@oscloudlab/knowledge-card 0.0.44 → 0.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/dist/{abap-B_RvGT1W.js → abap-FaBQqe3G.js} +1 -1
  2. package/dist/{abnf-Da5NYEK8.js → abnf-qPY37JaL.js} +1 -1
  3. package/dist/{actionscript-BK3NLLEi.js → actionscript-B7ddPAmK.js} +1 -1
  4. package/dist/{ada-CIkGtkmT.js → ada-DOt3wO7t.js} +1 -1
  5. package/dist/{agda-CJ-WD5GS.js → agda-DIAQ19cG.js} +1 -1
  6. package/dist/{al-Duppn1NH.js → al-CEjuczT3.js} +1 -1
  7. package/dist/{antlr4-C0LC4kqT.js → antlr4-CL5bV3xX.js} +1 -1
  8. package/dist/{apacheconf-xnxkmGxR.js → apacheconf-BA_Z59im.js} +1 -1
  9. package/dist/{apex-IgW-z7Rb.js → apex-C5Uy_LlV.js} +1 -1
  10. package/dist/{apl-Y4-Y2eGr.js → apl-CSu_R79O.js} +1 -1
  11. package/dist/{applescript-CPxMpqjc.js → applescript-CyI9nF8F.js} +1 -1
  12. package/dist/{aql-CA23JvXC.js → aql-DlRUB6JZ.js} +1 -1
  13. package/dist/{arduino-BULzzk2r.js → arduino-DpU3jofl.js} +1 -1
  14. package/dist/{arff-CP7qDs58.js → arff-tm5DxOLX.js} +1 -1
  15. package/dist/{asciidoc-DPK80Y-p.js → asciidoc-BKwgvxmL.js} +1 -1
  16. package/dist/{asm6502-Ca3twUYn.js → asm6502-C6KHnGae.js} +1 -1
  17. package/dist/{asmatmel-DmeKDEBp.js → asmatmel-DhfyR2bK.js} +1 -1
  18. package/dist/{aspnet-CxQ8dN1r.js → aspnet-Db4hmpHd.js} +1 -1
  19. package/dist/{autohotkey-D73NyKGu.js → autohotkey-l-3mPr8U.js} +1 -1
  20. package/dist/autohotkey-l-3mPr8U.js.gz +0 -0
  21. package/dist/{autoit-D_O2gEoR.js → autoit-BJpbSrf8.js} +1 -1
  22. package/dist/{avisynth-gSTVt7WG.js → avisynth-B94MiMSy.js} +1 -1
  23. package/dist/{avro-idl-E3JhLo-9.js → avro-idl-DCQwDfTr.js} +1 -1
  24. package/dist/{bash-BhTTuYXx.js → bash-MhLVifU1.js} +1 -1
  25. package/dist/{basic-KnQishnd.js → basic-DVpDyZWV.js} +1 -1
  26. package/dist/{batch-C5JVCT8C.js → batch-B6AqdSpB.js} +1 -1
  27. package/dist/{bbcode-BazFdBdt.js → bbcode-C5kLBnuC.js} +1 -1
  28. package/dist/{bicep-BNYe6kAm.js → bicep-DEdTZW_R.js} +1 -1
  29. package/dist/{birb-3K9xQBhv.js → birb-BxKxzmg_.js} +1 -1
  30. package/dist/{bison-CdAHkimD.js → bison-CwYs0KQa.js} +1 -1
  31. package/dist/{bnf-2lhLdXa-.js → bnf-CtgB05jy.js} +1 -1
  32. package/dist/{brainfuck-Bh-kejQF.js → brainfuck-2i7wQH1Q.js} +1 -1
  33. package/dist/{brightscript-B406dmnC.js → brightscript-ov3YMRyU.js} +1 -1
  34. package/dist/{bro-aijue4cZ.js → bro-DrTUO-4z.js} +1 -1
  35. package/dist/{bsl-DozzTXn4.js → bsl-DjgHRHkL.js} +1 -1
  36. package/dist/{c-zOf9tLkE.js → c-e849bloQ.js} +1 -1
  37. package/dist/{cfscript-CCOzqRzX.js → cfscript-C99TCT39.js} +1 -1
  38. package/dist/{chaiscript-DPqYey8y.js → chaiscript-DDKMKzR0.js} +1 -1
  39. package/dist/{cil-DP-dB7Dv.js → cil-bZ4e4u8P.js} +1 -1
  40. package/dist/{clike-Bf5brrRK.js → clike-BSSLx3J7.js} +1 -1
  41. package/dist/{clojure-BWdasfv9.js → clojure-CbnoRwNm.js} +1 -1
  42. package/dist/{cmake-BB8Suvou.js → cmake-DaGpzQ3n.js} +1 -1
  43. package/dist/cmake-DaGpzQ3n.js.gz +0 -0
  44. package/dist/{cobol-BC6DLhy1.js → cobol-DvkKYKNx.js} +1 -1
  45. package/dist/{coffeescript-B9_BUCmR.js → coffeescript-D09w4YEC.js} +1 -1
  46. package/dist/{concurnas-BCxfxCTS.js → concurnas-xIfD43mE.js} +1 -1
  47. package/dist/{coq-BSVzsI81.js → coq-DyhfXI69.js} +1 -1
  48. package/dist/{core-COvHOxVn.js → core-CRBGs4R9.js} +5 -5
  49. package/dist/core-CRBGs4R9.js.gz +0 -0
  50. package/dist/{cpp-DFtn5kvn.js → cpp-C0zM3w_k.js} +1 -1
  51. package/dist/{crystal-Z9kPArWH.js → crystal-Dp8g0lEp.js} +1 -1
  52. package/dist/{csharp-BmR0XQvm.js → csharp-BD5-e2UP.js} +1 -1
  53. package/dist/{cshtml-CNCfNwPi.js → cshtml-XjdsExbo.js} +1 -1
  54. package/dist/{csp-CCYxtm9J.js → csp-B6qiG2IQ.js} +1 -1
  55. package/dist/{css-DGGxZk7P.js → css-Nh58TSp3.js} +1 -1
  56. package/dist/{css-extras-BtnB93Jf.js → css-extras-Doq47IoR.js} +1 -1
  57. package/dist/{csv-D6bjgry_.js → csv-qRFb_HYh.js} +1 -1
  58. package/dist/{cypher-CS4AkEkD.js → cypher-d7adOJI1.js} +1 -1
  59. package/dist/{d-DVMzSuSK.js → d-C_hYNj2u.js} +1 -1
  60. package/dist/{dart-VRBoex-F.js → dart-ZDPdl21Z.js} +1 -1
  61. package/dist/{dataweave-8I5j4DQ7.js → dataweave-CiOHXUP6.js} +1 -1
  62. package/dist/{dax-Ru0tby1x.js → dax-DLNHAnXP.js} +1 -1
  63. package/dist/{dhall-BXdm7gnI.js → dhall-C3fF416P.js} +1 -1
  64. package/dist/{diff-D1WD3UWw.js → diff-DmieDC2r.js} +1 -1
  65. package/dist/{django-M2SpbmRK.js → django-CX-yjls4.js} +1 -1
  66. package/dist/{dns-zone-file-DhFSMLcO.js → dns-zone-file-CHjaFDjT.js} +1 -1
  67. package/dist/{docker-DbkATPJp.js → docker-D3iUkILx.js} +1 -1
  68. package/dist/{dot-U1CGbB0J.js → dot-DC21M8aI.js} +1 -1
  69. package/dist/{ebnf-BlbDjBik.js → ebnf-CtO7msp0.js} +1 -1
  70. package/dist/{editorconfig-BoWACFwe.js → editorconfig-CN9yqOfN.js} +1 -1
  71. package/dist/{eiffel-CqgIdq4g.js → eiffel-KU6r2Ipa.js} +1 -1
  72. package/dist/{ejs-ojawECfW.js → ejs-D0jWZeCl.js} +1 -1
  73. package/dist/{elixir-BP5wDLM8.js → elixir-Bv1F-i60.js} +1 -1
  74. package/dist/{elm-HGIlSdAo.js → elm-D3Lmh8wx.js} +1 -1
  75. package/dist/{erb-xICEHP-Q.js → erb-zFB2kYBi.js} +1 -1
  76. package/dist/{erlang-C_1SzvhQ.js → erlang-DO9t24aZ.js} +1 -1
  77. package/dist/{etlua-CnRdoA3P.js → etlua-DONylRDa.js} +1 -1
  78. package/dist/{excel-formula-BJLW1Wjy.js → excel-formula-B1r9nxAD.js} +1 -1
  79. package/dist/{factor-CXL0uiBl.js → factor-CeC2pJwZ.js} +1 -1
  80. package/dist/factor-CeC2pJwZ.js.gz +0 -0
  81. package/dist/{false-DByg52K7.js → false-Cda8jl71.js} +1 -1
  82. package/dist/{firestore-security-rules-BXCig2YZ.js → firestore-security-rules-C7jOPHSF.js} +1 -1
  83. package/dist/{flow-BwViD8Be.js → flow-P5ykGR6f.js} +1 -1
  84. package/dist/{fortran-D0MQGcgf.js → fortran-v0MQv05h.js} +1 -1
  85. package/dist/{fsharp-2PQoaoRe.js → fsharp-B2hJus1Y.js} +1 -1
  86. package/dist/{ftl-D_9hR4SF.js → ftl-TZc81FUY.js} +1 -1
  87. package/dist/{gap-C4-y_IY7.js → gap-DrKJWuos.js} +1 -1
  88. package/dist/{gcode-6zRK6Zdt.js → gcode-CjtjRPig.js} +1 -1
  89. package/dist/{gdscript-DiUv5MSk.js → gdscript-5dBtaKrQ.js} +1 -1
  90. package/dist/{gedcom-cQu9HG-b.js → gedcom-BC4SrM0s.js} +1 -1
  91. package/dist/{gherkin-DZGUtMQp.js → gherkin-CC0CPefz.js} +1 -1
  92. package/dist/gherkin-CC0CPefz.js.gz +0 -0
  93. package/dist/{git-hkjLG9BG.js → git-Dqd8zj0e.js} +1 -1
  94. package/dist/{glsl-SFK1tN2W.js → glsl-CbFzEDmd.js} +1 -1
  95. package/dist/{gml-CiXHLDLw.js → gml-Balu98-o.js} +1 -1
  96. package/dist/{gn-BeWk0mBu.js → gn-DkPCw9B8.js} +1 -1
  97. package/dist/{go-cRWjprV1.js → go-D3UHEaFS.js} +1 -1
  98. package/dist/{go-module-BRYcQpct.js → go-module-DPRx2Bha.js} +1 -1
  99. package/dist/{graphql-B119Ny7f.js → graphql-jAXK-30r.js} +1 -1
  100. package/dist/{groovy-CQ0wzPw7.js → groovy-q3n3j6kW.js} +1 -1
  101. package/dist/{haml-CZ50chOh.js → haml-Dllo9Fv4.js} +1 -1
  102. package/dist/{handlebars-QdReietn.js → handlebars-B1s4NqQ1.js} +1 -1
  103. package/dist/{haskell-DMaF4fb0.js → haskell-Br6cNRAa.js} +1 -1
  104. package/dist/{haxe-COz3iuuV.js → haxe-Bk-799hO.js} +1 -1
  105. package/dist/{hcl-BQjLUjJN.js → hcl-C74bdFyU.js} +1 -1
  106. package/dist/{hlsl-C8rQlk9a.js → hlsl-B8Caskev.js} +1 -1
  107. package/dist/{hoon-D0XYxeZG.js → hoon-iZy5meN1.js} +1 -1
  108. package/dist/{hpkp-BxZpP4TA.js → hpkp-0_ay5TDr.js} +1 -1
  109. package/dist/{hsts--Zl3v6Pi.js → hsts-mowF2rQs.js} +1 -1
  110. package/dist/{http-X-mNo8Ej.js → http-DjN2LrT7.js} +1 -1
  111. package/dist/{ichigojam-78ziS22z.js → ichigojam-Buq0Xilg.js} +1 -1
  112. package/dist/{icon-IBHy0fCz.js → icon-DU4we2W6.js} +1 -1
  113. package/dist/{icu-message-format-BHq0Ue-A.js → icu-message-format-DUaqyeLv.js} +1 -1
  114. package/dist/{idris-CuPtey28.js → idris-ByJIE2OZ.js} +1 -1
  115. package/dist/{iecst-DTDZmmip.js → iecst-ClatWaK7.js} +1 -1
  116. package/dist/{ignore-D-Oq4Rvn.js → ignore-DWhMRJDE.js} +1 -1
  117. package/dist/{index-CNmPdS1o.js → index-KOWnzW_B.js} +279 -279
  118. package/dist/{index-CNmPdS1o.js.gz → index-KOWnzW_B.js.gz} +0 -0
  119. package/dist/{inform7-CPmHCqP4.js → inform7-qBIr4xrH.js} +1 -1
  120. package/dist/{ini-DJgdYRcT.js → ini-XMD2hqFP.js} +1 -1
  121. package/dist/{io-g-4b_E52.js → io-wr5pfc9E.js} +1 -1
  122. package/dist/{j-BbVciqxy.js → j-DjZmJvHu.js} +1 -1
  123. package/dist/{java-D0kzHsl5.js → java-B2Lp3wCP.js} +1 -1
  124. package/dist/{javadoc-CzVh2mvU.js → javadoc-Dpgamn7w.js} +1 -1
  125. package/dist/{javadoclike-CO9tt67f.js → javadoclike-CI1ehf6F.js} +1 -1
  126. package/dist/{javascript-DfLwGNNP.js → javascript-DMj3oSlQ.js} +1 -1
  127. package/dist/{javastacktrace-DVNaWmFH.js → javastacktrace-BN4bbFIw.js} +1 -1
  128. package/dist/{jexl-DhgAfwq1.js → jexl-Wz_XtV8u.js} +1 -1
  129. package/dist/{jolie-DwuyuLNi.js → jolie-CIUUpaS0.js} +1 -1
  130. package/dist/{jq-C966r57O.js → jq-C9Mw-Am9.js} +1 -1
  131. package/dist/{js-extras-lkEcRMCs.js → js-extras-CqtFH7Bj.js} +1 -1
  132. package/dist/{js-templates-f6JSYnMM.js → js-templates-BDWNzPZ3.js} +1 -1
  133. package/dist/{jsdoc-C6jlhzN5.js → jsdoc-DpPxVuo1.js} +1 -1
  134. package/dist/{json-DZkIzimH.js → json-ChLXKDM4.js} +1 -1
  135. package/dist/{json5-Dwrxku3S.js → json5-C6mJ7nhb.js} +1 -1
  136. package/dist/{jsonp-h8KMPwq8.js → jsonp-DaNrsLSG.js} +1 -1
  137. package/dist/{jsstacktrace-DjbJ13FT.js → jsstacktrace-BjWTO5Mj.js} +1 -1
  138. package/dist/{jsx-3wYQhKVW.js → jsx-D1jEQV3q.js} +1 -1
  139. package/dist/{julia-1vHfnXqM.js → julia-COBqirv-.js} +1 -1
  140. package/dist/{keepalived-C1kvpaFQ.js → keepalived-Cm7oM4ma.js} +1 -1
  141. package/dist/{keyman-DZtUPp9T.js → keyman-DDbkRI3e.js} +1 -1
  142. package/dist/knowledge-card.es.js +1 -1
  143. package/dist/knowledge-card.umd.js +1 -1
  144. package/dist/knowledge-card.umd.js.gz +0 -0
  145. package/dist/{kotlin-DmpBAAw0.js → kotlin-CihRbJqG.js} +1 -1
  146. package/dist/{kumir-C4MMIsgb.js → kumir-ze0QxAMI.js} +1 -1
  147. package/dist/{kusto-DYeJI8u1.js → kusto-Dfgg2ZQk.js} +1 -1
  148. package/dist/{latex-Bg5BBpu4.js → latex-DFGwoVRI.js} +1 -1
  149. package/dist/{latte-DeypZomK.js → latte-CkvPEDIs.js} +1 -1
  150. package/dist/{less-Wf3TN6IF.js → less-CJltX1Bf.js} +1 -1
  151. package/dist/{lilypond-CE-9uF9h.js → lilypond-DDN0kG1T.js} +1 -1
  152. package/dist/{liquid-8tre9e1n.js → liquid-CFAcXsN2.js} +1 -1
  153. package/dist/{lisp-Ck2iEIwo.js → lisp-B56Qt8hC.js} +1 -1
  154. package/dist/{livescript-c78xywuo.js → livescript-BcP38hBg.js} +1 -1
  155. package/dist/{llvm-JAELsqT-.js → llvm-C-ch2oY1.js} +1 -1
  156. package/dist/{log-LwDsMx3Q.js → log-D2ZhxsEp.js} +1 -1
  157. package/dist/{lolcode-Clrbq0Ki.js → lolcode-BivTDTeW.js} +1 -1
  158. package/dist/{lua-BbiI6GKy.js → lua-DCLcu4F7.js} +1 -1
  159. package/dist/{magma-X-OpL3xv.js → magma-BP8jaqs7.js} +1 -1
  160. package/dist/{makefile-dhZEIec5.js → makefile-DlojReEG.js} +1 -1
  161. package/dist/{markdown-CFbjkq43.js → markdown-CMaFtJRH.js} +1 -1
  162. package/dist/markdown-CMaFtJRH.js.gz +0 -0
  163. package/dist/{markup-Dtys3GX3.js → markup-DWBp1vbn.js} +1 -1
  164. package/dist/{markup-templating-CHJfLrv0.js → markup-templating-BuzPmlGo.js} +1 -1
  165. package/dist/{matlab-CAoWQiX3.js → matlab-DHZM8US9.js} +1 -1
  166. package/dist/{maxscript-T64yAPtV.js → maxscript-Db9F3Gl9.js} +1 -1
  167. package/dist/{mel-BKnRl7Jr.js → mel-yTNXi0TO.js} +1 -1
  168. package/dist/mel-yTNXi0TO.js.gz +0 -0
  169. package/dist/{mermaid-BXucFcoP.js → mermaid-Bil0y0pK.js} +1 -1
  170. package/dist/{mizar-DqPqfMGP.js → mizar-_5UPS__m.js} +1 -1
  171. package/dist/{mongodb-B0EW0epG.js → mongodb-BhC_CMmb.js} +1 -1
  172. package/dist/{monkey-BTlI_lWw.js → monkey-D5gHE3hU.js} +1 -1
  173. package/dist/{moonscript-Caa7usO0.js → moonscript-CfAf5kwK.js} +1 -1
  174. package/dist/{n1ql-SytxWQxm.js → n1ql-Bvmv0KUi.js} +1 -1
  175. package/dist/{n4js-BfRaRFyK.js → n4js-COl_v0LL.js} +1 -1
  176. package/dist/{nand2tetris-hdl-DF86ALer.js → nand2tetris-hdl-Bg0VCAzN.js} +1 -1
  177. package/dist/{naniscript-KoNfUsUT.js → naniscript-rtj_-tV5.js} +1 -1
  178. package/dist/{nasm-BD70kjaf.js → nasm-VnAeB9TF.js} +1 -1
  179. package/dist/{neon-BocHsXci.js → neon-DORLTz42.js} +1 -1
  180. package/dist/{nevod-BzS91Lz5.js → nevod-DJ36j9GE.js} +1 -1
  181. package/dist/{nginx-BeUHf2vS.js → nginx-Dj4vwRGQ.js} +1 -1
  182. package/dist/{nim-Dhhg2jxR.js → nim-CJ98Z6OW.js} +1 -1
  183. package/dist/{nix-CkNvlPhQ.js → nix-B-ssod5b.js} +1 -1
  184. package/dist/{nsis-DTn1cIQu.js → nsis-Cx9KfORO.js} +1 -1
  185. package/dist/{objectivec-D6_lFvCM.js → objectivec-Dz5qummh.js} +1 -1
  186. package/dist/{ocaml-vwdRi_Rj.js → ocaml-DlbOUIv2.js} +1 -1
  187. package/dist/{opencl--oajoxMm.js → opencl-DLx0yCBW.js} +1 -1
  188. package/dist/opencl-DLx0yCBW.js.gz +0 -0
  189. package/dist/{openqasm-Davf3ivK.js → openqasm-DQLQH5R0.js} +1 -1
  190. package/dist/{oz-jG17Jgx5.js → oz-D_7qSduF.js} +1 -1
  191. package/dist/{parigp-Cw_lEI5a.js → parigp-jbqR-kzg.js} +1 -1
  192. package/dist/{parser-DK-HLV2z.js → parser-BBFIaap3.js} +1 -1
  193. package/dist/{pascal-BBLv644C.js → pascal-CM2dMZKW.js} +1 -1
  194. package/dist/{pascaligo-BKlk8KzP.js → pascaligo-0g_uEhiK.js} +1 -1
  195. package/dist/{pcaxis-DTwY6TbS.js → pcaxis-Dtk0kCyJ.js} +1 -1
  196. package/dist/{peoplecode-DyYerUdC.js → peoplecode-DMW02fj3.js} +1 -1
  197. package/dist/{perl-DNvjbQ5L.js → perl-Duvutncj.js} +1 -1
  198. package/dist/{php-yf8ZKS5n.js → php-CRbS_2UG.js} +1 -1
  199. package/dist/{php-extras-BKgQbDZg.js → php-extras-NT8W640k.js} +1 -1
  200. package/dist/{phpdoc-BkM0mqcx.js → phpdoc-vgBGvegj.js} +1 -1
  201. package/dist/{plsql-BAKgLqcJ.js → plsql-D5_nS_F0.js} +1 -1
  202. package/dist/{powerquery-DV08i9Kc.js → powerquery-D9wV3Af3.js} +1 -1
  203. package/dist/{powershell-gPYuhmzC.js → powershell-Dd78xCkl.js} +1 -1
  204. package/dist/{processing-36PUp_Sh.js → processing-DhroGH4O.js} +1 -1
  205. package/dist/{prolog-UvHUoiIp.js → prolog-DlNuFWFP.js} +1 -1
  206. package/dist/{promql-CTVfcs8c.js → promql-CSTkVIXW.js} +1 -1
  207. package/dist/{properties-DsGOQdgp.js → properties-B3gMrJsX.js} +1 -1
  208. package/dist/{protobuf-DW8NtB8f.js → protobuf-Bqp94EoR.js} +1 -1
  209. package/dist/{psl-tQs2sqaO.js → psl-BE-mW8Dd.js} +1 -1
  210. package/dist/{pug-B-GNlTBm.js → pug-Dg_ukWpc.js} +1 -1
  211. package/dist/{puppet-DibcCqfZ.js → puppet-CxtTjJTm.js} +1 -1
  212. package/dist/{pure-COXObEc8.js → pure-BKXaJnPl.js} +1 -1
  213. package/dist/{purebasic-BAZWN3iP.js → purebasic-CpgX9M-n.js} +1 -1
  214. package/dist/{purescript-BO-7gK32.js → purescript-2VmQ0lC1.js} +1 -1
  215. package/dist/{python-DG7BAqlU.js → python-BTBHPjI_.js} +1 -1
  216. package/dist/{q-C3X1xDGa.js → q-DqpQRCZO.js} +1 -1
  217. package/dist/{qml-C3nJI1Fh.js → qml-B4xXJ_AF.js} +1 -1
  218. package/dist/{qore-GIMIYunO.js → qore-Bgn3ilPc.js} +1 -1
  219. package/dist/{qsharp-WsgYYKw7.js → qsharp-BEuW3n0Q.js} +1 -1
  220. package/dist/{r-BOTfspgu.js → r-Dl3LW0Bl.js} +1 -1
  221. package/dist/{racket-BVe5KZ2H.js → racket-BpSI5E_4.js} +1 -1
  222. package/dist/{reason-QycL9YBF.js → reason-tAUsOQZk.js} +1 -1
  223. package/dist/{regex-lvOcY5QM.js → regex-BnJVAkmm.js} +1 -1
  224. package/dist/{rego-0TsWfkCj.js → rego-DpncZepN.js} +1 -1
  225. package/dist/{renpy-CfY2pwrl.js → renpy-OH-d5u1Y.js} +1 -1
  226. package/dist/{rest-C6Xn24vg.js → rest-B0O3MIei.js} +1 -1
  227. package/dist/{rip-H-3ShIfa.js → rip-CIBJxQrA.js} +1 -1
  228. package/dist/{roboconf-OtJU0ksl.js → roboconf-CIm8ht1q.js} +1 -1
  229. package/dist/{robotframework-CQA_U8Ei.js → robotframework-Crj5RRPn.js} +1 -1
  230. package/dist/{ruby-OreFTpou.js → ruby-BjEf_KLo.js} +1 -1
  231. package/dist/{rust-BW8gFrsR.js → rust-CkkyKRrI.js} +1 -1
  232. package/dist/{sas-DPotHK3-.js → sas-DyFpZDYp.js} +1 -1
  233. package/dist/sas-DyFpZDYp.js.gz +0 -0
  234. package/dist/{sass-nUXd0z-Y.js → sass-Hm0ueTBt.js} +1 -1
  235. package/dist/{scala-BXzS9BwR.js → scala-C7KDVfer.js} +1 -1
  236. package/dist/{scheme-H-ttC3Yx.js → scheme-CCzD-FLK.js} +1 -1
  237. package/dist/{scss-DkG8rlLh.js → scss-BuZ5o4Ci.js} +1 -1
  238. package/dist/{shell-session-CryX7ivH.js → shell-session-D-nLap2k.js} +1 -1
  239. package/dist/{smali-TB5pTHpb.js → smali-DtotaoPt.js} +1 -1
  240. package/dist/{smalltalk-TWk2d7cz.js → smalltalk-DK5L24br.js} +1 -1
  241. package/dist/{smarty-DTuBV-gp.js → smarty-w8IO2v8f.js} +1 -1
  242. package/dist/{sml-BWHuauDb.js → sml-DWjNT7mQ.js} +1 -1
  243. package/dist/{solidity-Ce5-vBaO.js → solidity-1uBWY1No.js} +1 -1
  244. package/dist/{solution-file-DssrqkE4.js → solution-file-DTbGGdNj.js} +1 -1
  245. package/dist/{soy-CzxMGGxb.js → soy-DCDps9LI.js} +1 -1
  246. package/dist/{sparql-DYOMUk5a.js → sparql-BkCHY4BQ.js} +1 -1
  247. package/dist/{splunk-spl-DwPW5eh6.js → splunk-spl-0q1T6zBU.js} +1 -1
  248. package/dist/{sqf-_T_mo7om.js → sqf-BqbMZDcQ.js} +1 -1
  249. package/dist/sqf-BqbMZDcQ.js.gz +0 -0
  250. package/dist/{sql-CCkauzum.js → sql-BF_7Z4YM.js} +1 -1
  251. package/dist/{squirrel-DiT0kUIK.js → squirrel-BGTONAb4.js} +1 -1
  252. package/dist/{stan-jHzObOA_.js → stan-Dd_NPDVg.js} +1 -1
  253. package/dist/{stylus-BMABZhdS.js → stylus-ImnCRylR.js} +1 -1
  254. package/dist/{swift-D3MY6wkH.js → swift-BqpLpBIn.js} +1 -1
  255. package/dist/{systemd-ClpjYBJP.js → systemd-suuEQgUE.js} +1 -1
  256. package/dist/{t4-cs-fu0qBLwr.js → t4-cs-Cvf6ZbzX.js} +1 -1
  257. package/dist/{t4-templating-ByZXeJOm.js → t4-templating-DegfU-Oy.js} +1 -1
  258. package/dist/{t4-vb-CKfcalIV.js → t4-vb-CteD9Mcl.js} +1 -1
  259. package/dist/{tap-DWq5h2LC.js → tap-DFi-DKr-.js} +1 -1
  260. package/dist/{tcl-CdEO_bH9.js → tcl-D9QVqfGN.js} +1 -1
  261. package/dist/{textile-0VUrN_8s.js → textile-w6hLx2cW.js} +1 -1
  262. package/dist/textile-w6hLx2cW.js.gz +0 -0
  263. package/dist/{toml-D4ndRmG0.js → toml-L1lR2wId.js} +1 -1
  264. package/dist/{tremor-D9KYKNx4.js → tremor-B_tPlHh5.js} +1 -1
  265. package/dist/{tsx-4fZWT8rl.js → tsx-jCabGMvN.js} +1 -1
  266. package/dist/{tt2-DObDlrDh.js → tt2-BEcGvh3x.js} +1 -1
  267. package/dist/{turtle-CJXjfTuQ.js → turtle-olfCaWK3.js} +1 -1
  268. package/dist/{twig-BvifXKCL.js → twig-DzAdJtIp.js} +1 -1
  269. package/dist/{typescript-C_kjx16f.js → typescript-CLQvQKqG.js} +1 -1
  270. package/dist/{typoscript-CKx7i0lw.js → typoscript-CSBkhrAL.js} +1 -1
  271. package/dist/{unrealscript-C99-FTMD.js → unrealscript-BtjbdKx7.js} +1 -1
  272. package/dist/{uorazor-gq1rw9l6.js → uorazor-BdwFJ_zE.js} +1 -1
  273. package/dist/{uri-x57ZiKUR.js → uri-C8xMvlfF.js} +1 -1
  274. package/dist/{v-D2uVu8wS.js → v-DBZpxO77.js} +1 -1
  275. package/dist/{vala-rs2tr4PQ.js → vala-CEDjHFpq.js} +1 -1
  276. package/dist/{vbnet-CkP4ImoI.js → vbnet-CXgH85cV.js} +1 -1
  277. package/dist/{velocity-Dn3oZ8Fg.js → velocity-DvU2yYNO.js} +1 -1
  278. package/dist/{verilog-C3-DD5kg.js → verilog-BLRd-UJ6.js} +1 -1
  279. package/dist/{vhdl-CcvZbpGE.js → vhdl-Bsd8eowi.js} +1 -1
  280. package/dist/{vim-BufjZct2.js → vim-B_FBNgdo.js} +1 -1
  281. package/dist/vim-B_FBNgdo.js.gz +0 -0
  282. package/dist/{visual-basic-Cwl6YtXm.js → visual-basic-CUeImzKc.js} +1 -1
  283. package/dist/{warpscript--JHTxzvH.js → warpscript-cSWPEGuR.js} +1 -1
  284. package/dist/{wasm-DUrKTYin.js → wasm-Dc40fBnE.js} +1 -1
  285. package/dist/{web-idl-CKCfh4ld.js → web-idl-23dOUlWW.js} +1 -1
  286. package/dist/{wiki-DwbjYqb0.js → wiki-Dj9-saPM.js} +1 -1
  287. package/dist/{wolfram-CfuiHc4N.js → wolfram-lZeiHEGH.js} +1 -1
  288. package/dist/{wren-Bw7Hbihx.js → wren-C9EUlgwo.js} +1 -1
  289. package/dist/{xeora-Cp8XH_U7.js → xeora-BlA2Sqno.js} +1 -1
  290. package/dist/{xml-doc-DAu95CyK.js → xml-doc-MtTdMc3V.js} +1 -1
  291. package/dist/{xojo-DzInwwlf.js → xojo-BV1Xrc4X.js} +1 -1
  292. package/dist/{xquery-C8Uc8pMF.js → xquery-D680IH_E.js} +1 -1
  293. package/dist/{yaml-MPPxFUJw.js → yaml-J3jbZxOO.js} +1 -1
  294. package/dist/{yang-D-cL_61Q.js → yang-C76E2xtn.js} +1 -1
  295. package/dist/{zig-5RyYlM_r.js → zig-dQyCl0x4.js} +1 -1
  296. package/package.json +1 -1
  297. package/dist/autohotkey-D73NyKGu.js.gz +0 -0
  298. package/dist/cmake-BB8Suvou.js.gz +0 -0
  299. package/dist/core-COvHOxVn.js.gz +0 -0
  300. package/dist/factor-CXL0uiBl.js.gz +0 -0
  301. package/dist/gherkin-DZGUtMQp.js.gz +0 -0
  302. package/dist/markdown-CFbjkq43.js.gz +0 -0
  303. package/dist/mel-BKnRl7Jr.js.gz +0 -0
  304. package/dist/opencl--oajoxMm.js.gz +0 -0
  305. package/dist/sas-DPotHK3-.js.gz +0 -0
  306. package/dist/sqf-_T_mo7om.js.gz +0 -0
  307. package/dist/textile-0VUrN_8s.js.gz +0 -0
  308. package/dist/vim-BufjZct2.js.gz +0 -0
@@ -203,7 +203,7 @@ var kse=function(){return kse=Object.assign||function(e){for(var t,r=1,n=argumen
203
203
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
204
204
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
205
205
  PERFORMANCE OF THIS SOFTWARE.
206
- ***************************************************************************** */var a$1=function(){return a$1=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a$1.apply(this,arguments)};function i$1(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function u$1(e){var t=e.defaultContent,r=void 0===t?[]:t,n=e.onCreated,i=e.defaultHtml,o=void 0===i?"":i,a=e.value,s=void 0===a?"":a,l=e.onChange,c=e.defaultConfig,u=void 0===c?{}:c,d=e.mode,p=void 0===d?"default":d,h=e.style,f=void 0===h?{}:h,g=e.className,m=React.useRef(null),v=i$1(React.useState(null),2),y=v[0],b=v[1],q=i$1(React.useState(""),2),V=q[0],S=q[1],E=function(e){n&&n(e);var t=u.onCreated;t&&t(e)},x=function(e){S(e.getHtml()),l&&l(e);var t=u.onChange;t&&t(e)},C=function(e){var t=u.onDestroyed;b(null),t&&t(e)};return React.useEffect(function(){if(null!=y&&s!==V)try{y.setHtml(s)}catch(e10){}},[s]),React.useEffect(function(){var e;if(null!=m.current&&null==y&&!(null===(e=m.current)||void 0===e?void 0:e.getAttribute("data-w-e-textarea"))){var t=iye({selector:m.current,config:a$1(a$1({},u),{onCreated:E,onChange:x,onDestroyed:C}),content:r,html:o||s,mode:p});b(t)}},[y]),React.createElement("div",{style:f,ref:m,className:g})}function c$3(e){var t=e.editor,r=e.defaultConfig,n=void 0===r?{}:r,i=e.mode,o=void 0===i?"default":i,a=e.style,s=void 0===a?{}:a,l=e.className,c=React.useRef(null);return React.useEffect(function(){null!=c.current&&null!=t&&aye({editor:t,selector:c.current,config:n,mode:o})},[t]),React.createElement("div",{style:s,ref:c,className:l})}var dist={exports:{}};const require$$0$2=getAugmentedNamespace(index_esm);var module2;module2=dist,self,module2.exports=(e=>(()=>{var t={857:t=>{t.exports=e}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var o=r[e]={exports:{}};return t[e](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{default:()=>a});var e=n(857),t={"*":"list-item","-":"list-item","+":"list-item",">":"blockquote","#":"header1","##":"header2","###":"header3","####":"header4","#####":"header5"},r={"---":"divider","----":"divider","-----":"divider","------":"divider"};function o(t){var r=t.selection;if(null==r)return{beforeText:"",range:null};var n=r.anchor,i=e.SlateEditor.above(t,{match:function(r){return e.SlateEditor.isBlock(t,r)}});if(null==i)return{beforeText:"",range:null};var o=i[1],a={anchor:n,focus:e.SlateEditor.start(t,o)};return{beforeText:e.SlateEditor.string(t,a)||"",range:a}}const a={editorPlugin:function(n){var i=n.insertBreak,a=n.insertText,s=n;return s.insertText=function(r){var i=n.selection;if(null==i)return a(r);if(e.SlateRange.isExpanded(i))return a(r);if(null==e.DomEditor.getSelectedNodeByType(n,"paragraph"))return a(r);if(" "!==r)return a(r);var s=o(n),l=s.beforeText,c=s.range;if(!l||!c)return a(r);var u=t[l];if(!u)return a(r);e.SlateTransforms.select(n,c),e.SlateTransforms.delete(n);var d={type:u};e.SlateTransforms.setNodes(n,d,{match:function(t){return e.SlateEditor.isBlock(n,t)}}),"list-item"===u&&e.SlateTransforms.wrapNodes(n,{type:"bulleted-list",children:[]},{match:function(t){return"list-item"===e.DomEditor.getNodeType(t)}})},s.insertBreak=function(){var t=n.selection;if(null==t)return i();if(e.SlateRange.isExpanded(t))return i();if(null==e.DomEditor.getSelectedNodeByType(n,"paragraph"))return i();var a=o(n),s=a.beforeText,l=a.range;if(!s||!l)return i();if(0!==s.indexOf("```")){var c=r[s];if(!c)return i();e.SlateTransforms.select(n,l),e.SlateTransforms.delete(n);var u={type:c};e.SlateTransforms.setNodes(n,u,{match:function(t){return e.SlateEditor.isBlock(n,t)}})}else{var d=s.slice(3).toLowerCase().trim();"js"===d&&(d="javascript"),"ts"===d&&(d="typescript"),"md"===d&&(d="markdown"),"py"===d&&(d="python"),"vb"===d&&(d="visual-basic"),"c#"===d&&(d="csharp");var p=((n.getConfig().MENU_CONF||{}).codeSelectLang||[]).codeLangs;if(d&&!(void 0===p?[]:p).some(function(e){return e.value===d}))return i();e.SlateTransforms.select(n,l),e.SlateTransforms.delete(n);var h={type:"pre",children:[{type:"code",language:d,children:[{text:""}]}]};e.SlateTransforms.insertNodes(n,h)}},s}}})(),i})())(require$$0$2);var distExports=dist.exports;const markdownModule=getDefaultExportFromCjs(distExports);function vnode(e,t,r,n,i){return{sel:e,data:t,children:r,text:n,elm:i,key:void 0===t?void 0:t.key}}const array=Array.isArray;function primitive(e){return"string"==typeof e||"number"==typeof e||e instanceof String||e instanceof Number}function addNS(e,t,r){if(e.ns="http://www.w3.org/2000/svg","foreignObject"!==r&&void 0!==t)for(let n=0;n<t.length;++n){const e=t[n];if("string"==typeof e)continue;const r=e.data;void 0!==r&&addNS(r,e.children,e.sel)}}function h$2(e,t,r){let n,i,o,a={};if(null!=t&&(array(t)?n=t:primitive(t)?i=t.toString():t&&t.sel?n=[t]:a=t),void 0!==n)for(o=0;o<n.length;++o)primitive(n[o])&&(n[o]=vnode(void 0,void 0,void 0,n[o],void 0));return!e.startsWith("svg")||3!==e.length&&"."!==e[3]&&"#"!==e[3]||addNS(a,n,e),vnode(e,a,n,i,void 0)}const byteToHex=[];for(let i=0;i<256;++i)byteToHex.push((i+256).toString(16).slice(1));function unsafeStringify(e,t=0){return(byteToHex[e[t+0]]+byteToHex[e[t+1]]+byteToHex[e[t+2]]+byteToHex[e[t+3]]+"-"+byteToHex[e[t+4]]+byteToHex[e[t+5]]+"-"+byteToHex[e[t+6]]+byteToHex[e[t+7]]+"-"+byteToHex[e[t+8]]+byteToHex[e[t+9]]+"-"+byteToHex[e[t+10]]+byteToHex[e[t+11]]+byteToHex[e[t+12]]+byteToHex[e[t+13]]+byteToHex[e[t+14]]+byteToHex[e[t+15]]).toLowerCase()}let getRandomValues;const rnds8=new Uint8Array(16);function rng(){if(!getRandomValues){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");getRandomValues=crypto.getRandomValues.bind(crypto)}return getRandomValues(rnds8)}const randomUUID="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),native={randomUUID:randomUUID};function _v4(e,t,r){var n;const i=(e=e||{}).random??(null==(n=e.rng)?void 0:n.call(e))??rng();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,unsafeStringify(i)}function v4(e,t,r){return native.randomUUID&&!e?native.randomUUID():_v4(e)}function withFillBlank(e){const{isInline:t,isVoid:r}=e,n=e;return n.isInline=e=>"fill-blank"===QO.getNodeType(e)||t(e),n.isVoid=e=>"fill-blank"===QO.getNodeType(e)||r(e),n}class InsertFillBlankMenu{constructor(){__publicField(this,"title","插入填空项"),__publicField(this,"tag","button")}getValue(e){return""}isActive(e){return!1}isDisabled(e){var t;return null==e.selection||(null==(t=e.getElemsByType("fill-blank"))?void 0:t.length)>=20}exec(e,t){if(this.isDisabled(e))return;const r=[{text:" "},{type:"fill-blank",key:v4(),children:[{text:""}]},{text:" "}];md.insertNodes(e,r)}}let fillBlankIds=[];const renderFillBlank=(e,t,r)=>{const n=null==r?void 0:r.getElemsByType("fill-blank"),i=(null==n?void 0:n.findIndex(t=>t.key===e.key&&!fillBlankIds.includes(t.id)))||0;return i===n.length-1?fillBlankIds=[]:fillBlankIds.push(n[i].id),h$2("input",{attrs:{class:"w-e-fill-blank","data-w-e-type":"fill-blank","data-w-e-is-void":"true","data-w-e-is-inline":"true",readonly:!0,placeholder:i+1}})},fillBlankToHtml=(e,t,r)=>'<input class="w-e-fill-blank" data-w-e-type="fill-blank" data-w-e-is-void="true" data-w-e-is-inline="true" readonly="true">',parseFillBlankHtml=(e,t,r)=>({type:"fill-blank",key:v4(),children:[{text:""}]}),parseCodeHtml=(e,t,r)=>{let n=(null==e?void 0:e.innerHTML)||"";const i='<input class="w-e-fill-blank" data-w-e-type="fill-blank" data-w-e-is-void="true" data-w-e-is-inline="true" readonly="true">',o=(null==t?void 0:t.filter(e=>"fill-blank"===(null==e?void 0:e.type)))||[];let a=[];return(null==o?void 0:o.length)&&(null==t||t.forEach((e,r)=>{var o;if(a.push(e),"fill-blank"===(null==e?void 0:e.type))if("fill-blank"===(null==(o=t[r+1])?void 0:o.type)){const e=null==n?void 0:n.indexOf(i,1);let t=null==n?void 0:n.slice(0,e);n=null==n?void 0:n.replace(t,""),t=t.replace(i,""),a.push({text:t})}else n=null==n?void 0:n.replace(i,"");else n=null==n?void 0:n.replace(null==e?void 0:e.text,"")})),{type:"code",language:"",children:(null==o?void 0:o.length)?a:[{text:(null==e?void 0:e.textContent)||""}]}},fillBlankModule={editorPlugin:withFillBlank,renderElems:[{type:"fill-blank",renderElem:renderFillBlank}],elemsToHtml:[{type:"fill-blank",elemToHtml:fillBlankToHtml}],parseElemsHtml:[{selector:"input[data-w-e-type='fill-blank']",parseElemHtml:parseFillBlankHtml},{selector:"pre:not([data-w-e-type])>code",parseElemHtml:parseCodeHtml}],menus:[{key:"fill-blank",factory:()=>new InsertFillBlankMenu}]},QuestionContext=React.createContext(null),useQuestionContext=()=>{const e=React.useContext(QuestionContext);if(!e)throw new Error("useMyContext must be used within a MyContext.Provider");return e};Zve.registerModule(fillBlankModule),Zve.registerModule(markdownModule);const RichEditor=React.forwardRef((e,t)=>{const{topProps:r}=useQuestionContext(),{uploadImg:n}=r,{defaultValue:i="",readOnly:o=!1,editorHeight:a=300,placeholder:s="请输入内容...",isBorder:l=!0,autoHeight:c,onChange:u,customToolbarKeys:d,mode:p="default",noPadding:h=!1}=e,[f,g]=React.useState(null),[m]=React.useState({toolbarKeys:d??["undo","redo","fullScreen","|","headerSelect","bold","underline","italic","color","bgColor","|","bulletedList","numberedList",{key:"group-justify",title:"对齐",iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M204.8 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z"></path><path d="M505.6 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z"></path><path d="M806.4 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z"></path></svg>',menuKeys:["justifyLeft","justifyRight","justifyCenter","justifyJustify"]},{key:"group-indent",title:"缩进",iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m384 192h640v128H384z m0 192h640v128H384z m0 192h640v128H384zM0 832h1024v128H0z m0-128V320l256 192z"></path></svg>',menuKeys:["indent","delIndent"]},"insertLink",{key:"group-image",title:"图片",iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M959.877 128l0.123 0.123v767.775l-0.123 0.122H64.102l-0.122-0.122V128.123l0.122-0.123h895.775zM960 64H64C28.795 64 0 92.795 0 128v768c0 35.205 28.795 64 64 64h896c35.205 0 64-28.795 64-64V128c0-35.205-28.795-64-64-64zM832 288.01c0 53.023-42.988 96.01-96.01 96.01s-96.01-42.987-96.01-96.01S682.967 192 735.99 192 832 234.988 832 288.01zM896 832H128V704l224.01-384 256 320h64l224.01-192z"></path></svg>',menuKeys:["insertImage","uploadImage"]},"insertTable","codeBlock","divider","|"]}),v={placeholder:s,autoFocus:!1,MENU_CONF:{uploadImage:{async customUpload(e,t){if(!e||!n)return;const r=new FormData;r.append("file",e);const i=await n({file:r});(null==i?void 0:i.url)&&t(null==i?void 0:i.url,null==i?void 0:i.url,null==i?void 0:i.url)}}}},y=React.useRef(null);React.useEffect(()=>()=>{null!=f&&(y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{null==f||f.destroy(),g(null)},500))},[f]),React.useEffect(()=>{o?null==f||f.disable():null==f||f.enable()},[o,f]);const b=React.useCallback((e="")=>e.replace(/<\/?p>/g,"").replace(/&nbsp;/gi,"").replace(/<br\/?>/g,""),[]);React.useImperativeHandle(t,()=>({getHtml:()=>{if(null==f?void 0:f.isEmpty())return"";{const e=(null==f?void 0:f.getHtml())??"",t=b(e);return/\S+/.test(t)?e:""}},setValue:(e="")=>!!f&&(null==f||f.setHtml(e),!0)}));const q={};return o&&c?(q.minHeight=c.min+"px",q.maxHeight=c.max+"px",q.overflowY="auto"):q.height="number"==typeof a?a+"px":a,jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{"data-nopadding":h,style:{border:l?"1px solid #E5E5E5":"",zIndex:99},className:"richeditor",children:[!o&&jsxRuntimeExports.jsx(c$3,{editor:f,defaultConfig:m,mode:"default",style:{borderBottom:"1px solid #E5E5E5"}}),jsxRuntimeExports.jsx(u$1,{defaultConfig:v,value:i,onCreated:g,mode:p,onChange:e=>{if(null==e?void 0:e.isEmpty())null==u||u("",e);else{const t=(null==e?void 0:e.getHtml())??"",r=b(t);/\S+/.test(r)?null==u||u(t,e):null==u||u("",e)}},style:{fontSize:"16px",...q}})]})})}),warningSvg="data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20x='0.535156'%20width='16'%20height='16'%20fill='black'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.53516%201C4.66953%201%201.53516%204.13438%201.53516%208C1.53516%2011.8656%204.66953%2015%208.53516%2015C12.4008%2015%2015.5352%2011.8656%2015.5352%208C15.5352%204.13438%2012.4008%201%208.53516%201ZM8.03516%204.625C8.03516%204.55625%208.09141%204.5%208.16016%204.5H8.91016C8.97891%204.5%209.03516%204.55625%209.03516%204.625V8.875C9.03516%208.94375%208.97891%209%208.91016%209H8.16016C8.09141%209%208.03516%208.94375%208.03516%208.875V4.625ZM8.53516%2011.5C8.12109%2011.5%207.78516%2011.1641%207.78516%2010.75C7.78516%2010.3359%208.12109%2010%208.53516%2010C8.94922%2010%209.28516%2010.3359%209.28516%2010.75C9.28516%2011.1641%208.94922%2011.5%208.53516%2011.5Z'%20fill='%23FAAD14'/%3e%3c/svg%3e",upYSvg="data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20x='16.5352'%20y='16'%20width='16'%20height='16'%20transform='rotate(-180%2016.5352%2016)'%20fill='black'/%3e%3cpath%20d='M4.75455%2010.7326L8.71709%206.43956L12.68%2010.7326C12.8843%2010.9541%2013.2295%2010.9679%2013.4509%2010.7636C13.6723%2010.5592%2013.6862%2010.2141%2013.4818%209.99265L9.11818%205.26537C9.01492%205.15344%208.86956%205.08977%208.71727%205.08977C8.56498%205.08977%208.41963%205.15344%208.31636%205.26537L3.95273%209.99265C3.74838%2010.2141%203.76222%2010.5592%203.98364%2010.7636C4.20505%2010.9679%204.5502%2010.9541%204.75455%2010.7326'%20fill='%23FAAD14'/%3e%3c/svg%3e",tipSvg="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clipPath='url(%23clip0_954_6949)'%3e%3cg%20filter='url(%23filter0_i_954_6949)'%3e%3cpath%20d='M26.9806%2012.2299L29.1814%2011.1896C29.9321%2013.1617%2030.1883%2015.2877%2029.9274%2017.3817C29.6665%2019.4757%2028.8965%2021.4739%2027.6848%2023.2015L25.6975%2021.81C26.6636%2020.4329%2027.2845%2018.8438%2027.5078%2017.1765C27.7311%2015.5092%2027.5503%2013.8127%2026.9806%2012.2299ZM17.053%205.27772C15.3709%205.28347%2013.7147%205.69355%2012.2243%206.47339C10.7338%207.25323%209.45264%208.37997%208.48881%209.75864L6.50399%208.36886C7.71308%206.63945%209.32747%205.23262%2011.206%204.27141C13.0845%203.31019%2015.1699%202.82387%2017.2798%202.85497L17.0554%205.2795L17.053%205.27772ZM12.325%2028.2294C12.0815%2028.5771%2011.772%2028.8734%2011.414%2029.1015C11.056%2029.3295%2010.6566%2029.4848%2010.2386%2029.5586C9.82061%2029.6323%209.39218%2029.6229%208.97778%2029.531C8.56339%2029.4392%208.17115%2029.2666%207.82346%2029.0231C7.47577%2028.7796%207.17943%2028.4701%206.95138%2028.1121C6.72332%2027.7541%206.56801%2027.3547%206.49431%2026.9367C6.34546%2026.0925%206.53806%2025.2237%207.02975%2024.5216L12.325%2028.2294ZM23.7127%2020.4202L20.9314%2024.3923L20.2555%2028.9549C20.2148%2029.2272%2020.1052%2029.4845%2019.9371%2029.7026C19.769%2029.9206%2019.548%2030.0921%2019.295%2030.2008C19.042%2030.3094%2018.7655%2030.3516%2018.4916%2030.3234C18.2178%2030.2952%2017.9556%2030.1974%2017.7301%2030.0395L3.48051%2020.0642C3.25433%2019.9064%203.07227%2019.6935%202.95167%2019.4455C2.83107%2019.1975%202.77592%2018.9228%202.79149%2018.6475C2.80706%2018.3721%202.89282%2018.1054%203.04062%2017.8726C3.18841%2017.6398%203.39332%2017.4487%203.63584%2017.3174L7.69207%2015.1218L10.4747%2011.15C11.3766%209.86202%2012.6346%208.8651%2014.0946%208.28134C15.5545%207.69757%2017.153%207.55231%2018.6943%207.86334L19.0811%207.31281C19.3203%206.95534%2019.6285%206.64922%2019.9876%206.41239C20.3467%206.17556%2020.7494%206.01279%2021.1722%205.93362C21.595%205.85444%2022.0293%205.86046%2022.4498%205.95132C22.8702%206.04217%2023.2683%206.21604%2023.6206%206.46273C23.973%206.70941%2024.2726%207.02396%2024.5018%207.38792C24.7311%207.75188%2024.8854%208.15794%2024.9557%208.5823C25.0259%209.00666%2025.0108%209.44078%2024.9111%209.85922C24.8115%2010.2777%2024.6293%2010.672%2024.3753%2011.0191L23.9911%2011.5701C24.811%2012.9126%2025.2214%2014.4651%2025.1719%2016.0374C25.1224%2017.6096%2024.6152%2019.1333%2023.7125%2020.4215L23.7127%2020.4202Z'%20fill='%23FFCC33'%20fill-opacity='0.15'/%3e%3c/g%3e%3cpath%20d='M21.3721%2019.6161C22.2185%2018.4077%2022.6941%2016.9787%2022.7405%2015.5041C22.787%2014.0291%2022.402%2012.5726%2021.6328%2011.3131L21.4625%2011.0344L21.6493%2010.7665L22.0335%2010.2156L22.04%2010.2062L22.0401%2010.2062C22.2549%209.91283%2022.4089%209.5795%2022.4931%209.2258C22.5774%208.87209%2022.5901%208.50513%2022.5307%208.14642C22.4713%207.78771%2022.3409%207.44447%2022.1471%207.13681C21.9534%206.82916%2021.7001%206.56327%2021.4023%206.35475C21.1044%206.14623%2020.7679%205.99926%2020.4125%205.92246C20.0571%205.84566%2019.69%205.84057%2019.3326%205.9075C18.9752%205.97442%2018.6348%206.11201%2018.3313%206.3122C18.0277%206.51239%2017.7672%206.77116%2017.565%207.07333L17.5587%207.08276L17.5586%207.08268L17.1718%207.63321L16.984%207.9005L16.6638%207.83588C15.2178%207.54409%2013.7182%207.68037%2012.3486%208.22802C10.9789%208.77567%209.79875%209.71092%208.95263%2010.9192L8.95257%2010.9193L6.16993%2014.8911L6.10222%2014.9877L5.99845%2015.0439L1.94222%2017.2396L1.94216%2017.2396C1.77467%2017.3302%201.63316%2017.4622%201.5311%2017.623C1.42903%2017.7838%201.36981%2017.968%201.35905%2018.1581C1.3483%2018.3482%201.38638%2018.538%201.46967%2018.7092C1.55296%2018.8805%201.67869%2019.0276%201.83489%2019.1365L1.83562%2019.137L16.0852%2029.1123L16.0854%2029.1124C16.2411%2029.2215%2016.4221%2029.289%2016.6112%2029.3084C16.8004%2029.3279%2016.9913%2029.2988%2017.166%2029.2238C17.3407%2029.1487%2017.4934%2029.0303%2017.6095%2028.8797C17.7254%2028.7293%2017.8011%2028.5518%2017.8293%2028.364L21.3721%2019.6161ZM21.3721%2019.6161L21.3715%2019.6158L18.5902%2023.5879L18.5225%2023.6846L18.5052%2023.8014L17.8294%2028.3634L21.3721%2019.6161ZM14.7994%202.84116L14.6671%204.27101C13.0611%204.34269%2011.4885%204.76584%2010.0608%205.51279C8.64735%206.25234%207.41357%207.28968%206.44341%208.55102L5.27665%207.73406C6.40133%206.25582%207.84479%205.04697%209.50211%204.19894C11.147%203.35725%2012.957%202.89436%2014.7994%202.84116ZM26.0717%2016.7253C26.2855%2015.1291%2026.1457%2013.5074%2025.6647%2011.9743L26.964%2011.3601C27.5441%2013.1097%2027.728%2014.9688%2027.4996%2016.8023C27.2694%2018.6498%2026.627%2020.4196%2025.6224%2021.982L24.4533%2021.1634C25.3069%2019.8204%2025.86%2018.3064%2026.0717%2016.7253ZM5.05507%2026.3323C4.95858%2025.7851%205.03183%2025.2256%205.25868%2024.7268L9.6592%2027.8081C9.52376%2027.941%209.37452%2028.0598%209.21372%2028.1622C8.91111%2028.355%208.5735%2028.4863%208.22015%2028.5486C7.86681%2028.6109%207.50466%2028.603%207.15437%2028.5253C6.80408%2028.4476%206.47252%2028.3017%206.17861%2028.096C5.88471%2027.8902%205.63421%2027.6285%205.44143%2027.3259C5.24866%2027.0233%205.11737%2026.6857%205.05507%2026.3323Z'%20stroke='%23FAA600'%20stroke-opacity='0.4'/%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_i_954_6949'%20x='2.78906'%20y='2.85352'%20width='27.2373'%20height='27.4785'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dx='-2'%20dy='2'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200.96%200%200%200%200%200.832%200%200%200%200%200.576%200%200%200%200.3%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_954_6949'/%3e%3c/filter%3e%3cclipPath%20id='clip0_954_6949'%3e%3crect%20width='32'%20height='32'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",questionTypesMap={[QuestionTypeEnum.RADIO]:"单选题",[QuestionTypeEnum.CHECKBOX]:"多选题",[QuestionTypeEnum.JUDGE]:"判断题",[QuestionTypeEnum.COMPLETION]:"填空题",[QuestionTypeEnum.ANSWER]:"问答题",[QuestionTypeEnum.ACM]:"编程题",[QuestionTypeEnum.CCM]:"编码测验题",[QuestionTypeEnum.COMPOSITE]:"组合题",[QuestionTypeEnum.DRAW]:"画图题"},questionTypeSelectOptions=[{value:QuestionTypeEnum.RADIO,label:"选择题"},{value:QuestionTypeEnum.COMPLETION,label:"填空题"},{value:QuestionTypeEnum.ANSWER,label:"问答题"},{value:QuestionTypeEnum.CCM,label:"编码测验题"},{value:QuestionTypeEnum.COMPOSITE,label:"组合题"},{value:QuestionTypeEnum.DRAW,label:"画图题"}],difficultyMap={low:"简单",middle:"中等",high:"困难"},codeTestUrlStatic="https://quiz.cloudlab.top",codePlayerUrlStatic="https://run.cloudlab.top",getQuestionTypeIcon=e=>{switch(e){case"radio":case"checkbox":return jsxRuntimeExports.jsx(Target,{className:"w-4 h-4"});case"acm":case"ccm":return jsxRuntimeExports.jsx(Code$1,{className:"w-4 h-4"});case"completion":return jsxRuntimeExports.jsx(PenLine,{className:"w-4 h-4"});case"answer":return jsxRuntimeExports.jsx(MessageSquare,{className:"w-4 h-4"});default:return jsxRuntimeExports.jsx(FileText,{className:"w-4 h-4"})}},getQuestionTypeName=e=>{switch(e){case"radio":return"单选题";case"checkbox":return"多选题";case"acm":case"ccm":return"编码测验";case"completion":return"填空题";case"answer":return"问答题";default:return"题目"}},getDifficultyColor=e=>{switch(e){case"low":return"text-green-600 bg-green-100";case"middle":return"text-yellow-600 bg-yellow-100";case"high":return"text-red-600 bg-red-100";default:return"text-gray-600 bg-gray-100"}},QuestionHeader=e=>{const{currentIndex:t,questionsCount:r,type:n,difficulty:i="low",score:o}=e;return jsxRuntimeExports.jsxs("div",{className:"questionHeader tailwind-scoped",children:[t&&r&&jsxRuntimeExports.jsxs("div",{className:"questionIndex itemWrapper",children:["题目 ",t,"/",r]}),jsxRuntimeExports.jsxs("span",{className:"questionType itemWrapper",children:[getQuestionTypeIcon(n)," ",getQuestionTypeName(n)]}),i&&jsxRuntimeExports.jsx("div",{className:`difficulty itemWrapper ${getDifficultyColor(i)}`,children:jsxRuntimeExports.jsx("span",{className:"difficulty",children:difficultyMap[i]})}),o&&jsxRuntimeExports.jsxs("div",{className:"score itemWrapper",children:[jsxRuntimeExports.jsx(Star,{})," ",o," 分"]})]})},ChoiceQuestion=e=>{var t;const{data:r,onSubmit:n,buttonText:i,showQuestionTip:o,showResult:a,onNextQuestion:s}=e,{optionJson:l,answer:c,userAnswer:u,score:d,type:p,topic:h,content:f,auxiliary:g,difficulty:m,currentIndex:v,questionsCount:y}=r,[b,q]=React.useState(!0),[V,S]=React.useState(void 0),[E,x]=React.useState(),[C,w]=React.useState(""),[R,A]=React.useState([]);React.useEffect(()=>{u&&!E&&(x(u),u.indexOf(",")>-1?A(null==u?void 0:u.split(",")):w(u),T(u))},[r]);const T=e=>{if(!E&&!e)return void staticMethods.warning("请先作答!");const t=E||e;n&&!e&&void 0===V&&n(t),void 0!==V&&(null==s||s()),c&&a&&(t===c||t&&isArrayEqual(null==t?void 0:t.split(","),null==c?void 0:c.split(","))?S(1):S(0))},k=["A","B","C","D","E","F","G","H","I","J"];return jsxRuntimeExports.jsx("div",{className:"video-player-interaction tailwind-scoped",children:jsxRuntimeExports.jsx("div",{className:"video-player-interaction-content",children:jsxRuntimeExports.jsxs("div",{className:"video-player-interaction-content-main",children:[jsxRuntimeExports.jsx(QuestionHeader,{score:d,type:p,difficulty:m,currentIndex:v,questionsCount:y}),jsxRuntimeExports.jsx("div",{className:"video-player-interaction-content-desc",children:jsxRuntimeExports.jsx(RichEditor,{defaultValue:h||f,readOnly:!0,noPadding:!0})}),jsxRuntimeExports.jsx("div",{className:"video-player-interaction-content-options",children:"radio"===p?null==l?void 0:l.map(({key:e,value:t},r)=>jsxRuntimeExports.jsx("button",{onClick:()=>(e=>{S(void 0),x(e+""),w(e+"")})(e),disabled:void 0!==V,className:`w-full text-left p-4 rounded-lg border-2 transition-all ${C===e?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"} ${void 0!==V?e===c?"border-green-500 bg-green-50":C===e&&e!==c?"border-red-500 bg-red-50":"border-gray-200":""}`,children:jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntimeExports.jsxs("span",{children:[k[r],"、",t]}),void 0!==V&&e===c&&jsxRuntimeExports.jsx(CircleCheckBig,{className:"w-5 h-5 text-green-600"}),void 0!==V&&C===e&&e!==c&&jsxRuntimeExports.jsx(CircleX,{className:"w-5 h-5 text-red-600"})]})},e)):null==l?void 0:l.map(({key:e,value:t},r)=>jsxRuntimeExports.jsx("button",{onClick:()=>(e=>{S(void 0);let t=E||"";if(t&&(null==t?void 0:t.indexOf(e))>-1){let r=t.split(",");r=r.filter(t=>t!==e),t=null==r?void 0:r.join(",")}else t=t?t+","+e:e;x(t)})(String(e)),disabled:void 0!==V,className:`w-full text-left p-4 rounded-lg border-2 transition-all ${E&&(null==E?void 0:E.indexOf(e))>-1?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"} ${void 0!==V?c.indexOf(e)>-1?(null==E||E.indexOf(e),"border-green-500 bg-green-50"):E&&(null==E?void 0:E.indexOf(e))>-1&&-1===c.indexOf(e)?"border-red-500 bg-red-50":"border-gray-200":""}`,children:jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntimeExports.jsxs("span",{children:[k[r],"、",t]}),void 0!==V&&c.indexOf(e)>-1&&jsxRuntimeExports.jsx(CircleCheckBig,{className:"w-5 h-5 text-green-600"}),void 0!==V&&E&&(null==E?void 0:E.indexOf(e))>-1&&-1===c.indexOf(e)&&jsxRuntimeExports.jsx(CircleX,{className:"w-5 h-5 text-red-600"})]})},e))}),o&&0===V&&g&&(null==g?void 0:g.length)>0&&jsxRuntimeExports.jsxs("div",{className:"video-player-interaction-content-tip",children:[jsxRuntimeExports.jsxs("div",{className:"video-player-interaction-content-tip-icons",onClick:()=>{q(!b)},children:[jsxRuntimeExports.jsx("img",{src:warningSvg}),jsxRuntimeExports.jsx("span",{children:"提示"}),jsxRuntimeExports.jsx("img",{src:upYSvg,style:{transform:b?"rotate(0deg)":"rotate(180deg)"}})]}),b&&jsxRuntimeExports.jsxs("div",{className:"video-player-interaction-content-tip-text",children:[jsxRuntimeExports.jsx(RichEditor,{defaultValue:null==(t=null==g?void 0:g[0])?void 0:t.description,readOnly:!0}),jsxRuntimeExports.jsx("img",{src:tipSvg})]})]}),n&&jsxRuntimeExports.jsx("div",{className:"video-player-interaction-content-actions",children:jsxRuntimeExports.jsx(Button$1,{type:"primary",onClick:()=>T(),children:i||(void 0===V?"提交":"下一题")})})]})})})};var postRobot$2={exports:{}},postRobot$1={exports:{}};!function(e,t){"undefined"!=typeof self&&self,e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return{}.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){function n(e){return"[object RegExp]"==={}.toString.call(e)}r.r(t),r.d(t,"Promise",function(){return O}),r.d(t,"TYPES",function(){return Ye}),r.d(t,"ProxyWindow",function(){return Ce}),r.d(t,"setup",function(){return Ge}),r.d(t,"destroy",function(){return Ze}),r.d(t,"serializeMessage",function(){return Ke}),r.d(t,"deserializeMessage",function(){return He}),r.d(t,"createProxyWindow",function(){return ze}),r.d(t,"toProxyWindow",function(){return Xe}),r.d(t,"on",function(){return Me}),r.d(t,"once",function(){return We}),r.d(t,"send",function(){return je}),r.d(t,"markWindowKnown",function(){return fe}),r.d(t,"cleanUpWindow",function(){return Qe}),r.d(t,"bridge",function(){});var i="Call was rejected by callee.\r\n";function o(e){return void 0===e&&(e=window),e.location.protocol}function a(e){if(void 0===e&&(e=window),e.mockDomain){var t=e.mockDomain.split("//")[0];if(t)return t}return o(e)}function s(e){return void 0===e&&(e=window),"about:"===a(e)}function l(e){if(void 0===e&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch(t){}}function c(e){if(void 0===e&&(e=window),e&&!l(e))try{return e.opener}catch(t){}}function u(e){try{return!0}catch(t){}return!1}function d(e){void 0===e&&(e=window);var t=e.location;if(!t)throw new Error("Can not read window location");var r=o(e);if(!r)throw new Error("Can not read window protocol");if("file:"===r)return"file://";if("about:"===r){var n=l(e);return n&&u()?d(n):"about://"}var i=t.host;if(!i)throw new Error("Can not read window host");return r+"//"+i}function p(e){void 0===e&&(e=window);var t=d(e);return t&&e.mockDomain&&0===e.mockDomain.indexOf("mock:")?e.mockDomain:t}function h(e){if(!function(e){try{if(e===window)return!0}catch(n){}try{var t=Object.getOwnPropertyDescriptor(e,"location");if(t&&!1===t.enumerable)return!1}catch(n){}try{if(s(e)&&u())return!0}catch(n){}try{if(void 0===(r=e)&&(r=window),"mock:"===a(r)&&u())return!0}catch(n){}var r;try{if(d(e)===d(window))return!0}catch(n){}return!1}(e))return!1;try{if(e===window)return!0;if(s(e)&&u())return!0;if(p(window)===p(e))return!0}catch(t){}return!1}function f(e){if(!h(e))throw new Error("Expected window to be same domain");return e}function g(e,t){if(!e||!t)return!1;var r=l(t);return r?r===e:-1!==function(e){var t=[];try{for(;e.parent!==e;)t.push(e.parent),e=e.parent}catch(r){}return t}(t).indexOf(e)}function m(e){var t,r,n=[];try{t=e.frames}catch(l){t=e}try{r=t.length}catch(l){}if(0===r)return n;if(r){for(var i=0;i<r;i++){var o=void 0;try{o=t[i]}catch(l){continue}n.push(o)}return n}for(var a=0;a<100;a++){var s=void 0;try{s=t[a]}catch(l){return n}if(!s)return n;n.push(s)}return n}var v=[],y=[];function b(e,t){void 0===t&&(t=!0);try{if(e===window)return!1}catch(o){return!0}try{if(!e)return!0}catch(o){return!0}try{if(e.closed)return!0}catch(o){return!o||o.message!==i}if(t&&h(e))try{if(e.mockclosed)return!0}catch(o){}try{if(!e.parent||!e.top)return!0}catch(o){}var r=function(e,t){for(var r=0;r<e.length;r++)try{if(e[r]===t)return r}catch(o){}return-1}(v,e);if(-1!==r){var n=y[r];if(n&&function(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var t=e.ownerDocument;if(t&&t.documentElement&&!t.documentElement.contains(e)){for(var r=e;r.parentNode&&r.parentNode!==r;)r=r.parentNode;if(!r.host||!t.documentElement.contains(r.host))return!0}return!1}(n))return!0}return!1}function q(e){return void 0===e&&(e=window),c(e=e||window)||l(e)||void 0}function V(e,t){if("string"==typeof e){if("string"==typeof t)return"*"===e||t===e;if(n(t))return!1;if(Array.isArray(t))return!1}return n(e)?n(t)?e.toString()===t.toString():!Array.isArray(t)&&Boolean(t.match(e)):!!Array.isArray(e)&&(Array.isArray(t)?JSON.stringify(e)===JSON.stringify(t):!n(t)&&e.some(function(e){return V(e,t)}))}function S(e){try{if(e===window)return!0}catch(t){if(t&&t.message===i)return!0}try{if("[object Window]"==={}.toString.call(e))return!0}catch(t){if(t&&t.message===i)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(t){if(t&&t.message===i)return!0}try{if(e&&e.self===e)return!0}catch(t){if(t&&t.message===i)return!0}try{if(e&&e.parent===e)return!0}catch(t){if(t&&t.message===i)return!0}try{if(e&&e.top===e)return!0}catch(t){if(t&&t.message===i)return!0}try{if(e&&"__unlikely_value__"===e.__cross_domain_utils_window_check__)return!1}catch(t){return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch(t){}return!1}function E(e){if(h(e))return f(e).frameElement;for(var t=0,r=document.querySelectorAll("iframe");t<r.length;t++){var n=r[t];if(n&&n.contentWindow&&n.contentWindow===e)return n}}function x(e){if(void 0===(r=e)&&(r=window),Boolean(l(r))){var t=E(e);if(t&&t.parentElement)return void t.parentElement.removeChild(t)}var r;try{e.close()}catch(n){}}function C(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&"function"==typeof window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&"function"==typeof window.constructor&&e instanceof window.constructor)return!1;var t={}.toString;if(t){var r=t.call(e);if("[object Window]"===r||"[object global]"===r||"[object DOMWindow]"===r)return!1}if("function"==typeof e.then)return!0}catch(n){return!1}return!1}var w,R=[],A=[],T=0;function k(){if(!T&&w){var e=w;w=null,e.resolve()}}function N(){T+=1}function P(){T-=1,k()}var O=function(){function e(e){var t=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],e){var r,n,i=!1,o=!1,a=!1;N();try{e(function(e){a?t.resolve(e):(i=!0,r=e)},function(e){a?t.reject(e):(o=!0,n=e)})}catch(s){return P(),void this.reject(s)}P(),a=!0,i?this.resolve(r):o&&this.reject(n)}}var t=e.prototype;return t.resolve=function(e){if(this.resolved||this.rejected)return this;if(C(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},t.reject=function(e){var t=this;if(this.resolved||this.rejected)return this;if(C(e))throw new Error("Can not reject promise with another promise");if(!e){var r=e&&"function"==typeof e.toString?e.toString():{}.toString.call(e);e=new Error("Expected reject to be called with Error, got "+r)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout(function(){t.errorHandled||function(e,t){if(-1===R.indexOf(e)){R.push(e),setTimeout(function(){throw e},1);for(var r=0;r<A.length;r++)A[r](e,t)}}(e,t)},1),this.dispatch(),this},t.asyncReject=function(e){return this.errorHandled=!0,this.reject(e),this},t.dispatch=function(){var t=this.resolved,r=this.rejected,n=this.handlers;if(!this.dispatching&&(t||r)){this.dispatching=!0,N();for(var i=function(e,t){return e.then(function(e){t.resolve(e)},function(e){t.reject(e)})},o=0;o<n.length;o++){var a=n[o],s=a.onSuccess,l=a.onError,c=a.promise,u=void 0;if(t)try{u=s?s(this.value):this.value}catch(p){c.reject(p);continue}else if(r){if(!l){c.reject(this.error);continue}try{u=l(this.error)}catch(p){c.reject(p);continue}}if(u instanceof e&&(u.resolved||u.rejected)){var d=u;d.resolved?c.resolve(d.value):c.reject(d.error),d.errorHandled=!0}else C(u)?u instanceof e&&(u.resolved||u.rejected)?u.resolved?c.resolve(u.value):c.reject(u.error):i(u,c):c.resolve(u)}n.length=0,this.dispatching=!1,P()}},t.then=function(t,r){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for success handler");if(r&&"function"!=typeof r&&!r.call)throw new Error("Promise.then expected a function for error handler");var n=new e;return this.handlers.push({promise:n,onSuccess:t,onError:r}),this.errorHandled=!0,this.dispatch(),n},t.catch=function(e){return this.then(void 0,e)},t.finally=function(t){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return e.try(t).then(function(){return r})},function(r){return e.try(t).then(function(){throw r})})},t.timeout=function(e,t){var r=this;if(this.resolved||this.rejected)return this;var n=setTimeout(function(){r.resolved||r.rejected||r.reject(t||new Error("Promise timed out after "+e+"ms"))},e);return this.then(function(e){return clearTimeout(n),e})},t.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},t.lazy=function(){return this.errorHandled=!0,this},e.resolve=function(t){return t instanceof e?t:C(t)?new e(function(e,r){return t.then(e,r)}):(new e).resolve(t)},e.reject=function(t){return(new e).reject(t)},e.asyncReject=function(t){return(new e).asyncReject(t)},e.all=function(t){var r=new e,n=t.length,i=[].slice();if(!n)return r.resolve(i),r;for(var o=function(e,t,o){return t.then(function(t){i[e]=t,0==(n-=1)&&r.resolve(i)},function(e){o.reject(e)})},a=0;a<t.length;a++){var s=t[a];if(s instanceof e){if(s.resolved){i[a]=s.value,n-=1;continue}}else if(!C(s)){i[a]=s,n-=1;continue}o(a,e.resolve(s),r)}return 0===n&&r.resolve(i),r},e.hash=function(t){var r={},n=[],i=function(e){if(t.hasOwnProperty(e)){var i=t[e];C(i)?n.push(i.then(function(t){r[e]=t})):r[e]=i}};for(var o in t)i(o);return e.all(n).then(function(){return r})},e.map=function(t,r){return e.all(t.map(r))},e.onPossiblyUnhandledException=function(e){return t=e,A.push(t),{cancel:function(){A.splice(A.indexOf(t),1)}};var t},e.try=function(t,r,n){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.try expected a function");var i;N();try{i=t.apply(r,n||[])}catch(o){return P(),e.reject(o)}return P(),e.resolve(i)},e.delay=function(t){return new e(function(e){setTimeout(e,t)})},e.isPromise=function(t){return!!(t&&t instanceof e)||C(t)},e.flush=function(){return t=e,r=w=w||new t,k(),r;var t,r},e}();function F(e,t){for(var r=0;r<e.length;r++)try{if(e[r]===t)return r}catch(n){}return-1}var _,I=function(){function e(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var e=new WeakMap,t={};return Object.freeze(t),e.set(t,"__testvalue__"),"__testvalue__"===e.get(t)}catch(r){return!1}}())try{this.weakmap=new WeakMap}catch(e){}this.keys=[],this.values=[]}var t=e.prototype;return t._cleanupClosedWindows=function(){for(var e=this.weakmap,t=this.keys,r=0;r<t.length;r++){var n=t[r];if(S(n)&&b(n)){if(e)try{e.delete(n)}catch(i){}t.splice(r,1),this.values.splice(r,1),r-=1}}},t.isSafeToReadWrite=function(e){return!S(e)},t.set=function(e,t){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(e,t)}catch(l){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=this.name,i=e[n];return void(i&&i[0]===e?i[1]=t:Object.defineProperty(e,n,{value:[e,t],writable:!0}))}catch(l){}this._cleanupClosedWindows();var o=this.keys,a=this.values,s=F(o,e);-1===s?(o.push(e),a.push(t)):a[s]=t},t.get=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return t.get(e)}catch(i){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var r=e[this.name];return r&&r[0]===e?r[1]:void 0}catch(i){}this._cleanupClosedWindows();var n=F(this.keys,e);if(-1!==n)return this.values[n]},t.delete=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{t.delete(e)}catch(o){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var r=e[this.name];r&&r[0]===e&&(r[0]=r[1]=void 0)}catch(o){}this._cleanupClosedWindows();var n=this.keys,i=F(n,e);-1!==i&&(n.splice(i,1),this.values.splice(i,1))},t.has=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return!0}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var r=e[this.name];return!(!r||r[0]!==e)}catch(n){}return this._cleanupClosedWindows(),-1!==F(this.keys,e)},t.getOrSet=function(e,t){if(this.has(e))return this.get(e);var r=t();return this.set(e,r),r},e}();function D(e){return e.name||e.__name__||e.displayName||"anonymous"}function U(e,t){try{delete e.name,e.name=t}catch(r){}return e.__name__=e.displayName=t,e}function L(){var e="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+function(e){if("function"==typeof btoa)return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(parseInt(t,16))})).replace(/[=]/g,"");if("undefined"!=typeof Buffer)return Buffer.from(e,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function B(e){try{return JSON.stringify([].slice.call(e),function(e,t){return"function"==typeof t?"memoize["+function(e){if(_=_||new I,null==e||"object"!=typeof e&&"function"!=typeof e)throw new Error("Invalid object");var t=_.get(e);return t||(t=typeof e+":"+L(),_.set(e,t)),t}(t)+"]":"undefined"!=typeof window&&t instanceof window.Element||null!==t&&"object"==typeof t&&1===t.nodeType&&"object"==typeof t.style&&"object"==typeof t.ownerDocument?{}:t})}catch(t){throw new Error("Arguments not serializable -- can not be used to memoize")}}function M(){return{}}var W=0,j=0;function K(e,t){void 0===t&&(t={});var r,n,i=t.thisNamespace,o=void 0!==i&&i,a=t.time,s=W;W+=1;var l=function(){for(var t=arguments.length,i=new Array(t),l=0;l<t;l++)i[l]=arguments[l];var c,u;s<j&&(r=null,n=null,s=W,W+=1),c=o?(n=n||new I).getOrSet(this,M):r=r||{};try{u=B(i)}catch(f){return e.apply(this,arguments)}var d=c[u];if(d&&a&&Date.now()-d.time<a&&(delete c[u],d=null),d)return d.value;var p=Date.now(),h=e.apply(this,arguments);return c[u]={time:p,value:h},h};return l.reset=function(){r=null,n=null},U(l,(t.name||D(e))+"::memoized")}function H(e){var t={};function r(){for(var r=arguments,n=this,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];var s=B(o);return t.hasOwnProperty(s)||(t[s]=O.try(function(){return e.apply(n,r)}).finally(function(){delete t[s]})),t[s]}return r.reset=function(){t={}},U(r,D(e)+"::promiseMemoized")}function z(){}function X(e,t){if(void 0===t&&(t=1),t>=3)return"stringifyError stack overflow";try{if(!e)return"<unknown error: "+{}.toString.call(e)+">";if("string"==typeof e)return e;if(e instanceof Error){var r=e&&e.stack,n=e&&e.message;if(r&&n)return-1!==r.indexOf(n)?r:n+"\n"+r;if(r)return r;if(n)return n}return e&&e.toString&&"function"==typeof e.toString?e.toString():{}.toString.call(e)}catch(i){return"Error while stringifying error: "+X(i,t+1)}}function G(e){return"string"==typeof e?e:e.toString&&"function"==typeof e.toString?e.toString():{}.toString.call(e)}function Z(e){return"[object RegExp]"==={}.toString.call(e)}function Y(e,t,r){if(e.hasOwnProperty(t))return e[t];var n=r();return e[t]=n,n}function Q(){var e=document.body;if(!e)throw new Error("Body element not found");return e}function J(){return Boolean(document.body)&&"complete"===document.readyState}function $(){return Boolean(document.body)&&"interactive"===document.readyState}K.clear=function(){j=W},K(function(e){if(Object.values)return Object.values(e);var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t}),K(function(){return new O(function(e){if(J()||$())return e();var t=setInterval(function(){if(J()||$())return clearInterval(t),e()},10)})});var ee="undefined"!=typeof document?document.currentScript:null,te=K(function(){if(ee)return ee;if(ee=function(){try{var e=function(){try{throw new Error("_")}catch(e){return e.stack||""}}(),t=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(e),r=t&&t[1];if(!r)return;for(var n=0,i=[].slice.call(document.getElementsByTagName("script")).reverse();n<i.length;n++){var o=i[n];if(o.src&&o.src===r)return o}}catch(a){}}())return ee;throw new Error("Can not determine current script")}),re=L();function ne(e){void 0===e&&(e=window);var t="__post_robot_10_0_46__";return e!==window?e[t]:e[t]=e[t]||{}}K(function(){var e;try{e=te()}catch(n){return re}var t=e.getAttribute("data-uid");if(t&&"string"==typeof t)return t;if((t=e.getAttribute("data-uid-auto"))&&"string"==typeof t)return t;if(e.src){var r=function(e){for(var t="",r=0;r<e.length;r++){var n=e[r].charCodeAt(0)*r;e[r+1]&&(n+=e[r+1].charCodeAt(0)*(r-1)),t+=String.fromCharCode(97+Math.abs(n)%26)}return t}(JSON.stringify({src:e.src,dataset:e.dataset}));t="uid_"+r.slice(r.length-30)}else t=L();return e.setAttribute("data-uid-auto",t),t});var ie=function(){return{}};function oe(e,t){return void 0===e&&(e="store"),void 0===t&&(t=ie),Y(ne(),e,function(){var e=t();return{has:function(t){return e.hasOwnProperty(t)},get:function(t,r){return e.hasOwnProperty(t)?e[t]:r},set:function(t,r){return e[t]=r,r},del:function(t){delete e[t]},getOrSet:function(t,r){return Y(e,t,r)},reset:function(){e=t()},keys:function(){return Object.keys(e)}}})}var ae,se=function(){};function le(){var e=ne();return e.WINDOW_WILDCARD=e.WINDOW_WILDCARD||new se,e.WINDOW_WILDCARD}function ce(e,t){return void 0===e&&(e="store"),void 0===t&&(t=ie),oe("windowStore").getOrSet(e,function(){var r=new I,n=function(e){return r.getOrSet(e,t)};return{has:function(t){return n(t).hasOwnProperty(e)},get:function(t,r){var i=n(t);return i.hasOwnProperty(e)?i[e]:r},set:function(t,r){return n(t)[e]=r,r},del:function(t){delete n(t)[e]},getOrSet:function(t,r){return Y(n(t),e,r)}}})}function ue(){return oe("instance").getOrSet("instanceID",L)}function de(e,t){var r=t.domain,n=ce("helloPromises"),i=n.get(e);i&&i.resolve({domain:r});var o=O.resolve({domain:r});return n.set(e,o),o}function pe(e,t){return(0,t.send)(e,"postrobot_hello",{instanceID:ue()},{domain:"*",timeout:-1}).then(function(t){var r=t.origin,n=t.data.instanceID;return de(e,{domain:r}),{win:e,domain:r,instanceID:n}})}function he(e,t){var r=t.send;return ce("windowInstanceIDPromises").getOrSet(e,function(){return pe(e,{send:r}).then(function(e){return e.instanceID})})}function fe(e){ce("knownWindows").set(e,!0)}function ge(e){return"object"==typeof e&&null!==e&&"string"==typeof e.__type__}function me(e){return void 0===e?"undefined":null===e?"null":Array.isArray(e)?"array":"function"==typeof e?"function":"object"==typeof e?e instanceof Error?"error":"function"==typeof e.then?"promise":"[object RegExp]"==={}.toString.call(e)?"regex":"[object Date]"==={}.toString.call(e)?"date":"object":"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":void 0}function ve(e,t){return{__type__:e,__val__:t}}var ye,be=((ae={}).function=function(){},ae.error=function(e){return ve("error",{message:e.message,stack:e.stack,code:e.code,data:e.data})},ae.promise=function(){},ae.regex=function(e){return ve("regex",e.source)},ae.date=function(e){return ve("date",e.toJSON())},ae.array=function(e){return e},ae.object=function(e){return e},ae.string=function(e){return e},ae.number=function(e){return e},ae.boolean=function(e){return e},ae.null=function(e){return e},ae[void 0]=function(e){return ve("undefined",e)},ae),qe={},Ve=((ye={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},ye.error=function(e){var t=e.stack,r=e.code,n=e.data,i=new Error(e.message);return i.code=r,n&&(i.data=n),i.stack=t+"\n\n"+i.stack,i},ye.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},ye.regex=function(e){return new RegExp(e)},ye.date=function(e){return new Date(e)},ye.array=function(e){return e},ye.object=function(e){return e},ye.string=function(e){return e},ye.number=function(e){return e},ye.boolean=function(e){return e},ye.null=function(e){return e},ye[void 0]=function(){},ye),Se={};function Ee(){for(var e=oe("idToProxyWindow"),t=0,r=e.keys();t<r.length;t++){var n=r[t];e.get(n).shouldClean()&&e.del(n)}}function xe(e,t){var r=t.send,n=t.id,i=void 0===n?L():n,o=e.then(function(e){if(h(e))return f(e).name}),a=e.then(function(e){if(b(e))throw new Error("Window is closed, can not determine type");return c(e)?"popup":"iframe"});o.catch(z),a.catch(z);var s=function(){return e.then(function(e){if(!b(e))return h(e)?f(e).name:o})};return{id:i,getType:function(){return a},getInstanceID:H(function(){return e.then(function(e){return he(e,{send:r})})}),close:function(){return e.then(x)},getName:s,focus:function(){return e.then(function(e){e.focus()})},isClosed:function(){return e.then(function(e){return b(e)})},setLocation:function(t,r){return void 0===r&&(r={}),e.then(function(e){var n=window.location.protocol+"//"+window.location.host,i=r.method,o=void 0===i?"get":i,a=r.body;if(0===t.indexOf("/"))t=""+n+t;else if(!t.match(/^https?:\/\//)&&0!==t.indexOf(n))throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(t));if("post"===o)return s().then(function(e){if(!e)throw new Error("Can not post to window without target name");!function(e){var t=e.url,r=e.target,n=e.body,i=e.method,o=void 0===i?"post":i,a=document.createElement("form");if(a.setAttribute("target",r),a.setAttribute("method",o),a.setAttribute("action",t),a.style.display="none",n)for(var s=0,l=Object.keys(n);s<l.length;s++){var c,u=l[s],d=document.createElement("input");d.setAttribute("name",u),d.setAttribute("value",null==(c=n[u])?void 0:c.toString()),a.appendChild(d)}Q().appendChild(a),a.submit(),Q().removeChild(a)}({url:t,target:e,method:o,body:a})});if("get"!==o)throw new Error("Unsupported method: "+o);if(h(e))try{if(e.location&&"function"==typeof e.location.replace)return void e.location.replace(t)}catch(l){}e.location=t})},setName:function(t){return e.then(function(e){var r=h(e),n=E(e);if(!r)throw new Error("Can not set name for cross-domain window: "+t);f(e).name=t,n&&n.setAttribute("name",t),o=O.resolve(t)})}}}new O(function(e){if(window.document&&window.document.body)return e(window.document.body);var t=setInterval(function(){if(window.document&&window.document.body)return clearInterval(t),e(window.document.body)},10)});var Ce=function(){function e(e){var t=e.send,r=e.win,n=e.serializedWindow;this.id=void 0,this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.name=void 0,this.actualWindowPromise=new O,this.serializedWindow=n||xe(this.actualWindowPromise,{send:t}),oe("idToProxyWindow").set(this.getID(),this),r&&this.setWindow(r,{send:t})}var t=e.prototype;return t.getID=function(){return this.serializedWindow.id},t.getType=function(){return this.serializedWindow.getType()},t.isPopup=function(){return this.getType().then(function(e){return"popup"===e})},t.setLocation=function(e,t){var r=this;return this.serializedWindow.setLocation(e,t).then(function(){return r})},t.getName=function(){return this.serializedWindow.getName()},t.setName=function(e){var t=this;return this.serializedWindow.setName(e).then(function(){return t})},t.close=function(){var e=this;return this.serializedWindow.close().then(function(){return e})},t.focus=function(){var e=this,t=this.isPopup(),r=this.getName(),n=O.hash({isPopup:t,name:r}).then(function(e){var t=e.name;e.isPopup&&t&&window.open("",t,"noopener")}),i=this.serializedWindow.focus();return O.all([n,i]).then(function(){return e})},t.isClosed=function(){return this.serializedWindow.isClosed()},t.getWindow=function(){return this.actualWindow},t.setWindow=function(e,t){var r=t.send;this.actualWindow=e,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=xe(this.actualWindowPromise,{send:r,id:this.getID()}),ce("winToProxyWindow").set(e,this)},t.awaitWindow=function(){return this.actualWindowPromise},t.matchWindow=function(e,t){var r=this,n=t.send;return O.try(function(){return r.actualWindow?e===r.actualWindow:O.hash({proxyInstanceID:r.getInstanceID(),knownWindowInstanceID:he(e,{send:n})}).then(function(t){var i=t.proxyInstanceID===t.knownWindowInstanceID;return i&&r.setWindow(e,{send:n}),i})})},t.unwrap=function(){return this.actualWindow||this},t.getInstanceID=function(){return this.serializedWindow.getInstanceID()},t.shouldClean=function(){return Boolean(this.actualWindow&&b(this.actualWindow))},t.serialize=function(){return this.serializedWindow},e.unwrap=function(t){return e.isProxyWindow(t)?t.unwrap():t},e.serialize=function(t,r){var n=r.send;return Ee(),e.toProxyWindow(t,{send:n}).serialize()},e.deserialize=function(t,r){var n=r.send;return Ee(),oe("idToProxyWindow").get(t.id)||new e({serializedWindow:t,send:n})},e.isProxyWindow=function(e){return Boolean(e&&!S(e)&&e.isProxyWindow)},e.toProxyWindow=function(t,r){var n=r.send;if(Ee(),e.isProxyWindow(t))return t;var i=t;return ce("winToProxyWindow").get(i)||new e({win:i,send:n})},e}();function we(e,t,r,n,i){var o=ce("methodStore"),a=oe("proxyWindowMethods");Ce.isProxyWindow(n)?a.set(e,{val:t,name:r,domain:i,source:n}):(a.del(e),o.getOrSet(n,function(){return{}})[e]={domain:i,name:r,val:t,source:n})}function Re(e,t){var r=ce("methodStore"),n=oe("proxyWindowMethods");return r.getOrSet(e,function(){return{}})[t]||n.get(t)}function Ae(e,t,r,n,i){var o,a,s;a=(o={on:i.on,send:i.send}).on,s=o.send,oe("builtinListeners").getOrSet("functionCalls",function(){return a("postrobot_method",{domain:"*"},function(e){var t=e.source,r=e.origin,n=e.data,i=n.id,o=n.name,a=Re(t,i);if(!a)throw new Error("Could not find method '"+o+"' with id: "+n.id+" in "+p(window));var l=a.source,c=a.domain,u=a.val;return O.try(function(){if(!V(c,r))throw new Error("Method '"+n.name+"' domain "+JSON.stringify(Z(a.domain)?a.domain.source:a.domain)+" does not match origin "+r+" in "+p(window));if(Ce.isProxyWindow(l))return l.matchWindow(t,{send:s}).then(function(e){if(!e)throw new Error("Method call '"+n.name+"' failed - proxy window does not match source in "+p(window))})}).then(function(){return u.apply({source:t,origin:r},n.args)},function(e){return O.try(function(){if(u.onError)return u.onError(e)}).then(function(){var t,r;throw e.stack&&(e.stack="Remote call to "+o+"("+(void 0===(t=n.args)&&(t=[]),(r=t,[].slice.call(r)).map(function(e){return"string"==typeof e?"'"+e+"'":void 0===e?"undefined":null===e?"null":"boolean"==typeof e?e.toString():Array.isArray(e)?"[ ... ]":"object"==typeof e?"{ ... }":"function"==typeof e?"() => { ... }":"<"+typeof e+">"}).join(", ")+") failed\n\n")+e.stack),e})}).then(function(e){return{result:e,id:i,name:o}})})});var l=r.__id__||L();e=Ce.unwrap(e);var c=r.__name__||r.name||n;return"string"==typeof c&&"function"==typeof c.indexOf&&0===c.indexOf("anonymous::")&&(c=c.replace("anonymous::",n+"::")),Ce.isProxyWindow(e)?(we(l,r,c,e,t),e.awaitWindow().then(function(e){we(l,r,c,e,t)})):we(l,r,c,e,t),ve("cross_domain_function",{id:l,name:c})}function Te(e,t,r,n){var i,o=n.on,a=n.send;return function(e,t){void 0===t&&(t=qe);var r=JSON.stringify(e,function(e){var r=this[e];if(ge(this))return r;var n=me(r);if(!n)return r;var i=t[n]||be[n];return i?i(r,e):r});return void 0===r?"undefined":r}(r,((i={}).promise=function(r,n){return i=r,ve("cross_domain_zalgo_promise",{then:Ae(e,t,function(e,t){return i.then(e,t)},n,{on:(s={on:o,send:a}).on,send:s.send})});var i,s},i.function=function(r,n){return Ae(e,t,r,n,{on:o,send:a})},i.object=function(e){return S(e)||Ce.isProxyWindow(e)?ve("cross_domain_window",Ce.serialize(e,{send:a})):e},i))}function ke(e,t,r,n){var i,o=n.send;return function(e,t){if(void 0===t&&(t=Se),"undefined"!==e)return JSON.parse(e,function(e,r){if(ge(this))return r;var n,i;if(ge(r)?(n=r.__type__,i=r.__val__):(n=me(r),i=r),!n)return i;var o=t[n]||Ve[n];return o?o(i,e):i})}(r,((i={}).cross_domain_zalgo_promise=function(e){return new O(e.then)},i.cross_domain_function=function(r){return n=e,i=t,s={send:o},l=(a=r).id,c=a.name,u=s.send,d=function(e){function t(){var r=arguments;return Ce.toProxyWindow(n,{send:u}).awaitWindow().then(function(n){var o=Re(n,l);if(o&&o.val!==t)return o.val.apply({source:window,origin:p()},r);var a=[].slice.call(r);return e.fireAndForget?u(n,"postrobot_method",{id:l,name:c,args:a},{domain:i,fireAndForget:!0}):u(n,"postrobot_method",{id:l,name:c,args:a},{domain:i,fireAndForget:!1}).then(function(e){return e.data.result})}).catch(function(e){throw e})}return void 0===e&&(e={}),t.__name__=c,t.__origin__=i,t.__source__=n,t.__id__=l,t.origin=i,t},(h=d()).fireAndForget=d({fireAndForget:!0}),h;var n,i,a,s,l,c,u,d,h},i.cross_domain_window=function(e){return Ce.deserialize(e,{send:o})},i))}var Ne={};function Pe(e,t,r,n){var i=n.on,o=n.send;return O.try(function(){var n=ce().getOrSet(e,function(){return{}});return n.buffer=n.buffer||[],n.buffer.push(r),n.flush=n.flush||O.flush().then(function(){if(b(e))throw new Error("Window is closed");var r,a=Te(e,t,((r={}).__post_robot_10_0_46__=n.buffer||[],r),{on:i,send:o});delete n.buffer;for(var s=Object.keys(Ne),l=[],c=0;c<s.length;c++){var u=s[c];try{Ne[u](e,a,t)}catch(d){l.push(d)}}if(l.length===s.length)throw new Error("All post-robot messaging strategies failed:\n\n"+l.map(function(e,t){return t+". "+X(e)}).join("\n\n"))}),n.flush.then(function(){delete n.flush})}).then(z)}function Oe(e){return oe("responseListeners").get(e)}function Fe(e){oe("responseListeners").del(e)}function _e(e){return oe("erroredResponseListeners").has(e)}function Ie(e){var t=e.name,r=e.win,n=e.domain,i=ce("requestListeners");if("*"===r&&(r=null),"*"===n&&(n=null),!t)throw new Error("Name required to get request listener");for(var o=0,a=[r,le()];o<a.length;o++){var s=a[o];if(s){var l=i.get(s);if(l){var c=l[t];if(c){if(n&&"string"==typeof n){if(c[n])return c[n];if(c.__domain_regex__)for(var u=0,d=c.__domain_regex__;u<d.length;u++){var p=d[u],h=p.listener;if(V(p.regex,n))return h}}if(c["*"])return c["*"]}}}}}function De(e,t,r,n){var i=n.on,o=n.send,a=Ie({name:r.name,win:e,domain:t}),s="postrobot_method"===r.name&&r.data&&"string"==typeof r.data.name?r.data.name+"()":r.name;function l(n,a,l){return O.flush().then(function(){if(!r.fireAndForget&&!b(e))try{return Pe(e,t,{id:L(),origin:p(window),type:"postrobot_message_response",hash:r.hash,name:r.name,ack:n,data:a,error:l},{on:i,send:o})}catch(c){throw new Error("Send response message failed for "+s+" in "+p()+"\n\n"+X(c))}})}return O.all([O.flush().then(function(){if(!r.fireAndForget&&!b(e))try{return Pe(e,t,{id:L(),origin:p(window),type:"postrobot_message_ack",hash:r.hash,name:r.name},{on:i,send:o})}catch(n){throw new Error("Send ack message failed for "+s+" in "+p()+"\n\n"+X(n))}}),O.try(function(){if(!a)throw new Error("No handler found for post message: "+r.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return a.handler({source:e,origin:t,data:r.data})}).then(function(e){return l("success",e)},function(e){return l("error",null,e)})]).then(z).catch(function(e){if(a&&a.handleError)return a.handleError(e);throw e})}function Ue(e,t,r){if(!_e(r.hash)){var n=Oe(r.hash);if(!n)throw new Error("No handler found for post message ack for message: "+r.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!V(n.domain,t))throw new Error("Ack origin "+t+" does not match domain "+n.domain.toString());if(e!==n.win)throw new Error("Ack source does not match registered window")}catch(i){n.promise.reject(i)}n.ack=!0}}function Le(e,t,r){if(!_e(r.hash)){var i,o=Oe(r.hash);if(!o)throw new Error("No handler found for post message response for message: "+r.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!V(o.domain,t))throw new Error("Response origin "+t+" does not match domain "+(i=o.domain,Array.isArray(i)?"("+i.join(" | ")+")":n(i)?"RegExp("+i.toString()+")":i.toString()));if(e!==o.win)throw new Error("Response source does not match registered window");Fe(r.hash),"error"===r.ack?o.promise.reject(r.error):"success"===r.ack&&o.promise.resolve({source:e,origin:t,data:r.data})}}function Be(e,t){var r=t.on,n=t.send,i=oe("receivedMessages");try{if(!window||window.closed||!e.source)return}catch(u){return}var o=e.source,a=e.origin,s=function(e,t,r,n){var i,o=n.on,a=n.send;try{i=ke(t,r,e,{on:o,send:a})}catch(u){return}if(i&&"object"==typeof i&&null!==i){var s=i.__post_robot_10_0_46__;if(Array.isArray(s))return s}}(e.data,o,a,{on:r,send:n});if(s){fe(o);for(var l=0;l<s.length;l++){var c=s[l];if(i.has(c.id))return;if(i.set(c.id,!0),b(o)&&!c.fireAndForget)return;0===c.origin.indexOf("file:")&&(a="file://");try{"postrobot_message_request"===c.type?De(o,a,c,{on:r,send:n}):"postrobot_message_response"===c.type?Le(o,a,c):"postrobot_message_ack"===c.type&&Ue(o,a,c)}catch(u){setTimeout(function(){throw u},0)}}}}function Me(e,t,r){if(!e)throw new Error("Expected name");if("function"==typeof(t=t||{})&&(r=t,t={}),!r)throw new Error("Expected handler");var n=function e(t,r){var n=t.name,i=t.win,o=t.domain,a=ce("requestListeners");if(!n||"string"!=typeof n)throw new Error("Name required to add request listener");if(i&&"*"!==i&&Ce.isProxyWindow(i)){var s=i.awaitWindow().then(function(t){return e({name:n,win:t,domain:o},r)});return{cancel:function(){s.then(function(e){return e.cancel()},z)}}}var l=i;if(Array.isArray(l)){for(var c=[],u=0,d=l;u<d.length;u++)c.push(e({name:n,domain:o,win:d[u]},r));return{cancel:function(){for(var e=0;e<c.length;e++)c[e].cancel()}}}if(Array.isArray(o)){for(var p=[],h=0,f=o;h<f.length;h++)p.push(e({name:n,win:l,domain:f[h]},r));return{cancel:function(){for(var e=0;e<p.length;e++)p[e].cancel()}}}var g=Ie({name:n,win:l,domain:o});l&&"*"!==l||(l=le());var m=(o=o||"*").toString();if(g)throw l&&o?new Error("Request listener already exists for "+n+" on domain "+o.toString()+" for "+(l===le()?"wildcard":"specified")+" window"):l?new Error("Request listener already exists for "+n+" for "+(l===le()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+n+" on domain "+o.toString()):new Error("Request listener already exists for "+n);var v,y,b=a.getOrSet(l,function(){return{}}),q=Y(b,n,function(){return{}});return Z(o)?(v=Y(q,"__domain_regex__",function(){return[]})).push(y={regex:o,listener:r}):q[m]=r,{cancel:function(){delete q[m],y&&(v.splice(v.indexOf(y,1)),v.length||delete q.__domain_regex__),Object.keys(q).length||delete b[n],l&&!Object.keys(b).length&&a.del(l)}}}({name:e,win:t.window,domain:t.domain||"*"},{handler:r||t.handler,handleError:t.errorHandler||function(e){throw e}});return{cancel:function(){n.cancel()}}}function We(e,t,r){"function"==typeof(t=t||{})&&(r=t,t={});var n,i=new O;return t.errorHandler=function(e){n.cancel(),i.reject(e)},n=Me(e,t,function(e){if(n.cancel(),i.resolve(e),r)return r(e)}),i.cancel=n.cancel,i}Ne.postrobot_post_message=function(e,t,r){0===r.indexOf("file:")&&(r="*"),e.postMessage(t,r)};var je=function e(t,r,n,i){var o=(i=i||{}).domain||"*",a=i.timeout||-1,s=i.timeout||5e3,c=i.fireAndForget||!1;return Ce.toProxyWindow(t,{send:e}).awaitWindow().then(function(t){return O.try(function(){if(function(e,t,r){if(!e)throw new Error("Expected name");if("string"!=typeof r&&!Array.isArray(r)&&!Z(r))throw new TypeError("Can not send "+e+". Expected domain "+JSON.stringify(r)+" to be a string, array, or regex");if(b(t))throw new Error("Can not send "+e+". Target window is closed")}(r,t,o),function(e,t){var r=q(t);if(r)return r===e;if(t===e)return!1;if(function(e){void 0===e&&(e=window);try{if(e.top)return e.top}catch(i){}if(l(e)===e)return e;try{if(g(window,e)&&window.top)return window.top}catch(i){}try{if(g(e,window)&&window.top)return window.top}catch(i){}for(var t=0,r=function e(t){for(var r=[],n=0,i=m(t);n<i.length;n++){var o=i[n];r.push(o);for(var a=0,s=e(o);a<s.length;a++)r.push(s[a])}return r}(e);t<r.length;t++){var n=r[t];try{if(n.top)return n.top}catch(i){}if(l(n)===n)return n}}(t)===t)return!1;for(var n=0,i=m(e);n<i.length;n++)if(i[n]===t)return!0;return!1}(window,t))return function(e,t,r){void 0===t&&(t=5e3),void 0===r&&(r="Window");var n,i=(n=e,ce("helloPromises").getOrSet(n,function(){return new O}));return-1!==t&&(i=i.timeout(t,new Error(r+" did not load after "+t+"ms"))),i}(t,s)}).then(function(r){return n=t,i=o,a=(void 0===r?{}:r).domain,s={send:e}.send,O.try(function(){return"string"==typeof i?i:O.try(function(){return a||pe(n,{send:s}).then(function(e){return e.domain})}).then(function(e){if(!V(i,i))throw new Error("Domain "+G(i)+" does not match "+G(i));return e})});var n,i,a,s}).then(function(i){var o,s,l,u,d=i,h="postrobot_method"===r&&n&&"string"==typeof n.name?n.name+"()":r,f=new O,g=r+"_"+L();if(!c){var m={name:r,win:t,domain:d,promise:f};l=g,u=m,oe("responseListeners").set(l,u);var v=ce("requestPromises").getOrSet(t,function(){return[]});v.push(f),f.catch(function(){!function(e){oe("erroredResponseListeners").set(e,!0)}(g),Fe(g)});var y=(s=t,ce("knownWindows").get(s,!1)?1e4:2e3),q=a,V=y,S=q,E=(function e(){o=setTimeout(function(){b(t)?f.reject(new Error("Window closed for "+r+" before "+(m.ack?"response":"ack"))):m.cancelled?f.reject(new Error("Response listener was cancelled for "+r)):(V=Math.max(V-500,0),-1!==S&&(S=Math.max(S-500,0)),m.ack||0!==V?0===S&&f.reject(new Error("No response for postMessage "+h+" in "+p()+" in "+q+"ms")):f.reject(new Error("No ack for postMessage "+h+" in "+p()+" in "+y+"ms"))),e()},500)}(),{cancel:function(){clearTimeout(o)}});f.finally(function(){E.cancel(),v.splice(v.indexOf(f,1))}).catch(z)}return Pe(t,d,{id:L(),origin:p(window),type:"postrobot_message_request",hash:g,name:r,data:n,fireAndForget:c},{on:Me,send:e}).then(function(){return c?f.resolve():f},function(e){throw new Error("Send request message failed for "+h+" in "+p()+"\n\n"+X(e))})})})};function Ke(e,t,r){return Te(e,t,r,{on:Me,send:je})}function He(e,t,r){return ke(e,t,r,{send:je})}function ze(e){return new Ce({send:je,win:e})}function Xe(e){return Ce.toProxyWindow(e,{send:je})}function Ge(){var e,t,r,n,i,o,a;ne().initialized||(ne().initialized=!0,i=(n={on:Me,send:je}).on,o=n.send,(a=ne()).receiveMessage=a.receiveMessage||function(e){return Be(e,{on:i,send:o})},t=(e={on:Me,send:je}).on,r=e.send,oe().getOrSet("postMessageListener",function(){return e=window,n=function(e){var n,i,o,a;n=e,o=(i={on:t,send:r}).on,a=i.send,O.try(function(){var e=n.source||n.sourceElement,t=n.origin||n.originalEvent&&n.originalEvent.origin,r=n.data;if("null"===t&&(t="file://"),e){if(!t)throw new Error("Post message did not have origin domain");Be({source:e,origin:t,data:r},{on:o,send:a})}})},e.addEventListener("message",n),{cancel:function(){e.removeEventListener("message",n)}};var e,n}),function(e){var t=e.on,r=e.send;oe("builtinListeners").getOrSet("helloListener",function(){var e=t("postrobot_hello",{domain:"*"},function(e){return de(e.source,{domain:e.origin}),{instanceID:ue()}}),n=q();return n&&pe(n,{send:r}).catch(function(e){}),e})}({on:Me,send:je}))}function Ze(){var e;!function(){for(var e=oe("responseListeners"),t=0,r=e.keys();t<r.length;t++){var n=r[t],i=e.get(n);i&&(i.cancelled=!0),e.del(n)}}(),(e=oe().get("postMessageListener"))&&e.cancel(),delete window.__post_robot_10_0_46__}var Ye=!0;function Qe(e){for(var t=0,r=ce("requestPromises").get(e,[]);t<r.length;t++)r[t].reject(new Error("Window "+(b(e)?"closed":"cleaned up")+" before response")).catch(z)}Ge()}])}(postRobot$1);var postRobotExports$1=postRobot$1.exports;!function(e){e.exports=postRobotExports$1,e.exports.default=e.exports}(postRobot$2);var postRobotExports=postRobot$2.exports;const postRobot=getDefaultExportFromCjs(postRobotExports),Preview=e=>{const{data:t,buttonText:r,codeTestURL:n=codeTestUrlStatic,codeplayerURL:i=codePlayerUrlStatic,toRunCodeQuestion:o}=e,{verifyMode:a="",content:s="",topic:l,example:c,lang:u,cases:d}=t;React.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const p=React.useRef(null);return jsxRuntimeExports.jsx("div",{className:"question-preview",children:jsxRuntimeExports.jsx("div",{className:"content",children:jsxRuntimeExports.jsx("div",{className:"preview-container",children:jsxRuntimeExports.jsx("div",{className:"preview",children:jsxRuntimeExports.jsxs("div",{className:"preview-content",children:[jsxRuntimeExports.jsx(QuestionHeader,{score:t.score,type:t.type,difficulty:t.difficulty,currentIndex:null==t?void 0:t.currentIndex,questionsCount:null==t?void 0:t.questionsCount}),l&&jsxRuntimeExports.jsx("div",{className:"topic",children:l}),s.trim()?jsxRuntimeExports.jsx(RichEditor,{editorHeight:"fit-content",readOnly:!0,isBorder:!1,defaultValue:s,noPadding:!0}):jsxRuntimeExports.jsx("p",{}),jsxRuntimeExports.jsx(Button$1,{className:"submitBtn",onClick:()=>{if(o)o();else if(a===CCMVerifyMode.INPUT_OUTPUT){const e=window.open(n),t=null==d?void 0:d.map(({input:e,output:t})=>Array.isArray(e)?{input:e,output:t}:{input:[e],output:t});postRobot.send(e,"send",{title:l,content:s,initCode:c,code:c,lang:null==u?void 0:u.toLocaleLowerCase(),cases:t,submitCases:t,noSubmit:!0,aiEnabled:!0})}else{const e=window.open(`${i}`),r=()=>{let r=[c];if("html"===t.lang&&c)try{const e=JSON.parse(c);r=[e.html??"",e.css??"",e.js??""]}catch(n){}postRobot.send(e,"send",{title:l,content:s,lang:null==u?void 0:u.toLocaleLowerCase(),code:r,aiEnabled:!0,run:!1,dark:!0})};r(),postRobot.on("refresh",{window:e},async function(){p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{(null==e?void 0:e.closed)||r()},500)}),postRobot.on("change",{window:e},e=>{})}},type:"primary",style:{minWidth:"88px"},children:r||"去答题"})]})})})})})},{TextArea:TextArea}=Input,Completion=e=>{const{status:t,data:r,onSubmit:n,buttonText:i,onNextQuestion:o}=e,{answerOption:a,userAnswer:s,topic:l}=r,[c,u]=React.useState([]),[d,p]=React.useState(),[h,f]=React.useState(!1),g=e=>{if(m&&!e)return void staticMethods.warning("请先进行填空!");if(h&&!e)return void(null==o||o());const t=e||c,r=null==a?void 0:a.every((e,r)=>{var n;return(null==e?void 0:e.answer)===(null==(n=t[r])?void 0:n.answer)});p(r),f(!0),!e&&(null==n||n(t))},m=React.useMemo(()=>c.every(e=>!(null==e?void 0:e.answer)),[c]);return React.useEffect(()=>{let e;"string"==typeof s&&(e=tryParseJSON(s));const r=(e||s||a||[]).map(e=>({answer:t===QuestionStatus.ADD||s?null==e?void 0:e.answer:void 0}))??[];u(r),s&&g(r)},[t,s,a]),jsxRuntimeExports.jsxs("div",{className:"completion",children:[jsxRuntimeExports.jsx("div",{className:"completion-title",children:jsxRuntimeExports.jsxs("div",{className:"completion-title-content",children:[jsxRuntimeExports.jsx(QuestionHeader,{score:r.score,type:r.type,difficulty:r.difficulty,currentIndex:null==r?void 0:r.currentIndex,questionsCount:null==r?void 0:r.questionsCount}),jsxRuntimeExports.jsx(RichEditor,{isBorder:!1,defaultValue:l.indexOf("git")>-1?l.replace(/<code[^>]*>|<\/code>/g,""):l,readOnly:!0,autoHeight:{min:0,max:1e5},noPadding:!0})]})}),jsxRuntimeExports.jsx("div",{className:"completion-content",children:null==c?void 0:c.map((e,r)=>{var n,i,o;return jsxRuntimeExports.jsxs("div",{className:"item-warpper",children:[jsxRuntimeExports.jsxs("div",{className:"completion-content-item",children:[jsxRuntimeExports.jsxs("span",{children:["填空",r+1]}),jsxRuntimeExports.jsx(TextArea,{style:{resize:"none"},placeholder:t===QuestionStatus.EXAM||t===QuestionStatus.PREVIEW?"请输入答案":"",disabled:t===QuestionStatus.ADD||h,autoSize:{maxRows:3},value:null==e?void 0:e.answer,onChange:e=>((e,t)=>{p(void 0),f(!1);const r=e.target.value,n=[...c];n[t].answer=r,u(n)})(e,r)})]}),h&&jsxRuntimeExports.jsx("div",{className:"item-result "+((null==e?void 0:e.answer)===(null==(n=a[r])?void 0:n.answer)?"right":"error"),children:(null==e?void 0:e.answer)===(null==(i=a[r])?void 0:i.answer)?jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx(RefIcon$x,{})," 正确"]}):jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx(RefIcon$w,{})," 错误, ",jsxRuntimeExports.jsxs("span",{className:"answer",children:["正确答案:",null==(o=a[r])?void 0:o.answer]})]})})]},String(r))})}),n&&jsxRuntimeExports.jsx("div",{className:"submit-btn",children:jsxRuntimeExports.jsx(Button$1,{type:"primary",onClick:()=>g(),children:i||(h?"下一题":"提交")})})]})},AnswerQuestion=e=>{const{status:t=QuestionStatus.EXAM,data:r,onSubmit:n,buttonText:i,onNextQuestion:o}=e,[a,s]=React.useState(),[l,c]=React.useState(!1),u=React.useRef(null);React.useEffect(()=>{r.userAnswer&&(s(r.userAnswer),d(r.userAnswer))},[r]);const d=e=>{if(l&&!e)return void(null==o||o());const t=e||a;t?(c(!0),!e&&n&&n(t)):staticMethods.warning("请输入答案!")},p=[];return[QuestionStatus.ADD,QuestionStatus.MARK].includes(t)&&r&&(r.answer&&p.push({key:"1",label:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("span",{style:{fontWeight:"bold"},children:"参考答案"}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",color:"#999999"},children:"(学生不可见)"})]}),children:jsxRuntimeExports.jsx(RichEditor,{readOnly:!0,isBorder:!1,defaultValue:r.answer,autoHeight:{min:0,max:1e4}})}),r.judgeNorm&&p.push({key:"2",label:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("span",{style:{fontWeight:"bold"},children:"判分标准"}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",color:"#999999"},children:"(学生不可见)"})]}),children:jsxRuntimeExports.jsx(RichEditor,{readOnly:!0,defaultValue:r.judgeNorm,isBorder:!1,autoHeight:{min:0,max:1e4}})})),jsxRuntimeExports.jsxs("div",{className:"essay-question",children:[jsxRuntimeExports.jsx("div",{className:"essay-question-title",children:jsxRuntimeExports.jsxs("div",{className:"essay-question-title-content",children:[jsxRuntimeExports.jsx(QuestionHeader,{score:r.score,type:r.type,difficulty:r.difficulty,currentIndex:null==r?void 0:r.currentIndex,questionsCount:null==r?void 0:r.questionsCount}),jsxRuntimeExports.jsx(RichEditor,{defaultValue:null==r?void 0:r.topic,readOnly:!0,isBorder:!1,autoHeight:{min:0,max:1e5},noPadding:!0})]})}),jsxRuntimeExports.jsxs("div",{className:"essay-question-content",children:[[QuestionStatus.MARK,QuestionStatus.VIEW,QuestionStatus.EXAM,QuestionStatus.PREVIEW].includes(t)&&jsxRuntimeExports.jsx(RichEditor,{ref:u,readOnly:t===QuestionStatus.ADD||t===QuestionStatus.MARK||t===QuestionStatus.VIEW,editorHeight:220,defaultValue:(null==r?void 0:r.userAnswer)||"",placeholder:t===QuestionStatus.EXAM||t===QuestionStatus.PREVIEW?"请输入回答":"",onChange:e=>{s(e)},customToolbarKeys:["undo","redo","fullScreen","|","headerSelect","bold",{key:"group-image",title:"图片",iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M959.877 128l0.123 0.123v767.775l-0.123 0.122H64.102l-0.122-0.122V128.123l0.122-0.123h895.775zM960 64H64C28.795 64 0 92.795 0 128v768c0 35.205 28.795 64 64 64h896c35.205 0 64-28.795 64-64V128c0-35.205-28.795-64-64-64zM832 288.01c0 53.023-42.988 96.01-96.01 96.01s-96.01-42.987-96.01-96.01S682.967 192 735.99 192 832 234.988 832 288.01zM896 832H128V704l224.01-384 256 320h64l224.01-192z"></path></svg>',menuKeys:["insertImage","uploadImage"]},"insertTable"],uploadImageLimit:e=>e.size>3145728&&(staticMethods.destroy(),staticMethods.warning("仅能上传大小为3MB内的图片噢~"),!0)}),[QuestionStatus.ADD,QuestionStatus.MARK].includes(t)&&jsxRuntimeExports.jsx(Collapse,{defaultActiveKey:t===QuestionStatus.ADD?["1","2"].filter(e=>!("1"===e&&!(null==r?void 0:r.answer))&&!("2"===e&&!(null==r?void 0:r.judgeNorm))):[],ghost:!0,expandIcon:({isActive:e})=>jsxRuntimeExports.jsx(RefIcon$i,{rotate:e?90:0}),items:p})]}),n&&jsxRuntimeExports.jsx("div",{className:"submit-btn",children:jsxRuntimeExports.jsx(Button$1,{type:"primary",onClick:()=>d(),children:i||l?"下一题":"提交"})})]})};"object"==typeof window&&window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),"undefined"!=typeof window&&[Element.prototype,Document.prototype,DocumentFragment.prototype].forEach(e=>{Object.prototype.hasOwnProperty.call(e,"append")||Object.defineProperty(e,"append",{configurable:!0,enumerable:!0,writable:!0,value(...e){const t=document.createDocumentFragment();e.forEach(e=>{const r=e instanceof Node;t.appendChild(r?e:document.createTextNode(String(e)))}),this.appendChild(t)}})});class Disposable{get disposed(){return!0===this._disposed}dispose(){this._disposed=!0}}var Disposable2,DisposableSet2;Disposable2=Disposable||(Disposable={}),Disposable2.dispose=function(){return(e,t,r)=>{const n=r.value,i=e.__proto__;r.value=function(...e){this.disposed||(n.call(this,...e),i.dispose.call(this))}}};class DisposableSet{constructor(){this.isDisposed=!1,this.items=new Set}get disposed(){return this.isDisposed}dispose(){this.isDisposed||(this.isDisposed=!0,this.items.forEach(e=>{e.dispose()}),this.items.clear())}contains(e){return this.items.has(e)}add(e){this.items.add(e)}remove(e){this.items.delete(e)}clear(){this.items.clear()}}DisposableSet2=DisposableSet||(DisposableSet={}),DisposableSet2.from=function(e){const t=new DisposableSet2;return e.forEach(e=>{t.add(e)}),t};var freeGlobal="object"==typeof global&&global&&global.Object===Object&&global,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),Symbol$1=root.Symbol,objectProto$j=Object.prototype,hasOwnProperty$i=objectProto$j.hasOwnProperty,nativeObjectToString$1=objectProto$j.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty$i.call(e,symToStringTag$1),r=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var n=!0}catch(e10){}var i=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),i}var objectProto$i=Object.prototype,nativeObjectToString=objectProto$i.toString;function objectToString(e){return nativeObjectToString.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return null!=e&&"object"==typeof e}var symbolTag$3="[object Symbol]";function isSymbol(e){return"symbol"==typeof e||isObjectLike(e)&&baseGetTag(e)==symbolTag$3}function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var isArray=Array.isArray,symbolProto$2=Symbol$1?Symbol$1.prototype:void 0,symbolToString=symbolProto$2?symbolProto$2.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray(e))return arrayMap(e,baseToString)+"";if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}var reWhitespace=/\s/;function trimmedEndIndex(e){for(var t=e.length;t--&&reWhitespace.test(e.charAt(t)););return t}var reTrimStart=/^\s+/;function baseTrim(e){return e?e.slice(0,trimmedEndIndex(e)+1).replace(reTrimStart,""):e}function isObject(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var NAN=NaN,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;function toNumber(e){if("number"==typeof e)return e;if(isSymbol(e))return NAN;if(isObject(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=baseTrim(e);var r=reIsBinary.test(e);return r||reIsOctal.test(e)?freeParseInt(e.slice(2),r?2:8):reIsBadHex.test(e)?NAN:+e}function identity(e){return e}var asyncTag="[object AsyncFunction]",funcTag$2="[object Function]",genTag$1="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject(e))return!1;var t=baseGetTag(e);return t==funcTag$2||t==genTag$1||t==asyncTag||t==proxyTag}var coreJsData=root["__core-js_shared__"],maskSrcKey=(uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||""),uid?"Symbol(src)_1."+uid:""),uid;function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource(e){if(null!=e){try{return funcToString$2.call(e)}catch(e10){}try{return e+""}catch(e10){}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$h=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$h=objectProto$h.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$h).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}function getValue(e,t){return null==e?void 0:e[t]}function getNative(e,t){var r=getValue(e,t);return baseIsNative(r)?r:void 0}var WeakMap$1=getNative(root,"WeakMap"),objectCreate=Object.create,baseCreate=function(){function e(){}return function(t){if(!isObject(t))return{};if(objectCreate)return objectCreate(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function apply$1(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function noop$2(){}function copyArray(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var HOT_COUNT=800,HOT_SPAN=16,nativeNow=Date.now;function shortOut(e){var t=0,r=0;return function(){var n=nativeNow(),i=HOT_SPAN-(n-r);if(r=n,i>0){if(++t>=HOT_COUNT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function constant(e){return function(){return e}}var defineProperty=function(){try{var e=getNative(Object,"defineProperty");return e({},"",{}),e}catch(e10){}}(),baseSetToString=defineProperty?function(e,t){return defineProperty(e,"toString",{configurable:!0,enumerable:!1,value:constant(t),writable:!0})}:identity,setToString=shortOut(baseSetToString);function arrayEach(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function baseFindIndex(e,t,r,n){for(var i=e.length,o=r+-1;++o<i;)if(t(e[o],o,e))return o;return-1}function baseIsNaN(e){return e!=e}function strictIndexOf(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function baseIndexOf(e,t,r){return t==t?strictIndexOf(e,t,r):baseFindIndex(e,baseIsNaN,r)}function arrayIncludes(e,t){return!!(null==e?0:e.length)&&baseIndexOf(e,t,0)>-1}var MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(e,t){var r=typeof e;return!!(t=null==t?MAX_SAFE_INTEGER$1:t)&&("number"==r||"symbol"!=r&&reIsUint.test(e))&&e>-1&&e%1==0&&e<t}function baseAssignValue(e,t,r){"__proto__"==t&&defineProperty?defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function eq(e,t){return e===t||e!=e&&t!=t}var objectProto$g=Object.prototype,hasOwnProperty$g=objectProto$g.hasOwnProperty;function assignValue(e,t,r){var n=e[t];hasOwnProperty$g.call(e,t)&&eq(n,r)&&(void 0!==r||t in e)||baseAssignValue(e,t,r)}function copyObject(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],l=void 0;void 0===l&&(l=e[s]),i?baseAssignValue(r,s,l):assignValue(r,s,l)}return r}var nativeMax$1=Math.max;function overRest(e,t,r){return t=nativeMax$1(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=nativeMax$1(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),apply$1(e,this,s)}}function baseRest(e,t){return setToString(overRest(e,t,identity),e+"")}var MAX_SAFE_INTEGER=9007199254740991;function isLength(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=MAX_SAFE_INTEGER}function isArrayLike(e){return null!=e&&isLength(e.length)&&!isFunction(e)}function isIterateeCall(e,t,r){if(!isObject(r))return!1;var n=typeof t;return!!("number"==n?isArrayLike(r)&&isIndex(t,r.length):"string"==n&&t in r)&&eq(r[t],e)}function createAssigner(e){return baseRest(function(t,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,a&&isIterateeCall(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,o)}return t})}var objectProto$f=Object.prototype;function isPrototype(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||objectProto$f)}function baseTimes(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var argsTag$3="[object Arguments]";function baseIsArguments(e){return isObjectLike(e)&&baseGetTag(e)==argsTag$3}var objectProto$e=Object.prototype,hasOwnProperty$f=objectProto$e.hasOwnProperty,propertyIsEnumerable$1=objectProto$e.propertyIsEnumerable,isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&hasOwnProperty$f.call(e,"callee")&&!propertyIsEnumerable$1.call(e,"callee")};function stubFalse(){return!1}var freeExports$2="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule$2=freeExports$2&&"object"==typeof module&&module&&!module.nodeType&&module,moduleExports$2=freeModule$2&&freeModule$2.exports===freeExports$2,Buffer$2=moduleExports$2?root.Buffer:void 0,nativeIsBuffer=Buffer$2?Buffer$2.isBuffer:void 0,isBuffer=nativeIsBuffer||stubFalse,argsTag$2="[object Arguments]",arrayTag$2="[object Array]",boolTag$3="[object Boolean]",dateTag$3="[object Date]",errorTag$2="[object Error]",funcTag$1="[object Function]",mapTag$6="[object Map]",numberTag$4="[object Number]",objectTag$4="[object Object]",regexpTag$3="[object RegExp]",setTag$6="[object Set]",stringTag$3="[object String]",weakMapTag$2="[object WeakMap]",arrayBufferTag$3="[object ArrayBuffer]",dataViewTag$4="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};function baseIsTypedArray(e){return isObjectLike(e)&&isLength(e.length)&&!!typedArrayTags[baseGetTag(e)]}function baseUnary(e){return function(t){return e(t)}}typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0,typedArrayTags[argsTag$2]=typedArrayTags[arrayTag$2]=typedArrayTags[arrayBufferTag$3]=typedArrayTags[boolTag$3]=typedArrayTags[dataViewTag$4]=typedArrayTags[dateTag$3]=typedArrayTags[errorTag$2]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag$6]=typedArrayTags[numberTag$4]=typedArrayTags[objectTag$4]=typedArrayTags[regexpTag$3]=typedArrayTags[setTag$6]=typedArrayTags[stringTag$3]=typedArrayTags[weakMapTag$2]=!1;var freeExports$1="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&"object"==typeof module&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal.process,nodeUtil=function(){try{var e=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return e||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e10){}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$d=Object.prototype,hasOwnProperty$e=objectProto$d.hasOwnProperty;function arrayLikeKeys(e,t){var r=isArray(e),n=!r&&isArguments(e),i=!r&&!n&&isBuffer(e),o=!r&&!n&&!i&&isTypedArray(e),a=r||n||i||o,s=a?baseTimes(e.length,String):[],l=s.length;for(var c in e)!t&&!hasOwnProperty$e.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||isIndex(c,l))||s.push(c);return s}function overArg(e,t){return function(r){return e(t(r))}}var nativeKeys=overArg(Object.keys,Object),objectProto$c=Object.prototype,hasOwnProperty$d=objectProto$c.hasOwnProperty;function baseKeys(e){if(!isPrototype(e))return nativeKeys(e);var t=[];for(var r in Object(e))hasOwnProperty$d.call(e,r)&&"constructor"!=r&&t.push(r);return t}function keys(e){return isArrayLike(e)?arrayLikeKeys(e):baseKeys(e)}function nativeKeysIn(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}var objectProto$b=Object.prototype,hasOwnProperty$c=objectProto$b.hasOwnProperty;function baseKeysIn(e){if(!isObject(e))return nativeKeysIn(e);var t=isPrototype(e),r=[];for(var n in e)("constructor"!=n||!t&&hasOwnProperty$c.call(e,n))&&r.push(n);return r}function keysIn(e){return isArrayLike(e)?arrayLikeKeys(e,!0):baseKeysIn(e)}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,t){if(isArray(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var nativeCreate=getNative(Object,"create");function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{},this.size=0}function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var HASH_UNDEFINED$2="__lodash_hash_undefined__",objectProto$a=Object.prototype,hasOwnProperty$b=objectProto$a.hasOwnProperty;function hashGet(e){var t=this.__data__;if(nativeCreate){var r=t[e];return r===HASH_UNDEFINED$2?void 0:r}return hasOwnProperty$b.call(t,e)?t[e]:void 0}var objectProto$9=Object.prototype,hasOwnProperty$a=objectProto$9.hasOwnProperty;function hashHas(e){var t=this.__data__;return nativeCreate?void 0!==t[e]:hasOwnProperty$a.call(t,e)}var HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate&&void 0===t?HASH_UNDEFINED$1:t,this}function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[],this.size=0}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice.call(t,r,1),--this.size,!0)}function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?void 0:t[r][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map$1=getNative(root,"Map");function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function getMapData(e,t){var r=e.__data__;return isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}function mapCacheDelete(e){var t=getMapData(this,e).delete(e);return this.size-=t?1:0,t}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT$2="Expected a function";function memoize$1(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT$2);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(memoize$1.Cache||MapCache),r}memoize$1.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var t=memoize$1(e,function(e){return r.size===MAX_MEMOIZE_SIZE&&r.clear(),e}),r=t.cache;return t}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rePropName,function(e,r,n,i){t.push(n?i.replace(reEscapeChar,"$1"):r||e)}),t});function toString(e){return null==e?"":baseToString(e)}function castPath(e,t){return isArray(e)?e:isKey(e,t)?[e]:stringToPath(toString(e))}function toKey(e){if("string"==typeof e||isSymbol(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function baseGet(e,t){for(var r=0,n=(t=castPath(t,e)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}function get(e,t,r){var n=null==e?void 0:baseGet(e,t);return void 0===n?r:n}function arrayPush(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var spreadableSymbol=Symbol$1?Symbol$1.isConcatSpreadable:void 0;function isFlattenable(e){return isArray(e)||isArguments(e)||!!(spreadableSymbol&&e&&e[spreadableSymbol])}function baseFlatten(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=isFlattenable),i||(i=[]);++o<a;){var s=e[o];r(s)?arrayPush(i,s):n||(i[i.length]=s)}return i}function flatten(e){return(null==e?0:e.length)?baseFlatten(e):[]}function flatRest(e){return setToString(overRest(e,void 0,flatten),e+"")}var getPrototype=overArg(Object.getPrototypeOf,Object),objectTag$3="[object Object]",funcProto=Function.prototype,objectProto$8=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$9=objectProto$8.hasOwnProperty,objectCtorString=funcToString.call(Object);function isPlainObject(e){if(!isObjectLike(e)||baseGetTag(e)!=objectTag$3)return!1;var t=getPrototype(e);if(null===t)return!0;var r=hasOwnProperty$9.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&funcToString.call(r)==objectCtorString}function baseSlice(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n<i;)o[n]=e[n+t];return o}function castSlice(e,t,r){var n=e.length;return r=void 0===r?n:r,!t&&r>=n?e:baseSlice(e,t,r)}var rsAstralRange$2="\\ud800-\\udfff",rsComboMarksRange$3="\\u0300-\\u036f",reComboHalfMarksRange$3="\\ufe20-\\ufe2f",rsComboSymbolsRange$3="\\u20d0-\\u20ff",rsComboRange$3=rsComboMarksRange$3+reComboHalfMarksRange$3+rsComboSymbolsRange$3,rsVarRange$2="\\ufe0e\\ufe0f",rsZWJ$2="\\u200d",reHasUnicode=RegExp("["+rsZWJ$2+rsAstralRange$2+rsComboRange$3+rsVarRange$2+"]");function hasUnicode(e){return reHasUnicode.test(e)}function asciiToArray(e){return e.split("")}var rsAstralRange$1="\\ud800-\\udfff",rsComboMarksRange$2="\\u0300-\\u036f",reComboHalfMarksRange$2="\\ufe20-\\ufe2f",rsComboSymbolsRange$2="\\u20d0-\\u20ff",rsComboRange$2=rsComboMarksRange$2+reComboHalfMarksRange$2+rsComboSymbolsRange$2,rsVarRange$1="\\ufe0e\\ufe0f",rsAstral="["+rsAstralRange$1+"]",rsCombo$2="["+rsComboRange$2+"]",rsFitz$1="\\ud83c[\\udffb-\\udfff]",rsModifier$1="(?:"+rsCombo$2+"|"+rsFitz$1+")",rsNonAstral$1="[^"+rsAstralRange$1+"]",rsRegional$1="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair$1="[\\ud800-\\udbff][\\udc00-\\udfff]",rsZWJ$1="\\u200d",reOptMod$1=rsModifier$1+"?",rsOptVar$1="["+rsVarRange$1+"]?",rsOptJoin$1="(?:"+rsZWJ$1+"(?:"+[rsNonAstral$1,rsRegional$1,rsSurrPair$1].join("|")+")"+rsOptVar$1+reOptMod$1+")*",rsSeq$1=rsOptVar$1+reOptMod$1+rsOptJoin$1,rsSymbol="(?:"+[rsNonAstral$1+rsCombo$2+"?",rsCombo$2,rsRegional$1,rsSurrPair$1,rsAstral].join("|")+")",reUnicode=RegExp(rsFitz$1+"(?="+rsFitz$1+")|"+rsSymbol+rsSeq$1,"g");function unicodeToArray(e){return e.match(reUnicode)||[]}function stringToArray$1(e){return hasUnicode(e)?unicodeToArray(e):asciiToArray(e)}function createCaseFirst(e){return function(t){var r=hasUnicode(t=toString(t))?stringToArray$1(t):void 0,n=r?r[0]:t.charAt(0),i=r?castSlice(r,1).join(""):t.slice(1);return n[e]()+i}}var upperFirst=createCaseFirst("toUpperCase");function capitalize(e){return upperFirst(toString(e).toLowerCase())}function arrayReduce(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;)r=t(r,e[i],i,e);return r}function basePropertyOf(e){return function(t){return null==e?void 0:e[t]}}var deburredLetters={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},deburrLetter=basePropertyOf(deburredLetters),reLatin=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,rsComboMarksRange$1="\\u0300-\\u036f",reComboHalfMarksRange$1="\\ufe20-\\ufe2f",rsComboSymbolsRange$1="\\u20d0-\\u20ff",rsComboRange$1=rsComboMarksRange$1+reComboHalfMarksRange$1+rsComboSymbolsRange$1,rsCombo$1="["+rsComboRange$1+"]",reComboMark=RegExp(rsCombo$1,"g");function deburr(e){return(e=toString(e))&&e.replace(reLatin,deburrLetter).replace(reComboMark,"")}var reAsciiWord=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function asciiWords(e){return e.match(reAsciiWord)||[]}var reHasUnicodeWord=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function hasUnicodeWord(e){return reHasUnicodeWord.test(e)}var rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f",reComboHalfMarksRange="\\ufe20-\\ufe2f",rsComboSymbolsRange="\\u20d0-\\u20ff",rsComboRange=rsComboMarksRange+reComboHalfMarksRange+rsComboSymbolsRange,rsDingbatRange="\\u2700-\\u27bf",rsLowerRange="a-z\\xdf-\\xf6\\xf8-\\xff",rsMathOpRange="\\xac\\xb1\\xd7\\xf7",rsNonCharRange="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",rsPunctuationRange="\\u2000-\\u206f",rsSpaceRange=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",rsUpperRange="A-Z\\xc0-\\xd6\\xd8-\\xde",rsVarRange="\\ufe0e\\ufe0f",rsBreakRange=rsMathOpRange+rsNonCharRange+rsPunctuationRange+rsSpaceRange,rsApos$1="['’]",rsBreak="["+rsBreakRange+"]",rsCombo="["+rsComboRange+"]",rsDigits="\\d+",rsDingbat="["+rsDingbatRange+"]",rsLower="["+rsLowerRange+"]",rsMisc="[^"+rsAstralRange+rsBreakRange+rsDigits+rsDingbatRange+rsLowerRange+rsUpperRange+"]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier="(?:"+rsCombo+"|"+rsFitz+")",rsNonAstral="[^"+rsAstralRange+"]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsUpper="["+rsUpperRange+"]",rsZWJ="\\u200d",rsMiscLower="(?:"+rsLower+"|"+rsMisc+")",rsMiscUpper="(?:"+rsUpper+"|"+rsMisc+")",rsOptContrLower="(?:"+rsApos$1+"(?:d|ll|m|re|s|t|ve))?",rsOptContrUpper="(?:"+rsApos$1+"(?:D|LL|M|RE|S|T|VE))?",reOptMod=rsModifier+"?",rsOptVar="["+rsVarRange+"]?",rsOptJoin="(?:"+rsZWJ+"(?:"+[rsNonAstral,rsRegional,rsSurrPair].join("|")+")"+rsOptVar+reOptMod+")*",rsOrdLower="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",rsOrdUpper="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",rsSeq=rsOptVar+reOptMod+rsOptJoin,rsEmoji="(?:"+[rsDingbat,rsRegional,rsSurrPair].join("|")+")"+rsSeq,reUnicodeWord=RegExp([rsUpper+"?"+rsLower+"+"+rsOptContrLower+"(?="+[rsBreak,rsUpper,"$"].join("|")+")",rsMiscUpper+"+"+rsOptContrUpper+"(?="+[rsBreak,rsUpper+rsMiscLower,"$"].join("|")+")",rsUpper+"?"+rsMiscLower+"+"+rsOptContrLower,rsUpper+"+"+rsOptContrUpper,rsOrdUpper,rsOrdLower,rsDigits,rsEmoji].join("|"),"g");function unicodeWords(e){return e.match(reUnicodeWord)||[]}function words(e,t,r){return e=toString(e),void 0===t?hasUnicodeWord(e)?unicodeWords(e):asciiWords(e):e.match(t)||[]}var rsApos="['’]",reApos=RegExp(rsApos,"g");function createCompounder(e){return function(t){return arrayReduce(words(deburr(t).replace(reApos,"")),e,"")}}var camelCase=createCompounder(function(e,t,r){return t=t.toLowerCase(),e+(r?capitalize(t):t)});function baseClamp(e,t,r){return e==e&&(void 0!==r&&(e=e<=r?e:r),void 0!==t&&(e=e>=t?e:t)),e}function clamp(e,t,r){return void 0===r&&(r=t,t=void 0),void 0!==r&&(r=(r=toNumber(r))==r?r:0),void 0!==t&&(t=(t=toNumber(t))==t?t:0),baseClamp(toNumber(e),t,r)}function stackClear(){this.__data__=new ListCache,this.size=0}function stackDelete(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function stackGet(e){return this.__data__.get(e)}function stackHas(e){return this.__data__.has(e)}var LARGE_ARRAY_SIZE$2=200;function stackSet(e,t){var r=this.__data__;if(r instanceof ListCache){var n=r.__data__;if(!Map$1||n.length<LARGE_ARRAY_SIZE$2-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new MapCache(n)}return r.set(e,t),this.size=r.size,this}function Stack(e){var t=this.__data__=new ListCache(e);this.size=t.size}function baseAssign(e,t){return e&&copyObject(t,keys(t),e)}function baseAssignIn(e,t){return e&&copyObject(t,keysIn(t),e)}Stack.prototype.clear=stackClear,Stack.prototype.delete=stackDelete,Stack.prototype.get=stackGet,Stack.prototype.has=stackHas,Stack.prototype.set=stackSet;var freeExports="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&"object"==typeof module&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer$1=moduleExports?root.Buffer:void 0,allocUnsafe=Buffer$1?Buffer$1.allocUnsafe:void 0;function cloneBuffer(e,t){if(t)return e.slice();var r=e.length,n=allocUnsafe?allocUnsafe(r):new e.constructor(r);return e.copy(n),n}function arrayFilter(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}function stubArray(){return[]}var objectProto$7=Object.prototype,propertyIsEnumerable=objectProto$7.propertyIsEnumerable,nativeGetSymbols$1=Object.getOwnPropertySymbols,getSymbols=nativeGetSymbols$1?function(e){return null==e?[]:(e=Object(e),arrayFilter(nativeGetSymbols$1(e),function(t){return propertyIsEnumerable.call(e,t)}))}:stubArray;function copySymbols(e,t){return copyObject(e,getSymbols(e),t)}var nativeGetSymbols=Object.getOwnPropertySymbols,getSymbolsIn=nativeGetSymbols?function(e){for(var t=[];e;)arrayPush(t,getSymbols(e)),e=getPrototype(e);return t}:stubArray;function copySymbolsIn(e,t){return copyObject(e,getSymbolsIn(e),t)}function baseGetAllKeys(e,t,r){var n=t(e);return isArray(e)?n:arrayPush(n,r(e))}function getAllKeys(e){return baseGetAllKeys(e,keys,getSymbols)}function getAllKeysIn(e){return baseGetAllKeys(e,keysIn,getSymbolsIn)}var DataView$1=getNative(root,"DataView"),Promise$1=getNative(root,"Promise"),Set$1=getNative(root,"Set"),mapTag$5="[object Map]",objectTag$2="[object Object]",promiseTag="[object Promise]",setTag$5="[object Set]",weakMapTag$1="[object WeakMap]",dataViewTag$3="[object DataView]",dataViewCtorString=toSource(DataView$1),mapCtorString=toSource(Map$1),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set$1),weakMapCtorString=toSource(WeakMap$1),getTag=baseGetTag;(DataView$1&&getTag(new DataView$1(new ArrayBuffer(1)))!=dataViewTag$3||Map$1&&getTag(new Map$1)!=mapTag$5||Promise$1&&getTag(Promise$1.resolve())!=promiseTag||Set$1&&getTag(new Set$1)!=setTag$5||WeakMap$1&&getTag(new WeakMap$1)!=weakMapTag$1)&&(getTag=function(e){var t=baseGetTag(e),r=t==objectTag$2?e.constructor:void 0,n=r?toSource(r):"";if(n)switch(n){case dataViewCtorString:return dataViewTag$3;case mapCtorString:return mapTag$5;case promiseCtorString:return promiseTag;case setCtorString:return setTag$5;case weakMapCtorString:return weakMapTag$1}return t});var objectProto$6=Object.prototype,hasOwnProperty$8=objectProto$6.hasOwnProperty;function initCloneArray(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&hasOwnProperty$8.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var Uint8Array$1=root.Uint8Array;function cloneArrayBuffer(e){var t=new e.constructor(e.byteLength);return new Uint8Array$1(t).set(new Uint8Array$1(e)),t}function cloneDataView(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var reFlags=/\w*$/;function cloneRegExp(e){var t=new e.constructor(e.source,reFlags.exec(e));return t.lastIndex=e.lastIndex,t}var symbolProto$1=Symbol$1?Symbol$1.prototype:void 0,symbolValueOf$1=symbolProto$1?symbolProto$1.valueOf:void 0;function cloneSymbol(e){return symbolValueOf$1?Object(symbolValueOf$1.call(e)):{}}function cloneTypedArray(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var boolTag$2="[object Boolean]",dateTag$2="[object Date]",mapTag$4="[object Map]",numberTag$3="[object Number]",regexpTag$2="[object RegExp]",setTag$4="[object Set]",stringTag$2="[object String]",symbolTag$2="[object Symbol]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$2="[object DataView]",float32Tag$1="[object Float32Array]",float64Tag$1="[object Float64Array]",int8Tag$1="[object Int8Array]",int16Tag$1="[object Int16Array]",int32Tag$1="[object Int32Array]",uint8Tag$1="[object Uint8Array]",uint8ClampedTag$1="[object Uint8ClampedArray]",uint16Tag$1="[object Uint16Array]",uint32Tag$1="[object Uint32Array]";function initCloneByTag(e,t,r){var n=e.constructor;switch(t){case arrayBufferTag$2:return cloneArrayBuffer(e);case boolTag$2:case dateTag$2:return new n(+e);case dataViewTag$2:return cloneDataView(e,r);case float32Tag$1:case float64Tag$1:case int8Tag$1:case int16Tag$1:case int32Tag$1:case uint8Tag$1:case uint8ClampedTag$1:case uint16Tag$1:case uint32Tag$1:return cloneTypedArray(e,r);case mapTag$4:return new n;case numberTag$3:case stringTag$2:return new n(e);case regexpTag$2:return cloneRegExp(e);case setTag$4:return new n;case symbolTag$2:return cloneSymbol(e)}}function initCloneObject(e){return"function"!=typeof e.constructor||isPrototype(e)?{}:baseCreate(getPrototype(e))}var mapTag$3="[object Map]";function baseIsMap(e){return isObjectLike(e)&&getTag(e)==mapTag$3}var nodeIsMap=nodeUtil&&nodeUtil.isMap,isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap,setTag$3="[object Set]";function baseIsSet(e){return isObjectLike(e)&&getTag(e)==setTag$3}var nodeIsSet=nodeUtil&&nodeUtil.isSet,isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet,CLONE_DEEP_FLAG$1=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG$2=4,argsTag$1="[object Arguments]",arrayTag$1="[object Array]",boolTag$1="[object Boolean]",dateTag$1="[object Date]",errorTag$1="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag$2="[object Map]",numberTag$2="[object Number]",objectTag$1="[object Object]",regexpTag$1="[object RegExp]",setTag$2="[object Set]",stringTag$1="[object String]",symbolTag$1="[object Symbol]",weakMapTag="[object WeakMap]",arrayBufferTag$1="[object ArrayBuffer]",dataViewTag$1="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",cloneableTags={};function baseClone(e,t,r,n,i,o){var a,s=t&CLONE_DEEP_FLAG$1,l=t&CLONE_FLAT_FLAG,c=t&CLONE_SYMBOLS_FLAG$2;if(void 0!==a)return a;if(!isObject(e))return e;var u=isArray(e);if(u){if(a=initCloneArray(e),!s)return copyArray(e,a)}else{var d=getTag(e),p=d==funcTag||d==genTag;if(isBuffer(e))return cloneBuffer(e,s);if(d==objectTag$1||d==argsTag$1||p&&!i){if(a=l||p?{}:initCloneObject(e),!s)return l?copySymbolsIn(e,baseAssignIn(a,e)):copySymbols(e,baseAssign(a,e))}else{if(!cloneableTags[d])return i?e:{};a=initCloneByTag(e,d,s)}}o||(o=new Stack);var h=o.get(e);if(h)return h;o.set(e,a),isSet(e)?e.forEach(function(n){a.add(baseClone(n,t,r,n,e,o))}):isMap(e)&&e.forEach(function(n,i){a.set(i,baseClone(n,t,r,i,e,o))});var f=u?void 0:(c?l?getAllKeysIn:getAllKeys:l?keysIn:keys)(e);return arrayEach(f||e,function(n,i){f&&(n=e[i=n]),assignValue(a,i,baseClone(n,t,r,i,e,o))}),a}cloneableTags[argsTag$1]=cloneableTags[arrayTag$1]=cloneableTags[arrayBufferTag$1]=cloneableTags[dataViewTag$1]=cloneableTags[boolTag$1]=cloneableTags[dateTag$1]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag$2]=cloneableTags[numberTag$2]=cloneableTags[objectTag$1]=cloneableTags[regexpTag$1]=cloneableTags[setTag$2]=cloneableTags[stringTag$1]=cloneableTags[symbolTag$1]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag$1]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=!1;var CLONE_SYMBOLS_FLAG$1=4;function clone(e){return baseClone(e,CLONE_SYMBOLS_FLAG$1)}var CLONE_DEEP_FLAG=1,CLONE_SYMBOLS_FLAG=4;function cloneDeep(e){return baseClone(e,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}var HASH_UNDEFINED="__lodash_hash_undefined__";function setCacheAdd(e){return this.__data__.set(e,HASH_UNDEFINED),this}function setCacheHas(e){return this.__data__.has(e)}function SetCache(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new MapCache;++t<r;)this.add(e[t])}function arraySome(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function cacheHas(e,t){return e.has(t)}SetCache.prototype.add=SetCache.prototype.push=setCacheAdd,SetCache.prototype.has=setCacheHas;var COMPARE_PARTIAL_FLAG$5=1,COMPARE_UNORDERED_FLAG$3=2;function equalArrays(e,t,r,n,i,o){var a=r&COMPARE_PARTIAL_FLAG$5,s=e.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var c=o.get(e),u=o.get(t);if(c&&u)return c==t&&u==e;var d=-1,p=!0,h=r&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(o.set(e,t),o.set(t,e);++d<s;){var f=e[d],g=t[d];if(n)var m=a?n(g,f,d,t,e,o):n(f,g,d,e,t,o);if(void 0!==m){if(m)continue;p=!1;break}if(h){if(!arraySome(t,function(e,t){if(!cacheHas(h,t)&&(f===e||i(f,e,r,n,o)))return h.push(t)})){p=!1;break}}else if(f!==g&&!i(f,g,r,n,o)){p=!1;break}}return o.delete(e),o.delete(t),p}function mapToArray(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function setToArray(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var COMPARE_PARTIAL_FLAG$4=1,COMPARE_UNORDERED_FLAG$2=2,boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",mapTag$1="[object Map]",numberTag$1="[object Number]",regexpTag="[object RegExp]",setTag$1="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",symbolProto=Symbol$1?Symbol$1.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0;function equalByTag(e,t,r,n,i,o,a){switch(r){case dataViewTag:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case arrayBufferTag:return!(e.byteLength!=t.byteLength||!o(new Uint8Array$1(e),new Uint8Array$1(t)));case boolTag:case dateTag:case numberTag$1:return eq(+e,+t);case errorTag:return e.name==t.name&&e.message==t.message;case regexpTag:case stringTag:return e==t+"";case mapTag$1:var s=mapToArray;case setTag$1:var l=n&COMPARE_PARTIAL_FLAG$4;if(s||(s=setToArray),e.size!=t.size&&!l)return!1;var c=a.get(e);if(c)return c==t;n|=COMPARE_UNORDERED_FLAG$2,a.set(e,t);var u=equalArrays(s(e),s(t),n,i,o,a);return a.delete(e),u;case symbolTag:if(symbolValueOf)return symbolValueOf.call(e)==symbolValueOf.call(t)}return!1}var COMPARE_PARTIAL_FLAG$3=1,objectProto$5=Object.prototype,hasOwnProperty$7=objectProto$5.hasOwnProperty;function equalObjects(e,t,r,n,i,o){var a=r&COMPARE_PARTIAL_FLAG$3,s=getAllKeys(e),l=s.length;if(l!=getAllKeys(t).length&&!a)return!1;for(var c=l;c--;){var u=s[c];if(!(a?u in t:hasOwnProperty$7.call(t,u)))return!1}var d=o.get(e),p=o.get(t);if(d&&p)return d==t&&p==e;var h=!0;o.set(e,t),o.set(t,e);for(var f=a;++c<l;){var g=e[u=s[c]],m=t[u];if(n)var v=a?n(m,g,u,t,e,o):n(g,m,u,e,t,o);if(!(void 0===v?g===m||i(g,m,r,n,o):v)){h=!1;break}f||(f="constructor"==u)}if(h&&!f){var y=e.constructor,b=t.constructor;y==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b||(h=!1)}return o.delete(e),o.delete(t),h}var COMPARE_PARTIAL_FLAG$2=1,argsTag="[object Arguments]",arrayTag="[object Array]",objectTag="[object Object]",objectProto$4=Object.prototype,hasOwnProperty$6=objectProto$4.hasOwnProperty;function baseIsEqualDeep(e,t,r,n,i,o){var a=isArray(e),s=isArray(t),l=a?arrayTag:getTag(e),c=s?arrayTag:getTag(t),u=(l=l==argsTag?objectTag:l)==objectTag,d=(c=c==argsTag?objectTag:c)==objectTag,p=l==c;if(p&&isBuffer(e)){if(!isBuffer(t))return!1;a=!0,u=!1}if(p&&!u)return o||(o=new Stack),a||isTypedArray(e)?equalArrays(e,t,r,n,i,o):equalByTag(e,t,l,r,n,i,o);if(!(r&COMPARE_PARTIAL_FLAG$2)){var h=u&&hasOwnProperty$6.call(e,"__wrapped__"),f=d&&hasOwnProperty$6.call(t,"__wrapped__");if(h||f){var g=h?e.value():e,m=f?t.value():t;return o||(o=new Stack),i(g,m,r,n,o)}}return!!p&&(o||(o=new Stack),equalObjects(e,t,r,n,i,o))}function baseIsEqual(e,t,r,n,i){return e===t||(null==e||null==t||!isObjectLike(e)&&!isObjectLike(t)?e!=e&&t!=t:baseIsEqualDeep(e,t,r,n,baseIsEqual,i))}var COMPARE_PARTIAL_FLAG$1=1,COMPARE_UNORDERED_FLAG$1=2;function baseIsMatch(e,t,r,n){var i=r.length,o=i;if(null==e)return!o;for(e=Object(e);i--;){var a=r[i];if(a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){var s=(a=r[i])[0],l=e[s],c=a[1];if(a[2]){if(void 0===l&&!(s in e))return!1}else{var u=new Stack;if(!baseIsEqual(c,l,COMPARE_PARTIAL_FLAG$1|COMPARE_UNORDERED_FLAG$1,n,u))return!1}}return!0}function isStrictComparable(e){return e==e&&!isObject(e)}function getMatchData(e){for(var t=keys(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,isStrictComparable(i)]}return t}function matchesStrictComparable(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}function baseMatches(e){var t=getMatchData(e);return 1==t.length&&t[0][2]?matchesStrictComparable(t[0][0],t[0][1]):function(r){return r===e||baseIsMatch(r,e,t)}}function baseHasIn(e,t){return null!=e&&t in Object(e)}function hasPath(e,t,r){for(var n=-1,i=(t=castPath(t,e)).length,o=!1;++n<i;){var a=toKey(t[n]);if(!(o=null!=e&&r(e,a)))break;e=e[a]}return o||++n!=i?o:!!(i=null==e?0:e.length)&&isLength(i)&&isIndex(a,i)&&(isArray(e)||isArguments(e))}function hasIn(e,t){return null!=e&&hasPath(e,t,baseHasIn)}var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;function baseMatchesProperty(e,t){return isKey(e)&&isStrictComparable(t)?matchesStrictComparable(toKey(e),t):function(r){var n=get(r,e);return void 0===n&&n===t?hasIn(r,e):baseIsEqual(t,n,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG)}}function baseProperty(e){return function(t){return null==t?void 0:t[e]}}function basePropertyDeep(e){return function(t){return baseGet(t,e)}}function property(e){return isKey(e)?baseProperty(toKey(e)):basePropertyDeep(e)}function baseIteratee(e){return"function"==typeof e?e:null==e?identity:"object"==typeof e?isArray(e)?baseMatchesProperty(e[0],e[1]):baseMatches(e):property(e)}function arrayAggregator(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(n,a,r(a),e)}return n}function createBaseFor(e){return function(e,t,r){for(var n=-1,i=Object(e),o=r(e),a=o.length;a--;){var s=o[++n];if(!1===t(i[s],s,i))break}return e}}var baseFor=createBaseFor();function baseForOwn(e,t){return e&&baseFor(e,t,keys)}function createBaseEach(e,t){return function(t,r){if(null==t)return t;if(!isArrayLike(t))return e(t,r);for(var n=t.length,i=-1,o=Object(t);++i<n&&!1!==r(o[i],i,o););return t}}var baseEach=createBaseEach(baseForOwn);function baseAggregator(e,t,r,n){return baseEach(e,function(e,i,o){t(n,e,r(e),o)}),n}function createAggregator(e,t){return function(r,n){var i=isArray(r)?arrayAggregator:baseAggregator,o=t?t():{};return i(r,e,baseIteratee(n),o)}}var now=function(){return root.Date.now()},FUNC_ERROR_TEXT$1="Expected a function",nativeMax=Math.max,nativeMin$1=Math.min;function debounce$1(e,t,r){var n,i,o,a,s,l,c=0,u=!1,d=!1,p=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT$1);function h(t){var r=n,o=i;return n=i=void 0,c=t,a=e.apply(o,r)}function f(e){var r=e-l;return void 0===l||r>=t||r<0||d&&e-c>=o}function g(){var e=now();if(f(e))return m(e);s=setTimeout(g,function(e){var r=t-(e-l);return d?nativeMin$1(r,o-(e-c)):r}(e))}function m(e){return s=void 0,p&&n?h(e):(n=i=void 0,a)}function v(){var e=now(),r=f(e);if(n=arguments,i=this,l=e,r){if(void 0===s)return function(e){return c=e,s=setTimeout(g,t),u?h(e):a}(l);if(d)return clearTimeout(s),s=setTimeout(g,t),h(l)}return void 0===s&&(s=setTimeout(g,t)),a}return t=toNumber(t)||0,isObject(r)&&(u=!!r.leading,o=(d="maxWait"in r)?nativeMax(toNumber(r.maxWait)||0,t):o,p="trailing"in r?!!r.trailing:p),v.cancel=function(){void 0!==s&&clearTimeout(s),c=0,n=l=i=s=void 0},v.flush=function(){return void 0===s?a:m(now())},v}var objectProto$3=Object.prototype,hasOwnProperty$5=objectProto$3.hasOwnProperty,defaults$4=baseRest(function(e,t){e=Object(e);var r=-1,n=t.length,i=n>2?t[2]:void 0;for(i&&isIterateeCall(t[0],t[1],i)&&(n=1);++r<n;)for(var o=t[r],a=keysIn(o),s=-1,l=a.length;++s<l;){var c=a[s],u=e[c];(void 0===u||eq(u,objectProto$3[c])&&!hasOwnProperty$5.call(e,c))&&(e[c]=o[c])}return e});function assignMergeValue(e,t,r){(void 0!==r&&!eq(e[t],r)||void 0===r&&!(t in e))&&baseAssignValue(e,t,r)}function isArrayLikeObject(e){return isObjectLike(e)&&isArrayLike(e)}function safeGet(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function toPlainObject(e){return copyObject(e,keysIn(e))}function baseMergeDeep(e,t,r,n,i,o,a){var s=safeGet(e,r),l=safeGet(t,r),c=a.get(l);if(c)assignMergeValue(e,r,c);else{var u=o?o(s,l,r+"",e,t,a):void 0,d=void 0===u;if(d){var p=isArray(l),h=!p&&isBuffer(l),f=!p&&!h&&isTypedArray(l);u=l,p||h||f?isArray(s)?u=s:isArrayLikeObject(s)?u=copyArray(s):h?(d=!1,u=cloneBuffer(l,!0)):f?(d=!1,u=cloneTypedArray(l,!0)):u=[]:isPlainObject(l)||isArguments(l)?(u=s,isArguments(s)?u=toPlainObject(s):isObject(s)&&!isFunction(s)||(u=initCloneObject(l))):d=!1}d&&(a.set(l,u),i(u,l,n,o,a),a.delete(l)),assignMergeValue(e,r,u)}}function baseMerge(e,t,r,n,i){e!==t&&baseFor(t,function(o,a){if(i||(i=new Stack),isObject(o))baseMergeDeep(e,t,a,r,baseMerge,n,i);else{var s=n?n(safeGet(e,a),o,a+"",e,t,i):void 0;void 0===s&&(s=o),assignMergeValue(e,a,s)}},keysIn)}function customDefaultsMerge(e,t,r,n,i,o){return isObject(e)&&isObject(t)&&(o.set(t,e),baseMerge(e,t,void 0,customDefaultsMerge,o),o.delete(t)),e}var mergeWith=createAssigner(function(e,t,r,n){baseMerge(e,t,r,n)}),defaultsDeep=baseRest(function(e){return e.push(void 0,customDefaultsMerge),apply$1(mergeWith,void 0,e)}),LARGE_ARRAY_SIZE$1=200;function baseDifference(e,t,r,n){var i=-1,o=arrayIncludes,a=!0,s=e.length,l=[],c=t.length;if(!s)return l;t.length>=LARGE_ARRAY_SIZE$1&&(o=cacheHas,a=!1,t=new SetCache(t));e:for(;++i<s;){var u=e[i],d=u;if(u=0!==u?u:0,a&&d==d){for(var p=c;p--;)if(t[p]===d)continue e;l.push(u)}else o(t,d,n)||l.push(u)}return l}var difference=baseRest(function(e,t){return isArrayLikeObject(e)?baseDifference(e,baseFlatten(t,1,isArrayLikeObject,!0)):[]});function baseMap(e,t){var r=-1,n=isArrayLike(e)?Array(e.length):[];return baseEach(e,function(e,i,o){n[++r]=t(e,i,o)}),n}var objectProto$2=Object.prototype,hasOwnProperty$4=objectProto$2.hasOwnProperty,groupBy=createAggregator(function(e,t,r){hasOwnProperty$4.call(e,r)?e[r].push(t):baseAssignValue(e,r,[t])});function baseGt(e,t){return e>t}var objectProto$1=Object.prototype,hasOwnProperty$3=objectProto$1.hasOwnProperty;function baseHas(e,t){return null!=e&&hasOwnProperty$3.call(e,t)}function has(e,t){return null!=e&&hasPath(e,t,baseHas)}var mapTag="[object Map]",setTag="[object Set]",objectProto=Object.prototype,hasOwnProperty$2=objectProto.hasOwnProperty;function isEmpty(e){if(null==e)return!0;if(isArrayLike(e)&&(isArray(e)||"string"==typeof e||"function"==typeof e.splice||isBuffer(e)||isTypedArray(e)||isArguments(e)))return!e.length;var t=getTag(e);if(t==mapTag||t==setTag)return!e.size;if(isPrototype(e))return!baseKeys(e).length;for(var r in e)if(hasOwnProperty$2.call(e,r))return!1;return!0}function isEqual(e,t){return baseIsEqual(e,t)}var numberTag="[object Number]";function isNumber(e){return"number"==typeof e||isObjectLike(e)&&baseGetTag(e)==numberTag}var lowerFirst=createCaseFirst("toLowerCase");function baseExtremum(e,t,r){for(var n=-1,i=e.length;++n<i;){var o=e[n],a=t(o);if(null!=a&&(void 0===s?a==a&&!isSymbol(a):r(a,s)))var s=a,l=o}return l}function max(e){return e&&e.length?baseExtremum(e,identity,baseGt):void 0}var merge$2=createAssigner(function(e,t,r){baseMerge(e,t,r)});function baseSet(e,t,r,n){if(!isObject(e))return e;for(var i=-1,o=(t=castPath(t,e)).length,a=o-1,s=e;null!=s&&++i<o;){var l=toKey(t[i]),c=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(i!=a){var u=s[l];void 0===(c=void 0)&&(c=isObject(u)?u:isIndex(t[i+1])?[]:{})}assignValue(s,l,c),s=s[l]}return e}function basePickBy(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=baseGet(e,a);r(s,a)&&baseSet(o,castPath(a,e),s)}return o}function baseSortBy(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function compareAscending(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=e==e,o=isSymbol(e),a=void 0!==t,s=null===t,l=t==t,c=isSymbol(t);if(!s&&!c&&!o&&e>t||o&&a&&l&&!s&&!c||n&&a&&l||!r&&l||!i)return 1;if(!n&&!o&&!c&&e<t||c&&r&&i&&!n&&!o||s&&r&&i||!a&&i||!l)return-1}return 0}function compareMultiple(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,a=i.length,s=r.length;++n<a;){var l=compareAscending(i[n],o[n]);if(l)return n>=s?l:l*("desc"==r[n]?-1:1)}return e.index-t.index}function baseOrderBy(e,t,r){t=t.length?arrayMap(t,function(e){return isArray(e)?function(t){return baseGet(t,1===e.length?e[0]:e)}:e}):[identity];var n=-1;return t=arrayMap(t,baseUnary(baseIteratee)),baseSortBy(baseMap(e,function(e,r,i){return{criteria:arrayMap(t,function(t){return t(e)}),index:++n,value:e}}),function(e,t){return compareMultiple(e,t,r)})}function basePick(e,t){return basePickBy(e,t,function(t,r){return hasIn(e,r)})}var pick=flatRest(function(e,t){return null==e?{}:basePick(e,t)}),sortBy=baseRest(function(e,t){if(null==e)return[];var r=t.length;return r>1&&isIterateeCall(e,t[0],t[1])?t=[]:r>2&&isIterateeCall(t[0],t[1],t[2])&&(t=[t[0]]),baseOrderBy(e,baseFlatten(t),[])}),MAX_ARRAY_LENGTH$1=4294967295,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH$1-1,nativeFloor=Math.floor,nativeMin=Math.min;function baseSortedIndexBy(e,t,r,n){var i=0,o=null==e?0:e.length;if(0===o)return 0;for(var a=(t=r(t))!=t,s=null===t,l=isSymbol(t),c=void 0===t;i<o;){var u=nativeFloor((i+o)/2),d=r(e[u]),p=void 0!==d,h=null===d,f=d==d,g=isSymbol(d);if(a)var m=f;else m=c?f&&p:s?f&&p&&!h:l?f&&p&&!h&&!g:!h&&!g&&d<t;m?i=u+1:o=u}return nativeMin(o,MAX_ARRAY_INDEX)}var MAX_ARRAY_LENGTH=4294967295,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1;function baseSortedIndex(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=HALF_MAX_ARRAY_LENGTH){for(;n<i;){var o=n+i>>>1,a=e[o];null!==a&&!isSymbol(a)&&a<t?n=o+1:i=o}return i}return baseSortedIndexBy(e,t,identity)}function sortedIndex(e,t){return baseSortedIndex(e,t)}function sortedIndexBy(e,t,r){return baseSortedIndexBy(e,t,baseIteratee(r))}var startCase=createCompounder(function(e,t,r){return e+(r?" ":"")+upperFirst(t)}),FUNC_ERROR_TEXT="Expected a function";function throttle$1(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT);return isObject(r)&&(n="leading"in r||n,i="trailing"in r?!!r.trailing:i),debounce$1(e,t,{leading:n,maxWait:t,trailing:i})}var INFINITY=1/0,createSet=Set$1&&1/setToArray(new Set$1([,-0]))[1]==INFINITY?function(e){return new Set$1(e)}:noop$2,LARGE_ARRAY_SIZE=200;function baseUniq(e,t,r){var n=-1,i=arrayIncludes,o=e.length,a=!0,s=[],l=s;if(o>=LARGE_ARRAY_SIZE){var c=createSet(e);if(c)return setToArray(c);a=!1,i=cacheHas,l=new SetCache}else l=s;e:for(;++n<o;){var u=e[n],d=u;if(u=0!==u?u:0,a&&d==d){for(var p=l.length;p--;)if(l[p]===d)continue e;s.push(u)}else i(l,d,r)||(l!==s&&l.push(d),s.push(u))}return s}var union=baseRest(function(e){return baseUniq(baseFlatten(e,1,isArrayLikeObject,!0))});function uniq(e){return e&&e.length?baseUniq(e):[]}function apply(e,t,r){if(r)switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2]);case 4:return e.call(t,r[0],r[1],r[2],r[3]);case 5:return e.call(t,r[0],r[1],r[2],r[3],r[4]);case 6:return e.call(t,r[0],r[1],r[2],r[3],r[4],r[5]);default:return e.apply(t,r)}return e.call(t)}function call$1(e,t,...r){return apply(e,t,r)}function isAsyncLike(e){return"object"==typeof e&&e.then&&"function"==typeof e.then}function isAsync(e){return null!=e&&(e instanceof Promise||isAsyncLike(e))}function toAsyncBoolean(...e){const t=[];e.forEach(e=>{Array.isArray(e)?t.push(...e):t.push(e)});if(t.some(e=>isAsync(e))){const e=t.map(e=>isAsync(e)?e:Promise.resolve(!1!==e));return Promise.all(e).then(e=>e.reduce((e,t)=>!1!==t&&e,!0))}return t.every(e=>!1!==e)}function toDeferredBoolean(...e){const t=toAsyncBoolean(e);return"boolean"==typeof t?Promise.resolve(t):t}function call(e,t){const r=[];for(let n=0;n<e.length;n+=2){const i=apply(e[n],e[n+1],Array.isArray(t)?t:[t]);r.push(i)}return toAsyncBoolean(r)}class Events{constructor(){this.listeners={}}on(e,t,r){if(null==t)return this;this.listeners[e]||(this.listeners[e]=[]);return this.listeners[e].push(t,r),this}once(e,t,r){const n=(...i)=>(this.off(e,n),call([t,r],i));return this.on(e,n,this)}off(e,t,r){if(!(e||t||r))return this.listeners={},this;const n=this.listeners;return(e?[e]:Object.keys(n)).forEach(e=>{const i=n[e];if(i)if(t||r)for(let n=i.length-2;n>=0;n-=2)t&&i[n]!==t||r&&i[n+1]!==r||i.splice(n,2);else delete n[e]}),this}trigger(e,...t){let r=!0;if("*"!==e){const n=this.listeners[e];null!=n&&(r=call([...n],t))}const n=this.listeners["*"];return null!=n?toAsyncBoolean([r,call([...n],[e,...t])]):r}emit(e,...t){return this.trigger(e,...t)}}function applyMixins(e,...t){t.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(r=>{"constructor"!==r&&Object.defineProperty(e.prototype,r,Object.getOwnPropertyDescriptor(t.prototype,r))})})}const extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])};function inherit(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}let A$1=class{};const isNativeClass=/^\s*class\s+/.test(`${A$1}`)||/^\s*class\s*\{/.test(`${class{}}`);function createClass(e,t){let r;return isNativeClass?r=class extends t{}:(r=function(){return t.apply(this,arguments)},inherit(r,t)),Object.defineProperty(r,"name",{value:e}),r}function isMaliciousProp(e){return"__proto__"===e}function getByPath(e,t,r="/"){let n;const i=Array.isArray(t)?t:t.split(r);if(i.length)for(n=e;i.length;){const e=i.shift();if(Object(n)!==n||!e||!(e in n))return;n=n[e]}return n}function setByPath(e,t,r,n="/"){const i=Array.isArray(t)?t:t.split(n),o=i.pop();if(o&&!isMaliciousProp(o)){let t=e;i.forEach(e=>{isMaliciousProp(e)||(null==t[e]&&(t[e]={}),t=t[e])}),t[o]=r}return e}function unsetByPath(e,t,r="/"){const n=Array.isArray(t)?t.slice():t.split(r),i=n.pop();if(i)if(n.length>0){const t=getByPath(e,n);t&&delete t[i]}else delete e[i];return e}var __decorate$v=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Basecoat2;class Basecoat extends Events{dispose(){this.off()}}__decorate$v([Disposable.dispose()],Basecoat.prototype,"dispose",null),Basecoat2=Basecoat||(Basecoat={}),Basecoat2.dispose=Disposable.dispose,applyMixins(Basecoat,Disposable);const cacheStringFunction=e=>{const t=Object.create(null);return r=>t[r]||(t[r]=e(r))},kebabCase=cacheStringFunction(e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase()),pascalCase=cacheStringFunction(e=>startCase(camelCase(e)).replace(/ /g,""));function hashcode(e){let t=2166136261,r=!1,n=e;for(let i=0,o=n.length;i<o;i+=1){let e=n.charCodeAt(i);e>127&&!r&&(n=unescape(encodeURIComponent(n)),e=n.charCodeAt(i),r=!0),t^=e,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}return t>>>0}function uuid(){let e="";const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";for(let r=0,n=36;r<n;r+=1){const n=t[r],i=16*Math.random()|0;e+=("x"===n?i:"y"===n?3&i|8:n).toString(16)}return e}function getSpellingSuggestion(e,t,r){const n=Math.min(2,Math.floor(.34*e.length));let i,o=Math.floor(.4*e.length)+1,a=!1;const s=e.toLowerCase();for(const l of t){const t=r(l);if(void 0!==t&&Math.abs(t.length-s.length)<=n){const r=t.toLowerCase();if(r===s){if(t===e)continue;return l}if(a)continue;if(t.length<3)continue;const n=levenshteinWithMax(s,r,o-1);if(void 0===n)continue;n<3?(a=!0,i=l):(o=n,i=l)}}return i}function levenshteinWithMax(e,t,r){let n=new Array(t.length+1),i=new Array(t.length+1);const o=r+1;for(let s=0;s<=t.length;s+=1)n[s]=s;for(let s=1;s<=e.length;s+=1){const a=e.charCodeAt(s-1),l=s>r?s-r:1,c=t.length>r+s?r+s:t.length;i[0]=s;let u=s;for(let e=1;e<l;e+=1)i[e]=o;for(let e=l;e<=c;e+=1){const r=a===t.charCodeAt(e-1)?n[e-1]:Math.min(n[e]+1,i[e-1]+1,n[e-1]+2);i[e]=r,u=Math.min(u,r)}for(let e=c+1;e<=t.length;e+=1)i[e]=o;if(u>r)return;const d=n;n=i,i=d}const a=n[t.length];return a>r?void 0:a}function isPercentage(e){return"string"==typeof e&&"%"===e.slice(-1)}function normalizePercentage(e,t){if(null==e)return 0;let r;if("string"==typeof e){if(r=parseFloat(e),isPercentage(e)&&(r/=100,Number.isFinite(r)))return r*t}else r=e;return Number.isFinite(r)?r>0&&r<1?r*t:r:0}function normalizeSides(e){if("object"==typeof e){let t=0,r=0,n=0,i=0;return null!=e.vertical&&Number.isFinite(e.vertical)&&(r=i=e.vertical),null!=e.horizontal&&Number.isFinite(e.horizontal)&&(n=t=e.horizontal),null!=e.left&&Number.isFinite(e.left)&&(t=e.left),null!=e.top&&Number.isFinite(e.top)&&(r=e.top),null!=e.right&&Number.isFinite(e.right)&&(n=e.right),null!=e.bottom&&Number.isFinite(e.bottom)&&(i=e.bottom),{top:r,right:n,bottom:i,left:t}}let t=0;return null!=e&&Number.isFinite(e)&&(t=e),{top:t,right:t,bottom:t,left:t}}let _IS_MAC=!1,_IS_IOS=!1,_IS_WINDOWS=!1,_IS_IE=!1,_IS_IE11=!1,_IS_EDGE=!1,_IS_NETSCAPE=!1,_IS_CHROME_APP=!1,_IS_CHROME=!1,_IS_OPERA=!1,_IS_FIREFOX=!1,_IS_SAFARI=!1,_SUPPORT_TOUCH=!1,_SUPPORT_POINTER=!1,_SUPPORT_PASSIVE=!1,_NO_FOREIGNOBJECT=!1;if("object"==typeof navigator){const e=navigator.userAgent;_IS_MAC=e.indexOf("Macintosh")>=0,_IS_IOS=!!e.match(/(iPad|iPhone|iPod)/g),_IS_WINDOWS=e.indexOf("Windows")>=0,_IS_IE=e.indexOf("MSIE")>=0,_IS_IE11=!!e.match(/Trident\/7\./),_IS_EDGE=!!e.match(/Edge\//),_IS_NETSCAPE=e.indexOf("Mozilla/")>=0&&e.indexOf("MSIE")<0&&e.indexOf("Edge/")<0,_IS_CHROME=e.indexOf("Chrome/")>=0&&e.indexOf("Edge/")<0,_IS_OPERA=e.indexOf("Opera/")>=0||e.indexOf("OPR/")>=0,_IS_FIREFOX=e.indexOf("Firefox/")>=0,_IS_SAFARI=e.indexOf("AppleWebKit/")>=0&&e.indexOf("Chrome/")<0&&e.indexOf("Edge/")<0,"object"==typeof document&&(_NO_FOREIGNOBJECT=!document.createElementNS||"[object SVGForeignObjectElement]"!=`${document.createElementNS("http://www.w3.org/2000/svg","foreignObject")}`||e.indexOf("Opera/")>=0)}if("object"==typeof window&&(_IS_CHROME_APP=null!=window.chrome&&null!=window.chrome.app&&null!=window.chrome.app.runtime,_SUPPORT_POINTER=null!=window.PointerEvent&&!_IS_MAC),"object"==typeof document){_SUPPORT_TOUCH="ontouchstart"in document.documentElement;try{const e=Object.defineProperty({},"passive",{get(){_SUPPORT_PASSIVE=!0}}),t=document.createElement("div");t.addEventListener&&t.addEventListener("click",()=>{},e)}catch(err){}}var Platform,Platform2;Platform2=Platform||(Platform={}),Platform2.IS_MAC=_IS_MAC,Platform2.IS_IOS=_IS_IOS,Platform2.IS_WINDOWS=_IS_WINDOWS,Platform2.IS_IE=_IS_IE,Platform2.IS_IE11=_IS_IE11,Platform2.IS_EDGE=_IS_EDGE,Platform2.IS_NETSCAPE=_IS_NETSCAPE,Platform2.IS_CHROME_APP=_IS_CHROME_APP,Platform2.IS_CHROME=_IS_CHROME,Platform2.IS_OPERA=_IS_OPERA,Platform2.IS_FIREFOX=_IS_FIREFOX,Platform2.IS_SAFARI=_IS_SAFARI,Platform2.SUPPORT_TOUCH=_SUPPORT_TOUCH,Platform2.SUPPORT_POINTER=_SUPPORT_POINTER,Platform2.SUPPORT_PASSIVE=_SUPPORT_PASSIVE,Platform2.NO_FOREIGNOBJECT=_NO_FOREIGNOBJECT,Platform2.SUPPORT_FOREIGNOBJECT=!Platform2.NO_FOREIGNOBJECT,function(e){function t(){const e=window.module;return null!=e&&null!=e.hot&&null!=e.hot.status?e.hot.status():"unkonwn"}e.getHMRStatus=t,e.isApplyingHMR=function(){return"apply"===t()};const r={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};e.isEventSupported=function(e){const t=document.createElement(r[e]||"div"),n=`on${e}`;let i=n in t;return i||(t.setAttribute(n,"return;"),i="function"==typeof t[n]),i}}(Platform||(Platform={}));const rclass=/[\t\r\n\f]/g,rnotwhite=/\S+/g,fillSpaces=e=>` ${e} `;function getClass(e){return e&&e.getAttribute&&e.getAttribute("class")||""}function hasClass(e,t){if(null==e||null==t)return!1;const r=fillSpaces(getClass(e)),n=fillSpaces(t);return 1===e.nodeType&&r.replace(rclass," ").includes(n)}function addClass(e,t){if(null!=e&&null!=t){if("function"==typeof t)return addClass(e,t(getClass(e)));if("string"==typeof t&&1===e.nodeType){const r=t.match(rnotwhite)||[],n=fillSpaces(getClass(e)).replace(rclass," ");let i=r.reduce((e,t)=>e.indexOf(fillSpaces(t))<0?`${e}${t} `:e,n);i=i.trim(),n!==i&&e.setAttribute("class",i)}}}function removeClass(e,t){if(null!=e){if("function"==typeof t)return removeClass(e,t(getClass(e)));if((!t||"string"==typeof t)&&1===e.nodeType){const r=(t||"").match(rnotwhite)||[],n=fillSpaces(getClass(e)).replace(rclass," ");let i=r.reduce((e,t)=>{const r=fillSpaces(t);return e.indexOf(r)>-1?e.replace(r," "):e},n);i=t?i.trim():"",n!==i&&e.setAttribute("class",i)}}}function toggleClass(e,t,r){if(null!=e&&null!=t)if(null==r||"string"!=typeof t){if("function"==typeof t)return toggleClass(e,t(getClass(e),r),r);if("string"==typeof t){(t.match(rnotwhite)||[]).forEach(t=>{hasClass(e,t)?removeClass(e,t):addClass(e,t)})}}else r?addClass(e,t):removeClass(e,t)}let idCounter=0;function uniqueId(){return idCounter+=1,`v${idCounter}`}function ensureId(e){return null!=e.id&&""!==e.id||(e.id=uniqueId()),e.id}function isSVGGraphicsElement$1(e){return null!=e&&("function"==typeof e.getScreenCTM&&e instanceof SVGElement)}const ns={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml"},svgVersion="1.1";function createElement$1(e,t=document){return t.createElement(e)}function createElementNS(e,t=ns.xhtml,r=document){return r.createElementNS(t,e)}function createSvgElement(e,t=document){return createElementNS(e,ns.svg,t)}function createSvgDocument(e){if(e){const t=`<svg xmlns="${ns.svg}" xmlns:xlink="${ns.xlink}" version="${svgVersion}">${e}</svg>`,{documentElement:r}=parseXML(t,{async:!1});return r}const t=document.createElementNS(ns.svg,"svg");return t.setAttributeNS(ns.xmlns,"xmlns:xlink",ns.xlink),t.setAttribute("version",svgVersion),t}function parseXML(e,t={}){let r;try{const n=new DOMParser;if(null!=t.async){n.async=t.async}r=n.parseFromString(e,t.mimeType||"text/xml")}catch(n){r=void 0}if(!r||r.getElementsByTagName("parsererror").length)throw new Error(`Invalid XML: ${e}`);return r}function tagName(e,t=!0){const r=e.nodeName;return t?r.toLowerCase():r.toUpperCase()}function index$1(e){let t=0,r=e.previousSibling;for(;r;)1===r.nodeType&&(t+=1),r=r.previousSibling;return t}function find$2(e,t){return e.querySelectorAll(t)}function findOne(e,t){return e.querySelector(t)}function findParentByClass(e,t,r){const n=e.ownerSVGElement;let i=e.parentNode;for(;i&&i!==r&&i!==n;){if(hasClass(i,t))return i;i=i.parentNode}return null}function contains(e,t){const r=t&&t.parentNode;return e===r||!!(r&&1===r.nodeType&&16&e.compareDocumentPosition(r))}function remove(e){if(e){(Array.isArray(e)?e:[e]).forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)})}}function empty$2(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function append(e,t){(Array.isArray(t)?t:[t]).forEach(t=>{null!=t&&e.appendChild(t)})}function prepend(e,t){const r=e.firstChild;return r?before(r,t):append(e,t)}function before(e,t){const r=e.parentNode;if(r){(Array.isArray(t)?t:[t]).forEach(t=>{null!=t&&r.insertBefore(t,e)})}}function appendTo(e,t){null!=t&&t.appendChild(e)}function isHTMLElement(e){try{return e instanceof HTMLElement}catch(e10){return"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument}}function children(e,t){const r=[];let n=e.firstChild;for(;n;n=n.nextSibling)1===n.nodeType&&(t&&!hasClass(n,t)||r.push(n));return r}const CASE_SENSITIVE_ATTR=["viewBox","attributeName","attributeType","repeatCount","textLength","lengthAdjust","gradientUnits"];function getAttribute(e,t){return e.getAttribute(t)}function removeAttribute(e,t){const r=qualifyAttr(t);r.ns?e.hasAttributeNS(r.ns,r.local)&&e.removeAttributeNS(r.ns,r.local):e.hasAttribute(t)&&e.removeAttribute(t)}function setAttribute(e,t,r){if(null==r)return removeAttribute(e,t);const n=qualifyAttr(t);n.ns&&"string"==typeof r?e.setAttributeNS(n.ns,t,r):"id"===t?e.id=`${r}`:e.setAttribute(t,`${r}`)}function setAttributes(e,t){Object.keys(t).forEach(r=>{setAttribute(e,r,t[r])})}function attr(e,t,r){if(null==t){const t=e.attributes,r={};for(let e=0;e<t.length;e+=1)r[t[e].name]=t[e].value;return r}if("string"==typeof t&&void 0===r)return e.getAttribute(t);"object"==typeof t?setAttributes(e,t):setAttribute(e,t,r)}function qualifyAttr(e){if(-1!==e.indexOf(":")){const t=e.split(":");return{ns:ns[t[0]],local:t[1]}}return{ns:null,local:e}}function kebablizeAttrs(e){const t={};return Object.keys(e).forEach(r=>{const n=CASE_SENSITIVE_ATTR.includes(r)?r:kebabCase(r);t[n]=e[r]}),t}function styleToObject(e){const t={};return e.split(";").forEach(e=>{const r=e.trim();if(r){const e=r.split("=");e.length&&(t[e[0].trim()]=e[1]?e[1].trim():"")}}),t}function mergeAttrs(e,t){return Object.keys(t).forEach(r=>{if("class"===r)e[r]=e[r]?`${e[r]} ${t[r]}`:t[r];else if("style"===r){const n="object"==typeof e[r],i="object"==typeof t[r];let o,a;n&&i?(o=e[r],a=t[r]):n?(o=e[r],a=styleToObject(t[r])):i?(o=styleToObject(e[r]),a=t[r]):(o=styleToObject(e[r]),a=styleToObject(t[r])),e[r]=mergeAttrs(o,a)}else e[r]=t[r]}),e}function annotate(e,t,r={}){const n=r.offset||0,i=[],o=[];let a,s,l=null;for(let c=0;c<e.length;c+=1){a=o[c]=e[c];for(let i=0,s=t.length;i<s;i+=1){const s=t[i],l=s.start+n,u=s.end+n;c>=l&&c<u&&("string"==typeof a?a=o[c]={t:e[c],attrs:s.attrs}:a.attrs=mergeAttrs(mergeAttrs({},a.attrs),s.attrs),r.includeAnnotationIndices&&(null==a.annotations&&(a.annotations=[]),a.annotations.push(i)))}s=o[c-1],s?isObject(a)&&isObject(s)?JSON.stringify(a.attrs)===JSON.stringify(s.attrs)?l.t+=a.t:(i.push(l),l=a):isObject(a)||isObject(s)?(i.push(l),l=a):l=(l||"")+a:l=a}return null!=l&&i.push(l),i}function sanitize(e){return e.replace(/ /g," ")}var DataUri;let millimeterSize;!function(e){function t(e){const t="data:";return e.substr(0,5)===t}function r(e){let t=e.replace(/\s/g,"");t=decodeURIComponent(t);const r=t.indexOf(","),n=t.slice(0,r),i=n.split(":")[1].split(";")[0],o=t.slice(r+1);let a;a=n.indexOf("base64")>=0?atob(o):unescape(encodeURIComponent(o));const s=new Uint8Array(a.length);for(let l=0;l<a.length;l+=1)s[l]=a.charCodeAt(l);return new Blob([s],{type:i})}function n(e,t){const r=window.navigator.msSaveBlob;if(r)r(e,t);else{const r=window.URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(r)}}function i(e){const t=parseFloat(e);return Number.isNaN(t)?null:t}e.isDataUrl=t,e.imageToDataUri=function(e,r){if(!e||t(e))return void setTimeout(()=>r(null,e));const n=()=>{r(new Error(`Failed to load image: ${e}`))},i=window.FileReader?e=>{if(200===e.status){const t=new FileReader;t.onload=e=>{const t=e.target.result;r(null,t)},t.onerror=n,t.readAsDataURL(e.response)}else n()}:t=>{if(200===t.status){let n=e.split(".").pop()||"png";"svg"===n&&(n="svg+xml");const i=`data:image/${n};base64,`,o=new Uint8Array(t.response),a=i+btoa((e=>{const t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode.apply(null,e.subarray(r,r+32768)));return t.join("")})(o));r(null,a)}else n()},o=new XMLHttpRequest;o.responseType=window.FileReader?"blob":"arraybuffer",o.open("GET",e,!0),o.addEventListener("error",n),o.addEventListener("load",()=>i(o)),o.send()},e.dataUriToBlob=r,e.downloadBlob=n,e.downloadDataUri=function(e,t){n(r(e),t)},e.svgToDataUrl=function(e,t={}){let r=null;const n=t=>(null==r&&(r=function(e){const t=e.match(/<svg[^>]*viewBox\s*=\s*(["']?)(.+?)\1[^>]*>/i);return t&&t[2]?t[2].replace(/\s+/," ").split(" "):null}(e)),null!=r?i(r[t]):null),o=t=>{const r=e.match(t);return r&&r[2]?i(r[2]):null};let a=t.width;if(null==a&&(a=o(/<svg[^>]*width\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==a&&(a=n(2)),null==a)throw new Error("Can not parse width from svg string");let s=t.height;if(null==s&&(s=o(/<svg[^>]*height\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==s&&(s=n(3)),null==s)throw new Error("Can not parse height from svg string");return`data:image/svg+xml,${encodeURIComponent(e).replace(/'/g,"%27").replace(/"/g,"%22")}`}}(DataUri||(DataUri={}));const supportedUnits={px:e=>e,mm:e=>millimeterSize*e,cm:e=>millimeterSize*e*10,in:e=>millimeterSize*e*25.4,pt:e=>millimeterSize*(25.4*e/72),pc:e=>millimeterSize*(25.4*e/6)};var Unit;!function(e){function t(e,t,r){const n=document.createElement("div"),i=n.style;i.display="inline-block",i.position="absolute",i.left="-15000px",i.top="-15000px",i.width=e+(r||"px"),i.height=t+(r||"px"),document.body.appendChild(n);const o=n.getBoundingClientRect(),a={width:o.width||0,height:o.height||0};return document.body.removeChild(n),a}e.measure=t,e.toPx=function(e,r){null==millimeterSize&&(millimeterSize=t("1","1","mm").width);const n=r?supportedUnits[r]:null;return n?n(e):e}}(Unit||(Unit={}));const hyphenPattern=/-(.)/g;function camelize(e){return e.replace(hyphenPattern,(e,t)=>t.toUpperCase())}const memoized={},prefixes=["webkit","ms","moz","o"],testStyle="undefined"!=typeof document?document.createElement("div").style:{};function getWithPrefix(e){for(let t=0;t<prefixes.length;t+=1){const r=prefixes[t]+e;if(r in testStyle)return r}return null}function getVendorPrefixedName(e){const t=camelize(e);if(null==memoized[t]){const e=t.charAt(0).toUpperCase()+t.slice(1);memoized[t]=t in testStyle?t:getWithPrefix(e)}return memoized[t]}function getComputedStyle$1(e,t){const r=e.ownerDocument&&e.ownerDocument.defaultView&&e.ownerDocument.defaultView.opener?e.ownerDocument.defaultView.getComputedStyle(e,null):window.getComputedStyle(e,null);return r&&t?r.getPropertyValue(t)||r[t]:r}const numericProps={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function isCSSVariable(e){return/^--/.test(e)}function computeStyle(e,t,r){const n=window.getComputedStyle(e,null);return r?n.getPropertyValue(t)||void 0:n[t]||e.style[t]}function getSuffixedValue(e,t){return numericProps[e]||"number"!=typeof t?t:`${t}px`}function css$3(e,t,r){if("string"==typeof t){const n=isCSSVariable(t);if(n||(t=getVendorPrefixedName(t)),void 0===r)return computeStyle(e,t,n);n||(r=getSuffixedValue(t,r));const i=e.style;return void(n?i.setProperty(t,r):i[t]=r)}for(const n in t)css$3(e,n,t[n])}const dataset=new WeakMap;function getData(e,t){const r=camelCase(t),n=dataset.get(e);if(n)return n[r]}function setData(e,t,r){const n=camelCase(t),i=dataset.get(e);i?i[n]=r:dataset.set(e,{[n]:r})}function data$2(e,t,r){if(!t){const t={};return Object.keys(dataset).forEach(r=>{t[r]=getData(e,r)}),t}if("string"==typeof t)return void 0===r?getData(e,t):void setData(e,t,r);for(const n in t)data$2(e,n,t[n])}class Vector{get[Symbol.toStringTag](){return Vector.toStringTag}get type(){return this.node.nodeName}get id(){return this.node.id}set id(e){this.node.id=e}constructor(e,t,r){if(!e)throw new TypeError("Invalid element to create vector");let n;if(Vector.isVector(e))n=e.node;else if("string"==typeof e)if("svg"===e.toLowerCase())n=createSvgDocument();else if("<"===e[0]){const t=createSvgDocument(e);n=document.importNode(t.firstChild,!0)}else n=document.createElementNS(ns.svg,e);else n=e;this.node=n,t&&this.setAttributes(t),r&&this.append(r)}transform(e,t){return null==e?transform(this.node):(transform(this.node,e,t),this)}translate(e,t=0,r={}){return null==e?translate(this.node):(translate(this.node,e,t,r),this)}rotate(e,t,r,n={}){return null==e?rotate$1(this.node):(rotate$1(this.node,e,t,r,n),this)}scale(e,t){return null==e?scale(this.node):(scale(this.node,e,t),this)}getTransformToElement(e){const t=Vector.toNode(e);return getTransformToElement(this.node,t)}removeAttribute(e){return removeAttribute(this.node,e),this}getAttribute(e){return getAttribute(this.node,e)}setAttribute(e,t){return setAttribute(this.node,e,t),this}setAttributes(e){return setAttributes(this.node,e),this}attr(e,t){return null==e?attr(this.node):"string"==typeof e&&void 0===t?attr(this.node,e):("object"==typeof e?attr(this.node,e):attr(this.node,e,t),this)}svg(){return this.node instanceof SVGSVGElement?this:Vector.create(this.node.ownerSVGElement)}defs(){const e=this.svg()||this,t=e.node.getElementsByTagName("defs")[0];return t?Vector.create(t):Vector.create("defs").appendTo(e)}text(e,t={}){return text$1(this.node,e,t),this}tagName(){return tagName(this.node)}clone(){return Vector.create(this.node.cloneNode(!0))}remove(){return remove(this.node),this}empty(){return empty$2(this.node),this}append(e){return append(this.node,Vector.toNodes(e)),this}appendTo(e){return appendTo(this.node,Vector.isVector(e)?e.node:e),this}prepend(e){return prepend(this.node,Vector.toNodes(e)),this}before(e){return before(this.node,Vector.toNodes(e)),this}replace(e){return this.node.parentNode&&this.node.parentNode.replaceChild(Vector.toNode(e),this.node),Vector.create(e)}first(){return this.node.firstChild?Vector.create(this.node.firstChild):null}last(){return this.node.lastChild?Vector.create(this.node.lastChild):null}get(e){const t=this.node.childNodes[e];return t?Vector.create(t):null}indexOf(e){return Array.prototype.slice.call(this.node.childNodes).indexOf(Vector.toNode(e))}find(e){const t=[],r=find$2(this.node,e);if(r)for(let n=0,i=r.length;n<i;n+=1)t.push(Vector.create(r[n]));return t}findOne(e){const t=findOne(this.node,e);return t?Vector.create(t):null}findParentByClass(e,t){const r=findParentByClass(this.node,e,t);return r?Vector.create(r):null}matches(e){const t=this.node;this.node.matches;const r=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector||null;return r&&r.call(t,e)}contains(e){return contains(this.node,Vector.isVector(e)?e.node:e)}wrap(e){const t=Vector.create(e),r=this.node.parentNode;return null!=r&&r.insertBefore(t.node,this.node),t.append(this)}parent(e){let t=this;if(null==t.node.parentNode)return null;if(t=Vector.create(t.node.parentNode),null==e)return t;do{if("string"==typeof e?t.matches(e):t instanceof e)return t}while(t=Vector.create(t.node.parentNode));return t}children(){const e=this.node.childNodes,t=[];for(let r=0;r<e.length;r+=1){1===e[r].nodeType&&t.push(Vector.create(e[r]))}return t}eachChild(e,t){const r=this.children();for(let n=0,i=r.length;n<i;n+=1)e.call(r[n],r[n],n,r),t&&r[n].eachChild(e,t);return this}index(){return index$1(this.node)}hasClass(e){return hasClass(this.node,e)}addClass(e){return addClass(this.node,e),this}removeClass(e){return removeClass(this.node,e),this}toggleClass(e,t){return toggleClass(this.node,e,t),this}toLocalPoint(e,t){return toLocalPoint(this.node,e,t)}sample(e=1){return this.node instanceof SVGPathElement?sample(this.node,e):[]}toPath(){return Vector.create(toPath(this.node))}toPathData(){return toPathData(this.node)}}function createTextPathNode(e,t){const r=Vector.create(t),n=Vector.create("textPath"),i=e.d;if(i&&void 0===e["xlink:href"]){const e=Vector.create("path").attr("d",i).appendTo(r.defs());n.attr("xlink:href",`#${e.id}`)}return"object"==typeof e&&n.attr(e),n.node}function annotateTextLine(e,t,r){const n=r.eol,i=r.baseSize,o=r.lineHeight;let a,s=0;const l={},c=t.length-1;for(let u=0;u<=c;u+=1){let o=t[u],l=null;if("object"==typeof o){const e=o.attrs,t=Vector.create("tspan",e);a=t.node;let d=o.t;n&&u===c&&(d+=n),a.textContent=d;const p=e.class;p&&t.addClass(p),r.includeAnnotationIndices&&t.attr("annotations",o.annotations.join(",")),l=parseFloat(e["font-size"]),void 0===l&&(l=i),l&&l>s&&(s=l)}else n&&u===c&&(o+=n),a=document.createTextNode(o||" "),i&&i>s&&(s=i);e.appendChild(a)}return s&&(l.maxFontSize=s),o?l.lineHeight=o:s&&(l.lineHeight=1.2*s),l}!function(e){function t(t){if(null==t)return!1;if(t instanceof e)return!0;const r=t[Symbol.toStringTag],n=t;return(null==r||r===e.toStringTag)&&n.node instanceof SVGElement&&"function"==typeof n.sample&&"function"==typeof n.toPath}function r(t,r,n){return new e(t,r,n)}function n(e){return t(e)?e.node:e}e.toStringTag=`X6.${e.name}`,e.isVector=t,e.create=r,e.createVectors=function(e){if("<"===e[0]){const t=createSvgDocument(e),n=[];for(let e=0,i=t.childNodes.length;e<i;e+=1){const i=t.childNodes[e];n.push(r(document.importNode(i,!0)))}return n}return[r(e)]},e.toNode=n,e.toNodes=function(e){return Array.isArray(e)?e.map(e=>n(e)):[n(e)]}}(Vector||(Vector={}));const emRegex=/em$/;function emToPx(e,t){const r=parseFloat(e);return emRegex.test(e)?r*t:r}function calculateDY(e,t,r,n){if(!Array.isArray(t))return 0;const i=t.length;if(!i)return 0;let o=t[0];const a=emToPx(o.maxFontSize,r)||r;let s=0;const l=emToPx(n,r);for(let d=1;d<i;d+=1){o=t[d];s+=emToPx(o.lineHeight,r)||l}const c=emToPx(o.maxFontSize,r)||r;let u;switch(e){case"middle":u=a/2-.15*c-s/2;break;case"bottom":u=-.25*c-s;break;default:u=.8*a}return u}function text$1(e,t,r={}){t=sanitize(t);const n=r.eol;let i=r.textPath;const o=r.textVerticalAnchor,a="middle"===o||"bottom"===o||"top"===o;let s=r.x;void 0===s&&(s=e.getAttribute("x")||0);const l=r.includeAnnotationIndices;let c=r.annotations;c&&!Array.isArray(c)&&(c=[c]);const u=r.lineHeight,d="auto"===u,p=d?"1.5em":u||"1em";let h=!0;const f=e.childNodes;if(1===f.length){const e=f[0];e&&"TITLE"===e.tagName.toUpperCase()&&(h=!1)}h&&empty$2(e),attr(e,{"xml:space":"preserve",display:t||r.displayEmpty?null:"none"});const g=attr(e,"font-size");let m,v,y=parseFloat(g);y||(y=16,!a&&!c||g||attr(e,"font-size",`${y}`)),i?("string"==typeof i&&(i={d:i}),m=createTextPathNode(i,e)):m=document.createDocumentFragment();let b,q=0;const V=t.split("\n"),S=[],E=V.length-1;for(let x=0;x<=E;x+=1){v=p;let e="v-line";const t=createSvgElement("tspan");let r,o=V[x];if(o)if(c){r=annotateTextLine(t,annotate(o,c,{offset:-q,includeAnnotationIndices:l}),{eol:x!==E&&n,baseSize:y,lineHeight:d?null:p,includeAnnotationIndices:l});const e=r.lineHeight;e&&d&&0!==x&&(v=e),0===x&&(b=.8*r.maxFontSize)}else n&&x!==E&&(o+=n),t.textContent=o;else{t.textContent="-",e+=" v-empty-line";const n=t.style;n.fillOpacity=0,n.strokeOpacity=0,c&&(r={})}r&&S.push(r),x>0&&t.setAttribute("dy",v),(x>0||i)&&t.setAttribute("x",s),t.className.baseVal=e,m.appendChild(t),q+=o.length+1}if(a)if(c)v=calculateDY(o,S,y,p);else if("top"===o)v="0.8em";else{let e;switch(E>0?(e=parseFloat(p)||1,e*=E,emRegex.test(p)||(e/=y)):e=0,o){case"middle":v=.3-e/2+"em";break;case"bottom":v=-e-.3+"em"}}else 0===o?v="0em":o?v=o:(v=0,null==e.getAttribute("y")&&e.setAttribute("y",`${b||"0.8em"}`));m.firstChild.setAttribute("dy",v),e.appendChild(m)}function measureText(e,t={}){const r=document.createElement("canvas").getContext("2d");if(!e)return{width:0};const n=[],i=t["font-size"]?`${parseFloat(t["font-size"])}px`:"14px";return n.push(t["font-style"]||"normal"),n.push(t["font-variant"]||"normal"),n.push(t["font-weight"]||400),n.push(i),n.push(t["font-family"]||"sans-serif"),r.font=n.join(" "),r.measureText(e)}function splitTextByLength(e,t,r,n={}){if(t>=r)return[e,""];const i=e.length,o={};let a=Math.round(t/r*i-1);for(a<0&&(a=0);a>=0&&a<i;){const r=e.slice(0,a),i=o[r]||measureText(r,n).width,s=e.slice(0,a+1),l=o[s]||measureText(s,n).width;if(o[r]=i,o[s]=l,i>t)a-=1;else{if(!(l<=t))break;a+=1}}return[e.slice(0,a),e.slice(a)]}function breakText(e,t,r={},n={}){const i=t.width,o=t.height,a=n.eol||"\n",s=r.fontSize||14,l=r.lineHeight?parseFloat(r.lineHeight):Math.ceil(1.4*s),c=Math.floor(o/l);if(e.indexOf(a)>-1){const i=uuid(),o=[];return e.split(a).map(e=>{const a=breakText(e,Object.assign(Object.assign({},t),{height:Number.MAX_SAFE_INTEGER}),r,Object.assign(Object.assign({},n),{eol:i}));a&&o.push(...a.split(i))}),o.slice(0,c).join(a)}const{width:u}=measureText(e,r);if(u<i)return e;const d=[];let p=e,h=u,f=n.ellipsis,g=0;f&&("string"!=typeof f&&(f="…"),g=measureText(f,r).width);for(let m=0;m<c;m+=1){if(!(h>i)){d.push(p);break}if(m===c-1){const[e]=splitTextByLength(p,i-g,h,r);d.push(f?`${e}${f}`:e)}else{const[e,t]=splitTextByLength(p,i,h,r);d.push(e),p=t,h=measureText(p,r).width}}return d.join(a)}const KAPPA=.551784;function getNumbericAttribute(e,t,r=NaN){const n=e.getAttribute(t);if(null==n)return r;const i=parseFloat(n);return Number.isNaN(i)?r:i}function sample(e,t=1){const r=e.getTotalLength(),n=[];let i,o=0;for(;o<r;)i=e.getPointAtLength(o),n.push({distance:o,x:i.x,y:i.y}),o+=t;return n}function lineToPathData(e){return["M",getNumbericAttribute(e,"x1"),getNumbericAttribute(e,"y1"),"L",getNumbericAttribute(e,"x2"),getNumbericAttribute(e,"y2")].join(" ")}function polygonToPathData(e){const t=getPointsFromSvgElement(e);return 0===t.length?null:`${svgPointsToPath(t)} Z`}function polylineToPathData(e){const t=getPointsFromSvgElement(e);return 0===t.length?null:svgPointsToPath(t)}function svgPointsToPath(e){return`M ${e.map(e=>`${e.x} ${e.y}`).join(" L")}`}function getPointsFromSvgElement(e){const t=[],r=e.points;if(r)for(let n=0,i=r.numberOfItems;n<i;n+=1)t.push(r.getItem(n));return t}function circleToPathData(e){const t=getNumbericAttribute(e,"cx",0),r=getNumbericAttribute(e,"cy",0),n=getNumbericAttribute(e,"r"),i=n*KAPPA;return["M",t,r-n,"C",t+i,r-n,t+n,r-i,t+n,r,"C",t+n,r+i,t+i,r+n,t,r+n,"C",t-i,r+n,t-n,r+i,t-n,r,"C",t-n,r-i,t-i,r-n,t,r-n,"Z"].join(" ")}function ellipseToPathData(e){const t=getNumbericAttribute(e,"cx",0),r=getNumbericAttribute(e,"cy",0),n=getNumbericAttribute(e,"rx"),i=getNumbericAttribute(e,"ry")||n,o=n*KAPPA,a=i*KAPPA;return["M",t,r-i,"C",t+o,r-i,t+n,r-a,t+n,r,"C",t+n,r+a,t+o,r+i,t,r+i,"C",t-o,r+i,t-n,r+a,t-n,r,"C",t-n,r-a,t-o,r-i,t,r-i,"Z"].join(" ")}function rectangleToPathData(e){return rectToPathData({x:getNumbericAttribute(e,"x",0),y:getNumbericAttribute(e,"y",0),width:getNumbericAttribute(e,"width",0),height:getNumbericAttribute(e,"height",0),rx:getNumbericAttribute(e,"rx",0),ry:getNumbericAttribute(e,"ry",0)})}function rectToPathData(e){let t;const r=e.x,n=e.y,i=e.width,o=e.height,a=Math.min(e.rx||e["top-rx"]||0,i/2),s=Math.min(e.rx||e["bottom-rx"]||0,i/2),l=Math.min(e.ry||e["top-ry"]||0,o/2),c=Math.min(e.ry||e["bottom-ry"]||0,o/2);return t=a||s||l||c?["M",r,n+l,"v",o-l-c,"a",s,c,0,0,0,s,c,"h",i-2*s,"a",s,c,0,0,0,s,-c,"v",-(o-c-l),"a",a,l,0,0,0,-a,-l,"h",-(i-2*a),"a",a,l,0,0,0,-a,l,"Z"]:["M",r,n,"H",r+i,"V",n+o,"H",r,"V",n,"Z"],t.join(" ")}function toPath(e){const t=createSvgElement("path");attr(t,attr(e));const r=toPathData(e);return r&&t.setAttribute("d",r),t}function toPathData(e){const t=e.tagName.toLowerCase();switch(t){case"path":return e.getAttribute("d");case"line":return lineToPathData(e);case"polygon":return polygonToPathData(e);case"polyline":return polylineToPathData(e);case"ellipse":return ellipseToPathData(e);case"circle":return circleToPathData(e);case"rect":return rectangleToPathData(e)}throw new Error(`"${t}" cannot be converted to svg path element.`)}const transformRegex=/(\w+)\(([^,)]+),?([^)]+)?\)/gi,transformSeparatorRegex=/[ ,]+/,transformationListRegex=/^(\w+)\((.*)\)/;function createSVGPoint(e,t){const r=createSvgElement("svg").createSVGPoint();return r.x=e,r.y=t,r}function createSVGMatrix(e){const t=createSvgElement("svg").createSVGMatrix();if(null!=e){const r=e,n=t;for(const e in r)n[e]=r[e]}return t}function createSVGTransform(e){const t=createSvgElement("svg");return null!=e?(e instanceof DOMMatrix||(e=createSVGMatrix(e)),t.createSVGTransformFromMatrix(e)):t.createSVGTransform()}function transformStringToMatrix(e){let t=createSVGMatrix();const r=null!=e&&e.match(transformRegex);if(!r)return t;for(let n=0,i=r.length;n<i;n+=1){const e=r[n].match(transformationListRegex);if(e){let r,n,i,o,a,s=createSVGMatrix();const l=e[2].split(transformSeparatorRegex);switch(e[1].toLowerCase()){case"scale":r=parseFloat(l[0]),n=void 0===l[1]?r:parseFloat(l[1]),s=s.scaleNonUniform(r,n);break;case"translate":i=parseFloat(l[0]),o=parseFloat(l[1]),s=s.translate(i,o);break;case"rotate":a=parseFloat(l[0]),i=parseFloat(l[1])||0,o=parseFloat(l[2])||0,s=0!==i||0!==o?s.translate(i,o).rotate(a).translate(-i,-o):s.rotate(a);break;case"skewx":a=parseFloat(l[0]),s=s.skewX(a);break;case"skewy":a=parseFloat(l[0]),s=s.skewY(a);break;case"matrix":s.a=parseFloat(l[0]),s.b=parseFloat(l[1]),s.c=parseFloat(l[2]),s.d=parseFloat(l[3]),s.e=parseFloat(l[4]),s.f=parseFloat(l[5]);break;default:continue}t=t.multiply(s)}}return t}function matrixToTransformString(e){const t=e||{};return`matrix(${null!=t.a?t.a:1},${null!=t.b?t.b:0},${null!=t.c?t.c:0},${null!=t.d?t.d:1},${null!=t.e?t.e:0},${null!=t.f?t.f:0})`}function parseTransformString(e){let t,r,n;if(e){const i=transformSeparatorRegex;if(e.trim().indexOf("matrix")>=0){const i=decomposeMatrix(transformStringToMatrix(e));t=[i.translateX,i.translateY],r=[i.rotation],n=[i.scaleX,i.scaleY];const o=[];0===t[0]&&0===t[1]||o.push(`translate(${t.join(",")})`),1===n[0]&&1===n[1]||o.push(`scale(${n.join(",")})`),0!==r[0]&&o.push(`rotate(${r[0]})`),e=o.join(" ")}else{const o=e.match(/translate\((.*?)\)/);o&&(t=o[1].split(i));const a=e.match(/rotate\((.*?)\)/);a&&(r=a[1].split(i));const s=e.match(/scale\((.*?)\)/);s&&(n=s[1].split(i))}}const i=n&&n[0]?parseFloat(n[0]):1;return{raw:e||"",translation:{tx:t&&t[0]?parseInt(t[0],10):0,ty:t&&t[1]?parseInt(t[1],10):0},rotation:{angle:r&&r[0]?parseInt(r[0],10):0,cx:r&&r[1]?parseInt(r[1],10):void 0,cy:r&&r[2]?parseInt(r[2],10):void 0},scale:{sx:i,sy:n&&n[1]?parseFloat(n[1]):i}}}function deltaTransformPoint(e,t){return{x:t.x*e.a+t.y*e.c+0,y:t.x*e.b+t.y*e.d+0}}function decomposeMatrix(e){const t=deltaTransformPoint(e,{x:0,y:1}),r=deltaTransformPoint(e,{x:1,y:0}),n=180/Math.PI*Math.atan2(t.y,t.x)-90;return{skewX:n,skewY:180/Math.PI*Math.atan2(r.y,r.x),translateX:e.e,translateY:e.f,scaleX:Math.sqrt(e.a*e.a+e.b*e.b),scaleY:Math.sqrt(e.c*e.c+e.d*e.d),rotation:n}}function matrixToScale(e){let t,r,n,i;return e?(t=null==e.a?1:e.a,i=null==e.d?1:e.d,r=e.b,n=e.c):t=i=1,{sx:r?Math.sqrt(t*t+r*r):t,sy:n?Math.sqrt(n*n+i*i):i}}function matrixToRotation(e){let t={x:0,y:1};e&&(t=deltaTransformPoint(e,t));const r=180*Math.atan2(t.y,t.x)/Math.PI%360-90;return{angle:r%360+(r<0?360:0)}}function matrixToTranslation(e){return{tx:e&&e.e||0,ty:e&&e.f||0}}function transform(e,t,r={}){if(null==t)return transformStringToMatrix(attr(e,"transform"));if(r.absolute)return void e.setAttribute("transform",matrixToTransformString(t));const n=e.transform,i=createSVGTransform(t);n.baseVal.appendItem(i)}function translate(e,t,r=0,n={}){let i=attr(e,"transform");const o=parseTransformString(i);if(null==t)return o.translation;i=o.raw,i=i.replace(/translate\([^)]*\)/g,"").trim();const a=`translate(${n.absolute?t:o.translation.tx+t},${n.absolute?r:o.translation.ty+r})`;e.setAttribute("transform",`${a} ${i}`.trim())}function rotate$1(e,t,r,n,i={}){let o=attr(e,"transform");const a=parseTransformString(o);if(null==t)return a.rotation;o=a.raw,o=o.replace(/rotate\([^)]*\)/g,"").trim(),t%=360;const s=`rotate(${i.absolute?t:a.rotation.angle+t}${null!=r&&null!=n?`,${r},${n}`:""})`;e.setAttribute("transform",`${o} ${s}`.trim())}function scale(e,t,r){let n=attr(e,"transform");const i=parseTransformString(n);if(null==t)return i.scale;r=null==r?t:r,n=i.raw,n=n.replace(/scale\([^)]*\)/g,"").trim();const o=`scale(${t},${r})`;e.setAttribute("transform",`${n} ${o}`.trim())}function getTransformToElement(e,t){if(isSVGGraphicsElement$1(t)&&isSVGGraphicsElement$1(e)){const r=t.getScreenCTM(),n=e.getScreenCTM();if(r&&n)return r.inverse().multiply(n)}return createSVGMatrix()}function getTransformToParentElement(e,t){let r=createSVGMatrix();if(isSVGGraphicsElement$1(t)&&isSVGGraphicsElement$1(e)){let n=e;const i=[];for(;n&&n!==t;){const e=transformStringToMatrix(n.getAttribute("transform")||null);i.push(e),n=n.parentNode}i.reverse().forEach(e=>{r=r.multiply(e)})}return r}function toLocalPoint(e,t,r){const n=e instanceof SVGSVGElement?e:e.ownerSVGElement,i=n.createSVGPoint();i.x=t,i.y=r;try{const t=n.getScreenCTM(),r=i.matrixTransform(t.inverse()),o=getTransformToElement(e,n).inverse();return r.matrixTransform(o)}catch(e10){return i}}var EventHook,Store$1,Util$2,Util2,EventObject2;!function(e){const t={};e.get=function(e){return t[e]||{}},e.register=function(e,r){t[e]=r},e.unregister=function(e){delete t[e]}}(EventHook||(EventHook={})),function(e){const t=new WeakMap;e.ensure=function(e){return t.has(e)||t.set(e,{events:Object.create(null)}),t.get(e)},e.get=function(e){return t.get(e)},e.remove=function(e){return t.delete(e)}}(Store$1||(Store$1={})),Util2=Util$2||(Util$2={}),Util2.returnTrue=()=>!0,Util2.returnFalse=()=>!1,Util2.stopPropagationCallback=function(e){e.stopPropagation()},Util2.addEventListener=function(e,t,r){null!=e.addEventListener&&e.addEventListener(t,r)},Util2.removeEventListener=function(e,t,r){null!=e.removeEventListener&&e.removeEventListener(t,r)},function(e){const t=/[^\x20\t\r\n\f]+/g,r=/^([^.]*)(?:\.(.+)|)/;e.splitType=function(e){return(e||"").match(t)||[""]},e.normalizeType=function(e){const t=r.exec(e)||[];return{originType:t[1]?t[1].trim():t[1],namespaces:t[2]?t[2].split(".").map(e=>e.trim()).sort():[]}},e.isValidTarget=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType},e.isValidSelector=function(e,t){if(t){const r=e;return null!=r.querySelector&&null!=r.querySelector(t)}return!0}}(Util$2||(Util$2={})),function(e){let t=0;const r=new WeakMap;e.ensureHandlerId=function(e){return r.has(e)||(r.set(e,t),t+=1),r.get(e)},e.getHandlerId=function(e){return r.get(e)},e.removeHandlerId=function(e){return r.delete(e)},e.setHandlerId=function(e,t){return r.set(e,t)}}(Util$2||(Util$2={})),function(e){e.getHandlerQueue=function(e,t){const r=[],n=Store$1.get(e),i=n&&n.events&&n.events[t.type],o=i&&i.handlers||[],a=i?i.delegateCount:0;if(a>0&&!("click"===t.type&&"number"==typeof t.button&&t.button>=1))for(let s=t.target;s!==e;s=s.parentNode||e)if(1===s.nodeType&&("click"!==t.type||!0!==s.disabled)){const t=[],n={};for(let r=0;r<a;r+=1){const i=o[r],a=i.selector;if(null!=a&&null==n[a]){const t=[];e.querySelectorAll(a).forEach(e=>{t.push(e)}),n[a]=t.includes(s)}n[a]&&t.push(i)}t.length&&r.push({elem:s,handlers:t})}return a<o.length&&r.push({elem:e,handlers:o.slice(a)}),r}}(Util$2||(Util$2={})),function(e){e.isWindow=function(e){return null!=e&&e===e.window}}(Util$2||(Util$2={})),function(e){e.contains=function(e,t){const r=9===e.nodeType?e.documentElement:e,n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(r.contains?r.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))}}(Util$2||(Util$2={}));class EventObject{constructor(e,t){this.isDefaultPrevented=Util$2.returnFalse,this.isPropagationStopped=Util$2.returnFalse,this.isImmediatePropagationStopped=Util$2.returnFalse,this.isSimulated=!1,this.preventDefault=()=>{const e=this.originalEvent;this.isDefaultPrevented=Util$2.returnTrue,e&&!this.isSimulated&&e.preventDefault()},this.stopPropagation=()=>{const e=this.originalEvent;this.isPropagationStopped=Util$2.returnTrue,e&&!this.isSimulated&&e.stopPropagation()},this.stopImmediatePropagation=()=>{const e=this.originalEvent;this.isImmediatePropagationStopped=Util$2.returnTrue,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()},"string"==typeof e?this.type=e:e.type&&(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Util$2.returnTrue:Util$2.returnFalse,this.target=e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget,this.timeStamp=e.timeStamp),t&&Object.assign(this,t),this.timeStamp||(this.timeStamp=Date.now())}}EventObject2=EventObject||(EventObject={}),EventObject2.create=function(e){return e instanceof EventObject2?e:new EventObject2(e)},function(e){e.addProperty=function(t,r){Object.defineProperty(e.prototype,t,{enumerable:!0,configurable:!0,get:"function"==typeof r?function(){if(this.originalEvent)return r(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})}}(EventObject||(EventObject={})),function(e){const t={bubbles:!0,cancelable:!0,eventPhase:!0,detail:!0,view:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pageX:!0,pageY:!0,screenX:!0,screenY:!0,toElement:!0,pointerId:!0,pointerType:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,touches:!0,changedTouches:!0,targetTouches:!0,which:!0,altKey:!0,ctrlKey:!0,metaKey:!0,shiftKey:!0};Object.keys(t).forEach(r=>e.addProperty(r,t[r]))}(EventObject||(EventObject={})),EventHook.register("load",{noBubble:!0}),EventHook.register("beforeunload",{postDispatch(e,t){void 0!==t.result&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}),EventHook.register("mouseenter",{delegateType:"mouseover",bindType:"mouseover",handle(e,t){let r;const n=t.relatedTarget,i=t.handleObj;return n&&(n===e||Util$2.contains(e,n))||(t.type=i.originType,r=i.handler.call(e,t),t.type="mouseover"),r}}),EventHook.register("mouseleave",{delegateType:"mouseout",bindType:"mouseout",handle(e,t){let r;const n=t.relatedTarget,i=t.handleObj;return n&&(n===e||Util$2.contains(e,n))||(t.type=i.originType,r=i.handler.call(e,t),t.type="mouseout"),r}});var __rest$s=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},Core,Event$1,Event2,Private$5,Private2;!function(e){let t;function r(e,t,...r){const n=EventObject.create(t);n.delegateTarget=e;const i=EventHook.get(n.type);if(i.preDispatch&&!1===i.preDispatch(e,n))return;const o=Util$2.getHandlerQueue(e,n);for(let a=0,s=o.length;a<s&&!n.isPropagationStopped();a+=1){const e=o[a];n.currentTarget=e.elem;for(let t=0,i=e.handlers.length;t<i&&!n.isImmediatePropagationStopped();t+=1){const i=e.handlers[t];if(null==n.rnamespace||i.namespace&&n.rnamespace.test(i.namespace)){n.handleObj=i,n.data=i.data;const t=EventHook.get(i.originType).handle,o=t?t(e.elem,n,...r):i.handler.call(e.elem,n,...r);void 0!==o&&(n.result=o,!1===o&&(n.preventDefault(),n.stopPropagation()))}}}return i.postDispatch&&i.postDispatch(e,n),n.result}e.on=function(e,n,i,o,a){if(!Util$2.isValidTarget(e))return;let s;if("function"!=typeof i){const{handler:e,selector:t}=i,r=__rest$s(i,["handler","selector"]);i=e,a=t,s=r}const l=Store$1.ensure(e);let c=l.handler;null==c&&(c=l.handler=function(n,...i){return t!==n.type?r(e,n,...i):void 0});const u=Util$2.ensureHandlerId(i);Util$2.splitType(n).forEach(t=>{const{originType:r,namespaces:n}=Util$2.normalizeType(t);if(!r)return;let d=r,p=EventHook.get(d);d=(a?p.delegateType:p.bindType)||d,p=EventHook.get(d);const h=Object.assign({type:d,originType:r,data:o,selector:a,guid:u,handler:i,namespace:n.join(".")},s),f=l.events;let g=f[d];g||(g=f[d]={handlers:[],delegateCount:0},p.setup&&!1!==p.setup(e,o,n,c)||Util$2.addEventListener(e,d,c)),p.add&&(Util$2.removeHandlerId(h.handler),p.add(e,h),Util$2.setHandlerId(h.handler,u)),a?(g.handlers.splice(g.delegateCount,0,h),g.delegateCount+=1):g.handlers.push(h)})},e.off=function e(t,r,n,i,o){const a=Store$1.get(t);if(!a)return;const s=a.events;s&&(Util$2.splitType(r).forEach(r=>{const{originType:l,namespaces:c}=Util$2.normalizeType(r);if(!l)return void Object.keys(s).forEach(o=>{e(t,o+r,n,i,!0)});let u=l;const d=EventHook.get(u);u=(i?d.delegateType:d.bindType)||u;const p=s[u];if(!p)return;const h=c.length>0?new RegExp(`(^|\\.)${c.join("\\.(?:.*\\.|)")}(\\.|$)`):null,f=p.handlers.length;for(let e=p.handlers.length-1;e>=0;e-=1){const r=p.handlers[e];!o&&l!==r.originType||n&&Util$2.getHandlerId(n)!==r.guid||!(null==h||r.namespace&&h.test(r.namespace))||!(null==i||i===r.selector||"**"===i&&r.selector)||(p.handlers.splice(e,1),r.selector&&(p.delegateCount-=1),d.remove&&d.remove(t,r))}f&&0===p.handlers.length&&(d.teardown&&!1!==d.teardown(t,c,a.handler)||Util$2.removeEventListener(t,u,a.handler),delete s[u])}),0===Object.keys(s).length&&Store$1.remove(t))},e.dispatch=r,e.trigger=function(e,r,n,i){let o=e,a="string"==typeof e?e:e.type,s="string"==typeof e||null==o.namespace?[]:o.namespace.split(".");const l=n;if(3===l.nodeType||8===l.nodeType)return;a.indexOf(".")>-1&&(s=a.split("."),a=s.shift(),s.sort());const c=a.indexOf(":")<0&&`on${a}`;o=e instanceof EventObject?e:new EventObject(a,"object"==typeof e?e:null),o.namespace=s.join("."),o.rnamespace=o.namespace?new RegExp(`(^|\\.)${s.join("\\.(?:.*\\.|)")}(\\.|$)`):null,o.result=void 0,o.target||(o.target=l);const u=[o];Array.isArray(r)?u.push(...r):u.push(r);const d=EventHook.get(a);if(!i&&d.trigger&&!1===d.trigger(l,o,r))return;let p;const h=[l];if(!i&&!d.noBubble&&!Util$2.isWindow(l)){p=d.delegateType||a;let e=l,t=l.parentNode;for(;null!=t;)h.push(t),e=t,t=t.parentNode;if(e===(l.ownerDocument||document)){const t=e.defaultView||e.parentWindow||window;h.push(t)}}let f=l;for(let t=0,g=h.length;t<g&&!o.isPropagationStopped();t+=1){const e=h[t];f=e,o.type=t>1?p:d.bindType||a;const r=Store$1.get(e);r&&r.events[o.type]&&r.handler&&r.handler.call(e,...u);const n=c&&e[c]||null;n&&Util$2.isValidTarget(e)&&(o.result=n.call(e,...u),!1===o.result&&o.preventDefault())}if(o.type=a,!i&&!o.isDefaultPrevented()){const e=d.preventDefault;if((null==e||!1===e(h.pop(),o,r))&&Util$2.isValidTarget(l)&&c&&"function"==typeof l[a]&&!Util$2.isWindow(l)){const e=l[c];e&&(l[c]=null),t=a,o.isPropagationStopped()&&f.addEventListener(a,Util$2.stopPropagationCallback),l[a](),o.isPropagationStopped()&&f.removeEventListener(a,Util$2.stopPropagationCallback),t=void 0,e&&(l[c]=e)}}return o.result}}(Core||(Core={})),Event2=Event$1||(Event$1={}),Event2.on=function(e,t,r,n,i){return Private$5.on(e,t,r,n,i),e},Event2.once=function(e,t,r,n,i){return Private$5.on(e,t,r,n,i,!0),e},Event2.off=function(e,t,r,n){return Private$5.off(e,t,r,n),e},Event2.trigger=function(e,t,r,n){return Core.trigger(t,r,e,n),e},Private2=Private$5||(Private$5={}),Private2.on=function e(t,r,n,i,o,a){if("object"==typeof r)return"string"!=typeof n&&(i=i||n,n=void 0),void Object.keys(r).forEach(o=>e(t,o,n,i,r[o],a));if(null==i&&null==o?(o=n,i=n=void 0):null==o&&("string"==typeof n?(o=i,i=void 0):(o=i,i=n,n=void 0)),!1===o)o=Util$2.returnFalse;else if(!o)return;if(a){const e=o;o=function(r,...n){return Private2.off(t,r),e.call(this,r,...n)},Util$2.setHandlerId(o,Util$2.ensureHandlerId(e))}Core.on(t,r,o,i,n)},Private2.off=function e(t,r,n,i){const o=r;if(o&&null!=o.preventDefault&&null!=o.handleObj){const t=o.handleObj;return void e(o.delegateTarget,t.namespace?`${t.originType}.${t.namespace}`:t.originType,t.selector,t.handler)}if("object"==typeof r){const i=r;return void Object.keys(i).forEach(r=>e(t,r,n,i[r]))}!1!==n&&"function"!=typeof n||(i=n,n=void 0),!1===i&&(i=Util$2.returnFalse),Core.off(t,r,i,n)};class MouseWheelHandle{constructor(e,t,r){this.animationFrameId=0,this.deltaX=0,this.deltaY=0,this.eventName=Platform.isEventSupported("wheel")?"wheel":"mousewheel",this.target=e,this.onWheelCallback=t,this.onWheelGuard=r,this.onWheel=this.onWheel.bind(this),this.didWheel=this.didWheel.bind(this)}enable(){this.target.addEventListener(this.eventName,this.onWheel,{passive:!1})}disable(){this.target.removeEventListener(this.eventName,this.onWheel)}onWheel(e){if(null!=this.onWheelGuard&&!this.onWheelGuard(e))return;let t;this.deltaX+=e.deltaX,this.deltaY+=e.deltaY,e.preventDefault(),0===this.deltaX&&0===this.deltaY||(e.stopPropagation(),t=!0),!0===t&&0===this.animationFrameId&&(this.animationFrameId=requestAnimationFrame(()=>{this.didWheel(e)}))}didWheel(e){this.animationFrameId=0,this.onWheelCallback(e,this.deltaX,this.deltaY),this.deltaX=0,this.deltaY=0}}function offset$1(e){const t=e.getBoundingClientRect(),r=e.ownerDocument.defaultView;return{top:t.top+r.pageYOffset,left:t.left+r.pageXOffset}}function width$1(e){return e.getBoundingClientRect().width}function height$1(e){return e.getBoundingClientRect().height}function debounce(e,t=60){let r=null;return(...n)=>{r&&clearTimeout(r),r=window.setTimeout(()=>{e.apply(this,n)},t)}}function createSensor$2(e){let t=null,r=[];const n=debounce(()=>{r.forEach(t=>t(e))}),i=()=>{t&&t.parentNode&&(t.contentDocument&&t.contentDocument.defaultView.removeEventListener("resize",n),t.parentNode.removeChild(t),t=null,r=[])};return{element:e,bind:i=>{t||(t=(()=>{"static"===getComputedStyle(e).position&&(e.style.position="relative");const t=document.createElement("object");return t.onload=()=>{t.contentDocument.defaultView.addEventListener("resize",n),n()},t.style.display="block",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.height="100%",t.style.width="100%",t.style.overflow="hidden",t.style.pointerEvents="none",t.style.zIndex="-1",t.style.opacity="0",t.setAttribute("tabindex","-1"),t.type="text/html",e.appendChild(t),t.data="about:blank",t})()),-1===r.indexOf(i)&&r.push(i)},destroy:i,unbind:e=>{const n=r.indexOf(e);-1!==n&&r.splice(n,1),0===r.length&&t&&i()}}}function createSensor$1(e){let t=null,r=[];const n=debounce(()=>{r.forEach(t=>{t(e)})}),i=()=>{t&&(t.disconnect(),r=[],t=null)};return{element:e,bind:i=>{t||(t=(()=>{const t=new ResizeObserver(n);return t.observe(e),n(),t})()),-1===r.indexOf(i)&&r.push(i)},destroy:i,unbind:e=>{const n=r.indexOf(e);-1!==n&&r.splice(n,1),0===r.length&&t&&i()}}}const createSensor="undefined"!=typeof ResizeObserver?createSensor$1:createSensor$2;var SizeSensor,PriorityQueue2,Dijkstra,Dijkstra2,Color2,ModifierKey,Timing,Timing2,Interp,Interp2;!function(e){const t=new WeakMap;function r(e){let r=t.get(e);return r||(r=createSensor(e),t.set(e,r),r)}e.bind=(e,t)=>{const n=r(e);return n.bind(t),()=>n.unbind(t)},e.clear=e=>{!function(e){e.destroy(),t.delete(e.element)}(r(e))}}(SizeSensor||(SizeSensor={}));class PriorityQueue{constructor(e={}){this.comparator=e.comparator||PriorityQueue.defaultComparator,this.index={},this.data=e.data||[],this.heapify()}isEmpty(){return 0===this.data.length}insert(e,t,r){const n={priority:e,value:t},i=this.data.length;return r&&(n.id=r,this.index[r]=i),this.data.push(n),this.bubbleUp(i),this}peek(){return this.data[0]?this.data[0].value:null}peekPriority(){return this.data[0]?this.data[0].priority:null}updatePriority(e,t){const r=this.index[e];if(void 0===r)throw new Error(`Node with id '${e}' was not found in the heap.`);const n=this.data,i=n[r].priority,o=this.comparator(t,i);o<0?(n[r].priority=t,this.bubbleUp(r)):o>0&&(n[r].priority=t,this.bubbleDown(r))}remove(){const e=this.data,t=e[0],r=e.pop();return t.id&&delete this.index[t.id],e.length>0&&(e[0]=r,r.id&&(this.index[r.id]=0),this.bubbleDown(0)),t?t.value:null}heapify(){for(let e=0;e<this.data.length;e+=1)this.bubbleUp(e)}bubbleUp(e){const t=this.data;let r,n,i=e;for(;i>0&&(n=i-1>>>1,this.comparator(t[i].priority,t[n].priority)<0);){r=t[n],t[n]=t[i];let e=t[i].id;null!=e&&(this.index[e]=n),t[i]=r,e=t[i].id,null!=e&&(this.index[e]=i),i=n}}bubbleDown(e){const t=this.data,r=t.length-1;let n=e;for(;;){const e=1+(n<<1),i=e+1;let o=n;if(e<=r&&this.comparator(t[e].priority,t[o].priority)<0&&(o=e),i<=r&&this.comparator(t[i].priority,t[o].priority)<0&&(o=i),o===n)break;{const e=t[o];t[o]=t[n];let r=t[n].id;null!=r&&(this.index[r]=o),t[n]=e,r=t[n].id,null!=r&&(this.index[r]=n),n=o}}}}PriorityQueue2=PriorityQueue||(PriorityQueue={}),PriorityQueue2.defaultComparator=(e,t)=>e-t,Dijkstra2=Dijkstra||(Dijkstra={}),Dijkstra2.run=function(e,t,r=(e,t)=>1){const n={},i={},o={},a=new PriorityQueue;for(n[t]=0,Object.keys(e).forEach(e=>{e!==t&&(n[e]=1/0),a.insert(n[e],e,e)});!a.isEmpty();){const t=a.remove();o[t]=!0;const s=e[t]||[];for(let e=0;e<s.length;e+=1){const l=s[e];if(!o[l]){const e=n[t]+r(t,l);e<n[l]&&(n[l]=e,i[l]=t,a.updatePriority(l,e))}}}return i};class Color{constructor(e,t,r,n){return null==e?this.set(255,255,255,1):"number"==typeof e?this.set(e,t,r,n):"string"==typeof e?Color.fromString(e)||this:Array.isArray(e)?this.set(e):void this.set(e.r,e.g,e.b,null==e.a?1:e.a)}blend(e,t,r){this.set(e.r+(t.r-e.r)*r,e.g+(t.g-e.g)*r,e.b+(t.b-e.b)*r,e.a+(t.a-e.a)*r)}lighten(e){const t=Color.lighten(this.toArray(),e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}darken(e){this.lighten(-e)}set(e,t,r,n){const i=Array.isArray(e)?e[0]:e,o=Array.isArray(e)?e[1]:t,a=Array.isArray(e)?e[2]:r,s=Array.isArray(e)?e[3]:n;return this.r=Math.round(clamp(i,0,255)),this.g=Math.round(clamp(o,0,255)),this.b=Math.round(clamp(a,0,255)),this.a=null==s?1:clamp(s,0,1),this}toHex(){return`#${["r","g","b"].map(e=>{const t=this[e].toString(16);return t.length<2?`0${t}`:t}).join("")}`}toRGBA(){return this.toArray()}toHSLA(){return Color.rgba2hsla(this.r,this.g,this.b,this.a)}toCSS(e){const t=`${this.r},${this.g},${this.b},`;return e?`rgb(${t})`:`rgba(${t},${this.a})`}toGrey(){return Color.makeGrey(Math.round((this.r+this.g+this.b)/3),this.a)}toArray(){return[this.r,this.g,this.b,this.a]}toString(){return this.toCSS()}}!function(e){function t(t){return new e([...s(t),1])}function r(t){const r=t.toLowerCase().match(/^rgba?\(([\s.,0-9]+)\)/);if(r){const t=r[1].split(/\s*,\s*/).map(e=>parseInt(e,10));return new e(t)}return null}function n(e,t,r){r<0&&++r,r>1&&--r;const n=6*r;return n<1?e+(t-e)*n:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}function i(t){const r=t.toLowerCase().match(/^hsla?\(([\s.,0-9]+)\)/);if(r){const t=r[2].split(/\s*,\s*/),n=(parseFloat(t[0])%360+360)%360/360,i=parseFloat(t[1])/100,a=parseFloat(t[2])/100,s=null==t[3]?1:parseInt(t[3],10);return new e(o(n,i,a,s))}return null}function o(e,t,r,i){const o=Array.isArray(e)?e[0]:e,a=Array.isArray(e)?e[1]:t,s=Array.isArray(e)?e[2]:r,l=Array.isArray(e)?e[3]:i,c=s<=.5?s*(a+1):s+a-s*a,u=2*s-c;return[256*n(u,c,o+1/3),256*n(u,c,o),256*n(u,c,o-1/3),null==l?1:l]}function a(t){return new e(Math.round(256*Math.random()),Math.round(256*Math.random()),Math.round(256*Math.random()),t?void 0:parseFloat(Math.random().toFixed(2)))}function s(e){const t=0===e.indexOf("#")?e:`#${e}`;let r=Number(`0x${t.substr(1)}`);if(4!==t.length&&7!==t.length||Number.isNaN(r))throw new Error("Invalid hex color.");const n=4===t.length?4:8,i=(1<<n)-1,o=["b","g","r"].map(()=>{const e=r&i;return r>>=n,4===n?17*e:e});return[o[2],o[1],o[0]]}function l(e,t,r){const n=e=>e.length<2?`0${e}`:e;return`${n(e.toString(16))}${n(t.toString(16))}${n(r.toString(16))}`}function c(e,t){if("string"==typeof e){const r="#"===e[0],n=parseInt(r?e.substr(1):e,16),i=clamp((n>>16)+t,0,255),o=clamp((n>>8&255)+t,0,255);return`${r?"#":""}${(clamp((255&n)+t,0,255)|o<<8|i<<16).toString(16)}`}const r=s(c(l(e[0],e[1],e[2]),t));return[r[0],r[1],r[2],e[3]]}e.fromArray=function(t){return new e(t)},e.fromHex=t,e.fromRGBA=r,e.fromHSLA=i,e.fromString=function(n){if(n.startsWith("#"))return t(n);if(n.startsWith("rgb"))return r(n);const o=e.named[n];return o?t(o):i(n)},e.makeGrey=function(t,r){return e.fromArray([t,t,t,r])},e.rgba2hsla=function(e,t,r,n){const i=Array.isArray(e)?e[0]:e,o=Array.isArray(e)?e[1]:t,a=Array.isArray(e)?e[2]:r,s=Array.isArray(e)?e[3]:n,l=Math.max(i,o,a),c=Math.min(i,o,a),u=(l+c)/2;let d=0,p=0;if(c!==l){const e=l-c;switch(p=u>.5?e/(2-l-c):e/(l+c),l){case i:d=(o-a)/e+(o<a?6:0);break;case o:d=(a-i)/e+2;break;case a:d=(i-o)/e+4}d/=6}return[d,p,u,null==s?1:s]},e.hsla2rgba=o,e.random=a,e.randomHex=function(){let e="#";for(let t=0;t<6;t+=1)e+="0123456789ABCDEF"[Math.floor(16*Math.random())];return e},e.randomRGBA=function(e){return a(e).toString()},e.invert=function(e,t){if("string"==typeof e){const r="#"===e[0],[n,i,o]=s(e);return t?.299*n+.587*i+.114*o>186?"#000000":"#ffffff":`${r?"#":""}${l(255-n,255-i,255-o)}`}const r=e[0],n=e[1],i=e[2],o=e[3];return t?.299*r+.587*n+.114*i>186?[0,0,0,o]:[255,255,255,o]:[255-r,255-n,255-i,o]},e.lighten=function(e,t){return c(e,t)},e.darken=function(e,t){return c(e,-t)}}(Color||(Color={})),Color2=Color||(Color={}),Color2.named={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",burntsienna:"#ea7e5d",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};class Dictionary{constructor(){this.clear()}clear(){this.map=new WeakMap,this.arr=[]}has(e){return this.map.has(e)}get(e){return this.map.get(e)}set(e,t){this.map.set(e,t),this.arr.push(e)}delete(e){const t=this.arr.indexOf(e);t>=0&&this.arr.splice(t,1);const r=this.map.get(e);return this.map.delete(e),r}each(e){this.arr.forEach(t=>{const r=this.map.get(t);e(r,t)})}dispose(){this.clear()}}!function(e){function t(e){const t=[],r=[];return Array.isArray(e)?t.push(...e):e.split("|").forEach(e=>{-1===e.indexOf("&")?t.push(e):r.push(...e.split("&"))}),{or:t,and:r}}e.parse=t,e.equals=function(e,r){if(null!=e&&null!=r){const n=t(e),i=t(r),o=n.or.sort(),a=i.or.sort(),s=n.and.sort(),l=i.and.sort(),c=(e,t)=>e.length===t.length&&(0===e.length||e.every((e,r)=>e===t[r]));return c(o,a)&&c(s,l)}return null==e&&null==r},e.isMatch=function(e,r,n){if(null==r||Array.isArray(r)&&0===r.length)return!n||!0!==e.altKey&&!0!==e.ctrlKey&&!0!==e.metaKey&&!0!==e.shiftKey;const{or:i,and:o}=t(r),a=t=>{const r=`${t.toLowerCase()}Key`;return!0===e[r]};return i.some(e=>a(e))&&o.every(e=>a(e))}}(ModifierKey||(ModifierKey={})),Timing2=Timing||(Timing={}),Timing2.linear=e=>e,Timing2.quad=e=>e*e,Timing2.cubic=e=>e*e*e,Timing2.inout=e=>{if(e<=0)return 0;if(e>=1)return 1;const t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)},Timing2.exponential=e=>Math.pow(2,10*(e-1)),Timing2.bounce=e=>{for(let t=0,r=1;;t+=r,r/=2)if(e>=(7-4*t)/11){const n=(11-6*t-11*e)/4;return-n*n+r*r}},function(e){e.decorators={reverse:e=>t=>1-e(1-t),reflect:e=>t=>.5*(t<.5?e(2*t):2-e(2-2*t)),clamp:(e,t=0,r=1)=>n=>{const i=e(n);return i<t?t:i>r?r:i},back:(e=1.70158)=>t=>t*t*((e+1)*t-e),elastic:(e=1.5)=>t=>Math.pow(2,10*(t-1))*Math.cos(20*Math.PI*e/3*t)}}(Timing||(Timing={})),function(e){function t(e){const t=e/1;if(t<1/2.75)return 7.5625*t*t;if(t<2/2.75){const e=t-1.5/2.75;return 7.5625*e*e+.75}if(t<2.5/2.75){const e=t-2.25/2.75;return 7.5625*e*e+.9375}{const e=t-2.625/2.75;return 7.5625*e*e+.984375}}function r(e){return 1-t(1-e)}e.easeInSine=function(e){return-1*Math.cos(e*(Math.PI/2))+1},e.easeOutSine=function(e){return Math.sin(e*(Math.PI/2))},e.easeInOutSine=function(e){return-.5*(Math.cos(Math.PI*e)-1)},e.easeInQuad=function(e){return e*e},e.easeOutQuad=function(e){return e*(2-e)},e.easeInOutQuad=function(e){return e<.5?2*e*e:(4-2*e)*e-1},e.easeInCubic=function(e){return e*e*e},e.easeOutCubic=function(e){const t=e-1;return t*t*t+1},e.easeInOutCubic=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},e.easeInQuart=function(e){return e*e*e*e},e.easeOutQuart=function(e){const t=e-1;return 1-t*t*t*t},e.easeInOutQuart=function(e){const t=e-1;return e<.5?8*e*e*e*e:1-8*t*t*t*t},e.easeInQuint=function(e){return e*e*e*e*e},e.easeOutQuint=function(e){const t=e-1;return 1+t*t*t*t*t},e.easeInOutQuint=function(e){const t=e-1;return e<.5?16*e*e*e*e*e:1+16*t*t*t*t*t},e.easeInExpo=function(e){return 0===e?0:Math.pow(2,10*(e-1))},e.easeOutExpo=function(e){return 1===e?1:1-Math.pow(2,-10*e)},e.easeInOutExpo=function(e){if(0===e||1===e)return e;const t=2*e,r=t-1;return t<1?.5*Math.pow(2,10*r):.5*(2-Math.pow(2,-10*r))},e.easeInCirc=function(e){const t=e/1;return-1*(Math.sqrt(1-t*e)-1)},e.easeOutCirc=function(e){const t=e-1;return Math.sqrt(1-t*t)},e.easeInOutCirc=function(e){const t=2*e,r=t-2;return t<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-r*r)+1)},e.easeInBack=function(e,t=1.70158){return e*e*((t+1)*e-t)},e.easeOutBack=function(e,t=1.70158){const r=e/1-1;return r*r*((t+1)*r+t)+1},e.easeInOutBack=function(e,t=1.70158){const r=2*e,n=r-2,i=1.525*t;return r<1?.5*r*r*((i+1)*r-i):.5*(n*n*((i+1)*n+i)+2)},e.easeInElastic=function(e,t=.7){if(0===e||1===e)return e;const r=e/1-1,n=1-t,i=n/(2*Math.PI)*Math.asin(1);return-Math.pow(2,10*r)*Math.sin((r-i)*(2*Math.PI)/n)},e.easeOutElastic=function(e,t=.7){const r=1-t,n=2*e;if(0===e||1===e)return e;const i=r/(2*Math.PI)*Math.asin(1);return Math.pow(2,-10*n)*Math.sin((n-i)*(2*Math.PI)/r)+1},e.easeInOutElastic=function(e,t=.65){const r=1-t;if(0===e||1===e)return e;const n=2*e,i=n-1,o=r/(2*Math.PI)*Math.asin(1);return n<1?Math.pow(2,10*i)*Math.sin((i-o)*(2*Math.PI)/r)*-.5:Math.pow(2,-10*i)*Math.sin((i-o)*(2*Math.PI)/r)*.5+1},e.easeOutBounce=t,e.easeInBounce=r,e.easeInOutBounce=function(e){return e<.5?.5*r(2*e):.5*t(2*e-1)+.5}}(Timing||(Timing={})),Interp2=Interp||(Interp={}),Interp2.number=(e,t)=>{const r=t-e;return t=>e+r*t},Interp2.object=(e,t)=>{const r=Object.keys(e);return n=>{const i={};for(let o=r.length-1;-1!==o;o-=1){const a=r[o];i[a]=e[a]+(t[a]-e[a])*n}return i}},Interp2.unit=(e,t)=>{const r=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/,n=r.exec(e),i=r.exec(t),o=i?i[1]:"",a=n?+n[1]:0,s=i?+i[1]:0,l=o.indexOf("."),c=l>0?o[1].length-l-1:0,u=s-a,d=n?n[2]:"";return e=>(a+u*e).toFixed(c)+d},Interp2.color=(e,t)=>{const r=parseInt(e.slice(1),16),n=parseInt(t.slice(1),16),i=255&r,o=(255&n)-i,a=65280&r,s=(65280&n)-a,l=16711680&r,c=(16711680&n)-l;return e=>`#${(1<<24|i+o*e&255|a+s*e&65280|l+c*e&16711680).toString(16).slice(1)}`};const cssModules=[];function ensure(e,t){const r=cssModules.find(t=>t.name===e);if(!(r&&(r.loadTimes+=1,r.loadTimes>1)||Platform.isApplyingHMR())){const r=document.createElement("style");r.setAttribute("type","text/css"),r.textContent=t;const n=document.querySelector("head");n&&n.insertBefore(r,n.firstChild),cssModules.push({name:e,loadTimes:1,styleElement:r})}}function clean(e){const t=cssModules.findIndex(t=>t.name===e);if(t>-1){const e=cssModules[t];if(e.loadTimes-=1,e.loadTimes>0)return;let r=e.styleElement;r&&r.parentNode&&r.parentNode.removeChild(r),r=null,cssModules.splice(t,1)}}var Angle,Angle2,GeometryUtil,GeometryUtil2,Point2,Rectangle2,Line2,Ellipse2;Angle2=Angle||(Angle={}),Angle2.toDeg=function(e){return 180*e/Math.PI%360},Angle2.toRad=function(e,t=!1){return(t?e:e%360)*Math.PI/180},Angle2.normalize=function(e){return e%360+(e<0?360:0)},GeometryUtil2=GeometryUtil||(GeometryUtil={}),GeometryUtil2.round=function(e,t=0){return Number.isInteger(e)?e:+e.toFixed(t)},GeometryUtil2.random=function(e,t){let r,n;if(null==t?(n=null==e?1:e,r=0):(n=t,r=null==e?0:e),n<r){const e=r;r=n,n=e}return Math.floor(Math.random()*(n-r+1)+r)},GeometryUtil2.clamp=function(e,t,r){return Number.isNaN(e)?NaN:Number.isNaN(t)||Number.isNaN(r)?0:t<r?e<t?t:e>r?r:e:e<r?r:e>t?t:e},GeometryUtil2.snapToGrid=function(e,t){return t*Math.round(e/t)},GeometryUtil2.containsPoint=function(e,t){return null!=t&&null!=e&&t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height},GeometryUtil2.squaredLength=function(e,t){const r=e.x-t.x,n=e.y-t.y;return r*r+n*n};class Geometry{valueOf(){return this.toJSON()}toString(){return JSON.stringify(this.toJSON())}}class Point extends Geometry{constructor(e,t){super(),this.x=null==e?0:e,this.y=null==t?0:t}round(e=0){return this.x=GeometryUtil.round(this.x,e),this.y=GeometryUtil.round(this.y,e),this}add(e,t){const r=Point.create(e,t);return this.x+=r.x,this.y+=r.y,this}update(e,t){const r=Point.create(e,t);return this.x=r.x,this.y=r.y,this}translate(e,t){const r=Point.create(e,t);return this.x+=r.x,this.y+=r.y,this}rotate(e,t){const r=Point.rotate(this,e,t);return this.x=r.x,this.y=r.y,this}scale(e,t,r=new Point){const n=Point.create(r);return this.x=n.x+e*(this.x-n.x),this.y=n.y+t*(this.y-n.y),this}closest(e){if(1===e.length)return Point.create(e[0]);let t=null,r=1/0;return e.forEach(e=>{const n=this.squaredDistance(e);n<r&&(t=e,r=n)}),t?Point.create(t):null}distance(e){return Math.sqrt(this.squaredDistance(e))}squaredDistance(e){const t=Point.create(e),r=this.x-t.x,n=this.y-t.y;return r*r+n*n}manhattanDistance(e){const t=Point.create(e);return Math.abs(t.x-this.x)+Math.abs(t.y-this.y)}magnitude(){return Math.sqrt(this.x*this.x+this.y*this.y)||.01}theta(e=new Point){const t=Point.create(e),r=-(t.y-this.y),n=t.x-this.x;let i=Math.atan2(r,n);return i<0&&(i=2*Math.PI+i),180*i/Math.PI}angleBetween(e,t){if(this.equals(e)||this.equals(t))return NaN;let r=this.theta(t)-this.theta(e);return r<0&&(r+=360),r}vectorAngle(e){return new Point(0,0).angleBetween(this,e)}toPolar(e){return this.update(Point.toPolar(this,e)),this}changeInAngle(e,t,r=new Point){return this.clone().translate(-e,-t).theta(r)-this.theta(r)}adhereToRect(e){return GeometryUtil.containsPoint(e,this)||(this.x=Math.min(Math.max(this.x,e.x),e.x+e.width),this.y=Math.min(Math.max(this.y,e.y),e.y+e.height)),this}bearing(e){const t=Point.create(e),r=Angle.toRad(this.y),n=Angle.toRad(t.y),i=this.x,o=t.x,a=Angle.toRad(o-i),s=Math.sin(a)*Math.cos(n),l=Math.cos(r)*Math.sin(n)-Math.sin(r)*Math.cos(n)*Math.cos(a);let c=Angle.toDeg(Math.atan2(s,l))-22.5;return c<0&&(c+=360),c=parseInt(c/45,10),["NE","E","SE","S","SW","W","NW","N"][c]}cross(e,t){if(null!=e&&null!=t){const r=Point.create(e),n=Point.create(t);return(n.x-this.x)*(r.y-this.y)-(n.y-this.y)*(r.x-this.x)}return NaN}dot(e){const t=Point.create(e);return this.x*t.x+this.y*t.y}diff(e,t){if("number"==typeof e)return new Point(this.x-e,this.y-t);const r=Point.create(e);return new Point(this.x-r.x,this.y-r.y)}lerp(e,t){const r=Point.create(e);return new Point((1-t)*this.x+t*r.x,(1-t)*this.y+t*r.y)}normalize(e=1){const t=e/this.magnitude();return this.scale(t,t)}move(e,t){const r=Point.create(e),n=Angle.toRad(r.theta(this));return this.translate(Math.cos(n)*t,-Math.sin(n)*t)}reflection(e){return Point.create(e).move(this,this.distance(e))}snapToGrid(e,t){return this.x=GeometryUtil.snapToGrid(this.x,e),this.y=GeometryUtil.snapToGrid(this.y,null==t?e:t),this}equals(e){const t=Point.create(e);return null!=t&&t.x===this.x&&t.y===this.y}clone(){return Point.clone(this)}toJSON(){return Point.toJSON(this)}serialize(){return`${this.x} ${this.y}`}}Point2=Point||(Point={}),Point2.isPoint=function(e){return null!=e&&e instanceof Point2},function(e){e.isPointLike=function(e){return null!=e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y},e.isPointData=function(e){return null!=e&&Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}}(Point||(Point={})),function(e){function t(t){return e.isPoint(t)?new e(t.x,t.y):Array.isArray(t)?new e(t[0],t[1]):new e(t.x,t.y)}function r(e,t){return e===t||null!=e&&null!=t&&(e.x===t.x&&e.y===t.y)}function n(r,n,i,o=new e){const a=t(r),s=t(o),l=a.x-s.x,c=a.y-s.y,u=c*n+l*i;return new e(l*n-c*i+s.x,u+s.y)}e.create=function(r,n){return null==r||"number"==typeof r?new e(r,n):t(r)},e.clone=t,e.toJSON=function(t){return e.isPoint(t)?{x:t.x,y:t.y}:Array.isArray(t)?{x:t[0],y:t[1]}:{x:t.x,y:t.y}},e.fromPolar=function(r,n,i=new e){let o=Math.abs(r*Math.cos(n)),a=Math.abs(r*Math.sin(n));const s=t(i),l=Angle.normalize(Angle.toDeg(n));return l<90?a=-a:l<180?(o=-o,a=-a):l<270&&(o=-o),new e(s.x+o,s.y+a)},e.toPolar=function(r,n=new e){const i=t(r),o=t(n),a=i.x-o.x,s=i.y-o.y;return new e(Math.sqrt(a*a+s*s),Angle.toRad(o.theta(i)))},e.equals=r,e.equalPoints=function(e,t){if(null==e&&null!=t||null!=e&&null==t||null!=e&&null!=t&&e.length!==t.length)return!1;if(null!=e&&null!=t)for(let n=0,i=e.length;n<i;n+=1)if(!r(e[n],t[n]))return!1;return!0},e.random=function(t,r,n,i){return new e(GeometryUtil.random(t,r),GeometryUtil.random(n,i))},e.rotate=function(e,t,r){const i=Angle.toRad(Angle.normalize(-t)),o=Math.sin(i);return n(e,Math.cos(i),o,r)},e.rotateEx=n}(Point||(Point={}));class Rectangle extends Geometry{get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get origin(){return new Point(this.x,this.y)}get topLeft(){return new Point(this.x,this.y)}get topCenter(){return new Point(this.x+this.width/2,this.y)}get topRight(){return new Point(this.x+this.width,this.y)}get center(){return new Point(this.x+this.width/2,this.y+this.height/2)}get bottomLeft(){return new Point(this.x,this.y+this.height)}get bottomCenter(){return new Point(this.x+this.width/2,this.y+this.height)}get bottomRight(){return new Point(this.x+this.width,this.y+this.height)}get corner(){return new Point(this.x+this.width,this.y+this.height)}get rightMiddle(){return new Point(this.x+this.width,this.y+this.height/2)}get leftMiddle(){return new Point(this.x,this.y+this.height/2)}get topLine(){return new Line(this.topLeft,this.topRight)}get rightLine(){return new Line(this.topRight,this.bottomRight)}get bottomLine(){return new Line(this.bottomLeft,this.bottomRight)}get leftLine(){return new Line(this.topLeft,this.bottomLeft)}constructor(e,t,r,n){super(),this.x=null==e?0:e,this.y=null==t?0:t,this.width=null==r?0:r,this.height=null==n?0:n}getOrigin(){return this.origin}getTopLeft(){return this.topLeft}getTopCenter(){return this.topCenter}getTopRight(){return this.topRight}getCenter(){return this.center}getCenterX(){return this.x+this.width/2}getCenterY(){return this.y+this.height/2}getBottomLeft(){return this.bottomLeft}getBottomCenter(){return this.bottomCenter}getBottomRight(){return this.bottomRight}getCorner(){return this.corner}getRightMiddle(){return this.rightMiddle}getLeftMiddle(){return this.leftMiddle}getTopLine(){return this.topLine}getRightLine(){return this.rightLine}getBottomLine(){return this.bottomLine}getLeftLine(){return this.leftLine}bbox(e){if(!e)return this.clone();const t=Angle.toRad(e),r=Math.abs(Math.sin(t)),n=Math.abs(Math.cos(t)),i=this.width*n+this.height*r,o=this.width*r+this.height*n;return new Rectangle(this.x+(this.width-i)/2,this.y+(this.height-o)/2,i,o)}round(e=0){return this.x=GeometryUtil.round(this.x,e),this.y=GeometryUtil.round(this.y,e),this.width=GeometryUtil.round(this.width,e),this.height=GeometryUtil.round(this.height,e),this}add(e,t,r,n){const i=Rectangle.create(e,t,r,n),o=Math.min(this.x,i.x),a=Math.min(this.y,i.y),s=Math.max(this.x+this.width,i.x+i.width),l=Math.max(this.y+this.height,i.y+i.height);return this.x=o,this.y=a,this.width=s-o,this.height=l-a,this}update(e,t,r,n){const i=Rectangle.create(e,t,r,n);return this.x=i.x,this.y=i.y,this.width=i.width,this.height=i.height,this}inflate(e,t){const r=e,n=null!=t?t:e;return this.x-=r,this.y-=n,this.width+=2*r,this.height+=2*n,this}snapToGrid(e,t){const r=this.origin.snapToGrid(e,t),n=this.corner.snapToGrid(e,t);return this.x=r.x,this.y=r.y,this.width=n.x-r.x,this.height=n.y-r.y,this}translate(e,t){const r=Point.create(e,t);return this.x+=r.x,this.y+=r.y,this}scale(e,t,r=new Point){const n=this.origin.scale(e,t,r);return this.x=n.x,this.y=n.y,this.width*=e,this.height*=t,this}rotate(e,t=this.getCenter()){if(0!==e){const r=Angle.toRad(e),n=Math.cos(r),i=Math.sin(r);let o=this.getOrigin(),a=this.getTopRight(),s=this.getBottomRight(),l=this.getBottomLeft();o=Point.rotateEx(o,n,i,t),a=Point.rotateEx(a,n,i,t),s=Point.rotateEx(s,n,i,t),l=Point.rotateEx(l,n,i,t);const c=new Rectangle(o.x,o.y,0,0);c.add(a.x,a.y,0,0),c.add(s.x,s.y,0,0),c.add(l.x,l.y,0,0),this.update(c)}return this}rotate90(){const e=(this.width-this.height)/2;this.x+=e,this.y-=e;const t=this.width;return this.width=this.height,this.height=t,this}moveAndExpand(e){const t=Rectangle.clone(e);return this.x+=t.x||0,this.y+=t.y||0,this.width+=t.width||0,this.height+=t.height||0,this}getMaxScaleToFit(e,t=this.center){const r=Rectangle.clone(e),n=t.x,i=t.y;let o=1/0,a=1/0,s=1/0,l=1/0,c=1/0,u=1/0,d=1/0,p=1/0;const h=r.topLeft;h.x<n&&(o=(this.x-n)/(h.x-n)),h.y<i&&(c=(this.y-i)/(h.y-i));const f=r.bottomRight;f.x>n&&(a=(this.x+this.width-n)/(f.x-n)),f.y>i&&(u=(this.y+this.height-i)/(f.y-i));const g=r.topRight;g.x>n&&(s=(this.x+this.width-n)/(g.x-n)),g.y<i&&(d=(this.y-i)/(g.y-i));const m=r.bottomLeft;return m.x<n&&(l=(this.x-n)/(m.x-n)),m.y>i&&(p=(this.y+this.height-i)/(m.y-i)),{sx:Math.min(o,a,s,l),sy:Math.min(c,u,d,p)}}getMaxUniformScaleToFit(e,t=this.center){const r=this.getMaxScaleToFit(e,t);return Math.min(r.sx,r.sy)}containsPoint(e,t){return GeometryUtil.containsPoint(this,Point.create(e,t))}containsRect(e,t,r,n){const i=Rectangle.create(e,t,r,n),o=this.x,a=this.y,s=this.width,l=this.height,c=i.x,u=i.y,d=i.width,p=i.height;return 0!==s&&0!==l&&0!==d&&0!==p&&(c>=o&&u>=a&&c+d<=o+s&&u+p<=a+l)}intersectsWithLine(e){const t=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],r=[],n=[];return t.forEach(t=>{const i=e.intersectsWithLine(t);null!==i&&n.indexOf(i.toString())<0&&(r.push(i),n.push(i.toString()))}),r.length>0?r:null}intersectsWithLineFromCenterToPoint(e,t){const r=Point.clone(e),n=this.center;let i=null;null!=t&&0!==t&&r.rotate(t,n);const o=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],a=new Line(n,r);for(let s=o.length-1;s>=0;s-=1){const e=o[s].intersectsWithLine(a);if(null!==e){i=e;break}}return i&&null!=t&&0!==t&&i.rotate(-t,n),i}intersectsWithRect(e,t,r,n){const i=Rectangle.create(e,t,r,n);if(!this.isIntersectWithRect(i))return null;const o=this.origin,a=this.corner,s=i.origin,l=i.corner,c=Math.max(o.x,s.x),u=Math.max(o.y,s.y);return new Rectangle(c,u,Math.min(a.x,l.x)-c,Math.min(a.y,l.y)-u)}isIntersectWithRect(e,t,r,n){const i=Rectangle.create(e,t,r,n),o=this.origin,a=this.corner,s=i.origin,l=i.corner;return!(l.x<=o.x||l.y<=o.y||s.x>=a.x||s.y>=a.y)}normalize(){let e=this.x,t=this.y,r=this.width,n=this.height;return this.width<0&&(e=this.x+this.width,r=-this.width),this.height<0&&(t=this.y+this.height,n=-this.height),this.x=e,this.y=t,this.width=r,this.height=n,this}union(e){const t=Rectangle.clone(e),r=this.origin,n=this.corner,i=t.origin,o=t.corner,a=Math.min(r.x,i.x),s=Math.min(r.y,i.y),l=Math.max(n.x,o.x),c=Math.max(n.y,o.y);return new Rectangle(a,s,l-a,c-s)}getNearestSideToPoint(e){const t=Point.clone(e),r=t.x-this.x,n=this.x+this.width-t.x,i=t.y-this.y;let o=r,a="left";return n<o&&(o=n,a="right"),i<o&&(o=i,a="top"),this.y+this.height-t.y<o&&(a="bottom"),a}getNearestPointToPoint(e){const t=Point.clone(e);if(this.containsPoint(t)){const e=this.getNearestSideToPoint(t);if("left"===e)return new Point(this.x,t.y);if("top"===e)return new Point(t.x,this.y);if("right"===e)return new Point(this.x+this.width,t.y);if("bottom"===e)return new Point(t.x,this.y+this.height)}return t.adhereToRect(this)}equals(e){return null!=e&&e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height}clone(){return new Rectangle(this.x,this.y,this.width,this.height)}toJSON(){return{x:this.x,y:this.y,width:this.width,height:this.height}}serialize(){return`${this.x} ${this.y} ${this.width} ${this.height}`}}Rectangle2=Rectangle||(Rectangle={}),Rectangle2.isRectangle=function(e){return null!=e&&e instanceof Rectangle2},function(e){e.isRectangleLike=function(e){return null!=e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.width&&"number"==typeof e.height}}(Rectangle||(Rectangle={})),function(e){function t(t){return e.isRectangle(t)?t.clone():Array.isArray(t)?new e(t[0],t[1],t[2],t[3]):new e(t.x,t.y,t.width,t.height)}e.create=function(r,n,i,o){return null==r||"number"==typeof r?new e(r,n,i,o):t(r)},e.clone=t,e.fromEllipse=function(t){return new e(t.x-t.a,t.y-t.b,2*t.a,2*t.b)},e.fromSize=function(t){return new e(0,0,t.width,t.height)},e.fromPositionAndSize=function(t,r){return new e(t.x,t.y,r.width,r.height)}}(Rectangle||(Rectangle={}));class Line extends Geometry{get center(){return new Point((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}constructor(e,t,r,n){super(),"number"==typeof e&&"number"==typeof t?(this.start=new Point(e,t),this.end=new Point(r,n)):(this.start=Point.create(e),this.end=Point.create(t))}getCenter(){return this.center}round(e=0){return this.start.round(e),this.end.round(e),this}translate(e,t){return"number"==typeof e?(this.start.translate(e,t),this.end.translate(e,t)):(this.start.translate(e),this.end.translate(e)),this}rotate(e,t){return this.start.rotate(e,t),this.end.rotate(e,t),this}scale(e,t,r){return this.start.scale(e,t,r),this.end.scale(e,t,r),this}length(){return Math.sqrt(this.squaredLength())}squaredLength(){const e=this.start.x-this.end.x,t=this.start.y-this.end.y;return e*e+t*t}setLength(e){const t=this.length();if(!t)return this;const r=e/t;return this.scale(r,r,this.start)}parallel(e){const t=this.clone();if(!t.isDifferentiable())return t;const{start:r,end:n}=t,i=r.clone().rotate(270,n),o=n.clone().rotate(90,r);return r.move(o,e),n.move(i,e),t}vector(){return new Point(this.end.x-this.start.x,this.end.y-this.start.y)}angle(){const e=new Point(this.start.x+1,this.start.y);return this.start.angleBetween(this.end,e)}bbox(){const e=Math.min(this.start.x,this.end.x),t=Math.min(this.start.y,this.end.y),r=Math.max(this.start.x,this.end.x),n=Math.max(this.start.y,this.end.y);return new Rectangle(e,t,r-e,n-t)}bearing(){return this.start.bearing(this.end)}closestPoint(e){return this.pointAt(this.closestPointNormalizedLength(e))}closestPointLength(e){return this.closestPointNormalizedLength(e)*this.length()}closestPointTangent(e){return this.tangentAt(this.closestPointNormalizedLength(e))}closestPointNormalizedLength(e){const t=this.vector().dot(new Line(this.start,e).vector()),r=Math.min(1,Math.max(0,t/this.squaredLength()));return Number.isNaN(r)?0:r}pointAt(e){const t=this.start,r=this.end;return e<=0?t.clone():e>=1?r.clone():t.lerp(r,e)}pointAtLength(e){const t=this.start,r=this.end;let n=!0;e<0&&(n=!1,e=-e);const i=this.length();if(e>=i)return n?r.clone():t.clone();const o=(n?e:i-e)/i;return this.pointAt(o)}divideAt(e){const t=this.pointAt(e);return[new Line(this.start,t),new Line(t,this.end)]}divideAtLength(e){const t=this.pointAtLength(e);return[new Line(this.start,t),new Line(t,this.end)]}containsPoint(e){const t=this.start,r=this.end;if(0!==t.cross(e,r))return!1;const n=this.length();return!(new Line(t,e).length()>n)&&!(new Line(e,r).length()>n)}intersect(e,t){const r=e.intersectsWithLine(this,t);return r?Array.isArray(r)?r:[r]:null}intersectsWithLine(e){const t=new Point(this.end.x-this.start.x,this.end.y-this.start.y),r=new Point(e.end.x-e.start.x,e.end.y-e.start.y),n=t.x*r.y-t.y*r.x,i=new Point(e.start.x-this.start.x,e.start.y-this.start.y),o=i.x*r.y-i.y*r.x,a=i.x*t.y-i.y*t.x;if(0===n||o*n<0||a*n<0)return null;if(n>0){if(o>n||a>n)return null}else if(o<n||a<n)return null;return new Point(this.start.x+o*t.x/n,this.start.y+o*t.y/n)}isDifferentiable(){return!this.start.equals(this.end)}pointOffset(e){const t=Point.clone(e),r=this.start,n=this.end;return((n.x-r.x)*(t.y-r.y)-(n.y-r.y)*(t.x-r.x))/this.length()}pointSquaredDistance(e,t){const r=Point.create(e,t);return this.closestPoint(r).squaredDistance(r)}pointDistance(e,t){const r=Point.create(e,t);return this.closestPoint(r).distance(r)}tangentAt(e){if(!this.isDifferentiable())return null;const t=this.start,r=this.end,n=this.pointAt(e),i=new Line(t,r);return i.translate(n.x-t.x,n.y-t.y),i}tangentAtLength(e){if(!this.isDifferentiable())return null;const t=this.start,r=this.end,n=this.pointAtLength(e),i=new Line(t,r);return i.translate(n.x-t.x,n.y-t.y),i}relativeCcw(e,t){const r=Point.create(e,t);let n=r.x-this.start.x,i=r.y-this.start.y;const o=this.end.x-this.start.x,a=this.end.y-this.start.y;let s=n*a-i*o;return 0===s&&(s=n*o+i*a,s>0&&(n-=o,i-=a,s=n*o+i*a,s<0&&(s=0))),s<0?-1:s>0?1:0}equals(e){return null!=e&&this.start.x===e.start.x&&this.start.y===e.start.y&&this.end.x===e.end.x&&this.end.y===e.end.y}clone(){return new Line(this.start,this.end)}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.end.serialize()].join(" ")}}Line2=Line||(Line={}),Line2.isLine=function(e){return null!=e&&e instanceof Line2};class Ellipse extends Geometry{get center(){return new Point(this.x,this.y)}constructor(e,t,r,n){super(),this.x=null==e?0:e,this.y=null==t?0:t,this.a=null==r?0:r,this.b=null==n?0:n}bbox(){return Rectangle.fromEllipse(this)}getCenter(){return this.center}inflate(e,t){const r=e,n=null!=t?t:e;return this.a+=2*r,this.b+=2*n,this}normalizedDistance(e,t){const r=Point.create(e,t),n=r.x-this.x,i=r.y-this.y,o=this.a,a=this.b;return n*n/(o*o)+i*i/(a*a)}containsPoint(e,t){return this.normalizedDistance(e,t)<=1}intersectsWithLine(e){const t=[],r=this.a,n=this.b,i=e.start,o=e.end,a=e.vector(),s=i.diff(new Point(this.x,this.y)),l=new Point(a.x/(r*r),a.y/(n*n)),c=new Point(s.x/(r*r),s.y/(n*n)),u=a.dot(l),d=a.dot(c),p=d*d-u*(s.dot(c)-1);if(p<0)return null;if(p>0){const e=Math.sqrt(p),r=(-d-e)/u,n=(-d+e)/u;if((r<0||r>1)&&(n<0||n>1))return null;r>=0&&r<=1&&t.push(i.lerp(o,r)),n>=0&&n<=1&&t.push(i.lerp(o,n))}else{const e=-d/u;if(!(e>=0&&e<=1))return null;t.push(i.lerp(o,e))}return t}intersectsWithLineFromCenterToPoint(e,t=0){const r=Point.clone(e);t&&r.rotate(t,this.getCenter());const n=r.x-this.x,i=r.y-this.y;let o;if(0===n)return o=this.bbox().getNearestPointToPoint(r),t?o.rotate(-t,this.getCenter()):o;const a=i/n,s=a*a,l=this.a*this.a,c=this.b*this.b;let u=Math.sqrt(1/(1/l+s/c));u=n<0?-u:u;const d=a*u;return o=new Point(this.x+u,this.y+d),t?o.rotate(-t,this.getCenter()):o}tangentTheta(e){const t=Point.clone(e),r=t.x,n=t.y,i=this.a,o=this.b,a=this.bbox().center,s=a.x,l=a.y,c=r>a.x+i/2,u=r<a.x-i/2;let d,p;return c||u?(p=r>a.x?n-30:n+30,d=i*i/(r-s)-i*i*(n-l)*(p-l)/(o*o*(r-s))+s):(d=n>a.y?r+30:r-30,p=o*o/(n-l)-o*o*(r-s)*(d-s)/(i*i*(n-l))+l),new Point(d,p).theta(t)}scale(e,t){return this.a*=e,this.b*=t,this}rotate(e,t){const r=Rectangle.fromEllipse(this);r.rotate(e,t);const n=Ellipse.fromRect(r);return this.a=n.a,this.b=n.b,this.x=n.x,this.y=n.y,this}translate(e,t){const r=Point.create(e,t);return this.x+=r.x,this.y+=r.y,this}equals(e){return null!=e&&e.x===this.x&&e.y===this.y&&e.a===this.a&&e.b===this.b}clone(){return new Ellipse(this.x,this.y,this.a,this.b)}toJSON(){return{x:this.x,y:this.y,a:this.a,b:this.b}}serialize(){return`${this.x} ${this.y} ${this.a} ${this.b}`}}Ellipse2=Ellipse||(Ellipse={}),Ellipse2.isEllipse=function(e){return null!=e&&e instanceof Ellipse2},function(e){function t(t){return e.isEllipse(t)?t.clone():Array.isArray(t)?new e(t[0],t[1],t[2],t[3]):new e(t.x,t.y,t.a,t.b)}e.create=function(r,n,i,o){return null==r||"number"==typeof r?new e(r,n,i,o):t(r)},e.parse=t,e.fromRect=function(t){const r=t.center;return new e(r.x,r.y,t.width/2,t.height/2)}}(Ellipse||(Ellipse={}));const regexSupportedData=new RegExp("^[\\s\\dLMCZz,.]*$");function isValid(e){return"string"==typeof e&&regexSupportedData.test(e)}function mod(e,t){return(e%t+t)%t}function draw(e,t,r,n,i){const o=[],a=e[e.length-1],s=null!=t&&t>0,l=t||0;if(n&&s){const t=(e=e.slice())[0],r=new Point(a.x+(t.x-a.x)/2,a.y+(t.y-a.y)/2);e.splice(0,0,r)}let c=e[0],u=1;for(r?o.push("M",c.x,c.y):o.push("L",c.x,c.y);u<(n?e.length:e.length-1);){let t=e[mod(u,e.length)],r=c.x-t.x,n=c.y-t.y;if(s&&(0!==r||0!==n)&&(null==i||i.indexOf(u-1)<0)){let i=Math.sqrt(r*r+n*n);const a=r*Math.min(l,i/2)/i,s=n*Math.min(l,i/2)/i,c=t.x+a,d=t.y+s;o.push("L",c,d);let p=e[mod(u+1,e.length)];for(;u<e.length-2&&0===Math.round(p.x-t.x)&&0===Math.round(p.y-t.y);)p=e[mod(u+2,e.length)],u+=1;r=p.x-t.x,n=p.y-t.y,i=Math.max(1,Math.sqrt(r*r+n*n));const h=r*Math.min(l,i/2)/i,f=n*Math.min(l,i/2)/i,g=t.x+h,m=t.y+f;o.push("Q",t.x,t.y,g,m),t=new Point(g,m)}else o.push("L",t.x,t.y);c=t,u+=1}return n?o.push("Z"):o.push("L",a.x,a.y),o.map(e=>"string"==typeof e?e:+e.toFixed(3)).join(" ")}function drawPoints(e,t={}){const r=[];return e&&e.length&&e.forEach(e=>{Array.isArray(e)?r.push({x:e[0],y:e[1]}):r.push({x:e.x,y:e.y})}),draw(r,t.round,null==t.initialMove||t.initialMove,t.close,t.exclude)}function arcToCurves(e,t,r,n,i=0,o=0,a=0,s,l){if(0===r||0===n)return[];s-=e,l-=t,r=Math.abs(r),n=Math.abs(n);const c=-s/2,u=-l/2,d=Math.cos(i*Math.PI/180),p=Math.sin(i*Math.PI/180),h=d*c+p*u,f=-1*p*c+d*u,g=h*h,m=f*f,v=r*r,y=n*n,b=g/v+m/y;let q;if(b>1)r=Math.sqrt(b)*r,n=Math.sqrt(b)*n,q=0;else{let e=1;o===a&&(e=-1),q=e*Math.sqrt((v*y-v*m-y*g)/(v*m+y*g))}const V=q*r*f/n,S=-1*q*n*h/r,E=d*V-p*S+s/2,x=p*V+d*S+l/2;let C=Math.atan2((f-S)/n,(h-V)/r)-Math.atan2(0,1),w=C>=0?C:2*Math.PI+C;C=Math.atan2((-f-S)/n,(-h-V)/r)-Math.atan2((f-S)/n,(h-V)/r);let R=C>=0?C:2*Math.PI+C;0===a&&R>0?R-=2*Math.PI:0!==a&&R<0&&(R+=2*Math.PI);const A=2*R/Math.PI,T=Math.ceil(A<0?-1*A:A),k=R/T,N=8/3*Math.sin(k/4)*Math.sin(k/4)/Math.sin(k/2),P=d*r,O=d*n,F=p*r,_=p*n;let I=Math.cos(w),D=Math.sin(w),U=-N*(P*D+_*I),L=-N*(F*D-O*I),B=0,M=0;const W=[];for(let j=0;j<T;j+=1){w+=k,I=Math.cos(w),D=Math.sin(w),B=P*I-_*D+E,M=F*I+O*D+x;const r=-N*(P*D+_*I),n=-N*(F*D-O*I),i=6*j;W[i]=Number(U+e),W[i+1]=Number(L+t),W[i+2]=Number(B-r+e),W[i+3]=Number(M-n+t),W[i+4]=Number(B+e),W[i+5]=Number(M+t),U=B+r,L=M+n}return W.map(e=>+e.toFixed(2))}function drawArc(e,t,r,n,i=0,o=0,a=0,s,l){const c=[],u=arcToCurves(e,t,r,n,i,o,a,s,l);if(null!=u)for(let d=0,p=u.length;d<p;d+=6)c.push("C",u[d],u[d+1],u[d+2],u[d+3],u[d+4],u[d+5]);return c.join(" ")}class Polyline extends Geometry{get start(){return this.points[0]||null}get end(){return this.points[this.points.length-1]||null}constructor(e){if(super(),null!=e){if("string"==typeof e)return Polyline.parse(e);this.points=e.map(e=>Point.create(e))}else this.points=[]}scale(e,t,r=new Point){return this.points.forEach(n=>n.scale(e,t,r)),this}rotate(e,t){return this.points.forEach(r=>r.rotate(e,t)),this}translate(e,t){const r=Point.create(e,t);return this.points.forEach(e=>e.translate(r.x,r.y)),this}round(e=0){return this.points.forEach(t=>t.round(e)),this}bbox(){if(0===this.points.length)return new Rectangle;let e=1/0,t=-1/0,r=1/0,n=-1/0;const i=this.points;for(let o=0,a=i.length;o<a;o+=1){const a=i[o],s=a.x,l=a.y;s<e&&(e=s),s>t&&(t=s),l<r&&(r=l),l>n&&(n=l)}return new Rectangle(e,r,t-e,n-r)}closestPoint(e){const t=this.closestPointLength(e);return this.pointAtLength(t)}closestPointLength(e){const t=this.points,r=t.length;if(0===r||1===r)return 0;let n=0,i=0,o=1/0;for(let a=0,s=r-1;a<s;a+=1){const r=new Line(t[a],t[a+1]),s=r.length(),l=r.closestPointNormalizedLength(e),c=r.pointAt(l).squaredDistance(e);c<o&&(o=c,i=n+l*s),n+=s}return i}closestPointNormalizedLength(e){const t=this.length();if(0===t)return 0;return this.closestPointLength(e)/t}closestPointTangent(e){const t=this.closestPointLength(e);return this.tangentAtLength(t)}containsPoint(e){if(0===this.points.length)return!1;const t=Point.clone(e),r=t.x,n=t.y,i=this.points,o=i.length;let a=o-1,s=0;for(let l=0;l<o;l+=1){const o=i[a],c=i[l];if(t.equals(o))return!0;const u=new Line(o,c);if(u.containsPoint(e))return!0;if(n<=o.y&&n>c.y||n>o.y&&n<=c.y){const t=o.x-r>c.x-r?o.x-r:c.x-r;if(t>=0){const i=new Point(r+t,n),o=new Line(e,i);u.intersectsWithLine(o)&&(s+=1)}}a=l}return s%2==1}intersectsWithLine(e){const t=[];for(let r=0,n=this.points.length-1;r<n;r+=1){const n=this.points[r],i=this.points[r+1],o=e.intersectsWithLine(new Line(n,i));o&&t.push(o)}return t.length>0?t:null}isDifferentiable(){for(let e=0,t=this.points.length-1;e<t;e+=1){const t=this.points[e],r=this.points[e+1];if(new Line(t,r).isDifferentiable())return!0}return!1}length(){let e=0;for(let t=0,r=this.points.length-1;t<r;t+=1){const r=this.points[t],n=this.points[t+1];e+=r.distance(n)}return e}pointAt(e){const t=this.points,r=t.length;if(0===r)return null;if(1===r)return t[0].clone();if(e<=0)return t[0].clone();if(e>=1)return t[r-1].clone();const n=this.length()*e;return this.pointAtLength(n)}pointAtLength(e){const t=this.points,r=t.length;if(0===r)return null;if(1===r)return t[0].clone();let n=!0;e<0&&(n=!1,e=-e);let i=0;for(let o=0,a=r-1;o<a;o+=1){const r=n?o:a-1-o,s=t[r],l=t[r+1],c=new Line(s,l),u=s.distance(l);if(e<=i+u)return c.pointAtLength((n?1:-1)*(e-i));i+=u}return(n?t[r-1]:t[0]).clone()}tangentAt(e){const t=this.points.length;if(0===t||1===t)return null;e<0&&(e=0),e>1&&(e=1);const r=this.length()*e;return this.tangentAtLength(r)}tangentAtLength(e){const t=this.points,r=t.length;if(0===r||1===r)return null;let n,i=!0;e<0&&(i=!1,e=-e);let o=0;for(let a=0,s=r-1;a<s;a+=1){const r=i?a:s-1-a,l=t[r],c=t[r+1],u=new Line(l,c),d=l.distance(c);if(u.isDifferentiable()){if(e<=o+d)return u.tangentAtLength((i?1:-1)*(e-o));n=u}o+=d}if(n){const e=i?1:0;return n.tangentAt(e)}return null}simplify(e={}){const t=this.points;if(t.length<3)return this;const r=e.threshold||0;let n=0;for(;t[n+2];){const e=n+1,i=n+2,o=t[n],a=t[e],s=t[i];new Line(o,s).closestPoint(a).distance(a)<=r?t.splice(e,1):n+=1}return this}toHull(){const e=this.points,t=e.length;if(0===t)return new Polyline;let r=e[0];for(let d=1;d<t;d+=1)(e[d].y<r.y||e[d].y===r.y&&e[d].x>r.x)&&(r=e[d]);const n=[];for(let d=0;d<t;d+=1){let t=r.theta(e[d]);0===t&&(t=360),n.push([e[d],d,t])}if(n.sort((e,t)=>{let r=e[2]-t[2];return 0===r&&(r=t[1]-e[1]),r}),n.length>2){const e=n[n.length-1];n.unshift(e)}const i={},o=[],a=e=>`${e[0].toString()}@${e[1]}`;for(;0!==n.length;){const e=n.pop(),t=e[0];if(i[a(e)])continue;let r=!1;for(;!r;)if(o.length<2)o.push(e),r=!0;else{const s=o.pop(),l=s[0],c=o.pop(),u=c[0],d=u.cross(l,t);if(d<0)o.push(c),o.push(s),o.push(e),r=!0;else if(0===d){const e=1e-10,r=l.angleBetween(u,t);Math.abs(r-180)<e||l.equals(t)||u.equals(l)?(i[a(s)]=l,o.push(c)):Math.abs((r+1)%360-1)<e&&(o.push(c),n.push(s))}else i[a(s)]=l,o.push(c)}}let s;o.length>2&&o.pop();let l=-1;for(let d=0,p=o.length;d<p;d+=1){const e=o[d][1];(void 0===s||e<s)&&(s=e,l=d)}let c=[];if(l>0){const e=o.slice(l),t=o.slice(0,l);c=e.concat(t)}else c=o;const u=[];for(let d=0,p=c.length;d<p;d+=1)u.push(c[d][0]);return new Polyline(u)}equals(e){return null!=e&&(e.points.length===this.points.length&&e.points.every((e,t)=>e.equals(this.points[t])))}clone(){return new Polyline(this.points.map(e=>e.clone()))}toJSON(){return this.points.map(e=>e.toJSON())}serialize(){return this.points.map(e=>`${e.serialize()}`).join(" ")}}var Polyline2,Curve2,LineTo2,Close2,MoveTo2,CurveTo2,Path2,Registry2;Polyline2=Polyline||(Polyline={}),Polyline2.isPolyline=function(e){return null!=e&&e instanceof Polyline2},function(e){e.parse=function(t){const r=t.trim();if(""===r)return new e;const n=[],i=r.split(/\s*,\s*|\s+/);for(let e=0,o=i.length;e<o;e+=2)n.push({x:+i[e],y:+i[e+1]});return new e(n)}}(Polyline||(Polyline={}));class Curve extends Geometry{constructor(e,t,r,n){super(),this.PRECISION=3,this.start=Point.create(e),this.controlPoint1=Point.create(t),this.controlPoint2=Point.create(r),this.end=Point.create(n)}bbox(){const e=this.start,t=this.controlPoint1,r=this.controlPoint2,n=this.end,i=e.x,o=e.y,a=t.x,s=t.y,l=r.x,c=r.y,u=n.x,d=n.y,p=[],h=[[],[]];let f,g,m,v,y,b,q,V,S,E,x;for(let N=0;N<2;N+=1)if(0===N?(g=6*i-12*a+6*l,f=-3*i+9*a-9*l+3*u,m=3*a-3*i):(g=6*o-12*s+6*c,f=-3*o+9*s-9*c+3*d,m=3*s-3*o),Math.abs(f)<1e-12){if(Math.abs(g)<1e-12)continue;v=-m/g,v>0&&v<1&&p.push(v)}else q=g*g-4*m*f,V=Math.sqrt(q),q<0||(y=(-g+V)/(2*f),y>0&&y<1&&p.push(y),b=(-g-V)/(2*f),b>0&&b<1&&p.push(b));let C=p.length;const w=C;for(;C;)C-=1,v=p[C],x=1-v,S=x*x*x*i+3*x*x*v*a+3*x*v*v*l+v*v*v*u,h[0][C]=S,E=x*x*x*o+3*x*x*v*s+3*x*v*v*c+v*v*v*d,h[1][C]=E;p[w]=0,p[w+1]=1,h[0][w]=i,h[1][w]=o,h[0][w+1]=u,h[1][w+1]=d,p.length=w+2,h[0].length=w+2,h[1].length=w+2;const R=Math.min.apply(null,h[0]),A=Math.min.apply(null,h[1]),T=Math.max.apply(null,h[0]),k=Math.max.apply(null,h[1]);return new Rectangle(R,A,T-R,k-A)}closestPoint(e,t={}){return this.pointAtT(this.closestPointT(e,t))}closestPointLength(e,t={}){const r=this.getOptions(t);return this.lengthAtT(this.closestPointT(e,r),r)}closestPointNormalizedLength(e,t={}){const r=this.getOptions(t),n=this.closestPointLength(e,r);if(!n)return 0;const i=this.length(r);return 0===i?0:n/i}closestPointT(e,t={}){const r=this.getPrecision(t),n=this.getDivisions(t),i=Math.pow(10,-r);let o=null,a=0,s=0,l=0,c=0,u=0,d=null;const p=n.length;let h=p>0?1/p:0;for(n.forEach((t,r)=>{const n=t.start.distance(e),i=t.end.distance(e),p=n+i;(null==d||p<d)&&(o=t,a=r*h,s=(r+1)*h,l=n,c=i,d=p,u=t.endpointDistance())});;){const t=l?Math.abs(l-c)/l:0,r=null!=c?Math.abs(l-c)/c:0;if(t<i||r<i||(!l||l<u*i||(!c||c<u*i)))return l<=c?a:s;const n=o.divide(.5);h/=2;const d=n[0].start.distance(e),p=n[0].end.distance(e),f=d+p,g=n[1].start.distance(e),m=n[1].end.distance(e);f<=g+m?(o=n[0],s-=h,l=d,c=p):(o=n[1],a+=h,l=g,c=m)}}closestPointTangent(e,t={}){return this.tangentAtT(this.closestPointT(e,t))}containsPoint(e,t={}){return this.toPolyline(t).containsPoint(e)}divideAt(e,t={}){if(e<=0)return this.divideAtT(0);if(e>=1)return this.divideAtT(1);const r=this.tAt(e,t);return this.divideAtT(r)}divideAtLength(e,t={}){const r=this.tAtLength(e,t);return this.divideAtT(r)}divide(e){return this.divideAtT(e)}divideAtT(e){const t=this.start,r=this.controlPoint1,n=this.controlPoint2,i=this.end;if(e<=0)return[new Curve(t,t,t,t),new Curve(t,r,n,i)];if(e>=1)return[new Curve(t,r,n,i),new Curve(i,i,i,i)];const o=this.getSkeletonPoints(e),a=o.startControlPoint1,s=o.startControlPoint2,l=o.divider,c=o.dividerControlPoint1,u=o.dividerControlPoint2;return[new Curve(t,a,s,l),new Curve(l,c,u,i)]}endpointDistance(){return this.start.distance(this.end)}getSkeletonPoints(e){const t=this.start,r=this.controlPoint1,n=this.controlPoint2,i=this.end;if(e<=0)return{startControlPoint1:t.clone(),startControlPoint2:t.clone(),divider:t.clone(),dividerControlPoint1:r.clone(),dividerControlPoint2:n.clone()};if(e>=1)return{startControlPoint1:r.clone(),startControlPoint2:n.clone(),divider:i.clone(),dividerControlPoint1:i.clone(),dividerControlPoint2:i.clone()};const o=new Line(t,r).pointAt(e),a=new Line(r,n).pointAt(e),s=new Line(n,i).pointAt(e),l=new Line(o,a).pointAt(e),c=new Line(a,s).pointAt(e);return{startControlPoint1:o,startControlPoint2:l,divider:new Line(l,c).pointAt(e),dividerControlPoint1:c,dividerControlPoint2:s}}getSubdivisions(e={}){const t=this.getPrecision(e);let r=[new Curve(this.start,this.controlPoint1,this.controlPoint2,this.end)];if(0===t)return r;let n=this.endpointDistance();const i=Math.pow(10,-t);let o=0;for(;;){o+=1;const e=[];r.forEach(t=>{const r=t.divide(.5);e.push(r[0],r[1])});const t=e.reduce((e,t)=>e+t.endpointDistance(),0);if(o>1&&(0!==t?(t-n)/t:0)<i)return e;r=e,n=t}}length(e={}){return this.getDivisions(e).reduce((e,t)=>e+t.endpointDistance(),0)}lengthAtT(e,t={}){if(e<=0)return 0;const r=void 0===t.precision?this.PRECISION:t.precision;return this.divide(e)[0].length({precision:r})}pointAt(e,t={}){if(e<=0)return this.start.clone();if(e>=1)return this.end.clone();const r=this.tAt(e,t);return this.pointAtT(r)}pointAtLength(e,t={}){const r=this.tAtLength(e,t);return this.pointAtT(r)}pointAtT(e){return e<=0?this.start.clone():e>=1?this.end.clone():this.getSkeletonPoints(e).divider}isDifferentiable(){const e=this.start,t=this.controlPoint1,r=this.controlPoint2,n=this.end;return!(e.equals(t)&&t.equals(r)&&r.equals(n))}tangentAt(e,t={}){if(!this.isDifferentiable())return null;e<0?e=0:e>1&&(e=1);const r=this.tAt(e,t);return this.tangentAtT(r)}tangentAtLength(e,t={}){if(!this.isDifferentiable())return null;const r=this.tAtLength(e,t);return this.tangentAtT(r)}tangentAtT(e){if(!this.isDifferentiable())return null;e<0&&(e=0),e>1&&(e=1);const t=this.getSkeletonPoints(e),r=t.startControlPoint2,n=t.dividerControlPoint1,i=t.divider,o=new Line(r,n);return o.translate(i.x-r.x,i.y-r.y),o}getPrecision(e={}){return null==e.precision?this.PRECISION:e.precision}getDivisions(e={}){if(null!=e.subdivisions)return e.subdivisions;const t=this.getPrecision(e);return this.getSubdivisions({precision:t})}getOptions(e={}){return{precision:this.getPrecision(e),subdivisions:this.getDivisions(e)}}tAt(e,t={}){if(e<=0)return 0;if(e>=1)return 1;const r=this.getOptions(t),n=this.length(r)*e;return this.tAtLength(n,r)}tAtLength(e,t={}){let r=!0;e<0&&(r=!1,e=-e);const n=this.getPrecision(t),i=this.getDivisions(t),o={precision:n,subdivisions:i};let a,s,l=null,c=0,u=0,d=0;const p=i.length;let h=p>0?1/p:0;for(let m=0;m<p;m+=1){const t=r?m:p-1-m,n=i[m],o=n.endpointDistance();if(e<=d+o){l=n,a=t*h,s=(t+1)*h,c=r?e-d:o+d-e,u=r?o+d-e:e-d;break}d+=o}if(null==l)return r?1:0;const f=this.length(o),g=Math.pow(10,-n);for(;;){let e,t,r;if(e=0!==f?c/f:0,e<g)return a;if(e=0!==f?u/f:0,e<g)return s;const n=l.divide(.5);h/=2;const i=n[0].endpointDistance(),o=n[1].endpointDistance();c<=i?(l=n[0],s-=h,t=c,r=i-t):(l=n[1],a+=h,t=c-i,r=o-t),c=t,u=r}}toPoints(e={}){const t=this.getDivisions(e),r=[t[0].start.clone()];return t.forEach(e=>r.push(e.end.clone())),r}toPolyline(e={}){return new Polyline(this.toPoints(e))}scale(e,t,r){return this.start.scale(e,t,r),this.controlPoint1.scale(e,t,r),this.controlPoint2.scale(e,t,r),this.end.scale(e,t,r),this}rotate(e,t){return this.start.rotate(e,t),this.controlPoint1.rotate(e,t),this.controlPoint2.rotate(e,t),this.end.rotate(e,t),this}translate(e,t){return"number"==typeof e?(this.start.translate(e,t),this.controlPoint1.translate(e,t),this.controlPoint2.translate(e,t),this.end.translate(e,t)):(this.start.translate(e),this.controlPoint1.translate(e),this.controlPoint2.translate(e),this.end.translate(e)),this}equals(e){return null!=e&&this.start.equals(e.start)&&this.controlPoint1.equals(e.controlPoint1)&&this.controlPoint2.equals(e.controlPoint2)&&this.end.equals(e.end)}clone(){return new Curve(this.start,this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.controlPoint1.serialize(),this.controlPoint2.serialize(),this.end.serialize()].join(" ")}}Curve2=Curve||(Curve={}),Curve2.isCurve=function(e){return null!=e&&e instanceof Curve2},function(e){function t(e){const t=e.length,r=[],n=[];let i=2;r[0]=e[0]/i;for(let o=1;o<t;o+=1)n[o]=1/i,i=(o<t-1?4:3.5)-n[o],r[o]=(e[o]-r[o-1])/i;for(let o=1;o<t;o+=1)r[t-o-1]-=n[t-o]*r[t-o];return r}e.throughPoints=function(r){if(null==r||Array.isArray(r)&&r.length<2)throw new Error("At least 2 points are required");const n=function(e){const r=e.map(e=>Point.clone(e)),n=[],i=[],o=r.length-1;if(1===o)return n[0]=new Point((2*r[0].x+r[1].x)/3,(2*r[0].y+r[1].y)/3),i[0]=new Point(2*n[0].x-r[0].x,2*n[0].y-r[0].y),[n,i];const a=[];for(let t=1;t<o-1;t+=1)a[t]=4*r[t].x+2*r[t+1].x;a[0]=r[0].x+2*r[1].x,a[o-1]=(8*r[o-1].x+r[o].x)/2;const s=t(a);for(let t=1;t<o-1;t+=1)a[t]=4*r[t].y+2*r[t+1].y;a[0]=r[0].y+2*r[1].y,a[o-1]=(8*r[o-1].y+r[o].y)/2;const l=t(a);for(let t=0;t<o;t+=1)n.push(new Point(s[t],l[t])),t<o-1?i.push(new Point(2*r[t+1].x-s[t+1],2*r[t+1].y-l[t+1])):i.push(new Point((r[o].x+s[o-1])/2,(r[o].y+l[o-1])/2));return[n,i]}(r),i=[];for(let t=0,o=n[0].length;t<o;t+=1){const o=new Point(n[0][t].x,n[0][t].y),a=new Point(n[1][t].x,n[1][t].y);i.push(new e(r[t],o,a,r[t+1]))}return i}}(Curve||(Curve={}));class Segment extends Geometry{constructor(){super(...arguments),this.isVisible=!0,this.isSegment=!0,this.isSubpathStart=!1}get end(){return this.endPoint}get start(){if(null==this.previousSegment)throw new Error("Missing previous segment. (This segment cannot be the first segment of a path, or segment has not yet been added to a path.)");return this.previousSegment.end}closestPointT(e,t){if(this.closestPointNormalizedLength)return this.closestPointNormalizedLength(e);throw new Error("Neither `closestPointT` nor `closestPointNormalizedLength` method is implemented.")}lengthAtT(e,t){if(e<=0)return 0;const r=this.length();return e>=1?r:r*e}divideAtT(e){if(this.divideAt)return this.divideAt(e);throw new Error("Neither `divideAtT` nor `divideAt` method is implemented.")}pointAtT(e){if(this.pointAt)return this.pointAt(e);throw new Error("Neither `pointAtT` nor `pointAt` method is implemented.")}tangentAtT(e){if(this.tangentAt)return this.tangentAt(e);throw new Error("Neither `tangentAtT` nor `tangentAt` method is implemented.")}}class LineTo extends Segment{constructor(e,t){super(),Line.isLine(e)?this.endPoint=e.end.clone().round(2):this.endPoint=Point.create(e,t).round(2)}get type(){return"L"}get line(){return new Line(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(e){return this.line.closestPoint(e)}closestPointLength(e){return this.line.closestPointLength(e)}closestPointNormalizedLength(e){return this.line.closestPointNormalizedLength(e)}closestPointTangent(e){return this.line.closestPointTangent(e)}length(){return this.line.length()}divideAt(e){const t=this.line.divideAt(e);return[new LineTo(t[0]),new LineTo(t[1])]}divideAtLength(e){const t=this.line.divideAtLength(e);return[new LineTo(t[0]),new LineTo(t[1])]}getSubdivisions(){return[]}pointAt(e){return this.line.pointAt(e)}pointAtLength(e){return this.line.pointAtLength(e)}tangentAt(e){return this.line.tangentAt(e)}tangentAtLength(e){return this.line.tangentAtLength(e)}isDifferentiable(){return null!=this.previousSegment&&!this.start.equals(this.end)}clone(){return new LineTo(this.end)}scale(e,t,r){return this.end.scale(e,t,r),this}rotate(e,t){return this.end.rotate(e,t),this}translate(e,t){return"number"==typeof e?this.end.translate(e,t):this.end.translate(e),this}equals(e){return this.type===e.type&&this.start.equals(e.start)&&this.end.equals(e.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){const e=this.end;return`${this.type} ${e.x} ${e.y}`}}LineTo2=LineTo||(LineTo={}),LineTo2.create=function(...e){const t=e.length,r=e[0];if(Line.isLine(r))return new LineTo2(r);if(Point.isPointLike(r))return 1===t?new LineTo2(r):e.map(e=>new LineTo2(e));if(2===t)return new LineTo2(+e[0],+e[1]);const n=[];for(let i=0;i<t;i+=2){const t=+e[i],r=+e[i+1];n.push(new LineTo2(t,r))}return n};class Close extends Segment{get end(){if(!this.subpathStartSegment)throw new Error("Missing subpath start segment. (This segment needs a subpath start segment (e.g. MoveTo), or segment has not yet been added to a path.)");return this.subpathStartSegment.end}get type(){return"Z"}get line(){return new Line(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(e){return this.line.closestPoint(e)}closestPointLength(e){return this.line.closestPointLength(e)}closestPointNormalizedLength(e){return this.line.closestPointNormalizedLength(e)}closestPointTangent(e){return this.line.closestPointTangent(e)}length(){return this.line.length()}divideAt(e){const t=this.line.divideAt(e);return[t[1].isDifferentiable()?new LineTo(t[0]):this.clone(),new LineTo(t[1])]}divideAtLength(e){const t=this.line.divideAtLength(e);return[t[1].isDifferentiable()?new LineTo(t[0]):this.clone(),new LineTo(t[1])]}getSubdivisions(){return[]}pointAt(e){return this.line.pointAt(e)}pointAtLength(e){return this.line.pointAtLength(e)}tangentAt(e){return this.line.tangentAt(e)}tangentAtLength(e){return this.line.tangentAtLength(e)}isDifferentiable(){return!(!this.previousSegment||!this.subpathStartSegment)&&!this.start.equals(this.end)}scale(){return this}rotate(){return this}translate(){return this}equals(e){return this.type===e.type&&this.start.equals(e.start)&&this.end.equals(e.end)}clone(){return new Close}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return this.type}}Close2=Close||(Close={}),Close2.create=function(){return new Close2};class MoveTo extends Segment{constructor(e,t){super(),this.isVisible=!1,this.isSubpathStart=!0,Line.isLine(e)||Curve.isCurve(e)?this.endPoint=e.end.clone().round(2):this.endPoint=Point.create(e,t).round(2)}get start(){throw new Error("Illegal access. Moveto segments should not need a start property.")}get type(){return"M"}bbox(){return null}closestPoint(){return this.end.clone()}closestPointLength(){return 0}closestPointNormalizedLength(){return 0}closestPointT(){return 1}closestPointTangent(){return null}length(){return 0}lengthAtT(){return 0}divideAt(){return[this.clone(),this.clone()]}divideAtLength(){return[this.clone(),this.clone()]}getSubdivisions(){return[]}pointAt(){return this.end.clone()}pointAtLength(){return this.end.clone()}pointAtT(){return this.end.clone()}tangentAt(){return null}tangentAtLength(){return null}tangentAtT(){return null}isDifferentiable(){return!1}scale(e,t,r){return this.end.scale(e,t,r),this}rotate(e,t){return this.end.rotate(e,t),this}translate(e,t){return"number"==typeof e?this.end.translate(e,t):this.end.translate(e),this}clone(){return new MoveTo(this.end)}equals(e){return this.type===e.type&&this.end.equals(e.end)}toJSON(){return{type:this.type,end:this.end.toJSON()}}serialize(){const e=this.end;return`${this.type} ${e.x} ${e.y}`}}MoveTo2=MoveTo||(MoveTo={}),MoveTo2.create=function(...e){const t=e.length,r=e[0];if(Line.isLine(r))return new MoveTo2(r);if(Curve.isCurve(r))return new MoveTo2(r);if(Point.isPointLike(r)){if(1===t)return new MoveTo2(r);const n=[];for(let r=0;r<t;r+=1)0===r?n.push(new MoveTo2(e[r])):n.push(new LineTo(e[r]));return n}if(2===t)return new MoveTo2(+e[0],+e[1]);const n=[];for(let i=0;i<t;i+=2){const t=+e[i],r=+e[i+1];0===i?n.push(new MoveTo2(t,r)):n.push(new LineTo(t,r))}return n};class CurveTo extends Segment{constructor(e,t,r,n,i,o){super(),Curve.isCurve(e)?(this.controlPoint1=e.controlPoint1.clone().round(2),this.controlPoint2=e.controlPoint2.clone().round(2),this.endPoint=e.end.clone().round(2)):"number"==typeof e?(this.controlPoint1=new Point(e,t).round(2),this.controlPoint2=new Point(r,n).round(2),this.endPoint=new Point(i,o).round(2)):(this.controlPoint1=Point.create(e).round(2),this.controlPoint2=Point.create(t).round(2),this.endPoint=Point.create(r).round(2))}get type(){return"C"}get curve(){return new Curve(this.start,this.controlPoint1,this.controlPoint2,this.end)}bbox(){return this.curve.bbox()}closestPoint(e){return this.curve.closestPoint(e)}closestPointLength(e){return this.curve.closestPointLength(e)}closestPointNormalizedLength(e){return this.curve.closestPointNormalizedLength(e)}closestPointTangent(e){return this.curve.closestPointTangent(e)}length(){return this.curve.length()}divideAt(e,t={}){const r=this.curve.divideAt(e,t);return[new CurveTo(r[0]),new CurveTo(r[1])]}divideAtLength(e,t={}){const r=this.curve.divideAtLength(e,t);return[new CurveTo(r[0]),new CurveTo(r[1])]}divideAtT(e){const t=this.curve.divideAtT(e);return[new CurveTo(t[0]),new CurveTo(t[1])]}getSubdivisions(){return[]}pointAt(e){return this.curve.pointAt(e)}pointAtLength(e){return this.curve.pointAtLength(e)}tangentAt(e){return this.curve.tangentAt(e)}tangentAtLength(e){return this.curve.tangentAtLength(e)}isDifferentiable(){if(!this.previousSegment)return!1;const e=this.start,t=this.controlPoint1,r=this.controlPoint2,n=this.end;return!(e.equals(t)&&t.equals(r)&&r.equals(n))}scale(e,t,r){return this.controlPoint1.scale(e,t,r),this.controlPoint2.scale(e,t,r),this.end.scale(e,t,r),this}rotate(e,t){return this.controlPoint1.rotate(e,t),this.controlPoint2.rotate(e,t),this.end.rotate(e,t),this}translate(e,t){return"number"==typeof e?(this.controlPoint1.translate(e,t),this.controlPoint2.translate(e,t),this.end.translate(e,t)):(this.controlPoint1.translate(e),this.controlPoint2.translate(e),this.end.translate(e)),this}equals(e){return this.start.equals(e.start)&&this.end.equals(e.end)&&this.controlPoint1.equals(e.controlPoint1)&&this.controlPoint2.equals(e.controlPoint2)}clone(){return new CurveTo(this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){const e=this.controlPoint1,t=this.controlPoint2,r=this.end;return[this.type,e.x,e.y,t.x,t.y,r.x,r.y].join(" ")}}function rotate(e,t,r){return{x:e*Math.cos(r)-t*Math.sin(r),y:e*Math.sin(r)+t*Math.cos(r)}}function q2c(e,t,r,n,i,o){const a=1/3,s=2/3;return[a*e+s*r,a*t+s*n,a*i+s*r,a*o+s*n,i,o]}function a2c(e,t,r,n,i,o,a,s,l,c){const u=120*Math.PI/180,d=Math.PI/180*(+i||0);let p,h,f,g,m,v=[];if(c)h=c[0],f=c[1],g=c[2],m=c[3];else{p=rotate(e,t,-d),e=p.x,t=p.y,p=rotate(s,l,-d);const i=(e-(s=p.x))/2,c=(t-(l=p.y))/2;let u=i*i/(r*r)+c*c/(n*n);u>1&&(u=Math.sqrt(u),r*=u,n*=u);const v=r*r,y=n*n,b=(o===a?-1:1)*Math.sqrt(Math.abs((v*y-v*c*c-y*i*i)/(v*c*c+y*i*i)));g=b*r*c/n+(e+s)/2,m=b*-n*i/r+(t+l)/2,h=Math.asin((t-m)/n),f=Math.asin((l-m)/n),h=e<g?Math.PI-h:h,f=s<g?Math.PI-f:f,h<0&&(h=2*Math.PI+h),f<0&&(f=2*Math.PI+f),a&&h>f&&(h-=2*Math.PI),!a&&f>h&&(f-=2*Math.PI)}let y=f-h;if(Math.abs(y)>u){const e=f,t=s,o=l;f=h+u*(a&&f>h?1:-1),v=a2c(s=g+r*Math.cos(f),l=m+n*Math.sin(f),r,n,i,0,a,t,o,[f,e,g,m])}y=f-h;const b=Math.cos(h),q=Math.sin(h),V=Math.cos(f),S=Math.sin(f),E=Math.tan(y/4),x=4/3*(r*E),C=4/3*(n*E),w=[e,t],R=[e+x*q,t-C*b],A=[s+x*S,l-C*V],T=[s,l];if(R[0]=2*w[0]-R[0],R[1]=2*w[1]-R[1],c)return[R,A,T].concat(v);{v=[R,A,T].concat(v).join().split(",");const e=[],t=v.length;for(let r=0;r<t;r+=1)e[r]=r%2?rotate(+v[r-1],+v[r],d).y:rotate(+v[r],+v[r+1],d).x;return e}}function parse$4(e){if(!e)return null;const t="\t\n\v\f\r   ᠎              \u2028\u2029",r=new RegExp(`([a-z])[${t},]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[${t}]*,?[${t}]*)+)`,"ig"),n=new RegExp(`(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[${t}]*,?[${t}]*`,"ig"),i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[];return e.replace(r,(e,t,r)=>{const a=[];let s=t.toLowerCase();r.replace(n,(e,t)=>(t&&a.push(+t),e)),"m"===s&&a.length>2&&(o.push([t,...a.splice(0,2)]),s="l",t="m"===t?"l":"L");const l=i[s];for(;a.length>=l&&(o.push([t,...a.splice(0,l)]),l););return e}),o}function abs(e){const t=parse$4(e);if(!t||!t.length)return[["M",0,0]];let r=0,n=0,i=0,o=0;const a=[];for(let s=0,l=t.length;s<l;s+=1){const e=[];a.push(e);const l=t[s],c=l[0];if(c!==c.toUpperCase())switch(e[0]=c.toUpperCase(),e[0]){case"A":e[1]=l[1],e[2]=l[2],e[3]=l[3],e[4]=l[4],e[5]=l[5],e[6]=+l[6]+r,e[7]=+l[7]+n;break;case"V":e[1]=+l[1]+n;break;case"H":e[1]=+l[1]+r;break;case"M":i=+l[1]+r,o=+l[2]+n;for(let t=1,i=l.length;t<i;t+=1)e[t]=+l[t]+(t%2?r:n);break;default:for(let t=1,i=l.length;t<i;t+=1)e[t]=+l[t]+(t%2?r:n)}else for(let t=0,r=l.length;t<r;t+=1)e[t]=l[t];switch(e[0]){case"Z":r=+i,n=+o;break;case"H":r=e[1];break;case"V":n=e[1];break;case"M":i=e[e.length-2],o=e[e.length-1],r=e[e.length-2],n=e[e.length-1];break;default:r=e[e.length-2],n=e[e.length-1]}}return a}function normalize$5(e){const t=abs(e),r={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};function n(e,t,r){let n,i;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(e[0]in{T:1,Q:1}||(t.qx=null,t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":return 0===parseFloat(e[1])||0===parseFloat(e[2])?["L",e[6],e[7]]:["C"].concat(a2c.apply(0,[t.x,t.y].concat(e.slice(1))));case"S":return"C"===r||"S"===r?(n=2*t.x-t.bx,i=2*t.y-t.by):(n=t.x,i=t.y),["C",n,i].concat(e.slice(1));case"T":return"Q"===r||"T"===r?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),["C"].concat(q2c(t.x,t.y,t.qx,t.qy,e[1],e[2]));case"Q":return t.qx=e[1],t.qy=e[2],["C"].concat(q2c(t.x,t.y,e[1],e[2],e[3],e[4]));case"H":return["L"].concat(e[1],t.y);case"V":return["L"].concat(t.x,e[1])}return e}function i(e,r){if(e[r].length>7){e[r].shift();const n=e[r];for(;n.length;)o[r]="A",r+=1,e.splice(r,0,["C"].concat(n.splice(0,6)));e.splice(r,1),s=t.length}}const o=[];let a="",s=t.length;for(let l=0;l<s;l+=1){let e="";t[l]&&(e=t[l][0]),"C"!==e&&(o[l]=e,l>0&&(a=o[l-1])),t[l]=n(t[l],r,a),"A"!==o[l]&&"C"===e&&(o[l]="C"),i(t,l);const s=t[l],c=s.length;r.x=s[c-2],r.y=s[c-1],r.bx=parseFloat(s[c-4])||r.x,r.by=parseFloat(s[c-3])||r.y}return t[0][0]&&"M"===t[0][0]||t.unshift(["M",0,0]),t}function normalizePathData(e){return normalize$5(e).map(e=>e.map(e=>"string"==typeof e?e:GeometryUtil.round(e,2))).join(",").split(",").join(" ")}CurveTo2=CurveTo||(CurveTo={}),CurveTo2.create=function(...e){const t=e.length,r=e[0];if(Curve.isCurve(r))return new CurveTo2(r);if(Point.isPointLike(r)){if(3===t)return new CurveTo2(e[0],e[1],e[2]);const r=[];for(let n=0;n<t;n+=3)r.push(new CurveTo2(e[n],e[n+1],e[n+2]));return r}if(6===t)return new CurveTo2(e[0],e[1],e[2],e[3],e[4],e[5]);const n=[];for(let i=0;i<t;i+=6)n.push(new CurveTo2(e[i],e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]));return n};class Path extends Geometry{constructor(e){if(super(),this.PRECISION=3,this.segments=[],Array.isArray(e))if(Line.isLine(e[0])||Curve.isCurve(e[0])){let t=null;e.forEach((e,r)=>{0===r&&this.appendSegment(Path.createSegment("M",e.start)),null==t||t.end.equals(e.start)||this.appendSegment(Path.createSegment("M",e.start)),Line.isLine(e)?this.appendSegment(Path.createSegment("L",e.end)):Curve.isCurve(e)&&this.appendSegment(Path.createSegment("C",e.controlPoint1,e.controlPoint2,e.end)),t=e})}else{e.forEach(e=>{e.isSegment&&this.appendSegment(e)})}else null!=e&&(Line.isLine(e)?(this.appendSegment(Path.createSegment("M",e.start)),this.appendSegment(Path.createSegment("L",e.end))):Curve.isCurve(e)?(this.appendSegment(Path.createSegment("M",e.start)),this.appendSegment(Path.createSegment("C",e.controlPoint1,e.controlPoint2,e.end))):Polyline.isPolyline(e)?e.points&&e.points.length&&e.points.forEach((e,t)=>{const r=0===t?Path.createSegment("M",e):Path.createSegment("L",e);this.appendSegment(r)}):e.isSegment&&this.appendSegment(e))}get start(){const e=this.segments,t=e.length;if(0===t)return null;for(let r=0;r<t;r+=1){const t=e[r];if(t.isVisible)return t.start}return e[t-1].end}get end(){const e=this.segments,t=e.length;if(0===t)return null;for(let r=t-1;r>=0;r-=1){const t=e[r];if(t.isVisible)return t.end}return e[t-1].end}moveTo(...e){return this.appendSegment(MoveTo.create.call(null,...e))}lineTo(...e){return this.appendSegment(LineTo.create.call(null,...e))}curveTo(...e){return this.appendSegment(CurveTo.create.call(null,...e))}arcTo(e,t,r,n,i,o,a){const s=this.end||new Point,l="number"==typeof o?arcToCurves(s.x,s.y,e,t,r,n,i,o,a):arcToCurves(s.x,s.y,e,t,r,n,i,o.x,o.y);if(null!=l)for(let c=0,u=l.length;c<u;c+=6)this.curveTo(l[c],l[c+1],l[c+2],l[c+3],l[c+4],l[c+5]);return this}quadTo(e,t,r,n){const i=this.end||new Point,o=["M",i.x,i.y];if("number"==typeof e)o.push("Q",e,t,r,n);else{const r=t;o.push("Q",e.x,e.y,r.x,r.y)}const a=Path.parse(o.join(" "));return this.appendSegment(a.segments.slice(1)),this}close(){return this.appendSegment(Close.create())}drawPoints(e,t={}){const r=drawPoints(e,t),n=Path.parse(r);n&&n.segments&&this.appendSegment(n.segments)}bbox(){const e=this.segments,t=e.length;if(0===t)return null;let r;for(let i=0;i<t;i+=1){const t=e[i];if(t.isVisible){const e=t.bbox();null!=e&&(r=r?r.union(e):e)}}if(null!=r)return r;const n=e[t-1];return new Rectangle(n.end.x,n.end.y,0,0)}appendSegment(e){const t=this.segments.length;let r,n=0!==t?this.segments[t-1]:null;if(Array.isArray(e))for(let i=0,o=e.length;i<o;i+=1){const t=e[i];r=this.prepareSegment(t,n,null),this.segments.push(r),n=r}else null!=e&&e.isSegment&&(r=this.prepareSegment(e,n,null),this.segments.push(r));return this}insertSegment(e,t){const r=this.segments.length;if(e<0&&(e=r+e+1),e>r||e<0)throw new Error("Index out of range.");let n,i=null,o=null;if(0!==r&&(e>=1?(i=this.segments[e-1],o=i.nextSegment):(i=null,o=this.segments[0])),Array.isArray(t))for(let a=0,s=t.length;a<s;a+=1){const r=t[a];n=this.prepareSegment(r,i,o),this.segments.splice(e+a,0,n),i=n}else n=this.prepareSegment(t,i,o),this.segments.splice(e,0,n);return this}removeSegment(e){const t=this.fixIndex(e),r=this.segments.splice(t,1)[0],n=r.previousSegment,i=r.nextSegment;return n&&(n.nextSegment=i),i&&(i.previousSegment=n),r.isSubpathStart&&i&&this.updateSubpathStartSegment(i),r}replaceSegment(e,t){const r=this.fixIndex(e);let n;const i=this.segments[r];let o=i.previousSegment;const a=i.nextSegment;let s=i.isSubpathStart;if(Array.isArray(t)){this.segments.splice(e,1);for(let r=0,i=t.length;r<i;r+=1){const i=t[r];n=this.prepareSegment(i,o,a),this.segments.splice(e+r,0,n),o=n,s&&n.isSubpathStart&&(s=!1)}}else n=this.prepareSegment(t,o,a),this.segments.splice(r,1,n),s&&n.isSubpathStart&&(s=!1);s&&a&&this.updateSubpathStartSegment(a)}getSegment(e){const t=this.fixIndex(e);return this.segments[t]}fixIndex(e){const t=this.segments.length;if(0===t)throw new Error("Path has no segments.");let r=e;for(;r<0;)r=t+r;if(r>=t||r<0)throw new Error("Index out of range.");return r}segmentAt(e,t={}){const r=this.segmentIndexAt(e,t);return r?this.getSegment(r):null}segmentAtLength(e,t={}){const r=this.segmentIndexAtLength(e,t);return r?this.getSegment(r):null}segmentIndexAt(e,t={}){if(0===this.segments.length)return null;const r=GeometryUtil.clamp(e,0,1),n=this.getOptions(t),i=this.length(n)*r;return this.segmentIndexAtLength(i,n)}segmentIndexAtLength(e,t={}){const r=this.segments.length;if(0===r)return null;let n=!0;e<0&&(n=!1,e=-e);const i=this.getPrecision(t),o=this.getSubdivisions(t);let a=0,s=null;for(let l=0;l<r;l+=1){const t=n?l:r-1-l,c=this.segments[t],u=o[t],d=c.length({precision:i,subdivisions:u});if(c.isVisible){if(e<=a+d)return t;s=t}a+=d}return s}getSegmentSubdivisions(e={}){const t=this.getPrecision(e),r=[];for(let n=0,i=this.segments.length;n<i;n+=1){const e=this.segments[n].getSubdivisions({precision:t});r.push(e)}return r}updateSubpathStartSegment(e){let t=e.previousSegment,r=e;for(;r&&!r.isSubpathStart;)r.subpathStartSegment=null!=t?t.subpathStartSegment:null,t=r,r=r.nextSegment}prepareSegment(e,t,r){e.previousSegment=t,e.nextSegment=r,null!=t&&(t.nextSegment=e),null!=r&&(r.previousSegment=e);let n=e;return e.isSubpathStart&&(e.subpathStartSegment=e,n=r),null!=n&&this.updateSubpathStartSegment(n),e}closestPoint(e,t={}){const r=this.closestPointT(e,t);return r?this.pointAtT(r):null}closestPointLength(e,t={}){const r=this.getOptions(t),n=this.closestPointT(e,r);return n?this.lengthAtT(n,r):0}closestPointNormalizedLength(e,t={}){const r=this.getOptions(t),n=this.closestPointLength(e,r);if(0===n)return 0;const i=this.length(r);return 0===i?0:n/i}closestPointT(e,t={}){if(0===this.segments.length)return null;const r=this.getPrecision(t),n=this.getSubdivisions(t);let i,o=1/0;for(let a=0,s=this.segments.length;a<s;a+=1){const t=this.segments[a],s=n[a];if(t.isVisible){const n=t.closestPointT(e,{precision:r,subdivisions:s}),l=t.pointAtT(n),c=GeometryUtil.squaredLength(l,e);c<o&&(i={segmentIndex:a,value:n},o=c)}}return i||{segmentIndex:this.segments.length-1,value:1}}closestPointTangent(e,t={}){if(0===this.segments.length)return null;const r=this.getPrecision(t),n=this.getSubdivisions(t);let i,o=1/0;for(let a=0,s=this.segments.length;a<s;a+=1){const t=this.segments[a],s=n[a];if(t.isDifferentiable()){const n=t.closestPointT(e,{precision:r,subdivisions:s}),a=t.pointAtT(n),l=GeometryUtil.squaredLength(a,e);l<o&&(i=t.tangentAtT(n),o=l)}}return i||null}containsPoint(e,t={}){const r=this.toPolylines(t);if(!r)return!1;let n=0;for(let i=0,o=r.length;i<o;i+=1){r[i].containsPoint(e)&&(n+=1)}return n%2==1}pointAt(e,t={}){if(0===this.segments.length)return null;if(e<=0)return this.start.clone();if(e>=1)return this.end.clone();const r=this.getOptions(t),n=this.length(r)*e;return this.pointAtLength(n,r)}pointAtLength(e,t={}){if(0===this.segments.length)return null;if(0===e)return this.start.clone();let r=!0;e<0&&(r=!1,e=-e);const n=this.getPrecision(t),i=this.getSubdivisions(t);let o,a=0;for(let s=0,l=this.segments.length;s<l;s+=1){const t=r?s:l-1-s,c=this.segments[t],u=i[t],d=c.length({precision:n,subdivisions:u});if(c.isVisible){if(e<=a+d)return c.pointAtLength((r?1:-1)*(e-a),{precision:n,subdivisions:u});o=c}a+=d}if(o)return r?o.end:o.start;return this.segments[this.segments.length-1].end.clone()}pointAtT(e){const t=this.segments,r=t.length;if(0===r)return null;const n=e.segmentIndex;if(n<0)return t[0].pointAtT(0);if(n>=r)return t[r-1].pointAtT(1);const i=GeometryUtil.clamp(e.value,0,1);return t[n].pointAtT(i)}divideAt(e,t={}){if(0===this.segments.length)return null;const r=GeometryUtil.clamp(e,0,1),n=this.getOptions(t),i=this.length(n)*r;return this.divideAtLength(i,n)}divideAtLength(e,t={}){if(0===this.segments.length)return null;let r=!0;e<0&&(r=!1,e=-e);const n=this.getPrecision(t),i=this.getSubdivisions(t);let o,a,s,l,c,u=0;for(let y=0,b=this.segments.length;y<b;y+=1){const t=r?y:b-1-y,c=this.getSegment(t),d={precision:n,subdivisions:i[t]},p=c.length(d);if(c.isDifferentiable()&&(s=c,l=t,e<=u+p)){a=t,o=c.divideAtLength((r?1:-1)*(e-u),d);break}u+=p}if(!s)return null;o||(a=l,c=r?1:0,o=s.divideAtT(c));const d=this.clone(),p=a;d.replaceSegment(p,o);const h=p;let f=p+1,g=p+2;o[0].isDifferentiable()||(d.removeSegment(h),f-=1,g-=1);const m=d.getSegment(f).start;d.insertSegment(f,Path.createSegment("M",m)),g+=1,o[1].isDifferentiable()||(d.removeSegment(g-1),g-=1);const v=g-h-1;for(let y=g,b=d.segments.length;y<b;y+=1){const e=this.getSegment(y-v),t=d.getSegment(y);if("Z"===t.type&&!e.subpathStartSegment.end.equals(t.subpathStartSegment.end)){const t=Path.createSegment("L",e.end);d.replaceSegment(y,t)}}return[new Path(d.segments.slice(0,f)),new Path(d.segments.slice(f))]}intersectsWithLine(e,t={}){const r=this.toPolylines(t);if(null==r)return null;let n=null;for(let i=0,o=r.length;i<o;i+=1){const t=r[i],o=e.intersect(t);o&&(null==n&&(n=[]),Array.isArray(o)?n.push(...o):n.push(o))}return n}isDifferentiable(){for(let e=0,t=this.segments.length;e<t;e+=1){if(this.segments[e].isDifferentiable())return!0}return!1}isValid(){const e=this.segments;return 0===e.length||"M"===e[0].type}length(e={}){if(0===this.segments.length)return 0;const t=this.getSubdivisions(e);let r=0;for(let n=0,i=this.segments.length;n<i;n+=1){const e=this.segments[n],i=t[n];r+=e.length({subdivisions:i})}return r}lengthAtT(e,t={}){const r=this.segments.length;if(0===r)return 0;let n=e.segmentIndex;if(n<0)return 0;let i=GeometryUtil.clamp(e.value,0,1);n>=r&&(n=r-1,i=1);const o=this.getPrecision(t),a=this.getSubdivisions(t);let s=0;for(let u=0;u<n;u+=1){const e=this.segments[u],t=a[u];s+=e.length({precision:o,subdivisions:t})}const l=this.segments[n],c=a[n];return s+=l.lengthAtT(i,{precision:o,subdivisions:c}),s}tangentAt(e,t={}){if(0===this.segments.length)return null;const r=GeometryUtil.clamp(e,0,1),n=this.getOptions(t),i=this.length(n)*r;return this.tangentAtLength(i,n)}tangentAtLength(e,t={}){if(0===this.segments.length)return null;let r=!0;e<0&&(r=!1,e=-e);const n=this.getPrecision(t),i=this.getSubdivisions(t);let o,a=0;for(let s=0,l=this.segments.length;s<l;s+=1){const t=r?s:l-1-s,c=this.segments[t],u=i[t],d=c.length({precision:n,subdivisions:u});if(c.isDifferentiable()){if(e<=a+d)return c.tangentAtLength((r?1:-1)*(e-a),{precision:n,subdivisions:u});o=c}a+=d}if(o){const e=r?1:0;return o.tangentAtT(e)}return null}tangentAtT(e){const t=this.segments.length;if(0===t)return null;const r=e.segmentIndex;if(r<0)return this.segments[0].tangentAtT(0);if(r>=t)return this.segments[t-1].tangentAtT(1);const n=GeometryUtil.clamp(e.value,0,1);return this.segments[r].tangentAtT(n)}getPrecision(e={}){return null==e.precision?this.PRECISION:e.precision}getSubdivisions(e={}){if(null==e.segmentSubdivisions){const t=this.getPrecision(e);return this.getSegmentSubdivisions({precision:t})}return e.segmentSubdivisions}getOptions(e={}){return{precision:this.getPrecision(e),segmentSubdivisions:this.getSubdivisions(e)}}toPoints(e={}){const t=this.segments,r=t.length;if(0===r)return null;const n=this.getSubdivisions(e),i=[];let o=[];for(let a=0;a<r;a+=1){const e=t[a];if(e.isVisible){const t=n[a];t.length>0?t.forEach(e=>o.push(e.start)):o.push(e.start)}else o.length>0&&(o.push(t[a-1].end),i.push(o),o=[])}return o.length>0&&(o.push(this.end),i.push(o)),i}toPolylines(e={}){const t=this.toPoints(e);return t?t.map(e=>new Polyline(e)):null}scale(e,t,r){return this.segments.forEach(n=>n.scale(e,t,r)),this}rotate(e,t){return this.segments.forEach(r=>r.rotate(e,t)),this}translate(e,t){return"number"==typeof e?this.segments.forEach(r=>r.translate(e,t)):this.segments.forEach(t=>t.translate(e)),this}clone(){const e=new Path;return this.segments.forEach(t=>e.appendSegment(t.clone())),e}equals(e){if(null==e)return!1;const t=this.segments,r=e.segments,n=t.length;if(r.length!==n)return!1;for(let i=0;i<n;i+=1){const e=t[i],n=r[i];if(e.type!==n.type||!e.equals(n))return!1}return!0}toJSON(){return this.segments.map(e=>e.toJSON())}serialize(){if(!this.isValid())throw new Error("Invalid path segments.");return this.segments.map(e=>e.serialize()).join(" ")}toString(){return this.serialize()}}Path2=Path||(Path={}),Path2.isPath=function(e){return null!=e&&e instanceof Path2},function(e){function t(e,...t){if("M"===e)return MoveTo.create.call(null,...t);if("L"===e)return LineTo.create.call(null,...t);if("C"===e)return CurveTo.create.call(null,...t);if("z"===e||"Z"===e)return Close.create();throw new Error(`Invalid path segment type "${e}"`)}e.parse=function(r){if(!r)return new e;const n=new e,i=e.normalize(r).match(/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g);if(null!=i)for(let e=0,o=i.length;e<o;e+=1){const r=/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g,o=i[e].match(r);if(null!=o){const e=o[0],r=o.slice(1).map(e=>+e),i=t.call(null,e,...r);n.appendSegment(i)}}return n},e.createSegment=t}(Path||(Path={})),function(e){e.normalize=normalizePathData,e.isValid=isValid,e.drawArc=drawArc,e.drawPoints=drawPoints,e.arcToCurves=arcToCurves}(Path||(Path={}));class Registry{constructor(e){this.options=Object.assign({},e),this.data=this.options.data||{},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this)}get names(){return Object.keys(this.data)}register(e,t,r=!1){if("object"==typeof e)return void Object.entries(e).forEach(([e,r])=>{this.register(e,r,t)});!this.exist(e)||r||Platform.isApplyingHMR()||this.onDuplicated(e);const n=this.options.process,i=n?call$1(n,this,e,t):t;return this.data[e]=i,i}unregister(e){const t=e?this.data[e]:null;return delete this.data[e],t}get(e){return e?this.data[e]:null}exist(e){return!!e&&null!=this.data[e]}onDuplicated(e){try{throw this.options.onConflict&&call$1(this.options.onConflict,this,e),new Error(`${upperFirst(this.options.type)} with name '${e}' already registered.`)}catch(err){throw err}}onNotFound(e,t){throw new Error(this.getSpellingSuggestion(e,t))}getSpellingSuggestion(e,t){const r=this.getSpellingSuggestionForName(e),n=t?`${t} ${lowerFirst(this.options.type)}`:this.options.type;return`${upperFirst(n)} with name '${e}' does not exist.${r?` Did you mean '${r}'?`:""}`}getSpellingSuggestionForName(e){return getSpellingSuggestion(e,Object.keys(this.data),e=>e)}}Registry2=Registry||(Registry={}),Registry2.create=function(e){return new Registry2(e)};const dot$2={color:"#aaaaaa",thickness:1,markup:"rect",update(e,t){const r=t.thickness*t.sx,n=t.thickness*t.sy;attr(e,{width:r,height:n,rx:r,ry:n,fill:t.color})}},fixedDot={color:"#aaaaaa",thickness:1,markup:"rect",update(e,t){const r=t.sx<=1?t.thickness*t.sx:t.thickness;attr(e,{width:r,height:r,rx:r,ry:r,fill:t.color})}},mesh={color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(e,t){let r;const n=t.width,i=t.height,o=t.thickness;r=n-o>=0&&i-o>=0?["M",n,0,"H0 M0 0 V0",i].join(" "):"M 0 0 0 0",attr(e,{d:r,stroke:t.color,"stroke-width":t.thickness})}},doubleMesh=[{color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(e,t){let r;const n=t.width,i=t.height,o=t.thickness;r=n-o>=0&&i-o>=0?["M",n,0,"H0 M0 0 V0",i].join(" "):"M 0 0 0 0",attr(e,{d:r,stroke:t.color,"stroke-width":t.thickness})}},{color:"rgba(224,224,224,0.2)",thickness:3,factor:4,markup:"path",update(e,t){let r;const n=t.factor||1,i=t.width*n,o=t.height*n,a=t.thickness;r=i-a>=0&&o-a>=0?["M",i,0,"H0 M0 0 V0",o].join(" "):"M 0 0 0 0",t.width=i,t.height=o,attr(e,{d:r,stroke:t.color,"stroke-width":t.thickness})}}],patterns$1=Object.freeze(Object.defineProperty({__proto__:null,dot:dot$2,doubleMesh:doubleMesh,fixedDot:fixedDot,mesh:mesh},Symbol.toStringTag,{value:"Module"}));class Grid{constructor(){this.patterns={},this.root=Vector.create(createSvgDocument(),{width:"100%",height:"100%"},[createSvgElement("defs")]).node}add(e,t){const r=this.root.childNodes[0];r&&r.appendChild(t),this.patterns[e]=t,Vector.create("rect",{width:"100%",height:"100%",fill:`url(#${e})`}).appendTo(this.root)}get(e){return this.patterns[e]}has(e){return null!=this.patterns[e]}}var Grid2;Grid2=Grid||(Grid={}),Grid2.presets=patterns$1,Grid2.registry=Registry.create({type:"grid"}),Grid2.registry.register(Grid2.presets,!0);const flipX=function(e){const t=document.createElement("canvas"),r=e.width,n=e.height;t.width=2*r,t.height=n;const i=t.getContext("2d");return i.drawImage(e,0,0,r,n),i.translate(2*r,0),i.scale(-1,1),i.drawImage(e,0,0,r,n),t},flipY=function(e){const t=document.createElement("canvas"),r=e.width,n=e.height;t.width=r,t.height=2*n;const i=t.getContext("2d");return i.drawImage(e,0,0,r,n),i.translate(0,2*n),i.scale(1,-1),i.drawImage(e,0,0,r,n),t},flipXY=function(e){const t=document.createElement("canvas"),r=e.width,n=e.height;t.width=2*r,t.height=2*n;const i=t.getContext("2d");return i.drawImage(e,0,0,r,n),i.setTransform(-1,0,0,-1,t.width,t.height),i.drawImage(e,0,0,r,n),i.setTransform(-1,0,0,1,t.width,0),i.drawImage(e,0,0,r,n),i.setTransform(1,0,0,-1,0,t.height),i.drawImage(e,0,0,r,n),t},watermark=function(e,t){const r=e.width,n=e.height,i=document.createElement("canvas");i.width=3*r,i.height=3*n;const o=i.getContext("2d"),a=null!=t.angle?-t.angle:-20,s=Angle.toRad(a),l=i.width/4,c=i.height/4;for(let u=0;u<4;u+=1)for(let t=0;t<4;t+=1)(u+t)%2>0&&(o.setTransform(1,0,0,1,(2*u-1)*l,(2*t-1)*c),o.rotate(s),o.drawImage(e,-r/2,-n/2,r,n));return i},patterns=Object.freeze(Object.defineProperty({__proto__:null,flipX:flipX,flipXY:flipXY,flipY:flipY,watermark:watermark},Symbol.toStringTag,{value:"Module"}));var Background,Background2;function getString(e,t){return null!=e?e:t}function getNumber(e,t){return null!=e&&Number.isFinite(e)?e:t}function outline(e={}){const t=getString(e.color,"blue"),r=getNumber(e.width,1),n=getNumber(e.margin,2);return`\n <filter>\n <feFlood flood-color="${t}" flood-opacity="${getNumber(e.opacity,1)}" result="colored"/>\n <feMorphology in="SourceAlpha" result="morphedOuter" operator="dilate" radius="${n+r}" />\n <feMorphology in="SourceAlpha" result="morphedInner" operator="dilate" radius="${n}" />\n <feComposite result="morphedOuterColored" in="colored" in2="morphedOuter" operator="in"/>\n <feComposite operator="xor" in="morphedOuterColored" in2="morphedInner" result="outline"/>\n <feMerge>\n <feMergeNode in="outline"/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>\n `.trim()}function highlight$2(e={}){const t=getString(e.color,"red"),r=getNumber(e.blur,0),n=getNumber(e.width,1);return`\n <filter>\n <feFlood flood-color="${t}" flood-opacity="${getNumber(e.opacity,1)}" result="colored"/>\n <feMorphology result="morphed" in="SourceGraphic" operator="dilate" radius="${n}"/>\n <feComposite result="composed" in="colored" in2="morphed" operator="in"/>\n <feGaussianBlur result="blured" in="composed" stdDeviation="${r}"/>\n <feBlend in="SourceGraphic" in2="blured" mode="normal"/>\n </filter>\n `.trim()}function blur(e={}){const t=getNumber(e.x,2);return`\n <filter>\n <feGaussianBlur stdDeviation="${null!=e.y&&Number.isFinite(e.y)?[t,e.y]:t}"/>\n </filter>\n `.trim()}function dropShadow(e={}){const t=getNumber(e.dx,0),r=getNumber(e.dy,0),n=getString(e.color,"black"),i=getNumber(e.blur,4),o=getNumber(e.opacity,1);return"SVGFEDropShadowElement"in window?`<filter>\n <feDropShadow stdDeviation="${i}" dx="${t}" dy="${r}" flood-color="${n}" flood-opacity="${o}" />\n </filter>`.trim():`<filter>\n <feGaussianBlur in="SourceAlpha" stdDeviation="${i}" />\n <feOffset dx="${t}" dy="${r}" result="offsetblur" />\n <feFlood flood-color="${n}" />\n <feComposite in2="offsetblur" operator="in" />\n <feComponentTransfer>\n <feFuncA type="linear" slope="${o}" />\n </feComponentTransfer>\n <feMerge>\n <feMergeNode/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>`.trim()}function grayScale(e={}){const t=getNumber(e.amount,1),r=.7152-.7152*(1-t);return`\n <filter>\n <feColorMatrix type="matrix" values="${.2126+.7874*(1-t)} ${r} ${.0722-.0722*(1-t)} 0 0 ${.2126-.2126*(1-t)} ${.7152+.2848*(1-t)} ${.0722-.0722*(1-t)} 0 0 ${.2126-.2126*(1-t)} ${r} ${.0722+.9278*(1-t)} 0 0 0 0 0 1 0"/>\n </filter>\n `.trim()}function sepia(e={}){const t=getNumber(e.amount,1);return`\n <filter>\n <feColorMatrix type="matrix" values="${.393+.607*(1-t)} ${.769-.769*(1-t)} ${.189-.189*(1-t)} 0 0 ${.349-.349*(1-t)} ${.686+.314*(1-t)} ${.168-.168*(1-t)} 0 0 ${.272-.272*(1-t)} ${.534-.534*(1-t)} ${.131+.869*(1-t)} 0 0 0 0 0 1 0"/>\n </filter>\n `.trim()}function saturate(e={}){return`\n <filter>\n <feColorMatrix type="saturate" values="${1-getNumber(e.amount,1)}"/>\n </filter>\n `.trim()}function hueRotate(e={}){return`\n <filter>\n <feColorMatrix type="hueRotate" values="${getNumber(e.angle,0)}"/>\n </filter>\n `.trim()}function invert(e={}){const t=getNumber(e.amount,1),r=1-t;return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="table" tableValues="${t} ${r}"/>\n <feFuncG type="table" tableValues="${t} ${r}"/>\n <feFuncB type="table" tableValues="${t} ${r}"/>\n </feComponentTransfer>\n </filter>\n `.trim()}function brightness(e={}){const t=getNumber(e.amount,1);return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="linear" slope="${t}"/>\n <feFuncG type="linear" slope="${t}"/>\n <feFuncB type="linear" slope="${t}"/>\n </feComponentTransfer>\n </filter>\n `.trim()}function contrast(e={}){const t=getNumber(e.amount,1),r=.5-t/2;return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="linear" slope="${t}" intercept="${r}"/>\n <feFuncG type="linear" slope="${t}" intercept="${r}"/>\n <feFuncB type="linear" slope="${t}" intercept="${r}"/>\n </feComponentTransfer>\n </filter>\n `.trim()}Background2=Background||(Background={}),Background2.presets=Object.assign({},patterns),Background2.presets["flip-x"]=flipX,Background2.presets["flip-y"]=flipY,Background2.presets["flip-xy"]=flipXY,Background2.registry=Registry.create({type:"background pattern"}),Background2.registry.register(Background2.presets,!0);const filters=Object.freeze(Object.defineProperty({__proto__:null,blur:blur,brightness:brightness,contrast:contrast,dropShadow:dropShadow,grayScale:grayScale,highlight:highlight$2,hueRotate:hueRotate,invert:invert,outline:outline,saturate:saturate,sepia:sepia},Symbol.toStringTag,{value:"Module"}));var Filter,Filter2;Filter2=Filter||(Filter={}),Filter2.presets=filters,Filter2.registry=Registry.create({type:"filter"}),Filter2.registry.register(Filter2.presets,!0);const raw={xlinkHref:"xlink:href",xlinkShow:"xlink:show",xlinkRole:"xlink:role",xlinkType:"xlink:type",xlinkArcrole:"xlink:arcrole",xlinkTitle:"xlink:title",xlinkActuate:"xlink:actuate",xmlSpace:"xml:space",xmlBase:"xml:base",xmlLang:"xml:lang",preserveAspectRatio:"preserveAspectRatio",requiredExtension:"requiredExtension",requiredFeatures:"requiredFeatures",systemLanguage:"systemLanguage",externalResourcesRequired:"externalResourceRequired"},ref={},refX={position:positionWrapper("x","width","origin")},refY={position:positionWrapper("y","height","origin")},refDx={position:positionWrapper("x","width","corner")},refDy={position:positionWrapper("y","height","corner")},refWidth={set:setWrapper("width","width")},refHeight={set:setWrapper("height","height")},refRx={set:setWrapper("rx","width")},refRy={set:setWrapper("ry","height")},refRInscribed={set:(e=>{const t=setWrapper("r","width"),r=setWrapper("r","height");return function(e,n){const i=n.refBBox;return call$1(i.height>i.width?t:r,this,e,n)}})()},refRCircumscribed={set(e,{refBBox:t}){let r=parseFloat(e);const n=isPercentage(e);n&&(r/=100);const i=Math.sqrt(t.height*t.height+t.width*t.width);let o;return Number.isFinite(r)&&(o=n||r>=0&&r<=1?r*i:Math.max(r+i,0)),{r:o}}},refCx={set:setWrapper("cx","width")},refCy={set:setWrapper("cy","height")},refDResetOffset={set:dWrapper({resetOffset:!0})},refDKeepOffset={set:dWrapper({resetOffset:!1})},refPointsResetOffset={set:pointsWrapper({resetOffset:!0})},refPointsKeepOffset={set:pointsWrapper({resetOffset:!1})},refR=refRInscribed,refD=refDResetOffset,refPoints=refPointsResetOffset,refX2=refX,refY2=refY,refWidth2=refWidth,refHeight2=refHeight;function positionWrapper(e,t,r){return(n,{refBBox:i})=>{if(null==n)return null;let o=parseFloat(n);const a=isPercentage(n);let s;if(a&&(o/=100),Number.isFinite(o)){const n=i[r];s=a||o>0&&o<1?n[e]+i[t]*o:n[e]+o}const l=new Point;return l[e]=s||0,l}}function setWrapper(e,t){return function(r,{refBBox:n}){let i=parseFloat(r);const o=isPercentage(r);o&&(i/=100);const a={};if(Number.isFinite(i)){const r=o||i>=0&&i<=1?i*n[t]:Math.max(i+n[t],0);a[e]=r}return a}}function shapeWrapper(e,t){const r="x6-shape",n=t&&t.resetOffset;return function(t,{elem:i,refBBox:o}){let a=data$2(i,r);if(!a||a.value!==t){const n=e(t);a={value:t,shape:n,shapeBBox:n.bbox()},data$2(i,r,a)}const s=a.shape.clone(),l=a.shapeBBox.clone(),c=l.getOrigin(),u=o.getOrigin();l.x=u.x,l.y=u.y;const d=o.getMaxScaleToFit(l,u),p=0===l.width||0===o.width?1:d.sx,h=0===l.height||0===o.height?1:d.sy;return s.scale(p,h,c),n&&s.translate(-c.x,-c.y),s}}function dWrapper(e){const t=shapeWrapper(function(e){return Path.parse(e)},e);return(e,r)=>({d:t(e,r).serialize()})}function pointsWrapper(e){const t=shapeWrapper(e=>new Polyline(e),e);return(e,r)=>({points:t(e,r).serialize()})}const fill={qualify:isPlainObject,set:(e,{view:t})=>`url(#${t.graph.defineGradient(e)})`},stroke$1={qualify:isPlainObject,set(e,{view:t}){const r=t.cell,n=Object.assign({},e);if(r.isEdge()&&"linearGradient"===n.type){const e=t,i=e.sourcePoint,o=e.targetPoint;n.id=`gradient-${n.type}-${r.id}`,n.attrs=Object.assign(Object.assign({},n.attrs),{x1:i.x,y1:i.y,x2:o.x,y2:o.y,gradientUnits:"userSpaceOnUse"}),t.graph.defs.remove(n.id)}return`url(#${t.graph.defineGradient(n)})`}},text={qualify:(e,{attrs:t})=>null==t.textWrap||!isPlainObject(t.textWrap),set(e,{view:t,elem:r,attrs:n}){const i="x6-text",o=data$2(r,i),a=e=>{try{return JSON.parse(e)}catch(t){return e}},s={x:n.x,eol:n.eol,annotations:a(n.annotations),textPath:a(n["text-path"]||n.textPath),textVerticalAnchor:n["text-vertical-anchor"]||n.textVerticalAnchor,displayEmpty:"true"===(n["display-empty"]||n.displayEmpty),lineHeight:n["line-height"]||n.lineHeight},l=n["font-size"]||n.fontSize,c=JSON.stringify([e,s]);if(l&&r.setAttribute("font-size",l),null==o||o!==c){const n=s.textPath;if(null!=n&&"object"==typeof n){const e=n.selector;if("string"==typeof e){const r=t.find(e)[0];r instanceof SVGPathElement&&(ensureId(r),s.textPath=Object.assign({"xlink:href":`#${r.id}`},n))}}text$1(r,`${e}`,s),data$2(r,i,c)}}},textWrap={qualify:isPlainObject,set(e,{view:t,elem:r,attrs:n,refBBox:i}){const o=e,a=o.width||0;isPercentage(a)?i.width*=parseFloat(a)/100:a<=0?i.width+=a:i.width=a;const s=o.height||0;let l;isPercentage(s)?i.height*=parseFloat(s)/100:s<=0?i.height+=s:i.height=s;let c=o.text;null==c&&(c=n.text||(null==r?void 0:r.textContent)),l=null!=c?breakText(`${c}`,i,{"font-weight":n["font-weight"]||n.fontWeight,"font-size":n["font-size"]||n.fontSize,"font-family":n["font-family"]||n.fontFamily,lineHeight:n.lineHeight},{ellipsis:o.ellipsis}):"",call$1(text.set,this,l,{view:t,elem:r,attrs:n,refBBox:i,cell:t.cell})}},isTextInUse=(e,{attrs:t})=>void 0!==t.text,lineHeight={qualify:isTextInUse},textVerticalAnchor={qualify:isTextInUse},textPath={qualify:isTextInUse},annotations={qualify:isTextInUse},eol={qualify:isTextInUse},displayEmpty={qualify:isTextInUse},title={qualify:(e,{elem:t})=>t instanceof SVGElement,set(e,{elem:t}){const r="x6-title",n=`${e}`,i=data$2(t,r);if(null==i||i!==n){data$2(t,r,n);const e=t.firstChild;if(e&&"TITLE"===e.tagName.toUpperCase()){e.textContent=n}else{const r=document.createElementNS(t.namespaceURI,"title");r.textContent=n,t.insertBefore(r,e)}}}},xAlign={offset:offsetWrapper("x","width","right")},yAlign={offset:offsetWrapper("y","height","bottom")},resetOffset={offset:(e,{refBBox:t})=>e?{x:-t.x,y:-t.y}:{x:0,y:0}};function offsetWrapper(e,t,r){return(n,{refBBox:i})=>{const o=new Point;let a;return a="middle"===n?i[t]/2:n===r?i[t]:"number"==typeof n&&Number.isFinite(n)?n>-1&&n<1?-i[t]*n:-n:isPercentage(n)?i[t]*parseFloat(n)/100:0,o[e]=-(i[e]+a),o}}const style$1={qualify:isPlainObject,set(e,{elem:t}){css$3(t,e)}},html$4={set(e,{elem:t}){t.innerHTML=`${e}`}},filter={qualify:isPlainObject,set:(e,{view:t})=>`url(#${t.graph.defineFilter(e)})`},port={set:e=>null!=e&&"object"==typeof e&&e.id?e.id:e};function normalize$4(e,t,r){let n,i;"object"==typeof t?(n=t.x,i=t.y):(n=t,i=r);const o=Path.parse(e),a=o.bbox();if(a){let e=-a.height/2-a.y,t=-a.width/2-a.x;"number"==typeof n&&(t-=n),"number"==typeof i&&(e-=i),o.translate(t,e)}return o.serialize()}var __rest$r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const block$1=e=>{var{size:t,width:r,height:n,offset:i,open:o}=e;return createClassicMarker({size:t,width:r,height:n,offset:i},!0===o,!0,void 0,__rest$r(e,["size","width","height","offset","open"]))},classic=e=>{var{size:t,width:r,height:n,offset:i,factor:o}=e;return createClassicMarker({size:t,width:r,height:n,offset:i},!1,!1,o,__rest$r(e,["size","width","height","offset","factor"]))};function createClassicMarker(e,t,r,n=3/4,i={}){const o=e.size||10,a=e.width||o,s=e.height||o,l=new Path,c={};if(t)l.moveTo(a,0).lineTo(0,s/2).lineTo(a,s),c.fill="none";else{if(l.moveTo(0,s/2),l.lineTo(a,0),!r){const e=clamp(n,0,1);l.lineTo(a*e,s/2)}l.lineTo(a,s),l.close()}return Object.assign(Object.assign(Object.assign({},c),i),{tagName:"path",d:normalize$4(l.serialize(),{x:null!=e.offset?e.offset:-a/2})})}var __rest$q=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const diamond=e=>{var{size:t,width:r,height:n,offset:i}=e,o=__rest$q(e,["size","width","height","offset"]);const a=t||10,s=r||a,l=n||a,c=new Path;return c.moveTo(0,l/2).lineTo(s/2,0).lineTo(s,l/2).lineTo(s/2,l).close(),Object.assign(Object.assign({},o),{tagName:"path",d:normalize$4(c.serialize(),null==i?-s/2:i)})};var __rest$p=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const path=e=>{var{d:t,offsetX:r,offsetY:n}=e,i=__rest$p(e,["d","offsetX","offsetY"]);return Object.assign(Object.assign({},i),{tagName:"path",d:normalize$4(t,r,n)})};var __rest$o=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const cross=e=>{var{size:t,width:r,height:n,offset:i}=e,o=__rest$o(e,["size","width","height","offset"]);const a=t||10,s=r||a,l=n||a,c=new Path;return c.moveTo(0,0).lineTo(s,l).moveTo(0,l).lineTo(s,0),Object.assign(Object.assign({},o),{tagName:"path",fill:"none",d:normalize$4(c.serialize(),i||-s/2)})};var __rest$n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const async=e=>{var{width:t,height:r,offset:n,open:i,flip:o}=e,a=__rest$n(e,["width","height","offset","open","flip"]);let s=r||6;const l=t||10,c=!0===i,u=!0===o,d=Object.assign(Object.assign({},a),{tagName:"path"});u&&(s=-s);const p=new Path;return p.moveTo(0,s).lineTo(l,0),c?d.fill="none":(p.lineTo(l,s),p.close()),d.d=normalize$4(p.serialize(),{x:n||-l/2,y:s/2}),d};var __rest$m=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const circle=e=>{var{r:t}=e,r=__rest$m(e,["r"]);const n=t||5;return Object.assign(Object.assign({cx:n},r),{tagName:"circle",r:n})},circlePlus=e=>{var{r:t}=e,r=__rest$m(e,["r"]);const n=t||5,i=new Path;return i.moveTo(n,0).lineTo(n,2*n),i.moveTo(0,n).lineTo(2*n,n),{children:[Object.assign(Object.assign({},circle({r:n})),{fill:"none"}),Object.assign(Object.assign({},r),{tagName:"path",d:normalize$4(i.serialize(),-n)})]}};var __rest$l=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const ellipse$1=e=>{var{rx:t,ry:r}=e,n=__rest$l(e,["rx","ry"]);const i=t||5,o=r||5;return Object.assign(Object.assign({cx:i},n),{tagName:"ellipse",rx:i,ry:o})},markers=Object.freeze(Object.defineProperty({__proto__:null,async:async,block:block$1,circle:circle,circlePlus:circlePlus,classic:classic,cross:cross,diamond:diamond,ellipse:ellipse$1,path:path},Symbol.toStringTag,{value:"Module"}));var Marker,Marker2;Marker2=Marker||(Marker={}),Marker2.presets=markers,Marker2.registry=Registry.create({type:"marker"}),Marker2.registry.register(Marker2.presets,!0),function(e){e.normalize=normalize$4}(Marker||(Marker={}));var __rest$k=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};function qualify(e){return"string"==typeof e||isPlainObject(e)}const sourceMarker={qualify:qualify,set:(e,{view:t,attrs:r})=>createMarker("marker-start",e,t,r)},targetMarker={qualify:qualify,set:(e,{view:t,attrs:r})=>createMarker("marker-end",e,t,r,{transform:"rotate(180)"})},vertexMarker={qualify:qualify,set:(e,{view:t,attrs:r})=>createMarker("marker-mid",e,t,r)};function createMarker(e,t,r,n,i={}){const o="string"==typeof t?{name:t}:t,{name:a,args:s}=o,l=__rest$k(o,["name","args"]);let c=l;if(a&&"string"==typeof a){const e=Marker.registry.get(a);if(!e)return Marker.registry.onNotFound(a);c=e(Object.assign(Object.assign({},l),s))}const u=Object.assign(Object.assign(Object.assign({},normalizeAttr(n,e)),i),c);return{[e]:`url(#${r.graph.defineMarker(u)})`}}function normalizeAttr(e,t){const r={},n=e.stroke;"string"==typeof n&&(r.stroke=n,r.fill=n);let i=e.strokeOpacity;if(null==i&&(i=e["stroke-opacity"]),null==i&&(i=e.opacity),null!=i&&(r["stroke-opacity"]=i,r["fill-opacity"]=i),"marker-mid"!==t){const n=parseFloat(e.strokeWidth||e["stroke-width"]);if(Number.isFinite(n)&&n>1){const e=Math.ceil(n/2);r.refX="marker-start"===t?e:-e}}return r}const isEdgeView=(e,{view:t})=>t.cell.isEdge(),connection={qualify:isEdgeView,set(e,t){var r,n,i,o;const a=t.view,s=e.reverse||!1,l=e.stubs||0;let c;if(Number.isFinite(l)&&0!==l)if(s){let e,t;const s=a.getConnectionLength()||0;l<0?(e=(s+l)/2,t=-l):(e=l,t=s-2*l);const u=a.getConnection();c=null===(o=null===(i=null===(n=null===(r=null==u?void 0:u.divideAtLength(e))||void 0===r?void 0:r[1])||void 0===n?void 0:n.divideAtLength(t))||void 0===i?void 0:i[0])||void 0===o?void 0:o.serialize()}else{let e;if(l<0){e=((a.getConnectionLength()||0)+l)/2}else e=l;const t=a.getConnection();if(t){const r=t.divideAtLength(e),n=t.divideAtLength(-e);r&&n&&(c=`${r[0].serialize()} ${n[1].serialize()}`)}}return{d:c||a.getConnectionPathData()}}},atConnectionLengthKeepGradient={qualify:isEdgeView,set:atConnectionWrapper("getTangentAtLength",{rotate:!0})},atConnectionLengthIgnoreGradient={qualify:isEdgeView,set:atConnectionWrapper("getTangentAtLength",{rotate:!1})},atConnectionRatioKeepGradient={qualify:isEdgeView,set:atConnectionWrapper("getTangentAtRatio",{rotate:!0})},atConnectionRatioIgnoreGradient={qualify:isEdgeView,set:atConnectionWrapper("getTangentAtRatio",{rotate:!1})},atConnectionLength=atConnectionLengthKeepGradient,atConnectionRatio=atConnectionRatioKeepGradient;function atConnectionWrapper(e,t){const r={x:1,y:0};return(n,i)=>{let o,a;const s=i.view,l=s[e](Number(n));return l?(a=t.rotate?l.vector().vectorAngle(r):0,o=l.start):(o=s.path.start,a=0),0===a?{transform:`translate(${o.x},${o.y}')`}:{transform:`translate(${o.x},${o.y}') rotate(${a})`}}}const attrs=Object.freeze(Object.defineProperty({__proto__:null,annotations:annotations,atConnectionLength:atConnectionLength,atConnectionLengthIgnoreGradient:atConnectionLengthIgnoreGradient,atConnectionLengthKeepGradient:atConnectionLengthKeepGradient,atConnectionRatio:atConnectionRatio,atConnectionRatioIgnoreGradient:atConnectionRatioIgnoreGradient,atConnectionRatioKeepGradient:atConnectionRatioKeepGradient,connection:connection,displayEmpty:displayEmpty,eol:eol,fill:fill,filter:filter,html:html$4,lineHeight:lineHeight,port:port,ref:ref,refCx:refCx,refCy:refCy,refD:refD,refDKeepOffset:refDKeepOffset,refDResetOffset:refDResetOffset,refDx:refDx,refDy:refDy,refHeight:refHeight,refHeight2:refHeight2,refPoints:refPoints,refPointsKeepOffset:refPointsKeepOffset,refPointsResetOffset:refPointsResetOffset,refR:refR,refRCircumscribed:refRCircumscribed,refRInscribed:refRInscribed,refRx:refRx,refRy:refRy,refWidth:refWidth,refWidth2:refWidth2,refX:refX,refX2:refX2,refY:refY,refY2:refY2,resetOffset:resetOffset,sourceMarker:sourceMarker,stroke:stroke$1,style:style$1,targetMarker:targetMarker,text:text,textPath:textPath,textVerticalAnchor:textVerticalAnchor,textWrap:textWrap,title:title,vertexMarker:vertexMarker,xAlign:xAlign,yAlign:yAlign},Symbol.toStringTag,{value:"Module"}));var Attr,Attr2;Attr2=Attr||(Attr={}),Attr2.isValidDefinition=function(e,t,r){if(null!=e){if("string"==typeof e)return!0;if("function"!=typeof e.qualify||call$1(e.qualify,this,t,r))return!0}return!1},function(e){e.presets=Object.assign(Object.assign({},raw),attrs),e.registry=Registry.create({type:"attribute definition"}),e.registry.register(e.presets,!0)}(Attr||(Attr={}));const Config={prefixCls:"x6",autoInsertCSS:!0,useCSSSelector:!0,prefix:e=>`${Config.prefixCls}-${e}`},defaultClassName=Config.prefix("highlighted"),className$1={highlight(e,t,r){addClass(t,r&&r.className||defaultClassName)},unhighlight(e,t,r){removeClass(t,r&&r.className||defaultClassName)}},className=Config.prefix("highlight-opacity"),opacity={highlight(e,t){addClass(t,className)},unhighlight(e,t){removeClass(t,className)}};var Util$1;!function(e){function t(e,t){const r=createSVGPoint(e.x,e.y).matrixTransform(t);return new Point(r.x,r.y)}function r(e,t){const r=createSvgElement("svg").createSVGPoint();r.x=e.x,r.y=e.y;const n=r.matrixTransform(t);r.x=e.x+e.width,r.y=e.y;const i=r.matrixTransform(t);r.x=e.x+e.width,r.y=e.y+e.height;const o=r.matrixTransform(t);r.x=e.x,r.y=e.y+e.height;const a=r.matrixTransform(t),s=Math.min(n.x,i.x,o.x,a.x),l=Math.max(n.x,i.x,o.x,a.x),c=Math.min(n.y,i.y,o.y,a.y),u=Math.max(n.y,i.y,o.y,a.y);return new Rectangle(s,c,l-s,u-c)}function n(e,t={}){let o;if(!e.ownerSVGElement||!isSVGGraphicsElement$1(e)){if(isHTMLElement(e)){const{left:t,top:r,width:n,height:o}=i(e);return new Rectangle(t,r,n,o)}return new Rectangle(0,0,0,0)}let a=t.target;if(!t.recursive){try{o=e.getBBox()}catch(e10){o={x:e.clientLeft,y:e.clientTop,width:e.clientWidth,height:e.clientHeight}}if(!a)return Rectangle.create(o);return r(o,getTransformToElement(e,a))}{const t=e.childNodes,r=t.length;if(0===r)return n(e,{target:a});a||(a=e);for(let e=0;e<r;e+=1){const r=t[e];let i;i=0===r.childNodes.length?n(r,{target:a}):n(r,{target:a,recursive:!0}),o=o?o.union(i):i}return o}}function i(e){let t=0,r=0,n=0,i=0;if(e){let o=e;for(;o;)t+=o.offsetLeft,r+=o.offsetTop,o=o.offsetParent,o&&(t+=parseInt(getComputedStyle$1(o,"borderLeft"),10),r+=parseInt(getComputedStyle$1(o,"borderTop"),10));n=e.offsetWidth,i=e.offsetHeight}return{left:t,top:r,width:n,height:i}}function o(e){const t=t=>{const r=e.getAttribute(t),n=r?parseFloat(r):0;return Number.isNaN(n)?0:n};switch(e instanceof SVGElement&&e.nodeName.toLowerCase()){case"rect":return new Rectangle(t("x"),t("y"),t("width"),t("height"));case"circle":return new Ellipse(t("cx"),t("cy"),t("r"),t("r"));case"ellipse":return new Ellipse(t("cx"),t("cy"),t("rx"),t("ry"));case"polyline":{const t=getPointsFromSvgElement(e);return new Polyline(t)}case"polygon":{const t=getPointsFromSvgElement(e);return t.length>1&&t.push(t[0]),new Polyline(t)}case"path":{let t=e.getAttribute("d");return Path.isValid(t)||(t=Path.normalize(t)),Path.parse(t)}case"line":return new Line(t("x1"),t("y1"),t("x2"),t("y2"))}return n(e)}function a(e){if(null==e)return null;let t=e;do{let e=t.tagName;if("string"!=typeof e)return null;if(e=e.toUpperCase(),hasClass(t,"x6-port"))t=t.nextElementSibling;else if("G"===e)t=t.firstElementChild;else{if("TITLE"!==e)break;t=t.nextElementSibling}}while(t);return t}e.normalizeMarker=normalize$4,e.transformPoint=t,e.transformLine=function(e,r){return new Line(t(e.start,r),t(e.end,r))},e.transformPolyline=function(e,r){let n=e instanceof Polyline?e.points:e;return Array.isArray(n)||(n=[]),new Polyline(n.map(e=>t(e,r)))},e.transformRectangle=r,e.bbox=function(e,t,n){let i;const o=e.ownerSVGElement;if(!o)return new Rectangle(0,0,0,0);try{i=e.getBBox()}catch(e10){i={x:e.clientLeft,y:e.clientTop,width:e.clientWidth,height:e.clientHeight}}return t?Rectangle.create(i):r(i,getTransformToElement(e,n||o))},e.getBBox=n,e.getBoundingOffsetRect=i,e.toGeometryShape=o,e.translateAndAutoOrient=function(e,t,r,i){const o=Point.create(t),a=Point.create(r);if(!i){i=e instanceof SVGSVGElement?e:e.ownerSVGElement}const s=scale(e);e.setAttribute("transform","");const l=n(e,{target:i}).scale(s.sx,s.sy),c=createSVGTransform();c.setTranslate(-l.x-l.width/2,-l.y-l.height/2);const u=createSVGTransform(),d=o.angleBetween(a,o.clone().translate(1,0));d&&u.setRotate(d,0,0);const p=createSVGTransform(),h=o.clone().move(a,l.width/2);p.setTranslate(2*o.x-h.x,2*o.y-h.y);const f=getTransformToElement(e,i),g=createSVGTransform();g.setMatrix(p.matrix.multiply(u.matrix.multiply(c.matrix.multiply(f.scale(s.sx,s.sy))))),e.setAttribute("transform",matrixToTransformString(g.matrix))},e.findShapeNode=a,e.getBBoxV2=function(e){const t=a(e);if(!isSVGGraphicsElement$1(t)){if(isHTMLElement(e)){const{left:t,top:r,width:n,height:o}=i(e);return new Rectangle(t,r,n,o)}return new Rectangle(0,0,0,0)}return o(t).bbox()||Rectangle.create()}}(Util$1||(Util$1={}));const defaultOptions={padding:3,rx:0,ry:0,attrs:{"stroke-width":3,stroke:"#FEB663"}},stroke={highlight(e,t,r){const n=Private$4.getHighlighterId(t,r);if(Private$4.hasCache(n))return;r=defaultsDeep({},r,defaultOptions);const i=Vector.create(t);let o,a;try{o=i.toPathData()}catch(u){a=Util$1.bbox(i.node,!0),o=rectToPathData(Object.assign(Object.assign({},r),a))}const s=createSvgElement("path");if(attr(s,Object.assign({d:o,"pointer-events":"none","vector-effect":"non-scaling-stroke",fill:"none"},r.attrs?kebablizeAttrs(r.attrs):null)),e.isEdgeElement(t))attr(s,"d",e.getConnectionPathData());else{let t=i.getTransformToElement(e.container);const n=r.padding;if(n){null==a&&(a=Util$1.bbox(i.node,!0));const e=a.x+a.width/2,r=a.y+a.height/2;a=Util$1.transformRectangle(a,t);const o=Math.max(a.width,1),s=Math.max(a.height,1),l=(o+n)/o,c=(s+n)/s,u=createSVGMatrix({a:l,b:0,c:0,d:c,e:e-l*e,f:r-c*r});t=t.multiply(u)}transform(s,t)}addClass(s,Config.prefix("highlight-stroke"));const l=e.cell,c=()=>Private$4.removeHighlighter(n);l.on("removed",c),l.model&&l.model.on("reseted",c),e.container.appendChild(s),Private$4.setCache(n,s)},unhighlight(e,t,r){Private$4.removeHighlighter(Private$4.getHighlighterId(t,r))}};var Private$4;!function(e){e.getHighlighterId=function(e,t){return ensureId(e),e.id+JSON.stringify(t)};const t={};e.setCache=function(e,r){t[e]=r},e.hasCache=function(e){return null!=t[e]},e.removeHighlighter=function(e){const r=t[e];r&&(remove(r),delete t[e])}}(Private$4||(Private$4={}));const highlighters=Object.freeze(Object.defineProperty({__proto__:null,className:className$1,opacity:opacity,stroke:stroke},Symbol.toStringTag,{value:"Module"}));var Highlighter,Highlighter2;function normalizePoint$1(e,t={}){return new Point(normalizePercentage(t.x,e.width),normalizePercentage(t.y,e.height))}function toResult$1(e,t,r){return Object.assign({angle:t,position:e.toJSON()},r)}Highlighter2=Highlighter||(Highlighter={}),Highlighter2.check=function(e,t){if("function"!=typeof t.highlight)throw new Error(`Highlighter '${e}' is missing required \`highlight()\` method`);if("function"!=typeof t.unhighlight)throw new Error(`Highlighter '${e}' is missing required \`unhighlight()\` method`)},function(e){e.presets=highlighters,e.registry=Registry.create({type:"highlighter"}),e.registry.register(e.presets,!0)}(Highlighter||(Highlighter={}));const absolute=(e,t)=>e.map(({x:e,y:r,angle:n})=>toResult$1(normalizePoint$1(t,{x:e,y:r}),n||0)),ellipse=(e,t,r)=>{const n=r.start||0,i=r.step||20;return ellipseLayout(e,t,n,(e,t)=>(e+.5-t/2)*i)},ellipseSpread=(e,t,r)=>{const n=r.start||0,i=r.step||360/e.length;return ellipseLayout(e,t,n,e=>e*i)};function ellipseLayout(e,t,r,n){const i=t.getCenter(),o=t.getTopCenter(),a=t.width/t.height,s=Ellipse.fromRect(t),l=e.length;return e.map((e,t)=>{const c=r+n(t,l),u=o.clone().rotate(-c,i).scale(a,1,i),d=e.compensateRotate?-s.tangentTheta(u):0;return(e.dx||e.dy)&&u.translate(e.dx||0,e.dy||0),e.dr&&u.move(i,e.dr),toResult$1(u.round(),d,e)})}var __rest$j=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const line=(e,t,r)=>lineLayout(e,normalizePoint$1(t,r.start||t.getOrigin()),normalizePoint$1(t,r.end||t.getCorner()),r),left$3=(e,t,r)=>lineLayout(e,t.getTopLeft(),t.getBottomLeft(),r),right$2=(e,t,r)=>lineLayout(e,t.getTopRight(),t.getBottomRight(),r),top$3=(e,t,r)=>lineLayout(e,t.getTopLeft(),t.getTopRight(),r),bottom$2=(e,t,r)=>lineLayout(e,t.getBottomLeft(),t.getBottomRight(),r);function lineLayout(e,t,r,n){const i=new Line(t,r),o=e.length;return e.map((e,t)=>{var{strict:r}=e,a=__rest$j(e,["strict"]);const s=r||n.strict?(t+1)/(o+1):(t+.5)/o,l=i.pointAt(s);return(a.dx||a.dy)&&l.translate(a.dx||0,a.dy||0),toResult$1(l.round(),0,a)})}const layouts$1=Object.freeze(Object.defineProperty({__proto__:null,absolute:absolute,bottom:bottom$2,ellipse:ellipse,ellipseSpread:ellipseSpread,left:left$3,line:line,right:right$2,top:top$3},Symbol.toStringTag,{value:"Module"}));var PortLayout,PortLayout2;PortLayout2=PortLayout||(PortLayout={}),PortLayout2.presets=layouts$1,PortLayout2.registry=Registry.create({type:"port layout"}),PortLayout2.registry.register(PortLayout2.presets,!0);const defaults$3={position:{x:0,y:0},angle:0,attrs:{".":{y:"0","text-anchor":"start"}}};function toResult(e,t){const{x:r,y:n,angle:i,attrs:o}=t||{};return defaultsDeep({},{angle:i,attrs:o,position:{x:r,y:n}},e,defaults$3)}const manual=(e,t,r)=>toResult({position:t.getTopLeft()},r),left$2=(e,t,r)=>toResult({position:{x:-15,y:0},attrs:{".":{y:".3em","text-anchor":"end"}}},r),right$1=(e,t,r)=>toResult({position:{x:15,y:0},attrs:{".":{y:".3em","text-anchor":"start"}}},r),top$2=(e,t,r)=>toResult({position:{x:0,y:-15},attrs:{".":{"text-anchor":"middle"}}},r),bottom$1=(e,t,r)=>toResult({position:{x:0,y:15},attrs:{".":{y:".6em","text-anchor":"middle"}}},r),outside=(e,t,r)=>outsideLayout(e,t,!1,r),outsideOriented=(e,t,r)=>outsideLayout(e,t,!0,r),inside=(e,t,r)=>insideLayout(e,t,!1,r),insideOriented=(e,t,r)=>insideLayout(e,t,!0,r);function outsideLayout(e,t,r,n){const i=null!=n.offset?n.offset:15,o=t.getCenter().theta(e),a=getBBoxAngles(t);let s,l,c,u,d=0;return o<a[1]||o>a[2]?(s=".3em",l=i,c=0,u="start"):o<a[0]?(s="0",l=0,c=-i,r?(d=-90,u="start"):u="middle"):o<a[3]?(s=".3em",l=-i,c=0,u="end"):(s=".6em",l=0,c=i,r?(d=90,u="start"):u="middle"),toResult({position:{x:Math.round(l),y:Math.round(c)},angle:d,attrs:{".":{y:s,"text-anchor":u}}},n)}function insideLayout(e,t,r,n){const i=null!=n.offset?n.offset:15,o=t.getCenter().theta(e),a=getBBoxAngles(t);let s,l,c,u,d=0;return o<a[1]||o>a[2]?(s=".3em",l=-i,c=0,u="end"):o<a[0]?(s=".6em",l=0,c=i,r?(d=90,u="start"):u="middle"):o<a[3]?(s=".3em",l=i,c=0,u="start"):(s="0em",l=0,c=-i,r?(d=-90,u="start"):u="middle"),toResult({position:{x:Math.round(l),y:Math.round(c)},angle:d,attrs:{".":{y:s,"text-anchor":u}}},n)}function getBBoxAngles(e){const t=e.getCenter(),r=t.theta(e.getTopLeft()),n=t.theta(e.getBottomLeft()),i=t.theta(e.getBottomRight());return[r,t.theta(e.getTopRight()),i,n]}const radial=(e,t,r)=>radialLayout(e.diff(t.getCenter()),!1,r),radialOriented=(e,t,r)=>radialLayout(e.diff(t.getCenter()),!0,r);function radialLayout(e,t,r){const n=null!=r.offset?r.offset:20,i=new Point(0,0),o=-e.theta(i);let a,s=".3em",l=o;return(o+90)%180==0?(a=t?"end":"middle",t||-270!==o||(s="0em")):o>-270&&o<-90?(a="start",l=o-180):a="end",toResult({position:e.clone().move(i,n).diff(e).round().round().toJSON(),angle:t?l:0,attrs:{".":{y:s,"text-anchor":a}}},r)}const layouts=Object.freeze(Object.defineProperty({__proto__:null,bottom:bottom$1,inside:inside,insideOriented:insideOriented,left:left$2,manual:manual,outside:outside,outsideOriented:outsideOriented,radial:radial,radialOriented:radialOriented,right:right$1,top:top$2},Symbol.toStringTag,{value:"Module"}));var PortLabelLayout,PortLabelLayout2;PortLabelLayout2=PortLabelLayout||(PortLabelLayout={}),PortLabelLayout2.presets=layouts,PortLabelLayout2.registry=Registry.create({type:"port label layout"}),PortLabelLayout2.registry.register(PortLabelLayout2.presets,!0);var __decorate$u=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},View2,Private$3,Markup,Markup2;class View extends Basecoat{get priority(){return 2}get disposeContainer(){return!0}constructor(){super(),this.cid=Private$3.uniqueId(),View.views[this.cid]=this}confirmUpdate(e,t){return 0}empty(e=this.container){return empty$2(e),this}unmount(e=this.container){return remove(e),this}remove(e=this.container){return e===this.container?(this.removeEventListeners(document),this.onRemove(),delete View.views[this.cid],this.disposeContainer&&this.unmount(e)):this.unmount(e),this}onRemove(){}setClass(e,t=this.container){t.classList.value=Array.isArray(e)?e.join(" "):e}addClass(e,t=this.container){return addClass(t,Array.isArray(e)?e.join(" "):e),this}removeClass(e,t=this.container){return removeClass(t,Array.isArray(e)?e.join(" "):e),this}setStyle(e,t=this.container){return css$3(t,e),this}setAttrs(e,t=this.container){return null!=e&&null!=t&&attr(t,e),this}findAttr(e,t=this.container){let r=t;for(;r&&1===r.nodeType;){const t=r.getAttribute(e);if(null!=t)return t;if(r===this.container)return null;r=r.parentNode}return null}find(e,t=this.container,r=this.selectors){return View.find(e,t,r).elems}findOne(e,t=this.container,r=this.selectors){const n=this.find(e,t,r);return n.length>0?n[0]:null}findByAttr(e,t=this.container){let r=t;for(;r&&r.getAttribute;){const t=r.getAttribute(e);if((null!=t||r===this.container)&&"false"!==t)return r;r=r.parentNode}return null}getSelector(e,t){let r;if(e===this.container)return"string"==typeof t&&(r=`> ${t}`),r;if(e){const n=index$1(e)+1;r=`${e.tagName.toLowerCase()}:nth-child(${n})`,t&&(r+=` > ${t}`),r=this.getSelector(e.parentNode,r)}return r}prefixClassName(e){return Config.prefix(e)}delegateEvents(e,t){if(null==e)return this;t||this.undelegateEvents();const r=/^(\S+)\s*(.*)$/;return Object.keys(e).forEach(t=>{const n=t.match(r);if(null==n)return;const i=this.getEventHandler(e[t]);"function"==typeof i&&this.delegateEvent(n[1],n[2],i)}),this}undelegateEvents(){return Event$1.off(this.container,this.getEventNamespace()),this}delegateDocumentEvents(e,t){return this.addEventListeners(document,e,t),this}undelegateDocumentEvents(){return this.removeEventListeners(document),this}delegateEvent(e,t,r){return Event$1.on(this.container,e+this.getEventNamespace(),t,r),this}undelegateEvent(e,t,r){const n=e+this.getEventNamespace();return null==t?Event$1.off(this.container,n):"string"==typeof t?Event$1.off(this.container,n,t,r):Event$1.off(this.container,n,t),this}addEventListeners(e,t,r){if(null==t)return this;const n=this.getEventNamespace();return Object.keys(t).forEach(i=>{const o=this.getEventHandler(t[i]);"function"==typeof o&&Event$1.on(e,i+n,r,o)}),this}removeEventListeners(e){return null!=e&&Event$1.off(e,this.getEventNamespace()),this}getEventNamespace(){return`.${Config.prefixCls}-event-${this.cid}`}getEventHandler(e){let t;if("string"==typeof e){const r=this[e];"function"==typeof r&&(t=(...e)=>r.call(this,...e))}else t=(...t)=>e.call(this,...t);return t}getEventTarget(e,t={}){const{target:r,type:n,clientX:i=0,clientY:o=0}=e;return t.fromPoint||"touchmove"===n||"touchend"===n?document.elementFromPoint(i,o):r}stopPropagation(e){return this.setEventData(e,{propagationStopped:!0}),this}isPropagationStopped(e){return!0===this.getEventData(e).propagationStopped}getEventData(e){return this.eventData(e)}setEventData(e,t){return this.eventData(e,t)}eventData(e,t){if(null==e)throw new TypeError("Event object required");let r=e.data;const n=`__${this.cid}__`;return null==t?null==r?{}:r[n]||{}:(null==r&&(r=e.data={}),null==r[n]?r[n]=Object.assign({},t):r[n]=Object.assign(Object.assign({},r[n]),t),r[n])}normalizeEvent(e){return View.normalizeEvent(e)}dispose(){this.remove()}}__decorate$u([View.dispose()],View.prototype,"dispose",null),View2=View||(View={}),View2.createElement=function(e,t){return t?createSvgElement(e||"g"):createElementNS(e||"div")},View2.find=function(e,t,r){if(!e||"."===e)return{elems:[t]};if(r){const t=r[e];if(t)return{elems:Array.isArray(t)?t:[t]}}{const r=e.includes(">")?`:scope ${e}`:e;return{isCSSSelector:!0,elems:Array.prototype.slice.call(t.querySelectorAll(r))}}},View2.normalizeEvent=function(e){let t=e;const r=e.originalEvent,n=r&&r.changedTouches&&r.changedTouches[0];if(n){for(const t in e)void 0===n[t]&&(n[t]=e[t]);t=n}return t},function(e){e.views={},e.getView=function(t){return e.views[t]||null}}(View||(View={})),function(e){let t=0;e.uniqueId=function(){const e=`v${t}`;return t+=1,e}}(Private$3||(Private$3={}));class Cache{constructor(e){this.view=e,this.clean()}clean(){this.elemCache&&this.elemCache.dispose(),this.elemCache=new Dictionary,this.pathCache={}}get(e){return this.elemCache.has(e)||this.elemCache.set(e,{}),this.elemCache.get(e)}getData(e){const t=this.get(e);return t.data||(t.data={}),t.data}getMatrix(e){const t=this.get(e);if(null==t.matrix){const r=this.view.container;t.matrix=getTransformToParentElement(e,r)}return createSVGMatrix(t.matrix)}getShape(e){const t=this.get(e);return null==t.shape&&(t.shape=Util$1.toGeometryShape(e)),t.shape.clone()}getBoundingRect(e){const t=this.get(e);return null==t.boundingRect&&(t.boundingRect=Util$1.getBBoxV2(e)),t.boundingRect.clone()}}!function(e){function t(e){return null!=e&&"string"==typeof e}function r(e,t={ns:ns.svg}){const r=document.createDocumentFragment(),n={},i={},o=[{markup:Array.isArray(e)?e:[e],parent:r,ns:t.ns}];for(;o.length>0;){const e=o.pop();let t=e.ns||ns.svg;const r=e.markup,a=e.parent;r.forEach(e=>{const r=e.tagName;if(!r)throw new TypeError("Invalid tagName");e.ns&&(t=e.ns);const s=t?createElementNS(r,t):createElement$1(r),l=e.attrs;l&&attr(s,kebablizeAttrs(l));const c=e.style;c&&css$3(s,c);const u=e.className;null!=u&&s.setAttribute("class",Array.isArray(u)?u.join(" "):u),e.textContent&&(s.textContent=e.textContent);const d=e.selector;if(null!=d){if(i[d])throw new TypeError("Selector must be unique");i[d]=s}if(e.groupSelector){let t=e.groupSelector;Array.isArray(t)||(t=[t]),t.forEach(e=>{n[e]||(n[e]=[]),n[e].push(s)})}a.appendChild(s);const p=e.children;Array.isArray(p)&&o.push({ns:t,markup:p,parent:s})})}return Object.keys(n).forEach(e=>{if(i[e])throw new Error("Ambiguous group selector");i[e]=n[e]}),{fragment:r,selectors:i,groups:n}}function n(e){return e instanceof SVGElement?createSvgElement("g"):createElement$1("div")}e.isJSONMarkup=function(e){return null!=e&&!t(e)},e.isStringMarkup=t,e.clone=function(e){return null==e||t(e)?e:cloneDeep(e)},e.sanitize=function(e){return`${e}`.trim().replace(/[\r|\n]/g," ").replace(/>\s+</g,"><")},e.parseJSONMarkup=r,e.renderMarkup=function(e){if(t(e)){const t=Vector.createVectors(e),r=t.length;if(1===r)return{elem:t[0].node};if(r>1){const e=n(t[0].node);return t.forEach(t=>{e.appendChild(t.node)}),{elem:e}}return{}}const i=r(e),o=i.fragment;let a=null;return o.childNodes.length>1?(a=n(o.firstChild),a.appendChild(o)):a=o.firstChild,{elem:a,selectors:i.selectors}},e.parseLabelStringMarkup=function(e){const t=Vector.createVectors(e),r=document.createDocumentFragment();for(let n=0,i=t.length;n<i;n+=1){const e=t[n].node;r.appendChild(e)}return{fragment:r,selectors:{}}}}(Markup||(Markup={})),Markup2=Markup||(Markup={}),Markup2.getSelector=function e(t,r,n){if(null!=t){let i;const o=t.tagName.toLowerCase();if(t===r)return i="string"==typeof n?`> ${o} > ${n}`:`> ${o}`,i;const a=t.parentNode;return i=a&&a.childNodes.length>1?`${o}:nth-child(${index$1(t)+1})`:o,n&&(i+=` > ${n}`),e(t.parentNode,r,i)}return n},function(e){e.getPortContainerMarkup=function(){return"g"},e.getPortMarkup=function(){return{tagName:"circle",selector:"circle",attrs:{r:10,fill:"#FFFFFF",stroke:"#000000"}}},e.getPortLabelMarkup=function(){return{tagName:"text",selector:"text",attrs:{fill:"#000000"}}}}(Markup||(Markup={})),function(e){e.getEdgeMarkup=function(){return[{tagName:"path",selector:"wrap",groupSelector:"lines",attrs:{fill:"none",cursor:"pointer",stroke:"transparent",strokeLinecap:"round"}},{tagName:"path",selector:"line",groupSelector:"lines",attrs:{fill:"none",pointerEvents:"none"}}]}}(Markup||(Markup={})),function(e){e.getForeignObjectMarkup=function(e=!1){return{tagName:"foreignObject",selector:"fo",children:[{ns:ns.xhtml,tagName:"body",selector:"foBody",attrs:{xmlns:ns.xhtml},style:{width:"100%",height:"100%",background:"transparent"},children:e?[]:[{tagName:"div",selector:"foContent",style:{width:"100%",height:"100%"}}]}]}}}(Markup||(Markup={}));class AttrManager{constructor(e){this.view=e}get cell(){return this.view.cell}getDefinition(e){return this.cell.getAttrDefinition(e)}processAttrs(e,t){let r,n,i,o;const a=[];return Object.keys(t).forEach(n=>{const i=t[n],o=this.getDefinition(n),s=call$1(Attr.isValidDefinition,this.view,o,i,{elem:e,attrs:t,cell:this.cell,view:this.view});if(o&&s)"string"==typeof o?(null==r&&(r={}),r[o]=i):null!==i&&a.push({name:n,definition:o});else{null==r&&(r={});const e=CASE_SENSITIVE_ATTR.includes(n)?n:kebabCase(n);r[e]=i}}),a.forEach(({name:e,definition:r})=>{const a=t[e];"function"==typeof r.set&&(null==n&&(n={}),n[e]=a);"function"==typeof r.offset&&(null==i&&(i={}),i[e]=a);"function"==typeof r.position&&(null==o&&(o={}),o[e]=a)}),{raw:t,normal:r,set:n,offset:i,position:o}}mergeProcessedAttrs(e,t){e.set=Object.assign(Object.assign({},e.set),t.set),e.position=Object.assign(Object.assign({},e.position),t.position),e.offset=Object.assign(Object.assign({},e.offset),t.offset);const r=e.normal&&e.normal.transform;null!=r&&t.normal&&(t.normal.transform=r),e.normal=t.normal}findAttrs(e,t,r,n){const i=[],o=new Dictionary;return Object.keys(e).forEach(a=>{const s=e[a];if(!isPlainObject(s))return;const{isCSSSelector:l,elems:c}=View.find(a,t,n);r[a]=c;for(let e=0,t=c.length;e<t;e+=1){const r=c[e],u=n&&n[a]===r,d=o.get(r);if(d){d.array||(i.push(r),d.array=!0,d.attrs=[d.attrs],d.priority=[d.priority]);const e=d.attrs,n=d.priority;if(u)e.unshift(s),n.unshift(-1);else{const r=sortedIndex(n,l?-1:t);e.splice(r,0,s),n.splice(r,0,t)}}else o.set(r,{elem:r,attrs:s,priority:u?-1:t,array:!1})}}),i.forEach(e=>{const t=o.get(e),r=t.attrs;t.attrs=r.reduceRight((e,t)=>merge$2(e,t),{})}),o}updateRelativeAttrs(e,t,r){const n=t.raw||{};let i=t.normal||{};const o=t.set,a=t.position,s=t.offset,l=()=>({elem:e,cell:this.cell,view:this.view,attrs:n,refBBox:r.clone()});if(null!=o&&Object.keys(o).forEach(e=>{const t=o[e],r=this.getDefinition(e);if(null!=r){const n=call$1(r.set,this.view,t,l());"object"==typeof n?i=Object.assign(Object.assign({},i),n):null!=n&&(i[e]=n)}}),e instanceof HTMLElement)return void this.view.setAttrs(i,e);const c=i.transform,u=transformStringToMatrix(c?`${c}`:null),d=new Point(u.e,u.f);c&&(delete i.transform,u.e=0,u.f=0);let p=!1;null!=a&&Object.keys(a).forEach(e=>{const t=a[e],r=this.getDefinition(e);if(null!=r){const e=call$1(r.position,this.view,t,l());null!=e&&(p=!0,d.translate(Point.create(e)))}}),this.view.setAttrs(i,e);let h=!1;if(null!=s){const t=this.view.getBoundingRectOfElement(e);if(t.width>0&&t.height>0){const r=Util$1.transformRectangle(t,u);Object.keys(s).forEach(t=>{const i=s[t],o=this.getDefinition(t);if(null!=o){const t=call$1(o.offset,this.view,i,{elem:e,cell:this.cell,view:this.view,attrs:n,refBBox:r});null!=t&&(h=!0,d.translate(Point.create(t)))}})}}(null!=c||p||h)&&(d.round(1),u.e=Number.isFinite(d.x)?d.x:0,u.f=Number.isFinite(d.y)?d.y:0,e.setAttribute("transform",matrixToTransformString(u)))}update(e,t,r){const n={},i=this.findAttrs(r.attrs||t,e,n,r.selectors),o=r.attrs?this.findAttrs(t,e,n,r.selectors):i,a=[];i.each(t=>{const i=t.elem,s=t.attrs,l=this.processAttrs(i,s);if(null==l.set&&null==l.position&&null==l.offset)this.view.setAttrs(l.normal,i);else{const t=o.get(i),c=t?t.attrs:null,u=c&&null==s.ref?c.ref:s.ref;let d;if(u){if(d=(n[u]||this.view.find(u,e,r.selectors))[0],!d)throw new Error(`"${u}" reference does not exist.`)}else d=null;const p={node:i,refNode:d,attributes:c,processedAttributes:l},h=a.findIndex(e=>e.refNode===i);h>-1?a.splice(h,0,p):a.push(p)}});const s=new Dictionary;let l;a.forEach(t=>{const n=t.node,i=t.refNode;let o;const a=null!=i&&null!=r.rotatableNode&&contains(r.rotatableNode,i);if(i&&(o=s.get(i)),!o){const t=a?r.rotatableNode:e;o=i?Util$1.getBBox(i,{target:t}):r.rootBBox,i&&s.set(i,o)}let c;r.attrs&&t.attributes?(c=this.processAttrs(n,t.attributes),this.mergeProcessedAttrs(c,t.processedAttributes)):c=t.processedAttributes;let u=o;a&&null!=r.rotatableNode&&!r.rotatableNode.contains(n)&&(l||(l=transformStringToMatrix(attr(r.rotatableNode,"transform"))),u=Util$1.transformRectangle(o,l)),this.updateRelativeAttrs(n,c,u)})}}class FlagManager{get cell(){return this.view.cell}constructor(e,t,r=[]){this.view=e;const n={},i={};let o=0;Object.keys(t).forEach(e=>{let r=t[e];Array.isArray(r)||(r=[r]),r.forEach(t=>{let r=n[t];r||(o+=1,r=n[t]=1<<o),i[e]|=r})});let a=r;if(Array.isArray(a)||(a=[a]),a.forEach(e=>{n[e]||(o+=1,n[e]=1<<o)}),o>25)throw new Error("Maximum number of flags exceeded.");this.flags=n,this.attrs=i,this.bootstrap=r}getFlag(e){const t=this.flags;return null==t?0:Array.isArray(e)?e.reduce((e,r)=>e|t[r],0):0|t[e]}hasAction(e,t){return e&this.getFlag(t)}removeAction(e,t){return e^e&this.getFlag(t)}getBootstrapFlag(){return this.getFlag(this.bootstrap)}getChangedFlag(){let e=0;return this.attrs?(Object.keys(this.attrs).forEach(t=>{this.cell.hasChanged(t)&&(e|=this.attrs[t])}),e):e}}var __decorate$t=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},__rest$i=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},CellView2,ToolsView2;class CellView extends View{static getDefaults(){return this.defaults}static config(e){this.defaults=this.getOptions(e)}static getOptions(e){const t=(e,t)=>null!=t?uniq([...Array.isArray(e)?e:[e],...Array.isArray(t)?t:[t]]):Array.isArray(e)?[...e]:[e],r=cloneDeep(this.getDefaults()),{bootstrap:n,actions:i,events:o,documentEvents:a}=e,s=__rest$i(e,["bootstrap","actions","events","documentEvents"]);return n&&(r.bootstrap=t(r.bootstrap,n)),i&&Object.entries(i).forEach(([e,n])=>{const i=r.actions[e];n&&i?r.actions[e]=t(i,n):n&&(r.actions[e]=t(n))}),o&&(r.events=Object.assign(Object.assign({},r.events),o)),e.documentEvents&&(r.documentEvents=Object.assign(Object.assign({},r.documentEvents),a)),merge$2(r,s)}get[Symbol.toStringTag](){return CellView.toStringTag}constructor(e,t={}){super(),this.cell=e,this.options=this.ensureOptions(t),this.graph=this.options.graph,this.attr=new AttrManager(this),this.flag=new FlagManager(this,this.options.actions,this.options.bootstrap),this.cache=new Cache(this),this.setContainer(this.ensureContainer()),this.setup(),this.init()}init(){}onRemove(){this.removeTools()}get priority(){return this.options.priority}get rootSelector(){return this.options.rootSelector}getConstructor(){return this.constructor}ensureOptions(e){return this.getConstructor().getOptions(e)}getContainerTagName(){return this.options.isSvgElement?"g":"div"}getContainerStyle(){}getContainerAttrs(){return{"data-cell-id":this.cell.id,"data-shape":this.cell.shape}}getContainerClassName(){return this.prefixClassName("cell")}ensureContainer(){return View.createElement(this.getContainerTagName(),this.options.isSvgElement)}setContainer(e){if(this.container!==e){this.undelegateEvents(),this.container=e,null!=this.options.events&&this.delegateEvents(this.options.events);const t=this.getContainerAttrs();null!=t&&this.setAttrs(t,e);const r=this.getContainerStyle();null!=r&&this.setStyle(r,e);const n=this.getContainerClassName();null!=n&&this.addClass(n,e)}return this}isNodeView(){return!1}isEdgeView(){return!1}render(){return this}confirmUpdate(e,t={}){return 0}getBootstrapFlag(){return this.flag.getBootstrapFlag()}getFlag(e){return this.flag.getFlag(e)}hasAction(e,t){return this.flag.hasAction(e,t)}removeAction(e,t){return this.flag.removeAction(e,t)}handleAction(e,t,r,n){if(this.hasAction(e,t)){r();const i=[t];return n&&("string"==typeof n?i.push(n):i.push(...n)),this.removeAction(e,i)}return e}setup(){this.cell.on("changed",this.onCellChanged,this)}onCellChanged({options:e}){this.onAttrsChange(e)}onAttrsChange(e){let t=this.flag.getChangedFlag();!e.updated&&t&&(e.dirty&&this.hasAction(t,"update")&&(t|=this.getFlag("render")),e.toolId&&(e.async=!1),null!=this.graph&&this.graph.renderer.requestViewUpdate(this,t,e))}parseJSONMarkup(e,t){const r=Markup.parseJSONMarkup(e),n=r.selectors,i=this.rootSelector;if(t&&i){if(n[i])throw new Error("Invalid root selector");n[i]=t}return r}can(e){let t=this.graph.options.interacting;if("function"==typeof t&&(t=call$1(t,this.graph,this)),"object"==typeof t){let r=t[e];return"function"==typeof r&&(r=call$1(r,this.graph,this)),!1!==r}return"boolean"==typeof t&&t}cleanCache(){return this.cache.clean(),this}getCache(e){return this.cache.get(e)}getDataOfElement(e){return this.cache.getData(e)}getMatrixOfElement(e){return this.cache.getMatrix(e)}getShapeOfElement(e){return this.cache.getShape(e)}getBoundingRectOfElement(e){return this.cache.getBoundingRect(e)}getBBoxOfElement(e){const t=this.getBoundingRectOfElement(e),r=this.getMatrixOfElement(e),n=this.getRootRotatedMatrix(),i=this.getRootTranslatedMatrix();return Util$1.transformRectangle(t,i.multiply(n).multiply(r))}getUnrotatedBBoxOfElement(e){const t=this.getBoundingRectOfElement(e),r=this.getMatrixOfElement(e),n=this.getRootTranslatedMatrix();return Util$1.transformRectangle(t,n.multiply(r))}getBBox(e={}){let t;if(e.useCellGeometry){const e=this.cell,r=e.isNode()?e.getAngle():0;t=e.getBBox().bbox(r)}else t=this.getBBoxOfElement(this.container);return this.graph.coord.localToGraphRect(t)}getRootTranslatedMatrix(){const e=this.cell,t=e.isNode()?e.getPosition():{x:0,y:0};return createSVGMatrix().translate(t.x,t.y)}getRootRotatedMatrix(){let e=createSVGMatrix();const t=this.cell,r=t.isNode()?t.getAngle():0;if(r){const n=t.getBBox(),i=n.width/2,o=n.height/2;e=e.translate(i,o).rotate(r).translate(-i,-o)}return e}findMagnet(e=this.container){return this.findByAttr("magnet",e)}updateAttrs(e,t,r={}){null==r.rootBBox&&(r.rootBBox=new Rectangle),null==r.selectors&&(r.selectors=this.selectors),this.attr.update(e,t,r)}isEdgeElement(e){return this.cell.isEdge()&&(null==e||e===this.container)}prepareHighlight(e,t={}){const r=e||this.container;return t.partial=r===this.container,r}highlight(e,t={}){const r=this.prepareHighlight(e,t);return this.notify("cell:highlight",{magnet:r,options:t,view:this,cell:this.cell}),this.isEdgeView()?this.notify("edge:highlight",{magnet:r,options:t,view:this,edge:this.cell,cell:this.cell}):this.isNodeView()&&this.notify("node:highlight",{magnet:r,options:t,view:this,node:this.cell,cell:this.cell}),this}unhighlight(e,t={}){const r=this.prepareHighlight(e,t);return this.notify("cell:unhighlight",{magnet:r,options:t,view:this,cell:this.cell}),this.isNodeView()?this.notify("node:unhighlight",{magnet:r,options:t,view:this,node:this.cell,cell:this.cell}):this.isEdgeView()&&this.notify("edge:unhighlight",{magnet:r,options:t,view:this,edge:this.cell,cell:this.cell}),this}notifyUnhighlight(e,t){}getEdgeTerminal(e,t,r,n,i){const o=this.cell,a=this.findAttr("port",e),s=e.getAttribute("data-selector"),l={cell:o.id};return null!=s&&(l.magnet=s),null!=a?(l.port=a,o.isNode()&&(o.hasPort(a)||null!=s||(l.selector=this.getSelector(e)))):null==s&&this.container!==e&&(l.selector=this.getSelector(e)),l}getMagnetFromEdgeTerminal(e){const t=this.cell,r=this.container,n=e.port;let i,o=e.magnet;return null!=n&&t.isNode()&&t.hasPort(n)?i=this.findPortElem(n,o)||r:(o||(o=e.selector),o||null==n||(o=`[port="${n}"]`),i=this.findOne(o,r,this.selectors)),i}hasTools(e){const t=this.tools;return null!=t&&(null==e||t.name===e)}addTools(e){if(this.removeTools(),e){if(!this.can("toolsAddable"))return this;const t=ToolsView.isToolsView(e)?e:new ToolsView(e);this.tools=t,t.config({view:this}),t.mount()}return this}updateTools(e={}){return this.tools&&this.tools.update(e),this}removeTools(){return this.tools&&(this.tools.remove(),this.tools=null),this}hideTools(){return this.tools&&this.tools.hide(),this}showTools(){return this.tools&&this.tools.show(),this}renderTools(){const e=this.cell.getTools();return this.addTools(e),this}notify(e,t){return this.trigger(e,t),this.graph.trigger(e,t),this}getEventArgs(e,t,r){const n=this,i=n.cell;return null==t||null==r?{e:e,view:n,cell:i}:{e:e,x:t,y:r,view:n,cell:i}}onClick(e,t,r){this.notify("cell:click",this.getEventArgs(e,t,r))}onDblClick(e,t,r){this.notify("cell:dblclick",this.getEventArgs(e,t,r))}onContextMenu(e,t,r){this.notify("cell:contextmenu",this.getEventArgs(e,t,r))}onMouseDown(e,t,r){this.cell.model&&(this.cachedModelForMouseEvent=this.cell.model,this.cachedModelForMouseEvent.startBatch("mouse")),this.notify("cell:mousedown",this.getEventArgs(e,t,r))}onMouseUp(e,t,r){this.notify("cell:mouseup",this.getEventArgs(e,t,r)),this.cachedModelForMouseEvent&&(this.cachedModelForMouseEvent.stopBatch("mouse",{cell:this.cell}),this.cachedModelForMouseEvent=null)}onMouseMove(e,t,r){this.notify("cell:mousemove",this.getEventArgs(e,t,r))}onMouseOver(e){this.notify("cell:mouseover",this.getEventArgs(e))}onMouseOut(e){this.notify("cell:mouseout",this.getEventArgs(e))}onMouseEnter(e){this.notify("cell:mouseenter",this.getEventArgs(e))}onMouseLeave(e){this.notify("cell:mouseleave",this.getEventArgs(e))}onMouseWheel(e,t,r,n){this.notify("cell:mousewheel",Object.assign({delta:n},this.getEventArgs(e,t,r)))}onCustomEvent(e,t,r,n){this.notify("cell:customevent",Object.assign({name:t},this.getEventArgs(e,r,n))),this.notify(t,Object.assign({},this.getEventArgs(e,r,n)))}onMagnetMouseDown(e,t,r,n){}onMagnetDblClick(e,t,r,n){}onMagnetContextMenu(e,t,r,n){}onLabelMouseDown(e,t,r){}checkMouseleave(e){const t=this.getEventTarget(e,{fromPoint:!0}),r=this.graph.findViewByElem(t);r!==this&&(this.onMouseLeave(e),r&&r.onMouseEnter(e))}dispose(){this.cell.off("changed",this.onCellChanged,this)}}CellView.defaults={isSvgElement:!0,rootSelector:"root",priority:0,bootstrap:[],actions:{}},__decorate$t([CellView.dispose()],CellView.prototype,"dispose",null),CellView2=CellView||(CellView={}),CellView2.Flag=FlagManager,CellView2.Attr=AttrManager,function(e){e.toStringTag=`X6.${e.name}`,e.isCellView=function(t){if(null==t)return!1;if(t instanceof e)return!0;const r=t[Symbol.toStringTag],n=t;return(null==r||r===e.toStringTag)&&"function"==typeof n.isNodeView&&"function"==typeof n.isEdgeView&&"function"==typeof n.confirmUpdate}}(CellView||(CellView={})),function(e){e.priority=function(e){return function(t){t.config({priority:e})}},e.bootstrap=function(e){return function(t){t.config({bootstrap:e})}}}(CellView||(CellView={})),function(e){e.registry=Registry.create({type:"view"})}(CellView||(CellView={}));class ToolsView extends View{get name(){return this.options.name}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get[Symbol.toStringTag](){return ToolsView.toStringTag}constructor(e={}){super(),this.svgContainer=this.createContainer(!0,e),this.htmlContainer=this.createContainer(!1,e),this.config(e)}createContainer(e,t){const r=e?View.createElement("g",!0):View.createElement("div",!1);return addClass(r,this.prefixClassName("cell-tools")),t.className&&addClass(r,t.className),r}config(e){if(this.options=Object.assign(Object.assign({},this.options),e),!CellView.isCellView(e.view)||e.view===this.cellView)return this;this.cellView=e.view,this.cell.isEdge()?(addClass(this.svgContainer,this.prefixClassName("edge-tools")),addClass(this.htmlContainer,this.prefixClassName("edge-tools"))):this.cell.isNode()&&(addClass(this.svgContainer,this.prefixClassName("node-tools")),addClass(this.htmlContainer,this.prefixClassName("node-tools"))),this.svgContainer.setAttribute("data-cell-id",this.cell.id),this.htmlContainer.setAttribute("data-cell-id",this.cell.id),this.name&&(this.svgContainer.setAttribute("data-tools-name",this.name),this.htmlContainer.setAttribute("data-tools-name",this.name));const t=this.options.items;if(!Array.isArray(t))return this;this.tools=[];const r=[];t.forEach(e=>{if(ToolsView.ToolItem.isToolItem(e))"vertices"===e.name?r.unshift(e):r.push(e);else{"vertices"===("object"==typeof e?e.name:e)?r.unshift(e):r.push(e)}});for(let n=0;n<r.length;n+=1){const e=r[n];let t;if(ToolsView.ToolItem.isToolItem(e))t=e;else{const r="object"==typeof e?e.name:e,n="object"==typeof e&&e.args||{};if(r)if(this.cell.isNode()){const e=NodeTool.registry.get(r);if(!e)return NodeTool.registry.onNotFound(r);t=new e(n)}else if(this.cell.isEdge()){const e=EdgeTool.registry.get(r);if(!e)return EdgeTool.registry.onNotFound(r);t=new e(n)}}if(t){t.config(this.cellView,this),t.render();(!1!==t.options.isSVGElement?this.svgContainer:this.htmlContainer).appendChild(t.container),this.tools.push(t)}}return this}update(e={}){const t=this.tools;return t&&t.forEach(t=>{e.toolId!==t.cid&&t.isVisible()&&t.update()}),this}focus(e){const t=this.tools;return t&&t.forEach(t=>{e===t?t.show():t.hide()}),this}blur(e){const t=this.tools;return t&&t.forEach(t=>{t===e||t.isVisible()||(t.show(),t.update())}),this}hide(){return this.focus(null)}show(){return this.blur(null)}remove(){const e=this.tools;return e&&(e.forEach(e=>e.remove()),this.tools=null),remove(this.svgContainer),remove(this.htmlContainer),super.remove()}mount(){const e=this.tools,t=this.cellView;if(t&&e){const r=e.some(e=>!1!==e.options.isSVGElement),n=e.some(e=>!1===e.options.isSVGElement);if(r){(this.options.local?t.container:t.graph.view.decorator).appendChild(this.svgContainer)}n&&this.graph.container.appendChild(this.htmlContainer)}return this}}ToolsView2=ToolsView||(ToolsView={}),ToolsView2.toStringTag=`X6.${ToolsView2.name}`,ToolsView2.isToolsView=function(e){if(null==e)return!1;if(e instanceof ToolsView2)return!0;const t=e[Symbol.toStringTag],r=e;return(null==t||t===ToolsView2.toStringTag)&&null!=r.graph&&null!=r.cell&&"function"==typeof r.config&&"function"==typeof r.update&&"function"==typeof r.focus&&"function"==typeof r.blur&&"function"==typeof r.show&&"function"==typeof r.hide},function(e){class t extends View{static getDefaults(){return this.defaults}static config(e){this.defaults=this.getOptions(e)}static getOptions(e){return merge$2(cloneDeep(this.getDefaults()),e)}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get name(){return this.options.name}get[Symbol.toStringTag](){return t.toStringTag}constructor(e={}){super(),this.visible=!0,this.options=this.getOptions(e),this.container=View.createElement(this.options.tagName||"g",!1!==this.options.isSVGElement),addClass(this.container,this.prefixClassName("cell-tool")),"string"==typeof this.options.className&&addClass(this.container,this.options.className),this.init()}init(){}getOptions(e){return this.constructor.getOptions(e)}delegateEvents(){return this.options.events&&super.delegateEvents(this.options.events),this}config(e,t){return this.cellView=e,this.parent=t,this.stamp(this.container),this.cell.isEdge()?addClass(this.container,this.prefixClassName("edge-tool")):this.cell.isNode()&&addClass(this.container,this.prefixClassName("node-tool")),this.name&&this.container.setAttribute("data-tool-name",this.name),this.delegateEvents(),this}render(){this.empty();const e=this.options.markup;if(e){const t=Markup.parseJSONMarkup(e);this.container.appendChild(t.fragment),this.childNodes=t.selectors}return this.onRender(),this}onRender(){}update(){return this}stamp(e){e&&e.setAttribute("data-cell-id",this.cellView.cell.id)}show(){return this.container.style.display="",this.visible=!0,this}hide(){return this.container.style.display="none",this.visible=!1,this}isVisible(){return this.visible}focus(){const e=this.options.focusOpacity;return null!=e&&Number.isFinite(e)&&(this.container.style.opacity=`${e}`),this.parent.focus(this),this}blur(){return this.container.style.opacity="",this.parent.blur(this),this}guard(e){return null==this.graph||null==this.cellView||this.graph.view.guard(e,this.cellView)}}var r;t.defaults={isSVGElement:!0,tagName:"g"},e.ToolItem=t,function(e){let t=0;e.define=function(e){const r=createClass((n=e.name)?pascalCase(n):(t+=1,`CustomTool${t}`),this);var n;return r.config(e),r}}(t=e.ToolItem||(e.ToolItem={})),(r=t=e.ToolItem||(e.ToolItem={})).toStringTag=`X6.${r.name}`,r.isToolItem=function(e){if(null==e)return!1;if(e instanceof r)return!0;const t=e[Symbol.toStringTag],n=e;return(null==t||t===r.toStringTag)&&null!=n.graph&&null!=n.cell&&"function"==typeof n.config&&"function"==typeof n.update&&"function"==typeof n.focus&&"function"==typeof n.blur&&"function"==typeof n.show&&"function"==typeof n.hide&&"function"==typeof n.isVisible}}(ToolsView||(ToolsView={}));const noop$1=e=>e;function toPercentage(e,t){return 0===t?"0%":`${Math.round(e/t*100)}%`}function pin(e){return(t,r,n,i)=>r.isEdgeElement(n)?pinEdgeTerminal(e,t,r,n,i):pinNodeTerminal(e,t,r,n,i)}function pinNodeTerminal(e,t,r,n,i){const o=r.cell,a=o.getAngle(),s=r.getUnrotatedBBoxOfElement(n),l=o.getBBox().getCenter(),c=Point.create(i).rotate(a,l);let u=c.x-s.x,d=c.y-s.y;return e&&(u=toPercentage(u,s.width),d=toPercentage(d,s.height)),t.anchor={name:"topLeft",args:{dx:u,dy:d,rotate:!0}},t}function pinEdgeTerminal(e,t,r,n,i){const o=r.getConnection();if(!o)return t;const a=o.closestPointLength(i);if(e){const e=o.length();t.anchor={name:"ratio",args:{ratio:a/e}}}else t.anchor={name:"length",args:{length:a}};return t}const pinRelative=pin(!0),pinAbsolute=pin(!1),strategies=Object.freeze(Object.defineProperty({__proto__:null,noop:noop$1,pinAbsolute:pinAbsolute,pinRelative:pinRelative},Symbol.toStringTag,{value:"Module"}));var ConnectionStrategy,ConnectionStrategy2,Button2;function getAnchor(e,t,r,n){return call$1(ConnectionStrategy.presets.pinRelative,this.graph,{},t,r,e,this.cell,n,{}).anchor}function getViewBBox(e,t){return t?e.cell.getBBox():e.cell.isEdge()?e.getConnection().bbox():e.getUnrotatedBBoxOfElement(e.container)}ConnectionStrategy2=ConnectionStrategy||(ConnectionStrategy={}),ConnectionStrategy2.presets=strategies,ConnectionStrategy2.registry=Registry.create({type:"connection strategy"}),ConnectionStrategy2.registry.register(ConnectionStrategy2.presets,!0);class Button extends ToolsView.ToolItem{onRender(){addClass(this.container,this.prefixClassName("cell-tool-button")),this.update()}update(){return this.updatePosition(),this}updatePosition(){const e=this.cellView.cell.isEdge()?this.getEdgeMatrix():this.getNodeMatrix();transform(this.container,e,{absolute:!0})}getNodeMatrix(){const e=this.cellView,t=this.options;let{x:r=0,y:n=0}=t;const{offset:i,useCellGeometry:o,rotate:a}=t;let s=getViewBBox(e,o);const l=e.cell.getAngle();a||(s=s.bbox(l));let c=0,u=0;"number"==typeof i?(c=i,u=i):"object"==typeof i&&(c=i.x,u=i.y),r=normalizePercentage(r,s.width),n=normalizePercentage(n,s.height);let d=createSVGMatrix().translate(s.x+s.width/2,s.y+s.height/2);return a&&(d=d.rotate(l)),d=d.translate(r+c-s.width/2,n+u-s.height/2),d}getEdgeMatrix(){const e=this.cellView,t=this.options,{offset:r=0,distance:n=0,rotate:i}=t;let o,a,s;const l=normalizePercentage(n,1);o=l>=0&&l<=1?e.getTangentAtRatio(l):e.getTangentAtLength(l),o?(a=o.start,s=o.vector().vectorAngle(new Point(1,0))||0):(a=e.getConnection().start,s=0);let c=createSVGMatrix().translate(a.x,a.y).rotate(s);return c="object"==typeof r?c.translate(r.x||0,r.y||0):c.translate(0,r),i||(c=c.rotate(-s)),c}onMouseDown(e){if(this.guard(e))return;e.stopPropagation(),e.preventDefault();const t=this.options.onClick;"function"==typeof t&&call$1(t,this.cellView,{e:e,view:this.cellView,cell:this.cellView.cell,btn:this})}}Button2=Button||(Button={}),Button2.config({name:"button",useCellGeometry:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"}}),function(e){e.Remove=e.define({name:"button-remove",markup:[{tagName:"circle",selector:"button",attrs:{r:7,fill:"#FF1D00",cursor:"pointer"}},{tagName:"path",selector:"icon",attrs:{d:"M -3 -3 3 3 M -3 3 3 -3",fill:"none",stroke:"#FFFFFF","stroke-width":2,"pointer-events":"none"}}],distance:60,offset:0,useCellGeometry:!0,onClick({view:e,btn:t}){t.parent.remove(),e.cell.remove({ui:!0,toolId:t.cid})}})}(Button||(Button={}));var __rest$h=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},Boundary2,Vertices2,Segments2,Anchor2;class Boundary extends ToolsView.ToolItem{onRender(){if(addClass(this.container,this.prefixClassName("cell-tool-boundary")),this.options.attrs){const e=this.options.attrs,{class:t}=e,r=__rest$h(e,["class"]);attr(this.container,kebablizeAttrs(r)),t&&addClass(this.container,t)}this.update()}update(){const e=this.cellView,t=this.options,{useCellGeometry:r,rotate:n}=t,i=normalizeSides(t.padding);let o=getViewBBox(e,r).moveAndExpand({x:-i.left,y:-i.top,width:i.left+i.right,height:i.top+i.bottom});const a=e.cell;if(a.isNode()){const e=a.getAngle();if(e)if(n){const t=a.getBBox().getCenter();rotate$1(this.container,e,t.x,t.y,{absolute:!0})}else o=o.bbox(e)}return attr(this.container,o.toJSON()),this}}Boundary2=Boundary||(Boundary={}),Boundary2.config({name:"boundary",tagName:"rect",padding:10,useCellGeometry:!0,attrs:{fill:"none",stroke:"#333","stroke-width":.5,"stroke-dasharray":"5, 5","pointer-events":"none"}});class Vertices extends ToolsView.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}onRender(){return this.addClass(this.prefixClassName("edge-tool-vertices")),this.options.addable&&this.updatePath(),this.resetHandles(),this.renderHandles(),this}update(){return this.vertices.length===this.handles.length?this.updateHandles():(this.resetHandles(),this.renderHandles()),this.options.addable&&this.updatePath(),this}resetHandles(){const e=this.handles;this.handles=[],e&&e.forEach(e=>{this.stopHandleListening(e),e.remove()})}renderHandles(){const e=this.vertices;for(let t=0,r=e.length;t<r;t+=1){const r=e[t],n=this.options.createHandle,i=this.options.processHandle,o=n({index:t,graph:this.graph,guard:e=>this.guard(e),attrs:this.options.attrs||{}});i&&i(o),o.updatePosition(r.x,r.y),this.stamp(o.container),this.container.appendChild(o.container),this.handles.push(o),this.startHandleListening(o)}}updateHandles(){const e=this.vertices;for(let t=0,r=e.length;t<r;t+=1){const r=e[t],n=this.handles[t];n&&n.updatePosition(r.x,r.y)}}updatePath(){const e=this.childNodes.connection;e&&e.setAttribute("d",this.cellView.getConnectionPathData())}startHandleListening(e){const t=this.cellView;t.can("vertexMovable")&&(e.on("change",this.onHandleChange,this),e.on("changing",this.onHandleChanging,this),e.on("changed",this.onHandleChanged,this)),t.can("vertexDeletable")&&e.on("remove",this.onHandleRemove,this)}stopHandleListening(e){const t=this.cellView;t.can("vertexMovable")&&(e.off("change",this.onHandleChange,this),e.off("changing",this.onHandleChanging,this),e.off("changed",this.onHandleChanged,this)),t.can("vertexDeletable")&&e.off("remove",this.onHandleRemove,this)}getNeighborPoints(e){const t=this.cellView,r=this.vertices,n=e>0?r[e-1]:t.sourceAnchor,i=e<r.length-1?r[e+1]:t.targetAnchor;return{prev:Point.create(n),next:Point.create(i)}}getMouseEventArgs(e){const t=this.normalizeEvent(e),{x:r,y:n}=this.graph.snapToGrid(t.clientX,t.clientY);return{e:t,x:r,y:n}}onHandleChange({e:e}){this.focus();const t=this.cellView;if(t.cell.startBatch("move-vertex",{ui:!0,toolId:this.cid}),!this.options.stopPropagation){const{e:r,x:n,y:i}=this.getMouseEventArgs(e);this.eventData(r,{start:{x:n,y:i}}),t.notifyMouseDown(r,n,i)}}onHandleChanging({handle:e,e:t}){const r=this.cellView,n=e.options.index,{e:i,x:o,y:a}=this.getMouseEventArgs(t),s={x:o,y:a};this.snapVertex(s,n),r.cell.setVertexAt(n,s,{ui:!0,toolId:this.cid}),e.updatePosition(s.x,s.y),this.options.stopPropagation||r.notifyMouseMove(i,o,a)}stopBatch(e){this.cell.stopBatch("move-vertex",{ui:!0,toolId:this.cid}),e&&this.cell.stopBatch("add-vertex",{ui:!0,toolId:this.cid})}onHandleChanged({e:e}){const t=this.options,r=this.cellView;if(t.addable&&this.updatePath(),!t.removeRedundancies)return void this.stopBatch(this.eventData(e).vertexAdded);r.removeRedundantLinearVertices({ui:!0,toolId:this.cid})&&this.render(),this.blur(),this.stopBatch(this.eventData(e).vertexAdded);const{e:n,x:i,y:o}=this.getMouseEventArgs(e);if(!this.options.stopPropagation){r.notifyMouseUp(n,i,o);const{start:e}=this.eventData(n);if(e){const{x:t,y:a}=e;t===i&&a===o&&r.onClick(n,i,o)}}r.checkMouseleave(n),t.onChanged&&t.onChanged({edge:r.cell,edgeView:r})}snapVertex(e,t){const r=this.options.snapRadius||0;if(r>0){const n=this.getNeighborPoints(t),i=n.prev,o=n.next;Math.abs(e.x-i.x)<r?e.x=i.x:Math.abs(e.x-o.x)<r&&(e.x=o.x),Math.abs(e.y-i.y)<r?e.y=n.prev.y:Math.abs(e.y-o.y)<r&&(e.y=o.y)}}onHandleRemove({handle:e,e:t}){if(this.options.removable){const r=e.options.index,n=this.cellView;n.cell.removeVertexAt(r,{ui:!0}),this.options.addable&&this.updatePath(),n.checkMouseleave(this.normalizeEvent(t))}}allowAddVertex(e){const t=this.guard(e),r=this.options.addable&&this.cellView.can("vertexAddable"),n=!this.options.modifiers||ModifierKey.isMatch(e,this.options.modifiers);return!t&&r&&n}onPathMouseDown(e){const t=this.cellView;if(!this.allowAddVertex(e))return;e.stopPropagation(),e.preventDefault();const r=this.normalizeEvent(e),n=this.graph.snapToGrid(r.clientX,r.clientY).toJSON();t.cell.startBatch("add-vertex",{ui:!0,toolId:this.cid});const i=t.getVertexIndex(n.x,n.y);this.snapVertex(n,i),t.cell.insertVertex(n,i,{ui:!0,toolId:this.cid}),this.render();const o=this.handles[i];this.eventData(r,{vertexAdded:!0}),o.onMouseDown(r)}onRemove(){this.resetHandles()}}Vertices2=Vertices||(Vertices={}),Vertices2.Handle=class extends View{get graph(){return this.options.graph}constructor(e){super(),this.options=e,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDoubleClick"})}render(){this.container=View.createElement("circle",!0);const e=this.options.attrs;if("function"==typeof e){const t=Vertices2.getDefaults();this.setAttrs(Object.assign(Object.assign({},t.attrs),e(this)))}else this.setAttrs(e);this.addClass(this.prefixClassName("edge-tool-vertex"))}updatePosition(e,t){this.setAttrs({cx:e,cy:t})}onMouseDown(e){this.options.guard(e)||(e.stopPropagation(),e.preventDefault(),this.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},e.data),this.emit("change",{e:e,handle:this}))}onMouseMove(e){this.emit("changing",{e:e,handle:this})}onMouseUp(e){this.emit("changed",{e:e,handle:this}),this.undelegateDocumentEvents(),this.graph.view.delegateEvents()}onDoubleClick(e){this.emit("remove",{e:e,handle:this})}},function(e){const t=Config.prefix("edge-tool-vertex-path");e.config({name:"vertices",snapRadius:20,addable:!0,removable:!0,removeRedundancies:!0,stopPropagation:!0,attrs:{r:6,fill:"#333",stroke:"#fff",cursor:"move","stroke-width":2},createHandle:t=>new e.Handle(t),markup:[{tagName:"path",selector:"connection",className:t,attrs:{fill:"none",stroke:"transparent","stroke-width":10,cursor:"pointer"}}],events:{[`mousedown .${t}`]:"onPathMouseDown",[`touchstart .${t}`]:"onPathMouseDown"}})}(Vertices||(Vertices={}));class Segments extends ToolsView.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}update(){return this.render(),this}onRender(){addClass(this.container,this.prefixClassName("edge-tool-segments")),this.resetHandles();const e=this.cellView,t=[...this.vertices];t.unshift(e.sourcePoint),t.push(e.targetPoint);for(let r=0,n=t.length;r<n-1;r+=1){const e=t[r],n=t[r+1],i=this.renderHandle(e,n,r);this.stamp(i.container),this.handles.push(i)}return this}renderHandle(e,t,r){const n=this.options.createHandle({index:r,graph:this.graph,guard:e=>this.guard(e),attrs:this.options.attrs||{}});return this.options.processHandle&&this.options.processHandle(n),this.updateHandle(n,e,t),this.container.appendChild(n.container),this.startHandleListening(n),n}startHandleListening(e){e.on("change",this.onHandleChange,this),e.on("changing",this.onHandleChanging,this),e.on("changed",this.onHandleChanged,this)}stopHandleListening(e){e.off("change",this.onHandleChange,this),e.off("changing",this.onHandleChanging,this),e.off("changed",this.onHandleChanged,this)}resetHandles(){const e=this.handles;this.handles=[],e&&e.forEach(e=>{this.stopHandleListening(e),e.remove()})}shiftHandleIndexes(e){const t=this.handles;for(let r=0,n=t.length;r<n;r+=1)t[r].options.index+=e}resetAnchor(e,t){const r=this.cellView.cell,n={ui:!0,toolId:this.cid};t?r.prop([e,"anchor"],t,n):r.removeProp([e,"anchor"],n)}snapHandle(e,t,r){const n=e.options.axis,i=e.options.index,o=this.cellView.cell.getVertices(),a=o[i-2]||r.sourceAnchor,s=o[i+1]||r.targetAnchor,l=this.options.snapRadius;return Math.abs(t[n]-a[n])<l?t[n]=a[n]:Math.abs(t[n]-s[n])<l&&(t[n]=s[n]),t}onHandleChanging({handle:e,e:t}){const r=this.graph,n=this.options,i=this.cellView,o=n.anchor,a=e.options.axis,s=e.options.index-1,l=this.getEventData(t),c=this.normalizeEvent(t),u=r.snapToGrid(c.clientX,c.clientY),d=this.snapHandle(e,u.clone(),l),p=cloneDeep(this.vertices);let h=p[s],f=p[s+1];const g=i.sourceView,m=i.sourceBBox;let v=!1,y=!1;if(h?0===s?m.containsPoint(h)?(p.shift(),this.shiftHandleIndexes(-1),v=!0):(h[a]=d[a],y=!0):h[a]=d[a]:(h=i.sourceAnchor.toJSON(),h[a]=d[a],m.containsPoint(h)?v=!0:(p.unshift(h),this.shiftHandleIndexes(1),y=!0)),"function"==typeof o&&g){if(v){const e=l.sourceAnchor.clone();e[a]=d[a];const t=call$1(o,i,e,g,i.sourceMagnet||g.container,"source",i,this);this.resetAnchor("source",t)}y&&this.resetAnchor("source",l.sourceAnchorDef)}const b=i.targetView,q=i.targetBBox;let V=!1,S=!1;if(f?s===p.length-2?q.containsPoint(f)?(p.pop(),V=!0):(f[a]=d[a],S=!0):f[a]=d[a]:(f=i.targetAnchor.toJSON(),f[a]=d[a],q.containsPoint(f)?V=!0:(p.push(f),S=!0)),"function"==typeof o&&b){if(V){const e=l.targetAnchor.clone();e[a]=d[a];const t=call$1(o,i,e,b,i.targetMagnet||b.container,"target",i,this);this.resetAnchor("target",t)}S&&this.resetAnchor("target",l.targetAnchorDef)}Point.equalPoints(p,this.vertices)||this.cellView.cell.setVertices(p,{ui:!0,toolId:this.cid}),this.updateHandle(e,h,f,0),n.stopPropagation||i.notifyMouseMove(c,u.x,u.y)}onHandleChange({handle:e,e:t}){const r=this.options,n=this.handles,i=this.cellView,o=e.options.index;if(Array.isArray(n)){for(let e=0,t=n.length;e<t;e+=1)e!==o&&n[e].hide();if(this.focus(),this.setEventData(t,{sourceAnchor:i.sourceAnchor.clone(),targetAnchor:i.targetAnchor.clone(),sourceAnchorDef:cloneDeep(this.cell.prop(["source","anchor"])),targetAnchorDef:cloneDeep(this.cell.prop(["target","anchor"]))}),this.cell.startBatch("move-segment",{ui:!0,toolId:this.cid}),!r.stopPropagation){const e=this.normalizeEvent(t),r=this.graph.snapToGrid(e.clientX,e.clientY);i.notifyMouseDown(e,r.x,r.y)}}}onHandleChanged({e:e}){const t=this.options,r=this.cellView;t.removeRedundancies&&r.removeRedundantLinearVertices({ui:!0,toolId:this.cid});const n=this.normalizeEvent(e),i=this.graph.snapToGrid(n.clientX,n.clientY);this.render(),this.blur(),this.cell.stopBatch("move-segment",{ui:!0,toolId:this.cid}),t.stopPropagation||r.notifyMouseUp(n,i.x,i.y),r.checkMouseleave(n),t.onChanged&&t.onChanged({edge:r.cell,edgeView:r})}updateHandle(e,t,r,n=0){const i=this.options.precision||0,o=Math.abs(t.x-r.x)<i,a=Math.abs(t.y-r.y)<i;if(o||a){const i=new Line(t,r);if(i.length()<this.options.threshold)e.hide();else{const t=i.getCenter(),r=o?"x":"y";t[r]+=n||0;const a=i.vector().vectorAngle(new Point(1,0));e.updatePosition(t.x,t.y,a,this.cellView),e.show(),e.options.axis=r}}else e.hide()}onRemove(){this.resetHandles()}}Segments2=Segments||(Segments={}),Segments2.Handle=class extends View{constructor(e){super(),this.options=e,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown"})}render(){this.container=View.createElement("rect",!0);const e=this.options.attrs;if("function"==typeof e){const t=Segments2.getDefaults();this.setAttrs(Object.assign(Object.assign({},t.attrs),e(this)))}else this.setAttrs(e);this.addClass(this.prefixClassName("edge-tool-segment"))}updatePosition(e,t,r,n){const i=n.getClosestPoint(new Point(e,t))||new Point(e,t);let o=createSVGMatrix().translate(i.x,i.y);if(i.equals({x:e,y:t}))o=o.rotate(r);else{let r=new Line(e,t,i.x,i.y).vector().vectorAngle(new Point(1,0));0!==r&&(r+=90),o=o.rotate(r)}this.setAttrs({transform:matrixToTransformString(o),cursor:r%180==0?"row-resize":"col-resize"})}onMouseDown(e){this.options.guard(e)||(this.trigger("change",{e:e,handle:this}),e.stopPropagation(),e.preventDefault(),this.options.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},e.data))}onMouseMove(e){this.emit("changing",{e:e,handle:this})}onMouseUp(e){this.emit("changed",{e:e,handle:this}),this.undelegateDocumentEvents(),this.options.graph.view.delegateEvents()}show(){this.container.style.display=""}hide(){this.container.style.display="none"}},function(e){e.config({name:"segments",precision:.5,threshold:40,snapRadius:10,stopPropagation:!0,removeRedundancies:!0,attrs:{width:20,height:8,x:-10,y:-4,rx:4,ry:4,fill:"#333",stroke:"#fff","stroke-width":2},createHandle:t=>new e.Handle(t),anchor:getAnchor})}(Segments||(Segments={}));class Anchor extends ToolsView.ToolItem{get type(){return this.options.type}onRender(){addClass(this.container,this.prefixClassName(`edge-tool-${this.type}-anchor`)),this.toggleArea(!1),this.update()}update(){const e=this.type;return this.cellView.getTerminalView(e)?(this.updateAnchor(),this.updateArea(),this.container.style.display=""):this.container.style.display="none",this}updateAnchor(){const e=this.childNodes;if(!e)return;const t=e.anchor;if(!t)return;const r=this.type,n=this.cellView,i=this.options,o=n.getTerminalAnchor(r),a=n.cell.prop([r,"anchor"]);t.setAttribute("transform",`translate(${o.x}, ${o.y})`);const s=a?i.customAnchorAttrs:i.defaultAnchorAttrs;s&&Object.keys(s).forEach(e=>{t.setAttribute(e,s[e])})}updateArea(){const e=this.childNodes;if(!e)return;const t=e.area;if(!t)return;const r=this.type,n=this.cellView,i=n.getTerminalView(r);if(i){const e=i.cell,o=n.getTerminalMagnet(r);let a,s,l,c=this.options.areaPadding||0;Number.isFinite(c)||(c=0),i.isEdgeElement(o)?(a=i.getBBox(),s=0,l=a.getCenter()):(a=i.getUnrotatedBBoxOfElement(o),s=e.getAngle(),l=a.getCenter(),s&&l.rotate(-s,e.getBBox().getCenter())),a.inflate(c),attr(t,{x:-a.width/2,y:-a.height/2,width:a.width,height:a.height,transform:`translate(${l.x}, ${l.y}) rotate(${s})`})}}toggleArea(e){if(this.childNodes){const t=this.childNodes.area;t&&(t.style.display=e?"":"none")}}onMouseDown(e){this.guard(e)||(e.stopPropagation(),e.preventDefault(),this.graph.view.undelegateEvents(),this.options.documentEvents&&this.delegateDocumentEvents(this.options.documentEvents),this.focus(),this.toggleArea(this.options.restrictArea),this.cell.startBatch("move-anchor",{ui:!0,toolId:this.cid}))}resetAnchor(e){const t=this.type,r=this.cell;e?r.prop([t,"anchor"],e,{rewrite:!0,ui:!0,toolId:this.cid}):r.removeProp([t,"anchor"],{ui:!0,toolId:this.cid})}onMouseMove(e){const t=this.type,r=this.cellView,n=r.getTerminalView(t);if(null==n)return;const i=this.normalizeEvent(e),o=n.cell,a=r.getTerminalMagnet(t);let s=this.graph.coord.clientToLocalPoint(i.clientX,i.clientY);const l=this.options.snap;if("function"==typeof l){const e=call$1(l,r,s,n,a,t,r,this);s=Point.create(e)}if(this.options.restrictArea)if(n.isEdgeElement(a)){const e=n.getClosestPoint(s);e&&(s=e)}else{const e=n.getUnrotatedBBoxOfElement(a),t=o.getAngle(),r=o.getBBox().getCenter(),i=s.clone().rotate(t,r);e.containsPoint(i)||(s=e.getNearestPointToPoint(i).rotate(-t,r))}let c;const u=this.options.anchor;"function"==typeof u&&(c=call$1(u,r,s,n,a,t,r,this)),this.resetAnchor(c),this.update()}onMouseUp(e){this.graph.view.delegateEvents(),this.undelegateDocumentEvents(),this.blur(),this.toggleArea(!1);const t=this.cellView;this.options.removeRedundancies&&t.removeRedundantLinearVertices({ui:!0,toolId:this.cid}),this.cell.stopBatch("move-anchor",{ui:!0,toolId:this.cid})}onDblClick(){const e=this.options.resetAnchor;e&&this.resetAnchor(!0===e?void 0:e),this.update()}}Anchor2=Anchor||(Anchor={}),Anchor2.config({tagName:"g",markup:[{tagName:"circle",selector:"anchor",attrs:{cursor:"pointer"}},{tagName:"rect",selector:"area",attrs:{"pointer-events":"none",fill:"none",stroke:"#33334F","stroke-dasharray":"2,4",rx:5,ry:5}}],events:{mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDblClick"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},customAnchorAttrs:{"stroke-width":4,stroke:"#33334F",fill:"#FFFFFF",r:5},defaultAnchorAttrs:{"stroke-width":2,stroke:"#FFFFFF",fill:"#33334F",r:6},areaPadding:6,snapRadius:10,resetAnchor:!0,restrictArea:!0,removeRedundancies:!0,anchor:getAnchor,snap(e,t,r,n,i,o){const a=o.options.snapRadius||0,s="source"===n,l=s?0:-1,c=this.cell.getVertexAt(l)||this.getTerminalAnchor(s?"target":"source");return c&&(Math.abs(c.x-e.x)<a&&(e.x=c.x),Math.abs(c.y-e.y)<a&&(e.y=c.y)),e}});const SourceAnchor=Anchor.define({name:"source-anchor",type:"source"}),TargetAnchor=Anchor.define({name:"target-anchor",type:"target"});var __rest$g=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},Arrowhead2;class Arrowhead extends ToolsView.ToolItem{get type(){return this.options.type}get ratio(){return this.options.ratio}init(){if(this.options.attrs){const e=this.options.attrs,{class:t}=e,r=__rest$g(e,["class"]);this.setAttrs(r,this.container),t&&addClass(this.container,t)}}onRender(){addClass(this.container,this.prefixClassName(`edge-tool-${this.type}-arrowhead`)),this.update()}update(){const e=this.ratio,t=this.cellView,r=t.getTangentAtRatio(e),n=r?r.start:t.getPointAtRatio(e),i=r&&r.vector().vectorAngle(new Point(1,0))||0;if(!n)return this;const o=createSVGMatrix().translate(n.x,n.y).rotate(i);return transform(this.container,o,{absolute:!0}),this}onMouseDown(e){if(this.guard(e))return;e.stopPropagation(),e.preventDefault();const t=this.cellView;if(t.can("arrowheadMovable")){t.cell.startBatch("move-arrowhead",{ui:!0,toolId:this.cid});const r=this.graph.snapToGrid(e.clientX,e.clientY),n=t.prepareArrowheadDragging(this.type,{x:r.x,y:r.y,options:Object.assign(Object.assign({},this.options),{toolId:this.cid})});this.cellView.setEventData(e,n),this.delegateDocumentEvents(this.options.documentEvents,e.data),t.graph.view.undelegateEvents(),this.container.style.pointerEvents="none"}this.focus()}onMouseMove(e){const t=this.normalizeEvent(e),r=this.graph.snapToGrid(t.clientX,t.clientY);this.cellView.onMouseMove(t,r.x,r.y),this.update()}onMouseUp(e){this.undelegateDocumentEvents();const t=this.normalizeEvent(e),r=this.cellView,n=this.graph.snapToGrid(t.clientX,t.clientY);r.onMouseUp(t,n.x,n.y),this.graph.view.delegateEvents(),this.blur(),this.container.style.pointerEvents="",r.cell.stopBatch("move-arrowhead",{ui:!0,toolId:this.cid})}}Arrowhead2=Arrowhead||(Arrowhead={}),Arrowhead2.config({tagName:"path",isSVGElement:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}});const SourceArrowhead=Arrowhead.define({name:"source-arrowhead",type:"source",ratio:0,attrs:{d:"M 10 -8 -10 0 10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}}),TargetArrowhead=Arrowhead.define({name:"target-arrowhead",type:"target",ratio:1,attrs:{d:"M -10 -8 10 0 -10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}});class CellEditor extends ToolsView.ToolItem{constructor(){super(...arguments),this.labelIndex=-1,this.distance=.5,this.dblClick=this.onCellDblClick.bind(this)}onRender(){const e=this.cellView;e&&e.on("cell:dblclick",this.dblClick)}createElement(){const e=[this.prefixClassName((this.cell.isEdge()?"edge":"node")+"-tool-editor"),this.prefixClassName("cell-tool-editor")];this.editor=ToolsView.createElement("div",!1),this.addClass(e,this.editor),this.editor.contentEditable="true",this.container.appendChild(this.editor)}removeElement(){this.undelegateDocumentEvents(),this.editor&&(this.container.removeChild(this.editor),this.editor=null)}updateEditor(){const{cell:e,editor:t}=this;if(!t)return;const{style:r}=t;e.isNode()?this.updateNodeEditorTransform():e.isEdge()&&this.updateEdgeEditorTransform();const{attrs:n}=this.options;r.fontSize=`${n.fontSize}px`,r.fontFamily=n.fontFamily,r.color=n.color,r.backgroundColor=n.backgroundColor;const i=this.getCellText()||"";return t.innerText=i,this.setCellText(""),this}updateNodeEditorTransform(){const{graph:e,cell:t,editor:r}=this;if(!r)return;let n=Point.create(),i=20,o="",{x:a,y:s}=this.options;const{width:l,height:c}=this.options;if(void 0!==a&&void 0!==s){const e=t.getBBox();a=normalizePercentage(a,e.width),s=normalizePercentage(s,e.height),n=e.topLeft.translate(a,s),i=e.width-2*a}else{const e=t.getBBox();n=e.center,i=e.width-4,o="translate(-50%, -50%)"}const u=e.scale(),{style:d}=r;n=e.localToGraph(n),d.left=`${n.x}px`,d.top=`${n.y}px`,d.transform=`scale(${u.sx}, ${u.sy}) ${o}`,d.minWidth=`${i}px`,"number"==typeof l&&(d.width=`${l}px`),"number"==typeof c&&(d.height=`${c}px`)}updateEdgeEditorTransform(){if(!this.event)return;const{graph:e,editor:t}=this;if(!t)return;let r=Point.create(),n=20;const{style:i}=t,o=this.event.target,a=o.parentElement;if(a&&hasClass(a,this.prefixClassName("edge-label"))){const e=a.getAttribute("data-index")||"0";this.labelIndex=parseInt(e,10);const t=a.getAttribute("transform"),{translation:i}=parseTransformString(t);r=new Point(i.tx,i.ty),n=Util$1.getBBox(o).width}else{if(!this.options.labelAddable)return this;r=e.clientToLocal(Point.create(this.event.clientX,this.event.clientY));const t=this.cellView.path.closestPointLength(r);this.distance=t,this.labelIndex=-1}r=e.localToGraph(r);const s=e.scale();i.left=`${r.x}px`,i.top=`${r.y}px`,i.minWidth=`${n}px`,i.transform=`scale(${s.sx}, ${s.sy}) translate(-50%, -50%)`}onDocumentMouseUp(e){if(this.editor&&e.target!==this.editor){const e=this.editor.innerText.replace(/\n$/,"")||"";this.setCellText(""!==e?e:null),this.removeElement()}}onCellDblClick({e:e}){this.editor||(e.stopPropagation(),this.removeElement(),this.event=e,this.createElement(),this.updateEditor(),this.autoFocus(),this.delegateDocumentEvents(this.options.documentEvents))}onMouseDown(e){e.stopPropagation()}autoFocus(){setTimeout(()=>{this.editor&&(this.editor.focus(),this.selectText())})}selectText(){if(window.getSelection&&this.editor){const e=document.createRange(),t=window.getSelection();e.selectNodeContents(this.editor),t.removeAllRanges(),t.addRange(e)}}getCellText(){const{getText:e}=this.options;if("function"==typeof e)return call$1(e,this.cellView,{cell:this.cell,index:this.labelIndex});if("string"==typeof e){if(this.cell.isNode())return this.cell.attr(e);if(this.cell.isEdge()&&-1!==this.labelIndex)return this.cell.prop(`labels/${this.labelIndex}/attrs/${e}`)}}setCellText(e){const t=this.options.setText;if("function"!=typeof t){if("string"==typeof t){if(this.cell.isNode())return void(null!==e&&this.cell.attr(t,e));if(this.cell.isEdge()){const r=this.cell;if(-1===this.labelIndex){if(e){const n={position:{distance:this.distance},attrs:{}};setByPath(n,`attrs/${t}`,e),r.appendLabel(n)}}else null!==e?r.prop(`labels/${this.labelIndex}/attrs/${t}`,e):"number"==typeof this.labelIndex&&r.removeLabelAt(this.labelIndex)}}}else call$1(t,this.cellView,{cell:this.cell,value:e,index:this.labelIndex,distance:this.distance})}onRemove(){const e=this.cellView;e&&e.off("cell:dblclick",this.dblClick),this.removeElement()}}var CellEditor2;CellEditor2=CellEditor||(CellEditor={}),CellEditor2.config({tagName:"div",isSVGElement:!1,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mouseup:"onDocumentMouseUp",touchend:"onDocumentMouseUp",touchcancel:"onDocumentMouseUp"}}),function(e){e.NodeEditor=e.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},getText:"text/text",setText:"text/text"}),e.EdgeEditor=e.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},labelAddable:!0,getText:"label/text",setText:"label/text"})}(CellEditor||(CellEditor={}));var __rest$f=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},NodeTool,NodeTool2,EdgeTool,EdgeTool2;NodeTool2=NodeTool||(NodeTool={}),NodeTool2.presets={boundary:Boundary,button:Button,"button-remove":Button.Remove,"node-editor":CellEditor.NodeEditor},NodeTool2.registry=Registry.create({type:"node tool",process(e,t){if("function"==typeof t)return t;let r=ToolsView.ToolItem;const{inherit:n}=t,i=__rest$f(t,["inherit"]);if(n){const e=this.get(n);null==e?this.onNotFound(n,"inherited"):r=e}return null==i.name&&(i.name=e),r.define.call(r,i)}}),NodeTool2.registry.register(NodeTool2.presets,!0),EdgeTool2=EdgeTool||(EdgeTool={}),EdgeTool2.presets={boundary:Boundary,vertices:Vertices,segments:Segments,button:Button,"button-remove":Button.Remove,"source-anchor":SourceAnchor,"target-anchor":TargetAnchor,"source-arrowhead":SourceArrowhead,"target-arrowhead":TargetArrowhead,"edge-editor":CellEditor.EdgeEditor},EdgeTool2.registry=Registry.create({type:"edge tool",process(e,t){if("function"==typeof t)return t;let r=ToolsView.ToolItem;const{inherit:n}=t,i=__rest$f(t,["inherit"]);if(n){const e=this.get(n);null==e?this.onNotFound(n,"inherited"):r=e}return null==i.name&&(i.name=e),r.define.call(r,i)}}),EdgeTool2.registry.register(EdgeTool2.presets,!0);const center=createBBoxAnchor("center"),top$1=createBBoxAnchor("topCenter"),bottom=createBBoxAnchor("bottomCenter"),left$1=createBBoxAnchor("leftMiddle"),right=createBBoxAnchor("rightMiddle"),topLeft=createBBoxAnchor("topLeft"),topRight=createBBoxAnchor("topRight"),bottomLeft=createBBoxAnchor("bottomLeft"),bottomRight=createBBoxAnchor("bottomRight");function createBBoxAnchor(e){return function(t,r,n,i={}){let o;o=t.cell.visible?i.rotate?t.getUnrotatedBBoxOfElement(r):t.getBBoxOfElement(r):t.cell.getBBox();const a=o[e];a.x+=normalizePercentage(i.dx,o.width),a.y+=normalizePercentage(i.dy,o.height);const s=t.cell;return i.rotate?a.rotate(-s.getAngle(),s.getBBox().getCenter()):a}}function resolve$1(e){return function(t,r,n,i){if(n instanceof Element){const o=this.graph.findViewByElem(n);let a;if(o)if(o.isEdgeElement(n)){a=getPointAtEdge(o,null!=i.fixedAt?i.fixedAt:"50%")}else a=o.getBBoxOfElement(n).getCenter();else a=new Point;return e.call(this,t,r,a,i)}return e.apply(this,arguments)}}function getPointAtEdge(e,t){const r=isPercentage(t),n="string"==typeof t?parseFloat(t):t;return r?e.getPointAtRatio(n/100):e.getPointAtLength(n)}const orthogonal$1=function(e,t,r,n){const i=Angle.normalize(e.cell.getAngle()),o=e.cell.visible?e.getBBoxOfElement(t):e.cell.getBBox(),a=o.getCenter(),s=o.getTopLeft(),l=o.getBottomRight();let c=n.padding;if(Number.isFinite(c)||(c=0),s.y+c<=r.y&&r.y<=l.y-c){const e=r.y-a.y;a.x+=0===i||180===i?0:1*e/Math.tan(Angle.toRad(i)),a.y+=e}else if(s.x+c<=r.x&&r.x<=l.x-c){const e=r.x-a.x;a.y+=90===i||270===i?0:e*Math.tan(Angle.toRad(i)),a.x+=e}return a},orth$2=resolve$1(orthogonal$1),nodeCenter=function(e,t,r,n,i){const o=e.cell.getConnectionPoint(this.cell,i);return(n.dx||n.dy)&&o.translate(n.dx||0,n.dy||0),o},middleSide=function(e,t,r,n){let i,o,a=0;const s=e.cell;n.rotate?(i=e.getUnrotatedBBoxOfElement(t),o=s.getBBox().getCenter(),a=s.getAngle()):i=s.visible?e.getBBoxOfElement(t):e.cell.getBBox();const l=n.padding;null!=l&&Number.isFinite(l)&&i.inflate(l),n.rotate&&r.rotate(a,o);const c=i.getNearestSideToPoint(r);let u;switch(c){case"left":u=i.getLeftMiddle();break;case"right":u=i.getRightMiddle();break;case"top":u=i.getTopCenter();break;case"bottom":u=i.getBottomCenter()}const d=n.direction;return"H"===d?"top"!==c&&"bottom"!==c||(u=r.x<=i.x+i.width?i.getLeftMiddle():i.getRightMiddle()):"V"===d&&(u=r.y<=i.y+i.height?i.getTopCenter():i.getBottomCenter()),n.rotate?u.rotate(-a,o):u},midSide=resolve$1(middleSide),anchors$1=Object.freeze(Object.defineProperty({__proto__:null,bottom:bottom,bottomLeft:bottomLeft,bottomRight:bottomRight,center:center,left:left$1,midSide:midSide,nodeCenter:nodeCenter,orth:orth$2,right:right,top:top$1,topLeft:topLeft,topRight:topRight},Symbol.toStringTag,{value:"Module"}));var NodeAnchor,NodeAnchor2;NodeAnchor2=NodeAnchor||(NodeAnchor={}),NodeAnchor2.presets=anchors$1,NodeAnchor2.registry=Registry.create({type:"node endpoint"}),NodeAnchor2.registry.register(NodeAnchor2.presets,!0);const ratio=function(e,t,r,n){let i=null!=n.ratio?n.ratio:.5;return i>1&&(i/=100),e.getPointAtRatio(i)},length=function(e,t,r,n){const i=null!=n.length?n.length:20;return e.getPointAtLength(i)},getClosestPoint=function(e,t,r,n){const i=e.getClosestPoint(r);return null!=i?i:new Point},closest=resolve$1(getClosestPoint),orthogonal=function(e,t,r,n){const i=1e6,o=e.getConnection(),a=e.getConnectionSubdivisions(),s=new Line(r.clone().translate(0,i),r.clone().translate(0,-i)),l=new Line(r.clone().translate(i,0),r.clone().translate(-i,0)),c=s.intersect(o,{segmentSubdivisions:a}),u=l.intersect(o,{segmentSubdivisions:a}),d=[];return c&&d.push(...c),u&&d.push(...u),d.length>0?r.closest(d):null!=n.fallbackAt?getPointAtEdge(e,n.fallbackAt):call$1(getClosestPoint,this,e,t,r,n)},orth$1=resolve$1(orthogonal),anchors=Object.freeze(Object.defineProperty({__proto__:null,closest:closest,length:length,orth:orth$1,ratio:ratio},Symbol.toStringTag,{value:"Module"}));var EdgeAnchor,EdgeAnchor2;function offset(e,t,r){let n;if("object"==typeof r){if(Number.isFinite(r.y)){const n=new Line(t,e),{start:i,end:o}=n.parallel(r.y);t=i,e=o}n=r.x}else n=r;if(null==n||!Number.isFinite(n))return e;const i=e.distance(t);return 0===n&&i>0?e:e.move(t,-Math.min(n,i-1))}function getStrokeWidth(e){const t=e.getAttribute("stroke-width");return null===t?0:parseFloat(t)||0}function findShapeNode(e){if(null==e)return null;let t=e;do{let e=t.tagName;if("string"!=typeof e)return null;if(e=e.toUpperCase(),"G"===e)t=t.firstElementChild;else{if("TITLE"!==e)break;t=t.nextElementSibling}}while(t);return t}EdgeAnchor2=EdgeAnchor||(EdgeAnchor={}),EdgeAnchor2.presets=anchors,EdgeAnchor2.registry=Registry.create({type:"edge endpoint"}),EdgeAnchor2.registry.register(EdgeAnchor2.presets,!0);const bbox=function(e,t,r,n){const i=t.getBBoxOfElement(r);n.stroked&&i.inflate(getStrokeWidth(r)/2);const o=e.intersect(i);return offset(o&&o.length?e.start.closest(o):e.end,e.start,n.offset)},rect=function(e,t,r,n,i){const o=t.cell,a=o.isNode()?o.getAngle():0;if(0===a)return call$1(bbox,this,e,t,r,n,i);const s=t.getUnrotatedBBoxOfElement(r);n.stroked&&s.inflate(getStrokeWidth(r)/2);const l=s.getCenter(),c=e.clone().rotate(a,l),u=c.setLength(1e6).intersect(s);return offset(u&&u.length?c.start.closest(u).rotate(-a,l):e.end,e.start,n.offset)},boundary=function(e,t,r,n){let i,o;const a=e.end,s=n.selector;if(i="string"==typeof s?t.findOne(s):Array.isArray(s)?getByPath(r,s):findShapeNode(r),!isSVGGraphicsElement$1(i)){if(i===r||!isSVGGraphicsElement$1(r))return a;i=r}const l=t.getShapeOfElement(i),c=t.getMatrixOfElement(i),u=t.getRootTranslatedMatrix(),d=t.getRootRotatedMatrix(),p=u.multiply(d).multiply(c),h=p.inverse(),f=Util$1.transformLine(e,h),g=f.start.clone(),m=t.getDataOfElement(i);if(!1===n.insideout){null==m.shapeBBox&&(m.shapeBBox=l.bbox());const e=m.shapeBBox;if(null!=e&&e.containsPoint(g))return a}let v;if(!0===n.extrapolate&&f.setLength(1e6),Path.isPath(l)){const e=n.precision||2;null==m.segmentSubdivisions&&(m.segmentSubdivisions=l.getSegmentSubdivisions({precision:e})),v={precision:e,segmentSubdivisions:m.segmentSubdivisions},o=f.intersect(l,v)}else o=f.intersect(l);o?Array.isArray(o)&&(o=g.closest(o)):!0===n.sticky&&(o=Rectangle.isRectangle(l)?l.getNearestPointToPoint(g):Ellipse.isEllipse(l)?l.intersectsWithLineFromCenterToPoint(g):l.closestPoint(g,v));const y=o?Util$1.transformPoint(o,p):a;let b=n.offset||0;return!1!==n.stroked&&("object"==typeof b?(b=Object.assign({},b),null==b.x&&(b.x=0),b.x+=getStrokeWidth(i)/2):b+=getStrokeWidth(i)/2),offset(y,e.start,b)};function alignLine(e,t,r=0){const{start:n,end:i}=e;let o,a,s,l;switch(t){case"left":l="x",o=i,a=n,s=-1;break;case"right":l="x",o=n,a=i,s=1;break;case"top":l="y",o=i,a=n,s=-1;break;case"bottom":l="y",o=n,a=i,s=1;break;default:return}n[l]<i[l]?o[l]=a[l]:a[l]=o[l],Number.isFinite(r)&&(o[l]+=s*r,a[l]+=s*r)}const anchor=function(e,t,r,n){const{alignOffset:i,align:o}=n;return o&&alignLine(e,o,i),offset(e.end,e.start,n.offset)},connectionPoints=Object.freeze(Object.defineProperty({__proto__:null,anchor:anchor,bbox:bbox,boundary:boundary,rect:rect},Symbol.toStringTag,{value:"Module"}));var ConnectionPoint,ConnectionPoint2;ConnectionPoint2=ConnectionPoint||(ConnectionPoint={}),ConnectionPoint2.presets=connectionPoints,ConnectionPoint2.registry=Registry.create({type:"connection point"}),ConnectionPoint2.registry.register(ConnectionPoint2.presets,!0);const normal$1=function(e){return[...e]},oneSide=function(e,t,r){const n=t.side||"bottom",i=normalizeSides(t.padding||40),o=r.sourceBBox,a=r.targetBBox,s=o.getCenter(),l=a.getCenter();let c,u,d;switch(n){case"top":d=-1,c="y",u="height";break;case"left":d=-1,c="x",u="width";break;case"right":d=1,c="x",u="width";break;default:d=1,c="y",u="height"}return s[c]+=d*(o[u]/2+i[n]),l[c]+=d*(a[u]/2+i[n]),d*(s[c]-l[c])>0?l[c]=s[c]:s[c]=l[c],[s.toJSON(),...e,l.toJSON()]};function getPointBBox(e){return new Rectangle(e.x,e.y,0,0)}function getPaddingBox(e={}){const t=normalizeSides(e.padding||20);return{x:-t.left,y:-t.top,width:t.left+t.right,height:t.top+t.bottom}}function getSourceBBox$1(e,t={}){return e.sourceBBox.clone().moveAndExpand(getPaddingBox(t))}function getTargetBBox$1(e,t={}){return e.targetBBox.clone().moveAndExpand(getPaddingBox(t))}function getSourceAnchor(e,t={}){if(e.sourceAnchor)return e.sourceAnchor;return getSourceBBox$1(e,t).getCenter()}function getTargetAnchor(e,t={}){if(e.targetAnchor)return e.targetAnchor;return getTargetBBox$1(e,t).getCenter()}const orth=function(e,t,r){let n=getSourceBBox$1(r,t),i=getTargetBBox$1(r,t);const o=getSourceAnchor(r,t),a=getTargetAnchor(r,t);n=n.union(getPointBBox(o)),i=i.union(getPointBBox(a));const s=e.map(e=>Point.create(e));s.unshift(o),s.push(a);let l=null;const c=[];for(let u=0,d=s.length-1;u<d;u+=1){let e=null;const r=s[u],o=s[u+1],a=null!=Private$2.getBearing(r,o);if(0===u)u+1===d?n.intersectsWithRect(i.clone().inflate(1))?e=Private$2.insideNode(r,o,n,i):a||(e=Private$2.nodeToNode(r,o,n,i)):n.containsPoint(o)?e=Private$2.insideNode(r,o,n,getPointBBox(o).moveAndExpand(getPaddingBox(t))):a||(e=Private$2.nodeToVertex(r,o,n));else if(u+1===d){const n=a&&Private$2.getBearing(o,r)===l;i.containsPoint(r)||n?e=Private$2.insideNode(r,o,getPointBBox(r).moveAndExpand(getPaddingBox(t)),i,l):a||(e=Private$2.vertexToNode(r,o,i,l))}else a||(e=Private$2.vertexToVertex(r,o,l));e?(c.push(...e.points),l=e.direction):l=Private$2.getBearing(r,o),u+1<d&&c.push(o)}return c};var Private$2;!function(e){const t={N:"S",S:"N",E:"W",W:"E"},r={N:-Math.PI/2*3,S:-Math.PI/2,E:0,W:Math.PI};function n(e,t,r){let n=new Point(e.x,t.y);return r.containsPoint(n)&&(n=new Point(t.x,e.y)),n}function i(e,t){return e["W"===t||"E"===t?"width":"height"]}function o(e,t){return e.x===t.x?e.y>t.y?"N":"S":e.y===t.y?e.x>t.x?"W":"E":null}function a(e,r,n){const i=new Point(e.x,r.y),a=new Point(r.x,e.y),s=o(e,i),l=o(e,a),c=n?t[n]:null,u=s===n||s!==c&&(l===c||l!==n)?i:a;return{points:[u],direction:o(u,r)}}function s(e,t,r){const i=n(e,t,r);return{points:[i],direction:o(i,t)}}e.getBBoxSize=i,e.getBearing=o,e.vertexToVertex=a,e.nodeToVertex=s,e.vertexToNode=function(e,t,r,a){const s=[new Point(e.x,t.y),new Point(t.x,e.y)],l=s.filter(e=>!r.containsPoint(e)),c=l.filter(t=>o(t,e)!==a);let u;if(c.length>0)return u=c.filter(t=>o(e,t)===a).pop(),u=u||c[0],{points:[u],direction:o(u,t)};{u=difference(s,l)[0];const c=Point.create(t).move(u,-i(r,a)/2);return{points:[n(c,e,r),c],direction:o(c,t)}}},e.nodeToNode=function(e,t,r,n){let l=s(t,e,n);const c=l.points[0];if(r.containsPoint(c)){l=s(e,t,r);const u=l.points[0];if(n.containsPoint(u)){const d=Point.create(e).move(u,-i(r,o(e,u))/2),p=Point.create(t).move(c,-i(n,o(t,c))/2),h=new Line(d,p).getCenter(),f=s(e,h,r),g=a(h,t,f.direction);l.points=[f.points[0],g.points[0]],l.direction=g.direction}}return l},e.insideNode=function(e,t,i,a,s){const l=i.union(a).inflate(1),c=l.getCenter(),u=c.distance(t)>c.distance(e),d=u?t:e,p=u?e:t;let h,f,g,m;return s?(h=Point.fromPolar(l.width+l.height,r[s],d),h=l.getNearestPointToPoint(h).move(h,-1)):h=l.getNearestPointToPoint(d).move(d,1),f=n(h,p,l),h.round().equals(f.round())?(f=Point.fromPolar(l.width+l.height,Angle.toRad(h.theta(d))+Math.PI/2,p),f=l.getNearestPointToPoint(f).move(p,1).round(),g=n(h,f,l),m=u?[f,g,h]:[h,g,f]):m=u?[f,h]:[h,f],{points:m,direction:o(u?h:f,t)}}}(Private$2||(Private$2={}));const defaults$2={step:10,maxLoopCount:2e3,precision:1,maxDirectionChange:90,perpendicular:!0,excludeTerminals:[],excludeNodes:[],excludeShapes:[],startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{top:{x:0,y:-1},right:{x:1,y:0},bottom:{x:0,y:1},left:{x:-1,y:0}},cost(){return resolve(this.step,this)},directions(){const e=resolve(this.step,this),t=resolve(this.cost,this);return[{cost:t,offsetX:e,offsetY:0},{cost:t,offsetX:-e,offsetY:0},{cost:t,offsetX:0,offsetY:e},{cost:t,offsetX:0,offsetY:-e}]},penalties(){const e=resolve(this.step,this);return{0:0,45:e/2,90:e/2}},paddingBox(){const e=resolve(this.step,this);return{x:-e,y:-e,width:2*e,height:2*e}},fallbackRouter:orth,draggingRouter:null,snapToGrid:!0};function resolve(e,t){return"function"==typeof e?e.call(t):e}function resolveOptions(e){const t=Object.keys(e).reduce((t,r)=>{const n=t;return n[r]="fallbackRouter"===r||"draggingRouter"===r||"fallbackRoute"===r?e[r]:resolve(e[r],e),t},{});if(t.padding){const e=normalizeSides(t.padding);t.paddingBox={x:-e.left,y:-e.top,width:e.left+e.right,height:e.top+e.bottom}}return t.directions.forEach(e=>{const t=new Point(0,0),r=new Point(e.offsetX,e.offsetY);e.angle=Angle.normalize(t.theta(r))}),t}const OPEN=1,CLOSE=2;class SortedSet{constructor(){this.items=[],this.hash={},this.values={}}add(e,t){this.hash[e]?this.items.splice(this.items.indexOf(e),1):this.hash[e]=OPEN,this.values[e]=t;const r=sortedIndexBy(this.items,e,e=>this.values[e]);this.items.splice(r,0,e)}pop(){const e=this.items.shift();return e&&(this.hash[e]=CLOSE),e}isOpen(e){return this.hash[e]===OPEN}isClose(e){return this.hash[e]===CLOSE}isEmpty(){return 0===this.items.length}}class ObstacleMap{constructor(e){this.options=e,this.mapGridSize=100,this.map={}}build(e,t){const r=this.options,n=r.excludeTerminals.reduce((r,n)=>{const i=t[n];if(i){const t=e.getCell(i.cell);t&&r.push(t)}return r},[]);let i=[];const o=e.getCell(t.getSourceCellId());o&&(i=union(i,o.getAncestors().map(e=>e.id)));const a=e.getCell(t.getTargetCellId());a&&(i=union(i,a.getAncestors().map(e=>e.id)));const s=this.mapGridSize;return e.getNodes().reduce((e,t)=>{const o=n.some(e=>e.id===t.id),a=!!t.shape&&r.excludeShapes.includes(t.shape),l=r.excludeNodes.some(e=>"string"==typeof e?t.id===e:e===t),c=i.includes(t.id),u=a||o||l||c;if(t.isVisible()&&!u){const n=t.getBBox().moveAndExpand(r.paddingBox),i=n.getOrigin().snapToGrid(s),o=n.getCorner().snapToGrid(s);for(let t=i.x;t<=o.x;t+=s)for(let r=i.y;r<=o.y;r+=s){const i=new Point(t,r).toString();null==e[i]&&(e[i]=[]),e[i].push(n)}}return e},this.map),this}isAccessible(e){const t=e.clone().snapToGrid(this.mapGridSize).toString(),r=this.map[t];return!r||r.every(t=>!t.containsPoint(e))}}function getSourceBBox(e,t){const r=e.sourceBBox.clone();return t&&t.paddingBox?r.moveAndExpand(t.paddingBox):r}function getTargetBBox(e,t){const r=e.targetBBox.clone();return t&&t.paddingBox?r.moveAndExpand(t.paddingBox):r}function getSourceEndpoint(e,t){if(e.sourceAnchor)return e.sourceAnchor;return getSourceBBox(e,t).getCenter()}function getTargetEndpoint(e,t){if(e.targetAnchor)return e.targetAnchor;return getTargetBBox(e,t).getCenter()}function getDirectionAngle(e,t,r,n,i){const o=360/r,a=e.theta(fixAngleEnd(e,t,n,i)),s=Angle.normalize(a+o/2);return o*Math.floor(s/o)}function fixAngleEnd(e,t,r,n){const i=n.step,o=t.x-e.x,a=t.y-e.y,s=o/r.x*i,l=a/r.y*i;return new Point(e.x+s,e.y+l)}function getDirectionChange(e,t){const r=Math.abs(e-t);return r>180?360-r:r}function getGridOffsets(e,t){const r=t.step;return t.directions.forEach(t=>{t.gridOffsetX=t.offsetX/r*e.x,t.gridOffsetY=t.offsetY/r*e.y}),t.directions}function getGrid(e,t,r){return{source:t.clone(),x:getGridDimension(r.x-t.x,e),y:getGridDimension(r.y-t.y,e)}}function getGridDimension(e,t){if(!e)return t;const r=Math.abs(e),n=Math.round(r/t);if(!n)return r;return t+(r-n*t)/n}function snapGrid(e,t){const r=t.source,n=GeometryUtil.snapToGrid(e.x-r.x,t.x)+r.x,i=GeometryUtil.snapToGrid(e.y-r.y,t.y)+r.y;return new Point(n,i)}function round(e,t){return e.round(t)}function align(e,t,r){return round(snapGrid(e.clone(),t),r)}function getKey(e){return e.toString()}function normalizePoint(e){return new Point(0===e.x?0:Math.abs(e.x)/e.x,0===e.y?0:Math.abs(e.y)/e.y)}function getCost(e,t){let r=1/0;for(let n=0,i=t.length;n<i;n+=1){const i=e.manhattanDistance(t[n]);i<r&&(r=i)}return r}function getRectPoints(e,t,r,n,i){const o=i.precision,a=i.directionMap,s=e.diff(t.getCenter()),l=Object.keys(a).reduce((i,l)=>{if(r.includes(l)){const r=a[l],c=new Point(e.x+r.x*(Math.abs(s.x)+t.width),e.y+r.y*(Math.abs(s.y)+t.height)),u=new Line(e,c).intersect(t)||[];let d,p=null;for(let t=0;t<u.length;t+=1){const r=u[t],n=e.squaredDistance(r);(null==d||n>d)&&(d=n,p=r)}if(p){let e=align(p,n,o);t.containsPoint(e)&&(e=align(e.translate(r.x*n.x,r.y*n.y),n,o)),i.push(e)}}return i},[]);return t.containsPoint(e)||l.push(align(e,n,o)),l}function reconstructRoute(e,t,r,n,i){const o=[];let a,s=normalizePoint(i.diff(r)),l=getKey(r),c=e[l];for(;c;){a=t[l];const r=normalizePoint(a.diff(c));r.equals(s)||(o.unshift(a),s=r),l=getKey(c),c=e[l]}const u=t[l];return normalizePoint(u.diff(n)).equals(s)||o.unshift(u),o}function findRoute(e,t,r,n,i){const o=i.precision;let a,s;a=Rectangle.isRectangle(t)?round(getSourceEndpoint(e,i).clone(),o):round(t.clone(),o),s=Rectangle.isRectangle(r)?round(getTargetEndpoint(e,i).clone(),o):round(r.clone(),o);const l=getGrid(i.step,a,s),c=a,u=s;let d,p;if(d=Rectangle.isRectangle(t)?getRectPoints(c,t,i.startDirections,l,i):[c],p=Rectangle.isRectangle(r)?getRectPoints(s,r,i.endDirections,l,i):[u],d=d.filter(e=>n.isAccessible(e)),p=p.filter(e=>n.isAccessible(e)),d.length>0&&p.length>0){const e=new SortedSet,t={},r={},a={};for(let n=0,i=d.length;n<i;n+=1){const r=d[n],i=getKey(r);e.add(i,getCost(r,p)),t[i]=r,a[i]=0}const s=i.previousDirectionAngle,h=void 0===s;let f,g;const m=getGridOffsets(l,i),v=m.length,y=p.reduce((e,t)=>{const r=getKey(t);return e.push(r),e},[]),b=Point.equalPoints(d,p);let q=i.maxLoopCount;for(;!e.isEmpty()&&q>0;){const d=e.pop(),V=t[d],S=r[d],E=a[d],x=V.equals(c),C=null==S;let w;w=C?h?x?null:getDirectionAngle(c,V,v,l,i):s:getDirectionAngle(S,V,v,l,i);if(!(C&&b)&&y.indexOf(d)>=0)return i.previousDirectionAngle=w,reconstructRoute(r,t,V,c,u);for(let s=0;s<v;s+=1){f=m[s];const c=f.angle;if(g=getDirectionChange(w,c),(!h||!x)&&g>i.maxDirectionChange)continue;const d=align(V.clone().translate(f.gridOffsetX||0,f.gridOffsetY||0),l,o),b=getKey(d);if(e.isClose(b)||!n.isAccessible(d))continue;if(y.indexOf(b)>=0){if(!d.equals(u)){if(getDirectionChange(c,getDirectionAngle(d,u,v,l,i))>i.maxDirectionChange)continue}}const q=E+f.cost+(x?0:i.penalties[g]);(!e.isOpen(b)||q<a[b])&&(t[b]=d,r[b]=V,a[b]=q,e.add(b,q+getCost(d,p)))}q-=1}}return i.fallbackRoute?call$1(i.fallbackRoute,this,c,u,i):null}function snap(e,t=10){if(e.length<=1)return e;for(let r=0,n=e.length;r<n-1;r+=1){const n=e[r],i=e[r+1];if(n.x===i.x){const e=t*Math.round(n.x/t);n.x!==e&&(n.x=e,i.x=e)}else if(n.y===i.y){const e=t*Math.round(n.y/t);n.y!==e&&(n.y=e,i.y=e)}}return e}const router=function(e,t,r){const n=resolveOptions(t),i=getSourceBBox(r,n),o=getTargetBBox(r,n),a=getSourceEndpoint(r,n),s=new ObstacleMap(n).build(r.graph.model,r.cell),l=e.map(e=>Point.create(e)),c=[];let u,d,p=a;for(let h=0,f=l.length;h<=f;h+=1){let t=null;if(u=d||i,d=l[h],null==d){d=o;const e=r.cell;if((null==e.getSourceCellId()||null==e.getTargetCellId())&&"function"==typeof n.draggingRouter){const e=u===i?a:u,o=d.getOrigin();t=call$1(n.draggingRouter,r,e,o,n)}}if(null==t&&(t=findRoute(r,u,d,s,n)),null===t)return call$1(n.fallbackRouter,this,e,n,r);const f=t[0];f&&f.equals(p)&&t.shift(),p=t[t.length-1]||p,c.push(...t)}return n.snapToGrid?snap(c,r.graph.grid.getGridSize()):c},manhattan=function(e,t,r){return call$1(router,this,e,Object.assign(Object.assign({},defaults$2),t),r)},defaults$1={maxDirectionChange:45,directions(){const e=resolve(this.step,this),t=resolve(this.cost,this),r=Math.ceil(Math.sqrt(e*e<<1));return[{cost:t,offsetX:e,offsetY:0},{cost:r,offsetX:e,offsetY:e},{cost:t,offsetX:0,offsetY:e},{cost:r,offsetX:-e,offsetY:e},{cost:t,offsetX:-e,offsetY:0},{cost:r,offsetX:-e,offsetY:-e},{cost:t,offsetX:0,offsetY:-e},{cost:r,offsetX:e,offsetY:-e}]},fallbackRoute(e,t,r){const n=e.theta(t),i=[];let o={x:t.x,y:e.y},a={x:e.x,y:t.y};if(n%180>90){const e=o;o=a,a=e}const s=n%90<45?o:a,l=new Line(e,s),c=90*Math.ceil(n/90),u=Point.fromPolar(l.squaredLength(),Angle.toRad(c+135),s),d=new Line(t,u),p=l.intersectsWithLine(d),h=p||t,f=p?h:e,g=360/r.directions.length,m=f.theta(t),v=Angle.normalize(m+g/2),y=g*Math.floor(v/g);return r.previousDirectionAngle=y,h&&i.push(h.round()),i.push(t),i}},metro=function(e,t,r){return call$1(manhattan,this,e,Object.assign(Object.assign({},defaults$1),t),r)},er=function(e,t,r){const n=t.offset||32,i=null==t.min?16:t.min;let o=0,a=t.direction;const s=r.sourceBBox,l=r.targetBBox,c=s.getCenter(),u=l.getCenter();if("number"==typeof n&&(o=n),null==a){let e=l.left-s.right,t=l.top-s.bottom;e>=0&&t>=0?a=e>=t?"L":"T":e<=0&&t>=0?(e=s.left-l.right,a=e>=0&&e>=t?"R":"T"):e>=0&&t<=0?(t=s.top-l.bottom,a=t>=0?e>=t?"L":"B":"L"):(e=s.left-l.right,t=s.top-l.bottom,a=e>=0&&t>=0?e>=t?"R":"B":e<=0&&t>=0?"B":e>=0&&t<=0||Math.abs(e)>Math.abs(t)?"R":"B")}let d,p,h;"H"===a?a=u.x-c.x>=0?"L":"R":"V"===a&&(a=u.y-c.y>=0?"T":"B"),"center"===n&&("L"===a?o=(l.left-s.right)/2:"R"===a?o=(s.left-l.right)/2:"T"===a?o=(l.top-s.bottom)/2:"B"===a&&(o=(s.top-l.bottom)/2));const f="L"===a||"R"===a;if(f){if(u.y===c.y)return[...e];h="L"===a?1:-1,d="x",p="width"}else{if(u.x===c.x)return[...e];h="T"===a?1:-1,d="y",p="height"}const g=c.clone(),m=u.clone();if(g[d]+=h*(s[p]/2+o),m[d]-=h*(l[p]/2+o),f){const e=g.x,t=m.x,r=s.width/2+i,n=l.width/2+i;u.x>c.x?t<=e&&(g.x=Math.max(t,c.x+r),m.x=Math.min(e,u.x-n)):t>=e&&(g.x=Math.min(t,c.x-r),m.x=Math.max(e,u.x+n))}else{const e=g.y,t=m.y,r=s.height/2+i,n=l.height/2+i;u.y>c.y?t<=e&&(g.y=Math.max(t,c.y+r),m.y=Math.min(e,u.y-n)):t>=e&&(g.y=Math.min(t,c.y-r),m.y=Math.max(e,u.y+n))}return[g.toJSON(),...e,m.toJSON()]};function rollup(e,t){if(null!=t&&!1!==t){const r="boolean"==typeof t?0:t;if(r>0){const t=Point.create(e[1]).move(e[2],r),n=Point.create(e[1]).move(e[0],r);return[t.toJSON(),...e,n.toJSON()]}{const t=e[1];return[Object.assign({},t),...e,Object.assign({},t)]}}return e}const loop$1=function(e,t,r){const n=t.width||50,i=(t.height||80)/2,o=t.angle||"auto",a=r.sourceAnchor,s=r.targetAnchor,l=r.sourceBBox,c=r.targetBBox;if(a.equals(s)){const e=e=>{const t=Angle.toRad(e),r=Math.sin(t),o=Math.cos(t),s=new Point(a.x+o*n,a.y+r*n),l=new Point(s.x-o*i,s.y-r*i),c=l.clone().rotate(-90,s),u=l.clone().rotate(90,s);return[c.toJSON(),s.toJSON(),u.toJSON()]},r=e=>{const t=a.clone().move(e,-1),r=new Line(t,e);return!l.containsPoint(e)&&!l.intersectsWithLine(r)},s=[0,90,180,270,45,135,225,315];if("number"==typeof o)return rollup(e(o),t.merge);const c=l.getCenter();if(c.equals(a))return rollup(e(0),t.merge);const u=c.angleBetween(a,c.clone().translate(1,0));let d=e(u);if(r(d[1]))return rollup(d,t.merge);for(let n=1,i=s.length;n<i;n+=1)if(d=e(u+s[n]),r(d[1]))return rollup(d,t.merge);return rollup(d,t.merge)}{const e=new Line(a,s);let o=e.parallel(-n),u=o.getCenter(),d=o.start.clone().move(o.end,i),p=o.end.clone().move(o.start,i);const h=e.parallel(-1),f=new Line(h.start,u),g=new Line(h.end,u);if((l.containsPoint(u)||c.containsPoint(u)||l.intersectsWithLine(f)||l.intersectsWithLine(g)||c.intersectsWithLine(f)||c.intersectsWithLine(g))&&(o=e.parallel(n),u=o.getCenter(),d=o.start.clone().move(o.end,i),p=o.end.clone().move(o.start,i)),t.merge){const e=new Line(a,s),t=new Line(u,e.center).setLength(Number.MAX_SAFE_INTEGER),n=l.intersectsWithLine(t),i=c.intersectsWithLine(t),o=n?Array.isArray(n)?n:[n]:[];i&&(Array.isArray(i)?o.push(...i):o.push(i));const d=e.center.closest(o);d?(r.sourceAnchor=d.clone(),r.targetAnchor=d.clone()):(r.sourceAnchor=e.center.clone(),r.targetAnchor=e.center.clone())}return rollup([d.toJSON(),u.toJSON(),p.toJSON()],t.merge)}},routers=Object.freeze(Object.defineProperty({__proto__:null,er:er,loop:loop$1,manhattan:manhattan,metro:metro,normal:normal$1,oneSide:oneSide,orth:orth},Symbol.toStringTag,{value:"Module"}));var Router,Router2;Router2=Router||(Router={}),Router2.presets=routers,Router2.registry=Registry.create({type:"router"}),Router2.registry.register(Router2.presets,!0);const normal=function(e,t,r,n={}){const i=[e,...r,t],o=new Polyline(i),a=new Path(o);return n.raw?a:a.serialize()},loop=function(e,t,r,n={}){const i=3===r.length?0:1,o=Point.create(r[0+i]),a=Point.create(r[2+i]),s=Point.create(r[1+i]);if(!Point.equals(e,t)){const r=new Point((e.x+t.x)/2,(e.y+t.y)/2),n=r.angleBetween(Point.create(e).rotate(90,r),s);n>1&&(o.rotate(180-n,r),a.rotate(180-n,r),s.rotate(180-n,r))}const l=`\n M ${e.x} ${e.y}\n Q ${o.x} ${o.y} ${s.x} ${s.y}\n Q ${a.x} ${a.y} ${t.x} ${t.y}\n `;return n.raw?Path.parse(l):l},rounded=function(e,t,r,n={}){const i=new Path;i.appendSegment(Path.createSegment("M",e));const o=1/3,a=2/3,s=n.radius||10;let l,c;for(let u=0,d=r.length;u<d;u+=1){const n=Point.create(r[u]),d=r[u-1]||e,p=r[u+1]||t;l=c||n.distance(d)/2,c=n.distance(p)/2;const h=-Math.min(s,l),f=-Math.min(s,c),g=n.clone().move(d,h).round(),m=n.clone().move(p,f).round(),v=new Point(o*g.x+a*n.x,a*n.y+o*g.y),y=new Point(o*m.x+a*n.x,a*n.y+o*m.y);i.appendSegment(Path.createSegment("L",g)),i.appendSegment(Path.createSegment("C",v,y,m))}return i.appendSegment(Path.createSegment("L",t)),n.raw?i:i.serialize()},smooth=function(e,t,r,n={}){let i,o=n.direction;if(r&&0!==r.length){const n=[e,...r,t],o=Curve.throughPoints(n);i=new Path(o)}else if(i=new Path,i.appendSegment(Path.createSegment("M",e)),o||(o=Math.abs(e.x-t.x)>=Math.abs(e.y-t.y)?"H":"V"),"H"===o){const r=(e.x+t.x)/2;i.appendSegment(Path.createSegment("C",r,e.y,r,t.y,t.x,t.y))}else{const r=(e.y+t.y)/2;i.appendSegment(Path.createSegment("C",e.x,r,t.x,r,t.x,t.y))}return n.raw?i:i.serialize()},CLOSE_PROXIMITY_PADDING=1,F13=1/3,F23=2/3;function setupUpdating(e){let t=e.graph._jumpOverUpdateList;if(null==t&&(t=e.graph._jumpOverUpdateList=[],e.graph.on("cell:mouseup",()=>{const t=e.graph._jumpOverUpdateList;setTimeout(()=>{for(let e=0;e<t.length;e+=1)t[e].update()})}),e.graph.on("model:reseted",()=>{t=e.graph._jumpOverUpdateList=[]})),t.indexOf(e)<0){t.push(e);const r=()=>t.splice(t.indexOf(e),1);e.cell.once("change:connector",r),e.cell.once("removed",r)}}function createLines(e,t,r=[]){const n=[e,...r,t],i=[];return n.forEach((e,t)=>{const r=n[t+1];null!=r&&i.push(new Line(e,r))}),i}function findLineIntersections(e,t){const r=[];return t.forEach(t=>{const n=e.intersectsWithLine(t);if(n){const{x:e,y:i}=n,{start:o,end:a}=t,s=Math.round(o.x)===Math.round(e)&&Math.round(o.y)===Math.round(i),l=Math.round(a.x)===Math.round(e)&&Math.round(a.y)===Math.round(i);if(s||l)return;r.push(n)}}),r}function getDistence(e,t){return new Line(e,t).squaredLength()}function createJumps(e,t,r){return t.reduce((n,i,o)=>{if(skippedPoints.includes(i))return n;const a=n.pop()||e,s=Point.create(i).move(a.start,-r);let l=Point.create(i).move(a.start,+r);const c=t[o+1];if(null!=c){const e=l.distance(c);e<=r&&(l=c.move(a.start,e),skippedPoints.push(c))}else{if(s.distance(a.end)<2*r+CLOSE_PROXIMITY_PADDING)return n.push(a),n}if(l.distance(a.start)<2*r+CLOSE_PROXIMITY_PADDING)return n.push(a),n;const u=new Line(s,l);return jumppedLines.push(u),n.push(new Line(a.start,s),u,new Line(l,a.end)),n},[])}function buildPath(e,t,r,n){const i=new Path;let o;return o=Path.createSegment("M",e[0].start),i.appendSegment(o),e.forEach((a,s)=>{if(jumppedLines.includes(a)){let e,n,s,l;if("arc"===r){e=-90,n=a.start.diff(a.end);(n.x<0||0===n.x&&n.y<0)&&(e+=180);const t=a.getCenter(),r=new Line(t,a.end).rotate(e,t);let c;c=new Line(a.start,t),s=c.pointAt(2/3).rotate(e,a.start),l=r.pointAt(1/3).rotate(-e,r.end),o=Path.createSegment("C",s,l,r.end),i.appendSegment(o),c=new Line(t,a.end),s=r.pointAt(1/3).rotate(e,r.end),l=c.pointAt(1/3).rotate(-e,a.end),o=Path.createSegment("C",s,l,a.end),i.appendSegment(o)}else if("gap"===r)o=Path.createSegment("M",a.end),i.appendSegment(o);else if("cubic"===r){e=a.start.theta(a.end);const r=.6*t;let c=1.35*t;n=a.start.diff(a.end);(n.x<0||0===n.x&&n.y<0)&&(c*=-1),s=new Point(a.start.x+r,a.start.y+c).rotate(e,a.start),l=new Point(a.end.x-r,a.end.y+c).rotate(e,a.end),o=Path.createSegment("C",s,l,a.end),i.appendSegment(o)}}else{const t=e[s+1];0===n||!t||jumppedLines.includes(t)?(o=Path.createSegment("L",a.end),i.appendSegment(o)):buildRoundedSegment(n,i,a.end,a.start,t.end)}}),i}function buildRoundedSegment(e,t,r,n,i){const o=r.distance(n)/2,a=r.distance(i)/2,s=-Math.min(e,o),l=-Math.min(e,a),c=r.clone().move(n,s).round(),u=r.clone().move(i,l).round(),d=new Point(F13*c.x+F23*r.x,F23*r.y+F13*c.y),p=new Point(F13*u.x+F23*r.x,F23*r.y+F13*u.y);let h;h=Path.createSegment("L",c),t.appendSegment(h),h=Path.createSegment("C",d,p,u),t.appendSegment(h)}let jumppedLines,skippedPoints;const jumpover=function(e,t,r,n={}){jumppedLines=[],skippedPoints=[],setupUpdating(this);const i=n.size||5,o=n.type||"arc",a=n.radius||0,s=n.ignoreConnectors||["smooth"],l=this.graph,c=l.model.getEdges();if(1===c.length)return buildPath(createLines(e,t,r),i,o,a);const u=this.cell,d=c.indexOf(u),p=l.options.connecting.connector||{},h=c.filter((e,t)=>{const r=e.getConnector()||p;return!s.includes(r.name)&&(!(t>d)||"jumpover"!==r.name)}),f=h.map(e=>l.findViewByCell(e)),g=createLines(e,t,r),m=f.map(e=>null==e?[]:e===this?g:createLines(e.sourcePoint,e.targetPoint,e.routePoints)),v=[];g.forEach(e=>{const t=h.reduce((t,r,n)=>{if(r!==u){const r=findLineIntersections(e,m[n]);t.push(...r)}return t},[]).sort((t,r)=>getDistence(e.start,t)-getDistence(e.start,r));t.length>0?v.push(...createJumps(e,t,i)):v.push(e)});const y=buildPath(v,i,o,a);return jumppedLines=[],skippedPoints=[],n.raw?y:y.serialize()},connectors=Object.freeze(Object.defineProperty({__proto__:null,jumpover:jumpover,loop:loop,normal:normal,rounded:rounded,smooth:smooth},Symbol.toStringTag,{value:"Module"}));var Connector,Connector2;Connector2=Connector||(Connector={}),Connector2.presets=connectors,Connector2.registry=Registry.create({type:"connector"}),Connector2.registry.register(Connector2.presets,!0);var __decorate$s=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Animation2;class Store extends Basecoat{constructor(e={}){super(),this.pending=!1,this.changing=!1,this.data={},this.mutate(cloneDeep(e)),this.changed={}}mutate(e,t={}){const r=!0===t.unset,n=!0===t.silent,i=[],o=this.changing;this.changing=!0,o||(this.previous=cloneDeep(this.data),this.changed={});const a=this.data,s=this.previous,l=this.changed;if(Object.keys(e).forEach(t=>{const n=t,o=e[n];isEqual(a[n],o)||i.push(n),isEqual(s[n],o)?delete l[n]:l[n]=o,r?delete a[n]:a[n]=o}),!n&&i.length>0&&(this.pending=!0,this.pendingOptions=t,i.forEach(e=>{this.emit("change:*",{key:e,options:t,store:this,current:a[e],previous:s[e]})})),o)return this;if(!n)for(;this.pending;)this.pending=!1,this.emit("changed",{current:a,previous:s,store:this,options:this.pendingOptions});return this.pending=!1,this.changing=!1,this.pendingOptions=null,this}get(e,t){if(null==e)return this.data;const r=this.data[e];return null==r?t:r}getPrevious(e){if(this.previous){const t=this.previous[e];return null==t?void 0:t}}set(e,t,r){return null!=e&&("object"==typeof e?this.mutate(e,t):this.mutate({[e]:t},r)),this}remove(e,t){const r=void 0,n={};let i;if("string"==typeof e)n[e]=r,i=t;else if(Array.isArray(e))e.forEach(e=>n[e]=r),i=t;else{for(const e in this.data)n[e]=r;i=e}return this.mutate(n,Object.assign(Object.assign({},i),{unset:!0})),this}getByPath(e){return getByPath(this.data,e,"/")}setByPath(e,t,r={}){const n="/",i=Array.isArray(e)?[...e]:e.split(n),o=Array.isArray(e)?e.join(n):e,a=i[0],s=i.length;if(r.propertyPath=o,r.propertyValue=t,r.propertyPathArray=i,1===s)this.set(a,t,r);else{const o={};let l=o,c=a;for(let e=1;e<s;e+=1){const t=i[e],r=Number.isFinite(Number(t));l=l[c]=r?[]:{},c=t}setByPath(o,i,t,n);const u=cloneDeep(this.data);r.rewrite&&unsetByPath(u,e,n);const d=merge$2(u,o);this.set(a,d[a],r)}return this}removeByPath(e,t){const r=Array.isArray(e)?e:e.split("/"),n=r[0];if(1===r.length)this.remove(n,t);else{const e=r.slice(1),i=cloneDeep(this.get(n));i&&unsetByPath(i,e),this.set(n,i,t)}return this}hasChanged(e){return null==e?Object.keys(this.changed).length>0:e in this.changed}getChanges(e){if(null==e)return this.hasChanged()?cloneDeep(this.changed):null;const t=this.changing?this.previous:this.data,r={};let n;for(const i in e){const o=e[i];isEqual(t[i],o)||(r[i]=o,n=!0)}return n?cloneDeep(r):null}toJSON(){return cloneDeep(this.data)}clone(){return new(0,this.constructor)(this.data)}dispose(){this.off(),this.data={},this.previous={},this.changed={},this.pending=!1,this.changing=!1,this.pendingOptions=null,this.trigger("disposed",{store:this})}}__decorate$s([Basecoat.dispose()],Store.prototype,"dispose",null);class Animation{constructor(e){this.cell=e,this.ids={},this.cache={}}get(){return Object.keys(this.ids)}start(e,t,r={},n="/"){const i=this.cell.getPropByPath(e),o=defaults$4(r,Animation.defaultOptions),a=this.getTiming(o.timing),s=this.getInterp(o.interp,i,t);let l=0;const c=Array.isArray(e)?e.join(n):e,u=Array.isArray(e)?e:e.split(n),d=()=>{const e=(new Date).getTime();0===l&&(l=e);let t=(e-l)/o.duration;t<1?this.ids[c]=requestAnimationFrame(d):t=1;const n=s(a(t));this.cell.setPropByPath(u,n),r.progress&&r.progress(Object.assign({progress:t,currentValue:n},this.getArgs(c))),1===t&&(this.cell.notify("transition:complete",this.getArgs(c)),r.complete&&r.complete(this.getArgs(c)),this.cell.notify("transition:finish",this.getArgs(c)),r.finish&&r.finish(this.getArgs(c)),this.clean(c))};return setTimeout(()=>{this.stop(e,void 0,n),this.cache[c]={startValue:i,targetValue:t,options:o},this.ids[c]=requestAnimationFrame(d),this.cell.notify("transition:start",this.getArgs(c)),r.start&&r.start(this.getArgs(c))},r.delay),this.stop.bind(this,e,n,r)}stop(e,t={},r="/"){const n=Array.isArray(e)?e:e.split(r);return Object.keys(this.ids).filter(e=>isEqual(n,e.split(r).slice(0,n.length))).forEach(e=>{cancelAnimationFrame(this.ids[e]);const r=this.cache[e],n=this.getArgs(e),i=Object.assign(Object.assign({},r.options),t),o=i.jumpedToEnd;o&&null!=r.targetValue&&(this.cell.setPropByPath(e,r.targetValue),this.cell.notify("transition:end",Object.assign({},n)),this.cell.notify("transition:complete",Object.assign({},n)),i.complete&&i.complete(Object.assign({},n)));const a=Object.assign({jumpedToEnd:o},n);this.cell.notify("transition:stop",Object.assign({},a)),i.stop&&i.stop(Object.assign({},a)),this.cell.notify("transition:finish",Object.assign({},n)),i.finish&&i.finish(Object.assign({},n)),this.clean(e)}),this}clean(e){delete this.ids[e],delete this.cache[e]}getTiming(e){return"string"==typeof e?Timing[e]:e}getInterp(e,t,r){return e?e(t,r):"number"==typeof r?Interp.number(t,r):"string"==typeof r?"#"===r[0]?Interp.color(t,r):Interp.unit(t,r):Interp.object(t,r)}getArgs(e){const t=this.cache[e];return{path:e,startValue:t.startValue,targetValue:t.targetValue,cell:this.cell}}}Animation2=Animation||(Animation={}),Animation2.defaultOptions={delay:10,duration:100,timing:"linear"};var __decorate$r=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},__rest$e=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},Cell2,ShareRegistry;class Cell extends Basecoat{static config(e){const{markup:t,propHooks:r,attrHooks:n}=e,i=__rest$e(e,["markup","propHooks","attrHooks"]);null!=t&&(this.markup=t),r&&(this.propHooks=this.propHooks.slice(),Array.isArray(r)?this.propHooks.push(...r):"function"==typeof r?this.propHooks.push(r):Object.values(r).forEach(e=>{"function"==typeof e&&this.propHooks.push(e)})),n&&(this.attrHooks=Object.assign(Object.assign({},this.attrHooks),n)),this.defaults=merge$2({},this.defaults,i)}static getMarkup(){return this.markup}static getDefaults(e){return e?this.defaults:cloneDeep(this.defaults)}static getAttrHooks(){return this.attrHooks}static applyPropHooks(e,t){return this.propHooks.reduce((t,r)=>r?call$1(r,e,t):t,t)}get[Symbol.toStringTag](){return Cell.toStringTag}constructor(e={}){super();const t=this.constructor.getDefaults(!0),r=merge$2({},this.preprocess(t),this.preprocess(e));this.id=r.id||uuid(),this.store=new Store(r),this.animation=new Animation(this),this.setup(),this.init(),this.postprocess(e)}init(){}get model(){return this._model}set model(e){this._model!==e&&(this._model=e)}preprocess(e,t){const r=e.id,n=this.constructor.applyPropHooks(this,e);return null==r&&!0!==t&&(n.id=uuid()),n}postprocess(e){}setup(){this.store.on("change:*",e=>{const{key:t,current:r,previous:n,options:i}=e;this.notify("change:*",{key:t,options:i,current:r,previous:n,cell:this}),this.notify(`change:${t}`,{options:i,current:r,previous:n,cell:this});const o=t;"source"!==o&&"target"!==o||this.notify("change:terminal",{type:o,current:r,previous:n,options:i,cell:this})}),this.store.on("changed",({options:e})=>this.notify("changed",{options:e,cell:this}))}notify(e,t){this.trigger(e,t);const r=this.model;return r&&(r.notify(`cell:${e}`,t),this.isNode()?r.notify(`node:${e}`,Object.assign(Object.assign({},t),{node:this})):this.isEdge()&&r.notify(`edge:${e}`,Object.assign(Object.assign({},t),{edge:this}))),this}isNode(){return!1}isEdge(){return!1}isSameStore(e){return this.store===e.store}get view(){return this.store.get("view")}get shape(){return this.store.get("shape","")}getProp(e,t){return null==e?this.store.get():this.store.get(e,t)}setProp(e,t,r){if("string"==typeof e)this.store.set(e,t,r);else{const r=this.preprocess(e,!0);this.store.set(merge$2({},this.getProp(),r),t),this.postprocess(e)}return this}removeProp(e,t){return"string"==typeof e||Array.isArray(e)?this.store.removeByPath(e,t):this.store.remove(t),this}hasChanged(e){return null==e?this.store.hasChanged():this.store.hasChanged(e)}getPropByPath(e){return this.store.getByPath(e)}setPropByPath(e,t,r={}){return this.model&&("children"===e?this._children=t?t.map(e=>this.model.getCell(e)).filter(e=>null!=e):null:"parent"===e&&(this._parent=t?this.model.getCell(t):null)),this.store.setByPath(e,t,r),this}removePropByPath(e,t={}){const r=Array.isArray(e)?e:e.split("/");return"attrs"===r[0]&&(t.dirty=!0),this.store.removeByPath(r,t),this}prop(e,t,r){return null==e?this.getProp():"string"==typeof e||Array.isArray(e)?1===arguments.length?this.getPropByPath(e):null==t?this.removePropByPath(e,r||{}):this.setPropByPath(e,t,r||{}):this.setProp(e,t||{})}previous(e){return this.store.getPrevious(e)}get zIndex(){return this.getZIndex()}set zIndex(e){null==e?this.removeZIndex():this.setZIndex(e)}getZIndex(){return this.store.get("zIndex")}setZIndex(e,t={}){return this.store.set("zIndex",e,t),this}removeZIndex(e={}){return this.store.remove("zIndex",e),this}toFront(e={}){const t=this.model;if(t){let r,n=t.getMaxZIndex();e.deep?(r=this.getDescendants({deep:!0,breadthFirst:!0}),r.unshift(this)):r=[this],n=n-r.length+1;const i=t.total();let o=t.indexOf(this)!==i-r.length;o||(o=r.some((e,t)=>e.getZIndex()!==n+t)),o&&this.batchUpdate("to-front",()=>{n+=r.length,r.forEach((t,r)=>{t.setZIndex(n+r,e)})})}return this}toBack(e={}){const t=this.model;if(t){let r,n=t.getMinZIndex();e.deep?(r=this.getDescendants({deep:!0,breadthFirst:!0}),r.unshift(this)):r=[this];let i=0!==t.indexOf(this);i||(i=r.some((e,t)=>e.getZIndex()!==n+t)),i&&this.batchUpdate("to-back",()=>{n-=r.length,r.forEach((t,r)=>{t.setZIndex(n+r,e)})})}return this}get markup(){return this.getMarkup()}set markup(e){null==e?this.removeMarkup():this.setMarkup(e)}getMarkup(){let e=this.store.get("markup");if(null==e){e=this.constructor.getMarkup()}return e}setMarkup(e,t={}){return this.store.set("markup",e,t),this}removeMarkup(e={}){return this.store.remove("markup",e),this}get attrs(){return this.getAttrs()}set attrs(e){null==e?this.removeAttrs():this.setAttrs(e)}getAttrs(){const e=this.store.get("attrs");return e?Object.assign({},e):{}}setAttrs(e,t={}){if(null==e)this.removeAttrs(t);else{const r=e=>this.store.set("attrs",e,t);if(!0===t.overwrite)r(e);else{const n=this.getAttrs();!1===t.deep?r(Object.assign(Object.assign({},n),e)):r(merge$2({},n,e))}}return this}replaceAttrs(e,t={}){return this.setAttrs(e,Object.assign(Object.assign({},t),{overwrite:!0}))}updateAttrs(e,t={}){return this.setAttrs(e,Object.assign(Object.assign({},t),{deep:!1}))}removeAttrs(e={}){return this.store.remove("attrs",e),this}getAttrDefinition(e){if(!e)return null;const t=this.constructor.getAttrHooks()||{};let r=t[e]||Attr.registry.get(e);if(!r){const n=camelCase(e);r=t[n]||Attr.registry.get(n)}return r||null}getAttrByPath(e){return null==e||""===e?this.getAttrs():this.getPropByPath(this.prefixAttrPath(e))}setAttrByPath(e,t,r={}){return this.setPropByPath(this.prefixAttrPath(e),t,r),this}removeAttrByPath(e,t={}){return this.removePropByPath(this.prefixAttrPath(e),t),this}prefixAttrPath(e){return Array.isArray(e)?["attrs"].concat(e):`attrs/${e}`}attr(e,t,r){return null==e?this.getAttrByPath():"string"==typeof e||Array.isArray(e)?1===arguments.length?this.getAttrByPath(e):null==t?this.removeAttrByPath(e,r||{}):this.setAttrByPath(e,t,r||{}):this.setAttrs(e,t||{})}get visible(){return this.isVisible()}set visible(e){this.setVisible(e)}setVisible(e,t={}){return this.store.set("visible",e,t),this}isVisible(){return!1!==this.store.get("visible")}show(e={}){return this.isVisible()||this.setVisible(!0,e),this}hide(e={}){return this.isVisible()&&this.setVisible(!1,e),this}toggleVisible(e,t={}){const r="boolean"==typeof e?t:e;return("boolean"==typeof e?e:!this.isVisible())?this.show(r):this.hide(r),this}get data(){return this.getData()}set data(e){this.setData(e)}getData(){return this.store.get("data")}setData(e,t={}){if(null==e)this.removeData(t);else{const r=e=>this.store.set("data",e,t);if(!0===t.overwrite)r(e);else{const n=this.getData();!1===t.deep?r("object"==typeof e?Object.assign(Object.assign({},n),e):e):r(merge$2({},n,e))}}return this}replaceData(e,t={}){return this.setData(e,Object.assign(Object.assign({},t),{overwrite:!0}))}updateData(e,t={}){return this.setData(e,Object.assign(Object.assign({},t),{deep:!1}))}removeData(e={}){return this.store.remove("data",e),this}get parent(){return this.getParent()}get children(){return this.getChildren()}getParentId(){return this.store.get("parent")}getParent(){const e=this.getParentId();if(e&&this.model){const t=this.model.getCell(e);return this._parent=t,t}return null}getChildren(){const e=this.store.get("children");if(e&&e.length&&this.model){const t=e.map(e=>{var t;return null===(t=this.model)||void 0===t?void 0:t.getCell(e)}).filter(e=>null!=e);return this._children=t,[...t]}return null}hasParent(){return null!=this.parent}isParentOf(e){return null!=e&&e.getParent()===this}isChildOf(e){return null!=e&&this.getParent()===e}eachChild(e,t){return this.children&&this.children.forEach(e,t),this}filterChild(e,t){return this.children?this.children.filter(e,t):[]}getChildCount(){return null==this.children?0:this.children.length}getChildIndex(e){return null==this.children?-1:this.children.indexOf(e)}getChildAt(e){return null!=this.children&&e>=0?this.children[e]:null}getAncestors(e={}){const t=[];let r=this.getParent();for(;r;)t.push(r),r=!1!==e.deep?r.getParent():null;return t}getDescendants(e={}){if(!1!==e.deep){if(e.breadthFirst){const e=[],t=this.getChildren()||[];for(;t.length>0;){const r=t.shift(),n=r.getChildren();e.push(r),n&&t.push(...n)}return e}{const t=this.getChildren()||[];return t.forEach(r=>{t.push(...r.getDescendants(e))}),t}}return this.getChildren()||[]}isDescendantOf(e,t={}){if(null==e)return!1;if(!1!==t.deep){let t=this.getParent();for(;t;){if(t===e)return!0;t=t.getParent()}return!1}return this.isChildOf(e)}isAncestorOf(e,t={}){return null!=e&&e.isDescendantOf(this,t)}contains(e){return this.isAncestorOf(e)}getCommonAncestor(...e){return Cell.getCommonAncestor(this,...e)}setParent(e,t={}){return this._parent=e,e?this.store.set("parent",e.id,t):this.store.remove("parent",t),this}setChildren(e,t={}){return this._children=e,null!=e?this.store.set("children",e.map(e=>e.id),t):this.store.remove("children",t),this}unembed(e,t={}){const r=this.children;if(null!=r&&null!=e){const n=this.getChildIndex(e);-1!==n&&(r.splice(n,1),e.setParent(null,t),this.setChildren(r,t))}return this}embed(e,t={}){return e.addTo(this,t),this}addTo(e,t={}){return Cell.isCell(e)?e.addChild(this,t):e.addCell(this,t),this}insertTo(e,t,r={}){return e.insertChild(this,t,r),this}addChild(e,t={}){return this.insertChild(e,void 0,t)}insertChild(e,t,r={}){if(null!=e&&e!==this){const n=e.getParent(),i=this!==n;let o=t;if(null==o&&(o=this.getChildCount(),i||(o-=1)),n){const t=n.getChildren();if(t){const i=t.indexOf(e);i>=0&&(e.setParent(null,r),t.splice(i,1),n.setChildren(t,r))}}let a=this.children;if(null==a?(a=[],a.push(e)):a.splice(o,0,e),e.setParent(this,r),this.setChildren(a,r),i&&this.model){const e=this.model.getIncomingEdges(this),t=this.model.getOutgoingEdges(this);e&&e.forEach(e=>e.updateParent(r)),t&&t.forEach(e=>e.updateParent(r))}this.model&&this.model.addCell(e,r)}return this}removeFromParent(e={}){const t=this.getParent();if(null!=t){const r=t.getChildIndex(this);t.removeChildAt(r,e)}return this}removeChild(e,t={}){const r=this.getChildIndex(e);return this.removeChildAt(r,t)}removeChildAt(e,t={}){const r=this.getChildAt(e);return null!=this.children&&null!=r&&(this.unembed(r,t),r.remove(t)),r}remove(e={}){return this.batchUpdate("remove",()=>{const t=this.getParent();t&&t.removeChild(this,e),!1!==e.deep&&this.eachChild(t=>t.remove(e)),this.model&&this.model.removeCell(this,e)}),this}transition(e,t,r={},n="/"){return this.animation.start(e,t,r,n)}stopTransition(e,t,r="/"){return this.animation.stop(e,t,r),this}getTransitions(){return this.animation.get()}translate(e,t,r){return this}scale(e,t,r,n){return this}addTools(e,t,r){const n=Array.isArray(e)?e:[e],i="string"==typeof t?t:null,o="object"==typeof t?t:"object"==typeof r?r:{};if(o.reset)return this.setTools({name:i,items:n,local:o.local},o);let a=cloneDeep(this.getTools());return null==a||null==i||a.name===i?(null==a&&(a={}),a.items||(a.items=[]),a.name=i,a.items=[...a.items,...n],this.setTools(Object.assign({},a),o)):void 0}setTools(e,t={}){return null==e?this.removeTools():this.store.set("tools",Cell.normalizeTools(e),t),this}getTools(){return this.store.get("tools")}removeTools(e={}){return this.store.remove("tools",e),this}hasTools(e){const t=this.getTools();return null!=t&&(null==e||t.name===e)}hasTool(e){const t=this.getTools();return null!=t&&t.items.some(t=>"string"==typeof t?t===e:t.name===e)}removeTool(e,t={}){const r=cloneDeep(this.getTools());if(r){let n=!1;const i=r.items.slice(),o=e=>{i.splice(e,1),n=!0};if("number"==typeof e)o(e);else for(let t=i.length-1;t>=0;t-=1){const r=i[t];("string"==typeof r?r===e:r.name===e)&&o(t)}n&&(r.items=i,this.setTools(r,t))}return this}getBBox(e){return new Rectangle}getConnectionPoint(e,t){return new Point}toJSON(e={}){const t=Object.assign({},this.store.get()),r=Object.prototype.toString,n=this.isNode()?"node":this.isEdge()?"edge":"cell";if(!t.shape){const e=this.constructor;throw new Error(`Unable to serialize ${n} missing "shape" prop, check the ${n} "${e.name||r.call(e)}"`)}const i=this.constructor,o=!0===e.diff,a=t.attrs||{},s=i.getDefaults(!0),l=o?this.preprocess(s,!0):s,c=l.attrs||{},u={};Object.entries(t).forEach(([e,i])=>{if(null!=i&&!Array.isArray(i)&&"object"==typeof i&&!isPlainObject(i))throw new Error(`Can only serialize ${n} with plain-object props, but got a "${r.call(i)}" type of key "${e}" on ${n} "${this.id}"`);if("attrs"!==e&&"shape"!==e&&o){isEqual(i,l[e])&&delete t[e]}}),Object.keys(a).forEach(e=>{const t=a[e],r=c[e];Object.keys(t).forEach(n=>{const i=t[n],o=r?r[n]:null;null==i||"object"!=typeof i||Array.isArray(i)?null!=r&&isEqual(o,i)||(null==u[e]&&(u[e]={}),u[e][n]=i):Object.keys(i).forEach(t=>{const a=i[t];if(null==r||null==o||!isObject(o)||!isEqual(o[t],a)){null==u[e]&&(u[e]={}),null==u[e][n]&&(u[e][n]={});u[e][n][t]=a}})})});const d=Object.assign(Object.assign({},t),{attrs:isEmpty(u)?void 0:u});null==d.attrs&&delete d.attrs;const p=d;return 0===p.angle&&delete p.angle,cloneDeep(p)}clone(e={}){if(!e.deep){const t=Object.assign({},this.store.get());e.keepId||delete t.id,delete t.parent,delete t.children;return new(0,this.constructor)(t)}return Cell.deepClone(this)[this.id]}findView(e){return e.findViewByCell(this)}startBatch(e,t={},r=this.model){return this.notify("batch:start",{name:e,data:t,cell:this}),r&&r.startBatch(e,Object.assign(Object.assign({},t),{cell:this})),this}stopBatch(e,t={},r=this.model){return r&&r.stopBatch(e,Object.assign(Object.assign({},t),{cell:this})),this.notify("batch:stop",{name:e,data:t,cell:this}),this}batchUpdate(e,t,r){const n=this.model;this.startBatch(e,r,n);const i=t();return this.stopBatch(e,r,n),i}dispose(){this.removeFromParent(),this.store.dispose()}}Cell.defaults={},Cell.attrHooks={},Cell.propHooks=[],__decorate$r([Basecoat.dispose()],Cell.prototype,"dispose",null),Cell2=Cell||(Cell={}),Cell2.normalizeTools=function(e){return"string"==typeof e?{items:[e]}:Array.isArray(e)?{items:e}:e.items?e:{items:[e]}},function(e){e.toStringTag=`X6.${e.name}`,e.isCell=function(t){if(null==t)return!1;if(t instanceof e)return!0;const r=t[Symbol.toStringTag],n=t;return(null==r||r===e.toStringTag)&&"function"==typeof n.isNode&&"function"==typeof n.isEdge&&"function"==typeof n.prop&&"function"==typeof n.attr}}(Cell||(Cell={})),function(e){e.getCommonAncestor=function(...e){const t=e.filter(e=>null!=e).map(e=>e.getAncestors()).sort((e,t)=>e.length-t.length);return t.shift().find(e=>t.every(t=>t.includes(e)))||null},e.getCellsBBox=function(e,t={}){let r=null;for(let n=0,i=e.length;n<i;n+=1){const i=e[n];let o=i.getBBox(t);if(o){if(i.isNode()){const e=i.getAngle();null!=e&&0!==e&&(o=o.bbox(e))}r=null==r?o:r.union(o)}}return r},e.deepClone=function(t){const r=[t,...t.getDescendants({deep:!0})];return e.cloneCells(r)},e.cloneCells=function(e){const t=uniq(e),r=t.reduce((e,t)=>(e[t.id]=t.clone(),e),{});return t.forEach(e=>{const t=r[e.id];if(t.isEdge()){const e=t.getSourceCellId(),n=t.getTargetCellId();e&&r[e]&&t.setSource(Object.assign(Object.assign({},t.getSource()),{cell:r[e].id})),n&&r[n]&&t.setTarget(Object.assign(Object.assign({},t.getTarget()),{cell:r[n].id}))}const n=e.getParent();n&&r[n.id]&&t.setParent(r[n.id]);const i=e.getChildren();if(i&&i.length){const e=i.reduce((e,t)=>(r[t.id]&&e.push(r[t.id]),e),[]);e.length>0&&t.setChildren(e)}}),r}}(Cell||(Cell={})),function(e){e.config({propHooks(t){var{tools:r}=t,n=__rest$e(t,["tools"]);return r&&(n.tools=e.normalizeTools(r)),n}})}(Cell||(Cell={})),function(e){let t,r;e.exist=function(e,n){return n?null!=t&&t.exist(e):null!=r&&r.exist(e)},e.setEdgeRegistry=function(e){t=e},e.setNodeRegistry=function(e){r=e}}(ShareRegistry||(ShareRegistry={}));class PortManager{constructor(e){this.ports=[],this.groups={},this.init(cloneDeep(e))}getPorts(){return this.ports}getGroup(e){return null!=e?this.groups[e]:null}getPortsByGroup(e){return this.ports.filter(t=>t.group===e||null==t.group&&null==e)}getPortsLayoutByGroup(e,t){const r=this.getPortsByGroup(e),n=e?this.getGroup(e):null,i=n?n.position:null,o=i?i.name:null;let a;if(null!=o){const e=PortLayout.registry.get(o);if(null==e)return PortLayout.registry.onNotFound(o);a=e}else a=PortLayout.presets.left;const s=r.map(e=>e&&e.position&&e.position.args||{}),l=i&&i.args||{};return a(s,t,l).map((e,n)=>{const i=r[n];return{portLayout:e,portId:i.id,portSize:i.size,portAttrs:i.attrs,labelSize:i.label.size,labelLayout:this.getPortLabelLayout(i,Point.create(e.position),t)}})}init(e){const{groups:t,items:r}=e;null!=t&&Object.keys(t).forEach(e=>{this.groups[e]=this.parseGroup(t[e])}),Array.isArray(r)&&r.forEach(e=>{this.ports.push(this.parsePort(e))})}parseGroup(e){return Object.assign(Object.assign({},e),{label:this.getLabel(e,!0),position:this.getPortPosition(e.position,!0)})}parsePort(e){const t=Object.assign({},e),r=this.getGroup(e.group)||{};return t.markup=t.markup||r.markup,t.attrs=merge$2({},r.attrs,t.attrs),t.position=this.createPosition(r,t),t.label=merge$2({},r.label,this.getLabel(t)),t.zIndex=this.getZIndex(r,t),t.size=Object.assign(Object.assign({},r.size),t.size),t}getZIndex(e,t){return"number"==typeof t.zIndex?t.zIndex:"number"==typeof e.zIndex||"auto"===e.zIndex?e.zIndex:"auto"}createPosition(e,t){return merge$2({name:"left",args:{}},e.position,{args:t.args})}getPortPosition(e,t=!1){if(null==e){if(t)return{name:"left",args:{}}}else{if("string"==typeof e)return{name:e,args:{}};if(Array.isArray(e))return{name:"absolute",args:{x:e[0],y:e[1]}};if("object"==typeof e)return e}return{args:{}}}getPortLabelPosition(e,t=!1){if(null==e){if(t)return{name:"left",args:{}}}else{if("string"==typeof e)return{name:e,args:{}};if("object"==typeof e)return e}return{args:{}}}getLabel(e,t=!1){const r=e.label||{};return r.position=this.getPortLabelPosition(r.position,t),r}getPortLabelLayout(e,t,r){const n=e.label.position.name||"left",i=e.label.position.args||{},o=PortLabelLayout.registry.get(n)||PortLabelLayout.presets.left;return o?o(t,r,i):null}}var __rest$d=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};let Node$1=class e extends Cell{get[Symbol.toStringTag](){return e.toStringTag}constructor(e={}){super(e),this.initPorts()}preprocess(e,t){const{x:r,y:n,width:i,height:o}=e,a=__rest$d(e,["x","y","width","height"]);if(null!=r||null!=n){const e=a.position;a.position=Object.assign(Object.assign({},e),{x:null!=r?r:e?e.x:0,y:null!=n?n:e?e.y:0})}if(null!=i||null!=o){const e=a.size;a.size=Object.assign(Object.assign({},e),{width:null!=i?i:e?e.width:0,height:null!=o?o:e?e.height:0})}return super.preprocess(a,t)}isNode(){return!0}size(e,t,r){return void 0===e?this.getSize():"number"==typeof e?this.setSize(e,t,r):this.setSize(e,t)}getSize(){const e=this.store.get("size");return e?Object.assign({},e):{width:1,height:1}}setSize(e,t,r){return"object"==typeof e?this.resize(e.width,e.height,t):this.resize(e,t,r),this}resize(e,t,r={}){this.startBatch("resize",r);const n=r.direction;if(n){const i=this.getSize();switch(n){case"left":case"right":t=i.height;break;case"top":case"bottom":e=i.width}let o={right:0,"top-right":0,top:1,"top-left":1,left:2,"bottom-left":2,bottom:3,"bottom-right":3}[n];const a=Angle.normalize(this.getAngle()||0);r.absolute&&(o+=Math.floor((a+45)/90),o%=4);const s=this.getBBox();let l;l=0===o?s.getBottomLeft():1===o?s.getCorner():2===o?s.getTopRight():s.getOrigin();const c=l.clone().rotate(-a,s.getCenter()),u=Math.sqrt(e*e+t*t)/2;let d=o*Math.PI/2;d+=Math.atan(o%2==0?t/e:e/t),d-=Angle.toRad(a);const p=Point.fromPolar(u,d,c).clone().translate(e/-2,t/-2);this.store.set("size",{width:e,height:t},r),this.setPosition(p.x,p.y,r)}else this.store.set("size",{width:e,height:t},r);return this.stopBatch("resize",r),this}scale(e,t,r,n={}){const i=this.getBBox().scale(e,t,null==r?void 0:r);return this.startBatch("scale",n),this.setPosition(i.x,i.y,n),this.resize(i.width,i.height,n),this.stopBatch("scale"),this}position(e,t,r){return"number"==typeof e?this.setPosition(e,t,r):this.getPosition(e)}getPosition(e={}){if(e.relative){const e=this.getParent();if(null!=e&&e.isNode()){const t=this.getPosition(),r=e.getPosition();return{x:t.x-r.x,y:t.y-r.y}}}const t=this.store.get("position");return t?Object.assign({},t):{x:0,y:0}}setPosition(e,t,r={}){let n,i,o;if("object"==typeof e?(n=e.x,i=e.y,o=t||{}):(n=e,i=t,o=r||{}),o.relative){const e=this.getParent();if(null!=e&&e.isNode()){const t=e.getPosition();n+=t.x,i+=t.y}}if(o.deep){const e=this.getPosition();this.translate(n-e.x,i-e.y,o)}else this.store.set("position",{x:n,y:i},o);return this}translate(e=0,t=0,r={}){if(0===e&&0===t)return this;r.translateBy=r.translateBy||this.id;const n=this.getPosition();if(null!=r.restrict&&r.translateBy===this.id){const i=this.getBBox({deep:!0}),o=r.restrict,a=n.x-i.x,s=n.y-i.y,l=Math.max(o.x+a,Math.min(o.x+o.width+a-i.width,n.x+e)),c=Math.max(o.y+s,Math.min(o.y+o.height+s-i.height,n.y+t));e=l-n.x,t=c-n.y}const i={x:n.x+e,y:n.y+t};return r.tx=e,r.ty=t,r.transition?("object"!=typeof r.transition&&(r.transition={}),this.transition("position",i,Object.assign(Object.assign({},r.transition),{interp:Interp.object})),this.eachChild(n=>{var i;(null===(i=r.exclude)||void 0===i?void 0:i.includes(n))||n.translate(e,t,r)})):(this.startBatch("translate",r),this.store.set("position",i,r),this.eachChild(n=>{var i;(null===(i=r.exclude)||void 0===i?void 0:i.includes(n))||n.translate(e,t,r)}),this.stopBatch("translate",r)),this}angle(e,t){return null==e?this.getAngle():this.rotate(e,t)}getAngle(){return this.store.get("angle",0)}rotate(e,t={}){const r=this.getAngle();if(t.center){const n=this.getSize(),i=this.getPosition(),o=this.getBBox().getCenter();o.rotate(r-e,t.center);const a=o.x-n.width/2-i.x,s=o.y-n.height/2-i.y;this.startBatch("rotate",{angle:e,options:t}),this.setPosition(i.x+a,i.y+s,t),this.rotate(e,Object.assign(Object.assign({},t),{center:null})),this.stopBatch("rotate")}else this.store.set("angle",t.absolute?e:(r+e)%360,t);return this}getBBox(e={}){if(e.deep){const e=this.getDescendants({deep:!0,breadthFirst:!0});return e.push(this),Cell.getCellsBBox(e)}return Rectangle.fromPositionAndSize(this.getPosition(),this.getSize())}getConnectionPoint(e,t){const r=this.getBBox(),n=r.getCenter(),i=e.getTerminal(t);if(null==i)return n;const o=i.port;if(!o||!this.hasPort(o))return n;const a=this.getPort(o);if(!a||!a.group)return n;const s=this.getPortsPosition(a.group)[o].position,l=Point.create(s).translate(r.getOrigin()),c=this.getAngle();return c&&l.rotate(-c,n),l}fit(e={}){const t=(this.getChildren()||[]).filter(e=>e.isNode());if(0===t.length)return this;this.startBatch("fit-embeds",e),e.deep&&t.forEach(t=>t.fit(e));let{x:r,y:n,width:i,height:o}=Cell.getCellsBBox(t);const a=normalizeSides(e.padding);return r-=a.left,n-=a.top,i+=a.left+a.right,o+=a.bottom+a.top,this.store.set({position:{x:r,y:n},size:{width:i,height:o}},e),this.stopBatch("fit-embeds"),this}get portContainerMarkup(){return this.getPortContainerMarkup()}set portContainerMarkup(e){this.setPortContainerMarkup(e)}getDefaultPortContainerMarkup(){return this.store.get("defaultPortContainerMarkup")||Markup.getPortContainerMarkup()}getPortContainerMarkup(){return this.store.get("portContainerMarkup")||this.getDefaultPortContainerMarkup()}setPortContainerMarkup(e,t={}){return this.store.set("portContainerMarkup",Markup.clone(e),t),this}get portMarkup(){return this.getPortMarkup()}set portMarkup(e){this.setPortMarkup(e)}getDefaultPortMarkup(){return this.store.get("defaultPortMarkup")||Markup.getPortMarkup()}getPortMarkup(){return this.store.get("portMarkup")||this.getDefaultPortMarkup()}setPortMarkup(e,t={}){return this.store.set("portMarkup",Markup.clone(e),t),this}get portLabelMarkup(){return this.getPortLabelMarkup()}set portLabelMarkup(e){this.setPortLabelMarkup(e)}getDefaultPortLabelMarkup(){return this.store.get("defaultPortLabelMarkup")||Markup.getPortLabelMarkup()}getPortLabelMarkup(){return this.store.get("portLabelMarkup")||this.getDefaultPortLabelMarkup()}setPortLabelMarkup(e,t={}){return this.store.set("portLabelMarkup",Markup.clone(e),t),this}get ports(){const e=this.store.get("ports",{items:[]});return null==e.items&&(e.items=[]),e}getPorts(){return cloneDeep(this.ports.items)}getPortsByGroup(e){return this.getPorts().filter(t=>t.group===e)}getPort(e){return cloneDeep(this.ports.items.find(t=>t.id&&t.id===e))}getPortAt(e){return this.ports.items[e]||null}hasPorts(){return this.ports.items.length>0}hasPort(e){return-1!==this.getPortIndex(e)}getPortIndex(e){const t="string"==typeof e?e:e.id;return null!=t?this.ports.items.findIndex(e=>e.id===t):-1}getPortsPosition(e){const t=this.getSize();return this.port.getPortsLayoutByGroup(e,new Rectangle(0,0,t.width,t.height)).reduce((e,t)=>{const r=t.portLayout;return e[t.portId]={position:Object.assign({},r.position),angle:r.angle||0},e},{})}getPortProp(e,t){return this.getPropByPath(this.prefixPortPath(e,t))}setPortProp(e,t,r,n){if("string"==typeof t||Array.isArray(t)){const i=this.prefixPortPath(e,t),o=r;return this.setPropByPath(i,o,n)}const i=this.prefixPortPath(e),o=t;return this.setPropByPath(i,o,r)}removePortProp(e,t,r){return"string"==typeof t||Array.isArray(t)?this.removePropByPath(this.prefixPortPath(e,t),r):this.removePropByPath(this.prefixPortPath(e),t)}portProp(e,t,r,n){return null==t?this.getPortProp(e):"string"==typeof t||Array.isArray(t)?2===arguments.length?this.getPortProp(e,t):null==r?this.removePortProp(e,t,n):this.setPortProp(e,t,r,n):this.setPortProp(e,t,r)}prefixPortPath(e,t){const r=this.getPortIndex(e);if(-1===r)throw new Error(`Unable to find port with id: "${e}"`);return null==t||""===t?["ports","items",`${r}`]:Array.isArray(t)?["ports","items",`${r}`,...t]:`ports/items/${r}/${t}`}addPort(e,t){const r=[...this.ports.items];return r.push(e),this.setPropByPath("ports/items",r,t),this}addPorts(e,t){return this.setPropByPath("ports/items",[...this.ports.items,...e],t),this}insertPort(e,t,r){const n=[...this.ports.items];return n.splice(e,0,t),this.setPropByPath("ports/items",n,r),this}removePort(e,t={}){return this.removePortAt(this.getPortIndex(e),t)}removePortAt(e,t={}){if(e>=0){const r=[...this.ports.items];r.splice(e,1),t.rewrite=!0,this.setPropByPath("ports/items",r,t)}return this}removePorts(e,t){let r;if(Array.isArray(e)){if(r=t||{},e.length){r.rewrite=!0;const t=[...this.ports.items].filter(t=>!e.some(e=>{const r="string"==typeof e?e:e.id;return t.id===r}));this.setPropByPath("ports/items",t,r)}}else r=e||{},r.rewrite=!0,this.setPropByPath("ports/items",[],r);return this}getParsedPorts(){return this.port.getPorts()}getParsedGroups(){return this.port.groups}getPortsLayoutByGroup(e,t){return this.port.getPortsLayoutByGroup(e,t)}initPorts(){this.updatePortData(),this.on("change:ports",()=>{this.processRemovedPort(),this.updatePortData()})}processRemovedPort(){const e=this.ports,t={};e.items.forEach(e=>{e.id&&(t[e.id]=!0)});const r={};(this.store.getPrevious("ports")||{items:[]}).items.forEach(e=>{e.id&&!t[e.id]&&(r[e.id]=!0)});const n=this.model;if(n&&!isEmpty(r)){n.getConnectedEdges(this,{incoming:!0}).forEach(e=>{const t=e.getTargetPortId();t&&r[t]&&e.remove()});n.getConnectedEdges(this,{outgoing:!0}).forEach(e=>{const t=e.getSourcePortId();t&&r[t]&&e.remove()})}}validatePorts(){const e={},t=[];return this.ports.items.forEach(r=>{"object"!=typeof r&&t.push(`Invalid port ${r}.`),null==r.id&&(r.id=this.generatePortId()),e[r.id]&&t.push("Duplicitied port id."),e[r.id]=!0}),t}generatePortId(){return uuid()}updatePortData(){const e=this.validatePorts();if(e.length>0)throw this.store.set("ports",this.store.getPrevious("ports")),new Error(e.join(" "));const t=this.port?this.port.getPorts():null;this.port=new PortManager(this.ports);const r=this.port.getPorts(),n=t?r.filter(e=>t.find(t=>t.id===e.id)?null:e):[...r],i=t?t.filter(e=>r.find(t=>t.id===e.id)?null:e):[];n.length>0&&this.notify("ports:added",{added:n,cell:this,node:this}),i.length>0&&this.notify("ports:removed",{removed:i,cell:this,node:this})}};var Node2;Node$1.defaults={angle:0,position:{x:0,y:0},size:{width:1,height:1}},Node2=Node$1||(Node$1={}),Node2.toStringTag=`X6.${Node2.name}`,Node2.isNode=function(e){if(null==e)return!1;if(e instanceof Node2)return!0;const t=e[Symbol.toStringTag],r=e;return(null==t||t===Node2.toStringTag)&&"function"==typeof r.isNode&&"function"==typeof r.isEdge&&"function"==typeof r.prop&&"function"==typeof r.attr&&"function"==typeof r.size&&"function"==typeof r.position},function(e){e.config({propHooks(e){var{ports:t}=e,r=__rest$d(e,["ports"]);return t&&(r.ports=Array.isArray(t)?{items:t}:t),r}})}(Node$1||(Node$1={})),function(e){e.registry=Registry.create({type:"node",process(t,r){if(ShareRegistry.exist(t,!0))throw new Error(`Node with name '${t}' was registered by anthor Edge`);if("function"==typeof r)return r.config({shape:t}),r;let n=e;const{inherit:i}=r,o=__rest$d(r,["inherit"]);if(i)if("string"==typeof i){const e=this.get(i);null==e?this.onNotFound(i,"inherited"):n=e}else n=i;null==o.constructorName&&(o.constructorName=t);const a=n.define.call(n,o);return a.config({shape:t}),a}}),ShareRegistry.setNodeRegistry(e.registry)}(Node$1||(Node$1={})),function(e){let t=0;e.define=function(r){const{constructorName:n,overwrite:i}=r,o=__rest$d(r,["constructorName","overwrite"]),a=createClass((s=n||o.shape)?pascalCase(s):(t+=1,`CustomNode${t}`),this);var s;return a.config(o),o.shape&&e.registry.register(o.shape,a,i),a},e.create=function(t){const r=t.shape||"rect",n=e.registry.get(r);return n?new n(t):e.registry.onNotFound(r)}}(Node$1||(Node$1={}));var __rest$c=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};let Edge$1=class e extends Cell{get[Symbol.toStringTag](){return e.toStringTag}constructor(e={}){super(e)}preprocess(e,t){const{source:r,sourceCell:n,sourcePort:i,sourcePoint:o,target:a,targetCell:s,targetPort:l,targetPoint:c}=e,u=__rest$c(e,["source","sourceCell","sourcePort","sourcePoint","target","targetCell","targetPort","targetPoint"]),d=e=>"string"==typeof e||"number"==typeof e;if(null!=r)if(Cell.isCell(r))u.source={cell:r.id};else if(d(r))u.source={cell:r};else if(Point.isPoint(r))u.source=r.toJSON();else if(Array.isArray(r))u.source={x:r[0],y:r[1]};else{const e=r.cell;Cell.isCell(e)?u.source=Object.assign(Object.assign({},r),{cell:e.id}):u.source=r}if(null!=n||null!=i){let e=u.source;if(null!=n){const t=d(n)?n:n.id;e?e.cell=t:e=u.source={cell:t}}null!=i&&e&&(e.port=i)}else null!=o&&(u.source=Point.create(o).toJSON());if(null!=a)if(Cell.isCell(a))u.target={cell:a.id};else if(d(a))u.target={cell:a};else if(Point.isPoint(a))u.target=a.toJSON();else if(Array.isArray(a))u.target={x:a[0],y:a[1]};else{const e=a.cell;Cell.isCell(e)?u.target=Object.assign(Object.assign({},a),{cell:e.id}):u.target=a}if(null!=s||null!=l){let e=u.target;if(null!=s){const t=d(s)?s:s.id;e?e.cell=t:e=u.target={cell:t}}null!=l&&e&&(e.port=l)}else null!=c&&(u.target=Point.create(c).toJSON());return super.preprocess(u,t)}setup(){super.setup(),this.on("change:labels",e=>this.onLabelsChanged(e)),this.on("change:vertices",e=>this.onVertexsChanged(e))}isEdge(){return!0}disconnect(e={}){return this.store.set({source:{x:0,y:0},target:{x:0,y:0}},e),this}get source(){return this.getSource()}set source(e){this.setSource(e)}getSource(){return this.getTerminal("source")}getSourceCellId(){return this.source.cell}getSourcePortId(){return this.source.port}setSource(e,t,r={}){return this.setTerminal("source",e,t,r)}get target(){return this.getTarget()}set target(e){this.setTarget(e)}getTarget(){return this.getTerminal("target")}getTargetCellId(){return this.target.cell}getTargetPortId(){return this.target.port}setTarget(e,t,r={}){return this.setTerminal("target",e,t,r)}getTerminal(e){return Object.assign({},this.store.get(e))}setTerminal(e,t,r,n={}){if(Cell.isCell(t))return this.store.set(e,merge$2({},r,{cell:t.id}),n),this;const i=t;return Point.isPoint(t)||null!=i.x&&null!=i.y?(this.store.set(e,merge$2({},r,{x:i.x,y:i.y}),n),this):(this.store.set(e,cloneDeep(t),n),this)}getSourcePoint(){return this.getTerminalPoint("source")}getTargetPoint(){return this.getTerminalPoint("target")}getTerminalPoint(e){const t=this[e];if(Point.isPointLike(t))return Point.create(t);const r=this.getTerminalCell(e);return r?r.getConnectionPoint(this,e):new Point}getSourceCell(){return this.getTerminalCell("source")}getTargetCell(){return this.getTerminalCell("target")}getTerminalCell(e){if(this.model){const t="source"===e?this.getSourceCellId():this.getTargetCellId();if(t)return this.model.getCell(t)}return null}getSourceNode(){return this.getTerminalNode("source")}getTargetNode(){return this.getTerminalNode("target")}getTerminalNode(e){let t=this;const r={};for(;t&&t.isEdge();){if(r[t.id])return null;r[t.id]=!0,t=t.getTerminalCell(e)}return t&&t.isNode()?t:null}get router(){return this.getRouter()}set router(e){null==e?this.removeRouter():this.setRouter(e)}getRouter(){return this.store.get("router")}setRouter(e,t,r){return"object"==typeof e?this.store.set("router",e,t):this.store.set("router",{name:e,args:t},r),this}removeRouter(e={}){return this.store.remove("router",e),this}get connector(){return this.getConnector()}set connector(e){null==e?this.removeConnector():this.setConnector(e)}getConnector(){return this.store.get("connector")}setConnector(e,t,r){return"object"==typeof e?this.store.set("connector",e,t):this.store.set("connector",{name:e,args:t},r),this}removeConnector(e={}){return this.store.remove("connector",e)}getDefaultLabel(){const e=this.constructor;return cloneDeep(this.store.get("defaultLabel")||e.defaultLabel||{})}get labels(){return this.getLabels()}set labels(e){this.setLabels(e)}getLabels(){return[...this.store.get("labels",[])].map(e=>this.parseLabel(e))}setLabels(e,t={}){return this.store.set("labels",Array.isArray(e)?e:[e],t),this}insertLabel(e,t,r={}){const n=this.getLabels(),i=n.length;let o=null!=t&&Number.isFinite(t)?t:i;return o<0&&(o=i+o+1),n.splice(o,0,this.parseLabel(e)),this.setLabels(n,r)}appendLabel(e,t={}){return this.insertLabel(e,-1,t)}getLabelAt(e){const t=this.getLabels();return null!=e&&Number.isFinite(e)?this.parseLabel(t[e]):null}setLabelAt(e,t,r={}){if(null!=e&&Number.isFinite(e)){const n=this.getLabels();n[e]=this.parseLabel(t),this.setLabels(n,r)}return this}removeLabelAt(e,t={}){const r=this.getLabels(),n=null!=e&&Number.isFinite(e)?e:-1,i=r.splice(n,1);return this.setLabels(r,t),i.length?i[0]:null}parseLabel(e){if("string"==typeof e){return this.constructor.parseStringLabel(e)}return e}onLabelsChanged({previous:e,current:t}){const r=e&&t?t.filter(t=>e.find(e=>t===e||isEqual(t,e))?null:t):t?[...t]:[],n=e&&t?e.filter(e=>t.find(t=>e===t||isEqual(e,t))?null:e):e?[...e]:[];r.length>0&&this.notify("labels:added",{added:r,cell:this,edge:this}),n.length>0&&this.notify("labels:removed",{removed:n,cell:this,edge:this})}get vertices(){return this.getVertices()}set vertices(e){this.setVertices(e)}getVertices(){return[...this.store.get("vertices",[])]}setVertices(e,t={}){const r=Array.isArray(e)?e:[e];return this.store.set("vertices",r.map(e=>Point.toJSON(e)),t),this}insertVertex(e,t,r={}){const n=this.getVertices(),i=n.length;let o=null!=t&&Number.isFinite(t)?t:i;return o<0&&(o=i+o+1),n.splice(o,0,Point.toJSON(e)),this.setVertices(n,r)}appendVertex(e,t={}){return this.insertVertex(e,-1,t)}getVertexAt(e){if(null!=e&&Number.isFinite(e)){return this.getVertices()[e]}return null}setVertexAt(e,t,r={}){if(null!=e&&Number.isFinite(e)){const n=this.getVertices();n[e]=t,this.setVertices(n,r)}return this}removeVertexAt(e,t={}){const r=this.getVertices(),n=null!=e&&Number.isFinite(e)?e:-1;return r.splice(n,1),this.setVertices(r,t)}onVertexsChanged({previous:e,current:t}){const r=e&&t?t.filter(t=>e.find(e=>Point.equals(t,e))?null:t):t?[...t]:[],n=e&&t?e.filter(e=>t.find(t=>Point.equals(e,t))?null:e):e?[...e]:[];r.length>0&&this.notify("vertexs:added",{added:r,cell:this,edge:this}),n.length>0&&this.notify("vertexs:removed",{removed:n,cell:this,edge:this})}getDefaultMarkup(){return this.store.get("defaultMarkup")||Markup.getEdgeMarkup()}getMarkup(){return super.getMarkup()||this.getDefaultMarkup()}translate(e,t,r={}){return r.translateBy=r.translateBy||this.id,r.tx=e,r.ty=t,this.applyToPoints(r=>({x:(r.x||0)+e,y:(r.y||0)+t}),r)}scale(e,t,r,n={}){return this.applyToPoints(n=>Point.create(n).scale(e,t,r).toJSON(),n)}applyToPoints(e,t={}){const r={},n=this.getSource(),i=this.getTarget();Point.isPointLike(n)&&(r.source=e(n)),Point.isPointLike(i)&&(r.target=e(i));const o=this.getVertices();return o.length>0&&(r.vertices=o.map(e)),this.store.set(r,t),this}getBBox(){return this.getPolyline().bbox()}getConnectionPoint(){return this.getPolyline().pointAt(.5)}getPolyline(){const e=[this.getSourcePoint(),...this.getVertices().map(e=>Point.create(e)),this.getTargetPoint()];return new Polyline(e)}updateParent(e){let t=null;const r=this.getSourceCell(),n=this.getTargetCell(),i=this.getParent();return r&&n&&(t=r===n||r.isDescendantOf(n)?n:n.isDescendantOf(r)?r:Cell.getCommonAncestor(r,n)),i&&t&&t.id!==i.id&&i.unembed(this,e),!t||i&&i.id===t.id||t.embed(this,e),t}hasLoop(e={}){const t=this.getSource(),r=this.getTarget(),n=t.cell,i=r.cell;if(!n||!i)return!1;let o=n===i;if(!o&&e.deep&&this._model){const t=this.getSourceCell(),r=this.getTargetCell();t&&r&&(o=t.isAncestorOf(r,e)||r.isAncestorOf(t,e))}return o}getFragmentAncestor(){const e=[this,this.getSourceNode(),this.getTargetNode()].filter(e=>null!=e);return this.getCommonAncestor(...e)}isFragmentDescendantOf(e){const t=this.getFragmentAncestor();return!!t&&(t.id===e.id||t.isDescendantOf(e))}};var Edge2;Edge$1.defaults={},Edge2=Edge$1||(Edge$1={}),Edge2.equalTerminals=function(e,t){const r=e,n=t;return r.cell===n.cell&&(r.port===n.port||null==r.port&&null==n.port)},function(e){e.defaultLabel={markup:[{tagName:"rect",selector:"body"},{tagName:"text",selector:"label"}],attrs:{text:{fill:"#000",fontSize:14,textAnchor:"middle",textVerticalAnchor:"middle",pointerEvents:"none"},rect:{ref:"label",fill:"#fff",rx:3,ry:3,refWidth:1,refHeight:1,refX:0,refY:0}},position:{distance:.5}},e.parseStringLabel=function(e){return{attrs:{label:{text:e}}}}}(Edge$1||(Edge$1={})),function(e){e.toStringTag=`X6.${e.name}`,e.isEdge=function(t){if(null==t)return!1;if(t instanceof e)return!0;const r=t[Symbol.toStringTag],n=t;return(null==r||r===e.toStringTag)&&"function"==typeof n.isNode&&"function"==typeof n.isEdge&&"function"==typeof n.prop&&"function"==typeof n.attr&&"function"==typeof n.disconnect&&"function"==typeof n.getSource&&"function"==typeof n.getTarget}}(Edge$1||(Edge$1={})),function(e){e.registry=Registry.create({type:"edge",process(t,r){if(ShareRegistry.exist(t,!1))throw new Error(`Edge with name '${t}' was registered by anthor Node`);if("function"==typeof r)return r.config({shape:t}),r;let n=e;const{inherit:i="edge"}=r,o=__rest$c(r,["inherit"]);if("string"==typeof i){const e=this.get(i||"edge");null==e&&i?this.onNotFound(i,"inherited"):n=e}else n=i;null==o.constructorName&&(o.constructorName=t);const a=n.define.call(n,o);return a.config({shape:t}),a}}),ShareRegistry.setEdgeRegistry(e.registry)}(Edge$1||(Edge$1={})),function(e){let t=0;e.define=function(r){const{constructorName:n,overwrite:i}=r,o=__rest$c(r,["constructorName","overwrite"]),a=createClass((s=n||o.shape)?pascalCase(s):(t+=1,`CustomEdge${t}`),this);var s;return a.config(o),o.shape&&e.registry.register(o.shape,a,i),a},e.create=function(t){const r=t.shape||"edge",n=e.registry.get(r);return n?new n(t):e.registry.onNotFound(r)}}(Edge$1||(Edge$1={})),function(e){const t="basic.edge";e.config({shape:t,propHooks(t){const{label:r,vertices:n}=t,i=__rest$c(t,["label","vertices"]);if(r){null==i.labels&&(i.labels=[]);const t="string"==typeof r?e.parseStringLabel(r):r;i.labels.push(t)}return n&&Array.isArray(n)&&(i.vertices=n.map(e=>Point.create(e).toJSON())),i}}),e.registry.register(t,e)}(Edge$1||(Edge$1={}));var __decorate$q=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class Collection extends Basecoat{constructor(e,t={}){super(),this.length=0,this.comparator=t.comparator||"zIndex",this.clean(),e&&this.reset(e,{silent:!0})}toJSON(){return this.cells.map(e=>e.toJSON())}add(e,t,r){let n,i;"number"==typeof t?(n=t,i=Object.assign({merge:!1},r)):(n=this.length,i=Object.assign({merge:!1},t)),n>this.length&&(n=this.length),n<0&&(n+=this.length+1);const o=Array.isArray(e)?e:[e],a=this.comparator&&"number"!=typeof t&&!1!==i.sort,s=this.comparator||null;let l=!1;const c=[],u=[];return o.forEach(e=>{const t=this.get(e);t?i.merge&&!e.isSameStore(t)&&(t.setProp(e.getProp(),r),u.push(t),a&&!l&&(l=null==s||"function"==typeof s?t.hasChanged():"string"==typeof s?t.hasChanged(s):s.some(e=>t.hasChanged(e)))):(c.push(e),this.reference(e))}),c.length&&(a&&(l=!0),this.cells.splice(n,0,...c),this.length=this.cells.length),l&&this.sort({silent:!0}),i.silent||(c.forEach((e,t)=>{const r={cell:e,index:n+t,options:i};this.trigger("added",r),i.dryrun||e.notify("added",Object.assign({},r))}),l&&this.trigger("sorted"),(c.length||u.length)&&this.trigger("updated",{added:c,merged:u,removed:[],options:i})),this}remove(e,t={}){const r=Array.isArray(e)?e:[e],n=this.removeCells(r,t);return!t.silent&&n.length>0&&this.trigger("updated",{options:t,removed:n,added:[],merged:[]}),Array.isArray(e)?n:n[0]}removeCells(e,t){const r=[];for(let n=0;n<e.length;n+=1){const i=this.get(e[n]);if(null==i)continue;const o=this.cells.indexOf(i);this.cells.splice(o,1),this.length-=1,delete this.map[i.id],r.push(i),this.unreference(i),t.dryrun||i.remove(),t.silent||(this.trigger("removed",{cell:i,index:o,options:t}),t.dryrun||i.notify("removed",{cell:i,index:o,options:t}))}return r}reset(e,t={}){const r=this.cells.slice();if(r.forEach(e=>this.unreference(e)),this.clean(),this.add(e,Object.assign({silent:!0},t)),!t.silent){const e=this.cells.slice();this.trigger("reseted",{options:t,previous:r,current:e});const n=[],i=[];e.forEach(e=>{r.some(t=>t.id===e.id)||n.push(e)}),r.forEach(t=>{e.some(e=>e.id===t.id)||i.push(t)}),this.trigger("updated",{options:t,added:n,removed:i,merged:[]})}return this}push(e,t){return this.add(e,this.length,t)}pop(e){const t=this.at(this.length-1);return this.remove(t,e)}unshift(e,t){return this.add(e,0,t)}shift(e){const t=this.at(0);return this.remove(t,e)}get(e){if(null==e)return null;const t="string"==typeof e||"number"==typeof e?e:e.id;return this.map[t]||null}has(e){return null!=this.get(e)}at(e){return e<0&&(e+=this.length),this.cells[e]||null}first(){return this.at(0)}last(){return this.at(-1)}indexOf(e){return this.cells.indexOf(e)}toArray(){return this.cells.slice()}sort(e={}){return null!=this.comparator&&(this.cells=sortBy(this.cells,this.comparator),e.silent||this.trigger("sorted")),this}clone(){return new(0,this.constructor)(this.cells.slice(),{comparator:this.comparator})}reference(e){this.map[e.id]=e,e.on("*",this.notifyCellEvent,this)}unreference(e){e.off("*",this.notifyCellEvent,this),delete this.map[e.id]}notifyCellEvent(e,t){const r=t.cell;this.trigger(`cell:${e}`,t),r&&(r.isNode()?this.trigger(`node:${e}`,Object.assign(Object.assign({},t),{node:r})):r.isEdge()&&this.trigger(`edge:${e}`,Object.assign(Object.assign({},t),{edge:r})))}clean(){this.length=0,this.cells=[],this.map={}}dispose(){this.reset([])}}__decorate$q([Collection.dispose()],Collection.prototype,"dispose",null);var __decorate$p=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Model2;class Model extends Basecoat{get[Symbol.toStringTag](){return Model.toStringTag}constructor(e=[]){super(),this.batches={},this.addings=new WeakMap,this.nodes={},this.edges={},this.outgoings={},this.incomings={},this.collection=new Collection(e),this.setup()}notify(e,t){this.trigger(e,t);const r=this.graph;return r&&("sorted"===e||"reseted"===e||"updated"===e?r.trigger(`model:${e}`,t):r.trigger(e,t)),this}setup(){const e=this.collection;e.on("sorted",()=>this.notify("sorted",null)),e.on("updated",e=>this.notify("updated",e)),e.on("cell:change:zIndex",()=>this.sortOnChangeZ()),e.on("added",({cell:e})=>{this.onCellAdded(e)}),e.on("removed",e=>{const t=e.cell;this.onCellRemoved(t,e.options),this.notify("cell:removed",e),t.isNode()?this.notify("node:removed",Object.assign(Object.assign({},e),{node:t})):t.isEdge()&&this.notify("edge:removed",Object.assign(Object.assign({},e),{edge:t}))}),e.on("reseted",e=>{this.onReset(e.current),this.notify("reseted",e)}),e.on("edge:change:source",({edge:e})=>this.onEdgeTerminalChanged(e,"source")),e.on("edge:change:target",({edge:e})=>{this.onEdgeTerminalChanged(e,"target")})}sortOnChangeZ(){this.collection.sort()}onCellAdded(e){const t=e.id;e.isEdge()?(e.updateParent(),this.edges[t]=!0,this.onEdgeTerminalChanged(e,"source"),this.onEdgeTerminalChanged(e,"target")):this.nodes[t]=!0}onCellRemoved(e,t){const r=e.id;if(e.isEdge()){delete this.edges[r];const t=e.getSource(),n=e.getTarget();if(t&&t.cell){const e=this.outgoings[t.cell],n=e?e.indexOf(r):-1;n>=0&&(e.splice(n,1),0===e.length&&delete this.outgoings[t.cell])}if(n&&n.cell){const e=this.incomings[n.cell],t=e?e.indexOf(r):-1;t>=0&&(e.splice(t,1),0===e.length&&delete this.incomings[n.cell])}}else delete this.nodes[r];t.clear||(t.disconnectEdges?this.disconnectConnectedEdges(e,t):this.removeConnectedEdges(e,t)),e.model===this&&(e.model=null)}onReset(e){this.nodes={},this.edges={},this.outgoings={},this.incomings={},e.forEach(e=>this.onCellAdded(e))}onEdgeTerminalChanged(e,t){const r="source"===t?this.outgoings:this.incomings,n=e.previous(t);if(n&&n.cell){const t=Cell.isCell(n.cell)?n.cell.id:n.cell,i=r[t],o=i?i.indexOf(e.id):-1;o>=0&&(i.splice(o,1),0===i.length&&delete r[t])}const i=e.getTerminal(t);if(i&&i.cell){const t=Cell.isCell(i.cell)?i.cell.id:i.cell,n=r[t]||[];-1===n.indexOf(e.id)&&n.push(e.id),r[t]=n}}prepareCell(e,t){return e.model||t&&t.dryrun||(e.model=this),null==e.zIndex&&e.setZIndex(this.getMaxZIndex()+1,{silent:!0}),e}resetCells(e,t={}){return e.map(e=>this.prepareCell(e,Object.assign(Object.assign({},t),{dryrun:!0}))),this.collection.reset(e,t),e.map(e=>this.prepareCell(e,{options:t})),this}clear(e={}){const t=this.getCells();if(0===t.length)return this;const r=Object.assign(Object.assign({},e),{clear:!0});return this.batchUpdate("clear",()=>{const e=t.sort((e,t)=>(e.isEdge()?1:2)-(t.isEdge()?1:2));for(;e.length>0;){const t=e.shift();t&&t.remove(r)}},r),this}addNode(e,t={}){const r=Node$1.isNode(e)?e:this.createNode(e);return this.addCell(r,t),r}updateNode(e,t={}){const r=this.createNode(e),n=r.getProp();return r.dispose(),this.updateCell(n,t)}createNode(e){return Node$1.create(e)}addEdge(e,t={}){const r=Edge$1.isEdge(e)?e:this.createEdge(e);return this.addCell(r,t),r}createEdge(e){return Edge$1.create(e)}updateEdge(e,t={}){const r=this.createEdge(e),n=r.getProp();return r.dispose(),this.updateCell(n,t)}addCell(e,t={}){return Array.isArray(e)?this.addCells(e,t):(this.collection.has(e)||this.addings.has(e)||(this.addings.set(e,!0),this.collection.add(this.prepareCell(e,t),t),e.eachChild(e=>this.addCell(e,t)),this.addings.delete(e)),this)}addCells(e,t={}){const r=e.length;if(0===r)return this;const n=Object.assign(Object.assign({},t),{position:r-1,maxPosition:r-1});return this.startBatch("add",Object.assign(Object.assign({},n),{cells:e})),e.forEach(e=>{this.addCell(e,n),n.position-=1}),this.stopBatch("add",Object.assign(Object.assign({},n),{cells:e})),this}updateCell(e,t={}){const r=e.id&&this.getCell(e.id);return!!r&&this.batchUpdate("update",()=>(Object.entries(e).forEach(([e,n])=>r.setProp(e,n,t)),!0),e)}removeCell(e,t={}){const r="string"==typeof e?this.getCell(e):e;return r&&this.has(r)?this.collection.remove(r,t):null}updateCellId(e,t){if(e.id===t)return;this.startBatch("update",{id:t}),e.prop("id",t);const r=e.clone({keepId:!0});this.addCell(r);return this.getConnectedEdges(e).forEach(r=>{const n=r.getSourceCell(),i=r.getTargetCell();n===e&&r.setSource(Object.assign(Object.assign({},r.getSource()),{cell:t})),i===e&&r.setTarget(Object.assign(Object.assign({},r.getTarget()),{cell:t}))}),this.removeCell(e),this.stopBatch("update",{id:t}),r}removeCells(e,t={}){return e.length?this.batchUpdate("remove",()=>e.map(e=>this.removeCell(e,t))):[]}removeConnectedEdges(e,t={}){const r=this.getConnectedEdges(e);return r.forEach(e=>{e.remove(t)}),r}disconnectConnectedEdges(e,t={}){const r="string"==typeof e?e:e.id;this.getConnectedEdges(e).forEach(e=>{const n=e.getSourceCellId(),i=e.getTargetCellId();n===r&&e.setSource({x:0,y:0},t),i===r&&e.setTarget({x:0,y:0},t)})}has(e){return this.collection.has(e)}total(){return this.collection.length}indexOf(e){return this.collection.indexOf(e)}getCell(e){return this.collection.get(e)}getCells(){return this.collection.toArray()}getFirstCell(){return this.collection.first()}getLastCell(){return this.collection.last()}getMinZIndex(){const e=this.collection.first();return e&&e.getZIndex()||0}getMaxZIndex(){const e=this.collection.last();return e&&e.getZIndex()||0}getCellsFromCache(e){return e?Object.keys(e).map(e=>this.getCell(e)).filter(e=>null!=e):[]}getNodes(){return this.getCellsFromCache(this.nodes)}getEdges(){return this.getCellsFromCache(this.edges)}getOutgoingEdges(e){const t="string"==typeof e?e:e.id,r=this.outgoings[t];return r?r.map(e=>this.getCell(e)).filter(e=>e&&e.isEdge()):null}getIncomingEdges(e){const t="string"==typeof e?e:e.id,r=this.incomings[t];return r?r.map(e=>this.getCell(e)).filter(e=>e&&e.isEdge()):null}getConnectedEdges(e,t={}){const r=[],n="string"==typeof e?this.getCell(e):e;if(null==n)return r;const i={},o=t.indirect;let a=t.incoming,s=t.outgoing;null==a&&null==s&&(a=s=!0);const l=(e,t)=>{const n=t?this.getOutgoingEdges(e):this.getIncomingEdges(e);if(null!=n&&n.forEach(e=>{i[e.id]||(r.push(e),i[e.id]=!0,o&&(a&&l(e,!1),s&&l(e,!0)))}),o&&e.isEdge()){const n=t?e.getTargetCell():e.getSourceCell();n&&n.isEdge()&&(i[n.id]||(r.push(n),l(n,t)))}};if(s&&l(n,!0),a&&l(n,!1),t.deep){const e=n.getDescendants({deep:!0}),o={};e.forEach(e=>{e.isNode()&&(o[e.id]=!0)});const l=(e,n)=>{const a=n?this.getOutgoingEdges(e.id):this.getIncomingEdges(e.id);null!=a&&a.forEach(e=>{if(!i[e.id]){const n=e.getSourceCell(),a=e.getTargetCell();if(!t.enclosed&&n&&o[n.id]&&a&&o[a.id])return;r.push(e),i[e.id]=!0}})};e.forEach(e=>{e.isEdge()||(s&&l(e,!0),a&&l(e,!1))})}return r}isBoundary(e,t){const r="string"==typeof e?this.getCell(e):e,n=t?this.getIncomingEdges(r):this.getOutgoingEdges(r);return null==n||0===n.length}getBoundaryNodes(e){const t=[];return Object.keys(this.nodes).forEach(r=>{if(this.isBoundary(r,e)){const e=this.getCell(r);e&&t.push(e)}}),t}getRoots(){return this.getBoundaryNodes(!0)}getLeafs(){return this.getBoundaryNodes(!1)}isRoot(e){return this.isBoundary(e,!0)}isLeaf(e){return this.isBoundary(e,!1)}getNeighbors(e,t={}){let r=t.incoming,n=t.outgoing;null==r&&null==n&&(r=n=!0);const i=this.getConnectedEdges(e,t).reduce((i,o)=>{const a=o.hasLoop(t),s=o.getSourceCell(),l=o.getTargetCell();return r&&s&&s.isNode()&&!i[s.id]&&(!a&&(s===e||t.deep&&s.isDescendantOf(e))||(i[s.id]=s)),n&&l&&l.isNode()&&!i[l.id]&&(!a&&(l===e||t.deep&&l.isDescendantOf(e))||(i[l.id]=l)),i},{});if(e.isEdge()){if(r){const t=e.getSourceCell();t&&t.isNode()&&!i[t.id]&&(i[t.id]=t)}if(n){const t=e.getTargetCell();t&&t.isNode()&&!i[t.id]&&(i[t.id]=t)}}return Object.keys(i).map(e=>i[e])}isNeighbor(e,t,r={}){let n=r.incoming,i=r.outgoing;return null==n&&null==i&&(n=i=!0),this.getConnectedEdges(e,r).some(e=>{const r=e.getSourceCell(),o=e.getTargetCell();return!(!n||!r||r.id!==t.id)||!(!i||!o||o.id!==t.id)})}getSuccessors(e,t={}){const r=[];return this.search(e,(n,i)=>{n!==e&&this.matchDistance(i,t.distance)&&r.push(n)},Object.assign(Object.assign({},t),{outgoing:!0})),r}isSuccessor(e,t,r={}){let n=!1;return this.search(e,(i,o)=>{if(i===t&&i!==e&&this.matchDistance(o,r.distance))return n=!0,!1},Object.assign(Object.assign({},r),{outgoing:!0})),n}getPredecessors(e,t={}){const r=[];return this.search(e,(n,i)=>{n!==e&&this.matchDistance(i,t.distance)&&r.push(n)},Object.assign(Object.assign({},t),{incoming:!0})),r}isPredecessor(e,t,r={}){let n=!1;return this.search(e,(i,o)=>{if(i===t&&i!==e&&this.matchDistance(o,r.distance))return n=!0,!1},Object.assign(Object.assign({},r),{incoming:!0})),n}matchDistance(e,t){return null==t||("function"==typeof t?t(e):!(!Array.isArray(t)||!t.includes(e))||e===t)}getCommonAncestor(...e){const t=[];return e.forEach(e=>{e&&(Array.isArray(e)?t.push(...e):t.push(e))}),Cell.getCommonAncestor(...t)}getSubGraph(e,t={}){const r=[],n={},i=[],o=[],a=e=>{n[e.id]||(r.push(e),n[e.id]=e,e.isEdge()&&o.push(e),e.isNode()&&i.push(e))};return e.forEach(e=>{if(a(e),t.deep){e.getDescendants({deep:!0}).forEach(e=>a(e))}}),o.forEach(e=>{const t=e.getSourceCell(),o=e.getTargetCell();t&&!n[t.id]&&(r.push(t),n[t.id]=t,t.isNode()&&i.push(t)),o&&!n[o.id]&&(r.push(o),n[o.id]=o,o.isNode()&&i.push(o))}),i.forEach(e=>{this.getConnectedEdges(e,t).forEach(e=>{const t=e.getSourceCell(),i=e.getTargetCell();!n[e.id]&&t&&n[t.id]&&i&&n[i.id]&&(r.push(e),n[e.id]=e)})}),r}cloneSubGraph(e,t={}){const r=this.getSubGraph(e,t);return this.cloneCells(r)}cloneCells(e){return Cell.cloneCells(e)}getNodesFromPoint(e,t){const r="number"==typeof e?{x:e,y:t||0}:e;return this.getNodes().filter(e=>e.getBBox().containsPoint(r))}getNodesInArea(e,t,r,n,i){const o="number"==typeof e?new Rectangle(e,t,r,n):Rectangle.create(e),a="number"==typeof e?i:t,s=a&&a.strict;return this.getNodes().filter(e=>{const t=e.getBBox();return s?o.containsRect(t):o.isIntersectWithRect(t)})}getEdgesInArea(e,t,r,n,i){const o="number"==typeof e?new Rectangle(e,t,r,n):Rectangle.create(e),a="number"==typeof e?i:t,s=a&&a.strict;return this.getEdges().filter(e=>{const t=e.getBBox();return 0===t.width?t.inflate(1,0):0===t.height&&t.inflate(0,1),s?o.containsRect(t):o.isIntersectWithRect(t)})}getNodesUnderNode(e,t={}){const r=e.getBBox();return(null==t.by||"bbox"===t.by?this.getNodesInArea(r):this.getNodesFromPoint(r[t.by])).filter(t=>e.id!==t.id&&!t.isDescendantOf(e))}getAllCellsBBox(){return this.getCellsBBox(this.getCells())}getCellsBBox(e,t={}){return Cell.getCellsBBox(e,t)}search(e,t,r={}){r.breadthFirst?this.breadthFirstSearch(e,t,r):this.depthFirstSearch(e,t,r)}breadthFirstSearch(e,t,r={}){const n=[],i={},o={};for(n.push(e),o[e.id]=0;n.length>0;){const e=n.shift();if(null==e||i[e.id])continue;if(i[e.id]=!0,!1===call$1(t,this,e,o[e.id]))continue;this.getNeighbors(e,r).forEach(t=>{o[t.id]=o[e.id]+1,n.push(t)})}}depthFirstSearch(e,t,r={}){const n=[],i={},o={};for(n.push(e),o[e.id]=0;n.length>0;){const e=n.pop();if(null==e||i[e.id])continue;if(i[e.id]=!0,!1===call$1(t,this,e,o[e.id]))continue;const a=this.getNeighbors(e,r),s=n.length;a.forEach(t=>{o[t.id]=o[e.id]+1,n.splice(s,0,t)})}}getShortestPath(e,t,r={}){const n={};this.getEdges().forEach(e=>{const t=e.getSourceCellId(),i=e.getTargetCellId();t&&i&&(n[t]||(n[t]=[]),n[i]||(n[i]=[]),n[t].push(i),r.directed||n[i].push(t))});const i="string"==typeof e?e:e.id,o=Dijkstra.run(n,i,r.weight),a=[];let s="string"==typeof t?t:t.id;for(o[s]&&a.push(s);s=o[s];)a.unshift(s);return a}translate(e,t,r){return this.getCells().filter(e=>!e.hasParent()).forEach(n=>n.translate(e,t,r)),this}resize(e,t,r){return this.resizeCells(e,t,this.getCells(),r)}resizeCells(e,t,r,n={}){const i=this.getCellsBBox(r);if(i){const o=Math.max(e/i.width,0),a=Math.max(t/i.height,0),s=i.getOrigin();r.forEach(e=>e.scale(o,a,s,n))}return this}toJSON(e={}){return Model.toJSON(this.getCells(),e)}parseJSON(e){return Model.fromJSON(e)}fromJSON(e,t={}){const r=this.parseJSON(e);return this.resetCells(r,t),this}startBatch(e,t={}){return this.batches[e]=(this.batches[e]||0)+1,this.notify("batch:start",{name:e,data:t}),this}stopBatch(e,t={}){return this.batches[e]=(this.batches[e]||0)-1,this.notify("batch:stop",{name:e,data:t}),this}batchUpdate(e,t,r={}){this.startBatch(e,r);const n=t();return this.stopBatch(e,r),n}hasActiveBatch(e=Object.keys(this.batches)){return(Array.isArray(e)?e:[e]).some(e=>this.batches[e]>0)}dispose(){this.collection.dispose()}}__decorate$p([Model.dispose()],Model.prototype,"dispose",null),Model2=Model||(Model={}),Model2.toStringTag=`X6.${Model2.name}`,Model2.isModel=function(e){if(null==e)return!1;if(e instanceof Model2)return!0;const t=e[Symbol.toStringTag],r=e;return(null==t||t===Model2.toStringTag)&&"function"==typeof r.addNode&&"function"==typeof r.addEdge&&null!=r.collection},function(e){e.toJSON=function(e,t={}){return{cells:e.map(e=>e.toJSON(t))}},e.fromJSON=function(e){const t=[];return Array.isArray(e)?t.push(...e):(e.cells&&t.push(...e.cells),e.nodes&&e.nodes.forEach(e=>{null==e.shape&&(e.shape="rect"),t.push(e)}),e.edges&&e.edges.forEach(e=>{null==e.shape&&(e.shape="edge"),t.push(e)})),t.map(e=>{const t=e.shape;if(t){if(Node$1.registry.exist(t))return Node$1.create(e);if(Edge$1.registry.exist(t))return Edge$1.create(e)}throw new Error("The `shape` should be specified when creating a node/edge instance")})}}(Model||(Model={}));var __rest$b=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};let Base$1=class extends Node$1{get label(){return this.getLabel()}set label(e){this.setLabel(e)}getLabel(){return this.getAttrByPath("text/text")}setLabel(e,t){return null==e?this.removeLabel():this.setAttrByPath("text/text",e,t),this}removeLabel(){return this.removeAttrByPath("text/text"),this}};var Base2;Base2=Base$1||(Base$1={}),Base2.bodyAttr={fill:"#ffffff",stroke:"#333333",strokeWidth:2},Base2.labelAttr={fontSize:14,fill:"#000000",refX:.5,refY:.5,textAnchor:"middle",textVerticalAnchor:"middle",fontFamily:"Arial, helvetica, sans-serif"},Base2.config({attrs:{text:Object.assign({},Base2.labelAttr)},propHooks(e){const{label:t}=e,r=__rest$b(e,["label"]);return t&&setByPath(r,"attrs/text/text",t),r},visible:!0});var __rest$a=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};function getMarkup(e,t="body"){return[{tagName:e,selector:t},{tagName:"text",selector:"label"}]}function getImageUrlHook(e="xlink:href"){return t=>{const{imageUrl:r,imageWidth:n,imageHeight:i}=t,o=__rest$a(t,["imageUrl","imageWidth","imageHeight"]);if(null!=r||null!=n||null!=i){const t=()=>{if(o.attrs){const t=o.attrs.image;null!=r&&(t[e]=r),null!=n&&(t.width=n),null!=i&&(t.height=i),o.attrs.image=t}};o.attrs?(null==o.attrs.image&&(o.attrs.image={}),t()):(o.attrs={image:{}},t())}return o}}function createShape(e,t,r={}){const n={constructorName:e,markup:getMarkup(e,r.selector),attrs:{[e]:Object.assign({},Base$1.bodyAttr)}};return(r.parent||Base$1).define(merge$2(n,t,{shape:e}))}createShape("rect",{attrs:{body:{refWidth:"100%",refHeight:"100%"}}});const Edge=Edge$1.define({shape:"edge",markup:[{tagName:"path",selector:"wrap",groupSelector:"lines",attrs:{fill:"none",cursor:"pointer",stroke:"transparent",strokeLinecap:"round"}},{tagName:"path",selector:"line",groupSelector:"lines",attrs:{fill:"none",pointerEvents:"none"}}],attrs:{lines:{connection:!0,strokeLinejoin:"round"},wrap:{strokeWidth:10},line:{stroke:"#333",strokeWidth:2,targetMarker:"classic"}}});createShape("ellipse",{attrs:{body:{refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"}}});var __rest$9=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};class Poly extends Base$1{get points(){return this.getPoints()}set points(e){this.setPoints(e)}getPoints(){return this.getAttrByPath("body/refPoints")}setPoints(e,t){return null==e?this.removePoints():this.setAttrByPath("body/refPoints",Poly.pointsToString(e),t),this}removePoints(){return this.removeAttrByPath("body/refPoints"),this}}!function(e){function t(e){return"string"==typeof e?e:e.map(e=>Array.isArray(e)?e.join(","):Point.isPointLike(e)?`${e.x}, ${e.y}`:"").join(" ")}e.pointsToString=t,e.config({propHooks(e){const{points:r}=e,n=__rest$9(e,["points"]);if(r){const e=t(r);e&&setByPath(n,"attrs/body/refPoints",e)}return n}})}(Poly||(Poly={})),createShape("polygon",{},{parent:Poly}),createShape("polyline",{},{parent:Poly});var __rest$8=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};Base$1.define({shape:"path",markup:[{tagName:"rect",selector:"bg"},{tagName:"path",selector:"body"},{tagName:"text",selector:"label"}],attrs:{bg:{refWidth:"100%",refHeight:"100%",fill:"none",stroke:"none",pointerEvents:"all"},body:{fill:"none",stroke:"#000",strokeWidth:2}},propHooks(e){const{path:t}=e,r=__rest$8(e,["path"]);return t&&setByPath(r,"attrs/body/refD",t),r}});var __rest$7=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},NodeView2;Base$1.define({shape:"text-block",markup:[{tagName:"rect",selector:"body"},Platform.SUPPORT_FOREIGNOBJECT?{tagName:"foreignObject",selector:"foreignObject",children:[{tagName:"div",ns:ns.xhtml,selector:"label",style:{width:"100%",height:"100%",position:"static",backgroundColor:"transparent",textAlign:"center",margin:0,padding:"0px 5px",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center"}}]}:{tagName:"text",selector:"label",attrs:{textAnchor:"middle"}}],attrs:{body:Object.assign(Object.assign({},Base$1.bodyAttr),{refWidth:"100%",refHeight:"100%"}),foreignObject:{refWidth:"100%",refHeight:"100%"},label:{style:{fontSize:14}}},propHooks(e){const{text:t}=e,r=__rest$7(e,["text"]);return t&&setByPath(r,"attrs/label/text",t),r},attrHooks:{text:{set(e,{cell:t,view:r,refBBox:n,elem:i,attrs:o}){if(!(i instanceof HTMLElement)){const a=o.style||{},s={text:e,width:-5,height:"100%"},l=Object.assign({textVerticalAnchor:"middle"},a);return call$1(Attr.presets.textWrap.set,this,s,{cell:t,view:r,elem:i,refBBox:n,attrs:l}),{fill:a.color||null}}i.textContent=e},position(e,{refBBox:t,elem:r}){if(r instanceof SVGElement)return t.getCenter()}}}}),createShape("image",{attrs:{image:{refWidth:"100%",refHeight:"100%"}},propHooks:getImageUrlHook()},{selector:"image"}),createShape("circle",{attrs:{body:{refCx:"50%",refCy:"50%",refR:"50%"}}});class NodeView extends CellView{constructor(){super(...arguments),this.portsCache={}}get[Symbol.toStringTag](){return NodeView.toStringTag}getContainerClassName(){const e=[super.getContainerClassName(),this.prefixClassName("node")];return this.can("nodeMovable")||e.push(this.prefixClassName("node-immovable")),e.join(" ")}updateClassName(e){const t=e.target;if(t.hasAttribute("magnet")){const e=this.prefixClassName("port-unconnectable");this.can("magnetConnectable")?removeClass(t,e):addClass(t,e)}else{const e=this.prefixClassName("node-immovable");this.can("nodeMovable")?this.removeClass(e):this.addClass(e)}}isNodeView(){return!0}confirmUpdate(e,t={}){let r=e;return this.hasAction(r,"ports")&&(this.removePorts(),this.cleanPortsCache()),this.hasAction(r,"render")?(this.render(),r=this.removeAction(r,["render","update","resize","translate","rotate","ports","tools"])):(r=this.handleAction(r,"resize",()=>this.resize(),"update"),r=this.handleAction(r,"update",()=>this.update(),"ports"),r=this.handleAction(r,"translate",()=>this.translate()),r=this.handleAction(r,"rotate",()=>this.rotate()),r=this.handleAction(r,"ports",()=>this.renderPorts()),r=this.handleAction(r,"tools",()=>{this.getFlag("tools")===e?this.renderTools():this.updateTools(t)})),r}update(e){this.cleanCache(),this.removePorts();const t=this.cell,r=t.getSize(),n=t.getAttrs();this.updateAttrs(this.container,n,{attrs:e===n?null:e,rootBBox:new Rectangle(0,0,r.width,r.height),selectors:this.selectors}),this.renderPorts()}renderMarkup(){const e=this.cell.markup;if(e){if("string"==typeof e)throw new TypeError("Not support string markup.");return this.renderJSONMarkup(e)}throw new TypeError("Invalid node markup.")}renderJSONMarkup(e){const t=this.parseJSONMarkup(e,this.container);this.selectors=t.selectors,this.container.appendChild(t.fragment)}render(){return this.empty(),this.renderMarkup(),this.resize(),this.updateTransform(),this.renderTools(),this}resize(){this.cell.getAngle()&&this.rotate(),this.update()}translate(){this.updateTransform()}rotate(){this.updateTransform()}getTranslationString(){const e=this.cell.getPosition();return`translate(${e.x},${e.y})`}getRotationString(){const e=this.cell.getAngle();if(e){const t=this.cell.getSize();return`rotate(${e},${t.width/2},${t.height/2})`}}updateTransform(){let e=this.getTranslationString();const t=this.getRotationString();t&&(e+=` ${t}`),this.container.setAttribute("transform",e)}findPortElem(e,t){const r=e?this.portsCache[e]:null;if(!r)return null;const n=r.portContentElement,i=r.portContentSelectors||{};return this.findOne(t,n,i)}cleanPortsCache(){this.portsCache={}}removePorts(){Object.values(this.portsCache).forEach(e=>{remove(e.portElement)})}renderPorts(){const e=this.container,t=[];e.childNodes.forEach(e=>{t.push(e)});const r=this.cell.getParsedPorts(),n=groupBy(r,"zIndex"),i="auto";n[i]&&n[i].forEach(r=>{const n=this.getPortElement(r);e.append(n),t.push(n)}),Object.keys(n).forEach(e=>{if(e!==i){const r=parseInt(e,10);this.appendPorts(n[e],r,t)}}),this.updatePorts()}appendPorts(e,t,r){const n=e.map(e=>this.getPortElement(e));r[t]||t<0?before(r[Math.max(t,0)],n):append(this.container,n)}getPortElement(e){const t=this.portsCache[e.id];return t?t.portElement:this.createPortElement(e)}createPortElement(e){let t=Markup.renderMarkup(this.cell.getPortContainerMarkup());const r=t.elem;if(null==r)throw new Error("Invalid port container markup.");t=Markup.renderMarkup(this.getPortMarkup(e));const n=t.elem,i=t.selectors;if(null==n)throw new Error("Invalid port markup.");this.setAttrs({port:e.id,"port-group":e.group},n);let o="x6-port";e.group&&(o+=` x6-port-${e.group}`),addClass(r,o),addClass(r,"x6-port"),addClass(n,"x6-port-body"),r.appendChild(n);let a,s,l=i;if(this.existPortLabel(e)){if(t=Markup.renderMarkup(this.getPortLabelMarkup(e.label)),a=t.elem,s=t.selectors,null==a)throw new Error("Invalid port label markup.");if(i&&s){for(const e in s)if(i[e]&&e!==this.rootSelector)throw new Error("Selectors within port must be unique.");l=Object.assign(Object.assign({},i),s)}addClass(a,"x6-port-label"),r.appendChild(a)}return this.portsCache[e.id]={portElement:r,portSelectors:l,portLabelElement:a,portLabelSelectors:s,portContentElement:n,portContentSelectors:i},this.graph.options.onPortRendered&&this.graph.options.onPortRendered({port:e,node:this.cell,container:r,selectors:l,labelContainer:a,labelSelectors:s,contentContainer:n,contentSelectors:i}),r}updatePorts(){const e=this.cell.getParsedGroups(),t=Object.keys(e);0===t.length?this.updatePortGroup():t.forEach(e=>this.updatePortGroup(e))}updatePortGroup(e){const t=Rectangle.fromSize(this.cell.getSize()),r=this.cell.getPortsLayoutByGroup(e,t);for(let n=0,i=r.length;n<i;n+=1){const e=r[n],t=e.portId,i=this.portsCache[t]||{},o=e.portLayout;if(this.applyPortTransform(i.portElement,o),null!=e.portAttrs){const t={selectors:i.portSelectors||{}};e.portSize&&(t.rootBBox=Rectangle.fromSize(e.portSize)),this.updateAttrs(i.portElement,e.portAttrs,t)}const a=e.labelLayout;if(a&&i.portLabelElement&&(this.applyPortTransform(i.portLabelElement,a,-(o.angle||0)),a.attrs)){const t={selectors:i.portLabelSelectors||{}};e.labelSize&&(t.rootBBox=Rectangle.fromSize(e.labelSize)),this.updateAttrs(i.portLabelElement,a.attrs,t)}}}applyPortTransform(e,t,r=0){const n=t.angle,i=t.position;transform(e,createSVGMatrix().rotate(r).translate(i.x||0,i.y||0).rotate(n||0),{absolute:!0})}getPortMarkup(e){return e.markup||this.cell.portMarkup}getPortLabelMarkup(e){return e.markup||this.cell.portLabelMarkup}existPortLabel(e){return e.attrs&&e.attrs.text}getEventArgs(e,t,r){const n=this,i=n.cell;return null==t||null==r?{e:e,view:n,node:i,cell:i}:{e:e,x:t,y:r,view:n,node:i,cell:i}}getPortEventArgs(e,t,r){const n=this,i=n.cell,o=i;return r?{e:e,x:r.x,y:r.y,view:n,node:i,cell:o,port:t}:{e:e,view:n,node:i,cell:o,port:t}}notifyMouseDown(e,t,r){super.onMouseDown(e,t,r),this.notify("node:mousedown",this.getEventArgs(e,t,r))}notifyMouseMove(e,t,r){super.onMouseMove(e,t,r),this.notify("node:mousemove",this.getEventArgs(e,t,r))}notifyMouseUp(e,t,r){super.onMouseUp(e,t,r),this.notify("node:mouseup",this.getEventArgs(e,t,r))}notifyPortEvent(e,t,r){const n=this.findAttr("port",t.target);if(n){const i=t.type;"node:port:mouseenter"===e?t.type="mouseenter":"node:port:mouseleave"===e&&(t.type="mouseleave"),this.notify(e,this.getPortEventArgs(t,n,r)),t.type=i}}onClick(e,t,r){super.onClick(e,t,r),this.notify("node:click",this.getEventArgs(e,t,r)),this.notifyPortEvent("node:port:click",e,{x:t,y:r})}onDblClick(e,t,r){super.onDblClick(e,t,r),this.notify("node:dblclick",this.getEventArgs(e,t,r)),this.notifyPortEvent("node:port:dblclick",e,{x:t,y:r})}onContextMenu(e,t,r){super.onContextMenu(e,t,r),this.notify("node:contextmenu",this.getEventArgs(e,t,r)),this.notifyPortEvent("node:port:contextmenu",e,{x:t,y:r})}onMouseDown(e,t,r){this.isPropagationStopped(e)||(this.notifyMouseDown(e,t,r),this.notifyPortEvent("node:port:mousedown",e,{x:t,y:r}),this.startNodeDragging(e,t,r))}onMouseMove(e,t,r){const n=this.getEventData(e),i=n.action;if("magnet"===i)this.dragMagnet(e,t,r);else{if("move"===i){const i=n.targetView||this;i.dragNode(e,t,r),i.notify("node:moving",{e:e,x:t,y:r,view:i,cell:i.cell,node:i.cell})}this.notifyMouseMove(e,t,r),this.notifyPortEvent("node:port:mousemove",e,{x:t,y:r})}this.setEventData(e,n)}onMouseUp(e,t,r){const n=this.getEventData(e),i=n.action;if("magnet"===i)this.stopMagnetDragging(e,t,r);else if(this.notifyMouseUp(e,t,r),this.notifyPortEvent("node:port:mouseup",e,{x:t,y:r}),"move"===i){(n.targetView||this).stopNodeDragging(e,t,r)}const o=n.targetMagnet;o&&this.onMagnetClick(e,o,t,r),this.checkMouseleave(e)}onMouseOver(e){super.onMouseOver(e),this.notify("node:mouseover",this.getEventArgs(e)),this.notifyPortEvent("node:port:mouseenter",e),this.notifyPortEvent("node:port:mouseover",e)}onMouseOut(e){super.onMouseOut(e),this.notify("node:mouseout",this.getEventArgs(e)),this.notifyPortEvent("node:port:mouseleave",e),this.notifyPortEvent("node:port:mouseout",e)}onMouseEnter(e){this.updateClassName(e),super.onMouseEnter(e),this.notify("node:mouseenter",this.getEventArgs(e))}onMouseLeave(e){super.onMouseLeave(e),this.notify("node:mouseleave",this.getEventArgs(e))}onMouseWheel(e,t,r,n){super.onMouseWheel(e,t,r,n),this.notify("node:mousewheel",Object.assign({delta:n},this.getEventArgs(e,t,r)))}onMagnetClick(e,t,r,n){const i=this.graph;i.view.getMouseMovedCount(e)>i.options.clickThreshold||this.notify("node:magnet:click",Object.assign({magnet:t},this.getEventArgs(e,r,n)))}onMagnetDblClick(e,t,r,n){this.notify("node:magnet:dblclick",Object.assign({magnet:t},this.getEventArgs(e,r,n)))}onMagnetContextMenu(e,t,r,n){this.notify("node:magnet:contextmenu",Object.assign({magnet:t},this.getEventArgs(e,r,n)))}onMagnetMouseDown(e,t,r,n){this.startMagnetDragging(e,r,n)}onCustomEvent(e,t,r,n){this.notify("node:customevent",Object.assign({name:t},this.getEventArgs(e,r,n))),super.onCustomEvent(e,t,r,n)}prepareEmbedding(e){const t=this.graph,r=this.getEventData(e).cell||this.cell,n=t.findViewByCell(r),i=t.snapToGrid(e.clientX,e.clientY);this.notify("node:embed",{e:e,node:r,view:n,cell:r,x:i.x,y:i.y,currentParent:r.getParent()})}processEmbedding(e,t){const r=t.cell||this.cell,n=t.graph||this.graph,i=n.options.embedding,o=i.findParent;let a="function"==typeof o?call$1(o,n,{view:this,node:this.cell}).filter(e=>Cell.isCell(e)&&this.cell.id!==e.id&&!e.isDescendantOf(this.cell)):n.model.getNodesUnderNode(r,{by:o});if(i.frontOnly&&a.length>0){const e=groupBy(a,"zIndex"),t=max(Object.keys(e).map(e=>parseInt(e,10)));t&&(a=e[t])}a=a.filter(e=>e.visible);let s=null;const l=t.candidateEmbedView,c=i.validate;for(let d=a.length-1;d>=0;d-=1){const e=a[d];if(l&&l.cell.id===e.id){s=l;break}{const t=e.findView(n);if(c&&call$1(c,n,{child:this.cell,parent:t.cell,childView:this,parentView:t})){s=t;break}}}this.clearEmbedding(t),s&&s.highlight(null,{type:"embedding"}),t.candidateEmbedView=s;const u=n.snapToGrid(e.clientX,e.clientY);this.notify("node:embedding",{e:e,cell:r,node:r,view:n.findViewByCell(r),x:u.x,y:u.y,currentParent:r.getParent(),candidateParent:s?s.cell:null})}clearEmbedding(e){const t=e.candidateEmbedView;t&&(t.unhighlight(null,{type:"embedding"}),e.candidateEmbedView=null)}finalizeEmbedding(e,t){this.graph.startBatch("embedding");const r=t.cell||this.cell,n=t.graph||this.graph,i=n.findViewByCell(r),o=r.getParent(),a=t.candidateEmbedView;if(a?(a.unhighlight(null,{type:"embedding"}),t.candidateEmbedView=null,null!=o&&o.id===a.cell.id||a.cell.insertChild(r,void 0,{ui:!0})):o&&o.unembed(r,{ui:!0}),n.model.getConnectedEdges(r,{deep:!0}).forEach(e=>{e.updateParent({ui:!0})}),i&&a){const t=n.snapToGrid(e.clientX,e.clientY);i.notify("node:embedded",{e:e,cell:r,x:t.x,y:t.y,node:r,view:n.findViewByCell(r),previousParent:o,currentParent:r.getParent()})}this.graph.stopBatch("embedding")}getDelegatedView(){let e=this.cell,t=this;for(;t&&!e.isEdge();){if(!e.hasParent()||t.can("stopDelegateOnDragging"))return t;e=e.getParent(),t=this.graph.findViewByCell(e)}return null}validateMagnet(e,t,r){if("passive"!==t.getAttribute("magnet")){const n=this.graph.options.connecting.validateMagnet;return!n||call$1(n,this.graph,{e:r,magnet:t,view:e,cell:e.cell})}return!1}startMagnetDragging(e,t,r){if(!this.can("magnetConnectable"))return;e.stopPropagation();const n=e.currentTarget,i=this.graph;this.setEventData(e,{targetMagnet:n}),this.validateMagnet(this,n,e)?(i.options.magnetThreshold<=0&&this.startConnectting(e,n,t,r),this.setEventData(e,{action:"magnet"}),this.stopPropagation(e)):this.onMouseDown(e,t,r),i.view.delegateDragEvents(e,this)}startConnectting(e,t,r,n){this.graph.model.startBatch("add-edge");const i=this.createEdgeFromMagnet(t,r,n);i.setEventData(e,i.prepareArrowheadDragging("target",{x:r,y:n,isNewEdge:!0,fallbackAction:"remove"})),this.setEventData(e,{edgeView:i}),i.notifyMouseDown(e,r,n)}getDefaultEdge(e,t){let r;const n=this.graph.options.connecting.createEdge;return n&&(r=call$1(n,this.graph,{sourceMagnet:t,sourceView:e,sourceCell:e.cell})),r}createEdgeFromMagnet(e,t,r){const n=this.graph,i=n.model,o=this.getDefaultEdge(this,e);return o.setSource(Object.assign(Object.assign({},o.getSource()),this.getEdgeTerminal(e,t,r,o,"source"))),o.setTarget(Object.assign(Object.assign({},o.getTarget()),{x:t,y:r})),o.addTo(i,{async:!1,ui:!0}),o.findView(n)}dragMagnet(e,t,r){const n=this.getEventData(e),i=n.edgeView;if(i)i.onMouseMove(e,t,r),this.autoScrollGraph(e.clientX,e.clientY);else{const i=this.graph,o=i.options.magnetThreshold,a=this.getEventTarget(e),s=n.targetMagnet;if("onleave"===o){if(s===a||s.contains(a))return}else if(i.view.getMouseMovedCount(e)<=o)return;this.startConnectting(e,s,t,r)}}stopMagnetDragging(e,t,r){const n=this.eventData(e).edgeView;n&&(n.onMouseUp(e,t,r),this.graph.model.stopBatch("add-edge"))}notifyUnhandledMouseDown(e,t,r){this.notify("node:unhandled:mousedown",{e:e,x:t,y:r,view:this,cell:this.cell,node:this.cell})}notifyNodeMove(e,t,r,n,i){let o=[i];const a=this.graph.getPlugin("selection");if(a&&a.isSelectionMovable()){const e=a.getSelectedCells();e.includes(i)&&(o=e.filter(e=>e.isNode()))}o.forEach(i=>{this.notify(e,{e:t,x:r,y:n,cell:i,node:i,view:i.findView(this.graph)})})}getRestrictArea(e){const t=this.graph.options.translating.restrict,r="function"==typeof t?call$1(t,this.graph,e):t;return"number"==typeof r?this.graph.transform.getGraphArea().inflate(r):!0===r?this.graph.transform.getGraphArea():r||null}startNodeDragging(e,t,r){const n=this.getDelegatedView();if(null==n||!n.can("nodeMovable"))return this.notifyUnhandledMouseDown(e,t,r);this.setEventData(e,{targetView:n,action:"move"});const i=Point.create(n.cell.getPosition());n.setEventData(e,{moving:!1,offset:i.diff(t,r),restrict:this.getRestrictArea(n)})}dragNode(e,t,r){const n=this.cell,i=this.graph,o=i.getGridSize(),a=this.getEventData(e),s=a.offset,l=a.restrict;a.moving||(a.moving=!0,this.addClass("node-moving"),this.notifyNodeMove("node:move",e,t,r,this.cell)),this.autoScrollGraph(e.clientX,e.clientY);const c=GeometryUtil.snapToGrid(t+s.x,o),u=GeometryUtil.snapToGrid(r+s.y,o);n.setPosition(c,u,{restrict:l,deep:!0,ui:!0}),i.options.embedding.enabled&&(a.embedding||(this.prepareEmbedding(e),a.embedding=!0),this.processEmbedding(e,a))}autoOffsetNode(){const e=this.cell,t=this.graph,r=Object.assign({id:e.id},e.getPosition()),n=t.getNodes().map(e=>{const t=e.getPosition();return{id:e.id,x:t.x,y:t.y}}).filter(e=>e.id!==r.id),i=[[1,1],[1,-1],[-1,1],[-1,-1]];let o=t.getGridSize();const a=e=>n.some(t=>t.x===e.x&&t.y===e.y);for(;a(r);){let n=!1;for(let t=0;t<i.length;t+=1){const s=i[t];if(!a({x:r.x+s[0]*o,y:r.y+s[1]*o})){e.translate(s[0]*o,s[1]*o),n=!0;break}}if(n)break;o+=t.getGridSize()}}stopNodeDragging(e,t,r){const n=this.getEventData(e),i=this.graph;if(n.embedding&&this.finalizeEmbedding(e,n),n.moving){i.options.translating.autoOffset&&this.autoOffsetNode(),this.removeClass("node-moving"),this.notifyNodeMove("node:moved",e,t,r,this.cell)}n.moving=!1,n.embedding=!1}autoScrollGraph(e,t){const r=this.graph.getPlugin("scroller");r&&r.autoScroll(e,t)}}NodeView2=NodeView||(NodeView={}),NodeView2.toStringTag=`X6.${NodeView2.name}`,NodeView2.isNodeView=function(e){if(null==e)return!1;if(e instanceof NodeView2)return!0;const t=e[Symbol.toStringTag],r=e;return(null==t||t===NodeView2.toStringTag)&&"function"==typeof r.isNodeView&&"function"==typeof r.isEdgeView&&"function"==typeof r.confirmUpdate&&"function"==typeof r.update&&"function"==typeof r.findPortElem&&"function"==typeof r.resize&&"function"==typeof r.rotate&&"function"==typeof r.translate},NodeView.config({isSvgElement:!0,priority:0,bootstrap:["render"],actions:{view:["render"],markup:["render"],attrs:["update"],size:["resize","ports","tools"],angle:["rotate","tools"],position:["translate","tools"],ports:["ports"],tools:["tools"]}}),NodeView.registry.register("node",NodeView,!0);var __rest$6=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},EdgeView2;class EdgeView extends CellView{constructor(){super(...arguments),this.POINT_ROUNDING=2,this.labelDestroyFn={}}get[Symbol.toStringTag](){return EdgeView.toStringTag}getContainerClassName(){return[super.getContainerClassName(),this.prefixClassName("edge")].join(" ")}get sourceBBox(){const e=this.sourceView;if(!e){const e=this.cell.getSource();return new Rectangle(e.x,e.y)}const t=this.sourceMagnet;return e.isEdgeElement(t)?new Rectangle(this.sourceAnchor.x,this.sourceAnchor.y):e.getBBoxOfElement(t||e.container)}get targetBBox(){const e=this.targetView;if(!e){const e=this.cell.getTarget();return new Rectangle(e.x,e.y)}const t=this.targetMagnet;return e.isEdgeElement(t)?new Rectangle(this.targetAnchor.x,this.targetAnchor.y):e.getBBoxOfElement(t||e.container)}isEdgeView(){return!0}confirmUpdate(e,t={}){let r=e;if(this.hasAction(r,"source")){if(!this.updateTerminalProperties("source"))return r;r=this.removeAction(r,"source")}if(this.hasAction(r,"target")){if(!this.updateTerminalProperties("target"))return r;r=this.removeAction(r,"target")}return this.hasAction(r,"render")?(this.render(),r=this.removeAction(r,["render","update","labels","tools"]),r):(r=this.handleAction(r,"update",()=>this.update(t)),r=this.handleAction(r,"labels",()=>this.onLabelsChange(t)),r=this.handleAction(r,"tools",()=>this.renderTools()),r)}render(){return this.empty(),this.renderMarkup(),this.labelContainer=null,this.renderLabels(),this.update(),this.renderTools(),this}renderMarkup(){const e=this.cell.markup;if(e){if("string"==typeof e)throw new TypeError("Not support string markup.");return this.renderJSONMarkup(e)}throw new TypeError("Invalid edge markup.")}renderJSONMarkup(e){const t=this.parseJSONMarkup(e,this.container);this.selectors=t.selectors,this.container.append(t.fragment)}customizeLabels(){if(this.labelContainer){const e=this.cell,t=e.labels;for(let r=0,n=t.length;r<n;r+=1){const n=t[r],i=this.labelCache[r],o=this.labelSelectors[r],a=this.graph.options.onEdgeLabelRendered;if(a){const t=a({edge:e,label:n,container:i,selectors:o});t&&(this.labelDestroyFn[r]=t)}}}}destroyCustomizeLabels(){const e=this.cell.labels;if(this.labelCache&&this.labelSelectors&&this.labelDestroyFn)for(let t=0,r=e.length;t<r;t+=1){const r=this.labelDestroyFn[t],n=this.labelCache[t],i=this.labelSelectors[t];r&&n&&i&&r({edge:this.cell,label:e[t],container:n,selectors:i})}this.labelDestroyFn={}}renderLabels(){const e=this.cell,t=e.getLabels(),r=t.length;let n=this.labelContainer;if(this.labelCache={},this.labelSelectors={},r<=0)return n&&n.parentNode&&n.parentNode.removeChild(n),this;n?this.empty(n):(n=createSvgElement("g"),this.addClass(this.prefixClassName("edge-labels"),n),this.labelContainer=n);for(let i=0,o=t.length;i<o;i+=1){const r=t[i],o=this.normalizeLabelMarkup(this.parseLabelMarkup(r.markup));let a,s;if(o)a=o.node,s=o.selectors;else{const t=e.getDefaultLabel(),r=this.normalizeLabelMarkup(this.parseLabelMarkup(t.markup));a=r.node,s=r.selectors}a.setAttribute("data-index",`${i}`),n.appendChild(a);const l=this.rootSelector;if(s[l])throw new Error("Ambiguous label root selector.");s[l]=a,this.labelCache[i]=a,this.labelSelectors[i]=s}return null==n.parentNode&&this.container.appendChild(n),this.updateLabels(),this.customizeLabels(),this}onLabelsChange(e={}){this.destroyCustomizeLabels(),this.shouldRerenderLabels(e)?this.renderLabels():this.updateLabels(),this.updateLabelPositions()}shouldRerenderLabels(e={}){const t=this.cell.previous("labels");if(null==t)return!0;if("propertyPathArray"in e&&"propertyValue"in e){const r=e.propertyPathArray||[],n=r.length;if(n>1){if(t[r[1]]){if(2===n)return"object"==typeof e.propertyValue&&has(e.propertyValue,"markup");if("markup"!==r[2])return!1}}}return!0}parseLabelMarkup(e){return e?"string"==typeof e?this.parseLabelStringMarkup(e):this.parseJSONMarkup(e):null}parseLabelStringMarkup(e){const t=Vector.createVectors(e),r=document.createDocumentFragment();for(let n=0,i=t.length;n<i;n+=1){const e=t[n].node;r.appendChild(e)}return{fragment:r,selectors:{}}}normalizeLabelMarkup(e){if(null==e)return;const t=e.fragment;if(!(t instanceof DocumentFragment&&t.hasChildNodes()))throw new Error("Invalid label markup.");let r;const n=t.childNodes;return r=n.length>1||"G"!==n[0].nodeName.toUpperCase()?Vector.create("g").append(t):Vector.create(n[0]),r.addClass(this.prefixClassName("edge-label")),{node:r.node,selectors:e.selectors}}updateLabels(){if(this.labelContainer){const e=this.cell,t=e.labels,r=this.can("edgeLabelMovable"),n=e.getDefaultLabel();for(let i=0,o=t.length;i<o;i+=1){const e=this.labelCache[i],o=this.labelSelectors[i];e.setAttribute("cursor",r?"move":"default");const a=t[i],s=merge$2({},n.attrs,a.attrs);this.updateAttrs(e,s,{selectors:o,rootBBox:a.size?Rectangle.fromSize(a.size):void 0})}}}renderTools(){const e=this.cell.getTools();return this.addTools(e),this}update(e={}){this.cleanCache(),this.updateConnection(e);const t=this.cell.getAttrs(),{text:r}=t,n=__rest$6(t,["text"]);return null!=n&&this.updateAttrs(this.container,n,{selectors:this.selectors}),this.updateLabelPositions(),this.updateTools(e),this}removeRedundantLinearVertices(e={}){const t=this.cell,r=t.getVertices(),n=[this.sourceAnchor,...r,this.targetAnchor],i=n.length,o=new Polyline(n);o.simplify({threshold:.01});const a=o.points.map(e=>e.toJSON()),s=a.length;return i===s?0:(t.setVertices(a.slice(1,s-1),e),i-s)}getTerminalView(e){switch(e){case"source":return this.sourceView||null;case"target":return this.targetView||null;default:throw new Error(`Unknown terminal type '${e}'`)}}getTerminalAnchor(e){switch(e){case"source":return Point.create(this.sourceAnchor);case"target":return Point.create(this.targetAnchor);default:throw new Error(`Unknown terminal type '${e}'`)}}getTerminalConnectionPoint(e){switch(e){case"source":return Point.create(this.sourcePoint);case"target":return Point.create(this.targetPoint);default:throw new Error(`Unknown terminal type '${e}'`)}}getTerminalMagnet(e,t={}){switch(e){case"source":{if(t.raw)return this.sourceMagnet;const e=this.sourceView;return e?this.sourceMagnet||e.container:null}case"target":{if(t.raw)return this.targetMagnet;const e=this.targetView;return e?this.targetMagnet||e.container:null}default:throw new Error(`Unknown terminal type '${e}'`)}}updateConnection(e={}){const t=this.cell;if(e.translateBy&&t.isFragmentDescendantOf(e.translateBy)){const t=e.tx||0,r=e.ty||0;this.routePoints=new Polyline(this.routePoints).translate(t,r).points,this.translateConnectionPoints(t,r),this.path.translate(t,r)}else{const e=t.getVertices(),r=this.findAnchors(e);this.sourceAnchor=r.source,this.targetAnchor=r.target,this.routePoints=this.findRoutePoints(e);const n=this.findConnectionPoints(this.routePoints,this.sourceAnchor,this.targetAnchor);this.sourcePoint=n.source,this.targetPoint=n.target;const i=this.findMarkerPoints(this.routePoints,this.sourcePoint,this.targetPoint);this.path=this.findPath(this.routePoints,i.source||this.sourcePoint,i.target||this.targetPoint)}this.cleanCache()}findAnchors(e){const t=this.cell,r=t.source,n=t.target,i=e[0],o=e[e.length-1];return n.priority&&!r.priority?this.findAnchorsOrdered("target",o,"source",i):this.findAnchorsOrdered("source",i,"target",o)}findAnchorsOrdered(e,t,r,n){let i,o;const a=this.cell,s=a[e],l=a[r],c=this.getTerminalView(e),u=this.getTerminalView(r),d=this.getTerminalMagnet(e),p=this.getTerminalMagnet(r);if(c){let r;r=t?Point.create(t):u?p:Point.create(l),i=this.getAnchor(s.anchor,c,d,r,e)}else i=Point.create(s);if(u){const e=Point.create(n||i);o=this.getAnchor(l.anchor,u,p,e,r)}else o=Point.isPointLike(l)?Point.create(l):new Point;return{[e]:i,[r]:o}}getAnchor(e,t,r,n,i){const o=t.isEdgeElement(r),a=this.graph.options.connecting;let s,l="string"==typeof e?{name:e}:e;if(!l){const e=o?("source"===i?a.sourceEdgeAnchor:a.targetEdgeAnchor)||a.edgeAnchor:("source"===i?a.sourceAnchor:a.targetAnchor)||a.anchor;l="string"==typeof e?{name:e}:e}if(!l)throw new Error("Anchor should be specified.");const c=l.name;if(o){const e=EdgeAnchor.registry.get(c);if("function"!=typeof e)return EdgeAnchor.registry.onNotFound(c);s=call$1(e,this,t,r,n,l.args||{},i)}else{const e=NodeAnchor.registry.get(c);if("function"!=typeof e)return NodeAnchor.registry.onNotFound(c);s=call$1(e,this,t,r,n,l.args||{},i)}return s?s.round(this.POINT_ROUNDING):new Point}findRoutePoints(e=[]){const t=this.graph.options.connecting.router||Router.presets.normal,r=this.cell.getRouter()||t;let n;if("function"==typeof r)n=call$1(r,this,e,{},this);else{const t="string"==typeof r?r:r.name,i="string"==typeof r?{}:r.args||{},o=t?Router.registry.get(t):Router.presets.normal;if("function"!=typeof o)return Router.registry.onNotFound(t);n=call$1(o,this,e,i,this)}return null==n?e.map(e=>Point.create(e)):n.map(e=>Point.create(e))}findConnectionPoints(e,t,r){const n=this.cell,i=this.graph.options.connecting,o=n.getSource(),a=n.getTarget(),s=this.sourceView,l=this.targetView,c=e[0],u=e[e.length-1];let d,p;if(s&&!s.isEdgeElement(this.sourceMagnet)){const e=this.sourceMagnet||s.container,n=new Line(c||r,t),a=o.connectionPoint||i.sourceConnectionPoint||i.connectionPoint;d=this.getConnectionPoint(a,s,e,n,"source")}else d=t;if(l&&!l.isEdgeElement(this.targetMagnet)){const e=this.targetMagnet||l.container,n=a.connectionPoint||i.targetConnectionPoint||i.connectionPoint,o=new Line(u||t,r);p=this.getConnectionPoint(n,l,e,o,"target")}else p=r;return{source:d,target:p}}getConnectionPoint(e,t,r,n,i){const o=n.end;if(null==e)return o;const a="string"==typeof e?e:e.name,s="string"==typeof e?{}:e.args,l=ConnectionPoint.registry.get(a);if("function"!=typeof l)return ConnectionPoint.registry.onNotFound(a);const c=call$1(l,this,n,t,r,s||{},i);return c?c.round(this.POINT_ROUNDING):o}findMarkerPoints(e,t,r){const n=e=>{const t=this.cell.getAttrs(),r=Object.keys(t);for(let n=0,i=r.length;n<i;n+=1){const i=t[r[n]];if(i[`${e}Marker`]||i[`${e}-marker`]){const e=i.strokeWidth||i["stroke-width"];if(e)return parseFloat(e);break}}return null},i=e[0],o=e[e.length-1];let a,s;const l=n("source");l&&(a=t.clone().move(i||r,-l));const c=n("target");return c&&(s=r.clone().move(o||t,-c)),this.sourceMarkerPoint=a||t.clone(),this.targetMarkerPoint=s||r.clone(),{source:a,target:s}}findPath(e,t,r){const n=this.cell.getConnector()||this.graph.options.connecting.connector;let i,o,a;if("string"==typeof n?i=n:(i=n.name,o=n.args),i){const e=Connector.registry.get(i);if("function"!=typeof e)return Connector.registry.onNotFound(i);a=e}else a=Connector.presets.normal;const s=call$1(a,this,t,r,e,Object.assign(Object.assign({},o),{raw:!0}),this);return"string"==typeof s?Path.parse(s):s}translateConnectionPoints(e,t){this.sourcePoint.translate(e,t),this.targetPoint.translate(e,t),this.sourceAnchor.translate(e,t),this.targetAnchor.translate(e,t),this.sourceMarkerPoint.translate(e,t),this.targetMarkerPoint.translate(e,t)}updateLabelPositions(){if(null==this.labelContainer)return this;if(!this.path)return this;const e=this.cell,t=e.getLabels();if(0===t.length)return this;const r=e.getDefaultLabel(),n=this.normalizeLabelPosition(r.position);for(let i=0,o=t.length;i<o;i+=1){const e=t[i],r=this.labelCache[i];if(!r)continue;const o=this.normalizeLabelPosition(e.position),a=merge$2({},n,o),s=this.getLabelTransformationMatrix(a);r.setAttribute("transform",matrixToTransformString(s))}return this}updateTerminalProperties(e){const t=this.cell,r=this.graph,n=t[e],i=n&&n.cell,o=`${e}View`;if(!i)return this[o]=null,this.updateTerminalMagnet(e),!0;const a=r.getCellById(i);if(!a)throw new Error(`Edge's ${e} node with id "${i}" not exists`);const s=a.findView(r);return!!s&&(this[o]=s,this.updateTerminalMagnet(e),!0)}updateTerminalMagnet(e){const t=`${e}Magnet`,r=this.getTerminalView(e);if(r){let n=r.getMagnetFromEdgeTerminal(this.cell[e]);n===r.container&&(n=null),this[t]=n}else this[t]=null}getLabelPositionAngle(e){const t=this.cell.getLabelAt(e);return t&&t.position&&"object"==typeof t.position&&t.position.angle||0}getLabelPositionArgs(e){const t=this.cell.getLabelAt(e);if(t&&t.position&&"object"==typeof t.position)return t.position.options}getDefaultLabelPositionArgs(){const e=this.cell.getDefaultLabel();if(e&&e.position&&"object"==typeof e.position)return e.position.options}mergeLabelPositionArgs(e,t){return null===e?null:void 0===e?null===t?null:t:merge$2({},t,e)}getConnection(){return null!=this.path?this.path.clone():null}getConnectionPathData(){if(null==this.path)return"";const e=this.cache.pathCache;return has(e,"data")||(e.data=this.path.serialize()),e.data||""}getConnectionSubdivisions(){if(null==this.path)return null;const e=this.cache.pathCache;return has(e,"segmentSubdivisions")||(e.segmentSubdivisions=this.path.getSegmentSubdivisions()),e.segmentSubdivisions}getConnectionLength(){if(null==this.path)return 0;const e=this.cache.pathCache;return has(e,"length")||(e.length=this.path.length({segmentSubdivisions:this.getConnectionSubdivisions()})),e.length}getPointAtLength(e){return null==this.path?null:this.path.pointAtLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getPointAtRatio(e){return null==this.path?null:(isPercentage(e)&&(e=parseFloat(e)/100),this.path.pointAt(e,{segmentSubdivisions:this.getConnectionSubdivisions()}))}getTangentAtLength(e){return null==this.path?null:this.path.tangentAtLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getTangentAtRatio(e){return null==this.path?null:this.path.tangentAt(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPoint(e){return null==this.path?null:this.path.closestPoint(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointLength(e){return null==this.path?null:this.path.closestPointLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointRatio(e){return null==this.path?null:this.path.closestPointNormalizedLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getLabelPosition(e,t,r,n){const i={distance:0};let o,a=0;"number"==typeof r?(a=r,o=n):o=r,null!=o&&(i.options=o);const s=o&&o.absoluteOffset,l=!(o&&o.absoluteDistance),c=o&&o.absoluteDistance&&o.reverseDistance,u=this.path,d={segmentSubdivisions:this.getConnectionSubdivisions()},p=new Point(e,t),h=u.closestPointT(p,d),f=this.getConnectionLength()||0;let g,m,v=u.lengthAtT(h,d);if(l&&(v=f>0?v/f:0),c&&(v=-1*(f-v)||1),i.distance=v,s||(g=u.tangentAtT(h)),g)m=g.pointOffset(p);else{const e=u.pointAtT(h),t=p.diff(e);m={x:t.x,y:t.y}}return i.offset=m,i.angle=a,i}normalizeLabelPosition(e){return"number"==typeof e?{distance:e}:e}getLabelTransformationMatrix(e){const t=this.normalizeLabelPosition(e),r=t.options||{},n=t.angle||0,i=t.distance,o=i>0&&i<=1;let a=0;const s={x:0,y:0},l=t.offset;l&&("number"==typeof l?a=l:(null!=l.x&&(s.x=l.x),null!=l.y&&(s.y=l.y)));const c=0!==s.x||0!==s.y||0===a,u=r.keepGradient,d=r.ensureLegibility,p=this.path,h={segmentSubdivisions:this.getConnectionSubdivisions()},f=o?i*this.getConnectionLength():i,g=p.tangentAtLength(f,h);let m,v=n;if(g){if(c)m=g.start,m.translate(s);else{const e=g.clone();e.rotate(-90,g.start),e.setLength(a),m=e.end}u&&(v=g.angle()+n,d&&(v=Angle.normalize((v+90)%180-90)))}else m=p.start,c&&m.translate(s);return createSVGMatrix().translate(m.x,m.y).rotate(v)}getVertexIndex(e,t){const r=this.cell.getVertices(),n=this.getClosestPointLength(new Point(e,t));let i=0;if(null!=n)for(const o=r.length;i<o;i+=1){const e=r[i],t=this.getClosestPointLength(e);if(null!=t&&n<t)break}return i}getEventArgs(e,t,r){const n=this,i=n.cell;return null==t||null==r?{e:e,view:n,edge:i,cell:i}:{e:e,x:t,y:r,view:n,edge:i,cell:i}}notifyUnhandledMouseDown(e,t,r){this.notify("edge:unhandled:mousedown",{e:e,x:t,y:r,view:this,cell:this.cell,edge:this.cell})}notifyMouseDown(e,t,r){super.onMouseDown(e,t,r),this.notify("edge:mousedown",this.getEventArgs(e,t,r))}notifyMouseMove(e,t,r){super.onMouseMove(e,t,r),this.notify("edge:mousemove",this.getEventArgs(e,t,r))}notifyMouseUp(e,t,r){super.onMouseUp(e,t,r),this.notify("edge:mouseup",this.getEventArgs(e,t,r))}onClick(e,t,r){super.onClick(e,t,r),this.notify("edge:click",this.getEventArgs(e,t,r))}onDblClick(e,t,r){super.onDblClick(e,t,r),this.notify("edge:dblclick",this.getEventArgs(e,t,r))}onContextMenu(e,t,r){super.onContextMenu(e,t,r),this.notify("edge:contextmenu",this.getEventArgs(e,t,r))}onMouseDown(e,t,r){this.notifyMouseDown(e,t,r),this.startEdgeDragging(e,t,r)}onMouseMove(e,t,r){const n=this.getEventData(e);switch(n.action){case"drag-label":this.dragLabel(e,t,r);break;case"drag-arrowhead":this.dragArrowhead(e,t,r);break;case"drag-edge":this.dragEdge(e,t,r)}return this.notifyMouseMove(e,t,r),n}onMouseUp(e,t,r){const n=this.getEventData(e);switch(n.action){case"drag-label":this.stopLabelDragging(e,t,r);break;case"drag-arrowhead":this.stopArrowheadDragging(e,t,r);break;case"drag-edge":this.stopEdgeDragging(e,t,r)}return this.notifyMouseUp(e,t,r),this.checkMouseleave(e),n}onMouseOver(e){super.onMouseOver(e),this.notify("edge:mouseover",this.getEventArgs(e))}onMouseOut(e){super.onMouseOut(e),this.notify("edge:mouseout",this.getEventArgs(e))}onMouseEnter(e){super.onMouseEnter(e),this.notify("edge:mouseenter",this.getEventArgs(e))}onMouseLeave(e){super.onMouseLeave(e),this.notify("edge:mouseleave",this.getEventArgs(e))}onMouseWheel(e,t,r,n){super.onMouseWheel(e,t,r,n),this.notify("edge:mousewheel",Object.assign({delta:n},this.getEventArgs(e,t,r)))}onCustomEvent(e,t,r,n){if(findParentByClass(e.target,"edge-tool",this.container)){if(e.stopPropagation(),this.can("useEdgeTools")){if("edge:remove"===t)return void this.cell.remove({ui:!0});this.notify("edge:customevent",Object.assign({name:t},this.getEventArgs(e,r,n)))}this.notifyMouseDown(e,r,n)}else this.notify("edge:customevent",Object.assign({name:t},this.getEventArgs(e,r,n))),super.onCustomEvent(e,t,r,n)}onLabelMouseDown(e,t,r){this.notifyMouseDown(e,t,r),this.startLabelDragging(e,t,r);this.getEventData(e).stopPropagation&&e.stopPropagation()}startEdgeDragging(e,t,r){this.can("edgeMovable")?this.setEventData(e,{x:t,y:r,moving:!1,action:"drag-edge"}):this.notifyUnhandledMouseDown(e,t,r)}dragEdge(e,t,r){const n=this.getEventData(e);n.moving||(n.moving=!0,this.addClass("edge-moving"),this.notify("edge:move",{e:e,x:t,y:r,view:this,cell:this.cell,edge:this.cell})),this.cell.translate(t-n.x,r-n.y,{ui:!0}),this.setEventData(e,{x:t,y:r}),this.notify("edge:moving",{e:e,x:t,y:r,view:this,cell:this.cell,edge:this.cell})}stopEdgeDragging(e,t,r){const n=this.getEventData(e);n.moving&&(this.removeClass("edge-moving"),this.notify("edge:moved",{e:e,x:t,y:r,view:this,cell:this.cell,edge:this.cell})),n.moving=!1}prepareArrowheadDragging(e,t){const r=this.getTerminalMagnet(e),n={action:"drag-arrowhead",x:t.x,y:t.y,isNewEdge:!0===t.isNewEdge,terminalType:e,initialMagnet:r,initialTerminal:clone(this.cell[e]),fallbackAction:t.fallbackAction||"revert",getValidateConnectionArgs:this.createValidateConnectionArgs(e),options:t.options};return this.beforeArrowheadDragging(n),n}createValidateConnectionArgs(e){const t=[];let r;t[4]=e,t[5]=this;let n=0,i=0;"source"===e?(n=2,r="target"):(i=2,r="source");const o=this.cell[r],a=o.cell;if(a){let e;const r=t[n]=this.graph.findViewByCell(a);r&&(e=r.getMagnetFromEdgeTerminal(o),e===r.container&&(e=void 0)),t[n+1]=e}return(e,r)=>(t[i]=e,t[i+1]=e.container===r?void 0:r,t)}beforeArrowheadDragging(e){e.zIndex=this.cell.zIndex,this.cell.toFront();const t=this.container.style;e.pointerEvents=t.pointerEvents,t.pointerEvents="none",this.graph.options.connecting.highlight&&this.highlightAvailableMagnets(e)}afterArrowheadDragging(e){null!=e.zIndex&&(this.cell.setZIndex(e.zIndex,{ui:!0}),e.zIndex=null);this.container.style.pointerEvents=e.pointerEvents||"",this.graph.options.connecting.highlight&&this.unhighlightAvailableMagnets(e)}validateConnection(e,t,r,n,i,o,a){const s=this.graph.options.connecting,l=s.allowLoop,c=s.allowNode,u=s.allowEdge,d=s.allowPort,p=s.allowMulti,h=s.validateConnection,f=o?o.cell:null,g="target"===i?r:e,m="target"===i?n:t;let v=!0;const y=s=>{const l="source"===i?a?a.port:null:f?f.getSourcePortId():null,c="target"===i?a?a.port:null:f?f.getTargetPortId():null;return call$1(s,this.graph,{edge:f,edgeView:o,sourceView:e,targetView:r,sourcePort:l,targetPort:c,sourceMagnet:t,targetMagnet:n,sourceCell:e?e.cell:null,targetCell:r?r.cell:null,type:i})};if(null!=l&&("boolean"==typeof l?l||e!==r||(v=!1):v=y(l)),v&&null!=d&&("boolean"==typeof d?!d&&m&&(v=!1):v=y(d)),v&&null!=u&&("boolean"==typeof u?!u&&EdgeView.isEdgeView(g)&&(v=!1):v=y(u)),v&&null!=c&&null==m&&("boolean"==typeof c?!c&&NodeView.isNodeView(g)&&(v=!1):v=y(c)),v&&null!=p&&o){const e=o.cell,t="source"===i?a:e.getSource(),r="target"===i?a:e.getTarget(),n=a?this.graph.getCellById(a.cell):null;if(t&&r&&t.cell&&r.cell&&n)if("function"==typeof p)v=y(p);else{const e=this.graph.model.getConnectedEdges(n,{outgoing:"source"===i,incoming:"target"===i});if(e.length)if("withPort"===p){e.some(e=>{const n=e.getSource(),i=e.getTarget();return n&&i&&n.cell===t.cell&&i.cell===r.cell&&null!=n.port&&n.port===t.port&&null!=i.port&&i.port===r.port})&&(v=!1)}else if(!p){e.some(e=>{const n=e.getSource(),i=e.getTarget();return n&&i&&n.cell===t.cell&&i.cell===r.cell})&&(v=!1)}}}return v&&null!=h&&(v=y(h)),v}allowConnectToBlank(e){const t=this.graph,r=t.options.connecting.allowBlank;if("function"!=typeof r)return!!r;const n=t.findViewByCell(e),i=e.getSourceCell(),o=e.getTargetCell(),a=t.findViewByCell(i),s=t.findViewByCell(o);return call$1(r,t,{edge:e,edgeView:n,sourceCell:i,targetCell:o,sourceView:a,targetView:s,sourcePort:e.getSourcePortId(),targetPort:e.getTargetPortId(),sourceMagnet:n.sourceMagnet,targetMagnet:n.targetMagnet})}validateEdge(e,t,r){const n=this.graph;if(!this.allowConnectToBlank(e)){const t=e.getSourceCellId(),r=e.getTargetCellId();if(!t||!r)return!1}const i=n.options.connecting.validateEdge;return!i||call$1(i,n,{edge:e,type:t,previous:r})}arrowheadDragging(e,t,r,n){n.x=t,n.y=r,n.currentTarget!==e&&(n.currentMagnet&&n.currentView&&n.currentView.unhighlight(n.currentMagnet,{type:"magnetAdsorbed"}),n.currentView=this.graph.findViewByElem(e),n.currentView?(n.currentMagnet=n.currentView.findMagnet(e),n.currentMagnet&&this.validateConnection(...n.getValidateConnectionArgs(n.currentView,n.currentMagnet),n.currentView.getEdgeTerminal(n.currentMagnet,t,r,this.cell,n.terminalType))?n.currentView.highlight(n.currentMagnet,{type:"magnetAdsorbed"}):n.currentMagnet=null):n.currentMagnet=null),n.currentTarget=e,this.cell.prop(n.terminalType,{x:t,y:r},Object.assign(Object.assign({},n.options),{ui:!0}))}arrowheadDragged(e,t,r){const n=e.currentView,i=e.currentMagnet;if(!i||!n)return;n.unhighlight(i,{type:"magnetAdsorbed"});const o=e.terminalType,a=n.getEdgeTerminal(i,t,r,this.cell,o);this.cell.setTerminal(o,a,{ui:!0})}snapArrowhead(e,t,r){const n=this.graph,{snap:i,allowEdge:o}=n.options.connecting,a="object"==typeof i&&i.radius||50,s="object"==typeof i&&i.anchor||"center",l=n.renderer.findViewsInArea({x:e-a,y:t-a,width:2*a,height:2*a},{nodeOnly:!0});if(o){const r=n.renderer.findEdgeViewsFromPoint({x:e,y:t},a).filter(e=>e!==this);l.push(...r)}const c=r.closestView||null,u=r.closestMagnet||null;let d;r.closestView=null,r.closestMagnet=null;let p=Number.MAX_SAFE_INTEGER;const h=new Point(e,t);let f;l.forEach(n=>{if("false"!==n.container.getAttribute("magnet")){if(n.isNodeView())d="center"===s?n.cell.getBBox().getCenter().distance(h):n.cell.getBBox().getNearestPointToPoint(h).distance(h);else if(n.isEdgeView()){const e=n.getClosestPoint(h);d=e?e.distance(h):Number.MAX_SAFE_INTEGER}d<a&&d<p&&(u===n.container||this.validateConnection(...r.getValidateConnectionArgs(n,null),n.getEdgeTerminal(n.container,e,t,this.cell,r.terminalType)))&&(p=d,r.closestView=n,r.closestMagnet=n.container)}n.container.querySelectorAll("[magnet]").forEach(i=>{if("false"!==i.getAttribute("magnet")){const o=n.getBBoxOfElement(i);d=h.distance(o.getCenter()),d<a&&d<p&&(u===i||this.validateConnection(...r.getValidateConnectionArgs(n,i),n.getEdgeTerminal(i,e,t,this.cell,r.terminalType)))&&(p=d,r.closestView=n,r.closestMagnet=i)}})});const g=r.terminalType,m=r.closestView,v=r.closestMagnet,y=u!==v;if(c&&y&&c.unhighlight(u,{type:"magnetAdsorbed"}),m){if(!y)return;m.highlight(v,{type:"magnetAdsorbed"}),f=m.getEdgeTerminal(v,e,t,this.cell,g)}else f={x:e,y:t};this.cell.setTerminal(g,f,{},Object.assign(Object.assign({},r.options),{ui:!0}))}snapArrowheadEnd(e){const t=e.closestView,r=e.closestMagnet;t&&r&&(t.unhighlight(r,{type:"magnetAdsorbed"}),e.currentMagnet=t.findMagnet(r)),e.closestView=null,e.closestMagnet=null}finishEmbedding(e){this.graph.options.embedding.enabled&&this.cell.updateParent()&&(e.zIndex=null)}fallbackConnection(e){if("remove"===e.fallbackAction)this.cell.remove({ui:!0});else this.cell.prop(e.terminalType,e.initialTerminal,{ui:!0})}notifyConnectionEvent(e,t){const r=e.terminalType,n=e.initialTerminal,i=this.cell[r];if(i&&!Edge$1.equalTerminals(n,i)){const o=this.graph,a=n,s=a.cell?o.getCellById(a.cell):null,l=a.port,c=s?o.findViewByCell(s):null,u=s||e.isNewEdge?null:Point.create(n).toJSON(),d=i,p=d.cell?o.getCellById(d.cell):null,h=d.port,f=p?o.findViewByCell(p):null,g=p?null:Point.create(i).toJSON();this.notify("edge:connected",{e:t,previousCell:s,previousPort:l,previousView:c,previousPoint:u,currentCell:p,currentView:f,currentPort:h,currentPoint:g,previousMagnet:e.initialMagnet,currentMagnet:e.currentMagnet,edge:this.cell,view:this,type:r,isNew:e.isNewEdge})}}highlightAvailableMagnets(e){const t=this.graph,r=t.model.getCells();e.marked={};for(let n=0,i=r.length;n<i;n+=1){const i=t.findViewByCell(r[n]);if(!i||i.cell.id===this.cell.id)continue;const o=Array.prototype.slice.call(i.container.querySelectorAll("[magnet]"));"false"!==i.container.getAttribute("magnet")&&o.push(i.container);const a=o.filter(t=>this.validateConnection(...e.getValidateConnectionArgs(i,t),i.getEdgeTerminal(t,e.x,e.y,this.cell,e.terminalType)));if(a.length>0){for(let e=0,t=a.length;e<t;e+=1)i.highlight(a[e],{type:"magnetAvailable"});i.highlight(null,{type:"nodeAvailable"}),e.marked[i.cell.id]=a}}}unhighlightAvailableMagnets(e){const t=e.marked||{};Object.keys(t).forEach(e=>{const r=this.graph.findViewByCell(e);if(r){t[e].forEach(e=>{r.unhighlight(e,{type:"magnetAvailable"})}),r.unhighlight(null,{type:"nodeAvailable"})}}),e.marked=null}startArrowheadDragging(e,t,r){if(!this.can("arrowheadMovable"))return void this.notifyUnhandledMouseDown(e,t,r);const n=e.target.getAttribute("data-terminal"),i=this.prepareArrowheadDragging(n,{x:t,y:r});this.setEventData(e,i)}dragArrowhead(e,t,r){const n=this.getEventData(e);this.graph.options.connecting.snap?this.snapArrowhead(t,r,n):this.arrowheadDragging(this.getEventTarget(e),t,r,n)}stopArrowheadDragging(e,t,r){const n=this.graph,i=this.getEventData(e);n.options.connecting.snap?this.snapArrowheadEnd(i):this.arrowheadDragged(i,t,r);this.validateEdge(this.cell,i.terminalType,i.initialTerminal)?(this.finishEmbedding(i),this.notifyConnectionEvent(i,e)):this.fallbackConnection(i),this.afterArrowheadDragging(i)}startLabelDragging(e,t,r){if(this.can("edgeLabelMovable")){const t=e.currentTarget,r=parseInt(t.getAttribute("data-index"),10),n=this.getLabelPositionAngle(r),i=this.getLabelPositionArgs(r),o=this.getDefaultLabelPositionArgs(),a=this.mergeLabelPositionArgs(i,o);this.setEventData(e,{index:r,positionAngle:n,positionArgs:a,stopPropagation:!0,action:"drag-label"})}else this.setEventData(e,{stopPropagation:!0});this.graph.view.delegateDragEvents(e,this)}dragLabel(e,t,r){const n=this.getEventData(e),i=this.cell.getLabelAt(n.index),o=merge$2({},i,{position:this.getLabelPosition(t,r,n.positionAngle,n.positionArgs)});this.cell.setLabelAt(n.index,o)}stopLabelDragging(e,t,r){}}EdgeView2=EdgeView||(EdgeView={}),EdgeView2.toStringTag=`X6.${EdgeView2.name}`,EdgeView2.isEdgeView=function(e){if(null==e)return!1;if(e instanceof EdgeView2)return!0;const t=e[Symbol.toStringTag],r=e;return(null==t||t===EdgeView2.toStringTag)&&"function"==typeof r.isNodeView&&"function"==typeof r.isEdgeView&&"function"==typeof r.confirmUpdate&&"function"==typeof r.update&&"function"==typeof r.getConnection},EdgeView.config({isSvgElement:!0,priority:1,bootstrap:["render","source","target"],actions:{view:["render"],markup:["render"],attrs:["update"],source:["source","update"],target:["target","update"],router:["update"],connector:["update"],labels:["labels"],defaultLabel:["labels"],tools:["tools"],vertices:["vertices","update"]}}),EdgeView.registry.register("edge",EdgeView,!0);var __decorate$o=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class GraphView extends View{get disposeContainer(){return!1}get options(){return this.graph.options}constructor(e){super(),this.graph=e;const{selectors:t,fragment:r}=Markup.parseJSONMarkup(GraphView.markup);this.background=t.background,this.grid=t.grid,this.svg=t.svg,this.defs=t.defs,this.viewport=t.viewport,this.primer=t.primer,this.stage=t.stage,this.decorator=t.decorator,this.overlay=t.overlay,this.container=this.options.container,this.restore=GraphView.snapshoot(this.container),addClass(this.container,this.prefixClassName("graph")),append(this.container,r),this.delegateEvents()}delegateEvents(){const e=this.constructor;return super.delegateEvents(e.events),this}guard(e,t){return"mousedown"===e.type&&2===e.button||(!(!this.options.guard||!this.options.guard(e,t))||(e.data&&void 0!==e.data.guarded?e.data.guarded:!(t&&t.cell&&Cell.isCell(t.cell))&&(this.svg!==e.target&&this.container!==e.target&&!this.svg.contains(e.target))))}findView(e){return this.graph.findViewByElem(e)}onDblClick(e){this.options.preventDefaultDblClick&&e.preventDefault();const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.guard(t,r))return;const n=this.graph.snapToGrid(t.clientX,t.clientY);r?r.onDblClick(t,n.x,n.y):this.graph.trigger("blank:dblclick",{e:t,x:n.x,y:n.y})}onClick(e){if(this.getMouseMovedCount(e)<=this.options.clickThreshold){const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.guard(t,r))return;const n=this.graph.snapToGrid(t.clientX,t.clientY);r?r.onClick(t,n.x,n.y):this.graph.trigger("blank:click",{e:t,x:n.x,y:n.y})}}isPreventDefaultContextMenu(e){let t=this.options.preventDefaultContextMenu;return"function"==typeof t&&(t=call$1(t,this.graph,{view:e})),t}onContextMenu(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.isPreventDefaultContextMenu(r)&&e.preventDefault(),this.guard(t,r))return;const n=this.graph.snapToGrid(t.clientX,t.clientY);r?r.onContextMenu(t,n.x,n.y):this.graph.trigger("blank:contextmenu",{e:t,x:n.x,y:n.y})}delegateDragEvents(e,t){null==e.data&&(e.data={}),this.setEventData(e,{currentView:t||null,mouseMovedCount:0,startPosition:{x:e.clientX,y:e.clientY}});const r=this.constructor;this.delegateDocumentEvents(r.documentEvents,e.data),this.undelegateEvents()}getMouseMovedCount(e){return this.getEventData(e).mouseMovedCount||0}onMouseDown(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.guard(t,r))return;this.options.preventDefaultMouseDown&&e.preventDefault();const n=this.graph.snapToGrid(t.clientX,t.clientY);r?r.onMouseDown(t,n.x,n.y):(this.options.preventDefaultBlankAction&&["touchstart"].includes(t.type)&&e.preventDefault(),this.graph.trigger("blank:mousedown",{e:t,x:n.x,y:n.y})),this.delegateDragEvents(t,r)}onMouseMove(e){const t=this.getEventData(e),r=t.startPosition;if(r&&r.x===e.clientX&&r.y===e.clientY)return;null==t.mouseMovedCount&&(t.mouseMovedCount=0),t.mouseMovedCount+=1;if(t.mouseMovedCount<=this.options.moveThreshold)return;const n=this.normalizeEvent(e),i=this.graph.snapToGrid(n.clientX,n.clientY),o=t.currentView;o?o.onMouseMove(n,i.x,i.y):this.graph.trigger("blank:mousemove",{e:n,x:i.x,y:i.y}),this.setEventData(n,t)}onMouseUp(e){this.undelegateDocumentEvents();const t=this.normalizeEvent(e),r=this.graph.snapToGrid(t.clientX,t.clientY),n=this.getEventData(e).currentView;if(n?n.onMouseUp(t,r.x,r.y):this.graph.trigger("blank:mouseup",{e:t,x:r.x,y:r.y}),!e.isPropagationStopped()){const t=new EventObject(e,{type:"click",data:e.data});this.onClick(t)}e.stopImmediatePropagation(),this.delegateEvents()}onMouseOver(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(!this.guard(t,r))if(r)r.onMouseOver(t);else{if(this.container===t.target)return;this.graph.trigger("blank:mouseover",{e:t})}}onMouseOut(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(!this.guard(t,r))if(r)r.onMouseOut(t);else{if(this.container===t.target)return;this.graph.trigger("blank:mouseout",{e:t})}}onMouseEnter(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.guard(t,r))return;const n=this.graph.findViewByElem(t.relatedTarget);if(r){if(n===r)return;r.onMouseEnter(t)}else{if(n)return;this.graph.trigger("graph:mouseenter",{e:t})}}onMouseLeave(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.guard(t,r))return;const n=this.graph.findViewByElem(t.relatedTarget);if(r){if(n===r)return;r.onMouseLeave(t)}else{if(n)return;this.graph.trigger("graph:mouseleave",{e:t})}}onMouseWheel(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.guard(t,r))return;const n=t.originalEvent,i=this.graph.snapToGrid(n.clientX,n.clientY),o=Math.max(-1,Math.min(1,n.wheelDelta||-n.detail));r?r.onMouseWheel(t,i.x,i.y,o):this.graph.trigger("blank:mousewheel",{e:t,delta:o,x:i.x,y:i.y})}onCustomEvent(e){const t=e.currentTarget,r=t.getAttribute("event")||t.getAttribute("data-event");if(r){const n=this.findView(t);if(n){const t=this.normalizeEvent(e);if(this.guard(t,n))return;const i=this.graph.snapToGrid(t.clientX,t.clientY);n.onCustomEvent(t,r,i.x,i.y)}}}handleMagnetEvent(e,t){const r=e.currentTarget,n=r.getAttribute("magnet");if(n&&"false"!==n.toLowerCase()){const n=this.findView(r);if(n){const i=this.normalizeEvent(e);if(this.guard(i,n))return;const o=this.graph.snapToGrid(i.clientX,i.clientY);call$1(t,this.graph,n,i,r,o.x,o.y)}}}onMagnetMouseDown(e){this.handleMagnetEvent(e,(e,t,r,n,i)=>{e.onMagnetMouseDown(t,r,n,i)})}onMagnetDblClick(e){this.handleMagnetEvent(e,(e,t,r,n,i)=>{e.onMagnetDblClick(t,r,n,i)})}onMagnetContextMenu(e){const t=this.findView(e.target);this.isPreventDefaultContextMenu(t)&&e.preventDefault(),this.handleMagnetEvent(e,(e,t,r,n,i)=>{e.onMagnetContextMenu(t,r,n,i)})}onLabelMouseDown(e){const t=e.currentTarget,r=this.findView(t);if(r){const t=this.normalizeEvent(e);if(this.guard(t,r))return;const n=this.graph.snapToGrid(t.clientX,t.clientY);r.onLabelMouseDown(t,n.x,n.y)}}onImageDragStart(){return!1}dispose(){this.undelegateEvents(),this.undelegateDocumentEvents(),this.restore(),this.restore=()=>{}}}__decorate$o([View.dispose()],GraphView.prototype,"dispose",null),function(e){const t=`${Config.prefixCls}-graph`;e.markup=[{ns:ns.xhtml,tagName:"div",selector:"background",className:`${t}-background`},{ns:ns.xhtml,tagName:"div",selector:"grid",className:`${t}-grid`},{ns:ns.svg,tagName:"svg",selector:"svg",className:`${t}-svg`,attrs:{width:"100%",height:"100%","xmlns:xlink":ns.xlink},children:[{tagName:"defs",selector:"defs"},{tagName:"g",selector:"viewport",className:`${t}-svg-viewport`,children:[{tagName:"g",selector:"primer",className:`${t}-svg-primer`},{tagName:"g",selector:"stage",className:`${t}-svg-stage`},{tagName:"g",selector:"decorator",className:`${t}-svg-decorator`},{tagName:"g",selector:"overlay",className:`${t}-svg-overlay`}]}]}],e.snapshoot=function(e){const t=e.cloneNode();return e.childNodes.forEach(e=>t.appendChild(e)),()=>{for(empty$2(e);e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);for(let r=0,n=t.attributes.length;r<n;r+=1){const n=t.attributes[r];e.setAttribute(n.name,n.value)}t.childNodes.forEach(t=>e.appendChild(t))}}}(GraphView||(GraphView={})),function(e){const t=Config.prefixCls;e.events={dblclick:"onDblClick",contextmenu:"onContextMenu",touchstart:"onMouseDown",mousedown:"onMouseDown",mouseover:"onMouseOver",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",DOMMouseScroll:"onMouseWheel",[`mouseenter .${t}-cell`]:"onMouseEnter",[`mouseleave .${t}-cell`]:"onMouseLeave",[`mouseenter .${t}-cell-tools`]:"onMouseEnter",[`mouseleave .${t}-cell-tools`]:"onMouseLeave",[`mousedown .${t}-cell [event]`]:"onCustomEvent",[`touchstart .${t}-cell [event]`]:"onCustomEvent",[`mousedown .${t}-cell [data-event]`]:"onCustomEvent",[`touchstart .${t}-cell [data-event]`]:"onCustomEvent",[`dblclick .${t}-cell [magnet]`]:"onMagnetDblClick",[`contextmenu .${t}-cell [magnet]`]:"onMagnetContextMenu",[`mousedown .${t}-cell [magnet]`]:"onMagnetMouseDown",[`touchstart .${t}-cell [magnet]`]:"onMagnetMouseDown",[`dblclick .${t}-cell [data-magnet]`]:"onMagnetDblClick",[`contextmenu .${t}-cell [data-magnet]`]:"onMagnetContextMenu",[`mousedown .${t}-cell [data-magnet]`]:"onMagnetMouseDown",[`touchstart .${t}-cell [data-magnet]`]:"onMagnetMouseDown",[`dragstart .${t}-cell image`]:"onImageDragStart",[`mousedown .${t}-edge .${t}-edge-label`]:"onLabelMouseDown",[`touchstart .${t}-edge .${t}-edge-label`]:"onLabelMouseDown"},e.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}}(GraphView||(GraphView={}));const content$5=".x6-graph {\n position: relative;\n overflow: hidden;\n outline: none;\n touch-action: none;\n}\n.x6-graph-background,\n.x6-graph-grid,\n.x6-graph-svg {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n.x6-graph-background-stage,\n.x6-graph-grid-stage,\n.x6-graph-svg-stage {\n user-select: none;\n}\n.x6-graph.x6-graph-pannable {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n.x6-graph.x6-graph-panning {\n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n user-select: none;\n}\n.x6-node {\n cursor: move;\n /* stylelint-disable-next-line */\n}\n.x6-node.x6-node-immovable {\n cursor: default;\n}\n.x6-node * {\n -webkit-user-drag: none;\n}\n.x6-node .scalable * {\n vector-effect: non-scaling-stroke;\n}\n.x6-node [magnet='true'] {\n cursor: crosshair;\n transition: opacity 0.3s;\n}\n.x6-node [magnet='true']:hover {\n opacity: 0.7;\n}\n.x6-node foreignObject {\n display: block;\n overflow: visible;\n background-color: transparent;\n}\n.x6-node foreignObject > body {\n position: static;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n overflow: visible;\n background-color: transparent;\n}\n.x6-edge .source-marker,\n.x6-edge .target-marker {\n vector-effect: non-scaling-stroke;\n}\n.x6-edge .connection {\n stroke-linejoin: round;\n fill: none;\n}\n.x6-edge .connection-wrap {\n cursor: move;\n opacity: 0;\n fill: none;\n stroke: #000;\n stroke-width: 15;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n.x6-edge .connection-wrap:hover {\n opacity: 0.4;\n stroke-opacity: 0.4;\n}\n.x6-edge .vertices {\n cursor: move;\n opacity: 0;\n}\n.x6-edge .vertices .vertex {\n fill: #1abc9c;\n}\n.x6-edge .vertices .vertex :hover {\n fill: #34495e;\n stroke: none;\n}\n.x6-edge .vertices .vertex-remove {\n cursor: pointer;\n fill: #fff;\n}\n.x6-edge .vertices .vertex-remove-area {\n cursor: pointer;\n opacity: 0.1;\n}\n.x6-edge .vertices .vertex-group:hover .vertex-remove-area {\n opacity: 1;\n}\n.x6-edge .arrowheads {\n cursor: move;\n opacity: 0;\n}\n.x6-edge .arrowheads .arrowhead {\n fill: #1abc9c;\n}\n.x6-edge .arrowheads .arrowhead :hover {\n fill: #f39c12;\n stroke: none;\n}\n.x6-edge .tools {\n cursor: pointer;\n opacity: 0;\n}\n.x6-edge .tools .tool-options {\n display: none;\n}\n.x6-edge .tools .tool-remove circle {\n fill: #f00;\n}\n.x6-edge .tools .tool-remove path {\n fill: #fff;\n}\n.x6-edge:hover .vertices,\n.x6-edge:hover .arrowheads,\n.x6-edge:hover .tools {\n opacity: 1;\n}\n.x6-highlight-opacity {\n opacity: 0.3;\n}\n.x6-cell-tool-editor {\n position: relative;\n display: inline-block;\n min-height: 1em;\n margin: 0;\n padding: 0;\n line-height: 1;\n white-space: normal;\n text-align: center;\n vertical-align: top;\n overflow-wrap: normal;\n outline: none;\n transform-origin: 0 0;\n -webkit-user-drag: none;\n}\n.x6-edge-tool-editor {\n border: 1px solid #275fc5;\n border-radius: 2px;\n}\n";class Base extends Disposable{get options(){return this.graph.options}get model(){return this.graph.model}get view(){return this.graph.view}constructor(e){super(),this.graph=e,this.init()}init(){}}var __decorate$n=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class CSSManager extends Base{init(){ensure("core",content$5)}dispose(){clean("core")}}__decorate$n([CSSManager.dispose()],CSSManager.prototype,"dispose",null);var __rest$5=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},Options,Options2;Options2=Options||(Options={}),Options2.get=function(e){const{grid:t,panning:r,mousewheel:n,embedding:i}=e,o=__rest$5(e,["grid","panning","mousewheel","embedding"]),a=e.container;if(null==a)throw new Error("Ensure the container of the graph is specified and valid");null==o.width&&(o.width=a.clientWidth),null==o.height&&(o.height=a.clientHeight);const s=merge$2({},Options2.defaults,o),l={size:10,visible:!1};return s.grid="number"==typeof t?{size:t,visible:!1}:"boolean"==typeof t?Object.assign(Object.assign({},l),{visible:t}):Object.assign(Object.assign({},l),t),["panning","mousewheel","embedding"].forEach(t=>{const r=e[t];"boolean"==typeof r?s[t].enabled=r:s[t]=Object.assign(Object.assign({},s[t]),r)}),s},function(e){e.defaults={x:0,y:0,scaling:{min:.01,max:16},grid:{size:10,visible:!1},background:!1,panning:{enabled:!1,eventTypes:["leftMouseDown"]},mousewheel:{enabled:!1,factor:1.2,zoomAtMousePosition:!0},highlighting:{default:{name:"stroke",args:{padding:3}},nodeAvailable:{name:"className",args:{className:Config.prefix("available-node")}},magnetAvailable:{name:"className",args:{className:Config.prefix("available-magnet")}}},connecting:{snap:!1,allowLoop:!0,allowNode:!0,allowEdge:!1,allowPort:!0,allowBlank:!0,allowMulti:!0,highlight:!1,anchor:"center",edgeAnchor:"ratio",connectionPoint:"boundary",router:"normal",connector:"normal",validateConnection:({type:e,sourceView:t,targetView:r})=>null!=("target"===e?r:t),createEdge:()=>new Edge},translating:{restrict:!1},embedding:{enabled:!1,findParent:"bbox",frontOnly:!0,validate:()=>!0},moveThreshold:0,clickThreshold:0,magnetThreshold:0,preventDefaultDblClick:!0,preventDefaultMouseDown:!1,preventDefaultContextMenu:!0,preventDefaultBlankAction:!0,interacting:{edgeLabelMovable:!1},async:!0,virtual:!1,guard:()=>!1}}(Options||(Options={}));var __decorate$m=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},__rest$4=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};class GridManager extends Base{get elem(){return this.view.grid}get grid(){return this.options.grid}init(){this.startListening(),this.draw(this.grid)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}setVisible(e){this.grid.visible!==e&&(this.grid.visible=e,this.update())}getGridSize(){return this.grid.size}setGridSize(e){this.grid.size=Math.max(e,1),this.update()}show(){this.setVisible(!0),this.update()}hide(){this.setVisible(!1),this.update()}clear(){this.elem.style.backgroundImage=""}draw(e){this.clear(),this.instance=null,Object.assign(this.grid,e),this.patterns=this.resolveGrid(e),this.update()}update(e={}){const t=this.grid.size;if(t<=1||!this.grid.visible)return this.clear();const r=this.graph.matrix(),n=this.getInstance(),i=Array.isArray(e)?e:[e];this.patterns.forEach((e,o)=>{const a=`pattern_${o}`,s=r.a||1,l=r.d||1,{update:c,markup:u}=e,d=__rest$4(e,["update","markup"]),p=Object.assign(Object.assign(Object.assign({},d),i[o]),{sx:s,sy:l,ox:r.e||0,oy:r.f||0,width:t*s,height:t*l});n.has(a)||n.add(a,Vector.create("pattern",{id:a,patternUnits:"userSpaceOnUse"},Vector.createVectors(u)).node);const h=n.get(a);"function"==typeof c&&c(h.childNodes[0],p);let f=p.ox%p.width;f<0&&(f+=p.width);let g=p.oy%p.height;g<0&&(g+=p.height),attr(h,{x:f,y:g,width:p.width,height:p.height})});const o=(new XMLSerializer).serializeToString(n.root),a=`url(data:image/svg+xml;base64,${btoa(o)})`;this.elem.style.backgroundImage=a}getInstance(){return this.instance||(this.instance=new Grid),this.instance}resolveGrid(e){if(!e)return[];const t=e.type;if(null==t)return[Object.assign(Object.assign({},Grid.presets.dot),e.args)];const r=Grid.registry.get(t);if(r){let t=e.args||[];return Array.isArray(t)||(t=[t]),Array.isArray(r)?r.map((e,r)=>Object.assign(Object.assign({},e),t[r])):[Object.assign(Object.assign({},r),t[0])]}return Grid.registry.onNotFound(t)}dispose(){this.stopListening(),this.clear()}}__decorate$m([Base.dispose()],GridManager.prototype,"dispose",null);class TransformManager extends Base{get container(){return this.graph.view.container}get viewport(){return this.graph.view.viewport}get stage(){return this.graph.view.stage}init(){this.resize()}getMatrix(){const e=this.viewport.getAttribute("transform");return e!==this.viewportTransformString&&(this.viewportMatrix=this.viewport.getCTM(),this.viewportTransformString=e),createSVGMatrix(this.viewportMatrix)}setMatrix(e){const t=createSVGMatrix(e);t.a=Number.isFinite(t.a)?t.a:1,t.b=Number.isFinite(t.b)?t.b:0,t.c=Number.isFinite(t.c)?t.c:0,t.d=Number.isFinite(t.d)?t.d:1,t.e=Number.isFinite(t.e)?t.e:0,t.f=Number.isFinite(t.f)?t.f:0;const r=matrixToTransformString(t);this.viewport.setAttribute("transform",r),this.viewportMatrix=t,this.viewportTransformString=r}resize(e,t){let r=void 0===e?this.options.width:e,n=void 0===t?this.options.height:t;this.options.width=r,this.options.height=n,"number"==typeof r&&(r=Math.round(r)),"number"==typeof n&&(n=Math.round(n)),this.container.style.width=null==r?"":`${r}px`,this.container.style.height=null==n?"":`${n}px`;const i=this.getComputedSize();return this.graph.trigger("resize",Object.assign({},i)),this}getComputedSize(){let e=this.options.width,t=this.options.height;return isNumber(e)||(e=this.container.clientWidth),isNumber(t)||(t=this.container.clientHeight),{width:e,height:t}}getScale(){return matrixToScale(this.getMatrix())}scale(e,t=e,r=0,n=0){if(e=this.clampScale(e),t=this.clampScale(t),r||n){const i=this.getTranslation(),o=i.tx-r*(e-1),a=i.ty-n*(t-1);o===i.tx&&a===i.ty||this.translate(o,a)}const i=this.getMatrix(),o=Number.isFinite(e)?e:1,a=Number.isFinite(t)?t:1;return i.a=o,i.d=a,this.setMatrix(i),this.graph.trigger("scale",{sx:o,sy:a,ox:r,oy:n}),this}clampScale(e){const t=this.graph.options.scaling;return clamp(e,t.min||.01,t.max||16)}getZoom(){return this.getScale().sx}zoom(e,t){t=t||{};let r=e,n=e;const i=this.getScale(),o=this.getComputedSize();let a=o.width/2,s=o.height/2;if(t.absolute||(r+=i.sx,n+=i.sy),t.scaleGrid&&(r=Math.round(r/t.scaleGrid)*t.scaleGrid,n=Math.round(n/t.scaleGrid)*t.scaleGrid),t.maxScale&&(r=Math.min(t.maxScale,r),n=Math.min(t.maxScale,n)),t.minScale&&(r=Math.max(t.minScale,r),n=Math.max(t.minScale,n)),t.center&&(a=t.center.x,s=t.center.y),r=this.clampScale(r),n=this.clampScale(n),r=Number.isFinite(r)?r:i.sx,n=Number.isFinite(n)?n:i.sy,a||s){const e=this.getTranslation(),t=0===i.sx?1:i.sx,o=0===i.sy?1:i.sy,l=a-(a-e.tx)*(r/t),c=s-(s-e.ty)*(n/o);l===e.tx&&c===e.ty||this.translate(l,c)}return this.scale(r,n),this}getRotation(){return matrixToRotation(this.getMatrix())}rotate(e,t,r){if(null==t||null==r){const e=Util$1.getBBox(this.stage);t=e.width/2,r=e.height/2}const n=this.getMatrix().translate(t,r).rotate(e).translate(-t,-r);return this.setMatrix(n),this}getTranslation(){return matrixToTranslation(this.getMatrix())}translate(e,t){const r=this.getMatrix();r.e=Number.isFinite(e)?e:0,r.f=Number.isFinite(t)?t:0,this.setMatrix(r);const n=this.getTranslation();return this.options.x=n.tx,this.options.y=n.ty,this.graph.trigger("translate",Object.assign({},n)),this}setOrigin(e,t){return this.translate(e||0,t||0)}fitToContent(e,t,r,n){if("object"==typeof e){const i=e;e=i.gridWidth||1,t=i.gridHeight||1,r=i.padding||0,n=i}else e=e||1,t=t||1,r=r||0,null==n&&(n={});const i=normalizeSides(r),o=n.border||0,a=n.contentArea?Rectangle.create(n.contentArea):this.getContentArea(n);o>0&&a.inflate(o);const s=this.getScale(),l=this.getTranslation(),c=s.sx,u=s.sy;a.x*=c,a.y*=u,a.width*=c,a.height*=u;let d=Math.max(Math.ceil((a.width+a.x)/e),1)*e,p=Math.max(Math.ceil((a.height+a.y)/t),1)*t,h=0,f=0;("negative"===n.allowNewOrigin&&a.x<0||"positive"===n.allowNewOrigin&&a.x>=0||"any"===n.allowNewOrigin)&&(h=Math.ceil(-a.x/e)*e,h+=i.left,d+=h),("negative"===n.allowNewOrigin&&a.y<0||"positive"===n.allowNewOrigin&&a.y>=0||"any"===n.allowNewOrigin)&&(f=Math.ceil(-a.y/t)*t,f+=i.top,p+=f),d+=i.right,p+=i.bottom,d=Math.max(d,n.minWidth||0),p=Math.max(p,n.minHeight||0),d=Math.min(d,n.maxWidth||Number.MAX_SAFE_INTEGER),p=Math.min(p,n.maxHeight||Number.MAX_SAFE_INTEGER);const g=this.getComputedSize(),m=d!==g.width||p!==g.height;return(h!==l.tx||f!==l.ty)&&this.translate(h,f),m&&this.resize(d,p),new Rectangle(-h/c,-f/u,d/c,p/u)}scaleContentToFit(e={}){this.scaleContentToFitImpl(e)}scaleContentToFitImpl(e={},t=!0){let r,n;if(e.contentArea){const t=e.contentArea;r=this.graph.localToGraph(t),n=Point.create(t)}else r=this.getContentBBox(e),n=this.graph.graphToLocal(r);if(!r.width||!r.height)return;const i=normalizeSides(e.padding),o=e.minScale||0,a=e.maxScale||Number.MAX_SAFE_INTEGER,s=e.minScaleX||o,l=e.maxScaleX||a,c=e.minScaleY||o,u=e.maxScaleY||a;let d;if(e.viewportArea)d=e.viewportArea;else{const e=this.getComputedSize(),t=this.getTranslation();d={x:t.tx,y:t.ty,width:e.width,height:e.height}}d=Rectangle.create(d).moveAndExpand({x:i.left,y:i.top,width:-i.left-i.right,height:-i.top-i.bottom});const p=this.getScale();let h=d.width/r.width*p.sx,f=d.height/r.height*p.sy;!1!==e.preserveAspectRatio&&(h=f=Math.min(h,f));const g=e.scaleGrid;if(g&&(h=g*Math.floor(h/g),f=g*Math.floor(f/g)),h=clamp(h,s,l),f=clamp(f,c,u),this.scale(h,f),t){const e=this.options,t=d.x-n.x*h-e.x,r=d.y-n.y*f-e.y;this.translate(t,r)}}getContentArea(e={}){return!1!==e.useCellGeometry?this.model.getAllCellsBBox()||new Rectangle:Util$1.getBBox(this.stage)}getContentBBox(e={}){return this.graph.localToGraph(this.getContentArea(e))}getGraphArea(){const e=Rectangle.fromSize(this.getComputedSize());return this.graph.graphToLocal(e)}zoomToRect(e,t={}){const r=Rectangle.create(e),n=this.graph;t.contentArea=r,null==t.viewportArea&&(t.viewportArea={x:n.options.x,y:n.options.y,width:this.options.width,height:this.options.height}),this.scaleContentToFitImpl(t,!1);const i=r.getCenter();return this.centerPoint(i.x,i.y),this}zoomToFit(e={}){return this.zoomToRect(this.getContentArea(e),e)}centerPoint(e,t){const r=this.getComputedSize(),n=this.getScale(),i=this.getTranslation(),o=r.width/2,a=r.height/2;t="number"==typeof t?t:a,e=o-(e="number"==typeof e?e:o)*n.sx,t=a-t*n.sy,i.tx===e&&i.ty===t||this.translate(e,t)}centerContent(e){const t=this.graph.getContentArea(e).getCenter();this.centerPoint(t.x,t.y)}centerCell(e){return this.positionCell(e,"center")}positionPoint(e,t,r){const n=this.getComputedSize();(t=normalizePercentage(t,Math.max(0,n.width)))<0&&(t=n.width+t),(r=normalizePercentage(r,Math.max(0,n.height)))<0&&(r=n.height+r);const i=this.getTranslation(),o=this.getScale(),a=t-e.x*o.sx,s=r-e.y*o.sy;i.tx===a&&i.ty===s||this.translate(a,s)}positionRect(e,t){const r=Rectangle.create(e);switch(t){case"center":return this.positionPoint(r.getCenter(),"50%","50%");case"top":return this.positionPoint(r.getTopCenter(),"50%",0);case"top-right":return this.positionPoint(r.getTopRight(),"100%",0);case"right":return this.positionPoint(r.getRightMiddle(),"100%","50%");case"bottom-right":return this.positionPoint(r.getBottomRight(),"100%","100%");case"bottom":return this.positionPoint(r.getBottomCenter(),"50%","100%");case"bottom-left":return this.positionPoint(r.getBottomLeft(),0,"100%");case"left":return this.positionPoint(r.getLeftMiddle(),0,"50%");case"top-left":return this.positionPoint(r.getTopLeft(),0,0);default:return this}}positionCell(e,t){const r=e.getBBox();return this.positionRect(r,t)}positionContent(e,t){const r=this.graph.getContentArea(t);return this.positionRect(r,e)}}var __decorate$l=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class BackgroundManager extends Base{get elem(){return this.view.background}init(){this.startListening(),this.options.background&&this.draw(this.options.background)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}updateBackgroundImage(e={}){let t=e.size||"auto auto",r=e.position||"center";const n=this.graph.transform.getScale(),i=this.graph.translate();if("object"==typeof r){r=`${i.tx+n.sx*(r.x||0)}px ${i.ty+n.sy*(r.y||0)}px`}"object"==typeof t&&(t=Rectangle.fromSize(t).scale(n.sx,n.sy),t=`${t.width}px ${t.height}px`),this.elem.style.backgroundSize=t,this.elem.style.backgroundPosition=r}drawBackgroundImage(e,t={}){if(!(e instanceof HTMLImageElement))return void(this.elem.style.backgroundImage="");const r=this.optionsCache;if(r&&r.image!==t.image)return;let n;const i=t.opacity,o=t.size;let a=t.repeat||"no-repeat";const s=Background.registry.get(a);if("function"==typeof s){const r=t.quality||1;e.width*=r,e.height*=r;const i=s(e,t);if(!(i instanceof HTMLCanvasElement))throw new Error("Background pattern must return an HTML Canvas instance");n=i.toDataURL("image/png"),a=t.repeat&&a!==t.repeat?t.repeat:"repeat","object"==typeof o?(o.width*=i.width/e.width,o.height*=i.height/e.height):void 0===o&&(t.size={width:i.width/r,height:i.height/r})}else n=e.src,void 0===o&&(t.size={width:e.width,height:e.height});null!=r&&"object"==typeof t.size&&t.image===r.image&&t.repeat===r.repeat&&t.quality===r.quality&&(r.size=clone(t.size));const l=this.elem.style;l.backgroundImage=`url(${n})`,l.backgroundRepeat=a,l.opacity=null==i||i>=1?"":`${i}`,this.updateBackgroundImage(t)}updateBackgroundColor(e){this.elem.style.backgroundColor=e||""}updateBackgroundOptions(e){this.graph.options.background=e}update(){this.optionsCache&&this.updateBackgroundImage(this.optionsCache)}draw(e){const t=e||{};if(this.updateBackgroundOptions(e),this.updateBackgroundColor(t.color),t.image){this.optionsCache=clone(t);const r=document.createElement("img");r.onload=()=>this.drawBackgroundImage(r,e),r.setAttribute("crossorigin","anonymous"),r.src=t.image}else this.drawBackgroundImage(null),this.optionsCache=null}clear(){this.draw()}dispose(){this.clear(),this.stopListening()}}__decorate$l([Base.dispose()],BackgroundManager.prototype,"dispose",null);var __decorate$k=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class PanningManager extends Base{get widgetOptions(){return this.options.panning}get pannable(){return this.widgetOptions&&!0===this.widgetOptions.enabled}init(){this.onRightMouseDown=this.onRightMouseDown.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.startListening(),this.updateClassName()}startListening(){this.graph.on("blank:mousedown",this.onMouseDown,this),this.graph.on("node:unhandled:mousedown",this.onMouseDown,this),this.graph.on("edge:unhandled:mousedown",this.onMouseDown,this),Event$1.on(this.graph.container,"mousedown",this.onRightMouseDown),Event$1.on(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle=new MouseWheelHandle(this.graph.container,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.mousewheelHandle.enable()}stopListening(){this.graph.off("blank:mousedown",this.onMouseDown,this),this.graph.off("node:unhandled:mousedown",this.onMouseDown,this),this.graph.off("edge:unhandled:mousedown",this.onMouseDown,this),Event$1.off(this.graph.container,"mousedown",this.onRightMouseDown),Event$1.off(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle&&this.mousewheelHandle.disable()}allowPanning(e,t){return e.spaceKey=this.isSpaceKeyPressed,this.pannable&&ModifierKey.isMatch(e,this.widgetOptions.modifiers,t)}startPanning(e){const t=this.view.normalizeEvent(e);this.clientX=t.clientX,this.clientY=t.clientY,this.panning=!0,this.updateClassName(e),Event$1.on(document.body,{"mousemove.panning touchmove.panning":this.pan.bind(this),"mouseup.panning touchend.panning":this.stopPanning.bind(this),"mouseleave.panning":this.stopPanning.bind(this)}),Event$1.on(window,"mouseup.panning",this.stopPanning.bind(this))}pan(e){const t=this.view.normalizeEvent(e),r=t.clientX-this.clientX,n=t.clientY-this.clientY;this.clientX=t.clientX,this.clientY=t.clientY,this.graph.translateBy(r,n)}stopPanning(e){this.panning=!1,this.updateClassName(e),Event$1.off(document.body,".panning"),Event$1.off(window,".panning")}updateClassName(e){const t=this.widgetOptions.eventTypes;if(1===(null==t?void 0:t.length)&&t.includes("mouseWheel"))return;const r=this.view.container,n=this.view.prefixClassName("graph-panning"),i=this.view.prefixClassName("graph-pannable"),o=this.graph.getPlugin("selection"),a=o&&o.allowRubberband(e,!0),s=(null==t?void 0:t.includes("leftMouseDown"))&&!a;this.allowPanning(null!=e?e:{},!0)||this.allowPanning(null!=e?e:{})&&s?this.panning?(addClass(r,n),removeClass(r,i)):(removeClass(r,n),addClass(r,i)):this.panning||(removeClass(r,n),removeClass(r,i))}onMouseDown({e:e}){if(!this.allowBlankMouseDown(e))return;const t=this.graph.getPlugin("selection"),r=t&&t.allowRubberband(e,!0);(this.allowPanning(e,!0)||this.allowPanning(e)&&!r)&&this.startPanning(e)}onRightMouseDown(e){const t=this.widgetOptions.eventTypes;(null==t?void 0:t.includes("rightMouseDown"))&&2===e.button&&this.allowPanning(e,!0)&&this.startPanning(e)}onMouseWheel(e,t,r){this.graph.translateBy(-t,-r)}onKeyDown(e){32===e.which&&(this.isSpaceKeyPressed=!0),this.updateClassName(e)}onKeyUp(e){32===e.which&&(this.isSpaceKeyPressed=!1),this.updateClassName(e)}allowBlankMouseDown(e){const t=this.widgetOptions.eventTypes;return(null==t?void 0:t.includes("leftMouseDown"))&&0===e.button||(null==t?void 0:t.includes("mouseWheelDown"))&&1===e.button}allowMouseWheel(e){var t;return this.pannable&&!e.ctrlKey&&(null===(t=this.widgetOptions.eventTypes)||void 0===t?void 0:t.includes("mouseWheel"))}autoPanning(e,t){const r=10,n=this.graph.getGraphArea();let i=0,o=0;e<=n.left+r&&(i=-10),t<=n.top+r&&(o=-10),e>=n.right-r&&(i=r),t>=n.bottom-r&&(o=r),0===i&&0===o||this.graph.translateBy(-i,-o)}enablePanning(){this.pannable||(this.widgetOptions.enabled=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.widgetOptions.enabled=!1,this.updateClassName())}dispose(){this.stopListening()}}__decorate$k([Base.dispose()],PanningManager.prototype,"dispose",null);var __decorate$j=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class MouseWheel extends Base{constructor(){super(...arguments),this.cumulatedFactor=1}get widgetOptions(){return this.options.mousewheel}init(){this.container=this.graph.container,this.target=this.widgetOptions.global?document:this.container,this.mousewheelHandle=new MouseWheelHandle(this.target,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.widgetOptions.enabled&&this.enable(!0)}get disabled(){return!0!==this.widgetOptions.enabled}enable(e){(this.disabled||e)&&(this.widgetOptions.enabled=!0,this.mousewheelHandle.enable())}disable(){this.disabled||(this.widgetOptions.enabled=!1,this.mousewheelHandle.disable())}allowMouseWheel(e){const t=this.widgetOptions.guard;return(null==t||t(e))&&ModifierKey.isMatch(e,this.widgetOptions.modifiers)}onMouseWheel(e){const t=this.widgetOptions.guard;if((null==t||t(e))&&ModifierKey.isMatch(e,this.widgetOptions.modifiers)){const t=this.widgetOptions.factor||1.2;null==this.currentScale&&(this.startPos={x:e.clientX,y:e.clientY},this.currentScale=this.graph.transform.getScale().sx);e.deltaY<0?(this.currentScale<.15?this.cumulatedFactor=(this.currentScale+.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*t*20)/20/this.currentScale,this.cumulatedFactor<=1&&(this.cumulatedFactor=1.05)):(this.currentScale<=.15?this.cumulatedFactor=(this.currentScale-.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*(1/t)*20)/20/this.currentScale,this.cumulatedFactor>=1&&(this.cumulatedFactor=.95)),this.cumulatedFactor=Math.max(.01,Math.min(this.currentScale*this.cumulatedFactor,160)/this.currentScale);const r=this.currentScale;let n=this.graph.transform.clampScale(r*this.cumulatedFactor);if(n=clamp(n,this.widgetOptions.minScale||Number.MIN_SAFE_INTEGER,this.widgetOptions.maxScale||Number.MAX_SAFE_INTEGER),n!==r)if(this.widgetOptions.zoomAtMousePosition){const e=!!this.graph.getPlugin("scroller")?this.graph.clientToLocal(this.startPos):this.graph.clientToGraph(this.startPos);this.graph.zoom(n,{absolute:!0,center:e.clone()})}else this.graph.zoom(n,{absolute:!0});this.currentScale=null,this.cumulatedFactor=1}}dispose(){this.disable()}}__decorate$j([Disposable.dispose()],MouseWheel.prototype,"dispose",null);var __decorate$i=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},JOB_PRIORITY,JOB_PRIORITY2;class VirtualRenderManager extends Base{init(){this.resetRenderArea=throttle$1(this.resetRenderArea,200,{leading:!0}),this.resetRenderArea(),this.startListening()}startListening(){this.graph.on("translate",this.resetRenderArea,this),this.graph.on("scale",this.resetRenderArea,this),this.graph.on("resize",this.resetRenderArea,this)}stopListening(){this.graph.off("translate",this.resetRenderArea,this),this.graph.off("scale",this.resetRenderArea,this),this.graph.off("resize",this.resetRenderArea,this)}enableVirtualRender(){this.options.virtual=!0,this.resetRenderArea()}disableVirtualRender(){this.options.virtual=!1,this.graph.renderer.setRenderArea(void 0)}resetRenderArea(){if(this.options.virtual){const e=this.graph.getGraphArea();this.graph.renderer.setRenderArea(e)}}dispose(){this.stopListening()}}__decorate$i([Base.dispose()],VirtualRenderManager.prototype,"dispose",null);class JobQueue{constructor(){this.isFlushing=!1,this.isFlushPending=!1,this.scheduleId=0,this.queue=[],this.frameInterval=33,this.initialTime=Date.now()}queueJob(e){if(e.priority&JOB_PRIORITY.PRIOR)e.cb();else{const t=this.findInsertionIndex(e);t>=0&&this.queue.splice(t,0,e)}}queueFlush(){this.isFlushing||this.isFlushPending||(this.isFlushPending=!0,this.scheduleJob())}queueFlushSync(){this.isFlushing||this.isFlushPending||(this.isFlushPending=!0,this.flushJobsSync())}clearJobs(){this.queue.length=0,this.isFlushing=!1,this.isFlushPending=!1,this.cancelScheduleJob()}flushJobs(){this.isFlushPending=!1,this.isFlushing=!0;const e=this.getCurrentTime();let t;for(;(t=this.queue.shift())&&(t.cb(),!(this.getCurrentTime()-e>=this.frameInterval)););this.isFlushing=!1,this.queue.length&&this.queueFlush()}flushJobsSync(){let e;for(this.isFlushPending=!1,this.isFlushing=!0;e=this.queue.shift();)try{e.cb()}catch(t){}this.isFlushing=!1}findInsertionIndex(e){let t=0,r=this.queue.length,n=r-1;const i=e.priority;for(;t<=n;){const e=(n-t>>1)+t;i<=this.queue[e].priority?t=e+1:(r=e,n=e-1)}return r}scheduleJob(){"requestIdleCallback"in window?(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.requestIdleCallback(this.flushJobs.bind(this),{timeout:100})):(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.setTimeout(this.flushJobs.bind(this)))}cancelScheduleJob(){"cancelIdleCallback"in window?(this.scheduleId&&window.cancelIdleCallback(this.scheduleId),this.scheduleId=0):(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduleId=0)}getCurrentTime(){return"object"==typeof performance&&"function"==typeof performance.now?performance.now():Date.now()-this.initialTime}}JOB_PRIORITY2=JOB_PRIORITY||(JOB_PRIORITY={}),JOB_PRIORITY2[JOB_PRIORITY2.Update=2]="Update",JOB_PRIORITY2[JOB_PRIORITY2.RenderEdge=4]="RenderEdge",JOB_PRIORITY2[JOB_PRIORITY2.RenderNode=8]="RenderNode",JOB_PRIORITY2[JOB_PRIORITY2.PRIOR=1048576]="PRIOR";var __decorate$h=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Scheduler2;class Scheduler extends Disposable{get model(){return this.graph.model}get container(){return this.graph.view.stage}constructor(e){super(),this.views={},this.willRemoveViews={},this.queue=new JobQueue,this.graph=e,this.init()}init(){this.startListening(),this.renderViews(this.model.getCells())}startListening(){this.model.on("reseted",this.onModelReseted,this),this.model.on("cell:added",this.onCellAdded,this),this.model.on("cell:removed",this.onCellRemoved,this),this.model.on("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.on("cell:change:visible",this.onCellVisibleChanged,this)}stopListening(){this.model.off("reseted",this.onModelReseted,this),this.model.off("cell:added",this.onCellAdded,this),this.model.off("cell:removed",this.onCellRemoved,this),this.model.off("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.off("cell:change:visible",this.onCellVisibleChanged,this)}onModelReseted({options:e}){this.queue.clearJobs(),this.removeZPivots(),this.resetViews();const t=this.model.getCells();this.renderViews(t,Object.assign(Object.assign({},e),{queue:t.map(e=>e.id)}))}onCellAdded({cell:e,options:t}){this.renderViews([e],t)}onCellRemoved({cell:e}){this.removeViews([e])}onCellZIndexChanged({cell:e,options:t}){const r=this.views[e.id];r&&this.requestViewUpdate(r.view,Scheduler.FLAG_INSERT,t,JOB_PRIORITY.Update,!0)}onCellVisibleChanged({cell:e,current:t}){this.toggleVisible(e,!!t)}requestViewUpdate(e,t,r={},n=JOB_PRIORITY.Update,i=!0){const o=e.cell.id,a=this.views[o];if(!a)return;a.flag=t,a.options=r;(e.hasAction(t,["translate","resize","rotate"])||!1===r.async)&&(n=JOB_PRIORITY.PRIOR,i=!1),this.queue.queueJob({id:o,priority:n,cb:()=>{this.renderViewInArea(e,t,r);const n=r.queue;if(n){const t=n.indexOf(e.cell.id);t>=0&&n.splice(t,1),0===n.length&&this.graph.trigger("render:done")}}});this.getEffectedEdges(e).forEach(e=>{this.requestViewUpdate(e.view,e.flag,r,n,!1)}),i&&this.flush()}setRenderArea(e){this.renderArea=e,this.flushWaitingViews()}isViewMounted(e){if(null==e)return!1;const t=this.views[e.cell.id];return!!t&&t.state===Scheduler.ViewState.MOUNTED}renderViews(e,t={}){e.sort((e,t)=>e.isNode()&&t.isEdge()?-1:0),e.forEach(e=>{const r=e.id;let n=0,i=this.views[r];if(i)n=Scheduler.FLAG_INSERT;else{const o=this.createCellView(e);o&&(o.graph=this.graph,n=Scheduler.FLAG_INSERT|o.getBootstrapFlag(),i={view:o,flag:n,options:t,state:Scheduler.ViewState.CREATED},this.views[r]=i)}i&&this.requestViewUpdate(i.view,n,t,this.getRenderPriority(i.view),!1)}),this.flush()}renderViewInArea(e,t,r={}){const n=e.cell,i=n.id,o=this.views[i];if(!o)return;let a=0;this.isUpdatable(e)||o.state===Scheduler.ViewState.MOUNTED?(a=this.updateView(e,t,r),o.flag=a):o.state=Scheduler.ViewState.WAITING,a&&n.isEdge()&&0===(a&e.getFlag(["source","target"]))&&this.queue.queueJob({id:i,priority:JOB_PRIORITY.RenderEdge,cb:()=>{this.updateView(e,t,r)}})}removeViews(e){e.forEach(e=>{const t=e.id,r=this.views[t];r&&(this.willRemoveViews[t]=r,delete this.views[t],this.queue.queueJob({id:t,priority:this.getRenderPriority(r.view),cb:()=>{this.removeView(r.view)}}))}),this.flush()}flush(){this.graph.options.async?this.queue.queueFlush():this.queue.queueFlushSync()}flushWaitingViews(){Object.values(this.views).forEach(e=>{if(e&&e.state===Scheduler.ViewState.WAITING){const{view:t,flag:r,options:n}=e;this.requestViewUpdate(t,r,n,this.getRenderPriority(t),!1)}}),this.flush()}updateView(e,t,r={}){if(null==e)return 0;if(CellView.isCellView(e)){if(t&Scheduler.FLAG_REMOVE)return this.removeView(e.cell),0;t&Scheduler.FLAG_INSERT&&(this.insertView(e),t^=Scheduler.FLAG_INSERT)}return t?e.confirmUpdate(t,r):0}insertView(e){const t=this.views[e.cell.id];if(t){const r=e.cell.getZIndex(),n=this.addZPivot(r);this.container.insertBefore(e.container,n),e.cell.isVisible()||this.toggleVisible(e.cell,!1),t.state=Scheduler.ViewState.MOUNTED,this.graph.trigger("view:mounted",{view:e})}}resetViews(){this.willRemoveViews=Object.assign(Object.assign({},this.views),this.willRemoveViews),Object.values(this.willRemoveViews).forEach(e=>{e&&this.removeView(e.view)}),this.views={},this.willRemoveViews={}}removeView(e){const t=e.cell,r=this.willRemoveViews[t.id];r&&e&&(r.view.remove(),delete this.willRemoveViews[t.id],this.graph.trigger("view:unmounted",{view:e}))}toggleVisible(e,t){const r=this.model.getConnectedEdges(e);for(let i=0,o=r.length;i<o;i+=1){const e=r[i];if(t){const t=e.getSourceCell(),r=e.getTargetCell();if(t&&!t.isVisible()||r&&!r.isVisible())continue;this.toggleVisible(e,!0)}else this.toggleVisible(e,!1)}const n=this.views[e.id];n&&css$3(n.view.container,{display:t?"unset":"none"})}addZPivot(e=0){null==this.zPivots&&(this.zPivots={});const t=this.zPivots;let r=t[e];if(r)return r;r=t[e]=document.createComment(`z-index:${e+1}`);let n=-1/0;for(const o in t){const t=+o;t<e&&t>n&&(n=t)}const i=this.container;if(n!==-1/0){const e=t[n];i.insertBefore(r,e.nextSibling)}else i.insertBefore(r,i.firstChild);return r}removeZPivots(){this.zPivots&&Object.values(this.zPivots).forEach(e=>{e&&e.parentNode&&e.parentNode.removeChild(e)}),this.zPivots={}}createCellView(e){const t={graph:this.graph},r=this.graph.options.createCellView;if(r){const n=call$1(r,this.graph,e);if(n)return new n(e,t);if(null===n)return null}const n=e.view;if(null!=n&&"string"==typeof n){const r=CellView.registry.get(n);return r?new r(e,t):CellView.registry.onNotFound(n)}return e.isNode()?new NodeView(e,t):e.isEdge()?new EdgeView(e,t):null}getEffectedEdges(e){const t=[],r=e.cell,n=this.model.getConnectedEdges(r);for(let i=0,o=n.length;i<o;i+=1){const e=n[i],o=this.views[e.id];if(!o)continue;const a=o.view;if(!this.isViewMounted(a))continue;const s=["update"];e.getTargetCell()===r&&s.push("target"),e.getSourceCell()===r&&s.push("source"),t.push({id:e.id,view:a,flag:a.getFlag(s)})}return t}isUpdatable(e){if(e.isNodeView())return!this.renderArea||this.renderArea.isIntersectWithRect(e.cell.getBBox());if(e.isEdgeView()){const t=e.cell,r=t.getSourceCell(),n=t.getTargetCell();if(this.renderArea&&r&&n)return this.renderArea.isIntersectWithRect(r.getBBox())||this.renderArea.isIntersectWithRect(n.getBBox())}return!0}getRenderPriority(e){return e.cell.isNode()?JOB_PRIORITY.RenderNode:JOB_PRIORITY.RenderEdge}dispose(){this.stopListening(),Object.keys(this.views).forEach(e=>{this.views[e].view.dispose()}),this.views={}}}__decorate$h([Disposable.dispose()],Scheduler.prototype,"dispose",null),Scheduler2=Scheduler||(Scheduler={}),Scheduler2.FLAG_INSERT=1<<30,Scheduler2.FLAG_REMOVE=1<<29,Scheduler2.FLAG_RENDER=67108863,function(e){var t;(t=e.ViewState||(e.ViewState={}))[t.CREATED=0]="CREATED",t[t.MOUNTED=1]="MOUNTED",t[t.WAITING=2]="WAITING"}(Scheduler||(Scheduler={}));var __decorate$g=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class Renderer extends Base{constructor(){super(...arguments),this.schedule=new Scheduler(this.graph)}requestViewUpdate(e,t,r={}){this.schedule.requestViewUpdate(e,t,r)}isViewMounted(e){return this.schedule.isViewMounted(e)}setRenderArea(e){this.schedule.setRenderArea(e)}findViewByElem(e){if(null==e)return null;const t=this.options.container,r="string"==typeof e?t.querySelector(e):e instanceof Element?e:e[0];if(r){const e=this.graph.view.findAttr("data-cell-id",r);if(e){const t=this.schedule.views;if(t[e])return t[e].view}}return null}findViewByCell(e){if(null==e)return null;const t=Cell.isCell(e)?e.id:e,r=this.schedule.views;return r[t]?r[t].view:null}findViewsFromPoint(e){const t={x:e.x,y:e.y};return this.model.getCells().map(e=>this.findViewByCell(e)).filter(e=>null!=e&&Util$1.getBBox(e.container,{target:this.view.stage}).containsPoint(t))}findEdgeViewsFromPoint(e,t=5){return this.model.getEdges().map(e=>this.findViewByCell(e)).filter(r=>{if(null!=r){const n=r.getClosestPoint(e);if(n)return n.distance(e)<=t}return!1})}findViewsInArea(e,t={}){const r=Rectangle.create(e);return this.model.getCells().map(e=>this.findViewByCell(e)).filter(e=>{if(e){if(t.nodeOnly&&!e.isNodeView())return!1;const n=Util$1.getBBox(e.container,{target:this.view.stage});return 0===n.width?n.inflate(1,0):0===n.height&&n.inflate(0,1),t.strict?r.containsRect(n):r.isIntersectWithRect(n)}return!1})}dispose(){this.schedule.dispose()}}__decorate$g([Base.dispose()],Renderer.prototype,"dispose",null);var __rest$3=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};class DefsManager extends Base{get cid(){return this.graph.view.cid}get svg(){return this.view.svg}get defs(){return this.view.defs}isDefined(e){return null!=this.svg.getElementById(e)}filter(e){let t=e.id;const r=e.name;if(t||(t=`filter-${r}-${this.cid}-${hashcode(JSON.stringify(e))}`),!this.isDefined(t)){const n=Filter.registry.get(r);if(null==n)return Filter.registry.onNotFound(r);const i=n(e.args||{}),o=Object.assign(Object.assign({x:-1,y:-1,width:3,height:3,filterUnits:"objectBoundingBox"},e.attrs),{id:t});Vector.create(Markup.sanitize(i),o).appendTo(this.defs)}return t}gradient(e){let t=e.id;const r=e.type;if(t||(t=`gradient-${r}-${this.cid}-${hashcode(JSON.stringify(e))}`),!this.isDefined(t)){const n=`<${r}>${e.stops.map(e=>{const t=null!=e.opacity&&Number.isFinite(e.opacity)?e.opacity:1;return`<stop offset="${e.offset}" stop-color="${e.color}" stop-opacity="${t}"/>`}).join("")}</${r}>`,i=Object.assign({id:t},e.attrs);Vector.create(n,i).appendTo(this.defs)}return t}marker(e){const{id:t,refX:r,refY:n,markerUnits:i,markerOrient:o,tagName:a,children:s}=e,l=__rest$3(e,["id","refX","refY","markerUnits","markerOrient","tagName","children"]);let c=t;if(c||(c=`marker-${this.cid}-${hashcode(JSON.stringify(e))}`),!this.isDefined(c)){"path"!==a&&delete l.d;const e=Vector.create("marker",{refX:r,refY:n,id:c,overflow:"visible",orient:null!=o?o:"auto",markerUnits:i||"userSpaceOnUse"},s?s.map(e=>{var{tagName:t}=e,r=__rest$3(e,["tagName"]);return Vector.create(`${t}`||"path",kebablizeAttrs(Object.assign(Object.assign({},l),r)))}):[Vector.create(a||"path",kebablizeAttrs(l))]);this.defs.appendChild(e.node)}return c}remove(e){const t=this.svg.getElementById(e);t&&t.parentNode&&t.parentNode.removeChild(t)}}class CoordManager extends Base{getClientMatrix(){return createSVGMatrix(this.view.stage.getScreenCTM())}getClientOffset(){const e=this.view.svg.getBoundingClientRect();return new Point(e.left,e.top)}getPageOffset(){return this.getClientOffset().translate(window.scrollX,window.scrollY)}snapToGrid(e,t){return("number"==typeof e?this.clientToLocalPoint(e,t):this.clientToLocalPoint(e.x,e.y)).snapToGrid(this.graph.getGridSize())}localToGraphPoint(e,t){const r=Point.create(e,t);return Util$1.transformPoint(r,this.graph.matrix())}localToClientPoint(e,t){const r=Point.create(e,t);return Util$1.transformPoint(r,this.getClientMatrix())}localToPagePoint(e,t){return("number"==typeof e?this.localToGraphPoint(e,t):this.localToGraphPoint(e)).translate(this.getPageOffset())}localToGraphRect(e,t,r,n){const i=Rectangle.create(e,t,r,n);return Util$1.transformRectangle(i,this.graph.matrix())}localToClientRect(e,t,r,n){const i=Rectangle.create(e,t,r,n);return Util$1.transformRectangle(i,this.getClientMatrix())}localToPageRect(e,t,r,n){return("number"==typeof e?this.localToGraphRect(e,t,r,n):this.localToGraphRect(e)).translate(this.getPageOffset())}graphToLocalPoint(e,t){const r=Point.create(e,t);return Util$1.transformPoint(r,this.graph.matrix().inverse())}clientToLocalPoint(e,t){const r=Point.create(e,t);return Util$1.transformPoint(r,this.getClientMatrix().inverse())}clientToGraphPoint(e,t){const r=Point.create(e,t);return Util$1.transformPoint(r,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalPoint(e,t){const r=Point.create(e,t).diff(this.getPageOffset());return this.graphToLocalPoint(r)}graphToLocalRect(e,t,r,n){const i=Rectangle.create(e,t,r,n);return Util$1.transformRectangle(i,this.graph.matrix().inverse())}clientToLocalRect(e,t,r,n){const i=Rectangle.create(e,t,r,n);return Util$1.transformRectangle(i,this.getClientMatrix().inverse())}clientToGraphRect(e,t,r,n){const i=Rectangle.create(e,t,r,n);return Util$1.transformRectangle(i,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalRect(e,t,r,n){const i=Rectangle.create(e,t,r,n),o=this.getPageOffset();return i.x-=o.x,i.y-=o.y,this.graphToLocalRect(i)}}var __decorate$f=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class HighlightManager extends Base{constructor(){super(...arguments),this.highlights={}}init(){this.startListening()}startListening(){this.graph.on("cell:highlight",this.onCellHighlight,this),this.graph.on("cell:unhighlight",this.onCellUnhighlight,this)}stopListening(){this.graph.off("cell:highlight",this.onCellHighlight,this),this.graph.off("cell:unhighlight",this.onCellUnhighlight,this)}onCellHighlight({view:e,magnet:t,options:r={}}){const n=this.resolveHighlighter(r);if(!n)return;const i=this.getHighlighterId(t,n);if(!this.highlights[i]){const r=n.highlighter;r.highlight(e,t,Object.assign({},n.args)),this.highlights[i]={cellView:e,magnet:t,highlighter:r,args:n.args}}}onCellUnhighlight({magnet:e,options:t={}}){const r=this.resolveHighlighter(t);if(!r)return;const n=this.getHighlighterId(e,r);this.unhighlight(n)}resolveHighlighter(e){const t=this.options;let r=e.highlighter;if(null==r){const n=e.type;r=n&&t.highlighting[n]||t.highlighting.default}if(null==r)return null;const n="string"==typeof r?{name:r}:r,i=n.name,o=Highlighter.registry.get(i);return null==o?Highlighter.registry.onNotFound(i):(Highlighter.check(i,o),{name:i,highlighter:o,args:n.args||{}})}getHighlighterId(e,t){return ensureId(e),t.name+e.id+JSON.stringify(t.args)}unhighlight(e){const t=this.highlights[e];t&&(t.highlighter.unhighlight(t.cellView,t.magnet,t.args),delete this.highlights[e])}dispose(){Object.keys(this.highlights).forEach(e=>this.unhighlight(e)),this.stopListening()}}__decorate$f([HighlightManager.dispose()],HighlightManager.prototype,"dispose",null);var __decorate$e=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class SizeManager extends Base{getScroller(){const e=this.graph.getPlugin("scroller");return e&&e.options.enabled?e:null}getContainer(){const e=this.getScroller();return e?e.container.parentElement:this.graph.container.parentElement}getSensorTarget(){const e=this.options.autoResize;if(e)return"boolean"==typeof e?this.getContainer():e}init(){if(this.options.autoResize){const e=this.getSensorTarget();e&&SizeSensor.bind(e,()=>{const t=e.offsetWidth,r=e.offsetHeight;this.resize(t,r)})}}resize(e,t){const r=this.getScroller();r?r.resize(e,t):this.graph.transform.resize(e,t)}dispose(){SizeSensor.clear(this.graph.container)}}__decorate$e([Base.dispose()],SizeManager.prototype,"dispose",null);var __decorate$d=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Graph2;class Graph extends Basecoat{get container(){return this.options.container}get[Symbol.toStringTag](){return Graph.toStringTag}constructor(e){super(),this.installedPlugins=new Set,this.options=Options.get(e),this.css=new CSSManager(this),this.view=new GraphView(this),this.defs=new DefsManager(this),this.coord=new CoordManager(this),this.transform=new TransformManager(this),this.highlight=new HighlightManager(this),this.grid=new GridManager(this),this.background=new BackgroundManager(this),this.options.model?this.model=this.options.model:(this.model=new Model,this.model.graph=this),this.renderer=new Renderer(this),this.panning=new PanningManager(this),this.mousewheel=new MouseWheel(this),this.virtualRender=new VirtualRenderManager(this),this.size=new SizeManager(this)}isNode(e){return e.isNode()}isEdge(e){return e.isEdge()}resetCells(e,t={}){return this.model.resetCells(e,t),this}clearCells(e={}){return this.model.clear(e),this}toJSON(e={}){return this.model.toJSON(e)}parseJSON(e){return this.model.parseJSON(e)}fromJSON(e,t={}){return this.model.fromJSON(e,t),this}getCellById(e){return this.model.getCell(e)}addNode(e,t={}){return this.model.addNode(e,t)}addNodes(e,t={}){return this.addCell(e.map(e=>Node$1.isNode(e)?e:this.createNode(e)),t)}createNode(e){return this.model.createNode(e)}removeNode(e,t={}){return this.model.removeCell(e,t)}addEdge(e,t={}){return this.model.addEdge(e,t)}addEdges(e,t={}){return this.addCell(e.map(e=>Edge$1.isEdge(e)?e:this.createEdge(e)),t)}removeEdge(e,t={}){return this.model.removeCell(e,t)}createEdge(e){return this.model.createEdge(e)}addCell(e,t={}){return this.model.addCell(e,t),this}removeCell(e,t={}){return this.model.removeCell(e,t)}removeCells(e,t={}){return this.model.removeCells(e,t)}removeConnectedEdges(e,t={}){return this.model.removeConnectedEdges(e,t)}disconnectConnectedEdges(e,t={}){return this.model.disconnectConnectedEdges(e,t),this}hasCell(e){return this.model.has(e)}getCells(){return this.model.getCells()}getCellCount(){return this.model.total()}getNodes(){return this.model.getNodes()}getEdges(){return this.model.getEdges()}getOutgoingEdges(e){return this.model.getOutgoingEdges(e)}getIncomingEdges(e){return this.model.getIncomingEdges(e)}getConnectedEdges(e,t={}){return this.model.getConnectedEdges(e,t)}getRootNodes(){return this.model.getRoots()}getLeafNodes(){return this.model.getLeafs()}isRootNode(e){return this.model.isRoot(e)}isLeafNode(e){return this.model.isLeaf(e)}getNeighbors(e,t={}){return this.model.getNeighbors(e,t)}isNeighbor(e,t,r={}){return this.model.isNeighbor(e,t,r)}getSuccessors(e,t={}){return this.model.getSuccessors(e,t)}isSuccessor(e,t,r={}){return this.model.isSuccessor(e,t,r)}getPredecessors(e,t={}){return this.model.getPredecessors(e,t)}isPredecessor(e,t,r={}){return this.model.isPredecessor(e,t,r)}getCommonAncestor(...e){return this.model.getCommonAncestor(...e)}getSubGraph(e,t={}){return this.model.getSubGraph(e,t)}cloneSubGraph(e,t={}){return this.model.cloneSubGraph(e,t)}cloneCells(e){return this.model.cloneCells(e)}getNodesFromPoint(e,t){return this.model.getNodesFromPoint(e,t)}getNodesInArea(e,t,r,n,i){return this.model.getNodesInArea(e,t,r,n,i)}getNodesUnderNode(e,t={}){return this.model.getNodesUnderNode(e,t)}searchCell(e,t,r={}){return this.model.search(e,t,r),this}getShortestPath(e,t,r={}){return this.model.getShortestPath(e,t,r)}getAllCellsBBox(){return this.model.getAllCellsBBox()}getCellsBBox(e,t={}){return this.model.getCellsBBox(e,t)}startBatch(e,t={}){this.model.startBatch(e,t)}stopBatch(e,t={}){this.model.stopBatch(e,t)}batchUpdate(e,t,r){const n="string"==typeof e?e:"update",i="string"==typeof e?t:e,o="function"==typeof t?r:t;this.startBatch(n,o);const a=i();return this.stopBatch(n,o),a}updateCellId(e,t){return this.model.updateCellId(e,t)}findView(e){return Cell.isCell(e)?this.findViewByCell(e):this.findViewByElem(e)}findViews(e){return Rectangle.isRectangleLike(e)?this.findViewsInArea(e):Point.isPointLike(e)?this.findViewsFromPoint(e):[]}findViewByCell(e){return this.renderer.findViewByCell(e)}findViewByElem(e){return this.renderer.findViewByElem(e)}findViewsFromPoint(e,t){const r="number"==typeof e?{x:e,y:t}:e;return this.renderer.findViewsFromPoint(r)}findViewsInArea(e,t,r,n,i){const o="number"==typeof e?{x:e,y:t,width:r,height:n}:e,a="number"==typeof e?i:t;return this.renderer.findViewsInArea(o,a)}matrix(e){return void 0===e?this.transform.getMatrix():(this.transform.setMatrix(e),this)}resize(e,t){const r=this.getPlugin("scroller");return r?r.resize(e,t):this.transform.resize(e,t),this}scale(e,t=e,r=0,n=0){return void 0===e?this.transform.getScale():(this.transform.scale(e,t,r,n),this)}zoom(e,t){const r=this.getPlugin("scroller");if(r){if(void 0===e)return r.zoom();r.zoom(e,t)}else{if(void 0===e)return this.transform.getZoom();this.transform.zoom(e,t)}return this}zoomTo(e,t={}){const r=this.getPlugin("scroller");return r?r.zoom(e,Object.assign(Object.assign({},t),{absolute:!0})):this.transform.zoom(e,Object.assign(Object.assign({},t),{absolute:!0})),this}zoomToRect(e,t={}){const r=this.getPlugin("scroller");return r?r.zoomToRect(e,t):this.transform.zoomToRect(e,t),this}zoomToFit(e={}){const t=this.getPlugin("scroller");return t?t.zoomToFit(e):this.transform.zoomToFit(e),this}rotate(e,t,r){return void 0===e?this.transform.getRotation():(this.transform.rotate(e,t,r),this)}translate(e,t){return void 0===e?this.transform.getTranslation():(this.transform.translate(e,t),this)}translateBy(e,t){const r=this.translate(),n=r.tx+e,i=r.ty+t;return this.translate(n,i)}getGraphArea(){return this.transform.getGraphArea()}getContentArea(e={}){return this.transform.getContentArea(e)}getContentBBox(e={}){return this.transform.getContentBBox(e)}fitToContent(e,t,r,n){return this.transform.fitToContent(e,t,r,n)}scaleContentToFit(e={}){return this.transform.scaleContentToFit(e),this}center(e){return this.centerPoint(e)}centerPoint(e,t,r){const n=this.getPlugin("scroller");return n?n.centerPoint(e,t,r):this.transform.centerPoint(e,t),this}centerContent(e){const t=this.getPlugin("scroller");return t?t.centerContent(e):this.transform.centerContent(e),this}centerCell(e,t){const r=this.getPlugin("scroller");return r?r.centerCell(e,t):this.transform.centerCell(e),this}positionPoint(e,t,r,n={}){const i=this.getPlugin("scroller");return i?i.positionPoint(e,t,r,n):this.transform.positionPoint(e,t,r),this}positionRect(e,t,r){const n=this.getPlugin("scroller");return n?n.positionRect(e,t,r):this.transform.positionRect(e,t),this}positionCell(e,t,r){const n=this.getPlugin("scroller");return n?n.positionCell(e,t,r):this.transform.positionCell(e,t),this}positionContent(e,t){const r=this.getPlugin("scroller");return r?r.positionContent(e,t):this.transform.positionContent(e,t),this}snapToGrid(e,t){return this.coord.snapToGrid(e,t)}pageToLocal(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.pageToLocalRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.pageToLocalRect(e,t,r,n):this.coord.pageToLocalPoint(e,t)}localToPage(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.localToPageRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.localToPageRect(e,t,r,n):this.coord.localToPagePoint(e,t)}clientToLocal(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.clientToLocalRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.clientToLocalRect(e,t,r,n):this.coord.clientToLocalPoint(e,t)}localToClient(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.localToClientRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.localToClientRect(e,t,r,n):this.coord.localToClientPoint(e,t)}localToGraph(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.localToGraphRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.localToGraphRect(e,t,r,n):this.coord.localToGraphPoint(e,t)}graphToLocal(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.graphToLocalRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.graphToLocalRect(e,t,r,n):this.coord.graphToLocalPoint(e,t)}clientToGraph(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.clientToGraphRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.clientToGraphRect(e,t,r,n):this.coord.clientToGraphPoint(e,t)}defineFilter(e){return this.defs.filter(e)}defineGradient(e){return this.defs.gradient(e)}defineMarker(e){return this.defs.marker(e)}getGridSize(){return this.grid.getGridSize()}setGridSize(e){return this.grid.setGridSize(e),this}showGrid(){return this.grid.show(),this}hideGrid(){return this.grid.hide(),this}clearGrid(){return this.grid.clear(),this}drawGrid(e){return this.grid.draw(e),this}updateBackground(){return this.background.update(),this}drawBackground(e,t){const r=this.getPlugin("scroller");return null==r||null!=this.options.background&&t?this.background.draw(e):r.drawBackground(e,t),this}clearBackground(e){const t=this.getPlugin("scroller");return null==t||null!=this.options.background&&e?this.background.clear():t.clearBackground(e),this}enableVirtualRender(){return this.virtualRender.enableVirtualRender(),this}disableVirtualRender(){return this.virtualRender.disableVirtualRender(),this}isMouseWheelEnabled(){return!this.mousewheel.disabled}enableMouseWheel(){return this.mousewheel.enable(),this}disableMouseWheel(){return this.mousewheel.disable(),this}toggleMouseWheel(e){return null==e?this.isMouseWheelEnabled()?this.disableMouseWheel():this.enableMouseWheel():e?this.enableMouseWheel():this.disableMouseWheel(),this}isPannable(){const e=this.getPlugin("scroller");return e?e.isPannable():this.panning.pannable}enablePanning(){const e=this.getPlugin("scroller");return e?e.enablePanning():this.panning.enablePanning(),this}disablePanning(){const e=this.getPlugin("scroller");return e?e.disablePanning():this.panning.disablePanning(),this}togglePanning(e){return null==e?this.isPannable()?this.disablePanning():this.enablePanning():e!==this.isPannable()&&(e?this.enablePanning():this.disablePanning()),this}use(e,...t){return this.installedPlugins.has(e)||(this.installedPlugins.add(e),e.init(this,...t)),this}getPlugin(e){return Array.from(this.installedPlugins).find(t=>t.name===e)}getPlugins(e){return Array.from(this.installedPlugins).filter(t=>e.includes(t.name))}enablePlugins(e){let t=e;Array.isArray(t)||(t=[t]);const r=this.getPlugins(t);return null==r||r.forEach(e=>{var t;null===(t=null==e?void 0:e.enable)||void 0===t||t.call(e)}),this}disablePlugins(e){let t=e;Array.isArray(t)||(t=[t]);const r=this.getPlugins(t);return null==r||r.forEach(e=>{var t;null===(t=null==e?void 0:e.disable)||void 0===t||t.call(e)}),this}isPluginEnabled(e){var t;const r=this.getPlugin(e);return null===(t=null==r?void 0:r.isEnabled)||void 0===t?void 0:t.call(r)}disposePlugins(e){let t=e;Array.isArray(t)||(t=[t]);const r=this.getPlugins(t);return null==r||r.forEach(e=>{e.dispose(),this.installedPlugins.delete(e)}),this}dispose(e=!0){e&&this.model.dispose(),this.css.dispose(),this.defs.dispose(),this.grid.dispose(),this.coord.dispose(),this.transform.dispose(),this.highlight.dispose(),this.background.dispose(),this.mousewheel.dispose(),this.panning.dispose(),this.view.dispose(),this.renderer.dispose(),this.installedPlugins.forEach(e=>{e.dispose()})}}__decorate$d([Basecoat.dispose()],Graph.prototype,"dispose",null),Graph2=Graph||(Graph={}),Graph2.View=GraphView,Graph2.Renderer=Renderer,Graph2.MouseWheel=MouseWheel,Graph2.DefsManager=DefsManager,Graph2.GridManager=GridManager,Graph2.CoordManager=CoordManager,Graph2.TransformManager=TransformManager,Graph2.HighlightManager=HighlightManager,Graph2.BackgroundManager=BackgroundManager,Graph2.PanningManager=PanningManager,function(e){e.toStringTag=`X6.${e.name}`,e.isGraph=function(t){if(null==t)return!1;if(t instanceof e)return!0;const r=t[Symbol.toStringTag];return null==r||r===e.toStringTag}}(Graph||(Graph={})),function(e){e.render=function(t,r){const n=t instanceof HTMLElement?new e({container:t}):new e(t);return null!=r&&n.fromJSON(r),n}}(Graph||(Graph={})),function(e){e.registerNode=Node$1.registry.register,e.registerEdge=Edge$1.registry.register,e.registerView=CellView.registry.register,e.registerAttr=Attr.registry.register,e.registerGrid=Grid.registry.register,e.registerFilter=Filter.registry.register,e.registerNodeTool=NodeTool.registry.register,e.registerEdgeTool=EdgeTool.registry.register,e.registerBackground=Background.registry.register,e.registerHighlighter=Highlighter.registry.register,e.registerPortLayout=PortLayout.registry.register,e.registerPortLabelLayout=PortLabelLayout.registry.register,e.registerMarker=Marker.registry.register,e.registerRouter=Router.registry.register,e.registerConnector=Connector.registry.register,e.registerAnchor=NodeAnchor.registry.register,e.registerEdgeAnchor=EdgeAnchor.registry.register,e.registerConnectionPoint=ConnectionPoint.registry.register}(Graph||(Graph={})),function(e){e.unregisterNode=Node$1.registry.unregister,e.unregisterEdge=Edge$1.registry.unregister,e.unregisterView=CellView.registry.unregister,e.unregisterAttr=Attr.registry.unregister,e.unregisterGrid=Grid.registry.unregister,e.unregisterFilter=Filter.registry.unregister,e.unregisterNodeTool=NodeTool.registry.unregister,e.unregisterEdgeTool=EdgeTool.registry.unregister,e.unregisterBackground=Background.registry.unregister,e.unregisterHighlighter=Highlighter.registry.unregister,e.unregisterPortLayout=PortLayout.registry.unregister,e.unregisterPortLabelLayout=PortLabelLayout.registry.unregister,e.unregisterMarker=Marker.registry.unregister,e.unregisterRouter=Router.registry.unregister,e.unregisterConnector=Connector.registry.unregister,e.unregisterAnchor=NodeAnchor.registry.unregister,e.unregisterEdgeAnchor=EdgeAnchor.registry.unregister,e.unregisterConnectionPoint=ConnectionPoint.registry.unregister}(Graph||(Graph={}));var __decorate$c=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},__rest$2=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},HTML2;class HTML extends Node$1{}!function(e){class t extends NodeView{init(){super.init(),this.cell.on("change:*",this.onCellChangeAny,this)}onCellChangeAny({key:t}){const r=e.shapeMaps[this.cell.shape];if(r){const{effect:e}=r;e&&!e.includes(t)||this.renderHTMLComponent()}}confirmUpdate(e){const r=super.confirmUpdate(e);return this.handleAction(r,t.action,()=>this.renderHTMLComponent())}renderHTMLComponent(){const t=this.selectors&&this.selectors.foContent;if(t){empty$2(t);const r=e.shapeMaps[this.cell.shape];if(!r)return;let{html:n}=r;"function"==typeof n&&(n=n(this.cell)),n&&("string"==typeof n?t.innerHTML=n:append(t,n))}}dispose(){this.cell.off("change:*",this.onCellChangeAny,this)}}var r;__decorate$c([t.dispose()],t.prototype,"dispose",null),e.View=t,(r=t=e.View||(e.View={})).action="html",r.config({bootstrap:[r.action],actions:{html:r.action}}),NodeView.registry.register("html-view",r,!0)}(HTML||(HTML={})),HTML2=HTML||(HTML={}),HTML2.config({view:"html-view",markup:[{tagName:"rect",selector:"body"},Object.assign({},Markup.getForeignObjectMarkup()),{tagName:"text",selector:"label"}],attrs:{body:{fill:"none",stroke:"none",refWidth:"100%",refHeight:"100%"},fo:{refWidth:"100%",refHeight:"100%"}}}),Node$1.registry.register("html",HTML2,!0),function(e){e.shapeMaps={},e.register=function(t){const{shape:r,html:n,effect:i,inherit:o}=t,a=__rest$2(t,["shape","html","effect","inherit"]);if(!r)throw new Error("should specify shape in config");e.shapeMaps[r]={html:n,effect:i},Graph.registerNode(r,Object.assign({inherit:o||"html"},a),!0)}}(HTML||(HTML={}));const registerCustomCell=()=>{Graph.registerNode("text",{inherit:"rect",width:100,height:30,label:"文本",markup:[{tagName:"text",selector:"label",attrs:{fill:"#000000",fontSize:18,refX:"50%",refY:"50%",textAnchor:"middle",textVerticalAnchor:"middle",style:"word-wrap: 'break-all';"}}]})};registerCustomCell();var classnames={exports:{}};
206
+ ***************************************************************************** */var a$1=function(){return a$1=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},a$1.apply(this,arguments)};function i$1(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function u$1(e){var t=e.defaultContent,r=void 0===t?[]:t,n=e.onCreated,i=e.defaultHtml,o=void 0===i?"":i,a=e.value,s=void 0===a?"":a,l=e.onChange,c=e.defaultConfig,u=void 0===c?{}:c,d=e.mode,p=void 0===d?"default":d,h=e.style,f=void 0===h?{}:h,g=e.className,m=React.useRef(null),v=i$1(React.useState(null),2),y=v[0],b=v[1],q=i$1(React.useState(""),2),V=q[0],S=q[1],E=function(e){n&&n(e);var t=u.onCreated;t&&t(e)},x=function(e){S(e.getHtml()),l&&l(e);var t=u.onChange;t&&t(e)},C=function(e){var t=u.onDestroyed;b(null),t&&t(e)};return React.useEffect(function(){if(null!=y&&s!==V)try{y.setHtml(s)}catch(e10){}},[s]),React.useEffect(function(){var e;if(null!=m.current&&null==y&&!(null===(e=m.current)||void 0===e?void 0:e.getAttribute("data-w-e-textarea"))){var t=iye({selector:m.current,config:a$1(a$1({},u),{onCreated:E,onChange:x,onDestroyed:C}),content:r,html:o||s,mode:p});b(t)}},[y]),React.createElement("div",{style:f,ref:m,className:g})}function c$3(e){var t=e.editor,r=e.defaultConfig,n=void 0===r?{}:r,i=e.mode,o=void 0===i?"default":i,a=e.style,s=void 0===a?{}:a,l=e.className,c=React.useRef(null);return React.useEffect(function(){null!=c.current&&null!=t&&aye({editor:t,selector:c.current,config:n,mode:o})},[t]),React.createElement("div",{style:s,ref:c,className:l})}var dist={exports:{}};const require$$0$2=getAugmentedNamespace(index_esm);var module2;module2=dist,self,module2.exports=(e=>(()=>{var t={857:t=>{t.exports=e}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var o=r[e]={exports:{}};return t[e](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{default:()=>a});var e=n(857),t={"*":"list-item","-":"list-item","+":"list-item",">":"blockquote","#":"header1","##":"header2","###":"header3","####":"header4","#####":"header5"},r={"---":"divider","----":"divider","-----":"divider","------":"divider"};function o(t){var r=t.selection;if(null==r)return{beforeText:"",range:null};var n=r.anchor,i=e.SlateEditor.above(t,{match:function(r){return e.SlateEditor.isBlock(t,r)}});if(null==i)return{beforeText:"",range:null};var o=i[1],a={anchor:n,focus:e.SlateEditor.start(t,o)};return{beforeText:e.SlateEditor.string(t,a)||"",range:a}}const a={editorPlugin:function(n){var i=n.insertBreak,a=n.insertText,s=n;return s.insertText=function(r){var i=n.selection;if(null==i)return a(r);if(e.SlateRange.isExpanded(i))return a(r);if(null==e.DomEditor.getSelectedNodeByType(n,"paragraph"))return a(r);if(" "!==r)return a(r);var s=o(n),l=s.beforeText,c=s.range;if(!l||!c)return a(r);var u=t[l];if(!u)return a(r);e.SlateTransforms.select(n,c),e.SlateTransforms.delete(n);var d={type:u};e.SlateTransforms.setNodes(n,d,{match:function(t){return e.SlateEditor.isBlock(n,t)}}),"list-item"===u&&e.SlateTransforms.wrapNodes(n,{type:"bulleted-list",children:[]},{match:function(t){return"list-item"===e.DomEditor.getNodeType(t)}})},s.insertBreak=function(){var t=n.selection;if(null==t)return i();if(e.SlateRange.isExpanded(t))return i();if(null==e.DomEditor.getSelectedNodeByType(n,"paragraph"))return i();var a=o(n),s=a.beforeText,l=a.range;if(!s||!l)return i();if(0!==s.indexOf("```")){var c=r[s];if(!c)return i();e.SlateTransforms.select(n,l),e.SlateTransforms.delete(n);var u={type:c};e.SlateTransforms.setNodes(n,u,{match:function(t){return e.SlateEditor.isBlock(n,t)}})}else{var d=s.slice(3).toLowerCase().trim();"js"===d&&(d="javascript"),"ts"===d&&(d="typescript"),"md"===d&&(d="markdown"),"py"===d&&(d="python"),"vb"===d&&(d="visual-basic"),"c#"===d&&(d="csharp");var p=((n.getConfig().MENU_CONF||{}).codeSelectLang||[]).codeLangs;if(d&&!(void 0===p?[]:p).some(function(e){return e.value===d}))return i();e.SlateTransforms.select(n,l),e.SlateTransforms.delete(n);var h={type:"pre",children:[{type:"code",language:d,children:[{text:""}]}]};e.SlateTransforms.insertNodes(n,h)}},s}}})(),i})())(require$$0$2);var distExports=dist.exports;const markdownModule=getDefaultExportFromCjs(distExports);function vnode(e,t,r,n,i){return{sel:e,data:t,children:r,text:n,elm:i,key:void 0===t?void 0:t.key}}const array=Array.isArray;function primitive(e){return"string"==typeof e||"number"==typeof e||e instanceof String||e instanceof Number}function addNS(e,t,r){if(e.ns="http://www.w3.org/2000/svg","foreignObject"!==r&&void 0!==t)for(let n=0;n<t.length;++n){const e=t[n];if("string"==typeof e)continue;const r=e.data;void 0!==r&&addNS(r,e.children,e.sel)}}function h$2(e,t,r){let n,i,o,a={};if(null!=t&&(array(t)?n=t:primitive(t)?i=t.toString():t&&t.sel?n=[t]:a=t),void 0!==n)for(o=0;o<n.length;++o)primitive(n[o])&&(n[o]=vnode(void 0,void 0,void 0,n[o],void 0));return!e.startsWith("svg")||3!==e.length&&"."!==e[3]&&"#"!==e[3]||addNS(a,n,e),vnode(e,a,n,i,void 0)}const byteToHex=[];for(let i=0;i<256;++i)byteToHex.push((i+256).toString(16).slice(1));function unsafeStringify(e,t=0){return(byteToHex[e[t+0]]+byteToHex[e[t+1]]+byteToHex[e[t+2]]+byteToHex[e[t+3]]+"-"+byteToHex[e[t+4]]+byteToHex[e[t+5]]+"-"+byteToHex[e[t+6]]+byteToHex[e[t+7]]+"-"+byteToHex[e[t+8]]+byteToHex[e[t+9]]+"-"+byteToHex[e[t+10]]+byteToHex[e[t+11]]+byteToHex[e[t+12]]+byteToHex[e[t+13]]+byteToHex[e[t+14]]+byteToHex[e[t+15]]).toLowerCase()}let getRandomValues;const rnds8=new Uint8Array(16);function rng(){if(!getRandomValues){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");getRandomValues=crypto.getRandomValues.bind(crypto)}return getRandomValues(rnds8)}const randomUUID="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),native={randomUUID:randomUUID};function _v4(e,t,r){var n;const i=(e=e||{}).random??(null==(n=e.rng)?void 0:n.call(e))??rng();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,unsafeStringify(i)}function v4(e,t,r){return native.randomUUID&&!e?native.randomUUID():_v4(e)}function withFillBlank(e){const{isInline:t,isVoid:r}=e,n=e;return n.isInline=e=>"fill-blank"===QO.getNodeType(e)||t(e),n.isVoid=e=>"fill-blank"===QO.getNodeType(e)||r(e),n}class InsertFillBlankMenu{constructor(){__publicField(this,"title","插入填空项"),__publicField(this,"tag","button")}getValue(e){return""}isActive(e){return!1}isDisabled(e){var t;return null==e.selection||(null==(t=e.getElemsByType("fill-blank"))?void 0:t.length)>=20}exec(e,t){if(this.isDisabled(e))return;const r=[{text:" "},{type:"fill-blank",key:v4(),children:[{text:""}]},{text:" "}];md.insertNodes(e,r)}}let fillBlankIds=[];const renderFillBlank=(e,t,r)=>{const n=null==r?void 0:r.getElemsByType("fill-blank"),i=(null==n?void 0:n.findIndex(t=>t.key===e.key&&!fillBlankIds.includes(t.id)))||0;return i===n.length-1?fillBlankIds=[]:fillBlankIds.push(n[i].id),h$2("input",{attrs:{class:"w-e-fill-blank","data-w-e-type":"fill-blank","data-w-e-is-void":"true","data-w-e-is-inline":"true",readonly:!0,placeholder:i+1}})},fillBlankToHtml=(e,t,r)=>'<input class="w-e-fill-blank" data-w-e-type="fill-blank" data-w-e-is-void="true" data-w-e-is-inline="true" readonly="true">',parseFillBlankHtml=(e,t,r)=>({type:"fill-blank",key:v4(),children:[{text:""}]}),parseCodeHtml=(e,t,r)=>{let n=(null==e?void 0:e.innerHTML)||"";const i='<input class="w-e-fill-blank" data-w-e-type="fill-blank" data-w-e-is-void="true" data-w-e-is-inline="true" readonly="true">',o=(null==t?void 0:t.filter(e=>"fill-blank"===(null==e?void 0:e.type)))||[];let a=[];return(null==o?void 0:o.length)&&(null==t||t.forEach((e,r)=>{var o;if(a.push(e),"fill-blank"===(null==e?void 0:e.type))if("fill-blank"===(null==(o=t[r+1])?void 0:o.type)){const e=null==n?void 0:n.indexOf(i,1);let t=null==n?void 0:n.slice(0,e);n=null==n?void 0:n.replace(t,""),t=t.replace(i,""),a.push({text:t})}else n=null==n?void 0:n.replace(i,"");else n=null==n?void 0:n.replace(null==e?void 0:e.text,"")})),{type:"code",language:"",children:(null==o?void 0:o.length)?a:[{text:(null==e?void 0:e.textContent)||""}]}},fillBlankModule={editorPlugin:withFillBlank,renderElems:[{type:"fill-blank",renderElem:renderFillBlank}],elemsToHtml:[{type:"fill-blank",elemToHtml:fillBlankToHtml}],parseElemsHtml:[{selector:"input[data-w-e-type='fill-blank']",parseElemHtml:parseFillBlankHtml},{selector:"pre:not([data-w-e-type])>code",parseElemHtml:parseCodeHtml}],menus:[{key:"fill-blank",factory:()=>new InsertFillBlankMenu}]},QuestionContext=React.createContext(null),useQuestionContext=()=>{const e=React.useContext(QuestionContext);if(!e)throw new Error("useMyContext must be used within a MyContext.Provider");return e};Zve.registerModule(fillBlankModule),Zve.registerModule(markdownModule);const RichEditor=React.forwardRef((e,t)=>{const{topProps:r}=useQuestionContext(),{uploadImg:n}=r,{defaultValue:i="",readOnly:o=!1,editorHeight:a=300,placeholder:s="请输入内容...",isBorder:l=!0,autoHeight:c,onChange:u,customToolbarKeys:d,mode:p="default",noPadding:h=!1}=e,[f,g]=React.useState(null),[m]=React.useState({toolbarKeys:d??["undo","redo","fullScreen","|","headerSelect","bold","underline","italic","color","bgColor","|","bulletedList","numberedList",{key:"group-justify",title:"对齐",iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M204.8 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z"></path><path d="M505.6 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z"></path><path d="M806.4 505.6m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z"></path></svg>',menuKeys:["justifyLeft","justifyRight","justifyCenter","justifyJustify"]},{key:"group-indent",title:"缩进",iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M0 64h1024v128H0z m384 192h640v128H384z m0 192h640v128H384z m0 192h640v128H384zM0 832h1024v128H0z m0-128V320l256 192z"></path></svg>',menuKeys:["indent","delIndent"]},"insertLink",{key:"group-image",title:"图片",iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M959.877 128l0.123 0.123v767.775l-0.123 0.122H64.102l-0.122-0.122V128.123l0.122-0.123h895.775zM960 64H64C28.795 64 0 92.795 0 128v768c0 35.205 28.795 64 64 64h896c35.205 0 64-28.795 64-64V128c0-35.205-28.795-64-64-64zM832 288.01c0 53.023-42.988 96.01-96.01 96.01s-96.01-42.987-96.01-96.01S682.967 192 735.99 192 832 234.988 832 288.01zM896 832H128V704l224.01-384 256 320h64l224.01-192z"></path></svg>',menuKeys:["insertImage","uploadImage"]},"insertTable","codeBlock","divider","|"]}),v={placeholder:s,autoFocus:!1,MENU_CONF:{uploadImage:{async customUpload(e,t){if(!e||!n)return;const r=new FormData;r.append("file",e);const i=await n({file:r});(null==i?void 0:i.url)&&t(null==i?void 0:i.url,null==i?void 0:i.url,null==i?void 0:i.url)}}}},y=React.useRef(null);React.useEffect(()=>()=>{null!=f&&(y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{null==f||f.destroy(),g(null)},500))},[f]),React.useEffect(()=>{o?null==f||f.disable():null==f||f.enable()},[o,f]);const b=React.useCallback((e="")=>e.replace(/<\/?p>/g,"").replace(/&nbsp;/gi,"").replace(/<br\/?>/g,""),[]);React.useImperativeHandle(t,()=>({getHtml:()=>{if(null==f?void 0:f.isEmpty())return"";{const e=(null==f?void 0:f.getHtml())??"",t=b(e);return/\S+/.test(t)?e:""}},setValue:(e="")=>!!f&&(null==f||f.setHtml(e),!0)}));const q={};return o&&c?(q.minHeight=c.min+"px",q.maxHeight=c.max+"px",q.overflowY="auto"):q.height="number"==typeof a?a+"px":a,jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{"data-nopadding":h,style:{border:l?"1px solid #E5E5E5":"",zIndex:99},className:"richeditor",children:[!o&&jsxRuntimeExports.jsx(c$3,{editor:f,defaultConfig:m,mode:"default",style:{borderBottom:"1px solid #E5E5E5"}}),jsxRuntimeExports.jsx(u$1,{defaultConfig:v,value:i,onCreated:g,mode:p,onChange:e=>{if(null==e?void 0:e.isEmpty())null==u||u("",e);else{const t=(null==e?void 0:e.getHtml())??"",r=b(t);/\S+/.test(r)?null==u||u(t,e):null==u||u("",e)}},style:{fontSize:"16px",...q}})]})})}),warningSvg="data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20x='0.535156'%20width='16'%20height='16'%20fill='black'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8.53516%201C4.66953%201%201.53516%204.13438%201.53516%208C1.53516%2011.8656%204.66953%2015%208.53516%2015C12.4008%2015%2015.5352%2011.8656%2015.5352%208C15.5352%204.13438%2012.4008%201%208.53516%201ZM8.03516%204.625C8.03516%204.55625%208.09141%204.5%208.16016%204.5H8.91016C8.97891%204.5%209.03516%204.55625%209.03516%204.625V8.875C9.03516%208.94375%208.97891%209%208.91016%209H8.16016C8.09141%209%208.03516%208.94375%208.03516%208.875V4.625ZM8.53516%2011.5C8.12109%2011.5%207.78516%2011.1641%207.78516%2010.75C7.78516%2010.3359%208.12109%2010%208.53516%2010C8.94922%2010%209.28516%2010.3359%209.28516%2010.75C9.28516%2011.1641%208.94922%2011.5%208.53516%2011.5Z'%20fill='%23FAAD14'/%3e%3c/svg%3e",upYSvg="data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20opacity='0.01'%20x='16.5352'%20y='16'%20width='16'%20height='16'%20transform='rotate(-180%2016.5352%2016)'%20fill='black'/%3e%3cpath%20d='M4.75455%2010.7326L8.71709%206.43956L12.68%2010.7326C12.8843%2010.9541%2013.2295%2010.9679%2013.4509%2010.7636C13.6723%2010.5592%2013.6862%2010.2141%2013.4818%209.99265L9.11818%205.26537C9.01492%205.15344%208.86956%205.08977%208.71727%205.08977C8.56498%205.08977%208.41963%205.15344%208.31636%205.26537L3.95273%209.99265C3.74838%2010.2141%203.76222%2010.5592%203.98364%2010.7636C4.20505%2010.9679%204.5502%2010.9541%204.75455%2010.7326'%20fill='%23FAAD14'/%3e%3c/svg%3e",tipSvg="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clipPath='url(%23clip0_954_6949)'%3e%3cg%20filter='url(%23filter0_i_954_6949)'%3e%3cpath%20d='M26.9806%2012.2299L29.1814%2011.1896C29.9321%2013.1617%2030.1883%2015.2877%2029.9274%2017.3817C29.6665%2019.4757%2028.8965%2021.4739%2027.6848%2023.2015L25.6975%2021.81C26.6636%2020.4329%2027.2845%2018.8438%2027.5078%2017.1765C27.7311%2015.5092%2027.5503%2013.8127%2026.9806%2012.2299ZM17.053%205.27772C15.3709%205.28347%2013.7147%205.69355%2012.2243%206.47339C10.7338%207.25323%209.45264%208.37997%208.48881%209.75864L6.50399%208.36886C7.71308%206.63945%209.32747%205.23262%2011.206%204.27141C13.0845%203.31019%2015.1699%202.82387%2017.2798%202.85497L17.0554%205.2795L17.053%205.27772ZM12.325%2028.2294C12.0815%2028.5771%2011.772%2028.8734%2011.414%2029.1015C11.056%2029.3295%2010.6566%2029.4848%2010.2386%2029.5586C9.82061%2029.6323%209.39218%2029.6229%208.97778%2029.531C8.56339%2029.4392%208.17115%2029.2666%207.82346%2029.0231C7.47577%2028.7796%207.17943%2028.4701%206.95138%2028.1121C6.72332%2027.7541%206.56801%2027.3547%206.49431%2026.9367C6.34546%2026.0925%206.53806%2025.2237%207.02975%2024.5216L12.325%2028.2294ZM23.7127%2020.4202L20.9314%2024.3923L20.2555%2028.9549C20.2148%2029.2272%2020.1052%2029.4845%2019.9371%2029.7026C19.769%2029.9206%2019.548%2030.0921%2019.295%2030.2008C19.042%2030.3094%2018.7655%2030.3516%2018.4916%2030.3234C18.2178%2030.2952%2017.9556%2030.1974%2017.7301%2030.0395L3.48051%2020.0642C3.25433%2019.9064%203.07227%2019.6935%202.95167%2019.4455C2.83107%2019.1975%202.77592%2018.9228%202.79149%2018.6475C2.80706%2018.3721%202.89282%2018.1054%203.04062%2017.8726C3.18841%2017.6398%203.39332%2017.4487%203.63584%2017.3174L7.69207%2015.1218L10.4747%2011.15C11.3766%209.86202%2012.6346%208.8651%2014.0946%208.28134C15.5545%207.69757%2017.153%207.55231%2018.6943%207.86334L19.0811%207.31281C19.3203%206.95534%2019.6285%206.64922%2019.9876%206.41239C20.3467%206.17556%2020.7494%206.01279%2021.1722%205.93362C21.595%205.85444%2022.0293%205.86046%2022.4498%205.95132C22.8702%206.04217%2023.2683%206.21604%2023.6206%206.46273C23.973%206.70941%2024.2726%207.02396%2024.5018%207.38792C24.7311%207.75188%2024.8854%208.15794%2024.9557%208.5823C25.0259%209.00666%2025.0108%209.44078%2024.9111%209.85922C24.8115%2010.2777%2024.6293%2010.672%2024.3753%2011.0191L23.9911%2011.5701C24.811%2012.9126%2025.2214%2014.4651%2025.1719%2016.0374C25.1224%2017.6096%2024.6152%2019.1333%2023.7125%2020.4215L23.7127%2020.4202Z'%20fill='%23FFCC33'%20fill-opacity='0.15'/%3e%3c/g%3e%3cpath%20d='M21.3721%2019.6161C22.2185%2018.4077%2022.6941%2016.9787%2022.7405%2015.5041C22.787%2014.0291%2022.402%2012.5726%2021.6328%2011.3131L21.4625%2011.0344L21.6493%2010.7665L22.0335%2010.2156L22.04%2010.2062L22.0401%2010.2062C22.2549%209.91283%2022.4089%209.5795%2022.4931%209.2258C22.5774%208.87209%2022.5901%208.50513%2022.5307%208.14642C22.4713%207.78771%2022.3409%207.44447%2022.1471%207.13681C21.9534%206.82916%2021.7001%206.56327%2021.4023%206.35475C21.1044%206.14623%2020.7679%205.99926%2020.4125%205.92246C20.0571%205.84566%2019.69%205.84057%2019.3326%205.9075C18.9752%205.97442%2018.6348%206.11201%2018.3313%206.3122C18.0277%206.51239%2017.7672%206.77116%2017.565%207.07333L17.5587%207.08276L17.5586%207.08268L17.1718%207.63321L16.984%207.9005L16.6638%207.83588C15.2178%207.54409%2013.7182%207.68037%2012.3486%208.22802C10.9789%208.77567%209.79875%209.71092%208.95263%2010.9192L8.95257%2010.9193L6.16993%2014.8911L6.10222%2014.9877L5.99845%2015.0439L1.94222%2017.2396L1.94216%2017.2396C1.77467%2017.3302%201.63316%2017.4622%201.5311%2017.623C1.42903%2017.7838%201.36981%2017.968%201.35905%2018.1581C1.3483%2018.3482%201.38638%2018.538%201.46967%2018.7092C1.55296%2018.8805%201.67869%2019.0276%201.83489%2019.1365L1.83562%2019.137L16.0852%2029.1123L16.0854%2029.1124C16.2411%2029.2215%2016.4221%2029.289%2016.6112%2029.3084C16.8004%2029.3279%2016.9913%2029.2988%2017.166%2029.2238C17.3407%2029.1487%2017.4934%2029.0303%2017.6095%2028.8797C17.7254%2028.7293%2017.8011%2028.5518%2017.8293%2028.364L21.3721%2019.6161ZM21.3721%2019.6161L21.3715%2019.6158L18.5902%2023.5879L18.5225%2023.6846L18.5052%2023.8014L17.8294%2028.3634L21.3721%2019.6161ZM14.7994%202.84116L14.6671%204.27101C13.0611%204.34269%2011.4885%204.76584%2010.0608%205.51279C8.64735%206.25234%207.41357%207.28968%206.44341%208.55102L5.27665%207.73406C6.40133%206.25582%207.84479%205.04697%209.50211%204.19894C11.147%203.35725%2012.957%202.89436%2014.7994%202.84116ZM26.0717%2016.7253C26.2855%2015.1291%2026.1457%2013.5074%2025.6647%2011.9743L26.964%2011.3601C27.5441%2013.1097%2027.728%2014.9688%2027.4996%2016.8023C27.2694%2018.6498%2026.627%2020.4196%2025.6224%2021.982L24.4533%2021.1634C25.3069%2019.8204%2025.86%2018.3064%2026.0717%2016.7253ZM5.05507%2026.3323C4.95858%2025.7851%205.03183%2025.2256%205.25868%2024.7268L9.6592%2027.8081C9.52376%2027.941%209.37452%2028.0598%209.21372%2028.1622C8.91111%2028.355%208.5735%2028.4863%208.22015%2028.5486C7.86681%2028.6109%207.50466%2028.603%207.15437%2028.5253C6.80408%2028.4476%206.47252%2028.3017%206.17861%2028.096C5.88471%2027.8902%205.63421%2027.6285%205.44143%2027.3259C5.24866%2027.0233%205.11737%2026.6857%205.05507%2026.3323Z'%20stroke='%23FAA600'%20stroke-opacity='0.4'/%3e%3c/g%3e%3cdefs%3e%3cfilter%20id='filter0_i_954_6949'%20x='2.78906'%20y='2.85352'%20width='27.2373'%20height='27.4785'%20filterUnits='userSpaceOnUse'%20color-interpolation-filters='sRGB'%3e%3cfeFlood%20flood-opacity='0'%20result='BackgroundImageFix'/%3e%3cfeBlend%20mode='normal'%20in='SourceGraphic'%20in2='BackgroundImageFix'%20result='shape'/%3e%3cfeColorMatrix%20in='SourceAlpha'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%20127%200'%20result='hardAlpha'/%3e%3cfeOffset%20dx='-2'%20dy='2'/%3e%3cfeComposite%20in2='hardAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'/%3e%3cfeColorMatrix%20type='matrix'%20values='0%200%200%200%200.96%200%200%200%200%200.832%200%200%200%200%200.576%200%200%200%200.3%200'/%3e%3cfeBlend%20mode='normal'%20in2='shape'%20result='effect1_innerShadow_954_6949'/%3e%3c/filter%3e%3cclipPath%20id='clip0_954_6949'%3e%3crect%20width='32'%20height='32'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",questionTypesMap={[QuestionTypeEnum.RADIO]:"单选题",[QuestionTypeEnum.CHECKBOX]:"多选题",[QuestionTypeEnum.JUDGE]:"判断题",[QuestionTypeEnum.COMPLETION]:"填空题",[QuestionTypeEnum.ANSWER]:"问答题",[QuestionTypeEnum.ACM]:"编程题",[QuestionTypeEnum.CCM]:"编码测验题",[QuestionTypeEnum.COMPOSITE]:"组合题",[QuestionTypeEnum.DRAW]:"画图题"},questionTypeSelectOptions=[{value:QuestionTypeEnum.RADIO,label:"选择题"},{value:QuestionTypeEnum.COMPLETION,label:"填空题"},{value:QuestionTypeEnum.ANSWER,label:"问答题"},{value:QuestionTypeEnum.CCM,label:"编码测验题"},{value:QuestionTypeEnum.COMPOSITE,label:"组合题"},{value:QuestionTypeEnum.DRAW,label:"画图题"}],difficultyMap={low:"简单",middle:"中等",high:"困难"},codeTestUrlStatic="https://quiz.cloudlab.top",codePlayerUrlStatic="https://run.cloudlab.top",getQuestionTypeIcon=e=>{switch(e){case"radio":case"checkbox":return jsxRuntimeExports.jsx(Target,{className:"w-4 h-4"});case"acm":case"ccm":return jsxRuntimeExports.jsx(Code$1,{className:"w-4 h-4"});case"completion":return jsxRuntimeExports.jsx(PenLine,{className:"w-4 h-4"});case"answer":return jsxRuntimeExports.jsx(MessageSquare,{className:"w-4 h-4"});default:return jsxRuntimeExports.jsx(FileText,{className:"w-4 h-4"})}},getQuestionTypeName=e=>{switch(e){case"radio":return"单选题";case"checkbox":return"多选题";case"acm":case"ccm":return"编码测验";case"completion":return"填空题";case"answer":return"问答题";default:return"题目"}},getDifficultyColor=e=>{switch(e){case"low":return"text-green-600 bg-green-100";case"middle":return"text-yellow-600 bg-yellow-100";case"high":return"text-red-600 bg-red-100";default:return"text-gray-600 bg-gray-100"}},QuestionHeader=e=>{const{currentIndex:t,questionsCount:r,type:n,difficulty:i="low",score:o}=e;return jsxRuntimeExports.jsxs("div",{className:"questionHeader tailwind-scoped",children:[t&&r&&jsxRuntimeExports.jsxs("div",{className:"questionIndex itemWrapper",children:["题目 ",t,"/",r]}),jsxRuntimeExports.jsxs("span",{className:"questionType itemWrapper",children:[getQuestionTypeIcon(n)," ",getQuestionTypeName(n)]}),i&&jsxRuntimeExports.jsx("div",{className:`difficulty itemWrapper ${getDifficultyColor(i)}`,children:jsxRuntimeExports.jsx("span",{className:"difficulty",children:difficultyMap[i]})}),o&&jsxRuntimeExports.jsxs("div",{className:"score itemWrapper",children:[jsxRuntimeExports.jsx(Star,{})," ",o," 分"]})]})},ChoiceQuestion=e=>{var t;const{data:r,onSubmit:n,buttonText:i,showQuestionTip:o,showResult:a,onNextQuestion:s}=e,{optionJson:l,answer:c,userAnswer:u,score:d,type:p,topic:h,content:f,auxiliary:g,difficulty:m,currentIndex:v,questionsCount:y}=r,[b,q]=React.useState(!0),[V,S]=React.useState(void 0),[E,x]=React.useState(),[C,w]=React.useState(""),[R,A]=React.useState([]);React.useEffect(()=>{u&&!E&&(x(u),u.indexOf(",")>-1?A(null==u?void 0:u.split(",")):w(u),T(u))},[r]);const T=e=>{if(!E&&!e)return void staticMethods.warning("请先作答!");const t=E||e;n&&!e&&void 0===V&&n(t),void 0!==V&&(null==s||s()),c&&a&&(t===c||t&&isArrayEqual(null==t?void 0:t.split(","),null==c?void 0:c.split(","))?S(1):S(0))},k=["A","B","C","D","E","F","G","H","I","J"];return jsxRuntimeExports.jsx("div",{className:"video-player-interaction tailwind-scoped",children:jsxRuntimeExports.jsx("div",{className:"video-player-interaction-content",children:jsxRuntimeExports.jsxs("div",{className:"video-player-interaction-content-main",children:[jsxRuntimeExports.jsx(QuestionHeader,{score:d,type:p,difficulty:m,currentIndex:v,questionsCount:y}),jsxRuntimeExports.jsx("div",{className:"video-player-interaction-content-desc",children:jsxRuntimeExports.jsx(RichEditor,{defaultValue:h||f,readOnly:!0,noPadding:!0})}),jsxRuntimeExports.jsx("div",{className:"video-player-interaction-content-options",children:"radio"===p?null==l?void 0:l.map(({key:e,value:t},r)=>jsxRuntimeExports.jsx("button",{onClick:()=>(e=>{S(void 0),x(e+""),w(e+"")})(e),disabled:void 0!==V,className:`w-full text-left p-4 rounded-lg border-2 transition-all ${C===e?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"} ${void 0!==V?e===c?"border-green-500 bg-green-50":C===e&&e!==c?"border-red-500 bg-red-50":"border-gray-200":""}`,children:jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntimeExports.jsxs("span",{children:[k[r],"、",t]}),void 0!==V&&e===c&&jsxRuntimeExports.jsx(CircleCheckBig,{className:"w-5 h-5 text-green-600"}),void 0!==V&&C===e&&e!==c&&jsxRuntimeExports.jsx(CircleX,{className:"w-5 h-5 text-red-600"})]})},e)):null==l?void 0:l.map(({key:e,value:t},r)=>jsxRuntimeExports.jsx("button",{onClick:()=>(e=>{S(void 0);let t=E||"";if(t&&(null==t?void 0:t.indexOf(e))>-1){let r=t.split(",");r=r.filter(t=>t!==e),t=null==r?void 0:r.join(",")}else t=t?t+","+e:e;x(t)})(String(e)),disabled:void 0!==V,className:`w-full text-left p-4 rounded-lg border-2 transition-all ${E&&(null==E?void 0:E.indexOf(e))>-1?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"} ${void 0!==V?c.indexOf(e)>-1?(null==E||E.indexOf(e),"border-green-500 bg-green-50"):E&&(null==E?void 0:E.indexOf(e))>-1&&-1===c.indexOf(e)?"border-red-500 bg-red-50":"border-gray-200":""}`,children:jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntimeExports.jsxs("span",{children:[k[r],"、",t]}),void 0!==V&&c.indexOf(e)>-1&&jsxRuntimeExports.jsx(CircleCheckBig,{className:"w-5 h-5 text-green-600"}),void 0!==V&&E&&(null==E?void 0:E.indexOf(e))>-1&&-1===c.indexOf(e)&&jsxRuntimeExports.jsx(CircleX,{className:"w-5 h-5 text-red-600"})]})},e))}),o&&0===V&&g&&(null==g?void 0:g.length)>0&&jsxRuntimeExports.jsxs("div",{className:"video-player-interaction-content-tip",children:[jsxRuntimeExports.jsxs("div",{className:"video-player-interaction-content-tip-icons",onClick:()=>{q(!b)},children:[jsxRuntimeExports.jsx("img",{src:warningSvg}),jsxRuntimeExports.jsx("span",{children:"提示"}),jsxRuntimeExports.jsx("img",{src:upYSvg,style:{transform:b?"rotate(0deg)":"rotate(180deg)"}})]}),b&&jsxRuntimeExports.jsxs("div",{className:"video-player-interaction-content-tip-text",children:[jsxRuntimeExports.jsx(RichEditor,{defaultValue:null==(t=null==g?void 0:g[0])?void 0:t.description,readOnly:!0}),jsxRuntimeExports.jsx("img",{src:tipSvg})]})]}),n&&jsxRuntimeExports.jsx("div",{className:"video-player-interaction-content-actions",children:jsxRuntimeExports.jsx(Button$1,{type:"primary",onClick:()=>T(),children:i||(void 0===V?"提交":"下一题")})})]})})})};var postRobot$2={exports:{}},postRobot$1={exports:{}};!function(e,t){"undefined"!=typeof self&&self,e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return{}.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){function n(e){return"[object RegExp]"==={}.toString.call(e)}r.r(t),r.d(t,"Promise",function(){return O}),r.d(t,"TYPES",function(){return Ye}),r.d(t,"ProxyWindow",function(){return Ce}),r.d(t,"setup",function(){return Ge}),r.d(t,"destroy",function(){return Ze}),r.d(t,"serializeMessage",function(){return Ke}),r.d(t,"deserializeMessage",function(){return He}),r.d(t,"createProxyWindow",function(){return ze}),r.d(t,"toProxyWindow",function(){return Xe}),r.d(t,"on",function(){return Me}),r.d(t,"once",function(){return We}),r.d(t,"send",function(){return je}),r.d(t,"markWindowKnown",function(){return fe}),r.d(t,"cleanUpWindow",function(){return Qe}),r.d(t,"bridge",function(){});var i="Call was rejected by callee.\r\n";function o(e){return void 0===e&&(e=window),e.location.protocol}function a(e){if(void 0===e&&(e=window),e.mockDomain){var t=e.mockDomain.split("//")[0];if(t)return t}return o(e)}function s(e){return void 0===e&&(e=window),"about:"===a(e)}function l(e){if(void 0===e&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch(t){}}function c(e){if(void 0===e&&(e=window),e&&!l(e))try{return e.opener}catch(t){}}function u(e){try{return!0}catch(t){}return!1}function d(e){void 0===e&&(e=window);var t=e.location;if(!t)throw new Error("Can not read window location");var r=o(e);if(!r)throw new Error("Can not read window protocol");if("file:"===r)return"file://";if("about:"===r){var n=l(e);return n&&u()?d(n):"about://"}var i=t.host;if(!i)throw new Error("Can not read window host");return r+"//"+i}function p(e){void 0===e&&(e=window);var t=d(e);return t&&e.mockDomain&&0===e.mockDomain.indexOf("mock:")?e.mockDomain:t}function h(e){if(!function(e){try{if(e===window)return!0}catch(n){}try{var t=Object.getOwnPropertyDescriptor(e,"location");if(t&&!1===t.enumerable)return!1}catch(n){}try{if(s(e)&&u())return!0}catch(n){}try{if(void 0===(r=e)&&(r=window),"mock:"===a(r)&&u())return!0}catch(n){}var r;try{if(d(e)===d(window))return!0}catch(n){}return!1}(e))return!1;try{if(e===window)return!0;if(s(e)&&u())return!0;if(p(window)===p(e))return!0}catch(t){}return!1}function f(e){if(!h(e))throw new Error("Expected window to be same domain");return e}function g(e,t){if(!e||!t)return!1;var r=l(t);return r?r===e:-1!==function(e){var t=[];try{for(;e.parent!==e;)t.push(e.parent),e=e.parent}catch(r){}return t}(t).indexOf(e)}function m(e){var t,r,n=[];try{t=e.frames}catch(l){t=e}try{r=t.length}catch(l){}if(0===r)return n;if(r){for(var i=0;i<r;i++){var o=void 0;try{o=t[i]}catch(l){continue}n.push(o)}return n}for(var a=0;a<100;a++){var s=void 0;try{s=t[a]}catch(l){return n}if(!s)return n;n.push(s)}return n}var v=[],y=[];function b(e,t){void 0===t&&(t=!0);try{if(e===window)return!1}catch(o){return!0}try{if(!e)return!0}catch(o){return!0}try{if(e.closed)return!0}catch(o){return!o||o.message!==i}if(t&&h(e))try{if(e.mockclosed)return!0}catch(o){}try{if(!e.parent||!e.top)return!0}catch(o){}var r=function(e,t){for(var r=0;r<e.length;r++)try{if(e[r]===t)return r}catch(o){}return-1}(v,e);if(-1!==r){var n=y[r];if(n&&function(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var t=e.ownerDocument;if(t&&t.documentElement&&!t.documentElement.contains(e)){for(var r=e;r.parentNode&&r.parentNode!==r;)r=r.parentNode;if(!r.host||!t.documentElement.contains(r.host))return!0}return!1}(n))return!0}return!1}function q(e){return void 0===e&&(e=window),c(e=e||window)||l(e)||void 0}function V(e,t){if("string"==typeof e){if("string"==typeof t)return"*"===e||t===e;if(n(t))return!1;if(Array.isArray(t))return!1}return n(e)?n(t)?e.toString()===t.toString():!Array.isArray(t)&&Boolean(t.match(e)):!!Array.isArray(e)&&(Array.isArray(t)?JSON.stringify(e)===JSON.stringify(t):!n(t)&&e.some(function(e){return V(e,t)}))}function S(e){try{if(e===window)return!0}catch(t){if(t&&t.message===i)return!0}try{if("[object Window]"==={}.toString.call(e))return!0}catch(t){if(t&&t.message===i)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(t){if(t&&t.message===i)return!0}try{if(e&&e.self===e)return!0}catch(t){if(t&&t.message===i)return!0}try{if(e&&e.parent===e)return!0}catch(t){if(t&&t.message===i)return!0}try{if(e&&e.top===e)return!0}catch(t){if(t&&t.message===i)return!0}try{if(e&&"__unlikely_value__"===e.__cross_domain_utils_window_check__)return!1}catch(t){return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch(t){}return!1}function E(e){if(h(e))return f(e).frameElement;for(var t=0,r=document.querySelectorAll("iframe");t<r.length;t++){var n=r[t];if(n&&n.contentWindow&&n.contentWindow===e)return n}}function x(e){if(void 0===(r=e)&&(r=window),Boolean(l(r))){var t=E(e);if(t&&t.parentElement)return void t.parentElement.removeChild(t)}var r;try{e.close()}catch(n){}}function C(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&"function"==typeof window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&"function"==typeof window.constructor&&e instanceof window.constructor)return!1;var t={}.toString;if(t){var r=t.call(e);if("[object Window]"===r||"[object global]"===r||"[object DOMWindow]"===r)return!1}if("function"==typeof e.then)return!0}catch(n){return!1}return!1}var w,R=[],A=[],T=0;function k(){if(!T&&w){var e=w;w=null,e.resolve()}}function N(){T+=1}function P(){T-=1,k()}var O=function(){function e(e){var t=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],e){var r,n,i=!1,o=!1,a=!1;N();try{e(function(e){a?t.resolve(e):(i=!0,r=e)},function(e){a?t.reject(e):(o=!0,n=e)})}catch(s){return P(),void this.reject(s)}P(),a=!0,i?this.resolve(r):o&&this.reject(n)}}var t=e.prototype;return t.resolve=function(e){if(this.resolved||this.rejected)return this;if(C(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},t.reject=function(e){var t=this;if(this.resolved||this.rejected)return this;if(C(e))throw new Error("Can not reject promise with another promise");if(!e){var r=e&&"function"==typeof e.toString?e.toString():{}.toString.call(e);e=new Error("Expected reject to be called with Error, got "+r)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout(function(){t.errorHandled||function(e,t){if(-1===R.indexOf(e)){R.push(e),setTimeout(function(){throw e},1);for(var r=0;r<A.length;r++)A[r](e,t)}}(e,t)},1),this.dispatch(),this},t.asyncReject=function(e){return this.errorHandled=!0,this.reject(e),this},t.dispatch=function(){var t=this.resolved,r=this.rejected,n=this.handlers;if(!this.dispatching&&(t||r)){this.dispatching=!0,N();for(var i=function(e,t){return e.then(function(e){t.resolve(e)},function(e){t.reject(e)})},o=0;o<n.length;o++){var a=n[o],s=a.onSuccess,l=a.onError,c=a.promise,u=void 0;if(t)try{u=s?s(this.value):this.value}catch(p){c.reject(p);continue}else if(r){if(!l){c.reject(this.error);continue}try{u=l(this.error)}catch(p){c.reject(p);continue}}if(u instanceof e&&(u.resolved||u.rejected)){var d=u;d.resolved?c.resolve(d.value):c.reject(d.error),d.errorHandled=!0}else C(u)?u instanceof e&&(u.resolved||u.rejected)?u.resolved?c.resolve(u.value):c.reject(u.error):i(u,c):c.resolve(u)}n.length=0,this.dispatching=!1,P()}},t.then=function(t,r){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for success handler");if(r&&"function"!=typeof r&&!r.call)throw new Error("Promise.then expected a function for error handler");var n=new e;return this.handlers.push({promise:n,onSuccess:t,onError:r}),this.errorHandled=!0,this.dispatch(),n},t.catch=function(e){return this.then(void 0,e)},t.finally=function(t){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.finally expected a function");return this.then(function(r){return e.try(t).then(function(){return r})},function(r){return e.try(t).then(function(){throw r})})},t.timeout=function(e,t){var r=this;if(this.resolved||this.rejected)return this;var n=setTimeout(function(){r.resolved||r.rejected||r.reject(t||new Error("Promise timed out after "+e+"ms"))},e);return this.then(function(e){return clearTimeout(n),e})},t.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},t.lazy=function(){return this.errorHandled=!0,this},e.resolve=function(t){return t instanceof e?t:C(t)?new e(function(e,r){return t.then(e,r)}):(new e).resolve(t)},e.reject=function(t){return(new e).reject(t)},e.asyncReject=function(t){return(new e).asyncReject(t)},e.all=function(t){var r=new e,n=t.length,i=[].slice();if(!n)return r.resolve(i),r;for(var o=function(e,t,o){return t.then(function(t){i[e]=t,0==(n-=1)&&r.resolve(i)},function(e){o.reject(e)})},a=0;a<t.length;a++){var s=t[a];if(s instanceof e){if(s.resolved){i[a]=s.value,n-=1;continue}}else if(!C(s)){i[a]=s,n-=1;continue}o(a,e.resolve(s),r)}return 0===n&&r.resolve(i),r},e.hash=function(t){var r={},n=[],i=function(e){if(t.hasOwnProperty(e)){var i=t[e];C(i)?n.push(i.then(function(t){r[e]=t})):r[e]=i}};for(var o in t)i(o);return e.all(n).then(function(){return r})},e.map=function(t,r){return e.all(t.map(r))},e.onPossiblyUnhandledException=function(e){return t=e,A.push(t),{cancel:function(){A.splice(A.indexOf(t),1)}};var t},e.try=function(t,r,n){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.try expected a function");var i;N();try{i=t.apply(r,n||[])}catch(o){return P(),e.reject(o)}return P(),e.resolve(i)},e.delay=function(t){return new e(function(e){setTimeout(e,t)})},e.isPromise=function(t){return!!(t&&t instanceof e)||C(t)},e.flush=function(){return t=e,r=w=w||new t,k(),r;var t,r},e}();function F(e,t){for(var r=0;r<e.length;r++)try{if(e[r]===t)return r}catch(n){}return-1}var _,I=function(){function e(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var e=new WeakMap,t={};return Object.freeze(t),e.set(t,"__testvalue__"),"__testvalue__"===e.get(t)}catch(r){return!1}}())try{this.weakmap=new WeakMap}catch(e){}this.keys=[],this.values=[]}var t=e.prototype;return t._cleanupClosedWindows=function(){for(var e=this.weakmap,t=this.keys,r=0;r<t.length;r++){var n=t[r];if(S(n)&&b(n)){if(e)try{e.delete(n)}catch(i){}t.splice(r,1),this.values.splice(r,1),r-=1}}},t.isSafeToReadWrite=function(e){return!S(e)},t.set=function(e,t){if(!e)throw new Error("WeakMap expected key");var r=this.weakmap;if(r)try{r.set(e,t)}catch(l){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=this.name,i=e[n];return void(i&&i[0]===e?i[1]=t:Object.defineProperty(e,n,{value:[e,t],writable:!0}))}catch(l){}this._cleanupClosedWindows();var o=this.keys,a=this.values,s=F(o,e);-1===s?(o.push(e),a.push(t)):a[s]=t},t.get=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return t.get(e)}catch(i){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var r=e[this.name];return r&&r[0]===e?r[1]:void 0}catch(i){}this._cleanupClosedWindows();var n=F(this.keys,e);if(-1!==n)return this.values[n]},t.delete=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{t.delete(e)}catch(o){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var r=e[this.name];r&&r[0]===e&&(r[0]=r[1]=void 0)}catch(o){}this._cleanupClosedWindows();var n=this.keys,i=F(n,e);-1!==i&&(n.splice(i,1),this.values.splice(i,1))},t.has=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return!0}catch(n){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var r=e[this.name];return!(!r||r[0]!==e)}catch(n){}return this._cleanupClosedWindows(),-1!==F(this.keys,e)},t.getOrSet=function(e,t){if(this.has(e))return this.get(e);var r=t();return this.set(e,r),r},e}();function D(e){return e.name||e.__name__||e.displayName||"anonymous"}function U(e,t){try{delete e.name,e.name=t}catch(r){}return e.__name__=e.displayName=t,e}function L(){var e="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,function(){return e.charAt(Math.floor(Math.random()*e.length))})+"_"+function(e){if("function"==typeof btoa)return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(parseInt(t,16))})).replace(/[=]/g,"");if("undefined"!=typeof Buffer)return Buffer.from(e,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function B(e){try{return JSON.stringify([].slice.call(e),function(e,t){return"function"==typeof t?"memoize["+function(e){if(_=_||new I,null==e||"object"!=typeof e&&"function"!=typeof e)throw new Error("Invalid object");var t=_.get(e);return t||(t=typeof e+":"+L(),_.set(e,t)),t}(t)+"]":"undefined"!=typeof window&&t instanceof window.Element||null!==t&&"object"==typeof t&&1===t.nodeType&&"object"==typeof t.style&&"object"==typeof t.ownerDocument?{}:t})}catch(t){throw new Error("Arguments not serializable -- can not be used to memoize")}}function M(){return{}}var W=0,j=0;function K(e,t){void 0===t&&(t={});var r,n,i=t.thisNamespace,o=void 0!==i&&i,a=t.time,s=W;W+=1;var l=function(){for(var t=arguments.length,i=new Array(t),l=0;l<t;l++)i[l]=arguments[l];var c,u;s<j&&(r=null,n=null,s=W,W+=1),c=o?(n=n||new I).getOrSet(this,M):r=r||{};try{u=B(i)}catch(f){return e.apply(this,arguments)}var d=c[u];if(d&&a&&Date.now()-d.time<a&&(delete c[u],d=null),d)return d.value;var p=Date.now(),h=e.apply(this,arguments);return c[u]={time:p,value:h},h};return l.reset=function(){r=null,n=null},U(l,(t.name||D(e))+"::memoized")}function H(e){var t={};function r(){for(var r=arguments,n=this,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];var s=B(o);return t.hasOwnProperty(s)||(t[s]=O.try(function(){return e.apply(n,r)}).finally(function(){delete t[s]})),t[s]}return r.reset=function(){t={}},U(r,D(e)+"::promiseMemoized")}function z(){}function X(e,t){if(void 0===t&&(t=1),t>=3)return"stringifyError stack overflow";try{if(!e)return"<unknown error: "+{}.toString.call(e)+">";if("string"==typeof e)return e;if(e instanceof Error){var r=e&&e.stack,n=e&&e.message;if(r&&n)return-1!==r.indexOf(n)?r:n+"\n"+r;if(r)return r;if(n)return n}return e&&e.toString&&"function"==typeof e.toString?e.toString():{}.toString.call(e)}catch(i){return"Error while stringifying error: "+X(i,t+1)}}function G(e){return"string"==typeof e?e:e.toString&&"function"==typeof e.toString?e.toString():{}.toString.call(e)}function Z(e){return"[object RegExp]"==={}.toString.call(e)}function Y(e,t,r){if(e.hasOwnProperty(t))return e[t];var n=r();return e[t]=n,n}function Q(){var e=document.body;if(!e)throw new Error("Body element not found");return e}function J(){return Boolean(document.body)&&"complete"===document.readyState}function $(){return Boolean(document.body)&&"interactive"===document.readyState}K.clear=function(){j=W},K(function(e){if(Object.values)return Object.values(e);var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t}),K(function(){return new O(function(e){if(J()||$())return e();var t=setInterval(function(){if(J()||$())return clearInterval(t),e()},10)})});var ee="undefined"!=typeof document?document.currentScript:null,te=K(function(){if(ee)return ee;if(ee=function(){try{var e=function(){try{throw new Error("_")}catch(e){return e.stack||""}}(),t=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(e),r=t&&t[1];if(!r)return;for(var n=0,i=[].slice.call(document.getElementsByTagName("script")).reverse();n<i.length;n++){var o=i[n];if(o.src&&o.src===r)return o}}catch(a){}}())return ee;throw new Error("Can not determine current script")}),re=L();function ne(e){void 0===e&&(e=window);var t="__post_robot_10_0_46__";return e!==window?e[t]:e[t]=e[t]||{}}K(function(){var e;try{e=te()}catch(n){return re}var t=e.getAttribute("data-uid");if(t&&"string"==typeof t)return t;if((t=e.getAttribute("data-uid-auto"))&&"string"==typeof t)return t;if(e.src){var r=function(e){for(var t="",r=0;r<e.length;r++){var n=e[r].charCodeAt(0)*r;e[r+1]&&(n+=e[r+1].charCodeAt(0)*(r-1)),t+=String.fromCharCode(97+Math.abs(n)%26)}return t}(JSON.stringify({src:e.src,dataset:e.dataset}));t="uid_"+r.slice(r.length-30)}else t=L();return e.setAttribute("data-uid-auto",t),t});var ie=function(){return{}};function oe(e,t){return void 0===e&&(e="store"),void 0===t&&(t=ie),Y(ne(),e,function(){var e=t();return{has:function(t){return e.hasOwnProperty(t)},get:function(t,r){return e.hasOwnProperty(t)?e[t]:r},set:function(t,r){return e[t]=r,r},del:function(t){delete e[t]},getOrSet:function(t,r){return Y(e,t,r)},reset:function(){e=t()},keys:function(){return Object.keys(e)}}})}var ae,se=function(){};function le(){var e=ne();return e.WINDOW_WILDCARD=e.WINDOW_WILDCARD||new se,e.WINDOW_WILDCARD}function ce(e,t){return void 0===e&&(e="store"),void 0===t&&(t=ie),oe("windowStore").getOrSet(e,function(){var r=new I,n=function(e){return r.getOrSet(e,t)};return{has:function(t){return n(t).hasOwnProperty(e)},get:function(t,r){var i=n(t);return i.hasOwnProperty(e)?i[e]:r},set:function(t,r){return n(t)[e]=r,r},del:function(t){delete n(t)[e]},getOrSet:function(t,r){return Y(n(t),e,r)}}})}function ue(){return oe("instance").getOrSet("instanceID",L)}function de(e,t){var r=t.domain,n=ce("helloPromises"),i=n.get(e);i&&i.resolve({domain:r});var o=O.resolve({domain:r});return n.set(e,o),o}function pe(e,t){return(0,t.send)(e,"postrobot_hello",{instanceID:ue()},{domain:"*",timeout:-1}).then(function(t){var r=t.origin,n=t.data.instanceID;return de(e,{domain:r}),{win:e,domain:r,instanceID:n}})}function he(e,t){var r=t.send;return ce("windowInstanceIDPromises").getOrSet(e,function(){return pe(e,{send:r}).then(function(e){return e.instanceID})})}function fe(e){ce("knownWindows").set(e,!0)}function ge(e){return"object"==typeof e&&null!==e&&"string"==typeof e.__type__}function me(e){return void 0===e?"undefined":null===e?"null":Array.isArray(e)?"array":"function"==typeof e?"function":"object"==typeof e?e instanceof Error?"error":"function"==typeof e.then?"promise":"[object RegExp]"==={}.toString.call(e)?"regex":"[object Date]"==={}.toString.call(e)?"date":"object":"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":void 0}function ve(e,t){return{__type__:e,__val__:t}}var ye,be=((ae={}).function=function(){},ae.error=function(e){return ve("error",{message:e.message,stack:e.stack,code:e.code,data:e.data})},ae.promise=function(){},ae.regex=function(e){return ve("regex",e.source)},ae.date=function(e){return ve("date",e.toJSON())},ae.array=function(e){return e},ae.object=function(e){return e},ae.string=function(e){return e},ae.number=function(e){return e},ae.boolean=function(e){return e},ae.null=function(e){return e},ae[void 0]=function(e){return ve("undefined",e)},ae),qe={},Ve=((ye={}).function=function(){throw new Error("Function serialization is not implemented; nothing to deserialize")},ye.error=function(e){var t=e.stack,r=e.code,n=e.data,i=new Error(e.message);return i.code=r,n&&(i.data=n),i.stack=t+"\n\n"+i.stack,i},ye.promise=function(){throw new Error("Promise serialization is not implemented; nothing to deserialize")},ye.regex=function(e){return new RegExp(e)},ye.date=function(e){return new Date(e)},ye.array=function(e){return e},ye.object=function(e){return e},ye.string=function(e){return e},ye.number=function(e){return e},ye.boolean=function(e){return e},ye.null=function(e){return e},ye[void 0]=function(){},ye),Se={};function Ee(){for(var e=oe("idToProxyWindow"),t=0,r=e.keys();t<r.length;t++){var n=r[t];e.get(n).shouldClean()&&e.del(n)}}function xe(e,t){var r=t.send,n=t.id,i=void 0===n?L():n,o=e.then(function(e){if(h(e))return f(e).name}),a=e.then(function(e){if(b(e))throw new Error("Window is closed, can not determine type");return c(e)?"popup":"iframe"});o.catch(z),a.catch(z);var s=function(){return e.then(function(e){if(!b(e))return h(e)?f(e).name:o})};return{id:i,getType:function(){return a},getInstanceID:H(function(){return e.then(function(e){return he(e,{send:r})})}),close:function(){return e.then(x)},getName:s,focus:function(){return e.then(function(e){e.focus()})},isClosed:function(){return e.then(function(e){return b(e)})},setLocation:function(t,r){return void 0===r&&(r={}),e.then(function(e){var n=window.location.protocol+"//"+window.location.host,i=r.method,o=void 0===i?"get":i,a=r.body;if(0===t.indexOf("/"))t=""+n+t;else if(!t.match(/^https?:\/\//)&&0!==t.indexOf(n))throw new Error("Expected url to be http or https url, or absolute path, got "+JSON.stringify(t));if("post"===o)return s().then(function(e){if(!e)throw new Error("Can not post to window without target name");!function(e){var t=e.url,r=e.target,n=e.body,i=e.method,o=void 0===i?"post":i,a=document.createElement("form");if(a.setAttribute("target",r),a.setAttribute("method",o),a.setAttribute("action",t),a.style.display="none",n)for(var s=0,l=Object.keys(n);s<l.length;s++){var c,u=l[s],d=document.createElement("input");d.setAttribute("name",u),d.setAttribute("value",null==(c=n[u])?void 0:c.toString()),a.appendChild(d)}Q().appendChild(a),a.submit(),Q().removeChild(a)}({url:t,target:e,method:o,body:a})});if("get"!==o)throw new Error("Unsupported method: "+o);if(h(e))try{if(e.location&&"function"==typeof e.location.replace)return void e.location.replace(t)}catch(l){}e.location=t})},setName:function(t){return e.then(function(e){var r=h(e),n=E(e);if(!r)throw new Error("Can not set name for cross-domain window: "+t);f(e).name=t,n&&n.setAttribute("name",t),o=O.resolve(t)})}}}new O(function(e){if(window.document&&window.document.body)return e(window.document.body);var t=setInterval(function(){if(window.document&&window.document.body)return clearInterval(t),e(window.document.body)},10)});var Ce=function(){function e(e){var t=e.send,r=e.win,n=e.serializedWindow;this.id=void 0,this.isProxyWindow=!0,this.serializedWindow=void 0,this.actualWindow=void 0,this.actualWindowPromise=void 0,this.send=void 0,this.name=void 0,this.actualWindowPromise=new O,this.serializedWindow=n||xe(this.actualWindowPromise,{send:t}),oe("idToProxyWindow").set(this.getID(),this),r&&this.setWindow(r,{send:t})}var t=e.prototype;return t.getID=function(){return this.serializedWindow.id},t.getType=function(){return this.serializedWindow.getType()},t.isPopup=function(){return this.getType().then(function(e){return"popup"===e})},t.setLocation=function(e,t){var r=this;return this.serializedWindow.setLocation(e,t).then(function(){return r})},t.getName=function(){return this.serializedWindow.getName()},t.setName=function(e){var t=this;return this.serializedWindow.setName(e).then(function(){return t})},t.close=function(){var e=this;return this.serializedWindow.close().then(function(){return e})},t.focus=function(){var e=this,t=this.isPopup(),r=this.getName(),n=O.hash({isPopup:t,name:r}).then(function(e){var t=e.name;e.isPopup&&t&&window.open("",t,"noopener")}),i=this.serializedWindow.focus();return O.all([n,i]).then(function(){return e})},t.isClosed=function(){return this.serializedWindow.isClosed()},t.getWindow=function(){return this.actualWindow},t.setWindow=function(e,t){var r=t.send;this.actualWindow=e,this.actualWindowPromise.resolve(this.actualWindow),this.serializedWindow=xe(this.actualWindowPromise,{send:r,id:this.getID()}),ce("winToProxyWindow").set(e,this)},t.awaitWindow=function(){return this.actualWindowPromise},t.matchWindow=function(e,t){var r=this,n=t.send;return O.try(function(){return r.actualWindow?e===r.actualWindow:O.hash({proxyInstanceID:r.getInstanceID(),knownWindowInstanceID:he(e,{send:n})}).then(function(t){var i=t.proxyInstanceID===t.knownWindowInstanceID;return i&&r.setWindow(e,{send:n}),i})})},t.unwrap=function(){return this.actualWindow||this},t.getInstanceID=function(){return this.serializedWindow.getInstanceID()},t.shouldClean=function(){return Boolean(this.actualWindow&&b(this.actualWindow))},t.serialize=function(){return this.serializedWindow},e.unwrap=function(t){return e.isProxyWindow(t)?t.unwrap():t},e.serialize=function(t,r){var n=r.send;return Ee(),e.toProxyWindow(t,{send:n}).serialize()},e.deserialize=function(t,r){var n=r.send;return Ee(),oe("idToProxyWindow").get(t.id)||new e({serializedWindow:t,send:n})},e.isProxyWindow=function(e){return Boolean(e&&!S(e)&&e.isProxyWindow)},e.toProxyWindow=function(t,r){var n=r.send;if(Ee(),e.isProxyWindow(t))return t;var i=t;return ce("winToProxyWindow").get(i)||new e({win:i,send:n})},e}();function we(e,t,r,n,i){var o=ce("methodStore"),a=oe("proxyWindowMethods");Ce.isProxyWindow(n)?a.set(e,{val:t,name:r,domain:i,source:n}):(a.del(e),o.getOrSet(n,function(){return{}})[e]={domain:i,name:r,val:t,source:n})}function Re(e,t){var r=ce("methodStore"),n=oe("proxyWindowMethods");return r.getOrSet(e,function(){return{}})[t]||n.get(t)}function Ae(e,t,r,n,i){var o,a,s;a=(o={on:i.on,send:i.send}).on,s=o.send,oe("builtinListeners").getOrSet("functionCalls",function(){return a("postrobot_method",{domain:"*"},function(e){var t=e.source,r=e.origin,n=e.data,i=n.id,o=n.name,a=Re(t,i);if(!a)throw new Error("Could not find method '"+o+"' with id: "+n.id+" in "+p(window));var l=a.source,c=a.domain,u=a.val;return O.try(function(){if(!V(c,r))throw new Error("Method '"+n.name+"' domain "+JSON.stringify(Z(a.domain)?a.domain.source:a.domain)+" does not match origin "+r+" in "+p(window));if(Ce.isProxyWindow(l))return l.matchWindow(t,{send:s}).then(function(e){if(!e)throw new Error("Method call '"+n.name+"' failed - proxy window does not match source in "+p(window))})}).then(function(){return u.apply({source:t,origin:r},n.args)},function(e){return O.try(function(){if(u.onError)return u.onError(e)}).then(function(){var t,r;throw e.stack&&(e.stack="Remote call to "+o+"("+(void 0===(t=n.args)&&(t=[]),(r=t,[].slice.call(r)).map(function(e){return"string"==typeof e?"'"+e+"'":void 0===e?"undefined":null===e?"null":"boolean"==typeof e?e.toString():Array.isArray(e)?"[ ... ]":"object"==typeof e?"{ ... }":"function"==typeof e?"() => { ... }":"<"+typeof e+">"}).join(", ")+") failed\n\n")+e.stack),e})}).then(function(e){return{result:e,id:i,name:o}})})});var l=r.__id__||L();e=Ce.unwrap(e);var c=r.__name__||r.name||n;return"string"==typeof c&&"function"==typeof c.indexOf&&0===c.indexOf("anonymous::")&&(c=c.replace("anonymous::",n+"::")),Ce.isProxyWindow(e)?(we(l,r,c,e,t),e.awaitWindow().then(function(e){we(l,r,c,e,t)})):we(l,r,c,e,t),ve("cross_domain_function",{id:l,name:c})}function Te(e,t,r,n){var i,o=n.on,a=n.send;return function(e,t){void 0===t&&(t=qe);var r=JSON.stringify(e,function(e){var r=this[e];if(ge(this))return r;var n=me(r);if(!n)return r;var i=t[n]||be[n];return i?i(r,e):r});return void 0===r?"undefined":r}(r,((i={}).promise=function(r,n){return i=r,ve("cross_domain_zalgo_promise",{then:Ae(e,t,function(e,t){return i.then(e,t)},n,{on:(s={on:o,send:a}).on,send:s.send})});var i,s},i.function=function(r,n){return Ae(e,t,r,n,{on:o,send:a})},i.object=function(e){return S(e)||Ce.isProxyWindow(e)?ve("cross_domain_window",Ce.serialize(e,{send:a})):e},i))}function ke(e,t,r,n){var i,o=n.send;return function(e,t){if(void 0===t&&(t=Se),"undefined"!==e)return JSON.parse(e,function(e,r){if(ge(this))return r;var n,i;if(ge(r)?(n=r.__type__,i=r.__val__):(n=me(r),i=r),!n)return i;var o=t[n]||Ve[n];return o?o(i,e):i})}(r,((i={}).cross_domain_zalgo_promise=function(e){return new O(e.then)},i.cross_domain_function=function(r){return n=e,i=t,s={send:o},l=(a=r).id,c=a.name,u=s.send,d=function(e){function t(){var r=arguments;return Ce.toProxyWindow(n,{send:u}).awaitWindow().then(function(n){var o=Re(n,l);if(o&&o.val!==t)return o.val.apply({source:window,origin:p()},r);var a=[].slice.call(r);return e.fireAndForget?u(n,"postrobot_method",{id:l,name:c,args:a},{domain:i,fireAndForget:!0}):u(n,"postrobot_method",{id:l,name:c,args:a},{domain:i,fireAndForget:!1}).then(function(e){return e.data.result})}).catch(function(e){throw e})}return void 0===e&&(e={}),t.__name__=c,t.__origin__=i,t.__source__=n,t.__id__=l,t.origin=i,t},(h=d()).fireAndForget=d({fireAndForget:!0}),h;var n,i,a,s,l,c,u,d,h},i.cross_domain_window=function(e){return Ce.deserialize(e,{send:o})},i))}var Ne={};function Pe(e,t,r,n){var i=n.on,o=n.send;return O.try(function(){var n=ce().getOrSet(e,function(){return{}});return n.buffer=n.buffer||[],n.buffer.push(r),n.flush=n.flush||O.flush().then(function(){if(b(e))throw new Error("Window is closed");var r,a=Te(e,t,((r={}).__post_robot_10_0_46__=n.buffer||[],r),{on:i,send:o});delete n.buffer;for(var s=Object.keys(Ne),l=[],c=0;c<s.length;c++){var u=s[c];try{Ne[u](e,a,t)}catch(d){l.push(d)}}if(l.length===s.length)throw new Error("All post-robot messaging strategies failed:\n\n"+l.map(function(e,t){return t+". "+X(e)}).join("\n\n"))}),n.flush.then(function(){delete n.flush})}).then(z)}function Oe(e){return oe("responseListeners").get(e)}function Fe(e){oe("responseListeners").del(e)}function _e(e){return oe("erroredResponseListeners").has(e)}function Ie(e){var t=e.name,r=e.win,n=e.domain,i=ce("requestListeners");if("*"===r&&(r=null),"*"===n&&(n=null),!t)throw new Error("Name required to get request listener");for(var o=0,a=[r,le()];o<a.length;o++){var s=a[o];if(s){var l=i.get(s);if(l){var c=l[t];if(c){if(n&&"string"==typeof n){if(c[n])return c[n];if(c.__domain_regex__)for(var u=0,d=c.__domain_regex__;u<d.length;u++){var p=d[u],h=p.listener;if(V(p.regex,n))return h}}if(c["*"])return c["*"]}}}}}function De(e,t,r,n){var i=n.on,o=n.send,a=Ie({name:r.name,win:e,domain:t}),s="postrobot_method"===r.name&&r.data&&"string"==typeof r.data.name?r.data.name+"()":r.name;function l(n,a,l){return O.flush().then(function(){if(!r.fireAndForget&&!b(e))try{return Pe(e,t,{id:L(),origin:p(window),type:"postrobot_message_response",hash:r.hash,name:r.name,ack:n,data:a,error:l},{on:i,send:o})}catch(c){throw new Error("Send response message failed for "+s+" in "+p()+"\n\n"+X(c))}})}return O.all([O.flush().then(function(){if(!r.fireAndForget&&!b(e))try{return Pe(e,t,{id:L(),origin:p(window),type:"postrobot_message_ack",hash:r.hash,name:r.name},{on:i,send:o})}catch(n){throw new Error("Send ack message failed for "+s+" in "+p()+"\n\n"+X(n))}}),O.try(function(){if(!a)throw new Error("No handler found for post message: "+r.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);return a.handler({source:e,origin:t,data:r.data})}).then(function(e){return l("success",e)},function(e){return l("error",null,e)})]).then(z).catch(function(e){if(a&&a.handleError)return a.handleError(e);throw e})}function Ue(e,t,r){if(!_e(r.hash)){var n=Oe(r.hash);if(!n)throw new Error("No handler found for post message ack for message: "+r.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);try{if(!V(n.domain,t))throw new Error("Ack origin "+t+" does not match domain "+n.domain.toString());if(e!==n.win)throw new Error("Ack source does not match registered window")}catch(i){n.promise.reject(i)}n.ack=!0}}function Le(e,t,r){if(!_e(r.hash)){var i,o=Oe(r.hash);if(!o)throw new Error("No handler found for post message response for message: "+r.name+" from "+t+" in "+window.location.protocol+"//"+window.location.host+window.location.pathname);if(!V(o.domain,t))throw new Error("Response origin "+t+" does not match domain "+(i=o.domain,Array.isArray(i)?"("+i.join(" | ")+")":n(i)?"RegExp("+i.toString()+")":i.toString()));if(e!==o.win)throw new Error("Response source does not match registered window");Fe(r.hash),"error"===r.ack?o.promise.reject(r.error):"success"===r.ack&&o.promise.resolve({source:e,origin:t,data:r.data})}}function Be(e,t){var r=t.on,n=t.send,i=oe("receivedMessages");try{if(!window||window.closed||!e.source)return}catch(u){return}var o=e.source,a=e.origin,s=function(e,t,r,n){var i,o=n.on,a=n.send;try{i=ke(t,r,e,{on:o,send:a})}catch(u){return}if(i&&"object"==typeof i&&null!==i){var s=i.__post_robot_10_0_46__;if(Array.isArray(s))return s}}(e.data,o,a,{on:r,send:n});if(s){fe(o);for(var l=0;l<s.length;l++){var c=s[l];if(i.has(c.id))return;if(i.set(c.id,!0),b(o)&&!c.fireAndForget)return;0===c.origin.indexOf("file:")&&(a="file://");try{"postrobot_message_request"===c.type?De(o,a,c,{on:r,send:n}):"postrobot_message_response"===c.type?Le(o,a,c):"postrobot_message_ack"===c.type&&Ue(o,a,c)}catch(u){setTimeout(function(){throw u},0)}}}}function Me(e,t,r){if(!e)throw new Error("Expected name");if("function"==typeof(t=t||{})&&(r=t,t={}),!r)throw new Error("Expected handler");var n=function e(t,r){var n=t.name,i=t.win,o=t.domain,a=ce("requestListeners");if(!n||"string"!=typeof n)throw new Error("Name required to add request listener");if(i&&"*"!==i&&Ce.isProxyWindow(i)){var s=i.awaitWindow().then(function(t){return e({name:n,win:t,domain:o},r)});return{cancel:function(){s.then(function(e){return e.cancel()},z)}}}var l=i;if(Array.isArray(l)){for(var c=[],u=0,d=l;u<d.length;u++)c.push(e({name:n,domain:o,win:d[u]},r));return{cancel:function(){for(var e=0;e<c.length;e++)c[e].cancel()}}}if(Array.isArray(o)){for(var p=[],h=0,f=o;h<f.length;h++)p.push(e({name:n,win:l,domain:f[h]},r));return{cancel:function(){for(var e=0;e<p.length;e++)p[e].cancel()}}}var g=Ie({name:n,win:l,domain:o});l&&"*"!==l||(l=le());var m=(o=o||"*").toString();if(g)throw l&&o?new Error("Request listener already exists for "+n+" on domain "+o.toString()+" for "+(l===le()?"wildcard":"specified")+" window"):l?new Error("Request listener already exists for "+n+" for "+(l===le()?"wildcard":"specified")+" window"):o?new Error("Request listener already exists for "+n+" on domain "+o.toString()):new Error("Request listener already exists for "+n);var v,y,b=a.getOrSet(l,function(){return{}}),q=Y(b,n,function(){return{}});return Z(o)?(v=Y(q,"__domain_regex__",function(){return[]})).push(y={regex:o,listener:r}):q[m]=r,{cancel:function(){delete q[m],y&&(v.splice(v.indexOf(y,1)),v.length||delete q.__domain_regex__),Object.keys(q).length||delete b[n],l&&!Object.keys(b).length&&a.del(l)}}}({name:e,win:t.window,domain:t.domain||"*"},{handler:r||t.handler,handleError:t.errorHandler||function(e){throw e}});return{cancel:function(){n.cancel()}}}function We(e,t,r){"function"==typeof(t=t||{})&&(r=t,t={});var n,i=new O;return t.errorHandler=function(e){n.cancel(),i.reject(e)},n=Me(e,t,function(e){if(n.cancel(),i.resolve(e),r)return r(e)}),i.cancel=n.cancel,i}Ne.postrobot_post_message=function(e,t,r){0===r.indexOf("file:")&&(r="*"),e.postMessage(t,r)};var je=function e(t,r,n,i){var o=(i=i||{}).domain||"*",a=i.timeout||-1,s=i.timeout||5e3,c=i.fireAndForget||!1;return Ce.toProxyWindow(t,{send:e}).awaitWindow().then(function(t){return O.try(function(){if(function(e,t,r){if(!e)throw new Error("Expected name");if("string"!=typeof r&&!Array.isArray(r)&&!Z(r))throw new TypeError("Can not send "+e+". Expected domain "+JSON.stringify(r)+" to be a string, array, or regex");if(b(t))throw new Error("Can not send "+e+". Target window is closed")}(r,t,o),function(e,t){var r=q(t);if(r)return r===e;if(t===e)return!1;if(function(e){void 0===e&&(e=window);try{if(e.top)return e.top}catch(i){}if(l(e)===e)return e;try{if(g(window,e)&&window.top)return window.top}catch(i){}try{if(g(e,window)&&window.top)return window.top}catch(i){}for(var t=0,r=function e(t){for(var r=[],n=0,i=m(t);n<i.length;n++){var o=i[n];r.push(o);for(var a=0,s=e(o);a<s.length;a++)r.push(s[a])}return r}(e);t<r.length;t++){var n=r[t];try{if(n.top)return n.top}catch(i){}if(l(n)===n)return n}}(t)===t)return!1;for(var n=0,i=m(e);n<i.length;n++)if(i[n]===t)return!0;return!1}(window,t))return function(e,t,r){void 0===t&&(t=5e3),void 0===r&&(r="Window");var n,i=(n=e,ce("helloPromises").getOrSet(n,function(){return new O}));return-1!==t&&(i=i.timeout(t,new Error(r+" did not load after "+t+"ms"))),i}(t,s)}).then(function(r){return n=t,i=o,a=(void 0===r?{}:r).domain,s={send:e}.send,O.try(function(){return"string"==typeof i?i:O.try(function(){return a||pe(n,{send:s}).then(function(e){return e.domain})}).then(function(e){if(!V(i,i))throw new Error("Domain "+G(i)+" does not match "+G(i));return e})});var n,i,a,s}).then(function(i){var o,s,l,u,d=i,h="postrobot_method"===r&&n&&"string"==typeof n.name?n.name+"()":r,f=new O,g=r+"_"+L();if(!c){var m={name:r,win:t,domain:d,promise:f};l=g,u=m,oe("responseListeners").set(l,u);var v=ce("requestPromises").getOrSet(t,function(){return[]});v.push(f),f.catch(function(){!function(e){oe("erroredResponseListeners").set(e,!0)}(g),Fe(g)});var y=(s=t,ce("knownWindows").get(s,!1)?1e4:2e3),q=a,V=y,S=q,E=(function e(){o=setTimeout(function(){b(t)?f.reject(new Error("Window closed for "+r+" before "+(m.ack?"response":"ack"))):m.cancelled?f.reject(new Error("Response listener was cancelled for "+r)):(V=Math.max(V-500,0),-1!==S&&(S=Math.max(S-500,0)),m.ack||0!==V?0===S&&f.reject(new Error("No response for postMessage "+h+" in "+p()+" in "+q+"ms")):f.reject(new Error("No ack for postMessage "+h+" in "+p()+" in "+y+"ms"))),e()},500)}(),{cancel:function(){clearTimeout(o)}});f.finally(function(){E.cancel(),v.splice(v.indexOf(f,1))}).catch(z)}return Pe(t,d,{id:L(),origin:p(window),type:"postrobot_message_request",hash:g,name:r,data:n,fireAndForget:c},{on:Me,send:e}).then(function(){return c?f.resolve():f},function(e){throw new Error("Send request message failed for "+h+" in "+p()+"\n\n"+X(e))})})})};function Ke(e,t,r){return Te(e,t,r,{on:Me,send:je})}function He(e,t,r){return ke(e,t,r,{send:je})}function ze(e){return new Ce({send:je,win:e})}function Xe(e){return Ce.toProxyWindow(e,{send:je})}function Ge(){var e,t,r,n,i,o,a;ne().initialized||(ne().initialized=!0,i=(n={on:Me,send:je}).on,o=n.send,(a=ne()).receiveMessage=a.receiveMessage||function(e){return Be(e,{on:i,send:o})},t=(e={on:Me,send:je}).on,r=e.send,oe().getOrSet("postMessageListener",function(){return e=window,n=function(e){var n,i,o,a;n=e,o=(i={on:t,send:r}).on,a=i.send,O.try(function(){var e=n.source||n.sourceElement,t=n.origin||n.originalEvent&&n.originalEvent.origin,r=n.data;if("null"===t&&(t="file://"),e){if(!t)throw new Error("Post message did not have origin domain");Be({source:e,origin:t,data:r},{on:o,send:a})}})},e.addEventListener("message",n),{cancel:function(){e.removeEventListener("message",n)}};var e,n}),function(e){var t=e.on,r=e.send;oe("builtinListeners").getOrSet("helloListener",function(){var e=t("postrobot_hello",{domain:"*"},function(e){return de(e.source,{domain:e.origin}),{instanceID:ue()}}),n=q();return n&&pe(n,{send:r}).catch(function(e){}),e})}({on:Me,send:je}))}function Ze(){var e;!function(){for(var e=oe("responseListeners"),t=0,r=e.keys();t<r.length;t++){var n=r[t],i=e.get(n);i&&(i.cancelled=!0),e.del(n)}}(),(e=oe().get("postMessageListener"))&&e.cancel(),delete window.__post_robot_10_0_46__}var Ye=!0;function Qe(e){for(var t=0,r=ce("requestPromises").get(e,[]);t<r.length;t++)r[t].reject(new Error("Window "+(b(e)?"closed":"cleaned up")+" before response")).catch(z)}Ge()}])}(postRobot$1);var postRobotExports$1=postRobot$1.exports;!function(e){e.exports=postRobotExports$1,e.exports.default=e.exports}(postRobot$2);var postRobotExports=postRobot$2.exports;const postRobot=getDefaultExportFromCjs(postRobotExports),Preview=e=>{const{data:t,buttonText:r,codeTestURL:n=codeTestUrlStatic,codeplayerURL:i=codePlayerUrlStatic,toRunCodeQuestion:o}=e,{verifyMode:a="",content:s="",topic:l,example:c,lang:u,cases:d}=t;React.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const p=React.useRef(null);return jsxRuntimeExports.jsx("div",{className:"question-preview",children:jsxRuntimeExports.jsx("div",{className:"content",children:jsxRuntimeExports.jsx("div",{className:"preview-container",children:jsxRuntimeExports.jsx("div",{className:"preview",children:jsxRuntimeExports.jsxs("div",{className:"preview-content",children:[jsxRuntimeExports.jsx(QuestionHeader,{score:t.score,type:t.type,difficulty:t.difficulty,currentIndex:null==t?void 0:t.currentIndex,questionsCount:null==t?void 0:t.questionsCount}),l&&jsxRuntimeExports.jsx("div",{className:"topic",children:l}),s.trim()?jsxRuntimeExports.jsx(RichEditor,{editorHeight:"fit-content",readOnly:!0,isBorder:!1,defaultValue:s,noPadding:!0}):jsxRuntimeExports.jsx("p",{}),jsxRuntimeExports.jsx(Button$1,{className:"submitBtn",onClick:()=>{if(o)o();else if(a===CCMVerifyMode.INPUT_OUTPUT){const e=window.open(n),t=null==d?void 0:d.map(({input:e,output:t})=>Array.isArray(e)?{input:e,output:t}:{input:[e],output:t});postRobot.send(e,"send",{title:l,content:s,initCode:c,code:c,lang:null==u?void 0:u.toLocaleLowerCase(),cases:t,submitCases:t,noSubmit:!0,aiEnabled:!0})}else{const e=window.open(`${i}`),r=()=>{let r=[c];if("html"===t.lang&&c)try{const e=JSON.parse(c);r=[e.html??"",e.css??"",e.js??""]}catch(n){}postRobot.send(e,"send",{title:l,content:s,lang:null==u?void 0:u.toLocaleLowerCase(),code:r,aiEnabled:!0,run:!1,dark:!0})};r(),postRobot.on("refresh",{window:e},async function(){p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{(null==e?void 0:e.closed)||r()},500)}),postRobot.on("change",{window:e},e=>{})}},type:"primary",style:{minWidth:"88px"},children:r||"去答题"})]})})})})})},{TextArea:TextArea}=Input,Completion=e=>{const{status:t,data:r,onSubmit:n,buttonText:i,onNextQuestion:o}=e,{answerOption:a,userAnswer:s,topic:l}=r,[c,u]=React.useState([]),[d,p]=React.useState(),[h,f]=React.useState(!1),g=e=>{if(m&&!e)return void staticMethods.warning("请先进行填空!");if(h&&!e)return void(null==o||o());const t=e||c,r=null==a?void 0:a.every((e,r)=>{var n;return(null==e?void 0:e.answer)===(null==(n=t[r])?void 0:n.answer)});p(r),f(!0),!e&&(null==n||n(t))},m=React.useMemo(()=>c.every(e=>!(null==e?void 0:e.answer)),[c]);return React.useEffect(()=>{let e;"string"==typeof s&&(e=tryParseJSON(s));const r=(e||s||a||[]).map(e=>({answer:t===QuestionStatus.ADD||s?null==e?void 0:e.answer:void 0}))??[];u(r),s&&g(r)},[t,s,a]),jsxRuntimeExports.jsxs("div",{className:"completion",children:[jsxRuntimeExports.jsx("div",{className:"completion-title",children:jsxRuntimeExports.jsxs("div",{className:"completion-title-content",children:[jsxRuntimeExports.jsx(QuestionHeader,{score:r.score,type:r.type,difficulty:r.difficulty,currentIndex:null==r?void 0:r.currentIndex,questionsCount:null==r?void 0:r.questionsCount}),jsxRuntimeExports.jsx(RichEditor,{isBorder:!1,defaultValue:l.indexOf("<code")>-1?l.replace(/<code[^>]*>|<\/code>/g,""):l,readOnly:!0,autoHeight:{min:0,max:1e5},noPadding:!0})]})}),jsxRuntimeExports.jsx("div",{className:"completion-content",children:null==c?void 0:c.map((e,r)=>{var n,i,o;return jsxRuntimeExports.jsxs("div",{className:"item-warpper",children:[jsxRuntimeExports.jsxs("div",{className:"completion-content-item",children:[jsxRuntimeExports.jsxs("span",{children:["填空",r+1]}),jsxRuntimeExports.jsx(TextArea,{style:{resize:"none"},placeholder:t===QuestionStatus.EXAM||t===QuestionStatus.PREVIEW?"请输入答案":"",disabled:t===QuestionStatus.ADD||h,autoSize:{maxRows:3},value:null==e?void 0:e.answer,onChange:e=>((e,t)=>{p(void 0),f(!1);const r=e.target.value,n=[...c];n[t].answer=r,u(n)})(e,r)})]}),h&&jsxRuntimeExports.jsx("div",{className:"item-result "+((null==e?void 0:e.answer)===(null==(n=a[r])?void 0:n.answer)?"right":"error"),children:(null==e?void 0:e.answer)===(null==(i=a[r])?void 0:i.answer)?jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx(RefIcon$x,{})," 正确"]}):jsxRuntimeExports.jsxs("span",{children:[jsxRuntimeExports.jsx(RefIcon$w,{})," 错误, ",jsxRuntimeExports.jsxs("span",{className:"answer",children:["正确答案:",null==(o=a[r])?void 0:o.answer]})]})})]},String(r))})}),n&&jsxRuntimeExports.jsx("div",{className:"submit-btn",children:jsxRuntimeExports.jsx(Button$1,{type:"primary",onClick:()=>g(),children:i||(h?"下一题":"提交")})})]})},AnswerQuestion=e=>{const{status:t=QuestionStatus.EXAM,data:r,onSubmit:n,buttonText:i,onNextQuestion:o}=e,[a,s]=React.useState(),[l,c]=React.useState(!1),u=React.useRef(null);React.useEffect(()=>{r.userAnswer&&(s(r.userAnswer),d(r.userAnswer))},[r]);const d=e=>{if(l&&!e)return void(null==o||o());const t=e||a;t?(c(!0),!e&&n&&n(t)):staticMethods.warning("请输入答案!")},p=[];return[QuestionStatus.ADD,QuestionStatus.MARK].includes(t)&&r&&(r.answer&&p.push({key:"1",label:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("span",{style:{fontWeight:"bold"},children:"参考答案"}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",color:"#999999"},children:"(学生不可见)"})]}),children:jsxRuntimeExports.jsx(RichEditor,{readOnly:!0,isBorder:!1,defaultValue:r.answer,autoHeight:{min:0,max:1e4}})}),r.judgeNorm&&p.push({key:"2",label:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("span",{style:{fontWeight:"bold"},children:"判分标准"}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",color:"#999999"},children:"(学生不可见)"})]}),children:jsxRuntimeExports.jsx(RichEditor,{readOnly:!0,defaultValue:r.judgeNorm,isBorder:!1,autoHeight:{min:0,max:1e4}})})),jsxRuntimeExports.jsxs("div",{className:"essay-question",children:[jsxRuntimeExports.jsx("div",{className:"essay-question-title",children:jsxRuntimeExports.jsxs("div",{className:"essay-question-title-content",children:[jsxRuntimeExports.jsx(QuestionHeader,{score:r.score,type:r.type,difficulty:r.difficulty,currentIndex:null==r?void 0:r.currentIndex,questionsCount:null==r?void 0:r.questionsCount}),jsxRuntimeExports.jsx(RichEditor,{defaultValue:null==r?void 0:r.topic,readOnly:!0,isBorder:!1,autoHeight:{min:0,max:1e5},noPadding:!0})]})}),jsxRuntimeExports.jsxs("div",{className:"essay-question-content",children:[[QuestionStatus.MARK,QuestionStatus.VIEW,QuestionStatus.EXAM,QuestionStatus.PREVIEW].includes(t)&&jsxRuntimeExports.jsx(RichEditor,{ref:u,readOnly:t===QuestionStatus.ADD||t===QuestionStatus.MARK||t===QuestionStatus.VIEW,editorHeight:220,defaultValue:(null==r?void 0:r.userAnswer)||"",placeholder:t===QuestionStatus.EXAM||t===QuestionStatus.PREVIEW?"请输入回答":"",onChange:e=>{s(e)},customToolbarKeys:["undo","redo","fullScreen","|","headerSelect","bold",{key:"group-image",title:"图片",iconSvg:'<svg viewBox="0 0 1024 1024"><path d="M959.877 128l0.123 0.123v767.775l-0.123 0.122H64.102l-0.122-0.122V128.123l0.122-0.123h895.775zM960 64H64C28.795 64 0 92.795 0 128v768c0 35.205 28.795 64 64 64h896c35.205 0 64-28.795 64-64V128c0-35.205-28.795-64-64-64zM832 288.01c0 53.023-42.988 96.01-96.01 96.01s-96.01-42.987-96.01-96.01S682.967 192 735.99 192 832 234.988 832 288.01zM896 832H128V704l224.01-384 256 320h64l224.01-192z"></path></svg>',menuKeys:["insertImage","uploadImage"]},"insertTable"],uploadImageLimit:e=>e.size>3145728&&(staticMethods.destroy(),staticMethods.warning("仅能上传大小为3MB内的图片噢~"),!0)}),[QuestionStatus.ADD,QuestionStatus.MARK].includes(t)&&jsxRuntimeExports.jsx(Collapse,{defaultActiveKey:t===QuestionStatus.ADD?["1","2"].filter(e=>!("1"===e&&!(null==r?void 0:r.answer))&&!("2"===e&&!(null==r?void 0:r.judgeNorm))):[],ghost:!0,expandIcon:({isActive:e})=>jsxRuntimeExports.jsx(RefIcon$i,{rotate:e?90:0}),items:p})]}),n&&jsxRuntimeExports.jsx("div",{className:"submit-btn",children:jsxRuntimeExports.jsx(Button$1,{type:"primary",onClick:()=>d(),children:i||l?"下一题":"提交"})})]})};"object"==typeof window&&window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),"undefined"!=typeof window&&[Element.prototype,Document.prototype,DocumentFragment.prototype].forEach(e=>{Object.prototype.hasOwnProperty.call(e,"append")||Object.defineProperty(e,"append",{configurable:!0,enumerable:!0,writable:!0,value(...e){const t=document.createDocumentFragment();e.forEach(e=>{const r=e instanceof Node;t.appendChild(r?e:document.createTextNode(String(e)))}),this.appendChild(t)}})});class Disposable{get disposed(){return!0===this._disposed}dispose(){this._disposed=!0}}var Disposable2,DisposableSet2;Disposable2=Disposable||(Disposable={}),Disposable2.dispose=function(){return(e,t,r)=>{const n=r.value,i=e.__proto__;r.value=function(...e){this.disposed||(n.call(this,...e),i.dispose.call(this))}}};class DisposableSet{constructor(){this.isDisposed=!1,this.items=new Set}get disposed(){return this.isDisposed}dispose(){this.isDisposed||(this.isDisposed=!0,this.items.forEach(e=>{e.dispose()}),this.items.clear())}contains(e){return this.items.has(e)}add(e){this.items.add(e)}remove(e){this.items.delete(e)}clear(){this.items.clear()}}DisposableSet2=DisposableSet||(DisposableSet={}),DisposableSet2.from=function(e){const t=new DisposableSet2;return e.forEach(e=>{t.add(e)}),t};var freeGlobal="object"==typeof global&&global&&global.Object===Object&&global,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),Symbol$1=root.Symbol,objectProto$j=Object.prototype,hasOwnProperty$i=objectProto$j.hasOwnProperty,nativeObjectToString$1=objectProto$j.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty$i.call(e,symToStringTag$1),r=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var n=!0}catch(e10){}var i=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),i}var objectProto$i=Object.prototype,nativeObjectToString=objectProto$i.toString;function objectToString(e){return nativeObjectToString.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return null!=e&&"object"==typeof e}var symbolTag$3="[object Symbol]";function isSymbol(e){return"symbol"==typeof e||isObjectLike(e)&&baseGetTag(e)==symbolTag$3}function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var isArray=Array.isArray,symbolProto$2=Symbol$1?Symbol$1.prototype:void 0,symbolToString=symbolProto$2?symbolProto$2.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray(e))return arrayMap(e,baseToString)+"";if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}var reWhitespace=/\s/;function trimmedEndIndex(e){for(var t=e.length;t--&&reWhitespace.test(e.charAt(t)););return t}var reTrimStart=/^\s+/;function baseTrim(e){return e?e.slice(0,trimmedEndIndex(e)+1).replace(reTrimStart,""):e}function isObject(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var NAN=NaN,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;function toNumber(e){if("number"==typeof e)return e;if(isSymbol(e))return NAN;if(isObject(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=baseTrim(e);var r=reIsBinary.test(e);return r||reIsOctal.test(e)?freeParseInt(e.slice(2),r?2:8):reIsBadHex.test(e)?NAN:+e}function identity(e){return e}var asyncTag="[object AsyncFunction]",funcTag$2="[object Function]",genTag$1="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject(e))return!1;var t=baseGetTag(e);return t==funcTag$2||t==genTag$1||t==asyncTag||t==proxyTag}var coreJsData=root["__core-js_shared__"],maskSrcKey=(uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||""),uid?"Symbol(src)_1."+uid:""),uid;function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource(e){if(null!=e){try{return funcToString$2.call(e)}catch(e10){}try{return e+""}catch(e10){}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$h=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$h=objectProto$h.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$h).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}function getValue(e,t){return null==e?void 0:e[t]}function getNative(e,t){var r=getValue(e,t);return baseIsNative(r)?r:void 0}var WeakMap$1=getNative(root,"WeakMap"),objectCreate=Object.create,baseCreate=function(){function e(){}return function(t){if(!isObject(t))return{};if(objectCreate)return objectCreate(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function apply$1(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function noop$2(){}function copyArray(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var HOT_COUNT=800,HOT_SPAN=16,nativeNow=Date.now;function shortOut(e){var t=0,r=0;return function(){var n=nativeNow(),i=HOT_SPAN-(n-r);if(r=n,i>0){if(++t>=HOT_COUNT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function constant(e){return function(){return e}}var defineProperty=function(){try{var e=getNative(Object,"defineProperty");return e({},"",{}),e}catch(e10){}}(),baseSetToString=defineProperty?function(e,t){return defineProperty(e,"toString",{configurable:!0,enumerable:!1,value:constant(t),writable:!0})}:identity,setToString=shortOut(baseSetToString);function arrayEach(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function baseFindIndex(e,t,r,n){for(var i=e.length,o=r+-1;++o<i;)if(t(e[o],o,e))return o;return-1}function baseIsNaN(e){return e!=e}function strictIndexOf(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}function baseIndexOf(e,t,r){return t==t?strictIndexOf(e,t,r):baseFindIndex(e,baseIsNaN,r)}function arrayIncludes(e,t){return!!(null==e?0:e.length)&&baseIndexOf(e,t,0)>-1}var MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(e,t){var r=typeof e;return!!(t=null==t?MAX_SAFE_INTEGER$1:t)&&("number"==r||"symbol"!=r&&reIsUint.test(e))&&e>-1&&e%1==0&&e<t}function baseAssignValue(e,t,r){"__proto__"==t&&defineProperty?defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function eq(e,t){return e===t||e!=e&&t!=t}var objectProto$g=Object.prototype,hasOwnProperty$g=objectProto$g.hasOwnProperty;function assignValue(e,t,r){var n=e[t];hasOwnProperty$g.call(e,t)&&eq(n,r)&&(void 0!==r||t in e)||baseAssignValue(e,t,r)}function copyObject(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],l=void 0;void 0===l&&(l=e[s]),i?baseAssignValue(r,s,l):assignValue(r,s,l)}return r}var nativeMax$1=Math.max;function overRest(e,t,r){return t=nativeMax$1(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=nativeMax$1(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),apply$1(e,this,s)}}function baseRest(e,t){return setToString(overRest(e,t,identity),e+"")}var MAX_SAFE_INTEGER=9007199254740991;function isLength(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=MAX_SAFE_INTEGER}function isArrayLike(e){return null!=e&&isLength(e.length)&&!isFunction(e)}function isIterateeCall(e,t,r){if(!isObject(r))return!1;var n=typeof t;return!!("number"==n?isArrayLike(r)&&isIndex(t,r.length):"string"==n&&t in r)&&eq(r[t],e)}function createAssigner(e){return baseRest(function(t,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,a&&isIterateeCall(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,o)}return t})}var objectProto$f=Object.prototype;function isPrototype(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||objectProto$f)}function baseTimes(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var argsTag$3="[object Arguments]";function baseIsArguments(e){return isObjectLike(e)&&baseGetTag(e)==argsTag$3}var objectProto$e=Object.prototype,hasOwnProperty$f=objectProto$e.hasOwnProperty,propertyIsEnumerable$1=objectProto$e.propertyIsEnumerable,isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&hasOwnProperty$f.call(e,"callee")&&!propertyIsEnumerable$1.call(e,"callee")};function stubFalse(){return!1}var freeExports$2="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule$2=freeExports$2&&"object"==typeof module&&module&&!module.nodeType&&module,moduleExports$2=freeModule$2&&freeModule$2.exports===freeExports$2,Buffer$2=moduleExports$2?root.Buffer:void 0,nativeIsBuffer=Buffer$2?Buffer$2.isBuffer:void 0,isBuffer=nativeIsBuffer||stubFalse,argsTag$2="[object Arguments]",arrayTag$2="[object Array]",boolTag$3="[object Boolean]",dateTag$3="[object Date]",errorTag$2="[object Error]",funcTag$1="[object Function]",mapTag$6="[object Map]",numberTag$4="[object Number]",objectTag$4="[object Object]",regexpTag$3="[object RegExp]",setTag$6="[object Set]",stringTag$3="[object String]",weakMapTag$2="[object WeakMap]",arrayBufferTag$3="[object ArrayBuffer]",dataViewTag$4="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};function baseIsTypedArray(e){return isObjectLike(e)&&isLength(e.length)&&!!typedArrayTags[baseGetTag(e)]}function baseUnary(e){return function(t){return e(t)}}typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0,typedArrayTags[argsTag$2]=typedArrayTags[arrayTag$2]=typedArrayTags[arrayBufferTag$3]=typedArrayTags[boolTag$3]=typedArrayTags[dataViewTag$4]=typedArrayTags[dateTag$3]=typedArrayTags[errorTag$2]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag$6]=typedArrayTags[numberTag$4]=typedArrayTags[objectTag$4]=typedArrayTags[regexpTag$3]=typedArrayTags[setTag$6]=typedArrayTags[stringTag$3]=typedArrayTags[weakMapTag$2]=!1;var freeExports$1="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&"object"==typeof module&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal.process,nodeUtil=function(){try{var e=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return e||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e10){}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$d=Object.prototype,hasOwnProperty$e=objectProto$d.hasOwnProperty;function arrayLikeKeys(e,t){var r=isArray(e),n=!r&&isArguments(e),i=!r&&!n&&isBuffer(e),o=!r&&!n&&!i&&isTypedArray(e),a=r||n||i||o,s=a?baseTimes(e.length,String):[],l=s.length;for(var c in e)!t&&!hasOwnProperty$e.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||isIndex(c,l))||s.push(c);return s}function overArg(e,t){return function(r){return e(t(r))}}var nativeKeys=overArg(Object.keys,Object),objectProto$c=Object.prototype,hasOwnProperty$d=objectProto$c.hasOwnProperty;function baseKeys(e){if(!isPrototype(e))return nativeKeys(e);var t=[];for(var r in Object(e))hasOwnProperty$d.call(e,r)&&"constructor"!=r&&t.push(r);return t}function keys(e){return isArrayLike(e)?arrayLikeKeys(e):baseKeys(e)}function nativeKeysIn(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}var objectProto$b=Object.prototype,hasOwnProperty$c=objectProto$b.hasOwnProperty;function baseKeysIn(e){if(!isObject(e))return nativeKeysIn(e);var t=isPrototype(e),r=[];for(var n in e)("constructor"!=n||!t&&hasOwnProperty$c.call(e,n))&&r.push(n);return r}function keysIn(e){return isArrayLike(e)?arrayLikeKeys(e,!0):baseKeysIn(e)}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,t){if(isArray(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var nativeCreate=getNative(Object,"create");function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{},this.size=0}function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var HASH_UNDEFINED$2="__lodash_hash_undefined__",objectProto$a=Object.prototype,hasOwnProperty$b=objectProto$a.hasOwnProperty;function hashGet(e){var t=this.__data__;if(nativeCreate){var r=t[e];return r===HASH_UNDEFINED$2?void 0:r}return hasOwnProperty$b.call(t,e)?t[e]:void 0}var objectProto$9=Object.prototype,hasOwnProperty$a=objectProto$9.hasOwnProperty;function hashHas(e){var t=this.__data__;return nativeCreate?void 0!==t[e]:hasOwnProperty$a.call(t,e)}var HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate&&void 0===t?HASH_UNDEFINED$1:t,this}function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[],this.size=0}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice.call(t,r,1),--this.size,!0)}function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?void 0:t[r][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map$1=getNative(root,"Map");function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}function isKeyable(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function getMapData(e,t){var r=e.__data__;return isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}function mapCacheDelete(e){var t=getMapData(this,e).delete(e);return this.size-=t?1:0,t}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT$2="Expected a function";function memoize$1(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT$2);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(memoize$1.Cache||MapCache),r}memoize$1.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var t=memoize$1(e,function(e){return r.size===MAX_MEMOIZE_SIZE&&r.clear(),e}),r=t.cache;return t}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rePropName,function(e,r,n,i){t.push(n?i.replace(reEscapeChar,"$1"):r||e)}),t});function toString(e){return null==e?"":baseToString(e)}function castPath(e,t){return isArray(e)?e:isKey(e,t)?[e]:stringToPath(toString(e))}function toKey(e){if("string"==typeof e||isSymbol(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function baseGet(e,t){for(var r=0,n=(t=castPath(t,e)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}function get(e,t,r){var n=null==e?void 0:baseGet(e,t);return void 0===n?r:n}function arrayPush(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var spreadableSymbol=Symbol$1?Symbol$1.isConcatSpreadable:void 0;function isFlattenable(e){return isArray(e)||isArguments(e)||!!(spreadableSymbol&&e&&e[spreadableSymbol])}function baseFlatten(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=isFlattenable),i||(i=[]);++o<a;){var s=e[o];r(s)?arrayPush(i,s):n||(i[i.length]=s)}return i}function flatten(e){return(null==e?0:e.length)?baseFlatten(e):[]}function flatRest(e){return setToString(overRest(e,void 0,flatten),e+"")}var getPrototype=overArg(Object.getPrototypeOf,Object),objectTag$3="[object Object]",funcProto=Function.prototype,objectProto$8=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$9=objectProto$8.hasOwnProperty,objectCtorString=funcToString.call(Object);function isPlainObject(e){if(!isObjectLike(e)||baseGetTag(e)!=objectTag$3)return!1;var t=getPrototype(e);if(null===t)return!0;var r=hasOwnProperty$9.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&funcToString.call(r)==objectCtorString}function baseSlice(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n<i;)o[n]=e[n+t];return o}function castSlice(e,t,r){var n=e.length;return r=void 0===r?n:r,!t&&r>=n?e:baseSlice(e,t,r)}var rsAstralRange$2="\\ud800-\\udfff",rsComboMarksRange$3="\\u0300-\\u036f",reComboHalfMarksRange$3="\\ufe20-\\ufe2f",rsComboSymbolsRange$3="\\u20d0-\\u20ff",rsComboRange$3=rsComboMarksRange$3+reComboHalfMarksRange$3+rsComboSymbolsRange$3,rsVarRange$2="\\ufe0e\\ufe0f",rsZWJ$2="\\u200d",reHasUnicode=RegExp("["+rsZWJ$2+rsAstralRange$2+rsComboRange$3+rsVarRange$2+"]");function hasUnicode(e){return reHasUnicode.test(e)}function asciiToArray(e){return e.split("")}var rsAstralRange$1="\\ud800-\\udfff",rsComboMarksRange$2="\\u0300-\\u036f",reComboHalfMarksRange$2="\\ufe20-\\ufe2f",rsComboSymbolsRange$2="\\u20d0-\\u20ff",rsComboRange$2=rsComboMarksRange$2+reComboHalfMarksRange$2+rsComboSymbolsRange$2,rsVarRange$1="\\ufe0e\\ufe0f",rsAstral="["+rsAstralRange$1+"]",rsCombo$2="["+rsComboRange$2+"]",rsFitz$1="\\ud83c[\\udffb-\\udfff]",rsModifier$1="(?:"+rsCombo$2+"|"+rsFitz$1+")",rsNonAstral$1="[^"+rsAstralRange$1+"]",rsRegional$1="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair$1="[\\ud800-\\udbff][\\udc00-\\udfff]",rsZWJ$1="\\u200d",reOptMod$1=rsModifier$1+"?",rsOptVar$1="["+rsVarRange$1+"]?",rsOptJoin$1="(?:"+rsZWJ$1+"(?:"+[rsNonAstral$1,rsRegional$1,rsSurrPair$1].join("|")+")"+rsOptVar$1+reOptMod$1+")*",rsSeq$1=rsOptVar$1+reOptMod$1+rsOptJoin$1,rsSymbol="(?:"+[rsNonAstral$1+rsCombo$2+"?",rsCombo$2,rsRegional$1,rsSurrPair$1,rsAstral].join("|")+")",reUnicode=RegExp(rsFitz$1+"(?="+rsFitz$1+")|"+rsSymbol+rsSeq$1,"g");function unicodeToArray(e){return e.match(reUnicode)||[]}function stringToArray$1(e){return hasUnicode(e)?unicodeToArray(e):asciiToArray(e)}function createCaseFirst(e){return function(t){var r=hasUnicode(t=toString(t))?stringToArray$1(t):void 0,n=r?r[0]:t.charAt(0),i=r?castSlice(r,1).join(""):t.slice(1);return n[e]()+i}}var upperFirst=createCaseFirst("toUpperCase");function capitalize(e){return upperFirst(toString(e).toLowerCase())}function arrayReduce(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;)r=t(r,e[i],i,e);return r}function basePropertyOf(e){return function(t){return null==e?void 0:e[t]}}var deburredLetters={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},deburrLetter=basePropertyOf(deburredLetters),reLatin=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,rsComboMarksRange$1="\\u0300-\\u036f",reComboHalfMarksRange$1="\\ufe20-\\ufe2f",rsComboSymbolsRange$1="\\u20d0-\\u20ff",rsComboRange$1=rsComboMarksRange$1+reComboHalfMarksRange$1+rsComboSymbolsRange$1,rsCombo$1="["+rsComboRange$1+"]",reComboMark=RegExp(rsCombo$1,"g");function deburr(e){return(e=toString(e))&&e.replace(reLatin,deburrLetter).replace(reComboMark,"")}var reAsciiWord=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function asciiWords(e){return e.match(reAsciiWord)||[]}var reHasUnicodeWord=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function hasUnicodeWord(e){return reHasUnicodeWord.test(e)}var rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f",reComboHalfMarksRange="\\ufe20-\\ufe2f",rsComboSymbolsRange="\\u20d0-\\u20ff",rsComboRange=rsComboMarksRange+reComboHalfMarksRange+rsComboSymbolsRange,rsDingbatRange="\\u2700-\\u27bf",rsLowerRange="a-z\\xdf-\\xf6\\xf8-\\xff",rsMathOpRange="\\xac\\xb1\\xd7\\xf7",rsNonCharRange="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",rsPunctuationRange="\\u2000-\\u206f",rsSpaceRange=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",rsUpperRange="A-Z\\xc0-\\xd6\\xd8-\\xde",rsVarRange="\\ufe0e\\ufe0f",rsBreakRange=rsMathOpRange+rsNonCharRange+rsPunctuationRange+rsSpaceRange,rsApos$1="['’]",rsBreak="["+rsBreakRange+"]",rsCombo="["+rsComboRange+"]",rsDigits="\\d+",rsDingbat="["+rsDingbatRange+"]",rsLower="["+rsLowerRange+"]",rsMisc="[^"+rsAstralRange+rsBreakRange+rsDigits+rsDingbatRange+rsLowerRange+rsUpperRange+"]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier="(?:"+rsCombo+"|"+rsFitz+")",rsNonAstral="[^"+rsAstralRange+"]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsUpper="["+rsUpperRange+"]",rsZWJ="\\u200d",rsMiscLower="(?:"+rsLower+"|"+rsMisc+")",rsMiscUpper="(?:"+rsUpper+"|"+rsMisc+")",rsOptContrLower="(?:"+rsApos$1+"(?:d|ll|m|re|s|t|ve))?",rsOptContrUpper="(?:"+rsApos$1+"(?:D|LL|M|RE|S|T|VE))?",reOptMod=rsModifier+"?",rsOptVar="["+rsVarRange+"]?",rsOptJoin="(?:"+rsZWJ+"(?:"+[rsNonAstral,rsRegional,rsSurrPair].join("|")+")"+rsOptVar+reOptMod+")*",rsOrdLower="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",rsOrdUpper="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",rsSeq=rsOptVar+reOptMod+rsOptJoin,rsEmoji="(?:"+[rsDingbat,rsRegional,rsSurrPair].join("|")+")"+rsSeq,reUnicodeWord=RegExp([rsUpper+"?"+rsLower+"+"+rsOptContrLower+"(?="+[rsBreak,rsUpper,"$"].join("|")+")",rsMiscUpper+"+"+rsOptContrUpper+"(?="+[rsBreak,rsUpper+rsMiscLower,"$"].join("|")+")",rsUpper+"?"+rsMiscLower+"+"+rsOptContrLower,rsUpper+"+"+rsOptContrUpper,rsOrdUpper,rsOrdLower,rsDigits,rsEmoji].join("|"),"g");function unicodeWords(e){return e.match(reUnicodeWord)||[]}function words(e,t,r){return e=toString(e),void 0===t?hasUnicodeWord(e)?unicodeWords(e):asciiWords(e):e.match(t)||[]}var rsApos="['’]",reApos=RegExp(rsApos,"g");function createCompounder(e){return function(t){return arrayReduce(words(deburr(t).replace(reApos,"")),e,"")}}var camelCase=createCompounder(function(e,t,r){return t=t.toLowerCase(),e+(r?capitalize(t):t)});function baseClamp(e,t,r){return e==e&&(void 0!==r&&(e=e<=r?e:r),void 0!==t&&(e=e>=t?e:t)),e}function clamp(e,t,r){return void 0===r&&(r=t,t=void 0),void 0!==r&&(r=(r=toNumber(r))==r?r:0),void 0!==t&&(t=(t=toNumber(t))==t?t:0),baseClamp(toNumber(e),t,r)}function stackClear(){this.__data__=new ListCache,this.size=0}function stackDelete(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function stackGet(e){return this.__data__.get(e)}function stackHas(e){return this.__data__.has(e)}var LARGE_ARRAY_SIZE$2=200;function stackSet(e,t){var r=this.__data__;if(r instanceof ListCache){var n=r.__data__;if(!Map$1||n.length<LARGE_ARRAY_SIZE$2-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new MapCache(n)}return r.set(e,t),this.size=r.size,this}function Stack(e){var t=this.__data__=new ListCache(e);this.size=t.size}function baseAssign(e,t){return e&&copyObject(t,keys(t),e)}function baseAssignIn(e,t){return e&&copyObject(t,keysIn(t),e)}Stack.prototype.clear=stackClear,Stack.prototype.delete=stackDelete,Stack.prototype.get=stackGet,Stack.prototype.has=stackHas,Stack.prototype.set=stackSet;var freeExports="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&"object"==typeof module&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer$1=moduleExports?root.Buffer:void 0,allocUnsafe=Buffer$1?Buffer$1.allocUnsafe:void 0;function cloneBuffer(e,t){if(t)return e.slice();var r=e.length,n=allocUnsafe?allocUnsafe(r):new e.constructor(r);return e.copy(n),n}function arrayFilter(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}function stubArray(){return[]}var objectProto$7=Object.prototype,propertyIsEnumerable=objectProto$7.propertyIsEnumerable,nativeGetSymbols$1=Object.getOwnPropertySymbols,getSymbols=nativeGetSymbols$1?function(e){return null==e?[]:(e=Object(e),arrayFilter(nativeGetSymbols$1(e),function(t){return propertyIsEnumerable.call(e,t)}))}:stubArray;function copySymbols(e,t){return copyObject(e,getSymbols(e),t)}var nativeGetSymbols=Object.getOwnPropertySymbols,getSymbolsIn=nativeGetSymbols?function(e){for(var t=[];e;)arrayPush(t,getSymbols(e)),e=getPrototype(e);return t}:stubArray;function copySymbolsIn(e,t){return copyObject(e,getSymbolsIn(e),t)}function baseGetAllKeys(e,t,r){var n=t(e);return isArray(e)?n:arrayPush(n,r(e))}function getAllKeys(e){return baseGetAllKeys(e,keys,getSymbols)}function getAllKeysIn(e){return baseGetAllKeys(e,keysIn,getSymbolsIn)}var DataView$1=getNative(root,"DataView"),Promise$1=getNative(root,"Promise"),Set$1=getNative(root,"Set"),mapTag$5="[object Map]",objectTag$2="[object Object]",promiseTag="[object Promise]",setTag$5="[object Set]",weakMapTag$1="[object WeakMap]",dataViewTag$3="[object DataView]",dataViewCtorString=toSource(DataView$1),mapCtorString=toSource(Map$1),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set$1),weakMapCtorString=toSource(WeakMap$1),getTag=baseGetTag;(DataView$1&&getTag(new DataView$1(new ArrayBuffer(1)))!=dataViewTag$3||Map$1&&getTag(new Map$1)!=mapTag$5||Promise$1&&getTag(Promise$1.resolve())!=promiseTag||Set$1&&getTag(new Set$1)!=setTag$5||WeakMap$1&&getTag(new WeakMap$1)!=weakMapTag$1)&&(getTag=function(e){var t=baseGetTag(e),r=t==objectTag$2?e.constructor:void 0,n=r?toSource(r):"";if(n)switch(n){case dataViewCtorString:return dataViewTag$3;case mapCtorString:return mapTag$5;case promiseCtorString:return promiseTag;case setCtorString:return setTag$5;case weakMapCtorString:return weakMapTag$1}return t});var objectProto$6=Object.prototype,hasOwnProperty$8=objectProto$6.hasOwnProperty;function initCloneArray(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&hasOwnProperty$8.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var Uint8Array$1=root.Uint8Array;function cloneArrayBuffer(e){var t=new e.constructor(e.byteLength);return new Uint8Array$1(t).set(new Uint8Array$1(e)),t}function cloneDataView(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var reFlags=/\w*$/;function cloneRegExp(e){var t=new e.constructor(e.source,reFlags.exec(e));return t.lastIndex=e.lastIndex,t}var symbolProto$1=Symbol$1?Symbol$1.prototype:void 0,symbolValueOf$1=symbolProto$1?symbolProto$1.valueOf:void 0;function cloneSymbol(e){return symbolValueOf$1?Object(symbolValueOf$1.call(e)):{}}function cloneTypedArray(e,t){var r=t?cloneArrayBuffer(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var boolTag$2="[object Boolean]",dateTag$2="[object Date]",mapTag$4="[object Map]",numberTag$3="[object Number]",regexpTag$2="[object RegExp]",setTag$4="[object Set]",stringTag$2="[object String]",symbolTag$2="[object Symbol]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$2="[object DataView]",float32Tag$1="[object Float32Array]",float64Tag$1="[object Float64Array]",int8Tag$1="[object Int8Array]",int16Tag$1="[object Int16Array]",int32Tag$1="[object Int32Array]",uint8Tag$1="[object Uint8Array]",uint8ClampedTag$1="[object Uint8ClampedArray]",uint16Tag$1="[object Uint16Array]",uint32Tag$1="[object Uint32Array]";function initCloneByTag(e,t,r){var n=e.constructor;switch(t){case arrayBufferTag$2:return cloneArrayBuffer(e);case boolTag$2:case dateTag$2:return new n(+e);case dataViewTag$2:return cloneDataView(e,r);case float32Tag$1:case float64Tag$1:case int8Tag$1:case int16Tag$1:case int32Tag$1:case uint8Tag$1:case uint8ClampedTag$1:case uint16Tag$1:case uint32Tag$1:return cloneTypedArray(e,r);case mapTag$4:return new n;case numberTag$3:case stringTag$2:return new n(e);case regexpTag$2:return cloneRegExp(e);case setTag$4:return new n;case symbolTag$2:return cloneSymbol(e)}}function initCloneObject(e){return"function"!=typeof e.constructor||isPrototype(e)?{}:baseCreate(getPrototype(e))}var mapTag$3="[object Map]";function baseIsMap(e){return isObjectLike(e)&&getTag(e)==mapTag$3}var nodeIsMap=nodeUtil&&nodeUtil.isMap,isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap,setTag$3="[object Set]";function baseIsSet(e){return isObjectLike(e)&&getTag(e)==setTag$3}var nodeIsSet=nodeUtil&&nodeUtil.isSet,isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet,CLONE_DEEP_FLAG$1=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG$2=4,argsTag$1="[object Arguments]",arrayTag$1="[object Array]",boolTag$1="[object Boolean]",dateTag$1="[object Date]",errorTag$1="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag$2="[object Map]",numberTag$2="[object Number]",objectTag$1="[object Object]",regexpTag$1="[object RegExp]",setTag$2="[object Set]",stringTag$1="[object String]",symbolTag$1="[object Symbol]",weakMapTag="[object WeakMap]",arrayBufferTag$1="[object ArrayBuffer]",dataViewTag$1="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",cloneableTags={};function baseClone(e,t,r,n,i,o){var a,s=t&CLONE_DEEP_FLAG$1,l=t&CLONE_FLAT_FLAG,c=t&CLONE_SYMBOLS_FLAG$2;if(void 0!==a)return a;if(!isObject(e))return e;var u=isArray(e);if(u){if(a=initCloneArray(e),!s)return copyArray(e,a)}else{var d=getTag(e),p=d==funcTag||d==genTag;if(isBuffer(e))return cloneBuffer(e,s);if(d==objectTag$1||d==argsTag$1||p&&!i){if(a=l||p?{}:initCloneObject(e),!s)return l?copySymbolsIn(e,baseAssignIn(a,e)):copySymbols(e,baseAssign(a,e))}else{if(!cloneableTags[d])return i?e:{};a=initCloneByTag(e,d,s)}}o||(o=new Stack);var h=o.get(e);if(h)return h;o.set(e,a),isSet(e)?e.forEach(function(n){a.add(baseClone(n,t,r,n,e,o))}):isMap(e)&&e.forEach(function(n,i){a.set(i,baseClone(n,t,r,i,e,o))});var f=u?void 0:(c?l?getAllKeysIn:getAllKeys:l?keysIn:keys)(e);return arrayEach(f||e,function(n,i){f&&(n=e[i=n]),assignValue(a,i,baseClone(n,t,r,i,e,o))}),a}cloneableTags[argsTag$1]=cloneableTags[arrayTag$1]=cloneableTags[arrayBufferTag$1]=cloneableTags[dataViewTag$1]=cloneableTags[boolTag$1]=cloneableTags[dateTag$1]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag$2]=cloneableTags[numberTag$2]=cloneableTags[objectTag$1]=cloneableTags[regexpTag$1]=cloneableTags[setTag$2]=cloneableTags[stringTag$1]=cloneableTags[symbolTag$1]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag$1]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=!1;var CLONE_SYMBOLS_FLAG$1=4;function clone(e){return baseClone(e,CLONE_SYMBOLS_FLAG$1)}var CLONE_DEEP_FLAG=1,CLONE_SYMBOLS_FLAG=4;function cloneDeep(e){return baseClone(e,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}var HASH_UNDEFINED="__lodash_hash_undefined__";function setCacheAdd(e){return this.__data__.set(e,HASH_UNDEFINED),this}function setCacheHas(e){return this.__data__.has(e)}function SetCache(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new MapCache;++t<r;)this.add(e[t])}function arraySome(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function cacheHas(e,t){return e.has(t)}SetCache.prototype.add=SetCache.prototype.push=setCacheAdd,SetCache.prototype.has=setCacheHas;var COMPARE_PARTIAL_FLAG$5=1,COMPARE_UNORDERED_FLAG$3=2;function equalArrays(e,t,r,n,i,o){var a=r&COMPARE_PARTIAL_FLAG$5,s=e.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var c=o.get(e),u=o.get(t);if(c&&u)return c==t&&u==e;var d=-1,p=!0,h=r&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(o.set(e,t),o.set(t,e);++d<s;){var f=e[d],g=t[d];if(n)var m=a?n(g,f,d,t,e,o):n(f,g,d,e,t,o);if(void 0!==m){if(m)continue;p=!1;break}if(h){if(!arraySome(t,function(e,t){if(!cacheHas(h,t)&&(f===e||i(f,e,r,n,o)))return h.push(t)})){p=!1;break}}else if(f!==g&&!i(f,g,r,n,o)){p=!1;break}}return o.delete(e),o.delete(t),p}function mapToArray(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function setToArray(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var COMPARE_PARTIAL_FLAG$4=1,COMPARE_UNORDERED_FLAG$2=2,boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",mapTag$1="[object Map]",numberTag$1="[object Number]",regexpTag="[object RegExp]",setTag$1="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",symbolProto=Symbol$1?Symbol$1.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0;function equalByTag(e,t,r,n,i,o,a){switch(r){case dataViewTag:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case arrayBufferTag:return!(e.byteLength!=t.byteLength||!o(new Uint8Array$1(e),new Uint8Array$1(t)));case boolTag:case dateTag:case numberTag$1:return eq(+e,+t);case errorTag:return e.name==t.name&&e.message==t.message;case regexpTag:case stringTag:return e==t+"";case mapTag$1:var s=mapToArray;case setTag$1:var l=n&COMPARE_PARTIAL_FLAG$4;if(s||(s=setToArray),e.size!=t.size&&!l)return!1;var c=a.get(e);if(c)return c==t;n|=COMPARE_UNORDERED_FLAG$2,a.set(e,t);var u=equalArrays(s(e),s(t),n,i,o,a);return a.delete(e),u;case symbolTag:if(symbolValueOf)return symbolValueOf.call(e)==symbolValueOf.call(t)}return!1}var COMPARE_PARTIAL_FLAG$3=1,objectProto$5=Object.prototype,hasOwnProperty$7=objectProto$5.hasOwnProperty;function equalObjects(e,t,r,n,i,o){var a=r&COMPARE_PARTIAL_FLAG$3,s=getAllKeys(e),l=s.length;if(l!=getAllKeys(t).length&&!a)return!1;for(var c=l;c--;){var u=s[c];if(!(a?u in t:hasOwnProperty$7.call(t,u)))return!1}var d=o.get(e),p=o.get(t);if(d&&p)return d==t&&p==e;var h=!0;o.set(e,t),o.set(t,e);for(var f=a;++c<l;){var g=e[u=s[c]],m=t[u];if(n)var v=a?n(m,g,u,t,e,o):n(g,m,u,e,t,o);if(!(void 0===v?g===m||i(g,m,r,n,o):v)){h=!1;break}f||(f="constructor"==u)}if(h&&!f){var y=e.constructor,b=t.constructor;y==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b||(h=!1)}return o.delete(e),o.delete(t),h}var COMPARE_PARTIAL_FLAG$2=1,argsTag="[object Arguments]",arrayTag="[object Array]",objectTag="[object Object]",objectProto$4=Object.prototype,hasOwnProperty$6=objectProto$4.hasOwnProperty;function baseIsEqualDeep(e,t,r,n,i,o){var a=isArray(e),s=isArray(t),l=a?arrayTag:getTag(e),c=s?arrayTag:getTag(t),u=(l=l==argsTag?objectTag:l)==objectTag,d=(c=c==argsTag?objectTag:c)==objectTag,p=l==c;if(p&&isBuffer(e)){if(!isBuffer(t))return!1;a=!0,u=!1}if(p&&!u)return o||(o=new Stack),a||isTypedArray(e)?equalArrays(e,t,r,n,i,o):equalByTag(e,t,l,r,n,i,o);if(!(r&COMPARE_PARTIAL_FLAG$2)){var h=u&&hasOwnProperty$6.call(e,"__wrapped__"),f=d&&hasOwnProperty$6.call(t,"__wrapped__");if(h||f){var g=h?e.value():e,m=f?t.value():t;return o||(o=new Stack),i(g,m,r,n,o)}}return!!p&&(o||(o=new Stack),equalObjects(e,t,r,n,i,o))}function baseIsEqual(e,t,r,n,i){return e===t||(null==e||null==t||!isObjectLike(e)&&!isObjectLike(t)?e!=e&&t!=t:baseIsEqualDeep(e,t,r,n,baseIsEqual,i))}var COMPARE_PARTIAL_FLAG$1=1,COMPARE_UNORDERED_FLAG$1=2;function baseIsMatch(e,t,r,n){var i=r.length,o=i;if(null==e)return!o;for(e=Object(e);i--;){var a=r[i];if(a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){var s=(a=r[i])[0],l=e[s],c=a[1];if(a[2]){if(void 0===l&&!(s in e))return!1}else{var u=new Stack;if(!baseIsEqual(c,l,COMPARE_PARTIAL_FLAG$1|COMPARE_UNORDERED_FLAG$1,n,u))return!1}}return!0}function isStrictComparable(e){return e==e&&!isObject(e)}function getMatchData(e){for(var t=keys(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,isStrictComparable(i)]}return t}function matchesStrictComparable(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}function baseMatches(e){var t=getMatchData(e);return 1==t.length&&t[0][2]?matchesStrictComparable(t[0][0],t[0][1]):function(r){return r===e||baseIsMatch(r,e,t)}}function baseHasIn(e,t){return null!=e&&t in Object(e)}function hasPath(e,t,r){for(var n=-1,i=(t=castPath(t,e)).length,o=!1;++n<i;){var a=toKey(t[n]);if(!(o=null!=e&&r(e,a)))break;e=e[a]}return o||++n!=i?o:!!(i=null==e?0:e.length)&&isLength(i)&&isIndex(a,i)&&(isArray(e)||isArguments(e))}function hasIn(e,t){return null!=e&&hasPath(e,t,baseHasIn)}var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;function baseMatchesProperty(e,t){return isKey(e)&&isStrictComparable(t)?matchesStrictComparable(toKey(e),t):function(r){var n=get(r,e);return void 0===n&&n===t?hasIn(r,e):baseIsEqual(t,n,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG)}}function baseProperty(e){return function(t){return null==t?void 0:t[e]}}function basePropertyDeep(e){return function(t){return baseGet(t,e)}}function property(e){return isKey(e)?baseProperty(toKey(e)):basePropertyDeep(e)}function baseIteratee(e){return"function"==typeof e?e:null==e?identity:"object"==typeof e?isArray(e)?baseMatchesProperty(e[0],e[1]):baseMatches(e):property(e)}function arrayAggregator(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(n,a,r(a),e)}return n}function createBaseFor(e){return function(e,t,r){for(var n=-1,i=Object(e),o=r(e),a=o.length;a--;){var s=o[++n];if(!1===t(i[s],s,i))break}return e}}var baseFor=createBaseFor();function baseForOwn(e,t){return e&&baseFor(e,t,keys)}function createBaseEach(e,t){return function(t,r){if(null==t)return t;if(!isArrayLike(t))return e(t,r);for(var n=t.length,i=-1,o=Object(t);++i<n&&!1!==r(o[i],i,o););return t}}var baseEach=createBaseEach(baseForOwn);function baseAggregator(e,t,r,n){return baseEach(e,function(e,i,o){t(n,e,r(e),o)}),n}function createAggregator(e,t){return function(r,n){var i=isArray(r)?arrayAggregator:baseAggregator,o=t?t():{};return i(r,e,baseIteratee(n),o)}}var now=function(){return root.Date.now()},FUNC_ERROR_TEXT$1="Expected a function",nativeMax=Math.max,nativeMin$1=Math.min;function debounce$1(e,t,r){var n,i,o,a,s,l,c=0,u=!1,d=!1,p=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT$1);function h(t){var r=n,o=i;return n=i=void 0,c=t,a=e.apply(o,r)}function f(e){var r=e-l;return void 0===l||r>=t||r<0||d&&e-c>=o}function g(){var e=now();if(f(e))return m(e);s=setTimeout(g,function(e){var r=t-(e-l);return d?nativeMin$1(r,o-(e-c)):r}(e))}function m(e){return s=void 0,p&&n?h(e):(n=i=void 0,a)}function v(){var e=now(),r=f(e);if(n=arguments,i=this,l=e,r){if(void 0===s)return function(e){return c=e,s=setTimeout(g,t),u?h(e):a}(l);if(d)return clearTimeout(s),s=setTimeout(g,t),h(l)}return void 0===s&&(s=setTimeout(g,t)),a}return t=toNumber(t)||0,isObject(r)&&(u=!!r.leading,o=(d="maxWait"in r)?nativeMax(toNumber(r.maxWait)||0,t):o,p="trailing"in r?!!r.trailing:p),v.cancel=function(){void 0!==s&&clearTimeout(s),c=0,n=l=i=s=void 0},v.flush=function(){return void 0===s?a:m(now())},v}var objectProto$3=Object.prototype,hasOwnProperty$5=objectProto$3.hasOwnProperty,defaults$4=baseRest(function(e,t){e=Object(e);var r=-1,n=t.length,i=n>2?t[2]:void 0;for(i&&isIterateeCall(t[0],t[1],i)&&(n=1);++r<n;)for(var o=t[r],a=keysIn(o),s=-1,l=a.length;++s<l;){var c=a[s],u=e[c];(void 0===u||eq(u,objectProto$3[c])&&!hasOwnProperty$5.call(e,c))&&(e[c]=o[c])}return e});function assignMergeValue(e,t,r){(void 0!==r&&!eq(e[t],r)||void 0===r&&!(t in e))&&baseAssignValue(e,t,r)}function isArrayLikeObject(e){return isObjectLike(e)&&isArrayLike(e)}function safeGet(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function toPlainObject(e){return copyObject(e,keysIn(e))}function baseMergeDeep(e,t,r,n,i,o,a){var s=safeGet(e,r),l=safeGet(t,r),c=a.get(l);if(c)assignMergeValue(e,r,c);else{var u=o?o(s,l,r+"",e,t,a):void 0,d=void 0===u;if(d){var p=isArray(l),h=!p&&isBuffer(l),f=!p&&!h&&isTypedArray(l);u=l,p||h||f?isArray(s)?u=s:isArrayLikeObject(s)?u=copyArray(s):h?(d=!1,u=cloneBuffer(l,!0)):f?(d=!1,u=cloneTypedArray(l,!0)):u=[]:isPlainObject(l)||isArguments(l)?(u=s,isArguments(s)?u=toPlainObject(s):isObject(s)&&!isFunction(s)||(u=initCloneObject(l))):d=!1}d&&(a.set(l,u),i(u,l,n,o,a),a.delete(l)),assignMergeValue(e,r,u)}}function baseMerge(e,t,r,n,i){e!==t&&baseFor(t,function(o,a){if(i||(i=new Stack),isObject(o))baseMergeDeep(e,t,a,r,baseMerge,n,i);else{var s=n?n(safeGet(e,a),o,a+"",e,t,i):void 0;void 0===s&&(s=o),assignMergeValue(e,a,s)}},keysIn)}function customDefaultsMerge(e,t,r,n,i,o){return isObject(e)&&isObject(t)&&(o.set(t,e),baseMerge(e,t,void 0,customDefaultsMerge,o),o.delete(t)),e}var mergeWith=createAssigner(function(e,t,r,n){baseMerge(e,t,r,n)}),defaultsDeep=baseRest(function(e){return e.push(void 0,customDefaultsMerge),apply$1(mergeWith,void 0,e)}),LARGE_ARRAY_SIZE$1=200;function baseDifference(e,t,r,n){var i=-1,o=arrayIncludes,a=!0,s=e.length,l=[],c=t.length;if(!s)return l;t.length>=LARGE_ARRAY_SIZE$1&&(o=cacheHas,a=!1,t=new SetCache(t));e:for(;++i<s;){var u=e[i],d=u;if(u=0!==u?u:0,a&&d==d){for(var p=c;p--;)if(t[p]===d)continue e;l.push(u)}else o(t,d,n)||l.push(u)}return l}var difference=baseRest(function(e,t){return isArrayLikeObject(e)?baseDifference(e,baseFlatten(t,1,isArrayLikeObject,!0)):[]});function baseMap(e,t){var r=-1,n=isArrayLike(e)?Array(e.length):[];return baseEach(e,function(e,i,o){n[++r]=t(e,i,o)}),n}var objectProto$2=Object.prototype,hasOwnProperty$4=objectProto$2.hasOwnProperty,groupBy=createAggregator(function(e,t,r){hasOwnProperty$4.call(e,r)?e[r].push(t):baseAssignValue(e,r,[t])});function baseGt(e,t){return e>t}var objectProto$1=Object.prototype,hasOwnProperty$3=objectProto$1.hasOwnProperty;function baseHas(e,t){return null!=e&&hasOwnProperty$3.call(e,t)}function has(e,t){return null!=e&&hasPath(e,t,baseHas)}var mapTag="[object Map]",setTag="[object Set]",objectProto=Object.prototype,hasOwnProperty$2=objectProto.hasOwnProperty;function isEmpty(e){if(null==e)return!0;if(isArrayLike(e)&&(isArray(e)||"string"==typeof e||"function"==typeof e.splice||isBuffer(e)||isTypedArray(e)||isArguments(e)))return!e.length;var t=getTag(e);if(t==mapTag||t==setTag)return!e.size;if(isPrototype(e))return!baseKeys(e).length;for(var r in e)if(hasOwnProperty$2.call(e,r))return!1;return!0}function isEqual(e,t){return baseIsEqual(e,t)}var numberTag="[object Number]";function isNumber(e){return"number"==typeof e||isObjectLike(e)&&baseGetTag(e)==numberTag}var lowerFirst=createCaseFirst("toLowerCase");function baseExtremum(e,t,r){for(var n=-1,i=e.length;++n<i;){var o=e[n],a=t(o);if(null!=a&&(void 0===s?a==a&&!isSymbol(a):r(a,s)))var s=a,l=o}return l}function max(e){return e&&e.length?baseExtremum(e,identity,baseGt):void 0}var merge$2=createAssigner(function(e,t,r){baseMerge(e,t,r)});function baseSet(e,t,r,n){if(!isObject(e))return e;for(var i=-1,o=(t=castPath(t,e)).length,a=o-1,s=e;null!=s&&++i<o;){var l=toKey(t[i]),c=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(i!=a){var u=s[l];void 0===(c=void 0)&&(c=isObject(u)?u:isIndex(t[i+1])?[]:{})}assignValue(s,l,c),s=s[l]}return e}function basePickBy(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=baseGet(e,a);r(s,a)&&baseSet(o,castPath(a,e),s)}return o}function baseSortBy(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function compareAscending(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=e==e,o=isSymbol(e),a=void 0!==t,s=null===t,l=t==t,c=isSymbol(t);if(!s&&!c&&!o&&e>t||o&&a&&l&&!s&&!c||n&&a&&l||!r&&l||!i)return 1;if(!n&&!o&&!c&&e<t||c&&r&&i&&!n&&!o||s&&r&&i||!a&&i||!l)return-1}return 0}function compareMultiple(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,a=i.length,s=r.length;++n<a;){var l=compareAscending(i[n],o[n]);if(l)return n>=s?l:l*("desc"==r[n]?-1:1)}return e.index-t.index}function baseOrderBy(e,t,r){t=t.length?arrayMap(t,function(e){return isArray(e)?function(t){return baseGet(t,1===e.length?e[0]:e)}:e}):[identity];var n=-1;return t=arrayMap(t,baseUnary(baseIteratee)),baseSortBy(baseMap(e,function(e,r,i){return{criteria:arrayMap(t,function(t){return t(e)}),index:++n,value:e}}),function(e,t){return compareMultiple(e,t,r)})}function basePick(e,t){return basePickBy(e,t,function(t,r){return hasIn(e,r)})}var pick=flatRest(function(e,t){return null==e?{}:basePick(e,t)}),sortBy=baseRest(function(e,t){if(null==e)return[];var r=t.length;return r>1&&isIterateeCall(e,t[0],t[1])?t=[]:r>2&&isIterateeCall(t[0],t[1],t[2])&&(t=[t[0]]),baseOrderBy(e,baseFlatten(t),[])}),MAX_ARRAY_LENGTH$1=4294967295,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH$1-1,nativeFloor=Math.floor,nativeMin=Math.min;function baseSortedIndexBy(e,t,r,n){var i=0,o=null==e?0:e.length;if(0===o)return 0;for(var a=(t=r(t))!=t,s=null===t,l=isSymbol(t),c=void 0===t;i<o;){var u=nativeFloor((i+o)/2),d=r(e[u]),p=void 0!==d,h=null===d,f=d==d,g=isSymbol(d);if(a)var m=f;else m=c?f&&p:s?f&&p&&!h:l?f&&p&&!h&&!g:!h&&!g&&d<t;m?i=u+1:o=u}return nativeMin(o,MAX_ARRAY_INDEX)}var MAX_ARRAY_LENGTH=4294967295,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1;function baseSortedIndex(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=HALF_MAX_ARRAY_LENGTH){for(;n<i;){var o=n+i>>>1,a=e[o];null!==a&&!isSymbol(a)&&a<t?n=o+1:i=o}return i}return baseSortedIndexBy(e,t,identity)}function sortedIndex(e,t){return baseSortedIndex(e,t)}function sortedIndexBy(e,t,r){return baseSortedIndexBy(e,t,baseIteratee(r))}var startCase=createCompounder(function(e,t,r){return e+(r?" ":"")+upperFirst(t)}),FUNC_ERROR_TEXT="Expected a function";function throttle$1(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT);return isObject(r)&&(n="leading"in r||n,i="trailing"in r?!!r.trailing:i),debounce$1(e,t,{leading:n,maxWait:t,trailing:i})}var INFINITY=1/0,createSet=Set$1&&1/setToArray(new Set$1([,-0]))[1]==INFINITY?function(e){return new Set$1(e)}:noop$2,LARGE_ARRAY_SIZE=200;function baseUniq(e,t,r){var n=-1,i=arrayIncludes,o=e.length,a=!0,s=[],l=s;if(o>=LARGE_ARRAY_SIZE){var c=createSet(e);if(c)return setToArray(c);a=!1,i=cacheHas,l=new SetCache}else l=s;e:for(;++n<o;){var u=e[n],d=u;if(u=0!==u?u:0,a&&d==d){for(var p=l.length;p--;)if(l[p]===d)continue e;s.push(u)}else i(l,d,r)||(l!==s&&l.push(d),s.push(u))}return s}var union=baseRest(function(e){return baseUniq(baseFlatten(e,1,isArrayLikeObject,!0))});function uniq(e){return e&&e.length?baseUniq(e):[]}function apply(e,t,r){if(r)switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2]);case 4:return e.call(t,r[0],r[1],r[2],r[3]);case 5:return e.call(t,r[0],r[1],r[2],r[3],r[4]);case 6:return e.call(t,r[0],r[1],r[2],r[3],r[4],r[5]);default:return e.apply(t,r)}return e.call(t)}function call$1(e,t,...r){return apply(e,t,r)}function isAsyncLike(e){return"object"==typeof e&&e.then&&"function"==typeof e.then}function isAsync(e){return null!=e&&(e instanceof Promise||isAsyncLike(e))}function toAsyncBoolean(...e){const t=[];e.forEach(e=>{Array.isArray(e)?t.push(...e):t.push(e)});if(t.some(e=>isAsync(e))){const e=t.map(e=>isAsync(e)?e:Promise.resolve(!1!==e));return Promise.all(e).then(e=>e.reduce((e,t)=>!1!==t&&e,!0))}return t.every(e=>!1!==e)}function toDeferredBoolean(...e){const t=toAsyncBoolean(e);return"boolean"==typeof t?Promise.resolve(t):t}function call(e,t){const r=[];for(let n=0;n<e.length;n+=2){const i=apply(e[n],e[n+1],Array.isArray(t)?t:[t]);r.push(i)}return toAsyncBoolean(r)}class Events{constructor(){this.listeners={}}on(e,t,r){if(null==t)return this;this.listeners[e]||(this.listeners[e]=[]);return this.listeners[e].push(t,r),this}once(e,t,r){const n=(...i)=>(this.off(e,n),call([t,r],i));return this.on(e,n,this)}off(e,t,r){if(!(e||t||r))return this.listeners={},this;const n=this.listeners;return(e?[e]:Object.keys(n)).forEach(e=>{const i=n[e];if(i)if(t||r)for(let n=i.length-2;n>=0;n-=2)t&&i[n]!==t||r&&i[n+1]!==r||i.splice(n,2);else delete n[e]}),this}trigger(e,...t){let r=!0;if("*"!==e){const n=this.listeners[e];null!=n&&(r=call([...n],t))}const n=this.listeners["*"];return null!=n?toAsyncBoolean([r,call([...n],[e,...t])]):r}emit(e,...t){return this.trigger(e,...t)}}function applyMixins(e,...t){t.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(r=>{"constructor"!==r&&Object.defineProperty(e.prototype,r,Object.getOwnPropertyDescriptor(t.prototype,r))})})}const extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])};function inherit(e,t){function r(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}let A$1=class{};const isNativeClass=/^\s*class\s+/.test(`${A$1}`)||/^\s*class\s*\{/.test(`${class{}}`);function createClass(e,t){let r;return isNativeClass?r=class extends t{}:(r=function(){return t.apply(this,arguments)},inherit(r,t)),Object.defineProperty(r,"name",{value:e}),r}function isMaliciousProp(e){return"__proto__"===e}function getByPath(e,t,r="/"){let n;const i=Array.isArray(t)?t:t.split(r);if(i.length)for(n=e;i.length;){const e=i.shift();if(Object(n)!==n||!e||!(e in n))return;n=n[e]}return n}function setByPath(e,t,r,n="/"){const i=Array.isArray(t)?t:t.split(n),o=i.pop();if(o&&!isMaliciousProp(o)){let t=e;i.forEach(e=>{isMaliciousProp(e)||(null==t[e]&&(t[e]={}),t=t[e])}),t[o]=r}return e}function unsetByPath(e,t,r="/"){const n=Array.isArray(t)?t.slice():t.split(r),i=n.pop();if(i)if(n.length>0){const t=getByPath(e,n);t&&delete t[i]}else delete e[i];return e}var __decorate$v=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Basecoat2;class Basecoat extends Events{dispose(){this.off()}}__decorate$v([Disposable.dispose()],Basecoat.prototype,"dispose",null),Basecoat2=Basecoat||(Basecoat={}),Basecoat2.dispose=Disposable.dispose,applyMixins(Basecoat,Disposable);const cacheStringFunction=e=>{const t=Object.create(null);return r=>t[r]||(t[r]=e(r))},kebabCase=cacheStringFunction(e=>e.replace(/\B([A-Z])/g,"-$1").toLowerCase()),pascalCase=cacheStringFunction(e=>startCase(camelCase(e)).replace(/ /g,""));function hashcode(e){let t=2166136261,r=!1,n=e;for(let i=0,o=n.length;i<o;i+=1){let e=n.charCodeAt(i);e>127&&!r&&(n=unescape(encodeURIComponent(n)),e=n.charCodeAt(i),r=!0),t^=e,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}return t>>>0}function uuid(){let e="";const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";for(let r=0,n=36;r<n;r+=1){const n=t[r],i=16*Math.random()|0;e+=("x"===n?i:"y"===n?3&i|8:n).toString(16)}return e}function getSpellingSuggestion(e,t,r){const n=Math.min(2,Math.floor(.34*e.length));let i,o=Math.floor(.4*e.length)+1,a=!1;const s=e.toLowerCase();for(const l of t){const t=r(l);if(void 0!==t&&Math.abs(t.length-s.length)<=n){const r=t.toLowerCase();if(r===s){if(t===e)continue;return l}if(a)continue;if(t.length<3)continue;const n=levenshteinWithMax(s,r,o-1);if(void 0===n)continue;n<3?(a=!0,i=l):(o=n,i=l)}}return i}function levenshteinWithMax(e,t,r){let n=new Array(t.length+1),i=new Array(t.length+1);const o=r+1;for(let s=0;s<=t.length;s+=1)n[s]=s;for(let s=1;s<=e.length;s+=1){const a=e.charCodeAt(s-1),l=s>r?s-r:1,c=t.length>r+s?r+s:t.length;i[0]=s;let u=s;for(let e=1;e<l;e+=1)i[e]=o;for(let e=l;e<=c;e+=1){const r=a===t.charCodeAt(e-1)?n[e-1]:Math.min(n[e]+1,i[e-1]+1,n[e-1]+2);i[e]=r,u=Math.min(u,r)}for(let e=c+1;e<=t.length;e+=1)i[e]=o;if(u>r)return;const d=n;n=i,i=d}const a=n[t.length];return a>r?void 0:a}function isPercentage(e){return"string"==typeof e&&"%"===e.slice(-1)}function normalizePercentage(e,t){if(null==e)return 0;let r;if("string"==typeof e){if(r=parseFloat(e),isPercentage(e)&&(r/=100,Number.isFinite(r)))return r*t}else r=e;return Number.isFinite(r)?r>0&&r<1?r*t:r:0}function normalizeSides(e){if("object"==typeof e){let t=0,r=0,n=0,i=0;return null!=e.vertical&&Number.isFinite(e.vertical)&&(r=i=e.vertical),null!=e.horizontal&&Number.isFinite(e.horizontal)&&(n=t=e.horizontal),null!=e.left&&Number.isFinite(e.left)&&(t=e.left),null!=e.top&&Number.isFinite(e.top)&&(r=e.top),null!=e.right&&Number.isFinite(e.right)&&(n=e.right),null!=e.bottom&&Number.isFinite(e.bottom)&&(i=e.bottom),{top:r,right:n,bottom:i,left:t}}let t=0;return null!=e&&Number.isFinite(e)&&(t=e),{top:t,right:t,bottom:t,left:t}}let _IS_MAC=!1,_IS_IOS=!1,_IS_WINDOWS=!1,_IS_IE=!1,_IS_IE11=!1,_IS_EDGE=!1,_IS_NETSCAPE=!1,_IS_CHROME_APP=!1,_IS_CHROME=!1,_IS_OPERA=!1,_IS_FIREFOX=!1,_IS_SAFARI=!1,_SUPPORT_TOUCH=!1,_SUPPORT_POINTER=!1,_SUPPORT_PASSIVE=!1,_NO_FOREIGNOBJECT=!1;if("object"==typeof navigator){const e=navigator.userAgent;_IS_MAC=e.indexOf("Macintosh")>=0,_IS_IOS=!!e.match(/(iPad|iPhone|iPod)/g),_IS_WINDOWS=e.indexOf("Windows")>=0,_IS_IE=e.indexOf("MSIE")>=0,_IS_IE11=!!e.match(/Trident\/7\./),_IS_EDGE=!!e.match(/Edge\//),_IS_NETSCAPE=e.indexOf("Mozilla/")>=0&&e.indexOf("MSIE")<0&&e.indexOf("Edge/")<0,_IS_CHROME=e.indexOf("Chrome/")>=0&&e.indexOf("Edge/")<0,_IS_OPERA=e.indexOf("Opera/")>=0||e.indexOf("OPR/")>=0,_IS_FIREFOX=e.indexOf("Firefox/")>=0,_IS_SAFARI=e.indexOf("AppleWebKit/")>=0&&e.indexOf("Chrome/")<0&&e.indexOf("Edge/")<0,"object"==typeof document&&(_NO_FOREIGNOBJECT=!document.createElementNS||"[object SVGForeignObjectElement]"!=`${document.createElementNS("http://www.w3.org/2000/svg","foreignObject")}`||e.indexOf("Opera/")>=0)}if("object"==typeof window&&(_IS_CHROME_APP=null!=window.chrome&&null!=window.chrome.app&&null!=window.chrome.app.runtime,_SUPPORT_POINTER=null!=window.PointerEvent&&!_IS_MAC),"object"==typeof document){_SUPPORT_TOUCH="ontouchstart"in document.documentElement;try{const e=Object.defineProperty({},"passive",{get(){_SUPPORT_PASSIVE=!0}}),t=document.createElement("div");t.addEventListener&&t.addEventListener("click",()=>{},e)}catch(err){}}var Platform,Platform2;Platform2=Platform||(Platform={}),Platform2.IS_MAC=_IS_MAC,Platform2.IS_IOS=_IS_IOS,Platform2.IS_WINDOWS=_IS_WINDOWS,Platform2.IS_IE=_IS_IE,Platform2.IS_IE11=_IS_IE11,Platform2.IS_EDGE=_IS_EDGE,Platform2.IS_NETSCAPE=_IS_NETSCAPE,Platform2.IS_CHROME_APP=_IS_CHROME_APP,Platform2.IS_CHROME=_IS_CHROME,Platform2.IS_OPERA=_IS_OPERA,Platform2.IS_FIREFOX=_IS_FIREFOX,Platform2.IS_SAFARI=_IS_SAFARI,Platform2.SUPPORT_TOUCH=_SUPPORT_TOUCH,Platform2.SUPPORT_POINTER=_SUPPORT_POINTER,Platform2.SUPPORT_PASSIVE=_SUPPORT_PASSIVE,Platform2.NO_FOREIGNOBJECT=_NO_FOREIGNOBJECT,Platform2.SUPPORT_FOREIGNOBJECT=!Platform2.NO_FOREIGNOBJECT,function(e){function t(){const e=window.module;return null!=e&&null!=e.hot&&null!=e.hot.status?e.hot.status():"unkonwn"}e.getHMRStatus=t,e.isApplyingHMR=function(){return"apply"===t()};const r={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};e.isEventSupported=function(e){const t=document.createElement(r[e]||"div"),n=`on${e}`;let i=n in t;return i||(t.setAttribute(n,"return;"),i="function"==typeof t[n]),i}}(Platform||(Platform={}));const rclass=/[\t\r\n\f]/g,rnotwhite=/\S+/g,fillSpaces=e=>` ${e} `;function getClass(e){return e&&e.getAttribute&&e.getAttribute("class")||""}function hasClass(e,t){if(null==e||null==t)return!1;const r=fillSpaces(getClass(e)),n=fillSpaces(t);return 1===e.nodeType&&r.replace(rclass," ").includes(n)}function addClass(e,t){if(null!=e&&null!=t){if("function"==typeof t)return addClass(e,t(getClass(e)));if("string"==typeof t&&1===e.nodeType){const r=t.match(rnotwhite)||[],n=fillSpaces(getClass(e)).replace(rclass," ");let i=r.reduce((e,t)=>e.indexOf(fillSpaces(t))<0?`${e}${t} `:e,n);i=i.trim(),n!==i&&e.setAttribute("class",i)}}}function removeClass(e,t){if(null!=e){if("function"==typeof t)return removeClass(e,t(getClass(e)));if((!t||"string"==typeof t)&&1===e.nodeType){const r=(t||"").match(rnotwhite)||[],n=fillSpaces(getClass(e)).replace(rclass," ");let i=r.reduce((e,t)=>{const r=fillSpaces(t);return e.indexOf(r)>-1?e.replace(r," "):e},n);i=t?i.trim():"",n!==i&&e.setAttribute("class",i)}}}function toggleClass(e,t,r){if(null!=e&&null!=t)if(null==r||"string"!=typeof t){if("function"==typeof t)return toggleClass(e,t(getClass(e),r),r);if("string"==typeof t){(t.match(rnotwhite)||[]).forEach(t=>{hasClass(e,t)?removeClass(e,t):addClass(e,t)})}}else r?addClass(e,t):removeClass(e,t)}let idCounter=0;function uniqueId(){return idCounter+=1,`v${idCounter}`}function ensureId(e){return null!=e.id&&""!==e.id||(e.id=uniqueId()),e.id}function isSVGGraphicsElement$1(e){return null!=e&&("function"==typeof e.getScreenCTM&&e instanceof SVGElement)}const ns={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml"},svgVersion="1.1";function createElement$1(e,t=document){return t.createElement(e)}function createElementNS(e,t=ns.xhtml,r=document){return r.createElementNS(t,e)}function createSvgElement(e,t=document){return createElementNS(e,ns.svg,t)}function createSvgDocument(e){if(e){const t=`<svg xmlns="${ns.svg}" xmlns:xlink="${ns.xlink}" version="${svgVersion}">${e}</svg>`,{documentElement:r}=parseXML(t,{async:!1});return r}const t=document.createElementNS(ns.svg,"svg");return t.setAttributeNS(ns.xmlns,"xmlns:xlink",ns.xlink),t.setAttribute("version",svgVersion),t}function parseXML(e,t={}){let r;try{const n=new DOMParser;if(null!=t.async){n.async=t.async}r=n.parseFromString(e,t.mimeType||"text/xml")}catch(n){r=void 0}if(!r||r.getElementsByTagName("parsererror").length)throw new Error(`Invalid XML: ${e}`);return r}function tagName(e,t=!0){const r=e.nodeName;return t?r.toLowerCase():r.toUpperCase()}function index$1(e){let t=0,r=e.previousSibling;for(;r;)1===r.nodeType&&(t+=1),r=r.previousSibling;return t}function find$2(e,t){return e.querySelectorAll(t)}function findOne(e,t){return e.querySelector(t)}function findParentByClass(e,t,r){const n=e.ownerSVGElement;let i=e.parentNode;for(;i&&i!==r&&i!==n;){if(hasClass(i,t))return i;i=i.parentNode}return null}function contains(e,t){const r=t&&t.parentNode;return e===r||!!(r&&1===r.nodeType&&16&e.compareDocumentPosition(r))}function remove(e){if(e){(Array.isArray(e)?e:[e]).forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)})}}function empty$2(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function append(e,t){(Array.isArray(t)?t:[t]).forEach(t=>{null!=t&&e.appendChild(t)})}function prepend(e,t){const r=e.firstChild;return r?before(r,t):append(e,t)}function before(e,t){const r=e.parentNode;if(r){(Array.isArray(t)?t:[t]).forEach(t=>{null!=t&&r.insertBefore(t,e)})}}function appendTo(e,t){null!=t&&t.appendChild(e)}function isHTMLElement(e){try{return e instanceof HTMLElement}catch(e10){return"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument}}function children(e,t){const r=[];let n=e.firstChild;for(;n;n=n.nextSibling)1===n.nodeType&&(t&&!hasClass(n,t)||r.push(n));return r}const CASE_SENSITIVE_ATTR=["viewBox","attributeName","attributeType","repeatCount","textLength","lengthAdjust","gradientUnits"];function getAttribute(e,t){return e.getAttribute(t)}function removeAttribute(e,t){const r=qualifyAttr(t);r.ns?e.hasAttributeNS(r.ns,r.local)&&e.removeAttributeNS(r.ns,r.local):e.hasAttribute(t)&&e.removeAttribute(t)}function setAttribute(e,t,r){if(null==r)return removeAttribute(e,t);const n=qualifyAttr(t);n.ns&&"string"==typeof r?e.setAttributeNS(n.ns,t,r):"id"===t?e.id=`${r}`:e.setAttribute(t,`${r}`)}function setAttributes(e,t){Object.keys(t).forEach(r=>{setAttribute(e,r,t[r])})}function attr(e,t,r){if(null==t){const t=e.attributes,r={};for(let e=0;e<t.length;e+=1)r[t[e].name]=t[e].value;return r}if("string"==typeof t&&void 0===r)return e.getAttribute(t);"object"==typeof t?setAttributes(e,t):setAttribute(e,t,r)}function qualifyAttr(e){if(-1!==e.indexOf(":")){const t=e.split(":");return{ns:ns[t[0]],local:t[1]}}return{ns:null,local:e}}function kebablizeAttrs(e){const t={};return Object.keys(e).forEach(r=>{const n=CASE_SENSITIVE_ATTR.includes(r)?r:kebabCase(r);t[n]=e[r]}),t}function styleToObject(e){const t={};return e.split(";").forEach(e=>{const r=e.trim();if(r){const e=r.split("=");e.length&&(t[e[0].trim()]=e[1]?e[1].trim():"")}}),t}function mergeAttrs(e,t){return Object.keys(t).forEach(r=>{if("class"===r)e[r]=e[r]?`${e[r]} ${t[r]}`:t[r];else if("style"===r){const n="object"==typeof e[r],i="object"==typeof t[r];let o,a;n&&i?(o=e[r],a=t[r]):n?(o=e[r],a=styleToObject(t[r])):i?(o=styleToObject(e[r]),a=t[r]):(o=styleToObject(e[r]),a=styleToObject(t[r])),e[r]=mergeAttrs(o,a)}else e[r]=t[r]}),e}function annotate(e,t,r={}){const n=r.offset||0,i=[],o=[];let a,s,l=null;for(let c=0;c<e.length;c+=1){a=o[c]=e[c];for(let i=0,s=t.length;i<s;i+=1){const s=t[i],l=s.start+n,u=s.end+n;c>=l&&c<u&&("string"==typeof a?a=o[c]={t:e[c],attrs:s.attrs}:a.attrs=mergeAttrs(mergeAttrs({},a.attrs),s.attrs),r.includeAnnotationIndices&&(null==a.annotations&&(a.annotations=[]),a.annotations.push(i)))}s=o[c-1],s?isObject(a)&&isObject(s)?JSON.stringify(a.attrs)===JSON.stringify(s.attrs)?l.t+=a.t:(i.push(l),l=a):isObject(a)||isObject(s)?(i.push(l),l=a):l=(l||"")+a:l=a}return null!=l&&i.push(l),i}function sanitize(e){return e.replace(/ /g," ")}var DataUri;let millimeterSize;!function(e){function t(e){const t="data:";return e.substr(0,5)===t}function r(e){let t=e.replace(/\s/g,"");t=decodeURIComponent(t);const r=t.indexOf(","),n=t.slice(0,r),i=n.split(":")[1].split(";")[0],o=t.slice(r+1);let a;a=n.indexOf("base64")>=0?atob(o):unescape(encodeURIComponent(o));const s=new Uint8Array(a.length);for(let l=0;l<a.length;l+=1)s[l]=a.charCodeAt(l);return new Blob([s],{type:i})}function n(e,t){const r=window.navigator.msSaveBlob;if(r)r(e,t);else{const r=window.URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(r)}}function i(e){const t=parseFloat(e);return Number.isNaN(t)?null:t}e.isDataUrl=t,e.imageToDataUri=function(e,r){if(!e||t(e))return void setTimeout(()=>r(null,e));const n=()=>{r(new Error(`Failed to load image: ${e}`))},i=window.FileReader?e=>{if(200===e.status){const t=new FileReader;t.onload=e=>{const t=e.target.result;r(null,t)},t.onerror=n,t.readAsDataURL(e.response)}else n()}:t=>{if(200===t.status){let n=e.split(".").pop()||"png";"svg"===n&&(n="svg+xml");const i=`data:image/${n};base64,`,o=new Uint8Array(t.response),a=i+btoa((e=>{const t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode.apply(null,e.subarray(r,r+32768)));return t.join("")})(o));r(null,a)}else n()},o=new XMLHttpRequest;o.responseType=window.FileReader?"blob":"arraybuffer",o.open("GET",e,!0),o.addEventListener("error",n),o.addEventListener("load",()=>i(o)),o.send()},e.dataUriToBlob=r,e.downloadBlob=n,e.downloadDataUri=function(e,t){n(r(e),t)},e.svgToDataUrl=function(e,t={}){let r=null;const n=t=>(null==r&&(r=function(e){const t=e.match(/<svg[^>]*viewBox\s*=\s*(["']?)(.+?)\1[^>]*>/i);return t&&t[2]?t[2].replace(/\s+/," ").split(" "):null}(e)),null!=r?i(r[t]):null),o=t=>{const r=e.match(t);return r&&r[2]?i(r[2]):null};let a=t.width;if(null==a&&(a=o(/<svg[^>]*width\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==a&&(a=n(2)),null==a)throw new Error("Can not parse width from svg string");let s=t.height;if(null==s&&(s=o(/<svg[^>]*height\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==s&&(s=n(3)),null==s)throw new Error("Can not parse height from svg string");return`data:image/svg+xml,${encodeURIComponent(e).replace(/'/g,"%27").replace(/"/g,"%22")}`}}(DataUri||(DataUri={}));const supportedUnits={px:e=>e,mm:e=>millimeterSize*e,cm:e=>millimeterSize*e*10,in:e=>millimeterSize*e*25.4,pt:e=>millimeterSize*(25.4*e/72),pc:e=>millimeterSize*(25.4*e/6)};var Unit;!function(e){function t(e,t,r){const n=document.createElement("div"),i=n.style;i.display="inline-block",i.position="absolute",i.left="-15000px",i.top="-15000px",i.width=e+(r||"px"),i.height=t+(r||"px"),document.body.appendChild(n);const o=n.getBoundingClientRect(),a={width:o.width||0,height:o.height||0};return document.body.removeChild(n),a}e.measure=t,e.toPx=function(e,r){null==millimeterSize&&(millimeterSize=t("1","1","mm").width);const n=r?supportedUnits[r]:null;return n?n(e):e}}(Unit||(Unit={}));const hyphenPattern=/-(.)/g;function camelize(e){return e.replace(hyphenPattern,(e,t)=>t.toUpperCase())}const memoized={},prefixes=["webkit","ms","moz","o"],testStyle="undefined"!=typeof document?document.createElement("div").style:{};function getWithPrefix(e){for(let t=0;t<prefixes.length;t+=1){const r=prefixes[t]+e;if(r in testStyle)return r}return null}function getVendorPrefixedName(e){const t=camelize(e);if(null==memoized[t]){const e=t.charAt(0).toUpperCase()+t.slice(1);memoized[t]=t in testStyle?t:getWithPrefix(e)}return memoized[t]}function getComputedStyle$1(e,t){const r=e.ownerDocument&&e.ownerDocument.defaultView&&e.ownerDocument.defaultView.opener?e.ownerDocument.defaultView.getComputedStyle(e,null):window.getComputedStyle(e,null);return r&&t?r.getPropertyValue(t)||r[t]:r}const numericProps={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function isCSSVariable(e){return/^--/.test(e)}function computeStyle(e,t,r){const n=window.getComputedStyle(e,null);return r?n.getPropertyValue(t)||void 0:n[t]||e.style[t]}function getSuffixedValue(e,t){return numericProps[e]||"number"!=typeof t?t:`${t}px`}function css$3(e,t,r){if("string"==typeof t){const n=isCSSVariable(t);if(n||(t=getVendorPrefixedName(t)),void 0===r)return computeStyle(e,t,n);n||(r=getSuffixedValue(t,r));const i=e.style;return void(n?i.setProperty(t,r):i[t]=r)}for(const n in t)css$3(e,n,t[n])}const dataset=new WeakMap;function getData(e,t){const r=camelCase(t),n=dataset.get(e);if(n)return n[r]}function setData(e,t,r){const n=camelCase(t),i=dataset.get(e);i?i[n]=r:dataset.set(e,{[n]:r})}function data$2(e,t,r){if(!t){const t={};return Object.keys(dataset).forEach(r=>{t[r]=getData(e,r)}),t}if("string"==typeof t)return void 0===r?getData(e,t):void setData(e,t,r);for(const n in t)data$2(e,n,t[n])}class Vector{get[Symbol.toStringTag](){return Vector.toStringTag}get type(){return this.node.nodeName}get id(){return this.node.id}set id(e){this.node.id=e}constructor(e,t,r){if(!e)throw new TypeError("Invalid element to create vector");let n;if(Vector.isVector(e))n=e.node;else if("string"==typeof e)if("svg"===e.toLowerCase())n=createSvgDocument();else if("<"===e[0]){const t=createSvgDocument(e);n=document.importNode(t.firstChild,!0)}else n=document.createElementNS(ns.svg,e);else n=e;this.node=n,t&&this.setAttributes(t),r&&this.append(r)}transform(e,t){return null==e?transform(this.node):(transform(this.node,e,t),this)}translate(e,t=0,r={}){return null==e?translate(this.node):(translate(this.node,e,t,r),this)}rotate(e,t,r,n={}){return null==e?rotate$1(this.node):(rotate$1(this.node,e,t,r,n),this)}scale(e,t){return null==e?scale(this.node):(scale(this.node,e,t),this)}getTransformToElement(e){const t=Vector.toNode(e);return getTransformToElement(this.node,t)}removeAttribute(e){return removeAttribute(this.node,e),this}getAttribute(e){return getAttribute(this.node,e)}setAttribute(e,t){return setAttribute(this.node,e,t),this}setAttributes(e){return setAttributes(this.node,e),this}attr(e,t){return null==e?attr(this.node):"string"==typeof e&&void 0===t?attr(this.node,e):("object"==typeof e?attr(this.node,e):attr(this.node,e,t),this)}svg(){return this.node instanceof SVGSVGElement?this:Vector.create(this.node.ownerSVGElement)}defs(){const e=this.svg()||this,t=e.node.getElementsByTagName("defs")[0];return t?Vector.create(t):Vector.create("defs").appendTo(e)}text(e,t={}){return text$1(this.node,e,t),this}tagName(){return tagName(this.node)}clone(){return Vector.create(this.node.cloneNode(!0))}remove(){return remove(this.node),this}empty(){return empty$2(this.node),this}append(e){return append(this.node,Vector.toNodes(e)),this}appendTo(e){return appendTo(this.node,Vector.isVector(e)?e.node:e),this}prepend(e){return prepend(this.node,Vector.toNodes(e)),this}before(e){return before(this.node,Vector.toNodes(e)),this}replace(e){return this.node.parentNode&&this.node.parentNode.replaceChild(Vector.toNode(e),this.node),Vector.create(e)}first(){return this.node.firstChild?Vector.create(this.node.firstChild):null}last(){return this.node.lastChild?Vector.create(this.node.lastChild):null}get(e){const t=this.node.childNodes[e];return t?Vector.create(t):null}indexOf(e){return Array.prototype.slice.call(this.node.childNodes).indexOf(Vector.toNode(e))}find(e){const t=[],r=find$2(this.node,e);if(r)for(let n=0,i=r.length;n<i;n+=1)t.push(Vector.create(r[n]));return t}findOne(e){const t=findOne(this.node,e);return t?Vector.create(t):null}findParentByClass(e,t){const r=findParentByClass(this.node,e,t);return r?Vector.create(r):null}matches(e){const t=this.node;this.node.matches;const r=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector||null;return r&&r.call(t,e)}contains(e){return contains(this.node,Vector.isVector(e)?e.node:e)}wrap(e){const t=Vector.create(e),r=this.node.parentNode;return null!=r&&r.insertBefore(t.node,this.node),t.append(this)}parent(e){let t=this;if(null==t.node.parentNode)return null;if(t=Vector.create(t.node.parentNode),null==e)return t;do{if("string"==typeof e?t.matches(e):t instanceof e)return t}while(t=Vector.create(t.node.parentNode));return t}children(){const e=this.node.childNodes,t=[];for(let r=0;r<e.length;r+=1){1===e[r].nodeType&&t.push(Vector.create(e[r]))}return t}eachChild(e,t){const r=this.children();for(let n=0,i=r.length;n<i;n+=1)e.call(r[n],r[n],n,r),t&&r[n].eachChild(e,t);return this}index(){return index$1(this.node)}hasClass(e){return hasClass(this.node,e)}addClass(e){return addClass(this.node,e),this}removeClass(e){return removeClass(this.node,e),this}toggleClass(e,t){return toggleClass(this.node,e,t),this}toLocalPoint(e,t){return toLocalPoint(this.node,e,t)}sample(e=1){return this.node instanceof SVGPathElement?sample(this.node,e):[]}toPath(){return Vector.create(toPath(this.node))}toPathData(){return toPathData(this.node)}}function createTextPathNode(e,t){const r=Vector.create(t),n=Vector.create("textPath"),i=e.d;if(i&&void 0===e["xlink:href"]){const e=Vector.create("path").attr("d",i).appendTo(r.defs());n.attr("xlink:href",`#${e.id}`)}return"object"==typeof e&&n.attr(e),n.node}function annotateTextLine(e,t,r){const n=r.eol,i=r.baseSize,o=r.lineHeight;let a,s=0;const l={},c=t.length-1;for(let u=0;u<=c;u+=1){let o=t[u],l=null;if("object"==typeof o){const e=o.attrs,t=Vector.create("tspan",e);a=t.node;let d=o.t;n&&u===c&&(d+=n),a.textContent=d;const p=e.class;p&&t.addClass(p),r.includeAnnotationIndices&&t.attr("annotations",o.annotations.join(",")),l=parseFloat(e["font-size"]),void 0===l&&(l=i),l&&l>s&&(s=l)}else n&&u===c&&(o+=n),a=document.createTextNode(o||" "),i&&i>s&&(s=i);e.appendChild(a)}return s&&(l.maxFontSize=s),o?l.lineHeight=o:s&&(l.lineHeight=1.2*s),l}!function(e){function t(t){if(null==t)return!1;if(t instanceof e)return!0;const r=t[Symbol.toStringTag],n=t;return(null==r||r===e.toStringTag)&&n.node instanceof SVGElement&&"function"==typeof n.sample&&"function"==typeof n.toPath}function r(t,r,n){return new e(t,r,n)}function n(e){return t(e)?e.node:e}e.toStringTag=`X6.${e.name}`,e.isVector=t,e.create=r,e.createVectors=function(e){if("<"===e[0]){const t=createSvgDocument(e),n=[];for(let e=0,i=t.childNodes.length;e<i;e+=1){const i=t.childNodes[e];n.push(r(document.importNode(i,!0)))}return n}return[r(e)]},e.toNode=n,e.toNodes=function(e){return Array.isArray(e)?e.map(e=>n(e)):[n(e)]}}(Vector||(Vector={}));const emRegex=/em$/;function emToPx(e,t){const r=parseFloat(e);return emRegex.test(e)?r*t:r}function calculateDY(e,t,r,n){if(!Array.isArray(t))return 0;const i=t.length;if(!i)return 0;let o=t[0];const a=emToPx(o.maxFontSize,r)||r;let s=0;const l=emToPx(n,r);for(let d=1;d<i;d+=1){o=t[d];s+=emToPx(o.lineHeight,r)||l}const c=emToPx(o.maxFontSize,r)||r;let u;switch(e){case"middle":u=a/2-.15*c-s/2;break;case"bottom":u=-.25*c-s;break;default:u=.8*a}return u}function text$1(e,t,r={}){t=sanitize(t);const n=r.eol;let i=r.textPath;const o=r.textVerticalAnchor,a="middle"===o||"bottom"===o||"top"===o;let s=r.x;void 0===s&&(s=e.getAttribute("x")||0);const l=r.includeAnnotationIndices;let c=r.annotations;c&&!Array.isArray(c)&&(c=[c]);const u=r.lineHeight,d="auto"===u,p=d?"1.5em":u||"1em";let h=!0;const f=e.childNodes;if(1===f.length){const e=f[0];e&&"TITLE"===e.tagName.toUpperCase()&&(h=!1)}h&&empty$2(e),attr(e,{"xml:space":"preserve",display:t||r.displayEmpty?null:"none"});const g=attr(e,"font-size");let m,v,y=parseFloat(g);y||(y=16,!a&&!c||g||attr(e,"font-size",`${y}`)),i?("string"==typeof i&&(i={d:i}),m=createTextPathNode(i,e)):m=document.createDocumentFragment();let b,q=0;const V=t.split("\n"),S=[],E=V.length-1;for(let x=0;x<=E;x+=1){v=p;let e="v-line";const t=createSvgElement("tspan");let r,o=V[x];if(o)if(c){r=annotateTextLine(t,annotate(o,c,{offset:-q,includeAnnotationIndices:l}),{eol:x!==E&&n,baseSize:y,lineHeight:d?null:p,includeAnnotationIndices:l});const e=r.lineHeight;e&&d&&0!==x&&(v=e),0===x&&(b=.8*r.maxFontSize)}else n&&x!==E&&(o+=n),t.textContent=o;else{t.textContent="-",e+=" v-empty-line";const n=t.style;n.fillOpacity=0,n.strokeOpacity=0,c&&(r={})}r&&S.push(r),x>0&&t.setAttribute("dy",v),(x>0||i)&&t.setAttribute("x",s),t.className.baseVal=e,m.appendChild(t),q+=o.length+1}if(a)if(c)v=calculateDY(o,S,y,p);else if("top"===o)v="0.8em";else{let e;switch(E>0?(e=parseFloat(p)||1,e*=E,emRegex.test(p)||(e/=y)):e=0,o){case"middle":v=.3-e/2+"em";break;case"bottom":v=-e-.3+"em"}}else 0===o?v="0em":o?v=o:(v=0,null==e.getAttribute("y")&&e.setAttribute("y",`${b||"0.8em"}`));m.firstChild.setAttribute("dy",v),e.appendChild(m)}function measureText(e,t={}){const r=document.createElement("canvas").getContext("2d");if(!e)return{width:0};const n=[],i=t["font-size"]?`${parseFloat(t["font-size"])}px`:"14px";return n.push(t["font-style"]||"normal"),n.push(t["font-variant"]||"normal"),n.push(t["font-weight"]||400),n.push(i),n.push(t["font-family"]||"sans-serif"),r.font=n.join(" "),r.measureText(e)}function splitTextByLength(e,t,r,n={}){if(t>=r)return[e,""];const i=e.length,o={};let a=Math.round(t/r*i-1);for(a<0&&(a=0);a>=0&&a<i;){const r=e.slice(0,a),i=o[r]||measureText(r,n).width,s=e.slice(0,a+1),l=o[s]||measureText(s,n).width;if(o[r]=i,o[s]=l,i>t)a-=1;else{if(!(l<=t))break;a+=1}}return[e.slice(0,a),e.slice(a)]}function breakText(e,t,r={},n={}){const i=t.width,o=t.height,a=n.eol||"\n",s=r.fontSize||14,l=r.lineHeight?parseFloat(r.lineHeight):Math.ceil(1.4*s),c=Math.floor(o/l);if(e.indexOf(a)>-1){const i=uuid(),o=[];return e.split(a).map(e=>{const a=breakText(e,Object.assign(Object.assign({},t),{height:Number.MAX_SAFE_INTEGER}),r,Object.assign(Object.assign({},n),{eol:i}));a&&o.push(...a.split(i))}),o.slice(0,c).join(a)}const{width:u}=measureText(e,r);if(u<i)return e;const d=[];let p=e,h=u,f=n.ellipsis,g=0;f&&("string"!=typeof f&&(f="…"),g=measureText(f,r).width);for(let m=0;m<c;m+=1){if(!(h>i)){d.push(p);break}if(m===c-1){const[e]=splitTextByLength(p,i-g,h,r);d.push(f?`${e}${f}`:e)}else{const[e,t]=splitTextByLength(p,i,h,r);d.push(e),p=t,h=measureText(p,r).width}}return d.join(a)}const KAPPA=.551784;function getNumbericAttribute(e,t,r=NaN){const n=e.getAttribute(t);if(null==n)return r;const i=parseFloat(n);return Number.isNaN(i)?r:i}function sample(e,t=1){const r=e.getTotalLength(),n=[];let i,o=0;for(;o<r;)i=e.getPointAtLength(o),n.push({distance:o,x:i.x,y:i.y}),o+=t;return n}function lineToPathData(e){return["M",getNumbericAttribute(e,"x1"),getNumbericAttribute(e,"y1"),"L",getNumbericAttribute(e,"x2"),getNumbericAttribute(e,"y2")].join(" ")}function polygonToPathData(e){const t=getPointsFromSvgElement(e);return 0===t.length?null:`${svgPointsToPath(t)} Z`}function polylineToPathData(e){const t=getPointsFromSvgElement(e);return 0===t.length?null:svgPointsToPath(t)}function svgPointsToPath(e){return`M ${e.map(e=>`${e.x} ${e.y}`).join(" L")}`}function getPointsFromSvgElement(e){const t=[],r=e.points;if(r)for(let n=0,i=r.numberOfItems;n<i;n+=1)t.push(r.getItem(n));return t}function circleToPathData(e){const t=getNumbericAttribute(e,"cx",0),r=getNumbericAttribute(e,"cy",0),n=getNumbericAttribute(e,"r"),i=n*KAPPA;return["M",t,r-n,"C",t+i,r-n,t+n,r-i,t+n,r,"C",t+n,r+i,t+i,r+n,t,r+n,"C",t-i,r+n,t-n,r+i,t-n,r,"C",t-n,r-i,t-i,r-n,t,r-n,"Z"].join(" ")}function ellipseToPathData(e){const t=getNumbericAttribute(e,"cx",0),r=getNumbericAttribute(e,"cy",0),n=getNumbericAttribute(e,"rx"),i=getNumbericAttribute(e,"ry")||n,o=n*KAPPA,a=i*KAPPA;return["M",t,r-i,"C",t+o,r-i,t+n,r-a,t+n,r,"C",t+n,r+a,t+o,r+i,t,r+i,"C",t-o,r+i,t-n,r+a,t-n,r,"C",t-n,r-a,t-o,r-i,t,r-i,"Z"].join(" ")}function rectangleToPathData(e){return rectToPathData({x:getNumbericAttribute(e,"x",0),y:getNumbericAttribute(e,"y",0),width:getNumbericAttribute(e,"width",0),height:getNumbericAttribute(e,"height",0),rx:getNumbericAttribute(e,"rx",0),ry:getNumbericAttribute(e,"ry",0)})}function rectToPathData(e){let t;const r=e.x,n=e.y,i=e.width,o=e.height,a=Math.min(e.rx||e["top-rx"]||0,i/2),s=Math.min(e.rx||e["bottom-rx"]||0,i/2),l=Math.min(e.ry||e["top-ry"]||0,o/2),c=Math.min(e.ry||e["bottom-ry"]||0,o/2);return t=a||s||l||c?["M",r,n+l,"v",o-l-c,"a",s,c,0,0,0,s,c,"h",i-2*s,"a",s,c,0,0,0,s,-c,"v",-(o-c-l),"a",a,l,0,0,0,-a,-l,"h",-(i-2*a),"a",a,l,0,0,0,-a,l,"Z"]:["M",r,n,"H",r+i,"V",n+o,"H",r,"V",n,"Z"],t.join(" ")}function toPath(e){const t=createSvgElement("path");attr(t,attr(e));const r=toPathData(e);return r&&t.setAttribute("d",r),t}function toPathData(e){const t=e.tagName.toLowerCase();switch(t){case"path":return e.getAttribute("d");case"line":return lineToPathData(e);case"polygon":return polygonToPathData(e);case"polyline":return polylineToPathData(e);case"ellipse":return ellipseToPathData(e);case"circle":return circleToPathData(e);case"rect":return rectangleToPathData(e)}throw new Error(`"${t}" cannot be converted to svg path element.`)}const transformRegex=/(\w+)\(([^,)]+),?([^)]+)?\)/gi,transformSeparatorRegex=/[ ,]+/,transformationListRegex=/^(\w+)\((.*)\)/;function createSVGPoint(e,t){const r=createSvgElement("svg").createSVGPoint();return r.x=e,r.y=t,r}function createSVGMatrix(e){const t=createSvgElement("svg").createSVGMatrix();if(null!=e){const r=e,n=t;for(const e in r)n[e]=r[e]}return t}function createSVGTransform(e){const t=createSvgElement("svg");return null!=e?(e instanceof DOMMatrix||(e=createSVGMatrix(e)),t.createSVGTransformFromMatrix(e)):t.createSVGTransform()}function transformStringToMatrix(e){let t=createSVGMatrix();const r=null!=e&&e.match(transformRegex);if(!r)return t;for(let n=0,i=r.length;n<i;n+=1){const e=r[n].match(transformationListRegex);if(e){let r,n,i,o,a,s=createSVGMatrix();const l=e[2].split(transformSeparatorRegex);switch(e[1].toLowerCase()){case"scale":r=parseFloat(l[0]),n=void 0===l[1]?r:parseFloat(l[1]),s=s.scaleNonUniform(r,n);break;case"translate":i=parseFloat(l[0]),o=parseFloat(l[1]),s=s.translate(i,o);break;case"rotate":a=parseFloat(l[0]),i=parseFloat(l[1])||0,o=parseFloat(l[2])||0,s=0!==i||0!==o?s.translate(i,o).rotate(a).translate(-i,-o):s.rotate(a);break;case"skewx":a=parseFloat(l[0]),s=s.skewX(a);break;case"skewy":a=parseFloat(l[0]),s=s.skewY(a);break;case"matrix":s.a=parseFloat(l[0]),s.b=parseFloat(l[1]),s.c=parseFloat(l[2]),s.d=parseFloat(l[3]),s.e=parseFloat(l[4]),s.f=parseFloat(l[5]);break;default:continue}t=t.multiply(s)}}return t}function matrixToTransformString(e){const t=e||{};return`matrix(${null!=t.a?t.a:1},${null!=t.b?t.b:0},${null!=t.c?t.c:0},${null!=t.d?t.d:1},${null!=t.e?t.e:0},${null!=t.f?t.f:0})`}function parseTransformString(e){let t,r,n;if(e){const i=transformSeparatorRegex;if(e.trim().indexOf("matrix")>=0){const i=decomposeMatrix(transformStringToMatrix(e));t=[i.translateX,i.translateY],r=[i.rotation],n=[i.scaleX,i.scaleY];const o=[];0===t[0]&&0===t[1]||o.push(`translate(${t.join(",")})`),1===n[0]&&1===n[1]||o.push(`scale(${n.join(",")})`),0!==r[0]&&o.push(`rotate(${r[0]})`),e=o.join(" ")}else{const o=e.match(/translate\((.*?)\)/);o&&(t=o[1].split(i));const a=e.match(/rotate\((.*?)\)/);a&&(r=a[1].split(i));const s=e.match(/scale\((.*?)\)/);s&&(n=s[1].split(i))}}const i=n&&n[0]?parseFloat(n[0]):1;return{raw:e||"",translation:{tx:t&&t[0]?parseInt(t[0],10):0,ty:t&&t[1]?parseInt(t[1],10):0},rotation:{angle:r&&r[0]?parseInt(r[0],10):0,cx:r&&r[1]?parseInt(r[1],10):void 0,cy:r&&r[2]?parseInt(r[2],10):void 0},scale:{sx:i,sy:n&&n[1]?parseFloat(n[1]):i}}}function deltaTransformPoint(e,t){return{x:t.x*e.a+t.y*e.c+0,y:t.x*e.b+t.y*e.d+0}}function decomposeMatrix(e){const t=deltaTransformPoint(e,{x:0,y:1}),r=deltaTransformPoint(e,{x:1,y:0}),n=180/Math.PI*Math.atan2(t.y,t.x)-90;return{skewX:n,skewY:180/Math.PI*Math.atan2(r.y,r.x),translateX:e.e,translateY:e.f,scaleX:Math.sqrt(e.a*e.a+e.b*e.b),scaleY:Math.sqrt(e.c*e.c+e.d*e.d),rotation:n}}function matrixToScale(e){let t,r,n,i;return e?(t=null==e.a?1:e.a,i=null==e.d?1:e.d,r=e.b,n=e.c):t=i=1,{sx:r?Math.sqrt(t*t+r*r):t,sy:n?Math.sqrt(n*n+i*i):i}}function matrixToRotation(e){let t={x:0,y:1};e&&(t=deltaTransformPoint(e,t));const r=180*Math.atan2(t.y,t.x)/Math.PI%360-90;return{angle:r%360+(r<0?360:0)}}function matrixToTranslation(e){return{tx:e&&e.e||0,ty:e&&e.f||0}}function transform(e,t,r={}){if(null==t)return transformStringToMatrix(attr(e,"transform"));if(r.absolute)return void e.setAttribute("transform",matrixToTransformString(t));const n=e.transform,i=createSVGTransform(t);n.baseVal.appendItem(i)}function translate(e,t,r=0,n={}){let i=attr(e,"transform");const o=parseTransformString(i);if(null==t)return o.translation;i=o.raw,i=i.replace(/translate\([^)]*\)/g,"").trim();const a=`translate(${n.absolute?t:o.translation.tx+t},${n.absolute?r:o.translation.ty+r})`;e.setAttribute("transform",`${a} ${i}`.trim())}function rotate$1(e,t,r,n,i={}){let o=attr(e,"transform");const a=parseTransformString(o);if(null==t)return a.rotation;o=a.raw,o=o.replace(/rotate\([^)]*\)/g,"").trim(),t%=360;const s=`rotate(${i.absolute?t:a.rotation.angle+t}${null!=r&&null!=n?`,${r},${n}`:""})`;e.setAttribute("transform",`${o} ${s}`.trim())}function scale(e,t,r){let n=attr(e,"transform");const i=parseTransformString(n);if(null==t)return i.scale;r=null==r?t:r,n=i.raw,n=n.replace(/scale\([^)]*\)/g,"").trim();const o=`scale(${t},${r})`;e.setAttribute("transform",`${n} ${o}`.trim())}function getTransformToElement(e,t){if(isSVGGraphicsElement$1(t)&&isSVGGraphicsElement$1(e)){const r=t.getScreenCTM(),n=e.getScreenCTM();if(r&&n)return r.inverse().multiply(n)}return createSVGMatrix()}function getTransformToParentElement(e,t){let r=createSVGMatrix();if(isSVGGraphicsElement$1(t)&&isSVGGraphicsElement$1(e)){let n=e;const i=[];for(;n&&n!==t;){const e=transformStringToMatrix(n.getAttribute("transform")||null);i.push(e),n=n.parentNode}i.reverse().forEach(e=>{r=r.multiply(e)})}return r}function toLocalPoint(e,t,r){const n=e instanceof SVGSVGElement?e:e.ownerSVGElement,i=n.createSVGPoint();i.x=t,i.y=r;try{const t=n.getScreenCTM(),r=i.matrixTransform(t.inverse()),o=getTransformToElement(e,n).inverse();return r.matrixTransform(o)}catch(e10){return i}}var EventHook,Store$1,Util$2,Util2,EventObject2;!function(e){const t={};e.get=function(e){return t[e]||{}},e.register=function(e,r){t[e]=r},e.unregister=function(e){delete t[e]}}(EventHook||(EventHook={})),function(e){const t=new WeakMap;e.ensure=function(e){return t.has(e)||t.set(e,{events:Object.create(null)}),t.get(e)},e.get=function(e){return t.get(e)},e.remove=function(e){return t.delete(e)}}(Store$1||(Store$1={})),Util2=Util$2||(Util$2={}),Util2.returnTrue=()=>!0,Util2.returnFalse=()=>!1,Util2.stopPropagationCallback=function(e){e.stopPropagation()},Util2.addEventListener=function(e,t,r){null!=e.addEventListener&&e.addEventListener(t,r)},Util2.removeEventListener=function(e,t,r){null!=e.removeEventListener&&e.removeEventListener(t,r)},function(e){const t=/[^\x20\t\r\n\f]+/g,r=/^([^.]*)(?:\.(.+)|)/;e.splitType=function(e){return(e||"").match(t)||[""]},e.normalizeType=function(e){const t=r.exec(e)||[];return{originType:t[1]?t[1].trim():t[1],namespaces:t[2]?t[2].split(".").map(e=>e.trim()).sort():[]}},e.isValidTarget=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType},e.isValidSelector=function(e,t){if(t){const r=e;return null!=r.querySelector&&null!=r.querySelector(t)}return!0}}(Util$2||(Util$2={})),function(e){let t=0;const r=new WeakMap;e.ensureHandlerId=function(e){return r.has(e)||(r.set(e,t),t+=1),r.get(e)},e.getHandlerId=function(e){return r.get(e)},e.removeHandlerId=function(e){return r.delete(e)},e.setHandlerId=function(e,t){return r.set(e,t)}}(Util$2||(Util$2={})),function(e){e.getHandlerQueue=function(e,t){const r=[],n=Store$1.get(e),i=n&&n.events&&n.events[t.type],o=i&&i.handlers||[],a=i?i.delegateCount:0;if(a>0&&!("click"===t.type&&"number"==typeof t.button&&t.button>=1))for(let s=t.target;s!==e;s=s.parentNode||e)if(1===s.nodeType&&("click"!==t.type||!0!==s.disabled)){const t=[],n={};for(let r=0;r<a;r+=1){const i=o[r],a=i.selector;if(null!=a&&null==n[a]){const t=[];e.querySelectorAll(a).forEach(e=>{t.push(e)}),n[a]=t.includes(s)}n[a]&&t.push(i)}t.length&&r.push({elem:s,handlers:t})}return a<o.length&&r.push({elem:e,handlers:o.slice(a)}),r}}(Util$2||(Util$2={})),function(e){e.isWindow=function(e){return null!=e&&e===e.window}}(Util$2||(Util$2={})),function(e){e.contains=function(e,t){const r=9===e.nodeType?e.documentElement:e,n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(r.contains?r.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))}}(Util$2||(Util$2={}));class EventObject{constructor(e,t){this.isDefaultPrevented=Util$2.returnFalse,this.isPropagationStopped=Util$2.returnFalse,this.isImmediatePropagationStopped=Util$2.returnFalse,this.isSimulated=!1,this.preventDefault=()=>{const e=this.originalEvent;this.isDefaultPrevented=Util$2.returnTrue,e&&!this.isSimulated&&e.preventDefault()},this.stopPropagation=()=>{const e=this.originalEvent;this.isPropagationStopped=Util$2.returnTrue,e&&!this.isSimulated&&e.stopPropagation()},this.stopImmediatePropagation=()=>{const e=this.originalEvent;this.isImmediatePropagationStopped=Util$2.returnTrue,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()},"string"==typeof e?this.type=e:e.type&&(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Util$2.returnTrue:Util$2.returnFalse,this.target=e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget,this.timeStamp=e.timeStamp),t&&Object.assign(this,t),this.timeStamp||(this.timeStamp=Date.now())}}EventObject2=EventObject||(EventObject={}),EventObject2.create=function(e){return e instanceof EventObject2?e:new EventObject2(e)},function(e){e.addProperty=function(t,r){Object.defineProperty(e.prototype,t,{enumerable:!0,configurable:!0,get:"function"==typeof r?function(){if(this.originalEvent)return r(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})}}(EventObject||(EventObject={})),function(e){const t={bubbles:!0,cancelable:!0,eventPhase:!0,detail:!0,view:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pageX:!0,pageY:!0,screenX:!0,screenY:!0,toElement:!0,pointerId:!0,pointerType:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,touches:!0,changedTouches:!0,targetTouches:!0,which:!0,altKey:!0,ctrlKey:!0,metaKey:!0,shiftKey:!0};Object.keys(t).forEach(r=>e.addProperty(r,t[r]))}(EventObject||(EventObject={})),EventHook.register("load",{noBubble:!0}),EventHook.register("beforeunload",{postDispatch(e,t){void 0!==t.result&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}),EventHook.register("mouseenter",{delegateType:"mouseover",bindType:"mouseover",handle(e,t){let r;const n=t.relatedTarget,i=t.handleObj;return n&&(n===e||Util$2.contains(e,n))||(t.type=i.originType,r=i.handler.call(e,t),t.type="mouseover"),r}}),EventHook.register("mouseleave",{delegateType:"mouseout",bindType:"mouseout",handle(e,t){let r;const n=t.relatedTarget,i=t.handleObj;return n&&(n===e||Util$2.contains(e,n))||(t.type=i.originType,r=i.handler.call(e,t),t.type="mouseout"),r}});var __rest$s=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},Core,Event$1,Event2,Private$5,Private2;!function(e){let t;function r(e,t,...r){const n=EventObject.create(t);n.delegateTarget=e;const i=EventHook.get(n.type);if(i.preDispatch&&!1===i.preDispatch(e,n))return;const o=Util$2.getHandlerQueue(e,n);for(let a=0,s=o.length;a<s&&!n.isPropagationStopped();a+=1){const e=o[a];n.currentTarget=e.elem;for(let t=0,i=e.handlers.length;t<i&&!n.isImmediatePropagationStopped();t+=1){const i=e.handlers[t];if(null==n.rnamespace||i.namespace&&n.rnamespace.test(i.namespace)){n.handleObj=i,n.data=i.data;const t=EventHook.get(i.originType).handle,o=t?t(e.elem,n,...r):i.handler.call(e.elem,n,...r);void 0!==o&&(n.result=o,!1===o&&(n.preventDefault(),n.stopPropagation()))}}}return i.postDispatch&&i.postDispatch(e,n),n.result}e.on=function(e,n,i,o,a){if(!Util$2.isValidTarget(e))return;let s;if("function"!=typeof i){const{handler:e,selector:t}=i,r=__rest$s(i,["handler","selector"]);i=e,a=t,s=r}const l=Store$1.ensure(e);let c=l.handler;null==c&&(c=l.handler=function(n,...i){return t!==n.type?r(e,n,...i):void 0});const u=Util$2.ensureHandlerId(i);Util$2.splitType(n).forEach(t=>{const{originType:r,namespaces:n}=Util$2.normalizeType(t);if(!r)return;let d=r,p=EventHook.get(d);d=(a?p.delegateType:p.bindType)||d,p=EventHook.get(d);const h=Object.assign({type:d,originType:r,data:o,selector:a,guid:u,handler:i,namespace:n.join(".")},s),f=l.events;let g=f[d];g||(g=f[d]={handlers:[],delegateCount:0},p.setup&&!1!==p.setup(e,o,n,c)||Util$2.addEventListener(e,d,c)),p.add&&(Util$2.removeHandlerId(h.handler),p.add(e,h),Util$2.setHandlerId(h.handler,u)),a?(g.handlers.splice(g.delegateCount,0,h),g.delegateCount+=1):g.handlers.push(h)})},e.off=function e(t,r,n,i,o){const a=Store$1.get(t);if(!a)return;const s=a.events;s&&(Util$2.splitType(r).forEach(r=>{const{originType:l,namespaces:c}=Util$2.normalizeType(r);if(!l)return void Object.keys(s).forEach(o=>{e(t,o+r,n,i,!0)});let u=l;const d=EventHook.get(u);u=(i?d.delegateType:d.bindType)||u;const p=s[u];if(!p)return;const h=c.length>0?new RegExp(`(^|\\.)${c.join("\\.(?:.*\\.|)")}(\\.|$)`):null,f=p.handlers.length;for(let e=p.handlers.length-1;e>=0;e-=1){const r=p.handlers[e];!o&&l!==r.originType||n&&Util$2.getHandlerId(n)!==r.guid||!(null==h||r.namespace&&h.test(r.namespace))||!(null==i||i===r.selector||"**"===i&&r.selector)||(p.handlers.splice(e,1),r.selector&&(p.delegateCount-=1),d.remove&&d.remove(t,r))}f&&0===p.handlers.length&&(d.teardown&&!1!==d.teardown(t,c,a.handler)||Util$2.removeEventListener(t,u,a.handler),delete s[u])}),0===Object.keys(s).length&&Store$1.remove(t))},e.dispatch=r,e.trigger=function(e,r,n,i){let o=e,a="string"==typeof e?e:e.type,s="string"==typeof e||null==o.namespace?[]:o.namespace.split(".");const l=n;if(3===l.nodeType||8===l.nodeType)return;a.indexOf(".")>-1&&(s=a.split("."),a=s.shift(),s.sort());const c=a.indexOf(":")<0&&`on${a}`;o=e instanceof EventObject?e:new EventObject(a,"object"==typeof e?e:null),o.namespace=s.join("."),o.rnamespace=o.namespace?new RegExp(`(^|\\.)${s.join("\\.(?:.*\\.|)")}(\\.|$)`):null,o.result=void 0,o.target||(o.target=l);const u=[o];Array.isArray(r)?u.push(...r):u.push(r);const d=EventHook.get(a);if(!i&&d.trigger&&!1===d.trigger(l,o,r))return;let p;const h=[l];if(!i&&!d.noBubble&&!Util$2.isWindow(l)){p=d.delegateType||a;let e=l,t=l.parentNode;for(;null!=t;)h.push(t),e=t,t=t.parentNode;if(e===(l.ownerDocument||document)){const t=e.defaultView||e.parentWindow||window;h.push(t)}}let f=l;for(let t=0,g=h.length;t<g&&!o.isPropagationStopped();t+=1){const e=h[t];f=e,o.type=t>1?p:d.bindType||a;const r=Store$1.get(e);r&&r.events[o.type]&&r.handler&&r.handler.call(e,...u);const n=c&&e[c]||null;n&&Util$2.isValidTarget(e)&&(o.result=n.call(e,...u),!1===o.result&&o.preventDefault())}if(o.type=a,!i&&!o.isDefaultPrevented()){const e=d.preventDefault;if((null==e||!1===e(h.pop(),o,r))&&Util$2.isValidTarget(l)&&c&&"function"==typeof l[a]&&!Util$2.isWindow(l)){const e=l[c];e&&(l[c]=null),t=a,o.isPropagationStopped()&&f.addEventListener(a,Util$2.stopPropagationCallback),l[a](),o.isPropagationStopped()&&f.removeEventListener(a,Util$2.stopPropagationCallback),t=void 0,e&&(l[c]=e)}}return o.result}}(Core||(Core={})),Event2=Event$1||(Event$1={}),Event2.on=function(e,t,r,n,i){return Private$5.on(e,t,r,n,i),e},Event2.once=function(e,t,r,n,i){return Private$5.on(e,t,r,n,i,!0),e},Event2.off=function(e,t,r,n){return Private$5.off(e,t,r,n),e},Event2.trigger=function(e,t,r,n){return Core.trigger(t,r,e,n),e},Private2=Private$5||(Private$5={}),Private2.on=function e(t,r,n,i,o,a){if("object"==typeof r)return"string"!=typeof n&&(i=i||n,n=void 0),void Object.keys(r).forEach(o=>e(t,o,n,i,r[o],a));if(null==i&&null==o?(o=n,i=n=void 0):null==o&&("string"==typeof n?(o=i,i=void 0):(o=i,i=n,n=void 0)),!1===o)o=Util$2.returnFalse;else if(!o)return;if(a){const e=o;o=function(r,...n){return Private2.off(t,r),e.call(this,r,...n)},Util$2.setHandlerId(o,Util$2.ensureHandlerId(e))}Core.on(t,r,o,i,n)},Private2.off=function e(t,r,n,i){const o=r;if(o&&null!=o.preventDefault&&null!=o.handleObj){const t=o.handleObj;return void e(o.delegateTarget,t.namespace?`${t.originType}.${t.namespace}`:t.originType,t.selector,t.handler)}if("object"==typeof r){const i=r;return void Object.keys(i).forEach(r=>e(t,r,n,i[r]))}!1!==n&&"function"!=typeof n||(i=n,n=void 0),!1===i&&(i=Util$2.returnFalse),Core.off(t,r,i,n)};class MouseWheelHandle{constructor(e,t,r){this.animationFrameId=0,this.deltaX=0,this.deltaY=0,this.eventName=Platform.isEventSupported("wheel")?"wheel":"mousewheel",this.target=e,this.onWheelCallback=t,this.onWheelGuard=r,this.onWheel=this.onWheel.bind(this),this.didWheel=this.didWheel.bind(this)}enable(){this.target.addEventListener(this.eventName,this.onWheel,{passive:!1})}disable(){this.target.removeEventListener(this.eventName,this.onWheel)}onWheel(e){if(null!=this.onWheelGuard&&!this.onWheelGuard(e))return;let t;this.deltaX+=e.deltaX,this.deltaY+=e.deltaY,e.preventDefault(),0===this.deltaX&&0===this.deltaY||(e.stopPropagation(),t=!0),!0===t&&0===this.animationFrameId&&(this.animationFrameId=requestAnimationFrame(()=>{this.didWheel(e)}))}didWheel(e){this.animationFrameId=0,this.onWheelCallback(e,this.deltaX,this.deltaY),this.deltaX=0,this.deltaY=0}}function offset$1(e){const t=e.getBoundingClientRect(),r=e.ownerDocument.defaultView;return{top:t.top+r.pageYOffset,left:t.left+r.pageXOffset}}function width$1(e){return e.getBoundingClientRect().width}function height$1(e){return e.getBoundingClientRect().height}function debounce(e,t=60){let r=null;return(...n)=>{r&&clearTimeout(r),r=window.setTimeout(()=>{e.apply(this,n)},t)}}function createSensor$2(e){let t=null,r=[];const n=debounce(()=>{r.forEach(t=>t(e))}),i=()=>{t&&t.parentNode&&(t.contentDocument&&t.contentDocument.defaultView.removeEventListener("resize",n),t.parentNode.removeChild(t),t=null,r=[])};return{element:e,bind:i=>{t||(t=(()=>{"static"===getComputedStyle(e).position&&(e.style.position="relative");const t=document.createElement("object");return t.onload=()=>{t.contentDocument.defaultView.addEventListener("resize",n),n()},t.style.display="block",t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.height="100%",t.style.width="100%",t.style.overflow="hidden",t.style.pointerEvents="none",t.style.zIndex="-1",t.style.opacity="0",t.setAttribute("tabindex","-1"),t.type="text/html",e.appendChild(t),t.data="about:blank",t})()),-1===r.indexOf(i)&&r.push(i)},destroy:i,unbind:e=>{const n=r.indexOf(e);-1!==n&&r.splice(n,1),0===r.length&&t&&i()}}}function createSensor$1(e){let t=null,r=[];const n=debounce(()=>{r.forEach(t=>{t(e)})}),i=()=>{t&&(t.disconnect(),r=[],t=null)};return{element:e,bind:i=>{t||(t=(()=>{const t=new ResizeObserver(n);return t.observe(e),n(),t})()),-1===r.indexOf(i)&&r.push(i)},destroy:i,unbind:e=>{const n=r.indexOf(e);-1!==n&&r.splice(n,1),0===r.length&&t&&i()}}}const createSensor="undefined"!=typeof ResizeObserver?createSensor$1:createSensor$2;var SizeSensor,PriorityQueue2,Dijkstra,Dijkstra2,Color2,ModifierKey,Timing,Timing2,Interp,Interp2;!function(e){const t=new WeakMap;function r(e){let r=t.get(e);return r||(r=createSensor(e),t.set(e,r),r)}e.bind=(e,t)=>{const n=r(e);return n.bind(t),()=>n.unbind(t)},e.clear=e=>{!function(e){e.destroy(),t.delete(e.element)}(r(e))}}(SizeSensor||(SizeSensor={}));class PriorityQueue{constructor(e={}){this.comparator=e.comparator||PriorityQueue.defaultComparator,this.index={},this.data=e.data||[],this.heapify()}isEmpty(){return 0===this.data.length}insert(e,t,r){const n={priority:e,value:t},i=this.data.length;return r&&(n.id=r,this.index[r]=i),this.data.push(n),this.bubbleUp(i),this}peek(){return this.data[0]?this.data[0].value:null}peekPriority(){return this.data[0]?this.data[0].priority:null}updatePriority(e,t){const r=this.index[e];if(void 0===r)throw new Error(`Node with id '${e}' was not found in the heap.`);const n=this.data,i=n[r].priority,o=this.comparator(t,i);o<0?(n[r].priority=t,this.bubbleUp(r)):o>0&&(n[r].priority=t,this.bubbleDown(r))}remove(){const e=this.data,t=e[0],r=e.pop();return t.id&&delete this.index[t.id],e.length>0&&(e[0]=r,r.id&&(this.index[r.id]=0),this.bubbleDown(0)),t?t.value:null}heapify(){for(let e=0;e<this.data.length;e+=1)this.bubbleUp(e)}bubbleUp(e){const t=this.data;let r,n,i=e;for(;i>0&&(n=i-1>>>1,this.comparator(t[i].priority,t[n].priority)<0);){r=t[n],t[n]=t[i];let e=t[i].id;null!=e&&(this.index[e]=n),t[i]=r,e=t[i].id,null!=e&&(this.index[e]=i),i=n}}bubbleDown(e){const t=this.data,r=t.length-1;let n=e;for(;;){const e=1+(n<<1),i=e+1;let o=n;if(e<=r&&this.comparator(t[e].priority,t[o].priority)<0&&(o=e),i<=r&&this.comparator(t[i].priority,t[o].priority)<0&&(o=i),o===n)break;{const e=t[o];t[o]=t[n];let r=t[n].id;null!=r&&(this.index[r]=o),t[n]=e,r=t[n].id,null!=r&&(this.index[r]=n),n=o}}}}PriorityQueue2=PriorityQueue||(PriorityQueue={}),PriorityQueue2.defaultComparator=(e,t)=>e-t,Dijkstra2=Dijkstra||(Dijkstra={}),Dijkstra2.run=function(e,t,r=(e,t)=>1){const n={},i={},o={},a=new PriorityQueue;for(n[t]=0,Object.keys(e).forEach(e=>{e!==t&&(n[e]=1/0),a.insert(n[e],e,e)});!a.isEmpty();){const t=a.remove();o[t]=!0;const s=e[t]||[];for(let e=0;e<s.length;e+=1){const l=s[e];if(!o[l]){const e=n[t]+r(t,l);e<n[l]&&(n[l]=e,i[l]=t,a.updatePriority(l,e))}}}return i};class Color{constructor(e,t,r,n){return null==e?this.set(255,255,255,1):"number"==typeof e?this.set(e,t,r,n):"string"==typeof e?Color.fromString(e)||this:Array.isArray(e)?this.set(e):void this.set(e.r,e.g,e.b,null==e.a?1:e.a)}blend(e,t,r){this.set(e.r+(t.r-e.r)*r,e.g+(t.g-e.g)*r,e.b+(t.b-e.b)*r,e.a+(t.a-e.a)*r)}lighten(e){const t=Color.lighten(this.toArray(),e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}darken(e){this.lighten(-e)}set(e,t,r,n){const i=Array.isArray(e)?e[0]:e,o=Array.isArray(e)?e[1]:t,a=Array.isArray(e)?e[2]:r,s=Array.isArray(e)?e[3]:n;return this.r=Math.round(clamp(i,0,255)),this.g=Math.round(clamp(o,0,255)),this.b=Math.round(clamp(a,0,255)),this.a=null==s?1:clamp(s,0,1),this}toHex(){return`#${["r","g","b"].map(e=>{const t=this[e].toString(16);return t.length<2?`0${t}`:t}).join("")}`}toRGBA(){return this.toArray()}toHSLA(){return Color.rgba2hsla(this.r,this.g,this.b,this.a)}toCSS(e){const t=`${this.r},${this.g},${this.b},`;return e?`rgb(${t})`:`rgba(${t},${this.a})`}toGrey(){return Color.makeGrey(Math.round((this.r+this.g+this.b)/3),this.a)}toArray(){return[this.r,this.g,this.b,this.a]}toString(){return this.toCSS()}}!function(e){function t(t){return new e([...s(t),1])}function r(t){const r=t.toLowerCase().match(/^rgba?\(([\s.,0-9]+)\)/);if(r){const t=r[1].split(/\s*,\s*/).map(e=>parseInt(e,10));return new e(t)}return null}function n(e,t,r){r<0&&++r,r>1&&--r;const n=6*r;return n<1?e+(t-e)*n:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}function i(t){const r=t.toLowerCase().match(/^hsla?\(([\s.,0-9]+)\)/);if(r){const t=r[2].split(/\s*,\s*/),n=(parseFloat(t[0])%360+360)%360/360,i=parseFloat(t[1])/100,a=parseFloat(t[2])/100,s=null==t[3]?1:parseInt(t[3],10);return new e(o(n,i,a,s))}return null}function o(e,t,r,i){const o=Array.isArray(e)?e[0]:e,a=Array.isArray(e)?e[1]:t,s=Array.isArray(e)?e[2]:r,l=Array.isArray(e)?e[3]:i,c=s<=.5?s*(a+1):s+a-s*a,u=2*s-c;return[256*n(u,c,o+1/3),256*n(u,c,o),256*n(u,c,o-1/3),null==l?1:l]}function a(t){return new e(Math.round(256*Math.random()),Math.round(256*Math.random()),Math.round(256*Math.random()),t?void 0:parseFloat(Math.random().toFixed(2)))}function s(e){const t=0===e.indexOf("#")?e:`#${e}`;let r=Number(`0x${t.substr(1)}`);if(4!==t.length&&7!==t.length||Number.isNaN(r))throw new Error("Invalid hex color.");const n=4===t.length?4:8,i=(1<<n)-1,o=["b","g","r"].map(()=>{const e=r&i;return r>>=n,4===n?17*e:e});return[o[2],o[1],o[0]]}function l(e,t,r){const n=e=>e.length<2?`0${e}`:e;return`${n(e.toString(16))}${n(t.toString(16))}${n(r.toString(16))}`}function c(e,t){if("string"==typeof e){const r="#"===e[0],n=parseInt(r?e.substr(1):e,16),i=clamp((n>>16)+t,0,255),o=clamp((n>>8&255)+t,0,255);return`${r?"#":""}${(clamp((255&n)+t,0,255)|o<<8|i<<16).toString(16)}`}const r=s(c(l(e[0],e[1],e[2]),t));return[r[0],r[1],r[2],e[3]]}e.fromArray=function(t){return new e(t)},e.fromHex=t,e.fromRGBA=r,e.fromHSLA=i,e.fromString=function(n){if(n.startsWith("#"))return t(n);if(n.startsWith("rgb"))return r(n);const o=e.named[n];return o?t(o):i(n)},e.makeGrey=function(t,r){return e.fromArray([t,t,t,r])},e.rgba2hsla=function(e,t,r,n){const i=Array.isArray(e)?e[0]:e,o=Array.isArray(e)?e[1]:t,a=Array.isArray(e)?e[2]:r,s=Array.isArray(e)?e[3]:n,l=Math.max(i,o,a),c=Math.min(i,o,a),u=(l+c)/2;let d=0,p=0;if(c!==l){const e=l-c;switch(p=u>.5?e/(2-l-c):e/(l+c),l){case i:d=(o-a)/e+(o<a?6:0);break;case o:d=(a-i)/e+2;break;case a:d=(i-o)/e+4}d/=6}return[d,p,u,null==s?1:s]},e.hsla2rgba=o,e.random=a,e.randomHex=function(){let e="#";for(let t=0;t<6;t+=1)e+="0123456789ABCDEF"[Math.floor(16*Math.random())];return e},e.randomRGBA=function(e){return a(e).toString()},e.invert=function(e,t){if("string"==typeof e){const r="#"===e[0],[n,i,o]=s(e);return t?.299*n+.587*i+.114*o>186?"#000000":"#ffffff":`${r?"#":""}${l(255-n,255-i,255-o)}`}const r=e[0],n=e[1],i=e[2],o=e[3];return t?.299*r+.587*n+.114*i>186?[0,0,0,o]:[255,255,255,o]:[255-r,255-n,255-i,o]},e.lighten=function(e,t){return c(e,t)},e.darken=function(e,t){return c(e,-t)}}(Color||(Color={})),Color2=Color||(Color={}),Color2.named={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",burntsienna:"#ea7e5d",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};class Dictionary{constructor(){this.clear()}clear(){this.map=new WeakMap,this.arr=[]}has(e){return this.map.has(e)}get(e){return this.map.get(e)}set(e,t){this.map.set(e,t),this.arr.push(e)}delete(e){const t=this.arr.indexOf(e);t>=0&&this.arr.splice(t,1);const r=this.map.get(e);return this.map.delete(e),r}each(e){this.arr.forEach(t=>{const r=this.map.get(t);e(r,t)})}dispose(){this.clear()}}!function(e){function t(e){const t=[],r=[];return Array.isArray(e)?t.push(...e):e.split("|").forEach(e=>{-1===e.indexOf("&")?t.push(e):r.push(...e.split("&"))}),{or:t,and:r}}e.parse=t,e.equals=function(e,r){if(null!=e&&null!=r){const n=t(e),i=t(r),o=n.or.sort(),a=i.or.sort(),s=n.and.sort(),l=i.and.sort(),c=(e,t)=>e.length===t.length&&(0===e.length||e.every((e,r)=>e===t[r]));return c(o,a)&&c(s,l)}return null==e&&null==r},e.isMatch=function(e,r,n){if(null==r||Array.isArray(r)&&0===r.length)return!n||!0!==e.altKey&&!0!==e.ctrlKey&&!0!==e.metaKey&&!0!==e.shiftKey;const{or:i,and:o}=t(r),a=t=>{const r=`${t.toLowerCase()}Key`;return!0===e[r]};return i.some(e=>a(e))&&o.every(e=>a(e))}}(ModifierKey||(ModifierKey={})),Timing2=Timing||(Timing={}),Timing2.linear=e=>e,Timing2.quad=e=>e*e,Timing2.cubic=e=>e*e*e,Timing2.inout=e=>{if(e<=0)return 0;if(e>=1)return 1;const t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)},Timing2.exponential=e=>Math.pow(2,10*(e-1)),Timing2.bounce=e=>{for(let t=0,r=1;;t+=r,r/=2)if(e>=(7-4*t)/11){const n=(11-6*t-11*e)/4;return-n*n+r*r}},function(e){e.decorators={reverse:e=>t=>1-e(1-t),reflect:e=>t=>.5*(t<.5?e(2*t):2-e(2-2*t)),clamp:(e,t=0,r=1)=>n=>{const i=e(n);return i<t?t:i>r?r:i},back:(e=1.70158)=>t=>t*t*((e+1)*t-e),elastic:(e=1.5)=>t=>Math.pow(2,10*(t-1))*Math.cos(20*Math.PI*e/3*t)}}(Timing||(Timing={})),function(e){function t(e){const t=e/1;if(t<1/2.75)return 7.5625*t*t;if(t<2/2.75){const e=t-1.5/2.75;return 7.5625*e*e+.75}if(t<2.5/2.75){const e=t-2.25/2.75;return 7.5625*e*e+.9375}{const e=t-2.625/2.75;return 7.5625*e*e+.984375}}function r(e){return 1-t(1-e)}e.easeInSine=function(e){return-1*Math.cos(e*(Math.PI/2))+1},e.easeOutSine=function(e){return Math.sin(e*(Math.PI/2))},e.easeInOutSine=function(e){return-.5*(Math.cos(Math.PI*e)-1)},e.easeInQuad=function(e){return e*e},e.easeOutQuad=function(e){return e*(2-e)},e.easeInOutQuad=function(e){return e<.5?2*e*e:(4-2*e)*e-1},e.easeInCubic=function(e){return e*e*e},e.easeOutCubic=function(e){const t=e-1;return t*t*t+1},e.easeInOutCubic=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},e.easeInQuart=function(e){return e*e*e*e},e.easeOutQuart=function(e){const t=e-1;return 1-t*t*t*t},e.easeInOutQuart=function(e){const t=e-1;return e<.5?8*e*e*e*e:1-8*t*t*t*t},e.easeInQuint=function(e){return e*e*e*e*e},e.easeOutQuint=function(e){const t=e-1;return 1+t*t*t*t*t},e.easeInOutQuint=function(e){const t=e-1;return e<.5?16*e*e*e*e*e:1+16*t*t*t*t*t},e.easeInExpo=function(e){return 0===e?0:Math.pow(2,10*(e-1))},e.easeOutExpo=function(e){return 1===e?1:1-Math.pow(2,-10*e)},e.easeInOutExpo=function(e){if(0===e||1===e)return e;const t=2*e,r=t-1;return t<1?.5*Math.pow(2,10*r):.5*(2-Math.pow(2,-10*r))},e.easeInCirc=function(e){const t=e/1;return-1*(Math.sqrt(1-t*e)-1)},e.easeOutCirc=function(e){const t=e-1;return Math.sqrt(1-t*t)},e.easeInOutCirc=function(e){const t=2*e,r=t-2;return t<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-r*r)+1)},e.easeInBack=function(e,t=1.70158){return e*e*((t+1)*e-t)},e.easeOutBack=function(e,t=1.70158){const r=e/1-1;return r*r*((t+1)*r+t)+1},e.easeInOutBack=function(e,t=1.70158){const r=2*e,n=r-2,i=1.525*t;return r<1?.5*r*r*((i+1)*r-i):.5*(n*n*((i+1)*n+i)+2)},e.easeInElastic=function(e,t=.7){if(0===e||1===e)return e;const r=e/1-1,n=1-t,i=n/(2*Math.PI)*Math.asin(1);return-Math.pow(2,10*r)*Math.sin((r-i)*(2*Math.PI)/n)},e.easeOutElastic=function(e,t=.7){const r=1-t,n=2*e;if(0===e||1===e)return e;const i=r/(2*Math.PI)*Math.asin(1);return Math.pow(2,-10*n)*Math.sin((n-i)*(2*Math.PI)/r)+1},e.easeInOutElastic=function(e,t=.65){const r=1-t;if(0===e||1===e)return e;const n=2*e,i=n-1,o=r/(2*Math.PI)*Math.asin(1);return n<1?Math.pow(2,10*i)*Math.sin((i-o)*(2*Math.PI)/r)*-.5:Math.pow(2,-10*i)*Math.sin((i-o)*(2*Math.PI)/r)*.5+1},e.easeOutBounce=t,e.easeInBounce=r,e.easeInOutBounce=function(e){return e<.5?.5*r(2*e):.5*t(2*e-1)+.5}}(Timing||(Timing={})),Interp2=Interp||(Interp={}),Interp2.number=(e,t)=>{const r=t-e;return t=>e+r*t},Interp2.object=(e,t)=>{const r=Object.keys(e);return n=>{const i={};for(let o=r.length-1;-1!==o;o-=1){const a=r[o];i[a]=e[a]+(t[a]-e[a])*n}return i}},Interp2.unit=(e,t)=>{const r=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/,n=r.exec(e),i=r.exec(t),o=i?i[1]:"",a=n?+n[1]:0,s=i?+i[1]:0,l=o.indexOf("."),c=l>0?o[1].length-l-1:0,u=s-a,d=n?n[2]:"";return e=>(a+u*e).toFixed(c)+d},Interp2.color=(e,t)=>{const r=parseInt(e.slice(1),16),n=parseInt(t.slice(1),16),i=255&r,o=(255&n)-i,a=65280&r,s=(65280&n)-a,l=16711680&r,c=(16711680&n)-l;return e=>`#${(1<<24|i+o*e&255|a+s*e&65280|l+c*e&16711680).toString(16).slice(1)}`};const cssModules=[];function ensure(e,t){const r=cssModules.find(t=>t.name===e);if(!(r&&(r.loadTimes+=1,r.loadTimes>1)||Platform.isApplyingHMR())){const r=document.createElement("style");r.setAttribute("type","text/css"),r.textContent=t;const n=document.querySelector("head");n&&n.insertBefore(r,n.firstChild),cssModules.push({name:e,loadTimes:1,styleElement:r})}}function clean(e){const t=cssModules.findIndex(t=>t.name===e);if(t>-1){const e=cssModules[t];if(e.loadTimes-=1,e.loadTimes>0)return;let r=e.styleElement;r&&r.parentNode&&r.parentNode.removeChild(r),r=null,cssModules.splice(t,1)}}var Angle,Angle2,GeometryUtil,GeometryUtil2,Point2,Rectangle2,Line2,Ellipse2;Angle2=Angle||(Angle={}),Angle2.toDeg=function(e){return 180*e/Math.PI%360},Angle2.toRad=function(e,t=!1){return(t?e:e%360)*Math.PI/180},Angle2.normalize=function(e){return e%360+(e<0?360:0)},GeometryUtil2=GeometryUtil||(GeometryUtil={}),GeometryUtil2.round=function(e,t=0){return Number.isInteger(e)?e:+e.toFixed(t)},GeometryUtil2.random=function(e,t){let r,n;if(null==t?(n=null==e?1:e,r=0):(n=t,r=null==e?0:e),n<r){const e=r;r=n,n=e}return Math.floor(Math.random()*(n-r+1)+r)},GeometryUtil2.clamp=function(e,t,r){return Number.isNaN(e)?NaN:Number.isNaN(t)||Number.isNaN(r)?0:t<r?e<t?t:e>r?r:e:e<r?r:e>t?t:e},GeometryUtil2.snapToGrid=function(e,t){return t*Math.round(e/t)},GeometryUtil2.containsPoint=function(e,t){return null!=t&&null!=e&&t.x>=e.x&&t.x<=e.x+e.width&&t.y>=e.y&&t.y<=e.y+e.height},GeometryUtil2.squaredLength=function(e,t){const r=e.x-t.x,n=e.y-t.y;return r*r+n*n};class Geometry{valueOf(){return this.toJSON()}toString(){return JSON.stringify(this.toJSON())}}class Point extends Geometry{constructor(e,t){super(),this.x=null==e?0:e,this.y=null==t?0:t}round(e=0){return this.x=GeometryUtil.round(this.x,e),this.y=GeometryUtil.round(this.y,e),this}add(e,t){const r=Point.create(e,t);return this.x+=r.x,this.y+=r.y,this}update(e,t){const r=Point.create(e,t);return this.x=r.x,this.y=r.y,this}translate(e,t){const r=Point.create(e,t);return this.x+=r.x,this.y+=r.y,this}rotate(e,t){const r=Point.rotate(this,e,t);return this.x=r.x,this.y=r.y,this}scale(e,t,r=new Point){const n=Point.create(r);return this.x=n.x+e*(this.x-n.x),this.y=n.y+t*(this.y-n.y),this}closest(e){if(1===e.length)return Point.create(e[0]);let t=null,r=1/0;return e.forEach(e=>{const n=this.squaredDistance(e);n<r&&(t=e,r=n)}),t?Point.create(t):null}distance(e){return Math.sqrt(this.squaredDistance(e))}squaredDistance(e){const t=Point.create(e),r=this.x-t.x,n=this.y-t.y;return r*r+n*n}manhattanDistance(e){const t=Point.create(e);return Math.abs(t.x-this.x)+Math.abs(t.y-this.y)}magnitude(){return Math.sqrt(this.x*this.x+this.y*this.y)||.01}theta(e=new Point){const t=Point.create(e),r=-(t.y-this.y),n=t.x-this.x;let i=Math.atan2(r,n);return i<0&&(i=2*Math.PI+i),180*i/Math.PI}angleBetween(e,t){if(this.equals(e)||this.equals(t))return NaN;let r=this.theta(t)-this.theta(e);return r<0&&(r+=360),r}vectorAngle(e){return new Point(0,0).angleBetween(this,e)}toPolar(e){return this.update(Point.toPolar(this,e)),this}changeInAngle(e,t,r=new Point){return this.clone().translate(-e,-t).theta(r)-this.theta(r)}adhereToRect(e){return GeometryUtil.containsPoint(e,this)||(this.x=Math.min(Math.max(this.x,e.x),e.x+e.width),this.y=Math.min(Math.max(this.y,e.y),e.y+e.height)),this}bearing(e){const t=Point.create(e),r=Angle.toRad(this.y),n=Angle.toRad(t.y),i=this.x,o=t.x,a=Angle.toRad(o-i),s=Math.sin(a)*Math.cos(n),l=Math.cos(r)*Math.sin(n)-Math.sin(r)*Math.cos(n)*Math.cos(a);let c=Angle.toDeg(Math.atan2(s,l))-22.5;return c<0&&(c+=360),c=parseInt(c/45,10),["NE","E","SE","S","SW","W","NW","N"][c]}cross(e,t){if(null!=e&&null!=t){const r=Point.create(e),n=Point.create(t);return(n.x-this.x)*(r.y-this.y)-(n.y-this.y)*(r.x-this.x)}return NaN}dot(e){const t=Point.create(e);return this.x*t.x+this.y*t.y}diff(e,t){if("number"==typeof e)return new Point(this.x-e,this.y-t);const r=Point.create(e);return new Point(this.x-r.x,this.y-r.y)}lerp(e,t){const r=Point.create(e);return new Point((1-t)*this.x+t*r.x,(1-t)*this.y+t*r.y)}normalize(e=1){const t=e/this.magnitude();return this.scale(t,t)}move(e,t){const r=Point.create(e),n=Angle.toRad(r.theta(this));return this.translate(Math.cos(n)*t,-Math.sin(n)*t)}reflection(e){return Point.create(e).move(this,this.distance(e))}snapToGrid(e,t){return this.x=GeometryUtil.snapToGrid(this.x,e),this.y=GeometryUtil.snapToGrid(this.y,null==t?e:t),this}equals(e){const t=Point.create(e);return null!=t&&t.x===this.x&&t.y===this.y}clone(){return Point.clone(this)}toJSON(){return Point.toJSON(this)}serialize(){return`${this.x} ${this.y}`}}Point2=Point||(Point={}),Point2.isPoint=function(e){return null!=e&&e instanceof Point2},function(e){e.isPointLike=function(e){return null!=e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y},e.isPointData=function(e){return null!=e&&Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}}(Point||(Point={})),function(e){function t(t){return e.isPoint(t)?new e(t.x,t.y):Array.isArray(t)?new e(t[0],t[1]):new e(t.x,t.y)}function r(e,t){return e===t||null!=e&&null!=t&&(e.x===t.x&&e.y===t.y)}function n(r,n,i,o=new e){const a=t(r),s=t(o),l=a.x-s.x,c=a.y-s.y,u=c*n+l*i;return new e(l*n-c*i+s.x,u+s.y)}e.create=function(r,n){return null==r||"number"==typeof r?new e(r,n):t(r)},e.clone=t,e.toJSON=function(t){return e.isPoint(t)?{x:t.x,y:t.y}:Array.isArray(t)?{x:t[0],y:t[1]}:{x:t.x,y:t.y}},e.fromPolar=function(r,n,i=new e){let o=Math.abs(r*Math.cos(n)),a=Math.abs(r*Math.sin(n));const s=t(i),l=Angle.normalize(Angle.toDeg(n));return l<90?a=-a:l<180?(o=-o,a=-a):l<270&&(o=-o),new e(s.x+o,s.y+a)},e.toPolar=function(r,n=new e){const i=t(r),o=t(n),a=i.x-o.x,s=i.y-o.y;return new e(Math.sqrt(a*a+s*s),Angle.toRad(o.theta(i)))},e.equals=r,e.equalPoints=function(e,t){if(null==e&&null!=t||null!=e&&null==t||null!=e&&null!=t&&e.length!==t.length)return!1;if(null!=e&&null!=t)for(let n=0,i=e.length;n<i;n+=1)if(!r(e[n],t[n]))return!1;return!0},e.random=function(t,r,n,i){return new e(GeometryUtil.random(t,r),GeometryUtil.random(n,i))},e.rotate=function(e,t,r){const i=Angle.toRad(Angle.normalize(-t)),o=Math.sin(i);return n(e,Math.cos(i),o,r)},e.rotateEx=n}(Point||(Point={}));class Rectangle extends Geometry{get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get origin(){return new Point(this.x,this.y)}get topLeft(){return new Point(this.x,this.y)}get topCenter(){return new Point(this.x+this.width/2,this.y)}get topRight(){return new Point(this.x+this.width,this.y)}get center(){return new Point(this.x+this.width/2,this.y+this.height/2)}get bottomLeft(){return new Point(this.x,this.y+this.height)}get bottomCenter(){return new Point(this.x+this.width/2,this.y+this.height)}get bottomRight(){return new Point(this.x+this.width,this.y+this.height)}get corner(){return new Point(this.x+this.width,this.y+this.height)}get rightMiddle(){return new Point(this.x+this.width,this.y+this.height/2)}get leftMiddle(){return new Point(this.x,this.y+this.height/2)}get topLine(){return new Line(this.topLeft,this.topRight)}get rightLine(){return new Line(this.topRight,this.bottomRight)}get bottomLine(){return new Line(this.bottomLeft,this.bottomRight)}get leftLine(){return new Line(this.topLeft,this.bottomLeft)}constructor(e,t,r,n){super(),this.x=null==e?0:e,this.y=null==t?0:t,this.width=null==r?0:r,this.height=null==n?0:n}getOrigin(){return this.origin}getTopLeft(){return this.topLeft}getTopCenter(){return this.topCenter}getTopRight(){return this.topRight}getCenter(){return this.center}getCenterX(){return this.x+this.width/2}getCenterY(){return this.y+this.height/2}getBottomLeft(){return this.bottomLeft}getBottomCenter(){return this.bottomCenter}getBottomRight(){return this.bottomRight}getCorner(){return this.corner}getRightMiddle(){return this.rightMiddle}getLeftMiddle(){return this.leftMiddle}getTopLine(){return this.topLine}getRightLine(){return this.rightLine}getBottomLine(){return this.bottomLine}getLeftLine(){return this.leftLine}bbox(e){if(!e)return this.clone();const t=Angle.toRad(e),r=Math.abs(Math.sin(t)),n=Math.abs(Math.cos(t)),i=this.width*n+this.height*r,o=this.width*r+this.height*n;return new Rectangle(this.x+(this.width-i)/2,this.y+(this.height-o)/2,i,o)}round(e=0){return this.x=GeometryUtil.round(this.x,e),this.y=GeometryUtil.round(this.y,e),this.width=GeometryUtil.round(this.width,e),this.height=GeometryUtil.round(this.height,e),this}add(e,t,r,n){const i=Rectangle.create(e,t,r,n),o=Math.min(this.x,i.x),a=Math.min(this.y,i.y),s=Math.max(this.x+this.width,i.x+i.width),l=Math.max(this.y+this.height,i.y+i.height);return this.x=o,this.y=a,this.width=s-o,this.height=l-a,this}update(e,t,r,n){const i=Rectangle.create(e,t,r,n);return this.x=i.x,this.y=i.y,this.width=i.width,this.height=i.height,this}inflate(e,t){const r=e,n=null!=t?t:e;return this.x-=r,this.y-=n,this.width+=2*r,this.height+=2*n,this}snapToGrid(e,t){const r=this.origin.snapToGrid(e,t),n=this.corner.snapToGrid(e,t);return this.x=r.x,this.y=r.y,this.width=n.x-r.x,this.height=n.y-r.y,this}translate(e,t){const r=Point.create(e,t);return this.x+=r.x,this.y+=r.y,this}scale(e,t,r=new Point){const n=this.origin.scale(e,t,r);return this.x=n.x,this.y=n.y,this.width*=e,this.height*=t,this}rotate(e,t=this.getCenter()){if(0!==e){const r=Angle.toRad(e),n=Math.cos(r),i=Math.sin(r);let o=this.getOrigin(),a=this.getTopRight(),s=this.getBottomRight(),l=this.getBottomLeft();o=Point.rotateEx(o,n,i,t),a=Point.rotateEx(a,n,i,t),s=Point.rotateEx(s,n,i,t),l=Point.rotateEx(l,n,i,t);const c=new Rectangle(o.x,o.y,0,0);c.add(a.x,a.y,0,0),c.add(s.x,s.y,0,0),c.add(l.x,l.y,0,0),this.update(c)}return this}rotate90(){const e=(this.width-this.height)/2;this.x+=e,this.y-=e;const t=this.width;return this.width=this.height,this.height=t,this}moveAndExpand(e){const t=Rectangle.clone(e);return this.x+=t.x||0,this.y+=t.y||0,this.width+=t.width||0,this.height+=t.height||0,this}getMaxScaleToFit(e,t=this.center){const r=Rectangle.clone(e),n=t.x,i=t.y;let o=1/0,a=1/0,s=1/0,l=1/0,c=1/0,u=1/0,d=1/0,p=1/0;const h=r.topLeft;h.x<n&&(o=(this.x-n)/(h.x-n)),h.y<i&&(c=(this.y-i)/(h.y-i));const f=r.bottomRight;f.x>n&&(a=(this.x+this.width-n)/(f.x-n)),f.y>i&&(u=(this.y+this.height-i)/(f.y-i));const g=r.topRight;g.x>n&&(s=(this.x+this.width-n)/(g.x-n)),g.y<i&&(d=(this.y-i)/(g.y-i));const m=r.bottomLeft;return m.x<n&&(l=(this.x-n)/(m.x-n)),m.y>i&&(p=(this.y+this.height-i)/(m.y-i)),{sx:Math.min(o,a,s,l),sy:Math.min(c,u,d,p)}}getMaxUniformScaleToFit(e,t=this.center){const r=this.getMaxScaleToFit(e,t);return Math.min(r.sx,r.sy)}containsPoint(e,t){return GeometryUtil.containsPoint(this,Point.create(e,t))}containsRect(e,t,r,n){const i=Rectangle.create(e,t,r,n),o=this.x,a=this.y,s=this.width,l=this.height,c=i.x,u=i.y,d=i.width,p=i.height;return 0!==s&&0!==l&&0!==d&&0!==p&&(c>=o&&u>=a&&c+d<=o+s&&u+p<=a+l)}intersectsWithLine(e){const t=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],r=[],n=[];return t.forEach(t=>{const i=e.intersectsWithLine(t);null!==i&&n.indexOf(i.toString())<0&&(r.push(i),n.push(i.toString()))}),r.length>0?r:null}intersectsWithLineFromCenterToPoint(e,t){const r=Point.clone(e),n=this.center;let i=null;null!=t&&0!==t&&r.rotate(t,n);const o=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],a=new Line(n,r);for(let s=o.length-1;s>=0;s-=1){const e=o[s].intersectsWithLine(a);if(null!==e){i=e;break}}return i&&null!=t&&0!==t&&i.rotate(-t,n),i}intersectsWithRect(e,t,r,n){const i=Rectangle.create(e,t,r,n);if(!this.isIntersectWithRect(i))return null;const o=this.origin,a=this.corner,s=i.origin,l=i.corner,c=Math.max(o.x,s.x),u=Math.max(o.y,s.y);return new Rectangle(c,u,Math.min(a.x,l.x)-c,Math.min(a.y,l.y)-u)}isIntersectWithRect(e,t,r,n){const i=Rectangle.create(e,t,r,n),o=this.origin,a=this.corner,s=i.origin,l=i.corner;return!(l.x<=o.x||l.y<=o.y||s.x>=a.x||s.y>=a.y)}normalize(){let e=this.x,t=this.y,r=this.width,n=this.height;return this.width<0&&(e=this.x+this.width,r=-this.width),this.height<0&&(t=this.y+this.height,n=-this.height),this.x=e,this.y=t,this.width=r,this.height=n,this}union(e){const t=Rectangle.clone(e),r=this.origin,n=this.corner,i=t.origin,o=t.corner,a=Math.min(r.x,i.x),s=Math.min(r.y,i.y),l=Math.max(n.x,o.x),c=Math.max(n.y,o.y);return new Rectangle(a,s,l-a,c-s)}getNearestSideToPoint(e){const t=Point.clone(e),r=t.x-this.x,n=this.x+this.width-t.x,i=t.y-this.y;let o=r,a="left";return n<o&&(o=n,a="right"),i<o&&(o=i,a="top"),this.y+this.height-t.y<o&&(a="bottom"),a}getNearestPointToPoint(e){const t=Point.clone(e);if(this.containsPoint(t)){const e=this.getNearestSideToPoint(t);if("left"===e)return new Point(this.x,t.y);if("top"===e)return new Point(t.x,this.y);if("right"===e)return new Point(this.x+this.width,t.y);if("bottom"===e)return new Point(t.x,this.y+this.height)}return t.adhereToRect(this)}equals(e){return null!=e&&e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height}clone(){return new Rectangle(this.x,this.y,this.width,this.height)}toJSON(){return{x:this.x,y:this.y,width:this.width,height:this.height}}serialize(){return`${this.x} ${this.y} ${this.width} ${this.height}`}}Rectangle2=Rectangle||(Rectangle={}),Rectangle2.isRectangle=function(e){return null!=e&&e instanceof Rectangle2},function(e){e.isRectangleLike=function(e){return null!=e&&"object"==typeof e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.width&&"number"==typeof e.height}}(Rectangle||(Rectangle={})),function(e){function t(t){return e.isRectangle(t)?t.clone():Array.isArray(t)?new e(t[0],t[1],t[2],t[3]):new e(t.x,t.y,t.width,t.height)}e.create=function(r,n,i,o){return null==r||"number"==typeof r?new e(r,n,i,o):t(r)},e.clone=t,e.fromEllipse=function(t){return new e(t.x-t.a,t.y-t.b,2*t.a,2*t.b)},e.fromSize=function(t){return new e(0,0,t.width,t.height)},e.fromPositionAndSize=function(t,r){return new e(t.x,t.y,r.width,r.height)}}(Rectangle||(Rectangle={}));class Line extends Geometry{get center(){return new Point((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}constructor(e,t,r,n){super(),"number"==typeof e&&"number"==typeof t?(this.start=new Point(e,t),this.end=new Point(r,n)):(this.start=Point.create(e),this.end=Point.create(t))}getCenter(){return this.center}round(e=0){return this.start.round(e),this.end.round(e),this}translate(e,t){return"number"==typeof e?(this.start.translate(e,t),this.end.translate(e,t)):(this.start.translate(e),this.end.translate(e)),this}rotate(e,t){return this.start.rotate(e,t),this.end.rotate(e,t),this}scale(e,t,r){return this.start.scale(e,t,r),this.end.scale(e,t,r),this}length(){return Math.sqrt(this.squaredLength())}squaredLength(){const e=this.start.x-this.end.x,t=this.start.y-this.end.y;return e*e+t*t}setLength(e){const t=this.length();if(!t)return this;const r=e/t;return this.scale(r,r,this.start)}parallel(e){const t=this.clone();if(!t.isDifferentiable())return t;const{start:r,end:n}=t,i=r.clone().rotate(270,n),o=n.clone().rotate(90,r);return r.move(o,e),n.move(i,e),t}vector(){return new Point(this.end.x-this.start.x,this.end.y-this.start.y)}angle(){const e=new Point(this.start.x+1,this.start.y);return this.start.angleBetween(this.end,e)}bbox(){const e=Math.min(this.start.x,this.end.x),t=Math.min(this.start.y,this.end.y),r=Math.max(this.start.x,this.end.x),n=Math.max(this.start.y,this.end.y);return new Rectangle(e,t,r-e,n-t)}bearing(){return this.start.bearing(this.end)}closestPoint(e){return this.pointAt(this.closestPointNormalizedLength(e))}closestPointLength(e){return this.closestPointNormalizedLength(e)*this.length()}closestPointTangent(e){return this.tangentAt(this.closestPointNormalizedLength(e))}closestPointNormalizedLength(e){const t=this.vector().dot(new Line(this.start,e).vector()),r=Math.min(1,Math.max(0,t/this.squaredLength()));return Number.isNaN(r)?0:r}pointAt(e){const t=this.start,r=this.end;return e<=0?t.clone():e>=1?r.clone():t.lerp(r,e)}pointAtLength(e){const t=this.start,r=this.end;let n=!0;e<0&&(n=!1,e=-e);const i=this.length();if(e>=i)return n?r.clone():t.clone();const o=(n?e:i-e)/i;return this.pointAt(o)}divideAt(e){const t=this.pointAt(e);return[new Line(this.start,t),new Line(t,this.end)]}divideAtLength(e){const t=this.pointAtLength(e);return[new Line(this.start,t),new Line(t,this.end)]}containsPoint(e){const t=this.start,r=this.end;if(0!==t.cross(e,r))return!1;const n=this.length();return!(new Line(t,e).length()>n)&&!(new Line(e,r).length()>n)}intersect(e,t){const r=e.intersectsWithLine(this,t);return r?Array.isArray(r)?r:[r]:null}intersectsWithLine(e){const t=new Point(this.end.x-this.start.x,this.end.y-this.start.y),r=new Point(e.end.x-e.start.x,e.end.y-e.start.y),n=t.x*r.y-t.y*r.x,i=new Point(e.start.x-this.start.x,e.start.y-this.start.y),o=i.x*r.y-i.y*r.x,a=i.x*t.y-i.y*t.x;if(0===n||o*n<0||a*n<0)return null;if(n>0){if(o>n||a>n)return null}else if(o<n||a<n)return null;return new Point(this.start.x+o*t.x/n,this.start.y+o*t.y/n)}isDifferentiable(){return!this.start.equals(this.end)}pointOffset(e){const t=Point.clone(e),r=this.start,n=this.end;return((n.x-r.x)*(t.y-r.y)-(n.y-r.y)*(t.x-r.x))/this.length()}pointSquaredDistance(e,t){const r=Point.create(e,t);return this.closestPoint(r).squaredDistance(r)}pointDistance(e,t){const r=Point.create(e,t);return this.closestPoint(r).distance(r)}tangentAt(e){if(!this.isDifferentiable())return null;const t=this.start,r=this.end,n=this.pointAt(e),i=new Line(t,r);return i.translate(n.x-t.x,n.y-t.y),i}tangentAtLength(e){if(!this.isDifferentiable())return null;const t=this.start,r=this.end,n=this.pointAtLength(e),i=new Line(t,r);return i.translate(n.x-t.x,n.y-t.y),i}relativeCcw(e,t){const r=Point.create(e,t);let n=r.x-this.start.x,i=r.y-this.start.y;const o=this.end.x-this.start.x,a=this.end.y-this.start.y;let s=n*a-i*o;return 0===s&&(s=n*o+i*a,s>0&&(n-=o,i-=a,s=n*o+i*a,s<0&&(s=0))),s<0?-1:s>0?1:0}equals(e){return null!=e&&this.start.x===e.start.x&&this.start.y===e.start.y&&this.end.x===e.end.x&&this.end.y===e.end.y}clone(){return new Line(this.start,this.end)}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.end.serialize()].join(" ")}}Line2=Line||(Line={}),Line2.isLine=function(e){return null!=e&&e instanceof Line2};class Ellipse extends Geometry{get center(){return new Point(this.x,this.y)}constructor(e,t,r,n){super(),this.x=null==e?0:e,this.y=null==t?0:t,this.a=null==r?0:r,this.b=null==n?0:n}bbox(){return Rectangle.fromEllipse(this)}getCenter(){return this.center}inflate(e,t){const r=e,n=null!=t?t:e;return this.a+=2*r,this.b+=2*n,this}normalizedDistance(e,t){const r=Point.create(e,t),n=r.x-this.x,i=r.y-this.y,o=this.a,a=this.b;return n*n/(o*o)+i*i/(a*a)}containsPoint(e,t){return this.normalizedDistance(e,t)<=1}intersectsWithLine(e){const t=[],r=this.a,n=this.b,i=e.start,o=e.end,a=e.vector(),s=i.diff(new Point(this.x,this.y)),l=new Point(a.x/(r*r),a.y/(n*n)),c=new Point(s.x/(r*r),s.y/(n*n)),u=a.dot(l),d=a.dot(c),p=d*d-u*(s.dot(c)-1);if(p<0)return null;if(p>0){const e=Math.sqrt(p),r=(-d-e)/u,n=(-d+e)/u;if((r<0||r>1)&&(n<0||n>1))return null;r>=0&&r<=1&&t.push(i.lerp(o,r)),n>=0&&n<=1&&t.push(i.lerp(o,n))}else{const e=-d/u;if(!(e>=0&&e<=1))return null;t.push(i.lerp(o,e))}return t}intersectsWithLineFromCenterToPoint(e,t=0){const r=Point.clone(e);t&&r.rotate(t,this.getCenter());const n=r.x-this.x,i=r.y-this.y;let o;if(0===n)return o=this.bbox().getNearestPointToPoint(r),t?o.rotate(-t,this.getCenter()):o;const a=i/n,s=a*a,l=this.a*this.a,c=this.b*this.b;let u=Math.sqrt(1/(1/l+s/c));u=n<0?-u:u;const d=a*u;return o=new Point(this.x+u,this.y+d),t?o.rotate(-t,this.getCenter()):o}tangentTheta(e){const t=Point.clone(e),r=t.x,n=t.y,i=this.a,o=this.b,a=this.bbox().center,s=a.x,l=a.y,c=r>a.x+i/2,u=r<a.x-i/2;let d,p;return c||u?(p=r>a.x?n-30:n+30,d=i*i/(r-s)-i*i*(n-l)*(p-l)/(o*o*(r-s))+s):(d=n>a.y?r+30:r-30,p=o*o/(n-l)-o*o*(r-s)*(d-s)/(i*i*(n-l))+l),new Point(d,p).theta(t)}scale(e,t){return this.a*=e,this.b*=t,this}rotate(e,t){const r=Rectangle.fromEllipse(this);r.rotate(e,t);const n=Ellipse.fromRect(r);return this.a=n.a,this.b=n.b,this.x=n.x,this.y=n.y,this}translate(e,t){const r=Point.create(e,t);return this.x+=r.x,this.y+=r.y,this}equals(e){return null!=e&&e.x===this.x&&e.y===this.y&&e.a===this.a&&e.b===this.b}clone(){return new Ellipse(this.x,this.y,this.a,this.b)}toJSON(){return{x:this.x,y:this.y,a:this.a,b:this.b}}serialize(){return`${this.x} ${this.y} ${this.a} ${this.b}`}}Ellipse2=Ellipse||(Ellipse={}),Ellipse2.isEllipse=function(e){return null!=e&&e instanceof Ellipse2},function(e){function t(t){return e.isEllipse(t)?t.clone():Array.isArray(t)?new e(t[0],t[1],t[2],t[3]):new e(t.x,t.y,t.a,t.b)}e.create=function(r,n,i,o){return null==r||"number"==typeof r?new e(r,n,i,o):t(r)},e.parse=t,e.fromRect=function(t){const r=t.center;return new e(r.x,r.y,t.width/2,t.height/2)}}(Ellipse||(Ellipse={}));const regexSupportedData=new RegExp("^[\\s\\dLMCZz,.]*$");function isValid(e){return"string"==typeof e&&regexSupportedData.test(e)}function mod(e,t){return(e%t+t)%t}function draw(e,t,r,n,i){const o=[],a=e[e.length-1],s=null!=t&&t>0,l=t||0;if(n&&s){const t=(e=e.slice())[0],r=new Point(a.x+(t.x-a.x)/2,a.y+(t.y-a.y)/2);e.splice(0,0,r)}let c=e[0],u=1;for(r?o.push("M",c.x,c.y):o.push("L",c.x,c.y);u<(n?e.length:e.length-1);){let t=e[mod(u,e.length)],r=c.x-t.x,n=c.y-t.y;if(s&&(0!==r||0!==n)&&(null==i||i.indexOf(u-1)<0)){let i=Math.sqrt(r*r+n*n);const a=r*Math.min(l,i/2)/i,s=n*Math.min(l,i/2)/i,c=t.x+a,d=t.y+s;o.push("L",c,d);let p=e[mod(u+1,e.length)];for(;u<e.length-2&&0===Math.round(p.x-t.x)&&0===Math.round(p.y-t.y);)p=e[mod(u+2,e.length)],u+=1;r=p.x-t.x,n=p.y-t.y,i=Math.max(1,Math.sqrt(r*r+n*n));const h=r*Math.min(l,i/2)/i,f=n*Math.min(l,i/2)/i,g=t.x+h,m=t.y+f;o.push("Q",t.x,t.y,g,m),t=new Point(g,m)}else o.push("L",t.x,t.y);c=t,u+=1}return n?o.push("Z"):o.push("L",a.x,a.y),o.map(e=>"string"==typeof e?e:+e.toFixed(3)).join(" ")}function drawPoints(e,t={}){const r=[];return e&&e.length&&e.forEach(e=>{Array.isArray(e)?r.push({x:e[0],y:e[1]}):r.push({x:e.x,y:e.y})}),draw(r,t.round,null==t.initialMove||t.initialMove,t.close,t.exclude)}function arcToCurves(e,t,r,n,i=0,o=0,a=0,s,l){if(0===r||0===n)return[];s-=e,l-=t,r=Math.abs(r),n=Math.abs(n);const c=-s/2,u=-l/2,d=Math.cos(i*Math.PI/180),p=Math.sin(i*Math.PI/180),h=d*c+p*u,f=-1*p*c+d*u,g=h*h,m=f*f,v=r*r,y=n*n,b=g/v+m/y;let q;if(b>1)r=Math.sqrt(b)*r,n=Math.sqrt(b)*n,q=0;else{let e=1;o===a&&(e=-1),q=e*Math.sqrt((v*y-v*m-y*g)/(v*m+y*g))}const V=q*r*f/n,S=-1*q*n*h/r,E=d*V-p*S+s/2,x=p*V+d*S+l/2;let C=Math.atan2((f-S)/n,(h-V)/r)-Math.atan2(0,1),w=C>=0?C:2*Math.PI+C;C=Math.atan2((-f-S)/n,(-h-V)/r)-Math.atan2((f-S)/n,(h-V)/r);let R=C>=0?C:2*Math.PI+C;0===a&&R>0?R-=2*Math.PI:0!==a&&R<0&&(R+=2*Math.PI);const A=2*R/Math.PI,T=Math.ceil(A<0?-1*A:A),k=R/T,N=8/3*Math.sin(k/4)*Math.sin(k/4)/Math.sin(k/2),P=d*r,O=d*n,F=p*r,_=p*n;let I=Math.cos(w),D=Math.sin(w),U=-N*(P*D+_*I),L=-N*(F*D-O*I),B=0,M=0;const W=[];for(let j=0;j<T;j+=1){w+=k,I=Math.cos(w),D=Math.sin(w),B=P*I-_*D+E,M=F*I+O*D+x;const r=-N*(P*D+_*I),n=-N*(F*D-O*I),i=6*j;W[i]=Number(U+e),W[i+1]=Number(L+t),W[i+2]=Number(B-r+e),W[i+3]=Number(M-n+t),W[i+4]=Number(B+e),W[i+5]=Number(M+t),U=B+r,L=M+n}return W.map(e=>+e.toFixed(2))}function drawArc(e,t,r,n,i=0,o=0,a=0,s,l){const c=[],u=arcToCurves(e,t,r,n,i,o,a,s,l);if(null!=u)for(let d=0,p=u.length;d<p;d+=6)c.push("C",u[d],u[d+1],u[d+2],u[d+3],u[d+4],u[d+5]);return c.join(" ")}class Polyline extends Geometry{get start(){return this.points[0]||null}get end(){return this.points[this.points.length-1]||null}constructor(e){if(super(),null!=e){if("string"==typeof e)return Polyline.parse(e);this.points=e.map(e=>Point.create(e))}else this.points=[]}scale(e,t,r=new Point){return this.points.forEach(n=>n.scale(e,t,r)),this}rotate(e,t){return this.points.forEach(r=>r.rotate(e,t)),this}translate(e,t){const r=Point.create(e,t);return this.points.forEach(e=>e.translate(r.x,r.y)),this}round(e=0){return this.points.forEach(t=>t.round(e)),this}bbox(){if(0===this.points.length)return new Rectangle;let e=1/0,t=-1/0,r=1/0,n=-1/0;const i=this.points;for(let o=0,a=i.length;o<a;o+=1){const a=i[o],s=a.x,l=a.y;s<e&&(e=s),s>t&&(t=s),l<r&&(r=l),l>n&&(n=l)}return new Rectangle(e,r,t-e,n-r)}closestPoint(e){const t=this.closestPointLength(e);return this.pointAtLength(t)}closestPointLength(e){const t=this.points,r=t.length;if(0===r||1===r)return 0;let n=0,i=0,o=1/0;for(let a=0,s=r-1;a<s;a+=1){const r=new Line(t[a],t[a+1]),s=r.length(),l=r.closestPointNormalizedLength(e),c=r.pointAt(l).squaredDistance(e);c<o&&(o=c,i=n+l*s),n+=s}return i}closestPointNormalizedLength(e){const t=this.length();if(0===t)return 0;return this.closestPointLength(e)/t}closestPointTangent(e){const t=this.closestPointLength(e);return this.tangentAtLength(t)}containsPoint(e){if(0===this.points.length)return!1;const t=Point.clone(e),r=t.x,n=t.y,i=this.points,o=i.length;let a=o-1,s=0;for(let l=0;l<o;l+=1){const o=i[a],c=i[l];if(t.equals(o))return!0;const u=new Line(o,c);if(u.containsPoint(e))return!0;if(n<=o.y&&n>c.y||n>o.y&&n<=c.y){const t=o.x-r>c.x-r?o.x-r:c.x-r;if(t>=0){const i=new Point(r+t,n),o=new Line(e,i);u.intersectsWithLine(o)&&(s+=1)}}a=l}return s%2==1}intersectsWithLine(e){const t=[];for(let r=0,n=this.points.length-1;r<n;r+=1){const n=this.points[r],i=this.points[r+1],o=e.intersectsWithLine(new Line(n,i));o&&t.push(o)}return t.length>0?t:null}isDifferentiable(){for(let e=0,t=this.points.length-1;e<t;e+=1){const t=this.points[e],r=this.points[e+1];if(new Line(t,r).isDifferentiable())return!0}return!1}length(){let e=0;for(let t=0,r=this.points.length-1;t<r;t+=1){const r=this.points[t],n=this.points[t+1];e+=r.distance(n)}return e}pointAt(e){const t=this.points,r=t.length;if(0===r)return null;if(1===r)return t[0].clone();if(e<=0)return t[0].clone();if(e>=1)return t[r-1].clone();const n=this.length()*e;return this.pointAtLength(n)}pointAtLength(e){const t=this.points,r=t.length;if(0===r)return null;if(1===r)return t[0].clone();let n=!0;e<0&&(n=!1,e=-e);let i=0;for(let o=0,a=r-1;o<a;o+=1){const r=n?o:a-1-o,s=t[r],l=t[r+1],c=new Line(s,l),u=s.distance(l);if(e<=i+u)return c.pointAtLength((n?1:-1)*(e-i));i+=u}return(n?t[r-1]:t[0]).clone()}tangentAt(e){const t=this.points.length;if(0===t||1===t)return null;e<0&&(e=0),e>1&&(e=1);const r=this.length()*e;return this.tangentAtLength(r)}tangentAtLength(e){const t=this.points,r=t.length;if(0===r||1===r)return null;let n,i=!0;e<0&&(i=!1,e=-e);let o=0;for(let a=0,s=r-1;a<s;a+=1){const r=i?a:s-1-a,l=t[r],c=t[r+1],u=new Line(l,c),d=l.distance(c);if(u.isDifferentiable()){if(e<=o+d)return u.tangentAtLength((i?1:-1)*(e-o));n=u}o+=d}if(n){const e=i?1:0;return n.tangentAt(e)}return null}simplify(e={}){const t=this.points;if(t.length<3)return this;const r=e.threshold||0;let n=0;for(;t[n+2];){const e=n+1,i=n+2,o=t[n],a=t[e],s=t[i];new Line(o,s).closestPoint(a).distance(a)<=r?t.splice(e,1):n+=1}return this}toHull(){const e=this.points,t=e.length;if(0===t)return new Polyline;let r=e[0];for(let d=1;d<t;d+=1)(e[d].y<r.y||e[d].y===r.y&&e[d].x>r.x)&&(r=e[d]);const n=[];for(let d=0;d<t;d+=1){let t=r.theta(e[d]);0===t&&(t=360),n.push([e[d],d,t])}if(n.sort((e,t)=>{let r=e[2]-t[2];return 0===r&&(r=t[1]-e[1]),r}),n.length>2){const e=n[n.length-1];n.unshift(e)}const i={},o=[],a=e=>`${e[0].toString()}@${e[1]}`;for(;0!==n.length;){const e=n.pop(),t=e[0];if(i[a(e)])continue;let r=!1;for(;!r;)if(o.length<2)o.push(e),r=!0;else{const s=o.pop(),l=s[0],c=o.pop(),u=c[0],d=u.cross(l,t);if(d<0)o.push(c),o.push(s),o.push(e),r=!0;else if(0===d){const e=1e-10,r=l.angleBetween(u,t);Math.abs(r-180)<e||l.equals(t)||u.equals(l)?(i[a(s)]=l,o.push(c)):Math.abs((r+1)%360-1)<e&&(o.push(c),n.push(s))}else i[a(s)]=l,o.push(c)}}let s;o.length>2&&o.pop();let l=-1;for(let d=0,p=o.length;d<p;d+=1){const e=o[d][1];(void 0===s||e<s)&&(s=e,l=d)}let c=[];if(l>0){const e=o.slice(l),t=o.slice(0,l);c=e.concat(t)}else c=o;const u=[];for(let d=0,p=c.length;d<p;d+=1)u.push(c[d][0]);return new Polyline(u)}equals(e){return null!=e&&(e.points.length===this.points.length&&e.points.every((e,t)=>e.equals(this.points[t])))}clone(){return new Polyline(this.points.map(e=>e.clone()))}toJSON(){return this.points.map(e=>e.toJSON())}serialize(){return this.points.map(e=>`${e.serialize()}`).join(" ")}}var Polyline2,Curve2,LineTo2,Close2,MoveTo2,CurveTo2,Path2,Registry2;Polyline2=Polyline||(Polyline={}),Polyline2.isPolyline=function(e){return null!=e&&e instanceof Polyline2},function(e){e.parse=function(t){const r=t.trim();if(""===r)return new e;const n=[],i=r.split(/\s*,\s*|\s+/);for(let e=0,o=i.length;e<o;e+=2)n.push({x:+i[e],y:+i[e+1]});return new e(n)}}(Polyline||(Polyline={}));class Curve extends Geometry{constructor(e,t,r,n){super(),this.PRECISION=3,this.start=Point.create(e),this.controlPoint1=Point.create(t),this.controlPoint2=Point.create(r),this.end=Point.create(n)}bbox(){const e=this.start,t=this.controlPoint1,r=this.controlPoint2,n=this.end,i=e.x,o=e.y,a=t.x,s=t.y,l=r.x,c=r.y,u=n.x,d=n.y,p=[],h=[[],[]];let f,g,m,v,y,b,q,V,S,E,x;for(let N=0;N<2;N+=1)if(0===N?(g=6*i-12*a+6*l,f=-3*i+9*a-9*l+3*u,m=3*a-3*i):(g=6*o-12*s+6*c,f=-3*o+9*s-9*c+3*d,m=3*s-3*o),Math.abs(f)<1e-12){if(Math.abs(g)<1e-12)continue;v=-m/g,v>0&&v<1&&p.push(v)}else q=g*g-4*m*f,V=Math.sqrt(q),q<0||(y=(-g+V)/(2*f),y>0&&y<1&&p.push(y),b=(-g-V)/(2*f),b>0&&b<1&&p.push(b));let C=p.length;const w=C;for(;C;)C-=1,v=p[C],x=1-v,S=x*x*x*i+3*x*x*v*a+3*x*v*v*l+v*v*v*u,h[0][C]=S,E=x*x*x*o+3*x*x*v*s+3*x*v*v*c+v*v*v*d,h[1][C]=E;p[w]=0,p[w+1]=1,h[0][w]=i,h[1][w]=o,h[0][w+1]=u,h[1][w+1]=d,p.length=w+2,h[0].length=w+2,h[1].length=w+2;const R=Math.min.apply(null,h[0]),A=Math.min.apply(null,h[1]),T=Math.max.apply(null,h[0]),k=Math.max.apply(null,h[1]);return new Rectangle(R,A,T-R,k-A)}closestPoint(e,t={}){return this.pointAtT(this.closestPointT(e,t))}closestPointLength(e,t={}){const r=this.getOptions(t);return this.lengthAtT(this.closestPointT(e,r),r)}closestPointNormalizedLength(e,t={}){const r=this.getOptions(t),n=this.closestPointLength(e,r);if(!n)return 0;const i=this.length(r);return 0===i?0:n/i}closestPointT(e,t={}){const r=this.getPrecision(t),n=this.getDivisions(t),i=Math.pow(10,-r);let o=null,a=0,s=0,l=0,c=0,u=0,d=null;const p=n.length;let h=p>0?1/p:0;for(n.forEach((t,r)=>{const n=t.start.distance(e),i=t.end.distance(e),p=n+i;(null==d||p<d)&&(o=t,a=r*h,s=(r+1)*h,l=n,c=i,d=p,u=t.endpointDistance())});;){const t=l?Math.abs(l-c)/l:0,r=null!=c?Math.abs(l-c)/c:0;if(t<i||r<i||(!l||l<u*i||(!c||c<u*i)))return l<=c?a:s;const n=o.divide(.5);h/=2;const d=n[0].start.distance(e),p=n[0].end.distance(e),f=d+p,g=n[1].start.distance(e),m=n[1].end.distance(e);f<=g+m?(o=n[0],s-=h,l=d,c=p):(o=n[1],a+=h,l=g,c=m)}}closestPointTangent(e,t={}){return this.tangentAtT(this.closestPointT(e,t))}containsPoint(e,t={}){return this.toPolyline(t).containsPoint(e)}divideAt(e,t={}){if(e<=0)return this.divideAtT(0);if(e>=1)return this.divideAtT(1);const r=this.tAt(e,t);return this.divideAtT(r)}divideAtLength(e,t={}){const r=this.tAtLength(e,t);return this.divideAtT(r)}divide(e){return this.divideAtT(e)}divideAtT(e){const t=this.start,r=this.controlPoint1,n=this.controlPoint2,i=this.end;if(e<=0)return[new Curve(t,t,t,t),new Curve(t,r,n,i)];if(e>=1)return[new Curve(t,r,n,i),new Curve(i,i,i,i)];const o=this.getSkeletonPoints(e),a=o.startControlPoint1,s=o.startControlPoint2,l=o.divider,c=o.dividerControlPoint1,u=o.dividerControlPoint2;return[new Curve(t,a,s,l),new Curve(l,c,u,i)]}endpointDistance(){return this.start.distance(this.end)}getSkeletonPoints(e){const t=this.start,r=this.controlPoint1,n=this.controlPoint2,i=this.end;if(e<=0)return{startControlPoint1:t.clone(),startControlPoint2:t.clone(),divider:t.clone(),dividerControlPoint1:r.clone(),dividerControlPoint2:n.clone()};if(e>=1)return{startControlPoint1:r.clone(),startControlPoint2:n.clone(),divider:i.clone(),dividerControlPoint1:i.clone(),dividerControlPoint2:i.clone()};const o=new Line(t,r).pointAt(e),a=new Line(r,n).pointAt(e),s=new Line(n,i).pointAt(e),l=new Line(o,a).pointAt(e),c=new Line(a,s).pointAt(e);return{startControlPoint1:o,startControlPoint2:l,divider:new Line(l,c).pointAt(e),dividerControlPoint1:c,dividerControlPoint2:s}}getSubdivisions(e={}){const t=this.getPrecision(e);let r=[new Curve(this.start,this.controlPoint1,this.controlPoint2,this.end)];if(0===t)return r;let n=this.endpointDistance();const i=Math.pow(10,-t);let o=0;for(;;){o+=1;const e=[];r.forEach(t=>{const r=t.divide(.5);e.push(r[0],r[1])});const t=e.reduce((e,t)=>e+t.endpointDistance(),0);if(o>1&&(0!==t?(t-n)/t:0)<i)return e;r=e,n=t}}length(e={}){return this.getDivisions(e).reduce((e,t)=>e+t.endpointDistance(),0)}lengthAtT(e,t={}){if(e<=0)return 0;const r=void 0===t.precision?this.PRECISION:t.precision;return this.divide(e)[0].length({precision:r})}pointAt(e,t={}){if(e<=0)return this.start.clone();if(e>=1)return this.end.clone();const r=this.tAt(e,t);return this.pointAtT(r)}pointAtLength(e,t={}){const r=this.tAtLength(e,t);return this.pointAtT(r)}pointAtT(e){return e<=0?this.start.clone():e>=1?this.end.clone():this.getSkeletonPoints(e).divider}isDifferentiable(){const e=this.start,t=this.controlPoint1,r=this.controlPoint2,n=this.end;return!(e.equals(t)&&t.equals(r)&&r.equals(n))}tangentAt(e,t={}){if(!this.isDifferentiable())return null;e<0?e=0:e>1&&(e=1);const r=this.tAt(e,t);return this.tangentAtT(r)}tangentAtLength(e,t={}){if(!this.isDifferentiable())return null;const r=this.tAtLength(e,t);return this.tangentAtT(r)}tangentAtT(e){if(!this.isDifferentiable())return null;e<0&&(e=0),e>1&&(e=1);const t=this.getSkeletonPoints(e),r=t.startControlPoint2,n=t.dividerControlPoint1,i=t.divider,o=new Line(r,n);return o.translate(i.x-r.x,i.y-r.y),o}getPrecision(e={}){return null==e.precision?this.PRECISION:e.precision}getDivisions(e={}){if(null!=e.subdivisions)return e.subdivisions;const t=this.getPrecision(e);return this.getSubdivisions({precision:t})}getOptions(e={}){return{precision:this.getPrecision(e),subdivisions:this.getDivisions(e)}}tAt(e,t={}){if(e<=0)return 0;if(e>=1)return 1;const r=this.getOptions(t),n=this.length(r)*e;return this.tAtLength(n,r)}tAtLength(e,t={}){let r=!0;e<0&&(r=!1,e=-e);const n=this.getPrecision(t),i=this.getDivisions(t),o={precision:n,subdivisions:i};let a,s,l=null,c=0,u=0,d=0;const p=i.length;let h=p>0?1/p:0;for(let m=0;m<p;m+=1){const t=r?m:p-1-m,n=i[m],o=n.endpointDistance();if(e<=d+o){l=n,a=t*h,s=(t+1)*h,c=r?e-d:o+d-e,u=r?o+d-e:e-d;break}d+=o}if(null==l)return r?1:0;const f=this.length(o),g=Math.pow(10,-n);for(;;){let e,t,r;if(e=0!==f?c/f:0,e<g)return a;if(e=0!==f?u/f:0,e<g)return s;const n=l.divide(.5);h/=2;const i=n[0].endpointDistance(),o=n[1].endpointDistance();c<=i?(l=n[0],s-=h,t=c,r=i-t):(l=n[1],a+=h,t=c-i,r=o-t),c=t,u=r}}toPoints(e={}){const t=this.getDivisions(e),r=[t[0].start.clone()];return t.forEach(e=>r.push(e.end.clone())),r}toPolyline(e={}){return new Polyline(this.toPoints(e))}scale(e,t,r){return this.start.scale(e,t,r),this.controlPoint1.scale(e,t,r),this.controlPoint2.scale(e,t,r),this.end.scale(e,t,r),this}rotate(e,t){return this.start.rotate(e,t),this.controlPoint1.rotate(e,t),this.controlPoint2.rotate(e,t),this.end.rotate(e,t),this}translate(e,t){return"number"==typeof e?(this.start.translate(e,t),this.controlPoint1.translate(e,t),this.controlPoint2.translate(e,t),this.end.translate(e,t)):(this.start.translate(e),this.controlPoint1.translate(e),this.controlPoint2.translate(e),this.end.translate(e)),this}equals(e){return null!=e&&this.start.equals(e.start)&&this.controlPoint1.equals(e.controlPoint1)&&this.controlPoint2.equals(e.controlPoint2)&&this.end.equals(e.end)}clone(){return new Curve(this.start,this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.controlPoint1.serialize(),this.controlPoint2.serialize(),this.end.serialize()].join(" ")}}Curve2=Curve||(Curve={}),Curve2.isCurve=function(e){return null!=e&&e instanceof Curve2},function(e){function t(e){const t=e.length,r=[],n=[];let i=2;r[0]=e[0]/i;for(let o=1;o<t;o+=1)n[o]=1/i,i=(o<t-1?4:3.5)-n[o],r[o]=(e[o]-r[o-1])/i;for(let o=1;o<t;o+=1)r[t-o-1]-=n[t-o]*r[t-o];return r}e.throughPoints=function(r){if(null==r||Array.isArray(r)&&r.length<2)throw new Error("At least 2 points are required");const n=function(e){const r=e.map(e=>Point.clone(e)),n=[],i=[],o=r.length-1;if(1===o)return n[0]=new Point((2*r[0].x+r[1].x)/3,(2*r[0].y+r[1].y)/3),i[0]=new Point(2*n[0].x-r[0].x,2*n[0].y-r[0].y),[n,i];const a=[];for(let t=1;t<o-1;t+=1)a[t]=4*r[t].x+2*r[t+1].x;a[0]=r[0].x+2*r[1].x,a[o-1]=(8*r[o-1].x+r[o].x)/2;const s=t(a);for(let t=1;t<o-1;t+=1)a[t]=4*r[t].y+2*r[t+1].y;a[0]=r[0].y+2*r[1].y,a[o-1]=(8*r[o-1].y+r[o].y)/2;const l=t(a);for(let t=0;t<o;t+=1)n.push(new Point(s[t],l[t])),t<o-1?i.push(new Point(2*r[t+1].x-s[t+1],2*r[t+1].y-l[t+1])):i.push(new Point((r[o].x+s[o-1])/2,(r[o].y+l[o-1])/2));return[n,i]}(r),i=[];for(let t=0,o=n[0].length;t<o;t+=1){const o=new Point(n[0][t].x,n[0][t].y),a=new Point(n[1][t].x,n[1][t].y);i.push(new e(r[t],o,a,r[t+1]))}return i}}(Curve||(Curve={}));class Segment extends Geometry{constructor(){super(...arguments),this.isVisible=!0,this.isSegment=!0,this.isSubpathStart=!1}get end(){return this.endPoint}get start(){if(null==this.previousSegment)throw new Error("Missing previous segment. (This segment cannot be the first segment of a path, or segment has not yet been added to a path.)");return this.previousSegment.end}closestPointT(e,t){if(this.closestPointNormalizedLength)return this.closestPointNormalizedLength(e);throw new Error("Neither `closestPointT` nor `closestPointNormalizedLength` method is implemented.")}lengthAtT(e,t){if(e<=0)return 0;const r=this.length();return e>=1?r:r*e}divideAtT(e){if(this.divideAt)return this.divideAt(e);throw new Error("Neither `divideAtT` nor `divideAt` method is implemented.")}pointAtT(e){if(this.pointAt)return this.pointAt(e);throw new Error("Neither `pointAtT` nor `pointAt` method is implemented.")}tangentAtT(e){if(this.tangentAt)return this.tangentAt(e);throw new Error("Neither `tangentAtT` nor `tangentAt` method is implemented.")}}class LineTo extends Segment{constructor(e,t){super(),Line.isLine(e)?this.endPoint=e.end.clone().round(2):this.endPoint=Point.create(e,t).round(2)}get type(){return"L"}get line(){return new Line(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(e){return this.line.closestPoint(e)}closestPointLength(e){return this.line.closestPointLength(e)}closestPointNormalizedLength(e){return this.line.closestPointNormalizedLength(e)}closestPointTangent(e){return this.line.closestPointTangent(e)}length(){return this.line.length()}divideAt(e){const t=this.line.divideAt(e);return[new LineTo(t[0]),new LineTo(t[1])]}divideAtLength(e){const t=this.line.divideAtLength(e);return[new LineTo(t[0]),new LineTo(t[1])]}getSubdivisions(){return[]}pointAt(e){return this.line.pointAt(e)}pointAtLength(e){return this.line.pointAtLength(e)}tangentAt(e){return this.line.tangentAt(e)}tangentAtLength(e){return this.line.tangentAtLength(e)}isDifferentiable(){return null!=this.previousSegment&&!this.start.equals(this.end)}clone(){return new LineTo(this.end)}scale(e,t,r){return this.end.scale(e,t,r),this}rotate(e,t){return this.end.rotate(e,t),this}translate(e,t){return"number"==typeof e?this.end.translate(e,t):this.end.translate(e),this}equals(e){return this.type===e.type&&this.start.equals(e.start)&&this.end.equals(e.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){const e=this.end;return`${this.type} ${e.x} ${e.y}`}}LineTo2=LineTo||(LineTo={}),LineTo2.create=function(...e){const t=e.length,r=e[0];if(Line.isLine(r))return new LineTo2(r);if(Point.isPointLike(r))return 1===t?new LineTo2(r):e.map(e=>new LineTo2(e));if(2===t)return new LineTo2(+e[0],+e[1]);const n=[];for(let i=0;i<t;i+=2){const t=+e[i],r=+e[i+1];n.push(new LineTo2(t,r))}return n};class Close extends Segment{get end(){if(!this.subpathStartSegment)throw new Error("Missing subpath start segment. (This segment needs a subpath start segment (e.g. MoveTo), or segment has not yet been added to a path.)");return this.subpathStartSegment.end}get type(){return"Z"}get line(){return new Line(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(e){return this.line.closestPoint(e)}closestPointLength(e){return this.line.closestPointLength(e)}closestPointNormalizedLength(e){return this.line.closestPointNormalizedLength(e)}closestPointTangent(e){return this.line.closestPointTangent(e)}length(){return this.line.length()}divideAt(e){const t=this.line.divideAt(e);return[t[1].isDifferentiable()?new LineTo(t[0]):this.clone(),new LineTo(t[1])]}divideAtLength(e){const t=this.line.divideAtLength(e);return[t[1].isDifferentiable()?new LineTo(t[0]):this.clone(),new LineTo(t[1])]}getSubdivisions(){return[]}pointAt(e){return this.line.pointAt(e)}pointAtLength(e){return this.line.pointAtLength(e)}tangentAt(e){return this.line.tangentAt(e)}tangentAtLength(e){return this.line.tangentAtLength(e)}isDifferentiable(){return!(!this.previousSegment||!this.subpathStartSegment)&&!this.start.equals(this.end)}scale(){return this}rotate(){return this}translate(){return this}equals(e){return this.type===e.type&&this.start.equals(e.start)&&this.end.equals(e.end)}clone(){return new Close}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return this.type}}Close2=Close||(Close={}),Close2.create=function(){return new Close2};class MoveTo extends Segment{constructor(e,t){super(),this.isVisible=!1,this.isSubpathStart=!0,Line.isLine(e)||Curve.isCurve(e)?this.endPoint=e.end.clone().round(2):this.endPoint=Point.create(e,t).round(2)}get start(){throw new Error("Illegal access. Moveto segments should not need a start property.")}get type(){return"M"}bbox(){return null}closestPoint(){return this.end.clone()}closestPointLength(){return 0}closestPointNormalizedLength(){return 0}closestPointT(){return 1}closestPointTangent(){return null}length(){return 0}lengthAtT(){return 0}divideAt(){return[this.clone(),this.clone()]}divideAtLength(){return[this.clone(),this.clone()]}getSubdivisions(){return[]}pointAt(){return this.end.clone()}pointAtLength(){return this.end.clone()}pointAtT(){return this.end.clone()}tangentAt(){return null}tangentAtLength(){return null}tangentAtT(){return null}isDifferentiable(){return!1}scale(e,t,r){return this.end.scale(e,t,r),this}rotate(e,t){return this.end.rotate(e,t),this}translate(e,t){return"number"==typeof e?this.end.translate(e,t):this.end.translate(e),this}clone(){return new MoveTo(this.end)}equals(e){return this.type===e.type&&this.end.equals(e.end)}toJSON(){return{type:this.type,end:this.end.toJSON()}}serialize(){const e=this.end;return`${this.type} ${e.x} ${e.y}`}}MoveTo2=MoveTo||(MoveTo={}),MoveTo2.create=function(...e){const t=e.length,r=e[0];if(Line.isLine(r))return new MoveTo2(r);if(Curve.isCurve(r))return new MoveTo2(r);if(Point.isPointLike(r)){if(1===t)return new MoveTo2(r);const n=[];for(let r=0;r<t;r+=1)0===r?n.push(new MoveTo2(e[r])):n.push(new LineTo(e[r]));return n}if(2===t)return new MoveTo2(+e[0],+e[1]);const n=[];for(let i=0;i<t;i+=2){const t=+e[i],r=+e[i+1];0===i?n.push(new MoveTo2(t,r)):n.push(new LineTo(t,r))}return n};class CurveTo extends Segment{constructor(e,t,r,n,i,o){super(),Curve.isCurve(e)?(this.controlPoint1=e.controlPoint1.clone().round(2),this.controlPoint2=e.controlPoint2.clone().round(2),this.endPoint=e.end.clone().round(2)):"number"==typeof e?(this.controlPoint1=new Point(e,t).round(2),this.controlPoint2=new Point(r,n).round(2),this.endPoint=new Point(i,o).round(2)):(this.controlPoint1=Point.create(e).round(2),this.controlPoint2=Point.create(t).round(2),this.endPoint=Point.create(r).round(2))}get type(){return"C"}get curve(){return new Curve(this.start,this.controlPoint1,this.controlPoint2,this.end)}bbox(){return this.curve.bbox()}closestPoint(e){return this.curve.closestPoint(e)}closestPointLength(e){return this.curve.closestPointLength(e)}closestPointNormalizedLength(e){return this.curve.closestPointNormalizedLength(e)}closestPointTangent(e){return this.curve.closestPointTangent(e)}length(){return this.curve.length()}divideAt(e,t={}){const r=this.curve.divideAt(e,t);return[new CurveTo(r[0]),new CurveTo(r[1])]}divideAtLength(e,t={}){const r=this.curve.divideAtLength(e,t);return[new CurveTo(r[0]),new CurveTo(r[1])]}divideAtT(e){const t=this.curve.divideAtT(e);return[new CurveTo(t[0]),new CurveTo(t[1])]}getSubdivisions(){return[]}pointAt(e){return this.curve.pointAt(e)}pointAtLength(e){return this.curve.pointAtLength(e)}tangentAt(e){return this.curve.tangentAt(e)}tangentAtLength(e){return this.curve.tangentAtLength(e)}isDifferentiable(){if(!this.previousSegment)return!1;const e=this.start,t=this.controlPoint1,r=this.controlPoint2,n=this.end;return!(e.equals(t)&&t.equals(r)&&r.equals(n))}scale(e,t,r){return this.controlPoint1.scale(e,t,r),this.controlPoint2.scale(e,t,r),this.end.scale(e,t,r),this}rotate(e,t){return this.controlPoint1.rotate(e,t),this.controlPoint2.rotate(e,t),this.end.rotate(e,t),this}translate(e,t){return"number"==typeof e?(this.controlPoint1.translate(e,t),this.controlPoint2.translate(e,t),this.end.translate(e,t)):(this.controlPoint1.translate(e),this.controlPoint2.translate(e),this.end.translate(e)),this}equals(e){return this.start.equals(e.start)&&this.end.equals(e.end)&&this.controlPoint1.equals(e.controlPoint1)&&this.controlPoint2.equals(e.controlPoint2)}clone(){return new CurveTo(this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){const e=this.controlPoint1,t=this.controlPoint2,r=this.end;return[this.type,e.x,e.y,t.x,t.y,r.x,r.y].join(" ")}}function rotate(e,t,r){return{x:e*Math.cos(r)-t*Math.sin(r),y:e*Math.sin(r)+t*Math.cos(r)}}function q2c(e,t,r,n,i,o){const a=1/3,s=2/3;return[a*e+s*r,a*t+s*n,a*i+s*r,a*o+s*n,i,o]}function a2c(e,t,r,n,i,o,a,s,l,c){const u=120*Math.PI/180,d=Math.PI/180*(+i||0);let p,h,f,g,m,v=[];if(c)h=c[0],f=c[1],g=c[2],m=c[3];else{p=rotate(e,t,-d),e=p.x,t=p.y,p=rotate(s,l,-d);const i=(e-(s=p.x))/2,c=(t-(l=p.y))/2;let u=i*i/(r*r)+c*c/(n*n);u>1&&(u=Math.sqrt(u),r*=u,n*=u);const v=r*r,y=n*n,b=(o===a?-1:1)*Math.sqrt(Math.abs((v*y-v*c*c-y*i*i)/(v*c*c+y*i*i)));g=b*r*c/n+(e+s)/2,m=b*-n*i/r+(t+l)/2,h=Math.asin((t-m)/n),f=Math.asin((l-m)/n),h=e<g?Math.PI-h:h,f=s<g?Math.PI-f:f,h<0&&(h=2*Math.PI+h),f<0&&(f=2*Math.PI+f),a&&h>f&&(h-=2*Math.PI),!a&&f>h&&(f-=2*Math.PI)}let y=f-h;if(Math.abs(y)>u){const e=f,t=s,o=l;f=h+u*(a&&f>h?1:-1),v=a2c(s=g+r*Math.cos(f),l=m+n*Math.sin(f),r,n,i,0,a,t,o,[f,e,g,m])}y=f-h;const b=Math.cos(h),q=Math.sin(h),V=Math.cos(f),S=Math.sin(f),E=Math.tan(y/4),x=4/3*(r*E),C=4/3*(n*E),w=[e,t],R=[e+x*q,t-C*b],A=[s+x*S,l-C*V],T=[s,l];if(R[0]=2*w[0]-R[0],R[1]=2*w[1]-R[1],c)return[R,A,T].concat(v);{v=[R,A,T].concat(v).join().split(",");const e=[],t=v.length;for(let r=0;r<t;r+=1)e[r]=r%2?rotate(+v[r-1],+v[r],d).y:rotate(+v[r],+v[r+1],d).x;return e}}function parse$4(e){if(!e)return null;const t="\t\n\v\f\r   ᠎              \u2028\u2029",r=new RegExp(`([a-z])[${t},]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[${t}]*,?[${t}]*)+)`,"ig"),n=new RegExp(`(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[${t}]*,?[${t}]*`,"ig"),i={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},o=[];return e.replace(r,(e,t,r)=>{const a=[];let s=t.toLowerCase();r.replace(n,(e,t)=>(t&&a.push(+t),e)),"m"===s&&a.length>2&&(o.push([t,...a.splice(0,2)]),s="l",t="m"===t?"l":"L");const l=i[s];for(;a.length>=l&&(o.push([t,...a.splice(0,l)]),l););return e}),o}function abs(e){const t=parse$4(e);if(!t||!t.length)return[["M",0,0]];let r=0,n=0,i=0,o=0;const a=[];for(let s=0,l=t.length;s<l;s+=1){const e=[];a.push(e);const l=t[s],c=l[0];if(c!==c.toUpperCase())switch(e[0]=c.toUpperCase(),e[0]){case"A":e[1]=l[1],e[2]=l[2],e[3]=l[3],e[4]=l[4],e[5]=l[5],e[6]=+l[6]+r,e[7]=+l[7]+n;break;case"V":e[1]=+l[1]+n;break;case"H":e[1]=+l[1]+r;break;case"M":i=+l[1]+r,o=+l[2]+n;for(let t=1,i=l.length;t<i;t+=1)e[t]=+l[t]+(t%2?r:n);break;default:for(let t=1,i=l.length;t<i;t+=1)e[t]=+l[t]+(t%2?r:n)}else for(let t=0,r=l.length;t<r;t+=1)e[t]=l[t];switch(e[0]){case"Z":r=+i,n=+o;break;case"H":r=e[1];break;case"V":n=e[1];break;case"M":i=e[e.length-2],o=e[e.length-1],r=e[e.length-2],n=e[e.length-1];break;default:r=e[e.length-2],n=e[e.length-1]}}return a}function normalize$5(e){const t=abs(e),r={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};function n(e,t,r){let n,i;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(e[0]in{T:1,Q:1}||(t.qx=null,t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":return 0===parseFloat(e[1])||0===parseFloat(e[2])?["L",e[6],e[7]]:["C"].concat(a2c.apply(0,[t.x,t.y].concat(e.slice(1))));case"S":return"C"===r||"S"===r?(n=2*t.x-t.bx,i=2*t.y-t.by):(n=t.x,i=t.y),["C",n,i].concat(e.slice(1));case"T":return"Q"===r||"T"===r?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),["C"].concat(q2c(t.x,t.y,t.qx,t.qy,e[1],e[2]));case"Q":return t.qx=e[1],t.qy=e[2],["C"].concat(q2c(t.x,t.y,e[1],e[2],e[3],e[4]));case"H":return["L"].concat(e[1],t.y);case"V":return["L"].concat(t.x,e[1])}return e}function i(e,r){if(e[r].length>7){e[r].shift();const n=e[r];for(;n.length;)o[r]="A",r+=1,e.splice(r,0,["C"].concat(n.splice(0,6)));e.splice(r,1),s=t.length}}const o=[];let a="",s=t.length;for(let l=0;l<s;l+=1){let e="";t[l]&&(e=t[l][0]),"C"!==e&&(o[l]=e,l>0&&(a=o[l-1])),t[l]=n(t[l],r,a),"A"!==o[l]&&"C"===e&&(o[l]="C"),i(t,l);const s=t[l],c=s.length;r.x=s[c-2],r.y=s[c-1],r.bx=parseFloat(s[c-4])||r.x,r.by=parseFloat(s[c-3])||r.y}return t[0][0]&&"M"===t[0][0]||t.unshift(["M",0,0]),t}function normalizePathData(e){return normalize$5(e).map(e=>e.map(e=>"string"==typeof e?e:GeometryUtil.round(e,2))).join(",").split(",").join(" ")}CurveTo2=CurveTo||(CurveTo={}),CurveTo2.create=function(...e){const t=e.length,r=e[0];if(Curve.isCurve(r))return new CurveTo2(r);if(Point.isPointLike(r)){if(3===t)return new CurveTo2(e[0],e[1],e[2]);const r=[];for(let n=0;n<t;n+=3)r.push(new CurveTo2(e[n],e[n+1],e[n+2]));return r}if(6===t)return new CurveTo2(e[0],e[1],e[2],e[3],e[4],e[5]);const n=[];for(let i=0;i<t;i+=6)n.push(new CurveTo2(e[i],e[i+1],e[i+2],e[i+3],e[i+4],e[i+5]));return n};class Path extends Geometry{constructor(e){if(super(),this.PRECISION=3,this.segments=[],Array.isArray(e))if(Line.isLine(e[0])||Curve.isCurve(e[0])){let t=null;e.forEach((e,r)=>{0===r&&this.appendSegment(Path.createSegment("M",e.start)),null==t||t.end.equals(e.start)||this.appendSegment(Path.createSegment("M",e.start)),Line.isLine(e)?this.appendSegment(Path.createSegment("L",e.end)):Curve.isCurve(e)&&this.appendSegment(Path.createSegment("C",e.controlPoint1,e.controlPoint2,e.end)),t=e})}else{e.forEach(e=>{e.isSegment&&this.appendSegment(e)})}else null!=e&&(Line.isLine(e)?(this.appendSegment(Path.createSegment("M",e.start)),this.appendSegment(Path.createSegment("L",e.end))):Curve.isCurve(e)?(this.appendSegment(Path.createSegment("M",e.start)),this.appendSegment(Path.createSegment("C",e.controlPoint1,e.controlPoint2,e.end))):Polyline.isPolyline(e)?e.points&&e.points.length&&e.points.forEach((e,t)=>{const r=0===t?Path.createSegment("M",e):Path.createSegment("L",e);this.appendSegment(r)}):e.isSegment&&this.appendSegment(e))}get start(){const e=this.segments,t=e.length;if(0===t)return null;for(let r=0;r<t;r+=1){const t=e[r];if(t.isVisible)return t.start}return e[t-1].end}get end(){const e=this.segments,t=e.length;if(0===t)return null;for(let r=t-1;r>=0;r-=1){const t=e[r];if(t.isVisible)return t.end}return e[t-1].end}moveTo(...e){return this.appendSegment(MoveTo.create.call(null,...e))}lineTo(...e){return this.appendSegment(LineTo.create.call(null,...e))}curveTo(...e){return this.appendSegment(CurveTo.create.call(null,...e))}arcTo(e,t,r,n,i,o,a){const s=this.end||new Point,l="number"==typeof o?arcToCurves(s.x,s.y,e,t,r,n,i,o,a):arcToCurves(s.x,s.y,e,t,r,n,i,o.x,o.y);if(null!=l)for(let c=0,u=l.length;c<u;c+=6)this.curveTo(l[c],l[c+1],l[c+2],l[c+3],l[c+4],l[c+5]);return this}quadTo(e,t,r,n){const i=this.end||new Point,o=["M",i.x,i.y];if("number"==typeof e)o.push("Q",e,t,r,n);else{const r=t;o.push("Q",e.x,e.y,r.x,r.y)}const a=Path.parse(o.join(" "));return this.appendSegment(a.segments.slice(1)),this}close(){return this.appendSegment(Close.create())}drawPoints(e,t={}){const r=drawPoints(e,t),n=Path.parse(r);n&&n.segments&&this.appendSegment(n.segments)}bbox(){const e=this.segments,t=e.length;if(0===t)return null;let r;for(let i=0;i<t;i+=1){const t=e[i];if(t.isVisible){const e=t.bbox();null!=e&&(r=r?r.union(e):e)}}if(null!=r)return r;const n=e[t-1];return new Rectangle(n.end.x,n.end.y,0,0)}appendSegment(e){const t=this.segments.length;let r,n=0!==t?this.segments[t-1]:null;if(Array.isArray(e))for(let i=0,o=e.length;i<o;i+=1){const t=e[i];r=this.prepareSegment(t,n,null),this.segments.push(r),n=r}else null!=e&&e.isSegment&&(r=this.prepareSegment(e,n,null),this.segments.push(r));return this}insertSegment(e,t){const r=this.segments.length;if(e<0&&(e=r+e+1),e>r||e<0)throw new Error("Index out of range.");let n,i=null,o=null;if(0!==r&&(e>=1?(i=this.segments[e-1],o=i.nextSegment):(i=null,o=this.segments[0])),Array.isArray(t))for(let a=0,s=t.length;a<s;a+=1){const r=t[a];n=this.prepareSegment(r,i,o),this.segments.splice(e+a,0,n),i=n}else n=this.prepareSegment(t,i,o),this.segments.splice(e,0,n);return this}removeSegment(e){const t=this.fixIndex(e),r=this.segments.splice(t,1)[0],n=r.previousSegment,i=r.nextSegment;return n&&(n.nextSegment=i),i&&(i.previousSegment=n),r.isSubpathStart&&i&&this.updateSubpathStartSegment(i),r}replaceSegment(e,t){const r=this.fixIndex(e);let n;const i=this.segments[r];let o=i.previousSegment;const a=i.nextSegment;let s=i.isSubpathStart;if(Array.isArray(t)){this.segments.splice(e,1);for(let r=0,i=t.length;r<i;r+=1){const i=t[r];n=this.prepareSegment(i,o,a),this.segments.splice(e+r,0,n),o=n,s&&n.isSubpathStart&&(s=!1)}}else n=this.prepareSegment(t,o,a),this.segments.splice(r,1,n),s&&n.isSubpathStart&&(s=!1);s&&a&&this.updateSubpathStartSegment(a)}getSegment(e){const t=this.fixIndex(e);return this.segments[t]}fixIndex(e){const t=this.segments.length;if(0===t)throw new Error("Path has no segments.");let r=e;for(;r<0;)r=t+r;if(r>=t||r<0)throw new Error("Index out of range.");return r}segmentAt(e,t={}){const r=this.segmentIndexAt(e,t);return r?this.getSegment(r):null}segmentAtLength(e,t={}){const r=this.segmentIndexAtLength(e,t);return r?this.getSegment(r):null}segmentIndexAt(e,t={}){if(0===this.segments.length)return null;const r=GeometryUtil.clamp(e,0,1),n=this.getOptions(t),i=this.length(n)*r;return this.segmentIndexAtLength(i,n)}segmentIndexAtLength(e,t={}){const r=this.segments.length;if(0===r)return null;let n=!0;e<0&&(n=!1,e=-e);const i=this.getPrecision(t),o=this.getSubdivisions(t);let a=0,s=null;for(let l=0;l<r;l+=1){const t=n?l:r-1-l,c=this.segments[t],u=o[t],d=c.length({precision:i,subdivisions:u});if(c.isVisible){if(e<=a+d)return t;s=t}a+=d}return s}getSegmentSubdivisions(e={}){const t=this.getPrecision(e),r=[];for(let n=0,i=this.segments.length;n<i;n+=1){const e=this.segments[n].getSubdivisions({precision:t});r.push(e)}return r}updateSubpathStartSegment(e){let t=e.previousSegment,r=e;for(;r&&!r.isSubpathStart;)r.subpathStartSegment=null!=t?t.subpathStartSegment:null,t=r,r=r.nextSegment}prepareSegment(e,t,r){e.previousSegment=t,e.nextSegment=r,null!=t&&(t.nextSegment=e),null!=r&&(r.previousSegment=e);let n=e;return e.isSubpathStart&&(e.subpathStartSegment=e,n=r),null!=n&&this.updateSubpathStartSegment(n),e}closestPoint(e,t={}){const r=this.closestPointT(e,t);return r?this.pointAtT(r):null}closestPointLength(e,t={}){const r=this.getOptions(t),n=this.closestPointT(e,r);return n?this.lengthAtT(n,r):0}closestPointNormalizedLength(e,t={}){const r=this.getOptions(t),n=this.closestPointLength(e,r);if(0===n)return 0;const i=this.length(r);return 0===i?0:n/i}closestPointT(e,t={}){if(0===this.segments.length)return null;const r=this.getPrecision(t),n=this.getSubdivisions(t);let i,o=1/0;for(let a=0,s=this.segments.length;a<s;a+=1){const t=this.segments[a],s=n[a];if(t.isVisible){const n=t.closestPointT(e,{precision:r,subdivisions:s}),l=t.pointAtT(n),c=GeometryUtil.squaredLength(l,e);c<o&&(i={segmentIndex:a,value:n},o=c)}}return i||{segmentIndex:this.segments.length-1,value:1}}closestPointTangent(e,t={}){if(0===this.segments.length)return null;const r=this.getPrecision(t),n=this.getSubdivisions(t);let i,o=1/0;for(let a=0,s=this.segments.length;a<s;a+=1){const t=this.segments[a],s=n[a];if(t.isDifferentiable()){const n=t.closestPointT(e,{precision:r,subdivisions:s}),a=t.pointAtT(n),l=GeometryUtil.squaredLength(a,e);l<o&&(i=t.tangentAtT(n),o=l)}}return i||null}containsPoint(e,t={}){const r=this.toPolylines(t);if(!r)return!1;let n=0;for(let i=0,o=r.length;i<o;i+=1){r[i].containsPoint(e)&&(n+=1)}return n%2==1}pointAt(e,t={}){if(0===this.segments.length)return null;if(e<=0)return this.start.clone();if(e>=1)return this.end.clone();const r=this.getOptions(t),n=this.length(r)*e;return this.pointAtLength(n,r)}pointAtLength(e,t={}){if(0===this.segments.length)return null;if(0===e)return this.start.clone();let r=!0;e<0&&(r=!1,e=-e);const n=this.getPrecision(t),i=this.getSubdivisions(t);let o,a=0;for(let s=0,l=this.segments.length;s<l;s+=1){const t=r?s:l-1-s,c=this.segments[t],u=i[t],d=c.length({precision:n,subdivisions:u});if(c.isVisible){if(e<=a+d)return c.pointAtLength((r?1:-1)*(e-a),{precision:n,subdivisions:u});o=c}a+=d}if(o)return r?o.end:o.start;return this.segments[this.segments.length-1].end.clone()}pointAtT(e){const t=this.segments,r=t.length;if(0===r)return null;const n=e.segmentIndex;if(n<0)return t[0].pointAtT(0);if(n>=r)return t[r-1].pointAtT(1);const i=GeometryUtil.clamp(e.value,0,1);return t[n].pointAtT(i)}divideAt(e,t={}){if(0===this.segments.length)return null;const r=GeometryUtil.clamp(e,0,1),n=this.getOptions(t),i=this.length(n)*r;return this.divideAtLength(i,n)}divideAtLength(e,t={}){if(0===this.segments.length)return null;let r=!0;e<0&&(r=!1,e=-e);const n=this.getPrecision(t),i=this.getSubdivisions(t);let o,a,s,l,c,u=0;for(let y=0,b=this.segments.length;y<b;y+=1){const t=r?y:b-1-y,c=this.getSegment(t),d={precision:n,subdivisions:i[t]},p=c.length(d);if(c.isDifferentiable()&&(s=c,l=t,e<=u+p)){a=t,o=c.divideAtLength((r?1:-1)*(e-u),d);break}u+=p}if(!s)return null;o||(a=l,c=r?1:0,o=s.divideAtT(c));const d=this.clone(),p=a;d.replaceSegment(p,o);const h=p;let f=p+1,g=p+2;o[0].isDifferentiable()||(d.removeSegment(h),f-=1,g-=1);const m=d.getSegment(f).start;d.insertSegment(f,Path.createSegment("M",m)),g+=1,o[1].isDifferentiable()||(d.removeSegment(g-1),g-=1);const v=g-h-1;for(let y=g,b=d.segments.length;y<b;y+=1){const e=this.getSegment(y-v),t=d.getSegment(y);if("Z"===t.type&&!e.subpathStartSegment.end.equals(t.subpathStartSegment.end)){const t=Path.createSegment("L",e.end);d.replaceSegment(y,t)}}return[new Path(d.segments.slice(0,f)),new Path(d.segments.slice(f))]}intersectsWithLine(e,t={}){const r=this.toPolylines(t);if(null==r)return null;let n=null;for(let i=0,o=r.length;i<o;i+=1){const t=r[i],o=e.intersect(t);o&&(null==n&&(n=[]),Array.isArray(o)?n.push(...o):n.push(o))}return n}isDifferentiable(){for(let e=0,t=this.segments.length;e<t;e+=1){if(this.segments[e].isDifferentiable())return!0}return!1}isValid(){const e=this.segments;return 0===e.length||"M"===e[0].type}length(e={}){if(0===this.segments.length)return 0;const t=this.getSubdivisions(e);let r=0;for(let n=0,i=this.segments.length;n<i;n+=1){const e=this.segments[n],i=t[n];r+=e.length({subdivisions:i})}return r}lengthAtT(e,t={}){const r=this.segments.length;if(0===r)return 0;let n=e.segmentIndex;if(n<0)return 0;let i=GeometryUtil.clamp(e.value,0,1);n>=r&&(n=r-1,i=1);const o=this.getPrecision(t),a=this.getSubdivisions(t);let s=0;for(let u=0;u<n;u+=1){const e=this.segments[u],t=a[u];s+=e.length({precision:o,subdivisions:t})}const l=this.segments[n],c=a[n];return s+=l.lengthAtT(i,{precision:o,subdivisions:c}),s}tangentAt(e,t={}){if(0===this.segments.length)return null;const r=GeometryUtil.clamp(e,0,1),n=this.getOptions(t),i=this.length(n)*r;return this.tangentAtLength(i,n)}tangentAtLength(e,t={}){if(0===this.segments.length)return null;let r=!0;e<0&&(r=!1,e=-e);const n=this.getPrecision(t),i=this.getSubdivisions(t);let o,a=0;for(let s=0,l=this.segments.length;s<l;s+=1){const t=r?s:l-1-s,c=this.segments[t],u=i[t],d=c.length({precision:n,subdivisions:u});if(c.isDifferentiable()){if(e<=a+d)return c.tangentAtLength((r?1:-1)*(e-a),{precision:n,subdivisions:u});o=c}a+=d}if(o){const e=r?1:0;return o.tangentAtT(e)}return null}tangentAtT(e){const t=this.segments.length;if(0===t)return null;const r=e.segmentIndex;if(r<0)return this.segments[0].tangentAtT(0);if(r>=t)return this.segments[t-1].tangentAtT(1);const n=GeometryUtil.clamp(e.value,0,1);return this.segments[r].tangentAtT(n)}getPrecision(e={}){return null==e.precision?this.PRECISION:e.precision}getSubdivisions(e={}){if(null==e.segmentSubdivisions){const t=this.getPrecision(e);return this.getSegmentSubdivisions({precision:t})}return e.segmentSubdivisions}getOptions(e={}){return{precision:this.getPrecision(e),segmentSubdivisions:this.getSubdivisions(e)}}toPoints(e={}){const t=this.segments,r=t.length;if(0===r)return null;const n=this.getSubdivisions(e),i=[];let o=[];for(let a=0;a<r;a+=1){const e=t[a];if(e.isVisible){const t=n[a];t.length>0?t.forEach(e=>o.push(e.start)):o.push(e.start)}else o.length>0&&(o.push(t[a-1].end),i.push(o),o=[])}return o.length>0&&(o.push(this.end),i.push(o)),i}toPolylines(e={}){const t=this.toPoints(e);return t?t.map(e=>new Polyline(e)):null}scale(e,t,r){return this.segments.forEach(n=>n.scale(e,t,r)),this}rotate(e,t){return this.segments.forEach(r=>r.rotate(e,t)),this}translate(e,t){return"number"==typeof e?this.segments.forEach(r=>r.translate(e,t)):this.segments.forEach(t=>t.translate(e)),this}clone(){const e=new Path;return this.segments.forEach(t=>e.appendSegment(t.clone())),e}equals(e){if(null==e)return!1;const t=this.segments,r=e.segments,n=t.length;if(r.length!==n)return!1;for(let i=0;i<n;i+=1){const e=t[i],n=r[i];if(e.type!==n.type||!e.equals(n))return!1}return!0}toJSON(){return this.segments.map(e=>e.toJSON())}serialize(){if(!this.isValid())throw new Error("Invalid path segments.");return this.segments.map(e=>e.serialize()).join(" ")}toString(){return this.serialize()}}Path2=Path||(Path={}),Path2.isPath=function(e){return null!=e&&e instanceof Path2},function(e){function t(e,...t){if("M"===e)return MoveTo.create.call(null,...t);if("L"===e)return LineTo.create.call(null,...t);if("C"===e)return CurveTo.create.call(null,...t);if("z"===e||"Z"===e)return Close.create();throw new Error(`Invalid path segment type "${e}"`)}e.parse=function(r){if(!r)return new e;const n=new e,i=e.normalize(r).match(/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g);if(null!=i)for(let e=0,o=i.length;e<o;e+=1){const r=/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g,o=i[e].match(r);if(null!=o){const e=o[0],r=o.slice(1).map(e=>+e),i=t.call(null,e,...r);n.appendSegment(i)}}return n},e.createSegment=t}(Path||(Path={})),function(e){e.normalize=normalizePathData,e.isValid=isValid,e.drawArc=drawArc,e.drawPoints=drawPoints,e.arcToCurves=arcToCurves}(Path||(Path={}));class Registry{constructor(e){this.options=Object.assign({},e),this.data=this.options.data||{},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this)}get names(){return Object.keys(this.data)}register(e,t,r=!1){if("object"==typeof e)return void Object.entries(e).forEach(([e,r])=>{this.register(e,r,t)});!this.exist(e)||r||Platform.isApplyingHMR()||this.onDuplicated(e);const n=this.options.process,i=n?call$1(n,this,e,t):t;return this.data[e]=i,i}unregister(e){const t=e?this.data[e]:null;return delete this.data[e],t}get(e){return e?this.data[e]:null}exist(e){return!!e&&null!=this.data[e]}onDuplicated(e){try{throw this.options.onConflict&&call$1(this.options.onConflict,this,e),new Error(`${upperFirst(this.options.type)} with name '${e}' already registered.`)}catch(err){throw err}}onNotFound(e,t){throw new Error(this.getSpellingSuggestion(e,t))}getSpellingSuggestion(e,t){const r=this.getSpellingSuggestionForName(e),n=t?`${t} ${lowerFirst(this.options.type)}`:this.options.type;return`${upperFirst(n)} with name '${e}' does not exist.${r?` Did you mean '${r}'?`:""}`}getSpellingSuggestionForName(e){return getSpellingSuggestion(e,Object.keys(this.data),e=>e)}}Registry2=Registry||(Registry={}),Registry2.create=function(e){return new Registry2(e)};const dot$2={color:"#aaaaaa",thickness:1,markup:"rect",update(e,t){const r=t.thickness*t.sx,n=t.thickness*t.sy;attr(e,{width:r,height:n,rx:r,ry:n,fill:t.color})}},fixedDot={color:"#aaaaaa",thickness:1,markup:"rect",update(e,t){const r=t.sx<=1?t.thickness*t.sx:t.thickness;attr(e,{width:r,height:r,rx:r,ry:r,fill:t.color})}},mesh={color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(e,t){let r;const n=t.width,i=t.height,o=t.thickness;r=n-o>=0&&i-o>=0?["M",n,0,"H0 M0 0 V0",i].join(" "):"M 0 0 0 0",attr(e,{d:r,stroke:t.color,"stroke-width":t.thickness})}},doubleMesh=[{color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(e,t){let r;const n=t.width,i=t.height,o=t.thickness;r=n-o>=0&&i-o>=0?["M",n,0,"H0 M0 0 V0",i].join(" "):"M 0 0 0 0",attr(e,{d:r,stroke:t.color,"stroke-width":t.thickness})}},{color:"rgba(224,224,224,0.2)",thickness:3,factor:4,markup:"path",update(e,t){let r;const n=t.factor||1,i=t.width*n,o=t.height*n,a=t.thickness;r=i-a>=0&&o-a>=0?["M",i,0,"H0 M0 0 V0",o].join(" "):"M 0 0 0 0",t.width=i,t.height=o,attr(e,{d:r,stroke:t.color,"stroke-width":t.thickness})}}],patterns$1=Object.freeze(Object.defineProperty({__proto__:null,dot:dot$2,doubleMesh:doubleMesh,fixedDot:fixedDot,mesh:mesh},Symbol.toStringTag,{value:"Module"}));class Grid{constructor(){this.patterns={},this.root=Vector.create(createSvgDocument(),{width:"100%",height:"100%"},[createSvgElement("defs")]).node}add(e,t){const r=this.root.childNodes[0];r&&r.appendChild(t),this.patterns[e]=t,Vector.create("rect",{width:"100%",height:"100%",fill:`url(#${e})`}).appendTo(this.root)}get(e){return this.patterns[e]}has(e){return null!=this.patterns[e]}}var Grid2;Grid2=Grid||(Grid={}),Grid2.presets=patterns$1,Grid2.registry=Registry.create({type:"grid"}),Grid2.registry.register(Grid2.presets,!0);const flipX=function(e){const t=document.createElement("canvas"),r=e.width,n=e.height;t.width=2*r,t.height=n;const i=t.getContext("2d");return i.drawImage(e,0,0,r,n),i.translate(2*r,0),i.scale(-1,1),i.drawImage(e,0,0,r,n),t},flipY=function(e){const t=document.createElement("canvas"),r=e.width,n=e.height;t.width=r,t.height=2*n;const i=t.getContext("2d");return i.drawImage(e,0,0,r,n),i.translate(0,2*n),i.scale(1,-1),i.drawImage(e,0,0,r,n),t},flipXY=function(e){const t=document.createElement("canvas"),r=e.width,n=e.height;t.width=2*r,t.height=2*n;const i=t.getContext("2d");return i.drawImage(e,0,0,r,n),i.setTransform(-1,0,0,-1,t.width,t.height),i.drawImage(e,0,0,r,n),i.setTransform(-1,0,0,1,t.width,0),i.drawImage(e,0,0,r,n),i.setTransform(1,0,0,-1,0,t.height),i.drawImage(e,0,0,r,n),t},watermark=function(e,t){const r=e.width,n=e.height,i=document.createElement("canvas");i.width=3*r,i.height=3*n;const o=i.getContext("2d"),a=null!=t.angle?-t.angle:-20,s=Angle.toRad(a),l=i.width/4,c=i.height/4;for(let u=0;u<4;u+=1)for(let t=0;t<4;t+=1)(u+t)%2>0&&(o.setTransform(1,0,0,1,(2*u-1)*l,(2*t-1)*c),o.rotate(s),o.drawImage(e,-r/2,-n/2,r,n));return i},patterns=Object.freeze(Object.defineProperty({__proto__:null,flipX:flipX,flipXY:flipXY,flipY:flipY,watermark:watermark},Symbol.toStringTag,{value:"Module"}));var Background,Background2;function getString(e,t){return null!=e?e:t}function getNumber(e,t){return null!=e&&Number.isFinite(e)?e:t}function outline(e={}){const t=getString(e.color,"blue"),r=getNumber(e.width,1),n=getNumber(e.margin,2);return`\n <filter>\n <feFlood flood-color="${t}" flood-opacity="${getNumber(e.opacity,1)}" result="colored"/>\n <feMorphology in="SourceAlpha" result="morphedOuter" operator="dilate" radius="${n+r}" />\n <feMorphology in="SourceAlpha" result="morphedInner" operator="dilate" radius="${n}" />\n <feComposite result="morphedOuterColored" in="colored" in2="morphedOuter" operator="in"/>\n <feComposite operator="xor" in="morphedOuterColored" in2="morphedInner" result="outline"/>\n <feMerge>\n <feMergeNode in="outline"/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>\n `.trim()}function highlight$2(e={}){const t=getString(e.color,"red"),r=getNumber(e.blur,0),n=getNumber(e.width,1);return`\n <filter>\n <feFlood flood-color="${t}" flood-opacity="${getNumber(e.opacity,1)}" result="colored"/>\n <feMorphology result="morphed" in="SourceGraphic" operator="dilate" radius="${n}"/>\n <feComposite result="composed" in="colored" in2="morphed" operator="in"/>\n <feGaussianBlur result="blured" in="composed" stdDeviation="${r}"/>\n <feBlend in="SourceGraphic" in2="blured" mode="normal"/>\n </filter>\n `.trim()}function blur(e={}){const t=getNumber(e.x,2);return`\n <filter>\n <feGaussianBlur stdDeviation="${null!=e.y&&Number.isFinite(e.y)?[t,e.y]:t}"/>\n </filter>\n `.trim()}function dropShadow(e={}){const t=getNumber(e.dx,0),r=getNumber(e.dy,0),n=getString(e.color,"black"),i=getNumber(e.blur,4),o=getNumber(e.opacity,1);return"SVGFEDropShadowElement"in window?`<filter>\n <feDropShadow stdDeviation="${i}" dx="${t}" dy="${r}" flood-color="${n}" flood-opacity="${o}" />\n </filter>`.trim():`<filter>\n <feGaussianBlur in="SourceAlpha" stdDeviation="${i}" />\n <feOffset dx="${t}" dy="${r}" result="offsetblur" />\n <feFlood flood-color="${n}" />\n <feComposite in2="offsetblur" operator="in" />\n <feComponentTransfer>\n <feFuncA type="linear" slope="${o}" />\n </feComponentTransfer>\n <feMerge>\n <feMergeNode/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>`.trim()}function grayScale(e={}){const t=getNumber(e.amount,1),r=.7152-.7152*(1-t);return`\n <filter>\n <feColorMatrix type="matrix" values="${.2126+.7874*(1-t)} ${r} ${.0722-.0722*(1-t)} 0 0 ${.2126-.2126*(1-t)} ${.7152+.2848*(1-t)} ${.0722-.0722*(1-t)} 0 0 ${.2126-.2126*(1-t)} ${r} ${.0722+.9278*(1-t)} 0 0 0 0 0 1 0"/>\n </filter>\n `.trim()}function sepia(e={}){const t=getNumber(e.amount,1);return`\n <filter>\n <feColorMatrix type="matrix" values="${.393+.607*(1-t)} ${.769-.769*(1-t)} ${.189-.189*(1-t)} 0 0 ${.349-.349*(1-t)} ${.686+.314*(1-t)} ${.168-.168*(1-t)} 0 0 ${.272-.272*(1-t)} ${.534-.534*(1-t)} ${.131+.869*(1-t)} 0 0 0 0 0 1 0"/>\n </filter>\n `.trim()}function saturate(e={}){return`\n <filter>\n <feColorMatrix type="saturate" values="${1-getNumber(e.amount,1)}"/>\n </filter>\n `.trim()}function hueRotate(e={}){return`\n <filter>\n <feColorMatrix type="hueRotate" values="${getNumber(e.angle,0)}"/>\n </filter>\n `.trim()}function invert(e={}){const t=getNumber(e.amount,1),r=1-t;return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="table" tableValues="${t} ${r}"/>\n <feFuncG type="table" tableValues="${t} ${r}"/>\n <feFuncB type="table" tableValues="${t} ${r}"/>\n </feComponentTransfer>\n </filter>\n `.trim()}function brightness(e={}){const t=getNumber(e.amount,1);return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="linear" slope="${t}"/>\n <feFuncG type="linear" slope="${t}"/>\n <feFuncB type="linear" slope="${t}"/>\n </feComponentTransfer>\n </filter>\n `.trim()}function contrast(e={}){const t=getNumber(e.amount,1),r=.5-t/2;return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="linear" slope="${t}" intercept="${r}"/>\n <feFuncG type="linear" slope="${t}" intercept="${r}"/>\n <feFuncB type="linear" slope="${t}" intercept="${r}"/>\n </feComponentTransfer>\n </filter>\n `.trim()}Background2=Background||(Background={}),Background2.presets=Object.assign({},patterns),Background2.presets["flip-x"]=flipX,Background2.presets["flip-y"]=flipY,Background2.presets["flip-xy"]=flipXY,Background2.registry=Registry.create({type:"background pattern"}),Background2.registry.register(Background2.presets,!0);const filters=Object.freeze(Object.defineProperty({__proto__:null,blur:blur,brightness:brightness,contrast:contrast,dropShadow:dropShadow,grayScale:grayScale,highlight:highlight$2,hueRotate:hueRotate,invert:invert,outline:outline,saturate:saturate,sepia:sepia},Symbol.toStringTag,{value:"Module"}));var Filter,Filter2;Filter2=Filter||(Filter={}),Filter2.presets=filters,Filter2.registry=Registry.create({type:"filter"}),Filter2.registry.register(Filter2.presets,!0);const raw={xlinkHref:"xlink:href",xlinkShow:"xlink:show",xlinkRole:"xlink:role",xlinkType:"xlink:type",xlinkArcrole:"xlink:arcrole",xlinkTitle:"xlink:title",xlinkActuate:"xlink:actuate",xmlSpace:"xml:space",xmlBase:"xml:base",xmlLang:"xml:lang",preserveAspectRatio:"preserveAspectRatio",requiredExtension:"requiredExtension",requiredFeatures:"requiredFeatures",systemLanguage:"systemLanguage",externalResourcesRequired:"externalResourceRequired"},ref={},refX={position:positionWrapper("x","width","origin")},refY={position:positionWrapper("y","height","origin")},refDx={position:positionWrapper("x","width","corner")},refDy={position:positionWrapper("y","height","corner")},refWidth={set:setWrapper("width","width")},refHeight={set:setWrapper("height","height")},refRx={set:setWrapper("rx","width")},refRy={set:setWrapper("ry","height")},refRInscribed={set:(e=>{const t=setWrapper("r","width"),r=setWrapper("r","height");return function(e,n){const i=n.refBBox;return call$1(i.height>i.width?t:r,this,e,n)}})()},refRCircumscribed={set(e,{refBBox:t}){let r=parseFloat(e);const n=isPercentage(e);n&&(r/=100);const i=Math.sqrt(t.height*t.height+t.width*t.width);let o;return Number.isFinite(r)&&(o=n||r>=0&&r<=1?r*i:Math.max(r+i,0)),{r:o}}},refCx={set:setWrapper("cx","width")},refCy={set:setWrapper("cy","height")},refDResetOffset={set:dWrapper({resetOffset:!0})},refDKeepOffset={set:dWrapper({resetOffset:!1})},refPointsResetOffset={set:pointsWrapper({resetOffset:!0})},refPointsKeepOffset={set:pointsWrapper({resetOffset:!1})},refR=refRInscribed,refD=refDResetOffset,refPoints=refPointsResetOffset,refX2=refX,refY2=refY,refWidth2=refWidth,refHeight2=refHeight;function positionWrapper(e,t,r){return(n,{refBBox:i})=>{if(null==n)return null;let o=parseFloat(n);const a=isPercentage(n);let s;if(a&&(o/=100),Number.isFinite(o)){const n=i[r];s=a||o>0&&o<1?n[e]+i[t]*o:n[e]+o}const l=new Point;return l[e]=s||0,l}}function setWrapper(e,t){return function(r,{refBBox:n}){let i=parseFloat(r);const o=isPercentage(r);o&&(i/=100);const a={};if(Number.isFinite(i)){const r=o||i>=0&&i<=1?i*n[t]:Math.max(i+n[t],0);a[e]=r}return a}}function shapeWrapper(e,t){const r="x6-shape",n=t&&t.resetOffset;return function(t,{elem:i,refBBox:o}){let a=data$2(i,r);if(!a||a.value!==t){const n=e(t);a={value:t,shape:n,shapeBBox:n.bbox()},data$2(i,r,a)}const s=a.shape.clone(),l=a.shapeBBox.clone(),c=l.getOrigin(),u=o.getOrigin();l.x=u.x,l.y=u.y;const d=o.getMaxScaleToFit(l,u),p=0===l.width||0===o.width?1:d.sx,h=0===l.height||0===o.height?1:d.sy;return s.scale(p,h,c),n&&s.translate(-c.x,-c.y),s}}function dWrapper(e){const t=shapeWrapper(function(e){return Path.parse(e)},e);return(e,r)=>({d:t(e,r).serialize()})}function pointsWrapper(e){const t=shapeWrapper(e=>new Polyline(e),e);return(e,r)=>({points:t(e,r).serialize()})}const fill={qualify:isPlainObject,set:(e,{view:t})=>`url(#${t.graph.defineGradient(e)})`},stroke$1={qualify:isPlainObject,set(e,{view:t}){const r=t.cell,n=Object.assign({},e);if(r.isEdge()&&"linearGradient"===n.type){const e=t,i=e.sourcePoint,o=e.targetPoint;n.id=`gradient-${n.type}-${r.id}`,n.attrs=Object.assign(Object.assign({},n.attrs),{x1:i.x,y1:i.y,x2:o.x,y2:o.y,gradientUnits:"userSpaceOnUse"}),t.graph.defs.remove(n.id)}return`url(#${t.graph.defineGradient(n)})`}},text={qualify:(e,{attrs:t})=>null==t.textWrap||!isPlainObject(t.textWrap),set(e,{view:t,elem:r,attrs:n}){const i="x6-text",o=data$2(r,i),a=e=>{try{return JSON.parse(e)}catch(t){return e}},s={x:n.x,eol:n.eol,annotations:a(n.annotations),textPath:a(n["text-path"]||n.textPath),textVerticalAnchor:n["text-vertical-anchor"]||n.textVerticalAnchor,displayEmpty:"true"===(n["display-empty"]||n.displayEmpty),lineHeight:n["line-height"]||n.lineHeight},l=n["font-size"]||n.fontSize,c=JSON.stringify([e,s]);if(l&&r.setAttribute("font-size",l),null==o||o!==c){const n=s.textPath;if(null!=n&&"object"==typeof n){const e=n.selector;if("string"==typeof e){const r=t.find(e)[0];r instanceof SVGPathElement&&(ensureId(r),s.textPath=Object.assign({"xlink:href":`#${r.id}`},n))}}text$1(r,`${e}`,s),data$2(r,i,c)}}},textWrap={qualify:isPlainObject,set(e,{view:t,elem:r,attrs:n,refBBox:i}){const o=e,a=o.width||0;isPercentage(a)?i.width*=parseFloat(a)/100:a<=0?i.width+=a:i.width=a;const s=o.height||0;let l;isPercentage(s)?i.height*=parseFloat(s)/100:s<=0?i.height+=s:i.height=s;let c=o.text;null==c&&(c=n.text||(null==r?void 0:r.textContent)),l=null!=c?breakText(`${c}`,i,{"font-weight":n["font-weight"]||n.fontWeight,"font-size":n["font-size"]||n.fontSize,"font-family":n["font-family"]||n.fontFamily,lineHeight:n.lineHeight},{ellipsis:o.ellipsis}):"",call$1(text.set,this,l,{view:t,elem:r,attrs:n,refBBox:i,cell:t.cell})}},isTextInUse=(e,{attrs:t})=>void 0!==t.text,lineHeight={qualify:isTextInUse},textVerticalAnchor={qualify:isTextInUse},textPath={qualify:isTextInUse},annotations={qualify:isTextInUse},eol={qualify:isTextInUse},displayEmpty={qualify:isTextInUse},title={qualify:(e,{elem:t})=>t instanceof SVGElement,set(e,{elem:t}){const r="x6-title",n=`${e}`,i=data$2(t,r);if(null==i||i!==n){data$2(t,r,n);const e=t.firstChild;if(e&&"TITLE"===e.tagName.toUpperCase()){e.textContent=n}else{const r=document.createElementNS(t.namespaceURI,"title");r.textContent=n,t.insertBefore(r,e)}}}},xAlign={offset:offsetWrapper("x","width","right")},yAlign={offset:offsetWrapper("y","height","bottom")},resetOffset={offset:(e,{refBBox:t})=>e?{x:-t.x,y:-t.y}:{x:0,y:0}};function offsetWrapper(e,t,r){return(n,{refBBox:i})=>{const o=new Point;let a;return a="middle"===n?i[t]/2:n===r?i[t]:"number"==typeof n&&Number.isFinite(n)?n>-1&&n<1?-i[t]*n:-n:isPercentage(n)?i[t]*parseFloat(n)/100:0,o[e]=-(i[e]+a),o}}const style$1={qualify:isPlainObject,set(e,{elem:t}){css$3(t,e)}},html$4={set(e,{elem:t}){t.innerHTML=`${e}`}},filter={qualify:isPlainObject,set:(e,{view:t})=>`url(#${t.graph.defineFilter(e)})`},port={set:e=>null!=e&&"object"==typeof e&&e.id?e.id:e};function normalize$4(e,t,r){let n,i;"object"==typeof t?(n=t.x,i=t.y):(n=t,i=r);const o=Path.parse(e),a=o.bbox();if(a){let e=-a.height/2-a.y,t=-a.width/2-a.x;"number"==typeof n&&(t-=n),"number"==typeof i&&(e-=i),o.translate(t,e)}return o.serialize()}var __rest$r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const block$1=e=>{var{size:t,width:r,height:n,offset:i,open:o}=e;return createClassicMarker({size:t,width:r,height:n,offset:i},!0===o,!0,void 0,__rest$r(e,["size","width","height","offset","open"]))},classic=e=>{var{size:t,width:r,height:n,offset:i,factor:o}=e;return createClassicMarker({size:t,width:r,height:n,offset:i},!1,!1,o,__rest$r(e,["size","width","height","offset","factor"]))};function createClassicMarker(e,t,r,n=3/4,i={}){const o=e.size||10,a=e.width||o,s=e.height||o,l=new Path,c={};if(t)l.moveTo(a,0).lineTo(0,s/2).lineTo(a,s),c.fill="none";else{if(l.moveTo(0,s/2),l.lineTo(a,0),!r){const e=clamp(n,0,1);l.lineTo(a*e,s/2)}l.lineTo(a,s),l.close()}return Object.assign(Object.assign(Object.assign({},c),i),{tagName:"path",d:normalize$4(l.serialize(),{x:null!=e.offset?e.offset:-a/2})})}var __rest$q=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const diamond=e=>{var{size:t,width:r,height:n,offset:i}=e,o=__rest$q(e,["size","width","height","offset"]);const a=t||10,s=r||a,l=n||a,c=new Path;return c.moveTo(0,l/2).lineTo(s/2,0).lineTo(s,l/2).lineTo(s/2,l).close(),Object.assign(Object.assign({},o),{tagName:"path",d:normalize$4(c.serialize(),null==i?-s/2:i)})};var __rest$p=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const path=e=>{var{d:t,offsetX:r,offsetY:n}=e,i=__rest$p(e,["d","offsetX","offsetY"]);return Object.assign(Object.assign({},i),{tagName:"path",d:normalize$4(t,r,n)})};var __rest$o=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const cross=e=>{var{size:t,width:r,height:n,offset:i}=e,o=__rest$o(e,["size","width","height","offset"]);const a=t||10,s=r||a,l=n||a,c=new Path;return c.moveTo(0,0).lineTo(s,l).moveTo(0,l).lineTo(s,0),Object.assign(Object.assign({},o),{tagName:"path",fill:"none",d:normalize$4(c.serialize(),i||-s/2)})};var __rest$n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const async=e=>{var{width:t,height:r,offset:n,open:i,flip:o}=e,a=__rest$n(e,["width","height","offset","open","flip"]);let s=r||6;const l=t||10,c=!0===i,u=!0===o,d=Object.assign(Object.assign({},a),{tagName:"path"});u&&(s=-s);const p=new Path;return p.moveTo(0,s).lineTo(l,0),c?d.fill="none":(p.lineTo(l,s),p.close()),d.d=normalize$4(p.serialize(),{x:n||-l/2,y:s/2}),d};var __rest$m=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const circle=e=>{var{r:t}=e,r=__rest$m(e,["r"]);const n=t||5;return Object.assign(Object.assign({cx:n},r),{tagName:"circle",r:n})},circlePlus=e=>{var{r:t}=e,r=__rest$m(e,["r"]);const n=t||5,i=new Path;return i.moveTo(n,0).lineTo(n,2*n),i.moveTo(0,n).lineTo(2*n,n),{children:[Object.assign(Object.assign({},circle({r:n})),{fill:"none"}),Object.assign(Object.assign({},r),{tagName:"path",d:normalize$4(i.serialize(),-n)})]}};var __rest$l=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const ellipse$1=e=>{var{rx:t,ry:r}=e,n=__rest$l(e,["rx","ry"]);const i=t||5,o=r||5;return Object.assign(Object.assign({cx:i},n),{tagName:"ellipse",rx:i,ry:o})},markers=Object.freeze(Object.defineProperty({__proto__:null,async:async,block:block$1,circle:circle,circlePlus:circlePlus,classic:classic,cross:cross,diamond:diamond,ellipse:ellipse$1,path:path},Symbol.toStringTag,{value:"Module"}));var Marker,Marker2;Marker2=Marker||(Marker={}),Marker2.presets=markers,Marker2.registry=Registry.create({type:"marker"}),Marker2.registry.register(Marker2.presets,!0),function(e){e.normalize=normalize$4}(Marker||(Marker={}));var __rest$k=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};function qualify(e){return"string"==typeof e||isPlainObject(e)}const sourceMarker={qualify:qualify,set:(e,{view:t,attrs:r})=>createMarker("marker-start",e,t,r)},targetMarker={qualify:qualify,set:(e,{view:t,attrs:r})=>createMarker("marker-end",e,t,r,{transform:"rotate(180)"})},vertexMarker={qualify:qualify,set:(e,{view:t,attrs:r})=>createMarker("marker-mid",e,t,r)};function createMarker(e,t,r,n,i={}){const o="string"==typeof t?{name:t}:t,{name:a,args:s}=o,l=__rest$k(o,["name","args"]);let c=l;if(a&&"string"==typeof a){const e=Marker.registry.get(a);if(!e)return Marker.registry.onNotFound(a);c=e(Object.assign(Object.assign({},l),s))}const u=Object.assign(Object.assign(Object.assign({},normalizeAttr(n,e)),i),c);return{[e]:`url(#${r.graph.defineMarker(u)})`}}function normalizeAttr(e,t){const r={},n=e.stroke;"string"==typeof n&&(r.stroke=n,r.fill=n);let i=e.strokeOpacity;if(null==i&&(i=e["stroke-opacity"]),null==i&&(i=e.opacity),null!=i&&(r["stroke-opacity"]=i,r["fill-opacity"]=i),"marker-mid"!==t){const n=parseFloat(e.strokeWidth||e["stroke-width"]);if(Number.isFinite(n)&&n>1){const e=Math.ceil(n/2);r.refX="marker-start"===t?e:-e}}return r}const isEdgeView=(e,{view:t})=>t.cell.isEdge(),connection={qualify:isEdgeView,set(e,t){var r,n,i,o;const a=t.view,s=e.reverse||!1,l=e.stubs||0;let c;if(Number.isFinite(l)&&0!==l)if(s){let e,t;const s=a.getConnectionLength()||0;l<0?(e=(s+l)/2,t=-l):(e=l,t=s-2*l);const u=a.getConnection();c=null===(o=null===(i=null===(n=null===(r=null==u?void 0:u.divideAtLength(e))||void 0===r?void 0:r[1])||void 0===n?void 0:n.divideAtLength(t))||void 0===i?void 0:i[0])||void 0===o?void 0:o.serialize()}else{let e;if(l<0){e=((a.getConnectionLength()||0)+l)/2}else e=l;const t=a.getConnection();if(t){const r=t.divideAtLength(e),n=t.divideAtLength(-e);r&&n&&(c=`${r[0].serialize()} ${n[1].serialize()}`)}}return{d:c||a.getConnectionPathData()}}},atConnectionLengthKeepGradient={qualify:isEdgeView,set:atConnectionWrapper("getTangentAtLength",{rotate:!0})},atConnectionLengthIgnoreGradient={qualify:isEdgeView,set:atConnectionWrapper("getTangentAtLength",{rotate:!1})},atConnectionRatioKeepGradient={qualify:isEdgeView,set:atConnectionWrapper("getTangentAtRatio",{rotate:!0})},atConnectionRatioIgnoreGradient={qualify:isEdgeView,set:atConnectionWrapper("getTangentAtRatio",{rotate:!1})},atConnectionLength=atConnectionLengthKeepGradient,atConnectionRatio=atConnectionRatioKeepGradient;function atConnectionWrapper(e,t){const r={x:1,y:0};return(n,i)=>{let o,a;const s=i.view,l=s[e](Number(n));return l?(a=t.rotate?l.vector().vectorAngle(r):0,o=l.start):(o=s.path.start,a=0),0===a?{transform:`translate(${o.x},${o.y}')`}:{transform:`translate(${o.x},${o.y}') rotate(${a})`}}}const attrs=Object.freeze(Object.defineProperty({__proto__:null,annotations:annotations,atConnectionLength:atConnectionLength,atConnectionLengthIgnoreGradient:atConnectionLengthIgnoreGradient,atConnectionLengthKeepGradient:atConnectionLengthKeepGradient,atConnectionRatio:atConnectionRatio,atConnectionRatioIgnoreGradient:atConnectionRatioIgnoreGradient,atConnectionRatioKeepGradient:atConnectionRatioKeepGradient,connection:connection,displayEmpty:displayEmpty,eol:eol,fill:fill,filter:filter,html:html$4,lineHeight:lineHeight,port:port,ref:ref,refCx:refCx,refCy:refCy,refD:refD,refDKeepOffset:refDKeepOffset,refDResetOffset:refDResetOffset,refDx:refDx,refDy:refDy,refHeight:refHeight,refHeight2:refHeight2,refPoints:refPoints,refPointsKeepOffset:refPointsKeepOffset,refPointsResetOffset:refPointsResetOffset,refR:refR,refRCircumscribed:refRCircumscribed,refRInscribed:refRInscribed,refRx:refRx,refRy:refRy,refWidth:refWidth,refWidth2:refWidth2,refX:refX,refX2:refX2,refY:refY,refY2:refY2,resetOffset:resetOffset,sourceMarker:sourceMarker,stroke:stroke$1,style:style$1,targetMarker:targetMarker,text:text,textPath:textPath,textVerticalAnchor:textVerticalAnchor,textWrap:textWrap,title:title,vertexMarker:vertexMarker,xAlign:xAlign,yAlign:yAlign},Symbol.toStringTag,{value:"Module"}));var Attr,Attr2;Attr2=Attr||(Attr={}),Attr2.isValidDefinition=function(e,t,r){if(null!=e){if("string"==typeof e)return!0;if("function"!=typeof e.qualify||call$1(e.qualify,this,t,r))return!0}return!1},function(e){e.presets=Object.assign(Object.assign({},raw),attrs),e.registry=Registry.create({type:"attribute definition"}),e.registry.register(e.presets,!0)}(Attr||(Attr={}));const Config={prefixCls:"x6",autoInsertCSS:!0,useCSSSelector:!0,prefix:e=>`${Config.prefixCls}-${e}`},defaultClassName=Config.prefix("highlighted"),className$1={highlight(e,t,r){addClass(t,r&&r.className||defaultClassName)},unhighlight(e,t,r){removeClass(t,r&&r.className||defaultClassName)}},className=Config.prefix("highlight-opacity"),opacity={highlight(e,t){addClass(t,className)},unhighlight(e,t){removeClass(t,className)}};var Util$1;!function(e){function t(e,t){const r=createSVGPoint(e.x,e.y).matrixTransform(t);return new Point(r.x,r.y)}function r(e,t){const r=createSvgElement("svg").createSVGPoint();r.x=e.x,r.y=e.y;const n=r.matrixTransform(t);r.x=e.x+e.width,r.y=e.y;const i=r.matrixTransform(t);r.x=e.x+e.width,r.y=e.y+e.height;const o=r.matrixTransform(t);r.x=e.x,r.y=e.y+e.height;const a=r.matrixTransform(t),s=Math.min(n.x,i.x,o.x,a.x),l=Math.max(n.x,i.x,o.x,a.x),c=Math.min(n.y,i.y,o.y,a.y),u=Math.max(n.y,i.y,o.y,a.y);return new Rectangle(s,c,l-s,u-c)}function n(e,t={}){let o;if(!e.ownerSVGElement||!isSVGGraphicsElement$1(e)){if(isHTMLElement(e)){const{left:t,top:r,width:n,height:o}=i(e);return new Rectangle(t,r,n,o)}return new Rectangle(0,0,0,0)}let a=t.target;if(!t.recursive){try{o=e.getBBox()}catch(e10){o={x:e.clientLeft,y:e.clientTop,width:e.clientWidth,height:e.clientHeight}}if(!a)return Rectangle.create(o);return r(o,getTransformToElement(e,a))}{const t=e.childNodes,r=t.length;if(0===r)return n(e,{target:a});a||(a=e);for(let e=0;e<r;e+=1){const r=t[e];let i;i=0===r.childNodes.length?n(r,{target:a}):n(r,{target:a,recursive:!0}),o=o?o.union(i):i}return o}}function i(e){let t=0,r=0,n=0,i=0;if(e){let o=e;for(;o;)t+=o.offsetLeft,r+=o.offsetTop,o=o.offsetParent,o&&(t+=parseInt(getComputedStyle$1(o,"borderLeft"),10),r+=parseInt(getComputedStyle$1(o,"borderTop"),10));n=e.offsetWidth,i=e.offsetHeight}return{left:t,top:r,width:n,height:i}}function o(e){const t=t=>{const r=e.getAttribute(t),n=r?parseFloat(r):0;return Number.isNaN(n)?0:n};switch(e instanceof SVGElement&&e.nodeName.toLowerCase()){case"rect":return new Rectangle(t("x"),t("y"),t("width"),t("height"));case"circle":return new Ellipse(t("cx"),t("cy"),t("r"),t("r"));case"ellipse":return new Ellipse(t("cx"),t("cy"),t("rx"),t("ry"));case"polyline":{const t=getPointsFromSvgElement(e);return new Polyline(t)}case"polygon":{const t=getPointsFromSvgElement(e);return t.length>1&&t.push(t[0]),new Polyline(t)}case"path":{let t=e.getAttribute("d");return Path.isValid(t)||(t=Path.normalize(t)),Path.parse(t)}case"line":return new Line(t("x1"),t("y1"),t("x2"),t("y2"))}return n(e)}function a(e){if(null==e)return null;let t=e;do{let e=t.tagName;if("string"!=typeof e)return null;if(e=e.toUpperCase(),hasClass(t,"x6-port"))t=t.nextElementSibling;else if("G"===e)t=t.firstElementChild;else{if("TITLE"!==e)break;t=t.nextElementSibling}}while(t);return t}e.normalizeMarker=normalize$4,e.transformPoint=t,e.transformLine=function(e,r){return new Line(t(e.start,r),t(e.end,r))},e.transformPolyline=function(e,r){let n=e instanceof Polyline?e.points:e;return Array.isArray(n)||(n=[]),new Polyline(n.map(e=>t(e,r)))},e.transformRectangle=r,e.bbox=function(e,t,n){let i;const o=e.ownerSVGElement;if(!o)return new Rectangle(0,0,0,0);try{i=e.getBBox()}catch(e10){i={x:e.clientLeft,y:e.clientTop,width:e.clientWidth,height:e.clientHeight}}return t?Rectangle.create(i):r(i,getTransformToElement(e,n||o))},e.getBBox=n,e.getBoundingOffsetRect=i,e.toGeometryShape=o,e.translateAndAutoOrient=function(e,t,r,i){const o=Point.create(t),a=Point.create(r);if(!i){i=e instanceof SVGSVGElement?e:e.ownerSVGElement}const s=scale(e);e.setAttribute("transform","");const l=n(e,{target:i}).scale(s.sx,s.sy),c=createSVGTransform();c.setTranslate(-l.x-l.width/2,-l.y-l.height/2);const u=createSVGTransform(),d=o.angleBetween(a,o.clone().translate(1,0));d&&u.setRotate(d,0,0);const p=createSVGTransform(),h=o.clone().move(a,l.width/2);p.setTranslate(2*o.x-h.x,2*o.y-h.y);const f=getTransformToElement(e,i),g=createSVGTransform();g.setMatrix(p.matrix.multiply(u.matrix.multiply(c.matrix.multiply(f.scale(s.sx,s.sy))))),e.setAttribute("transform",matrixToTransformString(g.matrix))},e.findShapeNode=a,e.getBBoxV2=function(e){const t=a(e);if(!isSVGGraphicsElement$1(t)){if(isHTMLElement(e)){const{left:t,top:r,width:n,height:o}=i(e);return new Rectangle(t,r,n,o)}return new Rectangle(0,0,0,0)}return o(t).bbox()||Rectangle.create()}}(Util$1||(Util$1={}));const defaultOptions={padding:3,rx:0,ry:0,attrs:{"stroke-width":3,stroke:"#FEB663"}},stroke={highlight(e,t,r){const n=Private$4.getHighlighterId(t,r);if(Private$4.hasCache(n))return;r=defaultsDeep({},r,defaultOptions);const i=Vector.create(t);let o,a;try{o=i.toPathData()}catch(u){a=Util$1.bbox(i.node,!0),o=rectToPathData(Object.assign(Object.assign({},r),a))}const s=createSvgElement("path");if(attr(s,Object.assign({d:o,"pointer-events":"none","vector-effect":"non-scaling-stroke",fill:"none"},r.attrs?kebablizeAttrs(r.attrs):null)),e.isEdgeElement(t))attr(s,"d",e.getConnectionPathData());else{let t=i.getTransformToElement(e.container);const n=r.padding;if(n){null==a&&(a=Util$1.bbox(i.node,!0));const e=a.x+a.width/2,r=a.y+a.height/2;a=Util$1.transformRectangle(a,t);const o=Math.max(a.width,1),s=Math.max(a.height,1),l=(o+n)/o,c=(s+n)/s,u=createSVGMatrix({a:l,b:0,c:0,d:c,e:e-l*e,f:r-c*r});t=t.multiply(u)}transform(s,t)}addClass(s,Config.prefix("highlight-stroke"));const l=e.cell,c=()=>Private$4.removeHighlighter(n);l.on("removed",c),l.model&&l.model.on("reseted",c),e.container.appendChild(s),Private$4.setCache(n,s)},unhighlight(e,t,r){Private$4.removeHighlighter(Private$4.getHighlighterId(t,r))}};var Private$4;!function(e){e.getHighlighterId=function(e,t){return ensureId(e),e.id+JSON.stringify(t)};const t={};e.setCache=function(e,r){t[e]=r},e.hasCache=function(e){return null!=t[e]},e.removeHighlighter=function(e){const r=t[e];r&&(remove(r),delete t[e])}}(Private$4||(Private$4={}));const highlighters=Object.freeze(Object.defineProperty({__proto__:null,className:className$1,opacity:opacity,stroke:stroke},Symbol.toStringTag,{value:"Module"}));var Highlighter,Highlighter2;function normalizePoint$1(e,t={}){return new Point(normalizePercentage(t.x,e.width),normalizePercentage(t.y,e.height))}function toResult$1(e,t,r){return Object.assign({angle:t,position:e.toJSON()},r)}Highlighter2=Highlighter||(Highlighter={}),Highlighter2.check=function(e,t){if("function"!=typeof t.highlight)throw new Error(`Highlighter '${e}' is missing required \`highlight()\` method`);if("function"!=typeof t.unhighlight)throw new Error(`Highlighter '${e}' is missing required \`unhighlight()\` method`)},function(e){e.presets=highlighters,e.registry=Registry.create({type:"highlighter"}),e.registry.register(e.presets,!0)}(Highlighter||(Highlighter={}));const absolute=(e,t)=>e.map(({x:e,y:r,angle:n})=>toResult$1(normalizePoint$1(t,{x:e,y:r}),n||0)),ellipse=(e,t,r)=>{const n=r.start||0,i=r.step||20;return ellipseLayout(e,t,n,(e,t)=>(e+.5-t/2)*i)},ellipseSpread=(e,t,r)=>{const n=r.start||0,i=r.step||360/e.length;return ellipseLayout(e,t,n,e=>e*i)};function ellipseLayout(e,t,r,n){const i=t.getCenter(),o=t.getTopCenter(),a=t.width/t.height,s=Ellipse.fromRect(t),l=e.length;return e.map((e,t)=>{const c=r+n(t,l),u=o.clone().rotate(-c,i).scale(a,1,i),d=e.compensateRotate?-s.tangentTheta(u):0;return(e.dx||e.dy)&&u.translate(e.dx||0,e.dy||0),e.dr&&u.move(i,e.dr),toResult$1(u.round(),d,e)})}var __rest$j=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};const line=(e,t,r)=>lineLayout(e,normalizePoint$1(t,r.start||t.getOrigin()),normalizePoint$1(t,r.end||t.getCorner()),r),left$3=(e,t,r)=>lineLayout(e,t.getTopLeft(),t.getBottomLeft(),r),right$2=(e,t,r)=>lineLayout(e,t.getTopRight(),t.getBottomRight(),r),top$3=(e,t,r)=>lineLayout(e,t.getTopLeft(),t.getTopRight(),r),bottom$2=(e,t,r)=>lineLayout(e,t.getBottomLeft(),t.getBottomRight(),r);function lineLayout(e,t,r,n){const i=new Line(t,r),o=e.length;return e.map((e,t)=>{var{strict:r}=e,a=__rest$j(e,["strict"]);const s=r||n.strict?(t+1)/(o+1):(t+.5)/o,l=i.pointAt(s);return(a.dx||a.dy)&&l.translate(a.dx||0,a.dy||0),toResult$1(l.round(),0,a)})}const layouts$1=Object.freeze(Object.defineProperty({__proto__:null,absolute:absolute,bottom:bottom$2,ellipse:ellipse,ellipseSpread:ellipseSpread,left:left$3,line:line,right:right$2,top:top$3},Symbol.toStringTag,{value:"Module"}));var PortLayout,PortLayout2;PortLayout2=PortLayout||(PortLayout={}),PortLayout2.presets=layouts$1,PortLayout2.registry=Registry.create({type:"port layout"}),PortLayout2.registry.register(PortLayout2.presets,!0);const defaults$3={position:{x:0,y:0},angle:0,attrs:{".":{y:"0","text-anchor":"start"}}};function toResult(e,t){const{x:r,y:n,angle:i,attrs:o}=t||{};return defaultsDeep({},{angle:i,attrs:o,position:{x:r,y:n}},e,defaults$3)}const manual=(e,t,r)=>toResult({position:t.getTopLeft()},r),left$2=(e,t,r)=>toResult({position:{x:-15,y:0},attrs:{".":{y:".3em","text-anchor":"end"}}},r),right$1=(e,t,r)=>toResult({position:{x:15,y:0},attrs:{".":{y:".3em","text-anchor":"start"}}},r),top$2=(e,t,r)=>toResult({position:{x:0,y:-15},attrs:{".":{"text-anchor":"middle"}}},r),bottom$1=(e,t,r)=>toResult({position:{x:0,y:15},attrs:{".":{y:".6em","text-anchor":"middle"}}},r),outside=(e,t,r)=>outsideLayout(e,t,!1,r),outsideOriented=(e,t,r)=>outsideLayout(e,t,!0,r),inside=(e,t,r)=>insideLayout(e,t,!1,r),insideOriented=(e,t,r)=>insideLayout(e,t,!0,r);function outsideLayout(e,t,r,n){const i=null!=n.offset?n.offset:15,o=t.getCenter().theta(e),a=getBBoxAngles(t);let s,l,c,u,d=0;return o<a[1]||o>a[2]?(s=".3em",l=i,c=0,u="start"):o<a[0]?(s="0",l=0,c=-i,r?(d=-90,u="start"):u="middle"):o<a[3]?(s=".3em",l=-i,c=0,u="end"):(s=".6em",l=0,c=i,r?(d=90,u="start"):u="middle"),toResult({position:{x:Math.round(l),y:Math.round(c)},angle:d,attrs:{".":{y:s,"text-anchor":u}}},n)}function insideLayout(e,t,r,n){const i=null!=n.offset?n.offset:15,o=t.getCenter().theta(e),a=getBBoxAngles(t);let s,l,c,u,d=0;return o<a[1]||o>a[2]?(s=".3em",l=-i,c=0,u="end"):o<a[0]?(s=".6em",l=0,c=i,r?(d=90,u="start"):u="middle"):o<a[3]?(s=".3em",l=i,c=0,u="start"):(s="0em",l=0,c=-i,r?(d=-90,u="start"):u="middle"),toResult({position:{x:Math.round(l),y:Math.round(c)},angle:d,attrs:{".":{y:s,"text-anchor":u}}},n)}function getBBoxAngles(e){const t=e.getCenter(),r=t.theta(e.getTopLeft()),n=t.theta(e.getBottomLeft()),i=t.theta(e.getBottomRight());return[r,t.theta(e.getTopRight()),i,n]}const radial=(e,t,r)=>radialLayout(e.diff(t.getCenter()),!1,r),radialOriented=(e,t,r)=>radialLayout(e.diff(t.getCenter()),!0,r);function radialLayout(e,t,r){const n=null!=r.offset?r.offset:20,i=new Point(0,0),o=-e.theta(i);let a,s=".3em",l=o;return(o+90)%180==0?(a=t?"end":"middle",t||-270!==o||(s="0em")):o>-270&&o<-90?(a="start",l=o-180):a="end",toResult({position:e.clone().move(i,n).diff(e).round().round().toJSON(),angle:t?l:0,attrs:{".":{y:s,"text-anchor":a}}},r)}const layouts=Object.freeze(Object.defineProperty({__proto__:null,bottom:bottom$1,inside:inside,insideOriented:insideOriented,left:left$2,manual:manual,outside:outside,outsideOriented:outsideOriented,radial:radial,radialOriented:radialOriented,right:right$1,top:top$2},Symbol.toStringTag,{value:"Module"}));var PortLabelLayout,PortLabelLayout2;PortLabelLayout2=PortLabelLayout||(PortLabelLayout={}),PortLabelLayout2.presets=layouts,PortLabelLayout2.registry=Registry.create({type:"port label layout"}),PortLabelLayout2.registry.register(PortLabelLayout2.presets,!0);var __decorate$u=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},View2,Private$3,Markup,Markup2;class View extends Basecoat{get priority(){return 2}get disposeContainer(){return!0}constructor(){super(),this.cid=Private$3.uniqueId(),View.views[this.cid]=this}confirmUpdate(e,t){return 0}empty(e=this.container){return empty$2(e),this}unmount(e=this.container){return remove(e),this}remove(e=this.container){return e===this.container?(this.removeEventListeners(document),this.onRemove(),delete View.views[this.cid],this.disposeContainer&&this.unmount(e)):this.unmount(e),this}onRemove(){}setClass(e,t=this.container){t.classList.value=Array.isArray(e)?e.join(" "):e}addClass(e,t=this.container){return addClass(t,Array.isArray(e)?e.join(" "):e),this}removeClass(e,t=this.container){return removeClass(t,Array.isArray(e)?e.join(" "):e),this}setStyle(e,t=this.container){return css$3(t,e),this}setAttrs(e,t=this.container){return null!=e&&null!=t&&attr(t,e),this}findAttr(e,t=this.container){let r=t;for(;r&&1===r.nodeType;){const t=r.getAttribute(e);if(null!=t)return t;if(r===this.container)return null;r=r.parentNode}return null}find(e,t=this.container,r=this.selectors){return View.find(e,t,r).elems}findOne(e,t=this.container,r=this.selectors){const n=this.find(e,t,r);return n.length>0?n[0]:null}findByAttr(e,t=this.container){let r=t;for(;r&&r.getAttribute;){const t=r.getAttribute(e);if((null!=t||r===this.container)&&"false"!==t)return r;r=r.parentNode}return null}getSelector(e,t){let r;if(e===this.container)return"string"==typeof t&&(r=`> ${t}`),r;if(e){const n=index$1(e)+1;r=`${e.tagName.toLowerCase()}:nth-child(${n})`,t&&(r+=` > ${t}`),r=this.getSelector(e.parentNode,r)}return r}prefixClassName(e){return Config.prefix(e)}delegateEvents(e,t){if(null==e)return this;t||this.undelegateEvents();const r=/^(\S+)\s*(.*)$/;return Object.keys(e).forEach(t=>{const n=t.match(r);if(null==n)return;const i=this.getEventHandler(e[t]);"function"==typeof i&&this.delegateEvent(n[1],n[2],i)}),this}undelegateEvents(){return Event$1.off(this.container,this.getEventNamespace()),this}delegateDocumentEvents(e,t){return this.addEventListeners(document,e,t),this}undelegateDocumentEvents(){return this.removeEventListeners(document),this}delegateEvent(e,t,r){return Event$1.on(this.container,e+this.getEventNamespace(),t,r),this}undelegateEvent(e,t,r){const n=e+this.getEventNamespace();return null==t?Event$1.off(this.container,n):"string"==typeof t?Event$1.off(this.container,n,t,r):Event$1.off(this.container,n,t),this}addEventListeners(e,t,r){if(null==t)return this;const n=this.getEventNamespace();return Object.keys(t).forEach(i=>{const o=this.getEventHandler(t[i]);"function"==typeof o&&Event$1.on(e,i+n,r,o)}),this}removeEventListeners(e){return null!=e&&Event$1.off(e,this.getEventNamespace()),this}getEventNamespace(){return`.${Config.prefixCls}-event-${this.cid}`}getEventHandler(e){let t;if("string"==typeof e){const r=this[e];"function"==typeof r&&(t=(...e)=>r.call(this,...e))}else t=(...t)=>e.call(this,...t);return t}getEventTarget(e,t={}){const{target:r,type:n,clientX:i=0,clientY:o=0}=e;return t.fromPoint||"touchmove"===n||"touchend"===n?document.elementFromPoint(i,o):r}stopPropagation(e){return this.setEventData(e,{propagationStopped:!0}),this}isPropagationStopped(e){return!0===this.getEventData(e).propagationStopped}getEventData(e){return this.eventData(e)}setEventData(e,t){return this.eventData(e,t)}eventData(e,t){if(null==e)throw new TypeError("Event object required");let r=e.data;const n=`__${this.cid}__`;return null==t?null==r?{}:r[n]||{}:(null==r&&(r=e.data={}),null==r[n]?r[n]=Object.assign({},t):r[n]=Object.assign(Object.assign({},r[n]),t),r[n])}normalizeEvent(e){return View.normalizeEvent(e)}dispose(){this.remove()}}__decorate$u([View.dispose()],View.prototype,"dispose",null),View2=View||(View={}),View2.createElement=function(e,t){return t?createSvgElement(e||"g"):createElementNS(e||"div")},View2.find=function(e,t,r){if(!e||"."===e)return{elems:[t]};if(r){const t=r[e];if(t)return{elems:Array.isArray(t)?t:[t]}}{const r=e.includes(">")?`:scope ${e}`:e;return{isCSSSelector:!0,elems:Array.prototype.slice.call(t.querySelectorAll(r))}}},View2.normalizeEvent=function(e){let t=e;const r=e.originalEvent,n=r&&r.changedTouches&&r.changedTouches[0];if(n){for(const t in e)void 0===n[t]&&(n[t]=e[t]);t=n}return t},function(e){e.views={},e.getView=function(t){return e.views[t]||null}}(View||(View={})),function(e){let t=0;e.uniqueId=function(){const e=`v${t}`;return t+=1,e}}(Private$3||(Private$3={}));class Cache{constructor(e){this.view=e,this.clean()}clean(){this.elemCache&&this.elemCache.dispose(),this.elemCache=new Dictionary,this.pathCache={}}get(e){return this.elemCache.has(e)||this.elemCache.set(e,{}),this.elemCache.get(e)}getData(e){const t=this.get(e);return t.data||(t.data={}),t.data}getMatrix(e){const t=this.get(e);if(null==t.matrix){const r=this.view.container;t.matrix=getTransformToParentElement(e,r)}return createSVGMatrix(t.matrix)}getShape(e){const t=this.get(e);return null==t.shape&&(t.shape=Util$1.toGeometryShape(e)),t.shape.clone()}getBoundingRect(e){const t=this.get(e);return null==t.boundingRect&&(t.boundingRect=Util$1.getBBoxV2(e)),t.boundingRect.clone()}}!function(e){function t(e){return null!=e&&"string"==typeof e}function r(e,t={ns:ns.svg}){const r=document.createDocumentFragment(),n={},i={},o=[{markup:Array.isArray(e)?e:[e],parent:r,ns:t.ns}];for(;o.length>0;){const e=o.pop();let t=e.ns||ns.svg;const r=e.markup,a=e.parent;r.forEach(e=>{const r=e.tagName;if(!r)throw new TypeError("Invalid tagName");e.ns&&(t=e.ns);const s=t?createElementNS(r,t):createElement$1(r),l=e.attrs;l&&attr(s,kebablizeAttrs(l));const c=e.style;c&&css$3(s,c);const u=e.className;null!=u&&s.setAttribute("class",Array.isArray(u)?u.join(" "):u),e.textContent&&(s.textContent=e.textContent);const d=e.selector;if(null!=d){if(i[d])throw new TypeError("Selector must be unique");i[d]=s}if(e.groupSelector){let t=e.groupSelector;Array.isArray(t)||(t=[t]),t.forEach(e=>{n[e]||(n[e]=[]),n[e].push(s)})}a.appendChild(s);const p=e.children;Array.isArray(p)&&o.push({ns:t,markup:p,parent:s})})}return Object.keys(n).forEach(e=>{if(i[e])throw new Error("Ambiguous group selector");i[e]=n[e]}),{fragment:r,selectors:i,groups:n}}function n(e){return e instanceof SVGElement?createSvgElement("g"):createElement$1("div")}e.isJSONMarkup=function(e){return null!=e&&!t(e)},e.isStringMarkup=t,e.clone=function(e){return null==e||t(e)?e:cloneDeep(e)},e.sanitize=function(e){return`${e}`.trim().replace(/[\r|\n]/g," ").replace(/>\s+</g,"><")},e.parseJSONMarkup=r,e.renderMarkup=function(e){if(t(e)){const t=Vector.createVectors(e),r=t.length;if(1===r)return{elem:t[0].node};if(r>1){const e=n(t[0].node);return t.forEach(t=>{e.appendChild(t.node)}),{elem:e}}return{}}const i=r(e),o=i.fragment;let a=null;return o.childNodes.length>1?(a=n(o.firstChild),a.appendChild(o)):a=o.firstChild,{elem:a,selectors:i.selectors}},e.parseLabelStringMarkup=function(e){const t=Vector.createVectors(e),r=document.createDocumentFragment();for(let n=0,i=t.length;n<i;n+=1){const e=t[n].node;r.appendChild(e)}return{fragment:r,selectors:{}}}}(Markup||(Markup={})),Markup2=Markup||(Markup={}),Markup2.getSelector=function e(t,r,n){if(null!=t){let i;const o=t.tagName.toLowerCase();if(t===r)return i="string"==typeof n?`> ${o} > ${n}`:`> ${o}`,i;const a=t.parentNode;return i=a&&a.childNodes.length>1?`${o}:nth-child(${index$1(t)+1})`:o,n&&(i+=` > ${n}`),e(t.parentNode,r,i)}return n},function(e){e.getPortContainerMarkup=function(){return"g"},e.getPortMarkup=function(){return{tagName:"circle",selector:"circle",attrs:{r:10,fill:"#FFFFFF",stroke:"#000000"}}},e.getPortLabelMarkup=function(){return{tagName:"text",selector:"text",attrs:{fill:"#000000"}}}}(Markup||(Markup={})),function(e){e.getEdgeMarkup=function(){return[{tagName:"path",selector:"wrap",groupSelector:"lines",attrs:{fill:"none",cursor:"pointer",stroke:"transparent",strokeLinecap:"round"}},{tagName:"path",selector:"line",groupSelector:"lines",attrs:{fill:"none",pointerEvents:"none"}}]}}(Markup||(Markup={})),function(e){e.getForeignObjectMarkup=function(e=!1){return{tagName:"foreignObject",selector:"fo",children:[{ns:ns.xhtml,tagName:"body",selector:"foBody",attrs:{xmlns:ns.xhtml},style:{width:"100%",height:"100%",background:"transparent"},children:e?[]:[{tagName:"div",selector:"foContent",style:{width:"100%",height:"100%"}}]}]}}}(Markup||(Markup={}));class AttrManager{constructor(e){this.view=e}get cell(){return this.view.cell}getDefinition(e){return this.cell.getAttrDefinition(e)}processAttrs(e,t){let r,n,i,o;const a=[];return Object.keys(t).forEach(n=>{const i=t[n],o=this.getDefinition(n),s=call$1(Attr.isValidDefinition,this.view,o,i,{elem:e,attrs:t,cell:this.cell,view:this.view});if(o&&s)"string"==typeof o?(null==r&&(r={}),r[o]=i):null!==i&&a.push({name:n,definition:o});else{null==r&&(r={});const e=CASE_SENSITIVE_ATTR.includes(n)?n:kebabCase(n);r[e]=i}}),a.forEach(({name:e,definition:r})=>{const a=t[e];"function"==typeof r.set&&(null==n&&(n={}),n[e]=a);"function"==typeof r.offset&&(null==i&&(i={}),i[e]=a);"function"==typeof r.position&&(null==o&&(o={}),o[e]=a)}),{raw:t,normal:r,set:n,offset:i,position:o}}mergeProcessedAttrs(e,t){e.set=Object.assign(Object.assign({},e.set),t.set),e.position=Object.assign(Object.assign({},e.position),t.position),e.offset=Object.assign(Object.assign({},e.offset),t.offset);const r=e.normal&&e.normal.transform;null!=r&&t.normal&&(t.normal.transform=r),e.normal=t.normal}findAttrs(e,t,r,n){const i=[],o=new Dictionary;return Object.keys(e).forEach(a=>{const s=e[a];if(!isPlainObject(s))return;const{isCSSSelector:l,elems:c}=View.find(a,t,n);r[a]=c;for(let e=0,t=c.length;e<t;e+=1){const r=c[e],u=n&&n[a]===r,d=o.get(r);if(d){d.array||(i.push(r),d.array=!0,d.attrs=[d.attrs],d.priority=[d.priority]);const e=d.attrs,n=d.priority;if(u)e.unshift(s),n.unshift(-1);else{const r=sortedIndex(n,l?-1:t);e.splice(r,0,s),n.splice(r,0,t)}}else o.set(r,{elem:r,attrs:s,priority:u?-1:t,array:!1})}}),i.forEach(e=>{const t=o.get(e),r=t.attrs;t.attrs=r.reduceRight((e,t)=>merge$2(e,t),{})}),o}updateRelativeAttrs(e,t,r){const n=t.raw||{};let i=t.normal||{};const o=t.set,a=t.position,s=t.offset,l=()=>({elem:e,cell:this.cell,view:this.view,attrs:n,refBBox:r.clone()});if(null!=o&&Object.keys(o).forEach(e=>{const t=o[e],r=this.getDefinition(e);if(null!=r){const n=call$1(r.set,this.view,t,l());"object"==typeof n?i=Object.assign(Object.assign({},i),n):null!=n&&(i[e]=n)}}),e instanceof HTMLElement)return void this.view.setAttrs(i,e);const c=i.transform,u=transformStringToMatrix(c?`${c}`:null),d=new Point(u.e,u.f);c&&(delete i.transform,u.e=0,u.f=0);let p=!1;null!=a&&Object.keys(a).forEach(e=>{const t=a[e],r=this.getDefinition(e);if(null!=r){const e=call$1(r.position,this.view,t,l());null!=e&&(p=!0,d.translate(Point.create(e)))}}),this.view.setAttrs(i,e);let h=!1;if(null!=s){const t=this.view.getBoundingRectOfElement(e);if(t.width>0&&t.height>0){const r=Util$1.transformRectangle(t,u);Object.keys(s).forEach(t=>{const i=s[t],o=this.getDefinition(t);if(null!=o){const t=call$1(o.offset,this.view,i,{elem:e,cell:this.cell,view:this.view,attrs:n,refBBox:r});null!=t&&(h=!0,d.translate(Point.create(t)))}})}}(null!=c||p||h)&&(d.round(1),u.e=Number.isFinite(d.x)?d.x:0,u.f=Number.isFinite(d.y)?d.y:0,e.setAttribute("transform",matrixToTransformString(u)))}update(e,t,r){const n={},i=this.findAttrs(r.attrs||t,e,n,r.selectors),o=r.attrs?this.findAttrs(t,e,n,r.selectors):i,a=[];i.each(t=>{const i=t.elem,s=t.attrs,l=this.processAttrs(i,s);if(null==l.set&&null==l.position&&null==l.offset)this.view.setAttrs(l.normal,i);else{const t=o.get(i),c=t?t.attrs:null,u=c&&null==s.ref?c.ref:s.ref;let d;if(u){if(d=(n[u]||this.view.find(u,e,r.selectors))[0],!d)throw new Error(`"${u}" reference does not exist.`)}else d=null;const p={node:i,refNode:d,attributes:c,processedAttributes:l},h=a.findIndex(e=>e.refNode===i);h>-1?a.splice(h,0,p):a.push(p)}});const s=new Dictionary;let l;a.forEach(t=>{const n=t.node,i=t.refNode;let o;const a=null!=i&&null!=r.rotatableNode&&contains(r.rotatableNode,i);if(i&&(o=s.get(i)),!o){const t=a?r.rotatableNode:e;o=i?Util$1.getBBox(i,{target:t}):r.rootBBox,i&&s.set(i,o)}let c;r.attrs&&t.attributes?(c=this.processAttrs(n,t.attributes),this.mergeProcessedAttrs(c,t.processedAttributes)):c=t.processedAttributes;let u=o;a&&null!=r.rotatableNode&&!r.rotatableNode.contains(n)&&(l||(l=transformStringToMatrix(attr(r.rotatableNode,"transform"))),u=Util$1.transformRectangle(o,l)),this.updateRelativeAttrs(n,c,u)})}}class FlagManager{get cell(){return this.view.cell}constructor(e,t,r=[]){this.view=e;const n={},i={};let o=0;Object.keys(t).forEach(e=>{let r=t[e];Array.isArray(r)||(r=[r]),r.forEach(t=>{let r=n[t];r||(o+=1,r=n[t]=1<<o),i[e]|=r})});let a=r;if(Array.isArray(a)||(a=[a]),a.forEach(e=>{n[e]||(o+=1,n[e]=1<<o)}),o>25)throw new Error("Maximum number of flags exceeded.");this.flags=n,this.attrs=i,this.bootstrap=r}getFlag(e){const t=this.flags;return null==t?0:Array.isArray(e)?e.reduce((e,r)=>e|t[r],0):0|t[e]}hasAction(e,t){return e&this.getFlag(t)}removeAction(e,t){return e^e&this.getFlag(t)}getBootstrapFlag(){return this.getFlag(this.bootstrap)}getChangedFlag(){let e=0;return this.attrs?(Object.keys(this.attrs).forEach(t=>{this.cell.hasChanged(t)&&(e|=this.attrs[t])}),e):e}}var __decorate$t=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},__rest$i=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},CellView2,ToolsView2;class CellView extends View{static getDefaults(){return this.defaults}static config(e){this.defaults=this.getOptions(e)}static getOptions(e){const t=(e,t)=>null!=t?uniq([...Array.isArray(e)?e:[e],...Array.isArray(t)?t:[t]]):Array.isArray(e)?[...e]:[e],r=cloneDeep(this.getDefaults()),{bootstrap:n,actions:i,events:o,documentEvents:a}=e,s=__rest$i(e,["bootstrap","actions","events","documentEvents"]);return n&&(r.bootstrap=t(r.bootstrap,n)),i&&Object.entries(i).forEach(([e,n])=>{const i=r.actions[e];n&&i?r.actions[e]=t(i,n):n&&(r.actions[e]=t(n))}),o&&(r.events=Object.assign(Object.assign({},r.events),o)),e.documentEvents&&(r.documentEvents=Object.assign(Object.assign({},r.documentEvents),a)),merge$2(r,s)}get[Symbol.toStringTag](){return CellView.toStringTag}constructor(e,t={}){super(),this.cell=e,this.options=this.ensureOptions(t),this.graph=this.options.graph,this.attr=new AttrManager(this),this.flag=new FlagManager(this,this.options.actions,this.options.bootstrap),this.cache=new Cache(this),this.setContainer(this.ensureContainer()),this.setup(),this.init()}init(){}onRemove(){this.removeTools()}get priority(){return this.options.priority}get rootSelector(){return this.options.rootSelector}getConstructor(){return this.constructor}ensureOptions(e){return this.getConstructor().getOptions(e)}getContainerTagName(){return this.options.isSvgElement?"g":"div"}getContainerStyle(){}getContainerAttrs(){return{"data-cell-id":this.cell.id,"data-shape":this.cell.shape}}getContainerClassName(){return this.prefixClassName("cell")}ensureContainer(){return View.createElement(this.getContainerTagName(),this.options.isSvgElement)}setContainer(e){if(this.container!==e){this.undelegateEvents(),this.container=e,null!=this.options.events&&this.delegateEvents(this.options.events);const t=this.getContainerAttrs();null!=t&&this.setAttrs(t,e);const r=this.getContainerStyle();null!=r&&this.setStyle(r,e);const n=this.getContainerClassName();null!=n&&this.addClass(n,e)}return this}isNodeView(){return!1}isEdgeView(){return!1}render(){return this}confirmUpdate(e,t={}){return 0}getBootstrapFlag(){return this.flag.getBootstrapFlag()}getFlag(e){return this.flag.getFlag(e)}hasAction(e,t){return this.flag.hasAction(e,t)}removeAction(e,t){return this.flag.removeAction(e,t)}handleAction(e,t,r,n){if(this.hasAction(e,t)){r();const i=[t];return n&&("string"==typeof n?i.push(n):i.push(...n)),this.removeAction(e,i)}return e}setup(){this.cell.on("changed",this.onCellChanged,this)}onCellChanged({options:e}){this.onAttrsChange(e)}onAttrsChange(e){let t=this.flag.getChangedFlag();!e.updated&&t&&(e.dirty&&this.hasAction(t,"update")&&(t|=this.getFlag("render")),e.toolId&&(e.async=!1),null!=this.graph&&this.graph.renderer.requestViewUpdate(this,t,e))}parseJSONMarkup(e,t){const r=Markup.parseJSONMarkup(e),n=r.selectors,i=this.rootSelector;if(t&&i){if(n[i])throw new Error("Invalid root selector");n[i]=t}return r}can(e){let t=this.graph.options.interacting;if("function"==typeof t&&(t=call$1(t,this.graph,this)),"object"==typeof t){let r=t[e];return"function"==typeof r&&(r=call$1(r,this.graph,this)),!1!==r}return"boolean"==typeof t&&t}cleanCache(){return this.cache.clean(),this}getCache(e){return this.cache.get(e)}getDataOfElement(e){return this.cache.getData(e)}getMatrixOfElement(e){return this.cache.getMatrix(e)}getShapeOfElement(e){return this.cache.getShape(e)}getBoundingRectOfElement(e){return this.cache.getBoundingRect(e)}getBBoxOfElement(e){const t=this.getBoundingRectOfElement(e),r=this.getMatrixOfElement(e),n=this.getRootRotatedMatrix(),i=this.getRootTranslatedMatrix();return Util$1.transformRectangle(t,i.multiply(n).multiply(r))}getUnrotatedBBoxOfElement(e){const t=this.getBoundingRectOfElement(e),r=this.getMatrixOfElement(e),n=this.getRootTranslatedMatrix();return Util$1.transformRectangle(t,n.multiply(r))}getBBox(e={}){let t;if(e.useCellGeometry){const e=this.cell,r=e.isNode()?e.getAngle():0;t=e.getBBox().bbox(r)}else t=this.getBBoxOfElement(this.container);return this.graph.coord.localToGraphRect(t)}getRootTranslatedMatrix(){const e=this.cell,t=e.isNode()?e.getPosition():{x:0,y:0};return createSVGMatrix().translate(t.x,t.y)}getRootRotatedMatrix(){let e=createSVGMatrix();const t=this.cell,r=t.isNode()?t.getAngle():0;if(r){const n=t.getBBox(),i=n.width/2,o=n.height/2;e=e.translate(i,o).rotate(r).translate(-i,-o)}return e}findMagnet(e=this.container){return this.findByAttr("magnet",e)}updateAttrs(e,t,r={}){null==r.rootBBox&&(r.rootBBox=new Rectangle),null==r.selectors&&(r.selectors=this.selectors),this.attr.update(e,t,r)}isEdgeElement(e){return this.cell.isEdge()&&(null==e||e===this.container)}prepareHighlight(e,t={}){const r=e||this.container;return t.partial=r===this.container,r}highlight(e,t={}){const r=this.prepareHighlight(e,t);return this.notify("cell:highlight",{magnet:r,options:t,view:this,cell:this.cell}),this.isEdgeView()?this.notify("edge:highlight",{magnet:r,options:t,view:this,edge:this.cell,cell:this.cell}):this.isNodeView()&&this.notify("node:highlight",{magnet:r,options:t,view:this,node:this.cell,cell:this.cell}),this}unhighlight(e,t={}){const r=this.prepareHighlight(e,t);return this.notify("cell:unhighlight",{magnet:r,options:t,view:this,cell:this.cell}),this.isNodeView()?this.notify("node:unhighlight",{magnet:r,options:t,view:this,node:this.cell,cell:this.cell}):this.isEdgeView()&&this.notify("edge:unhighlight",{magnet:r,options:t,view:this,edge:this.cell,cell:this.cell}),this}notifyUnhighlight(e,t){}getEdgeTerminal(e,t,r,n,i){const o=this.cell,a=this.findAttr("port",e),s=e.getAttribute("data-selector"),l={cell:o.id};return null!=s&&(l.magnet=s),null!=a?(l.port=a,o.isNode()&&(o.hasPort(a)||null!=s||(l.selector=this.getSelector(e)))):null==s&&this.container!==e&&(l.selector=this.getSelector(e)),l}getMagnetFromEdgeTerminal(e){const t=this.cell,r=this.container,n=e.port;let i,o=e.magnet;return null!=n&&t.isNode()&&t.hasPort(n)?i=this.findPortElem(n,o)||r:(o||(o=e.selector),o||null==n||(o=`[port="${n}"]`),i=this.findOne(o,r,this.selectors)),i}hasTools(e){const t=this.tools;return null!=t&&(null==e||t.name===e)}addTools(e){if(this.removeTools(),e){if(!this.can("toolsAddable"))return this;const t=ToolsView.isToolsView(e)?e:new ToolsView(e);this.tools=t,t.config({view:this}),t.mount()}return this}updateTools(e={}){return this.tools&&this.tools.update(e),this}removeTools(){return this.tools&&(this.tools.remove(),this.tools=null),this}hideTools(){return this.tools&&this.tools.hide(),this}showTools(){return this.tools&&this.tools.show(),this}renderTools(){const e=this.cell.getTools();return this.addTools(e),this}notify(e,t){return this.trigger(e,t),this.graph.trigger(e,t),this}getEventArgs(e,t,r){const n=this,i=n.cell;return null==t||null==r?{e:e,view:n,cell:i}:{e:e,x:t,y:r,view:n,cell:i}}onClick(e,t,r){this.notify("cell:click",this.getEventArgs(e,t,r))}onDblClick(e,t,r){this.notify("cell:dblclick",this.getEventArgs(e,t,r))}onContextMenu(e,t,r){this.notify("cell:contextmenu",this.getEventArgs(e,t,r))}onMouseDown(e,t,r){this.cell.model&&(this.cachedModelForMouseEvent=this.cell.model,this.cachedModelForMouseEvent.startBatch("mouse")),this.notify("cell:mousedown",this.getEventArgs(e,t,r))}onMouseUp(e,t,r){this.notify("cell:mouseup",this.getEventArgs(e,t,r)),this.cachedModelForMouseEvent&&(this.cachedModelForMouseEvent.stopBatch("mouse",{cell:this.cell}),this.cachedModelForMouseEvent=null)}onMouseMove(e,t,r){this.notify("cell:mousemove",this.getEventArgs(e,t,r))}onMouseOver(e){this.notify("cell:mouseover",this.getEventArgs(e))}onMouseOut(e){this.notify("cell:mouseout",this.getEventArgs(e))}onMouseEnter(e){this.notify("cell:mouseenter",this.getEventArgs(e))}onMouseLeave(e){this.notify("cell:mouseleave",this.getEventArgs(e))}onMouseWheel(e,t,r,n){this.notify("cell:mousewheel",Object.assign({delta:n},this.getEventArgs(e,t,r)))}onCustomEvent(e,t,r,n){this.notify("cell:customevent",Object.assign({name:t},this.getEventArgs(e,r,n))),this.notify(t,Object.assign({},this.getEventArgs(e,r,n)))}onMagnetMouseDown(e,t,r,n){}onMagnetDblClick(e,t,r,n){}onMagnetContextMenu(e,t,r,n){}onLabelMouseDown(e,t,r){}checkMouseleave(e){const t=this.getEventTarget(e,{fromPoint:!0}),r=this.graph.findViewByElem(t);r!==this&&(this.onMouseLeave(e),r&&r.onMouseEnter(e))}dispose(){this.cell.off("changed",this.onCellChanged,this)}}CellView.defaults={isSvgElement:!0,rootSelector:"root",priority:0,bootstrap:[],actions:{}},__decorate$t([CellView.dispose()],CellView.prototype,"dispose",null),CellView2=CellView||(CellView={}),CellView2.Flag=FlagManager,CellView2.Attr=AttrManager,function(e){e.toStringTag=`X6.${e.name}`,e.isCellView=function(t){if(null==t)return!1;if(t instanceof e)return!0;const r=t[Symbol.toStringTag],n=t;return(null==r||r===e.toStringTag)&&"function"==typeof n.isNodeView&&"function"==typeof n.isEdgeView&&"function"==typeof n.confirmUpdate}}(CellView||(CellView={})),function(e){e.priority=function(e){return function(t){t.config({priority:e})}},e.bootstrap=function(e){return function(t){t.config({bootstrap:e})}}}(CellView||(CellView={})),function(e){e.registry=Registry.create({type:"view"})}(CellView||(CellView={}));class ToolsView extends View{get name(){return this.options.name}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get[Symbol.toStringTag](){return ToolsView.toStringTag}constructor(e={}){super(),this.svgContainer=this.createContainer(!0,e),this.htmlContainer=this.createContainer(!1,e),this.config(e)}createContainer(e,t){const r=e?View.createElement("g",!0):View.createElement("div",!1);return addClass(r,this.prefixClassName("cell-tools")),t.className&&addClass(r,t.className),r}config(e){if(this.options=Object.assign(Object.assign({},this.options),e),!CellView.isCellView(e.view)||e.view===this.cellView)return this;this.cellView=e.view,this.cell.isEdge()?(addClass(this.svgContainer,this.prefixClassName("edge-tools")),addClass(this.htmlContainer,this.prefixClassName("edge-tools"))):this.cell.isNode()&&(addClass(this.svgContainer,this.prefixClassName("node-tools")),addClass(this.htmlContainer,this.prefixClassName("node-tools"))),this.svgContainer.setAttribute("data-cell-id",this.cell.id),this.htmlContainer.setAttribute("data-cell-id",this.cell.id),this.name&&(this.svgContainer.setAttribute("data-tools-name",this.name),this.htmlContainer.setAttribute("data-tools-name",this.name));const t=this.options.items;if(!Array.isArray(t))return this;this.tools=[];const r=[];t.forEach(e=>{if(ToolsView.ToolItem.isToolItem(e))"vertices"===e.name?r.unshift(e):r.push(e);else{"vertices"===("object"==typeof e?e.name:e)?r.unshift(e):r.push(e)}});for(let n=0;n<r.length;n+=1){const e=r[n];let t;if(ToolsView.ToolItem.isToolItem(e))t=e;else{const r="object"==typeof e?e.name:e,n="object"==typeof e&&e.args||{};if(r)if(this.cell.isNode()){const e=NodeTool.registry.get(r);if(!e)return NodeTool.registry.onNotFound(r);t=new e(n)}else if(this.cell.isEdge()){const e=EdgeTool.registry.get(r);if(!e)return EdgeTool.registry.onNotFound(r);t=new e(n)}}if(t){t.config(this.cellView,this),t.render();(!1!==t.options.isSVGElement?this.svgContainer:this.htmlContainer).appendChild(t.container),this.tools.push(t)}}return this}update(e={}){const t=this.tools;return t&&t.forEach(t=>{e.toolId!==t.cid&&t.isVisible()&&t.update()}),this}focus(e){const t=this.tools;return t&&t.forEach(t=>{e===t?t.show():t.hide()}),this}blur(e){const t=this.tools;return t&&t.forEach(t=>{t===e||t.isVisible()||(t.show(),t.update())}),this}hide(){return this.focus(null)}show(){return this.blur(null)}remove(){const e=this.tools;return e&&(e.forEach(e=>e.remove()),this.tools=null),remove(this.svgContainer),remove(this.htmlContainer),super.remove()}mount(){const e=this.tools,t=this.cellView;if(t&&e){const r=e.some(e=>!1!==e.options.isSVGElement),n=e.some(e=>!1===e.options.isSVGElement);if(r){(this.options.local?t.container:t.graph.view.decorator).appendChild(this.svgContainer)}n&&this.graph.container.appendChild(this.htmlContainer)}return this}}ToolsView2=ToolsView||(ToolsView={}),ToolsView2.toStringTag=`X6.${ToolsView2.name}`,ToolsView2.isToolsView=function(e){if(null==e)return!1;if(e instanceof ToolsView2)return!0;const t=e[Symbol.toStringTag],r=e;return(null==t||t===ToolsView2.toStringTag)&&null!=r.graph&&null!=r.cell&&"function"==typeof r.config&&"function"==typeof r.update&&"function"==typeof r.focus&&"function"==typeof r.blur&&"function"==typeof r.show&&"function"==typeof r.hide},function(e){class t extends View{static getDefaults(){return this.defaults}static config(e){this.defaults=this.getOptions(e)}static getOptions(e){return merge$2(cloneDeep(this.getDefaults()),e)}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get name(){return this.options.name}get[Symbol.toStringTag](){return t.toStringTag}constructor(e={}){super(),this.visible=!0,this.options=this.getOptions(e),this.container=View.createElement(this.options.tagName||"g",!1!==this.options.isSVGElement),addClass(this.container,this.prefixClassName("cell-tool")),"string"==typeof this.options.className&&addClass(this.container,this.options.className),this.init()}init(){}getOptions(e){return this.constructor.getOptions(e)}delegateEvents(){return this.options.events&&super.delegateEvents(this.options.events),this}config(e,t){return this.cellView=e,this.parent=t,this.stamp(this.container),this.cell.isEdge()?addClass(this.container,this.prefixClassName("edge-tool")):this.cell.isNode()&&addClass(this.container,this.prefixClassName("node-tool")),this.name&&this.container.setAttribute("data-tool-name",this.name),this.delegateEvents(),this}render(){this.empty();const e=this.options.markup;if(e){const t=Markup.parseJSONMarkup(e);this.container.appendChild(t.fragment),this.childNodes=t.selectors}return this.onRender(),this}onRender(){}update(){return this}stamp(e){e&&e.setAttribute("data-cell-id",this.cellView.cell.id)}show(){return this.container.style.display="",this.visible=!0,this}hide(){return this.container.style.display="none",this.visible=!1,this}isVisible(){return this.visible}focus(){const e=this.options.focusOpacity;return null!=e&&Number.isFinite(e)&&(this.container.style.opacity=`${e}`),this.parent.focus(this),this}blur(){return this.container.style.opacity="",this.parent.blur(this),this}guard(e){return null==this.graph||null==this.cellView||this.graph.view.guard(e,this.cellView)}}var r;t.defaults={isSVGElement:!0,tagName:"g"},e.ToolItem=t,function(e){let t=0;e.define=function(e){const r=createClass((n=e.name)?pascalCase(n):(t+=1,`CustomTool${t}`),this);var n;return r.config(e),r}}(t=e.ToolItem||(e.ToolItem={})),(r=t=e.ToolItem||(e.ToolItem={})).toStringTag=`X6.${r.name}`,r.isToolItem=function(e){if(null==e)return!1;if(e instanceof r)return!0;const t=e[Symbol.toStringTag],n=e;return(null==t||t===r.toStringTag)&&null!=n.graph&&null!=n.cell&&"function"==typeof n.config&&"function"==typeof n.update&&"function"==typeof n.focus&&"function"==typeof n.blur&&"function"==typeof n.show&&"function"==typeof n.hide&&"function"==typeof n.isVisible}}(ToolsView||(ToolsView={}));const noop$1=e=>e;function toPercentage(e,t){return 0===t?"0%":`${Math.round(e/t*100)}%`}function pin(e){return(t,r,n,i)=>r.isEdgeElement(n)?pinEdgeTerminal(e,t,r,n,i):pinNodeTerminal(e,t,r,n,i)}function pinNodeTerminal(e,t,r,n,i){const o=r.cell,a=o.getAngle(),s=r.getUnrotatedBBoxOfElement(n),l=o.getBBox().getCenter(),c=Point.create(i).rotate(a,l);let u=c.x-s.x,d=c.y-s.y;return e&&(u=toPercentage(u,s.width),d=toPercentage(d,s.height)),t.anchor={name:"topLeft",args:{dx:u,dy:d,rotate:!0}},t}function pinEdgeTerminal(e,t,r,n,i){const o=r.getConnection();if(!o)return t;const a=o.closestPointLength(i);if(e){const e=o.length();t.anchor={name:"ratio",args:{ratio:a/e}}}else t.anchor={name:"length",args:{length:a}};return t}const pinRelative=pin(!0),pinAbsolute=pin(!1),strategies=Object.freeze(Object.defineProperty({__proto__:null,noop:noop$1,pinAbsolute:pinAbsolute,pinRelative:pinRelative},Symbol.toStringTag,{value:"Module"}));var ConnectionStrategy,ConnectionStrategy2,Button2;function getAnchor(e,t,r,n){return call$1(ConnectionStrategy.presets.pinRelative,this.graph,{},t,r,e,this.cell,n,{}).anchor}function getViewBBox(e,t){return t?e.cell.getBBox():e.cell.isEdge()?e.getConnection().bbox():e.getUnrotatedBBoxOfElement(e.container)}ConnectionStrategy2=ConnectionStrategy||(ConnectionStrategy={}),ConnectionStrategy2.presets=strategies,ConnectionStrategy2.registry=Registry.create({type:"connection strategy"}),ConnectionStrategy2.registry.register(ConnectionStrategy2.presets,!0);class Button extends ToolsView.ToolItem{onRender(){addClass(this.container,this.prefixClassName("cell-tool-button")),this.update()}update(){return this.updatePosition(),this}updatePosition(){const e=this.cellView.cell.isEdge()?this.getEdgeMatrix():this.getNodeMatrix();transform(this.container,e,{absolute:!0})}getNodeMatrix(){const e=this.cellView,t=this.options;let{x:r=0,y:n=0}=t;const{offset:i,useCellGeometry:o,rotate:a}=t;let s=getViewBBox(e,o);const l=e.cell.getAngle();a||(s=s.bbox(l));let c=0,u=0;"number"==typeof i?(c=i,u=i):"object"==typeof i&&(c=i.x,u=i.y),r=normalizePercentage(r,s.width),n=normalizePercentage(n,s.height);let d=createSVGMatrix().translate(s.x+s.width/2,s.y+s.height/2);return a&&(d=d.rotate(l)),d=d.translate(r+c-s.width/2,n+u-s.height/2),d}getEdgeMatrix(){const e=this.cellView,t=this.options,{offset:r=0,distance:n=0,rotate:i}=t;let o,a,s;const l=normalizePercentage(n,1);o=l>=0&&l<=1?e.getTangentAtRatio(l):e.getTangentAtLength(l),o?(a=o.start,s=o.vector().vectorAngle(new Point(1,0))||0):(a=e.getConnection().start,s=0);let c=createSVGMatrix().translate(a.x,a.y).rotate(s);return c="object"==typeof r?c.translate(r.x||0,r.y||0):c.translate(0,r),i||(c=c.rotate(-s)),c}onMouseDown(e){if(this.guard(e))return;e.stopPropagation(),e.preventDefault();const t=this.options.onClick;"function"==typeof t&&call$1(t,this.cellView,{e:e,view:this.cellView,cell:this.cellView.cell,btn:this})}}Button2=Button||(Button={}),Button2.config({name:"button",useCellGeometry:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"}}),function(e){e.Remove=e.define({name:"button-remove",markup:[{tagName:"circle",selector:"button",attrs:{r:7,fill:"#FF1D00",cursor:"pointer"}},{tagName:"path",selector:"icon",attrs:{d:"M -3 -3 3 3 M -3 3 3 -3",fill:"none",stroke:"#FFFFFF","stroke-width":2,"pointer-events":"none"}}],distance:60,offset:0,useCellGeometry:!0,onClick({view:e,btn:t}){t.parent.remove(),e.cell.remove({ui:!0,toolId:t.cid})}})}(Button||(Button={}));var __rest$h=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},Boundary2,Vertices2,Segments2,Anchor2;class Boundary extends ToolsView.ToolItem{onRender(){if(addClass(this.container,this.prefixClassName("cell-tool-boundary")),this.options.attrs){const e=this.options.attrs,{class:t}=e,r=__rest$h(e,["class"]);attr(this.container,kebablizeAttrs(r)),t&&addClass(this.container,t)}this.update()}update(){const e=this.cellView,t=this.options,{useCellGeometry:r,rotate:n}=t,i=normalizeSides(t.padding);let o=getViewBBox(e,r).moveAndExpand({x:-i.left,y:-i.top,width:i.left+i.right,height:i.top+i.bottom});const a=e.cell;if(a.isNode()){const e=a.getAngle();if(e)if(n){const t=a.getBBox().getCenter();rotate$1(this.container,e,t.x,t.y,{absolute:!0})}else o=o.bbox(e)}return attr(this.container,o.toJSON()),this}}Boundary2=Boundary||(Boundary={}),Boundary2.config({name:"boundary",tagName:"rect",padding:10,useCellGeometry:!0,attrs:{fill:"none",stroke:"#333","stroke-width":.5,"stroke-dasharray":"5, 5","pointer-events":"none"}});class Vertices extends ToolsView.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}onRender(){return this.addClass(this.prefixClassName("edge-tool-vertices")),this.options.addable&&this.updatePath(),this.resetHandles(),this.renderHandles(),this}update(){return this.vertices.length===this.handles.length?this.updateHandles():(this.resetHandles(),this.renderHandles()),this.options.addable&&this.updatePath(),this}resetHandles(){const e=this.handles;this.handles=[],e&&e.forEach(e=>{this.stopHandleListening(e),e.remove()})}renderHandles(){const e=this.vertices;for(let t=0,r=e.length;t<r;t+=1){const r=e[t],n=this.options.createHandle,i=this.options.processHandle,o=n({index:t,graph:this.graph,guard:e=>this.guard(e),attrs:this.options.attrs||{}});i&&i(o),o.updatePosition(r.x,r.y),this.stamp(o.container),this.container.appendChild(o.container),this.handles.push(o),this.startHandleListening(o)}}updateHandles(){const e=this.vertices;for(let t=0,r=e.length;t<r;t+=1){const r=e[t],n=this.handles[t];n&&n.updatePosition(r.x,r.y)}}updatePath(){const e=this.childNodes.connection;e&&e.setAttribute("d",this.cellView.getConnectionPathData())}startHandleListening(e){const t=this.cellView;t.can("vertexMovable")&&(e.on("change",this.onHandleChange,this),e.on("changing",this.onHandleChanging,this),e.on("changed",this.onHandleChanged,this)),t.can("vertexDeletable")&&e.on("remove",this.onHandleRemove,this)}stopHandleListening(e){const t=this.cellView;t.can("vertexMovable")&&(e.off("change",this.onHandleChange,this),e.off("changing",this.onHandleChanging,this),e.off("changed",this.onHandleChanged,this)),t.can("vertexDeletable")&&e.off("remove",this.onHandleRemove,this)}getNeighborPoints(e){const t=this.cellView,r=this.vertices,n=e>0?r[e-1]:t.sourceAnchor,i=e<r.length-1?r[e+1]:t.targetAnchor;return{prev:Point.create(n),next:Point.create(i)}}getMouseEventArgs(e){const t=this.normalizeEvent(e),{x:r,y:n}=this.graph.snapToGrid(t.clientX,t.clientY);return{e:t,x:r,y:n}}onHandleChange({e:e}){this.focus();const t=this.cellView;if(t.cell.startBatch("move-vertex",{ui:!0,toolId:this.cid}),!this.options.stopPropagation){const{e:r,x:n,y:i}=this.getMouseEventArgs(e);this.eventData(r,{start:{x:n,y:i}}),t.notifyMouseDown(r,n,i)}}onHandleChanging({handle:e,e:t}){const r=this.cellView,n=e.options.index,{e:i,x:o,y:a}=this.getMouseEventArgs(t),s={x:o,y:a};this.snapVertex(s,n),r.cell.setVertexAt(n,s,{ui:!0,toolId:this.cid}),e.updatePosition(s.x,s.y),this.options.stopPropagation||r.notifyMouseMove(i,o,a)}stopBatch(e){this.cell.stopBatch("move-vertex",{ui:!0,toolId:this.cid}),e&&this.cell.stopBatch("add-vertex",{ui:!0,toolId:this.cid})}onHandleChanged({e:e}){const t=this.options,r=this.cellView;if(t.addable&&this.updatePath(),!t.removeRedundancies)return void this.stopBatch(this.eventData(e).vertexAdded);r.removeRedundantLinearVertices({ui:!0,toolId:this.cid})&&this.render(),this.blur(),this.stopBatch(this.eventData(e).vertexAdded);const{e:n,x:i,y:o}=this.getMouseEventArgs(e);if(!this.options.stopPropagation){r.notifyMouseUp(n,i,o);const{start:e}=this.eventData(n);if(e){const{x:t,y:a}=e;t===i&&a===o&&r.onClick(n,i,o)}}r.checkMouseleave(n),t.onChanged&&t.onChanged({edge:r.cell,edgeView:r})}snapVertex(e,t){const r=this.options.snapRadius||0;if(r>0){const n=this.getNeighborPoints(t),i=n.prev,o=n.next;Math.abs(e.x-i.x)<r?e.x=i.x:Math.abs(e.x-o.x)<r&&(e.x=o.x),Math.abs(e.y-i.y)<r?e.y=n.prev.y:Math.abs(e.y-o.y)<r&&(e.y=o.y)}}onHandleRemove({handle:e,e:t}){if(this.options.removable){const r=e.options.index,n=this.cellView;n.cell.removeVertexAt(r,{ui:!0}),this.options.addable&&this.updatePath(),n.checkMouseleave(this.normalizeEvent(t))}}allowAddVertex(e){const t=this.guard(e),r=this.options.addable&&this.cellView.can("vertexAddable"),n=!this.options.modifiers||ModifierKey.isMatch(e,this.options.modifiers);return!t&&r&&n}onPathMouseDown(e){const t=this.cellView;if(!this.allowAddVertex(e))return;e.stopPropagation(),e.preventDefault();const r=this.normalizeEvent(e),n=this.graph.snapToGrid(r.clientX,r.clientY).toJSON();t.cell.startBatch("add-vertex",{ui:!0,toolId:this.cid});const i=t.getVertexIndex(n.x,n.y);this.snapVertex(n,i),t.cell.insertVertex(n,i,{ui:!0,toolId:this.cid}),this.render();const o=this.handles[i];this.eventData(r,{vertexAdded:!0}),o.onMouseDown(r)}onRemove(){this.resetHandles()}}Vertices2=Vertices||(Vertices={}),Vertices2.Handle=class extends View{get graph(){return this.options.graph}constructor(e){super(),this.options=e,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDoubleClick"})}render(){this.container=View.createElement("circle",!0);const e=this.options.attrs;if("function"==typeof e){const t=Vertices2.getDefaults();this.setAttrs(Object.assign(Object.assign({},t.attrs),e(this)))}else this.setAttrs(e);this.addClass(this.prefixClassName("edge-tool-vertex"))}updatePosition(e,t){this.setAttrs({cx:e,cy:t})}onMouseDown(e){this.options.guard(e)||(e.stopPropagation(),e.preventDefault(),this.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},e.data),this.emit("change",{e:e,handle:this}))}onMouseMove(e){this.emit("changing",{e:e,handle:this})}onMouseUp(e){this.emit("changed",{e:e,handle:this}),this.undelegateDocumentEvents(),this.graph.view.delegateEvents()}onDoubleClick(e){this.emit("remove",{e:e,handle:this})}},function(e){const t=Config.prefix("edge-tool-vertex-path");e.config({name:"vertices",snapRadius:20,addable:!0,removable:!0,removeRedundancies:!0,stopPropagation:!0,attrs:{r:6,fill:"#333",stroke:"#fff",cursor:"move","stroke-width":2},createHandle:t=>new e.Handle(t),markup:[{tagName:"path",selector:"connection",className:t,attrs:{fill:"none",stroke:"transparent","stroke-width":10,cursor:"pointer"}}],events:{[`mousedown .${t}`]:"onPathMouseDown",[`touchstart .${t}`]:"onPathMouseDown"}})}(Vertices||(Vertices={}));class Segments extends ToolsView.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}update(){return this.render(),this}onRender(){addClass(this.container,this.prefixClassName("edge-tool-segments")),this.resetHandles();const e=this.cellView,t=[...this.vertices];t.unshift(e.sourcePoint),t.push(e.targetPoint);for(let r=0,n=t.length;r<n-1;r+=1){const e=t[r],n=t[r+1],i=this.renderHandle(e,n,r);this.stamp(i.container),this.handles.push(i)}return this}renderHandle(e,t,r){const n=this.options.createHandle({index:r,graph:this.graph,guard:e=>this.guard(e),attrs:this.options.attrs||{}});return this.options.processHandle&&this.options.processHandle(n),this.updateHandle(n,e,t),this.container.appendChild(n.container),this.startHandleListening(n),n}startHandleListening(e){e.on("change",this.onHandleChange,this),e.on("changing",this.onHandleChanging,this),e.on("changed",this.onHandleChanged,this)}stopHandleListening(e){e.off("change",this.onHandleChange,this),e.off("changing",this.onHandleChanging,this),e.off("changed",this.onHandleChanged,this)}resetHandles(){const e=this.handles;this.handles=[],e&&e.forEach(e=>{this.stopHandleListening(e),e.remove()})}shiftHandleIndexes(e){const t=this.handles;for(let r=0,n=t.length;r<n;r+=1)t[r].options.index+=e}resetAnchor(e,t){const r=this.cellView.cell,n={ui:!0,toolId:this.cid};t?r.prop([e,"anchor"],t,n):r.removeProp([e,"anchor"],n)}snapHandle(e,t,r){const n=e.options.axis,i=e.options.index,o=this.cellView.cell.getVertices(),a=o[i-2]||r.sourceAnchor,s=o[i+1]||r.targetAnchor,l=this.options.snapRadius;return Math.abs(t[n]-a[n])<l?t[n]=a[n]:Math.abs(t[n]-s[n])<l&&(t[n]=s[n]),t}onHandleChanging({handle:e,e:t}){const r=this.graph,n=this.options,i=this.cellView,o=n.anchor,a=e.options.axis,s=e.options.index-1,l=this.getEventData(t),c=this.normalizeEvent(t),u=r.snapToGrid(c.clientX,c.clientY),d=this.snapHandle(e,u.clone(),l),p=cloneDeep(this.vertices);let h=p[s],f=p[s+1];const g=i.sourceView,m=i.sourceBBox;let v=!1,y=!1;if(h?0===s?m.containsPoint(h)?(p.shift(),this.shiftHandleIndexes(-1),v=!0):(h[a]=d[a],y=!0):h[a]=d[a]:(h=i.sourceAnchor.toJSON(),h[a]=d[a],m.containsPoint(h)?v=!0:(p.unshift(h),this.shiftHandleIndexes(1),y=!0)),"function"==typeof o&&g){if(v){const e=l.sourceAnchor.clone();e[a]=d[a];const t=call$1(o,i,e,g,i.sourceMagnet||g.container,"source",i,this);this.resetAnchor("source",t)}y&&this.resetAnchor("source",l.sourceAnchorDef)}const b=i.targetView,q=i.targetBBox;let V=!1,S=!1;if(f?s===p.length-2?q.containsPoint(f)?(p.pop(),V=!0):(f[a]=d[a],S=!0):f[a]=d[a]:(f=i.targetAnchor.toJSON(),f[a]=d[a],q.containsPoint(f)?V=!0:(p.push(f),S=!0)),"function"==typeof o&&b){if(V){const e=l.targetAnchor.clone();e[a]=d[a];const t=call$1(o,i,e,b,i.targetMagnet||b.container,"target",i,this);this.resetAnchor("target",t)}S&&this.resetAnchor("target",l.targetAnchorDef)}Point.equalPoints(p,this.vertices)||this.cellView.cell.setVertices(p,{ui:!0,toolId:this.cid}),this.updateHandle(e,h,f,0),n.stopPropagation||i.notifyMouseMove(c,u.x,u.y)}onHandleChange({handle:e,e:t}){const r=this.options,n=this.handles,i=this.cellView,o=e.options.index;if(Array.isArray(n)){for(let e=0,t=n.length;e<t;e+=1)e!==o&&n[e].hide();if(this.focus(),this.setEventData(t,{sourceAnchor:i.sourceAnchor.clone(),targetAnchor:i.targetAnchor.clone(),sourceAnchorDef:cloneDeep(this.cell.prop(["source","anchor"])),targetAnchorDef:cloneDeep(this.cell.prop(["target","anchor"]))}),this.cell.startBatch("move-segment",{ui:!0,toolId:this.cid}),!r.stopPropagation){const e=this.normalizeEvent(t),r=this.graph.snapToGrid(e.clientX,e.clientY);i.notifyMouseDown(e,r.x,r.y)}}}onHandleChanged({e:e}){const t=this.options,r=this.cellView;t.removeRedundancies&&r.removeRedundantLinearVertices({ui:!0,toolId:this.cid});const n=this.normalizeEvent(e),i=this.graph.snapToGrid(n.clientX,n.clientY);this.render(),this.blur(),this.cell.stopBatch("move-segment",{ui:!0,toolId:this.cid}),t.stopPropagation||r.notifyMouseUp(n,i.x,i.y),r.checkMouseleave(n),t.onChanged&&t.onChanged({edge:r.cell,edgeView:r})}updateHandle(e,t,r,n=0){const i=this.options.precision||0,o=Math.abs(t.x-r.x)<i,a=Math.abs(t.y-r.y)<i;if(o||a){const i=new Line(t,r);if(i.length()<this.options.threshold)e.hide();else{const t=i.getCenter(),r=o?"x":"y";t[r]+=n||0;const a=i.vector().vectorAngle(new Point(1,0));e.updatePosition(t.x,t.y,a,this.cellView),e.show(),e.options.axis=r}}else e.hide()}onRemove(){this.resetHandles()}}Segments2=Segments||(Segments={}),Segments2.Handle=class extends View{constructor(e){super(),this.options=e,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown"})}render(){this.container=View.createElement("rect",!0);const e=this.options.attrs;if("function"==typeof e){const t=Segments2.getDefaults();this.setAttrs(Object.assign(Object.assign({},t.attrs),e(this)))}else this.setAttrs(e);this.addClass(this.prefixClassName("edge-tool-segment"))}updatePosition(e,t,r,n){const i=n.getClosestPoint(new Point(e,t))||new Point(e,t);let o=createSVGMatrix().translate(i.x,i.y);if(i.equals({x:e,y:t}))o=o.rotate(r);else{let r=new Line(e,t,i.x,i.y).vector().vectorAngle(new Point(1,0));0!==r&&(r+=90),o=o.rotate(r)}this.setAttrs({transform:matrixToTransformString(o),cursor:r%180==0?"row-resize":"col-resize"})}onMouseDown(e){this.options.guard(e)||(this.trigger("change",{e:e,handle:this}),e.stopPropagation(),e.preventDefault(),this.options.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},e.data))}onMouseMove(e){this.emit("changing",{e:e,handle:this})}onMouseUp(e){this.emit("changed",{e:e,handle:this}),this.undelegateDocumentEvents(),this.options.graph.view.delegateEvents()}show(){this.container.style.display=""}hide(){this.container.style.display="none"}},function(e){e.config({name:"segments",precision:.5,threshold:40,snapRadius:10,stopPropagation:!0,removeRedundancies:!0,attrs:{width:20,height:8,x:-10,y:-4,rx:4,ry:4,fill:"#333",stroke:"#fff","stroke-width":2},createHandle:t=>new e.Handle(t),anchor:getAnchor})}(Segments||(Segments={}));class Anchor extends ToolsView.ToolItem{get type(){return this.options.type}onRender(){addClass(this.container,this.prefixClassName(`edge-tool-${this.type}-anchor`)),this.toggleArea(!1),this.update()}update(){const e=this.type;return this.cellView.getTerminalView(e)?(this.updateAnchor(),this.updateArea(),this.container.style.display=""):this.container.style.display="none",this}updateAnchor(){const e=this.childNodes;if(!e)return;const t=e.anchor;if(!t)return;const r=this.type,n=this.cellView,i=this.options,o=n.getTerminalAnchor(r),a=n.cell.prop([r,"anchor"]);t.setAttribute("transform",`translate(${o.x}, ${o.y})`);const s=a?i.customAnchorAttrs:i.defaultAnchorAttrs;s&&Object.keys(s).forEach(e=>{t.setAttribute(e,s[e])})}updateArea(){const e=this.childNodes;if(!e)return;const t=e.area;if(!t)return;const r=this.type,n=this.cellView,i=n.getTerminalView(r);if(i){const e=i.cell,o=n.getTerminalMagnet(r);let a,s,l,c=this.options.areaPadding||0;Number.isFinite(c)||(c=0),i.isEdgeElement(o)?(a=i.getBBox(),s=0,l=a.getCenter()):(a=i.getUnrotatedBBoxOfElement(o),s=e.getAngle(),l=a.getCenter(),s&&l.rotate(-s,e.getBBox().getCenter())),a.inflate(c),attr(t,{x:-a.width/2,y:-a.height/2,width:a.width,height:a.height,transform:`translate(${l.x}, ${l.y}) rotate(${s})`})}}toggleArea(e){if(this.childNodes){const t=this.childNodes.area;t&&(t.style.display=e?"":"none")}}onMouseDown(e){this.guard(e)||(e.stopPropagation(),e.preventDefault(),this.graph.view.undelegateEvents(),this.options.documentEvents&&this.delegateDocumentEvents(this.options.documentEvents),this.focus(),this.toggleArea(this.options.restrictArea),this.cell.startBatch("move-anchor",{ui:!0,toolId:this.cid}))}resetAnchor(e){const t=this.type,r=this.cell;e?r.prop([t,"anchor"],e,{rewrite:!0,ui:!0,toolId:this.cid}):r.removeProp([t,"anchor"],{ui:!0,toolId:this.cid})}onMouseMove(e){const t=this.type,r=this.cellView,n=r.getTerminalView(t);if(null==n)return;const i=this.normalizeEvent(e),o=n.cell,a=r.getTerminalMagnet(t);let s=this.graph.coord.clientToLocalPoint(i.clientX,i.clientY);const l=this.options.snap;if("function"==typeof l){const e=call$1(l,r,s,n,a,t,r,this);s=Point.create(e)}if(this.options.restrictArea)if(n.isEdgeElement(a)){const e=n.getClosestPoint(s);e&&(s=e)}else{const e=n.getUnrotatedBBoxOfElement(a),t=o.getAngle(),r=o.getBBox().getCenter(),i=s.clone().rotate(t,r);e.containsPoint(i)||(s=e.getNearestPointToPoint(i).rotate(-t,r))}let c;const u=this.options.anchor;"function"==typeof u&&(c=call$1(u,r,s,n,a,t,r,this)),this.resetAnchor(c),this.update()}onMouseUp(e){this.graph.view.delegateEvents(),this.undelegateDocumentEvents(),this.blur(),this.toggleArea(!1);const t=this.cellView;this.options.removeRedundancies&&t.removeRedundantLinearVertices({ui:!0,toolId:this.cid}),this.cell.stopBatch("move-anchor",{ui:!0,toolId:this.cid})}onDblClick(){const e=this.options.resetAnchor;e&&this.resetAnchor(!0===e?void 0:e),this.update()}}Anchor2=Anchor||(Anchor={}),Anchor2.config({tagName:"g",markup:[{tagName:"circle",selector:"anchor",attrs:{cursor:"pointer"}},{tagName:"rect",selector:"area",attrs:{"pointer-events":"none",fill:"none",stroke:"#33334F","stroke-dasharray":"2,4",rx:5,ry:5}}],events:{mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDblClick"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},customAnchorAttrs:{"stroke-width":4,stroke:"#33334F",fill:"#FFFFFF",r:5},defaultAnchorAttrs:{"stroke-width":2,stroke:"#FFFFFF",fill:"#33334F",r:6},areaPadding:6,snapRadius:10,resetAnchor:!0,restrictArea:!0,removeRedundancies:!0,anchor:getAnchor,snap(e,t,r,n,i,o){const a=o.options.snapRadius||0,s="source"===n,l=s?0:-1,c=this.cell.getVertexAt(l)||this.getTerminalAnchor(s?"target":"source");return c&&(Math.abs(c.x-e.x)<a&&(e.x=c.x),Math.abs(c.y-e.y)<a&&(e.y=c.y)),e}});const SourceAnchor=Anchor.define({name:"source-anchor",type:"source"}),TargetAnchor=Anchor.define({name:"target-anchor",type:"target"});var __rest$g=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},Arrowhead2;class Arrowhead extends ToolsView.ToolItem{get type(){return this.options.type}get ratio(){return this.options.ratio}init(){if(this.options.attrs){const e=this.options.attrs,{class:t}=e,r=__rest$g(e,["class"]);this.setAttrs(r,this.container),t&&addClass(this.container,t)}}onRender(){addClass(this.container,this.prefixClassName(`edge-tool-${this.type}-arrowhead`)),this.update()}update(){const e=this.ratio,t=this.cellView,r=t.getTangentAtRatio(e),n=r?r.start:t.getPointAtRatio(e),i=r&&r.vector().vectorAngle(new Point(1,0))||0;if(!n)return this;const o=createSVGMatrix().translate(n.x,n.y).rotate(i);return transform(this.container,o,{absolute:!0}),this}onMouseDown(e){if(this.guard(e))return;e.stopPropagation(),e.preventDefault();const t=this.cellView;if(t.can("arrowheadMovable")){t.cell.startBatch("move-arrowhead",{ui:!0,toolId:this.cid});const r=this.graph.snapToGrid(e.clientX,e.clientY),n=t.prepareArrowheadDragging(this.type,{x:r.x,y:r.y,options:Object.assign(Object.assign({},this.options),{toolId:this.cid})});this.cellView.setEventData(e,n),this.delegateDocumentEvents(this.options.documentEvents,e.data),t.graph.view.undelegateEvents(),this.container.style.pointerEvents="none"}this.focus()}onMouseMove(e){const t=this.normalizeEvent(e),r=this.graph.snapToGrid(t.clientX,t.clientY);this.cellView.onMouseMove(t,r.x,r.y),this.update()}onMouseUp(e){this.undelegateDocumentEvents();const t=this.normalizeEvent(e),r=this.cellView,n=this.graph.snapToGrid(t.clientX,t.clientY);r.onMouseUp(t,n.x,n.y),this.graph.view.delegateEvents(),this.blur(),this.container.style.pointerEvents="",r.cell.stopBatch("move-arrowhead",{ui:!0,toolId:this.cid})}}Arrowhead2=Arrowhead||(Arrowhead={}),Arrowhead2.config({tagName:"path",isSVGElement:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}});const SourceArrowhead=Arrowhead.define({name:"source-arrowhead",type:"source",ratio:0,attrs:{d:"M 10 -8 -10 0 10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}}),TargetArrowhead=Arrowhead.define({name:"target-arrowhead",type:"target",ratio:1,attrs:{d:"M -10 -8 10 0 -10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}});class CellEditor extends ToolsView.ToolItem{constructor(){super(...arguments),this.labelIndex=-1,this.distance=.5,this.dblClick=this.onCellDblClick.bind(this)}onRender(){const e=this.cellView;e&&e.on("cell:dblclick",this.dblClick)}createElement(){const e=[this.prefixClassName((this.cell.isEdge()?"edge":"node")+"-tool-editor"),this.prefixClassName("cell-tool-editor")];this.editor=ToolsView.createElement("div",!1),this.addClass(e,this.editor),this.editor.contentEditable="true",this.container.appendChild(this.editor)}removeElement(){this.undelegateDocumentEvents(),this.editor&&(this.container.removeChild(this.editor),this.editor=null)}updateEditor(){const{cell:e,editor:t}=this;if(!t)return;const{style:r}=t;e.isNode()?this.updateNodeEditorTransform():e.isEdge()&&this.updateEdgeEditorTransform();const{attrs:n}=this.options;r.fontSize=`${n.fontSize}px`,r.fontFamily=n.fontFamily,r.color=n.color,r.backgroundColor=n.backgroundColor;const i=this.getCellText()||"";return t.innerText=i,this.setCellText(""),this}updateNodeEditorTransform(){const{graph:e,cell:t,editor:r}=this;if(!r)return;let n=Point.create(),i=20,o="",{x:a,y:s}=this.options;const{width:l,height:c}=this.options;if(void 0!==a&&void 0!==s){const e=t.getBBox();a=normalizePercentage(a,e.width),s=normalizePercentage(s,e.height),n=e.topLeft.translate(a,s),i=e.width-2*a}else{const e=t.getBBox();n=e.center,i=e.width-4,o="translate(-50%, -50%)"}const u=e.scale(),{style:d}=r;n=e.localToGraph(n),d.left=`${n.x}px`,d.top=`${n.y}px`,d.transform=`scale(${u.sx}, ${u.sy}) ${o}`,d.minWidth=`${i}px`,"number"==typeof l&&(d.width=`${l}px`),"number"==typeof c&&(d.height=`${c}px`)}updateEdgeEditorTransform(){if(!this.event)return;const{graph:e,editor:t}=this;if(!t)return;let r=Point.create(),n=20;const{style:i}=t,o=this.event.target,a=o.parentElement;if(a&&hasClass(a,this.prefixClassName("edge-label"))){const e=a.getAttribute("data-index")||"0";this.labelIndex=parseInt(e,10);const t=a.getAttribute("transform"),{translation:i}=parseTransformString(t);r=new Point(i.tx,i.ty),n=Util$1.getBBox(o).width}else{if(!this.options.labelAddable)return this;r=e.clientToLocal(Point.create(this.event.clientX,this.event.clientY));const t=this.cellView.path.closestPointLength(r);this.distance=t,this.labelIndex=-1}r=e.localToGraph(r);const s=e.scale();i.left=`${r.x}px`,i.top=`${r.y}px`,i.minWidth=`${n}px`,i.transform=`scale(${s.sx}, ${s.sy}) translate(-50%, -50%)`}onDocumentMouseUp(e){if(this.editor&&e.target!==this.editor){const e=this.editor.innerText.replace(/\n$/,"")||"";this.setCellText(""!==e?e:null),this.removeElement()}}onCellDblClick({e:e}){this.editor||(e.stopPropagation(),this.removeElement(),this.event=e,this.createElement(),this.updateEditor(),this.autoFocus(),this.delegateDocumentEvents(this.options.documentEvents))}onMouseDown(e){e.stopPropagation()}autoFocus(){setTimeout(()=>{this.editor&&(this.editor.focus(),this.selectText())})}selectText(){if(window.getSelection&&this.editor){const e=document.createRange(),t=window.getSelection();e.selectNodeContents(this.editor),t.removeAllRanges(),t.addRange(e)}}getCellText(){const{getText:e}=this.options;if("function"==typeof e)return call$1(e,this.cellView,{cell:this.cell,index:this.labelIndex});if("string"==typeof e){if(this.cell.isNode())return this.cell.attr(e);if(this.cell.isEdge()&&-1!==this.labelIndex)return this.cell.prop(`labels/${this.labelIndex}/attrs/${e}`)}}setCellText(e){const t=this.options.setText;if("function"!=typeof t){if("string"==typeof t){if(this.cell.isNode())return void(null!==e&&this.cell.attr(t,e));if(this.cell.isEdge()){const r=this.cell;if(-1===this.labelIndex){if(e){const n={position:{distance:this.distance},attrs:{}};setByPath(n,`attrs/${t}`,e),r.appendLabel(n)}}else null!==e?r.prop(`labels/${this.labelIndex}/attrs/${t}`,e):"number"==typeof this.labelIndex&&r.removeLabelAt(this.labelIndex)}}}else call$1(t,this.cellView,{cell:this.cell,value:e,index:this.labelIndex,distance:this.distance})}onRemove(){const e=this.cellView;e&&e.off("cell:dblclick",this.dblClick),this.removeElement()}}var CellEditor2;CellEditor2=CellEditor||(CellEditor={}),CellEditor2.config({tagName:"div",isSVGElement:!1,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mouseup:"onDocumentMouseUp",touchend:"onDocumentMouseUp",touchcancel:"onDocumentMouseUp"}}),function(e){e.NodeEditor=e.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},getText:"text/text",setText:"text/text"}),e.EdgeEditor=e.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},labelAddable:!0,getText:"label/text",setText:"label/text"})}(CellEditor||(CellEditor={}));var __rest$f=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},NodeTool,NodeTool2,EdgeTool,EdgeTool2;NodeTool2=NodeTool||(NodeTool={}),NodeTool2.presets={boundary:Boundary,button:Button,"button-remove":Button.Remove,"node-editor":CellEditor.NodeEditor},NodeTool2.registry=Registry.create({type:"node tool",process(e,t){if("function"==typeof t)return t;let r=ToolsView.ToolItem;const{inherit:n}=t,i=__rest$f(t,["inherit"]);if(n){const e=this.get(n);null==e?this.onNotFound(n,"inherited"):r=e}return null==i.name&&(i.name=e),r.define.call(r,i)}}),NodeTool2.registry.register(NodeTool2.presets,!0),EdgeTool2=EdgeTool||(EdgeTool={}),EdgeTool2.presets={boundary:Boundary,vertices:Vertices,segments:Segments,button:Button,"button-remove":Button.Remove,"source-anchor":SourceAnchor,"target-anchor":TargetAnchor,"source-arrowhead":SourceArrowhead,"target-arrowhead":TargetArrowhead,"edge-editor":CellEditor.EdgeEditor},EdgeTool2.registry=Registry.create({type:"edge tool",process(e,t){if("function"==typeof t)return t;let r=ToolsView.ToolItem;const{inherit:n}=t,i=__rest$f(t,["inherit"]);if(n){const e=this.get(n);null==e?this.onNotFound(n,"inherited"):r=e}return null==i.name&&(i.name=e),r.define.call(r,i)}}),EdgeTool2.registry.register(EdgeTool2.presets,!0);const center=createBBoxAnchor("center"),top$1=createBBoxAnchor("topCenter"),bottom=createBBoxAnchor("bottomCenter"),left$1=createBBoxAnchor("leftMiddle"),right=createBBoxAnchor("rightMiddle"),topLeft=createBBoxAnchor("topLeft"),topRight=createBBoxAnchor("topRight"),bottomLeft=createBBoxAnchor("bottomLeft"),bottomRight=createBBoxAnchor("bottomRight");function createBBoxAnchor(e){return function(t,r,n,i={}){let o;o=t.cell.visible?i.rotate?t.getUnrotatedBBoxOfElement(r):t.getBBoxOfElement(r):t.cell.getBBox();const a=o[e];a.x+=normalizePercentage(i.dx,o.width),a.y+=normalizePercentage(i.dy,o.height);const s=t.cell;return i.rotate?a.rotate(-s.getAngle(),s.getBBox().getCenter()):a}}function resolve$1(e){return function(t,r,n,i){if(n instanceof Element){const o=this.graph.findViewByElem(n);let a;if(o)if(o.isEdgeElement(n)){a=getPointAtEdge(o,null!=i.fixedAt?i.fixedAt:"50%")}else a=o.getBBoxOfElement(n).getCenter();else a=new Point;return e.call(this,t,r,a,i)}return e.apply(this,arguments)}}function getPointAtEdge(e,t){const r=isPercentage(t),n="string"==typeof t?parseFloat(t):t;return r?e.getPointAtRatio(n/100):e.getPointAtLength(n)}const orthogonal$1=function(e,t,r,n){const i=Angle.normalize(e.cell.getAngle()),o=e.cell.visible?e.getBBoxOfElement(t):e.cell.getBBox(),a=o.getCenter(),s=o.getTopLeft(),l=o.getBottomRight();let c=n.padding;if(Number.isFinite(c)||(c=0),s.y+c<=r.y&&r.y<=l.y-c){const e=r.y-a.y;a.x+=0===i||180===i?0:1*e/Math.tan(Angle.toRad(i)),a.y+=e}else if(s.x+c<=r.x&&r.x<=l.x-c){const e=r.x-a.x;a.y+=90===i||270===i?0:e*Math.tan(Angle.toRad(i)),a.x+=e}return a},orth$2=resolve$1(orthogonal$1),nodeCenter=function(e,t,r,n,i){const o=e.cell.getConnectionPoint(this.cell,i);return(n.dx||n.dy)&&o.translate(n.dx||0,n.dy||0),o},middleSide=function(e,t,r,n){let i,o,a=0;const s=e.cell;n.rotate?(i=e.getUnrotatedBBoxOfElement(t),o=s.getBBox().getCenter(),a=s.getAngle()):i=s.visible?e.getBBoxOfElement(t):e.cell.getBBox();const l=n.padding;null!=l&&Number.isFinite(l)&&i.inflate(l),n.rotate&&r.rotate(a,o);const c=i.getNearestSideToPoint(r);let u;switch(c){case"left":u=i.getLeftMiddle();break;case"right":u=i.getRightMiddle();break;case"top":u=i.getTopCenter();break;case"bottom":u=i.getBottomCenter()}const d=n.direction;return"H"===d?"top"!==c&&"bottom"!==c||(u=r.x<=i.x+i.width?i.getLeftMiddle():i.getRightMiddle()):"V"===d&&(u=r.y<=i.y+i.height?i.getTopCenter():i.getBottomCenter()),n.rotate?u.rotate(-a,o):u},midSide=resolve$1(middleSide),anchors$1=Object.freeze(Object.defineProperty({__proto__:null,bottom:bottom,bottomLeft:bottomLeft,bottomRight:bottomRight,center:center,left:left$1,midSide:midSide,nodeCenter:nodeCenter,orth:orth$2,right:right,top:top$1,topLeft:topLeft,topRight:topRight},Symbol.toStringTag,{value:"Module"}));var NodeAnchor,NodeAnchor2;NodeAnchor2=NodeAnchor||(NodeAnchor={}),NodeAnchor2.presets=anchors$1,NodeAnchor2.registry=Registry.create({type:"node endpoint"}),NodeAnchor2.registry.register(NodeAnchor2.presets,!0);const ratio=function(e,t,r,n){let i=null!=n.ratio?n.ratio:.5;return i>1&&(i/=100),e.getPointAtRatio(i)},length=function(e,t,r,n){const i=null!=n.length?n.length:20;return e.getPointAtLength(i)},getClosestPoint=function(e,t,r,n){const i=e.getClosestPoint(r);return null!=i?i:new Point},closest=resolve$1(getClosestPoint),orthogonal=function(e,t,r,n){const i=1e6,o=e.getConnection(),a=e.getConnectionSubdivisions(),s=new Line(r.clone().translate(0,i),r.clone().translate(0,-i)),l=new Line(r.clone().translate(i,0),r.clone().translate(-i,0)),c=s.intersect(o,{segmentSubdivisions:a}),u=l.intersect(o,{segmentSubdivisions:a}),d=[];return c&&d.push(...c),u&&d.push(...u),d.length>0?r.closest(d):null!=n.fallbackAt?getPointAtEdge(e,n.fallbackAt):call$1(getClosestPoint,this,e,t,r,n)},orth$1=resolve$1(orthogonal),anchors=Object.freeze(Object.defineProperty({__proto__:null,closest:closest,length:length,orth:orth$1,ratio:ratio},Symbol.toStringTag,{value:"Module"}));var EdgeAnchor,EdgeAnchor2;function offset(e,t,r){let n;if("object"==typeof r){if(Number.isFinite(r.y)){const n=new Line(t,e),{start:i,end:o}=n.parallel(r.y);t=i,e=o}n=r.x}else n=r;if(null==n||!Number.isFinite(n))return e;const i=e.distance(t);return 0===n&&i>0?e:e.move(t,-Math.min(n,i-1))}function getStrokeWidth(e){const t=e.getAttribute("stroke-width");return null===t?0:parseFloat(t)||0}function findShapeNode(e){if(null==e)return null;let t=e;do{let e=t.tagName;if("string"!=typeof e)return null;if(e=e.toUpperCase(),"G"===e)t=t.firstElementChild;else{if("TITLE"!==e)break;t=t.nextElementSibling}}while(t);return t}EdgeAnchor2=EdgeAnchor||(EdgeAnchor={}),EdgeAnchor2.presets=anchors,EdgeAnchor2.registry=Registry.create({type:"edge endpoint"}),EdgeAnchor2.registry.register(EdgeAnchor2.presets,!0);const bbox=function(e,t,r,n){const i=t.getBBoxOfElement(r);n.stroked&&i.inflate(getStrokeWidth(r)/2);const o=e.intersect(i);return offset(o&&o.length?e.start.closest(o):e.end,e.start,n.offset)},rect=function(e,t,r,n,i){const o=t.cell,a=o.isNode()?o.getAngle():0;if(0===a)return call$1(bbox,this,e,t,r,n,i);const s=t.getUnrotatedBBoxOfElement(r);n.stroked&&s.inflate(getStrokeWidth(r)/2);const l=s.getCenter(),c=e.clone().rotate(a,l),u=c.setLength(1e6).intersect(s);return offset(u&&u.length?c.start.closest(u).rotate(-a,l):e.end,e.start,n.offset)},boundary=function(e,t,r,n){let i,o;const a=e.end,s=n.selector;if(i="string"==typeof s?t.findOne(s):Array.isArray(s)?getByPath(r,s):findShapeNode(r),!isSVGGraphicsElement$1(i)){if(i===r||!isSVGGraphicsElement$1(r))return a;i=r}const l=t.getShapeOfElement(i),c=t.getMatrixOfElement(i),u=t.getRootTranslatedMatrix(),d=t.getRootRotatedMatrix(),p=u.multiply(d).multiply(c),h=p.inverse(),f=Util$1.transformLine(e,h),g=f.start.clone(),m=t.getDataOfElement(i);if(!1===n.insideout){null==m.shapeBBox&&(m.shapeBBox=l.bbox());const e=m.shapeBBox;if(null!=e&&e.containsPoint(g))return a}let v;if(!0===n.extrapolate&&f.setLength(1e6),Path.isPath(l)){const e=n.precision||2;null==m.segmentSubdivisions&&(m.segmentSubdivisions=l.getSegmentSubdivisions({precision:e})),v={precision:e,segmentSubdivisions:m.segmentSubdivisions},o=f.intersect(l,v)}else o=f.intersect(l);o?Array.isArray(o)&&(o=g.closest(o)):!0===n.sticky&&(o=Rectangle.isRectangle(l)?l.getNearestPointToPoint(g):Ellipse.isEllipse(l)?l.intersectsWithLineFromCenterToPoint(g):l.closestPoint(g,v));const y=o?Util$1.transformPoint(o,p):a;let b=n.offset||0;return!1!==n.stroked&&("object"==typeof b?(b=Object.assign({},b),null==b.x&&(b.x=0),b.x+=getStrokeWidth(i)/2):b+=getStrokeWidth(i)/2),offset(y,e.start,b)};function alignLine(e,t,r=0){const{start:n,end:i}=e;let o,a,s,l;switch(t){case"left":l="x",o=i,a=n,s=-1;break;case"right":l="x",o=n,a=i,s=1;break;case"top":l="y",o=i,a=n,s=-1;break;case"bottom":l="y",o=n,a=i,s=1;break;default:return}n[l]<i[l]?o[l]=a[l]:a[l]=o[l],Number.isFinite(r)&&(o[l]+=s*r,a[l]+=s*r)}const anchor=function(e,t,r,n){const{alignOffset:i,align:o}=n;return o&&alignLine(e,o,i),offset(e.end,e.start,n.offset)},connectionPoints=Object.freeze(Object.defineProperty({__proto__:null,anchor:anchor,bbox:bbox,boundary:boundary,rect:rect},Symbol.toStringTag,{value:"Module"}));var ConnectionPoint,ConnectionPoint2;ConnectionPoint2=ConnectionPoint||(ConnectionPoint={}),ConnectionPoint2.presets=connectionPoints,ConnectionPoint2.registry=Registry.create({type:"connection point"}),ConnectionPoint2.registry.register(ConnectionPoint2.presets,!0);const normal$1=function(e){return[...e]},oneSide=function(e,t,r){const n=t.side||"bottom",i=normalizeSides(t.padding||40),o=r.sourceBBox,a=r.targetBBox,s=o.getCenter(),l=a.getCenter();let c,u,d;switch(n){case"top":d=-1,c="y",u="height";break;case"left":d=-1,c="x",u="width";break;case"right":d=1,c="x",u="width";break;default:d=1,c="y",u="height"}return s[c]+=d*(o[u]/2+i[n]),l[c]+=d*(a[u]/2+i[n]),d*(s[c]-l[c])>0?l[c]=s[c]:s[c]=l[c],[s.toJSON(),...e,l.toJSON()]};function getPointBBox(e){return new Rectangle(e.x,e.y,0,0)}function getPaddingBox(e={}){const t=normalizeSides(e.padding||20);return{x:-t.left,y:-t.top,width:t.left+t.right,height:t.top+t.bottom}}function getSourceBBox$1(e,t={}){return e.sourceBBox.clone().moveAndExpand(getPaddingBox(t))}function getTargetBBox$1(e,t={}){return e.targetBBox.clone().moveAndExpand(getPaddingBox(t))}function getSourceAnchor(e,t={}){if(e.sourceAnchor)return e.sourceAnchor;return getSourceBBox$1(e,t).getCenter()}function getTargetAnchor(e,t={}){if(e.targetAnchor)return e.targetAnchor;return getTargetBBox$1(e,t).getCenter()}const orth=function(e,t,r){let n=getSourceBBox$1(r,t),i=getTargetBBox$1(r,t);const o=getSourceAnchor(r,t),a=getTargetAnchor(r,t);n=n.union(getPointBBox(o)),i=i.union(getPointBBox(a));const s=e.map(e=>Point.create(e));s.unshift(o),s.push(a);let l=null;const c=[];for(let u=0,d=s.length-1;u<d;u+=1){let e=null;const r=s[u],o=s[u+1],a=null!=Private$2.getBearing(r,o);if(0===u)u+1===d?n.intersectsWithRect(i.clone().inflate(1))?e=Private$2.insideNode(r,o,n,i):a||(e=Private$2.nodeToNode(r,o,n,i)):n.containsPoint(o)?e=Private$2.insideNode(r,o,n,getPointBBox(o).moveAndExpand(getPaddingBox(t))):a||(e=Private$2.nodeToVertex(r,o,n));else if(u+1===d){const n=a&&Private$2.getBearing(o,r)===l;i.containsPoint(r)||n?e=Private$2.insideNode(r,o,getPointBBox(r).moveAndExpand(getPaddingBox(t)),i,l):a||(e=Private$2.vertexToNode(r,o,i,l))}else a||(e=Private$2.vertexToVertex(r,o,l));e?(c.push(...e.points),l=e.direction):l=Private$2.getBearing(r,o),u+1<d&&c.push(o)}return c};var Private$2;!function(e){const t={N:"S",S:"N",E:"W",W:"E"},r={N:-Math.PI/2*3,S:-Math.PI/2,E:0,W:Math.PI};function n(e,t,r){let n=new Point(e.x,t.y);return r.containsPoint(n)&&(n=new Point(t.x,e.y)),n}function i(e,t){return e["W"===t||"E"===t?"width":"height"]}function o(e,t){return e.x===t.x?e.y>t.y?"N":"S":e.y===t.y?e.x>t.x?"W":"E":null}function a(e,r,n){const i=new Point(e.x,r.y),a=new Point(r.x,e.y),s=o(e,i),l=o(e,a),c=n?t[n]:null,u=s===n||s!==c&&(l===c||l!==n)?i:a;return{points:[u],direction:o(u,r)}}function s(e,t,r){const i=n(e,t,r);return{points:[i],direction:o(i,t)}}e.getBBoxSize=i,e.getBearing=o,e.vertexToVertex=a,e.nodeToVertex=s,e.vertexToNode=function(e,t,r,a){const s=[new Point(e.x,t.y),new Point(t.x,e.y)],l=s.filter(e=>!r.containsPoint(e)),c=l.filter(t=>o(t,e)!==a);let u;if(c.length>0)return u=c.filter(t=>o(e,t)===a).pop(),u=u||c[0],{points:[u],direction:o(u,t)};{u=difference(s,l)[0];const c=Point.create(t).move(u,-i(r,a)/2);return{points:[n(c,e,r),c],direction:o(c,t)}}},e.nodeToNode=function(e,t,r,n){let l=s(t,e,n);const c=l.points[0];if(r.containsPoint(c)){l=s(e,t,r);const u=l.points[0];if(n.containsPoint(u)){const d=Point.create(e).move(u,-i(r,o(e,u))/2),p=Point.create(t).move(c,-i(n,o(t,c))/2),h=new Line(d,p).getCenter(),f=s(e,h,r),g=a(h,t,f.direction);l.points=[f.points[0],g.points[0]],l.direction=g.direction}}return l},e.insideNode=function(e,t,i,a,s){const l=i.union(a).inflate(1),c=l.getCenter(),u=c.distance(t)>c.distance(e),d=u?t:e,p=u?e:t;let h,f,g,m;return s?(h=Point.fromPolar(l.width+l.height,r[s],d),h=l.getNearestPointToPoint(h).move(h,-1)):h=l.getNearestPointToPoint(d).move(d,1),f=n(h,p,l),h.round().equals(f.round())?(f=Point.fromPolar(l.width+l.height,Angle.toRad(h.theta(d))+Math.PI/2,p),f=l.getNearestPointToPoint(f).move(p,1).round(),g=n(h,f,l),m=u?[f,g,h]:[h,g,f]):m=u?[f,h]:[h,f],{points:m,direction:o(u?h:f,t)}}}(Private$2||(Private$2={}));const defaults$2={step:10,maxLoopCount:2e3,precision:1,maxDirectionChange:90,perpendicular:!0,excludeTerminals:[],excludeNodes:[],excludeShapes:[],startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{top:{x:0,y:-1},right:{x:1,y:0},bottom:{x:0,y:1},left:{x:-1,y:0}},cost(){return resolve(this.step,this)},directions(){const e=resolve(this.step,this),t=resolve(this.cost,this);return[{cost:t,offsetX:e,offsetY:0},{cost:t,offsetX:-e,offsetY:0},{cost:t,offsetX:0,offsetY:e},{cost:t,offsetX:0,offsetY:-e}]},penalties(){const e=resolve(this.step,this);return{0:0,45:e/2,90:e/2}},paddingBox(){const e=resolve(this.step,this);return{x:-e,y:-e,width:2*e,height:2*e}},fallbackRouter:orth,draggingRouter:null,snapToGrid:!0};function resolve(e,t){return"function"==typeof e?e.call(t):e}function resolveOptions(e){const t=Object.keys(e).reduce((t,r)=>{const n=t;return n[r]="fallbackRouter"===r||"draggingRouter"===r||"fallbackRoute"===r?e[r]:resolve(e[r],e),t},{});if(t.padding){const e=normalizeSides(t.padding);t.paddingBox={x:-e.left,y:-e.top,width:e.left+e.right,height:e.top+e.bottom}}return t.directions.forEach(e=>{const t=new Point(0,0),r=new Point(e.offsetX,e.offsetY);e.angle=Angle.normalize(t.theta(r))}),t}const OPEN=1,CLOSE=2;class SortedSet{constructor(){this.items=[],this.hash={},this.values={}}add(e,t){this.hash[e]?this.items.splice(this.items.indexOf(e),1):this.hash[e]=OPEN,this.values[e]=t;const r=sortedIndexBy(this.items,e,e=>this.values[e]);this.items.splice(r,0,e)}pop(){const e=this.items.shift();return e&&(this.hash[e]=CLOSE),e}isOpen(e){return this.hash[e]===OPEN}isClose(e){return this.hash[e]===CLOSE}isEmpty(){return 0===this.items.length}}class ObstacleMap{constructor(e){this.options=e,this.mapGridSize=100,this.map={}}build(e,t){const r=this.options,n=r.excludeTerminals.reduce((r,n)=>{const i=t[n];if(i){const t=e.getCell(i.cell);t&&r.push(t)}return r},[]);let i=[];const o=e.getCell(t.getSourceCellId());o&&(i=union(i,o.getAncestors().map(e=>e.id)));const a=e.getCell(t.getTargetCellId());a&&(i=union(i,a.getAncestors().map(e=>e.id)));const s=this.mapGridSize;return e.getNodes().reduce((e,t)=>{const o=n.some(e=>e.id===t.id),a=!!t.shape&&r.excludeShapes.includes(t.shape),l=r.excludeNodes.some(e=>"string"==typeof e?t.id===e:e===t),c=i.includes(t.id),u=a||o||l||c;if(t.isVisible()&&!u){const n=t.getBBox().moveAndExpand(r.paddingBox),i=n.getOrigin().snapToGrid(s),o=n.getCorner().snapToGrid(s);for(let t=i.x;t<=o.x;t+=s)for(let r=i.y;r<=o.y;r+=s){const i=new Point(t,r).toString();null==e[i]&&(e[i]=[]),e[i].push(n)}}return e},this.map),this}isAccessible(e){const t=e.clone().snapToGrid(this.mapGridSize).toString(),r=this.map[t];return!r||r.every(t=>!t.containsPoint(e))}}function getSourceBBox(e,t){const r=e.sourceBBox.clone();return t&&t.paddingBox?r.moveAndExpand(t.paddingBox):r}function getTargetBBox(e,t){const r=e.targetBBox.clone();return t&&t.paddingBox?r.moveAndExpand(t.paddingBox):r}function getSourceEndpoint(e,t){if(e.sourceAnchor)return e.sourceAnchor;return getSourceBBox(e,t).getCenter()}function getTargetEndpoint(e,t){if(e.targetAnchor)return e.targetAnchor;return getTargetBBox(e,t).getCenter()}function getDirectionAngle(e,t,r,n,i){const o=360/r,a=e.theta(fixAngleEnd(e,t,n,i)),s=Angle.normalize(a+o/2);return o*Math.floor(s/o)}function fixAngleEnd(e,t,r,n){const i=n.step,o=t.x-e.x,a=t.y-e.y,s=o/r.x*i,l=a/r.y*i;return new Point(e.x+s,e.y+l)}function getDirectionChange(e,t){const r=Math.abs(e-t);return r>180?360-r:r}function getGridOffsets(e,t){const r=t.step;return t.directions.forEach(t=>{t.gridOffsetX=t.offsetX/r*e.x,t.gridOffsetY=t.offsetY/r*e.y}),t.directions}function getGrid(e,t,r){return{source:t.clone(),x:getGridDimension(r.x-t.x,e),y:getGridDimension(r.y-t.y,e)}}function getGridDimension(e,t){if(!e)return t;const r=Math.abs(e),n=Math.round(r/t);if(!n)return r;return t+(r-n*t)/n}function snapGrid(e,t){const r=t.source,n=GeometryUtil.snapToGrid(e.x-r.x,t.x)+r.x,i=GeometryUtil.snapToGrid(e.y-r.y,t.y)+r.y;return new Point(n,i)}function round(e,t){return e.round(t)}function align(e,t,r){return round(snapGrid(e.clone(),t),r)}function getKey(e){return e.toString()}function normalizePoint(e){return new Point(0===e.x?0:Math.abs(e.x)/e.x,0===e.y?0:Math.abs(e.y)/e.y)}function getCost(e,t){let r=1/0;for(let n=0,i=t.length;n<i;n+=1){const i=e.manhattanDistance(t[n]);i<r&&(r=i)}return r}function getRectPoints(e,t,r,n,i){const o=i.precision,a=i.directionMap,s=e.diff(t.getCenter()),l=Object.keys(a).reduce((i,l)=>{if(r.includes(l)){const r=a[l],c=new Point(e.x+r.x*(Math.abs(s.x)+t.width),e.y+r.y*(Math.abs(s.y)+t.height)),u=new Line(e,c).intersect(t)||[];let d,p=null;for(let t=0;t<u.length;t+=1){const r=u[t],n=e.squaredDistance(r);(null==d||n>d)&&(d=n,p=r)}if(p){let e=align(p,n,o);t.containsPoint(e)&&(e=align(e.translate(r.x*n.x,r.y*n.y),n,o)),i.push(e)}}return i},[]);return t.containsPoint(e)||l.push(align(e,n,o)),l}function reconstructRoute(e,t,r,n,i){const o=[];let a,s=normalizePoint(i.diff(r)),l=getKey(r),c=e[l];for(;c;){a=t[l];const r=normalizePoint(a.diff(c));r.equals(s)||(o.unshift(a),s=r),l=getKey(c),c=e[l]}const u=t[l];return normalizePoint(u.diff(n)).equals(s)||o.unshift(u),o}function findRoute(e,t,r,n,i){const o=i.precision;let a,s;a=Rectangle.isRectangle(t)?round(getSourceEndpoint(e,i).clone(),o):round(t.clone(),o),s=Rectangle.isRectangle(r)?round(getTargetEndpoint(e,i).clone(),o):round(r.clone(),o);const l=getGrid(i.step,a,s),c=a,u=s;let d,p;if(d=Rectangle.isRectangle(t)?getRectPoints(c,t,i.startDirections,l,i):[c],p=Rectangle.isRectangle(r)?getRectPoints(s,r,i.endDirections,l,i):[u],d=d.filter(e=>n.isAccessible(e)),p=p.filter(e=>n.isAccessible(e)),d.length>0&&p.length>0){const e=new SortedSet,t={},r={},a={};for(let n=0,i=d.length;n<i;n+=1){const r=d[n],i=getKey(r);e.add(i,getCost(r,p)),t[i]=r,a[i]=0}const s=i.previousDirectionAngle,h=void 0===s;let f,g;const m=getGridOffsets(l,i),v=m.length,y=p.reduce((e,t)=>{const r=getKey(t);return e.push(r),e},[]),b=Point.equalPoints(d,p);let q=i.maxLoopCount;for(;!e.isEmpty()&&q>0;){const d=e.pop(),V=t[d],S=r[d],E=a[d],x=V.equals(c),C=null==S;let w;w=C?h?x?null:getDirectionAngle(c,V,v,l,i):s:getDirectionAngle(S,V,v,l,i);if(!(C&&b)&&y.indexOf(d)>=0)return i.previousDirectionAngle=w,reconstructRoute(r,t,V,c,u);for(let s=0;s<v;s+=1){f=m[s];const c=f.angle;if(g=getDirectionChange(w,c),(!h||!x)&&g>i.maxDirectionChange)continue;const d=align(V.clone().translate(f.gridOffsetX||0,f.gridOffsetY||0),l,o),b=getKey(d);if(e.isClose(b)||!n.isAccessible(d))continue;if(y.indexOf(b)>=0){if(!d.equals(u)){if(getDirectionChange(c,getDirectionAngle(d,u,v,l,i))>i.maxDirectionChange)continue}}const q=E+f.cost+(x?0:i.penalties[g]);(!e.isOpen(b)||q<a[b])&&(t[b]=d,r[b]=V,a[b]=q,e.add(b,q+getCost(d,p)))}q-=1}}return i.fallbackRoute?call$1(i.fallbackRoute,this,c,u,i):null}function snap(e,t=10){if(e.length<=1)return e;for(let r=0,n=e.length;r<n-1;r+=1){const n=e[r],i=e[r+1];if(n.x===i.x){const e=t*Math.round(n.x/t);n.x!==e&&(n.x=e,i.x=e)}else if(n.y===i.y){const e=t*Math.round(n.y/t);n.y!==e&&(n.y=e,i.y=e)}}return e}const router=function(e,t,r){const n=resolveOptions(t),i=getSourceBBox(r,n),o=getTargetBBox(r,n),a=getSourceEndpoint(r,n),s=new ObstacleMap(n).build(r.graph.model,r.cell),l=e.map(e=>Point.create(e)),c=[];let u,d,p=a;for(let h=0,f=l.length;h<=f;h+=1){let t=null;if(u=d||i,d=l[h],null==d){d=o;const e=r.cell;if((null==e.getSourceCellId()||null==e.getTargetCellId())&&"function"==typeof n.draggingRouter){const e=u===i?a:u,o=d.getOrigin();t=call$1(n.draggingRouter,r,e,o,n)}}if(null==t&&(t=findRoute(r,u,d,s,n)),null===t)return call$1(n.fallbackRouter,this,e,n,r);const f=t[0];f&&f.equals(p)&&t.shift(),p=t[t.length-1]||p,c.push(...t)}return n.snapToGrid?snap(c,r.graph.grid.getGridSize()):c},manhattan=function(e,t,r){return call$1(router,this,e,Object.assign(Object.assign({},defaults$2),t),r)},defaults$1={maxDirectionChange:45,directions(){const e=resolve(this.step,this),t=resolve(this.cost,this),r=Math.ceil(Math.sqrt(e*e<<1));return[{cost:t,offsetX:e,offsetY:0},{cost:r,offsetX:e,offsetY:e},{cost:t,offsetX:0,offsetY:e},{cost:r,offsetX:-e,offsetY:e},{cost:t,offsetX:-e,offsetY:0},{cost:r,offsetX:-e,offsetY:-e},{cost:t,offsetX:0,offsetY:-e},{cost:r,offsetX:e,offsetY:-e}]},fallbackRoute(e,t,r){const n=e.theta(t),i=[];let o={x:t.x,y:e.y},a={x:e.x,y:t.y};if(n%180>90){const e=o;o=a,a=e}const s=n%90<45?o:a,l=new Line(e,s),c=90*Math.ceil(n/90),u=Point.fromPolar(l.squaredLength(),Angle.toRad(c+135),s),d=new Line(t,u),p=l.intersectsWithLine(d),h=p||t,f=p?h:e,g=360/r.directions.length,m=f.theta(t),v=Angle.normalize(m+g/2),y=g*Math.floor(v/g);return r.previousDirectionAngle=y,h&&i.push(h.round()),i.push(t),i}},metro=function(e,t,r){return call$1(manhattan,this,e,Object.assign(Object.assign({},defaults$1),t),r)},er=function(e,t,r){const n=t.offset||32,i=null==t.min?16:t.min;let o=0,a=t.direction;const s=r.sourceBBox,l=r.targetBBox,c=s.getCenter(),u=l.getCenter();if("number"==typeof n&&(o=n),null==a){let e=l.left-s.right,t=l.top-s.bottom;e>=0&&t>=0?a=e>=t?"L":"T":e<=0&&t>=0?(e=s.left-l.right,a=e>=0&&e>=t?"R":"T"):e>=0&&t<=0?(t=s.top-l.bottom,a=t>=0?e>=t?"L":"B":"L"):(e=s.left-l.right,t=s.top-l.bottom,a=e>=0&&t>=0?e>=t?"R":"B":e<=0&&t>=0?"B":e>=0&&t<=0||Math.abs(e)>Math.abs(t)?"R":"B")}let d,p,h;"H"===a?a=u.x-c.x>=0?"L":"R":"V"===a&&(a=u.y-c.y>=0?"T":"B"),"center"===n&&("L"===a?o=(l.left-s.right)/2:"R"===a?o=(s.left-l.right)/2:"T"===a?o=(l.top-s.bottom)/2:"B"===a&&(o=(s.top-l.bottom)/2));const f="L"===a||"R"===a;if(f){if(u.y===c.y)return[...e];h="L"===a?1:-1,d="x",p="width"}else{if(u.x===c.x)return[...e];h="T"===a?1:-1,d="y",p="height"}const g=c.clone(),m=u.clone();if(g[d]+=h*(s[p]/2+o),m[d]-=h*(l[p]/2+o),f){const e=g.x,t=m.x,r=s.width/2+i,n=l.width/2+i;u.x>c.x?t<=e&&(g.x=Math.max(t,c.x+r),m.x=Math.min(e,u.x-n)):t>=e&&(g.x=Math.min(t,c.x-r),m.x=Math.max(e,u.x+n))}else{const e=g.y,t=m.y,r=s.height/2+i,n=l.height/2+i;u.y>c.y?t<=e&&(g.y=Math.max(t,c.y+r),m.y=Math.min(e,u.y-n)):t>=e&&(g.y=Math.min(t,c.y-r),m.y=Math.max(e,u.y+n))}return[g.toJSON(),...e,m.toJSON()]};function rollup(e,t){if(null!=t&&!1!==t){const r="boolean"==typeof t?0:t;if(r>0){const t=Point.create(e[1]).move(e[2],r),n=Point.create(e[1]).move(e[0],r);return[t.toJSON(),...e,n.toJSON()]}{const t=e[1];return[Object.assign({},t),...e,Object.assign({},t)]}}return e}const loop$1=function(e,t,r){const n=t.width||50,i=(t.height||80)/2,o=t.angle||"auto",a=r.sourceAnchor,s=r.targetAnchor,l=r.sourceBBox,c=r.targetBBox;if(a.equals(s)){const e=e=>{const t=Angle.toRad(e),r=Math.sin(t),o=Math.cos(t),s=new Point(a.x+o*n,a.y+r*n),l=new Point(s.x-o*i,s.y-r*i),c=l.clone().rotate(-90,s),u=l.clone().rotate(90,s);return[c.toJSON(),s.toJSON(),u.toJSON()]},r=e=>{const t=a.clone().move(e,-1),r=new Line(t,e);return!l.containsPoint(e)&&!l.intersectsWithLine(r)},s=[0,90,180,270,45,135,225,315];if("number"==typeof o)return rollup(e(o),t.merge);const c=l.getCenter();if(c.equals(a))return rollup(e(0),t.merge);const u=c.angleBetween(a,c.clone().translate(1,0));let d=e(u);if(r(d[1]))return rollup(d,t.merge);for(let n=1,i=s.length;n<i;n+=1)if(d=e(u+s[n]),r(d[1]))return rollup(d,t.merge);return rollup(d,t.merge)}{const e=new Line(a,s);let o=e.parallel(-n),u=o.getCenter(),d=o.start.clone().move(o.end,i),p=o.end.clone().move(o.start,i);const h=e.parallel(-1),f=new Line(h.start,u),g=new Line(h.end,u);if((l.containsPoint(u)||c.containsPoint(u)||l.intersectsWithLine(f)||l.intersectsWithLine(g)||c.intersectsWithLine(f)||c.intersectsWithLine(g))&&(o=e.parallel(n),u=o.getCenter(),d=o.start.clone().move(o.end,i),p=o.end.clone().move(o.start,i)),t.merge){const e=new Line(a,s),t=new Line(u,e.center).setLength(Number.MAX_SAFE_INTEGER),n=l.intersectsWithLine(t),i=c.intersectsWithLine(t),o=n?Array.isArray(n)?n:[n]:[];i&&(Array.isArray(i)?o.push(...i):o.push(i));const d=e.center.closest(o);d?(r.sourceAnchor=d.clone(),r.targetAnchor=d.clone()):(r.sourceAnchor=e.center.clone(),r.targetAnchor=e.center.clone())}return rollup([d.toJSON(),u.toJSON(),p.toJSON()],t.merge)}},routers=Object.freeze(Object.defineProperty({__proto__:null,er:er,loop:loop$1,manhattan:manhattan,metro:metro,normal:normal$1,oneSide:oneSide,orth:orth},Symbol.toStringTag,{value:"Module"}));var Router,Router2;Router2=Router||(Router={}),Router2.presets=routers,Router2.registry=Registry.create({type:"router"}),Router2.registry.register(Router2.presets,!0);const normal=function(e,t,r,n={}){const i=[e,...r,t],o=new Polyline(i),a=new Path(o);return n.raw?a:a.serialize()},loop=function(e,t,r,n={}){const i=3===r.length?0:1,o=Point.create(r[0+i]),a=Point.create(r[2+i]),s=Point.create(r[1+i]);if(!Point.equals(e,t)){const r=new Point((e.x+t.x)/2,(e.y+t.y)/2),n=r.angleBetween(Point.create(e).rotate(90,r),s);n>1&&(o.rotate(180-n,r),a.rotate(180-n,r),s.rotate(180-n,r))}const l=`\n M ${e.x} ${e.y}\n Q ${o.x} ${o.y} ${s.x} ${s.y}\n Q ${a.x} ${a.y} ${t.x} ${t.y}\n `;return n.raw?Path.parse(l):l},rounded=function(e,t,r,n={}){const i=new Path;i.appendSegment(Path.createSegment("M",e));const o=1/3,a=2/3,s=n.radius||10;let l,c;for(let u=0,d=r.length;u<d;u+=1){const n=Point.create(r[u]),d=r[u-1]||e,p=r[u+1]||t;l=c||n.distance(d)/2,c=n.distance(p)/2;const h=-Math.min(s,l),f=-Math.min(s,c),g=n.clone().move(d,h).round(),m=n.clone().move(p,f).round(),v=new Point(o*g.x+a*n.x,a*n.y+o*g.y),y=new Point(o*m.x+a*n.x,a*n.y+o*m.y);i.appendSegment(Path.createSegment("L",g)),i.appendSegment(Path.createSegment("C",v,y,m))}return i.appendSegment(Path.createSegment("L",t)),n.raw?i:i.serialize()},smooth=function(e,t,r,n={}){let i,o=n.direction;if(r&&0!==r.length){const n=[e,...r,t],o=Curve.throughPoints(n);i=new Path(o)}else if(i=new Path,i.appendSegment(Path.createSegment("M",e)),o||(o=Math.abs(e.x-t.x)>=Math.abs(e.y-t.y)?"H":"V"),"H"===o){const r=(e.x+t.x)/2;i.appendSegment(Path.createSegment("C",r,e.y,r,t.y,t.x,t.y))}else{const r=(e.y+t.y)/2;i.appendSegment(Path.createSegment("C",e.x,r,t.x,r,t.x,t.y))}return n.raw?i:i.serialize()},CLOSE_PROXIMITY_PADDING=1,F13=1/3,F23=2/3;function setupUpdating(e){let t=e.graph._jumpOverUpdateList;if(null==t&&(t=e.graph._jumpOverUpdateList=[],e.graph.on("cell:mouseup",()=>{const t=e.graph._jumpOverUpdateList;setTimeout(()=>{for(let e=0;e<t.length;e+=1)t[e].update()})}),e.graph.on("model:reseted",()=>{t=e.graph._jumpOverUpdateList=[]})),t.indexOf(e)<0){t.push(e);const r=()=>t.splice(t.indexOf(e),1);e.cell.once("change:connector",r),e.cell.once("removed",r)}}function createLines(e,t,r=[]){const n=[e,...r,t],i=[];return n.forEach((e,t)=>{const r=n[t+1];null!=r&&i.push(new Line(e,r))}),i}function findLineIntersections(e,t){const r=[];return t.forEach(t=>{const n=e.intersectsWithLine(t);if(n){const{x:e,y:i}=n,{start:o,end:a}=t,s=Math.round(o.x)===Math.round(e)&&Math.round(o.y)===Math.round(i),l=Math.round(a.x)===Math.round(e)&&Math.round(a.y)===Math.round(i);if(s||l)return;r.push(n)}}),r}function getDistence(e,t){return new Line(e,t).squaredLength()}function createJumps(e,t,r){return t.reduce((n,i,o)=>{if(skippedPoints.includes(i))return n;const a=n.pop()||e,s=Point.create(i).move(a.start,-r);let l=Point.create(i).move(a.start,+r);const c=t[o+1];if(null!=c){const e=l.distance(c);e<=r&&(l=c.move(a.start,e),skippedPoints.push(c))}else{if(s.distance(a.end)<2*r+CLOSE_PROXIMITY_PADDING)return n.push(a),n}if(l.distance(a.start)<2*r+CLOSE_PROXIMITY_PADDING)return n.push(a),n;const u=new Line(s,l);return jumppedLines.push(u),n.push(new Line(a.start,s),u,new Line(l,a.end)),n},[])}function buildPath(e,t,r,n){const i=new Path;let o;return o=Path.createSegment("M",e[0].start),i.appendSegment(o),e.forEach((a,s)=>{if(jumppedLines.includes(a)){let e,n,s,l;if("arc"===r){e=-90,n=a.start.diff(a.end);(n.x<0||0===n.x&&n.y<0)&&(e+=180);const t=a.getCenter(),r=new Line(t,a.end).rotate(e,t);let c;c=new Line(a.start,t),s=c.pointAt(2/3).rotate(e,a.start),l=r.pointAt(1/3).rotate(-e,r.end),o=Path.createSegment("C",s,l,r.end),i.appendSegment(o),c=new Line(t,a.end),s=r.pointAt(1/3).rotate(e,r.end),l=c.pointAt(1/3).rotate(-e,a.end),o=Path.createSegment("C",s,l,a.end),i.appendSegment(o)}else if("gap"===r)o=Path.createSegment("M",a.end),i.appendSegment(o);else if("cubic"===r){e=a.start.theta(a.end);const r=.6*t;let c=1.35*t;n=a.start.diff(a.end);(n.x<0||0===n.x&&n.y<0)&&(c*=-1),s=new Point(a.start.x+r,a.start.y+c).rotate(e,a.start),l=new Point(a.end.x-r,a.end.y+c).rotate(e,a.end),o=Path.createSegment("C",s,l,a.end),i.appendSegment(o)}}else{const t=e[s+1];0===n||!t||jumppedLines.includes(t)?(o=Path.createSegment("L",a.end),i.appendSegment(o)):buildRoundedSegment(n,i,a.end,a.start,t.end)}}),i}function buildRoundedSegment(e,t,r,n,i){const o=r.distance(n)/2,a=r.distance(i)/2,s=-Math.min(e,o),l=-Math.min(e,a),c=r.clone().move(n,s).round(),u=r.clone().move(i,l).round(),d=new Point(F13*c.x+F23*r.x,F23*r.y+F13*c.y),p=new Point(F13*u.x+F23*r.x,F23*r.y+F13*u.y);let h;h=Path.createSegment("L",c),t.appendSegment(h),h=Path.createSegment("C",d,p,u),t.appendSegment(h)}let jumppedLines,skippedPoints;const jumpover=function(e,t,r,n={}){jumppedLines=[],skippedPoints=[],setupUpdating(this);const i=n.size||5,o=n.type||"arc",a=n.radius||0,s=n.ignoreConnectors||["smooth"],l=this.graph,c=l.model.getEdges();if(1===c.length)return buildPath(createLines(e,t,r),i,o,a);const u=this.cell,d=c.indexOf(u),p=l.options.connecting.connector||{},h=c.filter((e,t)=>{const r=e.getConnector()||p;return!s.includes(r.name)&&(!(t>d)||"jumpover"!==r.name)}),f=h.map(e=>l.findViewByCell(e)),g=createLines(e,t,r),m=f.map(e=>null==e?[]:e===this?g:createLines(e.sourcePoint,e.targetPoint,e.routePoints)),v=[];g.forEach(e=>{const t=h.reduce((t,r,n)=>{if(r!==u){const r=findLineIntersections(e,m[n]);t.push(...r)}return t},[]).sort((t,r)=>getDistence(e.start,t)-getDistence(e.start,r));t.length>0?v.push(...createJumps(e,t,i)):v.push(e)});const y=buildPath(v,i,o,a);return jumppedLines=[],skippedPoints=[],n.raw?y:y.serialize()},connectors=Object.freeze(Object.defineProperty({__proto__:null,jumpover:jumpover,loop:loop,normal:normal,rounded:rounded,smooth:smooth},Symbol.toStringTag,{value:"Module"}));var Connector,Connector2;Connector2=Connector||(Connector={}),Connector2.presets=connectors,Connector2.registry=Registry.create({type:"connector"}),Connector2.registry.register(Connector2.presets,!0);var __decorate$s=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Animation2;class Store extends Basecoat{constructor(e={}){super(),this.pending=!1,this.changing=!1,this.data={},this.mutate(cloneDeep(e)),this.changed={}}mutate(e,t={}){const r=!0===t.unset,n=!0===t.silent,i=[],o=this.changing;this.changing=!0,o||(this.previous=cloneDeep(this.data),this.changed={});const a=this.data,s=this.previous,l=this.changed;if(Object.keys(e).forEach(t=>{const n=t,o=e[n];isEqual(a[n],o)||i.push(n),isEqual(s[n],o)?delete l[n]:l[n]=o,r?delete a[n]:a[n]=o}),!n&&i.length>0&&(this.pending=!0,this.pendingOptions=t,i.forEach(e=>{this.emit("change:*",{key:e,options:t,store:this,current:a[e],previous:s[e]})})),o)return this;if(!n)for(;this.pending;)this.pending=!1,this.emit("changed",{current:a,previous:s,store:this,options:this.pendingOptions});return this.pending=!1,this.changing=!1,this.pendingOptions=null,this}get(e,t){if(null==e)return this.data;const r=this.data[e];return null==r?t:r}getPrevious(e){if(this.previous){const t=this.previous[e];return null==t?void 0:t}}set(e,t,r){return null!=e&&("object"==typeof e?this.mutate(e,t):this.mutate({[e]:t},r)),this}remove(e,t){const r=void 0,n={};let i;if("string"==typeof e)n[e]=r,i=t;else if(Array.isArray(e))e.forEach(e=>n[e]=r),i=t;else{for(const e in this.data)n[e]=r;i=e}return this.mutate(n,Object.assign(Object.assign({},i),{unset:!0})),this}getByPath(e){return getByPath(this.data,e,"/")}setByPath(e,t,r={}){const n="/",i=Array.isArray(e)?[...e]:e.split(n),o=Array.isArray(e)?e.join(n):e,a=i[0],s=i.length;if(r.propertyPath=o,r.propertyValue=t,r.propertyPathArray=i,1===s)this.set(a,t,r);else{const o={};let l=o,c=a;for(let e=1;e<s;e+=1){const t=i[e],r=Number.isFinite(Number(t));l=l[c]=r?[]:{},c=t}setByPath(o,i,t,n);const u=cloneDeep(this.data);r.rewrite&&unsetByPath(u,e,n);const d=merge$2(u,o);this.set(a,d[a],r)}return this}removeByPath(e,t){const r=Array.isArray(e)?e:e.split("/"),n=r[0];if(1===r.length)this.remove(n,t);else{const e=r.slice(1),i=cloneDeep(this.get(n));i&&unsetByPath(i,e),this.set(n,i,t)}return this}hasChanged(e){return null==e?Object.keys(this.changed).length>0:e in this.changed}getChanges(e){if(null==e)return this.hasChanged()?cloneDeep(this.changed):null;const t=this.changing?this.previous:this.data,r={};let n;for(const i in e){const o=e[i];isEqual(t[i],o)||(r[i]=o,n=!0)}return n?cloneDeep(r):null}toJSON(){return cloneDeep(this.data)}clone(){return new(0,this.constructor)(this.data)}dispose(){this.off(),this.data={},this.previous={},this.changed={},this.pending=!1,this.changing=!1,this.pendingOptions=null,this.trigger("disposed",{store:this})}}__decorate$s([Basecoat.dispose()],Store.prototype,"dispose",null);class Animation{constructor(e){this.cell=e,this.ids={},this.cache={}}get(){return Object.keys(this.ids)}start(e,t,r={},n="/"){const i=this.cell.getPropByPath(e),o=defaults$4(r,Animation.defaultOptions),a=this.getTiming(o.timing),s=this.getInterp(o.interp,i,t);let l=0;const c=Array.isArray(e)?e.join(n):e,u=Array.isArray(e)?e:e.split(n),d=()=>{const e=(new Date).getTime();0===l&&(l=e);let t=(e-l)/o.duration;t<1?this.ids[c]=requestAnimationFrame(d):t=1;const n=s(a(t));this.cell.setPropByPath(u,n),r.progress&&r.progress(Object.assign({progress:t,currentValue:n},this.getArgs(c))),1===t&&(this.cell.notify("transition:complete",this.getArgs(c)),r.complete&&r.complete(this.getArgs(c)),this.cell.notify("transition:finish",this.getArgs(c)),r.finish&&r.finish(this.getArgs(c)),this.clean(c))};return setTimeout(()=>{this.stop(e,void 0,n),this.cache[c]={startValue:i,targetValue:t,options:o},this.ids[c]=requestAnimationFrame(d),this.cell.notify("transition:start",this.getArgs(c)),r.start&&r.start(this.getArgs(c))},r.delay),this.stop.bind(this,e,n,r)}stop(e,t={},r="/"){const n=Array.isArray(e)?e:e.split(r);return Object.keys(this.ids).filter(e=>isEqual(n,e.split(r).slice(0,n.length))).forEach(e=>{cancelAnimationFrame(this.ids[e]);const r=this.cache[e],n=this.getArgs(e),i=Object.assign(Object.assign({},r.options),t),o=i.jumpedToEnd;o&&null!=r.targetValue&&(this.cell.setPropByPath(e,r.targetValue),this.cell.notify("transition:end",Object.assign({},n)),this.cell.notify("transition:complete",Object.assign({},n)),i.complete&&i.complete(Object.assign({},n)));const a=Object.assign({jumpedToEnd:o},n);this.cell.notify("transition:stop",Object.assign({},a)),i.stop&&i.stop(Object.assign({},a)),this.cell.notify("transition:finish",Object.assign({},n)),i.finish&&i.finish(Object.assign({},n)),this.clean(e)}),this}clean(e){delete this.ids[e],delete this.cache[e]}getTiming(e){return"string"==typeof e?Timing[e]:e}getInterp(e,t,r){return e?e(t,r):"number"==typeof r?Interp.number(t,r):"string"==typeof r?"#"===r[0]?Interp.color(t,r):Interp.unit(t,r):Interp.object(t,r)}getArgs(e){const t=this.cache[e];return{path:e,startValue:t.startValue,targetValue:t.targetValue,cell:this.cell}}}Animation2=Animation||(Animation={}),Animation2.defaultOptions={delay:10,duration:100,timing:"linear"};var __decorate$r=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},__rest$e=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},Cell2,ShareRegistry;class Cell extends Basecoat{static config(e){const{markup:t,propHooks:r,attrHooks:n}=e,i=__rest$e(e,["markup","propHooks","attrHooks"]);null!=t&&(this.markup=t),r&&(this.propHooks=this.propHooks.slice(),Array.isArray(r)?this.propHooks.push(...r):"function"==typeof r?this.propHooks.push(r):Object.values(r).forEach(e=>{"function"==typeof e&&this.propHooks.push(e)})),n&&(this.attrHooks=Object.assign(Object.assign({},this.attrHooks),n)),this.defaults=merge$2({},this.defaults,i)}static getMarkup(){return this.markup}static getDefaults(e){return e?this.defaults:cloneDeep(this.defaults)}static getAttrHooks(){return this.attrHooks}static applyPropHooks(e,t){return this.propHooks.reduce((t,r)=>r?call$1(r,e,t):t,t)}get[Symbol.toStringTag](){return Cell.toStringTag}constructor(e={}){super();const t=this.constructor.getDefaults(!0),r=merge$2({},this.preprocess(t),this.preprocess(e));this.id=r.id||uuid(),this.store=new Store(r),this.animation=new Animation(this),this.setup(),this.init(),this.postprocess(e)}init(){}get model(){return this._model}set model(e){this._model!==e&&(this._model=e)}preprocess(e,t){const r=e.id,n=this.constructor.applyPropHooks(this,e);return null==r&&!0!==t&&(n.id=uuid()),n}postprocess(e){}setup(){this.store.on("change:*",e=>{const{key:t,current:r,previous:n,options:i}=e;this.notify("change:*",{key:t,options:i,current:r,previous:n,cell:this}),this.notify(`change:${t}`,{options:i,current:r,previous:n,cell:this});const o=t;"source"!==o&&"target"!==o||this.notify("change:terminal",{type:o,current:r,previous:n,options:i,cell:this})}),this.store.on("changed",({options:e})=>this.notify("changed",{options:e,cell:this}))}notify(e,t){this.trigger(e,t);const r=this.model;return r&&(r.notify(`cell:${e}`,t),this.isNode()?r.notify(`node:${e}`,Object.assign(Object.assign({},t),{node:this})):this.isEdge()&&r.notify(`edge:${e}`,Object.assign(Object.assign({},t),{edge:this}))),this}isNode(){return!1}isEdge(){return!1}isSameStore(e){return this.store===e.store}get view(){return this.store.get("view")}get shape(){return this.store.get("shape","")}getProp(e,t){return null==e?this.store.get():this.store.get(e,t)}setProp(e,t,r){if("string"==typeof e)this.store.set(e,t,r);else{const r=this.preprocess(e,!0);this.store.set(merge$2({},this.getProp(),r),t),this.postprocess(e)}return this}removeProp(e,t){return"string"==typeof e||Array.isArray(e)?this.store.removeByPath(e,t):this.store.remove(t),this}hasChanged(e){return null==e?this.store.hasChanged():this.store.hasChanged(e)}getPropByPath(e){return this.store.getByPath(e)}setPropByPath(e,t,r={}){return this.model&&("children"===e?this._children=t?t.map(e=>this.model.getCell(e)).filter(e=>null!=e):null:"parent"===e&&(this._parent=t?this.model.getCell(t):null)),this.store.setByPath(e,t,r),this}removePropByPath(e,t={}){const r=Array.isArray(e)?e:e.split("/");return"attrs"===r[0]&&(t.dirty=!0),this.store.removeByPath(r,t),this}prop(e,t,r){return null==e?this.getProp():"string"==typeof e||Array.isArray(e)?1===arguments.length?this.getPropByPath(e):null==t?this.removePropByPath(e,r||{}):this.setPropByPath(e,t,r||{}):this.setProp(e,t||{})}previous(e){return this.store.getPrevious(e)}get zIndex(){return this.getZIndex()}set zIndex(e){null==e?this.removeZIndex():this.setZIndex(e)}getZIndex(){return this.store.get("zIndex")}setZIndex(e,t={}){return this.store.set("zIndex",e,t),this}removeZIndex(e={}){return this.store.remove("zIndex",e),this}toFront(e={}){const t=this.model;if(t){let r,n=t.getMaxZIndex();e.deep?(r=this.getDescendants({deep:!0,breadthFirst:!0}),r.unshift(this)):r=[this],n=n-r.length+1;const i=t.total();let o=t.indexOf(this)!==i-r.length;o||(o=r.some((e,t)=>e.getZIndex()!==n+t)),o&&this.batchUpdate("to-front",()=>{n+=r.length,r.forEach((t,r)=>{t.setZIndex(n+r,e)})})}return this}toBack(e={}){const t=this.model;if(t){let r,n=t.getMinZIndex();e.deep?(r=this.getDescendants({deep:!0,breadthFirst:!0}),r.unshift(this)):r=[this];let i=0!==t.indexOf(this);i||(i=r.some((e,t)=>e.getZIndex()!==n+t)),i&&this.batchUpdate("to-back",()=>{n-=r.length,r.forEach((t,r)=>{t.setZIndex(n+r,e)})})}return this}get markup(){return this.getMarkup()}set markup(e){null==e?this.removeMarkup():this.setMarkup(e)}getMarkup(){let e=this.store.get("markup");if(null==e){e=this.constructor.getMarkup()}return e}setMarkup(e,t={}){return this.store.set("markup",e,t),this}removeMarkup(e={}){return this.store.remove("markup",e),this}get attrs(){return this.getAttrs()}set attrs(e){null==e?this.removeAttrs():this.setAttrs(e)}getAttrs(){const e=this.store.get("attrs");return e?Object.assign({},e):{}}setAttrs(e,t={}){if(null==e)this.removeAttrs(t);else{const r=e=>this.store.set("attrs",e,t);if(!0===t.overwrite)r(e);else{const n=this.getAttrs();!1===t.deep?r(Object.assign(Object.assign({},n),e)):r(merge$2({},n,e))}}return this}replaceAttrs(e,t={}){return this.setAttrs(e,Object.assign(Object.assign({},t),{overwrite:!0}))}updateAttrs(e,t={}){return this.setAttrs(e,Object.assign(Object.assign({},t),{deep:!1}))}removeAttrs(e={}){return this.store.remove("attrs",e),this}getAttrDefinition(e){if(!e)return null;const t=this.constructor.getAttrHooks()||{};let r=t[e]||Attr.registry.get(e);if(!r){const n=camelCase(e);r=t[n]||Attr.registry.get(n)}return r||null}getAttrByPath(e){return null==e||""===e?this.getAttrs():this.getPropByPath(this.prefixAttrPath(e))}setAttrByPath(e,t,r={}){return this.setPropByPath(this.prefixAttrPath(e),t,r),this}removeAttrByPath(e,t={}){return this.removePropByPath(this.prefixAttrPath(e),t),this}prefixAttrPath(e){return Array.isArray(e)?["attrs"].concat(e):`attrs/${e}`}attr(e,t,r){return null==e?this.getAttrByPath():"string"==typeof e||Array.isArray(e)?1===arguments.length?this.getAttrByPath(e):null==t?this.removeAttrByPath(e,r||{}):this.setAttrByPath(e,t,r||{}):this.setAttrs(e,t||{})}get visible(){return this.isVisible()}set visible(e){this.setVisible(e)}setVisible(e,t={}){return this.store.set("visible",e,t),this}isVisible(){return!1!==this.store.get("visible")}show(e={}){return this.isVisible()||this.setVisible(!0,e),this}hide(e={}){return this.isVisible()&&this.setVisible(!1,e),this}toggleVisible(e,t={}){const r="boolean"==typeof e?t:e;return("boolean"==typeof e?e:!this.isVisible())?this.show(r):this.hide(r),this}get data(){return this.getData()}set data(e){this.setData(e)}getData(){return this.store.get("data")}setData(e,t={}){if(null==e)this.removeData(t);else{const r=e=>this.store.set("data",e,t);if(!0===t.overwrite)r(e);else{const n=this.getData();!1===t.deep?r("object"==typeof e?Object.assign(Object.assign({},n),e):e):r(merge$2({},n,e))}}return this}replaceData(e,t={}){return this.setData(e,Object.assign(Object.assign({},t),{overwrite:!0}))}updateData(e,t={}){return this.setData(e,Object.assign(Object.assign({},t),{deep:!1}))}removeData(e={}){return this.store.remove("data",e),this}get parent(){return this.getParent()}get children(){return this.getChildren()}getParentId(){return this.store.get("parent")}getParent(){const e=this.getParentId();if(e&&this.model){const t=this.model.getCell(e);return this._parent=t,t}return null}getChildren(){const e=this.store.get("children");if(e&&e.length&&this.model){const t=e.map(e=>{var t;return null===(t=this.model)||void 0===t?void 0:t.getCell(e)}).filter(e=>null!=e);return this._children=t,[...t]}return null}hasParent(){return null!=this.parent}isParentOf(e){return null!=e&&e.getParent()===this}isChildOf(e){return null!=e&&this.getParent()===e}eachChild(e,t){return this.children&&this.children.forEach(e,t),this}filterChild(e,t){return this.children?this.children.filter(e,t):[]}getChildCount(){return null==this.children?0:this.children.length}getChildIndex(e){return null==this.children?-1:this.children.indexOf(e)}getChildAt(e){return null!=this.children&&e>=0?this.children[e]:null}getAncestors(e={}){const t=[];let r=this.getParent();for(;r;)t.push(r),r=!1!==e.deep?r.getParent():null;return t}getDescendants(e={}){if(!1!==e.deep){if(e.breadthFirst){const e=[],t=this.getChildren()||[];for(;t.length>0;){const r=t.shift(),n=r.getChildren();e.push(r),n&&t.push(...n)}return e}{const t=this.getChildren()||[];return t.forEach(r=>{t.push(...r.getDescendants(e))}),t}}return this.getChildren()||[]}isDescendantOf(e,t={}){if(null==e)return!1;if(!1!==t.deep){let t=this.getParent();for(;t;){if(t===e)return!0;t=t.getParent()}return!1}return this.isChildOf(e)}isAncestorOf(e,t={}){return null!=e&&e.isDescendantOf(this,t)}contains(e){return this.isAncestorOf(e)}getCommonAncestor(...e){return Cell.getCommonAncestor(this,...e)}setParent(e,t={}){return this._parent=e,e?this.store.set("parent",e.id,t):this.store.remove("parent",t),this}setChildren(e,t={}){return this._children=e,null!=e?this.store.set("children",e.map(e=>e.id),t):this.store.remove("children",t),this}unembed(e,t={}){const r=this.children;if(null!=r&&null!=e){const n=this.getChildIndex(e);-1!==n&&(r.splice(n,1),e.setParent(null,t),this.setChildren(r,t))}return this}embed(e,t={}){return e.addTo(this,t),this}addTo(e,t={}){return Cell.isCell(e)?e.addChild(this,t):e.addCell(this,t),this}insertTo(e,t,r={}){return e.insertChild(this,t,r),this}addChild(e,t={}){return this.insertChild(e,void 0,t)}insertChild(e,t,r={}){if(null!=e&&e!==this){const n=e.getParent(),i=this!==n;let o=t;if(null==o&&(o=this.getChildCount(),i||(o-=1)),n){const t=n.getChildren();if(t){const i=t.indexOf(e);i>=0&&(e.setParent(null,r),t.splice(i,1),n.setChildren(t,r))}}let a=this.children;if(null==a?(a=[],a.push(e)):a.splice(o,0,e),e.setParent(this,r),this.setChildren(a,r),i&&this.model){const e=this.model.getIncomingEdges(this),t=this.model.getOutgoingEdges(this);e&&e.forEach(e=>e.updateParent(r)),t&&t.forEach(e=>e.updateParent(r))}this.model&&this.model.addCell(e,r)}return this}removeFromParent(e={}){const t=this.getParent();if(null!=t){const r=t.getChildIndex(this);t.removeChildAt(r,e)}return this}removeChild(e,t={}){const r=this.getChildIndex(e);return this.removeChildAt(r,t)}removeChildAt(e,t={}){const r=this.getChildAt(e);return null!=this.children&&null!=r&&(this.unembed(r,t),r.remove(t)),r}remove(e={}){return this.batchUpdate("remove",()=>{const t=this.getParent();t&&t.removeChild(this,e),!1!==e.deep&&this.eachChild(t=>t.remove(e)),this.model&&this.model.removeCell(this,e)}),this}transition(e,t,r={},n="/"){return this.animation.start(e,t,r,n)}stopTransition(e,t,r="/"){return this.animation.stop(e,t,r),this}getTransitions(){return this.animation.get()}translate(e,t,r){return this}scale(e,t,r,n){return this}addTools(e,t,r){const n=Array.isArray(e)?e:[e],i="string"==typeof t?t:null,o="object"==typeof t?t:"object"==typeof r?r:{};if(o.reset)return this.setTools({name:i,items:n,local:o.local},o);let a=cloneDeep(this.getTools());return null==a||null==i||a.name===i?(null==a&&(a={}),a.items||(a.items=[]),a.name=i,a.items=[...a.items,...n],this.setTools(Object.assign({},a),o)):void 0}setTools(e,t={}){return null==e?this.removeTools():this.store.set("tools",Cell.normalizeTools(e),t),this}getTools(){return this.store.get("tools")}removeTools(e={}){return this.store.remove("tools",e),this}hasTools(e){const t=this.getTools();return null!=t&&(null==e||t.name===e)}hasTool(e){const t=this.getTools();return null!=t&&t.items.some(t=>"string"==typeof t?t===e:t.name===e)}removeTool(e,t={}){const r=cloneDeep(this.getTools());if(r){let n=!1;const i=r.items.slice(),o=e=>{i.splice(e,1),n=!0};if("number"==typeof e)o(e);else for(let t=i.length-1;t>=0;t-=1){const r=i[t];("string"==typeof r?r===e:r.name===e)&&o(t)}n&&(r.items=i,this.setTools(r,t))}return this}getBBox(e){return new Rectangle}getConnectionPoint(e,t){return new Point}toJSON(e={}){const t=Object.assign({},this.store.get()),r=Object.prototype.toString,n=this.isNode()?"node":this.isEdge()?"edge":"cell";if(!t.shape){const e=this.constructor;throw new Error(`Unable to serialize ${n} missing "shape" prop, check the ${n} "${e.name||r.call(e)}"`)}const i=this.constructor,o=!0===e.diff,a=t.attrs||{},s=i.getDefaults(!0),l=o?this.preprocess(s,!0):s,c=l.attrs||{},u={};Object.entries(t).forEach(([e,i])=>{if(null!=i&&!Array.isArray(i)&&"object"==typeof i&&!isPlainObject(i))throw new Error(`Can only serialize ${n} with plain-object props, but got a "${r.call(i)}" type of key "${e}" on ${n} "${this.id}"`);if("attrs"!==e&&"shape"!==e&&o){isEqual(i,l[e])&&delete t[e]}}),Object.keys(a).forEach(e=>{const t=a[e],r=c[e];Object.keys(t).forEach(n=>{const i=t[n],o=r?r[n]:null;null==i||"object"!=typeof i||Array.isArray(i)?null!=r&&isEqual(o,i)||(null==u[e]&&(u[e]={}),u[e][n]=i):Object.keys(i).forEach(t=>{const a=i[t];if(null==r||null==o||!isObject(o)||!isEqual(o[t],a)){null==u[e]&&(u[e]={}),null==u[e][n]&&(u[e][n]={});u[e][n][t]=a}})})});const d=Object.assign(Object.assign({},t),{attrs:isEmpty(u)?void 0:u});null==d.attrs&&delete d.attrs;const p=d;return 0===p.angle&&delete p.angle,cloneDeep(p)}clone(e={}){if(!e.deep){const t=Object.assign({},this.store.get());e.keepId||delete t.id,delete t.parent,delete t.children;return new(0,this.constructor)(t)}return Cell.deepClone(this)[this.id]}findView(e){return e.findViewByCell(this)}startBatch(e,t={},r=this.model){return this.notify("batch:start",{name:e,data:t,cell:this}),r&&r.startBatch(e,Object.assign(Object.assign({},t),{cell:this})),this}stopBatch(e,t={},r=this.model){return r&&r.stopBatch(e,Object.assign(Object.assign({},t),{cell:this})),this.notify("batch:stop",{name:e,data:t,cell:this}),this}batchUpdate(e,t,r){const n=this.model;this.startBatch(e,r,n);const i=t();return this.stopBatch(e,r,n),i}dispose(){this.removeFromParent(),this.store.dispose()}}Cell.defaults={},Cell.attrHooks={},Cell.propHooks=[],__decorate$r([Basecoat.dispose()],Cell.prototype,"dispose",null),Cell2=Cell||(Cell={}),Cell2.normalizeTools=function(e){return"string"==typeof e?{items:[e]}:Array.isArray(e)?{items:e}:e.items?e:{items:[e]}},function(e){e.toStringTag=`X6.${e.name}`,e.isCell=function(t){if(null==t)return!1;if(t instanceof e)return!0;const r=t[Symbol.toStringTag],n=t;return(null==r||r===e.toStringTag)&&"function"==typeof n.isNode&&"function"==typeof n.isEdge&&"function"==typeof n.prop&&"function"==typeof n.attr}}(Cell||(Cell={})),function(e){e.getCommonAncestor=function(...e){const t=e.filter(e=>null!=e).map(e=>e.getAncestors()).sort((e,t)=>e.length-t.length);return t.shift().find(e=>t.every(t=>t.includes(e)))||null},e.getCellsBBox=function(e,t={}){let r=null;for(let n=0,i=e.length;n<i;n+=1){const i=e[n];let o=i.getBBox(t);if(o){if(i.isNode()){const e=i.getAngle();null!=e&&0!==e&&(o=o.bbox(e))}r=null==r?o:r.union(o)}}return r},e.deepClone=function(t){const r=[t,...t.getDescendants({deep:!0})];return e.cloneCells(r)},e.cloneCells=function(e){const t=uniq(e),r=t.reduce((e,t)=>(e[t.id]=t.clone(),e),{});return t.forEach(e=>{const t=r[e.id];if(t.isEdge()){const e=t.getSourceCellId(),n=t.getTargetCellId();e&&r[e]&&t.setSource(Object.assign(Object.assign({},t.getSource()),{cell:r[e].id})),n&&r[n]&&t.setTarget(Object.assign(Object.assign({},t.getTarget()),{cell:r[n].id}))}const n=e.getParent();n&&r[n.id]&&t.setParent(r[n.id]);const i=e.getChildren();if(i&&i.length){const e=i.reduce((e,t)=>(r[t.id]&&e.push(r[t.id]),e),[]);e.length>0&&t.setChildren(e)}}),r}}(Cell||(Cell={})),function(e){e.config({propHooks(t){var{tools:r}=t,n=__rest$e(t,["tools"]);return r&&(n.tools=e.normalizeTools(r)),n}})}(Cell||(Cell={})),function(e){let t,r;e.exist=function(e,n){return n?null!=t&&t.exist(e):null!=r&&r.exist(e)},e.setEdgeRegistry=function(e){t=e},e.setNodeRegistry=function(e){r=e}}(ShareRegistry||(ShareRegistry={}));class PortManager{constructor(e){this.ports=[],this.groups={},this.init(cloneDeep(e))}getPorts(){return this.ports}getGroup(e){return null!=e?this.groups[e]:null}getPortsByGroup(e){return this.ports.filter(t=>t.group===e||null==t.group&&null==e)}getPortsLayoutByGroup(e,t){const r=this.getPortsByGroup(e),n=e?this.getGroup(e):null,i=n?n.position:null,o=i?i.name:null;let a;if(null!=o){const e=PortLayout.registry.get(o);if(null==e)return PortLayout.registry.onNotFound(o);a=e}else a=PortLayout.presets.left;const s=r.map(e=>e&&e.position&&e.position.args||{}),l=i&&i.args||{};return a(s,t,l).map((e,n)=>{const i=r[n];return{portLayout:e,portId:i.id,portSize:i.size,portAttrs:i.attrs,labelSize:i.label.size,labelLayout:this.getPortLabelLayout(i,Point.create(e.position),t)}})}init(e){const{groups:t,items:r}=e;null!=t&&Object.keys(t).forEach(e=>{this.groups[e]=this.parseGroup(t[e])}),Array.isArray(r)&&r.forEach(e=>{this.ports.push(this.parsePort(e))})}parseGroup(e){return Object.assign(Object.assign({},e),{label:this.getLabel(e,!0),position:this.getPortPosition(e.position,!0)})}parsePort(e){const t=Object.assign({},e),r=this.getGroup(e.group)||{};return t.markup=t.markup||r.markup,t.attrs=merge$2({},r.attrs,t.attrs),t.position=this.createPosition(r,t),t.label=merge$2({},r.label,this.getLabel(t)),t.zIndex=this.getZIndex(r,t),t.size=Object.assign(Object.assign({},r.size),t.size),t}getZIndex(e,t){return"number"==typeof t.zIndex?t.zIndex:"number"==typeof e.zIndex||"auto"===e.zIndex?e.zIndex:"auto"}createPosition(e,t){return merge$2({name:"left",args:{}},e.position,{args:t.args})}getPortPosition(e,t=!1){if(null==e){if(t)return{name:"left",args:{}}}else{if("string"==typeof e)return{name:e,args:{}};if(Array.isArray(e))return{name:"absolute",args:{x:e[0],y:e[1]}};if("object"==typeof e)return e}return{args:{}}}getPortLabelPosition(e,t=!1){if(null==e){if(t)return{name:"left",args:{}}}else{if("string"==typeof e)return{name:e,args:{}};if("object"==typeof e)return e}return{args:{}}}getLabel(e,t=!1){const r=e.label||{};return r.position=this.getPortLabelPosition(r.position,t),r}getPortLabelLayout(e,t,r){const n=e.label.position.name||"left",i=e.label.position.args||{},o=PortLabelLayout.registry.get(n)||PortLabelLayout.presets.left;return o?o(t,r,i):null}}var __rest$d=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};let Node$1=class e extends Cell{get[Symbol.toStringTag](){return e.toStringTag}constructor(e={}){super(e),this.initPorts()}preprocess(e,t){const{x:r,y:n,width:i,height:o}=e,a=__rest$d(e,["x","y","width","height"]);if(null!=r||null!=n){const e=a.position;a.position=Object.assign(Object.assign({},e),{x:null!=r?r:e?e.x:0,y:null!=n?n:e?e.y:0})}if(null!=i||null!=o){const e=a.size;a.size=Object.assign(Object.assign({},e),{width:null!=i?i:e?e.width:0,height:null!=o?o:e?e.height:0})}return super.preprocess(a,t)}isNode(){return!0}size(e,t,r){return void 0===e?this.getSize():"number"==typeof e?this.setSize(e,t,r):this.setSize(e,t)}getSize(){const e=this.store.get("size");return e?Object.assign({},e):{width:1,height:1}}setSize(e,t,r){return"object"==typeof e?this.resize(e.width,e.height,t):this.resize(e,t,r),this}resize(e,t,r={}){this.startBatch("resize",r);const n=r.direction;if(n){const i=this.getSize();switch(n){case"left":case"right":t=i.height;break;case"top":case"bottom":e=i.width}let o={right:0,"top-right":0,top:1,"top-left":1,left:2,"bottom-left":2,bottom:3,"bottom-right":3}[n];const a=Angle.normalize(this.getAngle()||0);r.absolute&&(o+=Math.floor((a+45)/90),o%=4);const s=this.getBBox();let l;l=0===o?s.getBottomLeft():1===o?s.getCorner():2===o?s.getTopRight():s.getOrigin();const c=l.clone().rotate(-a,s.getCenter()),u=Math.sqrt(e*e+t*t)/2;let d=o*Math.PI/2;d+=Math.atan(o%2==0?t/e:e/t),d-=Angle.toRad(a);const p=Point.fromPolar(u,d,c).clone().translate(e/-2,t/-2);this.store.set("size",{width:e,height:t},r),this.setPosition(p.x,p.y,r)}else this.store.set("size",{width:e,height:t},r);return this.stopBatch("resize",r),this}scale(e,t,r,n={}){const i=this.getBBox().scale(e,t,null==r?void 0:r);return this.startBatch("scale",n),this.setPosition(i.x,i.y,n),this.resize(i.width,i.height,n),this.stopBatch("scale"),this}position(e,t,r){return"number"==typeof e?this.setPosition(e,t,r):this.getPosition(e)}getPosition(e={}){if(e.relative){const e=this.getParent();if(null!=e&&e.isNode()){const t=this.getPosition(),r=e.getPosition();return{x:t.x-r.x,y:t.y-r.y}}}const t=this.store.get("position");return t?Object.assign({},t):{x:0,y:0}}setPosition(e,t,r={}){let n,i,o;if("object"==typeof e?(n=e.x,i=e.y,o=t||{}):(n=e,i=t,o=r||{}),o.relative){const e=this.getParent();if(null!=e&&e.isNode()){const t=e.getPosition();n+=t.x,i+=t.y}}if(o.deep){const e=this.getPosition();this.translate(n-e.x,i-e.y,o)}else this.store.set("position",{x:n,y:i},o);return this}translate(e=0,t=0,r={}){if(0===e&&0===t)return this;r.translateBy=r.translateBy||this.id;const n=this.getPosition();if(null!=r.restrict&&r.translateBy===this.id){const i=this.getBBox({deep:!0}),o=r.restrict,a=n.x-i.x,s=n.y-i.y,l=Math.max(o.x+a,Math.min(o.x+o.width+a-i.width,n.x+e)),c=Math.max(o.y+s,Math.min(o.y+o.height+s-i.height,n.y+t));e=l-n.x,t=c-n.y}const i={x:n.x+e,y:n.y+t};return r.tx=e,r.ty=t,r.transition?("object"!=typeof r.transition&&(r.transition={}),this.transition("position",i,Object.assign(Object.assign({},r.transition),{interp:Interp.object})),this.eachChild(n=>{var i;(null===(i=r.exclude)||void 0===i?void 0:i.includes(n))||n.translate(e,t,r)})):(this.startBatch("translate",r),this.store.set("position",i,r),this.eachChild(n=>{var i;(null===(i=r.exclude)||void 0===i?void 0:i.includes(n))||n.translate(e,t,r)}),this.stopBatch("translate",r)),this}angle(e,t){return null==e?this.getAngle():this.rotate(e,t)}getAngle(){return this.store.get("angle",0)}rotate(e,t={}){const r=this.getAngle();if(t.center){const n=this.getSize(),i=this.getPosition(),o=this.getBBox().getCenter();o.rotate(r-e,t.center);const a=o.x-n.width/2-i.x,s=o.y-n.height/2-i.y;this.startBatch("rotate",{angle:e,options:t}),this.setPosition(i.x+a,i.y+s,t),this.rotate(e,Object.assign(Object.assign({},t),{center:null})),this.stopBatch("rotate")}else this.store.set("angle",t.absolute?e:(r+e)%360,t);return this}getBBox(e={}){if(e.deep){const e=this.getDescendants({deep:!0,breadthFirst:!0});return e.push(this),Cell.getCellsBBox(e)}return Rectangle.fromPositionAndSize(this.getPosition(),this.getSize())}getConnectionPoint(e,t){const r=this.getBBox(),n=r.getCenter(),i=e.getTerminal(t);if(null==i)return n;const o=i.port;if(!o||!this.hasPort(o))return n;const a=this.getPort(o);if(!a||!a.group)return n;const s=this.getPortsPosition(a.group)[o].position,l=Point.create(s).translate(r.getOrigin()),c=this.getAngle();return c&&l.rotate(-c,n),l}fit(e={}){const t=(this.getChildren()||[]).filter(e=>e.isNode());if(0===t.length)return this;this.startBatch("fit-embeds",e),e.deep&&t.forEach(t=>t.fit(e));let{x:r,y:n,width:i,height:o}=Cell.getCellsBBox(t);const a=normalizeSides(e.padding);return r-=a.left,n-=a.top,i+=a.left+a.right,o+=a.bottom+a.top,this.store.set({position:{x:r,y:n},size:{width:i,height:o}},e),this.stopBatch("fit-embeds"),this}get portContainerMarkup(){return this.getPortContainerMarkup()}set portContainerMarkup(e){this.setPortContainerMarkup(e)}getDefaultPortContainerMarkup(){return this.store.get("defaultPortContainerMarkup")||Markup.getPortContainerMarkup()}getPortContainerMarkup(){return this.store.get("portContainerMarkup")||this.getDefaultPortContainerMarkup()}setPortContainerMarkup(e,t={}){return this.store.set("portContainerMarkup",Markup.clone(e),t),this}get portMarkup(){return this.getPortMarkup()}set portMarkup(e){this.setPortMarkup(e)}getDefaultPortMarkup(){return this.store.get("defaultPortMarkup")||Markup.getPortMarkup()}getPortMarkup(){return this.store.get("portMarkup")||this.getDefaultPortMarkup()}setPortMarkup(e,t={}){return this.store.set("portMarkup",Markup.clone(e),t),this}get portLabelMarkup(){return this.getPortLabelMarkup()}set portLabelMarkup(e){this.setPortLabelMarkup(e)}getDefaultPortLabelMarkup(){return this.store.get("defaultPortLabelMarkup")||Markup.getPortLabelMarkup()}getPortLabelMarkup(){return this.store.get("portLabelMarkup")||this.getDefaultPortLabelMarkup()}setPortLabelMarkup(e,t={}){return this.store.set("portLabelMarkup",Markup.clone(e),t),this}get ports(){const e=this.store.get("ports",{items:[]});return null==e.items&&(e.items=[]),e}getPorts(){return cloneDeep(this.ports.items)}getPortsByGroup(e){return this.getPorts().filter(t=>t.group===e)}getPort(e){return cloneDeep(this.ports.items.find(t=>t.id&&t.id===e))}getPortAt(e){return this.ports.items[e]||null}hasPorts(){return this.ports.items.length>0}hasPort(e){return-1!==this.getPortIndex(e)}getPortIndex(e){const t="string"==typeof e?e:e.id;return null!=t?this.ports.items.findIndex(e=>e.id===t):-1}getPortsPosition(e){const t=this.getSize();return this.port.getPortsLayoutByGroup(e,new Rectangle(0,0,t.width,t.height)).reduce((e,t)=>{const r=t.portLayout;return e[t.portId]={position:Object.assign({},r.position),angle:r.angle||0},e},{})}getPortProp(e,t){return this.getPropByPath(this.prefixPortPath(e,t))}setPortProp(e,t,r,n){if("string"==typeof t||Array.isArray(t)){const i=this.prefixPortPath(e,t),o=r;return this.setPropByPath(i,o,n)}const i=this.prefixPortPath(e),o=t;return this.setPropByPath(i,o,r)}removePortProp(e,t,r){return"string"==typeof t||Array.isArray(t)?this.removePropByPath(this.prefixPortPath(e,t),r):this.removePropByPath(this.prefixPortPath(e),t)}portProp(e,t,r,n){return null==t?this.getPortProp(e):"string"==typeof t||Array.isArray(t)?2===arguments.length?this.getPortProp(e,t):null==r?this.removePortProp(e,t,n):this.setPortProp(e,t,r,n):this.setPortProp(e,t,r)}prefixPortPath(e,t){const r=this.getPortIndex(e);if(-1===r)throw new Error(`Unable to find port with id: "${e}"`);return null==t||""===t?["ports","items",`${r}`]:Array.isArray(t)?["ports","items",`${r}`,...t]:`ports/items/${r}/${t}`}addPort(e,t){const r=[...this.ports.items];return r.push(e),this.setPropByPath("ports/items",r,t),this}addPorts(e,t){return this.setPropByPath("ports/items",[...this.ports.items,...e],t),this}insertPort(e,t,r){const n=[...this.ports.items];return n.splice(e,0,t),this.setPropByPath("ports/items",n,r),this}removePort(e,t={}){return this.removePortAt(this.getPortIndex(e),t)}removePortAt(e,t={}){if(e>=0){const r=[...this.ports.items];r.splice(e,1),t.rewrite=!0,this.setPropByPath("ports/items",r,t)}return this}removePorts(e,t){let r;if(Array.isArray(e)){if(r=t||{},e.length){r.rewrite=!0;const t=[...this.ports.items].filter(t=>!e.some(e=>{const r="string"==typeof e?e:e.id;return t.id===r}));this.setPropByPath("ports/items",t,r)}}else r=e||{},r.rewrite=!0,this.setPropByPath("ports/items",[],r);return this}getParsedPorts(){return this.port.getPorts()}getParsedGroups(){return this.port.groups}getPortsLayoutByGroup(e,t){return this.port.getPortsLayoutByGroup(e,t)}initPorts(){this.updatePortData(),this.on("change:ports",()=>{this.processRemovedPort(),this.updatePortData()})}processRemovedPort(){const e=this.ports,t={};e.items.forEach(e=>{e.id&&(t[e.id]=!0)});const r={};(this.store.getPrevious("ports")||{items:[]}).items.forEach(e=>{e.id&&!t[e.id]&&(r[e.id]=!0)});const n=this.model;if(n&&!isEmpty(r)){n.getConnectedEdges(this,{incoming:!0}).forEach(e=>{const t=e.getTargetPortId();t&&r[t]&&e.remove()});n.getConnectedEdges(this,{outgoing:!0}).forEach(e=>{const t=e.getSourcePortId();t&&r[t]&&e.remove()})}}validatePorts(){const e={},t=[];return this.ports.items.forEach(r=>{"object"!=typeof r&&t.push(`Invalid port ${r}.`),null==r.id&&(r.id=this.generatePortId()),e[r.id]&&t.push("Duplicitied port id."),e[r.id]=!0}),t}generatePortId(){return uuid()}updatePortData(){const e=this.validatePorts();if(e.length>0)throw this.store.set("ports",this.store.getPrevious("ports")),new Error(e.join(" "));const t=this.port?this.port.getPorts():null;this.port=new PortManager(this.ports);const r=this.port.getPorts(),n=t?r.filter(e=>t.find(t=>t.id===e.id)?null:e):[...r],i=t?t.filter(e=>r.find(t=>t.id===e.id)?null:e):[];n.length>0&&this.notify("ports:added",{added:n,cell:this,node:this}),i.length>0&&this.notify("ports:removed",{removed:i,cell:this,node:this})}};var Node2;Node$1.defaults={angle:0,position:{x:0,y:0},size:{width:1,height:1}},Node2=Node$1||(Node$1={}),Node2.toStringTag=`X6.${Node2.name}`,Node2.isNode=function(e){if(null==e)return!1;if(e instanceof Node2)return!0;const t=e[Symbol.toStringTag],r=e;return(null==t||t===Node2.toStringTag)&&"function"==typeof r.isNode&&"function"==typeof r.isEdge&&"function"==typeof r.prop&&"function"==typeof r.attr&&"function"==typeof r.size&&"function"==typeof r.position},function(e){e.config({propHooks(e){var{ports:t}=e,r=__rest$d(e,["ports"]);return t&&(r.ports=Array.isArray(t)?{items:t}:t),r}})}(Node$1||(Node$1={})),function(e){e.registry=Registry.create({type:"node",process(t,r){if(ShareRegistry.exist(t,!0))throw new Error(`Node with name '${t}' was registered by anthor Edge`);if("function"==typeof r)return r.config({shape:t}),r;let n=e;const{inherit:i}=r,o=__rest$d(r,["inherit"]);if(i)if("string"==typeof i){const e=this.get(i);null==e?this.onNotFound(i,"inherited"):n=e}else n=i;null==o.constructorName&&(o.constructorName=t);const a=n.define.call(n,o);return a.config({shape:t}),a}}),ShareRegistry.setNodeRegistry(e.registry)}(Node$1||(Node$1={})),function(e){let t=0;e.define=function(r){const{constructorName:n,overwrite:i}=r,o=__rest$d(r,["constructorName","overwrite"]),a=createClass((s=n||o.shape)?pascalCase(s):(t+=1,`CustomNode${t}`),this);var s;return a.config(o),o.shape&&e.registry.register(o.shape,a,i),a},e.create=function(t){const r=t.shape||"rect",n=e.registry.get(r);return n?new n(t):e.registry.onNotFound(r)}}(Node$1||(Node$1={}));var __rest$c=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};let Edge$1=class e extends Cell{get[Symbol.toStringTag](){return e.toStringTag}constructor(e={}){super(e)}preprocess(e,t){const{source:r,sourceCell:n,sourcePort:i,sourcePoint:o,target:a,targetCell:s,targetPort:l,targetPoint:c}=e,u=__rest$c(e,["source","sourceCell","sourcePort","sourcePoint","target","targetCell","targetPort","targetPoint"]),d=e=>"string"==typeof e||"number"==typeof e;if(null!=r)if(Cell.isCell(r))u.source={cell:r.id};else if(d(r))u.source={cell:r};else if(Point.isPoint(r))u.source=r.toJSON();else if(Array.isArray(r))u.source={x:r[0],y:r[1]};else{const e=r.cell;Cell.isCell(e)?u.source=Object.assign(Object.assign({},r),{cell:e.id}):u.source=r}if(null!=n||null!=i){let e=u.source;if(null!=n){const t=d(n)?n:n.id;e?e.cell=t:e=u.source={cell:t}}null!=i&&e&&(e.port=i)}else null!=o&&(u.source=Point.create(o).toJSON());if(null!=a)if(Cell.isCell(a))u.target={cell:a.id};else if(d(a))u.target={cell:a};else if(Point.isPoint(a))u.target=a.toJSON();else if(Array.isArray(a))u.target={x:a[0],y:a[1]};else{const e=a.cell;Cell.isCell(e)?u.target=Object.assign(Object.assign({},a),{cell:e.id}):u.target=a}if(null!=s||null!=l){let e=u.target;if(null!=s){const t=d(s)?s:s.id;e?e.cell=t:e=u.target={cell:t}}null!=l&&e&&(e.port=l)}else null!=c&&(u.target=Point.create(c).toJSON());return super.preprocess(u,t)}setup(){super.setup(),this.on("change:labels",e=>this.onLabelsChanged(e)),this.on("change:vertices",e=>this.onVertexsChanged(e))}isEdge(){return!0}disconnect(e={}){return this.store.set({source:{x:0,y:0},target:{x:0,y:0}},e),this}get source(){return this.getSource()}set source(e){this.setSource(e)}getSource(){return this.getTerminal("source")}getSourceCellId(){return this.source.cell}getSourcePortId(){return this.source.port}setSource(e,t,r={}){return this.setTerminal("source",e,t,r)}get target(){return this.getTarget()}set target(e){this.setTarget(e)}getTarget(){return this.getTerminal("target")}getTargetCellId(){return this.target.cell}getTargetPortId(){return this.target.port}setTarget(e,t,r={}){return this.setTerminal("target",e,t,r)}getTerminal(e){return Object.assign({},this.store.get(e))}setTerminal(e,t,r,n={}){if(Cell.isCell(t))return this.store.set(e,merge$2({},r,{cell:t.id}),n),this;const i=t;return Point.isPoint(t)||null!=i.x&&null!=i.y?(this.store.set(e,merge$2({},r,{x:i.x,y:i.y}),n),this):(this.store.set(e,cloneDeep(t),n),this)}getSourcePoint(){return this.getTerminalPoint("source")}getTargetPoint(){return this.getTerminalPoint("target")}getTerminalPoint(e){const t=this[e];if(Point.isPointLike(t))return Point.create(t);const r=this.getTerminalCell(e);return r?r.getConnectionPoint(this,e):new Point}getSourceCell(){return this.getTerminalCell("source")}getTargetCell(){return this.getTerminalCell("target")}getTerminalCell(e){if(this.model){const t="source"===e?this.getSourceCellId():this.getTargetCellId();if(t)return this.model.getCell(t)}return null}getSourceNode(){return this.getTerminalNode("source")}getTargetNode(){return this.getTerminalNode("target")}getTerminalNode(e){let t=this;const r={};for(;t&&t.isEdge();){if(r[t.id])return null;r[t.id]=!0,t=t.getTerminalCell(e)}return t&&t.isNode()?t:null}get router(){return this.getRouter()}set router(e){null==e?this.removeRouter():this.setRouter(e)}getRouter(){return this.store.get("router")}setRouter(e,t,r){return"object"==typeof e?this.store.set("router",e,t):this.store.set("router",{name:e,args:t},r),this}removeRouter(e={}){return this.store.remove("router",e),this}get connector(){return this.getConnector()}set connector(e){null==e?this.removeConnector():this.setConnector(e)}getConnector(){return this.store.get("connector")}setConnector(e,t,r){return"object"==typeof e?this.store.set("connector",e,t):this.store.set("connector",{name:e,args:t},r),this}removeConnector(e={}){return this.store.remove("connector",e)}getDefaultLabel(){const e=this.constructor;return cloneDeep(this.store.get("defaultLabel")||e.defaultLabel||{})}get labels(){return this.getLabels()}set labels(e){this.setLabels(e)}getLabels(){return[...this.store.get("labels",[])].map(e=>this.parseLabel(e))}setLabels(e,t={}){return this.store.set("labels",Array.isArray(e)?e:[e],t),this}insertLabel(e,t,r={}){const n=this.getLabels(),i=n.length;let o=null!=t&&Number.isFinite(t)?t:i;return o<0&&(o=i+o+1),n.splice(o,0,this.parseLabel(e)),this.setLabels(n,r)}appendLabel(e,t={}){return this.insertLabel(e,-1,t)}getLabelAt(e){const t=this.getLabels();return null!=e&&Number.isFinite(e)?this.parseLabel(t[e]):null}setLabelAt(e,t,r={}){if(null!=e&&Number.isFinite(e)){const n=this.getLabels();n[e]=this.parseLabel(t),this.setLabels(n,r)}return this}removeLabelAt(e,t={}){const r=this.getLabels(),n=null!=e&&Number.isFinite(e)?e:-1,i=r.splice(n,1);return this.setLabels(r,t),i.length?i[0]:null}parseLabel(e){if("string"==typeof e){return this.constructor.parseStringLabel(e)}return e}onLabelsChanged({previous:e,current:t}){const r=e&&t?t.filter(t=>e.find(e=>t===e||isEqual(t,e))?null:t):t?[...t]:[],n=e&&t?e.filter(e=>t.find(t=>e===t||isEqual(e,t))?null:e):e?[...e]:[];r.length>0&&this.notify("labels:added",{added:r,cell:this,edge:this}),n.length>0&&this.notify("labels:removed",{removed:n,cell:this,edge:this})}get vertices(){return this.getVertices()}set vertices(e){this.setVertices(e)}getVertices(){return[...this.store.get("vertices",[])]}setVertices(e,t={}){const r=Array.isArray(e)?e:[e];return this.store.set("vertices",r.map(e=>Point.toJSON(e)),t),this}insertVertex(e,t,r={}){const n=this.getVertices(),i=n.length;let o=null!=t&&Number.isFinite(t)?t:i;return o<0&&(o=i+o+1),n.splice(o,0,Point.toJSON(e)),this.setVertices(n,r)}appendVertex(e,t={}){return this.insertVertex(e,-1,t)}getVertexAt(e){if(null!=e&&Number.isFinite(e)){return this.getVertices()[e]}return null}setVertexAt(e,t,r={}){if(null!=e&&Number.isFinite(e)){const n=this.getVertices();n[e]=t,this.setVertices(n,r)}return this}removeVertexAt(e,t={}){const r=this.getVertices(),n=null!=e&&Number.isFinite(e)?e:-1;return r.splice(n,1),this.setVertices(r,t)}onVertexsChanged({previous:e,current:t}){const r=e&&t?t.filter(t=>e.find(e=>Point.equals(t,e))?null:t):t?[...t]:[],n=e&&t?e.filter(e=>t.find(t=>Point.equals(e,t))?null:e):e?[...e]:[];r.length>0&&this.notify("vertexs:added",{added:r,cell:this,edge:this}),n.length>0&&this.notify("vertexs:removed",{removed:n,cell:this,edge:this})}getDefaultMarkup(){return this.store.get("defaultMarkup")||Markup.getEdgeMarkup()}getMarkup(){return super.getMarkup()||this.getDefaultMarkup()}translate(e,t,r={}){return r.translateBy=r.translateBy||this.id,r.tx=e,r.ty=t,this.applyToPoints(r=>({x:(r.x||0)+e,y:(r.y||0)+t}),r)}scale(e,t,r,n={}){return this.applyToPoints(n=>Point.create(n).scale(e,t,r).toJSON(),n)}applyToPoints(e,t={}){const r={},n=this.getSource(),i=this.getTarget();Point.isPointLike(n)&&(r.source=e(n)),Point.isPointLike(i)&&(r.target=e(i));const o=this.getVertices();return o.length>0&&(r.vertices=o.map(e)),this.store.set(r,t),this}getBBox(){return this.getPolyline().bbox()}getConnectionPoint(){return this.getPolyline().pointAt(.5)}getPolyline(){const e=[this.getSourcePoint(),...this.getVertices().map(e=>Point.create(e)),this.getTargetPoint()];return new Polyline(e)}updateParent(e){let t=null;const r=this.getSourceCell(),n=this.getTargetCell(),i=this.getParent();return r&&n&&(t=r===n||r.isDescendantOf(n)?n:n.isDescendantOf(r)?r:Cell.getCommonAncestor(r,n)),i&&t&&t.id!==i.id&&i.unembed(this,e),!t||i&&i.id===t.id||t.embed(this,e),t}hasLoop(e={}){const t=this.getSource(),r=this.getTarget(),n=t.cell,i=r.cell;if(!n||!i)return!1;let o=n===i;if(!o&&e.deep&&this._model){const t=this.getSourceCell(),r=this.getTargetCell();t&&r&&(o=t.isAncestorOf(r,e)||r.isAncestorOf(t,e))}return o}getFragmentAncestor(){const e=[this,this.getSourceNode(),this.getTargetNode()].filter(e=>null!=e);return this.getCommonAncestor(...e)}isFragmentDescendantOf(e){const t=this.getFragmentAncestor();return!!t&&(t.id===e.id||t.isDescendantOf(e))}};var Edge2;Edge$1.defaults={},Edge2=Edge$1||(Edge$1={}),Edge2.equalTerminals=function(e,t){const r=e,n=t;return r.cell===n.cell&&(r.port===n.port||null==r.port&&null==n.port)},function(e){e.defaultLabel={markup:[{tagName:"rect",selector:"body"},{tagName:"text",selector:"label"}],attrs:{text:{fill:"#000",fontSize:14,textAnchor:"middle",textVerticalAnchor:"middle",pointerEvents:"none"},rect:{ref:"label",fill:"#fff",rx:3,ry:3,refWidth:1,refHeight:1,refX:0,refY:0}},position:{distance:.5}},e.parseStringLabel=function(e){return{attrs:{label:{text:e}}}}}(Edge$1||(Edge$1={})),function(e){e.toStringTag=`X6.${e.name}`,e.isEdge=function(t){if(null==t)return!1;if(t instanceof e)return!0;const r=t[Symbol.toStringTag],n=t;return(null==r||r===e.toStringTag)&&"function"==typeof n.isNode&&"function"==typeof n.isEdge&&"function"==typeof n.prop&&"function"==typeof n.attr&&"function"==typeof n.disconnect&&"function"==typeof n.getSource&&"function"==typeof n.getTarget}}(Edge$1||(Edge$1={})),function(e){e.registry=Registry.create({type:"edge",process(t,r){if(ShareRegistry.exist(t,!1))throw new Error(`Edge with name '${t}' was registered by anthor Node`);if("function"==typeof r)return r.config({shape:t}),r;let n=e;const{inherit:i="edge"}=r,o=__rest$c(r,["inherit"]);if("string"==typeof i){const e=this.get(i||"edge");null==e&&i?this.onNotFound(i,"inherited"):n=e}else n=i;null==o.constructorName&&(o.constructorName=t);const a=n.define.call(n,o);return a.config({shape:t}),a}}),ShareRegistry.setEdgeRegistry(e.registry)}(Edge$1||(Edge$1={})),function(e){let t=0;e.define=function(r){const{constructorName:n,overwrite:i}=r,o=__rest$c(r,["constructorName","overwrite"]),a=createClass((s=n||o.shape)?pascalCase(s):(t+=1,`CustomEdge${t}`),this);var s;return a.config(o),o.shape&&e.registry.register(o.shape,a,i),a},e.create=function(t){const r=t.shape||"edge",n=e.registry.get(r);return n?new n(t):e.registry.onNotFound(r)}}(Edge$1||(Edge$1={})),function(e){const t="basic.edge";e.config({shape:t,propHooks(t){const{label:r,vertices:n}=t,i=__rest$c(t,["label","vertices"]);if(r){null==i.labels&&(i.labels=[]);const t="string"==typeof r?e.parseStringLabel(r):r;i.labels.push(t)}return n&&Array.isArray(n)&&(i.vertices=n.map(e=>Point.create(e).toJSON())),i}}),e.registry.register(t,e)}(Edge$1||(Edge$1={}));var __decorate$q=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class Collection extends Basecoat{constructor(e,t={}){super(),this.length=0,this.comparator=t.comparator||"zIndex",this.clean(),e&&this.reset(e,{silent:!0})}toJSON(){return this.cells.map(e=>e.toJSON())}add(e,t,r){let n,i;"number"==typeof t?(n=t,i=Object.assign({merge:!1},r)):(n=this.length,i=Object.assign({merge:!1},t)),n>this.length&&(n=this.length),n<0&&(n+=this.length+1);const o=Array.isArray(e)?e:[e],a=this.comparator&&"number"!=typeof t&&!1!==i.sort,s=this.comparator||null;let l=!1;const c=[],u=[];return o.forEach(e=>{const t=this.get(e);t?i.merge&&!e.isSameStore(t)&&(t.setProp(e.getProp(),r),u.push(t),a&&!l&&(l=null==s||"function"==typeof s?t.hasChanged():"string"==typeof s?t.hasChanged(s):s.some(e=>t.hasChanged(e)))):(c.push(e),this.reference(e))}),c.length&&(a&&(l=!0),this.cells.splice(n,0,...c),this.length=this.cells.length),l&&this.sort({silent:!0}),i.silent||(c.forEach((e,t)=>{const r={cell:e,index:n+t,options:i};this.trigger("added",r),i.dryrun||e.notify("added",Object.assign({},r))}),l&&this.trigger("sorted"),(c.length||u.length)&&this.trigger("updated",{added:c,merged:u,removed:[],options:i})),this}remove(e,t={}){const r=Array.isArray(e)?e:[e],n=this.removeCells(r,t);return!t.silent&&n.length>0&&this.trigger("updated",{options:t,removed:n,added:[],merged:[]}),Array.isArray(e)?n:n[0]}removeCells(e,t){const r=[];for(let n=0;n<e.length;n+=1){const i=this.get(e[n]);if(null==i)continue;const o=this.cells.indexOf(i);this.cells.splice(o,1),this.length-=1,delete this.map[i.id],r.push(i),this.unreference(i),t.dryrun||i.remove(),t.silent||(this.trigger("removed",{cell:i,index:o,options:t}),t.dryrun||i.notify("removed",{cell:i,index:o,options:t}))}return r}reset(e,t={}){const r=this.cells.slice();if(r.forEach(e=>this.unreference(e)),this.clean(),this.add(e,Object.assign({silent:!0},t)),!t.silent){const e=this.cells.slice();this.trigger("reseted",{options:t,previous:r,current:e});const n=[],i=[];e.forEach(e=>{r.some(t=>t.id===e.id)||n.push(e)}),r.forEach(t=>{e.some(e=>e.id===t.id)||i.push(t)}),this.trigger("updated",{options:t,added:n,removed:i,merged:[]})}return this}push(e,t){return this.add(e,this.length,t)}pop(e){const t=this.at(this.length-1);return this.remove(t,e)}unshift(e,t){return this.add(e,0,t)}shift(e){const t=this.at(0);return this.remove(t,e)}get(e){if(null==e)return null;const t="string"==typeof e||"number"==typeof e?e:e.id;return this.map[t]||null}has(e){return null!=this.get(e)}at(e){return e<0&&(e+=this.length),this.cells[e]||null}first(){return this.at(0)}last(){return this.at(-1)}indexOf(e){return this.cells.indexOf(e)}toArray(){return this.cells.slice()}sort(e={}){return null!=this.comparator&&(this.cells=sortBy(this.cells,this.comparator),e.silent||this.trigger("sorted")),this}clone(){return new(0,this.constructor)(this.cells.slice(),{comparator:this.comparator})}reference(e){this.map[e.id]=e,e.on("*",this.notifyCellEvent,this)}unreference(e){e.off("*",this.notifyCellEvent,this),delete this.map[e.id]}notifyCellEvent(e,t){const r=t.cell;this.trigger(`cell:${e}`,t),r&&(r.isNode()?this.trigger(`node:${e}`,Object.assign(Object.assign({},t),{node:r})):r.isEdge()&&this.trigger(`edge:${e}`,Object.assign(Object.assign({},t),{edge:r})))}clean(){this.length=0,this.cells=[],this.map={}}dispose(){this.reset([])}}__decorate$q([Collection.dispose()],Collection.prototype,"dispose",null);var __decorate$p=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Model2;class Model extends Basecoat{get[Symbol.toStringTag](){return Model.toStringTag}constructor(e=[]){super(),this.batches={},this.addings=new WeakMap,this.nodes={},this.edges={},this.outgoings={},this.incomings={},this.collection=new Collection(e),this.setup()}notify(e,t){this.trigger(e,t);const r=this.graph;return r&&("sorted"===e||"reseted"===e||"updated"===e?r.trigger(`model:${e}`,t):r.trigger(e,t)),this}setup(){const e=this.collection;e.on("sorted",()=>this.notify("sorted",null)),e.on("updated",e=>this.notify("updated",e)),e.on("cell:change:zIndex",()=>this.sortOnChangeZ()),e.on("added",({cell:e})=>{this.onCellAdded(e)}),e.on("removed",e=>{const t=e.cell;this.onCellRemoved(t,e.options),this.notify("cell:removed",e),t.isNode()?this.notify("node:removed",Object.assign(Object.assign({},e),{node:t})):t.isEdge()&&this.notify("edge:removed",Object.assign(Object.assign({},e),{edge:t}))}),e.on("reseted",e=>{this.onReset(e.current),this.notify("reseted",e)}),e.on("edge:change:source",({edge:e})=>this.onEdgeTerminalChanged(e,"source")),e.on("edge:change:target",({edge:e})=>{this.onEdgeTerminalChanged(e,"target")})}sortOnChangeZ(){this.collection.sort()}onCellAdded(e){const t=e.id;e.isEdge()?(e.updateParent(),this.edges[t]=!0,this.onEdgeTerminalChanged(e,"source"),this.onEdgeTerminalChanged(e,"target")):this.nodes[t]=!0}onCellRemoved(e,t){const r=e.id;if(e.isEdge()){delete this.edges[r];const t=e.getSource(),n=e.getTarget();if(t&&t.cell){const e=this.outgoings[t.cell],n=e?e.indexOf(r):-1;n>=0&&(e.splice(n,1),0===e.length&&delete this.outgoings[t.cell])}if(n&&n.cell){const e=this.incomings[n.cell],t=e?e.indexOf(r):-1;t>=0&&(e.splice(t,1),0===e.length&&delete this.incomings[n.cell])}}else delete this.nodes[r];t.clear||(t.disconnectEdges?this.disconnectConnectedEdges(e,t):this.removeConnectedEdges(e,t)),e.model===this&&(e.model=null)}onReset(e){this.nodes={},this.edges={},this.outgoings={},this.incomings={},e.forEach(e=>this.onCellAdded(e))}onEdgeTerminalChanged(e,t){const r="source"===t?this.outgoings:this.incomings,n=e.previous(t);if(n&&n.cell){const t=Cell.isCell(n.cell)?n.cell.id:n.cell,i=r[t],o=i?i.indexOf(e.id):-1;o>=0&&(i.splice(o,1),0===i.length&&delete r[t])}const i=e.getTerminal(t);if(i&&i.cell){const t=Cell.isCell(i.cell)?i.cell.id:i.cell,n=r[t]||[];-1===n.indexOf(e.id)&&n.push(e.id),r[t]=n}}prepareCell(e,t){return e.model||t&&t.dryrun||(e.model=this),null==e.zIndex&&e.setZIndex(this.getMaxZIndex()+1,{silent:!0}),e}resetCells(e,t={}){return e.map(e=>this.prepareCell(e,Object.assign(Object.assign({},t),{dryrun:!0}))),this.collection.reset(e,t),e.map(e=>this.prepareCell(e,{options:t})),this}clear(e={}){const t=this.getCells();if(0===t.length)return this;const r=Object.assign(Object.assign({},e),{clear:!0});return this.batchUpdate("clear",()=>{const e=t.sort((e,t)=>(e.isEdge()?1:2)-(t.isEdge()?1:2));for(;e.length>0;){const t=e.shift();t&&t.remove(r)}},r),this}addNode(e,t={}){const r=Node$1.isNode(e)?e:this.createNode(e);return this.addCell(r,t),r}updateNode(e,t={}){const r=this.createNode(e),n=r.getProp();return r.dispose(),this.updateCell(n,t)}createNode(e){return Node$1.create(e)}addEdge(e,t={}){const r=Edge$1.isEdge(e)?e:this.createEdge(e);return this.addCell(r,t),r}createEdge(e){return Edge$1.create(e)}updateEdge(e,t={}){const r=this.createEdge(e),n=r.getProp();return r.dispose(),this.updateCell(n,t)}addCell(e,t={}){return Array.isArray(e)?this.addCells(e,t):(this.collection.has(e)||this.addings.has(e)||(this.addings.set(e,!0),this.collection.add(this.prepareCell(e,t),t),e.eachChild(e=>this.addCell(e,t)),this.addings.delete(e)),this)}addCells(e,t={}){const r=e.length;if(0===r)return this;const n=Object.assign(Object.assign({},t),{position:r-1,maxPosition:r-1});return this.startBatch("add",Object.assign(Object.assign({},n),{cells:e})),e.forEach(e=>{this.addCell(e,n),n.position-=1}),this.stopBatch("add",Object.assign(Object.assign({},n),{cells:e})),this}updateCell(e,t={}){const r=e.id&&this.getCell(e.id);return!!r&&this.batchUpdate("update",()=>(Object.entries(e).forEach(([e,n])=>r.setProp(e,n,t)),!0),e)}removeCell(e,t={}){const r="string"==typeof e?this.getCell(e):e;return r&&this.has(r)?this.collection.remove(r,t):null}updateCellId(e,t){if(e.id===t)return;this.startBatch("update",{id:t}),e.prop("id",t);const r=e.clone({keepId:!0});this.addCell(r);return this.getConnectedEdges(e).forEach(r=>{const n=r.getSourceCell(),i=r.getTargetCell();n===e&&r.setSource(Object.assign(Object.assign({},r.getSource()),{cell:t})),i===e&&r.setTarget(Object.assign(Object.assign({},r.getTarget()),{cell:t}))}),this.removeCell(e),this.stopBatch("update",{id:t}),r}removeCells(e,t={}){return e.length?this.batchUpdate("remove",()=>e.map(e=>this.removeCell(e,t))):[]}removeConnectedEdges(e,t={}){const r=this.getConnectedEdges(e);return r.forEach(e=>{e.remove(t)}),r}disconnectConnectedEdges(e,t={}){const r="string"==typeof e?e:e.id;this.getConnectedEdges(e).forEach(e=>{const n=e.getSourceCellId(),i=e.getTargetCellId();n===r&&e.setSource({x:0,y:0},t),i===r&&e.setTarget({x:0,y:0},t)})}has(e){return this.collection.has(e)}total(){return this.collection.length}indexOf(e){return this.collection.indexOf(e)}getCell(e){return this.collection.get(e)}getCells(){return this.collection.toArray()}getFirstCell(){return this.collection.first()}getLastCell(){return this.collection.last()}getMinZIndex(){const e=this.collection.first();return e&&e.getZIndex()||0}getMaxZIndex(){const e=this.collection.last();return e&&e.getZIndex()||0}getCellsFromCache(e){return e?Object.keys(e).map(e=>this.getCell(e)).filter(e=>null!=e):[]}getNodes(){return this.getCellsFromCache(this.nodes)}getEdges(){return this.getCellsFromCache(this.edges)}getOutgoingEdges(e){const t="string"==typeof e?e:e.id,r=this.outgoings[t];return r?r.map(e=>this.getCell(e)).filter(e=>e&&e.isEdge()):null}getIncomingEdges(e){const t="string"==typeof e?e:e.id,r=this.incomings[t];return r?r.map(e=>this.getCell(e)).filter(e=>e&&e.isEdge()):null}getConnectedEdges(e,t={}){const r=[],n="string"==typeof e?this.getCell(e):e;if(null==n)return r;const i={},o=t.indirect;let a=t.incoming,s=t.outgoing;null==a&&null==s&&(a=s=!0);const l=(e,t)=>{const n=t?this.getOutgoingEdges(e):this.getIncomingEdges(e);if(null!=n&&n.forEach(e=>{i[e.id]||(r.push(e),i[e.id]=!0,o&&(a&&l(e,!1),s&&l(e,!0)))}),o&&e.isEdge()){const n=t?e.getTargetCell():e.getSourceCell();n&&n.isEdge()&&(i[n.id]||(r.push(n),l(n,t)))}};if(s&&l(n,!0),a&&l(n,!1),t.deep){const e=n.getDescendants({deep:!0}),o={};e.forEach(e=>{e.isNode()&&(o[e.id]=!0)});const l=(e,n)=>{const a=n?this.getOutgoingEdges(e.id):this.getIncomingEdges(e.id);null!=a&&a.forEach(e=>{if(!i[e.id]){const n=e.getSourceCell(),a=e.getTargetCell();if(!t.enclosed&&n&&o[n.id]&&a&&o[a.id])return;r.push(e),i[e.id]=!0}})};e.forEach(e=>{e.isEdge()||(s&&l(e,!0),a&&l(e,!1))})}return r}isBoundary(e,t){const r="string"==typeof e?this.getCell(e):e,n=t?this.getIncomingEdges(r):this.getOutgoingEdges(r);return null==n||0===n.length}getBoundaryNodes(e){const t=[];return Object.keys(this.nodes).forEach(r=>{if(this.isBoundary(r,e)){const e=this.getCell(r);e&&t.push(e)}}),t}getRoots(){return this.getBoundaryNodes(!0)}getLeafs(){return this.getBoundaryNodes(!1)}isRoot(e){return this.isBoundary(e,!0)}isLeaf(e){return this.isBoundary(e,!1)}getNeighbors(e,t={}){let r=t.incoming,n=t.outgoing;null==r&&null==n&&(r=n=!0);const i=this.getConnectedEdges(e,t).reduce((i,o)=>{const a=o.hasLoop(t),s=o.getSourceCell(),l=o.getTargetCell();return r&&s&&s.isNode()&&!i[s.id]&&(!a&&(s===e||t.deep&&s.isDescendantOf(e))||(i[s.id]=s)),n&&l&&l.isNode()&&!i[l.id]&&(!a&&(l===e||t.deep&&l.isDescendantOf(e))||(i[l.id]=l)),i},{});if(e.isEdge()){if(r){const t=e.getSourceCell();t&&t.isNode()&&!i[t.id]&&(i[t.id]=t)}if(n){const t=e.getTargetCell();t&&t.isNode()&&!i[t.id]&&(i[t.id]=t)}}return Object.keys(i).map(e=>i[e])}isNeighbor(e,t,r={}){let n=r.incoming,i=r.outgoing;return null==n&&null==i&&(n=i=!0),this.getConnectedEdges(e,r).some(e=>{const r=e.getSourceCell(),o=e.getTargetCell();return!(!n||!r||r.id!==t.id)||!(!i||!o||o.id!==t.id)})}getSuccessors(e,t={}){const r=[];return this.search(e,(n,i)=>{n!==e&&this.matchDistance(i,t.distance)&&r.push(n)},Object.assign(Object.assign({},t),{outgoing:!0})),r}isSuccessor(e,t,r={}){let n=!1;return this.search(e,(i,o)=>{if(i===t&&i!==e&&this.matchDistance(o,r.distance))return n=!0,!1},Object.assign(Object.assign({},r),{outgoing:!0})),n}getPredecessors(e,t={}){const r=[];return this.search(e,(n,i)=>{n!==e&&this.matchDistance(i,t.distance)&&r.push(n)},Object.assign(Object.assign({},t),{incoming:!0})),r}isPredecessor(e,t,r={}){let n=!1;return this.search(e,(i,o)=>{if(i===t&&i!==e&&this.matchDistance(o,r.distance))return n=!0,!1},Object.assign(Object.assign({},r),{incoming:!0})),n}matchDistance(e,t){return null==t||("function"==typeof t?t(e):!(!Array.isArray(t)||!t.includes(e))||e===t)}getCommonAncestor(...e){const t=[];return e.forEach(e=>{e&&(Array.isArray(e)?t.push(...e):t.push(e))}),Cell.getCommonAncestor(...t)}getSubGraph(e,t={}){const r=[],n={},i=[],o=[],a=e=>{n[e.id]||(r.push(e),n[e.id]=e,e.isEdge()&&o.push(e),e.isNode()&&i.push(e))};return e.forEach(e=>{if(a(e),t.deep){e.getDescendants({deep:!0}).forEach(e=>a(e))}}),o.forEach(e=>{const t=e.getSourceCell(),o=e.getTargetCell();t&&!n[t.id]&&(r.push(t),n[t.id]=t,t.isNode()&&i.push(t)),o&&!n[o.id]&&(r.push(o),n[o.id]=o,o.isNode()&&i.push(o))}),i.forEach(e=>{this.getConnectedEdges(e,t).forEach(e=>{const t=e.getSourceCell(),i=e.getTargetCell();!n[e.id]&&t&&n[t.id]&&i&&n[i.id]&&(r.push(e),n[e.id]=e)})}),r}cloneSubGraph(e,t={}){const r=this.getSubGraph(e,t);return this.cloneCells(r)}cloneCells(e){return Cell.cloneCells(e)}getNodesFromPoint(e,t){const r="number"==typeof e?{x:e,y:t||0}:e;return this.getNodes().filter(e=>e.getBBox().containsPoint(r))}getNodesInArea(e,t,r,n,i){const o="number"==typeof e?new Rectangle(e,t,r,n):Rectangle.create(e),a="number"==typeof e?i:t,s=a&&a.strict;return this.getNodes().filter(e=>{const t=e.getBBox();return s?o.containsRect(t):o.isIntersectWithRect(t)})}getEdgesInArea(e,t,r,n,i){const o="number"==typeof e?new Rectangle(e,t,r,n):Rectangle.create(e),a="number"==typeof e?i:t,s=a&&a.strict;return this.getEdges().filter(e=>{const t=e.getBBox();return 0===t.width?t.inflate(1,0):0===t.height&&t.inflate(0,1),s?o.containsRect(t):o.isIntersectWithRect(t)})}getNodesUnderNode(e,t={}){const r=e.getBBox();return(null==t.by||"bbox"===t.by?this.getNodesInArea(r):this.getNodesFromPoint(r[t.by])).filter(t=>e.id!==t.id&&!t.isDescendantOf(e))}getAllCellsBBox(){return this.getCellsBBox(this.getCells())}getCellsBBox(e,t={}){return Cell.getCellsBBox(e,t)}search(e,t,r={}){r.breadthFirst?this.breadthFirstSearch(e,t,r):this.depthFirstSearch(e,t,r)}breadthFirstSearch(e,t,r={}){const n=[],i={},o={};for(n.push(e),o[e.id]=0;n.length>0;){const e=n.shift();if(null==e||i[e.id])continue;if(i[e.id]=!0,!1===call$1(t,this,e,o[e.id]))continue;this.getNeighbors(e,r).forEach(t=>{o[t.id]=o[e.id]+1,n.push(t)})}}depthFirstSearch(e,t,r={}){const n=[],i={},o={};for(n.push(e),o[e.id]=0;n.length>0;){const e=n.pop();if(null==e||i[e.id])continue;if(i[e.id]=!0,!1===call$1(t,this,e,o[e.id]))continue;const a=this.getNeighbors(e,r),s=n.length;a.forEach(t=>{o[t.id]=o[e.id]+1,n.splice(s,0,t)})}}getShortestPath(e,t,r={}){const n={};this.getEdges().forEach(e=>{const t=e.getSourceCellId(),i=e.getTargetCellId();t&&i&&(n[t]||(n[t]=[]),n[i]||(n[i]=[]),n[t].push(i),r.directed||n[i].push(t))});const i="string"==typeof e?e:e.id,o=Dijkstra.run(n,i,r.weight),a=[];let s="string"==typeof t?t:t.id;for(o[s]&&a.push(s);s=o[s];)a.unshift(s);return a}translate(e,t,r){return this.getCells().filter(e=>!e.hasParent()).forEach(n=>n.translate(e,t,r)),this}resize(e,t,r){return this.resizeCells(e,t,this.getCells(),r)}resizeCells(e,t,r,n={}){const i=this.getCellsBBox(r);if(i){const o=Math.max(e/i.width,0),a=Math.max(t/i.height,0),s=i.getOrigin();r.forEach(e=>e.scale(o,a,s,n))}return this}toJSON(e={}){return Model.toJSON(this.getCells(),e)}parseJSON(e){return Model.fromJSON(e)}fromJSON(e,t={}){const r=this.parseJSON(e);return this.resetCells(r,t),this}startBatch(e,t={}){return this.batches[e]=(this.batches[e]||0)+1,this.notify("batch:start",{name:e,data:t}),this}stopBatch(e,t={}){return this.batches[e]=(this.batches[e]||0)-1,this.notify("batch:stop",{name:e,data:t}),this}batchUpdate(e,t,r={}){this.startBatch(e,r);const n=t();return this.stopBatch(e,r),n}hasActiveBatch(e=Object.keys(this.batches)){return(Array.isArray(e)?e:[e]).some(e=>this.batches[e]>0)}dispose(){this.collection.dispose()}}__decorate$p([Model.dispose()],Model.prototype,"dispose",null),Model2=Model||(Model={}),Model2.toStringTag=`X6.${Model2.name}`,Model2.isModel=function(e){if(null==e)return!1;if(e instanceof Model2)return!0;const t=e[Symbol.toStringTag],r=e;return(null==t||t===Model2.toStringTag)&&"function"==typeof r.addNode&&"function"==typeof r.addEdge&&null!=r.collection},function(e){e.toJSON=function(e,t={}){return{cells:e.map(e=>e.toJSON(t))}},e.fromJSON=function(e){const t=[];return Array.isArray(e)?t.push(...e):(e.cells&&t.push(...e.cells),e.nodes&&e.nodes.forEach(e=>{null==e.shape&&(e.shape="rect"),t.push(e)}),e.edges&&e.edges.forEach(e=>{null==e.shape&&(e.shape="edge"),t.push(e)})),t.map(e=>{const t=e.shape;if(t){if(Node$1.registry.exist(t))return Node$1.create(e);if(Edge$1.registry.exist(t))return Edge$1.create(e)}throw new Error("The `shape` should be specified when creating a node/edge instance")})}}(Model||(Model={}));var __rest$b=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};let Base$1=class extends Node$1{get label(){return this.getLabel()}set label(e){this.setLabel(e)}getLabel(){return this.getAttrByPath("text/text")}setLabel(e,t){return null==e?this.removeLabel():this.setAttrByPath("text/text",e,t),this}removeLabel(){return this.removeAttrByPath("text/text"),this}};var Base2;Base2=Base$1||(Base$1={}),Base2.bodyAttr={fill:"#ffffff",stroke:"#333333",strokeWidth:2},Base2.labelAttr={fontSize:14,fill:"#000000",refX:.5,refY:.5,textAnchor:"middle",textVerticalAnchor:"middle",fontFamily:"Arial, helvetica, sans-serif"},Base2.config({attrs:{text:Object.assign({},Base2.labelAttr)},propHooks(e){const{label:t}=e,r=__rest$b(e,["label"]);return t&&setByPath(r,"attrs/text/text",t),r},visible:!0});var __rest$a=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};function getMarkup(e,t="body"){return[{tagName:e,selector:t},{tagName:"text",selector:"label"}]}function getImageUrlHook(e="xlink:href"){return t=>{const{imageUrl:r,imageWidth:n,imageHeight:i}=t,o=__rest$a(t,["imageUrl","imageWidth","imageHeight"]);if(null!=r||null!=n||null!=i){const t=()=>{if(o.attrs){const t=o.attrs.image;null!=r&&(t[e]=r),null!=n&&(t.width=n),null!=i&&(t.height=i),o.attrs.image=t}};o.attrs?(null==o.attrs.image&&(o.attrs.image={}),t()):(o.attrs={image:{}},t())}return o}}function createShape(e,t,r={}){const n={constructorName:e,markup:getMarkup(e,r.selector),attrs:{[e]:Object.assign({},Base$1.bodyAttr)}};return(r.parent||Base$1).define(merge$2(n,t,{shape:e}))}createShape("rect",{attrs:{body:{refWidth:"100%",refHeight:"100%"}}});const Edge=Edge$1.define({shape:"edge",markup:[{tagName:"path",selector:"wrap",groupSelector:"lines",attrs:{fill:"none",cursor:"pointer",stroke:"transparent",strokeLinecap:"round"}},{tagName:"path",selector:"line",groupSelector:"lines",attrs:{fill:"none",pointerEvents:"none"}}],attrs:{lines:{connection:!0,strokeLinejoin:"round"},wrap:{strokeWidth:10},line:{stroke:"#333",strokeWidth:2,targetMarker:"classic"}}});createShape("ellipse",{attrs:{body:{refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"}}});var __rest$9=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};class Poly extends Base$1{get points(){return this.getPoints()}set points(e){this.setPoints(e)}getPoints(){return this.getAttrByPath("body/refPoints")}setPoints(e,t){return null==e?this.removePoints():this.setAttrByPath("body/refPoints",Poly.pointsToString(e),t),this}removePoints(){return this.removeAttrByPath("body/refPoints"),this}}!function(e){function t(e){return"string"==typeof e?e:e.map(e=>Array.isArray(e)?e.join(","):Point.isPointLike(e)?`${e.x}, ${e.y}`:"").join(" ")}e.pointsToString=t,e.config({propHooks(e){const{points:r}=e,n=__rest$9(e,["points"]);if(r){const e=t(r);e&&setByPath(n,"attrs/body/refPoints",e)}return n}})}(Poly||(Poly={})),createShape("polygon",{},{parent:Poly}),createShape("polyline",{},{parent:Poly});var __rest$8=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};Base$1.define({shape:"path",markup:[{tagName:"rect",selector:"bg"},{tagName:"path",selector:"body"},{tagName:"text",selector:"label"}],attrs:{bg:{refWidth:"100%",refHeight:"100%",fill:"none",stroke:"none",pointerEvents:"all"},body:{fill:"none",stroke:"#000",strokeWidth:2}},propHooks(e){const{path:t}=e,r=__rest$8(e,["path"]);return t&&setByPath(r,"attrs/body/refD",t),r}});var __rest$7=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},NodeView2;Base$1.define({shape:"text-block",markup:[{tagName:"rect",selector:"body"},Platform.SUPPORT_FOREIGNOBJECT?{tagName:"foreignObject",selector:"foreignObject",children:[{tagName:"div",ns:ns.xhtml,selector:"label",style:{width:"100%",height:"100%",position:"static",backgroundColor:"transparent",textAlign:"center",margin:0,padding:"0px 5px",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center"}}]}:{tagName:"text",selector:"label",attrs:{textAnchor:"middle"}}],attrs:{body:Object.assign(Object.assign({},Base$1.bodyAttr),{refWidth:"100%",refHeight:"100%"}),foreignObject:{refWidth:"100%",refHeight:"100%"},label:{style:{fontSize:14}}},propHooks(e){const{text:t}=e,r=__rest$7(e,["text"]);return t&&setByPath(r,"attrs/label/text",t),r},attrHooks:{text:{set(e,{cell:t,view:r,refBBox:n,elem:i,attrs:o}){if(!(i instanceof HTMLElement)){const a=o.style||{},s={text:e,width:-5,height:"100%"},l=Object.assign({textVerticalAnchor:"middle"},a);return call$1(Attr.presets.textWrap.set,this,s,{cell:t,view:r,elem:i,refBBox:n,attrs:l}),{fill:a.color||null}}i.textContent=e},position(e,{refBBox:t,elem:r}){if(r instanceof SVGElement)return t.getCenter()}}}}),createShape("image",{attrs:{image:{refWidth:"100%",refHeight:"100%"}},propHooks:getImageUrlHook()},{selector:"image"}),createShape("circle",{attrs:{body:{refCx:"50%",refCy:"50%",refR:"50%"}}});class NodeView extends CellView{constructor(){super(...arguments),this.portsCache={}}get[Symbol.toStringTag](){return NodeView.toStringTag}getContainerClassName(){const e=[super.getContainerClassName(),this.prefixClassName("node")];return this.can("nodeMovable")||e.push(this.prefixClassName("node-immovable")),e.join(" ")}updateClassName(e){const t=e.target;if(t.hasAttribute("magnet")){const e=this.prefixClassName("port-unconnectable");this.can("magnetConnectable")?removeClass(t,e):addClass(t,e)}else{const e=this.prefixClassName("node-immovable");this.can("nodeMovable")?this.removeClass(e):this.addClass(e)}}isNodeView(){return!0}confirmUpdate(e,t={}){let r=e;return this.hasAction(r,"ports")&&(this.removePorts(),this.cleanPortsCache()),this.hasAction(r,"render")?(this.render(),r=this.removeAction(r,["render","update","resize","translate","rotate","ports","tools"])):(r=this.handleAction(r,"resize",()=>this.resize(),"update"),r=this.handleAction(r,"update",()=>this.update(),"ports"),r=this.handleAction(r,"translate",()=>this.translate()),r=this.handleAction(r,"rotate",()=>this.rotate()),r=this.handleAction(r,"ports",()=>this.renderPorts()),r=this.handleAction(r,"tools",()=>{this.getFlag("tools")===e?this.renderTools():this.updateTools(t)})),r}update(e){this.cleanCache(),this.removePorts();const t=this.cell,r=t.getSize(),n=t.getAttrs();this.updateAttrs(this.container,n,{attrs:e===n?null:e,rootBBox:new Rectangle(0,0,r.width,r.height),selectors:this.selectors}),this.renderPorts()}renderMarkup(){const e=this.cell.markup;if(e){if("string"==typeof e)throw new TypeError("Not support string markup.");return this.renderJSONMarkup(e)}throw new TypeError("Invalid node markup.")}renderJSONMarkup(e){const t=this.parseJSONMarkup(e,this.container);this.selectors=t.selectors,this.container.appendChild(t.fragment)}render(){return this.empty(),this.renderMarkup(),this.resize(),this.updateTransform(),this.renderTools(),this}resize(){this.cell.getAngle()&&this.rotate(),this.update()}translate(){this.updateTransform()}rotate(){this.updateTransform()}getTranslationString(){const e=this.cell.getPosition();return`translate(${e.x},${e.y})`}getRotationString(){const e=this.cell.getAngle();if(e){const t=this.cell.getSize();return`rotate(${e},${t.width/2},${t.height/2})`}}updateTransform(){let e=this.getTranslationString();const t=this.getRotationString();t&&(e+=` ${t}`),this.container.setAttribute("transform",e)}findPortElem(e,t){const r=e?this.portsCache[e]:null;if(!r)return null;const n=r.portContentElement,i=r.portContentSelectors||{};return this.findOne(t,n,i)}cleanPortsCache(){this.portsCache={}}removePorts(){Object.values(this.portsCache).forEach(e=>{remove(e.portElement)})}renderPorts(){const e=this.container,t=[];e.childNodes.forEach(e=>{t.push(e)});const r=this.cell.getParsedPorts(),n=groupBy(r,"zIndex"),i="auto";n[i]&&n[i].forEach(r=>{const n=this.getPortElement(r);e.append(n),t.push(n)}),Object.keys(n).forEach(e=>{if(e!==i){const r=parseInt(e,10);this.appendPorts(n[e],r,t)}}),this.updatePorts()}appendPorts(e,t,r){const n=e.map(e=>this.getPortElement(e));r[t]||t<0?before(r[Math.max(t,0)],n):append(this.container,n)}getPortElement(e){const t=this.portsCache[e.id];return t?t.portElement:this.createPortElement(e)}createPortElement(e){let t=Markup.renderMarkup(this.cell.getPortContainerMarkup());const r=t.elem;if(null==r)throw new Error("Invalid port container markup.");t=Markup.renderMarkup(this.getPortMarkup(e));const n=t.elem,i=t.selectors;if(null==n)throw new Error("Invalid port markup.");this.setAttrs({port:e.id,"port-group":e.group},n);let o="x6-port";e.group&&(o+=` x6-port-${e.group}`),addClass(r,o),addClass(r,"x6-port"),addClass(n,"x6-port-body"),r.appendChild(n);let a,s,l=i;if(this.existPortLabel(e)){if(t=Markup.renderMarkup(this.getPortLabelMarkup(e.label)),a=t.elem,s=t.selectors,null==a)throw new Error("Invalid port label markup.");if(i&&s){for(const e in s)if(i[e]&&e!==this.rootSelector)throw new Error("Selectors within port must be unique.");l=Object.assign(Object.assign({},i),s)}addClass(a,"x6-port-label"),r.appendChild(a)}return this.portsCache[e.id]={portElement:r,portSelectors:l,portLabelElement:a,portLabelSelectors:s,portContentElement:n,portContentSelectors:i},this.graph.options.onPortRendered&&this.graph.options.onPortRendered({port:e,node:this.cell,container:r,selectors:l,labelContainer:a,labelSelectors:s,contentContainer:n,contentSelectors:i}),r}updatePorts(){const e=this.cell.getParsedGroups(),t=Object.keys(e);0===t.length?this.updatePortGroup():t.forEach(e=>this.updatePortGroup(e))}updatePortGroup(e){const t=Rectangle.fromSize(this.cell.getSize()),r=this.cell.getPortsLayoutByGroup(e,t);for(let n=0,i=r.length;n<i;n+=1){const e=r[n],t=e.portId,i=this.portsCache[t]||{},o=e.portLayout;if(this.applyPortTransform(i.portElement,o),null!=e.portAttrs){const t={selectors:i.portSelectors||{}};e.portSize&&(t.rootBBox=Rectangle.fromSize(e.portSize)),this.updateAttrs(i.portElement,e.portAttrs,t)}const a=e.labelLayout;if(a&&i.portLabelElement&&(this.applyPortTransform(i.portLabelElement,a,-(o.angle||0)),a.attrs)){const t={selectors:i.portLabelSelectors||{}};e.labelSize&&(t.rootBBox=Rectangle.fromSize(e.labelSize)),this.updateAttrs(i.portLabelElement,a.attrs,t)}}}applyPortTransform(e,t,r=0){const n=t.angle,i=t.position;transform(e,createSVGMatrix().rotate(r).translate(i.x||0,i.y||0).rotate(n||0),{absolute:!0})}getPortMarkup(e){return e.markup||this.cell.portMarkup}getPortLabelMarkup(e){return e.markup||this.cell.portLabelMarkup}existPortLabel(e){return e.attrs&&e.attrs.text}getEventArgs(e,t,r){const n=this,i=n.cell;return null==t||null==r?{e:e,view:n,node:i,cell:i}:{e:e,x:t,y:r,view:n,node:i,cell:i}}getPortEventArgs(e,t,r){const n=this,i=n.cell,o=i;return r?{e:e,x:r.x,y:r.y,view:n,node:i,cell:o,port:t}:{e:e,view:n,node:i,cell:o,port:t}}notifyMouseDown(e,t,r){super.onMouseDown(e,t,r),this.notify("node:mousedown",this.getEventArgs(e,t,r))}notifyMouseMove(e,t,r){super.onMouseMove(e,t,r),this.notify("node:mousemove",this.getEventArgs(e,t,r))}notifyMouseUp(e,t,r){super.onMouseUp(e,t,r),this.notify("node:mouseup",this.getEventArgs(e,t,r))}notifyPortEvent(e,t,r){const n=this.findAttr("port",t.target);if(n){const i=t.type;"node:port:mouseenter"===e?t.type="mouseenter":"node:port:mouseleave"===e&&(t.type="mouseleave"),this.notify(e,this.getPortEventArgs(t,n,r)),t.type=i}}onClick(e,t,r){super.onClick(e,t,r),this.notify("node:click",this.getEventArgs(e,t,r)),this.notifyPortEvent("node:port:click",e,{x:t,y:r})}onDblClick(e,t,r){super.onDblClick(e,t,r),this.notify("node:dblclick",this.getEventArgs(e,t,r)),this.notifyPortEvent("node:port:dblclick",e,{x:t,y:r})}onContextMenu(e,t,r){super.onContextMenu(e,t,r),this.notify("node:contextmenu",this.getEventArgs(e,t,r)),this.notifyPortEvent("node:port:contextmenu",e,{x:t,y:r})}onMouseDown(e,t,r){this.isPropagationStopped(e)||(this.notifyMouseDown(e,t,r),this.notifyPortEvent("node:port:mousedown",e,{x:t,y:r}),this.startNodeDragging(e,t,r))}onMouseMove(e,t,r){const n=this.getEventData(e),i=n.action;if("magnet"===i)this.dragMagnet(e,t,r);else{if("move"===i){const i=n.targetView||this;i.dragNode(e,t,r),i.notify("node:moving",{e:e,x:t,y:r,view:i,cell:i.cell,node:i.cell})}this.notifyMouseMove(e,t,r),this.notifyPortEvent("node:port:mousemove",e,{x:t,y:r})}this.setEventData(e,n)}onMouseUp(e,t,r){const n=this.getEventData(e),i=n.action;if("magnet"===i)this.stopMagnetDragging(e,t,r);else if(this.notifyMouseUp(e,t,r),this.notifyPortEvent("node:port:mouseup",e,{x:t,y:r}),"move"===i){(n.targetView||this).stopNodeDragging(e,t,r)}const o=n.targetMagnet;o&&this.onMagnetClick(e,o,t,r),this.checkMouseleave(e)}onMouseOver(e){super.onMouseOver(e),this.notify("node:mouseover",this.getEventArgs(e)),this.notifyPortEvent("node:port:mouseenter",e),this.notifyPortEvent("node:port:mouseover",e)}onMouseOut(e){super.onMouseOut(e),this.notify("node:mouseout",this.getEventArgs(e)),this.notifyPortEvent("node:port:mouseleave",e),this.notifyPortEvent("node:port:mouseout",e)}onMouseEnter(e){this.updateClassName(e),super.onMouseEnter(e),this.notify("node:mouseenter",this.getEventArgs(e))}onMouseLeave(e){super.onMouseLeave(e),this.notify("node:mouseleave",this.getEventArgs(e))}onMouseWheel(e,t,r,n){super.onMouseWheel(e,t,r,n),this.notify("node:mousewheel",Object.assign({delta:n},this.getEventArgs(e,t,r)))}onMagnetClick(e,t,r,n){const i=this.graph;i.view.getMouseMovedCount(e)>i.options.clickThreshold||this.notify("node:magnet:click",Object.assign({magnet:t},this.getEventArgs(e,r,n)))}onMagnetDblClick(e,t,r,n){this.notify("node:magnet:dblclick",Object.assign({magnet:t},this.getEventArgs(e,r,n)))}onMagnetContextMenu(e,t,r,n){this.notify("node:magnet:contextmenu",Object.assign({magnet:t},this.getEventArgs(e,r,n)))}onMagnetMouseDown(e,t,r,n){this.startMagnetDragging(e,r,n)}onCustomEvent(e,t,r,n){this.notify("node:customevent",Object.assign({name:t},this.getEventArgs(e,r,n))),super.onCustomEvent(e,t,r,n)}prepareEmbedding(e){const t=this.graph,r=this.getEventData(e).cell||this.cell,n=t.findViewByCell(r),i=t.snapToGrid(e.clientX,e.clientY);this.notify("node:embed",{e:e,node:r,view:n,cell:r,x:i.x,y:i.y,currentParent:r.getParent()})}processEmbedding(e,t){const r=t.cell||this.cell,n=t.graph||this.graph,i=n.options.embedding,o=i.findParent;let a="function"==typeof o?call$1(o,n,{view:this,node:this.cell}).filter(e=>Cell.isCell(e)&&this.cell.id!==e.id&&!e.isDescendantOf(this.cell)):n.model.getNodesUnderNode(r,{by:o});if(i.frontOnly&&a.length>0){const e=groupBy(a,"zIndex"),t=max(Object.keys(e).map(e=>parseInt(e,10)));t&&(a=e[t])}a=a.filter(e=>e.visible);let s=null;const l=t.candidateEmbedView,c=i.validate;for(let d=a.length-1;d>=0;d-=1){const e=a[d];if(l&&l.cell.id===e.id){s=l;break}{const t=e.findView(n);if(c&&call$1(c,n,{child:this.cell,parent:t.cell,childView:this,parentView:t})){s=t;break}}}this.clearEmbedding(t),s&&s.highlight(null,{type:"embedding"}),t.candidateEmbedView=s;const u=n.snapToGrid(e.clientX,e.clientY);this.notify("node:embedding",{e:e,cell:r,node:r,view:n.findViewByCell(r),x:u.x,y:u.y,currentParent:r.getParent(),candidateParent:s?s.cell:null})}clearEmbedding(e){const t=e.candidateEmbedView;t&&(t.unhighlight(null,{type:"embedding"}),e.candidateEmbedView=null)}finalizeEmbedding(e,t){this.graph.startBatch("embedding");const r=t.cell||this.cell,n=t.graph||this.graph,i=n.findViewByCell(r),o=r.getParent(),a=t.candidateEmbedView;if(a?(a.unhighlight(null,{type:"embedding"}),t.candidateEmbedView=null,null!=o&&o.id===a.cell.id||a.cell.insertChild(r,void 0,{ui:!0})):o&&o.unembed(r,{ui:!0}),n.model.getConnectedEdges(r,{deep:!0}).forEach(e=>{e.updateParent({ui:!0})}),i&&a){const t=n.snapToGrid(e.clientX,e.clientY);i.notify("node:embedded",{e:e,cell:r,x:t.x,y:t.y,node:r,view:n.findViewByCell(r),previousParent:o,currentParent:r.getParent()})}this.graph.stopBatch("embedding")}getDelegatedView(){let e=this.cell,t=this;for(;t&&!e.isEdge();){if(!e.hasParent()||t.can("stopDelegateOnDragging"))return t;e=e.getParent(),t=this.graph.findViewByCell(e)}return null}validateMagnet(e,t,r){if("passive"!==t.getAttribute("magnet")){const n=this.graph.options.connecting.validateMagnet;return!n||call$1(n,this.graph,{e:r,magnet:t,view:e,cell:e.cell})}return!1}startMagnetDragging(e,t,r){if(!this.can("magnetConnectable"))return;e.stopPropagation();const n=e.currentTarget,i=this.graph;this.setEventData(e,{targetMagnet:n}),this.validateMagnet(this,n,e)?(i.options.magnetThreshold<=0&&this.startConnectting(e,n,t,r),this.setEventData(e,{action:"magnet"}),this.stopPropagation(e)):this.onMouseDown(e,t,r),i.view.delegateDragEvents(e,this)}startConnectting(e,t,r,n){this.graph.model.startBatch("add-edge");const i=this.createEdgeFromMagnet(t,r,n);i.setEventData(e,i.prepareArrowheadDragging("target",{x:r,y:n,isNewEdge:!0,fallbackAction:"remove"})),this.setEventData(e,{edgeView:i}),i.notifyMouseDown(e,r,n)}getDefaultEdge(e,t){let r;const n=this.graph.options.connecting.createEdge;return n&&(r=call$1(n,this.graph,{sourceMagnet:t,sourceView:e,sourceCell:e.cell})),r}createEdgeFromMagnet(e,t,r){const n=this.graph,i=n.model,o=this.getDefaultEdge(this,e);return o.setSource(Object.assign(Object.assign({},o.getSource()),this.getEdgeTerminal(e,t,r,o,"source"))),o.setTarget(Object.assign(Object.assign({},o.getTarget()),{x:t,y:r})),o.addTo(i,{async:!1,ui:!0}),o.findView(n)}dragMagnet(e,t,r){const n=this.getEventData(e),i=n.edgeView;if(i)i.onMouseMove(e,t,r),this.autoScrollGraph(e.clientX,e.clientY);else{const i=this.graph,o=i.options.magnetThreshold,a=this.getEventTarget(e),s=n.targetMagnet;if("onleave"===o){if(s===a||s.contains(a))return}else if(i.view.getMouseMovedCount(e)<=o)return;this.startConnectting(e,s,t,r)}}stopMagnetDragging(e,t,r){const n=this.eventData(e).edgeView;n&&(n.onMouseUp(e,t,r),this.graph.model.stopBatch("add-edge"))}notifyUnhandledMouseDown(e,t,r){this.notify("node:unhandled:mousedown",{e:e,x:t,y:r,view:this,cell:this.cell,node:this.cell})}notifyNodeMove(e,t,r,n,i){let o=[i];const a=this.graph.getPlugin("selection");if(a&&a.isSelectionMovable()){const e=a.getSelectedCells();e.includes(i)&&(o=e.filter(e=>e.isNode()))}o.forEach(i=>{this.notify(e,{e:t,x:r,y:n,cell:i,node:i,view:i.findView(this.graph)})})}getRestrictArea(e){const t=this.graph.options.translating.restrict,r="function"==typeof t?call$1(t,this.graph,e):t;return"number"==typeof r?this.graph.transform.getGraphArea().inflate(r):!0===r?this.graph.transform.getGraphArea():r||null}startNodeDragging(e,t,r){const n=this.getDelegatedView();if(null==n||!n.can("nodeMovable"))return this.notifyUnhandledMouseDown(e,t,r);this.setEventData(e,{targetView:n,action:"move"});const i=Point.create(n.cell.getPosition());n.setEventData(e,{moving:!1,offset:i.diff(t,r),restrict:this.getRestrictArea(n)})}dragNode(e,t,r){const n=this.cell,i=this.graph,o=i.getGridSize(),a=this.getEventData(e),s=a.offset,l=a.restrict;a.moving||(a.moving=!0,this.addClass("node-moving"),this.notifyNodeMove("node:move",e,t,r,this.cell)),this.autoScrollGraph(e.clientX,e.clientY);const c=GeometryUtil.snapToGrid(t+s.x,o),u=GeometryUtil.snapToGrid(r+s.y,o);n.setPosition(c,u,{restrict:l,deep:!0,ui:!0}),i.options.embedding.enabled&&(a.embedding||(this.prepareEmbedding(e),a.embedding=!0),this.processEmbedding(e,a))}autoOffsetNode(){const e=this.cell,t=this.graph,r=Object.assign({id:e.id},e.getPosition()),n=t.getNodes().map(e=>{const t=e.getPosition();return{id:e.id,x:t.x,y:t.y}}).filter(e=>e.id!==r.id),i=[[1,1],[1,-1],[-1,1],[-1,-1]];let o=t.getGridSize();const a=e=>n.some(t=>t.x===e.x&&t.y===e.y);for(;a(r);){let n=!1;for(let t=0;t<i.length;t+=1){const s=i[t];if(!a({x:r.x+s[0]*o,y:r.y+s[1]*o})){e.translate(s[0]*o,s[1]*o),n=!0;break}}if(n)break;o+=t.getGridSize()}}stopNodeDragging(e,t,r){const n=this.getEventData(e),i=this.graph;if(n.embedding&&this.finalizeEmbedding(e,n),n.moving){i.options.translating.autoOffset&&this.autoOffsetNode(),this.removeClass("node-moving"),this.notifyNodeMove("node:moved",e,t,r,this.cell)}n.moving=!1,n.embedding=!1}autoScrollGraph(e,t){const r=this.graph.getPlugin("scroller");r&&r.autoScroll(e,t)}}NodeView2=NodeView||(NodeView={}),NodeView2.toStringTag=`X6.${NodeView2.name}`,NodeView2.isNodeView=function(e){if(null==e)return!1;if(e instanceof NodeView2)return!0;const t=e[Symbol.toStringTag],r=e;return(null==t||t===NodeView2.toStringTag)&&"function"==typeof r.isNodeView&&"function"==typeof r.isEdgeView&&"function"==typeof r.confirmUpdate&&"function"==typeof r.update&&"function"==typeof r.findPortElem&&"function"==typeof r.resize&&"function"==typeof r.rotate&&"function"==typeof r.translate},NodeView.config({isSvgElement:!0,priority:0,bootstrap:["render"],actions:{view:["render"],markup:["render"],attrs:["update"],size:["resize","ports","tools"],angle:["rotate","tools"],position:["translate","tools"],ports:["ports"],tools:["tools"]}}),NodeView.registry.register("node",NodeView,!0);var __rest$6=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},EdgeView2;class EdgeView extends CellView{constructor(){super(...arguments),this.POINT_ROUNDING=2,this.labelDestroyFn={}}get[Symbol.toStringTag](){return EdgeView.toStringTag}getContainerClassName(){return[super.getContainerClassName(),this.prefixClassName("edge")].join(" ")}get sourceBBox(){const e=this.sourceView;if(!e){const e=this.cell.getSource();return new Rectangle(e.x,e.y)}const t=this.sourceMagnet;return e.isEdgeElement(t)?new Rectangle(this.sourceAnchor.x,this.sourceAnchor.y):e.getBBoxOfElement(t||e.container)}get targetBBox(){const e=this.targetView;if(!e){const e=this.cell.getTarget();return new Rectangle(e.x,e.y)}const t=this.targetMagnet;return e.isEdgeElement(t)?new Rectangle(this.targetAnchor.x,this.targetAnchor.y):e.getBBoxOfElement(t||e.container)}isEdgeView(){return!0}confirmUpdate(e,t={}){let r=e;if(this.hasAction(r,"source")){if(!this.updateTerminalProperties("source"))return r;r=this.removeAction(r,"source")}if(this.hasAction(r,"target")){if(!this.updateTerminalProperties("target"))return r;r=this.removeAction(r,"target")}return this.hasAction(r,"render")?(this.render(),r=this.removeAction(r,["render","update","labels","tools"]),r):(r=this.handleAction(r,"update",()=>this.update(t)),r=this.handleAction(r,"labels",()=>this.onLabelsChange(t)),r=this.handleAction(r,"tools",()=>this.renderTools()),r)}render(){return this.empty(),this.renderMarkup(),this.labelContainer=null,this.renderLabels(),this.update(),this.renderTools(),this}renderMarkup(){const e=this.cell.markup;if(e){if("string"==typeof e)throw new TypeError("Not support string markup.");return this.renderJSONMarkup(e)}throw new TypeError("Invalid edge markup.")}renderJSONMarkup(e){const t=this.parseJSONMarkup(e,this.container);this.selectors=t.selectors,this.container.append(t.fragment)}customizeLabels(){if(this.labelContainer){const e=this.cell,t=e.labels;for(let r=0,n=t.length;r<n;r+=1){const n=t[r],i=this.labelCache[r],o=this.labelSelectors[r],a=this.graph.options.onEdgeLabelRendered;if(a){const t=a({edge:e,label:n,container:i,selectors:o});t&&(this.labelDestroyFn[r]=t)}}}}destroyCustomizeLabels(){const e=this.cell.labels;if(this.labelCache&&this.labelSelectors&&this.labelDestroyFn)for(let t=0,r=e.length;t<r;t+=1){const r=this.labelDestroyFn[t],n=this.labelCache[t],i=this.labelSelectors[t];r&&n&&i&&r({edge:this.cell,label:e[t],container:n,selectors:i})}this.labelDestroyFn={}}renderLabels(){const e=this.cell,t=e.getLabels(),r=t.length;let n=this.labelContainer;if(this.labelCache={},this.labelSelectors={},r<=0)return n&&n.parentNode&&n.parentNode.removeChild(n),this;n?this.empty(n):(n=createSvgElement("g"),this.addClass(this.prefixClassName("edge-labels"),n),this.labelContainer=n);for(let i=0,o=t.length;i<o;i+=1){const r=t[i],o=this.normalizeLabelMarkup(this.parseLabelMarkup(r.markup));let a,s;if(o)a=o.node,s=o.selectors;else{const t=e.getDefaultLabel(),r=this.normalizeLabelMarkup(this.parseLabelMarkup(t.markup));a=r.node,s=r.selectors}a.setAttribute("data-index",`${i}`),n.appendChild(a);const l=this.rootSelector;if(s[l])throw new Error("Ambiguous label root selector.");s[l]=a,this.labelCache[i]=a,this.labelSelectors[i]=s}return null==n.parentNode&&this.container.appendChild(n),this.updateLabels(),this.customizeLabels(),this}onLabelsChange(e={}){this.destroyCustomizeLabels(),this.shouldRerenderLabels(e)?this.renderLabels():this.updateLabels(),this.updateLabelPositions()}shouldRerenderLabels(e={}){const t=this.cell.previous("labels");if(null==t)return!0;if("propertyPathArray"in e&&"propertyValue"in e){const r=e.propertyPathArray||[],n=r.length;if(n>1){if(t[r[1]]){if(2===n)return"object"==typeof e.propertyValue&&has(e.propertyValue,"markup");if("markup"!==r[2])return!1}}}return!0}parseLabelMarkup(e){return e?"string"==typeof e?this.parseLabelStringMarkup(e):this.parseJSONMarkup(e):null}parseLabelStringMarkup(e){const t=Vector.createVectors(e),r=document.createDocumentFragment();for(let n=0,i=t.length;n<i;n+=1){const e=t[n].node;r.appendChild(e)}return{fragment:r,selectors:{}}}normalizeLabelMarkup(e){if(null==e)return;const t=e.fragment;if(!(t instanceof DocumentFragment&&t.hasChildNodes()))throw new Error("Invalid label markup.");let r;const n=t.childNodes;return r=n.length>1||"G"!==n[0].nodeName.toUpperCase()?Vector.create("g").append(t):Vector.create(n[0]),r.addClass(this.prefixClassName("edge-label")),{node:r.node,selectors:e.selectors}}updateLabels(){if(this.labelContainer){const e=this.cell,t=e.labels,r=this.can("edgeLabelMovable"),n=e.getDefaultLabel();for(let i=0,o=t.length;i<o;i+=1){const e=this.labelCache[i],o=this.labelSelectors[i];e.setAttribute("cursor",r?"move":"default");const a=t[i],s=merge$2({},n.attrs,a.attrs);this.updateAttrs(e,s,{selectors:o,rootBBox:a.size?Rectangle.fromSize(a.size):void 0})}}}renderTools(){const e=this.cell.getTools();return this.addTools(e),this}update(e={}){this.cleanCache(),this.updateConnection(e);const t=this.cell.getAttrs(),{text:r}=t,n=__rest$6(t,["text"]);return null!=n&&this.updateAttrs(this.container,n,{selectors:this.selectors}),this.updateLabelPositions(),this.updateTools(e),this}removeRedundantLinearVertices(e={}){const t=this.cell,r=t.getVertices(),n=[this.sourceAnchor,...r,this.targetAnchor],i=n.length,o=new Polyline(n);o.simplify({threshold:.01});const a=o.points.map(e=>e.toJSON()),s=a.length;return i===s?0:(t.setVertices(a.slice(1,s-1),e),i-s)}getTerminalView(e){switch(e){case"source":return this.sourceView||null;case"target":return this.targetView||null;default:throw new Error(`Unknown terminal type '${e}'`)}}getTerminalAnchor(e){switch(e){case"source":return Point.create(this.sourceAnchor);case"target":return Point.create(this.targetAnchor);default:throw new Error(`Unknown terminal type '${e}'`)}}getTerminalConnectionPoint(e){switch(e){case"source":return Point.create(this.sourcePoint);case"target":return Point.create(this.targetPoint);default:throw new Error(`Unknown terminal type '${e}'`)}}getTerminalMagnet(e,t={}){switch(e){case"source":{if(t.raw)return this.sourceMagnet;const e=this.sourceView;return e?this.sourceMagnet||e.container:null}case"target":{if(t.raw)return this.targetMagnet;const e=this.targetView;return e?this.targetMagnet||e.container:null}default:throw new Error(`Unknown terminal type '${e}'`)}}updateConnection(e={}){const t=this.cell;if(e.translateBy&&t.isFragmentDescendantOf(e.translateBy)){const t=e.tx||0,r=e.ty||0;this.routePoints=new Polyline(this.routePoints).translate(t,r).points,this.translateConnectionPoints(t,r),this.path.translate(t,r)}else{const e=t.getVertices(),r=this.findAnchors(e);this.sourceAnchor=r.source,this.targetAnchor=r.target,this.routePoints=this.findRoutePoints(e);const n=this.findConnectionPoints(this.routePoints,this.sourceAnchor,this.targetAnchor);this.sourcePoint=n.source,this.targetPoint=n.target;const i=this.findMarkerPoints(this.routePoints,this.sourcePoint,this.targetPoint);this.path=this.findPath(this.routePoints,i.source||this.sourcePoint,i.target||this.targetPoint)}this.cleanCache()}findAnchors(e){const t=this.cell,r=t.source,n=t.target,i=e[0],o=e[e.length-1];return n.priority&&!r.priority?this.findAnchorsOrdered("target",o,"source",i):this.findAnchorsOrdered("source",i,"target",o)}findAnchorsOrdered(e,t,r,n){let i,o;const a=this.cell,s=a[e],l=a[r],c=this.getTerminalView(e),u=this.getTerminalView(r),d=this.getTerminalMagnet(e),p=this.getTerminalMagnet(r);if(c){let r;r=t?Point.create(t):u?p:Point.create(l),i=this.getAnchor(s.anchor,c,d,r,e)}else i=Point.create(s);if(u){const e=Point.create(n||i);o=this.getAnchor(l.anchor,u,p,e,r)}else o=Point.isPointLike(l)?Point.create(l):new Point;return{[e]:i,[r]:o}}getAnchor(e,t,r,n,i){const o=t.isEdgeElement(r),a=this.graph.options.connecting;let s,l="string"==typeof e?{name:e}:e;if(!l){const e=o?("source"===i?a.sourceEdgeAnchor:a.targetEdgeAnchor)||a.edgeAnchor:("source"===i?a.sourceAnchor:a.targetAnchor)||a.anchor;l="string"==typeof e?{name:e}:e}if(!l)throw new Error("Anchor should be specified.");const c=l.name;if(o){const e=EdgeAnchor.registry.get(c);if("function"!=typeof e)return EdgeAnchor.registry.onNotFound(c);s=call$1(e,this,t,r,n,l.args||{},i)}else{const e=NodeAnchor.registry.get(c);if("function"!=typeof e)return NodeAnchor.registry.onNotFound(c);s=call$1(e,this,t,r,n,l.args||{},i)}return s?s.round(this.POINT_ROUNDING):new Point}findRoutePoints(e=[]){const t=this.graph.options.connecting.router||Router.presets.normal,r=this.cell.getRouter()||t;let n;if("function"==typeof r)n=call$1(r,this,e,{},this);else{const t="string"==typeof r?r:r.name,i="string"==typeof r?{}:r.args||{},o=t?Router.registry.get(t):Router.presets.normal;if("function"!=typeof o)return Router.registry.onNotFound(t);n=call$1(o,this,e,i,this)}return null==n?e.map(e=>Point.create(e)):n.map(e=>Point.create(e))}findConnectionPoints(e,t,r){const n=this.cell,i=this.graph.options.connecting,o=n.getSource(),a=n.getTarget(),s=this.sourceView,l=this.targetView,c=e[0],u=e[e.length-1];let d,p;if(s&&!s.isEdgeElement(this.sourceMagnet)){const e=this.sourceMagnet||s.container,n=new Line(c||r,t),a=o.connectionPoint||i.sourceConnectionPoint||i.connectionPoint;d=this.getConnectionPoint(a,s,e,n,"source")}else d=t;if(l&&!l.isEdgeElement(this.targetMagnet)){const e=this.targetMagnet||l.container,n=a.connectionPoint||i.targetConnectionPoint||i.connectionPoint,o=new Line(u||t,r);p=this.getConnectionPoint(n,l,e,o,"target")}else p=r;return{source:d,target:p}}getConnectionPoint(e,t,r,n,i){const o=n.end;if(null==e)return o;const a="string"==typeof e?e:e.name,s="string"==typeof e?{}:e.args,l=ConnectionPoint.registry.get(a);if("function"!=typeof l)return ConnectionPoint.registry.onNotFound(a);const c=call$1(l,this,n,t,r,s||{},i);return c?c.round(this.POINT_ROUNDING):o}findMarkerPoints(e,t,r){const n=e=>{const t=this.cell.getAttrs(),r=Object.keys(t);for(let n=0,i=r.length;n<i;n+=1){const i=t[r[n]];if(i[`${e}Marker`]||i[`${e}-marker`]){const e=i.strokeWidth||i["stroke-width"];if(e)return parseFloat(e);break}}return null},i=e[0],o=e[e.length-1];let a,s;const l=n("source");l&&(a=t.clone().move(i||r,-l));const c=n("target");return c&&(s=r.clone().move(o||t,-c)),this.sourceMarkerPoint=a||t.clone(),this.targetMarkerPoint=s||r.clone(),{source:a,target:s}}findPath(e,t,r){const n=this.cell.getConnector()||this.graph.options.connecting.connector;let i,o,a;if("string"==typeof n?i=n:(i=n.name,o=n.args),i){const e=Connector.registry.get(i);if("function"!=typeof e)return Connector.registry.onNotFound(i);a=e}else a=Connector.presets.normal;const s=call$1(a,this,t,r,e,Object.assign(Object.assign({},o),{raw:!0}),this);return"string"==typeof s?Path.parse(s):s}translateConnectionPoints(e,t){this.sourcePoint.translate(e,t),this.targetPoint.translate(e,t),this.sourceAnchor.translate(e,t),this.targetAnchor.translate(e,t),this.sourceMarkerPoint.translate(e,t),this.targetMarkerPoint.translate(e,t)}updateLabelPositions(){if(null==this.labelContainer)return this;if(!this.path)return this;const e=this.cell,t=e.getLabels();if(0===t.length)return this;const r=e.getDefaultLabel(),n=this.normalizeLabelPosition(r.position);for(let i=0,o=t.length;i<o;i+=1){const e=t[i],r=this.labelCache[i];if(!r)continue;const o=this.normalizeLabelPosition(e.position),a=merge$2({},n,o),s=this.getLabelTransformationMatrix(a);r.setAttribute("transform",matrixToTransformString(s))}return this}updateTerminalProperties(e){const t=this.cell,r=this.graph,n=t[e],i=n&&n.cell,o=`${e}View`;if(!i)return this[o]=null,this.updateTerminalMagnet(e),!0;const a=r.getCellById(i);if(!a)throw new Error(`Edge's ${e} node with id "${i}" not exists`);const s=a.findView(r);return!!s&&(this[o]=s,this.updateTerminalMagnet(e),!0)}updateTerminalMagnet(e){const t=`${e}Magnet`,r=this.getTerminalView(e);if(r){let n=r.getMagnetFromEdgeTerminal(this.cell[e]);n===r.container&&(n=null),this[t]=n}else this[t]=null}getLabelPositionAngle(e){const t=this.cell.getLabelAt(e);return t&&t.position&&"object"==typeof t.position&&t.position.angle||0}getLabelPositionArgs(e){const t=this.cell.getLabelAt(e);if(t&&t.position&&"object"==typeof t.position)return t.position.options}getDefaultLabelPositionArgs(){const e=this.cell.getDefaultLabel();if(e&&e.position&&"object"==typeof e.position)return e.position.options}mergeLabelPositionArgs(e,t){return null===e?null:void 0===e?null===t?null:t:merge$2({},t,e)}getConnection(){return null!=this.path?this.path.clone():null}getConnectionPathData(){if(null==this.path)return"";const e=this.cache.pathCache;return has(e,"data")||(e.data=this.path.serialize()),e.data||""}getConnectionSubdivisions(){if(null==this.path)return null;const e=this.cache.pathCache;return has(e,"segmentSubdivisions")||(e.segmentSubdivisions=this.path.getSegmentSubdivisions()),e.segmentSubdivisions}getConnectionLength(){if(null==this.path)return 0;const e=this.cache.pathCache;return has(e,"length")||(e.length=this.path.length({segmentSubdivisions:this.getConnectionSubdivisions()})),e.length}getPointAtLength(e){return null==this.path?null:this.path.pointAtLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getPointAtRatio(e){return null==this.path?null:(isPercentage(e)&&(e=parseFloat(e)/100),this.path.pointAt(e,{segmentSubdivisions:this.getConnectionSubdivisions()}))}getTangentAtLength(e){return null==this.path?null:this.path.tangentAtLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getTangentAtRatio(e){return null==this.path?null:this.path.tangentAt(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPoint(e){return null==this.path?null:this.path.closestPoint(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointLength(e){return null==this.path?null:this.path.closestPointLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointRatio(e){return null==this.path?null:this.path.closestPointNormalizedLength(e,{segmentSubdivisions:this.getConnectionSubdivisions()})}getLabelPosition(e,t,r,n){const i={distance:0};let o,a=0;"number"==typeof r?(a=r,o=n):o=r,null!=o&&(i.options=o);const s=o&&o.absoluteOffset,l=!(o&&o.absoluteDistance),c=o&&o.absoluteDistance&&o.reverseDistance,u=this.path,d={segmentSubdivisions:this.getConnectionSubdivisions()},p=new Point(e,t),h=u.closestPointT(p,d),f=this.getConnectionLength()||0;let g,m,v=u.lengthAtT(h,d);if(l&&(v=f>0?v/f:0),c&&(v=-1*(f-v)||1),i.distance=v,s||(g=u.tangentAtT(h)),g)m=g.pointOffset(p);else{const e=u.pointAtT(h),t=p.diff(e);m={x:t.x,y:t.y}}return i.offset=m,i.angle=a,i}normalizeLabelPosition(e){return"number"==typeof e?{distance:e}:e}getLabelTransformationMatrix(e){const t=this.normalizeLabelPosition(e),r=t.options||{},n=t.angle||0,i=t.distance,o=i>0&&i<=1;let a=0;const s={x:0,y:0},l=t.offset;l&&("number"==typeof l?a=l:(null!=l.x&&(s.x=l.x),null!=l.y&&(s.y=l.y)));const c=0!==s.x||0!==s.y||0===a,u=r.keepGradient,d=r.ensureLegibility,p=this.path,h={segmentSubdivisions:this.getConnectionSubdivisions()},f=o?i*this.getConnectionLength():i,g=p.tangentAtLength(f,h);let m,v=n;if(g){if(c)m=g.start,m.translate(s);else{const e=g.clone();e.rotate(-90,g.start),e.setLength(a),m=e.end}u&&(v=g.angle()+n,d&&(v=Angle.normalize((v+90)%180-90)))}else m=p.start,c&&m.translate(s);return createSVGMatrix().translate(m.x,m.y).rotate(v)}getVertexIndex(e,t){const r=this.cell.getVertices(),n=this.getClosestPointLength(new Point(e,t));let i=0;if(null!=n)for(const o=r.length;i<o;i+=1){const e=r[i],t=this.getClosestPointLength(e);if(null!=t&&n<t)break}return i}getEventArgs(e,t,r){const n=this,i=n.cell;return null==t||null==r?{e:e,view:n,edge:i,cell:i}:{e:e,x:t,y:r,view:n,edge:i,cell:i}}notifyUnhandledMouseDown(e,t,r){this.notify("edge:unhandled:mousedown",{e:e,x:t,y:r,view:this,cell:this.cell,edge:this.cell})}notifyMouseDown(e,t,r){super.onMouseDown(e,t,r),this.notify("edge:mousedown",this.getEventArgs(e,t,r))}notifyMouseMove(e,t,r){super.onMouseMove(e,t,r),this.notify("edge:mousemove",this.getEventArgs(e,t,r))}notifyMouseUp(e,t,r){super.onMouseUp(e,t,r),this.notify("edge:mouseup",this.getEventArgs(e,t,r))}onClick(e,t,r){super.onClick(e,t,r),this.notify("edge:click",this.getEventArgs(e,t,r))}onDblClick(e,t,r){super.onDblClick(e,t,r),this.notify("edge:dblclick",this.getEventArgs(e,t,r))}onContextMenu(e,t,r){super.onContextMenu(e,t,r),this.notify("edge:contextmenu",this.getEventArgs(e,t,r))}onMouseDown(e,t,r){this.notifyMouseDown(e,t,r),this.startEdgeDragging(e,t,r)}onMouseMove(e,t,r){const n=this.getEventData(e);switch(n.action){case"drag-label":this.dragLabel(e,t,r);break;case"drag-arrowhead":this.dragArrowhead(e,t,r);break;case"drag-edge":this.dragEdge(e,t,r)}return this.notifyMouseMove(e,t,r),n}onMouseUp(e,t,r){const n=this.getEventData(e);switch(n.action){case"drag-label":this.stopLabelDragging(e,t,r);break;case"drag-arrowhead":this.stopArrowheadDragging(e,t,r);break;case"drag-edge":this.stopEdgeDragging(e,t,r)}return this.notifyMouseUp(e,t,r),this.checkMouseleave(e),n}onMouseOver(e){super.onMouseOver(e),this.notify("edge:mouseover",this.getEventArgs(e))}onMouseOut(e){super.onMouseOut(e),this.notify("edge:mouseout",this.getEventArgs(e))}onMouseEnter(e){super.onMouseEnter(e),this.notify("edge:mouseenter",this.getEventArgs(e))}onMouseLeave(e){super.onMouseLeave(e),this.notify("edge:mouseleave",this.getEventArgs(e))}onMouseWheel(e,t,r,n){super.onMouseWheel(e,t,r,n),this.notify("edge:mousewheel",Object.assign({delta:n},this.getEventArgs(e,t,r)))}onCustomEvent(e,t,r,n){if(findParentByClass(e.target,"edge-tool",this.container)){if(e.stopPropagation(),this.can("useEdgeTools")){if("edge:remove"===t)return void this.cell.remove({ui:!0});this.notify("edge:customevent",Object.assign({name:t},this.getEventArgs(e,r,n)))}this.notifyMouseDown(e,r,n)}else this.notify("edge:customevent",Object.assign({name:t},this.getEventArgs(e,r,n))),super.onCustomEvent(e,t,r,n)}onLabelMouseDown(e,t,r){this.notifyMouseDown(e,t,r),this.startLabelDragging(e,t,r);this.getEventData(e).stopPropagation&&e.stopPropagation()}startEdgeDragging(e,t,r){this.can("edgeMovable")?this.setEventData(e,{x:t,y:r,moving:!1,action:"drag-edge"}):this.notifyUnhandledMouseDown(e,t,r)}dragEdge(e,t,r){const n=this.getEventData(e);n.moving||(n.moving=!0,this.addClass("edge-moving"),this.notify("edge:move",{e:e,x:t,y:r,view:this,cell:this.cell,edge:this.cell})),this.cell.translate(t-n.x,r-n.y,{ui:!0}),this.setEventData(e,{x:t,y:r}),this.notify("edge:moving",{e:e,x:t,y:r,view:this,cell:this.cell,edge:this.cell})}stopEdgeDragging(e,t,r){const n=this.getEventData(e);n.moving&&(this.removeClass("edge-moving"),this.notify("edge:moved",{e:e,x:t,y:r,view:this,cell:this.cell,edge:this.cell})),n.moving=!1}prepareArrowheadDragging(e,t){const r=this.getTerminalMagnet(e),n={action:"drag-arrowhead",x:t.x,y:t.y,isNewEdge:!0===t.isNewEdge,terminalType:e,initialMagnet:r,initialTerminal:clone(this.cell[e]),fallbackAction:t.fallbackAction||"revert",getValidateConnectionArgs:this.createValidateConnectionArgs(e),options:t.options};return this.beforeArrowheadDragging(n),n}createValidateConnectionArgs(e){const t=[];let r;t[4]=e,t[5]=this;let n=0,i=0;"source"===e?(n=2,r="target"):(i=2,r="source");const o=this.cell[r],a=o.cell;if(a){let e;const r=t[n]=this.graph.findViewByCell(a);r&&(e=r.getMagnetFromEdgeTerminal(o),e===r.container&&(e=void 0)),t[n+1]=e}return(e,r)=>(t[i]=e,t[i+1]=e.container===r?void 0:r,t)}beforeArrowheadDragging(e){e.zIndex=this.cell.zIndex,this.cell.toFront();const t=this.container.style;e.pointerEvents=t.pointerEvents,t.pointerEvents="none",this.graph.options.connecting.highlight&&this.highlightAvailableMagnets(e)}afterArrowheadDragging(e){null!=e.zIndex&&(this.cell.setZIndex(e.zIndex,{ui:!0}),e.zIndex=null);this.container.style.pointerEvents=e.pointerEvents||"",this.graph.options.connecting.highlight&&this.unhighlightAvailableMagnets(e)}validateConnection(e,t,r,n,i,o,a){const s=this.graph.options.connecting,l=s.allowLoop,c=s.allowNode,u=s.allowEdge,d=s.allowPort,p=s.allowMulti,h=s.validateConnection,f=o?o.cell:null,g="target"===i?r:e,m="target"===i?n:t;let v=!0;const y=s=>{const l="source"===i?a?a.port:null:f?f.getSourcePortId():null,c="target"===i?a?a.port:null:f?f.getTargetPortId():null;return call$1(s,this.graph,{edge:f,edgeView:o,sourceView:e,targetView:r,sourcePort:l,targetPort:c,sourceMagnet:t,targetMagnet:n,sourceCell:e?e.cell:null,targetCell:r?r.cell:null,type:i})};if(null!=l&&("boolean"==typeof l?l||e!==r||(v=!1):v=y(l)),v&&null!=d&&("boolean"==typeof d?!d&&m&&(v=!1):v=y(d)),v&&null!=u&&("boolean"==typeof u?!u&&EdgeView.isEdgeView(g)&&(v=!1):v=y(u)),v&&null!=c&&null==m&&("boolean"==typeof c?!c&&NodeView.isNodeView(g)&&(v=!1):v=y(c)),v&&null!=p&&o){const e=o.cell,t="source"===i?a:e.getSource(),r="target"===i?a:e.getTarget(),n=a?this.graph.getCellById(a.cell):null;if(t&&r&&t.cell&&r.cell&&n)if("function"==typeof p)v=y(p);else{const e=this.graph.model.getConnectedEdges(n,{outgoing:"source"===i,incoming:"target"===i});if(e.length)if("withPort"===p){e.some(e=>{const n=e.getSource(),i=e.getTarget();return n&&i&&n.cell===t.cell&&i.cell===r.cell&&null!=n.port&&n.port===t.port&&null!=i.port&&i.port===r.port})&&(v=!1)}else if(!p){e.some(e=>{const n=e.getSource(),i=e.getTarget();return n&&i&&n.cell===t.cell&&i.cell===r.cell})&&(v=!1)}}}return v&&null!=h&&(v=y(h)),v}allowConnectToBlank(e){const t=this.graph,r=t.options.connecting.allowBlank;if("function"!=typeof r)return!!r;const n=t.findViewByCell(e),i=e.getSourceCell(),o=e.getTargetCell(),a=t.findViewByCell(i),s=t.findViewByCell(o);return call$1(r,t,{edge:e,edgeView:n,sourceCell:i,targetCell:o,sourceView:a,targetView:s,sourcePort:e.getSourcePortId(),targetPort:e.getTargetPortId(),sourceMagnet:n.sourceMagnet,targetMagnet:n.targetMagnet})}validateEdge(e,t,r){const n=this.graph;if(!this.allowConnectToBlank(e)){const t=e.getSourceCellId(),r=e.getTargetCellId();if(!t||!r)return!1}const i=n.options.connecting.validateEdge;return!i||call$1(i,n,{edge:e,type:t,previous:r})}arrowheadDragging(e,t,r,n){n.x=t,n.y=r,n.currentTarget!==e&&(n.currentMagnet&&n.currentView&&n.currentView.unhighlight(n.currentMagnet,{type:"magnetAdsorbed"}),n.currentView=this.graph.findViewByElem(e),n.currentView?(n.currentMagnet=n.currentView.findMagnet(e),n.currentMagnet&&this.validateConnection(...n.getValidateConnectionArgs(n.currentView,n.currentMagnet),n.currentView.getEdgeTerminal(n.currentMagnet,t,r,this.cell,n.terminalType))?n.currentView.highlight(n.currentMagnet,{type:"magnetAdsorbed"}):n.currentMagnet=null):n.currentMagnet=null),n.currentTarget=e,this.cell.prop(n.terminalType,{x:t,y:r},Object.assign(Object.assign({},n.options),{ui:!0}))}arrowheadDragged(e,t,r){const n=e.currentView,i=e.currentMagnet;if(!i||!n)return;n.unhighlight(i,{type:"magnetAdsorbed"});const o=e.terminalType,a=n.getEdgeTerminal(i,t,r,this.cell,o);this.cell.setTerminal(o,a,{ui:!0})}snapArrowhead(e,t,r){const n=this.graph,{snap:i,allowEdge:o}=n.options.connecting,a="object"==typeof i&&i.radius||50,s="object"==typeof i&&i.anchor||"center",l=n.renderer.findViewsInArea({x:e-a,y:t-a,width:2*a,height:2*a},{nodeOnly:!0});if(o){const r=n.renderer.findEdgeViewsFromPoint({x:e,y:t},a).filter(e=>e!==this);l.push(...r)}const c=r.closestView||null,u=r.closestMagnet||null;let d;r.closestView=null,r.closestMagnet=null;let p=Number.MAX_SAFE_INTEGER;const h=new Point(e,t);let f;l.forEach(n=>{if("false"!==n.container.getAttribute("magnet")){if(n.isNodeView())d="center"===s?n.cell.getBBox().getCenter().distance(h):n.cell.getBBox().getNearestPointToPoint(h).distance(h);else if(n.isEdgeView()){const e=n.getClosestPoint(h);d=e?e.distance(h):Number.MAX_SAFE_INTEGER}d<a&&d<p&&(u===n.container||this.validateConnection(...r.getValidateConnectionArgs(n,null),n.getEdgeTerminal(n.container,e,t,this.cell,r.terminalType)))&&(p=d,r.closestView=n,r.closestMagnet=n.container)}n.container.querySelectorAll("[magnet]").forEach(i=>{if("false"!==i.getAttribute("magnet")){const o=n.getBBoxOfElement(i);d=h.distance(o.getCenter()),d<a&&d<p&&(u===i||this.validateConnection(...r.getValidateConnectionArgs(n,i),n.getEdgeTerminal(i,e,t,this.cell,r.terminalType)))&&(p=d,r.closestView=n,r.closestMagnet=i)}})});const g=r.terminalType,m=r.closestView,v=r.closestMagnet,y=u!==v;if(c&&y&&c.unhighlight(u,{type:"magnetAdsorbed"}),m){if(!y)return;m.highlight(v,{type:"magnetAdsorbed"}),f=m.getEdgeTerminal(v,e,t,this.cell,g)}else f={x:e,y:t};this.cell.setTerminal(g,f,{},Object.assign(Object.assign({},r.options),{ui:!0}))}snapArrowheadEnd(e){const t=e.closestView,r=e.closestMagnet;t&&r&&(t.unhighlight(r,{type:"magnetAdsorbed"}),e.currentMagnet=t.findMagnet(r)),e.closestView=null,e.closestMagnet=null}finishEmbedding(e){this.graph.options.embedding.enabled&&this.cell.updateParent()&&(e.zIndex=null)}fallbackConnection(e){if("remove"===e.fallbackAction)this.cell.remove({ui:!0});else this.cell.prop(e.terminalType,e.initialTerminal,{ui:!0})}notifyConnectionEvent(e,t){const r=e.terminalType,n=e.initialTerminal,i=this.cell[r];if(i&&!Edge$1.equalTerminals(n,i)){const o=this.graph,a=n,s=a.cell?o.getCellById(a.cell):null,l=a.port,c=s?o.findViewByCell(s):null,u=s||e.isNewEdge?null:Point.create(n).toJSON(),d=i,p=d.cell?o.getCellById(d.cell):null,h=d.port,f=p?o.findViewByCell(p):null,g=p?null:Point.create(i).toJSON();this.notify("edge:connected",{e:t,previousCell:s,previousPort:l,previousView:c,previousPoint:u,currentCell:p,currentView:f,currentPort:h,currentPoint:g,previousMagnet:e.initialMagnet,currentMagnet:e.currentMagnet,edge:this.cell,view:this,type:r,isNew:e.isNewEdge})}}highlightAvailableMagnets(e){const t=this.graph,r=t.model.getCells();e.marked={};for(let n=0,i=r.length;n<i;n+=1){const i=t.findViewByCell(r[n]);if(!i||i.cell.id===this.cell.id)continue;const o=Array.prototype.slice.call(i.container.querySelectorAll("[magnet]"));"false"!==i.container.getAttribute("magnet")&&o.push(i.container);const a=o.filter(t=>this.validateConnection(...e.getValidateConnectionArgs(i,t),i.getEdgeTerminal(t,e.x,e.y,this.cell,e.terminalType)));if(a.length>0){for(let e=0,t=a.length;e<t;e+=1)i.highlight(a[e],{type:"magnetAvailable"});i.highlight(null,{type:"nodeAvailable"}),e.marked[i.cell.id]=a}}}unhighlightAvailableMagnets(e){const t=e.marked||{};Object.keys(t).forEach(e=>{const r=this.graph.findViewByCell(e);if(r){t[e].forEach(e=>{r.unhighlight(e,{type:"magnetAvailable"})}),r.unhighlight(null,{type:"nodeAvailable"})}}),e.marked=null}startArrowheadDragging(e,t,r){if(!this.can("arrowheadMovable"))return void this.notifyUnhandledMouseDown(e,t,r);const n=e.target.getAttribute("data-terminal"),i=this.prepareArrowheadDragging(n,{x:t,y:r});this.setEventData(e,i)}dragArrowhead(e,t,r){const n=this.getEventData(e);this.graph.options.connecting.snap?this.snapArrowhead(t,r,n):this.arrowheadDragging(this.getEventTarget(e),t,r,n)}stopArrowheadDragging(e,t,r){const n=this.graph,i=this.getEventData(e);n.options.connecting.snap?this.snapArrowheadEnd(i):this.arrowheadDragged(i,t,r);this.validateEdge(this.cell,i.terminalType,i.initialTerminal)?(this.finishEmbedding(i),this.notifyConnectionEvent(i,e)):this.fallbackConnection(i),this.afterArrowheadDragging(i)}startLabelDragging(e,t,r){if(this.can("edgeLabelMovable")){const t=e.currentTarget,r=parseInt(t.getAttribute("data-index"),10),n=this.getLabelPositionAngle(r),i=this.getLabelPositionArgs(r),o=this.getDefaultLabelPositionArgs(),a=this.mergeLabelPositionArgs(i,o);this.setEventData(e,{index:r,positionAngle:n,positionArgs:a,stopPropagation:!0,action:"drag-label"})}else this.setEventData(e,{stopPropagation:!0});this.graph.view.delegateDragEvents(e,this)}dragLabel(e,t,r){const n=this.getEventData(e),i=this.cell.getLabelAt(n.index),o=merge$2({},i,{position:this.getLabelPosition(t,r,n.positionAngle,n.positionArgs)});this.cell.setLabelAt(n.index,o)}stopLabelDragging(e,t,r){}}EdgeView2=EdgeView||(EdgeView={}),EdgeView2.toStringTag=`X6.${EdgeView2.name}`,EdgeView2.isEdgeView=function(e){if(null==e)return!1;if(e instanceof EdgeView2)return!0;const t=e[Symbol.toStringTag],r=e;return(null==t||t===EdgeView2.toStringTag)&&"function"==typeof r.isNodeView&&"function"==typeof r.isEdgeView&&"function"==typeof r.confirmUpdate&&"function"==typeof r.update&&"function"==typeof r.getConnection},EdgeView.config({isSvgElement:!0,priority:1,bootstrap:["render","source","target"],actions:{view:["render"],markup:["render"],attrs:["update"],source:["source","update"],target:["target","update"],router:["update"],connector:["update"],labels:["labels"],defaultLabel:["labels"],tools:["tools"],vertices:["vertices","update"]}}),EdgeView.registry.register("edge",EdgeView,!0);var __decorate$o=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class GraphView extends View{get disposeContainer(){return!1}get options(){return this.graph.options}constructor(e){super(),this.graph=e;const{selectors:t,fragment:r}=Markup.parseJSONMarkup(GraphView.markup);this.background=t.background,this.grid=t.grid,this.svg=t.svg,this.defs=t.defs,this.viewport=t.viewport,this.primer=t.primer,this.stage=t.stage,this.decorator=t.decorator,this.overlay=t.overlay,this.container=this.options.container,this.restore=GraphView.snapshoot(this.container),addClass(this.container,this.prefixClassName("graph")),append(this.container,r),this.delegateEvents()}delegateEvents(){const e=this.constructor;return super.delegateEvents(e.events),this}guard(e,t){return"mousedown"===e.type&&2===e.button||(!(!this.options.guard||!this.options.guard(e,t))||(e.data&&void 0!==e.data.guarded?e.data.guarded:!(t&&t.cell&&Cell.isCell(t.cell))&&(this.svg!==e.target&&this.container!==e.target&&!this.svg.contains(e.target))))}findView(e){return this.graph.findViewByElem(e)}onDblClick(e){this.options.preventDefaultDblClick&&e.preventDefault();const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.guard(t,r))return;const n=this.graph.snapToGrid(t.clientX,t.clientY);r?r.onDblClick(t,n.x,n.y):this.graph.trigger("blank:dblclick",{e:t,x:n.x,y:n.y})}onClick(e){if(this.getMouseMovedCount(e)<=this.options.clickThreshold){const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.guard(t,r))return;const n=this.graph.snapToGrid(t.clientX,t.clientY);r?r.onClick(t,n.x,n.y):this.graph.trigger("blank:click",{e:t,x:n.x,y:n.y})}}isPreventDefaultContextMenu(e){let t=this.options.preventDefaultContextMenu;return"function"==typeof t&&(t=call$1(t,this.graph,{view:e})),t}onContextMenu(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.isPreventDefaultContextMenu(r)&&e.preventDefault(),this.guard(t,r))return;const n=this.graph.snapToGrid(t.clientX,t.clientY);r?r.onContextMenu(t,n.x,n.y):this.graph.trigger("blank:contextmenu",{e:t,x:n.x,y:n.y})}delegateDragEvents(e,t){null==e.data&&(e.data={}),this.setEventData(e,{currentView:t||null,mouseMovedCount:0,startPosition:{x:e.clientX,y:e.clientY}});const r=this.constructor;this.delegateDocumentEvents(r.documentEvents,e.data),this.undelegateEvents()}getMouseMovedCount(e){return this.getEventData(e).mouseMovedCount||0}onMouseDown(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.guard(t,r))return;this.options.preventDefaultMouseDown&&e.preventDefault();const n=this.graph.snapToGrid(t.clientX,t.clientY);r?r.onMouseDown(t,n.x,n.y):(this.options.preventDefaultBlankAction&&["touchstart"].includes(t.type)&&e.preventDefault(),this.graph.trigger("blank:mousedown",{e:t,x:n.x,y:n.y})),this.delegateDragEvents(t,r)}onMouseMove(e){const t=this.getEventData(e),r=t.startPosition;if(r&&r.x===e.clientX&&r.y===e.clientY)return;null==t.mouseMovedCount&&(t.mouseMovedCount=0),t.mouseMovedCount+=1;if(t.mouseMovedCount<=this.options.moveThreshold)return;const n=this.normalizeEvent(e),i=this.graph.snapToGrid(n.clientX,n.clientY),o=t.currentView;o?o.onMouseMove(n,i.x,i.y):this.graph.trigger("blank:mousemove",{e:n,x:i.x,y:i.y}),this.setEventData(n,t)}onMouseUp(e){this.undelegateDocumentEvents();const t=this.normalizeEvent(e),r=this.graph.snapToGrid(t.clientX,t.clientY),n=this.getEventData(e).currentView;if(n?n.onMouseUp(t,r.x,r.y):this.graph.trigger("blank:mouseup",{e:t,x:r.x,y:r.y}),!e.isPropagationStopped()){const t=new EventObject(e,{type:"click",data:e.data});this.onClick(t)}e.stopImmediatePropagation(),this.delegateEvents()}onMouseOver(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(!this.guard(t,r))if(r)r.onMouseOver(t);else{if(this.container===t.target)return;this.graph.trigger("blank:mouseover",{e:t})}}onMouseOut(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(!this.guard(t,r))if(r)r.onMouseOut(t);else{if(this.container===t.target)return;this.graph.trigger("blank:mouseout",{e:t})}}onMouseEnter(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.guard(t,r))return;const n=this.graph.findViewByElem(t.relatedTarget);if(r){if(n===r)return;r.onMouseEnter(t)}else{if(n)return;this.graph.trigger("graph:mouseenter",{e:t})}}onMouseLeave(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.guard(t,r))return;const n=this.graph.findViewByElem(t.relatedTarget);if(r){if(n===r)return;r.onMouseLeave(t)}else{if(n)return;this.graph.trigger("graph:mouseleave",{e:t})}}onMouseWheel(e){const t=this.normalizeEvent(e),r=this.findView(t.target);if(this.guard(t,r))return;const n=t.originalEvent,i=this.graph.snapToGrid(n.clientX,n.clientY),o=Math.max(-1,Math.min(1,n.wheelDelta||-n.detail));r?r.onMouseWheel(t,i.x,i.y,o):this.graph.trigger("blank:mousewheel",{e:t,delta:o,x:i.x,y:i.y})}onCustomEvent(e){const t=e.currentTarget,r=t.getAttribute("event")||t.getAttribute("data-event");if(r){const n=this.findView(t);if(n){const t=this.normalizeEvent(e);if(this.guard(t,n))return;const i=this.graph.snapToGrid(t.clientX,t.clientY);n.onCustomEvent(t,r,i.x,i.y)}}}handleMagnetEvent(e,t){const r=e.currentTarget,n=r.getAttribute("magnet");if(n&&"false"!==n.toLowerCase()){const n=this.findView(r);if(n){const i=this.normalizeEvent(e);if(this.guard(i,n))return;const o=this.graph.snapToGrid(i.clientX,i.clientY);call$1(t,this.graph,n,i,r,o.x,o.y)}}}onMagnetMouseDown(e){this.handleMagnetEvent(e,(e,t,r,n,i)=>{e.onMagnetMouseDown(t,r,n,i)})}onMagnetDblClick(e){this.handleMagnetEvent(e,(e,t,r,n,i)=>{e.onMagnetDblClick(t,r,n,i)})}onMagnetContextMenu(e){const t=this.findView(e.target);this.isPreventDefaultContextMenu(t)&&e.preventDefault(),this.handleMagnetEvent(e,(e,t,r,n,i)=>{e.onMagnetContextMenu(t,r,n,i)})}onLabelMouseDown(e){const t=e.currentTarget,r=this.findView(t);if(r){const t=this.normalizeEvent(e);if(this.guard(t,r))return;const n=this.graph.snapToGrid(t.clientX,t.clientY);r.onLabelMouseDown(t,n.x,n.y)}}onImageDragStart(){return!1}dispose(){this.undelegateEvents(),this.undelegateDocumentEvents(),this.restore(),this.restore=()=>{}}}__decorate$o([View.dispose()],GraphView.prototype,"dispose",null),function(e){const t=`${Config.prefixCls}-graph`;e.markup=[{ns:ns.xhtml,tagName:"div",selector:"background",className:`${t}-background`},{ns:ns.xhtml,tagName:"div",selector:"grid",className:`${t}-grid`},{ns:ns.svg,tagName:"svg",selector:"svg",className:`${t}-svg`,attrs:{width:"100%",height:"100%","xmlns:xlink":ns.xlink},children:[{tagName:"defs",selector:"defs"},{tagName:"g",selector:"viewport",className:`${t}-svg-viewport`,children:[{tagName:"g",selector:"primer",className:`${t}-svg-primer`},{tagName:"g",selector:"stage",className:`${t}-svg-stage`},{tagName:"g",selector:"decorator",className:`${t}-svg-decorator`},{tagName:"g",selector:"overlay",className:`${t}-svg-overlay`}]}]}],e.snapshoot=function(e){const t=e.cloneNode();return e.childNodes.forEach(e=>t.appendChild(e)),()=>{for(empty$2(e);e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);for(let r=0,n=t.attributes.length;r<n;r+=1){const n=t.attributes[r];e.setAttribute(n.name,n.value)}t.childNodes.forEach(t=>e.appendChild(t))}}}(GraphView||(GraphView={})),function(e){const t=Config.prefixCls;e.events={dblclick:"onDblClick",contextmenu:"onContextMenu",touchstart:"onMouseDown",mousedown:"onMouseDown",mouseover:"onMouseOver",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",DOMMouseScroll:"onMouseWheel",[`mouseenter .${t}-cell`]:"onMouseEnter",[`mouseleave .${t}-cell`]:"onMouseLeave",[`mouseenter .${t}-cell-tools`]:"onMouseEnter",[`mouseleave .${t}-cell-tools`]:"onMouseLeave",[`mousedown .${t}-cell [event]`]:"onCustomEvent",[`touchstart .${t}-cell [event]`]:"onCustomEvent",[`mousedown .${t}-cell [data-event]`]:"onCustomEvent",[`touchstart .${t}-cell [data-event]`]:"onCustomEvent",[`dblclick .${t}-cell [magnet]`]:"onMagnetDblClick",[`contextmenu .${t}-cell [magnet]`]:"onMagnetContextMenu",[`mousedown .${t}-cell [magnet]`]:"onMagnetMouseDown",[`touchstart .${t}-cell [magnet]`]:"onMagnetMouseDown",[`dblclick .${t}-cell [data-magnet]`]:"onMagnetDblClick",[`contextmenu .${t}-cell [data-magnet]`]:"onMagnetContextMenu",[`mousedown .${t}-cell [data-magnet]`]:"onMagnetMouseDown",[`touchstart .${t}-cell [data-magnet]`]:"onMagnetMouseDown",[`dragstart .${t}-cell image`]:"onImageDragStart",[`mousedown .${t}-edge .${t}-edge-label`]:"onLabelMouseDown",[`touchstart .${t}-edge .${t}-edge-label`]:"onLabelMouseDown"},e.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}}(GraphView||(GraphView={}));const content$5=".x6-graph {\n position: relative;\n overflow: hidden;\n outline: none;\n touch-action: none;\n}\n.x6-graph-background,\n.x6-graph-grid,\n.x6-graph-svg {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n.x6-graph-background-stage,\n.x6-graph-grid-stage,\n.x6-graph-svg-stage {\n user-select: none;\n}\n.x6-graph.x6-graph-pannable {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n.x6-graph.x6-graph-panning {\n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n user-select: none;\n}\n.x6-node {\n cursor: move;\n /* stylelint-disable-next-line */\n}\n.x6-node.x6-node-immovable {\n cursor: default;\n}\n.x6-node * {\n -webkit-user-drag: none;\n}\n.x6-node .scalable * {\n vector-effect: non-scaling-stroke;\n}\n.x6-node [magnet='true'] {\n cursor: crosshair;\n transition: opacity 0.3s;\n}\n.x6-node [magnet='true']:hover {\n opacity: 0.7;\n}\n.x6-node foreignObject {\n display: block;\n overflow: visible;\n background-color: transparent;\n}\n.x6-node foreignObject > body {\n position: static;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n overflow: visible;\n background-color: transparent;\n}\n.x6-edge .source-marker,\n.x6-edge .target-marker {\n vector-effect: non-scaling-stroke;\n}\n.x6-edge .connection {\n stroke-linejoin: round;\n fill: none;\n}\n.x6-edge .connection-wrap {\n cursor: move;\n opacity: 0;\n fill: none;\n stroke: #000;\n stroke-width: 15;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n.x6-edge .connection-wrap:hover {\n opacity: 0.4;\n stroke-opacity: 0.4;\n}\n.x6-edge .vertices {\n cursor: move;\n opacity: 0;\n}\n.x6-edge .vertices .vertex {\n fill: #1abc9c;\n}\n.x6-edge .vertices .vertex :hover {\n fill: #34495e;\n stroke: none;\n}\n.x6-edge .vertices .vertex-remove {\n cursor: pointer;\n fill: #fff;\n}\n.x6-edge .vertices .vertex-remove-area {\n cursor: pointer;\n opacity: 0.1;\n}\n.x6-edge .vertices .vertex-group:hover .vertex-remove-area {\n opacity: 1;\n}\n.x6-edge .arrowheads {\n cursor: move;\n opacity: 0;\n}\n.x6-edge .arrowheads .arrowhead {\n fill: #1abc9c;\n}\n.x6-edge .arrowheads .arrowhead :hover {\n fill: #f39c12;\n stroke: none;\n}\n.x6-edge .tools {\n cursor: pointer;\n opacity: 0;\n}\n.x6-edge .tools .tool-options {\n display: none;\n}\n.x6-edge .tools .tool-remove circle {\n fill: #f00;\n}\n.x6-edge .tools .tool-remove path {\n fill: #fff;\n}\n.x6-edge:hover .vertices,\n.x6-edge:hover .arrowheads,\n.x6-edge:hover .tools {\n opacity: 1;\n}\n.x6-highlight-opacity {\n opacity: 0.3;\n}\n.x6-cell-tool-editor {\n position: relative;\n display: inline-block;\n min-height: 1em;\n margin: 0;\n padding: 0;\n line-height: 1;\n white-space: normal;\n text-align: center;\n vertical-align: top;\n overflow-wrap: normal;\n outline: none;\n transform-origin: 0 0;\n -webkit-user-drag: none;\n}\n.x6-edge-tool-editor {\n border: 1px solid #275fc5;\n border-radius: 2px;\n}\n";class Base extends Disposable{get options(){return this.graph.options}get model(){return this.graph.model}get view(){return this.graph.view}constructor(e){super(),this.graph=e,this.init()}init(){}}var __decorate$n=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class CSSManager extends Base{init(){ensure("core",content$5)}dispose(){clean("core")}}__decorate$n([CSSManager.dispose()],CSSManager.prototype,"dispose",null);var __rest$5=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},Options,Options2;Options2=Options||(Options={}),Options2.get=function(e){const{grid:t,panning:r,mousewheel:n,embedding:i}=e,o=__rest$5(e,["grid","panning","mousewheel","embedding"]),a=e.container;if(null==a)throw new Error("Ensure the container of the graph is specified and valid");null==o.width&&(o.width=a.clientWidth),null==o.height&&(o.height=a.clientHeight);const s=merge$2({},Options2.defaults,o),l={size:10,visible:!1};return s.grid="number"==typeof t?{size:t,visible:!1}:"boolean"==typeof t?Object.assign(Object.assign({},l),{visible:t}):Object.assign(Object.assign({},l),t),["panning","mousewheel","embedding"].forEach(t=>{const r=e[t];"boolean"==typeof r?s[t].enabled=r:s[t]=Object.assign(Object.assign({},s[t]),r)}),s},function(e){e.defaults={x:0,y:0,scaling:{min:.01,max:16},grid:{size:10,visible:!1},background:!1,panning:{enabled:!1,eventTypes:["leftMouseDown"]},mousewheel:{enabled:!1,factor:1.2,zoomAtMousePosition:!0},highlighting:{default:{name:"stroke",args:{padding:3}},nodeAvailable:{name:"className",args:{className:Config.prefix("available-node")}},magnetAvailable:{name:"className",args:{className:Config.prefix("available-magnet")}}},connecting:{snap:!1,allowLoop:!0,allowNode:!0,allowEdge:!1,allowPort:!0,allowBlank:!0,allowMulti:!0,highlight:!1,anchor:"center",edgeAnchor:"ratio",connectionPoint:"boundary",router:"normal",connector:"normal",validateConnection:({type:e,sourceView:t,targetView:r})=>null!=("target"===e?r:t),createEdge:()=>new Edge},translating:{restrict:!1},embedding:{enabled:!1,findParent:"bbox",frontOnly:!0,validate:()=>!0},moveThreshold:0,clickThreshold:0,magnetThreshold:0,preventDefaultDblClick:!0,preventDefaultMouseDown:!1,preventDefaultContextMenu:!0,preventDefaultBlankAction:!0,interacting:{edgeLabelMovable:!1},async:!0,virtual:!1,guard:()=>!1}}(Options||(Options={}));var __decorate$m=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},__rest$4=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};class GridManager extends Base{get elem(){return this.view.grid}get grid(){return this.options.grid}init(){this.startListening(),this.draw(this.grid)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}setVisible(e){this.grid.visible!==e&&(this.grid.visible=e,this.update())}getGridSize(){return this.grid.size}setGridSize(e){this.grid.size=Math.max(e,1),this.update()}show(){this.setVisible(!0),this.update()}hide(){this.setVisible(!1),this.update()}clear(){this.elem.style.backgroundImage=""}draw(e){this.clear(),this.instance=null,Object.assign(this.grid,e),this.patterns=this.resolveGrid(e),this.update()}update(e={}){const t=this.grid.size;if(t<=1||!this.grid.visible)return this.clear();const r=this.graph.matrix(),n=this.getInstance(),i=Array.isArray(e)?e:[e];this.patterns.forEach((e,o)=>{const a=`pattern_${o}`,s=r.a||1,l=r.d||1,{update:c,markup:u}=e,d=__rest$4(e,["update","markup"]),p=Object.assign(Object.assign(Object.assign({},d),i[o]),{sx:s,sy:l,ox:r.e||0,oy:r.f||0,width:t*s,height:t*l});n.has(a)||n.add(a,Vector.create("pattern",{id:a,patternUnits:"userSpaceOnUse"},Vector.createVectors(u)).node);const h=n.get(a);"function"==typeof c&&c(h.childNodes[0],p);let f=p.ox%p.width;f<0&&(f+=p.width);let g=p.oy%p.height;g<0&&(g+=p.height),attr(h,{x:f,y:g,width:p.width,height:p.height})});const o=(new XMLSerializer).serializeToString(n.root),a=`url(data:image/svg+xml;base64,${btoa(o)})`;this.elem.style.backgroundImage=a}getInstance(){return this.instance||(this.instance=new Grid),this.instance}resolveGrid(e){if(!e)return[];const t=e.type;if(null==t)return[Object.assign(Object.assign({},Grid.presets.dot),e.args)];const r=Grid.registry.get(t);if(r){let t=e.args||[];return Array.isArray(t)||(t=[t]),Array.isArray(r)?r.map((e,r)=>Object.assign(Object.assign({},e),t[r])):[Object.assign(Object.assign({},r),t[0])]}return Grid.registry.onNotFound(t)}dispose(){this.stopListening(),this.clear()}}__decorate$m([Base.dispose()],GridManager.prototype,"dispose",null);class TransformManager extends Base{get container(){return this.graph.view.container}get viewport(){return this.graph.view.viewport}get stage(){return this.graph.view.stage}init(){this.resize()}getMatrix(){const e=this.viewport.getAttribute("transform");return e!==this.viewportTransformString&&(this.viewportMatrix=this.viewport.getCTM(),this.viewportTransformString=e),createSVGMatrix(this.viewportMatrix)}setMatrix(e){const t=createSVGMatrix(e);t.a=Number.isFinite(t.a)?t.a:1,t.b=Number.isFinite(t.b)?t.b:0,t.c=Number.isFinite(t.c)?t.c:0,t.d=Number.isFinite(t.d)?t.d:1,t.e=Number.isFinite(t.e)?t.e:0,t.f=Number.isFinite(t.f)?t.f:0;const r=matrixToTransformString(t);this.viewport.setAttribute("transform",r),this.viewportMatrix=t,this.viewportTransformString=r}resize(e,t){let r=void 0===e?this.options.width:e,n=void 0===t?this.options.height:t;this.options.width=r,this.options.height=n,"number"==typeof r&&(r=Math.round(r)),"number"==typeof n&&(n=Math.round(n)),this.container.style.width=null==r?"":`${r}px`,this.container.style.height=null==n?"":`${n}px`;const i=this.getComputedSize();return this.graph.trigger("resize",Object.assign({},i)),this}getComputedSize(){let e=this.options.width,t=this.options.height;return isNumber(e)||(e=this.container.clientWidth),isNumber(t)||(t=this.container.clientHeight),{width:e,height:t}}getScale(){return matrixToScale(this.getMatrix())}scale(e,t=e,r=0,n=0){if(e=this.clampScale(e),t=this.clampScale(t),r||n){const i=this.getTranslation(),o=i.tx-r*(e-1),a=i.ty-n*(t-1);o===i.tx&&a===i.ty||this.translate(o,a)}const i=this.getMatrix(),o=Number.isFinite(e)?e:1,a=Number.isFinite(t)?t:1;return i.a=o,i.d=a,this.setMatrix(i),this.graph.trigger("scale",{sx:o,sy:a,ox:r,oy:n}),this}clampScale(e){const t=this.graph.options.scaling;return clamp(e,t.min||.01,t.max||16)}getZoom(){return this.getScale().sx}zoom(e,t){t=t||{};let r=e,n=e;const i=this.getScale(),o=this.getComputedSize();let a=o.width/2,s=o.height/2;if(t.absolute||(r+=i.sx,n+=i.sy),t.scaleGrid&&(r=Math.round(r/t.scaleGrid)*t.scaleGrid,n=Math.round(n/t.scaleGrid)*t.scaleGrid),t.maxScale&&(r=Math.min(t.maxScale,r),n=Math.min(t.maxScale,n)),t.minScale&&(r=Math.max(t.minScale,r),n=Math.max(t.minScale,n)),t.center&&(a=t.center.x,s=t.center.y),r=this.clampScale(r),n=this.clampScale(n),r=Number.isFinite(r)?r:i.sx,n=Number.isFinite(n)?n:i.sy,a||s){const e=this.getTranslation(),t=0===i.sx?1:i.sx,o=0===i.sy?1:i.sy,l=a-(a-e.tx)*(r/t),c=s-(s-e.ty)*(n/o);l===e.tx&&c===e.ty||this.translate(l,c)}return this.scale(r,n),this}getRotation(){return matrixToRotation(this.getMatrix())}rotate(e,t,r){if(null==t||null==r){const e=Util$1.getBBox(this.stage);t=e.width/2,r=e.height/2}const n=this.getMatrix().translate(t,r).rotate(e).translate(-t,-r);return this.setMatrix(n),this}getTranslation(){return matrixToTranslation(this.getMatrix())}translate(e,t){const r=this.getMatrix();r.e=Number.isFinite(e)?e:0,r.f=Number.isFinite(t)?t:0,this.setMatrix(r);const n=this.getTranslation();return this.options.x=n.tx,this.options.y=n.ty,this.graph.trigger("translate",Object.assign({},n)),this}setOrigin(e,t){return this.translate(e||0,t||0)}fitToContent(e,t,r,n){if("object"==typeof e){const i=e;e=i.gridWidth||1,t=i.gridHeight||1,r=i.padding||0,n=i}else e=e||1,t=t||1,r=r||0,null==n&&(n={});const i=normalizeSides(r),o=n.border||0,a=n.contentArea?Rectangle.create(n.contentArea):this.getContentArea(n);o>0&&a.inflate(o);const s=this.getScale(),l=this.getTranslation(),c=s.sx,u=s.sy;a.x*=c,a.y*=u,a.width*=c,a.height*=u;let d=Math.max(Math.ceil((a.width+a.x)/e),1)*e,p=Math.max(Math.ceil((a.height+a.y)/t),1)*t,h=0,f=0;("negative"===n.allowNewOrigin&&a.x<0||"positive"===n.allowNewOrigin&&a.x>=0||"any"===n.allowNewOrigin)&&(h=Math.ceil(-a.x/e)*e,h+=i.left,d+=h),("negative"===n.allowNewOrigin&&a.y<0||"positive"===n.allowNewOrigin&&a.y>=0||"any"===n.allowNewOrigin)&&(f=Math.ceil(-a.y/t)*t,f+=i.top,p+=f),d+=i.right,p+=i.bottom,d=Math.max(d,n.minWidth||0),p=Math.max(p,n.minHeight||0),d=Math.min(d,n.maxWidth||Number.MAX_SAFE_INTEGER),p=Math.min(p,n.maxHeight||Number.MAX_SAFE_INTEGER);const g=this.getComputedSize(),m=d!==g.width||p!==g.height;return(h!==l.tx||f!==l.ty)&&this.translate(h,f),m&&this.resize(d,p),new Rectangle(-h/c,-f/u,d/c,p/u)}scaleContentToFit(e={}){this.scaleContentToFitImpl(e)}scaleContentToFitImpl(e={},t=!0){let r,n;if(e.contentArea){const t=e.contentArea;r=this.graph.localToGraph(t),n=Point.create(t)}else r=this.getContentBBox(e),n=this.graph.graphToLocal(r);if(!r.width||!r.height)return;const i=normalizeSides(e.padding),o=e.minScale||0,a=e.maxScale||Number.MAX_SAFE_INTEGER,s=e.minScaleX||o,l=e.maxScaleX||a,c=e.minScaleY||o,u=e.maxScaleY||a;let d;if(e.viewportArea)d=e.viewportArea;else{const e=this.getComputedSize(),t=this.getTranslation();d={x:t.tx,y:t.ty,width:e.width,height:e.height}}d=Rectangle.create(d).moveAndExpand({x:i.left,y:i.top,width:-i.left-i.right,height:-i.top-i.bottom});const p=this.getScale();let h=d.width/r.width*p.sx,f=d.height/r.height*p.sy;!1!==e.preserveAspectRatio&&(h=f=Math.min(h,f));const g=e.scaleGrid;if(g&&(h=g*Math.floor(h/g),f=g*Math.floor(f/g)),h=clamp(h,s,l),f=clamp(f,c,u),this.scale(h,f),t){const e=this.options,t=d.x-n.x*h-e.x,r=d.y-n.y*f-e.y;this.translate(t,r)}}getContentArea(e={}){return!1!==e.useCellGeometry?this.model.getAllCellsBBox()||new Rectangle:Util$1.getBBox(this.stage)}getContentBBox(e={}){return this.graph.localToGraph(this.getContentArea(e))}getGraphArea(){const e=Rectangle.fromSize(this.getComputedSize());return this.graph.graphToLocal(e)}zoomToRect(e,t={}){const r=Rectangle.create(e),n=this.graph;t.contentArea=r,null==t.viewportArea&&(t.viewportArea={x:n.options.x,y:n.options.y,width:this.options.width,height:this.options.height}),this.scaleContentToFitImpl(t,!1);const i=r.getCenter();return this.centerPoint(i.x,i.y),this}zoomToFit(e={}){return this.zoomToRect(this.getContentArea(e),e)}centerPoint(e,t){const r=this.getComputedSize(),n=this.getScale(),i=this.getTranslation(),o=r.width/2,a=r.height/2;t="number"==typeof t?t:a,e=o-(e="number"==typeof e?e:o)*n.sx,t=a-t*n.sy,i.tx===e&&i.ty===t||this.translate(e,t)}centerContent(e){const t=this.graph.getContentArea(e).getCenter();this.centerPoint(t.x,t.y)}centerCell(e){return this.positionCell(e,"center")}positionPoint(e,t,r){const n=this.getComputedSize();(t=normalizePercentage(t,Math.max(0,n.width)))<0&&(t=n.width+t),(r=normalizePercentage(r,Math.max(0,n.height)))<0&&(r=n.height+r);const i=this.getTranslation(),o=this.getScale(),a=t-e.x*o.sx,s=r-e.y*o.sy;i.tx===a&&i.ty===s||this.translate(a,s)}positionRect(e,t){const r=Rectangle.create(e);switch(t){case"center":return this.positionPoint(r.getCenter(),"50%","50%");case"top":return this.positionPoint(r.getTopCenter(),"50%",0);case"top-right":return this.positionPoint(r.getTopRight(),"100%",0);case"right":return this.positionPoint(r.getRightMiddle(),"100%","50%");case"bottom-right":return this.positionPoint(r.getBottomRight(),"100%","100%");case"bottom":return this.positionPoint(r.getBottomCenter(),"50%","100%");case"bottom-left":return this.positionPoint(r.getBottomLeft(),0,"100%");case"left":return this.positionPoint(r.getLeftMiddle(),0,"50%");case"top-left":return this.positionPoint(r.getTopLeft(),0,0);default:return this}}positionCell(e,t){const r=e.getBBox();return this.positionRect(r,t)}positionContent(e,t){const r=this.graph.getContentArea(t);return this.positionRect(r,e)}}var __decorate$l=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class BackgroundManager extends Base{get elem(){return this.view.background}init(){this.startListening(),this.options.background&&this.draw(this.options.background)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}updateBackgroundImage(e={}){let t=e.size||"auto auto",r=e.position||"center";const n=this.graph.transform.getScale(),i=this.graph.translate();if("object"==typeof r){r=`${i.tx+n.sx*(r.x||0)}px ${i.ty+n.sy*(r.y||0)}px`}"object"==typeof t&&(t=Rectangle.fromSize(t).scale(n.sx,n.sy),t=`${t.width}px ${t.height}px`),this.elem.style.backgroundSize=t,this.elem.style.backgroundPosition=r}drawBackgroundImage(e,t={}){if(!(e instanceof HTMLImageElement))return void(this.elem.style.backgroundImage="");const r=this.optionsCache;if(r&&r.image!==t.image)return;let n;const i=t.opacity,o=t.size;let a=t.repeat||"no-repeat";const s=Background.registry.get(a);if("function"==typeof s){const r=t.quality||1;e.width*=r,e.height*=r;const i=s(e,t);if(!(i instanceof HTMLCanvasElement))throw new Error("Background pattern must return an HTML Canvas instance");n=i.toDataURL("image/png"),a=t.repeat&&a!==t.repeat?t.repeat:"repeat","object"==typeof o?(o.width*=i.width/e.width,o.height*=i.height/e.height):void 0===o&&(t.size={width:i.width/r,height:i.height/r})}else n=e.src,void 0===o&&(t.size={width:e.width,height:e.height});null!=r&&"object"==typeof t.size&&t.image===r.image&&t.repeat===r.repeat&&t.quality===r.quality&&(r.size=clone(t.size));const l=this.elem.style;l.backgroundImage=`url(${n})`,l.backgroundRepeat=a,l.opacity=null==i||i>=1?"":`${i}`,this.updateBackgroundImage(t)}updateBackgroundColor(e){this.elem.style.backgroundColor=e||""}updateBackgroundOptions(e){this.graph.options.background=e}update(){this.optionsCache&&this.updateBackgroundImage(this.optionsCache)}draw(e){const t=e||{};if(this.updateBackgroundOptions(e),this.updateBackgroundColor(t.color),t.image){this.optionsCache=clone(t);const r=document.createElement("img");r.onload=()=>this.drawBackgroundImage(r,e),r.setAttribute("crossorigin","anonymous"),r.src=t.image}else this.drawBackgroundImage(null),this.optionsCache=null}clear(){this.draw()}dispose(){this.clear(),this.stopListening()}}__decorate$l([Base.dispose()],BackgroundManager.prototype,"dispose",null);var __decorate$k=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class PanningManager extends Base{get widgetOptions(){return this.options.panning}get pannable(){return this.widgetOptions&&!0===this.widgetOptions.enabled}init(){this.onRightMouseDown=this.onRightMouseDown.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.startListening(),this.updateClassName()}startListening(){this.graph.on("blank:mousedown",this.onMouseDown,this),this.graph.on("node:unhandled:mousedown",this.onMouseDown,this),this.graph.on("edge:unhandled:mousedown",this.onMouseDown,this),Event$1.on(this.graph.container,"mousedown",this.onRightMouseDown),Event$1.on(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle=new MouseWheelHandle(this.graph.container,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.mousewheelHandle.enable()}stopListening(){this.graph.off("blank:mousedown",this.onMouseDown,this),this.graph.off("node:unhandled:mousedown",this.onMouseDown,this),this.graph.off("edge:unhandled:mousedown",this.onMouseDown,this),Event$1.off(this.graph.container,"mousedown",this.onRightMouseDown),Event$1.off(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle&&this.mousewheelHandle.disable()}allowPanning(e,t){return e.spaceKey=this.isSpaceKeyPressed,this.pannable&&ModifierKey.isMatch(e,this.widgetOptions.modifiers,t)}startPanning(e){const t=this.view.normalizeEvent(e);this.clientX=t.clientX,this.clientY=t.clientY,this.panning=!0,this.updateClassName(e),Event$1.on(document.body,{"mousemove.panning touchmove.panning":this.pan.bind(this),"mouseup.panning touchend.panning":this.stopPanning.bind(this),"mouseleave.panning":this.stopPanning.bind(this)}),Event$1.on(window,"mouseup.panning",this.stopPanning.bind(this))}pan(e){const t=this.view.normalizeEvent(e),r=t.clientX-this.clientX,n=t.clientY-this.clientY;this.clientX=t.clientX,this.clientY=t.clientY,this.graph.translateBy(r,n)}stopPanning(e){this.panning=!1,this.updateClassName(e),Event$1.off(document.body,".panning"),Event$1.off(window,".panning")}updateClassName(e){const t=this.widgetOptions.eventTypes;if(1===(null==t?void 0:t.length)&&t.includes("mouseWheel"))return;const r=this.view.container,n=this.view.prefixClassName("graph-panning"),i=this.view.prefixClassName("graph-pannable"),o=this.graph.getPlugin("selection"),a=o&&o.allowRubberband(e,!0),s=(null==t?void 0:t.includes("leftMouseDown"))&&!a;this.allowPanning(null!=e?e:{},!0)||this.allowPanning(null!=e?e:{})&&s?this.panning?(addClass(r,n),removeClass(r,i)):(removeClass(r,n),addClass(r,i)):this.panning||(removeClass(r,n),removeClass(r,i))}onMouseDown({e:e}){if(!this.allowBlankMouseDown(e))return;const t=this.graph.getPlugin("selection"),r=t&&t.allowRubberband(e,!0);(this.allowPanning(e,!0)||this.allowPanning(e)&&!r)&&this.startPanning(e)}onRightMouseDown(e){const t=this.widgetOptions.eventTypes;(null==t?void 0:t.includes("rightMouseDown"))&&2===e.button&&this.allowPanning(e,!0)&&this.startPanning(e)}onMouseWheel(e,t,r){this.graph.translateBy(-t,-r)}onKeyDown(e){32===e.which&&(this.isSpaceKeyPressed=!0),this.updateClassName(e)}onKeyUp(e){32===e.which&&(this.isSpaceKeyPressed=!1),this.updateClassName(e)}allowBlankMouseDown(e){const t=this.widgetOptions.eventTypes;return(null==t?void 0:t.includes("leftMouseDown"))&&0===e.button||(null==t?void 0:t.includes("mouseWheelDown"))&&1===e.button}allowMouseWheel(e){var t;return this.pannable&&!e.ctrlKey&&(null===(t=this.widgetOptions.eventTypes)||void 0===t?void 0:t.includes("mouseWheel"))}autoPanning(e,t){const r=10,n=this.graph.getGraphArea();let i=0,o=0;e<=n.left+r&&(i=-10),t<=n.top+r&&(o=-10),e>=n.right-r&&(i=r),t>=n.bottom-r&&(o=r),0===i&&0===o||this.graph.translateBy(-i,-o)}enablePanning(){this.pannable||(this.widgetOptions.enabled=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.widgetOptions.enabled=!1,this.updateClassName())}dispose(){this.stopListening()}}__decorate$k([Base.dispose()],PanningManager.prototype,"dispose",null);var __decorate$j=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class MouseWheel extends Base{constructor(){super(...arguments),this.cumulatedFactor=1}get widgetOptions(){return this.options.mousewheel}init(){this.container=this.graph.container,this.target=this.widgetOptions.global?document:this.container,this.mousewheelHandle=new MouseWheelHandle(this.target,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.widgetOptions.enabled&&this.enable(!0)}get disabled(){return!0!==this.widgetOptions.enabled}enable(e){(this.disabled||e)&&(this.widgetOptions.enabled=!0,this.mousewheelHandle.enable())}disable(){this.disabled||(this.widgetOptions.enabled=!1,this.mousewheelHandle.disable())}allowMouseWheel(e){const t=this.widgetOptions.guard;return(null==t||t(e))&&ModifierKey.isMatch(e,this.widgetOptions.modifiers)}onMouseWheel(e){const t=this.widgetOptions.guard;if((null==t||t(e))&&ModifierKey.isMatch(e,this.widgetOptions.modifiers)){const t=this.widgetOptions.factor||1.2;null==this.currentScale&&(this.startPos={x:e.clientX,y:e.clientY},this.currentScale=this.graph.transform.getScale().sx);e.deltaY<0?(this.currentScale<.15?this.cumulatedFactor=(this.currentScale+.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*t*20)/20/this.currentScale,this.cumulatedFactor<=1&&(this.cumulatedFactor=1.05)):(this.currentScale<=.15?this.cumulatedFactor=(this.currentScale-.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*(1/t)*20)/20/this.currentScale,this.cumulatedFactor>=1&&(this.cumulatedFactor=.95)),this.cumulatedFactor=Math.max(.01,Math.min(this.currentScale*this.cumulatedFactor,160)/this.currentScale);const r=this.currentScale;let n=this.graph.transform.clampScale(r*this.cumulatedFactor);if(n=clamp(n,this.widgetOptions.minScale||Number.MIN_SAFE_INTEGER,this.widgetOptions.maxScale||Number.MAX_SAFE_INTEGER),n!==r)if(this.widgetOptions.zoomAtMousePosition){const e=!!this.graph.getPlugin("scroller")?this.graph.clientToLocal(this.startPos):this.graph.clientToGraph(this.startPos);this.graph.zoom(n,{absolute:!0,center:e.clone()})}else this.graph.zoom(n,{absolute:!0});this.currentScale=null,this.cumulatedFactor=1}}dispose(){this.disable()}}__decorate$j([Disposable.dispose()],MouseWheel.prototype,"dispose",null);var __decorate$i=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},JOB_PRIORITY,JOB_PRIORITY2;class VirtualRenderManager extends Base{init(){this.resetRenderArea=throttle$1(this.resetRenderArea,200,{leading:!0}),this.resetRenderArea(),this.startListening()}startListening(){this.graph.on("translate",this.resetRenderArea,this),this.graph.on("scale",this.resetRenderArea,this),this.graph.on("resize",this.resetRenderArea,this)}stopListening(){this.graph.off("translate",this.resetRenderArea,this),this.graph.off("scale",this.resetRenderArea,this),this.graph.off("resize",this.resetRenderArea,this)}enableVirtualRender(){this.options.virtual=!0,this.resetRenderArea()}disableVirtualRender(){this.options.virtual=!1,this.graph.renderer.setRenderArea(void 0)}resetRenderArea(){if(this.options.virtual){const e=this.graph.getGraphArea();this.graph.renderer.setRenderArea(e)}}dispose(){this.stopListening()}}__decorate$i([Base.dispose()],VirtualRenderManager.prototype,"dispose",null);class JobQueue{constructor(){this.isFlushing=!1,this.isFlushPending=!1,this.scheduleId=0,this.queue=[],this.frameInterval=33,this.initialTime=Date.now()}queueJob(e){if(e.priority&JOB_PRIORITY.PRIOR)e.cb();else{const t=this.findInsertionIndex(e);t>=0&&this.queue.splice(t,0,e)}}queueFlush(){this.isFlushing||this.isFlushPending||(this.isFlushPending=!0,this.scheduleJob())}queueFlushSync(){this.isFlushing||this.isFlushPending||(this.isFlushPending=!0,this.flushJobsSync())}clearJobs(){this.queue.length=0,this.isFlushing=!1,this.isFlushPending=!1,this.cancelScheduleJob()}flushJobs(){this.isFlushPending=!1,this.isFlushing=!0;const e=this.getCurrentTime();let t;for(;(t=this.queue.shift())&&(t.cb(),!(this.getCurrentTime()-e>=this.frameInterval)););this.isFlushing=!1,this.queue.length&&this.queueFlush()}flushJobsSync(){let e;for(this.isFlushPending=!1,this.isFlushing=!0;e=this.queue.shift();)try{e.cb()}catch(t){}this.isFlushing=!1}findInsertionIndex(e){let t=0,r=this.queue.length,n=r-1;const i=e.priority;for(;t<=n;){const e=(n-t>>1)+t;i<=this.queue[e].priority?t=e+1:(r=e,n=e-1)}return r}scheduleJob(){"requestIdleCallback"in window?(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.requestIdleCallback(this.flushJobs.bind(this),{timeout:100})):(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.setTimeout(this.flushJobs.bind(this)))}cancelScheduleJob(){"cancelIdleCallback"in window?(this.scheduleId&&window.cancelIdleCallback(this.scheduleId),this.scheduleId=0):(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduleId=0)}getCurrentTime(){return"object"==typeof performance&&"function"==typeof performance.now?performance.now():Date.now()-this.initialTime}}JOB_PRIORITY2=JOB_PRIORITY||(JOB_PRIORITY={}),JOB_PRIORITY2[JOB_PRIORITY2.Update=2]="Update",JOB_PRIORITY2[JOB_PRIORITY2.RenderEdge=4]="RenderEdge",JOB_PRIORITY2[JOB_PRIORITY2.RenderNode=8]="RenderNode",JOB_PRIORITY2[JOB_PRIORITY2.PRIOR=1048576]="PRIOR";var __decorate$h=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Scheduler2;class Scheduler extends Disposable{get model(){return this.graph.model}get container(){return this.graph.view.stage}constructor(e){super(),this.views={},this.willRemoveViews={},this.queue=new JobQueue,this.graph=e,this.init()}init(){this.startListening(),this.renderViews(this.model.getCells())}startListening(){this.model.on("reseted",this.onModelReseted,this),this.model.on("cell:added",this.onCellAdded,this),this.model.on("cell:removed",this.onCellRemoved,this),this.model.on("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.on("cell:change:visible",this.onCellVisibleChanged,this)}stopListening(){this.model.off("reseted",this.onModelReseted,this),this.model.off("cell:added",this.onCellAdded,this),this.model.off("cell:removed",this.onCellRemoved,this),this.model.off("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.off("cell:change:visible",this.onCellVisibleChanged,this)}onModelReseted({options:e}){this.queue.clearJobs(),this.removeZPivots(),this.resetViews();const t=this.model.getCells();this.renderViews(t,Object.assign(Object.assign({},e),{queue:t.map(e=>e.id)}))}onCellAdded({cell:e,options:t}){this.renderViews([e],t)}onCellRemoved({cell:e}){this.removeViews([e])}onCellZIndexChanged({cell:e,options:t}){const r=this.views[e.id];r&&this.requestViewUpdate(r.view,Scheduler.FLAG_INSERT,t,JOB_PRIORITY.Update,!0)}onCellVisibleChanged({cell:e,current:t}){this.toggleVisible(e,!!t)}requestViewUpdate(e,t,r={},n=JOB_PRIORITY.Update,i=!0){const o=e.cell.id,a=this.views[o];if(!a)return;a.flag=t,a.options=r;(e.hasAction(t,["translate","resize","rotate"])||!1===r.async)&&(n=JOB_PRIORITY.PRIOR,i=!1),this.queue.queueJob({id:o,priority:n,cb:()=>{this.renderViewInArea(e,t,r);const n=r.queue;if(n){const t=n.indexOf(e.cell.id);t>=0&&n.splice(t,1),0===n.length&&this.graph.trigger("render:done")}}});this.getEffectedEdges(e).forEach(e=>{this.requestViewUpdate(e.view,e.flag,r,n,!1)}),i&&this.flush()}setRenderArea(e){this.renderArea=e,this.flushWaitingViews()}isViewMounted(e){if(null==e)return!1;const t=this.views[e.cell.id];return!!t&&t.state===Scheduler.ViewState.MOUNTED}renderViews(e,t={}){e.sort((e,t)=>e.isNode()&&t.isEdge()?-1:0),e.forEach(e=>{const r=e.id;let n=0,i=this.views[r];if(i)n=Scheduler.FLAG_INSERT;else{const o=this.createCellView(e);o&&(o.graph=this.graph,n=Scheduler.FLAG_INSERT|o.getBootstrapFlag(),i={view:o,flag:n,options:t,state:Scheduler.ViewState.CREATED},this.views[r]=i)}i&&this.requestViewUpdate(i.view,n,t,this.getRenderPriority(i.view),!1)}),this.flush()}renderViewInArea(e,t,r={}){const n=e.cell,i=n.id,o=this.views[i];if(!o)return;let a=0;this.isUpdatable(e)||o.state===Scheduler.ViewState.MOUNTED?(a=this.updateView(e,t,r),o.flag=a):o.state=Scheduler.ViewState.WAITING,a&&n.isEdge()&&0===(a&e.getFlag(["source","target"]))&&this.queue.queueJob({id:i,priority:JOB_PRIORITY.RenderEdge,cb:()=>{this.updateView(e,t,r)}})}removeViews(e){e.forEach(e=>{const t=e.id,r=this.views[t];r&&(this.willRemoveViews[t]=r,delete this.views[t],this.queue.queueJob({id:t,priority:this.getRenderPriority(r.view),cb:()=>{this.removeView(r.view)}}))}),this.flush()}flush(){this.graph.options.async?this.queue.queueFlush():this.queue.queueFlushSync()}flushWaitingViews(){Object.values(this.views).forEach(e=>{if(e&&e.state===Scheduler.ViewState.WAITING){const{view:t,flag:r,options:n}=e;this.requestViewUpdate(t,r,n,this.getRenderPriority(t),!1)}}),this.flush()}updateView(e,t,r={}){if(null==e)return 0;if(CellView.isCellView(e)){if(t&Scheduler.FLAG_REMOVE)return this.removeView(e.cell),0;t&Scheduler.FLAG_INSERT&&(this.insertView(e),t^=Scheduler.FLAG_INSERT)}return t?e.confirmUpdate(t,r):0}insertView(e){const t=this.views[e.cell.id];if(t){const r=e.cell.getZIndex(),n=this.addZPivot(r);this.container.insertBefore(e.container,n),e.cell.isVisible()||this.toggleVisible(e.cell,!1),t.state=Scheduler.ViewState.MOUNTED,this.graph.trigger("view:mounted",{view:e})}}resetViews(){this.willRemoveViews=Object.assign(Object.assign({},this.views),this.willRemoveViews),Object.values(this.willRemoveViews).forEach(e=>{e&&this.removeView(e.view)}),this.views={},this.willRemoveViews={}}removeView(e){const t=e.cell,r=this.willRemoveViews[t.id];r&&e&&(r.view.remove(),delete this.willRemoveViews[t.id],this.graph.trigger("view:unmounted",{view:e}))}toggleVisible(e,t){const r=this.model.getConnectedEdges(e);for(let i=0,o=r.length;i<o;i+=1){const e=r[i];if(t){const t=e.getSourceCell(),r=e.getTargetCell();if(t&&!t.isVisible()||r&&!r.isVisible())continue;this.toggleVisible(e,!0)}else this.toggleVisible(e,!1)}const n=this.views[e.id];n&&css$3(n.view.container,{display:t?"unset":"none"})}addZPivot(e=0){null==this.zPivots&&(this.zPivots={});const t=this.zPivots;let r=t[e];if(r)return r;r=t[e]=document.createComment(`z-index:${e+1}`);let n=-1/0;for(const o in t){const t=+o;t<e&&t>n&&(n=t)}const i=this.container;if(n!==-1/0){const e=t[n];i.insertBefore(r,e.nextSibling)}else i.insertBefore(r,i.firstChild);return r}removeZPivots(){this.zPivots&&Object.values(this.zPivots).forEach(e=>{e&&e.parentNode&&e.parentNode.removeChild(e)}),this.zPivots={}}createCellView(e){const t={graph:this.graph},r=this.graph.options.createCellView;if(r){const n=call$1(r,this.graph,e);if(n)return new n(e,t);if(null===n)return null}const n=e.view;if(null!=n&&"string"==typeof n){const r=CellView.registry.get(n);return r?new r(e,t):CellView.registry.onNotFound(n)}return e.isNode()?new NodeView(e,t):e.isEdge()?new EdgeView(e,t):null}getEffectedEdges(e){const t=[],r=e.cell,n=this.model.getConnectedEdges(r);for(let i=0,o=n.length;i<o;i+=1){const e=n[i],o=this.views[e.id];if(!o)continue;const a=o.view;if(!this.isViewMounted(a))continue;const s=["update"];e.getTargetCell()===r&&s.push("target"),e.getSourceCell()===r&&s.push("source"),t.push({id:e.id,view:a,flag:a.getFlag(s)})}return t}isUpdatable(e){if(e.isNodeView())return!this.renderArea||this.renderArea.isIntersectWithRect(e.cell.getBBox());if(e.isEdgeView()){const t=e.cell,r=t.getSourceCell(),n=t.getTargetCell();if(this.renderArea&&r&&n)return this.renderArea.isIntersectWithRect(r.getBBox())||this.renderArea.isIntersectWithRect(n.getBBox())}return!0}getRenderPriority(e){return e.cell.isNode()?JOB_PRIORITY.RenderNode:JOB_PRIORITY.RenderEdge}dispose(){this.stopListening(),Object.keys(this.views).forEach(e=>{this.views[e].view.dispose()}),this.views={}}}__decorate$h([Disposable.dispose()],Scheduler.prototype,"dispose",null),Scheduler2=Scheduler||(Scheduler={}),Scheduler2.FLAG_INSERT=1<<30,Scheduler2.FLAG_REMOVE=1<<29,Scheduler2.FLAG_RENDER=67108863,function(e){var t;(t=e.ViewState||(e.ViewState={}))[t.CREATED=0]="CREATED",t[t.MOUNTED=1]="MOUNTED",t[t.WAITING=2]="WAITING"}(Scheduler||(Scheduler={}));var __decorate$g=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class Renderer extends Base{constructor(){super(...arguments),this.schedule=new Scheduler(this.graph)}requestViewUpdate(e,t,r={}){this.schedule.requestViewUpdate(e,t,r)}isViewMounted(e){return this.schedule.isViewMounted(e)}setRenderArea(e){this.schedule.setRenderArea(e)}findViewByElem(e){if(null==e)return null;const t=this.options.container,r="string"==typeof e?t.querySelector(e):e instanceof Element?e:e[0];if(r){const e=this.graph.view.findAttr("data-cell-id",r);if(e){const t=this.schedule.views;if(t[e])return t[e].view}}return null}findViewByCell(e){if(null==e)return null;const t=Cell.isCell(e)?e.id:e,r=this.schedule.views;return r[t]?r[t].view:null}findViewsFromPoint(e){const t={x:e.x,y:e.y};return this.model.getCells().map(e=>this.findViewByCell(e)).filter(e=>null!=e&&Util$1.getBBox(e.container,{target:this.view.stage}).containsPoint(t))}findEdgeViewsFromPoint(e,t=5){return this.model.getEdges().map(e=>this.findViewByCell(e)).filter(r=>{if(null!=r){const n=r.getClosestPoint(e);if(n)return n.distance(e)<=t}return!1})}findViewsInArea(e,t={}){const r=Rectangle.create(e);return this.model.getCells().map(e=>this.findViewByCell(e)).filter(e=>{if(e){if(t.nodeOnly&&!e.isNodeView())return!1;const n=Util$1.getBBox(e.container,{target:this.view.stage});return 0===n.width?n.inflate(1,0):0===n.height&&n.inflate(0,1),t.strict?r.containsRect(n):r.isIntersectWithRect(n)}return!1})}dispose(){this.schedule.dispose()}}__decorate$g([Base.dispose()],Renderer.prototype,"dispose",null);var __rest$3=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};class DefsManager extends Base{get cid(){return this.graph.view.cid}get svg(){return this.view.svg}get defs(){return this.view.defs}isDefined(e){return null!=this.svg.getElementById(e)}filter(e){let t=e.id;const r=e.name;if(t||(t=`filter-${r}-${this.cid}-${hashcode(JSON.stringify(e))}`),!this.isDefined(t)){const n=Filter.registry.get(r);if(null==n)return Filter.registry.onNotFound(r);const i=n(e.args||{}),o=Object.assign(Object.assign({x:-1,y:-1,width:3,height:3,filterUnits:"objectBoundingBox"},e.attrs),{id:t});Vector.create(Markup.sanitize(i),o).appendTo(this.defs)}return t}gradient(e){let t=e.id;const r=e.type;if(t||(t=`gradient-${r}-${this.cid}-${hashcode(JSON.stringify(e))}`),!this.isDefined(t)){const n=`<${r}>${e.stops.map(e=>{const t=null!=e.opacity&&Number.isFinite(e.opacity)?e.opacity:1;return`<stop offset="${e.offset}" stop-color="${e.color}" stop-opacity="${t}"/>`}).join("")}</${r}>`,i=Object.assign({id:t},e.attrs);Vector.create(n,i).appendTo(this.defs)}return t}marker(e){const{id:t,refX:r,refY:n,markerUnits:i,markerOrient:o,tagName:a,children:s}=e,l=__rest$3(e,["id","refX","refY","markerUnits","markerOrient","tagName","children"]);let c=t;if(c||(c=`marker-${this.cid}-${hashcode(JSON.stringify(e))}`),!this.isDefined(c)){"path"!==a&&delete l.d;const e=Vector.create("marker",{refX:r,refY:n,id:c,overflow:"visible",orient:null!=o?o:"auto",markerUnits:i||"userSpaceOnUse"},s?s.map(e=>{var{tagName:t}=e,r=__rest$3(e,["tagName"]);return Vector.create(`${t}`||"path",kebablizeAttrs(Object.assign(Object.assign({},l),r)))}):[Vector.create(a||"path",kebablizeAttrs(l))]);this.defs.appendChild(e.node)}return c}remove(e){const t=this.svg.getElementById(e);t&&t.parentNode&&t.parentNode.removeChild(t)}}class CoordManager extends Base{getClientMatrix(){return createSVGMatrix(this.view.stage.getScreenCTM())}getClientOffset(){const e=this.view.svg.getBoundingClientRect();return new Point(e.left,e.top)}getPageOffset(){return this.getClientOffset().translate(window.scrollX,window.scrollY)}snapToGrid(e,t){return("number"==typeof e?this.clientToLocalPoint(e,t):this.clientToLocalPoint(e.x,e.y)).snapToGrid(this.graph.getGridSize())}localToGraphPoint(e,t){const r=Point.create(e,t);return Util$1.transformPoint(r,this.graph.matrix())}localToClientPoint(e,t){const r=Point.create(e,t);return Util$1.transformPoint(r,this.getClientMatrix())}localToPagePoint(e,t){return("number"==typeof e?this.localToGraphPoint(e,t):this.localToGraphPoint(e)).translate(this.getPageOffset())}localToGraphRect(e,t,r,n){const i=Rectangle.create(e,t,r,n);return Util$1.transformRectangle(i,this.graph.matrix())}localToClientRect(e,t,r,n){const i=Rectangle.create(e,t,r,n);return Util$1.transformRectangle(i,this.getClientMatrix())}localToPageRect(e,t,r,n){return("number"==typeof e?this.localToGraphRect(e,t,r,n):this.localToGraphRect(e)).translate(this.getPageOffset())}graphToLocalPoint(e,t){const r=Point.create(e,t);return Util$1.transformPoint(r,this.graph.matrix().inverse())}clientToLocalPoint(e,t){const r=Point.create(e,t);return Util$1.transformPoint(r,this.getClientMatrix().inverse())}clientToGraphPoint(e,t){const r=Point.create(e,t);return Util$1.transformPoint(r,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalPoint(e,t){const r=Point.create(e,t).diff(this.getPageOffset());return this.graphToLocalPoint(r)}graphToLocalRect(e,t,r,n){const i=Rectangle.create(e,t,r,n);return Util$1.transformRectangle(i,this.graph.matrix().inverse())}clientToLocalRect(e,t,r,n){const i=Rectangle.create(e,t,r,n);return Util$1.transformRectangle(i,this.getClientMatrix().inverse())}clientToGraphRect(e,t,r,n){const i=Rectangle.create(e,t,r,n);return Util$1.transformRectangle(i,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalRect(e,t,r,n){const i=Rectangle.create(e,t,r,n),o=this.getPageOffset();return i.x-=o.x,i.y-=o.y,this.graphToLocalRect(i)}}var __decorate$f=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class HighlightManager extends Base{constructor(){super(...arguments),this.highlights={}}init(){this.startListening()}startListening(){this.graph.on("cell:highlight",this.onCellHighlight,this),this.graph.on("cell:unhighlight",this.onCellUnhighlight,this)}stopListening(){this.graph.off("cell:highlight",this.onCellHighlight,this),this.graph.off("cell:unhighlight",this.onCellUnhighlight,this)}onCellHighlight({view:e,magnet:t,options:r={}}){const n=this.resolveHighlighter(r);if(!n)return;const i=this.getHighlighterId(t,n);if(!this.highlights[i]){const r=n.highlighter;r.highlight(e,t,Object.assign({},n.args)),this.highlights[i]={cellView:e,magnet:t,highlighter:r,args:n.args}}}onCellUnhighlight({magnet:e,options:t={}}){const r=this.resolveHighlighter(t);if(!r)return;const n=this.getHighlighterId(e,r);this.unhighlight(n)}resolveHighlighter(e){const t=this.options;let r=e.highlighter;if(null==r){const n=e.type;r=n&&t.highlighting[n]||t.highlighting.default}if(null==r)return null;const n="string"==typeof r?{name:r}:r,i=n.name,o=Highlighter.registry.get(i);return null==o?Highlighter.registry.onNotFound(i):(Highlighter.check(i,o),{name:i,highlighter:o,args:n.args||{}})}getHighlighterId(e,t){return ensureId(e),t.name+e.id+JSON.stringify(t.args)}unhighlight(e){const t=this.highlights[e];t&&(t.highlighter.unhighlight(t.cellView,t.magnet,t.args),delete this.highlights[e])}dispose(){Object.keys(this.highlights).forEach(e=>this.unhighlight(e)),this.stopListening()}}__decorate$f([HighlightManager.dispose()],HighlightManager.prototype,"dispose",null);var __decorate$e=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class SizeManager extends Base{getScroller(){const e=this.graph.getPlugin("scroller");return e&&e.options.enabled?e:null}getContainer(){const e=this.getScroller();return e?e.container.parentElement:this.graph.container.parentElement}getSensorTarget(){const e=this.options.autoResize;if(e)return"boolean"==typeof e?this.getContainer():e}init(){if(this.options.autoResize){const e=this.getSensorTarget();e&&SizeSensor.bind(e,()=>{const t=e.offsetWidth,r=e.offsetHeight;this.resize(t,r)})}}resize(e,t){const r=this.getScroller();r?r.resize(e,t):this.graph.transform.resize(e,t)}dispose(){SizeSensor.clear(this.graph.container)}}__decorate$e([Base.dispose()],SizeManager.prototype,"dispose",null);var __decorate$d=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Graph2;class Graph extends Basecoat{get container(){return this.options.container}get[Symbol.toStringTag](){return Graph.toStringTag}constructor(e){super(),this.installedPlugins=new Set,this.options=Options.get(e),this.css=new CSSManager(this),this.view=new GraphView(this),this.defs=new DefsManager(this),this.coord=new CoordManager(this),this.transform=new TransformManager(this),this.highlight=new HighlightManager(this),this.grid=new GridManager(this),this.background=new BackgroundManager(this),this.options.model?this.model=this.options.model:(this.model=new Model,this.model.graph=this),this.renderer=new Renderer(this),this.panning=new PanningManager(this),this.mousewheel=new MouseWheel(this),this.virtualRender=new VirtualRenderManager(this),this.size=new SizeManager(this)}isNode(e){return e.isNode()}isEdge(e){return e.isEdge()}resetCells(e,t={}){return this.model.resetCells(e,t),this}clearCells(e={}){return this.model.clear(e),this}toJSON(e={}){return this.model.toJSON(e)}parseJSON(e){return this.model.parseJSON(e)}fromJSON(e,t={}){return this.model.fromJSON(e,t),this}getCellById(e){return this.model.getCell(e)}addNode(e,t={}){return this.model.addNode(e,t)}addNodes(e,t={}){return this.addCell(e.map(e=>Node$1.isNode(e)?e:this.createNode(e)),t)}createNode(e){return this.model.createNode(e)}removeNode(e,t={}){return this.model.removeCell(e,t)}addEdge(e,t={}){return this.model.addEdge(e,t)}addEdges(e,t={}){return this.addCell(e.map(e=>Edge$1.isEdge(e)?e:this.createEdge(e)),t)}removeEdge(e,t={}){return this.model.removeCell(e,t)}createEdge(e){return this.model.createEdge(e)}addCell(e,t={}){return this.model.addCell(e,t),this}removeCell(e,t={}){return this.model.removeCell(e,t)}removeCells(e,t={}){return this.model.removeCells(e,t)}removeConnectedEdges(e,t={}){return this.model.removeConnectedEdges(e,t)}disconnectConnectedEdges(e,t={}){return this.model.disconnectConnectedEdges(e,t),this}hasCell(e){return this.model.has(e)}getCells(){return this.model.getCells()}getCellCount(){return this.model.total()}getNodes(){return this.model.getNodes()}getEdges(){return this.model.getEdges()}getOutgoingEdges(e){return this.model.getOutgoingEdges(e)}getIncomingEdges(e){return this.model.getIncomingEdges(e)}getConnectedEdges(e,t={}){return this.model.getConnectedEdges(e,t)}getRootNodes(){return this.model.getRoots()}getLeafNodes(){return this.model.getLeafs()}isRootNode(e){return this.model.isRoot(e)}isLeafNode(e){return this.model.isLeaf(e)}getNeighbors(e,t={}){return this.model.getNeighbors(e,t)}isNeighbor(e,t,r={}){return this.model.isNeighbor(e,t,r)}getSuccessors(e,t={}){return this.model.getSuccessors(e,t)}isSuccessor(e,t,r={}){return this.model.isSuccessor(e,t,r)}getPredecessors(e,t={}){return this.model.getPredecessors(e,t)}isPredecessor(e,t,r={}){return this.model.isPredecessor(e,t,r)}getCommonAncestor(...e){return this.model.getCommonAncestor(...e)}getSubGraph(e,t={}){return this.model.getSubGraph(e,t)}cloneSubGraph(e,t={}){return this.model.cloneSubGraph(e,t)}cloneCells(e){return this.model.cloneCells(e)}getNodesFromPoint(e,t){return this.model.getNodesFromPoint(e,t)}getNodesInArea(e,t,r,n,i){return this.model.getNodesInArea(e,t,r,n,i)}getNodesUnderNode(e,t={}){return this.model.getNodesUnderNode(e,t)}searchCell(e,t,r={}){return this.model.search(e,t,r),this}getShortestPath(e,t,r={}){return this.model.getShortestPath(e,t,r)}getAllCellsBBox(){return this.model.getAllCellsBBox()}getCellsBBox(e,t={}){return this.model.getCellsBBox(e,t)}startBatch(e,t={}){this.model.startBatch(e,t)}stopBatch(e,t={}){this.model.stopBatch(e,t)}batchUpdate(e,t,r){const n="string"==typeof e?e:"update",i="string"==typeof e?t:e,o="function"==typeof t?r:t;this.startBatch(n,o);const a=i();return this.stopBatch(n,o),a}updateCellId(e,t){return this.model.updateCellId(e,t)}findView(e){return Cell.isCell(e)?this.findViewByCell(e):this.findViewByElem(e)}findViews(e){return Rectangle.isRectangleLike(e)?this.findViewsInArea(e):Point.isPointLike(e)?this.findViewsFromPoint(e):[]}findViewByCell(e){return this.renderer.findViewByCell(e)}findViewByElem(e){return this.renderer.findViewByElem(e)}findViewsFromPoint(e,t){const r="number"==typeof e?{x:e,y:t}:e;return this.renderer.findViewsFromPoint(r)}findViewsInArea(e,t,r,n,i){const o="number"==typeof e?{x:e,y:t,width:r,height:n}:e,a="number"==typeof e?i:t;return this.renderer.findViewsInArea(o,a)}matrix(e){return void 0===e?this.transform.getMatrix():(this.transform.setMatrix(e),this)}resize(e,t){const r=this.getPlugin("scroller");return r?r.resize(e,t):this.transform.resize(e,t),this}scale(e,t=e,r=0,n=0){return void 0===e?this.transform.getScale():(this.transform.scale(e,t,r,n),this)}zoom(e,t){const r=this.getPlugin("scroller");if(r){if(void 0===e)return r.zoom();r.zoom(e,t)}else{if(void 0===e)return this.transform.getZoom();this.transform.zoom(e,t)}return this}zoomTo(e,t={}){const r=this.getPlugin("scroller");return r?r.zoom(e,Object.assign(Object.assign({},t),{absolute:!0})):this.transform.zoom(e,Object.assign(Object.assign({},t),{absolute:!0})),this}zoomToRect(e,t={}){const r=this.getPlugin("scroller");return r?r.zoomToRect(e,t):this.transform.zoomToRect(e,t),this}zoomToFit(e={}){const t=this.getPlugin("scroller");return t?t.zoomToFit(e):this.transform.zoomToFit(e),this}rotate(e,t,r){return void 0===e?this.transform.getRotation():(this.transform.rotate(e,t,r),this)}translate(e,t){return void 0===e?this.transform.getTranslation():(this.transform.translate(e,t),this)}translateBy(e,t){const r=this.translate(),n=r.tx+e,i=r.ty+t;return this.translate(n,i)}getGraphArea(){return this.transform.getGraphArea()}getContentArea(e={}){return this.transform.getContentArea(e)}getContentBBox(e={}){return this.transform.getContentBBox(e)}fitToContent(e,t,r,n){return this.transform.fitToContent(e,t,r,n)}scaleContentToFit(e={}){return this.transform.scaleContentToFit(e),this}center(e){return this.centerPoint(e)}centerPoint(e,t,r){const n=this.getPlugin("scroller");return n?n.centerPoint(e,t,r):this.transform.centerPoint(e,t),this}centerContent(e){const t=this.getPlugin("scroller");return t?t.centerContent(e):this.transform.centerContent(e),this}centerCell(e,t){const r=this.getPlugin("scroller");return r?r.centerCell(e,t):this.transform.centerCell(e),this}positionPoint(e,t,r,n={}){const i=this.getPlugin("scroller");return i?i.positionPoint(e,t,r,n):this.transform.positionPoint(e,t,r),this}positionRect(e,t,r){const n=this.getPlugin("scroller");return n?n.positionRect(e,t,r):this.transform.positionRect(e,t),this}positionCell(e,t,r){const n=this.getPlugin("scroller");return n?n.positionCell(e,t,r):this.transform.positionCell(e,t),this}positionContent(e,t){const r=this.getPlugin("scroller");return r?r.positionContent(e,t):this.transform.positionContent(e,t),this}snapToGrid(e,t){return this.coord.snapToGrid(e,t)}pageToLocal(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.pageToLocalRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.pageToLocalRect(e,t,r,n):this.coord.pageToLocalPoint(e,t)}localToPage(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.localToPageRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.localToPageRect(e,t,r,n):this.coord.localToPagePoint(e,t)}clientToLocal(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.clientToLocalRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.clientToLocalRect(e,t,r,n):this.coord.clientToLocalPoint(e,t)}localToClient(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.localToClientRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.localToClientRect(e,t,r,n):this.coord.localToClientPoint(e,t)}localToGraph(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.localToGraphRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.localToGraphRect(e,t,r,n):this.coord.localToGraphPoint(e,t)}graphToLocal(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.graphToLocalRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.graphToLocalRect(e,t,r,n):this.coord.graphToLocalPoint(e,t)}clientToGraph(e,t,r,n){return Rectangle.isRectangleLike(e)?this.coord.clientToGraphRect(e):"number"==typeof e&&"number"==typeof t&&"number"==typeof r&&"number"==typeof n?this.coord.clientToGraphRect(e,t,r,n):this.coord.clientToGraphPoint(e,t)}defineFilter(e){return this.defs.filter(e)}defineGradient(e){return this.defs.gradient(e)}defineMarker(e){return this.defs.marker(e)}getGridSize(){return this.grid.getGridSize()}setGridSize(e){return this.grid.setGridSize(e),this}showGrid(){return this.grid.show(),this}hideGrid(){return this.grid.hide(),this}clearGrid(){return this.grid.clear(),this}drawGrid(e){return this.grid.draw(e),this}updateBackground(){return this.background.update(),this}drawBackground(e,t){const r=this.getPlugin("scroller");return null==r||null!=this.options.background&&t?this.background.draw(e):r.drawBackground(e,t),this}clearBackground(e){const t=this.getPlugin("scroller");return null==t||null!=this.options.background&&e?this.background.clear():t.clearBackground(e),this}enableVirtualRender(){return this.virtualRender.enableVirtualRender(),this}disableVirtualRender(){return this.virtualRender.disableVirtualRender(),this}isMouseWheelEnabled(){return!this.mousewheel.disabled}enableMouseWheel(){return this.mousewheel.enable(),this}disableMouseWheel(){return this.mousewheel.disable(),this}toggleMouseWheel(e){return null==e?this.isMouseWheelEnabled()?this.disableMouseWheel():this.enableMouseWheel():e?this.enableMouseWheel():this.disableMouseWheel(),this}isPannable(){const e=this.getPlugin("scroller");return e?e.isPannable():this.panning.pannable}enablePanning(){const e=this.getPlugin("scroller");return e?e.enablePanning():this.panning.enablePanning(),this}disablePanning(){const e=this.getPlugin("scroller");return e?e.disablePanning():this.panning.disablePanning(),this}togglePanning(e){return null==e?this.isPannable()?this.disablePanning():this.enablePanning():e!==this.isPannable()&&(e?this.enablePanning():this.disablePanning()),this}use(e,...t){return this.installedPlugins.has(e)||(this.installedPlugins.add(e),e.init(this,...t)),this}getPlugin(e){return Array.from(this.installedPlugins).find(t=>t.name===e)}getPlugins(e){return Array.from(this.installedPlugins).filter(t=>e.includes(t.name))}enablePlugins(e){let t=e;Array.isArray(t)||(t=[t]);const r=this.getPlugins(t);return null==r||r.forEach(e=>{var t;null===(t=null==e?void 0:e.enable)||void 0===t||t.call(e)}),this}disablePlugins(e){let t=e;Array.isArray(t)||(t=[t]);const r=this.getPlugins(t);return null==r||r.forEach(e=>{var t;null===(t=null==e?void 0:e.disable)||void 0===t||t.call(e)}),this}isPluginEnabled(e){var t;const r=this.getPlugin(e);return null===(t=null==r?void 0:r.isEnabled)||void 0===t?void 0:t.call(r)}disposePlugins(e){let t=e;Array.isArray(t)||(t=[t]);const r=this.getPlugins(t);return null==r||r.forEach(e=>{e.dispose(),this.installedPlugins.delete(e)}),this}dispose(e=!0){e&&this.model.dispose(),this.css.dispose(),this.defs.dispose(),this.grid.dispose(),this.coord.dispose(),this.transform.dispose(),this.highlight.dispose(),this.background.dispose(),this.mousewheel.dispose(),this.panning.dispose(),this.view.dispose(),this.renderer.dispose(),this.installedPlugins.forEach(e=>{e.dispose()})}}__decorate$d([Basecoat.dispose()],Graph.prototype,"dispose",null),Graph2=Graph||(Graph={}),Graph2.View=GraphView,Graph2.Renderer=Renderer,Graph2.MouseWheel=MouseWheel,Graph2.DefsManager=DefsManager,Graph2.GridManager=GridManager,Graph2.CoordManager=CoordManager,Graph2.TransformManager=TransformManager,Graph2.HighlightManager=HighlightManager,Graph2.BackgroundManager=BackgroundManager,Graph2.PanningManager=PanningManager,function(e){e.toStringTag=`X6.${e.name}`,e.isGraph=function(t){if(null==t)return!1;if(t instanceof e)return!0;const r=t[Symbol.toStringTag];return null==r||r===e.toStringTag}}(Graph||(Graph={})),function(e){e.render=function(t,r){const n=t instanceof HTMLElement?new e({container:t}):new e(t);return null!=r&&n.fromJSON(r),n}}(Graph||(Graph={})),function(e){e.registerNode=Node$1.registry.register,e.registerEdge=Edge$1.registry.register,e.registerView=CellView.registry.register,e.registerAttr=Attr.registry.register,e.registerGrid=Grid.registry.register,e.registerFilter=Filter.registry.register,e.registerNodeTool=NodeTool.registry.register,e.registerEdgeTool=EdgeTool.registry.register,e.registerBackground=Background.registry.register,e.registerHighlighter=Highlighter.registry.register,e.registerPortLayout=PortLayout.registry.register,e.registerPortLabelLayout=PortLabelLayout.registry.register,e.registerMarker=Marker.registry.register,e.registerRouter=Router.registry.register,e.registerConnector=Connector.registry.register,e.registerAnchor=NodeAnchor.registry.register,e.registerEdgeAnchor=EdgeAnchor.registry.register,e.registerConnectionPoint=ConnectionPoint.registry.register}(Graph||(Graph={})),function(e){e.unregisterNode=Node$1.registry.unregister,e.unregisterEdge=Edge$1.registry.unregister,e.unregisterView=CellView.registry.unregister,e.unregisterAttr=Attr.registry.unregister,e.unregisterGrid=Grid.registry.unregister,e.unregisterFilter=Filter.registry.unregister,e.unregisterNodeTool=NodeTool.registry.unregister,e.unregisterEdgeTool=EdgeTool.registry.unregister,e.unregisterBackground=Background.registry.unregister,e.unregisterHighlighter=Highlighter.registry.unregister,e.unregisterPortLayout=PortLayout.registry.unregister,e.unregisterPortLabelLayout=PortLabelLayout.registry.unregister,e.unregisterMarker=Marker.registry.unregister,e.unregisterRouter=Router.registry.unregister,e.unregisterConnector=Connector.registry.unregister,e.unregisterAnchor=NodeAnchor.registry.unregister,e.unregisterEdgeAnchor=EdgeAnchor.registry.unregister,e.unregisterConnectionPoint=ConnectionPoint.registry.unregister}(Graph||(Graph={}));var __decorate$c=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},__rest$2=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},HTML2;class HTML extends Node$1{}!function(e){class t extends NodeView{init(){super.init(),this.cell.on("change:*",this.onCellChangeAny,this)}onCellChangeAny({key:t}){const r=e.shapeMaps[this.cell.shape];if(r){const{effect:e}=r;e&&!e.includes(t)||this.renderHTMLComponent()}}confirmUpdate(e){const r=super.confirmUpdate(e);return this.handleAction(r,t.action,()=>this.renderHTMLComponent())}renderHTMLComponent(){const t=this.selectors&&this.selectors.foContent;if(t){empty$2(t);const r=e.shapeMaps[this.cell.shape];if(!r)return;let{html:n}=r;"function"==typeof n&&(n=n(this.cell)),n&&("string"==typeof n?t.innerHTML=n:append(t,n))}}dispose(){this.cell.off("change:*",this.onCellChangeAny,this)}}var r;__decorate$c([t.dispose()],t.prototype,"dispose",null),e.View=t,(r=t=e.View||(e.View={})).action="html",r.config({bootstrap:[r.action],actions:{html:r.action}}),NodeView.registry.register("html-view",r,!0)}(HTML||(HTML={})),HTML2=HTML||(HTML={}),HTML2.config({view:"html-view",markup:[{tagName:"rect",selector:"body"},Object.assign({},Markup.getForeignObjectMarkup()),{tagName:"text",selector:"label"}],attrs:{body:{fill:"none",stroke:"none",refWidth:"100%",refHeight:"100%"},fo:{refWidth:"100%",refHeight:"100%"}}}),Node$1.registry.register("html",HTML2,!0),function(e){e.shapeMaps={},e.register=function(t){const{shape:r,html:n,effect:i,inherit:o}=t,a=__rest$2(t,["shape","html","effect","inherit"]);if(!r)throw new Error("should specify shape in config");e.shapeMaps[r]={html:n,effect:i},Graph.registerNode(r,Object.assign({inherit:o||"html"},a),!0)}}(HTML||(HTML={}));const registerCustomCell=()=>{Graph.registerNode("text",{inherit:"rect",width:100,height:30,label:"文本",markup:[{tagName:"text",selector:"label",attrs:{fill:"#000000",fontSize:18,refX:"50%",refY:"50%",textAnchor:"middle",textVerticalAnchor:"middle",style:"word-wrap: 'break-all';"}}]})};registerCustomCell();var classnames={exports:{}};
207
207
  /*!
208
208
  Copyright (c) 2018 Jed Watson.
209
209
  Licensed under the MIT License (MIT), see