@esri/solutions-components 1.1.0-next.20250815 → 1.1.0-next.20250819
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/{MZD64NYC.js → 24BDVPNH.js} +2 -2
- package/dist/cdn/{UBY64AYO.js → 2CEVCB6G.js} +2 -2
- package/dist/cdn/{GUJQ72VR.js → 2KLVK3DF.js} +2 -2
- package/dist/cdn/{P6U5F5YW.js → 2NX64ETW.js} +2 -2
- package/dist/cdn/{FZ5B72B6.js → 2PX7QCE5.js} +2 -2
- package/dist/cdn/{64UDM5WE.js → 2QN6VCK5.js} +2 -2
- package/dist/cdn/{WMC7HFYJ.js → 2XM25TAX.js} +2 -2
- package/dist/cdn/{JCBVJ5SW.js → 34E2LY63.js} +2 -2
- package/dist/cdn/{NPILEPIB.js → 3HMTTM32.js} +2 -2
- package/dist/cdn/{7ATSFN2Q.js → 3KRR3EWC.js} +2 -2
- package/dist/cdn/{QVGWI7BH.js → 3NDKI6NH.js} +2 -2
- package/dist/cdn/{M4G7D2JU.js → 3OHVOUJI.js} +2 -2
- package/dist/cdn/3R27T5NF.js +4 -0
- package/dist/cdn/{KFHDLQ4N.js → 3T3QPZTS.js} +1 -1
- package/dist/cdn/{Q7WB6ARM.js → 3VJ2UAF3.js} +2 -2
- package/dist/cdn/{S4KTRO4X.js → 3Z752QPI.js} +2 -2
- package/dist/cdn/{QRNKCW6S.js → 3ZSBXV3T.js} +2 -2
- package/dist/cdn/{RUYHLRTB.js → 4ACHVJAT.js} +2 -2
- package/dist/cdn/{SNQRHLBA.js → 4BBJTWZM.js} +2 -2
- package/dist/cdn/{LRMCH3HQ.js → 4NXWAPLL.js} +2 -2
- package/dist/cdn/{LZVOPEFK.js → 4RPS5OUS.js} +2 -2
- package/dist/cdn/4TAO7CZ6.js +18 -0
- package/dist/cdn/{ZNDVVXJV.js → 4VMTPD3X.js} +2 -2
- package/dist/cdn/{7SY4BRZV.js → 4XQLIJVE.js} +2 -2
- package/dist/cdn/{2ACSYRE6.js → 4XY265GH.js} +2 -2
- package/dist/cdn/{XHHM7WRB.js → 52DTSHHU.js} +3 -3
- package/dist/cdn/56HI5OZX.js +4 -0
- package/dist/cdn/{373MVXFL.js → 57MRFRBK.js} +1 -1
- package/dist/cdn/{J2XAG6XE.js → 5GSANUEI.js} +2 -2
- package/dist/cdn/{3F7AZTXH.js → 5PAFS5IG.js} +2 -2
- package/dist/cdn/5U4JK67I.js +4 -0
- package/dist/cdn/{HEIEIXYZ.js → 5UQVMELP.js} +2 -2
- package/dist/cdn/{YIU4RUM7.js → 654EUDXI.js} +2 -2
- package/dist/cdn/{6TMUW6FN.js → 65YWJHM4.js} +2 -2
- package/dist/cdn/{WKRDZB5Y.js → 67XBBPRO.js} +1 -1
- package/dist/cdn/{MMJ6OWRV.js → 6I65R44J.js} +1 -1
- package/dist/cdn/{5IOUK6U7.js → 6LCQVOOF.js} +2 -2
- package/dist/cdn/{N4NSA6LQ.js → 6LX6EBYJ.js} +2 -2
- package/dist/cdn/{SJHVU2TJ.js → 6U3K5YN7.js} +2 -2
- package/dist/cdn/{LVK6HFBV.js → 6VYGTDV4.js} +2 -2
- package/dist/cdn/{BW7HJGUE.js → 72XFI4RT.js} +2 -2
- package/dist/cdn/{P77RI7MD.js → 742IZCHX.js} +2 -2
- package/dist/cdn/{R6WAH5Y3.js → 7BTFQ7GB.js} +2 -2
- package/dist/cdn/{5U3ANZSH.js → 7DM3LKUS.js} +2 -2
- package/dist/cdn/{C4W6ZPLF.js → 7MLPJTWX.js} +2 -2
- package/dist/cdn/{ZSEI5RSC.js → 7MM6S4IL.js} +1 -1
- package/dist/cdn/7QS77URH.js +18 -0
- package/dist/cdn/{UIRBREW2.js → 7XCWJLB2.js} +2 -2
- package/dist/cdn/{ZBMOD4UQ.js → 7XT6DNUL.js} +1 -1
- package/dist/cdn/{NGQNRGLE.js → A3O6JMNA.js} +2 -2
- package/dist/cdn/A6AHNC5I.js +4 -0
- package/dist/cdn/{NFFANNF6.js → A76UWUIW.js} +2 -2
- package/dist/cdn/{LEGWW7SW.js → ACRCQUQS.js} +2 -2
- package/dist/cdn/{5KZOOCNV.js → AFKXBLKS.js} +2 -2
- package/dist/cdn/{SAXQNX3E.js → AMXYZ4OK.js} +1 -1
- package/dist/cdn/{RYUXHMB6.js → ANCO2LXL.js} +2 -2
- package/dist/cdn/{QDMVTLGB.js → ANEQF73J.js} +2 -2
- package/dist/cdn/ATSKQV75.js +4 -0
- package/dist/cdn/{FL7X4EW4.js → AXWVCHHB.js} +2 -2
- package/dist/cdn/{BNDH7DJ4.js → AY5CM33Y.js} +2 -2
- package/dist/cdn/{UCPBOOCL.js → BBAR5XKN.js} +2 -2
- package/dist/cdn/{4LXMVIWS.js → BCPDYBW6.js} +2 -2
- package/dist/cdn/{2IH2SIFN.js → BG6GLWG2.js} +1 -1
- package/dist/cdn/{XPCWYH6T.js → BGANBCPS.js} +2 -2
- package/dist/cdn/{V4RD2TOQ.js → BHNIWP2D.js} +1 -1
- package/dist/cdn/{PBNKVK4U.js → BKO27JVX.js} +2 -2
- package/dist/cdn/{3M43ZGL4.js → BLDAOYIG.js} +2 -2
- package/dist/cdn/{BABLK2FR.js → BOKOWFEO.js} +2 -2
- package/dist/cdn/{XPUM7UXM.js → BXAORZL4.js} +2 -2
- package/dist/cdn/{YRPKNK6P.js → BYDCJ4VZ.js} +1 -1
- package/dist/cdn/{YGRRQ64K.js → C66LGOL3.js} +2 -2
- package/dist/cdn/{DVFLQMVJ.js → CLESAR42.js} +2 -2
- package/dist/cdn/{VW7GR7XC.js → DEAO7LKH.js} +2 -2
- package/dist/cdn/{5GBUXTAG.js → DIID6F24.js} +2 -2
- package/dist/cdn/{Z6U7AKR4.js → DIUE32QA.js} +2 -2
- package/dist/cdn/{VIAOSFKI.js → DNAHE6B3.js} +2 -2
- package/dist/cdn/{ULJ3L776.js → DNE6MITH.js} +2 -2
- package/dist/cdn/{YC34Y3D7.js → DP6MNEO2.js} +2 -2
- package/dist/cdn/{BGEHQBN5.js → DPYO4UNZ.js} +1 -1
- package/dist/cdn/{RMQ7DGV6.js → DWL3QSPA.js} +2 -2
- package/dist/cdn/{2BSCJY6H.js → E2B4PX5E.js} +2 -2
- package/dist/cdn/{XLT3R6PW.js → E5O3SDQO.js} +2 -2
- package/dist/cdn/{RXHIXE4I.js → EAGLALAQ.js} +1 -1
- package/dist/cdn/{CQ22Q6F6.js → EB2PKDO6.js} +2 -2
- package/dist/cdn/{S7LHDN35.js → EFCGDNV5.js} +2 -2
- package/dist/cdn/{J6NX7SB6.js → EJAPQXFI.js} +2 -2
- package/dist/cdn/{LEGOR3KT.js → EJD4FG7F.js} +2 -2
- package/dist/cdn/{JW4HSEDN.js → ELYCXPDG.js} +2 -2
- package/dist/cdn/{GSOAXW2C.js → EMQCI6RG.js} +2 -2
- package/dist/cdn/{GDRFM65R.js → F2FAIAU2.js} +2 -2
- package/dist/cdn/{6XZ6AQM3.js → F7BRX5TN.js} +2 -2
- package/dist/cdn/{QRVZLEG7.js → F7EZLC62.js} +2 -2
- package/dist/cdn/{OWJ64LTS.js → FAPGFPOJ.js} +1 -1
- package/dist/cdn/{XIDJM47C.js → FKJ74KL2.js} +2 -2
- package/dist/cdn/{MJD3VGP3.js → FN2WRV4R.js} +2 -2
- package/dist/cdn/{PISE6C5K.js → FOGK56KV.js} +1 -1
- package/dist/cdn/{7MOYCP6M.js → FPVE7DKQ.js} +2 -2
- package/dist/cdn/{DCQWYHFI.js → FV5ATVEG.js} +2 -2
- package/dist/cdn/{INZ4E7JC.js → FVXZDOFO.js} +2 -2
- package/dist/cdn/{4SHIHRI6.js → FY5UZTY6.js} +1 -1
- package/dist/cdn/{CC62255Q.js → FZTZRSVE.js} +3 -3
- package/dist/cdn/{EBCZJVZD.js → GAIWNYWL.js} +2 -2
- package/dist/cdn/{65BFHCFZ.js → GE225ZJ6.js} +1 -1
- package/dist/cdn/{GYPMG4AG.js → GGG4CDGN.js} +1 -1
- package/dist/cdn/{LHPPTRV3.js → GK6IMCNG.js} +2 -2
- package/dist/cdn/{NZ34CHFA.js → GMCNEOK7.js} +2 -2
- package/dist/cdn/{ANQYJYU3.js → GNRZEXFN.js} +2 -2
- package/dist/cdn/{ITRRLAGE.js → GOISV2LT.js} +2 -2
- package/dist/cdn/{VTZ2ZWLV.js → GTUZ7LWY.js} +4 -4
- package/dist/cdn/{RE6254B2.js → GUJC76WT.js} +2 -2
- package/dist/cdn/{Z2FDJVKJ.js → GW66TTO2.js} +2 -2
- package/dist/cdn/{SPTLBRGM.js → GX2F4JGM.js} +1 -1
- package/dist/cdn/{YPAK67G7.js → GX36OVTS.js} +2 -2
- package/dist/cdn/{WSQ4SDXE.js → H465VNWN.js} +2 -2
- package/dist/cdn/{L4F4ICSP.js → H6MJF5YU.js} +2 -2
- package/dist/cdn/{3SCTVV5V.js → H6N72YM6.js} +1 -1
- package/dist/cdn/{4KLZCSZT.js → HCN44RZN.js} +2 -2
- package/dist/cdn/{W2AL4J2S.js → HFIFNLE6.js} +2 -2
- package/dist/cdn/{3MJONNJ7.js → HNGEXL62.js} +2 -2
- package/dist/cdn/{YO34Q6VS.js → HUHERRGE.js} +2 -2
- package/dist/cdn/I5HJNSNJ.js +4 -0
- package/dist/cdn/{JIKAOXY7.js → I6W4OLBS.js} +2 -2
- package/dist/cdn/{QTYDBQQ4.js → ICENJ546.js} +2 -2
- package/dist/cdn/{RF6BRNT4.js → IGVLUS3C.js} +2 -2
- package/dist/cdn/{FH6FZK7W.js → IJSMSB7D.js} +2 -2
- package/dist/cdn/INHVYJZT.js +4 -0
- package/dist/cdn/{AAQ7TMV6.js → INZPC2AB.js} +2 -2
- package/dist/cdn/{T6DVJJA5.js → IRNQSIXL.js} +2 -2
- package/dist/cdn/{2AMQDK5P.js → IUYH43JJ.js} +2 -2
- package/dist/cdn/{B6V3FZMS.js → IWJ2ZMNS.js} +2 -2
- package/dist/cdn/{5FOVVNQB.js → IXAWNCC5.js} +1 -1
- package/dist/cdn/{JUXNODXX.js → J2QF245E.js} +2 -2
- package/dist/cdn/{MTPSVAYA.js → J5ZCK3TK.js} +2 -2
- package/dist/cdn/{5CVMZFE2.js → J76PFNGB.js} +1 -1
- package/dist/cdn/{VZSZYLGB.js → J7YCPSUF.js} +2 -2
- package/dist/cdn/{4NFTXSFW.js → JHVO3CP7.js} +2 -2
- package/dist/cdn/{QSNTZEVL.js → JI2SAYCM.js} +2 -2
- package/dist/cdn/{D2WQUGXN.js → JJPZUFAZ.js} +2 -2
- package/dist/cdn/{QZIHEYLI.js → JONOM255.js} +2 -2
- package/dist/cdn/{VVGAWSJE.js → JQ22K6BZ.js} +2 -2
- package/dist/cdn/{NCHZK4VU.js → JTXFOO3I.js} +2 -2
- package/dist/cdn/{T3LKRCPT.js → K22KBOKY.js} +2 -2
- package/dist/cdn/{VEXXHCVL.js → K2LV3XD3.js} +2 -2
- package/dist/cdn/{4E7IAOL6.js → K2NMCDVM.js} +2 -2
- package/dist/cdn/{SG3I3BVR.js → K3YIW6KT.js} +1 -1
- package/dist/cdn/{HUFFSCY7.js → K53OL6JR.js} +2 -2
- package/dist/cdn/{WZMK4MMI.js → K73ZDL6T.js} +2 -2
- package/dist/cdn/K7ZA3FFC.js +4 -0
- package/dist/cdn/{OJRNLIHO.js → KQECYLAL.js} +2 -2
- package/dist/cdn/{5UWMW4LC.js → L2ZBG3JF.js} +2 -2
- package/dist/cdn/{GLP6MIWB.js → L3DBBV2W.js} +2 -2
- package/dist/cdn/{T6TUYLFG.js → L4CC4KNJ.js} +2 -2
- package/dist/cdn/{NFLORG7T.js → LB3TT43G.js} +2 -2
- package/dist/cdn/{3APRWDB5.js → LDJYSN5D.js} +2 -2
- package/dist/cdn/{XMKDFJEI.js → LDVZXGKZ.js} +2 -2
- package/dist/cdn/{O5MIRZG4.js → LHFFIZ22.js} +2 -2
- package/dist/cdn/{TL3SGMXL.js → LJWVIPZW.js} +2 -2
- package/dist/cdn/{EH5Q3QVP.js → LKCO6XND.js} +2 -2
- package/dist/cdn/{KOVBSK5N.js → LLILUCX4.js} +2 -2
- package/dist/cdn/{EDM4AY7G.js → LQACV2LW.js} +1 -1
- package/dist/cdn/{UIVIH2JN.js → LXH2SO43.js} +2 -2
- package/dist/cdn/{C3CQPITQ.js → LZQICKVC.js} +2 -2
- package/dist/cdn/{GYNVIHME.js → M6D4LGKQ.js} +2 -2
- package/dist/cdn/{RSTE37Y6.js → M7GBGDGE.js} +2 -2
- package/dist/cdn/{GMB5YWAG.js → MBUU52CZ.js} +2 -2
- package/dist/cdn/{WUMV4GRB.js → MCGFHROH.js} +2 -2
- package/dist/cdn/{T3EZV3I7.js → MF3OG4VY.js} +2 -2
- package/dist/cdn/{J4TGWZQP.js → MK3RPYXC.js} +2 -2
- package/dist/cdn/{WOUNP7CD.js → MQGQPICI.js} +2 -2
- package/dist/cdn/{IXWP62CT.js → N4BBS2LR.js} +2 -2
- package/dist/cdn/{MTO5Q5HN.js → NBAZK6OZ.js} +2 -2
- package/dist/cdn/{U62E5D2W.js → NJVZY5MD.js} +2 -2
- package/dist/cdn/{NBQOQX3B.js → NLFYNOUR.js} +2 -2
- package/dist/cdn/{GYCCV2BC.js → NOEXEMV5.js} +2 -2
- package/dist/cdn/{O2ADEHEI.js → NOLFW52G.js} +2 -2
- package/dist/cdn/{UNDPQUM5.js → NQ6M4LUU.js} +2 -2
- package/dist/cdn/{XP5S366J.js → NTRY3XB6.js} +2 -2
- package/dist/cdn/{UKMX74FI.js → NVHT3Y7W.js} +2 -2
- package/dist/cdn/{SP6JOJNB.js → NYNSAPTM.js} +2 -2
- package/dist/cdn/{72AX53JS.js → O2EOV3CJ.js} +2 -2
- package/dist/cdn/{STAZFWK4.js → O2IV4JMW.js} +2 -2
- package/dist/cdn/O7BZMNSE.js +4 -0
- package/dist/cdn/{LQ5QP2NN.js → ODW4STKJ.js} +2 -2
- package/dist/cdn/{WO2OLP6R.js → OFD6SR37.js} +2 -2
- package/dist/cdn/{YIJ4PX2R.js → ONWGDZT5.js} +2 -2
- package/dist/cdn/{CBB7A3AU.js → OO6IJCH4.js} +2 -2
- package/dist/cdn/{WWZAAQL7.js → OPTN3ME6.js} +2 -2
- package/dist/cdn/{EGQ5A6HA.js → OSCAEMPD.js} +2 -2
- package/dist/cdn/{4E7Q4S3L.js → OVJQ6OFH.js} +3 -3
- package/dist/cdn/{56APFWY2.js → OYZEM335.js} +1 -1
- package/dist/cdn/{IO6BJTEY.js → PIVVK35A.js} +2 -2
- package/dist/cdn/{2CYGYVSW.js → PR3CDOEP.js} +2 -2
- package/dist/cdn/{Y4LLUPJ4.js → PXCMVTKZ.js} +2 -2
- package/dist/cdn/{Z7SHIC4B.js → PXX4HFO5.js} +2 -2
- package/dist/cdn/{S45UXB6P.js → QAHIP2GX.js} +2 -2
- package/dist/cdn/{QO54BLLR.js → QDQOYMUU.js} +2 -2
- package/dist/cdn/{JTIENAFY.js → QHOELTKY.js} +2 -2
- package/dist/cdn/{WSIZYEL6.js → QJCXGJ6L.js} +2 -2
- package/dist/cdn/{6TNQR5ZZ.js → QPUATAAE.js} +2 -2
- package/dist/cdn/{AEMZJWR3.js → QR6CKG42.js} +2 -2
- package/dist/cdn/{XXOFBYMX.js → QRR2NNVK.js} +2 -2
- package/dist/cdn/{BIFJWEGT.js → QY7M2QSI.js} +2 -2
- package/dist/cdn/{7GF2QS2Z.js → R22QQKTW.js} +2 -2
- package/dist/cdn/{QIEWADMK.js → RAKIXVX2.js} +2 -2
- package/dist/cdn/{TXDOADWV.js → RCWLSY6I.js} +2 -2
- package/dist/cdn/{7A27PIVW.js → RDI63QRY.js} +2 -2
- package/dist/cdn/{QEGPKXH5.js → RHADMR4Z.js} +2 -2
- package/dist/cdn/{USVU75S5.js → ROYZJIEE.js} +2 -2
- package/dist/cdn/{6CS66UKI.js → S6ZH56JW.js} +2 -2
- package/dist/cdn/{WCGAPOG7.js → SA64VJDS.js} +2 -2
- package/dist/cdn/{R72XZLYM.js → SAH5BHRY.js} +1 -1
- package/dist/cdn/{RJQ7FAWD.js → SDJB7VSM.js} +2 -2
- package/dist/cdn/{KKOUGJZ3.js → SE23DFGC.js} +2 -2
- package/dist/cdn/{2XGTWAXZ.js → SQEH2DIV.js} +2 -2
- package/dist/cdn/{TABFXZLH.js → SQLK6YCV.js} +1 -1
- package/dist/cdn/{753GYI2V.js → SUOAKQEN.js} +2 -2
- package/dist/cdn/{TPAJAUQ7.js → SX3XDGQ6.js} +2 -2
- package/dist/cdn/{BVCIQYS4.js → SY5E3AVJ.js} +2 -2
- package/dist/cdn/{OZOV3BXJ.js → T2H7M2DI.js} +2 -2
- package/dist/cdn/{TLURR24J.js → T7F435GA.js} +2 -2
- package/dist/cdn/{TMO7U5HG.js → TACC72BQ.js} +2 -2
- package/dist/cdn/TAQN3MIW.js +18 -0
- package/dist/cdn/{AX3QFNZU.js → TEUVGOIY.js} +1 -1
- package/dist/cdn/{LEO6R7M7.js → TEXRB7NV.js} +2 -2
- package/dist/cdn/{CY4VLS3L.js → TFCKOEWL.js} +2 -2
- package/dist/cdn/{MMVMR4CD.js → TGBNBAXL.js} +2 -2
- package/dist/cdn/{2VROFSSM.js → THBUB5W7.js} +2 -2
- package/dist/cdn/{UC76MY6A.js → TK77BTJO.js} +2 -2
- package/dist/cdn/TNISXZRI.js +4 -0
- package/dist/cdn/{SPN442VG.js → TR4FJOX7.js} +1 -1
- package/dist/cdn/{HXSFGHXJ.js → TS7OFSKI.js} +2 -2
- package/dist/cdn/{VOLPH3TZ.js → TTGOCUOI.js} +2 -2
- package/dist/cdn/{D63R7E62.js → TU2VOXF6.js} +2 -2
- package/dist/cdn/{WZB7VHMS.js → TWGXRZ74.js} +2 -2
- package/dist/cdn/{2PIO4UB6.js → TYJ45GML.js} +2 -2
- package/dist/cdn/{PIJGR7YJ.js → U24LTB7J.js} +2 -2
- package/dist/cdn/{S7RGQP6Q.js → U2G7TTSF.js} +1 -1
- package/dist/cdn/{47AI6GVS.js → U5G7EA6M.js} +2 -2
- package/dist/cdn/{63XCFOCE.js → U63F2JDU.js} +2 -2
- package/dist/cdn/{65SLMV27.js → U7OHC5AQ.js} +2 -2
- package/dist/cdn/{V52WO4IY.js → UALKPXS3.js} +2 -2
- package/dist/cdn/{AUIDXQWK.js → UAVULCVS.js} +2 -2
- package/dist/cdn/{XONQMW52.js → UAXZFV4N.js} +2 -2
- package/dist/cdn/{MTUWIJJX.js → UB7PE3AY.js} +2 -2
- package/dist/cdn/{7REB5YFW.js → UMGOFUDS.js} +2 -2
- package/dist/cdn/{EHRG3P4A.js → UNUUESGY.js} +2 -2
- package/dist/cdn/{5GSU5Q3A.js → UTV27VN5.js} +2 -2
- package/dist/cdn/{Q6PH6YZW.js → UUIXKWJE.js} +2 -2
- package/dist/cdn/{55C4OZSK.js → UXLMABXA.js} +2 -2
- package/dist/cdn/UZJSQPSQ.js +4 -0
- package/dist/cdn/{X4RKMWOI.js → VBF5CTG3.js} +2 -2
- package/dist/cdn/{DZJZLLFO.js → VK2K5XNT.js} +2 -2
- package/dist/cdn/{KYJBLZWV.js → VLHVZ4SR.js} +2 -2
- package/dist/cdn/{WQWWVJ6Y.js → VMWDPJTM.js} +1 -1
- package/dist/cdn/VRAOCHFE.js +18 -0
- package/dist/cdn/{UW7TK7IN.js → VYLW2IDP.js} +2 -2
- package/dist/cdn/{MTNYXAMF.js → VYMRAN74.js} +2 -2
- package/dist/cdn/{WSRLB25S.js → W4HZTMNT.js} +1 -1
- package/dist/cdn/WB4LTDQP.js +4 -0
- package/dist/cdn/{2ARFKQYA.js → WEP26LHX.js} +2 -2
- package/dist/cdn/{B5XW62UJ.js → WG2NYCMG.js} +2 -2
- package/dist/cdn/{F4GMI7UW.js → WQ4TGR3C.js} +2 -2
- package/dist/cdn/{A6TJ43SY.js → WQ6KFVZN.js} +2 -2
- package/dist/cdn/{RP5O4R4Q.js → WV64QIRZ.js} +2 -2
- package/dist/cdn/{P4QXKHJD.js → WZMJH2DL.js} +1 -1
- package/dist/cdn/{TXLD3HTX.js → X2H43HYH.js} +1 -1
- package/dist/cdn/{WQBVFBYJ.js → X3XSZ65Y.js} +2 -2
- package/dist/cdn/{UGRPKRXZ.js → XB5P4EQI.js} +1 -1
- package/dist/cdn/{6CXWPWTQ.js → XCEMSPXE.js} +2 -2
- package/dist/cdn/{EFF5HM4F.js → XSIKQNNC.js} +2 -2
- package/dist/cdn/XSLY3IGZ.js +4 -0
- package/dist/cdn/{WEEGLWK2.js → XVEEFPUJ.js} +2 -2
- package/dist/cdn/XXCFRRLF.js +4 -0
- package/dist/cdn/{2PFRKBKP.js → Y6JZAFOX.js} +2 -2
- package/dist/cdn/Y7NS4JZS.js +18 -0
- package/dist/cdn/{3TJW2FOV.js → YA3RB4C4.js} +2 -2
- package/dist/cdn/{NPJIXRI3.js → YABH5PBS.js} +2 -2
- package/dist/cdn/{CFB2JIFI.js → YC3RTILK.js} +2 -2
- package/dist/cdn/{7G3F2NKE.js → YM6V6R3R.js} +2 -2
- package/dist/cdn/{YXNGYSMG.js → YN55LX3C.js} +1 -1
- package/dist/cdn/{2P3ODD4H.js → YRTVPKDV.js} +2 -2
- package/dist/cdn/{J3Y7ENAJ.js → YXHCXL4G.js} +2 -2
- package/dist/cdn/{ULQGQTU5.js → Z422BYVK.js} +2 -2
- package/dist/cdn/ZBCWEZ6Q.js +4 -0
- package/dist/cdn/{7GYNJ6QO.js → ZCJWOG36.js} +2 -2
- package/dist/cdn/{EZ67V244.js → ZCZBE7ES.js} +2 -2
- package/dist/cdn/{7MQULQBP.js → ZD5J7YJA.js} +2 -2
- package/dist/cdn/{UD37ZTZQ.js → ZDPXDUJD.js} +2 -2
- package/dist/cdn/{UCWFPZHR.js → ZIL5UCFT.js} +2 -2
- package/dist/cdn/{ZCSXNNNE.js → ZJAISNB5.js} +2 -2
- package/dist/cdn/{BTYX4Q5L.js → ZJE4EEE4.js} +2 -2
- package/dist/cdn/{OR4TROLT.js → ZP3BQCVA.js} +1 -1
- package/dist/cdn/{K6J5UV76.js → ZR74FN7G.js} +1 -1
- package/dist/cdn/{7Q3BPIIY.js → ZSX3D43K.js} +1 -1
- package/dist/cdn/{55FH2YE4.js → ZZC4NGY5.js} +2 -2
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/solution-deployed-card/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/index.js +2 -2
- package/dist/chunks/Auth.js +1 -1
- package/dist/chunks/appConfig.js +1 -1
- package/dist/chunks/cardFetchingUtils.js +1 -1
- package/dist/chunks/common.js +1 -1
- package/dist/chunks/deployAppContexts.js +1 -1
- package/dist/chunks/downloadUtils.js +1 -1
- package/dist/chunks/getItemIcon.js +1 -1
- package/dist/chunks/helpers.js +1 -1
- package/dist/chunks/index.js +1 -1
- package/dist/chunks/interfaces.js +1 -1
- package/dist/chunks/loadModules.js +1 -1
- package/dist/chunks/mapViewUtils.js +1 -1
- package/dist/chunks/pciUtils.js +1 -1
- package/dist/chunks/popupUtils.js +1 -1
- package/dist/chunks/prepareDataForSolutionDisplay.js +1 -1
- package/dist/chunks/privilegeUtils.js +1 -1
- package/dist/chunks/publicNotificationStore.js +1 -1
- package/dist/chunks/queryUtils.js +1 -1
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/solution-store.js +1 -1
- package/dist/chunks/templates.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/components/arcgis-solutions-assistant/customElement.js +1 -1
- package/dist/components/basemap-gallery/customElement.js +1 -1
- package/dist/components/buffer-tools/customElement.js +1 -1
- package/dist/components/card-manager/customElement.js +1 -1
- package/dist/components/consent-manager/customElement.js +1 -1
- package/dist/components/create-feature/customElement.js +1 -1
- package/dist/components/create-related-feature/customElement.js +1 -1
- package/dist/components/crowdsource-manager/customElement.js +1 -1
- package/dist/components/crowdsource-reporter/customElement.js +1 -1
- package/dist/components/deduct-calculator/customElement.js +1 -1
- package/dist/components/delete-button/customElement.js +1 -1
- package/dist/components/delete-dialog/customElement.js +1 -1
- package/dist/components/edit-card/customElement.js +1 -1
- package/dist/components/feature-details/customElement.js +1 -1
- package/dist/components/feature-list/customElement.js +1 -1
- package/dist/components/field-selection/customElement.js +1 -1
- package/dist/components/floor-filter/customElement.js +1 -1
- package/dist/components/info-card/customElement.js +1 -1
- package/dist/components/json-editor/customElement.js +1 -1
- package/dist/components/layer-list/customElement.js +1 -1
- package/dist/components/layer-table/customElement.js +1 -1
- package/dist/components/map-card/customElement.js +1 -1
- package/dist/components/map-draw-tools/customElement.js +1 -1
- package/dist/components/map-fullscreen/customElement.js +1 -1
- package/dist/components/map-layer-picker/customElement.js +1 -1
- package/dist/components/map-legend/customElement.js +1 -1
- package/dist/components/map-picker/customElement.js +1 -1
- package/dist/components/map-search/customElement.js +1 -1
- package/dist/components/map-select-tools/customElement.js +1 -1
- package/dist/components/map-tools/customElement.js +1 -1
- package/dist/components/pci-calculator/customElement.js +1 -1
- package/dist/components/pdf-download/customElement.js +1 -1
- package/dist/components/public-notification/customElement.js +1 -1
- package/dist/components/refine-selection/customElement.js +1 -1
- package/dist/components/selection-tool/customElement.js +1 -1
- package/dist/components/solution-article-card/customElement.js +1 -1
- package/dist/components/solution-configuration/customElement.js +1 -1
- package/dist/components/solution-configure-dialog/customElement.js +18 -15
- package/dist/components/solution-configure-dialog/index.d.ts +1 -1
- package/dist/components/solution-configure-dialog/index.js +1 -1
- package/dist/components/solution-configure-titles/customElement.js +1 -1
- package/dist/components/solution-contents/customElement.js +1 -1
- package/dist/components/solution-delete-dialog/customElement.js +1 -1
- package/dist/components/solution-deploy-dialog/customElement.js +1 -1
- package/dist/components/solution-deployed-card/customElement.js +1 -1
- package/dist/components/solution-deploying-dialog/customElement.js +1 -1
- package/dist/components/solution-details-card/customElement.js +1 -1
- package/dist/components/solution-details-panel/customElement.js +25 -25
- package/dist/components/solution-item/customElement.js +1 -1
- package/dist/components/solution-item-accordion/customElement.js +1 -1
- package/dist/components/solution-item-details/customElement.js +1 -1
- package/dist/components/solution-item-diagram/customElement.js +1 -1
- package/dist/components/solution-item-icon/customElement.js +1 -1
- package/dist/components/solution-item-sharing/customElement.js +1 -1
- package/dist/components/solution-organization-variables/customElement.js +1 -1
- package/dist/components/solution-resource-item/customElement.js +1 -1
- package/dist/components/solution-snapshot-gallery/customElement.js +1 -1
- package/dist/components/solution-social-share/customElement.js +1 -1
- package/dist/components/solution-spatial-ref/customElement.js +1 -1
- package/dist/components/solution-template-data/customElement.js +1 -1
- package/dist/components/solution-variables/customElement.js +1 -1
- package/dist/components/solutions-all-panel/customElement.js +1 -1
- package/dist/components/solutions-all-shell/customElement.js +13 -13
- package/dist/components/solutions-article-panel/customElement.js +1 -1
- package/dist/components/solutions-articles/customElement.js +1 -1
- package/dist/components/solutions-articles-shell/customElement.js +1 -1
- package/dist/components/solutions-deployed-panel/customElement.js +1 -1
- package/dist/components/solutions-deployed-shell/customElement.js +10 -10
- package/dist/components/solutions-filter-panel/customElement.js +1 -1
- package/dist/components/spatial-ref/customElement.js +1 -1
- package/dist/components/store-manager/customElement.js +1 -1
- package/dist/docs/api.json +2 -2
- package/dist/docs/docs.json +2 -2
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.js +1 -1
- package/package.json +1 -1
- package/dist/cdn/6JRE2N3F.js +0 -4
- package/dist/cdn/6T5TGQVX.js +0 -4
- package/dist/cdn/C2LJQG3Q.js +0 -4
- package/dist/cdn/D54CFOJO.js +0 -4
- package/dist/cdn/E2THKIQY.js +0 -4
- package/dist/cdn/F5Y3ZOZL.js +0 -4
- package/dist/cdn/FQDGFBRY.js +0 -18
- package/dist/cdn/JD2LCA3A.js +0 -4
- package/dist/cdn/LX3CIHRP.js +0 -18
- package/dist/cdn/MGAL6MZ5.js +0 -4
- package/dist/cdn/OJOO3PAW.js +0 -4
- package/dist/cdn/OLORFY6S.js +0 -4
- package/dist/cdn/P6LITD7G.js +0 -4
- package/dist/cdn/P6ZOYFLQ.js +0 -4
- package/dist/cdn/PTDMGHOW.js +0 -18
- package/dist/cdn/QVWXK4N2.js +0 -4
- package/dist/cdn/SKPY6EQZ.js +0 -4
- package/dist/cdn/WPCKEGGG.js +0 -4
- package/dist/cdn/YHTJPECZ.js +0 -18
- package/dist/cdn/YRWVZN3U.js +0 -18
@@ -1,12 +1,12 @@
|
|
1
1
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
2
2
|
See https://js.arcgis.com/1.1/esri/copyright.txt for details.
|
3
|
-
v1.1.0-next.
|
4
|
-
import{a as Zn}from"./WSIZYEL6.js";import{a as Jn}from"./ZCSXNNNE.js";import"./INZ4E7JC.js";import"./DZJZLLFO.js";import{b as $n}from"./JW4HSEDN.js";import{h as qn,i as Hn,w as Zs,x as Qs,y as Wn}from"./XHHM7WRB.js";import"./R72XZLYM.js";(function(){let A=typeof globalThis=="object"&&globalThis||typeof global=="object"&&global.global===global&&global||typeof self=="object"&&self.self===self&&self||{};A.requestAnimationFrame===void 0&&(A.setImmediate===void 0?A.requestAnimationFrame=x=>A.setTimeout(x,0):A.requestAnimationFrame=A.setImmediate);class f{static tr=A.navigator!==void 0&&A.navigator.platform!==void 0&&A.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i)!==null;static Rk(t,e,i){let s=-1;return function(){let n=this,o=arguments;s!==-1&&f.Tg(s),s=f.ir(()=>{s=-1,i||t.apply(n,o)},e),i&&!s&&t.apply(n,o)}}static ir(t,e){return A.setTimeout(t,e)}static Tg(t){A.clearTimeout(t)}static hs(t){return A.document.createElement(t)}static o(t){throw new Error(t)}static L(t,e){let i="The object is frozen, so its properties cannot be set: "+t.toString();e!==void 0&&(i+=" to value: "+e),f.o(i)}static dE(t,e,i,s){}static s(t,e,i,s){}static gE(t,e,i){}static ec(t,e,i){if(t===null||typeof t!="object"){let s=f.fC(e);i!==void 0&&(s+="."+i),f.Zi(t,"object",s)}}static k(t,e,i){f.s(t,"function",e,i)}static mE(t,e,i){}static Zi(t,e,i,s){}static W(t,e,i,s){let n=f.fC(i);s!==void 0&&(n+="."+s),f.o(n+" is not in the range "+e+": "+t)}static Re(t){}static er(t,e){}static ni(t){A.console&&A.console.log(t)}static G(t){return t!==null&&typeof t=="object"}static it(t){return typeof t=="function"}static vk=[];static et(){let t=f.vk.pop();return t===void 0?[]:t}static J(t){t.length=0,f.vk.push(t)}static pE=Object.freeze([]);static fC(t){return t===null?"*":typeof t=="string"?t:f.it(t)?t.name:""}static Dn(t){return f.it(t)?t.className?t.className:t.name:f.G(t)&&t.constructor?f.Dn(t.constructor):typeof t}static Uh(t,e){return e==null||e===""?null:f.G(t)&&e in t||t[e]?t[e]:null}static toString(t){let e=t;return f.G(t)&&(t.text?e=t.text:t.name?e=t.name:t.key!==void 0?e=t.key:t.id!==void 0?e=t.id:t.constructor===Object&&(t.Text?e=t.Text:t.Name?e=t.Name:t.Key!==void 0?e=t.Key:t.Id!==void 0?e=t.Id:t.ID!==void 0&&(e=t.ID))),e===void 0?"undefined":e===null?"null":e.toString()}static gw(t,e){if(t.hasOwnProperty(e))return!0;let i=Object.getPrototypeOf(t);for(;i&&i!==Function;){if(i.hasOwnProperty(e))return!0;let s=i.yE;if(s&&s[e])return!0;i=Object.getPrototypeOf(i)}return!1}static WD(t){let e=[],i=0;for(i=0;i<256;i++)e[i]=i;let s=0,n=0;for(i=0;i<256;i++)s=(s+e[i]+119)%256,n=e[i],e[i]=e[s],e[s]=n;i=0,s=0;let o="";for(let r=0;r<t.length;r++)i=(i+1)%256,s=(s+e[i])%256,n=e[i],e[i]=e[s],e[s]=n,o+=String.fromCharCode(t.charCodeAt(r)^e[(e[i]+e[s])%256]);return o}static JD(t){let e="0123456789abcdef",i=[];for(let r=0;r<256;r++)i[e.charAt(r>>4)+e.charAt(r&15)]=String.fromCharCode(r);t.length%2&&(t="0"+t);let s=[],n=0;for(let r=0;r<t.length;r+=2)s[n++]=i[t.substring(r,r+2)];let o=s.join("");return o===""?"0":o}static Ts(t){return f.WD(f.JD(t))}static color1="@COLOR1";static color2="@COLOR2";static mw="32ab5ff3b26f42dc0ed90f21412913b5"}f.vfo="29e646fdb163";class V{Ok;constructor(){this.Ok=[]}toString(){return this.Ok.join("")}add(t){t!==""&&this.Ok.push(t)}}class q{}class W{g;constructor(){this.g=[]}[Symbol.iterator](){return this.g.values()}key;value;get iterator(){return this}reset(){}next(){return!1}hasNext(){return!1}first(){return null}any(){return!1}all(){return!0}each(){return this}map(t){return this}filter(){return this}get count(){return 0}ul(){}toString(){return"EmptyIterator"}static instance=new W}class ${constructor(t){this.key=-1,this.value=t}[Symbol.iterator](){return[this.value].values()}key;value;get iterator(){return this}reset(){this.key=-1}next(){return this.key===-1?(this.key=0,!0):!1}hasNext(){return this.next()}first(){return this.key=0,this.value}any(t){return this.key=-1,t(this.value)}all(t){return this.key=-1,t(this.value)}each(t){return this.key=-1,t(this.value),this}map(t){return new $(t(this.value))}filter(t){return t(this.value)?new $(this.value):W.instance}get count(){return 1}ul(){this.value=null}toString(){return"SingletonIterator("+this.value+")"}}class it{qt;Ds;Gt;At;constructor(t){this.qt=t,this.Ds=null,t.sr=null,this.Gt=t.nt,this.At=-1}[Symbol.iterator](){return this.Ds===null?this.qt.r.values():this.qt.r.filter(this.Ds).values()}key;value;get iterator(){return this}get predicate(){return this.Ds}set predicate(t){this.Ds=t}reset(){let t=this.qt;t.sr=null,this.Gt=t.nt,this.At=-1}next(){let t=this.qt;if(t.nt!==this.Gt){if(this.key<0)return!1;f.Re(t)}let e=t.r,i=e.length,s=++this.At,n=this.Ds;if(n!==null)for(;s<i;){let o=e[s];if(n(o))return this.At=s,this.key=s,this.value=o,!0;s++}else{if(s<i)return this.key=s,this.value=e[s],!0;this.ul()}return!1}hasNext(){return this.next()}first(){let t=this.qt;this.Gt=t.nt,this.At=0;let e=t.r,i=e.length,s=this.Ds;if(s!==null){let n=0;for(;n<i;){let o=e[n];if(s(o))return this.At=n,this.key=n,this.value=o,o;n++}return null}else if(i>0){let n=e[0];return this.key=0,this.value=n,n}else return null}any(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(t(a))return!0;e.nt!==i&&f.Re(e)}}return!1}all(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(!t(a))return!1;e.nt!==i&&f.Re(e)}}return!0}each(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];o!==null&&!o(a)||(t(a),e.nt!==i&&f.Re(e))}return this}map(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=[],n=e.r,o=n.length,r=this.Ds;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(s.push(t(l)),e.nt!==i&&f.Re(e))}let a=new j;return a.r=s,a.ve(),a.iterator}filter(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=[],n=e.r,o=n.length,r=this.Ds;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(t(l)&&s.push(l),e.nt!==i&&f.Re(e))}let a=new j;return a.r=s,a.ve(),a.iterator}get count(){let t=this.Ds;if(t!==null){let e=0,i=this.qt.r,s=i.length;for(let n=0;n<s;n++)t(i[n])&&e++;return e}else return this.qt.r.length}ul(){this.key=-1,this.value=null,this.Gt=-1,this.Ds=null,this.qt.sr=this}toString(){return"ListIterator@"+this.At+"/"+this.qt.count}}class ht{qt;Gt;At;constructor(t){this.qt=t,t.nr=null,this.Gt=t.nt,this.At=t.r.length}[Symbol.iterator](){return this.qt.r.reverse().values()}key;value;get iterator(){return this}reset(){let t=this.qt;t.nr=null,this.Gt=t.nt,this.At=t.r.length}next(){let t=this.qt;if(t.nt!==this.Gt){if(this.key<0)return!1;f.Re(t)}let e=--this.At;return e>=0?(this.key=e,this.value=t.r[e],!0):(this.ul(),!1)}hasNext(){return this.next()}first(){let t=this.qt;this.Gt=t.nt;let e=t.r,i=e.length-1;if(this.At=i,i>=0){let s=e[i];return this.key=i,this.value=s,s}else return null}any(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];if(t(r))return!0;e.nt!==i&&f.Re(e)}return!1}all(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];if(!t(r))return!1;e.nt!==i&&f.Re(e)}return!0}each(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];t(r),e.nt!==i&&f.Re(e)}return this}map(t){let e=this.qt;e.nr=null;let i=e.nt,s=[],n=e.r,o=n.length;this.At=o;for(let a=o-1;a>=0;a--){let h=n[a];s.push(t(h)),e.nt!==i&&f.Re(e)}let r=new j;return r.r=s,r.ve(),r.iterator}filter(t){let e=this.qt;e.nr=null;let i=e.nt,s=[],n=e.r,o=n.length;this.At=o;for(let a=o-1;a>=0;a--){let h=n[a];t(h)&&s.push(h),e.nt!==i&&f.Re(e)}let r=new j;return r.r=s,r.ve(),r.iterator}get count(){return this.qt.r.length}ul(){this.key=-1,this.value=null,this.Gt=-1,this.qt.nr=this}toString(){return"ListIteratorBackwards("+this.At+"/"+this.qt.count+")"}}class j{h;r;nt;sr;nr;constructor(t){I.Ki(this),this.h=!1,this.r=[],this.nt=0,this.sr=null,this.nr=null,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.r.values()}ve(){let t=this.nt;t++,t>999999999&&(t=0),this.nt=t}u(){return this.h=!0,this}Pt(){return this.h=!1,this}toString(){return"List()#"+I.as(this)}add(t){return this.h&&f.L(this,t),this.r.push(t),this.ve(),this}push(t){this.add(t)}addAll(t){if(t===null)return this;this.h&&f.L(this);let e=this.r;if(Array.isArray(t)){let i=t.length;for(let s=0;s<i;s++){let n=t[s];e.push(n)}}else{let i=t.iterator;for(;i.next();){let s=i.value;e.push(s)}}return this.ve(),this}clear(){this.h&&f.L(this),this.r.length=0,this.ve()}contains(t){return this.has(t)}has(t){return t===null?!1:this.r.indexOf(t)!==-1}indexOf(t){return t===null?-1:this.r.indexOf(t)}elt(t){let e=this.r;return(t<0||t>=e.length)&&f.W(t,"0 <= i < length",j,"elt:i"),e[t]}get(t){return this.elt(t)}setElt(t,e){let i=this.r;(t<0||t>=i.length)&&f.W(t,"0 <= i < length",j,"setElt:i"),this.h&&f.L(this,t),i[t]=e}set(t,e){this.setElt(t,e)}first(){let t=this.r;return t.length===0?null:t[0]}last(){let t=this.r,e=t.length;return e>0?t[e-1]:null}pop(){this.h&&f.L(this);let t=this.r;return t.length>0?t.pop():null}any(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++){if(t(e[n]))return!0;this.nt!==i&&f.Re(this)}return!1}all(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++){if(!t(e[n]))return!1;this.nt!==i&&f.Re(this)}return!0}each(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++)t(e[n]),this.nt!==i&&f.Re(this);return this}map(t){let e=new j,i=[],s=this.r,n=this.nt,o=s.length;for(let r=0;r<o;r++)i.push(t(s[r])),this.nt!==n&&f.Re(this);return e.r=i,e.ve(),e}filter(t){let e=new j,i=[],s=this.r,n=this.nt,o=s.length;for(let r=0;r<o;r++){let a=s[r];t(a)&&i.push(a),this.nt!==n&&f.Re(this)}return e.r=i,e.ve(),e}insertAt(t,e){t<0&&f.W(t,">= 0",j,"insertAt:i"),this.h&&f.L(this,t);let i=this.r;t>=i.length?i.push(e):i.splice(t,0,e),this.ve()}remove(t){return this.delete(t)}delete(t){if(t===null)return!1;this.h&&f.L(this,t);let e=this.r,i=e.indexOf(t);return i===-1?!1:(i===e.length-1?e.pop():e.splice(i,1),this.ve(),!0)}removeAt(t){let e=this.r;(t<0||t>=e.length)&&f.W(t,"0 <= i < length",j,"removeAt:i"),this.h&&f.L(this,t),t===e.length-1?e.pop():e.splice(t,1),this.ve()}removeRange(t,e){let i=this.r,s=i.length;if(t<0)t=0;else if(t>=s)return this;if(e<0)return this;if(e>=s&&(e=s-1),t>e)return this;this.h&&f.L(this);let n=t,o=e+1;for(;o<s;)i[n++]=i[o++];return i.length=s-(e-t+1),this.ve(),this}copy(){let t=new j,e=this.r;return e.length>0&&(t.r=Array.prototype.slice.call(e)),t}toArray(){let t=this.r,e=this.count,i=new Array(e);for(let s=0;s<e;s++)i[s]=t[s];return i}get uC(){return this.r}toSet(){let t=new I,e=this.r,i=this.count;for(let s=0;s<i;s++)t.add(e[s]);return t}sort(t){return this.h&&f.L(this),this.r.sort(t),this.ve(),this}sortRange(t,e,i){let s=this.r,n=s.length;e===void 0&&(e=0),i===void 0&&(i=n),this.h&&f.L(this);let o=i-e;if(o<=1)return this;if((e<0||e>=n-1)&&f.W(e,"0 <= from < length",j,"sortRange:from"),o===2){let r=s[e],a=s[e+1];return t(r,a)>0&&(s[e]=a,s[e+1]=r,this.ve()),this}if(e===0)if(i>=n)s.sort(t);else{let r=s.slice(0,i);r.sort(t);for(let a=0;a<i;a++)s[a]=r[a]}else if(i>=n){let r=s.slice(e);r.sort(t);for(let a=e;a<n;a++)s[a]=r[a-e]}else{let r=s.slice(e,i);r.sort(t);for(let a=e;a<i;a++)s[a]=r[a-e]}return this.ve(),this}reverse(){return this.h&&f.L(this),this.r.reverse(),this.ve(),this}get count(){return this.r.length}get size(){return this.r.length}get length(){return this.r.length}get iterator(){if(this.r.length<=0)return W.instance;let t=this.sr;return t!==null?(t.reset(),t):new it(this)}get iteratorBackwards(){if(this.r.length<=0)return W.instance;let t=this.nr;return t!==null?(t.reset(),t):new ht(this)}}class Tt{wo;ii;constructor(t){this.wo=t,this.ii=t.g.values()}[Symbol.iterator](){return this.wo.g.values()}key;value;get iterator(){return this}reset(){let t=this.wo;this.ii=t.g.values()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.wo.g.size===0?null:(this.ii=this.wo.g.values(),this.ii.next().value)}any(t){return this.wo.any(t)}all(t){return this.wo.all(t)}each(t){return this.wo.each(t),this}map(t){let e=new j;return this.wo.g.forEach(i=>e.add(t(i))),e.iterator}filter(t){let e=new j;return this.wo.g.forEach(i=>{t(i)&&e.add(i)}),e.iterator}get count(){return this.wo.count}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"SetIterator"}}class I{h;g;constructor(t){this.h=!1,this.g=new Set,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.values()}values(){return this.g.values()}u(){return this.h=!0,this}Pt(){return this.h=!1,this}toString(){return"Set()#"+I.as(this)}add(t){return t===null?this:(this.g.add(t),this)}addAll(t){if(t===null)return this;if(Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];s!==null&&this.g.add(s)}}else{let e=t.iterator;for(;e.next();){let i=e.value;i!==null&&this.g.add(i)}}return this}has(t){return this.g.has(t)}contains(t){return this.has(t)}containsAll(t){if(t===null)return!0;let e=t.iterator;for(;e.next();)if(!this.has(e.value))return!1;return!0}containsAny(t){if(t===null)return!0;let e=t.iterator;for(;e.next();)if(this.has(e.value))return!0;return!1}first(){return this.g.size===0?null:this.g.values().next().value}any(t){for(let e of this.g)if(t(e))return!0;return!1}all(t){for(let e of this.g)if(!t(e))return!1;return!0}each(t){for(let e of this.g)t(e);return this}map(t){let e=new I;for(let i of this.g)e.add(t(i));return e}filter(t){let e=new I;for(let i of this.g)t(i)&&e.add(i);return e}delete(t){return this.h&&f.L(this),this.g.delete(t)}remove(t){return this.delete(t)}removeAll(t){if(t===null)return this;if(this.h&&f.L(this),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++)this.delete(t[i])}else{let e=t.iterator;for(;e.next();)this.delete(e.value)}return this}retainAll(t){if(t===null)return this;if(this.count===0)return this;this.h&&f.L(this);let e=new I;e.addAll(t);let i=[],s=this.iterator;for(;s.next();){let n=s.value;e.has(n)||i.push(n)}return this.removeAll(i),this}clear(){this.h&&f.L(this),this.g.clear()}copy(){let t=new I;return this.g.forEach(e=>t.add(e)),t}toArray(){return Array.from(this.g)}toList(){let t=new j;return this.g.forEach(e=>t.add(e)),t}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?W.instance:new Tt(this)}entries(){return this.g.entries()}keys(){return this.g.keys()}forEach(t,e){return this.g.forEach(t,e)}static pw=1;static Ki(t){t.__gohashid=I.pw++}static as(t){return t.__gohashid}}class Rt{q;ii;constructor(t){this.q=t,this.ii=t.g.keys()}[Symbol.iterator](){return this.q.g.keys()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.keys()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.q.g.size===0?null:(this.ii=this.q.g.keys(),this.ii.next().value)}any(t){for(let e of this.q.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.q.g)t(e[0]);return this}map(t){let e=this.q,i=new j;for(let s of e.g)i.add(t(s[0]));return i.iterator}filter(t){let e=this.q,i=new j;for(let s of e.g){let n=s[0];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapKeySetIterator"}}class he extends I{q;constructor(t){super(),I.Ki(this),this.h=!0,this.q=t}[Symbol.iterator](){return this.g.keys()}values(){return this.g.keys()}u(){return this}Pt(){return this}toString(){return"MapKeySet("+this.q.toString()+")"}add(t){f.o("This Set is read-only: "+this.toString())}has(t){return this.q.has(t)}contains(t){return this.has(t)}delete(t){f.o("This Set is read-only: "+this.toString())}remove(t){return this.delete(t)}clear(){f.o("This Set is read-only: "+this.toString())}first(){return this.q.g.size===0?null:this.q.g.keys().next().value}any(t){for(let e of this.q.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.q.g)t(e[0]);return this}map(t){let e=new I;for(let i of this.q.g)e.add(t(i[0]));return e}filter(t){let e=new I;for(let i of this.q.g){let s=i[0];t(s)&&e.add(s)}return e}copy(){return new he(this.q)}toSet(){let t=new I,e=this.q.g;for(let i of e)t.add(i[0]);return t}toArray(){let t=this.q.g,e=new Array(t.size),i=0;for(let s of t)e[i]=s[0],i++;return e}toList(){let t=new j,e=this.q.g;for(let i of e)t.add(i[0]);return t}get count(){return this.q.size}get size(){return this.q.size}get iterator(){return this.q.size<=0?W.instance:new Rt(this.q)}}class Oe{q;ii;constructor(t){this.q=t,this.ii=t.g.values()}[Symbol.iterator](){return this.q.g.values()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.values()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.q.g.size===0?null:(this.ii=this.q.g.values(),this.ii.next().value)}any(t){for(let e of this.q.g)if(t(e[1]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[1]))return!1;return!0}each(t){for(let e of this.q.g)t(e[1]);return this}map(t){let e=this.q,i=new j;for(let s of e.g)i.add(t(s[1]));return i.iterator}filter(t){let e=this.q,i=new j;for(let s of e.g){let n=s[1];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapValueSetIterator"}}class Ut{constructor(t,e){this.key=t,this.value=e}toString(){return"{"+this.key+":"+this.value+"}"}key;value}class Wt{q;ii;constructor(t){this.q=t,this.ii=t.g.entries()}[Symbol.iterator](){return this.q.g.entries()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.entries()}next(){let t=this.ii.next();return t.done?(this.key=null,this.value=null,!1):(this.key=t.value[0],this.value=t.value[1],!0)}hasNext(){return this.next()}first(){if(this.q.g.size===0)return null;this.ii=this.q.g.entries();let t=this.ii.next().value;return this.key=t[0],this.value=t[1],new Ut(t[0],t[1])}any(t){return this.q.any(t)}all(t){return this.q.all(t)}each(t){return this.q.each(t),this}map(t){let e=new j,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ut(n,s):(i.key=n,i.value=s),e.add(t(i))}),e.iterator}filter(t){let e=new j,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ut(n,s):(i.key=n,i.value=s),t(i)&&(e.add(i),i=null)}),e.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapIterator"}}class pt{h;g;constructor(t){I.Ki(this),this.h=!1,this.g=new Map,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.entries()}entries(){return this.g.entries()}u(){return this.h=!0,this}Pt(){return this.h=!1,this}toString(){return"Map()#"+I.as(this)}set(t,e){return this.h&&f.L(this,t),this.g.set(t,e),this}add(t,e){return this.set(t,e)}addAll(t){if(t===null)return this;if(this.h&&f.L(this),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];this.set(s.key,s.value)}}else if(t instanceof pt){let e=t.iterator;for(;e.next();)this.set(e.key,e.value)}else{let e=t.iterator;for(;e.next();){let i=e.value;this.set(i.key,i.value)}}return this}first(){if(this.g.size===0)return null;let t=this.g.entries().next().value;return new Ut(t[0],t[1])}any(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new Ut(i,s):(e.key=i,e.value=s),t(e))return!0;return!1}all(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new Ut(i,s):(e.key=i,e.value=s),!t(e))return!1;return!0}each(t){let e=null;for(let[i,s]of this.g)e===null?e=new Ut(i,s):(e.key=i,e.value=s),t(e);return this}map(t){let e=new pt,i=null;for(let[s,n]of this.g)i===null?i=new Ut(s,n):(i.key=s,i.value=n),e.set(s,t(i));return e}filter(t){let e=new pt,i=null;for(let[s,n]of this.g)i===null?i=new Ut(s,n):(i.key=s,i.value=n),t(i)&&e.set(s,n);return e}has(t){return this.g.has(t)}contains(t){return this.has(t)}get(t){let e=this.g.get(t);return e===void 0?null:e}getValue(t){return this.get(t)}delete(t){return t===null?!1:(this.h&&f.L(this,t),this.g.delete(t))}remove(t){return this.delete(t)}clear(){this.h&&f.L(this),this.g.clear()}copy(){let t=new pt;return t.g=new Map(this.g),t}toArray(){let t=this.g,e=new Array(t.size),i=0;for(let s of t)e[i]=new Ut(s[0],s[1]),i++;return e}toKeySet(){return new he(this)}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?W.instance:new Wt(this)}get iteratorKeys(){return this.count<=0?W.instance:new Rt(this)}keys(){return this.g.keys()}get iteratorValues(){return this.count<=0?W.instance:new Oe(this)}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}}class P{px;py;h;constructor(t,e){t===void 0?(this.px=0,this.py=0):typeof t=="number"&&typeof e=="number"?(this.px=t,this.py=e):f.o("Invalid arguments to Point constructor: "+t+", "+e),this.h=!1}a(t){return this.px=t.px,this.py=t.py,this}i(t,e){return this.px=t,this.py=e,this}setTo(t,e){return this.px=t,this.py=e,this}set(t){return this.px=t.px,this.py=t.py,this}copy(){let t=new P;return t.px=this.px,t.py=this.py,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;return n=e[i++],n&&(o=parseFloat(n)),new P(s,o)}else return new P}static stringify(t){return t.x.toString()+" "+t.y.toString()}static stringifyFixed(t){return f.s(t,"number",P,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)}toString(){return"Point("+this.x+","+this.y+")"}equals(t){return t instanceof P?this.px===t.x&&this.py===t.y:!1}equalTo(t,e){return this.px===t&&this.py===e}equalsApprox(t){return L.f(this.px,t.x)&&L.f(this.py,t.y)}add(t){return this.px+=t.x,this.py+=t.y,this}subtract(t){return this.px-=t.x,this.py-=t.y,this}offset(t,e){return this.px+=t,this.py+=e,this}rotate(t){if(t===0)return this;let e=this.px,i=this.py;if(e===0&&i===0)return this;let s=0,n=0;if(t>=360?t-=360:t<0&&(t+=360),t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let o=t*Math.PI/180;s=Math.cos(o),n=Math.sin(o)}return this.px=s*e-n*i,this.py=n*e+s*i,this}scale(t,e){return this.px*=t,this.py*=e,this}distanceSquaredPoint(t){let e=t.x-this.px,i=t.y-this.py;return e*e+i*i}distanceSquared(t,e){let i=t-this.px,s=e-this.py;return i*i+s*s}normalize(){let t=this.px,e=this.py,i=Math.sqrt(t*t+e*e);return i>0&&(this.px=t/i,this.py=e/i),this}directionPoint(t){return this.dC(t.x-this.px,t.y-this.py)}direction(t,e){return this.dC(t-this.px,e-this.py)}dC(t,e){if(t===0)return e>0?90:e<0?270:0;if(e===0)return t>0?0:180;{if(isNaN(t)||isNaN(e))return 0;let i=Math.atan(Math.abs(e/t))*180/Math.PI;return t<0?e<0?i+=180:i=180-i:e<0&&(i=360-i),i}}static compareWithLineSegment(t,e,i,s,n,o){return L.eu(t,e,i,s,n,o)}compareWithLineSegmentPoint(t,e){return L.eu(t.x,t.y,e.x,e.y,this.x,this.y)}static intersectingLineSegments(t,e,i,s,n,o,r,a){return L.su(t,e,i,s,n,o,r,a)}projectOntoLineSegment(t,e,i,s){return L.dl(t,e,i,s,this.px,this.py,this),this}projectOntoLineSegmentPoint(t,e){return L.dl(t.x,t.y,e.x,e.y,this.px,this.py,this),this}snapToGrid(t,e,i,s){return L.Dg(this.px,this.py,t,e,i,s,this),this}snapToGridPoint(t,e){return L.Dg(this.px,this.py,t.x,t.y,e.width,e.height,this),this}setRectSpot(t,e){return this.px=t.x+e.x*t.width+e.offsetX,this.py=t.y+e.y*t.height+e.offsetY,this}setSpot(t,e,i,s,n){return this.px=t+n.x*i+n.offsetX,this.py=e+n.y*s+n.offsetY,this}T(t){return t.gt(this),this}Oe(t){return t.$e(this),this}static distanceLineSegmentSquared(t,e,i,s,n,o){let r=n-i,a=o-s,h=r*r+a*a,l=i-t,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 xo=new P(0,0).$();static gC=new P(-1/0,-1/0).$();static mC=new P(1/0,1/0).$();static pC=new P(6,6).$();static Ik=new P(NaN,NaN).$();static Ek=[];static l(){let t=P.Ek.pop();return t===void 0?new P:t}static V(t,e){let i=P.Ek.pop();return i===void 0?new P(t,e):(i.x=t,i.y=e,i)}static e(t){P.Ek.push(t)}}class Q{sw;sh;h;constructor(t,e){t===void 0?(this.sw=0,this.sh=0):typeof t=="number"&&(t>=0||isNaN(t))&&typeof e=="number"&&(e>=0||isNaN(e))?(this.sw=t,this.sh=e):f.o("Invalid arguments to Size constructor: "+t+", "+e),this.h=!1}a(t){return this.sw=t.sw,this.sh=t.sh,this}i(t,e){return this.sw=t,this.sh=e,this}setTo(t,e){return this.sw=t,this.sh=e,this}set(t){return this.sw=t.sw,this.sh=t.sh,this}copy(){let t=new Q;return t.sw=this.sw,t.sh=this.sh,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;return n=e[i++],n&&(o=parseFloat(n)),new Q(s,o)}else return new Q}static stringify(t){return t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return f.s(t,"number",Q,"stringifyFixed:digits"),e=>e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Size("+this.width+","+this.height+")"}equals(t){return t instanceof Q?this.sw===t.width&&this.sh===t.height:!1}equalTo(t,e){return this.sw===t&&this.sh===e}equalsApprox(t){return L.f(this.sw,t.width)&&L.f(this.sh,t.height)}inflate(t,e){let i=this.width+t;this.sw=i>=0?i:0;let s=this.height+e;return this.sh=s>=0?s:0,this}get width(){return this.sw}set width(t){t<0&&f.W(t,">= 0",Q,"width"),this.sw=t}get height(){return this.sh}set height(t){t<0&&f.W(t,">= 0",Q,"height"),this.sh=t}isReal(){return isFinite(this.width)&&isFinite(this.height)}static sc=new Q(0,0).$();static Uk=new Q(1,1).$();static yC=new Q(6,6).$();static nu=new Q(8,8).$();static wC=new Q(10,10).$();static Bk=new Q(1/0,1/0).$();static ww=new Q(NaN,NaN).$();static xC=[];static l(){let t=Q.xC.pop();return t===void 0?new Q:t}static e(t){Q.xC.push(t)}}class z{rx;ry;rw;rh;h;constructor(t,e,i,s){if(t===void 0)this.rx=0,this.ry=0,this.rw=0,this.rh=0;else if(typeof t=="number"&&typeof e=="number"&&typeof i=="number"&&(i>=0||isNaN(i))&&typeof s=="number"&&(s>=0||isNaN(s)))this.rx=t,this.ry=e,this.rw=i,this.rh=s;else if(t instanceof P){let n=t.x,o=t.y;if(e instanceof P){let r=e.x,a=e.y;this.rx=Math.min(n,r),this.ry=Math.min(o,a),this.rw=Math.abs(n-r),this.rh=Math.abs(o-a)}else e instanceof Q?(this.rx=n,this.ry=o,this.rw=e.width,this.rh=e.height):f.o("Incorrect second argument supplied to Rect constructor "+e)}else f.o("Invalid arguments to Rect constructor: "+t+", "+e+", "+i+", "+s);this.h=!1}a(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}i(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}Fn(t,e){return this.rw=t,this.rh=e,this}setTo(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}set(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}setPoint(t){return this.rx=t.x,this.ry=t.y,this}setSize(t){return this.rw=t.width,this.rh=t.height,this}copy(){let t=new z;return t.rx=this.rx,t.ry=this.ry,t.rw=this.rw,t.rh=this.rh,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;n=e[i++],n&&(o=parseFloat(n));let r=0;for(;e[i]==="";)i++;n=e[i++],n&&(r=parseFloat(n));let a=0;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),new z(s,o,r,a)}else return new z}static stringify(t){return t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return f.s(t,"number",z,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)+" "+e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"}equals(t){return t instanceof z?this.rx===t.x&&this.ry===t.y&&this.rw===t.width&&this.rh===t.height:!1}equalTo(t,e,i,s){return this.rx===t&&this.ry===e&&this.rw===i&&this.rh===s}equalsApprox(t){return L.f(this.rx,t.x)&&L.f(this.ry,t.y)&&L.f(this.rw,t.width)&&L.f(this.rh,t.height)}equalsApproxTo(t,e,i,s){return L.f(this.rx,t)&&L.f(this.ry,e)&&L.f(this.rw,i)&&L.f(this.rh,s)}equalsApproxClose(t){return L.z(this.rx,t.x)&&L.z(this.ry,t.y)&&L.z(this.rw,t.width)&&L.z(this.rh,t.height)}containsPoint(t){return this.rx<=t.x&&this.rx+this.rw>=t.x&&this.ry<=t.y&&this.ry+this.rh>=t.y}containsRect(t){return this.rx<=t.x&&t.x+t.width<=this.rx+this.rw&&this.ry<=t.y&&t.y+t.height<=this.ry+this.rh}contains(t,e,i,s){return i===void 0&&(i=0),s===void 0&&(s=0),this.rx<=t&&t+i<=this.rx+this.rw&&this.ry<=e&&e+s<=this.ry+this.rh}offset(t,e){return this.rx+=t,this.ry+=e,this}inflate(t,e){return this.xw(e,t,e,t)}addMargin(t){return this.xw(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return this.xw(-t.top,-t.right,-t.bottom,-t.left)}grow(t,e,i,s){return this.xw(t,e,i,s)}xw(t,e,i,s){let n=this.rw;e+s<=-n?(this.rx+=n/2,this.rw=0):(this.rx-=s,this.rw+=e+s);let o=this.rh;return t+i<=-o?(this.ry+=o/2,this.rh=0):(this.ry-=t,this.rh+=t+i),this}intersectRect(t){return this.bC(t.x,t.y,t.width,t.height)}intersect(t,e,i,s){return this.bC(t,e,i,s)}bC(t,e,i,s){let n=Math.max(this.rx,t),o=Math.max(this.ry,e),r=Math.min(this.rx+this.rw,t+i),a=Math.min(this.ry+this.rh,e+s);return this.rx=n,this.ry=o,this.rw=Math.max(0,r-n),this.rh=Math.max(0,a-o),this}intersectsRect(t){return this.intersects(t.x,t.y,t.width,t.height)}intersects(t,e,i,s){let n=this.rw,o=this.rx;if(n!==1/0&&i!==1/0&&(n+=o,i+=t,isNaN(i)||isNaN(n)||o>i||t>n))return!1;let r=this.rh,a=this.ry;return!(r!==1/0&&s!==1/0&&(r+=a,s+=e,isNaN(s)||isNaN(r)||a>s||e>r))}intersectsRectPlus(t,e){let i=this.rw,s=t.width+e+e,n=this.rx,o=t.x-e;if(i+=n,s+=o,n>s||o>i)return!1;let r=this.rh,a=t.height+e+e,h=this.ry,l=t.y-e;return r+=h,a+=l,!(h>a||l>r)}unionPoint(t){return this.unionNoCheck(t.x,t.y,0,0)}unionRect(t){return this.unionNoCheck(t.rx,t.ry,t.rw,t.rh)}union(t,e,i,s){return i===void 0&&(i=0),s===void 0&&(s=0),this.unionNoCheck(t,e,i,s)}unionNoCheck(t,e,i,s){let n=Math.min(this.rx,t),o=Math.min(this.ry,e),r=Math.max(this.rx+this.rw,t+i),a=Math.max(this.ry+this.rh,e+s);return this.rx=n,this.ry=o,this.rw=r-n,this.rh=a-o,this}setSpot(t,e,i){return this.rx=t-i.offsetX-i.x*this.rw,this.ry=e-i.offsetY-i.y*this.rh,this}static contains(t,e,i,s,n,o,r,a){return r===void 0&&(r=0),a===void 0&&(a=0),t<=n&&n+r<=t+i&&e<=o&&o+a<=e+s}static intersects(t,e,i,s,n,o,r,a){let h=i,l=r,u=t,c=n;if(h+=u,l+=c,u>l||c>h)return!1;let d=s,g=a,p=e,m=o;return d+=p,g+=m,!(p>g||m>d)}static intersectsLineSegment(t,e,i,s,n,o,r,a){return L.kC(t,e,i,s,n,o,r,a)}get x(){return this.rx}set x(t){this.rx=t}get y(){return this.ry}set y(t){this.ry=t}get width(){return this.rw}set width(t){t<0&&f.W(t,">= 0",z,"width"),this.rw=t}get height(){return this.rh}set height(t){t<0&&f.W(t,">= 0",z,"height"),this.rh=t}get left(){return this.rx}set left(t){this.rx=t}get top(){return this.ry}set top(t){this.ry=t}get right(){return this.rx+this.rw}set right(t){this.rx+=t-(this.rx+this.rw)}get bottom(){return this.ry+this.rh}set bottom(t){this.ry+=t-(this.ry+this.rh)}get position(){return new P(this.rx,this.ry)}set position(t){this.rx=t.x,this.ry=t.y}get size(){return new Q(this.rw,this.rh)}set size(t){this.rw=t.width,this.rh=t.height}get center(){return new P(this.rx+this.rw/2,this.ry+this.rh/2)}set center(t){this.rx=t.x-this.rw/2,this.ry=t.y-this.rh/2}get centerX(){return this.rx+this.rw/2}set centerX(t){this.rx=t-this.rw/2}get centerY(){return this.ry+this.rh/2}set centerY(t){this.ry=t-this.rh/2}isReal(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)}isEmpty(){return this.width===0&&this.height===0}static Fg=new z(0,0,0,0).$();static $D=new z(NaN,NaN,NaN,NaN).$();static Vk=[];static l(){let t=z.Vk.pop();return t===void 0?new z:t}static V(t,e,i,s){let n=z.Vk.pop();return n===void 0?new z(t,e,i,s):n.i(t,e,i,s)}static e(t){z.Vk.push(t)}}class Lt{mt;mr;mb;ml;h;constructor(t,e,i,s){t===void 0?(this.mt=0,this.mr=0,this.mb=0,this.ml=0):e===void 0?(e=t,i=t,s=t,this.mt=t,this.mr=e,this.mb=i,this.ml=s):i===void 0?(i=t,s=e,this.mt=t,this.mr=e,this.mb=i,this.ml=s):s!==void 0?(this.mt=t,this.mr=e,this.mb=i,this.ml=s):f.o("Invalid arguments to Margin constructor: "+t+", "+e+", "+i+", "+s),this.h=!1}a(t){return this.mt=t.mt,this.mr=t.mr,this.mb=t.mb,this.ml=t.ml,this}setTo(t,e,i,s){return this.mt=t,this.mr=e,this.mb=i,this.ml=s,this}set(t){return this.mt=t.mt,this.mr=t.mr,this.mb=t.mb,this.ml=t.ml,this}copy(){let t=new Lt;return t.mt=this.mt,t.mr=this.mr,t.mb=this.mb,t.ml=this.ml,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=NaN;for(;e[i]==="";)i++;let n=e[i++];if(n&&(s=parseFloat(n)),isNaN(s))return new Lt;let o=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(o=parseFloat(n)),isNaN(o))return new Lt(s);let r=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(r=parseFloat(n)),isNaN(r))return new Lt(s,o);let a=NaN;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),isNaN(a)?new Lt(s,o):new Lt(s,o,r,a)}else return new Lt}static stringify(t){return t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}static stringifyFixed(t){return f.s(t,"number",Lt,"stringifyFixed:digits"),e=>e.top.toFixed(t)+" "+e.right.toFixed(t)+" "+e.bottom.toFixed(t)+" "+e.left.toFixed(t)}toString(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"}equals(t){return t instanceof Lt?this.mt===t.top&&this.mr===t.right&&this.mb===t.bottom&&this.ml===t.left:!1}equalTo(t,e,i,s){return this.mt===t&&this.mr===e&&this.mb===i&&this.ml===s}equalsApprox(t){return L.f(this.mt,t.top)&&L.f(this.mr,t.right)&&L.f(this.mb,t.bottom)&&L.f(this.ml,t.left)}get top(){return this.mt}set top(t){this.mt=t}get right(){return this.mr}set right(t){this.mr=t}get bottom(){return this.mb}set bottom(t){this.mb=t}get left(){return this.ml}set left(t){this.ml=t}isReal(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)}static Rg=new Lt(0,0,0,0).$();static PC=new Lt(2,2,2,2).$();static SC=[];static l(){let t=Lt.SC.pop();return t===void 0?new Lt:t}static e(t){Lt.SC.push(t)}}class D{sx;sy;ox;oy;h;constructor(t,e,i,s){t===void 0?(this.sx=0,this.sy=0,this.ox=0,this.oy=0):(e===void 0&&(e=0),i===void 0&&(i=0),s===void 0&&(s=0),this.sx=t,this.sy=e,this.ox=i,this.oy=s),this.h=!1}a(t){return this.sx=t.sx,this.sy=t.sy,this.ox=t.ox,this.oy=t.oy,this}setTo(t,e,i,s){return this.sx=t,this.sy=e,this.ox=i,this.oy=s,this}set(t){return this.sx=t.sx,this.sy=t.sy,this.ox=t.ox,this.oy=t.oy,this}copy(){let t=new D;return t.sx=this.sx,t.sy=this.sy,t.ox=this.ox,t.oy=this.oy,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(t){}Ie(t){return this.sx=NaN,this.sy=NaN,this.ox=t,this}wE(t,e){(isNaN(t)||t>1||t<0)&&f.W(t,"0 <= "+e+" <= 1",D,e)}xE(t,e){(isNaN(t)||t===1/0||t===-1/0)&&f.W(t,"real number, not NaN or Infinity",D,e)}static parse(t){if(typeof t=="string"){if(t=t.trim(),t==="None")return D.None;if(t==="TopLeft")return D.TopLeft;if(t==="Top"||t==="TopCenter"||t==="MiddleTop")return D.TopCenter;if(t==="TopRight")return D.TopRight;if(t==="Left"||t==="LeftCenter"||t==="MiddleLeft")return D.LeftCenter;if(t==="Center")return D.Center;if(t==="Right"||t==="RightCenter"||t==="MiddleRight")return D.RightCenter;if(t==="BottomLeft")return D.BottomLeft;if(t==="Bottom"||t==="BottomCenter"||t==="MiddleBottom")return D.BottomCenter;if(t==="BottomRight")return D.BottomRight;if(t==="TopSide")return D.TopSide;if(t==="LeftSide")return D.LeftSide;if(t==="RightSide")return D.RightSide;if(t==="BottomSide")return D.BottomSide;if(t==="TopBottomSides")return D.TopBottomSides;if(t==="LeftRightSides")return D.LeftRightSides;if(t==="TopLeftSides")return D.TopLeftSides;if(t==="TopRightSides")return D.TopRightSides;if(t==="BottomLeftSides")return D.BottomLeftSides;if(t==="BottomRightSides")return D.BottomRightSides;if(t==="NotTopSide")return D.NotTopSide;if(t==="NotLeftSide")return D.NotLeftSide;if(t==="NotRightSide")return D.NotRightSide;if(t==="NotBottomSide")return D.NotBottomSide;if(t==="AllSides")return D.AllSides;if(t==="Default")return D.Default;let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n!==void 0&&n.length>0&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;n=e[i++],n!==void 0&&n.length>0&&(o=parseFloat(n));let r=0;for(;e[i]==="";)i++;n=e[i++],n!==void 0&&n.length>0&&(r=parseFloat(n));let a=0;for(;e[i]==="";)i++;return n=e[i++],n!==void 0&&n.length>0&&(a=parseFloat(n)),new D(s,o,r,a)}else return new D}static stringify(t){return t.isSpot()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}static stringifyFixed(t){return f.s(t,"number",D,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)+" "+e.offsetX.toFixed(t)+" "+e.offsetY.toFixed(t)}toString(){return this.isSpot()?this.ox===0&&this.oy===0?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.equals(D.None)?"None":this.equals(D.TopLeft)?"TopLeft":this.equals(D.TopCenter)?"Top":this.equals(D.TopRight)?"TopRight":this.equals(D.LeftCenter)?"Left":this.equals(D.Center)?"Center":this.equals(D.RightCenter)?"Right":this.equals(D.BottomLeft)?"BottomLeft":this.equals(D.BottomCenter)?"Bottom":this.equals(D.BottomRight)?"BottomRight":this.equals(D.TopSide)?"TopSide":this.equals(D.LeftSide)?"LeftSide":this.equals(D.RightSide)?"RightSide":this.equals(D.BottomSide)?"BottomSide":this.equals(D.TopBottomSides)?"TopBottomSides":this.equals(D.LeftRightSides)?"LeftRightSides":this.equals(D.TopLeftSides)?"TopLeftSides":this.equals(D.TopRightSides)?"TopRightSides":this.equals(D.BottomLeftSides)?"BottomLeftSides":this.equals(D.BottomRightSides)?"BottomRightSides":this.equals(D.NotTopSide)?"NotTopSide":this.equals(D.NotLeftSide)?"NotLeftSide":this.equals(D.NotRightSide)?"NotRightSide":this.equals(D.NotBottomSide)?"NotBottomSide":this.equals(D.AllSides)?"AllSides":this.equals(D.Default)?"Default":"None"}equals(t){return t instanceof D?(this.sx===t.x||isNaN(this.sx)&&isNaN(t.x))&&(this.sy===t.y||isNaN(this.sy)&&isNaN(t.y))&&this.ox===t.offsetX&&this.oy===t.offsetY:!1}opposite(){return new D(.5-(this.sx-.5),.5-(this.sy-.5),-this.ox,-this.oy)}includesSide(t){if(!this.isSide())return!1;if(!t.isSide())if(t.equals(D.Left))t=D.LeftSide;else if(t.equals(D.Right))t=D.RightSide;else if(t.equals(D.Top))t=D.TopSide;else if(t.equals(D.Bottom))t=D.BottomSide;else return!1;let e=this.oy,i=t.offsetY;return(e&i)===i}get x(){return this.sx}set x(t){this.sx=t}get y(){return this.sy}set y(t){this.sy=t}get offsetX(){return this.ox}set offsetX(t){this.ox=t}get offsetY(){return this.oy}set offsetY(t){this.oy=t}isSpot(){return!isNaN(this.x)&&!isNaN(this.y)}isNoSpot(){return isNaN(this.x)||isNaN(this.y)}isSide(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===1&&this.offsetY!==0}isNone(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===0&&this.offsetY===0}isDefault(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===-1&&this.offsetY===0}static None=new D(0,0,0,0).Ie(0).$();static Default=new D(0,0,-1,0).Ie(-1).$();static TopLeft=new D(0,0,0,0).$();static TopCenter=new D(.5,0,0,0).$();static TopRight=new D(1,0,0,0).$();static LeftCenter=new D(0,.5,0,0).$();static Center=new D(.5,.5,0,0).$();static RightCenter=new D(1,.5,0,0).$();static BottomLeft=new D(0,1,0,0).$();static BottomCenter=new D(.5,1,0,0).$();static BottomRight=new D(1,1,0,0).$();static MiddleTop=D.TopCenter;static MiddleLeft=D.LeftCenter;static MiddleRight=D.RightCenter;static MiddleBottom=D.BottomCenter;static Top=D.TopCenter;static Left=D.LeftCenter;static Right=D.RightCenter;static Bottom=D.BottomCenter;static TopSide=new D(0,0,1,1).Ie(1).$();static LeftSide=new D(0,0,1,2).Ie(1).$();static RightSide=new D(0,0,1,4).Ie(1).$();static BottomSide=new D(0,0,1,8).Ie(1).$();static TopBottomSides=new D(0,0,1,9).Ie(1).$();static LeftRightSides=new D(0,0,1,6).Ie(1).$();static TopLeftSides=new D(0,0,1,3).Ie(1).$();static TopRightSides=new D(0,0,1,5).Ie(1).$();static BottomLeftSides=new D(0,0,1,10).Ie(1).$();static BottomRightSides=new D(0,0,1,12).Ie(1).$();static NotTopSide=new D(0,0,1,14).Ie(1).$();static NotLeftSide=new D(0,0,1,13).Ie(1).$();static NotRightSide=new D(0,0,1,11).Ie(1).$();static NotBottomSide=new D(0,0,1,7).Ie(1).$();static AllSides=new D(0,0,1,15).Ie(1).$();static zk=new D(.156,.156).$();static Xk=new D(.844,.844).$();static MC=[];static l(){let t=D.MC.pop();return t===void 0?new D:t}static e(t){D.MC.push(t)}}class Pt{m11;m12;m21;m22;dx;dy;constructor(){this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0}set(t){return this.m11=t.m11,this.m12=t.m12,this.m21=t.m21,this.m22=t.m22,this.dx=t.dx,this.dy=t.dy,this}setTo(t,e,i,s,n,o){return this.m11=t,this.m12=e,this.m21=i,this.m22=s,this.dx=n,this.dy=o,this}copy(){let t=new Pt;return t.m11=this.m11,t.m12=this.m12,t.m21=this.m21,t.m22=this.m22,t.dx=this.dx,t.dy=this.dy,t}toString(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"}equals(t){return this.m11===t.m11&&this.m12===t.m12&&this.m21===t.m21&&this.m22===t.m22&&this.dx===t.dx&&this.dy===t.dy}Yk(){return this.dx===0&&this.dy===0&&this.m11===1&&this.m12===0&&this.m21===0&&this.m22===1}Ri(){return this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0,this}nc(t){let e=this.m11*t.m11+this.m21*t.m12,i=this.m12*t.m11+this.m22*t.m12,s=this.m11*t.m21+this.m21*t.m22,n=this.m12*t.m21+this.m22*t.m22;return this.dx=this.m11*t.dx+this.m21*t.dy+this.dx,this.dy=this.m12*t.dx+this.m22*t.dy+this.dy,this.m11=e,this.m12=i,this.m21=s,this.m22=n,this}NC(t){let e=1/(t.m11*t.m22-t.m12*t.m21),i=t.m22*e,s=-t.m12*e,n=-t.m21*e,o=t.m11*e,r=e*(t.m21*t.dy-t.m22*t.dx),a=e*(t.m12*t.dx-t.m11*t.dy),h=this.m11*i+this.m21*s,l=this.m12*i+this.m22*s,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}bw(){let t=1/(this.m11*this.m22-this.m12*this.m21),e=this.m22*t,i=-this.m12*t,s=-this.m21*t,n=this.m11*t,o=t*(this.m21*this.dy-this.m22*this.dx),r=t*(this.m12*this.dx-this.m11*this.dy);return this.m11=e,this.m12=i,this.m21=s,this.m22=n,this.dx=o,this.dy=r,this}cs(t,e,i){if(t>=360?t-=360:t<0&&(t+=360),t===0)return this;this.Fs(e,i);let s=0,n=0;if(t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let l=t*Math.PI/180;s=Math.cos(l),n=Math.sin(l)}let o=this.m11*s+this.m21*n,r=this.m12*s+this.m22*n,a=this.m11*-n+this.m21*s,h=this.m12*-n+this.m22*s;return this.m11=o,this.m12=r,this.m21=a,this.m22=h,this.Fs(-e,-i),this}Fs(t,e){return this.dx+=this.m11*t+this.m21*e,this.dy+=this.m12*t+this.m22*e,this}tt(t,e){return e===void 0&&(e=t),this.m11*=t,this.m12*=t,this.m21*=e,this.m22*=e,this}ZD(){if(this.m11===1&&this.m12===0)return 0;let t=Math.atan2(this.m12,this.m11)*180/Math.PI;return t<0&&(t+=360),t}gt(t){let e=t.x,i=t.y;return t.i(e*this.m11+i*this.m21+this.dx,e*this.m12+i*this.m22+this.dy)}$e(t){let e=1/(this.m11*this.m22-this.m12*this.m21),i=this.m22*e,s=-this.m12*e,n=-this.m21*e,o=this.m11*e,r=t.x-this.dx,a=t.y-this.dy;return t.i(r*i+a*n,r*s+a*o)}kw(t){let e=1/(this.m11*this.m22-this.m12*this.m21),i=this.m22*e,s=-this.m12*e,n=-this.m21*e,o=this.m11*e,r=e*(this.m21*this.dy-this.m22*this.dx),a=e*(this.m12*this.dx-this.m11*this.dy),h=t.x*1.25,l=t.y*1.2;return t.i(h*i+l*n+r,h*s+l*o+a)}vg(t){let e=t.x,i=t.y,s=e+t.width,n=i+t.height,o=this.m11,r=this.m12,a=this.m21,h=this.m22,l=this.dx,u=this.dy,c=e*o+i*a+l,d=e*r+i*h+u,g=s*o+i*a+l,p=s*r+i*h+u,m=e*o+n*a+l,y=e*r+n*h+u,w=s*o+n*a+l,b=s*r+n*h+u,v=c,k=c,S=d,M=d;return v=Math.min(v,g),k=Math.max(k,g),S=Math.min(S,p),M=Math.max(M,p),v=Math.min(v,m),k=Math.max(k,m),S=Math.min(S,y),M=Math.max(M,y),v=Math.min(v,w),k=Math.max(k,w),S=Math.min(S,b),M=Math.max(M,b),t.i(v,S,k-v,M-S),t}static CC=[];static l(){let t=Pt.CC.pop();return t===void 0?new Pt:t}static e(t){Pt.CC.push(t)}static Gk="54a702f3e53909c447824c6706603faf4c"}let L={QD:"7da71ca0ad381e90",Rn:4*((Math.sqrt(2)-1)/3),LC:null,Pw:x=>{if(x<=0)return 0;let t=L.LC;if(t===null){t=[];for(let e=0;e<=2e3;e++)t[e]=Math.sqrt(e);L.LC=t}if(x<1){let e=1/x;return e<=2e3?1/t[e|0]:Math.sqrt(x)}else return x<=2e3?t[x|0]:Math.sqrt(x)},f:(x,t)=>{let e=x-t;return e<.5&&e>-.5},z:(x,t)=>{let e=x-t;return e<5e-8&&e>-5e-8},vi:(x,t,e,i,s,n,o)=>{s<=0&&(s=1e-6);let r=0,a=0,h=0,l=0;if(x<e?(a=x,r=e):(a=e,r=x),t<i?(l=t,h=i):(l=i,h=t),x===e)return l<=o&&o<=h&&x-s<=n&&n<=x+s;if(t===i)return a<=n&&n<=r&&t-s<=o&&o<=t+s;let u=r+s,c=a-s;if(c<=n&&n<=u){let d=h+s,g=l-s;if(g<=o&&o<=d)if(u-c>d-g)if(x-e>s||e-x>s){let p=(i-t)/(e-x)*(n-x)+t;if(p-s<=o&&o<=p+s)return!0}else return!0;else if(t-i>s||i-t>s){let p=(e-x)/(i-t)*(o-t)+x;if(p-s<=n&&n<=p+s)return!0}else return!0}return!1},Sw:(x,t,e,i,s,n,o,r,a,h,l,u)=>{if(!L.vi(x,t,o,r,u,e,i)||!L.vi(x,t,o,r,u,s,n)){let c=(x+e)/2,d=(t+i)/2,g=(e+s)/2,p=(i+n)/2,m=(s+o)/2,y=(n+r)/2,w=(c+g)/2,b=(d+p)/2,v=(g+m)/2,k=(p+y)/2,S=(w+v)/2,M=(b+k)/2;return L.Sw(x,t,c,d,w,b,S,M,a,h,l,u)||L.Sw(S,M,v,k,m,y,o,r,a,h,l,u)}else return L.vi(x,t,o,r,u,h,l)},AC:(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,g=(n+r)/2,p=(h+u)/2,m=(l+c)/2,y=(u+d)/2,w=(c+g)/2;return a.i((p+y)/2,(m+w)/2),a},_D:(x,t,e,i,s,n,o,r)=>{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,u=(i+n)/2,c=(s+o)/2,d=(n+r)/2,g=(a+l)/2,p=(h+u)/2,m=(l+c)/2,y=(u+d)/2;return P.direction(g,p,m,y)},ou:(x,t,e,i,s,n,o,r,a,h)=>{if(!L.vi(x,t,o,r,a,e,i)||!L.vi(x,t,o,r,a,s,n)){let l=(x+e)/2,u=(t+i)/2,c=(e+s)/2,d=(i+n)/2,g=(s+o)/2,p=(n+r)/2,m=(l+c)/2,y=(u+d)/2,w=(c+g)/2,b=(d+p)/2,v=(m+w)/2,k=(y+b)/2;L.ou(x,t,l,u,m,y,v,k,a,h),L.ou(v,k,w,b,g,p,o,r,a,h)}else h.unionNoCheck(x,t,0,0),h.unionNoCheck(o,r,0,0);return h},vn:(x,t,e,i,s,n,o,r,a,h)=>{if(!L.vi(x,t,o,r,a,e,i)||!L.vi(x,t,o,r,a,s,n)){let l=(x+e)/2,u=(t+i)/2,c=(e+s)/2,d=(i+n)/2,g=(s+o)/2,p=(n+r)/2,m=(l+c)/2,y=(u+d)/2,w=(c+g)/2,b=(d+p)/2,v=(m+w)/2,k=(y+b)/2;L.vn(x,t,l,u,m,y,v,k,a,h),L.vn(v,k,w,b,g,p,o,r,a,h)}else h.length===0&&(h.push(x),h.push(t)),h.push(o),h.push(r);return h},Kk:(x,t,e,i,s,n,o,r,a,h)=>{if(L.vi(x,t,s,n,h,e,i))return L.vi(x,t,s,n,h,r,a);{let l=(x+e)/2,u=(t+i)/2,c=(e+s)/2,d=(i+n)/2,g=(l+c)/2,p=(u+d)/2;return L.Kk(x,t,l,u,g,p,o,r,a,h)||L.Kk(g,p,c,d,s,n,o,r,a,h)}},bE:(x,t,e,i,s,n,o)=>{let r=(x+e)/2,a=(t+i)/2,h=(e+s)/2,l=(i+n)/2;return o.i((r+h)/2,(a+l)/2),o},jk:(x,t,e,i,s,n,o,r)=>{if(L.vi(x,t,s,n,o,e,i))r.unionNoCheck(x,t,0,0),r.unionNoCheck(s,n,0,0);else{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,u=(i+n)/2,c=(a+l)/2,d=(h+u)/2;L.jk(x,t,a,h,c,d,o,r),L.jk(c,d,l,u,s,n,o,r)}return r},Og:(x,t,e,i,s,n,o,r)=>{if(L.vi(x,t,s,n,o,e,i))r.length===0&&(r.push(x),r.push(t)),r.push(s),r.push(n);else{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,u=(i+n)/2,c=(a+l)/2,d=(h+u)/2;L.Og(x,t,a,h,c,d,o,r),L.Og(c,d,l,u,s,n,o,r)}return r},Ig:(x,t,e,i,s,n,o,r,a,h,l,u,c,d)=>{if(!L.vi(x,t,o,r,c,e,i)||!L.vi(x,t,o,r,c,s,n)){let g=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,w=(s+o)/2,b=(n+r)/2,v=(g+m)/2,k=(p+y)/2,S=(m+w)/2,M=(y+b)/2,F=(v+S)/2,T=(k+M)/2,N=1/0,C=!1,R=0,O=0;if(L.Ig(x,t,g,p,v,k,F,T,a,h,l,u,c,d)){let B=(d.x-a)**2+(d.y-h)**2;B<N&&(N=B,C=!0,R=d.x,O=d.y)}if(L.Ig(F,T,S,M,w,b,o,r,a,h,l,u,c,d)){let B=(d.x-a)**2+(d.y-h)**2;B<N&&(N=B,C=!0,R=d.x,O=d.y)}return C&&(d.x=R,d.y=O),C}else{if(!L.su(x,t,o,r,a,h,l,u))return!1;let g=(x-o)*(h-u)-(t-r)*(a-l);if(g===0)return!1;let p=((x*r-t*o)*(a-l)-(x-o)*(a*u-h*l))/g,m=((x*r-t*o)*(h-u)-(t-r)*(a*u-h*l))/g;return d.i(p,m),!0}},Eg:(x,t,e,i,s,n,o,r,a,h,l,u,c)=>{let d=0;if(!L.vi(x,t,o,r,c,e,i)||!L.vi(x,t,o,r,c,s,n)){let g=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,w=(s+o)/2,b=(n+r)/2,v=(g+m)/2,k=(p+y)/2,S=(m+w)/2,M=(y+b)/2,F=(v+S)/2,T=(k+M)/2;d+=L.Eg(x,t,g,p,v,k,F,T,a,h,l,u,c),d+=L.Eg(F,T,S,M,w,b,o,r,a,h,l,u,c)}else{let g=(x-o)*(h-u)-(t-r)*(a-l);if(g===0)return d;let p=((x*r-t*o)*(a-l)-(x-o)*(a*u-h*l))/g,m=((x*r-t*o)*(h-u)-(t-r)*(a*u-h*l))/g;if(p>=l)return d;let y=0,w=0;if((a>l?a-l:l-a)<(h>u?h-u:u-h)){if(t<r?(y=t,w=r):(y=r,w=t),m<y||m>w)return d}else if(x<o?(y=x,w=o):(y=o,w=x),p<y||p>w)return d;g>0?d++:g<0&&d--}return d},dl:(x,t,e,i,s,n,o)=>{if(L.z(x,e)){let r=0,a=0;t<i?(r=t,a=i):(r=i,a=t);let h=n;return h<r?(o.i(x,r),!1):h>a?(o.i(x,a),!1):(o.i(x,h),!0)}else if(L.z(t,i)){let r=0,a=0;x<e?(r=x,a=e):(r=e,a=x);let h=s;return h<r?(o.i(r,t),!1):h>a?(o.i(a,t),!1):(o.i(h,t),!0)}else{let r=(e-x)**2+(i-t)**2,a=((x-s)*(x-e)+(t-n)*(t-i))/r;if(a<-5e-6)return o.i(x,t),!1;if(a>1.000005)return o.i(e,i),!1;{let h=x+a*(e-x),l=t+a*(i-t);return o.i(h,l),!0}}},On:(x,t,e,i,s,n,o,r,a)=>{if(L.f(x,e)&&L.f(t,i))return a.i(x,t),!1;if(L.z(s,o)){if(L.z(x,e))return L.dl(x,t,e,i,s,n,a),!1;{let h=(i-t)/(e-x)*(s-x)+t;return L.dl(x,t,e,i,s,h,a)}}else{let h=(r-n)/(o-s);if(L.z(x,e)){let l=h*(x-s)+n,u=0,c=0;return t<i?(u=t,c=i):(u=i,c=t),l<u?(a.i(x,u),!1):l>c?(a.i(x,c),!1):(a.i(x,l),!0)}else{let l=(i-t)/(e-x);if(L.z(h,l))return L.dl(x,t,e,i,s,n,a),!1;{let u=(l*x-h*s+n-t)/(l-h);if(L.z(l,0)){let c=0,d=0;return x<e?(c=x,d=e):(c=e,d=x),u<c?(a.i(c,t),!1):u>d?(a.i(d,t),!1):(a.i(u,t),!0)}else{let c=l*(u-x)+t;return L.dl(x,t,e,i,u,c,a)}}}}},kE:(x,t,e,i,s)=>L.On(e.x,e.y,i.x,i.y,x.x,x.y,t.x,t.y,s),PE:(x,t,e,i,s,n,o,r,a,h)=>{let l=1/0;function u(S,M){let F=(S-x)**2+(M-t)**2;F<l&&(l=F,a.i(S,M))}u(a.x,a.y);let c=0,d=0,g=0,p=0;s<o?(c=s,d=o):(c=o,d=s),n<r?(g=s,p=o):(g=o,p=s);let m=d-c,y=p-g,w=m/2+h,b=y/2+h,v=(s+o)/2,k=(n+r)/2;if(w===0||b===0)return a;if(L.f(x,e)){let S=1-(e-v)**2/(w*w);if(S<0)return a;let M=Math.sqrt(S),F=b*M+k,T=-b*M+k;u(e,F),u(e,T)}else{let S=(i-t)/(e-x),M=1/(w*w)+S*S/(b*b),F=2*S*(t-S*x)/(b*b)-2*S*k/(b*b)-2*v/(w*w),T=2*S*x*k/(b*b)-2*t*k/(b*b)+k*k/(b*b)+v*v/(w*w)-1+(t-S*x)*(t-S*x)/(b*b),N=F*F-4*M*T;if(N<0)return a;let C=Math.sqrt(N),R=(-F+C)/(2*M);u(R,S*R-S*x+t);let O=(-F-C)/(2*M);u(O,S*O-S*x+t)}return a},gl:(x,t,e,i,s,n,o,r,a)=>{let h=1e21,l=x,u=t;if(L.On(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(L.On(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(L.On(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(L.On(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.i(l,u),h<1e21},Mw:(x,t,e)=>L.kC(x.x,x.y,x.width,x.height,t.x,t.y,e.x,e.y),kC:(x,t,e,i,s,n,o,r)=>{let a=x,h=x+e,l=t,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!!(z.contains(x,t,e,i,s,n)||z.contains(x,t,e,i,o,r)||L.su(a,l,h,l,s,n,o,r)||L.su(h,l,h,u,s,n,o,r)||L.su(h,u,a,u,s,n,o,r)||L.su(a,u,a,l,s,n,o,r))},su:(x,t,e,i,s,n,o,r)=>x===e&&t===i&&s===o&&n===r?x===s&&t===n:L.eu(x,t,e,i,s,n)*L.eu(x,t,e,i,o,r)<=0&&L.eu(s,n,o,r,x,t)*L.eu(s,n,o,r,e,i)<=0,eu:(x,t,e,i,s,n)=>{let o=e-x,r=i-t,a=s-x,h=n-t,l=a*r-h*o;return l===0&&(l=a*o+h*r,l>0&&(a-=o,h-=r,l=a*o+h*r,l<0&&(l=0))),l},Ug:x=>(x<0&&(x+=360),x>=360&&(x-=360),x),TC:(x,t,e,i,s,n)=>{let o=Math.PI;n||(i=i*(o/180),s=s*(o/180));let r=i>s?-1:1,a=1e-5,h=o*2,l=[],u=o/2,c=i,d=Math.min(h,Math.abs(s-i));if(d<a){let g=c+r*Math.min(d,u),p=x+e*Math.cos(c),m=t+e*Math.sin(c),y=x+e*Math.cos(g),w=t+e*Math.sin(g),b=(p+y)/2,v=(m+w)/2;return l.push([p,m,b,v,b,v,y,w]),l}for(;d>a;){let g=c+r*Math.min(d,u);l.push(L.tF(e,c,g,x,t)),d-=Math.abs(g-c),c=g}return l},tF:(x,t,e,i,s)=>{let n=(e-t)/2,o=x*Math.cos(n),r=x*Math.sin(n),a=o,h=-r,l=a*a+h*h,u=l+a*o+h*r,c=4/3*(Math.sqrt(2*l*u)-u)/(a*r-h*o),d=a-c*h,g=h+c*a,p=d,m=-g,y=n+t,w=Math.cos(y),b=Math.sin(y);return[i+x*Math.cos(t),s+x*Math.sin(t),i+d*w-g*b,s+d*b+g*w,i+p*w-m*b,s+p*b+m*w,i+x*Math.cos(e),s+x*Math.sin(e)]},Dg:(x,t,e,i,s,n,o)=>{let r=s,a=n,h=Math.floor((x-e)/r)*r+e,l=Math.floor((t-i)/a)*a+i,u=h;h+r-x<r/2&&(u=h+r);let c=l;return l+a-t<a/2&&(c=l+a),o.i(u,c),o},DC:(x,t)=>{let e=Math.max(x,t),i=Math.min(x,t),s=1,n=1;do s=e%i,n=i,e=i,i=s;while(s>0);return n},iF:(x,t,e,i)=>{let s=e<0,n=i<0,o=0,r=0,a=0;x<t?(r=1,a=0):(r=0,a=1);let h=0,l=0,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),L.eF(h,l,u,c,0,0)},eF:(x,t,e,i,s,n)=>{let o=0;if(i>0)if(e>0){let r=x*x,a=t*t,h=x*e,l=t*i,u=-a+l,c=-a+Math.sqrt(h*h+l*l),d=u,g=9999999999;for(let y=0;y<g&&(d=.5*(u+c),!(d===u||d===c));++y){let w=h/(d+r),b=l/(d+a),v=w*w+b*b-1;if(v>0)u=d;else if(v<0)c=d;else break}s=r*e/(d+r),n=a*i/(d+a);let p=s-e,m=n-i;o=Math.sqrt(p*p+m*m)}else s=0,n=t,o=Math.abs(i-t);else{let r=x*x-t*t,a=x*e;if(a<r){let h=a/r,l=h*h;s=x*h,n=t*Math.sqrt(Math.abs(1-l));let u=s-e;o=Math.sqrt(u*u+n*n)}else s=x,n=0,o=Math.abs(e-x)}return o},In:new q,Bg:new q,or:new q,rr:0,Vg:100};L.za=L.QD;var ei=(x=>(x[x.Line=1]="Line",x[x.Rectangle=2]="Rectangle",x[x.Ellipse=3]="Ellipse",x[x.Path=4]="Path",x))(ei||{}),ms=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Fill=2]="Fill",x[x.Uniform=6]="Uniform",x))(ms||{});class kt{n;zg;Xg;oc;ru;lu;En;Un;Bn;H;we;xe;Qi;_i;Rs;rc;lc;constructor(t){I.Ki(this),this.n=2,t===void 0&&(t=4),this.H=t,this.we=0,this.xe=0,this.Qi=0,this._i=0,t===4?this.Rs=new j:this.Rs=kt.Nw,this.zg=this.Rs.nt,this.Xg=new z().u(),this.oc=null,this.ru=null,this.lu=NaN,this.En=D.TopLeft,this.Un=D.BottomRight,this.rc=NaN,this.lc=NaN,this.Bn=2}copy(){let t=new kt;if(t.n=this.n&-2,t.H=this.H,t.we=this.we,t.xe=this.xe,t.Qi=this.Qi,t._i=this._i,this.H===4){let e=this.Rs.r,i=t.Rs;for(let s=0;s<e.length;s++){let n=e[s];i.add(n.copy())}t.Rs=i}else t.Rs=this.Rs;return t.zg=this.zg,t.Xg.a(this.Xg),t.oc=this.oc,t.ru=this.ru,t.lu=this.lu,t.En=this.En.P(),t.Un=this.Un.P(),t.rc=this.rc,t.lc=this.lc,t.Bn=this.Bn,t}static Line=1;static Rectangle=2;static Ellipse=3;static Path=4;static Nw=new j().u();get h(){return(this.n&1)!==0}set h(t){t?this.n|=1:this.n&=-2}get wt(){return(this.n&2)!==0}set wt(t){t?this.n|=2:this.n&=-3}u(){if(this.h=!0,this.type!==4)return this;let t=this.figures;t.u();for(let e of t)e.u();return this}equalsApprox(t){if(!(t instanceof kt))return!1;if(this.type!==t.type)return this.type===1&&t.type===4?this.FC(t):t.type===1&&this.type===4?t.FC(this):!1;if(this.type===4){let e=this.figures.r,i=t.figures.r,s=e.length;if(s!==i.length)return!1;for(let n=0;n<s;n++){let o=e[n],r=i[n];if(!o.equalsApprox(r))return!1}return!0}else return L.f(this.startX,t.startX)&&L.f(this.startY,t.startY)&&L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)}FC(t){if(this.type!==1||t.type!==4)return!1;if(t.figures.count===1){let e=t.figures.elt(0);if(e.segments.count===1&&L.f(this.startX,e.startX)&&L.f(this.startY,e.startY)){let i=e.segments.elt(0);if(i.type===2&&L.f(this.endX,i.endX)&&L.f(this.endY,i.endY))return!0}}return!1}static stringify(t){return t.toString()}static stringifyFixed(t){return f.s(t,"number",kt,"stringifyFixed:digits"),e=>e.toString(t)}oi(t){t in ei?this.type=t:f.er(this,t)}toString(t){t===void 0&&(t=-1);let e=s=>s===0?"0":s.toFixed(t),i;switch(this.type){case 1:return t<0?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+e(this.startX)+" "+e(this.startY)+"L"+e(this.endX)+" "+e(this.endY);case 2:return i=new z(this.startX,this.startY,0,0),i.union(this.endX,this.endY,0,0),t<0?"M"+i.x.toString()+" "+i.y.toString()+"H"+i.right.toString()+"V"+i.bottom.toString()+"H"+i.left.toString()+"z":"M"+e(i.x)+" "+e(i.y)+"H"+e(i.right)+"V"+e(i.bottom)+"H"+e(i.left)+"z";case 3:if(i=new z(this.startX,this.startY,0,0),i.union(this.endX,this.endY,0,0),t<0){let r=i.left.toString()+" "+(i.y+i.height/2).toString(),a=i.right.toString()+" "+(i.y+i.height/2).toString();return"M"+r+"A"+(i.width/2).toString()+" "+(i.height/2).toString()+" 0 0 1 "+a+"A"+(i.width/2).toString()+" "+(i.height/2).toString()+" 0 0 1 "+r}else{let r=e(i.left)+" "+e(i.y+i.height/2),a=e(i.right)+" "+e(i.y+i.height/2);return"M"+r+"A"+e(i.width/2)+" "+e(i.height/2)+" 0 0 1 "+a+"A"+e(i.width/2)+" "+e(i.height/2)+" 0 0 1 "+r}case 4:let s="",n=this.figures.r,o=n.length;for(let r=0;r<o;r++){let a=n[r];r>0&&(s+=" x "),a.isFilled&&(s+="F "),s+=a.toString(t)}return s;default:return ei[this.type]}}static fillPath(t){typeof t!="string"&&f.Zi(t,"string",kt,"fillPath:str");let e=t.split(/[Xx]/),i=e.length,s="";for(let n=0;n<i;n++){let o=e[n];if(o.match(/[Ff]/)!==null){n===0?s+=o:s+="X"+(o[0]===" "?"":" ")+o;continue}s+=(n===0?"":"X ")+"F"+(o[0]===" "?"":" ")+o}return s}static Yg="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";static parse(t,e){e===void 0&&(e=!1),typeof t!="string"&&f.Zi(t,"string",kt,"parse:str");let i=new RegExp("(["+kt.Yg+"])(["+kt.Yg+"])","gm"),s=new RegExp("(["+kt.Yg+"])([^s])","gm"),n=new RegExp("([^s])(["+kt.Yg+"])","gm");t=t.replace(/,/gm," "),t=t.replace(i,"$1 $2"),t=t.replace(i,"$1 $2"),t=t.replace(s,"$1 $2"),t=t.replace(n,"$1 $2"),t=t.replace(/([0-9])([+\-])/gm,"$1 $2"),t=t.replace(/[\s\r\t\n]+/gm," "),t=t.replace(/^\s+|\s+$/g,"");let o=t.split(" ");for(let R=0;R<o.length;R++){let O=o[R];if(O.match(/(\.[0-9]*)(\.)/gm)!==null){let B=f.et(),K="",Y=!1;for(let X=0;X<O.length;X++){let G=O[X];G==="."&&!Y?(Y=!0,K+=G):G==="."?(B.push(K),K="."):K+=G}B.push(K),o.splice(R,1);for(let X=0;X<B.length;X++)o.splice(R+X,0,B[X]);R+=B.length-1,f.J(B)}}let r=-1,a="",h="",l=new P(0,0),u=new P(0,0),c=new P(0,0),d=!0;function g(){return r>=v-1||o[r+1].match(N)!==null?!0:(d=!1,!1)}function p(){return r++,o[r]}function m(R){let O=parseFloat(p()),B=parseFloat(p());a===a.toLowerCase()&&(O=c.x+O,B=c.y+B),R.i(O,B)}function y(){return m(c),c}function w(){return m(u),u}function b(){let R=h.toLowerCase();return R==="c"||R==="s"||R==="q"||R==="t"?new P(2*c.x-u.x,2*c.y-u.y):new P(c.x,c.y)}let v=o.length,k=Ke.RC(null),S=!1,M=!1,F=!1,T=!0,N=new RegExp("["+kt.Yg+"]");for(;!(r>=v-1);){if(h=a,a=p(),a==="")continue;d=!0;let R=!1;switch(a.toUpperCase()){case"X":T=!0,S=!1,M=!1;break;case"M":let O=y();for(k.bi===null||T===!0?(k.hu(O.x,O.y,S,!1,!M,F),T=!1):k.sF(O.x,O.y),l.a(c);!g();){let B=y();k.lr(B.x,B.y)}break;case"L":for(;!g();){let B=y();k.lr(B.x,B.y)}d&&(R=!0);break;case"H":for(;!g();)c.i((a===a.toLowerCase()?c.x:0)+parseFloat(p()),c.y),k.lr(c.x,c.y);break;case"V":for(;!g();)c.i(c.x,(a===a.toLowerCase()?c.y:0)+parseFloat(p())),k.lr(c.x,c.y);d&&(R=!0);break;case"C":for(;!g();){let B=new P;m(B);let K=w(),Y=y();k.hr(B.x,B.y,K.x,K.y,Y.x,Y.y)}d&&(R=!0);break;case"S":for(;!g();){let B=b(),K=w(),Y=y();k.hr(B.x,B.y,K.x,K.y,Y.x,Y.y)}d&&(R=!0);break;case"Q":for(;!g();){let B=w(),K=y();k.Cw(B.x,B.y,K.x,K.y)}d&&(R=!0);break;case"T":for(;!g();){let B=b();u.a(B);let K=y();k.Cw(B.x,B.y,K.x,K.y),u.a(K)}d&&(R=!0);break;case"B":for(;!g();){let B=parseFloat(p()),K=parseFloat(p()),Y=parseFloat(p()),X=parseFloat(p()),G=parseFloat(p()),nt=G,at=!1;g()||(nt=parseFloat(p()),g()||(at=parseFloat(p())!==0)),a===a.toLowerCase()&&(Y+=c.x,X+=c.y),k.nF(B,K,Y,X,G,nt,at)}d&&(R=!0);break;case"A":for(;!g();){let B=Math.abs(parseFloat(p())),K=Math.abs(parseFloat(p())),Y=parseFloat(p()),X=!1,G=!1,nt=0,at=0,tt=p();tt.length===1?(X=!!parseFloat(tt),G=!!parseFloat(p()),nt=parseFloat(p()),at=parseFloat(p())):tt.length===2?(X=!!parseFloat(tt[0]),G=!!parseFloat(tt[1]),nt=parseFloat(p()),at=parseFloat(p())):(X=!!parseFloat(tt[0]),G=!!parseFloat(tt[1]),nt=parseFloat(tt.slice(2)),at=parseFloat(p())),a===a.toLowerCase()&&(nt=c.x+nt,at=c.y+at),c.i(nt,at),k.oF(B,K,Y,X,G,nt,at)}d&&(R=!0);break;case"Z":k.rF(),c.a(l);break;case"F":{let B="",K=1;for(;o[r+K];){if(o[r+K]==="0"){F=!0,K++;continue}if(o[r+K].match(/[Uu]/)!==null){K++;continue}if(o[r+K].match(N)===null){K++;continue}B=o[r+K];break}B.match(/[Mm]/)?S=!0:k.lF();break}case"U":{let B="",K=1;for(;o[r+K];){if(o[r+K].match(/[Ff]/)!==null){K++;continue}if(o[r+K].match(N)===null){K++;continue}B=o[r+K];break}B.match(/[Mm]/)?M=!0:k.hF(!1);break}default:if(a==="0"||a==="1")break;f.ni("Unknown geometry command: "+a);break}if(R){f.ni(`Bad geometry command: ${a}, next token: ${p()},
|
3
|
+
v1.1.0-next.20250819 */
|
4
|
+
import{a as Zn}from"./QJCXGJ6L.js";import{a as Jn}from"./ZJAISNB5.js";import"./FVXZDOFO.js";import"./VK2K5XNT.js";import{b as $n}from"./ELYCXPDG.js";import{C as Zs,D as Qs,E as Wn,h as qn,i as Hn}from"./52DTSHHU.js";import"./SAH5BHRY.js";(function(){let A=typeof globalThis=="object"&&globalThis||typeof global=="object"&&global.global===global&&global||typeof self=="object"&&self.self===self&&self||{};A.requestAnimationFrame===void 0&&(A.setImmediate===void 0?A.requestAnimationFrame=x=>A.setTimeout(x,0):A.requestAnimationFrame=A.setImmediate);class f{static tr=A.navigator!==void 0&&A.navigator.platform!==void 0&&A.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i)!==null;static Rk(t,e,i){let s=-1;return function(){let n=this,o=arguments;s!==-1&&f.Tg(s),s=f.ir(()=>{s=-1,i||t.apply(n,o)},e),i&&!s&&t.apply(n,o)}}static ir(t,e){return A.setTimeout(t,e)}static Tg(t){A.clearTimeout(t)}static hs(t){return A.document.createElement(t)}static o(t){throw new Error(t)}static L(t,e){let i="The object is frozen, so its properties cannot be set: "+t.toString();e!==void 0&&(i+=" to value: "+e),f.o(i)}static dE(t,e,i,s){}static s(t,e,i,s){}static gE(t,e,i){}static ec(t,e,i){if(t===null||typeof t!="object"){let s=f.fC(e);i!==void 0&&(s+="."+i),f.Zi(t,"object",s)}}static k(t,e,i){f.s(t,"function",e,i)}static mE(t,e,i){}static Zi(t,e,i,s){}static W(t,e,i,s){let n=f.fC(i);s!==void 0&&(n+="."+s),f.o(n+" is not in the range "+e+": "+t)}static Re(t){}static er(t,e){}static ni(t){A.console&&A.console.log(t)}static G(t){return t!==null&&typeof t=="object"}static it(t){return typeof t=="function"}static vk=[];static et(){let t=f.vk.pop();return t===void 0?[]:t}static J(t){t.length=0,f.vk.push(t)}static pE=Object.freeze([]);static fC(t){return t===null?"*":typeof t=="string"?t:f.it(t)?t.name:""}static Dn(t){return f.it(t)?t.className?t.className:t.name:f.G(t)&&t.constructor?f.Dn(t.constructor):typeof t}static Uh(t,e){return e==null||e===""?null:f.G(t)&&e in t||t[e]?t[e]:null}static toString(t){let e=t;return f.G(t)&&(t.text?e=t.text:t.name?e=t.name:t.key!==void 0?e=t.key:t.id!==void 0?e=t.id:t.constructor===Object&&(t.Text?e=t.Text:t.Name?e=t.Name:t.Key!==void 0?e=t.Key:t.Id!==void 0?e=t.Id:t.ID!==void 0&&(e=t.ID))),e===void 0?"undefined":e===null?"null":e.toString()}static gw(t,e){if(t.hasOwnProperty(e))return!0;let i=Object.getPrototypeOf(t);for(;i&&i!==Function;){if(i.hasOwnProperty(e))return!0;let s=i.yE;if(s&&s[e])return!0;i=Object.getPrototypeOf(i)}return!1}static WD(t){let e=[],i=0;for(i=0;i<256;i++)e[i]=i;let s=0,n=0;for(i=0;i<256;i++)s=(s+e[i]+119)%256,n=e[i],e[i]=e[s],e[s]=n;i=0,s=0;let o="";for(let r=0;r<t.length;r++)i=(i+1)%256,s=(s+e[i])%256,n=e[i],e[i]=e[s],e[s]=n,o+=String.fromCharCode(t.charCodeAt(r)^e[(e[i]+e[s])%256]);return o}static JD(t){let e="0123456789abcdef",i=[];for(let r=0;r<256;r++)i[e.charAt(r>>4)+e.charAt(r&15)]=String.fromCharCode(r);t.length%2&&(t="0"+t);let s=[],n=0;for(let r=0;r<t.length;r+=2)s[n++]=i[t.substring(r,r+2)];let o=s.join("");return o===""?"0":o}static Ts(t){return f.WD(f.JD(t))}static color1="@COLOR1";static color2="@COLOR2";static mw="32ab5ff3b26f42dc0ed90f21412913b5"}f.vfo="29e646fdb160";class V{Ok;constructor(){this.Ok=[]}toString(){return this.Ok.join("")}add(t){t!==""&&this.Ok.push(t)}}class q{}class W{g;constructor(){this.g=[]}[Symbol.iterator](){return this.g.values()}key;value;get iterator(){return this}reset(){}next(){return!1}hasNext(){return!1}first(){return null}any(){return!1}all(){return!0}each(){return this}map(t){return this}filter(){return this}get count(){return 0}ul(){}toString(){return"EmptyIterator"}static instance=new W}class ${constructor(t){this.key=-1,this.value=t}[Symbol.iterator](){return[this.value].values()}key;value;get iterator(){return this}reset(){this.key=-1}next(){return this.key===-1?(this.key=0,!0):!1}hasNext(){return this.next()}first(){return this.key=0,this.value}any(t){return this.key=-1,t(this.value)}all(t){return this.key=-1,t(this.value)}each(t){return this.key=-1,t(this.value),this}map(t){return new $(t(this.value))}filter(t){return t(this.value)?new $(this.value):W.instance}get count(){return 1}ul(){this.value=null}toString(){return"SingletonIterator("+this.value+")"}}class it{qt;Ds;Gt;At;constructor(t){this.qt=t,this.Ds=null,t.sr=null,this.Gt=t.nt,this.At=-1}[Symbol.iterator](){return this.Ds===null?this.qt.r.values():this.qt.r.filter(this.Ds).values()}key;value;get iterator(){return this}get predicate(){return this.Ds}set predicate(t){this.Ds=t}reset(){let t=this.qt;t.sr=null,this.Gt=t.nt,this.At=-1}next(){let t=this.qt;if(t.nt!==this.Gt){if(this.key<0)return!1;f.Re(t)}let e=t.r,i=e.length,s=++this.At,n=this.Ds;if(n!==null)for(;s<i;){let o=e[s];if(n(o))return this.At=s,this.key=s,this.value=o,!0;s++}else{if(s<i)return this.key=s,this.value=e[s],!0;this.ul()}return!1}hasNext(){return this.next()}first(){let t=this.qt;this.Gt=t.nt,this.At=0;let e=t.r,i=e.length,s=this.Ds;if(s!==null){let n=0;for(;n<i;){let o=e[n];if(s(o))return this.At=n,this.key=n,this.value=o,o;n++}return null}else if(i>0){let n=e[0];return this.key=0,this.value=n,n}else return null}any(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(t(a))return!0;e.nt!==i&&f.Re(e)}}return!1}all(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];if(!(o!==null&&!o(a))){if(!t(a))return!1;e.nt!==i&&f.Re(e)}}return!0}each(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=e.r,n=s.length,o=this.Ds;for(let r=0;r<n;r++){let a=s[r];o!==null&&!o(a)||(t(a),e.nt!==i&&f.Re(e))}return this}map(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=[],n=e.r,o=n.length,r=this.Ds;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(s.push(t(l)),e.nt!==i&&f.Re(e))}let a=new j;return a.r=s,a.ve(),a.iterator}filter(t){let e=this.qt;e.sr=null;let i=e.nt;this.At=-1;let s=[],n=e.r,o=n.length,r=this.Ds;for(let h=0;h<o;h++){let l=n[h];r!==null&&!r(l)||(t(l)&&s.push(l),e.nt!==i&&f.Re(e))}let a=new j;return a.r=s,a.ve(),a.iterator}get count(){let t=this.Ds;if(t!==null){let e=0,i=this.qt.r,s=i.length;for(let n=0;n<s;n++)t(i[n])&&e++;return e}else return this.qt.r.length}ul(){this.key=-1,this.value=null,this.Gt=-1,this.Ds=null,this.qt.sr=this}toString(){return"ListIterator@"+this.At+"/"+this.qt.count}}class ht{qt;Gt;At;constructor(t){this.qt=t,t.nr=null,this.Gt=t.nt,this.At=t.r.length}[Symbol.iterator](){return this.qt.r.reverse().values()}key;value;get iterator(){return this}reset(){let t=this.qt;t.nr=null,this.Gt=t.nt,this.At=t.r.length}next(){let t=this.qt;if(t.nt!==this.Gt){if(this.key<0)return!1;f.Re(t)}let e=--this.At;return e>=0?(this.key=e,this.value=t.r[e],!0):(this.ul(),!1)}hasNext(){return this.next()}first(){let t=this.qt;this.Gt=t.nt;let e=t.r,i=e.length-1;if(this.At=i,i>=0){let s=e[i];return this.key=i,this.value=s,s}else return null}any(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];if(t(r))return!0;e.nt!==i&&f.Re(e)}return!1}all(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];if(!t(r))return!1;e.nt!==i&&f.Re(e)}return!0}each(t){let e=this.qt;e.nr=null;let i=e.nt,s=e.r,n=s.length;this.At=n;for(let o=n-1;o>=0;o--){let r=s[o];t(r),e.nt!==i&&f.Re(e)}return this}map(t){let e=this.qt;e.nr=null;let i=e.nt,s=[],n=e.r,o=n.length;this.At=o;for(let a=o-1;a>=0;a--){let h=n[a];s.push(t(h)),e.nt!==i&&f.Re(e)}let r=new j;return r.r=s,r.ve(),r.iterator}filter(t){let e=this.qt;e.nr=null;let i=e.nt,s=[],n=e.r,o=n.length;this.At=o;for(let a=o-1;a>=0;a--){let h=n[a];t(h)&&s.push(h),e.nt!==i&&f.Re(e)}let r=new j;return r.r=s,r.ve(),r.iterator}get count(){return this.qt.r.length}ul(){this.key=-1,this.value=null,this.Gt=-1,this.qt.nr=this}toString(){return"ListIteratorBackwards("+this.At+"/"+this.qt.count+")"}}class j{h;r;nt;sr;nr;constructor(t){I.Ki(this),this.h=!1,this.r=[],this.nt=0,this.sr=null,this.nr=null,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.r.values()}ve(){let t=this.nt;t++,t>999999999&&(t=0),this.nt=t}u(){return this.h=!0,this}Pt(){return this.h=!1,this}toString(){return"List()#"+I.as(this)}add(t){return this.h&&f.L(this,t),this.r.push(t),this.ve(),this}push(t){this.add(t)}addAll(t){if(t===null)return this;this.h&&f.L(this);let e=this.r;if(Array.isArray(t)){let i=t.length;for(let s=0;s<i;s++){let n=t[s];e.push(n)}}else{let i=t.iterator;for(;i.next();){let s=i.value;e.push(s)}}return this.ve(),this}clear(){this.h&&f.L(this),this.r.length=0,this.ve()}contains(t){return this.has(t)}has(t){return t===null?!1:this.r.indexOf(t)!==-1}indexOf(t){return t===null?-1:this.r.indexOf(t)}elt(t){let e=this.r;return(t<0||t>=e.length)&&f.W(t,"0 <= i < length",j,"elt:i"),e[t]}get(t){return this.elt(t)}setElt(t,e){let i=this.r;(t<0||t>=i.length)&&f.W(t,"0 <= i < length",j,"setElt:i"),this.h&&f.L(this,t),i[t]=e}set(t,e){this.setElt(t,e)}first(){let t=this.r;return t.length===0?null:t[0]}last(){let t=this.r,e=t.length;return e>0?t[e-1]:null}pop(){this.h&&f.L(this);let t=this.r;return t.length>0?t.pop():null}any(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++){if(t(e[n]))return!0;this.nt!==i&&f.Re(this)}return!1}all(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++){if(!t(e[n]))return!1;this.nt!==i&&f.Re(this)}return!0}each(t){let e=this.r,i=this.nt,s=e.length;for(let n=0;n<s;n++)t(e[n]),this.nt!==i&&f.Re(this);return this}map(t){let e=new j,i=[],s=this.r,n=this.nt,o=s.length;for(let r=0;r<o;r++)i.push(t(s[r])),this.nt!==n&&f.Re(this);return e.r=i,e.ve(),e}filter(t){let e=new j,i=[],s=this.r,n=this.nt,o=s.length;for(let r=0;r<o;r++){let a=s[r];t(a)&&i.push(a),this.nt!==n&&f.Re(this)}return e.r=i,e.ve(),e}insertAt(t,e){t<0&&f.W(t,">= 0",j,"insertAt:i"),this.h&&f.L(this,t);let i=this.r;t>=i.length?i.push(e):i.splice(t,0,e),this.ve()}remove(t){return this.delete(t)}delete(t){if(t===null)return!1;this.h&&f.L(this,t);let e=this.r,i=e.indexOf(t);return i===-1?!1:(i===e.length-1?e.pop():e.splice(i,1),this.ve(),!0)}removeAt(t){let e=this.r;(t<0||t>=e.length)&&f.W(t,"0 <= i < length",j,"removeAt:i"),this.h&&f.L(this,t),t===e.length-1?e.pop():e.splice(t,1),this.ve()}removeRange(t,e){let i=this.r,s=i.length;if(t<0)t=0;else if(t>=s)return this;if(e<0)return this;if(e>=s&&(e=s-1),t>e)return this;this.h&&f.L(this);let n=t,o=e+1;for(;o<s;)i[n++]=i[o++];return i.length=s-(e-t+1),this.ve(),this}copy(){let t=new j,e=this.r;return e.length>0&&(t.r=Array.prototype.slice.call(e)),t}toArray(){let t=this.r,e=this.count,i=new Array(e);for(let s=0;s<e;s++)i[s]=t[s];return i}get uC(){return this.r}toSet(){let t=new I,e=this.r,i=this.count;for(let s=0;s<i;s++)t.add(e[s]);return t}sort(t){return this.h&&f.L(this),this.r.sort(t),this.ve(),this}sortRange(t,e,i){let s=this.r,n=s.length;e===void 0&&(e=0),i===void 0&&(i=n),this.h&&f.L(this);let o=i-e;if(o<=1)return this;if((e<0||e>=n-1)&&f.W(e,"0 <= from < length",j,"sortRange:from"),o===2){let r=s[e],a=s[e+1];return t(r,a)>0&&(s[e]=a,s[e+1]=r,this.ve()),this}if(e===0)if(i>=n)s.sort(t);else{let r=s.slice(0,i);r.sort(t);for(let a=0;a<i;a++)s[a]=r[a]}else if(i>=n){let r=s.slice(e);r.sort(t);for(let a=e;a<n;a++)s[a]=r[a-e]}else{let r=s.slice(e,i);r.sort(t);for(let a=e;a<i;a++)s[a]=r[a-e]}return this.ve(),this}reverse(){return this.h&&f.L(this),this.r.reverse(),this.ve(),this}get count(){return this.r.length}get size(){return this.r.length}get length(){return this.r.length}get iterator(){if(this.r.length<=0)return W.instance;let t=this.sr;return t!==null?(t.reset(),t):new it(this)}get iteratorBackwards(){if(this.r.length<=0)return W.instance;let t=this.nr;return t!==null?(t.reset(),t):new ht(this)}}class Tt{wo;ii;constructor(t){this.wo=t,this.ii=t.g.values()}[Symbol.iterator](){return this.wo.g.values()}key;value;get iterator(){return this}reset(){let t=this.wo;this.ii=t.g.values()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.wo.g.size===0?null:(this.ii=this.wo.g.values(),this.ii.next().value)}any(t){return this.wo.any(t)}all(t){return this.wo.all(t)}each(t){return this.wo.each(t),this}map(t){let e=new j;return this.wo.g.forEach(i=>e.add(t(i))),e.iterator}filter(t){let e=new j;return this.wo.g.forEach(i=>{t(i)&&e.add(i)}),e.iterator}get count(){return this.wo.count}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"SetIterator"}}class I{h;g;constructor(t){this.h=!1,this.g=new Set,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.values()}values(){return this.g.values()}u(){return this.h=!0,this}Pt(){return this.h=!1,this}toString(){return"Set()#"+I.as(this)}add(t){return t===null?this:(this.g.add(t),this)}addAll(t){if(t===null)return this;if(Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];s!==null&&this.g.add(s)}}else{let e=t.iterator;for(;e.next();){let i=e.value;i!==null&&this.g.add(i)}}return this}has(t){return this.g.has(t)}contains(t){return this.has(t)}containsAll(t){if(t===null)return!0;let e=t.iterator;for(;e.next();)if(!this.has(e.value))return!1;return!0}containsAny(t){if(t===null)return!0;let e=t.iterator;for(;e.next();)if(this.has(e.value))return!0;return!1}first(){return this.g.size===0?null:this.g.values().next().value}any(t){for(let e of this.g)if(t(e))return!0;return!1}all(t){for(let e of this.g)if(!t(e))return!1;return!0}each(t){for(let e of this.g)t(e);return this}map(t){let e=new I;for(let i of this.g)e.add(t(i));return e}filter(t){let e=new I;for(let i of this.g)t(i)&&e.add(i);return e}delete(t){return this.h&&f.L(this),this.g.delete(t)}remove(t){return this.delete(t)}removeAll(t){if(t===null)return this;if(this.h&&f.L(this),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++)this.delete(t[i])}else{let e=t.iterator;for(;e.next();)this.delete(e.value)}return this}retainAll(t){if(t===null)return this;if(this.count===0)return this;this.h&&f.L(this);let e=new I;e.addAll(t);let i=[],s=this.iterator;for(;s.next();){let n=s.value;e.has(n)||i.push(n)}return this.removeAll(i),this}clear(){this.h&&f.L(this),this.g.clear()}copy(){let t=new I;return this.g.forEach(e=>t.add(e)),t}toArray(){return Array.from(this.g)}toList(){let t=new j;return this.g.forEach(e=>t.add(e)),t}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?W.instance:new Tt(this)}entries(){return this.g.entries()}keys(){return this.g.keys()}forEach(t,e){return this.g.forEach(t,e)}static pw=1;static Ki(t){t.__gohashid=I.pw++}static as(t){return t.__gohashid}}class Rt{q;ii;constructor(t){this.q=t,this.ii=t.g.keys()}[Symbol.iterator](){return this.q.g.keys()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.keys()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.q.g.size===0?null:(this.ii=this.q.g.keys(),this.ii.next().value)}any(t){for(let e of this.q.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.q.g)t(e[0]);return this}map(t){let e=this.q,i=new j;for(let s of e.g)i.add(t(s[0]));return i.iterator}filter(t){let e=this.q,i=new j;for(let s of e.g){let n=s[0];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapKeySetIterator"}}class he extends I{q;constructor(t){super(),I.Ki(this),this.h=!0,this.q=t}[Symbol.iterator](){return this.g.keys()}values(){return this.g.keys()}u(){return this}Pt(){return this}toString(){return"MapKeySet("+this.q.toString()+")"}add(t){f.o("This Set is read-only: "+this.toString())}has(t){return this.q.has(t)}contains(t){return this.has(t)}delete(t){f.o("This Set is read-only: "+this.toString())}remove(t){return this.delete(t)}clear(){f.o("This Set is read-only: "+this.toString())}first(){return this.q.g.size===0?null:this.q.g.keys().next().value}any(t){for(let e of this.q.g)if(t(e[0]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[0]))return!1;return!0}each(t){for(let e of this.q.g)t(e[0]);return this}map(t){let e=new I;for(let i of this.q.g)e.add(t(i[0]));return e}filter(t){let e=new I;for(let i of this.q.g){let s=i[0];t(s)&&e.add(s)}return e}copy(){return new he(this.q)}toSet(){let t=new I,e=this.q.g;for(let i of e)t.add(i[0]);return t}toArray(){let t=this.q.g,e=new Array(t.size),i=0;for(let s of t)e[i]=s[0],i++;return e}toList(){let t=new j,e=this.q.g;for(let i of e)t.add(i[0]);return t}get count(){return this.q.size}get size(){return this.q.size}get iterator(){return this.q.size<=0?W.instance:new Rt(this.q)}}class Oe{q;ii;constructor(t){this.q=t,this.ii=t.g.values()}[Symbol.iterator](){return this.q.g.values()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.values()}next(){let t=this.ii.next();return this.value=t.value,this.key=t.value,!t.done}hasNext(){return this.next()}first(){return this.q.g.size===0?null:(this.ii=this.q.g.values(),this.ii.next().value)}any(t){for(let e of this.q.g)if(t(e[1]))return!0;return!1}all(t){for(let e of this.q.g)if(!t(e[1]))return!1;return!0}each(t){for(let e of this.q.g)t(e[1]);return this}map(t){let e=this.q,i=new j;for(let s of e.g)i.add(t(s[1]));return i.iterator}filter(t){let e=this.q,i=new j;for(let s of e.g){let n=s[1];t(n)&&i.add(n)}return i.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapValueSetIterator"}}class Ut{constructor(t,e){this.key=t,this.value=e}toString(){return"{"+this.key+":"+this.value+"}"}key;value}class Wt{q;ii;constructor(t){this.q=t,this.ii=t.g.entries()}[Symbol.iterator](){return this.q.g.entries()}key;value;get iterator(){return this}reset(){let t=this.q;this.ii=t.g.entries()}next(){let t=this.ii.next();return t.done?(this.key=null,this.value=null,!1):(this.key=t.value[0],this.value=t.value[1],!0)}hasNext(){return this.next()}first(){if(this.q.g.size===0)return null;this.ii=this.q.g.entries();let t=this.ii.next().value;return this.key=t[0],this.value=t[1],new Ut(t[0],t[1])}any(t){return this.q.any(t)}all(t){return this.q.all(t)}each(t){return this.q.each(t),this}map(t){let e=new j,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ut(n,s):(i.key=n,i.value=s),e.add(t(i))}),e.iterator}filter(t){let e=new j,i=null;return this.q.g.forEach((s,n)=>{i===null?i=new Ut(n,s):(i.key=n,i.value=s),t(i)&&(e.add(i),i=null)}),e.iterator}get count(){return this.q.size}ul(){this.key=null,this.value=null,this.ii=null}toString(){return"MapIterator"}}class pt{h;g;constructor(t){I.Ki(this),this.h=!1,this.g=new Map,t!==void 0&&this.addAll(t)}[Symbol.iterator](){return this.g.entries()}entries(){return this.g.entries()}u(){return this.h=!0,this}Pt(){return this.h=!1,this}toString(){return"Map()#"+I.as(this)}set(t,e){return this.h&&f.L(this,t),this.g.set(t,e),this}add(t,e){return this.set(t,e)}addAll(t){if(t===null)return this;if(this.h&&f.L(this),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];this.set(s.key,s.value)}}else if(t instanceof pt){let e=t.iterator;for(;e.next();)this.set(e.key,e.value)}else{let e=t.iterator;for(;e.next();){let i=e.value;this.set(i.key,i.value)}}return this}first(){if(this.g.size===0)return null;let t=this.g.entries().next().value;return new Ut(t[0],t[1])}any(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new Ut(i,s):(e.key=i,e.value=s),t(e))return!0;return!1}all(t){let e=null;for(let[i,s]of this.g)if(e===null?e=new Ut(i,s):(e.key=i,e.value=s),!t(e))return!1;return!0}each(t){let e=null;for(let[i,s]of this.g)e===null?e=new Ut(i,s):(e.key=i,e.value=s),t(e);return this}map(t){let e=new pt,i=null;for(let[s,n]of this.g)i===null?i=new Ut(s,n):(i.key=s,i.value=n),e.set(s,t(i));return e}filter(t){let e=new pt,i=null;for(let[s,n]of this.g)i===null?i=new Ut(s,n):(i.key=s,i.value=n),t(i)&&e.set(s,n);return e}has(t){return this.g.has(t)}contains(t){return this.has(t)}get(t){let e=this.g.get(t);return e===void 0?null:e}getValue(t){return this.get(t)}delete(t){return t===null?!1:(this.h&&f.L(this,t),this.g.delete(t))}remove(t){return this.delete(t)}clear(){this.h&&f.L(this),this.g.clear()}copy(){let t=new pt;return t.g=new Map(this.g),t}toArray(){let t=this.g,e=new Array(t.size),i=0;for(let s of t)e[i]=new Ut(s[0],s[1]),i++;return e}toKeySet(){return new he(this)}get count(){return this.g.size}get size(){return this.g.size}get iterator(){return this.g.size<=0?W.instance:new Wt(this)}get iteratorKeys(){return this.count<=0?W.instance:new Rt(this)}keys(){return this.g.keys()}get iteratorValues(){return this.count<=0?W.instance:new Oe(this)}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}}class P{px;py;h;constructor(t,e){t===void 0?(this.px=0,this.py=0):typeof t=="number"&&typeof e=="number"?(this.px=t,this.py=e):f.o("Invalid arguments to Point constructor: "+t+", "+e),this.h=!1}a(t){return this.px=t.px,this.py=t.py,this}i(t,e){return this.px=t,this.py=e,this}setTo(t,e){return this.px=t,this.py=e,this}set(t){return this.px=t.px,this.py=t.py,this}copy(){let t=new P;return t.px=this.px,t.py=this.py,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;return n=e[i++],n&&(o=parseFloat(n)),new P(s,o)}else return new P}static stringify(t){return t.x.toString()+" "+t.y.toString()}static stringifyFixed(t){return f.s(t,"number",P,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)}toString(){return"Point("+this.x+","+this.y+")"}equals(t){return t instanceof P?this.px===t.x&&this.py===t.y:!1}equalTo(t,e){return this.px===t&&this.py===e}equalsApprox(t){return L.f(this.px,t.x)&&L.f(this.py,t.y)}add(t){return this.px+=t.x,this.py+=t.y,this}subtract(t){return this.px-=t.x,this.py-=t.y,this}offset(t,e){return this.px+=t,this.py+=e,this}rotate(t){if(t===0)return this;let e=this.px,i=this.py;if(e===0&&i===0)return this;let s=0,n=0;if(t>=360?t-=360:t<0&&(t+=360),t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let o=t*Math.PI/180;s=Math.cos(o),n=Math.sin(o)}return this.px=s*e-n*i,this.py=n*e+s*i,this}scale(t,e){return this.px*=t,this.py*=e,this}distanceSquaredPoint(t){let e=t.x-this.px,i=t.y-this.py;return e*e+i*i}distanceSquared(t,e){let i=t-this.px,s=e-this.py;return i*i+s*s}normalize(){let t=this.px,e=this.py,i=Math.sqrt(t*t+e*e);return i>0&&(this.px=t/i,this.py=e/i),this}directionPoint(t){return this.dC(t.x-this.px,t.y-this.py)}direction(t,e){return this.dC(t-this.px,e-this.py)}dC(t,e){if(t===0)return e>0?90:e<0?270:0;if(e===0)return t>0?0:180;{if(isNaN(t)||isNaN(e))return 0;let i=Math.atan(Math.abs(e/t))*180/Math.PI;return t<0?e<0?i+=180:i=180-i:e<0&&(i=360-i),i}}static compareWithLineSegment(t,e,i,s,n,o){return L.eu(t,e,i,s,n,o)}compareWithLineSegmentPoint(t,e){return L.eu(t.x,t.y,e.x,e.y,this.x,this.y)}static intersectingLineSegments(t,e,i,s,n,o,r,a){return L.su(t,e,i,s,n,o,r,a)}projectOntoLineSegment(t,e,i,s){return L.dl(t,e,i,s,this.px,this.py,this),this}projectOntoLineSegmentPoint(t,e){return L.dl(t.x,t.y,e.x,e.y,this.px,this.py,this),this}snapToGrid(t,e,i,s){return L.Dg(this.px,this.py,t,e,i,s,this),this}snapToGridPoint(t,e){return L.Dg(this.px,this.py,t.x,t.y,e.width,e.height,this),this}setRectSpot(t,e){return this.px=t.x+e.x*t.width+e.offsetX,this.py=t.y+e.y*t.height+e.offsetY,this}setSpot(t,e,i,s,n){return this.px=t+n.x*i+n.offsetX,this.py=e+n.y*s+n.offsetY,this}T(t){return t.gt(this),this}Oe(t){return t.$e(this),this}static distanceLineSegmentSquared(t,e,i,s,n,o){let r=n-i,a=o-s,h=r*r+a*a,l=i-t,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 xo=new P(0,0).$();static gC=new P(-1/0,-1/0).$();static mC=new P(1/0,1/0).$();static pC=new P(6,6).$();static Ik=new P(NaN,NaN).$();static Ek=[];static l(){let t=P.Ek.pop();return t===void 0?new P:t}static V(t,e){let i=P.Ek.pop();return i===void 0?new P(t,e):(i.x=t,i.y=e,i)}static e(t){P.Ek.push(t)}}class Q{sw;sh;h;constructor(t,e){t===void 0?(this.sw=0,this.sh=0):typeof t=="number"&&(t>=0||isNaN(t))&&typeof e=="number"&&(e>=0||isNaN(e))?(this.sw=t,this.sh=e):f.o("Invalid arguments to Size constructor: "+t+", "+e),this.h=!1}a(t){return this.sw=t.sw,this.sh=t.sh,this}i(t,e){return this.sw=t,this.sh=e,this}setTo(t,e){return this.sw=t,this.sh=e,this}set(t){return this.sw=t.sw,this.sh=t.sh,this}copy(){let t=new Q;return t.sw=this.sw,t.sh=this.sh,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;return n=e[i++],n&&(o=parseFloat(n)),new Q(s,o)}else return new Q}static stringify(t){return t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return f.s(t,"number",Q,"stringifyFixed:digits"),e=>e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Size("+this.width+","+this.height+")"}equals(t){return t instanceof Q?this.sw===t.width&&this.sh===t.height:!1}equalTo(t,e){return this.sw===t&&this.sh===e}equalsApprox(t){return L.f(this.sw,t.width)&&L.f(this.sh,t.height)}inflate(t,e){let i=this.width+t;this.sw=i>=0?i:0;let s=this.height+e;return this.sh=s>=0?s:0,this}get width(){return this.sw}set width(t){t<0&&f.W(t,">= 0",Q,"width"),this.sw=t}get height(){return this.sh}set height(t){t<0&&f.W(t,">= 0",Q,"height"),this.sh=t}isReal(){return isFinite(this.width)&&isFinite(this.height)}static sc=new Q(0,0).$();static Uk=new Q(1,1).$();static yC=new Q(6,6).$();static nu=new Q(8,8).$();static wC=new Q(10,10).$();static Bk=new Q(1/0,1/0).$();static ww=new Q(NaN,NaN).$();static xC=[];static l(){let t=Q.xC.pop();return t===void 0?new Q:t}static e(t){Q.xC.push(t)}}class z{rx;ry;rw;rh;h;constructor(t,e,i,s){if(t===void 0)this.rx=0,this.ry=0,this.rw=0,this.rh=0;else if(typeof t=="number"&&typeof e=="number"&&typeof i=="number"&&(i>=0||isNaN(i))&&typeof s=="number"&&(s>=0||isNaN(s)))this.rx=t,this.ry=e,this.rw=i,this.rh=s;else if(t instanceof P){let n=t.x,o=t.y;if(e instanceof P){let r=e.x,a=e.y;this.rx=Math.min(n,r),this.ry=Math.min(o,a),this.rw=Math.abs(n-r),this.rh=Math.abs(o-a)}else e instanceof Q?(this.rx=n,this.ry=o,this.rw=e.width,this.rh=e.height):f.o("Incorrect second argument supplied to Rect constructor "+e)}else f.o("Invalid arguments to Rect constructor: "+t+", "+e+", "+i+", "+s);this.h=!1}a(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}i(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}Fn(t,e){return this.rw=t,this.rh=e,this}setTo(t,e,i,s){return this.rx=t,this.ry=e,this.rw=i,this.rh=s,this}set(t){return this.rx=t.rx,this.ry=t.ry,this.rw=t.rw,this.rh=t.rh,this}setPoint(t){return this.rx=t.x,this.ry=t.y,this}setSize(t){return this.rw=t.width,this.rh=t.height,this}copy(){let t=new z;return t.rx=this.rx,t.ry=this.ry,t.rw=this.rw,t.rh=this.rh,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;n=e[i++],n&&(o=parseFloat(n));let r=0;for(;e[i]==="";)i++;n=e[i++],n&&(r=parseFloat(n));let a=0;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),new z(s,o,r,a)}else return new z}static stringify(t){return t.x.toString()+" "+t.y.toString()+" "+t.width.toString()+" "+t.height.toString()}static stringifyFixed(t){return f.s(t,"number",z,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)+" "+e.width.toFixed(t)+" "+e.height.toFixed(t)}toString(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"}equals(t){return t instanceof z?this.rx===t.x&&this.ry===t.y&&this.rw===t.width&&this.rh===t.height:!1}equalTo(t,e,i,s){return this.rx===t&&this.ry===e&&this.rw===i&&this.rh===s}equalsApprox(t){return L.f(this.rx,t.x)&&L.f(this.ry,t.y)&&L.f(this.rw,t.width)&&L.f(this.rh,t.height)}equalsApproxTo(t,e,i,s){return L.f(this.rx,t)&&L.f(this.ry,e)&&L.f(this.rw,i)&&L.f(this.rh,s)}equalsApproxClose(t){return L.z(this.rx,t.x)&&L.z(this.ry,t.y)&&L.z(this.rw,t.width)&&L.z(this.rh,t.height)}containsPoint(t){return this.rx<=t.x&&this.rx+this.rw>=t.x&&this.ry<=t.y&&this.ry+this.rh>=t.y}containsRect(t){return this.rx<=t.x&&t.x+t.width<=this.rx+this.rw&&this.ry<=t.y&&t.y+t.height<=this.ry+this.rh}contains(t,e,i,s){return i===void 0&&(i=0),s===void 0&&(s=0),this.rx<=t&&t+i<=this.rx+this.rw&&this.ry<=e&&e+s<=this.ry+this.rh}offset(t,e){return this.rx+=t,this.ry+=e,this}inflate(t,e){return this.xw(e,t,e,t)}addMargin(t){return this.xw(t.top,t.right,t.bottom,t.left)}subtractMargin(t){return this.xw(-t.top,-t.right,-t.bottom,-t.left)}grow(t,e,i,s){return this.xw(t,e,i,s)}xw(t,e,i,s){let n=this.rw;e+s<=-n?(this.rx+=n/2,this.rw=0):(this.rx-=s,this.rw+=e+s);let o=this.rh;return t+i<=-o?(this.ry+=o/2,this.rh=0):(this.ry-=t,this.rh+=t+i),this}intersectRect(t){return this.bC(t.x,t.y,t.width,t.height)}intersect(t,e,i,s){return this.bC(t,e,i,s)}bC(t,e,i,s){let n=Math.max(this.rx,t),o=Math.max(this.ry,e),r=Math.min(this.rx+this.rw,t+i),a=Math.min(this.ry+this.rh,e+s);return this.rx=n,this.ry=o,this.rw=Math.max(0,r-n),this.rh=Math.max(0,a-o),this}intersectsRect(t){return this.intersects(t.x,t.y,t.width,t.height)}intersects(t,e,i,s){let n=this.rw,o=this.rx;if(n!==1/0&&i!==1/0&&(n+=o,i+=t,isNaN(i)||isNaN(n)||o>i||t>n))return!1;let r=this.rh,a=this.ry;return!(r!==1/0&&s!==1/0&&(r+=a,s+=e,isNaN(s)||isNaN(r)||a>s||e>r))}intersectsRectPlus(t,e){let i=this.rw,s=t.width+e+e,n=this.rx,o=t.x-e;if(i+=n,s+=o,n>s||o>i)return!1;let r=this.rh,a=t.height+e+e,h=this.ry,l=t.y-e;return r+=h,a+=l,!(h>a||l>r)}unionPoint(t){return this.unionNoCheck(t.x,t.y,0,0)}unionRect(t){return this.unionNoCheck(t.rx,t.ry,t.rw,t.rh)}union(t,e,i,s){return i===void 0&&(i=0),s===void 0&&(s=0),this.unionNoCheck(t,e,i,s)}unionNoCheck(t,e,i,s){let n=Math.min(this.rx,t),o=Math.min(this.ry,e),r=Math.max(this.rx+this.rw,t+i),a=Math.max(this.ry+this.rh,e+s);return this.rx=n,this.ry=o,this.rw=r-n,this.rh=a-o,this}setSpot(t,e,i){return this.rx=t-i.offsetX-i.x*this.rw,this.ry=e-i.offsetY-i.y*this.rh,this}static contains(t,e,i,s,n,o,r,a){return r===void 0&&(r=0),a===void 0&&(a=0),t<=n&&n+r<=t+i&&e<=o&&o+a<=e+s}static intersects(t,e,i,s,n,o,r,a){let h=i,l=r,u=t,c=n;if(h+=u,l+=c,u>l||c>h)return!1;let d=s,g=a,p=e,m=o;return d+=p,g+=m,!(p>g||m>d)}static intersectsLineSegment(t,e,i,s,n,o,r,a){return L.kC(t,e,i,s,n,o,r,a)}get x(){return this.rx}set x(t){this.rx=t}get y(){return this.ry}set y(t){this.ry=t}get width(){return this.rw}set width(t){t<0&&f.W(t,">= 0",z,"width"),this.rw=t}get height(){return this.rh}set height(t){t<0&&f.W(t,">= 0",z,"height"),this.rh=t}get left(){return this.rx}set left(t){this.rx=t}get top(){return this.ry}set top(t){this.ry=t}get right(){return this.rx+this.rw}set right(t){this.rx+=t-(this.rx+this.rw)}get bottom(){return this.ry+this.rh}set bottom(t){this.ry+=t-(this.ry+this.rh)}get position(){return new P(this.rx,this.ry)}set position(t){this.rx=t.x,this.ry=t.y}get size(){return new Q(this.rw,this.rh)}set size(t){this.rw=t.width,this.rh=t.height}get center(){return new P(this.rx+this.rw/2,this.ry+this.rh/2)}set center(t){this.rx=t.x-this.rw/2,this.ry=t.y-this.rh/2}get centerX(){return this.rx+this.rw/2}set centerX(t){this.rx=t-this.rw/2}get centerY(){return this.ry+this.rh/2}set centerY(t){this.ry=t-this.rh/2}isReal(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)}isEmpty(){return this.width===0&&this.height===0}static Fg=new z(0,0,0,0).$();static $D=new z(NaN,NaN,NaN,NaN).$();static Vk=[];static l(){let t=z.Vk.pop();return t===void 0?new z:t}static V(t,e,i,s){let n=z.Vk.pop();return n===void 0?new z(t,e,i,s):n.i(t,e,i,s)}static e(t){z.Vk.push(t)}}class Lt{mt;mr;mb;ml;h;constructor(t,e,i,s){t===void 0?(this.mt=0,this.mr=0,this.mb=0,this.ml=0):e===void 0?(e=t,i=t,s=t,this.mt=t,this.mr=e,this.mb=i,this.ml=s):i===void 0?(i=t,s=e,this.mt=t,this.mr=e,this.mb=i,this.ml=s):s!==void 0?(this.mt=t,this.mr=e,this.mb=i,this.ml=s):f.o("Invalid arguments to Margin constructor: "+t+", "+e+", "+i+", "+s),this.h=!1}a(t){return this.mt=t.mt,this.mr=t.mr,this.mb=t.mb,this.ml=t.ml,this}setTo(t,e,i,s){return this.mt=t,this.mr=e,this.mb=i,this.ml=s,this}set(t){return this.mt=t.mt,this.mr=t.mr,this.mb=t.mb,this.ml=t.ml,this}copy(){let t=new Lt;return t.mt=this.mt,t.mr=this.mr,t.mb=this.mb,t.ml=this.ml,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(t){}static parse(t){if(typeof t=="string"){let e=t.split(" "),i=0,s=NaN;for(;e[i]==="";)i++;let n=e[i++];if(n&&(s=parseFloat(n)),isNaN(s))return new Lt;let o=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(o=parseFloat(n)),isNaN(o))return new Lt(s);let r=NaN;for(;e[i]==="";)i++;if(n=e[i++],n&&(r=parseFloat(n)),isNaN(r))return new Lt(s,o);let a=NaN;for(;e[i]==="";)i++;return n=e[i++],n&&(a=parseFloat(n)),isNaN(a)?new Lt(s,o):new Lt(s,o,r,a)}else return new Lt}static stringify(t){return t.top.toString()+" "+t.right.toString()+" "+t.bottom.toString()+" "+t.left.toString()}static stringifyFixed(t){return f.s(t,"number",Lt,"stringifyFixed:digits"),e=>e.top.toFixed(t)+" "+e.right.toFixed(t)+" "+e.bottom.toFixed(t)+" "+e.left.toFixed(t)}toString(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"}equals(t){return t instanceof Lt?this.mt===t.top&&this.mr===t.right&&this.mb===t.bottom&&this.ml===t.left:!1}equalTo(t,e,i,s){return this.mt===t&&this.mr===e&&this.mb===i&&this.ml===s}equalsApprox(t){return L.f(this.mt,t.top)&&L.f(this.mr,t.right)&&L.f(this.mb,t.bottom)&&L.f(this.ml,t.left)}get top(){return this.mt}set top(t){this.mt=t}get right(){return this.mr}set right(t){this.mr=t}get bottom(){return this.mb}set bottom(t){this.mb=t}get left(){return this.ml}set left(t){this.ml=t}isReal(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)}static Rg=new Lt(0,0,0,0).$();static PC=new Lt(2,2,2,2).$();static SC=[];static l(){let t=Lt.SC.pop();return t===void 0?new Lt:t}static e(t){Lt.SC.push(t)}}class D{sx;sy;ox;oy;h;constructor(t,e,i,s){t===void 0?(this.sx=0,this.sy=0,this.ox=0,this.oy=0):(e===void 0&&(e=0),i===void 0&&(i=0),s===void 0&&(s=0),this.sx=t,this.sy=e,this.ox=i,this.oy=s),this.h=!1}a(t){return this.sx=t.sx,this.sy=t.sy,this.ox=t.ox,this.oy=t.oy,this}setTo(t,e,i,s){return this.sx=t,this.sy=e,this.ox=i,this.oy=s,this}set(t){return this.sx=t.sx,this.sy=t.sy,this.ox=t.ox,this.oy=t.oy,this}copy(){let t=new D;return t.sx=this.sx,t.sy=this.sy,t.ox=this.ox,t.oy=this.oy,t}$(){return this.h=!0,Object.freeze(this),this}P(){return this.h||Object.isFrozen(this)?this:this.copy().u()}u(){return this.h||(this.h=!0),this}Pt(){return this.h&&(Object.isFrozen(this)&&f.o("cannot thaw constant: "+this),this.h=!1),this}yw(t){}Ie(t){return this.sx=NaN,this.sy=NaN,this.ox=t,this}wE(t,e){(isNaN(t)||t>1||t<0)&&f.W(t,"0 <= "+e+" <= 1",D,e)}xE(t,e){(isNaN(t)||t===1/0||t===-1/0)&&f.W(t,"real number, not NaN or Infinity",D,e)}static parse(t){if(typeof t=="string"){if(t=t.trim(),t==="None")return D.None;if(t==="TopLeft")return D.TopLeft;if(t==="Top"||t==="TopCenter"||t==="MiddleTop")return D.TopCenter;if(t==="TopRight")return D.TopRight;if(t==="Left"||t==="LeftCenter"||t==="MiddleLeft")return D.LeftCenter;if(t==="Center")return D.Center;if(t==="Right"||t==="RightCenter"||t==="MiddleRight")return D.RightCenter;if(t==="BottomLeft")return D.BottomLeft;if(t==="Bottom"||t==="BottomCenter"||t==="MiddleBottom")return D.BottomCenter;if(t==="BottomRight")return D.BottomRight;if(t==="TopSide")return D.TopSide;if(t==="LeftSide")return D.LeftSide;if(t==="RightSide")return D.RightSide;if(t==="BottomSide")return D.BottomSide;if(t==="TopBottomSides")return D.TopBottomSides;if(t==="LeftRightSides")return D.LeftRightSides;if(t==="TopLeftSides")return D.TopLeftSides;if(t==="TopRightSides")return D.TopRightSides;if(t==="BottomLeftSides")return D.BottomLeftSides;if(t==="BottomRightSides")return D.BottomRightSides;if(t==="NotTopSide")return D.NotTopSide;if(t==="NotLeftSide")return D.NotLeftSide;if(t==="NotRightSide")return D.NotRightSide;if(t==="NotBottomSide")return D.NotBottomSide;if(t==="AllSides")return D.AllSides;if(t==="Default")return D.Default;let e=t.split(" "),i=0,s=0;for(;e[i]==="";)i++;let n=e[i++];n!==void 0&&n.length>0&&(s=parseFloat(n));let o=0;for(;e[i]==="";)i++;n=e[i++],n!==void 0&&n.length>0&&(o=parseFloat(n));let r=0;for(;e[i]==="";)i++;n=e[i++],n!==void 0&&n.length>0&&(r=parseFloat(n));let a=0;for(;e[i]==="";)i++;return n=e[i++],n!==void 0&&n.length>0&&(a=parseFloat(n)),new D(s,o,r,a)}else return new D}static stringify(t){return t.isSpot()?t.x.toString()+" "+t.y.toString()+" "+t.offsetX.toString()+" "+t.offsetY.toString():t.toString()}static stringifyFixed(t){return f.s(t,"number",D,"stringifyFixed:digits"),e=>e.x.toFixed(t)+" "+e.y.toFixed(t)+" "+e.offsetX.toFixed(t)+" "+e.offsetY.toFixed(t)}toString(){return this.isSpot()?this.ox===0&&this.oy===0?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.equals(D.None)?"None":this.equals(D.TopLeft)?"TopLeft":this.equals(D.TopCenter)?"Top":this.equals(D.TopRight)?"TopRight":this.equals(D.LeftCenter)?"Left":this.equals(D.Center)?"Center":this.equals(D.RightCenter)?"Right":this.equals(D.BottomLeft)?"BottomLeft":this.equals(D.BottomCenter)?"Bottom":this.equals(D.BottomRight)?"BottomRight":this.equals(D.TopSide)?"TopSide":this.equals(D.LeftSide)?"LeftSide":this.equals(D.RightSide)?"RightSide":this.equals(D.BottomSide)?"BottomSide":this.equals(D.TopBottomSides)?"TopBottomSides":this.equals(D.LeftRightSides)?"LeftRightSides":this.equals(D.TopLeftSides)?"TopLeftSides":this.equals(D.TopRightSides)?"TopRightSides":this.equals(D.BottomLeftSides)?"BottomLeftSides":this.equals(D.BottomRightSides)?"BottomRightSides":this.equals(D.NotTopSide)?"NotTopSide":this.equals(D.NotLeftSide)?"NotLeftSide":this.equals(D.NotRightSide)?"NotRightSide":this.equals(D.NotBottomSide)?"NotBottomSide":this.equals(D.AllSides)?"AllSides":this.equals(D.Default)?"Default":"None"}equals(t){return t instanceof D?(this.sx===t.x||isNaN(this.sx)&&isNaN(t.x))&&(this.sy===t.y||isNaN(this.sy)&&isNaN(t.y))&&this.ox===t.offsetX&&this.oy===t.offsetY:!1}opposite(){return new D(.5-(this.sx-.5),.5-(this.sy-.5),-this.ox,-this.oy)}includesSide(t){if(!this.isSide())return!1;if(!t.isSide())if(t.equals(D.Left))t=D.LeftSide;else if(t.equals(D.Right))t=D.RightSide;else if(t.equals(D.Top))t=D.TopSide;else if(t.equals(D.Bottom))t=D.BottomSide;else return!1;let e=this.oy,i=t.offsetY;return(e&i)===i}get x(){return this.sx}set x(t){this.sx=t}get y(){return this.sy}set y(t){this.sy=t}get offsetX(){return this.ox}set offsetX(t){this.ox=t}get offsetY(){return this.oy}set offsetY(t){this.oy=t}isSpot(){return!isNaN(this.x)&&!isNaN(this.y)}isNoSpot(){return isNaN(this.x)||isNaN(this.y)}isSide(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===1&&this.offsetY!==0}isNone(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===0&&this.offsetY===0}isDefault(){return isNaN(this.x)&&isNaN(this.y)&&this.offsetX===-1&&this.offsetY===0}static None=new D(0,0,0,0).Ie(0).$();static Default=new D(0,0,-1,0).Ie(-1).$();static TopLeft=new D(0,0,0,0).$();static TopCenter=new D(.5,0,0,0).$();static TopRight=new D(1,0,0,0).$();static LeftCenter=new D(0,.5,0,0).$();static Center=new D(.5,.5,0,0).$();static RightCenter=new D(1,.5,0,0).$();static BottomLeft=new D(0,1,0,0).$();static BottomCenter=new D(.5,1,0,0).$();static BottomRight=new D(1,1,0,0).$();static MiddleTop=D.TopCenter;static MiddleLeft=D.LeftCenter;static MiddleRight=D.RightCenter;static MiddleBottom=D.BottomCenter;static Top=D.TopCenter;static Left=D.LeftCenter;static Right=D.RightCenter;static Bottom=D.BottomCenter;static TopSide=new D(0,0,1,1).Ie(1).$();static LeftSide=new D(0,0,1,2).Ie(1).$();static RightSide=new D(0,0,1,4).Ie(1).$();static BottomSide=new D(0,0,1,8).Ie(1).$();static TopBottomSides=new D(0,0,1,9).Ie(1).$();static LeftRightSides=new D(0,0,1,6).Ie(1).$();static TopLeftSides=new D(0,0,1,3).Ie(1).$();static TopRightSides=new D(0,0,1,5).Ie(1).$();static BottomLeftSides=new D(0,0,1,10).Ie(1).$();static BottomRightSides=new D(0,0,1,12).Ie(1).$();static NotTopSide=new D(0,0,1,14).Ie(1).$();static NotLeftSide=new D(0,0,1,13).Ie(1).$();static NotRightSide=new D(0,0,1,11).Ie(1).$();static NotBottomSide=new D(0,0,1,7).Ie(1).$();static AllSides=new D(0,0,1,15).Ie(1).$();static zk=new D(.156,.156).$();static Xk=new D(.844,.844).$();static MC=[];static l(){let t=D.MC.pop();return t===void 0?new D:t}static e(t){D.MC.push(t)}}class Pt{m11;m12;m21;m22;dx;dy;constructor(){this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0}set(t){return this.m11=t.m11,this.m12=t.m12,this.m21=t.m21,this.m22=t.m22,this.dx=t.dx,this.dy=t.dy,this}setTo(t,e,i,s,n,o){return this.m11=t,this.m12=e,this.m21=i,this.m22=s,this.dx=n,this.dy=o,this}copy(){let t=new Pt;return t.m11=this.m11,t.m12=this.m12,t.m21=this.m21,t.m22=this.m22,t.dx=this.dx,t.dy=this.dy,t}toString(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"}equals(t){return this.m11===t.m11&&this.m12===t.m12&&this.m21===t.m21&&this.m22===t.m22&&this.dx===t.dx&&this.dy===t.dy}Yk(){return this.dx===0&&this.dy===0&&this.m11===1&&this.m12===0&&this.m21===0&&this.m22===1}Ri(){return this.m11=1,this.m12=0,this.m21=0,this.m22=1,this.dx=0,this.dy=0,this}nc(t){let e=this.m11*t.m11+this.m21*t.m12,i=this.m12*t.m11+this.m22*t.m12,s=this.m11*t.m21+this.m21*t.m22,n=this.m12*t.m21+this.m22*t.m22;return this.dx=this.m11*t.dx+this.m21*t.dy+this.dx,this.dy=this.m12*t.dx+this.m22*t.dy+this.dy,this.m11=e,this.m12=i,this.m21=s,this.m22=n,this}NC(t){let e=1/(t.m11*t.m22-t.m12*t.m21),i=t.m22*e,s=-t.m12*e,n=-t.m21*e,o=t.m11*e,r=e*(t.m21*t.dy-t.m22*t.dx),a=e*(t.m12*t.dx-t.m11*t.dy),h=this.m11*i+this.m21*s,l=this.m12*i+this.m22*s,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}bw(){let t=1/(this.m11*this.m22-this.m12*this.m21),e=this.m22*t,i=-this.m12*t,s=-this.m21*t,n=this.m11*t,o=t*(this.m21*this.dy-this.m22*this.dx),r=t*(this.m12*this.dx-this.m11*this.dy);return this.m11=e,this.m12=i,this.m21=s,this.m22=n,this.dx=o,this.dy=r,this}cs(t,e,i){if(t>=360?t-=360:t<0&&(t+=360),t===0)return this;this.Fs(e,i);let s=0,n=0;if(t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let l=t*Math.PI/180;s=Math.cos(l),n=Math.sin(l)}let o=this.m11*s+this.m21*n,r=this.m12*s+this.m22*n,a=this.m11*-n+this.m21*s,h=this.m12*-n+this.m22*s;return this.m11=o,this.m12=r,this.m21=a,this.m22=h,this.Fs(-e,-i),this}Fs(t,e){return this.dx+=this.m11*t+this.m21*e,this.dy+=this.m12*t+this.m22*e,this}tt(t,e){return e===void 0&&(e=t),this.m11*=t,this.m12*=t,this.m21*=e,this.m22*=e,this}ZD(){if(this.m11===1&&this.m12===0)return 0;let t=Math.atan2(this.m12,this.m11)*180/Math.PI;return t<0&&(t+=360),t}gt(t){let e=t.x,i=t.y;return t.i(e*this.m11+i*this.m21+this.dx,e*this.m12+i*this.m22+this.dy)}$e(t){let e=1/(this.m11*this.m22-this.m12*this.m21),i=this.m22*e,s=-this.m12*e,n=-this.m21*e,o=this.m11*e,r=t.x-this.dx,a=t.y-this.dy;return t.i(r*i+a*n,r*s+a*o)}kw(t){let e=1/(this.m11*this.m22-this.m12*this.m21),i=this.m22*e,s=-this.m12*e,n=-this.m21*e,o=this.m11*e,r=e*(this.m21*this.dy-this.m22*this.dx),a=e*(this.m12*this.dx-this.m11*this.dy),h=t.x*1.25,l=t.y*1.2;return t.i(h*i+l*n+r,h*s+l*o+a)}vg(t){let e=t.x,i=t.y,s=e+t.width,n=i+t.height,o=this.m11,r=this.m12,a=this.m21,h=this.m22,l=this.dx,u=this.dy,c=e*o+i*a+l,d=e*r+i*h+u,g=s*o+i*a+l,p=s*r+i*h+u,m=e*o+n*a+l,y=e*r+n*h+u,w=s*o+n*a+l,b=s*r+n*h+u,v=c,k=c,S=d,M=d;return v=Math.min(v,g),k=Math.max(k,g),S=Math.min(S,p),M=Math.max(M,p),v=Math.min(v,m),k=Math.max(k,m),S=Math.min(S,y),M=Math.max(M,y),v=Math.min(v,w),k=Math.max(k,w),S=Math.min(S,b),M=Math.max(M,b),t.i(v,S,k-v,M-S),t}static CC=[];static l(){let t=Pt.CC.pop();return t===void 0?new Pt:t}static e(t){Pt.CC.push(t)}static Gk="54a702f3e53909c447824c6706603faf4c"}let L={QD:"7da71ca0ad381e90",Rn:4*((Math.sqrt(2)-1)/3),LC:null,Pw:x=>{if(x<=0)return 0;let t=L.LC;if(t===null){t=[];for(let e=0;e<=2e3;e++)t[e]=Math.sqrt(e);L.LC=t}if(x<1){let e=1/x;return e<=2e3?1/t[e|0]:Math.sqrt(x)}else return x<=2e3?t[x|0]:Math.sqrt(x)},f:(x,t)=>{let e=x-t;return e<.5&&e>-.5},z:(x,t)=>{let e=x-t;return e<5e-8&&e>-5e-8},vi:(x,t,e,i,s,n,o)=>{s<=0&&(s=1e-6);let r=0,a=0,h=0,l=0;if(x<e?(a=x,r=e):(a=e,r=x),t<i?(l=t,h=i):(l=i,h=t),x===e)return l<=o&&o<=h&&x-s<=n&&n<=x+s;if(t===i)return a<=n&&n<=r&&t-s<=o&&o<=t+s;let u=r+s,c=a-s;if(c<=n&&n<=u){let d=h+s,g=l-s;if(g<=o&&o<=d)if(u-c>d-g)if(x-e>s||e-x>s){let p=(i-t)/(e-x)*(n-x)+t;if(p-s<=o&&o<=p+s)return!0}else return!0;else if(t-i>s||i-t>s){let p=(e-x)/(i-t)*(o-t)+x;if(p-s<=n&&n<=p+s)return!0}else return!0}return!1},Sw:(x,t,e,i,s,n,o,r,a,h,l,u)=>{if(!L.vi(x,t,o,r,u,e,i)||!L.vi(x,t,o,r,u,s,n)){let c=(x+e)/2,d=(t+i)/2,g=(e+s)/2,p=(i+n)/2,m=(s+o)/2,y=(n+r)/2,w=(c+g)/2,b=(d+p)/2,v=(g+m)/2,k=(p+y)/2,S=(w+v)/2,M=(b+k)/2;return L.Sw(x,t,c,d,w,b,S,M,a,h,l,u)||L.Sw(S,M,v,k,m,y,o,r,a,h,l,u)}else return L.vi(x,t,o,r,u,h,l)},AC:(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,g=(n+r)/2,p=(h+u)/2,m=(l+c)/2,y=(u+d)/2,w=(c+g)/2;return a.i((p+y)/2,(m+w)/2),a},_D:(x,t,e,i,s,n,o,r)=>{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,u=(i+n)/2,c=(s+o)/2,d=(n+r)/2,g=(a+l)/2,p=(h+u)/2,m=(l+c)/2,y=(u+d)/2;return P.direction(g,p,m,y)},ou:(x,t,e,i,s,n,o,r,a,h)=>{if(!L.vi(x,t,o,r,a,e,i)||!L.vi(x,t,o,r,a,s,n)){let l=(x+e)/2,u=(t+i)/2,c=(e+s)/2,d=(i+n)/2,g=(s+o)/2,p=(n+r)/2,m=(l+c)/2,y=(u+d)/2,w=(c+g)/2,b=(d+p)/2,v=(m+w)/2,k=(y+b)/2;L.ou(x,t,l,u,m,y,v,k,a,h),L.ou(v,k,w,b,g,p,o,r,a,h)}else h.unionNoCheck(x,t,0,0),h.unionNoCheck(o,r,0,0);return h},vn:(x,t,e,i,s,n,o,r,a,h)=>{if(!L.vi(x,t,o,r,a,e,i)||!L.vi(x,t,o,r,a,s,n)){let l=(x+e)/2,u=(t+i)/2,c=(e+s)/2,d=(i+n)/2,g=(s+o)/2,p=(n+r)/2,m=(l+c)/2,y=(u+d)/2,w=(c+g)/2,b=(d+p)/2,v=(m+w)/2,k=(y+b)/2;L.vn(x,t,l,u,m,y,v,k,a,h),L.vn(v,k,w,b,g,p,o,r,a,h)}else h.length===0&&(h.push(x),h.push(t)),h.push(o),h.push(r);return h},Kk:(x,t,e,i,s,n,o,r,a,h)=>{if(L.vi(x,t,s,n,h,e,i))return L.vi(x,t,s,n,h,r,a);{let l=(x+e)/2,u=(t+i)/2,c=(e+s)/2,d=(i+n)/2,g=(l+c)/2,p=(u+d)/2;return L.Kk(x,t,l,u,g,p,o,r,a,h)||L.Kk(g,p,c,d,s,n,o,r,a,h)}},bE:(x,t,e,i,s,n,o)=>{let r=(x+e)/2,a=(t+i)/2,h=(e+s)/2,l=(i+n)/2;return o.i((r+h)/2,(a+l)/2),o},jk:(x,t,e,i,s,n,o,r)=>{if(L.vi(x,t,s,n,o,e,i))r.unionNoCheck(x,t,0,0),r.unionNoCheck(s,n,0,0);else{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,u=(i+n)/2,c=(a+l)/2,d=(h+u)/2;L.jk(x,t,a,h,c,d,o,r),L.jk(c,d,l,u,s,n,o,r)}return r},Og:(x,t,e,i,s,n,o,r)=>{if(L.vi(x,t,s,n,o,e,i))r.length===0&&(r.push(x),r.push(t)),r.push(s),r.push(n);else{let a=(x+e)/2,h=(t+i)/2,l=(e+s)/2,u=(i+n)/2,c=(a+l)/2,d=(h+u)/2;L.Og(x,t,a,h,c,d,o,r),L.Og(c,d,l,u,s,n,o,r)}return r},Ig:(x,t,e,i,s,n,o,r,a,h,l,u,c,d)=>{if(!L.vi(x,t,o,r,c,e,i)||!L.vi(x,t,o,r,c,s,n)){let g=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,w=(s+o)/2,b=(n+r)/2,v=(g+m)/2,k=(p+y)/2,S=(m+w)/2,M=(y+b)/2,F=(v+S)/2,T=(k+M)/2,N=1/0,C=!1,R=0,O=0;if(L.Ig(x,t,g,p,v,k,F,T,a,h,l,u,c,d)){let B=(d.x-a)**2+(d.y-h)**2;B<N&&(N=B,C=!0,R=d.x,O=d.y)}if(L.Ig(F,T,S,M,w,b,o,r,a,h,l,u,c,d)){let B=(d.x-a)**2+(d.y-h)**2;B<N&&(N=B,C=!0,R=d.x,O=d.y)}return C&&(d.x=R,d.y=O),C}else{if(!L.su(x,t,o,r,a,h,l,u))return!1;let g=(x-o)*(h-u)-(t-r)*(a-l);if(g===0)return!1;let p=((x*r-t*o)*(a-l)-(x-o)*(a*u-h*l))/g,m=((x*r-t*o)*(h-u)-(t-r)*(a*u-h*l))/g;return d.i(p,m),!0}},Eg:(x,t,e,i,s,n,o,r,a,h,l,u,c)=>{let d=0;if(!L.vi(x,t,o,r,c,e,i)||!L.vi(x,t,o,r,c,s,n)){let g=(x+e)/2,p=(t+i)/2,m=(e+s)/2,y=(i+n)/2,w=(s+o)/2,b=(n+r)/2,v=(g+m)/2,k=(p+y)/2,S=(m+w)/2,M=(y+b)/2,F=(v+S)/2,T=(k+M)/2;d+=L.Eg(x,t,g,p,v,k,F,T,a,h,l,u,c),d+=L.Eg(F,T,S,M,w,b,o,r,a,h,l,u,c)}else{let g=(x-o)*(h-u)-(t-r)*(a-l);if(g===0)return d;let p=((x*r-t*o)*(a-l)-(x-o)*(a*u-h*l))/g,m=((x*r-t*o)*(h-u)-(t-r)*(a*u-h*l))/g;if(p>=l)return d;let y=0,w=0;if((a>l?a-l:l-a)<(h>u?h-u:u-h)){if(t<r?(y=t,w=r):(y=r,w=t),m<y||m>w)return d}else if(x<o?(y=x,w=o):(y=o,w=x),p<y||p>w)return d;g>0?d++:g<0&&d--}return d},dl:(x,t,e,i,s,n,o)=>{if(L.z(x,e)){let r=0,a=0;t<i?(r=t,a=i):(r=i,a=t);let h=n;return h<r?(o.i(x,r),!1):h>a?(o.i(x,a),!1):(o.i(x,h),!0)}else if(L.z(t,i)){let r=0,a=0;x<e?(r=x,a=e):(r=e,a=x);let h=s;return h<r?(o.i(r,t),!1):h>a?(o.i(a,t),!1):(o.i(h,t),!0)}else{let r=(e-x)**2+(i-t)**2,a=((x-s)*(x-e)+(t-n)*(t-i))/r;if(a<-5e-6)return o.i(x,t),!1;if(a>1.000005)return o.i(e,i),!1;{let h=x+a*(e-x),l=t+a*(i-t);return o.i(h,l),!0}}},On:(x,t,e,i,s,n,o,r,a)=>{if(L.f(x,e)&&L.f(t,i))return a.i(x,t),!1;if(L.z(s,o)){if(L.z(x,e))return L.dl(x,t,e,i,s,n,a),!1;{let h=(i-t)/(e-x)*(s-x)+t;return L.dl(x,t,e,i,s,h,a)}}else{let h=(r-n)/(o-s);if(L.z(x,e)){let l=h*(x-s)+n,u=0,c=0;return t<i?(u=t,c=i):(u=i,c=t),l<u?(a.i(x,u),!1):l>c?(a.i(x,c),!1):(a.i(x,l),!0)}else{let l=(i-t)/(e-x);if(L.z(h,l))return L.dl(x,t,e,i,s,n,a),!1;{let u=(l*x-h*s+n-t)/(l-h);if(L.z(l,0)){let c=0,d=0;return x<e?(c=x,d=e):(c=e,d=x),u<c?(a.i(c,t),!1):u>d?(a.i(d,t),!1):(a.i(u,t),!0)}else{let c=l*(u-x)+t;return L.dl(x,t,e,i,u,c,a)}}}}},kE:(x,t,e,i,s)=>L.On(e.x,e.y,i.x,i.y,x.x,x.y,t.x,t.y,s),PE:(x,t,e,i,s,n,o,r,a,h)=>{let l=1/0;function u(S,M){let F=(S-x)**2+(M-t)**2;F<l&&(l=F,a.i(S,M))}u(a.x,a.y);let c=0,d=0,g=0,p=0;s<o?(c=s,d=o):(c=o,d=s),n<r?(g=s,p=o):(g=o,p=s);let m=d-c,y=p-g,w=m/2+h,b=y/2+h,v=(s+o)/2,k=(n+r)/2;if(w===0||b===0)return a;if(L.f(x,e)){let S=1-(e-v)**2/(w*w);if(S<0)return a;let M=Math.sqrt(S),F=b*M+k,T=-b*M+k;u(e,F),u(e,T)}else{let S=(i-t)/(e-x),M=1/(w*w)+S*S/(b*b),F=2*S*(t-S*x)/(b*b)-2*S*k/(b*b)-2*v/(w*w),T=2*S*x*k/(b*b)-2*t*k/(b*b)+k*k/(b*b)+v*v/(w*w)-1+(t-S*x)*(t-S*x)/(b*b),N=F*F-4*M*T;if(N<0)return a;let C=Math.sqrt(N),R=(-F+C)/(2*M);u(R,S*R-S*x+t);let O=(-F-C)/(2*M);u(O,S*O-S*x+t)}return a},gl:(x,t,e,i,s,n,o,r,a)=>{let h=1e21,l=x,u=t;if(L.On(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(L.On(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(L.On(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(L.On(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.i(l,u),h<1e21},Mw:(x,t,e)=>L.kC(x.x,x.y,x.width,x.height,t.x,t.y,e.x,e.y),kC:(x,t,e,i,s,n,o,r)=>{let a=x,h=x+e,l=t,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!!(z.contains(x,t,e,i,s,n)||z.contains(x,t,e,i,o,r)||L.su(a,l,h,l,s,n,o,r)||L.su(h,l,h,u,s,n,o,r)||L.su(h,u,a,u,s,n,o,r)||L.su(a,u,a,l,s,n,o,r))},su:(x,t,e,i,s,n,o,r)=>x===e&&t===i&&s===o&&n===r?x===s&&t===n:L.eu(x,t,e,i,s,n)*L.eu(x,t,e,i,o,r)<=0&&L.eu(s,n,o,r,x,t)*L.eu(s,n,o,r,e,i)<=0,eu:(x,t,e,i,s,n)=>{let o=e-x,r=i-t,a=s-x,h=n-t,l=a*r-h*o;return l===0&&(l=a*o+h*r,l>0&&(a-=o,h-=r,l=a*o+h*r,l<0&&(l=0))),l},Ug:x=>(x<0&&(x+=360),x>=360&&(x-=360),x),TC:(x,t,e,i,s,n)=>{let o=Math.PI;n||(i=i*(o/180),s=s*(o/180));let r=i>s?-1:1,a=1e-5,h=o*2,l=[],u=o/2,c=i,d=Math.min(h,Math.abs(s-i));if(d<a){let g=c+r*Math.min(d,u),p=x+e*Math.cos(c),m=t+e*Math.sin(c),y=x+e*Math.cos(g),w=t+e*Math.sin(g),b=(p+y)/2,v=(m+w)/2;return l.push([p,m,b,v,b,v,y,w]),l}for(;d>a;){let g=c+r*Math.min(d,u);l.push(L.tF(e,c,g,x,t)),d-=Math.abs(g-c),c=g}return l},tF:(x,t,e,i,s)=>{let n=(e-t)/2,o=x*Math.cos(n),r=x*Math.sin(n),a=o,h=-r,l=a*a+h*h,u=l+a*o+h*r,c=4/3*(Math.sqrt(2*l*u)-u)/(a*r-h*o),d=a-c*h,g=h+c*a,p=d,m=-g,y=n+t,w=Math.cos(y),b=Math.sin(y);return[i+x*Math.cos(t),s+x*Math.sin(t),i+d*w-g*b,s+d*b+g*w,i+p*w-m*b,s+p*b+m*w,i+x*Math.cos(e),s+x*Math.sin(e)]},Dg:(x,t,e,i,s,n,o)=>{let r=s,a=n,h=Math.floor((x-e)/r)*r+e,l=Math.floor((t-i)/a)*a+i,u=h;h+r-x<r/2&&(u=h+r);let c=l;return l+a-t<a/2&&(c=l+a),o.i(u,c),o},DC:(x,t)=>{let e=Math.max(x,t),i=Math.min(x,t),s=1,n=1;do s=e%i,n=i,e=i,i=s;while(s>0);return n},iF:(x,t,e,i)=>{let s=e<0,n=i<0,o=0,r=0,a=0;x<t?(r=1,a=0):(r=0,a=1);let h=0,l=0,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),L.eF(h,l,u,c,0,0)},eF:(x,t,e,i,s,n)=>{let o=0;if(i>0)if(e>0){let r=x*x,a=t*t,h=x*e,l=t*i,u=-a+l,c=-a+Math.sqrt(h*h+l*l),d=u,g=9999999999;for(let y=0;y<g&&(d=.5*(u+c),!(d===u||d===c));++y){let w=h/(d+r),b=l/(d+a),v=w*w+b*b-1;if(v>0)u=d;else if(v<0)c=d;else break}s=r*e/(d+r),n=a*i/(d+a);let p=s-e,m=n-i;o=Math.sqrt(p*p+m*m)}else s=0,n=t,o=Math.abs(i-t);else{let r=x*x-t*t,a=x*e;if(a<r){let h=a/r,l=h*h;s=x*h,n=t*Math.sqrt(Math.abs(1-l));let u=s-e;o=Math.sqrt(u*u+n*n)}else s=x,n=0,o=Math.abs(e-x)}return o},In:new q,Bg:new q,or:new q,rr:0,Vg:100};L.za=L.QD;var ei=(x=>(x[x.Line=1]="Line",x[x.Rectangle=2]="Rectangle",x[x.Ellipse=3]="Ellipse",x[x.Path=4]="Path",x))(ei||{}),ms=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Fill=2]="Fill",x[x.Uniform=6]="Uniform",x))(ms||{});class kt{n;zg;Xg;oc;ru;lu;En;Un;Bn;H;we;xe;Qi;_i;Rs;rc;lc;constructor(t){I.Ki(this),this.n=2,t===void 0&&(t=4),this.H=t,this.we=0,this.xe=0,this.Qi=0,this._i=0,t===4?this.Rs=new j:this.Rs=kt.Nw,this.zg=this.Rs.nt,this.Xg=new z().u(),this.oc=null,this.ru=null,this.lu=NaN,this.En=D.TopLeft,this.Un=D.BottomRight,this.rc=NaN,this.lc=NaN,this.Bn=2}copy(){let t=new kt;if(t.n=this.n&-2,t.H=this.H,t.we=this.we,t.xe=this.xe,t.Qi=this.Qi,t._i=this._i,this.H===4){let e=this.Rs.r,i=t.Rs;for(let s=0;s<e.length;s++){let n=e[s];i.add(n.copy())}t.Rs=i}else t.Rs=this.Rs;return t.zg=this.zg,t.Xg.a(this.Xg),t.oc=this.oc,t.ru=this.ru,t.lu=this.lu,t.En=this.En.P(),t.Un=this.Un.P(),t.rc=this.rc,t.lc=this.lc,t.Bn=this.Bn,t}static Line=1;static Rectangle=2;static Ellipse=3;static Path=4;static Nw=new j().u();get h(){return(this.n&1)!==0}set h(t){t?this.n|=1:this.n&=-2}get wt(){return(this.n&2)!==0}set wt(t){t?this.n|=2:this.n&=-3}u(){if(this.h=!0,this.type!==4)return this;let t=this.figures;t.u();for(let e of t)e.u();return this}equalsApprox(t){if(!(t instanceof kt))return!1;if(this.type!==t.type)return this.type===1&&t.type===4?this.FC(t):t.type===1&&this.type===4?t.FC(this):!1;if(this.type===4){let e=this.figures.r,i=t.figures.r,s=e.length;if(s!==i.length)return!1;for(let n=0;n<s;n++){let o=e[n],r=i[n];if(!o.equalsApprox(r))return!1}return!0}else return L.f(this.startX,t.startX)&&L.f(this.startY,t.startY)&&L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)}FC(t){if(this.type!==1||t.type!==4)return!1;if(t.figures.count===1){let e=t.figures.elt(0);if(e.segments.count===1&&L.f(this.startX,e.startX)&&L.f(this.startY,e.startY)){let i=e.segments.elt(0);if(i.type===2&&L.f(this.endX,i.endX)&&L.f(this.endY,i.endY))return!0}}return!1}static stringify(t){return t.toString()}static stringifyFixed(t){return f.s(t,"number",kt,"stringifyFixed:digits"),e=>e.toString(t)}oi(t){t in ei?this.type=t:f.er(this,t)}toString(t){t===void 0&&(t=-1);let e=s=>s===0?"0":s.toFixed(t),i;switch(this.type){case 1:return t<0?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+e(this.startX)+" "+e(this.startY)+"L"+e(this.endX)+" "+e(this.endY);case 2:return i=new z(this.startX,this.startY,0,0),i.union(this.endX,this.endY,0,0),t<0?"M"+i.x.toString()+" "+i.y.toString()+"H"+i.right.toString()+"V"+i.bottom.toString()+"H"+i.left.toString()+"z":"M"+e(i.x)+" "+e(i.y)+"H"+e(i.right)+"V"+e(i.bottom)+"H"+e(i.left)+"z";case 3:if(i=new z(this.startX,this.startY,0,0),i.union(this.endX,this.endY,0,0),t<0){let r=i.left.toString()+" "+(i.y+i.height/2).toString(),a=i.right.toString()+" "+(i.y+i.height/2).toString();return"M"+r+"A"+(i.width/2).toString()+" "+(i.height/2).toString()+" 0 0 1 "+a+"A"+(i.width/2).toString()+" "+(i.height/2).toString()+" 0 0 1 "+r}else{let r=e(i.left)+" "+e(i.y+i.height/2),a=e(i.right)+" "+e(i.y+i.height/2);return"M"+r+"A"+e(i.width/2)+" "+e(i.height/2)+" 0 0 1 "+a+"A"+e(i.width/2)+" "+e(i.height/2)+" 0 0 1 "+r}case 4:let s="",n=this.figures.r,o=n.length;for(let r=0;r<o;r++){let a=n[r];r>0&&(s+=" x "),a.isFilled&&(s+="F "),s+=a.toString(t)}return s;default:return ei[this.type]}}static fillPath(t){typeof t!="string"&&f.Zi(t,"string",kt,"fillPath:str");let e=t.split(/[Xx]/),i=e.length,s="";for(let n=0;n<i;n++){let o=e[n];if(o.match(/[Ff]/)!==null){n===0?s+=o:s+="X"+(o[0]===" "?"":" ")+o;continue}s+=(n===0?"":"X ")+"F"+(o[0]===" "?"":" ")+o}return s}static Yg="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";static parse(t,e){e===void 0&&(e=!1),typeof t!="string"&&f.Zi(t,"string",kt,"parse:str");let i=new RegExp("(["+kt.Yg+"])(["+kt.Yg+"])","gm"),s=new RegExp("(["+kt.Yg+"])([^s])","gm"),n=new RegExp("([^s])(["+kt.Yg+"])","gm");t=t.replace(/,/gm," "),t=t.replace(i,"$1 $2"),t=t.replace(i,"$1 $2"),t=t.replace(s,"$1 $2"),t=t.replace(n,"$1 $2"),t=t.replace(/([0-9])([+\-])/gm,"$1 $2"),t=t.replace(/[\s\r\t\n]+/gm," "),t=t.replace(/^\s+|\s+$/g,"");let o=t.split(" ");for(let R=0;R<o.length;R++){let O=o[R];if(O.match(/(\.[0-9]*)(\.)/gm)!==null){let B=f.et(),K="",Y=!1;for(let X=0;X<O.length;X++){let G=O[X];G==="."&&!Y?(Y=!0,K+=G):G==="."?(B.push(K),K="."):K+=G}B.push(K),o.splice(R,1);for(let X=0;X<B.length;X++)o.splice(R+X,0,B[X]);R+=B.length-1,f.J(B)}}let r=-1,a="",h="",l=new P(0,0),u=new P(0,0),c=new P(0,0),d=!0;function g(){return r>=v-1||o[r+1].match(N)!==null?!0:(d=!1,!1)}function p(){return r++,o[r]}function m(R){let O=parseFloat(p()),B=parseFloat(p());a===a.toLowerCase()&&(O=c.x+O,B=c.y+B),R.i(O,B)}function y(){return m(c),c}function w(){return m(u),u}function b(){let R=h.toLowerCase();return R==="c"||R==="s"||R==="q"||R==="t"?new P(2*c.x-u.x,2*c.y-u.y):new P(c.x,c.y)}let v=o.length,k=Ke.RC(null),S=!1,M=!1,F=!1,T=!0,N=new RegExp("["+kt.Yg+"]");for(;!(r>=v-1);){if(h=a,a=p(),a==="")continue;d=!0;let R=!1;switch(a.toUpperCase()){case"X":T=!0,S=!1,M=!1;break;case"M":let O=y();for(k.bi===null||T===!0?(k.hu(O.x,O.y,S,!1,!M,F),T=!1):k.sF(O.x,O.y),l.a(c);!g();){let B=y();k.lr(B.x,B.y)}break;case"L":for(;!g();){let B=y();k.lr(B.x,B.y)}d&&(R=!0);break;case"H":for(;!g();)c.i((a===a.toLowerCase()?c.x:0)+parseFloat(p()),c.y),k.lr(c.x,c.y);break;case"V":for(;!g();)c.i(c.x,(a===a.toLowerCase()?c.y:0)+parseFloat(p())),k.lr(c.x,c.y);d&&(R=!0);break;case"C":for(;!g();){let B=new P;m(B);let K=w(),Y=y();k.hr(B.x,B.y,K.x,K.y,Y.x,Y.y)}d&&(R=!0);break;case"S":for(;!g();){let B=b(),K=w(),Y=y();k.hr(B.x,B.y,K.x,K.y,Y.x,Y.y)}d&&(R=!0);break;case"Q":for(;!g();){let B=w(),K=y();k.Cw(B.x,B.y,K.x,K.y)}d&&(R=!0);break;case"T":for(;!g();){let B=b();u.a(B);let K=y();k.Cw(B.x,B.y,K.x,K.y),u.a(K)}d&&(R=!0);break;case"B":for(;!g();){let B=parseFloat(p()),K=parseFloat(p()),Y=parseFloat(p()),X=parseFloat(p()),G=parseFloat(p()),nt=G,at=!1;g()||(nt=parseFloat(p()),g()||(at=parseFloat(p())!==0)),a===a.toLowerCase()&&(Y+=c.x,X+=c.y),k.nF(B,K,Y,X,G,nt,at)}d&&(R=!0);break;case"A":for(;!g();){let B=Math.abs(parseFloat(p())),K=Math.abs(parseFloat(p())),Y=parseFloat(p()),X=!1,G=!1,nt=0,at=0,tt=p();tt.length===1?(X=!!parseFloat(tt),G=!!parseFloat(p()),nt=parseFloat(p()),at=parseFloat(p())):tt.length===2?(X=!!parseFloat(tt[0]),G=!!parseFloat(tt[1]),nt=parseFloat(p()),at=parseFloat(p())):(X=!!parseFloat(tt[0]),G=!!parseFloat(tt[1]),nt=parseFloat(tt.slice(2)),at=parseFloat(p())),a===a.toLowerCase()&&(nt=c.x+nt,at=c.y+at),c.i(nt,at),k.oF(B,K,Y,X,G,nt,at)}d&&(R=!0);break;case"Z":k.rF(),c.a(l);break;case"F":{let B="",K=1;for(;o[r+K];){if(o[r+K]==="0"){F=!0,K++;continue}if(o[r+K].match(/[Uu]/)!==null){K++;continue}if(o[r+K].match(N)===null){K++;continue}B=o[r+K];break}B.match(/[Mm]/)?S=!0:k.lF();break}case"U":{let B="",K=1;for(;o[r+K];){if(o[r+K].match(/[Ff]/)!==null){K++;continue}if(o[r+K].match(N)===null){K++;continue}B=o[r+K];break}B.match(/[Mm]/)?M=!0:k.hF(!1);break}default:if(a==="0"||a==="1")break;f.ni("Unknown geometry command: "+a);break}if(R){f.ni(`Bad geometry command: ${a}, next token: ${p()},
|
5
5
|
string: ${t}`);break}}let C=k.Gg;if(Ke.vC(k),e){let R=C.figures.iterator;for(;R.next();){let O=R.value;O.isFilled=!0}}return C}static OC(t,e){let i=t.length,s=P.l();for(let n=0;n<i;n++){let o=t[n];s.x=o[0],s.y=o[1],e.gt(s),o[0]=s.x,o[1]=s.y,s.x=o[2],s.y=o[3],e.gt(s),o[2]=s.x,o[3]=s.y,s.x=o[4],s.y=o[5],e.gt(s),o[4]=s.x,o[5]=s.y,s.x=o[6],s.y=o[7],e.gt(s),o[6]=s.x,o[7]=s.y}P.e(s)}Hk(){if(this.wt)return!0;if(this.type===4){let t=this.figures;if(this.zg!==t.nt)return!0;let e=this.figures.r,i=e.length;for(let s=0;s<i;s++)if(e[s].Hk())return!0}return!1}Lw(){if(this.wt=!1,this.oc=null,this.ru=null,this.lu=NaN,this.type===4){let e=this.figures;this.zg=e.nt;let i=this.figures.r,s=i.length;for(let n=0;n<s;n++)i[n].aF()}let t=this.Xg;t.Pt(),isNaN(this.rc)||isNaN(this.lc)?t.i(0,0,0,0):t.i(0,0,this.rc,this.lc),this.IC(t,!1),t.unionNoCheck(0,0,0,0),t.u()}computeBoundsWithoutOrigin(){let t=new z;return this.IC(t,!0),t}IC(t,e){switch(this.type){case 1:case 2:case 3:e?t.i(this.we,this.xe,0,0):t.unionNoCheck(this.we,this.xe,0,0),t.unionNoCheck(this.Qi,this._i,0,0);break;case 4:let i=this.figures,s=i.r,n=i.length;for(let o=0;o<n;o++){let r=s[o];e&&o===0?t.i(r.startX,r.startY,0,0):t.unionNoCheck(r.startX,r.startY,0,0);let a=r.segments.r,h=a.length,l=r.startX,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.unionNoCheck(l,u,0,0);break;case 3:L.ou(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:L.jk(l,u,d.point1X,d.point1Y,d.endX,d.endY,.5,t),l=d.endX,u=d.endY;break;case 5:case 6:let g=d.type===5?d.bo(r):d.Bh(r,l,u),p=g.length;if(p===0){l=d.type===5?d.centerX:d.endX,u=d.type===5?d.centerY:d.endY,t.unionNoCheck(l,u,0,0);break}let m=null;for(let y=0;y<p;y++)m=g[y],L.ou(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],.5,t);m!==null&&(l=m[6],u=m[7]);break;default:f.o("Unknown Segment type: "+d.type)}}}break;default:f.o("Unknown Geometry type: "+this.type)}}cF(t,e){let i=this.bounds,s=t/i.width,n=e/i.height;return isFinite(s)||(s=1),isFinite(n)||(n=1),s===1&&n===1?this:this.copy().scale(s,n)}normalize(){this.h&&f.L(this);let t=this.computeBoundsWithoutOrigin();return this.offset(-t.x,-t.y),new P(-t.x,-t.y)}offset(t,e){return this.h&&f.L(this),this.T(1,0,0,1,t,e),this}scale(t,e){return this.h&&f.L(this),this.T(t,0,0,e,0,0),this}rotate(t,e,i){this.h&&f.L(this),e===void 0&&(e=0),i===void 0&&(i=0);let s=Pt.l();return s.Ri(),s.cs(t,e,i),this.T(s.m11,s.m12,s.m21,s.m22,s.dx,s.dy),Pt.e(s),this}T(t,e,i,s,n,o){let r=0,a=0;switch(this.type){case 1:case 2:case 3:r=this.we,a=this.xe,this.we=r*t+a*i+n,this.xe=r*e+a*s+o,r=this.Qi,a=this._i,this.Qi=r*t+a*i+n,this._i=r*e+a*s+o;break;case 4:let h=this.figures.r,l=h.length;for(let 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,g=d.length;for(let p=0;p<g;p++){let m=d[p];switch(m.type){case 2:case 1:r=m.endX,a=m.endY,m.endX=r*t+a*i+n,m.endY=r*e+a*s+o;break;case 3:r=m.point1X,a=m.point1Y,m.point1X=r*t+a*i+n,m.point1Y=r*e+a*s+o,r=m.point2X,a=m.point2Y,m.point2X=r*t+a*i+n,m.point2Y=r*e+a*s+o,r=m.endX,a=m.endY,m.endX=r*t+a*i+n,m.endY=r*e+a*s+o;break;case 4:r=m.point1X,a=m.point1Y,m.point1X=r*t+a*i+n,m.point1Y=r*e+a*s+o,r=m.endX,a=m.endY,m.endX=r*t+a*i+n,m.endY=r*e+a*s+o;break;case 5:if(r=m.centerX,a=m.centerY,m.centerX=r*t+a*i+n,m.centerY=r*e+a*s+o,e!==0){let y=Math.atan2(e,t)*180/Math.PI;y<0&&(y+=360),m.startAngle+=y}t<0&&(m.startAngle=180-m.startAngle,m.sweepAngle=-m.sweepAngle),s<0&&(m.startAngle=-m.startAngle,m.sweepAngle=-m.sweepAngle),m.radiusX*=Math.sqrt(t*t+i*i),m.radiusY!==void 0&&(m.radiusY*=Math.sqrt(e*e+s*s));break;case 6:if(r=m.endX,a=m.endY,m.endX=r*t+a*i+n,m.endY=r*e+a*s+o,m.radiusX===0||m.radiusY===0)break;if(e!==0){let y=Math.atan2(e,t)*180/Math.PI;y<0&&(y+=360),m.xAxisRotation+=y}t<0&&(m.xAxisRotation=180-m.xAxisRotation,m.isClockwiseArc=!m.isClockwiseArc),s<0&&(m.xAxisRotation=-m.xAxisRotation,m.isClockwiseArc=!m.isClockwiseArc),m.radiusX*=Math.sqrt(t*t+i*i),m.radiusY*=Math.sqrt(e*e+s*s);break;default:f.o("Unknown Segment type: "+m.type)}}}break}return this.wt=!0,this}containsPoint(t,e){e===void 0&&(e=0);let i=this.we,s=this.xe,n=this.Qi,o=this._i;switch(this.type){case 1:return L.vi(i,s,n,o,e,t.x,t.y);case 2:{let r=Math.min(i,n)-e,a=Math.min(s,o)-e,h=Math.abs(n-i)+e*2,l=Math.abs(o-s)+e*2,u=z.V(r,a,h,l),c=u.containsPoint(t);return z.e(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.qk(t,e,!0,!1);default:return!1}}qk(t,e,i,s){let n=t.x,o=t.y,r=this.bounds.x-20,a=o,h=0,l=0,u=0,c=0,d=0,g=0,p=this.figures.r,m=p.length;for(let y=0;y<m;y++){let w=p[y],b=!w.isEvenOdd;if(w.isFilled){if(i&&w.Wk(n,o,e))return!0}else{if(w.Wk(n,o,s?e:e+2))return!0;continue}let v=w.segments;l=w.startX,u=w.startY;let k=l,S=u,M=v.r;for(let F=0;F<=v.length;F++){let T,N;switch(F!==v.length?(T=M[F],N=T.type,d=T.endX,g=T.endY):(N=2,d=k,g=S),N){case 1:{let C=this.Aw(n,o,r,a,l,u,k,S);if(isNaN(C))return!0;h+=C,k=d,S=g;break}case 2:{let C=this.Aw(n,o,r,a,l,u,d,g);if(isNaN(C))return!0;h+=C;break}case 3:c=L.Eg(l,u,T.point1X,T.point1Y,T.point2X,T.point2Y,d,g,r,a,n,o,.5),h+=c;break;case 4:{let C=(l+2*T.point1X)/3,R=(u+2*T.point1Y)/3,O=(T.point1X*2+d)/3,B=(T.point1Y*2+g)/3;c=L.Eg(l,u,C,R,O,B,d,g,r,a,n,o,.5),h+=c;break}case 5:case 6:{let C=T.type===5?T.bo(w):T.Bh(w,l,u),R=C.length;if(R===0){let B=this.Aw(n,o,r,a,l,u,T.type===5?T.centerX:T.endX,T.type===5?T.centerY:T.endY);if(isNaN(B))return!0;h+=B;break}let O=null;for(let B=0;B<R;B++){if(O=C[B],B===0){let K=this.Aw(n,o,r,a,l,u,O[0],O[1]);if(isNaN(K))return!0;h+=K}c=L.Eg(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],g=O[7]);break}default:f.o("Unknown Segment type: "+T.type)}l=d,u=g}if(b){if(h!==0)return!0}else if(h%2!==0)return!0;h=0}return!1}Aw(t,e,i,s,n,o,r,a){if(L.vi(n,o,r,a,.05,t,e))return NaN;let h=(t-i)*(o-a);if(h===0)return 0;let l=((t*s-e*i)*(n-r)-(t-i)*(n*a-o*r))/h,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}EC(t,e,i){let s=this.figures.r,n=s.length;for(let o=0;o<n;o++)if(s[o].Wk(t,e,i))return!0;return!1}getPointAlongPath(t,e){if(t<0?t=0:t>1&&(t=1),e===void 0&&(e=new P),this.type===1)return e.i(this.startX+t*(this.endX-this.startX),this.startY+t*(this.endY-this.startY)),e;let i=this.flattenedSegments,s=this.flattenedLengths,n=this.flattenedTotalLength,o=i.length,r=n*t,a=0;for(let h=0;h<o;h++){let l=s[h],u=l.length;for(let c=0;c<u;c++){let d=l[c];if(a+d>=r){let g=r-a,p=d===0?0:g/d,m=i[h],y=m[c*2],w=m[c*2+1],b=m[c*2+2],v=m[c*2+3];return e.i(y+(b-y)*p,w+(v-w)*p),e}a+=d}}return e}getAngleAlongPath(t){if(t<0?t=0:t>1&&(t=1),this.type===1)return Math.atan2(this.endY-this.startY,this.endX-this.startX)*180/Math.PI;let e=this.flattenedSegments,i=this.flattenedLengths,s=this.flattenedTotalLength,n=e.length,o=s*t,r=0;for(let a=0;a<n;a++){let h=i[a],l=h.length;for(let u=0;u<l;u++){let c=h[u];if(r+c>=o){let d=e[a],g=d[u*2],p=d[u*2+1],m=d[u*2+2],y=d[u*2+3];return Math.abs(m-g)<1&&Math.abs(y-p)<1?0:Math.abs(m-g)<1?y-p>=0?90:270:Math.abs(y-p)<1?m-g>=0?0:180:Math.atan2(y-p,m-g)*180/Math.PI}r+=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 g=r-a,p=d===0?0:g/d,m=i[h],y=m[c*2],w=m[c*2+1],b=m[c*2+2],v=m[c*2+3];e[0]=y+(b-y)*p,e[1]=w+(v-w)*p;let k;return Math.abs(b-y)<1&&Math.abs(v-w)<1?k=0:Math.abs(b-y)<1?k=v-w>=0?90:270:Math.abs(v-w)<1?k=b-y>=0?0:180:k=Math.atan2(v-w,b-y)*180/Math.PI,e[2]=k,e}a+=d}}return e}getFractionForPoint(t){if(this.type===1){let e=this.startX,i=this.startY,s=this.endX,n=this.endY;if(e===s&&i===n)return 0;{let o=t.x,r=t.y,a=0,h=0;if(e===s)return i<n?(a=i,h=n):(a=n,h=i),r<=a?a===i?0:1:r>=h?h===i?0:1:Math.abs(r-i)/(h-a);if(i===n)return e<s?(a=e,h=s):(a=s,h=e),o<=a?a===e?0:1:o>=h?h===e?0:1:Math.abs(o-e)/(h-a);{let l=(s-e)**2+(n-i)**2,u=P.l();L.dl(e,i,s,n,o,r,u);let c=u.x,d=u.y;return P.e(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),g=Math.abs(l-n),p=Math.min(u,c,d,g);if(p===d)return h/a;if(p===c)return(o+l)/a;if(p===g)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 g=e[d],p=i[d],m=g.length;for(let y=0;y<m;y+=2){let w=g[y],b=g[y+1];if(y===0){l=w,u=b;continue}L.dl(l,u,w,b,t.x,t.y,n);let v=(n.x-t.x)**2+(n.y-t.y)**2;v<o&&(o=v,r=a,r+=Math.sqrt((n.x-l)**2+(n.y-u)**2)),a+=p[(y-2)/2],l=w,u=b}}P.e(n);let c=r/s;return c<0?0:c>1?1:c}return 0}get flattenedSegments(){return this.UC(),this.oc}UC(){if(this.oc===null){let t=this.oc=[],e=this.ru=[];this.fF(t,e)}}get flattenedLengths(){return this.UC(),this.ru}get flattenedTotalLength(){let t=this.lu;if(isNaN(t)){if(this.type===1){let e=Math.abs(this.endX-this.startX),i=Math.abs(this.endY-this.startY);t=Math.sqrt(e*e+i*i)}else if(this.type===2){let e=Math.abs(this.endX-this.startX),i=Math.abs(this.endY-this.startY);t=e*2+i*2}else{let e=this.flattenedLengths,i=e.length;t=0;for(let s=0;s<i;s++){let n=e[s],o=n.length;for(let r=0;r<o;r++)t+=n[r]}}this.lu=t}return t}Jk(t){let e=[],i=0,s=0,n=t.length;for(let o=0;o<n;o+=2){let r=t[o],a=t[o+1];if(o===0){i=r,s=a;continue}let h=Math.sqrt(P.distanceSquared(i,s,r,a));e.push(h),i=r,s=a}return e}fF(t,e){let i=[],s=[];if(this.type===1)i.push(this.startX),i.push(this.startY),i.push(this.endX),i.push(this.endY),t.push(i),s.push(Math.sqrt((this.startX-this.endX)**2+(this.startY-this.endY)**2)),e.push(s);else if(this.type===2)i.push(this.startX),i.push(this.startY),i.push(this.endX),i.push(this.startY),i.push(this.endX),i.push(this.endY),i.push(this.startX),i.push(this.endY),i.push(this.startX),i.push(this.startY),t.push(i),s.push(Math.abs(this.startX-this.endX)),s.push(Math.abs(this.startY-this.endY)),s.push(Math.abs(this.startX-this.endX)),s.push(Math.abs(this.startY-this.endY)),e.push(s);else if(this.type===3){let n=new $t;n.startX=this.endX,n.startY=(this.startY+this.endY)/2;let o=new vt(5);o.startAngle=0,o.sweepAngle=360,o.centerX=(this.startX+this.endX)/2,o.centerY=(this.startY+this.endY)/2,o.radiusX=Math.abs(this.startX-this.endX)/2,o.radiusY=Math.abs(this.startY-this.endY)/2,n.add(o);let r=o.bo(n),a=r.length;if(a===0)i.push(o.centerX),i.push(o.centerY);else{let h=n.startX,l=n.startY;for(let u=0;u<a;u++){let c=r[u];L.vn(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.Jk(i))}else{let n=this.figures.iterator;for(;n.next();){let o=n.value;i=[],i.push(o.startX),i.push(o.startY);let r=o.startX,a=o.startY,h=r,l=a,u=o.segments.r,c=u.length;for(let d=0;d<c;d++){let g=u[d];switch(g.type){case 1:i.length>=4&&(t.push(i),e.push(this.Jk(i))),i=[],i.push(g.endX),i.push(g.endY),r=g.endX,a=g.endY,h=r,l=a;break;case 2:i.push(g.endX),i.push(g.endY),r=g.endX,a=g.endY;break;case 3:L.vn(r,a,g.point1X,g.point1Y,g.point2X,g.point2Y,g.endX,g.endY,.5,i),r=g.endX,a=g.endY;break;case 4:L.Og(r,a,g.point1X,g.point1Y,g.endX,g.endY,.5,i),r=g.endX,a=g.endY;break;case 5:{let p=g.bo(o),m=p.length;if(m===0){i.push(g.centerX),i.push(g.centerY),r=g.centerX,a=g.centerY;break}for(let y=0;y<m;y++){let w=p[y];L.vn(r,a,w[2],w[3],w[4],w[5],w[6],w[7],.5,i),r=w[6],a=w[7]}break}case 6:{let p=g.Bh(o,r,a),m=p.length,y=g.endX,w=g.endY;if(m===0){i.push(y),i.push(w),r=y,a=w;break}for(let b=0;b<m;b++){let v=p[b];L.vn(r,a,v[2],v[3],v[4],v[5],v[6],v[7],.5,i),r=v[6],a=v[7]}break}default:f.o("Segment not of valid type: "+g.type)}g.isClosed&&(i.push(h),i.push(l))}i.length>=4&&(t.push(i),e.push(this.Jk(i)))}}}get type(){return this.H}set type(t){this.H!==t&&(this.h&&f.L(this,t),this.H=t,t===4?this.Rs=new j:(kt.Nw===null&&(kt.Nw=new j().u()),this.Rs=kt.Nw),this.wt=!0)}get startX(){return this.we}set startX(t){this.we!==t&&(this.h&&f.L(this,t),this.we=t,this.wt=!0)}get startY(){return this.xe}set startY(t){this.xe!==t&&(this.h&&f.L(this,t),this.xe=t,this.wt=!0)}get endX(){return this.Qi}set endX(t){this.Qi!==t&&(this.h&&f.L(this,t),this.Qi=t,this.wt=!0)}get endY(){return this._i}set endY(t){this._i!==t&&(this.h&&f.L(this,t),this._i=t,this.wt=!0)}get figures(){return this.Rs}set figures(t){this.Rs!==t&&(this.h&&f.L(this,t),this.Rs=t,this.wt=!0)}add(t){return this.Rs.add(t),this}setSpots(t,e,i,s,n,o,r,a){return this.h&&f.L(this),this.En=new D(t,e,n,o).u(),this.Un=new D(i,s,r,a).u(),this}get spot1(){return this.En}set spot1(t){this.h&&f.L(this,t),this.En=t.P()}get spot2(){return this.Un}set spot2(t){this.h&&f.L(this,t),this.Un=t.P()}get defaultStretch(){return this.Bn}set defaultStretch(t){this.Bn=t}get bounds(){return this.Hk()&&this.Lw(),this.Xg}}kt.stringify=kt.stringify,kt.stringifyFixed=kt.stringifyFixed,kt.fillPath=kt.fillPath,kt.parse=kt.parse;class $t{n;we;xe;hc;Kg;Ee;constructor(t,e,i,s,n){i===void 0&&(i=!0),s===void 0&&(s=!0),n===void 0&&(n=!1),this.n=2|(i?4:0)|(s?8:0)|(n?16:0),t!==void 0?this.we=t:this.we=0,e!==void 0?this.xe=e:this.xe=0,this.hc=new j,this.Kg=this.hc.nt,this.Ee=null}copy(){let t=new $t;t.n=this.n&-2,t.we=this.we,t.xe=this.xe;let e=this.hc.r,i=e.length,s=t.hc;for(let n=0;n<i;n++){let o=e[n].copy();s.add(o)}return t.Kg=this.Kg,t.Ee=this.Ee,t}equalsApprox(t){if(!(t instanceof $t)||!L.f(this.startX,t.startX)||!L.f(this.startY,t.startY))return!1;let e=this.segments.r,i=t.segments.r,s=e.length;if(s!==i.length)return!1;for(let n=0;n<s;n++){let o=e[n],r=i[n];if(!o.equalsApprox(r))return!1}return!0}toString(t){t===void 0&&(t=-1);let e="";if(t<0)e="M"+this.startX.toString()+" "+this.startY.toString();else{let n=o=>o===0?"0":o.toFixed(t);e="M"+n(this.startX)+" "+n(this.startY)}let i=this.segments.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];e+=" "+o.toString(t)}return e}get h(){return(this.n&1)!==0}set h(t){t?this.n|=1:this.n&=-2}get wt(){return(this.n&2)!==0}set wt(t){t?this.n|=2:this.n&=-3}u(){this.h=!0;let t=this.segments;t.u();let e=t.r,i=t.length;for(let s=0;s<i;s++)e[s].u();return this}Hk(){if(this.wt)return!0;let t=this.segments;if(this.Kg!==t.nt)return!0;for(let e of t)if(e.wt)return!0;return!1}aF(){this.wt=!1,this.Ee=null;let t=this.segments;this.Kg=t.nt;for(let e of t)e.wt=!1,e.vs=null}get isFilled(){return(this.n&4)!==0}set isFilled(t){this.h&&f.L(this,t),t?this.n|=4:this.n&=-5}get isShadowed(){return(this.n&8)!==0}set isShadowed(t){this.h&&f.L(this,t),t?this.n|=8:this.n&=-9}get isEvenOdd(){return(this.n&16)!==0}set isEvenOdd(t){this.h&&f.L(this,t),t?this.n|=16:this.n&=-17}get startX(){return this.we}set startX(t){this.h&&f.L(this,t),this.we=t,this.Ee=null,this.wt=!0}get startY(){return this.xe}set startY(t){this.h&&f.L(this,t),this.xe=t,this.Ee=null,this.wt=!0}get segments(){return this.hc}set segments(t){this.h&&f.L(this,t),this.hc=t,this.Ee=null,this.wt=!0}add(t){return this.hc.add(t),this.Ee=null,this}Wk(t,e,i){let s=this,n=s.startX,o=s.startY,r=n,a=o,h=s.segments.r,l=h.length;for(let 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(L.vi(n,o,c.endX,c.endY,i,t,e))return!0;n=c.endX,o=c.endY;break;case 3:if(L.Sw(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(L.Kk(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.bo(s):c.Bh(s,n,o),g=d.length,p=c.type===5?c.centerX:c.endX,m=c.type===5?c.centerY:c.endY;if(g===0){if(L.vi(n,o,p,m,i,t,e))return!0;n=p,o=m;break}let y=null;for(let w=0;w<g;w++)if(y=d[w],w===0&&L.vi(n,o,y[0],y[1],i,t,e)||L.Sw(y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7],.5,t,e,i))return!0;y!==null&&(n=y[6],o=y[7]);break;default:f.o("Unknown Segment type: "+c.type)}if(c.isClosed&&(n!==r||o!==a)&&L.vi(n,o,r,a,i,t,e))return!0}return!1}}var Ci=(x=>(x[x.Move=1]="Move",x[x.Line=2]="Line",x[x.Bezier=3]="Bezier",x[x.QuadraticBezier=4]="QuadraticBezier",x[x.Arc=5]="Arc",x[x.SvgArc=6]="SvgArc",x))(Ci||{});class vt{H;n;Qi;_i;tn;pl;yl;ar;vs;constructor(t,e,i,s,n,o,r,a){if(I.Ki(this),t===void 0&&(t=2),this.H=t,this.n=2,e!==void 0?this.Qi=e:this.Qi=0,i!==void 0?this._i=i:this._i=0,s===void 0&&(s=0),n===void 0&&(n=0),o===void 0&&(o=0),r===void 0&&(r=0),t===6){let h=o;h=h%360,h<0&&(h+=360),this.tn=h,this.pl=0,this.yl=Math.max(s,0),this.ar=Math.max(n,0),typeof r=="boolean"?r&&(this.isLargeArc=!0):typeof r=="number"&&r&&(this.isLargeArc=!0),a&&(this.isClockwiseArc=!0)}else this.tn=s,this.pl=n,t===5&&(o=Math.max(o,0)),this.yl=o,typeof r=="number"?(t===5&&(r=Math.max(r,0)),this.ar=r):this.ar=0;this.vs=null}copy(){let t=new vt;return t.H=this.H,t.n=this.n&-2,t.Qi=this.Qi,t._i=this._i,t.tn=this.tn,t.pl=this.pl,t.yl=this.yl,t.ar=this.ar,t}equalsApprox(t){if(!(t instanceof vt)||this.type!==t.type||this.isClosed!==t.isClosed)return!1;switch(this.type){case 1:case 2:return L.f(this.endX,t.endX)&&L.f(this.endY,t.endY);case 3:return L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)&&L.f(this.point1X,t.point1X)&&L.f(this.point1Y,t.point1Y)&&L.f(this.point2X,t.point2X)&&L.f(this.point2Y,t.point2Y);case 4:return L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)&&L.f(this.point1X,t.point1X)&&L.f(this.point1Y,t.point1Y);case 5:return L.f(this.startAngle,t.startAngle)&&L.f(this.sweepAngle,t.sweepAngle)&&L.f(this.centerX,t.centerX)&&L.f(this.centerY,t.centerY)&&L.f(this.radiusX,t.radiusX)&&L.f(this.radiusY,t.radiusY);case 6:return this.isClockwiseArc===t.isClockwiseArc&&this.isLargeArc===t.isLargeArc&&L.f(this.xAxisRotation,t.xAxisRotation)&&L.f(this.endX,t.endX)&&L.f(this.endY,t.endY)&&L.f(this.radiusX,t.radiusX)&&L.f(this.radiusY,t.radiusY);default:return!1}}oi(t){t in Ci?this.type=t:f.er(this,t)}toString(t){t===void 0&&(t=-1);let e=s=>s===0?"0":s.toFixed(t),i="";switch(this.type){case 1:t<0?i="M"+this.endX.toString()+" "+this.endY.toString():i="M"+e(this.endX)+" "+e(this.endY);break;case 2:t<0?i="L"+this.endX.toString()+" "+this.endY.toString():i="L"+e(this.endX)+" "+e(this.endY);break;case 3:t<0?i="C"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.point2X.toString()+" "+this.point2Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():i="C"+e(this.point1X)+" "+e(this.point1Y)+" "+e(this.point2X)+" "+e(this.point2Y)+" "+e(this.endX)+" "+e(this.endY);break;case 4:t<0?i="Q"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():i="Q"+e(this.point1X)+" "+e(this.point1Y)+" "+e(this.endX)+" "+e(this.endY);break;case 5:t<0?i="B"+this.startAngle.toString()+" "+this.sweepAngle.toString()+" "+this.centerX.toString()+" "+this.centerY.toString()+" "+this.radiusX.toString()+" "+this.radiusY.toString():i="B"+e(this.startAngle)+" "+e(this.sweepAngle)+" "+e(this.centerX)+" "+e(this.centerY)+" "+e(this.radiusX)+" "+e(this.radiusY);break;case 6:t<0?i="A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.xAxisRotation.toString()+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toString()+" "+this.endY.toString():i="A"+e(this.radiusX)+" "+e(this.radiusY)+" "+e(this.xAxisRotation)+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+e(this.endX)+" "+e(this.endY);break;default:i=Ci[this.type]}return i+(this.isClosed?"z":"")}static Move=1;static Line=2;static Bezier=3;static QuadraticBezier=4;static Arc=5;static SvgArc=6;get h(){return(this.n&1)!==0}set h(t){t?this.n|=1:this.n&=-2}get wt(){return(this.n&2)!==0}set wt(t){t?this.n|=2:this.n&=-3}u(){return this.h=!0,this}close(){return this.isClosed=!0,this}bo(t){if(this.vs!==null&&t.wt===!1)return this.vs;let e=this.radiusX,i=this.radiusY;if(i===void 0&&(i=e),e===0||i===0)return this.vs=[],this.vs;let s=this.tn,n=this.pl,o=L.TC(0,0,e<i?e:i,this.startAngle,this.startAngle+this.sweepAngle,!1);if(e!==i){let a=Pt.l();a.Ri(),e<i?a.tt(1,i/e):a.tt(e/i,1),kt.OC(o,a),Pt.e(a)}let r=o.length;for(let a=0;a<r;a++){let h=o[a];h[0]+=s,h[1]+=n,h[2]+=s,h[3]+=n,h[4]+=s,h[5]+=n,h[6]+=s,h[7]+=n}return this.vs=o,this.vs}Bh(t,e,i){if(this.vs!==null&&t.wt===!1)return this.vs;if(this.radiusX===0||this.radiusY===0)return this.vs=[],this.vs;let s=e,n=i,o=this.yl,r=this.ar;o===0&&(o=1e-4),r===0&&(r=1e-4);let a=this.tn*(Math.PI/180),h=this.isLargeArc,l=this.isClockwiseArc,u=this.Qi,c=this._i,d=Math.cos(a),g=Math.sin(a),p=d*(s-u)/2+g*(n-c)/2,m=-g*(s-u)/2+d*(n-c)/2,y=p*p/(o*o)+m*m/(r*r);y>1&&(o*=Math.sqrt(y),r*=Math.sqrt(y));let w=(h===l?-1:1)*Math.sqrt((o*o*r*r-o*o*m*m-r*r*p*p)/(o*o*m*m+r*r*p*p));isNaN(w)&&(w=0);let b=w*o*m/r,v=w*-r*p/o;isNaN(b)&&(b=0),isNaN(v)&&(v=0);let k=(s+u)/2+d*b-g*v,S=(n+c)/2+g*b+d*v,M=(st,et)=>Math.sqrt(st*st+et*et),F=(st,et,ct,gt)=>(st*ct+et*gt)/(M(st,et)*M(ct,gt)),T=(st,et,ct,gt)=>(st*gt<et*ct?-1:1)*Math.acos(F(st,et,ct,gt)),N=T(1,0,(p-b)/o,(m-v)/r),C=(p-b)/o,R=(m-v)/r,O=(-p-b)/o,B=(-m-v)/r,K=T(C,R,O,B),Y=F(C,R,O,B);Y<=-1?K=Math.PI:Y>=1&&(K=0),!l&&K>0&&(K=K-2*Math.PI),l&&K<0&&(K=K+2*Math.PI);let X=o>r?o:r,G=o>r?1:o/r,nt=o>r?r/o:1,at=L.TC(0,0,X,N,N+K,!0),tt=Pt.l();return tt.Ri(),tt.Fs(k,S),tt.cs(this.tn,0,0),tt.tt(G,nt),kt.OC(at,tt),Pt.e(tt),this.vs=at,this.vs}get isClosed(){return(this.n&8)!==0}set isClosed(t){this.isClosed!==t&&(t?this.n|=8:this.n&=-9,this.wt=!0)}get type(){return this.H}set type(t){this.h&&f.L(this,t),this.H=t,this.wt=!0}get endX(){return this.Qi}set endX(t){this.h&&f.L(this,t),this.Qi=t,this.wt=!0}get endY(){return this._i}set endY(t){this.h&&f.L(this,t),this._i=t,this.wt=!0}get point1X(){return this.tn}set point1X(t){this.h&&f.L(this,t),this.tn=t,this.wt=!0}get point1Y(){return this.pl}set point1Y(t){this.h&&f.L(this,t),this.pl=t,this.wt=!0}get point2X(){return this.yl}set point2X(t){this.h&&f.L(this,t),this.yl=t,this.wt=!0}get point2Y(){return this.ar}set point2Y(t){this.h&&f.L(this,t),this.ar=t,this.wt=!0}get centerX(){return this.tn}set centerX(t){this.h&&f.L(this,t),this.tn=t,this.wt=!0}get centerY(){return this.pl}set centerY(t){this.h&&f.L(this,t),this.pl=t,this.wt=!0}get radiusX(){return this.yl}set radiusX(t){t<0&&f.W(t,">= zero",vt,"radiusX"),this.h&&f.L(this,t),this.yl=t,this.wt=!0}get radiusY(){return this.ar}set radiusY(t){t<0&&f.W(t,">= zero",vt,"radiusY"),this.h&&f.L(this,t),this.ar=t,this.wt=!0}get startAngle(){return this.Qi}set startAngle(t){this.h&&f.L(this,t),t=t%360,t<0&&(t+=360),this.Qi=t,this.wt=!0}get sweepAngle(){return this._i}set sweepAngle(t){this.h&&f.L(this,t),t>360&&(t=360),t<-360&&(t=-360),this._i=t,this.wt=!0}get isClockwiseArc(){return(this.n&4)!==0}set isClockwiseArc(t){this.h&&f.L(this,t),t?this.n|=4:this.n&=-5,this.wt=!0}get isLargeArc(){return(this.n&16)!==0}set isLargeArc(t){this.h&&f.L(this,t),t?this.n|=16:this.n&=-17,this.wt=!0}get xAxisRotation(){return this.tn}set xAxisRotation(t){this.h&&f.L(this,t),t=t%360,t<0&&(t+=360),this.tn=t,this.wt=!0}}class je{N;Tw;Dw;jg;Hg;qg;Wg;Jg;$g;Zg;Qg;_g;tm;im;ko;em;sm;nm;be;constructor(){this.N=null,this.Tw=new P(0,0).u(),this.Dw=new P(0,0).u(),this.jg=0,this.Hg=0,this.qg=1,this.Wg="",this.Jg="",this.$g=!1,this.Zg=!1,this.Qg=0,this._g=0,this.tm=!1,this.im=!1,this.ko=!1,this.em=null,this.sm=0,this.nm=null,this.be=null}copy(){let t=new je;return this.clone(t)}clone(t){return t.N=this.N,t.Tw.a(this.viewPoint),t.Dw.a(this.documentPoint),t.jg=this.jg,t.Hg=this.Hg,t.qg=this.qg,t.Wg=this.Wg,t.Jg=this.Jg,t.$g=this.$g,t.Zg=this.Zg,t.Qg=this.Qg,t._g=this._g,t.tm=this.tm,t.im=this.im,t.ko=this.ko,t.em=this.em,t.sm=this.sm,t.nm=this.nm,t.be=this.be,t}toString(){let t="^";return this.modifiers!==0&&(t+="M:"+this.modifiers),this.button!==0&&(t+="B:"+this.button),this.key!==""&&(t+="K:"+this.key),this.clickCount!==0&&(t+="C:"+this.clickCount),this.delta!==0&&(t+="D:"+this.delta),this.handled&&(t+="h"),this.bubbles&&(t+="b"),this.documentPoint!==null&&(t+="@"+this.documentPoint.toString()),t}get diagram(){return this.N}set diagram(t){this.N=t}get viewPoint(){return this.Tw}set viewPoint(t){this.Tw.a(t)}get documentPoint(){return this.Dw}set documentPoint(t){this.Dw.a(t)}getMultiTouchViewPoint(t,e){let i=this.diagram;return i===null||i.BC(this.event,t,e),e}getMultiTouchDocumentPoint(t,e){let i=this.diagram;return i===null||(i.BC(this.event,t,e),e.a(i.transformViewToDoc(e))),e}get modifiers(){return this.jg}set modifiers(t){this.jg=t}get button(){return this.Hg}set button(t){if(this.Hg=t,this.event===null)switch(t){case 0:this.buttons=1;return;case 1:this.buttons=4;return;case 2:this.buttons=2;return}}get buttons(){return this.qg}set buttons(t){this.qg=t}get key(){return this.Wg}set key(t){this.Wg=t}get code(){return this.Jg}set code(t){this.Jg=t}get down(){return this.$g}set down(t){this.$g=t}get up(){return this.Zg}set up(t){this.Zg=t}get clickCount(){return this.Qg}set clickCount(t){this.Qg=t}get delta(){return this._g}set delta(t){this._g=t}get isMultiTouch(){return this.tm}set isMultiTouch(t){this.tm=t}get handled(){return this.im}set handled(t){this.im=t}get bubbles(){return this.ko}set bubbles(t){this.ko=t}get event(){return this.em}set event(t){this.em=t}get isTouchEvent(){let t=this.event;return t===null?!1:t.pointerType==="touch"||t.pointerType==="pen"}get timestamp(){return this.sm}set timestamp(t){this.sm=t}get targetDiagram(){return this.nm}set targetDiagram(t){this.nm=t}get targetObject(){return this.be}set targetObject(t){this.be=t}get control(){return(this.modifiers&1)!==0}set control(t){this.modifiers=t?this.modifiers|1:this.modifiers&-2}get shift(){return(this.modifiers&4)!==0}set shift(t){this.modifiers=t?this.modifiers|4:this.modifiers&-5}get alt(){return(this.modifiers&2)!==0}set alt(t){this.modifiers=t?this.modifiers|2:this.modifiers&-3}get meta(){return(this.modifiers&8)!==0}set meta(t){this.modifiers=t?this.modifiers|8:this.modifiers&-9}get left(){let t=this.event;return t!==null&&(t.type==="mousedown"||t.type==="mouseup"||t.type==="pointerdown"||t.type==="pointerup")?this.button===0:(this.buttons&1)!==0}set left(t){t?this.buttons|=1:this.buttons&=-2}get right(){let t=this.event;return t!==null&&(t.type==="mousedown"||t.type==="mouseup"||t.type==="pointerdown"||t.type==="pointerup")?this.button===2:(this.buttons&2)!==0}set right(t){t?this.buttons|=2:this.buttons&=-3}get middle(){let t=this.event;return t!==null&&(t.type==="mousedown"||t.type==="mouseup"||t.type==="pointerdown"||t.type==="pointerup")?this.button===1:(this.buttons&4)!==0}set middle(t){t?this.buttons|=4:this.buttons&=-5}get commandKey(){let t=this.code,e=this.key;return"cxvyzagCXVYZAG".includes(e)?e.toLowerCase():t==="KeyC"?"c":t==="KeyX"?"x":t==="KeyV"?"v":t==="KeyY"?"y":t==="KeyZ"?"z":t==="KeyA"?"a":t==="KeyG"?"g":t!==""?t:e}}class Wi{N;St;om;rm;constructor(){this.N=null,this.St="",this.om=null,this.rm=null}copy(){let t=new Wi;return t.N=this.N,t.St=this.St,t.om=this.om,t.rm=this.rm,t}toString(){let t="*"+this.name;return this.subject!==null&&(t+=":"+this.subject.toString()),this.parameter!==null&&(t+="("+this.parameter.toString()+")"),t}get diagram(){return this.N}set diagram(t){this.N=t}get name(){return this.St}set name(t){this.St=t}get subject(){return this.om}set subject(t){this.om=t}get parameter(){return this.rm}set parameter(t){this.rm=t}}var ps=(x=>(x[x.Transaction=1]="Transaction",x[x.Property=2]="Property",x[x.Insert=3]="Insert",x[x.Remove=4]="Remove",x))(ps||{});class ii{au;lm;en;ki;N;cu;ac;cc;fc;uc;constructor(){this.au=2,this.lm="",this.en="",this.ki=null,this.N=null,this.cu=null,this.ac=null,this.cc=null,this.fc=null,this.uc=null}static Transaction=1;static Property=2;static Insert=3;static Remove=4;clear(){this.ki=null,this.N=null,this.cu=null,this.ac=null,this.cc=null,this.fc=null,this.uc=null}copy(){let t=new ii;t.au=this.au,t.lm=this.lm,t.en=this.en,t.ki=this.ki,t.N=this.N,t.cu=this.cu;let e=this.ac;return f.G(e)&&f.it(e.copyFrozen)?t.ac=e.copyFrozen():t.ac=e,e=this.cc,f.G(e)&&f.it(e.copyFrozen)?t.cc=e.copyFrozen():t.cc=e,e=this.fc,f.G(e)&&f.it(e.copyFrozen)?t.fc=e.copyFrozen():t.fc=e,e=this.uc,f.G(e)&&f.it(e.copyFrozen)?t.uc=e.copyFrozen():t.uc=e,t}oi(t){t in ps?this.change=t:f.er(this,t)}toString(){let t="";return this.change===1?t+="* ":this.change===2?t+=this.model!==null?"!m":"!d":t+=(this.model!==null?"!m":"!d")+this.change,this.propertyName&&typeof this.propertyName=="string"&&(t+=" "+this.propertyName),this.modelChange&&this.modelChange!==this.propertyName&&(t+=" "+this.modelChange),t+=": ",this.change===1?this.oldValue!==null&&(t+=" "+this.oldValue):(this.object!==null&&(t+=f.toString(this.object)),this.oldValue!==null&&(t+=" old: "+f.toString(this.oldValue)),this.oldParam!==null&&(t+=" "+this.oldParam),this.newValue!==null&&(t+=" new: "+f.toString(this.newValue)),this.newParam!==null&&(t+=" "+this.newParam)),t}getValue(t){return t?this.oldValue:this.newValue}getParam(t){return t?this.oldParam:this.newParam}canUndo(){return this.model!==null||this.diagram!==null}undo(){this.canUndo()&&(this.model!==null?this.model.changeState(this,!0):this.diagram!==null&&this.diagram.VC(this,!0))}canRedo(){return this.model!==null||this.diagram!==null}redo(){this.canRedo()&&(this.model!==null?this.model.changeState(this,!1):this.diagram!==null&&this.diagram.VC(this,!1))}get model(){return this.ki}set model(t){this.ki=t}get diagram(){return this.N}set diagram(t){this.N=t}get change(){return this.au}set change(t){this.au=t}get modelChange(){return this.lm}set modelChange(t){this.lm=t}get propertyName(){return this.en}set propertyName(t){this.en=t}get isTransactionFinished(){return this.au===1&&(this.en==="CommittedTransaction"||this.en==="FinishedUndo"||this.en==="FinishedRedo")}get object(){return this.cu}set object(t){this.cu=t}get oldValue(){return this.ac}set oldValue(t){this.ac=t}get oldParam(){return this.cc}set oldParam(t){this.cc=t}get newValue(){return this.fc}set newValue(t){this.fc=t}get newParam(){return this.uc}set newParam(t){this.uc=t}}class Ai{zC;St;$k;constructor(){this.zC=new j().u(),this.St="",this.$k=!1}toString(t){let e="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(t!==void 0&&t>0){let i=this.changes.count;for(let s=0;s<i;s++){let n=this.changes.elt(s);n!==null&&(e+=`
|
6
6
|
`+n.toString())}}return e}clear(){let t=this.changes;t.Pt();for(let e=t.count-1;e>=0;e--){let i=t.elt(e);i!==null&&i.clear()}t.clear(),t.u()}canUndo(){return this.isComplete}undo(){if(this.canUndo())for(let t=this.changes.count-1;t>=0;t--){let e=this.changes.elt(t);e!==null&&e.undo()}}canRedo(){return this.isComplete}redo(){if(!this.canRedo())return;let t=this.changes.count;for(let e=0;e<t;e++){let i=this.changes.elt(e);i!==null&&i.redo()}}uF(t){let e=this.changes;for(let i=e.count-1;i>=t;i--){let s=e.elt(i);s!==null&&s.undo(),e.Pt(),e.removeAt(i)}e.u()}thaw(){this.changes.Pt()}optimize(){if(!this.isComplete)return;let t=this.changes;t.Pt();let e=new pt;for(let s=0;s<t.count;s++){let n=t.elt(s);if(n===null||n.change!==2||!n.object)continue;let o=e.get(n.object);o||(o=new pt,e.set(n.object,o));let r=o.get(n.propertyName);r===null?o.set(n.propertyName,-1):(r>0&&t.setElt(r,null),o.set(n.propertyName,s))}let i=0;for(let s=0;s<t.count;s++){let n=t.elt(s);n!==null&&(s>i&&t.setElt(i,n),i++)}for(;t.length>i;)t.pop();t.u()}get changes(){return this.zC}get name(){return this.St}set name(t){this.St=t}get isComplete(){return this.$k}set isComplete(t){this.$k=t}}class $i{Fw;Oi;XC;Os;Zk;hm;Vn;Qk;_k;sn;dc;Rw;Is;vw;Ow;am;Iw;constructor(t){this.Fw=new I,this.Oi=!1,this.XC=new j().u(),this.Os=-1,this.Zk=999,this.Is=!1,this.hm=null,this.Vn=0,this.Qk=!1,this._k=23,this.sn=new j().u(),this.dc=new j,this.Rw=!0,this.vw=!1,this.Ow=!1,this.am=!1,this.Iw=!1,t&&Object.assign(this,t)}toString(t){let e="UndoManager "+this.historyIndex+"<"+this.history.count+"<="+this.maxHistoryLength;e+="[";let i=this.nestedTransactionNames.count;for(let s=0;s<i;s++)s>0&&(e+=" "),e+=this.nestedTransactionNames.elt(s);if(e+="]",t!==void 0&&t>0){i=this.history.count;for(let s=0;s<i;s++)e+=`
|
7
7
|
`+this.history.elt(s).toString(t-1)}return e}clear(){let t=this.history;t.Pt();for(let e=t.count-1;e>=0;e--){let i=t.elt(e);i!==null&&i.clear()}t.clear(),this.Os=-1,t.u(),this.Is=!1,this.hm=null,this.Vn=0,this.sn.Pt(),this.sn.clear(),this.sn.u(),this.dc.clear(),this.vw=!1,this.Ow=!1,this.am=!1,this.Iw=!1}copyProperties(t){this.isEnabled=t.isEnabled,this.maxHistoryLength=t.maxHistoryLength,this.cm=t.cm}addModel(t){this.Fw.add(t)}removeModel(t){this.Fw.delete(t)}startTransaction(t){if(t===void 0&&(t=""),t===null&&(t=""),this.isUndoingRedoing)return!1;this.Rw===!0&&(this.Rw=!1,this.Vn++,this.wl||this.xl("StartingFirstTransaction",t,this.currentTransaction),this.Vn>0&&this.Vn--),this.isEnabled&&(this.sn.Pt(),this.sn.add(t),this.sn.u(),this.currentTransaction===null?this.dc.add(0):this.dc.add(this.currentTransaction.changes.count)),this.Vn++;let e=this.transactionLevel===1;return e&&(this.wl||this.xl("StartedTransaction",t,this.currentTransaction)),e}commitTransaction(t){return t===void 0&&(t=""),this.YC(!0,t)}rollbackTransaction(){return this.YC(!1,"")}YC(t,e){if(this.isUndoingRedoing)return!1;this.cm&&this.transactionLevel<1&&f.ni("Ending transaction without having started a transaction: "+e);let i=this.transactionLevel===1,s=this.currentTransaction;i&&t&&(this.wl||this.xl("CommittingTransaction",e,s));let n=0;if(this.transactionLevel>0&&(this.Vn--,this.isEnabled)){let o=this.sn.count;o>0&&(e===""&&(e=this.sn.elt(0)),this.sn.Pt(),this.sn.removeAt(o-1),this.sn.u());let r=this.dc.count;r>0&&(n=this.dc.elt(r-1),this.dc.removeAt(r-1))}if(i){if(t){if(this.am=!1,s===null&&e!==""&&(s=this.currentTransaction),this.isEnabled&&s!==null){let o=s;o.isComplete||(o.isComplete=!0,o.name=e),this.discardHistoryAfterIndex();let r=this.history;r.Pt();let a=this.maxHistoryLength;if(a>=0){if(a===0)r.clear();else if(r.count>=a){let h=r.elt(0);h!==null&&h.clear(),r.removeAt(0),this.Os--}}a!==0&&(r.count===0||r.get(r.count-1)!==o)&&(r.add(o),this.Os++),r.u(),s=o}this.wl||this.xl("CommittedTransaction",e,s)}else{this.Is=!0;try{this.isEnabled&&s!==null&&(s.isComplete=!0,s.undo())}finally{this.wl||this.xl("RolledBackTransaction",e,s),this.Is=!1}s!==null&&s.clear()}return this.hm=null,this.Ew&&this.clear(),this.Ew=!1,this.Uw=!1,!0}else return this.isEnabled&&!t&&s!==null&&s.uF(n),!1}discardHistoryAfterIndex(){if(this.isUndoingRedoing||!this.canRedo())return;let t=this.history;t.Pt();for(let e=t.count-1;e>this.historyIndex;e--){let i=t.elt(e);i!==null&&i.clear(),t.removeAt(e),this.am=!0}t.u()}thaw(){this.history.Pt()}SE(t){this.Vn+=t,this.Vn<0&&(this.Vn=0)}canUndo(){if(!this.isEnabled||this.transactionLevel>0)return!1;let t=this.transactionToUndo;return!!(t!==null&&t.canUndo())}undo(){if(!this.canUndo())return;let t=this.transactionToUndo;try{this.Is=!0,this.xl("StartingUndo","Undo",t),this.Os--,t.undo()}catch(e){f.ni("undo error: "+e.toString())}finally{this.xl("FinishedUndo","Undo",t),this.Is=!1}}canRedo(){if(!this.isEnabled||this.transactionLevel>0)return!1;let t=this.transactionToRedo;return!!(t!==null&&t.canRedo())}redo(){if(!this.canRedo())return;let t=this.transactionToRedo;try{this.Is=!0,this.xl("StartingRedo","Redo",t),this.Os++,t.redo()}catch(e){f.ni("redo error: "+e.toString())}finally{this.xl("FinishedRedo","Redo",t),this.Is=!1}}xl(t,e,i){i===void 0&&(i=null);let s=new ii;s.change=1,s.propertyName=t,s.object=i,s.oldValue=e;let n=this.models;for(;n.next();){let o=n.value;s.model=o,o.dF(s)}}handleChanged(t){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(t)){let e=this.currentTransaction;e===null&&(e=new Ai,this.hm=e);let i=t.copy(),s=e.changes;if(s.Pt(),s.add(i),s.u(),this.cm&&this._k>0&&this.transactionLevel<=0&&!this.Rw){let n=t.diagram;if(n!==null&&n.Vh===!1)return;f.ni("Change not within a transaction: "+i.toString()),this._k--}}}skipsEvent(t){if(t===null||t.change===1)return!0;let e=t.object;if(e===null)return!1;if(e.layer!==void 0){let i=e.layer;if(i!==null&&i.isTemporary)return!0}else if(e.isTemporary)return!0;return!1}get models(){return this.Fw.iterator}get isEnabled(){return this.Oi}set isEnabled(t){this.Oi=t}get transactionToUndo(){return this.historyIndex>=0&&this.historyIndex<=this.history.count-1?this.history.elt(this.historyIndex):null}get transactionToRedo(){return this.historyIndex<this.history.count-1?this.history.elt(this.historyIndex+1):null}get isUndoingRedoing(){return this.Is}get history(){return this.XC}get maxHistoryLength(){return this.Zk}set maxHistoryLength(t){this.Zk=t}get historyIndex(){return this.Os}get currentTransaction(){return this.hm}get transactionLevel(){return this.Vn}get isInTransaction(){return this.Vn>0}get cm(){return this.Qk}set cm(t){this.Qk=t}get nestedTransactionNames(){return this.sn}get Ew(){return this.vw}set Ew(t){this.vw=t}get Uw(){return this.Ow}set Uw(t){this.Ow=t}get wl(){return this.Iw}set wl(t){this.Iw=t}get isJustDiscarded(){return this.am}}class ee{N;St;Oi;tP;iP;fm;GC;constructor(){I.Ki(this),this.N=U.um(),this.St="",this.Oi=!0,this.tP=!1,this.iP=null,this.GC=new je,this.fm=-1}get diagram(){return this.N}set diagram(t){t instanceof U&&(this.N=t)}toString(){return this.name!==""?this.name+" Tool":f.Dn(this.constructor)}updateAdornments(t){}canStart(){return this.isEnabled}doStart(){}doActivate(){this.isActive=!0}doDeactivate(){this.isActive=!1}doStop(){}doCancel(){this.transactionResult=null,this.stopTool()}stopTool(){let t=this.diagram;t.currentTool===this&&(t.currentTool=null,t.currentCursor="")}doMouseDown(){!this.isActive&&this.canStart()&&this.doActivate()}doMouseMove(){}doMouseUp(){this.stopTool()}doMouseWheel(){}canStartMultiTouch(){return!0}standardPinchZoomStart(){let t=this.diagram,e=t.lastInput,i=e.getMultiTouchViewPoint(0,P.V(NaN,NaN)),s=e.getMultiTouchViewPoint(1,P.V(NaN,NaN));if(!i.isReal()||!s.isReal()){P.e(i),P.e(s);return}if(this.doCancel(),t.getInputOption("hasGestureZoom")){t.eP=t.scale;let n=s.x-i.x,o=s.y-i.y,r=Math.sqrt(n*n+o*o);t.sP=r,e.bubbles=!1}P.e(i),P.e(s)}standardPinchZoomMove(){let t=this.diagram,e=t.lastInput,i=e.getMultiTouchViewPoint(0,P.V(NaN,NaN)),s=e.getMultiTouchViewPoint(1,P.V(NaN,NaN));if(!i.isReal()||!s.isReal()){P.e(i),P.e(s);return}if(this.doCancel(),t.getInputOption("hasGestureZoom")){let n=s.x-i.x,o=s.y-i.y,r=Math.sqrt(n*n+o*o)/t.sP,a=new P((Math.min(s.x,i.x)+Math.max(s.x,i.x))/2,(Math.min(s.y,i.y)+Math.max(s.y,i.y))/2),h=t.eP*r,l=t.commandHandler;if(h!==t.scale&&l.canResetZoom(h)){let u=t.zoomPoint;t.zoomPoint=a,l.resetZoom(h),t.zoomPoint=u}e.bubbles=!1}P.e(i),P.e(s)}doKeyDown(){this.diagram.lastInput.code==="Escape"&&this.doCancel()}doKeyUp(){}startTransaction(t){return t===void 0&&(t=this.name),this.transactionResult=null,this.diagram.startTransaction(t)}stopTransaction(){let t=this.diagram;return this.transactionResult===null?t.rollbackTransaction():t.commitTransaction(this.transactionResult)}standardMouseSelect(){let t=this.diagram;if(!t.allowSelect)return;let e=t.lastInput,i=t.findPartAt(e.documentPoint,!1);if(i!==null){if(f.tr?e.meta:e.control){t.D("ChangingSelection",t.selection);let s=i;for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!s.isSelected),t.D("ChangedSelection",t.selection)}else if(e.shift){if(!i.isSelected){t.D("ChangingSelection",t.selection);let s=i;for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&(s.isSelected=!0),t.D("ChangedSelection",t.selection)}}else if(!i.isSelected){let s=i;for(;s!==null&&!s.canSelect();)s=s.containingGroup;s!==null&&t.select(s)}}else e.left&&!(f.tr?e.meta:e.control)&&!e.shift&&t.clearSelection()}standardMouseClick(t,e){t===void 0&&(t=null),e===void 0&&(e=o=>!o.layer?.isTemporary);let i=this.diagram,s=i.lastInput,n=i.findObjectAt(s.documentPoint,t,e);return s.targetObject=n,this.gF(n,s,i),s.handled}gF(t,e,i){if(e.handled=!1,t!==null&&!t.isEnabledObject())return;let s=0;e.left?e.clickCount===1?s=1:e.clickCount===2?s=2:s=1:e.right&&e.clickCount===1&&(s=3);let n="ObjectSingleClicked";if(t!==null){switch(s){case 1:n="ObjectSingleClicked";break;case 2:n="ObjectDoubleClicked";break;case 3:n="ObjectContextClicked";break}s!==0&&i.D(n,t)}else{switch(s){case 1:n="BackgroundSingleClicked";break;case 2:n="BackgroundDoubleClicked";break;case 3:n="BackgroundContextClicked";break}s!==0&&i.D(n)}if(t!==null)for(;t!==null;){let o=null;switch(s){case 1:o=t.click;break;case 2:o=t.doubleClick?t.doubleClick:t.click;break;case 3:o=t.contextClick;break}if(o!==null&&(o(e,t),e.handled))break;t=t.panel}else{let o=null;switch(s){case 1:o=i.click;break;case 2:o=i.doubleClick?i.doubleClick:i.click;break;case 3:o=i.contextClick;break}o!==null&&o(e)}}standardMouseOver(){let t=this.diagram,e=t.lastInput;if(t.animationManager.pi===!0)return;let i=t.skipsUndoManager;t.skipsUndoManager=!0;let s=t.viewportBounds.containsPoint(e.documentPoint)?t.findObjectAt(e.documentPoint,null,null):null;e.event&&(e.event.type==="pointercancel"||e.event.type==="pointerout")&&(s=null),e.targetObject=s;let n=!1;if(s!==t.gc){let o=t.gc,r=o;for(t.gc=s,this.doCurrentObjectChanged(o,s),e.handled=!1;o!==null;){let a=o.mouseLeave;if(a!==null&&(s===o||s!==null&&s.isContainedBy(o)||(a(e,o,s),n=!0,e.handled)))break;o=o.panel}for(o=r,e.handled=!1;s!==null;){let a=s.mouseEnter;if(a!==null&&(o===s||o!==null&&o.isContainedBy(s)||(a(e,s,o),n=!0,e.handled)))break;s=s.panel}s=t.gc}if(s!==null){let o=s,r="";for(;o!==null&&(r=o.cursor,r==="");)o=o.panel;for(t.currentCursor=r,e.handled=!1,o=s;o!==null;){let a=o.mouseOver;if(a!==null&&(a(e,o),n=!0,e.handled))break;o=o.panel}}else{this.doUpdateCursor(null);let o=t.mouseOver;o!==null&&(o(e),n=!0)}n&&t.requestUpdate(),t.skipsUndoManager=i}doUpdateCursor(t){let e=this.diagram;e&&(e.currentCursor="")}doCurrentObjectChanged(t,e){}standardMouseWheel(){let t=this.diagram,e=t.lastInput,i=e.delta;if(i===0||!t.documentBounds.isReal())return;let s=t.commandHandler,n=t.toolManager.mouseWheelBehavior;if(s!==null&&(n===2&&!e.shift||n===1&&e.control)){if(i>0?s.canIncreaseZoom():s.canDecreaseZoom()){let o=t.zoomPoint;t.zoomPoint=e.viewPoint,i>0?s.increaseZoom():s.decreaseZoom(),t.zoomPoint=o}e.bubbles=!1}else if(n===2&&e.shift||n===1&&!e.control){let o=t.position.copy(),r=e.event,a=r.deltaMode,h=r.deltaX,l=r.deltaY,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.GC);this.fm=f.ir(()=>i.doWaitAfter(s),t)}cancelWaitAfter(){this.fm!==-1&&f.Tg(this.fm),this.fm=-1}doWaitAfter(t){}findToolHandleAt(t,e){let i=this.diagram.findObjectAt(t,s=>{for(;s!==null&&!(s.panel instanceof St);)s=s.panel;return s});return i===null?null:i.part.category===e?i:null}isBeyondDragSize(t,e){let i=this.diagram;t===void 0&&(t=i.firstInput.viewPoint),e===void 0&&(e=i.lastInput.viewPoint);let s=i.toolManager.dragSize,n=s.width,o=s.height;return i.firstInput.isTouchEvent&&(n+=6,o+=6),Math.abs(e.x-t.x)>n||Math.abs(e.y-t.y)>o}get name(){return this.St}set name(t){f.s(t,"string",ee,"name"),this.St=t}get isEnabled(){return this.Oi}set isEnabled(t){f.s(t,"boolean",ee,"isEnabled"),this.Oi=t}get isActive(){return this.tP}set isActive(t){f.s(t,"boolean",ee,"isActive"),this.tP=t}get transactionResult(){return this.iP}set transactionResult(t){t!==null&&f.s(t,"string",ee,"transactionResult"),this.iP=t}}var mn=(x=>(x[x.Scroll=1]="Scroll",x[x.Zoom=2]="Zoom",x[x.None=3]="None",x))(mn||{}),pn=(x=>(x[x.Zoom=1]="Zoom",x[x.Cancel=2]="Cancel",x[x.None=3]="None",x))(pn||{});class xe extends ee{KC;jC;HC;nP;oP;rP;lP;hP;aP;cP;dm;zh;constructor(t){super(),this.name="ToolManager",this.KC=new j,this.jC=new j,this.HC=new j,this.nP=850,this.oP=850,this.rP=new Q(2,2).$(),this.lP=5e3,this.hP=1,this.aP=1,this.cP=null,this.dm=null,this.zh=-1,t&&Object.assign(this,t)}static WheelScroll=1;static WheelZoom=2;static WheelNone=3;static GestureZoom=1;static GestureCancel=2;static GestureNone=3;get mouseWheelBehavior(){return this.hP}set mouseWheelBehavior(t){this.hP=t}get gestureBehavior(){return this.aP}set gestureBehavior(t){this.aP=t}initializeStandardTools(){}updateAdornments(t){let e=this.currentToolTip;if(e instanceof St&&this.dm===t){let i=e.adornedObject;(t!==null?i!==null&&i.part===t:i===null)?this.showToolTip(e,i):this.hideToolTip()}}doMouseDown(){let t=this.diagram,e=t.lastInput;if(e.isTouchEvent&&this.gestureBehavior===2&&(e.bubbles=!1),e.isMultiTouch){if(this.cancelWaitAfter(),this.gestureBehavior===3){e.bubbles=!0;return}if(this.gestureBehavior===2)return;if(t.currentTool.canStartMultiTouch()){t.currentTool.standardPinchZoomStart();return}}let i=t.undoManager,s=this.mouseDownTools.length;for(let n=0;n<s;n++){let o=this.mouseDownTools.elt(n);if(o.diagram=this.diagram,o.canStart()){t.doFocus(),t.currentTool=o,t.currentTool===o&&(o.isActive||o.doActivate(),o.doMouseDown());return}}t.lastInput.button===1&&(this.mouseWheelBehavior===1?this.mouseWheelBehavior=2:this.mouseWheelBehavior===2&&(this.mouseWheelBehavior=1)),this.doActivate(),this.standardWaitAfter(this.holdDelay,e)}doMouseMove(){let t=this.diagram,e=t.lastInput;if(e.isMultiTouch){if(this.gestureBehavior===3){e.bubbles=!0;return}if(this.gestureBehavior===2)return;if(t.currentTool.canStartMultiTouch()){t.currentTool.standardPinchZoomMove();return}}if(this.isActive){let s=this.mouseMoveTools.length;for(let n=0;n<s;n++){let o=this.mouseMoveTools.elt(n);if(o.diagram=this.diagram,o.canStart()){t.doFocus(),t.currentTool=o,t.currentTool===o&&(o.isActive||o.doActivate(),o.doMouseMove());return}}}this.standardMouseActivity(t);let i=e.event;i!==null&&(i.type==="pointermove"||!i.cancelable)&&(e.bubbles=!0)}standardMouseActivity(t){this.standardMouseOver(),this.isBeyondDragSize()&&this.standardWaitAfter(this.isActive?this.holdDelay:this.hoverDelay,t.lastInput)}doCurrentObjectChanged(t,e){let i=this.currentToolTip;i!==null&&(e!==null&&i instanceof St&&(e===i||e.isContainedBy(i))||this.hideToolTip())}doWaitAfter(t){let e=this.diagram;if(e.mF()&&(this.doMouseHover(),this.isActive||this.doToolTip(),t.isTouchEvent&&!e.lastInput.handled)){let i=t.copy();i.button=2,e.lastInput=i,e.Bw=!0,e.doMouseUp();return}}doMouseHover(){let t=this.diagram,e=t.lastInput;e.targetObject===null&&(e.targetObject=t.findObjectAt(e.documentPoint,null,null));let i=e.targetObject;if(i!==null)for(e.handled=!1;i!==null;){let s=this.isActive?i.mouseHold:i.mouseHover;if(s!==null&&(s(e,i),e.handled))break;i=i.panel}else{let s=this.isActive?t.mouseHold:t.mouseHover;s!==null&&s(e)}}doToolTip(){let t=this.diagram,e=t.lastInput;e.targetObject===null&&(e.targetObject=t.findObjectAt(e.documentPoint,null,null));let i=e.targetObject;if(i!==null){let s=this.currentToolTip;if(s instanceof St&&(i===s||i.isContainedBy(s)))return;for(;i!==null;){let n=i.toolTip;if(n!==null){this.showToolTip(n,i);return}i=i.panel}this.hideToolTip()}else{let s=t.toolTip;s!==null?this.showToolTip(s,null):this.hideToolTip()}}showToolTip(t,e){let i=this.diagram;if(t!==this.currentToolTip&&this.hideToolTip(),t instanceof St){t.layerName="Tool",t.selectable=!1,t.scale=1/i.scale,t.category="ToolTip",t.hasPlaceholder()&&(t.placeholder.scale=i.scale);let n=t.diagram;n!==null&&n!==i&&n.remove(t),i.add(t),e!==null?t.adornedObject=e:t.data=i.model,t.ensureBounds(),this.positionToolTip(t,e)}else t instanceof Ne&&t!==this.currentToolTip&&t.show!==null&&t.show(e,i,this);this.currentToolTip=t,this.zh!==-1&&(f.Tg(this.zh),this.zh=-1);let s=this.toolTipDuration;if(s>0&&s!==1/0){let n=this;this.zh=f.ir(()=>n.hideToolTip(),s)}}positionToolTip(t,e){if(t.hasPlaceholder())return;let i=t,s=this.diagram,n=s.lastInput.documentPoint.copy(),o=i.measuredBounds,r=s.viewportBounds;s.lastInput.isTouchEvent&&(n.x-=o.width),n.x+o.width>r.right&&(n.x-=o.width+5/s.scale),n.x<r.x&&(n.x=r.x),n.y+20/s.scale+o.height>r.bottom?n.y-=o.height+5/s.scale:n.y+=20/s.scale,n.y<r.y&&(n.y=r.y),i.position=n}hideToolTip(){this.zh!==-1&&(f.Tg(this.zh),this.zh=-1);let t=this.diagram,e=this.currentToolTip;e!==null&&(e instanceof St?(t.remove(e),this.dm!==null&&this.dm.removeAdornment(e.category),e.data=null,e.adornedObject=null):e instanceof Ne&&e.hide!==null&&e.hide(t,this),this.currentToolTip=null)}get currentToolTip(){return this.cP}set currentToolTip(t){this.cP=t,this.dm=t!==null&&t instanceof St?t.adornedPart:null}doMouseUp(){this.cancelWaitAfter();let t=this.diagram;if(this.isActive){let e=this.mouseUpTools.length;for(let i=0;i<e;i++){let s=this.mouseUpTools.elt(i);if(s.diagram=this.diagram,s.canStart()){t.doFocus(),t.currentTool=s,t.currentTool===s&&(s.isActive||s.doActivate(),s.doMouseUp());return}}}t.doFocus(),this.doDeactivate()}doMouseWheel(){this.standardMouseWheel()}doKeyDown(){let t=this.diagram;t.commandHandler!==null&&t.commandHandler.doKeyDown()}doKeyUp(){let t=this.diagram;t.commandHandler!==null&&t.commandHandler.doKeyUp()}findTool(t){f.s(t,"string",xe,"findTool:name");let e=this.mouseDownTools.length;for(let i=0;i<e;i++){let s=this.mouseDownTools.elt(i);if(s.name===t)return s}e=this.mouseMoveTools.length;for(let i=0;i<e;i++){let s=this.mouseMoveTools.elt(i);if(s.name===t)return s}e=this.mouseUpTools.length;for(let i=0;i<e;i++){let s=this.mouseUpTools.elt(i);if(s.name===t)return s}return null}replaceTool(t,e){f.s(t,"string",xe,"replaceTool:name"),e!==null&&(e.diagram=this.diagram);let i=this.mouseDownTools.length;for(let s=0;s<i;s++){let n=this.mouseDownTools.elt(s);if(n.name===t)return e!==null?this.mouseDownTools.setElt(s,e):this.mouseDownTools.removeAt(s),n}i=this.mouseMoveTools.length;for(let s=0;s<i;s++){let n=this.mouseMoveTools.elt(s);if(n.name===t)return e!==null?this.mouseMoveTools.setElt(s,e):this.mouseMoveTools.removeAt(s),n}i=this.mouseUpTools.length;for(let s=0;s<i;s++){let n=this.mouseUpTools.elt(s);if(n.name===t)return e!==null?this.mouseUpTools.setElt(s,e):this.mouseUpTools.removeAt(s),n}return null}replaceStandardTool(t,e,i){this.Jt(t,e,i)}Jt(t,e,i){f.s(t,"string",xe,"replaceStandardTool:name"),e!==null&&(e.name=t,e.diagram=this.diagram),this.findTool(t)?this.replaceTool(t,e):e!==null&&i.add(e)}get mouseDownTools(){return this.KC}get mouseMoveTools(){return this.jC}get mouseUpTools(){return this.HC}get hoverDelay(){return this.nP}set hoverDelay(t){f.s(t,"number",xe,"hoverDelay"),this.nP=t}get holdDelay(){return this.oP}set holdDelay(t){f.s(t,"number",xe,"holdDelay"),this.oP=t}get dragSize(){return this.rP}set dragSize(t){this.rP=t.P()}get toolTipDuration(){return this.lP}set toolTipDuration(t){f.s(t,"number",xe,"toolTipDuration"),this.lP=t}get actionTool(){return this.findTool("Action")}set actionTool(t){this.Jt("Action",t,this.mouseDownTools)}get relinkingTool(){return this.findTool("Relinking")}set relinkingTool(t){this.Jt("Relinking",t,this.mouseDownTools)}get linkReshapingTool(){return this.findTool("LinkReshaping")}set linkReshapingTool(t){this.Jt("LinkReshaping",t,this.mouseDownTools)}get resizingTool(){return this.findTool("Resizing")}set resizingTool(t){this.Jt("Resizing",t,this.mouseDownTools)}get rotatingTool(){return this.findTool("Rotating")}set rotatingTool(t){this.Jt("Rotating",t,this.mouseDownTools)}get linkingTool(){return this.findTool("Linking")}set linkingTool(t){this.Jt("Linking",t,this.mouseMoveTools)}get draggingTool(){return this.findTool("Dragging")}set draggingTool(t){this.Jt("Dragging",t,this.mouseMoveTools)}get dragSelectingTool(){return this.findTool("DragSelecting")}set dragSelectingTool(t){this.Jt("DragSelecting",t,this.mouseMoveTools)}get panningTool(){return this.findTool("Panning")}set panningTool(t){this.Jt("Panning",t,this.mouseMoveTools)}get contextMenuTool(){return this.findTool("ContextMenu")}set contextMenuTool(t){this.Jt("ContextMenu",t,this.mouseUpTools)}get textEditingTool(){return this.findTool("TextEditing")}set textEditingTool(t){this.Jt("TextEditing",t,this.mouseUpTools)}get clickCreatingTool(){return this.findTool("ClickCreating")}set clickCreatingTool(t){this.Jt("ClickCreating",t,this.mouseUpTools)}get clickSelectingTool(){return this.findTool("ClickSelecting")}set clickSelectingTool(t){this.Jt("ClickSelecting",t,this.mouseUpTools)}}class Dt extends ee{fP;uP;nn;dP;gP;mP;pP;mc;gm;yP;Xh;cr;qC;wP;fu;uu;xP;bP;kP;PP;constructor(t){super(),this.name="Dragging",this.fP=!0,this.PP=!0,this.uP=!0,this.nn=null,this.dP=null,this.gP=null,this.mP=null,this.pP=!1,this.fu=!1,this.mc=new P(NaN,NaN),this.gm=new P,this.yP=!0,this.Xh=100,this.cr=[],this.qC=new I().u(),this.wP=new Qi,this.uu=null,this.xP="copy",this.bP="",this.kP="no-drop",t&&Object.assign(this,t)}get isCopyEnabled(){return this.fP}set isCopyEnabled(t){f.s(t,"boolean",Dt,"isCopyEnabled"),this.fP=t}get copiesEffectiveCollection(){return this.uP}set copiesEffectiveCollection(t){f.s(t,"boolean",Dt,"copiesEffectiveCollection"),this.uP=t}get dragOptions(){return this.wP}set dragOptions(t){this.wP=t}get isGridSnapEnabled(){return this.dragOptions.isGridSnapEnabled}set isGridSnapEnabled(t){f.s(t,"boolean",Dt,"isGridSnapEnabled"),this.dragOptions.isGridSnapEnabled=t}get isComplexRoutingRealtime(){return this.yP}set isComplexRoutingRealtime(t){this.yP=t;let e=this.diagram.findRouter("AvoidsLinks");e!==null&&(e.isRealtime=t)}get isGridSnapRealtime(){return this.dragOptions.isGridSnapRealtime}set isGridSnapRealtime(t){f.s(t,"boolean",Dt,"isGridSnapRealtime"),this.dragOptions.isGridSnapRealtime=t}get gridSnapCellSize(){return this.dragOptions.gridSnapCellSize}set gridSnapCellSize(t){this.dragOptions.gridSnapCellSize.equals(t)||(t=t.P(),this.dragOptions.gridSnapCellSize=t)}get gridSnapCellSpot(){return this.dragOptions.gridSnapCellSpot}set gridSnapCellSpot(t){this.dragOptions.gridSnapCellSpot.equals(t)||(t=t.P(),this.dragOptions.gridSnapCellSpot=t)}get gridSnapOrigin(){return this.dragOptions.gridSnapOrigin}set gridSnapOrigin(t){this.dragOptions.gridSnapOrigin.equals(t)||(t=t.P(),this.dragOptions.gridSnapOrigin=t)}get dragsLink(){return this.dragOptions.dragsLink}set dragsLink(t){f.s(t,"boolean",Dt,"dragsLink"),this.dragOptions.dragsLink=t}get dragsTree(){return this.dragOptions.dragsTree}set dragsTree(t){f.s(t,"boolean",Dt,"dragsTree"),this.dragOptions.dragsTree=t}get copyCursor(){return this.xP}set copyCursor(t){this.xP=t}get moveCursor(){return this.bP}set moveCursor(t){this.bP=t}get nodropCursor(){return this.kP}set nodropCursor(t){this.kP=t}get currentPart(){return this.dP}set currentPart(t){this.dP=t}get copiedParts(){return this.mP}set copiedParts(t){this.mP=t}get draggedParts(){return this.gP}set draggedParts(t){this.gP=t}get draggingParts(){return this.copiedParts!==null?this.copiedParts.toKeySet():this.draggedParts!==null?this.draggedParts.toKeySet():this.qC}get draggedLink(){return this.diagram.draggedLink}set draggedLink(t){this.diagram.draggedLink=t}get isDragOutStarted(){return this.pP}set isDragOutStarted(t){this.pP=t}get startPoint(){return this.gm}set startPoint(t){this.gm.equals(t)||this.gm.a(t)}get delay(){return this.Xh}set delay(t){f.s(t,"number",Dt,"delay"),this.Xh=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t===null||t.isReadOnly&&!t.allowDragOut||!t.allowMove&&!t.allowCopy&&!t.allowDragOut||!t.allowSelect)return!1;let e=t.lastInput;return!e.left||t.currentTool!==this&&(!this.isBeyondDragSize()||e.isTouchEvent&&e.timestamp-t.firstInput.timestamp<this.Xh)?!1:this.findDraggablePart()!==null}findDraggablePart(){let t=this.diagram,e=t.findPartAt(t.firstInput.documentPoint,!1);if(e===null)return null;for(;e!==null&&!e.canSelect();)e=e.containingGroup;return e!==null&&(e.canMove()||e.canCopy())?e:null}standardMouseSelect(){let t=this.diagram;if(!t.allowSelect)return;let e=t.findPartAt(t.firstInput.documentPoint,!1);if(e!==null){for(;e!==null&&!e.canSelect();)e=e.containingGroup;if(this.currentPart=e,this.currentPart!==null&&!this.currentPart.isSelected){t.D("ChangingSelection",t.selection);let i=t.lastInput;!(f.tr?i.meta:i.control)&&!i.shift&&t.clearSelection(!0),this.currentPart.isSelected=!0,t.D("ChangedSelection",t.selection)}}}doActivate(){let t=this.diagram;this.uu=null,this.currentPart===null&&this.standardMouseSelect();let e=this.currentPart;if(e===null||!e.canMove()&&!e.canCopy())return;t.cacheGroupExternalLinks(!0),Dt.dt=null,this.isActive=!0,this.mc.set(t.position),this.SP(t.selection),this.cr.length=0,t.animationManager.stopAnimation();let i=this.computeEffectiveCollection(t.selection,this.dragOptions);this.draggedParts=i,this.PP=!!this.diagram.layout.isRealtime,this.diagram.layout.isRealtime=!1,t.du=!0,t.getRenderingHint("temporaryPixelRatio")===!0&&t.avgSpf>30&&t.Vw(),t.WC(this.draggedParts),t.gu=!0,this.startTransaction("Drag"),this.startPoint=t.firstInput.documentPoint,t.isMouseCaptured=!0,t.allowDragOut&&this.pF()}SP(t){if(!this.dragsLink)return;let e=this.diagram,i=e.model.mm(),s=t.first();i&&t.count===1&&s instanceof _&&this.mayDragLink(s)?(this.draggedLink=s,this.draggedLink.canRelinkFrom()&&this.draggedLink.canRelinkTo()&&this.draggedLink.clearAdornments(),this.nn=e.toolManager.findTool("Relinking"),this.nn===null&&(this.nn=new ys,this.nn.diagram=e),this.nn.originalLink=this.draggedLink):(this.draggedLink=null,this.nn=null)}mayDragLink(t){let e=this.diagram;return e!==null&&e.allowRelink}computeEffectiveCollection(t,e){return this.diagram.commandHandler.computeEffectiveCollection(t,e)}Es(t){return t===void 0?new ni(P.xo):this.isGridSnapEnabled?new ni(new P(Math.round(t.x*1e3)/1e3,Math.round(t.y*1e3)/1e3)):new ni(t.copy())}doDeactivate(){this.isActive=!1;let t=this.diagram;this.diagram.layout.isRealtime=this.PP,t.gu=!1,t.bl=!0,t.cacheGroupExternalLinks(!1),t.stopAutoScroll(),this.MP(),t.NP(this.draggedParts),this.uu=null,this.currentPart=null,this.draggedParts=null,this.isDragOutStarted=!1,this.fu=!1,Dt.yF(),this.JC(),this.mc.i(NaN,NaN),Dt.Yh!==null&&(Dt.Yh.currentCursor=""),Dt.Yh=null,Dt.dt=null,this.kl(),t.isMouseCaptured=!1,t.currentCursor="",t.du=!1,this.stopTransaction(),t.CP(!0)}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}MP(){let t=this.diagram,e=t.skipsUndoManager;t.skipsUndoManager=!0;let i=t.lastInput;this.$C(i,null),t.skipsUndoManager=e,this.cr.length=0}ZC(){this.kl(),this.LP();let t=this.diagram;this.mc.isReal()&&(t.position=this.mc),t.stopAutoScroll()}doCancel(){this.kl(),this.LP();let t=this.diagram;this.mc.isReal()&&(t.position=this.mc),this.stopTool()}doKeyDown(){let t=this.diagram;if(!this.isActive)return;let e=t.lastInput,i=t.previousInput;e.code==="Escape"?this.doCancel():(e.code!==i.code||e.modifiers!==i.modifiers)&&this.doMouseMove()}doKeyUp(){this.isActive&&this.doMouseMove()}wF(t,e){let i=1/0,s=1/0,n=-1/0,o=-1/0,r=t.iterator;for(;r.next();){let a=r.value;if(!a.isVisible())continue;let h=a.location,l=h.x,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.i(0,0,0,0):e.i(i,s,n-i,o-s),e}AP(t){if(this.copiedParts!==null)return;let e=this.diagram;if(t&&(e.isReadOnly||e.isModelReadOnly)||this.draggedParts===null)return;let i=e.undoManager;i.isEnabled&&i.isInTransaction?i.currentTransaction!==null&&i.currentTransaction.changes.count>0&&(e.undoManager.rollbackTransaction(),e.startTransaction("Drag")):this.LP(),e.skipsUndoManager=!t,e.partManager.addsToTemporaryLayer=!t,this.startPoint=e.firstInput.documentPoint;let s=this.copiesEffectiveCollection?this.draggedParts.toKeySet():e.selection,n=e.copyParts(s,e,!0),o=new pt,r=this.draggedParts.iterator;for(;r.next();){let h=r.key;if(h.ke()&&h.canCopy()){let l=n.get(h);if(l===null)continue;l.location=h.location,l.ensureBounds(),o.set(l,this.Es(l.location))}}let a=n.iterator;for(;a.next();){let h=a.value;h instanceof _&&h.canCopy()&&o.set(h,this.Es())}if(this.copiedParts=o,this.SP(o.toKeySet()),this.draggedLink!==null){let h=this.draggedLink,l=h.routeBounds;h.fr(this.startPoint.x-(l.x+l.width/2),this.startPoint.y-(l.y+l.height/2))}this.doUpdateCursor(null)}kl(){let t=this.diagram;if(this.copiedParts!==null){if(t.removeParts(this.copiedParts.toKeySet(),!1),this.copiedParts=null,this.draggedParts!==null){let e=this.draggedParts.iterator;for(;e.next();)if(e.key instanceof _){let i=e.value;i.point=new P(0,0)}}this.doUpdateCursor(null)}t.skipsUndoManager=!1,t.partManager.addsToTemporaryLayer=!1,this.startPoint=t.firstInput.documentPoint}JC(){this.draggedLink!==null&&(this.dragsLink&&this.nn!==null&&(this.nn.stopDraggingMouseMove(),this.nn.originalLink=null),this.draggedLink=null,this.nn=null)}pc(t,e){if(t===null)return;let i=this.diagram,s=this.startPoint,n=P.l();n.a(i.lastInput.documentPoint),this.moveParts(t,n.subtract(s),e),P.e(n),i.getRenderingHint("temporaryPixelRatio")===!0&&i.Pl===null&&i.avgSpf>30&&(i.Vw(),i.mu())}moveParts(t,e,i){i===void 0&&(i=!1);let s=this.diagram;s!==null&&s.TP(t,e,this.dragOptions,i)}LP(){if(this.draggedParts===null)return;let t=this.diagram,e=this.draggedParts.iterator;for(;e.next();){let i=e.key;i.ke()&&(i.location=e.value.point)}for(e=this.draggedParts.iterator;e.next();){let i=e.key;if(i instanceof _&&i.suspendsRouting){let s=e.value.point;this.draggedParts.set(i,this.Es()),i.fr(-s.x,-s.y)}}t.maybeUpdate()}xF(t){if(t===null)return!0;let e=t.part;return!!(e===null||e instanceof St||e.layer?.isTemporary||this.draggedParts&&this.draggedParts.has(e)||this.copiedParts&&this.copiedParts.has(e))}DP(t){let e=this.diagram;this.dragsLink&&(this.draggedLink!==null&&(this.draggedLink.fromNode=null,this.draggedLink.toNode=null),this.QC(!1));let i=this.findDragOverObject(t),s=e.lastInput;s.targetObject=i,this.doUpdateCursor(i);let n=e.skipsUndoManager,o=!1;try{if(e.skipsUndoManager=!0,o=this.$C(s,i),!this.isActive&&Dt.dt===null)return;let r=i!==null?i.part:null;if(r===null||e.handlesDragDropForTopLevelParts&&r.isTopLevel&&!(r instanceof ft)){let a=e.mouseDragOver;a!==null&&(a(s),o=!0)}if(!this.isActive&&Dt.dt===null||(this.doDragOver(t,i),!this.isActive&&Dt.dt===null))return}finally{e.skipsUndoManager=n,o&&e.maybeUpdate()}this.uu=i,!e.isReadOnly&&(e.allowMove||e.allowCopy)&&(e.allowHorizontalScroll||e.allowVerticalScroll)&&e.doAutoScroll(s.viewPoint)}findDragOverObject(t){return this.diagram.FP(t,null,e=>!this.xF(e))}doUpdateCursor(t){let e=this.diagram;(t===null||this.uu!==t)&&(!this.diagram.currentTool.isActive||this.mayCopy()?e.currentCursor=this.copyCursor:this.mayMove()?e.currentCursor=this.moveCursor:this.mayDragOut()&&(e.currentCursor=this.nodropCursor))}$C(t,e){let i=!1,s=this.cr.length,n=s>0?this.cr[0]:null;if(e===n)return!1;t.handled=!1;for(let r=0;r<s;r++){let a=this.cr[r],h=a.mouseDragLeave;if(h!==null&&(h(t,a,e),i=!0,t.handled))break}if(this.cr.length=0,!this.isActive&&Dt.dt===null||e===null)return i;t.handled=!1;let o=e;for(;o!==null;)this.cr.push(o),o=this._C(o);s=this.cr.length;for(let r=0;r<s;r++){let a=this.cr[r],h=a.mouseDragEnter;if(h!==null&&(h(t,a,n),i=!0,t.handled))break}return i}ME(t,e){return t===null?!1:!!(t===e||t.isContainedBy(e)||e instanceof ft&&!(t instanceof ft)&&e.handlesDragDropForMembers&&t.part?.isMemberOf(e))}_C(t){let e=t.panel;if(e!==null)return e;if(t instanceof Nt&&!(t instanceof ft)){let i=t.containingGroup;if(i!==null&&i.handlesDragDropForMembers)return i}return null}tL(t,e){let i=this.diagram,s=this.nn;if(s===null)return null;let n=s.portGravity,o=i.findObjectsNear(t,n,l=>s.findValidLinkablePort(l,e)),r=P.l(),a=1/0,h=null;for(let l=o.iterator;l.next();){let u=l.value;if(u.part===null)continue;let c=u.getDocumentPoint(D.Center,r),d=t.distanceSquaredPoint(c);d<a&&(h=u,a=d)}return P.e(r),h}QC(t){let e=this.draggedLink;if(e!==null){if(e.pointsCount<2)return;let i=this.diagram;if(i.isReadOnly)return;let s=this.nn;if(s===null)return;let n=null,o=null;e.fromNode===null&&(n=this.tL(e.getPoint(0),!1),n!==null&&(o=n.part));let r=null,a=null;e.toNode===null&&(r=this.tL(e.getPoint(e.pointsCount-1),!0),r!==null&&(a=r.part)),s.isValidLink(o,n,a,r)?t?(e.defaultFromPoint=e.getPoint(0),e.defaultToPoint=e.getPoint(e.pointsCount-1),e.suspendsRouting=!1,e.fromNode=o,n!==null&&(e.fromPortId=n.portId),e.toNode=a,r!==null&&(e.toPortId=r.portId),e.fromPort!==i.RP&&i.D("LinkRelinked",e,i.RP),e.toPort!==i.vP&&i.D("LinkRelinked",e,i.vP)):s.doDraggingMouseMove(o,n,a,r):s.doDraggingMouseMove(null,null,null,null)}}doDragOver(t,e){}iL(t){let e=this.diagram;this.dragsLink&&this.QC(!0),this.MP();let i=this.findDragOverObject(t),s=e.lastInput;if(s.targetObject=i,i!==null){s.handled=!1;let a=i;for(;a!==null;){let h=a.mouseDrop;if(h!==null&&(h(s,a),s.handled))break;this.bF(s,a),a=this._C(a)}}else{let a=e.mouseDrop;a!==null&&a(s)}if(!this.isActive&&Dt.dt===null)return;let n=this.copiedParts||this.draggedParts;if(n!==null){let a=n.iterator;for(;a.next();){let h=a.key;h instanceof rt&&h.linksConnected.each(l=>l.suspendsRouting=!1)}}if(this.doDropOnto(t,i),!this.isActive&&Dt.dt===null)return;let o=z.l(),r=e.selection.iterator;for(;r.next();){let a=r.value;a instanceof rt&&this.kF(e,a,o)}z.e(o)}bF(t,e){let i=this.diagram,s=e.part;if(i.handlesDragDropForTopLevelParts&&s!==null&&s.isTopLevel&&!(s instanceof ft)){let n=i.mouseDrop;n!==null&&n(t)}}kF(t,e,i){if(!e.canAvoid())return;let s=!1;i=e.getAvoidableRect(i),t.viewportBounds.containsRect(i)&&(s=!0);let n=this.copiedParts||this.draggedParts;if(n===null)return;let o=t.OP(i,a=>a.part,a=>a instanceof _,!0,a=>a instanceof _,s);if(o.count===0)return;let r=o.iterator;for(;r.next();){let a=r.value;n.has(a)&&n.has(e)||!a.isMemberOf(e)&&a.isAvoiding&&a.invalidateRoute()}}doDropOnto(t,e){}doMouseMove(){if(!this.isActive)return;let t=this.diagram,e=t.lastInput;this.simulatedMouseMove(e.event,e.documentPoint,e.targetDiagram)||this.currentPart!==null&&this.draggedParts!==null&&(this.mayCopy()?(this.AP(!1),this.pc(this.copiedParts,!1)):this.mayMove()?(this.kl(),this.pc(this.draggedParts,!0)):this.mayDragOut()?(this.AP(!1),this.pc(this.copiedParts,!1)):this.kl(),this.DP(t.lastInput.documentPoint))}doMouseUp(){if(!this.isActive)return;let t=this.diagram,e=t.lastInput;if(this.simulatedMouseUp(e.event,e.documentPoint,e.targetDiagram))return;let i=!1,s=this.mayCopy();if(s&&this.copiedParts!==null?(this.kl(),this.AP(!0),this.pc(this.copiedParts,!1),this.copiedParts!==null&&(t.D("ChangingSelection",t.selection),t.clearSelection(!0),this.copiedParts.iteratorKeys.each(n=>{n.isSelected=!0}))):(i=!0,this.kl(),this.mayMove()&&(this.pc(this.draggedParts,!0),this.DP(t.lastInput.documentPoint))),this.fu=!0,this.iL(t.lastInput.documentPoint),this.isActive){let n=s&&this.copiedParts,o=n?this.copiedParts?.toKeySet():this.draggedParts?this.draggedParts.toKeySet():null;this.copiedParts=null,i&&this.PF(),t.invalidateDocumentBounds(),t.NP(this.draggedParts),this.transactionResult=n?"Copy":"Move",t.D(n?"SelectionCopied":"SelectionMoved",o)}this.stopTool(),s&&t.D("ChangedSelection",t.selection)}simulatedMouseMove(t,e,i){if(Dt.dt===null)return!1;let s=Dt.dt.diagram;i instanceof U||(i=null);let n=Dt.Yh;if(i!==n){if(n!==null&&n!==s){n.stopAutoScroll(),Dt.dt.isDragOutStarted=!1;let r=n.toolManager.findTool("Dragging");r!==null&&r.doSimulatedDragLeave()}if(Dt.Yh=i,i!==null&&i!==s){Dt.dt.ZC();let r=i.toolManager.findTool("Dragging");r!==null&&(r.eL(),r.doSimulatedDragEnter())}this.doUpdateCursor(null)}if(i===null||i===s||!i.allowDrop||i.isReadOnly||!i.allowInsert)return!1;let o=i.toolManager.findTool("Dragging");if(o!==null){let r=e;t!==null&&(t.targetTouches!==void 0&&(t.targetTouches.length>0?t=t.targetTouches[0]:t.changedTouches.length>0&&(t=t.changedTouches[0])),r=i.getMouse(t)),i.lastInput.documentPoint=r,i.lastInput.viewPoint=i.transformDocToView(r),i.lastInput.down=!1,i.lastInput.up=!1,o.doSimulatedDragOver()}return!0}simulatedMouseUp(t,e,i){if(Dt.dt===null)return!1;let s=Dt.Yh,n=Dt.dt.diagram;if(i===null)return Dt.dt.doCancel(),!0;if(i!==s){if(s!==null){let r=s.toolManager.findTool("Dragging");if(s!==null&&s!==n&&r!==null)return s.stopAutoScroll(),Dt.dt.isDragOutStarted=!1,r.doSimulatedDragLeave(),!1}Dt.Yh=i;let o=i.toolManager.findTool("Dragging");o!==null&&(Dt.dt.ZC(),o.eL(),o.doSimulatedDragEnter())}if(i!==this.diagram){let o=e;t!==null?(t.targetTouches!==void 0&&(t.targetTouches.length>0?t=t.targetTouches[0]:t.changedTouches.length>0&&(t=t.changedTouches[0])),o=i.getMouse(t)):o===null&&(o=new P),i.lastInput.documentPoint=o,i.lastInput.viewPoint=i.transformDocToView(o),i.lastInput.down=!1,i.lastInput.up=!0;let r=i.toolManager.findTool("Dragging");r!==null&&r.doSimulatedDrop();let a=Dt.dt;if(a!==null){let h=a.mayCopy();a.transactionResult=h?"Copy":"Move",a.stopTool()}return!0}return!1}PF(){if(this.draggedParts===null)return;let t=this.draggedParts.iterator;for(;t.next();){let e=t.key;if(e instanceof rt){let i=e.containingGroup;i!==null&&i.hasPlaceholder()&&!this.draggedParts.has(i)&&i.placeholder.c()}}}mayCopy(){if(!this.isCopyEnabled)return!1;let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowCopy||!(f.tr?t.lastInput.alt:t.lastInput.control))return!1;let e=t.selection.iterator;for(;e.next();)if(e.value.canCopy())return!0;return!!(this.draggedLink!==null&&this.dragsLink&&this.draggedLink.canCopy())}mayDragOut(){if(!this.isCopyEnabled)return!1;let t=this.diagram;if(!t.allowDragOut||!t.allowCopy||t.allowMove)return!1;let e=t.selection.iterator;for(;e.next();)if(e.value.canCopy())return!0;return!!(this.draggedLink!==null&&this.dragsLink&&this.draggedLink.canCopy())}mayMove(){let t=this.diagram;if(t.isReadOnly||!t.allowMove)return!1;let e=t.selection.iterator;for(;e.next();)if(e.value.canMove())return!0;return!!(this.draggedLink!==null&&this.dragsLink&&this.draggedLink.canMove())}eL(){Dt.zw.has(this)||Dt.zw.add(this)}static yF(){if(Dt.zw.count>0){let t=Dt.zw,e=t.length;for(let i=0;i<e;i++){let s=t.elt(i);s.JC(),s.kl(),s.MP(),s.diagram.stopAutoScroll()}t.clear()}}computeBorder(t,e,i){return!this.fu&&this.draggedParts!==null&&!this.draggedParts.has(t)?i.a(e):null}getDraggingSource(){return Dt.dt}mayDragIn(){let t=this.diagram;if(!t.allowDrop||t.isReadOnly||t.isModelReadOnly||!t.allowInsert)return!1;let e=Dt.dt;return!(e===null||e.diagram.model.dataFormat!==t.model.dataFormat)}doSimulatedDragEnter(){if(!this.mayDragIn())return;let t=this.diagram;t.animationManager.stopAnimation(),t.ur(),t.animationManager.stopAnimation();let e=Dt.dt;e!==null&&(this.diagram.du=!0,t.lastInput.event===null&&(t.lastInput.event=e.diagram.lastInput.event)),this.doUpdateCursor(null)}doSimulatedDragLeave(){let t=Dt.dt;t!==null&&t.doSimulatedDragOut(),this.diagram.du=!1,this.doCancel()}doSimulatedDragOver(){let t=this.diagram;t.animationManager.pu=!0;let e=Dt.dt;if(e!==null&&e.draggedParts!==null){if(!this.mayDragIn())return;this.sL(e.draggedParts.toKeySet(),!1,t.firstInput),this.pc(this.copiedParts,!1),this.DP(t.lastInput.documentPoint)}t.animationManager.pu=!1}doSimulatedDrop(){let t=this.diagram,e=Dt.dt;if(e!==null){let i=e.diagram;if(e.fu=!0,this.kl(),e.draggedParts===null||!this.mayDragIn())return;t.animationManager.pu=!0,t.D("ChangingSelection",t.selection),this.startTransaction("Drop"),this.sL(e.draggedParts.toKeySet(),!0,t.lastInput),this.pc(this.copiedParts,!1);let s=new I;this.copiedParts!==null&&(t.clearSelection(!0),this.copiedParts.iteratorKeys.each(n=>{n.isSelected=!0,s.add(n)})),this.iL(t.lastInput.documentPoint),t.invalidateDocumentBounds(),this.copiedParts!==null&&(this.transactionResult="ExternalCopy"),this.copiedParts=null,t.doFocus(),t.du=!1,t.D("ExternalObjectsDropped",s,i),this.stopTransaction(),t.D("ChangedSelection",t.selection)}t.animationManager.pu=!1}sL(t,e,i){if(this.copiedParts!==null)return;let s=this.diagram;if(s.isReadOnly||s.isModelReadOnly)return;s.skipsUndoManager=!e,s.partManager.addsToTemporaryLayer=!e,this.startPoint=i.documentPoint;let n=s.copyParts(t,s,!0),o=z.l();this.wF(t,o);let r=o.x+o.width/2,a=o.y+o.height/2;z.e(o);let h=this.gm,l=new pt,u=P.l(),c=t.iterator;for(;c.next();){let g=c.value;if(g instanceof _&&g.canCopy()){let p=n.get(g);if(p===null)continue;p.points=g.points,p.fr(h.x-r,h.y-a),p.suspendsRouting=!0,l.set(p,this.Es())}}let d=t.iterator;for(;d.next();){let g=d.value;if(g.ke()&&g.canCopy()){let p=n.get(g);if(p===null)continue;let m=g.location;u.i(h.x-(r-m.x),h.y-(a-m.y)),p.location=u,p.ensureBounds(),l.set(p,this.Es(u))}}if(P.e(u),this.copiedParts=l,this.SP(l.toKeySet()),this.draggedLink!==null){let g=this.draggedLink,p=g.routeBounds;g.fr(this.startPoint.x-(p.x+p.width/2),this.startPoint.y-(p.y+p.height/2))}this.doUpdateCursor(null)}pF(){this.isDragOutStarted=!0,this.fu=!1,Dt.dt=this,Dt.Yh=this.diagram,this.doSimulatedDragOut()}doSimulatedDragOut(){let t=this.diagram;!this.mayCopy()&&!this.mayMove()?t.currentCursor=this.nodropCursor:t.currentCursor="",this.uu=null}computeMove(t,e,i,s){let n=this.diagram;return n!==null?n.computeMove(t,e,this.dragOptions,s):new P}static zw=new j;static dt=null;static Yh=null}xe.prototype.doCancel=function(){Dt.dt!==null&&Dt.dt.doCancel(),ee.prototype.doCancel.call(this)};class Ge extends ee{IP;EP;Sl;UP;BP;Gh;VP;Kh;zP;XP;YP;GP;KP;jP;nL;HP;Ml;qP;constructor(){super(),this.IP=100,this.EP=!1,this.Sl="pointer",this.UP=new _({layerName:"Tool"}).add(new ut({isPanelMain:!0,stroke:"blue"}).theme("stroke","tempLink"),new ut({toArrow:"Standard",fill:"blue",stroke:"blue"}).theme("fill","tempLink").theme("stroke","tempLink")).Et(),this.Gh=new ut("Rectangle",{portId:"",fill:null,stroke:"magenta",strokeWidth:2,desiredSize:Q.Uk}).theme("stroke","tempPort"),this.BP=new rt({selectable:!1,layerName:"Tool"}).add(this.Gh).Et(),this.Kh=new ut("Rectangle",{portId:"",fill:null,stroke:"magenta",strokeWidth:2,desiredSize:Q.Uk}).theme("stroke","tempPort"),this.VP=new rt({selectable:!1,layerName:"Tool"}).add(this.Kh).Et(),this.zP=null,this.XP=null,this.YP=null,this.GP=null,this.KP=null,this.jP=!0,this.nL=new pt,this.HP=null,this.Ml=null,this.qP=null}doStop(){this.diagram.stopAutoScroll(),this.originalLink=null,this.originalFromNode=null,this.originalFromPort=null,this.originalToNode=null,this.originalToPort=null,this.validPortsCache.clear(),this.targetPort=null}get portGravity(){return this.IP}set portGravity(t){f.s(t,"number",Ge,"portGravity"),t>=0&&(this.IP=t)}get isUnconnectedLinkValid(){return this.EP}set isUnconnectedLinkValid(t){f.s(t,"boolean",Ge,"isUnconnectedLinkValid"),this.EP=t}get linkingCursor(){return this.Sl}set linkingCursor(t){this.Sl=t}get temporaryLink(){return this.UP}set temporaryLink(t){t.Et(),this.UP=t}get temporaryFromNode(){return this.BP}set temporaryFromNode(t){t.Et(),this.BP=t,t&&(this.Gh=t.port)}get temporaryFromPort(){return this.Gh}set temporaryFromPort(t){if(this.Gh!==null){let e=this.Gh.panel;if(e!==null){let i=e.C.indexOf(this.Gh);e.removeAt(i),e.insertAt(i,t)}}this.Gh=t}get temporaryToNode(){return this.VP}set temporaryToNode(t){t.Et(),this.VP=t,t&&(this.Kh=t.port)}get temporaryToPort(){return this.Kh}set temporaryToPort(t){if(this.Kh!==null){let e=this.Kh.panel;if(e!==null){let i=e.C.indexOf(this.Kh);e.removeAt(i),e.insertAt(i,t)}}this.Kh=t}get originalLink(){return this.zP}set originalLink(t){this.zP=t}get originalFromNode(){return this.XP}set originalFromNode(t){this.XP=t}get originalFromPort(){return this.YP}set originalFromPort(t){this.YP=t}get originalToNode(){return this.GP}set originalToNode(t){this.GP=t}get originalToPort(){return this.KP}set originalToPort(t){this.KP=t}get isForwards(){return this.jP}set isForwards(t){this.jP=t}get validPortsCache(){return this.nL}get targetPort(){return this.HP}set targetPort(t){this.HP=t}copyPortProperties(t,e,i,s,n){if(t===null||e===null||i===null||s===null)return;let o=e.getDocumentScale(),r=Q.l();r.width=e.naturalBounds.width*o,r.height=e.naturalBounds.height*o,s.desiredSize=r,Q.e(r),n?(s.toSpot=e.toSpot,s.toEndSegmentLength=e.toEndSegmentLength):(s.fromSpot=e.fromSpot,s.fromEndSegmentLength=e.fromEndSegmentLength),i.locationSpot=D.Center;let a=P.l();i.location=e.getDocumentPoint(D.Center,a),P.e(a),s.angle=e.getDocumentAngle(),this.portTargeted!==null&&this.portTargeted(t,e,i,s,n)}setNoTargetPortProperties(t,e,i){e!==null&&(e.desiredSize=Q.Uk,e.fromSpot=D.None,e.toSpot=D.None),t!==null&&(t.location=this.diagram.lastInput.documentPoint),this.portTargeted!==null&&this.portTargeted(null,null,t,e,i)}doMouseDown(){this.isActive&&this.doMouseMove()}doMouseMove(){if(this.isActive){let t=this.diagram;if(this.targetPort=this.findTargetPort(this.isForwards),this.targetPort!==null&&this.targetPort.part instanceof rt){let e=this.targetPort.part;this.isForwards?this.copyPortProperties(e,this.targetPort,this.temporaryToNode,this.temporaryToPort,!0):this.copyPortProperties(e,this.targetPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else this.isForwards?this.setNoTargetPortProperties(this.temporaryToNode,this.temporaryToPort,!0):this.setNoTargetPortProperties(this.temporaryFromNode,this.temporaryFromPort,!1);(t.allowHorizontalScroll||t.allowVerticalScroll)&&t.doAutoScroll(t.lastInput.viewPoint)}}findValidLinkablePort(t,e){if(t===null)return null;let i=t.part;if(!(i instanceof rt))return null;for(;t!==null;){let s=e?t.toLinkable:t.fromLinkable;if(s===!0&&(t.portId!==null||t instanceof rt)&&(e?this.isValidTo(i,t):this.isValidFrom(i,t)))return t;if(s===!1)return null;t=t.panel}return null}findTargetPort(t){let e=this.diagram,i=e.lastInput.documentPoint,s=this.portGravity,n=e.findObjectsNear(i,s,h=>this.findValidLinkablePort(h,t),null,!0),o=1/0,r=null,a=n.iterator;for(;a.next();){let h=a.value,l=h.part;if(!(l instanceof rt))continue;let u=h.getDocumentPoint(D.Center,P.l()),c=i.x-u.x,d=i.y-u.y;P.e(u);let g=c*c+d*d;if(g<o){let p=this.validPortsCache.get(h);p!==null?p&&(r=h,o=g):t&&this.isValidLink(this.originalFromNode,this.originalFromPort,l,h)||!t&&this.isValidLink(l,h,this.originalToNode,this.originalToPort)?(this.validPortsCache.set(h,!0),r=h,o=g):this.validPortsCache.set(h,!1)}}if(r!==null){let h=r.part;if(h instanceof rt&&(h.layer===null||h.layer.allowLink))return r}return null}isValidFrom(t,e){if(t===null||e===null)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(t.layer!==null&&!t.layer.allowLink||e.fromLinkable!==!0))return!1;let i=e.fromMaxLinks;if(i<1/0){if(this.originalLink!==null&&t===this.originalFromNode&&e===this.originalFromPort)return!0;let s=e.portId;if(s===null&&(s=""),t.findLinksOutOf(s).count>=i)return!1}return!0}isValidTo(t,e){if(t===null||e===null)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(t.layer!==null&&!t.layer.allowLink||e.toLinkable!==!0))return!1;let i=e.toMaxLinks;if(i<1/0){if(this.originalLink!==null&&t===this.originalToNode&&e===this.originalToPort)return!0;let s=e.portId;if(s===null&&(s=""),t.findLinksInto(s).count>=i)return!1}return!0}isInSameNode(t,e){if(t===null||e===null)return!1;if(t===e)return!0;let i=t.part,s=e.part;return i!==null&&i===s}isLinked(t,e){if(t===null||e===null)return!1;let i=t.part;if(!(i instanceof rt))return!1;let s=t.portId;s===null&&(s="");let n=e.part;if(!(n instanceof rt))return!1;let o=e.portId;o===null&&(o="");let r=n.findLinksInto(o);for(;r.next();){let a=r.value;if(a.fromNode===i&&a.fromPortId===s)return!0}return!1}isValidLink(t,e,i,s){if(!this.isValidFrom(t,e)||!this.isValidTo(i,s)||e!==null&&s!==null&&(!(e.fromLinkableSelfNode&&s.toLinkableSelfNode)&&this.isInSameNode(e,s)||!(e.fromLinkableDuplicates&&s.toLinkableDuplicates)&&this.isLinked(e,s))||this.originalLink!==null&&(t!==null&&this.isLabelDependentOnLink(t,this.originalLink)||i!==null&&this.isLabelDependentOnLink(i,this.originalLink))||t!==null&&i!==null&&(t.data===null&&i.data!==null||t.data!==null&&i.data===null)||!this.isValidCycle(t,i,this.originalLink))return!1;let n;return t!==null&&e!==null&&(n=t.linkValidation,n!==null&&!n(t,e,i,s,this.originalLink))||i!==null&&s!==null&&(n=i.linkValidation,n!==null&&!n(t,e,i,s,this.originalLink))?!1:(n=this.linkValidation,n!==null?n(t,e,i,s,this.originalLink):!0)}isLabelDependentOnLink(t,e){if(t===null)return!1;let i=t.labeledLink;if(i===null)return!1;if(i===e)return!0;let s=new I;return s.add(t),this.WP(i,e,s)}WP(t,e,i){if(t===e)return!0;let s=t.fromNode;if(s!==null&&s.labeledLink&&(i.add(s),this.WP(s.labeledLink,e,i)))return!0;let n=t.toNode;return!!(n!==null&&n.labeledLink&&(i.add(n),this.WP(n.labeledLink,e,i)))}isValidCycle(t,e,i){if(i===void 0&&(i=null),t===null||e===null)return this.isUnconnectedLinkValid;let s=this.diagram,n=1;if(s&&(s.model.pm()?n=s.isTreePathToChildren?5:6:n=s.validCycle),n===1)return!0;if(n===5){let o=i||this.temporaryLink;if(o!==null&&!o.isTreeLink)return!0;let r=e.linksConnected;for(;r.next();){let a=r.value;if(a!==i&&a.isTreeLink&&a.toNode===e)return!1}return!this.yu(t,e,i,!0)}else if(n===6){let o=i||this.temporaryLink;if(o!==null&&!o.isTreeLink)return!0;let r=t.linksConnected;for(;r.next();){let a=r.value;if(a!==i&&a.isTreeLink&&a.fromNode===t)return!1}return!this.yu(t,e,i,!0)}else{if(n===2)return!this.SF(t,e,i);if(n===3)return!this.yu(t,e,i,!1);if(n===4)return!this.MF(t,e,i)}return!0}yu(t,e,i,s){if(t===e)return!0;if(t===null||e===null)return!1;let n=t.linksConnected;for(;n.next();){let o=n.value;if(o===i||s&&!o.isTreeLink||o.toNode!==t)continue;let r=o.fromNode;if(!(r===t||r===null)&&this.yu(r,e,i,s))return!0}return!1}SF(t,e,i){if(t===e)return!0;let s=new I;return s.add(e),this.oL(s,t,e,i)}oL(t,e,i,s){if(e===i)return!0;if(e===null||i===null||t.has(e))return!1;t.add(e);let n=e.linksConnected;for(;n.next();){let o=n.value;if(o===s||o.toNode!==e)continue;let r=o.fromNode;if(!(r===e||r===null)&&this.oL(t,r,i,s))return!0}return!1}MF(t,e,i){if(t===e)return!0;let s=new I;return s.add(e),this.rL(s,t,e,i)}rL(t,e,i,s){if(e===i)return!0;if(e===null||i===null||t.has(e))return!1;t.add(e);let n=e.linksConnected;for(;n.next();){let o=n.value;if(o===s)continue;let r=o.fromNode,a=o.toNode,h=r===e?a:r;if(!(h===e||h===null)&&this.rL(t,h,i,s))return!0}return!1}get linkValidation(){return this.Ml}set linkValidation(t){t!==null&&f.k(t,Ge,"linkValidation"),this.Ml=t}get portTargeted(){return this.qP}set portTargeted(t){t!==null&&f.k(t,Ge,"portTargeted"),this.qP=t}}var yn=(x=>(x[x.Either=1]="Either",x[x.ForwardsOnly=2]="ForwardsOnly",x[x.BackwardsOnly=3]="BackwardsOnly",x))(yn||{});class Li extends Ge{JP;$P;b;ZP;constructor(t){super(),this.name="Linking",this.JP={},this.$P=null,this.b=1,this.ZP=null,t&&Object.assign(this,t)}static Either=1;static ForwardsOnly=2;static BackwardsOnly=3;get archetypeLinkData(){return this.JP}set archetypeLinkData(t){t!==null&&f.ec(t,Li,"archetypeLinkData"),this.JP=t}get archetypeLabelNodeData(){return this.$P}set archetypeLabelNodeData(t){t!==null&&f.ec(t,Li,"archetypeLabelNodeData"),this.$P=t}get direction(){return this.b}set direction(t){this.b=t}get startObject(){return this.ZP}set startObject(t){this.ZP=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||t.isModelReadOnly||!t.allowLink||!t.model.Xw()||!t.lastInput.left||t.currentTool!==this&&!this.isBeyondDragSize()?!1:this.findLinkablePort()!==null}findLinkablePort(){let t=this.diagram,e=this.startObject;if(e===null&&(e=t.findObjectAt(t.firstInput.documentPoint,null,null)),e===null)return null;let i=e.part;if(!(i instanceof rt))return null;let s=this.direction;if(s===1||s===2){let n=this.findValidLinkablePort(e,!1);if(n!==null)return this.isForwards=!0,n;if(this.startObject===i){let o=i.port;if(this.findValidLinkablePort(o,!1))return this.isForwards=!0,o}}if(s===1||s===3){let n=this.findValidLinkablePort(e,!0);if(n!==null)return this.isForwards=!1,n;if(this.startObject===i){let o=i.port;if(this.findValidLinkablePort(o,!0))return this.isForwards=!1,o}}return null}doActivate(){let t=this.diagram,e=this.findLinkablePort();if(e===null){this.stopTool();return}if(this.startTransaction(this.name),t.isMouseCaptured=!0,t.currentCursor=this.linkingCursor,this.isForwards){this.temporaryToNode!==null&&(this.temporaryToNode.location=t.lastInput.documentPoint),this.originalFromPort=e;let i=this.originalFromPort.part;i instanceof rt&&(this.originalFromNode=i),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else{this.temporaryFromNode!==null&&(this.temporaryFromNode.location=t.lastInput.documentPoint),this.originalToPort=e;let i=this.originalToPort.part;i instanceof rt&&(this.originalToNode=i),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)}t.add(this.temporaryFromNode),this.temporaryFromNode&&this.temporaryFromNode.ensureBounds(),t.add(this.temporaryToNode),this.temporaryToNode&&this.temporaryToNode.ensureBounds(),this.temporaryLink!==null&&(this.temporaryFromNode!==null&&(this.temporaryLink.fromNode=this.temporaryFromNode),this.temporaryToNode!==null&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.invalidateRoute(),t.add(this.temporaryLink)),this.isActive=!0}doDeactivate(){this.isActive=!1;let t=this.diagram;t.remove(this.temporaryLink),t.remove(this.temporaryFromNode),t.remove(this.temporaryToNode),t.isMouseCaptured=!1,t.currentCursor="",this.stopTransaction()}doStop(){super.doStop(),this.startObject=null}doMouseUp(){if(this.isActive){let t=this.diagram;this.transactionResult=null;let e=null,i=null,s=null,n=null,o=null;try{this.targetPort=this.findTargetPort(this.isForwards);let r=this.targetPort;if(r!==null){let a=r.part;a instanceof rt&&(this.isForwards?(this.originalFromNode!==null&&(e=this.originalFromNode,i=this.originalFromPort),s=a,n=r):(e=a,i=r,this.originalToNode!==null&&(s=this.originalToNode,n=this.originalToPort)))}else this.isForwards?this.originalFromNode!==null&&this.isUnconnectedLinkValid&&(e=this.originalFromNode,i=this.originalFromPort):this.originalToNode!==null&&this.isUnconnectedLinkValid&&(s=this.originalToNode,n=this.originalToPort);e!==null||s!==null?(o=this.insertLink(e,i,s,n),o!==null?(r===null&&(this.isForwards?o.defaultToPoint=t.lastInput.documentPoint:o.defaultFromPoint=t.lastInput.documentPoint),t.allowSelect&&(t.D("ChangingSelection",t.selection),t.clearSelection(!0),o.isSelected=!0),this.transactionResult=this.name,t.D("LinkDrawn",o)):this.doNoLink(e,i,s,n)):this.isForwards?this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),o&&t.allowSelect&&t.D("ChangedSelection",t.selection)}}}isNewTreeLink(){let t=this.archetypeLinkData;if(t===null)return!0;if(t instanceof _)return t.isTreeLink;let e=this.diagram;if(e===null)return!0;let i=e.partManager.getLinkCategoryForData(t),s=e.partManager.findLinkTemplateForCategory(i);return s!==null?s.isTreeLink:!0}insertLink(t,e,i,s){return this.diagram.partManager.insertLink(t,e,i,s)}doNoLink(t,e,i,s){}}class ys extends Ge{lL=null;hL=null;QP=null;_P=null;fs;tS;constructor(t){super(),this.name="Relinking",this.fromHandleArchetype=new ut("Diamond",{desiredSize:Q.nu,fill:"lightblue",stroke:"dodgerblue",cursor:this.linkingCursor,segmentIndex:0}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.toHandleArchetype=new ut("Diamond",{desiredSize:Q.nu,fill:"lightblue",stroke:"dodgerblue",cursor:this.linkingCursor,segmentIndex:-1}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.fs=null,this.tS=new z,t&&Object.assign(this,t)}updateAdornments(t){if(t===null||!(t instanceof _))return;let e="RelinkFrom",i=null;if(t.isSelected&&!this.diagram.isReadOnly){let s=t.selectionObject;s!==null&&t.canRelinkFrom()&&t.actualBounds.isReal()&&t.isVisible()&&s.actualBounds.isReal()&&s.isVisibleObject()&&(i=t.findAdornment(e),i===null&&(i=this.makeAdornment(s,!1),t.addAdornment(e,i)))}if(i===null&&t.removeAdornment(e),e="RelinkTo",i=null,t.isSelected&&!this.diagram.isReadOnly){let s=t.selectionObject;s!==null&&t.canRelinkTo()&&t.actualBounds.isReal()&&t.isVisible()&&s.actualBounds.isReal()&&s.isVisibleObject()&&(i=t.findAdornment(e),i===null?(i=this.makeAdornment(s,!0),t.addAdornment(e,i)):i.c())}i===null&&t.removeAdornment(e)}makeAdornment(t,e){let i=e?this._P:this.QP;return i&&(i=i.copy(),i.adornedObject=t),i}get fromHandleArchetype(){return this.lL}set fromHandleArchetype(t){this.lL=t,t!==null?this.QP=new St(H.Link).add(t).Et():this.QP=null}get toHandleArchetype(){return this.hL}set toHandleArchetype(t){this.hL=t,t!==null?this._P=new St(H.Link).add(t).Et():this._P=null}get handle(){return this.fs}set handle(t){t!==null&&(t.part instanceof St||f.o("new handle is not in an Adornment: "+t)),this.fs=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowRelink||!t.model.Xw()||!t.lastInput.left)return!1;let e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkFrom");return e===null&&(e=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkTo")),e!==null}doActivate(){let t=this.diagram;if(this.originalLink===null){let i=this.handle;if(i===null&&(i=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkFrom"),i===null&&(i=this.findToolHandleAt(t.firstInput.documentPoint,"RelinkTo"))),i===null)return;let s=i.part;if(!(s instanceof St)||!(s.adornedPart instanceof _))return;this.handle=i,this.isForwards=s===null||s.category==="RelinkTo",this.originalLink=s.adornedPart}let e=this.originalLink;e!==null&&(this.startTransaction(this.name),t.isMouseCaptured=!0,t.currentCursor=this.linkingCursor,this.originalFromPort=e.fromPort,this.originalFromNode=e.fromNode,this.originalToPort=e.toPort,this.originalToNode=e.toNode,this.tS.set(e.actualBounds),e.pointsCount>0&&(e.fromNode===null&&(this.temporaryFromPort!==null&&(this.temporaryFromPort.desiredSize=Q.sc),this.temporaryFromNode!==null&&(this.temporaryFromNode.location=e.getPoint(0))),e.toNode===null&&(this.temporaryToPort!==null&&(this.temporaryToPort.desiredSize=Q.sc),this.temporaryToNode!==null&&(this.temporaryToNode.location=e.getPoint(e.pointsCount-1)))),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0),t.add(this.temporaryFromNode),t.add(this.temporaryToNode),this.temporaryLink!==null&&(this.temporaryFromNode!==null&&(this.temporaryLink.fromNode=this.temporaryFromNode),this.temporaryToNode!==null&&(this.temporaryLink.toNode=this.temporaryToNode),this.copyLinkProperties(e,this.temporaryLink),this.temporaryLink.invalidateRoute(),t.add(this.temporaryLink)),this.isActive=!0)}copyLinkProperties(t,e){if(t===null||e===null)return;e.adjusting=t.adjusting,e.corner=t.corner;let i=t.curve;(i===11||i===10)&&(i=0),e.curve=i,e.curviness=t.curviness,e.isTreeLink=t.isTreeLink,e.points=t.points,e.routing=t.routing,e.smoothness=t.smoothness,e.fromSpot=t.fromSpot,e.fromEndSegmentLength=t.fromEndSegmentLength,e.fromShortLength=t.fromShortLength,e.toSpot=t.toSpot,e.toEndSegmentLength=t.toEndSegmentLength,e.toShortLength=t.toShortLength}doDeactivate(){this.isActive=!1;let t=this.diagram;t.remove(this.temporaryLink),t.remove(this.temporaryFromNode),t.remove(this.temporaryToNode),t.isMouseCaptured=!1,t.currentCursor="",this.stopTransaction()}doStop(){super.doStop(),this.handle=null}doMouseUp(){if(this.isActive){let t=this.diagram;this.transactionResult=null;let e=this.originalFromNode,i=this.originalFromPort,s=this.originalToNode,n=this.originalToPort,o=this.originalLink;try{if(this.targetPort=this.findTargetPort(this.isForwards),this.targetPort!==null){let r=this.targetPort.part;r instanceof rt&&(this.isForwards?(s=r,n=this.targetPort):(e=r,i=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?(s=null,n=null):(e=null,i=null):o=null;o!==null?(this.reconnectLink(o,this.isForwards?s:e,this.isForwards?n:i,this.isForwards),this.targetPort===null&&(this.isForwards?o.defaultToPoint=t.lastInput.documentPoint:o.defaultFromPoint=t.lastInput.documentPoint,o.invalidateRoute()),this.transactionResult=this.name,t.D("LinkRelinked",o,this.isForwards?this.originalToPort:this.originalFromPort)):this.originalLink!==null&&this.doNoRelink(this.originalLink,this.isForwards),this.originalLink!==null&&this.originalLink.invalidateOtherJumpOvers(this.tS)}finally{this.stopTool()}}}reconnectLink(t,e,i,s){let n=i!==null&&i.portId!==null?i.portId:"";return s?(t.toNode=e,t.toPortId=n):(t.fromNode=e,t.fromPortId=n),!0}doNoRelink(t,e){}doDraggingMouseMove(t,e,i,s){t!==null?(this.copyPortProperties(t,e,this.temporaryFromNode,this.temporaryFromPort,!1),this.diagram.add(this.temporaryFromNode)):this.diagram.remove(this.temporaryFromNode),i!==null?(this.copyPortProperties(i,s,this.temporaryToNode,this.temporaryToPort,!0),this.diagram.add(this.temporaryToNode)):this.diagram.remove(this.temporaryToNode)}stopDraggingMouseMove(){this.diagram.remove(this.temporaryFromNode),this.diagram.remove(this.temporaryToNode)}}var xn=(x=>(x[x.None=0]="None",x[x.Horizontal=1]="Horizontal",x[x.Vertical=2]="Vertical",x[x.All=3]="All",x))(xn||{});class Ji extends ee{dr;iS;eS;fs;Yw;sS;ym;constructor(t){super(),this.name="LinkReshaping",this.dr=new ut("Rectangle",{desiredSize:Q.yC,fill:"lightblue",stroke:"dodgerblue"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.iS=new ut("Diamond",{desiredSize:Q.nu,fill:"lightblue",stroke:"dodgerblue",cursor:"move"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.eS=3,this.fs=null,this.Yw=null,this.sS=new P,this.ym=new j,t&&Object.assign(this,t)}static None=0;static Horizontal=1;static Vertical=2;static All=3;getReshapingBehavior(t){return t?t.gr:0}setReshapingBehavior(t,e){t.gr=e}updateAdornments(t){if(t===null||!(t instanceof _))return;let e=null;if(t.isSelected&&!this.diagram.isReadOnly){let i=t.path;i!==null&&t.canReshape()&&t.actualBounds.isReal()&&t.isVisible()&&i.actualBounds.isReal()&&i.isVisibleObject()&&(e=t.findAdornment(this.name),(e===null||e.nS!==t.pointsCount||e.oS!==t.resegmentable)&&(e=this.makeAdornment(i),e!==null&&(e.nS=t.pointsCount,e.oS=t.resegmentable,t.addAdornment(this.name,e))))}e===null&&t.removeAdornment(this.name)}makeAdornment(t){let e=t.part,i=e.points,s=e.pointsCount,n=e.isOrthogonal,o=null;if(i!==null&&s>1){o=new St,o.type=H.Link;let r=e.firstPickIndex,a=e.lastPickIndex,h=n?1:0;if(e.resegmentable&&e.computeCurve()!==9)for(let l=r+h;l<a-h;l++){let u=this.makeResegmentHandle(t,l);u!==null&&(u.segmentIndex=l,u.segmentFraction=.5,u.fromMaxLinks=999,o.add(u))}for(let l=r+1;l<a;l++){let u=this.makeHandle(t,l);if(u!==null){if(u.segmentIndex=l,l!==r)if(l===r+1&&n){let c=e.getPoint(r),d=e.getPoint(r+1);L.f(c.x,d.x)&&L.f(c.y,d.y)?(d=e.getPoint(r-1),L.f(c.x,d.x)?(this.setReshapingBehavior(u,2),u.cursor="n-resize"):L.f(c.y,d.y)&&(this.setReshapingBehavior(u,1),u.cursor="w-resize")):L.f(c.x,d.x)?(this.setReshapingBehavior(u,2),u.cursor="n-resize"):L.f(c.y,d.y)&&(this.setReshapingBehavior(u,1),u.cursor="w-resize")}else if(l===a-1&&n){let c=e.getPoint(a-1),d=e.getPoint(a);L.f(c.x,d.x)&&L.f(c.y,d.y)?(c=e.getPoint(a+1),L.f(c.x,d.x)?(this.setReshapingBehavior(u,2),u.cursor="n-resize"):L.f(c.y,d.y)&&(this.setReshapingBehavior(u,1),u.cursor="w-resize")):L.f(c.x,d.x)?(this.setReshapingBehavior(u,2),u.cursor="n-resize"):L.f(c.y,d.y)&&(this.setReshapingBehavior(u,1),u.cursor="w-resize")}else l===a||(this.setReshapingBehavior(u,3),u.cursor="move");o.add(u)}}o.adornedObject=t}return o}makeHandle(t,e){let i=this.handleArchetype;return i===null?null:i.copy().rS()}get handleArchetype(){return this.dr}set handleArchetype(t){this.dr=t}makeResegmentHandle(t,e){let i=this.midHandleArchetype;return i===null?null:i.copy().rS()}get midHandleArchetype(){return this.iS}set midHandleArchetype(t){this.iS=t}get handle(){return this.fs}set handle(t){t!==null&&(t.part instanceof St||f.o("new handle is not in an Adornment: "+t)),this.fs=t}get adornedLink(){return this.Yw}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||!t.allowReshape||!t.lastInput.left?!1:this.findToolHandleAt(t.firstInput.documentPoint,this.name)!==null}doActivate(){let t=this.diagram;if(this.handle===null&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),this.handle===null)return;let e=this.handle.part.adornedPart;if(e instanceof _){if(this.Yw=e,t.isMouseCaptured=!0,this.startTransaction(this.name),e.resegmentable&&this.handle.fromMaxLinks===999){let i=e.points.copy(),s=this.getResegmentingPoint();if(i.insertAt(this.handle.segmentIndex+1,s),e.isOrthogonal&&i.insertAt(this.handle.segmentIndex+1,s),e.points=i,e.invalidateAdornments(),e.updateAdornments(),this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name),this.handle===null){this.doDeactivate();return}}this.sS=e.getPoint(this.handle.segmentIndex),this.ym=e.points.copy(),this.isActive=!0}}doDeactivate(){this.stopTransaction(),this.handle=null,this.Yw=null;let t=this.diagram;t.isMouseCaptured=!1,this.isActive=!1}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}doCancel(){let t=this.adornedLink;t!==null&&(t.points=this.ym),this.stopTool()}getResegmentingPoint(){return this.handle===null?this.diagram.lastInput.documentPoint:this.handle.getDocumentPoint(D.Center)}doMouseMove(){let t=this.diagram;if(this.isActive){let e=this.computeReshape(t.lastInput.documentPoint);this.reshape(e)}}doMouseUp(){let t=this.diagram;if(this.isActive){let e=this.computeReshape(t.lastInput.documentPoint);this.reshape(e);let i=this.adornedLink;if(i!==null&&i.resegmentable&&this.handle!==null){let s=this.handle.segmentIndex,n=i.getPoint(s-1),o=i.getPoint(s),r=i.getPoint(s+1);if(i.isOrthogonal){if(s>i.firstPickIndex+1&&s<i.lastPickIndex-1){let a=i.getPoint(s-2);if(this.isWithinResegmentingDistance(n,o)&&(this.isInLineOrtho(a,n,o,r,!0)||this.isInLineOrtho(a,n,o,r,!1))){let h=i.points.copy();this.isInLineOrtho(a,n,o,r,!0)?(h.setElt(s-2,new P(a.x,(r.y+a.y)/2)),h.setElt(s+1,new P(r.x,(r.y+a.y)/2))):(h.setElt(s-2,new P((r.x+a.x)/2,a.y)),h.setElt(s+1,new P((r.x+a.x)/2,r.y))),h.removeAt(s),h.removeAt(s-1),i.points=h,i.invalidateAdornments()}else if(a=i.getPoint(s+2),this.isWithinResegmentingDistance(o,r)&&(this.isInLineOrtho(n,o,r,a,!0)||this.isInLineOrtho(n,o,r,a,!1))){let h=i.points.copy();this.isInLineOrtho(n,o,r,a,!0)?(h.setElt(s-1,new P(n.x,(n.y+a.y)/2)),h.setElt(s+2,new P(a.x,(n.y+a.y)/2))):(h.setElt(s-1,new P((n.x+a.x)/2,n.y)),h.setElt(s+2,new P((n.x+a.x)/2,a.y))),h.removeAt(s+1),h.removeAt(s),i.points=h,i.invalidateAdornments()}}}else{let a=P.l();if(L.dl(n.x,n.y,r.x,r.y,o.x,o.y,a)&&a.distanceSquaredPoint(o)<this.resegmentingDistance*this.resegmentingDistance){let h=i.points.copy();h.removeAt(s),i.points=h,i.invalidateAdornments()}P.e(a)}}t.invalidateDocumentBounds(),this.transactionResult=this.name,t.D("LinkReshaped",this.adornedLink,this.ym)}this.stopTool()}isWithinResegmentingDistance(t,e){return Math.abs(t.x-e.x)<this.resegmentingDistance&&Math.abs(t.y-e.y)<this.resegmentingDistance}isInLineOrtho(t,e,i,s,n){return n?Math.abs(t.y-e.y)<this.resegmentingDistance&&Math.abs(e.y-i.y)<this.resegmentingDistance&&Math.abs(i.y-s.y)<this.resegmentingDistance:Math.abs(t.x-e.x)<this.resegmentingDistance&&Math.abs(e.x-i.x)<this.resegmentingDistance&&Math.abs(i.x-s.x)<this.resegmentingDistance}get resegmentingDistance(){return this.eS}set resegmentingDistance(t){f.s(t,"number",Ji,"resegmentingDistance"),this.eS=t}reshape(t){let e=this.adornedLink;if(e===null)return;let i=this.handle;if(i===null)return;e.startRoute();let s=i.segmentIndex,n=this.getReshapingBehavior(i);if(e.isOrthogonal)if(s===e.firstPickIndex+1){let o=e.firstPickIndex+1;n===2?(e.setPointAt(o,e.getPoint(o-1).x,t.y),e.setPointAt(o+1,e.getPoint(o+2).x,t.y)):n===1&&(e.setPointAt(o,t.x,e.getPoint(o-1).y),e.setPointAt(o+1,t.x,e.getPoint(o+2).y))}else if(s===e.lastPickIndex-1){let o=e.lastPickIndex-1;n===2?(e.setPointAt(o-1,e.getPoint(o-2).x,t.y),e.setPointAt(o,e.getPoint(o+1).x,t.y)):n===1&&(e.setPointAt(o-1,t.x,e.getPoint(o-2).y),e.setPointAt(o,t.x,e.getPoint(o+1).y))}else{let o=s,r=e.getPoint(o),a=e.getPoint(o-1),h=e.getPoint(o+1);L.f(a.x,r.x)&&L.f(r.y,h.y)?(L.f(a.x,e.getPoint(o-2).x)&&!L.f(a.y,e.getPoint(o-2).y)?(e.insertPointAt(o,t.x,a.y),s++,o++):e.setPointAt(o-1,t.x,a.y),L.f(h.y,e.getPoint(o+2).y)&&!L.f(h.x,e.getPoint(o+2).x)?e.insertPointAt(o+1,h.x,t.y):e.setPointAt(o+1,h.x,t.y)):L.f(a.y,r.y)&&L.f(r.x,h.x)?(L.f(a.y,e.getPoint(o-2).y)&&!L.f(a.x,e.getPoint(o-2).x)?(e.insertPointAt(o,a.x,t.y),s++,o++):e.setPointAt(o-1,a.x,t.y),L.f(h.x,e.getPoint(o+2).x)&&!L.f(h.y,e.getPoint(o+2).y)?e.insertPointAt(o+1,t.x,h.y):e.setPointAt(o+1,t.x,h.y)):L.f(a.x,r.x)&&L.f(r.x,h.x)?(L.f(a.x,e.getPoint(o-2).x)&&!L.f(a.y,e.getPoint(o-2).y)?(e.insertPointAt(o,t.x,a.y),s++,o++):e.setPointAt(o-1,t.x,a.y),L.f(h.x,e.getPoint(o+2).x)&&!L.f(h.y,e.getPoint(o+2).y)?e.insertPointAt(o+1,t.x,h.y):e.setPointAt(o+1,t.x,h.y)):L.f(a.y,r.y)&&L.f(r.y,h.y)&&(L.f(a.y,e.getPoint(o-2).y)&&!L.f(a.x,e.getPoint(o-2).x)?(e.insertPointAt(o,a.x,t.y),s++,o++):e.setPointAt(o-1,a.x,t.y),L.f(h.y,e.getPoint(o+2).y)&&!L.f(h.x,e.getPoint(o+2).x)?e.insertPointAt(o+1,h.x,t.y):e.setPointAt(o+1,h.x,t.y)),e.setPointAt(s,t.x,t.y)}else{e.setPointAt(s,t.x,t.y);let o=e.fromNode,r=e.fromPort;if(o!==null){let l=o.findVisibleNode();l!==null&&l!==o&&(o=l,r=o.port)}if(s===1&&r!==null&&e.computeSpot(!0,r).isNoSpot()){let l=r.getDocumentPoint(D.Center,P.l()),u=e.getLinkPointFromPoint(o,r,l,t,!0,P.l());e.setPointAt(0,u.x,u.y),P.e(l),P.e(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(D.Center,P.l()),u=e.getLinkPointFromPoint(a,h,l,t,!1,P.l());e.setPointAt(e.pointsCount-1,u.x,u.y),P.e(l),P.e(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.sS}get originalPoints(){return this.ym}}class Ti extends ee{pr;yr;Po;yc;lS;us;dr;fs;wm;hS;wc;Gw;Kw;jw;constructor(t){super(),this.name="Resizing",this.pr=new Q(1,1).u(),this.yr=new Q(9999,9999).u(),this.Po=new Q(NaN,NaN).u(),this.yc=!1,this.lS=!0,this.us=null,this.dr=new ut("Rectangle",{alignmentFocus:D.Center,desiredSize:Q.yC,fill:"lightblue",stroke:"dodgerblue",strokeWidth:1,cursor:"pointer"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.fs=null,this.wm=new P,this.hS=new Q,this.wc=new P,this.Gw=new Q(0,0),this.Kw=new Q(1/0,1/0),this.jw=new Q(1,1),t&&Object.assign(this,t)}updateAdornments(t){if(!(t===null||t instanceof _)){if(t.isSelected&&!this.diagram.isReadOnly){let e=t.resizeObject,i=t.findAdornment(this.name);if(e!==null&&t.canResize()&&t.actualBounds.isReal()&&t.isVisible()&&e.actualBounds.isReal()&&e.isVisibleObject()&&((i===null||i.adornedObject!==e)&&(i=this.makeAdornment(e)),i!==null)){let s=e.getDocumentAngle();t.Nl()&&this.updateResizeHandles(i,s),t.addAdornment(this.name,i);return}}t.removeAdornment(this.name)}}makeAdornment(t){let e=null,i=t.part?.resizeAdornmentTemplate;if(i){if(e=i.copy(),e===null)return null}else{e=new St,e.type=H.Spot,e.locationSpot=D.Center;let s=new ve;s.isPanelMain=!0,e.add(s);let n=this.makeHandle(t,D.TopLeft);n!==null&&e.add(n),n=this.makeHandle(t,D.TopRight),n!==null&&e.add(n),n=this.makeHandle(t,D.BottomRight),n!==null&&e.add(n),n=this.makeHandle(t,D.BottomLeft),n!==null&&e.add(n),n=this.makeHandle(t,D.MiddleTop),n!==null&&e.add(n),n=this.makeHandle(t,D.MiddleRight),n!==null&&e.add(n),n=this.makeHandle(t,D.MiddleBottom),n!==null&&e.add(n),n=this.makeHandle(t,D.MiddleLeft),n!==null&&e.add(n)}return e.adornedObject=t,e}makeHandle(t,e){let i=this.handleArchetype;if(i===null)return null;let s=i.copy().rS();return s.alignment=e,s}updateResizeHandles(t,e){if(t!==null){if(!t.alignment.isDefault()&&(t.cursor==="pointer"||t.cursor.indexOf("resize")>0))this.NF(t,e);else if(t instanceof H){let i=t.elements;for(;i.next();){let s=i.value;this.updateResizeHandles(s,e)}}}}NF(t,e){let i=t.alignment;i.isNoSpot()&&(i=D.Center);let s=e;if(i.x<=0)i.y<=0?s+=225:i.y>=1?s+=135:s+=180;else if(i.x>=1)i.y<=0?s+=315:i.y>=1&&(s+=45);else if(i.y<=0)s+=270;else if(i.y>=1)s+=90;else return;s<0?s+=360:s>=360&&(s-=360),s<22.5?t.cursor="e-resize":s<67.5?t.cursor="se-resize":s<112.5?t.cursor="s-resize":s<157.5?t.cursor="sw-resize":s<202.5?t.cursor="w-resize":s<247.5?t.cursor="nw-resize":s<292.5?t.cursor="n-resize":s<337.5?t.cursor="ne-resize":t.cursor="e-resize"}get handleArchetype(){return this.dr}set handleArchetype(t){this.dr=t}get handle(){return this.fs}set handle(t){t!==null&&(t.part instanceof St||f.o("new handle is not in an Adornment: "+t)),this.fs=t}get adornedObject(){return this.us}set adornedObject(t){t!==null&&t.part instanceof St&&f.o("new handle must not be in an Adornment: "+t),this.us=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||!t.allowResize||!t.lastInput.left?!1:this.findToolHandleAt(t.firstInput.documentPoint,this.name)!==null}doActivate(){let t=this.diagram;this.handle===null&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),this.handle!==null&&(this.adornedObject=this.handle.part.adornedObject,this.adornedObject!==null&&this.adornedObject.part!==null&&(t.isMouseCaptured=!0,t.animationManager.stopAnimation(),t.gu=!0,this.startTransaction(this.name),this.wm.set(this.adornedObject.getDocumentPoint(this.handle.alignment.opposite())),this.wc.set(this.adornedObject.part.location),this.hS.set(this.adornedObject.desiredSize),this.jw=this.computeCellSize(),this.Gw=this.computeMinSize(),this.Kw=this.computeMaxSize(),this.isActive=!0))}doDeactivate(){let t=this.diagram;t.gu=!1,t.bl=!0,this.stopTransaction(),this.handle=null,this.us=null,t.isMouseCaptured=!1,this.isActive=!1}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}doCancel(){this.adornedObject!==null&&this.adornedObject.part!==null&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation),this.stopTool()}doMouseMove(){let t=this.diagram;if(!this.isActive||this.adornedObject===null||this.handle===null)return;let e=this.Gw,i=this.Kw,s=this.jw,n=t.lastInput.documentPoint,o=this.adornedObject.getLocalPoint(n,P.l()),r=this.computeReshape(),a=this.computeResize(o,this.handle.alignment,e,i,s,r);this.resize(a),t.maybeUpdate(),P.e(o)}doMouseUp(){let t=this.diagram;if(this.isActive&&this.adornedObject!==null&&this.handle!==null){let e=this.Gw,i=this.Kw,s=this.jw,n=this.adornedObject.getLocalPoint(t.lastInput.documentPoint,P.l()),o=this.computeReshape(),r=this.computeResize(n,this.handle.alignment,e,i,s,o);this.resize(r),P.e(n),t.invalidateDocumentBounds(),this.transactionResult=this.name,t.D("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()}resize(t){let e=this.diagram,i=this.adornedObject;if(i===null)return;i.desiredSize=t.size;let s=i.part;if(s===null||this.handle===null)return;s.ensureBounds();let n=i.getDocumentPoint(this.handle.alignment.opposite());if(s instanceof ft){let o=new j;o.add(s);let r;!this.dragsMembers&&!s.hasPlaceholder()&&(r=new Qi,r.dragsMembers=!1),e.moveParts(o,this.oppositePoint.copy().subtract(n),!0,r)}else s.location=s.location.copy().subtract(n).add(this.oppositePoint);e.maybeUpdate()}computeResize(t,e,i,s,n,o){if(this.adornedObject===null)return z.Fg;e.isNoSpot()&&(e=D.Center);let r=this.adornedObject.naturalBounds,a=r.x,h=r.y,l=r.x+r.width,u=r.y+r.height,c=1;if(!o){let p=r.width,m=r.height;p<=0&&(p=1),m<=0&&(m=1),c=m/p}let d=P.l();L.Dg(t.x,t.y,a,h,n.width,n.height,d);let g=r.copy();return e.x<=0?e.y<=0?(g.x=Math.max(d.x,l-s.width),g.x=Math.min(g.x,l-i.width),g.width=Math.max(l-g.x,i.width),g.y=Math.max(d.y,u-s.height),g.y=Math.min(g.y,u-i.height),g.height=Math.max(u-g.y,i.height),o||(g.height/g.width>=1?(g.height=Math.max(Math.min(c*g.width,s.height),i.height),g.width=g.height/c):(g.width=Math.max(Math.min(g.height/c,s.width),i.width),g.height=c*g.width),g.x=l-g.width,g.y=u-g.height)):e.y>=1?(g.x=Math.max(d.x,l-s.width),g.x=Math.min(g.x,l-i.width),g.width=Math.max(l-g.x,i.width),g.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(g.height/g.width>=1?(g.height=Math.max(Math.min(c*g.width,s.height),i.height),g.width=g.height/c):(g.width=Math.max(Math.min(g.height/c,s.width),i.width),g.height=c*g.width),g.x=l-g.width)):(g.x=Math.max(d.x,l-s.width),g.x=Math.min(g.x,l-i.width),g.width=l-g.x,o||(g.height=Math.max(Math.min(c*g.width,s.height),i.height),g.width=g.height/c,g.y=h+.5*(u-h-g.height))):e.x>=1?e.y<=0?(g.width=Math.max(Math.min(d.x-a,s.width),i.width),g.y=Math.max(d.y,u-s.height),g.y=Math.min(g.y,u-i.height),g.height=Math.max(u-g.y,i.height),o||(g.height/g.width>=1?(g.height=Math.max(Math.min(c*g.width,s.height),i.height),g.width=g.height/c):(g.width=Math.max(Math.min(g.height/c,s.width),i.width),g.height=c*g.width),g.y=u-g.height)):e.y>=1?(g.width=Math.max(Math.min(d.x-a,s.width),i.width),g.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(g.height/g.width>=1?(g.height=Math.max(Math.min(c*g.width,s.height),i.height),g.width=g.height/c):(g.width=Math.max(Math.min(g.height/c,s.width),i.width),g.height=c*g.width))):(g.width=Math.max(Math.min(d.x-a,s.width),i.width),o||(g.height=Math.max(Math.min(c*g.width,s.height),i.height),g.width=g.height/c,g.y=h+.5*(u-h-g.height))):e.y<=0?(g.y=Math.max(d.y,u-s.height),g.y=Math.min(g.y,u-i.height),g.height=u-g.y,o||(g.width=Math.max(Math.min(g.height/c,s.width),i.width),g.height=c*g.width,g.x=a+.5*(l-a-g.width))):e.y>=1&&(g.height=Math.max(Math.min(d.y-h,s.height),i.height),o||(g.width=Math.max(Math.min(g.height/c,s.width),i.width),g.height=c*g.width,g.x=a+.5*(l-a-g.width))),P.e(d),g}computeReshape(){let t=0;return this.adornedObject instanceof ut&&(t=this.adornedObject.aS()),!(t===6||this.diagram.lastInput.shift)}computeMinSize(){if(this.adornedObject===null)return Q.sc;let t=this.adornedObject.minSize.copy(),e=this.minSize;return!isNaN(e.width)&&e.width>t.width&&(t.width=e.width),!isNaN(e.height)&&e.height>t.height&&(t.height=e.height),t}computeMaxSize(){if(this.adornedObject===null)return Q.Bk;let t=this.adornedObject.maxSize.copy(),e=this.maxSize;return!isNaN(e.width)&&e.width<t.width&&(t.width=e.width),!isNaN(e.height)&&e.height<t.height&&(t.height=e.height),t}computeCellSize(){let t=new Q(NaN,NaN),e=this.adornedObject?.part;if(e){let n=e.resizeCellSize;!isNaN(n.width)&&n.width>0&&(t.width=n.width),!isNaN(n.height)&&n.height>0&&(t.height=n.height)}let i=this.cellSize;isNaN(t.width)&&!isNaN(i.width)&&i.width>0&&(t.width=i.width),isNaN(t.height)&&!isNaN(i.height)&&i.height>0&&(t.height=i.height);let s=this.diagram;if((isNaN(t.width)||isNaN(t.height))&&s){let n=s.grid;n!==null&&n.visible&&this.isGridSnapEnabled&&(i=n.gridCellSize,isNaN(t.width)&&!isNaN(i.width)&&i.width>0&&(t.width=i.width),isNaN(t.height)&&!isNaN(i.height)&&i.height>0&&(t.height=i.height))}return(isNaN(t.width)||t.width===0||t.width===1/0)&&(t.width=1),(isNaN(t.height)||t.height===0||t.height===1/0)&&(t.height=1),t}get minSize(){return this.pr}set minSize(t){if(!this.pr.equals(t)){let e=t.width;isNaN(e)&&(e=0);let i=t.height;isNaN(i)&&(i=0),this.pr.i(e,i)}}get maxSize(){return this.yr}set maxSize(t){if(!this.yr.equals(t)){let e=t.width;isNaN(e)&&(e=1/0);let i=t.height;isNaN(i)&&(i=1/0),this.yr.i(e,i)}}get cellSize(){return this.Po}set cellSize(t){this.Po.equals(t)||this.Po.a(t)}get isGridSnapEnabled(){return this.yc}set isGridSnapEnabled(t){f.s(t,"boolean",Ti,"isGridSnapEnabled"),this.yc=t}get dragsMembers(){return this.lS}set dragsMembers(t){f.s(t,"boolean",Ti,"dragsMembers"),this.lS=t}get oppositePoint(){return this.wm}set oppositePoint(t){this.wm.equals(t)||this.wm.a(t)}get originalDesiredSize(){return this.hS}get originalLocation(){return this.wc}}class si extends ee{cS;fS;us=null;dr=null;Hw=null;fs=null;uS;xm;wc;dS;gS;constructor(t){super(),this.name="Rotating",this.cS=45,this.fS=2,this.wc=new P,this.us=null,this.handleArchetype=new ut("Ellipse",{desiredSize:Q.nu,fill:"lightblue",stroke:"dodgerblue",strokeWidth:1,cursor:"pointer"}).theme("fill","adornmentFill").theme("stroke","adornmentStroke"),this.fs=null,this.uS=0,this.xm=new P(NaN,NaN),this.dS=0,this.gS=50,t&&Object.assign(this,t)}updateAdornments(t){if(t!==null){if(t.Cl()){let e=t.rotateObject;if(e===t||e===t.path||e.isPanelMain)return}if(t.isSelected&&!this.diagram.isReadOnly){let e=t.rotateObject;if(e!==null&&t.canRotate()&&t.actualBounds.isReal()&&t.isVisible()&&e.actualBounds.isReal()&&e.isVisibleObject()){let i=t.findAdornment(this.name);if((i===null||i.adornedObject!==e)&&(i=this.makeAdornment(e)),i!==null){i.angle=e.getDocumentAngle(),i.hasPlaceholder()||(i.location=this.computeAdornmentLocation(e)),t.addAdornment(this.name,i);return}}}t.removeAdornment(this.name)}}makeAdornment(t){let e=null,i=t.part?.rotateAdornmentTemplate;return i?e=i.copy():this.Hw!==null&&(e=this.Hw.copy()),e===null?null:(e.adornedObject=t,e)}get handleArchetype(){return this.dr}set handleArchetype(t){this.dr=t,t!==null?this.Hw=new St(H.Position,{locationSpot:D.Center}).add(t).Et():this.Hw=null}get handle(){return this.fs}set handle(t){t!==null&&(t.part instanceof St||f.o("new handle is not in an Adornment: "+t)),this.fs=t}get adornedObject(){return this.us}set adornedObject(t){t!==null&&t.part instanceof St&&f.o("new handle must not be in an Adornment: "+t),this.us=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return t.isReadOnly||!t.allowRotate||!t.lastInput.left?!1:this.findToolHandleAt(t.firstInput.documentPoint,this.name)!==null}doActivate(){let t=this.diagram;if(this.adornedObject===null){if(this.handle===null&&(this.handle=this.findToolHandleAt(t.firstInput.documentPoint,this.name)),this.handle===null)return;this.adornedObject=this.handle.part.adornedObject}this.adornedObject===null||this.adornedObject.part===null||(t.isMouseCaptured=!0,t.delaysLayout=!0,this.startTransaction(this.name),this.uS=this.adornedObject.angle,this.xm=this.computeRotationPoint(this.adornedObject),this.wc=this.adornedObject.part.location.copy(),this.isActive=!0)}computeRotationPoint(t){let e=t.part;if(e!==null){let i=e.locationObject;if(e.rotationSpot.isSpot())return t.getDocumentPoint(e.rotationSpot);if(t===e||t===i)return i.getDocumentPoint(e.locationSpot)}return t.getDocumentPoint(D.Center)}computeAdornmentLocation(t){let e=this.rotationPoint;e.isReal()||(e=this.computeRotationPoint(t));let i=t.getLocalPoint(e),s=this.handleAngle;s<0?s+=360:s>=360&&(s-=360),s=Math.round(Math.round(s/45)*45);let n=this.handleDistance;return s===0?i.x=t.naturalBounds.width+n:s===45?(i.x=t.naturalBounds.width+n,i.y=t.naturalBounds.height+n):s===90?i.y=t.naturalBounds.height+n:s===135?(i.x=-n,i.y=t.naturalBounds.height+n):s===180?i.x=-n:s===225?(i.x=-n,i.y=-n):s===270?i.y=-n:s===315&&(i.x=t.naturalBounds.width+n,i.y=-n),t.getDocumentPoint(i)}doDeactivate(){let t=this.diagram;this.stopTransaction(),this.handle=null,this.us=null,this.xm=new P(NaN,NaN),t.isMouseCaptured=!1,this.isActive=!1}stopTransaction(){let t=this.diagram,e=super.stopTransaction();return e&&t.undoManager.transactionToUndo!==null&&t.undoManager.transactionToUndo.optimize(),e}doCancel(){let t=this.diagram;t.delaysLayout=!1,this.rotate(this.originalAngle),this.stopTool()}doMouseMove(){let t=this.diagram;if(this.isActive){let e=this.computeRotate(t.lastInput.documentPoint);this.rotate(e)}}doMouseUp(){let t=this.diagram;if(this.isActive){t.delaysLayout=!1;let e=this.computeRotate(t.lastInput.documentPoint);this.rotate(e),t.invalidateDocumentBounds(),this.transactionResult=this.name,t.D("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()}rotate(t){let e=this.adornedObject;if(e===null||e.part===null)return;e.angle=t;let i=e.part;i.ensureBounds();let s=i.locationObject,n=i.rotateObject;if(s===n||s.isContainedBy(n)){let o=this.wc.copy();i.location=o.subtract(this.rotationPoint).rotate(t-this.originalAngle).add(this.rotationPoint)}this.diagram.maybeUpdate()}computeRotate(t){let e=this.rotationPoint.directionPoint(t)-this.handleAngle,i=this.adornedObject?.panel;i&&(e-=i.getDocumentAngle()),e>=360?e-=360:e<0&&(e+=360);let s=Math.min(Math.abs(this.snapAngleMultiple),180),n=Math.min(Math.abs(this.snapAngleEpsilon),s/2);return!this.diagram.lastInput.shift&&s>0&&n>0&&(e%s<n?e=Math.floor(e/s)*s:e%s>s-n&&(e=(Math.floor(e/s)+1)*s)),e>=360?e-=360:e<0&&(e+=360),e}get snapAngleMultiple(){return this.cS}set snapAngleMultiple(t){f.s(t,"number",si,"snapAngleMultiple"),this.cS=t}get snapAngleEpsilon(){return this.fS}set snapAngleEpsilon(t){f.s(t,"number",si,"snapAngleEpsilon"),this.fS=t}get originalAngle(){return this.uS}get rotationPoint(){return this.xm}set rotationPoint(t){this.xm=t.copy()}get handleAngle(){return this.dS}set handleAngle(t){f.s(t,"number",si,"handleAngle"),this.dS=t}get handleDistance(){return this.gS}set handleDistance(t){f.s(t,"number",si,"handleDistance"),this.gS=t}}class wn extends ee{constructor(t){super(),this.name="ClickSelecting",t&&Object.assign(this,t)}canStart(){return!(!this.isEnabled||this.isBeyondDragSize())}doMouseUp(){this.isActive&&(this.standardMouseSelect(),this.standardMouseClick()||this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip()),this.stopTool()}}class bn extends ee{xc;constructor(t){super(),this.name="Action",this.xc=null,t&&Object.assign(this,t)}canStart(){if(!this.isEnabled)return!1;let t=this.diagram,e=t.lastInput,i=t.findObjectAt(e.documentPoint,s=>{for(;s.panel!==null;){if(s.isActionable)return s;s=s.panel}return s});return i!==null&&i.isActionable?(this.xc=i,t.gc=t.findObjectAt(e.documentPoint,null,null),!0):!1}doMouseDown(){if(!this.isActive)this.canStart()&&this.doActivate();else{let t=this.diagram.lastInput,e=this.xc;if(e===null)return;t.targetObject=e,e.actionDown!==null&&e.actionDown(t,e)}}doMouseMove(){if(this.isActive){let t=this.diagram.lastInput,e=this.xc;if(e===null)return;t.targetObject=e,e.actionMove!==null&&e.actionMove(t,e)}}doMouseUp(){if(this.isActive){let t=this.diagram.lastInput,e=this.xc;if(e===null)return;t.targetObject=e,e.actionUp!==null&&e.actionUp(t,e),this.standardMouseClick(i=>{for(;i.panel!==null;){if(i.isActionable&&i===e)return i;i=i.panel}return i},i=>i===e)}this.stopTool()}doCancel(){let t=this.diagram.lastInput,e=this.xc;e!==null&&(t.targetObject=e,e.actionCancel!==null&&e.actionCancel(t,e),this.stopTool())}doStop(){this.xc=null}}class di extends ee{Ll;mS;yc;pS;constructor(t){super(),this.name="ClickCreating",this.Ll=null,this.mS=!0,this.yc=!1,this.pS=new P(0,0),t&&Object.assign(this,t)}canStart(){if(!this.isEnabled||this.archetypeNodeData===null)return!1;let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.lastInput.left||this.isBeyondDragSize())return!1;if(this.isDoubleClick){if(t.lastInput.clickCount===1&&(this.pS=t.lastInput.viewPoint.copy()),t.lastInput.clickCount!==2||this.isBeyondDragSize(this.pS))return!1}else if(t.lastInput.clickCount!==1)return!1;return!(t.currentTool!==this&&t.findPartAt(t.lastInput.documentPoint,!0)!==null)}doMouseUp(){let t=this.diagram;this.isActive&&this.insertPart(t.lastInput.documentPoint),this.stopTool()}insertPart(t){let e=this.diagram,i=this.archetypeNodeData;if(i===null)return null;let s=null;try{if(e.D("ChangingSelection",e.selection),this.startTransaction(this.name),i instanceof Nt)i.ke()&&(i.Et(),s=i.copy(),s!==null&&e.add(s));else if(i!==null){let n=e.model.copyNodeData(i);f.G(n)&&(e.model.addNodeData(n),s=e.findPartForData(n))}if(s!==null){let n=P.V(t.x,t.y);this.isGridSnapEnabled&&this.diagram.yS(s,t,n),s.location=n,e.allowSelect&&(e.clearSelection(!0),s.isSelected=!0),P.e(n)}e.invalidateDocumentBounds(),this.transactionResult=this.name,e.D("PartCreated",s)}finally{this.stopTransaction(),e.D("ChangedSelection",e.selection)}return s}get archetypeNodeData(){return this.Ll}set archetypeNodeData(t){t!==null&&f.ec(t,di,"archetypeNodeData"),this.Ll=t}get isDoubleClick(){return this.mS}set isDoubleClick(t){f.s(t,"boolean",di,"isDoubleClick"),this.mS=t}get isGridSnapEnabled(){return this.yc}set isGridSnapEnabled(t){f.s(t,"boolean",di,"isGridSnapEnabled"),this.yc=t}}class Di extends ee{Xh;wS;Al;constructor(t){super(),this.name="DragSelecting",this.Xh=175,this.wS=!1,this.Al=new Nt({layerName:"Tool",selectable:!1}).add(new ut("Rectangle",{name:"SHAPE",fill:null,stroke:"magenta"}).theme("stroke","dragSelect")).Et(),t&&Object.assign(this,t)}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(!t.allowSelect)return!1;let e=t.lastInput;return!(!e.left||t.currentTool!==this&&(!this.isBeyondDragSize()||e.timestamp-t.firstInput.timestamp<this.delay||t.findPartAt(e.documentPoint,!0)!==null))}doActivate(){let t=this.diagram;this.isActive=!0,t.isMouseCaptured=!0,t.skipsUndoManager=!0,this.box&&t.add(this.box),this.doMouseMove()}doDeactivate(){let t=this.diagram;t.stopAutoScroll(),this.box&&t.remove(this.box),t.skipsUndoManager=!1,t.isMouseCaptured=!1,this.isActive=!1}doMouseMove(){let t=this.diagram;if(this.isActive&&this.box!==null){let e=this.computeBoxBounds(),i=this.box.findObject("SHAPE");i===null&&(i=this.box.findMainElement());let s=Q.l().i(e.width,e.height);i!==null&&(i.desiredSize=s),this.box.bc(e.x,e.y,!1),Q.e(s),(t.allowHorizontalScroll||t.allowVerticalScroll)&&t.doAutoScroll(t.lastInput.viewPoint)}}doMouseUp(){if(this.isActive){let t=this.diagram;this.box&&t.remove(this.box);try{t.currentCursor="wait",t.D("ChangingSelection",t.selection),this.selectInRect(this.computeBoxBounds()),t.D("ChangedSelection",t.selection)}finally{t.currentCursor=""}}this.stopTool()}computeBoxBounds(){let t=this.diagram;return new z(t.firstInput.documentPoint,t.lastInput.documentPoint)}selectInRect(t){let e=this.diagram,i=e.lastInput,s=e.findPartsIn(t,this.isPartialInclusion);if(f.tr?i.meta:i.control)if(i.shift){let n=s.iterator;for(;n.next();){let o=n.value;o.isSelected&&(o.isSelected=!1)}}else{let n=s.iterator;for(;n.next();){let o=n.value;o.isSelected=!o.isSelected}}else if(i.shift){let n=s.iterator;for(;n.next();){let o=n.value;o.isSelected||(o.isSelected=!0)}}else{let n=new j,o=e.selection.iterator;for(;o.next();){let h=o.value;s.has(h)||n.add(h)}let r=n.iterator;for(;r.next();){let h=r.value;h.isSelected=!1}let a=s.iterator;for(;a.next();){let h=a.value;h.isSelected||(h.isSelected=!0)}}}get delay(){return this.Xh}set delay(t){f.s(t,"number",Di,"delay"),this.Xh=t}get isPartialInclusion(){return this.wS}set isPartialInclusion(t){f.s(t,"boolean",Di,"isPartialInclusion"),this.wS=t}get box(){return this.Al}set box(t){t!==null&&t.Et(),this.Al=t}}class Zi extends ee{qw;aL;ko;xS;constructor(t){super(),this.name="Panning",this.qw=new P,this.aL=new P,this.ko=!1;let e=this;this.xS=()=>{let i=e.diagram;i!==null&&i.Pi(A.document,"scroll",e.xS,!1),e.stopTool()},t&&Object.assign(this,t)}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return!(!t.allowHorizontalScroll&&!t.allowVerticalScroll||!t.lastInput.left||t.currentTool!==this&&!this.isBeyondDragSize())}doActivate(){let t=this.diagram;this.ko?(t.lastInput.bubbles=!0,t.Ut(A.document,"scroll",this.xS,!1)):(t.currentCursor="move",t.isMouseCaptured=!0,this.qw.a(t.position)),this.isActive=!0}doDeactivate(){let t=this.diagram;t.currentCursor="",t.isMouseCaptured=!1,this.isActive=!1}doCancel(){let t=this.diagram;t.position=this.qw,t.isMouseCaptured=!1,this.stopTool()}doMouseMove(){this.cL()}doMouseUp(){this.cL(),this.stopTool()}cL(){let t=this.diagram;if(this.isActive&&t){if(this.ko){t.lastInput.bubbles=!0;return}let e=t.position,i=t.firstInput.documentPoint,s=t.lastInput.documentPoint,n=e.x+i.x-s.x,o=e.y+i.y-s.y;t.allowHorizontalScroll||(n=e.x),t.allowVerticalScroll||(o=e.y),t.position=this.aL.i(n,o)}}get bubbles(){return this.ko}set bubbles(t){f.s(t,"boolean",Zi,"bubbles"),this.ko=t}get originalPosition(){return this.qw}}class Ne{Ww;Jw;bS;kS;constructor(t){this.Ww=null,this.Jw=null,this.bS=null,this.kS=null,t&&Object.assign(this,t)}get mainElement(){return this.bS}set mainElement(t){this.bS=t}get show(){return this.Ww}set show(t){this.Ww!==t&&(t!==null&&f.k(t,Ne,"show"),this.Ww=t)}get hide(){return this.Jw}set hide(t){this.Jw!==t&&(t!==null&&f.k(t,Ne,"hide"),this.Jw=t)}get valueFunction(){return this.kS}set valueFunction(t){this.kS=t}}class we{ri;$w;kc;constructor(t,e,i){this.ri=t,this.$w=e,this.kc=i}}class qt extends ee{PS;Zw;SS;MS;Qw;_w;bm;constructor(t){super(),this.name="ContextMenu",this.PS=null,this.Zw=null,this.SS=null,this.MS=new P,this.Qw=null,this.bm=!1;let e=this;this._w=()=>e.stopTool(),t&&Object.assign(this,t)}CF(){let t=new Ne;t.show=(r,a,h)=>h.showDefaultContextMenu(),t.hide=(r,a)=>a.hideDefaultContextMenu(),qt.wu=t;let e=this;this._w=()=>e.stopTool();let i=f.hs("div"),s=f.hs("div");i.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px",s.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";let n=f.hs("style");A.document.getElementsByTagName("head")[0].appendChild(n),n.sheet.insertRule(".goCXul { list-style: none; }",0),n.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0),n.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);let o=this.diagram;o!==null&&(o.Ut(i,"contextmenu",qt.jh,!1),o.Ut(i,"selectstart",qt.jh,!1),o.Ut(s,"contextmenu",qt.jh,!1)),i.className="goCXforeground",s.className="goCXbackground",A.document.body&&(A.document.body.appendChild(i),A.document.body.appendChild(s)),qt.km=i,qt.Pm=s,qt.NS=!0}static wu=null;static NS=!1;static Pm;static km;static jh(t){return t.preventDefault(),!1}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;return this.isBeyondDragSize()||!t.lastInput.right||t.lastInput.clickCount>1?!1:!!(t.lastInput.isTouchEvent&&this.defaultTouchContextMenu!==null||this.findObjectWithContextMenu()!==null)}doStart(){let t=this.diagram;this.MS.set(t.firstInput.documentPoint)}doStop(){this.hideContextMenu(),this.currentObject=null,this.bm=!1}findObjectWithContextMenu(t){t===void 0&&(t=null);let e=this.diagram,i=e.lastInput,s=null;if(t instanceof U||(t instanceof dt?s=t:s=e.findObjectAt(i.documentPoint,null,n=>!n.layer?.isTemporary)),s!==null){let n=s;for(;n!==null;){if(n.contextMenu!==null)return n;n=n.panel}if(e.lastInput.isTouchEvent&&this.defaultTouchContextMenu)return s.part}else if(e.contextMenu!==null)return e;return null}doActivate(){}doMouseDown(){if(super.doMouseDown(),this.isActive&&this.currentContextMenu instanceof St){let t=this.diagram.toolManager.findTool("Action");t!==null&&t.canStart()&&(t.doActivate(),t.doMouseDown(),t.doDeactivate())}this.diagram.toolManager.mouseDownTools.has(this)&&this.doContextClick()}doMouseUp(){if(this.isActive&&this.currentContextMenu instanceof St){let t=this.diagram.toolManager.findTool("Action");t!==null&&t.canStart()&&(t.doActivate(),t.doCancel(),t.doDeactivate())}this.doContextClick()}doContextClick(){let t=this.diagram;if(!this.isActive)this.canStart()&&(this.openMenu(!0),this.isActive||this.stopTool());else{let e=this.currentContextMenu;if(e===null)return;let i=null;e instanceof Ne||(i=t.findObjectAt(t.lastInput.documentPoint,null,null),i!==null&&i.isContainedBy(e)&&this.standardMouseClick(null,null)),this.maybeStopTool(i)}}maybeStopTool(t){this.stopTool(),this.canStart()&&(this.diagram.currentTool=this,this.doMouseUp())}openMenu(t,e){if(e===void 0&&(e=null),this.bm)return;this.bm=!0,t&&this.standardMouseSelect();let i=this.standardMouseClick();if(this.bm=!1,!i){this.isActive=!0;let s=qt.wu;if(e===null&&(e=this.findObjectWithContextMenu()),e!==null){let n=e.contextMenu;n!==null?(this.currentObject=e instanceof dt?e:null,this.showContextMenu(n,this.currentObject)):s!==null&&this.showContextMenu(s,this.currentObject)}else s!==null&&this.showContextMenu(s,null);this.currentContextMenu instanceof St&&!this.currentContextMenu.visible&&this.stopTool()}}doMouseMove(){let t=this.diagram.toolManager.findTool("Action");t!==null&&t.doMouseMove(),this.isActive&&this.diagram.toolManager.doMouseMove()}showContextMenu(t,e){let i=this.diagram;if(t!==this.currentContextMenu&&this.hideContextMenu(),t instanceof St){let s=t;s.layerName="Tool",s.selectable=!1,s.scale=1/i.scale,s.category=this.name,s.hasPlaceholder()&&(s.placeholder.scale=i.scale);let n=s.diagram;n!==null&&n!==i&&n.remove(s),i.add(s),e!==null?s.adornedObject=e:s.data=i.model,s.ensureBounds(),this.positionContextMenu(s,e)}else t instanceof Ne&&t.show!==null&&t.show(e,i,this);this.currentContextMenu=t}positionContextMenu(t,e){if(t.hasPlaceholder())return;let i=t,s=this.diagram,n=s.lastInput.documentPoint.copy(),o=i.measuredBounds,r=s.viewportBounds;s.lastInput.isTouchEvent&&(n.x-=o.width),n.x+o.width>r.right&&(n.x-=o.width+5/s.scale),n.x<r.x&&(n.x=r.x),n.y+o.height>r.bottom&&(n.y-=o.height+5/s.scale),n.y<r.y&&(n.y=r.y),i.position=n}hideContextMenu(){let t=this.diagram,e=this.currentContextMenu;e!==null&&(e instanceof St?(t.remove(e),this.Zw!==null&&this.Zw.removeAdornment(e.category),e.data=null,e.adornedObject=null):e instanceof Ne&&(e.hide!==null?e.hide(t,this):e.mainElement!==null&&(e.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())}LF(){let t=this,e=new j;return e.add(new we("Copy",i=>i.commandHandler.copySelection(),i=>i.commandHandler.canCopySelection())),e.add(new we("Cut",i=>i.commandHandler.cutSelection(),i=>i.commandHandler.canCutSelection())),e.add(new we("Delete",i=>i.commandHandler.deleteSelection(),i=>i.commandHandler.canDeleteSelection())),e.add(new we("Paste",i=>i.commandHandler.pasteSelection(t.mouseDownPoint),i=>i.commandHandler.canPasteSelection(t.mouseDownPoint))),e.add(new we("Select All",i=>i.commandHandler.selectAll(),i=>i.commandHandler.canSelectAll())),e.add(new we("Undo",i=>i.commandHandler.undo(),i=>i.commandHandler.canUndo())),e.add(new we("Redo",i=>i.commandHandler.redo(),i=>i.commandHandler.canRedo())),e.add(new we("Scroll To Part",i=>i.commandHandler.scrollToPart(),i=>i.commandHandler.canScrollToPart())),e.add(new we("Zoom To Fit",i=>i.commandHandler.zoomToFit(),i=>i.commandHandler.canZoomToFit())),e.add(new we("Reset Zoom",i=>i.commandHandler.resetZoom(),i=>i.commandHandler.canResetZoom())),e.add(new we("Group Selection",i=>i.commandHandler.groupSelection(),i=>i.commandHandler.canGroupSelection())),e.add(new we("Ungroup Selection",i=>i.commandHandler.ungroupSelection(),i=>i.commandHandler.canUngroupSelection())),e.add(new we("Edit Text",i=>i.commandHandler.editTextBlock(),i=>i.commandHandler.canEditTextBlock())),e}showDefaultContextMenu(){let t=this.diagram;this.Qw===null&&(this.Qw=this.LF()),qt.km.innerHTML="",qt.Pm.addEventListener("pointerdown",this._w,!1);let e=this,i=f.hs("ul");i.className="goCXul",qt.km.appendChild(i),i.innerHTML="";let s=this.Qw.iterator;for(;s.next();){let n=s.value,o=n.$w,r=n.kc;if(!f.it(o)||f.it(r)&&!r(t))continue;let a=f.hs("li");a.className="goCXli";let h=f.hs("a");h.className="goCXa",h.href="#",h.$w=o,h.addEventListener("pointerdown",function(l){return this.$w(t),e.stopTool(),l.preventDefault(),!1},!1),h.textContent=n.ri,a.appendChild(h),i.appendChild(a)}qt.km.style.display="block",qt.Pm.style.display="block"}hideDefaultContextMenu(){if(this.currentContextMenu===null||this.currentContextMenu!==qt.wu)return;qt.km.style.display="none",qt.Pm.style.display="none";let t=this.diagram;t!==null&&t.Pi(qt.Pm,"pointerdown",this._w,!1),this.currentContextMenu=null}get currentContextMenu(){return this.PS}set currentContextMenu(t){this.PS=t,this.Zw=t instanceof St?t.adornedPart:null}get defaultTouchContextMenu(){return qt.NS===!1&&qt.wu===null&&U.isUsingDOM()&&this.CF(),qt.wu}set defaultTouchContextMenu(t){t===null&&(qt.NS=!0),qt.wu=t}get currentObject(){return this.SS}set currentObject(t){this.SS=t}get mouseDownPoint(){return this.MS}}var vn=(x=>(x[x.LostFocus=1]="LostFocus",x[x.MouseDown=2]="MouseDown",x[x.Tab=3]="Tab",x[x.Enter=4]="Enter",x))(vn||{}),kn=(x=>(x[x.SingleClick=1]="SingleClick",x[x.SingleClickSelected=2]="SingleClickSelected",x[x.DoubleClick=3]="DoubleClick",x))(kn||{}),Sn=(x=>(x[x.None=1]="None",x[x.Active=2]="Active",x[x.Editing=3]="Editing",x[x.Validating=4]="Validating",x[x.Invalid=5]="Invalid",x[x.Validated=6]="Validated",x))(Sn||{});class me extends ee{Pe;CS;LS;Tl;Gt;AS;TS;DS;tx;FS;constructor(t){super(),this.name="TextEditing",this.Pe=new xt,this.CS=null,this.LS=2,this.Tl=null,this.Gt=1,this.AS=1,this.TS=!0,this.DS=null,this.tx=new Ne,this.AF(this.tx),t&&Object.assign(this,t)}static LostFocus=1;static MouseDown=2;static Tab=3;static Enter=4;static SingleClick=1;static SingleClickSelected=2;static DoubleClick=3;static StateNone=1;static StateActive=2;static StateEditing=3;static StateValidating=4;static StateInvalid=5;static StateValidated=6;AF(t){if(!U.isUsingDOM())return;let e=f.hs("textarea");this.FS=e;let i=this;e.addEventListener("input",function(s){if(i.textBlock===null)return;let n=i.measureTemporaryTextBlock(this.value),o=this.textScale;this.style.width=20+Math.max(i.textBlock.measuredBounds.width,n.measuredBounds.width)*o+"px",this.rows=Math.max(i.textBlock.lineCount,n.lineCount)},!1),e.addEventListener("keydown",function(s){if(s.isComposing||i.textBlock===null)return;let n=s.key;if(n==="Enter"){i.textBlock.isMultiline===!1&&s.preventDefault(),i.acceptText(4);return}else if(n==="Tab"){i.acceptText(3),s.preventDefault();return}else n==="Escape"&&(i.doCancel(),i.diagram!==null&&i.diagram.doFocus())},!1),e.addEventListener("focus",function(s){i.TF(s)},!1),e.addEventListener("blur",function(s){i.DF(s)},!1),t.valueFunction=()=>e.value,t.mainElement=e,t.show=(s,n,o)=>{if(!(s instanceof xt)||!n||!n.div||!(o instanceof me))return;if(o.state===5){e.style.border="3px solid red",e.focus();return}let r=s.getDocumentPoint(D.Center),a=n.position,h=n.scale,l=s.getDocumentScale()*h;l<o.minimumEditorScale&&(l=o.minimumEditorScale);let u=s.naturalBounds.width*l+6,c=s.naturalBounds.height*l+2,d=(r.x-a.x)*h,g=(r.y-a.y)*h,p=s.verticalAlignment,m=(s.lineHeight+s.spacingAbove+s.spacingBelow)*s.lineCount*l,y=.5*c-.5*m,w=p.y*c-p.y*m+p.offsetY-y-m/2;e.value=s.text,n.div.style.font=s.font;let b=1;e.style.position="absolute",e.style.zIndex="100",e.style.font="inherit",e.style.fontSize=l*100+"%",e.style.lineHeight="normal",e.style.width=u+"px",e.style.left=(d-u/2|0)-b+"px",e.style.top=(g+w|0)-b+"px",e.style.textAlign=s.textAlign,e.style.margin="0",e.style.padding=b+"px",e.style.border="0",e.style.outline="none",e.style.whiteSpace="pre-wrap",e.style.overflow="hidden",e.rows=s.lineCount,e.textScale=l,e.className="goTXarea",n.div.appendChild(e),e.focus(),o.selectsTextOnActivate&&(e.select(),e.setSelectionRange(0,9999))},t.hide=(s,n)=>{s.div&&s.div.removeChild(e)}}get textBlock(){return this.CS}set textBlock(t){this.CS=t}get currentTextEditor(){return this.DS}set currentTextEditor(t){this.DS=t}get defaultTextEditor(){return this.tx}set defaultTextEditor(t){this.tx=t}get starting(){return this.LS}set starting(t){this.LS=t}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t===null||t.isReadOnly||me.Pc&&me.Pc!==this&&(me.Pc.acceptText(2),me.Pc&&me.Pc!==this)||!t.lastInput.left||this.isBeyondDragSize())return!1;let e=t.lastInput.documentPoint,i=t.findObjectAt(e);if(i===null||!(i instanceof xt)||!i.editable||i.part===null||!i.part.canEdit())return!1;let s=i.part;return!(s===null||this.starting===2&&!s.isSelected||this.starting===3&&t.lastInput.clickCount<2)}doStart(){me.Pc=this,this.textBlock!==null&&this.doActivate()}doActivate(){if(this.isActive)return;let t=this.diagram;if(t===null)return;let e=this.textBlock;if(e===null&&(e=t.findObjectAt(t.lastInput.documentPoint)),e===null||!(e instanceof xt)||(this.textBlock=e,e.part===null))return;t.animationManager.stopAnimation(),this.isActive=!0,this.Gt=2;let i=this.defaultTextEditor;e.textEditor!==null&&(i=e.textEditor),this.Pe=this.textBlock.copy();let s=new z(this.textBlock.getDocumentPoint(D.TopLeft),this.textBlock.getDocumentPoint(D.BottomRight));t.scrollToRect(s),i!==null&&i.show!==null&&i.show(e,t,this),this.currentTextEditor=i}doCancel(){this.stopTool()}doMouseUp(){this.canStart()&&this.doActivate()}doMouseDown(){this.isActive&&this.acceptText(2)}acceptText(t){switch(t){case 2:this.Gt===6?this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus():(this.Gt===2||this.Gt===5||this.Gt===3)&&(this.Gt=4,this.fL());break;case 1:case 4:case 3:if(t===4&&this.textBlock!==null&&this.textBlock.isMultiline===!0)return;(this.Gt===2||this.Gt===5||this.Gt===3)&&(this.Gt=4,this.fL());break}}fL(){let t=this.textBlock,e=this.diagram,i=this.currentTextEditor;if(t!==null&&i!==null){let s=t.text,n="";if(i.valueFunction!==null&&(n=i.valueFunction()),!this.isValidText(t,s,n)){this.Gt=5,this.doError(s,n);return}this.startTransaction(this.name),this.Gt=6,this.transactionResult=this.name,t.text=n,this.doSuccess(s,n),e!==null&&e.D("TextEdited",t,s),this.stopTransaction(),this.stopTool(),e!==null&&e.doFocus()}}doError(t,e){let i=this.textBlock;if(i===null)return;i.errorFunction!==null&&i.errorFunction(this,t,e);let s=this.currentTextEditor;s!==null&&s.show!==null&&s.show(i,this.diagram,this)}doSuccess(t,e){let i=this.textBlock;i!==null&&i.textEdited!==null&&i.textEdited(i,t,e)}doDeactivate(){let t=this.diagram;if(t!==null){if(this.Gt=1,this.currentTextEditor!==null){let e=this.currentTextEditor;e!==null&&e.hide!==null&&e.hide(t,this)}this.textBlock=null,this.isActive=!1}}doStop(){me.Pc=null}TF(t){if(this.currentTextEditor===null||this.state===1)return;let e=this.FS;this.Gt===2&&(this.Gt=3),f.it(e.select)&&this.selectsTextOnActivate&&(e.select(),e.setSelectionRange(0,9999))}DF(t){if(this.currentTextEditor===null||this.state===1)return;let e=this.FS;f.it(e.focus)&&e.focus(),f.it(e.select)&&this.selectsTextOnActivate&&(e.select(),e.setSelectionRange(0,9999))}isValidText(t,e,i){let s=this.textValidation;if(s!==null&&!s(t,e,i))return!1;let n=t.textValidation;return!(n!==null&&!n(t,e,i))}get textValidation(){return this.Tl}set textValidation(t){t!==null&&f.k(t,me,"textValidation"),this.Tl=t}get minimumEditorScale(){return this.AS}set minimumEditorScale(t){t!==null&&f.s(t,"number",me,"minimumEditorScale"),this.AS=t}get selectsTextOnActivate(){return this.TS}set selectsTextOnActivate(t){t!==null&&f.s(t,"boolean",me,"selectsTextOnActivate"),this.TS=t}get state(){return this.Gt}set state(t){this.Gt!==t&&(this.Gt=t)}measureTemporaryTextBlock(t){let e=this.Pe;return e.text=t,this.textBlock!==null&&e.ht(this.textBlock.Dl,1/0),e}static Pc=null}var Pn=(x=>(x[x.Default=1]="Default",x[x.AnimateLocations=2]="AnimateLocations",x[x.None=3]="None",x))(Pn||{});class pe{N;Si;Oi;wr;zn;So;RS;vS;Sm;pi;Sc;on;Mm;Hh;ix;Nm;ex;Mc;pu;Cm;constructor(t){this.N=U.um(),this.Si=!1,this.Sm=!1,this.pi=!1,this.Sc=!1,this.ex=!0,this.Mc=1,this.pu=!1,this.Oi=!0,this.wr=!0,this.So=600,this.RS=!1,this.vS=!1,this.zn=new I,this.on=new Ce,this.Mm=new Ce,this.on.ds=this,this.Hh=new I,this.ix=new I,this.Nm=new I,this.Cm=new I,t&&Object.assign(this,t)}Mo(t){this.N=t}NE(){return this.N}canStart(t){return!0}Fl(t){return!this.Oi||!this.canStart(t)?!1:(this.zn.add(t),this.defaultAnimation.isAnimating&&this.stopAnimation(),this.N.Mi(),this.pi=!0,!0)}getBundleAnimation(){return this.Mm}OS(){if(!this.Oi||(this.Mm.ce.count>0&&this.Mm.start(),!this.pi))return;let t=this.on,e=this.N,i=this.zn.has("Model");if(i&&(this.Sc=!0,this.Mc===1?(t.isViewportUnconstrained=!0,t.ce.clear(),t.add(e,"position",e.position.copy().offset(0,-200),e.position),t.add(e,"opacity",0,1)):this.Mc===3&&t.ce.clear(),this.Mc===2&&e.nx.equals(e.at)?this.ex=!0:this.ex=!1,e.D("InitialAnimationStarting",this)),i&&!this.wr||t.ce.count===0){this.zn.clear(),this.pi=!1,t.ce.clear(),t.lx(e),this.Sc=!1,e.S();return}this.zn.clear(),e.xr=!1;let s=t.ce.get(e);e.autoScale!==1&&s!==null&&(delete s.ei.scale,delete s.gs.scale);let n=this;A.requestAnimationFrame(()=>{n.pi===!1||t.Si||(e.getRenderingHint("temporaryPixelRatio")&&e.Vw(),e.IS(),n.pi=!1,t.start(),t.Si&&(n.xu(),e.invalidateDocumentBounds(),t.uL(0),e.ur(!0),n.bu(),e.D("AnimationStarting",n)))})}ES(){return this.zn.has("Trigger")&&this.zn.count===1}dL(t,e,i,s){this.isTicking||this.ES()||t instanceof _&&(t.fromNode!==null||t.toNode!==null)||this.on.add(t,"position",e,i,s)}hx(t){return this.on.hx(t)}US(t){return this.on.US(t)}FF(t){let e=this.Hh,i=this;function s(){if(i.Nm.count>0&&(e.addAll(i.Nm),i.Nm.clear(),i.Si=!0),i.Si===!1||e.count===0)return;i.ix.addAll(e);let n=i.ix.iterator;for(;n.next();){let o=n.value;o.Si!==!1&&(o.RF()?o.gL(!1):o.Nc=!0)}if(i.ix.clear(),i.Si===!1){A.requestAnimationFrame(s);return}i.xu(),i.N.ur(),i.bu(),A.requestAnimationFrame(s)}this.Si?this.vF(t):(this.Si=!0,e.add(t),A.requestAnimationFrame(()=>s()))}vF(t){this.Nm.add(t)}OF(){let t=this.Hh.iterator;for(;t.next();)t.value.Nc=!1}xu(){if(this.Sm)return;let t=this.N;this.RS=t.skipsUndoManager,this.vS=t.fe,t.skipsUndoManager=!0,t.fe=!0,this.Sm=!0}bu(){let t=this.N;t.skipsUndoManager=this.RS,t.fe=this.vS,this.Sm=!1}stopAnimation(t){let e=this.on;if(this.pi===!0&&(this.pi=!1,this.Sc=!1,this.zn.clear(),e.IF()&&this.N.requestUpdate()),!this.Si){e.ce.clear(),e.lx(this.N);return}if(e.ku(!0),e.lx(null),t===!0){let i=this.Hh.toArray();for(let s=0;s<i.length;s++)i[s].ku(!0)}}ku(t){this.Hh.delete(t),this.Hh.count===0&&(this.Si=!1,this.N.requestUpdate()),t===this.defaultAnimation&&this.N.D("AnimationFinished",this)}Cc(t,e){this.pi&&(!this.zn.has("Expand Tree")&&!this.zn.has("Expand SubGraph")||(this.on.Cc(t,e),this.mL(t)))}Lc(t,e){this.pi&&(!this.zn.has("Collapse Tree")&&!this.zn.has("Collapse SubGraph")||(this.on.Lc(t,e),this.on.BS(e,"position",e.position,e.position),this.mL(t)))}pL(t,e){!this.pi||t.equals(e)||this.ES()||(this.N.Vh||(t=e.copy()),this.on.BS(this.N,"position",t,e))}yL(t,e){this.pi&&(this.ES()||this.on.add(this.N,"scale",t,e))}VS(t,e){t.Se&&(t.br=e,this.Cm.add(t))}mL(t){let e=t.findLinksConnected();for(;e.next();){let i=e.value;i.Se&&(i.br=i.points.copy(),this.Cm.add(i))}}get isEnabled(){return this.Oi}set isEnabled(t){f.s(t,"boolean",pe,"isEnabled"),this.Oi=t,t&&this.Hh.each(e=>{!e.isAnimating&&e.runCount===1/0&&e.start()})}get duration(){return this.So}set duration(t){f.s(t,"number",pe,"duration"),t<1&&f.W(t,">= 1",pe,"duration"),this.So=t}get isAnimating(){return this.Si}get isTicking(){return this.Sm}get isInitial(){return this.wr}set isInitial(t){f.s(t,"boolean",pe,"isInitial"),this.wr=t}get defaultAnimation(){return this.on}get activeAnimations(){return this.Hh}get initialAnimationStyle(){return this.Mc}set initialAnimationStyle(t){this.Mc=t}static ax=new pt;static defineAnimationEffect(t,e){pe.ax.set(t,e)}static zS(t,e,i,s,n){t===null&&(t=[0,0,0,0]),e===null&&(e=[0,0,0,0]);let o=t[0],r=t[1],a=t[2],h=t[3],l=e[0],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 g=n(i,o,l-o,s)%360,p=n(i,r,u-r,s),m=n(i,a,c-a,s),y=n(i,h,d-h,s);return"hsla("+g+", "+p+"%, "+m+"%, "+y+")"}static Default=1;static AnimateLocations=2;static None=3}{let x=pe.ax,t=(e,i,s,n,o,r)=>{e.position=new P(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r))};x.set("position:diagram",t),x.set("position",t),x.set("position:part",(e,i,s,n,o,r)=>{o<r?e.bc(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r),!1):e.position=new P(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r))}),x.set("location",(e,i,s,n,o,r)=>{o<r?e.bc(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r),!0):e.location=new P(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r))}),x.set("position:placeholder",(e,i,s,n,o,r)=>{o<r?e.bc(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r),!1):e.position=new P(n(o,i.x,s.x-i.x,r),n(o,i.y,s.y-i.y,r))}),x.set("position:nodeCollapse",(e,i,s,n,o,r)=>{let a=e.actualBounds,h=s.actualBounds,l=h.x+h.width/2-a.width/2,u=h.y+h.height/2-a.height/2;o<r?e.bc(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 Q(n(o,i.width,s.width-i.width,r),n(o,i.height,s.height-i.height,r))}),x.set("width",(e,i,s,n,o,r)=>{e.width=n(o,i,s-i,r)}),x.set("height",(e,i,s,n,o,r)=>{e.height=n(o,i,s-i,r)}),x.set("fill",(e,i,s,n,o,r)=>{e.fill=pe.zS(i,s,o,r,n)}),x.set("stroke",(e,i,s,n,o,r)=>{e.stroke=pe.zS(i,s,o,r,n)}),x.set("strokeWidth",(e,i,s,n,o,r)=>{e.strokeWidth=n(o,i,s-i,r)}),x.set("strokeDashOffset",(e,i,s,n,o,r)=>{e.strokeDashOffset=n(o,i,s-i,r)}),x.set("background",(e,i,s,n,o,r)=>{e.background=pe.zS(i,s,o,r,n)}),x.set("opacity",(e,i,s,n,o,r)=>{e.opacity=n(o,i,s-i,r)}),x.set("scale",(e,i,s,n,o,r)=>{e.scale=n(o,i,s-i,r)}),x.set("angle",(e,i,s,n,o,r)=>{e.angle=n(o,i,s-i,r)})}class Ce{cx;Lm;Si;Pu;So;ms;wL;Ac;ce;fx;ei;Xn;Su;Tc;ux;gx;Nc;XS;mx;ds;N;YS;GS;KS;constructor(t){this.N=null,this.ds=null,this.XS=null,this.mx=null,this.YS=!1,this.Si=!1,this.Nc=!1,this.ei=0,this.Xn=0,this.cx=Ce.EaseInOutQuad,this.Lm=Ce.EaseInOutQuad,this.Su=!1,this.Tc=!1,this.ux=1,this.gx=0,this.So=NaN,this.ms=NaN,this.GS=0,this.Pu=null,this.wL=P.xo,this.ce=new pt,this.fx=new pt,this.Ac=new I,this.KS=1,t&&Object.assign(this,t)}suspend(){this.Nc=!0}advanceTo(t,e){e&&(this.Nc=!1),this.Su&&t>=this.ms&&(this.Tc=!0,t=t-this.ms),this.GS=t,this.gL(!0),this.ds.xu(),this.N.ur(),this.ds.bu(),this.N.redraw()}lx(t){if(this.fx.clear(),this.Tc=!1,this.gx=0,this.ms=NaN,this.Ac.count>0&&this.Ac.clear(),t!==null){let e=t.links;for(;e.next();)e.value.br=null}}IF(){return this.ce.count>0}start(){if(this.ce.count===0)return this;if(this.Si)return this;let t=this.N,e=this.ce.iterator;for(;e.next();){let s=e.key;t===null&&(s instanceof U?t=s:s instanceof dt&&(t=s.diagram))}if(t!==null)this.N=t,this.ds=t.animationManager;else return this;let i=this.ds;return i.isEnabled===!1?this:(this.ms=isNaN(this.So)?i.duration:this.So,this.Lm=this.cx,i.Sc&&i.Mc===1&&this===i.defaultAnimation&&(this.Lm=Ce.EaseOutExpo,this.ms=isNaN(this.So)?i.duration===600?900:i.duration:this.So),this.KS=t.scrollMode,this.isViewportUnconstrained&&(t.qh=2),i.xu(),this.Ac.each(s=>{s.data=null,t.add(s)}),i.bu(),this.Si=!0,this.ei=+new Date,this.Xn=this.ei+this.ms,i.FF(this),this)}addTemporaryPart(t,e){return t.ke()?(this.Ac.add(t),this.N=e,this):this}add(t,e,i,s,n){if(this.N===null&&(t instanceof U?this.N=t:t instanceof dt&&t.diagram!==null&&(this.N=t.diagram)),t instanceof Nt){if(!t.isAnimated)return this;e==="position"&&(e="position:part")}return this.BS(t,e,i,s,n),this}BS(t,e,i,s,n){let o=this.ce,r,a,h;if(t instanceof U&&e==="position"&&(e="position:diagram"),(e==="fill"||e==="stroke"||e==="background")&&(E.No(i),E.jS(),i=[E.Ii.n0,E.Ii.n1,E.Ii.n2,E.Ii.n3],E.No(s),E.jS(),s=[E.Ii.n0,E.Ii.n1,E.Ii.n2,E.Ii.n3]),o.has(t))r=o.get(t),a=r.ei,h=r.gs,a[e]===void 0&&(a[e]=this.Mu(i)),h[e]=this.Mu(s);else{if(e==="position"&&i.equalsApprox(s))return;a={},h={},a[e]=this.Mu(i),h[e]=this.Mu(s),r=new Qo(a,h,n),o.set(t,r)}let l=a[e];l instanceof P&&!l.isReal()&&l.a(this.wL),n&&e.indexOf("position:")===0&&t instanceof Nt?r.yx.location=this.Mu(t.location):n&&(r.yx[e]=this.Mu(i))}Mu(t){return t instanceof P||t instanceof Q?t.copy():t}EF(t){let e=this.ce;if(e.has(t)){let i=e.get(t);i.wx=!0}}hx(t){if(!this.Si)return!1;let e=this.ce.get(t);return e!==null&&e.wx}US(t){if(!this.Si)return!1;let e=this.ce.get(t);return e!==null&&!!(e.ei.position||e.ei["position:part"]||e.ei.location)}RF(){if(this.Ac.count>0)return!0;let t=this.ce.iterator;for(;t.next();){let e=t.key;if(e instanceof dt&&e.diagram!==null||e instanceof U)return!0}return!1}gL(t){if(this.Nc&&!t)return;let e=this.ds;if(this.Si===!1)return;let i=+new Date,s=i>this.Xn?this.ms:i-this.ei;t&&(s=this.GS,s<this.ms?(this.ei=+new Date-s,this.Xn=this.ei+this.ms):s=this.ms),e.xu(),this.uL(s),this.N.ur(!0),e.bu(),i>this.Xn&&(this.Su&&!this.Tc?(this.ei=+new Date,this.Xn=this.ei+this.ms,this.Tc=!0):this.ku(!1))}uL(t){let e=this.ms,i=this.ce.iterator,s=this.Tc;for(;i.next();){let n=i.key;if(n instanceof dt&&n.diagram===null)continue;let o=i.value,r=s?o.gs:o.ei,a=s?o.ei:o.gs,h=pe.ax;for(let l in a)l==="position"&&(a["position:placeholder"]||a["position:nodeCollapse"])||h.get(l)!==null&&h.get(l)(n,r[l],a[l],this.Lm,t,e,this)}}stop(){return this.Si?(this.ku(!0),this):this}ku(t){if(this.mx!==null&&this.mx.UF(this.XS),!this.Si)return;let e=this.N,i=this.ds;i.Sc=!1,this.Si=!1,this.Nc=!1,i.xu();let s=this.ce,n=this.Ac.iterator;for(;n.next();)e.remove(n.value);let o=this.Su,r=s.iterator,a=pe.ax;for(;r.next();){let l=r.key,u=r.value,c=o?u.gs:u.ei,d=o?u.ei:u.gs,g=u.yx;for(let p in d)if(a.get(p)!==null){let m=p;u.xx&&(m==="position:nodeCollapse"||m==="position:placeholder")&&(m="position"),a.get(m)(l,c[p],g[p]!==void 0?g[p]:u.xx?c[p]:d[p],this.Lm,this.ms,this.ms,this)}u.xx&&g.location!==void 0&&l instanceof Nt&&(l.location=g.location),u.wx&&l instanceof Nt&&l.Ei(!1)}this.gx++;let h=!t&&this.ux>this.gx;if(!h&&(this===i.Mm||this===i.defaultAnimation)&&this.ce.clear(),e.bx.clear(),e.CP(!1),e.invalidateDocumentBounds(),e.S(),e.ur(!0),i.defaultAnimation===this){let l=i.Cm.iterator;for(;l.next();)l.value.BF();i.Cm.clear()}if(e.ur(!0),this.isViewportUnconstrained&&(e.scrollMode=this.KS),i.bu(),h){this.Tc=!1,this.start();return}this.lx(null),e.xL(),i.ku(this),this.Pu&&this.Pu(this),e.requestUpdate()}Cc(t,e){let i=e.actualBounds,s=null;if(e instanceof ft&&(s=e.placeholder),s!==null&&s.visible){let n=s.getDocumentPoint(D.TopLeft),o=s.padding;n.x+=o.left,n.y+=o.top,this.add(t,"position",n,t.position,!1)}else this.add(t,"position",new P(i.x+i.width/2,i.y+i.height/2),t.position,!1);this.add(t,"scale",.01,t.scale,!1),t instanceof ft&&this.VF(t,e)}VF(t,e){let i=t.memberParts;for(;i.next();){let s=i.value;s instanceof rt&&this.Cc(s,e)}}Lc(t,e){if(!t.isVisible())return;let i=null;if(e instanceof ft&&(i=e.placeholder),i!==null&&i.visible){let s=i.getDocumentPoint(D.TopLeft),n=i.padding;s.x+=n.left,s.y+=n.top,this.add(t,"position:placeholder",t.position,s,!0)}else this.add(t,"position:nodeCollapse",t.position,e,!0);this.add(t,"scale",t.scale,.01,!0),this.EF(t),t instanceof ft&&this.zF(t,e)}zF(t,e){let i=t.memberParts;for(;i.next();){let s=i.value;s instanceof rt&&this.Lc(s,e)}}get duration(){return this.So}set duration(t){f.s(t,"number",Ce,"duration"),t<1&&f.W(t,">= 1",Ce,"duration"),this.So=t}get reversible(){return this.Su}set reversible(t){this.Su=t}get runCount(){return this.ux}set runCount(t){t>0?this.ux=t:f.o("Animation.runCount value must be a positive integer.")}get finished(){return this.Pu}set finished(t){this.Pu!==t&&(t!==null&&f.k(t,Ce,"finished"),this.Pu=t)}get easing(){return this.cx}set easing(t){this.cx=t}get isViewportUnconstrained(){return this.YS}set isViewportUnconstrained(t){this.YS=t}get isAnimating(){return this.Si}getTemporaryState(t){let e=this.fx.get(t);return e===null&&(e={},this.fx.set(t,e)),e}static EaseLinear=(t,e,i,s)=>i*t/s+e;static EaseInOutQuad=(t,e,i,s)=>(t/=s/2,t<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e);static EaseInQuad=(t,e,i,s)=>i*(t/=s)*t+e;static EaseOutQuad=(t,e,i,s)=>-i*(t/=s)*(t-2)+e;static EaseInExpo=(t,e,i,s)=>t===0?e:i*Math.pow(2,10*(t/s-1))+e;static EaseOutExpo=(t,e,i,s)=>t===s?e+i:i*(-Math.pow(2,-10*t/s)+1)+e}class Qo{ei;gs;yx;xx;wx;constructor(t,e,i){this.ei=t,this.gs=e,this.yx={},this.xx=i,this.wx=!1}}var Mn=(x=>(x[x.Default=1]="Default",x[x.Immediate=2]="Immediate",x[x.Bundled=3]="Bundled",x))(Mn||{});class Fi{be;en;Nu;Dc;constructor(t,e,i){this.be=null,this.en=t,this.Nu=i||1,this.Dc=null,e!==void 0&&(this.Dc=e,i===void 0&&(this.Nu=2))}copy(){let t=new Fi(this.en);t.Nu=this.Nu;let e=this.Dc;if(e!==null){let i={};e.duration!==void 0&&(i.duration=e.duration),e.finished!==void 0&&(i.finished=e.finished),e.easing!==void 0&&(i.easing=e.easing),t.Dc=i}return t}get propertyName(){return this.en}set propertyName(t){this.en=t}get animationSettings(){return this.Dc}set animationSettings(t){this.Dc=t}XF(t){let e=this.Dc;e!==null&&(e.duration&&(t.duration=e.duration),e.finished&&(t.finished=e.finished),e.easing&&(t.easing=e.easing))}get startCondition(){return this.Nu}set startCondition(t){this.Nu=t}static Default=1;static Immediate=2;static Bundled=3}class Vt{N;St;$t;kr;Rl;vl;Ol;Il;El;Ul;Bl;Vl;zl;Xl;Yl;Gl;kc;Kl;kx;Am;Cu;Ct;constructor(t){I.Ki(this),this.N=null,this.Ct=new j,this.St="",this.$t=1,this.kr=!1,this.Rl=!0,this.vl=!0,this.Ol=!0,this.Il=!0,this.El=!0,this.Ul=!0,this.Bl=!0,this.Vl=!0,this.zl=!0,this.Xl=!0,this.Yl=!0,this.Gl=!0,this.kc=!0,this.Kl=!0,this.kx=!0,this.Am=!1,this.Cu=[],t&&Object.assign(this,t)}YF(){let t=this.Ct;for(let e=0;e<t.length;e++)t.r[e].HS(null);t.clear(),this.Cu.length=0}Mo(t){this.N=t}toString(t){t===void 0&&(t=0);let e='Layer "'+this.name+'"';if(t<=0)return e;let i=0,s=0,n=0,o=0,r=0,a=this.Ct.iterator;for(;a.next();){let l=a.value;l instanceof ft?n++:l instanceof rt?s++:l instanceof _?o++:l instanceof St?r++:i++}let h="";if(i>0&&(h+=i+" Parts "),s>0&&(h+=s+" Nodes "),n>0&&(h+=n+" Groups "),o>0&&(h+=o+" Links "),r>0&&(h+=r+" Adornments "),t>1){let l=this.Ct.iterator;for(;l.next();){let u=l.value;h+=`
|
8
8
|
`+u.toString();let c=u.data;c!==null&&I.as(c)&&(h+=" #"+I.as(c)),u instanceof rt?h+=" "+f.toString(c):u instanceof _&&(h+=" "+f.toString(u.fromNode)+" "+f.toString(u.toNode))}}return e+" "+this.Ct.count+": "+h}findObjectAt(t,e,i){if(e===void 0&&(e=null),i===void 0&&(i=null),this.Kl===!1)return null;let s=!1;this.diagram!==null&&this.diagram.viewportBounds.containsPoint(t)&&(s=!0);let n=P.l(),o=this.Ct.r,r=o.length;for(let a=r;a--;){let h=o[a];if(s===!0&&h.Nl()===!1||!h.isVisible())continue;n.a(t),n.Oe(h.Us);let l=h.bL(n,e,i);if(l!==null&&(e!==null&&(l=e(l)),l!==null&&(i===null||i(l))))return P.e(n),l}return P.e(n),null}findObjectsAt(t,e,i,s){if(e===void 0&&(e=null),i===void 0&&(i=null),!(s instanceof j)&&!(s instanceof I)&&(s=new I),this.Kl===!1)return s;let n=!1;this.diagram!==null&&this.diagram.viewportBounds.containsPoint(t)&&(n=!0);let o=P.l(),r=this.Ct.r,a=r.length;for(let h=a;h--;){let l=r[h];if(n===!0&&l.Nl()===!1||!l.isVisible())continue;o.a(t),o.Oe(l.Us);let u=l;l.kL(o,e,i,s)&&(e!==null&&(u=e(u)),u!==null&&(i===null||i(u))&&s.add(u))}return P.e(o),s}findObjectsIn(t,e,i,s,n){if(e===void 0&&(e=null),i===void 0&&(i=null),s===void 0&&(s=!1),!(n instanceof j)&&!(n instanceof I)&&(n=new I),this.Kl===!1)return n;let o=!1;this.diagram!==null&&this.diagram.viewportBounds.containsRect(t)&&(o=!0);let r=this.Ct.r,a=r.length;for(let h=a;h--;){let l=r[h];if(o===!0&&l.Nl()===!1||!l.isVisible())continue;let u=l;l.Tm(t,e,i,s,n)&&(e!==null&&(u=e(u)),u!==null&&(i===null||i(u))&&n.add(u))}return n}OP(t,e,i,s,n,o,r){if(this.Kl===!1)return n;let a=this.Ct.r,h=a.length;for(let l=h;l--;){let u=a[l];if(r===!0&&u.Nl()===!1||!o(u)||!u.isVisible())continue;let c=u;u.Tm(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 j||n instanceof I)&&(o=n),n=!0),!(o instanceof j)&&!(o instanceof I)&&(o=new I),this.Kl===!1)return o;let r=!1;this.diagram!==null&&this.diagram.viewportBounds.containsPoint(t)&&(r=!0);let a=P.l(),h=P.l(),l=this.Ct.r,u=l.length;for(let c=u;c--;){let d=l[c];if(r===!0&&d.Nl()===!1||!d.isVisible())continue;a.a(t),a.Oe(d.Us),h.i(t.x+e,t.y),h.Oe(d.Us);let g=d;d.PL(a,h,i,s,n,o)&&(i!==null&&(g=i(g)),g!==null&&(s===null||s(g))&&o.add(g))}return P.e(a),P.e(h),o}qS(){return this.Ct.r}ps(t,e){if(!this.visible)return;let i=this.Ct.r,s=i.length;if(s===0)return;let n=f.et(),o=f.et();for(let r=0;r<s;r++){let a=i[r];if(a.WS=r,a instanceof _){if(a.Se===!1)continue}else if(a instanceof St&&a.adornedPart!==null)continue;let h=a.actualBounds;a.isVisible()&&h.intersectsRectPlus(e,10)?(a.ps(!0),n.push(a)):(a.ps(!1),a.adornments!==null&&a.adornments.count>0&&o.push(a))}for(let r=0;r<n.length;r++){let a=n[r];a.JS();let h=a.adornments;for(;h.next();){let l=h.value;l.ht(1/0,1/0),l.Bt(),l.ps(!0)}}for(let r=0;r<o.length;r++)o[r].JS();f.J(n),f.J(o)}Lu(t){let e=1;return this.$t!==1&&(e=t.globalAlpha,t.globalAlpha=e*this.$t),e}SL(t,e){for(let i=0;i<e;i++)t[i].Au()}Ui(t,e,i){if(!this.visible||this.$t===0||(i===void 0&&(i=!0),!i&&this.isTemporary))return;let s=this.Ct.r,n=s.length;if(n===0)return;t.kr&&this.SL(s,n);let o=this.Lu(t),r=this.Cu;r.length=0;let a=e.scale,h=z.l();for(let l=0;l<n;l++){let u=s[l];this.Dm(t,u,e,r,a,h,!0)}z.e(h),t.kr&&this.SL(s,n),t.globalAlpha=o}CE(t,e,i){if(!this.visible||this.$t===0)return;let s=this.Ct.r,n=s.length;if(n===0)return;let o=this.Lu(t),r=this.Cu;r.length=0;let a=e.scale,h=z.l();for(let l=0;l<n;l++){let u=s[l];i.has(u)||this.Dm(t,u,e,r,a,h,!0)}z.e(h),t.globalAlpha=o}GF(t,e,i,s){if(!this.visible||this.$t===0||!s&&this.isTemporary)return;let n=this.Ct.r,o=n.length;if(o===0)return;let r=this.Lu(t),a=this.Cu;a.length=0;let h=e.scale,l=z.l();for(let u=0;u<o;u++){let c=n[u];i.has(c)&&this.Dm(t,c,e,a,h,l,!1)}z.e(l),t.globalAlpha=r}KF(t,e,i,s,n){if(!this.visible||this.opacity===0)return;let o=this.diagram.grid.part;if(!s&&this.isTemporary){if(n&&o.layer===this){let r=this.Lu(t);o.Ui(t,i),t.globalAlpha=r}}else{let r=this.Lu(t),a=i.scale,h=z.l(),l=this.Ct.r,u=l.length;for(let c=0;c<u;c++){let d=l[c];!n&&d===o||this.Dm(t,d,i,null,a,h,!1)}z.e(h),t.globalAlpha=r}}LE(t,e,i){if(!this.visible||this.$t===0)return;let s=this.Lu(t),n=this.Cu;n.length=0;let o=e.scale,r=z.l(),a=this.Ct.r,h=a.length,l=i.length;for(let u=0;u<h;u++){let c=a[u],d=c.Wh(c.actualBounds);this.jF(d,i,l,o)&&this.Dm(t,c,e,n,o,r,!0)}z.e(r),t.globalAlpha=s}Dm(t,e,i,s,n,o,r){if(r&&!e.Nl()){t.removePartFromView(e);return}if(s!==null&&e instanceof _&&(e.isOrthogonal&&s.push(e),e.Se===!1)){t.removePartFromView(e);return}let a=!1,h=e.containingGroup;for(;h!==null;)a?h.si!==null&&o.intersectRect(h.si):h.si!==null&&(a=!0,o.a(h.si)),h=h.containingGroup;let l=e.actualBounds,u=!1;if(a&&e.isVisible()){if(!o.intersectsRect(l)){t.removePartFromView(e);return}u=!o.containsRect(l)}u&&(t.save(),t instanceof ce?t.partClipRect=o.copy():(t.beginPath(),t.rect(o.x,o.y,o.width,o.height),t.clip())),l.width*n>i.Fm||l.height*n>i.Fm?e.Ui(t,i):this.HF(t,e,i),u&&(t.restore(),t.clearContextCache(!0))}HF(t,e,i){if(t instanceof ce){e.Ui(t,i);return}let s=e.actualBounds,n=e.naturalBounds;if(s.width===0||s.height===0||isNaN(s.x)||isNaN(s.y)||!e.isVisible())return;let o=e.T;if(e.background===null){e.rn(t,"rgba(0,0,0,0.3)",!0,!1,n,s),t.fillRect(s.x,s.y,s.width,s.height);return}if(t.transform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),e.rn(t,e.background,!0,!1,n,s),t.fillRect(0,0,n.width/2,n.height/2),!o.Yk()){let r=1/(o.m11*o.m22-o.m12*o.m21);t.transform(o.m22*r,-o.m12*r,-o.m21*r,o.m11*r,r*(o.m21*o.dy-o.m22*o.dx),r*(o.m12*o.dx-o.m11*o.dy))}}jF(t,e,i,s){let n=2/s,o=4/s;for(let r=0;r<i;r++){let a=e[r];if(!(a.width===0||a.height===0)&&t.intersects(a.x-n,a.y-n,a.width+o,a.height+o))return!0}return!1}t(t,e,i,s,n){let o=this.diagram;o!==null&&o.raiseChangedEvent(2,t,this,e,i,s,n)}Jh(t,e,i){let s=this.Ct;if(e.HS(this),t>=s.count)t=s.count;else if(s.elt(t)===e)return-1;s.insertAt(t,e),e.Rm(i);let n=this.diagram;return n!==null&&(i?n.S():n.Jh(e)),this.Px(t,e),t}te(t,e,i){if(!i&&e.layer!==this&&e.layer!==null)return e.layer.te(t,e,i);let s=this.Ct;if(t<0||t>=s.length){if(t=s.indexOf(e),t<0)return-1}else if(s.elt(t)!==e&&(t=s.indexOf(e),t<0))return-1;e.vm(i),s.removeAt(t);let n=this.diagram;return n!==null&&(i?n.S():n.te(e)),e.HS(null),t}Px(t,e){t=this.qF(t,e),e instanceof ft&&this.WF(t,e),e.svg!==null&&e.svg.remove()}qF(t,e){let i=e.zOrder;if(isNaN(i))return t;let s=this.Ct,n=s.count;if(n<=1)return t;if(t<0&&(t=s.indexOf(e)),t<0)return-1;let o=t-1,r=NaN;for(;o>=0&&(r=s.elt(o).zOrder,!!isNaN(r));)o--;let a=t+1,h=NaN;for(;a<n&&(h=s.elt(a).zOrder,!!isNaN(h));)a++;if(!isNaN(r)&&r>i)for(;;){if(o===-1||r<=i)return o++,o===t?t:(s.removeAt(t),s.insertAt(o,e),o);for(r=NaN;--o>=0&&(r=s.elt(o).zOrder,!!isNaN(r)););}else if(!isNaN(h)&&h<i)for(;;){if(a===n||h>=i)return a--,a===t?t:(s.removeAt(t),s.insertAt(a,e),a);for(h=NaN;++a<n&&(h=s.elt(a).zOrder,!!isNaN(h)););}return t}WF(t,e){if(e===null||!isNaN(e.zOrder))return;this.JF(t,e);let i=e.containingGroup;i!==null&&this.Px(-1,i)}JF(t,e){if(e.memberParts.count===0)return;let i=-1,s=this.Ct.r,n=s.length;for(let o=0;o<n;o++){let r=s[o];if(r===e&&(t=o,i>=0)||i<0&&r.containingGroup===e&&(i=o,t>=0))break}if(!(i<0)&&i<t){let o=this.Ct;o.removeAt(t),o.insertAt(i,e)}}get parts(){return this.Ct.iterator}get partsBackwards(){return this.Ct.iteratorBackwards}get diagram(){return this.N}get name(){return this.St}set name(t){f.s(t,"string",Vt,"name");let e=this.St;if(e!==t){let i=this.diagram;if(i!==null){e===""&&f.o("Cannot rename default Layer to: "+t);let n=i.layers;for(;n.next();)n.value.name===t&&f.o("Layer.name is already present in this diagram: "+t)}this.St=t,this.t("name",e,t);let s=this.Ct.iterator;for(;s.next();){let n=s.value;n.layerName=this.St}}}get opacity(){return this.$t}set opacity(t){let e=this.$t;if(e!==t){f.s(t,"number",Vt,"opacity"),(t<0||t>1)&&f.W(t,"0 <= value <= 1",Vt,"opacity"),this.$t=t;let i=this.diagram;i!==null&&i.S(),this.t("opacity",e,t)}}get isViewportAligned(){return this.Am}set isViewportAligned(t){let e=this.Am;e!==t&&(this.Am=t,this.diagram&&(this.ML(),this.diagram.S()),this.t("isViewportAligned",e,t),t&&(this.isInDocumentBounds=!1))}ML(){if(!this.Am)return;let t=this.diagram,e=this.Ct.r,i=e.length,s=t.xt,n=t.bt;for(let o=0;o<i;o++){let r=e[o],a=r.naturalBounds.width,h=r.naturalBounds.height,l=r.alignment;(l.isDefault()||!l.isSpot())&&(l=D.BottomRight);let u=r.alignmentFocus;u.isDefault()&&(u=new D(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),g=P.V(c,d);t.$F(g),r.bc(g.x,g.y,!0),P.e(g),r.tt=1/t.scale}}get isTemporary(){return this.kr}set isTemporary(t){let e=this.kr;e!==t&&(f.s(t,"boolean",Vt,"isTemporary"),this.kr=t,this.t("isTemporary",e,t))}get visible(){return this.kc}set visible(t){let e=this.kc;if(e!==t){f.s(t,"boolean",Vt,"visible"),this.kc=t;let i=this.Ct.iterator;for(;i.next();)i.value.Ei(t);let s=this.diagram;s!==null&&s.S(),this.t("visible",e,t)}}get pickable(){return this.Kl}set pickable(t){let e=this.Kl;e!==t&&(f.s(t,"boolean",Vt,"pickable"),this.Kl=t,this.t("pickable",e,t))}get isInDocumentBounds(){return this.kx}set isInDocumentBounds(t){let e=this.kx;e!==t&&(this.kx=t,this.diagram!==null&&this.diagram.invalidateDocumentBounds(),this.t("isInDocumentBounds",e,t))}get allowCopy(){return this.Rl}set allowCopy(t){let e=this.Rl;e!==t&&(f.s(t,"boolean",Vt,"allowCopy"),this.Rl=t,this.t("allowCopy",e,t))}get allowDelete(){return this.vl}set allowDelete(t){let e=this.vl;e!==t&&(f.s(t,"boolean",Vt,"allowDelete"),this.vl=t,this.t("allowDelete",e,t))}get allowTextEdit(){return this.Ol}set allowTextEdit(t){let e=this.Ol;e!==t&&(f.s(t,"boolean",Vt,"allowTextEdit"),this.Ol=t,this.t("allowTextEdit",e,t))}get allowGroup(){return this.Il}set allowGroup(t){let e=this.Il;e!==t&&(f.s(t,"boolean",Vt,"allowGroup"),this.Il=t,this.t("allowGroup",e,t))}get allowUngroup(){return this.El}set allowUngroup(t){let e=this.El;e!==t&&(f.s(t,"boolean",Vt,"allowUngroup"),this.El=t,this.t("allowUngroup",e,t))}get allowLink(){return this.Ul}set allowLink(t){let e=this.Ul;e!==t&&(f.s(t,"boolean",Vt,"allowLink"),this.Ul=t,this.t("allowLink",e,t))}get allowRelink(){return this.Bl}set allowRelink(t){let e=this.Bl;e!==t&&(f.s(t,"boolean",Vt,"allowRelink"),this.Bl=t,this.t("allowRelink",e,t))}get allowMove(){return this.Vl}set allowMove(t){let e=this.Vl;e!==t&&(f.s(t,"boolean",Vt,"allowMove"),this.Vl=t,this.t("allowMove",e,t))}get allowReshape(){return this.zl}set allowReshape(t){let e=this.zl;e!==t&&(f.s(t,"boolean",Vt,"allowReshape"),this.zl=t,this.t("allowReshape",e,t))}get allowResize(){return this.Xl}set allowResize(t){let e=this.Xl;e!==t&&(f.s(t,"boolean",Vt,"allowResize"),this.Xl=t,this.t("allowResize",e,t))}get allowRotate(){return this.Yl}set allowRotate(t){let e=this.Yl;e!==t&&(f.s(t,"boolean",Vt,"allowRotate"),this.Yl=t,this.t("allowRotate",e,t))}get allowSelect(){return this.Gl}set allowSelect(t){let e=this.Gl;e!==t&&(f.s(t,"boolean",Vt,"allowSelect"),this.Gl=t,this.t("allowSelect",e,t))}}var xs=(x=>(x[x.None=1]="None",x[x.Uniform=2]="Uniform",x[x.UniformToFill=3]="UniformToFill",x))(xs||{}),Nn=(x=>(x[x.All=1]="All",x[x.NotDirected=2]="NotDirected",x[x.NotDirectedFast=3]="NotDirectedFast",x[x.NotUndirected=4]="NotUndirected",x[x.DestinationTree=5]="DestinationTree",x[x.SourceTree=6]="SourceTree",x))(Nn||{}),Cn=(x=>(x[x.Document=1]="Document",x[x.Infinite=2]="Infinite",x))(Cn||{}),An=(x=>(x[x.TreeParent=1]="TreeParent",x[x.AllParents=2]="AllParents",x[x.AnyParents=3]="AnyParents",x))(An||{});class U{ds;Wt;$S;Sx;Pr;Tu;Mx;Nx;Cx;Lx;Ax;Tx;$h;qh;Dx;Fx;Rx;jl;Fc;Sr;Om;vx;Ox;Du;Yn;Mr;Zh;Co;Im;Rc;Em;vc;Fu;Nr;Gn;ZS;QS;Ix;Ex;_S;Ux;tM;iM;eM;Bx;Um;Cr;Lr;Ar;Tr;Dr;Fr;Vx;Rr;zx;vr;Or;Ir;Er;Xx;sM;Lo;nM;Yx;Gx;oM;ki;rM;lM;hM;Os;Ao;Oi;Kx;Rl;vl;jx;Hx;Ol;Il;El;qx;Ul;Bl;Vl;zl;Xl;Yl;Gl;Wx;Jx;aM;Ru;vu;$x;Zx;Qx;_x;Bm;tb;ib;eb;Zt;cM;sb;fM;Ou;ln;Kn;ie;jn;NL;Hl;uM;dM;Vm;nb;Iu;zm;ob;Ur;ql;Qh;gM;mM;Xm;rb;lb;Ze;Eu;Ym;Uu;Wl;Oc;Gm;Br;_h;pM;Km;Ht;T;Ue;xr;Bi;ys;yM;Jl;Vr;bl;zr;ta;Ic;wM;Bu;ia;Vu;Xt;$l;at;tt;zu;xt;bt;ft;Ec;Bw;hb;ea;Uc;ab;cb;fb;ZF;QF;Vi;Pl;Fm;jm;xM;bM;CL;Hm;_F;tR;iR;ub;eR;sR;nR;sa;LL;Zl;na;oa;ra;la;mu;jh;Qt;Mt;Bc;eP;sP;gc;$t;static db=null;static AL=new pt;static kM;static PM=null;gu;gb;pb;yb;wb;xb;qm;SM;Wm;Jm;$m;nx;MM;NM;Vc;constructor(t,e){if(U.mw||(U.Gk(),U.mw=!0),I.Ki(this),U.TL(this),this.Ht=!0,this.Mt=null,this.xt=0,this.bt=0,this.ft=null,U.isUsingDOM()){let s=this,n=()=>{s.Pi(A.document,"DOMContentLoaded",n,!1),s.setRTL()};A.document.body!==null?this.setRTL():s.Ut(A.document,"DOMContentLoaded",n,!1)}this.Ec=null,U.CM("Model",Se);let i=this;return this.rM=s=>i.partManager.doModelDataChanged(s),this.lM=s=>i.partManager.doModelChanged(s),this.ab=null,this.cb=null,this.DL(),this.model=yt.LM(),this.themeManager=new ai,this.Lo=!0,this.FL(),this.layout=new ne,this.Lo=!1,this._F=null,this.tR=null,this.iR=null,this.ub=null,this.eR=null,this.sR=null,this.nR=null,this.sa=null,this.LL=null,this.Zl=null,this.na=null,this.oa=null,this.ra=null,this.la=null,this.mu=()=>{},this.jh=null,this.Uu=!1,this.Bc=new _o(this),t!==void 0&&(typeof t=="string"||A.Element&&t instanceof Element?this.AM(t):e=t),e&&this.setProperties(e),this.Ht=!1,this.requestUpdate(),this}mF(){return this.ft!==null}get renderer(){return this.Oc}set renderer(t){if(this instanceof _i)return;t===""&&(t="default");let e=t.toLowerCase(),i=this.Oc;if(e===i)return;this.Oc=e;let s=null;e==="default"||e==="canvas"?(s=this.Wl.get("svg"),s!==null&&s.Tt.remove(),this.ft&&(this.Qt=this.ft.li),this.Qt.clearContextCache(!0)):e==="svg"?(this.Wl.has("svg")?s=this.Wl.get("svg"):(s=new Ri(this,A.document),this.addRenderer("svg",s)),this.div!==null&&this.div.appendChild(s.Tt),this.Qt=s.li,this.ft&&(this.ft.li.setTransform(this.Vi,0,0,this.Vi,0,0),this.ft.li.clearRect(0,0,this.xt,this.bt))):e==="debug"&&(this.Wl.has("SVG")||(s=new Ri(this,A.document),this.addRenderer("SVG",s),s.Tt.style.backgroundColor="whitesmoke",this.div!==null&&this.div.after(s.Tt))),this.Ht||this.redraw()}DL(){this.Vc=new j,this.setupRouters(),this.ds=new pe,this.ds.Mo(this),this.Wt=17,this.$S=!1,this.zu=!1,this.Sx="default",this.Xt=new j,this.Wl=new pt,this.Oc="default",this.resetRenderingHints(),this.oR(),this.$t=1,this.at=new P(NaN,NaN).u(),this.nx=new P(NaN,NaN),this.tt=1,this.Km=1,this.Mx=new P(NaN,NaN).u(),this.Nx=NaN,this.Cx=1e-4,this.Lx=100,this.T=new Pt,this.Ax=new P(NaN,NaN).u(),this.Tx=new z(NaN,NaN,NaN,NaN).u(),this.$h=new Lt(0,0,0,0).u(),this.qh=1,this.Dx=!1,this.Fx=null,this.Rx=null,this.jl=1,this.Fc=D.Default,this.Sr=1,this.Om=D.Default,this.vx=D.None,this.Ox=D.None,this.Ue=!0,this.Du=!1,this.Yn=new Set,this.Mr=new I,this.Zh=new I,this.Co=!1,this.$l=new pt,this.Bu=!0,this.Im=250,this.Rc=-1,this.Em=new Lt(16,16,16,16).u(),this.xr=!1,this.vc=!1,this.Fu=!0,this.Gm=new je,this.Gm.diagram=this,this.Br=new je,this.Br.diagram=this,this._h=new je,this._h.diagram=this,this.Nr=null,this.Gn=null,this.Bw=!1,this.rR(),this.zr=new I,this.Ix=!0,this.Ex=1,this._S=!1,this.Ux=1,this.Bx="auto",this.Um="auto",this.Cr=null,this.Lr=null,this.Ar=null,this.Tr=null,this.Dr=null,this.Fr=null,this.Vx=null,this.Rr=null,this.zx=!1,this.vr=null,this.Or=null,this.Ir=null,this.Er=null,this.Xx=!1,this.hb={},this.ea=[null,null],this.Lo=!1,this.nM=!1,this.Yx=!1,this.Gx=!1,this.oM=!0,this.ys=!1,this.ia=!1,this.hM=!0,this.Os=-2,this.Jl=new pt,this.Vu=new j,this.Ao=!1,this.Oi=!0,this.Kx=!0,this.Rl=!0,this.vl=!0,this.jx=!1,this.Hx=!0,this.Ol=!0,this.Il=!0,this.El=!0,this.qx=!0,this.Ul=!0,this.Bl=!0,this.Vl=!0,this.zl=!0,this.Xl=!0,this.Yl=!0,this.Gl=!0,this.Wx=!0,this.Jx=!0,this.aM=!1,this.Uc=!1,this.Ru=!0,this.vu=!0,this.$x=!0,this.Zx=!0,this.Qx=16,this._x=16,this.Bm=!1,this.tb=!1,this.ib=0,this.eb=0,this.Zt=new Lt(5).u(),this.cM=new I().u(),this.sb=999999999,this.fM=new I().u(),this.ta=!0,this.Ou=!0,this.Ic=!0,this.ln=!1,this.Kn=!1,this.Vr=!0,this.bl=!1,this.jn=!1,this.NL=new I,this.wM=new I,this.Hl=null,this.uM=new Q(8,8),this.dM=999,this.Vm=!1,this.eP=1,this.sP=0,this.Bi={scale:1,position:new P,bounds:new z,canvasSize:new Q,newCanvasSize:new Q,isScroll:!1},this.Bi.canvasSize=this.Bi.canvasSize,this.Bi.newCanvasSize=this.Bi.newCanvasSize,this.Bi.isScroll=!1,this.nb=new z(NaN,NaN,NaN,NaN).u(),this.Iu=new Q(NaN,NaN).u(),this.zm=new z(NaN,NaN,NaN,NaN).u(),this.ob=!1,this.lR(),this.Ze=null,this.Eu=!1,this.gc=null,this.partManager=new Se,this.toolManager=new xe,this.toolManager.initializeStandardTools(),this.defaultTool=this.toolManager,this.currentTool=this.defaultTool,this.pb=null,this.yb=new Qi,this.wb=null,this.xb=null,this.gb=!1,this.gu=!1,this.commandHandler=new be,this.Jm=null,this.$m=P.Ik,this.MM=!1,this.Vi=1,this.Pl=null,this.Fm=1,this.qm=0,this.SM=[0,0,0,0,0],this.Wm=0,this.jm=1,this.xM=0,this.bM=new P,this.CL=500,this.Ym=new P,this.Hm=!1}static RL=A.document!==void 0;static isUsingDOM(){return U.RL}static useDOM(t){U.RL=t?A.document!==void 0:!1}static Qe=new WeakMap;clear(){this.animationManager.stopAnimation(),this.model.clear(),U.vL(),this.OL(!1),this.Vu.clear(),this.IL(),this.Hl=null,this.invalidateDocumentBounds(),this.ensureBounds(),this.S()}OL(t){this.animationManager.stopAnimation(!0),this.cM=new I().u(),this.fM=new I().u();let e=this.skipsUndoManager,i=this.ki!==null&&this.ki!==void 0;i&&(this.skipsUndoManager=!0);let s=null;this.Ze!==null&&(s=this.Ze.part,s!==null&&this.remove(s));let n=[],o=this.Xt.length;if(t){for(let r=0;r<o;r++){let a=this.Xt.r[r].parts;for(;a.next();){let h=a.value;h!==s&&h.data===null&&n.push(h)}}for(let r=0;r<n.length;r++){let a=n[r];this.remove(a)}}for(let r=0;r<o;r++)this.Xt.r[r].YF();return this.partManager.clear(),this.Yn.clear(),this.Mr.clear(),this.Zh.clear(),this.$l.clear(),this.zr.clear(),this.gc=null,this.Vu.clear(),this.IL(),f.vk=[],s!==null&&(this.add(s),this.partManager.parts.delete(s)),i&&(this.skipsUndoManager=e),n}static Zm=null;static bb="";static vL(){U.Zm=null,U.bb=""}static AE(){return null}reset(){this.clear(),this.Ht=!0,this.DL(),this.themeManager=new ai,this.Ql(),this.Lo=!0,this.FL(),this.layout=new ne,this.Lo=!1,this.model=yt.LM(),this.model.undoManager=new $i,this.Uu=!1,this.Ht=!1,this.S()}lR(){this.Ur=new pt,this.gM=new rt().add(new xt({stroke:"black",font:"10pt sans-serif"}).bind("text","",f.toString).theme("stroke","text").theme("font","normal")),this.Ur.set("",this.gM),this.Ur.set("Comment",new rt().add(new xt({stroke:"brown",font:"10pt sans-serif"}).bind("text","",f.toString).theme("stroke","comment").theme("font","normal"))),this.Ur.set("LinkLabel",new rt({selectable:!1,avoidable:!1}).add(new ut("Ellipse",{fill:"black",stroke:null,desiredSize:new Q(3,3).$()}).theme("fill","link"))),this.Qh=new pt,this.yM=new ft(H.Vertical,{selectionObjectName:"GROUPPANEL"}).add(new xt({stroke:"black",font:"bold 12pt sans-serif"}).bind("text","",f.toString).theme("stroke","text").theme("font","bold"),new H(H.Auto,{name:"GROUPPPANEL"}).add(new ut({fill:"rgba(128,128,128,0.2)",stroke:"black",strokeWidth:1}).theme("fill","group").theme("stroke","outline").theme("strokeWidth","group"),new ve({padding:5}).theme("padding","group"))),this.Qh.set("",this.yM),this.ql=new pt,this.mM=new _().add(new ut({isPanelMain:!0,stroke:"black"}).theme("stroke","link"),new ut({toArrow:"Standard",fill:"black",stroke:null,strokeWidth:0}).theme("toArrow").theme("fill","link")),this.ql.set("",this.mM),this.ql.set("Comment",new _().add(new ut({isPanelMain:!0,stroke:"brown"}).theme("stroke","comment"))),this.Xm=new St(H.Auto).add(new ut({fill:null,stroke:"dodgerblue",strokeWidth:3}).theme("stroke","selection").theme("strokeWidth","selection"),new ve({margin:1.5}).theme("margin","selection","numbers",null,t=>t?new Lt(t/2):1.5)),this.rb=this.Xm,this.lb=new St(H.Link).add(new ut({isPanelMain:!0,fill:null,stroke:"dodgerblue",strokeWidth:3}).theme("stroke","selection").theme("strokeWidth","selection"))}setRTL(t){let e=t===void 0?this.div:t;e===null&&(e=A.document.body);let i=f.hs("div");i.dir="rtl",i.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;",i.textContent="A",e.appendChild(i);let s="reverse";i.scrollLeft>0?s="default":(i.scrollLeft=1,i.scrollLeft===0&&(s="negative")),e.removeChild(i),this.Sx=s}setScrollWidth(t){let e=t===void 0?this.div:t;e===null&&(e=A.document.body);let i=0;if(U.isUsingDOM()){let s=U.PM,n=U.kM;s===null&&(U.PM=f.hs("p"),s=U.PM,s.style.width="100%",s.style.height="200px",s.style.boxSizing="content-box",U.kM=f.hs("div"),n=U.kM,n.style.position="absolute",n.style.visibility="hidden",n.style.width="200px",n.style.height="150px",n.style.boxSizing="content-box",n.appendChild(s)),n.style.overflow="hidden",e.appendChild(n);let o=s.offsetWidth;n.style.overflow="scroll";let r=s.offsetWidth;o===r&&(r=n.clientWidth),e.removeChild(n),i=o-r,i===0&&!f.tr&&(i=11)}this.Wt=i,this.$S=!0}oi(t){t in xs?this.autoScale=t:f.er(this,t)}toString(t){t===void 0&&(t=0);let e="";this.div&&this.div.id&&(e=this.div.id);let i='Diagram "'+e+'"';if(t<=0)return i;let s=this.Xt.iterator;for(;s.next();){let n=s.value;i+=`
|
9
|
-
`+n.toString(t-1)}return i}static TL(t){U.db=t}static um(){return U.db}static fromDiv(t){let e=t;if(typeof t=="string"&&(e=A.document.getElementById(t)),e instanceof HTMLDivElement){let i=U.Qe.get(e);if(i)return i}return null}get div(){return this.Mt}set div(t){if(this.Mt!==t){let e=this.Mt;if(e!==null){if(U.Qe.delete(e),e.goDiagram=void 0,e.go=void 0,e.innerHTML="",this.ft!==null){let s=this.ft.Tt;this.Pi(s,"pointermove",this.na,!1),this.Pi(s,"pointerdown",this.Zl,!1),this.Pi(s,"pointerup",this.oa,!1),this.Pi(s,"pointerout",this.ra,!1),this.Pi(s,"pointercancel",this.la,!1),this.ft.dispose()}this.Ec&&(this.Ec.disconnect(),this.Ec=null);let i=this.toolManager;i!==null&&(i.mouseDownTools.each(s=>s.cancelWaitAfter()),i.mouseMoveTools.each(s=>s.cancelWaitAfter()),i.mouseUpTools.each(s=>s.cancelWaitAfter())),i.cancelWaitAfter(),this.currentTool.doCancel(),this.ft=null,this.Pi(A,"resize",this.ub,!1),this.Pi(A,"wheel",this.sa,!0),U.um()===this&&U.TL(null)}else this.Zl===null&&(this.jn=!1);if(this.Mt=null,t!==null){let i=U.Qe.get(t);i&&(i.div=null),this.AM(t),this.mu(),this.themeManager&&this.themeManager.hR()}else this.themeManager&&this.themeManager.aR()}}setupRouters(){this.Vc.push(new br)}AM(t){let e=this;if(!U.isUsingDOM())return;t==null&&f.o("Diagram setup requires an argument DIV."),e.Mt!==null&&f.o("Diagram has already completed setup."),typeof t=="string"?e.Mt=A.document.getElementById(t):t instanceof HTMLDivElement?e.Mt=t:f.o("No DIV or DIV id supplied: "+t),e.Mt===null&&f.o("Invalid DIV id; could not get element with id: "+t);let i=U.Qe.get(e.Mt);if(i&&i!==this&&f.o("Invalid div id; div already has a Diagram associated with it."),!e.Ec&&A.ResizeObserver){let u=A.ResizeObserver,c=f.Rk(()=>e.requestUpdate(),250,!1);e.Ec=new u(()=>c()),e.Ec.observe(e.Mt)}A.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="",U.Qe.set(e.Mt,e),e.Mt.goDiagram=e,e.Mt.go=A.go;let o=new Ue(e);o.style!==void 0&&(o.style.position="absolute",o.style.top="0px",o.style.left="0px",A.getComputedStyle(e.Mt,null).getPropertyValue("direction")==="rtl"&&(e.zu=!0),o.style.zIndex="2",o.style.userSelect="none",o.style.MozUserSelect="none",o.style.touchAction="none",o.style.letterSpacing="normal !important",o.style.wordSpacing="normal !important",o.style.lang="unknown"),e.ft=o,e.Qt=o.li;let r=e.Qt;e.Vi=e.computePixelRatio(),e.viewSize.isReal()||(e.xt=e.Mt.clientWidth||1,e.bt=e.Mt.clientHeight||1),e.EL(e.xt,e.bt);let a=e;e.Mt.insertBefore(o.Tt,e.Mt.firstChild);let h=new Ue(null);if(h.width=1,h.height=1,e.ZF=h,e.QF=h.li,U.isUsingDOM()){let u=f.hs("div"),c=f.hs("div");u.style.position="absolute",u.style.overflow="auto",u.style.width=e.xt+"px",u.style.height=e.bt+"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=U.cR,u.addEventListener("pointerdown",U.fR),u.N=e,u.uR=!0,u.dR=!0,e.ab=u,e.cb=c}e.mu=f.Rk(()=>{e.Pl=null,e.S()},300,!1),e.ub=f.Rk(()=>{e.IS()},250,!1),e.jh=u=>(u.preventDefault(),!1),e.sa=u=>{if(!a.isEnabled)return;let c=a.zc(u,!0);c.bubbles=!0;let d=0,g=0;c.delta=0,u.deltaX!==void 0?(u.deltaX!==0&&(d=u.deltaX>0?1:-1),u.deltaY!==0&&(g=u.deltaY>0?1:-1),c.delta=Math.abs(u.deltaX)>Math.abs(u.deltaY)?-d:-g):u.wheelDeltaX!==void 0?(u.wheelDeltaX!==0&&(d=u.wheelDeltaX>0?-1:1),u.wheelDeltaY!==0&&(g=u.wheelDeltaY>0?-1:1),c.delta=Math.abs(u.wheelDeltaX)>Math.abs(u.wheelDeltaY)?-d:-g):u.wheelDelta!==void 0&&u.wheelDelta!==0&&(c.delta=u.wheelDelta>0?1:-1),a.doMouseWheel(),a.ha(c,u)},e.LL=u=>{if(!a.isEnabled)return;e.Uc=!1,a.zc(u,!0);let c=a.currentTool;c.cancelWaitAfter(),c.standardMouseOver()},e.Zl=u=>{if(!a.isEnabled)return;e.Uc=!0;let c=a.hb;c[u.pointerId]===void 0&&(c[u.pointerId]=u);let d=a.ea,g=!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,g=!0;else if(d[0]===null)d[0]=u;else if(d[1]===null)d[1]=u,g=!0;else{u.preventDefault();return}let p=u.pointerType==="touch"||u.pointerType==="pen";p&&(a.Bw=!1,a.Hm=!0);let m=a.gR(u,u,g),y=a.bM,w=p?25:10;if(u.timeStamp-a.xM<a.CL&&!(Math.abs(y.x-u.screenX)>w||Math.abs(y.y-u.screenY)>w)?a.jm++:a.jm=1,m.clickCount=a.jm,a.xM=u.timeStamp,a.bM.setTo(u.screenX,u.screenY),a.doMouseDown(),u.button===1){u.preventDefault();return}a.ha(m,u)},e.na=u=>{if(!a.isEnabled)return;e.Uc=!0;let c=a.ea;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.mR(u,u,c[1]!==null);a.doMouseMove(),a.ha(d,u)},e.oa=u=>{if(!a.isEnabled)return;e.Uc=!0;let c=u.pointerType==="touch"||u.pointerType==="pen",d=a.hb;if(c&&a.Bw){delete d[u.pointerId],u.preventDefault();return}let g=a.ea;if(g[0]!==null&&(g[0].pointerId===u.pointerId||g[0].pointerType!==u.pointerType))g[0]=null;else if(g[1]!==null&&g[1].pointerId===u.pointerId){g[1]=null;return}else return;let p=a.TM(u,!1,!0,!1,!0,!1),m=A.document.elementFromPoint(u.clientX,u.clientY)||null;m!==null&&m.shadowRoot!==void 0&&m.shadowRoot!==null&&(m=m.shadowRoot.elementFromPoint(u.clientX,u.clientY)),m!==null&&m.N instanceof U&&m.N!==a&&m.N.Qm(u,p),m===null&&(m=u.target),a.Qm(u,p),p.clickCount=a.jm,p.targetDiagram=a.kb(u,m),p.targetObject=null,a.doMouseUp(),a.ha(p,u),c&&(a.Hm=!1)},e.ra=u=>{if(!a.isEnabled)return;e.Uc=!1;let c=a.hb;c[u.pointerId]&&delete c[u.pointerId];let d=a.ea;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 g=a.currentTool;g.cancelWaitAfter(),g.standardMouseOver()},e.la=u=>{let c=a.ea;c[0]!==null&&c[0].pointerId===u.pointerId?(c[0]=null,a.Hm=!1):c[1]!==null&&c[1].pointerId===u.pointerId&&(c[1]=null)};let l=r;if(e.fb=l.E[f.Ts("7eba17a4ca3b1a8346")][f.Ts("78a118b7")](l.E,U.Xu,s,s),r.clearContextCache(!0),e.pR(),this.Oc==="svg"){let u=this.Wl.get("svg");this.Mt&&this.Mt.appendChild(u.Tt),this.Qt=u.li}}addEventListener(t,e,i,s){t.addEventListener(e,i,{capture:s,passive:!1})}Ut(t,e,i,s){t.addEventListener(e,i,{capture:s,passive:!1})}removeEventListener(t,e,i,s){t.removeEventListener(e,i,{capture:s})}Pi(t,e,i,s){t.removeEventListener(e,i,{capture:s})}pR(){let t=this,e=this.ft.Tt;e instanceof HTMLCanvasElement||(e=t.div),this.Ut(e,"pointerdown",t.Zl,!1),this.Ut(e,"pointermove",t.na,!1),this.Ut(e,"pointerup",t.oa,!1),this.Ut(e,"pointerout",t.ra,!1),this.Ut(e,"pointercancel",t.la,!1),this.Ut(e,"pointerenter",t.yR,!1),this.Ut(e,"pointerleave",t.wR,!1),this.Ut(e,"wheel",t.sa,!1),this.Ut(e,"keydown",t.xR,!1),this.Ut(e,"keyup",t.bR,!1),this.Ut(e,"blur",t.kR,!1),this.Ut(e,"focus",t.PR,!1),this.Ut(e,"selectstart",i=>(i.preventDefault(),!1),!1),this.Ut(e,"contextmenu",i=>(i.preventDefault(),!1),!1),this.Ut(A,"resize",t.ub,!1)}Vw(){this.qm>30&&(this.Pl=1)}CP(t){this.Pl!==null&&(this.Pl=null,t&&this.mu(),this.qm=0,this.SM=[0,0,0,0,0],this.Wm=0)}computePixelRatio(){return this.Pl!==null?this.Pl:A.devicePixelRatio||1}get avgSpf(){return this.qm}doMouseDown(){this.currentTool.doMouseDown()}doMouseMove(){this.currentTool.doMouseMove()}doMouseUp(){this.currentTool.doMouseUp()}doMouseWheel(){this.currentTool.doMouseWheel()}doKeyDown(){this.currentTool.doKeyDown()}doKeyUp(){this.currentTool.doKeyUp()}doFocus(){this.focus()}focus(){if(this.ft)if(this.scrollsPageOnFocus)this.ft.focus();else{let t=A.scrollX,e=A.scrollY;this.ft.focus(),A.scrollTo(t,e)}}PR(t){let e=U.Qe.get(this);e&&e.D("GainedFocus")}kR(t){let e=U.Qe.get(this);e&&e.D("LostFocus")}IS(){if(this.ft===null)return;let t=this.Mt;if(t===null||t.clientWidth===0||t.clientHeight===0)return;this.$S||this.setScrollWidth();let e=this.Kn?this.Wt:0,i=this.ln?this.Wt:0,s=this.Vi;if(this.Vi=this.computePixelRatio(),this.Vi!==s&&(this.Du=!0,this.requestUpdate()),t.clientWidth!==this.xt+e||t.clientHeight!==this.bt+i){this.aa(),this.Ue=!0;let n=this.layout;n!==null&&n.isViewportSized&&this.autoScale===1&&(this.vc=!0,n.invalidateLayout()),this.ys||this.requestUpdate()}}FL(){let t=0,e=new Vt;e.name="Grid",e.allowSelect=!1,e.pickable=!1,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Xr(e,t++),e=new Vt,e.name="ViewportBackground",e.isViewportAligned=!0,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Xr(e,t++),e=new Vt,e.name="Background",this.Xr(e,t++),e=new Vt,e.name="",this.Xr(e,t++),e=new Vt,e.name="Foreground",this.Xr(e,t++),e=new Vt,e.name="ViewportForeground",e.isViewportAligned=!0,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Xr(e,t++),e=new Vt,e.name="Adornment",e.isTemporary=!0,e.isInDocumentBounds=!1,this.Xr(e,t++),e=new Vt,e.name="Tool",e.isTemporary=!0,e.isInDocumentBounds=!0,this.Xr(e,t++)}UL(){let t=new H(H.Grid,{name:"GRID"}).add(new ut("LineH",{stroke:"lightgray",strokeWidth:.5,interval:1}).theme("stroke","gridMinor"),new ut("LineV",{stroke:"lightgray",strokeWidth:.5,interval:1}).theme("stroke","gridMinor"),new ut("LineH",{stroke:"gray",strokeWidth:.5,interval:5}).theme("stroke","gridMajor"),new ut("LineV",{stroke:"gray",strokeWidth:.5,interval:5}).theme("stroke","gridMajor"),new ut("LineH",{stroke:"gray",strokeWidth:1,interval:10}).theme("stroke","gridMajor"),new ut("LineV",{stroke:"gray",strokeWidth:1,interval:10}).theme("stroke","gridMajor")),e=new Nt({layerName:"Grid",zOrder:0,isInDocumentBounds:!1,isAnimated:!1,pickable:!1,locationObjectName:"GRID"}).add(t);return this.add(e),this.partManager.parts.delete(e),t.visible=!1,t}static cR(){let t=U.Qe.get(this.parentElement||this);if(t){if(t.tb){t.tb=!1;return}if(!t.isEnabled){t.BL();return}t.diagramScroll(this)}}static fR(t){if(!this.N.isEnabled){this.N.updateScroll();return}this.N.ib=t.target.scrollTop,this.N.eb=t.target.scrollLeft}diagramScroll(t){if(this.ft===null)return;let e=this.ab,i=this.cb;this.Bm=!0;let s=this.documentBounds,n=this.viewportBounds,o=this.$h,r=s.x-o.left,a=s.y-o.top,h=s.width+o.left+o.right,l=s.height+o.top+o.bottom,u=s.right+o.right,c=s.bottom+o.bottom,d=n.x,g=n.y,p=n.width,m=n.height,y=n.right,w=n.bottom,b=this.scale,v,k=t.scrollLeft;if(this.zu)switch(this.Sx){case"negative":k=k+t.scrollWidth-t.clientWidth;break;case"reverse":k=t.scrollWidth-k-t.clientWidth;break}let S=k;if(p<h||m<l){v=P.V(this.position.x,this.position.y),this.allowHorizontalScroll&&this.eb!==S&&(v.x=S/b+r,this.eb=S),this.allowVerticalScroll&&this.ib!==t.scrollTop&&(v.y=t.scrollTop/b+a,this.ib=t.scrollTop),this.position=v,P.e(v),this.Bm=!1,this.Ou=!1;return}if(v=P.l(),t.uR&&this.allowHorizontalScroll&&(r<d&&(this.position=v.i(S+r,this.position.y)),u>y)){let M=e.scrollWidth-this.xt;this.position=v.i(-M+S-this.xt/b+u,this.position.y)}if(t.dR&&this.allowVerticalScroll&&(a<g&&(this.position=v.i(this.position.x,t.scrollTop+a)),c>w)){let M=e.scrollHeight-this.bt;this.position=v.i(this.position.x,-M+t.scrollTop-this.bt/b+c)}P.e(v),this._l(),this.Bm=!1,this.Ou=!1,s=this.documentBounds,n=this.viewportBounds,u=s.right,y=n.right,c=s.bottom,w=n.bottom,r=s.x,d=n.x,a=s.y,g=n.y,p>=h&&r>=d&&u<=y&&(i.style.width="1px"),m>=l&&a>=g&&c<=w&&(i.style.height="1px")}computeBounds(t){return t===void 0&&(t=new z),this.Mi(),this.VL(t)}VL(t){if(this.fixedBounds.isReal())return t.a(this.fixedBounds),t.addMargin(this.Zt),t;let e=!0,i=this.Xt.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];if(!o.visible||!o.isInDocumentBounds)continue;let r=o.Ct.r,a=r.length;for(let h=0;h<a;h++){let l=r[h];if(!l.isInDocumentBounds||!l.isVisible())continue;let u=l.actualBounds;u.isReal()&&(e?(e=!1,t.a(u)):t.unionRect(u))}}return e&&t.i(0,0,0,0),t.addMargin(this.Zt),t}computePartsBounds(t,e){e===void 0&&(e=!1);let i=null;if(Array.isArray(t))for(let s=0;s<t.length;s++){let n=t[s];!e&&n instanceof _||(n.ensureBounds(),i===null?i=n.actualBounds.copy():i.unionRect(n.actualBounds))}else{let s=t.iterator;for(;s.next();){let n=s.value;!e&&n instanceof _||(n.ensureBounds(),i===null?i=n.actualBounds.copy():i.unionRect(n.actualBounds))}}return i===null?new z(NaN,NaN,0,0):i}Bs(t){if(!t&&!this.jn||this.Ht||this.ft===null||!this.documentBounds.isReal())return;if(this.Ht=!0,t){let c=this.initialPosition;if(c.isReal()){this.Ht=!1,this.position=c;return}let d=this.initialDocumentSpot,g=this.initialViewportSpot;d.isNoSpot()&&(d=D.TopLeft),g.isNoSpot()&&(g=D.TopLeft);let p=P.l();p.setRectSpot(this.documentBounds,d);let m=this.viewportBounds,y=z.V(0,0,m.width,m.height),w=P.l();w.setRectSpot(y,g),w.i(p.x-w.x,p.y-w.y),this.Ht=!1,this.position=w,z.e(y),P.e(w)}let e=this.jl;t&&this.Sr!==1&&(e=this.Sr);let i=e!==1?this.Yu(e):this.scale,s=this.at.x,n=this.at.y,o=this.xt/i,r=this.bt/i,a=this.Fc,h=this.Om;if(t&&!a.isSpot()&&(h.isSpot()||h.isDefault())){let c=this.initialDocumentSpot.isSpot()&&this.initialViewportSpot.isSpot();a=h.isDefault()&&!c?D.Center:h}this.DM(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 z(s,n,o,r),u,l,!1)}Yu(t){let e=this.Km;if(this.ft===null)return e;if(t===1)return this.scale;this.ensureBounds();let i=this.documentBounds;if(!i.isReal())return e;let s=i.width,n=i.height,o=this.xt+(this.Kn?this.Wt:0),r=this.bt+(this.ln?this.Wt:0),a=o/s,h=r/n,l=this.$h,u=l.left+l.right!==0,c=l.top+l.bottom!==0;(u||c)&&(h===a?(h=(r-this.Wt)/n,a=(o-this.Wt)/s):h>a?h=(r-this.Wt)/n:a=(o-this.Wt)/s);let d=0;return t===2?d=Math.min(h,a):t===3&&(h>a?d=(r-this.Wt)/n:d=(o-this.Wt)/s),d>e&&(d=e),d<this.minScale&&(d=this.minScale),d>this.maxScale&&(d=this.maxScale),d}zoomToFit(){let t=this.qh;this.qh=1,this.scale=this.Yu(2),this.alignDocument(D.Center,D.Center),t!==1&&(this.Bs(!1),this.DM(this.documentBounds,this.xt/this.tt,this.bt/this.tt,this.Fc,!1)),this.qh=t}zoomToRect(t,e){e===void 0&&(e=2);let i=t.width,s=t.height;if(i===0||s===0||isNaN(i)&&isNaN(s))return;let n=1;if(e===2||e===3)if(isNaN(i))n=this.viewportBounds.height*this.scale/s;else if(isNaN(s))n=this.viewportBounds.width*this.scale/i;else{let o=this.xt,r=this.bt;e===3?r/s>o/i?n=(r-(this.ln?this.Wt:0))/s:n=(o-(this.Kn?this.Wt:0))/i:n=Math.min(r/s,o/i)}this.scale=n,this.position=new P(t.x,t.y)}get SR(){return this.Ht}set SR(t){this.Ht=t}alignDocument(t,e){this.ensureBounds();let i=this.documentBounds,s=this.viewportBounds;this.position=new P(i.x+(t.x*i.width+t.offsetX)-(e.x*s.width-e.offsetX),i.y+(t.y*i.height+t.offsetY)-(e.y*s.height-e.offsetY))}focusObject(t){if(t instanceof dt){this.Jm=t;let e=P.l();this.$m=this.transformDocToView(t.getDocumentPoint(D.TopLeft,e)),P.e(e)}else this.Jm=null,this.$m=P.Ik}DM(t,e,i,s,n){let o=P.V(this.at.x,this.at.y),r=o.x,a=o.y;if(this.Jm!==null){let h=P.l();h=this.Jm.getDocumentPoint(D.TopLeft,h),r=h.x-this.$m.x/this.scale,a=h.y-this.$m.y/this.scale,s=D.None,P.e(h)}if(n||this.scrollMode===1){s.isSpot()&&(e>t.width&&(r=t.x+(s.x*t.width+s.offsetX)-(s.x*e-s.offsetX)),i>t.height&&(a=t.y+(s.y*t.height+s.offsetY)-(s.y*i-s.offsetY)));let h=this.$h,l=e-t.width;if(e<t.width+h.left+h.right){let 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.Zt.left,o.y=isFinite(a)?a:-this.Zt.top,this.positionComputation!==null){let h=this.positionComputation(this,o);o.x=h.x,o.y=h.y}this.ds.pL(this.at,o),this.at.i(o.x,o.y),this._m(),this.Ql(),this.MR(),P.e(o)}findPartAt(t,e){if(e===void 0&&(e=!0),e){let i=this.FP(t,s=>s.part,s=>s.canSelect());if(i instanceof Nt)return i}else{let i=this.FP(t,s=>s.part);if(i instanceof Nt)return i}return null}findObjectAt(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null),this.Mi();let s=this.Xt.iteratorBackwards;for(;s.next();){let n=s.value;if(!n.visible)continue;let o=n.findObjectAt(t,e,i);if(o!==null)return o}return null}FP(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null),this.Mi();let s=this.Xt.iteratorBackwards;for(;s.next();){let n=s.value;if(!n.visible||n.isTemporary)continue;let o=n.findObjectAt(t,e,i);if(o!==null)return o}return null}findPartsAt(t,e,i){return e===void 0&&(e=!0),this.NR(t,s=>s.part,e?s=>s instanceof Nt&&s.canSelect():null,i)}NR(t,e,i,s){e===void 0&&(e=null),i===void 0&&(i=null),!(s instanceof j)&&!(s instanceof I)&&(s=new I),this.Mi();let n=this.Xt.iteratorBackwards;for(;n.next();){let o=n.value;!o.visible||o.isTemporary||o.findObjectsAt(t,e,i,s)}return s}findObjectsAt(t,e,i,s){e===void 0&&(e=null),i===void 0&&(i=null),!(s instanceof j)&&!(s instanceof I)&&(s=new I),this.Mi();let n=this.Xt.iteratorBackwards;for(;n.next();){let o=n.value;o.visible&&o.findObjectsAt(t,e,i,s)}return s}findPartsIn(t,e,i,s){return e===void 0&&(e=!1),i===void 0&&(i=!0),this.CR(t,null,n=>n instanceof Nt&&(!i||n.canSelect()),e,s)}findObjectsIn(t,e,i,s,n){e===void 0&&(e=null),i===void 0&&(i=null),s===void 0&&(s=!1),!(n instanceof j)&&!(n instanceof I)&&(n=new I),this.Mi();let o=this.Xt.iteratorBackwards;for(;o.next();){let r=o.value;r.visible&&r.findObjectsIn(t,e,i,s,n)}return n}OP(t,e,i,s,n,o){let r=new I;this.Mi();let a=this.Xt.iteratorBackwards;for(;a.next();){let h=a.value;h.visible&&h.OP(t,e,i,s,r,n,o)}return r}CR(t,e,i,s,n){e===void 0&&(e=null),i===void 0&&(i=null),s===void 0&&(s=!1),!(n instanceof j)&&!(n instanceof I)&&(n=new I),this.Mi();let o=this.Xt.iteratorBackwards;for(;o.next();){let r=o.value;!r.visible||r.isTemporary||r.findObjectsIn(t,e,i,s,n)}return n}findPartsNear(t,e,i,s,n){return i===void 0&&(i=!0),s===void 0&&(s=!0),this.LR(t,e,null,o=>o instanceof Nt&&(!s||o.canSelect()),i,n)}findObjectsNear(t,e,i,s,n,o){i===void 0&&(i=null),s===void 0&&(s=null),n===void 0&&(n=!0),n!==!1&&n!==!0&&((n instanceof j||n instanceof I)&&(o=n),n=!0),!(o instanceof j)&&!(o instanceof I)&&(o=new I),this.Mi();let r=this.Xt.iteratorBackwards;for(;r.next();){let a=r.value;a.visible&&a.findObjectsNear(t,e,i,s,n,o)}return o}LR(t,e,i,s,n,o){i===void 0&&(i=null),s===void 0&&(s=null),n===void 0&&(n=!0),n!==!1&&n!==!0&&((n instanceof j||n instanceof I)&&(o=n),n=!0),!(o instanceof j)&&!(o instanceof I)&&(o=new I),this.Mi();let r=this.Xt.iteratorBackwards;for(;r.next();){let a=r.value;!a.visible||a.isTemporary||a.findObjectsNear(t,e,i,s,n,o)}return o}acceptEvent(t){return this.zc(t,t instanceof MouseEvent)}zc(t,e){let i=this.Br;this.Br=this._h,this._h=i,i.diagram=this,i.event=t,e?this.Qm(t,i):(i.viewPoint=this.Br.viewPoint,i.documentPoint=this.Br.documentPoint);let s=0,n=t;return n.ctrlKey&&(s+=1),n.altKey&&(s+=2),n.shiftKey&&(s+=4),n.metaKey&&(s+=8),i.modifiers=s,i.button=n.button,n.buttons!==void 0&&(i.buttons=n.buttons),f.tr&&n.button===0&&n.ctrlKey&&(i.button=2),i.down=!1,i.up=!1,i.clickCount=1,i.delta=0,i.handled=!1,i.bubbles=!1,i.timestamp=t.timeStamp,i.isMultiTouch=!1,i.targetDiagram=this.kb(t,t.target),i.targetObject=null,i}kb(t,e){if(e===null)return null;let i=U.Qe.get(e);if(i)return i;let s=t.path;if(!s&&f.it(t.composedPath)&&(s=t.composedPath()),s&&s[0]){let n=U.Qe.get(s[0]);if(n)return n}return null}gR(t,e,i){let s=this.TM(t,!0,!1,!1,!0,i);return this.Qm(e,s),s.targetDiagram=this.kb(t,t.target),s.targetObject=null,i||s.clone(this.Gm),s}mR(t,e,i){let s=this.TM(t,!1,!1,!1,!1,i),n=A.document.elementFromPoint(e.clientX,e.clientY)||null;n!==null&&n.shadowRoot!==void 0&&n.shadowRoot!==null&&(n=n.shadowRoot.elementFromPoint(e.clientX,e.clientY));let o=this,r=t;if(n){let a=this.kb(t,n);a&&(r=e,o=a)}return s.targetDiagram=o,this.Qm(r,s),s.targetObject=null,s}TM(t,e,i,s,n,o){let r=this.Br;this.Br=this._h,this._h=r,r.diagram=this,r.clickCount=1,r.delta=0;let a=0;return t.ctrlKey&&(a+=1),t.altKey&&(a+=2),t.shiftKey&&(a+=4),t.metaKey&&(a+=8),r.modifiers=a,r.event=t,r.timestamp=t.timeStamp,r.button=i?this.firstInput.button:t.button,r.buttons=t.buttons,f.tr&&t.button===0&&t.ctrlKey&&(r.button=2),r.down=e,r.up=i,r.handled=s,r.bubbles=n,r.isMultiTouch=o,r}ha(t,e){return t.bubbles?!0:(e.stopPropagation!==void 0&&e.stopPropagation(),e.cancelable!==!1&&e.preventDefault(),e.cancelBubble=!0,!1)}xR(t){let e=U.Qe.get(this);if(!e||!e.isEnabled)return!1;let i=e.zc(t,!1);return i.key=t.key,i.code=t.code,i.down=!0,e.doKeyDown(),e.ha(i,t)}bR(t){let e=U.Qe.get(this);if(!e||!e.isEnabled)return!1;let i=e.zc(t,!1);return i.key=t.key,i.code=t.code,i.up=!0,e.doKeyUp(),e.ha(i,t)}yR(t){let e=U.Qe.get(this);if(!e||!e.isEnabled)return!1;let i=e.zc(t,!0);return e.mouseEnter!==null&&e.mouseEnter(i),e.currentTool.standardMouseOver(),e.ha(i,t)}wR(t){let e=U.Qe.get(this);if(!e||!e.isEnabled)return!1;let i=e.zc(t,!0);return e.mouseLeave!==null&&e.mouseLeave(i),e.ha(i,t)}getMouse(t){let e=this.ft;if(e===null)return new P(0,0);let i=e.getBoundingClientRect(),s=(t.clientX-i.left)*(this.xt/i.width),n=(t.clientY-i.top)*(this.bt/i.height);return new P(s,n).Oe(this.T)}Qm(t,e){let i=this.ft,s=0,n=0;if(i!==null){let r=i.getBoundingClientRect();s=(t.clientX-r.left)*(this.xt/r.width),n=(t.clientY-r.top)*(this.bt/r.height)}e.viewPoint.i(s,n);let o=P.V(s,n);this.T.$e(o),e.documentPoint.a(o),P.e(o)}BC(t,e,i){let s;if(this.ea[0]!==null)s=this.ea[e];else return;let n=this.ft;if(n!==null){let o=n.getBoundingClientRect();i.i((s.clientX-o.left)*(this.xt/o.width),(s.clientY-o.top)*(this.bt/o.height))}}invalidateDocumentBounds(){this.ta||(this.ta=!0,this.requestUpdate(!1))}AR(){this.ys||this.Mi(),this.ensureBounds()}redraw(){this.Ht||this.ys||(this.S(),this.maybeUpdate())}isUpdateRequested(){return this.xr}delayInitialization(t){t===void 0&&(t=null);let e=this.animationManager,i=e.isEnabled;e.stopAnimation(),e.isEnabled=!1,this.ur(),this.jn=!1,this.nx=new P(NaN,NaN),e.isEnabled=i,this.ys=!0;let s=this;t!==null&&f.ir(()=>{s.ys=!1,e.Fl("Model"),t(s)},1)}requestUpdate(t){if(t===void 0&&(t=!1),this.xr===!0||this.Ht||t===!1&&this.ys)return;this.xr=!0;let e=this;A.requestAnimationFrame(()=>{e.xr&&e.maybeUpdate()})}maybeUpdate(){this.Fu&&!this.xr||(this.Fu&&(this.Fu=!1),this.ur())}FM(t,e){!this.Ou||this.Ht||this.animationManager.defaultAnimation.isAnimating||this.BL()||(t&&this.Mi(),e&&this.Bs(!1))}ur(t){if(this.ys||(this.xr=!1,this.Mt===null&&!this.Iu.isReal()))return;this.ys=!0;let e=this.animationManager,i=this.Vu;if(!e.isAnimating&&i.length!==0){let u=i.r,c=u.length;for(let d=0;d<c;d++){let g=u[d];g.ue(!1),g.c()}i.clear()}let s=this.wM;s.count>0&&(s.each(u=>u.RM()),s.clear());let n=!1,o=!1;e.defaultAnimation.isAnimating&&(o=!0,n=this.skipsUndoManager,this.skipsUndoManager=!0),e.pi||this.IS(),t||this.FM(!1,!0);let r=!this.undoManager.isUndoingRedoing&&(this.bl||this.Vc.count!==0&&this.Mr.size!==0),a=!this.jn||this.Vr;this.Mi(!0);let h=!1;(a||r)&&(this.jn?this.vM(!this.vc,r):(this.startTransaction("Initial Layout"),e.isEnabled===!1&&e.stopAnimation(),this.vM(!1,r)),h=a),this.vc=!1,this.bl=!1,this.Mi(),this.Ze!==null&&(this.Ze.visible&&!this.Eu&&(this.th(),this.Eu=!0),!this.Ze.visible&&this.Eu&&(this.Eu=!1)),this.Yx||this.AR(),t||this.FM(!0,!1);let l=!1;if(h){let u=z.l();u.a(this.viewportBounds),this.jn||(this.jn=!0,l=!0,this.skipsUndoManager||(this.undoManager.Ew=!0),this.undoManager.Uw=!0,this.TR()),this.DR(),this.Mi(!1),t||this.FM(!0,!0),z.e(u)}else if(e.Sc&&e.ex){if(this.Sr!==1)this.scale=this.Yu(this.Sr);else if(this.jl!==1)this.scale=this.Yu(this.jl);else{let u=this.initialScale;isFinite(u)&&u>0&&(this.scale=u)}this.Bs(!0)}h&&l&&this.commitTransaction("Initial Layout"),t||this.Ui(this.Qt),o&&(this.skipsUndoManager=n),this.ys=!1}get Vh(){return this.jn}TR(){if(this.Sr!==1)this.scale=this.Yu(this.Sr);else if(this.jl!==1)this.scale=this.Yu(this.jl);else{let e=this.initialScale;isFinite(e)&&e>0&&(this.scale=e)}this.Bs(!0);let t=this.Xt.r;this.ps(t,t.length,this,this.viewportBounds),this.D("InitialLayoutCompleted"),this.nx.a(this.at),this.th()}DR(){this.D("LayoutCompleted")}t0(t){this.Yn.add(t)}addInvalidRoute(t){this.Co?this.Zh.add(t):this.Mr.add(t)}Mi(t){if(this.Yn.size!==0&&!(!this.ys&&this.animationManager.isTicking)){if(this.ys||(this.bl=!0),t){this.zL(this.Yn);return}for(let e=0;e<23&&this.Yn.size!==0;e++){let i=new Set(this.Yn);this.Yn.clear(),this.RM(i,this.Yn)}this.nodes.each(e=>{e instanceof ft&&e.XL(!1)})}}zL(t,e){for(let i of t)!i.ke()||i instanceof ft||(i.Yr()?(i.ht(1/0,1/0),i.Bt()):e&&e.add(i));for(let i of t)if(i instanceof ft){if(!i.isVisible())continue;this.Pb(i)}}RM(t,e){this.zL(t,e);for(let i of t){if(!(i instanceof _))continue;let s=i;s.isVisible()&&(s.Yr()?(s.ht(1/0,1/0),s.Bt()):e.add(s))}for(let i of t)i instanceof St&&i.isVisible()&&(i.Yr()?(i.ht(1/0,1/0),i.Bt()):e.add(i))}i0(t){let e=t instanceof U,i=e?t.links:t.memberParts,s=this.Yn;if(e)this.Mi(!0);else{for(;i.next();){let n=i.value;s.has(n)&&(!n.ke()||n instanceof ft||n.Yr()&&(n.ht(1/0,1/0),n.Bt()))}for(i.reset();i.next();){let n=i.value;if(s.has(n)&&n instanceof ft){if(!n.isVisible())continue;this.Pb(n)}}i.reset()}for(;i.next();){let n=i.value;n instanceof _&&s.has(n)&&n.isVisible()&&n.Yr()&&(n.ht(1/0,1/0),n.Bt())}}Pb(t){let e=f.et(),i=f.et(),s=t.memberParts;for(;s.next();){let o=s.value;o.isVisible()&&(o instanceof ft?(o.To()||o._e()||o.ih())&&this.Pb(o):o instanceof _?o.fromNode===t||o.toNode===t?i.push(o):e.push(o):(o.ht(1/0,1/0),o.Bt()))}let n=e.length;for(let o=0;o<n;o++){let r=e[o];r.ht(1/0,1/0),r.Bt()}f.J(e),t.ht(1/0,1/0),t.Bt(),n=i.length;for(let o=0;o<n;o++){let r=i[o];r.ht(1/0,1/0),r.Bt()}f.J(i)}ps(t,e,i,s){if(!(!this.Ic&&!this.animationManager.isAnimating)){for(let n=0;n<e;n++)t[n].ps(i,s);this.Mi()}}Ui(t){this.Mt!==null&&(this.ft===null&&f.o("No canvas specified"),this.Oc==="svg"?this.FR(t):this.RR(t))}RR(t){let e=this.animationManager;if(e.pi||e.isAnimating&&!e.isTicking)return;let i=new Date;if(this.e0(),this.Mt&&this.Mt.style.opacity==="0")return;let s=t!==this.Qt,n=this.Xt.r,o=n.length,r=this;if(this.ps(n,o,r,r.viewportBounds),s)t.clearContextCache(!0),this._l();else if(!this.Ue&&!e.isAnimating)return;let a=this.T,h=this.Vi;t.setTransform(h,0,0,h,0,0),t.clearRect(0,0,this.xt,this.bt),this.$t!==1&&(t.globalAlpha=this.$t),this.OM(t);for(let g=0;g<o;g++)t.setTransform(h,0,0,h,0,0),t.transform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),t.commitTransform(),n[g].Ui(t,r);let l=!1;this.Bc?this.Bc.Xu(this)&&(l=this.fb()):l=!0,l&&(Pt.prototype.$e=Pt.prototype.kw),s?(this.Qt.clearContextCache(!0),this._l()):(this.Ic=!1,this.Ue=!1);let u=+new Date-+i,c=!1,d=this.SM;if(c||this.Pl===null){d[this.Wm]=u,this.Wm=(this.Wm+1)%d.length;let g=0;for(let p=0;p<d.length;p++)g+=d[p];this.qm=g/d.length}if(this.$t!==1&&(t.globalAlpha=1),c){t.setTransform(1,0,0,1,0,0);for(let g=0;g<d.length;g++)t.fillText(d[g].toString(),20,150+ +(g*20))}}FR(t){if(this.Mt===null)return;let e=this.animationManager;if(e.pi||e.isAnimating&&!e.isTicking)return;this.e0();let i=this.xt,s=this.bt;t.surface.resize(i,s,i,s);let n=this.Xt.r,o=n.length,r=this;if(this.ps(n,o,r,r.viewportBounds),!this.Ue&&!e.isAnimating)return;let a=this.T;t.lastDrawnPart=null,t.setDiagramPosScale(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),this.$t!==1&&(t.globalAlpha=this.$t),this.OM(t);let h=this.Vi;this.ft.li.setTransform(h,0,0,h,0,0),this.ft.li.clearRect(0,0,this.xt,this.bt);for(let u=0;u<o;u++)n[u].Ui(t,r);let l=!1;this.Bc?this.Bc.Xu(this)&&(l=this.fb()):l=!0,l&&(Pt.prototype.$e=Pt.prototype.kw),this.Ic=!1,this.Ue=!1}Sb(t,e,i,s,n,o,r,a,h){if(this.Mt===null)return;this.ft===null&&f.o("No canvas specified"),o===void 0&&(o=null),r===void 0&&(r=null),a===void 0&&(a=!1),h===void 0&&(h=!1),this.e0(),this.Qt.clearContextCache(!0),this._l(),this.ia=!0;let l=this.tt;this.tt=s;let u=this,c=this.Xt.r,d=c.length;try{let g=new z(n.x,n.y,i.width/s,i.height/s),p=g.copy();p.addMargin(e),this.th(p),this.Mi(),this.ps(c,d,u,g),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,i.width,i.height),r!==null&&r!==""&&(t.fillStyle=r,t.fillBackground(0,0,i.width,i.height));let m=this.Vi;t.scale(m,m);let y=Pt.l();y.Ri(),y.Fs(e.left,e.top),y.tt(s),(n.x!==0||n.y!==0)&&y.Fs(-n.x,-n.y),t.setTransform(y.m11,y.m12,y.m21,y.m22,y.dx,y.dy),t.commitTransform(),t instanceof ce&&t.setDiagramPosScale(y.m11,y.m12,y.m21,y.m22,y.dx,y.dy),Pt.e(y),this.OM(t),t.globalAlpha=this.$t;let w=this.findLayer("Grid");if(o){let b=new I,v=o.iterator;for(v.reset();v.next();){let k=v.value;k instanceof Nt&&(!h&&k.layer===w||(k.Au(),b.add(k)))}for(let k=0;k<d;k++)c[k].GF(t,u,b,a);b.each(k=>k.Au())}else for(let b=0;b<d;b++){let v=c[b];v===w?h&&v.Ui(t,u,!0):v.Ui(t,u,a)}this.ia=!1,this.Bc&&this.Bc.Xu(this)&&this.fb()}finally{this.tt=l,this.Qt.clearContextCache(!0),this._l(),this.ps(c,d,u,u.viewportBounds),this.th(),this.Qt instanceof ce&&(this.Qt.diagramGroup.replaceChildren(),this.redraw())}}getRenderingHint(t){return this.Pr[t]}setRenderingHint(t,e){t==="minDrawingLength"&&(this.Fm=e),this.Pr[t]=e,this.redraw()}resetRenderingHints(){this.Pr=new q,this.Pr.drawShadows=!0,this.Pr.textGreeking=!0,this.Pr.viewportOptimizations=!f.tr,this.Pr.temporaryPixelRatio=!0,this.Pr.pictureRatioOptimization=!0,this.Pr.minDrawingLength=1,this.Fm=1}OM(t){let e=this.Pr;if(e===null)return;if(e.imageSmoothingEnabled!==void 0){let s=!!e.imageSmoothingEnabled;t.setImageSmoothingEnabled(s)}let i=e.defaultFont;i!=null&&(t.font=i)}getInputOption(t){return this.Tu[t]}setInputOption(t,e){this.Tu[t]=e}oR(){this.Tu=new q,this.Tu.extraTouchArea=10,this.Tu.extraTouchThreshold=10,this.Tu.hasGestureZoom=!0}set(t){return Object.assign(this,t),this}attach(t){return this.setProperties(t)}setProperties(t){return U.s0(this,t),this}static s0(t,e){let i=t instanceof H,s=t instanceof U;for(let n in e){n===""&&f.o("Setting properties requires non-empty property names");let o=t,r=n;if(i||s){let h=n.indexOf(".");if(h>0){let l=n.substring(0,h);i?o=t.findObject(l):(o=t[l],o==null&&(o=t.toolManager[l])),f.G(o)?r=n.substring(h+1):f.o("Unable to find object named: "+l+" in "+t.toString()+" when trying to set property: "+n)}}if(r[0]!=="_"&&!f.gw(o,r))if(s&&r==="ModelChanged"){t.addModelChangedListener(e[r]);continue}else if(s&&r==="Changed"){t.addChangedListener(e[r]);continue}else if(s&&f.gw(t.toolManager,r))o=t.toolManager;else if(s&&t.YL(r)){t.addDiagramListener(r,e[r]);continue}else if(t instanceof yt&&r==="Changed"){t.addChangedListener(e[r]);continue}else f.o('Trying to set undefined property "'+r+'" on object: '+o.toString());let a=e[n];o[r]=a,r[0]==="_"&&o instanceof dt&&o.addCopyProperty(r)}}xL(){if(this.$l.count!==0&&!(this.undoManager.transactionLevel>1)){for(;this.$l.count>0;){let t=this.$l;this.$l=new pt;let e=t.iterator;for(;e.next();){let i=e.key;i.invalidateOtherJumpOvers(e.value),i.ee()}}this.S()}}S(t){if(t===void 0)this.Ue=!0,this.requestUpdate();else{let e=this.viewportBounds;t.isReal()&&e.intersectsRect(t)&&(this.Ue=!0,this.requestUpdate())}this.D("InvalidateDraw")}invalidateViewport(t,e){if(this.Ue!==!0){if(this.Ue=!0,this.Oc==="svg"){this.maybeUpdate();return}this.getRenderingHint("temporaryPixelRatio")===!0?(this.Vw(),this.maybeUpdate(),this.CP(!0)):this.maybeUpdate()}}aa(){this.Ou=!0}_l(){this.Ic=!0}e0(){this.Du!==!1&&(this.Du=!1,this.EL(this.xt,this.bt))}EL(t,e){this.Ql();let i=this.Vi,s=t*i,n=e*i;this.ft.resize(s,n,t,e)&&(this.Ue=!0,this.Qt.clearContextCache(!0))}BL(){let t=this.ft;if(t===null||this.Iu.isReal())return!0;let e=this.xt,i=this.bt,s=this.Mt,n=!1,o=this.Kn?this.Wt:0,r=this.ln?this.Wt:0,a=s.clientWidth||e+o,h=s.clientHeight||i+r,l=this.viewportBounds,u=l.x,c=l.y,d=l.width,g=l.height;if((a!==e+o||h!==i+r)&&(this.Kn=!1,this.ln=!1,o=0,r=0,this.xt=a,this.bt=h,this.Du=!0,n=!0,this.Ql()),!this.jn||!this.viewportBounds.isReal())return!0;let p=this.ab,m=this.cb;if(this.Ou=!1,!n&&!this.Kn&&!this.ln&&!this.Ru&&!this.vu)return!0;let y=this.documentBounds,w=0,b=0,v=0,k=0,S=l.width,M=l.height,F=this.$h;this.contentAlignment.isSpot()?(y.width>S&&(w=F.left,b=F.right),y.height>M&&(v=F.top,k=F.bottom)):(w=F.left,b=F.right,v=F.top,k=F.bottom);let T=y.width+w+b,N=y.height+v+k,C=this.scale,R=C,O=T>a/C,B=N>h/C;if(!n&&!this.Kn&&!this.ln&&!O&&!B)return!0;let K=y.x-w,Y=l.x,X=y.right+b,G=l.right+o,nt=y.y-v,at=l.y,tt=y.bottom+k,st=l.bottom+r,et="1px",ct="1px";if(this.scrollMode===1&&(O||B)){if(O&&this.hasHorizontalScrollbar&&this.allowHorizontalScroll){let ot=1;K+1<Y&&(ot=Math.max((Y-K)*C+this.xt,ot)),X>G+1&&(ot=Math.max((X-G)*C+this.xt,ot)),S+o+1<T&&(ot=Math.max((T-S)*C+this.xt,ot)),et=ot.toString()+"px"}if(B&&this.hasVerticalScrollbar&&this.allowVerticalScroll){let ot=1;nt+1<at&&(ot=Math.max((at-nt)*C+this.bt,ot)),tt>st+1&&(ot=Math.max((tt-st)*C+this.bt,ot)),M+r+1<N&&(ot=Math.max((N-M)*C+this.bt,ot)),ct=ot.toString()+"px"}}let gt=et!=="1px",wt=ct!=="1px";if(!(gt&&wt)&&(gt||wt)){if(O=!(T<S+o),B=!(N<M+r),wt&&(G-=this.Wt),gt&&(st-=this.Wt),O&&this.hasHorizontalScrollbar&&this.allowHorizontalScroll){let Mt=1;K+1<Y&&(Mt=Math.max((Y-K)*C+this.xt,Mt)),X>G+1&&(Mt=Math.max((X-G)*C+this.xt,Mt)),S+1<T&&(Mt=Math.max((T-S)*C+this.xt,Mt)),et=Mt.toString()+"px"}gt=et!=="1px";let ot=this.bt;if(gt!==this.ln&&(ot=gt?this.bt-this.Wt:this.bt+this.Wt),B&&this.hasVerticalScrollbar&&this.allowVerticalScroll){let Mt=1;nt+1<at&&(Mt=Math.max((at-nt)*C+ot,Mt)),tt>st+1&&(Mt=Math.max((tt-st)*C+ot,Mt)),M+1<N&&(Mt=Math.max((N-M)*C+ot,Mt)),ct=Mt.toString()+"px"}wt=ct!=="1px"}if(this.Bm&&!(gt!==this.ln||wt!==this.Kn))return(e!==this.xt||i!==this.bt)&&this.maybeUpdate(),!1;if(gt!==this.ln&&(et==="1px"?this.bt=this.bt+this.Wt:this.bt=Math.max(this.bt-this.Wt,1),n=!0),this.ln=gt,m.style.width=et,wt!==this.Kn&&(ct==="1px"?this.xt=this.xt+this.Wt:this.xt=Math.max(this.xt-this.Wt,1),n=!0,this.zu)){let ot=P.l();wt?(t.style.left=this.Wt+"px",this.position=ot.i(this.at.x+this.Wt/this.scale,this.at.y)):(t.style.left="0px",this.position=ot.i(this.at.x-this.Wt/this.scale,this.at.y)),P.e(ot)}n&&this.Ql(),this.Kn=wt,m.style.height=ct,this.tb=!0,n&&(this.Du=!0);let Ct=p.scrollLeft;if(this.hasHorizontalScrollbar&&this.allowHorizontalScroll&&(S+1<T?Ct=(this.position.x-K)*C:K+1<Y?Ct=p.scrollWidth-p.clientWidth:X>G+1&&(Ct=this.position.x*C)),this.zu)switch(this.Sx){case"negative":Ct=-(p.scrollWidth-Ct-p.clientWidth);break;case"reverse":Ct=p.scrollWidth-Ct-p.clientWidth;break}if(p.scrollLeft=Ct,this.hasVerticalScrollbar&&this.allowVerticalScroll&&(M+1<N?p.scrollTop=(this.position.y-nt)*C:nt+1<at?p.scrollTop=p.scrollHeight-p.clientHeight:tt>st+1&&(p.scrollTop=this.position.y*C)),a=this.xt,h=this.bt,p.style.width=a+(this.Kn?this.Wt:0)+"px",p.style.height=h+(this.ln?this.Wt:0)+"px",e!==a||i!==h||this.animationManager.pi){let ot=z.V(u,c,d,g);return this.onViewportBoundsChanged(ot,this.viewportBounds,R,n),z.e(ot),!1}return!0}add(t){let e=t.diagram;if(e===this)return;e!==null&&f.o("Cannot add part "+t.toString()+" to "+this.toString()+". It is already a part of "+e.toString());let i=this.findLayer(t.layerName);if(i===null&&(i=this.findLayer("")),i===null&&f.o('Cannot add a Part when unable find a Layer named "'+t.layerName+'" and there is no default Layer'),t.layer===i)return;let s=i.Jh(99999999,t,t.diagram===this);s>=0&&this.raiseChangedEvent(3,"parts",i,null,t,null,s),i.isTemporary||this.invalidateDocumentBounds(),t.invalidateLayout(1);let n=t.layerChanged;n!==null&&n(t,null,i)}Jh(t){this.partManager.Jh(t);let e=this;t.Gr(i=>e.GL(i)),t.data||t.Do(),t.hasPlaceholder()&&t.c(),t.data!==null&&t.Gr(i=>e.partManager.IM(i,null)),(t._e()===!0||t.ih()===!0)&&this.t0(t),t.KL(!0,this),t.jL()?(t.actualBounds.isReal()&&this.S(t.Wh(t.actualBounds)),this.invalidateDocumentBounds()):t.isVisible()&&t.actualBounds.isReal()&&this.S(t.Wh(t.actualBounds)),this.requestUpdate()}te(t){t.clearAdornments(),this.partManager.te(t);let e=this;t.data!==null&&t.Gr(i=>e.partManager.EM(i,e)),this.Yn.delete(t),t instanceof _&&this.Mr.delete(t),t.jL()?(t.actualBounds.isReal()&&this.S(t.Wh(t.actualBounds)),this.invalidateDocumentBounds()):t.isVisible()&&t.actualBounds.isReal()&&this.S(t.Wh(t.actualBounds)),this.requestUpdate()}remove(t){this.UM(t,!0)}UM(t,e){let i=t.layer;if(i===null||i.diagram!==this)return;t.isSelected=!1,t.isHighlighted=!1,t.invalidateLayout(2),e&&t.Xc();let s=i.te(-1,t,!1);s>=0&&this.raiseChangedEvent(4,"parts",i,t,null,s,null);let n=t.layerChanged;n!==null&&n(t,i,null)}removeParts(t,e){if(e===void 0&&(e=!1),Array.isArray(t)){let i=t.length;for(let s=0;s<i;s++){let n=t[s];e&&!n.canDelete()||this.remove(n)}}else{let i=new I;i.addAll(t);let s=i.iterator;for(;s.next();){let n=s.value;e&&!n.canDelete()||this.remove(n)}}}copyParts(t,e,i){i===void 0&&(i=!1);let s=null,n=e||this,o=n.model,r=!1,a=!1;try{o.pm()&&(r=o.copiesParentKeyOfNodeData,o.copiesParentKeyOfNodeData=n.commandHandler.copiesParentKey),(o.mm()||o.Mb())&&(a=o.copiesGroupKeyOfNodeData,o.copiesGroupKeyOfNodeData=n.commandHandler.copiesGroupKey),s=this.partManager.copyParts(t,e,i)}finally{o.pm()&&(o.copiesParentKeyOfNodeData=r),(o.mm()||o.Mb())&&(o.copiesGroupKeyOfNodeData=a)}return s}moveParts(t,e,i,s){if(i===void 0&&(i=!1),s===void 0&&(s=this.o0()),this.toolManager===null)return;let n=new pt;if(t!==null)if(Array.isArray(t))for(let o=0;o<t.length;o++)this.Kr(n,t[o],i,s);else{let o=t.iterator;for(;o.next();)this.Kr(n,o.value,i,s)}else{let o=this.parts;for(;o.next();){let r=o.value;this.Kr(n,r,i,s)}for(o=this.nodes;o.next();){let r=o.value;this.Kr(n,r,i,s)}for(o=this.links;o.next();){let r=o.value;this.Kr(n,r,i,s)}}this.TP(n,e,s,i)}Kr(t,e,i,s,n){if(!t.has(e)&&(n===void 0&&(n=!1),!(i&&!n&&!e.canMove()&&!e.canCopy())))if(s===void 0&&(s=this.o0()),e instanceof rt){if(t.set(e,this.Es(s,e,e.location)),e instanceof ft&&(e.hasPlaceholder()||s.dragsMembers)){let r=e.memberParts;for(;r.next();){let a=r.value;this.Kr(t,a,i,s,s.groupsAlwaysMove)}}let o=e.linksConnected;for(;o.next();){let r=o.value;if(t.has(r))continue;let a=r.fromNode,h=r.toNode;a!==null&&t.has(a)&&h!==null&&t.has(h)&&this.Kr(t,r,i,s)}if(s.dragsTree){let r=e.findTreeChildrenNodes();for(;r.next();){let a=r.value;this.Kr(t,a,i,s)}}}else if(e instanceof _){t.set(e,this.Es(s,e));let o=e.labelNodes;for(;o.next();){let r=o.value;this.Kr(t,r,i,s)}}else e instanceof St||t.set(e,this.Es(s,e,e.location))}TP(t,e,i,s){if(t===null||t.count===0)return;let n=P.l(),o=P.l();o.a(e),isNaN(o.x)&&(o.x=0),isNaN(o.y)&&(o.y=0);let r=this.gb;r||this.WC(t);let a=f.et(),h=f.et(),l=t.iterator,u=P.l();for(;l.next();){let m=l.key,y=l.value;if(m.ke()){let w=this.HL(m,t);if(w!==null)a.push(new tr(m,y,w));else if(!s||m.canMove()){let b=y.point;n.a(b),this.computeMove(m,n.add(o),i,u),m.location=u,y.shifted===void 0&&(y.shifted=new P),y.shifted.a(u.subtract(b))}}else l.key instanceof _&&h.push(new Ut(l.key,l.value))}P.e(u);let c=a.length;for(let m=0;m<c;m++){let y=a[m],w=y.qL.point;n.a(w),y.Nb.shifted===void 0&&(y.Nb.shifted=new P),y.Me.location=n.add(y.Nb.shifted)}let d=P.l(),g=P.l(),p=h.length;for(let m=0;m<p;m++){let y=h[m],w=y.key;if(w instanceof _){if(w.suspendsRouting){w.br=null;let b=w.fromNode,v=w.toNode;if(this.draggedLink!==null&&i.dragsLink){let k=y.value.point;if(w.dragComputation===null){t.set(w,this.Es(i,w,o));let S=o.x-k.x,M=o.y-k.y;w.fr(S,M)}else{let S=P.V(0,0),M=w.getPoint(0);M&&M.isReal()&&S.a(M),u=P.l().a(S).add(o);let F=u;i.isGridSnapEnabled&&(i.isGridSnapRealtime||this.lastInput.up)&&(F=P.l(),this.yS(w,u,F,i)),u.a(w.dragComputation(w,u,F)).subtract(S),t.set(w,this.Es(i,w,u));let T=u.x-k.x,N=u.y-k.y;w.fr(T,N),P.e(S),P.e(u),F!==u&&P.e(F)}}else{if(b!==null){d.a(b.location);let k=t.get(b);k!==null&&d.subtract(k.point)}if(v!==null){g.a(v.location);let k=t.get(v);k!==null&&g.subtract(k.point)}if(b!==null&&v!==null)if(d.equalsApprox(g)){let k=y.value.point,S=n;S.a(d),S.subtract(k),t.set(w,this.Es(i,w,d)),w.fr(S.x,S.y)}else w.suspendsRouting=!1,w.invalidateRoute();else{let k=y.value.point,S;b!==null?S=d:v!==null?S=g:S=o,t.set(w,this.Es(i,w,S));let M=S.x-k.x,F=S.y-k.y;w.fr(M,F)}}}else if(w.fromNode===null||w.toNode===null){let b=y.value.point;t.set(w,this.Es(i,w,o));let v=o.x-b.x,k=o.y-b.y;w.fr(v,k)}}}P.e(n),P.e(o),P.e(d),P.e(g),f.J(a),f.J(h),r||(this.Mi(),this.NP(t))}computeMove(t,e,i,s){if(s===void 0&&(s=new P),s.a(e),t===null)return s;let n=e,o=i.isGridSnapEnabled;o&&(i.isGridSnapRealtime||this.lastInput.up)&&(n=P.l(),this.yS(t,e,n,i));let r=t.dragComputation!==null?t.dragComputation(t,e,n):n,a=t.minLocation,h=a.x;isNaN(h)&&(h=o?Math.round(t.location.x*1e3)/1e3:t.location.x);let l=a.y;isNaN(l)&&(l=o?Math.round(t.location.y*1e3)/1e3:t.location.y);let 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.i(Math.max(h,Math.min(r.x,c)),Math.max(l,Math.min(r.y,d))),n!==e&&P.e(n),s}o0(){let t=this.toolManager.findTool("Dragging");return t instanceof Dt?t.dragOptions:this.yb}yS(t,e,i,s){if(s===void 0&&(s=this.o0()),i.a(e),t===null)return i;let n=this.grid,o=s.gridSnapCellSize,r=o.width,a=o.height,h=s.gridSnapOrigin,l=h.x,u=h.y,c=s.gridSnapCellSpot;if(n!==null){let g=n.gridCellSize;isNaN(r)&&(r=g.width),isNaN(a)&&(a=g.height);let p=n.gridOrigin;isNaN(l)&&(l=p.x),isNaN(u)&&(u=p.y)}let d=P.V(0,0);return d.setSpot(0,0,r,a,c),L.Dg(e.x,e.y,l+d.x,u+d.y,r,a,i),P.e(d),i}WC(t){if(t===null)return;this.gb=!0;let e=t.iterator;for(;e.next();){let i=e.key;i instanceof _&&(i.suspendsRouting=!0)}}NP(t){if(t===null)return;let e=t.iterator;for(;e.next();){let i=e.key;i instanceof _&&(i.suspendsRouting=!1,i.WL()&&i.invalidateRoute())}this.gb=!1}get draggedLink(){return this.pb}set draggedLink(t){this.pb!==t&&(this.pb=t,t!==null&&(this.wb=t.fromPort,this.xb=t.toPort))}get RP(){return this.wb}set RP(t){this.wb=t}get vP(){return this.xb}set vP(t){this.xb=t}HL(t,e){let i=t.containingGroup;if(i!==null){let s=this.HL(i,e);if(s!==null||(s=e.get(i),s!==null))return s}return null}Es(t,e,i){if(i===void 0)return new ni(P.xo);let s=t.isGridSnapEnabled;return!t.groupsSnapMembers&&e.containingGroup!==null&&(s=!1),s?new ni(new P(Math.round(i.x*1e3)/1e3,Math.round(i.y*1e3)/1e3)):new ni(i.copy())}BM(t,e){if(t.diagram!==null&&t.diagram!==this&&f.o("Cannot share a Layer with another Diagram: "+t+" of "+t.diagram),e===null?t.diagram!==null&&f.o("Cannot add an existing Layer to this Diagram again: "+t):(e.diagram!==this&&f.o("Existing Layer must be in this Diagram: "+e+" not in "+e.diagram),t===e&&f.o("Cannot move a Layer before or after itself: "+t)),t.diagram===this)return;let i=t.name,s=this.Xt,n=s.count;for(let o=0;o<n;o++)s.elt(o).name===i&&f.o("Cannot add Layer with the name '"+i+"'; a Layer with the same name is already present in this Diagram.")}addLayer(t){this.BM(t,null),t.Mo(this);let e=this.Xt,i=e.count-1;if(!t.isTemporary)for(;i>=0&&e.elt(i).isTemporary;)i--;return e.insertAt(i+1,t),this.ki!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,i+1),this.S(),this.invalidateDocumentBounds(),this}addLayerBefore(t,e){this.BM(t,e),t.Mo(this);let i=this.Xt,s=i.indexOf(t);s>=0&&(i.delete(t),this.ki!==null&&this.raiseChangedEvent(4,"layers",this,t,null,s,null));let n=i.count,o;for(o=0;o<n;o++)if(i.elt(o)===e){i.insertAt(o,t);break}return this.ki!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,o),this.S(),s<0&&this.invalidateDocumentBounds(),this}addLayerAfter(t,e){this.BM(t,e),t.Mo(this);let i=this.Xt,s=i.indexOf(t);s>=0&&(i.delete(t),this.ki!==null&&this.raiseChangedEvent(4,"layers",this,t,null,s,null));let n=i.count,o;for(o=0;o<n;o++)if(i.elt(o)===e){i.insertAt(o+1,t);break}return this.ki!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,o+1),this.S(),s<0&&this.invalidateDocumentBounds(),this}Xr(t,e){t.Mo(this),this.Xt.insertAt(e,t)}JL(t){this.Xt.removeAt(t)}removeLayer(t){if(t.diagram!==this&&f.o("Cannot remove a Layer from another Diagram: "+t+" of "+t.diagram),t.name==="")return;let e=this.Xt,i=e.indexOf(t);if(e.delete(t)){let s=t.Ct.copy().iterator;for(;s.next();){let n=s.value,o=n.layerName;o!==t.name?n.layerName=o:n.layerName=""}this.ki!==null&&this.raiseChangedEvent(4,"layers",this,t,null,i,null),this.S(),this.invalidateDocumentBounds()}}findLayer(t){let e=this.layers;for(;e.next();){let i=e.value;if(i.name===t)return i}return null}findRouter(t){for(let e of this.Vc)if(e.name===t)return e;return null}addModelChangedListener(t){return f.k(t,U,"addModelChangedListener:listener"),this.Gn===null&&(this.Gn=new j),this.Gn.add(t),this.model.addChangedListener(t),this}removeModelChangedListener(t){f.k(t,U,"removeModelChangedListener:listener"),this.Gn!==null&&(this.Gn.delete(t),this.Gn.count===0&&(this.Gn=null)),this.model.removeChangedListener(t)}addChangedListener(t){return f.k(t,U,"addChangedListener:listener"),this.Nr===null&&(this.Nr=new j),this.Nr.add(t),this}removeChangedListener(t){f.k(t,U,"removeChangedListener:listener"),this.Nr!==null&&(this.Nr.delete(t),this.Nr.count===0&&(this.Nr=null))}VM(t){if(!this.skipsUndoManager&&!this.model.skipsUndoManager&&this.model.undoManager.handleChanged(t),t.change!==1&&(this.isModified=!0),this.Nr!==null){let e=this.Nr,i=e.length;for(let s=0;s<i;s++)e.elt(s)(t)}}raiseChangedEvent(t,e,i,s,n,o,r){o===void 0&&(o=null),r===void 0&&(r=null);let a=new ii;a.diagram=this,a.change=t,a.propertyName=e,a.object=i,a.oldValue=s,a.oldParam=o,a.newValue=n,a.newParam=r,this.VM(a)}raiseChanged(t,e,i,s,n){this.raiseChangedEvent(2,t,this,e,i,s,n)}t(t,e,i,s,n){this.raiseChangedEvent(2,t,this,e,i,s,n)}get animationManager(){return this.ds}get undoManager(){return this.ki.undoManager}get skipsUndoManager(){return this.Lo}set skipsUndoManager(t){f.s(t,"boolean",U,"skipsUndoManager"),this.Lo=t,this.ki.skipsUndoManager=t}get delaysLayout(){return this.Gx}set delaysLayout(t){this.Gx=t}VC(t,e){if(t===null||t.diagram!==this)return;let i=this.fe;try{this.fe=!0;let s=t.change;if(s===2){let n=t.object,o=t.propertyName,r=t.getValue(e);if(t.diagram.model.Z(n,o,r),n instanceof dt){let a=n.part;a!==null&&a.invalidateAdornments()}this.isModified=!0}else if(s===3){let n=t.object,o=t.newParam,r=t.newValue;if(n instanceof H)if(typeof o=="number"&&r instanceof dt){e?n.te(o):n.insertAt(o,r);let a=n.part;a!==null&&a.invalidateAdornments()}else typeof o=="number"&&r instanceof jt&&(r.isRow?n.$L(o,e?void 0:r):n.ZL(o,e?void 0:r));else if(n instanceof Vt){let a=t.oldParam===!0;typeof o=="number"&&r instanceof Nt&&(e?(a||(r.isSelected=!1,r.isHighlighted=!1,r.invalidateAdornments()),n.te(a?o:-1,r,a)):n.Jh(o,r,a))}else n instanceof U?typeof o=="number"&&r instanceof Vt&&(e?this.JL(o):this.Xr(r,o)):f.o("unknown ChangeType.Insert object: "+t.toString());this.isModified=!0}else if(s===4){let n=t.object,o=t.oldParam,r=t.oldValue;if(n instanceof H)typeof o=="number"&&r instanceof dt?e?n.insertAt(o,r):n.te(o):typeof o=="number"&&r instanceof jt&&(r.isRow?n.$L(o,e?r:void 0):n.ZL(o,e?r:void 0));else if(n instanceof Vt){let a=t.newParam===!0;typeof o=="number"&&r instanceof Nt&&(e?n.Ct.indexOf(r)<0&&n.Jh(o,r,a):(a||(r.isSelected=!1,r.isHighlighted=!1,r.invalidateAdornments()),n.te(a?o:-1,r,a)))}else n instanceof U?typeof o=="number"&&r instanceof Vt&&(e?this.Xr(r,o):this.JL(o)):f.o("unknown ChangeType.Remove object: "+t.toString());this.isModified=!0}else s===1||f.o("unknown ChangedEvent: "+t.toString())}finally{this.fe=i}}startTransaction(t){return this.undoManager.startTransaction(t)}commitTransaction(t){return this.undoManager.commitTransaction(t)}rollbackTransaction(){return this.undoManager.rollbackTransaction()}commit(t,e){let i=e;i===void 0&&(i="");let s=this.skipsUndoManager;i===null&&(this.skipsUndoManager=!0,i=""),this.undoManager.startTransaction(i);let n=!1;try{t(this),n=!0}finally{n?this.undoManager.commitTransaction(i):this.undoManager.rollbackTransaction(),this.skipsUndoManager=s}}updateAllTargetBindings(t){this.partManager.updateAllTargetBindings(t)}updateAllThemeBindings(){if(this.partManager.updateAllThemeBindings(),this.Ze!==null){let t=this.Ze.part;t!==null&&t.Do()}}setDivBackground(t){this.div&&(this.div.style.backgroundColor=t)}updateAllRelationshipsFromData(){this.partManager.updateAllRelationshipsFromData()}_m(){let t=this.T,e=this.tt,i=this.at;t.Ri(),e!==1&&t.tt(e),(i.x!==0||i.y!==0)&&t.Fs(-i.x,-i.y)}QL(t,e){let i=this.animationManager;if(this.Ht||this.ys){this.tt=e,this.Ql(),this.S(),this.aa(),i.yL(t,this.tt),this._m();return}if(this.ft===null){this.tt=e,this._m();return}this.Ht=!0;let s=this.viewportBounds.copy(),n=this.xt,o=this.bt,r=this.zoomPoint.x,a=this.zoomPoint.y,h=this.contentAlignment;isNaN(r)&&(h.isSide()?h.includesSide(D.LeftSide)?r=0:h.includesSide(D.RightSide)&&(r=n-1):h.isSpot()?r=h.x*(n-1):r=n/2),isNaN(a)&&(h.isSide()?h.includesSide(D.TopSide)?a=0:h.includesSide(D.BottomSide)&&(a=o-1):h.isSpot()?a=h.y*(o-1):a=o/2),this.scaleComputation!==null&&!this.animationManager.defaultAnimation.isAnimating&&(e=this.scaleComputation(this,e)),e<this.minScale&&(e=this.minScale),e>this.maxScale&&(e=this.maxScale);let l=P.V(this.at.x+r/t-r/e,this.at.y+a/t-a/e);this.position=l,P.e(l),this.tt=e,this._m(),this.Ql(),this.Ht=!1,this.onViewportBoundsChanged(s,this.viewportBounds,t,!1),this.Bs(!1),i.yL(t,this.tt),this.S()}MR(){let t=this.Xt.r;for(let e=0;e<t.length;e++)t[e].ML()}onViewportBoundsChanged(t,e,i,s){if(t.equals(e))return;s===void 0&&(s=!1),s||this.aa(),this._l();let n=this.layout;n!==null&&n.isViewportSized&&this.autoScale===1&&(t.width!==e.width||t.height!==e.height)&&n.invalidateLayout();let o=this.currentTool;this.Uc===!0&&o instanceof xe&&!this.animationManager.isTicking&&(this.lastInput.documentPoint=this.transformViewToDoc(this.lastInput.viewPoint),o.standardMouseActivity(this)),this.Ht||this.invalidateViewport(t,e),this.th(),this.Bi.scale=i,this.Bi.position.x=t.x,this.Bi.position.y=t.y,this.Bi.bounds.a(t),this.Bi.canvasSize.width=Math.round(t.width*i),this.Bi.canvasSize.height=Math.round(t.height*i),this.Bi.newCanvasSize.width=this.xt,this.Bi.newCanvasSize.height=this.bt,this.Bi.isScroll=s,this.D("ViewportBoundsChanged",this.Bi,t),this.isVirtualized&&this.links.each(r=>{r.isAvoiding&&r.actualBounds.intersectsRect(e)&&r.invalidateRoute()})}th(t){let e=this.Ze;if(e===null||!e.visible||e.part===null||e.layer===null)return;let i=t!==void 0?t:this.nb;if(!i.isReal())return;let s=i.width,n=i.height;if(e.scale=1,e.angle=0,e.layer.isViewportAligned)e.width=s*this.scale,e.height=n*this.scale,e.part.alignment=D.TopLeft;else{e.yi===null&&(e.yi=new gi);let o=e.yi.Yc;if(!o.isReal())return;e.width=s+o.width*2,e.height=n+o.height*2;let r=P.l();L.Dg(i.x,i.y,0,0,o.width,o.height,r),r.offset(-o.width,-o.height),e.part.location=r,P.e(r)}}clearSelection(t){t===void 0&&(t=!1);let e=this.selection;if(e.count===0)return;t||this.D("ChangingSelection",e);let i=e.toArray(),s=i.length;for(let n=0;n<s;n++){let o=i[n];o.isSelected=!1}e.Pt(),e.clear(),e.u(),t||this.D("ChangedSelection",e)}select(t){t!==null&&t.diagram===this&&(!t.isSelected||this.selection.count>1)&&(this.D("ChangingSelection",this.selection),this.clearSelection(!0),t.isSelected=!0,this.D("ChangedSelection",this.selection))}selectCollection(t){if(this.D("ChangingSelection",this.selection),this.clearSelection(!0),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];s instanceof Nt||f.o("Diagram.selectCollection given something that is not a Part: "+s),s.isSelected=!0}}else{let e=t.iterator;for(;e.next();){let i=e.value;i instanceof Nt||f.o("Diagram.selectCollection given something that is not a Part: "+i),i.isSelected=!0}}this.D("ChangedSelection",this.selection)}clearHighlighteds(){let t=this.highlighteds;if(t.count>0){let e=t.toArray(),i=e.length;for(let s=0;s<i;s++){let n=e[s];n.isHighlighted=!1}t.Pt(),t.clear(),t.u()}}highlight(t){t!==null&&t.diagram===this&&(!t.isHighlighted||this.highlighteds.count>1)&&(this.clearHighlighteds(),t.isHighlighted=!0)}highlightCollection(t){let e=new I().addAll(t),i=this.highlighteds.copy().removeAll(e).iterator;for(;i.next();){let n=i.value;n.isHighlighted=!1}let s=e.iterator;for(;s.next();){let n=s.value;n instanceof Nt||f.o("Diagram.highlightCollection given something that is not a Part: "+n),n.isHighlighted=!0}}scroll(t,e,i){i===void 0&&(i=1);let s=e==="up"||e==="down",n=0,o=P.l();if(t==="pixel")n=i;else if(t==="line")n=i*(s?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if(t==="page"){let a=s?this.viewportBounds.height:this.viewportBounds.width;if(a*=this.scale,a!==0){let h=Math.max(a-(s?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0);n=i*h}}else if(t==="document"){let a=this.documentBounds,h=this.viewportBounds;e==="up"?this.position=o.i(h.x,a.y):e==="left"?this.position=o.i(a.x,h.y):e==="down"?this.position=o.i(h.x,a.bottom-h.height):e==="right"&&(this.position=o.i(a.right-h.width,h.y)),P.e(o);return}else f.o("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+t);n/=this.scale;let r=this.position;e==="up"?this.position=o.i(r.x,r.y-n):e==="down"?this.position=o.i(r.x,r.y+n):e==="left"?this.position=o.i(r.x-n,r.y):e==="right"?this.position=o.i(r.x+n,r.y):f.o("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+e),P.e(o)}scrollToRect(t){let e=this.viewportBounds;if(e.containsRect(t))return;let i=t.center;i.x-=e.width/2,i.y-=e.height/2,this.position=i}centerRect(t){let e=this.viewportBounds,i=t.center;i.x-=e.width/2,i.y-=e.height/2,this.position=i}transformDocToView(t){return t.copy().T(this.T)}transformViewToDoc(t){return t.copy().Oe(this.T)}$F(t){return t.Oe(this.T)}static None=1;static Uniform=2;static UniformToFill=3;static CycleAll=1;static CycleNotDirected=2;static CycleNotDirectedFast=3;static CycleNotUndirected=4;static CycleDestinationTree=5;static CycleSourceTree=6;static DocumentScroll=1;static InfiniteScroll=2;static TreeParentCollapsed=1;static AllParentsCollapsed=2;static AnyParentsCollapsed=3;get opacity(){return this.$t}set opacity(t){let e=this.$t;e!==t&&(f.s(t,"number",U,"opacity"),(t<0||t>1)&&f.W(t,"0 <= value <= 1",U,"opacity"),this.$t=t,this.t("opacity",e,t),this.S())}get validCycle(){return this.Ux}set validCycle(t){let e=this.Ux;e!==t&&(this.Ux=t,this.t("validCycle",e,t))}get layers(){return this.Xt.iterator}get isModelReadOnly(){let t=this.ki;return t===null?!1:t.isReadOnly}set isModelReadOnly(t){let e=this.ki;e!==null&&(e.isReadOnly=t)}get isReadOnly(){return this.Ao}set isReadOnly(t){let e=this.Ao;e!==t&&(f.s(t,"boolean",U,"isReadOnly"),this.Ao=t,this.t("isReadOnly",e,t))}get isEnabled(){return this.Oi}set isEnabled(t){let e=this.Oi;e!==t&&(f.s(t,"boolean",U,"isEnabled"),this.Oi=t,this.t("isEnabled",e,t))}get allowClipboard(){return this.Kx}set allowClipboard(t){let e=this.Kx;e!==t&&(f.s(t,"boolean",U,"allowClipboard"),this.Kx=t,this.t("allowClipboard",e,t))}get allowCopy(){return this.Rl}set allowCopy(t){let e=this.Rl;e!==t&&(f.s(t,"boolean",U,"allowCopy"),this.Rl=t,this.t("allowCopy",e,t))}get allowDelete(){return this.vl}set allowDelete(t){let e=this.vl;e!==t&&(f.s(t,"boolean",U,"allowDelete"),this.vl=t,this.t("allowDelete",e,t))}get allowDragOut(){return this.jx}set allowDragOut(t){let e=this.jx;e!==t&&(f.s(t,"boolean",U,"allowDragOut"),this.jx=t,this.t("allowDragOut",e,t))}get allowDrop(){return this.Hx}set allowDrop(t){let e=this.Hx;e!==t&&(f.s(t,"boolean",U,"allowDrop"),this.Hx=t,this.t("allowDrop",e,t))}get allowTextEdit(){return this.Ol}set allowTextEdit(t){let e=this.Ol;e!==t&&(f.s(t,"boolean",U,"allowTextEdit"),this.Ol=t,this.t("allowTextEdit",e,t))}get allowGroup(){return this.Il}set allowGroup(t){let e=this.Il;e!==t&&(f.s(t,"boolean",U,"allowGroup"),this.Il=t,this.t("allowGroup",e,t))}get allowUngroup(){return this.El}set allowUngroup(t){let e=this.El;e!==t&&(f.s(t,"boolean",U,"allowUngroup"),this.El=t,this.t("allowUngroup",e,t))}get allowInsert(){return this.qx}set allowInsert(t){let e=this.qx;e!==t&&(f.s(t,"boolean",U,"allowInsert"),this.qx=t,this.t("allowInsert",e,t))}get allowLink(){return this.Ul}set allowLink(t){let e=this.Ul;e!==t&&(f.s(t,"boolean",U,"allowLink"),this.Ul=t,this.t("allowLink",e,t))}get allowRelink(){return this.Bl}set allowRelink(t){let e=this.Bl;e!==t&&(f.s(t,"boolean",U,"allowRelink"),this.Bl=t,this.t("allowRelink",e,t))}get allowMove(){return this.Vl}set allowMove(t){let e=this.Vl;e!==t&&(f.s(t,"boolean",U,"allowMove"),this.Vl=t,this.t("allowMove",e,t))}get allowReshape(){return this.zl}set allowReshape(t){let e=this.zl;e!==t&&(f.s(t,"boolean",U,"allowReshape"),this.zl=t,this.t("allowReshape",e,t))}get allowResize(){return this.Xl}set allowResize(t){let e=this.Xl;e!==t&&(f.s(t,"boolean",U,"allowResize"),this.Xl=t,this.t("allowResize",e,t))}get allowRotate(){return this.Yl}set allowRotate(t){let e=this.Yl;e!==t&&(f.s(t,"boolean",U,"allowRotate"),this.Yl=t,this.t("allowRotate",e,t))}get allowSelect(){return this.Gl}set allowSelect(t){let e=this.Gl;e!==t&&(f.s(t,"boolean",U,"allowSelect"),this.Gl=t,this.t("allowSelect",e,t))}get allowUndo(){return this.Wx}set allowUndo(t){let e=this.Wx;e!==t&&(f.s(t,"boolean",U,"allowUndo"),this.Wx=t,this.t("allowUndo",e,t))}get allowZoom(){return this.Jx}set allowZoom(t){let e=this.Jx;e!==t&&(f.s(t,"boolean",U,"allowZoom"),this.Jx=t,this.t("allowZoom",e,t))}get hasVerticalScrollbar(){return this.vu}set hasVerticalScrollbar(t){let e=this.vu;e!==t&&(f.s(t,"boolean",U,"hasVerticalScrollbar"),this.vu=t,this.aa(),this.S(),this.t("hasVerticalScrollbar",e,t),this.Bs(!1))}get hasHorizontalScrollbar(){return this.Ru}set hasHorizontalScrollbar(t){let e=this.Ru;e!==t&&(f.s(t,"boolean",U,"hasHorizontalScrollbar"),this.Ru=t,this.aa(),this.S(),this.t("hasHorizontalScrollbar",e,t),this.Bs(!1))}get allowHorizontalScroll(){return this.$x}set allowHorizontalScroll(t){let e=this.$x;e!==t&&(f.s(t,"boolean",U,"allowHorizontalScroll"),this.$x=t,this.t("allowHorizontalScroll",e,t),this.Bs(!1))}get allowVerticalScroll(){return this.Zx}set allowVerticalScroll(t){let e=this.Zx;e!==t&&(f.s(t,"boolean",U,"allowVerticalScroll"),this.Zx=t,this.t("allowVerticalScroll",e,t),this.Bs(!1))}get scrollHorizontalLineChange(){return this.Qx}set scrollHorizontalLineChange(t){let e=this.Qx;e!==t&&(f.s(t,"number",U,"scrollHorizontalLineChange"),t<0&&f.W(t,">= 0",U,"scrollHorizontalLineChange"),this.Qx=t,this.t("scrollHorizontalLineChange",e,t))}get scrollVerticalLineChange(){return this._x}set scrollVerticalLineChange(t){let e=this._x;e!==t&&(f.s(t,"number",U,"scrollVerticalLineChange"),t<0&&f.W(t,">= 0",U,"scrollVerticalLineChange"),this._x=t,this.t("scrollVerticalLineChange",e,t))}get lastInput(){return this._h}set lastInput(t){this._h=t}get previousInput(){return this.Br}set previousInput(t){this.Br=t}get firstInput(){return this.Gm}set firstInput(t){this.Gm=t}get currentCursor(){return this.Bx}set currentCursor(t){if(t===""&&(t=this.Um),this.Bx!==t){f.s(t,"string",U,"currentCursor");let e=this.ft,i=this.Mt;if(e===null||i===null)return;this.Bx=t;let s=e.style.cursor;e.style.cursor=t,i.style.cursor=t,e.style.cursor===s&&(e.style.cursor="-webkit-"+t,i.style.cursor="-webkit-"+t,e.style.cursor===s&&(e.style.cursor="-moz-"+t,i.style.cursor="-moz-"+t,e.style.cursor===s&&(e.style.cursor=t,i.style.cursor=t)))}}get defaultCursor(){return this.Um}set defaultCursor(t){t===""&&(t="auto");let e=this.Um;e!==t&&(f.s(t,"string",U,"defaultCursor"),this.Um=t,this.t("defaultCursor",e,t))}get click(){return this.Cr}set click(t){let e=this.Cr;e!==t&&(t!==null&&f.k(t,U,"click"),this.Cr=t,this.t("click",e,t))}get doubleClick(){return this.Lr}set doubleClick(t){let e=this.Lr;e!==t&&(t!==null&&f.k(t,U,"doubleClick"),this.Lr=t,this.t("doubleClick",e,t))}get contextClick(){return this.Ar}set contextClick(t){let e=this.Ar;e!==t&&(t!==null&&f.k(t,U,"contextClick"),this.Ar=t,this.t("contextClick",e,t))}get mouseOver(){return this.Tr}set mouseOver(t){let e=this.Tr;e!==t&&(t!==null&&f.k(t,U,"mouseOver"),this.Tr=t,this.t("mouseOver",e,t))}get mouseHover(){return this.Dr}set mouseHover(t){let e=this.Dr;e!==t&&(t!==null&&f.k(t,U,"mouseHover"),this.Dr=t,this.t("mouseHover",e,t))}get mouseHold(){return this.Fr}set mouseHold(t){let e=this.Fr;e!==t&&(t!==null&&f.k(t,U,"mouseHold"),this.Fr=t,this.t("mouseHold",e,t))}get mouseDragOver(){return this.Vx}set mouseDragOver(t){let e=this.Vx;e!==t&&(t!==null&&f.k(t,U,"mouseDragOver"),this.Vx=t,this.t("mouseDragOver",e,t))}get mouseDrop(){return this.Rr}set mouseDrop(t){let e=this.Rr;e!==t&&(this.Rr=t,this.t("mouseDrop",e,t))}get handlesDragDropForTopLevelParts(){return this.zx}set handlesDragDropForTopLevelParts(t){let e=this.zx;e!==t&&(f.s(t,"boolean",U,"handlesDragDropForTopLevelParts"),this.zx=t,this.t("handlesDragDropForTopLevelParts",e,t))}get mouseEnter(){return this.vr}set mouseEnter(t){let e=this.vr;e!==t&&(t!==null&&f.k(t,U,"mouseEnter"),this.vr=t,this.t("mouseEnter",e,t))}get mouseLeave(){return this.Or}set mouseLeave(t){let e=this.Or;e!==t&&(t!==null&&f.k(t,U,"mouseLeave"),this.Or=t,this.t("mouseLeave",e,t))}get toolTip(){return this.Ir}set toolTip(t){let e=this.Ir;e!==t&&(this.Ir=t,this.t("toolTip",e,t))}get contextMenu(){return this.Er}set contextMenu(t){let e=this.Er;e!==t&&(this.Er=t,this.t("contextMenu",e,t))}get commandHandler(){return this.sM}set commandHandler(t){let e=this.sM;e!==t&&(e&&e.doStop(),this.sM=t,t.Mo(this),t.doStart())}get toolManager(){return this.tM}set toolManager(t){this.tM!==t&&(this.tM=t,t.diagram=this)}get defaultTool(){return this.iM}set defaultTool(t){let e=this.iM;e!==t&&(this.iM=t,t.diagram=this,this.currentTool===e&&(this.currentTool=t))}get currentTool(){return this.eM}set currentTool(t){let e=this.eM;e&&(e.isActive&&e.doDeactivate(),e.cancelWaitAfter(),e.doStop()),t===null&&(t=this.defaultTool),t!==null&&(this.eM=t,t.diagram=this,t.doStart())}get selection(){return this.cM}get maxSelectionCount(){return this.sb}set maxSelectionCount(t){let e=this.sb;if(e!==t)if(f.s(t,"number",U,"maxSelectionCount"),t>=0&&!isNaN(t)){if(this.sb=t,this.t("maxSelectionCount",e,t),!this.undoManager.isUndoingRedoing){let i=this.selection.count-t;if(i>0){this.D("ChangingSelection",this.selection);let s=this.selection.toArray();for(let n=0;n<i;n++)s[n].isSelected=!1;this.D("ChangedSelection",this.selection)}}}else f.W(t,">= 0",U,"maxSelectionCount")}get nodeSelectionAdornmentTemplate(){return this.Xm}set nodeSelectionAdornmentTemplate(t){let e=this.Xm;e!==t&&(this.Xm=t.Et(),this.t("nodeSelectionAdornmentTemplate",e,t))}get groupSelectionAdornmentTemplate(){return this.rb}set groupSelectionAdornmentTemplate(t){let e=this.rb;e!==t&&(this.rb=t.Et(),this.t("groupSelectionAdornmentTemplate",e,t))}get linkSelectionAdornmentTemplate(){return this.lb}set linkSelectionAdornmentTemplate(t){let e=this.lb;e!==t&&(this.lb=t.Et(),this.t("linkSelectionAdornmentTemplate",e,t))}get highlighteds(){return this.fM}get isModified(){let t=this.undoManager;return t.isEnabled?t.currentTransaction!==null?!0:this.Uu&&this.Os!==t.historyIndex:this.Uu}set isModified(t){if(this.Uu!==t){f.s(t,"boolean",U,"isModified"),this.Uu=t;let e=this.undoManager;!t&&e.isEnabled&&(this.Os=e.historyIndex),t||this._L()}}_L(){let t=this.isModified;this.hM!==t&&(this.hM=t,this.D("Modified"))}get model(){return this.ki}set model(t){let e=this.ki;if(e!==t){this.currentTool.doCancel(),e&&e.undoManager!==t.undoManager&&e.undoManager.isInTransaction&&f.o("Do not replace a Diagram.model while a transaction is in progress."),this.animationManager.stopAnimation(!0);let i=this.OL(!0);this.jn=!1,this.Fu=!0,this.Os=-2,this.xr=!1;let s=this.Ht;this.Ht=!0,this.animationManager.Fl("Model"),e&&(this.Gn!==null&&this.Gn.each(n=>e.removeChangedListener(n)),e.removeChangedListener(this.lM)),this.ki=t,this.partManager=this.vR(this.ki.type),this.initializePartManager(this.partManager);for(let n=0;n<i.length;n++)this.add(i[n]);t.addChangedListener(this.rM),this.partManager.zM(),t.removeChangedListener(this.rM),t.addChangedListener(this.lM),this.Gn!==null&&this.Gn.each(n=>t.addChangedListener(n)),this.Ht=s,this.invalidateDocumentBounds(),this.Ht||this.S(),e&&t.undoManager.copyProperties(e.undoManager)}}get themeManager(){return this.NM}set themeManager(t){let e=this.NM;e!==t&&(e&&e.removeDiagram(this),this.NM=t,t!==null&&t.addDiagram(this))}initializePartManager(t){}static CM(t,e){U.AL.set(t,e)}static get licenseKey(){return U.XM.last()}static set licenseKey(t){U.XM.add(t.replace(/\s/g,""))}static get version(){return U.OR}static XM=new j;static OR="3.0.25";vR(t){let e=U.AL.get(t);return e!==null?new e:new Se}get X(){return this.oM}set X(t){this.oM=t}get bx(){return this.NL}IR(t){if(t.model!==this.model)return;let e=t.change,i=t.propertyName;if(e===1&&i[0]==="S"){if(i==="StartingFirstTransaction"){let s=this,n=this.toolManager;n.mouseDownTools.each(o=>o.diagram=s),n.mouseMoveTools.each(o=>o.diagram=s),n.mouseUpTools.each(o=>o.diagram=s),this.routers.each(o=>o.diagram=s),!this.ys&&!this.jn&&(this.vc=!0,this.Fu&&(this.xr=!0))}else if(i==="StartingUndo"||i==="StartingRedo"){let s=this.animationManager;this.skipsUndoManager||(s.defaultAnimation.isAnimating&&s.stopAnimation(),s.getBundleAnimation().isAnimating&&s.getBundleAnimation().stop()),this.D("ChangingSelection",this.selection)}else if(i==="StartedTransaction"){let s=this.animationManager;s.defaultAnimation.isAnimating&&!this.skipsUndoManager&&s.stopAnimation()}return}if(this.X){this.X=!1;try{if(t.modelChange===""&&e===1){(i==="FinishedUndo"||i==="FinishedRedo")&&(this.D("ChangedSelection",this.selection),this.Mi());let s=this.animationManager;i==="RolledBackTransaction"&&s.stopAnimation(),this.xL(),this.vc=!0,this.maybeUpdate(),(this.undoManager.transactionLevel===0||this.undoManager.transactionLevel===1)&&s.OS(),i==="CommittedTransaction"&&this.undoManager.isJustDiscarded&&(this.Os=Math.min(this.Os,this.undoManager.historyIndex-1)),(i==="CommittedTransaction"||i==="RolledBackTransaction")&&this.undoManager.Uw&&f.ir(()=>{this.isModified=!1},1);let n=t.isTransactionFinished;if(n&&(this._L(),this.bx.clear(),this.animationManager.OF()),!this.Xx&&n&&this.lastInput.targetDiagram){this.Xx=!0;let o=this;f.ir(()=>{o.currentTool.standardMouseOver(),o.Xx=!1},10)}}}finally{this.X=!0}}}get fe(){return this.nM}set fe(t){this.nM=t}get du(){return this.Yx}set du(t){this.Yx=t}GL(t){let e=t.C.r;for(let i of e)i instanceof zt&&this.YM(i)}YM(t){let e=t.element;if(e===null||!(e instanceof HTMLImageElement)||(e.ts instanceof I&&e.ts.add(this),t.ER(),!e.r0))return;let i=e.getAttribute("src")||"",s=this.Jl.get(i);if(s===null){zt.tA(t,e);let n=[];n.push(t),this.Jl.set(i,n)}else{for(let n=0;n<s.length;n++)if(s[n]===t)return;s.push(t)}}UR(t){let e=t.C.r,i=e.length;for(let s=0;s<i;s++)this.GM(e[s])}GM(t){if(!(t instanceof zt))return;let e=t.element;if(e===null||!(e instanceof HTMLImageElement)||!e.r0)return;let i=e.getAttribute("src")||"",s=this.Jl.get(i);if(s!==null){for(let n=0;n<s.length;n++)if(s[n]===t){s.splice(n,1),s.length===0&&(this.Jl.delete(i),zt.BR(e),e.ts instanceof I&&e.ts.delete(this),zt.clearCache(i));return}}}IL(){zt.clearCache(),this.Jl.clear()}rebuildParts(){this.partManager.rebuildParts()}Lc(t,e){this.ds.Lc(t,e)}Cc(t,e){this.ds.Cc(t,e)}findPartForKey(t){return this.partManager.findPartForKey(t)}findNodeForKey(t){return this.partManager.findNodeForKey(t)}findLinkForKey(t){return this.partManager.findLinkForKey(t)}findPartForData(t){return this.partManager.findPartForData(t)}findNodeForData(t){return this.partManager.findNodeForData(t)}findLinkForData(t){return this.partManager.findLinkForData(t)}findNodesByExample(...t){return this.partManager.findNodesByExample(...t)}findLinksByExample(...t){return this.partManager.findLinksByExample(...t)}get nodeTemplate(){return this.Ur.get("")}set nodeTemplate(t){let e=this.Ur.get("");e!==t&&(this.Ur.set("",t),this.t("nodeTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get nodeTemplateMap(){return this.Ur}set nodeTemplateMap(t){let e=this.Ur;e!==t&&(this.Ur=t,this.t("nodeTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get groupTemplate(){return this.Qh.get("")}set groupTemplate(t){let e=this.Qh.get("");e!==t&&(this.Qh.set("",t),this.t("groupTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get groupTemplateMap(){return this.Qh}set groupTemplateMap(t){let e=this.Qh;e!==t&&(this.Qh=t,this.t("groupTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get linkTemplate(){return this.ql.get("")}set linkTemplate(t){let e=this.ql.get("");e!==t&&(this.ql.set("",t),this.t("linkTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get linkTemplateMap(){return this.ql}set linkTemplateMap(t){let e=this.ql;e!==t&&(this.ql=t,this.t("linkTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get isMouseCaptured(){return this.aM}set isMouseCaptured(t){let e=this.ft;if(e===null)return;let i=e.Tt;i instanceof SVGElement||(t?(this.lastInput.bubbles=!1,this.Pi(i,"pointermove",this.na,!1),this.Pi(i,"pointerdown",this.Zl,!1),this.Pi(i,"pointerup",this.oa,!1),this.Pi(i,"pointerout",this.ra,!1),this.Pi(i,"pointercancel",this.la,!1),this.Ut(A,"pointermove",this.na,!0),this.Ut(A,"pointerdown",this.Zl,!0),this.Ut(A,"pointerup",this.oa,!0),this.Ut(A,"pointerout",this.ra,!0),this.Ut(A,"pointercancel",this.la,!0),this.Pi(i,"wheel",this.sa,!1),this.Ut(A,"wheel",this.sa,!0),this.Ut(A,"selectstart",this.jh,!1)):(this.Pi(A,"pointermove",this.na,!0),this.Pi(A,"pointerdown",this.Zl,!0),this.Pi(A,"pointerup",this.oa,!0),this.Pi(A,"pointerout",this.ra,!0),this.Pi(A,"pointercancel",this.la,!0),this.Ut(i,"pointermove",this.na,!1),this.Ut(i,"pointerdown",this.Zl,!1),this.Ut(i,"pointerup",this.oa,!1),this.Ut(i,"pointerout",this.ra,!1),this.Ut(i,"pointercancel",this.la,!1),this.Pi(A,"wheel",this.sa,!0),this.Pi(A,"selectstart",this.jh,!1),this.Ut(i,"wheel",this.sa,!1)),this.aM=t)}get position(){return this.at}set position(t){if(this.at.equals(t))return;let e=P.l().a(this.at),i=this.viewportBounds.copy();if(this.at.a(t),this.animationManager.pL(e,this.at),!this.Ht&&!(this.ft===null&&!this.Iu.isReal())){this.Ht=!0;let s=this.scale,n=this.xt/s,o=this.bt/s;this.DM(this.zm,n,o,this.Fc,!1),this.Ht=!1}else this.Ql(),this._m();if(!this.Ht){let s=this.viewportBounds;this.onViewportBoundsChanged(i,s,this.tt,!1)}P.e(e)}get initialPosition(){return this.Mx}set initialPosition(t){this.Mx.equals(t)||(this.Mx=t.P())}get initialScale(){return this.Nx}set initialScale(t){this.Nx!==t&&(f.s(t,"number",U,"initialScale"),this.Nx=t)}get grid(){return this.Ze===null&&(this.Ze=this.UL()),this.Ze}set grid(t){let e=this.Ze;if(e!==t){e===null&&(this.Ze=this.UL(),e=this.Ze),t.type!==H.Grid&&f.o("Diagram.grid must be a Panel of type Panel.Grid");let i=e.panel;i!==null&&i.remove(e),this.Ze=t,t.name="GRID",i!==null&&i.add(t),this.Eu=!1,this.S(),this.t("grid",e,t)}}get viewportBounds(){return this.nb}Ql(){let t=this.nb,e=this.at,i=this.tt;t.i(e.x,e.y,Math.max(this.xt,0)/i,Math.max(this.bt,0)/i),this._l()}get viewSize(){return this.Iu}set viewSize(t){let e=this.viewSize;if(!e.equals(t)){t=t.P(),this.Iu=t;let i=0,s=0;t.isReal()?(i=t.width,s=t.height):this.Mt!==null&&(i=this.Mt.clientWidth||1,s=this.Mt.clientHeight||1),this.xt=i,this.bt=s,this.Ql(),this.invalidateDocumentBounds(),this.t("viewSize",e,t),this.S()}}get fixedBounds(){return this.Tx}set fixedBounds(t){let e=this.Tx;e.equals(t)||((t.width===-1/0||t.height===1/0||t.height===-1/0)&&f.o("fixedBounds width/height must not be Infinity"),t=t.P(),this.Tx=t,this.invalidateDocumentBounds(),this.t("fixedBounds",e,t))}get scrollMargin(){return this.$h}set scrollMargin(t){typeof t=="number"&&(t=new Lt(t));let e=this.$h;e.equals(t)||(t=t.P(),this.$h=t,this.t("scrollMargin",e,t),this.mu())}get scrollMode(){return this.qh}set scrollMode(t){let e=this.qh;e!==t&&(this.qh=t,t===1&&this.Bs(!1),this.t("scrollMode",e,t),this.aa(),this.S())}get scrollsPageOnFocus(){return this.Dx}set scrollsPageOnFocus(t){let e=this.Dx;e!==t&&(f.s(t,"boolean",U,"scrollsPageOnFocus"),this.Dx=t,this.t("scrollsPageOnFocus",e,t))}get positionComputation(){return this.Fx}set positionComputation(t){let e=this.Fx;e!==t&&(t!==null&&f.k(t,U,"positionComputation"),this.Fx=t,this.Bs(!1),this.t("positionComputation",e,t))}get scaleComputation(){return this.Rx}set scaleComputation(t){let e=this.Rx;e!==t&&(t!==null&&f.k(t,U,"scaleComputation"),this.Rx=t,this.QL(this.scale,this.scale),this.t("scaleComputation",e,t))}get documentBounds(){return this.zm}iA(t){this.ta=!1;let e=this.zm;e.equals(t)||(e=e.copy(),this.zm.a(t),this.Bs(!1),this.D("DocumentBoundsChanged",void 0,e),this.aa(),this.S())}ensureBounds(){if(this.ta){let t=z.l();this.iA(this.computeBounds(t)),z.e(t)}}get isVirtualized(){return this.ob}set isVirtualized(t){let e=this.ob;e!==t&&(f.s(t,"boolean",U,"isVirtualized"),this.ob=t,this.t("isVirtualized",e,t))}get scale(){return this.tt}set scale(t){let e=this.tt;e!==t&&this.QL(e,t)}get defaultScale(){return this.Km}set defaultScale(t){this.Km=t}get autoScale(){return this.jl}set autoScale(t){let e=this.jl;e!==t&&(this.jl=t,this.t("autoScale",e,t),t!==1&&this.Bs(!1))}get initialAutoScale(){return this.Sr}set initialAutoScale(t){let e=this.Sr;e!==t&&(this.Sr=t,this.t("initialAutoScale",e,t))}get initialViewportSpot(){return this.Ox}set initialViewportSpot(t){let e=this.Ox;e!==t&&(t.isSpot()||f.o("initialViewportSpot must be a specific Spot: "+t),this.Ox=t,this.t("initialViewportSpot",e,t))}get initialDocumentSpot(){return this.vx}set initialDocumentSpot(t){let e=this.vx;e!==t&&(t.isSpot()||f.o("initialViewportSpot must be a specific Spot: "+t),this.vx=t,this.t("initialDocumentSpot",e,t))}get minScale(){return this.Cx}set minScale(t){let e=this.Cx;e!==t&&(t>0?(this.Cx=t,this.t("minScale",e,t),t>this.scale&&(this.scale=t)):f.W(t,"> 0",U,"minScale"))}get maxScale(){return this.Lx}set maxScale(t){let e=this.Lx;e!==t&&(t>0?(this.Lx=t,this.t("maxScale",e,t),t<this.scale&&(this.scale=t)):f.W(t,"> 0",U,"maxScale"))}get zoomPoint(){return this.Ax}set zoomPoint(t){this.Ax.equals(t)||(t=t.P(),this.Ax=t)}get contentAlignment(){return this.Fc}set contentAlignment(t){let e=this.Fc;e.equals(t)||(t=t.P(),this.Fc=t,this.t("contentAlignment",e,t),this.Bs(!1))}get initialContentAlignment(){return this.Om}set initialContentAlignment(t){let e=this.Om;e.equals(t)||(t=t.P(),this.Om=t,this.t("initialContentAlignment",e,t))}get padding(){return this.Zt}set padding(t){typeof t=="number"&&(t=new Lt(t));let e=this.Zt;e.equals(t)||(t=t.P(),this.Zt=t,this.invalidateDocumentBounds(),this.t("padding",e,t))}get partManager(){return this.pM}set partManager(t){let e=this.pM;e!==t&&(t.diagram!==null&&f.o("Cannot share PartManagers between Diagrams: "+t.toString()),e&&e.Mo(null),this.pM=t,t.Mo(this))}get nodes(){return this.partManager.nodes.iterator}get links(){return this.partManager.links.iterator}get parts(){return this.partManager.parts.iterator}findTopLevelNodesAndLinks(){let t=new I,e=this.nodes;for(;e.next();){let s=e.value;s.isTopLevel&&t.add(s)}let i=this.links;for(;i.next();){let s=i.value;s.isTopLevel&&t.add(s)}return t.iterator}findTopLevelGroups(){return this.zr.iterator}get routers(){return this.Vc}doLinkRouting(t){this.Co=!0;let e=this.Vc.r;for(let i=0;i<e.length;i++)e[i].canRoute(t)&&e[i].routeLinks(this.Mr,t);this.Co=!1}get layout(){return this.ie}set layout(t){let e=this.ie;e!==t&&(this.ie=t,t.diagram=this,t.group=null,this.Vr=!0,this.t("layout",e,t),this.requestUpdate())}layoutDiagram(t){this.Mi(),t&&this.Cb(!0),this.ys?this.vM(!1,this.bl||this.Vc.count!==0&&this.Yn.size!==0):(this.vc=!0,this.ur())}Cb(t){let e=this.zr.iterator;for(;e.next();)this.eA(e.value,t);this.layout&&(t?this.layout.isValidLayout=!1:this.layout.invalidateLayout())}eA(t,e){if(t===null)return;let i=t.ca.iterator;for(;i.next();){let s=i.value;this.eA(s,e)}t.layout!==null&&(e?t.layout.isValidLayout=!1:t.layout.invalidateLayout())}vM(t,e){if(this.Gx)return;let i=this.X;this.X=!0;let s="Layout",n=this.undoManager.transactionLevel,o=this.layout,r=this.animationManager;try{n===0&&(this.undoManager.wl=!0,this.startTransaction(s)),n<=1&&!r.defaultAnimation.isAnimating&&!r.pi&&(t||r.Fl(s)),this.Vr=!1;let a=this.zr.iterator;for(;a.next();)this.sA(a.value,t,n,e);let h=!1;if(o.isValidLayout||(!t||o.isRealtime||o.isRealtime===null||n===0?(o.doLayout(this),this.i0(this),h=!0,o.isValidLayout=!0):this.Vr=!0),h||this.i0(this),this.doLinkRouting(this),this.Mr.clear(),this.Zh.size!==0){for(let l=0;l<23&&this.Zh.size!==0;l++){for(a=this.zr.iterator;a.next();)this.nA(a.value);let u=this.Mr;this.Mr=this.Zh,this.Zh=u,this.i0(this),this.doLinkRouting(this)}this.Mr.clear(),this.Zh.clear()}}finally{let a=this.undoManager.wl;n===0&&(this.commitTransaction(s),this.undoManager.wl=!1),a&&(n===0||n===1)&&r.OS(),this.Vr&&(this.Vr=!o.isValidLayout),this.X=i}}sA(t,e,i,s){let n=t.ca.iterator;for(;n.next();)this.sA(n.value,e,i,s);let o=t.layout;o!==null&&!o.isValidLayout?!e||o.isRealtime||i===0?(t.fa=!t.location.isReal(),o.doLayout(t),t.invalidateLayout(32),this.Pb(t),this.i0(t),this.doLinkRouting(t),o.isValidLayout=!0):(this.doLinkRouting(t),this.Vr=!0):s&&this.doLinkRouting(t)}nA(t){let e=t.ca.iterator;for(;e.next();)this.nA(e.value);this.i0(t),this.doLinkRouting(t)}get isTreePathToChildren(){return this.Ix}set isTreePathToChildren(t){let e=this.Ix;if(e!==t&&(f.s(t,"boolean",U,"isTreePathToChildren"),this.Ix=t,this.t("isTreePathToChildren",e,t),!this.undoManager.isUndoingRedoing)){let i=this.nodes;for(;i.next();)i.value.l0()}}findTreeRoots(){let t=new j,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.Ex}set treeCollapsePolicy(t){let e=this.Ex;e!==t&&(t!==1&&t!==2&&t!==3&&f.o("Unknown Diagram.treeCollapsePolicy: "+t),this.Ex=t,this.t("treeCollapsePolicy",e,t))}get isCollapsingExpanding(){return this._S}set isCollapsingExpanding(t){this._S=t}rR(){let t=new pt,e=new pt;function i(s){let n=s.toLowerCase(),o=new j;t.set(s,o),t.set(n,o),e.set(s,s),e.set(n,s)}i("InitialAnimationStarting"),i("AnimationStarting"),i("AnimationFinished"),i("BackgroundSingleClicked"),i("BackgroundDoubleClicked"),i("BackgroundContextClicked"),i("ClipboardChanged"),i("ClipboardPasted"),i("DocumentBoundsChanged"),i("ExternalObjectsDropped"),i("GainedFocus"),i("InitialLayoutCompleted"),i("LayoutCompleted"),i("LinkDrawn"),i("LinkRelinked"),i("LinkReshaped"),i("LostFocus"),i("Modified"),i("ObjectSingleClicked"),i("ObjectDoubleClicked"),i("ObjectContextClicked"),i("PartCreated"),i("PartResized"),i("PartRotated"),i("SelectionMoved"),i("SelectionCopied"),i("SelectionDeleting"),i("SelectionDeleted"),i("SelectionGrouped"),i("SelectionUngrouped"),i("ChangingSelection"),i("ChangedSelection"),i("SubGraphCollapsed"),i("SubGraphExpanded"),i("TextEdited"),i("ThemeChanged"),i("TreeCollapsed"),i("TreeExpanded"),i("ViewportBoundsChanged"),i("InvalidateDraw"),this.ZS=t,this.QS=e}YL(t){let e=this.QS.get(t);return e!==null?e:this.QS.get(t.toLowerCase())}KM(t){let e=this.ZS.get(t);if(e!==null)return e;let i=t.toLowerCase();if(e=this.ZS.get(i),e!==null)return e;f.o("Unknown DiagramEvent name: "+t)}addDiagramListener(t,e){f.s(t,"string",U,"addDiagramListener:name"),f.k(e,U,"addDiagramListener:listener");let i=this.KM(t);return i!==null&&i.add(e),this}removeDiagramListener(t,e){f.s(t,"string",U,"removeDiagramListener:name"),f.k(e,U,"addDiagramListener:listener");let i=this.KM(t);i!==null&&i.delete(e)}raiseDiagramEvent(t,e,i){this.D(t,e,i)}D(t,e,i){let s=this.KM(t),n=new Wi;n.diagram=this;let o=this.YL(t);o!==null&&(n.name=o),e!==void 0&&(n.subject=e),i!==void 0&&(n.parameter=i);let r=s.length;if(r===1)s.elt(0)(n);else if(r!==0){let a=s.toArray();for(let h=0;h<r;h++){let l=a[h];l(n)}}}isUnoccupied(t,e){return this.getPositions(!1,null,e||null).isUnoccupied(t.x,t.y,t.width,t.height)}computeOccupiedArea(t){return this.isVirtualized?this.viewportBounds.copy():this.ta?this.VL(t):t.a(this.documentBounds)}getPositions(t,e,i){let s=this.Hl;s===null&&(this.Hl=s=new Et(this.avoidanceCellSize));let n=e;if(s.Fo||s.ua!==n||s.jM!==i){if(s.HM=Math.max(s.Gc+1,Math.floor(this.avoidanceLimit/this.avoidanceCellSize.width)),s.qM=Math.max(s.Gc+1,Math.floor(this.avoidanceLimit/this.avoidanceCellSize.height)),n!==null&&(n=this.oA(n)),n===null){let o=z.l();this.computeOccupiedArea(o),o.inflate(100,100),s.Lb(o);let r=this.nodes;for(;r.next();){let a=r.value,h=a.layer;h===null||!h.visible||h.isTemporary||this.WM(a,i,o)}z.e(o)}else{if(n.memberParts.count>0){let a=this.computePartsBounds(n.memberParts,!1);a.inflate(20,20),s.Lb(a)}let o=z.l(),r=n.memberParts;for(;r.next();){let a=r.value;a instanceof rt&&this.WM(a,i,o)}z.e(o)}s.ua=n,s.jM=i,s.Fo=!1}else t&&s.rA();return s}get avoidanceCellSize(){return this.uM}set avoidanceCellSize(t){this.Hl=null,this.uM=new Q(Math.max(1,t.width),Math.max(1,t.height))}get avoidanceLimit(){return this.dM}set avoidanceLimit(t){this.dM=Math.max(1,t)}oA(t){return t.canAvoid()?t:t.containingGroup!==null?this.oA(t.containingGroup):null}WM(t,e,i){if(t===e||!t.isVisible())return;let s=t.canAvoid();if(s){let n=t.getAvoidableRect(i);this.Hl.VR(n.x,n.y,n.width,n.height)}if(t instanceof ft&&(!s||t.avoidableMembers)){let n=t.memberParts;for(;n.next();){let o=n.value;o instanceof rt&&this.WM(o,e,i)}}}JM(t){this.Hl!==null&&!this.Hl.Fo&&(t===void 0||t.canAvoid())&&(this.Hl.Fo=!0)}get autoScrollInterval(){return this.Im}set autoScrollInterval(t){let e=this.Im;e!==t&&(this.Im=t,this.t("autoScrollInterval",e,t))}get autoScrollRegion(){return this.Em}set autoScrollRegion(t){typeof t=="number"&&(t=new Lt(t));let e=this.Em;e.equals(t)||(t=t.P(),this.Em=t,this.invalidateDocumentBounds(),this.t("autoScrollRegion",e,t))}doAutoScroll(t){this.Ym.a(t),this.computeAutoScrollPosition(this.Ym).equalsApprox(this.position)?this.stopAutoScroll():this.lA()}lA(){if(this.Rc!==-1)return;let t=this.Im,e=this;this.Rc=f.ir(()=>{if(e.Rc===-1||(e.stopAutoScroll(),e.lastInput.event===null))return;let i=e.computeAutoScrollPosition(e.Ym);if(i.equalsApprox(e.position))return;e.position=i,e.lastInput.documentPoint=e.transformViewToDoc(e.Ym),e.doMouseMove(),e.ta=!0;let s=z.l();e.computeBounds(s),s.unionRect(e.documentBounds),e.iA(s),z.e(s),e.Ue=!0,e.maybeUpdate(),e.lA()},t)}stopAutoScroll(){this.Rc!==-1&&(f.Tg(this.Rc),this.Rc=-1)}computeAutoScrollPosition(t){let e=this.position,i=this.Em;if(i.top<=0&&i.left<=0&&i.right<=0&&i.bottom<=0)return e;let s=this.viewportBounds,n=this.scale,o=z.V(0,0,s.width*n,s.height*n),r=P.V(0,0);if(t.x>=o.x&&t.x<o.x+i.left&&this.allowHorizontalScroll){let a=Math.max(this.scrollHorizontalLineChange,1);a=a|0,r.x-=a,t.x<o.x+i.left/2&&(r.x-=a),t.x<o.x+i.left/4&&(r.x-=4*a)}else if(t.x<=o.x+o.width&&t.x>o.x+o.width-i.right&&this.allowHorizontalScroll){let a=Math.max(this.scrollHorizontalLineChange,1);a=a|0,r.x+=a,t.x>o.x+o.width-i.right/2&&(r.x+=a),t.x>o.x+o.width-i.right/4&&(r.x+=4*a)}if(t.y>=o.y&&t.y<o.y+i.top&&this.allowVerticalScroll){let a=Math.max(this.scrollVerticalLineChange,1);a=a|0,r.y-=a,t.y<o.y+i.top/2&&(r.y-=a),t.y<o.y+i.top/4&&(r.y-=4*a)}else if(t.y<=o.y+o.height&&t.y>o.y+o.height-i.bottom&&this.allowVerticalScroll){let a=Math.max(this.scrollVerticalLineChange,1);a=a|0,r.y+=a,t.y>o.y+o.height-i.bottom/2&&(r.y+=a),t.y>o.y+o.height-i.bottom/4&&(r.y+=4*a)}return r.equalsApprox(P.xo)||(e=new P(e.x+r.x/n,e.y+r.y/n)),z.e(o),P.e(r),e}makeSvg(t){this.Wl.has("SVG")||this.addRenderer("SVG",new Ri(this,A.document));let e=new Ri(this,A.document,!0);t===void 0&&(t={});let i=this;function s(n,o){let r=i.hA(n,"SVG",e),a=r!==null?r.svg:null;return f.it(o)?(o(a),null):a}return this.aA(s,t)}makeSVG(t){return this.makeSvg(t)}addRenderer(t,e){this.Wl.set(t,e)}removeRenderer(t){this.Wl.delete(t)}cacheGroupExternalLinks(t){this.MM=t,t||this.nodes.each(e=>{e instanceof ft&&(e.h0=null)})}aA(t,e){let i=e.callback,s=!0,n=this.Jl.iterator;for(;n.next();)if(!n.value[0].hn){s=!1;break}if(!f.it(i)||s)return t(e,i,this);let o=this;function r(){let l=+new Date;for(s=!0,n.reset();n.next();)if(!n.value[0].hn){s=!1;break}if(s||l-h>a){t(e,i,o);return}A.requestAnimationFrame(r)}let a=e.callbackTimeout||300,h=+new Date;return A.requestAnimationFrame(()=>r()),null}makeImage(t){return U.isUsingDOM()?(t===void 0&&(t={}),t.returnType="Image",this.makeImageData(t)):null}makeImageData(t){return t===void 0&&(t={}),this.aA(this.zR,t)}static img="image";zR(t,e,i){let s=i.hA(t,"canvas",null);if(s===null)return null;let n=s.E.canvas,o=null;if(n!==null){let r=t.returnType;switch(r===void 0?r="string":r=r.toLowerCase(),r){case U.img+"data":o=s.getImageData(0,0,n.width,n.height);break;case U.img:let a=(t.document||document).createElement("img");a.src=n.toDataURL(t.type,t.details),o=a;break;case"blob":{let h=n;return f.it(e)||(o="",f.o('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.')),f.it(h.toBlob)?(h.toBlob(e,t.type,t.details),"toBlob"):(e(null),null)}case"string":default:o=n.toDataURL(t.type,t.details)}}return f.it(e)?(e(o),null):o}static XR=!1;hA(t,e,i){if(this.animationManager.stopAnimation(),this.maybeUpdate(),this.ft===null)return null;f.G(t)||f.o("properties argument must be an Object.");let s=!1,n=t.size||null,o=t.scale||null;t.scale!==void 0&&isNaN(t.scale)&&(o="NaN");let r=t.maxSize;t.maxSize===void 0&&(s=!0,e==="SVG"?r=new Q(1/0,1/0):r=new Q(2e3,2e3));let a=t.position||null,h=t.parts||null;Array.isArray(h)&&(h=new j(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||document,g=t.elementFinished||null,p=t.showTemporary;p===void 0&&(p=!c);let m=t.showGrid;m===void 0&&(m=p),n!==null&&isNaN(n.width)&&isNaN(n.height)&&(n=null),typeof l=="number"?l=new Lt(l):l instanceof Lt||f.o("MakeImage padding must be a Margin or a number."),l.left=Math.max(l.left,0),l.right=Math.max(l.right,0),l.top=Math.max(l.top,0),l.bottom=Math.max(l.bottom,0),this.Qt.clearContextCache(!0);let y=new Ue(null,d,void 0,!0),w=y.li;if(!(n||o||h||a))return y.width=this.xt+Math.ceil(l.left+l.right),y.height=this.bt+Math.ceil(l.top+l.bottom),e==="SVG"?i===null?null:(i.resize(y.width,y.height,y.width,y.height),i.jr=d,i.Gu=g,this.Sb(i.li,l,new Q(y.width,y.height),this.tt,this.at,h,u,p,m),i.li):(this.Bu=!1,this.Sb(w,l,new Q(y.width,y.height),this.tt,this.at,h,u,p,m),this.Bu=!0,y.li);let b=this.Km,v=this.documentBounds.copy();if(v.subtractMargin(this.Zt),p){let R=this.Xt.r,O=R.length;for(let B=0;B<O;B++){let K=R[B];if(!K.visible||!K.isTemporary)continue;let Y=K.Ct.r,X=Y.length;for(let G=0;G<X;G++){let nt=Y[G];if(!nt.isInDocumentBounds||!nt.isVisible())continue;let at=nt.actualBounds;at.isReal()&&v.unionRect(at)}}}let k=new P(v.x,v.y);if(h!==null){let R=new z(0,0,0,0),O=!0,B=h.iterator;for(B.reset();B.next();){let K=B.value;if(!(K instanceof Nt))continue;let Y=K.layer;if(Y!==null&&!Y.visible||Y!==null&&!p&&Y.isTemporary||!K.isVisible())continue;let X=K.actualBounds;X.isReal()&&(O?(O=!1,R.a(X)):R.unionRect(X))}v.width=R.width,v.height=R.height,k.x=R.x,k.y=R.y}a!==null&&a.isReal()&&(k=a,o||(o=b));let S=0,M=0;l!==null&&(S=l.left+l.right,M=l.top+l.bottom);let F=0,T=0;n!==null&&(F=n.width,T=n.height,isFinite(F)&&(F=Math.max(0,F-S)),isFinite(T)&&(T=Math.max(0,T-M)));let N=0,C=0;if(n!==null&&o!==null?(o==="NaN"&&(o=b),n.isReal()?(N=F,C=T):isNaN(T)?(N=F,C=v.height*o):(N=v.width*o,C=T)):n!==null?n.isReal()?(o=Math.min(F/v.width,T/v.height),N=F,C=T):isNaN(T)?(o=F/v.width,N=F,C=v.height*o):(o=T/v.height,N=v.width*o,C=T):o!==null?o==="NaN"&&r.isReal()?(o=Math.min((r.width-S)/v.width,(r.height-M)/v.height),o>b?(o=b,N=v.width,C=v.height):(N=r.width,C=r.height)):(N=v.width*o,C=v.height*o):(o=b,N=v.width,C=v.height),l!==null?(N+=S,C+=M):l=new Lt(0),r!==null){let R=r.width,O=r.height;e!=="SVG"&&s&&U.XR,isNaN(R)&&(R=2e3),isNaN(O)&&(O=2e3),isFinite(R)&&(N=Math.min(N,R)),isFinite(O)&&(C=Math.min(C,O))}return y.width=Math.ceil(N),y.height=Math.ceil(C),e==="SVG"?i===null?null:(i.resize(y.width,y.height,y.width,y.height),i.jr=d,i.Gu=g,this.Sb(i.li,l,new Q(Math.ceil(N),Math.ceil(C)),o,k,h,u,p,m),i.li):(this.Bu=!1,this.Sb(w,l,new Q(Math.ceil(N),Math.ceil(C)),o,k,h,u,p,m),this.Bu=!0,y.li)}static Xu=null;static cA="5da73c80a36555d4038e4972187c3cae51fd22";static mw=!1;static Gk=()=>{if(U.cA[5]===void 0&&(Pt.prototype.$e=Pt.prototype.kw),!U.isUsingDOM())return;let t=f.hs("canvas"),e=t.getContext("2d"),i=f.Ts("7ca11abfd022028846");e[i]=f.Ts("398c3597c01238");let s="7ca11abfd7330390",n=[U.cA,f.mw+"4ae6247590da4bb21c324ba3a84e385776",Pt.Gk+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",L.za],o=10,r=0;for(let a=1;a<5;a++)e[f.Ts(s)](f.Ts(n[a-1]),o,a*15+r);e[i]=f.Ts("39f046ebb36e4b");for(let a=1;a<5;a++)e[f.Ts(s)](f.Ts(n[a-1]),o,a*15+r);(n.length!==4||n[0][0]!=="5"||n[3][0]!=="7")&&(Pt.prototype.$e=Pt.prototype.kw),U.Xu=t}}class _o{fA;uA;$M;Ne;constructor(t){if(this.fA=null,this.uA="63ad05bbe23a1786468a4c741b6d2",this.$M="@onz",this.uA===this._tk){this.$M=!0,this.Ne=this.$M;return}this.Ne=null}YR(t,e){let i="f",s=A[f.Ts("76a715b2f73f148a")][f.Ts("72ba13b5")]||"",n=f.Ts;if(this.Ne=!0,!U.isUsingDOM())return;let o=U[n("76a115b6ed251eaf4692")];if(!o){let a=s[n("76ad18b4f73e")];for(let l=s[n("73a612b6fb191d")](n("35e7"))+2;l<a;l++)i+=s[l];let h=i[n("73a612b6fb191d")](n("7da71ca0ad381e90"));this.Ne=!(h>=0&&h<i[n("73a612b6fb191d")](n("35")));return}let r=U.XM.iterator;for(;r.next();){o=r.value;let a=n(o).split(n("39e9"));if(a.length<6)return;let h=n(a[1]).split(".");if(a[4]!=="7da71ca0")return;let l=n(f[n("6cae19")]).split(".");if(!(h[0]>l[0]||h[0]===l[0]&&h[1]>=l[1]))continue;let u="73a612b6fb191d",c=A[n("74a900bae4370f8b51")][n("6fbb13a1c2311e8a57")].toLowerCase(),d=c[n(u)](n("3aad1ab6e022098b4dc4")),g=n(a[2]);if(d>-1){let N=c[n(u)](g.toLowerCase()+"/");if(this.Ne=!(N>-1&&N<d),!this.Ne)return}let p=s[n("76ad18b4f73e")];for(let N=s[n(u)](n("35e7"))+2;N<p;N++)i+=s[N];let m=i[n(u)](g);if(m<0&&g!==n("7da71ca0ad381e90")&&(m=i[n(u)](n("76a715b2ef3e149757"))),m<0&&(m=i[n(u)](n("76a715b2ef3e149757"))),m<0&&(m=i[n(u)](n("2bfa41fdb3784bca12"))),m<0&&(m=s[n(u)](n("7baa19a6f76c1988428554"))),m<0&&(m=s[n(u)](n("7ea902b2b9221e9c57c45767196566"))),this.Ne=!(m>=0&&m<i[n(u)](n("35"))||i[n(u)](n("35"))===-1),!this.Ne||s[n(u)](n("7fb002b6ed25128b4da25b2e"))&&(this.Ne=!(s[n(u)](g)>-1),!this.Ne))return;let y=A[f.Ts("76a715b2f73f148a")][f.Ts("69ad17a1e03e")],w=y[n(u)](n("7fb002b6ed25128b4da25b2e"));if(w>-1&&(this.Ne=!(y[n(u)](g)>w),!this.Ne))return;let b=g;if(b[0]!=="#")continue;let v=f.hs("div"),k=a[0].replace(/[A-Za-z]/g,"");for(;k.length<4;)k+="9";let S=k;k=k.substring(k.length-4);let M="",F=["gsh","gsf"],T=["Header","Background","Display","Feedback"];if(M+=F[parseInt(k.substring(0,1),10)%2],M+=T[parseInt(k.substring(0,1),10)%4],v[n("79a417a0f0181a8946")]=M,A.document[n("78a712aa")]){A.document[n("78a712aa")][n("7bb806b6ed32388c4a875b")](v);let N=A.getComputedStyle(v).getPropertyValue(n("78a704b7e62456904c9b12701b6532a8")),C=A.getComputedStyle(v).getPropertyValue(n("75b817b0ea2202"));if(A.document[n("78a712aa")][n("68ad1bbcf533388c4a875b")](v),!N)continue;let R=A[n("77a902b0eb1b1e804a8a")],O="0."+parseInt(S,10)%100;if(C===O||N.indexOf(parseInt(b[1]+b[2],16))!==-1&&N.indexOf(parseInt(b[3]+b[4],16))!==-1){this.Ne=!1;return}else if(R&&R(n("32ae19a1e0331fc94084537c067a67fa59f1386b89d006")).matches){M="."+M;for(let B=0;B<document.styleSheets.length;B++){let K=document.styleSheets[B].rules||document.styleSheets[B].cssRules;for(let Y in K)if(M===K[Y].selectorText){this.Ne=!1;return}}}}else this.Ne=null,e&&(this.Ne=!1)}}Xu(t){return t.Qt.setTransform(t.Vi,0,0,t.Vi,0,0),t.Qt.commitTransform(),this.Ne===null&&this.YR(t,!0),0<this.Ne&&this!==this.fA}}class ni{ZM;QM;constructor(t){this.ZM=t===void 0?new P:t,this.QM=new P}get point(){return this.ZM}set point(t){this.ZM=t}get shifted(){return this.QM}set shifted(t){this.QM=t}}class tr{Me;qL;Nb;constructor(t,e,i){this.Me=t,this.qL=e,this.Nb=i}}class Qi{isGridSnapEnabled;isGridSnapRealtime;gridSnapCellSize;gridSnapCellSpot;gridSnapOrigin;dragsLink;dragsTree;groupsSnapMembers;groupsAlwaysMove;dragsMembers;constructor(t){this.Ri(),t&&Object.assign(this,t)}Ri(){this.isGridSnapEnabled=!1,this.isGridSnapRealtime=!0,this.gridSnapCellSize=new Q(NaN,NaN).u(),this.gridSnapCellSpot=D.TopLeft,this.gridSnapOrigin=new P(NaN,NaN).u(),this.dragsLink=!1,this.dragsTree=!1,this.groupsSnapMembers=!1,this.groupsAlwaysMove=!0,this.dragsMembers=!0}}class er extends U{constructor(t,e){let i;return t===void 0||typeof t=="string"||A.Element&&t instanceof Element?i=t:f.G(t)&&(e=t),super(i),this.dA(),e&&this.setProperties(e),this}dA(){this.allowDragOut=!0,this.allowMove=!1,this.isReadOnly=!0,this.contentAlignment=D.TopCenter,this.layout=new ri}setupRouters(){}reset(){super.reset(),this.dA()}}class _i extends U{Ab;Tb;Db;Fb;a0;Kc;Al;_M;t2;Rb;i2;constructor(t,e){let i;return t===void 0||typeof t=="string"||A.Element&&t instanceof Element?i=t:f.G(t)&&(e=t),super(i),this.animationManager.isEnabled=!1,this.Ht=!0,this.Ab=null,this.Ru=!1,this.vu=!1,this.Tb=!0,this.Db=!0,this.Fb=0,this.a0=!1,this.Kc=null,this.setRenderingHint("drawShadows",!1),this.Al=new Nt({selectable:!0,selectionAdorned:!1,selectionObjectName:"BOXSHAPE",locationObjectName:"BOXSHAPE",resizeObjectName:"BOXSHAPE",cursor:"move"}).add(new ut({name:"BOXSHAPE",fill:"transparent",stroke:"magenta",strokeWidth:2}).theme("stroke","overviewBox")).Et(),this.allowCopy=!1,this.allowDelete=!1,this.allowDrop=!1,this.allowSelect=!0,this.autoScrollRegion=new Lt(0,0,0,0),this.at.i(0,0),this.toolManager.Jt("Dragging",new ir,this.toolManager.mouseMoveTools),this.click=()=>{let s=this.observed;if(s===null)return;let n=s.viewportBounds,o=this.lastInput.documentPoint;s.position=new P(o.x-n.width/2,o.y-n.height/2)},this._M=s=>{this.invalidateDocumentBounds(),this.c0()},this.t2=s=>{this.observed!==null&&(this.invalidateDocumentBounds(),this.S())},this.Rb=s=>{this.updateDelay<1?this.S():this.a0||(this.a0=!0,f.ir(()=>this.redraw(),this.updateDelay))},this.i2=s=>{this.observed!==null&&this.c0()},this.autoScale=2,this.Ht=!1,e&&Object.assign(this,e),this}setupRouters(){}computePixelRatio(){return 1}redraw(){this.a0&&this.updateDelay>=1&&(this.a0=!1,this.GR()),super.redraw()}Ui(){if(this.Mt===null&&f.o("No div specified"),this.ft===null&&f.o("No canvas specified"),this.ft instanceof Ri||(this.box.JS(),!this.Ue))return;let t=this.observed;if(t===null||t.animationManager.defaultAnimation.isAnimating||!t.Vh)return;this.e0();let e=this.ft,i=this.Qt;if(i.clearContextCache(!0),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,e.width,e.height),this.updateDelay<1)this.gA();else if(this.Kc!==null){i.drawImage(this.Kc.Tt,0,0);let o=this.T;i.scale(this.Vi,this.Vi),i.transform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),i.commitTransform()}let s=this.Xt.r,n=s.length;for(let o=0;o<n;o++)s[o].Ui(i,this);this.Ic=!1,this.Ue=!1}GR(){let t=this.ft,e=this.Qt;if(!(t===null||e===null)){if(this.e0(),this.Kc===null){let i=new Ue(null);i.width=t.width,i.height=t.height,this.Kc=i}try{this.ft=this.Kc,this.Qt=this.ft.li,this.Qt.clearContextCache(!0),this.Qt.setTransform(1,0,0,1,0,0),this.Qt.clearRect(0,0,this.ft.width,this.ft.height),this.gA()}finally{this.ft=t,this.Qt=e}}}gA(){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=z.l().a(this.viewportBounds).unionRect(t.viewportBounds);t.th(u),z.e(u),t.Mi()}let n=this.T,o=this.Qt;o.scale(this.Vi,this.Vi),o.transform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),o.commitTransform();let r=this.viewportBounds,a=t.Xt.r,h=a.length,l=this.Xt.r;this.ps(l,l.length,this,this.viewportBounds);for(let u=0;u<h;u++)a[u].KF(o,r,this,e,i)}get observed(){return this.Ab}set observed(t){let e=this.Ab;if(t instanceof _i&&f.o("Overview.observed Diagram may not be an Overview itself: "+t),e!==t){if(e!==null&&this.KR(e),this.Ab=t,t!==null&&this.jR(t),this.invalidateDocumentBounds(),t===null){this.Kc=null;let i=this.ft,s=this.Qt;i&&s&&(s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,i.width,i.height))}else this.Rb(null),this.c0(),this.S();this.t("observed",e,t)}}get box(){return this.Al}set box(t){let e=this.Al;e!==t&&(t.Et(),this.Al=t,this.remove(e),this.add(this.Al),this.c0(),this.t("box",e,t))}get drawsTemporaryLayers(){return this.Tb}set drawsTemporaryLayers(t){this.Tb!==t&&(this.Tb=t,this.redraw())}get drawsGrid(){return this.Db}set drawsGrid(t){this.Db!==t&&(this.Db=t,this.redraw())}get updateDelay(){return this.Fb}set updateDelay(t){t<0&&(t=0),this.Fb!==t&&(this.Fb=t)}jR(t){t!==null&&(t.addDiagramListener("ViewportBoundsChanged",this._M),t.addDiagramListener("DocumentBoundsChanged",this.t2),t.addDiagramListener("InvalidateDraw",this.Rb),t.addDiagramListener("AnimationFinished",this.i2),this.add(this.box))}KR(t){t!==null&&(this.remove(this.box),t.removeDiagramListener("ViewportBoundsChanged",this._M),t.removeDiagramListener("DocumentBoundsChanged",this.t2),t.removeDiagramListener("InvalidateDraw",this.Rb),t.removeDiagramListener("AnimationFinished",this.i2))}c0(){let t=this.box,e=this.observed;if(e===null)return;this.Ue=!0;let i=e.viewportBounds,s=t.selectionObject,n=Q.l();n.i(i.width,i.height),s.desiredSize=n,Q.e(n);let o=2/this.scale;s instanceof ut&&(s.strokeWidth=o),t.location=new P(i.x-o/2,i.y-o/2),t.isSelected=!0}computeBounds(){let t=this.observed;if(t===null)return z.Fg;let e=t.documentBounds.copy();return e.unionRect(t.viewportBounds),e}invalidateViewport(t,e){this.Ue!==!0&&(this.Ue=!0,this.requestUpdate())}onViewportBoundsChanged(t,e,i,s){this.Ht||(this._l(),this.S(),this.aa(),this.invalidateDocumentBounds(),this.c0(),this.Bi.scale=i,this.Bi.position.x=t.x,this.Bi.position.y=t.y,this.Bi.bounds.a(t),this.Bi.isScroll=s,this.D("ViewportBoundsChanged",this.Bi,t))}}class ir extends Dt{eh;constructor(){super(),this.eh=null}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t===null||!t.allowMove||!t.allowSelect)return!1;let e=t.observed;if(e===null)return!1;let i=t.lastInput;if(!i.left||t.currentTool!==this&&(!this.isBeyondDragSize()||i.isTouchEvent&&i.timestamp-t.firstInput.timestamp<this.delay))return!1;if(this.findDraggablePart()===null){let s=e.viewportBounds;this.eh=new P(s.width/2,s.height/2);let n=t.firstInput.documentPoint;e.position=new P(n.x-this.eh.x,n.y-this.eh.y)}return!0}doActivate(){this.eh=null,super.doActivate()}doUpdateCursor(t){let e=this.diagram,i=e.box;i!==null&&i.cursor&&(e.currentCursor=i.cursor)}moveParts(t,e,i){i===void 0&&(i=!1);let s=this.diagram,n=s.observed;if(n===null)return;let o=s.box;if(o===null)return;if(this.eh===null){let a=s.firstInput.documentPoint,h=o.location;this.eh=new P(a.x-h.x,a.y-h.y)}let r=s.lastInput.documentPoint;n.position=new P(r.x-this.eh.x,r.y-this.eh.y)}}class be{N;e2;s2;o2;l2;h2;a2;c2;f2;nh;u2;vb;Ob;Ib;Eb;d2;Ro;g2;constructor(t){I.Ki(this),this.N=U.um(),this.e2=!0,this.s2=!0,this.o2=!0,this.l2=!1,this.h2=!1,this.a2=!1,this.c2=!1,this.f2=null,this.nh=null,this.u2=1.05,this.vb=NaN,this.Ob=null,this.Ib=NaN,this.Eb=z.Fg,this.d2=!1,this.Ro=null,this.g2=200,t&&Object.assign(this,t)}toString(){return"CommandHandler"}get diagram(){return this.N}Mo(t){this.N=t}doStart(){}doStop(){}doKeyDown(){let t=this.diagram,e=t.lastInput,i=f.tr?e.meta:e.control,s=e.shift,n=e.alt,o=e.commandKey;i&&(o==="Insert"||o==="c")?this.canCopySelection()&&this.copySelection():i&&o==="x"||s&&o==="Delete"?this.canCutSelection()&&this.cutSelection():i&&o==="v"||s&&o==="Insert"?this.canPasteSelection()&&this.pasteSelection():i&&o==="y"||i&&s&&o==="z"||n&&s&&o==="Backspace"?this.canRedo()&&this.redo():i&&o==="z"||n&&o==="Backspace"?this.canUndo()&&this.undo():o==="Delete"||o==="Backspace"?this.canDeleteSelection()&&this.deleteSelection():i&&o==="a"?this.canSelectAll()&&this.selectAll():o==="Escape"?this.canStopCommand()&&this.stopCommand():o==="ArrowUp"?t.allowVerticalScroll&&(i?t.scroll("pixel","up"):t.scroll("line","up")):o==="ArrowDown"?t.allowVerticalScroll&&(i?t.scroll("pixel","down"):t.scroll("line","down")):o==="ArrowLeft"?t.allowHorizontalScroll&&(i?t.scroll("pixel","left"):t.scroll("line","left")):o==="ArrowRight"?t.allowHorizontalScroll&&(i?t.scroll("pixel","right"):t.scroll("line","right")):o==="PageUp"?s&&t.allowHorizontalScroll?t.scroll("page","left"):t.allowVerticalScroll&&t.scroll("page","up"):o==="PageDown"?s&&t.allowHorizontalScroll?t.scroll("page","right"):t.allowVerticalScroll&&t.scroll("page","down"):o==="Home"?i&&t.allowVerticalScroll?t.scroll("document","up"):!i&&t.allowHorizontalScroll&&t.scroll("document","left"):o==="End"?i&&t.allowVerticalScroll?t.scroll("document","down"):!i&&t.allowHorizontalScroll&&t.scroll("document","right"):o==="Space"?this.canScrollToPart()&&this.scrollToPart():o==="Minus"||o==="NumpadSubtract"?this.canDecreaseZoom()&&this.decreaseZoom():o==="Equal"||o==="NumpadAdd"?this.canIncreaseZoom()&&this.increaseZoom():i&&o==="Digit0"?this.canResetZoom()&&this.resetZoom():s&&o==="z"?this.canZoomToFit()&&this.zoomToFit():i&&!s&&o==="g"?this.canGroupSelection()&&this.groupSelection():i&&s&&o==="g"?this.canUngroupSelection()&&this.ungroupSelection():o==="F2"?this.canEditTextBlock()&&this.editTextBlock():o==="ContextMenu"||s&&o==="F10"||i&&s&&o==="Backslash"?this.canShowContextMenu()&&this.showContextMenu():e.bubbles=!0}doKeyUp(){let t=this.diagram.lastInput;t.bubbles=!0}stopCommand(){let t=this.diagram,e=t.currentTool;e instanceof xe&&t.allowSelect&&t.clearSelection(),e!==null&&e.doCancel()}canStopCommand(){return!0}selectAll(){let t=this.diagram;t.S();try{t.currentCursor="wait",t.D("ChangingSelection",t.selection);let e=t.parts;for(;e.next();){let n=e.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}let i=t.nodes;for(;i.next();){let n=i.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}let s=t.links;for(;s.next();){let n=s.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}}finally{t.D("ChangedSelection",t.selection),t.currentCursor=""}}canSelectAll(){return this.diagram.allowSelect}deleteSelection(){let t=this.diagram;try{t.currentCursor="wait",t.D("ChangingSelection",t.selection),t.startTransaction("Delete"),t.D("SelectionDeleting",t.selection);let e=new I,i=t.selection.iterator;for(;i.next();){let s=i.value;Nt.oh(e,s,!0,this.deletesTree?1/0:0,this.deletesConnectedLinks?null:!1,n=>n.canDelete())}t.removeParts(e,!0),t.D("SelectionDeleted",e)}finally{t.commitTransaction("Delete"),t.D("ChangedSelection",t.selection),t.currentCursor=""}}canDeleteSelection(){let t=this.diagram;return!(t.isReadOnly||t.isModelReadOnly||!t.allowDelete||t.selection.count===0)}copySelection(){let t=this.diagram;try{let e=new I,i=t.selection.iterator;for(;i.next();){let s=i.value;Nt.oh(e,s,!0,this.copiesTree?1/0:0,this.copiesConnectedLinks,n=>n.canCopy())}this.copyToClipboard(e)}finally{}}canCopySelection(){let t=this.diagram;return!(!t.allowCopy||!t.allowClipboard||t.selection.count===0)}cutSelection(){this.copySelection(),this.deleteSelection()}canCutSelection(){let t=this.diagram;return!(t.isReadOnly||t.isModelReadOnly||!t.allowCopy||!t.allowDelete||!t.allowClipboard||t.selection.count===0)}copyToClipboard(t){let e=this.diagram,i=null;if(t===null)U.vL();else{let s=null;try{s=e.copyParts(t,null,!0)}finally{i=new j,s!==null&&i.addAll(s.iteratorValues),U.Zm=i,U.bb=e.model.dataFormat}}e.D("ClipboardChanged",i)}pasteFromClipboard(){let t=new I,e=U.Zm;if(e===null)return t;let i=this.diagram;if(U.bb!==i.model.dataFormat)return t;let s=null;try{s=i.copyParts(e,i,!1)}finally{if(s!==null){let n=s.iterator;for(;n.next();){let o=n.value,r=n.key;o.location.isReal()||(r.location.isReal()?o.location=r.location:!o.position.isReal()&&r.position.isReal()&&(o.position=r.position)),t.add(o)}}}return t}pasteSelection(t){t===void 0&&(t=null);let e=this.diagram;try{e.currentCursor="wait",e.D("ChangingSelection",e.selection),e.startTransaction("Paste");let i=this.pasteFromClipboard();i.count>0&&e.clearSelection(!0);let s=i.iterator;for(;s.next();){let n=s.value;n.isSelected=!0}if(t!==null){let n=e.computePartsBounds(e.selection);if(n.isReal()){let o=this.computeEffectiveCollection(e.selection,e.yb);e.TP(o,new P(t.x-n.centerX,t.y-n.centerY),e.yb,!1)}}e.D("ClipboardPasted",i)}finally{e.commitTransaction("Paste"),e.D("ChangedSelection",e.selection),e.currentCursor=""}}canPasteSelection(t){let e=this.diagram;return!(e.isReadOnly||e.isModelReadOnly||!e.allowInsert||!e.allowClipboard||U.Zm===null||U.Zm.count===0||U.bb!==e.model.dataFormat)}undo(){this.diagram.undoManager.undo()}canUndo(){let t=this.diagram;return t.isReadOnly||t.isModelReadOnly?!1:t.allowUndo&&t.undoManager.canUndo()}redo(){this.diagram.undoManager.redo()}canRedo(){let t=this.diagram;return t.isReadOnly||t.isModelReadOnly?!1:t.allowUndo&&t.undoManager.canRedo()}decreaseZoom(t){t===void 0&&(t=1/this.zoomFactor);let e=this.diagram;if(e.autoScale!==1)return;let i=e.scale*t;i<e.minScale||i>e.maxScale||(e.scale=i)}canDecreaseZoom(t){t===void 0&&(t=1/this.zoomFactor);let e=this.diagram;if(e.autoScale!==1)return!1;let i=e.scale*t;return i<e.minScale||i>e.maxScale?!1:e.allowZoom}increaseZoom(t){t===void 0&&(t=this.zoomFactor);let e=this.diagram;if(e.autoScale!==1)return;let i=e.scale*t;i<e.minScale||i>e.maxScale||(e.scale=i)}canIncreaseZoom(t){t===void 0&&(t=this.zoomFactor);let e=this.diagram;if(e.autoScale!==1)return!1;let i=e.scale*t;return i<e.minScale||i>e.maxScale?!1:e.allowZoom}resetZoom(t){t===void 0&&(t=this.defaultScale);let e=this.diagram;t<e.minScale||t>e.maxScale||(e.scale=t)}canResetZoom(t){t===void 0&&(t=this.defaultScale);let e=this.diagram;return t<e.minScale||t>e.maxScale?!1:e.allowZoom}zoomToFit(){let t=this.diagram,e=t.animationManager;e.stopAnimation(),t.redraw();let i=t.position,s=t.scale;e.Fl("Zoom To Fit"),this.isZoomToFitRestoreEnabled&&s===this.Ib&&!isNaN(this.vb)&&this.Ob!==null&&t.documentBounds.equals(this.Eb)?(t.scale=this.vb,t.position=this.Ob,this.Ib=NaN,this.Eb=z.Fg):(this.vb=s,this.Ob=i.copy(),t.zoomToFit(),this.Ib=t.scale,this.Eb=t.documentBounds.copy()),e.OS()}canZoomToFit(){return this.diagram.allowZoom}scrollToPart(t){t===void 0&&(t=null);let e=this.diagram;if(e.ensureBounds(),t===null){try{this.Ro!==null&&(this.Ro.next()?t=this.Ro.value:this.Ro=null)}catch{this.Ro=null}t===null&&(e.highlighteds.count>0?this.Ro=e.highlighteds.iterator:e.selection.count>0&&(this.Ro=e.selection.iterator),this.Ro!==null&&this.Ro.next()&&(t=this.Ro.value))}if(t!==null){let i=e.animationManager;i.Fl("Scroll To Part");let s=this.scrollToPartPause;if(s>0){let n=this.jc(t,[t]);if(n.length===1)e.startTransaction(),e.centerRect(t.actualBounds),e.commitTransaction("Scroll To Part");else{let o=()=>{e.startTransaction();let a=n.pop();for(;n.length>0&&a instanceof rt&&a.isTreeExpanded&&(!(a instanceof ft)||a.isSubGraphExpanded);)a=n.pop();n.length>0?(a instanceof Nt&&e.scrollToRect(a.actualBounds),a instanceof rt&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof ft&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof Nt&&e.centerRect(a.actualBounds),e.removeDiagramListener("LayoutCompleted",r)),e.commitTransaction("Scroll To Part")},r=()=>{f.ir(o,(i.isEnabled?i.duration:0)+s)};e.addDiagramListener("LayoutCompleted",r),o()}}else{let n=e.position.copy();e.centerRect(t.actualBounds),n.equalsApprox(e.position)&&i.stopAnimation()}}}jc(t,e){if(t.isVisible())return e;if(t instanceof St){let i=t.adornedPart;i!==null&&this.jc(i,e)}else if(t instanceof _){let i=t.fromNode;i!==null&&this.jc(i,e);let s=t.toNode;s!==null&&this.jc(s,e)}else{if(t instanceof rt){let s=t.labeledLink;s!==null&&this.jc(s,e);let n=t.findTreeParentNode();n!==null&&(!n.isTreeExpanded&&!n.wasTreeExpanded&&e.push(n),this.jc(n,e))}let i=t.containingGroup;i!==null&&(!i.isSubGraphExpanded&&!i.wasSubGraphExpanded&&e.push(i),this.jc(i,e))}return e}canScrollToPart(t){if(t===void 0&&(t=null),t!==null&&!(t instanceof Nt))return!1;let e=this.diagram;return e.selection.count===0&&e.highlighteds.count===0?!1:e.allowHorizontalScroll&&e.allowVerticalScroll}collapseTree(t){t===void 0&&(t=null);let e=this.diagram,i="Collapse Tree";try{e.startTransaction(i),e.animationManager.Fl(i);let s=new j;if(t!==null&&t.isTreeExpanded)t.collapseTree(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof rt&&o.isTreeExpanded&&(o.collapseTree(),s.add(o))}}e.D("TreeCollapsed",s)}finally{e.commitTransaction(i)}}canCollapseTree(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly)return!1;if(t!==null){if(!(t instanceof rt)||!t.isTreeExpanded)return!1;if(t.findTreeChildrenLinks().count>0)return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof rt){if(!s.isTreeExpanded)continue;if(s.findTreeChildrenLinks().count>0)return!0}}}return!1}expandTree(t){t===void 0&&(t=null);let e=this.diagram,i="Expand Tree";try{e.startTransaction(i),e.animationManager.Fl(i);let s=new j;if(t!==null&&!t.isTreeExpanded)t.expandTree(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof rt&&(o.isTreeExpanded||(o.expandTree(),s.add(o)))}}e.D("TreeExpanded",s)}finally{e.commitTransaction(i)}}canExpandTree(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly)return!1;if(t!==null){if(!(t instanceof rt)||t.isTreeExpanded)return!1;if(t.findTreeChildrenLinks().count>0)return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof rt){if(s.isTreeExpanded)continue;if(s.findTreeChildrenLinks().count>0)return!0}}}return!1}groupSelection(){let t=this.diagram,e=t.model;if(!e.Hc())return;let i=this.archetypeGroupData;if(i===null)return;let s=null;try{t.currentCursor="wait",t.D("ChangingSelection",t.selection),t.startTransaction("Group");let n=new j,o=t.selection.iterator;for(;o.next();){let l=o.value;l.ke()&&l.canGroup()&&n.add(l)}let r=new j,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 ft)i.Et(),s=i.copy(),s!==null&&t.add(s);else if(e.isGroupForData(i)){let u=e.copyNodeData(i);f.G(u)&&(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.D("SelectionGrouped",s)}finally{t.commitTransaction("Group"),t.D("ChangedSelection",t.selection),t.currentCursor=""}}canGroupSelection(){let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowGroup||!t.model.Hc()||this.archetypeGroupData===null)return!1;let e=t.selection.iterator;for(;e.next();){let i=e.value;if(i.ke()&&i.canGroup())return!0}return!1}m2(t){let e=f.et();if(Array.isArray(t))t.forEach(n=>{n instanceof _||n instanceof Nt&&e.push(n)});else{let n=t.iterator;for(;n.next();){let o=n.value;o instanceof _||o instanceof Nt&&e.push(o)}}let i=new I,s=e.length;for(let n=0;n<s;n++){let o=e[n],r=!0;for(let a=0;a<s;a++)if(o.isMemberOf(e[a])){r=!1;break}r&&i.add(o)}return f.J(e),i}isValidMember(t,e){if(e===null||t===e||e instanceof _)return!1;let i;return t!==null&&(t===e||t.isMemberOf(e)||(i=t.memberValidation,i!==null&&!i(t,e))||t.data===null&&e.data!==null||t.data!==null&&e.data===null)?!1:(i=this.memberValidation,i!==null?i(t,e):!0)}ungroupSelection(t){t===void 0&&(t=null);let e=this.diagram,i=e.model;if(i.Hc())try{e.currentCursor="wait",e.D("ChangingSelection",e.selection),e.startTransaction("Ungroup");let s=new j;if(t!==null)s.add(t);else{let o=e.selection.iterator;for(;o.next();){let r=o.value;r instanceof ft&&r.canUngroup()&&s.add(r)}}let n=new j;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 _)continue;let c=u.data;c!==null?i.setGroupForData(c,h):u.containingGroup=a}e.remove(r)}}e.D("SelectionUngrouped",s,n)}finally{e.commitTransaction("Ungroup"),e.D("ChangedSelection",e.selection),e.currentCursor=""}}canUngroupSelection(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly||e.isModelReadOnly||!e.allowDelete||!e.allowUngroup||!e.model.Hc())return!1;if(t!==null){if(!(t instanceof ft))return!1;if(t.canUngroup())return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ft&&s.canUngroup())return!0}}return!1}addTopLevelParts(t,e){let i=this.m2(t),s=!0,n=i.iterator;for(;n.next();){let o=n.value;o.containingGroup!==null&&(!e||this.isValidMember(null,o)?o.containingGroup=null:s=!1)}return s}collapseSubGraph(t){t===void 0&&(t=null);let e=this.diagram,i="Collapse SubGraph";try{e.startTransaction(i),e.animationManager.Fl(i);let s=new j;if(t!==null&&t.isSubGraphExpanded)t.collapseSubGraph(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof ft&&o.isSubGraphExpanded&&(o.collapseSubGraph(),s.add(o))}}e.D("SubGraphCollapsed",s)}finally{e.commitTransaction(i)}}canCollapseSubGraph(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly)return!1;if(t!==null)return!(!(t instanceof ft)||!t.isSubGraphExpanded);{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ft&&s.isSubGraphExpanded)return!0}}return!1}expandSubGraph(t){t===void 0&&(t=null);let e=this.diagram,i="Expand SubGraph",s=new j;try{if(e.startTransaction(i),e.animationManager.Fl(i),t!==null&&!t.isSubGraphExpanded)t.expandSubGraph(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof ft&&(o.isSubGraphExpanded||(o.expandSubGraph(),s.add(o)))}}e.D("SubGraphExpanded",s)}finally{for(let n of s)this.mA(e,n);t&&this.mA(e,t),e.commitTransaction(i)}}mA(t,e){for(let i of e.memberParts)i instanceof rt&&t.Cc(i,e)}canExpandSubGraph(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly)return!1;if(t!==null)return!(!(t instanceof ft)||t.isSubGraphExpanded);{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ft&&!s.isSubGraphExpanded)return!0}}return!1}editTextBlock(t){t===void 0&&(t=null);let e=this.diagram,i=e.toolManager.findTool("TextEditing");if(i!==null){if(t===null){let s=null,n=e.selection.iterator;for(;n.next();){let o=n.value;if(o.canEdit()){s=o;break}}if(s===null)return;t=s.findInVisualTree(o=>o instanceof xt&&o.editable)}t!==null&&(e.currentTool=null,i.textBlock=t,e.currentTool=i)}}canEditTextBlock(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly||e.isModelReadOnly||!e.allowTextEdit||e.toolManager.findTool("TextEditing")===null)return!1;if(t!==null){if(!(t instanceof xt))return!1;let i=t.part;if(i!==null&&i.canEdit())return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s.canEdit()&&(t=s.findInVisualTree(n=>n instanceof xt&&n.editable),t!==null))return!0}}return!1}showContextMenu(t){let e=this.diagram,i=e.toolManager.findTool("ContextMenu");if(i===null)return;t===void 0&&(t=null),t===null&&(e.selection.count>0?t=e.selection.first():t=e);let s=i.findObjectWithContextMenu(t);if(s!==null){let n=e.lastInput,o=null;if(s instanceof dt)o=s.getDocumentPoint(D.Center);else if(!e.viewportBounds.containsPoint(n.documentPoint)){let r=e.viewportBounds;o=new P(r.x+r.width/2,r.y+r.height/2)}if(o!==null){let r=new je;r.diagram=e,r.viewPoint=e.transformDocToView(o),r.documentPoint=o,r.button=2,r.up=!0,e.lastInput=r}e.currentTool=i,i.openMenu(!1,s)}}canShowContextMenu(t){let e=this.diagram,i=e.toolManager.findTool("ContextMenu");return!(i===null||(t===void 0&&(t=null),t===null&&(e.selection.count>0?t=e.selection.first():t=e),i.findObjectWithContextMenu(t)===null))}get copiesClipboardData(){return this.e2}set copiesClipboardData(t){f.s(t,"boolean",be,"copiesClipboardData"),this.e2=t}get copiesConnectedLinks(){return this.s2}set copiesConnectedLinks(t){f.s(t,"boolean",be,"copiesConnectedLinks"),this.s2=t}get deletesConnectedLinks(){return this.o2}set deletesConnectedLinks(t){f.s(t,"boolean",be,"deletesConnectedLinks"),this.o2=t}get copiesTree(){return this.l2}set copiesTree(t){f.s(t,"boolean",be,"copiesTree"),this.l2=t}get deletesTree(){return this.h2}set deletesTree(t){f.s(t,"boolean",be,"deletesTree"),this.h2=t}get copiesParentKey(){return this.a2}set copiesParentKey(t){f.s(t,"boolean",be,"copiesParentKey"),this.a2=t}get copiesGroupKey(){return this.c2}set copiesGroupKey(t){f.s(t,"boolean",be,"copiesGroupKey"),this.c2=t}get archetypeGroupData(){return this.f2}set archetypeGroupData(t){t!==null&&f.ec(t,be,"archetypeGroupData");let e=this.diagram;this.f2=t}get memberValidation(){return this.nh}set memberValidation(t){t!==null&&f.k(t,be,"memberValidation"),this.nh=t}get defaultScale(){return this.diagram.defaultScale}set defaultScale(t){this.diagram.defaultScale=t}get zoomFactor(){return this.u2}set zoomFactor(t){t>1||f.o("zoomFactor must be larger than 1.0, not: "+t),this.u2=t}get isZoomToFitRestoreEnabled(){return this.d2}set isZoomToFitRestoreEnabled(t){f.s(t,"boolean",be,"isZoomToFitRestoreEnabled"),this.d2=t}get scrollToPartPause(){return this.g2}set scrollToPartPause(t){this.g2=t}computeEffectiveCollection(t,e){let i=this.diagram,s=i.toolManager.findTool("Dragging"),n=i.currentTool===s;e===void 0&&(e=i.o0());let o=new pt;if(t===null)return o;let r=t.iterator;for(;r.next();){let a=r.value;i.Kr(o,a,n,e)}if(i.draggedLink!==null&&e.dragsLink)return o;for(r=t.iterator;r.next();){let a=r.value;if(a instanceof _){let h=a.fromNode;if(h!==null&&!o.has(h))o.delete(a);else{let l=a.toNode;l!==null&&!o.has(l)&&o.delete(a)}}}return o}}var ws=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Vertical=4]="Vertical",x[x.Horizontal=5]="Horizontal",x[x.Fill=2]="Fill",x))(ws||{}),bs=(x=>(x[x.None=0]="None",x[x.Along=21]="Along",x[x.Plus90=22]="Plus90",x[x.Minus90=23]="Minus90",x[x.Opposite=24]="Opposite",x[x.Upright=25]="Upright",x[x.Plus90Upright=26]="Plus90Upright",x[x.Minus90Upright=27]="Minus90Upright",x[x.Upright45=28]="Upright45",x))(bs||{}),Ln=(x=>(x[x.None=0]="None",x[x.Vertical=1]="Vertical",x[x.Horizontal=2]="Horizontal",x[x.Both=3]="Both",x))(Ln||{});class dt{n;f0;u0;Hr;p;lh;ct;at;se;$t;d0;Vs;Lt;is;qr;hh;wi;da;tt;Yt;Wr;Ni;zi;Ku;hi;ju;Ot;si;Jr;Ub;ah;Hu;constructor(){I.Ki(this),this.n=30723,this.$t=1,this.d0="",this.Vs=null,this.Lt=null,this.at=new P(NaN,NaN).u(),this.is=Q.ww,this.qr=new Pt,this.hh=new Pt,this.wi=null,this.da=1,this.tt=1,this.Yt=0,this.Wr=Lt.Rg,this.se=new z(NaN,NaN,NaN,NaN).u(),this.Ni=new z(NaN,NaN,NaN,NaN).u(),this.zi=new z(0,0,NaN,NaN).u(),this.Ku=null,this.f0=null,this.ct=null,this.hi=D.Default,this.ju=D.Default,this.u0=0,this.Hr=0,this.Ot=null,this.p=null,this.lh=null,this.si=null,this.Ub=null,this.ah=null,this.Jr=null,this.Hu=null}cloneProtected(t){t.n=(this.n|2048|4096)&-32769,t.$t=this.$t,t.d0=this.d0,t.Lt=this.Lt,t.at.a(this.at),t.is=this.is.P(),this.wi!==null?t.wi=this.wi.copy():t.wi=null,t.tt=this.tt,t.Yt=this.Yt,t.Wr=this.Wr.P(),t.se.a(this.se),t.Ni.a(this.Ni),t.zi.a(this.zi),t.f0=this.f0,this.ct!==null&&(t.ct=this.ct.copy()),t.hi=this.hi.P(),t.ju=this.ju.P(),t.u0=this.u0,t.Hr=this.Hr,this.Ot!==null&&(t.Ot=this.Ot.copy()),this.p!==null&&(this.p.fi?t.p=this.p:t.p=this.p.copy()),this.lh!==null&&(t.lh=this.lh.slice()),this.si!==null&&(t.si=this.si.copy())}addCopyProperty(t){let e=this.lh;if(!Array.isArray(e))e=[],this.lh=e;else for(let i=0;i<e.length;i++)if(e[i]===t)return;e.push(t)}vo(t){t.Ku=null,t.Jr=null,t.c()}clone(){let t=new this.constructor;if(this.cloneProtected(t),this.lh!==null)for(let e=0;e<this.lh.length;e++){let i=this.lh[e];t[i]=this[i]}return t}copy(){return this.clone()}rS(){let t=this.Ci;if(t!==null){this.Ci=null;for(let e of t)e.qu()&&(e.isToData?this.themeData(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter):e.isToObject?this.themeObject(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter,e.sourceName):e.isToModel?this.themeModel(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter):this.theme(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter))}return this}oi(t){t in bs?this.segmentOrientation=t:t in ws?this.stretch=t:f.er(this,t)}toString(){return f.Dn(this.constructor)+"#"+I.as(this)}static None=0;static Default=1;static Fill=2;static Vertical;static Horizontal;static Uniform=6;static UniformToFill=7;static FlipVertical=1;static FlipHorizontal=2;static FlipBoth=3;ch(){this.p!==null&&(this.p.fi=!0)}Kt(){return this.p===null?this.p=new oi:this.p.fi&&(this.p=this.p.copy()),this.p}Be(){if(this.ct===null){let t=new is;t.ga=D.None,t.ma=D.None,t.pa=10,t.ya=10,t.wa=0,t.xa=0,this.ct=t}return this.ct}raiseChangedEvent(t,e,i,s,n,o,r){let a=this.part;if(a!==null){a.qc(t,e,i,s,n,o,r),i===this&&t===2&&this.Wc()&&this.ba(a,e);let h=this.diagram;if(this.ws!==null&&h!==null&&h.Vh&&!h.undoManager.isUndoingRedoing&&!h.animationManager.pu){let l=this.ws.get(e);if(l!==null&&h.animationManager.isEnabled&&!h.animationManager.isTicking){this.Hu===null&&(this.Hu=new pt);let u=h.undoManager.transactionLevel===0;if(l.startCondition===2?u=!0:l.startCondition===3&&(u=!1),u){let c=new Ce;l.XF(c);let d=this.Hu.get(l);d!==null&&d.stop(),this.Hu.set(l,c),c.mx=this,c.XS=l,c.add(this,e,s,n),c.start()}else h.animationManager.getBundleAnimation().add(this,e,s,n)}}if(this instanceof H&&i===a&&a.p2()&&a.data!==null){let l=this.C.r,u=l.length;for(let c=0;c<u;c++){let d=l[c];d instanceof H&&d.Gr(g=>{g.data!==null&&g.p2()&&g.updateTargetBindings(e)})}}}}UF(t){this.Hu.delete(t)}Do(){if(this.diagram!==null&&this.findBindingPanel()===null&&this.Ci!==null){let t=this.diagram.model,e=this.Ci.iterator;for(;e.next();){let i=e.value;if(!i.isToTheme)continue;let s=null,n=i.sourceName;i.isToObject&&(s=this.pA(n));let o=this,r=i.targetId;r!==-1&&(o=this.g0(r),o===null)||(n==="/"?s=o.part:n==="."?s=o:n===".."&&(s=o.panel),i.updateTarget(o,s,void 0,t))}}}ba(t,e){let i=this.findBindingPanel();if(i!==null){let s=t.diagram,n=this.Ci.iterator;for(;n.next();){let o=n.value,r=null;if(o.isToObject){if(r=o.yA(i,this),r===null)continue;o.updateSource(this,r,e,null)}else if(o.isToModel)s!==null&&!s.fe&&o.updateSource(this,s.model.modelData,e,i);else if(!o.isToTheme){let a=i.data;if(a===null)continue;s!==null&&!s.fe&&o.updateSource(this,a,e,i)}if(r===this){let a=o.targetId,h=i.g0(a);h!==null&&o.updateTarget(h,r,e,s?.model)}}}}g0(t){return this.Hn===t?this:null}pA(t){let e;return t===""?e=this:t==="/"?e=this:t==="."?e=this:t===".."?e=this:e=this.part.findObject(t),e}get Hn(){return this.p!==null?this.p.Hn:-1}set Hn(t){this.Hn!==t&&(this.p===null&&(this.p=new oi),this.p.Hn=t)}get Ci(){return this.p!==null?this.p.Ci:null}set Ci(t){this.Ci!==t&&(this.p===null&&(this.p=new oi),this.p.Ci=t)}get qn(){return this.p!==null?this.p.qn:null}set qn(t){this.qn!==t&&(this.p===null&&(this.p=new oi),this.p.qn=t)}raiseChanged(t,e,i){this.raiseChangedEvent(2,t,this,e,i)}t(t,e,i){this.raiseChangedEvent(2,t,this,e,i)}Wn(t,e,i,s){let n=this.se;if(n.i(t,e,i,s),this.tt!==1||this.Yt!==0){this.wi===null&&(this.wi=new Pt);let o=this.wi;o.Ri(),this.m0(o,t,e,i,s),o.vg(n)}}wA(t,e,i){return this.pickable===!1?!1:(i.nc(this.T),e?this.intersectsRect(t,i):this.containedInRect(t,i))}xA(t,e,i){if(this.pickable===!1)return!1;let s=this.naturalBounds,n=t.distanceSquaredPoint(e);return i?P.distanceLineSegmentSquared(t.x,t.y,0,0,0,s.height)<=n||P.distanceLineSegmentSquared(t.x,t.y,0,s.height,s.width,s.height)<=n||P.distanceLineSegmentSquared(t.x,t.y,s.width,s.height,s.width,0)<=n||P.distanceLineSegmentSquared(t.x,t.y,s.width,0,0,0)<=n:t.distanceSquared(0,0)<=n&&t.distanceSquared(0,s.height)<=n&&t.distanceSquared(s.width,0)<=n&&t.distanceSquared(s.width,s.height)<=n}an(){return!0}containsPoint(t){let e=P.l();e.a(t),this.T.gt(e);let i=this.actualBounds;if(!i.isReal())return P.e(e),!1;let s=this.diagram;if(s!==null&&s.Hm){let o=s.getInputOption("extraTouchThreshold"),r=s.getInputOption("extraTouchArea"),a=r/2,h=this.naturalBounds,l=this.getDocumentScale()*s.scale,u=1/l;if(h.width*l<o&&h.height*l<o){let c=z.contains(i.x-a*u,i.y-a*u,i.width+r*u,i.height+r*u,e.x,e.y);return P.e(e),c}}let n=!1;return(this instanceof St||this instanceof ut?z.contains(i.x-5,i.y-5,i.width+10,i.height+10,e.x,e.y):i.containsPoint(e))&&(this.si&&!this.si.containsPoint(e)?n=!1:this.Lt!==null&&this.zi.containsPoint(t)?n=!0:n=this.fh(t)),P.e(e),n}fh(t){let e=this.naturalBounds;return z.contains(0,0,e.width,e.height,t.x,t.y)}containsRect(t){if(this.angle===0)return this.actualBounds.containsRect(t);let e=this.naturalBounds,i=z.V(0,0,e.width,e.height),s=this.T,n=!1,o=P.V(t.x,t.y);return i.containsPoint(s.$e(o))&&(o.i(t.x,t.bottom),i.containsPoint(s.$e(o))&&(o.i(t.right,t.bottom),i.containsPoint(s.$e(o))&&(o.i(t.right,t.y),i.containsPoint(s.$e(o))&&(n=!0)))),P.e(o),z.e(i),n}containedInRect(t,e){if(e===void 0)return t.containsRect(this.actualBounds);let i=this.naturalBounds,s=e,n=!1,o=P.V(0,0);return t.containsPoint(s.gt(o))&&(o.i(0,i.height),t.containsPoint(s.gt(o))&&(o.i(i.width,i.height),t.containsPoint(s.gt(o))&&(o.i(i.width,0),t.containsPoint(s.gt(o))&&(n=!0)))),P.e(o),n}intersectsRect(t,e){if(e===void 0&&(e=this.T,this.angle===0))return t.intersectsRect(this.actualBounds);let i=this.naturalBounds,s=e,n=P.V(0,0),o=P.V(0,i.height),r=P.V(i.width,i.height),a=P.V(i.width,0),h=!1;if(t.containsPoint(s.gt(n))||t.containsPoint(s.gt(o))||t.containsPoint(s.gt(r))||t.containsPoint(s.gt(a)))h=!0;else{let l=z.V(0,0,i.width,i.height),u=P.V(t.x,t.y);l.containsPoint(s.$e(u))?h=!0:(u.i(t.x,t.bottom),l.containsPoint(s.$e(u))?h=!0:(u.i(t.right,t.bottom),l.containsPoint(s.$e(u))?h=!0:(u.i(t.right,t.y),l.containsPoint(s.$e(u))&&(h=!0)))),P.e(u),z.e(l),h||(L.Mw(t,n,o)||L.Mw(t,o,r)||L.Mw(t,r,a)||L.Mw(t,a,n))&&(h=!0)}return P.e(n),P.e(o),P.e(r),P.e(a),h}getDocumentPoint(t,e){if(e===void 0&&(e=new P),t instanceof D){let i=t,s=this.naturalBounds;return e.i(i.x*s.width+i.offsetX,i.y*s.height+i.offsetY),this.Us.gt(e),e}else return e.set(t),this.Us.gt(e),e}getDocumentBounds(t){t===void 0&&(t=new z);let e=this.naturalBounds,i=this.Us,s=P.V(0,0).T(i);return t.i(s.x,s.y,0,0),s.i(e.width,0).T(i),t.unionNoCheck(s.x,s.y,0,0),s.i(e.width,e.height).T(i),t.unionNoCheck(s.x,s.y,0,0),s.i(0,e.height).T(i),t.unionNoCheck(s.x,s.y,0,0),P.e(s),t}getDocumentAngle(){return this.Us.ZD()}getDocumentScale(){if(this.p0()===!1)return this.da;let t=this.tt;return this.panel!==null?t*this.panel.getDocumentScale():t}getLocalPoint(t,e){return e===void 0&&(e=new P),e.a(t),this.Us.$e(e),e}getNearestIntersectionPoint(t,e,i){return this.Jc(t.x,t.y,e.x,e.y,i)}Jc(t,e,i,s,n){let o=this.T,r=1/(o.m11*o.m22-o.m12*o.m21),a=o.m22*r,h=-o.m12*r,l=-o.m21*r,u=o.m11*r,c=r*(o.m21*o.dy-o.m22*o.dx),d=r*(o.m12*o.dx-o.m11*o.dy),g=t*a+e*l+c,p=t*h+e*u+d,m=i*a+s*l+c,y=i*h+s*u+d;n.i(0,0);let w=this.naturalBounds,b=L.gl(0,0,w.width,w.height,g,p,m,y,n);return n.T(o),b}ht(t,e,i,s){if(this.To()===!1)return;let n=this.Wr,o=n.right+n.left,r=n.top+n.bottom;t=Math.max(t-o,0),e=Math.max(e-r,0),i=i||0,s=s||0,i=Math.max(i-o,0),s=Math.max(s-r,0);let a=this.angle,h=0,l=this.desiredSize,u=this.y0();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,g=this instanceof H;switch(this.zs(!0)){case 0:c=0,d=0,g&&(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,g&&(e=1/0);break;case 4:isFinite(e)&&e>s&&(d=e),c=0,g&&(t=1/0);break}let p=this.maxSize,m=this.minSize;c>p.width&&m.width<p.width&&(c=p.width),d>p.height&&m.height<p.height&&(d=p.height),i=Math.max(c,m.width),s=Math.max(d,m.height),p.width<i&&(i=Math.min(m.width,i)),p.height<s&&(s=Math.min(m.height,s)),t=Math.min(p.width,t),e=Math.min(p.height,e),t=Math.max(i,t),e=Math.max(s,e),(a===90||a===270)&&(h=t,t=e,e=h,h=i,i=s,s=h),this.se.Pt(),this.Wu(t,e,i,s),this.se.u(),this.se.isReal()||f.o("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.se.toString()),this.ue(!1)}Wu(t,e,i,s){}Xs(){return!1}Bt(t,e,i,s,n){this.$c();let o=z.l();o.a(this.Ni),this.Ni.Pt(),this._e()===!1?this.Ni.i(t,e,i,s):this.uh(t,e,i,s),this.Ni.u(),n===void 0?this.si=null:this.si=n;let r=!1;if(n!==void 0)r=!0;else{let a=this.panel;if(a!==null&&a.$r()&&(a=a.panel),a!==null){let h=a.zi,l=this.measuredBounds,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 xt){let d=this.naturalBounds;(this.w0>d.height||this.ui>d.width)&&(r=!0)}}}r?this.n|=256:this.n&=-257,this.Ni.isReal()||f.o("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.Ni.toString()),this.Ju(o,this.Ni),this.Jn(!1),z.e(o)}uh(t,e,i,s){}commonArrange(t,e,i,s){if(this.Ni.i(t,e,i,s),this.desiredSize.isReal())return;let n=this.se,o=this.Wr,r=o.right+o.left,a=o.top+o.bottom,h=n.width+r,l=n.height+a;i+=r,s+=a;let u=this.zs(!0);switch(h===i&&l===s&&(u=0),u){case 0:(h>i||l>s)&&(this.ue(!0),this.ht(h>i?i:h,l>s?s:l,0,0));break;case 2:this.ue(!0),this.ht(i,s,0,0);break;case 5:this.ue(!0),this.ht(i,l,0,0);break;case 4:this.ue(!0),this.ht(h,s,0,0);break}}Ju(t,e){let i=this.part;i!==null&&i.diagram!==null&&((i.selectionObject===this||i.resizeObject===this||i.rotateObject===this)&&i.w2(!0),this.S(),!t.equalsApproxClose(e)&&(i.dh(),this.x0(i)))}x0(t){this.portId!==null&&(t.w2(!0),t instanceof rt&&t.bA(this))}get shadowVisible(){return this.p!==null?this.p.b0:null}set shadowVisible(t){let e=this.shadowVisible;e!==t&&(this.Kt().b0=t,this.Ve(!0),this.S(),this.t("shadowVisible",e,t))}HR(t,e){let i=this.naturalBounds,s=this.hh,n=s.m11,o=s.m21,r=s.dx,a=s.m12,h=s.m22,l=s.dy,u=0,c=0,d=u,g=c;u=d*n+g*o+r,c=d*a+g*h+l;let p=u,m=c,y=0,w=0;d=i.width+e,g=0,u=d*n+g*o+r,c=d*a+g*h+l;let b=Math.min(p,u),v=Math.min(m,c);y=Math.max(p+y,u)-b,w=Math.max(m+w,c)-v,p=b,m=v,d=i.width+e,g=i.height+e,u=d*n+g*o+r,c=d*a+g*h+l,b=Math.min(p,u),v=Math.min(m,c),y=Math.max(p+y,u)-b,w=Math.max(m+w,c)-v,p=b,m=v,d=0,g=i.height+e,u=d*n+g*o+r,c=d*a+g*h+l,b=Math.min(p,u),v=Math.min(m,c),y=Math.max(p+y,u)-b,w=Math.max(m+w,c)-v,p=b,m=v;let k=t.viewportBounds,S=k.x,M=k.y,F=k.width,T=k.height;return p>F+S||S>y+p||m>T+M||M>w+m}Ui(t,e){if(this.qR(t,e)||!this.visible)return;let i=this.opacity;if(i===0)return;let s=1;i!==1&&(s=t.globalAlpha,t.globalAlpha=s*i);let n="";this.filter!==""&&(n=t.filter,t.filter=this.filter);let o=this.T,r=this.panel;this.p0()===!0&&this.Bb();let a=this.part,h=!1,l=0;if(a&&e.getRenderingHint("drawShadows")&&(h=a.isShadowed,h)){let m=a.shadowOffset;l=Math.max(m.y,m.x)*e.scale*e.Vi}let u=this instanceof H&&this.$r(),c=this.Ni;if(u&&(this.kA(h,t,!1,r),this.WR(t,e),this.PA(h,t,!1,r),this.SA(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.Xs();if(!e.ia&&d&&this.HR(e,l)){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}let g=(this.n&256)!==0;if(t.clipInsteadOfFill&&(g=!1),this instanceof xt&&(t.font=this.font),g){let m=r.an()?r.naturalBounds:r.actualBounds,y=Math.max(c.x,m.x),w=Math.max(c.y,m.y),b=Math.min(c.right,m.right)-y,v=Math.min(c.bottom,m.bottom)-w,k=this.si;if(k!==null&&(y=k.x,w=k.y,b=k.width,v=k.height),y>c.width+c.x||c.x>m.width+m.x){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}t.save(),t.beginPath(),t.rect(y,w,b,v),t.clip()}if(d){if(!a.isVisible()){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}if(h){let m=a.shadowOffset;t.shadowsSet(m.x*e.scale*this.scale*e.Vi,m.y*e.scale*this.scale*e.Vi,a.shadowBlur),t.shadowsOn(),t.shadowColor=a.shadowColor}}let p=this.naturalBounds;if(t.transform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.kA(h,t,d,r),this.Lt!==null&&(t.commitTransform(),this.Vb(t,p,c)),this.PA(h,t,d,r),this.gh(t,e),this.SA(h,t,d),g&&(t.restore(),t.clearContextCache(this instanceof H)),!o.Yk()){let m=1/(o.m11*o.m22-o.m12*o.m21);t.transform(o.m22*m,-o.m12*m,-o.m21*m,o.m11*m,m*(o.m21*o.dy-o.m22*o.dx),m*(o.m12*o.dx-o.m11*o.dy))}i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n)}kA(t,e,i,s){t&&this.shadowVisible===!0?e.shadowsOn():t&&this.shadowVisible===!1&&e.shadowsOff(),t&&this.zb(s)&&this.shadowVisible===null&&e.shadowsOff()}PA(t,e,i,s){t&&(this.Lt!==null||this.zb(s))?(this.Xb(!0),this.shadowVisible===null&&e.shadowsOff()):this.Xb(!1)}SA(t,e,i){t&&this.b2()===!0&&e.shadowsOn(),i&&t&&e.shadowsOff()}JR(t,e,i){let s=this.part,n=!1;s&&t.getRenderingHint("drawShadows")&&(n=s.isShadowed),e.clipInsteadOfFill&&(n=!1),this.Xs()&&n&&e.shadowsOn(),n&&this.shadowVisible===!0?e.shadowsOn():n&&this.shadowVisible===!1&&e.shadowsOff();let o=this.panel;if(n&&this.zb(o)&&this.shadowVisible===null&&e.shadowsOff(),e.Zr){let r=t.computePixelRatio(),a=`drop-shadow(${e.shadowOffsetX/r}px ${e.shadowOffsetY/r}px ${e.shadowBlur/r/2}px ${e.shadowColor})`;this.background!==null&&i.Lt.setAttributeNS(null,"filter",a)}return n&&(this.Lt!==null||this.zb(o))?(this.Xb(!0),this.shadowVisible===null&&e.shadowsOff()):this.Xb(!1),n}$R(t,e,i,s){if(i.Zr){let n=e.computePixelRatio(),o=`drop-shadow(${i.shadowOffsetX/n}px ${i.shadowOffsetY/n}px ${i.shadowBlur/n/2}px ${i.shadowColor})`;this.k2(t,o)}s&&this.b2()===!0&&i.shadowsOn(),this.Xs()&&i.shadowsOff()}zb(t){return t===null?!1:(t.$r()&&(t=t.panel),t.b2()||(t.type===H.Auto||t.type===H.Spot)&&t.findMainElement()!==this)}k2(t,e){}Vb(t,e,i){let s=this.y0(),n=e.x,o=e.y,r=e.width+s,a=e.height+s;this.rn(t,this.Lt,!0,!1,e,i),this.Lt instanceof E&&this.Lt.type===3?(t.beginPath(),t.rect(n-s/2,o-s/2,r,a),t.fillContext(this.Lt,!1,null)):t.fillRect(n-s/2,o-s/2,r,a)}MA(t,e){let i=t.ZR(this),s=t.ah!==null?t.ah:t.svg;if(i!==-1)if(i===0)if(s.Lt)s.Lt.after(e);else if(t.type===H.Table){let n=s.getElementsByClassName("gojs-ts"),o=n.length!==0?n[0]:null;o!==null&&o.after(e)}else s.prepend(e);else{for(;i!==0&&!t.elt(i-1).isVisibleObject();)i--;if(i===0)s.prepend(e);else{let n=t.elt(i-1).svg;n!==null?n.after(e):s.appendChild(e)}}}qR(t,e){if(!(t instanceof ce))return!1;if(!this.visible||this.opacity===0)return this.svg!==null&&this.svg.parentNode!==null&&this.svg.remove(),!0;let i=this.Ni;if(this.Xs()&&(!this.isVisible()||i.width===0||i.height===0||isNaN(i.x)||isNaN(i.y)))return this.svg!==null&&this.svg.parentNode!==null&&this.svg.remove(),!0;let s=this.panel,n=this.$u(t);if(this.Zc(t,e,n))return this.NA(this.svg),this.svg.parentElement!==null?(this.Xs()&&(t.lastDrawnPart=this.svg),!0):(this.Xs()?(t.lastDrawnPart!==null?t.lastDrawnPart.after(this.svg):t.diagramGroup.prepend(this.svg),t.lastDrawnPart=this.svg):s&&this.MA(s,this.svg),!0);if(this.Ve(!1),this.Xs()&&this.isShadowed){let p=this.shadowOffset;t.shadowsSet(p.x*e.scale*this.scale*e.Vi,p.y*e.scale*this.scale*e.Vi,this.shadowBlur),t.shadowsOn(),t.shadowColor=this.shadowColor}this instanceof xt&&(t.font=this.font),t.currentElement=null;let o=this.T,r=this instanceof H,a=this instanceof H?this.$r():!1,h=this.svg;if(this.p0()===!0&&this.Bb(),t.setCurrentTransform(1,0,0,1,0,0),t.outerGroup=!1,n)if(t.outerGroup=!0,r&&a)t.newGroup(1,0,0,1,0,0),this.svg=t.lastCreatedElement;else if(r&&this.isClipping){let p=this.findMainElement(),m=0,y=0;p!==null&&(m=p.actualBounds.x,y=p.actualBounds.y),t.newGroup(o.m11,o.m12,o.m21,o.m22,o.dx+m,o.dy+y),this.svg=t.lastCreatedElement,p!==null&&t.createOrUpdateClipGroup(this,p.actualBounds),t.currentElement=t.lastCreatedElement}else r?(t.newGroup(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.svg=t.lastCreatedElement):t.newGroup(1,0,0,1,0,0);let l=this.naturalBounds;r||t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.background!==null&&(r?(a&&t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.Vb(t,l,i),a&&t.setCurrentTransform(1,0,0,1,0,0)):(t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.Vb(t,l,i)),t.currentElement.Lt=t.lastCreatedElement,t.currentElement.prepend(t.lastCreatedElement));let u=this.JR(e,t,t.currentElement);this.gh(t,e),r&&t.endGroup(),t.outerGroup&&t.endGroup();let c=t.surface.Gu,d=r?this.svg:t.currentElement;if(h!==null&&d!==h&&h.parentNode===this.panel.svg){let p=this.svg.getAttribute("filter");return p!==null&&d.setAttribute("filter",p),this.filter!==""&&d.setAttributeNS(null,"filter",this.filter),h.replaceWith(d),this.svg=d,d!==null&&this.k0(t,s,i,d),!0}if(this.svg=d,c!==null&&d===null&&t.dummyGroup(),d===null)return!0;this.k0(t,s,i,d),this.$R(d,e,t,u);let g=this.Xs()?this.opacity*t.globalAlpha:this.opacity;if(g!==1&&d.setAttributeNS(null,"opacity",g.toString()),this.filter!==""&&d.setAttributeNS(null,"filter",this.filter),this.Xs()){if(h!==null&&d!==h&&h.parentNode===t.diagramGroup){let p=h.getAttribute("filter");p!==null&&d.setAttribute("filter",p),h.replaceWith(d)}else t.lastDrawnPart?t.lastDrawnPart.after(d):t.diagramGroup.prepend(d);t.lastDrawnPart=d}else s!==null&&this.MA(s,d);return c!==null&&c(this,d),this.NA(d),!0}NA(t){let e=this,i=t.dataset;e instanceof dt&&(e.portId!==null&&(i.portId=e.portId),e instanceof H&&(isNaN(e.itemIndex)||(i.itemIndex=e.itemIndex.toString()),e instanceof Nt&&(i.className=f.Dn(e),e.key!==void 0&&(i.key=e.key.toString()),e.containingGroup!==null&&(i.group=e.containingGroup.key.toString()),e instanceof _&&(e.fromNode!==null&&e.fromNode.key!==void 0&&(i.fromKey=e.fromNode.key.toString()),e.fromPortId!==""&&(i.fromPortId=e.fromPortId),e.toNode!==null&&e.toNode.key!==void 0&&(i.toKey=e.toNode.key.toString()),e.toPortId!==""&&(i.toPortId=e.toPortId)))))}k0(t,e,i,s){let n=(this.n&256)!==0;if(t.clipInsteadOfFill&&(n=!1),!n){s.removeAttributeNS(null,"clip-path");return}let o=e.an()?e.naturalBounds:e.actualBounds,r=Math.max(i.x,o.x),a=Math.max(i.y,o.y),h=Math.min(i.right,o.right)-r,l=Math.min(i.bottom,o.bottom)-a,u=this.si;u!==null&&(r=u.x,a=u.y,h=u.width,l=u.height);let c=new z(r,a,Math.max(h,0),Math.max(l,0));this instanceof H&&this.T.copy().bw().vg(c),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`)}QR(){if(this.svg===null)return;let t=this.svg.innerHTML.match(/url\(#((CLIP|GRAD).+?)\)/g),e=this.svg.ownerDocument;if(t!==null)for(let i of t){let s=e.getElementById(i.split("#")[1].slice(0,-1));s!==null&&s.remove()}this.svg.remove()}WR(t,e){let i=this.Ni,s=this.zi,n=this.Lt;n!==null&&t.commitTransform(),n!==null&&(this.rn(t,n,!0,!1,s,i),n instanceof E&&n.type===3?(t.beginPath(),t.rect(i.x,i.y,i.width,i.height),t.fillContext(n,!1,null)):t.fillRect(i.x,i.y,i.width,i.height)),this.gh(t,e)}gh(t,e){}Qc(){this.Ve(!0)}Zc(t,e,i){let s=this.svg;if(this._R()){if(this.Qc(),this.Ve(!1),s===null)return!1;let 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.T,o="matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+n.dx+", "+n.dy+")",r=this instanceof H,a=r?this.$r():!1;if(!(r&&a))if(this instanceof zt){let u=this.Yb;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 ut){let u=s.getElementsByTagName("path");for(let c=0;c<u.length;c++)u[c].setAttributeNS(null,"transform",o)}else if(this instanceof xt){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.ah){let u=this.findMainElement(),c=u!==null?u.actualBounds.x:0,d=u!==null?u.actualBounds.y:0;this.ah.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.Xs()?this.opacity*t.globalAlpha:this.opacity;h===1?s.removeAttribute("opacity"):s.setAttributeNS(null,"opacity",h.toString()),t.setCurrentTransform(1,0,0,1,0,0);let l=this.ah?this.ah:this.Ub;if(this.background!==null||l.Lt!==void 0){let u=l.Lt;if(this.background===null)t.removeOldGradient(this,l.Lt,"fill"),l.Lt.remove(),l.Lt=void 0;else{if((a||i&&!(this instanceof H))&&t.setCurrentTransform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),this.Vb(t,this.naturalBounds,this.actualBounds),l.Lt){t.removeOldGradient(this,l.Lt,"fill");let c=l.Lt.getAttribute("filter");c!==null&&t.lastCreatedElement.setAttribute("filter",c),l.Lt.replaceWith(t.lastCreatedElement)}else l.prepend(t.lastCreatedElement);l.Lt=t.lastCreatedElement}u&&t.removeOldGradient(this,u,"fill")}return this.k0(t,this.panel,this.actualBounds,s),!0}$u(t){if(this.background!==null)return!0;let e=(this.n&256)!==0;return t.clipInsteadOfFill&&(e=!1),!!e}static TE(t,e,i,s,n,o,r){let a=.001,h=o.length;t.moveTo(e,i);let l=s-e,u=n-i;l===0&&(l=.001);let c=u/l,d=Math.sqrt(l*l+u*u),g=0,p=!0;a=o[g%h];let m=r!==0;for(;d>=.1;){if(m){for(a=o[g++%h],a-=r;a<0;)a+=o[g++%h],p=!p;m=!1}else a=o[g++%h];a>d&&(a=d);let y=Math.sqrt(a*a/(1+c*c));l<0&&(y=-y),e+=y,i+=c*y,p?t.lineTo(e,i):t.moveTo(e,i),d-=a,p=!p}}rn(t,e,i,s,n,o){let r=1,a=1;if(typeof e=="string"){i?t.fillStyle=e:t.strokeStyle=e;return}else if(e.type===1){i?t.fillStyle=e.color:t.strokeStyle=e.color;return}let h,l=this.y0();r=n.width,a=n.height,s?(r=o.width,a=o.height):i||(r+=l,a+=l);let u=t instanceof Ei;if(u&&e.cn&&(e.type===4||e._c===r&&e.Gb===a))h=e.cn;else{let c=0,d=0,g=0,p=0,m=0,y=0,w=0,b=0;if(s?(w=o.x,b=o.y):i||(w-=l/2,b-=l/2),c=e.start.x*r+e.start.offsetX+w,d=e.start.y*a+e.start.offsetY+b,g=e.end.x*r+e.end.offsetX+w,p=e.end.y*a+e.end.offsetY+b,e.type===2)h=t.createLinearGradient(c,d,g,p);else if(e.type===3)y=isNaN(e.endRadius)?Math.max(r,a)/2:e.endRadius,isNaN(e.startRadius)?(m=0,y=Math.max(r,a)/2):m=e.startRadius,h=t.createRadialGradient(c,d,m,g,p,y);else if(e.type===4)try{h=t.createPattern(e.pattern,"repeat")}catch{h=null}else f.Zi(e.type,"Brush type");if(e.type!==4){let v=e.colorStops;if(v!==null){let k=v.iterator;for(;k.next();)h.addColorStop(k.key,k.value)}}if(u&&(e.cn=h,h!==null&&(e._c=r,e.Gb=a),h===null&&e.type===4&&e._c!==-1)){e._c=-1;let v=this.diagram;v!==null&&e._c===-1&&f.ir(()=>{v.redraw()},600)}}i?t.fillStyle=h:t.strokeStyle=h}isContainedBy(t){return t instanceof H?this.tv(this,t):!1}tv(t,e){if(t===e||e===null)return!1;let i=t.panel;for(;i!==null;){if(i===e)return!0;i=i.panel}return!1}isVisibleObject(){if(!this.visible)return!1;let t=this.panel;return t!==null?t.isVisibleObject():!0}isEnabledObject(){let t=this instanceof H?this:this.panel;for(;t!==null&&t.isEnabled;)t=t.panel;return t===null}get enabledChanged(){return this.p!==null?this.p.P0:null}set enabledChanged(t){let e=this.enabledChanged;e!==t&&(t!==null&&f.k(t,dt,"enabledChanged"),this.Kt().P0=t,this.t("enabledChanged",e,t))}Bb(){if(this.Kb()===!0){let t=this.qr;if(t.Ri(),!this.Ni.isReal()||!this.se.isReal()){this.Zu(!1);return}if(t.Fs(this.Ni.x-this.se.x,this.Ni.y-this.se.y),this.scale!==1||this.angle!==0){let e=this.naturalBounds;this.m0(t,e.x,e.y,e.width,e.height)}this.Zu(!1),this.ka(!0)}if(this.p0()===!0){let t=this.panel;if(t===null)this.hh.set(this.qr),this.da=this.scale;else if(t.Us!==null){let e=this.hh;e.Ri(),t.an()?e.nc(t.hh):t.panel!==null&&e.nc(t.panel.hh),e.nc(this.qr),this.da=this.scale*t.da}this.ka(!1)}}m0(t,e,i,s,n){if(this.tt!==1&&t.tt(this.tt),this.Yt===0)return;let o=P.l();o.setSpot(e,i,s,n,D.Center),t.cs(this.Yt,o.x,o.y),P.e(o)}c(t){if(this.To())return;t===void 0&&(t=!1),this.ue(!0),this.Jn(!0);let e=this.panel;e!==null&&!t&&e.c()}tf(){this.To()||(this.ue(!0),this.Jn(!0))}ef(t){if(this._e())return;let e=this.panel;!t&&e!==null&&e.c(),this.Jn(!0)}$c(){this.Kb()===!1&&(this.Zu(!0),this.ka(!0))}P2(){this.ka(!0)}S(){let t=this.part;t!==null&&t.S()}zs(t){let e=this.stretch,i=this.panel;if(i===null)return this.Oo(e===1?0:e,t);if(i.type===H.Table)return this.S0(i.getRowDefinition(this.row),i.getColumnDefinition(this.column),t);if(i.type===H.Auto&&i.findMainElement()===this)return this.Oo(2,t);if(e===1){if(i.type===H.Spot&&i.findMainElement()===this)return this.Oo(2,t);let s=i.defaultStretch;return s===1?this.Oo(0,t):this.Oo(s,t)}return this.Oo(e,t)}S0(t,e,i){let s=this.stretch;if(s!==1)return this.Oo(s,i);let n=null,o=null;switch(t.stretch){case 1:case 5:break;case 4:o=!0;break;case 2:o=!0;break}switch(e.stretch){case 1:case 4:break;case 5:n=!0;break;case 2:n=!0;break}let r=this.panel.defaultStretch;return n===null&&(n=r===5||r===2),o===null&&(o=r===4||r===2),n===!0&&o===!0?this.Oo(2,i):n===!0?this.Oo(5,i):o===!0?this.Oo(4,i):this.Oo(0,i)}Oo(t,e){if(e)return t;if(t===0)return 0;let i=this.desiredSize;if(i.isReal())return 0;let s=!isNaN(i.width),n=!isNaN(i.height),o=this.angle;if(s)if(o!==90&&o!==270){if(t===5)return 0;if(t===2)return 4}else{if(t===4)return 0;if(t===2)return 5}if(n)if(o!==90&&o!==270){if(t===4)return 0;if(t===2)return 5}else{if(t===5)return 0;if(t===2)return 4}return t}get segmentOrientation(){return this.Ot!==null?this.Ot.M0:0}set segmentOrientation(t){let e=this.segmentOrientation;e!==t&&(this.Ot===null&&(this.Ot=new He),this.Ot.M0=t,this.c(),this.t("segmentOrientation",e,t),t===0&&(this.angle=0))}iv(){this.segmentOrientation=21}get segmentIndex(){return this.Ot!==null?this.Ot.N0:-1/0}set segmentIndex(t){t=Math.round(t);let e=this.segmentIndex;e!==t&&(this.Ot===null&&(this.Ot=new He),this.Ot.N0=t,this.c(),this.t("segmentIndex",e,t))}get segmentFraction(){return this.Ot!==null?this.Ot.C0:0}set segmentFraction(t){t<0?t=0:t>1&&(t=1);let e=this.segmentFraction;e!==t&&(this.Ot===null&&(this.Ot=new He),this.Ot.C0=t,this.c(),this.t("segmentFraction",e,t))}get segmentOffset(){return this.Ot!==null?this.Ot.L0:P.xo}set segmentOffset(t){let e=this.segmentOffset;e.equals(t)||(t=t.P(),this.Ot===null&&(this.Ot=new He),this.Ot.L0=t,this.c(),this.t("segmentOffset",e,t))}get stretch(){return this.p!==null?this.p.$n:1}set stretch(t){let e=this.stretch;e!==t&&(this.Kt().$n=t,this.c(),this.t("stretch",e,t))}get name(){return this.p!==null?this.p.St:""}set name(t){let e=this.name;e!==t&&(this.Kt().St=t,this.part!==null&&this.part.A0(),this.t("name",e,t))}get opacity(){return this.$t}set opacity(t){t<0?t=0:t>1&&(t=1);let e=this.opacity;if(e!==t){this.$t=t,this.t("opacity",e,t);let i=this.diagram,s=this.part;i!==null&&s!==null&&i.S(s.Wh(s.actualBounds))}}get filter(){return this.d0}set filter(t){let e=this.filter;if(e!==t){this.d0=t,this.Ve(!0),this.t("filter",e,t);let i=this.diagram,s=this.part;i!==null&&s!==null&&i.S(s.Wh(s.actualBounds))}}get visible(){return(this.n&1)!==0}set visible(t){let e=(this.n&1)!==0;if(e!==t){this.n=this.n^1,this.Qc(),this.t("visible",e,t);let i=this.panel;i!==null?i.c():this.Xs()&&this.Ei(t),this.S(),this.CA()}}get pickable(){return(this.n&2)!==0}set pickable(t){let e=(this.n&2)!==0;e!==t&&(this.n=this.n^2,this.t("pickable",e,t))}get fromLinkableDuplicates(){return(this.n&4)!==0}set fromLinkableDuplicates(t){let e=(this.n&4)!==0;e!==t&&(this.n=this.n^4,this.t("fromLinkableDuplicates",e,t))}get fromLinkableSelfNode(){return(this.n&8)!==0}set fromLinkableSelfNode(t){let e=(this.n&8)!==0;e!==t&&(this.n=this.n^8,this.t("fromLinkableSelfNode",e,t))}get toLinkableDuplicates(){return(this.n&16)!==0}set toLinkableDuplicates(t){let e=(this.n&16)!==0;e!==t&&(this.n=this.n^16,this.t("toLinkableDuplicates",e,t))}get toLinkableSelfNode(){return(this.n&32)!==0}set toLinkableSelfNode(t){let e=(this.n&32)!==0;e!==t&&(this.n=this.n^32,this.t("toLinkableSelfNode",e,t))}get isPanelMain(){return(this.n&64)!==0}set isPanelMain(t){let e=(this.n&64)!==0;e!==t&&(this.n=this.n^64,this.c(),this.t("isPanelMain",e,t))}get isActionable(){return(this.n&128)!==0}set isActionable(t){let e=(this.n&128)!==0;e!==t&&(this.n=this.n^128,this.t("isActionable",e,t))}get background(){return this.Lt}set background(t){let e=this.background;e!==t&&(t!==null&&E.Qu(t,"GraphObject.background"),t instanceof E&&t.u(),this.Lt=t,this.S(),this.t("background",e,t))}b2(){return(this.n&512)!==0}Xb(t){t?this.n|=512:this.n&=-513}Wc(){return(this.n&1024)!==0}S2(t){t?this.n|=1024:this.n&=-1025}Kb(){return(this.n&2048)!==0}Zu(t){t?this.n|=2048:this.n&=-2049}p0(){return(this.n&4096)!==0}ka(t){t?this.n|=4096:this.n&=-4097}To(){return(this.n&8192)!==0}ue(t){t?this.n|=8192:this.n&=-8193}_e(){return(this.n&16384)!==0}Jn(t){t?this.n|=16384:this.n&=-16385}_R(){return(this.n&32768)!==0}Ve(t){t?this.n|=32768:this.n&=-32769}get part(){if(this.Xs())return this;if(this.Jr!==null)return this.Jr;let t=this;for(t=t.panel;t;){if(t instanceof Nt)return this.Jr=t,t;t=t.panel}return null}get svg(){return this.Ub}set svg(t){this.Ub=t}Au(){this.svg=null}get panel(){return this.Vs}Pa(t){this.Vs=t,this.svg!==null&&this.svg.remove()}get layer(){let t=this.part;return t!==null?t.layer:null}get diagram(){let t=this.part;return t!==null?t.diagram:null}get position(){return this.at}set position(t){let e=t.x,i=t.y,s=this.position,n=s.x,o=s.y;n!==e&&(!isNaN(n)||!isNaN(e))||o!==i&&(!isNaN(o)||!isNaN(i))?(t=t.copy(),this.M2(t,n,o)&&this.t("position",new P(n,o),t.copy())):this.N2()}N2(){}M2(t,e,i){return this.at=t,this.ef(),!0}bc(t,e,i){this.at.x===t&&this.at.y===e||(this.at.i(t,e),this.$c())}get actualBounds(){return this.Ni}get scale(){return this.tt}set scale(t){let e=this.scale;e!==t&&(t<=0&&f.o("GraphObject.scale for "+this+" must be greater than zero, not: "+t),this.tt=t,this.c(),this.t("scale",e,t))}get angle(){return this.Yt}set angle(t){let e=this.angle;if(e!==t){if(t=t%360,t<0&&(t+=360),e===t)return;this.Yt=t,this.CA(),this.c(),this.t("angle",e,t)}}get desiredSize(){return this.is}set desiredSize(t){let e=t.width,i=t.height,s=this.desiredSize,n=s.width,o=s.height;if((n!==e&&(!isNaN(n)||!isNaN(e))||o!==i&&(!isNaN(o)||!isNaN(i)))&&(t=t.P(),this.is=t,this.c(),this instanceof ut&&this.ee(),this.t("desiredSize",s,t),this.Wc())){let r=this.part;r!==null&&(this.ba(r,"width"),this.ba(r,"height"))}}get width(){return this.is.width}set width(t){let e=this.is.width;if(e!==t&&(!isNaN(e)||!isNaN(t))){let i=this.is,s=new Q(t,this.is.height).u();if(this.is=s,this.c(),this instanceof ut&&this.ee(),this.t("desiredSize",i,s),this.Wc()){let n=this.part;n!==null&&this.ba(n,"width")}}}get height(){return this.is.height}set height(t){let e=this.is.height;if(e!==t&&(!isNaN(e)||!isNaN(t))){let i=this.is,s=new Q(this.is.width,t).u();if(this.is=s,this.c(),this instanceof ut&&this.ee(),this.t("desiredSize",i,s),this.Wc()){let n=this.part;n!==null&&this.ba(n,"height")}}}get minSize(){return this.p!==null?this.p.pr:Q.sc}set minSize(t){let e=this.minSize;e.equals(t)||(t=t.copy(),isNaN(t.width)&&(t.width=0),isNaN(t.height)&&(t.height=0),t.u(),this.Kt().pr=t,this.c(),this.t("minSize",e,t))}get maxSize(){return this.p!==null?this.p.yr:Q.Bk}set maxSize(t){let e=this.maxSize;e.equals(t)||(t=t.copy(),isNaN(t.width)&&(t.width=1/0),isNaN(t.height)&&(t.height=1/0),t.u(),this.Kt().yr=t,this.c(),this.t("maxSize",e,t))}get measuredBounds(){return this.se}get naturalBounds(){return this.zi}y0(){return 0}get margin(){return this.Wr}set margin(t){typeof t=="number"&&(t=new Lt(t));let e=this.Wr;e.equals(t)||(t=t.P(),this.Wr=t,this.c(),this.t("margin",e,t))}get T(){return this.Kb()===!0&&this.Bb(),this.qr}get Us(){return this.p0()===!0&&this.Bb(),this.hh}trigger(t,e,i){let s=null;return typeof t=="string"?s=new Fi(t,e,i):s=t,s.be=this,this.ws===null&&(this.ws=new pt),this.ws.set(s.propertyName,s),this}get ws(){return this.p!==null?this.p.ws:null}set ws(t){this.ws!==t&&(this.Kt().ws=t)}get gr(){return this.p!==null?this.p.gr:0}set gr(t){this.gr!==t&&(this.Kt().gr=t)}get alignment(){return this.hi}set alignment(t){let e=this.alignment;e.equals(t)||(t.isNoSpot()&&!t.isDefault()&&f.o("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+t),t=t.P(),this.hi=t,this.ef(),this.t("alignment",e,t))}get column(){return this.Hr}set column(t){t=Math.round(t);let e=this.column;e!==t&&(t<0&&f.W(t,">= 0",dt,"column"),this.Hr=t,this.c(),this.t("column",e,t),this.svg!==null&&this.svg.remove())}get columnSpan(){return this.p!==null?this.p.T0:1}set columnSpan(t){t=Math.round(t);let e=this.columnSpan;e!==t&&(t<1&&f.W(t,">= 1",dt,"columnSpan"),this.Kt().T0=t,this.c(),this.t("columnSpan",e,t))}get row(){return this.u0}set row(t){t=Math.round(t);let e=this.row;e!==t&&(t<0&&f.W(t,">= 0",dt,"row"),this.u0=t,this.c(),this.t("row",e,t),this.svg!==null&&this.svg.remove())}get rowSpan(){return this.p!==null?this.p.D0:1}set rowSpan(t){t=Math.round(t);let e=this.rowSpan;e!==t&&(t<1&&f.W(t,">= 1",dt,"rowSpan"),this.Kt().D0=t,this.c(),this.t("rowSpan",e,t))}get spanAllocation(){return this.p!==null?this.p.F0:null}set spanAllocation(t){let e=this.spanAllocation;e!==t&&(t!==null&&f.k(t,dt,"spanAllocation"),this.Kt().F0=t,this.c(),this.t("spanAllocation",e,t))}get alignmentFocus(){return this.ju}set alignmentFocus(t){let e=this.alignmentFocus;e.equals(t)||(t=t.P(),this.ju=t,this.c(),this.t("alignmentFocus",e,t))}get portId(){return this.f0}set portId(t){let e=this.portId;if(e!==t){let i=this.part;i!==null&&!(i instanceof rt)&&f.o("Cannot set portID on a Link: "+t);let s=i;e!==null&&s!==null&&s.C2(this),this.f0=t,t!==null&&s!==null&&(s.fn=!0,s.LA(this)),this.t("portId",e,t)}}Sa(){let t=this.part;if(t instanceof rt&&(this.portId!==null||this===t.port)){let e=t.diagram;e!==null&&!e.undoManager.isUndoingRedoing&&t.bA(this)}}CA(){let t=this.diagram;t===null||t.undoManager.isUndoingRedoing||(this instanceof H?this instanceof rt?this.invalidateConnectedLinks():this.walkVisualTreeFrom(this,e=>{e.Sa()}):this.Sa())}get toSpot(){return this.ct!==null?this.ct.ma:D.None}set toSpot(t){let e=this.toSpot;e.equals(t)||(t=t.P(),this.Be().ma=t,this.t("toSpot",e,t),this.Sa())}get toEndSegmentLength(){return this.ct!==null?this.ct.ya:10}set toEndSegmentLength(t){let e=this.toEndSegmentLength;e!==t&&(t<0&&f.W(t,">= 0",dt,"toEndSegmentLength"),this.Be().ya=t,this.t("toEndSegmentLength",e,t),this.Sa())}get toShortLength(){return this.ct!==null?this.ct.xa:0}set toShortLength(t){let e=this.toShortLength;e!==t&&(this.Be().xa=t,this.t("toShortLength",e,t),this.Sa())}get toLinkable(){return this.ct!==null?this.ct.R0:null}set toLinkable(t){let e=this.toLinkable;e!==t&&(this.Be().R0=t,this.t("toLinkable",e,t))}get toMaxLinks(){return this.ct!==null?this.ct.v0:1/0}set toMaxLinks(t){let e=this.toMaxLinks;e!==t&&(t<0&&f.W(t,">= 0",dt,"toMaxLinks"),this.Be().v0=t,this.t("toMaxLinks",e,t))}get fromSpot(){return this.ct!==null?this.ct.ga:D.None}set fromSpot(t){let e=this.fromSpot;e.equals(t)||(t=t.P(),this.Be().ga=t,this.t("fromSpot",e,t),this.Sa())}get fromEndSegmentLength(){return this.ct!==null?this.ct.pa:10}set fromEndSegmentLength(t){let e=this.fromEndSegmentLength;e!==t&&(t<0&&f.W(t,">= 0",dt,"fromEndSegmentLength"),this.Be().pa=t,this.t("fromEndSegmentLength",e,t),this.Sa())}get fromShortLength(){return this.ct!==null?this.ct.wa:0}set fromShortLength(t){let e=this.fromShortLength;e!==t&&(this.Be().wa=t,this.t("fromShortLength",e,t),this.Sa())}get fromLinkable(){return this.ct!==null?this.ct.O0:null}set fromLinkable(t){let e=this.fromLinkable;e!==t&&(this.Be().O0=t,this.t("fromLinkable",e,t))}get fromMaxLinks(){return this.ct!==null?this.ct.I0:1/0}set fromMaxLinks(t){let e=this.fromMaxLinks;e!==t&&(t<0&&f.W(t,">= 0",dt,"fromMaxLinks"),this.Be().I0=t,this.t("fromMaxLinks",e,t))}get cursor(){return this.p!==null?this.p.Sl:""}set cursor(t){let e=this.cursor;e!==t&&(f.s(t,"string",dt,"cursor"),this.Kt().Sl=t,this.t("cursor",e,t))}get click(){return this.p!==null?this.p.Cr:null}set click(t){let e=this.click;e!==t&&(t!==null&&f.k(t,dt,"click"),this.Kt().Cr=t,this.t("click",e,t))}get doubleClick(){return this.p!==null?this.p.Lr:null}set doubleClick(t){let e=this.doubleClick;e!==t&&(t!==null&&f.k(t,dt,"doubleClick"),this.Kt().Lr=t,this.t("doubleClick",e,t))}get contextClick(){return this.p!==null?this.p.Ar:null}set contextClick(t){let e=this.contextClick;e!==t&&(t!==null&&f.k(t,dt,"contextClick"),this.Kt().Ar=t,this.t("contextClick",e,t))}get mouseEnter(){return this.p!==null?this.p.vr:null}set mouseEnter(t){let e=this.mouseEnter;e!==t&&(t!==null&&f.k(t,dt,"mouseEnter"),this.Kt().vr=t,this.t("mouseEnter",e,t))}get mouseLeave(){return this.p!==null?this.p.Or:null}set mouseLeave(t){let e=this.mouseLeave;e!==t&&(t!==null&&f.k(t,dt,"mouseLeave"),this.Kt().Or=t,this.t("mouseLeave",e,t))}get mouseOver(){return this.p!==null?this.p.Tr:null}set mouseOver(t){let e=this.mouseOver;e!==t&&(t!==null&&f.k(t,dt,"mouseOver"),this.Kt().Tr=t,this.t("mouseOver",e,t))}get mouseHover(){return this.p!==null?this.p.Dr:null}set mouseHover(t){let e=this.mouseHover;e!==t&&(t!==null&&f.k(t,dt,"mouseHover"),this.Kt().Dr=t,this.t("mouseHover",e,t))}get mouseHold(){return this.p!==null?this.p.Fr:null}set mouseHold(t){let e=this.mouseHold;e!==t&&(t!==null&&f.k(t,dt,"mouseHold"),this.Kt().Fr=t,this.t("mouseHold",e,t))}get mouseDragEnter(){return this.p!==null?this.p.E0:null}set mouseDragEnter(t){let e=this.mouseDragEnter;e!==t&&(t!==null&&f.k(t,dt,"mouseDragEnter"),this.Kt().E0=t,this.t("mouseDragEnter",e,t))}get mouseDragLeave(){return this.p!==null?this.p.U0:null}set mouseDragLeave(t){let e=this.mouseDragLeave;e!==t&&(t!==null&&f.k(t,dt,"mouseDragLeave"),this.Kt().U0=t,this.t("mouseDragLeave",e,t))}get mouseDrop(){return this.p!==null?this.p.Rr:null}set mouseDrop(t){let e=this.mouseDrop;e!==t&&(t!==null&&f.k(t,dt,"mouseDrop"),this.Kt().Rr=t,this.t("mouseDrop",e,t))}get actionDown(){return this.p!==null?this.p.B0:null}set actionDown(t){let e=this.actionDown;e!==t&&(t!==null&&f.k(t,dt,"actionDown"),this.Kt().B0=t,this.t("actionDown",e,t))}get actionMove(){return this.p!==null?this.p.V0:null}set actionMove(t){let e=this.actionMove;e!==t&&(t!==null&&f.k(t,dt,"actionMove"),this.Kt().V0=t,this.t("actionMove",e,t))}get actionUp(){return this.p!==null?this.p.z0:null}set actionUp(t){let e=this.actionUp;e!==t&&(t!==null&&f.k(t,dt,"actionUp"),this.Kt().z0=t,this.t("actionUp",e,t))}get actionCancel(){return this.p!==null?this.p.X0:null}set actionCancel(t){let e=this.actionCancel;e!==t&&(t!==null&&f.k(t,dt,"actionCancel"),this.Kt().X0=t,this.t("actionCancel",e,t))}get toolTip(){return this.p!==null?this.p.Ir:null}set toolTip(t){let e=this.toolTip;e!==t&&(this.Kt().Ir=t,this.t("toolTip",e,t))}get contextMenu(){return this.p!==null?this.p.Er:null}set contextMenu(t){let e=this.contextMenu;e!==t&&(this.Kt().Er=t,this.t("contextMenu",e,t))}findBindingPanel(){let t=this instanceof H?this:this.panel;for(;t!==null;){if(t.L2())return t;t=t.panel}return null}bind(t,e,i,s){return this.sf(t,e,i,s),this}bindTwoWay(t,e,i,s){return this.sf(t,e,i,s).makeTwoWay(),this}bindModel(t,e,i,s){return this.sf(t,e,i,s).ofModel(),this}bindObject(t,e,i,s,n){return this.sf(t,e,i,s).ofObject(n),this}theme(t,e,i,s,n){return this.mh(t,e,i,s,n),this}themeData(t,e,i,s,n){return this.mh(t,e,i,s,n).ofData(),this}themeObject(t,e,i,s,n,o){return this.mh(t,e,i,s,n).ofObject(o),this}themeModel(t,e,i,s,n){return this.mh(t,e,i,s,n).ofModel(),this}sf(t,e,i,s){let n=null;return typeof t=="string"?n=new oe(t,e,i,s):n=t,this.Y0(n),n}mh(t,e,i,s,n){let o=null;return typeof t=="string"?o=new pi(t,e,i,s,n):o=t,this.Y0(o),o}Y0(t){t.be=this;let e=this.findBindingPanel();e!==null&&e.AA()&&f.o("Cannot add a Binding to a template that has already been copied: "+t),this.Ci===null&&(this.Ci=new j),this.Ci.add(t)}set(t){return Object.assign(this,t),this}attach(t){return dt.A2(this,t),this}apply(t){return t(this),this}setProperties(t){return U.s0(this,t),this}static make(t,...e){let i=arguments,s=null,n=null;if(f.it(t))n=t;else if(typeof t=="string"){let r=dt.jb.get(t);f.it(r)?(i=Array.prototype.slice.call(i),s=r(i),f.G(s)||f.o('GraphObject.make invoked object builder "'+t+'", but it did not return an Object')):n=A.go[t]}s===null&&((n==null||!n.constructor)&&f.o("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+t),s=new n);let o=1;if(s instanceof U&&i.length>1){let r=s,a=i[1];(typeof a=="string"||a instanceof HTMLDivElement)&&(r.AM(a),o++)}for(let r=o;r<i.length;r++){let a=i[r];a===void 0?f.o("Undefined value at argument "+r+" for object being constructed by GraphObject.make: "+s):dt.A2(s,a)}return s}static A2(t,e){if(typeof e=="number")dt.ev(t,e);else if(typeof e=="string")dt.sv(t,e);else if(e instanceof dt)t instanceof H||f.o("A GraphObject can only be added to a Panel, not to: "+t),t.add(e);else if(e instanceof jt){let i;e.isRow&&f.it(t.getRowDefinition)?i=t.getRowDefinition(e.index):!e.isRow&&f.it(t.getColumnDefinition)&&(i=t.getColumnDefinition(e.index)),i instanceof jt?i.Hb(e):f.o("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+t)}else if(e instanceof Ft){let i=t;i.type=e}else if(e instanceof oe)t instanceof dt||t instanceof jt?t.bind(e):f.o("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+t);else if(e instanceof Fi)t instanceof dt?t.trigger(e):f.o("An AnimationTrigger can only be applied to a GraphObject, not to: "+t);else if(e instanceof $t)t instanceof kt&&t.type===4?t.figures.add(e):f.o("A PathFigure can only be added to a Path Geometry, not to: "+t);else if(e instanceof vt)t instanceof $t?t.segments.add(e):f.o("A PathSegment can only be added to a PathFigure, not to: "+t);else if(e instanceof ne)t instanceof U||t instanceof ft?t.layout=e:f.o("A Layout can only be assigned to a Diagram or a Group, not to: "+t);else if(Array.isArray(e))for(let i=0;i<e.length;i++){let s=e[i];dt.A2(t,s)}else f.G(e)?dt.nv(t,e):f.o('Unknown initializer "'+e+'" for object being constructed by GraphObject.make: '+t)}static sv(t,e){if(t instanceof xt)t.text=e;else if(t instanceof ut)t.figure=e;else if(t instanceof zt)t.source=e;else if(t instanceof H){let i=Ft.es.get(e);i!==null&&(t.type=i)}else if(t instanceof E){let i=f.Uh(qe,e);i!==null?t.type=i:f.o("Unknown Brush type as an argument to GraphObject.make: "+e)}else if(t instanceof kt){let i=f.Uh(ei,e);i!==null&&(t.type=i)}else if(t instanceof vt){let i=f.Uh(Ci,e);i!==null&&(t.type=i)}}static ev(t,e){f.it(t.oi)?t.oi(e):f.er(t,e)}static nv(t,e){if(t instanceof E){let i=new q;for(let s in e){let n=parseFloat(s);isNaN(n)?i[s]=e[s]:t.addColorStop(n,e[s])}U.s0(t,i)}else if(t instanceof jt){if(e.row!==void 0){let s=e.row;(s==null||s===1/0||isNaN(s)||s<0)&&f.o("Must specify non-negative integer row for RowColumnDefinition "+e+", not: "+s),t.isRow=!0,t.index=s}else if(e.column!==void 0){let s=e.column;(s==null||s===1/0||isNaN(s)||s<0)&&f.o("Must specify non-negative integer column for RowColumnDefinition "+e+", not: "+s),t.isRow=!1,t.index=s}let i=new q;for(let s in e)s==="row"||s==="column"||(i[s]=e[s]);U.s0(t,i)}else U.s0(t,e)}static build(t,e,...i){let s=dt.jb.get(t);if(f.it(s)){let n=s([t].concat(i));if(n instanceof dt)return e&&n.setProperties(e),n}f.o('GraphObject.build invoked object builder "'+t+'", but it did not return an Object')}static defineBuilder(t,e){f.s(t,"string",dt,"defineBuilder:name"),f.k(e,dt,"defineBuilder:func");let i=t.toLowerCase();dt.jb.set(t,e)}static isBuilderDefined(t){return dt.jb.has(t)}static takeBuilderArgument(t,e,i){i===void 0&&(i=null);let s=t[1];return(f.it(i)?i(s):typeof s=="string")?(t.splice(1,1),s):(e===void 0&&f.o("no "+(f.it(i)?"satisfactory":"string")+" argument for GraphObject builder "+t[0]),e)}static jb=new pt}dt.Vertical=4,dt.Horizontal=5,dt.defineBuilder("Button",x=>{let t="#f5f5f5",e="#737373",i="#d4d4d4",s="#737373",n="#a3a3a3",o=2.76142374915397,r=2.761423749153969,a=new H(H.Auto,{isActionable:!0,enabledChanged:(h,l)=>{if(h instanceof H){let 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 ut("RoundedRectangle",{name:"ButtonBorder",spot1:new D(0,0,o,r),spot2:new D(1,1,-o,-r),parameter1:2,fill:t,stroke:e}));return a.mouseEnter=(h,l,u)=>{if(!l.isEnabledObject()||!(l instanceof H))return;let c=l.findObject("ButtonBorder");c instanceof ut&&(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 H))return;let c=l.findObject("ButtonBorder");c instanceof ut&&(l._buttonFillNormal!==void 0&&(c.fill=l._buttonFillNormal),l._buttonStrokeNormal!==void 0&&(c.stroke=l._buttonStrokeNormal))},a}),dt.defineBuilder("TreeExpanderButton",x=>{let t=dt.build("Button");return t.attach({_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine",visible:!1}),t.add(new ut("MinusLine",{name:"ButtonIcon",stroke:"#0a0a0a",strokeWidth:2,desiredSize:Q.nu}).bindObject("figure","isTreeExpanded",(e,i)=>{let s=i.panel;return e?s._treeExpandedFigure:s._treeCollapsedFigure})),t.bindObject("visible","isTreeLeaf",e=>!e),t.click=(e,i)=>{let s=i.part;if(s instanceof St&&(s=s.adornedPart),!(s instanceof rt))return;let n=s.diagram;if(n===null)return;let o=n.commandHandler;if(s.isTreeExpanded){if(!o.canCollapseTree(s))return}else if(!o.canExpandTree(s))return;e.handled=!0,s.isTreeExpanded?o.collapseTree(s):o.expandTree(s)},t}),dt.defineBuilder("SubGraphExpanderButton",x=>{let t=dt.build("Button");return t.attach({_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"}),t.add(new ut("MinusLine",{name:"ButtonIcon",stroke:"#0a0a0a",strokeWidth:2,desiredSize:Q.nu}).bindObject("figure","isSubGraphExpanded",(e,i)=>{let s=i.panel;return e?s._subGraphExpandedFigure:s._subGraphCollapsedFigure})),t.click=(e,i)=>{let s=i.part;if(s instanceof St&&(s=s.adornedPart),!(s instanceof ft))return;let n=s.diagram;if(n===null)return;let o=n.commandHandler;if(s.isSubGraphExpanded){if(!o.canCollapseSubGraph(s))return}else if(!o.canExpandSubGraph(s))return;e.handled=!0,s.isSubGraphExpanded?o.collapseSubGraph(s):o.expandSubGraph(s)},t}),dt.defineBuilder("ToolTip",x=>new St(H.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new P(0,2)}).add(new ut("RoundedRectangle",{name:"Border",parameter1:1,fill:"#f5f5f5",strokeWidth:0,spot1:new D(0,0,4,6),spot2:new D(1,1,-4,-4)}))),dt.defineBuilder("ContextMenu",x=>new St(H.Vertical,{background:"#f5f5f5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new P(0,2)}).bindObject("background","",t=>t.adornedPart!==null&&t.hasPlaceholder()?null:"#f5f5f5")),dt.defineBuilder("ContextMenuButton",x=>{let t=dt.build("Button");t.stretch=5;let e=t.findObject("ButtonBorder");return e instanceof ut&&(e.figure="Rectangle",e.strokeWidth=0,e.spot1=new D(0,0,4,6),e.spot2=new D(1,1,-4,-4)),t}),dt.defineBuilder("PanelExpanderButton",x=>{let t=dt.takeBuilderArgument(x,"COLLAPSIBLE"),e=dt.build("Button");e.attach({_buttonExpandedFigure:"M0 0 M0 6 L4 2 8 6 M8 8",_buttonCollapsedFigure:"M0 0 M0 2 L4 6 8 2 M8 8","ButtonBorder.fill":"rgba(0, 0, 0, 0)",_buttonFillNormal:"rgba(0, 0, 0, 0)","ButtonBorder.stroke":null,_buttonStrokeNormal:null,_buttonFillOver:"rgba(0, 0, 0, .2)",_buttonStrokeOver:null}),e.add(new ut({name:"ButtonIcon",strokeWidth:2}).bindObject("geometryString","visible",s=>s?e._buttonExpandedFigure:e._buttonCollapsedFigure,void 0,t));let i=e.findObject("ButtonBorder");return i instanceof ut&&(i.stroke=null,i.fill="rgba(0, 0, 0, 0)"),e.click=(s,n)=>{if(!(n instanceof H))return;let o=n.diagram;if(o===null||o.isReadOnly)return;let r=n.findBindingPanel();if(r===null&&(r=n.part),r!==null){let a=r.findObject(t);a!==null&&(s.handled=!0,o.startTransaction("Collapse/Expand Panel"),a.visible=!a.visible,o.commitTransaction("Collapse/Expand Panel"))}},e}),dt.defineBuilder("CheckBoxButton",x=>{let t=dt.takeBuilderArgument(x),e=dt.build("Button",{desiredSize:new Q(14,14)});e.attach({"ButtonBorder.spot1":new D(0,0,1,1),"ButtonBorder.spot2":new D(1,1,-1,-1)});let i=new ut({name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:2,geometryStretch:6,visible:!1});return t!==""&&i.bindTwoWay("visible",t),e.add(i),e.click=(s,n)=>{if(!(n instanceof H))return;let o=s.diagram;if(o===null||o.isReadOnly||t!==""&&o.model.isReadOnly)return;s.handled=!0;let r=n.findObject("ButtonIcon");o.startTransaction("checkbox"),r!==null&&(r.visible=!r.visible),f.it(n._doClick)&&n._doClick(s,n),o.commitTransaction("checkbox")},e}),dt.defineBuilder("CheckBox",x=>{let t=dt.takeBuilderArgument(x),e=dt.build("CheckBoxButton",{name:"Button",isActionable:!1,margin:new Lt(0,1,0,0)},t),i=new H("Horizontal",{isActionable:!0,cursor:e.cursor,margin:new Lt(1),mouseEnter:e.mouseEnter,mouseLeave:e.mouseLeave,click:e.click}).attach({_buttonFillNormal:e._buttonFillNormal,_buttonStrokeNormal:e._buttonStrokeNormal,_buttonFillOver:e._buttonFillOver,_buttonStrokeOver:e._buttonStrokeOver,_buttonFillDisabled:e._buttonFillDisabled,_buttonClick:e.click});return i.add(e),e.mouseEnter=null,e.mouseLeave=null,e.click=null,i});class oi{fi;St;Hn;Ci;qn;Ys;Sl;Cr;Lr;Ar;vr;Or;Tr;Dr;Fr;E0;U0;Rr;B0;V0;z0;X0;Ir;Er;P0;F0;ws;pr;yr;$n;D0;T0;gr;b0;G0;K0;constructor(){this.fi=!1,this.St="",this.Hn=-1,this.Ci=null,this.qn=null,this.Ys=null,this.Sl="",this.Cr=null,this.Lr=null,this.Ar=null,this.vr=null,this.Or=null,this.Tr=null,this.Dr=null,this.Fr=null,this.E0=null,this.U0=null,this.Rr=null,this.B0=null,this.V0=null,this.z0=null,this.X0=null,this.Ir=null,this.Er=null,this.P0=null,this.F0=null,this.ws=null,this.pr=Q.sc,this.yr=Q.Bk,this.$n=1,this.D0=1,this.T0=1,this.gr=0,this.b0=null,this.G0=null,this.K0="category"}copy(){let t=new oi;return t.St=this.St,t.Hn=this.Hn,t.Ci=this.Ci,t.Ys=this.Ys,t.Sl=this.Sl,t.Cr=this.Cr,t.Lr=this.Lr,t.Ar=this.Ar,t.vr=this.vr,t.Or=this.Or,t.Tr=this.Tr,t.Dr=this.Dr,t.Fr=this.Fr,t.E0=this.E0,t.U0=this.U0,t.Rr=this.Rr,t.B0=this.B0,t.V0=this.V0,t.z0=this.z0,t.X0=this.X0,t.Ir=this.Ir,t.Er=this.Er,t.P0=this.P0,t.F0=this.F0,t.ws=this.ws,t.pr=this.pr.P(),t.yr=this.yr.P(),t.$n=this.$n,t.D0=this.D0,t.T0=this.T0,t.gr=this.gr,t.b0=this.b0,t.G0=this.G0,t.K0=this.K0,t}}class ts{m;constructor(){this.m=[1,0,0,1,0,0]}copy(){let t=new ts;return t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5],t}translate(t,e){this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e}scale(t,e){this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e}rotate(t,e,i){if(t>=360?t-=360:t<0&&(t+=360),t===0)return;this.translate(e,i);let s=0,n=0;if(t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let l=t*Math.PI/180;s=Math.cos(l),n=Math.sin(l)}let o=this.m[0]*s+this.m[2]*n,r=this.m[1]*s+this.m[3]*n,a=this.m[0]*-n+this.m[2]*s,h=this.m[1]*-n+this.m[3]*s;this.m[0]=o,this.m[1]=r,this.m[2]=a,this.m[3]=h,this.translate(-e,-i)}}class Oi{type;x1;y1;r1;x2;y2;r2;colors;pattern;constructor(t){this.type=t,this.x1=0,this.y1=0,this.r1=0,this.x2=0,this.y2=0,this.r2=0,this.colors=[],this.pattern=null}addColorStop(t,e){this.colors.push({offset:t,color:e})}}class Ri{Tt;li;jr;Gu;T2;constructor(t,e,i){let s=e===void 0?A.document:e;this.jr=s,this.T2="http://www.w3.org/2000/svg";let n="http://www.w3.org/2000/xmlns/";s!==void 0&&(this.Tt=this.makeElement("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.style.display="block",this.style.letterSpacing="normal",this.style.wordSpacing="normal",i||(this.style.position="absolute"),this.Tt.setAttributeNS(n,"xmlns",this.T2),this.Tt.setAttributeNS(n,"xmlns:xlink","http://www.w3.org/1999/xlink")),this.Gu=null,this.li=new ce(this,i)}resize(t,e,i,s){return this.width!==t||this.height!==e?(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=s+"px",this.Tt.setAttributeNS(null,"width",i+"px"),this.Tt.setAttributeNS(null,"height",s+"px"),this.Tt.setAttributeNS(null,"viewBox","0 0 "+i+" "+s),this.li.D2.firstElementChild.setAttributeNS(null,"width",i+"px"),this.li.D2.firstElementChild.setAttributeNS(null,"height",s+"px"),!0):!1}makeElement(t,e,i){let s=this.jr.createElementNS(this.T2,t);if(f.G(e))for(let n in e)s.setAttributeNS(n==="href"?"http://www.w3.org/1999/xlink":"",n,e[n]);return i!==void 0&&(s.textContent=i),s}getBoundingClientRect(){return this.Tt.getBoundingClientRect()}focus(){this.Tt.focus()}get width(){return this.Tt.width.baseVal.value}set width(t){this.Tt.setAttribute("width",t+"px")}get height(){return this.Tt.height.baseVal.value}set height(t){this.Tt.setAttribute("height",t+"px")}dispose(){this.jr=null}get style(){return this.Tt.style}}class ce{nf;of;un;Li;ze;fillStyle;font;globalAlpha;lineCap;lineDashOffset;lineJoin;lineWidth;miterLimit;shadowBlur;shadowColor;shadowOffsetX;shadowOffsetY;strokeStyle;textAlign;imageSmoothingEnabled;clipInsteadOfFill;lastCreatedElement;rf;lf;surface;svg;D2;TA;qb;Io;ph;Ma;currentElement;clipPathGroup;diagramGroup;lastDrawnPart;currentPath;outerGroup;pathAttributes;Zr;kr;filter;partClipRect;constructor(t,e){if(this.surface=t,this.svg=t.Tt,this.rf=[],this.lf=[],this.fillStyle="#000000",this.font="10px sans-serif",this.globalAlpha=1,this.lineCap="butt",this.lineDashOffset=0,this.lineJoin="miter",this.lineWidth=1,this.miterLimit=10,this.shadowBlur=0,this.shadowColor="rgba(0, 0, 0, 0)",this.shadowOffsetX=0,this.shadowOffsetY=0,this.Zr=!1,this.strokeStyle="#000000",this.textAlign="start",this.clipInsteadOfFill=!1,this.nf=0,this.of=0,this.un=0,this.lastCreatedElement=null,this.currentElement=null,this.Li=[],this.pathAttributes={},this.qb=!1,this.Io=null,this.ph=0,this.ze=new ts,t.jr===null||t.jr===void 0)return;this.clipPathGroup=this.newGroup2(),this.diagramGroup=this.newGroup2("gojs-diagram"),this.lastDrawnPart=null,this.currentPath=null;let i=I.pw++,s=this.makeElement("clipPath",{id:"mainClip"+i}),n={x:0,y:0,width:t.width,height:t.height};s.appendChild(this.makeElement("rect",n)),this.D2=s,this.svg.appendChild(this.clipPathGroup),this.clipPathGroup.appendChild(this.diagramGroup),this.svg.appendChild(s),this.clipPathGroup.setAttributeNS(null,"clip-path","url(#mainClip"+i+")"),this.TA={},this.kr=!!e,this.filter="",this.partClipRect=null}setDiagramPosScale(t,e,i,s,n,o){this.diagramGroup===void 0?this.newGroup(t,e,i,s,n,o):this.diagramGroup.setAttribute("transform","matrix("+t+", "+e+", "+i+", "+s+", "+n+", "+o+")")}resetInnerSVG(){this.diagramGroup!==null&&(this.diagramGroup.innerHTML="")}arc(t,e,i,s,n,o,r,a){let h=2*Math.PI,l=1e-6,u=h-l,c=i*Math.cos(s),d=i*Math.sin(s),g=t+c,p=e+d,m=o?0:1,y=o?s-n:n-s;(Math.abs(r-g)>l||Math.abs(a-p)>l)&&this.Li.push(["L",g,+p]),y<0&&(y=y%h+h),y>u?(this.Li.push(["A",i,i,0,1,m,t-c,e-d]),this.Li.push(["A",i,i,0,1,m,g,p])):y>l&&this.Li.push(["A",i,i,0,+(y>=Math.PI),m,t+i*Math.cos(n),e+i*Math.sin(n)])}beginPath(){this.Li=[],this.pathAttributes={stroke:"none",fill:"none"}}endPath(t){this.ov(this.Li,this.ze,t||0)}bezierCurveTo(t,e,i,s,n,o){this.Li.push(["C",t,e,i,s,n,o])}clearRect(t,e,i,s){}clip(){this.pathAttributes.clipPath=!0}closePath(){this.Li.push(["z"])}createLinearGradient(t,e,i,s){let n=new Oi("linear");return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}createPattern(t,e){let i="";t instanceof HTMLCanvasElement&&(i=t.toDataURL()),t instanceof HTMLImageElement&&(i=t.getAttribute("src"));let s=this.TA;if(s[i])return"url(#"+s[i]+")";let n="PATTERN"+I.pw++,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(U.img,r)),this.svg.appendChild(a),s[i]=n,"url(#"+n+")"}createRadialGradient(t,e,i,s,n,o){let r=new Oi("radial");return r.x1=t,r.y1=e,r.r1=i,r.x2=s,r.y2=n,r.r2=o,r}amendImageTransform(t,e,i,s,n,o,r,a){let h=r/i,l=a/s;(n!==0||o!==0)&&this.ze.translate(n,o),(h!==1||l!==1)&&this.ze.scale(h,l),(t!==0||e!==0)&&this.ze.translate(-t,-e)}drawImage(t,e,i,s,n,o,r,a,h){let l="";t instanceof HTMLCanvasElement&&(l=t.toDataURL()),t instanceof HTMLImageElement&&(l=t.getAttribute("src"));let u=t instanceof HTMLImageElement?t.naturalWidth:t.width,c=t instanceof HTMLImageElement?t.naturalHeight:t.height;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};!L.z(s,a)||!L.z(n,h)?d.preserveAspectRatio="none":l.toLowerCase().indexOf(".svg")===-1&&l.toLowerCase().indexOf("data:image/svg")===-1&&(d.preserveAspectRatio="xMidYMid slice"),(e!==0||i!==0||s!==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(U.img,d,this.ze),this._u(U.img,d)}fill(t,e){t&&(this.pathAttributes["fill-rule"]="evenodd"),this.setFill(this.pathAttributes)}fillContext(t,e,i){this.clipInsteadOfFill?this.clip():this.fill(e,i)}createOrUpdateClipGroup(t,e){let i=this.newGroup(1,0,0,1,-e.x,-e.y);i.setAttributeNS(null,"class","spotClip"),t.ah=i}fillRect(t,e,i,s){this.addRect("fill",[t,e,i,s],this.ze)}fillBackground(t,e,i,s){let n={x:t,y:e,width:i,height:s};this.processCommon("fill",n,this.ze),this.setFill(n),this.svg.prepend(this.makeElement("rect",n))}fillText(t,e,i){this.addText("fill",[t,e,i],this.ze)}lineTo(t,e){this.Li.push(["L",t,e])}moveTo(t,e){this.Li.push(["M",t,e])}quadraticCurveTo(t,e,i,s){this.Li.push(["Q",t,e,i,s])}rect(t,e,i,s){this.Li.push(["M",t,e],["L",t+i,e],["L",t+i,e+s],["L",t,e+s],["z"])}restore(){this.ze=this.rf.pop(),this.Li=this.rf.pop();let t=this.rf.pop();this.fillStyle=t.fillStyle,this.font=t.font,this.globalAlpha=t.globalAlpha,this.lineCap=t.lineCap,this.lineDashOffset=t.lineDashOffset,this.lineJoin=t.lineJoin,this.lineWidth=t.lineWidth,this.miterLimit=t.miterLimit,this.shadowBlur=t.shadowBlur,this.shadowColor=t.shadowColor,this.shadowOffsetX=t.shadowOffsetX,this.shadowOffsetY=t.shadowOffsetY,this.strokeStyle=t.strokeStyle,this.textAlign=t.textAlign,this.partClipRect=t.partClipRect}save(){let t={fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign,partClipRect:this.partClipRect};this.rf.push(t);let e=[];for(let i=0;i<this.Li.length;i++)e.push(this.Li[i]);this.rf.push(e),this.rf.push(this.ze.copy())}setTransform(t,e,i,s,n,o){t===1&&e===0&&i===0&&s===1&&n===0&&o===0||this.newGroup(t,e,i,s,n,o)}setCurrentTransform(t,e,i,s,n,o){this.ze.m=[t,e,i,s,n,o]}getCurrentTransform(){let t=this.ze.m;return"matrix("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}scale(t,e){this.ze.scale(t,e)}translate(t,e){this.ze.translate(t,e)}transform(t,e,i,s,n,o){}commitTransform(){}stroke(){this.setStroke(this.pathAttributes)}strokeContext(){this.clipInsteadOfFill||this.stroke()}strokeRect(t,e,i,s){this.addRect("stroke",[t,e,i,s],this.ze)}makeElement(t,e,i){return this.surface.makeElement(t,e,i)}_u(t,e,i){let s=this.makeElement(t,e,i);return this.currentElement!==null?this.currentElement.appendChild(s):this.currentElement=s,this.lastCreatedElement=s,s}processCommon(t,e,i){if(t==="fill"?this.setFill(e):t==="stroke"&&this.setStroke(e),i!==null){let s=i.m;e.transform="matrix("+s[0]+", "+s[1]+", "+s[2]+", "+s[3]+", "+s[4]+", "+s[5]+")"}}setFill(t){if(this.fillStyle instanceof Oi){t.fill=this.addGradient(this.fillStyle,!0);return}if(/^rgba\(/.test(this.fillStyle)){let e=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.fillStyle);t.fill="rgb("+e[1]+","+e[2]+","+e[3]+")",t["fill-opacity"]=e[4]}else t.fill=this.fillStyle}setFillOrStrokeInPlace(t,e){let i=e?"fill":"stroke";if(this.fillStyle instanceof Oi){t.setAttributeNS(null,"fill",this.addGradient(this.fillStyle,!0));return}if(/^rgba\(/.test(this.fillStyle)){let s=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.fillStyle);t.setAttributeNS(null,i,"rgb("+s[1]+","+s[2]+","+s[3]+")"),t.setAttributeNS(null,i+"-opacity",s[4])}else t.setAttributeNS(null,i,this.fillStyle)}setStroke(t){if(this.strokeStyle instanceof Oi)t.stroke=this.addGradient(this.strokeStyle,!1);else if(/^rgba\(/.test(this.strokeStyle)){let e=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.strokeStyle);t.stroke="rgb("+e[1]+","+e[2]+","+e[3]+")",t["stroke-opacity"]=e[4]}else t.stroke=this.strokeStyle;t["stroke-width"]=this.lineWidth,t["stroke-linecap"]=this.lineCap,t["stroke-linejoin"]=this.lineJoin,t["stroke-miterlimit"]=this.miterLimit,this.qb&&(t["stroke-dasharray"]=this.Io.toString(),t["stroke-dashoffset"]=this.ph)}addGradient(t,e){let i="",s=this.currentPath!==null?this.currentPath.getAttribute(e?"fill":"stroke"):null;if(s!==null&&s.indexOf("GRAD")!==-1){i=s.split("#")[1].slice(0,-1);let h=this.svg.getElementById(i);h!==null&&h.remove()}else i="GRAD"+I.pw++;let n;if(t.type==="linear"){let h={x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,id:i,gradientUnits:"userSpaceOnUse"};n=this.makeElement("linearGradient",h)}else if(t.type==="radial"){let h={x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,r1:t.r1,r2:t.r2,id:i};n=this.makeElement("radialGradient",h)}else f.o("invalid gradient");let o=t.colors,r=o.length,a=[];for(let h=0;h<r;h++){let l=o[h],u=l.color,c={offset:l.offset,"stop-color":u};if(/^rgba\(/.test(u)){let d=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(u);c["stop-color"]="rgb("+d[1]+","+d[2]+","+d[3]+")",c["stop-opacity"]=d[4]}a.push(c)}a.sort((h,l)=>h.offset>l.offset?1:-1);for(let h=0;h<r;h++)n.appendChild(this.makeElement("stop",a[h]));return this.svg.appendChild(n),"url(#"+i+")"}addRect(t,e,i){let s={x:e[0],y:e[1],width:e[2],height:e[3]};this.processCommon(t,s,i),this._u("rect",s)}addText(t,e,i){let s=this.textAlign;s==="left"?s="start":s==="right"?s="end":s==="center"&&(s="middle");let n={x:e[1],y:e[2],style:"font: "+this.font,"text-anchor":s};this.processCommon(t,n,i),this._u("text",n,e[0])}ov(t,e,i){let s=this.rv(t),n=this.pathAttributes;if(n.clipPath){this.lf.length>1&&this.lf[this.lf.length-2].setAttributeNS(null,"clip-path",'path("'+s+'") view-box');return}if(n.d=s,this.processCommon("",n,e),this.currentPath!==null){let o=this.currentPath;if(o.nodeName!=="g")for(let r in n)r!=="transform"&&o.setAttributeNS(null,r,n[r]);else{let r=o.getElementsByTagName("path");for(let a in n)a!=="transform"&&r[i].setAttributeNS(null,a,n[a])}}else this._u("path",n)}rv(t){let e=[];for(let i=0;i<t.length;i++){let s=t[i].slice(),n=[s.shift()];if(n[0]==="A")n.push(s.shift()+","+s.shift(),s.shift(),s.shift()+","+s.shift(),s.shift()+","+s.shift());else for(;s.length;)n.push(s.shift()+","+s.shift());e.push(n.join(" "))}return e.join(" ")}newGroup(t,e,i,s,n,o){let r=new ts;r.m=[t,e,i,s,n,o];let a={};this.processCommon("g",a,r);let h=this._u("g",a);return this.lf.push(h),h}newGroup2(t){let e={};t&&(e.class=t);let i=this._u("g",e);return this.lf.push(i),i}endGroup(){return this.lf.pop()}dummyGroup(){return this.newGroup2(),this.endGroup()}shadowsSet(t,e,i){this.nf=t,this.of=e,this.un=i}shadowsOff(){this.Zr=!1,this.shadowOffsetX=0,this.shadowOffsetY=0,this.shadowBlur=0}shadowsOn(){this.Zr=!0,this.shadowOffsetX=this.nf,this.shadowOffsetY=this.of,this.shadowBlur=this.un}enableDash(t,e){this.qb=!0,this.Io=t,this.ph=e}disableDash(){this.qb=!1}clearContextCache(t){}setImageSmoothingEnabled(t){}rotate(t){this.ze.rotate(t*57.2958,0,0)}getImageData(t,e,i,s){return null}measureText(t){return null}removeOldGradient(t,e,i){let s=e.getAttribute(i);if(s===null)return;let n=s.split("#");if(n.length===1)return;let o=this.svg.getElementById(n[1].slice(0,-1));if(o!==null){let r=new RegExp(o.id,"g");this.svg.innerHTML.match(r).length===1&&o.remove()}}removePartFromView(t){t.svg!==null&&t.svg.parentNode===this.diagramGroup&&t.svg.remove()}}class Ue{Tt;li;jr;Gu;constructor(t,e,i,s){let n=e===void 0?A.document:e;this.jr=n,this.Gu=null;let o=n.createElement("canvas");o.tabIndex=0,this.Tt=o,this.li=new Ei(o,i,s),U.Qe.set(o,t)}resize(t,e,i,s){return this.width!==t||this.height!==e?(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=s+"px",!0):!1}toDataURL(t,e){return this.Tt.toDataURL(t,e)}getBoundingClientRect(){return this.Tt.getBoundingClientRect()}focus(){this.Tt.focus()}get width(){return this.Tt.width}set width(t){this.Tt.width=t}get height(){return this.Tt.height}set height(t){this.Tt.height=t}dispose(){U.Qe.delete(this.Tt),this.jr=null}get style(){return this.Tt.style}}class Ei{E;Wb;Jb;$b;clipInsteadOfFill;nf;of;un;Ma;Zr;kr;constructor(t,e,i){this.E=t.getContext?t.getContext("2d",e):null,this.E===null&&f.o("Browser does not support HTML Canvas Element"),this.Wb="",this.Jb="",this.$b="",this.clipInsteadOfFill=!1,this.nf=0,this.of=0,this.un=0,this.Zr=!1,this.Ma=new Pt,this.kr=!!i}createOrUpdateClipGroup(t,e){}setImageSmoothingEnabled(t){this.E.imageSmoothingEnabled=t}get fillStyle(){return this.E.fillStyle}set fillStyle(t){this.$b!==t&&(this.E.fillStyle=t,this.$b=t)}get font(){return this.E.font}set font(t){this.Wb!==t&&(this.E.font=t,this.Wb=t)}get globalAlpha(){return this.E.globalAlpha}set globalAlpha(t){this.E.globalAlpha=t}get lineCap(){return this.E.lineCap}set lineCap(t){this.E.lineCap=t}get lineDashOffset(){return this.E.lineDashOffset}set lineDashOffset(t){this.E.lineDashOffset=t}get lineJoin(){return this.E.lineJoin}set lineJoin(t){this.E.lineJoin=t}get lineWidth(){return this.E.lineWidth}set lineWidth(t){this.E.lineWidth=t}get miterLimit(){return this.E.miterLimit}set miterLimit(t){this.E.miterLimit=t}get shadowBlur(){return this.E.shadowBlur}set shadowBlur(t){this.E.shadowBlur=t}get shadowColor(){return this.E.shadowColor}set shadowColor(t){this.E.shadowColor=t}get shadowOffsetX(){return this.E.shadowOffsetX}set shadowOffsetX(t){this.E.shadowOffsetX=t}get shadowOffsetY(){return this.E.shadowOffsetY}set shadowOffsetY(t){this.E.shadowOffsetY=t}get strokeStyle(){return this.E.strokeStyle}set strokeStyle(t){this.Jb!==t&&(this.E.strokeStyle=t,this.Jb=t)}get textAlign(){return this.E.textAlign}set textAlign(t){this.E.textAlign=t}get imageSmoothingEnabled(){return this.E.imageSmoothingEnabled}set imageSmoothingEnabled(t){this.E.imageSmoothingEnabled=t}get filter(){return this.E.filter}set filter(t){t===""?this.E.filter="none":this.E.filter=t}arc(t,e,i,s,n,o,r,a){this.E.arc(t,e,i,s,n,o)}beginPath(){this.E.beginPath()}endPath(){}bezierCurveTo(t,e,i,s,n,o){this.E.bezierCurveTo(t,e,i,s,n,o)}clearRect(t,e,i,s){this.commitTransform(),this.E.clearRect(t,e,i,s)}clip(t){t?this.E.clip(t):this.E.clip()}closePath(){this.E.closePath()}createLinearGradient(t,e,i,s){return this.E.createLinearGradient(t,e,i,s)}createPattern(t,e){return this.E.createPattern(t,e)}createRadialGradient(t,e,i,s,n,o){return this.E.createRadialGradient(t,e,i,s,n,o)}drawImage(t,e,i,s,n,o,r,a,h){s===void 0?this.E.drawImage(t,e,i):this.E.drawImage(t,e,i,s,n,o,r,a,h)}fill(t,e){e?this.E.fill(e,t?"evenodd":"nonzero"):this.E.fill(t?"evenodd":"nonzero")}fillRect(t,e,i,s){this.E.fillRect(t,e,i,s)}fillBackground(t,e,i,s){this.E.fillRect(t,e,i,s)}fillText(t,e,i){this.E.fillText(t,e,i)}getImageData(t,e,i,s){return this.E.getImageData(t,e,i,s)}lineTo(t,e){this.E.lineTo(t,e)}measureText(t){return this.E.measureText(t)}moveTo(t,e){this.E.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.E.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.E.rect(t,e,i,s)}restore(){this.E.restore()}save(){this.commitTransform(),this.E.save()}rotate(t){this.Ma.cs(t*57.2958,0,0)}setTransform(t,e,i,s,n,o){this.Ma.setTo(t,e,i,s,n,o)}scale(t,e){this.Ma.tt(t,e)}translate(t,e){this.Ma.Fs(t,e)}stroke(t){t?this.E.stroke(t):this.E.stroke()}transform(t,e,i,s,n,o){if(t===1&&e===0&&i===0&&s===1&&n===0&&o===0)return;let r=this.Ma,a=r.m11*t+r.m21*e,h=r.m12*t+r.m22*e,l=r.m11*i+r.m21*s,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.Ma;this.E.setTransform(t.m11,t.m12,t.m21,t.m22,t.dx,t.dy)}fillContext(t,e,i){this.radialFill(t,e,i)||this.fillOrClip(e,i)}radialFill(t,e,i){if(!(t instanceof E)||t.type!==3)return!1;let s=t._c,n=t.Gb;return n>s?(this.scale(s/n,1),this.translate((n-s)/2,0)):s>n&&(this.scale(1,n/s),this.translate(0,(s-n)/2)),this.fillOrClip(e,i),n>s?(this.translate(-(n-s)/2,0),this.scale(1/(s/n),1)):s>n&&(this.translate(0,-(s-n)/2),this.scale(1,1/(n/s))),!0}strokeContext(){this.clipInsteadOfFill||this.stroke()}fillOrClip(t,e){this.clipInsteadOfFill?this.clip(e):this.fill(t,e)}shadowsSet(t,e,i){this.nf=t,this.of=e,this.un=i}shadowsOff(){this.Zr=!1,this.shadowOffsetX=0,this.shadowOffsetY=0,this.shadowBlur=0}shadowsOn(){this.Zr=!0,this.shadowOffsetX=this.nf,this.shadowOffsetY=this.of,this.shadowBlur=this.un}enableDash(t,e){let i=this.E;i.setLineDash!==void 0&&(i.setLineDash(t),i.lineDashOffset=e)}disableDash(){let t=this.E;t.setLineDash!==void 0&&(t.setLineDash(Ei.EmptyArray),t.lineDashOffset=0)}clearContextCache(t){t&&(this.Wb=""),this.Jb="",this.$b=""}removePartFromView(t){}static EmptyArray=Object.freeze([])}var qe=(x=>(x[x.Solid=1]="Solid",x[x.Linear=2]="Linear",x[x.Radial=3]="Radial",x[x.Pattern=4]="Pattern",x))(qe||{}),Tn=(x=>(x[x.Lab=1]="Lab",x[x.HSL=2]="HSL",x[x.Oklch=3]="Oklch",x))(Tn||{});class fi{n0;n1;n2;n3;constructor(){this.n0=0,this.n1=0,this.n2=0,this.n3=0}}class E{h;H;Na;ei;gs;j0;H0;Eo;q0;cn;_c;Gb;constructor(t,e){if(I.Ki(this),this.h=!1,t===void 0)this.H=1,this.Na="black";else if(typeof t=="string"){let s=f.Uh(qe,t);s!==null?(this.H=s,this.Na="black"):(this.H=1,this.Na=t)}else Object.keys(qe).hasOwnProperty(t)?(this.H=t,this.Na="black"):typeof t=="object"&&(this.H=1,e=t);let i=this.H;if(i===2?(this.ei=D.TopCenter,this.gs=D.BottomCenter):i===3?(this.ei=D.Center,this.gs=D.Center):(this.ei=D.None,this.gs=D.None),this.j0=0,this.H0=NaN,this.Eo=null,this.q0=null,this.cn=null,this._c=0,this.Gb=0,e){let s={};for(let n in e)isFinite(parseFloat(n))?this.addColorStop(parseFloat(n),e[n]):s[n]=e[n];Object.assign(this,s)}}copy(){let t=new E;return t.H=this.H,t.Na=this.Na,t.ei=this.ei.P(),t.gs=this.gs.P(),t.j0=this.j0,t.H0=this.H0,this.Eo!==null&&(t.Eo=this.Eo.copy()),t.q0=this.q0,t}u(){return this.h=!0,this.Eo!==null&&this.Eo.u(),this}oi(t){t in qe?this.type=t:f.er(this,t)}toString(){let t="Brush(";if(this.type===1)t+=this.color;else if(this.type===2?t+="Linear ":this.type===3?t+="Radial ":this.type===4?t+="Pattern ":t+="(unknown) ",t+=this.start+" "+this.end,this.colorStops!==null){let e=this.colorStops.iterator;for(;e.next();){let i=e.key,s=e.value;t+=" "+i+":"+s}}return t+=")",t}addColorStop(t,e){return this.h&&f.L(this),(typeof t!="number"||!isFinite(t)||t>1||t<0)&&f.W(t,"0 <= loc <= 1",E,"addColorStop:loc"),f.s(e,"string",E,"addColorStop:color"),this.Eo===null&&(this.Eo=new pt),this.Eo.set(t,e),this.H===1&&(this.type=2),this.cn=null,this}get type(){return this.H}set type(t){this.h&&f.L(this,t),this.H=t,this.start.isNoSpot()&&(t===2?this.start=D.TopCenter:t===3&&(this.start=D.Center)),this.end.isNoSpot()&&(t===2?this.end=D.BottomCenter:t===3&&(this.end=D.Center)),this.cn=null}get color(){return this.Na}set color(t){this.h&&f.L(this,t),this.Na=t,this.cn=null}get start(){return this.ei}set start(t){this.h&&f.L(this,t),this.ei=t.P(),this.cn=null}get end(){return this.gs}set end(t){this.h&&f.L(this,t),this.gs=t.P(),this.cn=null}get startRadius(){return this.j0}set startRadius(t){this.h&&f.L(this,t),t<0&&f.W(t,">= zero",E,"startRadius"),this.j0=t,this.cn=null}get endRadius(){return this.H0}set endRadius(t){this.h&&f.L(this,t),t<0&&f.W(t,">= zero",E,"endRadius"),this.H0=t,this.cn=null}get colorStops(){return this.Eo}set colorStops(t){this.h&&f.L(this,t),this.Eo=t,this.cn=null}get pattern(){return this.q0}set pattern(t){this.h&&f.L(this,t),this.q0=t,this.cn=null}static randomColor(t,e){t===void 0&&(t=128),e===void 0&&(e=Math.max(t,255));let i=Math.abs(e-t),s=Math.floor(t+Math.random()*i).toString(16),n=Math.floor(t+Math.random()*i).toString(16),o=Math.floor(t+Math.random()*i).toString(16);return s.length<2&&(s="0"+s),n.length<2&&(n="0"+n),o.length<2&&(o="0"+o),"#"+s+n+o}static isValidColor(t){return A.CSS?A.CSS.supports("color",t):!0}static lighten(t){return E.lightenBy(t)}lightenBy(t,e){this.h&&f.L(this);let i=t===void 0||typeof t!="number"?.2:t,s=e===void 0?3:e;if(this.type===1)E.No(this.color),this.color=E.td(i,s);else if((this.type===2||this.type===3)&&this.colorStops!==null){let n=this.colorStops.iterator;for(;n.next();)E.No(n.value),this.addColorStop(n.key,E.td(i,s))}return this}static lightenBy(t,e,i){let s=e===void 0||typeof e!="number"?.2:e,n=i===void 0?3:i;return E.No(t),E.td(s,n)}static darken(t){return E.darkenBy(t)}darkenBy(t,e){this.h&&f.L(this);let i=t===void 0||typeof t!="number"?.2:t,s=e===void 0?3:e;if(this.type===1)E.No(this.color),this.color=E.td(-i,s);else if((this.type===2||this.type===3)&&this.colorStops!==null){let n=this.colorStops.iterator;for(;n.next();)E.No(n.value),this.addColorStop(n.key,E.td(-i,s))}return this}static darkenBy(t,e,i){let s=e===void 0||typeof e!="number"?.2:e,n=i===void 0?3:i;return E.No(t),E.td(-s,n)}static mix(t,e,i){E.No(t);let s=E.Y.n0,n=E.Y.n1,o=E.Y.n2,r=E.Y.n3;E.No(e),i===void 0&&(i=.5);let a=Math.round((E.Y.n0-s)*i+s),h=Math.round((E.Y.n1-n)*i+n),l=Math.round((E.Y.n2-o)*i+o),u=Math.round((E.Y.n3-r)*i+r);return`rgba(${a}, ${h}, ${l}, ${u})`}isDark(){if(this.type===1)return E.isDark(this.color);if((this.type===2||this.type===3)&&this.colorStops!==null){let t=this.colorStops;if(this.type===3)return E.isDark(t.first().value);if(t.get(.5)!==null)return E.isDark(t.get(.5));if(t.count===2){let a=t.toArray();return E.isDark(E.mix(a[0].value,a[1].value))}let e=t.iterator,i=-1,s=-1,n=1,o=1;for(;e.next();){let a=e.key,h=Math.abs(.5-e.key);n>o&&h<n?(i=a,n=h):o>=n&&h<o&&(s=a,o=h)}if(i>s){let a=i;i=s,s=a,a=n,n=o,o=a}let r=s-i;return E.isDark(E.mix(t.get(i),t.get(s),1-o/r))}return!1}static isDark(t){return t?t instanceof E?t.isDark():(E.No(t),(299*E.Y.n0+587*E.Y.n1+114*E.Y.n2)/1e3<128):!1}static td(t,e){switch(e){case 1:return E.lv(),E.Zn.n0=Math.min(100,Math.max(0,E.Zn.n0+100*t)),E.hv(),"rgba("+E.Y.n0+", "+E.Y.n1+", "+E.Y.n2+", "+E.Y.n3+")";case 2:return E.jS(),E.Ii.n2=Math.min(100,Math.max(0,E.Ii.n2+100*t)),"hsla("+E.Ii.n0+", "+E.Ii.n1+"%, "+E.Ii.n2+"%, "+E.Ii.n3+")";case 3:return E.av(),E.Qn.n0=Math.min(100,Math.max(0,E.Qn.n0+100*t)),E.cv(),"rgba("+E.Y.n0+", "+E.Y.n1+", "+E.Y.n2+", "+E.Y.n3+")";default:f.o("Unknown color space: "+e)}}static No(t){E.W0===!1&&(E.W0=!0,E._n=U.isUsingDOM()?new Ue(null,void 0,{willReadFrequently:!0}).li:null);let e=E._n;if(e===null)return;e.clearRect(0,0,1,1),e.fillStyle="#000000";let i=e.fillStyle;if(e.fillStyle=t,e.fillStyle!==i){e.fillRect(0,0,1,1);let s=e.getImageData(0,0,1,1).data;E.Y.n0=s[0],E.Y.n1=s[1],E.Y.n2=s[2],E.Y.n3=s[3]/255}else{e.fillStyle="#FFFFFF";let s=e.fillStyle;e.fillStyle=t,e.fillStyle,E.Y.n0=0,E.Y.n1=0,E.Y.n2=0,E.Y.n3=1}}static jS(){let t=E.Y.n0/255,e=E.Y.n1/255,i=E.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}r*=60,r<0&&(r+=360),a=o/(1-Math.abs(2*h-1))}E.Ii.n0=Math.round(r),E.Ii.n1=Math.round(a*100),E.Ii.n2=Math.round(h*100),E.Ii.n3=E.Y.n3}static DE(){let t=E.Ii.n0,e=E.Ii.n1/100,i=E.Ii.n2/100,s,n,o,r=(1-Math.abs(2*i-1))*e,a=t/60,h=r*(1-Math.abs(a%2-1));a>=0&&a<1?(s=r,n=h,o=0):a>=1&&a<2?(s=h,n=r,o=0):a>=2&&a<3?(s=0,n=r,o=h):a>=3&&a<4?(s=0,n=h,o=r):a>=4&&a<5?(s=h,n=0,o=r):a>=5&&a<6&&(s=r,n=0,o=h);let l=i-.5*r;s+=l,n+=l,o+=l,E.Y.n0=Math.round(s*255),E.Y.n1=Math.round(n*255),E.Y.n2=Math.round(o*255),E.Y.n3=E.Ii.n3}static lv(){E.DA(),E.fv()}static hv(){E.uv(),E.FA()}static F2(t){return t/=255,t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}static R2(t){return t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055}static DA(){let t=E.F2(E.Y.n0),e=E.F2(E.Y.n1),i=E.F2(E.Y.n2);E.Dt.n0=.4124564*t+.3575761*e+.1804375*i,E.Dt.n1=.2126729*t+.7151522*e+.072175*i,E.Dt.n2=.0193339*t+.119192*e+.9503041*i,E.Dt.n3=E.Y.n3}static FA(){let t=3.2404542*E.Dt.n0+-1.5371385*E.Dt.n1+-.4985314*E.Dt.n2,e=-.969266*E.Dt.n0+1.8760108*E.Dt.n1+.041556*E.Dt.n2,i=.0556434*E.Dt.n0+-.2040259*E.Dt.n1+1.0572252*E.Dt.n2;E.Y.n0=E.R2(t)*255,E.Y.n1=E.R2(e)*255,E.Y.n2=E.R2(i)*255,E.Y.n3=E.Dt.n3,E.Y.n0=Math.round(E.Y.n0),E.Y.n0>255?E.Y.n0=255:E.Y.n0<0&&(E.Y.n0=0),E.Y.n1=Math.round(E.Y.n1),E.Y.n1>255?E.Y.n1=255:E.Y.n1<0&&(E.Y.n1=0),E.Y.n2=Math.round(E.Y.n2),E.Y.n2>255?E.Y.n2=255:E.Y.n2<0&&(E.Y.n2=0)}static v2=216/24389;static Zb=24389/27;static ed=[95.047,100,108.883];static O2(t){return t>E.v2?Math.pow(t,1/3):(E.Zb*t+16)/116}static fv(){let t=E.O2(E.Dt.n0*100/E.ed[0]),e=E.O2(E.Dt.n1*100/E.ed[1]),i=E.O2(E.Dt.n2*100/E.ed[2]);E.Zn.n0=116*e-16,E.Zn.n1=500*(t-e),E.Zn.n2=200*(e-i),E.Zn.n3=E.Dt.n3}static RA(t){let e=t*t*t;return e>E.v2?e:(116*t-16)/E.Zb}static uv(){let t=(E.Zn.n0+16)/116,e=E.Zn.n1/500+t,i=t-E.Zn.n2/200;E.Dt.n0=E.ed[0]/100*E.RA(e),E.Dt.n1=E.ed[1]/100*(E.Zn.n0>E.Zb*E.v2?Math.pow(t,3):E.Zn.n0/E.Zb),E.Dt.n2=E.ed[2]/100*E.RA(i),E.Dt.n3=E.Zn.n3}static dv(){let t=.8190224*E.Dt.n0+.3619062*E.Dt.n1+-.1288737*E.Dt.n2,e=.03298366*E.Dt.n0+.9292868*E.Dt.n1+.03614466*E.Dt.n2,i=.04817719*E.Dt.n0+.2642395*E.Dt.n1+.6335478*E.Dt.n2;t=Math.cbrt(t),e=Math.cbrt(e),i=Math.cbrt(i),E.ai.n0=.2104542*t+.7936177*e+-.004072046*i,E.ai.n1=1.977998*t+-2.428592*e+.4505937*i,E.ai.n2=.02590403*t+.7827717*e+-.8086757*i,E.ai.n3=E.Dt.n3,E.ai.n0*=100}static gv(){E.ai.n0/=100;let t=.9999999*E.ai.n0+.3963377*E.ai.n1+.2158037*E.ai.n2,e=1.000000009*E.ai.n0+-.1055613*E.ai.n1+-.06385417*E.ai.n2,i=1.00000005*E.ai.n0+-.08948418*E.ai.n1+-1.291485*E.ai.n2;t=t**3,e=e**3,i=i**3,E.Dt.n0=1.2268798*t+-.5578149*e+.281391*i,E.Dt.n1=-.04057576*t+1.112286*e+-.07171106*i,E.Dt.n2=-.07637294*t+-.4214933*e+1.586924*i,E.Dt.n3=E.ai.n3}static mv(){let t=Math.atan2(E.ai.n2,E.ai.n1)*180/Math.PI;E.Qn.n0=E.ai.n0,E.Qn.n1=Math.sqrt(E.ai.n1**2+E.ai.n2**2),E.Qn.n2=t>=0?t:t+360,E.Qn.n3=E.ai.n3}static pv(){E.ai.n0=E.Qn.n0,E.ai.n1=E.Qn.n1*Math.cos(E.Qn.n2*Math.PI/180),E.ai.n2=E.Qn.n1*Math.sin(E.Qn.n2*Math.PI/180),E.ai.n3=E.Qn.n3}static av(){E.DA(),E.dv(),E.mv()}static cv(){E.pv(),E.gv(),E.FA()}static Qu(t,e){typeof t=="string"||t instanceof E||f.o("Value for "+e+" must be a color string or a Brush, not "+t)}static Solid=1;static Linear=2;static Radial=3;static Pattern=4;static Lab=1;static HSL=2;static _n=null;static W0=!1;static Y=new fi;static Ii=new fi;static Dt=new fi;static Zn=new fi;static ai=new fi;static Qn=new fi}class Ft{St="Base";static es=new pt;static dn(t,e){e.name=t,Ft.es.set(t,e)}get name(){return this.St}set name(t){this.St=t}constructor(){}get classType(){return H}measure(t,e,i,s,n,o,r){}measureElement(t,e,i,s,n){t.ht(e,i,s,n)}arrange(t,e,i){}arrangeElement(t,e,i,s,n,o){t.Bt(e,i,s,n,o)}remeasureObject(t){t.tf()}Ui(t,e,i){}}class sr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=t.Uo();for(let l=0;l<a;l++){let u=s[l];if(!u.visible&&u!==h)continue;let c=u.margin,d=c.right+c.left,g=c.top+c.bottom;u.ht(e,i,o,r);let p=u.measuredBounds,m=Math.max(p.width+d,0),y=Math.max(p.height+g,0),w=u.position.x,b=u.position.y;if(isFinite(w)||(w=0),isFinite(b)||(b=0),u instanceof ut&&u.isGeometryPositioned){let v=u.strokeWidth/2;w-=v,b-=v}n.unionNoCheck(w,b,m,y)}}arrange(t,e,i){let s=e.length,n=t.padding,o=i.x-n.left,r=i.y-n.top;for(let a=0;a<s;a++){let h=e[a],l=h.measuredBounds,u=h.margin,c=h.position.x,d=h.position.y,g=isNaN(c)?-o:c-o,p=isNaN(d)?-r:d-r;if(h instanceof ut&&h.isGeometryPositioned){let m=h.strokeWidth/2;g-=m,p-=m}h.visible&&h.Bt(g+u.left,p+u.top,l.width,l.height)}}}Ft.dn("Position",new sr);class nr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=f.et(),l=t.Uo();for(let c=0;c<a;c++){let d=s[c];if(!d.visible&&d!==l)continue;let g=d.zs(!1);if(g!==0&&g!==5){h.push(d);continue}d.ht(1/0,i,0,r);let p=d.margin,m=d.measuredBounds,y=Math.max(m.width+p.right+p.left,0),w=Math.max(m.height+p.top+p.bottom,0);n.Fn(n.width+y,Math.max(n.height,w))}let 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 g=d.margin,p=g.right+g.left,m=g.top+g.bottom;d.ht(1/0,i,0,r);let y=d.measuredBounds,w=Math.max(y.width+p,0),b=Math.max(y.height+m,0);n.width+=w,n.height=Math.max(n.height,b)}f.J(h)}arrange(t,e,i){let s=e.length,n=t.padding,o=n.top,r=t.isOpposite,a=r?i.width:n.left;for(let h=0;h<s;h++){let l=o,u=e[h];if(!u.visible)continue;let c=u.measuredBounds,d=u.margin,g=d.top+d.bottom,p=o+n.bottom,m=c.height,y=u.zs(!1);(isNaN(u.desiredSize.height)&&y===2||y===4)&&(m=Math.max(i.height-g-p,0));let w=m+g+p,b=u.alignment;b.isDefault()&&(b=t.defaultAlignment),b.isSpot()||(b=D.Center),r&&(a-=c.width+d.left+d.right),u.Bt(a+b.offsetX+d.left,l+b.offsetY+d.top+(i.height*b.y-w*b.y),c.width,m),r||(a+=c.width+d.left+d.right)}}}Ft.dn("Horizontal",new nr);class or extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=f.et(),l=t.Uo();for(let c=0;c<a;c++){let d=s[c];if(!d.visible&&d!==l)continue;let g=d.zs(!1);if(g!==0&&g!==4){h.push(d);continue}d.ht(e,1/0,o,0);let p=d.margin,m=d.measuredBounds,y=Math.max(m.width+p.right+p.left,0),w=Math.max(m.height+p.top+p.bottom,0);n.Fn(Math.max(n.width,y),n.height+w)}let 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 g=d.margin,p=g.right+g.left,m=g.top+g.bottom;d.ht(e,1/0,o,0);let y=d.measuredBounds,w=Math.max(y.width+p,0),b=Math.max(y.height+m,0);n.width=Math.max(n.width,w),n.height+=b}f.J(h)}arrange(t,e,i){let s=e.length,n=t.padding,o=n.left,r=t.isOpposite,a=r?i.height:n.top;for(let h=0;h<s;h++){let l=o,u=e[h];if(!u.visible)continue;let c=u.measuredBounds,d=u.margin,g=d.left+d.right,p=o+n.right,m=c.width,y=u.zs(!1);(isNaN(u.desiredSize.width)&&y===2||y===5)&&(m=Math.max(i.width-g-p,0));let w=m+g+p,b=u.alignment;b.isDefault()&&(b=t.defaultAlignment),b.isSpot()||(b=D.Center),r&&(a-=c.height+d.bottom+d.top),u.Bt(l+b.offsetX+d.left+(i.width*b.x-w*b.x),a+b.offsetY+d.top,m,c.height),r||(a+=c.height+d.bottom+d.top)}}}Ft.dn("Vertical",new or);class es extends Ft{constructor(){super()}static vA=!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,g=l.top+l.bottom;h.ht(e,i,o,r);let p=h.measuredBounds,m=p.width,y=p.height,w=Math.max(m+d,0),b=Math.max(y+g,0),v=t.isClipping;v&&h.y0()!==0&&!es.vA&&(es.vA=!0,f.ni("Main Shape for Spot Panel with isClipping = true must have a zero strokeWidth: "+t.toString()));let k=z.V(-l.left,-l.top,w,b),S=z.V(0,0,m,y);this.I2(h,S,!0),m=S.width,y=S.height;let M=!0,F=t.Uo(),T;for(let N=0;N<a;N++){let C=s[N],R=e,O=i;if(C===h||!C.visible&&C!==F)continue;l=C.margin;let B=l.left,K=l.top;switch(u=l.right+l.left,c=l.top+l.bottom,T=C.zs(!1),T){case 2:R=m,O=y,u=0,c=0,B=0,K=0;break;case 5:R=m,u=0,B=0;break;case 4:O=y,c=0,K=0;break}C.ht(R,O,0,0),p=C.measuredBounds,w=Math.max(p.width+u,0),b=Math.max(p.height+c,0);let Y=C.alignment;Y.isDefault()&&(Y=t.defaultAlignment),Y.isSpot()||(Y=D.Center);let X=C.alignmentFocus;X.isDefault()&&(X=D.Center);let G=null;C instanceof H&&C.to!==""&&(G=C.findObject(C.to),G===C&&(G=null));let nt=S.x-B,at=S.y-K;if(G!==null){C.Bt(0,0,p.width,p.height);let tt=G.actualBounds,st=P.V(tt.x+(X.x*tt.width-X.offsetX),tt.y+(X.y*tt.height-X.offsetY));for(G=G.panel;G!==C;)G.T.gt(st),G=G.panel;nt+=Y.x*m+Y.offsetX-st.x,at+=Y.y*y+Y.offsetY-st.y,P.e(st)}else nt+=Y.x*m+Y.offsetX-(X.x*p.width+X.offsetX),at+=Y.y*y+Y.offsetY-(X.y*p.height+X.offsetY);M?(M=!1,n.i(nt,at,w,b)):n.unionNoCheck(nt,at,w,b)}switch(M?n.a(k):v?n.intersect(S.x,S.y,S.width,S.height):n.unionNoCheck(k.x,k.y,k.width,k.height),z.e(k),z.e(S),T=h.stretch,T===1&&(T=h.zs(!1)),T){case 0:return;case 2:if(!isFinite(e)&&!isFinite(i))return;break;case 5:if(!isFinite(e))return;break;case 4:if(!isFinite(i))return;break}p=h.measuredBounds,m=p.width,y=p.height,w=Math.max(m+d,0),b=Math.max(y+g,0),l=h.margin,S=z.V(-l.left,-l.top,w,b),this.I2(h,S,!0),m=S.width,y=S.height;for(let N=0;N<a;N++){let C=s[N];if(C===h||!C.visible&&C!==F)continue;l=C.margin,u=l.right+l.left,c=l.top+l.bottom,p=C.measuredBounds,w=Math.max(p.width+u,0),b=Math.max(p.height+c,0);let R=C.alignment;R.isDefault()&&(R=t.defaultAlignment),R.isSpot()||(R=D.Center);let O=C.alignmentFocus;O.isDefault()&&(O=D.Center),M?(M=!1,n.i(R.x*m+R.offsetX-(O.x*p.width+O.offsetX)-l.left,R.y*y+R.offsetY-(O.y*p.height+O.offsetY)-l.top,w,b)):n.unionNoCheck(R.x*m+R.offsetX-(O.x*p.width+O.offsetX)-l.left,R.y*y+R.offsetY-(O.y*p.height+O.offsetY)-l.top,w,b)}M?n.a(k):v?n.intersect(S.x,S.y,S.width,S.height):n.unionNoCheck(k.x,k.y,k.width,k.height),z.e(S)}arrange(t,e,i){let s=e.length;if(s===0)return;let n=t.findMainElement(),o=n.measuredBounds,r=o.width,a=o.height,h=t.padding,l=h.left,u=h.top,c=l-i.x,d=u-i.y;n.Bt(c,d,r,a);let g=z.V(0,0,r,a);this.I2(n,g,!1);for(let p=0;p<s;p++){let m=e[p];if(m===n)continue;let y=m.measuredBounds,w=y.width,b=y.height,v=m.alignment;v.isDefault()&&(v=t.defaultAlignment),v.isSpot()||(v=D.Center);let k=m.alignmentFocus;k.isDefault()&&(k=D.Center);let S=null;if(m instanceof H&&m.to!==""&&(S=m.findObject(m.to),S===m&&(S=null)),S!==null){let M=S.actualBounds,F=P.V(M.x+(k.x*M.width-k.offsetX),M.y+(k.y*M.height-k.offsetY));for(S=S.panel;S!==m;)S.T.gt(F),S=S.panel;c=v.x*g.width+v.offsetX-F.x,d=v.y*g.height+v.offsetY-F.y,P.e(F)}else c=v.x*g.width+v.offsetX-(k.x*w+k.offsetX),d=v.y*g.height+v.offsetY-(k.y*b+k.offsetY);c+=g.x-i.x,d+=g.y-i.y,m.visible&&m.Bt(l+c,u+d,w,b)}z.e(g)}I2(t,e,i){let s=null;if(t instanceof H&&t.to!==""&&(s=t.findObject(t.to),s===t&&(s=null)),s!==null)for(i&&t.Bt(0,0,e.width,e.height),e.a(s.actualBounds),s=s.panel;s!==t;)s.T.vg(e),s=s.panel}}Ft.dn("Spot",new es);class rr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length;if(a===0)return;let h=t.findMainElement(),l=h.margin,u=e,c=i,d=l.right+l.left,g=l.top+l.bottom;h.ht(e,i,o,r);let p=h.measuredBounds,m=0,y=null;h instanceof ut&&(y=h,m=y.strokeWidth*y.scale);let w=Math.max(p.width+d,0),b=Math.max(p.height+g,0),v=t.E2(h),k=v.x*w+v.offsetX,S=v.y*b+v.offsetY,M=t.U2(h),F=M.x*w+M.offsetX,T=M.y*b+M.offsetY;isFinite(e)&&(u=Math.max(Math.abs(k-F)-m,0)),isFinite(i)&&(c=Math.max(Math.abs(S-T)-m,0));let N=0,C=0;o>0&&(N=Math.max(Math.abs(v.x*o+v.offsetX-(M.x*o+M.offsetX))-m,0)),r>0&&(C=Math.max(Math.abs(v.y*r+v.offsetY-(M.y*r+M.offsetY))-m,0));let R=Q.l();R.i(0,0);let O=t.Uo();for(let X=0;X<a;X++){let G=s[X];if(G===h||!G.visible&&G!==O)continue;l=G.margin;let nt=l.right+l.left,at=l.top+l.bottom;G.ht(u,c,N,C),p=G.measuredBounds,w=Math.max(p.width+nt,0),b=Math.max(p.height+at,0),R.i(Math.max(w,R.width),Math.max(b,R.height))}if(a===1){p=h.measuredBounds,n.width=w,n.height=b,Q.e(R);return}v=t.E2(h),M=t.U2(h);let B=0,K=0;M.x!==v.x&&M.y!==v.y&&(B=R.width/Math.abs(M.x-v.x),K=R.height/Math.abs(M.y-v.y)),Q.e(R),m=0,y!==null&&(m=y.strokeWidth*y.scale,y.aS()===6&&(B=K=Math.max(B,K))),B+=Math.abs(v.offsetX)+Math.abs(M.offsetX)+m,K+=Math.abs(v.offsetY)+Math.abs(M.offsetY)+m;let Y=h.stretch;switch(Y===1&&(Y=h.zs(!1)),Y){case 0:o=0,r=0;break;case 2:isFinite(e)&&(B=e),isFinite(i)&&(K=i);break;case 5:isFinite(e)&&(B=e),r=0;break;case 4:o=0,isFinite(i)&&(K=i);break}h.tf(),h.ht(B,K,o,r),n.width=h.measuredBounds.width+d,n.height=h.measuredBounds.height+g}arrange(t,e,i){let s=e.length;if(s===0)return;let n=t.findMainElement(),o=n.measuredBounds,r=z.l();r.i(0,0,1,1);let a=n.margin,h=a.left,l=a.top,u=t.padding,c=u.left,d=u.top,g=h,p=l,m=o.width,y=o.height;n.Bt(c+g,d+p,m,y);let w=t.E2(n),b=t.U2(n),v=0+w.x*o.width+w.offsetX,k=0+w.y*o.height+w.offsetY,S=0+b.x*o.width+b.offsetX,M=0+b.y*o.height+b.offsetY;r.x=v,r.y=k,r.unionNoCheck(S,M,0,0),r.x+=h+c,r.y+=l+d;for(let F=0;F<s;F++){let T=e[F];if(T===n)continue;let N=T.measuredBounds;a=T.margin;let C=Math.max(N.width+a.right+a.left,0),R=Math.max(N.height+a.top+a.bottom,0),O=T.alignment;O.isDefault()&&(O=t.defaultAlignment),O.isSpot()||(O=D.Center),g=r.width*O.x+O.offsetX-C*O.x+a.left+r.x,p=r.height*O.y+O.offsetY-R*O.y+a.top+r.y,m=r.width,y=r.height,T.visible&&(z.contains(r.x,r.y,r.width,r.height,g,p,N.width,N.height)?T.Bt(g,p,N.width,N.height):T.Bt(g,p,N.width,N.height,new z(r.x,r.y,r.width,r.height)))}z.e(r)}}Ft.dn("Auto",new rr);class ar extends Ft{constructor(){super(),this.name="Table"}measure(t,e,i,s,n,o,r){let a=s.length,h=f.et(),l=f.et();for(let lt=0;lt<a;lt++){let J=s[lt],mt=J instanceof H?J:null;if(mt!==null&&mt.$r()&&J.visible){l.push(mt);let At=mt.C.r,Qt=At.length;for(let Ht=0;Ht<Qt;Ht++){let Jt=At[Ht];mt.type===H.TableRow?Jt.row=J.row:mt.type===H.TableColumn&&(Jt.column=J.column),h.push(Jt)}}else h.push(J)}a=h.length,a===0&&(t.getRowDefinition(0),t.getColumnDefinition(0));let u=[];for(let lt=0;lt<a;lt++){let J=h[lt];J.visible&&(J.ue(!0),J.Jn(!0),u[J.row]||(u[J.row]=[]),u[J.row][J.column]||(u[J.row][J.column]=[]),u[J.row][J.column].push(J))}f.J(h);let c=f.et(),d=f.et(),g=f.et(),p={count:0},m={count:0},y=e,w=i,b=t.Xe,v=t.Ye,k=null;a=b.length;for(let lt=0;lt<a;lt++)k=b[lt],k!==void 0&&(k.actual=0,k.Ai=0);a=v.length;for(let lt=0;lt<a;lt++)k=v[lt],k!==void 0&&(k.actual=0,k.Ai=0);let S=u.length,M=0;for(let lt=0;lt<S;lt++)u[lt]&&(M=Math.max(M,u[lt].length));let F=Math.min(t.topIndex,S-1),T=Math.min(t.leftIndex,M-1),N=0,C;S=u.length;let R=t.Uo();for(let lt=0;lt<S;lt++){if(!u[lt])continue;M=u[lt].length;let J=t.getRowDefinition(lt);J.actual=0,J.Ai=0;for(let mt=0;mt<M;mt++){if(!u[lt][mt])continue;let At=t.getColumnDefinition(mt);c[mt]===void 0&&(At.actual=0,At.Ai=0,c[mt]=!0);let Qt=u[lt][mt],Ht=Qt.length;for(let Jt=0;Jt<Ht;Jt++){let Zt=Qt[Jt];if(!Zt.visible&&Zt!==R)continue;let Te=Zt.rowSpan>1,ye=Zt.columnSpan>1;(Te||ye)&&!(lt<F)&&!(mt<T)&&d.push(Zt);let ke=Zt.margin,_t=ke.right+ke.left,se=ke.top+ke.bottom;C=Zt.S0(J,At,!1);let Pe=Zt.desiredSize,Ot=!isNaN(Pe.width),Ie=!isNaN(Pe.height);if(C!==0&&!(Ot&&Ie)&&!(lt<F)&&!(mt<T)&&(!ye&&p[mt]===void 0&&(C===2||C===5)&&(p[mt]=-1,p.count++),!Te&&m[lt]===void 0&&(C===2||C===4)&&(m[lt]=-1,m.count++),!Te&&!ye&&g.push(Zt)),Zt.ht(1/0,1/0,0,0),lt<F||mt<T)continue;let ue=Zt.measuredBounds,De=Math.max(ue.width+_t,0),Ye=Math.max(ue.height+se,0);if(Zt.rowSpan===1&&(C===0||C===5)){k=t.getRowDefinition(lt);let Fe=k.computeEffectiveSpacing(),zi=k._===0;N=Math.max(Ye-k.actual,0),N+(zi?Fe:0)>w&&(N=Math.max(w-Fe,0)),k.Ai=k.Ai+N,k.actual=k._+N,w=Math.max(w-(N+(zi?Fe:0)),0)}if(Zt.columnSpan===1&&(C===0||C===4)){k=t.getColumnDefinition(mt);let Fe=k.computeEffectiveSpacing(),zi=k._===0;N=Math.max(De-k.actual,0),N+(zi?Fe:0)>y&&(N=Math.max(y-Fe,0)),k.Ai=k.Ai+N,k.actual=k._+N,y=Math.max(y-(N+(zi?Fe:0)),0)}(Te||ye)&&Zt.tf()}}}f.J(c);let O=0,B=0;a=t.columnCount;for(let lt=0;lt<a;lt++){let J=v[lt];J!==void 0&&(O+=isNaN(J.de)?J.Ai:J.de,J.Ai!==0&&(O+=J.computeEffectiveSpacing()))}a=t.rowCount;for(let lt=0;lt<a;lt++){let J=b[lt];J!==void 0&&(B+=isNaN(J.de)?J.Ai:J.de,J.Ai!==0&&(B+=J.computeEffectiveSpacing()))}y=Math.max(e-O,0),w=Math.max(i-B,0);let K=w,Y=y;a=g.length;for(let lt=0;lt<a;lt++){let J=g[lt],mt=t.getRowDefinition(J.row),At=t.getColumnDefinition(J.column),Qt=J.measuredBounds,Ht=J.margin,Jt=Ht.right+Ht.left,Zt=Ht.top+Ht.bottom;At.Ai===0&&p[J.column]!==void 0?p[J.column]=Math.max(Qt.width+Jt,p[J.column]):p[J.column]=null,mt.Ai===0&&m[J.row]!==void 0?m[J.row]=Math.max(Qt.height+Zt,m[J.row]):m[J.row]=null}let X=0,G=0,nt;for(nt in m)nt!=="count"&&(X+=m[nt]);for(nt in p)nt!=="count"&&(G+=p[nt]);let at=Q.l();for(let lt=0;lt<a;lt++){let J=g[lt];if(!J.visible&&J!==R)continue;let mt=t.getRowDefinition(J.row),At=t.getColumnDefinition(J.column),Qt=0;isFinite(At.width)?Qt=At.width:(isFinite(y)&&p[J.column]!==null?G===0?Qt=At.actual+y:Qt=p[J.column]/G*Y:p[J.column]!==null?Qt=y:Qt=At.actual||y,Qt=Math.max(0,Qt-At.computeEffectiveSpacing()));let Ht=0;switch(isFinite(mt.height)?Ht=mt.height:(isFinite(w)&&m[J.row]!==null?X===0?Ht=mt.actual+w:Ht=m[J.row]/X*K:m[J.row]!==null?Ht=w:Ht=mt.actual||w,Ht=Math.max(0,Ht-mt.computeEffectiveSpacing())),at.i(Math.max(At.minimum,Math.min(Qt,At.maximum)),Math.max(mt.minimum,Math.min(Ht,mt.maximum))),C=J.S0(mt,At,!1),C){case 5:at.height=Math.max(at.height,mt.actual+w);break;case 4:at.width=Math.max(at.width,At.actual+y);break}let Jt=J.margin,Zt=Jt.right+Jt.left,Te=Jt.top+Jt.bottom;J.tf();let ye=At.minimum,ke=mt.minimum,_t=J.measuredBounds;_t.width===0&&p[J.column]!==null&&(ye=Math.max(ye,p[J.column])),_t.height===0&&m[J.row]!==null&&(ke=Math.max(ye,m[J.row])),J.ht(at.width,at.height,ye,ke);let se=J.measuredBounds,Pe=Math.max(se.width+Zt,0),Ot=Math.max(se.height+Te,0);isFinite(y)&&(Pe=Math.min(Pe,at.width)),isFinite(w)&&(Ot=Math.min(Ot,at.height));let Ie=0;Ie=mt.actual,mt.actual=Math.max(mt.actual,Ot),mt.Ai=Math.max(mt.Ai,Ot),N=mt.actual-Ie,w=Math.max(w-N,0),m[J.row]===null&&(K=Math.max(K-N,0)),Ie=At.actual,At.actual=Math.max(At.actual,Pe),At.Ai=Math.max(At.Ai,Pe),N=At.actual-Ie,y=Math.max(y-N,0),p[J.column]===null&&(Y=Math.max(Y-N,0))}f.J(g);let tt=Q.l(),st=f.et(),et=f.et();if(a=d.length,a!==0)for(let lt=0;lt<S;lt++){if(!u[lt])continue;M=u[lt].length;let J=t.getRowDefinition(lt);st[lt]=J.actual;for(let mt=0;mt<M;mt++){if(!u[lt][mt])continue;let At=t.getColumnDefinition(mt);et[mt]=At.actual}}for(let lt=0;lt<a;lt++){let J=d[lt];if(!J.visible&&J!==R)continue;let mt=t.getRowDefinition(J.row),At=t.getColumnDefinition(J.column);switch(at.i(Math.max(At.minimum,Math.min(e,At.maximum)),Math.max(mt.minimum,Math.min(i,mt.maximum))),C=J.S0(mt,At,!1),C){case 2:et[At.index]!==0&&(at.width=Math.min(at.width,et[At.index])),st[mt.index]!==0&&(at.height=Math.min(at.height,st[mt.index]));break;case 5:et[At.index]!==0&&(at.width=Math.min(at.width,et[At.index]));break;case 4:st[mt.index]!==0&&(at.height=Math.min(at.height,st[mt.index]));break}isFinite(At.width)&&(at.width=At.width),isFinite(mt.height)&&(at.height=mt.height),tt.i(0,0);let Qt=At.minimum,Ht=mt.minimum;for(let Ot=1;Ot<J.rowSpan&&!(J.row+Ot>=t.rowCount);Ot++)k=t.getRowDefinition(J.row+Ot),N=0,C===2||C===4?N=Math.max(k.minimum,st[J.row+Ot]===0?k.maximum:Math.min(st[J.row+Ot],k.maximum)):N=Math.max(k.minimum,isNaN(k.de)?k.maximum:Math.min(k.de,k.maximum)),tt.height+=N,Ht+=k.minimum;for(let Ot=1;Ot<J.columnSpan&&!(J.column+Ot>=t.columnCount);Ot++)k=t.getColumnDefinition(J.column+Ot),N=0,C===2||C===5?N=Math.max(k.minimum,et[J.column+Ot]===0?k.maximum:Math.min(et[J.column+Ot],k.maximum)):N=Math.max(k.minimum,isNaN(k.de)?k.maximum:Math.min(k.de,k.maximum)),tt.width+=N,Qt+=k.minimum;at.width+=tt.width,at.height+=tt.height;let Jt=J.margin,Zt=Jt.right+Jt.left,Te=Jt.top+Jt.bottom;J.ht(at.width,at.height,Qt,Ht);let ye=J.measuredBounds,ke=Math.max(ye.width+Zt,0),_t=Math.max(ye.height+Te,0),se=0;for(let Ot=0;Ot<J.rowSpan&&!(J.row+Ot>=t.rowCount);Ot++)k=t.getRowDefinition(J.row+Ot),se+=k.total||0;if(se<_t){let Ot=_t-se,Ie=_t-se;if(J.spanAllocation!==null){let ue=J.spanAllocation;for(let De=0;De<J.rowSpan&&!(Ot<=0||J.row+De>=t.rowCount);De++){k=t.getRowDefinition(J.row+De);let Ye=k._||0,Fe=ue(J,k,Ie);k.actual=Math.min(k.maximum,Ye+Fe),k._!==Ye&&(Ot-=k._-Ye)}}for(;Ot>0;){let ue=k._||0;if(isNaN(k.height)&&k.maximum>ue&&(k.actual=Math.min(k.maximum,ue+Ot),k._!==ue&&(Ot-=k._-ue)),k.index===0)break;k=t.getRowDefinition(k.index-1)}}let Pe=0;for(let Ot=0;Ot<J.columnSpan&&!(J.column+Ot>=t.columnCount);Ot++)k=t.getColumnDefinition(J.column+Ot),Pe+=k.total||0;if(Pe<ke){let Ot=ke-Pe,Ie=ke-Pe;if(J.spanAllocation!==null){let ue=J.spanAllocation;for(let De=0;De<J.columnSpan&&!(Ot<=0||J.column+De>=t.columnCount);De++){k=t.getColumnDefinition(J.column+De);let Ye=k._||0,Fe=ue(J,k,Ie);k.actual=Math.min(k.maximum,Ye+Fe),k._!==Ye&&(Ot-=k._-Ye)}}for(;Ot>0;){let ue=k._||0;if(isNaN(k.width)&&k.maximum>ue&&(k.actual=Math.min(k.maximum,ue+Ot),k._!==ue&&(Ot-=k._-ue)),k.index===0)break;k=t.getColumnDefinition(k.index-1)}}}f.J(d),Q.e(tt),Q.e(at),st!==void 0&&f.J(st),et!==void 0&&f.J(et);let ct=0,gt=0,wt=t.desiredSize,Ct=t.maxSize;C=t.zs(!0),O=0,B=0;let ot=0,Mt=0;a=t.columnCount;for(let lt=0;lt<a;lt++)if(v[lt]!==void 0){if(k=t.getColumnDefinition(lt),isFinite(k.width)){ot+=k.width,ot+=k.computeEffectiveSpacing();continue}else if(k.Qb()===2){ot+=k._,ot+=k.computeEffectiveSpacing();continue}k._!==0&&(O+=k._,O+=k.computeEffectiveSpacing())}isFinite(wt.width)?ct=Math.min(wt.width,Ct.width):C!==0&&isFinite(e)?ct=e:ct=O,ct=Math.max(ct,isFinite(e)?Math.min(o,e):o),ct=Math.max(ct-ot,0);let bt=O===0?1:Math.max(ct/O,1);for(let lt=0;lt<a;lt++)v[lt]!==void 0&&(k=t.getColumnDefinition(lt),!isFinite(k.width)&&k.Qb()!==2&&(k.actual=k._*bt),k.position=n.width,k._!==0&&(n.width+=k._,n.width+=k.computeEffectiveSpacing()));a=t.rowCount;for(let lt=0;lt<a;lt++)if(b[lt]!==void 0){if(k=t.getRowDefinition(lt),isFinite(k.height)){Mt+=k.height,Mt+=k.computeEffectiveSpacing();continue}else if(k.Qb()===2){Mt+=k._,Mt+=k.computeEffectiveSpacing();continue}k._!==0&&(B+=k._,B+=k.computeEffectiveSpacing())}isFinite(wt.height)?gt=Math.min(wt.height,Ct.height):C!==0&&isFinite(i)?gt=i:gt=B,gt=Math.max(gt,isFinite(i)?Math.min(r,i):r),gt=Math.max(gt-Mt,0);let Gt=B===0?1:Math.max(gt/B,1);for(let lt=0;lt<a;lt++)b[lt]!==void 0&&(k=t.getRowDefinition(lt),!isFinite(k.height)&&k.Qb()!==2&&(k.actual=k._*Gt),k.position=n.height,k._!==0&&(n.height+=k._,n.height+=k.computeEffectiveSpacing()));a=l.length;for(let lt=0;lt<a;lt++){let J=l[lt],mt=0,At=0;J.type===H.TableRow?(mt=n.width,k=t.getRowDefinition(J.row),At=k.actual):(k=t.getColumnDefinition(J.column),mt=k.actual,At=n.height),J.measuredBounds.i(0,0,mt,At),J.ue(!1)}f.J(l),t.yh=u}arrange(t,e,i){let s=e.length,n=t.padding,o=n.left,r=n.top,a=t.yh;if(a===null)return;let h=0,l=0,u=a.length,c=0;for(let T=0;T<u;T++)a[T]&&(c=Math.max(c,a[T].length));let d=t.Xe,g=t.Ye,p=0,m=0,y=Math.min(t.topIndex,u-1);if(d.length>0){for(;y!==u&&(d[y]===void 0||d[y]._===0);)y++;y=Math.max(Math.min(y,u-1),0),p=-d[y].position}let w=Math.min(t.leftIndex,c-1);if(g.length>0){for(;w!==c&&(g[w]===void 0||g[w]._===0);)w++;w=Math.max(Math.min(w,c-1),0),m=-g[w].position}let b=0,v=0;for(;b!==u&&d[b]===void 0;)b++;for(;v!==u&&g[v]===void 0;)v++;let k=t.part,S=t.getRowDefinition(b),M=t.getColumnDefinition(v);for(let T=0;T<e.length;T++){let N=e[T];if(!(N instanceof H&&N.visible&&N.$r()))continue;N.type===H.TableRow?(S=t.getRowDefinition(N.row),M=t.getColumnDefinition(v)):(S=t.getRowDefinition(b),M=t.getColumnDefinition(N.column)),l=S.position+p+r,S._!==0&&(l+=S.computeEffectiveSpacingTop(Math.max(b,y))),h=M.position+m+o,M._!==0&&(h+=M.computeEffectiveSpacingTop(Math.max(v,w)));let C=N.measuredBounds;N.$c(),N.actualBounds.Pt();let R=N.actualBounds,O=z.V(R.x,R.y,R.width,R.height);if(R.x=N.type===H.TableRow?o:h,R.y=N.type===H.TableColumn?r:l,R.width=C.width,R.height=C.height,N.actualBounds.u(),N.Jn(!1),O.equalsApproxClose(R)){z.e(O);continue}k!==null&&(k.dh(),N.x0(k)),z.e(O)}let F=Q.l();for(let T=0;T<u;T++){if(!a[T])continue;c=a[T].length;let N=t.getRowDefinition(T);l=N.position+p+r,N._!==0&&(l+=N.computeEffectiveSpacingTop(Math.max(b,y)));for(let C=0;C<c;C++){if(!a[T][C])continue;let R=t.getColumnDefinition(C);h=R.position+m+o,R._!==0&&(h+=R.computeEffectiveSpacingTop(Math.max(v,w)));let O=a[T][C],B=O.length;for(let K=0;K<B;K++){let Y=O[K],X=Y.measuredBounds;F.i(0,0);for(let _t=1;_t<Y.rowSpan&&!(T+_t>=t.rowCount);_t++){let se=t.getRowDefinition(T+_t);se._!==0&&(F.height+=se.total)}for(let _t=1;_t<Y.columnSpan&&!(C+_t>=t.columnCount);_t++){let se=t.getColumnDefinition(C+_t);se._!==0&&(F.width+=se.total)}let G=R._+F.width,nt=N._+F.height,at=h,tt=l,st=G,et=nt,ct=h,gt=l,wt=G,Ct=nt;h+G>i.width&&(wt=Math.max(i.width-h,0)),l+nt>i.height&&(Ct=Math.max(i.height-l,0));let ot=Y.alignment,Mt=0,bt=0,Gt=0,lt=0;if(ot.isDefault()){ot=t.defaultAlignment,ot.isSpot()||(ot=D.Center),Mt=ot.x,bt=ot.y,Gt=ot.offsetX,lt=ot.offsetY;let _t=R.alignment,se=N.alignment;_t.isSpot()&&(Mt=_t.x,Gt=_t.offsetX),se.isSpot()&&(bt=se.y,lt=se.offsetY)}else Mt=ot.x,bt=ot.y,Gt=ot.offsetX,lt=ot.offsetY;(isNaN(Mt)||isNaN(bt))&&(Mt=.5,bt=.5,Gt=0,lt=0);let J=X.width,mt=X.height,At=Y.margin,Qt=At.left+At.right,Ht=At.top+At.bottom,Jt=Y.S0(N,R,!1);isNaN(Y.desiredSize.width)&&(Jt===2||Jt===5)&&(J=Math.max(G-Qt,0)),isNaN(Y.desiredSize.height)&&(Jt===2||Jt===4)&&(mt=Math.max(nt-Ht,0));let Zt=Y.maxSize,Te=Y.minSize;J=Math.min(Zt.width,J),mt=Math.min(Zt.height,mt),J=Math.max(Te.width,J),mt=Math.max(Te.height,mt);let ye=J+Qt,ke=mt+Ht;at+=st*Mt-ye*Mt+Gt+At.left,tt+=et*bt-ke*bt+lt+At.top,Y.visible&&(z.contains(ct,gt,wt,Ct,at,tt,X.width,X.height)?Y.Bt(at,tt,J,mt):Y.Bt(at,tt,J,mt,new z(ct,gt,wt,Ct)))}}}Q.e(F);for(let T=0;T<s;T++){let N=e[T],C=N instanceof H?N:null;if(C!==null&&C.$r()){let R=N.actualBounds;N.naturalBounds.Pt(),N.naturalBounds.i(0,0,R.width,R.height),N.naturalBounds.u()}}}}Ft.dn("Table",new ar);class hr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){}arrange(t,e,i){}}Ft.dn("TableRow",new hr);class lr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){}arrange(t,e,i){}}Ft.dn("TableColumn",new lr);class ur extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){s.length!==1&&f.o("Viewbox Panel must contain exactly one GraphObject.");let a=s[0];a.tt=1,a.tf(),a.ht(1/0,1/0,o,r);let h=a.measuredBounds,l=a.margin,u=l.right+l.left,c=l.top+l.bottom;if(isFinite(e)||isFinite(i)){let d=a.scale,g=h.width,p=h.height,m=Math.max(e-u,0),y=Math.max(i-c,0),w=1;t.viewboxStretch===6?(g!==0&&p!==0&&(w=Math.min(m/g,y/p)),w===0&&(w=1e-4),a.tt*=w):(g!==0&&p!==0&&(w=Math.max(m/g,y/p)),w===0&&(w=1e-4),a.tt*=w),d!==a.scale&&(a.ue(!0),a.ht(1/0,1/0,o,r))}h=a.measuredBounds,n.width=isFinite(e)?e:Math.max(h.width+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=D.Center),s.Bt(i.width*u.x-h*u.x+u.offsetX,i.height*u.y-l*u.y+u.offsetY,n.width,n.height)}}Ft.dn("Viewbox",new ur);class cr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){t.yi===null&&(t.yi=new gi),this.yv(t),this.wv(t)}arrange(t,e,i){}Ui(t,e,i){let s=t.naturalBounds,n=s.width,o=s.height;e.save(),e.beginPath(),e.rect(0,0,n,o),e.clip(),e.endPath(),this.xv(t,e,i),e.restore(),e.clearContextCache(!1)}xv(t,e,i){let s=t.getDocumentScale()*i.scale;s<=0&&(s=1);let n=t.gridCellSize,o=n.width,r=n.height,a=t.naturalBounds,h=t.actualBounds,l=a.width,u=a.height,c=Math.ceil(l/o),d=Math.ceil(u/r),g=t.gridOrigin,p=g.x,m=g.y,y=t.yi.J0,w=t.C.r,b=w.length;for(let v=0;v<b;v++){let k=w[v];if(!k.visible)continue;let S=k.interval||1,M=Math.abs(S);if(o*M*s<2)continue;let F=k.segmentIndex;(!isFinite(F)||isNaN(F))&&(F=0),F<0&&(F=M-Math.min(-F,M)),F=Math.round(F%M);let T=k.opacity,N=1;if(T!==1){if(T===0)continue;N=e.globalAlpha,e.globalAlpha=N*T}let C=y[v],R=!1,O=k.strokeDashArray;if(O!==null&&(R=!0,e.enableDash(O,k.strokeDashOffset)),k.stroke!==null&&k.strokeWidth>0&&(k.figure==="LineV"||k.figure==="LineH")){if(e.lineWidth=k.strokeWidth,t.rn(e,k.stroke,!1,!1,a,h),e.beginPath(),k.figure==="LineV"){let B=Math.floor((p-o)/o);for(let K=B;K<=B+c;K++){let Y=K*o+p;0<=Y&&Y<=l&&this._b(K,S,F,C)&&(e.moveTo(Y,0),e.lineTo(Y,u))}}else if(k.figure==="LineH"){let B=Math.floor((m-r)/r);for(let K=B;K<=B+d;K++){let Y=K*r+m;0<=Y&&Y<=u&&this._b(K,S,F,C)&&(e.moveTo(0,Y),e.lineTo(l,Y))}}e.stroke(),e.endPath()}else if(k.fill!==null){if(t.rn(e,k.fill,!0,!1,a,h),k.figure==="BarV"){let B=k.width;isNaN(B)&&(B=o);let K=Math.floor((p-o)/o);for(let Y=K;Y<=K+c;Y++){let X=Y*o+p;0<=X+B&&X<=l&&this._b(Y,S,F,C)&&e.fillRect(X,0,B,u)}}else if(k.figure==="BarH"){let B=k.height;isNaN(B)&&(B=r);let K=Math.floor((m-r)/r);for(let Y=K;Y<=K+d;Y++){let X=Y*r+m;0<=X+B&&X<=u&&this._b(Y,S,F,C)&&e.fillRect(0,X,l,B)}}}R&&e.disableDash(),T!==1&&(e.globalAlpha=N)}}_b(t,e,i,s){if(e<0)return t%e===i;if(t%e!==i)return!1;let n=s.length;for(let o=0;o<n;o++){let r=s[o];if(t%r===i)return!1}return!0}wv(t){let e=[],i=t.C.r,s=i.length;for(let n=0;n<s;n++){let o=i[n],r=[];if(e.push(r),!o.visible)continue;let a=o.interval;if(a<0)continue;let h=o.figure,l=this.B2(h);for(let u=0;u<s;u++){if(u===n)continue;let c=i[u];if(!c.visible)continue;let d=c.figure;if(this.B2(d)!==l)continue;let g=c.interval;g>a&&r.push(g)}}t.yi.J0=e}B2(t){return t==="LineV"||t==="BarV"}yv(t){let e=1,i=1,s=t.C.r,n=s.length;for(let a=0;a<n;a++){let h=s[a],l=Math.abs(h.interval);l<2||(this.B2(h.figure)?i=i*l/L.DC(i,l):e=e*l/L.DC(e,l))}let o=t.gridCellSize,r=t.yi;r.Yc.isReal()?r.Yc.i(i*o.width,e*o.height):r.Yc=new Q(i*o.width,e*o.height)}}Ft.dn("Grid",new cr);class dr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length;if(!(t instanceof St||t instanceof _))return;let h=null,l=null;if(t instanceof _&&(h=t),t instanceof St&&(l=t,h=l.adornedPart,t.hf===null&&(t.hf=[])),!(h instanceof _))return;let u=h;if(a===0){t.naturalBounds.Fn(0,0),t.measuredBounds.i(0,0,0,0);return}let c=t instanceof St?null:h.path,d=h.routeBounds,g=t.Bo;g.i(0,0,d.width,d.height);let p=u.points,m=h.pointsCount;l!==null?l.sd(!1):h!==null&&h.sd(!1);let y=d.width,w=d.height,b=t.hf;if(b.length=0,c!==null){this.measureLinkPath(t,y,w,c);let M=c.measuredBounds;g.unionRect(M),b.push(M)}let v=Pt.l(),k=P.l(),S=P.l();for(let M=0;M<a;M++){let F=s[M];if(F===c)continue;let T=F.measuredBounds;if(F.isPanelMain&&F instanceof ut){this.measureLinkPath(t,y,w,F),T=F.measuredBounds,g.unionRect(T),b.push(T);continue}if(m<2){F.ht(1/0,1/0,0,0),T=F.measuredBounds,g.unionRect(T),b.push(T);continue}let N=F.segmentIndex,C=F.segmentFraction,R=F.alignmentFocus;R.isNoSpot()&&(R=D.Center);let O=F.segmentOrientation,B=F.segmentOffset,K=0,Y=0,X=0,G=0;if(isNaN(N)){let ot=u.ot,Mt=f.et();ot.getPointAndAngleAlongPath(C,Mt);let bt=P.V(Mt[0],Mt[1]);G=Mt[2],O!==0&&(X=u.computeAngle(F,O,G),F.Yt=X,F.ue(!0),F.Jn(!0)),K=bt.x,Y=bt.y,P.e(bt),f.J(Mt)}else if(N<-m||N>=m){let ot=P.l();u.OA(ot),G=u.midAngle,O!==0&&(X=u.computeAngle(F,O,G),F.Yt=X,F.ue(!0),F.Jn(!0)),K=ot.x-d.x,Y=ot.y-d.y,P.e(ot)}else{let ot,Mt,bt=0;if(N>=0?(ot=p.elt(N),Mt=N<m-1?p.elt(N+1):ot):(bt=m+N,ot=p.elt(bt),Mt=bt>0?p.elt(bt-1):ot),G=0,ot.equalsApprox(Mt)){let Gt,lt;N>=0?(Gt=N>0?p.elt(N-1):ot,lt=N<m-2?p.elt(N+2):Mt):(Gt=bt<m-1?p.elt(bt+1):ot,lt=bt>1?p.elt(bt-2):Mt);let J=Gt.distanceSquaredPoint(ot),mt=Mt.distanceSquaredPoint(lt);J>mt+10?G=N>=0?Gt.directionPoint(ot):ot.directionPoint(Gt):mt>J+10?G=N>=0?Mt.directionPoint(lt):lt.directionPoint(Mt):G=N>=0?Gt.directionPoint(lt):lt.directionPoint(Gt)}else G=N>=0?ot.directionPoint(Mt):Mt.directionPoint(ot);O!==0&&(X=u.computeAngle(F,O,G),F.Yt=X,F.ue(!0),F.Jn(!0)),K=ot.x+(Mt.x-ot.x)*C-d.x,Y=ot.y+(Mt.y-ot.y)*C-d.y}F.ht(1/0,1/0,0,0),T=F.measuredBounds;let nt=F.naturalBounds,at=0;F instanceof ut&&(at=F.strokeWidth);let tt=nt.width+at,st=nt.height+at;v.Ri(),v.Fs(-T.x,-T.y),v.tt(F.scale,F.scale),v.cs(O===0?F.angle:G,tt/2,st/2),(O===22||O===26)&&v.cs(90,tt/2,st/2),(O===23||O===27)&&v.cs(-90,tt/2,st/2),O===28&&(G>45&&G<135||G>225&&G<315)&&v.cs(-G,tt/2,st/2);let et=new z(0,0,tt,st);k.setRectSpot(et,R),v.gt(k);let ct=-k.x+at/2*F.scale,gt=-k.y+at/2*F.scale;S.a(B);let wt=isNaN(B.x),Ct=isNaN(B.y);if(wt||Ct){let ot=tt/2+3,Mt=st/2+3,bt=G>=45&&G<=135,Gt=G>=225&&G<=315;O===0&&(bt||Gt)?(S.x=Ct?ot:B.y,S.y=wt?Mt:B.x,bt?N>=0||isNaN(N)&&C<.5||wt&&(S.y=-Mt):Gt&&((N>=0||isNaN(N)&&C<.5)&&wt&&(S.y=-Mt),Ct&&(S.x=-ot))):(wt&&(N>=0||isNaN(N)&&C<.5?S.x=ot:S.x=-ot),Ct&&(S.y=-Mt),S.rotate(G))}else S.rotate(G);K+=S.x,Y+=S.y,et.i(K+ct,Y+gt,T.width,T.height),b.push(et),g.unionRect(et)}if(h!==null){let M=h.labelNodes;for(;M.next();)M.value.ht(1/0,1/0)}t.Bo=g,t.position.i(d.x+g.x,d.y+g.y),n.Fn(g.width||0,g.height||0),Pt.e(v),P.e(k),P.e(S)}arrange(t,e,i){let s=e.length;if(!(t instanceof St||t instanceof _))return;let n=t,o=null;t instanceof St&&(o=t,n=o.adornedPart);let r=t,a=t instanceof St?null:n.path,h=t.hf;if(h.length!==0){let d=0;if(a!==null&&d<h.length){let g=h[d];d++,a.Bt(g.x-r.Bo.x,g.y-r.Bo.y,g.width,g.height)}for(let g=0;g<s;g++){let p=e[g];if(p!==a&&d<h.length){let m=h[d];d++,p.Bt(m.x-r.Bo.x,m.y-r.Bo.y,m.width,m.height)}}}let l=n.points,u=l.count;if(u>=2&&r instanceof _){let d=r.labelNodes;for(;d.next();){let g=d.value;r.bv(g,u,l)}}o!==null?o.sd(!1):n.sd(!1);let c=t.IA(P.l());t.location.i(t.position.x+c.x,t.position.y+c.y),P.e(c)}measureLinkPath(t,e,i,s){if(s.To()===!1)return;let n=s.strokeWidth;if(n===0&&t instanceof St&&t.type===H.Link&&t.adornedObject instanceof ut&&(n=t.adornedObject.strokeWidth),n=n*s.tt,t instanceof _&&t.ot!==null){let o=t.geometry.bounds;s.Wn(o.x-n/2,o.y-n/2,o.width+n,o.height+n)}else if(t instanceof St&&t.adornedPart.ot!==null){let o=t.adornedPart.ot.bounds;s.Wn(o.x-n/2,o.y-n/2,o.width+n,o.height+n)}else s.Wn(-(n/2),-(n/2),e+n,i+n);s.kv(),s.ue(!1)}}Ft.dn("Link",new dr);class fr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=t.findMainElement();t.Ge=[];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,g=c.height,p=Math.max(d+l,0),m=Math.max(g+u,0),y=new z(-h.left,-h.top,p,m);t.Ge.push(y),n.a(y),this.determineGraduatedMarks(t,a);let w=t.xs;if(w===null)return;let b=s.length;for(let v=0;v<b;v++){let k=s[v],S=w[v];!k.visible||k===a||S.length===0||(k instanceof ut?this.measureGraduatedTicks(t,k,S,n):k instanceof xt&&this.measureGraduatedLabels(t,k,S,n),k.ue(!1))}}arrange(t,e,i){if(t.Ge===null)return;let s=t.findMainElement(),n=t.xs;if(n===null)return;let o=t.Ge,r=0,a=o[r];r++,s!==null&&s.Bt(a.x-i.x,a.y-i.y,a.width,a.height);let h=e.length;for(let l=0;l<h;l++){let u=e[l],c=n[l];!u.visible||u===s||c.length===0||(a=o[r],r++,u.Bt(a.x-i.x,a.y-i.y,a.width,a.height))}t.Ge=null}measureGraduatedTicks(t,e,i,s){let n=e.alignmentFocus;n.isNoSpot()&&(n=D.TopCenter);let o=e.angle;e.Yt=0,e.ht(1/0,1/0,0,0),e.Yt=o;let r=e.measuredBounds,a=r.width,h=r.height,l=z.V(0,0,a,h),u=P.l();u.setRectSpot(l,n),z.e(l);let c=-u.x,d=-u.y,g=new z,p=i.length;for(let m=0;m<p;m++){let y=i[m],w=y.pt.x,b=y.pt.y,v=y.angle;for(let k=0;k<4;k++){switch(k){case 0:u.i(c,d);break;case 1:u.i(c+a,d);break;case 2:u.i(c,d+h);break;case 3:u.i(c+a,d+h);break}u.rotate(v+e.angle),u.offset(w,b),m===0&&k===0?g.i(u.x,u.y,0,0):g.unionPoint(u),u.offset(-w,-b),u.rotate(-v-e.angle)}}P.e(u),t.Ge!==null&&t.Ge.push(g),s.unionNoCheck(g.x,g.y,g.width,g.height)}measureGraduatedLabels(t,e,i,s){t.Pe===null&&(t.Pe=new xt);let n=t.Pe;this.EA(e,n);let o=e.alignmentFocus;o.isNoSpot()&&(o=D.TopCenter);let r=e.segmentOrientation,a=e.segmentOffset,h=new z,l=0,u=0,c=0,d=0,g=0,p=i.length;for(let m=0;m<p;m++){let y=i[m];l=y.pt.x,u=y.pt.y,c=y.angle,d=e.angle,g=e.angle,r!==0&&(r===21||r===25?g=c+e.angle:g=c,d=_.computeAngle(r,g)),n.Yt=d,n.text=y.text||"",n.ht(1/0,1/0,0,0);let w=n.measuredBounds,b=n.naturalBounds,v=b.width,k=b.height,S=Pt.l();S.Ri(),S.Fs(-w.x,-w.y),S.tt(n.scale,n.scale),S.cs(g,v/2,k/2),(r===22||r===26)&&S.cs(90,v/2,k/2),(r===23||r===27)&&S.cs(-90,v/2,k/2),r===28&&(c>45&&c<135||c>225&&c<315)&&S.cs(-c,v/2,k/2);let M=z.V(0,0,v,k),F=P.l();F.setRectSpot(M,o),S.gt(F);let T=-F.x,N=-F.y,C=P.l();C.a(a),isNaN(C.x)&&(C.x=v/2+3),isNaN(C.y)&&(C.y=-(k/2+3)),C.rotate(c),l+=C.x+T,u+=C.y+N;let R=new z(l,u,w.width,w.height),O=new z(w.x,w.y,w.width,w.height),B=new z(b.x,b.y,b.width,b.height);y.labelAngle=d,y.lineCount=n.lineCount,y.lines=n.getMetrics(),y.actualBounds=R,y.measuredBounds=O,y.naturalBounds=B,m===0?h.a(R):h.unionRect(R),P.e(C),P.e(F),z.e(M),Pt.e(S)}t.Ge!==null&&t.Ge.push(h),s.unionNoCheck(h.x,h.y,h.width,h.height)}determineGraduatedMarks(t,e){let i=e.geometry,s=e.strokeWidth,n=i.flattenedSegments,o=i.flattenedLengths,r=i.flattenedTotalLength,a=n.length,h=0,l=0,u=f.et();for(let b=0;b<a;b++){let v=n[b],k=[];h=0,l=0;let S=v.length;for(let M=0;M<S;M+=2){let F=v[M],T=v[M+1];if(M===0){h=F,l=T;continue}let N=Math.atan2(T-l,F-h)*180/Math.PI;N<0&&(N+=360),k.push(N),h=F,l=T}u.push(k)}let c=this.Pv(t),d=t.C.r,g=d.length,p=0,m=0,y=r;t.xs=[];let w;for(let b=0;b<g;b++){let v=d[b];if(w=[],!v.visible||v===e){t.xs.push(w);continue}let k=Math.abs(v.interval),S=t.graduatedTickUnit;if(S*k*r/t.graduatedRange<2&&v.graduatedSkip===null){t.xs.push(w);continue}let M=o[0][0],F=0,T=0;m=r*v.graduatedStart-1e-4,y=r*v.graduatedEnd+1e-4;let N=S*k,C=t.graduatedTickBase;if(C<t.graduatedMin){let K=(t.graduatedMin-C)/N;K=K%1===0?K:Math.floor(K+1),C+=K*N}else if(C>t.graduatedMin+N){let K=Math.floor((C-t.graduatedMin)/N);C-=K*N}let R=c[b],O=C,B=t.graduatedMax*1e-6;for(let K=1;C<=t.graduatedMax+B;K++){if(this.Sv(t,C-t.graduatedTickBase,R)&&(C>t.graduatedMax&&(C=t.graduatedMax),(v.graduatedSkip===null||v instanceof xt&&!v.graduatedSkip(C,v)||v instanceof ut&&!v.graduatedSkip(C,v))&&(p=(C-t.graduatedMin)*r/t.graduatedRange,p>r&&(p=r),m<=p&&p<=y))){let Y=u[F][T],X=o[F][T];for(;F<o.length;){for(;p>M&&T<o[F].length-1;)T++,Y=u[F][T],X=o[F][T],M+=X;if(p<=M)break;F++,T=0,Y=u[F][T],X=o[F][T],M+=X}let G=n[F],nt=G[T*2],at=G[T*2+1],tt=G[T*2+2],st=G[T*2+3],et=(p-(M-X))/X,ct=new P(nt+(tt-nt)*et+s/2-i.bounds.x,at+(st-at)*et+s/2-i.bounds.y);if(ct.scale(e.scale,e.scale),Y=this.Mv(Y,et,G,u[F],T),v instanceof xt){let gt="";v.graduatedFunction!==null?(gt=v.graduatedFunction(C,v),gt=gt!=null?gt.toString():""):gt=(+C.toFixed(2)).toString(),gt!==""&&w.push({pt:ct,angle:Y,text:gt})}else w.push({pt:ct,angle:Y})}C=O+K*N}t.xs.push(w)}f.J(u)}Mv(t,e,i,s,n){if(e<.5005&&e>.4995)return t;let o=t;if(e<.5?n>0?o=s[n-1]:L.z(i[0],i[i.length-2])&&L.z(i[1],i[i.length-1])&&(o=s[s.length-1]):e>.5&&(n+1<s.length?o=s[n+1]:L.z(i[0],i[i.length-2])&&L.z(i[1],i[i.length-1])&&(o=s[0])),t!==o){let r=Math.abs(t-o);if(r>180&&(t<o?t+=360:o+=360,r=Math.abs(t-o)),e<5e-4||e>.9995)return(t+o)/2%360;if(r<10){let a=1-Math.abs(.5-e);return(t*a+o*(1-a))%360}}return t}Pv(t){if(t.ss===null){let e=[],i=t.C.r,s=i.length;for(let n=0;n<s;n++){let o=i[n],r=[];if(e.push(r),!o.visible)continue;let a=o.interval;if(!(a<0))for(let h=0;h<s;h++){if(h===n)continue;let l=i[h];if(!l.visible||o.constructor!==l.constructor)continue;let u=l.interval;u>a&&r.push(u)}}t.ss=e}return t.ss}Sv(t,e,i){let s=i.length;for(let n=0;n<s;n++){let o=i[n]*t.graduatedTickUnit,r=e%o,a=t.graduatedTickUnit*1e-6;if(r<a&&r>-a)return!1}return!0}Ui(t,e,i){let s=i.ia;i.ia=!0;let n=t.naturalBounds,o=n.width,r=n.height,a=e instanceof ce;e.save(),e.beginPath(),e.rect(-1,-1,o+1,r+1),e.clip(),e.endPath();let h=t.findMainElement();h.Ui(e,i);let l=t.getDocumentScale()*i.scale;l<=0&&(l=1);let u=h.actualBounds,c=t.C.r,d=t.xs,g=c.length;for(let p=0;p<g;p++){let m=c[p],y=d[p],w=y.length;if(!(!m.visible||m===h||y.length===0)){if(m instanceof ut){if(t.graduatedTickUnit*m.interval*h.geometry.flattenedTotalLength/t.graduatedRange*l<2&&m.graduatedSkip===null)continue;let b=m.measuredBounds,v=m.strokeWidth*m.scale,k=m.alignmentFocus;k.isNoSpot()&&(k=D.TopCenter);for(let S=0;S<w;S++){let M=y[S].pt,F=y[S].angle;this.Nv(m,M,u,F,b,v,k),m.Ui(e,i),a&&(t.svg.appendChild(m.svg),m.svg=null),m.qr.Ri()}}else if(m instanceof xt){t.Pe===null&&(t.Pe=new xt);let b=t.Pe;this.EA(m,b),b.V2=!0;for(let v=0;v<w;v++){let k=y[v];if(k.actualBounds&&k.measuredBounds&&k.naturalBounds){b.Cv(k);let S=k.actualBounds;b.Bt(S.x,S.y,S.width,S.height),this.Lv(b,u,S,k.measuredBounds,k.naturalBounds),b.Jr=m.part,b.Vs=m.panel,b.Ui(e,i),b.Vs=null,b.Jr=null,a&&(t.svg.appendChild(b.svg),b.svg=null)}}}}}i.ia=s,e.restore(),e.clearContextCache(!0)}Nv(t,e,i,s,n,o,r){let a=t.qr;a.Ri(),a.Fs(e.x+i.x,e.y+i.y),a.cs(s+t.angle,0,0),a.Fs(-n.width*r.x+r.offsetX+o/2,-n.height*r.y+r.offsetY+o/2),a.tt(t.scale,t.scale),t.Zu(!1),t.hh.set(t.qr),t.da=t.scale,t.ka(!1)}Lv(t,e,i,s,n){let o=t.qr;o.Ri(),o.Fs(i.x+e.x,i.y+e.y),o.Fs(-s.x,-s.y),t.m0(o,n.x,n.y,n.width,n.height),t.Zu(!1),t.hh.set(t.qr),t.da=t.scale,t.ka(!1)}EA(t,e){e.Av(t)}}Ft.dn("Graduated",new fr);var Dn=(x=>(x[x.Uniform=6]="Uniform",x[x.UniformToFill=7]="UniformToFill",x))(Dn||{});class H extends dt{H;C;Zt;nd;Bn;Qr;to;Bo;z2;F;od;st;yi;_t;rd;wh;Gs;constructor(t,e){if(super(),this.H=null,t===void 0)this.H=H.Position;else if(typeof t=="string"){let i=Ft.es.get(t);i!==null&&(this.H=i)}else t instanceof Ft?this.H=t:t&&(this.H=H.Position,e=t);this.H===null&&f.o("Panel type not specified or PanelLayout not loaded: "+t),this.n|=4194304|(this.H===H.Grid?1048576:0),this.C=new j,this.Zt=Lt.Rg,this.nd=D.Default,this.Bn=1,this.Qr=null,this.to="",this.Bo=new z(NaN,NaN,NaN,NaN),this.z2=null,this.F=null,this.od=6,this.yi=null,this.st=null,this._t=null,this.rd=NaN,this.wh=null,this.Gs=null,e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.H=this.H,t.Zt=this.Zt.P(),t.nd=this.nd.P(),t.Bn=this.Bn,t.to=this.to,t.Bo.a(this.Bo),this.F!==null&&(t.F=this.F.copy(t)),t.od=this.od,this.st!==null&&(t.st=this.st.copy()),this.yi!==null&&(t.yi=this.yi.copy()),t._t=this._t,t.rd=this.rd,t.wh=this.wh}vo(t){super.vo(t),t.C=this.C;let e=t.C.r,i=e.length;for(let s=0;s<i;s++){let n=e[s];n.Vs=t}t.Qr=null}copy(){let t=super.copy();if(t!==null){let e=this.C.r,i=e.length;for(let s=0;s<i;s++){let n=e[s].copy();t.Tv(n)}return t}else return null}toString(){return"Panel("+this.type.name+")#"+I.as(this)}get type(){return this.H}set type(t){let e=this.H;e!==t&&(this.H=t,this.af=this.H===H.Grid,this.c(),this.t("type",e,t))}get elements(){return this.C.iterator}get naturalBounds(){return this.zi}get padding(){return this.Zt}set padding(t){typeof t=="number"?(t<0&&f.W(t,">= 0",H,"padding"),t=new Lt(t)):(t.left<0&&f.W(t.left,">= 0",H,"padding:value.left"),t.right<0&&f.W(t.right,">= 0",H,"padding:value.right"),t.top<0&&f.W(t.top,">= 0",H,"padding:value.top"),t.bottom<0&&f.W(t.bottom,">= 0",H,"padding:value.bottom"));let e=this.Zt;e.equals(t)||(t=t.P(),this.Zt=t,this.c(),this.t("padding",e,t))}get defaultAlignment(){return this.nd}set defaultAlignment(t){let e=this.nd;e.equals(t)||(t=t.P(),this.nd=t,this.c(),this.t("defaultAlignment",e,t))}get defaultStretch(){return this.Bn}set defaultStretch(t){let e=this.Bn;e!==t&&(this.Bn=t,this.c(),this.t("defaultStretch",e,t))}get defaultSeparatorPadding(){return this.F!==null?this.F.$0:Lt.Rg}set defaultSeparatorPadding(t){typeof t=="number"&&(t=new Lt(t));let e=this.defaultSeparatorPadding;e.equals(t)||(t=t.P(),this.F===null&&(this.F=new le),this.F.$0=t,this.c(),this.t("defaultSeparatorPadding",e,t))}get defaultRowSeparatorStroke(){return this.F!==null?this.F.Z0:null}set defaultRowSeparatorStroke(t){let e=this.defaultRowSeparatorStroke;e!==t&&(t===null||typeof t=="string"||t instanceof E)&&(t instanceof E&&t.u(),this.F===null&&(this.F=new le),this.F.Z0=t,this.S(),this.t("defaultRowSeparatorStroke",e,t))}get defaultRowSeparatorStrokeWidth(){return this.F!==null?this.F.Q0:1}set defaultRowSeparatorStrokeWidth(t){let e=this.defaultRowSeparatorStrokeWidth;e!==t&&isFinite(t)&&t>=0&&(this.F===null&&(this.F=new le),this.F.Q0=t,this.c(),this.t("defaultRowSeparatorStrokeWidth",e,t))}get defaultRowSeparatorDashArray(){return this.F!==null?this.F._0:null}set defaultRowSeparatorDashArray(t){let e=this.defaultRowSeparatorDashArray;if(e!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",H,"defaultRowSeparatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&f.o("defaultRowSeparatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.F===null&&(this.F=new le),this.F._0=t,this.S(),this.t("defaultRowSeparatorDashArray",e,t)}}get defaultColumnSeparatorStroke(){return this.F!==null?this.F.tp:null}set defaultColumnSeparatorStroke(t){let e=this.defaultColumnSeparatorStroke;e!==t&&(t===null||typeof t=="string"||t instanceof E)&&(t instanceof E&&t.u(),this.F===null&&(this.F=new le),this.F.tp=t,this.S(),this.t("defaultColumnSeparatorStroke",e,t))}get defaultColumnSeparatorStrokeWidth(){return this.F!==null?this.F.ip:1}set defaultColumnSeparatorStrokeWidth(t){let e=this.defaultColumnSeparatorStrokeWidth;e!==t&&isFinite(t)&&t>=0&&(this.F===null&&(this.F=new le),this.F.ip=t,this.c(),this.t("defaultColumnSeparatorStrokeWidth",e,t))}get defaultColumnSeparatorDashArray(){return this.F!==null?this.F.ep:null}set defaultColumnSeparatorDashArray(t){let e=this.defaultColumnSeparatorDashArray;if(e!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",H,"defaultColumnSeparatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&f.o("defaultColumnSeparatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.F===null&&(this.F=new le),this.F.ep=t,this.S(),this.t("defaultColumnSeparatorDashArray",e,t)}}get yh(){return this.F!==null?this.F.yh:null}set yh(t){this.F===null&&(this.F=new le),this.F.yh=t}get viewboxStretch(){return this.od}set viewboxStretch(t){let e=this.od;e!==t&&(this.od=t,this.c(),this.t("viewboxStretch",e,t))}get gridCellSize(){return this.yi!==null?this.yi.ld:Q.wC}set gridCellSize(t){this.yi===null&&(this.yi=new gi);let e=this.yi.ld;if(!e.equals(t)){(!t.isReal()||t.width===0||t.height===0)&&f.o("Invalid Panel.gridCellSize: "+t),this.yi.ld=t.P();let i=this.diagram;i!==null&&this===i.grid&&i.th(),this.S(),this.t("gridCellSize",e,t)}}get gridOrigin(){return this.yi!==null?this.yi.hd:P.xo}set gridOrigin(t){this.yi===null&&(this.yi=new gi);let e=this.yi.hd;if(!e.equals(t)){t.isReal()||f.o("Invalid Panel.gridOrigin: "+t),this.yi.hd=t.P();let i=this.diagram;i!==null&&this===i.grid&&i.th(),this.S(),this.t("gridOrigin",e,t)}}get graduatedMin(){return this.st!==null?this.st.sp:0}set graduatedMin(t){let e=this.graduatedMin;if(e!==t&&(this.st===null&&(this.st=new Re),this.st.sp=t,this.c(),this.t("graduatedMin",e,t),this.Wc())){let i=this.part;i!==null&&this.ba(i,"graduatedRange")}}get graduatedMax(){return this.st!==null?this.st.np:100}set graduatedMax(t){let e=this.graduatedMax;if(e!==t&&(this.st===null&&(this.st=new Re),this.st.np=t,this.c(),this.t("graduatedMax",e,t),this.Wc())){let i=this.part;i!==null&&this.ba(i,"graduatedRange")}}get graduatedRange(){return this.graduatedMax-this.graduatedMin}get graduatedTickUnit(){return this.st!==null?this.st.op:10}set graduatedTickUnit(t){let e=this.graduatedTickUnit;e!==t&&t>0&&(this.st===null&&(this.st=new Re),this.st.op=t,this.c(),this.t("graduatedTickUnit",e,t))}get graduatedTickBase(){return this.st!==null?this.st.rp:0}set graduatedTickBase(t){let e=this.graduatedTickBase;e!==t&&(this.st===null&&(this.st=new Re),this.st.rp=t,this.c(),this.t("graduatedTickBase",e,t))}get xs(){return this.st!==null?this.st.xs:null}set xs(t){this.st!==null?this.st.xs=t:t!==null&&(this.st=new Re,this.st.xs=t)}get Ge(){return this.st!==null?this.st.Ge:null}set Ge(t){this.st!==null?this.st.Ge=t:t!==null&&(this.st=new Re,this.st.Ge=t)}get ss(){return this.st!==null?this.st.ss:null}set ss(t){this.st!==null?this.st.ss=t:t!==null&&(this.st=new Re,this.st.ss=t)}get Pe(){return this.st!==null?this.st.Pe:null}set Pe(t){this.st!==null?this.st.Pe=t:t!==null&&(this.st=new Re,this.st.Pe=t)}x0(t){super.x0(t);let e=this.C.r,i=e.length;for(let s=0;s<i;s++)e[s].x0(t)}gh(t,e){if(this.H===H.Grid){t.commitTransform(),this.H.Ui(this,t,e);return}if(this.H===H.Graduated){t.commitTransform(),this.H.Ui(this,t,e);return}if(this.H===H.Table)if(t.commitTransform(),t instanceof ce){let r=t.currentElement;t.currentElement=t.newGroup2("gojs-ts"),this.X2(t,e),t.endGroup(),t.currentElement=r}else this.X2(t,e);let i=this.isClipping&&this.H===H.Spot;i&&t.save();let s=this.findMainElement(),n=this.C.r,o=n.length;for(let r=0;r<o;r++){let a=n[r];i&&a===s&&(t.clipInsteadOfFill=!0),a.Ui(t,e),i&&a===s&&(t.clipInsteadOfFill=!1)}i&&(t.restore(),t.clearContextCache(!0))}X2(t,e){t.lineCap="butt";let i=this.rowCount>0?this.Xe:null,s=this.columnCount>0?this.Ye:null;i!==null&&this.t1(t,e,!0,i,!0),s!==null&&this.t1(t,e,!1,s,!0),i!==null&&this.UA(t,!0,i),s!==null&&this.UA(t,!1,s),i!==null&&this.t1(t,e,!0,i,!1),s!==null&&this.t1(t,e,!1,s,!1)}UA(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.rn(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 g=h.position+l;e?g>o.height&&(l-=g-o.height):g>o.width&&(l-=g-o.width);let p=h.position+l/2;t.lineWidth=l;let m=this.Zt;if(e){p+=m.top;let y=m.left,w=o.width-m.right;t.moveTo(y,p),t.lineTo(w,p)}else{p+=m.left;let y=m.top,w=o.height-m.bottom;t.moveTo(p,y),t.lineTo(p,w)}t.stroke(),t.endPath(),c&&t.disableDash()}}t1(t,e,i,s,n){let o=s.length,r=this.actualBounds,a=this.naturalBounds,h=this.BA(!0),l=this.BA(!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 g=c.computeEffectiveSpacing(),p=c.separatorStrokeWidth;isNaN(p)&&(p=i?this.defaultRowSeparatorStrokeWidth:this.defaultColumnSeparatorStrokeWidth);let m=c.separatorStroke;m===null&&(m=i?this.defaultRowSeparatorStroke:this.defaultColumnSeparatorStroke),(m===null||c.index===(i?h:l))&&(p=0),g-=p;let y=c.position+p,w=g+c.actual;if(y+w>d&&(w=d-y),w<=0)continue;let b=this.Zt;this.rn(t,c.background,!0,!1,a,r),i?t.fillRect(b.left,y+b.top,r.width-(b.left+b.right),w):t.fillRect(y+b.left,b.top,w,r.height-(b.top+b.bottom))}}BA(t){let e=t?this.rowCount:this.columnCount;for(let i=0;i<e;i++){let s=t?this.Xe[i]:this.Ye[i];if(s!==void 0)return s.index}return 0}Qc(){let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].Qc();this.Ve(!0)}Zc(t,e,i){let s=this.svg;if(s===null)return!1;if(this.type===H.Table){let r=s.getElementsByClassName("gojs-ts"),a=r.length!==0?r[0]:null;a!==null&&(a.innerHTML=""),t.currentElement=a,this.X2(t,e),t.currentElement=null}else{if(this.H===H.Grid||this.H===H.Graduated)return s.innerHTML="",s.remove(),!1;if(this.H===H.Spot&&this.isClipping)return s.innerHTML="",s.remove(),this.ah=null,this.Qc(),!1}if(!super.Zc(t,e,i))return!1;let n=this.C.r,o=n.length;for(let r=0;r<o;r++)n[r].Ui(t,e);return!0}$u(t){return!0}k0(t,e,i,s){if(!this.isClipping){if(this.Xs()&&t.partClipRect!==null){let n=t.partClipRect,o=this.C.r,r=0,a=0;for(let h=0;h<o.length;h++){if(!o[h].isVisibleObject())continue;let l=o[h].actualBounds;r=h===0?l.x:Math.min(l.x,r),a=h===0?l.y:Math.min(l.y,a)}s.setAttributeNS(null,"clip-path",`path('M ${n.x-i.x-r},${n.y-i.y-a} l ${n.width} 0 l 0 ${n.height} l -${n.width} 0 z')`);return}super.k0(t,e,i,s)}}Jc(t,e,i,s,n){let o=this.an(),r=this.T,a=1/(r.m11*r.m22-r.m12*r.m21),h=r.m22*a,l=-r.m12*a,u=-r.m21*a,c=r.m11*a,d=a*(r.m21*r.dy-r.m22*r.dx),g=a*(r.m12*r.dx-r.m11*r.dy);if(this.background!==null){let p=t*h+e*u+d,m=t*l+e*c+g,y=i*h+s*u+d,w=i*l+s*c+g;n.i(0,0);let b=this.naturalBounds,v=L.gl(0,0,b.width,b.height,p,m,y,w,n);return n.T(r),v}else{o||(h=1,l=0,u=0,c=1,d=0,g=0);let p=t*h+e*u+d,m=t*l+e*c+g,y=i*h+s*u+d,w=i*l+s*c+g;n.i(y,w);let b=(y-p)**2+(w-m)**2,v=!1,k=this.C.r,S=k.length,M=P.l(),F=null,T=1/0,N=null,C=this.isClipping&&this.H===H.Spot;C&&(N=P.l(),F=this.findMainElement(),v=F.Jc(p,m,y,w,N),v&&(T=(p-N.x)**2+(m-N.y)**2));for(let R=0;R<S;R++){let O=k[R];if(!O.visible||O===F||!O.Jc(p,m,y,w,M))continue;v=!0;let B=(p-M.x)**2+(m-M.y)**2;B<b&&(b=B,n.set(M))}return C&&(T>b&&n.set(N),P.e(N)),P.e(M),o&&n.T(r),v}}Au(){let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].Au();super.Au()}c(t){if(this.To())return;super.c(t);let e=null;(this.H===H.Auto||this.H===H.Link)&&(e=this.findMainElement());let i=this.C.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];if((o===e||o.isPanelMain)&&o.c(!0),o.desiredSize.isReal())continue;let r=o.zs(!1);!(o instanceof ve)&&!(o instanceof H)&&!(o instanceof xt)&&r===0||o.c(!0)}}tf(){if(this.To())return;this.ue(!0),this.Jn(!0);let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].tf()}$c(){if(this.Kb()===!1){this.Zu(!0),this.ka(!0);let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].P2()}}P2(){this.ka(!0);let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].P2()}Wu(t,e,i,s){let n=this.Bo;n.i(0,0,0,0);let o=this.desiredSize,r=this.minSize;i===void 0&&(i=r.width,s=r.height),i=Math.max(i,r.width),s=Math.max(s,r.height);let a=this.maxSize;isNaN(o.width)||(t=Math.min(o.width,a.width)),isNaN(o.height)||(e=Math.min(o.height,a.height)),t=Math.max(i,t),e=Math.max(s,e);let h=this.Zt;t=Math.max(t-h.left-h.right,0),e=Math.max(e-h.top-h.bottom,0);let l=this.C.r;this.H.measure(this,t,e,l,n,i,s);let 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.Fn(u,c),this.naturalBounds.Fn(u,c),this.Wn(0,0,u,c)}findMainElement(){if(this.Qr===null){let t=this.C.r,e=t.length;if(e===0)return null;for(let i=0;i<e;i++){let s=t[i];if(s.isPanelMain===!0)return this.Qr=s,s}this.Qr=t[0]}return this.Qr}Uo(){return this.part!==null?this.part.locationObject:null}get panelLayoutState(){return this.z2}set panelLayoutState(t){this.z2=t}uh(t,e,i,s){let n=this.C.r;if(this.actualBounds.i(t,e,i,s),!this.desiredSize.isReal()){let o=this.zs(!0),r=this.measuredBounds,a=r.width,h=r.height,l=this.Wr,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.c(),this.ht(a>i?i:a,h>s?s:h,0,0));break;case 2:this.c(!0),this.ht(i+u,s+c,0,0);break;case 5:this.c(!0),this.ht(i+u,h+c,0,0);break;case 4:this.c(!0),this.ht(a+u,s+c,0,0);break}}this.H.arrange(this,n,this.Bo)}fh(t){let e=this.naturalBounds,i=this.Uo();if(z.contains(0,0,e.width,e.height,t.x,t.y)){let s=this.C.r,n=s.length,o=P.V(0,0);for(let r=n;r--;){let a=s[r];if(!(!a.visible&&a!==i)&&(o.set(t).Oe(a.T),a.containsPoint(o)))return P.e(o),!0}return P.e(o),this.Lt!==null}return!1}g0(t){if(this.Hn===t)return this;let e=this.C.r,i=e.length;for(let s=0;s<i;s++){let n=e[s].g0(t);if(n!==null)return n}return null}walkVisualTreeFrom(t,e){if(e(this,t),t instanceof H){let i=t.C.r,s=i.length;for(let n=0;n<s;n++)this.walkVisualTreeFrom(i[n],e)}}Gr(t){this.VA(this,t)}VA(t,e){e(t);let i=t.C.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];o instanceof H&&this.VA(o,e)}}Dv(t){this.zA(this,t)}zA(t,e){if(e(t),t instanceof H){let i=t.C.r,s=i.length;for(let n=0;n<s;n++)this.zA(i[n],e)}}findInVisualTree(t){return this.XA(this,t)}XA(t,e){if(e(t))return t;if(t instanceof H){let i=t.C.r,s=i.length;for(let n=0;n<s;n++){let o=this.XA(i[n],e);if(o!==null)return o}}return null}findObject(t){if(this.name===t)return this;let e=this.C.r,i=e.length;this.Fv()&&(i=this.lp());for(let s=0;s<i;s++){let n=e[s];if(n instanceof H){let o=n.findObject(t);if(o!==null)return o}if(n.name===t)return n}return null}YA(){let t=this.C.r,e=t.length,i=0;for(let s=0;s<e;s++){let n=t[s];n instanceof H?i=Math.max(i,n.YA()):n instanceof ut&&(i=Math.max(i,n.Rv()))}return i}an(){return!(this.type===H.TableRow||this.type===H.TableColumn)}$r(){return this.type===H.TableRow||this.type===H.TableColumn}bL(t,e,i){if(this.pickable===!1||(e===void 0&&(e=null),i===void 0&&(i=null),this._e()))return null;let s=this.naturalBounds,n=1/this.getDocumentScale(),o=this.an(),r=o?t:P.V(t.x,t.y).Oe(this.T),a=this.diagram,h=10,l=5;if(a!==null&&(h=a.getInputOption("extraTouchArea"),l=h/2),z.contains(-(l*n),-(l*n),s.width+h*n,s.height+h*n,r.x,r.y)){if(!this.af){let c=this.C.r,d=c.length,g=P.l(),p=this.isClipping&&this.H===H.Spot,m=p?this.findMainElement():null;if(p&&(m.an()?g.set(t).Oe(m.T):g.set(t),!m.containsPoint(g)))return P.e(g),o||P.e(r),null;let y=this.Uo();for(let w=d;w--;){let b=c[w];if(!b.visible&&b!==y||(b.an()?g.set(t).Oe(b.T):g.set(t),p&&b===m))continue;let v=null;if(b instanceof H?v=b.bL(g,e,i):b.pickable===!0&&b.containsPoint(g)&&(v=b),v!==null&&(e!==null&&(v=e(v)),v!==null&&(i===null||i(v))))return P.e(g),o||P.e(r),v}P.e(g)}if(this.background===null)return o||P.e(r),null;let u=z.contains(0,0,s.width,s.height,r.x,r.y)?this:null;return o||P.e(r),u}return o||P.e(r),null}kL(t,e,i,s){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);let n=this.naturalBounds,o=this.an(),r=o?t:P.V(t.x,t.y).Oe(this.T),a=this.$r(),h=z.contains(0,0,n.width,n.height,r.x,r.y);if(a||h){if(!this.af){let l=this.C.r,u=l.length,c=P.l(),d=this.Uo();for(let g=u;g--;){let p=l[g];if(!p.visible&&p!==d)continue;p.an()?c.set(t).Oe(p.T):c.set(t);let m=p,y=p instanceof H?p:null;if(y!==null?y.kL(c,e,i,s):m.containsPoint(c)){if(m.pickable===!1)continue;e!==null&&(m=e(m)),m!==null&&(i===null||i(m))&&s.add(m)}}P.e(c)}return o||P.e(r),h&&this.background!==null}return o||P.e(r),!1}Tm(t,e,i,s,n,o){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);let r=o;if(r===void 0&&(r=Pt.l(),r.Ri()),r.nc(this.T),this.containedInRect(t,r))return this.Y2(e,i,n),o===void 0&&Pt.e(r),!0;if(this.intersectsRect(t,r)){if(!this.af){let a=this.Uo(),h=this.C.r,l=h.length;for(let u=l;u--;){let c=h[u];if(!c.visible&&c!==a)continue;let d=c.actualBounds,g=this.naturalBounds;if(d.x>g.width||d.y>g.height||d.x+d.width<0||d.y+d.height<0)continue;let p=c,m=c instanceof H?c:null,y=Pt.l();y.set(r),(m!==null?m.Tm(t,e,i,s,n,y):p.wA(t,s,y))&&(e!==null&&(p=e(p)),p!==null&&(i===null||i(p))&&n.add(p)),Pt.e(y)}}return o===void 0&&Pt.e(r),s}return o===void 0&&Pt.e(r),!1}Y2(t,e,i){let s=this.C.r,n=s.length;for(let o=n;o--;){let r=s[o];if(!r.visible)continue;let a=r.actualBounds,h=this.naturalBounds;if(a.x>h.width||a.y>h.height||a.x+a.width<0||a.y+a.height<0)continue;r instanceof H&&r.Y2(t,e,i);let l=r;t!==null&&(l=t(l)),l!==null&&(e===null||e(l))&&i.add(l)}}PL(t,e,i,s,n,o){if(this.pickable===!1)return!1;i===void 0&&(i=null),s===void 0&&(s=null);let r=this.naturalBounds,a=this.an(),h=a?t:P.V(t.x,t.y).Oe(this.T),l=a?e:P.V(e.x,e.y).Oe(this.T),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.e(h),P.e(l)),c){if(!this.af){let g=P.l(),p=P.l(),m=this.Uo(),y=this.C.r,w=y.length;for(let b=w;b--;){let v=y[b];if(!v.visible&&v!==m)continue;let k=v.actualBounds,S=this.naturalBounds;if(a&&(k.x>S.width||k.y>S.height||k.x+k.width<0||k.y+k.height<0))continue;if(v.an()){let T=v.T;g.set(t).Oe(T),p.set(e).Oe(T)}else g.set(t),p.set(e);let M=v,F=v instanceof H?v:null;(F!==null?F.PL(g,p,i,s,n,o):M.xA(g,p,n))&&(i!==null&&(M=i(M)),M!==null&&(s===null||s(M))&&o.add(M))}P.e(g),P.e(p)}return n?c:d}return!1}E2(t){let e=null;if(t instanceof ut){e=t.spot1,e===D.Default&&(e=null);let i=t.geometry;i!==null&&e===null&&(e=i.spot1)}return e===null&&(e=D.TopLeft),e}U2(t){let e=null;if(t instanceof ut){e=t.spot2,e===D.Default&&(e=null);let i=t.geometry;i!==null&&e===null&&(e=i.spot2)}return e===null&&(e=D.BottomRight),e}add(...t){for(let e=0;e<t.length;e++)this.insertAt(this.C.count,t[e]);return this}elt(t){return this.C.elt(t)}insertAt(t,e){e instanceof Nt&&f.o("Cannot add a Part to a Panel: "+e+"; use a Panel instead"),(this===e||this.isContainedBy(e))&&(this===e&&f.o("Cannot make a Panel contain itself: "+this.toString()),f.o("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+e.toString()));let i=e.panel;if(i!==null&&i!==this&&f.o("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+e.toString()+", already contained by "+i.toString()+", cannot be shared by this Panel: "+this.toString()),this.H===H.Grid&&!(e instanceof ut)&&f.o("Can only add Shapes to a Grid Panel, not: "+e),this.H===H.Graduated&&!(e instanceof ut||e instanceof xt)&&f.o("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+e),e.Pa(this),e.Jr=null,this.itemArray!==null){let r=e.data;f.G(r)&&(this.Gs===null&&(this.Gs=new pt),this.Gs.set(r,e))}let s=this.C,n=-1;if(i===this){let r=-1,a=this.C.r,h=a.length;for(let l=0;l<h;l++)if(a[l]===e){r=l;break}if(r!==-1){if(r===t||r+1>=s.count&&t>=s.count)return;s.removeAt(r),n=r}else f.o("element "+e.toString()+" has panel "+i.toString()+" but is not contained by it.")}(t<0||t>s.count)&&(t=s.count),s.insertAt(t,e),(t===0||e.isPanelMain)&&(this.Qr=null),this.To()||this.c(),e.c(!1),e.portId!==null?this.fn=!0:e instanceof H&&e.fn===!0&&(this.fn=!0),this.ss=null,this.isEnabledObject()||this.i1(e,!1);let o=this.part;if(o!==null){o.A0(),o.cf(),this.fn&&o instanceof rt&&(o.fn=!0),o.fn&&o instanceof rt&&(o.ne=null);let r=this.diagram;if(r!==null&&r.undoManager.isUndoingRedoing)return;n!==-1&&o.raiseChangedEvent(4,"elements",this,e,null,n,null),o.raiseChangedEvent(3,"elements",this,null,e,null,t)}}get fn(){return(this.n&8388608)!==0}set fn(t){(this.n&8388608)!==0!==t&&(this.n=this.n^8388608)}p2(){return(this.n&16777216)!==0}G2(t){t?this.n|=16777216:this.n&=-16777217}Tv(t){t.Pa(this),t.Jr=null;let e=this.C,i=e.count;e.insertAt(i,t);let s=this.part;if(s!==null){s.A0(),t.portId!==null&&s instanceof rt&&(s.fn=!0);let n=this.diagram;if(n!==null&&n.undoManager.isUndoingRedoing)return;s.raiseChangedEvent(3,"elements",this,null,t,null,i)}}ZR(t){let e=this.C.r,i=e.length,s=-1;for(let n=0;n<i;n++)if(e[n]===t){s=n;break}return s}remove(t){let e=this.C.r,i=e.length,s=-1;for(let n=0;n<i;n++)if(e[n]===t){s=n;break}s!==-1&&this.te(s,!0)}removeAt(t){t>=0&&this.te(t,!0)}te(t,e){let i=this.C,s=i.elt(t);if(s.Jr=null,s.Pa(null),this.Gs!==null){let o=s.data;f.G(o)&&this.Gs.delete(o)}i.removeAt(t),this.ue(!1),this.c(),this.Qr===s&&(this.Qr=null),this.ss=null;let n=this.part;if(n!==null){n.A0(),n.cf(),n.invalidateAdornments(),n instanceof rt&&(s instanceof H?s.walkVisualTreeFrom(s,(r,a)=>n.C2(a,e)):n.C2(s,e));let o=this.diagram;if(o!==null&&o.undoManager.isUndoingRedoing)return;n.raiseChangedEvent(4,"elements",this,s,null,t,null)}}get Xe(){return this.F===null&&(this.F=new le),this.F.Xe}get rowCount(){return this.F===null?0:this.Xe.length}getRowDefinition(t){t<0&&f.W(t,">= 0",H,"getRowDefinition:idx"),t=Math.round(t);let e=this.Xe;if(e[t]===void 0){let i=new jt;i.Pa(this),i.isRow=!0,i.index=t,e[t]=i,this.raiseChangedEvent(3,"rowdefs",this,null,i,null,t)}return e[t]}removeRowDefinition(t){if(t<0&&f.W(t,">= 0",H,"removeRowDefinition:idx"),this.rowCount===0)return;t=Math.round(t);let e=this.Xe,i=e[t];if(i){e[t]=void 0;let s=e.length-1;for(;s>=0&&e[s--]===void 0;)e.length--;this.raiseChangedEvent(4,"rowdefs",this,i,null,t,null),this.c()}}$L(t,e){let i=this.Xe;if(!(t<0)){if(i[t]=e instanceof jt?e:void 0,!e){let s=i.length-1;for(;s>=0&&i[s--]===void 0;)i.length--}this.c()}}get Ye(){return this.F===null&&(this.F=new le),this.F.Ye}get columnCount(){return this.F===null?0:this.Ye.length}getColumnDefinition(t){t<0&&f.W(t,">= 0",H,"getColumnDefinition:idx"),t=Math.round(t);let e=this.Ye;if(e[t]===void 0){let i=new jt;i.Pa(this),i.isRow=!1,i.index=t,e[t]=i,this.raiseChangedEvent(3,"coldefs",this,null,i,null,t)}return e[t]}removeColumnDefinition(t){if(t<0&&f.W(t,">= 0",H,"removeColumnDefinition:idx"),this.columnCount===0)return;t=Math.round(t);let e=this.Ye,i=e[t];if(i){e[t]=void 0;let s=e.length-1;for(;s>=0&&e[s--]===void 0;)e.length--;this.raiseChangedEvent(4,"coldefs",this,i,null,t,null),this.c()}}ZL(t,e){let i=this.Ye;if(!(t<0)){if(i[t]=e instanceof jt?e:void 0,!e){let s=i.length-1;for(;s>=0&&i[s--]===void 0;)i.length--}this.c()}}addRowColumnDefinition(t){let e=null;return t.isRow?e=this.getRowDefinition(t.index):t.isRow||(e=this.getColumnDefinition(t.index)),e&&e.Hb(t),this}addRowDefinition(t,e){let i=this.getRowDefinition(t);return i&&i.Hb(new jt(e)),this}addColumnDefinition(t,e){let i=this.getColumnDefinition(t);return i&&i.Hb(new jt(e)),this}get rowSizing(){return this.F!==null?this.F.hp:3}set rowSizing(t){let e=this.rowSizing;e!==t&&(this.F===null&&(this.F=new le),this.F.hp=t,this.c(),this.t("rowSizing",e,t))}get columnSizing(){return this.F!==null?this.F.ap:3}set columnSizing(t){let e=this.columnSizing;e!==t&&(this.F===null&&(this.F=new le),this.F.ap=t,this.c(),this.t("columnSizing",e,t))}get topIndex(){return this.F!==null?this.F.cp:0}set topIndex(t){let e=this.topIndex;e!==t&&((!isFinite(t)||t<0)&&f.o("Panel.topIndex must be greater than zero and a real number, not: "+t),this.F===null&&(this.F=new le),this.F.cp=t,this.c(),this.t("topIndex",e,t))}get leftIndex(){return this.F!==null?this.F.fp:0}set leftIndex(t){let e=this.leftIndex;e!==t&&((!isFinite(t)||t<0)&&f.o("Panel.leftIndex must be greater than zero and a real number, not: "+t),this.F===null&&(this.F=new le),this.F.fp=t,this.c(),this.t("leftIndex",e,t))}findRowForLocalY(t){if(t<0||this.type!==H.Table||this.rowCount===0)return-1;let e=0,i=this.Xe,s=i.length,n=this.topIndex;for(;n<s;n++){let o=i[n];if(o!==void 0&&(e+=o.total,t<e))return n}return n}findColumnForLocalX(t){if(t<0||this.type!==H.Table||this.columnCount===0)return-1;let e=0,i=this.Ye,s=i.length,n=this.leftIndex;for(;n<s;n++){let o=i[n];if(o!==void 0&&(e+=o.total,t<e))return n}return n}graduatedPointForValue(t,e){if(e===void 0&&(e=new P(NaN,NaN)),this.type!==H.Graduated)return e.i(NaN,NaN),e;t=Math.min(Math.max(t,this.graduatedMin),this.graduatedMax);let i=this.findMainElement();return i.geometry.getPointAlongPath((t-this.graduatedMin)/this.graduatedRange,e),i.T.gt(e)}graduatedValueForPoint(t){if(this.type!==H.Graduated)return NaN;let e=this.findMainElement();return e.T.$e(t),e.geometry.getFractionForPoint(t)*this.graduatedRange+this.graduatedMin}get data(){return this._t}set data(t){let e=this._t;if(e!==t){let i=this instanceof Nt&&!(this instanceof St);i&&f.s(t,"object",H,"data"),this.Et(),this._t=t;let s=this.diagram;if(s!==null)if(i)s.partManager.vv(this,e,t);else{let n=this.panel;n!==null&&n.Gs!==null&&(e!==null&&n.Gs.delete(e),t!==null&&n.Gs.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 Ys(){return this.p!==null?this.p.Ys:null}set Ys(t){this.Ci!==t&&(this.p===null&&(this.p=new oi),this.p.Ys=t)}L2(){return this.Ys!==null}AA(){let t=this.Ys;return t!==null&&t.h}freezeBindings(){return this.Et()}Et(){let t=this.Ys;if(t===null)this.data!==null&&f.o("Template cannot have .data be non-null: "+this),this.Ys=t=new j;else if(t.h)return this;let e=new j;this.G2(!1),this.walkVisualTreeFrom(this,(n,o)=>{o.ch();let r=o.Ci;if(r!==null){o.S2(!1);let a=r.iterator;for(;a.next();){let h=a.value;h.mode===2&&o.S2(!0);let l=h.sourceName;if(h.isToObject){l==="/"&&n.G2(!0);let u=h.yA(n,o);u!==null&&(e.add(u),u.qn===null&&(u.qn=new j),u.qn.add(h))}t.add(h)}}if(o instanceof H&&o.type===H.Table){if(o.rowCount>0){let a=o.Xe,h=a.length;for(let l=0;l<h;l++){let u=a[l];if(u!==void 0&&u.bs!==null){let c=u.bs.iterator;for(;c.next();){let d=c.value;d.be=u,d.ad=2,d.ff=u.index,t.add(d)}}}}if(o.columnCount>0){let a=o.Ye,h=a.length;for(let l=0;l<h;l++){let u=a[l];if(u!==void 0&&u.bs!==null){let c=u.bs.iterator;for(;c.next();){let d=c.value;d.be=u,d.ad=1,d.ff=u.index,t.add(d)}}}}}});let i=e.iterator;for(;i.next();){let n=i.value;if(n.qn!==null){n.S2(!0);let o=n.qn.iterator;for(;o.next();){let r=o.value;n.Ci===null&&(n.Ci=new j),n.Ci.add(r)}}n.qn=null}let s=t.iterator;for(;s.next();){let n=s.value,o=n.be;if(o!==null){n.be=null;let r=n.targetProperty,a=r.indexOf(".");if(a>0&&o instanceof H){let h=r.substring(0,a),l=r.substring(a+1),u=o.findObject(h);u!==null?(o=u,n.targetProperty=l):(f.ni('Warning: unable to find GraphObject named "'+h+'" for Binding: '+n.toString()),o=null)}if(o instanceof jt){let h=I.as(o.panel);n.targetId=h===void 0?-1:h,o.panel.Hn=n.targetId}else if(o instanceof dt){let h=I.as(o);n.targetId=h===void 0?-1:h,o.Hn=n.targetId}else f.o("Unknown type of binding target: "+o);n.check(o)}}return t.u(),this instanceof Nt&&this.ke()&&this.ensureBounds(),this}static FE=!1;copyTemplate(t){t===void 0&&(t=!1);let e=this.copy();return e.Dv(i=>{i instanceof H&&(i.Ys=null,i._t=null);let s=i.Ci;s!==null&&(i.Ci=null,s.each(o=>i.bind(o.copy())));let n=i.ws;n!==null&&(i.ws=null,n.each(o=>i.trigger(o.value.copy())))}),t&&e.Et(),e}updateTargetBindings(t){let e=this.Ys;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.GA(n,t);if(o===null)continue;let{data:r,elt:a}=o;n.isToTheme&&this.diagram===null||a!==void 0&&n.updateTarget(a,r,void 0,i)}}Do(){if(this.diagram!==null)if(this.L2()){let t=this.diagram.model,e=this.Ys.iterator;for(;e.next();){let i=e.value;if(!i.isToTheme)continue;let s=this.GA(i);if(s===null)continue;let{data:n,elt:o}=s;o!==void 0&&i.updateTarget(o,n,void 0,t)}}else{let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].Do()}}GA(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.pA(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.g0(a),r===null)return null}else t.be!==null&&(r=t.be);o==="/"?n=r.part:o==="."?n=r:o===".."&&(n=r.panel);let h=t.ad;if(h!==0){if(!(r instanceof H))return null;h===1?r=r.getColumnDefinition(t.ff):h===2&&(r=r.getRowDefinition(t.ff))}return{data:n,elt:r}}get itemArray(){return this.wh}set itemArray(t){let e=this.wh;if(e!==t||t!==null&&this.Ov(t)){let i=this.diagram;if(e!==t&&(i!==null&&e!==null&&i.partManager.EM(this,i),this.wh=t,i!==null&&t!==null&&i.partManager.IM(this,i)),this.t("itemArray",e,t),i!==null&&i.undoManager.isUndoingRedoing)return;this.KA(e,t)}}findItemPanelForData(t){return t==null||this.Gs===null?null:(f.ec(t,H,"findItemPanelForData"),this.Gs.get(t))}Ov(t){let e=this.C.r,i=e.length,s=t.length,n=0,o=null;for(;n<i&&(o=e[n],!(o instanceof H)||o.data===null);)n++,o=e[n];if(i-n!==s)return!0;if(o===null)return s>0;let r=0;for(;n<i&&r<s;){if(o=e[n],!(o instanceof H)||o.data!==t[r])return!0;n++,r++}return!1}lp(){if(this.type===H.Spot||this.type===H.Auto)return Math.min(this.C.length,1);if(this.type===H.Link){let t=this.C,e=t.length,i=0;for(;i<e;i++){let s=t.elt(i);if(!(s instanceof ut)||!s.isPanelMain)return i}return i}if(this.type===H.Table&&this.C.length>0){let t=this.C.elt(0);if(t.isPanelMain&&t instanceof H&&t.$r())return 1}return 0}rebuildItemElements(){let t=this.lp();for(;this.C.length>t;)this.te(this.C.length-1,!1);this.KA(null,this.itemArray)}KA(t,e){let i=this.lp(),s=e;if(s===null||s.length===0){for(;this.C.length>i;)this.te(this.C.length-1,!1);return}if(this.C.length<=i){let n=s.length;for(let o=0;o<n;o++)this.e1(s[o],o,!0)}else{let n=i;for(let r=0;r<s.length;r++,n++){let a=s[r],h=n<this.C.length?this.C.elt(n):null;if(h instanceof H){if(h.data!==a){let l=this.K2(h.data,r),u=this.K2(a,r),c=u!==l;if(!c){let d=this.j2(h.data,r,l);c=this.j2(a,r,u)!==d}c?(this.te(n,!1),this.e1(a,r,!1)):h.data=a}}else this.e1(a,r,!1)}for(;n<this.C.length;)this.te(n,!1);this.Qr=null,this.H2(i,0),this.To()||this.c(),this.ss=null,this.isEnabledObject()||this.i1(this,!1);let o=this.part;o!==null&&(o.A0(),o.cf(),this.fn&&o instanceof rt&&(o.fn=!0),o.fn&&o instanceof rt&&(o.ne=null))}}e1(t,e,i){if(t==null||e<0)return null;let s=this.K2(t,e),n=this.j2(t,e,s);if(n!==null){n.Et();let o=n.copy();if(o.p2()){let a=this.findBindingPanel();a!==null&&a.G2(!0)}f.G(t)&&(this.Gs===null&&(this.Gs=new pt),this.Gs.set(t,o));let r=e+this.lp();return this.insertAt(r,o),i&&(o._t=t,this.H2(r,e),o._t=null),o.data=t,o}return null}Iv(t){if(t<0)return;let e=t+this.lp();this.te(e,!0),this.H2(e,t)}H2(t,e){let i=this.C,s=t,n=e;for(;s<i.length;){let o=i.elt(s);o instanceof H&&o.Ev(s,n),s++,n++}}Ev(t,e){this.type===H.TableRow?this.row=t:this.type===H.TableColumn&&(this.column=t),this.itemIndex=e}Fv(){return this.wh!==null||this.itemTemplateMap!==null}get itemTemplate(){return this.itemTemplateMap===null?null:this.itemTemplateMap.get("")}set itemTemplate(t){if(this.itemTemplateMap===null){if(t===null)return;this.itemTemplateMap=new pt}let e=this.itemTemplateMap.get("");if(e!==t){(t instanceof Nt||t.isPanelMain)&&f.o("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+t),this.itemTemplateMap.set("",t),this.t("itemTemplate",e,t);let i=this.diagram;if(i!==null&&i.undoManager.isUndoingRedoing)return;this.rebuildItemElements()}}get itemTemplateMap(){return this.p!==null?this.p.G0:null}set itemTemplateMap(t){let e=this.itemTemplateMap;if(e!==t){let i=t.iterator;for(;i.next();){let n=i.value}this.Kt().G0=t,this.t("itemTemplateMap",e,t);let s=this.diagram;if(s!==null&&s.undoManager.isUndoingRedoing)return;this.rebuildItemElements()}}get itemCategoryProperty(){return this.p!==null?this.p.K0:"category"}set itemCategoryProperty(t){let e=this.itemCategoryProperty;e!==t&&(typeof t!="string"&&!f.it(t)&&f.Zi(t,"string or function",H,"itemCategoryProperty"),this.Kt().K0=t,this.t("itemCategoryProperty",e,t))}K2(t,e){if(t===null)return"";let i=this.itemCategoryProperty,s="";if(f.it(i))s=i(t);else if(typeof i=="string"&&f.G(t)){if(i==="")return"";let n=this.diagram,o=n!==null?n.model:null;o?s=o.yt(t,i):s=yt.yt(t,i)}else return"";if(s===void 0)return"";if(typeof s=="string")return s;f.o("Panel.getCategoryForItemData found a non-string category for "+t+": "+s)}static jA=!1;static HA=null;j2(t,e,i){let s=this.itemTemplateMap,n=null;return s!==null&&(n=s.get(i)),n===null&&(s!==null&&(n=s.get("")),n===null&&(H.jA||(H.jA=!0,f.ni('No item template Panel found for category "'+i+'" on '+this),f.ni(" Using default item template."),H.HA=new H().add(new xt().bind("text","",f.toString).theme("stroke","text"))),n=H.HA)),n}get af(){return(this.n&1048576)!==0}set af(t){let e=(this.n&1048576)!==0;e!==t&&(f.s(t,"boolean",H,"isAtomic"),this.n=this.n^1048576,this.t("isAtomic",e,t))}get isClipping(){return(this.n&2097152)!==0}set isClipping(t){let e=(this.n&2097152)!==0;e!==t&&(this.Qc(),this.n=this.n^2097152,this instanceof ft&&(this.si=null),this.c(),this.t("isClipping",e,t))}get isOpposite(){return(this.n&33554432)!==0}set isOpposite(t){let e=(this.n&33554432)!==0;e!==t&&(this.n=this.n^33554432,this.c(),this.t("isOpposite",e,t))}get isEnabled(){return(this.n&4194304)!==0}set isEnabled(t){let e=(this.n&4194304)!==0;if(e!==t){let i=this.panel===null||this.panel.isEnabledObject();this.n=this.n^4194304,this.t("isEnabled",e,t);let s=this.diagram;if(s!==null&&s.undoManager.isUndoingRedoing)return;i&&this.i1(this,t)}}i1(t,e){let i=t.enabledChanged;if(i!==null&&i(t,e),t instanceof H){let s=t.C.r,n=s.length;for(let o=0;o<n;o++){let r=s[o];e&&r instanceof H&&!r.isEnabled||this.i1(r,e)}}}get alignmentFocusName(){return this.to}set alignmentFocusName(t){let e=this.to;e!==t&&(this.to=t,this.c(),this.t("alignmentFocusName",e,t))}static definePanelLayout(t,e){Ft.dn(t,e)}static isBuilderDefined(t){return Ft.es.has(t)}static Position=Ft.es.get("Position");static Horizontal=Ft.es.get("Horizontal");static Vertical=Ft.es.get("Vertical");static Spot=Ft.es.get("Spot");static Auto=Ft.es.get("Auto");static Table=Ft.es.get("Table");static Viewbox=Ft.es.get("Viewbox");static TableRow=Ft.es.get("TableRow");static TableColumn=Ft.es.get("TableColumn");static Link=Ft.es.get("Link");static Grid=Ft.es.get("Grid");static Graduated=Ft.es.get("Graduated")}H.definePanelLayout=H.definePanelLayout;class Re{sp;np;op;rp;xs;Ge;ss;Pe;constructor(){this.sp=0,this.np=100,this.op=10,this.rp=0,this.xs=null,this.Ge=null,this.ss=null,this.Pe=null}copy(){let t=new Re;return t.sp=this.sp,t.np=this.np,t.op=this.op,t.rp=this.rp,t.xs=this.xs,t.Ge=this.Ge,t.ss=this.ss,t.Pe=this.Pe,t}}class gi{ld;hd;Yc;J0;constructor(){this.ld=Q.wC,this.hd=P.xo,this.Yc=Q.ww,this.J0=[]}copy(){let t=new gi;return t.ld=this.ld.copy(),t.hd=this.hd.copy(),t.Yc=this.Yc.copy(),t.J0=this.J0,t}}class le{Xe;Ye;hp;ap;cp;fp;$0;Q0;Z0;_0;ip;tp;ep;yh;constructor(){this.Xe=[],this.Ye=[],this.hp=3,this.ap=3,this.cp=0,this.fp=0,this.$0=Lt.Rg,this.Q0=1,this.Z0=null,this._0=null,this.ip=1,this.tp=null,this.ep=null,this.yh=null}copy(t){let e=new le,i=this.Xe,s=i.length,n=e.Xe;for(let h=0;h<s;h++){if(i[h]===void 0)continue;let l=i[h].copy();l.Pa(t),n[h]=l}let o=this.Ye,r=o.length,a=e.Ye;for(let h=0;h<r;h++){if(o[h]===void 0)continue;let l=o[h].copy();l.Pa(t),a[h]=l}return e.hp=this.hp,e.ap=this.ap,e.cp=this.cp,e.fp=this.fp,e.$0=this.$0.P(),e.Q0=this.Q0,e.Z0=this.Z0,e._0=this._0,e.ip=this.ip,e.tp=this.tp,e.ep=this.ep,e.yh=this.yh,e}}var vs=(x=>(x[x.Default=1]="Default",x[x.None=2]="None",x[x.ProportionalExtra=3]="ProportionalExtra",x))(vs||{});class jt{Vs;dp;At;Ca;La;hi;at;cd;$n;_r;fd;ud;Aa;Lt;dd;bs;_;Ai;de;constructor(t){I.Ki(this),this.Vs=null,this.dp=!0,this.At=0,this.de=NaN,this.Ca=0,this.La=1/0,this.hi=D.Default,this._=0,this.Ai=0,this.at=0,this.bs=null,this.cd=1,this.$n=1,this._r=null,this.fd=null,this.ud=NaN,this.Aa=null,this.Lt=null,this.dd=!1,t&&(Object.assign(this,t),t.column!==void 0?(this.isRow=!1,this.index=t.column):t.row!==void 0&&(this.isRow=!0,this.index=t.row))}copy(){let t=new jt;return t.dp=this.dp,t.At=this.At,t.de=this.de,t.Ca=this.Ca,t.La=this.La,t.hi=this.hi,t._=this._,t.Ai=this.Ai,t.at=this.at,t.$n=this.$n,t.cd=this.cd,this._r===null?t._r=null:t._r=this._r.P(),t.fd=this.fd,t.ud=this.ud,t.Aa=null,this.Aa!==null&&(t.separatorDashArray=this.Aa.slice()),t.Lt=this.Lt,t.dd=this.dd,t.bs=this.bs,t}Hb(t){t.isRow?t.height!==void 0&&(this.height=t.height):t.width!==void 0&&(this.width=t.width),t.minimum!==void 0&&(this.minimum=t.minimum),t.maximum!==void 0&&(this.maximum=t.maximum),t.alignment!==void 0&&(this.alignment=t.alignment),t.stretch!==void 0&&(this.stretch=t.stretch),t.sizing!==void 0&&(this.sizing=t.sizing),t.separatorPadding!==void 0&&(this.separatorPadding=t.separatorPadding),t.separatorStroke!==void 0&&(this.separatorStroke=t.separatorStroke),t.separatorStrokeWidth!==void 0&&(this.separatorStrokeWidth=t.separatorStrokeWidth),t.separatorDashArray!==void 0&&(this.Aa=t.separatorDashArray),t.background!==void 0&&(this.background=t.background),t.coversSeparators!==void 0&&(this.coversSeparators=t.coversSeparators),t.bs!==void 0&&(this.bs=t.bs)}oi(t){t in vs?this.sizing=t:f.er(this,t)}toString(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+I.as(this)}static Default=1;static None=2;static ProportionalExtra=3;Pa(t){this.Vs=t}computeEffectiveSpacingTop(t){let e=0,i=this.Vs;if(this.index!==t){let n=this.separatorStroke;n===null&&i!==null&&(n=this.isRow?i.defaultRowSeparatorStroke:i.defaultColumnSeparatorStroke),n!==null&&(e=this.separatorStrokeWidth,isNaN(e)&&(i!==null?e=this.isRow?i.defaultRowSeparatorStrokeWidth:i.defaultColumnSeparatorStrokeWidth:e=0))}let s=this._r;if(s===null)if(i!==null)s=i.defaultSeparatorPadding;else return e;return e+(this.isRow?s.top:s.left)}computeEffectiveSpacing(){let t=0,e=this.Vs,i=0,s=this.isRow;if(e!==null&&e.type===H.Table){let o=s?e.Xe.length:e.Ye.length;for(let r=0;r<o;r++){let a=s?e.Xe[r]:e.Ye[r];if(a!==void 0&&a._!==0){i=a.index;break}}}if(this.index!==i){let o=this.separatorStroke;o===null&&e!==null&&(o=s?e.defaultRowSeparatorStroke:e.defaultColumnSeparatorStroke),o!==null&&(t=this.separatorStrokeWidth,isNaN(t)&&(e!==null?t=s?e.defaultRowSeparatorStrokeWidth:e.defaultColumnSeparatorStrokeWidth:t=0))}let n=this._r;if(n===null)if(e!==null)n=e.defaultSeparatorPadding;else return t;return t+(this.isRow?n.top+n.bottom:n.left+n.right)}t(t,e,i,s,n){let o=this.Vs;if(o!==null&&(o.raiseChangedEvent(2,t,this,e,i,s,n),this.bs!==null)){let r=o.diagram;if(r!==null&&!r.fe){let a=o.findBindingPanel();if(a!==null){let h=a.data;if(h!==null){let l=this.bs.iterator;for(;l.next();)l.value.updateSource(this,h,t,a)}}}}}get panel(){return this.Vs}get isRow(){return this.dp}set isRow(t){this.dp=t}get index(){return this.At}set index(t){this.At=t}get height(){return this.de}set height(t){let e=this.de;e!==t&&(t<0&&f.W(t,">= 0",jt,"height"),this.de=t,this.actual=this._,this.panel!==null&&this.panel.c(),this.t("height",e,t))}get width(){return this.de}set width(t){let e=this.de;e!==t&&(t<0&&f.W(t,">= 0",jt,"width"),this.de=t,this.actual=this._,this.panel!==null&&this.panel.c(),this.t("width",e,t))}get minimum(){return this.Ca}set minimum(t){let e=this.Ca;e!==t&&((t<0||!isFinite(t))&&f.W(t,">= 0",jt,"minimum"),this.Ca=t,this.actual=this._,this.panel!==null&&this.panel.c(),this.t("minimum",e,t))}get maximum(){return this.La}set maximum(t){let e=this.La;e!==t&&(t<0&&f.W(t,">= 0",jt,"maximum"),this.La=t,this.actual=this._,this.panel!==null&&this.panel.c(),this.t("maximum",e,t))}get alignment(){return this.hi}set alignment(t){let e=this.hi;e.equals(t)||(this.hi=t.P(),this.panel!==null&&this.panel.c(),this.t("alignment",e,t))}get stretch(){return this.$n}set stretch(t){let e=this.$n;e!==t&&(this.$n=t,this.panel!==null&&this.panel.c(),this.t("stretch",e,t))}get separatorPadding(){return this._r}set separatorPadding(t){typeof t=="number"&&(t=new Lt(t));let e=this._r;(t===null||e===null||!e.equals(t))&&(t!==null&&(t=t.P()),this._r=t,this.panel!==null&&this.panel.c(),this.t("separatorPadding",e,t))}get separatorStroke(){return this.fd}set separatorStroke(t){let e=this.fd;e!==t&&(t!==null&&E.Qu(t,"RowColumnDefinition.separatorStroke"),t instanceof E&&t.u(),this.fd=t,this.panel!==null&&this.panel.c(),this.t("separatorStroke",e,t))}get separatorStrokeWidth(){return this.ud}set separatorStrokeWidth(t){let e=this.ud;e!==t&&(this.ud=t,this.panel!==null&&this.panel.c(),this.t("separatorStrokeWidth",e,t))}get separatorDashArray(){return this.Aa}set separatorDashArray(t){let e=this.Aa;if(e!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",jt,"separatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&f.o("separatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.Aa=t,this.panel!==null&&this.panel.S(),this.t("separatorDashArray",e,t)}}get background(){return this.Lt}set background(t){let e=this.Lt;e!==t&&(t!==null&&E.Qu(t,"RowColumnDefinition.background"),t instanceof E&&t.u(),this.Lt=t,this.panel!==null&&this.panel.S(),this.t("background",e,t))}get coversSeparators(){return this.dd}set coversSeparators(t){let e=this.dd;e!==t&&(f.s(t,"boolean",jt,"coversSeparators"),this.dd=t,this.panel!==null&&this.panel.S(),this.t("coversSeparators",e,t))}get sizing(){return this.cd}set sizing(t){let e=this.cd;e!==t&&(this.cd=t,this.panel!==null&&this.panel.c(),this.t("sizing",e,t))}Qb(){if(this.sizing===1){let t=this.Vs;return this.isRow?t.rowSizing:t.columnSizing}return this.sizing}get actual(){return this._}set actual(t){isNaN(this.de)?this._=Math.max(Math.min(this.La,t),this.Ca):this._=Math.max(Math.min(this.La,this.de),this.Ca)}get measured(){return this.Ai}set measured(t){this.Ai=t}get total(){return this._+this.computeEffectiveSpacing()}get position(){return this.at}set position(t){this.at=t}bind(t,e,i,s){return this.sf(t,e,i,s),this}bindTwoWay(t,e,i,s){let n=this.sf(t,e,i,s);return s===void 0&&n.makeTwoWay(),this}theme(t,e,i,s,n){return this.mh(t,e,i,s,n),this}themeData(t,e,i,s,n){return this.mh(t,e,i,s,n).ofData(),this}themeObject(t,e,i,s,n,o){return this.mh(t,e,i,s,n).ofObject(o),this}themeModel(t,e,i,s,n){return this.mh(t,e,i,s,n).ofModel(),this}sf(t,e,i,s){let n;return typeof t=="string"?n=new oe(t,e,i,s):n=t,this.Y0(n),n}mh(t,e,i,s,n){let o;return typeof t=="string"?o=new pi(t,e,i,s,n):o=t,this.Y0(o),o}Y0(t){t.be=this;let e=this.panel;if(e!==null){let i=e.findBindingPanel();i!==null&&i.AA()&&f.o("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+t+" on "+e)}this.bs===null&&(this.bs=new j),this.bs.add(t)}}class ut extends dt{ot;ks;gd;Ta;ji;Vo;Io;jt;md;pd;K;constructor(t,e){super(),this.ot=null,this.ks=null,this.gd="None",this.Ta="black",this.ji="black",this.Vo=1,this.Io=null,this.jt=null,this.md=NaN,this.pd=NaN,this.K=null,typeof t=="string"?this.figure=t:t&&Object.assign(this,t),e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.ot=this.ot,t.ks=this.ks,t.gd=this.gd,t.Ta=this.Ta,t.ji=this.ji,t.Vo=this.Vo,this.Io!==null&&(t.Io=this.Io.slice()),this.jt!==null&&(this.jt.fi?t.jt=this.jt:t.jt=this.jt.copy()),t.md=this.md,t.pd=this.pd,this.K!==null&&(t.K=this.K.copy())}Da(){return this.jt===null?this.jt=new ks:this.jt.fi&&(this.jt=this.jt.copy()),this.jt}ch(){super.ch(),this.jt!==null&&(this.jt.fi=!0)}oi(t){t in ms?this.geometryStretch=t:super.oi(t)}toString(){return"Shape("+(this.figure!=="None"?this.figure:this.toArrow!=="None"?this.toArrow:this.fromArrow)+")#"+I.as(this)}Uv(t,e){let i=this.pathPattern;i.ht(1/0,1/0);let s=i.measuredBounds;i.Bt(0,0,s.width,s.height);let n=this.geometry;t.save(),t.beginPath();let o=f.et();if(n.type===1)o.push(n.startX),o.push(n.startY),o.push(n.endX),o.push(n.endY),this.yd(t,e,o,i);else if(n.type===4){let r=n.figures.iterator;for(;r.next();){let a=r.value;o.length=0,o.push(a.startX),o.push(a.startY);let h=a.startX,l=a.startY,u=h,c=l,d=a.segments.r,g=d.length;for(let p=0;p<g;p++){let m=d[p];switch(m.type){case 1:this.yd(t,e,o,i),o.length=0,o.push(m.endX),o.push(m.endY),h=m.endX,l=m.endY,u=h,c=l;break;case 2:o.push(m.endX),o.push(m.endY),h=m.endX,l=m.endY;break;case 3:L.vn(h,l,m.point1X,m.point1Y,m.point2X,m.point2Y,m.endX,m.endY,.5,o),h=m.endX,l=m.endY;break;case 4:L.Og(h,l,m.point1X,m.point1Y,m.endX,m.endY,.5,o),h=m.endX,l=m.endY;break;case 5:{let y=m.bo(a),w=y.length;if(w===0){o.push(m.centerX),o.push(m.centerY),h=m.centerX,l=m.centerY;break}for(let b=0;b<w;b++){let v=y[b];L.vn(h,l,v[2],v[3],v[4],v[5],v[6],v[7],.5,o),h=v[6],l=v[7]}break}case 6:{let y=m.Bh(a,h,l),w=y.length;if(w===0){o.push(m.endX),o.push(m.endY),h=m.endX,l=m.endY;break}for(let b=0;b<w;b++){let v=y[b];L.vn(h,l,v[2],v[3],v[4],v[5],v[6],v[7],.5,o),h=v[6],l=v[7]}break}default:f.o("Segment not of valid type: "+m.type)}m.isClosed&&(o.push(u),o.push(c),this.yd(t,e,o,i))}this.yd(t,e,o,i)}}else if(n.type===2)o.push(n.startX),o.push(n.startY),o.push(n.endX),o.push(n.startY),o.push(n.endX),o.push(n.endY),o.push(n.startX),o.push(n.endY),o.push(n.startX),o.push(n.startY),this.yd(t,e,o,i);else if(n.type===3){let r=new $t;r.startX=n.endX,r.startY=(n.startY+n.endY)/2;let a=new vt(5);a.startAngle=0,a.sweepAngle=360,a.centerX=(n.startX+n.endX)/2,a.centerY=(n.startY+n.endY)/2,a.radiusX=Math.abs(n.startX-n.endX)/2,a.radiusY=Math.abs(n.startY-n.endY)/2,r.add(a);let h=a.bo(r),l=h.length;if(l===0)o.push(a.centerX),o.push(a.centerY);else{let u=r.startX,c=r.startY;for(let d=0;d<l;d++){let g=h[d];L.vn(u,c,g[2],g[3],g[4],g[5],g[6],g[7],.5,o),u=g[6],c=g[7]}}this.yd(t,e,o,i)}f.J(o),t.restore(),t.clearContextCache(!1)}Bv(t){let e=t.measuredBounds.width;return t instanceof ut&&(e-=t.strokeWidth),e<1&&(e=1),e}yd(t,e,i,s){let n=i.length;if(n<4)return;let o=s.measuredBounds,r=Math.max(1,o.width),a=o.height,h=i[0],l=i[1],u=0,c=0,d=0,g=0,p=0,m=0,y=0,w=0,b=f.et();for(let C=2;C<n;C+=2)u=i[C],c=i[C+1],d=u-h,g=c-l,d===0&&(d=.001),p=g/d,m=Math.atan2(g,d),y=Math.sqrt(d*d+g*g),b.push([d,m,p,y]),w+=y,h=u,l=c;h=i[0],l=i[1];let v=this.Bv(s),k=v,S=r/2,M=S!==0,F=0,T=b[F];d=T[0],m=T[1],p=T[2],y=T[3];let N=0;for(;w>=.1;){if(N===0&&(M?(k=v,k-=S,w-=S,M=!1):k=v,k===0&&(k=1)),k>w){k=w,f.J(b);return}k>y?(N=k-y,k=y):N=0;let C=Math.sqrt(k*k/(1+p*p));if(d<0&&(C=-C),h+=C,l+=p*C,t.translate(h,l),t.rotate(m),t.translate(-(r/2),-(a/2)),N===0&&s.gh(t,e),t.translate(r/2,a/2),t.rotate(-m),t.translate(-h,-l),w-=k,y-=k,N!==0){if(F++,F===b.length){f.J(b);return}T=b[F],d=T[0],m=T[1],p=T[2],y=T[3],k=N}}f.J(b)}gh(t,e){let i=t instanceof ce,s=this.ji,n=this.Ta;if(s===null&&n===null)return;let o=this.ot;if(o===null)return;t.commitTransform();let r=this.actualBounds,a=this.naturalBounds;n!==null&&this.rn(t,n,!0,!1,a,r);let h=this.part,l=this.Vo;s!==null&&l===0&&h!==null&&(this.isPanelMain||h.findMainElement()===this)&&(l=h.Vv()),l===0&&(s=null),s!==null&&l!==0&&(this.rn(t,s,!1,!1,a,r),t.lineWidth=l,t.lineJoin=this.strokeJoin,t.lineCap=this.strokeCap,t.miterLimit=this.strokeMiterLimit);let u=!1;h&&e.getRenderingHint("drawShadows")&&(u=h.isShadowed),t.Zr===!1&&(u=!1);let c=!0;s!==null&&(n===null||n==="transparent")&&(c=!1);let d=!1,g=this.strokeDashArray;if(g!==null&&(d=!0,t.enableDash(g,this.strokeDashOffset)),o.type===1)t.beginPath(),t.moveTo(o.startX,o.startY),t.lineTo(o.endX,o.endY),s!==null&&t.strokeContext(),t.endPath();else if(o.type===2){let p=o.startX,m=o.startY,y=o.endX,w=o.endY,b=Math.min(p,y),v=Math.min(m,w),k=Math.abs(y-p),S=Math.abs(w-m);t.beginPath(),t.rect(b,v,k,S),n!==null&&t.fillContext(n,!1,null),s!==null&&(c&&u&&t.shadowsOff(),t.strokeContext(),c&&u&&t.shadowsOn()),t.endPath()}else if(o.type===3){let p=o.startX,m=o.startY,y=o.endX,w=o.endY,b=Math.abs(y-p)/2,v=Math.abs(w-m)/2,k=Math.min(p,y)+b,S=Math.min(m,w)+v;t.beginPath(),t.moveTo(k,S-v),t.bezierCurveTo(k+L.Rn*b,S-v,k+b,S-L.Rn*v,k+b,S),t.bezierCurveTo(k+b,S+L.Rn*v,k+L.Rn*b,S+v,k,S+v),t.bezierCurveTo(k-L.Rn*b,S+v,k-b,S+L.Rn*v,k-b,S),t.bezierCurveTo(k-b,S-L.Rn*v,k-L.Rn*b,S-v,k,S-v),t.closePath(),n!==null&&t.fillContext(n,!1,null),s!==null&&(c&&u&&t.shadowsOff(),t.strokeContext(),c&&u&&t.shadowsOn()),t.endPath()}else if(o.type===4){let p=o.figures,m=p.length;for(let y=0;y<m;y++){let w=p.r[y];i?(t.beginPath(),this.buildPath(t,w)):w.Ee===null&&(w.Ee=new Path2D,this.buildPath(w.Ee,w));let b=w.isFilled;u?w.isShadowed?(b===!0&&n!=="transparent"&&n!==null&&t.fillContext(n,w.isEvenOdd,w.Ee),s!==null&&(b&&c&&t.shadowsOff(),t.stroke(w.Ee),b&&c&&t.shadowsOn())):(t.shadowsOff(),b&&n!=="transparent"&&n!==null&&t.fillContext(n,w.isEvenOdd,w.Ee),s!==null&&t.stroke(w.Ee),t.shadowsOn()):(b&&n!==null&&t.fillContext(n,w.isEvenOdd,w.Ee),s!==null&&t.stroke(w.Ee)),t.endPath(y)}}d&&t.disableDash(),this.pathPattern!==null&&this.Uv(t,e)}buildPath(t,e){t.moveTo(e.startX,e.startY);let i=e.segments.r,s=i.length,n=null;for(let o=0;o<s;o++){let r=i[o];switch(r.type){case 1:t.moveTo(r.endX,r.endY);break;case 2:t.lineTo(r.endX,r.endY);break;case 3:t.bezierCurveTo(r.point1X,r.point1Y,r.point2X,r.point2Y,r.endX,r.endY);break;case 4:t.quadraticCurveTo(r.point1X,r.point1Y,r.endX,r.endY);break;case 5:if(r.radiusX===r.radiusY){let a=n!==null?n.endX:e.startX,h=n!==null?n.endY:e.startY,l=Math.PI/180;t.arc(r.point1X,r.point1Y,r.radiusX,r.startAngle*l,(r.startAngle+r.sweepAngle)*l,r.sweepAngle<0,a,h)}else{let a=r.bo(e),h=a.length;if(h===0){t.lineTo(r.centerX,r.centerY);break}for(let l=0;l<h;l++){let 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.bo(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.Bh(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}}Zc(t,e,i){if(!super.Zc(t,e,i)||this.ji===null&&this.Ta===null||this.ot===null||this.pathPattern!==null)return!1;let s=this.svg.getElementsByTagName("path");return this.geometry.figures.length!==s.length?!1:(t.currentPath=this.svg,this.gh(t,e),t.currentPath=null,!0)}$u(t){return this.geometry!==null&&this.geometry.figures.length>1||this.pathPattern!==null?!0:super.$u(t)}k2(t,e){if(t.nodeName!=="g")t.setAttributeNS(null,"filter",e);else{let i=t.getElementsByTagName("path");for(let s=0;s<i.length;s++)i[s].setAttributeNS(null,"filter",e)}}getDocumentPoint(t,e){if(e===void 0&&(e=new P),t instanceof D){let i=t;i.isNoSpot()&&f.o("getDocumentPoint Spot must be a real, specific Spot, not: "+i.toString());let s=this.naturalBounds,n=this.strokeWidth;return e.i(i.x*(s.width+n)-n/2+s.x+i.offsetX,i.y*(s.height+n)-n/2+s.y+i.offsetY),this.Us.gt(e),e}else return e.set(t),this.Us.gt(e),e}getDocumentBounds(t){t===void 0&&(t=new z);let e=this.naturalBounds,i=this.Us,s=z.V(e.x,e.y,e.width,e.height),n=this.strokeWidth;s.inflate(n/2,n/2);let o=P.V(s.x,s.y).T(i);return t.i(o.x,o.y,0,0),o.i(s.right,s.y).T(i),t.unionNoCheck(o.x,o.y,0,0),o.i(s.right,s.bottom).T(i),t.unionNoCheck(o.x,o.y,0,0),o.i(s.x,s.bottom).T(i),t.unionNoCheck(o.x,o.y,0,0),z.e(s),P.e(o),t}fh(t,e){let i=this.geometry;if(i===null||this.fill===null&&this.stroke===null)return!1;let s=i.bounds,n=this.strokeWidth/2;i.type===1&&!e&&(n+=2);let o=z.l();if(o.a(s),o.inflate(n+2,n+2),!o.containsPoint(t))return z.e(o),!1;let r=n+1e-4;if(i.type===1){if(this.stroke===null)return!1;let a=(i.startX-i.endX)*(t.x-i.endX)+(i.startY-i.endY)*(t.y-i.endY),h=(i.endX-i.startX)*(t.x-i.startX)+(i.endY-i.startY)*(t.y-i.startY);return a<0||h<0?!1:(z.e(o),L.vi(i.startX,i.startY,i.endX,i.endY,n,t.x,t.y))}else if(i.type===2){let a=i.startX,h=i.startY,l=i.endX,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 z.e(o),!1;o.inflate(r,r)}this.stroke!==null&&o.inflate(n,n);let c=o.containsPoint(t);return z.e(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),g=Math.abs(l-a),p=Math.abs(u-h),m=g/2,y=p/2;if(c=t.x-(c+m),d=t.y-(d+y),this.fill===null){if(m-=r,y-=r,m<=0||y<=0||c*c/(m*m)+d*d/(y*y)<=1)return z.e(o),!1;m+=r,y+=r}return this.stroke!==null&&(m+=r,y+=r),z.e(o),m<=0||y<=0?!1:c*c/(m*m)+d*d/(y*y)<=1}else{if(i.type===4)return z.e(o),this.fill===null?i.EC(t.x,t.y,n):i.qk(t,n,this.strokeWidth>1,e);f.o("Unknown Geometry type: "+i.type)}}Wu(t,e,i,s){let n=this.desiredSize,o=this.Vo;t=Math.max(t,0),e=Math.max(e,0);let r;if(this.ks!==null)r=this.geometry.bounds;else{let p=this.figure,m=ut.q2[p];if(m===void 0){let y=L.In[p];typeof y=="string"&&(y=L.In[y]),f.it(y)?(m=y(null,100,100),ut.q2[p]=m):f.o("Unsupported Figure: "+p)}r=m.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 g=this.aS();switch(g){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:f.o(g+" is not a valid geometryStretch.")}if(this.ks!==null){a===0&&(a=.001),h===0&&(h=.001);let p=(this.ks!==null?this.ks:this.ot).cF(a,h);this.ot=p}else(this.ot===null||!L.z(this.ot.rc,t-o)||!L.z(this.ot.lc,e-o))&&(this.ot=ut.zv(this,a,h));r=this.ot.bounds,t===1/0||e===1/0?this.Wn(r.x-o/2,r.y-o/2,t===0&&a===0?0:r.width+o,e===0&&h===0?0:r.height+o):this.Wn(-(o/2),-(o/2),l+o,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.zi.i(0,0,l,u)):this.zi.a(r)}aS(){let t=this.geometryStretch;return this.ks!==null?t===1?2:t:t===1?ut.q2[this.figure].defaultStretch:t}uh(t,e,i,s){this.commonArrange(t,e,i,s)}getNearestIntersectionPoint(t,e,i){return this.Jc(t.x,t.y,e.x,e.y,i)}Jc(t,e,i,s,n){let o=this.T,r=1/(o.m11*o.m22-o.m12*o.m21),a=o.m22*r,h=-o.m12*r,l=-o.m21*r,u=o.m11*r,c=r*(o.m21*o.dy-o.m22*o.dx),d=r*(o.m12*o.dx-o.m11*o.dy),g=t*a+e*l+c,p=t*h+e*u+d,m=i*a+s*l+c,y=i*h+s*u+d,w=this.Vo/2,b=this.ot;b===null&&(this.ht(1/0,1/0),b=this.ot);let v=b.bounds,k=!1;if(b.type===1)if(this.strokeWidth<=1.5)k=L.On(b.startX,b.startY,b.endX,b.endY,g,p,m,y,n);else{let S=0,M=0;if(b.startX===b.endX)S=w,M=0;else{let R=(b.endY-b.startY)/(b.endX-b.startX);M=w/Math.sqrt(1+R*R),S=M*R}let F=f.et(),T=new P;L.On(b.startX+S,b.startY+M,b.endX+S,b.endY+M,g,p,m,y,T)&&F.push(T),T=new P,L.On(b.startX-S,b.startY-M,b.endX-S,b.endY-M,g,p,m,y,T)&&F.push(T),T=new P,L.On(b.startX+S,b.startY+M,b.startX-S,b.startY-M,g,p,m,y,T)&&F.push(T),T=new P,L.On(b.endX+S,b.endY+M,b.endX-S,b.endY-M,g,p,m,y,T)&&F.push(T);let N=F.length;if(N===0)return f.J(F),!1;k=!0;let C=1/0;for(let R=0;R<N;R++){let O=F[R],B=(O.x-g)**2+(O.y-p)**2;B<C&&(C=B,n.x=O.x,n.y=O.y)}f.J(F)}else if(b.type===2)k=L.gl(v.x-w,v.y-w,v.x+v.width+w,v.y+v.height+w,g,p,m,y,n);else if(b.type===3){let S=z.V(v.x,v.y,v.width,v.height).inflate(w,w);k=this.Xv(S,g,p,m,y,n),z.e(S)}else if(b.type===4){let S=0,M=0,F=0,T=0,N=P.l(),C=m-g,R=y-p,O=C*C+R*R,B=g,K=p;if(O>0&&v.contains(B,K)&&(N.x=B,N.y=K,this.containsPoint(N)))for(C!==0&&Math.abs(C)<.5?(R*=.5/C,C=.5):R!==0&&Math.abs(R)<.5&&(C*=.5/R,R=.5),B-=C,K-=R;v.contains(B,K);)B-=C,K-=R;let Y=.6;n.x=m,n.y=y;for(let at=0;at<b.figures.count;at++){let tt=b.figures.r[at],st=tt.isFilled?B:g,et=tt.isFilled?K:p,ct=tt.segments;S=tt.startX,M=tt.startY;let gt=S,wt=M;for(let Ct=0;Ct<ct.count;Ct++){let ot=ct.r[Ct],Mt=ot.type;F=ot.endX,T=ot.endY;let bt=!1;switch(Mt){case 1:gt=F,wt=T;break;case 2:bt=this.s1(S,M,F,T,st,et,m,y,N);break;case 3:{bt=L.Ig(S,M,ot.point1X,ot.point1Y,ot.point2X,ot.point2Y,F,T,st,et,m,y,Y,N);break}case 4:{bt=L.Ig(S,M,S+2/3*(ot.point1X-S),M+2/3*(ot.point1Y-M),F+2/3*(ot.point1X-F),T+2/3*(ot.point1Y-T),F,T,st,et,m,y,Y,N);break}case 5:case 6:{let Gt=ot.type===5?ot.bo(tt):ot.Bh(tt,S,M),lt=Gt.length;if(lt===0){bt=this.s1(S,M,ot.type===5?ot.centerX:ot.endX,ot.type===5?ot.centerY:ot.endY,st,et,m,y,N);break}let J=null;for(let mt=0;mt<lt;mt++){if(J=Gt[mt],mt===0&&this.s1(S,M,J[0],J[1],st,et,m,y,N)){let At=this.o1(st,et,N,O,n);At<O&&(O=At,k=!0)}if(L.Ig(J[0],J[1],J[2],J[3],J[4],J[5],J[6],J[7],st,et,m,y,Y,N)){let At=this.o1(st,et,N,O,n);At<O&&(O=At,k=!0)}}F=J[6],T=J[7];break}default:f.o("Unknown Segment type: "+Mt)}if(S=F,M=T,bt){let Gt=this.o1(st,et,N,O,n);Gt<O&&(O=Gt,k=!0)}if(ot.isClosed&&(F=gt,T=wt,this.s1(S,M,F,T,st,et,m,y,N))){let Gt=this.o1(st,et,N,O,n);Gt<O&&(O=Gt,k=!0)}}}let X=i-t,G=s-e,nt=Math.sqrt(X*X+G*G);nt!==0&&(X/=nt,G/=nt),n.x-=X*w,n.y-=G*w,P.e(N)}else f.o("Unknown Geometry type: "+b.type);return k?(this.T.gt(n),!0):!1}o1(t,e,i,s,n){let o=i.x-t,r=i.y-e,a=o*o+r*r;return a<s?(n.x=i.x,n.y=i.y,a):s}s1(t,e,i,s,n,o,r,a,h){if(L.z(t,i)&&L.z(e,s)||L.z(n,r)&&L.z(o,a))return!1;let l=!1,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||L.z(h.y,c))&&(h.y<d||L.z(h.y,d))&&(l=!0)}else{let c=t<i?t:i,d=t<i?i:t;(h.x>c||L.z(h.x,c))&&(h.x<d||L.z(h.x,d))&&(l=!0)}return l}Yv(t,e,i){return this.pickable===!1?!1:(i.nc(this.T),e?this.Gv(t,i):this.containedInRect(t,i))}containedInRect(t,e){if(e===void 0)return t.containsRect(this.actualBounds);let i=this.ot;i===null&&(this.ht(1/0,1/0),i=this.ot);let s=i.bounds,n=this.strokeWidth/2,o=!1,r=P.l();return r.i(s.x-n,s.y-n),t.containsPoint(e.gt(r))&&(r.i(s.x-n,s.bottom+n),t.containsPoint(e.gt(r))&&(r.i(s.right+n,s.bottom+n),t.containsPoint(e.gt(r))&&(r.i(s.right+n,s.y-n),t.containsPoint(e.gt(r))&&(o=!0)))),P.e(r),o}intersectsRect(t,e){if(this.containedInRect(t,e)||e===void 0&&(e=this.T,t.containsRect(this.actualBounds)))return!0;let i=Pt.l();i.set(e),i.bw();let s=t.left,n=t.right,o=t.top,r=t.bottom,a=P.l();if(a.i(s,o),i.gt(a),this.fh(a,!0)||(a.i(n,o),i.gt(a),this.fh(a,!0))||(a.i(s,r),i.gt(a),this.fh(a,!0))||(a.i(n,r),i.gt(a),this.fh(a,!0)))return P.e(a),!0;let h=P.l(),l=P.l();i.set(e),i.NC(this.T),i.bw(),h.x=n,h.y=o,h.T(i),a.x=s,a.y=o,a.T(i);let u=!1;return this.Fa(a,h,l)?u=!0:(a.x=n,a.y=r,a.T(i),this.Fa(a,h,l)?u=!0:(h.x=s,h.y=r,h.T(i),this.Fa(a,h,l)?u=!0:(a.x=s,a.y=o,a.T(i),this.Fa(a,h,l)&&(u=!0)))),P.e(a),Pt.e(i),P.e(h),P.e(l),u}Fa(t,e,i){if(!this.getNearestIntersectionPoint(t,e,i))return!1;let s=t.x,n=t.y,o=e.x,r=e.y,a=i.x,h=i.y;if(s===o){let l=0,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}}Gv(t,e){if(this.containedInRect(t,e)||e===void 0&&(e=this.T,t.containsRect(this.actualBounds)))return!0;let i=t.left,s=t.right,n=t.top,o=t.bottom,r=P.l(),a=P.l(),h=P.l(),l=Pt.l();l.set(e),l.NC(this.T),l.bw(),a.x=s,a.y=n,a.T(l),r.x=i,r.y=n,r.T(l);let u=!1;return this.Fa(r,a,h)?u=!0:(r.x=s,r.y=o,r.T(l),this.Fa(r,a,h)?u=!0:(a.x=i,a.y=o,a.T(l),this.Fa(r,a,h)?u=!0:(r.x=i,r.y=n,r.T(l),this.Fa(r,a,h)&&(u=!0)))),Pt.e(l),P.e(r),P.e(a),P.e(h),u}xA(t,e,i){if(i&&this.fill!==null&&this.fh(t,!0))return!0;let s=t.distanceSquaredPoint(e),n=s;this.strokeWidth>1.5&&(s=this.strokeWidth/2+Math.sqrt(s),s*=s);let o=this.ot;if(o===null&&(this.ht(1/0,1/0),o=this.ot,o===null))return!1;if(!i){let c=o.bounds,d=c.x,g=c.y,p=c.x+c.width,m=c.y+c.height;if(P.distanceSquared(t.x,t.y,d,g)<=s&&P.distanceSquared(t.x,t.y,p,g)<=s&&P.distanceSquared(t.x,t.y,d,m)<=s&&P.distanceSquared(t.x,t.y,p,m)<=s)return!0}function r(c,d){let g=c.length;for(let p=0;p<g;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),g=(a-l)*(t.x-l)+(h-u)*(t.y-u),p=d>=0&&g>=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,g=t.x-c,p=t.y-d,m=Math.abs(l-a)/2,y=Math.abs(u-h)/2;if(m===0||y===0)return P.distanceLineSegmentSquared(t.x,t.y,a,h,l,u)<=s;if(i){let w=L.iF(m,y,g,p);return w*w<=s}else return!(P.distanceSquared(g,p,-m,0)>=s||P.distanceSquared(g,p,0,-y)>=s||P.distanceSquared(g,p,0,y)>=s||P.distanceSquared(g,p,m,0)>=s)}else if(o.type===4){let c=o.bounds,d=c.x,g=c.y,p=c.x+c.width,m=c.y+c.height;if(t.x>p&&t.x<d&&t.y>m&&t.y<g&&P.distanceLineSegmentSquared(t.x,t.y,d,g,d,m)>s&&P.distanceLineSegmentSquared(t.x,t.y,d,g,p,g)>s&&P.distanceLineSegmentSquared(t.x,t.y,p,m,d,m)>s&&P.distanceLineSegmentSquared(t.x,t.y,p,m,p,g)>s)return!1;let y=Math.sqrt(s);if(i){if(this.fill===null?o.EC(t.x,t.y,y):o.qk(t,y,!0,!1))return!0}else{let w=o.figures;for(let b=0;b<w.count;b++){let v=w.r[b],k=v.startX,S=v.startY;if(t.distanceSquared(k,S)>s)return!1;let M=v.segments.r,F=M.length;for(let T=0;T<F;T++){let N=M[T];switch(N.type){case 1:case 2:if(k=N.endX,S=N.endY,t.distanceSquared(k,S)>s)return!1;break;case 3:{let C=f.et();L.vn(k,S,N.point1X,N.point1Y,N.point2X,N.point2Y,N.endX,N.endY,.8,C);let R=r(C,t);if(f.J(C),R||(k=N.endX,S=N.endY,t.distanceSquared(k,S)>s))return!1;break}case 4:{let C=f.et();L.Og(k,S,N.point1X,N.point1Y,N.endX,N.endY,.8,C);let R=r(C,t);if(f.J(C),R||(k=N.endX,S=N.endY,t.distanceSquared(k,S)>s))return!1;break}case 5:case 6:{let C=N.type===5?N.bo(v):N.Bh(v,k,S),R=C.length;if(R===0){if(k=N.type===5?N.centerX:N.endX,S=N.type===5?N.centerY:N.endY,t.distanceSquared(k,S)>s)return!1;break}let O=null,B=f.et();for(let K=0;K<R;K++)if(O=C[K],B.length=0,L.vn(O[0],O[1],O[2],O[3],O[4],O[5],O[6],O[7],.8,B),r(B,t))return f.J(B),!1;f.J(B),O!==null&&(k=O[6],S=O[7]);break}default:f.o("Unknown Segment type: "+N.type)}}}return!0}}return!1}Xv(t,e,i,s,n,o){if(t.width===0)return L.On(t.x,t.y,t.x,t.y+t.height,e,i,s,n,o);if(t.height===0)return L.On(t.x,t.y,t.x+t.width,t.y,e,i,s,n,o);{let r=t.width/2,a=t.height/2,h=t.x+r,l=t.y+a,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),g=(-(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,m=u*(g-h)+c+l,y=u*(p-h)+c+l,w=Math.abs((e-g)**2)+Math.abs((i-m)**2),b=Math.abs((e-p)**2)+Math.abs((i-y)**2);w<b?(o.x=g,o.y=m):(o.x=p,o.y=y)}else{let c=a*a,d=r*r,g=e-h,p=c-c/d*(g*g);if(p<0)return o.x=NaN,o.y=NaN,!1;let m=Math.sqrt(p),y=l+m,w=l-m,b=Math.abs(y-i),v=Math.abs(w-i);b<v?(o.x=e,o.y=y):(o.x=e,o.y=w)}return!0}}Rv(){return this.Vo/2*this.strokeMiterLimit*this.getDocumentScale()}get geometry(){return this.ot!==null?this.ot:this.ks}set geometry(t){let e=this.ot,i=this.ks;if(e===t)return;t!==null?(this.ot=t.u(),this.ks=this.ot):(this.ot=null,this.ks=null);let s=this.part;if(s!==null&&s.cf(),this.c(),this.t("geometry",e||i,t),this.Wc()){let n=this.part;n!==null&&this.ba(n,"geometryString")}}get geometryString(){return this.geometry===null?"":this.geometry.toString()}set geometryString(t){let e=kt.parse(t),i=e.normalize();this.geometry=e;let s=P.V(-i.x,-i.y);this.position=s,P.e(s)}get isGeometryPositioned(){return(this.n&1048576)!==0}set isGeometryPositioned(t){let e=(this.n&1048576)!==0;e!==t&&(this.n=this.n^1048576,this.c(),this.t("isGeometryPositioned",e,t))}ee(){this.ot=null}get fill(){return this.Ta}set fill(t){let e=this.Ta;e!==t&&(t!==null&&E.Qu(t,"Shape.fill"),t instanceof E&&t.u(),this.Ta=t,this.S(),this.t("fill",e,t))}get stroke(){return this.ji}set stroke(t){let e=this.ji;e!==t&&(t!==null&&E.Qu(t,"Shape.stroke"),t instanceof E&&t.u(),this.ji=t,this.S(),this.t("stroke",e,t))}get strokeWidth(){return this.Vo}set strokeWidth(t){let e=this.Vo;if(e!==t)if(t>=0){this.Vo=t,this.c();let i=this.part;i!==null&&i.cf(),this.t("strokeWidth",e,t)}else f.W(t,"value >= 0",ut,"strokeWidth:value")}y0(){return this.Vo}get strokeCap(){return this.jt!==null?this.jt.gp:"butt"}set strokeCap(t){let e=this.strokeCap;e!==t&&(typeof t=="string"&&(t==="butt"||t==="round"||t==="square")?(this.Da().gp=t,this.S(),this.t("strokeCap",e,t)):f.W(t,'"butt", "round", or "square"',ut,"strokeCap"))}get strokeJoin(){return this.jt!==null?this.jt.mp:"miter"}set strokeJoin(t){let e=this.strokeJoin;e!==t&&(typeof t=="string"&&(t==="miter"||t==="bevel"||t==="round")?(this.Da().mp=t,this.S(),this.t("strokeJoin",e,t)):f.W(t,'"miter", "bevel", or "round"',ut,"strokeJoin"))}get strokeMiterLimit(){return this.jt!==null?this.jt.pp:10}set strokeMiterLimit(t){let e=this.strokeMiterLimit;if(e!==t&&t>=1){this.Da().pp=t,this.S();let i=this.part;i!==null&&i.cf(),this.t("strokeMiterLimit",e,t)}}get strokeDashArray(){return this.Io}set strokeDashArray(t){let e=this.Io;if(e!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",ut,"strokeDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(!(o>=0)||!isFinite(o))&&f.o("strokeDashArray:value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.Io=t,this.S(),this.t("strokeDashArray",e,t)}}get strokeDashOffset(){return this.jt!==null?this.jt.ph:0}set strokeDashOffset(t){let e=this.strokeDashOffset;e!==t&&t>=0&&(this.Da().ph=t,this.S(),this.t("strokeDashOffset",e,t))}get figure(){return this.gd}set figure(t){let e=this.gd;if(e!==t){let i=L.In[t];if(f.it(i)?i=t:(i=L.In[t.toLowerCase()],i||f.o("Unknown Shape.figure: "+t)),e!==i){let s=this.part;s!==null&&s.cf(),this.gd=i,this.ks=null,this.ee(),this.c(),this.t("figure",e,i)}}}get toArrow(){return this.Ot!==null?this.Ot.yp:"None"}set toArrow(t){let e=this.toArrow;if(t===!0?t="Standard":t===!1&&(t=""),e!==t){let i=ut.qA(t);i===null?f.o("Unknown Shape.toArrow: "+t):e!==i&&(this.Ot===null&&(this.Ot=new He),this.Ot.yp=i,this.ks=null,this.ee(),this.c(),this.WA(i),this.t("toArrow",e,i))}}get fromArrow(){return this.Ot!==null?this.Ot.wp:"None"}set fromArrow(t){let e=this.fromArrow;if(t===!0?t="Standard":t===!1&&(t=""),e!==t){let i=ut.qA(t);i===null?f.o("Unknown Shape.fromArrow: "+t):e!==i&&(this.Ot===null&&(this.Ot=new He),this.Ot.wp=i,this.ks=null,this.ee(),this.c(),this.WA(i),this.t("fromArrow",e,i))}}WA(t){let e=this.diagram;if(e!==null&&e.undoManager.isUndoingRedoing)return;this.iv();let i=D.MiddleRight;this.toArrow!=="None"?(this.segmentIndex=-1,this.alignmentFocus=i):this.fromArrow!=="None"&&(this.segmentIndex=0,this.alignmentFocus=new D(1-i.x,i.y))}get spot1(){return this.jt!==null?this.jt.En:D.Default}set spot1(t){let e=this.spot1;e.equals(t)||(t=t.P(),this.Da().En=t,this.c(),this.t("spot1",e,t))}get spot2(){return this.jt!==null?this.jt.Un:D.Default}set spot2(t){let e=this.spot2;e.equals(t)||(t=t.P(),this.Da().Un=t,this.c(),this.t("spot2",e,t))}get parameter1(){return this.md}set parameter1(t){let e=this.md;e!==t&&(this.md=t,this.ee(),this.c(),this.t("parameter1",e,t))}get parameter2(){return this.pd}set parameter2(t){let e=this.pd;e!==t&&(this.pd=t,this.ee(),this.c(),this.t("parameter2",e,t))}get naturalBounds(){return this.zi}kv(){let t=this.desiredSize;if(!t.isReal()&&this.ot!==null){let e=this.ot.bounds;this.zi.a(e)}else this.zi.i(0,0,t.width,t.height)}get pathPattern(){return this.jt!==null?this.jt.xp:null}set pathPattern(t){let e=this.pathPattern;e!==t&&(this.Da().xp=t,this.S(),this.t("pathPattern",e,t))}get geometryStretch(){return this.jt!==null?this.jt.bp:1}set geometryStretch(t){let e=this.geometryStretch;e!==t&&(this.Da().bp=t,this.c(),this.t("geometryStretch",e,t))}get interval(){return this.K!==null?this.K.uf:1}set interval(t){let e=this.interval;if(t=Math.round(t),e!==t&&t!==0&&isFinite(t)){this.K===null&&(this.K=new Ae),this.K.uf=t;let i=this.diagram;i!==null&&this.panel===i.grid&&i.th(),this.c();let s=this.panel;s!==null&&(s.ss=null),this.t("interval",e,t)}}get graduatedStart(){return this.K!==null?this.K.df:0}set graduatedStart(t){let e=this.graduatedStart;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new Ae),this.K.df=t,this.c(),this.t("graduatedStart",e,t))}get graduatedEnd(){return this.K!==null?this.K.gf:1}set graduatedEnd(t){let e=this.graduatedEnd;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new Ae),this.K.gf=t,this.c(),this.t("graduatedEnd",e,t))}get graduatedSkip(){return this.K!==null?this.K.mf:null}set graduatedSkip(t){let e=this.graduatedSkip;e!==t&&(t!==null&&f.k(t,ut,"graduatedSkip"),this.K===null&&(this.K=new Ae),this.K.mf=t,this.c(),this.t("graduatedSkip",e,t))}static zv(t,e,i){let s=null;if(t.toArrow!=="None")s=ut.gn[t.toArrow];else if(t.fromArrow!=="None")s=ut.gn[t.fromArrow];else{let n=L.In[t.figure];typeof n=="string"&&(n=L.In[n]),n===void 0&&f.o("Unknown Shape.figure: "+t.figure),s=n(t,e,i),s.rc=e,s.lc=i}if(s===null){let n=L.In.Rectangle;f.it(n)&&(s=n(t,e,i))}return s}static getFigureGenerators(){let t=new pt;for(let e in L.In){if(e===e.toLowerCase())continue;let i=L.In[e];t.set(e,i)}return t.u(),t}static defineFigureGenerator(t,e){f.s(t,"string",ut,"defineFigureGenerator:name"),typeof e=="string"||f.k(e,ut,"defineFigureGenerator:func");let i=t.toLowerCase(),s=L.In;s[t]=e,s[i]=t}static isFigureDefined(t){return L.In.has(t)}static getArrowheadGeometries(){let t=new pt;for(let e in L.Bg)if(ut.gn[e]===void 0){let i=kt.parse(L.Bg[e],!1);ut.gn[e]=i;let s=e.toLowerCase();s!==e&&(ut.gn[s]=e)}for(let e in ut.gn){if(e===e.toLowerCase())continue;let i=ut.gn[e];i instanceof kt&&t.set(e,i)}return t.u(),t}static defineArrowheadGeometry(t,e){f.s(t,"string",ut,"defineArrowheadGeometry:name");let i=null;typeof e=="string"?(f.s(e,"string",ut,"defineArrowheadGeometry:pathstr"),i=kt.parse(e,!1)):i=e;let s=t.toLowerCase();(s==="none"||t===s)&&f.o("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+t);let n=ut.gn;n[t]=i,n[s]=t}static isArrowheadDefined(t){return ut.gn.has(t)}static gn=new q;static q2=new q;static qA(t){let e=ut.gn[t];if(e===void 0){let i=t.toLowerCase();if(i==="none")return"None";if(e=ut.gn[i],e===void 0){let s=null;for(let n in L.Bg)if(n.toLowerCase()===i){s=n;break}if(s!==null){let n=kt.parse(L.Bg[s],!1);return ut.gn[s]=n,i!==s&&(ut.gn[i]=s),s}}}return typeof e=="string"?e:e instanceof kt?t:null}}class ks{fi;gp;mp;pp;ph;xp;bp;En;Un;constructor(){this.fi=!1,this.gp="butt",this.mp="miter",this.pp=10,this.ph=0,this.xp=null,this.bp=1,this.En=D.Default,this.Un=D.Default}copy(){let t=new ks;return t.gp=this.gp,t.mp=this.mp,t.pp=this.pp,t.ph=this.ph,t.xp=this.xp,t.bp=this.bp,t.En=this.En.P(),t.Un=this.Un.P(),t}}var Ss=(x=>(x[x.None=0]="None",x[x.Fit=1]="Fit",x[x.DesiredSize=2]="DesiredSize",x[x.BreakAll=3]="BreakAll",x))(Ss||{}),Fn=(x=>(x[x.Clip=0]="Clip",x[x.Ellipsis=1]="Ellipsis",x))(Fn||{}),Ps=(x=>(x[x.Trim=0]="Trim",x[x.None=1]="None",x))(Ps||{});class xt extends dt{ri;ji;mn;ge;ui;w0;wd;K;rt;Dl;io;pn;Ce;Ti;yn;constructor(t,e){return super(),xt.W0===!1&&(xt.W0=!0,xt._n=U.isUsingDOM()?new Ue(null).li:null),this.n|=2097152,this.ri="",this.ji="black",this.mn="13px sans-serif",this.ge=0,this.ui=0,this.w0=0,this.wd=null,this.K=null,this.rt=null,this.Dl=0,this.io=null,this.pn=0,this.Ce=null,this.Ti=null,this.yn=null,typeof t=="string"?this.text=t:t&&Object.assign(this,t),e&&Object.assign(this,e),this}cloneProtected(t){super.cloneProtected(t),t.ri=this.ri,t.ji=this.ji,t.mn=this.mn,t.ge=this.ge,t.ui=this.ui,t.w0=this.w0,t.wd=this.wd,this.K!==null&&(t.K=this.K.copy()),this.rt!==null&&(this.rt.fi?t.rt=this.rt:t.rt=this.rt.copy()),t.Dl=this.Dl,t.io=this.io,t.pn=this.pn,t.Ce=this.Ce,t.Ti=this.Ti,t.yn=this.yn}wn(){return this.rt===null?this.rt=new Ms:this.rt.fi&&(this.rt=this.rt.copy()),this.rt}ch(){super.ch(),this.rt!==null&&(this.rt.fi=!0)}Av(t){this.n=t.n|2048|4096,this.$t=t.opacity,this.Lt=t.background,this.is=t.desiredSize.P(),this.minSize=t.minSize.P(),this.maxSize=t.maxSize.P(),t.wi!==null?this.wi=t.wi.copy():this.wi=null,this.tt=t.scale,this.Yt=t.angle,this.stretch=t.stretch,this.Wr=t.margin.P(),this.hi=t.alignment.P(),this.ju=t.alignmentFocus.P(),this.segmentFraction=t.segmentFraction,this.segmentOffset=t.segmentOffset.P(),this.segmentOrientation=t.segmentOrientation,t.si!==null&&(this.si=t.si.copy()),this.shadowVisible=t.shadowVisible,this.ri=t.ri,this.ji=t.ji,this.mn=t.mn,this.K!==null&&(this.K=t.K.copy()),t.rt!==null&&(t.rt.fi?this.rt=t.rt:this.rt=t.rt.copy()),this.Dl=t.Dl}Cv(t){if(this.ri=t.text||"",this.Yt=t.labelAngle||0,this.ge=t.lineCount||0,this.Kv(t.lines),t.naturalBounds&&(this.zi=t.naturalBounds),t.actualBounds){let e=t.actualBounds;this.Bt(e.x,e.y,e.width,e.height)}}oi(t){t in Ss?this.wrap=t:super.oi(t)}toString(){return this.ri.length>22?'TextBlock("'+this.ri.substring(0,20)+'"...)':'TextBlock("'+this.ri+'")'}static getEllipsis(){return xt.kp}static setEllipsis(t){xt.kp=t,xt.l1=new q,xt.W2=0}static getBaseline(){return xt.h1}static setBaseline(t){xt.h1=t}static h1=null;static getUnderline(){return xt.a1}static setUnderline(t){xt.a1=t}static a1=null;static None=0;static WrapFit=1;static WrapDesiredSize=2;static WrapBreakAll=3;static OverflowClip=0;static OverflowEllipsis=1;static FormatTrim=0;static FormatNone=1;c(){super.c(),this.Ve(!0)}get font(){return this.mn}set font(t){let e=this.mn;e!==t&&(this.mn=t,this.io=null,this.c(),this.t("font",e,t))}static isValidFont(t){return A.CSS?A.CSS.supports("font",t):!0}get text(){return this.ri}set text(t){let e=this.ri;t!=null?t=t.toString():t="",e!==t&&(this.ri=t,this.c(),this.t("text",e,t))}get textAlign(){return this.rt!==null?this.rt.Pp:"start"}set textAlign(t){let e=this.textAlign;e!==t&&(t==="start"||t==="end"||t==="left"||t==="right"||t==="center")&&(this.wn().Pp=t,this.S(),this.t("textAlign",e,t))}get flip(){return this.rt!==null?this.rt.eo:0}set flip(t){let e=this.flip;e!==t&&(this.wn().eo=t,this.S(),this.t("flip",e,t))}get verticalAlignment(){return this.rt!==null?this.rt.tl:D.Top}set verticalAlignment(t){let e=this.verticalAlignment;e.equals(t)||(t=t.P(),this.wn().tl=t,this.ef(),this.t("verticalAlignment",e,t))}get naturalBounds(){if(!this.zi.isReal()){let t=Q.l();this.J2(this.ri,999999,t);let e=t.width;Q.e(t);let i=this.JA(e),s=this.desiredSize;isNaN(s.width)||(e=s.width),isNaN(s.height)||(i=s.height),this.zi.Fn(e,i)}return this.zi}get isMultiline(){return(this.n&2097152)!==0}set isMultiline(t){let e=(this.n&2097152)!==0;e!==t&&(this.n=this.n^2097152,this.c(),this.t("isMultiline",e,t))}get isUnderline(){return(this.n&4194304)!==0}set isUnderline(t){let e=(this.n&4194304)!==0;e!==t&&(this.n=this.n^4194304,this.Ve(!0),this.S(),this.t("isUnderline",e,t))}get isStrikethrough(){return(this.n&8388608)!==0}set isStrikethrough(t){let e=(this.n&8388608)!==0;e!==t&&(this.n=this.n^8388608,this.Ve(!0),this.S(),this.t("isStrikethrough",e,t))}get wrap(){return this.rt!==null?this.rt.Sp:2}set wrap(t){let e=this.wrap;e!==t&&(this.wn().Sp=t,this.c(),this.t("wrap",e,t))}get overflow(){return this.rt!==null?this.rt.Mp:0}set overflow(t){let e=this.overflow;e!==t&&(this.wn().Mp=t,this.c(),this.t("overflow",e,t))}get isOverflowed(){return(this.n&16777216)!==0}$2(t){t?this.n|=16777216:this.n&=-16777217}get stroke(){return this.ji}set stroke(t){let e=this.ji;e!==t&&(t!==null&&E.Qu(t,"TextBlock.stroke"),t instanceof E&&t.u(),this.ji=t,typeof t!="string"&&this.Qc(),this.S(),this.t("stroke",e,t))}get lineCount(){return this.ge}get lineHeight(){return this.Np()}get editable(){return(this.n&1048576)!==0}set editable(t){let e=(this.n&1048576)!==0;e!==t&&(this.n=this.n^1048576,this.t("editable",e,t))}get V2(){return(this.n&33554432)!==0}set V2(t){this.n=this.n^33554432}get textEditor(){return this.rt!==null?this.rt.Cp:null}set textEditor(t){let e=this.textEditor;e!==t&&(this.wn().Cp=t,this.t("textEditor",e,t))}get errorFunction(){return this.rt!==null?this.rt.ns:null}set errorFunction(t){let e=this.errorFunction;e!==t&&(t!==null&&f.k(t,xt,"errorFunction"),this.wn().ns=t,this.t("errorFunction",e,t))}get interval(){return this.K!==null?this.K.uf:1}set interval(t){let e=this.interval;if(t=Math.round(t),e!==t&&t!==0&&isFinite(t)){this.K===null&&(this.K=new Ae),this.K.uf=t,this.c();let i=this.panel;i!==null&&(i.ss=null),this.t("interval",e,t)}}get graduatedStart(){return this.K!==null?this.K.df:0}set graduatedStart(t){let e=this.graduatedStart;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new Ae),this.K.df=t,this.c(),this.t("graduatedStart",e,t))}get graduatedEnd(){return this.K!==null?this.K.gf:1}set graduatedEnd(t){let e=this.graduatedEnd;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new Ae),this.K.gf=t,this.c(),this.t("graduatedEnd",e,t))}get graduatedFunction(){return this.K!==null?this.K.Lp:null}set graduatedFunction(t){let e=this.graduatedFunction;e!==t&&(t!==null&&f.k(t,xt,"graduatedFunction"),this.K===null&&(this.K=new Ae),this.K.Lp=t,this.c(),this.t("graduatedFunction",e,t))}get graduatedSkip(){return this.K!==null?this.K.mf:null}set graduatedSkip(t){let e=this.graduatedSkip;e!==t&&(t!==null&&f.k(t,xt,"graduatedSkip"),this.K===null&&(this.K=new Ae),this.K.mf=t,this.c(),this.t("graduatedSkip",e,t))}gh(t,e){if(this.ji===null||this.ri.length===0||this.mn===null)return;let i=this.naturalBounds,s=this.actualBounds,n=i.width,o=i.height,r=this.Np(),a=t.textAlign=this.textAlign,h=e.zu;a==="start"?a=h?"right":"left":a==="end"&&(a=h?"left":"right");let l=this.isUnderline,u=this.isStrikethrough;this.rn(t,this.ji,!0,!1,i,s),(l||u)&&this.rn(t,this.ji,!1,!1,i,s);let c=0,d=0,g=n,p=!1;e.Qt===t&&!(e.Qt instanceof ce)&&!this.V2&&e.getRenderingHint("textGreeking")===!0&&r*this.da*e.scale<3&&(p=!0);let m=this.spacingAbove,y=this.spacingBelow;switch(this.flip){case 0:break;case 2:t.translate(n,0),t.scale(-1,1);break;case 1:t.translate(0,o),t.scale(1,-1);break;case 3:t.translate(n,o),t.scale(-1,-1);break}t.commitTransform();let w=this.ge,b=(m+r+y)*w;if(o>b){let v=this.verticalAlignment;d=v.y*o-v.y*b+v.offsetY}if(w===1&&this.yn!==null){let v=this.ui;v>g&&(v=g),d+=m,this.$A(this.yn,t,c,d,g,r,v,p,a,l,u)}else if(this.Ce!==null&&this.Ti!==null)for(let v=0;v<w;v++){let k=this.Ce[v];k>g&&(k=g),d+=m,this.$A(this.Ti[v],t,c,d,g,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}}$A(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=xt.h1!==null?xt.h1(this,o):o*.75;e.fillText(t,i+c,s+d);let g=o/20|0;if(g===0&&(g=1),h==="right"?c-=r:h==="center"&&(c-=r/2),l){let p=xt.a1!==null?xt.a1(this,o):o*.8;this.ZA(i+c,s+p,i+c+r,s+p,g,e),e instanceof ce&&e.lastCreatedElement.classList.add("gojs-td")}if(u){let p=s+o-o/2.2|0;g%2!==0&&(p+=.5),this.ZA(i+c,p,i+c+r,p,g,e),e instanceof ce&&e.lastCreatedElement.classList.add("gojs-td")}}ZA(t,e,i,s,n,o){o.beginPath(),o.lineWidth=n,o.moveTo(t,e),o.lineTo(i,s),o.stroke(),o.endPath()}Zc(t,e,i){if(!super.Zc(t,e,i))return!1;if(this.rn(t,this.ji,!0,!1,this.naturalBounds,this.actualBounds),i){if(this.svg.getElementsByTagName("text").length===0)return!0;let s=this.svg.getElementsByClassName("gojs-td");for(let n=0;n<s.length;n++)t.setFillOrStrokeInPlace(s[n],!1)}else this.jv(this.svg,this.text,t);return!0}jv(t,e,i){t.innerHTML=e,i.setFillOrStrokeInPlace(t,!0)}$u(t){return this.lineCount>1||this.isUnderline||this.isStrikethrough?!0:super.$u(t)}k2(t,e){if(t.nodeName!=="g")t.setAttributeNS(null,"filter",e);else{let i=t.getElementsByTagName("text");for(let s=0;s<i.length;s++)i[s].setAttributeNS(null,"filter",e)}}Hv(){this.pn=0,this.ui=0,this.io=null,this.Ce=null,this.Ti=null,this.yn=null}Wu(t,e,i,s){let n=this.ge;this.Dl=t,this.$2(!1);let o=this.mn;xt._n!==null&&xt.QA!==o&&(xt._n.font=o,xt.QA=o),this.Hv();let r=0,a=0;isNaN(this.desiredSize.width)?(r=this.qv(),r=Math.min(r,t/this.scale)):r=this.desiredSize.width,this.panel!==null&&(r=Math.min(r,this.panel.maxSize.width)),a=this.JA(r),isNaN(this.desiredSize.height)?a=Math.min(a,e/this.scale):a=this.desiredSize.height,this.Wv(t,a),(this.wrap===1||isNaN(this.desiredSize.width))&&(r=isNaN(t)?this.ui:Math.min(t,this.ui)),r=Math.max(i,r),a=Math.max(s,a),this.zi.Fn(r,a),this.Wn(0,0,r,a),this.svg!==null&&n!==this.ge&&this.Ve(!0)}uh(t,e,i,s){this.commonArrange(t,e,i,s)}xn(t,e){this.yn===null?(this.yn=t,this.ui=e):((this.Ti===null||this.Ce===null)&&(this.Ti=[],this.Ce=[],this.Ti.push(this.yn),this.Ce.push(this.ui)),this.Ti.push(t),this.Ce.push(e),this.Ti.length>this.maxLines&&(this.n|=16777216))}J2(t,e,i){let s=this.formatting===0;s&&(t=t.trim());let n=0,o=0,r=0,a=this.mn,h=this.spacingAbove+this.spacingBelow,l=Math.max(0,this.Np()+h),u=this.overflow===1?this._A(a):0;if(this.ge>=this.maxLines){i!==null&&i.i(0,l);return}let c=t;if(this.wrap===0){if(this.pn=1,o=this.getStringWidth(t),u===0||o<=e){this.ui=Math.max(this.ui,o),this.xn(t,this.ui),i!==null&&i.i(o,l);return}let g=this.xd(c);c=c.substring(g.length);let p=this.xd(c);for(o=this.getStringWidth(g+p),r=0;p.length>0&&o<=e;){g+=p,c=c.substring(p.length),p=this.xd(c),r=o;let m=g+p;s&&(m=m.trim()),o=this.getStringWidth(m)}for(s&&(p=p.trim()),g+=p,e=Math.max(1,e-u);this.getStringWidth(g)>e&&g.length>1;)g=g.substring(0,g.length-1);this.$2(!0),g+=xt.kp,r=this.getStringWidth(g),this.ui=r,this.xn(g,r),i!==null&&i.i(r,l);return}let d=0;for(c.length===0&&(d=1,this.xn(c,0));c.length>0;){let g=this.xd(c);for(c=c.substring(g.length);this.getStringWidth(g)>e;){let y=1;for(o=this.getStringWidth(g.substring(0,y)),r=0;o<=e;)y++,r=o,o=this.getStringWidth(g.substring(0,y));let w=0;y===1?(w=o,n=Math.max(n,o)):(w=r,n=Math.max(n,r)),y--,y<1&&(y=1);let b=g.substring(0,y);if(this.xn(b,w),d++,g=g.substring(y),this.ge+d>this.maxLines)break}let p=this.xd(c);for(o=this.getStringWidth(g+p),r=0;p.length>0&&o<=e;){g+=p,c=c.substring(p.length),p=this.xd(c),r=o;let y=g+p;s&&(y=y.trim()),o=this.getStringWidth(y)}if(s&&(g=g.trim()),g==="")continue;g[g.length-1]==="\xAD"&&(g=g.substring(0,g.length-1)+"\u2010");let m=0;if(p.length===0?(m=o,n=Math.max(n,o)):(r=this.getStringWidth(g),m=r,n=Math.max(n,r)),this.xn(g,m),d++,this.ge+d>this.maxLines)break}this.pn=Math.min(this.maxLines-this.ge,d),this.ui=Math.max(this.ui,n),i!==null&&i.i(this.ui,l*this.pn)}Wv(t,e){if(this.ui===0||this.Ce===null||this.Ti===null||this.overflow!==1)return;let i=this.mn,s=this.overflow===1?this._A(i):0,n=this.spacingAbove+this.spacingBelow,o=Math.max(0,this.Np()+n),r=Math.min(this.maxLines-1,Math.max(Math.floor(e/o+.01)-1,0));if(r+1>=this.Ti.length)return;this.$2(!0);let a=this.Ti[r],h=Math.max(1,t-s);for(;this.getStringWidth(a)>h&&a.length>1;)a=a.substring(0,a.length-1);a+=xt.kp;let l=this.getStringWidth(a);this.Ti[r]=a,this.Ti=this.Ti.slice(0,r+1),this.Ce[r]=l,this.Ce=this.Ce.slice(0,r+1),this.pn=this.Ti.length,this.ui=Math.max(this.ui,l),this.ge=this.pn,this.ge===1&&(this.yn=this.Ti[0])}xd(t){if(this.wrap===3)return t.substring(0,1);let e=t.length,i=0,s=xt.Jv;for(;i<e&&!s.test(t.charAt(i));)i++;for(this.formatting===1&&(e=Math.min(e,i+1));i<e&&s.test(t.charAt(i));)i++;return i>=t.length?t:t.substring(0,i)}getStringWidth(t){return xt._n===null?t.length*8:xt._n.measureText(t).width}Np(){if(this.io!==null)return this.io;let t=this.mn,e=0;return xt._n===null?(e=16,this.io=e,e):(xt.Z2[t]!==void 0&&xt.tT<5e3?e=xt.Z2[t]:(e=xt._n.measureText("M").width*1.3,xt.Z2[t]=e,xt.tT++),this.io=e,e)}_A(t){if(xt._n===null)return 6;let e=0;return xt.l1[t]!==void 0&&xt.W2<5e3?e=xt.l1[t]:(e=xt._n.measureText(xt.kp).width,xt.l1[t]=e,xt.W2++),e}c1(t,e){return t.indexOf(`
|
9
|
+
`+n.toString(t-1)}return i}static TL(t){U.db=t}static um(){return U.db}static fromDiv(t){let e=t;if(typeof t=="string"&&(e=A.document.getElementById(t)),e instanceof HTMLDivElement){let i=U.Qe.get(e);if(i)return i}return null}get div(){return this.Mt}set div(t){if(this.Mt!==t){let e=this.Mt;if(e!==null){if(U.Qe.delete(e),e.goDiagram=void 0,e.go=void 0,e.innerHTML="",this.ft!==null){let s=this.ft.Tt;this.Pi(s,"pointermove",this.na,!1),this.Pi(s,"pointerdown",this.Zl,!1),this.Pi(s,"pointerup",this.oa,!1),this.Pi(s,"pointerout",this.ra,!1),this.Pi(s,"pointercancel",this.la,!1),this.ft.dispose()}this.Ec&&(this.Ec.disconnect(),this.Ec=null);let i=this.toolManager;i!==null&&(i.mouseDownTools.each(s=>s.cancelWaitAfter()),i.mouseMoveTools.each(s=>s.cancelWaitAfter()),i.mouseUpTools.each(s=>s.cancelWaitAfter())),i.cancelWaitAfter(),this.currentTool.doCancel(),this.ft=null,this.Pi(A,"resize",this.ub,!1),this.Pi(A,"wheel",this.sa,!0),U.um()===this&&U.TL(null)}else this.Zl===null&&(this.jn=!1);if(this.Mt=null,t!==null){let i=U.Qe.get(t);i&&(i.div=null),this.AM(t),this.mu(),this.themeManager&&this.themeManager.hR()}else this.themeManager&&this.themeManager.aR()}}setupRouters(){this.Vc.push(new br)}AM(t){let e=this;if(!U.isUsingDOM())return;t==null&&f.o("Diagram setup requires an argument DIV."),e.Mt!==null&&f.o("Diagram has already completed setup."),typeof t=="string"?e.Mt=A.document.getElementById(t):t instanceof HTMLDivElement?e.Mt=t:f.o("No DIV or DIV id supplied: "+t),e.Mt===null&&f.o("Invalid DIV id; could not get element with id: "+t);let i=U.Qe.get(e.Mt);if(i&&i!==this&&f.o("Invalid div id; div already has a Diagram associated with it."),!e.Ec&&A.ResizeObserver){let u=A.ResizeObserver,c=f.Rk(()=>e.requestUpdate(),250,!1);e.Ec=new u(()=>c()),e.Ec.observe(e.Mt)}A.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="",U.Qe.set(e.Mt,e),e.Mt.goDiagram=e,e.Mt.go=A.go;let o=new Ue(e);o.style!==void 0&&(o.style.position="absolute",o.style.top="0px",o.style.left="0px",A.getComputedStyle(e.Mt,null).getPropertyValue("direction")==="rtl"&&(e.zu=!0),o.style.zIndex="2",o.style.userSelect="none",o.style.MozUserSelect="none",o.style.touchAction="none",o.style.letterSpacing="normal !important",o.style.wordSpacing="normal !important",o.style.lang="unknown"),e.ft=o,e.Qt=o.li;let r=e.Qt;e.Vi=e.computePixelRatio(),e.viewSize.isReal()||(e.xt=e.Mt.clientWidth||1,e.bt=e.Mt.clientHeight||1),e.EL(e.xt,e.bt);let a=e;e.Mt.insertBefore(o.Tt,e.Mt.firstChild);let h=new Ue(null);if(h.width=1,h.height=1,e.ZF=h,e.QF=h.li,U.isUsingDOM()){let u=f.hs("div"),c=f.hs("div");u.style.position="absolute",u.style.overflow="auto",u.style.width=e.xt+"px",u.style.height=e.bt+"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=U.cR,u.addEventListener("pointerdown",U.fR),u.N=e,u.uR=!0,u.dR=!0,e.ab=u,e.cb=c}e.mu=f.Rk(()=>{e.Pl=null,e.S()},300,!1),e.ub=f.Rk(()=>{e.IS()},250,!1),e.jh=u=>(u.preventDefault(),!1),e.sa=u=>{if(!a.isEnabled)return;let c=a.zc(u,!0);c.bubbles=!0;let d=0,g=0;c.delta=0,u.deltaX!==void 0?(u.deltaX!==0&&(d=u.deltaX>0?1:-1),u.deltaY!==0&&(g=u.deltaY>0?1:-1),c.delta=Math.abs(u.deltaX)>Math.abs(u.deltaY)?-d:-g):u.wheelDeltaX!==void 0?(u.wheelDeltaX!==0&&(d=u.wheelDeltaX>0?-1:1),u.wheelDeltaY!==0&&(g=u.wheelDeltaY>0?-1:1),c.delta=Math.abs(u.wheelDeltaX)>Math.abs(u.wheelDeltaY)?-d:-g):u.wheelDelta!==void 0&&u.wheelDelta!==0&&(c.delta=u.wheelDelta>0?1:-1),a.doMouseWheel(),a.ha(c,u)},e.LL=u=>{if(!a.isEnabled)return;e.Uc=!1,a.zc(u,!0);let c=a.currentTool;c.cancelWaitAfter(),c.standardMouseOver()},e.Zl=u=>{if(!a.isEnabled)return;e.Uc=!0;let c=a.hb;c[u.pointerId]===void 0&&(c[u.pointerId]=u);let d=a.ea,g=!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,g=!0;else if(d[0]===null)d[0]=u;else if(d[1]===null)d[1]=u,g=!0;else{u.preventDefault();return}let p=u.pointerType==="touch"||u.pointerType==="pen";p&&(a.Bw=!1,a.Hm=!0);let m=a.gR(u,u,g),y=a.bM,w=p?25:10;if(u.timeStamp-a.xM<a.CL&&!(Math.abs(y.x-u.screenX)>w||Math.abs(y.y-u.screenY)>w)?a.jm++:a.jm=1,m.clickCount=a.jm,a.xM=u.timeStamp,a.bM.setTo(u.screenX,u.screenY),a.doMouseDown(),u.button===1){u.preventDefault();return}a.ha(m,u)},e.na=u=>{if(!a.isEnabled)return;e.Uc=!0;let c=a.ea;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.mR(u,u,c[1]!==null);a.doMouseMove(),a.ha(d,u)},e.oa=u=>{if(!a.isEnabled)return;e.Uc=!0;let c=u.pointerType==="touch"||u.pointerType==="pen",d=a.hb;if(c&&a.Bw){delete d[u.pointerId],u.preventDefault();return}let g=a.ea;if(g[0]!==null&&(g[0].pointerId===u.pointerId||g[0].pointerType!==u.pointerType))g[0]=null;else if(g[1]!==null&&g[1].pointerId===u.pointerId){g[1]=null;return}else return;let p=a.TM(u,!1,!0,!1,!0,!1),m=A.document.elementFromPoint(u.clientX,u.clientY)||null;m!==null&&m.shadowRoot!==void 0&&m.shadowRoot!==null&&(m=m.shadowRoot.elementFromPoint(u.clientX,u.clientY)),m!==null&&m.N instanceof U&&m.N!==a&&m.N.Qm(u,p),m===null&&(m=u.target),a.Qm(u,p),p.clickCount=a.jm,p.targetDiagram=a.kb(u,m),p.targetObject=null,a.doMouseUp(),a.ha(p,u),c&&(a.Hm=!1)},e.ra=u=>{if(!a.isEnabled)return;e.Uc=!1;let c=a.hb;c[u.pointerId]&&delete c[u.pointerId];let d=a.ea;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 g=a.currentTool;g.cancelWaitAfter(),g.standardMouseOver()},e.la=u=>{let c=a.ea;c[0]!==null&&c[0].pointerId===u.pointerId?(c[0]=null,a.Hm=!1):c[1]!==null&&c[1].pointerId===u.pointerId&&(c[1]=null)};let l=r;if(e.fb=l.E[f.Ts("7eba17a4ca3b1a8346")][f.Ts("78a118b7")](l.E,U.Xu,s,s),r.clearContextCache(!0),e.pR(),this.Oc==="svg"){let u=this.Wl.get("svg");this.Mt&&this.Mt.appendChild(u.Tt),this.Qt=u.li}}addEventListener(t,e,i,s){t.addEventListener(e,i,{capture:s,passive:!1})}Ut(t,e,i,s){t.addEventListener(e,i,{capture:s,passive:!1})}removeEventListener(t,e,i,s){t.removeEventListener(e,i,{capture:s})}Pi(t,e,i,s){t.removeEventListener(e,i,{capture:s})}pR(){let t=this,e=this.ft.Tt;e instanceof HTMLCanvasElement||(e=t.div),this.Ut(e,"pointerdown",t.Zl,!1),this.Ut(e,"pointermove",t.na,!1),this.Ut(e,"pointerup",t.oa,!1),this.Ut(e,"pointerout",t.ra,!1),this.Ut(e,"pointercancel",t.la,!1),this.Ut(e,"pointerenter",t.yR,!1),this.Ut(e,"pointerleave",t.wR,!1),this.Ut(e,"wheel",t.sa,!1),this.Ut(e,"keydown",t.xR,!1),this.Ut(e,"keyup",t.bR,!1),this.Ut(e,"blur",t.kR,!1),this.Ut(e,"focus",t.PR,!1),this.Ut(e,"selectstart",i=>(i.preventDefault(),!1),!1),this.Ut(e,"contextmenu",i=>(i.preventDefault(),!1),!1),this.Ut(A,"resize",t.ub,!1)}Vw(){this.qm>30&&(this.Pl=1)}CP(t){this.Pl!==null&&(this.Pl=null,t&&this.mu(),this.qm=0,this.SM=[0,0,0,0,0],this.Wm=0)}computePixelRatio(){return this.Pl!==null?this.Pl:A.devicePixelRatio||1}get avgSpf(){return this.qm}doMouseDown(){this.currentTool.doMouseDown()}doMouseMove(){this.currentTool.doMouseMove()}doMouseUp(){this.currentTool.doMouseUp()}doMouseWheel(){this.currentTool.doMouseWheel()}doKeyDown(){this.currentTool.doKeyDown()}doKeyUp(){this.currentTool.doKeyUp()}doFocus(){this.focus()}focus(){if(this.ft)if(this.scrollsPageOnFocus)this.ft.focus();else{let t=A.scrollX,e=A.scrollY;this.ft.focus(),A.scrollTo(t,e)}}PR(t){let e=U.Qe.get(this);e&&e.D("GainedFocus")}kR(t){let e=U.Qe.get(this);e&&e.D("LostFocus")}IS(){if(this.ft===null)return;let t=this.Mt;if(t===null||t.clientWidth===0||t.clientHeight===0)return;this.$S||this.setScrollWidth();let e=this.Kn?this.Wt:0,i=this.ln?this.Wt:0,s=this.Vi;if(this.Vi=this.computePixelRatio(),this.Vi!==s&&(this.Du=!0,this.requestUpdate()),t.clientWidth!==this.xt+e||t.clientHeight!==this.bt+i){this.aa(),this.Ue=!0;let n=this.layout;n!==null&&n.isViewportSized&&this.autoScale===1&&(this.vc=!0,n.invalidateLayout()),this.ys||this.requestUpdate()}}FL(){let t=0,e=new Vt;e.name="Grid",e.allowSelect=!1,e.pickable=!1,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Xr(e,t++),e=new Vt,e.name="ViewportBackground",e.isViewportAligned=!0,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Xr(e,t++),e=new Vt,e.name="Background",this.Xr(e,t++),e=new Vt,e.name="",this.Xr(e,t++),e=new Vt,e.name="Foreground",this.Xr(e,t++),e=new Vt,e.name="ViewportForeground",e.isViewportAligned=!0,e.isTemporary=!0,e.isInDocumentBounds=!1,this.Xr(e,t++),e=new Vt,e.name="Adornment",e.isTemporary=!0,e.isInDocumentBounds=!1,this.Xr(e,t++),e=new Vt,e.name="Tool",e.isTemporary=!0,e.isInDocumentBounds=!0,this.Xr(e,t++)}UL(){let t=new H(H.Grid,{name:"GRID"}).add(new ut("LineH",{stroke:"lightgray",strokeWidth:.5,interval:1}).theme("stroke","gridMinor"),new ut("LineV",{stroke:"lightgray",strokeWidth:.5,interval:1}).theme("stroke","gridMinor"),new ut("LineH",{stroke:"gray",strokeWidth:.5,interval:5}).theme("stroke","gridMajor"),new ut("LineV",{stroke:"gray",strokeWidth:.5,interval:5}).theme("stroke","gridMajor"),new ut("LineH",{stroke:"gray",strokeWidth:1,interval:10}).theme("stroke","gridMajor"),new ut("LineV",{stroke:"gray",strokeWidth:1,interval:10}).theme("stroke","gridMajor")),e=new Nt({layerName:"Grid",zOrder:0,isInDocumentBounds:!1,isAnimated:!1,pickable:!1,locationObjectName:"GRID"}).add(t);return this.add(e),this.partManager.parts.delete(e),t.visible=!1,t}static cR(){let t=U.Qe.get(this.parentElement||this);if(t){if(t.tb){t.tb=!1;return}if(!t.isEnabled){t.BL();return}t.diagramScroll(this)}}static fR(t){if(!this.N.isEnabled){this.N.updateScroll();return}this.N.ib=t.target.scrollTop,this.N.eb=t.target.scrollLeft}diagramScroll(t){if(this.ft===null)return;let e=this.ab,i=this.cb;this.Bm=!0;let s=this.documentBounds,n=this.viewportBounds,o=this.$h,r=s.x-o.left,a=s.y-o.top,h=s.width+o.left+o.right,l=s.height+o.top+o.bottom,u=s.right+o.right,c=s.bottom+o.bottom,d=n.x,g=n.y,p=n.width,m=n.height,y=n.right,w=n.bottom,b=this.scale,v,k=t.scrollLeft;if(this.zu)switch(this.Sx){case"negative":k=k+t.scrollWidth-t.clientWidth;break;case"reverse":k=t.scrollWidth-k-t.clientWidth;break}let S=k;if(p<h||m<l){v=P.V(this.position.x,this.position.y),this.allowHorizontalScroll&&this.eb!==S&&(v.x=S/b+r,this.eb=S),this.allowVerticalScroll&&this.ib!==t.scrollTop&&(v.y=t.scrollTop/b+a,this.ib=t.scrollTop),this.position=v,P.e(v),this.Bm=!1,this.Ou=!1;return}if(v=P.l(),t.uR&&this.allowHorizontalScroll&&(r<d&&(this.position=v.i(S+r,this.position.y)),u>y)){let M=e.scrollWidth-this.xt;this.position=v.i(-M+S-this.xt/b+u,this.position.y)}if(t.dR&&this.allowVerticalScroll&&(a<g&&(this.position=v.i(this.position.x,t.scrollTop+a)),c>w)){let M=e.scrollHeight-this.bt;this.position=v.i(this.position.x,-M+t.scrollTop-this.bt/b+c)}P.e(v),this._l(),this.Bm=!1,this.Ou=!1,s=this.documentBounds,n=this.viewportBounds,u=s.right,y=n.right,c=s.bottom,w=n.bottom,r=s.x,d=n.x,a=s.y,g=n.y,p>=h&&r>=d&&u<=y&&(i.style.width="1px"),m>=l&&a>=g&&c<=w&&(i.style.height="1px")}computeBounds(t){return t===void 0&&(t=new z),this.Mi(),this.VL(t)}VL(t){if(this.fixedBounds.isReal())return t.a(this.fixedBounds),t.addMargin(this.Zt),t;let e=!0,i=this.Xt.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];if(!o.visible||!o.isInDocumentBounds)continue;let r=o.Ct.r,a=r.length;for(let h=0;h<a;h++){let l=r[h];if(!l.isInDocumentBounds||!l.isVisible())continue;let u=l.actualBounds;u.isReal()&&(e?(e=!1,t.a(u)):t.unionRect(u))}}return e&&t.i(0,0,0,0),t.addMargin(this.Zt),t}computePartsBounds(t,e){e===void 0&&(e=!1);let i=null;if(Array.isArray(t))for(let s=0;s<t.length;s++){let n=t[s];!e&&n instanceof _||(n.ensureBounds(),i===null?i=n.actualBounds.copy():i.unionRect(n.actualBounds))}else{let s=t.iterator;for(;s.next();){let n=s.value;!e&&n instanceof _||(n.ensureBounds(),i===null?i=n.actualBounds.copy():i.unionRect(n.actualBounds))}}return i===null?new z(NaN,NaN,0,0):i}Bs(t){if(!t&&!this.jn||this.Ht||this.ft===null||!this.documentBounds.isReal())return;if(this.Ht=!0,t){let c=this.initialPosition;if(c.isReal()){this.Ht=!1,this.position=c;return}let d=this.initialDocumentSpot,g=this.initialViewportSpot;d.isNoSpot()&&(d=D.TopLeft),g.isNoSpot()&&(g=D.TopLeft);let p=P.l();p.setRectSpot(this.documentBounds,d);let m=this.viewportBounds,y=z.V(0,0,m.width,m.height),w=P.l();w.setRectSpot(y,g),w.i(p.x-w.x,p.y-w.y),this.Ht=!1,this.position=w,z.e(y),P.e(w)}let e=this.jl;t&&this.Sr!==1&&(e=this.Sr);let i=e!==1?this.Yu(e):this.scale,s=this.at.x,n=this.at.y,o=this.xt/i,r=this.bt/i,a=this.Fc,h=this.Om;if(t&&!a.isSpot()&&(h.isSpot()||h.isDefault())){let c=this.initialDocumentSpot.isSpot()&&this.initialViewportSpot.isSpot();a=h.isDefault()&&!c?D.Center:h}this.DM(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 z(s,n,o,r),u,l,!1)}Yu(t){let e=this.Km;if(this.ft===null)return e;if(t===1)return this.scale;this.ensureBounds();let i=this.documentBounds;if(!i.isReal())return e;let s=i.width,n=i.height,o=this.xt+(this.Kn?this.Wt:0),r=this.bt+(this.ln?this.Wt:0),a=o/s,h=r/n,l=this.$h,u=l.left+l.right!==0,c=l.top+l.bottom!==0;(u||c)&&(h===a?(h=(r-this.Wt)/n,a=(o-this.Wt)/s):h>a?h=(r-this.Wt)/n:a=(o-this.Wt)/s);let d=0;return t===2?d=Math.min(h,a):t===3&&(h>a?d=(r-this.Wt)/n:d=(o-this.Wt)/s),d>e&&(d=e),d<this.minScale&&(d=this.minScale),d>this.maxScale&&(d=this.maxScale),d}zoomToFit(){let t=this.qh;this.qh=1,this.scale=this.Yu(2),this.alignDocument(D.Center,D.Center),t!==1&&(this.Bs(!1),this.DM(this.documentBounds,this.xt/this.tt,this.bt/this.tt,this.Fc,!1)),this.qh=t}zoomToRect(t,e){e===void 0&&(e=2);let i=t.width,s=t.height;if(i===0||s===0||isNaN(i)&&isNaN(s))return;let n=1;if(e===2||e===3)if(isNaN(i))n=this.viewportBounds.height*this.scale/s;else if(isNaN(s))n=this.viewportBounds.width*this.scale/i;else{let o=this.xt,r=this.bt;e===3?r/s>o/i?n=(r-(this.ln?this.Wt:0))/s:n=(o-(this.Kn?this.Wt:0))/i:n=Math.min(r/s,o/i)}this.scale=n,this.position=new P(t.x,t.y)}get SR(){return this.Ht}set SR(t){this.Ht=t}alignDocument(t,e){this.ensureBounds();let i=this.documentBounds,s=this.viewportBounds;this.position=new P(i.x+(t.x*i.width+t.offsetX)-(e.x*s.width-e.offsetX),i.y+(t.y*i.height+t.offsetY)-(e.y*s.height-e.offsetY))}focusObject(t){if(t instanceof dt){this.Jm=t;let e=P.l();this.$m=this.transformDocToView(t.getDocumentPoint(D.TopLeft,e)),P.e(e)}else this.Jm=null,this.$m=P.Ik}DM(t,e,i,s,n){let o=P.V(this.at.x,this.at.y),r=o.x,a=o.y;if(this.Jm!==null){let h=P.l();h=this.Jm.getDocumentPoint(D.TopLeft,h),r=h.x-this.$m.x/this.scale,a=h.y-this.$m.y/this.scale,s=D.None,P.e(h)}if(n||this.scrollMode===1){s.isSpot()&&(e>t.width&&(r=t.x+(s.x*t.width+s.offsetX)-(s.x*e-s.offsetX)),i>t.height&&(a=t.y+(s.y*t.height+s.offsetY)-(s.y*i-s.offsetY)));let h=this.$h,l=e-t.width;if(e<t.width+h.left+h.right){let 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.Zt.left,o.y=isFinite(a)?a:-this.Zt.top,this.positionComputation!==null){let h=this.positionComputation(this,o);o.x=h.x,o.y=h.y}this.ds.pL(this.at,o),this.at.i(o.x,o.y),this._m(),this.Ql(),this.MR(),P.e(o)}findPartAt(t,e){if(e===void 0&&(e=!0),e){let i=this.FP(t,s=>s.part,s=>s.canSelect());if(i instanceof Nt)return i}else{let i=this.FP(t,s=>s.part);if(i instanceof Nt)return i}return null}findObjectAt(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null),this.Mi();let s=this.Xt.iteratorBackwards;for(;s.next();){let n=s.value;if(!n.visible)continue;let o=n.findObjectAt(t,e,i);if(o!==null)return o}return null}FP(t,e,i){e===void 0&&(e=null),i===void 0&&(i=null),this.Mi();let s=this.Xt.iteratorBackwards;for(;s.next();){let n=s.value;if(!n.visible||n.isTemporary)continue;let o=n.findObjectAt(t,e,i);if(o!==null)return o}return null}findPartsAt(t,e,i){return e===void 0&&(e=!0),this.NR(t,s=>s.part,e?s=>s instanceof Nt&&s.canSelect():null,i)}NR(t,e,i,s){e===void 0&&(e=null),i===void 0&&(i=null),!(s instanceof j)&&!(s instanceof I)&&(s=new I),this.Mi();let n=this.Xt.iteratorBackwards;for(;n.next();){let o=n.value;!o.visible||o.isTemporary||o.findObjectsAt(t,e,i,s)}return s}findObjectsAt(t,e,i,s){e===void 0&&(e=null),i===void 0&&(i=null),!(s instanceof j)&&!(s instanceof I)&&(s=new I),this.Mi();let n=this.Xt.iteratorBackwards;for(;n.next();){let o=n.value;o.visible&&o.findObjectsAt(t,e,i,s)}return s}findPartsIn(t,e,i,s){return e===void 0&&(e=!1),i===void 0&&(i=!0),this.CR(t,null,n=>n instanceof Nt&&(!i||n.canSelect()),e,s)}findObjectsIn(t,e,i,s,n){e===void 0&&(e=null),i===void 0&&(i=null),s===void 0&&(s=!1),!(n instanceof j)&&!(n instanceof I)&&(n=new I),this.Mi();let o=this.Xt.iteratorBackwards;for(;o.next();){let r=o.value;r.visible&&r.findObjectsIn(t,e,i,s,n)}return n}OP(t,e,i,s,n,o){let r=new I;this.Mi();let a=this.Xt.iteratorBackwards;for(;a.next();){let h=a.value;h.visible&&h.OP(t,e,i,s,r,n,o)}return r}CR(t,e,i,s,n){e===void 0&&(e=null),i===void 0&&(i=null),s===void 0&&(s=!1),!(n instanceof j)&&!(n instanceof I)&&(n=new I),this.Mi();let o=this.Xt.iteratorBackwards;for(;o.next();){let r=o.value;!r.visible||r.isTemporary||r.findObjectsIn(t,e,i,s,n)}return n}findPartsNear(t,e,i,s,n){return i===void 0&&(i=!0),s===void 0&&(s=!0),this.LR(t,e,null,o=>o instanceof Nt&&(!s||o.canSelect()),i,n)}findObjectsNear(t,e,i,s,n,o){i===void 0&&(i=null),s===void 0&&(s=null),n===void 0&&(n=!0),n!==!1&&n!==!0&&((n instanceof j||n instanceof I)&&(o=n),n=!0),!(o instanceof j)&&!(o instanceof I)&&(o=new I),this.Mi();let r=this.Xt.iteratorBackwards;for(;r.next();){let a=r.value;a.visible&&a.findObjectsNear(t,e,i,s,n,o)}return o}LR(t,e,i,s,n,o){i===void 0&&(i=null),s===void 0&&(s=null),n===void 0&&(n=!0),n!==!1&&n!==!0&&((n instanceof j||n instanceof I)&&(o=n),n=!0),!(o instanceof j)&&!(o instanceof I)&&(o=new I),this.Mi();let r=this.Xt.iteratorBackwards;for(;r.next();){let a=r.value;!a.visible||a.isTemporary||a.findObjectsNear(t,e,i,s,n,o)}return o}acceptEvent(t){return this.zc(t,t instanceof MouseEvent)}zc(t,e){let i=this.Br;this.Br=this._h,this._h=i,i.diagram=this,i.event=t,e?this.Qm(t,i):(i.viewPoint=this.Br.viewPoint,i.documentPoint=this.Br.documentPoint);let s=0,n=t;return n.ctrlKey&&(s+=1),n.altKey&&(s+=2),n.shiftKey&&(s+=4),n.metaKey&&(s+=8),i.modifiers=s,i.button=n.button,n.buttons!==void 0&&(i.buttons=n.buttons),f.tr&&n.button===0&&n.ctrlKey&&(i.button=2),i.down=!1,i.up=!1,i.clickCount=1,i.delta=0,i.handled=!1,i.bubbles=!1,i.timestamp=t.timeStamp,i.isMultiTouch=!1,i.targetDiagram=this.kb(t,t.target),i.targetObject=null,i}kb(t,e){if(e===null)return null;let i=U.Qe.get(e);if(i)return i;let s=t.path;if(!s&&f.it(t.composedPath)&&(s=t.composedPath()),s&&s[0]){let n=U.Qe.get(s[0]);if(n)return n}return null}gR(t,e,i){let s=this.TM(t,!0,!1,!1,!0,i);return this.Qm(e,s),s.targetDiagram=this.kb(t,t.target),s.targetObject=null,i||s.clone(this.Gm),s}mR(t,e,i){let s=this.TM(t,!1,!1,!1,!1,i),n=A.document.elementFromPoint(e.clientX,e.clientY)||null;n!==null&&n.shadowRoot!==void 0&&n.shadowRoot!==null&&(n=n.shadowRoot.elementFromPoint(e.clientX,e.clientY));let o=this,r=t;if(n){let a=this.kb(t,n);a&&(r=e,o=a)}return s.targetDiagram=o,this.Qm(r,s),s.targetObject=null,s}TM(t,e,i,s,n,o){let r=this.Br;this.Br=this._h,this._h=r,r.diagram=this,r.clickCount=1,r.delta=0;let a=0;return t.ctrlKey&&(a+=1),t.altKey&&(a+=2),t.shiftKey&&(a+=4),t.metaKey&&(a+=8),r.modifiers=a,r.event=t,r.timestamp=t.timeStamp,r.button=i?this.firstInput.button:t.button,r.buttons=t.buttons,f.tr&&t.button===0&&t.ctrlKey&&(r.button=2),r.down=e,r.up=i,r.handled=s,r.bubbles=n,r.isMultiTouch=o,r}ha(t,e){return t.bubbles?!0:(e.stopPropagation!==void 0&&e.stopPropagation(),e.cancelable!==!1&&e.preventDefault(),e.cancelBubble=!0,!1)}xR(t){let e=U.Qe.get(this);if(!e||!e.isEnabled)return!1;let i=e.zc(t,!1);return i.key=t.key,i.code=t.code,i.down=!0,e.doKeyDown(),e.ha(i,t)}bR(t){let e=U.Qe.get(this);if(!e||!e.isEnabled)return!1;let i=e.zc(t,!1);return i.key=t.key,i.code=t.code,i.up=!0,e.doKeyUp(),e.ha(i,t)}yR(t){let e=U.Qe.get(this);if(!e||!e.isEnabled)return!1;let i=e.zc(t,!0);return e.mouseEnter!==null&&e.mouseEnter(i),e.currentTool.standardMouseOver(),e.ha(i,t)}wR(t){let e=U.Qe.get(this);if(!e||!e.isEnabled)return!1;let i=e.zc(t,!0);return e.mouseLeave!==null&&e.mouseLeave(i),e.ha(i,t)}getMouse(t){let e=this.ft;if(e===null)return new P(0,0);let i=e.getBoundingClientRect(),s=(t.clientX-i.left)*(this.xt/i.width),n=(t.clientY-i.top)*(this.bt/i.height);return new P(s,n).Oe(this.T)}Qm(t,e){let i=this.ft,s=0,n=0;if(i!==null){let r=i.getBoundingClientRect();s=(t.clientX-r.left)*(this.xt/r.width),n=(t.clientY-r.top)*(this.bt/r.height)}e.viewPoint.i(s,n);let o=P.V(s,n);this.T.$e(o),e.documentPoint.a(o),P.e(o)}BC(t,e,i){let s;if(this.ea[0]!==null)s=this.ea[e];else return;let n=this.ft;if(n!==null){let o=n.getBoundingClientRect();i.i((s.clientX-o.left)*(this.xt/o.width),(s.clientY-o.top)*(this.bt/o.height))}}invalidateDocumentBounds(){this.ta||(this.ta=!0,this.requestUpdate(!1))}AR(){this.ys||this.Mi(),this.ensureBounds()}redraw(){this.Ht||this.ys||(this.S(),this.maybeUpdate())}isUpdateRequested(){return this.xr}delayInitialization(t){t===void 0&&(t=null);let e=this.animationManager,i=e.isEnabled;e.stopAnimation(),e.isEnabled=!1,this.ur(),this.jn=!1,this.nx=new P(NaN,NaN),e.isEnabled=i,this.ys=!0;let s=this;t!==null&&f.ir(()=>{s.ys=!1,e.Fl("Model"),t(s)},1)}requestUpdate(t){if(t===void 0&&(t=!1),this.xr===!0||this.Ht||t===!1&&this.ys)return;this.xr=!0;let e=this;A.requestAnimationFrame(()=>{e.xr&&e.maybeUpdate()})}maybeUpdate(){this.Fu&&!this.xr||(this.Fu&&(this.Fu=!1),this.ur())}FM(t,e){!this.Ou||this.Ht||this.animationManager.defaultAnimation.isAnimating||this.BL()||(t&&this.Mi(),e&&this.Bs(!1))}ur(t){if(this.ys||(this.xr=!1,this.Mt===null&&!this.Iu.isReal()))return;this.ys=!0;let e=this.animationManager,i=this.Vu;if(!e.isAnimating&&i.length!==0){let u=i.r,c=u.length;for(let d=0;d<c;d++){let g=u[d];g.ue(!1),g.c()}i.clear()}let s=this.wM;s.count>0&&(s.each(u=>u.RM()),s.clear());let n=!1,o=!1;e.defaultAnimation.isAnimating&&(o=!0,n=this.skipsUndoManager,this.skipsUndoManager=!0),e.pi||this.IS(),t||this.FM(!1,!0);let r=!this.undoManager.isUndoingRedoing&&(this.bl||this.Vc.count!==0&&this.Mr.size!==0),a=!this.jn||this.Vr;this.Mi(!0);let h=!1;(a||r)&&(this.jn?this.vM(!this.vc,r):(this.startTransaction("Initial Layout"),e.isEnabled===!1&&e.stopAnimation(),this.vM(!1,r)),h=a),this.vc=!1,this.bl=!1,this.Mi(),this.Ze!==null&&(this.Ze.visible&&!this.Eu&&(this.th(),this.Eu=!0),!this.Ze.visible&&this.Eu&&(this.Eu=!1)),this.Yx||this.AR(),t||this.FM(!0,!1);let l=!1;if(h){let u=z.l();u.a(this.viewportBounds),this.jn||(this.jn=!0,l=!0,this.skipsUndoManager||(this.undoManager.Ew=!0),this.undoManager.Uw=!0,this.TR()),this.DR(),this.Mi(!1),t||this.FM(!0,!0),z.e(u)}else if(e.Sc&&e.ex){if(this.Sr!==1)this.scale=this.Yu(this.Sr);else if(this.jl!==1)this.scale=this.Yu(this.jl);else{let u=this.initialScale;isFinite(u)&&u>0&&(this.scale=u)}this.Bs(!0)}h&&l&&this.commitTransaction("Initial Layout"),t||this.Ui(this.Qt),o&&(this.skipsUndoManager=n),this.ys=!1}get Vh(){return this.jn}TR(){if(this.Sr!==1)this.scale=this.Yu(this.Sr);else if(this.jl!==1)this.scale=this.Yu(this.jl);else{let e=this.initialScale;isFinite(e)&&e>0&&(this.scale=e)}this.Bs(!0);let t=this.Xt.r;this.ps(t,t.length,this,this.viewportBounds),this.D("InitialLayoutCompleted"),this.nx.a(this.at),this.th()}DR(){this.D("LayoutCompleted")}t0(t){this.Yn.add(t)}addInvalidRoute(t){this.Co?this.Zh.add(t):this.Mr.add(t)}Mi(t){if(this.Yn.size!==0&&!(!this.ys&&this.animationManager.isTicking)){if(this.ys||(this.bl=!0),t){this.zL(this.Yn);return}for(let e=0;e<23&&this.Yn.size!==0;e++){let i=new Set(this.Yn);this.Yn.clear(),this.RM(i,this.Yn)}this.nodes.each(e=>{e instanceof ft&&e.XL(!1)})}}zL(t,e){for(let i of t)!i.ke()||i instanceof ft||(i.Yr()?(i.ht(1/0,1/0),i.Bt()):e&&e.add(i));for(let i of t)if(i instanceof ft){if(!i.isVisible())continue;this.Pb(i)}}RM(t,e){this.zL(t,e);for(let i of t){if(!(i instanceof _))continue;let s=i;s.isVisible()&&(s.Yr()?(s.ht(1/0,1/0),s.Bt()):e.add(s))}for(let i of t)i instanceof St&&i.isVisible()&&(i.Yr()?(i.ht(1/0,1/0),i.Bt()):e.add(i))}i0(t){let e=t instanceof U,i=e?t.links:t.memberParts,s=this.Yn;if(e)this.Mi(!0);else{for(;i.next();){let n=i.value;s.has(n)&&(!n.ke()||n instanceof ft||n.Yr()&&(n.ht(1/0,1/0),n.Bt()))}for(i.reset();i.next();){let n=i.value;if(s.has(n)&&n instanceof ft){if(!n.isVisible())continue;this.Pb(n)}}i.reset()}for(;i.next();){let n=i.value;n instanceof _&&s.has(n)&&n.isVisible()&&n.Yr()&&(n.ht(1/0,1/0),n.Bt())}}Pb(t){let e=f.et(),i=f.et(),s=t.memberParts;for(;s.next();){let o=s.value;o.isVisible()&&(o instanceof ft?(o.To()||o._e()||o.ih())&&this.Pb(o):o instanceof _?o.fromNode===t||o.toNode===t?i.push(o):e.push(o):(o.ht(1/0,1/0),o.Bt()))}let n=e.length;for(let o=0;o<n;o++){let r=e[o];r.ht(1/0,1/0),r.Bt()}f.J(e),t.ht(1/0,1/0),t.Bt(),n=i.length;for(let o=0;o<n;o++){let r=i[o];r.ht(1/0,1/0),r.Bt()}f.J(i)}ps(t,e,i,s){if(!(!this.Ic&&!this.animationManager.isAnimating)){for(let n=0;n<e;n++)t[n].ps(i,s);this.Mi()}}Ui(t){this.Mt!==null&&(this.ft===null&&f.o("No canvas specified"),this.Oc==="svg"?this.FR(t):this.RR(t))}RR(t){let e=this.animationManager;if(e.pi||e.isAnimating&&!e.isTicking)return;let i=new Date;if(this.e0(),this.Mt&&this.Mt.style.opacity==="0")return;let s=t!==this.Qt,n=this.Xt.r,o=n.length,r=this;if(this.ps(n,o,r,r.viewportBounds),s)t.clearContextCache(!0),this._l();else if(!this.Ue&&!e.isAnimating)return;let a=this.T,h=this.Vi;t.setTransform(h,0,0,h,0,0),t.clearRect(0,0,this.xt,this.bt),this.$t!==1&&(t.globalAlpha=this.$t),this.OM(t);for(let g=0;g<o;g++)t.setTransform(h,0,0,h,0,0),t.transform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),t.commitTransform(),n[g].Ui(t,r);let l=!1;this.Bc?this.Bc.Xu(this)&&(l=this.fb()):l=!0,l&&(Pt.prototype.$e=Pt.prototype.kw),s?(this.Qt.clearContextCache(!0),this._l()):(this.Ic=!1,this.Ue=!1);let u=+new Date-+i,c=!1,d=this.SM;if(c||this.Pl===null){d[this.Wm]=u,this.Wm=(this.Wm+1)%d.length;let g=0;for(let p=0;p<d.length;p++)g+=d[p];this.qm=g/d.length}if(this.$t!==1&&(t.globalAlpha=1),c){t.setTransform(1,0,0,1,0,0);for(let g=0;g<d.length;g++)t.fillText(d[g].toString(),20,150+ +(g*20))}}FR(t){if(this.Mt===null)return;let e=this.animationManager;if(e.pi||e.isAnimating&&!e.isTicking)return;this.e0();let i=this.xt,s=this.bt;t.surface.resize(i,s,i,s);let n=this.Xt.r,o=n.length,r=this;if(this.ps(n,o,r,r.viewportBounds),!this.Ue&&!e.isAnimating)return;let a=this.T;t.lastDrawnPart=null,t.setDiagramPosScale(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy),this.$t!==1&&(t.globalAlpha=this.$t),this.OM(t);let h=this.Vi;this.ft.li.setTransform(h,0,0,h,0,0),this.ft.li.clearRect(0,0,this.xt,this.bt);for(let u=0;u<o;u++)n[u].Ui(t,r);let l=!1;this.Bc?this.Bc.Xu(this)&&(l=this.fb()):l=!0,l&&(Pt.prototype.$e=Pt.prototype.kw),this.Ic=!1,this.Ue=!1}Sb(t,e,i,s,n,o,r,a,h){if(this.Mt===null)return;this.ft===null&&f.o("No canvas specified"),o===void 0&&(o=null),r===void 0&&(r=null),a===void 0&&(a=!1),h===void 0&&(h=!1),this.e0(),this.Qt.clearContextCache(!0),this._l(),this.ia=!0;let l=this.tt;this.tt=s;let u=this,c=this.Xt.r,d=c.length;try{let g=new z(n.x,n.y,i.width/s,i.height/s),p=g.copy();p.addMargin(e),this.th(p),this.Mi(),this.ps(c,d,u,g),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,i.width,i.height),r!==null&&r!==""&&(t.fillStyle=r,t.fillBackground(0,0,i.width,i.height));let m=this.Vi;t.scale(m,m);let y=Pt.l();y.Ri(),y.Fs(e.left,e.top),y.tt(s),(n.x!==0||n.y!==0)&&y.Fs(-n.x,-n.y),t.setTransform(y.m11,y.m12,y.m21,y.m22,y.dx,y.dy),t.commitTransform(),t instanceof ce&&t.setDiagramPosScale(y.m11,y.m12,y.m21,y.m22,y.dx,y.dy),Pt.e(y),this.OM(t),t.globalAlpha=this.$t;let w=this.findLayer("Grid");if(o){let b=new I,v=o.iterator;for(v.reset();v.next();){let k=v.value;k instanceof Nt&&(!h&&k.layer===w||(k.Au(),b.add(k)))}for(let k=0;k<d;k++)c[k].GF(t,u,b,a);b.each(k=>k.Au())}else for(let b=0;b<d;b++){let v=c[b];v===w?h&&v.Ui(t,u,!0):v.Ui(t,u,a)}this.ia=!1,this.Bc&&this.Bc.Xu(this)&&this.fb()}finally{this.tt=l,this.Qt.clearContextCache(!0),this._l(),this.ps(c,d,u,u.viewportBounds),this.th(),this.Qt instanceof ce&&(this.Qt.diagramGroup.replaceChildren(),this.redraw())}}getRenderingHint(t){return this.Pr[t]}setRenderingHint(t,e){t==="minDrawingLength"&&(this.Fm=e),this.Pr[t]=e,this.redraw()}resetRenderingHints(){this.Pr=new q,this.Pr.drawShadows=!0,this.Pr.textGreeking=!0,this.Pr.viewportOptimizations=!f.tr,this.Pr.temporaryPixelRatio=!0,this.Pr.pictureRatioOptimization=!0,this.Pr.minDrawingLength=1,this.Fm=1}OM(t){let e=this.Pr;if(e===null)return;if(e.imageSmoothingEnabled!==void 0){let s=!!e.imageSmoothingEnabled;t.setImageSmoothingEnabled(s)}let i=e.defaultFont;i!=null&&(t.font=i)}getInputOption(t){return this.Tu[t]}setInputOption(t,e){this.Tu[t]=e}oR(){this.Tu=new q,this.Tu.extraTouchArea=10,this.Tu.extraTouchThreshold=10,this.Tu.hasGestureZoom=!0}set(t){return Object.assign(this,t),this}attach(t){return this.setProperties(t)}setProperties(t){return U.s0(this,t),this}static s0(t,e){let i=t instanceof H,s=t instanceof U;for(let n in e){n===""&&f.o("Setting properties requires non-empty property names");let o=t,r=n;if(i||s){let h=n.indexOf(".");if(h>0){let l=n.substring(0,h);i?o=t.findObject(l):(o=t[l],o==null&&(o=t.toolManager[l])),f.G(o)?r=n.substring(h+1):f.o("Unable to find object named: "+l+" in "+t.toString()+" when trying to set property: "+n)}}if(r[0]!=="_"&&!f.gw(o,r))if(s&&r==="ModelChanged"){t.addModelChangedListener(e[r]);continue}else if(s&&r==="Changed"){t.addChangedListener(e[r]);continue}else if(s&&f.gw(t.toolManager,r))o=t.toolManager;else if(s&&t.YL(r)){t.addDiagramListener(r,e[r]);continue}else if(t instanceof yt&&r==="Changed"){t.addChangedListener(e[r]);continue}else f.o('Trying to set undefined property "'+r+'" on object: '+o.toString());let a=e[n];o[r]=a,r[0]==="_"&&o instanceof dt&&o.addCopyProperty(r)}}xL(){if(this.$l.count!==0&&!(this.undoManager.transactionLevel>1)){for(;this.$l.count>0;){let t=this.$l;this.$l=new pt;let e=t.iterator;for(;e.next();){let i=e.key;i.invalidateOtherJumpOvers(e.value),i.ee()}}this.S()}}S(t){if(t===void 0)this.Ue=!0,this.requestUpdate();else{let e=this.viewportBounds;t.isReal()&&e.intersectsRect(t)&&(this.Ue=!0,this.requestUpdate())}this.D("InvalidateDraw")}invalidateViewport(t,e){if(this.Ue!==!0){if(this.Ue=!0,this.Oc==="svg"){this.maybeUpdate();return}this.getRenderingHint("temporaryPixelRatio")===!0?(this.Vw(),this.maybeUpdate(),this.CP(!0)):this.maybeUpdate()}}aa(){this.Ou=!0}_l(){this.Ic=!0}e0(){this.Du!==!1&&(this.Du=!1,this.EL(this.xt,this.bt))}EL(t,e){this.Ql();let i=this.Vi,s=t*i,n=e*i;this.ft.resize(s,n,t,e)&&(this.Ue=!0,this.Qt.clearContextCache(!0))}BL(){let t=this.ft;if(t===null||this.Iu.isReal())return!0;let e=this.xt,i=this.bt,s=this.Mt,n=!1,o=this.Kn?this.Wt:0,r=this.ln?this.Wt:0,a=s.clientWidth||e+o,h=s.clientHeight||i+r,l=this.viewportBounds,u=l.x,c=l.y,d=l.width,g=l.height;if((a!==e+o||h!==i+r)&&(this.Kn=!1,this.ln=!1,o=0,r=0,this.xt=a,this.bt=h,this.Du=!0,n=!0,this.Ql()),!this.jn||!this.viewportBounds.isReal())return!0;let p=this.ab,m=this.cb;if(this.Ou=!1,!n&&!this.Kn&&!this.ln&&!this.Ru&&!this.vu)return!0;let y=this.documentBounds,w=0,b=0,v=0,k=0,S=l.width,M=l.height,F=this.$h;this.contentAlignment.isSpot()?(y.width>S&&(w=F.left,b=F.right),y.height>M&&(v=F.top,k=F.bottom)):(w=F.left,b=F.right,v=F.top,k=F.bottom);let T=y.width+w+b,N=y.height+v+k,C=this.scale,R=C,O=T>a/C,B=N>h/C;if(!n&&!this.Kn&&!this.ln&&!O&&!B)return!0;let K=y.x-w,Y=l.x,X=y.right+b,G=l.right+o,nt=y.y-v,at=l.y,tt=y.bottom+k,st=l.bottom+r,et="1px",ct="1px";if(this.scrollMode===1&&(O||B)){if(O&&this.hasHorizontalScrollbar&&this.allowHorizontalScroll){let ot=1;K+1<Y&&(ot=Math.max((Y-K)*C+this.xt,ot)),X>G+1&&(ot=Math.max((X-G)*C+this.xt,ot)),S+o+1<T&&(ot=Math.max((T-S)*C+this.xt,ot)),et=ot.toString()+"px"}if(B&&this.hasVerticalScrollbar&&this.allowVerticalScroll){let ot=1;nt+1<at&&(ot=Math.max((at-nt)*C+this.bt,ot)),tt>st+1&&(ot=Math.max((tt-st)*C+this.bt,ot)),M+r+1<N&&(ot=Math.max((N-M)*C+this.bt,ot)),ct=ot.toString()+"px"}}let gt=et!=="1px",wt=ct!=="1px";if(!(gt&&wt)&&(gt||wt)){if(O=!(T<S+o),B=!(N<M+r),wt&&(G-=this.Wt),gt&&(st-=this.Wt),O&&this.hasHorizontalScrollbar&&this.allowHorizontalScroll){let Mt=1;K+1<Y&&(Mt=Math.max((Y-K)*C+this.xt,Mt)),X>G+1&&(Mt=Math.max((X-G)*C+this.xt,Mt)),S+1<T&&(Mt=Math.max((T-S)*C+this.xt,Mt)),et=Mt.toString()+"px"}gt=et!=="1px";let ot=this.bt;if(gt!==this.ln&&(ot=gt?this.bt-this.Wt:this.bt+this.Wt),B&&this.hasVerticalScrollbar&&this.allowVerticalScroll){let Mt=1;nt+1<at&&(Mt=Math.max((at-nt)*C+ot,Mt)),tt>st+1&&(Mt=Math.max((tt-st)*C+ot,Mt)),M+1<N&&(Mt=Math.max((N-M)*C+ot,Mt)),ct=Mt.toString()+"px"}wt=ct!=="1px"}if(this.Bm&&!(gt!==this.ln||wt!==this.Kn))return(e!==this.xt||i!==this.bt)&&this.maybeUpdate(),!1;if(gt!==this.ln&&(et==="1px"?this.bt=this.bt+this.Wt:this.bt=Math.max(this.bt-this.Wt,1),n=!0),this.ln=gt,m.style.width=et,wt!==this.Kn&&(ct==="1px"?this.xt=this.xt+this.Wt:this.xt=Math.max(this.xt-this.Wt,1),n=!0,this.zu)){let ot=P.l();wt?(t.style.left=this.Wt+"px",this.position=ot.i(this.at.x+this.Wt/this.scale,this.at.y)):(t.style.left="0px",this.position=ot.i(this.at.x-this.Wt/this.scale,this.at.y)),P.e(ot)}n&&this.Ql(),this.Kn=wt,m.style.height=ct,this.tb=!0,n&&(this.Du=!0);let Ct=p.scrollLeft;if(this.hasHorizontalScrollbar&&this.allowHorizontalScroll&&(S+1<T?Ct=(this.position.x-K)*C:K+1<Y?Ct=p.scrollWidth-p.clientWidth:X>G+1&&(Ct=this.position.x*C)),this.zu)switch(this.Sx){case"negative":Ct=-(p.scrollWidth-Ct-p.clientWidth);break;case"reverse":Ct=p.scrollWidth-Ct-p.clientWidth;break}if(p.scrollLeft=Ct,this.hasVerticalScrollbar&&this.allowVerticalScroll&&(M+1<N?p.scrollTop=(this.position.y-nt)*C:nt+1<at?p.scrollTop=p.scrollHeight-p.clientHeight:tt>st+1&&(p.scrollTop=this.position.y*C)),a=this.xt,h=this.bt,p.style.width=a+(this.Kn?this.Wt:0)+"px",p.style.height=h+(this.ln?this.Wt:0)+"px",e!==a||i!==h||this.animationManager.pi){let ot=z.V(u,c,d,g);return this.onViewportBoundsChanged(ot,this.viewportBounds,R,n),z.e(ot),!1}return!0}add(t){let e=t.diagram;if(e===this)return;e!==null&&f.o("Cannot add part "+t.toString()+" to "+this.toString()+". It is already a part of "+e.toString());let i=this.findLayer(t.layerName);if(i===null&&(i=this.findLayer("")),i===null&&f.o('Cannot add a Part when unable find a Layer named "'+t.layerName+'" and there is no default Layer'),t.layer===i)return;let s=i.Jh(99999999,t,t.diagram===this);s>=0&&this.raiseChangedEvent(3,"parts",i,null,t,null,s),i.isTemporary||this.invalidateDocumentBounds(),t.invalidateLayout(1);let n=t.layerChanged;n!==null&&n(t,null,i)}Jh(t){this.partManager.Jh(t);let e=this;t.Gr(i=>e.GL(i)),t.data||t.Do(),t.hasPlaceholder()&&t.c(),t.data!==null&&t.Gr(i=>e.partManager.IM(i,null)),(t._e()===!0||t.ih()===!0)&&this.t0(t),t.KL(!0,this),t.jL()?(t.actualBounds.isReal()&&this.S(t.Wh(t.actualBounds)),this.invalidateDocumentBounds()):t.isVisible()&&t.actualBounds.isReal()&&this.S(t.Wh(t.actualBounds)),this.requestUpdate()}te(t){t.clearAdornments(),this.partManager.te(t);let e=this;t.data!==null&&t.Gr(i=>e.partManager.EM(i,e)),this.Yn.delete(t),t instanceof _&&this.Mr.delete(t),t.jL()?(t.actualBounds.isReal()&&this.S(t.Wh(t.actualBounds)),this.invalidateDocumentBounds()):t.isVisible()&&t.actualBounds.isReal()&&this.S(t.Wh(t.actualBounds)),this.requestUpdate()}remove(t){this.UM(t,!0)}UM(t,e){let i=t.layer;if(i===null||i.diagram!==this)return;t.isSelected=!1,t.isHighlighted=!1,t.invalidateLayout(2),e&&t.Xc();let s=i.te(-1,t,!1);s>=0&&this.raiseChangedEvent(4,"parts",i,t,null,s,null);let n=t.layerChanged;n!==null&&n(t,i,null)}removeParts(t,e){if(e===void 0&&(e=!1),Array.isArray(t)){let i=t.length;for(let s=0;s<i;s++){let n=t[s];e&&!n.canDelete()||this.remove(n)}}else{let i=new I;i.addAll(t);let s=i.iterator;for(;s.next();){let n=s.value;e&&!n.canDelete()||this.remove(n)}}}copyParts(t,e,i){i===void 0&&(i=!1);let s=null,n=e||this,o=n.model,r=!1,a=!1;try{o.pm()&&(r=o.copiesParentKeyOfNodeData,o.copiesParentKeyOfNodeData=n.commandHandler.copiesParentKey),(o.mm()||o.Mb())&&(a=o.copiesGroupKeyOfNodeData,o.copiesGroupKeyOfNodeData=n.commandHandler.copiesGroupKey),s=this.partManager.copyParts(t,e,i)}finally{o.pm()&&(o.copiesParentKeyOfNodeData=r),(o.mm()||o.Mb())&&(o.copiesGroupKeyOfNodeData=a)}return s}moveParts(t,e,i,s){if(i===void 0&&(i=!1),s===void 0&&(s=this.o0()),this.toolManager===null)return;let n=new pt;if(t!==null)if(Array.isArray(t))for(let o=0;o<t.length;o++)this.Kr(n,t[o],i,s);else{let o=t.iterator;for(;o.next();)this.Kr(n,o.value,i,s)}else{let o=this.parts;for(;o.next();){let r=o.value;this.Kr(n,r,i,s)}for(o=this.nodes;o.next();){let r=o.value;this.Kr(n,r,i,s)}for(o=this.links;o.next();){let r=o.value;this.Kr(n,r,i,s)}}this.TP(n,e,s,i)}Kr(t,e,i,s,n){if(!t.has(e)&&(n===void 0&&(n=!1),!(i&&!n&&!e.canMove()&&!e.canCopy())))if(s===void 0&&(s=this.o0()),e instanceof rt){if(t.set(e,this.Es(s,e,e.location)),e instanceof ft&&(e.hasPlaceholder()||s.dragsMembers)){let r=e.memberParts;for(;r.next();){let a=r.value;this.Kr(t,a,i,s,s.groupsAlwaysMove)}}let o=e.linksConnected;for(;o.next();){let r=o.value;if(t.has(r))continue;let a=r.fromNode,h=r.toNode;a!==null&&t.has(a)&&h!==null&&t.has(h)&&this.Kr(t,r,i,s)}if(s.dragsTree){let r=e.findTreeChildrenNodes();for(;r.next();){let a=r.value;this.Kr(t,a,i,s)}}}else if(e instanceof _){t.set(e,this.Es(s,e));let o=e.labelNodes;for(;o.next();){let r=o.value;this.Kr(t,r,i,s)}}else e instanceof St||t.set(e,this.Es(s,e,e.location))}TP(t,e,i,s){if(t===null||t.count===0)return;let n=P.l(),o=P.l();o.a(e),isNaN(o.x)&&(o.x=0),isNaN(o.y)&&(o.y=0);let r=this.gb;r||this.WC(t);let a=f.et(),h=f.et(),l=t.iterator,u=P.l();for(;l.next();){let m=l.key,y=l.value;if(m.ke()){let w=this.HL(m,t);if(w!==null)a.push(new tr(m,y,w));else if(!s||m.canMove()){let b=y.point;n.a(b),this.computeMove(m,n.add(o),i,u),m.location=u,y.shifted===void 0&&(y.shifted=new P),y.shifted.a(u.subtract(b))}}else l.key instanceof _&&h.push(new Ut(l.key,l.value))}P.e(u);let c=a.length;for(let m=0;m<c;m++){let y=a[m],w=y.qL.point;n.a(w),y.Nb.shifted===void 0&&(y.Nb.shifted=new P),y.Me.location=n.add(y.Nb.shifted)}let d=P.l(),g=P.l(),p=h.length;for(let m=0;m<p;m++){let y=h[m],w=y.key;if(w instanceof _){if(w.suspendsRouting){w.br=null;let b=w.fromNode,v=w.toNode;if(this.draggedLink!==null&&i.dragsLink){let k=y.value.point;if(w.dragComputation===null){t.set(w,this.Es(i,w,o));let S=o.x-k.x,M=o.y-k.y;w.fr(S,M)}else{let S=P.V(0,0),M=w.getPoint(0);M&&M.isReal()&&S.a(M),u=P.l().a(S).add(o);let F=u;i.isGridSnapEnabled&&(i.isGridSnapRealtime||this.lastInput.up)&&(F=P.l(),this.yS(w,u,F,i)),u.a(w.dragComputation(w,u,F)).subtract(S),t.set(w,this.Es(i,w,u));let T=u.x-k.x,N=u.y-k.y;w.fr(T,N),P.e(S),P.e(u),F!==u&&P.e(F)}}else{if(b!==null){d.a(b.location);let k=t.get(b);k!==null&&d.subtract(k.point)}if(v!==null){g.a(v.location);let k=t.get(v);k!==null&&g.subtract(k.point)}if(b!==null&&v!==null)if(d.equalsApprox(g)){let k=y.value.point,S=n;S.a(d),S.subtract(k),t.set(w,this.Es(i,w,d)),w.fr(S.x,S.y)}else w.suspendsRouting=!1,w.invalidateRoute();else{let k=y.value.point,S;b!==null?S=d:v!==null?S=g:S=o,t.set(w,this.Es(i,w,S));let M=S.x-k.x,F=S.y-k.y;w.fr(M,F)}}}else if(w.fromNode===null||w.toNode===null){let b=y.value.point;t.set(w,this.Es(i,w,o));let v=o.x-b.x,k=o.y-b.y;w.fr(v,k)}}}P.e(n),P.e(o),P.e(d),P.e(g),f.J(a),f.J(h),r||(this.Mi(),this.NP(t))}computeMove(t,e,i,s){if(s===void 0&&(s=new P),s.a(e),t===null)return s;let n=e,o=i.isGridSnapEnabled;o&&(i.isGridSnapRealtime||this.lastInput.up)&&(n=P.l(),this.yS(t,e,n,i));let r=t.dragComputation!==null?t.dragComputation(t,e,n):n,a=t.minLocation,h=a.x;isNaN(h)&&(h=o?Math.round(t.location.x*1e3)/1e3:t.location.x);let l=a.y;isNaN(l)&&(l=o?Math.round(t.location.y*1e3)/1e3:t.location.y);let 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.i(Math.max(h,Math.min(r.x,c)),Math.max(l,Math.min(r.y,d))),n!==e&&P.e(n),s}o0(){let t=this.toolManager.findTool("Dragging");return t instanceof Dt?t.dragOptions:this.yb}yS(t,e,i,s){if(s===void 0&&(s=this.o0()),i.a(e),t===null)return i;let n=this.grid,o=s.gridSnapCellSize,r=o.width,a=o.height,h=s.gridSnapOrigin,l=h.x,u=h.y,c=s.gridSnapCellSpot;if(n!==null){let g=n.gridCellSize;isNaN(r)&&(r=g.width),isNaN(a)&&(a=g.height);let p=n.gridOrigin;isNaN(l)&&(l=p.x),isNaN(u)&&(u=p.y)}let d=P.V(0,0);return d.setSpot(0,0,r,a,c),L.Dg(e.x,e.y,l+d.x,u+d.y,r,a,i),P.e(d),i}WC(t){if(t===null)return;this.gb=!0;let e=t.iterator;for(;e.next();){let i=e.key;i instanceof _&&(i.suspendsRouting=!0)}}NP(t){if(t===null)return;let e=t.iterator;for(;e.next();){let i=e.key;i instanceof _&&(i.suspendsRouting=!1,i.WL()&&i.invalidateRoute())}this.gb=!1}get draggedLink(){return this.pb}set draggedLink(t){this.pb!==t&&(this.pb=t,t!==null&&(this.wb=t.fromPort,this.xb=t.toPort))}get RP(){return this.wb}set RP(t){this.wb=t}get vP(){return this.xb}set vP(t){this.xb=t}HL(t,e){let i=t.containingGroup;if(i!==null){let s=this.HL(i,e);if(s!==null||(s=e.get(i),s!==null))return s}return null}Es(t,e,i){if(i===void 0)return new ni(P.xo);let s=t.isGridSnapEnabled;return!t.groupsSnapMembers&&e.containingGroup!==null&&(s=!1),s?new ni(new P(Math.round(i.x*1e3)/1e3,Math.round(i.y*1e3)/1e3)):new ni(i.copy())}BM(t,e){if(t.diagram!==null&&t.diagram!==this&&f.o("Cannot share a Layer with another Diagram: "+t+" of "+t.diagram),e===null?t.diagram!==null&&f.o("Cannot add an existing Layer to this Diagram again: "+t):(e.diagram!==this&&f.o("Existing Layer must be in this Diagram: "+e+" not in "+e.diagram),t===e&&f.o("Cannot move a Layer before or after itself: "+t)),t.diagram===this)return;let i=t.name,s=this.Xt,n=s.count;for(let o=0;o<n;o++)s.elt(o).name===i&&f.o("Cannot add Layer with the name '"+i+"'; a Layer with the same name is already present in this Diagram.")}addLayer(t){this.BM(t,null),t.Mo(this);let e=this.Xt,i=e.count-1;if(!t.isTemporary)for(;i>=0&&e.elt(i).isTemporary;)i--;return e.insertAt(i+1,t),this.ki!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,i+1),this.S(),this.invalidateDocumentBounds(),this}addLayerBefore(t,e){this.BM(t,e),t.Mo(this);let i=this.Xt,s=i.indexOf(t);s>=0&&(i.delete(t),this.ki!==null&&this.raiseChangedEvent(4,"layers",this,t,null,s,null));let n=i.count,o;for(o=0;o<n;o++)if(i.elt(o)===e){i.insertAt(o,t);break}return this.ki!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,o),this.S(),s<0&&this.invalidateDocumentBounds(),this}addLayerAfter(t,e){this.BM(t,e),t.Mo(this);let i=this.Xt,s=i.indexOf(t);s>=0&&(i.delete(t),this.ki!==null&&this.raiseChangedEvent(4,"layers",this,t,null,s,null));let n=i.count,o;for(o=0;o<n;o++)if(i.elt(o)===e){i.insertAt(o+1,t);break}return this.ki!==null&&this.raiseChangedEvent(3,"layers",this,null,t,null,o+1),this.S(),s<0&&this.invalidateDocumentBounds(),this}Xr(t,e){t.Mo(this),this.Xt.insertAt(e,t)}JL(t){this.Xt.removeAt(t)}removeLayer(t){if(t.diagram!==this&&f.o("Cannot remove a Layer from another Diagram: "+t+" of "+t.diagram),t.name==="")return;let e=this.Xt,i=e.indexOf(t);if(e.delete(t)){let s=t.Ct.copy().iterator;for(;s.next();){let n=s.value,o=n.layerName;o!==t.name?n.layerName=o:n.layerName=""}this.ki!==null&&this.raiseChangedEvent(4,"layers",this,t,null,i,null),this.S(),this.invalidateDocumentBounds()}}findLayer(t){let e=this.layers;for(;e.next();){let i=e.value;if(i.name===t)return i}return null}findRouter(t){for(let e of this.Vc)if(e.name===t)return e;return null}addModelChangedListener(t){return f.k(t,U,"addModelChangedListener:listener"),this.Gn===null&&(this.Gn=new j),this.Gn.add(t),this.model.addChangedListener(t),this}removeModelChangedListener(t){f.k(t,U,"removeModelChangedListener:listener"),this.Gn!==null&&(this.Gn.delete(t),this.Gn.count===0&&(this.Gn=null)),this.model.removeChangedListener(t)}addChangedListener(t){return f.k(t,U,"addChangedListener:listener"),this.Nr===null&&(this.Nr=new j),this.Nr.add(t),this}removeChangedListener(t){f.k(t,U,"removeChangedListener:listener"),this.Nr!==null&&(this.Nr.delete(t),this.Nr.count===0&&(this.Nr=null))}VM(t){if(!this.skipsUndoManager&&!this.model.skipsUndoManager&&this.model.undoManager.handleChanged(t),t.change!==1&&(this.isModified=!0),this.Nr!==null){let e=this.Nr,i=e.length;for(let s=0;s<i;s++)e.elt(s)(t)}}raiseChangedEvent(t,e,i,s,n,o,r){o===void 0&&(o=null),r===void 0&&(r=null);let a=new ii;a.diagram=this,a.change=t,a.propertyName=e,a.object=i,a.oldValue=s,a.oldParam=o,a.newValue=n,a.newParam=r,this.VM(a)}raiseChanged(t,e,i,s,n){this.raiseChangedEvent(2,t,this,e,i,s,n)}t(t,e,i,s,n){this.raiseChangedEvent(2,t,this,e,i,s,n)}get animationManager(){return this.ds}get undoManager(){return this.ki.undoManager}get skipsUndoManager(){return this.Lo}set skipsUndoManager(t){f.s(t,"boolean",U,"skipsUndoManager"),this.Lo=t,this.ki.skipsUndoManager=t}get delaysLayout(){return this.Gx}set delaysLayout(t){this.Gx=t}VC(t,e){if(t===null||t.diagram!==this)return;let i=this.fe;try{this.fe=!0;let s=t.change;if(s===2){let n=t.object,o=t.propertyName,r=t.getValue(e);if(t.diagram.model.Z(n,o,r),n instanceof dt){let a=n.part;a!==null&&a.invalidateAdornments()}this.isModified=!0}else if(s===3){let n=t.object,o=t.newParam,r=t.newValue;if(n instanceof H)if(typeof o=="number"&&r instanceof dt){e?n.te(o):n.insertAt(o,r);let a=n.part;a!==null&&a.invalidateAdornments()}else typeof o=="number"&&r instanceof jt&&(r.isRow?n.$L(o,e?void 0:r):n.ZL(o,e?void 0:r));else if(n instanceof Vt){let a=t.oldParam===!0;typeof o=="number"&&r instanceof Nt&&(e?(a||(r.isSelected=!1,r.isHighlighted=!1,r.invalidateAdornments()),n.te(a?o:-1,r,a)):n.Jh(o,r,a))}else n instanceof U?typeof o=="number"&&r instanceof Vt&&(e?this.JL(o):this.Xr(r,o)):f.o("unknown ChangeType.Insert object: "+t.toString());this.isModified=!0}else if(s===4){let n=t.object,o=t.oldParam,r=t.oldValue;if(n instanceof H)typeof o=="number"&&r instanceof dt?e?n.insertAt(o,r):n.te(o):typeof o=="number"&&r instanceof jt&&(r.isRow?n.$L(o,e?r:void 0):n.ZL(o,e?r:void 0));else if(n instanceof Vt){let a=t.newParam===!0;typeof o=="number"&&r instanceof Nt&&(e?n.Ct.indexOf(r)<0&&n.Jh(o,r,a):(a||(r.isSelected=!1,r.isHighlighted=!1,r.invalidateAdornments()),n.te(a?o:-1,r,a)))}else n instanceof U?typeof o=="number"&&r instanceof Vt&&(e?this.Xr(r,o):this.JL(o)):f.o("unknown ChangeType.Remove object: "+t.toString());this.isModified=!0}else s===1||f.o("unknown ChangedEvent: "+t.toString())}finally{this.fe=i}}startTransaction(t){return this.undoManager.startTransaction(t)}commitTransaction(t){return this.undoManager.commitTransaction(t)}rollbackTransaction(){return this.undoManager.rollbackTransaction()}commit(t,e){let i=e;i===void 0&&(i="");let s=this.skipsUndoManager;i===null&&(this.skipsUndoManager=!0,i=""),this.undoManager.startTransaction(i);let n=!1;try{t(this),n=!0}finally{n?this.undoManager.commitTransaction(i):this.undoManager.rollbackTransaction(),this.skipsUndoManager=s}}updateAllTargetBindings(t){this.partManager.updateAllTargetBindings(t)}updateAllThemeBindings(){if(this.partManager.updateAllThemeBindings(),this.Ze!==null){let t=this.Ze.part;t!==null&&t.Do()}}setDivBackground(t){this.div&&(this.div.style.backgroundColor=t)}updateAllRelationshipsFromData(){this.partManager.updateAllRelationshipsFromData()}_m(){let t=this.T,e=this.tt,i=this.at;t.Ri(),e!==1&&t.tt(e),(i.x!==0||i.y!==0)&&t.Fs(-i.x,-i.y)}QL(t,e){let i=this.animationManager;if(this.Ht||this.ys){this.tt=e,this.Ql(),this.S(),this.aa(),i.yL(t,this.tt),this._m();return}if(this.ft===null){this.tt=e,this._m();return}this.Ht=!0;let s=this.viewportBounds.copy(),n=this.xt,o=this.bt,r=this.zoomPoint.x,a=this.zoomPoint.y,h=this.contentAlignment;isNaN(r)&&(h.isSide()?h.includesSide(D.LeftSide)?r=0:h.includesSide(D.RightSide)&&(r=n-1):h.isSpot()?r=h.x*(n-1):r=n/2),isNaN(a)&&(h.isSide()?h.includesSide(D.TopSide)?a=0:h.includesSide(D.BottomSide)&&(a=o-1):h.isSpot()?a=h.y*(o-1):a=o/2),this.scaleComputation!==null&&!this.animationManager.defaultAnimation.isAnimating&&(e=this.scaleComputation(this,e)),e<this.minScale&&(e=this.minScale),e>this.maxScale&&(e=this.maxScale);let l=P.V(this.at.x+r/t-r/e,this.at.y+a/t-a/e);this.position=l,P.e(l),this.tt=e,this._m(),this.Ql(),this.Ht=!1,this.onViewportBoundsChanged(s,this.viewportBounds,t,!1),this.Bs(!1),i.yL(t,this.tt),this.S()}MR(){let t=this.Xt.r;for(let e=0;e<t.length;e++)t[e].ML()}onViewportBoundsChanged(t,e,i,s){if(t.equals(e))return;s===void 0&&(s=!1),s||this.aa(),this._l();let n=this.layout;n!==null&&n.isViewportSized&&this.autoScale===1&&(t.width!==e.width||t.height!==e.height)&&n.invalidateLayout();let o=this.currentTool;this.Uc===!0&&o instanceof xe&&!this.animationManager.isTicking&&(this.lastInput.documentPoint=this.transformViewToDoc(this.lastInput.viewPoint),o.standardMouseActivity(this)),this.Ht||this.invalidateViewport(t,e),this.th(),this.Bi.scale=i,this.Bi.position.x=t.x,this.Bi.position.y=t.y,this.Bi.bounds.a(t),this.Bi.canvasSize.width=Math.round(t.width*i),this.Bi.canvasSize.height=Math.round(t.height*i),this.Bi.newCanvasSize.width=this.xt,this.Bi.newCanvasSize.height=this.bt,this.Bi.isScroll=s,this.D("ViewportBoundsChanged",this.Bi,t),this.isVirtualized&&this.links.each(r=>{r.isAvoiding&&r.actualBounds.intersectsRect(e)&&r.invalidateRoute()})}th(t){let e=this.Ze;if(e===null||!e.visible||e.part===null||e.layer===null)return;let i=t!==void 0?t:this.nb;if(!i.isReal())return;let s=i.width,n=i.height;if(e.scale=1,e.angle=0,e.layer.isViewportAligned)e.width=s*this.scale,e.height=n*this.scale,e.part.alignment=D.TopLeft;else{e.yi===null&&(e.yi=new gi);let o=e.yi.Yc;if(!o.isReal())return;e.width=s+o.width*2,e.height=n+o.height*2;let r=P.l();L.Dg(i.x,i.y,0,0,o.width,o.height,r),r.offset(-o.width,-o.height),e.part.location=r,P.e(r)}}clearSelection(t){t===void 0&&(t=!1);let e=this.selection;if(e.count===0)return;t||this.D("ChangingSelection",e);let i=e.toArray(),s=i.length;for(let n=0;n<s;n++){let o=i[n];o.isSelected=!1}e.Pt(),e.clear(),e.u(),t||this.D("ChangedSelection",e)}select(t){t!==null&&t.diagram===this&&(!t.isSelected||this.selection.count>1)&&(this.D("ChangingSelection",this.selection),this.clearSelection(!0),t.isSelected=!0,this.D("ChangedSelection",this.selection))}selectCollection(t){if(this.D("ChangingSelection",this.selection),this.clearSelection(!0),Array.isArray(t)){let e=t.length;for(let i=0;i<e;i++){let s=t[i];s instanceof Nt||f.o("Diagram.selectCollection given something that is not a Part: "+s),s.isSelected=!0}}else{let e=t.iterator;for(;e.next();){let i=e.value;i instanceof Nt||f.o("Diagram.selectCollection given something that is not a Part: "+i),i.isSelected=!0}}this.D("ChangedSelection",this.selection)}clearHighlighteds(){let t=this.highlighteds;if(t.count>0){let e=t.toArray(),i=e.length;for(let s=0;s<i;s++){let n=e[s];n.isHighlighted=!1}t.Pt(),t.clear(),t.u()}}highlight(t){t!==null&&t.diagram===this&&(!t.isHighlighted||this.highlighteds.count>1)&&(this.clearHighlighteds(),t.isHighlighted=!0)}highlightCollection(t){let e=new I().addAll(t),i=this.highlighteds.copy().removeAll(e).iterator;for(;i.next();){let n=i.value;n.isHighlighted=!1}let s=e.iterator;for(;s.next();){let n=s.value;n instanceof Nt||f.o("Diagram.highlightCollection given something that is not a Part: "+n),n.isHighlighted=!0}}scroll(t,e,i){i===void 0&&(i=1);let s=e==="up"||e==="down",n=0,o=P.l();if(t==="pixel")n=i;else if(t==="line")n=i*(s?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if(t==="page"){let a=s?this.viewportBounds.height:this.viewportBounds.width;if(a*=this.scale,a!==0){let h=Math.max(a-(s?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0);n=i*h}}else if(t==="document"){let a=this.documentBounds,h=this.viewportBounds;e==="up"?this.position=o.i(h.x,a.y):e==="left"?this.position=o.i(a.x,h.y):e==="down"?this.position=o.i(h.x,a.bottom-h.height):e==="right"&&(this.position=o.i(a.right-h.width,h.y)),P.e(o);return}else f.o("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+t);n/=this.scale;let r=this.position;e==="up"?this.position=o.i(r.x,r.y-n):e==="down"?this.position=o.i(r.x,r.y+n):e==="left"?this.position=o.i(r.x-n,r.y):e==="right"?this.position=o.i(r.x+n,r.y):f.o("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+e),P.e(o)}scrollToRect(t){let e=this.viewportBounds;if(e.containsRect(t))return;let i=t.center;i.x-=e.width/2,i.y-=e.height/2,this.position=i}centerRect(t){let e=this.viewportBounds,i=t.center;i.x-=e.width/2,i.y-=e.height/2,this.position=i}transformDocToView(t){return t.copy().T(this.T)}transformViewToDoc(t){return t.copy().Oe(this.T)}$F(t){return t.Oe(this.T)}static None=1;static Uniform=2;static UniformToFill=3;static CycleAll=1;static CycleNotDirected=2;static CycleNotDirectedFast=3;static CycleNotUndirected=4;static CycleDestinationTree=5;static CycleSourceTree=6;static DocumentScroll=1;static InfiniteScroll=2;static TreeParentCollapsed=1;static AllParentsCollapsed=2;static AnyParentsCollapsed=3;get opacity(){return this.$t}set opacity(t){let e=this.$t;e!==t&&(f.s(t,"number",U,"opacity"),(t<0||t>1)&&f.W(t,"0 <= value <= 1",U,"opacity"),this.$t=t,this.t("opacity",e,t),this.S())}get validCycle(){return this.Ux}set validCycle(t){let e=this.Ux;e!==t&&(this.Ux=t,this.t("validCycle",e,t))}get layers(){return this.Xt.iterator}get isModelReadOnly(){let t=this.ki;return t===null?!1:t.isReadOnly}set isModelReadOnly(t){let e=this.ki;e!==null&&(e.isReadOnly=t)}get isReadOnly(){return this.Ao}set isReadOnly(t){let e=this.Ao;e!==t&&(f.s(t,"boolean",U,"isReadOnly"),this.Ao=t,this.t("isReadOnly",e,t))}get isEnabled(){return this.Oi}set isEnabled(t){let e=this.Oi;e!==t&&(f.s(t,"boolean",U,"isEnabled"),this.Oi=t,this.t("isEnabled",e,t))}get allowClipboard(){return this.Kx}set allowClipboard(t){let e=this.Kx;e!==t&&(f.s(t,"boolean",U,"allowClipboard"),this.Kx=t,this.t("allowClipboard",e,t))}get allowCopy(){return this.Rl}set allowCopy(t){let e=this.Rl;e!==t&&(f.s(t,"boolean",U,"allowCopy"),this.Rl=t,this.t("allowCopy",e,t))}get allowDelete(){return this.vl}set allowDelete(t){let e=this.vl;e!==t&&(f.s(t,"boolean",U,"allowDelete"),this.vl=t,this.t("allowDelete",e,t))}get allowDragOut(){return this.jx}set allowDragOut(t){let e=this.jx;e!==t&&(f.s(t,"boolean",U,"allowDragOut"),this.jx=t,this.t("allowDragOut",e,t))}get allowDrop(){return this.Hx}set allowDrop(t){let e=this.Hx;e!==t&&(f.s(t,"boolean",U,"allowDrop"),this.Hx=t,this.t("allowDrop",e,t))}get allowTextEdit(){return this.Ol}set allowTextEdit(t){let e=this.Ol;e!==t&&(f.s(t,"boolean",U,"allowTextEdit"),this.Ol=t,this.t("allowTextEdit",e,t))}get allowGroup(){return this.Il}set allowGroup(t){let e=this.Il;e!==t&&(f.s(t,"boolean",U,"allowGroup"),this.Il=t,this.t("allowGroup",e,t))}get allowUngroup(){return this.El}set allowUngroup(t){let e=this.El;e!==t&&(f.s(t,"boolean",U,"allowUngroup"),this.El=t,this.t("allowUngroup",e,t))}get allowInsert(){return this.qx}set allowInsert(t){let e=this.qx;e!==t&&(f.s(t,"boolean",U,"allowInsert"),this.qx=t,this.t("allowInsert",e,t))}get allowLink(){return this.Ul}set allowLink(t){let e=this.Ul;e!==t&&(f.s(t,"boolean",U,"allowLink"),this.Ul=t,this.t("allowLink",e,t))}get allowRelink(){return this.Bl}set allowRelink(t){let e=this.Bl;e!==t&&(f.s(t,"boolean",U,"allowRelink"),this.Bl=t,this.t("allowRelink",e,t))}get allowMove(){return this.Vl}set allowMove(t){let e=this.Vl;e!==t&&(f.s(t,"boolean",U,"allowMove"),this.Vl=t,this.t("allowMove",e,t))}get allowReshape(){return this.zl}set allowReshape(t){let e=this.zl;e!==t&&(f.s(t,"boolean",U,"allowReshape"),this.zl=t,this.t("allowReshape",e,t))}get allowResize(){return this.Xl}set allowResize(t){let e=this.Xl;e!==t&&(f.s(t,"boolean",U,"allowResize"),this.Xl=t,this.t("allowResize",e,t))}get allowRotate(){return this.Yl}set allowRotate(t){let e=this.Yl;e!==t&&(f.s(t,"boolean",U,"allowRotate"),this.Yl=t,this.t("allowRotate",e,t))}get allowSelect(){return this.Gl}set allowSelect(t){let e=this.Gl;e!==t&&(f.s(t,"boolean",U,"allowSelect"),this.Gl=t,this.t("allowSelect",e,t))}get allowUndo(){return this.Wx}set allowUndo(t){let e=this.Wx;e!==t&&(f.s(t,"boolean",U,"allowUndo"),this.Wx=t,this.t("allowUndo",e,t))}get allowZoom(){return this.Jx}set allowZoom(t){let e=this.Jx;e!==t&&(f.s(t,"boolean",U,"allowZoom"),this.Jx=t,this.t("allowZoom",e,t))}get hasVerticalScrollbar(){return this.vu}set hasVerticalScrollbar(t){let e=this.vu;e!==t&&(f.s(t,"boolean",U,"hasVerticalScrollbar"),this.vu=t,this.aa(),this.S(),this.t("hasVerticalScrollbar",e,t),this.Bs(!1))}get hasHorizontalScrollbar(){return this.Ru}set hasHorizontalScrollbar(t){let e=this.Ru;e!==t&&(f.s(t,"boolean",U,"hasHorizontalScrollbar"),this.Ru=t,this.aa(),this.S(),this.t("hasHorizontalScrollbar",e,t),this.Bs(!1))}get allowHorizontalScroll(){return this.$x}set allowHorizontalScroll(t){let e=this.$x;e!==t&&(f.s(t,"boolean",U,"allowHorizontalScroll"),this.$x=t,this.t("allowHorizontalScroll",e,t),this.Bs(!1))}get allowVerticalScroll(){return this.Zx}set allowVerticalScroll(t){let e=this.Zx;e!==t&&(f.s(t,"boolean",U,"allowVerticalScroll"),this.Zx=t,this.t("allowVerticalScroll",e,t),this.Bs(!1))}get scrollHorizontalLineChange(){return this.Qx}set scrollHorizontalLineChange(t){let e=this.Qx;e!==t&&(f.s(t,"number",U,"scrollHorizontalLineChange"),t<0&&f.W(t,">= 0",U,"scrollHorizontalLineChange"),this.Qx=t,this.t("scrollHorizontalLineChange",e,t))}get scrollVerticalLineChange(){return this._x}set scrollVerticalLineChange(t){let e=this._x;e!==t&&(f.s(t,"number",U,"scrollVerticalLineChange"),t<0&&f.W(t,">= 0",U,"scrollVerticalLineChange"),this._x=t,this.t("scrollVerticalLineChange",e,t))}get lastInput(){return this._h}set lastInput(t){this._h=t}get previousInput(){return this.Br}set previousInput(t){this.Br=t}get firstInput(){return this.Gm}set firstInput(t){this.Gm=t}get currentCursor(){return this.Bx}set currentCursor(t){if(t===""&&(t=this.Um),this.Bx!==t){f.s(t,"string",U,"currentCursor");let e=this.ft,i=this.Mt;if(e===null||i===null)return;this.Bx=t;let s=e.style.cursor;e.style.cursor=t,i.style.cursor=t,e.style.cursor===s&&(e.style.cursor="-webkit-"+t,i.style.cursor="-webkit-"+t,e.style.cursor===s&&(e.style.cursor="-moz-"+t,i.style.cursor="-moz-"+t,e.style.cursor===s&&(e.style.cursor=t,i.style.cursor=t)))}}get defaultCursor(){return this.Um}set defaultCursor(t){t===""&&(t="auto");let e=this.Um;e!==t&&(f.s(t,"string",U,"defaultCursor"),this.Um=t,this.t("defaultCursor",e,t))}get click(){return this.Cr}set click(t){let e=this.Cr;e!==t&&(t!==null&&f.k(t,U,"click"),this.Cr=t,this.t("click",e,t))}get doubleClick(){return this.Lr}set doubleClick(t){let e=this.Lr;e!==t&&(t!==null&&f.k(t,U,"doubleClick"),this.Lr=t,this.t("doubleClick",e,t))}get contextClick(){return this.Ar}set contextClick(t){let e=this.Ar;e!==t&&(t!==null&&f.k(t,U,"contextClick"),this.Ar=t,this.t("contextClick",e,t))}get mouseOver(){return this.Tr}set mouseOver(t){let e=this.Tr;e!==t&&(t!==null&&f.k(t,U,"mouseOver"),this.Tr=t,this.t("mouseOver",e,t))}get mouseHover(){return this.Dr}set mouseHover(t){let e=this.Dr;e!==t&&(t!==null&&f.k(t,U,"mouseHover"),this.Dr=t,this.t("mouseHover",e,t))}get mouseHold(){return this.Fr}set mouseHold(t){let e=this.Fr;e!==t&&(t!==null&&f.k(t,U,"mouseHold"),this.Fr=t,this.t("mouseHold",e,t))}get mouseDragOver(){return this.Vx}set mouseDragOver(t){let e=this.Vx;e!==t&&(t!==null&&f.k(t,U,"mouseDragOver"),this.Vx=t,this.t("mouseDragOver",e,t))}get mouseDrop(){return this.Rr}set mouseDrop(t){let e=this.Rr;e!==t&&(this.Rr=t,this.t("mouseDrop",e,t))}get handlesDragDropForTopLevelParts(){return this.zx}set handlesDragDropForTopLevelParts(t){let e=this.zx;e!==t&&(f.s(t,"boolean",U,"handlesDragDropForTopLevelParts"),this.zx=t,this.t("handlesDragDropForTopLevelParts",e,t))}get mouseEnter(){return this.vr}set mouseEnter(t){let e=this.vr;e!==t&&(t!==null&&f.k(t,U,"mouseEnter"),this.vr=t,this.t("mouseEnter",e,t))}get mouseLeave(){return this.Or}set mouseLeave(t){let e=this.Or;e!==t&&(t!==null&&f.k(t,U,"mouseLeave"),this.Or=t,this.t("mouseLeave",e,t))}get toolTip(){return this.Ir}set toolTip(t){let e=this.Ir;e!==t&&(this.Ir=t,this.t("toolTip",e,t))}get contextMenu(){return this.Er}set contextMenu(t){let e=this.Er;e!==t&&(this.Er=t,this.t("contextMenu",e,t))}get commandHandler(){return this.sM}set commandHandler(t){let e=this.sM;e!==t&&(e&&e.doStop(),this.sM=t,t.Mo(this),t.doStart())}get toolManager(){return this.tM}set toolManager(t){this.tM!==t&&(this.tM=t,t.diagram=this)}get defaultTool(){return this.iM}set defaultTool(t){let e=this.iM;e!==t&&(this.iM=t,t.diagram=this,this.currentTool===e&&(this.currentTool=t))}get currentTool(){return this.eM}set currentTool(t){let e=this.eM;e&&(e.isActive&&e.doDeactivate(),e.cancelWaitAfter(),e.doStop()),t===null&&(t=this.defaultTool),t!==null&&(this.eM=t,t.diagram=this,t.doStart())}get selection(){return this.cM}get maxSelectionCount(){return this.sb}set maxSelectionCount(t){let e=this.sb;if(e!==t)if(f.s(t,"number",U,"maxSelectionCount"),t>=0&&!isNaN(t)){if(this.sb=t,this.t("maxSelectionCount",e,t),!this.undoManager.isUndoingRedoing){let i=this.selection.count-t;if(i>0){this.D("ChangingSelection",this.selection);let s=this.selection.toArray();for(let n=0;n<i;n++)s[n].isSelected=!1;this.D("ChangedSelection",this.selection)}}}else f.W(t,">= 0",U,"maxSelectionCount")}get nodeSelectionAdornmentTemplate(){return this.Xm}set nodeSelectionAdornmentTemplate(t){let e=this.Xm;e!==t&&(this.Xm=t.Et(),this.t("nodeSelectionAdornmentTemplate",e,t))}get groupSelectionAdornmentTemplate(){return this.rb}set groupSelectionAdornmentTemplate(t){let e=this.rb;e!==t&&(this.rb=t.Et(),this.t("groupSelectionAdornmentTemplate",e,t))}get linkSelectionAdornmentTemplate(){return this.lb}set linkSelectionAdornmentTemplate(t){let e=this.lb;e!==t&&(this.lb=t.Et(),this.t("linkSelectionAdornmentTemplate",e,t))}get highlighteds(){return this.fM}get isModified(){let t=this.undoManager;return t.isEnabled?t.currentTransaction!==null?!0:this.Uu&&this.Os!==t.historyIndex:this.Uu}set isModified(t){if(this.Uu!==t){f.s(t,"boolean",U,"isModified"),this.Uu=t;let e=this.undoManager;!t&&e.isEnabled&&(this.Os=e.historyIndex),t||this._L()}}_L(){let t=this.isModified;this.hM!==t&&(this.hM=t,this.D("Modified"))}get model(){return this.ki}set model(t){let e=this.ki;if(e!==t){this.currentTool.doCancel(),e&&e.undoManager!==t.undoManager&&e.undoManager.isInTransaction&&f.o("Do not replace a Diagram.model while a transaction is in progress."),this.animationManager.stopAnimation(!0);let i=this.OL(!0);this.jn=!1,this.Fu=!0,this.Os=-2,this.xr=!1;let s=this.Ht;this.Ht=!0,this.animationManager.Fl("Model"),e&&(this.Gn!==null&&this.Gn.each(n=>e.removeChangedListener(n)),e.removeChangedListener(this.lM)),this.ki=t,this.partManager=this.vR(this.ki.type),this.initializePartManager(this.partManager);for(let n=0;n<i.length;n++)this.add(i[n]);t.addChangedListener(this.rM),this.partManager.zM(),t.removeChangedListener(this.rM),t.addChangedListener(this.lM),this.Gn!==null&&this.Gn.each(n=>t.addChangedListener(n)),this.Ht=s,this.invalidateDocumentBounds(),this.Ht||this.S(),e&&t.undoManager.copyProperties(e.undoManager)}}get themeManager(){return this.NM}set themeManager(t){let e=this.NM;e!==t&&(e&&e.removeDiagram(this),this.NM=t,t!==null&&t.addDiagram(this))}initializePartManager(t){}static CM(t,e){U.AL.set(t,e)}static get licenseKey(){return U.XM.last()}static set licenseKey(t){U.XM.add(t.replace(/\s/g,""))}static get version(){return U.OR}static XM=new j;static OR="3.0.26";vR(t){let e=U.AL.get(t);return e!==null?new e:new Se}get X(){return this.oM}set X(t){this.oM=t}get bx(){return this.NL}IR(t){if(t.model!==this.model)return;let e=t.change,i=t.propertyName;if(e===1&&i[0]==="S"){if(i==="StartingFirstTransaction"){let s=this,n=this.toolManager;n.mouseDownTools.each(o=>o.diagram=s),n.mouseMoveTools.each(o=>o.diagram=s),n.mouseUpTools.each(o=>o.diagram=s),this.routers.each(o=>o.diagram=s),!this.ys&&!this.jn&&(this.vc=!0,this.Fu&&(this.xr=!0))}else if(i==="StartingUndo"||i==="StartingRedo"){let s=this.animationManager;this.skipsUndoManager||(s.defaultAnimation.isAnimating&&s.stopAnimation(),s.getBundleAnimation().isAnimating&&s.getBundleAnimation().stop()),this.D("ChangingSelection",this.selection)}else if(i==="StartedTransaction"){let s=this.animationManager;s.defaultAnimation.isAnimating&&!this.skipsUndoManager&&s.stopAnimation()}return}if(this.X){this.X=!1;try{if(t.modelChange===""&&e===1){(i==="FinishedUndo"||i==="FinishedRedo")&&(this.D("ChangedSelection",this.selection),this.Mi());let s=this.animationManager;i==="RolledBackTransaction"&&s.stopAnimation(),this.xL(),this.vc=!0,this.maybeUpdate(),(this.undoManager.transactionLevel===0||this.undoManager.transactionLevel===1)&&s.OS(),i==="CommittedTransaction"&&this.undoManager.isJustDiscarded&&(this.Os=Math.min(this.Os,this.undoManager.historyIndex-1)),(i==="CommittedTransaction"||i==="RolledBackTransaction")&&this.undoManager.Uw&&f.ir(()=>{this.isModified=!1},1);let n=t.isTransactionFinished;if(n&&(this._L(),this.bx.clear(),this.animationManager.OF()),!this.Xx&&n&&this.lastInput.targetDiagram){this.Xx=!0;let o=this;f.ir(()=>{o.currentTool.standardMouseOver(),o.Xx=!1},10)}}}finally{this.X=!0}}}get fe(){return this.nM}set fe(t){this.nM=t}get du(){return this.Yx}set du(t){this.Yx=t}GL(t){let e=t.C.r;for(let i of e)i instanceof zt&&this.YM(i)}YM(t){let e=t.element;if(e===null||!(e instanceof HTMLImageElement)||(e.ts instanceof I&&e.ts.add(this),t.ER(),!e.r0))return;let i=e.getAttribute("src")||"",s=this.Jl.get(i);if(s===null){zt.tA(t,e);let n=[];n.push(t),this.Jl.set(i,n)}else{for(let n=0;n<s.length;n++)if(s[n]===t)return;s.push(t)}}UR(t){let e=t.C.r,i=e.length;for(let s=0;s<i;s++)this.GM(e[s])}GM(t){if(!(t instanceof zt))return;let e=t.element;if(e===null||!(e instanceof HTMLImageElement)||!e.r0)return;let i=e.getAttribute("src")||"",s=this.Jl.get(i);if(s!==null){for(let n=0;n<s.length;n++)if(s[n]===t){s.splice(n,1),s.length===0&&(this.Jl.delete(i),zt.BR(e),e.ts instanceof I&&e.ts.delete(this),zt.clearCache(i));return}}}IL(){zt.clearCache(),this.Jl.clear()}rebuildParts(){this.partManager.rebuildParts()}Lc(t,e){this.ds.Lc(t,e)}Cc(t,e){this.ds.Cc(t,e)}findPartForKey(t){return this.partManager.findPartForKey(t)}findNodeForKey(t){return this.partManager.findNodeForKey(t)}findLinkForKey(t){return this.partManager.findLinkForKey(t)}findPartForData(t){return this.partManager.findPartForData(t)}findNodeForData(t){return this.partManager.findNodeForData(t)}findLinkForData(t){return this.partManager.findLinkForData(t)}findNodesByExample(...t){return this.partManager.findNodesByExample(...t)}findLinksByExample(...t){return this.partManager.findLinksByExample(...t)}get nodeTemplate(){return this.Ur.get("")}set nodeTemplate(t){let e=this.Ur.get("");e!==t&&(this.Ur.set("",t),this.t("nodeTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get nodeTemplateMap(){return this.Ur}set nodeTemplateMap(t){let e=this.Ur;e!==t&&(this.Ur=t,this.t("nodeTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get groupTemplate(){return this.Qh.get("")}set groupTemplate(t){let e=this.Qh.get("");e!==t&&(this.Qh.set("",t),this.t("groupTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get groupTemplateMap(){return this.Qh}set groupTemplateMap(t){let e=this.Qh;e!==t&&(this.Qh=t,this.t("groupTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get linkTemplate(){return this.ql.get("")}set linkTemplate(t){let e=this.ql.get("");e!==t&&(this.ql.set("",t),this.t("linkTemplate",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get linkTemplateMap(){return this.ql}set linkTemplateMap(t){let e=this.ql;e!==t&&(this.ql=t,this.t("linkTemplateMap",e,t),this.undoManager.isUndoingRedoing||this.rebuildParts())}get isMouseCaptured(){return this.aM}set isMouseCaptured(t){let e=this.ft;if(e===null)return;let i=e.Tt;i instanceof SVGElement||(t?(this.lastInput.bubbles=!1,this.Pi(i,"pointermove",this.na,!1),this.Pi(i,"pointerdown",this.Zl,!1),this.Pi(i,"pointerup",this.oa,!1),this.Pi(i,"pointerout",this.ra,!1),this.Pi(i,"pointercancel",this.la,!1),this.Ut(A,"pointermove",this.na,!0),this.Ut(A,"pointerdown",this.Zl,!0),this.Ut(A,"pointerup",this.oa,!0),this.Ut(A,"pointerout",this.ra,!0),this.Ut(A,"pointercancel",this.la,!0),this.Pi(i,"wheel",this.sa,!1),this.Ut(A,"wheel",this.sa,!0),this.Ut(A,"selectstart",this.jh,!1)):(this.Pi(A,"pointermove",this.na,!0),this.Pi(A,"pointerdown",this.Zl,!0),this.Pi(A,"pointerup",this.oa,!0),this.Pi(A,"pointerout",this.ra,!0),this.Pi(A,"pointercancel",this.la,!0),this.Ut(i,"pointermove",this.na,!1),this.Ut(i,"pointerdown",this.Zl,!1),this.Ut(i,"pointerup",this.oa,!1),this.Ut(i,"pointerout",this.ra,!1),this.Ut(i,"pointercancel",this.la,!1),this.Pi(A,"wheel",this.sa,!0),this.Pi(A,"selectstart",this.jh,!1),this.Ut(i,"wheel",this.sa,!1)),this.aM=t)}get position(){return this.at}set position(t){if(this.at.equals(t))return;let e=P.l().a(this.at),i=this.viewportBounds.copy();if(this.at.a(t),this.animationManager.pL(e,this.at),!this.Ht&&!(this.ft===null&&!this.Iu.isReal())){this.Ht=!0;let s=this.scale,n=this.xt/s,o=this.bt/s;this.DM(this.zm,n,o,this.Fc,!1),this.Ht=!1}else this.Ql(),this._m();if(!this.Ht){let s=this.viewportBounds;this.onViewportBoundsChanged(i,s,this.tt,!1)}P.e(e)}get initialPosition(){return this.Mx}set initialPosition(t){this.Mx.equals(t)||(this.Mx=t.P())}get initialScale(){return this.Nx}set initialScale(t){this.Nx!==t&&(f.s(t,"number",U,"initialScale"),this.Nx=t)}get grid(){return this.Ze===null&&(this.Ze=this.UL()),this.Ze}set grid(t){let e=this.Ze;if(e!==t){e===null&&(this.Ze=this.UL(),e=this.Ze),t.type!==H.Grid&&f.o("Diagram.grid must be a Panel of type Panel.Grid");let i=e.panel;i!==null&&i.remove(e),this.Ze=t,t.name="GRID",i!==null&&i.add(t),this.Eu=!1,this.S(),this.t("grid",e,t)}}get viewportBounds(){return this.nb}Ql(){let t=this.nb,e=this.at,i=this.tt;t.i(e.x,e.y,Math.max(this.xt,0)/i,Math.max(this.bt,0)/i),this._l()}get viewSize(){return this.Iu}set viewSize(t){let e=this.viewSize;if(!e.equals(t)){t=t.P(),this.Iu=t;let i=0,s=0;t.isReal()?(i=t.width,s=t.height):this.Mt!==null&&(i=this.Mt.clientWidth||1,s=this.Mt.clientHeight||1),this.xt=i,this.bt=s,this.Ql(),this.invalidateDocumentBounds(),this.t("viewSize",e,t),this.S()}}get fixedBounds(){return this.Tx}set fixedBounds(t){let e=this.Tx;e.equals(t)||((t.width===-1/0||t.height===1/0||t.height===-1/0)&&f.o("fixedBounds width/height must not be Infinity"),t=t.P(),this.Tx=t,this.invalidateDocumentBounds(),this.t("fixedBounds",e,t))}get scrollMargin(){return this.$h}set scrollMargin(t){typeof t=="number"&&(t=new Lt(t));let e=this.$h;e.equals(t)||(t=t.P(),this.$h=t,this.t("scrollMargin",e,t),this.mu())}get scrollMode(){return this.qh}set scrollMode(t){let e=this.qh;e!==t&&(this.qh=t,t===1&&this.Bs(!1),this.t("scrollMode",e,t),this.aa(),this.S())}get scrollsPageOnFocus(){return this.Dx}set scrollsPageOnFocus(t){let e=this.Dx;e!==t&&(f.s(t,"boolean",U,"scrollsPageOnFocus"),this.Dx=t,this.t("scrollsPageOnFocus",e,t))}get positionComputation(){return this.Fx}set positionComputation(t){let e=this.Fx;e!==t&&(t!==null&&f.k(t,U,"positionComputation"),this.Fx=t,this.Bs(!1),this.t("positionComputation",e,t))}get scaleComputation(){return this.Rx}set scaleComputation(t){let e=this.Rx;e!==t&&(t!==null&&f.k(t,U,"scaleComputation"),this.Rx=t,this.QL(this.scale,this.scale),this.t("scaleComputation",e,t))}get documentBounds(){return this.zm}iA(t){this.ta=!1;let e=this.zm;e.equals(t)||(e=e.copy(),this.zm.a(t),this.Bs(!1),this.D("DocumentBoundsChanged",void 0,e),this.aa(),this.S())}ensureBounds(){if(this.ta){let t=z.l();this.iA(this.computeBounds(t)),z.e(t)}}get isVirtualized(){return this.ob}set isVirtualized(t){let e=this.ob;e!==t&&(f.s(t,"boolean",U,"isVirtualized"),this.ob=t,this.t("isVirtualized",e,t))}get scale(){return this.tt}set scale(t){let e=this.tt;e!==t&&this.QL(e,t)}get defaultScale(){return this.Km}set defaultScale(t){this.Km=t}get autoScale(){return this.jl}set autoScale(t){let e=this.jl;e!==t&&(this.jl=t,this.t("autoScale",e,t),t!==1&&this.Bs(!1))}get initialAutoScale(){return this.Sr}set initialAutoScale(t){let e=this.Sr;e!==t&&(this.Sr=t,this.t("initialAutoScale",e,t))}get initialViewportSpot(){return this.Ox}set initialViewportSpot(t){let e=this.Ox;e!==t&&(t.isSpot()||f.o("initialViewportSpot must be a specific Spot: "+t),this.Ox=t,this.t("initialViewportSpot",e,t))}get initialDocumentSpot(){return this.vx}set initialDocumentSpot(t){let e=this.vx;e!==t&&(t.isSpot()||f.o("initialViewportSpot must be a specific Spot: "+t),this.vx=t,this.t("initialDocumentSpot",e,t))}get minScale(){return this.Cx}set minScale(t){let e=this.Cx;e!==t&&(t>0?(this.Cx=t,this.t("minScale",e,t),t>this.scale&&(this.scale=t)):f.W(t,"> 0",U,"minScale"))}get maxScale(){return this.Lx}set maxScale(t){let e=this.Lx;e!==t&&(t>0?(this.Lx=t,this.t("maxScale",e,t),t<this.scale&&(this.scale=t)):f.W(t,"> 0",U,"maxScale"))}get zoomPoint(){return this.Ax}set zoomPoint(t){this.Ax.equals(t)||(t=t.P(),this.Ax=t)}get contentAlignment(){return this.Fc}set contentAlignment(t){let e=this.Fc;e.equals(t)||(t=t.P(),this.Fc=t,this.t("contentAlignment",e,t),this.Bs(!1))}get initialContentAlignment(){return this.Om}set initialContentAlignment(t){let e=this.Om;e.equals(t)||(t=t.P(),this.Om=t,this.t("initialContentAlignment",e,t))}get padding(){return this.Zt}set padding(t){typeof t=="number"&&(t=new Lt(t));let e=this.Zt;e.equals(t)||(t=t.P(),this.Zt=t,this.invalidateDocumentBounds(),this.t("padding",e,t))}get partManager(){return this.pM}set partManager(t){let e=this.pM;e!==t&&(t.diagram!==null&&f.o("Cannot share PartManagers between Diagrams: "+t.toString()),e&&e.Mo(null),this.pM=t,t.Mo(this))}get nodes(){return this.partManager.nodes.iterator}get links(){return this.partManager.links.iterator}get parts(){return this.partManager.parts.iterator}findTopLevelNodesAndLinks(){let t=new I,e=this.nodes;for(;e.next();){let s=e.value;s.isTopLevel&&t.add(s)}let i=this.links;for(;i.next();){let s=i.value;s.isTopLevel&&t.add(s)}return t.iterator}findTopLevelGroups(){return this.zr.iterator}get routers(){return this.Vc}doLinkRouting(t){this.Co=!0;let e=this.Vc.r;for(let i=0;i<e.length;i++)e[i].canRoute(t)&&e[i].routeLinks(this.Mr,t);this.Co=!1}get layout(){return this.ie}set layout(t){let e=this.ie;e!==t&&(this.ie=t,t.diagram=this,t.group=null,this.Vr=!0,this.t("layout",e,t),this.requestUpdate())}layoutDiagram(t){this.Mi(),t&&this.Cb(!0),this.ys?this.vM(!1,this.bl||this.Vc.count!==0&&this.Yn.size!==0):(this.vc=!0,this.ur())}Cb(t){let e=this.zr.iterator;for(;e.next();)this.eA(e.value,t);this.layout&&(t?this.layout.isValidLayout=!1:this.layout.invalidateLayout())}eA(t,e){if(t===null)return;let i=t.ca.iterator;for(;i.next();){let s=i.value;this.eA(s,e)}t.layout!==null&&(e?t.layout.isValidLayout=!1:t.layout.invalidateLayout())}vM(t,e){if(this.Gx)return;let i=this.X;this.X=!0;let s="Layout",n=this.undoManager.transactionLevel,o=this.layout,r=this.animationManager;try{n===0&&(this.undoManager.wl=!0,this.startTransaction(s)),n<=1&&!r.defaultAnimation.isAnimating&&!r.pi&&(t||r.Fl(s)),this.Vr=!1;let a=this.zr.iterator;for(;a.next();)this.sA(a.value,t,n,e);let h=!1;if(o.isValidLayout||(!t||o.isRealtime||o.isRealtime===null||n===0?(o.doLayout(this),this.i0(this),h=!0,o.isValidLayout=!0):this.Vr=!0),h||this.i0(this),this.doLinkRouting(this),this.Mr.clear(),this.Zh.size!==0){for(let l=0;l<23&&this.Zh.size!==0;l++){for(a=this.zr.iterator;a.next();)this.nA(a.value);let u=this.Mr;this.Mr=this.Zh,this.Zh=u,this.i0(this),this.doLinkRouting(this)}this.Mr.clear(),this.Zh.clear()}}finally{let a=this.undoManager.wl;n===0&&(this.commitTransaction(s),this.undoManager.wl=!1),a&&(n===0||n===1)&&r.OS(),this.Vr&&(this.Vr=!o.isValidLayout),this.X=i}}sA(t,e,i,s){let n=t.ca.iterator;for(;n.next();)this.sA(n.value,e,i,s);let o=t.layout;o!==null&&!o.isValidLayout?!e||o.isRealtime||i===0?(t.fa=!t.location.isReal(),o.doLayout(t),t.invalidateLayout(32),this.Pb(t),this.i0(t),this.doLinkRouting(t),o.isValidLayout=!0):(this.doLinkRouting(t),this.Vr=!0):s&&this.doLinkRouting(t)}nA(t){let e=t.ca.iterator;for(;e.next();)this.nA(e.value);this.i0(t),this.doLinkRouting(t)}get isTreePathToChildren(){return this.Ix}set isTreePathToChildren(t){let e=this.Ix;if(e!==t&&(f.s(t,"boolean",U,"isTreePathToChildren"),this.Ix=t,this.t("isTreePathToChildren",e,t),!this.undoManager.isUndoingRedoing)){let i=this.nodes;for(;i.next();)i.value.l0()}}findTreeRoots(){let t=new j,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.Ex}set treeCollapsePolicy(t){let e=this.Ex;e!==t&&(t!==1&&t!==2&&t!==3&&f.o("Unknown Diagram.treeCollapsePolicy: "+t),this.Ex=t,this.t("treeCollapsePolicy",e,t))}get isCollapsingExpanding(){return this._S}set isCollapsingExpanding(t){this._S=t}rR(){let t=new pt,e=new pt;function i(s){let n=s.toLowerCase(),o=new j;t.set(s,o),t.set(n,o),e.set(s,s),e.set(n,s)}i("InitialAnimationStarting"),i("AnimationStarting"),i("AnimationFinished"),i("BackgroundSingleClicked"),i("BackgroundDoubleClicked"),i("BackgroundContextClicked"),i("ClipboardChanged"),i("ClipboardPasted"),i("DocumentBoundsChanged"),i("ExternalObjectsDropped"),i("GainedFocus"),i("InitialLayoutCompleted"),i("LayoutCompleted"),i("LinkDrawn"),i("LinkRelinked"),i("LinkReshaped"),i("LostFocus"),i("Modified"),i("ObjectSingleClicked"),i("ObjectDoubleClicked"),i("ObjectContextClicked"),i("PartCreated"),i("PartResized"),i("PartRotated"),i("SelectionMoved"),i("SelectionCopied"),i("SelectionDeleting"),i("SelectionDeleted"),i("SelectionGrouped"),i("SelectionUngrouped"),i("ChangingSelection"),i("ChangedSelection"),i("SubGraphCollapsed"),i("SubGraphExpanded"),i("TextEdited"),i("ThemeChanged"),i("TreeCollapsed"),i("TreeExpanded"),i("ViewportBoundsChanged"),i("InvalidateDraw"),this.ZS=t,this.QS=e}YL(t){let e=this.QS.get(t);return e!==null?e:this.QS.get(t.toLowerCase())}KM(t){let e=this.ZS.get(t);if(e!==null)return e;let i=t.toLowerCase();if(e=this.ZS.get(i),e!==null)return e;f.o("Unknown DiagramEvent name: "+t)}addDiagramListener(t,e){f.s(t,"string",U,"addDiagramListener:name"),f.k(e,U,"addDiagramListener:listener");let i=this.KM(t);return i!==null&&i.add(e),this}removeDiagramListener(t,e){f.s(t,"string",U,"removeDiagramListener:name"),f.k(e,U,"addDiagramListener:listener");let i=this.KM(t);i!==null&&i.delete(e)}raiseDiagramEvent(t,e,i){this.D(t,e,i)}D(t,e,i){let s=this.KM(t),n=new Wi;n.diagram=this;let o=this.YL(t);o!==null&&(n.name=o),e!==void 0&&(n.subject=e),i!==void 0&&(n.parameter=i);let r=s.length;if(r===1)s.elt(0)(n);else if(r!==0){let a=s.toArray();for(let h=0;h<r;h++){let l=a[h];l(n)}}}isUnoccupied(t,e){return this.getPositions(!1,null,e||null).isUnoccupied(t.x,t.y,t.width,t.height)}computeOccupiedArea(t){return this.isVirtualized?this.viewportBounds.copy():this.ta?this.VL(t):t.a(this.documentBounds)}getPositions(t,e,i){let s=this.Hl;s===null&&(this.Hl=s=new Et(this.avoidanceCellSize));let n=e;if(s.Fo||s.ua!==n||s.jM!==i){if(s.HM=Math.max(s.Gc+1,Math.floor(this.avoidanceLimit/this.avoidanceCellSize.width)),s.qM=Math.max(s.Gc+1,Math.floor(this.avoidanceLimit/this.avoidanceCellSize.height)),n!==null&&(n=this.oA(n)),n===null){let o=z.l();this.computeOccupiedArea(o),o.inflate(100,100),s.Lb(o);let r=this.nodes;for(;r.next();){let a=r.value,h=a.layer;h===null||!h.visible||h.isTemporary||this.WM(a,i,o)}z.e(o)}else{if(n.memberParts.count>0){let a=this.computePartsBounds(n.memberParts,!1);a.inflate(20,20),s.Lb(a)}let o=z.l(),r=n.memberParts;for(;r.next();){let a=r.value;a instanceof rt&&this.WM(a,i,o)}z.e(o)}s.ua=n,s.jM=i,s.Fo=!1}else t&&s.rA();return s}get avoidanceCellSize(){return this.uM}set avoidanceCellSize(t){this.Hl=null,this.uM=new Q(Math.max(1,t.width),Math.max(1,t.height))}get avoidanceLimit(){return this.dM}set avoidanceLimit(t){this.dM=Math.max(1,t)}oA(t){return t.canAvoid()?t:t.containingGroup!==null?this.oA(t.containingGroup):null}WM(t,e,i){if(t===e||!t.isVisible())return;let s=t.canAvoid();if(s){let n=t.getAvoidableRect(i);this.Hl.VR(n.x,n.y,n.width,n.height)}if(t instanceof ft&&(!s||t.avoidableMembers)){let n=t.memberParts;for(;n.next();){let o=n.value;o instanceof rt&&this.WM(o,e,i)}}}JM(t){this.Hl!==null&&!this.Hl.Fo&&(t===void 0||t.canAvoid())&&(this.Hl.Fo=!0)}get autoScrollInterval(){return this.Im}set autoScrollInterval(t){let e=this.Im;e!==t&&(this.Im=t,this.t("autoScrollInterval",e,t))}get autoScrollRegion(){return this.Em}set autoScrollRegion(t){typeof t=="number"&&(t=new Lt(t));let e=this.Em;e.equals(t)||(t=t.P(),this.Em=t,this.invalidateDocumentBounds(),this.t("autoScrollRegion",e,t))}doAutoScroll(t){this.Ym.a(t),this.computeAutoScrollPosition(this.Ym).equalsApprox(this.position)?this.stopAutoScroll():this.lA()}lA(){if(this.Rc!==-1)return;let t=this.Im,e=this;this.Rc=f.ir(()=>{if(e.Rc===-1||(e.stopAutoScroll(),e.lastInput.event===null))return;let i=e.computeAutoScrollPosition(e.Ym);if(i.equalsApprox(e.position))return;e.position=i,e.lastInput.documentPoint=e.transformViewToDoc(e.Ym),e.doMouseMove(),e.ta=!0;let s=z.l();e.computeBounds(s),s.unionRect(e.documentBounds),e.iA(s),z.e(s),e.Ue=!0,e.maybeUpdate(),e.lA()},t)}stopAutoScroll(){this.Rc!==-1&&(f.Tg(this.Rc),this.Rc=-1)}computeAutoScrollPosition(t){let e=this.position,i=this.Em;if(i.top<=0&&i.left<=0&&i.right<=0&&i.bottom<=0)return e;let s=this.viewportBounds,n=this.scale,o=z.V(0,0,s.width*n,s.height*n),r=P.V(0,0);if(t.x>=o.x&&t.x<o.x+i.left&&this.allowHorizontalScroll){let a=Math.max(this.scrollHorizontalLineChange,1);a=a|0,r.x-=a,t.x<o.x+i.left/2&&(r.x-=a),t.x<o.x+i.left/4&&(r.x-=4*a)}else if(t.x<=o.x+o.width&&t.x>o.x+o.width-i.right&&this.allowHorizontalScroll){let a=Math.max(this.scrollHorizontalLineChange,1);a=a|0,r.x+=a,t.x>o.x+o.width-i.right/2&&(r.x+=a),t.x>o.x+o.width-i.right/4&&(r.x+=4*a)}if(t.y>=o.y&&t.y<o.y+i.top&&this.allowVerticalScroll){let a=Math.max(this.scrollVerticalLineChange,1);a=a|0,r.y-=a,t.y<o.y+i.top/2&&(r.y-=a),t.y<o.y+i.top/4&&(r.y-=4*a)}else if(t.y<=o.y+o.height&&t.y>o.y+o.height-i.bottom&&this.allowVerticalScroll){let a=Math.max(this.scrollVerticalLineChange,1);a=a|0,r.y+=a,t.y>o.y+o.height-i.bottom/2&&(r.y+=a),t.y>o.y+o.height-i.bottom/4&&(r.y+=4*a)}return r.equalsApprox(P.xo)||(e=new P(e.x+r.x/n,e.y+r.y/n)),z.e(o),P.e(r),e}makeSvg(t){this.Wl.has("SVG")||this.addRenderer("SVG",new Ri(this,A.document));let e=new Ri(this,A.document,!0);t===void 0&&(t={});let i=this;function s(n,o){let r=i.hA(n,"SVG",e),a=r!==null?r.svg:null;return f.it(o)?(o(a),null):a}return this.aA(s,t)}makeSVG(t){return this.makeSvg(t)}addRenderer(t,e){this.Wl.set(t,e)}removeRenderer(t){this.Wl.delete(t)}cacheGroupExternalLinks(t){this.MM=t,t||this.nodes.each(e=>{e instanceof ft&&(e.h0=null)})}aA(t,e){let i=e.callback,s=!0,n=this.Jl.iterator;for(;n.next();)if(!n.value[0].hn){s=!1;break}if(!f.it(i)||s)return t(e,i,this);let o=this;function r(){let l=+new Date;for(s=!0,n.reset();n.next();)if(!n.value[0].hn){s=!1;break}if(s||l-h>a){t(e,i,o);return}A.requestAnimationFrame(r)}let a=e.callbackTimeout||300,h=+new Date;return A.requestAnimationFrame(()=>r()),null}makeImage(t){return U.isUsingDOM()?(t===void 0&&(t={}),t.returnType="Image",this.makeImageData(t)):null}makeImageData(t){return t===void 0&&(t={}),this.aA(this.zR,t)}static img="image";zR(t,e,i){let s=i.hA(t,"canvas",null);if(s===null)return null;let n=s.E.canvas,o=null;if(n!==null){let r=t.returnType;switch(r===void 0?r="string":r=r.toLowerCase(),r){case U.img+"data":o=s.getImageData(0,0,n.width,n.height);break;case U.img:let a=(t.document||document).createElement("img");a.src=n.toDataURL(t.type,t.details),o=a;break;case"blob":{let h=n;return f.it(e)||(o="",f.o('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.')),f.it(h.toBlob)?(h.toBlob(e,t.type,t.details),"toBlob"):(e(null),null)}case"string":default:o=n.toDataURL(t.type,t.details)}}return f.it(e)?(e(o),null):o}static XR=!1;hA(t,e,i){if(this.animationManager.stopAnimation(),this.maybeUpdate(),this.ft===null)return null;f.G(t)||f.o("properties argument must be an Object.");let s=!1,n=t.size||null,o=t.scale||null;t.scale!==void 0&&isNaN(t.scale)&&(o="NaN");let r=t.maxSize;t.maxSize===void 0&&(s=!0,e==="SVG"?r=new Q(1/0,1/0):r=new Q(2e3,2e3));let a=t.position||null,h=t.parts||null;Array.isArray(h)&&(h=new j(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||document,g=t.elementFinished||null,p=t.showTemporary;p===void 0&&(p=!c);let m=t.showGrid;m===void 0&&(m=p),n!==null&&isNaN(n.width)&&isNaN(n.height)&&(n=null),typeof l=="number"?l=new Lt(l):l instanceof Lt||f.o("MakeImage padding must be a Margin or a number."),l.left=Math.max(l.left,0),l.right=Math.max(l.right,0),l.top=Math.max(l.top,0),l.bottom=Math.max(l.bottom,0),this.Qt.clearContextCache(!0);let y=new Ue(null,d,void 0,!0),w=y.li;if(!(n||o||h||a))return y.width=this.xt+Math.ceil(l.left+l.right),y.height=this.bt+Math.ceil(l.top+l.bottom),e==="SVG"?i===null?null:(i.resize(y.width,y.height,y.width,y.height),i.jr=d,i.Gu=g,this.Sb(i.li,l,new Q(y.width,y.height),this.tt,this.at,h,u,p,m),i.li):(this.Bu=!1,this.Sb(w,l,new Q(y.width,y.height),this.tt,this.at,h,u,p,m),this.Bu=!0,y.li);let b=this.Km,v=this.documentBounds.copy();if(v.subtractMargin(this.Zt),p){let R=this.Xt.r,O=R.length;for(let B=0;B<O;B++){let K=R[B];if(!K.visible||!K.isTemporary)continue;let Y=K.Ct.r,X=Y.length;for(let G=0;G<X;G++){let nt=Y[G];if(!nt.isInDocumentBounds||!nt.isVisible())continue;let at=nt.actualBounds;at.isReal()&&v.unionRect(at)}}}let k=new P(v.x,v.y);if(h!==null){let R=new z(0,0,0,0),O=!0,B=h.iterator;for(B.reset();B.next();){let K=B.value;if(!(K instanceof Nt))continue;let Y=K.layer;if(Y!==null&&!Y.visible||Y!==null&&!p&&Y.isTemporary||!K.isVisible())continue;let X=K.actualBounds;X.isReal()&&(O?(O=!1,R.a(X)):R.unionRect(X))}v.width=R.width,v.height=R.height,k.x=R.x,k.y=R.y}a!==null&&a.isReal()&&(k=a,o||(o=b));let S=0,M=0;l!==null&&(S=l.left+l.right,M=l.top+l.bottom);let F=0,T=0;n!==null&&(F=n.width,T=n.height,isFinite(F)&&(F=Math.max(0,F-S)),isFinite(T)&&(T=Math.max(0,T-M)));let N=0,C=0;if(n!==null&&o!==null?(o==="NaN"&&(o=b),n.isReal()?(N=F,C=T):isNaN(T)?(N=F,C=v.height*o):(N=v.width*o,C=T)):n!==null?n.isReal()?(o=Math.min(F/v.width,T/v.height),N=F,C=T):isNaN(T)?(o=F/v.width,N=F,C=v.height*o):(o=T/v.height,N=v.width*o,C=T):o!==null?o==="NaN"&&r.isReal()?(o=Math.min((r.width-S)/v.width,(r.height-M)/v.height),o>b?(o=b,N=v.width,C=v.height):(N=r.width,C=r.height)):(N=v.width*o,C=v.height*o):(o=b,N=v.width,C=v.height),l!==null?(N+=S,C+=M):l=new Lt(0),r!==null){let R=r.width,O=r.height;e!=="SVG"&&s&&U.XR,isNaN(R)&&(R=2e3),isNaN(O)&&(O=2e3),isFinite(R)&&(N=Math.min(N,R)),isFinite(O)&&(C=Math.min(C,O))}return y.width=Math.ceil(N),y.height=Math.ceil(C),e==="SVG"?i===null?null:(i.resize(y.width,y.height,y.width,y.height),i.jr=d,i.Gu=g,this.Sb(i.li,l,new Q(Math.ceil(N),Math.ceil(C)),o,k,h,u,p,m),i.li):(this.Bu=!1,this.Sb(w,l,new Q(Math.ceil(N),Math.ceil(C)),o,k,h,u,p,m),this.Bu=!0,y.li)}static Xu=null;static cA="5da73c80a36555d4038e4972187c3cae51fd22";static mw=!1;static Gk=()=>{if(U.cA[5]===void 0&&(Pt.prototype.$e=Pt.prototype.kw),!U.isUsingDOM())return;let t=f.hs("canvas"),e=t.getContext("2d"),i=f.Ts("7ca11abfd022028846");e[i]=f.Ts("398c3597c01238");let s="7ca11abfd7330390",n=[U.cA,f.mw+"4ae6247590da4bb21c324ba3a84e385776",Pt.Gk+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",L.za],o=10,r=0;for(let a=1;a<5;a++)e[f.Ts(s)](f.Ts(n[a-1]),o,a*15+r);e[i]=f.Ts("39f046ebb36e4b");for(let a=1;a<5;a++)e[f.Ts(s)](f.Ts(n[a-1]),o,a*15+r);(n.length!==4||n[0][0]!=="5"||n[3][0]!=="7")&&(Pt.prototype.$e=Pt.prototype.kw),U.Xu=t}}class _o{fA;uA;$M;Ne;constructor(t){if(this.fA=null,this.uA="63ad05bbe23a1786468a4c741b6d2",this.$M="@onz",this.uA===this._tk){this.$M=!0,this.Ne=this.$M;return}this.Ne=null}YR(t,e){let i="f",s=A[f.Ts("76a715b2f73f148a")][f.Ts("72ba13b5")]||"",n=f.Ts;if(this.Ne=!0,!U.isUsingDOM())return;let o=U[n("76a115b6ed251eaf4692")];if(!o){let a=s[n("76ad18b4f73e")];for(let l=s[n("73a612b6fb191d")](n("35e7"))+2;l<a;l++)i+=s[l];let h=i[n("73a612b6fb191d")](n("7da71ca0ad381e90"));this.Ne=!(h>=0&&h<i[n("73a612b6fb191d")](n("35")));return}let r=U.XM.iterator;for(;r.next();){o=r.value;let a=n(o).split(n("39e9"));if(a.length<6)return;let h=n(a[1]).split(".");if(a[4]!=="7da71ca0")return;let l=n(f[n("6cae19")]).split(".");if(!(h[0]>l[0]||h[0]===l[0]&&h[1]>=l[1]))continue;let u="73a612b6fb191d",c=A[n("74a900bae4370f8b51")][n("6fbb13a1c2311e8a57")].toLowerCase(),d=c[n(u)](n("3aad1ab6e022098b4dc4")),g=n(a[2]);if(d>-1){let N=c[n(u)](g.toLowerCase()+"/");if(this.Ne=!(N>-1&&N<d),!this.Ne)return}let p=s[n("76ad18b4f73e")];for(let N=s[n(u)](n("35e7"))+2;N<p;N++)i+=s[N];let m=i[n(u)](g);if(m<0&&g!==n("7da71ca0ad381e90")&&(m=i[n(u)](n("76a715b2ef3e149757"))),m<0&&(m=i[n(u)](n("76a715b2ef3e149757"))),m<0&&(m=i[n(u)](n("2bfa41fdb3784bca12"))),m<0&&(m=s[n(u)](n("7baa19a6f76c1988428554"))),m<0&&(m=s[n(u)](n("7ea902b2b9221e9c57c45767196566"))),this.Ne=!(m>=0&&m<i[n(u)](n("35"))||i[n(u)](n("35"))===-1),!this.Ne||s[n(u)](n("7fb002b6ed25128b4da25b2e"))&&(this.Ne=!(s[n(u)](g)>-1),!this.Ne))return;let y=A[f.Ts("76a715b2f73f148a")][f.Ts("69ad17a1e03e")],w=y[n(u)](n("7fb002b6ed25128b4da25b2e"));if(w>-1&&(this.Ne=!(y[n(u)](g)>w),!this.Ne))return;let b=g;if(b[0]!=="#")continue;let v=f.hs("div"),k=a[0].replace(/[A-Za-z]/g,"");for(;k.length<4;)k+="9";let S=k;k=k.substring(k.length-4);let M="",F=["gsh","gsf"],T=["Header","Background","Display","Feedback"];if(M+=F[parseInt(k.substring(0,1),10)%2],M+=T[parseInt(k.substring(0,1),10)%4],v[n("79a417a0f0181a8946")]=M,A.document[n("78a712aa")]){A.document[n("78a712aa")][n("7bb806b6ed32388c4a875b")](v);let N=A.getComputedStyle(v).getPropertyValue(n("78a704b7e62456904c9b12701b6532a8")),C=A.getComputedStyle(v).getPropertyValue(n("75b817b0ea2202"));if(A.document[n("78a712aa")][n("68ad1bbcf533388c4a875b")](v),!N)continue;let R=A[n("77a902b0eb1b1e804a8a")],O="0."+parseInt(S,10)%100;if(C===O||N.indexOf(parseInt(b[1]+b[2],16))!==-1&&N.indexOf(parseInt(b[3]+b[4],16))!==-1){this.Ne=!1;return}else if(R&&R(n("32ae19a1e0331fc94084537c067a67fa59f1386b89d006")).matches){M="."+M;for(let B=0;B<document.styleSheets.length;B++){let K=document.styleSheets[B].rules||document.styleSheets[B].cssRules;for(let Y in K)if(M===K[Y].selectorText){this.Ne=!1;return}}}}else this.Ne=null,e&&(this.Ne=!1)}}Xu(t){return t.Qt.setTransform(t.Vi,0,0,t.Vi,0,0),t.Qt.commitTransform(),this.Ne===null&&this.YR(t,!0),0<this.Ne&&this!==this.fA}}class ni{ZM;QM;constructor(t){this.ZM=t===void 0?new P:t,this.QM=new P}get point(){return this.ZM}set point(t){this.ZM=t}get shifted(){return this.QM}set shifted(t){this.QM=t}}class tr{Me;qL;Nb;constructor(t,e,i){this.Me=t,this.qL=e,this.Nb=i}}class Qi{isGridSnapEnabled;isGridSnapRealtime;gridSnapCellSize;gridSnapCellSpot;gridSnapOrigin;dragsLink;dragsTree;groupsSnapMembers;groupsAlwaysMove;dragsMembers;constructor(t){this.Ri(),t&&Object.assign(this,t)}Ri(){this.isGridSnapEnabled=!1,this.isGridSnapRealtime=!0,this.gridSnapCellSize=new Q(NaN,NaN).u(),this.gridSnapCellSpot=D.TopLeft,this.gridSnapOrigin=new P(NaN,NaN).u(),this.dragsLink=!1,this.dragsTree=!1,this.groupsSnapMembers=!1,this.groupsAlwaysMove=!0,this.dragsMembers=!0}}class er extends U{constructor(t,e){let i;return t===void 0||typeof t=="string"||A.Element&&t instanceof Element?i=t:f.G(t)&&(e=t),super(i),this.dA(),e&&this.setProperties(e),this}dA(){this.allowDragOut=!0,this.allowMove=!1,this.isReadOnly=!0,this.contentAlignment=D.TopCenter,this.layout=new ri}setupRouters(){}reset(){super.reset(),this.dA()}}class _i extends U{Ab;Tb;Db;Fb;a0;Kc;Al;_M;t2;Rb;i2;constructor(t,e){let i;return t===void 0||typeof t=="string"||A.Element&&t instanceof Element?i=t:f.G(t)&&(e=t),super(i),this.animationManager.isEnabled=!1,this.Ht=!0,this.Ab=null,this.Ru=!1,this.vu=!1,this.Tb=!0,this.Db=!0,this.Fb=0,this.a0=!1,this.Kc=null,this.setRenderingHint("drawShadows",!1),this.Al=new Nt({selectable:!0,selectionAdorned:!1,selectionObjectName:"BOXSHAPE",locationObjectName:"BOXSHAPE",resizeObjectName:"BOXSHAPE",cursor:"move"}).add(new ut({name:"BOXSHAPE",fill:"transparent",stroke:"magenta",strokeWidth:2}).theme("stroke","overviewBox")).Et(),this.allowCopy=!1,this.allowDelete=!1,this.allowDrop=!1,this.allowSelect=!0,this.autoScrollRegion=new Lt(0,0,0,0),this.at.i(0,0),this.toolManager.Jt("Dragging",new ir,this.toolManager.mouseMoveTools),this.click=()=>{let s=this.observed;if(s===null)return;let n=s.viewportBounds,o=this.lastInput.documentPoint;s.position=new P(o.x-n.width/2,o.y-n.height/2)},this._M=s=>{this.invalidateDocumentBounds(),this.c0()},this.t2=s=>{this.observed!==null&&(this.invalidateDocumentBounds(),this.S())},this.Rb=s=>{this.updateDelay<1?this.S():this.a0||(this.a0=!0,f.ir(()=>this.redraw(),this.updateDelay))},this.i2=s=>{this.observed!==null&&this.c0()},this.autoScale=2,this.Ht=!1,e&&Object.assign(this,e),this}setupRouters(){}computePixelRatio(){return 1}redraw(){this.a0&&this.updateDelay>=1&&(this.a0=!1,this.GR()),super.redraw()}Ui(){if(this.Mt===null&&f.o("No div specified"),this.ft===null&&f.o("No canvas specified"),this.ft instanceof Ri||(this.box.JS(),!this.Ue))return;let t=this.observed;if(t===null||t.animationManager.defaultAnimation.isAnimating||!t.Vh)return;this.e0();let e=this.ft,i=this.Qt;if(i.clearContextCache(!0),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,e.width,e.height),this.updateDelay<1)this.gA();else if(this.Kc!==null){i.drawImage(this.Kc.Tt,0,0);let o=this.T;i.scale(this.Vi,this.Vi),i.transform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),i.commitTransform()}let s=this.Xt.r,n=s.length;for(let o=0;o<n;o++)s[o].Ui(i,this);this.Ic=!1,this.Ue=!1}GR(){let t=this.ft,e=this.Qt;if(!(t===null||e===null)){if(this.e0(),this.Kc===null){let i=new Ue(null);i.width=t.width,i.height=t.height,this.Kc=i}try{this.ft=this.Kc,this.Qt=this.ft.li,this.Qt.clearContextCache(!0),this.Qt.setTransform(1,0,0,1,0,0),this.Qt.clearRect(0,0,this.ft.width,this.ft.height),this.gA()}finally{this.ft=t,this.Qt=e}}}gA(){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=z.l().a(this.viewportBounds).unionRect(t.viewportBounds);t.th(u),z.e(u),t.Mi()}let n=this.T,o=this.Qt;o.scale(this.Vi,this.Vi),o.transform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),o.commitTransform();let r=this.viewportBounds,a=t.Xt.r,h=a.length,l=this.Xt.r;this.ps(l,l.length,this,this.viewportBounds);for(let u=0;u<h;u++)a[u].KF(o,r,this,e,i)}get observed(){return this.Ab}set observed(t){let e=this.Ab;if(t instanceof _i&&f.o("Overview.observed Diagram may not be an Overview itself: "+t),e!==t){if(e!==null&&this.KR(e),this.Ab=t,t!==null&&this.jR(t),this.invalidateDocumentBounds(),t===null){this.Kc=null;let i=this.ft,s=this.Qt;i&&s&&(s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,i.width,i.height))}else this.Rb(null),this.c0(),this.S();this.t("observed",e,t)}}get box(){return this.Al}set box(t){let e=this.Al;e!==t&&(t.Et(),this.Al=t,this.remove(e),this.add(this.Al),this.c0(),this.t("box",e,t))}get drawsTemporaryLayers(){return this.Tb}set drawsTemporaryLayers(t){this.Tb!==t&&(this.Tb=t,this.redraw())}get drawsGrid(){return this.Db}set drawsGrid(t){this.Db!==t&&(this.Db=t,this.redraw())}get updateDelay(){return this.Fb}set updateDelay(t){t<0&&(t=0),this.Fb!==t&&(this.Fb=t)}jR(t){t!==null&&(t.addDiagramListener("ViewportBoundsChanged",this._M),t.addDiagramListener("DocumentBoundsChanged",this.t2),t.addDiagramListener("InvalidateDraw",this.Rb),t.addDiagramListener("AnimationFinished",this.i2),this.add(this.box))}KR(t){t!==null&&(this.remove(this.box),t.removeDiagramListener("ViewportBoundsChanged",this._M),t.removeDiagramListener("DocumentBoundsChanged",this.t2),t.removeDiagramListener("InvalidateDraw",this.Rb),t.removeDiagramListener("AnimationFinished",this.i2))}c0(){let t=this.box,e=this.observed;if(e===null)return;this.Ue=!0;let i=e.viewportBounds,s=t.selectionObject,n=Q.l();n.i(i.width,i.height),s.desiredSize=n,Q.e(n);let o=2/this.scale;s instanceof ut&&(s.strokeWidth=o),t.location=new P(i.x-o/2,i.y-o/2),t.isSelected=!0}computeBounds(){let t=this.observed;if(t===null)return z.Fg;let e=t.documentBounds.copy();return e.unionRect(t.viewportBounds),e}invalidateViewport(t,e){this.Ue!==!0&&(this.Ue=!0,this.requestUpdate())}onViewportBoundsChanged(t,e,i,s){this.Ht||(this._l(),this.S(),this.aa(),this.invalidateDocumentBounds(),this.c0(),this.Bi.scale=i,this.Bi.position.x=t.x,this.Bi.position.y=t.y,this.Bi.bounds.a(t),this.Bi.isScroll=s,this.D("ViewportBoundsChanged",this.Bi,t))}}class ir extends Dt{eh;constructor(){super(),this.eh=null}canStart(){if(!this.isEnabled)return!1;let t=this.diagram;if(t===null||!t.allowMove||!t.allowSelect)return!1;let e=t.observed;if(e===null)return!1;let i=t.lastInput;if(!i.left||t.currentTool!==this&&(!this.isBeyondDragSize()||i.isTouchEvent&&i.timestamp-t.firstInput.timestamp<this.delay))return!1;if(this.findDraggablePart()===null){let s=e.viewportBounds;this.eh=new P(s.width/2,s.height/2);let n=t.firstInput.documentPoint;e.position=new P(n.x-this.eh.x,n.y-this.eh.y)}return!0}doActivate(){this.eh=null,super.doActivate()}doUpdateCursor(t){let e=this.diagram,i=e.box;i!==null&&i.cursor&&(e.currentCursor=i.cursor)}moveParts(t,e,i){i===void 0&&(i=!1);let s=this.diagram,n=s.observed;if(n===null)return;let o=s.box;if(o===null)return;if(this.eh===null){let a=s.firstInput.documentPoint,h=o.location;this.eh=new P(a.x-h.x,a.y-h.y)}let r=s.lastInput.documentPoint;n.position=new P(r.x-this.eh.x,r.y-this.eh.y)}}class be{N;e2;s2;o2;l2;h2;a2;c2;f2;nh;u2;vb;Ob;Ib;Eb;d2;Ro;g2;constructor(t){I.Ki(this),this.N=U.um(),this.e2=!0,this.s2=!0,this.o2=!0,this.l2=!1,this.h2=!1,this.a2=!1,this.c2=!1,this.f2=null,this.nh=null,this.u2=1.05,this.vb=NaN,this.Ob=null,this.Ib=NaN,this.Eb=z.Fg,this.d2=!1,this.Ro=null,this.g2=200,t&&Object.assign(this,t)}toString(){return"CommandHandler"}get diagram(){return this.N}Mo(t){this.N=t}doStart(){}doStop(){}doKeyDown(){let t=this.diagram,e=t.lastInput,i=f.tr?e.meta:e.control,s=e.shift,n=e.alt,o=e.commandKey;i&&(o==="Insert"||o==="c")?this.canCopySelection()&&this.copySelection():i&&o==="x"||s&&o==="Delete"?this.canCutSelection()&&this.cutSelection():i&&o==="v"||s&&o==="Insert"?this.canPasteSelection()&&this.pasteSelection():i&&o==="y"||i&&s&&o==="z"||n&&s&&o==="Backspace"?this.canRedo()&&this.redo():i&&o==="z"||n&&o==="Backspace"?this.canUndo()&&this.undo():o==="Delete"||o==="Backspace"?this.canDeleteSelection()&&this.deleteSelection():i&&o==="a"?this.canSelectAll()&&this.selectAll():o==="Escape"?this.canStopCommand()&&this.stopCommand():o==="ArrowUp"?t.allowVerticalScroll&&(i?t.scroll("pixel","up"):t.scroll("line","up")):o==="ArrowDown"?t.allowVerticalScroll&&(i?t.scroll("pixel","down"):t.scroll("line","down")):o==="ArrowLeft"?t.allowHorizontalScroll&&(i?t.scroll("pixel","left"):t.scroll("line","left")):o==="ArrowRight"?t.allowHorizontalScroll&&(i?t.scroll("pixel","right"):t.scroll("line","right")):o==="PageUp"?s&&t.allowHorizontalScroll?t.scroll("page","left"):t.allowVerticalScroll&&t.scroll("page","up"):o==="PageDown"?s&&t.allowHorizontalScroll?t.scroll("page","right"):t.allowVerticalScroll&&t.scroll("page","down"):o==="Home"?i&&t.allowVerticalScroll?t.scroll("document","up"):!i&&t.allowHorizontalScroll&&t.scroll("document","left"):o==="End"?i&&t.allowVerticalScroll?t.scroll("document","down"):!i&&t.allowHorizontalScroll&&t.scroll("document","right"):o==="Space"?this.canScrollToPart()&&this.scrollToPart():o==="Minus"||o==="NumpadSubtract"?this.canDecreaseZoom()&&this.decreaseZoom():o==="Equal"||o==="NumpadAdd"?this.canIncreaseZoom()&&this.increaseZoom():i&&o==="Digit0"?this.canResetZoom()&&this.resetZoom():s&&o==="z"?this.canZoomToFit()&&this.zoomToFit():i&&!s&&o==="g"?this.canGroupSelection()&&this.groupSelection():i&&s&&o==="g"?this.canUngroupSelection()&&this.ungroupSelection():o==="F2"?this.canEditTextBlock()&&this.editTextBlock():o==="ContextMenu"||s&&o==="F10"||i&&s&&o==="Backslash"?this.canShowContextMenu()&&this.showContextMenu():e.bubbles=!0}doKeyUp(){let t=this.diagram.lastInput;t.bubbles=!0}stopCommand(){let t=this.diagram,e=t.currentTool;e instanceof xe&&t.allowSelect&&t.clearSelection(),e!==null&&e.doCancel()}canStopCommand(){return!0}selectAll(){let t=this.diagram;t.S();try{t.currentCursor="wait",t.D("ChangingSelection",t.selection);let e=t.parts;for(;e.next();){let n=e.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}let i=t.nodes;for(;i.next();){let n=i.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}let s=t.links;for(;s.next();){let n=s.value;n.canSelect()&&!n.layer.isTemporary&&(n.isSelected=!0)}}finally{t.D("ChangedSelection",t.selection),t.currentCursor=""}}canSelectAll(){return this.diagram.allowSelect}deleteSelection(){let t=this.diagram;try{t.currentCursor="wait",t.D("ChangingSelection",t.selection),t.startTransaction("Delete"),t.D("SelectionDeleting",t.selection);let e=new I,i=t.selection.iterator;for(;i.next();){let s=i.value;Nt.oh(e,s,!0,this.deletesTree?1/0:0,this.deletesConnectedLinks?null:!1,n=>n.canDelete())}t.removeParts(e,!0),t.D("SelectionDeleted",e)}finally{t.commitTransaction("Delete"),t.D("ChangedSelection",t.selection),t.currentCursor=""}}canDeleteSelection(){let t=this.diagram;return!(t.isReadOnly||t.isModelReadOnly||!t.allowDelete||t.selection.count===0)}copySelection(){let t=this.diagram;try{let e=new I,i=t.selection.iterator;for(;i.next();){let s=i.value;Nt.oh(e,s,!0,this.copiesTree?1/0:0,this.copiesConnectedLinks,n=>n.canCopy())}this.copyToClipboard(e)}finally{}}canCopySelection(){let t=this.diagram;return!(!t.allowCopy||!t.allowClipboard||t.selection.count===0)}cutSelection(){this.copySelection(),this.deleteSelection()}canCutSelection(){let t=this.diagram;return!(t.isReadOnly||t.isModelReadOnly||!t.allowCopy||!t.allowDelete||!t.allowClipboard||t.selection.count===0)}copyToClipboard(t){let e=this.diagram,i=null;if(t===null)U.vL();else{let s=null;try{s=e.copyParts(t,null,!0)}finally{i=new j,s!==null&&i.addAll(s.iteratorValues),U.Zm=i,U.bb=e.model.dataFormat}}e.D("ClipboardChanged",i)}pasteFromClipboard(){let t=new I,e=U.Zm;if(e===null)return t;let i=this.diagram;if(U.bb!==i.model.dataFormat)return t;let s=null;try{s=i.copyParts(e,i,!1)}finally{if(s!==null){let n=s.iterator;for(;n.next();){let o=n.value,r=n.key;o.location.isReal()||(r.location.isReal()?o.location=r.location:!o.position.isReal()&&r.position.isReal()&&(o.position=r.position)),t.add(o)}}}return t}pasteSelection(t){t===void 0&&(t=null);let e=this.diagram;try{e.currentCursor="wait",e.D("ChangingSelection",e.selection),e.startTransaction("Paste");let i=this.pasteFromClipboard();i.count>0&&e.clearSelection(!0);let s=i.iterator;for(;s.next();){let n=s.value;n.isSelected=!0}if(t!==null){let n=e.computePartsBounds(e.selection);if(n.isReal()){let o=this.computeEffectiveCollection(e.selection,e.yb);e.TP(o,new P(t.x-n.centerX,t.y-n.centerY),e.yb,!1)}}e.D("ClipboardPasted",i)}finally{e.commitTransaction("Paste"),e.D("ChangedSelection",e.selection),e.currentCursor=""}}canPasteSelection(t){let e=this.diagram;return!(e.isReadOnly||e.isModelReadOnly||!e.allowInsert||!e.allowClipboard||U.Zm===null||U.Zm.count===0||U.bb!==e.model.dataFormat)}undo(){this.diagram.undoManager.undo()}canUndo(){let t=this.diagram;return t.isReadOnly||t.isModelReadOnly?!1:t.allowUndo&&t.undoManager.canUndo()}redo(){this.diagram.undoManager.redo()}canRedo(){let t=this.diagram;return t.isReadOnly||t.isModelReadOnly?!1:t.allowUndo&&t.undoManager.canRedo()}decreaseZoom(t){t===void 0&&(t=1/this.zoomFactor);let e=this.diagram;if(e.autoScale!==1)return;let i=e.scale*t;i<e.minScale||i>e.maxScale||(e.scale=i)}canDecreaseZoom(t){t===void 0&&(t=1/this.zoomFactor);let e=this.diagram;if(e.autoScale!==1)return!1;let i=e.scale*t;return i<e.minScale||i>e.maxScale?!1:e.allowZoom}increaseZoom(t){t===void 0&&(t=this.zoomFactor);let e=this.diagram;if(e.autoScale!==1)return;let i=e.scale*t;i<e.minScale||i>e.maxScale||(e.scale=i)}canIncreaseZoom(t){t===void 0&&(t=this.zoomFactor);let e=this.diagram;if(e.autoScale!==1)return!1;let i=e.scale*t;return i<e.minScale||i>e.maxScale?!1:e.allowZoom}resetZoom(t){t===void 0&&(t=this.defaultScale);let e=this.diagram;t<e.minScale||t>e.maxScale||(e.scale=t)}canResetZoom(t){t===void 0&&(t=this.defaultScale);let e=this.diagram;return t<e.minScale||t>e.maxScale?!1:e.allowZoom}zoomToFit(){let t=this.diagram,e=t.animationManager;e.stopAnimation(),t.redraw();let i=t.position,s=t.scale;e.Fl("Zoom To Fit"),this.isZoomToFitRestoreEnabled&&s===this.Ib&&!isNaN(this.vb)&&this.Ob!==null&&t.documentBounds.equals(this.Eb)?(t.scale=this.vb,t.position=this.Ob,this.Ib=NaN,this.Eb=z.Fg):(this.vb=s,this.Ob=i.copy(),t.zoomToFit(),this.Ib=t.scale,this.Eb=t.documentBounds.copy()),e.OS()}canZoomToFit(){return this.diagram.allowZoom}scrollToPart(t){t===void 0&&(t=null);let e=this.diagram;if(e.ensureBounds(),t===null){try{this.Ro!==null&&(this.Ro.next()?t=this.Ro.value:this.Ro=null)}catch{this.Ro=null}t===null&&(e.highlighteds.count>0?this.Ro=e.highlighteds.iterator:e.selection.count>0&&(this.Ro=e.selection.iterator),this.Ro!==null&&this.Ro.next()&&(t=this.Ro.value))}if(t!==null){let i=e.animationManager;i.Fl("Scroll To Part");let s=this.scrollToPartPause;if(s>0){let n=this.jc(t,[t]);if(n.length===1)e.startTransaction(),e.centerRect(t.actualBounds),e.commitTransaction("Scroll To Part");else{let o=()=>{e.startTransaction();let a=n.pop();for(;n.length>0&&a instanceof rt&&a.isTreeExpanded&&(!(a instanceof ft)||a.isSubGraphExpanded);)a=n.pop();n.length>0?(a instanceof Nt&&e.scrollToRect(a.actualBounds),a instanceof rt&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof ft&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof Nt&&e.centerRect(a.actualBounds),e.removeDiagramListener("LayoutCompleted",r)),e.commitTransaction("Scroll To Part")},r=()=>{f.ir(o,(i.isEnabled?i.duration:0)+s)};e.addDiagramListener("LayoutCompleted",r),o()}}else{let n=e.position.copy();e.centerRect(t.actualBounds),n.equalsApprox(e.position)&&i.stopAnimation()}}}jc(t,e){if(t.isVisible())return e;if(t instanceof St){let i=t.adornedPart;i!==null&&this.jc(i,e)}else if(t instanceof _){let i=t.fromNode;i!==null&&this.jc(i,e);let s=t.toNode;s!==null&&this.jc(s,e)}else{if(t instanceof rt){let s=t.labeledLink;s!==null&&this.jc(s,e);let n=t.findTreeParentNode();n!==null&&(!n.isTreeExpanded&&!n.wasTreeExpanded&&e.push(n),this.jc(n,e))}let i=t.containingGroup;i!==null&&(!i.isSubGraphExpanded&&!i.wasSubGraphExpanded&&e.push(i),this.jc(i,e))}return e}canScrollToPart(t){if(t===void 0&&(t=null),t!==null&&!(t instanceof Nt))return!1;let e=this.diagram;return e.selection.count===0&&e.highlighteds.count===0?!1:e.allowHorizontalScroll&&e.allowVerticalScroll}collapseTree(t){t===void 0&&(t=null);let e=this.diagram,i="Collapse Tree";try{e.startTransaction(i),e.animationManager.Fl(i);let s=new j;if(t!==null&&t.isTreeExpanded)t.collapseTree(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof rt&&o.isTreeExpanded&&(o.collapseTree(),s.add(o))}}e.D("TreeCollapsed",s)}finally{e.commitTransaction(i)}}canCollapseTree(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly)return!1;if(t!==null){if(!(t instanceof rt)||!t.isTreeExpanded)return!1;if(t.findTreeChildrenLinks().count>0)return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof rt){if(!s.isTreeExpanded)continue;if(s.findTreeChildrenLinks().count>0)return!0}}}return!1}expandTree(t){t===void 0&&(t=null);let e=this.diagram,i="Expand Tree";try{e.startTransaction(i),e.animationManager.Fl(i);let s=new j;if(t!==null&&!t.isTreeExpanded)t.expandTree(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof rt&&(o.isTreeExpanded||(o.expandTree(),s.add(o)))}}e.D("TreeExpanded",s)}finally{e.commitTransaction(i)}}canExpandTree(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly)return!1;if(t!==null){if(!(t instanceof rt)||t.isTreeExpanded)return!1;if(t.findTreeChildrenLinks().count>0)return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof rt){if(s.isTreeExpanded)continue;if(s.findTreeChildrenLinks().count>0)return!0}}}return!1}groupSelection(){let t=this.diagram,e=t.model;if(!e.Hc())return;let i=this.archetypeGroupData;if(i===null)return;let s=null;try{t.currentCursor="wait",t.D("ChangingSelection",t.selection),t.startTransaction("Group");let n=new j,o=t.selection.iterator;for(;o.next();){let l=o.value;l.ke()&&l.canGroup()&&n.add(l)}let r=new j,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 ft)i.Et(),s=i.copy(),s!==null&&t.add(s);else if(e.isGroupForData(i)){let u=e.copyNodeData(i);f.G(u)&&(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.D("SelectionGrouped",s)}finally{t.commitTransaction("Group"),t.D("ChangedSelection",t.selection),t.currentCursor=""}}canGroupSelection(){let t=this.diagram;if(t.isReadOnly||t.isModelReadOnly||!t.allowInsert||!t.allowGroup||!t.model.Hc()||this.archetypeGroupData===null)return!1;let e=t.selection.iterator;for(;e.next();){let i=e.value;if(i.ke()&&i.canGroup())return!0}return!1}m2(t){let e=f.et();if(Array.isArray(t))t.forEach(n=>{n instanceof _||n instanceof Nt&&e.push(n)});else{let n=t.iterator;for(;n.next();){let o=n.value;o instanceof _||o instanceof Nt&&e.push(o)}}let i=new I,s=e.length;for(let n=0;n<s;n++){let o=e[n],r=!0;for(let a=0;a<s;a++)if(o.isMemberOf(e[a])){r=!1;break}r&&i.add(o)}return f.J(e),i}isValidMember(t,e){if(e===null||t===e||e instanceof _)return!1;let i;return t!==null&&(t===e||t.isMemberOf(e)||(i=t.memberValidation,i!==null&&!i(t,e))||t.data===null&&e.data!==null||t.data!==null&&e.data===null)?!1:(i=this.memberValidation,i!==null?i(t,e):!0)}ungroupSelection(t){t===void 0&&(t=null);let e=this.diagram,i=e.model;if(i.Hc())try{e.currentCursor="wait",e.D("ChangingSelection",e.selection),e.startTransaction("Ungroup");let s=new j;if(t!==null)s.add(t);else{let o=e.selection.iterator;for(;o.next();){let r=o.value;r instanceof ft&&r.canUngroup()&&s.add(r)}}let n=new j;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 _)continue;let c=u.data;c!==null?i.setGroupForData(c,h):u.containingGroup=a}e.remove(r)}}e.D("SelectionUngrouped",s,n)}finally{e.commitTransaction("Ungroup"),e.D("ChangedSelection",e.selection),e.currentCursor=""}}canUngroupSelection(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly||e.isModelReadOnly||!e.allowDelete||!e.allowUngroup||!e.model.Hc())return!1;if(t!==null){if(!(t instanceof ft))return!1;if(t.canUngroup())return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ft&&s.canUngroup())return!0}}return!1}addTopLevelParts(t,e){let i=this.m2(t),s=!0,n=i.iterator;for(;n.next();){let o=n.value;o.containingGroup!==null&&(!e||this.isValidMember(null,o)?o.containingGroup=null:s=!1)}return s}collapseSubGraph(t){t===void 0&&(t=null);let e=this.diagram,i="Collapse SubGraph";try{e.startTransaction(i),e.animationManager.Fl(i);let s=new j;if(t!==null&&t.isSubGraphExpanded)t.collapseSubGraph(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof ft&&o.isSubGraphExpanded&&(o.collapseSubGraph(),s.add(o))}}e.D("SubGraphCollapsed",s)}finally{e.commitTransaction(i)}}canCollapseSubGraph(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly)return!1;if(t!==null)return!(!(t instanceof ft)||!t.isSubGraphExpanded);{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ft&&s.isSubGraphExpanded)return!0}}return!1}expandSubGraph(t){t===void 0&&(t=null);let e=this.diagram,i="Expand SubGraph",s=new j;try{if(e.startTransaction(i),e.animationManager.Fl(i),t!==null&&!t.isSubGraphExpanded)t.expandSubGraph(),s.add(t);else if(t===null){let n=e.selection.iterator;for(;n.next();){let o=n.value;o instanceof ft&&(o.isSubGraphExpanded||(o.expandSubGraph(),s.add(o)))}}e.D("SubGraphExpanded",s)}finally{for(let n of s)this.mA(e,n);t&&this.mA(e,t),e.commitTransaction(i)}}mA(t,e){for(let i of e.memberParts)i instanceof rt&&t.Cc(i,e)}canExpandSubGraph(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly)return!1;if(t!==null)return!(!(t instanceof ft)||t.isSubGraphExpanded);{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s instanceof ft&&!s.isSubGraphExpanded)return!0}}return!1}editTextBlock(t){t===void 0&&(t=null);let e=this.diagram,i=e.toolManager.findTool("TextEditing");if(i!==null){if(t===null){let s=null,n=e.selection.iterator;for(;n.next();){let o=n.value;if(o.canEdit()){s=o;break}}if(s===null)return;t=s.findInVisualTree(o=>o instanceof xt&&o.editable)}t!==null&&(e.currentTool=null,i.textBlock=t,e.currentTool=i)}}canEditTextBlock(t){t===void 0&&(t=null);let e=this.diagram;if(e.isReadOnly||e.isModelReadOnly||!e.allowTextEdit||e.toolManager.findTool("TextEditing")===null)return!1;if(t!==null){if(!(t instanceof xt))return!1;let i=t.part;if(i!==null&&i.canEdit())return!0}else{let i=e.selection.iterator;for(;i.next();){let s=i.value;if(s.canEdit()&&(t=s.findInVisualTree(n=>n instanceof xt&&n.editable),t!==null))return!0}}return!1}showContextMenu(t){let e=this.diagram,i=e.toolManager.findTool("ContextMenu");if(i===null)return;t===void 0&&(t=null),t===null&&(e.selection.count>0?t=e.selection.first():t=e);let s=i.findObjectWithContextMenu(t);if(s!==null){let n=e.lastInput,o=null;if(s instanceof dt)o=s.getDocumentPoint(D.Center);else if(!e.viewportBounds.containsPoint(n.documentPoint)){let r=e.viewportBounds;o=new P(r.x+r.width/2,r.y+r.height/2)}if(o!==null){let r=new je;r.diagram=e,r.viewPoint=e.transformDocToView(o),r.documentPoint=o,r.button=2,r.up=!0,e.lastInput=r}e.currentTool=i,i.openMenu(!1,s)}}canShowContextMenu(t){let e=this.diagram,i=e.toolManager.findTool("ContextMenu");return!(i===null||(t===void 0&&(t=null),t===null&&(e.selection.count>0?t=e.selection.first():t=e),i.findObjectWithContextMenu(t)===null))}get copiesClipboardData(){return this.e2}set copiesClipboardData(t){f.s(t,"boolean",be,"copiesClipboardData"),this.e2=t}get copiesConnectedLinks(){return this.s2}set copiesConnectedLinks(t){f.s(t,"boolean",be,"copiesConnectedLinks"),this.s2=t}get deletesConnectedLinks(){return this.o2}set deletesConnectedLinks(t){f.s(t,"boolean",be,"deletesConnectedLinks"),this.o2=t}get copiesTree(){return this.l2}set copiesTree(t){f.s(t,"boolean",be,"copiesTree"),this.l2=t}get deletesTree(){return this.h2}set deletesTree(t){f.s(t,"boolean",be,"deletesTree"),this.h2=t}get copiesParentKey(){return this.a2}set copiesParentKey(t){f.s(t,"boolean",be,"copiesParentKey"),this.a2=t}get copiesGroupKey(){return this.c2}set copiesGroupKey(t){f.s(t,"boolean",be,"copiesGroupKey"),this.c2=t}get archetypeGroupData(){return this.f2}set archetypeGroupData(t){t!==null&&f.ec(t,be,"archetypeGroupData");let e=this.diagram;this.f2=t}get memberValidation(){return this.nh}set memberValidation(t){t!==null&&f.k(t,be,"memberValidation"),this.nh=t}get defaultScale(){return this.diagram.defaultScale}set defaultScale(t){this.diagram.defaultScale=t}get zoomFactor(){return this.u2}set zoomFactor(t){t>1||f.o("zoomFactor must be larger than 1.0, not: "+t),this.u2=t}get isZoomToFitRestoreEnabled(){return this.d2}set isZoomToFitRestoreEnabled(t){f.s(t,"boolean",be,"isZoomToFitRestoreEnabled"),this.d2=t}get scrollToPartPause(){return this.g2}set scrollToPartPause(t){this.g2=t}computeEffectiveCollection(t,e){let i=this.diagram,s=i.toolManager.findTool("Dragging"),n=i.currentTool===s;e===void 0&&(e=i.o0());let o=new pt;if(t===null)return o;let r=t.iterator;for(;r.next();){let a=r.value;i.Kr(o,a,n,e)}if(i.draggedLink!==null&&e.dragsLink)return o;for(r=t.iterator;r.next();){let a=r.value;if(a instanceof _){let h=a.fromNode;if(h!==null&&!o.has(h))o.delete(a);else{let l=a.toNode;l!==null&&!o.has(l)&&o.delete(a)}}}return o}}var ws=(x=>(x[x.None=0]="None",x[x.Default=1]="Default",x[x.Vertical=4]="Vertical",x[x.Horizontal=5]="Horizontal",x[x.Fill=2]="Fill",x))(ws||{}),bs=(x=>(x[x.None=0]="None",x[x.Along=21]="Along",x[x.Plus90=22]="Plus90",x[x.Minus90=23]="Minus90",x[x.Opposite=24]="Opposite",x[x.Upright=25]="Upright",x[x.Plus90Upright=26]="Plus90Upright",x[x.Minus90Upright=27]="Minus90Upright",x[x.Upright45=28]="Upright45",x))(bs||{}),Ln=(x=>(x[x.None=0]="None",x[x.Vertical=1]="Vertical",x[x.Horizontal=2]="Horizontal",x[x.Both=3]="Both",x))(Ln||{});class dt{n;f0;u0;Hr;p;lh;ct;at;se;$t;d0;Vs;Lt;is;qr;hh;wi;da;tt;Yt;Wr;Ni;zi;Ku;hi;ju;Ot;si;Jr;Ub;ah;Hu;constructor(){I.Ki(this),this.n=30723,this.$t=1,this.d0="",this.Vs=null,this.Lt=null,this.at=new P(NaN,NaN).u(),this.is=Q.ww,this.qr=new Pt,this.hh=new Pt,this.wi=null,this.da=1,this.tt=1,this.Yt=0,this.Wr=Lt.Rg,this.se=new z(NaN,NaN,NaN,NaN).u(),this.Ni=new z(NaN,NaN,NaN,NaN).u(),this.zi=new z(0,0,NaN,NaN).u(),this.Ku=null,this.f0=null,this.ct=null,this.hi=D.Default,this.ju=D.Default,this.u0=0,this.Hr=0,this.Ot=null,this.p=null,this.lh=null,this.si=null,this.Ub=null,this.ah=null,this.Jr=null,this.Hu=null}cloneProtected(t){t.n=(this.n|2048|4096)&-32769,t.$t=this.$t,t.d0=this.d0,t.Lt=this.Lt,t.at.a(this.at),t.is=this.is.P(),this.wi!==null?t.wi=this.wi.copy():t.wi=null,t.tt=this.tt,t.Yt=this.Yt,t.Wr=this.Wr.P(),t.se.a(this.se),t.Ni.a(this.Ni),t.zi.a(this.zi),t.f0=this.f0,this.ct!==null&&(t.ct=this.ct.copy()),t.hi=this.hi.P(),t.ju=this.ju.P(),t.u0=this.u0,t.Hr=this.Hr,this.Ot!==null&&(t.Ot=this.Ot.copy()),this.p!==null&&(this.p.fi?t.p=this.p:t.p=this.p.copy()),this.lh!==null&&(t.lh=this.lh.slice()),this.si!==null&&(t.si=this.si.copy())}addCopyProperty(t){let e=this.lh;if(!Array.isArray(e))e=[],this.lh=e;else for(let i=0;i<e.length;i++)if(e[i]===t)return;e.push(t)}vo(t){t.Ku=null,t.Jr=null,t.c()}clone(){let t=new this.constructor;if(this.cloneProtected(t),this.lh!==null)for(let e=0;e<this.lh.length;e++){let i=this.lh[e];t[i]=this[i]}return t}copy(){return this.clone()}rS(){let t=this.Ci;if(t!==null){this.Ci=null;for(let e of t)e.qu()&&(e.isToData?this.themeData(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter):e.isToObject?this.themeObject(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter,e.sourceName):e.isToModel?this.themeModel(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter):this.theme(e.targetProperty,e.sourceProperty,e.themeSource,e.converter,e.themeConverter))}return this}oi(t){t in bs?this.segmentOrientation=t:t in ws?this.stretch=t:f.er(this,t)}toString(){return f.Dn(this.constructor)+"#"+I.as(this)}static None=0;static Default=1;static Fill=2;static Vertical;static Horizontal;static Uniform=6;static UniformToFill=7;static FlipVertical=1;static FlipHorizontal=2;static FlipBoth=3;ch(){this.p!==null&&(this.p.fi=!0)}Kt(){return this.p===null?this.p=new oi:this.p.fi&&(this.p=this.p.copy()),this.p}Be(){if(this.ct===null){let t=new is;t.ga=D.None,t.ma=D.None,t.pa=10,t.ya=10,t.wa=0,t.xa=0,this.ct=t}return this.ct}raiseChangedEvent(t,e,i,s,n,o,r){let a=this.part;if(a!==null){a.qc(t,e,i,s,n,o,r),i===this&&t===2&&this.Wc()&&this.ba(a,e);let h=this.diagram;if(this.ws!==null&&h!==null&&h.Vh&&!h.undoManager.isUndoingRedoing&&!h.animationManager.pu){let l=this.ws.get(e);if(l!==null&&h.animationManager.isEnabled&&!h.animationManager.isTicking){this.Hu===null&&(this.Hu=new pt);let u=h.undoManager.transactionLevel===0;if(l.startCondition===2?u=!0:l.startCondition===3&&(u=!1),u){let c=new Ce;l.XF(c);let d=this.Hu.get(l);d!==null&&d.stop(),this.Hu.set(l,c),c.mx=this,c.XS=l,c.add(this,e,s,n),c.start()}else h.animationManager.getBundleAnimation().add(this,e,s,n)}}if(this instanceof H&&i===a&&a.p2()&&a.data!==null){let l=this.C.r,u=l.length;for(let c=0;c<u;c++){let d=l[c];d instanceof H&&d.Gr(g=>{g.data!==null&&g.p2()&&g.updateTargetBindings(e)})}}}}UF(t){this.Hu.delete(t)}Do(){if(this.diagram!==null&&this.findBindingPanel()===null&&this.Ci!==null){let t=this.diagram.model,e=this.Ci.iterator;for(;e.next();){let i=e.value;if(!i.isToTheme)continue;let s=null,n=i.sourceName;i.isToObject&&(s=this.pA(n));let o=this,r=i.targetId;r!==-1&&(o=this.g0(r),o===null)||(n==="/"?s=o.part:n==="."?s=o:n===".."&&(s=o.panel),i.updateTarget(o,s,void 0,t))}}}ba(t,e){let i=this.findBindingPanel();if(i!==null){let s=t.diagram,n=this.Ci.iterator;for(;n.next();){let o=n.value,r=null;if(o.isToObject){if(r=o.yA(i,this),r===null)continue;o.updateSource(this,r,e,null)}else if(o.isToModel)s!==null&&!s.fe&&o.updateSource(this,s.model.modelData,e,i);else if(!o.isToTheme){let a=i.data;if(a===null)continue;s!==null&&!s.fe&&o.updateSource(this,a,e,i)}if(r===this){let a=o.targetId,h=i.g0(a);h!==null&&o.updateTarget(h,r,e,s?.model)}}}}g0(t){return this.Hn===t?this:null}pA(t){let e;return t===""?e=this:t==="/"?e=this:t==="."?e=this:t===".."?e=this:e=this.part.findObject(t),e}get Hn(){return this.p!==null?this.p.Hn:-1}set Hn(t){this.Hn!==t&&(this.p===null&&(this.p=new oi),this.p.Hn=t)}get Ci(){return this.p!==null?this.p.Ci:null}set Ci(t){this.Ci!==t&&(this.p===null&&(this.p=new oi),this.p.Ci=t)}get qn(){return this.p!==null?this.p.qn:null}set qn(t){this.qn!==t&&(this.p===null&&(this.p=new oi),this.p.qn=t)}raiseChanged(t,e,i){this.raiseChangedEvent(2,t,this,e,i)}t(t,e,i){this.raiseChangedEvent(2,t,this,e,i)}Wn(t,e,i,s){let n=this.se;if(n.i(t,e,i,s),this.tt!==1||this.Yt!==0){this.wi===null&&(this.wi=new Pt);let o=this.wi;o.Ri(),this.m0(o,t,e,i,s),o.vg(n)}}wA(t,e,i){return this.pickable===!1?!1:(i.nc(this.T),e?this.intersectsRect(t,i):this.containedInRect(t,i))}xA(t,e,i){if(this.pickable===!1)return!1;let s=this.naturalBounds,n=t.distanceSquaredPoint(e);return i?P.distanceLineSegmentSquared(t.x,t.y,0,0,0,s.height)<=n||P.distanceLineSegmentSquared(t.x,t.y,0,s.height,s.width,s.height)<=n||P.distanceLineSegmentSquared(t.x,t.y,s.width,s.height,s.width,0)<=n||P.distanceLineSegmentSquared(t.x,t.y,s.width,0,0,0)<=n:t.distanceSquared(0,0)<=n&&t.distanceSquared(0,s.height)<=n&&t.distanceSquared(s.width,0)<=n&&t.distanceSquared(s.width,s.height)<=n}an(){return!0}containsPoint(t){let e=P.l();e.a(t),this.T.gt(e);let i=this.actualBounds;if(!i.isReal())return P.e(e),!1;let s=this.diagram;if(s!==null&&s.Hm){let o=s.getInputOption("extraTouchThreshold"),r=s.getInputOption("extraTouchArea"),a=r/2,h=this.naturalBounds,l=this.getDocumentScale()*s.scale,u=1/l;if(h.width*l<o&&h.height*l<o){let c=z.contains(i.x-a*u,i.y-a*u,i.width+r*u,i.height+r*u,e.x,e.y);return P.e(e),c}}let n=!1;return(this instanceof St||this instanceof ut?z.contains(i.x-5,i.y-5,i.width+10,i.height+10,e.x,e.y):i.containsPoint(e))&&(this.si&&!this.si.containsPoint(e)?n=!1:this.Lt!==null&&this.zi.containsPoint(t)?n=!0:n=this.fh(t)),P.e(e),n}fh(t){let e=this.naturalBounds;return z.contains(0,0,e.width,e.height,t.x,t.y)}containsRect(t){if(this.angle===0)return this.actualBounds.containsRect(t);let e=this.naturalBounds,i=z.V(0,0,e.width,e.height),s=this.T,n=!1,o=P.V(t.x,t.y);return i.containsPoint(s.$e(o))&&(o.i(t.x,t.bottom),i.containsPoint(s.$e(o))&&(o.i(t.right,t.bottom),i.containsPoint(s.$e(o))&&(o.i(t.right,t.y),i.containsPoint(s.$e(o))&&(n=!0)))),P.e(o),z.e(i),n}containedInRect(t,e){if(e===void 0)return t.containsRect(this.actualBounds);let i=this.naturalBounds,s=e,n=!1,o=P.V(0,0);return t.containsPoint(s.gt(o))&&(o.i(0,i.height),t.containsPoint(s.gt(o))&&(o.i(i.width,i.height),t.containsPoint(s.gt(o))&&(o.i(i.width,0),t.containsPoint(s.gt(o))&&(n=!0)))),P.e(o),n}intersectsRect(t,e){if(e===void 0&&(e=this.T,this.angle===0))return t.intersectsRect(this.actualBounds);let i=this.naturalBounds,s=e,n=P.V(0,0),o=P.V(0,i.height),r=P.V(i.width,i.height),a=P.V(i.width,0),h=!1;if(t.containsPoint(s.gt(n))||t.containsPoint(s.gt(o))||t.containsPoint(s.gt(r))||t.containsPoint(s.gt(a)))h=!0;else{let l=z.V(0,0,i.width,i.height),u=P.V(t.x,t.y);l.containsPoint(s.$e(u))?h=!0:(u.i(t.x,t.bottom),l.containsPoint(s.$e(u))?h=!0:(u.i(t.right,t.bottom),l.containsPoint(s.$e(u))?h=!0:(u.i(t.right,t.y),l.containsPoint(s.$e(u))&&(h=!0)))),P.e(u),z.e(l),h||(L.Mw(t,n,o)||L.Mw(t,o,r)||L.Mw(t,r,a)||L.Mw(t,a,n))&&(h=!0)}return P.e(n),P.e(o),P.e(r),P.e(a),h}getDocumentPoint(t,e){if(e===void 0&&(e=new P),t instanceof D){let i=t,s=this.naturalBounds;return e.i(i.x*s.width+i.offsetX,i.y*s.height+i.offsetY),this.Us.gt(e),e}else return e.set(t),this.Us.gt(e),e}getDocumentBounds(t){t===void 0&&(t=new z);let e=this.naturalBounds,i=this.Us,s=P.V(0,0).T(i);return t.i(s.x,s.y,0,0),s.i(e.width,0).T(i),t.unionNoCheck(s.x,s.y,0,0),s.i(e.width,e.height).T(i),t.unionNoCheck(s.x,s.y,0,0),s.i(0,e.height).T(i),t.unionNoCheck(s.x,s.y,0,0),P.e(s),t}getDocumentAngle(){return this.Us.ZD()}getDocumentScale(){if(this.p0()===!1)return this.da;let t=this.tt;return this.panel!==null?t*this.panel.getDocumentScale():t}getLocalPoint(t,e){return e===void 0&&(e=new P),e.a(t),this.Us.$e(e),e}getNearestIntersectionPoint(t,e,i){return this.Jc(t.x,t.y,e.x,e.y,i)}Jc(t,e,i,s,n){let o=this.T,r=1/(o.m11*o.m22-o.m12*o.m21),a=o.m22*r,h=-o.m12*r,l=-o.m21*r,u=o.m11*r,c=r*(o.m21*o.dy-o.m22*o.dx),d=r*(o.m12*o.dx-o.m11*o.dy),g=t*a+e*l+c,p=t*h+e*u+d,m=i*a+s*l+c,y=i*h+s*u+d;n.i(0,0);let w=this.naturalBounds,b=L.gl(0,0,w.width,w.height,g,p,m,y,n);return n.T(o),b}ht(t,e,i,s){if(this.To()===!1)return;let n=this.Wr,o=n.right+n.left,r=n.top+n.bottom;t=Math.max(t-o,0),e=Math.max(e-r,0),i=i||0,s=s||0,i=Math.max(i-o,0),s=Math.max(s-r,0);let a=this.angle,h=0,l=this.desiredSize,u=this.y0();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,g=this instanceof H;switch(this.zs(!0)){case 0:c=0,d=0,g&&(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,g&&(e=1/0);break;case 4:isFinite(e)&&e>s&&(d=e),c=0,g&&(t=1/0);break}let p=this.maxSize,m=this.minSize;c>p.width&&m.width<p.width&&(c=p.width),d>p.height&&m.height<p.height&&(d=p.height),i=Math.max(c,m.width),s=Math.max(d,m.height),p.width<i&&(i=Math.min(m.width,i)),p.height<s&&(s=Math.min(m.height,s)),t=Math.min(p.width,t),e=Math.min(p.height,e),t=Math.max(i,t),e=Math.max(s,e),(a===90||a===270)&&(h=t,t=e,e=h,h=i,i=s,s=h),this.se.Pt(),this.Wu(t,e,i,s),this.se.u(),this.se.isReal()||f.o("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.se.toString()),this.ue(!1)}Wu(t,e,i,s){}Xs(){return!1}Bt(t,e,i,s,n){this.$c();let o=z.l();o.a(this.Ni),this.Ni.Pt(),this._e()===!1?this.Ni.i(t,e,i,s):this.uh(t,e,i,s),this.Ni.u(),n===void 0?this.si=null:this.si=n;let r=!1;if(n!==void 0)r=!0;else{let a=this.panel;if(a!==null&&a.$r()&&(a=a.panel),a!==null){let h=a.zi,l=this.measuredBounds,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 xt){let d=this.naturalBounds;(this.w0>d.height||this.ui>d.width)&&(r=!0)}}}r?this.n|=256:this.n&=-257,this.Ni.isReal()||f.o("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.Ni.toString()),this.Ju(o,this.Ni),this.Jn(!1),z.e(o)}uh(t,e,i,s){}commonArrange(t,e,i,s){if(this.Ni.i(t,e,i,s),this.desiredSize.isReal())return;let n=this.se,o=this.Wr,r=o.right+o.left,a=o.top+o.bottom,h=n.width+r,l=n.height+a;i+=r,s+=a;let u=this.zs(!0);switch(h===i&&l===s&&(u=0),u){case 0:(h>i||l>s)&&(this.ue(!0),this.ht(h>i?i:h,l>s?s:l,0,0));break;case 2:this.ue(!0),this.ht(i,s,0,0);break;case 5:this.ue(!0),this.ht(i,l,0,0);break;case 4:this.ue(!0),this.ht(h,s,0,0);break}}Ju(t,e){let i=this.part;i!==null&&i.diagram!==null&&((i.selectionObject===this||i.resizeObject===this||i.rotateObject===this)&&i.w2(!0),this.S(),!t.equalsApproxClose(e)&&(i.dh(),this.x0(i)))}x0(t){this.portId!==null&&(t.w2(!0),t instanceof rt&&t.bA(this))}get shadowVisible(){return this.p!==null?this.p.b0:null}set shadowVisible(t){let e=this.shadowVisible;e!==t&&(this.Kt().b0=t,this.Ve(!0),this.S(),this.t("shadowVisible",e,t))}HR(t,e){let i=this.naturalBounds,s=this.hh,n=s.m11,o=s.m21,r=s.dx,a=s.m12,h=s.m22,l=s.dy,u=0,c=0,d=u,g=c;u=d*n+g*o+r,c=d*a+g*h+l;let p=u,m=c,y=0,w=0;d=i.width+e,g=0,u=d*n+g*o+r,c=d*a+g*h+l;let b=Math.min(p,u),v=Math.min(m,c);y=Math.max(p+y,u)-b,w=Math.max(m+w,c)-v,p=b,m=v,d=i.width+e,g=i.height+e,u=d*n+g*o+r,c=d*a+g*h+l,b=Math.min(p,u),v=Math.min(m,c),y=Math.max(p+y,u)-b,w=Math.max(m+w,c)-v,p=b,m=v,d=0,g=i.height+e,u=d*n+g*o+r,c=d*a+g*h+l,b=Math.min(p,u),v=Math.min(m,c),y=Math.max(p+y,u)-b,w=Math.max(m+w,c)-v,p=b,m=v;let k=t.viewportBounds,S=k.x,M=k.y,F=k.width,T=k.height;return p>F+S||S>y+p||m>T+M||M>w+m}Ui(t,e){if(this.qR(t,e)||!this.visible)return;let i=this.opacity;if(i===0)return;let s=1;i!==1&&(s=t.globalAlpha,t.globalAlpha=s*i);let n="";this.filter!==""&&(n=t.filter,t.filter=this.filter);let o=this.T,r=this.panel;this.p0()===!0&&this.Bb();let a=this.part,h=!1,l=0;if(a&&e.getRenderingHint("drawShadows")&&(h=a.isShadowed,h)){let m=a.shadowOffset;l=Math.max(m.y,m.x)*e.scale*e.Vi}let u=this instanceof H&&this.$r(),c=this.Ni;if(u&&(this.kA(h,t,!1,r),this.WR(t,e),this.PA(h,t,!1,r),this.SA(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.Xs();if(!e.ia&&d&&this.HR(e,l)){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}let g=(this.n&256)!==0;if(t.clipInsteadOfFill&&(g=!1),this instanceof xt&&(t.font=this.font),g){let m=r.an()?r.naturalBounds:r.actualBounds,y=Math.max(c.x,m.x),w=Math.max(c.y,m.y),b=Math.min(c.right,m.right)-y,v=Math.min(c.bottom,m.bottom)-w,k=this.si;if(k!==null&&(y=k.x,w=k.y,b=k.width,v=k.height),y>c.width+c.x||c.x>m.width+m.x){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}t.save(),t.beginPath(),t.rect(y,w,b,v),t.clip()}if(d){if(!a.isVisible()){i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n);return}if(h){let m=a.shadowOffset;t.shadowsSet(m.x*e.scale*this.scale*e.Vi,m.y*e.scale*this.scale*e.Vi,a.shadowBlur),t.shadowsOn(),t.shadowColor=a.shadowColor}}let p=this.naturalBounds;if(t.transform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.kA(h,t,d,r),this.Lt!==null&&(t.commitTransform(),this.Vb(t,p,c)),this.PA(h,t,d,r),this.gh(t,e),this.SA(h,t,d),g&&(t.restore(),t.clearContextCache(this instanceof H)),!o.Yk()){let m=1/(o.m11*o.m22-o.m12*o.m21);t.transform(o.m22*m,-o.m12*m,-o.m21*m,o.m11*m,m*(o.m21*o.dy-o.m22*o.dx),m*(o.m12*o.dx-o.m11*o.dy))}i!==1&&(t.globalAlpha=s),this.filter!==""&&(t.filter=n)}kA(t,e,i,s){t&&this.shadowVisible===!0?e.shadowsOn():t&&this.shadowVisible===!1&&e.shadowsOff(),t&&this.zb(s)&&this.shadowVisible===null&&e.shadowsOff()}PA(t,e,i,s){t&&(this.Lt!==null||this.zb(s))?(this.Xb(!0),this.shadowVisible===null&&e.shadowsOff()):this.Xb(!1)}SA(t,e,i){t&&this.b2()===!0&&e.shadowsOn(),i&&t&&e.shadowsOff()}JR(t,e,i){let s=this.part,n=!1;s&&t.getRenderingHint("drawShadows")&&(n=s.isShadowed),e.clipInsteadOfFill&&(n=!1),this.Xs()&&n&&e.shadowsOn(),n&&this.shadowVisible===!0?e.shadowsOn():n&&this.shadowVisible===!1&&e.shadowsOff();let o=this.panel;if(n&&this.zb(o)&&this.shadowVisible===null&&e.shadowsOff(),e.Zr){let r=t.computePixelRatio(),a=`drop-shadow(${e.shadowOffsetX/r}px ${e.shadowOffsetY/r}px ${e.shadowBlur/r/2}px ${e.shadowColor})`;this.background!==null&&i.Lt.setAttributeNS(null,"filter",a)}return n&&(this.Lt!==null||this.zb(o))?(this.Xb(!0),this.shadowVisible===null&&e.shadowsOff()):this.Xb(!1),n}$R(t,e,i,s){if(i.Zr){let n=e.computePixelRatio(),o=`drop-shadow(${i.shadowOffsetX/n}px ${i.shadowOffsetY/n}px ${i.shadowBlur/n/2}px ${i.shadowColor})`;this.k2(t,o)}s&&this.b2()===!0&&i.shadowsOn(),this.Xs()&&i.shadowsOff()}zb(t){return t===null?!1:(t.$r()&&(t=t.panel),t.b2()||(t.type===H.Auto||t.type===H.Spot)&&t.findMainElement()!==this)}k2(t,e){}Vb(t,e,i){let s=this.y0(),n=e.x,o=e.y,r=e.width+s,a=e.height+s;this.rn(t,this.Lt,!0,!1,e,i),this.Lt instanceof E&&this.Lt.type===3?(t.beginPath(),t.rect(n-s/2,o-s/2,r,a),t.fillContext(this.Lt,!1,null)):t.fillRect(n-s/2,o-s/2,r,a)}MA(t,e){let i=t.ZR(this),s=t.ah!==null?t.ah:t.svg;if(i!==-1)if(i===0)if(s.Lt)s.Lt.after(e);else if(t.type===H.Table){let n=s.getElementsByClassName("gojs-ts"),o=n.length!==0?n[0]:null;o!==null&&o.after(e)}else s.prepend(e);else{for(;i!==0&&!t.elt(i-1).isVisibleObject();)i--;if(i===0)s.prepend(e);else{let n=t.elt(i-1).svg;n!==null?n.after(e):s.appendChild(e)}}}qR(t,e){if(!(t instanceof ce))return!1;if(!this.visible||this.opacity===0)return this.svg!==null&&this.svg.parentNode!==null&&this.svg.remove(),!0;let i=this.Ni;if(this.Xs()&&(!this.isVisible()||i.width===0||i.height===0||isNaN(i.x)||isNaN(i.y)))return this.svg!==null&&this.svg.parentNode!==null&&this.svg.remove(),!0;let s=this.panel,n=this.$u(t);if(this.Zc(t,e,n))return this.NA(this.svg),this.svg.parentElement!==null?(this.Xs()&&(t.lastDrawnPart=this.svg),!0):(this.Xs()?(t.lastDrawnPart!==null?t.lastDrawnPart.after(this.svg):t.diagramGroup.prepend(this.svg),t.lastDrawnPart=this.svg):s&&this.MA(s,this.svg),!0);if(this.Ve(!1),this.Xs()&&this.isShadowed){let p=this.shadowOffset;t.shadowsSet(p.x*e.scale*this.scale*e.Vi,p.y*e.scale*this.scale*e.Vi,this.shadowBlur),t.shadowsOn(),t.shadowColor=this.shadowColor}this instanceof xt&&(t.font=this.font),t.currentElement=null;let o=this.T,r=this instanceof H,a=this instanceof H?this.$r():!1,h=this.svg;if(this.p0()===!0&&this.Bb(),t.setCurrentTransform(1,0,0,1,0,0),t.outerGroup=!1,n)if(t.outerGroup=!0,r&&a)t.newGroup(1,0,0,1,0,0),this.svg=t.lastCreatedElement;else if(r&&this.isClipping){let p=this.findMainElement(),m=0,y=0;p!==null&&(m=p.actualBounds.x,y=p.actualBounds.y),t.newGroup(o.m11,o.m12,o.m21,o.m22,o.dx+m,o.dy+y),this.svg=t.lastCreatedElement,p!==null&&t.createOrUpdateClipGroup(this,p.actualBounds),t.currentElement=t.lastCreatedElement}else r?(t.newGroup(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.svg=t.lastCreatedElement):t.newGroup(1,0,0,1,0,0);let l=this.naturalBounds;r||t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.background!==null&&(r?(a&&t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.Vb(t,l,i),a&&t.setCurrentTransform(1,0,0,1,0,0)):(t.setCurrentTransform(o.m11,o.m12,o.m21,o.m22,o.dx,o.dy),this.Vb(t,l,i)),t.currentElement.Lt=t.lastCreatedElement,t.currentElement.prepend(t.lastCreatedElement));let u=this.JR(e,t,t.currentElement);this.gh(t,e),r&&t.endGroup(),t.outerGroup&&t.endGroup();let c=t.surface.Gu,d=r?this.svg:t.currentElement;if(h!==null&&h.parentNode!==null&&d!==h&&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.k0(t,s,i,d),!0}if(this.svg=d,c!==null&&d===null&&t.dummyGroup(),d===null)return!0;this.k0(t,s,i,d),this.$R(d,e,t,u);let g=this.Xs()?this.opacity*t.globalAlpha:this.opacity;if(g!==1&&d.setAttributeNS(null,"opacity",g.toString()),this.filter!==""&&d.setAttributeNS(null,"filter",this.filter),this.Xs()){if(h!==null&&d!==h&&h.parentNode===t.diagramGroup){let p=h.getAttribute("filter");p!==null&&d.setAttribute("filter",p),h.replaceWith(d)}else t.lastDrawnPart?t.lastDrawnPart.after(d):t.diagramGroup.prepend(d);t.lastDrawnPart=d}else s!==null&&this.MA(s,d);return c!==null&&c(this,d),this.NA(d),!0}NA(t){let e=this,i=t.dataset;e instanceof dt&&(e.portId!==null&&(i.portId=e.portId),e instanceof H&&(isNaN(e.itemIndex)||(i.itemIndex=e.itemIndex.toString()),e instanceof Nt&&(i.className=f.Dn(e),e.key!==void 0&&(i.key=e.key.toString()),e.containingGroup!==null&&(i.group=e.containingGroup.key.toString()),e instanceof _&&(e.fromNode!==null&&e.fromNode.key!==void 0&&(i.fromKey=e.fromNode.key.toString()),e.fromPortId!==""&&(i.fromPortId=e.fromPortId),e.toNode!==null&&e.toNode.key!==void 0&&(i.toKey=e.toNode.key.toString()),e.toPortId!==""&&(i.toPortId=e.toPortId)))))}k0(t,e,i,s){let n=(this.n&256)!==0;if(t.clipInsteadOfFill&&(n=!1),!n){s.removeAttributeNS(null,"clip-path");return}let o=e.an()?e.naturalBounds:e.actualBounds,r=Math.max(i.x,o.x),a=Math.max(i.y,o.y),h=Math.min(i.right,o.right)-r,l=Math.min(i.bottom,o.bottom)-a,u=this.si;u!==null&&(r=u.x,a=u.y,h=u.width,l=u.height);let c=new z(r,a,Math.max(h,0),Math.max(l,0));this instanceof H&&this.T.copy().bw().vg(c),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`)}QR(){if(this.svg===null)return;let t=this.svg.innerHTML.match(/url\(#((CLIP|GRAD).+?)\)/g),e=this.svg.ownerDocument;if(t!==null)for(let i of t){let s=e.getElementById(i.split("#")[1].slice(0,-1));s!==null&&s.remove()}this.svg.remove()}WR(t,e){let i=this.Ni,s=this.zi,n=this.Lt;n!==null&&t.commitTransform(),n!==null&&(this.rn(t,n,!0,!1,s,i),n instanceof E&&n.type===3?(t.beginPath(),t.rect(i.x,i.y,i.width,i.height),t.fillContext(n,!1,null)):t.fillRect(i.x,i.y,i.width,i.height)),this.gh(t,e)}gh(t,e){}Qc(){this.Ve(!0)}Zc(t,e,i){let s=this.svg;if(this._R()){if(this.Qc(),this.Ve(!1),s===null)return!1;let 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.T,o="matrix("+n.m11+", "+n.m12+", "+n.m21+", "+n.m22+", "+n.dx+", "+n.dy+")",r=this instanceof H,a=r?this.$r():!1;if(!(r&&a))if(this instanceof zt){let u=this.Yb;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 ut){let u=s.getElementsByTagName("path");for(let c=0;c<u.length;c++)u[c].setAttributeNS(null,"transform",o)}else if(this instanceof xt){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.ah){let u=this.findMainElement(),c=u!==null?u.actualBounds.x:0,d=u!==null?u.actualBounds.y:0;this.ah.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.Xs()?this.opacity*t.globalAlpha:this.opacity;h===1?s.removeAttribute("opacity"):s.setAttributeNS(null,"opacity",h.toString()),t.setCurrentTransform(1,0,0,1,0,0);let l=this.ah?this.ah:this.Ub;if(this.background!==null||l.Lt!==void 0){let u=l.Lt;if(this.background===null)t.removeOldGradient(this,l.Lt,"fill"),l.Lt.remove(),l.Lt=void 0;else{if((a||i&&!(this instanceof H))&&t.setCurrentTransform(n.m11,n.m12,n.m21,n.m22,n.dx,n.dy),this.Vb(t,this.naturalBounds,this.actualBounds),l.Lt){t.removeOldGradient(this,l.Lt,"fill");let c=l.Lt.getAttribute("filter");c!==null&&t.lastCreatedElement.setAttribute("filter",c),l.Lt.replaceWith(t.lastCreatedElement)}else l.prepend(t.lastCreatedElement);l.Lt=t.lastCreatedElement}u&&t.removeOldGradient(this,u,"fill")}return this.k0(t,this.panel,this.actualBounds,s),!0}$u(t){if(this.background!==null)return!0;let e=(this.n&256)!==0;return t.clipInsteadOfFill&&(e=!1),!!e}static TE(t,e,i,s,n,o,r){let a=.001,h=o.length;t.moveTo(e,i);let l=s-e,u=n-i;l===0&&(l=.001);let c=u/l,d=Math.sqrt(l*l+u*u),g=0,p=!0;a=o[g%h];let m=r!==0;for(;d>=.1;){if(m){for(a=o[g++%h],a-=r;a<0;)a+=o[g++%h],p=!p;m=!1}else a=o[g++%h];a>d&&(a=d);let y=Math.sqrt(a*a/(1+c*c));l<0&&(y=-y),e+=y,i+=c*y,p?t.lineTo(e,i):t.moveTo(e,i),d-=a,p=!p}}rn(t,e,i,s,n,o){let r=1,a=1;if(typeof e=="string"){i?t.fillStyle=e:t.strokeStyle=e;return}else if(e.type===1){i?t.fillStyle=e.color:t.strokeStyle=e.color;return}let h,l=this.y0();r=n.width,a=n.height,s?(r=o.width,a=o.height):i||(r+=l,a+=l);let u=t instanceof Ei;if(u&&e.cn&&(e.type===4||e._c===r&&e.Gb===a))h=e.cn;else{let c=0,d=0,g=0,p=0,m=0,y=0,w=0,b=0;if(s?(w=o.x,b=o.y):i||(w-=l/2,b-=l/2),c=e.start.x*r+e.start.offsetX+w,d=e.start.y*a+e.start.offsetY+b,g=e.end.x*r+e.end.offsetX+w,p=e.end.y*a+e.end.offsetY+b,e.type===2)h=t.createLinearGradient(c,d,g,p);else if(e.type===3)y=isNaN(e.endRadius)?Math.max(r,a)/2:e.endRadius,isNaN(e.startRadius)?(m=0,y=Math.max(r,a)/2):m=e.startRadius,h=t.createRadialGradient(c,d,m,g,p,y);else if(e.type===4)try{h=t.createPattern(e.pattern,"repeat")}catch{h=null}else f.Zi(e.type,"Brush type");if(e.type!==4){let v=e.colorStops;if(v!==null){let k=v.iterator;for(;k.next();)h.addColorStop(k.key,k.value)}}if(u&&(e.cn=h,h!==null&&(e._c=r,e.Gb=a),h===null&&e.type===4&&e._c!==-1)){e._c=-1;let v=this.diagram;v!==null&&e._c===-1&&f.ir(()=>{v.redraw()},600)}}i?t.fillStyle=h:t.strokeStyle=h}isContainedBy(t){return t instanceof H?this.tv(this,t):!1}tv(t,e){if(t===e||e===null)return!1;let i=t.panel;for(;i!==null;){if(i===e)return!0;i=i.panel}return!1}isVisibleObject(){if(!this.visible)return!1;let t=this.panel;return t!==null?t.isVisibleObject():!0}isEnabledObject(){let t=this instanceof H?this:this.panel;for(;t!==null&&t.isEnabled;)t=t.panel;return t===null}get enabledChanged(){return this.p!==null?this.p.P0:null}set enabledChanged(t){let e=this.enabledChanged;e!==t&&(t!==null&&f.k(t,dt,"enabledChanged"),this.Kt().P0=t,this.t("enabledChanged",e,t))}Bb(){if(this.Kb()===!0){let t=this.qr;if(t.Ri(),!this.Ni.isReal()||!this.se.isReal()){this.Zu(!1);return}if(t.Fs(this.Ni.x-this.se.x,this.Ni.y-this.se.y),this.scale!==1||this.angle!==0){let e=this.naturalBounds;this.m0(t,e.x,e.y,e.width,e.height)}this.Zu(!1),this.ka(!0)}if(this.p0()===!0){let t=this.panel;if(t===null)this.hh.set(this.qr),this.da=this.scale;else if(t.Us!==null){let e=this.hh;e.Ri(),t.an()?e.nc(t.hh):t.panel!==null&&e.nc(t.panel.hh),e.nc(this.qr),this.da=this.scale*t.da}this.ka(!1)}}m0(t,e,i,s,n){if(this.tt!==1&&t.tt(this.tt),this.Yt===0)return;let o=P.l();o.setSpot(e,i,s,n,D.Center),t.cs(this.Yt,o.x,o.y),P.e(o)}c(t){if(this.To())return;t===void 0&&(t=!1),this.ue(!0),this.Jn(!0);let e=this.panel;e!==null&&!t&&e.c()}tf(){this.To()||(this.ue(!0),this.Jn(!0))}ef(t){if(this._e())return;let e=this.panel;!t&&e!==null&&e.c(),this.Jn(!0)}$c(){this.Kb()===!1&&(this.Zu(!0),this.ka(!0))}P2(){this.ka(!0)}S(){let t=this.part;t!==null&&t.S()}zs(t){let e=this.stretch,i=this.panel;if(i===null)return this.Oo(e===1?0:e,t);if(i.type===H.Table)return this.S0(i.getRowDefinition(this.row),i.getColumnDefinition(this.column),t);if(i.type===H.Auto&&i.findMainElement()===this)return this.Oo(2,t);if(e===1){if(i.type===H.Spot&&i.findMainElement()===this)return this.Oo(2,t);let s=i.defaultStretch;return s===1?this.Oo(0,t):this.Oo(s,t)}return this.Oo(e,t)}S0(t,e,i){let s=this.stretch;if(s!==1)return this.Oo(s,i);let n=null,o=null;switch(t.stretch){case 1:case 5:break;case 4:o=!0;break;case 2:o=!0;break}switch(e.stretch){case 1:case 4:break;case 5:n=!0;break;case 2:n=!0;break}let r=this.panel.defaultStretch;return n===null&&(n=r===5||r===2),o===null&&(o=r===4||r===2),n===!0&&o===!0?this.Oo(2,i):n===!0?this.Oo(5,i):o===!0?this.Oo(4,i):this.Oo(0,i)}Oo(t,e){if(e)return t;if(t===0)return 0;let i=this.desiredSize;if(i.isReal())return 0;let s=!isNaN(i.width),n=!isNaN(i.height),o=this.angle;if(s)if(o!==90&&o!==270){if(t===5)return 0;if(t===2)return 4}else{if(t===4)return 0;if(t===2)return 5}if(n)if(o!==90&&o!==270){if(t===4)return 0;if(t===2)return 5}else{if(t===5)return 0;if(t===2)return 4}return t}get segmentOrientation(){return this.Ot!==null?this.Ot.M0:0}set segmentOrientation(t){let e=this.segmentOrientation;e!==t&&(this.Ot===null&&(this.Ot=new He),this.Ot.M0=t,this.c(),this.t("segmentOrientation",e,t),t===0&&(this.angle=0))}iv(){this.segmentOrientation=21}get segmentIndex(){return this.Ot!==null?this.Ot.N0:-1/0}set segmentIndex(t){t=Math.round(t);let e=this.segmentIndex;e!==t&&(this.Ot===null&&(this.Ot=new He),this.Ot.N0=t,this.c(),this.t("segmentIndex",e,t))}get segmentFraction(){return this.Ot!==null?this.Ot.C0:0}set segmentFraction(t){t<0?t=0:t>1&&(t=1);let e=this.segmentFraction;e!==t&&(this.Ot===null&&(this.Ot=new He),this.Ot.C0=t,this.c(),this.t("segmentFraction",e,t))}get segmentOffset(){return this.Ot!==null?this.Ot.L0:P.xo}set segmentOffset(t){let e=this.segmentOffset;e.equals(t)||(t=t.P(),this.Ot===null&&(this.Ot=new He),this.Ot.L0=t,this.c(),this.t("segmentOffset",e,t))}get stretch(){return this.p!==null?this.p.$n:1}set stretch(t){let e=this.stretch;e!==t&&(this.Kt().$n=t,this.c(),this.t("stretch",e,t))}get name(){return this.p!==null?this.p.St:""}set name(t){let e=this.name;e!==t&&(this.Kt().St=t,this.part!==null&&this.part.A0(),this.t("name",e,t))}get opacity(){return this.$t}set opacity(t){t<0?t=0:t>1&&(t=1);let e=this.opacity;if(e!==t){this.$t=t,this.t("opacity",e,t);let i=this.diagram,s=this.part;i!==null&&s!==null&&i.S(s.Wh(s.actualBounds))}}get filter(){return this.d0}set filter(t){let e=this.filter;if(e!==t){this.d0=t,this.Ve(!0),this.t("filter",e,t);let i=this.diagram,s=this.part;i!==null&&s!==null&&i.S(s.Wh(s.actualBounds))}}get visible(){return(this.n&1)!==0}set visible(t){let e=(this.n&1)!==0;if(e!==t){this.n=this.n^1,this.Qc(),this.t("visible",e,t);let i=this.panel;i!==null?i.c():this.Xs()&&this.Ei(t),this.S(),this.CA()}}get pickable(){return(this.n&2)!==0}set pickable(t){let e=(this.n&2)!==0;e!==t&&(this.n=this.n^2,this.t("pickable",e,t))}get fromLinkableDuplicates(){return(this.n&4)!==0}set fromLinkableDuplicates(t){let e=(this.n&4)!==0;e!==t&&(this.n=this.n^4,this.t("fromLinkableDuplicates",e,t))}get fromLinkableSelfNode(){return(this.n&8)!==0}set fromLinkableSelfNode(t){let e=(this.n&8)!==0;e!==t&&(this.n=this.n^8,this.t("fromLinkableSelfNode",e,t))}get toLinkableDuplicates(){return(this.n&16)!==0}set toLinkableDuplicates(t){let e=(this.n&16)!==0;e!==t&&(this.n=this.n^16,this.t("toLinkableDuplicates",e,t))}get toLinkableSelfNode(){return(this.n&32)!==0}set toLinkableSelfNode(t){let e=(this.n&32)!==0;e!==t&&(this.n=this.n^32,this.t("toLinkableSelfNode",e,t))}get isPanelMain(){return(this.n&64)!==0}set isPanelMain(t){let e=(this.n&64)!==0;e!==t&&(this.n=this.n^64,this.c(),this.t("isPanelMain",e,t))}get isActionable(){return(this.n&128)!==0}set isActionable(t){let e=(this.n&128)!==0;e!==t&&(this.n=this.n^128,this.t("isActionable",e,t))}get background(){return this.Lt}set background(t){let e=this.background;e!==t&&(t!==null&&E.Qu(t,"GraphObject.background"),t instanceof E&&t.u(),this.Lt=t,this.S(),this.t("background",e,t))}b2(){return(this.n&512)!==0}Xb(t){t?this.n|=512:this.n&=-513}Wc(){return(this.n&1024)!==0}S2(t){t?this.n|=1024:this.n&=-1025}Kb(){return(this.n&2048)!==0}Zu(t){t?this.n|=2048:this.n&=-2049}p0(){return(this.n&4096)!==0}ka(t){t?this.n|=4096:this.n&=-4097}To(){return(this.n&8192)!==0}ue(t){t?this.n|=8192:this.n&=-8193}_e(){return(this.n&16384)!==0}Jn(t){t?this.n|=16384:this.n&=-16385}_R(){return(this.n&32768)!==0}Ve(t){t?this.n|=32768:this.n&=-32769}get part(){if(this.Xs())return this;if(this.Jr!==null)return this.Jr;let t=this;for(t=t.panel;t;){if(t instanceof Nt)return this.Jr=t,t;t=t.panel}return null}get svg(){return this.Ub}set svg(t){this.Ub=t}Au(){this.svg=null}get panel(){return this.Vs}Pa(t){this.Vs=t,this.svg!==null&&this.svg.remove()}get layer(){let t=this.part;return t!==null?t.layer:null}get diagram(){let t=this.part;return t!==null?t.diagram:null}get position(){return this.at}set position(t){let e=t.x,i=t.y,s=this.position,n=s.x,o=s.y;n!==e&&(!isNaN(n)||!isNaN(e))||o!==i&&(!isNaN(o)||!isNaN(i))?(t=t.copy(),this.M2(t,n,o)&&this.t("position",new P(n,o),t.copy())):this.N2()}N2(){}M2(t,e,i){return this.at=t,this.ef(),!0}bc(t,e,i){this.at.x===t&&this.at.y===e||(this.at.i(t,e),this.$c())}get actualBounds(){return this.Ni}get scale(){return this.tt}set scale(t){let e=this.scale;e!==t&&(t<=0&&f.o("GraphObject.scale for "+this+" must be greater than zero, not: "+t),this.tt=t,this.c(),this.t("scale",e,t))}get angle(){return this.Yt}set angle(t){let e=this.angle;if(e!==t){if(t=t%360,t<0&&(t+=360),e===t)return;this.Yt=t,this.CA(),this.c(),this.t("angle",e,t)}}get desiredSize(){return this.is}set desiredSize(t){let e=t.width,i=t.height,s=this.desiredSize,n=s.width,o=s.height;if((n!==e&&(!isNaN(n)||!isNaN(e))||o!==i&&(!isNaN(o)||!isNaN(i)))&&(t=t.P(),this.is=t,this.c(),this instanceof ut&&this.ee(),this.t("desiredSize",s,t),this.Wc())){let r=this.part;r!==null&&(this.ba(r,"width"),this.ba(r,"height"))}}get width(){return this.is.width}set width(t){let e=this.is.width;if(e!==t&&(!isNaN(e)||!isNaN(t))){let i=this.is,s=new Q(t,this.is.height).u();if(this.is=s,this.c(),this instanceof ut&&this.ee(),this.t("desiredSize",i,s),this.Wc()){let n=this.part;n!==null&&this.ba(n,"width")}}}get height(){return this.is.height}set height(t){let e=this.is.height;if(e!==t&&(!isNaN(e)||!isNaN(t))){let i=this.is,s=new Q(this.is.width,t).u();if(this.is=s,this.c(),this instanceof ut&&this.ee(),this.t("desiredSize",i,s),this.Wc()){let n=this.part;n!==null&&this.ba(n,"height")}}}get minSize(){return this.p!==null?this.p.pr:Q.sc}set minSize(t){let e=this.minSize;e.equals(t)||(t=t.copy(),isNaN(t.width)&&(t.width=0),isNaN(t.height)&&(t.height=0),t.u(),this.Kt().pr=t,this.c(),this.t("minSize",e,t))}get maxSize(){return this.p!==null?this.p.yr:Q.Bk}set maxSize(t){let e=this.maxSize;e.equals(t)||(t=t.copy(),isNaN(t.width)&&(t.width=1/0),isNaN(t.height)&&(t.height=1/0),t.u(),this.Kt().yr=t,this.c(),this.t("maxSize",e,t))}get measuredBounds(){return this.se}get naturalBounds(){return this.zi}y0(){return 0}get margin(){return this.Wr}set margin(t){typeof t=="number"&&(t=new Lt(t));let e=this.Wr;e.equals(t)||(t=t.P(),this.Wr=t,this.c(),this.t("margin",e,t))}get T(){return this.Kb()===!0&&this.Bb(),this.qr}get Us(){return this.p0()===!0&&this.Bb(),this.hh}trigger(t,e,i){let s=null;return typeof t=="string"?s=new Fi(t,e,i):s=t,s.be=this,this.ws===null&&(this.ws=new pt),this.ws.set(s.propertyName,s),this}get ws(){return this.p!==null?this.p.ws:null}set ws(t){this.ws!==t&&(this.Kt().ws=t)}get gr(){return this.p!==null?this.p.gr:0}set gr(t){this.gr!==t&&(this.Kt().gr=t)}get alignment(){return this.hi}set alignment(t){let e=this.alignment;e.equals(t)||(t.isNoSpot()&&!t.isDefault()&&f.o("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+t),t=t.P(),this.hi=t,this.ef(),this.t("alignment",e,t))}get column(){return this.Hr}set column(t){t=Math.round(t);let e=this.column;e!==t&&(t<0&&f.W(t,">= 0",dt,"column"),this.Hr=t,this.c(),this.t("column",e,t),this.svg!==null&&this.svg.remove())}get columnSpan(){return this.p!==null?this.p.T0:1}set columnSpan(t){t=Math.round(t);let e=this.columnSpan;e!==t&&(t<1&&f.W(t,">= 1",dt,"columnSpan"),this.Kt().T0=t,this.c(),this.t("columnSpan",e,t))}get row(){return this.u0}set row(t){t=Math.round(t);let e=this.row;e!==t&&(t<0&&f.W(t,">= 0",dt,"row"),this.u0=t,this.c(),this.t("row",e,t),this.svg!==null&&this.svg.remove())}get rowSpan(){return this.p!==null?this.p.D0:1}set rowSpan(t){t=Math.round(t);let e=this.rowSpan;e!==t&&(t<1&&f.W(t,">= 1",dt,"rowSpan"),this.Kt().D0=t,this.c(),this.t("rowSpan",e,t))}get spanAllocation(){return this.p!==null?this.p.F0:null}set spanAllocation(t){let e=this.spanAllocation;e!==t&&(t!==null&&f.k(t,dt,"spanAllocation"),this.Kt().F0=t,this.c(),this.t("spanAllocation",e,t))}get alignmentFocus(){return this.ju}set alignmentFocus(t){let e=this.alignmentFocus;e.equals(t)||(t=t.P(),this.ju=t,this.c(),this.t("alignmentFocus",e,t))}get portId(){return this.f0}set portId(t){let e=this.portId;if(e!==t){let i=this.part;i!==null&&!(i instanceof rt)&&f.o("Cannot set portID on a Link: "+t);let s=i;e!==null&&s!==null&&s.C2(this),this.f0=t,t!==null&&s!==null&&(s.fn=!0,s.LA(this)),this.t("portId",e,t)}}Sa(){let t=this.part;if(t instanceof rt&&(this.portId!==null||this===t.port)){let e=t.diagram;e!==null&&!e.undoManager.isUndoingRedoing&&t.bA(this)}}CA(){let t=this.diagram;t===null||t.undoManager.isUndoingRedoing||(this instanceof H?this instanceof rt?this.invalidateConnectedLinks():this.walkVisualTreeFrom(this,e=>{e.Sa()}):this.Sa())}get toSpot(){return this.ct!==null?this.ct.ma:D.None}set toSpot(t){let e=this.toSpot;e.equals(t)||(t=t.P(),this.Be().ma=t,this.t("toSpot",e,t),this.Sa())}get toEndSegmentLength(){return this.ct!==null?this.ct.ya:10}set toEndSegmentLength(t){let e=this.toEndSegmentLength;e!==t&&(t<0&&f.W(t,">= 0",dt,"toEndSegmentLength"),this.Be().ya=t,this.t("toEndSegmentLength",e,t),this.Sa())}get toShortLength(){return this.ct!==null?this.ct.xa:0}set toShortLength(t){let e=this.toShortLength;e!==t&&(this.Be().xa=t,this.t("toShortLength",e,t),this.Sa())}get toLinkable(){return this.ct!==null?this.ct.R0:null}set toLinkable(t){let e=this.toLinkable;e!==t&&(this.Be().R0=t,this.t("toLinkable",e,t))}get toMaxLinks(){return this.ct!==null?this.ct.v0:1/0}set toMaxLinks(t){let e=this.toMaxLinks;e!==t&&(t<0&&f.W(t,">= 0",dt,"toMaxLinks"),this.Be().v0=t,this.t("toMaxLinks",e,t))}get fromSpot(){return this.ct!==null?this.ct.ga:D.None}set fromSpot(t){let e=this.fromSpot;e.equals(t)||(t=t.P(),this.Be().ga=t,this.t("fromSpot",e,t),this.Sa())}get fromEndSegmentLength(){return this.ct!==null?this.ct.pa:10}set fromEndSegmentLength(t){let e=this.fromEndSegmentLength;e!==t&&(t<0&&f.W(t,">= 0",dt,"fromEndSegmentLength"),this.Be().pa=t,this.t("fromEndSegmentLength",e,t),this.Sa())}get fromShortLength(){return this.ct!==null?this.ct.wa:0}set fromShortLength(t){let e=this.fromShortLength;e!==t&&(this.Be().wa=t,this.t("fromShortLength",e,t),this.Sa())}get fromLinkable(){return this.ct!==null?this.ct.O0:null}set fromLinkable(t){let e=this.fromLinkable;e!==t&&(this.Be().O0=t,this.t("fromLinkable",e,t))}get fromMaxLinks(){return this.ct!==null?this.ct.I0:1/0}set fromMaxLinks(t){let e=this.fromMaxLinks;e!==t&&(t<0&&f.W(t,">= 0",dt,"fromMaxLinks"),this.Be().I0=t,this.t("fromMaxLinks",e,t))}get cursor(){return this.p!==null?this.p.Sl:""}set cursor(t){let e=this.cursor;e!==t&&(f.s(t,"string",dt,"cursor"),this.Kt().Sl=t,this.t("cursor",e,t))}get click(){return this.p!==null?this.p.Cr:null}set click(t){let e=this.click;e!==t&&(t!==null&&f.k(t,dt,"click"),this.Kt().Cr=t,this.t("click",e,t))}get doubleClick(){return this.p!==null?this.p.Lr:null}set doubleClick(t){let e=this.doubleClick;e!==t&&(t!==null&&f.k(t,dt,"doubleClick"),this.Kt().Lr=t,this.t("doubleClick",e,t))}get contextClick(){return this.p!==null?this.p.Ar:null}set contextClick(t){let e=this.contextClick;e!==t&&(t!==null&&f.k(t,dt,"contextClick"),this.Kt().Ar=t,this.t("contextClick",e,t))}get mouseEnter(){return this.p!==null?this.p.vr:null}set mouseEnter(t){let e=this.mouseEnter;e!==t&&(t!==null&&f.k(t,dt,"mouseEnter"),this.Kt().vr=t,this.t("mouseEnter",e,t))}get mouseLeave(){return this.p!==null?this.p.Or:null}set mouseLeave(t){let e=this.mouseLeave;e!==t&&(t!==null&&f.k(t,dt,"mouseLeave"),this.Kt().Or=t,this.t("mouseLeave",e,t))}get mouseOver(){return this.p!==null?this.p.Tr:null}set mouseOver(t){let e=this.mouseOver;e!==t&&(t!==null&&f.k(t,dt,"mouseOver"),this.Kt().Tr=t,this.t("mouseOver",e,t))}get mouseHover(){return this.p!==null?this.p.Dr:null}set mouseHover(t){let e=this.mouseHover;e!==t&&(t!==null&&f.k(t,dt,"mouseHover"),this.Kt().Dr=t,this.t("mouseHover",e,t))}get mouseHold(){return this.p!==null?this.p.Fr:null}set mouseHold(t){let e=this.mouseHold;e!==t&&(t!==null&&f.k(t,dt,"mouseHold"),this.Kt().Fr=t,this.t("mouseHold",e,t))}get mouseDragEnter(){return this.p!==null?this.p.E0:null}set mouseDragEnter(t){let e=this.mouseDragEnter;e!==t&&(t!==null&&f.k(t,dt,"mouseDragEnter"),this.Kt().E0=t,this.t("mouseDragEnter",e,t))}get mouseDragLeave(){return this.p!==null?this.p.U0:null}set mouseDragLeave(t){let e=this.mouseDragLeave;e!==t&&(t!==null&&f.k(t,dt,"mouseDragLeave"),this.Kt().U0=t,this.t("mouseDragLeave",e,t))}get mouseDrop(){return this.p!==null?this.p.Rr:null}set mouseDrop(t){let e=this.mouseDrop;e!==t&&(t!==null&&f.k(t,dt,"mouseDrop"),this.Kt().Rr=t,this.t("mouseDrop",e,t))}get actionDown(){return this.p!==null?this.p.B0:null}set actionDown(t){let e=this.actionDown;e!==t&&(t!==null&&f.k(t,dt,"actionDown"),this.Kt().B0=t,this.t("actionDown",e,t))}get actionMove(){return this.p!==null?this.p.V0:null}set actionMove(t){let e=this.actionMove;e!==t&&(t!==null&&f.k(t,dt,"actionMove"),this.Kt().V0=t,this.t("actionMove",e,t))}get actionUp(){return this.p!==null?this.p.z0:null}set actionUp(t){let e=this.actionUp;e!==t&&(t!==null&&f.k(t,dt,"actionUp"),this.Kt().z0=t,this.t("actionUp",e,t))}get actionCancel(){return this.p!==null?this.p.X0:null}set actionCancel(t){let e=this.actionCancel;e!==t&&(t!==null&&f.k(t,dt,"actionCancel"),this.Kt().X0=t,this.t("actionCancel",e,t))}get toolTip(){return this.p!==null?this.p.Ir:null}set toolTip(t){let e=this.toolTip;e!==t&&(this.Kt().Ir=t,this.t("toolTip",e,t))}get contextMenu(){return this.p!==null?this.p.Er:null}set contextMenu(t){let e=this.contextMenu;e!==t&&(this.Kt().Er=t,this.t("contextMenu",e,t))}findBindingPanel(){let t=this instanceof H?this:this.panel;for(;t!==null;){if(t.L2())return t;t=t.panel}return null}bind(t,e,i,s){return this.sf(t,e,i,s),this}bindTwoWay(t,e,i,s){return this.sf(t,e,i,s).makeTwoWay(),this}bindModel(t,e,i,s){return this.sf(t,e,i,s).ofModel(),this}bindObject(t,e,i,s,n){return this.sf(t,e,i,s).ofObject(n),this}theme(t,e,i,s,n){return this.mh(t,e,i,s,n),this}themeData(t,e,i,s,n){return this.mh(t,e,i,s,n).ofData(),this}themeObject(t,e,i,s,n,o){return this.mh(t,e,i,s,n).ofObject(o),this}themeModel(t,e,i,s,n){return this.mh(t,e,i,s,n).ofModel(),this}sf(t,e,i,s){let n=null;return typeof t=="string"?n=new oe(t,e,i,s):n=t,this.Y0(n),n}mh(t,e,i,s,n){let o=null;return typeof t=="string"?o=new pi(t,e,i,s,n):o=t,this.Y0(o),o}Y0(t){t.be=this;let e=this.findBindingPanel();e!==null&&e.AA()&&f.o("Cannot add a Binding to a template that has already been copied: "+t),this.Ci===null&&(this.Ci=new j),this.Ci.add(t)}set(t){return Object.assign(this,t),this}attach(t){return dt.A2(this,t),this}apply(t){return t(this),this}setProperties(t){return U.s0(this,t),this}static make(t,...e){let i=arguments,s=null,n=null;if(f.it(t))n=t;else if(typeof t=="string"){let r=dt.jb.get(t);f.it(r)?(i=Array.prototype.slice.call(i),s=r(i),f.G(s)||f.o('GraphObject.make invoked object builder "'+t+'", but it did not return an Object')):n=A.go[t]}s===null&&((n==null||!n.constructor)&&f.o("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+t),s=new n);let o=1;if(s instanceof U&&i.length>1){let r=s,a=i[1];(typeof a=="string"||a instanceof HTMLDivElement)&&(r.AM(a),o++)}for(let r=o;r<i.length;r++){let a=i[r];a===void 0?f.o("Undefined value at argument "+r+" for object being constructed by GraphObject.make: "+s):dt.A2(s,a)}return s}static A2(t,e){if(typeof e=="number")dt.ev(t,e);else if(typeof e=="string")dt.sv(t,e);else if(e instanceof dt)t instanceof H||f.o("A GraphObject can only be added to a Panel, not to: "+t),t.add(e);else if(e instanceof jt){let i;e.isRow&&f.it(t.getRowDefinition)?i=t.getRowDefinition(e.index):!e.isRow&&f.it(t.getColumnDefinition)&&(i=t.getColumnDefinition(e.index)),i instanceof jt?i.Hb(e):f.o("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+t)}else if(e instanceof Ft){let i=t;i.type=e}else if(e instanceof oe)t instanceof dt||t instanceof jt?t.bind(e):f.o("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+t);else if(e instanceof Fi)t instanceof dt?t.trigger(e):f.o("An AnimationTrigger can only be applied to a GraphObject, not to: "+t);else if(e instanceof $t)t instanceof kt&&t.type===4?t.figures.add(e):f.o("A PathFigure can only be added to a Path Geometry, not to: "+t);else if(e instanceof vt)t instanceof $t?t.segments.add(e):f.o("A PathSegment can only be added to a PathFigure, not to: "+t);else if(e instanceof ne)t instanceof U||t instanceof ft?t.layout=e:f.o("A Layout can only be assigned to a Diagram or a Group, not to: "+t);else if(Array.isArray(e))for(let i=0;i<e.length;i++){let s=e[i];dt.A2(t,s)}else f.G(e)?dt.nv(t,e):f.o('Unknown initializer "'+e+'" for object being constructed by GraphObject.make: '+t)}static sv(t,e){if(t instanceof xt)t.text=e;else if(t instanceof ut)t.figure=e;else if(t instanceof zt)t.source=e;else if(t instanceof H){let i=Ft.es.get(e);i!==null&&(t.type=i)}else if(t instanceof E){let i=f.Uh(qe,e);i!==null?t.type=i:f.o("Unknown Brush type as an argument to GraphObject.make: "+e)}else if(t instanceof kt){let i=f.Uh(ei,e);i!==null&&(t.type=i)}else if(t instanceof vt){let i=f.Uh(Ci,e);i!==null&&(t.type=i)}}static ev(t,e){f.it(t.oi)?t.oi(e):f.er(t,e)}static nv(t,e){if(t instanceof E){let i=new q;for(let s in e){let n=parseFloat(s);isNaN(n)?i[s]=e[s]:t.addColorStop(n,e[s])}U.s0(t,i)}else if(t instanceof jt){if(e.row!==void 0){let s=e.row;(s==null||s===1/0||isNaN(s)||s<0)&&f.o("Must specify non-negative integer row for RowColumnDefinition "+e+", not: "+s),t.isRow=!0,t.index=s}else if(e.column!==void 0){let s=e.column;(s==null||s===1/0||isNaN(s)||s<0)&&f.o("Must specify non-negative integer column for RowColumnDefinition "+e+", not: "+s),t.isRow=!1,t.index=s}let i=new q;for(let s in e)s==="row"||s==="column"||(i[s]=e[s]);U.s0(t,i)}else U.s0(t,e)}static build(t,e,...i){let s=dt.jb.get(t);if(f.it(s)){let n=s([t].concat(i));if(n instanceof dt)return e&&n.setProperties(e),n}f.o('GraphObject.build invoked object builder "'+t+'", but it did not return an Object')}static defineBuilder(t,e){f.s(t,"string",dt,"defineBuilder:name"),f.k(e,dt,"defineBuilder:func");let i=t.toLowerCase();dt.jb.set(t,e)}static isBuilderDefined(t){return dt.jb.has(t)}static takeBuilderArgument(t,e,i){i===void 0&&(i=null);let s=t[1];return(f.it(i)?i(s):typeof s=="string")?(t.splice(1,1),s):(e===void 0&&f.o("no "+(f.it(i)?"satisfactory":"string")+" argument for GraphObject builder "+t[0]),e)}static jb=new pt}dt.Vertical=4,dt.Horizontal=5,dt.defineBuilder("Button",x=>{let t="#f5f5f5",e="#737373",i="#d4d4d4",s="#737373",n="#a3a3a3",o=2.76142374915397,r=2.761423749153969,a=new H(H.Auto,{isActionable:!0,enabledChanged:(h,l)=>{if(h instanceof H){let 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 ut("RoundedRectangle",{name:"ButtonBorder",spot1:new D(0,0,o,r),spot2:new D(1,1,-o,-r),parameter1:2,fill:t,stroke:e}));return a.mouseEnter=(h,l,u)=>{if(!l.isEnabledObject()||!(l instanceof H))return;let c=l.findObject("ButtonBorder");c instanceof ut&&(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 H))return;let c=l.findObject("ButtonBorder");c instanceof ut&&(l._buttonFillNormal!==void 0&&(c.fill=l._buttonFillNormal),l._buttonStrokeNormal!==void 0&&(c.stroke=l._buttonStrokeNormal))},a}),dt.defineBuilder("TreeExpanderButton",x=>{let t=dt.build("Button");return t.attach({_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine",visible:!1}),t.add(new ut("MinusLine",{name:"ButtonIcon",stroke:"#0a0a0a",strokeWidth:2,desiredSize:Q.nu}).bindObject("figure","isTreeExpanded",(e,i)=>{let s=i.panel;return e?s._treeExpandedFigure:s._treeCollapsedFigure})),t.bindObject("visible","isTreeLeaf",e=>!e),t.click=(e,i)=>{let s=i.part;if(s instanceof St&&(s=s.adornedPart),!(s instanceof rt))return;let n=s.diagram;if(n===null)return;let o=n.commandHandler;if(s.isTreeExpanded){if(!o.canCollapseTree(s))return}else if(!o.canExpandTree(s))return;e.handled=!0,s.isTreeExpanded?o.collapseTree(s):o.expandTree(s)},t}),dt.defineBuilder("SubGraphExpanderButton",x=>{let t=dt.build("Button");return t.attach({_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"}),t.add(new ut("MinusLine",{name:"ButtonIcon",stroke:"#0a0a0a",strokeWidth:2,desiredSize:Q.nu}).bindObject("figure","isSubGraphExpanded",(e,i)=>{let s=i.panel;return e?s._subGraphExpandedFigure:s._subGraphCollapsedFigure})),t.click=(e,i)=>{let s=i.part;if(s instanceof St&&(s=s.adornedPart),!(s instanceof ft))return;let n=s.diagram;if(n===null)return;let o=n.commandHandler;if(s.isSubGraphExpanded){if(!o.canCollapseSubGraph(s))return}else if(!o.canExpandSubGraph(s))return;e.handled=!0,s.isSubGraphExpanded?o.collapseSubGraph(s):o.expandSubGraph(s)},t}),dt.defineBuilder("ToolTip",x=>new St(H.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new P(0,2)}).add(new ut("RoundedRectangle",{name:"Border",parameter1:1,fill:"#f5f5f5",strokeWidth:0,spot1:new D(0,0,4,6),spot2:new D(1,1,-4,-4)}))),dt.defineBuilder("ContextMenu",x=>new St(H.Vertical,{background:"#f5f5f5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new P(0,2)}).bindObject("background","",t=>t.adornedPart!==null&&t.hasPlaceholder()?null:"#f5f5f5")),dt.defineBuilder("ContextMenuButton",x=>{let t=dt.build("Button");t.stretch=5;let e=t.findObject("ButtonBorder");return e instanceof ut&&(e.figure="Rectangle",e.strokeWidth=0,e.spot1=new D(0,0,4,6),e.spot2=new D(1,1,-4,-4)),t}),dt.defineBuilder("PanelExpanderButton",x=>{let t=dt.takeBuilderArgument(x,"COLLAPSIBLE"),e=dt.build("Button");e.attach({_buttonExpandedFigure:"M0 0 M0 6 L4 2 8 6 M8 8",_buttonCollapsedFigure:"M0 0 M0 2 L4 6 8 2 M8 8","ButtonBorder.fill":"rgba(0, 0, 0, 0)",_buttonFillNormal:"rgba(0, 0, 0, 0)","ButtonBorder.stroke":null,_buttonStrokeNormal:null,_buttonFillOver:"rgba(0, 0, 0, .2)",_buttonStrokeOver:null}),e.add(new ut({name:"ButtonIcon",strokeWidth:2}).bindObject("geometryString","visible",s=>s?e._buttonExpandedFigure:e._buttonCollapsedFigure,void 0,t));let i=e.findObject("ButtonBorder");return i instanceof ut&&(i.stroke=null,i.fill="rgba(0, 0, 0, 0)"),e.click=(s,n)=>{if(!(n instanceof H))return;let o=n.diagram;if(o===null||o.isReadOnly)return;let r=n.findBindingPanel();if(r===null&&(r=n.part),r!==null){let a=r.findObject(t);a!==null&&(s.handled=!0,o.startTransaction("Collapse/Expand Panel"),a.visible=!a.visible,o.commitTransaction("Collapse/Expand Panel"))}},e}),dt.defineBuilder("CheckBoxButton",x=>{let t=dt.takeBuilderArgument(x),e=dt.build("Button",{desiredSize:new Q(14,14)});e.attach({"ButtonBorder.spot1":new D(0,0,1,1),"ButtonBorder.spot2":new D(1,1,-1,-1)});let i=new ut({name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:2,geometryStretch:6,visible:!1});return t!==""&&i.bindTwoWay("visible",t),e.add(i),e.click=(s,n)=>{if(!(n instanceof H))return;let o=s.diagram;if(o===null||o.isReadOnly||t!==""&&o.model.isReadOnly)return;s.handled=!0;let r=n.findObject("ButtonIcon");o.startTransaction("checkbox"),r!==null&&(r.visible=!r.visible),f.it(n._doClick)&&n._doClick(s,n),o.commitTransaction("checkbox")},e}),dt.defineBuilder("CheckBox",x=>{let t=dt.takeBuilderArgument(x),e=dt.build("CheckBoxButton",{name:"Button",isActionable:!1,margin:new Lt(0,1,0,0)},t),i=new H("Horizontal",{isActionable:!0,cursor:e.cursor,margin:new Lt(1),mouseEnter:e.mouseEnter,mouseLeave:e.mouseLeave,click:e.click}).attach({_buttonFillNormal:e._buttonFillNormal,_buttonStrokeNormal:e._buttonStrokeNormal,_buttonFillOver:e._buttonFillOver,_buttonStrokeOver:e._buttonStrokeOver,_buttonFillDisabled:e._buttonFillDisabled,_buttonClick:e.click});return i.add(e),e.mouseEnter=null,e.mouseLeave=null,e.click=null,i});class oi{fi;St;Hn;Ci;qn;Ys;Sl;Cr;Lr;Ar;vr;Or;Tr;Dr;Fr;E0;U0;Rr;B0;V0;z0;X0;Ir;Er;P0;F0;ws;pr;yr;$n;D0;T0;gr;b0;G0;K0;constructor(){this.fi=!1,this.St="",this.Hn=-1,this.Ci=null,this.qn=null,this.Ys=null,this.Sl="",this.Cr=null,this.Lr=null,this.Ar=null,this.vr=null,this.Or=null,this.Tr=null,this.Dr=null,this.Fr=null,this.E0=null,this.U0=null,this.Rr=null,this.B0=null,this.V0=null,this.z0=null,this.X0=null,this.Ir=null,this.Er=null,this.P0=null,this.F0=null,this.ws=null,this.pr=Q.sc,this.yr=Q.Bk,this.$n=1,this.D0=1,this.T0=1,this.gr=0,this.b0=null,this.G0=null,this.K0="category"}copy(){let t=new oi;return t.St=this.St,t.Hn=this.Hn,t.Ci=this.Ci,t.Ys=this.Ys,t.Sl=this.Sl,t.Cr=this.Cr,t.Lr=this.Lr,t.Ar=this.Ar,t.vr=this.vr,t.Or=this.Or,t.Tr=this.Tr,t.Dr=this.Dr,t.Fr=this.Fr,t.E0=this.E0,t.U0=this.U0,t.Rr=this.Rr,t.B0=this.B0,t.V0=this.V0,t.z0=this.z0,t.X0=this.X0,t.Ir=this.Ir,t.Er=this.Er,t.P0=this.P0,t.F0=this.F0,t.ws=this.ws,t.pr=this.pr.P(),t.yr=this.yr.P(),t.$n=this.$n,t.D0=this.D0,t.T0=this.T0,t.gr=this.gr,t.b0=this.b0,t.G0=this.G0,t.K0=this.K0,t}}class ts{m;constructor(){this.m=[1,0,0,1,0,0]}copy(){let t=new ts;return t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5],t}translate(t,e){this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e}scale(t,e){this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e}rotate(t,e,i){if(t>=360?t-=360:t<0&&(t+=360),t===0)return;this.translate(e,i);let s=0,n=0;if(t===90)s=0,n=1;else if(t===180)s=-1,n=0;else if(t===270)s=0,n=-1;else{let l=t*Math.PI/180;s=Math.cos(l),n=Math.sin(l)}let o=this.m[0]*s+this.m[2]*n,r=this.m[1]*s+this.m[3]*n,a=this.m[0]*-n+this.m[2]*s,h=this.m[1]*-n+this.m[3]*s;this.m[0]=o,this.m[1]=r,this.m[2]=a,this.m[3]=h,this.translate(-e,-i)}}class Oi{type;x1;y1;r1;x2;y2;r2;colors;pattern;constructor(t){this.type=t,this.x1=0,this.y1=0,this.r1=0,this.x2=0,this.y2=0,this.r2=0,this.colors=[],this.pattern=null}addColorStop(t,e){this.colors.push({offset:t,color:e})}}class Ri{Tt;li;jr;Gu;T2;constructor(t,e,i){let s=e===void 0?A.document:e;this.jr=s,this.T2="http://www.w3.org/2000/svg";let n="http://www.w3.org/2000/xmlns/";s!==void 0&&(this.Tt=this.makeElement("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.style.display="block",this.style.letterSpacing="normal",this.style.wordSpacing="normal",i||(this.style.position="absolute"),this.Tt.setAttributeNS(n,"xmlns",this.T2),this.Tt.setAttributeNS(n,"xmlns:xlink","http://www.w3.org/1999/xlink")),this.Gu=null,this.li=new ce(this,i)}resize(t,e,i,s){return this.width!==t||this.height!==e?(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=s+"px",this.Tt.setAttributeNS(null,"width",i+"px"),this.Tt.setAttributeNS(null,"height",s+"px"),this.Tt.setAttributeNS(null,"viewBox","0 0 "+i+" "+s),this.li.D2.firstElementChild.setAttributeNS(null,"width",i+"px"),this.li.D2.firstElementChild.setAttributeNS(null,"height",s+"px"),!0):!1}makeElement(t,e,i){let s=this.jr.createElementNS(this.T2,t);if(f.G(e))for(let n in e)s.setAttributeNS(n==="href"?"http://www.w3.org/1999/xlink":"",n,e[n]);return i!==void 0&&(s.textContent=i),s}getBoundingClientRect(){return this.Tt.getBoundingClientRect()}focus(){this.Tt.focus()}get width(){return this.Tt.width.baseVal.value}set width(t){this.Tt.setAttribute("width",t+"px")}get height(){return this.Tt.height.baseVal.value}set height(t){this.Tt.setAttribute("height",t+"px")}dispose(){this.jr=null}get style(){return this.Tt.style}}class ce{nf;of;un;Li;ze;fillStyle;font;globalAlpha;lineCap;lineDashOffset;lineJoin;lineWidth;miterLimit;shadowBlur;shadowColor;shadowOffsetX;shadowOffsetY;strokeStyle;textAlign;imageSmoothingEnabled;clipInsteadOfFill;lastCreatedElement;rf;lf;surface;svg;D2;TA;qb;Io;ph;Ma;currentElement;clipPathGroup;diagramGroup;lastDrawnPart;currentPath;outerGroup;pathAttributes;Zr;kr;filter;partClipRect;constructor(t,e){if(this.surface=t,this.svg=t.Tt,this.rf=[],this.lf=[],this.fillStyle="#000000",this.font="10px sans-serif",this.globalAlpha=1,this.lineCap="butt",this.lineDashOffset=0,this.lineJoin="miter",this.lineWidth=1,this.miterLimit=10,this.shadowBlur=0,this.shadowColor="rgba(0, 0, 0, 0)",this.shadowOffsetX=0,this.shadowOffsetY=0,this.Zr=!1,this.strokeStyle="#000000",this.textAlign="start",this.clipInsteadOfFill=!1,this.nf=0,this.of=0,this.un=0,this.lastCreatedElement=null,this.currentElement=null,this.Li=[],this.pathAttributes={},this.qb=!1,this.Io=null,this.ph=0,this.ze=new ts,t.jr===null||t.jr===void 0)return;this.clipPathGroup=this.newGroup2(),this.diagramGroup=this.newGroup2("gojs-diagram"),this.lastDrawnPart=null,this.currentPath=null;let i=I.pw++,s=this.makeElement("clipPath",{id:"mainClip"+i}),n={x:0,y:0,width:t.width,height:t.height};s.appendChild(this.makeElement("rect",n)),this.D2=s,this.svg.appendChild(this.clipPathGroup),this.clipPathGroup.appendChild(this.diagramGroup),this.svg.appendChild(s),this.clipPathGroup.setAttributeNS(null,"clip-path","url(#mainClip"+i+")"),this.TA={},this.kr=!!e,this.filter="",this.partClipRect=null}setDiagramPosScale(t,e,i,s,n,o){this.diagramGroup===void 0?this.newGroup(t,e,i,s,n,o):this.diagramGroup.setAttribute("transform","matrix("+t+", "+e+", "+i+", "+s+", "+n+", "+o+")")}resetInnerSVG(){this.diagramGroup!==null&&(this.diagramGroup.innerHTML="")}arc(t,e,i,s,n,o,r,a){let h=2*Math.PI,l=1e-6,u=h-l,c=i*Math.cos(s),d=i*Math.sin(s),g=t+c,p=e+d,m=o?0:1,y=o?s-n:n-s;(Math.abs(r-g)>l||Math.abs(a-p)>l)&&this.Li.push(["L",g,+p]),y<0&&(y=y%h+h),y>u?(this.Li.push(["A",i,i,0,1,m,t-c,e-d]),this.Li.push(["A",i,i,0,1,m,g,p])):y>l&&this.Li.push(["A",i,i,0,+(y>=Math.PI),m,t+i*Math.cos(n),e+i*Math.sin(n)])}beginPath(){this.Li=[],this.pathAttributes={stroke:"none",fill:"none"}}endPath(t){this.ov(this.Li,this.ze,t||0)}bezierCurveTo(t,e,i,s,n,o){this.Li.push(["C",t,e,i,s,n,o])}clearRect(t,e,i,s){}clip(){this.pathAttributes.clipPath=!0}closePath(){this.Li.push(["z"])}createLinearGradient(t,e,i,s){let n=new Oi("linear");return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}createPattern(t,e){let i="";t instanceof HTMLCanvasElement&&(i=t.toDataURL()),t instanceof HTMLImageElement&&(i=t.getAttribute("src"));let s=this.TA;if(s[i])return"url(#"+s[i]+")";let n="PATTERN"+I.pw++,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(U.img,r)),this.svg.appendChild(a),s[i]=n,"url(#"+n+")"}createRadialGradient(t,e,i,s,n,o){let r=new Oi("radial");return r.x1=t,r.y1=e,r.r1=i,r.x2=s,r.y2=n,r.r2=o,r}amendImageTransform(t,e,i,s,n,o,r,a){let h=r/i,l=a/s;(n!==0||o!==0)&&this.ze.translate(n,o),(h!==1||l!==1)&&this.ze.scale(h,l),(t!==0||e!==0)&&this.ze.translate(-t,-e)}drawImage(t,e,i,s,n,o,r,a,h){let l="";t instanceof HTMLCanvasElement&&(l=t.toDataURL()),t instanceof HTMLImageElement&&(l=t.getAttribute("src"));let u=t instanceof HTMLImageElement?t.naturalWidth:t.width,c=t instanceof HTMLImageElement?t.naturalHeight:t.height;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};!L.z(s,a)||!L.z(n,h)?d.preserveAspectRatio="none":l.toLowerCase().indexOf(".svg")===-1&&l.toLowerCase().indexOf("data:image/svg")===-1&&(d.preserveAspectRatio="xMidYMid slice"),(e!==0||i!==0||s!==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(U.img,d,this.ze),this._u(U.img,d)}fill(t,e){t&&(this.pathAttributes["fill-rule"]="evenodd"),this.setFill(this.pathAttributes)}fillContext(t,e,i){this.clipInsteadOfFill?this.clip():this.fill(e,i)}createOrUpdateClipGroup(t,e){let i=this.newGroup(1,0,0,1,-e.x,-e.y);i.setAttributeNS(null,"class","spotClip"),t.ah=i}fillRect(t,e,i,s){this.addRect("fill",[t,e,i,s],this.ze)}fillBackground(t,e,i,s){let n={x:t,y:e,width:i,height:s};this.processCommon("fill",n,this.ze),this.setFill(n),this.svg.prepend(this.makeElement("rect",n))}fillText(t,e,i){this.addText("fill",[t,e,i],this.ze)}lineTo(t,e){this.Li.push(["L",t,e])}moveTo(t,e){this.Li.push(["M",t,e])}quadraticCurveTo(t,e,i,s){this.Li.push(["Q",t,e,i,s])}rect(t,e,i,s){this.Li.push(["M",t,e],["L",t+i,e],["L",t+i,e+s],["L",t,e+s],["z"])}restore(){this.ze=this.rf.pop(),this.Li=this.rf.pop();let t=this.rf.pop();this.fillStyle=t.fillStyle,this.font=t.font,this.globalAlpha=t.globalAlpha,this.lineCap=t.lineCap,this.lineDashOffset=t.lineDashOffset,this.lineJoin=t.lineJoin,this.lineWidth=t.lineWidth,this.miterLimit=t.miterLimit,this.shadowBlur=t.shadowBlur,this.shadowColor=t.shadowColor,this.shadowOffsetX=t.shadowOffsetX,this.shadowOffsetY=t.shadowOffsetY,this.strokeStyle=t.strokeStyle,this.textAlign=t.textAlign,this.partClipRect=t.partClipRect}save(){let t={fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign,partClipRect:this.partClipRect};this.rf.push(t);let e=[];for(let i=0;i<this.Li.length;i++)e.push(this.Li[i]);this.rf.push(e),this.rf.push(this.ze.copy())}setTransform(t,e,i,s,n,o){t===1&&e===0&&i===0&&s===1&&n===0&&o===0||this.newGroup(t,e,i,s,n,o)}setCurrentTransform(t,e,i,s,n,o){this.ze.m=[t,e,i,s,n,o]}getCurrentTransform(){let t=this.ze.m;return"matrix("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}scale(t,e){this.ze.scale(t,e)}translate(t,e){this.ze.translate(t,e)}transform(t,e,i,s,n,o){}commitTransform(){}stroke(){this.setStroke(this.pathAttributes)}strokeContext(){this.clipInsteadOfFill||this.stroke()}strokeRect(t,e,i,s){this.addRect("stroke",[t,e,i,s],this.ze)}makeElement(t,e,i){return this.surface.makeElement(t,e,i)}_u(t,e,i){let s=this.makeElement(t,e,i);return this.currentElement!==null?this.currentElement.appendChild(s):this.currentElement=s,this.lastCreatedElement=s,s}processCommon(t,e,i){if(t==="fill"?this.setFill(e):t==="stroke"&&this.setStroke(e),i!==null){let s=i.m;e.transform="matrix("+s[0]+", "+s[1]+", "+s[2]+", "+s[3]+", "+s[4]+", "+s[5]+")"}}setFill(t){if(this.fillStyle instanceof Oi){t.fill=this.addGradient(this.fillStyle,!0);return}if(/^rgba\(/.test(this.fillStyle)){let e=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.fillStyle);t.fill="rgb("+e[1]+","+e[2]+","+e[3]+")",t["fill-opacity"]=e[4]}else t.fill=this.fillStyle}setFillOrStrokeInPlace(t,e){let i=e?"fill":"stroke";if(this.fillStyle instanceof Oi){t.setAttributeNS(null,"fill",this.addGradient(this.fillStyle,!0));return}if(/^rgba\(/.test(this.fillStyle)){let s=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.fillStyle);t.setAttributeNS(null,i,"rgb("+s[1]+","+s[2]+","+s[3]+")"),t.setAttributeNS(null,i+"-opacity",s[4])}else t.setAttributeNS(null,i,this.fillStyle)}setStroke(t){if(this.strokeStyle instanceof Oi)t.stroke=this.addGradient(this.strokeStyle,!1);else if(/^rgba\(/.test(this.strokeStyle)){let e=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(this.strokeStyle);t.stroke="rgb("+e[1]+","+e[2]+","+e[3]+")",t["stroke-opacity"]=e[4]}else t.stroke=this.strokeStyle;t["stroke-width"]=this.lineWidth,t["stroke-linecap"]=this.lineCap,t["stroke-linejoin"]=this.lineJoin,t["stroke-miterlimit"]=this.miterLimit,this.qb&&(t["stroke-dasharray"]=this.Io.toString(),t["stroke-dashoffset"]=this.ph)}addGradient(t,e){let i="",s=this.currentPath!==null?this.currentPath.getAttribute(e?"fill":"stroke"):null;if(s!==null&&s.indexOf("GRAD")!==-1){i=s.split("#")[1].slice(0,-1);let h=this.svg.getElementById(i);h!==null&&h.remove()}else i="GRAD"+I.pw++;let n;if(t.type==="linear"){let h={x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,id:i,gradientUnits:"userSpaceOnUse"};n=this.makeElement("linearGradient",h)}else if(t.type==="radial"){let h={x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,r1:t.r1,r2:t.r2,id:i};n=this.makeElement("radialGradient",h)}else f.o("invalid gradient");let o=t.colors,r=o.length,a=[];for(let h=0;h<r;h++){let l=o[h],u=l.color,c={offset:l.offset,"stop-color":u};if(/^rgba\(/.test(u)){let d=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(u);c["stop-color"]="rgb("+d[1]+","+d[2]+","+d[3]+")",c["stop-opacity"]=d[4]}a.push(c)}a.sort((h,l)=>h.offset>l.offset?1:-1);for(let h=0;h<r;h++)n.appendChild(this.makeElement("stop",a[h]));return this.svg.appendChild(n),"url(#"+i+")"}addRect(t,e,i){let s={x:e[0],y:e[1],width:e[2],height:e[3]};this.processCommon(t,s,i),this._u("rect",s)}addText(t,e,i){let s=this.textAlign;s==="left"?s="start":s==="right"?s="end":s==="center"&&(s="middle");let n={x:e[1],y:e[2],style:"font: "+this.font,"text-anchor":s};this.processCommon(t,n,i),this._u("text",n,e[0])}ov(t,e,i){let s=this.rv(t),n=this.pathAttributes;if(n.clipPath){this.lf.length>1&&this.lf[this.lf.length-2].setAttributeNS(null,"clip-path",'path("'+s+'") view-box');return}if(n.d=s,this.processCommon("",n,e),this.currentPath!==null){let o=this.currentPath;if(o.nodeName!=="g")for(let r in n)r!=="transform"&&o.setAttributeNS(null,r,n[r]);else{let r=o.getElementsByTagName("path");for(let a in n)a!=="transform"&&r[i].setAttributeNS(null,a,n[a])}}else this._u("path",n)}rv(t){let e=[];for(let i=0;i<t.length;i++){let s=t[i].slice(),n=[s.shift()];if(n[0]==="A")n.push(s.shift()+","+s.shift(),s.shift(),s.shift()+","+s.shift(),s.shift()+","+s.shift());else for(;s.length;)n.push(s.shift()+","+s.shift());e.push(n.join(" "))}return e.join(" ")}newGroup(t,e,i,s,n,o){let r=new ts;r.m=[t,e,i,s,n,o];let a={};this.processCommon("g",a,r);let h=this._u("g",a);return this.lf.push(h),h}newGroup2(t){let e={};t&&(e.class=t);let i=this._u("g",e);return this.lf.push(i),i}endGroup(){return this.lf.pop()}dummyGroup(){return this.newGroup2(),this.endGroup()}shadowsSet(t,e,i){this.nf=t,this.of=e,this.un=i}shadowsOff(){this.Zr=!1,this.shadowOffsetX=0,this.shadowOffsetY=0,this.shadowBlur=0}shadowsOn(){this.Zr=!0,this.shadowOffsetX=this.nf,this.shadowOffsetY=this.of,this.shadowBlur=this.un}enableDash(t,e){this.qb=!0,this.Io=t,this.ph=e}disableDash(){this.qb=!1}clearContextCache(t){}setImageSmoothingEnabled(t){}rotate(t){this.ze.rotate(t*57.2958,0,0)}getImageData(t,e,i,s){return null}measureText(t){return null}removeOldGradient(t,e,i){let s=e.getAttribute(i);if(s===null)return;let n=s.split("#");if(n.length===1)return;let o=this.svg.getElementById(n[1].slice(0,-1));if(o!==null){let r=new RegExp(o.id,"g");this.svg.innerHTML.match(r).length===1&&o.remove()}}removePartFromView(t){t.svg!==null&&t.svg.parentNode===this.diagramGroup&&t.svg.remove()}}class Ue{Tt;li;jr;Gu;constructor(t,e,i,s){let n=e===void 0?A.document:e;this.jr=n,this.Gu=null;let o=n.createElement("canvas");o.tabIndex=0,this.Tt=o,this.li=new Ei(o,i,s),U.Qe.set(o,t)}resize(t,e,i,s){return this.width!==t||this.height!==e?(this.width=t,this.height=e,this.style.width=i+"px",this.style.height=s+"px",!0):!1}toDataURL(t,e){return this.Tt.toDataURL(t,e)}getBoundingClientRect(){return this.Tt.getBoundingClientRect()}focus(){this.Tt.focus()}get width(){return this.Tt.width}set width(t){this.Tt.width=t}get height(){return this.Tt.height}set height(t){this.Tt.height=t}dispose(){U.Qe.delete(this.Tt),this.jr=null}get style(){return this.Tt.style}}class Ei{E;Wb;Jb;$b;clipInsteadOfFill;nf;of;un;Ma;Zr;kr;constructor(t,e,i){this.E=t.getContext?t.getContext("2d",e):null,this.E===null&&f.o("Browser does not support HTML Canvas Element"),this.Wb="",this.Jb="",this.$b="",this.clipInsteadOfFill=!1,this.nf=0,this.of=0,this.un=0,this.Zr=!1,this.Ma=new Pt,this.kr=!!i}createOrUpdateClipGroup(t,e){}setImageSmoothingEnabled(t){this.E.imageSmoothingEnabled=t}get fillStyle(){return this.E.fillStyle}set fillStyle(t){this.$b!==t&&(this.E.fillStyle=t,this.$b=t)}get font(){return this.E.font}set font(t){this.Wb!==t&&(this.E.font=t,this.Wb=t)}get globalAlpha(){return this.E.globalAlpha}set globalAlpha(t){this.E.globalAlpha=t}get lineCap(){return this.E.lineCap}set lineCap(t){this.E.lineCap=t}get lineDashOffset(){return this.E.lineDashOffset}set lineDashOffset(t){this.E.lineDashOffset=t}get lineJoin(){return this.E.lineJoin}set lineJoin(t){this.E.lineJoin=t}get lineWidth(){return this.E.lineWidth}set lineWidth(t){this.E.lineWidth=t}get miterLimit(){return this.E.miterLimit}set miterLimit(t){this.E.miterLimit=t}get shadowBlur(){return this.E.shadowBlur}set shadowBlur(t){this.E.shadowBlur=t}get shadowColor(){return this.E.shadowColor}set shadowColor(t){this.E.shadowColor=t}get shadowOffsetX(){return this.E.shadowOffsetX}set shadowOffsetX(t){this.E.shadowOffsetX=t}get shadowOffsetY(){return this.E.shadowOffsetY}set shadowOffsetY(t){this.E.shadowOffsetY=t}get strokeStyle(){return this.E.strokeStyle}set strokeStyle(t){this.Jb!==t&&(this.E.strokeStyle=t,this.Jb=t)}get textAlign(){return this.E.textAlign}set textAlign(t){this.E.textAlign=t}get imageSmoothingEnabled(){return this.E.imageSmoothingEnabled}set imageSmoothingEnabled(t){this.E.imageSmoothingEnabled=t}get filter(){return this.E.filter}set filter(t){t===""?this.E.filter="none":this.E.filter=t}arc(t,e,i,s,n,o,r,a){this.E.arc(t,e,i,s,n,o)}beginPath(){this.E.beginPath()}endPath(){}bezierCurveTo(t,e,i,s,n,o){this.E.bezierCurveTo(t,e,i,s,n,o)}clearRect(t,e,i,s){this.commitTransform(),this.E.clearRect(t,e,i,s)}clip(t){t?this.E.clip(t):this.E.clip()}closePath(){this.E.closePath()}createLinearGradient(t,e,i,s){return this.E.createLinearGradient(t,e,i,s)}createPattern(t,e){return this.E.createPattern(t,e)}createRadialGradient(t,e,i,s,n,o){return this.E.createRadialGradient(t,e,i,s,n,o)}drawImage(t,e,i,s,n,o,r,a,h){s===void 0?this.E.drawImage(t,e,i):this.E.drawImage(t,e,i,s,n,o,r,a,h)}fill(t,e){e?this.E.fill(e,t?"evenodd":"nonzero"):this.E.fill(t?"evenodd":"nonzero")}fillRect(t,e,i,s){this.E.fillRect(t,e,i,s)}fillBackground(t,e,i,s){this.E.fillRect(t,e,i,s)}fillText(t,e,i){this.E.fillText(t,e,i)}getImageData(t,e,i,s){return this.E.getImageData(t,e,i,s)}lineTo(t,e){this.E.lineTo(t,e)}measureText(t){return this.E.measureText(t)}moveTo(t,e){this.E.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.E.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.E.rect(t,e,i,s)}restore(){this.E.restore()}save(){this.commitTransform(),this.E.save()}rotate(t){this.Ma.cs(t*57.2958,0,0)}setTransform(t,e,i,s,n,o){this.Ma.setTo(t,e,i,s,n,o)}scale(t,e){this.Ma.tt(t,e)}translate(t,e){this.Ma.Fs(t,e)}stroke(t){t?this.E.stroke(t):this.E.stroke()}transform(t,e,i,s,n,o){if(t===1&&e===0&&i===0&&s===1&&n===0&&o===0)return;let r=this.Ma,a=r.m11*t+r.m21*e,h=r.m12*t+r.m22*e,l=r.m11*i+r.m21*s,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.Ma;this.E.setTransform(t.m11,t.m12,t.m21,t.m22,t.dx,t.dy)}fillContext(t,e,i){this.radialFill(t,e,i)||this.fillOrClip(e,i)}radialFill(t,e,i){if(!(t instanceof E)||t.type!==3)return!1;let s=t._c,n=t.Gb;return n>s?(this.scale(s/n,1),this.translate((n-s)/2,0)):s>n&&(this.scale(1,n/s),this.translate(0,(s-n)/2)),this.fillOrClip(e,i),n>s?(this.translate(-(n-s)/2,0),this.scale(1/(s/n),1)):s>n&&(this.translate(0,-(s-n)/2),this.scale(1,1/(n/s))),!0}strokeContext(){this.clipInsteadOfFill||this.stroke()}fillOrClip(t,e){this.clipInsteadOfFill?this.clip(e):this.fill(t,e)}shadowsSet(t,e,i){this.nf=t,this.of=e,this.un=i}shadowsOff(){this.Zr=!1,this.shadowOffsetX=0,this.shadowOffsetY=0,this.shadowBlur=0}shadowsOn(){this.Zr=!0,this.shadowOffsetX=this.nf,this.shadowOffsetY=this.of,this.shadowBlur=this.un}enableDash(t,e){let i=this.E;i.setLineDash!==void 0&&(i.setLineDash(t),i.lineDashOffset=e)}disableDash(){let t=this.E;t.setLineDash!==void 0&&(t.setLineDash(Ei.EmptyArray),t.lineDashOffset=0)}clearContextCache(t){t&&(this.Wb=""),this.Jb="",this.$b=""}removePartFromView(t){}static EmptyArray=Object.freeze([])}var qe=(x=>(x[x.Solid=1]="Solid",x[x.Linear=2]="Linear",x[x.Radial=3]="Radial",x[x.Pattern=4]="Pattern",x))(qe||{}),Tn=(x=>(x[x.Lab=1]="Lab",x[x.HSL=2]="HSL",x[x.Oklch=3]="Oklch",x))(Tn||{});class fi{n0;n1;n2;n3;constructor(){this.n0=0,this.n1=0,this.n2=0,this.n3=0}}class E{h;H;Na;ei;gs;j0;H0;Eo;q0;cn;_c;Gb;constructor(t,e){if(I.Ki(this),this.h=!1,t===void 0)this.H=1,this.Na="black";else if(typeof t=="string"){let s=f.Uh(qe,t);s!==null?(this.H=s,this.Na="black"):(this.H=1,this.Na=t)}else Object.keys(qe).hasOwnProperty(t)?(this.H=t,this.Na="black"):typeof t=="object"&&(this.H=1,e=t);let i=this.H;if(i===2?(this.ei=D.TopCenter,this.gs=D.BottomCenter):i===3?(this.ei=D.Center,this.gs=D.Center):(this.ei=D.None,this.gs=D.None),this.j0=0,this.H0=NaN,this.Eo=null,this.q0=null,this.cn=null,this._c=0,this.Gb=0,e){let s={};for(let n in e)isFinite(parseFloat(n))?this.addColorStop(parseFloat(n),e[n]):s[n]=e[n];Object.assign(this,s)}}copy(){let t=new E;return t.H=this.H,t.Na=this.Na,t.ei=this.ei.P(),t.gs=this.gs.P(),t.j0=this.j0,t.H0=this.H0,this.Eo!==null&&(t.Eo=this.Eo.copy()),t.q0=this.q0,t}u(){return this.h=!0,this.Eo!==null&&this.Eo.u(),this}oi(t){t in qe?this.type=t:f.er(this,t)}toString(){let t="Brush(";if(this.type===1)t+=this.color;else if(this.type===2?t+="Linear ":this.type===3?t+="Radial ":this.type===4?t+="Pattern ":t+="(unknown) ",t+=this.start+" "+this.end,this.colorStops!==null){let e=this.colorStops.iterator;for(;e.next();){let i=e.key,s=e.value;t+=" "+i+":"+s}}return t+=")",t}addColorStop(t,e){return this.h&&f.L(this),(typeof t!="number"||!isFinite(t)||t>1||t<0)&&f.W(t,"0 <= loc <= 1",E,"addColorStop:loc"),f.s(e,"string",E,"addColorStop:color"),this.Eo===null&&(this.Eo=new pt),this.Eo.set(t,e),this.H===1&&(this.type=2),this.cn=null,this}get type(){return this.H}set type(t){this.h&&f.L(this,t),this.H=t,this.start.isNoSpot()&&(t===2?this.start=D.TopCenter:t===3&&(this.start=D.Center)),this.end.isNoSpot()&&(t===2?this.end=D.BottomCenter:t===3&&(this.end=D.Center)),this.cn=null}get color(){return this.Na}set color(t){this.h&&f.L(this,t),this.Na=t,this.cn=null}get start(){return this.ei}set start(t){this.h&&f.L(this,t),this.ei=t.P(),this.cn=null}get end(){return this.gs}set end(t){this.h&&f.L(this,t),this.gs=t.P(),this.cn=null}get startRadius(){return this.j0}set startRadius(t){this.h&&f.L(this,t),t<0&&f.W(t,">= zero",E,"startRadius"),this.j0=t,this.cn=null}get endRadius(){return this.H0}set endRadius(t){this.h&&f.L(this,t),t<0&&f.W(t,">= zero",E,"endRadius"),this.H0=t,this.cn=null}get colorStops(){return this.Eo}set colorStops(t){this.h&&f.L(this,t),this.Eo=t,this.cn=null}get pattern(){return this.q0}set pattern(t){this.h&&f.L(this,t),this.q0=t,this.cn=null}static randomColor(t,e){t===void 0&&(t=128),e===void 0&&(e=Math.max(t,255));let i=Math.abs(e-t),s=Math.floor(t+Math.random()*i).toString(16),n=Math.floor(t+Math.random()*i).toString(16),o=Math.floor(t+Math.random()*i).toString(16);return s.length<2&&(s="0"+s),n.length<2&&(n="0"+n),o.length<2&&(o="0"+o),"#"+s+n+o}static isValidColor(t){return A.CSS?A.CSS.supports("color",t):!0}static lighten(t){return E.lightenBy(t)}lightenBy(t,e){this.h&&f.L(this);let i=t===void 0||typeof t!="number"?.2:t,s=e===void 0?3:e;if(this.type===1)E.No(this.color),this.color=E.td(i,s);else if((this.type===2||this.type===3)&&this.colorStops!==null){let n=this.colorStops.iterator;for(;n.next();)E.No(n.value),this.addColorStop(n.key,E.td(i,s))}return this}static lightenBy(t,e,i){let s=e===void 0||typeof e!="number"?.2:e,n=i===void 0?3:i;return E.No(t),E.td(s,n)}static darken(t){return E.darkenBy(t)}darkenBy(t,e){this.h&&f.L(this);let i=t===void 0||typeof t!="number"?.2:t,s=e===void 0?3:e;if(this.type===1)E.No(this.color),this.color=E.td(-i,s);else if((this.type===2||this.type===3)&&this.colorStops!==null){let n=this.colorStops.iterator;for(;n.next();)E.No(n.value),this.addColorStop(n.key,E.td(-i,s))}return this}static darkenBy(t,e,i){let s=e===void 0||typeof e!="number"?.2:e,n=i===void 0?3:i;return E.No(t),E.td(-s,n)}static mix(t,e,i){E.No(t);let s=E.Y.n0,n=E.Y.n1,o=E.Y.n2,r=E.Y.n3;E.No(e),i===void 0&&(i=.5);let a=Math.round((E.Y.n0-s)*i+s),h=Math.round((E.Y.n1-n)*i+n),l=Math.round((E.Y.n2-o)*i+o),u=Math.round((E.Y.n3-r)*i+r);return`rgba(${a}, ${h}, ${l}, ${u})`}isDark(){if(this.type===1)return E.isDark(this.color);if((this.type===2||this.type===3)&&this.colorStops!==null){let t=this.colorStops;if(this.type===3)return E.isDark(t.first().value);if(t.get(.5)!==null)return E.isDark(t.get(.5));if(t.count===2){let a=t.toArray();return E.isDark(E.mix(a[0].value,a[1].value))}let e=t.iterator,i=-1,s=-1,n=1,o=1;for(;e.next();){let a=e.key,h=Math.abs(.5-e.key);n>o&&h<n?(i=a,n=h):o>=n&&h<o&&(s=a,o=h)}if(i>s){let a=i;i=s,s=a,a=n,n=o,o=a}let r=s-i;return E.isDark(E.mix(t.get(i),t.get(s),1-o/r))}return!1}static isDark(t){return t?t instanceof E?t.isDark():(E.No(t),(299*E.Y.n0+587*E.Y.n1+114*E.Y.n2)/1e3<128):!1}static td(t,e){switch(e){case 1:return E.lv(),E.Zn.n0=Math.min(100,Math.max(0,E.Zn.n0+100*t)),E.hv(),"rgba("+E.Y.n0+", "+E.Y.n1+", "+E.Y.n2+", "+E.Y.n3+")";case 2:return E.jS(),E.Ii.n2=Math.min(100,Math.max(0,E.Ii.n2+100*t)),"hsla("+E.Ii.n0+", "+E.Ii.n1+"%, "+E.Ii.n2+"%, "+E.Ii.n3+")";case 3:return E.av(),E.Qn.n0=Math.min(100,Math.max(0,E.Qn.n0+100*t)),E.cv(),"rgba("+E.Y.n0+", "+E.Y.n1+", "+E.Y.n2+", "+E.Y.n3+")";default:f.o("Unknown color space: "+e)}}static No(t){E.W0===!1&&(E.W0=!0,E._n=U.isUsingDOM()?new Ue(null,void 0,{willReadFrequently:!0}).li:null);let e=E._n;if(e===null)return;e.clearRect(0,0,1,1),e.fillStyle="#000000";let i=e.fillStyle;if(e.fillStyle=t,e.fillStyle!==i){e.fillRect(0,0,1,1);let s=e.getImageData(0,0,1,1).data;E.Y.n0=s[0],E.Y.n1=s[1],E.Y.n2=s[2],E.Y.n3=s[3]/255}else{e.fillStyle="#FFFFFF";let s=e.fillStyle;e.fillStyle=t,e.fillStyle,E.Y.n0=0,E.Y.n1=0,E.Y.n2=0,E.Y.n3=1}}static jS(){let t=E.Y.n0/255,e=E.Y.n1/255,i=E.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}r*=60,r<0&&(r+=360),a=o/(1-Math.abs(2*h-1))}E.Ii.n0=Math.round(r),E.Ii.n1=Math.round(a*100),E.Ii.n2=Math.round(h*100),E.Ii.n3=E.Y.n3}static DE(){let t=E.Ii.n0,e=E.Ii.n1/100,i=E.Ii.n2/100,s,n,o,r=(1-Math.abs(2*i-1))*e,a=t/60,h=r*(1-Math.abs(a%2-1));a>=0&&a<1?(s=r,n=h,o=0):a>=1&&a<2?(s=h,n=r,o=0):a>=2&&a<3?(s=0,n=r,o=h):a>=3&&a<4?(s=0,n=h,o=r):a>=4&&a<5?(s=h,n=0,o=r):a>=5&&a<6&&(s=r,n=0,o=h);let l=i-.5*r;s+=l,n+=l,o+=l,E.Y.n0=Math.round(s*255),E.Y.n1=Math.round(n*255),E.Y.n2=Math.round(o*255),E.Y.n3=E.Ii.n3}static lv(){E.DA(),E.fv()}static hv(){E.uv(),E.FA()}static F2(t){return t/=255,t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}static R2(t){return t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055}static DA(){let t=E.F2(E.Y.n0),e=E.F2(E.Y.n1),i=E.F2(E.Y.n2);E.Dt.n0=.4124564*t+.3575761*e+.1804375*i,E.Dt.n1=.2126729*t+.7151522*e+.072175*i,E.Dt.n2=.0193339*t+.119192*e+.9503041*i,E.Dt.n3=E.Y.n3}static FA(){let t=3.2404542*E.Dt.n0+-1.5371385*E.Dt.n1+-.4985314*E.Dt.n2,e=-.969266*E.Dt.n0+1.8760108*E.Dt.n1+.041556*E.Dt.n2,i=.0556434*E.Dt.n0+-.2040259*E.Dt.n1+1.0572252*E.Dt.n2;E.Y.n0=E.R2(t)*255,E.Y.n1=E.R2(e)*255,E.Y.n2=E.R2(i)*255,E.Y.n3=E.Dt.n3,E.Y.n0=Math.round(E.Y.n0),E.Y.n0>255?E.Y.n0=255:E.Y.n0<0&&(E.Y.n0=0),E.Y.n1=Math.round(E.Y.n1),E.Y.n1>255?E.Y.n1=255:E.Y.n1<0&&(E.Y.n1=0),E.Y.n2=Math.round(E.Y.n2),E.Y.n2>255?E.Y.n2=255:E.Y.n2<0&&(E.Y.n2=0)}static v2=216/24389;static Zb=24389/27;static ed=[95.047,100,108.883];static O2(t){return t>E.v2?Math.pow(t,1/3):(E.Zb*t+16)/116}static fv(){let t=E.O2(E.Dt.n0*100/E.ed[0]),e=E.O2(E.Dt.n1*100/E.ed[1]),i=E.O2(E.Dt.n2*100/E.ed[2]);E.Zn.n0=116*e-16,E.Zn.n1=500*(t-e),E.Zn.n2=200*(e-i),E.Zn.n3=E.Dt.n3}static RA(t){let e=t*t*t;return e>E.v2?e:(116*t-16)/E.Zb}static uv(){let t=(E.Zn.n0+16)/116,e=E.Zn.n1/500+t,i=t-E.Zn.n2/200;E.Dt.n0=E.ed[0]/100*E.RA(e),E.Dt.n1=E.ed[1]/100*(E.Zn.n0>E.Zb*E.v2?Math.pow(t,3):E.Zn.n0/E.Zb),E.Dt.n2=E.ed[2]/100*E.RA(i),E.Dt.n3=E.Zn.n3}static dv(){let t=.8190224*E.Dt.n0+.3619062*E.Dt.n1+-.1288737*E.Dt.n2,e=.03298366*E.Dt.n0+.9292868*E.Dt.n1+.03614466*E.Dt.n2,i=.04817719*E.Dt.n0+.2642395*E.Dt.n1+.6335478*E.Dt.n2;t=Math.cbrt(t),e=Math.cbrt(e),i=Math.cbrt(i),E.ai.n0=.2104542*t+.7936177*e+-.004072046*i,E.ai.n1=1.977998*t+-2.428592*e+.4505937*i,E.ai.n2=.02590403*t+.7827717*e+-.8086757*i,E.ai.n3=E.Dt.n3,E.ai.n0*=100}static gv(){E.ai.n0/=100;let t=.9999999*E.ai.n0+.3963377*E.ai.n1+.2158037*E.ai.n2,e=1.000000009*E.ai.n0+-.1055613*E.ai.n1+-.06385417*E.ai.n2,i=1.00000005*E.ai.n0+-.08948418*E.ai.n1+-1.291485*E.ai.n2;t=t**3,e=e**3,i=i**3,E.Dt.n0=1.2268798*t+-.5578149*e+.281391*i,E.Dt.n1=-.04057576*t+1.112286*e+-.07171106*i,E.Dt.n2=-.07637294*t+-.4214933*e+1.586924*i,E.Dt.n3=E.ai.n3}static mv(){let t=Math.atan2(E.ai.n2,E.ai.n1)*180/Math.PI;E.Qn.n0=E.ai.n0,E.Qn.n1=Math.sqrt(E.ai.n1**2+E.ai.n2**2),E.Qn.n2=t>=0?t:t+360,E.Qn.n3=E.ai.n3}static pv(){E.ai.n0=E.Qn.n0,E.ai.n1=E.Qn.n1*Math.cos(E.Qn.n2*Math.PI/180),E.ai.n2=E.Qn.n1*Math.sin(E.Qn.n2*Math.PI/180),E.ai.n3=E.Qn.n3}static av(){E.DA(),E.dv(),E.mv()}static cv(){E.pv(),E.gv(),E.FA()}static Qu(t,e){typeof t=="string"||t instanceof E||f.o("Value for "+e+" must be a color string or a Brush, not "+t)}static Solid=1;static Linear=2;static Radial=3;static Pattern=4;static Lab=1;static HSL=2;static _n=null;static W0=!1;static Y=new fi;static Ii=new fi;static Dt=new fi;static Zn=new fi;static ai=new fi;static Qn=new fi}class Ft{St="Base";static es=new pt;static dn(t,e){e.name=t,Ft.es.set(t,e)}get name(){return this.St}set name(t){this.St=t}constructor(){}get classType(){return H}measure(t,e,i,s,n,o,r){}measureElement(t,e,i,s,n){t.ht(e,i,s,n)}arrange(t,e,i){}arrangeElement(t,e,i,s,n,o){t.Bt(e,i,s,n,o)}remeasureObject(t){t.tf()}Ui(t,e,i){}}class sr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=t.Uo();for(let l=0;l<a;l++){let u=s[l];if(!u.visible&&u!==h)continue;let c=u.margin,d=c.right+c.left,g=c.top+c.bottom;u.ht(e,i,o,r);let p=u.measuredBounds,m=Math.max(p.width+d,0),y=Math.max(p.height+g,0),w=u.position.x,b=u.position.y;if(isFinite(w)||(w=0),isFinite(b)||(b=0),u instanceof ut&&u.isGeometryPositioned){let v=u.strokeWidth/2;w-=v,b-=v}n.unionNoCheck(w,b,m,y)}}arrange(t,e,i){let s=e.length,n=t.padding,o=i.x-n.left,r=i.y-n.top;for(let a=0;a<s;a++){let h=e[a],l=h.measuredBounds,u=h.margin,c=h.position.x,d=h.position.y,g=isNaN(c)?-o:c-o,p=isNaN(d)?-r:d-r;if(h instanceof ut&&h.isGeometryPositioned){let m=h.strokeWidth/2;g-=m,p-=m}h.visible&&h.Bt(g+u.left,p+u.top,l.width,l.height)}}}Ft.dn("Position",new sr);class nr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=f.et(),l=t.Uo();for(let c=0;c<a;c++){let d=s[c];if(!d.visible&&d!==l)continue;let g=d.zs(!1);if(g!==0&&g!==5){h.push(d);continue}d.ht(1/0,i,0,r);let p=d.margin,m=d.measuredBounds,y=Math.max(m.width+p.right+p.left,0),w=Math.max(m.height+p.top+p.bottom,0);n.Fn(n.width+y,Math.max(n.height,w))}let 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 g=d.margin,p=g.right+g.left,m=g.top+g.bottom;d.ht(1/0,i,0,r);let y=d.measuredBounds,w=Math.max(y.width+p,0),b=Math.max(y.height+m,0);n.width+=w,n.height=Math.max(n.height,b)}f.J(h)}arrange(t,e,i){let s=e.length,n=t.padding,o=n.top,r=t.isOpposite,a=r?i.width:n.left;for(let h=0;h<s;h++){let l=o,u=e[h];if(!u.visible)continue;let c=u.measuredBounds,d=u.margin,g=d.top+d.bottom,p=o+n.bottom,m=c.height,y=u.zs(!1);(isNaN(u.desiredSize.height)&&y===2||y===4)&&(m=Math.max(i.height-g-p,0));let w=m+g+p,b=u.alignment;b.isDefault()&&(b=t.defaultAlignment),b.isSpot()||(b=D.Center),r&&(a-=c.width+d.left+d.right),u.Bt(a+b.offsetX+d.left,l+b.offsetY+d.top+(i.height*b.y-w*b.y),c.width,m),r||(a+=c.width+d.left+d.right)}}}Ft.dn("Horizontal",new nr);class or extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length,h=f.et(),l=t.Uo();for(let c=0;c<a;c++){let d=s[c];if(!d.visible&&d!==l)continue;let g=d.zs(!1);if(g!==0&&g!==4){h.push(d);continue}d.ht(e,1/0,o,0);let p=d.margin,m=d.measuredBounds,y=Math.max(m.width+p.right+p.left,0),w=Math.max(m.height+p.top+p.bottom,0);n.Fn(Math.max(n.width,y),n.height+w)}let 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 g=d.margin,p=g.right+g.left,m=g.top+g.bottom;d.ht(e,1/0,o,0);let y=d.measuredBounds,w=Math.max(y.width+p,0),b=Math.max(y.height+m,0);n.width=Math.max(n.width,w),n.height+=b}f.J(h)}arrange(t,e,i){let s=e.length,n=t.padding,o=n.left,r=t.isOpposite,a=r?i.height:n.top;for(let h=0;h<s;h++){let l=o,u=e[h];if(!u.visible)continue;let c=u.measuredBounds,d=u.margin,g=d.left+d.right,p=o+n.right,m=c.width,y=u.zs(!1);(isNaN(u.desiredSize.width)&&y===2||y===5)&&(m=Math.max(i.width-g-p,0));let w=m+g+p,b=u.alignment;b.isDefault()&&(b=t.defaultAlignment),b.isSpot()||(b=D.Center),r&&(a-=c.height+d.bottom+d.top),u.Bt(l+b.offsetX+d.left+(i.width*b.x-w*b.x),a+b.offsetY+d.top,m,c.height),r||(a+=c.height+d.bottom+d.top)}}}Ft.dn("Vertical",new or);class es extends Ft{constructor(){super()}static vA=!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,g=l.top+l.bottom;h.ht(e,i,o,r);let p=h.measuredBounds,m=p.width,y=p.height,w=Math.max(m+d,0),b=Math.max(y+g,0),v=t.isClipping;v&&h.y0()!==0&&!es.vA&&(es.vA=!0,f.ni("Main Shape for Spot Panel with isClipping = true must have a zero strokeWidth: "+t.toString()));let k=z.V(-l.left,-l.top,w,b),S=z.V(0,0,m,y);this.I2(h,S,!0),m=S.width,y=S.height;let M=!0,F=t.Uo(),T;for(let N=0;N<a;N++){let C=s[N],R=e,O=i;if(C===h||!C.visible&&C!==F)continue;l=C.margin;let B=l.left,K=l.top;switch(u=l.right+l.left,c=l.top+l.bottom,T=C.zs(!1),T){case 2:R=m,O=y,u=0,c=0,B=0,K=0;break;case 5:R=m,u=0,B=0;break;case 4:O=y,c=0,K=0;break}C.ht(R,O,0,0),p=C.measuredBounds,w=Math.max(p.width+u,0),b=Math.max(p.height+c,0);let Y=C.alignment;Y.isDefault()&&(Y=t.defaultAlignment),Y.isSpot()||(Y=D.Center);let X=C.alignmentFocus;X.isDefault()&&(X=D.Center);let G=null;C instanceof H&&C.to!==""&&(G=C.findObject(C.to),G===C&&(G=null));let nt=S.x-B,at=S.y-K;if(G!==null){C.Bt(0,0,p.width,p.height);let tt=G.actualBounds,st=P.V(tt.x+(X.x*tt.width-X.offsetX),tt.y+(X.y*tt.height-X.offsetY));for(G=G.panel;G!==C;)G.T.gt(st),G=G.panel;nt+=Y.x*m+Y.offsetX-st.x,at+=Y.y*y+Y.offsetY-st.y,P.e(st)}else nt+=Y.x*m+Y.offsetX-(X.x*p.width+X.offsetX),at+=Y.y*y+Y.offsetY-(X.y*p.height+X.offsetY);M?(M=!1,n.i(nt,at,w,b)):n.unionNoCheck(nt,at,w,b)}switch(M?n.a(k):v?n.intersect(S.x,S.y,S.width,S.height):n.unionNoCheck(k.x,k.y,k.width,k.height),z.e(k),z.e(S),T=h.stretch,T===1&&(T=h.zs(!1)),T){case 0:return;case 2:if(!isFinite(e)&&!isFinite(i))return;break;case 5:if(!isFinite(e))return;break;case 4:if(!isFinite(i))return;break}p=h.measuredBounds,m=p.width,y=p.height,w=Math.max(m+d,0),b=Math.max(y+g,0),l=h.margin,S=z.V(-l.left,-l.top,w,b),this.I2(h,S,!0),m=S.width,y=S.height;for(let N=0;N<a;N++){let C=s[N];if(C===h||!C.visible&&C!==F)continue;l=C.margin,u=l.right+l.left,c=l.top+l.bottom,p=C.measuredBounds,w=Math.max(p.width+u,0),b=Math.max(p.height+c,0);let R=C.alignment;R.isDefault()&&(R=t.defaultAlignment),R.isSpot()||(R=D.Center);let O=C.alignmentFocus;O.isDefault()&&(O=D.Center),M?(M=!1,n.i(R.x*m+R.offsetX-(O.x*p.width+O.offsetX)-l.left,R.y*y+R.offsetY-(O.y*p.height+O.offsetY)-l.top,w,b)):n.unionNoCheck(R.x*m+R.offsetX-(O.x*p.width+O.offsetX)-l.left,R.y*y+R.offsetY-(O.y*p.height+O.offsetY)-l.top,w,b)}M?n.a(k):v?n.intersect(S.x,S.y,S.width,S.height):n.unionNoCheck(k.x,k.y,k.width,k.height),z.e(S)}arrange(t,e,i){let s=e.length;if(s===0)return;let n=t.findMainElement(),o=n.measuredBounds,r=o.width,a=o.height,h=t.padding,l=h.left,u=h.top,c=l-i.x,d=u-i.y;n.Bt(c,d,r,a);let g=z.V(0,0,r,a);this.I2(n,g,!1);for(let p=0;p<s;p++){let m=e[p];if(m===n)continue;let y=m.measuredBounds,w=y.width,b=y.height,v=m.alignment;v.isDefault()&&(v=t.defaultAlignment),v.isSpot()||(v=D.Center);let k=m.alignmentFocus;k.isDefault()&&(k=D.Center);let S=null;if(m instanceof H&&m.to!==""&&(S=m.findObject(m.to),S===m&&(S=null)),S!==null){let M=S.actualBounds,F=P.V(M.x+(k.x*M.width-k.offsetX),M.y+(k.y*M.height-k.offsetY));for(S=S.panel;S!==m;)S.T.gt(F),S=S.panel;c=v.x*g.width+v.offsetX-F.x,d=v.y*g.height+v.offsetY-F.y,P.e(F)}else c=v.x*g.width+v.offsetX-(k.x*w+k.offsetX),d=v.y*g.height+v.offsetY-(k.y*b+k.offsetY);c+=g.x-i.x,d+=g.y-i.y,m.visible&&m.Bt(l+c,u+d,w,b)}z.e(g)}I2(t,e,i){let s=null;if(t instanceof H&&t.to!==""&&(s=t.findObject(t.to),s===t&&(s=null)),s!==null)for(i&&t.Bt(0,0,e.width,e.height),e.a(s.actualBounds),s=s.panel;s!==t;)s.T.vg(e),s=s.panel}}Ft.dn("Spot",new es);class rr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length;if(a===0)return;let h=t.findMainElement(),l=h.margin,u=e,c=i,d=l.right+l.left,g=l.top+l.bottom;h.ht(e,i,o,r);let p=h.measuredBounds,m=0,y=null;h instanceof ut&&(y=h,m=y.strokeWidth*y.scale);let w=Math.max(p.width+d,0),b=Math.max(p.height+g,0),v=t.E2(h),k=v.x*w+v.offsetX,S=v.y*b+v.offsetY,M=t.U2(h),F=M.x*w+M.offsetX,T=M.y*b+M.offsetY;isFinite(e)&&(u=Math.max(Math.abs(k-F)-m,0)),isFinite(i)&&(c=Math.max(Math.abs(S-T)-m,0));let N=0,C=0;o>0&&(N=Math.max(Math.abs(v.x*o+v.offsetX-(M.x*o+M.offsetX))-m,0)),r>0&&(C=Math.max(Math.abs(v.y*r+v.offsetY-(M.y*r+M.offsetY))-m,0));let R=Q.l();R.i(0,0);let O=t.Uo();for(let X=0;X<a;X++){let G=s[X];if(G===h||!G.visible&&G!==O)continue;l=G.margin;let nt=l.right+l.left,at=l.top+l.bottom;G.ht(u,c,N,C),p=G.measuredBounds,w=Math.max(p.width+nt,0),b=Math.max(p.height+at,0),R.i(Math.max(w,R.width),Math.max(b,R.height))}if(a===1){p=h.measuredBounds,n.width=w,n.height=b,Q.e(R);return}v=t.E2(h),M=t.U2(h);let B=0,K=0;M.x!==v.x&&M.y!==v.y&&(B=R.width/Math.abs(M.x-v.x),K=R.height/Math.abs(M.y-v.y)),Q.e(R),m=0,y!==null&&(m=y.strokeWidth*y.scale,y.aS()===6&&(B=K=Math.max(B,K))),B+=Math.abs(v.offsetX)+Math.abs(M.offsetX)+m,K+=Math.abs(v.offsetY)+Math.abs(M.offsetY)+m;let Y=h.stretch;switch(Y===1&&(Y=h.zs(!1)),Y){case 0:o=0,r=0;break;case 2:isFinite(e)&&(B=e),isFinite(i)&&(K=i);break;case 5:isFinite(e)&&(B=e),r=0;break;case 4:o=0,isFinite(i)&&(K=i);break}h.tf(),h.ht(B,K,o,r),n.width=h.measuredBounds.width+d,n.height=h.measuredBounds.height+g}arrange(t,e,i){let s=e.length;if(s===0)return;let n=t.findMainElement(),o=n.measuredBounds,r=z.l();r.i(0,0,1,1);let a=n.margin,h=a.left,l=a.top,u=t.padding,c=u.left,d=u.top,g=h,p=l,m=o.width,y=o.height;n.Bt(c+g,d+p,m,y);let w=t.E2(n),b=t.U2(n),v=0+w.x*o.width+w.offsetX,k=0+w.y*o.height+w.offsetY,S=0+b.x*o.width+b.offsetX,M=0+b.y*o.height+b.offsetY;r.x=v,r.y=k,r.unionNoCheck(S,M,0,0),r.x+=h+c,r.y+=l+d;for(let F=0;F<s;F++){let T=e[F];if(T===n)continue;let N=T.measuredBounds;a=T.margin;let C=Math.max(N.width+a.right+a.left,0),R=Math.max(N.height+a.top+a.bottom,0),O=T.alignment;O.isDefault()&&(O=t.defaultAlignment),O.isSpot()||(O=D.Center),g=r.width*O.x+O.offsetX-C*O.x+a.left+r.x,p=r.height*O.y+O.offsetY-R*O.y+a.top+r.y,m=r.width,y=r.height,T.visible&&(z.contains(r.x,r.y,r.width,r.height,g,p,N.width,N.height)?T.Bt(g,p,N.width,N.height):T.Bt(g,p,N.width,N.height,new z(r.x,r.y,r.width,r.height)))}z.e(r)}}Ft.dn("Auto",new rr);class ar extends Ft{constructor(){super(),this.name="Table"}measure(t,e,i,s,n,o,r){let a=s.length,h=f.et(),l=f.et();for(let lt=0;lt<a;lt++){let J=s[lt],mt=J instanceof H?J:null;if(mt!==null&&mt.$r()&&J.visible){l.push(mt);let At=mt.C.r,Qt=At.length;for(let Ht=0;Ht<Qt;Ht++){let Jt=At[Ht];mt.type===H.TableRow?Jt.row=J.row:mt.type===H.TableColumn&&(Jt.column=J.column),h.push(Jt)}}else h.push(J)}a=h.length,a===0&&(t.getRowDefinition(0),t.getColumnDefinition(0));let u=[];for(let lt=0;lt<a;lt++){let J=h[lt];J.visible&&(J.ue(!0),J.Jn(!0),u[J.row]||(u[J.row]=[]),u[J.row][J.column]||(u[J.row][J.column]=[]),u[J.row][J.column].push(J))}f.J(h);let c=f.et(),d=f.et(),g=f.et(),p={count:0},m={count:0},y=e,w=i,b=t.Xe,v=t.Ye,k=null;a=b.length;for(let lt=0;lt<a;lt++)k=b[lt],k!==void 0&&(k.actual=0,k.Ai=0);a=v.length;for(let lt=0;lt<a;lt++)k=v[lt],k!==void 0&&(k.actual=0,k.Ai=0);let S=u.length,M=0;for(let lt=0;lt<S;lt++)u[lt]&&(M=Math.max(M,u[lt].length));let F=Math.min(t.topIndex,S-1),T=Math.min(t.leftIndex,M-1),N=0,C;S=u.length;let R=t.Uo();for(let lt=0;lt<S;lt++){if(!u[lt])continue;M=u[lt].length;let J=t.getRowDefinition(lt);J.actual=0,J.Ai=0;for(let mt=0;mt<M;mt++){if(!u[lt][mt])continue;let At=t.getColumnDefinition(mt);c[mt]===void 0&&(At.actual=0,At.Ai=0,c[mt]=!0);let Qt=u[lt][mt],Ht=Qt.length;for(let Jt=0;Jt<Ht;Jt++){let Zt=Qt[Jt];if(!Zt.visible&&Zt!==R)continue;let Te=Zt.rowSpan>1,ye=Zt.columnSpan>1;(Te||ye)&&!(lt<F)&&!(mt<T)&&d.push(Zt);let ke=Zt.margin,_t=ke.right+ke.left,se=ke.top+ke.bottom;C=Zt.S0(J,At,!1);let Pe=Zt.desiredSize,Ot=!isNaN(Pe.width),Ie=!isNaN(Pe.height);if(C!==0&&!(Ot&&Ie)&&!(lt<F)&&!(mt<T)&&(!ye&&p[mt]===void 0&&(C===2||C===5)&&(p[mt]=-1,p.count++),!Te&&m[lt]===void 0&&(C===2||C===4)&&(m[lt]=-1,m.count++),!Te&&!ye&&g.push(Zt)),Zt.ht(1/0,1/0,0,0),lt<F||mt<T)continue;let ue=Zt.measuredBounds,De=Math.max(ue.width+_t,0),Ye=Math.max(ue.height+se,0);if(Zt.rowSpan===1&&(C===0||C===5)){k=t.getRowDefinition(lt);let Fe=k.computeEffectiveSpacing(),zi=k._===0;N=Math.max(Ye-k.actual,0),N+(zi?Fe:0)>w&&(N=Math.max(w-Fe,0)),k.Ai=k.Ai+N,k.actual=k._+N,w=Math.max(w-(N+(zi?Fe:0)),0)}if(Zt.columnSpan===1&&(C===0||C===4)){k=t.getColumnDefinition(mt);let Fe=k.computeEffectiveSpacing(),zi=k._===0;N=Math.max(De-k.actual,0),N+(zi?Fe:0)>y&&(N=Math.max(y-Fe,0)),k.Ai=k.Ai+N,k.actual=k._+N,y=Math.max(y-(N+(zi?Fe:0)),0)}(Te||ye)&&Zt.tf()}}}f.J(c);let O=0,B=0;a=t.columnCount;for(let lt=0;lt<a;lt++){let J=v[lt];J!==void 0&&(O+=isNaN(J.de)?J.Ai:J.de,J.Ai!==0&&(O+=J.computeEffectiveSpacing()))}a=t.rowCount;for(let lt=0;lt<a;lt++){let J=b[lt];J!==void 0&&(B+=isNaN(J.de)?J.Ai:J.de,J.Ai!==0&&(B+=J.computeEffectiveSpacing()))}y=Math.max(e-O,0),w=Math.max(i-B,0);let K=w,Y=y;a=g.length;for(let lt=0;lt<a;lt++){let J=g[lt],mt=t.getRowDefinition(J.row),At=t.getColumnDefinition(J.column),Qt=J.measuredBounds,Ht=J.margin,Jt=Ht.right+Ht.left,Zt=Ht.top+Ht.bottom;At.Ai===0&&p[J.column]!==void 0?p[J.column]=Math.max(Qt.width+Jt,p[J.column]):p[J.column]=null,mt.Ai===0&&m[J.row]!==void 0?m[J.row]=Math.max(Qt.height+Zt,m[J.row]):m[J.row]=null}let X=0,G=0,nt;for(nt in m)nt!=="count"&&(X+=m[nt]);for(nt in p)nt!=="count"&&(G+=p[nt]);let at=Q.l();for(let lt=0;lt<a;lt++){let J=g[lt];if(!J.visible&&J!==R)continue;let mt=t.getRowDefinition(J.row),At=t.getColumnDefinition(J.column),Qt=0;isFinite(At.width)?Qt=At.width:(isFinite(y)&&p[J.column]!==null?G===0?Qt=At.actual+y:Qt=p[J.column]/G*Y:p[J.column]!==null?Qt=y:Qt=At.actual||y,Qt=Math.max(0,Qt-At.computeEffectiveSpacing()));let Ht=0;switch(isFinite(mt.height)?Ht=mt.height:(isFinite(w)&&m[J.row]!==null?X===0?Ht=mt.actual+w:Ht=m[J.row]/X*K:m[J.row]!==null?Ht=w:Ht=mt.actual||w,Ht=Math.max(0,Ht-mt.computeEffectiveSpacing())),at.i(Math.max(At.minimum,Math.min(Qt,At.maximum)),Math.max(mt.minimum,Math.min(Ht,mt.maximum))),C=J.S0(mt,At,!1),C){case 5:at.height=Math.max(at.height,mt.actual+w);break;case 4:at.width=Math.max(at.width,At.actual+y);break}let Jt=J.margin,Zt=Jt.right+Jt.left,Te=Jt.top+Jt.bottom;J.tf();let ye=At.minimum,ke=mt.minimum,_t=J.measuredBounds;_t.width===0&&p[J.column]!==null&&(ye=Math.max(ye,p[J.column])),_t.height===0&&m[J.row]!==null&&(ke=Math.max(ye,m[J.row])),J.ht(at.width,at.height,ye,ke);let se=J.measuredBounds,Pe=Math.max(se.width+Zt,0),Ot=Math.max(se.height+Te,0);isFinite(y)&&(Pe=Math.min(Pe,at.width)),isFinite(w)&&(Ot=Math.min(Ot,at.height));let Ie=0;Ie=mt.actual,mt.actual=Math.max(mt.actual,Ot),mt.Ai=Math.max(mt.Ai,Ot),N=mt.actual-Ie,w=Math.max(w-N,0),m[J.row]===null&&(K=Math.max(K-N,0)),Ie=At.actual,At.actual=Math.max(At.actual,Pe),At.Ai=Math.max(At.Ai,Pe),N=At.actual-Ie,y=Math.max(y-N,0),p[J.column]===null&&(Y=Math.max(Y-N,0))}f.J(g);let tt=Q.l(),st=f.et(),et=f.et();if(a=d.length,a!==0)for(let lt=0;lt<S;lt++){if(!u[lt])continue;M=u[lt].length;let J=t.getRowDefinition(lt);st[lt]=J.actual;for(let mt=0;mt<M;mt++){if(!u[lt][mt])continue;let At=t.getColumnDefinition(mt);et[mt]=At.actual}}for(let lt=0;lt<a;lt++){let J=d[lt];if(!J.visible&&J!==R)continue;let mt=t.getRowDefinition(J.row),At=t.getColumnDefinition(J.column);switch(at.i(Math.max(At.minimum,Math.min(e,At.maximum)),Math.max(mt.minimum,Math.min(i,mt.maximum))),C=J.S0(mt,At,!1),C){case 2:et[At.index]!==0&&(at.width=Math.min(at.width,et[At.index])),st[mt.index]!==0&&(at.height=Math.min(at.height,st[mt.index]));break;case 5:et[At.index]!==0&&(at.width=Math.min(at.width,et[At.index]));break;case 4:st[mt.index]!==0&&(at.height=Math.min(at.height,st[mt.index]));break}isFinite(At.width)&&(at.width=At.width),isFinite(mt.height)&&(at.height=mt.height),tt.i(0,0);let Qt=At.minimum,Ht=mt.minimum;for(let Ot=1;Ot<J.rowSpan&&!(J.row+Ot>=t.rowCount);Ot++)k=t.getRowDefinition(J.row+Ot),N=0,C===2||C===4?N=Math.max(k.minimum,st[J.row+Ot]===0?k.maximum:Math.min(st[J.row+Ot],k.maximum)):N=Math.max(k.minimum,isNaN(k.de)?k.maximum:Math.min(k.de,k.maximum)),tt.height+=N,Ht+=k.minimum;for(let Ot=1;Ot<J.columnSpan&&!(J.column+Ot>=t.columnCount);Ot++)k=t.getColumnDefinition(J.column+Ot),N=0,C===2||C===5?N=Math.max(k.minimum,et[J.column+Ot]===0?k.maximum:Math.min(et[J.column+Ot],k.maximum)):N=Math.max(k.minimum,isNaN(k.de)?k.maximum:Math.min(k.de,k.maximum)),tt.width+=N,Qt+=k.minimum;at.width+=tt.width,at.height+=tt.height;let Jt=J.margin,Zt=Jt.right+Jt.left,Te=Jt.top+Jt.bottom;J.ht(at.width,at.height,Qt,Ht);let ye=J.measuredBounds,ke=Math.max(ye.width+Zt,0),_t=Math.max(ye.height+Te,0),se=0;for(let Ot=0;Ot<J.rowSpan&&!(J.row+Ot>=t.rowCount);Ot++)k=t.getRowDefinition(J.row+Ot),se+=k.total||0;if(se<_t){let Ot=_t-se,Ie=_t-se;if(J.spanAllocation!==null){let ue=J.spanAllocation;for(let De=0;De<J.rowSpan&&!(Ot<=0||J.row+De>=t.rowCount);De++){k=t.getRowDefinition(J.row+De);let Ye=k._||0,Fe=ue(J,k,Ie);k.actual=Math.min(k.maximum,Ye+Fe),k._!==Ye&&(Ot-=k._-Ye)}}for(;Ot>0;){let ue=k._||0;if(isNaN(k.height)&&k.maximum>ue&&(k.actual=Math.min(k.maximum,ue+Ot),k._!==ue&&(Ot-=k._-ue)),k.index===0)break;k=t.getRowDefinition(k.index-1)}}let Pe=0;for(let Ot=0;Ot<J.columnSpan&&!(J.column+Ot>=t.columnCount);Ot++)k=t.getColumnDefinition(J.column+Ot),Pe+=k.total||0;if(Pe<ke){let Ot=ke-Pe,Ie=ke-Pe;if(J.spanAllocation!==null){let ue=J.spanAllocation;for(let De=0;De<J.columnSpan&&!(Ot<=0||J.column+De>=t.columnCount);De++){k=t.getColumnDefinition(J.column+De);let Ye=k._||0,Fe=ue(J,k,Ie);k.actual=Math.min(k.maximum,Ye+Fe),k._!==Ye&&(Ot-=k._-Ye)}}for(;Ot>0;){let ue=k._||0;if(isNaN(k.width)&&k.maximum>ue&&(k.actual=Math.min(k.maximum,ue+Ot),k._!==ue&&(Ot-=k._-ue)),k.index===0)break;k=t.getColumnDefinition(k.index-1)}}}f.J(d),Q.e(tt),Q.e(at),st!==void 0&&f.J(st),et!==void 0&&f.J(et);let ct=0,gt=0,wt=t.desiredSize,Ct=t.maxSize;C=t.zs(!0),O=0,B=0;let ot=0,Mt=0;a=t.columnCount;for(let lt=0;lt<a;lt++)if(v[lt]!==void 0){if(k=t.getColumnDefinition(lt),isFinite(k.width)){ot+=k.width,ot+=k.computeEffectiveSpacing();continue}else if(k.Qb()===2){ot+=k._,ot+=k.computeEffectiveSpacing();continue}k._!==0&&(O+=k._,O+=k.computeEffectiveSpacing())}isFinite(wt.width)?ct=Math.min(wt.width,Ct.width):C!==0&&isFinite(e)?ct=e:ct=O,ct=Math.max(ct,isFinite(e)?Math.min(o,e):o),ct=Math.max(ct-ot,0);let bt=O===0?1:Math.max(ct/O,1);for(let lt=0;lt<a;lt++)v[lt]!==void 0&&(k=t.getColumnDefinition(lt),!isFinite(k.width)&&k.Qb()!==2&&(k.actual=k._*bt),k.position=n.width,k._!==0&&(n.width+=k._,n.width+=k.computeEffectiveSpacing()));a=t.rowCount;for(let lt=0;lt<a;lt++)if(b[lt]!==void 0){if(k=t.getRowDefinition(lt),isFinite(k.height)){Mt+=k.height,Mt+=k.computeEffectiveSpacing();continue}else if(k.Qb()===2){Mt+=k._,Mt+=k.computeEffectiveSpacing();continue}k._!==0&&(B+=k._,B+=k.computeEffectiveSpacing())}isFinite(wt.height)?gt=Math.min(wt.height,Ct.height):C!==0&&isFinite(i)?gt=i:gt=B,gt=Math.max(gt,isFinite(i)?Math.min(r,i):r),gt=Math.max(gt-Mt,0);let Gt=B===0?1:Math.max(gt/B,1);for(let lt=0;lt<a;lt++)b[lt]!==void 0&&(k=t.getRowDefinition(lt),!isFinite(k.height)&&k.Qb()!==2&&(k.actual=k._*Gt),k.position=n.height,k._!==0&&(n.height+=k._,n.height+=k.computeEffectiveSpacing()));a=l.length;for(let lt=0;lt<a;lt++){let J=l[lt],mt=0,At=0;J.type===H.TableRow?(mt=n.width,k=t.getRowDefinition(J.row),At=k.actual):(k=t.getColumnDefinition(J.column),mt=k.actual,At=n.height),J.measuredBounds.i(0,0,mt,At),J.ue(!1)}f.J(l),t.yh=u}arrange(t,e,i){let s=e.length,n=t.padding,o=n.left,r=n.top,a=t.yh;if(a===null)return;let h=0,l=0,u=a.length,c=0;for(let T=0;T<u;T++)a[T]&&(c=Math.max(c,a[T].length));let d=t.Xe,g=t.Ye,p=0,m=0,y=Math.min(t.topIndex,u-1);if(d.length>0){for(;y!==u&&(d[y]===void 0||d[y]._===0);)y++;y=Math.max(Math.min(y,u-1),0),p=-d[y].position}let w=Math.min(t.leftIndex,c-1);if(g.length>0){for(;w!==c&&(g[w]===void 0||g[w]._===0);)w++;w=Math.max(Math.min(w,c-1),0),m=-g[w].position}let b=0,v=0;for(;b!==u&&d[b]===void 0;)b++;for(;v!==u&&g[v]===void 0;)v++;let k=t.part,S=t.getRowDefinition(b),M=t.getColumnDefinition(v);for(let T=0;T<e.length;T++){let N=e[T];if(!(N instanceof H&&N.visible&&N.$r()))continue;N.type===H.TableRow?(S=t.getRowDefinition(N.row),M=t.getColumnDefinition(v)):(S=t.getRowDefinition(b),M=t.getColumnDefinition(N.column)),l=S.position+p+r,S._!==0&&(l+=S.computeEffectiveSpacingTop(Math.max(b,y))),h=M.position+m+o,M._!==0&&(h+=M.computeEffectiveSpacingTop(Math.max(v,w)));let C=N.measuredBounds;N.$c(),N.actualBounds.Pt();let R=N.actualBounds,O=z.V(R.x,R.y,R.width,R.height);if(R.x=N.type===H.TableRow?o:h,R.y=N.type===H.TableColumn?r:l,R.width=C.width,R.height=C.height,N.actualBounds.u(),N.Jn(!1),O.equalsApproxClose(R)){z.e(O);continue}k!==null&&(k.dh(),N.x0(k)),z.e(O)}let F=Q.l();for(let T=0;T<u;T++){if(!a[T])continue;c=a[T].length;let N=t.getRowDefinition(T);l=N.position+p+r,N._!==0&&(l+=N.computeEffectiveSpacingTop(Math.max(b,y)));for(let C=0;C<c;C++){if(!a[T][C])continue;let R=t.getColumnDefinition(C);h=R.position+m+o,R._!==0&&(h+=R.computeEffectiveSpacingTop(Math.max(v,w)));let O=a[T][C],B=O.length;for(let K=0;K<B;K++){let Y=O[K],X=Y.measuredBounds;F.i(0,0);for(let _t=1;_t<Y.rowSpan&&!(T+_t>=t.rowCount);_t++){let se=t.getRowDefinition(T+_t);se._!==0&&(F.height+=se.total)}for(let _t=1;_t<Y.columnSpan&&!(C+_t>=t.columnCount);_t++){let se=t.getColumnDefinition(C+_t);se._!==0&&(F.width+=se.total)}let G=R._+F.width,nt=N._+F.height,at=h,tt=l,st=G,et=nt,ct=h,gt=l,wt=G,Ct=nt;h+G>i.width&&(wt=Math.max(i.width-h,0)),l+nt>i.height&&(Ct=Math.max(i.height-l,0));let ot=Y.alignment,Mt=0,bt=0,Gt=0,lt=0;if(ot.isDefault()){ot=t.defaultAlignment,ot.isSpot()||(ot=D.Center),Mt=ot.x,bt=ot.y,Gt=ot.offsetX,lt=ot.offsetY;let _t=R.alignment,se=N.alignment;_t.isSpot()&&(Mt=_t.x,Gt=_t.offsetX),se.isSpot()&&(bt=se.y,lt=se.offsetY)}else Mt=ot.x,bt=ot.y,Gt=ot.offsetX,lt=ot.offsetY;(isNaN(Mt)||isNaN(bt))&&(Mt=.5,bt=.5,Gt=0,lt=0);let J=X.width,mt=X.height,At=Y.margin,Qt=At.left+At.right,Ht=At.top+At.bottom,Jt=Y.S0(N,R,!1);isNaN(Y.desiredSize.width)&&(Jt===2||Jt===5)&&(J=Math.max(G-Qt,0)),isNaN(Y.desiredSize.height)&&(Jt===2||Jt===4)&&(mt=Math.max(nt-Ht,0));let Zt=Y.maxSize,Te=Y.minSize;J=Math.min(Zt.width,J),mt=Math.min(Zt.height,mt),J=Math.max(Te.width,J),mt=Math.max(Te.height,mt);let ye=J+Qt,ke=mt+Ht;at+=st*Mt-ye*Mt+Gt+At.left,tt+=et*bt-ke*bt+lt+At.top,Y.visible&&(z.contains(ct,gt,wt,Ct,at,tt,X.width,X.height)?Y.Bt(at,tt,J,mt):Y.Bt(at,tt,J,mt,new z(ct,gt,wt,Ct)))}}}Q.e(F);for(let T=0;T<s;T++){let N=e[T],C=N instanceof H?N:null;if(C!==null&&C.$r()){let R=N.actualBounds;N.naturalBounds.Pt(),N.naturalBounds.i(0,0,R.width,R.height),N.naturalBounds.u()}}}}Ft.dn("Table",new ar);class hr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){}arrange(t,e,i){}}Ft.dn("TableRow",new hr);class lr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){}arrange(t,e,i){}}Ft.dn("TableColumn",new lr);class ur extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){s.length!==1&&f.o("Viewbox Panel must contain exactly one GraphObject.");let a=s[0];a.tt=1,a.tf(),a.ht(1/0,1/0,o,r);let h=a.measuredBounds,l=a.margin,u=l.right+l.left,c=l.top+l.bottom;if(isFinite(e)||isFinite(i)){let d=a.scale,g=h.width,p=h.height,m=Math.max(e-u,0),y=Math.max(i-c,0),w=1;t.viewboxStretch===6?(g!==0&&p!==0&&(w=Math.min(m/g,y/p)),w===0&&(w=1e-4),a.tt*=w):(g!==0&&p!==0&&(w=Math.max(m/g,y/p)),w===0&&(w=1e-4),a.tt*=w),d!==a.scale&&(a.ue(!0),a.ht(1/0,1/0,o,r))}h=a.measuredBounds,n.width=isFinite(e)?e:Math.max(h.width+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=D.Center),s.Bt(i.width*u.x-h*u.x+u.offsetX,i.height*u.y-l*u.y+u.offsetY,n.width,n.height)}}Ft.dn("Viewbox",new ur);class cr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){t.yi===null&&(t.yi=new gi),this.yv(t),this.wv(t)}arrange(t,e,i){}Ui(t,e,i){let s=t.naturalBounds,n=s.width,o=s.height;e.save(),e.beginPath(),e.rect(0,0,n,o),e.clip(),e.endPath(),this.xv(t,e,i),e.restore(),e.clearContextCache(!1)}xv(t,e,i){let s=t.getDocumentScale()*i.scale;s<=0&&(s=1);let n=t.gridCellSize,o=n.width,r=n.height,a=t.naturalBounds,h=t.actualBounds,l=a.width,u=a.height,c=Math.ceil(l/o),d=Math.ceil(u/r),g=t.gridOrigin,p=g.x,m=g.y,y=t.yi.J0,w=t.C.r,b=w.length;for(let v=0;v<b;v++){let k=w[v];if(!k.visible)continue;let S=k.interval||1,M=Math.abs(S);if(o*M*s<2)continue;let F=k.segmentIndex;(!isFinite(F)||isNaN(F))&&(F=0),F<0&&(F=M-Math.min(-F,M)),F=Math.round(F%M);let T=k.opacity,N=1;if(T!==1){if(T===0)continue;N=e.globalAlpha,e.globalAlpha=N*T}let C=y[v],R=!1,O=k.strokeDashArray;if(O!==null&&(R=!0,e.enableDash(O,k.strokeDashOffset)),k.stroke!==null&&k.strokeWidth>0&&(k.figure==="LineV"||k.figure==="LineH")){if(e.lineWidth=k.strokeWidth,t.rn(e,k.stroke,!1,!1,a,h),e.beginPath(),k.figure==="LineV"){let B=Math.floor((p-o)/o);for(let K=B;K<=B+c;K++){let Y=K*o+p;0<=Y&&Y<=l&&this._b(K,S,F,C)&&(e.moveTo(Y,0),e.lineTo(Y,u))}}else if(k.figure==="LineH"){let B=Math.floor((m-r)/r);for(let K=B;K<=B+d;K++){let Y=K*r+m;0<=Y&&Y<=u&&this._b(K,S,F,C)&&(e.moveTo(0,Y),e.lineTo(l,Y))}}e.stroke(),e.endPath()}else if(k.fill!==null){if(t.rn(e,k.fill,!0,!1,a,h),k.figure==="BarV"){let B=k.width;isNaN(B)&&(B=o);let K=Math.floor((p-o)/o);for(let Y=K;Y<=K+c;Y++){let X=Y*o+p;0<=X+B&&X<=l&&this._b(Y,S,F,C)&&e.fillRect(X,0,B,u)}}else if(k.figure==="BarH"){let B=k.height;isNaN(B)&&(B=r);let K=Math.floor((m-r)/r);for(let Y=K;Y<=K+d;Y++){let X=Y*r+m;0<=X+B&&X<=u&&this._b(Y,S,F,C)&&e.fillRect(0,X,l,B)}}}R&&e.disableDash(),T!==1&&(e.globalAlpha=N)}}_b(t,e,i,s){if(e<0)return t%e===i;if(t%e!==i)return!1;let n=s.length;for(let o=0;o<n;o++){let r=s[o];if(t%r===i)return!1}return!0}wv(t){let e=[],i=t.C.r,s=i.length;for(let n=0;n<s;n++){let o=i[n],r=[];if(e.push(r),!o.visible)continue;let a=o.interval;if(a<0)continue;let h=o.figure,l=this.B2(h);for(let u=0;u<s;u++){if(u===n)continue;let c=i[u];if(!c.visible)continue;let d=c.figure;if(this.B2(d)!==l)continue;let g=c.interval;g>a&&r.push(g)}}t.yi.J0=e}B2(t){return t==="LineV"||t==="BarV"}yv(t){let e=1,i=1,s=t.C.r,n=s.length;for(let a=0;a<n;a++){let h=s[a],l=Math.abs(h.interval);l<2||(this.B2(h.figure)?i=i*l/L.DC(i,l):e=e*l/L.DC(e,l))}let o=t.gridCellSize,r=t.yi;r.Yc.isReal()?r.Yc.i(i*o.width,e*o.height):r.Yc=new Q(i*o.width,e*o.height)}}Ft.dn("Grid",new cr);class dr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=s.length;if(!(t instanceof St||t instanceof _))return;let h=null,l=null;if(t instanceof _&&(h=t),t instanceof St&&(l=t,h=l.adornedPart,t.hf===null&&(t.hf=[])),!(h instanceof _))return;let u=h;if(a===0){t.naturalBounds.Fn(0,0),t.measuredBounds.i(0,0,0,0);return}let c=t instanceof St?null:h.path,d=h.routeBounds,g=t.Bo;g.i(0,0,d.width,d.height);let p=u.points,m=h.pointsCount;l!==null?l.sd(!1):h!==null&&h.sd(!1);let y=d.width,w=d.height,b=t.hf;if(b.length=0,c!==null){this.measureLinkPath(t,y,w,c);let M=c.measuredBounds;g.unionRect(M),b.push(M)}let v=Pt.l(),k=P.l(),S=P.l();for(let M=0;M<a;M++){let F=s[M];if(F===c)continue;let T=F.measuredBounds;if(F.isPanelMain&&F instanceof ut){this.measureLinkPath(t,y,w,F),T=F.measuredBounds,g.unionRect(T),b.push(T);continue}if(m<2){F.ht(1/0,1/0,0,0),T=F.measuredBounds,g.unionRect(T),b.push(T);continue}let N=F.segmentIndex,C=F.segmentFraction,R=F.alignmentFocus;R.isNoSpot()&&(R=D.Center);let O=F.segmentOrientation,B=F.segmentOffset,K=0,Y=0,X=0,G=0;if(isNaN(N)){let ot=u.ot,Mt=f.et();ot.getPointAndAngleAlongPath(C,Mt);let bt=P.V(Mt[0],Mt[1]);G=Mt[2],O!==0&&(X=u.computeAngle(F,O,G),F.Yt=X,F.ue(!0),F.Jn(!0)),K=bt.x,Y=bt.y,P.e(bt),f.J(Mt)}else if(N<-m||N>=m){let ot=P.l();u.OA(ot),G=u.midAngle,O!==0&&(X=u.computeAngle(F,O,G),F.Yt=X,F.ue(!0),F.Jn(!0)),K=ot.x-d.x,Y=ot.y-d.y,P.e(ot)}else{let ot,Mt,bt=0;if(N>=0?(ot=p.elt(N),Mt=N<m-1?p.elt(N+1):ot):(bt=m+N,ot=p.elt(bt),Mt=bt>0?p.elt(bt-1):ot),G=0,ot.equalsApprox(Mt)){let Gt,lt;N>=0?(Gt=N>0?p.elt(N-1):ot,lt=N<m-2?p.elt(N+2):Mt):(Gt=bt<m-1?p.elt(bt+1):ot,lt=bt>1?p.elt(bt-2):Mt);let J=Gt.distanceSquaredPoint(ot),mt=Mt.distanceSquaredPoint(lt);J>mt+10?G=N>=0?Gt.directionPoint(ot):ot.directionPoint(Gt):mt>J+10?G=N>=0?Mt.directionPoint(lt):lt.directionPoint(Mt):G=N>=0?Gt.directionPoint(lt):lt.directionPoint(Gt)}else G=N>=0?ot.directionPoint(Mt):Mt.directionPoint(ot);O!==0&&(X=u.computeAngle(F,O,G),F.Yt=X,F.ue(!0),F.Jn(!0)),K=ot.x+(Mt.x-ot.x)*C-d.x,Y=ot.y+(Mt.y-ot.y)*C-d.y}F.ht(1/0,1/0,0,0),T=F.measuredBounds;let nt=F.naturalBounds,at=0;F instanceof ut&&(at=F.strokeWidth);let tt=nt.width+at,st=nt.height+at;v.Ri(),v.Fs(-T.x,-T.y),v.tt(F.scale,F.scale),v.cs(O===0?F.angle:G,tt/2,st/2),(O===22||O===26)&&v.cs(90,tt/2,st/2),(O===23||O===27)&&v.cs(-90,tt/2,st/2),O===28&&(G>45&&G<135||G>225&&G<315)&&v.cs(-G,tt/2,st/2);let et=new z(0,0,tt,st);k.setRectSpot(et,R),v.gt(k);let ct=-k.x+at/2*F.scale,gt=-k.y+at/2*F.scale;S.a(B);let wt=isNaN(B.x),Ct=isNaN(B.y);if(wt||Ct){let ot=tt/2+3,Mt=st/2+3,bt=G>=45&&G<=135,Gt=G>=225&&G<=315;O===0&&(bt||Gt)?(S.x=Ct?ot:B.y,S.y=wt?Mt:B.x,bt?N>=0||isNaN(N)&&C<.5||wt&&(S.y=-Mt):Gt&&((N>=0||isNaN(N)&&C<.5)&&wt&&(S.y=-Mt),Ct&&(S.x=-ot))):(wt&&(N>=0||isNaN(N)&&C<.5?S.x=ot:S.x=-ot),Ct&&(S.y=-Mt),S.rotate(G))}else S.rotate(G);K+=S.x,Y+=S.y,et.i(K+ct,Y+gt,T.width,T.height),b.push(et),g.unionRect(et)}if(h!==null){let M=h.labelNodes;for(;M.next();)M.value.ht(1/0,1/0)}t.Bo=g,t.position.i(d.x+g.x,d.y+g.y),n.Fn(g.width||0,g.height||0),Pt.e(v),P.e(k),P.e(S)}arrange(t,e,i){let s=e.length;if(!(t instanceof St||t instanceof _))return;let n=t,o=null;t instanceof St&&(o=t,n=o.adornedPart);let r=t,a=t instanceof St?null:n.path,h=t.hf;if(h.length!==0){let d=0;if(a!==null&&d<h.length){let g=h[d];d++,a.Bt(g.x-r.Bo.x,g.y-r.Bo.y,g.width,g.height)}for(let g=0;g<s;g++){let p=e[g];if(p!==a&&d<h.length){let m=h[d];d++,p.Bt(m.x-r.Bo.x,m.y-r.Bo.y,m.width,m.height)}}}let l=n.points,u=l.count;if(u>=2&&r instanceof _){let d=r.labelNodes;for(;d.next();){let g=d.value;r.bv(g,u,l)}}o!==null?o.sd(!1):n.sd(!1);let c=t.IA(P.l());t.location.i(t.position.x+c.x,t.position.y+c.y),P.e(c)}measureLinkPath(t,e,i,s){if(s.To()===!1)return;let n=s.strokeWidth;if(n===0&&t instanceof St&&t.type===H.Link&&t.adornedObject instanceof ut&&(n=t.adornedObject.strokeWidth),n=n*s.tt,t instanceof _&&t.ot!==null){let o=t.geometry.bounds;s.Wn(o.x-n/2,o.y-n/2,o.width+n,o.height+n)}else if(t instanceof St&&t.adornedPart.ot!==null){let o=t.adornedPart.ot.bounds;s.Wn(o.x-n/2,o.y-n/2,o.width+n,o.height+n)}else s.Wn(-(n/2),-(n/2),e+n,i+n);s.kv(),s.ue(!1)}}Ft.dn("Link",new dr);class fr extends Ft{constructor(){super()}measure(t,e,i,s,n,o,r){let a=t.findMainElement();t.Ge=[];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,g=c.height,p=Math.max(d+l,0),m=Math.max(g+u,0),y=new z(-h.left,-h.top,p,m);t.Ge.push(y),n.a(y),this.determineGraduatedMarks(t,a);let w=t.xs;if(w===null)return;let b=s.length;for(let v=0;v<b;v++){let k=s[v],S=w[v];!k.visible||k===a||S.length===0||(k instanceof ut?this.measureGraduatedTicks(t,k,S,n):k instanceof xt&&this.measureGraduatedLabels(t,k,S,n),k.ue(!1))}}arrange(t,e,i){if(t.Ge===null)return;let s=t.findMainElement(),n=t.xs;if(n===null)return;let o=t.Ge,r=0,a=o[r];r++,s!==null&&s.Bt(a.x-i.x,a.y-i.y,a.width,a.height);let h=e.length;for(let l=0;l<h;l++){let u=e[l],c=n[l];!u.visible||u===s||c.length===0||(a=o[r],r++,u.Bt(a.x-i.x,a.y-i.y,a.width,a.height))}t.Ge=null}measureGraduatedTicks(t,e,i,s){let n=e.alignmentFocus;n.isNoSpot()&&(n=D.TopCenter);let o=e.angle;e.Yt=0,e.ht(1/0,1/0,0,0),e.Yt=o;let r=e.measuredBounds,a=r.width,h=r.height,l=z.V(0,0,a,h),u=P.l();u.setRectSpot(l,n),z.e(l);let c=-u.x,d=-u.y,g=new z,p=i.length;for(let m=0;m<p;m++){let y=i[m],w=y.pt.x,b=y.pt.y,v=y.angle;for(let k=0;k<4;k++){switch(k){case 0:u.i(c,d);break;case 1:u.i(c+a,d);break;case 2:u.i(c,d+h);break;case 3:u.i(c+a,d+h);break}u.rotate(v+e.angle),u.offset(w,b),m===0&&k===0?g.i(u.x,u.y,0,0):g.unionPoint(u),u.offset(-w,-b),u.rotate(-v-e.angle)}}P.e(u),t.Ge!==null&&t.Ge.push(g),s.unionNoCheck(g.x,g.y,g.width,g.height)}measureGraduatedLabels(t,e,i,s){t.Pe===null&&(t.Pe=new xt);let n=t.Pe;this.EA(e,n);let o=e.alignmentFocus;o.isNoSpot()&&(o=D.TopCenter);let r=e.segmentOrientation,a=e.segmentOffset,h=new z,l=0,u=0,c=0,d=0,g=0,p=i.length;for(let m=0;m<p;m++){let y=i[m];l=y.pt.x,u=y.pt.y,c=y.angle,d=e.angle,g=e.angle,r!==0&&(r===21||r===25?g=c+e.angle:g=c,d=_.computeAngle(r,g)),n.Yt=d,n.text=y.text||"",n.ht(1/0,1/0,0,0);let w=n.measuredBounds,b=n.naturalBounds,v=b.width,k=b.height,S=Pt.l();S.Ri(),S.Fs(-w.x,-w.y),S.tt(n.scale,n.scale),S.cs(g,v/2,k/2),(r===22||r===26)&&S.cs(90,v/2,k/2),(r===23||r===27)&&S.cs(-90,v/2,k/2),r===28&&(c>45&&c<135||c>225&&c<315)&&S.cs(-c,v/2,k/2);let M=z.V(0,0,v,k),F=P.l();F.setRectSpot(M,o),S.gt(F);let T=-F.x,N=-F.y,C=P.l();C.a(a),isNaN(C.x)&&(C.x=v/2+3),isNaN(C.y)&&(C.y=-(k/2+3)),C.rotate(c),l+=C.x+T,u+=C.y+N;let R=new z(l,u,w.width,w.height),O=new z(w.x,w.y,w.width,w.height),B=new z(b.x,b.y,b.width,b.height);y.labelAngle=d,y.lineCount=n.lineCount,y.lines=n.getMetrics(),y.actualBounds=R,y.measuredBounds=O,y.naturalBounds=B,m===0?h.a(R):h.unionRect(R),P.e(C),P.e(F),z.e(M),Pt.e(S)}t.Ge!==null&&t.Ge.push(h),s.unionNoCheck(h.x,h.y,h.width,h.height)}determineGraduatedMarks(t,e){let i=e.geometry,s=e.strokeWidth,n=i.flattenedSegments,o=i.flattenedLengths,r=i.flattenedTotalLength,a=n.length,h=0,l=0,u=f.et();for(let b=0;b<a;b++){let v=n[b],k=[];h=0,l=0;let S=v.length;for(let M=0;M<S;M+=2){let F=v[M],T=v[M+1];if(M===0){h=F,l=T;continue}let N=Math.atan2(T-l,F-h)*180/Math.PI;N<0&&(N+=360),k.push(N),h=F,l=T}u.push(k)}let c=this.Pv(t),d=t.C.r,g=d.length,p=0,m=0,y=r;t.xs=[];let w;for(let b=0;b<g;b++){let v=d[b];if(w=[],!v.visible||v===e){t.xs.push(w);continue}let k=Math.abs(v.interval),S=t.graduatedTickUnit;if(S*k*r/t.graduatedRange<2&&v.graduatedSkip===null){t.xs.push(w);continue}let M=o[0][0],F=0,T=0;m=r*v.graduatedStart-1e-4,y=r*v.graduatedEnd+1e-4;let N=S*k,C=t.graduatedTickBase;if(C<t.graduatedMin){let K=(t.graduatedMin-C)/N;K=K%1===0?K:Math.floor(K+1),C+=K*N}else if(C>t.graduatedMin+N){let K=Math.floor((C-t.graduatedMin)/N);C-=K*N}let R=c[b],O=C,B=t.graduatedMax*1e-6;for(let K=1;C<=t.graduatedMax+B;K++){if(this.Sv(t,C-t.graduatedTickBase,R)&&(C>t.graduatedMax&&(C=t.graduatedMax),(v.graduatedSkip===null||v instanceof xt&&!v.graduatedSkip(C,v)||v instanceof ut&&!v.graduatedSkip(C,v))&&(p=(C-t.graduatedMin)*r/t.graduatedRange,p>r&&(p=r),m<=p&&p<=y))){let Y=u[F][T],X=o[F][T];for(;F<o.length;){for(;p>M&&T<o[F].length-1;)T++,Y=u[F][T],X=o[F][T],M+=X;if(p<=M)break;F++,T=0,Y=u[F][T],X=o[F][T],M+=X}let G=n[F],nt=G[T*2],at=G[T*2+1],tt=G[T*2+2],st=G[T*2+3],et=(p-(M-X))/X,ct=new P(nt+(tt-nt)*et+s/2-i.bounds.x,at+(st-at)*et+s/2-i.bounds.y);if(ct.scale(e.scale,e.scale),Y=this.Mv(Y,et,G,u[F],T),v instanceof xt){let gt="";v.graduatedFunction!==null?(gt=v.graduatedFunction(C,v),gt=gt!=null?gt.toString():""):gt=(+C.toFixed(2)).toString(),gt!==""&&w.push({pt:ct,angle:Y,text:gt})}else w.push({pt:ct,angle:Y})}C=O+K*N}t.xs.push(w)}f.J(u)}Mv(t,e,i,s,n){if(e<.5005&&e>.4995)return t;let o=t;if(e<.5?n>0?o=s[n-1]:L.z(i[0],i[i.length-2])&&L.z(i[1],i[i.length-1])&&(o=s[s.length-1]):e>.5&&(n+1<s.length?o=s[n+1]:L.z(i[0],i[i.length-2])&&L.z(i[1],i[i.length-1])&&(o=s[0])),t!==o){let r=Math.abs(t-o);if(r>180&&(t<o?t+=360:o+=360,r=Math.abs(t-o)),e<5e-4||e>.9995)return(t+o)/2%360;if(r<10){let a=1-Math.abs(.5-e);return(t*a+o*(1-a))%360}}return t}Pv(t){if(t.ss===null){let e=[],i=t.C.r,s=i.length;for(let n=0;n<s;n++){let o=i[n],r=[];if(e.push(r),!o.visible)continue;let a=o.interval;if(!(a<0))for(let h=0;h<s;h++){if(h===n)continue;let l=i[h];if(!l.visible||o.constructor!==l.constructor)continue;let u=l.interval;u>a&&r.push(u)}}t.ss=e}return t.ss}Sv(t,e,i){let s=i.length;for(let n=0;n<s;n++){let o=i[n]*t.graduatedTickUnit,r=e%o,a=t.graduatedTickUnit*1e-6;if(r<a&&r>-a)return!1}return!0}Ui(t,e,i){let s=i.ia;i.ia=!0;let n=t.naturalBounds,o=n.width,r=n.height,a=e instanceof ce;e.save(),e.beginPath(),e.rect(-1,-1,o+1,r+1),e.clip(),e.endPath();let h=t.findMainElement();h.Ui(e,i);let l=t.getDocumentScale()*i.scale;l<=0&&(l=1);let u=h.actualBounds,c=t.C.r,d=t.xs,g=c.length;for(let p=0;p<g;p++){let m=c[p],y=d[p],w=y.length;if(!(!m.visible||m===h||y.length===0)){if(m instanceof ut){if(t.graduatedTickUnit*m.interval*h.geometry.flattenedTotalLength/t.graduatedRange*l<2&&m.graduatedSkip===null)continue;let b=m.measuredBounds,v=m.strokeWidth*m.scale,k=m.alignmentFocus;k.isNoSpot()&&(k=D.TopCenter);for(let S=0;S<w;S++){let M=y[S].pt,F=y[S].angle;this.Nv(m,M,u,F,b,v,k),m.Ui(e,i),a&&(t.svg.appendChild(m.svg),m.svg=null),m.qr.Ri()}}else if(m instanceof xt){t.Pe===null&&(t.Pe=new xt);let b=t.Pe;this.EA(m,b),b.V2=!0;for(let v=0;v<w;v++){let k=y[v];if(k.actualBounds&&k.measuredBounds&&k.naturalBounds){b.Cv(k);let S=k.actualBounds;b.Bt(S.x,S.y,S.width,S.height),this.Lv(b,u,S,k.measuredBounds,k.naturalBounds),b.Jr=m.part,b.Vs=m.panel,b.Ui(e,i),b.Vs=null,b.Jr=null,a&&(t.svg.appendChild(b.svg),b.svg=null)}}}}}i.ia=s,e.restore(),e.clearContextCache(!0)}Nv(t,e,i,s,n,o,r){let a=t.qr;a.Ri(),a.Fs(e.x+i.x,e.y+i.y),a.cs(s+t.angle,0,0),a.Fs(-n.width*r.x+r.offsetX+o/2,-n.height*r.y+r.offsetY+o/2),a.tt(t.scale,t.scale),t.Zu(!1),t.hh.set(t.qr),t.da=t.scale,t.ka(!1)}Lv(t,e,i,s,n){let o=t.qr;o.Ri(),o.Fs(i.x+e.x,i.y+e.y),o.Fs(-s.x,-s.y),t.m0(o,n.x,n.y,n.width,n.height),t.Zu(!1),t.hh.set(t.qr),t.da=t.scale,t.ka(!1)}EA(t,e){e.Av(t)}}Ft.dn("Graduated",new fr);var Dn=(x=>(x[x.Uniform=6]="Uniform",x[x.UniformToFill=7]="UniformToFill",x))(Dn||{});class H extends dt{H;C;Zt;nd;Bn;Qr;to;Bo;z2;F;od;st;yi;_t;rd;wh;Gs;constructor(t,e){if(super(),this.H=null,t===void 0)this.H=H.Position;else if(typeof t=="string"){let i=Ft.es.get(t);i!==null&&(this.H=i)}else t instanceof Ft?this.H=t:t&&(this.H=H.Position,e=t);this.H===null&&f.o("Panel type not specified or PanelLayout not loaded: "+t),this.n|=4194304|(this.H===H.Grid?1048576:0),this.C=new j,this.Zt=Lt.Rg,this.nd=D.Default,this.Bn=1,this.Qr=null,this.to="",this.Bo=new z(NaN,NaN,NaN,NaN),this.z2=null,this.F=null,this.od=6,this.yi=null,this.st=null,this._t=null,this.rd=NaN,this.wh=null,this.Gs=null,e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.H=this.H,t.Zt=this.Zt.P(),t.nd=this.nd.P(),t.Bn=this.Bn,t.to=this.to,t.Bo.a(this.Bo),this.F!==null&&(t.F=this.F.copy(t)),t.od=this.od,this.st!==null&&(t.st=this.st.copy()),this.yi!==null&&(t.yi=this.yi.copy()),t._t=this._t,t.rd=this.rd,t.wh=this.wh}vo(t){super.vo(t),t.C=this.C;let e=t.C.r,i=e.length;for(let s=0;s<i;s++){let n=e[s];n.Vs=t}t.Qr=null}copy(){let t=super.copy();if(t!==null){let e=this.C.r,i=e.length;for(let s=0;s<i;s++){let n=e[s].copy();t.Tv(n)}return t}else return null}toString(){return"Panel("+this.type.name+")#"+I.as(this)}get type(){return this.H}set type(t){let e=this.H;e!==t&&(this.H=t,this.af=this.H===H.Grid,this.c(),this.t("type",e,t))}get elements(){return this.C.iterator}get naturalBounds(){return this.zi}get padding(){return this.Zt}set padding(t){typeof t=="number"?(t<0&&f.W(t,">= 0",H,"padding"),t=new Lt(t)):(t.left<0&&f.W(t.left,">= 0",H,"padding:value.left"),t.right<0&&f.W(t.right,">= 0",H,"padding:value.right"),t.top<0&&f.W(t.top,">= 0",H,"padding:value.top"),t.bottom<0&&f.W(t.bottom,">= 0",H,"padding:value.bottom"));let e=this.Zt;e.equals(t)||(t=t.P(),this.Zt=t,this.c(),this.t("padding",e,t))}get defaultAlignment(){return this.nd}set defaultAlignment(t){let e=this.nd;e.equals(t)||(t=t.P(),this.nd=t,this.c(),this.t("defaultAlignment",e,t))}get defaultStretch(){return this.Bn}set defaultStretch(t){let e=this.Bn;e!==t&&(this.Bn=t,this.c(),this.t("defaultStretch",e,t))}get defaultSeparatorPadding(){return this.F!==null?this.F.$0:Lt.Rg}set defaultSeparatorPadding(t){typeof t=="number"&&(t=new Lt(t));let e=this.defaultSeparatorPadding;e.equals(t)||(t=t.P(),this.F===null&&(this.F=new le),this.F.$0=t,this.c(),this.t("defaultSeparatorPadding",e,t))}get defaultRowSeparatorStroke(){return this.F!==null?this.F.Z0:null}set defaultRowSeparatorStroke(t){let e=this.defaultRowSeparatorStroke;e!==t&&(t===null||typeof t=="string"||t instanceof E)&&(t instanceof E&&t.u(),this.F===null&&(this.F=new le),this.F.Z0=t,this.S(),this.t("defaultRowSeparatorStroke",e,t))}get defaultRowSeparatorStrokeWidth(){return this.F!==null?this.F.Q0:1}set defaultRowSeparatorStrokeWidth(t){let e=this.defaultRowSeparatorStrokeWidth;e!==t&&isFinite(t)&&t>=0&&(this.F===null&&(this.F=new le),this.F.Q0=t,this.c(),this.t("defaultRowSeparatorStrokeWidth",e,t))}get defaultRowSeparatorDashArray(){return this.F!==null?this.F._0:null}set defaultRowSeparatorDashArray(t){let e=this.defaultRowSeparatorDashArray;if(e!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",H,"defaultRowSeparatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&f.o("defaultRowSeparatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.F===null&&(this.F=new le),this.F._0=t,this.S(),this.t("defaultRowSeparatorDashArray",e,t)}}get defaultColumnSeparatorStroke(){return this.F!==null?this.F.tp:null}set defaultColumnSeparatorStroke(t){let e=this.defaultColumnSeparatorStroke;e!==t&&(t===null||typeof t=="string"||t instanceof E)&&(t instanceof E&&t.u(),this.F===null&&(this.F=new le),this.F.tp=t,this.S(),this.t("defaultColumnSeparatorStroke",e,t))}get defaultColumnSeparatorStrokeWidth(){return this.F!==null?this.F.ip:1}set defaultColumnSeparatorStrokeWidth(t){let e=this.defaultColumnSeparatorStrokeWidth;e!==t&&isFinite(t)&&t>=0&&(this.F===null&&(this.F=new le),this.F.ip=t,this.c(),this.t("defaultColumnSeparatorStrokeWidth",e,t))}get defaultColumnSeparatorDashArray(){return this.F!==null?this.F.ep:null}set defaultColumnSeparatorDashArray(t){let e=this.defaultColumnSeparatorDashArray;if(e!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",H,"defaultColumnSeparatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&f.o("defaultColumnSeparatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.F===null&&(this.F=new le),this.F.ep=t,this.S(),this.t("defaultColumnSeparatorDashArray",e,t)}}get yh(){return this.F!==null?this.F.yh:null}set yh(t){this.F===null&&(this.F=new le),this.F.yh=t}get viewboxStretch(){return this.od}set viewboxStretch(t){let e=this.od;e!==t&&(this.od=t,this.c(),this.t("viewboxStretch",e,t))}get gridCellSize(){return this.yi!==null?this.yi.ld:Q.wC}set gridCellSize(t){this.yi===null&&(this.yi=new gi);let e=this.yi.ld;if(!e.equals(t)){(!t.isReal()||t.width===0||t.height===0)&&f.o("Invalid Panel.gridCellSize: "+t),this.yi.ld=t.P();let i=this.diagram;i!==null&&this===i.grid&&i.th(),this.S(),this.t("gridCellSize",e,t)}}get gridOrigin(){return this.yi!==null?this.yi.hd:P.xo}set gridOrigin(t){this.yi===null&&(this.yi=new gi);let e=this.yi.hd;if(!e.equals(t)){t.isReal()||f.o("Invalid Panel.gridOrigin: "+t),this.yi.hd=t.P();let i=this.diagram;i!==null&&this===i.grid&&i.th(),this.S(),this.t("gridOrigin",e,t)}}get graduatedMin(){return this.st!==null?this.st.sp:0}set graduatedMin(t){let e=this.graduatedMin;if(e!==t&&(this.st===null&&(this.st=new Re),this.st.sp=t,this.c(),this.t("graduatedMin",e,t),this.Wc())){let i=this.part;i!==null&&this.ba(i,"graduatedRange")}}get graduatedMax(){return this.st!==null?this.st.np:100}set graduatedMax(t){let e=this.graduatedMax;if(e!==t&&(this.st===null&&(this.st=new Re),this.st.np=t,this.c(),this.t("graduatedMax",e,t),this.Wc())){let i=this.part;i!==null&&this.ba(i,"graduatedRange")}}get graduatedRange(){return this.graduatedMax-this.graduatedMin}get graduatedTickUnit(){return this.st!==null?this.st.op:10}set graduatedTickUnit(t){let e=this.graduatedTickUnit;e!==t&&t>0&&(this.st===null&&(this.st=new Re),this.st.op=t,this.c(),this.t("graduatedTickUnit",e,t))}get graduatedTickBase(){return this.st!==null?this.st.rp:0}set graduatedTickBase(t){let e=this.graduatedTickBase;e!==t&&(this.st===null&&(this.st=new Re),this.st.rp=t,this.c(),this.t("graduatedTickBase",e,t))}get xs(){return this.st!==null?this.st.xs:null}set xs(t){this.st!==null?this.st.xs=t:t!==null&&(this.st=new Re,this.st.xs=t)}get Ge(){return this.st!==null?this.st.Ge:null}set Ge(t){this.st!==null?this.st.Ge=t:t!==null&&(this.st=new Re,this.st.Ge=t)}get ss(){return this.st!==null?this.st.ss:null}set ss(t){this.st!==null?this.st.ss=t:t!==null&&(this.st=new Re,this.st.ss=t)}get Pe(){return this.st!==null?this.st.Pe:null}set Pe(t){this.st!==null?this.st.Pe=t:t!==null&&(this.st=new Re,this.st.Pe=t)}x0(t){super.x0(t);let e=this.C.r,i=e.length;for(let s=0;s<i;s++)e[s].x0(t)}gh(t,e){if(this.H===H.Grid){t.commitTransform(),this.H.Ui(this,t,e);return}if(this.H===H.Graduated){t.commitTransform(),this.H.Ui(this,t,e);return}if(this.H===H.Table)if(t.commitTransform(),t instanceof ce){let r=t.currentElement;t.currentElement=t.newGroup2("gojs-ts"),this.X2(t,e),t.endGroup(),t.currentElement=r}else this.X2(t,e);let i=this.isClipping&&this.H===H.Spot;i&&t.save();let s=this.findMainElement(),n=this.C.r,o=n.length;for(let r=0;r<o;r++){let a=n[r];i&&a===s&&(t.clipInsteadOfFill=!0),a.Ui(t,e),i&&a===s&&(t.clipInsteadOfFill=!1)}i&&(t.restore(),t.clearContextCache(!0))}X2(t,e){t.lineCap="butt";let i=this.rowCount>0?this.Xe:null,s=this.columnCount>0?this.Ye:null;i!==null&&this.t1(t,e,!0,i,!0),s!==null&&this.t1(t,e,!1,s,!0),i!==null&&this.UA(t,!0,i),s!==null&&this.UA(t,!1,s),i!==null&&this.t1(t,e,!0,i,!1),s!==null&&this.t1(t,e,!1,s,!1)}UA(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.rn(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 g=h.position+l;e?g>o.height&&(l-=g-o.height):g>o.width&&(l-=g-o.width);let p=h.position+l/2;t.lineWidth=l;let m=this.Zt;if(e){p+=m.top;let y=m.left,w=o.width-m.right;t.moveTo(y,p),t.lineTo(w,p)}else{p+=m.left;let y=m.top,w=o.height-m.bottom;t.moveTo(p,y),t.lineTo(p,w)}t.stroke(),t.endPath(),c&&t.disableDash()}}t1(t,e,i,s,n){let o=s.length,r=this.actualBounds,a=this.naturalBounds,h=this.BA(!0),l=this.BA(!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 g=c.computeEffectiveSpacing(),p=c.separatorStrokeWidth;isNaN(p)&&(p=i?this.defaultRowSeparatorStrokeWidth:this.defaultColumnSeparatorStrokeWidth);let m=c.separatorStroke;m===null&&(m=i?this.defaultRowSeparatorStroke:this.defaultColumnSeparatorStroke),(m===null||c.index===(i?h:l))&&(p=0),g-=p;let y=c.position+p,w=g+c.actual;if(y+w>d&&(w=d-y),w<=0)continue;let b=this.Zt;this.rn(t,c.background,!0,!1,a,r),i?t.fillRect(b.left,y+b.top,r.width-(b.left+b.right),w):t.fillRect(y+b.left,b.top,w,r.height-(b.top+b.bottom))}}BA(t){let e=t?this.rowCount:this.columnCount;for(let i=0;i<e;i++){let s=t?this.Xe[i]:this.Ye[i];if(s!==void 0)return s.index}return 0}Qc(){let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].Qc();this.Ve(!0)}Zc(t,e,i){let s=this.svg;if(s===null)return!1;if(this.type===H.Table){let r=s.getElementsByClassName("gojs-ts"),a=r.length!==0?r[0]:null;a!==null&&(a.innerHTML=""),t.currentElement=a,this.X2(t,e),t.currentElement=null}else{if(this.H===H.Grid||this.H===H.Graduated)return s.innerHTML="",s.remove(),!1;if(this.H===H.Spot&&this.isClipping)return s.innerHTML="",s.remove(),this.ah=null,this.Qc(),!1}if(!super.Zc(t,e,i))return!1;let n=this.C.r,o=n.length;for(let r=0;r<o;r++)n[r].Ui(t,e);return!0}$u(t){return!0}k0(t,e,i,s){if(!this.isClipping){if(this.Xs()&&t.partClipRect!==null){let n=t.partClipRect,o=this.C.r,r=0,a=0;for(let h=0;h<o.length;h++){if(!o[h].isVisibleObject())continue;let l=o[h].actualBounds;r=h===0?l.x:Math.min(l.x,r),a=h===0?l.y:Math.min(l.y,a)}s.setAttributeNS(null,"clip-path",`path('M ${n.x-i.x-r},${n.y-i.y-a} l ${n.width} 0 l 0 ${n.height} l -${n.width} 0 z')`);return}super.k0(t,e,i,s)}}Jc(t,e,i,s,n){let o=this.an(),r=this.T,a=1/(r.m11*r.m22-r.m12*r.m21),h=r.m22*a,l=-r.m12*a,u=-r.m21*a,c=r.m11*a,d=a*(r.m21*r.dy-r.m22*r.dx),g=a*(r.m12*r.dx-r.m11*r.dy);if(this.background!==null){let p=t*h+e*u+d,m=t*l+e*c+g,y=i*h+s*u+d,w=i*l+s*c+g;n.i(0,0);let b=this.naturalBounds,v=L.gl(0,0,b.width,b.height,p,m,y,w,n);return n.T(r),v}else{o||(h=1,l=0,u=0,c=1,d=0,g=0);let p=t*h+e*u+d,m=t*l+e*c+g,y=i*h+s*u+d,w=i*l+s*c+g;n.i(y,w);let b=(y-p)**2+(w-m)**2,v=!1,k=this.C.r,S=k.length,M=P.l(),F=null,T=1/0,N=null,C=this.isClipping&&this.H===H.Spot;C&&(N=P.l(),F=this.findMainElement(),v=F.Jc(p,m,y,w,N),v&&(T=(p-N.x)**2+(m-N.y)**2));for(let R=0;R<S;R++){let O=k[R];if(!O.visible||O===F||!O.Jc(p,m,y,w,M))continue;v=!0;let B=(p-M.x)**2+(m-M.y)**2;B<b&&(b=B,n.set(M))}return C&&(T>b&&n.set(N),P.e(N)),P.e(M),o&&n.T(r),v}}Au(){let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].Au();super.Au()}c(t){if(this.To())return;super.c(t);let e=null;(this.H===H.Auto||this.H===H.Link)&&(e=this.findMainElement());let i=this.C.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];if((o===e||o.isPanelMain)&&o.c(!0),o.desiredSize.isReal())continue;let r=o.zs(!1);!(o instanceof ve)&&!(o instanceof H)&&!(o instanceof xt)&&r===0||o.c(!0)}}tf(){if(this.To())return;this.ue(!0),this.Jn(!0);let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].tf()}$c(){if(this.Kb()===!1){this.Zu(!0),this.ka(!0);let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].P2()}}P2(){this.ka(!0);let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].P2()}Wu(t,e,i,s){let n=this.Bo;n.i(0,0,0,0);let o=this.desiredSize,r=this.minSize;i===void 0&&(i=r.width,s=r.height),i=Math.max(i,r.width),s=Math.max(s,r.height);let a=this.maxSize;isNaN(o.width)||(t=Math.min(o.width,a.width)),isNaN(o.height)||(e=Math.min(o.height,a.height)),t=Math.max(i,t),e=Math.max(s,e);let h=this.Zt;t=Math.max(t-h.left-h.right,0),e=Math.max(e-h.top-h.bottom,0);let l=this.C.r;this.H.measure(this,t,e,l,n,i,s);let 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.Fn(u,c),this.naturalBounds.Fn(u,c),this.Wn(0,0,u,c)}findMainElement(){if(this.Qr===null){let t=this.C.r,e=t.length;if(e===0)return null;for(let i=0;i<e;i++){let s=t[i];if(s.isPanelMain===!0)return this.Qr=s,s}this.Qr=t[0]}return this.Qr}Uo(){return this.part!==null?this.part.locationObject:null}get panelLayoutState(){return this.z2}set panelLayoutState(t){this.z2=t}uh(t,e,i,s){let n=this.C.r;if(this.actualBounds.i(t,e,i,s),!this.desiredSize.isReal()){let o=this.zs(!0),r=this.measuredBounds,a=r.width,h=r.height,l=this.Wr,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.c(),this.ht(a>i?i:a,h>s?s:h,0,0));break;case 2:this.c(!0),this.ht(i+u,s+c,0,0);break;case 5:this.c(!0),this.ht(i+u,h+c,0,0);break;case 4:this.c(!0),this.ht(a+u,s+c,0,0);break}}this.H.arrange(this,n,this.Bo)}fh(t){let e=this.naturalBounds,i=this.Uo();if(z.contains(0,0,e.width,e.height,t.x,t.y)){let s=this.C.r,n=s.length,o=P.V(0,0);for(let r=n;r--;){let a=s[r];if(!(!a.visible&&a!==i)&&(o.set(t).Oe(a.T),a.containsPoint(o)))return P.e(o),!0}return P.e(o),this.Lt!==null}return!1}g0(t){if(this.Hn===t)return this;let e=this.C.r,i=e.length;for(let s=0;s<i;s++){let n=e[s].g0(t);if(n!==null)return n}return null}walkVisualTreeFrom(t,e){if(e(this,t),t instanceof H){let i=t.C.r,s=i.length;for(let n=0;n<s;n++)this.walkVisualTreeFrom(i[n],e)}}Gr(t){this.VA(this,t)}VA(t,e){e(t);let i=t.C.r,s=i.length;for(let n=0;n<s;n++){let o=i[n];o instanceof H&&this.VA(o,e)}}Dv(t){this.zA(this,t)}zA(t,e){if(e(t),t instanceof H){let i=t.C.r,s=i.length;for(let n=0;n<s;n++)this.zA(i[n],e)}}findInVisualTree(t){return this.XA(this,t)}XA(t,e){if(e(t))return t;if(t instanceof H){let i=t.C.r,s=i.length;for(let n=0;n<s;n++){let o=this.XA(i[n],e);if(o!==null)return o}}return null}findObject(t){if(this.name===t)return this;let e=this.C.r,i=e.length;this.Fv()&&(i=this.lp());for(let s=0;s<i;s++){let n=e[s];if(n instanceof H){let o=n.findObject(t);if(o!==null)return o}if(n.name===t)return n}return null}YA(){let t=this.C.r,e=t.length,i=0;for(let s=0;s<e;s++){let n=t[s];n instanceof H?i=Math.max(i,n.YA()):n instanceof ut&&(i=Math.max(i,n.Rv()))}return i}an(){return!(this.type===H.TableRow||this.type===H.TableColumn)}$r(){return this.type===H.TableRow||this.type===H.TableColumn}bL(t,e,i){if(this.pickable===!1||(e===void 0&&(e=null),i===void 0&&(i=null),this._e()))return null;let s=this.naturalBounds,n=1/this.getDocumentScale(),o=this.an(),r=o?t:P.V(t.x,t.y).Oe(this.T),a=this.diagram,h=10,l=5;if(a!==null&&(h=a.getInputOption("extraTouchArea"),l=h/2),z.contains(-(l*n),-(l*n),s.width+h*n,s.height+h*n,r.x,r.y)){if(!this.af){let c=this.C.r,d=c.length,g=P.l(),p=this.isClipping&&this.H===H.Spot,m=p?this.findMainElement():null;if(p&&(m.an()?g.set(t).Oe(m.T):g.set(t),!m.containsPoint(g)))return P.e(g),o||P.e(r),null;let y=this.Uo();for(let w=d;w--;){let b=c[w];if(!b.visible&&b!==y||(b.an()?g.set(t).Oe(b.T):g.set(t),p&&b===m))continue;let v=null;if(b instanceof H?v=b.bL(g,e,i):b.pickable===!0&&b.containsPoint(g)&&(v=b),v!==null&&(e!==null&&(v=e(v)),v!==null&&(i===null||i(v))))return P.e(g),o||P.e(r),v}P.e(g)}if(this.background===null)return o||P.e(r),null;let u=z.contains(0,0,s.width,s.height,r.x,r.y)?this:null;return o||P.e(r),u}return o||P.e(r),null}kL(t,e,i,s){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);let n=this.naturalBounds,o=this.an(),r=o?t:P.V(t.x,t.y).Oe(this.T),a=this.$r(),h=z.contains(0,0,n.width,n.height,r.x,r.y);if(a||h){if(!this.af){let l=this.C.r,u=l.length,c=P.l(),d=this.Uo();for(let g=u;g--;){let p=l[g];if(!p.visible&&p!==d)continue;p.an()?c.set(t).Oe(p.T):c.set(t);let m=p,y=p instanceof H?p:null;if(y!==null?y.kL(c,e,i,s):m.containsPoint(c)){if(m.pickable===!1)continue;e!==null&&(m=e(m)),m!==null&&(i===null||i(m))&&s.add(m)}}P.e(c)}return o||P.e(r),h&&this.background!==null}return o||P.e(r),!1}Tm(t,e,i,s,n,o){if(this.pickable===!1)return!1;e===void 0&&(e=null),i===void 0&&(i=null);let r=o;if(r===void 0&&(r=Pt.l(),r.Ri()),r.nc(this.T),this.containedInRect(t,r))return this.Y2(e,i,n),o===void 0&&Pt.e(r),!0;if(this.intersectsRect(t,r)){if(!this.af){let a=this.Uo(),h=this.C.r,l=h.length;for(let u=l;u--;){let c=h[u];if(!c.visible&&c!==a)continue;let d=c.actualBounds,g=this.naturalBounds;if(d.x>g.width||d.y>g.height||d.x+d.width<0||d.y+d.height<0)continue;let p=c,m=c instanceof H?c:null,y=Pt.l();y.set(r),(m!==null?m.Tm(t,e,i,s,n,y):p.wA(t,s,y))&&(e!==null&&(p=e(p)),p!==null&&(i===null||i(p))&&n.add(p)),Pt.e(y)}}return o===void 0&&Pt.e(r),s}return o===void 0&&Pt.e(r),!1}Y2(t,e,i){let s=this.C.r,n=s.length;for(let o=n;o--;){let r=s[o];if(!r.visible)continue;let a=r.actualBounds,h=this.naturalBounds;if(a.x>h.width||a.y>h.height||a.x+a.width<0||a.y+a.height<0)continue;r instanceof H&&r.Y2(t,e,i);let l=r;t!==null&&(l=t(l)),l!==null&&(e===null||e(l))&&i.add(l)}}PL(t,e,i,s,n,o){if(this.pickable===!1)return!1;i===void 0&&(i=null),s===void 0&&(s=null);let r=this.naturalBounds,a=this.an(),h=a?t:P.V(t.x,t.y).Oe(this.T),l=a?e:P.V(e.x,e.y).Oe(this.T),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.e(h),P.e(l)),c){if(!this.af){let g=P.l(),p=P.l(),m=this.Uo(),y=this.C.r,w=y.length;for(let b=w;b--;){let v=y[b];if(!v.visible&&v!==m)continue;let k=v.actualBounds,S=this.naturalBounds;if(a&&(k.x>S.width||k.y>S.height||k.x+k.width<0||k.y+k.height<0))continue;if(v.an()){let T=v.T;g.set(t).Oe(T),p.set(e).Oe(T)}else g.set(t),p.set(e);let M=v,F=v instanceof H?v:null;(F!==null?F.PL(g,p,i,s,n,o):M.xA(g,p,n))&&(i!==null&&(M=i(M)),M!==null&&(s===null||s(M))&&o.add(M))}P.e(g),P.e(p)}return n?c:d}return!1}E2(t){let e=null;if(t instanceof ut){e=t.spot1,e===D.Default&&(e=null);let i=t.geometry;i!==null&&e===null&&(e=i.spot1)}return e===null&&(e=D.TopLeft),e}U2(t){let e=null;if(t instanceof ut){e=t.spot2,e===D.Default&&(e=null);let i=t.geometry;i!==null&&e===null&&(e=i.spot2)}return e===null&&(e=D.BottomRight),e}add(...t){for(let e=0;e<t.length;e++)this.insertAt(this.C.count,t[e]);return this}elt(t){return this.C.elt(t)}insertAt(t,e){e instanceof Nt&&f.o("Cannot add a Part to a Panel: "+e+"; use a Panel instead"),(this===e||this.isContainedBy(e))&&(this===e&&f.o("Cannot make a Panel contain itself: "+this.toString()),f.o("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+e.toString()));let i=e.panel;if(i!==null&&i!==this&&f.o("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+e.toString()+", already contained by "+i.toString()+", cannot be shared by this Panel: "+this.toString()),this.H===H.Grid&&!(e instanceof ut)&&f.o("Can only add Shapes to a Grid Panel, not: "+e),this.H===H.Graduated&&!(e instanceof ut||e instanceof xt)&&f.o("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+e),e.Pa(this),e.Jr=null,this.itemArray!==null){let r=e.data;f.G(r)&&(this.Gs===null&&(this.Gs=new pt),this.Gs.set(r,e))}let s=this.C,n=-1;if(i===this){let r=-1,a=this.C.r,h=a.length;for(let l=0;l<h;l++)if(a[l]===e){r=l;break}if(r!==-1){if(r===t||r+1>=s.count&&t>=s.count)return;s.removeAt(r),n=r}else f.o("element "+e.toString()+" has panel "+i.toString()+" but is not contained by it.")}(t<0||t>s.count)&&(t=s.count),s.insertAt(t,e),(t===0||e.isPanelMain)&&(this.Qr=null),this.To()||this.c(),e.c(!1),e.portId!==null?this.fn=!0:e instanceof H&&e.fn===!0&&(this.fn=!0),this.ss=null,this.isEnabledObject()||this.i1(e,!1);let o=this.part;if(o!==null){o.A0(),o.cf(),this.fn&&o instanceof rt&&(o.fn=!0),o.fn&&o instanceof rt&&(o.ne=null);let r=this.diagram;if(r!==null&&r.undoManager.isUndoingRedoing)return;n!==-1&&o.raiseChangedEvent(4,"elements",this,e,null,n,null),o.raiseChangedEvent(3,"elements",this,null,e,null,t)}}get fn(){return(this.n&8388608)!==0}set fn(t){(this.n&8388608)!==0!==t&&(this.n=this.n^8388608)}p2(){return(this.n&16777216)!==0}G2(t){t?this.n|=16777216:this.n&=-16777217}Tv(t){t.Pa(this),t.Jr=null;let e=this.C,i=e.count;e.insertAt(i,t);let s=this.part;if(s!==null){s.A0(),t.portId!==null&&s instanceof rt&&(s.fn=!0);let n=this.diagram;if(n!==null&&n.undoManager.isUndoingRedoing)return;s.raiseChangedEvent(3,"elements",this,null,t,null,i)}}ZR(t){let e=this.C.r,i=e.length,s=-1;for(let n=0;n<i;n++)if(e[n]===t){s=n;break}return s}remove(t){let e=this.C.r,i=e.length,s=-1;for(let n=0;n<i;n++)if(e[n]===t){s=n;break}s!==-1&&this.te(s,!0)}removeAt(t){t>=0&&this.te(t,!0)}te(t,e){let i=this.C,s=i.elt(t);if(s.Jr=null,s.Pa(null),this.Gs!==null){let o=s.data;f.G(o)&&this.Gs.delete(o)}i.removeAt(t),this.ue(!1),this.c(),this.Qr===s&&(this.Qr=null),this.ss=null;let n=this.part;if(n!==null){n.A0(),n.cf(),n.invalidateAdornments(),n instanceof rt&&(s instanceof H?s.walkVisualTreeFrom(s,(r,a)=>n.C2(a,e)):n.C2(s,e));let o=this.diagram;if(o!==null&&o.undoManager.isUndoingRedoing)return;n.raiseChangedEvent(4,"elements",this,s,null,t,null)}}get Xe(){return this.F===null&&(this.F=new le),this.F.Xe}get rowCount(){return this.F===null?0:this.Xe.length}getRowDefinition(t){t<0&&f.W(t,">= 0",H,"getRowDefinition:idx"),t=Math.round(t);let e=this.Xe;if(e[t]===void 0){let i=new jt;i.Pa(this),i.isRow=!0,i.index=t,e[t]=i,this.raiseChangedEvent(3,"rowdefs",this,null,i,null,t)}return e[t]}removeRowDefinition(t){if(t<0&&f.W(t,">= 0",H,"removeRowDefinition:idx"),this.rowCount===0)return;t=Math.round(t);let e=this.Xe,i=e[t];if(i){e[t]=void 0;let s=e.length-1;for(;s>=0&&e[s--]===void 0;)e.length--;this.raiseChangedEvent(4,"rowdefs",this,i,null,t,null),this.c()}}$L(t,e){let i=this.Xe;if(!(t<0)){if(i[t]=e instanceof jt?e:void 0,!e){let s=i.length-1;for(;s>=0&&i[s--]===void 0;)i.length--}this.c()}}get Ye(){return this.F===null&&(this.F=new le),this.F.Ye}get columnCount(){return this.F===null?0:this.Ye.length}getColumnDefinition(t){t<0&&f.W(t,">= 0",H,"getColumnDefinition:idx"),t=Math.round(t);let e=this.Ye;if(e[t]===void 0){let i=new jt;i.Pa(this),i.isRow=!1,i.index=t,e[t]=i,this.raiseChangedEvent(3,"coldefs",this,null,i,null,t)}return e[t]}removeColumnDefinition(t){if(t<0&&f.W(t,">= 0",H,"removeColumnDefinition:idx"),this.columnCount===0)return;t=Math.round(t);let e=this.Ye,i=e[t];if(i){e[t]=void 0;let s=e.length-1;for(;s>=0&&e[s--]===void 0;)e.length--;this.raiseChangedEvent(4,"coldefs",this,i,null,t,null),this.c()}}ZL(t,e){let i=this.Ye;if(!(t<0)){if(i[t]=e instanceof jt?e:void 0,!e){let s=i.length-1;for(;s>=0&&i[s--]===void 0;)i.length--}this.c()}}addRowColumnDefinition(t){let e=null;return t.isRow?e=this.getRowDefinition(t.index):t.isRow||(e=this.getColumnDefinition(t.index)),e&&e.Hb(t),this}addRowDefinition(t,e){let i=this.getRowDefinition(t);return i&&i.Hb(new jt(e)),this}addColumnDefinition(t,e){let i=this.getColumnDefinition(t);return i&&i.Hb(new jt(e)),this}get rowSizing(){return this.F!==null?this.F.hp:3}set rowSizing(t){let e=this.rowSizing;e!==t&&(this.F===null&&(this.F=new le),this.F.hp=t,this.c(),this.t("rowSizing",e,t))}get columnSizing(){return this.F!==null?this.F.ap:3}set columnSizing(t){let e=this.columnSizing;e!==t&&(this.F===null&&(this.F=new le),this.F.ap=t,this.c(),this.t("columnSizing",e,t))}get topIndex(){return this.F!==null?this.F.cp:0}set topIndex(t){let e=this.topIndex;e!==t&&((!isFinite(t)||t<0)&&f.o("Panel.topIndex must be greater than zero and a real number, not: "+t),this.F===null&&(this.F=new le),this.F.cp=t,this.c(),this.t("topIndex",e,t))}get leftIndex(){return this.F!==null?this.F.fp:0}set leftIndex(t){let e=this.leftIndex;e!==t&&((!isFinite(t)||t<0)&&f.o("Panel.leftIndex must be greater than zero and a real number, not: "+t),this.F===null&&(this.F=new le),this.F.fp=t,this.c(),this.t("leftIndex",e,t))}findRowForLocalY(t){if(t<0||this.type!==H.Table||this.rowCount===0)return-1;let e=0,i=this.Xe,s=i.length,n=this.topIndex;for(;n<s;n++){let o=i[n];if(o!==void 0&&(e+=o.total,t<e))return n}return n}findColumnForLocalX(t){if(t<0||this.type!==H.Table||this.columnCount===0)return-1;let e=0,i=this.Ye,s=i.length,n=this.leftIndex;for(;n<s;n++){let o=i[n];if(o!==void 0&&(e+=o.total,t<e))return n}return n}graduatedPointForValue(t,e){if(e===void 0&&(e=new P(NaN,NaN)),this.type!==H.Graduated)return e.i(NaN,NaN),e;t=Math.min(Math.max(t,this.graduatedMin),this.graduatedMax);let i=this.findMainElement();return i.geometry.getPointAlongPath((t-this.graduatedMin)/this.graduatedRange,e),i.T.gt(e)}graduatedValueForPoint(t){if(this.type!==H.Graduated)return NaN;let e=this.findMainElement();return e.T.$e(t),e.geometry.getFractionForPoint(t)*this.graduatedRange+this.graduatedMin}get data(){return this._t}set data(t){let e=this._t;if(e!==t){let i=this instanceof Nt&&!(this instanceof St);i&&f.s(t,"object",H,"data"),this.Et(),this._t=t;let s=this.diagram;if(s!==null)if(i)s.partManager.vv(this,e,t);else{let n=this.panel;n!==null&&n.Gs!==null&&(e!==null&&n.Gs.delete(e),t!==null&&n.Gs.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 Ys(){return this.p!==null?this.p.Ys:null}set Ys(t){this.Ci!==t&&(this.p===null&&(this.p=new oi),this.p.Ys=t)}L2(){return this.Ys!==null}AA(){let t=this.Ys;return t!==null&&t.h}freezeBindings(){return this.Et()}Et(){let t=this.Ys;if(t===null)this.data!==null&&f.o("Template cannot have .data be non-null: "+this),this.Ys=t=new j;else if(t.h)return this;let e=new j;this.G2(!1),this.walkVisualTreeFrom(this,(n,o)=>{o.ch();let r=o.Ci;if(r!==null){o.S2(!1);let a=r.iterator;for(;a.next();){let h=a.value;h.mode===2&&o.S2(!0);let l=h.sourceName;if(h.isToObject){l==="/"&&n.G2(!0);let u=h.yA(n,o);u!==null&&(e.add(u),u.qn===null&&(u.qn=new j),u.qn.add(h))}t.add(h)}}if(o instanceof H&&o.type===H.Table){if(o.rowCount>0){let a=o.Xe,h=a.length;for(let l=0;l<h;l++){let u=a[l];if(u!==void 0&&u.bs!==null){let c=u.bs.iterator;for(;c.next();){let d=c.value;d.be=u,d.ad=2,d.ff=u.index,t.add(d)}}}}if(o.columnCount>0){let a=o.Ye,h=a.length;for(let l=0;l<h;l++){let u=a[l];if(u!==void 0&&u.bs!==null){let c=u.bs.iterator;for(;c.next();){let d=c.value;d.be=u,d.ad=1,d.ff=u.index,t.add(d)}}}}}});let i=e.iterator;for(;i.next();){let n=i.value;if(n.qn!==null){n.S2(!0);let o=n.qn.iterator;for(;o.next();){let r=o.value;n.Ci===null&&(n.Ci=new j),n.Ci.add(r)}}n.qn=null}let s=t.iterator;for(;s.next();){let n=s.value,o=n.be;if(o!==null){n.be=null;let r=n.targetProperty,a=r.indexOf(".");if(a>0&&o instanceof H){let h=r.substring(0,a),l=r.substring(a+1),u=o.findObject(h);u!==null?(o=u,n.targetProperty=l):(f.ni('Warning: unable to find GraphObject named "'+h+'" for Binding: '+n.toString()),o=null)}if(o instanceof jt){let h=I.as(o.panel);n.targetId=h===void 0?-1:h,o.panel.Hn=n.targetId}else if(o instanceof dt){let h=I.as(o);n.targetId=h===void 0?-1:h,o.Hn=n.targetId}else f.o("Unknown type of binding target: "+o);n.check(o)}}return t.u(),this instanceof Nt&&this.ke()&&this.ensureBounds(),this}static FE=!1;copyTemplate(t){t===void 0&&(t=!1);let e=this.copy();return e.Dv(i=>{i instanceof H&&(i.Ys=null,i._t=null);let s=i.Ci;s!==null&&(i.Ci=null,s.each(o=>i.bind(o.copy())));let n=i.ws;n!==null&&(i.ws=null,n.each(o=>i.trigger(o.value.copy())))}),t&&e.Et(),e}updateTargetBindings(t){let e=this.Ys;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.GA(n,t);if(o===null)continue;let{data:r,elt:a}=o;n.isToTheme&&this.diagram===null||a!==void 0&&n.updateTarget(a,r,void 0,i)}}Do(){if(this.diagram!==null)if(this.L2()){let t=this.diagram.model,e=this.Ys.iterator;for(;e.next();){let i=e.value;if(!i.isToTheme)continue;let s=this.GA(i);if(s===null)continue;let{data:n,elt:o}=s;o!==void 0&&i.updateTarget(o,n,void 0,t)}}else{let t=this.C.r,e=t.length;for(let i=0;i<e;i++)t[i].Do()}}GA(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.pA(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.g0(a),r===null)return null}else t.be!==null&&(r=t.be);o==="/"?n=r.part:o==="."?n=r:o===".."&&(n=r.panel);let h=t.ad;if(h!==0){if(!(r instanceof H))return null;h===1?r=r.getColumnDefinition(t.ff):h===2&&(r=r.getRowDefinition(t.ff))}return{data:n,elt:r}}get itemArray(){return this.wh}set itemArray(t){let e=this.wh;if(e!==t||t!==null&&this.Ov(t)){let i=this.diagram;if(e!==t&&(i!==null&&e!==null&&i.partManager.EM(this,i),this.wh=t,i!==null&&t!==null&&i.partManager.IM(this,i)),this.t("itemArray",e,t),i!==null&&i.undoManager.isUndoingRedoing)return;this.KA(e,t)}}findItemPanelForData(t){return t==null||this.Gs===null?null:(f.ec(t,H,"findItemPanelForData"),this.Gs.get(t))}Ov(t){let e=this.C.r,i=e.length,s=t.length,n=0,o=null;for(;n<i&&(o=e[n],!(o instanceof H)||o.data===null);)n++,o=e[n];if(i-n!==s)return!0;if(o===null)return s>0;let r=0;for(;n<i&&r<s;){if(o=e[n],!(o instanceof H)||o.data!==t[r])return!0;n++,r++}return!1}lp(){if(this.type===H.Spot||this.type===H.Auto)return Math.min(this.C.length,1);if(this.type===H.Link){let t=this.C,e=t.length,i=0;for(;i<e;i++){let s=t.elt(i);if(!(s instanceof ut)||!s.isPanelMain)return i}return i}if(this.type===H.Table&&this.C.length>0){let t=this.C.elt(0);if(t.isPanelMain&&t instanceof H&&t.$r())return 1}return 0}rebuildItemElements(){let t=this.lp();for(;this.C.length>t;)this.te(this.C.length-1,!1);this.KA(null,this.itemArray)}KA(t,e){let i=this.lp(),s=e;if(s===null||s.length===0){for(;this.C.length>i;)this.te(this.C.length-1,!1);return}if(this.C.length<=i){let n=s.length;for(let o=0;o<n;o++)this.e1(s[o],o,!0)}else{let n=i;for(let r=0;r<s.length;r++,n++){let a=s[r],h=n<this.C.length?this.C.elt(n):null;if(h instanceof H){if(h.data!==a){let l=this.K2(h.data,r),u=this.K2(a,r),c=u!==l;if(!c){let d=this.j2(h.data,r,l);c=this.j2(a,r,u)!==d}c?(this.te(n,!1),this.e1(a,r,!1)):h.data=a}}else this.e1(a,r,!1)}for(;n<this.C.length;)this.te(n,!1);this.Qr=null,this.H2(i,0),this.To()||this.c(),this.ss=null,this.isEnabledObject()||this.i1(this,!1);let o=this.part;o!==null&&(o.A0(),o.cf(),this.fn&&o instanceof rt&&(o.fn=!0),o.fn&&o instanceof rt&&(o.ne=null))}}e1(t,e,i){if(t==null||e<0)return null;let s=this.K2(t,e),n=this.j2(t,e,s);if(n!==null){n.Et();let o=n.copy();if(o.p2()){let a=this.findBindingPanel();a!==null&&a.G2(!0)}f.G(t)&&(this.Gs===null&&(this.Gs=new pt),this.Gs.set(t,o));let r=e+this.lp();return this.insertAt(r,o),i&&(o._t=t,this.H2(r,e),o._t=null),o.data=t,o}return null}Iv(t){if(t<0)return;let e=t+this.lp();this.te(e,!0),this.H2(e,t)}H2(t,e){let i=this.C,s=t,n=e;for(;s<i.length;){let o=i.elt(s);o instanceof H&&o.Ev(s,n),s++,n++}}Ev(t,e){this.type===H.TableRow?this.row=t:this.type===H.TableColumn&&(this.column=t),this.itemIndex=e}Fv(){return this.wh!==null||this.itemTemplateMap!==null}get itemTemplate(){return this.itemTemplateMap===null?null:this.itemTemplateMap.get("")}set itemTemplate(t){if(this.itemTemplateMap===null){if(t===null)return;this.itemTemplateMap=new pt}let e=this.itemTemplateMap.get("");if(e!==t){(t instanceof Nt||t.isPanelMain)&&f.o("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+t),this.itemTemplateMap.set("",t),this.t("itemTemplate",e,t);let i=this.diagram;if(i!==null&&i.undoManager.isUndoingRedoing)return;this.rebuildItemElements()}}get itemTemplateMap(){return this.p!==null?this.p.G0:null}set itemTemplateMap(t){let e=this.itemTemplateMap;if(e!==t){let i=t.iterator;for(;i.next();){let n=i.value}this.Kt().G0=t,this.t("itemTemplateMap",e,t);let s=this.diagram;if(s!==null&&s.undoManager.isUndoingRedoing)return;this.rebuildItemElements()}}get itemCategoryProperty(){return this.p!==null?this.p.K0:"category"}set itemCategoryProperty(t){let e=this.itemCategoryProperty;e!==t&&(typeof t!="string"&&!f.it(t)&&f.Zi(t,"string or function",H,"itemCategoryProperty"),this.Kt().K0=t,this.t("itemCategoryProperty",e,t))}K2(t,e){if(t===null)return"";let i=this.itemCategoryProperty,s="";if(f.it(i))s=i(t);else if(typeof i=="string"&&f.G(t)){if(i==="")return"";let n=this.diagram,o=n!==null?n.model:null;o?s=o.yt(t,i):s=yt.yt(t,i)}else return"";if(s===void 0)return"";if(typeof s=="string")return s;f.o("Panel.getCategoryForItemData found a non-string category for "+t+": "+s)}static jA=!1;static HA=null;j2(t,e,i){let s=this.itemTemplateMap,n=null;return s!==null&&(n=s.get(i)),n===null&&(s!==null&&(n=s.get("")),n===null&&(H.jA||(H.jA=!0,f.ni('No item template Panel found for category "'+i+'" on '+this),f.ni(" Using default item template."),H.HA=new H().add(new xt().bind("text","",f.toString).theme("stroke","text"))),n=H.HA)),n}get af(){return(this.n&1048576)!==0}set af(t){let e=(this.n&1048576)!==0;e!==t&&(f.s(t,"boolean",H,"isAtomic"),this.n=this.n^1048576,this.t("isAtomic",e,t))}get isClipping(){return(this.n&2097152)!==0}set isClipping(t){let e=(this.n&2097152)!==0;e!==t&&(this.Qc(),this.n=this.n^2097152,this instanceof ft&&(this.si=null),this.c(),this.t("isClipping",e,t))}get isOpposite(){return(this.n&33554432)!==0}set isOpposite(t){let e=(this.n&33554432)!==0;e!==t&&(this.n=this.n^33554432,this.c(),this.t("isOpposite",e,t))}get isEnabled(){return(this.n&4194304)!==0}set isEnabled(t){let e=(this.n&4194304)!==0;if(e!==t){let i=this.panel===null||this.panel.isEnabledObject();this.n=this.n^4194304,this.t("isEnabled",e,t);let s=this.diagram;if(s!==null&&s.undoManager.isUndoingRedoing)return;i&&this.i1(this,t)}}i1(t,e){let i=t.enabledChanged;if(i!==null&&i(t,e),t instanceof H){let s=t.C.r,n=s.length;for(let o=0;o<n;o++){let r=s[o];e&&r instanceof H&&!r.isEnabled||this.i1(r,e)}}}get alignmentFocusName(){return this.to}set alignmentFocusName(t){let e=this.to;e!==t&&(this.to=t,this.c(),this.t("alignmentFocusName",e,t))}static definePanelLayout(t,e){Ft.dn(t,e)}static isBuilderDefined(t){return Ft.es.has(t)}static Position=Ft.es.get("Position");static Horizontal=Ft.es.get("Horizontal");static Vertical=Ft.es.get("Vertical");static Spot=Ft.es.get("Spot");static Auto=Ft.es.get("Auto");static Table=Ft.es.get("Table");static Viewbox=Ft.es.get("Viewbox");static TableRow=Ft.es.get("TableRow");static TableColumn=Ft.es.get("TableColumn");static Link=Ft.es.get("Link");static Grid=Ft.es.get("Grid");static Graduated=Ft.es.get("Graduated")}H.definePanelLayout=H.definePanelLayout;class Re{sp;np;op;rp;xs;Ge;ss;Pe;constructor(){this.sp=0,this.np=100,this.op=10,this.rp=0,this.xs=null,this.Ge=null,this.ss=null,this.Pe=null}copy(){let t=new Re;return t.sp=this.sp,t.np=this.np,t.op=this.op,t.rp=this.rp,t.xs=this.xs,t.Ge=this.Ge,t.ss=this.ss,t.Pe=this.Pe,t}}class gi{ld;hd;Yc;J0;constructor(){this.ld=Q.wC,this.hd=P.xo,this.Yc=Q.ww,this.J0=[]}copy(){let t=new gi;return t.ld=this.ld.copy(),t.hd=this.hd.copy(),t.Yc=this.Yc.copy(),t.J0=this.J0,t}}class le{Xe;Ye;hp;ap;cp;fp;$0;Q0;Z0;_0;ip;tp;ep;yh;constructor(){this.Xe=[],this.Ye=[],this.hp=3,this.ap=3,this.cp=0,this.fp=0,this.$0=Lt.Rg,this.Q0=1,this.Z0=null,this._0=null,this.ip=1,this.tp=null,this.ep=null,this.yh=null}copy(t){let e=new le,i=this.Xe,s=i.length,n=e.Xe;for(let h=0;h<s;h++){if(i[h]===void 0)continue;let l=i[h].copy();l.Pa(t),n[h]=l}let o=this.Ye,r=o.length,a=e.Ye;for(let h=0;h<r;h++){if(o[h]===void 0)continue;let l=o[h].copy();l.Pa(t),a[h]=l}return e.hp=this.hp,e.ap=this.ap,e.cp=this.cp,e.fp=this.fp,e.$0=this.$0.P(),e.Q0=this.Q0,e.Z0=this.Z0,e._0=this._0,e.ip=this.ip,e.tp=this.tp,e.ep=this.ep,e.yh=this.yh,e}}var vs=(x=>(x[x.Default=1]="Default",x[x.None=2]="None",x[x.ProportionalExtra=3]="ProportionalExtra",x))(vs||{});class jt{Vs;dp;At;Ca;La;hi;at;cd;$n;_r;fd;ud;Aa;Lt;dd;bs;_;Ai;de;constructor(t){I.Ki(this),this.Vs=null,this.dp=!0,this.At=0,this.de=NaN,this.Ca=0,this.La=1/0,this.hi=D.Default,this._=0,this.Ai=0,this.at=0,this.bs=null,this.cd=1,this.$n=1,this._r=null,this.fd=null,this.ud=NaN,this.Aa=null,this.Lt=null,this.dd=!1,t&&(Object.assign(this,t),t.column!==void 0?(this.isRow=!1,this.index=t.column):t.row!==void 0&&(this.isRow=!0,this.index=t.row))}copy(){let t=new jt;return t.dp=this.dp,t.At=this.At,t.de=this.de,t.Ca=this.Ca,t.La=this.La,t.hi=this.hi,t._=this._,t.Ai=this.Ai,t.at=this.at,t.$n=this.$n,t.cd=this.cd,this._r===null?t._r=null:t._r=this._r.P(),t.fd=this.fd,t.ud=this.ud,t.Aa=null,this.Aa!==null&&(t.separatorDashArray=this.Aa.slice()),t.Lt=this.Lt,t.dd=this.dd,t.bs=this.bs,t}Hb(t){t.isRow?t.height!==void 0&&(this.height=t.height):t.width!==void 0&&(this.width=t.width),t.minimum!==void 0&&(this.minimum=t.minimum),t.maximum!==void 0&&(this.maximum=t.maximum),t.alignment!==void 0&&(this.alignment=t.alignment),t.stretch!==void 0&&(this.stretch=t.stretch),t.sizing!==void 0&&(this.sizing=t.sizing),t.separatorPadding!==void 0&&(this.separatorPadding=t.separatorPadding),t.separatorStroke!==void 0&&(this.separatorStroke=t.separatorStroke),t.separatorStrokeWidth!==void 0&&(this.separatorStrokeWidth=t.separatorStrokeWidth),t.separatorDashArray!==void 0&&(this.Aa=t.separatorDashArray),t.background!==void 0&&(this.background=t.background),t.coversSeparators!==void 0&&(this.coversSeparators=t.coversSeparators),t.bs!==void 0&&(this.bs=t.bs)}oi(t){t in vs?this.sizing=t:f.er(this,t)}toString(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+I.as(this)}static Default=1;static None=2;static ProportionalExtra=3;Pa(t){this.Vs=t}computeEffectiveSpacingTop(t){let e=0,i=this.Vs;if(this.index!==t){let n=this.separatorStroke;n===null&&i!==null&&(n=this.isRow?i.defaultRowSeparatorStroke:i.defaultColumnSeparatorStroke),n!==null&&(e=this.separatorStrokeWidth,isNaN(e)&&(i!==null?e=this.isRow?i.defaultRowSeparatorStrokeWidth:i.defaultColumnSeparatorStrokeWidth:e=0))}let s=this._r;if(s===null)if(i!==null)s=i.defaultSeparatorPadding;else return e;return e+(this.isRow?s.top:s.left)}computeEffectiveSpacing(){let t=0,e=this.Vs,i=0,s=this.isRow;if(e!==null&&e.type===H.Table){let o=s?e.Xe.length:e.Ye.length;for(let r=0;r<o;r++){let a=s?e.Xe[r]:e.Ye[r];if(a!==void 0&&a._!==0){i=a.index;break}}}if(this.index!==i){let o=this.separatorStroke;o===null&&e!==null&&(o=s?e.defaultRowSeparatorStroke:e.defaultColumnSeparatorStroke),o!==null&&(t=this.separatorStrokeWidth,isNaN(t)&&(e!==null?t=s?e.defaultRowSeparatorStrokeWidth:e.defaultColumnSeparatorStrokeWidth:t=0))}let n=this._r;if(n===null)if(e!==null)n=e.defaultSeparatorPadding;else return t;return t+(this.isRow?n.top+n.bottom:n.left+n.right)}t(t,e,i,s,n){let o=this.Vs;if(o!==null&&(o.raiseChangedEvent(2,t,this,e,i,s,n),this.bs!==null)){let r=o.diagram;if(r!==null&&!r.fe){let a=o.findBindingPanel();if(a!==null){let h=a.data;if(h!==null){let l=this.bs.iterator;for(;l.next();)l.value.updateSource(this,h,t,a)}}}}}get panel(){return this.Vs}get isRow(){return this.dp}set isRow(t){this.dp=t}get index(){return this.At}set index(t){this.At=t}get height(){return this.de}set height(t){let e=this.de;e!==t&&(t<0&&f.W(t,">= 0",jt,"height"),this.de=t,this.actual=this._,this.panel!==null&&this.panel.c(),this.t("height",e,t))}get width(){return this.de}set width(t){let e=this.de;e!==t&&(t<0&&f.W(t,">= 0",jt,"width"),this.de=t,this.actual=this._,this.panel!==null&&this.panel.c(),this.t("width",e,t))}get minimum(){return this.Ca}set minimum(t){let e=this.Ca;e!==t&&((t<0||!isFinite(t))&&f.W(t,">= 0",jt,"minimum"),this.Ca=t,this.actual=this._,this.panel!==null&&this.panel.c(),this.t("minimum",e,t))}get maximum(){return this.La}set maximum(t){let e=this.La;e!==t&&(t<0&&f.W(t,">= 0",jt,"maximum"),this.La=t,this.actual=this._,this.panel!==null&&this.panel.c(),this.t("maximum",e,t))}get alignment(){return this.hi}set alignment(t){let e=this.hi;e.equals(t)||(this.hi=t.P(),this.panel!==null&&this.panel.c(),this.t("alignment",e,t))}get stretch(){return this.$n}set stretch(t){let e=this.$n;e!==t&&(this.$n=t,this.panel!==null&&this.panel.c(),this.t("stretch",e,t))}get separatorPadding(){return this._r}set separatorPadding(t){typeof t=="number"&&(t=new Lt(t));let e=this._r;(t===null||e===null||!e.equals(t))&&(t!==null&&(t=t.P()),this._r=t,this.panel!==null&&this.panel.c(),this.t("separatorPadding",e,t))}get separatorStroke(){return this.fd}set separatorStroke(t){let e=this.fd;e!==t&&(t!==null&&E.Qu(t,"RowColumnDefinition.separatorStroke"),t instanceof E&&t.u(),this.fd=t,this.panel!==null&&this.panel.c(),this.t("separatorStroke",e,t))}get separatorStrokeWidth(){return this.ud}set separatorStrokeWidth(t){let e=this.ud;e!==t&&(this.ud=t,this.panel!==null&&this.panel.c(),this.t("separatorStrokeWidth",e,t))}get separatorDashArray(){return this.Aa}set separatorDashArray(t){let e=this.Aa;if(e!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",jt,"separatorDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(typeof o!="number"||!(o>=0)||!isFinite(o))&&f.o("separatorDashArray value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.Aa=t,this.panel!==null&&this.panel.S(),this.t("separatorDashArray",e,t)}}get background(){return this.Lt}set background(t){let e=this.Lt;e!==t&&(t!==null&&E.Qu(t,"RowColumnDefinition.background"),t instanceof E&&t.u(),this.Lt=t,this.panel!==null&&this.panel.S(),this.t("background",e,t))}get coversSeparators(){return this.dd}set coversSeparators(t){let e=this.dd;e!==t&&(f.s(t,"boolean",jt,"coversSeparators"),this.dd=t,this.panel!==null&&this.panel.S(),this.t("coversSeparators",e,t))}get sizing(){return this.cd}set sizing(t){let e=this.cd;e!==t&&(this.cd=t,this.panel!==null&&this.panel.c(),this.t("sizing",e,t))}Qb(){if(this.sizing===1){let t=this.Vs;return this.isRow?t.rowSizing:t.columnSizing}return this.sizing}get actual(){return this._}set actual(t){isNaN(this.de)?this._=Math.max(Math.min(this.La,t),this.Ca):this._=Math.max(Math.min(this.La,this.de),this.Ca)}get measured(){return this.Ai}set measured(t){this.Ai=t}get total(){return this._+this.computeEffectiveSpacing()}get position(){return this.at}set position(t){this.at=t}bind(t,e,i,s){return this.sf(t,e,i,s),this}bindTwoWay(t,e,i,s){let n=this.sf(t,e,i,s);return s===void 0&&n.makeTwoWay(),this}theme(t,e,i,s,n){return this.mh(t,e,i,s,n),this}themeData(t,e,i,s,n){return this.mh(t,e,i,s,n).ofData(),this}themeObject(t,e,i,s,n,o){return this.mh(t,e,i,s,n).ofObject(o),this}themeModel(t,e,i,s,n){return this.mh(t,e,i,s,n).ofModel(),this}sf(t,e,i,s){let n;return typeof t=="string"?n=new oe(t,e,i,s):n=t,this.Y0(n),n}mh(t,e,i,s,n){let o;return typeof t=="string"?o=new pi(t,e,i,s,n):o=t,this.Y0(o),o}Y0(t){t.be=this;let e=this.panel;if(e!==null){let i=e.findBindingPanel();i!==null&&i.AA()&&f.o("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+t+" on "+e)}this.bs===null&&(this.bs=new j),this.bs.add(t)}}class ut extends dt{ot;ks;gd;Ta;ji;Vo;Io;jt;md;pd;K;constructor(t,e){super(),this.ot=null,this.ks=null,this.gd="None",this.Ta="black",this.ji="black",this.Vo=1,this.Io=null,this.jt=null,this.md=NaN,this.pd=NaN,this.K=null,typeof t=="string"?this.figure=t:t&&Object.assign(this,t),e&&Object.assign(this,e)}cloneProtected(t){super.cloneProtected(t),t.ot=this.ot,t.ks=this.ks,t.gd=this.gd,t.Ta=this.Ta,t.ji=this.ji,t.Vo=this.Vo,this.Io!==null&&(t.Io=this.Io.slice()),this.jt!==null&&(this.jt.fi?t.jt=this.jt:t.jt=this.jt.copy()),t.md=this.md,t.pd=this.pd,this.K!==null&&(t.K=this.K.copy())}Da(){return this.jt===null?this.jt=new ks:this.jt.fi&&(this.jt=this.jt.copy()),this.jt}ch(){super.ch(),this.jt!==null&&(this.jt.fi=!0)}oi(t){t in ms?this.geometryStretch=t:super.oi(t)}toString(){return"Shape("+(this.figure!=="None"?this.figure:this.toArrow!=="None"?this.toArrow:this.fromArrow)+")#"+I.as(this)}Uv(t,e){let i=this.pathPattern;i.ht(1/0,1/0);let s=i.measuredBounds;i.Bt(0,0,s.width,s.height);let n=this.geometry;t.save(),t.beginPath();let o=f.et();if(n.type===1)o.push(n.startX),o.push(n.startY),o.push(n.endX),o.push(n.endY),this.yd(t,e,o,i);else if(n.type===4){let r=n.figures.iterator;for(;r.next();){let a=r.value;o.length=0,o.push(a.startX),o.push(a.startY);let h=a.startX,l=a.startY,u=h,c=l,d=a.segments.r,g=d.length;for(let p=0;p<g;p++){let m=d[p];switch(m.type){case 1:this.yd(t,e,o,i),o.length=0,o.push(m.endX),o.push(m.endY),h=m.endX,l=m.endY,u=h,c=l;break;case 2:o.push(m.endX),o.push(m.endY),h=m.endX,l=m.endY;break;case 3:L.vn(h,l,m.point1X,m.point1Y,m.point2X,m.point2Y,m.endX,m.endY,.5,o),h=m.endX,l=m.endY;break;case 4:L.Og(h,l,m.point1X,m.point1Y,m.endX,m.endY,.5,o),h=m.endX,l=m.endY;break;case 5:{let y=m.bo(a),w=y.length;if(w===0){o.push(m.centerX),o.push(m.centerY),h=m.centerX,l=m.centerY;break}for(let b=0;b<w;b++){let v=y[b];L.vn(h,l,v[2],v[3],v[4],v[5],v[6],v[7],.5,o),h=v[6],l=v[7]}break}case 6:{let y=m.Bh(a,h,l),w=y.length;if(w===0){o.push(m.endX),o.push(m.endY),h=m.endX,l=m.endY;break}for(let b=0;b<w;b++){let v=y[b];L.vn(h,l,v[2],v[3],v[4],v[5],v[6],v[7],.5,o),h=v[6],l=v[7]}break}default:f.o("Segment not of valid type: "+m.type)}m.isClosed&&(o.push(u),o.push(c),this.yd(t,e,o,i))}this.yd(t,e,o,i)}}else if(n.type===2)o.push(n.startX),o.push(n.startY),o.push(n.endX),o.push(n.startY),o.push(n.endX),o.push(n.endY),o.push(n.startX),o.push(n.endY),o.push(n.startX),o.push(n.startY),this.yd(t,e,o,i);else if(n.type===3){let r=new $t;r.startX=n.endX,r.startY=(n.startY+n.endY)/2;let a=new vt(5);a.startAngle=0,a.sweepAngle=360,a.centerX=(n.startX+n.endX)/2,a.centerY=(n.startY+n.endY)/2,a.radiusX=Math.abs(n.startX-n.endX)/2,a.radiusY=Math.abs(n.startY-n.endY)/2,r.add(a);let h=a.bo(r),l=h.length;if(l===0)o.push(a.centerX),o.push(a.centerY);else{let u=r.startX,c=r.startY;for(let d=0;d<l;d++){let g=h[d];L.vn(u,c,g[2],g[3],g[4],g[5],g[6],g[7],.5,o),u=g[6],c=g[7]}}this.yd(t,e,o,i)}f.J(o),t.restore(),t.clearContextCache(!1)}Bv(t){let e=t.measuredBounds.width;return t instanceof ut&&(e-=t.strokeWidth),e<1&&(e=1),e}yd(t,e,i,s){let n=i.length;if(n<4)return;let o=s.measuredBounds,r=Math.max(1,o.width),a=o.height,h=i[0],l=i[1],u=0,c=0,d=0,g=0,p=0,m=0,y=0,w=0,b=f.et();for(let C=2;C<n;C+=2)u=i[C],c=i[C+1],d=u-h,g=c-l,d===0&&(d=.001),p=g/d,m=Math.atan2(g,d),y=Math.sqrt(d*d+g*g),b.push([d,m,p,y]),w+=y,h=u,l=c;h=i[0],l=i[1];let v=this.Bv(s),k=v,S=r/2,M=S!==0,F=0,T=b[F];d=T[0],m=T[1],p=T[2],y=T[3];let N=0;for(;w>=.1;){if(N===0&&(M?(k=v,k-=S,w-=S,M=!1):k=v,k===0&&(k=1)),k>w){k=w,f.J(b);return}k>y?(N=k-y,k=y):N=0;let C=Math.sqrt(k*k/(1+p*p));if(d<0&&(C=-C),h+=C,l+=p*C,t.translate(h,l),t.rotate(m),t.translate(-(r/2),-(a/2)),N===0&&s.gh(t,e),t.translate(r/2,a/2),t.rotate(-m),t.translate(-h,-l),w-=k,y-=k,N!==0){if(F++,F===b.length){f.J(b);return}T=b[F],d=T[0],m=T[1],p=T[2],y=T[3],k=N}}f.J(b)}gh(t,e){let i=t instanceof ce,s=this.ji,n=this.Ta;if(s===null&&n===null)return;let o=this.ot;if(o===null)return;t.commitTransform();let r=this.actualBounds,a=this.naturalBounds;n!==null&&this.rn(t,n,!0,!1,a,r);let h=this.part,l=this.Vo;s!==null&&l===0&&h!==null&&(this.isPanelMain||h.findMainElement()===this)&&(l=h.Vv()),l===0&&(s=null),s!==null&&l!==0&&(this.rn(t,s,!1,!1,a,r),t.lineWidth=l,t.lineJoin=this.strokeJoin,t.lineCap=this.strokeCap,t.miterLimit=this.strokeMiterLimit);let u=!1;h&&e.getRenderingHint("drawShadows")&&(u=h.isShadowed),t.Zr===!1&&(u=!1);let c=!0;s!==null&&(n===null||n==="transparent")&&(c=!1);let d=!1,g=this.strokeDashArray;if(g!==null&&(d=!0,t.enableDash(g,this.strokeDashOffset)),o.type===1)t.beginPath(),t.moveTo(o.startX,o.startY),t.lineTo(o.endX,o.endY),s!==null&&t.strokeContext(),t.endPath();else if(o.type===2){let p=o.startX,m=o.startY,y=o.endX,w=o.endY,b=Math.min(p,y),v=Math.min(m,w),k=Math.abs(y-p),S=Math.abs(w-m);t.beginPath(),t.rect(b,v,k,S),n!==null&&t.fillContext(n,!1,null),s!==null&&(c&&u&&t.shadowsOff(),t.strokeContext(),c&&u&&t.shadowsOn()),t.endPath()}else if(o.type===3){let p=o.startX,m=o.startY,y=o.endX,w=o.endY,b=Math.abs(y-p)/2,v=Math.abs(w-m)/2,k=Math.min(p,y)+b,S=Math.min(m,w)+v;t.beginPath(),t.moveTo(k,S-v),t.bezierCurveTo(k+L.Rn*b,S-v,k+b,S-L.Rn*v,k+b,S),t.bezierCurveTo(k+b,S+L.Rn*v,k+L.Rn*b,S+v,k,S+v),t.bezierCurveTo(k-L.Rn*b,S+v,k-b,S+L.Rn*v,k-b,S),t.bezierCurveTo(k-b,S-L.Rn*v,k-L.Rn*b,S-v,k,S-v),t.closePath(),n!==null&&t.fillContext(n,!1,null),s!==null&&(c&&u&&t.shadowsOff(),t.strokeContext(),c&&u&&t.shadowsOn()),t.endPath()}else if(o.type===4){let p=o.figures,m=p.length;for(let y=0;y<m;y++){let w=p.r[y];i?(t.beginPath(),this.buildPath(t,w)):w.Ee===null&&(w.Ee=new Path2D,this.buildPath(w.Ee,w));let b=w.isFilled;u?w.isShadowed?(b===!0&&n!=="transparent"&&n!==null&&t.fillContext(n,w.isEvenOdd,w.Ee),s!==null&&(b&&c&&t.shadowsOff(),t.stroke(w.Ee),b&&c&&t.shadowsOn())):(t.shadowsOff(),b&&n!=="transparent"&&n!==null&&t.fillContext(n,w.isEvenOdd,w.Ee),s!==null&&t.stroke(w.Ee),t.shadowsOn()):(b&&n!==null&&t.fillContext(n,w.isEvenOdd,w.Ee),s!==null&&t.stroke(w.Ee)),t.endPath(y)}}d&&t.disableDash(),this.pathPattern!==null&&this.Uv(t,e)}buildPath(t,e){t.moveTo(e.startX,e.startY);let i=e.segments.r,s=i.length,n=null;for(let o=0;o<s;o++){let r=i[o];switch(r.type){case 1:t.moveTo(r.endX,r.endY);break;case 2:t.lineTo(r.endX,r.endY);break;case 3:t.bezierCurveTo(r.point1X,r.point1Y,r.point2X,r.point2Y,r.endX,r.endY);break;case 4:t.quadraticCurveTo(r.point1X,r.point1Y,r.endX,r.endY);break;case 5:if(r.radiusX===r.radiusY){let a=n!==null?n.endX:e.startX,h=n!==null?n.endY:e.startY,l=Math.PI/180;t.arc(r.point1X,r.point1Y,r.radiusX,r.startAngle*l,(r.startAngle+r.sweepAngle)*l,r.sweepAngle<0,a,h)}else{let a=r.bo(e),h=a.length;if(h===0){t.lineTo(r.centerX,r.centerY);break}for(let l=0;l<h;l++){let 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.bo(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.Bh(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}}Zc(t,e,i){if(!super.Zc(t,e,i)||this.ji===null&&this.Ta===null||this.ot===null||this.pathPattern!==null)return!1;let s=this.svg.getElementsByTagName("path");return this.geometry.figures.length!==s.length?!1:(t.currentPath=this.svg,this.gh(t,e),t.currentPath=null,!0)}$u(t){return this.geometry!==null&&this.geometry.figures.length>1||this.pathPattern!==null?!0:super.$u(t)}k2(t,e){if(t.nodeName!=="g")t.setAttributeNS(null,"filter",e);else{let i=t.getElementsByTagName("path");for(let s=0;s<i.length;s++)i[s].setAttributeNS(null,"filter",e)}}getDocumentPoint(t,e){if(e===void 0&&(e=new P),t instanceof D){let i=t;i.isNoSpot()&&f.o("getDocumentPoint Spot must be a real, specific Spot, not: "+i.toString());let s=this.naturalBounds,n=this.strokeWidth;return e.i(i.x*(s.width+n)-n/2+s.x+i.offsetX,i.y*(s.height+n)-n/2+s.y+i.offsetY),this.Us.gt(e),e}else return e.set(t),this.Us.gt(e),e}getDocumentBounds(t){t===void 0&&(t=new z);let e=this.naturalBounds,i=this.Us,s=z.V(e.x,e.y,e.width,e.height),n=this.strokeWidth;s.inflate(n/2,n/2);let o=P.V(s.x,s.y).T(i);return t.i(o.x,o.y,0,0),o.i(s.right,s.y).T(i),t.unionNoCheck(o.x,o.y,0,0),o.i(s.right,s.bottom).T(i),t.unionNoCheck(o.x,o.y,0,0),o.i(s.x,s.bottom).T(i),t.unionNoCheck(o.x,o.y,0,0),z.e(s),P.e(o),t}fh(t,e){let i=this.geometry;if(i===null||this.fill===null&&this.stroke===null)return!1;let s=i.bounds,n=this.strokeWidth/2;i.type===1&&!e&&(n+=2);let o=z.l();if(o.a(s),o.inflate(n+2,n+2),!o.containsPoint(t))return z.e(o),!1;let r=n+1e-4;if(i.type===1){if(this.stroke===null)return!1;let a=(i.startX-i.endX)*(t.x-i.endX)+(i.startY-i.endY)*(t.y-i.endY),h=(i.endX-i.startX)*(t.x-i.startX)+(i.endY-i.startY)*(t.y-i.startY);return a<0||h<0?!1:(z.e(o),L.vi(i.startX,i.startY,i.endX,i.endY,n,t.x,t.y))}else if(i.type===2){let a=i.startX,h=i.startY,l=i.endX,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 z.e(o),!1;o.inflate(r,r)}this.stroke!==null&&o.inflate(n,n);let c=o.containsPoint(t);return z.e(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),g=Math.abs(l-a),p=Math.abs(u-h),m=g/2,y=p/2;if(c=t.x-(c+m),d=t.y-(d+y),this.fill===null){if(m-=r,y-=r,m<=0||y<=0||c*c/(m*m)+d*d/(y*y)<=1)return z.e(o),!1;m+=r,y+=r}return this.stroke!==null&&(m+=r,y+=r),z.e(o),m<=0||y<=0?!1:c*c/(m*m)+d*d/(y*y)<=1}else{if(i.type===4)return z.e(o),this.fill===null?i.EC(t.x,t.y,n):i.qk(t,n,this.strokeWidth>1,e);f.o("Unknown Geometry type: "+i.type)}}Wu(t,e,i,s){let n=this.desiredSize,o=this.Vo;t=Math.max(t,0),e=Math.max(e,0);let r;if(this.ks!==null)r=this.geometry.bounds;else{let p=this.figure,m=ut.q2[p];if(m===void 0){let y=L.In[p];typeof y=="string"&&(y=L.In[y]),f.it(y)?(m=y(null,100,100),ut.q2[p]=m):f.o("Unsupported Figure: "+p)}r=m.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 g=this.aS();switch(g){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:f.o(g+" is not a valid geometryStretch.")}if(this.ks!==null){a===0&&(a=.001),h===0&&(h=.001);let p=(this.ks!==null?this.ks:this.ot).cF(a,h);this.ot=p}else(this.ot===null||!L.z(this.ot.rc,t-o)||!L.z(this.ot.lc,e-o))&&(this.ot=ut.zv(this,a,h));r=this.ot.bounds,t===1/0||e===1/0?this.Wn(r.x-o/2,r.y-o/2,t===0&&a===0?0:r.width+o,e===0&&h===0?0:r.height+o):this.Wn(-(o/2),-(o/2),l+o,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.zi.i(0,0,l,u)):this.zi.a(r)}aS(){let t=this.geometryStretch;return this.ks!==null?t===1?2:t:t===1?ut.q2[this.figure].defaultStretch:t}uh(t,e,i,s){this.commonArrange(t,e,i,s)}getNearestIntersectionPoint(t,e,i){return this.Jc(t.x,t.y,e.x,e.y,i)}Jc(t,e,i,s,n){let o=this.T,r=1/(o.m11*o.m22-o.m12*o.m21),a=o.m22*r,h=-o.m12*r,l=-o.m21*r,u=o.m11*r,c=r*(o.m21*o.dy-o.m22*o.dx),d=r*(o.m12*o.dx-o.m11*o.dy),g=t*a+e*l+c,p=t*h+e*u+d,m=i*a+s*l+c,y=i*h+s*u+d,w=this.Vo/2,b=this.ot;b===null&&(this.ht(1/0,1/0),b=this.ot);let v=b.bounds,k=!1;if(b.type===1)if(this.strokeWidth<=1.5)k=L.On(b.startX,b.startY,b.endX,b.endY,g,p,m,y,n);else{let S=0,M=0;if(b.startX===b.endX)S=w,M=0;else{let R=(b.endY-b.startY)/(b.endX-b.startX);M=w/Math.sqrt(1+R*R),S=M*R}let F=f.et(),T=new P;L.On(b.startX+S,b.startY+M,b.endX+S,b.endY+M,g,p,m,y,T)&&F.push(T),T=new P,L.On(b.startX-S,b.startY-M,b.endX-S,b.endY-M,g,p,m,y,T)&&F.push(T),T=new P,L.On(b.startX+S,b.startY+M,b.startX-S,b.startY-M,g,p,m,y,T)&&F.push(T),T=new P,L.On(b.endX+S,b.endY+M,b.endX-S,b.endY-M,g,p,m,y,T)&&F.push(T);let N=F.length;if(N===0)return f.J(F),!1;k=!0;let C=1/0;for(let R=0;R<N;R++){let O=F[R],B=(O.x-g)**2+(O.y-p)**2;B<C&&(C=B,n.x=O.x,n.y=O.y)}f.J(F)}else if(b.type===2)k=L.gl(v.x-w,v.y-w,v.x+v.width+w,v.y+v.height+w,g,p,m,y,n);else if(b.type===3){let S=z.V(v.x,v.y,v.width,v.height).inflate(w,w);k=this.Xv(S,g,p,m,y,n),z.e(S)}else if(b.type===4){let S=0,M=0,F=0,T=0,N=P.l(),C=m-g,R=y-p,O=C*C+R*R,B=g,K=p;if(O>0&&v.contains(B,K)&&(N.x=B,N.y=K,this.containsPoint(N)))for(C!==0&&Math.abs(C)<.5?(R*=.5/C,C=.5):R!==0&&Math.abs(R)<.5&&(C*=.5/R,R=.5),B-=C,K-=R;v.contains(B,K);)B-=C,K-=R;let Y=.6;n.x=m,n.y=y;for(let at=0;at<b.figures.count;at++){let tt=b.figures.r[at],st=tt.isFilled?B:g,et=tt.isFilled?K:p,ct=tt.segments;S=tt.startX,M=tt.startY;let gt=S,wt=M;for(let Ct=0;Ct<ct.count;Ct++){let ot=ct.r[Ct],Mt=ot.type;F=ot.endX,T=ot.endY;let bt=!1;switch(Mt){case 1:gt=F,wt=T;break;case 2:bt=this.s1(S,M,F,T,st,et,m,y,N);break;case 3:{bt=L.Ig(S,M,ot.point1X,ot.point1Y,ot.point2X,ot.point2Y,F,T,st,et,m,y,Y,N);break}case 4:{bt=L.Ig(S,M,S+2/3*(ot.point1X-S),M+2/3*(ot.point1Y-M),F+2/3*(ot.point1X-F),T+2/3*(ot.point1Y-T),F,T,st,et,m,y,Y,N);break}case 5:case 6:{let Gt=ot.type===5?ot.bo(tt):ot.Bh(tt,S,M),lt=Gt.length;if(lt===0){bt=this.s1(S,M,ot.type===5?ot.centerX:ot.endX,ot.type===5?ot.centerY:ot.endY,st,et,m,y,N);break}let J=null;for(let mt=0;mt<lt;mt++){if(J=Gt[mt],mt===0&&this.s1(S,M,J[0],J[1],st,et,m,y,N)){let At=this.o1(st,et,N,O,n);At<O&&(O=At,k=!0)}if(L.Ig(J[0],J[1],J[2],J[3],J[4],J[5],J[6],J[7],st,et,m,y,Y,N)){let At=this.o1(st,et,N,O,n);At<O&&(O=At,k=!0)}}F=J[6],T=J[7];break}default:f.o("Unknown Segment type: "+Mt)}if(S=F,M=T,bt){let Gt=this.o1(st,et,N,O,n);Gt<O&&(O=Gt,k=!0)}if(ot.isClosed&&(F=gt,T=wt,this.s1(S,M,F,T,st,et,m,y,N))){let Gt=this.o1(st,et,N,O,n);Gt<O&&(O=Gt,k=!0)}}}let X=i-t,G=s-e,nt=Math.sqrt(X*X+G*G);nt!==0&&(X/=nt,G/=nt),n.x-=X*w,n.y-=G*w,P.e(N)}else f.o("Unknown Geometry type: "+b.type);return k?(this.T.gt(n),!0):!1}o1(t,e,i,s,n){let o=i.x-t,r=i.y-e,a=o*o+r*r;return a<s?(n.x=i.x,n.y=i.y,a):s}s1(t,e,i,s,n,o,r,a,h){if(L.z(t,i)&&L.z(e,s)||L.z(n,r)&&L.z(o,a))return!1;let l=!1,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||L.z(h.y,c))&&(h.y<d||L.z(h.y,d))&&(l=!0)}else{let c=t<i?t:i,d=t<i?i:t;(h.x>c||L.z(h.x,c))&&(h.x<d||L.z(h.x,d))&&(l=!0)}return l}Yv(t,e,i){return this.pickable===!1?!1:(i.nc(this.T),e?this.Gv(t,i):this.containedInRect(t,i))}containedInRect(t,e){if(e===void 0)return t.containsRect(this.actualBounds);let i=this.ot;i===null&&(this.ht(1/0,1/0),i=this.ot);let s=i.bounds,n=this.strokeWidth/2,o=!1,r=P.l();return r.i(s.x-n,s.y-n),t.containsPoint(e.gt(r))&&(r.i(s.x-n,s.bottom+n),t.containsPoint(e.gt(r))&&(r.i(s.right+n,s.bottom+n),t.containsPoint(e.gt(r))&&(r.i(s.right+n,s.y-n),t.containsPoint(e.gt(r))&&(o=!0)))),P.e(r),o}intersectsRect(t,e){if(this.containedInRect(t,e)||e===void 0&&(e=this.T,t.containsRect(this.actualBounds)))return!0;let i=Pt.l();i.set(e),i.bw();let s=t.left,n=t.right,o=t.top,r=t.bottom,a=P.l();if(a.i(s,o),i.gt(a),this.fh(a,!0)||(a.i(n,o),i.gt(a),this.fh(a,!0))||(a.i(s,r),i.gt(a),this.fh(a,!0))||(a.i(n,r),i.gt(a),this.fh(a,!0)))return P.e(a),!0;let h=P.l(),l=P.l();i.set(e),i.NC(this.T),i.bw(),h.x=n,h.y=o,h.T(i),a.x=s,a.y=o,a.T(i);let u=!1;return this.Fa(a,h,l)?u=!0:(a.x=n,a.y=r,a.T(i),this.Fa(a,h,l)?u=!0:(h.x=s,h.y=r,h.T(i),this.Fa(a,h,l)?u=!0:(a.x=s,a.y=o,a.T(i),this.Fa(a,h,l)&&(u=!0)))),P.e(a),Pt.e(i),P.e(h),P.e(l),u}Fa(t,e,i){if(!this.getNearestIntersectionPoint(t,e,i))return!1;let s=t.x,n=t.y,o=e.x,r=e.y,a=i.x,h=i.y;if(s===o){let l=0,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}}Gv(t,e){if(this.containedInRect(t,e)||e===void 0&&(e=this.T,t.containsRect(this.actualBounds)))return!0;let i=t.left,s=t.right,n=t.top,o=t.bottom,r=P.l(),a=P.l(),h=P.l(),l=Pt.l();l.set(e),l.NC(this.T),l.bw(),a.x=s,a.y=n,a.T(l),r.x=i,r.y=n,r.T(l);let u=!1;return this.Fa(r,a,h)?u=!0:(r.x=s,r.y=o,r.T(l),this.Fa(r,a,h)?u=!0:(a.x=i,a.y=o,a.T(l),this.Fa(r,a,h)?u=!0:(r.x=i,r.y=n,r.T(l),this.Fa(r,a,h)&&(u=!0)))),Pt.e(l),P.e(r),P.e(a),P.e(h),u}xA(t,e,i){if(i&&this.fill!==null&&this.fh(t,!0))return!0;let s=t.distanceSquaredPoint(e),n=s;this.strokeWidth>1.5&&(s=this.strokeWidth/2+Math.sqrt(s),s*=s);let o=this.ot;if(o===null&&(this.ht(1/0,1/0),o=this.ot,o===null))return!1;if(!i){let c=o.bounds,d=c.x,g=c.y,p=c.x+c.width,m=c.y+c.height;if(P.distanceSquared(t.x,t.y,d,g)<=s&&P.distanceSquared(t.x,t.y,p,g)<=s&&P.distanceSquared(t.x,t.y,d,m)<=s&&P.distanceSquared(t.x,t.y,p,m)<=s)return!0}function r(c,d){let g=c.length;for(let p=0;p<g;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),g=(a-l)*(t.x-l)+(h-u)*(t.y-u),p=d>=0&&g>=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,g=t.x-c,p=t.y-d,m=Math.abs(l-a)/2,y=Math.abs(u-h)/2;if(m===0||y===0)return P.distanceLineSegmentSquared(t.x,t.y,a,h,l,u)<=s;if(i){let w=L.iF(m,y,g,p);return w*w<=s}else return!(P.distanceSquared(g,p,-m,0)>=s||P.distanceSquared(g,p,0,-y)>=s||P.distanceSquared(g,p,0,y)>=s||P.distanceSquared(g,p,m,0)>=s)}else if(o.type===4){let c=o.bounds,d=c.x,g=c.y,p=c.x+c.width,m=c.y+c.height;if(t.x>p&&t.x<d&&t.y>m&&t.y<g&&P.distanceLineSegmentSquared(t.x,t.y,d,g,d,m)>s&&P.distanceLineSegmentSquared(t.x,t.y,d,g,p,g)>s&&P.distanceLineSegmentSquared(t.x,t.y,p,m,d,m)>s&&P.distanceLineSegmentSquared(t.x,t.y,p,m,p,g)>s)return!1;let y=Math.sqrt(s);if(i){if(this.fill===null?o.EC(t.x,t.y,y):o.qk(t,y,!0,!1))return!0}else{let w=o.figures;for(let b=0;b<w.count;b++){let v=w.r[b],k=v.startX,S=v.startY;if(t.distanceSquared(k,S)>s)return!1;let M=v.segments.r,F=M.length;for(let T=0;T<F;T++){let N=M[T];switch(N.type){case 1:case 2:if(k=N.endX,S=N.endY,t.distanceSquared(k,S)>s)return!1;break;case 3:{let C=f.et();L.vn(k,S,N.point1X,N.point1Y,N.point2X,N.point2Y,N.endX,N.endY,.8,C);let R=r(C,t);if(f.J(C),R||(k=N.endX,S=N.endY,t.distanceSquared(k,S)>s))return!1;break}case 4:{let C=f.et();L.Og(k,S,N.point1X,N.point1Y,N.endX,N.endY,.8,C);let R=r(C,t);if(f.J(C),R||(k=N.endX,S=N.endY,t.distanceSquared(k,S)>s))return!1;break}case 5:case 6:{let C=N.type===5?N.bo(v):N.Bh(v,k,S),R=C.length;if(R===0){if(k=N.type===5?N.centerX:N.endX,S=N.type===5?N.centerY:N.endY,t.distanceSquared(k,S)>s)return!1;break}let O=null,B=f.et();for(let K=0;K<R;K++)if(O=C[K],B.length=0,L.vn(O[0],O[1],O[2],O[3],O[4],O[5],O[6],O[7],.8,B),r(B,t))return f.J(B),!1;f.J(B),O!==null&&(k=O[6],S=O[7]);break}default:f.o("Unknown Segment type: "+N.type)}}}return!0}}return!1}Xv(t,e,i,s,n,o){if(t.width===0)return L.On(t.x,t.y,t.x,t.y+t.height,e,i,s,n,o);if(t.height===0)return L.On(t.x,t.y,t.x+t.width,t.y,e,i,s,n,o);{let r=t.width/2,a=t.height/2,h=t.x+r,l=t.y+a,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),g=(-(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,m=u*(g-h)+c+l,y=u*(p-h)+c+l,w=Math.abs((e-g)**2)+Math.abs((i-m)**2),b=Math.abs((e-p)**2)+Math.abs((i-y)**2);w<b?(o.x=g,o.y=m):(o.x=p,o.y=y)}else{let c=a*a,d=r*r,g=e-h,p=c-c/d*(g*g);if(p<0)return o.x=NaN,o.y=NaN,!1;let m=Math.sqrt(p),y=l+m,w=l-m,b=Math.abs(y-i),v=Math.abs(w-i);b<v?(o.x=e,o.y=y):(o.x=e,o.y=w)}return!0}}Rv(){return this.Vo/2*this.strokeMiterLimit*this.getDocumentScale()}get geometry(){return this.ot!==null?this.ot:this.ks}set geometry(t){let e=this.ot,i=this.ks;if(e===t)return;t!==null?(this.ot=t.u(),this.ks=this.ot):(this.ot=null,this.ks=null);let s=this.part;if(s!==null&&s.cf(),this.c(),this.t("geometry",e||i,t),this.Wc()){let n=this.part;n!==null&&this.ba(n,"geometryString")}}get geometryString(){return this.geometry===null?"":this.geometry.toString()}set geometryString(t){let e=kt.parse(t),i=e.normalize();this.geometry=e;let s=P.V(-i.x,-i.y);this.position=s,P.e(s)}get isGeometryPositioned(){return(this.n&1048576)!==0}set isGeometryPositioned(t){let e=(this.n&1048576)!==0;e!==t&&(this.n=this.n^1048576,this.c(),this.t("isGeometryPositioned",e,t))}ee(){this.ot=null}get fill(){return this.Ta}set fill(t){let e=this.Ta;e!==t&&(t!==null&&E.Qu(t,"Shape.fill"),t instanceof E&&t.u(),this.Ta=t,this.S(),this.t("fill",e,t))}get stroke(){return this.ji}set stroke(t){let e=this.ji;e!==t&&(t!==null&&E.Qu(t,"Shape.stroke"),t instanceof E&&t.u(),this.ji=t,this.S(),this.t("stroke",e,t))}get strokeWidth(){return this.Vo}set strokeWidth(t){let e=this.Vo;if(e!==t)if(t>=0){this.Vo=t,this.c();let i=this.part;i!==null&&i.cf(),this.t("strokeWidth",e,t)}else f.W(t,"value >= 0",ut,"strokeWidth:value")}y0(){return this.Vo}get strokeCap(){return this.jt!==null?this.jt.gp:"butt"}set strokeCap(t){let e=this.strokeCap;e!==t&&(typeof t=="string"&&(t==="butt"||t==="round"||t==="square")?(this.Da().gp=t,this.S(),this.t("strokeCap",e,t)):f.W(t,'"butt", "round", or "square"',ut,"strokeCap"))}get strokeJoin(){return this.jt!==null?this.jt.mp:"miter"}set strokeJoin(t){let e=this.strokeJoin;e!==t&&(typeof t=="string"&&(t==="miter"||t==="bevel"||t==="round")?(this.Da().mp=t,this.S(),this.t("strokeJoin",e,t)):f.W(t,'"miter", "bevel", or "round"',ut,"strokeJoin"))}get strokeMiterLimit(){return this.jt!==null?this.jt.pp:10}set strokeMiterLimit(t){let e=this.strokeMiterLimit;if(e!==t&&t>=1){this.Da().pp=t,this.S();let i=this.part;i!==null&&i.cf(),this.t("strokeMiterLimit",e,t)}}get strokeDashArray(){return this.Io}set strokeDashArray(t){let e=this.Io;if(e!==t){if(t!==null&&!Array.isArray(t)&&f.Zi(t,"Array",ut,"strokeDashArray:value"),t!==null){let i=t.length,s=0;for(let n=0;n<i;n++){let o=t[n];(!(o>=0)||!isFinite(o))&&f.o("strokeDashArray:value "+o+" at index "+n+" must be a positive number or zero."),s+=o}if(s===0){if(e===null)return;t=null}}this.Io=t,this.S(),this.t("strokeDashArray",e,t)}}get strokeDashOffset(){return this.jt!==null?this.jt.ph:0}set strokeDashOffset(t){let e=this.strokeDashOffset;e!==t&&t>=0&&(this.Da().ph=t,this.S(),this.t("strokeDashOffset",e,t))}get figure(){return this.gd}set figure(t){let e=this.gd;if(e!==t){let i=L.In[t];if(f.it(i)?i=t:(i=L.In[t.toLowerCase()],i||f.o("Unknown Shape.figure: "+t)),e!==i){let s=this.part;s!==null&&s.cf(),this.gd=i,this.ks=null,this.ee(),this.c(),this.t("figure",e,i)}}}get toArrow(){return this.Ot!==null?this.Ot.yp:"None"}set toArrow(t){let e=this.toArrow;if(t===!0?t="Standard":t===!1&&(t=""),e!==t){let i=ut.qA(t);i===null?f.o("Unknown Shape.toArrow: "+t):e!==i&&(this.Ot===null&&(this.Ot=new He),this.Ot.yp=i,this.ks=null,this.ee(),this.c(),this.WA(i),this.t("toArrow",e,i))}}get fromArrow(){return this.Ot!==null?this.Ot.wp:"None"}set fromArrow(t){let e=this.fromArrow;if(t===!0?t="Standard":t===!1&&(t=""),e!==t){let i=ut.qA(t);i===null?f.o("Unknown Shape.fromArrow: "+t):e!==i&&(this.Ot===null&&(this.Ot=new He),this.Ot.wp=i,this.ks=null,this.ee(),this.c(),this.WA(i),this.t("fromArrow",e,i))}}WA(t){let e=this.diagram;if(e!==null&&e.undoManager.isUndoingRedoing)return;this.iv();let i=D.MiddleRight;this.toArrow!=="None"?(this.segmentIndex=-1,this.alignmentFocus=i):this.fromArrow!=="None"&&(this.segmentIndex=0,this.alignmentFocus=new D(1-i.x,i.y))}get spot1(){return this.jt!==null?this.jt.En:D.Default}set spot1(t){let e=this.spot1;e.equals(t)||(t=t.P(),this.Da().En=t,this.c(),this.t("spot1",e,t))}get spot2(){return this.jt!==null?this.jt.Un:D.Default}set spot2(t){let e=this.spot2;e.equals(t)||(t=t.P(),this.Da().Un=t,this.c(),this.t("spot2",e,t))}get parameter1(){return this.md}set parameter1(t){let e=this.md;e!==t&&(this.md=t,this.ee(),this.c(),this.t("parameter1",e,t))}get parameter2(){return this.pd}set parameter2(t){let e=this.pd;e!==t&&(this.pd=t,this.ee(),this.c(),this.t("parameter2",e,t))}get naturalBounds(){return this.zi}kv(){let t=this.desiredSize;if(!t.isReal()&&this.ot!==null){let e=this.ot.bounds;this.zi.a(e)}else this.zi.i(0,0,t.width,t.height)}get pathPattern(){return this.jt!==null?this.jt.xp:null}set pathPattern(t){let e=this.pathPattern;e!==t&&(this.Da().xp=t,this.S(),this.t("pathPattern",e,t))}get geometryStretch(){return this.jt!==null?this.jt.bp:1}set geometryStretch(t){let e=this.geometryStretch;e!==t&&(this.Da().bp=t,this.c(),this.t("geometryStretch",e,t))}get interval(){return this.K!==null?this.K.uf:1}set interval(t){let e=this.interval;if(t=Math.round(t),e!==t&&t!==0&&isFinite(t)){this.K===null&&(this.K=new Ae),this.K.uf=t;let i=this.diagram;i!==null&&this.panel===i.grid&&i.th(),this.c();let s=this.panel;s!==null&&(s.ss=null),this.t("interval",e,t)}}get graduatedStart(){return this.K!==null?this.K.df:0}set graduatedStart(t){let e=this.graduatedStart;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new Ae),this.K.df=t,this.c(),this.t("graduatedStart",e,t))}get graduatedEnd(){return this.K!==null?this.K.gf:1}set graduatedEnd(t){let e=this.graduatedEnd;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new Ae),this.K.gf=t,this.c(),this.t("graduatedEnd",e,t))}get graduatedSkip(){return this.K!==null?this.K.mf:null}set graduatedSkip(t){let e=this.graduatedSkip;e!==t&&(t!==null&&f.k(t,ut,"graduatedSkip"),this.K===null&&(this.K=new Ae),this.K.mf=t,this.c(),this.t("graduatedSkip",e,t))}static zv(t,e,i){let s=null;if(t.toArrow!=="None")s=ut.gn[t.toArrow];else if(t.fromArrow!=="None")s=ut.gn[t.fromArrow];else{let n=L.In[t.figure];typeof n=="string"&&(n=L.In[n]),n===void 0&&f.o("Unknown Shape.figure: "+t.figure),s=n(t,e,i),s.rc=e,s.lc=i}if(s===null){let n=L.In.Rectangle;f.it(n)&&(s=n(t,e,i))}return s}static getFigureGenerators(){let t=new pt;for(let e in L.In){if(e===e.toLowerCase())continue;let i=L.In[e];t.set(e,i)}return t.u(),t}static defineFigureGenerator(t,e){f.s(t,"string",ut,"defineFigureGenerator:name"),typeof e=="string"||f.k(e,ut,"defineFigureGenerator:func");let i=t.toLowerCase(),s=L.In;s[t]=e,s[i]=t}static isFigureDefined(t){return L.In.has(t)}static getArrowheadGeometries(){let t=new pt;for(let e in L.Bg)if(ut.gn[e]===void 0){let i=kt.parse(L.Bg[e],!1);ut.gn[e]=i;let s=e.toLowerCase();s!==e&&(ut.gn[s]=e)}for(let e in ut.gn){if(e===e.toLowerCase())continue;let i=ut.gn[e];i instanceof kt&&t.set(e,i)}return t.u(),t}static defineArrowheadGeometry(t,e){f.s(t,"string",ut,"defineArrowheadGeometry:name");let i=null;typeof e=="string"?(f.s(e,"string",ut,"defineArrowheadGeometry:pathstr"),i=kt.parse(e,!1)):i=e;let s=t.toLowerCase();(s==="none"||t===s)&&f.o("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+t);let n=ut.gn;n[t]=i,n[s]=t}static isArrowheadDefined(t){return ut.gn.has(t)}static gn=new q;static q2=new q;static qA(t){let e=ut.gn[t];if(e===void 0){let i=t.toLowerCase();if(i==="none")return"None";if(e=ut.gn[i],e===void 0){let s=null;for(let n in L.Bg)if(n.toLowerCase()===i){s=n;break}if(s!==null){let n=kt.parse(L.Bg[s],!1);return ut.gn[s]=n,i!==s&&(ut.gn[i]=s),s}}}return typeof e=="string"?e:e instanceof kt?t:null}}class ks{fi;gp;mp;pp;ph;xp;bp;En;Un;constructor(){this.fi=!1,this.gp="butt",this.mp="miter",this.pp=10,this.ph=0,this.xp=null,this.bp=1,this.En=D.Default,this.Un=D.Default}copy(){let t=new ks;return t.gp=this.gp,t.mp=this.mp,t.pp=this.pp,t.ph=this.ph,t.xp=this.xp,t.bp=this.bp,t.En=this.En.P(),t.Un=this.Un.P(),t}}var Ss=(x=>(x[x.None=0]="None",x[x.Fit=1]="Fit",x[x.DesiredSize=2]="DesiredSize",x[x.BreakAll=3]="BreakAll",x))(Ss||{}),Fn=(x=>(x[x.Clip=0]="Clip",x[x.Ellipsis=1]="Ellipsis",x))(Fn||{}),Ps=(x=>(x[x.Trim=0]="Trim",x[x.None=1]="None",x))(Ps||{});class xt extends dt{ri;ji;mn;ge;ui;w0;wd;K;rt;Dl;io;pn;Ce;Ti;yn;constructor(t,e){return super(),xt.W0===!1&&(xt.W0=!0,xt._n=U.isUsingDOM()?new Ue(null).li:null),this.n|=2097152,this.ri="",this.ji="black",this.mn="13px sans-serif",this.ge=0,this.ui=0,this.w0=0,this.wd=null,this.K=null,this.rt=null,this.Dl=0,this.io=null,this.pn=0,this.Ce=null,this.Ti=null,this.yn=null,typeof t=="string"?this.text=t:t&&Object.assign(this,t),e&&Object.assign(this,e),this}cloneProtected(t){super.cloneProtected(t),t.ri=this.ri,t.ji=this.ji,t.mn=this.mn,t.ge=this.ge,t.ui=this.ui,t.w0=this.w0,t.wd=this.wd,this.K!==null&&(t.K=this.K.copy()),this.rt!==null&&(this.rt.fi?t.rt=this.rt:t.rt=this.rt.copy()),t.Dl=this.Dl,t.io=this.io,t.pn=this.pn,t.Ce=this.Ce,t.Ti=this.Ti,t.yn=this.yn}wn(){return this.rt===null?this.rt=new Ms:this.rt.fi&&(this.rt=this.rt.copy()),this.rt}ch(){super.ch(),this.rt!==null&&(this.rt.fi=!0)}Av(t){this.n=t.n|2048|4096,this.$t=t.opacity,this.Lt=t.background,this.is=t.desiredSize.P(),this.minSize=t.minSize.P(),this.maxSize=t.maxSize.P(),t.wi!==null?this.wi=t.wi.copy():this.wi=null,this.tt=t.scale,this.Yt=t.angle,this.stretch=t.stretch,this.Wr=t.margin.P(),this.hi=t.alignment.P(),this.ju=t.alignmentFocus.P(),this.segmentFraction=t.segmentFraction,this.segmentOffset=t.segmentOffset.P(),this.segmentOrientation=t.segmentOrientation,t.si!==null&&(this.si=t.si.copy()),this.shadowVisible=t.shadowVisible,this.ri=t.ri,this.ji=t.ji,this.mn=t.mn,this.K!==null&&(this.K=t.K.copy()),t.rt!==null&&(t.rt.fi?this.rt=t.rt:this.rt=t.rt.copy()),this.Dl=t.Dl}Cv(t){if(this.ri=t.text||"",this.Yt=t.labelAngle||0,this.ge=t.lineCount||0,this.Kv(t.lines),t.naturalBounds&&(this.zi=t.naturalBounds),t.actualBounds){let e=t.actualBounds;this.Bt(e.x,e.y,e.width,e.height)}}oi(t){t in Ss?this.wrap=t:super.oi(t)}toString(){return this.ri.length>22?'TextBlock("'+this.ri.substring(0,20)+'"...)':'TextBlock("'+this.ri+'")'}static getEllipsis(){return xt.kp}static setEllipsis(t){xt.kp=t,xt.l1=new q,xt.W2=0}static getBaseline(){return xt.h1}static setBaseline(t){xt.h1=t}static h1=null;static getUnderline(){return xt.a1}static setUnderline(t){xt.a1=t}static a1=null;static None=0;static WrapFit=1;static WrapDesiredSize=2;static WrapBreakAll=3;static OverflowClip=0;static OverflowEllipsis=1;static FormatTrim=0;static FormatNone=1;c(){super.c(),this.Ve(!0)}get font(){return this.mn}set font(t){let e=this.mn;e!==t&&(this.mn=t,this.io=null,this.c(),this.t("font",e,t))}static isValidFont(t){return A.CSS?A.CSS.supports("font",t):!0}get text(){return this.ri}set text(t){let e=this.ri;t!=null?t=t.toString():t="",e!==t&&(this.ri=t,this.c(),this.t("text",e,t))}get textAlign(){return this.rt!==null?this.rt.Pp:"start"}set textAlign(t){let e=this.textAlign;e!==t&&(t==="start"||t==="end"||t==="left"||t==="right"||t==="center")&&(this.wn().Pp=t,this.S(),this.t("textAlign",e,t))}get flip(){return this.rt!==null?this.rt.eo:0}set flip(t){let e=this.flip;e!==t&&(this.wn().eo=t,this.S(),this.t("flip",e,t))}get verticalAlignment(){return this.rt!==null?this.rt.tl:D.Top}set verticalAlignment(t){let e=this.verticalAlignment;e.equals(t)||(t=t.P(),this.wn().tl=t,this.ef(),this.t("verticalAlignment",e,t))}get naturalBounds(){if(!this.zi.isReal()){let t=Q.l();this.J2(this.ri,999999,t);let e=t.width;Q.e(t);let i=this.JA(e),s=this.desiredSize;isNaN(s.width)||(e=s.width),isNaN(s.height)||(i=s.height),this.zi.Fn(e,i)}return this.zi}get isMultiline(){return(this.n&2097152)!==0}set isMultiline(t){let e=(this.n&2097152)!==0;e!==t&&(this.n=this.n^2097152,this.c(),this.t("isMultiline",e,t))}get isUnderline(){return(this.n&4194304)!==0}set isUnderline(t){let e=(this.n&4194304)!==0;e!==t&&(this.n=this.n^4194304,this.Ve(!0),this.S(),this.t("isUnderline",e,t))}get isStrikethrough(){return(this.n&8388608)!==0}set isStrikethrough(t){let e=(this.n&8388608)!==0;e!==t&&(this.n=this.n^8388608,this.Ve(!0),this.S(),this.t("isStrikethrough",e,t))}get wrap(){return this.rt!==null?this.rt.Sp:2}set wrap(t){let e=this.wrap;e!==t&&(this.wn().Sp=t,this.c(),this.t("wrap",e,t))}get overflow(){return this.rt!==null?this.rt.Mp:0}set overflow(t){let e=this.overflow;e!==t&&(this.wn().Mp=t,this.c(),this.t("overflow",e,t))}get isOverflowed(){return(this.n&16777216)!==0}$2(t){t?this.n|=16777216:this.n&=-16777217}get stroke(){return this.ji}set stroke(t){let e=this.ji;e!==t&&(t!==null&&E.Qu(t,"TextBlock.stroke"),t instanceof E&&t.u(),this.ji=t,typeof t!="string"&&this.Qc(),this.S(),this.t("stroke",e,t))}get lineCount(){return this.ge}get lineHeight(){return this.Np()}get editable(){return(this.n&1048576)!==0}set editable(t){let e=(this.n&1048576)!==0;e!==t&&(this.n=this.n^1048576,this.t("editable",e,t))}get V2(){return(this.n&33554432)!==0}set V2(t){this.n=this.n^33554432}get textEditor(){return this.rt!==null?this.rt.Cp:null}set textEditor(t){let e=this.textEditor;e!==t&&(this.wn().Cp=t,this.t("textEditor",e,t))}get errorFunction(){return this.rt!==null?this.rt.ns:null}set errorFunction(t){let e=this.errorFunction;e!==t&&(t!==null&&f.k(t,xt,"errorFunction"),this.wn().ns=t,this.t("errorFunction",e,t))}get interval(){return this.K!==null?this.K.uf:1}set interval(t){let e=this.interval;if(t=Math.round(t),e!==t&&t!==0&&isFinite(t)){this.K===null&&(this.K=new Ae),this.K.uf=t,this.c();let i=this.panel;i!==null&&(i.ss=null),this.t("interval",e,t)}}get graduatedStart(){return this.K!==null?this.K.df:0}set graduatedStart(t){let e=this.graduatedStart;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new Ae),this.K.df=t,this.c(),this.t("graduatedStart",e,t))}get graduatedEnd(){return this.K!==null?this.K.gf:1}set graduatedEnd(t){let e=this.graduatedEnd;e!==t&&(t<0?t=0:t>1&&(t=1),this.K===null&&(this.K=new Ae),this.K.gf=t,this.c(),this.t("graduatedEnd",e,t))}get graduatedFunction(){return this.K!==null?this.K.Lp:null}set graduatedFunction(t){let e=this.graduatedFunction;e!==t&&(t!==null&&f.k(t,xt,"graduatedFunction"),this.K===null&&(this.K=new Ae),this.K.Lp=t,this.c(),this.t("graduatedFunction",e,t))}get graduatedSkip(){return this.K!==null?this.K.mf:null}set graduatedSkip(t){let e=this.graduatedSkip;e!==t&&(t!==null&&f.k(t,xt,"graduatedSkip"),this.K===null&&(this.K=new Ae),this.K.mf=t,this.c(),this.t("graduatedSkip",e,t))}gh(t,e){if(this.ji===null||this.ri.length===0||this.mn===null)return;let i=this.naturalBounds,s=this.actualBounds,n=i.width,o=i.height,r=this.Np(),a=t.textAlign=this.textAlign,h=e.zu;a==="start"?a=h?"right":"left":a==="end"&&(a=h?"left":"right");let l=this.isUnderline,u=this.isStrikethrough;this.rn(t,this.ji,!0,!1,i,s),(l||u)&&this.rn(t,this.ji,!1,!1,i,s);let c=0,d=0,g=n,p=!1;e.Qt===t&&!(e.Qt instanceof ce)&&!this.V2&&e.getRenderingHint("textGreeking")===!0&&r*this.da*e.scale<3&&(p=!0);let m=this.spacingAbove,y=this.spacingBelow;switch(this.flip){case 0:break;case 2:t.translate(n,0),t.scale(-1,1);break;case 1:t.translate(0,o),t.scale(1,-1);break;case 3:t.translate(n,o),t.scale(-1,-1);break}t.commitTransform();let w=this.ge,b=(m+r+y)*w;if(o>b){let v=this.verticalAlignment;d=v.y*o-v.y*b+v.offsetY}if(w===1&&this.yn!==null){let v=this.ui;v>g&&(v=g),d+=m,this.$A(this.yn,t,c,d,g,r,v,p,a,l,u)}else if(this.Ce!==null&&this.Ti!==null)for(let v=0;v<w;v++){let k=this.Ce[v];k>g&&(k=g),d+=m,this.$A(this.Ti[v],t,c,d,g,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}}$A(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=xt.h1!==null?xt.h1(this,o):o*.75;e.fillText(t,i+c,s+d);let g=o/20|0;if(g===0&&(g=1),h==="right"?c-=r:h==="center"&&(c-=r/2),l){let p=xt.a1!==null?xt.a1(this,o):o*.8;this.ZA(i+c,s+p,i+c+r,s+p,g,e),e instanceof ce&&e.lastCreatedElement.classList.add("gojs-td")}if(u){let p=s+o-o/2.2|0;g%2!==0&&(p+=.5),this.ZA(i+c,p,i+c+r,p,g,e),e instanceof ce&&e.lastCreatedElement.classList.add("gojs-td")}}ZA(t,e,i,s,n,o){o.beginPath(),o.lineWidth=n,o.moveTo(t,e),o.lineTo(i,s),o.stroke(),o.endPath()}Zc(t,e,i){if(!super.Zc(t,e,i))return!1;if(this.rn(t,this.ji,!0,!1,this.naturalBounds,this.actualBounds),i){if(this.svg.getElementsByTagName("text").length===0)return!0;let s=this.svg.getElementsByClassName("gojs-td");for(let n=0;n<s.length;n++)t.setFillOrStrokeInPlace(s[n],!1)}else this.jv(this.svg,this.text,t);return!0}jv(t,e,i){t.innerHTML=e,i.setFillOrStrokeInPlace(t,!0)}$u(t){return this.lineCount>1||this.isUnderline||this.isStrikethrough?!0:super.$u(t)}k2(t,e){if(t.nodeName!=="g")t.setAttributeNS(null,"filter",e);else{let i=t.getElementsByTagName("text");for(let s=0;s<i.length;s++)i[s].setAttributeNS(null,"filter",e)}}Hv(){this.pn=0,this.ui=0,this.io=null,this.Ce=null,this.Ti=null,this.yn=null}Wu(t,e,i,s){let n=this.ge;this.Dl=t,this.$2(!1);let o=this.mn;xt._n!==null&&xt.QA!==o&&(xt._n.font=o,xt.QA=o),this.Hv();let r=0,a=0;isNaN(this.desiredSize.width)?(r=this.qv(),r=Math.min(r,t/this.scale)):r=this.desiredSize.width,this.panel!==null&&(r=Math.min(r,this.panel.maxSize.width)),a=this.JA(r),isNaN(this.desiredSize.height)?a=Math.min(a,e/this.scale):a=this.desiredSize.height,this.Wv(t,a),(this.wrap===1||isNaN(this.desiredSize.width))&&(r=isNaN(t)?this.ui:Math.min(t,this.ui)),r=Math.max(i,r),a=Math.max(s,a),this.zi.Fn(r,a),this.Wn(0,0,r,a),this.svg!==null&&n!==this.ge&&this.Ve(!0)}uh(t,e,i,s){this.commonArrange(t,e,i,s)}xn(t,e){this.yn===null?(this.yn=t,this.ui=e):((this.Ti===null||this.Ce===null)&&(this.Ti=[],this.Ce=[],this.Ti.push(this.yn),this.Ce.push(this.ui)),this.Ti.push(t),this.Ce.push(e),this.Ti.length>this.maxLines&&(this.n|=16777216))}J2(t,e,i){let s=this.formatting===0;s&&(t=t.trim());let n=0,o=0,r=0,a=this.mn,h=this.spacingAbove+this.spacingBelow,l=Math.max(0,this.Np()+h),u=this.overflow===1?this._A(a):0;if(this.ge>=this.maxLines){i!==null&&i.i(0,l);return}let c=t;if(this.wrap===0){if(this.pn=1,o=this.getStringWidth(t),u===0||o<=e){this.ui=Math.max(this.ui,o),this.xn(t,this.ui),i!==null&&i.i(o,l);return}let g=this.xd(c);c=c.substring(g.length);let p=this.xd(c);for(o=this.getStringWidth(g+p),r=0;p.length>0&&o<=e;){g+=p,c=c.substring(p.length),p=this.xd(c),r=o;let m=g+p;s&&(m=m.trim()),o=this.getStringWidth(m)}for(s&&(p=p.trim()),g+=p,e=Math.max(1,e-u);this.getStringWidth(g)>e&&g.length>1;)g=g.substring(0,g.length-1);this.$2(!0),g+=xt.kp,r=this.getStringWidth(g),this.ui=r,this.xn(g,r),i!==null&&i.i(r,l);return}let d=0;for(c.length===0&&(d=1,this.xn(c,0));c.length>0;){let g=this.xd(c);for(c=c.substring(g.length);this.getStringWidth(g)>e;){let y=1;for(o=this.getStringWidth(g.substring(0,y)),r=0;o<=e;)y++,r=o,o=this.getStringWidth(g.substring(0,y));let w=0;y===1?(w=o,n=Math.max(n,o)):(w=r,n=Math.max(n,r)),y--,y<1&&(y=1);let b=g.substring(0,y);if(this.xn(b,w),d++,g=g.substring(y),this.ge+d>this.maxLines)break}let p=this.xd(c);for(o=this.getStringWidth(g+p),r=0;p.length>0&&o<=e;){g+=p,c=c.substring(p.length),p=this.xd(c),r=o;let y=g+p;s&&(y=y.trim()),o=this.getStringWidth(y)}if(s&&(g=g.trim()),g==="")continue;g[g.length-1]==="\xAD"&&(g=g.substring(0,g.length-1)+"\u2010");let m=0;if(p.length===0?(m=o,n=Math.max(n,o)):(r=this.getStringWidth(g),m=r,n=Math.max(n,r)),this.xn(g,m),d++,this.ge+d>this.maxLines)break}this.pn=Math.min(this.maxLines-this.ge,d),this.ui=Math.max(this.ui,n),i!==null&&i.i(this.ui,l*this.pn)}Wv(t,e){if(this.ui===0||this.Ce===null||this.Ti===null||this.overflow!==1)return;let i=this.mn,s=this.overflow===1?this._A(i):0,n=this.spacingAbove+this.spacingBelow,o=Math.max(0,this.Np()+n),r=Math.min(this.maxLines-1,Math.max(Math.floor(e/o+.01)-1,0));if(r+1>=this.Ti.length)return;this.$2(!0);let a=this.Ti[r],h=Math.max(1,t-s);for(;this.getStringWidth(a)>h&&a.length>1;)a=a.substring(0,a.length-1);a+=xt.kp;let l=this.getStringWidth(a);this.Ti[r]=a,this.Ti=this.Ti.slice(0,r+1),this.Ce[r]=l,this.Ce=this.Ce.slice(0,r+1),this.pn=this.Ti.length,this.ui=Math.max(this.ui,l),this.ge=this.pn,this.ge===1&&(this.yn=this.Ti[0])}xd(t){if(this.wrap===3)return t.substring(0,1);let e=t.length,i=0,s=xt.Jv;for(;i<e&&!s.test(t.charAt(i));)i++;for(this.formatting===1&&(e=Math.min(e,i+1));i<e&&s.test(t.charAt(i));)i++;return i>=t.length?t:t.substring(0,i)}getStringWidth(t){return xt._n===null?t.length*8:xt._n.measureText(t).width}Np(){if(this.io!==null)return this.io;let t=this.mn,e=0;return xt._n===null?(e=16,this.io=e,e):(xt.Z2[t]!==void 0&&xt.tT<5e3?e=xt.Z2[t]:(e=xt._n.measureText("M").width*1.3,xt.Z2[t]=e,xt.tT++),this.io=e,e)}_A(t){if(xt._n===null)return 6;let e=0;return xt.l1[t]!==void 0&&xt.W2<5e3?e=xt.l1[t]:(e=xt._n.measureText(xt.kp).width,xt.l1[t]=e,xt.W2++),e}c1(t,e){return t.indexOf(`
|
10
10
|
`,e)}JA(t){let e=this.ri.replace(/\r\n/g,`
|
11
11
|
`).replace(/\r/g,`
|
12
12
|
`),i=this.spacingAbove+this.spacingBelow,s=Math.max(0,this.Np()+i);if(e.length===0)return this.ui=0,this.ge=1,s;if(!this.isMultiline){let h=this.c1(e,0);h>=0&&(e=e.substring(0,h))}let n=0;this.ge=0;let o=0,r=-1,a=!1;for(;!a;){if(r=this.c1(e,o),r===-1&&(r=e.length,a=!0),o<=r){let h=e.substring(o,r);if(this.wrap!==0){this.pn=0;let l=Q.l();this.J2(h,t,l),n+=l.height,Q.e(l),this.ge+=this.pn}else this.J2(h,t,null),n+=s,this.ge++;this.ge===this.maxLines&&(a=!0)}o=r+1}return this.w0=n,n}qv(){let t=this.ri.replace(/\r\n/g,`
|