@vectorize-io/hindsight-control-plane 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (561) hide show
  1. package/package.json +3 -3
  2. package/standalone/.next/BUILD_ID +1 -1
  3. package/standalone/.next/build-manifest.json +8 -8
  4. package/standalone/.next/prerender-manifest.json +3 -3
  5. package/standalone/.next/server/app/_global-error/page/build-manifest.json +5 -5
  6. package/standalone/.next/server/app/_global-error/page.js +7 -9
  7. package/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  8. package/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/standalone/.next/server/app/_global-error.html +1 -1
  10. package/standalone/.next/server/app/_global-error.rsc +7 -7
  11. package/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
  12. package/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  13. package/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
  14. package/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  15. package/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/standalone/.next/server/app/_not-found/page/build-manifest.json +5 -5
  17. package/standalone/.next/server/app/_not-found/page.js +9 -11
  18. package/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/standalone/.next/server/app/_not-found.html +1 -1
  21. package/standalone/.next/server/app/_not-found.rsc +13 -13
  22. package/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +13 -13
  23. package/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  24. package/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +8 -8
  25. package/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  26. package/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  27. package/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  28. package/standalone/.next/server/app/api/auth/login/route.js +4 -4
  29. package/standalone/.next/server/app/api/auth/login/route.js.nft.json +1 -1
  30. package/standalone/.next/server/app/api/auth/logout/route.js +4 -4
  31. package/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  32. package/standalone/.next/server/app/api/banks/[bankId]/audit-logs/route.js +4 -4
  33. package/standalone/.next/server/app/api/banks/[bankId]/audit-logs/route.js.nft.json +1 -1
  34. package/standalone/.next/server/app/api/banks/[bankId]/audit-logs/stats/route.js +4 -4
  35. package/standalone/.next/server/app/api/banks/[bankId]/audit-logs/stats/route.js.nft.json +1 -1
  36. package/standalone/.next/server/app/api/banks/[bankId]/config/route.js +4 -4
  37. package/standalone/.next/server/app/api/banks/[bankId]/config/route.js.nft.json +1 -1
  38. package/standalone/.next/server/app/api/banks/[bankId]/consolidate/route.js +4 -4
  39. package/standalone/.next/server/app/api/banks/[bankId]/consolidate/route.js.nft.json +1 -1
  40. package/standalone/.next/server/app/api/banks/[bankId]/consolidation-recover/route.js +4 -4
  41. package/standalone/.next/server/app/api/banks/[bankId]/consolidation-recover/route.js.nft.json +1 -1
  42. package/standalone/.next/server/app/api/banks/[bankId]/directives/[directiveId]/route.js +4 -4
  43. package/standalone/.next/server/app/api/banks/[bankId]/directives/[directiveId]/route.js.nft.json +1 -1
  44. package/standalone/.next/server/app/api/banks/[bankId]/directives/route.js +4 -4
  45. package/standalone/.next/server/app/api/banks/[bankId]/directives/route.js.nft.json +1 -1
  46. package/standalone/.next/server/app/api/banks/[bankId]/export/route.js +4 -4
  47. package/standalone/.next/server/app/api/banks/[bankId]/export/route.js.nft.json +1 -1
  48. package/standalone/.next/server/app/api/banks/[bankId]/import/route.js +4 -4
  49. package/standalone/.next/server/app/api/banks/[bankId]/import/route.js.nft.json +1 -1
  50. package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/history/route.js +4 -4
  51. package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/history/route.js.nft.json +1 -1
  52. package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/refresh/route.js +4 -4
  53. package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/refresh/route.js.nft.json +1 -1
  54. package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/route.js +4 -4
  55. package/standalone/.next/server/app/api/banks/[bankId]/mental-models/[mentalModelId]/route.js.nft.json +1 -1
  56. package/standalone/.next/server/app/api/banks/[bankId]/mental-models/route.js +4 -4
  57. package/standalone/.next/server/app/api/banks/[bankId]/mental-models/route.js.nft.json +1 -1
  58. package/standalone/.next/server/app/api/banks/[bankId]/observations/[modelId]/route.js +4 -4
  59. package/standalone/.next/server/app/api/banks/[bankId]/observations/[modelId]/route.js.nft.json +1 -1
  60. package/standalone/.next/server/app/api/banks/[bankId]/observations/route.js +4 -4
  61. package/standalone/.next/server/app/api/banks/[bankId]/observations/route.js.nft.json +1 -1
  62. package/standalone/.next/server/app/api/banks/[bankId]/operations/[operationId]/route.js +4 -4
  63. package/standalone/.next/server/app/api/banks/[bankId]/operations/[operationId]/route.js.nft.json +1 -1
  64. package/standalone/.next/server/app/api/banks/[bankId]/route.js +4 -4
  65. package/standalone/.next/server/app/api/banks/[bankId]/route.js.nft.json +1 -1
  66. package/standalone/.next/server/app/api/banks/[bankId]/tags/route.js +4 -4
  67. package/standalone/.next/server/app/api/banks/[bankId]/tags/route.js.nft.json +1 -1
  68. package/standalone/.next/server/app/api/banks/[bankId]/webhooks/[webhookId]/deliveries/route.js +4 -4
  69. package/standalone/.next/server/app/api/banks/[bankId]/webhooks/[webhookId]/deliveries/route.js.nft.json +1 -1
  70. package/standalone/.next/server/app/api/banks/[bankId]/webhooks/[webhookId]/route.js +4 -4
  71. package/standalone/.next/server/app/api/banks/[bankId]/webhooks/[webhookId]/route.js.nft.json +1 -1
  72. package/standalone/.next/server/app/api/banks/[bankId]/webhooks/route.js +4 -4
  73. package/standalone/.next/server/app/api/banks/[bankId]/webhooks/route.js.nft.json +1 -1
  74. package/standalone/.next/server/app/api/banks/route.js +4 -4
  75. package/standalone/.next/server/app/api/banks/route.js.nft.json +1 -1
  76. package/standalone/.next/server/app/api/chunks/[chunkId]/route.js +4 -4
  77. package/standalone/.next/server/app/api/chunks/[chunkId]/route.js.nft.json +1 -1
  78. package/standalone/.next/server/app/api/documents/[documentId]/chunks/route.js +4 -4
  79. package/standalone/.next/server/app/api/documents/[documentId]/chunks/route.js.nft.json +1 -1
  80. package/standalone/.next/server/app/api/documents/[documentId]/reprocess/route.js +4 -4
  81. package/standalone/.next/server/app/api/documents/[documentId]/reprocess/route.js.nft.json +1 -1
  82. package/standalone/.next/server/app/api/documents/[documentId]/route.js +4 -4
  83. package/standalone/.next/server/app/api/documents/[documentId]/route.js.nft.json +1 -1
  84. package/standalone/.next/server/app/api/documents/route.js +4 -4
  85. package/standalone/.next/server/app/api/documents/route.js.nft.json +1 -1
  86. package/standalone/.next/server/app/api/entities/[entityId]/regenerate/route.js +4 -4
  87. package/standalone/.next/server/app/api/entities/[entityId]/regenerate/route.js.nft.json +1 -1
  88. package/standalone/.next/server/app/api/entities/[entityId]/route.js +4 -4
  89. package/standalone/.next/server/app/api/entities/[entityId]/route.js.nft.json +1 -1
  90. package/standalone/.next/server/app/api/entities/graph/route.js +4 -4
  91. package/standalone/.next/server/app/api/entities/graph/route.js.nft.json +1 -1
  92. package/standalone/.next/server/app/api/entities/route.js +4 -4
  93. package/standalone/.next/server/app/api/entities/route.js.nft.json +1 -1
  94. package/standalone/.next/server/app/api/files/retain/route.js +4 -4
  95. package/standalone/.next/server/app/api/files/retain/route.js.nft.json +1 -1
  96. package/standalone/.next/server/app/api/graph/route.js +4 -4
  97. package/standalone/.next/server/app/api/graph/route.js.nft.json +1 -1
  98. package/standalone/.next/server/app/api/health/route.js +4 -4
  99. package/standalone/.next/server/app/api/health/route.js.nft.json +1 -1
  100. package/standalone/.next/server/app/api/list/route.js +4 -4
  101. package/standalone/.next/server/app/api/list/route.js.nft.json +1 -1
  102. package/standalone/.next/server/app/api/memories/[memoryId]/history/route.js +4 -4
  103. package/standalone/.next/server/app/api/memories/[memoryId]/history/route.js.nft.json +1 -1
  104. package/standalone/.next/server/app/api/memories/[memoryId]/route.js +4 -4
  105. package/standalone/.next/server/app/api/memories/[memoryId]/route.js.nft.json +1 -1
  106. package/standalone/.next/server/app/api/memories/retain/route.js +4 -4
  107. package/standalone/.next/server/app/api/memories/retain/route.js.nft.json +1 -1
  108. package/standalone/.next/server/app/api/memories/retain_async/route.js +4 -4
  109. package/standalone/.next/server/app/api/memories/retain_async/route.js.nft.json +1 -1
  110. package/standalone/.next/server/app/api/operations/[agentId]/route.js +4 -4
  111. package/standalone/.next/server/app/api/operations/[agentId]/route.js.nft.json +1 -1
  112. package/standalone/.next/server/app/api/profile/[bankId]/route.js +4 -4
  113. package/standalone/.next/server/app/api/profile/[bankId]/route.js.nft.json +1 -1
  114. package/standalone/.next/server/app/api/recall/route.js +4 -4
  115. package/standalone/.next/server/app/api/recall/route.js.nft.json +1 -1
  116. package/standalone/.next/server/app/api/reflect/route.js +4 -4
  117. package/standalone/.next/server/app/api/reflect/route.js.nft.json +1 -1
  118. package/standalone/.next/server/app/api/stats/[agentId]/memories-timeseries/route.js +4 -4
  119. package/standalone/.next/server/app/api/stats/[agentId]/memories-timeseries/route.js.nft.json +1 -1
  120. package/standalone/.next/server/app/api/stats/[agentId]/route.js +4 -4
  121. package/standalone/.next/server/app/api/stats/[agentId]/route.js.nft.json +1 -1
  122. package/standalone/.next/server/app/api/version/route.js +4 -4
  123. package/standalone/.next/server/app/api/version/route.js.nft.json +1 -1
  124. package/standalone/.next/server/app/banks/[bankId]/page/build-manifest.json +5 -5
  125. package/standalone/.next/server/app/banks/[bankId]/page.js +10 -12
  126. package/standalone/.next/server/app/banks/[bankId]/page.js.nft.json +1 -1
  127. package/standalone/.next/server/app/banks/[bankId]/page_client-reference-manifest.js +1 -1
  128. package/standalone/.next/server/app/dashboard/page/build-manifest.json +5 -5
  129. package/standalone/.next/server/app/dashboard/page.js +10 -12
  130. package/standalone/.next/server/app/dashboard/page.js.nft.json +1 -1
  131. package/standalone/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
  132. package/standalone/.next/server/app/dashboard.html +1 -1
  133. package/standalone/.next/server/app/dashboard.rsc +15 -15
  134. package/standalone/.next/server/app/dashboard.segments/_full.segment.rsc +15 -15
  135. package/standalone/.next/server/app/dashboard.segments/_head.segment.rsc +4 -4
  136. package/standalone/.next/server/app/dashboard.segments/_index.segment.rsc +8 -8
  137. package/standalone/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  138. package/standalone/.next/server/app/dashboard.segments/dashboard/__PAGE__.segment.rsc +4 -4
  139. package/standalone/.next/server/app/dashboard.segments/dashboard.segment.rsc +3 -3
  140. package/standalone/.next/server/app/index.html +1 -1
  141. package/standalone/.next/server/app/index.rsc +13 -13
  142. package/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  143. package/standalone/.next/server/app/index.segments/_full.segment.rsc +13 -13
  144. package/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  145. package/standalone/.next/server/app/index.segments/_index.segment.rsc +8 -8
  146. package/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  147. package/standalone/.next/server/app/login/page/build-manifest.json +5 -5
  148. package/standalone/.next/server/app/login/page.js +10 -12
  149. package/standalone/.next/server/app/login/page.js.nft.json +1 -1
  150. package/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  151. package/standalone/.next/server/app/login.html +1 -1
  152. package/standalone/.next/server/app/login.rsc +15 -15
  153. package/standalone/.next/server/app/login.segments/_full.segment.rsc +15 -15
  154. package/standalone/.next/server/app/login.segments/_head.segment.rsc +4 -4
  155. package/standalone/.next/server/app/login.segments/_index.segment.rsc +8 -8
  156. package/standalone/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  157. package/standalone/.next/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  158. package/standalone/.next/server/app/login.segments/login.segment.rsc +3 -3
  159. package/standalone/.next/server/app/page/build-manifest.json +5 -5
  160. package/standalone/.next/server/app/page.js +11 -13
  161. package/standalone/.next/server/app/page.js.nft.json +1 -1
  162. package/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  163. package/standalone/.next/server/chunks/[root-of-the-server]__0-19xx0._.js +3 -0
  164. package/standalone/.next/server/chunks/[root-of-the-server]__0-ensby._.js +3 -0
  165. package/standalone/.next/server/chunks/[root-of-the-server]__0-ykzc0._.js +3 -0
  166. package/standalone/.next/server/chunks/[root-of-the-server]__0.agsak._.js +3 -0
  167. package/standalone/.next/server/chunks/[root-of-the-server]__0.i626k._.js +3 -0
  168. package/standalone/.next/server/chunks/[root-of-the-server]__00i3o1z._.js +3 -0
  169. package/standalone/.next/server/chunks/[root-of-the-server]__02nwakm._.js +3 -0
  170. package/standalone/.next/server/chunks/[root-of-the-server]__045is_g._.js +3 -0
  171. package/standalone/.next/server/chunks/[root-of-the-server]__05-gqwe._.js +3 -0
  172. package/standalone/.next/server/chunks/[root-of-the-server]__08tjq.i._.js +3 -0
  173. package/standalone/.next/server/chunks/[root-of-the-server]__09o6ecb._.js +3 -0
  174. package/standalone/.next/server/chunks/[root-of-the-server]__0_522se._.js +3 -0
  175. package/standalone/.next/server/chunks/[root-of-the-server]__0_lg09a._.js +3 -0
  176. package/standalone/.next/server/chunks/[root-of-the-server]__0_lq~dt._.js +3 -0
  177. package/standalone/.next/server/chunks/[root-of-the-server]__0_nmf28._.js +3 -0
  178. package/standalone/.next/server/chunks/[root-of-the-server]__0c34es9._.js +3 -0
  179. package/standalone/.next/server/chunks/[root-of-the-server]__0dm~zm5._.js +3 -0
  180. package/standalone/.next/server/chunks/[root-of-the-server]__0dqqhi5._.js +3 -0
  181. package/standalone/.next/server/chunks/[root-of-the-server]__0g-k5nf._.js +3 -0
  182. package/standalone/.next/server/chunks/[root-of-the-server]__0g6ttz_._.js +3 -0
  183. package/standalone/.next/server/chunks/[root-of-the-server]__0h-un1o._.js +3 -0
  184. package/standalone/.next/server/chunks/[root-of-the-server]__0i_ddhv._.js +3 -0
  185. package/standalone/.next/server/chunks/[root-of-the-server]__0ib~g6h._.js +3 -0
  186. package/standalone/.next/server/chunks/[root-of-the-server]__0ih88nb._.js +3 -0
  187. package/standalone/.next/server/chunks/[root-of-the-server]__0j21skf._.js +3 -0
  188. package/standalone/.next/server/chunks/[root-of-the-server]__0jkvo~~._.js +3 -0
  189. package/standalone/.next/server/chunks/[root-of-the-server]__0jukxf0._.js +3 -0
  190. package/standalone/.next/server/chunks/[root-of-the-server]__0kfe-s3._.js +3 -0
  191. package/standalone/.next/server/chunks/[root-of-the-server]__0kpvc5m._.js +3 -0
  192. package/standalone/.next/server/chunks/[root-of-the-server]__0lxho.q._.js +3 -0
  193. package/standalone/.next/server/chunks/[root-of-the-server]__0mbqcjv._.js +3 -0
  194. package/standalone/.next/server/chunks/[root-of-the-server]__0nglzhr._.js +13 -0
  195. package/standalone/.next/server/chunks/[root-of-the-server]__0ow3d9r._.js +3 -0
  196. package/standalone/.next/server/chunks/[root-of-the-server]__0qhbr0h._.js +3 -0
  197. package/standalone/.next/server/chunks/[root-of-the-server]__0qlh00e._.js +3 -0
  198. package/standalone/.next/server/chunks/[root-of-the-server]__0qn6ojb._.js +3 -0
  199. package/standalone/.next/server/chunks/[root-of-the-server]__0qxre7i._.js +3 -0
  200. package/standalone/.next/server/chunks/[root-of-the-server]__0rldm53._.js +3 -0
  201. package/standalone/.next/server/chunks/[root-of-the-server]__0ugd9zh._.js +3 -0
  202. package/standalone/.next/server/chunks/[root-of-the-server]__0w48xj-._.js +3 -0
  203. package/standalone/.next/server/chunks/[root-of-the-server]__0wdo5wh._.js +3 -0
  204. package/standalone/.next/server/chunks/[root-of-the-server]__0wtx8ox._.js +3 -0
  205. package/standalone/.next/server/chunks/[root-of-the-server]__0w~~_ar._.js +3 -0
  206. package/standalone/.next/server/chunks/[root-of-the-server]__0x~pclg._.js +3 -0
  207. package/standalone/.next/server/chunks/[root-of-the-server]__10vi3mt._.js +3 -0
  208. package/standalone/.next/server/chunks/[root-of-the-server]__11doxv0._.js +3 -0
  209. package/standalone/.next/server/chunks/[root-of-the-server]__11ulkfa._.js +3 -0
  210. package/standalone/.next/server/chunks/[root-of-the-server]__134m13c._.js +3 -0
  211. package/standalone/.next/server/chunks/[root-of-the-server]__13jqxg3._.js +3 -0
  212. package/standalone/.next/server/chunks/hindsight-control-plane_src_lib_hindsight-client_ts_08a51-e._.js +1 -1
  213. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0146r~c._.js +3 -0
  214. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__03krood._.js +11 -0
  215. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0b3~l7~._.js +3 -0
  216. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0bt.mb5._.js +3 -0
  217. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0cbmrds._.js +3 -0
  218. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0din_f4._.js +3 -0
  219. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0i1yiyh._.js +3 -0
  220. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0l5r-52._.js +19 -0
  221. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0tcyn68._.js +33 -0
  222. package/standalone/.next/server/chunks/ssr/{[root-of-the-server]__07.c_7l._.js → [root-of-the-server]__0~c-ivw._.js} +3 -3
  223. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__13dmc~7._.js +3 -0
  224. package/standalone/.next/server/chunks/ssr/_08qed-e._.js +1 -1
  225. package/standalone/.next/server/chunks/ssr/{hindsight-control-plane_0s.~bje._.js → _0__8juh._.js} +4 -4
  226. package/standalone/.next/server/chunks/ssr/_0k_-~3d._.js +6 -0
  227. package/standalone/.next/server/chunks/ssr/_0mh~vnk._.js +1 -1
  228. package/standalone/.next/server/chunks/ssr/_0q3l4f0._.js +1 -1
  229. package/standalone/.next/server/chunks/ssr/_0xgpb1t._.js +1 -1
  230. package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_0ki2hlw._.js +1 -1
  231. package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_components_bank-selector_tsx_06fpcdx._.js +2 -2
  232. package/standalone/.next/server/chunks/ssr/{_10tj6yd._.js → node_modules_09w7yel._.js} +3 -3
  233. package/standalone/.next/server/chunks/ssr/node_modules_0g2b~5_._.js +6 -0
  234. package/standalone/.next/server/chunks/ssr/node_modules_next_dist_0h9llsw._.js +6 -0
  235. package/standalone/.next/server/chunks/ssr/{0xqq_next_dist_client_components_0qccfea._.js → node_modules_next_dist_client_components_0inhx6q._.js} +2 -2
  236. package/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_forbidden_0ghu-f7.js +3 -0
  237. package/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_0lgvd_..js +3 -0
  238. package/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_0cjv-23.js +3 -0
  239. package/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0it2daa.js +4 -0
  240. package/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0rc3ul_.js +4 -0
  241. package/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0rgz5sc.js +4 -0
  242. package/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0vji4h-.js +4 -0
  243. package/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0~l7yql.js +4 -0
  244. package/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_127zk4f.js +4 -0
  245. package/standalone/.next/server/edge/chunks/[root-of-the-server]__032ign5._.js +11 -0
  246. package/standalone/.next/server/edge/chunks/_078chv~._.js +3 -0
  247. package/standalone/.next/server/edge/chunks/node_modules_next_dist_esm_build_templates_edge-wrapper_04.8.xv.js +3 -0
  248. package/standalone/.next/server/edge/chunks/turbopack-node_modules_next_dist_esm_build_templates_edge-wrapper_0q-a.hc.js +3 -0
  249. package/standalone/.next/server/edge/chunks/turbopack-node_modules_next_dist_esm_build_templates_edge-wrapper_0z67sut.js +3 -0
  250. package/standalone/.next/server/middleware-build-manifest.js +8 -8
  251. package/standalone/.next/server/middleware-manifest.json +12 -12
  252. package/standalone/.next/server/pages/404.html +1 -1
  253. package/standalone/.next/server/pages/500.html +1 -1
  254. package/standalone/.next/server/server-reference-manifest.js +1 -1
  255. package/standalone/.next/server/server-reference-manifest.json +1 -1
  256. package/standalone/.next/static/chunks/01jfwizpstpzt.js +2 -0
  257. package/standalone/.next/static/chunks/{0fe.wql6.w4gs.js → 01xlw8hd842-c.js} +1 -1
  258. package/standalone/.next/static/chunks/02_um6l2wp~ls.css +2 -0
  259. package/standalone/.next/static/chunks/063f4u.4z~v2d.js +1 -0
  260. package/standalone/.next/static/chunks/{0t4x0.c8~-jkd.js → 0_nsfh~bkidtn.js} +1 -1
  261. package/standalone/.next/static/chunks/0bno0116cz1js.js +5 -0
  262. package/standalone/.next/static/chunks/{0vmyuepchjdz3.js → 0cvc2q7n4bgin.js} +1 -1
  263. package/standalone/.next/static/chunks/0k8fcq_tsf70-.js +4 -0
  264. package/standalone/.next/static/chunks/0roluhgciupg2.js +1 -0
  265. package/standalone/.next/static/chunks/0tzc13c.ie0tr.js +1 -0
  266. package/standalone/.next/static/chunks/0vk1nrxcez~j0.js +1 -0
  267. package/standalone/.next/static/chunks/0xe7gt3~du.d0.js +1 -0
  268. package/standalone/.next/static/chunks/0~6rybudzzg2n.js +3 -0
  269. package/standalone/.next/static/chunks/1448x0i8f6_ty.js +9 -0
  270. package/standalone/.next/static/chunks/172kko93lglzd.js +31 -0
  271. package/standalone/.next/static/chunks/turbopack-13c2vkonuuqnn.js +1 -0
  272. package/standalone/.next/static/{ivrhmmzua95PoZD_IAvpe → jjcyUHSdhXRM74rBGX4tQ}/_clientMiddlewareManifest.js +1 -1
  273. package/standalone/node_modules/@next/env/package.json +1 -1
  274. package/standalone/node_modules/next/dist/build/static-paths/app.js +2 -1
  275. package/standalone/node_modules/next/dist/build/swc/index.js +1 -1
  276. package/standalone/node_modules/next/dist/build/utils.js +2 -1
  277. package/standalone/node_modules/next/dist/client/components/router-reducer/fetch-server-response.js +2 -2
  278. package/standalone/node_modules/next/dist/client/components/router-reducer/set-cache-busting-search-param.js +8 -2
  279. package/standalone/node_modules/next/dist/client/route-params.js +23 -6
  280. package/standalone/node_modules/next/dist/compiled/jsonwebtoken/index.js +2 -2
  281. package/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +13 -13
  282. package/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +11 -11
  283. package/standalone/node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +2 -2
  284. package/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +10 -10
  285. package/standalone/node_modules/next/dist/lib/metadata/resolve-metadata.js +2 -4
  286. package/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
  287. package/standalone/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js +80 -0
  288. package/standalone/node_modules/next/dist/lib/typescript/writeConfigurationDefaults.js +24 -20
  289. package/standalone/node_modules/next/dist/server/app-render/action-handler.js +3 -6
  290. package/standalone/node_modules/next/dist/server/app-render/app-render.js +62 -9
  291. package/standalone/node_modules/next/dist/server/app-render/collect-segment-data.js +16 -0
  292. package/standalone/node_modules/next/dist/server/app-render/create-component-tree.js +49 -19
  293. package/standalone/node_modules/next/dist/server/app-render/get-script-nonce-from-header.js +8 -20
  294. package/standalone/node_modules/next/dist/server/app-render/metadata-insertion/create-server-inserted-metadata.js +8 -7
  295. package/standalone/node_modules/next/dist/server/app-render/use-flight-response.js +2 -2
  296. package/standalone/node_modules/next/dist/server/async-storage/work-store.js +2 -1
  297. package/standalone/node_modules/next/dist/server/base-server.js +13 -5
  298. package/standalone/node_modules/next/dist/server/config-schema.js +11 -2
  299. package/standalone/node_modules/next/dist/server/config.js +1 -1
  300. package/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +18 -16
  301. package/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
  302. package/standalone/node_modules/next/dist/server/dev/static-paths-worker.js +2 -1
  303. package/standalone/node_modules/next/dist/server/image-optimizer.js +22 -2
  304. package/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
  305. package/standalone/node_modules/next/dist/server/lib/is-rsc-request.js +18 -0
  306. package/standalone/node_modules/next/dist/server/lib/mock-request.js +30 -5
  307. package/standalone/node_modules/next/dist/server/lib/patch-set-header.js +7 -0
  308. package/standalone/node_modules/next/dist/server/lib/router-server.js +20 -4
  309. package/standalone/node_modules/next/dist/server/lib/router-utils/resolve-routes.js +18 -4
  310. package/standalone/node_modules/next/dist/server/lib/server-ipc/utils.js +3 -1
  311. package/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
  312. package/standalone/node_modules/next/dist/server/next-server.js +1 -1
  313. package/standalone/node_modules/next/dist/server/render.js +47 -39
  314. package/standalone/node_modules/next/dist/server/request/fallback-params.js +27 -1
  315. package/standalone/node_modules/next/dist/server/route-modules/app-route/module.js +26 -10
  316. package/standalone/node_modules/next/dist/server/route-modules/route-module.js +11 -1
  317. package/standalone/node_modules/next/dist/server/server-utils.js +19 -2
  318. package/standalone/node_modules/next/dist/server/stream-utils/node-web-streams-helper.js +5 -5
  319. package/standalone/node_modules/next/dist/server/use-cache/use-cache-wrapper.js +1 -1
  320. package/standalone/node_modules/next/dist/server/web/adapter.js +4 -1
  321. package/standalone/node_modules/next/dist/server/web/edge-route-module-wrapper.js +2 -1
  322. package/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
  323. package/standalone/node_modules/next/dist/{server → shared/lib}/htmlescape.js +15 -0
  324. package/standalone/node_modules/next/dist/shared/lib/router/routes/app.js +13 -1
  325. package/standalone/node_modules/next/dist/shared/lib/router/utils/cache-busting-search-param.js +56 -10
  326. package/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
  327. package/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
  328. package/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
  329. package/standalone/node_modules/next/package.json +15 -15
  330. package/standalone/package.json +3 -3
  331. package/standalone/.next/server/chunks/[root-of-the-server]__0-mzq5k._.js +0 -3
  332. package/standalone/.next/server/chunks/[root-of-the-server]__006nmon._.js +0 -3
  333. package/standalone/.next/server/chunks/[root-of-the-server]__01qc.lt._.js +0 -3
  334. package/standalone/.next/server/chunks/[root-of-the-server]__03i9r24._.js +0 -3
  335. package/standalone/.next/server/chunks/[root-of-the-server]__04ov5nx._.js +0 -3
  336. package/standalone/.next/server/chunks/[root-of-the-server]__0641809._.js +0 -3
  337. package/standalone/.next/server/chunks/[root-of-the-server]__072_7sg._.js +0 -3
  338. package/standalone/.next/server/chunks/[root-of-the-server]__084.pvp._.js +0 -13
  339. package/standalone/.next/server/chunks/[root-of-the-server]__0_nif9x._.js +0 -3
  340. package/standalone/.next/server/chunks/[root-of-the-server]__0_uq85o._.js +0 -3
  341. package/standalone/.next/server/chunks/[root-of-the-server]__0bzczua._.js +0 -3
  342. package/standalone/.next/server/chunks/[root-of-the-server]__0d~.2wu._.js +0 -3
  343. package/standalone/.next/server/chunks/[root-of-the-server]__0e30_2-._.js +0 -3
  344. package/standalone/.next/server/chunks/[root-of-the-server]__0estz38._.js +0 -3
  345. package/standalone/.next/server/chunks/[root-of-the-server]__0f~qam_._.js +0 -3
  346. package/standalone/.next/server/chunks/[root-of-the-server]__0h-01m.._.js +0 -3
  347. package/standalone/.next/server/chunks/[root-of-the-server]__0h12w8h._.js +0 -3
  348. package/standalone/.next/server/chunks/[root-of-the-server]__0hof.m7._.js +0 -3
  349. package/standalone/.next/server/chunks/[root-of-the-server]__0i2otbg._.js +0 -3
  350. package/standalone/.next/server/chunks/[root-of-the-server]__0i8s1ez._.js +0 -3
  351. package/standalone/.next/server/chunks/[root-of-the-server]__0idud4m._.js +0 -3
  352. package/standalone/.next/server/chunks/[root-of-the-server]__0jbb41r._.js +0 -3
  353. package/standalone/.next/server/chunks/[root-of-the-server]__0k5dzt7._.js +0 -3
  354. package/standalone/.next/server/chunks/[root-of-the-server]__0m9skry._.js +0 -3
  355. package/standalone/.next/server/chunks/[root-of-the-server]__0ob35wz._.js +0 -3
  356. package/standalone/.next/server/chunks/[root-of-the-server]__0oqmwro._.js +0 -3
  357. package/standalone/.next/server/chunks/[root-of-the-server]__0p518-s._.js +0 -3
  358. package/standalone/.next/server/chunks/[root-of-the-server]__0q79ahg._.js +0 -3
  359. package/standalone/.next/server/chunks/[root-of-the-server]__0q8qt00._.js +0 -3
  360. package/standalone/.next/server/chunks/[root-of-the-server]__0rx61xd._.js +0 -3
  361. package/standalone/.next/server/chunks/[root-of-the-server]__0s3k8sh._.js +0 -3
  362. package/standalone/.next/server/chunks/[root-of-the-server]__0sfmlxb._.js +0 -3
  363. package/standalone/.next/server/chunks/[root-of-the-server]__0sppjv6._.js +0 -3
  364. package/standalone/.next/server/chunks/[root-of-the-server]__0t1c109._.js +0 -3
  365. package/standalone/.next/server/chunks/[root-of-the-server]__0t8dn-e._.js +0 -3
  366. package/standalone/.next/server/chunks/[root-of-the-server]__0tsjs49._.js +0 -3
  367. package/standalone/.next/server/chunks/[root-of-the-server]__0wb10vh._.js +0 -3
  368. package/standalone/.next/server/chunks/[root-of-the-server]__0xq~4xc._.js +0 -3
  369. package/standalone/.next/server/chunks/[root-of-the-server]__0y.4qtn._.js +0 -3
  370. package/standalone/.next/server/chunks/[root-of-the-server]__0z2j3hx._.js +0 -3
  371. package/standalone/.next/server/chunks/[root-of-the-server]__0zvjpa~._.js +0 -3
  372. package/standalone/.next/server/chunks/[root-of-the-server]__0zy9wud._.js +0 -3
  373. package/standalone/.next/server/chunks/[root-of-the-server]__0~2--h0._.js +0 -3
  374. package/standalone/.next/server/chunks/[root-of-the-server]__0~49ero._.js +0 -3
  375. package/standalone/.next/server/chunks/[root-of-the-server]__0~8b2h-._.js +0 -3
  376. package/standalone/.next/server/chunks/[root-of-the-server]__10koc90._.js +0 -3
  377. package/standalone/.next/server/chunks/[root-of-the-server]__10z2iah._.js +0 -3
  378. package/standalone/.next/server/chunks/[root-of-the-server]__12ww4dj._.js +0 -3
  379. package/standalone/.next/server/chunks/[root-of-the-server]__13ex1pi._.js +0 -3
  380. package/standalone/.next/server/chunks/ssr/0xqq_next_dist_0lz8ap0._.js +0 -6
  381. package/standalone/.next/server/chunks/ssr/0xqq_next_dist_0zdefg~._.js +0 -3
  382. package/standalone/.next/server/chunks/ssr/0xqq_next_dist_client_components_builtin_forbidden_0hqinps.js +0 -3
  383. package/standalone/.next/server/chunks/ssr/0xqq_next_dist_client_components_builtin_global-error_10_vrpd.js +0 -3
  384. package/standalone/.next/server/chunks/ssr/0xqq_next_dist_client_components_builtin_unauthorized_0ili.5_.js +0 -3
  385. package/standalone/.next/server/chunks/ssr/0xqq_next_dist_esm_build_templates_app-page_0aave80.js +0 -4
  386. package/standalone/.next/server/chunks/ssr/0xqq_next_dist_esm_build_templates_app-page_0cik78y.js +0 -4
  387. package/standalone/.next/server/chunks/ssr/0xqq_next_dist_esm_build_templates_app-page_0d4rgnj.js +0 -4
  388. package/standalone/.next/server/chunks/ssr/0xqq_next_dist_esm_build_templates_app-page_0fev1c9.js +0 -4
  389. package/standalone/.next/server/chunks/ssr/0xqq_next_dist_esm_build_templates_app-page_0kjoyj0.js +0 -4
  390. package/standalone/.next/server/chunks/ssr/0xqq_next_dist_esm_build_templates_app-page_0wtkrby.js +0 -4
  391. package/standalone/.next/server/chunks/ssr/[externals]_next_dist_shared_lib_no-fallback-error_external_0fgm~bn.js +0 -3
  392. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__00p0977._.js +0 -3
  393. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__01gojj5._.js +0 -3
  394. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__021w61p._.js +0 -3
  395. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__09_g7l8._.js +0 -11
  396. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0cuzey5._.js +0 -33
  397. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0f1equb._.js +0 -3
  398. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0huzohk._.js +0 -12
  399. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0z9pk.d._.js +0 -3
  400. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0~hnz..._.js +0 -3
  401. package/standalone/.next/server/chunks/ssr/_0dv_n64._.js +0 -3
  402. package/standalone/.next/server/chunks/ssr/_0srg9jo._.js +0 -6
  403. package/standalone/.next/server/chunks/ssr/hindsight-control-plane_092-e4h._.js +0 -6
  404. package/standalone/.next/server/edge/chunks/0rt3_next_dist_esm_build_templates_edge-wrapper_0bx.bt2.js +0 -3
  405. package/standalone/.next/server/edge/chunks/0rt3_next_dist_esm_build_templates_edge-wrapper_10yyufs.js +0 -3
  406. package/standalone/.next/server/edge/chunks/0xqq_next_dist_esm_build_templates_edge-wrapper_00.t9w_.js +0 -3
  407. package/standalone/.next/server/edge/chunks/[root-of-the-server]__03uqjvz._.js +0 -11
  408. package/standalone/.next/server/edge/chunks/hindsight-control-plane_0xz8f54._.js +0 -3
  409. package/standalone/.next/static/chunks/0.48ii2q-yie-.js +0 -3
  410. package/standalone/.next/static/chunks/04r-p7gk1lv_k.js +0 -2
  411. package/standalone/.next/static/chunks/08gsr4jnmyyhd.js +0 -1
  412. package/standalone/.next/static/chunks/0h3rkz9znn5s6.js +0 -31
  413. package/standalone/.next/static/chunks/0lwpzlu3p_37_.js +0 -1
  414. package/standalone/.next/static/chunks/0ow-v7.pf1_pu.js +0 -4
  415. package/standalone/.next/static/chunks/0oyxru0ka.5b8.js +0 -1
  416. package/standalone/.next/static/chunks/0rc788z.mdy14.js +0 -9
  417. package/standalone/.next/static/chunks/10tswg3m7bea9.css +0 -2
  418. package/standalone/.next/static/chunks/110o2cv22kme0.js +0 -1
  419. package/standalone/.next/static/chunks/11a0z_vz-~75n.js +0 -5
  420. package/standalone/.next/static/chunks/11h3.87w6dkf7.js +0 -1
  421. package/standalone/.next/static/chunks/turbopack-0z-lv4_4r7vzv.js +0 -1
  422. /package/standalone/.next/static/{ivrhmmzua95PoZD_IAvpe → jjcyUHSdhXRM74rBGX4tQ}/_buildManifest.js +0 -0
  423. /package/standalone/.next/static/{ivrhmmzua95PoZD_IAvpe → jjcyUHSdhXRM74rBGX4tQ}/_ssgManifest.js +0 -0
  424. /package/standalone/node_modules/{node_modules/@img → @img}/colour/color.cjs +0 -0
  425. /package/standalone/node_modules/{node_modules/@img → @img}/colour/index.cjs +0 -0
  426. /package/standalone/node_modules/{node_modules/@img → @img}/colour/package.json +0 -0
  427. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-libvips-linux-x64/README.md +0 -0
  428. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +0 -0
  429. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-libvips-linux-x64/lib/index.js +0 -0
  430. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  431. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-libvips-linux-x64/package.json +0 -0
  432. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-libvips-linux-x64/versions.json +0 -0
  433. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-libvips-linuxmusl-x64/README.md +0 -0
  434. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h +0 -0
  435. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-libvips-linuxmusl-x64/lib/index.js +0 -0
  436. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  437. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-libvips-linuxmusl-x64/package.json +0 -0
  438. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-libvips-linuxmusl-x64/versions.json +0 -0
  439. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
  440. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-linux-x64/package.json +0 -0
  441. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64.node +0 -0
  442. /package/standalone/node_modules/{node_modules/@img → @img}/sharp-linuxmusl-x64/package.json +0 -0
  443. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/api/context.js +0 -0
  444. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/api/diag.js +0 -0
  445. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/api/metrics.js +0 -0
  446. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/api/propagation.js +0 -0
  447. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/api/trace.js +0 -0
  448. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/baggage/context-helpers.js +0 -0
  449. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/baggage/internal/baggage-impl.js +0 -0
  450. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/baggage/internal/symbol.js +0 -0
  451. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/baggage/utils.js +0 -0
  452. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/context/NoopContextManager.js +0 -0
  453. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/context/context.js +0 -0
  454. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/context-api.js +0 -0
  455. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/diag/ComponentLogger.js +0 -0
  456. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/diag/consoleLogger.js +0 -0
  457. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/diag/internal/logLevelLogger.js +0 -0
  458. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/diag/types.js +0 -0
  459. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/diag-api.js +0 -0
  460. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/index.js +0 -0
  461. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/internal/global-utils.js +0 -0
  462. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/internal/semver.js +0 -0
  463. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/metrics/Metric.js +0 -0
  464. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/metrics/NoopMeter.js +0 -0
  465. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/metrics/NoopMeterProvider.js +0 -0
  466. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/metrics-api.js +0 -0
  467. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/platform/index.js +0 -0
  468. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/platform/node/globalThis.js +0 -0
  469. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/platform/node/index.js +0 -0
  470. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/propagation/NoopTextMapPropagator.js +0 -0
  471. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/propagation/TextMapPropagator.js +0 -0
  472. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/propagation-api.js +0 -0
  473. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/NonRecordingSpan.js +0 -0
  474. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/NoopTracer.js +0 -0
  475. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/NoopTracerProvider.js +0 -0
  476. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/ProxyTracer.js +0 -0
  477. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/ProxyTracerProvider.js +0 -0
  478. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/SamplingResult.js +0 -0
  479. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/context-utils.js +0 -0
  480. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/internal/tracestate-impl.js +0 -0
  481. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/internal/tracestate-validators.js +0 -0
  482. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/internal/utils.js +0 -0
  483. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/invalid-span-constants.js +0 -0
  484. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/span_kind.js +0 -0
  485. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/spancontext-utils.js +0 -0
  486. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/status.js +0 -0
  487. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace/trace_flags.js +0 -0
  488. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/trace-api.js +0 -0
  489. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/build/src/version.js +0 -0
  490. /package/standalone/node_modules/{node_modules/@opentelemetry → @opentelemetry}/api/package.json +0 -0
  491. /package/standalone/node_modules/{node_modules/@swc → @swc}/helpers/cjs/_interop_require_default.cjs +0 -0
  492. /package/standalone/node_modules/{node_modules/@swc → @swc}/helpers/cjs/_interop_require_wildcard.cjs +0 -0
  493. /package/standalone/node_modules/{node_modules/@swc → @swc}/helpers/package.json +0 -0
  494. /package/standalone/node_modules/{node_modules/client-only → client-only}/index.js +0 -0
  495. /package/standalone/node_modules/{node_modules/client-only → client-only}/package.json +0 -0
  496. /package/standalone/node_modules/{node_modules/detect-libc → detect-libc}/lib/detect-libc.js +0 -0
  497. /package/standalone/node_modules/{node_modules/detect-libc → detect-libc}/lib/elf.js +0 -0
  498. /package/standalone/node_modules/{node_modules/detect-libc → detect-libc}/lib/filesystem.js +0 -0
  499. /package/standalone/node_modules/{node_modules/detect-libc → detect-libc}/lib/process.js +0 -0
  500. /package/standalone/node_modules/{node_modules/detect-libc → detect-libc}/package.json +0 -0
  501. /package/standalone/node_modules/{node_modules/react → react}/cjs/react-compiler-runtime.production.js +0 -0
  502. /package/standalone/node_modules/{node_modules/react → react}/cjs/react-jsx-dev-runtime.production.js +0 -0
  503. /package/standalone/node_modules/{node_modules/react → react}/cjs/react-jsx-runtime.production.js +0 -0
  504. /package/standalone/node_modules/{node_modules/react → react}/cjs/react.development.js +0 -0
  505. /package/standalone/node_modules/{node_modules/react → react}/cjs/react.production.js +0 -0
  506. /package/standalone/node_modules/{node_modules/react → react}/compiler-runtime.js +0 -0
  507. /package/standalone/node_modules/{node_modules/react → react}/index.js +0 -0
  508. /package/standalone/node_modules/{node_modules/react → react}/jsx-dev-runtime.js +0 -0
  509. /package/standalone/node_modules/{node_modules/react → react}/jsx-runtime.js +0 -0
  510. /package/standalone/node_modules/{node_modules/react → react}/package.json +0 -0
  511. /package/standalone/node_modules/{node_modules/react-dom → react-dom}/cjs/react-dom-server-legacy.browser.production.js +0 -0
  512. /package/standalone/node_modules/{node_modules/react-dom → react-dom}/cjs/react-dom-server-legacy.node.production.js +0 -0
  513. /package/standalone/node_modules/{node_modules/react-dom → react-dom}/cjs/react-dom-server.browser.production.js +0 -0
  514. /package/standalone/node_modules/{node_modules/react-dom → react-dom}/cjs/react-dom-server.edge.production.js +0 -0
  515. /package/standalone/node_modules/{node_modules/react-dom → react-dom}/cjs/react-dom-server.node.production.js +0 -0
  516. /package/standalone/node_modules/{node_modules/react-dom → react-dom}/cjs/react-dom.production.js +0 -0
  517. /package/standalone/node_modules/{node_modules/react-dom → react-dom}/index.js +0 -0
  518. /package/standalone/node_modules/{node_modules/react-dom → react-dom}/package.json +0 -0
  519. /package/standalone/node_modules/{node_modules/react-dom → react-dom}/server.browser.js +0 -0
  520. /package/standalone/node_modules/{node_modules/react-dom → react-dom}/server.edge.js +0 -0
  521. /package/standalone/node_modules/{node_modules/react-dom → react-dom}/server.node.js +0 -0
  522. /package/standalone/node_modules/{node_modules/react-dom → react-dom}/static.node.js +0 -0
  523. /package/standalone/node_modules/{node_modules/semver → semver}/classes/comparator.js +0 -0
  524. /package/standalone/node_modules/{node_modules/semver → semver}/classes/range.js +0 -0
  525. /package/standalone/node_modules/{node_modules/semver → semver}/classes/semver.js +0 -0
  526. /package/standalone/node_modules/{node_modules/semver → semver}/functions/cmp.js +0 -0
  527. /package/standalone/node_modules/{node_modules/semver → semver}/functions/coerce.js +0 -0
  528. /package/standalone/node_modules/{node_modules/semver → semver}/functions/compare.js +0 -0
  529. /package/standalone/node_modules/{node_modules/semver → semver}/functions/eq.js +0 -0
  530. /package/standalone/node_modules/{node_modules/semver → semver}/functions/gt.js +0 -0
  531. /package/standalone/node_modules/{node_modules/semver → semver}/functions/gte.js +0 -0
  532. /package/standalone/node_modules/{node_modules/semver → semver}/functions/lt.js +0 -0
  533. /package/standalone/node_modules/{node_modules/semver → semver}/functions/lte.js +0 -0
  534. /package/standalone/node_modules/{node_modules/semver → semver}/functions/neq.js +0 -0
  535. /package/standalone/node_modules/{node_modules/semver → semver}/functions/parse.js +0 -0
  536. /package/standalone/node_modules/{node_modules/semver → semver}/functions/satisfies.js +0 -0
  537. /package/standalone/node_modules/{node_modules/semver → semver}/internal/constants.js +0 -0
  538. /package/standalone/node_modules/{node_modules/semver → semver}/internal/debug.js +0 -0
  539. /package/standalone/node_modules/{node_modules/semver → semver}/internal/identifiers.js +0 -0
  540. /package/standalone/node_modules/{node_modules/semver → semver}/internal/lrucache.js +0 -0
  541. /package/standalone/node_modules/{node_modules/semver → semver}/internal/parse-options.js +0 -0
  542. /package/standalone/node_modules/{node_modules/semver → semver}/internal/re.js +0 -0
  543. /package/standalone/node_modules/{node_modules/semver → semver}/package.json +0 -0
  544. /package/standalone/node_modules/{node_modules/sharp → sharp}/lib/channel.js +0 -0
  545. /package/standalone/node_modules/{node_modules/sharp → sharp}/lib/colour.js +0 -0
  546. /package/standalone/node_modules/{node_modules/sharp → sharp}/lib/composite.js +0 -0
  547. /package/standalone/node_modules/{node_modules/sharp → sharp}/lib/constructor.js +0 -0
  548. /package/standalone/node_modules/{node_modules/sharp → sharp}/lib/index.js +0 -0
  549. /package/standalone/node_modules/{node_modules/sharp → sharp}/lib/input.js +0 -0
  550. /package/standalone/node_modules/{node_modules/sharp → sharp}/lib/is.js +0 -0
  551. /package/standalone/node_modules/{node_modules/sharp → sharp}/lib/libvips.js +0 -0
  552. /package/standalone/node_modules/{node_modules/sharp → sharp}/lib/operation.js +0 -0
  553. /package/standalone/node_modules/{node_modules/sharp → sharp}/lib/output.js +0 -0
  554. /package/standalone/node_modules/{node_modules/sharp → sharp}/lib/resize.js +0 -0
  555. /package/standalone/node_modules/{node_modules/sharp → sharp}/lib/sharp.js +0 -0
  556. /package/standalone/node_modules/{node_modules/sharp → sharp}/lib/utility.js +0 -0
  557. /package/standalone/node_modules/{node_modules/sharp → sharp}/package.json +0 -0
  558. /package/standalone/node_modules/{node_modules/styled-jsx → styled-jsx}/dist/index/index.js +0 -0
  559. /package/standalone/node_modules/{node_modules/styled-jsx → styled-jsx}/index.js +0 -0
  560. /package/standalone/node_modules/{node_modules/styled-jsx → styled-jsx}/package.json +0 -0
  561. /package/standalone/node_modules/{node_modules/styled-jsx → styled-jsx}/style.js +0 -0
@@ -1,9 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,27130,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={formatUrl:function(){return s},formatWithValidation:function(){return c},urlObjectKeys:function(){return l}};for(var i in r)Object.defineProperty(n,i,{enumerable:!0,get:r[i]});let a=e.r(90809)._(e.r(39650)),o=/https?|ftp|gopher|file/;function s(e){let{auth:t,hostname:n}=e,r=e.protocol||"",i=e.pathname||"",s=e.hash||"",l=e.query||"",c=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?c=t+e.host:n&&(c=t+(~n.indexOf(":")?`[${n}]`:n),e.port&&(c+=":"+e.port)),l&&"object"==typeof l&&(l=String(a.urlQueryToSearchParams(l)));let u=e.search||l&&`?${l}`||"";return r&&!r.endsWith(":")&&(r+=":"),e.slashes||(!r||o.test(r))&&!1!==c?(c="//"+(c||""),i&&"/"!==i[0]&&(i="/"+i)):c||(c=""),s&&"#"!==s[0]&&(s="#"+s),u&&"?"!==u[0]&&(u="?"+u),i=i.replace(/[?#]/g,encodeURIComponent),u=u.replace("#","%23"),`${r}${c}${i}${u}${s}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function c(e){return s(e)}},22141,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"isLocalURL",{enumerable:!0,get:function(){return a}});let r=e.r(12994),i=e.r(46749);function a(e){if(!(0,r.isAbsoluteUrl)(e))return!0;try{let t=(0,r.getLocationOrigin)(),n=new URL(e,t);return n.origin===t&&(0,i.hasBasePath)(n.pathname)}catch(e){return!1}}},97710,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"errorOnce",{enumerable:!0,get:function(){return r}});let r=e=>{}},28830,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={default:function(){return x},useLinkStatus:function(){return b}};for(var i in r)Object.defineProperty(n,i,{enumerable:!0,get:r[i]});let a=e.r(90809),o=e.r(9087),s=a._(e.r(41357)),l=e.r(27130),c=e.r(95629),u=e.r(80286),d=e.r(12994),h=e.r(30717);e.r(14775);let f=e.r(14915),p=e.r(29953),g=e.r(22141),v=e.r(82539);function x(t){var n,r;let i,a,x,[b,w]=(0,s.useOptimistic)(p.IDLE_LINK_STATUS),j=(0,s.useRef)(null),{href:N,as:k,children:C,prefetch:E=null,passHref:_,replace:S,shallow:T,scroll:A,onClick:O,onMouseEnter:M,onTouchStart:P,legacyBehavior:D=!1,onNavigate:L,transitionTypes:I,ref:R,unstable_dynamicOnHover:B,...z}=t;i=C,D&&("string"==typeof i||"number"==typeof i)&&(i=(0,o.jsx)("a",{children:i}));let F=s.default.useContext(c.AppRouterContext),V=!1!==E,U=!1!==E?null===(r=E)||"auto"===r?v.FetchStrategy.PPR:v.FetchStrategy.Full:v.FetchStrategy.PPR,H="string"==typeof(n=k||N)?n:(0,l.formatUrl)(n);if(D){if(i?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});a=s.default.Children.only(i)}let W=D?a&&"object"==typeof a&&a.ref:R,Y=s.default.useCallback(e=>(null!==F&&(j.current=(0,p.mountLinkInstance)(e,H,F,U,V,w)),()=>{j.current&&((0,p.unmountLinkForCurrentNavigation)(j.current),j.current=null),(0,p.unmountPrefetchableInstance)(e)}),[V,H,F,U,w]),G={ref:(0,u.useMergedRef)(Y,W),onClick(t){D||"function"!=typeof O||O(t),D&&a.props&&"function"==typeof a.props.onClick&&a.props.onClick(t),!F||t.defaultPrevented||function(t,n,r,i,a,o,l){if("u">typeof window){let c,{nodeName:u}=t.currentTarget;if("A"===u.toUpperCase()&&((c=t.currentTarget.getAttribute("target"))&&"_self"!==c||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,g.isLocalURL)(n)){i&&(t.preventDefault(),location.replace(n));return}if(t.preventDefault(),o){let e=!1;if(o({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:d}=e.r(54137);s.default.startTransition(()=>{d(n,i?"replace":"push",!1===a?f.ScrollBehavior.NoScroll:f.ScrollBehavior.Default,r.current,l)})}}(t,H,j,S,A,L,I)},onMouseEnter(e){D||"function"!=typeof M||M(e),D&&a.props&&"function"==typeof a.props.onMouseEnter&&a.props.onMouseEnter(e),F&&V&&(0,p.onNavigationIntent)(e.currentTarget,!0===B)},onTouchStart:function(e){D||"function"!=typeof P||P(e),D&&a.props&&"function"==typeof a.props.onTouchStart&&a.props.onTouchStart(e),F&&V&&(0,p.onNavigationIntent)(e.currentTarget,!0===B)}};return(0,d.isAbsoluteUrl)(H)?G.href=H:D&&!_&&("a"!==a.type||"href"in a.props)||(G.href=(0,h.addBasePath)(H)),x=D?s.default.cloneElement(a,G):(0,o.jsx)("a",{...z,...G,children:i}),(0,o.jsx)(y.Provider,{value:b,children:x})}e.r(97710);let y=(0,s.createContext)(p.IDLE_LINK_STATUS),b=()=>(0,s.useContext)(y);("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},51273,(e,t,n)=>{e.e,t.exports=function(){var e=[function(e,t,n){"use strict";function r(){}r.QUALITY=1,r.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,r.DEFAULT_INCREMENTAL=!1,r.DEFAULT_ANIMATION_ON_LAYOUT=!0,r.DEFAULT_ANIMATION_DURING_LAYOUT=!1,r.DEFAULT_ANIMATION_PERIOD=50,r.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,r.DEFAULT_GRAPH_MARGIN=15,r.NODE_DIMENSIONS_INCLUDE_LABELS=!1,r.SIMPLE_NODE_SIZE=40,r.SIMPLE_NODE_HALF_SIZE=r.SIMPLE_NODE_SIZE/2,r.EMPTY_COMPOUND_NODE_SIZE=40,r.MIN_EDGE_LENGTH=1,r.WORLD_BOUNDARY=1e6,r.INITIAL_WORLD_BOUNDARY=r.WORLD_BOUNDARY/1e3,r.WORLD_CENTER_X=1200,r.WORLD_CENTER_Y=900,e.exports=r},function(e,t,n){"use strict";var r=n(2),i=n(8),a=n(9);function o(e,t,n){r.call(this,n),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=n,this.bendpoints=[],this.source=e,this.target=t}for(var s in o.prototype=Object.create(r.prototype),r)o[s]=r[s];o.prototype.getSource=function(){return this.source},o.prototype.getTarget=function(){return this.target},o.prototype.isInterGraph=function(){return this.isInterGraph},o.prototype.getLength=function(){return this.length},o.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},o.prototype.getBendpoints=function(){return this.bendpoints},o.prototype.getLca=function(){return this.lca},o.prototype.getSourceInLca=function(){return this.sourceInLca},o.prototype.getTargetInLca=function(){return this.targetInLca},o.prototype.getOtherEnd=function(e){if(this.source===e)return this.target;if(this.target===e)return this.source;throw"Node is not incident with this edge"},o.prototype.getOtherEndInGraph=function(e,t){for(var n=this.getOtherEnd(e),r=t.getGraphManager().getRoot();;){if(n.getOwner()==t)return n;if(n.getOwner()==r)break;n=n.getOwner().getParent()}return null},o.prototype.updateLength=function(){var e=[,,,,];this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),e),this.isOverlapingSourceAndTarget||(this.lengthX=e[0]-e[2],this.lengthY=e[1]-e[3],1>Math.abs(this.lengthX)&&(this.lengthX=a.sign(this.lengthX)),1>Math.abs(this.lengthY)&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},o.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),1>Math.abs(this.lengthX)&&(this.lengthX=a.sign(this.lengthX)),1>Math.abs(this.lengthY)&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=o},function(e,t,n){"use strict";e.exports=function(e){this.vGraphObject=e}},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(13),o=n(0),s=n(16),l=n(5);function c(e,t,n,o){null==n&&null==o&&(o=t),r.call(this,o),null!=e.graphManager&&(e=e.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=o,this.edges=[],this.graphManager=e,null!=n&&null!=t?this.rect=new a(t.x,t.y,n.width,n.height):this.rect=new a}for(var u in c.prototype=Object.create(r.prototype),r)c[u]=r[u];c.prototype.getEdges=function(){return this.edges},c.prototype.getChild=function(){return this.child},c.prototype.getOwner=function(){return this.owner},c.prototype.getWidth=function(){return this.rect.width},c.prototype.setWidth=function(e){this.rect.width=e},c.prototype.getHeight=function(){return this.rect.height},c.prototype.setHeight=function(e){this.rect.height=e},c.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},c.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},c.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},c.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},c.prototype.getRect=function(){return this.rect},c.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},c.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},c.prototype.setRect=function(e,t){this.rect.x=e.x,this.rect.y=e.y,this.rect.width=t.width,this.rect.height=t.height},c.prototype.setCenter=function(e,t){this.rect.x=e-this.rect.width/2,this.rect.y=t-this.rect.height/2},c.prototype.setLocation=function(e,t){this.rect.x=e,this.rect.y=t},c.prototype.moveBy=function(e,t){this.rect.x+=e,this.rect.y+=t},c.prototype.getEdgeListToNode=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(r.target==e){if(r.source!=n)throw"Incorrect edge source!";t.push(r)}}),t},c.prototype.getEdgesBetween=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(r.source!=n&&r.target!=n)throw"Incorrect edge source and/or target";(r.target==e||r.source==e)&&t.push(r)}),t},c.prototype.getNeighborsList=function(){var e=new Set,t=this;return t.edges.forEach(function(n){if(n.source==t)e.add(n.target);else{if(n.target!=t)throw"Incorrect incidency!";e.add(n.source)}}),e},c.prototype.withChildren=function(){var e=new Set;if(e.add(this),null!=this.child)for(var t=this.child.getNodes(),n=0;n<t.length;n++)t[n].withChildren().forEach(function(t){e.add(t)});return e},c.prototype.getNoOfChildren=function(){var e=0;if(null==this.child)e=1;else for(var t=this.child.getNodes(),n=0;n<t.length;n++)e+=t[n].getNoOfChildren();return 0==e&&(e=1),e},c.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},c.prototype.calcEstimatedSize=function(){return null==this.child?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},c.prototype.scatter=function(){var e,t,n=-o.INITIAL_WORLD_BOUNDARY,r=o.INITIAL_WORLD_BOUNDARY;e=o.WORLD_CENTER_X+s.nextDouble()*(r-n)+n;var i=-o.INITIAL_WORLD_BOUNDARY,a=o.INITIAL_WORLD_BOUNDARY;t=o.WORLD_CENTER_Y+s.nextDouble()*(a-i)+i,this.rect.x=e,this.rect.y=t},c.prototype.updateBounds=function(){if(null==this.getChild())throw"assert failed";if(0!=this.getChild().getNodes().length){var e=this.getChild();if(e.updateBounds(!0),this.rect.x=e.getLeft(),this.rect.y=e.getTop(),this.setWidth(e.getRight()-e.getLeft()),this.setHeight(e.getBottom()-e.getTop()),o.NODE_DIMENSIONS_INCLUDE_LABELS){var t=e.getRight()-e.getLeft(),n=e.getBottom()-e.getTop();this.labelWidth&&("left"==this.labelPosHorizontal?(this.rect.x-=this.labelWidth,this.setWidth(t+this.labelWidth)):"center"==this.labelPosHorizontal&&this.labelWidth>t?(this.rect.x-=(this.labelWidth-t)/2,this.setWidth(this.labelWidth)):"right"==this.labelPosHorizontal&&this.setWidth(t+this.labelWidth)),this.labelHeight&&("top"==this.labelPosVertical?(this.rect.y-=this.labelHeight,this.setHeight(n+this.labelHeight)):"center"==this.labelPosVertical&&this.labelHeight>n?(this.rect.y-=(this.labelHeight-n)/2,this.setHeight(this.labelHeight)):"bottom"==this.labelPosVertical&&this.setHeight(n+this.labelHeight))}}},c.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},c.prototype.transform=function(e){var t=this.rect.x;t>o.WORLD_BOUNDARY?t=o.WORLD_BOUNDARY:t<-o.WORLD_BOUNDARY&&(t=-o.WORLD_BOUNDARY);var n=this.rect.y;n>o.WORLD_BOUNDARY?n=o.WORLD_BOUNDARY:n<-o.WORLD_BOUNDARY&&(n=-o.WORLD_BOUNDARY);var r=new l(t,n),i=e.inverseTransformPoint(r);this.setLocation(i.x,i.y)},c.prototype.getLeft=function(){return this.rect.x},c.prototype.getRight=function(){return this.rect.x+this.rect.width},c.prototype.getTop=function(){return this.rect.y},c.prototype.getBottom=function(){return this.rect.y+this.rect.height},c.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},e.exports=c},function(e,t,n){"use strict";var r=n(0);function i(){}for(var a in r)i[a]=r[a];i.MAX_ITERATIONS=2500,i.DEFAULT_EDGE_LENGTH=50,i.DEFAULT_SPRING_STRENGTH=.45,i.DEFAULT_REPULSION_STRENGTH=4500,i.DEFAULT_GRAVITY_STRENGTH=.4,i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,i.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,i.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,i.COOLING_ADAPTATION_FACTOR=.33,i.ADAPTATION_LOWER_NODE_LIMIT=1e3,i.ADAPTATION_UPPER_NODE_LIMIT=5e3,i.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,i.MAX_NODE_DISPLACEMENT=3*i.MAX_NODE_DISPLACEMENT_INCREMENTAL,i.MIN_REPULSION_DIST=i.DEFAULT_EDGE_LENGTH/10,i.CONVERGENCE_CHECK_PERIOD=100,i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,i.MIN_EDGE_LENGTH=1,i.GRID_CALCULATION_CHECK_PERIOD=10,e.exports=i},function(e,t,n){"use strict";function r(e,t){null==e&&null==t?(this.x=0,this.y=0):(this.x=e,this.y=t)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(e){this.x=e},r.prototype.setY=function(e){this.y=e},r.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},e.exports=r},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(0),o=n(7),s=n(3),l=n(1),c=n(13),u=n(12),d=n(11);function h(e,t,n){r.call(this,n),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=e,null!=t&&t instanceof o?this.graphManager=t:null!=t&&t instanceof Layout&&(this.graphManager=t.graphManager)}for(var f in h.prototype=Object.create(r.prototype),r)h[f]=r[f];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(e,t,n){if(null==t&&null==n){if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(e)>-1)throw"Node already in graph!";return e.owner=this,this.getNodes().push(e),e}if(!(this.getNodes().indexOf(t)>-1&&this.getNodes().indexOf(n)>-1))throw"Source or target not in graph!";if(t.owner!=n.owner||t.owner!=this)throw"Both owners must be this graph!";return t.owner!=n.owner?null:(e.source=t,e.target=n,e.isInterGraph=!1,this.getEdges().push(e),t.edges.push(e),n!=t&&n.edges.push(e),e)},h.prototype.remove=function(e){if(e instanceof s){if(null==e)throw"Node is null!";if(null==e.owner||e.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var t,n=e.edges.slice(),r=n.length,i=0;i<r;i++)(t=n[i]).isInterGraph?this.graphManager.remove(t):t.source.owner.remove(t);var a=this.nodes.indexOf(e);if(-1==a)throw"Node not in owner node list!";this.nodes.splice(a,1)}else if(e instanceof l){var t=e;if(null==t)throw"Edge is null!";if(null==t.source||null==t.target)throw"Source and/or target is null!";if(null==t.source.owner||null==t.target.owner||t.source.owner!=this||t.target.owner!=this)throw"Source and/or target owner is invalid!";var o=t.source.edges.indexOf(t),c=t.target.edges.indexOf(t);if(!(o>-1&&c>-1))throw"Source and/or target doesn't know this edge!";t.source.edges.splice(o,1),t.target!=t.source&&t.target.edges.splice(c,1);var a=t.source.owner.getEdges().indexOf(t);if(-1==a)throw"Not in owner's edge list!";t.source.owner.getEdges().splice(a,1)}},h.prototype.updateLeftTop=function(){for(var e,t,n,r=i.MAX_VALUE,a=i.MAX_VALUE,o=this.getNodes(),s=o.length,l=0;l<s;l++){var c=o[l];e=c.getTop(),t=c.getLeft(),r>e&&(r=e),a>t&&(a=t)}return r==i.MAX_VALUE?null:(n=void 0!=o[0].getParent().paddingLeft?o[0].getParent().paddingLeft:this.margin,this.left=a-n,this.top=r-n,new u(this.left,this.top))},h.prototype.updateBounds=function(e){for(var t,n,r,a,o,s=i.MAX_VALUE,l=-i.MAX_VALUE,u=i.MAX_VALUE,d=-i.MAX_VALUE,h=this.nodes,f=h.length,p=0;p<f;p++){var g=h[p];e&&null!=g.child&&g.updateBounds(),t=g.getLeft(),n=g.getRight(),r=g.getTop(),a=g.getBottom(),s>t&&(s=t),l<n&&(l=n),u>r&&(u=r),d<a&&(d=a)}var v=new c(s,u,l-s,d-u);s==i.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),o=void 0!=h[0].getParent().paddingLeft?h[0].getParent().paddingLeft:this.margin,this.left=v.x-o,this.right=v.x+v.width+o,this.top=v.y-o,this.bottom=v.y+v.height+o},h.calculateBounds=function(e){for(var t,n,r,a,o=i.MAX_VALUE,s=-i.MAX_VALUE,l=i.MAX_VALUE,u=-i.MAX_VALUE,d=e.length,h=0;h<d;h++){var f=e[h];t=f.getLeft(),n=f.getRight(),r=f.getTop(),a=f.getBottom(),o>t&&(o=t),s<n&&(s=n),l>r&&(l=r),u<a&&(u=a)}return new c(o,l,s-o,u-l)},h.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},h.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},h.prototype.calcEstimatedSize=function(){for(var e=0,t=this.nodes,n=t.length,r=0;r<n;r++)e+=t[r].calcEstimatedSize();return 0==e?this.estimatedSize=a.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=e/Math.sqrt(this.nodes.length),this.estimatedSize},h.prototype.updateConnected=function(){var e,t,n=this;if(0==this.nodes.length){this.isConnected=!0;return}var r=new d,i=new Set,a=this.nodes[0];for(a.withChildren().forEach(function(e){r.push(e),i.add(e)});0!==r.length;)for(var o=(e=(a=r.shift()).getEdges()).length,s=0;s<o;s++)null==(t=e[s].getOtherEndInGraph(a,this))||i.has(t)||t.withChildren().forEach(function(e){r.push(e),i.add(e)});if(this.isConnected=!1,i.size>=this.nodes.length){var l=0;i.forEach(function(e){e.owner==n&&l++}),l==this.nodes.length&&(this.isConnected=!0)}},e.exports=h},function(e,t,n){"use strict";var r,i=n(1);function a(e){r=n(6),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),t=this.layout.newNode(null),n=this.add(e,t);return this.setRootGraph(n),this.rootGraph},a.prototype.add=function(e,t,n,r,i){if(null==n&&null==r&&null==i){if(null==e)throw"Graph is null!";if(null==t)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),null!=e.parent)throw"Already has a parent!";if(null!=t.child)throw"Already has a child!";return e.parent=t,t.child=e,e}i=n,r=t,n=e;var a=r.getOwner(),o=i.getOwner();if(null==a||a.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==o||o.getGraphManager()!=this)throw"Target not in this graph mgr!";if(a==o)return n.isInterGraph=!1,a.add(n,r,i);if(n.isInterGraph=!0,n.source=r,n.target=i,this.edges.indexOf(n)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(n),null==n.source||null==n.target)throw"Edge source and/or target is null!";if(-1!=n.source.edges.indexOf(n)||-1!=n.target.edges.indexOf(n))throw"Edge already in source and/or target incidency list!";return n.source.edges.push(n),n.target.edges.push(n),n},a.prototype.remove=function(e){if(e instanceof r){if(e.getGraphManager()!=this)throw"Graph not in this graph mgr";if(e!=this.rootGraph&&(null==e.parent||e.parent.graphManager!=this))throw"Invalid parent node!";for(var t,n,a=[],o=(a=a.concat(e.getEdges())).length,s=0;s<o;s++)t=a[s],e.remove(t);var l=[];o=(l=l.concat(e.getNodes())).length;for(var s=0;s<o;s++)n=l[s],e.remove(n);e==this.rootGraph&&this.setRootGraph(null);var c=this.graphs.indexOf(e);this.graphs.splice(c,1),e.parent=null}else if(e instanceof i){if(null==(t=e))throw"Edge is null!";if(!t.isInterGraph)throw"Not an inter-graph edge!";if(null==t.source||null==t.target)throw"Source and/or target is null!";if(-1==t.source.edges.indexOf(t)||-1==t.target.edges.indexOf(t))throw"Source and/or target doesn't know this edge!";var c=t.source.edges.indexOf(t);if(t.source.edges.splice(c,1),c=t.target.edges.indexOf(t),t.target.edges.splice(c,1),null==t.source.owner||null==t.source.owner.getGraphManager())throw"Edge owner graph or owner graph manager is null!";if(-1==t.source.owner.getGraphManager().edges.indexOf(t))throw"Not in owner graph manager's edge list!";var c=t.source.owner.getGraphManager().edges.indexOf(t);t.source.owner.getGraphManager().edges.splice(c,1)}},a.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},a.prototype.getGraphs=function(){return this.graphs},a.prototype.getAllNodes=function(){if(null==this.allNodes){for(var e=[],t=this.getGraphs(),n=t.length,r=0;r<n;r++)e=e.concat(t[r].getNodes());this.allNodes=e}return this.allNodes},a.prototype.resetAllNodes=function(){this.allNodes=null},a.prototype.resetAllEdges=function(){this.allEdges=null},a.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},a.prototype.getAllEdges=function(){if(null==this.allEdges){var e=[],t=this.getGraphs();t.length;for(var n=0;n<t.length;n++)e=e.concat(t[n].getEdges());e=e.concat(this.edges),this.allEdges=e}return this.allEdges},a.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},a.prototype.setAllNodesToApplyGravitation=function(e){if(null!=this.allNodesToApplyGravitation)throw"assert failed";this.allNodesToApplyGravitation=e},a.prototype.getRoot=function(){return this.rootGraph},a.prototype.setRootGraph=function(e){if(e.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=e,null==e.parent&&(e.parent=this.layout.newNode("Root node"))},a.prototype.getLayout=function(){return this.layout},a.prototype.isOneAncestorOfOther=function(e,t){if(null==e||null==t)throw"assert failed";if(e==t)return!0;for(var n,r=e.getOwner();null!=(n=r.getParent());){if(n==t)return!0;if(null==(r=n.getOwner()))break}for(r=t.getOwner();null!=(n=r.getParent());){if(n==e)return!0;if(null==(r=n.getOwner()))break}return!1},a.prototype.calcLowestCommonAncestors=function(){for(var e,t,n,r,i,a=this.getAllEdges(),o=a.length,s=0;s<o;s++){if(t=(e=a[s]).source,n=e.target,e.lca=null,e.sourceInLca=t,e.targetInLca=n,t==n){e.lca=t.getOwner();continue}for(r=t.getOwner();null==e.lca;){for(e.targetInLca=n,i=n.getOwner();null==e.lca;){if(i==r){e.lca=i;break}if(i==this.rootGraph)break;if(null!=e.lca)throw"assert failed";e.targetInLca=i.getParent(),i=e.targetInLca.getOwner()}if(r==this.rootGraph)break;null==e.lca&&(e.sourceInLca=r.getParent(),r=e.sourceInLca.getOwner())}if(null==e.lca)throw"assert failed"}},a.prototype.calcLowestCommonAncestor=function(e,t){if(e==t)return e.getOwner();for(var n=e.getOwner();null!=n;){for(var r=t.getOwner();null!=r;){if(r==n)return r;r=r.getParent().getOwner()}n=n.getParent().getOwner()}return n},a.prototype.calcInclusionTreeDepths=function(e,t){null==e&&null==t&&(e=this.rootGraph,t=1);for(var n,r=e.getNodes(),i=r.length,a=0;a<i;a++)(n=r[a]).inclusionTreeDepth=t,null!=n.child&&this.calcInclusionTreeDepths(n.child,t+1)},a.prototype.includesInvalidEdge=function(){for(var e,t=[],n=this.edges.length,r=0;r<n;r++)e=this.edges[r],this.isOneAncestorOfOther(e.source,e.target)&&t.push(e);for(var r=0;r<t.length;r++)this.remove(t[r]);return!1},e.exports=a},function(e,t,n){"use strict";var r=n(12);function i(){}i.calcSeparationAmount=function(e,t,n,r){if(!e.intersects(t))throw"assert failed";var i=[,,];this.decideDirectionsForOverlappingNodes(e,t,i),n[0]=Math.min(e.getRight(),t.getRight())-Math.max(e.x,t.x),n[1]=Math.min(e.getBottom(),t.getBottom())-Math.max(e.y,t.y),e.getX()<=t.getX()&&e.getRight()>=t.getRight()?n[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight()):t.getX()<=e.getX()&&t.getRight()>=e.getRight()&&(n[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight())),e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()?n[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()):t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()&&(n[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()));var a=Math.abs((t.getCenterY()-e.getCenterY())/(t.getCenterX()-e.getCenterX()));t.getCenterY()===e.getCenterY()&&t.getCenterX()===e.getCenterX()&&(a=1);var o=a*n[0],s=n[1]/a;n[0]<s?s=n[0]:o=n[1],n[0]=-1*i[0]*(s/2+r),n[1]=-1*i[1]*(o/2+r)},i.decideDirectionsForOverlappingNodes=function(e,t,n){e.getCenterX()<t.getCenterX()?n[0]=-1:n[0]=1,e.getCenterY()<t.getCenterY()?n[1]=-1:n[1]=1},i.getIntersection2=function(e,t,n){var r=e.getCenterX(),i=e.getCenterY(),a=t.getCenterX(),o=t.getCenterY();if(e.intersects(t))return n[0]=r,n[1]=i,n[2]=a,n[3]=o,!0;var s=e.getX(),l=e.getY(),c=e.getRight(),u=e.getX(),d=e.getBottom(),h=e.getRight(),f=e.getWidthHalf(),p=e.getHeightHalf(),g=t.getX(),v=t.getY(),x=t.getRight(),y=t.getX(),b=t.getBottom(),w=t.getRight(),j=t.getWidthHalf(),N=t.getHeightHalf(),k=!1,C=!1;if(r===a)i>o?(n[0]=r,n[1]=l,n[2]=a,n[3]=b):i<o&&(n[0]=r,n[1]=d,n[2]=a,n[3]=v);else if(i===o)r>a?(n[0]=s,n[1]=i,n[2]=x,n[3]=o):r<a&&(n[0]=c,n[1]=i,n[2]=g,n[3]=o);else{var E=e.height/e.width,_=t.height/t.width,S=(o-i)/(a-r),T=void 0,A=void 0,O=void 0,M=void 0,P=void 0,D=void 0;if(-E===S?(r>a?(n[0]=u,n[1]=d):(n[0]=c,n[1]=l),k=!0):E===S&&(r>a?(n[0]=s,n[1]=l):(n[0]=h,n[1]=d),k=!0),-_===S?(a>r?(n[2]=y,n[3]=b):(n[2]=x,n[3]=v),C=!0):_===S&&(a>r?(n[2]=g,n[3]=v):(n[2]=w,n[3]=b),C=!0),k&&C)return!1;if(r>a?i>o?(T=this.getCardinalDirection(E,S,4),A=this.getCardinalDirection(_,S,2)):(T=this.getCardinalDirection(-E,S,3),A=this.getCardinalDirection(-_,S,1)):i>o?(T=this.getCardinalDirection(-E,S,1),A=this.getCardinalDirection(-_,S,3)):(T=this.getCardinalDirection(E,S,2),A=this.getCardinalDirection(_,S,4)),!k)switch(T){case 1:M=l,O=r+-p/S,n[0]=O,n[1]=M;break;case 2:O=h,M=i+f*S,n[0]=O,n[1]=M;break;case 3:M=d,O=r+p/S,n[0]=O,n[1]=M;break;case 4:O=u,M=i+-f*S,n[0]=O,n[1]=M}if(!C)switch(A){case 1:D=v,P=a+-N/S,n[2]=P,n[3]=D;break;case 2:P=w,D=o+j*S,n[2]=P,n[3]=D;break;case 3:D=b,P=a+N/S,n[2]=P,n[3]=D;break;case 4:P=y,D=o+-j*S,n[2]=P,n[3]=D}}return!1},i.getCardinalDirection=function(e,t,n){return e>t?n:1+n%4},i.getIntersection=function(e,t,n,i){if(null==i)return this.getIntersection2(e,t,n);var a=e.x,o=e.y,s=t.x,l=t.y,c=n.x,u=n.y,d=i.x,h=i.y,f=void 0,p=void 0,g=void 0,v=void 0,x=void 0,y=void 0,b=void 0;return(f=l-o,g=a-s,x=s*o-a*l,p=h-u,v=c-d,y=d*u-c*h,0==(b=f*v-p*g))?null:new r((g*y-v*x)/b,(p*x-f*y)/b)},i.angleOfVector=function(e,t,n,r){var i=void 0;return e!==n?(i=Math.atan((r-t)/(n-e)),n<e?i+=Math.PI:r<t&&(i+=this.TWO_PI)):i=r<t?this.ONE_AND_HALF_PI:this.HALF_PI,i},i.doIntersect=function(e,t,n,r){var i=e.x,a=e.y,o=t.x,s=t.y,l=n.x,c=n.y,u=r.x,d=r.y,h=(o-i)*(d-c)-(u-l)*(s-a);if(0===h)return!1;var f=((d-c)*(u-i)+(l-u)*(d-a))/h,p=((a-s)*(u-i)+(o-i)*(d-a))/h;return 0<f&&f<1&&0<p&&p<1},i.findCircleLineIntersections=function(e,t,n,r,i,a,o){var s=(n-e)*(n-e)+(r-t)*(r-t),l=2*((e-i)*(n-e)+(t-a)*(r-t)),c=(e-i)*(e-i)+(t-a)*(t-a)-o*o;if(!(l*l-4*s*c>=0))return null;var u=(-l+Math.sqrt(l*l-4*s*c))/(2*s),d=(-l-Math.sqrt(l*l-4*s*c))/(2*s);return u>=0&&u<=1?[u]:d>=0&&d<=1?[d]:null},i.HALF_PI=.5*Math.PI,i.ONE_AND_HALF_PI=1.5*Math.PI,i.TWO_PI=2*Math.PI,i.THREE_PI=3*Math.PI,e.exports=i},function(e,t,n){"use strict";function r(){}r.sign=function(e){return e>0?1:e<0?-1:0},r.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},r.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},e.exports=r},function(e,t,n){"use strict";function r(){}r.MAX_VALUE=0x7fffffff,r.MIN_VALUE=-0x80000000,e.exports=r},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(e){return{value:e,next:null,prev:null}},a=function(e,t,n,r){return null!==e?e.next=t:r.head=t,null!==n?n.prev=t:r.tail=t,t.prev=e,t.next=n,r.length++,t},o=function(e,t){var n=e.prev,r=e.next;return null!==n?n.next=r:t.head=r,null!==r?r.prev=n:t.tail=n,e.prev=e.next=null,t.length--,e};e.exports=function(){function e(t){var n=this;if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.length=0,this.head=null,this.tail=null,null!=t&&t.forEach(function(e){return n.push(e)})}return r(e,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(e,t){return a(t.prev,i(e),t,this)}},{key:"insertAfter",value:function(e,t){return a(t,i(e),t.next,this)}},{key:"insertNodeBefore",value:function(e,t){return a(t.prev,e,t,this)}},{key:"insertNodeAfter",value:function(e,t){return a(t,e,t.next,this)}},{key:"push",value:function(e){return a(this.tail,i(e),null,this)}},{key:"unshift",value:function(e){return a(null,i(e),this.head,this)}},{key:"remove",value:function(e){return o(e,this)}},{key:"pop",value:function(){return o(this.tail,this).value}},{key:"popNode",value:function(){return o(this.tail,this)}},{key:"shift",value:function(){return o(this.head,this).value}},{key:"shiftNode",value:function(){return o(this.head,this)}},{key:"get_object_at",value:function(e){if(e<=this.length()){for(var t=1,n=this.head;t<e;)n=n.next,t++;return n.value}}},{key:"set_object_at",value:function(e,t){if(e<=this.length()){for(var n=1,r=this.head;n<e;)r=r.next,n++;r.value=t}}}]),e}()},function(e,t,n){"use strict";function r(e,t,n){this.x=null,this.y=null,null==e&&null==t&&null==n?(this.x=0,this.y=0):"number"==typeof e&&"number"==typeof t&&null==n?(this.x=e,this.y=t):"Point"==e.constructor.name&&null==t&&null==n&&(n=e,this.x=n.x,this.y=n.y)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.getLocation=function(){return new r(this.x,this.y)},r.prototype.setLocation=function(e,t,n){"Point"==e.constructor.name&&null==t&&null==n?(n=e,this.setLocation(n.x,n.y)):"number"==typeof e&&"number"==typeof t&&null==n&&(parseInt(e)==e&&parseInt(t)==t?this.move(e,t):(this.x=Math.floor(e+.5),this.y=Math.floor(t+.5)))},r.prototype.move=function(e,t){this.x=e,this.y=t},r.prototype.translate=function(e,t){this.x+=e,this.y+=t},r.prototype.equals=function(e){return"Point"==e.constructor.name?this.x==e.x&&this.y==e.y:this==e},r.prototype.toString=function(){return new r().constructor.name+"[x="+this.x+",y="+this.y+"]"},e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){this.x=0,this.y=0,this.width=0,this.height=0,null!=e&&null!=t&&null!=n&&null!=r&&(this.x=e,this.y=t,this.width=n,this.height=r)}r.prototype.getX=function(){return this.x},r.prototype.setX=function(e){this.x=e},r.prototype.getY=function(){return this.y},r.prototype.setY=function(e){this.y=e},r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},r.prototype.getRight=function(){return this.x+this.width},r.prototype.getBottom=function(){return this.y+this.height},r.prototype.intersects=function(e){return!(this.getRight()<e.x||this.getBottom()<e.y||e.getRight()<this.x||e.getBottom()<this.y)},r.prototype.getCenterX=function(){return this.x+this.width/2},r.prototype.getMinX=function(){return this.getX()},r.prototype.getMaxX=function(){return this.getX()+this.width},r.prototype.getCenterY=function(){return this.y+this.height/2},r.prototype.getMinY=function(){return this.getY()},r.prototype.getMaxY=function(){return this.getY()+this.height},r.prototype.getWidthHalf=function(){return this.width/2},r.prototype.getHeightHalf=function(){return this.height/2},e.exports=r},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(){}i.lastID=0,i.createID=function(e){return i.isPrimitive(e)?e:(null!=e.uniqueID||(e.uniqueID=i.getString(),i.lastID++),e.uniqueID)},i.getString=function(e){return null==e&&(e=i.lastID),"Object#"+e},i.isPrimitive=function(e){var t=void 0===e?"undefined":r(e);return null==e||"object"!=t&&"function"!=t},e.exports=i},function(e,t,n){"use strict";function r(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}var i=n(0),a=n(7),o=n(3),s=n(1),l=n(6),c=n(5),u=n(17),d=n(29);function h(e){d.call(this),this.layoutQuality=i.QUALITY,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=i.DEFAULT_INCREMENTAL,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new a(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,null!=e&&(this.isRemoteUse=e)}h.RANDOM_SEED=1,h.prototype=Object.create(d.prototype),h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},h.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},h.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},h.prototype.newGraphManager=function(){var e=new a(this);return this.graphManager=e,e},h.prototype.newGraph=function(e){return new l(null,this.graphManager,e)},h.prototype.newNode=function(e){return new o(this.graphManager,e)},h.prototype.newEdge=function(e){return new s(null,null,e)},h.prototype.checkLayoutSuccess=function(){return null==this.graphManager.getRoot()||0==this.graphManager.getRoot().getNodes().length||this.graphManager.includesInvalidEdge()},h.prototype.runLayout=function(){var e;return this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters(),e=!this.checkLayoutSuccess()&&this.layout(),"during"!==i.ANIMATE&&(e&&!this.isSubLayout&&this.doPostLayout(),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,e)},h.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},h.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var e=this.graphManager.getAllEdges(),t=0;t<e.length;t++)e[t];for(var n=this.graphManager.getRoot().getNodes(),t=0;t<n.length;t++)n[t];this.update(this.graphManager.getRoot())}},h.prototype.update=function(e){if(null==e)this.update2();else if(e instanceof o){if(null!=e.getChild())for(var t=e.getChild().getNodes(),n=0;n<t.length;n++)update(t[n]);null!=e.vGraphObject&&e.vGraphObject.update(e)}else e instanceof s?null!=e.vGraphObject&&e.vGraphObject.update(e):e instanceof l&&null!=e.vGraphObject&&e.vGraphObject.update(e)},h.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=i.QUALITY,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=i.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},h.prototype.transform=function(e){if(void 0==e)this.transform(new c(0,0));else{var t=new u,n=this.graphManager.getRoot().updateLeftTop();if(null!=n){t.setWorldOrgX(e.x),t.setWorldOrgY(e.y),t.setDeviceOrgX(n.x),t.setDeviceOrgY(n.y);for(var r=this.getAllNodes(),i=0;i<r.length;i++)r[i].transform(t)}}},h.prototype.positionNodesRandomly=function(e){if(void 0==e)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var t,n,r=e.getNodes(),i=0;i<r.length;i++)null==(n=(t=r[i]).getChild())||0==n.getNodes().length?t.scatter():(this.positionNodesRandomly(n),t.updateBounds())},h.prototype.getFlatForest=function(){for(var e=[],t=!0,n=this.graphManager.getRoot().getNodes(),i=!0,a=0;a<n.length;a++)null!=n[a].getChild()&&(i=!1);if(!i)return e;var o=new Set,s=[],l=new Map,c=[];for(c=c.concat(n);c.length>0&&t;){for(s.push(c[0]);s.length>0&&t;){var u=s[0];s.splice(0,1),o.add(u);for(var d=u.getEdges(),a=0;a<d.length;a++){var h=d[a].getOtherEnd(u);if(l.get(u)!=h)if(o.has(h)){t=!1;break}else s.push(h),l.set(h,u)}}if(t){var f=[].concat(r(o));e.push(f);for(var a=0;a<f.length;a++){var p=f[a],g=c.indexOf(p);g>-1&&c.splice(g,1)}o=new Set,l=new Map}else e=[]}return e},h.prototype.createDummyNodesForBendpoints=function(e){for(var t=[],n=e.source,r=this.graphManager.calcLowestCommonAncestor(e.source,e.target),i=0;i<e.bendpoints.length;i++){var a=this.newNode(null);a.setRect(new Point(0,0),new Dimension(1,1)),r.add(a);var o=this.newEdge(null);this.graphManager.add(o,n,a),t.add(a),n=a}var o=this.newEdge(null);return this.graphManager.add(o,n,e.target),this.edgeToDummyNodes.set(e,t),e.isInterGraph()?this.graphManager.remove(e):r.remove(e),t},h.prototype.createBendpointsFromDummyNodes=function(){var e=[];e=e.concat(this.graphManager.getAllEdges()),e=[].concat(r(this.edgeToDummyNodes.keys())).concat(e);for(var t=0;t<e.length;t++){var n=e[t];if(n.bendpoints.length>0){for(var i=this.edgeToDummyNodes.get(n),a=0;a<i.length;a++){var o=i[a],s=new c(o.getCenterX(),o.getCenterY()),l=n.bendpoints.get(a);l.x=s.x,l.y=s.y,o.getOwner().remove(o)}this.graphManager.add(n,n.source,n.target)}}},h.transform=function(e,t,n,r){if(void 0==n||void 0==r)return e<=50?(i=9*t/500,a=t/10):(i=9*t/50,a=-8*t),i*e+a;var i,a,o=t;return e<=50?o-=(t-t/n)/50*(50-e):o+=(t*r-t)/50*(e-50),o},h.findCenterOfTree=function(e){var t=[];t=t.concat(e);var n=[],r=new Map,i=!1,a=null;(1==t.length||2==t.length)&&(i=!0,a=t[0]);for(var o=0;o<t.length;o++){var s=t[o],l=s.getNeighborsList().size;r.set(s,s.getNeighborsList().size),1==l&&n.push(s)}var c=[];for(c=c.concat(n);!i;){var u=[];u=u.concat(c),c=[];for(var o=0;o<t.length;o++){var s=t[o],d=t.indexOf(s);d>=0&&t.splice(d,1),s.getNeighborsList().forEach(function(e){if(0>n.indexOf(e)){var t=r.get(e)-1;1==t&&c.push(e),r.set(e,t)}})}n=n.concat(c),(1==t.length||2==t.length)&&(i=!0,a=t[0])}return a},h.prototype.setGraphManager=function(e){this.graphManager=e},e.exports=h},function(e,t,n){"use strict";function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=1e4*Math.sin(r.seed++),r.x-Math.floor(r.x)},e.exports=r},function(e,t,n){"use strict";var r=n(5);function i(e,t){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(e){this.lworldOrgX=e},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(e){this.lworldOrgY=e},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(e){this.lworldExtX=e},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(e){this.lworldExtY=e},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e},i.prototype.transformX=function(e){var t=0,n=this.lworldExtX;return 0!=n&&(t=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/n),t},i.prototype.transformY=function(e){var t=0,n=this.lworldExtY;return 0!=n&&(t=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/n),t},i.prototype.inverseTransformX=function(e){var t=0,n=this.ldeviceExtX;return 0!=n&&(t=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/n),t},i.prototype.inverseTransformY=function(e){var t=0,n=this.ldeviceExtY;return 0!=n&&(t=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/n),t},i.prototype.inverseTransformPoint=function(e){return new r(this.inverseTransformX(e.x),this.inverseTransformY(e.y))},e.exports=i},function(e,t,n){"use strict";var r=n(15),i=n(4),a=n(0),o=n(8),s=n(9);function l(){r.call(this),this.useSmartIdealEdgeLengthCalculation=i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=i.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=i.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=i.MAX_ITERATIONS}for(var c in l.prototype=Object.create(r.prototype),r)l[c]=r[c];l.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},l.prototype.calcIdealEdgeLengths=function(){for(var e,t,n,r,o,s,l,c=this.getGraphManager().getAllEdges(),u=0;u<c.length;u++)t=(e=c[u]).idealLength,e.isInterGraph&&(r=e.getSource(),o=e.getTarget(),s=e.getSourceInLca().getEstimatedSize(),l=e.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(e.idealLength+=s+l-2*a.SIMPLE_NODE_SIZE),n=e.getLca().getInclusionTreeDepth(),e.idealLength+=t*i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(r.getInclusionTreeDepth()+o.getInclusionTreeDepth()-2*n))},l.prototype.initSpringEmbedder=function(){var e=this.getAllNodes().length;this.incremental?(e>i.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL):(e>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},l.prototype.calcSpringForces=function(){for(var e,t=this.getAllEdges(),n=0;n<t.length;n++)e=t[n],this.calcSpringForce(e,e.idealLength)},l.prototype.calcRepulsionForces=function(){var e,t,n,r,a,o=!(arguments.length>0)||void 0===arguments[0]||arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&o&&this.updateGrid(),a=new Set,e=0;e<l.length;e++)n=l[e],this.calculateRepulsionForceOfANode(n,a,o,s),a.add(n);else for(e=0;e<l.length;e++)for(n=l[e],t=e+1;t<l.length;t++)r=l[t],n.getOwner()==r.getOwner()&&this.calcRepulsionForce(n,r)},l.prototype.calcGravitationalForces=function(){for(var e,t=this.getAllNodesToApplyGravitation(),n=0;n<t.length;n++)e=t[n],this.calcGravitationalForce(e)},l.prototype.moveNodes=function(){for(var e=this.getAllNodes(),t=0;t<e.length;t++)e[t].move()},l.prototype.calcSpringForce=function(e,t){var n,r,i,a,o=e.getSource(),s=e.getTarget();if(this.uniformLeafNodeSizes&&null==o.getChild()&&null==s.getChild())e.updateLengthSimple();else if(e.updateLength(),e.isOverlapingSourceAndTarget)return;0!=(n=e.getLength())&&(i=(r=e.edgeElasticity*(n-t))*(e.lengthX/n),a=r*(e.lengthY/n),o.springForceX+=i,o.springForceY+=a,s.springForceX-=i,s.springForceY-=a)},l.prototype.calcRepulsionForce=function(e,t){var n,r,a,l,c,u,d,h=e.getRect(),f=t.getRect(),p=[,,],g=[,,,,];if(h.intersects(f)){o.calcSeparationAmount(h,f,p,i.DEFAULT_EDGE_LENGTH/2),u=2*p[0],d=2*p[1];var v=e.noOfChildren*t.noOfChildren/(e.noOfChildren+t.noOfChildren);e.repulsionForceX-=v*u,e.repulsionForceY-=v*d,t.repulsionForceX+=v*u,t.repulsionForceY+=v*d}else this.uniformLeafNodeSizes&&null==e.getChild()&&null==t.getChild()?(n=f.getCenterX()-h.getCenterX(),r=f.getCenterY()-h.getCenterY()):(o.getIntersection(h,f,g),n=g[2]-g[0],r=g[3]-g[1]),Math.abs(n)<i.MIN_REPULSION_DIST&&(n=s.sign(n)*i.MIN_REPULSION_DIST),Math.abs(r)<i.MIN_REPULSION_DIST&&(r=s.sign(r)*i.MIN_REPULSION_DIST),l=Math.sqrt(a=n*n+r*r),u=(c=(e.nodeRepulsion/2+t.nodeRepulsion/2)*e.noOfChildren*t.noOfChildren/a)*n/l,d=c*r/l,e.repulsionForceX-=u,e.repulsionForceY-=d,t.repulsionForceX+=u,t.repulsionForceY+=d},l.prototype.calcGravitationalForce=function(e){var t,n,r,i,a,o,s,l;n=((t=e.getOwner()).getRight()+t.getLeft())/2,r=(t.getTop()+t.getBottom())/2,i=e.getCenterX()-n,a=e.getCenterY()-r,o=Math.abs(i)+e.getWidth()/2,s=Math.abs(a)+e.getHeight()/2,e.getOwner()==this.graphManager.getRoot()?(o>(l=t.getEstimatedSize()*this.gravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i,e.gravitationForceY=-this.gravityConstant*a):(o>(l=t.getEstimatedSize()*this.compoundGravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i*this.compoundGravityConstant,e.gravitationForceY=-this.gravityConstant*a*this.compoundGravityConstant)},l.prototype.isConverged=function(){var e,t=!1;return this.totalIterations>this.maxIterations/3&&(t=2>Math.abs(this.totalDisplacement-this.oldTotalDisplacement)),e=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,e||t},l.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},l.prototype.calcNoOfChildrenForAllNodes=function(){for(var e,t=this.graphManager.getAllNodes(),n=0;n<t.length;n++)(e=t[n]).noOfChildren=e.getNoOfChildren()},l.prototype.calcGrid=function(e){var t=0,n=0;t=parseInt(Math.ceil((e.getRight()-e.getLeft())/this.repulsionRange)),n=parseInt(Math.ceil((e.getBottom()-e.getTop())/this.repulsionRange));for(var r=Array(t),i=0;i<t;i++)r[i]=Array(n);for(var i=0;i<t;i++)for(var a=0;a<n;a++)r[i][a]=[];return r},l.prototype.addNodeToGrid=function(e,t,n){var r=0,i=0,a=0,o=0;r=parseInt(Math.floor((e.getRect().x-t)/this.repulsionRange)),i=parseInt(Math.floor((e.getRect().width+e.getRect().x-t)/this.repulsionRange)),a=parseInt(Math.floor((e.getRect().y-n)/this.repulsionRange)),o=parseInt(Math.floor((e.getRect().height+e.getRect().y-n)/this.repulsionRange));for(var s=r;s<=i;s++)for(var l=a;l<=o;l++)this.grid[s][l].push(e),e.setGridCoordinates(r,i,a,o)},l.prototype.updateGrid=function(){var e,t,n=this.getAllNodes();for(e=0,this.grid=this.calcGrid(this.graphManager.getRoot());e<n.length;e++)t=n[e],this.addNodeToGrid(t,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},l.prototype.calculateRepulsionForceOfANode=function(e,t,n,r){if(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&n||r){var a,o=new Set;e.surrounding=[];for(var s=this.grid,l=e.startX-1;l<e.finishX+2;l++)for(var c=e.startY-1;c<e.finishY+2;c++)if(!(l<0||c<0||l>=s.length||c>=s[0].length)){for(var u=0;u<s[l][c].length;u++)if(a=s[l][c][u],e.getOwner()==a.getOwner()&&e!=a&&!t.has(a)&&!o.has(a)){var d=Math.abs(e.getCenterX()-a.getCenterX())-(e.getWidth()/2+a.getWidth()/2),h=Math.abs(e.getCenterY()-a.getCenterY())-(e.getHeight()/2+a.getHeight()/2);d<=this.repulsionRange&&h<=this.repulsionRange&&o.add(a)}}e.surrounding=[].concat(function(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}(o))}for(l=0;l<e.surrounding.length;l++)this.calcRepulsionForce(e,e.surrounding[l])},l.prototype.calcRepulsionRange=function(){return 0},e.exports=l},function(e,t,n){"use strict";var r=n(1),i=n(4);function a(e,t,n){r.call(this,e,t,n),this.idealLength=i.DEFAULT_EDGE_LENGTH,this.edgeElasticity=i.DEFAULT_SPRING_STRENGTH}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];e.exports=a},function(e,t,n){"use strict";var r=n(3),i=n(4);function a(e,t,n,a){r.call(this,e,t,n,a),this.nodeRepulsion=i.DEFAULT_REPULSION_STRENGTH,this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.prototype.setGridCoordinates=function(e,t,n,r){this.startX=e,this.finishX=t,this.startY=n,this.finishY=r},e.exports=a},function(e,t,n){"use strict";function r(e,t){this.width=0,this.height=0,null!==e&&null!==t&&(this.height=t,this.width=e)}r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},e.exports=r},function(e,t,n){"use strict";var r=n(14);function i(){this.map={},this.keys=[]}i.prototype.put=function(e,t){var n=r.createID(e);this.contains(n)||(this.map[n]=t,this.keys.push(e))},i.prototype.contains=function(e){return r.createID(e),null!=this.map[e]},i.prototype.get=function(e){var t=r.createID(e);return this.map[t]},i.prototype.keySet=function(){return this.keys},e.exports=i},function(e,t,n){"use strict";var r=n(14);function i(){this.set={}}i.prototype.add=function(e){var t=r.createID(e);this.contains(t)||(this.set[t]=e)},i.prototype.remove=function(e){delete this.set[r.createID(e)]},i.prototype.clear=function(){this.set={}},i.prototype.contains=function(e){return this.set[r.createID(e)]==e},i.prototype.isEmpty=function(){return 0===this.size()},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAllTo=function(e){for(var t=Object.keys(this.set),n=t.length,r=0;r<n;r++)e.push(this.set[t[r]])},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAll=function(e){for(var t=e.length,n=0;n<t;n++){var r=e[n];this.add(r)}},e.exports=i},function(e,t,n){"use strict";function r(){}r.multMat=function(e,t){for(var n=[],r=0;r<e.length;r++){n[r]=[];for(var i=0;i<t[0].length;i++){n[r][i]=0;for(var a=0;a<e[0].length;a++)n[r][i]+=e[r][a]*t[a][i]}}return n},r.transpose=function(e){for(var t=[],n=0;n<e[0].length;n++){t[n]=[];for(var r=0;r<e.length;r++)t[n][r]=e[r][n]}return t},r.multCons=function(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=e[r]*t;return n},r.minusOp=function(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=e[r]-t[r];return n},r.dotProduct=function(e,t){for(var n=0,r=0;r<e.length;r++)n+=e[r]*t[r];return n},r.mag=function(e){return Math.sqrt(this.dotProduct(e,e))},r.normalize=function(e){for(var t=[],n=this.mag(e),r=0;r<e.length;r++)t[r]=e[r]/n;return t},r.multGamma=function(e){for(var t=[],n=0,r=0;r<e.length;r++)n+=e[r];n*=-1/e.length;for(var i=0;i<e.length;i++)t[i]=n+e[i];return t},r.multL=function(e,t,n){for(var r=[],i=[],a=[],o=0;o<t[0].length;o++){for(var s=0,l=0;l<t.length;l++)s+=-.5*t[l][o]*e[l];i[o]=s}for(var c=0;c<n.length;c++){for(var u=0,d=0;d<n.length;d++)u+=n[c][d]*i[d];a[c]=u}for(var h=0;h<t.length;h++){for(var f=0,p=0;p<t[0].length;p++)f+=t[h][p]*a[p];r[h]=f}return r},e.exports=r},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(11);e.exports=function(){function e(t,n){if(!(this instanceof e))throw TypeError("Cannot call a class as a function");(null!==n||void 0!==n)&&(this.compareFunction=this._defaultCompareFunction);var r=void 0;r=t instanceof i?t.size():t.length,this._quicksort(t,0,r-1)}return r(e,[{key:"_quicksort",value:function(e,t,n){if(t<n){var r=this._partition(e,t,n);this._quicksort(e,t,r),this._quicksort(e,r+1,n)}}},{key:"_partition",value:function(e,t,n){for(var r=this._get(e,t),i=t,a=n;;){for(;this.compareFunction(r,this._get(e,a));)a--;for(;this.compareFunction(this._get(e,i),r);)i++;if(!(i<a))return a;this._swap(e,i,a),i++,a--}}},{key:"_get",value:function(e,t){return e instanceof i?e.get_object_at(t):e[t]}},{key:"_set",value:function(e,t,n){e instanceof i?e.set_object_at(t,n):e[t]=n}},{key:"_swap",value:function(e,t,n){var r=this._get(e,t);this._set(e,t,this._get(e,n)),this._set(e,n,r)}},{key:"_defaultCompareFunction",value:function(e,t){return t>e}}]),e}()},function(e,t,n){"use strict";function r(){}r.svd=function(e){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=e.length,this.n=e[0].length;var t=Math.min(this.m,this.n);this.s=function(e){for(var t=[];e-- >0;)t.push(0);return t}(Math.min(this.m+1,this.n)),this.U=function e(t){if(0==t.length)return 0;for(var n=[],r=0;r<t[0];r++)n.push(e(t.slice(1)));return n}([this.m,t]),this.V=function e(t){if(0==t.length)return 0;for(var n=[],r=0;r<t[0];r++)n.push(e(t.slice(1)));return n}([this.n,this.n]);for(var n=function(e){for(var t=[];e-- >0;)t.push(0);return t}(this.n),i=function(e){for(var t=[];e-- >0;)t.push(0);return t}(this.m),a=Math.min(this.m-1,this.n),o=Math.max(0,Math.min(this.n-2,this.m)),s=0;s<Math.max(a,o);s++){if(s<a){this.s[s]=0;for(var l=s;l<this.m;l++)this.s[s]=r.hypot(this.s[s],e[l][s]);if(0!==this.s[s]){e[s][s]<0&&(this.s[s]=-this.s[s]);for(var c=s;c<this.m;c++)e[c][s]/=this.s[s];e[s][s]+=1}this.s[s]=-this.s[s]}for(var u=s+1;u<this.n;u++){if(g=s<a,v=0!==this.s[s],g&&v){for(var d=0,h=s;h<this.m;h++)d+=e[h][s]*e[h][u];d=-d/e[s][s];for(var f=s;f<this.m;f++)e[f][u]+=d*e[f][s]}n[u]=e[s][u]}if(x=s<a)for(var p=s;p<this.m;p++)this.U[p][s]=e[p][s];if(s<o){n[s]=0;for(var g,v,x,y,b,w=s+1;w<this.n;w++)n[s]=r.hypot(n[s],n[w]);if(0!==n[s]){n[s+1]<0&&(n[s]=-n[s]);for(var j=s+1;j<this.n;j++)n[j]/=n[s];n[s+1]+=1}if(n[s]=-n[s],y=s+1<this.m,b=0!==n[s],y&&b){for(var N=s+1;N<this.m;N++)i[N]=0;for(var k=s+1;k<this.n;k++)for(var C=s+1;C<this.m;C++)i[C]+=n[k]*e[C][k];for(var E=s+1;E<this.n;E++)for(var _=-n[E]/n[s+1],S=s+1;S<this.m;S++)e[S][E]+=_*i[S]}for(var T=s+1;T<this.n;T++)this.V[T][s]=n[T]}}var A=Math.min(this.n,this.m+1);a<this.n&&(this.s[a]=e[a][a]),this.m<A&&(this.s[A-1]=0),o+1<A&&(n[o]=e[o][A-1]),n[A-1]=0;for(var O=a;O<t;O++){for(var M=0;M<this.m;M++)this.U[M][O]=0;this.U[O][O]=1}for(var P=a-1;P>=0;P--)if(0!==this.s[P]){for(var D=P+1;D<t;D++){for(var L=0,I=P;I<this.m;I++)L+=this.U[I][P]*this.U[I][D];L=-L/this.U[P][P];for(var R=P;R<this.m;R++)this.U[R][D]+=L*this.U[R][P]}for(var B=P;B<this.m;B++)this.U[B][P]=-this.U[B][P];this.U[P][P]=1+this.U[P][P];for(var z=0;z<P-1;z++)this.U[z][P]=0}else{for(var F=0;F<this.m;F++)this.U[F][P]=0;this.U[P][P]=1}for(var V=this.n-1;V>=0;V--){if(ed=V<o,eh=0!==n[V],ed&&eh)for(var U=V+1;U<t;U++){for(var H=0,W=V+1;W<this.n;W++)H+=this.V[W][V]*this.V[W][U];H=-H/this.V[V+1][V];for(var Y=V+1;Y<this.n;Y++)this.V[Y][U]+=H*this.V[Y][V]}for(var G=0;G<this.n;G++)this.V[G][V]=0;this.V[V][V]=1}for(var $=A-1,X=0;A>0;){var q=void 0,K=void 0;for(q=A-2;q>=-1&&-1!==q;q--)if(Math.abs(n[q])<=16033346880071782e-307+2220446049250313e-31*(Math.abs(this.s[q])+Math.abs(this.s[q+1]))){n[q]=0;break}if(q===A-2)K=4;else{var Z=void 0;for(Z=A-1;Z>=q&&Z!==q;Z--){var Q=(Z!==A?Math.abs(n[Z]):0)+(Z!==q+1?Math.abs(n[Z-1]):0);if(Math.abs(this.s[Z])<=16033346880071782e-307+2220446049250313e-31*Q){this.s[Z]=0;break}}Z===q?K=3:Z===A-1?K=1:(K=2,q=Z)}switch(q++,K){case 1:var J=n[A-2];n[A-2]=0;for(var ee=A-2;ee>=q;ee--){var et=r.hypot(this.s[ee],J),en=this.s[ee]/et,er=J/et;this.s[ee]=et,ee!==q&&(J=-er*n[ee-1],n[ee-1]=en*n[ee-1]);for(var ei=0;ei<this.n;ei++)et=en*this.V[ei][ee]+er*this.V[ei][A-1],this.V[ei][A-1]=-er*this.V[ei][ee]+en*this.V[ei][A-1],this.V[ei][ee]=et}break;case 2:var ea=n[q-1];n[q-1]=0;for(var eo=q;eo<A;eo++){var es=r.hypot(this.s[eo],ea),el=this.s[eo]/es,ec=ea/es;this.s[eo]=es,ea=-ec*n[eo],n[eo]=el*n[eo];for(var eu=0;eu<this.m;eu++)es=el*this.U[eu][eo]+ec*this.U[eu][q-1],this.U[eu][q-1]=-ec*this.U[eu][eo]+el*this.U[eu][q-1],this.U[eu][eo]=es}break;case 3:var ed,eh,ef,ep,em=Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[A-1]),Math.abs(this.s[A-2])),Math.abs(n[A-2])),Math.abs(this.s[q])),Math.abs(n[q])),eg=this.s[A-1]/em,ev=this.s[A-2]/em,ex=n[A-2]/em,ey=this.s[q]/em,eb=n[q]/em,ew=((ev+eg)*(ev-eg)+ex*ex)/2,ej=eg*ex*(eg*ex),eN=0;ef=0!==ew,ep=0!==ej,(ef||ep)&&(eN=Math.sqrt(ew*ew+ej),ew<0&&(eN=-eN),eN=ej/(ew+eN));for(var ek=(ey+eg)*(ey-eg)+eN,eC=ey*eb,eE=q;eE<A-1;eE++){var e_=r.hypot(ek,eC),eS=ek/e_,eT=eC/e_;eE!==q&&(n[eE-1]=e_),ek=eS*this.s[eE]+eT*n[eE],n[eE]=eS*n[eE]-eT*this.s[eE],eC=eT*this.s[eE+1],this.s[eE+1]=eS*this.s[eE+1];for(var eA=0;eA<this.n;eA++)e_=eS*this.V[eA][eE]+eT*this.V[eA][eE+1],this.V[eA][eE+1]=-eT*this.V[eA][eE]+eS*this.V[eA][eE+1],this.V[eA][eE]=e_;if(e_=r.hypot(ek,eC),eS=ek/e_,eT=eC/e_,this.s[eE]=e_,ek=eS*n[eE]+eT*this.s[eE+1],this.s[eE+1]=-eT*n[eE]+eS*this.s[eE+1],eC=eT*n[eE+1],n[eE+1]=eS*n[eE+1],eE<this.m-1)for(var eO=0;eO<this.m;eO++)e_=eS*this.U[eO][eE]+eT*this.U[eO][eE+1],this.U[eO][eE+1]=-eT*this.U[eO][eE]+eS*this.U[eO][eE+1],this.U[eO][eE]=e_}n[A-2]=ek;break;case 4:if(this.s[q]<=0){this.s[q]=this.s[q]<0?-this.s[q]:0;for(var eM=0;eM<=$;eM++)this.V[eM][q]=-this.V[eM][q]}for(;q<$&&!(this.s[q]>=this.s[q+1]);){var eP=this.s[q];if(this.s[q]=this.s[q+1],this.s[q+1]=eP,q<this.n-1)for(var eD=0;eD<this.n;eD++)eP=this.V[eD][q+1],this.V[eD][q+1]=this.V[eD][q],this.V[eD][q]=eP;if(q<this.m-1)for(var eL=0;eL<this.m;eL++)eP=this.U[eL][q+1],this.U[eL][q+1]=this.U[eL][q],this.U[eL][q]=eP;q++}A--}}return{U:this.U,V:this.V,S:this.s}},r.hypot=function(e,t){var n=void 0;return Math.abs(e)>Math.abs(t)?(n=t/e,n=Math.abs(e)*Math.sqrt(1+n*n)):0!=t?(n=e/t,n=Math.abs(t)*Math.sqrt(1+n*n)):n=0,n},e.exports=r},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();e.exports=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.sequence1=t,this.sequence2=n,this.match_score=r,this.mismatch_penalty=i,this.gap_penalty=a,this.iMax=t.length+1,this.jMax=n.length+1,this.grid=Array(this.iMax);for(var o=0;o<this.iMax;o++){this.grid[o]=Array(this.jMax);for(var s=0;s<this.jMax;s++)this.grid[o][s]=0}this.tracebackGrid=Array(this.iMax);for(var l=0;l<this.iMax;l++){this.tracebackGrid[l]=Array(this.jMax);for(var c=0;c<this.jMax;c++)this.tracebackGrid[l][c]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return r(e,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var e=1;e<this.jMax;e++)this.grid[0][e]=this.grid[0][e-1]+this.gap_penalty,this.tracebackGrid[0][e]=[!1,!1,!0];for(var t=1;t<this.iMax;t++)this.grid[t][0]=this.grid[t-1][0]+this.gap_penalty,this.tracebackGrid[t][0]=[!1,!0,!1];for(var n=1;n<this.iMax;n++)for(var r=1;r<this.jMax;r++){var i=[this.sequence1[n-1]===this.sequence2[r-1]?this.grid[n-1][r-1]+this.match_score:this.grid[n-1][r-1]+this.mismatch_penalty,this.grid[n-1][r]+this.gap_penalty,this.grid[n][r-1]+this.gap_penalty],a=this.arrayAllMaxIndexes(i);this.grid[n][r]=i[a[0]],this.tracebackGrid[n][r]=[a.includes(0),a.includes(1),a.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var e=[];for(e.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});e[0];){var t=e[0],n=this.tracebackGrid[t.pos[0]][t.pos[1]];n[0]&&e.push({pos:[t.pos[0]-1,t.pos[1]-1],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),n[1]&&e.push({pos:[t.pos[0]-1,t.pos[1]],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:"-"+t.seq2}),n[2]&&e.push({pos:[t.pos[0],t.pos[1]-1],seq1:"-"+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),0===t.pos[0]&&0===t.pos[1]&&this.alignments.push({sequence1:t.seq1,sequence2:t.seq2}),e.shift()}return this.alignments}},{key:"getAllIndexes",value:function(e,t){for(var n=[],r=-1;-1!==(r=e.indexOf(t,r+1));)n.push(r);return n}},{key:"arrayAllMaxIndexes",value:function(e){return this.getAllIndexes(e,Math.max.apply(null,e))}}]),e}()},function(e,t,n){"use strict";var r=function(){};r.FDLayout=n(18),r.FDLayoutConstants=n(4),r.FDLayoutEdge=n(19),r.FDLayoutNode=n(20),r.DimensionD=n(21),r.HashMap=n(22),r.HashSet=n(23),r.IGeometry=n(8),r.IMath=n(9),r.Integer=n(10),r.Point=n(12),r.PointD=n(5),r.RandomSeed=n(16),r.RectangleD=n(13),r.Transform=n(17),r.UniqueIDGeneretor=n(14),r.Quicksort=n(25),r.LinkedList=n(11),r.LGraphObject=n(2),r.LGraph=n(6),r.LEdge=n(1),r.LGraphManager=n(7),r.LNode=n(3),r.Layout=n(15),r.LayoutConstants=n(0),r.NeedlemanWunsch=n(27),r.Matrix=n(24),r.SVD=n(26),e.exports=r},function(e,t,n){"use strict";function r(){this.listeners=[]}var i=r.prototype;i.addListener=function(e,t){this.listeners.push({event:e,callback:t})},i.removeListener=function(e,t){for(var n=this.listeners.length;n>=0;n--){var r=this.listeners[n];r.event===e&&r.callback===t&&this.listeners.splice(n,1)}},i.emit=function(e,t){for(var n=0;n<this.listeners.length;n++){var r=this.listeners[n];e===r.event&&r.callback(t)}},e.exports=r}],t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=28)}()},97659,(e,t,n)=>{var r;e.e,r=e.r(51273),t.exports=(()=>{"use strict";var e={45:(e,t,n)=>{var r={};r.layoutBase=n(551),r.CoSEConstants=n(806),r.CoSEEdge=n(767),r.CoSEGraph=n(880),r.CoSEGraphManager=n(578),r.CoSELayout=n(765),r.CoSENode=n(991),r.ConstraintHandler=n(902),e.exports=r},806:(e,t,n)=>{var r=n(551).FDLayoutConstants;function i(){}for(var a in r)i[a]=r[a];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!0,i.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,i.TREE_REDUCTION_ON_INCREMENTAL=!0,i.PURE_INCREMENTAL=i.DEFAULT_INCREMENTAL,e.exports=i},767:(e,t,n)=>{var r=n(551).FDLayoutEdge;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},880:(e,t,n)=>{var r=n(551).LGraph;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},578:(e,t,n)=>{var r=n(551).LGraphManager;function i(e){r.call(this,e)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},765:(e,t,n)=>{var r=n(551).FDLayout,i=n(578),a=n(880),o=n(991),s=n(767),l=n(806),c=n(902),u=n(551).FDLayoutConstants,d=n(551).LayoutConstants,h=n(551).Point,f=n(551).PointD,p=n(551).DimensionD,g=n(551).Layout,v=n(551).Integer,x=n(551).IGeometry,y=n(551).LGraph,b=n(551).Transform,w=n(551).LinkedList;function j(){r.call(this),this.toBeTiled={},this.constraints={}}for(var N in j.prototype=Object.create(r.prototype),r)j[N]=r[N];j.prototype.newGraphManager=function(){var e=new i(this);return this.graphManager=e,e},j.prototype.newGraph=function(e){return new a(null,this.graphManager,e)},j.prototype.newNode=function(e){return new o(this.graphManager,e)},j.prototype.newEdge=function(e){return new s(null,null,e)},j.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.isSubLayout||(l.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=l.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=u.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=u.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=u.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=u.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},j.prototype.initSpringEmbedder=function(){r.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/u.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},j.prototype.layout=function(){return d.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},j.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(l.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter(function(t){return e.has(t)});this.graphManager.setAllNodesToApplyGravitation(t)}}else{var n=this.getFlatForest();if(n.length>0)this.positionNodesRadially(n);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter(function(t){return e.has(t)});this.graphManager.setAllNodesToApplyGravitation(t),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),l.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},j.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(!(this.prunedNodesAll.length>0))return!0;else this.isTreeGrowing=!0;if(this.totalIterations%u.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(!(this.prunedNodesAll.length>0))return!0;else this.isTreeGrowing=!0;this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter(function(t){return e.has(t)});this.graphManager.setAllNodesToApplyGravitation(t),this.graphManager.updateBounds(),this.updateGrid(),l.PURE_INCREMENTAL?this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),l.PURE_INCREMENTAL?this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var n=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(n,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},j.prototype.getPositionsData=function(){for(var e=this.graphManager.getAllNodes(),t={},n=0;n<e.length;n++){var r=e[n].rect,i=e[n].id;t[i]={id:i,x:r.getCenterX(),y:r.getCenterY(),w:r.width,h:r.height}}return t},j.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var e=!1;if("during"===u.ANIMATE)this.emit("layoutstarted");else{for(;!e;)e=this.tick();this.graphManager.updateBounds()}},j.prototype.moveNodes=function(){for(var e,t=this.getAllNodes(),n=0;n<t.length;n++)t[n].calculateDisplacement();Object.keys(this.constraints).length>0&&this.updateDisplacements();for(var n=0;n<t.length;n++)t[n].move()},j.prototype.initConstraintVariables=function(){var e=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var t=this.graphManager.getAllNodes(),n=0;n<t.length;n++){var r=t[n];this.idToNodeMap.set(r.id,r)}if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function(t){e.fixedNodeSet.add(t.nodeId)});for(var r,t=this.graphManager.getAllNodes(),n=0;n<t.length;n++)if(null!=(r=t[n]).getChild()){var i=function t(n){for(var r,i=n.getChild().getNodes(),a=0,o=0;o<i.length;o++)null==(r=i[o]).getChild()?e.fixedNodeSet.has(r.id)&&(a+=100):a+=t(r);return a}(r);i>0&&(r.fixedNodeWeight=i)}}if(this.constraints.relativePlacementConstraint){var a=new Map,o=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(t){e.fixedNodesOnHorizontal.add(t),e.fixedNodesOnVertical.add(t)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var s=this.constraints.alignmentConstraint.vertical,n=0;n<s.length;n++)this.dummyToNodeForVerticalAlignment.set("dummy"+n,[]),s[n].forEach(function(t){a.set(t,"dummy"+n),e.dummyToNodeForVerticalAlignment.get("dummy"+n).push(t),e.fixedNodeSet.has(t)&&e.fixedNodesOnHorizontal.add("dummy"+n)});if(this.constraints.alignmentConstraint.horizontal)for(var c=this.constraints.alignmentConstraint.horizontal,n=0;n<c.length;n++)this.dummyToNodeForHorizontalAlignment.set("dummy"+n,[]),c[n].forEach(function(t){o.set(t,"dummy"+n),e.dummyToNodeForHorizontalAlignment.get("dummy"+n).push(t),e.fixedNodeSet.has(t)&&e.fixedNodesOnVertical.add("dummy"+n)})}if(l.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(e){var t,n,r;for(r=e.length-1;r>=2*e.length/3;r--)t=Math.floor(Math.random()*(r+1)),n=e[r],e[r]=e[t],e[t]=n;return e},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(t){if(t.left){var n=a.has(t.left)?a.get(t.left):t.left,r=a.has(t.right)?a.get(t.right):t.right;e.nodesInRelativeHorizontal.includes(n)||(e.nodesInRelativeHorizontal.push(n),e.nodeToRelativeConstraintMapHorizontal.set(n,[]),e.dummyToNodeForVerticalAlignment.has(n)?e.nodeToTempPositionMapHorizontal.set(n,e.idToNodeMap.get(e.dummyToNodeForVerticalAlignment.get(n)[0]).getCenterX()):e.nodeToTempPositionMapHorizontal.set(n,e.idToNodeMap.get(n).getCenterX())),e.nodesInRelativeHorizontal.includes(r)||(e.nodesInRelativeHorizontal.push(r),e.nodeToRelativeConstraintMapHorizontal.set(r,[]),e.dummyToNodeForVerticalAlignment.has(r)?e.nodeToTempPositionMapHorizontal.set(r,e.idToNodeMap.get(e.dummyToNodeForVerticalAlignment.get(r)[0]).getCenterX()):e.nodeToTempPositionMapHorizontal.set(r,e.idToNodeMap.get(r).getCenterX())),e.nodeToRelativeConstraintMapHorizontal.get(n).push({right:r,gap:t.gap}),e.nodeToRelativeConstraintMapHorizontal.get(r).push({left:n,gap:t.gap})}else{var i=o.has(t.top)?o.get(t.top):t.top,s=o.has(t.bottom)?o.get(t.bottom):t.bottom;e.nodesInRelativeVertical.includes(i)||(e.nodesInRelativeVertical.push(i),e.nodeToRelativeConstraintMapVertical.set(i,[]),e.dummyToNodeForHorizontalAlignment.has(i)?e.nodeToTempPositionMapVertical.set(i,e.idToNodeMap.get(e.dummyToNodeForHorizontalAlignment.get(i)[0]).getCenterY()):e.nodeToTempPositionMapVertical.set(i,e.idToNodeMap.get(i).getCenterY())),e.nodesInRelativeVertical.includes(s)||(e.nodesInRelativeVertical.push(s),e.nodeToRelativeConstraintMapVertical.set(s,[]),e.dummyToNodeForHorizontalAlignment.has(s)?e.nodeToTempPositionMapVertical.set(s,e.idToNodeMap.get(e.dummyToNodeForHorizontalAlignment.get(s)[0]).getCenterY()):e.nodeToTempPositionMapVertical.set(s,e.idToNodeMap.get(s).getCenterY())),e.nodeToRelativeConstraintMapVertical.get(i).push({bottom:s,gap:t.gap}),e.nodeToRelativeConstraintMapVertical.get(s).push({top:i,gap:t.gap})}});else{var u=new Map,d=new Map;this.constraints.relativePlacementConstraint.forEach(function(e){if(e.left){var t=a.has(e.left)?a.get(e.left):e.left,n=a.has(e.right)?a.get(e.right):e.right;u.has(t)?u.get(t).push(n):u.set(t,[n]),u.has(n)?u.get(n).push(t):u.set(n,[t])}else{var r=o.has(e.top)?o.get(e.top):e.top,i=o.has(e.bottom)?o.get(e.bottom):e.bottom;d.has(r)?d.get(r).push(i):d.set(r,[i]),d.has(i)?d.get(i).push(r):d.set(i,[r])}});var h=function(e,t){var n=[],r=[],i=new w,a=new Set,o=0;return e.forEach(function(s,l){if(!a.has(l)){n[o]=[],r[o]=!1;var c=l;for(i.push(c),a.add(c),n[o].push(c);0!=i.length;)c=i.shift(),t.has(c)&&(r[o]=!0),e.get(c).forEach(function(e){a.has(e)||(i.push(e),a.add(e),n[o].push(e))});o++}}),{components:n,isFixed:r}},f=h(u,e.fixedNodesOnHorizontal);this.componentsOnHorizontal=f.components,this.fixedComponentsOnHorizontal=f.isFixed;var p=h(d,e.fixedNodesOnVertical);this.componentsOnVertical=p.components,this.fixedComponentsOnVertical=p.isFixed}}},j.prototype.updateDisplacements=function(){var e=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(t){var n=e.idToNodeMap.get(t.nodeId);n.displacementX=0,n.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var t=this.constraints.alignmentConstraint.vertical,n=0;n<t.length;n++){for(var r=0,i=0;i<t[n].length;i++){if(this.fixedNodeSet.has(t[n][i])){r=0;break}r+=this.idToNodeMap.get(t[n][i]).displacementX}for(var a=r/t[n].length,i=0;i<t[n].length;i++)this.idToNodeMap.get(t[n][i]).displacementX=a}if(this.constraints.alignmentConstraint.horizontal)for(var o=this.constraints.alignmentConstraint.horizontal,n=0;n<o.length;n++){for(var s=0,i=0;i<o[n].length;i++){if(this.fixedNodeSet.has(o[n][i])){s=0;break}s+=this.idToNodeMap.get(o[n][i]).displacementY}for(var c=s/o[n].length,i=0;i<o[n].length;i++)this.idToNodeMap.get(o[n][i]).displacementY=c}}if(this.constraints.relativePlacementConstraint)if(l.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach(function(t){if(!e.fixedNodesOnHorizontal.has(t)){var n=0;n=e.dummyToNodeForVerticalAlignment.has(t)?e.idToNodeMap.get(e.dummyToNodeForVerticalAlignment.get(t)[0]).displacementX:e.idToNodeMap.get(t).displacementX,e.nodeToRelativeConstraintMapHorizontal.get(t).forEach(function(r){if(r.right){var i=e.nodeToTempPositionMapHorizontal.get(r.right)-e.nodeToTempPositionMapHorizontal.get(t)-n;i<r.gap&&(n-=r.gap-i)}else{var i=e.nodeToTempPositionMapHorizontal.get(t)-e.nodeToTempPositionMapHorizontal.get(r.left)+n;i<r.gap&&(n+=r.gap-i)}}),e.nodeToTempPositionMapHorizontal.set(t,e.nodeToTempPositionMapHorizontal.get(t)+n),e.dummyToNodeForVerticalAlignment.has(t)?e.dummyToNodeForVerticalAlignment.get(t).forEach(function(t){e.idToNodeMap.get(t).displacementX=n}):e.idToNodeMap.get(t).displacementX=n}}),this.nodesInRelativeVertical.forEach(function(t){if(!e.fixedNodesOnHorizontal.has(t)){var n=0;n=e.dummyToNodeForHorizontalAlignment.has(t)?e.idToNodeMap.get(e.dummyToNodeForHorizontalAlignment.get(t)[0]).displacementY:e.idToNodeMap.get(t).displacementY,e.nodeToRelativeConstraintMapVertical.get(t).forEach(function(r){if(r.bottom){var i=e.nodeToTempPositionMapVertical.get(r.bottom)-e.nodeToTempPositionMapVertical.get(t)-n;i<r.gap&&(n-=r.gap-i)}else{var i=e.nodeToTempPositionMapVertical.get(t)-e.nodeToTempPositionMapVertical.get(r.top)+n;i<r.gap&&(n+=r.gap-i)}}),e.nodeToTempPositionMapVertical.set(t,e.nodeToTempPositionMapVertical.get(t)+n),e.dummyToNodeForHorizontalAlignment.has(t)?e.dummyToNodeForHorizontalAlignment.get(t).forEach(function(t){e.idToNodeMap.get(t).displacementY=n}):e.idToNodeMap.get(t).displacementY=n}});else{for(var n=0;n<this.componentsOnHorizontal.length;n++){var u=this.componentsOnHorizontal[n];if(this.fixedComponentsOnHorizontal[n])for(var i=0;i<u.length;i++)this.dummyToNodeForVerticalAlignment.has(u[i])?this.dummyToNodeForVerticalAlignment.get(u[i]).forEach(function(t){e.idToNodeMap.get(t).displacementX=0}):this.idToNodeMap.get(u[i]).displacementX=0;else{for(var d=0,h=0,i=0;i<u.length;i++)if(this.dummyToNodeForVerticalAlignment.has(u[i])){var f=this.dummyToNodeForVerticalAlignment.get(u[i]);d+=f.length*this.idToNodeMap.get(f[0]).displacementX,h+=f.length}else d+=this.idToNodeMap.get(u[i]).displacementX,h++;for(var p=d/h,i=0;i<u.length;i++)this.dummyToNodeForVerticalAlignment.has(u[i])?this.dummyToNodeForVerticalAlignment.get(u[i]).forEach(function(t){e.idToNodeMap.get(t).displacementX=p}):this.idToNodeMap.get(u[i]).displacementX=p}}for(var n=0;n<this.componentsOnVertical.length;n++){var u=this.componentsOnVertical[n];if(this.fixedComponentsOnVertical[n])for(var i=0;i<u.length;i++)this.dummyToNodeForHorizontalAlignment.has(u[i])?this.dummyToNodeForHorizontalAlignment.get(u[i]).forEach(function(t){e.idToNodeMap.get(t).displacementY=0}):this.idToNodeMap.get(u[i]).displacementY=0;else{for(var d=0,h=0,i=0;i<u.length;i++)if(this.dummyToNodeForHorizontalAlignment.has(u[i])){var f=this.dummyToNodeForHorizontalAlignment.get(u[i]);d+=f.length*this.idToNodeMap.get(f[0]).displacementY,h+=f.length}else d+=this.idToNodeMap.get(u[i]).displacementY,h++;for(var p=d/h,i=0;i<u.length;i++)this.dummyToNodeForHorizontalAlignment.has(u[i])?this.dummyToNodeForHorizontalAlignment.get(u[i]).forEach(function(t){e.idToNodeMap.get(t).displacementY=p}):this.idToNodeMap.get(u[i]).displacementY=p}}}},j.prototype.calculateNodesToApplyGravitationTo=function(){var e,t,n=[],r=this.graphManager.getGraphs(),i=r.length;for(t=0;t<i;t++)(e=r[t]).updateConnected(),e.isConnected||(n=n.concat(e.getNodes()));return n},j.prototype.createBendpoints=function(){var e=[];e=e.concat(this.graphManager.getAllEdges());var t=new Set;for(a=0;a<e.length;a++){var n=e[a];if(!t.has(n)){var r=n.getSource(),i=n.getTarget();if(r==i)n.getBendpoints().push(new f),n.getBendpoints().push(new f),this.createDummyNodesForBendpoints(n),t.add(n);else{var a,o,s=[];if(s=(s=s.concat(r.getEdgeListToNode(i))).concat(i.getEdgeListToNode(r)),!t.has(s[0])){if(s.length>1)for(o=0;o<s.length;o++){var l=s[o];l.getBendpoints().push(new f),this.createDummyNodesForBendpoints(l)}s.forEach(function(e){t.add(e)})}}}if(t.size==e.length)break}},j.prototype.positionNodesRadially=function(e){for(var t=new h(0,0),n=Math.ceil(Math.sqrt(e.length)),r=0,i=0,a=0,o=new f(0,0),s=0;s<e.length;s++){s%n==0&&(a=0,i=r,0!=s&&(i+=l.DEFAULT_COMPONENT_SEPERATION),r=0);var c=e[s],u=g.findCenterOfTree(c);t.x=a,t.y=i,(o=j.radialLayout(c,u,t)).y>r&&(r=Math.floor(o.y)),a=Math.floor(o.x+l.DEFAULT_COMPONENT_SEPERATION)}this.transform(new f(d.WORLD_CENTER_X-o.x/2,d.WORLD_CENTER_Y-o.y/2))},j.radialLayout=function(e,t,n){var r=Math.max(this.maxDiagonalInTree(e),l.DEFAULT_RADIAL_SEPARATION);j.branchRadialLayout(t,null,0,359,0,r);var i=y.calculateBounds(e),a=new b;a.setDeviceOrgX(i.getMinX()),a.setDeviceOrgY(i.getMinY()),a.setWorldOrgX(n.x),a.setWorldOrgY(n.y);for(var o=0;o<e.length;o++)e[o].transform(a);var s=new f(i.getMaxX(),i.getMaxY());return a.inverseTransformPoint(s)},j.branchRadialLayout=function(e,t,n,r,i,a){var o,s=(r-n+1)/2;s<0&&(s+=180);var l=(s+n)%360*x.TWO_PI/360,c=i*Math.cos(l),u=i*Math.sin(l);e.setCenter(c,u);var d=[],h=(d=d.concat(e.getEdges())).length;null!=t&&h--;for(var f=0,p=d.length,g=e.getEdgesBetween(t);g.length>1;){var v=g[0];g.splice(0,1);var y=d.indexOf(v);y>=0&&d.splice(y,1),p--,h--}o=null!=t?(d.indexOf(g[0])+1)%p:0;for(var b=Math.abs(r-n)/h,w=o;f!=h;w=++w%p){var N=d[w].getOtherEnd(e);if(N!=t){var k=(n+f*b)%360,C=(k+b)%360;j.branchRadialLayout(N,e,k,C,i+a,a),f++}}},j.maxDiagonalInTree=function(e){for(var t=v.MIN_VALUE,n=0;n<e.length;n++){var r=e[n].getDiagonal();r>t&&(t=r)}return t},j.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},j.prototype.groupZeroDegreeMembers=function(){var e=this,t={};this.memberGroups={},this.idToDummyNode={};for(var n=[],r=this.graphManager.getAllNodes(),i=0;i<r.length;i++){var a=r[i],s=a.getParent();0!==this.getNodeDegreeWithChildren(a)||void 0!=s.id&&this.getToBeTiled(s)||n.push(a)}for(var i=0;i<n.length;i++){var a=n[i],l=a.getParent().id;void 0===t[l]&&(t[l]=[]),t[l]=t[l].concat(a)}Object.keys(t).forEach(function(n){if(t[n].length>1){var r="DummyCompound_"+n;e.memberGroups[r]=t[n];var i=t[n][0].getParent(),a=new o(e.graphManager);a.id=r,a.paddingLeft=i.paddingLeft||0,a.paddingRight=i.paddingRight||0,a.paddingBottom=i.paddingBottom||0,a.paddingTop=i.paddingTop||0,e.idToDummyNode[r]=a;var s=e.getGraphManager().add(e.newGraph(),a),l=i.getChild();l.add(a);for(var c=0;c<t[n].length;c++){var u=t[n][c];l.remove(u),s.add(u)}}})},j.prototype.clearCompounds=function(){var e={},t={};this.performDFSOnCompounds();for(var n=0;n<this.compoundOrder.length;n++)t[this.compoundOrder[n].id]=this.compoundOrder[n],e[this.compoundOrder[n].id]=[].concat(this.compoundOrder[n].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[n].getChild()),this.compoundOrder[n].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(e,t)},j.prototype.clearZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(n){var r=e.idToDummyNode[n];if(t[n]=e.tileNodes(e.memberGroups[n],r.paddingLeft+r.paddingRight),r.rect.width=t[n].width,r.rect.height=t[n].height,r.setCenter(t[n].centerX,t[n].centerY),r.labelMarginLeft=0,r.labelMarginTop=0,l.NODE_DIMENSIONS_INCLUDE_LABELS){var i=r.rect.width,a=r.rect.height;r.labelWidth&&("left"==r.labelPosHorizontal?(r.rect.x-=r.labelWidth,r.setWidth(i+r.labelWidth),r.labelMarginLeft=r.labelWidth):"center"==r.labelPosHorizontal&&r.labelWidth>i?(r.rect.x-=(r.labelWidth-i)/2,r.setWidth(r.labelWidth),r.labelMarginLeft=(r.labelWidth-i)/2):"right"==r.labelPosHorizontal&&r.setWidth(i+r.labelWidth)),r.labelHeight&&("top"==r.labelPosVertical?(r.rect.y-=r.labelHeight,r.setHeight(a+r.labelHeight),r.labelMarginTop=r.labelHeight):"center"==r.labelPosVertical&&r.labelHeight>a?(r.rect.y-=(r.labelHeight-a)/2,r.setHeight(r.labelHeight),r.labelMarginTop=(r.labelHeight-a)/2):"bottom"==r.labelPosVertical&&r.setHeight(a+r.labelHeight))}})},j.prototype.repopulateCompounds=function(){for(var e=this.compoundOrder.length-1;e>=0;e--){var t=this.compoundOrder[e],n=t.id,r=t.paddingLeft,i=t.paddingTop,a=t.labelMarginLeft,o=t.labelMarginTop;this.adjustLocations(this.tiledMemberPack[n],t.rect.x,t.rect.y,r,i,a,o)}},j.prototype.repopulateZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack;Object.keys(t).forEach(function(n){var r=e.idToDummyNode[n],i=r.paddingLeft,a=r.paddingTop,o=r.labelMarginLeft,s=r.labelMarginTop;e.adjustLocations(t[n],r.rect.x,r.rect.y,i,a,o,s)})},j.prototype.getToBeTiled=function(e){var t=e.id;if(null!=this.toBeTiled[t])return this.toBeTiled[t];var n=e.getChild();if(null==n)return this.toBeTiled[t]=!1,!1;for(var r=n.getNodes(),i=0;i<r.length;i++){var a=r[i];if(this.getNodeDegree(a)>0)return this.toBeTiled[t]=!1,!1;if(null==a.getChild()){this.toBeTiled[a.id]=!1;continue}if(!this.getToBeTiled(a))return this.toBeTiled[t]=!1,!1}return this.toBeTiled[t]=!0,!0},j.prototype.getNodeDegree=function(e){e.id;for(var t=e.getEdges(),n=0,r=0;r<t.length;r++){var i=t[r];i.getSource().id!==i.getTarget().id&&(n+=1)}return n},j.prototype.getNodeDegreeWithChildren=function(e){var t=this.getNodeDegree(e);if(null==e.getChild())return t;for(var n=e.getChild().getNodes(),r=0;r<n.length;r++){var i=n[r];t+=this.getNodeDegreeWithChildren(i)}return t},j.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},j.prototype.fillCompexOrderByDFS=function(e){for(var t=0;t<e.length;t++){var n=e[t];null!=n.getChild()&&this.fillCompexOrderByDFS(n.getChild().getNodes()),this.getToBeTiled(n)&&this.compoundOrder.push(n)}},j.prototype.adjustLocations=function(e,t,n,r,i,a,o){t+=r+a,n+=i+o;for(var s=t,l=0;l<e.rows.length;l++){var c=e.rows[l];t=s;for(var u=0,d=0;d<c.length;d++){var h=c[d];h.rect.x=t,h.rect.y=n,t+=h.rect.width+e.horizontalPadding,h.rect.height>u&&(u=h.rect.height)}n+=u+e.verticalPadding}},j.prototype.tileCompoundMembers=function(e,t){var n=this;this.tiledMemberPack=[],Object.keys(e).forEach(function(r){var i=t[r];if(n.tiledMemberPack[r]=n.tileNodes(e[r],i.paddingLeft+i.paddingRight),i.rect.width=n.tiledMemberPack[r].width,i.rect.height=n.tiledMemberPack[r].height,i.setCenter(n.tiledMemberPack[r].centerX,n.tiledMemberPack[r].centerY),i.labelMarginLeft=0,i.labelMarginTop=0,l.NODE_DIMENSIONS_INCLUDE_LABELS){var a=i.rect.width,o=i.rect.height;i.labelWidth&&("left"==i.labelPosHorizontal?(i.rect.x-=i.labelWidth,i.setWidth(a+i.labelWidth),i.labelMarginLeft=i.labelWidth):"center"==i.labelPosHorizontal&&i.labelWidth>a?(i.rect.x-=(i.labelWidth-a)/2,i.setWidth(i.labelWidth),i.labelMarginLeft=(i.labelWidth-a)/2):"right"==i.labelPosHorizontal&&i.setWidth(a+i.labelWidth)),i.labelHeight&&("top"==i.labelPosVertical?(i.rect.y-=i.labelHeight,i.setHeight(o+i.labelHeight),i.labelMarginTop=i.labelHeight):"center"==i.labelPosVertical&&i.labelHeight>o?(i.rect.y-=(i.labelHeight-o)/2,i.setHeight(i.labelHeight),i.labelMarginTop=(i.labelHeight-o)/2):"bottom"==i.labelPosVertical&&i.setHeight(o+i.labelHeight))}})},j.prototype.tileNodes=function(e,t){var n=this.tileNodesByFavoringDim(e,t,!0),r=this.tileNodesByFavoringDim(e,t,!1),i=this.getOrgRatio(n);return this.getOrgRatio(r)<i?r:n},j.prototype.getOrgRatio=function(e){var t=e.width/e.height;return t<1&&(t=1/t),t},j.prototype.calcIdealRowWidth=function(e,t){var n,r=l.TILING_PADDING_VERTICAL,i=l.TILING_PADDING_HORIZONTAL,a=e.length,o=0,s=0,c=0;e.forEach(function(e){o+=e.getWidth(),s+=e.getHeight(),e.getWidth()>c&&(c=e.getWidth())});var u=o/a,d=Math.pow(r-i,2)+4*(u+i)*(s/a+r)*a,h=(i-r+Math.sqrt(d))/(2*(u+i));t?(n=Math.ceil(h))==h&&n++:n=Math.floor(h);var f=n*(u+i)-i;return c>f&&(f=c),f+=2*i},j.prototype.tileNodesByFavoringDim=function(e,t,n){var r=l.TILING_PADDING_VERTICAL,i=l.TILING_PADDING_HORIZONTAL,a=l.TILING_COMPARE_BY,o={rows:[],rowWidth:[],rowHeight:[],width:0,height:t,verticalPadding:r,horizontalPadding:i,centerX:0,centerY:0};a&&(o.idealRowWidth=this.calcIdealRowWidth(e,n));var s=function(e){return e.rect.width*e.rect.height},c=function(e,t){return s(t)-s(e)};e.sort(function(e,t){var n=c;return o.idealRowWidth?(n=a)(e.id,t.id):n(e,t)});for(var u=0,d=0,h=0;h<e.length;h++){var f=e[h];u+=f.getCenterX(),d+=f.getCenterY()}o.centerX=u/e.length,o.centerY=d/e.length;for(var h=0;h<e.length;h++){var f=e[h];if(0==o.rows.length)this.insertNodeToRow(o,f,0,t);else if(this.canAddHorizontal(o,f.rect.width,f.rect.height)){var p=o.rows.length-1;o.idealRowWidth||(p=this.getShortestRowIndex(o)),this.insertNodeToRow(o,f,p,t)}else this.insertNodeToRow(o,f,o.rows.length,t);this.shiftToLastRow(o)}return o},j.prototype.insertNodeToRow=function(e,t,n,r){n==e.rows.length&&(e.rows.push([]),e.rowWidth.push(r),e.rowHeight.push(0));var i=e.rowWidth[n]+t.rect.width;e.rows[n].length>0&&(i+=e.horizontalPadding),e.rowWidth[n]=i,e.width<i&&(e.width=i);var a=t.rect.height;n>0&&(a+=e.verticalPadding);var o=0;a>e.rowHeight[n]&&(o=e.rowHeight[n],e.rowHeight[n]=a,o=e.rowHeight[n]-o),e.height+=o,e.rows[n].push(t)},j.prototype.getShortestRowIndex=function(e){for(var t=-1,n=Number.MAX_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]<n&&(t=r,n=e.rowWidth[r]);return t},j.prototype.getLongestRowIndex=function(e){for(var t=-1,n=5e-324,r=0;r<e.rows.length;r++)e.rowWidth[r]>n&&(t=r,n=e.rowWidth[r]);return t},j.prototype.canAddHorizontal=function(e,t,n){if(e.idealRowWidth){var r,i,a=e.rows.length-1;return e.rowWidth[a]+t+e.horizontalPadding<=e.idealRowWidth}var o=this.getShortestRowIndex(e);if(o<0)return!0;var s=e.rowWidth[o];if(s+e.horizontalPadding+t<=e.width)return!0;var l=0;return e.rowHeight[o]<n&&o>0&&(l=n+e.verticalPadding-e.rowHeight[o]),r=e.width-s>=t+e.horizontalPadding?(e.height+l)/(s+t+e.horizontalPadding):(e.height+l)/e.width,l=n+e.verticalPadding,(i=e.width<t?(e.height+l)/t:(e.height+l)/e.width)<1&&(i=1/i),r<1&&(r=1/r),r<i},j.prototype.shiftToLastRow=function(e){var t=this.getLongestRowIndex(e),n=e.rowWidth.length-1,r=e.rows[t],i=r[r.length-1],a=i.width+e.horizontalPadding;if(e.width-e.rowWidth[n]>a&&t!=n){r.splice(-1,1),e.rows[n].push(i),e.rowWidth[t]=e.rowWidth[t]-a,e.rowWidth[n]=e.rowWidth[n]+a,e.width=e.rowWidth[instance.getLongestRowIndex(e)];for(var o=5e-324,s=0;s<r.length;s++)r[s].height>o&&(o=r[s].height);t>0&&(o+=e.verticalPadding);var l=e.rowHeight[t]+e.rowHeight[n];e.rowHeight[t]=o,e.rowHeight[n]<i.height+e.verticalPadding&&(e.rowHeight[n]=i.height+e.verticalPadding);var c=e.rowHeight[t]+e.rowHeight[n];e.height+=c-l,this.shiftToLastRow(e)}},j.prototype.tilingPreLayout=function(){l.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},j.prototype.tilingPostLayout=function(){l.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},j.prototype.reduceTrees=function(){for(var e,t=[],n=!0;n;){var r=this.graphManager.getAllNodes(),i=[];n=!1;for(var a=0;a<r.length;a++)if(1==(e=r[a]).getEdges().length&&!e.getEdges()[0].isInterGraph&&null==e.getChild()){if(l.PURE_INCREMENTAL){var o=e.getEdges()[0].getOtherEnd(e),s=new p(e.getCenterX()-o.getCenterX(),e.getCenterY()-o.getCenterY());i.push([e,e.getEdges()[0],e.getOwner(),s])}else i.push([e,e.getEdges()[0],e.getOwner()]);n=!0}if(!0==n){for(var c=[],u=0;u<i.length;u++)1==i[u][0].getEdges().length&&(c.push(i[u]),i[u][0].getOwner().remove(i[u][0]));t.push(c),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=t},j.prototype.growTree=function(e){for(var t,n=e.length,r=e[n-1],i=0;i<r.length;i++)t=r[i],this.findPlaceforPrunedNode(t),t[2].add(t[0]),t[2].add(t[1],t[1].source,t[1].target);e.splice(e.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},j.prototype.findPlaceforPrunedNode=function(e){var t=e[0];if(r=t==e[1].source?e[1].target:e[1].source,l.PURE_INCREMENTAL)t.setCenter(r.getCenterX()+e[3].getWidth(),r.getCenterY()+e[3].getHeight());else{var n,r,i,a,o=r.startX,s=r.finishX,c=r.startY,d=r.finishY,h=[0,0,0,0];if(c>0)for(var f=o;f<=s;f++)h[0]+=this.grid[f][c-1].length+this.grid[f][c].length-1;if(s<this.grid.length-1)for(var f=c;f<=d;f++)h[1]+=this.grid[s+1][f].length+this.grid[s][f].length-1;if(d<this.grid[0].length-1)for(var f=o;f<=s;f++)h[2]+=this.grid[f][d+1].length+this.grid[f][d].length-1;if(o>0)for(var f=c;f<=d;f++)h[3]+=this.grid[o-1][f].length+this.grid[o][f].length-1;for(var p=v.MAX_VALUE,g=0;g<h.length;g++)h[g]<p?(p=h[g],i=1,a=g):h[g]==p&&i++;if(3==i&&0==p)0==h[0]&&0==h[1]&&0==h[2]?n=1:0==h[0]&&0==h[1]&&0==h[3]?n=0:0==h[0]&&0==h[2]&&0==h[3]?n=3:0==h[1]&&0==h[2]&&0==h[3]&&(n=2);else if(2==i&&0==p){var x=Math.floor(2*Math.random());n=0==h[0]&&0==h[1]?+(0!=x):0==h[0]&&0==h[2]?2*(0!=x):0==h[0]&&0==h[3]?3*(0!=x):0==h[1]&&0==h[2]?0==x?1:2:0==h[1]&&0==h[3]?0==x?1:3:0==x?2:3}else if(4==i&&0==p){var x=Math.floor(4*Math.random());n=x}else n=a;0==n?t.setCenter(r.getCenterX(),r.getCenterY()-r.getHeight()/2-u.DEFAULT_EDGE_LENGTH-t.getHeight()/2):1==n?t.setCenter(r.getCenterX()+r.getWidth()/2+u.DEFAULT_EDGE_LENGTH+t.getWidth()/2,r.getCenterY()):2==n?t.setCenter(r.getCenterX(),r.getCenterY()+r.getHeight()/2+u.DEFAULT_EDGE_LENGTH+t.getHeight()/2):t.setCenter(r.getCenterX()-r.getWidth()/2-u.DEFAULT_EDGE_LENGTH-t.getWidth()/2,r.getCenterY())}},e.exports=j},991:(e,t,n)=>{var r=n(551).FDLayoutNode,i=n(551).IMath;function a(e,t,n,i){r.call(this,e,t,n,i)}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.prototype.calculateDisplacement=function(){var e=this.graphManager.getLayout();null!=this.getChild()&&this.fixedNodeWeight?(this.displacementX+=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementX=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementY=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},a.prototype.propogateDisplacementToChildren=function(e,t){for(var n,r=this.getChild().getNodes(),i=0;i<r.length;i++)null==(n=r[i]).getChild()?(n.displacementX+=e,n.displacementY+=t):n.propogateDisplacementToChildren(e,t)},a.prototype.move=function(){var e=this.graphManager.getLayout();(null==this.child||0==this.child.getNodes().length)&&(this.moveBy(this.displacementX,this.displacementY),e.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY)),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},a.prototype.setPred1=function(e){this.pred1=e},a.prototype.getPred1=function(){return pred1},a.prototype.getPred2=function(){return pred2},a.prototype.setNext=function(e){this.next=e},a.prototype.getNext=function(){return next},a.prototype.setProcessed=function(e){this.processed=e},a.prototype.isProcessed=function(){return processed},e.exports=a},902:(e,t,n)=>{function r(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}var i=n(806),a=n(551).LinkedList,o=n(551).Matrix,s=n(551).SVD;function l(){}l.handleConstraints=function(e){var t={};t.fixedNodeConstraint=e.constraints.fixedNodeConstraint,t.alignmentConstraint=e.constraints.alignmentConstraint,t.relativePlacementConstraint=e.constraints.relativePlacementConstraint;for(var n=new Map,l=new Map,c=[],u=[],d=e.getAllNodes(),h=0,f=0;f<d.length;f++){var p=d[f];null==p.getChild()&&(l.set(p.id,h++),c.push(p.getCenterX()),u.push(p.getCenterY()),n.set(p.id,p))}t.relativePlacementConstraint&&t.relativePlacementConstraint.forEach(function(e){e.gap||0==e.gap||(e.left?e.gap=i.DEFAULT_EDGE_LENGTH+n.get(e.left).getWidth()/2+n.get(e.right).getWidth()/2:e.gap=i.DEFAULT_EDGE_LENGTH+n.get(e.top).getHeight()/2+n.get(e.bottom).getHeight()/2)});var g=function(e){var t=0,n=0;return e.forEach(function(e){t+=c[l.get(e)],n+=u[l.get(e)]}),{x:t/e.size,y:n/e.size}},v=function(e,t,n,i,o){var s=new Map;e.forEach(function(e,t){s.set(t,0)}),e.forEach(function(e,t){e.forEach(function(e){s.set(e.id,s.get(e.id)+1)})});var d=new Map,h=new Map,f=new a;for(s.forEach(function(e,r){0==e?(f.push(r),n||("horizontal"==t?d.set(r,l.has(r)?c[l.get(r)]:i.get(r)):d.set(r,l.has(r)?u[l.get(r)]:i.get(r)))):d.set(r,-1/0),n&&h.set(r,new Set([r]))}),n&&o.forEach(function(e){var r=[];if(e.forEach(function(e){n.has(e)&&r.push(e)}),r.length>0){var a=0;r.forEach(function(e){"horizontal"==t?d.set(e,l.has(e)?c[l.get(e)]:i.get(e)):d.set(e,l.has(e)?u[l.get(e)]:i.get(e)),a+=d.get(e)}),a/=r.length,e.forEach(function(e){n.has(e)||d.set(e,a)})}else{var o=0;e.forEach(function(e){"horizontal"==t?o+=l.has(e)?c[l.get(e)]:i.get(e):o+=l.has(e)?u[l.get(e)]:i.get(e)}),o/=e.length,e.forEach(function(e){d.set(e,o)})}});0!=f.length;)!function(){var r=f.shift();e.get(r).forEach(function(e){if(d.get(e.id)<d.get(r)+e.gap)if(n&&n.has(e.id)){var a=void 0;if(a="horizontal"==t?l.has(e.id)?c[l.get(e.id)]:i.get(e.id):l.has(e.id)?u[l.get(e.id)]:i.get(e.id),d.set(e.id,a),a<d.get(r)+e.gap){var o=d.get(r)+e.gap-a;h.get(r).forEach(function(e){d.set(e,d.get(e)-o)})}}else d.set(e.id,d.get(r)+e.gap);s.set(e.id,s.get(e.id)-1),0==s.get(e.id)&&f.push(e.id),n&&h.set(e.id,function(e,t){var n=new Set(e),r=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var l=o.value;n.add(l)}}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(h.get(r),h.get(e.id)))})}();if(n){var p=new Set;e.forEach(function(e,t){0==e.length&&p.add(t)});var g=[];h.forEach(function(e,t){if(p.has(t)){var i=!1,a=!0,o=!1,s=void 0;try{for(var l,c=e[Symbol.iterator]();!(a=(l=c.next()).done);a=!0){var u=l.value;n.has(u)&&(i=!0)}}catch(e){o=!0,s=e}finally{try{!a&&c.return&&c.return()}finally{if(o)throw s}}if(!i){var d=!1,h=void 0;g.forEach(function(t,n){t.has([].concat(r(e))[0])&&(d=!0,h=n)}),d?e.forEach(function(e){g[h].add(e)}):g.push(new Set(e))}}}),g.forEach(function(e,n){var r=1/0,a=1/0,o=-1/0,s=-1/0,h=!0,f=!1,p=void 0;try{for(var g,v=e[Symbol.iterator]();!(h=(g=v.next()).done);h=!0){var x=g.value,y=void 0;y="horizontal"==t?l.has(x)?c[l.get(x)]:i.get(x):l.has(x)?u[l.get(x)]:i.get(x);var b=d.get(x);y<r&&(r=y),y>o&&(o=y),b<a&&(a=b),b>s&&(s=b)}}catch(e){f=!0,p=e}finally{try{!h&&v.return&&v.return()}finally{if(f)throw p}}var w=(r+o)/2-(a+s)/2,j=!0,N=!1,k=void 0;try{for(var C,E=e[Symbol.iterator]();!(j=(C=E.next()).done);j=!0){var _=C.value;d.set(_,d.get(_)+w)}}catch(e){N=!0,k=e}finally{try{!j&&E.return&&E.return()}finally{if(N)throw k}}})}return d},x=function(e){var t=0,n=0,r=0,i=0;if(e.forEach(function(e){e.left?c[l.get(e.left)]-c[l.get(e.right)]>=0?t++:n++:u[l.get(e.top)]-u[l.get(e.bottom)]>=0?r++:i++}),t>n&&r>i)for(var a=0;a<l.size;a++)c[a]=-1*c[a],u[a]=-1*u[a];else if(t>n)for(var o=0;o<l.size;o++)c[o]=-1*c[o];else if(r>i)for(var s=0;s<l.size;s++)u[s]=-1*u[s]},y=function(e){var t=[],n=new a,r=new Set,i=0;return e.forEach(function(a,o){if(!r.has(o)){t[i]=[];var s=o;for(n.push(s),r.add(s),t[i].push(s);0!=n.length;)s=n.shift(),e.get(s).forEach(function(e){r.has(e.id)||(n.push(e.id),r.add(e.id),t[i].push(e.id))});i++}}),t},b=function(e){var t=new Map;return e.forEach(function(e,n){t.set(n,[])}),e.forEach(function(e,n){e.forEach(function(e){t.get(n).push(e),t.get(e.id).push({id:n,gap:e.gap,direction:e.direction})})}),t},w=function(e){var t=new Map;return e.forEach(function(e,n){t.set(n,[])}),e.forEach(function(e,n){e.forEach(function(e){t.get(e.id).push({id:n,gap:e.gap,direction:e.direction})})}),t},j=[],N=[],k=!1,C=!1,E=new Set,_=new Map,S=new Map,T=[];if(t.fixedNodeConstraint&&t.fixedNodeConstraint.forEach(function(e){E.add(e.nodeId)}),t.relativePlacementConstraint&&(t.relativePlacementConstraint.forEach(function(e){e.left?(_.has(e.left)?_.get(e.left).push({id:e.right,gap:e.gap,direction:"horizontal"}):_.set(e.left,[{id:e.right,gap:e.gap,direction:"horizontal"}]),_.has(e.right)||_.set(e.right,[])):(_.has(e.top)?_.get(e.top).push({id:e.bottom,gap:e.gap,direction:"vertical"}):_.set(e.top,[{id:e.bottom,gap:e.gap,direction:"vertical"}]),_.has(e.bottom)||_.set(e.bottom,[]))}),T=y(S=b(_))),i.TRANSFORM_ON_CONSTRAINT_HANDLING){if(t.fixedNodeConstraint&&t.fixedNodeConstraint.length>1)t.fixedNodeConstraint.forEach(function(e,t){j[t]=[e.position.x,e.position.y],N[t]=[c[l.get(e.nodeId)],u[l.get(e.nodeId)]]}),k=!0;else if(t.alignmentConstraint)!function(){var e=0;if(t.alignmentConstraint.vertical){for(var n=t.alignmentConstraint.vertical,i=0;i<n.length;i++)!function(t){var i=new Set;n[t].forEach(function(e){i.add(e)});var a=new Set([].concat(r(i)).filter(function(e){return E.has(e)})),o=void 0;o=a.size>0?c[l.get(a.values().next().value)]:g(i).x,n[t].forEach(function(t){j[e]=[o,u[l.get(t)]],N[e]=[c[l.get(t)],u[l.get(t)]],e++})}(i);k=!0}if(t.alignmentConstraint.horizontal){for(var a=t.alignmentConstraint.horizontal,o=0;o<a.length;o++)!function(t){var n=new Set;a[t].forEach(function(e){n.add(e)});var i=new Set([].concat(r(n)).filter(function(e){return E.has(e)})),o=void 0;o=i.size>0?c[l.get(i.values().next().value)]:g(n).y,a[t].forEach(function(t){j[e]=[c[l.get(t)],o],N[e]=[c[l.get(t)],u[l.get(t)]],e++})}(o);k=!0}t.relativePlacementConstraint&&(C=!0)}();else if(t.relativePlacementConstraint){for(var A=0,O=0,M=0;M<T.length;M++)T[M].length>A&&(A=T[M].length,O=M);if(A<S.size/2)x(t.relativePlacementConstraint),k=!1,C=!1;else{var P=new Map,D=new Map,L=[];T[O].forEach(function(e){_.get(e).forEach(function(t){"horizontal"==t.direction?(P.has(e)?P.get(e).push(t):P.set(e,[t]),P.has(t.id)||P.set(t.id,[]),L.push({left:e,right:t.id})):(D.has(e)?D.get(e).push(t):D.set(e,[t]),D.has(t.id)||D.set(t.id,[]),L.push({top:e,bottom:t.id}))})}),x(L),C=!1;var I=v(P,"horizontal"),R=v(D,"vertical");T[O].forEach(function(e,t){N[t]=[c[l.get(e)],u[l.get(e)]],j[t]=[],I.has(e)?j[t][0]=I.get(e):j[t][0]=c[l.get(e)],R.has(e)?j[t][1]=R.get(e):j[t][1]=u[l.get(e)]}),k=!0}}if(k){for(var B=void 0,z=o.transpose(j),F=o.transpose(N),V=0;V<z.length;V++)z[V]=o.multGamma(z[V]),F[V]=o.multGamma(F[V]);var U=o.multMat(z,o.transpose(F)),H=s.svd(U);B=o.multMat(H.V,o.transpose(H.U));for(var W=0;W<l.size;W++){var Y=[c[W],u[W]],G=[B[0][0],B[1][0]],$=[B[0][1],B[1][1]];c[W]=o.dotProduct(Y,G),u[W]=o.dotProduct(Y,$)}C&&x(t.relativePlacementConstraint)}}if(i.ENFORCE_CONSTRAINTS){if(t.fixedNodeConstraint&&t.fixedNodeConstraint.length>0){var X={x:0,y:0};t.fixedNodeConstraint.forEach(function(e,t){var n,r={x:c[l.get(e.nodeId)],y:u[l.get(e.nodeId)]},i=(n=e.position,{x:n.x-r.x,y:n.y-r.y});X.x+=i.x,X.y+=i.y}),X.x/=t.fixedNodeConstraint.length,X.y/=t.fixedNodeConstraint.length,c.forEach(function(e,t){c[t]+=X.x}),u.forEach(function(e,t){u[t]+=X.y}),t.fixedNodeConstraint.forEach(function(e){c[l.get(e.nodeId)]=e.position.x,u[l.get(e.nodeId)]=e.position.y})}if(t.alignmentConstraint){if(t.alignmentConstraint.vertical)for(var q=t.alignmentConstraint.vertical,K=0;K<q.length;K++)!function(e){var t=new Set;q[e].forEach(function(e){t.add(e)});var n=new Set([].concat(r(t)).filter(function(e){return E.has(e)})),i=void 0;i=n.size>0?c[l.get(n.values().next().value)]:g(t).x,t.forEach(function(e){E.has(e)||(c[l.get(e)]=i)})}(K);if(t.alignmentConstraint.horizontal)for(var Z=t.alignmentConstraint.horizontal,Q=0;Q<Z.length;Q++)!function(e){var t=new Set;Z[e].forEach(function(e){t.add(e)});var n=new Set([].concat(r(t)).filter(function(e){return E.has(e)})),i=void 0;i=n.size>0?u[l.get(n.values().next().value)]:g(t).y,t.forEach(function(e){E.has(e)||(u[l.get(e)]=i)})}(Q)}t.relativePlacementConstraint&&function(){var e=new Map,n=new Map,r=new Map,i=new Map,a=new Map,o=new Map,s=new Set,d=new Set;if(E.forEach(function(e){s.add(e),d.add(e)}),t.alignmentConstraint){if(t.alignmentConstraint.vertical)for(var h=t.alignmentConstraint.vertical,f=function(t){r.set("dummy"+t,[]),h[t].forEach(function(n){e.set(n,"dummy"+t),r.get("dummy"+t).push(n),E.has(n)&&s.add("dummy"+t)}),a.set("dummy"+t,c[l.get(h[t][0])])},p=0;p<h.length;p++)f(p);if(t.alignmentConstraint.horizontal)for(var g=t.alignmentConstraint.horizontal,x=function(e){i.set("dummy"+e,[]),g[e].forEach(function(t){n.set(t,"dummy"+e),i.get("dummy"+e).push(t),E.has(t)&&d.add("dummy"+e)}),o.set("dummy"+e,u[l.get(g[e][0])])},j=0;j<g.length;j++)x(j)}var N=new Map,k=new Map,C=function(t){_.get(t).forEach(function(r){var i=void 0,a=void 0;"horizontal"==r.direction?(i=e.get(t)?e.get(t):t,a=e.get(r.id)?{id:e.get(r.id),gap:r.gap,direction:r.direction}:r,N.has(i)?N.get(i).push(a):N.set(i,[a]),N.has(a.id)||N.set(a.id,[])):(i=n.get(t)?n.get(t):t,a=n.get(r.id)?{id:n.get(r.id),gap:r.gap,direction:r.direction}:r,k.has(i)?k.get(i).push(a):k.set(i,[a]),k.has(a.id)||k.set(a.id,[]))})},S=!0,T=!1,A=void 0;try{for(var O,M=_.keys()[Symbol.iterator]();!(S=(O=M.next()).done);S=!0){var P=O.value;C(P)}}catch(e){T=!0,A=e}finally{try{!S&&M.return&&M.return()}finally{if(T)throw A}}var D=b(N),L=b(k),I=y(D),R=y(L),B=w(N),z=w(k),F=[],V=[];I.forEach(function(e,t){F[t]=[],e.forEach(function(e){0==B.get(e).length&&F[t].push(e)})}),R.forEach(function(e,t){V[t]=[],e.forEach(function(e){0==z.get(e).length&&V[t].push(e)})});var U=v(N,"horizontal",s,a,F),H=v(k,"vertical",d,o,V),W=function(e){r.get(e)?r.get(e).forEach(function(t){c[l.get(t)]=U.get(e)}):c[l.get(e)]=U.get(e)},Y=!0,G=!1,$=void 0;try{for(var X,q=U.keys()[Symbol.iterator]();!(Y=(X=q.next()).done);Y=!0){var K=X.value;W(K)}}catch(e){G=!0,$=e}finally{try{!Y&&q.return&&q.return()}finally{if(G)throw $}}var Z=function(e){i.get(e)?i.get(e).forEach(function(t){u[l.get(t)]=H.get(e)}):u[l.get(e)]=H.get(e)},Q=!0,J=!1,ee=void 0;try{for(var et,en=H.keys()[Symbol.iterator]();!(Q=(et=en.next()).done);Q=!0){var K=et.value;Z(K)}}catch(e){J=!0,ee=e}finally{try{!Q&&en.return&&en.return()}finally{if(J)throw ee}}}()}for(var J=0;J<d.length;J++){var ee=d[J];null==ee.getChild()&&ee.setCenter(c[l.get(ee.id)],u[l.get(ee.id)])}},e.exports=l},551:e=>{e.exports=r}},t={};return function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}(45)})()},45108,(e,t,n)=>{var r;e.e,r=e.r(97659),t.exports=(()=>{"use strict";var e={658:e=>{e.exports=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.forEach(function(t){Object.keys(t).forEach(function(n){return e[n]=t[n]})}),e}},548:(e,t,n)=>{var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=n(140).layoutBase.LinkedList,a={};a.getTopMostNodes=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].id()]=!0;return e.filter(function(e,n){"number"==typeof e&&(e=n);for(var r=e.parent()[0];null!=r;){if(t[r.id()])return!1;r=r.parent()[0]}return!0})},a.connectComponents=function(e,t,n,r){var a=new i,o=new Set,s=[],l=void 0,c=void 0,u=void 0,d=!1,h=1,f=[],p=[];do!function(){var r=e.collection();p.push(r);var i=n[0],g=e.collection();for(g.merge(i).merge(i.descendants().intersection(t)),s.push(i),g.forEach(function(e){a.push(e),o.add(e),r.merge(e)});0!=a.length;)!function(){i=a.shift();var c=e.collection();i.neighborhood().nodes().forEach(function(e){t.intersection(i.edgesWith(e)).length>0&&c.merge(e)});for(var u=0;u<c.length;u++){var d=c[u];null==(l=n.intersection(d.union(d.ancestors())))||o.has(l[0])||l.union(l.descendants()).forEach(function(e){a.push(e),o.add(e),r.merge(e),n.has(e)&&s.push(e)})}}();if(r.forEach(function(e){t.intersection(e.connectedEdges()).forEach(function(e){r.has(e.source())&&r.has(e.target())&&r.merge(e)})}),s.length==n.length&&(d=!0),!d||d&&h>1){u=(c=s[0]).connectedEdges().length,s.forEach(function(e){e.connectedEdges().length<u&&(u=e.connectedEdges().length,c=e)}),f.push(c.id());var v=e.collection();v.merge(s[0]),s.forEach(function(e){v.merge(e)}),s=[],n=n.difference(v),h++}}();while(!d)return r&&f.length>0&&r.set("dummy"+(r.size+1),f),p},a.relocateComponent=function(e,t,n){if(!n.fixedNodeConstraint){var i=1/0,a=-1/0,o=1/0,s=-1/0;if("draft"==n.quality){var l=!0,c=!1,u=void 0;try{for(var d,h=t.nodeIndexes[Symbol.iterator]();!(l=(d=h.next()).done);l=!0){var f=d.value,p=r(f,2),g=p[0],v=p[1],x=n.cy.getElementById(g);if(x){var y=x.boundingBox(),b=t.xCoords[v]-y.w/2,w=t.xCoords[v]+y.w/2,j=t.yCoords[v]-y.h/2,N=t.yCoords[v]+y.h/2;b<i&&(i=b),w>a&&(a=w),j<o&&(o=j),N>s&&(s=N)}}}catch(e){c=!0,u=e}finally{try{!l&&h.return&&h.return()}finally{if(c)throw u}}var k=e.x-(a+i)/2,C=e.y-(s+o)/2;t.xCoords=t.xCoords.map(function(e){return e+k}),t.yCoords=t.yCoords.map(function(e){return e+C})}else{Object.keys(t).forEach(function(e){var n=t[e],r=n.getRect().x,l=n.getRect().x+n.getRect().width,c=n.getRect().y,u=n.getRect().y+n.getRect().height;r<i&&(i=r),l>a&&(a=l),c<o&&(o=c),u>s&&(s=u)});var E=e.x-(a+i)/2,_=e.y-(s+o)/2;Object.keys(t).forEach(function(e){var n=t[e];n.setCenter(n.getCenterX()+E,n.getCenterY()+_)})}}},a.calcBoundingBox=function(e,t,n,r){for(var i=Number.MAX_SAFE_INTEGER,a=Number.MIN_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER,l=void 0,c=void 0,u=void 0,d=void 0,h=e.descendants().not(":parent"),f=h.length,p=0;p<f;p++){var g=h[p];l=t[r.get(g.id())]-g.width()/2,c=t[r.get(g.id())]+g.width()/2,u=n[r.get(g.id())]-g.height()/2,d=n[r.get(g.id())]+g.height()/2,i>l&&(i=l),a<c&&(a=c),o>u&&(o=u),s<d&&(s=d)}var v={};return v.topLeftX=i,v.topLeftY=o,v.width=a-i,v.height=s-o,v},a.calcParentsWithoutChildren=function(e,t){var n=e.collection();return t.nodes(":parent").forEach(function(e){var t=!1;e.children().forEach(function(e){"none"!=e.css("display")&&(t=!0)}),t||n.merge(e)}),n},e.exports=a},816:(e,t,n)=>{var r=n(548),i=n(140).CoSELayout,a=n(140).CoSENode,o=n(140).layoutBase.PointD,s=n(140).layoutBase.DimensionD,l=n(140).layoutBase.LayoutConstants,c=n(140).layoutBase.FDLayoutConstants,u=n(140).CoSEConstants;e.exports={coseLayout:function(e,t){var n=e.cy,d=e.eles,h=d.nodes(),f=d.edges(),p=void 0,g=void 0,v=void 0,x={};e.randomize&&(p=t.nodeIndexes,g=t.xCoords,v=t.yCoords);var y=function(e){return"function"==typeof e},b=function(e,t){return y(e)?e(t):e},w=r.calcParentsWithoutChildren(n,d);null!=e.nestingFactor&&(u.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=e.nestingFactor),null!=e.gravity&&(u.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=e.gravity),null!=e.numIter&&(u.MAX_ITERATIONS=c.MAX_ITERATIONS=e.numIter),null!=e.gravityRange&&(u.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=e.gravityRange),null!=e.gravityCompound&&(u.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=e.gravityCompound),null!=e.gravityRangeCompound&&(u.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=e.gravityRangeCompound),null!=e.initialEnergyOnIncremental&&(u.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=e.initialEnergyOnIncremental),null!=e.tilingCompareBy&&(u.TILING_COMPARE_BY=e.tilingCompareBy),"proof"==e.quality?l.QUALITY=2:l.QUALITY=0,u.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=l.NODE_DIMENSIONS_INCLUDE_LABELS=e.nodeDimensionsIncludeLabels,u.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=l.DEFAULT_INCREMENTAL=!e.randomize,u.ANIMATE=c.ANIMATE=l.ANIMATE=e.animate,u.TILE=e.tile,u.TILING_PADDING_VERTICAL="function"==typeof e.tilingPaddingVertical?e.tilingPaddingVertical.call():e.tilingPaddingVertical,u.TILING_PADDING_HORIZONTAL="function"==typeof e.tilingPaddingHorizontal?e.tilingPaddingHorizontal.call():e.tilingPaddingHorizontal,u.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=l.DEFAULT_INCREMENTAL=!0,u.PURE_INCREMENTAL=!e.randomize,l.DEFAULT_UNIFORM_LEAF_NODE_SIZES=e.uniformNodeDimensions,"transformed"==e.step&&(u.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,u.ENFORCE_CONSTRAINTS=!1,u.APPLY_LAYOUT=!1),"enforced"==e.step&&(u.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,u.ENFORCE_CONSTRAINTS=!0,u.APPLY_LAYOUT=!1),"cose"==e.step&&(u.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,u.ENFORCE_CONSTRAINTS=!1,u.APPLY_LAYOUT=!0),"all"==e.step&&(e.randomize?u.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:u.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,u.ENFORCE_CONSTRAINTS=!0,u.APPLY_LAYOUT=!0),e.fixedNodeConstraint||e.alignmentConstraint||e.relativePlacementConstraint?u.TREE_REDUCTION_ON_INCREMENTAL=!1:u.TREE_REDUCTION_ON_INCREMENTAL=!0;var j=new i,N=j.newGraphManager();return!function e(t,n,i,l){for(var c=n.length,u=0;u<c;u++){var d=n[u],h=null;0==d.intersection(w).length&&(h=d.children());var f=void 0,y=d.layoutDimensions({nodeDimensionsIncludeLabels:l.nodeDimensionsIncludeLabels});if(null!=d.outerWidth()&&null!=d.outerHeight())if(l.randomize)if(d.isParent()){var j=r.calcBoundingBox(d,g,v,p);f=0==d.intersection(w).length?t.add(new a(i.graphManager,new o(j.topLeftX,j.topLeftY),new s(j.width,j.height))):t.add(new a(i.graphManager,new o(j.topLeftX,j.topLeftY),new s(parseFloat(y.w),parseFloat(y.h))))}else f=t.add(new a(i.graphManager,new o(g[p.get(d.id())]-y.w/2,v[p.get(d.id())]-y.h/2),new s(parseFloat(y.w),parseFloat(y.h))));else f=t.add(new a(i.graphManager,new o(d.position("x")-y.w/2,d.position("y")-y.h/2),new s(parseFloat(y.w),parseFloat(y.h))));else f=t.add(new a(this.graphManager));(f.id=d.data("id"),f.nodeRepulsion=b(l.nodeRepulsion,d),f.paddingLeft=parseInt(d.css("padding")),f.paddingTop=parseInt(d.css("padding")),f.paddingRight=parseInt(d.css("padding")),f.paddingBottom=parseInt(d.css("padding")),l.nodeDimensionsIncludeLabels&&(f.labelWidth=d.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,f.labelHeight=d.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,f.labelPosVertical=d.css("text-valign"),f.labelPosHorizontal=d.css("text-halign")),x[d.data("id")]=f,isNaN(f.rect.x)&&(f.rect.x=0),isNaN(f.rect.y)&&(f.rect.y=0),null!=h&&h.length>0)&&e(i.getGraphManager().add(i.newGraph(),f),h,i,l)}}(N.addRoot(),r.getTopMostNodes(h),j,e),!function(t,n,r){for(var i=0,a=0,o=0;o<r.length;o++){var s=r[o],l=x[s.data("source")],d=x[s.data("target")];if(l&&d&&l!==d&&0==l.getEdgesBetween(d).length){var h=n.add(t.newEdge(),l,d);h.id=s.id(),h.idealLength=b(e.idealEdgeLength,s),h.edgeElasticity=b(e.edgeElasticity,s),i+=h.idealLength,a++}}null!=e.idealEdgeLength&&(a>0?u.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=i/a:y(e.idealEdgeLength)?u.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:u.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=e.idealEdgeLength,u.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,u.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)}(j,N,f),e.fixedNodeConstraint&&(j.constraints.fixedNodeConstraint=e.fixedNodeConstraint),e.alignmentConstraint&&(j.constraints.alignmentConstraint=e.alignmentConstraint),e.relativePlacementConstraint&&(j.constraints.relativePlacementConstraint=e.relativePlacementConstraint),j.runLayout(),x}}},212:(e,t,n)=>{var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(658),a=n(548),o=n(657).spectralLayout,s=n(816).coseLayout,l=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1e3,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:1e-7,nodeRepulsion:function(e){return 4500},idealEdgeLength:function(e){return 50},edgeElasticity:function(e){return .45},nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}});e.exports=function(){function e(t){if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.options=i({},l,t)}return r(e,[{key:"run",value:function(){var e=this.options,t=e.cy,n=e.eles,r=[],i=[],l=void 0,c=[];e.fixedNodeConstraint&&(!Array.isArray(e.fixedNodeConstraint)||0==e.fixedNodeConstraint.length)&&(e.fixedNodeConstraint=void 0),e.alignmentConstraint&&(e.alignmentConstraint.vertical&&(!Array.isArray(e.alignmentConstraint.vertical)||0==e.alignmentConstraint.vertical.length)&&(e.alignmentConstraint.vertical=void 0),e.alignmentConstraint.horizontal&&(!Array.isArray(e.alignmentConstraint.horizontal)||0==e.alignmentConstraint.horizontal.length)&&(e.alignmentConstraint.horizontal=void 0)),e.relativePlacementConstraint&&(!Array.isArray(e.relativePlacementConstraint)||0==e.relativePlacementConstraint.length)&&(e.relativePlacementConstraint=void 0),(e.fixedNodeConstraint||e.alignmentConstraint||e.relativePlacementConstraint)&&(e.tile=!1,e.packComponents=!1);var u=void 0,d=!1;if(t.layoutUtilities&&e.packComponents&&((u=t.layoutUtilities("get"))||(u=t.layoutUtilities()),d=!0),n.nodes().length>0)if(d){var h=a.getTopMostNodes(e.eles.nodes());if((l=a.connectComponents(t,e.eles,h)).forEach(function(e){var t=e.boundingBox();c.push({x:t.x1+t.w/2,y:t.y1+t.h/2})}),e.randomize&&l.forEach(function(t){e.eles=t,r.push(o(e))}),"default"==e.quality||"proof"==e.quality){var f=t.collection();if(e.tile){var p=new Map,g=0,v={nodeIndexes:p,xCoords:[],yCoords:[]},x=[];if(l.forEach(function(e,t){0==e.edges().length&&(e.nodes().forEach(function(t,n){f.merge(e.nodes()[n]),t.isParent()||(v.nodeIndexes.set(e.nodes()[n].id(),g++),v.xCoords.push(e.nodes()[0].position().x),v.yCoords.push(e.nodes()[0].position().y))}),x.push(t))}),f.length>1){var y=f.boundingBox();c.push({x:y.x1+y.w/2,y:y.y1+y.h/2}),l.push(f),r.push(v);for(var b=x.length-1;b>=0;b--)l.splice(x[b],1),r.splice(x[b],1),c.splice(x[b],1)}}l.forEach(function(t,n){e.eles=t,i.push(s(e,r[n])),a.relocateComponent(c[n],i[n],e)})}else l.forEach(function(t,n){a.relocateComponent(c[n],r[n],e)});var w=new Set;if(l.length>1){var j=[],N=n.filter(function(e){return"none"==e.css("display")});l.forEach(function(t,n){var o=void 0;if("draft"==e.quality&&(o=r[n].nodeIndexes),t.nodes().not(N).length>0){var s={};s.edges=[],s.nodes=[];var l=void 0;t.nodes().not(N).forEach(function(t){if("draft"==e.quality)if(t.isParent()){var c=a.calcBoundingBox(t,r[n].xCoords,r[n].yCoords,o);s.nodes.push({x:c.topLeftX,y:c.topLeftY,width:c.width,height:c.height})}else l=o.get(t.id()),s.nodes.push({x:r[n].xCoords[l]-t.boundingbox().w/2,y:r[n].yCoords[l]-t.boundingbox().h/2,width:t.boundingbox().w,height:t.boundingbox().h});else i[n][t.id()]&&s.nodes.push({x:i[n][t.id()].getLeft(),y:i[n][t.id()].getTop(),width:i[n][t.id()].getWidth(),height:i[n][t.id()].getHeight()})}),t.edges().forEach(function(t){var l=t.source(),c=t.target();if("none"!=l.css("display")&&"none"!=c.css("display"))if("draft"==e.quality){var u=o.get(l.id()),d=o.get(c.id()),h=[],f=[];if(l.isParent()){var p=a.calcBoundingBox(l,r[n].xCoords,r[n].yCoords,o);h.push(p.topLeftX+p.width/2),h.push(p.topLeftY+p.height/2)}else h.push(r[n].xCoords[u]),h.push(r[n].yCoords[u]);if(c.isParent()){var g=a.calcBoundingBox(c,r[n].xCoords,r[n].yCoords,o);f.push(g.topLeftX+g.width/2),f.push(g.topLeftY+g.height/2)}else f.push(r[n].xCoords[d]),f.push(r[n].yCoords[d]);s.edges.push({startX:h[0],startY:h[1],endX:f[0],endY:f[1]})}else i[n][l.id()]&&i[n][c.id()]&&s.edges.push({startX:i[n][l.id()].getCenterX(),startY:i[n][l.id()].getCenterY(),endX:i[n][c.id()].getCenterX(),endY:i[n][c.id()].getCenterY()})}),s.nodes.length>0&&(j.push(s),w.add(n))}});var k=u.packComponents(j,e.randomize).shifts;if("draft"==e.quality)r.forEach(function(e,t){var n=e.xCoords.map(function(e){return e+k[t].dx}),r=e.yCoords.map(function(e){return e+k[t].dy});e.xCoords=n,e.yCoords=r});else{var C=0;w.forEach(function(e){Object.keys(i[e]).forEach(function(t){var n=i[e][t];n.setCenter(n.getCenterX()+k[C].dx,n.getCenterY()+k[C].dy)}),C++})}}}else{var E=e.eles.boundingBox();if(c.push({x:E.x1+E.w/2,y:E.y1+E.h/2}),e.randomize){var _=o(e);r.push(_)}"default"==e.quality||"proof"==e.quality?(i.push(s(e,r[0])),a.relocateComponent(c[0],i[0],e)):a.relocateComponent(c[0],r[0],e)}var S=function(t,n){if("default"==e.quality||"proof"==e.quality){"number"==typeof t&&(t=n);var a=void 0,o=void 0,s=t.data("id");return i.forEach(function(e){s in e&&(a={x:e[s].getRect().getCenterX(),y:e[s].getRect().getCenterY()},o=e[s])}),e.nodeDimensionsIncludeLabels&&(o.labelWidth&&("left"==o.labelPosHorizontal?a.x+=o.labelWidth/2:"right"==o.labelPosHorizontal&&(a.x-=o.labelWidth/2)),o.labelHeight&&("top"==o.labelPosVertical?a.y+=o.labelHeight/2:"bottom"==o.labelPosVertical&&(a.y-=o.labelHeight/2))),void 0==a&&(a={x:t.position("x"),y:t.position("y")}),{x:a.x,y:a.y}}var l=void 0;return r.forEach(function(e){var n=e.nodeIndexes.get(t.id());void 0!=n&&(l={x:e.xCoords[n],y:e.yCoords[n]})}),void 0==l&&(l={x:t.position("x"),y:t.position("y")}),{x:l.x,y:l.y}};if("default"==e.quality||"proof"==e.quality||e.randomize){var T=a.calcParentsWithoutChildren(t,n),A=n.filter(function(e){return"none"==e.css("display")});e.eles=n.not(A),n.nodes().not(":parent").not(A).layoutPositions(this,e,S),T.length>0&&T.forEach(function(e){e.position(S(e))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),e}()},657:(e,t,n)=>{var r=n(548),i=n(140).layoutBase.Matrix,a=n(140).layoutBase.SVD;e.exports={spectralLayout:function(e){var t=e.cy,n=e.eles,o=n.nodes(),s=n.nodes(":parent"),l=new Map,c=new Map,u=new Map,d=[],h=[],f=[],p=[],g=[],v=[],x=[],y=[],b=void 0,w=e.piTol,j=e.samplingType,N=e.nodeSeparation,k=void 0,C=function(){for(var e=0,t=0,n=!1;t<k;){e=Math.floor(Math.random()*b),n=!1;for(var r=0;r<t;r++)if(p[r]==e){n=!0;break}!n&&(p[t]=e,t++)}},E=function(e,t,n){for(var r=[],i=0,a=0,o=0,s=void 0,l=[],u=0,h=1,f=0;f<b;f++)l[f]=1e8;for(r[a]=e,l[e]=0;a>=i;){for(var p=d[o=r[i++]],x=0;x<p.length;x++)1e8==l[s=c.get(p[x])]&&(l[s]=l[o]+1,r[++a]=s);v[o][t]=l[o]*N}if(n){for(var y=0;y<b;y++)v[y][t]<g[y]&&(g[y]=v[y][t]);for(var w=0;w<b;w++)g[w]>u&&(u=g[w],h=w)}return h};r.connectComponents(t,n,r.getTopMostNodes(o),l),s.forEach(function(e){r.connectComponents(t,n,r.getTopMostNodes(e.descendants().intersection(n)),l)});for(var _=0,S=0;S<o.length;S++)o[S].isParent()||c.set(o[S].id(),_++);var T=!0,A=!1,O=void 0;try{for(var M,P=l.keys()[Symbol.iterator]();!(T=(M=P.next()).done);T=!0){var D=M.value;c.set(D,_++)}}catch(e){A=!0,O=e}finally{try{!T&&P.return&&P.return()}finally{if(A)throw O}}for(var L=0;L<c.size;L++)d[L]=[];s.forEach(function(e){for(var t=e.children().intersection(n);0==t.nodes(":childless").length;)t=t.nodes()[0].children().intersection(n);var r=0,i=t.nodes(":childless")[0].connectedEdges().length;t.nodes(":childless").forEach(function(e,t){e.connectedEdges().length<i&&(i=e.connectedEdges().length,r=t)}),u.set(e.id(),t.nodes(":childless")[r].id())}),o.forEach(function(e){var t=void 0;t=e.isParent()?c.get(u.get(e.id())):c.get(e.id()),e.neighborhood().nodes().forEach(function(r){n.intersection(e.edgesWith(r)).length>0&&(r.isParent()?d[t].push(u.get(r.id())):d[t].push(r.id()))})});var I=function(e){var n=c.get(e),r=void 0;l.get(e).forEach(function(i){r=t.getElementById(i).isParent()?u.get(i):i,d[n].push(r),d[c.get(r)].push(e)})},R=!0,B=!1,z=void 0;try{for(var F,V=l.keys()[Symbol.iterator]();!(R=(F=V.next()).done);R=!0){var U=F.value;I(U)}}catch(e){B=!0,z=e}finally{try{!R&&V.return&&V.return()}finally{if(B)throw z}}b=c.size;if(b>2){k=b<e.sampleSize?b:e.sampleSize;for(var H=0;H<b;H++)v[H]=[];for(var W=0;W<k;W++)y[W]=[];return"draft"==e.quality||"all"==e.step?(!function(e){var t=void 0;if(e){t=Math.floor(Math.random()*b);for(var n=0;n<b;n++)g[n]=1e8;for(var r=0;r<k;r++)p[r]=t,t=E(t,r,e)}else{C();for(var i=0;i<k;i++)E(p[i],i,e,!1)}for(var a=0;a<b;a++)for(var o=0;o<k;o++)v[a][o]*=v[a][o];for(var s=0;s<k;s++)x[s]=[];for(var l=0;l<k;l++)for(var c=0;c<k;c++)x[l][c]=v[p[c]][l]}(j),!function(){for(var e=a.svd(x),t=e.S,n=e.U,r=e.V,o=t[0]*t[0]*t[0],s=[],l=0;l<k;l++){s[l]=[];for(var c=0;c<k;c++)s[l][c]=0,l==c&&(s[l][c]=t[l]/(t[l]*t[l]+o/(t[l]*t[l])))}y=i.multMat(i.multMat(r,s),i.transpose(n))}(),!function(){for(var e=void 0,t=void 0,n=[],r=[],a=[],o=[],s=0;s<b;s++)n[s]=Math.random(),r[s]=Math.random();n=i.normalize(n),r=i.normalize(r);for(var l=0,c=1e-9,u=1e-9,d=void 0;;){l++;for(var p=0;p<b;p++)a[p]=n[p];if(n=i.multGamma(i.multL(i.multGamma(a),v,y)),e=i.dotProduct(a,n),n=i.normalize(n),(d=Math.abs((c=i.dotProduct(a,n))/u))<=1+w&&d>=1)break;u=c}for(var g=0;g<b;g++)a[g]=n[g];for(l=0,u=1e-9;;){l++;for(var x=0;x<b;x++)o[x]=r[x];if(o=i.minusOp(o,i.multCons(a,i.dotProduct(a,o))),r=i.multGamma(i.multL(i.multGamma(o),v,y)),t=i.dotProduct(o,r),r=i.normalize(r),(d=Math.abs((c=i.dotProduct(o,r))/u))<=1+w&&d>=1)break;u=c}for(var j=0;j<b;j++)o[j]=r[j];h=i.multCons(a,Math.sqrt(Math.abs(e))),f=i.multCons(o,Math.sqrt(Math.abs(t)))}()):c.forEach(function(e,n){h.push(t.getElementById(n).position("x")),f.push(t.getElementById(n).position("y"))}),{nodeIndexes:c,xCoords:h,yCoords:f}}var Y=c.keys(),G=t.getElementById(Y.next().value),$=G.position(),X=G.outerWidth();if(h.push($.x),f.push($.y),2==b){var q=t.getElementById(Y.next().value).outerWidth();h.push($.x+X/2+q/2+e.idealEdgeLength),f.push($.y)}return{nodeIndexes:c,xCoords:h,yCoords:f}}}},579:(e,t,n)=>{var r=n(212),i=function(e){e&&e("layout","fcose",r)};"u">typeof cytoscape&&i(cytoscape),e.exports=i},140:e=>{e.exports=r}},t={};return function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}(579)})()},26568,(e,t,n)=>{"use strict";var r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,a=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g;function d(e){return e?e.replace(u,""):""}t.exports=function(e,t){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,u=1;function h(e){var t=e.match(i);t&&(n+=t.length);var r=e.lastIndexOf("\n");u=~r?e.length-r:u+e.length}function f(){var e={line:n,column:u};return function(t){return t.position=new p(e),v(a),t}}function p(e){this.start=e,this.end={line:n,column:u},this.source=t.source}function g(r){var i=Error(t.source+":"+n+":"+u+": "+r);if(i.reason=r,i.filename=t.source,i.line=n,i.column=u,i.source=e,t.silent);else throw i}function v(t){var n=t.exec(e);if(n){var r=n[0];return h(r),e=e.slice(r.length),n}}function x(e){var t;for(e=e||[];t=y();)!1!==t&&e.push(t);return e}function y(){var t=f();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;""!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return g("End of comment missing");var r=e.slice(2,n-2);return u+=2,h(r),e=e.slice(n),u+=2,t({type:"comment",comment:r})}}p.prototype.content=e,v(a);var b,w=[];for(x(w);b=function(){var e=f(),t=v(o);if(t){if(y(),!v(s))return g("property missing ':'");var n=v(l),i=e({type:"declaration",property:d(t[0].replace(r,"")),value:n?d(n[0].replace(r,"")):""});return v(c),i}}();)!1!==b&&(w.push(b),x(w));return w}},70454,(e,t,n)=>{"use strict";var r=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,t){let n=null;if(!e||"string"!=typeof e)return n;let r=(0,i.default)(e),a="function"==typeof t;return r.forEach(e=>{if("declaration"!==e.type)return;let{property:r,value:i}=e;a?t(r,i,e):i&&((n=n||{})[r]=i)}),n};let i=r(e.r(26568))},65185,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.camelCase=void 0;var r=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,a=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,l=function(e,t){return t.toUpperCase()},c=function(e,t){return"".concat(t,"-")};n.camelCase=function(e,t){var n;return(void 0===t&&(t={}),!(n=e)||a.test(n)||r.test(n))?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(s,c):e.replace(o,c)).replace(i,l))}},15511,(e,t,n)=>{"use strict";var r=(e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e.r(70454)),i=e.r(65185);function a(e,t){var n={};return e&&"string"==typeof e&&(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}a.default=a,t.exports=a},4100,(e,t,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)},l=function(e){if(!e||"[object Object]"!==i.call(e))return!1;var t,n=r.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!a)return!1;for(t in e);return void 0===t||r.call(e,t)},c=function(e,t){a&&"__proto__"===t.name?a(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},u=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;else if(o)return o(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,o,d=arguments[0],h=1,f=arguments.length,p=!1;for("boolean"==typeof d&&(p=d,d=arguments[1]||{},h=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});h<f;++h)if(t=arguments[h],null!=t)for(n in t)r=u(d,n),d!==(i=u(t,n))&&(p&&i&&(l(i)||(a=s(i)))?(a?(a=!1,o=r&&s(r)?r:[]):o=r&&l(r)?r:{},c(d,{name:n,newValue:e(p,o,i)})):void 0!==i&&c(d,{name:n,newValue:i}));return d}},78756,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isUnsafeProperty=function(e){return"__proto__"===e}},33858,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isDeepKey=function(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}},96736,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.toKey=function(e){return"string"==typeof e||"symbol"==typeof e?e:Object.is(e?.valueOf?.(),-0)?"-0":String(e)}},48018,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.toString=function e(t){if(null==t)return"";if("string"==typeof t)return t;if(Array.isArray(t))return t.map(e).join(",");let n=String(t);return"0"===n&&Object.is(Number(t),-0)?"-0":n}},79232,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(48018),i=e.r(96736);n.toPath=function(e){if(Array.isArray(e))return e.map(i.toKey);if("symbol"==typeof e)return[e];e=r.toString(e);let t=[],n=e.length;if(0===n)return t;let a=0,o="",s="",l=!1;for(46===e.charCodeAt(0)&&(t.push(""),a++);a<n;){let r=e[a];s?"\\"===r&&a+1<n?o+=e[++a]:r===s?s="":o+=r:l?'"'===r||"'"===r?s=r:"]"===r?(l=!1,t.push(o),o=""):o+=r:"["===r?(l=!0,o&&(t.push(o),o="")):"."===r?o&&(t.push(o),o=""):o+=r,a++}return o&&t.push(o),t}},18915,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(78756),i=e.r(33858),a=e.r(96736),o=e.r(79232);n.get=function e(t,n,s){if(null==t)return s;switch(typeof n){case"string":{if(r.isUnsafeProperty(n))return s;let a=t[n];if(void 0===a)if(i.isDeepKey(n))return e(t,o.toPath(n),s);else return s;return a}case"number":case"symbol":{"number"==typeof n&&(n=a.toKey(n));let e=t[n];if(void 0===e)return s;return e}default:{if(Array.isArray(n)){var l=t,c=n,u=s;if(0===c.length)return u;let e=l;for(let t=0;t<c.length;t++){if(null==e||r.isUnsafeProperty(c[t]))return u;e=e[c[t]]}return void 0===e?u:e}if(n=Object.is(n?.valueOf(),-0)?"-0":String(n),r.isUnsafeProperty(n))return s;let e=t[n];if(void 0===e)return s;return e}}}},92068,(e,t,n)=>{t.exports=e.r(18915).get},14595,(e,t,n)=>{"use strict";var r=e.r(41357),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useSyncExternalStore,o=r.useRef,s=r.useEffect,l=r.useMemo,c=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;var f=a(e,(d=l(function(){function e(e){if(!s){if(s=!0,a=e,e=r(e),void 0!==u&&h.hasValue){var t=h.value;if(u(t,e))return o=t}return o=e}if(t=o,i(a,e))return t;var n=r(e);return void 0!==u&&u(t,n)?(a=e,t):(a=e,o=n)}var a,o,s=!1,l=void 0===n?null:n;return[function(){return e(t())},null===l?void 0:function(){return e(l())}]},[t,n,r,u]))[0],d[1]);return s(function(){h.hasValue=!0,h.value=f},[f]),c(f),f}},13027,(e,t,n)=>{"use strict";t.exports=e.r(14595)},55838,(e,t,n)=>{"use strict";var r=e.r(41357),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,o=r.useEffect,s=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch(e){return!0}}var u="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,u=r[1];return s(function(){i.value=n,i.getSnapshot=t,c(i)&&u({inst:i})},[e,n,t]),o(function(){return c(i)&&u({inst:i}),e(function(){c(i)&&u({inst:i})})},[e]),l(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},2239,(e,t,n)=>{"use strict";t.exports=e.r(55838)},52822,(e,t,n)=>{"use strict";var r=e.r(41357),i=e.r(2239),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=i.useSyncExternalStore,s=r.useRef,l=r.useEffect,c=r.useMemo,u=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;var f=o(e,(d=c(function(){function e(e){if(!l){if(l=!0,o=e,e=r(e),void 0!==i&&h.hasValue){var t=h.value;if(i(t,e))return s=t}return s=e}if(t=s,a(o,e))return t;var n=r(e);return void 0!==i&&i(t,n)?(o=e,t):(o=e,s=n)}var o,s,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,r,i]))[0],d[1]);return l(function(){h.hasValue=!0,h.value=f},[f]),u(f),f}},30224,(e,t,n)=>{"use strict";t.exports=e.r(52822)},45403,(e,t,n)=>{"use strict";function r(e){return"symbol"==typeof e?1:null===e?2:void 0===e?3:4*(e!=e)}Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.compareValues=(e,t,n)=>{if(e!==t){let i=r(e),a=r(t);if(i===a&&0===i){if(e<t)return"desc"===n?1:-1;if(e>t)return"desc"===n?-1:1}return"desc"===n?a-i:i-a}return 0}},9542,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isSymbol=function(e){return"symbol"==typeof e||e instanceof Symbol}},38104,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(9542),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;n.isKey=function(e,t){return!Array.isArray(e)&&(!!("number"==typeof e||"boolean"==typeof e||null==e||r.isSymbol(e))||"string"==typeof e&&(a.test(e)||!i.test(e))||null!=t&&Object.hasOwn(t,e))}},910,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(45403),i=e.r(38104),a=e.r(79232);n.orderBy=function(e,t,n,o){if(null==e)return[];n=o?void 0:n,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=null==t?[null]:[t]),0===t.length&&(t=[null]),Array.isArray(n)||(n=null==n?[]:[n]),n=n.map(e=>String(e));let s=(e,t)=>{let n=e;for(let e=0;e<t.length&&null!=n;++e)n=n[t[e]];return n},l=t.map(e=>(Array.isArray(e)&&1===e.length&&(e=e[0]),null==e||"function"==typeof e||Array.isArray(e)||i.isKey(e))?e:{key:e,path:a.toPath(e)});return e.map(e=>({original:e,criteria:l.map(t=>{var n,r;return n=t,null==(r=e)||null==n?r:"object"==typeof n&&"key"in n?Object.hasOwn(r,n.key)?r[n.key]:s(r,n.path):"function"==typeof n?n(r):Array.isArray(n)?s(r,n):"object"==typeof r?r[n]:r})})).slice().sort((e,t)=>{for(let i=0;i<l.length;i++){let a=r.compareValues(e.criteria[i],t.criteria[i],n[i]);if(0!==a)return a}return 0}).map(e=>e.original)}},44647,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.flatten=function(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a<e.length;a++){let o=e[a];Array.isArray(o)&&t<r?i(o,t+1):n.push(o)}};return i(e,0),n}},5257,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=/^(?:0|[1-9]\d*)$/;n.isIndex=function(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return r.test(e)}}},70871,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isLength=function(e){return Number.isSafeInteger(e)&&e>=0}},69642,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(70871);n.isArrayLike=function(e){return null!=e&&"function"!=typeof e&&r.isLength(e.length)}},90820,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isObject=function(e){return null!==e&&("object"==typeof e||"function"==typeof e)}},23855,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.eq=function(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}},15111,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(5257),i=e.r(69642),a=e.r(90820),o=e.r(23855);n.isIterateeCall=function(e,t,n){return!!a.isObject(n)&&(!!("number"==typeof t&&i.isArrayLike(n)&&r.isIndex(t))&&t<n.length||"string"==typeof t&&t in n)&&o.eq(n[t],e)}},69955,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(910),i=e.r(44647),a=e.r(15111);n.sortBy=function(e,...t){let n=t.length;return n>1&&a.isIterateeCall(e,t[0],t[1])?t=[]:n>2&&a.isIterateeCall(t[0],t[1],t[2])&&(t=[t[0]]),r.orderBy(e,i.flatten(t),["asc"])}},42342,(e,t,n)=>{t.exports=e.r(69955).sortBy},24798,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.debounce=function(e,t,{signal:n,edges:r}={}){let i,a=null,o=null!=r&&r.includes("leading"),s=null==r||r.includes("trailing"),l=()=>{null!==a&&(e.apply(i,a),i=void 0,a=null)},c=null,u=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,s&&l(),d()},t)},d=()=>{null!==c&&(clearTimeout(c),c=null),i=void 0,a=null},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=null==c;u(),o&&t&&l()};return h.schedule=u,h.cancel=d,h.flush=()=>{l()},n?.addEventListener("abort",d,{once:!0}),h}},96074,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(24798);n.debounce=function(e,t=0,n={}){let i;"object"!=typeof n&&(n={});let{leading:a=!1,trailing:o=!0,maxWait:s}=n,l=[,,];a&&(l[0]="leading"),o&&(l[1]="trailing");let c=null,u=r.debounce(function(...t){i=e.apply(this,t),c=null},t,{edges:l}),d=function(...t){return null!=s&&(null===c&&(c=Date.now()),Date.now()-c>=s)?(i=e.apply(this,t),c=Date.now(),u.cancel(),u.schedule(),i):(u.apply(this,t),i)};return d.cancel=u.cancel,d.flush=()=>(u.flush(),i),d}},46508,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(96074);n.throttle=function(e,t=0,n={}){let{leading:i=!0,trailing:a=!0}=n;return r.debounce(e,t,{leading:i,maxWait:t,trailing:a})}},58723,(e,t,n)=>{t.exports=e.r(46508).throttle},41015,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(9542);n.toNumber=function(e){return r.isSymbol(e)?NaN:Number(e)}},89793,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(41015);n.toFinite=function(e){return e?(e=r.toNumber(e))===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e==e?e:0:0===e?e:0}},45264,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(15111),i=e.r(89793);n.range=function(e,t,n){n&&"number"!=typeof n&&r.isIterateeCall(e,t,n)&&(t=n=void 0),e=i.toFinite(e),void 0===t?(t=e,e=0):t=i.toFinite(t),n=void 0===n?e<t?1:-1:i.toFinite(n);let a=Math.max(Math.ceil((t-e)/(n||1)),0),o=Array(a);for(let t=0;t<a;t++)o[t]=e,e+=n;return o}},66814,(e,t,n)=>{t.exports=e.r(45264).range},51655,(e,t,n)=>{!function(n){"use strict";var r,i={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},a=!0,o="[DecimalError] ",s=o+"Invalid argument: ",l=o+"Exponent out of range: ",c=Math.floor,u=Math.pow,d=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,h=c(1286742750677284.5),f={};function p(e,t){var n,r,i,o,s,l,c,u,d=e.constructor,h=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),a?C(t,h):t;if(c=e.d,u=t.d,s=e.e,i=t.e,c=c.slice(),o=s-i){for(o<0?(r=c,o=-o,l=u.length):(r=u,i=s,l=c.length),o>(l=(s=Math.ceil(h/7))>l?s+1:l+1)&&(o=l,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for((l=c.length)-(o=u.length)<0&&(o=l,r=u,u=c,c=r),n=0;o;)n=(c[--o]=c[o]+u[o]+n)/1e7|0,c[o]%=1e7;for(n&&(c.unshift(n),++i),l=c.length;0==c[--l];)c.pop();return t.d=c,t.e=i,a?C(t,h):t}function g(e,t,n){if(e!==~~e||e<t||e>n)throw Error(s+e)}function v(e){var t,n,r,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)(n=7-(r=e[t]+"").length)&&(a+=j(n)),a+=r;(n=7-(r=(o=e[t])+"").length)&&(a+=j(n))}else if(0===o)return"0";for(;o%10==0;)o/=10;return a+o}f.absoluteValue=f.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e},f.comparedTo=f.cmp=function(e){var t,n,r,i;if(e=new this.constructor(e),this.s!==e.s)return this.s||-e.s;if(this.e!==e.e)return this.e>e.e^this.s<0?1:-1;for(t=0,n=(r=this.d.length)<(i=e.d.length)?r:i;t<n;++t)if(this.d[t]!==e.d[t])return this.d[t]>e.d[t]^this.s<0?1:-1;return r===i?0:r>i^this.s<0?1:-1},f.decimalPlaces=f.dp=function(){var e=this.d.length-1,t=(e-this.e)*7;if(e=this.d[e])for(;e%10==0;e/=10)t--;return t<0?0:t},f.dividedBy=f.div=function(e){return x(this,new this.constructor(e))},f.dividedToIntegerBy=f.idiv=function(e){var t=this.constructor;return C(x(this,new t(e),0,1),t.precision)},f.equals=f.eq=function(e){return!this.cmp(e)},f.exponent=function(){return b(this)},f.greaterThan=f.gt=function(e){return this.cmp(e)>0},f.greaterThanOrEqualTo=f.gte=function(e){return this.cmp(e)>=0},f.isInteger=f.isint=function(){return this.e>this.d.length-2},f.isNegative=f.isneg=function(){return this.s<0},f.isPositive=f.ispos=function(){return this.s>0},f.isZero=function(){return 0===this.s},f.lessThan=f.lt=function(e){return 0>this.cmp(e)},f.lessThanOrEqualTo=f.lte=function(e){return 1>this.cmp(e)},f.logarithm=f.log=function(e){var t,n=this.constructor,i=n.precision,s=i+5;if(void 0===e)e=new n(10);else if((e=new n(e)).s<1||e.eq(r))throw Error(o+"NaN");if(this.s<1)throw Error(o+(this.s?"NaN":"-Infinity"));return this.eq(r)?new n(0):(a=!1,t=x(N(this,s),N(e,s),s),a=!0,C(t,i))},f.minus=f.sub=function(e){return e=new this.constructor(e),this.s==e.s?E(this,e):p(this,(e.s=-e.s,e))},f.modulo=f.mod=function(e){var t,n=this.constructor,r=n.precision;if(!(e=new n(e)).s)throw Error(o+"NaN");return this.s?(a=!1,t=x(this,e,0,1).times(e),a=!0,this.minus(t)):C(new n(this),r)},f.naturalExponential=f.exp=function(){return y(this)},f.naturalLogarithm=f.ln=function(){return N(this)},f.negated=f.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},f.plus=f.add=function(e){return e=new this.constructor(e),this.s==e.s?p(this,e):E(this,(e.s=-e.s,e))},f.precision=f.sd=function(e){var t,n,r;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(s+e);if(t=b(this)+1,n=7*(r=this.d.length-1)+1,r=this.d[r]){for(;r%10==0;r/=10)n--;for(r=this.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},f.squareRoot=f.sqrt=function(){var e,t,n,r,i,s,l,u=this.constructor;if(this.s<1){if(!this.s)return new u(0);throw Error(o+"NaN")}for(e=b(this),a=!1,0==(i=Math.sqrt(+this))||i==1/0?(((t=v(this.d)).length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),r=new u(t=i==1/0?"5e"+e:(t=i.toExponential()).slice(0,t.indexOf("e")+1)+e)):r=new u(i.toString()),i=l=(n=u.precision)+3;;)if(r=(s=r).plus(x(this,s,l+2)).times(.5),v(s.d).slice(0,l)===(t=v(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),i==l&&"4999"==t){if(C(s,n+1,0),s.times(s).eq(this)){r=s;break}}else if("9999"!=t)break;l+=4}return a=!0,C(r,n)},f.times=f.mul=function(e){var t,n,r,i,o,s,l,c,u,d=this.constructor,h=this.d,f=(e=new d(e)).d;if(!this.s||!e.s)return new d(0);for(e.s*=this.s,n=this.e+e.e,(c=h.length)<(u=f.length)&&(o=h,h=f,f=o,s=c,c=u,u=s),o=[],r=s=c+u;r--;)o.push(0);for(r=u;--r>=0;){for(t=0,i=c+r;i>r;)l=o[i]+f[r]*h[i-r-1]+t,o[i--]=l%1e7|0,t=l/1e7|0;o[i]=(o[i]+t)%1e7|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,a?C(e,d.precision):e},f.toDecimalPlaces=f.todp=function(e,t){var n=this,r=n.constructor;return(n=new r(n),void 0===e)?n:(g(e,0,1e9),void 0===t?t=r.rounding:g(t,0,8),C(n,e+b(n)+1,t))},f.toExponential=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=_(r,!0):(g(e,0,1e9),void 0===t?t=i.rounding:g(t,0,8),n=_(r=C(new i(r),e+1,t),!0,e+1)),n},f.toFixed=function(e,t){var n,r,i=this.constructor;return void 0===e?_(this):(g(e,0,1e9),void 0===t?t=i.rounding:g(t,0,8),n=_((r=C(new i(this),e+b(this)+1,t)).abs(),!1,e+b(r)+1),this.isneg()&&!this.isZero()?"-"+n:n)},f.toInteger=f.toint=function(){var e=this.constructor;return C(new e(this),b(this)+1,e.rounding)},f.toNumber=function(){return+this},f.toPower=f.pow=function(e){var t,n,i,s,l,u,d=this,h=d.constructor,f=+(e=new h(e));if(!e.s)return new h(r);if(!(d=new h(d)).s){if(e.s<1)throw Error(o+"Infinity");return d}if(d.eq(r))return d;if(i=h.precision,e.eq(r))return C(d,i);if(u=(t=e.e)>=(n=e.d.length-1),l=d.s,u){if((n=f<0?-f:f)<=0x1fffffffffffff){for(s=new h(r),t=Math.ceil(i/7+4),a=!1;n%2&&S((s=s.times(d)).d,t),0!==(n=c(n/2));)S((d=d.times(d)).d,t);return a=!0,e.s<0?new h(r).div(s):C(s,i)}}else if(l<0)throw Error(o+"NaN");return l=l<0&&1&e.d[Math.max(t,n)]?-1:1,d.s=1,a=!1,s=e.times(N(d,i+12)),a=!0,(s=y(s)).s=l,s},f.toPrecision=function(e,t){var n,r,i=this,a=i.constructor;return void 0===e?(n=b(i),r=_(i,n<=a.toExpNeg||n>=a.toExpPos)):(g(e,1,1e9),void 0===t?t=a.rounding:g(t,0,8),n=b(i=C(new a(i),e,t)),r=_(i,e<=n||n<=a.toExpNeg,e)),r},f.toSignificantDigits=f.tosd=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(g(e,1,1e9),void 0===t?t=n.rounding:g(t,0,8)),C(new n(this),e,t)},f.toString=f.valueOf=f.val=f.toJSON=function(){var e=b(this),t=this.constructor;return _(this,e<=t.toExpNeg||e>=t.toExpPos)};var x=function(){function e(e,t){var n,r=0,i=e.length;for(e=e.slice();i--;)n=e[i]*t+r,e[i]=n%1e7|0,r=n/1e7|0;return r&&e.unshift(r),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]<t[n]),e[n]=1e7*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,a,s){var l,c,u,d,h,f,p,g,v,x,y,w,j,N,k,E,_,S,T=r.constructor,A=r.s==i.s?1:-1,O=r.d,M=i.d;if(!r.s)return new T(r);if(!i.s)throw Error(o+"Division by zero");for(u=0,c=r.e-i.e,_=M.length,k=O.length,g=(p=new T(A)).d=[];M[u]==(O[u]||0);)++u;if(M[u]>(O[u]||0)&&--c,(w=null==a?a=T.precision:s?a+(b(r)-b(i))+1:a)<0)return new T(0);if(w=w/7+2|0,u=0,1==_)for(d=0,M=M[0],w++;(u<k||d)&&w--;u++)j=1e7*d+(O[u]||0),g[u]=j/M|0,d=j%M|0;else{for((d=1e7/(M[0]+1)|0)>1&&(M=e(M,d),O=e(O,d),_=M.length,k=O.length),N=_,x=(v=O.slice(0,_)).length;x<_;)v[x++]=0;(S=M.slice()).unshift(0),E=M[0],M[1]>=1e7/2&&++E;do d=0,(l=t(M,v,_,x))<0?(y=v[0],_!=x&&(y=1e7*y+(v[1]||0)),(d=y/E|0)>1?(d>=1e7&&(d=1e7-1),f=(h=e(M,d)).length,x=v.length,1==(l=t(h,v,f,x))&&(d--,n(h,_<f?S:M,f))):(0==d&&(l=d=1),h=M.slice()),(f=h.length)<x&&h.unshift(0),n(v,h,x),-1==l&&(x=v.length,(l=t(M,v,_,x))<1&&(d++,n(v,_<x?S:M,x))),x=v.length):0===l&&(d++,v=[0]),g[u++]=d,l&&v[0]?v[x++]=O[N]||0:(v=[O[N]],x=1);while((N++<k||void 0!==v[0])&&w--)}return g[0]||g.shift(),p.e=c,C(p,s?a+b(p)+1:a)}}();function y(e,t){var n,i,o,s,c,d=0,h=0,f=e.constructor,p=f.precision;if(b(e)>16)throw Error(l+b(e));if(!e.s)return new f(r);for(null==t?(a=!1,c=p):c=t,s=new f(.03125);e.abs().gte(.1);)e=e.times(s),h+=5;for(c+=Math.log(u(2,h))/Math.LN10*2+5|0,n=i=o=new f(r),f.precision=c;;){if(i=C(i.times(e),c),n=n.times(++d),v((s=o.plus(x(i,n,c))).d).slice(0,c)===v(o.d).slice(0,c)){for(;h--;)o=C(o.times(o),c);return f.precision=p,null==t?(a=!0,C(o,p)):o}o=s}}function b(e){for(var t=7*e.e,n=e.d[0];n>=10;n/=10)t++;return t}function w(e,t,n){if(t>e.LN10.sd())throw a=!0,n&&(e.precision=n),Error(o+"LN10 precision limit exceeded");return C(new e(e.LN10),t)}function j(e){for(var t="";e--;)t+="0";return t}function N(e,t){var n,i,s,l,c,u,d,h,f,p=1,g=e,y=g.d,j=g.constructor,k=j.precision;if(g.s<1)throw Error(o+(g.s?"NaN":"-Infinity"));if(g.eq(r))return new j(0);if(null==t?(a=!1,h=k):h=t,g.eq(10))return null==t&&(a=!0),w(j,h);if(j.precision=h+=10,i=(n=v(y)).charAt(0),!(15e14>Math.abs(l=b(g))))return d=w(j,h+2,k).times(l+""),g=N(new j(i+"."+n.slice(1)),h-10).plus(d),j.precision=k,null==t?(a=!0,C(g,k)):g;for(;i<7&&1!=i||1==i&&n.charAt(1)>3;)i=(n=v((g=g.times(e)).d)).charAt(0),p++;for(l=b(g),i>1?(g=new j("0."+n),l++):g=new j(i+"."+n.slice(1)),u=c=g=x(g.minus(r),g.plus(r),h),f=C(g.times(g),h),s=3;;){if(c=C(c.times(f),h),v((d=u.plus(x(c,new j(s),h))).d).slice(0,h)===v(u.d).slice(0,h))return u=u.times(2),0!==l&&(u=u.plus(w(j,h+2,k).times(l+""))),u=x(u,new j(p),h),j.precision=k,null==t?(a=!0,C(u,k)):u;u=d,s+=2}}function k(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);)++r;for(i=t.length;48===t.charCodeAt(i-1);)--i;if(t=t.slice(r,i)){if(i-=r,e.e=c((n=n-r-1)/7),e.d=[],r=(n+1)%7,n<0&&(r+=7),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=7;r<i;)e.d.push(+t.slice(r,r+=7));r=7-(t=t.slice(r)).length}else r-=i;for(;r--;)t+="0";if(e.d.push(+t),a&&(e.e>h||e.e<-h))throw Error(l+n)}else e.s=0,e.e=0,e.d=[0];return e}function C(e,t,n){var r,i,o,s,d,f,p,g,v=e.d;for(s=1,o=v[0];o>=10;o/=10)s++;if((r=t-s)<0)r+=7,i=t,p=v[g=0];else{if((g=Math.ceil((r+1)/7))>=(o=v.length))return e;for(s=1,p=o=v[g];o>=10;o/=10)s++;r%=7,i=r-7+s}if(void 0!==n&&(d=p/(o=u(10,s-i-1))%10|0,f=t<0||void 0!==v[g+1]||p%o,f=n<4?(d||f)&&(0==n||n==(e.s<0?3:2)):d>5||5==d&&(4==n||f||6==n&&(r>0?i>0?p/u(10,s-i):0:v[g-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return f?(o=b(e),v.length=1,t=t-o-1,v[0]=u(10,(7-t%7)%7),e.e=c(-t/7)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(0==r?(v.length=g,o=1,g--):(v.length=g+1,o=u(10,7-r),v[g]=i>0?(p/u(10,s-i)%u(10,i)|0)*o:0),f)for(;;)if(0==g){1e7==(v[0]+=o)&&(v[0]=1,++e.e);break}else{if(v[g]+=o,1e7!=v[g])break;v[g--]=0,o=1}for(r=v.length;0===v[--r];)v.pop();if(a&&(e.e>h||e.e<-h))throw Error(l+b(e));return e}function E(e,t){var n,r,i,o,s,l,c,u,d,h,f=e.constructor,p=f.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new f(e),a?C(t,p):t;if(c=e.d,h=t.d,r=t.e,u=e.e,c=c.slice(),s=u-r){for((d=s<0)?(n=c,s=-s,l=h.length):(n=h,r=u,l=c.length),s>(i=Math.max(Math.ceil(p/7),l)+2)&&(s=i,n.length=1),n.reverse(),i=s;i--;)n.push(0);n.reverse()}else{for((d=(i=c.length)<(l=h.length))&&(l=i),i=0;i<l;i++)if(c[i]!=h[i]){d=c[i]<h[i];break}s=0}for(d&&(n=c,c=h,h=n,t.s=-t.s),l=c.length,i=h.length-l;i>0;--i)c[l++]=0;for(i=h.length;i>s;){if(c[--i]<h[i]){for(o=i;o&&0===c[--o];)c[o]=1e7-1;--c[o],c[i]+=1e7}c[i]-=h[i]}for(;0===c[--l];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(t.d=c,t.e=r,a?C(t,p):t):new f(0)}function _(e,t,n){var r,i=b(e),a=v(e.d),o=a.length;return t?(n&&(r=n-o)>0?a=a.charAt(0)+"."+a.slice(1)+j(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+j(-i-1)+a,n&&(r=n-o)>0&&(a+=j(r))):i>=o?(a+=j(i+1-o),n&&(r=n-i-1)>0&&(a=a+"."+j(r))):((r=i+1)<o&&(a=a.slice(0,r)+"."+a.slice(r)),n&&(r=n-o)>0&&(i+1===o&&(a+="."),a+=j(r))),e.s<0?"-"+a:a}function S(e,t){if(e.length>t)return e.length=t,!0}function T(e){if(!e||"object"!=typeof e)throw Error(o+"Object expected");var t,n,r,i=["precision",1,1e9,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<i.length;t+=3)if(void 0!==(r=e[n=i[t]]))if(c(r)===r&&r>=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(s+n+": "+r);if(void 0!==(r=e[n="LN10"]))if(r==Math.LN10)this[n]=new this(r);else throw Error(s+n+": "+r);return this}if((i=function e(t){var n,r,i;function a(e){if(!(this instanceof a))return new a(e);if(this.constructor=a,e instanceof a){this.s=e.s,this.e=e.e,this.d=(e=e.d)?e.slice():e;return}if("number"==typeof e){if(0*e!=0)throw Error(s+e);if(e>0)this.s=1;else if(e<0)e=-e,this.s=-1;else{this.s=0,this.e=0,this.d=[0];return}if(e===~~e&&e<1e7){this.e=0,this.d=[e];return}return k(this,e.toString())}if("string"!=typeof e)throw Error(s+e);if(45===e.charCodeAt(0)?(e=e.slice(1),this.s=-1):this.s=1,d.test(e))k(this,e);else throw Error(s+e)}if(a.prototype=f,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=e,a.config=a.set=T,void 0===t&&(t={}),t)for(n=0,i=["precision","rounding","toExpNeg","toExpPos","LN10"];n<i.length;)t.hasOwnProperty(r=i[n++])||(t[r]=this[r]);return a.config(t),a}(i)).default=i.Decimal=i,r=new i(1),"function"==typeof define&&define.amd){let t;e.r,void 0!==(t=i)&&e.v(t)}else t.exports?t.exports=i:(n||(n="u">typeof self&&self&&self.self==self?self:Function("return this")()),n.Decimal=i)}(e.e)},29942,(e,t,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,i="~";function a(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,r,a){if("function"!=typeof n)throw TypeError("The listener must be a function");var s=new o(n,r||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new a:delete e._events[t]}function c(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(i=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,a=n.length,o=Array(a);r<a;r++)o[r]=n[r].fn;return o},c.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,r,a,o){var s=i?i+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,r),!0;case 5:return u.fn.call(u.context,t,n,r,a),!0;case 6:return u.fn.call(u.context,t,n,r,a,o),!0}for(c=1,l=Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var h,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,n);break;case 4:u[c].fn.call(u[c].context,t,n,r);break;default:if(!l)for(h=1,l=Array(d-1);h<d;h++)l[h-1]=arguments[h];u[c].fn.apply(u[c].context,l)}}return!0},c.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,r){var a=i?i+e:e;if(!this._events[a])return this;if(!t)return l(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||r&&!o.once||n&&o.context!==n||l(this,a);else{for(var s=0,c=[],u=o.length;s<u;s++)(o[s].fn!==t||r&&!o[s].once||n&&o[s].context!==n)&&c.push(o[s]);c.length?this._events[a]=1===c.length?c[0]:c:l(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&l(this,t)):(this._events=new a,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=i,c.EventEmitter=c,t.exports=c},43210,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.last=function(e){return e[e.length-1]}},75576,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.toArray=function(e){return Array.isArray(e)?e:Array.from(e)}},5518,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(43210),i=e.r(75576),a=e.r(69642);n.last=function(e){if(a.isArrayLike(e))return r.last(i.toArray(e))}},4178,(e,t,n)=>{t.exports=e.r(5518).last},78804,(e,t,n)=>{"use strict";var r=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.view_transition"),v=Symbol.for("react.client.reference");function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case a:case s:case o:case d:case h:case g:return e;default:switch(e=e&&e.$$typeof){case c:case u:case p:case f:case l:return e;default:return t}}case i:return t}}}n.ContextConsumer=l,n.ContextProvider=c,n.Element=r,n.ForwardRef=u,n.Fragment=a,n.Lazy=p,n.Memo=f,n.Portal=i,n.Profiler=s,n.StrictMode=o,n.Suspense=d,n.SuspenseList=h,n.isContextConsumer=function(e){return x(e)===l},n.isContextProvider=function(e){return x(e)===c},n.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},n.isForwardRef=function(e){return x(e)===u},n.isFragment=function(e){return x(e)===a},n.isLazy=function(e){return x(e)===p},n.isMemo=function(e){return x(e)===f},n.isPortal=function(e){return x(e)===i},n.isProfiler=function(e){return x(e)===s},n.isStrictMode=function(e){return x(e)===o},n.isSuspense=function(e){return x(e)===d},n.isSuspenseList=function(e){return x(e)===h},n.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===s||e===o||e===d||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===f||e.$$typeof===c||e.$$typeof===l||e.$$typeof===u||e.$$typeof===v||void 0!==e.getModuleId)||!1},n.typeOf=x},79684,(e,t,n)=>{"use strict";t.exports=e.r(78804)},10185,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.uniqBy=function(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r],a=t(i);n.has(a)||n.set(a,i)}return Array.from(n.values())}},36074,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.identity=function(e){return e}},52603,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isObjectLike=function(e){return"object"==typeof e&&null!==e}},44936,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(69642),i=e.r(52603);n.isArrayLikeObject=function(e){return i.isObjectLike(e)&&r.isArrayLike(e)}},77473,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(18915);n.property=function(e){return function(t){return r.get(t,e)}}},75234,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isPrimitive=function(e){return null==e||"object"!=typeof e&&"function"!=typeof e}},44695,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(90820),i=e.r(75234),a=e.r(23855);function o(e,t,n,c){if(t===e)return!0;switch(typeof t){case"object":return function(e,t,n,r){if(null==t)return!0;if(Array.isArray(t))return s(e,t,n,r);if(t instanceof Map){var a=e,o=t,c=n,u=r;if(0===o.size)return!0;if(!(a instanceof Map))return!1;for(let[e,t]of o.entries())if(!1===c(a.get(e),t,e,a,o,u))return!1;return!0}if(t instanceof Set)return l(e,t,n,r);let d=Object.keys(t);if(null==e||i.isPrimitive(e))return 0===d.length;if(0===d.length)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let a=0;a<d.length;a++){let o=d[a];if(!i.isPrimitive(e)&&!(o in e)||void 0===t[o]&&void 0!==e[o]||null===t[o]&&null!==e[o]||!n(e[o],t[o],o,e,t,r))return!1}return!0}finally{r?.delete(t)}}(e,t,n,c);case"function":if(Object.keys(t).length>0)return o(e,{...t},n,c);return a.eq(e,t);default:if(!r.isObject(e))return a.eq(e,t);if("string"==typeof t)return""===t;return!0}}function s(e,t,n,r){if(0===t.length)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],s=!1;for(let l=0;l<e.length;l++){if(i.has(l))continue;let c=e[l],u=!1;if(n(c,o,a,e,t,r)&&(u=!0),u){i.add(l),s=!0;break}}if(!s)return!1}return!0}function l(e,t,n,r){return 0===t.size||e instanceof Set&&s([...e],[...t],n,r)}n.isMatchWith=function e(t,n,r){return"function"!=typeof r?e(t,n,()=>void 0):o(t,n,function e(t,n,i,a,s,l){let c=r(t,n,i,a,s,l);return void 0!==c?!!c:o(t,n,e,l)},new Map)},n.isSetMatch=l},3450,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(44695);n.isMatch=function(e,t){return r.isMatchWith(e,t,()=>void 0)}},23545,(e,t,n)=>{var r={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),n=t[0],r=t[1];return(n+r)*3/4-r},t.toByteArray=function(e){var t,n,a=l(e),o=a[0],s=a[1],c=new i((o+s)*3/4-s),u=0,d=s>0?o-4:o;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===s&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,c[u++]=255&t),1===s&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,a=[],o=0,s=r-i;o<s;o+=16383)a.push(function(e,t,r){for(var i,a=[],o=t;o<r;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),a.push(n[i>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}(e,o,o+16383>s?s:o+16383));return 1===i?a.push(n[(t=e[r-1])>>2]+n[t<<4&63]+"=="):2===i&&a.push(n[(t=(e[r-2]<<8)+e[r-1])>>10]+n[t>>4&63]+n[t<<2&63]+"="),a.join("")};for(var n=[],r=[],i="u">typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o<s;++o)n[o]=a[o],r[a.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}r[45]=62,r[95]=63},72:function(e,t,n){"use strict";var r=n(675),i=n(783),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return u(e)}return l(e,t,n)}function l(e,t,n){if("string"==typeof e){var r=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!s.isEncoding(i))throw TypeError("Unknown encoding: "+i);var a=0|f(r,i),l=o(a),c=l.write(r,i);return c!==a&&(l=l.slice(0,c)),l}if(ArrayBuffer.isView(e))return d(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(A(e,ArrayBuffer)||e&&A(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(A(e,SharedArrayBuffer)||e&&A(e.buffer,SharedArrayBuffer)))return function(e,t,n){var r;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),s.prototype),r}(e,t,n);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var u=e.valueOf&&e.valueOf();if(null!=u&&u!==e)return s.from(u,t,n);var p=function(e){if(s.isBuffer(e)){var t=0|h(e.length),n=o(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?o(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(p)return p;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,n);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return c(e),o(e<0?0:0|h(e))}function d(e){for(var t=e.length<0?0:0|h(e.length),n=o(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}t.Buffer=s,t.SlowBuffer=function(e){return+e!=e&&(e=0),s.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!s.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,n){return l(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,n){return(c(e),e<=0)?o(e):void 0!==t?"string"==typeof n?o(e).fill(t,n):o(e).fill(t):o(e)},s.allocUnsafe=function(e){return u(e)},s.allocUnsafeSlow=function(e){return u(e)};function h(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function f(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||A(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return S(e).length;default:if(i)return r?-1:E(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,n){var i,a,o,s=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0||(n>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",a=t;a<n;++a)i+=O[e[a]];return i}(this,t,n);case"utf8":case"utf-8":return y(this,t,n);case"ascii":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}(this,t,n);case"latin1":case"binary":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}(this,t,n);case"base64":return i=this,a=t,o=n,0===a&&o===i.length?r.fromByteArray(i):r.fromByteArray(i.slice(a,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,n){for(var r=e.slice(t,n),i="",a=0;a<r.length;a+=2)i+=String.fromCharCode(r[a]+256*r[a+1]);return i}(this,t,n);default:if(s)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,i){var a;if(0===e.length)return -1;if("string"==typeof n?(r=n,n=0):n>0x7fffffff?n=0x7fffffff:n<-0x80000000&&(n=-0x80000000),(a=n*=1)!=a&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length)if(i)return -1;else n=e.length-1;else if(n<0)if(!i)return -1;else n=0;if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:x(e,t,n,r,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,n);else return Uint8Array.prototype.lastIndexOf.call(e,t,n);return x(e,[t],n,r,i)}throw TypeError("val must be string, number or Buffer")}function x(e,t,n,r,i){var a,o=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;o=2,s/=2,l/=2,n/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var u=-1;for(a=n;a<s;a++)if(c(e,a)===c(t,-1===u?0:a-u)){if(-1===u&&(u=a),a-u+1===l)return u*o}else -1!==u&&(a-=a-u),u=-1}else for(n+l>s&&(n=s-l),a=n;a>=0;a--){for(var d=!0,h=0;h<l;h++)if(c(e,a+h)!==c(t,h)){d=!1;break}if(d)return a}return -1}s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(A(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),A(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);if(void 0===t)for(n=0,t=0;n<e.length;++n)t+=e[n].length;var n,r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(A(a,Uint8Array)&&(a=s.from(a)),!s.isBuffer(a))throw TypeError('"list" argument must be an Array of Buffers');a.copy(r,i),i+=a.length}return r},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?y(this,0,e):p.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},a&&(s.prototype[a]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(A(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,o=n-t,l=Math.min(a,o),c=this.slice(r,i),u=e.slice(t,n),d=0;d<l;++d)if(c[d]!==u[d]){a=c[d],o=u[d];break}return a<o?-1:+(o<a)},s.prototype.includes=function(e,t,n){return -1!==this.indexOf(e,t,n)},s.prototype.indexOf=function(e,t,n){return v(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return v(this,e,t,n,!1)};function y(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a,o,s,l,c=e[i],u=null,d=c>239?4:c>223?3:c>191?2:1;if(i+d<=n)switch(d){case 1:c<128&&(u=c);break;case 2:(192&(a=e[i+1]))==128&&(l=(31&c)<<6|63&a)>127&&(u=l);break;case 3:a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(l=(15&c)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(l=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(u=l)}null===u?(u=65533,d=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=d}var h=r,f=h.length;if(f<=4096)return String.fromCharCode.apply(String,h);for(var p="",g=0;g<f;)p+=String.fromCharCode.apply(String,h.slice(g,g+=4096));return p}function b(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function w(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw RangeError('"value" argument is out of bounds');if(n+r>e.length)throw RangeError("Index out of range")}function j(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function N(e,t,n,r,a){return t*=1,n>>>=0,a||j(e,t,n,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,n,r,23,4),n+4}function k(e,t,n,r,a){return t*=1,n>>>=0,a||j(e,t,n,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,n,r,52,8),n+8}s.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,a,o,s,l,c,u,d,h=this.length-t;if((void 0===n||n>h)&&(n=h),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var f=!1;;)switch(r){case"hex":return function(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var a=t.length;r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s,l=parseInt(t.substr(2*o,2),16);if((s=l)!=s)break;e[n+o]=l}return o}(this,e,t,n);case"utf8":case"utf-8":return i=t,a=n,T(E(e,this.length-i),this,i,a);case"ascii":return o=t,s=n,T(_(e),this,o,s);case"latin1":case"binary":return function(e,t,n,r){return T(_(t),e,n,r)}(this,e,t,n);case"base64":return l=t,c=n,T(S(e),this,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u=t,d=n,T(function(e,t){for(var n,r,i=[],a=0;a<e.length&&!((t-=2)<0);++a)r=(n=e.charCodeAt(a))>>8,i.push(n%256),i.push(r);return i}(e,this.length-u),this,u,d);default:if(f)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),f=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},s.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r},s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||b(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?0xffff0000|n:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?0xffff0000|n:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;w(this,e,t,n,i,0)}var a=1,o=0;for(this[t]=255&e;++o<n&&(a*=256);)this[t+o]=e/a&255;return t+n},s.prototype.writeUIntBE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){var i=Math.pow(2,8*n)-1;w(this,e,t,n,i,0)}var a=n-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e*=1,t>>>=0,n||w(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e*=1,t>>>=0,n||w(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,n){return e*=1,t>>>=0,n||w(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,n){return e*=1,t>>>=0,n||w(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,n){return e*=1,t>>>=0,n||w(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e*=1,t>>>=0,!r){var i=Math.pow(2,8*n-1);w(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<n&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e*=1,t>>>=0,!r){var i=Math.pow(2,8*n-1);w(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e*=1,t>>>=0,n||w(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e*=1,t>>>=0,n||w(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e*=1,t>>>=0,n||w(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,n){return e*=1,t>>>=0,n||w(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e*=1,t>>>=0,n||w(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return k(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return k(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw RangeError("Index out of range");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,n,r);else if(this===e&&n<t&&t<r)for(var a=i-1;a>=0;--a)e[a+t]=this[a+n];else Uint8Array.prototype.set.call(e,this.subarray(n,r),t);return i},s.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw TypeError("encoding must be a string");if("string"==typeof r&&!s.isEncoding(r))throw TypeError("Unknown encoding: "+r);if(1===e.length){var i,a=e.charCodeAt(0);("utf8"===r&&a<128||"latin1"===r)&&(e=a)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError("Out of range index");if(n<=t)return this;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var o=s.isBuffer(e)?e:s.from(e,r),l=o.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=o[i%l]}return this};var C=/[^+/0-9A-Za-z-_]/g;function E(e,t){t=t||1/0;for(var n,r=e.length,i=null,a=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319||o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}else throw Error("Invalid code point")}return a}function _(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}function S(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function T(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length)&&!(i>=e.length);++i)t[i+n]=e[i];return i}function A(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var O=function(){for(var e="0123456789abcdef",t=Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t}()},783:function(e,t){t.read=function(e,t,n,r,i){var a,o,s=8*i-r-1,l=(1<<s)-1,c=l>>1,u=-7,d=n?i-1:0,h=n?-1:1,f=e[t+d];for(d+=h,a=f&(1<<-u)-1,f>>=-u,u+=s;u>0;a=256*a+e[t+d],d+=h,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=256*o+e[t+d],d+=h,u-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),a-=c}return(f?-1:1)*o*Math.pow(2,a-r)},t.write=function(e,t,n,r,i,a){var o,s,l,c=8*a-i-1,u=(1<<c)-1,d=u>>1,h=5960464477539062e-23*(23===i),f=r?0:a-1,p=r?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+d>=1?t+=h/l:t+=h*Math.pow(2,1-d),t*l>=2&&(o++,l/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*l-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[n+f]=255&o,f+=p,o/=256,c-=8);e[n+f-p]|=128*g}}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}},o=!0;try{r[e](n,n.exports,a),o=!1}finally{o&&delete i[e]}return n.exports}a.ab="/ROOT/hindsight-control-plane/node_modules/next/dist/compiled/buffer/",t.exports=a(72)},9866,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.getSymbols=function(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}},23678,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.getTag=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}},55813,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.argumentsTag="[object Arguments]",n.arrayBufferTag="[object ArrayBuffer]",n.arrayTag="[object Array]",n.bigInt64ArrayTag="[object BigInt64Array]",n.bigUint64ArrayTag="[object BigUint64Array]",n.booleanTag="[object Boolean]",n.dataViewTag="[object DataView]",n.dateTag="[object Date]",n.errorTag="[object Error]",n.float32ArrayTag="[object Float32Array]",n.float64ArrayTag="[object Float64Array]",n.functionTag="[object Function]",n.int16ArrayTag="[object Int16Array]",n.int32ArrayTag="[object Int32Array]",n.int8ArrayTag="[object Int8Array]",n.mapTag="[object Map]",n.numberTag="[object Number]",n.objectTag="[object Object]",n.regexpTag="[object RegExp]",n.setTag="[object Set]",n.stringTag="[object String]",n.symbolTag="[object Symbol]",n.uint16ArrayTag="[object Uint16Array]",n.uint32ArrayTag="[object Uint32Array]",n.uint8ArrayTag="[object Uint8Array]",n.uint8ClampedArrayTag="[object Uint8ClampedArray]"},55424,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isTypedArray=function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}},92348,(e,t,n)=>{"use strict";var r=e.i(23545);Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let i=e.r(9866),a=e.r(23678),o=e.r(55813),s=e.r(75234),l=e.r(55424);function c(e,t,n,i=new Map,d){let h=d?.(e,t,n,i);if(void 0!==h)return h;if(s.isPrimitive(e))return e;if(i.has(e))return i.get(e);if(Array.isArray(e)){let t=Array(e.length);i.set(e,t);for(let r=0;r<e.length;r++)t[r]=c(e[r],r,n,i,d);return Object.hasOwn(e,"index")&&(t.index=e.index),Object.hasOwn(e,"input")&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;for(let[r,a]of(i.set(e,t),e))t.set(r,c(a,r,n,i,d));return t}if(e instanceof Set){let t=new Set;for(let r of(i.set(e,t),e))t.add(c(r,void 0,n,i,d));return t}if(void 0!==r.Buffer&&r.Buffer.isBuffer(e))return e.subarray();if(l.isTypedArray(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);i.set(e,t);for(let r=0;r<e.length;r++)t[r]=c(e[r],r,n,i,d);return t}if(e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return i.set(e,t),u(t,e,n,i,d),t}if("u">typeof File&&e instanceof File){let t=new File([e],e.name,{type:e.type});return i.set(e,t),u(t,e,n,i,d),t}if("u">typeof Blob&&e instanceof Blob){let t=new Blob([e],{type:e.type});return i.set(e,t),u(t,e,n,i,d),t}if(e instanceof Error){let t=new e.constructor;return i.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,u(t,e,n,i,d),t}if(e instanceof Boolean){let t=new Boolean(e.valueOf());return i.set(e,t),u(t,e,n,i,d),t}if(e instanceof Number){let t=new Number(e.valueOf());return i.set(e,t),u(t,e,n,i,d),t}if(e instanceof String){let t=new String(e.valueOf());return i.set(e,t),u(t,e,n,i,d),t}if("object"==typeof e&&function(e){switch(a.getTag(e)){case o.argumentsTag:case o.arrayTag:case o.arrayBufferTag:case o.dataViewTag:case o.booleanTag:case o.dateTag:case o.float32ArrayTag:case o.float64ArrayTag:case o.int8ArrayTag:case o.int16ArrayTag:case o.int32ArrayTag:case o.mapTag:case o.numberTag:case o.objectTag:case o.regexpTag:case o.setTag:case o.stringTag:case o.symbolTag:case o.uint8ArrayTag:case o.uint8ClampedArrayTag:case o.uint16ArrayTag:case o.uint32ArrayTag:return!0;default:return!1}}(e)){let t=Object.create(Object.getPrototypeOf(e));return i.set(e,t),u(t,e,n,i,d),t}return e}function u(e,t,n=e,r,a){let o=[...Object.keys(t),...i.getSymbols(t)];for(let i=0;i<o.length;i++){let s=o[i],l=Object.getOwnPropertyDescriptor(e,s);(null==l||l.writable)&&(e[s]=c(t[s],s,n,r,a))}}n.cloneDeepWith=function(e,t){return c(e,void 0,e,new Map,t)},n.cloneDeepWithImpl=c,n.copyProperties=u},99510,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(92348);n.cloneDeep=function(e){return r.cloneDeepWithImpl(e,void 0,e,new Map,void 0)}},67284,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(3450),i=e.r(99510);n.matches=function(e){return e=i.cloneDeep(e),t=>r.isMatch(t,e)}},68110,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(92348),i=e.r(55813);n.cloneDeepWith=function(e,t){return r.cloneDeepWith(e,(n,a,o,s)=>{let l=t?.(n,a,o,s);if(void 0!==l)return l;if("object"==typeof e)switch(Object.prototype.toString.call(e)){case i.numberTag:case i.stringTag:case i.booleanTag:{let t=new e.constructor(e?.valueOf());return r.copyProperties(t,e),t}case i.argumentsTag:{let t={};return r.copyProperties(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}})}},93141,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(68110);n.cloneDeep=function(e){return r.cloneDeepWith(e)}},17858,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(23678);n.isArguments=function(e){return null!==e&&"object"==typeof e&&"[object Arguments]"===r.getTag(e)}},56518,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(33858),i=e.r(5257),a=e.r(17858),o=e.r(79232);n.has=function(e,t){let n;if(0===(n=Array.isArray(t)?t:"string"==typeof t&&r.isDeepKey(t)&&e?.[t]==null?o.toPath(t):[t]).length)return!1;let s=e;for(let e=0;e<n.length;e++){let t=n[e];if((null==s||!Object.hasOwn(s,t))&&!((Array.isArray(s)||a.isArguments(s))&&i.isIndex(t)&&t<s.length))return!1;s=s[t]}return!0}},40656,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(3450),i=e.r(96736),a=e.r(93141),o=e.r(18915),s=e.r(56518);n.matchesProperty=function(e,t){switch(typeof e){case"object":Object.is(e?.valueOf(),-0)&&(e="-0");break;case"number":e=i.toKey(e)}return t=a.cloneDeep(t),function(n){let i=o.get(n,e);return void 0===i?s.has(n,e):void 0===t?void 0===i:r.isMatch(i,t)}}},27519,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(36074),i=e.r(77473),a=e.r(67284),o=e.r(40656);n.iteratee=function(e){if(null==e)return r.identity;switch(typeof e){case"function":return e;case"object":if(Array.isArray(e)&&2===e.length)return o.matchesProperty(e[0],e[1]);return a.matches(e);case"string":case"symbol":case"number":return i.property(e)}}},77008,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});let r=e.r(10185),i=e.r(36074),a=e.r(44936),o=e.r(27519);n.uniqBy=function(e,t=i.identity){return a.isArrayLikeObject(e)?r.uniqBy(Array.from(e),o.iteratee(t)):[]}},92809,(e,t,n)=>{t.exports=e.r(77008).uniqBy},18256,(e,t,n)=>{"use strict";Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),n.isPlainObject=function(e){if("object"!=typeof e||null==e)return!1;if(null===Object.getPrototypeOf(e))return!0;if("[object Object]"!==Object.prototype.toString.call(e)){let t=e[Symbol.toStringTag];return null!=t&&!!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable&&e.toString()===`[object ${t}]`}let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}},7328,(e,t,n)=>{t.exports=e.r(18256).isPlainObject},37578,e=>{"use strict";let t,n,r,i,a,o;var s,l,c,u,d,h,f,p,g,v,x,y,b,w,j,N,k,C,E,_,S,T,A,O,M,P,D,L,I,R,B,z,F,V,U,H,W,Y,G,$,X,q,K,Z,Q,J,ee,et,en,er,ei,ea,eo,es,el,ec,eu,ed,eh,ef,ep=e.i(9087),em=e.i(41357),eg=e.i(45965),ev=e.i(46696),ex=e.i(99729),ey=e.i(59321),eb=e.i(29929),ew=e.i(55436),ej=e.i(75254);let eN=(0,ej.default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),ek=(0,ej.default)("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);var eC=e.i(78583);let eE=(0,ej.default)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),e_=(0,ej.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var eS=e.i(63059);let eT=(0,ej.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var eA=e.i(68373),eO=e.i(28830);function eM({currentTab:e,onTabChange:t}){let{currentBank:n}=(0,ey.useBank)(),[r,i]=(0,em.useState)(!0);if(!n)return null;let a=[{id:"data",label:"Memories",icon:ek},{id:"recall",label:"Recall",icon:ew.Search},{id:"reflect",label:"Reflect",icon:eN},{id:"documents",label:"Documents",icon:eC.FileText},{id:"entities",label:"Entities",icon:eE},{id:"profile",label:"Bank Configuration",icon:eT}];return(0,ep.jsxs)("aside",{className:(0,eA.cn)("bg-card border-r border-border flex flex-col transition-all duration-300",r?"w-16":"w-64"),children:[(0,ep.jsx)("nav",{className:"flex-1 p-3 pt-4",children:(0,ep.jsx)("ul",{className:"space-y-1",children:a.map(i=>{let a=i.icon,o=e===i.id,s=(0,eb.bankRoute)(n,`?view=${i.id}`);return(0,ep.jsx)("li",{children:(0,ep.jsxs)(eO.default,{href:s,onClick:e=>{0!==e.button||e.ctrlKey||e.metaKey||(e.preventDefault(),t(i.id))},className:(0,eA.cn)("w-full flex items-center gap-3 px-4 py-3 rounded-lg text-sm font-medium transition-all",o?"bg-primary-gradient text-white shadow-sm":"text-muted-foreground hover:bg-accent hover:text-accent-foreground",r&&"justify-center px-0"),title:r?i.label:void 0,children:[(0,ep.jsx)(a,{className:"w-5 h-5 flex-shrink-0"}),!r&&(0,ep.jsx)("span",{children:i.label})]})},i.id)})})}),(0,ep.jsx)("div",{className:"p-3 border-t border-border",children:(0,ep.jsx)("button",{onClick:()=>i(!r),className:(0,eA.cn)("w-full flex items-center gap-3 px-4 py-2 rounded-lg text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",r&&"justify-center px-0"),title:r?"Expand sidebar":"Collapse sidebar",children:r?(0,ep.jsx)(eS.ChevronRight,{className:"w-5 h-5"}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(e_,{className:"w-5 h-5"}),(0,ep.jsx)("span",{children:"Collapse"})]})})})]})}var eP=e.i(7122),eD=e.i(88029),eL=e.i(80208);let eI=(0,ej.default)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]),eR=(0,ej.default)("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),eB=(0,ej.default)("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),ez=(0,ej.default)("chevrons-left",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]),eF=(0,ej.default)("chevrons-right",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]),eV=(0,ej.default)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),eU=(0,ej.default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),eH=(0,ej.default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),eW=(0,ej.default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),eY=(0,ej.default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),eG=(0,ej.default)("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),e$=(0,ej.default)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),eX=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{className:"relative w-full overflow-auto rounded-xl ring-1 ring-border/60 bg-card",children:(0,ep.jsx)("table",{ref:n,className:(0,eA.cn)("w-full caption-bottom text-sm border-separate border-spacing-0",e),...t})}));eX.displayName="Table";let eq=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("thead",{ref:n,className:(0,eA.cn)("bg-muted/40",e),...t}));eq.displayName="TableHeader";let eK=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("tbody",{ref:n,className:(0,eA.cn)("[&>tr:last-child>td]:border-b-0",e),...t}));eK.displayName="TableBody",em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("tfoot",{ref:n,className:(0,eA.cn)("bg-muted/30 font-medium",e),...t})).displayName="TableFooter";let eZ=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("tr",{ref:n,className:(0,eA.cn)("transition-colors hover:bg-muted/40 data-[state=selected]:bg-muted/60",e),...t}));eZ.displayName="TableRow";let eQ=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("th",{ref:n,className:(0,eA.cn)("h-9 px-4 text-left align-middle text-[11px] font-semibold uppercase tracking-wider text-muted-foreground border-b border-border/60 [&:has([role=checkbox])]:pr-0",e),...t}));eQ.displayName="TableHead";let eJ=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("td",{ref:n,className:(0,eA.cn)("px-4 py-3 align-middle border-b border-border/40 [&:has([role=checkbox])]:pr-0",e),...t}));eJ.displayName="TableCell",em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("caption",{ref:n,className:(0,eA.cn)("mt-4 text-sm text-muted-foreground",e),...t})).displayName="TableCaption";var e0=e.i(62971),e1=e.i(91918),e2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,e1.createSlot)(`Primitive.${t}`),r=em.forwardRef((e,r)=>{let{asChild:i,...a}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ep.jsx)(i?n:t,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),e5=em.forwardRef((e,t)=>(0,ep.jsx)(e2.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));e5.displayName="Label";var e3=e.i(25913);let e4=(0,e3.cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),e6=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(e5,{ref:n,className:(0,eA.cn)(e4(),e),...t}));e6.displayName=e5.displayName;var e8=e.i(70152),e7=e.i(81140),e9=e.i(20783),te=e.i(30030),tt=e.i(69340),tn=e.i(86318),tr=e.i(99682),ti=e.i(35804),ta=e.i(48425),to=e.i(75830),ts=["PageUp","PageDown"],tl=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],tc={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},tu="Slider",[td,th,tf]=(0,to.createCollection)(tu),[tp,tm]=(0,te.createContextScope)(tu,[tf]),[tg,tv]=tp(tu),tx=em.forwardRef((e,t)=>{let{name:n,min:r=0,max:i=100,step:a=1,orientation:o="horizontal",disabled:s=!1,minStepsBetweenThumbs:l=0,defaultValue:c=[r],value:u,onValueChange:d=()=>{},onValueCommit:h=()=>{},inverted:f=!1,form:p,...g}=e,v=em.useRef(new Set),x=em.useRef(0),y="horizontal"===o,[b=[],w]=(0,tt.useControllableState)({prop:u,defaultProp:c,onChange:e=>{let t=[...v.current];t[x.current]?.focus(),d(e)}}),j=em.useRef(b);function N(e,t,{commit:n}={commit:!1}){let o,s=(String(a).split(".")[1]||"").length,c=Math.round((Math.round((e-r)/a)*a+r)*(o=Math.pow(10,s)))/o,u=(0,e8.clamp)(c,[r,i]);w((e=[])=>{let r=function(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}(e,u,t);if(!function(e,t){if(t>0)return Math.min(...e.slice(0,-1).map((t,n)=>e[n+1]-t))>=t;return!0}(r,l*a))return e;{x.current=r.indexOf(u);let t=String(r)!==String(e);return t&&n&&h(r),t?r:e}})}return(0,ep.jsx)(tg,{scope:e.__scopeSlider,name:n,disabled:s,min:r,max:i,valueIndexToChangeRef:x,thumbs:v.current,values:b,orientation:o,form:p,children:(0,ep.jsx)(td.Provider,{scope:e.__scopeSlider,children:(0,ep.jsx)(td.Slot,{scope:e.__scopeSlider,children:(0,ep.jsx)(y?tw:tj,{"aria-disabled":s,"data-disabled":s?"":void 0,...g,ref:t,onPointerDown:(0,e7.composeEventHandlers)(g.onPointerDown,()=>{s||(j.current=b)}),min:r,max:i,inverted:f,onSlideStart:s?void 0:function(e){let t=function(e,t){if(1===e.length)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}(b,e);N(e,t)},onSlideMove:s?void 0:function(e){N(e,x.current)},onSlideEnd:s?void 0:function(){let e=j.current[x.current];b[x.current]!==e&&h(b)},onHomeKeyDown:()=>!s&&N(r,0,{commit:!0}),onEndKeyDown:()=>!s&&N(i,b.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!s){let n=ts.includes(e.key)||e.shiftKey&&tl.includes(e.key),r=x.current;N(b[r]+a*(n?10:1)*t,r,{commit:!0})}}})})})})});tx.displayName=tu;var[ty,tb]=tp(tu,{startEdge:"left",endEdge:"right",size:"width",direction:1}),tw=em.forwardRef((e,t)=>{let{min:n,max:r,dir:i,inverted:a,onSlideStart:o,onSlideMove:s,onSlideEnd:l,onStepKeyDown:c,...u}=e,[d,h]=em.useState(null),f=(0,e9.useComposedRefs)(t,e=>h(e)),p=em.useRef(void 0),g=(0,tn.useDirection)(i),v="ltr"===g,x=v&&!a||!v&&a;function y(e){let t=p.current||d.getBoundingClientRect(),i=tP([0,t.width],x?[n,r]:[r,n]);return p.current=t,i(e-t.left)}return(0,ep.jsx)(ty,{scope:e.__scopeSlider,startEdge:x?"left":"right",endEdge:x?"right":"left",direction:x?1:-1,size:"width",children:(0,ep.jsx)(tN,{dir:g,"data-orientation":"horizontal",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:e=>{let t=y(e.clientX);o?.(t)},onSlideMove:e=>{let t=y(e.clientX);s?.(t)},onSlideEnd:()=>{p.current=void 0,l?.()},onStepKeyDown:e=>{let t=tc[x?"from-left":"from-right"].includes(e.key);c?.({event:e,direction:t?-1:1})}})})}),tj=em.forwardRef((e,t)=>{let{min:n,max:r,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:s,onStepKeyDown:l,...c}=e,u=em.useRef(null),d=(0,e9.useComposedRefs)(t,u),h=em.useRef(void 0),f=!i;function p(e){let t=h.current||u.current.getBoundingClientRect(),i=tP([0,t.height],f?[r,n]:[n,r]);return h.current=t,i(e-t.top)}return(0,ep.jsx)(ty,{scope:e.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1,children:(0,ep.jsx)(tN,{"data-orientation":"vertical",...c,ref:d,style:{...c.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:e=>{let t=p(e.clientY);a?.(t)},onSlideMove:e=>{let t=p(e.clientY);o?.(t)},onSlideEnd:()=>{h.current=void 0,s?.()},onStepKeyDown:e=>{let t=tc[f?"from-bottom":"from-top"].includes(e.key);l?.({event:e,direction:t?-1:1})}})})}),tN=em.forwardRef((e,t)=>{let{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:l,...c}=e,u=tv(tu,n);return(0,ep.jsx)(ta.Primitive.span,{...c,ref:t,onKeyDown:(0,e7.composeEventHandlers)(e.onKeyDown,e=>{"Home"===e.key?(o(e),e.preventDefault()):"End"===e.key?(s(e),e.preventDefault()):ts.concat(tl).includes(e.key)&&(l(e),e.preventDefault())}),onPointerDown:(0,e7.composeEventHandlers)(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),u.thumbs.has(t)?t.focus():r(e)}),onPointerMove:(0,e7.composeEventHandlers)(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&i(e)}),onPointerUp:(0,e7.composeEventHandlers)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),a(e))})})}),tk="SliderTrack",tC=em.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=tv(tk,n);return(0,ep.jsx)(ta.Primitive.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:t})});tC.displayName=tk;var tE="SliderRange",t_=em.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,i=tv(tE,n),a=tb(tE,n),o=em.useRef(null),s=(0,e9.useComposedRefs)(t,o),l=i.values.length,c=i.values.map(e=>tM(e,i.min,i.max)),u=l>1?Math.min(...c):0,d=100-Math.max(...c);return(0,ep.jsx)(ta.Primitive.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:s,style:{...e.style,[a.startEdge]:u+"%",[a.endEdge]:d+"%"}})});t_.displayName=tE;var tS="SliderThumb",tT=em.forwardRef((e,t)=>{let n=th(e.__scopeSlider),[r,i]=em.useState(null),a=(0,e9.useComposedRefs)(t,e=>i(e)),o=em.useMemo(()=>r?n().findIndex(e=>e.ref.current===r):-1,[n,r]);return(0,ep.jsx)(tA,{...e,ref:a,index:o})}),tA=em.forwardRef((e,t)=>{var n,r,i,a,o;let s,l,{__scopeSlider:c,index:u,name:d,...h}=e,f=tv(tS,c),p=tb(tS,c),[g,v]=em.useState(null),x=(0,e9.useComposedRefs)(t,e=>v(e)),y=!g||f.form||!!g.closest("form"),b=(0,ti.useSize)(g),w=f.values[u],j=void 0===w?0:tM(w,f.min,f.max),N=(n=u,(r=f.values.length)>2?`Value ${n+1} of ${r}`:2===r?["Minimum","Maximum"][n]:void 0),k=b?.[p.size],C=k?(i=k,a=j,o=p.direction,l=tP([0,50],[0,s=i/2]),(s-l(a)*o)*o):0;return em.useEffect(()=>{if(g)return f.thumbs.add(g),()=>{f.thumbs.delete(g)}},[g,f.thumbs]),(0,ep.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[p.startEdge]:`calc(${j}% + ${C}px)`},children:[(0,ep.jsx)(td.ItemSlot,{scope:e.__scopeSlider,children:(0,ep.jsx)(ta.Primitive.span,{role:"slider","aria-label":e["aria-label"]||N,"aria-valuemin":f.min,"aria-valuenow":w,"aria-valuemax":f.max,"aria-orientation":f.orientation,"data-orientation":f.orientation,"data-disabled":f.disabled?"":void 0,tabIndex:f.disabled?void 0:0,...h,ref:x,style:void 0===w?{display:"none"}:e.style,onFocus:(0,e7.composeEventHandlers)(e.onFocus,()=>{f.valueIndexToChangeRef.current=u})})}),y&&(0,ep.jsx)(tO,{name:d??(f.name?f.name+(f.values.length>1?"[]":""):void 0),form:f.form,value:w},u)]})});tT.displayName=tS;var tO=em.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{let i=em.useRef(null),a=(0,e9.useComposedRefs)(i,r),o=(0,tr.usePrevious)(t);return em.useEffect(()=>{let e=i.current;if(!e)return;let n=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;if(o!==t&&n){let r=new Event("input",{bubbles:!0});n.call(e,t),e.dispatchEvent(r)}},[o,t]),(0,ep.jsx)(ta.Primitive.input,{style:{display:"none"},...n,ref:a,defaultValue:t})});function tM(e,t,n){return(0,e8.clamp)(100/(n-t)*(e-t),[0,100])}function tP(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}tO.displayName="RadioBubbleInput";let tD=em.forwardRef(({className:e,...t},n)=>(0,ep.jsxs)(tx,{ref:n,className:(0,eA.cn)("relative flex w-full touch-none select-none items-center",e),...t,children:[(0,ep.jsx)(tC,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary/50 border border-border",children:(0,ep.jsx)(t_,{className:"absolute h-full bg-primary"})}),(0,ep.jsx)(tT,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));tD.displayName=tx.displayName;var tL=e.i(22757),tI=e.i(53489);let tR=(0,ej.default)("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);function tB({tags:e,size:t="sm",showLabel:n=!1}){if(!e||0===e.length)return null;let r="xs"===t?"text-[10px] px-1.5 py-0.5 rounded gap-0.5":"md"===t?"text-sm px-3 py-1 rounded-full gap-1 font-medium":"text-xs px-2 py-0.5 rounded-md gap-1 font-medium";return(0,ep.jsxs)("div",{children:[n&&(0,ep.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2 flex items-center gap-1",children:[(0,ep.jsx)(tR,{className:"w-3 h-3"}),"Tags"]}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.map((e,t)=>(0,ep.jsxs)("span",{className:`inline-flex items-center ${r} bg-primary/10 text-primary border border-primary/20 leading-none`,children:[(0,ep.jsx)("span",{className:"opacity-50 select-none font-mono",children:"#"}),e]},t))})]})}let tz=(0,ej.default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var tF=e.i(43531),tV=e.i(37727),tU=e.i(17521),tU=tU;let tH=(0,ej.default)("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);var tW=e.i(76223);function tY({type:e,id:t,onClose:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(null),[o,s]=(0,em.useState)(!1),[l,c]=(0,em.useState)(null);(0,em.useEffect)(()=>{t&&(async()=>{s(!0),c(null);try{if("document"===e){if(!r)return void c("No bank selected");let e=await eP.client.getDocument(t,r);a(e)}else{let e=await eP.client.getChunk(t);a(e)}}catch(t){console.error(`Error loading ${e}:`,t),c(t.message)}finally{s(!1)}})()},[t,e,r]);let u=null!==t;return(0,ep.jsx)(tW.Dialog,{open:u,onOpenChange:e=>!e&&n(),children:(0,ep.jsxs)(tW.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[(0,ep.jsxs)(tW.DialogHeader,{children:[(0,ep.jsx)(tW.DialogTitle,{children:"document"===e?"Document Details":"Chunk Details"}),(0,ep.jsx)(tW.DialogDescription,{children:"document"===e?"View the original document text and metadata":"View the chunk text and metadata"})]}),(0,ep.jsx)("div",{className:"flex-1 overflow-y-auto",children:o?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ep.jsxs)("div",{className:"text-sm text-muted-foreground",children:["Loading ",e,"..."]})]})}):l?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center text-destructive",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"❌"}),(0,ep.jsxs)("div",{className:"text-sm",children:["Error: ",l]})]})}):i?(0,ep.jsx)("div",{className:"space-y-4",children:"document"===e?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Document ID"}),(0,ep.jsx)("div",{className:"text-sm font-mono break-all text-foreground",children:i.id})]}),i.created_at&&(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Created"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:new Date(i.created_at).toLocaleString()})]}),(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Memory Units"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:i.memory_unit_count})]})]}),i.original_text&&(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Text Length"}),(0,ep.jsxs)("div",{className:"text-sm text-foreground",children:[i.original_text.length.toLocaleString()," characters"]})]})]}),i.original_text&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-bold text-foreground mb-2",children:"Original Text"}),(0,ep.jsx)("div",{className:"p-4 bg-muted rounded-lg border border-border max-h-[300px] overflow-y-auto",children:(0,ep.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono text-foreground",children:i.original_text})})]})]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Chunk ID"}),(0,ep.jsx)("div",{className:"text-sm font-mono break-all text-foreground",children:i.chunk_id})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Document ID"}),(0,ep.jsx)("div",{className:"text-sm font-mono break-all text-foreground",children:i.document_id})]}),(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Chunk Index"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:i.chunk_index})]})]}),i.created_at&&(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Created"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:new Date(i.created_at).toLocaleString()})]}),i.chunk_text&&(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Text Length"}),(0,ep.jsxs)("div",{className:"text-sm text-foreground",children:[i.chunk_text.length.toLocaleString()," characters"]})]})]}),i.chunk_text&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-bold text-foreground mb-2",children:"Chunk Text"}),(0,ep.jsx)("div",{className:"p-4 bg-muted rounded-lg border border-border max-h-[300px] overflow-y-auto",children:(0,ep.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono text-foreground",children:i.chunk_text})})]})]})}):null})]})})}var tG=e.i(63738),tU=tU;let t$=(0,ej.default)("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);function tX({before:e,after:t}){let n=function(e,t){let n=e.split(/(\s+)/),r=t.split(/(\s+)/),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=n[e-1]===r[t-1]?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=i,l=a,c=[];for(;s>0||l>0;)s>0&&l>0&&n[s-1]===r[l-1]?(c.push({type:"same",text:n[s-1]}),s--,l--):l>0&&(0===s||o[s][l-1]>=o[s-1][l])?(c.push({type:"added",text:r[l-1]}),l--):(c.push({type:"removed",text:n[s-1]}),s--);return c.reverse()}(e,t);return n.some(e=>"same"!==e.type)?(0,ep.jsx)("span",{className:"text-sm leading-relaxed",children:n.map((e,t)=>"same"===e.type?(0,ep.jsx)("span",{children:e.text},t):"removed"===e.type?(0,ep.jsx)("span",{className:"bg-red-500/15 text-red-700 dark:text-red-400 line-through rounded-sm px-0.5",children:e.text},t):(0,ep.jsx)("span",{className:"bg-green-500/15 text-green-700 dark:text-green-400 rounded-sm px-0.5",children:e.text},t))}):(0,ep.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"unchanged"})}function tq({before:e,after:t}){let n=e.filter(e=>!t.includes(e)),r=t.filter(t=>!e.includes(t)),i=e.filter(e=>t.includes(e));return 0===n.length&&0===r.length?(0,ep.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"unchanged"}):(0,ep.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[i.map((e,t)=>(0,ep.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md bg-amber-500/10 text-amber-700 border border-amber-500/20 font-mono",children:["#",e]},t)),n.map((e,t)=>(0,ep.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md bg-red-500/15 text-red-700 dark:text-red-400 border border-red-500/20 font-mono line-through",children:["#",e]},t)),r.map((e,t)=>(0,ep.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md bg-green-500/15 text-green-700 dark:text-green-400 border border-green-500/20 font-mono",children:["+#",e]},t))]})}function tK({label:e,before:t,after:n}){return t||n?(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e,": "]}),t!==n?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{className:"text-xs bg-red-500/15 text-red-700 dark:text-red-400 line-through rounded-sm px-0.5",children:t?new Date(t).toLocaleString():"—"})," → ",(0,ep.jsx)("span",{className:"text-xs bg-green-500/15 text-green-700 dark:text-green-400 rounded-sm px-0.5",children:n?new Date(n).toLocaleString():"—"})]}):(0,ep.jsx)("span",{className:"text-xs",children:n?new Date(n).toLocaleString():"—"})]}):null}function tZ({fact:e}){let t="experience"===e.type?"bg-green-500/10 text-green-700 dark:text-green-400":"bg-blue-500/10 text-blue-700 dark:text-blue-400";return(0,ep.jsxs)("div",{className:`p-2 rounded border space-y-1 ${e.is_new?"border-green-500/40 bg-green-500/5":"border-border/50 bg-muted/30"}`,children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[e.type&&(0,ep.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium flex-shrink-0 ${t}`,children:e.type}),e.is_new&&(0,ep.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-green-500/15 text-green-700 dark:text-green-400 border border-green-500/30",children:"new"}),e.context&&(0,ep.jsx)("span",{className:"text-[10px] text-muted-foreground italic truncate",children:e.context})]}),e.text?(0,ep.jsx)("p",{className:"text-xs text-foreground leading-relaxed",children:e.text}):(0,ep.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"(memory no longer available)"})]})}function tQ({history:e,current:t}){let n=[...e].reverse(),[r,i]=(0,em.useState)(0),a=n[r],o=0===r,s=o?t.text:n[r-1].previous_text,l=o?t.tags:n[r-1].previous_tags,c=o?t.occurred_start:n[r-1].previous_occurred_start,u=o?t.occurred_end:n[r-1].previous_occurred_end,d=o?t.mentioned_at:n[r-1].previous_mentioned_at;return(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Change ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:e.length-r})," of"," ",e.length," · ",new Date(a.changed_at).toLocaleString()]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:r===n.length-1,onClick:()=>i(r+1),children:(0,ep.jsx)(e_,{className:"h-3.5 w-3.5"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:0===r,onClick:()=>i(r-1),children:(0,ep.jsx)(eS.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),(0,ep.jsxs)("div",{className:"border border-border rounded-lg p-3 space-y-3",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Text"}),(0,ep.jsx)(tX,{before:a.previous_text,after:s})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Tags"}),(0,ep.jsx)(tq,{before:a.previous_tags,after:l})]}),(0,ep.jsxs)("div",{className:"space-y-1",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Dates"}),(0,ep.jsx)(tK,{label:"Occurred start",before:a.previous_occurred_start,after:c}),(0,ep.jsx)(tK,{label:"Occurred end",before:a.previous_occurred_end,after:u}),(0,ep.jsx)(tK,{label:"Mentioned at",before:a.previous_mentioned_at,after:d})]}),a.source_facts&&a.source_facts.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:["Source Facts (",a.source_facts.length,")"]}),(0,ep.jsx)("div",{className:"space-y-1.5",children:a.source_facts.map(e=>(0,ep.jsx)(tZ,{fact:e},e.id))})]})]})]})}function tJ({memoryId:e,onClose:t,initialTab:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(null),[o,s]=(0,em.useState)(!1),[l,c]=(0,em.useState)(null),[u,d]=(0,em.useState)(n??"memory"),[h,f]=(0,em.useState)(null),[p,g]=(0,em.useState)(null),[v,x]=(0,em.useState)(!1),[y,b]=(0,em.useState)(!1),[w,j]=(0,em.useState)(null),[N,k]=(0,em.useState)(!1),[C,E]=(0,em.useState)(null);(0,em.useEffect)(()=>{e&&r&&(async()=>{s(!0),c(null),a(null),f(null),g(null),j(null),d(n??"memory");try{let t=await eP.client.getMemory(e,r);a(t)}catch(e){console.error("Error loading memory:",e),c(e.message)}finally{s(!1)}})()},[e,r]),(0,em.useEffect)(()=>{"history"===u&&i&&"observation"===i.type&&r&&null===w&&(async()=>{k(!0);try{let e=await eP.client.getObservationHistory(i.id,r);j(e)}catch(e){console.error("Error loading history:",e),j([])}finally{k(!1)}})()},[u,i,r,w]),(0,em.useEffect)(()=>{"document"===u&&i?.document_id&&r&&!h&&(async()=>{x(!0);try{let e=await eP.client.getDocument(i.document_id,r);f(e)}catch(e){console.error("Error loading document:",e)}finally{x(!1)}})()},[u,i?.document_id,r,h]),(0,em.useEffect)(()=>{"chunk"!==u||!i?.chunk_id||p||(async()=>{b(!0);try{let e=await eP.client.getChunk(i.chunk_id);g(e)}catch(e){console.error("Error loading chunk:",e)}finally{b(!1)}})()},[u,i?.chunk_id,p]);let _=null!==e,S=i?.type==="observation";return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tW.Dialog,{open:_,onOpenChange:e=>!e&&t(),children:(0,ep.jsxs)(tW.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[(0,ep.jsx)(tW.DialogHeader,{children:(0,ep.jsx)(tW.DialogTitle,{children:i?i?.type==="observation"?"Observation":i?.type==="world"?"World Fact":i?.type==="experience"?"Experience":"Memory Details":"Memory Details"})}),o?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)(tU.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):l?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)("div",{className:"text-center text-destructive",children:(0,ep.jsxs)("div",{className:"text-sm",children:["Error: ",l]})})}):i?S?(0,ep.jsxs)(tG.Tabs,{value:u,onValueChange:d,className:"flex-1 flex flex-col overflow-hidden",children:[(0,ep.jsxs)(tG.TabsList,{className:"grid w-full grid-cols-2",children:[(0,ep.jsxs)(tG.TabsTrigger,{value:"memory",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),"Observation"]}),(0,ep.jsxs)(tG.TabsTrigger,{value:"history",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(tH,{className:"w-3.5 h-3.5"}),"History",w&&w.length>0?` (${w.length})`:""]})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,ep.jsxs)(tG.TabsContent,{value:"memory",className:"mt-0 space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Text"}),(0,ep.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:i.text})]}),i.occurred_start&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Occurred"}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,ep.jsx)(eI,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,ep.jsxs)("span",{children:[new Date(i.occurred_start).toLocaleString(),i.occurred_end&&i.occurred_end!==i.occurred_start&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{className:"text-muted-foreground mx-1",children:"→"}),new Date(i.occurred_end).toLocaleString()]})]})]})]}),i.mentioned_at&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Mentioned"}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,ep.jsx)(eI,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,ep.jsx)("span",{children:new Date(i.mentioned_at).toLocaleString()})]})]}),i.entities&&i.entities.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2 flex items-center gap-1",children:[(0,ep.jsx)(eE,{className:"w-3 h-3"}),"Entities"]}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.entities.map((e,t)=>(0,ep.jsx)("span",{className:"px-2 py-0.5 bg-primary/10 text-primary rounded text-xs",children:e},t))})]}),(0,ep.jsx)(tB,{tags:i.tags,showLabel:!0}),i.observation_scopes&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2 flex items-center gap-1",children:[(0,ep.jsx)(tR,{className:"w-3 h-3"}),"Observation Scopes"]}),"string"==typeof i.observation_scopes?(0,ep.jsx)("span",{className:"text-xs font-mono bg-muted px-1.5 py-0.5 rounded",children:i.observation_scopes}):(0,ep.jsx)("div",{className:"space-y-1.5",children:i.observation_scopes.map((e,t)=>(0,ep.jsx)(tB,{tags:e},t))})]}),i.source_memories&&i.source_memories.length>0&&(0,ep.jsxs)("div",{className:"border-t border-border pt-4",children:[(0,ep.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-3",children:["Source Memories (",i.source_memories.length,")"]}),(0,ep.jsx)("div",{className:"space-y-3",children:i.source_memories.map((e,t)=>(0,ep.jsxs)("div",{className:"p-3 bg-muted/50 rounded-lg border border-border/50",children:[(0,ep.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-xs flex-shrink-0 ${"experience"===e.type?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-blue-500/10 text-blue-600 dark:text-blue-400"}`,children:e.type}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",className:"h-6 text-xs",onClick:()=>E(e.id),children:"View"})]}),(0,ep.jsx)("p",{className:"text-sm text-foreground mb-2",children:e.text}),e.context&&(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground mb-2 italic",children:["Context: ",e.context]}),(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.occurred_start&&(0,ep.jsxs)("div",{className:"p-2 bg-background/50 rounded",children:[(0,ep.jsx)("div",{className:"text-muted-foreground mb-0.5",children:"Occurred"}),(0,ep.jsx)("div",{className:"font-medium",children:new Date(e.occurred_start).toLocaleString()})]}),e.mentioned_at&&(0,ep.jsxs)("div",{className:"p-2 bg-background/50 rounded",children:[(0,ep.jsx)("div",{className:"text-muted-foreground mb-0.5",children:"Mentioned"}),(0,ep.jsx)("div",{className:"font-medium",children:new Date(e.mentioned_at).toLocaleString()})]})]})]},e.id||t))})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Memory ID"}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:i.id})]})]}),(0,ep.jsx)(tG.TabsContent,{value:"history",className:"mt-0",children:N?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(tU.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):w&&w.length>0?(0,ep.jsx)(tQ,{history:w,current:{text:i.text,tags:i.tags,occurred_start:i.occurred_start,occurred_end:i.occurred_end,mentioned_at:i.mentioned_at}}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No history recorded yet."})})]})]}):(0,ep.jsxs)(tG.Tabs,{value:u,onValueChange:d,className:"flex-1 flex flex-col overflow-hidden",children:[(0,ep.jsxs)(tG.TabsList,{className:"grid w-full grid-cols-3",children:[(0,ep.jsxs)(tG.TabsTrigger,{value:"memory",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),"world"===i.type?"World Fact":"Experience"]}),(0,ep.jsxs)(tG.TabsTrigger,{value:"chunk",disabled:!i.chunk_id,className:"flex items-center gap-1.5",children:[(0,ep.jsx)(t$,{className:"w-3.5 h-3.5"}),"Chunk"]}),(0,ep.jsxs)(tG.TabsTrigger,{value:"document",disabled:!i.document_id,className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),"Document"]})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,ep.jsxs)(tG.TabsContent,{value:"memory",className:"mt-0 space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Text"}),(0,ep.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:i.text})]}),i.context&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Context"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:i.context})]}),i.occurred_start&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Occurred"}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,ep.jsx)(eI,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,ep.jsxs)("span",{children:[new Date(i.occurred_start).toLocaleString(),i.occurred_end&&i.occurred_end!==i.occurred_start&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{className:"text-muted-foreground mx-1",children:"→"}),new Date(i.occurred_end).toLocaleString()]})]})]})]}),i.mentioned_at&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Mentioned"}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,ep.jsx)(eI,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,ep.jsx)("span",{children:new Date(i.mentioned_at).toLocaleString()})]})]}),i.entities&&i.entities.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2 flex items-center gap-1",children:[(0,ep.jsx)(eE,{className:"w-3 h-3"}),"Entities"]}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.entities.map((e,t)=>(0,ep.jsx)("span",{className:"px-2 py-0.5 bg-primary/10 text-primary rounded text-xs",children:e},t))})]}),(0,ep.jsx)(tB,{tags:i.tags,showLabel:!0}),i.observation_scopes&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2 flex items-center gap-1",children:[(0,ep.jsx)(tR,{className:"w-3 h-3"}),"Observation Scopes"]}),"string"==typeof i.observation_scopes?(0,ep.jsx)("span",{className:"text-xs font-mono bg-muted px-1.5 py-0.5 rounded",children:i.observation_scopes}):(0,ep.jsx)("div",{className:"space-y-1.5",children:i.observation_scopes.map((e,t)=>(0,ep.jsx)(tB,{tags:e},t))})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Memory ID"}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:i.id})]})]}),(0,ep.jsx)(tG.TabsContent,{value:"chunk",className:"mt-0 space-y-4",children:y?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(tU.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):p?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Chunk Index"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:p.chunk_index})]}),p.chunk_text&&(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Text Length"}),(0,ep.jsxs)("div",{className:"text-sm text-foreground",children:[p.chunk_text.length.toLocaleString()," chars"]})]})]}),p.chunk_text&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Chunk Text"}),(0,ep.jsx)("div",{className:"p-4 bg-muted rounded-lg border border-border max-h-[300px] overflow-y-auto",children:(0,ep.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono text-foreground",children:p.chunk_text})})]}),(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Chunk ID"}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:p.chunk_id})]})]}):(0,ep.jsx)("div",{className:"text-center py-12 text-muted-foreground",children:"No chunk data available"})}),(0,ep.jsx)(tG.TabsContent,{value:"document",className:"mt-0 space-y-4",children:v?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(tU.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):h?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[h.created_at&&(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Created"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:new Date(h.created_at).toLocaleString()})]}),(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Memory Units"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:h.memory_unit_count})]})]}),h.original_text&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Text Length"}),(0,ep.jsxs)("div",{className:"text-sm text-foreground",children:[h.original_text.length.toLocaleString()," chars"]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Original Text"}),(0,ep.jsx)("div",{className:"p-4 bg-muted rounded-lg border border-border max-h-[300px] overflow-y-auto",children:(0,ep.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono text-foreground",children:h.original_text})})]})]}),h.tags&&h.tags.length>0&&(0,ep.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ep.jsx)(tB,{tags:h.tags,showLabel:!0})}),(0,ep.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Document ID"}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:h.id})]})]}):(0,ep.jsx)("div",{className:"text-center py-12 text-muted-foreground",children:"No document data available"})})]})]}):null]})}),C&&(0,ep.jsx)(tJ,{memoryId:C,onClose:()=>E(null)})]})}function t0({memory:e,onClose:t,compact:n=!1,inPanel:r=!1,bankId:i}){let a,[o,s]=(0,em.useState)(null),[l,c]=(0,em.useState)(null),[u,d]=(0,em.useState)(null),[h,f]=(0,em.useState)(null),[p,g]=(0,em.useState)(!1),[v,x]=(0,em.useState)(null),[y,b]=(0,em.useState)(!1);(0,em.useEffect)(()=>{let t=e?.id||e?.node_id;t&&i?(g(!0),eP.client.getMemory(t,i).then(e=>{f(e)}).catch(e=>{console.error("Failed to fetch memory details:",e),f(null)}).finally(()=>{g(!1)})):f(null)},[e?.id,e?.node_id,e?.fact_type,e?.type,i]);let w=h||e,j=w?.fact_type==="observation"||w?.type==="observation",N="observation"===(a=w?.fact_type||w?.type)?"Observation":"world"===a?"World Fact":"experience"===a?"Experience":"Memory Details",k=async e=>{try{await navigator.clipboard.writeText(e),s(e),setTimeout(()=>s(null),2e3)}catch(e){console.error("Failed to copy:",e)}},C=e=>{c("document"),d(e)},E=e=>{c("chunk"),d(e)},_=()=>{c(null),d(null)};if(!e)return null;let S=w.id||w.node_id,T=n?"text-[10px]":"text-xs",A=n?"text-xs":"text-sm";return r?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"p-5",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-foreground",children:N}),(0,ep.jsx)(eD.Button,{variant:"secondary",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:(0,ep.jsx)(tV.X,{className:"h-5 w-5"})})]}),p?(0,ep.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,ep.jsx)(tU.default,{className:"h-6 w-6 animate-spin text-muted-foreground"}),(0,ep.jsx)("span",{className:"ml-2 text-muted-foreground",children:"Loading memory details..."})]}):(0,ep.jsxs)("div",{className:"space-y-5",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Text"}),(0,ep.jsx)("div",{className:"text-sm whitespace-pre-wrap leading-relaxed text-foreground",children:w.text})]}),w.context&&!j&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Context"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:w.context})]}),w.occurred_start&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Occurred"}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,ep.jsx)(eI,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,ep.jsxs)("span",{children:[new Date(w.occurred_start).toLocaleString(),w.occurred_end&&w.occurred_end!==w.occurred_start&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{className:"text-muted-foreground mx-1",children:"→"}),new Date(w.occurred_end).toLocaleString()]})]})]})]}),w.mentioned_at&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Mentioned"}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,ep.jsx)(eI,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,ep.jsx)("span",{children:new Date(w.mentioned_at).toLocaleString()})]})]}),w.entities&&(Array.isArray(w.entities)?w.entities.length>0:w.entities)&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-3",children:"Entities"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:(Array.isArray(w.entities)?w.entities:String(w.entities).split(", ")).map((e,t)=>{let n="string"==typeof e?e:e?.name||JSON.stringify(e);return(0,ep.jsx)("span",{className:"text-sm px-3 py-1.5 rounded-full bg-primary/10 text-primary font-medium",children:n},t)})})]}),(0,ep.jsx)(tB,{tags:w.tags,size:"md",showLabel:!0}),w.source_memories&&w.source_memories.length>0&&(0,ep.jsxs)("div",{className:"border-t border-border pt-5",children:[(0,ep.jsxs)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-3",children:["Source Memories (",w.source_memories.length,")"]}),(0,ep.jsx)("div",{className:"space-y-3",children:w.source_memories.map((e,t)=>(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg border border-border/50",children:[(0,ep.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-xs flex-shrink-0 ${"experience"===e.type?"bg-green-500/10 text-green-600":"bg-blue-500/10 text-blue-600"}`,children:e.type}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",className:"h-6 text-xs",onClick:()=>x(e.id),children:"View"})]}),(0,ep.jsx)("p",{className:"text-sm text-foreground mb-3",children:e.text}),e.context&&(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground mb-3 italic",children:["Context: ",e.context]}),(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[(0,ep.jsxs)("div",{className:"p-2 bg-background/50 rounded",children:[(0,ep.jsx)("div",{className:"text-muted-foreground mb-0.5",children:"Occurred"}),(0,ep.jsx)("div",{className:"font-medium",children:e.occurred_start?new Date(e.occurred_start).toLocaleString():"N/A"})]}),(0,ep.jsxs)("div",{className:"p-2 bg-background/50 rounded",children:[(0,ep.jsx)("div",{className:"text-muted-foreground mb-0.5",children:"Mentioned"}),(0,ep.jsx)("div",{className:"font-medium",children:e.mentioned_at?new Date(e.mentioned_at).toLocaleString():"N/A"})]})]})]},e.id||t))})]}),(w.document_id||w.chunk_id)&&(0,ep.jsxs)("div",{className:"flex gap-3 pt-2",children:[w.document_id&&(0,ep.jsx)(eD.Button,{onClick:()=>C(w.document_id),variant:"secondary",className:"flex-1",children:"View Document"}),w.chunk_id&&(0,ep.jsx)(eD.Button,{onClick:()=>E(w.chunk_id),variant:"secondary",className:"flex-1",children:"View Chunk"})]}),j&&(0,ep.jsx)("div",{className:"border-t border-border pt-5",children:(0,ep.jsxs)(eD.Button,{variant:"outline",className:"w-full flex items-center gap-2",onClick:()=>b(!0),children:[(0,ep.jsx)(tH,{className:"h-4 w-4"}),"View History"]})}),S&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Memory ID"}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground",children:S}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>k(S),children:o===S?(0,ep.jsx)(tF.Check,{className:"h-3 w-3 text-green-600"}):(0,ep.jsx)(tz,{className:"h-3 w-3 text-muted-foreground"})})]})]})]})]}),l&&u&&(0,ep.jsx)(tY,{type:l,id:u,onClose:_}),(0,ep.jsx)(tJ,{memoryId:v,onClose:()=>x(null)}),y&&S&&i&&(0,ep.jsx)(tJ,{memoryId:S,onClose:()=>b(!1),initialTab:"history"})]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:`bg-card border-2 border-primary rounded-lg ${n?"p-3":"p-4"} sticky top-4 max-h-[calc(100vh-120px)] overflow-y-auto`,children:[(0,ep.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,ep.jsx)("h3",{className:`${n?"text-sm":"text-lg"} font-bold text-card-foreground`,children:N}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",onClick:t,className:n?"h-6 w-6 p-0":"h-8 w-8 p-0",children:(0,ep.jsx)(tV.X,{className:n?"h-3 w-3":"h-4 w-4"})})]}),p?(0,ep.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,ep.jsx)(tU.default,{className:"h-5 w-5 animate-spin text-muted-foreground"}),(0,ep.jsx)("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading..."})]}):(0,ep.jsxs)("div",{className:n?"space-y-2":"space-y-4",children:[(0,ep.jsxs)("div",{className:`${n?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,ep.jsx)("div",{className:`${T} font-bold text-muted-foreground uppercase mb-1`,children:"Text"}),(0,ep.jsx)("div",{className:`${A} whitespace-pre-wrap`,children:w.text})]}),w.context&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:`${T} font-bold text-muted-foreground uppercase mb-1`,children:"Context"}),(0,ep.jsx)("div",{className:A,children:w.context})]}),w.occurred_start&&(0,ep.jsxs)("div",{className:`${n?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,ep.jsx)("div",{className:`${T} font-bold text-muted-foreground uppercase mb-1`,children:"Occurred"}),(0,ep.jsxs)("div",{className:`flex items-center gap-2 ${A}`,children:[(0,ep.jsx)(eI,{className:`${n?"h-3 w-3":"h-4 w-4"} text-muted-foreground flex-shrink-0`}),(0,ep.jsxs)("span",{children:[new Date(w.occurred_start).toLocaleString(),w.occurred_end&&w.occurred_end!==w.occurred_start&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{className:"text-muted-foreground mx-1",children:"→"}),new Date(w.occurred_end).toLocaleString()]})]})]})]}),w.mentioned_at&&(0,ep.jsxs)("div",{className:`${n?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,ep.jsx)("div",{className:`${T} font-bold text-muted-foreground uppercase mb-1`,children:"Mentioned"}),(0,ep.jsxs)("div",{className:`flex items-center gap-2 ${A}`,children:[(0,ep.jsx)(eI,{className:`${n?"h-3 w-3":"h-4 w-4"} text-muted-foreground flex-shrink-0`}),(0,ep.jsx)("span",{children:new Date(w.mentioned_at).toLocaleString()})]})]}),w.entities&&(Array.isArray(w.entities)?w.entities.length>0:w.entities)&&(0,ep.jsxs)("div",{className:`${n?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,ep.jsx)("div",{className:`${T} font-bold text-muted-foreground uppercase mb-2`,children:"Entities"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:(Array.isArray(w.entities)?w.entities:String(w.entities).split(", ")).map((e,t)=>{let r="string"==typeof e?e:e?.name||JSON.stringify(e);return(0,ep.jsx)("span",{className:`${n?"text-[10px] px-1.5 py-0.5":"text-xs px-2 py-1"} rounded bg-secondary text-secondary-foreground`,children:r},t)})})]}),w.tags&&w.tags.length>0&&(0,ep.jsxs)("div",{className:`${n?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,ep.jsx)("div",{className:`${T} font-bold text-muted-foreground uppercase mb-2`,children:"Tags"}),(0,ep.jsx)(tB,{tags:w.tags,size:n?"xs":"sm"})]}),(w.document_id||w.chunk_id)&&(0,ep.jsxs)("div",{className:`flex gap-2 ${n?"pt-1":""}`,children:[w.document_id&&(0,ep.jsx)(eD.Button,{onClick:()=>C(w.document_id),size:"sm",variant:"secondary",className:`flex-1 ${n?"h-7 text-xs":""}`,children:"View Document"}),w.chunk_id&&(0,ep.jsx)(eD.Button,{onClick:()=>E(w.chunk_id),size:"sm",variant:"secondary",className:`flex-1 ${n?"h-7 text-xs":""}`,children:"View Chunk"})]}),w.source_memories&&w.source_memories.length>0&&(0,ep.jsxs)("div",{className:`${n?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,ep.jsxs)("div",{className:`${T} font-bold text-muted-foreground uppercase mb-2`,children:["Source Memories (",w.source_memories.length,")"]}),(0,ep.jsx)("div",{className:"space-y-2",children:w.source_memories.map((e,t)=>(0,ep.jsxs)("div",{className:"p-2 bg-background/50 rounded border border-border/50",children:[(0,ep.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-1",children:[(0,ep.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] flex-shrink-0 ${"experience"===e.type?"bg-green-500/10 text-green-600":"bg-blue-500/10 text-blue-600"}`,children:e.type}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",className:"h-5 text-[10px] px-2",onClick:()=>x(e.id),children:"View"})]}),(0,ep.jsx)("p",{className:`${A} mb-1`,children:e.text}),e.context&&(0,ep.jsxs)("p",{className:"text-[10px] text-muted-foreground italic",children:["Context: ",e.context]})]},e.id||t))})]}),S&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:`${T} font-bold text-muted-foreground uppercase mb-1`,children:"Memory ID"}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("code",{className:`${n?"text-[9px]":"text-xs"} font-mono text-muted-foreground`,children:S}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",className:`${n?"h-4 w-4":"h-5 w-5"} p-0`,onClick:()=>k(S),children:o===S?(0,ep.jsx)(tF.Check,{className:`${n?"h-2.5 w-2.5":"h-3 w-3"} text-green-600`}):(0,ep.jsx)(tz,{className:`${n?"h-2.5 w-2.5":"h-3 w-3"} text-muted-foreground`})})]})]})]})]}),l&&u&&(0,ep.jsx)(tY,{type:l,id:u,onClose:_}),(0,ep.jsx)(tJ,{memoryId:v,onClose:()=>x(null)})]})}function t1(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t2(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function t5(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,t7(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function t3(e,t){var n="u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ne(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function t4(e,t,n){return(t=t7(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t6(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return s}}(e,t)||ne(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t8(e){return function(e){if(Array.isArray(e))return t1(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ne(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t7(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function t9(e){return(t9="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ne(e,t){if(e){if("string"==typeof e)return t1(e,t);var n=({}).toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t1(e,t):void 0}}var nt="u"<typeof window?null:window,nn=nt?nt.navigator:null;nt&&nt.document;var nr=t9(""),ni=t9({}),na=t9(function(){}),no="u"<typeof HTMLElement?"undefined":t9(HTMLElement),ns=function(e){return e&&e.instanceString&&nc(e.instanceString)?e.instanceString():null},nl=function(e){return null!=e&&t9(e)==nr},nc=function(e){return null!=e&&t9(e)===na},nu=function(e){return!np(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},nd=function(e){return null!=e&&t9(e)===ni&&!nu(e)&&e.constructor===Object},nh=function(e){return null!=e&&t9(e)===t9(1)&&!isNaN(e)},nf=function(e){if("undefined"!==no)return null!=e&&e instanceof HTMLElement},np=function(e){return nm(e)||ng(e)},nm=function(e){return"collection"===ns(e)&&e._private.single},ng=function(e){return"collection"===ns(e)&&!e._private.single},nv=function(e){return"core"===ns(e)},nx=function(e){return"stylesheet"===ns(e)},ny=function(e){return null==e||!!(""===e||e.match(/^\s+$/))},nb=function(e){return null!=e&&t9(e)===ni&&nc(e.then)},nw=function(e,t){t||(t=function(){if(1==arguments.length)return arguments[0];if(0==arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var n=function(){var r,i=arguments,a=t.apply(this,i),o=n.cache;return(r=o[a])||(r=o[a]=e.apply(this,i)),r};return n.cache={},n},nj=nw(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),nN=nw(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),nk=nw(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),nC=function(e){return ny(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},nE=function(e,t){return e.slice(-1*t.length)===t},n_="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",nS="rgb[a]?\\(("+n_+"[%]?)\\s*,\\s*("+n_+"[%]?)\\s*,\\s*("+n_+"[%]?)(?:\\s*,\\s*("+n_+"))?\\)",nT="rgb[a]?\\((?:"+n_+"[%]?)\\s*,\\s*(?:"+n_+"[%]?)\\s*,\\s*(?:"+n_+"[%]?)(?:\\s*,\\s*(?:"+n_+"))?\\)",nA="hsl[a]?\\(("+n_+")\\s*,\\s*("+n_+"[%])\\s*,\\s*("+n_+"[%])(?:\\s*,\\s*("+n_+"))?\\)",nO="hsl[a]?\\((?:"+n_+")\\s*,\\s*(?:"+n_+"[%])\\s*,\\s*(?:"+n_+"[%])(?:\\s*,\\s*(?:"+n_+"))?\\)",nM=function(e,t){return e<t?-1:+(e>t)},nP=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(null!=r)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e},nD=function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,n,r;return 4===e.length?(t=parseInt(e[1]+e[1],16),n=parseInt(e[2]+e[2],16),r=parseInt(e[3]+e[3],16)):(t=parseInt(e[1]+e[2],16),n=parseInt(e[3]+e[4],16),r=parseInt(e[5]+e[6],16)),[t,n,r]}},nL=function(e){function t(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var n,r,i,a,o,s,l,c,u=RegExp("^"+nA+"$").exec(e);if(u){if((r=parseInt(u[1]))<0?r=(360- -1*r%360)%360:r>360&&(r%=360),r/=360,(i=parseFloat(u[2]))<0||i>100||(i/=100,(a=parseFloat(u[3]))<0||a>100)||(a/=100,void 0!==(o=u[4])&&((o=parseFloat(o))<0||o>1)))return;if(0===i)s=l=c=Math.round(255*a);else{var d=a<.5?a*(1+i):a+i-a*i,h=2*a-d;s=Math.round(255*t(h,d,r+1/3)),l=Math.round(255*t(h,d,r)),c=Math.round(255*t(h,d,r-1/3))}n=[s,l,c,o]}return n},nI=function(e){var t,n=RegExp("^"+nS+"$").exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if("%"===a[a.length-1]&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t},nR=function(e){return(nu(e)?e:null)||nB[e.toLowerCase()]||nD(e)||nI(e)||nL(e)},nB={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},nz=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(nd(a))throw Error("Tried to set map with object key");i<n.length-1?(null==t[a]&&(t[a]={}),t=t[a]):t[a]=e.value}},nF=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(nd(a))throw Error("Tried to get map with object key");if(null==(t=t[a]))break}return t},nV="u">typeof globalThis?globalThis:"u">typeof window?window:e.g;function nU(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function nH(){return lD?lP:(lD=1,lP=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)})}function nW(){if(lB)return lR;lB=1;var e=lI?lL:(lI=1,lL="object"==typeof nV&&nV&&nV.Object===Object&&nV),t="object"==typeof self&&self&&self.Object===Object&&self;return lR=e||t||Function("return this")()}function nY(){return lG?lY:(lG=1,lY=nW().Symbol)}function nG(){if(lQ)return lZ;lQ=1;var e=nY(),t=function(){if(lX)return l$;lX=1;var e=nY(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;return l$=function(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch(e){}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}}(),n=function(){if(lK)return lq;lK=1;var e=Object.prototype.toString;return lq=function(t){return e.call(t)}}(),r=e?e.toStringTag:void 0;return lZ=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?t(e):n(e)}}function n$(){if(l2)return l1;l2=1;var e=nG(),t=l0?lJ:(l0=1,lJ=function(e){return null!=e&&"object"==typeof e});return l1=function(n){return"symbol"==typeof n||t(n)&&"[object Symbol]"==e(n)}}var nX=nU(function(){if(l6)return l4;l6=1;var e=nH(),t=function(){if(lF)return lz;lF=1;var e=nW();return lz=function(){return e.Date.now()}}(),n=function(){if(l3)return l5;l3=1;var e=function(){if(lW)return lH;lW=1;var e=function(){if(lU)return lV;lU=1;var e=/\s/;return lV=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}}(),t=/^\s+/;return lH=function(n){return n?n.slice(0,e(n)+1).replace(t,""):n}}(),t=nH(),n=n$(),r=0/0,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;return l5=function(l){if("number"==typeof l)return l;if(n(l))return r;if(t(l)){var c="function"==typeof l.valueOf?l.valueOf():l;l=t(c)?c+"":c}if("string"!=typeof l)return 0===l?l:+l;l=e(l);var u=a.test(l);return u||o.test(l)?s(l.slice(2),u?2:8):i.test(l)?r:+l}}(),r=Math.max,i=Math.min;return l4=function(a,o,s){var l,c,u,d,h,f,p=0,g=!1,v=!1,x=!0;if("function"!=typeof a)throw TypeError("Expected a function");function y(e){var t=l,n=c;return l=c=void 0,p=e,d=a.apply(n,t)}function b(e){var t=e-f,n=e-p;return void 0===f||t>=o||t<0||v&&n>=u}function w(){var e,n,r,a=t();if(b(a))return j(a);h=setTimeout(w,(e=a-f,n=a-p,r=o-e,v?i(r,u-n):r))}function j(e){return(h=void 0,x&&l)?y(e):(l=c=void 0,d)}function N(){var e,n=t(),r=b(n);if(l=arguments,c=this,f=n,r){if(void 0===h)return p=e=f,h=setTimeout(w,o),g?y(e):d;if(v)return clearTimeout(h),h=setTimeout(w,o),y(f)}return void 0===h&&(h=setTimeout(w,o)),d}return o=n(o)||0,e(s)&&(g=!!s.leading,u=(v="maxWait"in s)?r(n(s.maxWait)||0,o):u,x="trailing"in s?!!s.trailing:x),N.cancel=function(){void 0!==h&&clearTimeout(h),p=0,l=f=c=h=void 0},N.flush=function(){return void 0===h?d:j(t())},N}}()),nq=nt?nt.performance:null,nK=nq&&nq.now?function(){return nq.now()}:function(){return Date.now()},nZ=function(){if(nt){if(nt.requestAnimationFrame)return function(e){nt.requestAnimationFrame(e)};else if(nt.mozRequestAnimationFrame)return function(e){nt.mozRequestAnimationFrame(e)};else if(nt.webkitRequestAnimationFrame)return function(e){nt.webkitRequestAnimationFrame(e)};else if(nt.msRequestAnimationFrame)return function(e){nt.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(nK())},1e3/60)}}(),nQ=function(e){return nZ(e)},nJ=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,r=n;!(t=e.next()).done;)r=65599*r+t.value|0;return r},n0=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return 65599*t+e|0},n1=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},n2=function(e){return 2097152*e[0]+e[1]},n5=function(e,t){return[n0(e[0],t[0]),n1(e[1],t[1])]},n3=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return nJ({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)},n4=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return nJ({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},n6=function(){return n8(arguments)},n8=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=0===n?n4(r):n4(r,t)}return t},n7=!0,n9=null!=console.warn,re=null!=console.trace,rt=Number.MAX_SAFE_INTEGER||0x1fffffffffffff,rn=function(){return!0},rr=function(){return!1},ri=function(){return 0},ra=function(){},ro=function(e){throw Error(e)},rs=function(e){if(void 0===e)return n7;n7=!!e},rl=function(e){rs()&&(n9?console.warn(e):(console.log(e),re&&console.trace()))},rc=function(e){return null==e?e:nu(e)?e.slice():nd(e)?nP({},e):e},ru=function(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t},rd={},rh=function(){return rd},rf=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=null==n?void 0:n[a];r[a]=void 0===o?e[a]:o}return r}},rp=function(e,t,n){for(var r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},rm=function(e){e.splice(0,e.length)},rg=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},rv=function(e,t,n){return n&&(t=nk(n,t)),e[t]},rx=function(e,t,n,r){n&&(t=nk(n,t)),e[t]=r},ry=t5(function e(){t2(this,e),this._obj={}},[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),rb="u">typeof Map?Map:ry,rw=t5(function e(t){if(t2(this,e),this._obj=Object.create(null),this.size=0,null!=t){var n;n=null!=t.instanceString&&t.instanceString()===this.instanceString()?t.toArray():t;for(var r=0;r<n.length;r++)this.add(n[r])}},[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;1!==t[e]&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;1===t[e]&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return 1===this._obj[e]}},{key:"toArray",value:function(){var e=this;return Object.keys(this._obj).filter(function(t){return e.has(t)})}},{key:"forEach",value:function(e,t){return this.toArray().forEach(e,t)}}]),rj=("u"<typeof Set?"undefined":t9(Set))!=="undefined"?Set:rw,rN=function(e,t){var n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(void 0===e||void 0===t||!nv(e))return void ro("An element must have a core reference and parameters set");var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"!==r&&"edges"!==r)return void ro("An element must be of type `nodes` or `edges`; you specified `"+r+"`");this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new rj,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];nu(t.classes)?l=t.classes:nl(t.classes)&&(l=t.classes.split(/\s+/));for(var c=0,u=l.length;c<u;c++){var d=l[c];d&&""!==d&&i.classes.add(d)}this.createEmitter(),(void 0===n||n)&&this.restore();var h=t.style||t.css;h&&(rl("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h))},rk=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){nd(t)&&!np(t)&&(t=(i=t).roots||i.root,n=i.visit,r=i.directed),r=2!=arguments.length||nc(n)?r:n,n=nc(n)?n:function(){};for(var i,a,o,s=this._private.cy,l=t=nl(t)?this.filter(t):t,c=[],u=[],d={},h={},f={},p=0,g=this.byGroup(),v=g.nodes,x=g.edges,y=0;y<l.length;y++){var b=l[y],w=b.id();b.isNode()&&(c.unshift(b),e.bfs&&(f[w]=!0,u.push(b)),h[w]=0)}for(;0!==c.length&&(0===(o=function(){var t,i=e.bfs?c.shift():c.pop(),o=i.id();if(e.dfs){if(f[o])return 0;f[o]=!0,u.push(i)}var s=h[o],l=d[o],g=null!=l?l.source():null,y=null!=l?l.target():null,b=null==l?void 0:i.same(g)?y[0]:g[0];if(!0===(t=n(i,l,b,p++,s)))return a=i,1;if(!1===t)return 1;for(var w=i.connectedEdges().filter(function(e){return(!r||e.source().same(i))&&x.has(e)}),j=0;j<w.length;j++){var N=w[j],k=N.connectedNodes().filter(function(e){return!e.same(i)&&v.has(e)}),C=k.id();0===k.length||f[C]||(k=k[0],c.push(k),e.bfs&&(f[C]=!0,u.push(k)),d[C]=N,h[C]=h[o]+1)}}())||1!==o););for(var j=s.collection(),N=0;N<u.length;N++){var k=u[N],C=d[k.id()];null!=C&&j.push(C),j.push(k)}return{path:s.collection(j),found:s.collection(a)}}},rC={breadthFirstSearch:rk({bfs:!0}),depthFirstSearch:rk({dfs:!0})};rC.bfs=rC.breadthFirstSearch,rC.dfs=rC.depthFirstSearch;var rE={exports:{}},r_=rE.exports,rS=nU(l9?l7:(l9=1,l7=function(){return l8?rE.exports:(l8=1,(function(){var e,t,n,r,i,a,o,s,l,c,u,d,h,f;t=Math.floor,l=Math.min,e=function(e,t){return e<t?-1:+(e>t)},s=function(n,r,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=e),i<0)throw Error("lo must be non-negative");for(null==a&&(a=n.length);i<a;)0>o(r,n[s=t((i+a)/2)])?a=s:i=s+1;return[].splice.apply(n,[i,i-i].concat(r)),r},i=function(t,n,r){return null==r&&(r=e),t.push(n),h(t,0,t.length-1,r)},r=function(t,n){var r,i;return null==n&&(n=e),r=t.pop(),t.length?(i=t[0],t[0]=r,f(t,0,n)):i=r,i},o=function(t,n,r){var i;return null==r&&(r=e),i=t[0],t[0]=n,f(t,0,r),i},a=function(t,n,r){var i;return null==r&&(r=e),t.length&&0>r(t[0],n)&&(n=(i=[t[0],n])[0],t[0]=i[1],f(t,0,r)),n},n=function(n,r){var i,a,o,s,l,c;for(null==r&&(r=e),s=(function(){c=[];for(var e=0,r=t(n.length/2);0<=r?e<r:e>r;0<=r?e++:e--)c.push(e);return c}).apply(this).reverse(),l=[],a=0,o=s.length;a<o;a++)i=s[a],l.push(f(n,i,r));return l},d=function(t,n,r){var i;if(null==r&&(r=e),-1!==(i=t.indexOf(n)))return h(t,0,i,r),f(t,i,r)},c=function(t,r,i){var o,s,l,c;if(null==i&&(i=e),!(o=t.slice(0,r)).length)return o;for(n(o,i),s=0,l=(c=t.slice(r)).length;s<l;s++)a(o,c[s],i);return o.sort(i).reverse()},u=function(t,i,a){var o,c,u,d,h,f,p,g,v;if(null==a&&(a=e),10*i<=t.length){if(!(u=t.slice(0,i).sort(a)).length)return u;for(d=0,c=u[u.length-1],f=(p=t.slice(i)).length;d<f;d++)0>a(o=p[d],c)&&(s(u,o,0,null,a),u.pop(),c=u[u.length-1]);return u}for(n(t,a),v=[],h=0,g=l(i,t.length);0<=g?h<g:h>g;0<=g?++h:--h)v.push(r(t,a));return v},h=function(t,n,r,i){var a,o,s;for(null==i&&(i=e),a=t[r];r>n;){if(0>i(a,o=t[s=r-1>>1])){t[r]=o,r=s;continue}break}return t[r]=a},f=function(t,n,r){var i,a,o,s,l;for(null==r&&(r=e),a=t.length,l=n,o=t[n],i=2*n+1;i<a;)(s=i+1)<a&&!(0>r(t[i],t[s]))&&(i=s),t[n]=t[i],i=2*(n=i)+1;return t[n]=o,h(t,l,n,r)},rE.exports=function(){function t(t){this.cmp=null!=t?t:e,this.nodes=[]}return t.push=i,t.pop=r,t.replace=o,t.pushpop=a,t.heapify=n,t.updateItem=d,t.nlargest=c,t.nsmallest=u,t.prototype.push=function(e){return i(this.nodes,e,this.cmp)},t.prototype.pop=function(){return r(this.nodes,this.cmp)},t.prototype.peek=function(){return this.nodes[0]},t.prototype.contains=function(e){return -1!==this.nodes.indexOf(e)},t.prototype.replace=function(e){return o(this.nodes,e,this.cmp)},t.prototype.pushpop=function(e){return a(this.nodes,e,this.cmp)},t.prototype.heapify=function(){return n(this.nodes,this.cmp)},t.prototype.updateItem=function(e){return d(this.nodes,e,this.cmp)},t.prototype.clear=function(){return this.nodes=[]},t.prototype.empty=function(){return 0===this.nodes.length},t.prototype.size=function(){return this.nodes.length},t.prototype.clone=function(){var e;return(e=new t).nodes=this.nodes.slice(0),e},t.prototype.toArray=function(){return this.nodes.slice(0)},t.prototype.insert=t.prototype.push,t.prototype.top=t.prototype.peek,t.prototype.front=t.prototype.peek,t.prototype.has=t.prototype.contains,t.prototype.copy=t.prototype.clone,t}()}).call(r_),rE.exports)}())),rT=rf({root:null,weight:function(e){return 1},directed:!1}),rA=rf({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),rO=rf({weight:function(e){return 1},directed:!1}),rM=rf({weight:function(e){return 1},directed:!1,root:null}),rP=Math.sqrt(2),rD=function(e,t,n){0===n.length&&ro("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n.length-1;l>=0;l--){var c=n[l],u=c[1],d=c[2];(t[u]===o&&t[d]===s||t[u]===s&&t[d]===o)&&n.splice(l,1)}for(var h=0;h<n.length;h++){var f=n[h];f[1]===s?(n[h]=f.slice(),n[h][1]=o):f[2]===s&&(n[h]=f.slice(),n[h][2]=o)}for(var p=0;p<t.length;p++)t[p]===s&&(t[p]=o);return n},rL=function(e,t,n,r){for(;n>r;)t=rD(Math.floor(Math.random()*t.length),e,t),n--;return t},rI=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},rR=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},rB=function(e){return{x:e[0],y:e[1]}},rz=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r},rF=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r},rV=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i},rU=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=!(arguments.length>5)||void 0===arguments[5]||arguments[5];r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?!isFinite(l)&&(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(e,t){return e-t});var c=e.length,u=Math.floor(c/2);return c%2!=0?e[u+1+o]:(e[u-1+o]+e[u+o])/2},rH=function(e,t){return Math.atan2(t,e)-Math.PI/2},rW=Math.log2||function(e){return Math.log(e)/Math.log(2)},rY=function(e){return e>0?1:e<0?-1:0},rG=function(e,t){return Math.sqrt(r$(e,t))},r$=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},rX=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},rq=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},rK=function(e,t,n,r){return{x:rq(e.x,t.x,n.x,r),y:rq(e.y,t.y,n.y,r)}},rZ=function(e,t,n,r){var i={x:t.x-e.x,y:t.y-e.y},a=rG(e,t),o={x:i.x/a,y:i.y/a};return n=null==n?0:n,r=null!=r?r:n*a,{x:e.x+o.x*r,y:e.y+o.y*r}},rQ=function(e,t,n){return Math.max(e,Math.min(n,t))},rJ=function(e){if(null==e)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(null!=e.x1&&null!=e.y1){if(null!=e.x2&&null!=e.y2&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};else if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},r0=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},r1=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},r2=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},r5=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},r3=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var o=t6(a,4);t=o[0],n=o[1],r=o[2],i=o[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},r4=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},r6=function(e,t){return!(e.x1>t.x2)&&!(t.x1>e.x2)&&!(e.x2<t.x1)&&!(t.x2<e.x1)&&!(e.y2<t.y1)&&!(t.y2<e.y1)&&!(e.y1>t.y2)&&!(t.y1>e.y2)&&!0},r8=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},r7=function(e,t){return r8(e,t.x,t.y)},r9=function(e,t){return r8(e,t.x1,t.y1)&&r8(e,t.x2,t.y2)},ie=null!=(ce=Math.hypot)?ce:function(e,t){return Math.sqrt(e*e+t*t)},it=function(e,t,n,r,i,a,o){var s,l,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",u="auto"===c?i_(i,a):c,d=i/2,h=a/2,f=(u=Math.min(u,d,h))!==d,p=u!==h;if(f){var g=n-d+u-o,v=r-h-o,x=n+d-u+o;if((s=iy(e,t,n,r,g,v,x,v,!1)).length>0)return s}if(p){var y=n+d+o,b=r-h+u-o,w=r+h-u+o;if((s=iy(e,t,n,r,y,b,y,w,!1)).length>0)return s}if(f){var j=n-d+u-o,N=r+h+o,k=n+d-u+o;if((s=iy(e,t,n,r,j,N,k,N,!1)).length>0)return s}if(p){var C=n-d-o,E=r-h+u-o,_=r+h-u+o;if((s=iy(e,t,n,r,C,E,C,_,!1)).length>0)return s}var S=n-d+u,T=r-h+u;if((l=iv(e,t,n,r,S,T,u+o)).length>0&&l[0]<=S&&l[1]<=T)return[l[0],l[1]];var A=n+d-u,O=r-h+u;if((l=iv(e,t,n,r,A,O,u+o)).length>0&&l[0]>=A&&l[1]<=O)return[l[0],l[1]];var M=n+d-u,P=r+h-u;if((l=iv(e,t,n,r,M,P,u+o)).length>0&&l[0]>=M&&l[1]>=P)return[l[0],l[1]];var D=n-d+u,L=r+h-u;return(l=iv(e,t,n,r,D,L,u+o)).length>0&&l[0]<=D&&l[1]>=L?[l[0],l[1]]:[]},ir=function(e,t,n,r,i,a,o){var s=Math.min(n,i),l=Math.max(n,i),c=Math.min(r,a),u=Math.max(r,a);return s-o<=e&&e<=l+o&&c-o<=t&&t<=u+o},ii=function(e,t,n,r,i,a,o,s,l){var c={x1:Math.min(n,o,i)-l,x2:Math.max(n,o,i)+l,y1:Math.min(r,s,a)-l,y2:Math.max(r,s,a)+l};return!(e<c.x1)&&!(e>c.x2)&&!(t<c.y1)&&!(t>c.y2)},ia=function(e,t,n,r){var i=t*t-4*e*(n-=r);if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},io=function(e,t,n,r,i){var a,o,s,l,c,u,d,h;if(0===e&&(e=1e-5),t/=e,n/=e,r/=e,a=(o=(3*n-t*t)/9)*o*o+(s=(-(27*r)+t*(9*n-t*t*2))/54)*s,i[1]=0,d=t/3,a>0){c=(c=s+Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),u=(u=s-Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-d+c+u,d+=(c+u)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-u+c)/2,i[3]=d,i[5]=-d;return}if(i[5]=i[3]=0,0===a){h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=-d+2*h,i[4]=i[2]=-(h+d);return}l=Math.acos(s/Math.sqrt(l=(o=-o)*o*o)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(l/3),i[2]=-d+h*Math.cos((l+2*Math.PI)/3),i[4]=-d+h*Math.cos((l+4*Math.PI)/3)},is=function(e,t,n,r,i,a,o,s){var l,c=[];io(n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,c);for(var u=[],d=0;d<6;d+=2)1e-7>Math.abs(c[d+1])&&c[d]>=0&&c[d]<=1&&u.push(c[d]);u.push(1),u.push(0);for(var h=-1,f=0;f<u.length;f++)l=Math.pow(Math.pow(1-u[f],2)*n+2*(1-u[f])*u[f]*i+u[f]*u[f]*o-e,2)+Math.pow(Math.pow(1-u[f],2)*r+2*(1-u[f])*u[f]*a+u[f]*u[f]*s-t,2),h>=0?l<h&&(h=l):h=l;return h},il=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-r],l=s[0]*s[0]+s[1]*s[1],c=o[0]*o[0]+o[1]*o[1],u=o[0]*s[0]+o[1]*s[1],d=u*u/l;return u<0?c:d>l?(e-i)*(e-i)+(t-a)*(t-a):c-d},ic=function(e,t,n){for(var r,i,a,o,s=0,l=0;l<n.length/2;l++)if(r=n[2*l],i=n[2*l+1],l+1<n.length/2?(a=n[(l+1)*2],o=n[(l+1)*2+1]):(a=n[(l+1-n.length/2)*2],o=n[(l+1-n.length/2)*2+1]),r==e&&a==e);else{if((!(r>=e)||!(e>=a))&&(!(r<=e)||!(e<=a)))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},iu=function(e,t,n,r,i,a,o,s,l){var c,u=Array(n.length);null!=s[0]?(c=Math.atan(s[1]/s[0]),s[0]<0?c+=Math.PI/2:c=-c-Math.PI/2):c=s;for(var d=Math.cos(-c),h=Math.sin(-c),f=0;f<u.length/2;f++)u[2*f]=a/2*(n[2*f]*d-n[2*f+1]*h),u[2*f+1]=o/2*(n[2*f+1]*d+n[2*f]*h),u[2*f]+=r,u[2*f+1]+=i;return ic(e,t,l>0?ih(ip(u,-l)):u)},id=function(e,t,n,r,i,a,o,s){for(var l=Array(2*n.length),c=0;c<s.length;c++){var u=s[c];if(l[4*c+0]=u.startX,l[4*c+1]=u.startY,l[4*c+2]=u.stopX,l[4*c+3]=u.stopY,Math.pow(u.cx-e,2)+Math.pow(u.cy-t,2)<=Math.pow(u.radius,2))return!0}return ic(e,t,l)},ih=function(e){for(var t,n,r,i,a,o,s,l,c=Array(e.length/2),u=0;u<e.length/4;u++){t=e[4*u],n=e[4*u+1],r=e[4*u+2],i=e[4*u+3],u<e.length/4-1?(a=e[(u+1)*4],o=e[(u+1)*4+1],s=e[(u+1)*4+2],l=e[(u+1)*4+3]):(a=e[0],o=e[1],s=e[2],l=e[3]);var d=iy(t,n,r,i,a,o,s,l,!0);c[2*u]=d[0],c[2*u+1]=d[1]}return c},ip=function(e,t){for(var n,r,i,a,o=Array(2*e.length),s=0;s<e.length/2;s++){n=e[2*s],r=e[2*s+1],s<e.length/2-1?(i=e[(s+1)*2],a=e[(s+1)*2+1]):(i=e[0],a=e[1]);var l=a-r,c=-(i-n),u=Math.sqrt(l*l+c*c),d=l/u,h=c/u;o[4*s]=n+d*t,o[4*s+1]=r+h*t,o[4*s+2]=i+d*t,o[4*s+3]=a+h*t}return o},im=function(e,t,n,r,i,a){var o=n-e,s=r-t,l=Math.sqrt((o/=i)*o+(s/=a)*s),c=l-1;if(c<0)return[];var u=c/l;return[(n-e)*u+e,(r-t)*u+t]},ig=function(e,t,n,r,i,a,o){return e-=i,t-=a,(e/=n/2+o)*e+(t/=r/2+o)*t<=1},iv=function(e,t,n,r,i,a,o){var s=[n-e,r-t],l=[e-i,t-a],c=s[0]*s[0]+s[1]*s[1],u=2*(l[0]*s[0]+l[1]*s[1]),d=u*u-4*c*(l[0]*l[0]+l[1]*l[1]-o*o);if(d<0)return[];var h=(-u+Math.sqrt(d))/(2*c),f=(-u-Math.sqrt(d))/(2*c),p=Math.min(h,f),g=Math.max(h,f),v=[];if(p>=0&&p<=1&&v.push(p),g>=0&&g<=1&&v.push(g),0===v.length)return[];var x=v[0]*s[0]+e,y=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[x,y]:[x,y,v[1]*s[0]+e,v[1]*s[1]+t]:[x,y]},ix=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},iy=function(e,t,n,r,i,a,o,s,l){var c=e-i,u=n-e,d=o-i,h=t-a,f=r-t,p=s-a,g=d*h-p*c,v=u*h-f*c,x=p*u-d*f;if(0!==x){var y=g/x,b=v/x;return -.001<=y&&y<=1.001&&-.001<=b&&b<=1.001||l?[e+y*u,t+y*f]:[]}return 0!==g&&0!==v?[]:ix(e,n,o)===o?[o,s]:ix(e,n,i)===i?[i,a]:ix(i,o,n)===n?[n,r]:[]},ib=function(e,t,n,r,i){var a=[],o=r/2,s=i/2;a.push({x:t+o*e[0],y:n+s*e[1]});for(var l=1;l<e.length/2;l++)a.push({x:t+o*e[2*l],y:n+s*e[2*l+1]});return a},iw=function(e,t,n,r,i,a,o,s){var l,c,u,d,h,f,p=[],g=Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var x=0;x<g.length/2;x++)g[2*x]=n[2*x]*a+r,g[2*x+1]=n[2*x+1]*o+i;c=s>0?ih(ip(g,-s)):g}else c=n;for(var y=0;y<c.length/2;y++)u=c[2*y],d=c[2*y+1],y<c.length/2-1?(h=c[(y+1)*2],f=c[(y+1)*2+1]):(h=c[0],f=c[1]),0!==(l=iy(e,t,r,i,u,d,h,f)).length&&p.push(l[0],l[1]);return p},ij=function(e,t,n,r,i,a,o,s,l){var c,u=[],d=Array(2*n.length);l.forEach(function(n,a){0===a?(d[d.length-2]=n.startX,d[d.length-1]=n.startY):(d[4*a-2]=n.startX,d[4*a-1]=n.startY),d[4*a]=n.stopX,d[4*a+1]=n.stopY,0!==(c=iv(e,t,r,i,n.cx,n.cy,n.radius)).length&&u.push(c[0],c[1])});for(var h=0;h<d.length/4;h++)0!==(c=iy(e,t,r,i,d[4*h],d[4*h+1],d[4*h+2],d[4*h+3],!1)).length&&u.push(c[0],c[1]);if(u.length>2){for(var f=[u[0],u[1]],p=Math.pow(f[0]-e,2)+Math.pow(f[1]-t,2),g=1;g<u.length/2;g++){var v=Math.pow(u[2*g]-e,2)+Math.pow(u[2*g+1]-t,2);v<=p&&(f[0]=u[2*g],f[1]=u[2*g+1],p=v)}return f}return u},iN=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},ik=function(e,t){var n=iE(e,t);return iC(n)},iC=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var c=2/(o-i),u=2/(s-a),d=0;d<r;d++)t=e[2*d]=e[2*d]*c,n=e[2*d+1]=e[2*d+1]*u,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var h=0;h<r;h++)n=e[2*h+1]=e[2*h+1]+(-1-a);return e},iE=function(e,t){var n,r=1/e*2*Math.PI,i=e%2==0?Math.PI/2+r/2:Math.PI/2;i+=t;for(var a=Array(2*e),o=0;o<e;o++)n=o*r+i,a[2*o]=Math.cos(n),a[2*o+1]=Math.sin(-n);return a},i_=function(e,t){return Math.min(e/4,t/4,8)},iS=function(e,t){return Math.min(e/10,t/10,8)},iT=function(){return 8},iA=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function iO(e,t){function n(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length],a={x:i.x-r.x,y:i.y-r.y},o={x:-a.y,y:a.x},s=Math.sqrt(o.x*o.x+o.y*o.y);t.push({x:o.x/s,y:o.y/s})}return t}function r(e,t){var n,r=1/0,i=-1/0,a=t3(e);try{for(a.s();!(n=a.n()).done;){var o=n.value,s=o.x*t.x+o.y*t.y;r=Math.min(r,s),i=Math.max(i,s)}}catch(e){a.e(e)}finally{a.f()}return{min:r,max:i}}var i,a=t3([].concat(t8(n(e)),t8(n(t))));try{for(a.s();!(i=a.n()).done;){var o=i.value,s=r(e,o),l=r(t,o);if(s.max<l.min||l.max<s.min)return!1}}catch(e){a.e(e)}finally{a.f()}return!0}var iM=rf({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),iP=rf({root:null,weight:function(e){return 1},directed:!1,alpha:0}),iD={degreeCentralityNormalized:function(e){e=iP(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,l=0;l<r;l++){var c=n[l],u=c.id();e.root=c;var d=this.degreeCentrality(e);o<d.indegree&&(o=d.indegree),s<d.outdegree&&(s=d.outdegree),i[u]=d.indegree,a[u]=d.outdegree}return{indegree:function(e){return 0==o?0:(nl(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return 0===s?0:(nl(e)&&(e=t.filter(e)),a[e.id()]/s)}}}for(var h={},f=0,p=0;p<r;p++){var g=n[p];e.root=g;var v=this.degreeCentrality(e);f<v.degree&&(f=v.degree),h[g.id()]=v.degree}return{degree:function(e){return 0===f?0:(nl(e)&&(e=t.filter(e)),h[e.id()]/f)}}},degreeCentrality:function(e){e=iP(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var l=i.connectedEdges(),c=l.filter(function(e){return e.target().same(i)&&n.has(e)}),u=l.filter(function(e){return e.source().same(i)&&n.has(e)}),d=c.length,h=u.length,f=0,p=0,g=0;g<c.length;g++)f+=a(c[g]);for(var v=0;v<u.length;v++)p+=a(u[v]);return{indegree:Math.pow(d,1-s)*Math.pow(f,s),outdegree:Math.pow(h,1-s)*Math.pow(p,s)}}for(var x=i.connectedEdges().intersection(n),y=x.length,b=0,w=0;w<x.length;w++)b+=a(x[w]);return{degree:Math.pow(y,1-s)*Math.pow(b,s)}}};iD.dc=iD.degreeCentrality,iD.dcn=iD.degreeCentralityNormalised=iD.degreeCentralityNormalized;var iL=rf({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),iI={closenessCentralityNormalized:function(e){for(var t=iL(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,l=this.nodes(),c=this.floydWarshall({weight:r,directed:i}),u=0;u<l.length;u++){for(var d=0,h=l[u],f=0;f<l.length;f++)if(u!==f){var p=c.distance(h,l[f]);n?d+=1/p:d+=p}n||(d=1/d),s<d&&(s=d),o[h.id()]=d}return{closeness:function(e){return 0==s?0:o[e=nl(e)?a.filter(e)[0].id():e.id()]/s}}},closenessCentrality:function(e){var t=iL(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,l=this.nodes(),c=0;c<l.length;c++){var u=l[c];if(!u.same(n)){var d=o.distanceTo(u);a?s+=1/d:s+=d}}return a?s:1/s}};iI.cc=iI.closenessCentrality,iI.ccn=iI.closenessCentralityNormalised=iI.closenessCentralityNormalized;var iR=rf({weight:null,directed:!1}),iB={betweennessCentrality:function(e){for(var t=iR(e),n=t.directed,r=t.weight,i=null!=r,a=this.cy(),o=this.nodes(),s={},l={},c=0,u=function(e,t){l[e]=t,t>c&&(c=t)},d=function(e){return l[e]},h=0;h<o.length;h++){var f=o[h],p=f.id();n?s[p]=f.outgoers().nodes():s[p]=f.openNeighborhood().nodes(),u(p,0)}for(var g=0;g<o.length;g++)!function(){for(var e=o[g].id(),t=[],n={},l={},c={},h=new rS(function(e,t){return c[e]-c[t]}),f=0;f<o.length;f++){var p=o[f].id();n[p]=[],l[p]=0,c[p]=1/0}for(l[e]=1,c[e]=0,h.push(e);!h.empty();){var v=h.pop();if(t.push(v),i)for(var x=0;x<s[v].length;x++){var y=s[v][x],b=a.getElementById(v),w=r(b.edgesTo(y).length>0?b.edgesTo(y)[0]:y.edgesTo(b)[0]);c[y=y.id()]>c[v]+w&&(c[y]=c[v]+w,0>h.nodes.indexOf(y)?h.push(y):h.updateItem(y),l[y]=0,n[y]=[]),c[y]==c[v]+w&&(l[y]=l[y]+l[v],n[y].push(v))}else for(var j=0;j<s[v].length;j++){var N=s[v][j].id();c[N]==1/0&&(h.push(N),c[N]=c[v]+1),c[N]==c[v]+1&&(l[N]=l[N]+l[v],n[N].push(v))}}for(var k={},C=0;C<o.length;C++)k[o[C].id()]=0;for(;t.length>0;){for(var E=t.pop(),_=0;_<n[E].length;_++){var S=n[E][_];k[S]=k[S]+l[S]/l[E]*(1+k[E])}E!=o[g].id()&&u(E,d(E)+k[E])}}();var v={betweenness:function(e){return d(a.collection(e).id())},betweennessNormalized:function(e){return 0==c?0:d(a.collection(e).id())/c}};return v.betweennessNormalised=v.betweennessNormalized,v}};iB.bc=iB.betweennessCentrality;var iz=rf({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),iF=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},iV=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},iU=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},iH=function(e,t,n){for(var r=Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},iW=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=iH(e,r,t);return e},iY=function(e,t,n){for(var r=Array(t*t),i=0;i<t*t;i++)r[i]=Math.pow(e[i],n);return iU(r,t),r},iG=function(e,t,n,r){for(var i=0;i<n;i++)if(Math.round(e[i]*Math.pow(10,r))/Math.pow(10,r)!=Math.round(t[i]*Math.pow(10,r))/Math.pow(10,r))return!1;return!0},i$=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(1e3*e[a*t+s])/1e3>0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i},iX=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},iq=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&iX(e[t],e[n])&&e.splice(n,1);return e},iK=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=iz(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s,l=t.length,c=l*l,u=Array(c),d=0;d<c;d++)u[d]=0;for(var h=0;h<n.length;h++){var f=n[h],p=a[f.source().id()],g=a[f.target().id()],v=iF(f,i.attributes);u[p*l+g]+=v,u[g*l+p]+=v}iV(u,l,i.multFactor),iU(u,l);for(var x=!0,y=0;x&&y<i.maxIterations;)x=!1,iG(u=iY(s=iW(u,l,i.expandFactor),l,i.inflateFactor),s,c,4)||(x=!0),y++;var b=i$(u,l,t,r);return iq(b)},iZ=function(e){return e},iQ=function(e,t){return Math.abs(t-e)},iJ=function(e,t,n){return e+iQ(t,n)},i0=function(e,t,n){return e+Math.pow(n-t,2)},i1=function(e){return Math.sqrt(e)},i2=function(e,t,n){return Math.max(e,iQ(t,n))},i5=function(e,t,n,r,i){for(var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:iZ,o=r,s=0;s<e;s++)o=i(o,t(s),n(s));return a(o)},i3={euclidean:function(e,t,n){return e>=2?i5(e,t,n,0,i0,i1):i5(e,t,n,0,iJ)},squaredEuclidean:function(e,t,n){return i5(e,t,n,0,i0)},manhattan:function(e,t,n){return i5(e,t,n,0,iJ)},max:function(e,t,n){return i5(e,t,n,-1/0,i2)}};function i4(e,t,n,r,i,a){var o;return(o=nc(e)?e:i3[e]||i3.euclidean,0===t&&nc(e))?o(i,a):o(t,n,r,i,a)}i3["squared-euclidean"]=i3.squaredEuclidean,i3.squaredeuclidean=i3.squaredEuclidean;var i6=rf({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),i8=function(e){return i6(e)},i7=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)};return i4(e,r.length,a,function(e){return r[e](t)},n,t)},i9=function(e,t,n){for(var r=n.length,i=Array(r),a=Array(r),o=Array(t),s=null,l=0;l<r;l++)i[l]=e.min(n[l]).value,a[l]=e.max(n[l]).value;for(var c=0;c<t;c++){s=[];for(var u=0;u<r;u++)s[u]=Math.random()*(a[u]-i[u])+i[u];o[c]=s}return o},ae=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var l=i7(n,e,t[s],r,i);l<a&&(a=l,o=s)}return o},at=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)n[(i=t[a]).id()]===e&&r.push(i);return r},an=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++)if(Math.abs(e[r][i]-t[r][i])>n)return!1;return!0},ar=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},ai=function(e,t){var n=Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];ar(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},aa=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=i7("manhattan",t[i],e,n,"kMedoids");return r},ao=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)r[s][l]=Math.pow(n[s][l],i.m);for(var c=0;c<e.length;c++)for(var u=0;u<i.attributes.length;u++){a=0,o=0;for(var d=0;d<t.length;d++)a+=r[d][c]*i.attributes[u](t[d]),o+=r[d][c];e[c][u]=a/o}},as=function(e,t,n,r,i){for(var a,o=0;o<e.length;o++)t[o]=e[o].slice();for(var s=2/(i.m-1),l=0;l<n.length;l++)for(var c=0;c<r.length;c++){a=0;for(var u=0;u<n.length;u++)a+=Math.pow(i7(i.distance,r[c],n[l],i.attributes,"cmeans")/i7(i.distance,r[c],n[u],i.attributes,"cmeans"),s);e[c][l]=1/a}},al=function(e,t,n,r){for(var i,a,o=Array(n.k),s=0;s<o.length;s++)o[s]=[];for(var l=0;l<t.length;l++){i=-1/0,a=-1;for(var c=0;c<t[0].length;c++)t[l][c]>i&&(i=t[l][c],a=c);o[a].push(e[l])}for(var u=0;u<o.length;u++)o[u]=r.collection(o[u]);return o},ac=function(e){var t,n,r,i,a=this.cy(),o=this.nodes(),s=i8(e);r=Array(o.length);for(var l=0;l<o.length;l++)r[l]=Array(s.k);n=Array(o.length);for(var c=0;c<o.length;c++)n[c]=Array(s.k);for(var u=0;u<o.length;u++){for(var d=0,h=0;h<s.k;h++)n[u][h]=Math.random(),d+=n[u][h];for(var f=0;f<s.k;f++)n[u][f]=n[u][f]/d}t=Array(s.k);for(var p=0;p<s.k;p++)t[p]=Array(s.attributes.length);i=Array(o.length);for(var g=0;g<o.length;g++)i[g]=Array(s.k);for(var v=!0,x=0;v&&x<s.maxIterations;)v=!1,ao(t,o,n,i,s),as(n,r,t,o,s),an(n,r,s.sensitivityThreshold)||(v=!0),x++;return{clusters:al(o,n,s,a),degreeOfMembership:n}},au=rf({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),ad={single:"min",complete:"max"},ah=function(e){var t=au(e),n=ad[t.linkage];return null!=n&&(t.linkage=n),t},af=function(e,t,n,r,i){for(var a,o,s=0,l=1/0,c=i.attributes,u=function(e,t){return i4(i.distance,c.length,function(t){return c[t](e)},function(e){return c[e](t)},e,t)},d=0;d<e.length;d++){var h=e[d].key,f=n[h][r[h]];f<l&&(s=h,l=f)}if("threshold"===i.mode&&l>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p=t[s],g=t[r[s]];o="dendrogram"===i.mode?{left:p,right:g,key:p.key}:{value:p.value.concat(g.value),key:p.key},e[p.index]=o,e.splice(g.index,1),t[p.key]=o;for(var v=0;v<e.length;v++){var x=e[v];p.key===x.key?a=1/0:"min"===i.linkage?(a=n[p.key][x.key],n[p.key][x.key]>n[g.key][x.key]&&(a=n[g.key][x.key])):"max"===i.linkage?(a=n[p.key][x.key],n[p.key][x.key]<n[g.key][x.key]&&(a=n[g.key][x.key])):a="mean"===i.linkage?(n[p.key][x.key]*p.size+n[g.key][x.key]*g.size)/(p.size+g.size):"dendrogram"===i.mode?u(x.value,p.value):u(x.value[0],p.value[0]),n[p.key][x.key]=n[x.key][p.key]=a}for(var y=0;y<e.length;y++){var b=e[y].key;if(r[b]===p.key||r[b]===g.key){for(var w=b,j=0;j<e.length;j++){var N=e[j].key;n[b][N]<n[b][w]&&(w=N)}r[b]=w}e[y].index=y}return p.key=g.key=p.index=g.index=null,!0},ap=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&ap(e.left,t),e.right&&ap(e.right,t)))},am=function(e,t){if(!e)return"";if(e.left&&e.right){var n=am(e.left,t),r=am(e.right,t),i=t.add({group:"nodes",data:{id:n+","+r}});return t.add({group:"edges",data:{source:n,target:i.id()}}),t.add({group:"edges",data:{source:r,target:i.id()}}),i.id()}if(e.value)return e.value.id()},ag=function(e,t,n){if(!e)return[];var r=[],i=[],a=[];if(0===t)return e.left&&ap(e.left,r),e.right&&ap(e.right,i),a=r.concat(i),[n.collection(a)];if(1===t)if(e.value)return[n.collection(e.value)];else return e.left&&ap(e.left,r),e.right&&ap(e.right,i),[n.collection(r),n.collection(i)];return e.value?[n.collection(e.value)]:(e.left&&(r=ag(e.left,t-1,n)),e.right&&(i=ag(e.right,t-1,n)),r.concat(i))},av=function(e){for(var t,n=this.cy(),r=this.nodes(),i=ah(e),a=i.attributes,o=function(e,t){return i4(i.distance,a.length,function(t){return a[t](e)},function(e){return a[e](t)},e,t)},s=[],l=[],c=[],u=[],d=0;d<r.length;d++){var h={value:"dendrogram"===i.mode?r[d]:[r[d]],key:d,index:d};s[d]=h,u[d]=h,l[d]=[],c[d]=0}for(var f=0;f<s.length;f++)for(var p=0;p<=f;p++){var g=void 0;g="dendrogram"===i.mode?f===p?1/0:o(s[f].value,s[p].value):f===p?1/0:o(s[f].value[0],s[p].value[0]),l[f][p]=g,l[p][f]=g,g<l[f][c[f]]&&(c[f]=p)}for(var v=af(s,u,l,c,i);v;)v=af(s,u,l,c,i);return"dendrogram"===i.mode?(t=ag(s[0],i.dendrogramDepth,n),i.addDendrogram&&am(s[0],n)):(t=Array(s.length),s.forEach(function(e,r){e.key=e.index=null,t[r]=n.collection(e.value)})),t},ax=rf({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),ay=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||ro("Damping must range on [0.5, 1). Got: ".concat(t));var r=["median","mean","min","max"];return r.some(function(e){return e===n})||nh(n)||ro("Preference must be one of [".concat(r.map(function(e){return"'".concat(e,"'")}).join(", "),"] or a number. Got: ").concat(n)),ax(e)},ab=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-i4(e,r.length,function(e){return i(t,e)},function(e){return i(n,e)},t,n)},aw=function(e,t){return"median"===t?rU(e):"mean"===t?rV(e):"min"===t?rz(e):"max"===t?rF(e):t},aj=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r},aN=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var l=n[s];t[i*e+l]>o&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var c=0;c<n.length;c++)r[n[c]]=n[c];return r},ak=function(e,t,n){for(var r=aN(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,l=-1/0,c=0;c<a.length;c++){for(var u=0,d=0;d<a.length;d++)u+=t[a[d]*e+a[c]];u>l&&(s=c,l=u)}n[i]=a[s]}return aN(e,t,n)},aC=function(e){for(var t,n,r,i,a,o,s,l=this.cy(),c=this.nodes(),u=ay(e),d={},h=0;h<c.length;h++)d[c[h].id()]=h;r=Array(n=(t=c.length)*t);for(var f=0;f<n;f++)r[f]=-1/0;for(var p=0;p<t;p++)for(var g=0;g<t;g++)p!==g&&(r[p*t+g]=ab(u.distance,c[p],c[g],u.attributes));i=aw(r,u.preference);for(var v=0;v<t;v++)r[v*t+v]=i;a=Array(n);for(var x=0;x<n;x++)a[x]=0;o=Array(n);for(var y=0;y<n;y++)o[y]=0;for(var b=Array(t),w=Array(t),j=Array(t),N=0;N<t;N++)b[N]=0,w[N]=0,j[N]=0;for(var k=Array(t*u.minIterations),C=0;C<k.length;C++)k[C]=0;for(s=0;s<u.maxIterations;s++){for(var E=0;E<t;E++){for(var _=-1/0,S=-1/0,T=-1,A=0,O=0;O<t;O++)b[O]=a[E*t+O],(A=o[E*t+O]+r[E*t+O])>=_?(S=_,_=A,T=O):A>S&&(S=A);for(var M=0;M<t;M++)a[E*t+M]=(1-u.damping)*(r[E*t+M]-_)+u.damping*b[M];a[E*t+T]=(1-u.damping)*(r[E*t+T]-S)+u.damping*b[T]}for(var P=0;P<t;P++){for(var D=0,L=0;L<t;L++)b[L]=o[L*t+P],w[L]=Math.max(0,a[L*t+P]),D+=w[L];D-=w[P],w[P]=a[P*t+P],D+=w[P];for(var I=0;I<t;I++)o[I*t+P]=(1-u.damping)*Math.min(0,D-w[I])+u.damping*b[I];o[P*t+P]=(1-u.damping)*(D-w[P])+u.damping*b[P]}for(var R=0,B=0;B<t;B++){var z=+(o[B*t+B]+a[B*t+B]>0);k[s%u.minIterations*t+B]=z,R+=z}if(R>0&&(s>=u.minIterations-1||s==u.maxIterations-1)){for(var F=0,V=0;V<t;V++){j[V]=0;for(var U=0;U<u.minIterations;U++)j[V]+=k[U*t+V];(0===j[V]||j[V]===u.minIterations)&&F++}if(F===t)break}}for(var H=aj(t,a,o),W=ak(t,r,H),Y={},G=0;G<H.length;G++)Y[H[G]]=[];for(var $=0;$<c.length;$++){var X=W[d[c[$].id()]];null!=X&&Y[X].push(c[$])}for(var q=Array(H.length),K=0;K<H.length;K++)q[K]=l.collection(Y[H[K]]);return q},aE=rf({root:void 0,directed:!1}),a_=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function(n,r){for(var o=a.length-1,s=[],l=e.spawn();a[o].x!=n||a[o].y!=r;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach(function(n){var r=n.connectedNodes().intersection(e);l.merge(n),r.forEach(function(n){var r=n.id(),i=n.connectedEdges().intersection(e);l.merge(n),t[r].cutVertex?l.merge(i.filter(function(e){return e.isLoop()})):l.merge(i)})}),i.push(l)},l=function(c,u,d){c===d&&(r+=1),t[u]={id:n,low:n++,cutVertex:!1};var h,f,p,g,v=e.getElementById(u).connectedEdges().intersection(e);0===v.size()?i.push(e.spawn(e.getElementById(u))):v.forEach(function(e){h=e.source().id(),f=e.target().id(),(p=h===u?f:h)!==d&&(o[g=e.id()]||(o[g]=!0,a.push({x:u,y:p,edge:e})),p in t?t[u].low=Math.min(t[u].low,t[p].id):(l(c,p,u),t[u].low=Math.min(t[u].low,t[p].low),t[u].id<=t[p].low&&(t[u].cutVertex=!0,s(u,p))))})};e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||(r=0,l(n,n),t[n].cutVertex=r>1)}});var c=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(c),components:i}},aS=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var l=e.spawn();;){var c=i.pop();if(l.merge(e.getElementById(c)),t[c].low=t[s].index,t[c].explored=!0,c===s)break}var u=l.edgesWith(l),d=l.merge(u);r.push(d),a=a.difference(d)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:a,components:r}},aT={};[rC,{dijkstra:function(e){if(!nd(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=rT(e),r=n.root,i=n.weight,a=n.directed,o=this,s=nl(r)?this.filter(r)[0]:r[0],l={},c={},u={},d=this.byGroup(),h=d.nodes,f=d.edges;f.unmergeBy(function(e){return e.isLoop()});for(var p=function(e){return l[e.id()]},g=new rS(function(e,t){return p(e)-p(t)}),v=0;v<h.length;v++){var x=h[v];l[x.id()]=x.same(s)?0:1/0,g.push(x)}for(;g.size()>0;){var y=g.pop(),b=p(y);if(u[y.id()]=b,b!==1/0)for(var w=y.neighborhood().intersect(h),j=0;j<w.length;j++){var N=w[j],k=N.id(),C=function(e,t){for(var n,r=(a?e.edgesTo(t):e.edgesWith(t)).intersect(f),o=1/0,s=0;s<r.length;s++){var l=r[s],c=i(l);(c<o||!n)&&(o=c,n=l)}return{edge:n,dist:o}}(y,N),E=b+C.dist;E<p(N)&&(l[N.id()]=E,g.updateItem(N),c[k]={node:y,edge:C.edge})}}return{distanceTo:function(e){return u[(nl(e)?h.filter(e)[0]:e[0]).id()]},pathTo:function(e){var t=nl(e)?h.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0)for(n.unshift(t);c[i];){var a=c[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},{kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=Array(i),o=function(e){for(var t=0;t<a.length;t++)if(a[t].has(e))return t},s=0;s<i;s++)a[s]=this.spawn(n[s]);for(var l=r.sort(function(t,n){return e(t)-e(n)}),c=0;c<l.length;c++){var u=l[c],d=u.source()[0],h=u.target()[0],f=o(d),p=o(h),g=a[f],v=a[p];f!==p&&(n.merge(u),g.merge(v),a.splice(p,1))}return n}},{aStar:function(e){var t,n,r=this.cy(),i=rA(e),a=i.root,o=i.goal,s=i.heuristic,l=i.directed,c=i.weight;a=r.collection(a)[0],o=r.collection(o)[0];var u=a.id(),d=o.id(),h={},f={},p={},g=new rS(function(e,t){return f[e.id()]-f[t.id()]}),v=new rj,x={},y={},b=function(e,t){g.push(e),v.add(t)};b(a,u),h[u]=0,f[u]=s(a);for(var w=0;g.size()>0;){if(n=(t=g.pop()).id(),v.delete(n),w++,n===d){for(var j=[],N=o,k=d,C=y[k];j.unshift(N),null!=C&&j.unshift(C),null!=(N=x[k]);)C=y[k=N.id()];return{found:!0,distance:h[n],path:this.spawn(j),steps:w}}p[n]=!0;for(var E=t._private.edges,_=0;_<E.length;_++){var S=E[_];if(this.hasElementWithId(S.id())&&(!l||S.data("source")===n)){var T=S.source(),A=S.target(),O=T.id()!==n?T:A,M=O.id();if(this.hasElementWithId(M)&&!p[M]){var P=h[n]+c(S);if(!v.has(M)){h[M]=P,f[M]=P+s(O),b(O,M),x[M]=t,y[M]=S;continue}P<h[M]&&(h[M]=P,f[M]=P+s(O),x[M]=t,y[M]=S)}}}}return{found:!1,distance:void 0,path:void 0,steps:w}}},{floydWarshall:function(e){for(var t=this.cy(),n=rO(e),r=n.weight,i=n.directed,a=this.byGroup(),o=a.nodes,s=a.edges,l=o.length,c=l*l,u=function(e){return o.indexOf(e)},d=function(e){return o[e]},h=Array(c),f=0;f<c;f++){var p=f%l;(f-p)/l===p?h[f]=0:h[f]=1/0}for(var g=Array(c),v=Array(c),x=0;x<s.length;x++){var y=s[x],b=y.source()[0],w=y.target()[0];if(b!==w){var j=u(b),N=u(w),k=j*l+N,C=r(y);if(h[k]>C&&(h[k]=C,g[k]=N,v[k]=y),!i){var E=N*l+j;!i&&h[E]>C&&(h[E]=C,g[E]=j,v[E]=y)}}}for(var _=0;_<l;_++)for(var S=0;S<l;S++)for(var T=S*l+_,A=0;A<l;A++){var O=S*l+A,M=_*l+A;h[T]+h[M]<h[O]&&(h[O]=h[T]+h[M],g[O]=g[T])}var P=function(e){return u((nl(e)?t.filter(e):e)[0])};return{distance:function(e,t){return h[P(e)*l+P(t)]},path:function(e,n){var r,i=P(e),a=P(n),o=d(i);if(i===a)return o.collection();if(null==g[i*l+a])return t.collection();var s=t.collection(),c=i;for(s.merge(o);i!==a;)c=i,i=g[i*l+a],r=v[c*l+i],s.merge(r),s.merge(d(i));return s}}}},{bellmanFord:function(e){var t=this,n=rM(e),r=n.weight,i=n.directed,a=n.root,o=this,s=this.cy(),l=this.byGroup(),c=l.edges,u=l.nodes,d=u.length,h=new rb,f=!1,p=[];a=s.collection(a)[0],c.unmergeBy(function(e){return e.isLoop()});for(var g=c.length,v=function(e){var t=h.get(e.id());return t||(t={},h.set(e.id(),t)),t},x=function(e){return(nl(e)?s.$(e):e)[0]},y=0;y<d;y++){var b=u[y],w=v(b);b.same(a)?w.dist=0:w.dist=1/0,w.pred=null,w.edge=null}for(var j=!1,N=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,j=!0)},k=1;k<d;k++){j=!1;for(var C=0;C<g;C++){var E=c[C],_=E.source(),S=E.target(),T=r(E),A=v(_),O=v(S);N(_,S,E,A,O,T),i||N(S,_,E,O,A,T)}if(!j)break}if(j)for(var M=[],P=0;P<g;P++){var D=c[P],L=D.source(),I=D.target(),R=r(D),B=v(L).dist,z=v(I).dist;if(B+R<z||!i&&z+R<B)if(f||(rl("Graph contains a negative weight cycle for Bellman-Ford"),f=!0),!1!==e.findNegativeWeightCycles){var F=[];B+R<z&&F.push(L),!i&&z+R<B&&F.push(I);for(var V=F.length,U=0;U<V;U++){var H=F[U],W=[H];W.push(v(H).edge);for(var Y=v(H).pred;-1===W.indexOf(Y);)W.push(Y),W.push(v(Y).edge),Y=v(Y).pred;for(var G=(W=W.slice(W.indexOf(Y)))[0].id(),$=0,X=2;X<W.length;X+=2)W[X].id()<G&&(G=W[X].id(),$=X);(W=W.slice($).concat(W.slice(0,$))).push(W[0]);var q=W.map(function(e){return e.id()}).join(",");-1===M.indexOf(q)&&(p.push(o.spawn(W)),M.push(q))}}else break}return{distanceTo:function(e){return v(x(e)).dist},pathTo:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,r=x(e),i=[],s=r;;){if(null==s)return t.spawn();var l=v(s),c=l.edge,u=l.pred;if(i.unshift(s[0]),s.same(n)&&i.length>0)break;null!=c&&i.unshift(c),s=u}return o.spawn(i)},hasNegativeWeightCycle:f,negativeWeightCycles:p}}},{kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(e){return e.isLoop()});var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/rP);if(i<2)return void ro("At least 2 nodes are required for Karger-Stein algorithm");for(var l=[],c=0;c<a;c++){var u=r[c];l.push([c,n.indexOf(u.source()),n.indexOf(u.target())])}for(var d=1/0,h=[],f=Array(i),p=Array(i),g=Array(i),v=function(e,t){for(var n=0;n<i;n++)t[n]=e[n]},x=0;x<=o;x++){for(var y=0;y<i;y++)p[y]=y;var b=rL(p,l.slice(),i,s),w=b.slice();v(p,g);var j=rL(p,b,s,2),N=rL(g,w,s,2);j.length<=N.length&&j.length<d?(d=j.length,h=j,v(p,f)):N.length<=j.length&&N.length<d&&(d=N.length,h=N,v(g,f))}for(var k=this.spawn(h.map(function(e){return r[e[0]]})),C=this.spawn(),E=this.spawn(),_=f[0],S=0;S<f.length;S++){var T=f[S],A=n[S];T===_?C.merge(A):E.merge(A)}var O=function(t){var n=e.spawn();return t.forEach(function(t){n.merge(t),t.connectedEdges().forEach(function(t){e.contains(t)&&!k.contains(t)&&n.merge(t)})}),n};return{cut:k,components:[O(C),O(E)],partition1:C,partition2:E}}},{pageRank:function(e){for(var t,n=iM(e),r=n.dampingFactor,i=n.precision,a=n.iterations,o=n.weight,s=this._private.cy,l=this.byGroup(),c=l.nodes,u=l.edges,d=c.length,h=d*d,f=u.length,p=Array(h),g=Array(d),v=(1-r)/d,x=0;x<d;x++){for(var y=0;y<d;y++)p[x*d+y]=0;g[x]=0}for(var b=0;b<f;b++){var w=u[b],j=w.data("source"),N=w.data("target");if(j!==N){var k=c.indexOfId(j),C=c.indexOfId(N),E=o(w),_=C*d+k;p[_]+=E,g[k]+=E}}for(var S=1/d+v,T=0;T<d;T++)if(0===g[T])for(var A=0;A<d;A++)p[A*d+T]=S;else for(var O=0;O<d;O++){var M=O*d+T;p[M]=p[M]/g[T]+v}for(var P=Array(d),D=Array(d),L=0;L<d;L++)P[L]=1;for(var I=0;I<a;I++){for(var R=0;R<d;R++)D[R]=0;for(var B=0;B<d;B++)for(var z=0;z<d;z++){var F=B*d+z;D[B]+=p[F]*P[z]}rX(D),t=P,P=D,D=t;for(var V=0,U=0;U<d;U++){var H=t[U]-P[U];V+=H*H}if(V<i)break}return{rank:function(e){return e=s.collection(e)[0],P[c.indexOf(e)]}}}},iD,iI,iB,{markovClustering:iK,mcl:iK},{kMeans:function(e){var t,n=this.cy(),r=this.nodes(),i=null,a=i8(e),o=Array(a.k),s={};a.testMode?"number"==typeof a.testCentroids?(a.testCentroids,t=i9(r,a.k,a.attributes)):t="object"===t9(a.testCentroids)?a.testCentroids:i9(r,a.k,a.attributes):t=i9(r,a.k,a.attributes);for(var l=!0,c=0;l&&c<a.maxIterations;){for(var u=0;u<r.length;u++)s[(i=r[u]).id()]=ae(i,t,a.distance,a.attributes,"kMeans");l=!1;for(var d=0;d<a.k;d++){var h=at(d,r,s);if(0!==h.length){for(var f=a.attributes.length,p=t[d],g=Array(f),v=Array(f),x=0;x<f;x++){v[x]=0;for(var y,b=0;b<h.length;b++)i=h[b],v[x]+=a.attributes[x](i);g[x]=v[x]/h.length,y=g[x],Math.abs(p[x]-y)<=a.sensitivityThreshold||(l=!0)}t[d]=g,o[d]=n.collection(h)}}c++}return o},kMedoids:function(e){var t,n,r=this.cy(),i=this.nodes(),a=null,o=i8(e),s=Array(o.k),l={},c=Array(o.k);o.testMode?"number"==typeof o.testCentroids||(t="object"===t9(o.testCentroids)?o.testCentroids:ai(i,o.k)):t=ai(i,o.k);for(var u=!0,d=0;u&&d<o.maxIterations;){for(var h=0;h<i.length;h++)l[(a=i[h]).id()]=ae(a,t,o.distance,o.attributes,"kMedoids");u=!1;for(var f=0;f<t.length;f++){var p=at(f,i,l);if(0!==p.length){c[f]=aa(t[f],p,o.attributes);for(var g=0;g<p.length;g++)(n=aa(p[g],p,o.attributes))<c[f]&&(c[f]=n,t[f]=p[g],u=!0);s[f]=r.collection(p)}}d++}return s},fuzzyCMeans:ac,fcm:ac},{hierarchicalClustering:av,hca:av},{affinityPropagation:aC,ap:aC},{hierholzer:function(e){if(!nd(e)){var t,n,r,i=arguments;e={root:i[0],directed:i[1]}}var a=aE(e),o=a.root,s=a.directed,l=!1;o&&(r=nl(o)?this.filter(o)[0].id():o[0].id());var c={},u={};s?this.forEach(function(e){var r=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?t?l=!0:t=r:1==s?n?l=!0:n=r:(s>1||o>1)&&(l=!0),c[r]=[],e.outgoers().forEach(function(e){e.isEdge()&&c[r].push(e.id())})}else u[r]=[void 0,e.target().id()]}):this.forEach(function(e){var r=e.id();e.isNode()?(e.degree(!0)%2&&(t?n?l=!0:n=r:t=r),c[r]=[],e.connectedEdges().forEach(function(e){return c[r].push(e.id())})):u[r]=[e.source().id(),e.target().id()]});var d={found:!1,trail:void 0};if(l)return d;if(n&&t)if(s){if(r&&n!=r)return d;r=n}else{if(r&&n!=r&&t!=r)return d;r||(r=n)}else r||(r=this[0].id());var h=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)n=u[t=c[i].shift()][0],i!=(r=u[t][1])?(c[r]=c[r].filter(function(e){return e!=t}),i=r):s||i==n||(c[n]=c[n].filter(function(e){return e!=t}),i=n),a.unshift(t),a.unshift(i);return a},f=[],p=[];for(p=h(r);1!=p.length;)0==c[p[0]].length?(f.unshift(this.getElementById(p.shift())),f.unshift(this.getElementById(p.shift()))):p=h(p.shift()).concat(p);for(var g in f.unshift(this.getElementById(p.shift())),c)if(c[g].length)return d;return d.found=!0,d.trail=this.spawn(f,!0),d}},{hopcroftTarjanBiconnected:a_,htbc:a_,htb:a_,hopcroftTarjanBiconnectedComponents:a_},{tarjanStronglyConnected:aS,tsc:aS,tscc:aS,tarjanStronglyConnectedComponents:aS}].forEach(function(e){nP(aT,e)});var aA=function(e){if(!(this instanceof aA))return new aA(e);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};aA.prototype={fulfill:function(e){return aO(this,1,"fulfillValue",e)},reject:function(e){return aO(this,2,"rejectReason",e)},then:function(e,t){var n=new aA;return this.onFulfilled.push(aD(e,n,"fulfill")),this.onRejected.push(aD(t,n,"reject")),aM(this),n.proxy}};var aO=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,aM(e)),e},aM=function(e){1===e.state?aP(e,"onFulfilled",e.fulfillValue):2===e.state&&aP(e,"onRejected",e.rejectReason)},aP=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e<r.length;e++)r[e](n)};"function"==typeof setImmediate?setImmediate(i):setTimeout(i,0)}},aD=function(e,t,n){return function(r){if("function"!=typeof e)t[n].call(t,r);else{var i;try{i=e(r)}catch(e){t.reject(e);return}aL(t,i)}}},aL=function(e,t){if(e===t||e.proxy===t)return void e.reject(TypeError("cannot resolve promise with itself"));if("object"===t9(t)&&null!==t||"function"==typeof t)try{n=t.then}catch(t){e.reject(t);return}if("function"==typeof n){var n,r=!1;try{n.call(t,function(n){r||(r=!0,n===t?e.reject(TypeError("circular thenable chain")):aL(e,n))},function(t){r||(r=!0,e.reject(t))})}catch(t){r||e.reject(t)}return}e.fulfill(t)};aA.all=function(e){return new aA(function(t,n){for(var r=Array(e.length),i=0,a=function(n,a){r[n]=a,++i===e.length&&t(r)},o=0;o<e.length;o++)!function(t){var r=e[t];null!=r&&null!=r.then?r.then(function(e){a(t,e)},function(e){n(e)}):a(t,r)}(o)})},aA.resolve=function(e){return new aA(function(t,n){t(e)})},aA.reject=function(e){return new aA(function(t,n){n(e)})};var aI="u">typeof Promise?Promise:aA,aR=function(e,t,n){var r=nv(e),i=this._private=nP({duration:1e3},t,n);if(i.target=e,i.style=i.style||i.css,i.started=!1,i.playing=!1,i.hooked=!1,i.applying=!1,i.progress=0,i.completes=[],i.frames=[],i.complete&&nc(i.complete)&&i.completes.push(i.complete),!r){var a=e.position();i.startPosition=i.startPosition||{x:a.x,y:a.y},i.startStyle=i.startStyle||e.cy().style().getAnimationStartStyle(e,i.style)}if(r){var o=e.pan();i.startPan={x:o.x,y:o.y},i.startZoom=e.zoom()}this.length=1,this[0]=this},aB=aR.prototype;function az(){return cn?ct:(cn=1,ct=Array.isArray)}function aF(){if(cx)return cv;cx=1;var e=function(){if(cp)return cf;cp=1;var e=function(){if(co)return ca;co=1;var e=nG(),t=nH();return ca=function(n){if(!t(n))return!1;var r=e(n);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}(),t=function(){if(cu)return cc;cu=1;var e,t=cl?cs:(cl=1,cs=nW()["__core-js_shared__"]),n=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return cc=function(e){return!!n&&n in e}}(),n=nH(),r=function(){if(ch)return cd;ch=1;var e=Function.prototype.toString;return cd=function(t){if(null!=t){try{return e.call(t)}catch(e){}try{return t+""}catch(e){}}return""}}(),i=/^\[object .+?Constructor\]$/,a=Object.prototype,o=Function.prototype.toString,s=a.hasOwnProperty,l=RegExp("^"+o.call(s).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return cf=function(a){return!(!n(a)||t(a))&&(e(a)?l:i).test(r(a))}}(),t=cg?cm:(cg=1,cm=function(e,t){return null==e?void 0:e[t]});return cv=function(n,r){var i=t(n,r);return e(i)?i:void 0}}function aV(){return cb?cy:(cb=1,cy=aF()(Object,"create"))}function aU(){return cI?cL:(cI=1,cL=function(e,t){return e===t||e!=e&&t!=t})}function aH(){if(cB)return cR;cB=1;var e=aU();return cR=function(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return -1}}function aW(){if(c2)return c1;c2=1;var e=c0?cJ:(c0=1,cJ=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e});return c1=function(t,n){var r=t.__data__;return e(n)?r["string"==typeof n?"string":"hash"]:r.map}}function aY(){if(ul)return us;ul=1;var e=function(){if(uo)return ua;uo=1;var e=function(){if(ui)return ur;ui=1;var e=function(){if(un)return ut;un=1;var e=function(){if(cQ)return cZ;cQ=1;var e=function(){if(cM)return cO;cM=1;var e=function(){if(cj)return cw;cj=1;var e=aV();return cw=function(){this.__data__=e?e(null):{},this.size=0}}(),t=ck?cN:(ck=1,cN=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t}),n=function(){if(cE)return cC;cE=1;var e=aV(),t=Object.prototype.hasOwnProperty;return cC=function(n){var r=this.__data__;if(e){var i=r[n];return"__lodash_hash_undefined__"===i?void 0:i}return t.call(r,n)?r[n]:void 0}}(),r=function(){if(cS)return c_;cS=1;var e=aV(),t=Object.prototype.hasOwnProperty;return c_=function(n){var r=this.__data__;return e?void 0!==r[n]:t.call(r,n)}}(),i=function(){if(cA)return cT;cA=1;var e=aV();return cT=function(t,n){var r=this.__data__;return this.size+=+!this.has(t),r[t]=e&&void 0===n?"__lodash_hash_undefined__":n,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,cO=a}(),t=function(){if(cX)return c$;cX=1;var e=cD?cP:(cD=1,cP=function(){this.__data__=[],this.size=0}),t=function(){if(cF)return cz;cF=1;var e=aH(),t=Array.prototype.splice;return cz=function(n){var r=this.__data__,i=e(r,n);return!(i<0)&&(i==r.length-1?r.pop():t.call(r,i,1),--this.size,!0)}}(),n=function(){if(cU)return cV;cU=1;var e=aH();return cV=function(t){var n=this.__data__,r=e(n,t);return r<0?void 0:n[r][1]}}(),r=function(){if(cW)return cH;cW=1;var e=aH();return cH=function(t){return e(this.__data__,t)>-1}}(),i=function(){if(cG)return cY;cG=1;var e=aH();return cY=function(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,c$=a}(),n=cK?cq:(cK=1,cq=aF()(nW(),"Map"));return cZ=function(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}}(),t=function(){if(c3)return c5;c3=1;var e=aW();return c5=function(t){var n=e(this,t).delete(t);return this.size-=!!n,n}}(),n=function(){if(c6)return c4;c6=1;var e=aW();return c4=function(t){return e(this,t).get(t)}}(),r=function(){if(c7)return c8;c7=1;var e=aW();return c8=function(t){return e(this,t).has(t)}}(),i=function(){if(ue)return c9;ue=1;var e=aW();return c9=function(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=+(r.size!=i),this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,ut=a}();function t(n,r){if("function"!=typeof n||null!=r&&"function"!=typeof r)throw TypeError("Expected a function");var i=function(){var e=arguments,t=r?r.apply(this,e):e[0],a=i.cache;if(a.has(t))return a.get(t);var o=n.apply(this,e);return i.cache=a.set(t,o)||a,o};return i.cache=new(t.Cache||e),i}return t.Cache=e,ur=t}();return ua=function(t){var n=e(t,function(e){return 500===r.size&&r.clear(),e}),r=n.cache;return n}}(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g;return us=e(function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(t,function(e,t,i,a){r.push(i?a.replace(n,"$1"):t||e)}),r})}function aG(){return uu?uc:(uu=1,uc=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i})}function a$(){if(up)return uf;up=1;var e=function(){if(uh)return ud;uh=1;var e=nY(),t=aG(),n=az(),r=n$(),i=e?e.prototype:void 0,a=i?i.toString:void 0;return ud=function e(i){if("string"==typeof i)return i;if(n(i))return t(i,e)+"";if(r(i))return a?a.call(i):"";var o=i+"";return"0"==o&&1/i==-1/0?"-0":o}}();return uf=function(t){return null==t?"":e(t)}}function aX(){if(ug)return um;ug=1;var e=az(),t=function(){if(ci)return cr;ci=1;var e=az(),t=n$(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return cr=function(i,a){if(e(i))return!1;var o=typeof i;return!!("number"==o||"symbol"==o||"boolean"==o||null==i||t(i))||r.test(i)||!n.test(i)||null!=a&&i in Object(a)}}(),n=aY(),r=a$();return um=function(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))}}function aq(){if(ux)return uv;ux=1;var e=n$();return uv=function(t){if("string"==typeof t||e(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}}nP(aB,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t=e.target._private.animation;(e.queue?t.queue:t.current).push(this),np(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];null!=r&&(e[t]=e[n],e[n]=r)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;return t="frame"===e?n.frames:n.completes,new aI(function(e,n){t.push(function(){e()})})}}),aB.complete=aB.completed,aB.run=aB.play,aB.running=aB.playing;var aK=nU(function(){if(uj)return uw;uj=1;var e=function(){if(ub)return uy;ub=1;var e=aX(),t=aq();return uy=function(n,r){r=e(r,n);for(var i=0,a=r.length;null!=n&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0}}();return uw=function(t,n,r){var i=null==t?void 0:e(t,n);return void 0===i?r:i}}()),aZ=nU(function(){if(uD)return uP;uD=1;var e=function(){if(uM)return uO;uM=1;var e=function(){if(uS)return u_;uS=1;var e=function(){if(uE)return uC;uE=1;var e=function(){if(uk)return uN;uk=1;var e=aF();return uN=function(){try{var t=e(Object,"defineProperty");return t({},"",{}),t}catch(e){}}()}();return uC=function(t,n,r){"__proto__"==n&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r}}(),t=aU(),n=Object.prototype.hasOwnProperty;return u_=function(r,i,a){var o=r[i];n.call(r,i)&&t(o,a)&&(void 0!==a||i in r)||e(r,i,a)}}(),t=aX(),n=function(){if(uA)return uT;uA=1;var e=/^(?:0|[1-9]\d*)$/;return uT=function(t,n){var r=typeof t;return!!(n=null==n?0x1fffffffffffff:n)&&("number"==r||"symbol"!=r&&e.test(t))&&t>-1&&t%1==0&&t<n}}(),r=nH(),i=aq();return uO=function(a,o,s,l){if(!r(a))return a;o=t(o,a);for(var c=-1,u=o.length,d=u-1,h=a;null!=h&&++c<u;){var f=i(o[c]),p=s;if("__proto__"===f||"constructor"===f||"prototype"===f)break;if(c!=d){var g=h[f];void 0===(p=l?l(g,f,h):void 0)&&(p=r(g)?g:n(o[c+1])?[]:{})}e(h,f,p),h=h[f]}return a}}();return uP=function(t,n,r){return null==t?t:e(t,n,r)}}()),aQ=nU(function(){if(uB)return uR;uB=1;var e=aG(),t=uI?uL:(uI=1,uL=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}),n=az(),r=n$(),i=aY(),a=aq(),o=a$();return uR=function(s){return n(s)?e(s,a):r(s)?[s]:t(i(o(s)))}}()),aJ={};[{animated:function(){return function(){var e=void 0!==this.length;if(!(this._private.cy||this).styleEnabled())return!1;var t=(e?this:[this])[0];if(t)return t._private.animation.current.length>0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t<e.length;t++)e[t]._private.animation.queue=[];return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=void 0!==this.length,r=n?this:[this],i=this._private.cy||this,a=!n,o=!a;if(!i.styleEnabled())return this;var s=i.style();if(0===Object.keys(e=nP({},e,t)).length)return new aR(r[0],e);switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}if(o&&(e.style=s.getPropsList(e.style||e.css),e.css=void 0),o&&null!=e.renderedPosition){var l=e.renderedPosition,c=i.pan(),u=i.zoom();e.position=rR(l,u,c)}if(a&&null!=e.panBy){var d=e.panBy,h=i.pan();e.pan={x:h.x+d.x,y:h.y+d.y}}var f=e.center||e.centre;if(a&&null!=f){var p=i.getCenterPan(f.eles,e.zoom);null!=p&&(e.pan=p)}if(a&&null!=e.fit){var g=e.fit,v=i.getFitViewport(g.eles||g.boundingBox,g.padding);null!=v&&(e.pan=v.pan,e.zoom=v.zoom)}if(a&&nd(e.zoom)){var x=i.getZoomedViewport(e.zoom);null!=x?(x.zoomed&&(e.zoom=x.zoom),x.panned&&(e.pan=x.pan)):e.zoom=null}return new aR(r[0],e)}},animate:function(){return function(e,t){var n=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=nP({},e,t));for(var r=0;r<n.length;r++){var i=n[r],a=i.animated()&&(void 0===e.queue||e.queue);i.animation(e,a?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=void 0!==this.length?this:[this],r=this._private.cy||this;if(!r.styleEnabled())return this;for(var i=0;i<n.length;i++){for(var a=n[i]._private,o=a.animation.current,s=0;s<o.length;s++){var l=o[s]._private;t&&(l.duration=0)}e&&(a.animation.queue=[]),t||(a.animation.current=[])}return r.notify("draw"),this}}},{data:function(e){return e=nP({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r,i=e,a=void 0!==this.length,o=a?this:[this],s=a?this[0]:this;if(nl(t)){var l,c=-1!==t.indexOf(".")&&aQ(t);if(i.allowGetting&&void 0===n)return s&&(i.beforeGet(s),l=c&&void 0===s._private[i.field][t]?aK(s._private[i.field],c):s._private[i.field][t]),l;if(i.allowSetting&&void 0!==n&&!i.immutableKeys[t]){var u=t4({},t,n);i.beforeSet(this,u);for(var d=0,h=o.length;d<h;d++){var f=o[d];i.canSet(f)&&(c&&void 0===s._private[i.field][t]?aZ(f._private[i.field],c,n):f._private[i.field][t]=n)}i.updateStyle&&this.updateStyle(),i.onSet(this),i.settingTriggersEvent&&this[i.triggerFnName](i.settingEvent)}}else if(i.allowSetting&&nd(t)){var p,g,v=Object.keys(t);i.beforeSet(this,t);for(var x=0;x<v.length;x++)if(g=t[p=v[x]],!i.immutableKeys[p])for(var y=0;y<o.length;y++){var b=o[y];i.canSet(b)&&(b._private[i.field][p]=g)}i.updateStyle&&this.updateStyle(),i.onSet(this),i.settingTriggersEvent&&this[i.triggerFnName](i.settingEvent)}else if(i.allowBinding&&nc(t))this.on(i.bindingEvent,t);else if(i.allowGetting&&void 0===t)return s&&(i.beforeGet(s),r=s._private[i.field]),r;return this}},removeData:function(e){return e=nP({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=void 0!==this.length?this:[this];if(nl(t)){for(var i=t.split(/\s+/),a=i.length,o=0;o<a;o++){var s=i[o];if(!ny(s)&&!n.immutableKeys[s])for(var l=0,c=r.length;l<c;l++)r[l]._private[n.field][s]=void 0}n.triggerEvent&&this[n.triggerFnName](n.event)}else if(void 0===t){for(var u=0,d=r.length;u<d;u++)for(var h=r[u]._private[n.field],f=Object.keys(h),p=0;p<f.length;p++){var g=f[p];n.immutableKeys[g]||(h[g]=void 0)}n.triggerEvent&&this[n.triggerFnName](n.event)}return this}}},{eventAliasesOn:function(e){e.addListener=e.listen=e.bind=e.on,e.unlisten=e.unbind=e.off=e.removeListener,e.trigger=e.emit,e.pon=e.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new aI(function(e,t){var i=r.concat([function(t){n.off.apply(n,a),e(t)}]),a=i.concat([]);n.on.apply(n,i)})}}}].forEach(function(e){nP(aJ,e)});var a0={animate:aJ.animate(),animation:aJ.animation(),animated:aJ.animated(),clearQueue:aJ.clearQueue(),delay:aJ.delay(),delayAnimation:aJ.delayAnimation(),stop:aJ.stop()},a1={classes:function(e){if(void 0===e){var t=[];return this[0]._private.classes.forEach(function(e){return t.push(e)}),t}nu(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],r=new rj(e),i=0;i<this.length;i++){for(var a=this[i],o=a._private,s=o.classes,l=!1,c=0;c<e.length;c++){var u=e[c];if(!s.has(u)){l=!0;break}}l||(l=s.size!==e.length),l&&(o.classes=r,n.push(a))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){nu(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i<a;i++)for(var o=this[i],s=o._private.classes,l=!1,c=0;c<e.length;c++){var u=e[c],d=s.has(u),h=!1;t||n&&!d?(s.add(u),h=!0):(!t||n&&d)&&(s.delete(u),h=!0),!l&&h&&(r.push(o),l=!0)}return r.length>0&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};a1.className=a1.classNames=a1.classes;var a2={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:n_,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};for(lM=0,a2.variable="(?:[\\w-.]|(?:\\\\"+a2.metaChar+"))+",a2.className="(?:[\\w-]|(?:\\\\"+a2.metaChar+"))+",a2.value=a2.string+"|"+a2.number,a2.id=a2.variable,lA=a2.comparatorOp.split("|");lM<lA.length;lM++)lO=lA[lM],a2.comparatorOp+="|@"+lO;for(lM=0,lA=a2.comparatorOp.split("|");lM<lA.length;lM++)(lO=lA[lM]).indexOf("!")>=0||"="!==lO&&(a2.comparatorOp+="|\\!"+lO);var a5=function(){return{checks:[]}},a3=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return -1*nM(e.selector,t.selector)}),a4=function(){for(var e,t={},n=0;n<a3.length;n++)t[(e=a3[n]).selector]=e.matches;return t}(),a6="("+a3.map(function(e){return e.selector}).join("|")+")",a8=function(e){return e.replace(RegExp("\\\\("+a2.metaChar+")","g"),function(e,t){return t})},a7=function(e,t,n){e[e.length-1]=n},a9=[{name:"group",query:!0,regex:"("+a2.group+")",populate:function(e,t,n){var r=t6(n,1)[0];t.checks.push({type:0,value:"*"===r?r:r+"s"})}},{name:"state",query:!0,regex:a6,populate:function(e,t,n){var r=t6(n,1)[0];t.checks.push({type:7,value:r})}},{name:"id",query:!0,regex:"\\#("+a2.id+")",populate:function(e,t,n){var r=t6(n,1)[0];t.checks.push({type:8,value:a8(r)})}},{name:"className",query:!0,regex:"\\.("+a2.className+")",populate:function(e,t,n){var r=t6(n,1)[0];t.checks.push({type:9,value:a8(r)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+a2.variable+")\\s*\\]",populate:function(e,t,n){var r=t6(n,1)[0];t.checks.push({type:4,field:a8(r)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+a2.variable+")\\s*("+a2.comparatorOp+")\\s*("+a2.value+")\\s*\\]",populate:function(e,t,n){var r=t6(n,3),i=r[0],a=r[1],o=r[2];o=null!=RegExp("^"+a2.string+"$").exec(o)?o.substring(1,o.length-1):parseFloat(o),t.checks.push({type:3,field:a8(i),operator:a,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+a2.boolOp+")\\s*("+a2.variable+")\\s*\\]",populate:function(e,t,n){var r=t6(n,2),i=r[0],a=r[1];t.checks.push({type:5,field:a8(a),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+a2.meta+")\\s*("+a2.comparatorOp+")\\s*("+a2.number+")\\s*\\]\\]",populate:function(e,t,n){var r=t6(n,3),i=r[0],a=r[1],o=r[2];t.checks.push({type:6,field:a8(i),operator:a,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:a2.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return null!=n&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]=a5()}},{name:"directedEdge",separator:!0,regex:a2.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n=a5(),r=a5();return n.checks.push({type:11,source:t,target:r}),a7(e,t,n),e.edgeCount++,r}var i=a5(),a=a5();return i.checks.push({type:12,source:t,target:a}),a7(e,t,i),e.edgeCount++,a}},{name:"undirectedEdge",separator:!0,regex:a2.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n=a5(),r=a5();return n.checks.push({type:10,nodes:[t,r]}),a7(e,t,n),e.edgeCount++,r}var i=a5(),a=a5();return i.checks.push({type:14,node:t,neighbor:a}),a7(e,t,i),a}},{name:"child",separator:!0,regex:a2.child,populate:function(e,t){if(null==e.currentSubject){var n=a5(),r=a5(),i=e[e.length-1];return n.checks.push({type:15,parent:i,child:r}),a7(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var a=a5(),o=e[e.length-1],s=a5(),l=a5(),c=a5(),u=a5();return a.checks.push({type:19,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:20}],u.checks.push({type:20}),s.checks.push({type:17,parent:u,child:c}),a7(e,o,a),e.currentSubject=l,e.compoundCount++,c}var d=a5(),h=a5(),f=[{type:17,parent:d,child:h}];return d.checks=t.checks,t.checks=f,e.compoundCount++,h}},{name:"descendant",separator:!0,regex:a2.descendant,populate:function(e,t){if(null==e.currentSubject){var n=a5(),r=a5(),i=e[e.length-1];return n.checks.push({type:16,ancestor:i,descendant:r}),a7(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var a=a5(),o=e[e.length-1],s=a5(),l=a5(),c=a5(),u=a5();return a.checks.push({type:19,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:20}],u.checks.push({type:20}),s.checks.push({type:18,ancestor:u,descendant:c}),a7(e,o,a),e.currentSubject=l,e.compoundCount++,c}var d=a5(),h=a5(),f=[{type:18,ancestor:d,descendant:h}];return d.checks=t.checks,t.checks=f,e.compoundCount++,h}},{name:"subject",modifier:!0,regex:a2.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return rl("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=null==n?null:n.type;11===r?n.type=13:10===r&&(n.type=14,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];a9.forEach(function(e){return e.regexObj=RegExp("^"+e.regex)});var oe=function(e){for(var t,n,r,i=0;i<a9.length;i++){var a=a9[i],o=a.name,s=e.match(a.regexObj);if(null!=s){n=s,t=a,r=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},ot=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},on=function(e,t,n){var r,i,a,o=nl(e),s=nh(e),l=nl(n),c=!1,u=!1,d=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),u=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),c=!0),(o||l||c)&&(i=o||s?""+e:"",a=""+n),c&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e<n;break;case"<=":d=!0,r=e<=n;break;default:r=!1}return u&&(null!=e||!d)&&(r=!r),r},or=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}},oi=function(e,t){return e.data(t)},oa=[],oo=function(e,t){return e.checks.every(function(e){return oa[e.type](e,t)})};oa[0]=function(e,t){var n=e.value;return"*"===n||n===t.group()},oa[7]=function(e,t){var n;return n=e.value,a4[n](t)},oa[8]=function(e,t){var n=e.value;return t.id()===n},oa[9]=function(e,t){var n=e.value;return t.hasClass(n)},oa[6]=function(e,t){var n=e.field,r=e.operator,i=e.value;return on(t[n](),r,i)},oa[3]=function(e,t){var n=e.field,r=e.operator,i=e.value;return on(oi(t,n),r,i)},oa[5]=function(e,t){var n=e.field,r=e.operator;return or(oi(t,n),r)},oa[4]=function(e,t){var n=e.field;return e.operator,void 0!==oi(t,n)},oa[10]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return oo(n,i)&&oo(r,a)||oo(r,i)&&oo(n,a)},oa[14]=function(e,t){return oo(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&oo(e.neighbor,t)})},oa[11]=function(e,t){return oo(e.source,t.source())&&oo(e.target,t.target())},oa[12]=function(e,t){return oo(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&oo(e.target,t)})},oa[13]=function(e,t){return oo(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&oo(e.source,t)})},oa[15]=function(e,t){return oo(e.child,t)&&oo(e.parent,t.parent())},oa[17]=function(e,t){return oo(e.parent,t)&&t.children().some(function(t){return oo(e.child,t)})},oa[16]=function(e,t){return oo(e.descendant,t)&&t.ancestors().some(function(t){return oo(e.ancestor,t)})},oa[18]=function(e,t){return oo(e.ancestor,t)&&t.descendants().some(function(t){return oo(e.descendant,t)})},oa[19]=function(e,t){return oo(e.subject,t)&&oo(e.left,t)&&oo(e.right,t)},oa[20]=function(){return!0},oa[1]=function(e,t){return e.value.has(t)},oa[2]=function(e,t){return(0,e.value)(t)};var os=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||nl(e)&&e.match(/^\s*$/)||(np(e)?this.addQuery({checks:[{type:1,value:e.collection()}]}):nc(e)?this.addQuery({checks:[{type:2,value:e}]}):nl(e)?this.parse(e)||(this.invalid=!0):ro("A selector must be created from a string; found "))},ol=os.prototype;[{parse:function(e){var t=this.inputText=e,n=this[0]=a5();for(this.length=1,t=ot(t);;){var r=oe(t);if(null==r.expr)return rl("The selector `"+e+"`is invalid"),!1;var i=r.match.slice(1),a=r.expr.populate(this,n,i);if(!1===a)return!1;if(null!=a&&(n=a),(t=r.remaining).match(/^\s*$/))break}var o=this[this.length-1];null!=this.currentSubject&&(o.subject=this.currentSubject),o.edgeCount=this.edgeCount,o.compoundCount=this.compoundCount;for(var s=0;s<this.length;s++){var l=this[s];if(l.compoundCount>0&&l.edgeCount>0)return rl("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return rl("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&rl("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return nl(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case 0:var l=e(s);return l.substring(0,l.length-1);case 3:return"["+r.field+n(e(r.operator))+t(s)+"]";case 5:var c=r.operator,u=r.field;return"["+e(c)+u+"]";case 4:return"["+r.field+"]";case 6:var d=r.operator;return"[["+r.field+n(e(d))+t(s)+"]]";case 7:return s;case 8:return"#"+s;case 9:return"."+s;case 17:case 15:return i(r.parent,a)+n(">")+i(r.child,a);case 18:case 16:return i(r.ancestor,a)+" "+i(r.descendant,a);case 19:var h=i(r.left,a),f=i(r.subject,a),p=i(r.right,a);return h+(h.length>0?" ":"")+f+p;case 20:return""}},i=function(e,t){return e.checks.reduce(function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)},"")},a="",o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=", ")}return this.toStringCache=a,a}},{matches:function(e){for(var t=0;t<this.length;t++)if(oo(this[t],e))return!0;return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&8===t[0].checks[0].type)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++)if(oo(t[n],e))return!0;return!1};return null==t.text()&&(n=function(){return!0}),e.filter(n)}}].forEach(function(e){return nP(ol,e)}),ol.text=function(){return this.inputText},ol.size=function(){return this.length},ol.eq=function(e){return this[e]},ol.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},ol.addQuery=function(e){this[this.length++]=e},ol.selector=ol.toString;var oc={allAre:function(e){var t=new os(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new os(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every(function(t){return e.hasElementWithId(t.id())}))},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(e){return t.hasElementWithId(e.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(e){return t.hasElementWithId(e.id())})}};oc.allAreNeighbours=oc.allAreNeighbors,oc.has=oc.contains,oc.equal=oc.equals=oc.same;var ou=function(e,t){return function(n,r,i,a){if(null==n?o="":np(n)&&1===n.length&&(o=n.id()),1!==this.length||!o)return e.call(this,n,r,i,a);var o,s=this[0]._private,l=s.traversalCache=s.traversalCache||{},c=l[t]=l[t]||[],u=n4(o),d=c[u];return d||(c[u]=e.call(this,n,r,i,a))}},od={parent:function(e){var t=[];if(1===this.length){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r]._private.parent;i&&t.push(i)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t=(t=t||r).intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(e){return e.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(e){return e.isChild()}).filter(e)},children:ou(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[i]);return this.spawn(t,!0).filter(e)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];return!function e(n){for(var r=0;r<n.length;r++){var i=n[r];t.push(i),i.children().nonempty()&&e(i.children())}}(this.children()),this.spawn(t,!0).filter(e)}};function oh(e,t,n,r){for(var i=[],a=new rj,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];n?i.push(l):o&&r(i,a,l)}for(;i.length>0;){var c=i.shift();t(c),a.add(c.id()),o&&r(i,a,c)}return e}function of(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}function op(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}function om(e,t,n){op(e,t,n),of(e,t,n)}od.forEachDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return oh(this,e,t,of)},od.forEachUp=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return oh(this,e,t,op)},od.forEachUpAndDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return oh(this,e,t,om)},od.ancestors=od.parents,(uz=uF={data:aJ.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:aJ.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:aJ.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:aJ.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:aJ.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:aJ.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=uz.data,uz.removeAttr=uz.removeData;var og={};function ov(e){return function(t){if(void 0===t&&(t=!0),0!==this.length)if(!this.isNode()||this.removed())return;else{for(var n=0,r=this[0],i=r._private.edges,a=0;a<i.length;a++){var o=i[a];!t&&o.isLoop()||(n+=e(r,o))}return n}}}function ox(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);void 0!==o&&(void 0===r||t(o,r))&&(r=o)}return r}}nP(og,{degree:ov(function(e,t){return t.source().same(t.target())?2:1}),indegree:ov(function(e,t){return+!!t.target().same(e)}),outdegree:ov(function(e,t){return+!!t.source().same(e)})}),nP(og,{minDegree:ox("degree",function(e,t){return e<t}),maxDegree:ox("degree",function(e,t){return e>t}),minIndegree:ox("indegree",function(e,t){return e<t}),maxIndegree:ox("indegree",function(e,t){return e>t}),minOutdegree:ox("outdegree",function(e,t){return e<t}),maxOutdegree:ox("outdegree",function(e,t){return e>t})}),nP(og,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var oy=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:null!=t.x?t.x-a.x:0,y:null!=t.y?t.y-a.y:0};i.isParent()&&(0!==o.x||0!==o.y)&&i.children().shift(o,n),i.dirtyBoundingBoxCache()}}},ob={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){oy(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};(uV=uU={position:aJ.data(ob),silentPosition:aJ.data(nP({},ob,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){oy(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(nd(e))t?this.silentPosition(e):this.position(e);else if(nc(e)){var n=this.cy();n.startBatch();for(var r=0;r<this.length;r++){var i=this[r],a=void 0;(a=e(i,r))&&(t?i.silentPosition(a):i.position(a))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(nd(e)?(r={x:nh(e.x)?e.x:0,y:nh(e.y)?e.y:0},n=t):nl(e)&&nh(t)&&((r={x:0,y:0})[e]=t),null!=r){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),l={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(l):o.position(l)}}i.endBatch()}return this},silentShift:function(e,t){return nd(e)?this.shift(e,!0):nl(e)&&nh(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=nd(e)?e:void 0,s=void 0!==o||void 0!==t&&nl(e);if(n&&n.isNode())if(!s)return(o=rI(n.position(),i,a),void 0===e)?o:o[e];else for(var l=0;l<this.length;l++){var c=this[l];void 0!==t?c.position(e,(t-a[e])/i):void 0!==o&&c.position(rR(o,i,a))}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=nd(e)?e:void 0,a=void 0!==i||void 0!==t&&nl(e),o=r.hasCompoundNodes();if(n&&n.isNode())if(a)for(var s=0;s<this.length;s++){var l=this[s],c=o?l.parent():null,u=c&&c.length>0;u&&(c=c[0]);var d=u?c.position():{x:0,y:0};void 0!==t?l.position(e,t+d[e]):void 0!==i&&l.position({x:i.x+d.x,y:i.y+d.y})}else{var h=n.position(),f=o?n.parent():null,p=f&&f.length>0;p&&(f=f[0]);var g=p?f.position():{x:0,y:0};return(i={x:h.x-g.x,y:h.y-g.y},void 0===e)?i:i[e]}else if(!a)return;return this}}).modelPosition=uV.point=uV.position,uV.modelPositions=uV.points=uV.positions,uV.renderedPoint=uV.renderedPosition,uV.relativePoint=uV.relativePosition,uH=uW={},uW.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},uW.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()&&this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}}),this},uW.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()||!e&&t.batching())return this;for(var n=0;n<this.length;n++){var r=this[n],i=r._private;(!i.compoundBoundsClean||e)&&(!function(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;(0===a.w||0===a.h)&&((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var c=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(c=100*c/i.height.val);var u=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(u=100*u/i.height.val);var d=x(i.width.val-a.w,s,l),h=d.biasDiff,f=d.biasComplementDiff,p=x(i.height.val-a.h,c,u),g=p.biasDiff,v=p.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"===n.units)switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}return"px"===n.units?n.pfValue:0}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-h+a.x1+a.x2+f)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-g+a.y1+a.y2+v)/2}function x(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}(r),t.batching()||(i.compoundBoundsClean=!0))}return this};var ow=function(e){return e===1/0||e===-1/0?0:e},oj=function(e,t,n,r,i){r-t==0||i-n==0||null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},oN=function(e,t){return null==t?e:oj(e,t.x1,t.y1,t.x2,t.y2)},ok=function(e,t,n){return rv(e,t,n)},oC=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},c=l[n]=l[n]||{};c.x1=r-s,c.y1=i-s,c.x2=r+s,c.y2=i+s,c.w=c.x2-c.x1,c.h=c.y2-c.y1,r5(c,1),oj(e,c.x1,c.y1,c.x2,c.y2)}}},oE=function(e,t,n){if(!t.cy().headless()){a=n?n+"-":"";var r=t._private,i=r.rstyle;if(t.pstyle(a+"label").strValue){var a,o,s,l,c,u=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=ok(i,"labelWidth",n),f=ok(i,"labelHeight",n),p=ok(i,"labelX",n),g=ok(i,"labelY",n),v=t.pstyle(a+"text-margin-x").pfValue,x=t.pstyle(a+"text-margin-y").pfValue,y=t.isEdge(),b=t.pstyle(a+"text-rotation"),w=t.pstyle("text-outline-width").pfValue,j=t.pstyle("text-border-width").pfValue/2,N=t.pstyle("text-background-padding").pfValue,k=h/2,C=f/2;if(y)o=p-k,s=p+k,l=g-C,c=g+C;else{switch(u.value){case"left":o=p-h,s=p;break;case"center":o=p-k,s=p+k;break;case"right":o=p,s=p+h}switch(d.value){case"top":l=g-f,c=g;break;case"center":l=g-C,c=g+C;break;case"bottom":l=g,c=g+f}}var E=v-Math.max(w,j)-N-2,_=v+Math.max(w,j)+N+2,S=x-Math.max(w,j)-N-2,T=x+Math.max(w,j)+N+2;o+=E,s+=_,l+=S,c+=T;var A=n||"main",O=r.labelBounds,M=O[A]=O[A]||{};M.x1=o,M.y1=l,M.x2=s,M.y2=c,M.w=s-o,M.h=c-l,M.leftPad=E,M.rightPad=_,M.topPad=S,M.botPad=T;var P=y&&"autorotate"===b.strValue,D=null!=b.pfValue&&0!==b.pfValue;if(P||D){var L=P?ok(r.rstyle,"labelAngle",n):b.pfValue,I=Math.cos(L),R=Math.sin(L),B=(o+s)/2,z=(l+c)/2;if(!y){switch(u.value){case"left":B=s;break;case"right":B=o}switch(d.value){case"top":z=c;break;case"bottom":z=l}}var F=function(e,t){return{x:(e-=B)*I-(t-=z)*R+B,y:e*R+t*I+z}},V=F(o,l),U=F(o,c),H=F(s,l),W=F(s,c);o=Math.min(V.x,U.x,H.x,W.x),s=Math.max(V.x,U.x,H.x,W.x),l=Math.min(V.y,U.y,H.y,W.y),c=Math.max(V.y,U.y,H.y,W.y)}var Y=A+"Rot",G=O[Y]=O[Y]||{};G.x1=o,G.y1=l,G.x2=s,G.y2=c,G.w=s-o,G.h=c-l,oj(e,o,l,s,c),oj(r.labelBounds.all,o,l,s,c)}return e}},o_=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value+t.pstyle("outline-offset").value;oS(e,t,n,r,"outside",r/2)}},oS=function(e,t,n,r,i,a){if(0!==n&&!(r<=0)&&"inside"!==i){var o=t.cy(),s=t.pstyle("shape").value,l=o.renderer().nodeShapes[s],c=t.position(),u=c.x,d=c.y,h=t.width(),f=t.height();l.hasMiterBounds?("center"===i&&(r/=2),oN(e,l.miterBounds(u,d,h,f,r))):null!=a&&a>0&&r3(e,[a,a,a,a])}},oT=function(e,t){if(!t.cy().headless()){var n=t.pstyle("border-opacity").value,r=t.pstyle("border-width").pfValue,i=t.pstyle("border-position").value;oS(e,t,n,r,i)}},oA=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a=rJ(),o=e._private,s=e.isNode(),l=e.isEdge(),c=o.rstyle,u=s&&r?e.pstyle("bounds-expansion").pfValue:[0],d=function(e){return"none"!==e.pstyle("display").value},h=!r||d(e)&&(!l||d(e.source())&&d(e.target()));if(h){var f=0;r&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(f=e.pstyle("overlay-padding").value);var p=0;r&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(p=e.pstyle("underlay-padding").value);var g=Math.max(f,p),v=0;if(r&&(v=e.pstyle("width").pfValue/2),s&&t.includeNodes){var x=e.position();C=x.x,E=x.y;var y=e.outerWidth()/2,b=e.outerHeight()/2;w=C-y,j=C+y,oj(a,w,N=E-b,j,k=E+b),r&&o_(a,e),r&&t.includeOutlines&&!i&&o_(a,e),r&&oT(a,e)}else if(l&&t.includeEdges)if(r&&!i){var w,j,N,k,C,E,_,S=e.pstyle("curve-style").strValue;if(w=Math.min(c.srcX,c.midX,c.tgtX),j=Math.max(c.srcX,c.midX,c.tgtX),N=Math.min(c.srcY,c.midY,c.tgtY),k=Math.max(c.srcY,c.midY,c.tgtY),w-=v,j+=v,oj(a,w,N-=v,j,k+=v),"haystack"===S){var T=c.haystackPts;if(T&&2===T.length){if(w=T[0].x,N=T[0].y,j=T[1].x,k=T[1].y,w>j){var A=w;w=j,j=A}if(N>k){var O=N;N=k,k=O}oj(a,w-v,N-v,j+v,k+v)}}else if("bezier"===S||"unbundled-bezier"===S||nE(S,"segments")||nE(S,"taxi")){switch(S){case"bezier":case"unbundled-bezier":_=c.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":_=c.linePts}if(null!=_)for(var M=0;M<_.length;M++){var P=_[M];w=P.x-v,j=P.x+v,oj(a,w,N=P.y-v,j,k=P.y+v)}}}else{var D=e.source().position(),L=e.target().position();if(w=D.x,j=L.x,N=D.y,k=L.y,w>j){var I=w;w=j,j=I}if(N>k){var R=N;N=k,k=R}w-=v,j+=v,oj(a,w,N-=v,j,k+=v)}if(r&&t.includeEdges&&l&&(oC(a,e,"mid-source"),oC(a,e,"mid-target"),oC(a,e,"source"),oC(a,e,"target")),r&&"yes"===e.pstyle("ghost").value){var B=e.pstyle("ghost-offset-x").pfValue,z=e.pstyle("ghost-offset-y").pfValue;oj(a,a.x1+B,a.y1+z,a.x2+B,a.y2+z)}var F=o.bodyBounds=o.bodyBounds||{};r4(F,a),r3(F,u),r5(F,1),r&&(w=a.x1,j=a.x2,N=a.y1,k=a.y2,oj(a,w-g,N-g,j+g,k+g));var V=o.overlayBounds=o.overlayBounds||{};r4(V,a),r3(V,u),r5(V,1);var U=o.labelBounds=o.labelBounds||{};null!=U.all?r0(U.all):U.all=rJ(),r&&t.includeLabels&&(t.includeMainLabels&&oE(a,e,null),l&&(t.includeSourceLabels&&oE(a,e,"source"),t.includeTargetLabels&&oE(a,e,"target")))}return a.x1=ow(a.x1),a.y1=ow(a.y1),a.x2=ow(a.x2),a.y2=ow(a.y2),a.w=ow(a.x2-a.x1),a.h=ow(a.y2-a.y1),a.w>0&&a.h>0&&h&&(r3(a,u),r5(a,1)),a},oO=function(e){var t=0,n=function(e){return!!e<<t++};return 0+n(e.incudeNodes)+n(e.includeEdges)+n(e.includeLabels)+n(e.includeMainLabels)+n(e.includeSourceLabels)+n(e.includeTargetLabels)+n(e.includeOverlays)+n(e.includeOutlines)},oM=function(e){var t=function(e){return Math.round(e)};if(e.isEdge()){var n=e.source().position(),r=e.target().position();return n3([t(n.x),t(n.y),t(r.x),t(r.y)])}var i=e.position();return n3([t(i.x),t(i.y)])},oP=function(e,t){var n,r=e._private,i=e.isEdge(),a=null==t?oL:oO(t);if(null==r.bbCache?(r.bbCache=n=oA(e,oD),r.bbCachePosKey=oM(e)):n=r.bbCache,a!==oL){var o=e.isNode();n=rJ(),(t.includeNodes&&o||t.includeEdges&&!o)&&(t.includeOverlays?oN(n,r.overlayBounds):oN(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?oN(n,r.labelBounds.all):(t.includeMainLabels&&oN(n,r.labelBounds.mainRot),t.includeSourceLabels&&oN(n,r.labelBounds.sourceRot),t.includeTargetLabels&&oN(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},oD={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},oL=oO(oD),oI=rf(oD);uW.boundingBox=function(e){var t,n=void 0===e||void 0===e.useCache||!0===e.useCache,r=nw(function(e){var t=e._private;return null==t.bbCache||t.styleDirty||t.bbCachePosKey!==oM(e)},function(e){return e.id()});if(n&&1===this.length&&!r(this[0]))e=void 0===e?oD:oI(e),t=oP(this[0],e);else{t=rJ();var i=oI(e=e||oD),a=this.cy().styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),a&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var o=0;o<this.length;o++){var s=this[o];r(s)&&s.dirtyBoundingBoxCache(),oN(t,oP(s,i))}}return t.x1=ow(t.x1),t.y1=ow(t.y1),t.x2=ow(t.x2),t.y2=ow(t.y2),t.w=ow(t.x2-t.x1),t.h=ow(t.y2-t.y1),t},uW.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},uW.boundingBoxAt=function(e){var t,n=this.nodes(),r=this.cy(),i=r.hasCompoundNodes(),a=r.collection();if(i&&(a=n.filter(function(e){return e.isParent()}),n=n.not(a)),nd(e)){var o=e;e=function(){return o}}r.startBatch(),n.forEach(function(t,n){return t._private.bbAtOldPos=e(t,n)}).silentPositions(e),i&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var s={x1:(t=this.boundingBox({useCache:!1})).x1,x2:t.x2,w:t.w,y1:t.y1,y2:t.y2,h:t.h};return n.silentPositions(function(e){return e._private.bbAtOldPos}),i&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),r.endBatch(),s},uH.boundingbox=uH.bb=uH.boundingBox,uH.renderedBoundingbox=uH.renderedBoundingBox,uY=uG={};var oR=function(e){e.uppercaseName=nC(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=nC(e.outerName),uY[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t)if(!r)return 1;else{if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var i=t.pstyle(e.name);return"label"===i.strValue?(t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):i.pfValue}},uY["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)if(!n)return 1;else{var r=t[e.name](),i=t.pstyle("border-position").value;return r+("center"===i?t.pstyle("border-width").pfValue:"outside"===i?2*t.pstyle("border-width").pfValue:0)+2*t.padding()}},uY["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},uY["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};oR({name:"width"}),oR({name:"height"}),uG.padding=function(){var e=this[0],t=e._private;return e.isParent()&&(e.updateCompoundBounds(),void 0!==t.autoPadding)?t.autoPadding:e.pstyle("padding").pfValue},uG.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},uG.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var oB=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},oz=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return rI(t(e),n.zoom(),n.pan())}},oF=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map(function(e){return rI(e,i,r)})}},oV={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},oU=nP({},uU,uW,uG,Object.keys(oV).reduce(function(e,t){var n=oV[t],r="rendered"+t[0].toUpperCase()+t.substr(1);return e[t]=function(){return oB(this,n.get)},n.mult?e[r]=function(){return oF(this,n.get)}:e[r]=function(){return oz(this,n.get)},e},{})),oH=function(e,t){this.recycle(e,t)};function oW(){return!1}function oY(){return!0}oH.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=oW,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?oY:oW):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=oY;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=oY;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=oY,this.stopPropagation()},isDefaultPrevented:oW,isPropagationStopped:oW,isImmediatePropagationStopped:oW};var oG=/^([^.]+)(\.(?:[^.]+))?$/,o$={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},oX=Object.keys(o$),oq={};function oK(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:oq,t=arguments.length>1?arguments[1]:void 0,n=0;n<oX.length;n++){var r=oX[n];this[r]=e[r]||o$[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var oZ=oK.prototype,oQ=function(e,t,n,r,i,a,o){nc(r)&&(i=r,r=null),o&&(a=null==a?o:nP({},a,o));for(var s=nu(n)?n:n.split(/\s+/),l=0;l<s.length;l++){var c=s[l];if(!ny(c)){var u=c.match(oG);if(u&&!1===t(e,c,u[1],u[2]?u[2]:null,r,i,a))break}}},oJ=function(e,t){return e.addEventFields(e.context,t),new oH(t.type,t)},o0=function(e,t,n){if("event"===ns(n))return void t(e,n);if(nd(n))return void t(e,oJ(e,n));for(var r=nu(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!ny(a)){var o=a.match(oG);if(o){var s=oJ(e,{type:o[1],namespace:o[2]?o[2]:null,target:e.context});t(e,s)}}}};oZ.on=oZ.addListener=function(e,t,n,r,i){return oQ(this,function(e,t,n,r,i,a,o){nc(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})},e,t,n,r,i),this},oZ.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},oZ.removeListener=oZ.off=function(e,t,n,r){var i=this;0!==this.emitting&&(this.listeners=this.listeners.slice());for(var a=this.listeners,o=function(o){var s=a[o];oQ(i,function(t,n,r,i,l,c){if((s.type===r||"*"===e)&&(!i&&".*"!==s.namespace||s.namespace===i)&&(!l||t.qualifierCompare(s.qualifier,l))&&(!c||s.callback===c))return a.splice(o,1),!1},e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},oZ.removeAllListeners=function(){return this.removeListener("*")},oZ.emit=oZ.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,nu(t)||(t=[t]),o0(this,function(e,a){null!=n&&(i=(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}]).length);for(var o=0;o<i;o++)!function(){var n=r[o];if(n.type===a.type&&(!n.namespace||n.namespace===a.namespace||".*"===n.namespace)&&e.eventMatches(e.context,n,a)){var i=[a];null!=t&&rg(i,t),e.beforeEmit(e.context,n,a),n.conf&&n.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==n}));var s=e.callbackContext(e.context,n,a),l=n.callback.apply(s,i);e.afterEmit(e.context,n,a),!1===l&&(a.stopPropagation(),a.preventDefault())}}();e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)},e),this.emitting--,this};var o1={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&nm(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},o2=function(e){return nl(e)?new os(e):e},o5={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new oK(o1,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=o2(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n);return this},removeListener:function(e,t,n){for(var r=o2(t),i=0;i<this.length;i++)this[i].emitter().removeListener(e,r,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var r=o2(t),i=0;i<this.length;i++)this[i].emitter().one(e,r,n);return this},once:function(e,t,n){for(var r=o2(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};aJ.eventAliasesOn(o5);var o3={nodes:function(e){return this.filter(function(e){return e.isNode()}).filter(e)},edges:function(e){return this.filter(function(e){return e.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(nl(e)||np(e))return new os(e).filter(this);if(nc(e)){for(var n=this.spawn(),r=0;r<this.length;r++){var i=this[r];(t?e.apply(t,[i,r,this]):e(i,r,this))&&n.push(i)}return n}return this.spawn()},not:function(e){if(!e)return this;nl(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n];e.has(r)||t.push(r)}return t},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(nl(e))return this.filter(e);for(var t=this.spawn(),n=this.length<e.length,r=n?this:e,i=n?e:this,a=0;a<r.length;a++){var o=r[a];i.has(o)&&t.push(o)}return t},xor:function(e){var t=this._private.cy;nl(e)&&(e=t.$(e));var n=this.spawn(),r=e,i=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id;t.hasElementWithId(a)||n.push(i)}};return i(this,r),i(r,this),n},diff:function(e){var t=this._private.cy;nl(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),i=this.spawn(),a=e,o=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.merge(a):n.push(a)}};return o(this,a,n),o(a,this,r),{left:n,right:r,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(nl(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i];this.has(a)||r.push(a)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&nl(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var l=this.length++;this[l]=o,i.set(s,{ele:o,index:l})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&nl(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=0;r<this.length;r++){var i=this[r],a=t?e.apply(t,[i,r,this]):e(i,r,this);n.push(a)}return n},reduce:function(e,t){for(var n=t,r=0;r<this.length;r++)n=e(n,this[r],r,this);return n},max:function(e,t){for(var n,r=-1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o>r&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o<r&&(r=o,n=a)}return{value:r,ele:n}}};o3.u=o3["|"]=o3["+"]=o3.union=o3.or=o3.add,o3["\\"]=o3["!"]=o3["-"]=o3.difference=o3.relativeComplement=o3.subtract=o3.not,o3.n=o3["&"]=o3["."]=o3.and=o3.intersection=o3.intersect,o3["^"]=o3["(+)"]=o3["(-)"]=o3.symmetricDifference=o3.symdiff=o3.xor,o3.fnFilter=o3.filterFn=o3.stdFilter=o3.filter,o3.complement=o3.abscomp=o3.absoluteComplement;var o4=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?n?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?rt:0}var i=r(e)-r(t);if(0!==i)return i;function a(e){return"auto"===e.pstyle("z-index-compare").value?+!!e.isNode():0}var o=a(e)-a(t);if(0!==o)return o;var s=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==s?s:e.poolIndex()-t.poolIndex()},o6={forEach:function(e,t){if(nc(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if(!1===(t?e.apply(t,[i,r,this]):e(i,r,this)))break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;null==t&&(t=r),null==e&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!nc(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(o4)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:rt-1}var r=t.source,i=t.target;return Math.max(r.zDepth(),i.zDepth(),0)}}};o6.each=o6.forEach,("u"<typeof Symbol?"undefined":t9(Symbol))!="undefined"&&"undefined"!=t9(Symbol.iterator)&&(o6[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return t4({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})});var o8=rf({nodeDimensionsIncludeLabels:!1}),o7={layoutDimensions:function(e){if(e=o8(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var t,n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};else t={w:0,h:0};return(0===t.w||0===t.h)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter(function(e){return!e.isParent()}),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=nw(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(e,t,n){var r={x:t.x1+t.w/2,y:t.y1+t.h/2},i={x:(n.x-r.x)*e,y:(n.y-r.y)*e};return{x:r.x+i.x,y:r.y+i.y}},c=t.spacingFactor&&1!==t.spacingFactor,u=function(){if(!c)return null;for(var e=rJ(),t=0;t<r.length;t++){var n=s(r[t],t);r2(e,n.x,n.y)}return e}(),d=nw(function(e,n){var r=s(e,n);return c&&(r=l(Math.abs(t.spacingFactor),u,r)),null!=t.transform&&(r=t.transform(e,r)),r},o);if(t.animate){for(var h=0;h<r.length;h++){var f=r[h],p=d(f,h);if(null==t.animateFilter||t.animateFilter(f,h)){var g=f.animation({position:p,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else f.position(p)}if(t.fit){var v=i.animation({fit:{boundingBox:a.boundingBoxAt(d),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(v)}else if(void 0!==t.zoom&&void 0!==t.pan){var x=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(x)}e.animations.forEach(function(e){return e.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),aI.all(e.animations.map(function(e){return e.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else r.positions(d),t.fit&&i.fit(t.eles,t.padding),null!=t.zoom&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout(nP({},e,{eles:this}))}};function o9(e,t,n){var r,i=n._private,a=i.styleCache=i.styleCache||[];return null!=(r=a[e])?r:r=a[e]=t(n)}function se(e,t){return e=n4(e),function(n){return o9(e,t,n)}}function st(e,t){e=n4(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return o9(e,n,t)}}o7.createLayout=o7.makeLayout=o7.layout;var sn={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),n=function(e){return e._private.styleCache=null};return t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(n)):this.forEach(function(e){n(e),e.connectedEdges().forEach(n)}),this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=t.hasCompoundNodes(),r=this;e=!!e||void 0===e,n&&(r=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var i=r;return e?i.emitAndNotify("style"):i.emit("style"),r.forEach(function(e){return e._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n));var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(nd(e))r.applyBypass(this,e,!1),this.emitAndNotify("style");else if(nl(e))if(void 0===t){var i=this[0];return i?r.getStylePropertyValue(i,e):void 0}else r.applyBypass(this,e,t,!1),this.emitAndNotify("style");else if(void 0===e){var a=this[0];return a?r.getRawStyle(a):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r<this.length;r++){var i=this[r];n.removeAllBypasses(i,!1)}else{e=e.split(/\s+/);for(var a=0;a<this.length;a++){var o=this[a];n.removeBypasses(o,e,!1)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle("opacity").value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++)i*=a[o].pstyle("opacity").value;return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();if(e)if(!t)return 0===e.pstyle("opacity").value;else return 0===e.effectiveOpacity()},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function sr(e,t){var n=e._private.data.parent?e.parents():null;if(n){for(var r=0;r<n.length;r++)if(!t(n[r]))return!1}return!0}function si(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||sr(i,r);var s=o.source,l=o.target;return n(s)&&(!a||sr(s,n))&&(s===l||n(l)&&(!a||sr(l,n)))}}}var sa=se("eleTakesUpSpace",function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())});sn.takesUpSpace=st("takesUpSpace",si({ok:sa})),sn.interactive=st("interactive",si({ok:se("eleInteractive",function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&sa(e)}),parentOk:se("parentInteractive",function(e){return"visible"===e.pstyle("visibility").value&&sa(e)}),edgeOkViaNode:sa})),sn.noninteractive=function(){var e=this[0];if(e)return!e.interactive()},sn.visible=st("visible",si({ok:se("eleVisible",function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&sa(e)}),edgeOkViaNode:sa})),sn.hidden=function(){var e=this[0];if(e)return!e.visible()},sn.isBundledBezier=st("isBundledBezier",function(){return!!this.cy().styleEnabled()&&!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace()}),sn.bypass=sn.css=sn.style,sn.renderedCss=sn.renderedStyle,sn.removeBypass=sn.removeCss=sn.removeStyle,sn.pstyle=sn.parsedStyle;var so={};function ss(e){return function(){var t=arguments,n=[];if(2===t.length){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(1===t.length&&nc(t[0])){var a=t[0];this.on(e.event,a)}else if(0===t.length||1===t.length&&nu(t[0])){for(var o=1===t.length?t[0]:null,s=0;s<this.length;s++){var l=this[s],c=!e.ableField||l._private[e.ableField],u=l._private[e.field]!=e.value;if(e.overrideAble){var d=e.overrideAble(l);if(void 0!==d&&(c=d,!d))return this}c&&(l._private[e.field]=e.value,u&&n.push(l))}var h=this.spawn(n);h.updateStyle(),h.emit(e.event),o&&h.emit(o)}return this}}function sl(e){so[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(void 0!==n)return n}return t._private[e.field]}},so[e.on]=ss({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),so[e.off]=ss({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}sl({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),sl({field:"grabbable",overrideField:function(e){return!(e.cy().autoungrabify()||e.pannable())&&void 0},on:"grabify",off:"ungrabify"}),sl({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),sl({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),so.deselect=so.unselect,so.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},sl({field:"active",on:"activate",off:"unactivate"}),sl({field:"pannable",on:"panify",off:"unpanify"}),so.inactive=function(){var e=this[0];if(e)return!e._private.active};var sc={},su=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode()){for(var a=!1,o=i.connectedEdges(),s=0;s<o.length;s++){var l=o[s],c=l.source(),u=l.target();if(e.noIncomingEdges&&u===i&&c!==i||e.noOutgoingEdges&&c===i&&u!==i){a=!0;break}}a||n.push(i)}}return this.spawn(n,!0).filter(t)}},sd=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode())for(var a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),c=s.target();e.outgoing&&l===i?(n.push(s),n.push(c)):e.incoming&&c===i&&(n.push(s),n.push(l))}}return this.spawn(n,!0).filter(t)}},sh=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(0===a.length)break;for(var o=!1,s=0;s<a.length;s++){var l=a[s],c=l.id();i[c]||(i[c]=!0,r.push(l),o=!0)}if(!o)break;n=a}return this.spawn(r,!0).filter(t)}};function sf(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,!0).filter(t)}}function sp(e){return function(t){var n=[],r=this._private.cy,i=e||{};nl(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var l=o[s],c=l._private.data,u=this.hasElementWithId(c.source)&&t.hasElementWithId(c.target),d=t.hasElementWithId(c.source)&&this.hasElementWithId(c.target);if(u||d){if((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!u||i.thisIsTgt&&!d))continue;n.push(l)}}return this.spawn(n,!0)}}function sm(e){return e=nP({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,l=s._private.data.id,c=o.data.target,u=s._private.edges,d=0;d<u.length;d++){var h=u[d],f=h._private.data,p=f.target,g=f.source,v=p===c&&g===l,x=l===p&&c===g;(i.codirected&&v||!i.codirected&&(v||x))&&n.push(h)}return this.spawn(n,!0).filter(t)}}sc.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},nP(sc,{roots:su({noIncomingEdges:!0}),leaves:su({noOutgoingEdges:!0}),outgoers:ou(sd({outgoing:!0}),"outgoers"),successors:sh({outgoing:!0}),incomers:ou(sd({incoming:!0}),"incomers"),predecessors:sh({})}),nP(sc,{neighborhood:ou(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),c=s.target(),u=i===l?c:l;u.length>0&&t.push(u[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),sc.neighbourhood=sc.neighborhood,sc.closedNeighbourhood=sc.closedNeighborhood,sc.openNeighbourhood=sc.openNeighborhood,nP(sc,{source:ou(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:ou(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:sf({attr:"source"}),targets:sf({attr:"target"})}),nP(sc,{edgesWith:ou(sp(),"edgesWith"),edgesTo:ou(sp({thisIsSrc:!0}),"edgesTo")}),nP(sc,{connectedEdges:ou(function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];if(r.isNode())for(var i=r._private.edges,a=0;a<i.length;a++){var o=i[a];t.push(o)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:ou(function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];r.isEdge()&&(t.push(r.source()[0]),t.push(r.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:ou(sm(),"parallelEdges"),codirectedEdges:ou(sm({codirected:!0}),"codirectedEdges")}),nP(sc,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=null==e?t.nodes():e.nodes(),a=[];null!=e&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();do!function(){var e=n.collection();a.push(e);var r=i[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach(function(n){n.connectedEdges().forEach(function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)})})}();while(i.length>0)return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),sc.componentsOf=sc.components;var sg=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0===e)return void ro("A collection must have a reference to the core");var i=new rb,a=!1;if(t){if(t.length>0&&nd(t[0])&&!nm(t[0])){a=!0;for(var o=[],s=new rj,l=0,c=t.length;l<c;l++){var u=t[l];null==u.data&&(u.data={});var d=u.data;if(null==d.id)d.id=ru();else if(e.hasElementWithId(d.id)||s.has(d.id))continue;var h=new rN(e,u,!1);o.push(h),s.add(d.id)}t=o}}else t=[];this.length=0;for(var f=0,p=t.length;f<p;f++){var g=t[f][0];if(null!=g){var v=g._private.data.id;(!n||!i.has(v))&&(n&&i.set(v,{index:this.length,ele:g}),this[this.length]=g,this.length++)}}this._private={eles:this,cy:e,get map(){return null==this.lazyMap&&this.rebuildMap(),this.lazyMap},set map(m){this.lazyMap=m},rebuildMap:function(){for(var e=this.lazyMap=new rb,t=this.eles,n=0;n<t.length;n++){var r=t[n];e.set(r.id(),{index:n,ele:r})}}},n&&(this._private.map=i),a&&!r&&this.restore()},sv=rN.prototype=sg.prototype=Object.create(Array.prototype);sv.instanceString=function(){return"collection"},sv.spawn=function(e,t){return new sg(this.cy(),e,t)},sv.spawnSelf=function(){return this.spawn(this)},sv.cy=function(){return this._private.cy},sv.renderer=function(){return this._private.cy.renderer()},sv.element=function(){return this[0]},sv.collection=function(){return ng(this)?this:new sg(this._private.cy,[this])},sv.unique=function(){return new sg(this._private.cy,this,!0)},sv.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},sv.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new sg(t)},sv.$id=sv.getElementById,sv.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},sv.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},sv.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},sv.json=function(e){var t=this.element(),n=this.cy();if(null==t&&e)return this;if(null!=t){var r=t._private;if(nd(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,l=e.data.target;null!=s&&s!=i.source&&(o.source=""+s,a=!0),null!=l&&l!=i.target&&(o.target=""+l,a=!0),a&&(t=t.move(o))}else{var c="parent"in e.data,u=e.data.parent;c&&(null!=u||null!=i.parent)&&u!=i.parent&&(void 0===u&&(u=null),null!=u&&(u=""+u),t=t.move({parent:u}))}}e.position&&t.position(e.position);var d=function(n,i,a){var o=e[n];null!=o&&o!==r[n]&&(o?t[i]():t[a]())};return d("removed","remove","restore"),d("selected","select","unselect"),d("selectable","selectify","unselectify"),d("locked","lock","unlock"),d("grabbable","grabify","ungrabify"),d("pannable","panify","unpanify"),null!=e.classes&&t.classes(e.classes),n.endBatch(),this}if(void 0===e){var h={data:rc(r.data),position:rc(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};h.classes="";var f=0;return r.classes.forEach(function(e){return h.classes+=0==f++?e:" "+e}),h}}},sv.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},sv.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=new rN(e,this[n].json(),!1);t.push(r)}return new sg(e,t)},sv.copy=sv.clone,sv.restore=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.cy(),r=n._private,i=[],a=[],o=0,s=this.length;o<s;o++){var l=this[o];(!t||l.removed())&&(l.isNode()?i.push(l):a.push(l))}O=i.concat(a);var c=function(){O.splice(M,1),M--};for(M=0;M<O.length;M++){var u=O[M],d=u._private,h=d.data;if(u.clearTraversalCache(),t||d.removed){if(void 0===h.id)h.id=ru();else if(nh(h.id))h.id=""+h.id;else if(ny(h.id)||!nl(h.id)){ro("Can not create element with invalid string ID `"+h.id+"`"),c();continue}else if(n.hasElementWithId(h.id)){ro("Can not create second element with ID `"+h.id+"`"),c();continue}}var f=h.id;if(u.isNode()){var p=d.position;null==p.x&&(p.x=0),null==p.y&&(p.y=0)}if(u.isEdge()){for(var g=["source","target"],v=g.length,x=!1,y=0;y<v;y++){var b=g[y],w=h[b];nh(w)&&(w=h[b]=""+h[b]),null==w||""===w?(ro("Can not create edge `"+f+"` with unspecified "+b),x=!0):n.hasElementWithId(w)||(ro("Can not create edge `"+f+"` with nonexistant "+b+" `"+w+"`"),x=!0)}if(x){c();continue}var j=n.getElementById(h.source),N=n.getElementById(h.target);j.same(N)?j._private.edges.push(u):(j._private.edges.push(u),N._private.edges.push(u)),u._private.source=j,u._private.target=N}d.map=new rb,d.map.set(f,{ele:u,index:0}),d.removed=!1,t&&n.addToPool(u)}for(var k=0;k<i.length;k++){var C=i[k],E=C._private.data;nh(E.parent)&&(E.parent=""+E.parent);var _=E.parent;if(null!=_||C._private.parent){var S=C._private.parent?n.collection().merge(C._private.parent):n.getElementById(_);if(S.empty())E.parent=void 0;else if(S[0].removed())rl("Node added with missing parent, reference to parent removed"),E.parent=void 0,C._private.parent=null;else{for(var T=!1,A=S;!A.empty();){if(C.same(A)){T=!0,E.parent=void 0;break}A=A.parent()}T||(S[0]._private.children.push(C),C._private.parent=S[0],r.hasCompoundNodes=!0)}}}if(O.length>0){for(var O,M,P,D=O.length===this.length?this:new sg(n,O),L=0;L<D.length;L++){var I=D[L];I.isNode()||(I.parallelEdges().clearTraversalCache(),I.source().clearTraversalCache(),I.target().clearTraversalCache())}(r.hasCompoundNodes?n.collection().merge(D).merge(D.connectedNodes()).merge(D.parent()):D).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?D.emitAndNotify("add"):t&&D.emit("add")}return this},sv.removed=function(){var e=this[0];return e&&e._private.removed},sv.inside=function(){var e=this[0];return e&&!e._private.removed},sv.remove=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=[],r={},i=this._private.cy,a=0,o=this.length;a<o;a++)!function e(i){var a=r[i.id()];if(!(t&&i.removed())&&!a)if(r[i.id()]=!0,i.isNode()){n.push(i);for(var o=i._private.edges,s=0;s<o.length;s++)e(o[s]);for(var l=i._private.children,c=0;c<l.length;c++)e(l[c])}else n.unshift(i)}(this[a]);function s(e,t){rp(e._private.edges,t),e.clearTraversalCache()}var l=[];l.ids={},this.dirtyCompoundBoundsCache(),t&&i.removeFromPool(n);for(var c=0;c<n.length;c++){var u=n[c];if(u.isEdge()){var d=u.source()[0],h=u.target()[0];s(d,u),s(h,u);for(var f=u.parallelEdges(),p=0;p<f.length;p++){var g=f[p];g.clearTraversalCache(),g.isBundledBezier()&&g.dirtyBoundingBoxCache()}}else{var v=u.parent();0!==v.length&&function(e,t){t=t[0];var n=(e=e[0])._private.children,r=e.id();rp(n,t),t._private.parent=null,l.ids[r]||(l.ids[r]=!0,l.push(e))}(v,u)}t&&(u._private.removed=!0)}var x=i._private.elements;i._private.hasCompoundNodes=!1;for(var y=0;y<x.length;y++)if(x[y].isParent()){i._private.hasCompoundNodes=!0;break}var b=new sg(this.cy(),n);b.size()>0&&(e?b.emitAndNotify("remove"):t&&b.emit("remove"));for(var w=0;w<l.length;w++){var j=l[w];t&&j.removed()||j.updateStyle()}return b},sv.move=function(e){var t=this._private.cy,n=this,r=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var i=r(e.source),a=r(e.target),o=null!=i&&t.hasElementWithId(i),s=null!=a&&t.hasElementWithId(a);(o||s)&&(t.batch(function(){n.remove(!1,!1),n.emitAndNotify("moveout");for(var e=0;e<n.length;e++){var t=n[e],r=t._private.data;t.isEdge()&&(o&&(r.source=i),s&&(r.target=a))}n.restore(!1,!1)}),n.emitAndNotify("move"))}else if(void 0!==e.parent){var l=r(e.parent);if(null===l||t.hasElementWithId(l)){var c=null===l?void 0:l;t.batch(function(){var e=n.remove(!1,!1);e.emitAndNotify("moveout");for(var t=0;t<n.length;t++){var r=n[t],i=r._private.data;r.isNode()&&(i.parent=c)}e.restore(!1,!1)}),n.emitAndNotify("move")}}return this},[aT,a0,a1,oc,od,uF,og,oU,o5,o3,{isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},o6,o7,sn,so,sc].forEach(function(e){nP(sv,e)});var sx=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}return function n(r,i,a){var o,s,l,c,u,d,h,f,p,g,v,x={x:-1,v:0,tension:null,friction:null},y=[0],b=0;for(r=parseFloat(r)||500,i=parseFloat(i)||20,a=a||null,x.tension=r,x.friction=i,g=(p=null!==a)?(b=n(r,i))/a*.016:.016;o=v||x,s=g,l={dx:o.v,dv:e(o)},c=t(o,.5*s,l),u=t(o,.5*s,c),d=t(o,s,u),h=1/6*(l.dx+2*(c.dx+u.dx)+d.dx),f=1/6*(l.dv+2*(c.dv+u.dv)+d.dv),o.x=o.x+h*s,o.v=o.v+f*s,v=o,y.push(1+v.x),b+=16,Math.abs(v.x)>1e-4&&Math.abs(v.v)>1e-4;);return p?function(e){return y[e*(y.length-1)|0]}:b}}(),sy=function(e,t,n,r){var i=function(e,t,n,r){var i="u">typeof Float32Array;if(4!=arguments.length)return!1;for(var a=0;a<4;++a)if("number"!=typeof arguments[a]||isNaN(arguments[a])||!isFinite(arguments[a]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var o=i?new Float32Array(11):Array(11);function s(e,t,n){return(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e}function l(e,t,n){return 3*(1-3*n+3*t)*e*e+2*(3*n-6*t)*e+3*t}var c=!1,u=function(i){return(c||(c=!0,(e!==t||n!==r)&&function(){for(var t=0;t<11;++t)o[t]=s(.1*t,e,n)}()),e===t&&n===r)?i:0===i?0:1===i?1:s(function(t){for(var r=0,i=1;10!==i&&o[i]<=t;++i)r+=.1;var a=r+(t-o[--i])/(o[i+1]-o[i])*.1,c=l(a,e,n);if(c>=.001){for(var u=a,d=0;d<4;++d){var h=l(u,e,n);if(0===h)break;var f=s(u,e,n)-t;u-=f/h}return u}return 0===c?a:function(t,r,i){var a,o,l=0;do(a=s(o=r+(i-r)/2,e,n)-t)>0?i=o:r=o;while(Math.abs(a)>1e-7&&++l<10)return o}(t,r,r+.1)}(i),t,r)};u.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var d="generateBezier("+[e,t,n,r]+")";return u.toString=function(){return d},u}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},sb={linear:function(e,t,n){return e+(t-e)*n},ease:sy(.25,.1,.25,1),"ease-in":sy(.42,0,1,1),"ease-out":sy(0,0,.58,1),"ease-in-out":sy(.42,0,.58,1),"ease-in-sine":sy(.47,0,.745,.715),"ease-out-sine":sy(.39,.575,.565,1),"ease-in-out-sine":sy(.445,.05,.55,.95),"ease-in-quad":sy(.55,.085,.68,.53),"ease-out-quad":sy(.25,.46,.45,.94),"ease-in-out-quad":sy(.455,.03,.515,.955),"ease-in-cubic":sy(.55,.055,.675,.19),"ease-out-cubic":sy(.215,.61,.355,1),"ease-in-out-cubic":sy(.645,.045,.355,1),"ease-in-quart":sy(.895,.03,.685,.22),"ease-out-quart":sy(.165,.84,.44,1),"ease-in-out-quart":sy(.77,0,.175,1),"ease-in-quint":sy(.755,.05,.855,.06),"ease-out-quint":sy(.23,1,.32,1),"ease-in-out-quint":sy(.86,0,.07,1),"ease-in-expo":sy(.95,.05,.795,.035),"ease-out-expo":sy(.19,1,.22,1),"ease-in-out-expo":sy(1,0,0,1),"ease-in-circ":sy(.6,.04,.98,.335),"ease-out-circ":sy(.075,.82,.165,1),"ease-in-out-circ":sy(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return sb.linear;var r=sx(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":sy};function sw(e,t,n,r,i){if(1===r||t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function sj(e,t){return null==e.pfValue&&null==e.value?e:null!=e.pfValue&&(null==t||"%"!==t.type.units)?e.pfValue:e.value}function sN(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=sj(e,i),s=sj(t,i);if(nh(o)&&nh(s))return sw(a,o,s,n,r);if(nu(o)&&nu(s)){for(var l=[],c=0;c<s.length;c++){var u=o[c],d=s[c];if(null!=u&&null!=d){var h=sw(a,u,d,n,r);l.push(h)}else l.push(d)}return l}}function sk(e,t){return null!=e&&null!=t&&(!!(nh(e)&&nh(t))||!!e&&!!t)}function sC(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(0===a.length){var l=o.shift();l&&a.push(l)}for(var c=function(e){for(var t=e.length-1;t>=0;t--)(0,e[t])();e.splice(0,e.length)},u=a.length-1;u>=0;u--){var d=a[u],h=d._private;if(h.stopped){a.splice(u,1),h.hooked=!1,h.playing=!1,h.started=!1,c(h.frames);continue}(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||function(e,t){var n=e._private;n.started=!0,n.startTime=t-n.progress*n.duration}(d,e),function(e,t,n,r){var i,a,o,s,l=!r,c=e._private,u=t._private,d=u.easing,h=u.startTime,f=(r?e:e.cy()).style();u.easingImpl||(null==d?u.easingImpl=sb.linear:(i=nl(d)?f.parse("transition-timing-function",d).value:d,nl(i)?(a=i,o=[]):(a=i[1],o=i.slice(2).map(function(e){return+e})),o.length>0?("spring"===a&&o.push(u.duration),u.easingImpl=sb[a].apply(null,o)):u.easingImpl=sb[a]));var p=u.easingImpl;if(s=0===u.duration?1:(n-h)/u.duration,u.applying&&(s=u.progress),s<0?s=0:s>1&&(s=1),null==u.delay){var g=u.startPosition,v=u.position;if(v&&l&&!e.locked()){var x={};sk(g.x,v.x)&&(x.x=sN(g.x,v.x,s,p)),sk(g.y,v.y)&&(x.y=sN(g.y,v.y,s,p)),e.position(x)}var y=u.startPan,b=u.pan,w=c.pan,j=null!=b&&r;j&&(sk(y.x,b.x)&&(w.x=sN(y.x,b.x,s,p)),sk(y.y,b.y)&&(w.y=sN(y.y,b.y,s,p)),e.emit("pan"));var N=u.startZoom,k=u.zoom,C=null!=k&&r;C&&(sk(N,k)&&(c.zoom=rQ(c.minZoom,sN(N,k,s,p),c.maxZoom)),e.emit("zoom")),(j||C)&&e.emit("viewport");var E=u.style;if(E&&E.length>0&&l){for(var _=0;_<E.length;_++){var S=E[_],T=S.name,A=u.startStyle[T],O=f.properties[A.name],M=sN(A,S,s,p,O);f.overrideBypass(e,T,M)}e.emit("style")}}u.progress=s}(t,d,e,n),h.applying&&(h.applying=!1),c(h.frames),null!=h.step&&h.step(e),d.completed()&&(a.splice(u,1),h.hooked=!1,h.playing=!1,h.started=!1,c(h.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=i(n[o]);a=a||s}var l=i(t,!0);(a||l)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var sE={animate:aJ.animate(),animation:aJ.animation(),animated:aJ.animated(),clearQueue:aJ.clearQueue(),delay:aJ.delay(),delayAnimation:aJ.delayAnimation(),stop:aJ.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(t,n){sC(n,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&nQ(function(n){sC(n,e),t()})}()}}},s_={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&nm(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},sS=function(e){return nl(e)?new os(e):e},sT={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new oK(s_,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,sS(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,sS(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,sS(t),n),this},once:function(e,t,n){return this.emitter().one(e,sS(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};aJ.eventAliasesOn(sT);var sA={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};sA.jpeg=sA.jpg;var sO={layout:function(e){if(null==e)return void ro("Layout options must be specified to make a layout");if(null==e.name)return void ro("A `name` must be specified to make a layout");var t,n=e.name,r=this.extension("layout",n);return null==r?void ro("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?"):(t=nl(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$(),new r(nP({},e,{cy:this,eles:t})))}};sO.createLayout=sO.makeLayout=sO.layout;var sM=rf({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),sP={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this.extension("renderer",e.name);if(null==t)return void ro("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));void 0!==e.wheelSensitivity&&rl("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=sM(e);n.cy=this,this._private.renderer=new t(n),this.notify("init")},destroyRenderer:function(){this.notify("destroy");var e=this.container();if(e)for(e._cyreg=null;e.childNodes.length>0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};sP.invalidateDimensions=sP.resize;var sD={collection:function(e,t){return nl(e)?this.$(e):np(e)?e.collection():nu(e)?(t||(t={}),new sg(this,e,t.unique,t.removed)):new sg(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};sD.elements=sD.filter=sD.$;var sL={};sL.apply=function(e){for(var t=this._private.cy.collection(),n=0;n<e.length;n++){var r=e[n],i=this.getContextMeta(r);if(!i.empty){var a=this.getContextStyle(i),o=this.applyContextStyle(i,a,r);r._private.appliedInitStyle?this.updateTransitions(r,o.diffProps):r._private.appliedInitStyle=!0,this.updateStyleHints(r)&&t.push(r)}}return t},sL.getPropertiesDiff=function(e,t){var n=this._private.propDiffs=this._private.propDiffs||{},r=e+"-"+t,i=n[r];if(i)return i;for(var a=[],o={},s=0;s<this.length;s++){var l=this[s],c="t"===e[s],u="t"===t[s],d=c!==u,h=l.mappedProperties.length>0;if(d||u&&h){var f=void 0;d&&h||d?f=l.properties:h&&(f=l.mappedProperties);for(var p=0;p<f.length;p++){for(var g=f[p],v=g.name,x=!1,y=s+1;y<this.length;y++){var b=this[y];if("t"===t[y]&&(x=null!=b.properties[g.name]))break}o[v]||x||(o[v]=!0,a.push(v))}}}return n[r]=a,a},sL.getContextMeta=function(e){for(var t,n="",r=e._private.styleCxtKey||"",i=0;i<this.length;i++){var a=this[i];a.selector&&a.selector.matches(e)?n+="t":n+="f"}return t=this.getPropertiesDiff(r,n),e._private.styleCxtKey=n,{key:n,diffPropNames:t,empty:0===t.length}},sL.getContextStyle=function(e){var t=e.key,n=this._private.contextStyles=this._private.contextStyles||{};if(n[t])return n[t];for(var r={_private:{key:t}},i=0;i<this.length;i++){var a=this[i];if("t"===t[i])for(var o=0;o<a.properties.length;o++){var s=a.properties[o];r[s.name]=s}}return n[t]=r,r},sL.applyContextStyle=function(e,t,n){for(var r=e.diffPropNames,i={},a=this.types,o=0;o<r.length;o++){var s=r[o],l=t[s],c=n.pstyle(s);if(!l)if(!c)continue;else l=c.bypass?{name:s,deleteBypassed:!0}:{name:s,delete:!0};if(c!==l){if(l.mapped===a.fn&&null!=c&&null!=c.mapping&&c.mapping.value===l.value){var u=c.mapping;if((u.fnValue=l.value(n))===u.prevFnValue)continue}var d=i[s]={prev:c};this.applyParsedProperty(n,l),d.next=n.pstyle(s),d.next&&d.next.bypass&&(d.next=d.next.bypassed)}}return{diffProps:i}},sL.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,l=e._private.style;r=Object.keys(l);for(var c=0;c<i.length;c++){var u=i[c];t.styleKeys[u]=[9261,5381]}for(var d=function(e,n){return t.styleKeys[n][0]=n0(e,t.styleKeys[n][0])},h=function(e,n){return t.styleKeys[n][1]=n1(e,t.styleKeys[n][1])},f=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);d(r,t),h(r,t)}},p=0;p<r.length;p++){var g=r[p],v=l[g];if(null!=v){var x,y,b=this.properties[g],w=b.type,j=b.groupKey,N=void 0;null!=b.hashOverride?N=b.hashOverride(e,v):null!=v.pfValue&&(N=v.pfValue);var k=null==b.enums?v.value:null,C=null!=N,E=null!=k,_=C||E,S=v.units;w.number&&_&&!w.multiple?(d(y=-128<(x=C?N:k)&&x<128&&Math.floor(x)!==x?2e9-(1024*x|0):x,j),h(y,j),C||null==S||f(S,j)):f(v.strValue,j)}}for(var T=[9261,5381],A=0;A<i.length;A++){var O=i[A],M=t.styleKeys[O];T[0]=n0(M[0],T[0]),T[1]=n1(M[1],T[1])}t.styleKey=2097152*T[0]+T[1];var P=t.styleKeys;t.labelDimsKey=n2(P.labelDimensions);var D=a(e,["label"],P.labelDimensions);if(t.labelKey=n2(D),t.labelStyleKey=n2(n5(P.commonLabel,D)),!s){var L=a(e,["source-label"],P.labelDimensions);t.sourceLabelKey=n2(L),t.sourceLabelStyleKey=n2(n5(P.commonLabel,L));var I=a(e,["target-label"],P.labelDimensions);t.targetLabelKey=n2(I),t.targetLabelStyleKey=n2(n5(P.commonLabel,I))}if(s){var R=t.styleKeys,B=R.nodeBody,z=R.nodeBorder,F=R.nodeOutline,V=R.backgroundImage,U=R.compound,H=R.pie,W=R.stripe;t.nodeKey=n2([B,z,F,V,U,H,W].filter(function(e){return null!=e}).reduce(n5,[9261,5381])),t.hasPie=null!=H&&9261!==H[0]&&5381!==H[1],t.hasStripe=null!=W&&9261!==W[0]&&5381!==W[1]}return o!==t.styleKey},sL.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null,t.hasStripe=null},sL.applyParsedProperty=function(e,t){var n=this,r=t,i=e._private.style,a=n.types,o=n.properties[r.name].type,s=r.bypass,l=i[r.name],c=l&&l.bypass,u=e._private,d="mapping",h=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},f=function(){var t=h(l),i=h(r);n.checkTriggers(e,r.name,t,i)};if("curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,"bezier",s)),r.delete)return i[r.name]=void 0,f(),!0;if(r.deleteBypassed)if(!l)return f(),!0;else if(l.bypass)return l.bypassed=void 0,f(),!0;else return!1;if(r.deleteBypass)if(!l)return f(),!0;else if(l.bypass)return i[r.name]=l.bypassed,f(),!0;else return!1;var p=function(){rl("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case a.mapData:for(var g,v,x=r.field.split("."),y=u.data,b=0;b<x.length&&y;b++)y=y[x[b]];if(null==y)return p(),!1;if(!nh(y))return rl("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+": "+y+"` for `"+e.id()+"` is non-numeric)"),!1;var w=r.fieldMax-r.fieldMin;if((v=0===w?0:(y-r.fieldMin)/w)<0?v=0:v>1&&(v=1),o.color){var j=r.valueMin[0],N=r.valueMax[0],k=r.valueMin[1],C=r.valueMax[1],E=r.valueMin[2],_=r.valueMax[2],S=null==r.valueMin[3]?1:r.valueMin[3],T=[Math.round(j+(N-j)*v),Math.round(k+(C-k)*v),Math.round(E+(_-E)*v),Math.round(S+((null==r.valueMax[3]?1:r.valueMax[3])-S)*v)];g={bypass:r.bypass,name:r.name,value:T,strValue:"rgb("+T[0]+", "+T[1]+", "+T[2]+")"}}else{if(!o.number)return!1;var A=r.valueMin+(r.valueMax-r.valueMin)*v;g=this.parse(r.name,A,r.bypass,d)}if(!g)return p(),!1;g.mapping=r,r=g;break;case a.data:for(var O=r.field.split("."),M=u.data,P=0;P<O.length&&M;P++)M=M[O[P]];if(null!=M&&(g=this.parse(r.name,M,r.bypass,d)),!g)return p(),!1;g.mapping=r,r=g;break;case a.fn:var D=r.value,L=null!=r.fnValue?r.fnValue:D(e);if(r.prevFnValue=L,null==L)return rl("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(g=this.parse(r.name,L,r.bypass,d)))return rl("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;g.mapping=rc(r),r=g;break;case void 0:break;default:return!1}return s?(c?r.bypassed=l.bypassed:r.bypassed=l,i[r.name]=r):c?l.bypassed=r:i[r.name]=r,f(),!0},sL.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),t)for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],l=i[s];null!=l&&(l.bypass?l.bypassed=null:i[s]=null)}else r._private.style={}}},sL.update=function(){this._private.cy.mutableElements().updateStyle()},sL.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var s={},l=!1,c=0;c<i.length;c++){var u=i[c],d=e.pstyle(u),h=t[u];if(h){var f=h.prev,p=null!=h.next?h.next:d,g=!1,v=void 0;f&&(nh(f.pfValue)&&nh(p.pfValue)?(g=p.pfValue-f.pfValue,v=f.pfValue+1e-6*g):nh(f.value)&&nh(p.value)?(g=p.value-f.value,v=f.value+1e-6*g):nu(f.value)&&nu(p.value)&&(g=f.value[0]!==p.value[0]||f.value[1]!==p.value[1]||f.value[2]!==p.value[2],v=f.strValue),g&&(s[u]=p.strValue,this.applyBypass(e,u,v),l=!0))}}if(!l)return;r.transitioning=!0,new aI(function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},sL.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);!e.removed()&&null!=s&&s(n,r,e)&&a(o)},sL.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){i._private.cy.notify("zorder",e)})},sL.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},sL.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},sL.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},sL.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var sI={};sI.applyBypass=function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;a<this.properties.length;a++){var o=this.properties[a].name,s=this.parse(o,n,!0);s&&i.push(s)}}else if(nl(t)){var l=this.parse(t,n,!0);l&&i.push(l)}else{if(!nd(t))return!1;r=n;for(var c=Object.keys(t),u=0;u<c.length;u++){var d=c[u],h=t[d];if(void 0===h&&(h=t[nN(d)]),void 0!==h){var f=this.parse(d,h,!0);f&&i.push(f)}}}if(0===i.length)return!1;for(var p=!1,g=0;g<e.length;g++){for(var v=e[g],x={},y=void 0,b=0;b<i.length;b++){var w=i[b];if(r){var j=v.pstyle(w.name);y=x[w.name]={prev:j}}p=this.applyParsedProperty(v,rc(w))||p,r&&(y.next=v.pstyle(w.name))}p&&this.updateStyleHints(v),r&&this.updateTransitions(v,x,!0)}return p},sI.overrideBypass=function(e,t,n){t=nj(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,l=o.mutiple,c=a?null!=a.pfValue?a.pfValue:a.value:null;a&&a.bypass?(a.value=n,null!=a.pfValue&&(a.pfValue=n),s?a.strValue="rgb("+n.join(",")+")":l?a.strValue=n.join(" "):a.strValue=""+n,this.updateStyleHints(i)):this.applyBypass(i,t,n),this.checkTriggers(i,t,c,n)}},sI.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},sI.removeBypasses=function(e,t,n){for(var r=0;r<e.length;r++){for(var i=e[r],a={},o=0;o<t.length;o++){var s=t[o],l=this.properties[s],c=i.pstyle(l.name);if(c&&c.bypass){var u=this.parse(s,"",!0),d=a[l.name]={prev:c};this.applyParsedProperty(i,u),d.next=i.pstyle(l.name)}}this.updateStyleHints(i),n&&this.updateTransitions(i,a,!0)}};var sR={};sR.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},sR.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var sB={};sB.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},sB.getRawStyle=function(e,t){if(e=e[0]){for(var n={},r=0;r<this.properties.length;r++){var i=this.properties[r],a=this.getStylePropertyValue(e,i.name,t);null!=a&&(n[i.name]=a,n[nN(i.name)]=a)}return n}},sB.getIndexedStyle=function(e,t,n,r){var i=e.pstyle(t)[n][r];return null!=i?i:e.cy().style().getDefaultProperty(t)[n][0]},sB.getStylePropertyValue=function(e,t,n){if(e=e[0]){var r=this.properties[t];r.alias&&(r=r.pointsTo);var i=r.type,a=e.pstyle(r.name);if(a){var o=a.value,s=a.units,l=a.strValue;if(n&&i.number&&null!=o&&nh(o)){var c=e.cy().zoom(),u=function(e){return e*c},d=function(e,t){return u(e)+t},h=nu(o);if(h?s.every(function(e){return null!=e}):null!=s)if(h)return o.map(function(e,t){return d(e,s[t])}).join(" ");else return d(o,s);return h?o.map(function(e){return nl(e)?e:""+u(e)}).join(" "):""+u(o)}if(null!=l)return l}return null}},sB.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r].name,a=e.pstyle(i);void 0!==a&&(a=nd(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(n[i]=a)}return n},sB.getPropsList=function(e){var t=[],n=this.properties;if(e)for(var r=Object.keys(e),i=0;i<r.length;i++){var a=r[i],o=e[a],s=n[a]||n[nj(a)],l=this.parse(s.name,o);l&&t.push(l)}return t},sB.getNonDefaultPropertiesHash=function(e,t,n){var r,i,a,o,s,l,c=n.slice();for(s=0;s<t.length;s++)if(r=t[s],null!=(i=e.pstyle(r,!1)))if(null!=i.pfValue)c[0]=n0(o,c[0]),c[1]=n1(o,c[1]);else for(l=0,a=i.strValue;l<a.length;l++)o=a.charCodeAt(l),c[0]=n0(o,c[0]),c[1]=n1(o,c[1]);return c},sB.getPropertiesHash=sB.getNonDefaultPropertiesHash;var sz={};sz.appendFromJson=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n.selector,i=n.style||n.css,a=Object.keys(i);this.selector(r);for(var o=0;o<a.length;o++){var s=a[o],l=i[s];this.css(s,l)}}return this},sz.fromJson=function(e){return this.resetToDefault(),this.appendFromJson(e),this},sz.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:a})}return e};var sF={};sF.appendFromString=function(e){var t,n,r,i=""+e;function a(){i=i.length>t.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");!i.match(/^\s*$/);){var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){rl("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l&&new os(l).invalid){rl("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var c=s[2],u=!1;n=c;for(var d=[];!n.match(/^\s*$/);){var h=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!h){rl("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),u=!0;break}r=h[0];var f=h[1],p=h[2];if(!this.properties[f]){rl("Skipping property: Invalid property name in: "+r),o();continue}if(!this.parse(f,p)){rl("Skipping property: Invalid property definition in: "+r),o();continue}d.push({name:f,val:p}),o()}if(u){a();break}this.selector(l);for(var g=0;g<d.length;g++){var v=d[g];this.css(v.name,v.val)}a()}return this},sF.fromString=function(e){return this.resetToDefault(),this.appendFromString(e),this};var sV={};!function(){var e=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},t=function(e){var t=n_+"|\\w+|"+nT+"|"+nO+"|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+e+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+n_+")\\s*\\,\\s*("+n_+")\\s*,\\s*("+t+")\\s*\\,\\s*("+t+")\\)$"},n=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];sV.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:e("data")},layoutData:{mapping:!0,regex:e("layoutData")},scratch:{mapping:!0,regex:e("scratch")},mapData:{mapping:!0,regex:t("mapData")},mapLayoutData:{mapping:!0,regex:t("mapLayoutData")},mapScratch:{mapping:!0,regex:t("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:n,singleRegexMatchValue:!0},urls:{regexes:n,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(e,t){switch(e.length){case 2:return"deg"!==t[0]&&"rad"!==t[0]&&"deg"!==t[1]&&"rad"!==t[1];case 1:return nl(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+n_+")\\s*,\\s*("+n_+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+n_+")\\s*,\\s*("+n_+")\\s*,\\s*("+n_+")\\s*,\\s*("+n_+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(e){var t=e.length;return 1===t||2===t||4===t}}};var r=function(e,t){return(null==e||null==t)&&e!==t||0==e&&0!=t||0!=e&&0==t},i=function(e,t){return e!=t},a=sV.types,o=[{name:"label",type:a.text,triggersBounds:i,triggersZOrder:function(e,t){var n=ny(e),r=ny(t);return n&&!r||!n&&r}},{name:"text-rotation",type:a.textRotation,triggersBounds:i},{name:"text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"text-margin-y",type:a.bidirectionalSize,triggersBounds:i}],s=[{name:"source-label",type:a.text,triggersBounds:i},{name:"source-text-rotation",type:a.textRotation,triggersBounds:i},{name:"source-text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"source-text-margin-y",type:a.bidirectionalSize,triggersBounds:i},{name:"source-text-offset",type:a.size,triggersBounds:i}],l=[{name:"target-label",type:a.text,triggersBounds:i},{name:"target-text-rotation",type:a.textRotation,triggersBounds:i},{name:"target-text-margin-x",type:a.bidirectionalSize,triggersBounds:i},{name:"target-text-margin-y",type:a.bidirectionalSize,triggersBounds:i},{name:"target-text-offset",type:a.size,triggersBounds:i}],c=[{name:"font-family",type:a.fontFamily,triggersBounds:i},{name:"font-style",type:a.fontStyle,triggersBounds:i},{name:"font-weight",type:a.fontWeight,triggersBounds:i},{name:"font-size",type:a.size,triggersBounds:i},{name:"text-transform",type:a.textTransform,triggersBounds:i},{name:"text-wrap",type:a.textWrap,triggersBounds:i},{name:"text-overflow-wrap",type:a.textOverflowWrap,triggersBounds:i},{name:"text-max-width",type:a.size,triggersBounds:i},{name:"text-outline-width",type:a.size,triggersBounds:i},{name:"line-height",type:a.positiveNumber,triggersBounds:i}],u=[{name:"text-valign",type:a.valign,triggersBounds:i},{name:"text-halign",type:a.halign,triggersBounds:i},{name:"color",type:a.color},{name:"text-outline-color",type:a.color},{name:"text-outline-opacity",type:a.zeroOneNumber},{name:"text-background-color",type:a.color},{name:"text-background-opacity",type:a.zeroOneNumber},{name:"text-background-padding",type:a.size,triggersBounds:i},{name:"text-border-opacity",type:a.zeroOneNumber},{name:"text-border-color",type:a.color},{name:"text-border-width",type:a.size,triggersBounds:i},{name:"text-border-style",type:a.borderStyle,triggersBounds:i},{name:"text-background-shape",type:a.textBackgroundShape,triggersBounds:i},{name:"text-justification",type:a.justification},{name:"box-select-labels",type:a.bool,triggersBounds:i}],d=[{name:"events",type:a.bool,triggersZOrder:i},{name:"text-events",type:a.bool,triggersZOrder:i},{name:"box-selection",type:a.boxSelection,triggersZOrder:i}],h=[{name:"display",type:a.display,triggersZOrder:i,triggersBounds:i,triggersBoundsOfConnectedEdges:i,triggersBoundsOfParallelEdges:function(e,t,n){return e!==t&&"bezier"===n.pstyle("curve-style").value}},{name:"visibility",type:a.visibility,triggersZOrder:i},{name:"opacity",type:a.zeroOneNumber,triggersZOrder:r},{name:"text-opacity",type:a.zeroOneNumber},{name:"min-zoomed-font-size",type:a.size},{name:"z-compound-depth",type:a.zCompoundDepth,triggersZOrder:i},{name:"z-index-compare",type:a.zIndexCompare,triggersZOrder:i},{name:"z-index",type:a.number,triggersZOrder:i}],f=[{name:"overlay-padding",type:a.size,triggersBounds:i},{name:"overlay-color",type:a.color},{name:"overlay-opacity",type:a.zeroOneNumber,triggersBounds:r},{name:"overlay-shape",type:a.overlayShape,triggersBounds:i},{name:"overlay-corner-radius",type:a.cornerRadius}],p=[{name:"underlay-padding",type:a.size,triggersBounds:i},{name:"underlay-color",type:a.color},{name:"underlay-opacity",type:a.zeroOneNumber,triggersBounds:r},{name:"underlay-shape",type:a.overlayShape,triggersBounds:i},{name:"underlay-corner-radius",type:a.cornerRadius}],g=[{name:"transition-property",type:a.propList},{name:"transition-duration",type:a.time},{name:"transition-delay",type:a.time},{name:"transition-timing-function",type:a.easing}],v=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},x=[{name:"height",type:a.nodeSize,triggersBounds:i,hashOverride:v},{name:"width",type:a.nodeSize,triggersBounds:i,hashOverride:v},{name:"shape",type:a.nodeShape,triggersBounds:i},{name:"shape-polygon-points",type:a.polygonPointList,triggersBounds:i},{name:"corner-radius",type:a.cornerRadius},{name:"background-color",type:a.color},{name:"background-fill",type:a.fill},{name:"background-opacity",type:a.zeroOneNumber},{name:"background-blacken",type:a.nOneOneNumber},{name:"background-gradient-stop-colors",type:a.colors},{name:"background-gradient-stop-positions",type:a.percentages},{name:"background-gradient-direction",type:a.gradientDirection},{name:"padding",type:a.sizeMaybePercent,triggersBounds:i},{name:"padding-relative-to",type:a.paddingRelativeTo,triggersBounds:i},{name:"bounds-expansion",type:a.boundsExpansion,triggersBounds:i}],y=[{name:"border-color",type:a.color},{name:"border-opacity",type:a.zeroOneNumber},{name:"border-width",type:a.size,triggersBounds:i},{name:"border-style",type:a.borderStyle},{name:"border-cap",type:a.lineCap},{name:"border-join",type:a.lineJoin},{name:"border-dash-pattern",type:a.numbers},{name:"border-dash-offset",type:a.number},{name:"border-position",type:a.linePosition}],b=[{name:"outline-color",type:a.color},{name:"outline-opacity",type:a.zeroOneNumber},{name:"outline-width",type:a.size,triggersBounds:i},{name:"outline-style",type:a.borderStyle},{name:"outline-offset",type:a.size,triggersBounds:i}],w=[{name:"background-image",type:a.urls},{name:"background-image-crossorigin",type:a.bgCrossOrigin},{name:"background-image-opacity",type:a.zeroOneNumbers},{name:"background-image-containment",type:a.bgContainment},{name:"background-image-smoothing",type:a.bools},{name:"background-position-x",type:a.bgPos},{name:"background-position-y",type:a.bgPos},{name:"background-width-relative-to",type:a.bgRelativeTo},{name:"background-height-relative-to",type:a.bgRelativeTo},{name:"background-repeat",type:a.bgRepeat},{name:"background-fit",type:a.bgFit},{name:"background-clip",type:a.bgClip},{name:"background-width",type:a.bgWH},{name:"background-height",type:a.bgWH},{name:"background-offset-x",type:a.bgPos},{name:"background-offset-y",type:a.bgPos}],j=[{name:"position",type:a.position,triggersBounds:i},{name:"compound-sizing-wrt-labels",type:a.compoundIncludeLabels,triggersBounds:i},{name:"min-width",type:a.size,triggersBounds:i},{name:"min-width-bias-left",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-width-bias-right",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-height",type:a.size,triggersBounds:i},{name:"min-height-bias-top",type:a.sizeMaybePercent,triggersBounds:i},{name:"min-height-bias-bottom",type:a.sizeMaybePercent,triggersBounds:i}],N=[{name:"line-style",type:a.lineStyle},{name:"line-color",type:a.color},{name:"line-fill",type:a.fill},{name:"line-cap",type:a.lineCap},{name:"line-opacity",type:a.zeroOneNumber},{name:"line-dash-pattern",type:a.numbers},{name:"line-dash-offset",type:a.number},{name:"line-outline-width",type:a.size},{name:"line-outline-color",type:a.color},{name:"line-gradient-stop-colors",type:a.colors},{name:"line-gradient-stop-positions",type:a.percentages},{name:"curve-style",type:a.curveStyle,triggersBounds:i,triggersBoundsOfParallelEdges:function(e,t){return e!==t&&("bezier"===e||"bezier"===t)}},{name:"haystack-radius",type:a.zeroOneNumber,triggersBounds:i},{name:"source-endpoint",type:a.edgeEndpoint,triggersBounds:i},{name:"target-endpoint",type:a.edgeEndpoint,triggersBounds:i},{name:"control-point-step-size",type:a.size,triggersBounds:i},{name:"control-point-distances",type:a.bidirectionalSizes,triggersBounds:i},{name:"control-point-weights",type:a.numbers,triggersBounds:i},{name:"segment-distances",type:a.bidirectionalSizes,triggersBounds:i},{name:"segment-weights",type:a.numbers,triggersBounds:i},{name:"segment-radii",type:a.numbers,triggersBounds:i},{name:"radius-type",type:a.radiusType,triggersBounds:i},{name:"taxi-turn",type:a.bidirectionalSizeMaybePercent,triggersBounds:i},{name:"taxi-turn-min-distance",type:a.size,triggersBounds:i},{name:"taxi-direction",type:a.axisDirection,triggersBounds:i},{name:"taxi-radius",type:a.number,triggersBounds:i},{name:"edge-distances",type:a.edgeDistances,triggersBounds:i},{name:"arrow-scale",type:a.positiveNumber,triggersBounds:i},{name:"loop-direction",type:a.angle,triggersBounds:i},{name:"loop-sweep",type:a.angle,triggersBounds:i},{name:"source-distance-from-node",type:a.size,triggersBounds:i},{name:"target-distance-from-node",type:a.size,triggersBounds:i}],k=[{name:"ghost",type:a.bool,triggersBounds:i},{name:"ghost-offset-x",type:a.bidirectionalSize,triggersBounds:i},{name:"ghost-offset-y",type:a.bidirectionalSize,triggersBounds:i},{name:"ghost-opacity",type:a.zeroOneNumber}],C=[{name:"selection-box-color",type:a.color},{name:"selection-box-opacity",type:a.zeroOneNumber},{name:"selection-box-border-color",type:a.color},{name:"selection-box-border-width",type:a.size},{name:"active-bg-color",type:a.color},{name:"active-bg-opacity",type:a.zeroOneNumber},{name:"active-bg-size",type:a.size},{name:"outside-texture-bg-color",type:a.color},{name:"outside-texture-bg-opacity",type:a.zeroOneNumber}],E=[];sV.pieBackgroundN=16,E.push({name:"pie-size",type:a.sizeMaybePercent}),E.push({name:"pie-hole",type:a.sizeMaybePercent}),E.push({name:"pie-start-angle",type:a.angle});for(var _=1;_<=sV.pieBackgroundN;_++)E.push({name:"pie-"+_+"-background-color",type:a.color}),E.push({name:"pie-"+_+"-background-size",type:a.percent}),E.push({name:"pie-"+_+"-background-opacity",type:a.zeroOneNumber});var S=[];sV.stripeBackgroundN=16,S.push({name:"stripe-size",type:a.sizeMaybePercent}),S.push({name:"stripe-direction",type:a.axisDirectionPrimary});for(var T=1;T<=sV.stripeBackgroundN;T++)S.push({name:"stripe-"+T+"-background-color",type:a.color}),S.push({name:"stripe-"+T+"-background-size",type:a.percent}),S.push({name:"stripe-"+T+"-background-opacity",type:a.zeroOneNumber});var A=[],O=sV.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:a.arrowShape,triggersBounds:i},{name:"arrow-color",type:a.color},{name:"arrow-fill",type:a.arrowFill},{name:"arrow-width",type:a.arrowWidth}].forEach(function(e){O.forEach(function(t){var n=t+"-"+e.name,r=e.type,i=e.triggersBounds;A.push({name:n,type:r,triggersBounds:i})})},{});var M=sV.properties=[].concat(d,g,h,f,p,k,u,c,o,s,l,x,y,b,w,E,S,j,N,A,C),P=sV.propertyGroups={behavior:d,transition:g,visibility:h,overlay:f,underlay:p,ghost:k,commonLabel:u,labelDimensions:c,mainLabel:o,sourceLabel:s,targetLabel:l,nodeBody:x,nodeBorder:y,nodeOutline:b,backgroundImage:w,pie:E,stripe:S,compound:j,edgeLine:N,edgeArrow:A,core:C},D=sV.propertyGroupNames={};(sV.propertyGroupKeys=Object.keys(P)).forEach(function(e){D[e]=P[e].map(function(e){return e.name}),P[e].forEach(function(t){return t.groupKey=e})});var L=sV.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];sV.propertyNames=M.map(function(e){return e.name});for(var I=0;I<M.length;I++){var R=M[I];M[R.name]=R}for(var B=0;B<L.length;B++){var z=L[B],F=M[z.pointsTo],V={name:z.name,alias:!0,pointsTo:F};M.push(V),M[z.name]=V}}(),sV.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},sV.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=nP({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(e,t){for(var n=1;n<=sV.pieBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}return e},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(e,t){for(var n=1;n<=sV.stripeBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}return e},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(e,t){return sV.arrowPrefixes.forEach(function(n){var r=n+"-"+t.name,i=t.value;e[r]=i}),e},{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a],s=this.parse(a,o);n[a]=s}}return e.defaultProperties=n,e.defaultProperties},sV.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var sU={};sU.parse=function(e,t,n,r){if(nc(t))return this.parseImplWarn(e,t,n,r);var i,a=n6(e,""+t,n?"t":"f","mapping"===r||!0===r||!1===r||null==r?"dontcare":r),o=this.propCache=this.propCache||[];return(i=o[a])||(i=o[a]=this.parseImplWarn(e,t,n,r)),(n||"mapping"===r)&&(i=rc(i))&&(i.value=rc(i.value)),i},sU.parseImplWarn=function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return i||null==t||rl("The style property `".concat(e,": ").concat(t,"` is invalid")),i&&("width"===i.name||"height"===i.name)&&"label"===t&&rl("The style value of `label` is deprecated for `"+i.name+"`"),i},sU.parseImpl=function(e,t,n,r){e=nj(e);var i=this.properties[e],a=t,o=this.types;if(!i||void 0===t)return null;i.alias&&(e=(i=i.pointsTo).name);var s=nl(t);s&&(t=t.trim());var l=i.type;if(!l)return null;if(n&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(nc(t))return{name:e,value:t,strValue:"fn",mapped:o.fn,bypass:n};if(!s||r||t.length<7||"a"!==t[1]);else if(t.length>=7&&"d"===t[0]&&(g=new RegExp(o.data.regex).exec(t))){if(n)return!1;var c=o.data;return{name:e,value:g,strValue:""+t,mapped:c,field:g[1],bypass:n}}else if(t.length>=10&&"m"===t[0]&&(v=new RegExp(o.mapData.regex).exec(t))){if(n||l.multiple)return!1;var u=o.mapData;if(!(l.color||l.number))return!1;var d=this.parse(e,v[4]);if(!d||d.mapped)return!1;var h=this.parse(e,v[5]);if(!h||h.mapped)return!1;if(d.pfValue===h.pfValue||d.strValue===h.strValue)return rl("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+d.strValue+"`"),this.parse(e,d.strValue);if(l.color){var f=d.value,p=h.value;if(f[0]===p[0]&&f[1]===p[1]&&f[2]===p[2]&&(f[3]===p[3]||(null==f[3]||1===f[3])&&(null==p[3]||1===p[3])))return!1}return{name:e,value:v,strValue:""+t,mapped:u,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:d.value,valueMax:h.value,bypass:n}}if(l.multiple&&"multiple"!==r){if(x=s?t.split(/\s+/):nu(t)?t:[t],l.evenMultiple&&x.length%2!=0)return null;for(var g,v,x,y=[],b=[],w=[],j="",N=!1,k=0;k<x.length;k++){var C=this.parse(e,x[k],n,"multiple");N=N||nl(C.value),y.push(C.value),w.push(null!=C.pfValue?C.pfValue:C.value),b.push(C.units),j+=(k>0?" ":"")+C.strValue}if(l.validate&&!l.validate(y,b))return null;if(l.singleEnum&&N)if(1===y.length&&nl(y[0]))return{name:e,value:y[0],strValue:y[0],bypass:n};else return null;return{name:e,value:y,pfValue:w,strValue:j,bypass:n,units:b}}var E=function(){for(var r=0;r<l.enums.length;r++)if(l.enums[r]===t)return{name:e,value:t,strValue:""+t,bypass:n};return null};if(l.number){var _,S,T="px";if(l.units&&(S=l.units),l.implicitUnits&&(T=l.implicitUnits),!l.unitless)if(s){var A="px|em"+(l.allowPercent?"|\\%":"");S&&(A=S);var O=t.match("^("+n_+")("+A+")?$");O&&(t=O[1],S=O[2]||T)}else(!S||l.implicitUnits)&&(S=T);if(isNaN(t=parseFloat(t))&&void 0===l.enums)return null;if(isNaN(t)&&void 0!==l.enums)return t=a,E();if(l.integer&&!(nh(_=t)&&Math.floor(_)===_)||void 0!==l.min&&(t<l.min||l.strictMin&&t===l.min)||void 0!==l.max&&(t>l.max||l.strictMax&&t===l.max))return null;var M={name:e,value:t,strValue:""+t+(S||""),units:S,bypass:n};return l.unitless||"px"!==S&&"em"!==S?M.pfValue=t:M.pfValue="px"!==S&&S?this.getEmSizeInPixels()*t:t,("ms"===S||"s"===S)&&(M.pfValue="ms"===S?t:1e3*t),("deg"===S||"rad"===S)&&(M.pfValue="rad"===S?t:Math.PI*t/180),"%"===S&&(M.pfValue=t/100),M}if(l.propList){var P=[],D=""+t;if("none"===D);else{for(var L=D.split(/\s*,\s*|\s+/),I=0;I<L.length;I++){var R=L[I].trim();this.properties[R]?P.push(R):rl("`"+R+"` is not a valid property name")}if(0===P.length)return null}return{name:e,value:P,strValue:0===P.length?"none":P.join(" "),bypass:n}}if(l.color){var B=nR(t);return B?{name:e,value:B,pfValue:B,strValue:"rgb("+B[0]+","+B[1]+","+B[2]+")",bypass:n}:null}if(l.regex||l.regexes){if(l.enums){var z=E();if(z)return z}for(var F=l.regexes?l.regexes:[l.regex],V=0;V<F.length;V++){var U=new RegExp(F[V]).exec(t);if(U)return{name:e,value:l.singleRegexMatchValue?U[1]:U,strValue:""+t,bypass:n}}return null}if(l.string)return{name:e,value:""+t,strValue:""+t,bypass:n};else if(l.enums)return E();else return null};var sH=function(e){return this instanceof sH?nv(e)?void(this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()):void ro("A style must have a core reference"):new sH(e)},sW=sH.prototype;sW.instanceString=function(){return"style"},sW.clear=function(){for(var e=this._private,t=e.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach(function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1}),this},sW.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},sW.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},sW.selector=function(e){var t="core"===e?null:new os(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},sW.css=function(){var e=arguments;if(1===e.length)for(var t=e[0],n=0;n<this.properties.length;n++){var r=this.properties[n],i=t[r.name];void 0===i&&(i=t[nN(r.name)]),void 0!==i&&this.cssRule(r.name,i)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},sW.style=sW.css,sW.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.name.match(/stripe-(\d+)-background-size/)&&n.value&&(this._private.hasStripe=!0),n.mapped&&this[r].mappedProperties.push(n),this[r].selector||(this._private.coreStyle[n.name]=n)}return this},sW.append=function(e){return nx(e)?e.appendToStyle(this):nu(e)?this.appendFromJson(e):nl(e)&&this.appendFromString(e),this},sH.fromJson=function(e,t){var n=new sH(e);return n.fromJson(t),n},sH.fromString=function(e,t){return new sH(e).fromString(t)},[sL,sI,sR,sB,sz,sF,sV,sU].forEach(function(e){nP(sW,e)}),sH.types=sW.types,sH.properties=sW.properties,sH.propertyGroups=sW.propertyGroups,sH.propertyGroupNames=sW.propertyGroupNames,sH.propertyGroupKeys=sW.propertyGroupKeys;var sY={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return(null==t.selectionType&&(t.selectionType="single"),void 0===e)?t.selectionType:(("additive"===e||"single"===e)&&(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,n,r,i,a=arguments,o=this._private.pan;switch(a.length){case 0:return o;case 1:if(nl(a[0]))return o[e=a[0]];if(nd(a[0])){if(!this._private.panningEnabled)return this;r=(n=a[0]).x,i=n.y,nh(r)&&(o.x=r),nh(i)&&(o.y=i),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;e=a[0],t=a[1],("x"===e||"y"===e)&&nh(t)&&(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,r,i,a=arguments,o=this._private.pan;if(!this._private.panningEnabled)return this;switch(a.length){case 1:nd(e)&&(r=(n=a[0]).x,i=n.y,nh(r)&&(o.x+=r),nh(i)&&(o.y+=i),this.emit("pan viewport"));break;case 2:("x"===e||"y"===e)&&nh(t)&&(o[e]+=t),this.emit("pan viewport")}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(nh(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){if(nl(e)){var n,r,i,a=e;e=this.$(a)}else if(nd(n=e)&&nh(n.x1)&&nh(n.x2)&&nh(n.y1)&&nh(n.y2)){var o=e;(r={x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2}).w=r.x2-r.x1,r.h=r.y2-r.y1}else np(e)||(e=this.mutableElements());if(!(np(e)&&e.empty())){r=r||e.boundingBox();var s=this.width(),l=this.height();if(t=nh(t)?t:0,!isNaN(s)&&!isNaN(l)&&s>0&&l>0&&!isNaN(r.w)&&!isNaN(r.h)&&r.w>0&&r.h>0){i=(i=(i=Math.min((s-2*t)/r.w,(l-2*t)/r.h))>this._private.maxZoom?this._private.maxZoom:i)<this._private.minZoom?this._private.minZoom:i;var c={x:(s-i*(r.x1+r.x2))/2,y:(l-i*(r.y1+r.y2))/2};return{zoom:i,pan:c}}}}},zoomRange:function(e,t){var n=this._private;if(null==t){var r=e;e=r.min,t=r.max}return nh(e)&&nh(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):nh(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:nh(t)&&void 0===e&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),nh(e)?n=e:nd(e)&&(n=e.level,null!=e.position?t=rI(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)<r.minZoom?r.minZoom:n,o||!nh(n)||n===a||null!=t&&(!nh(t.x)||!nh(t.y)))return null;if(null==t)return{zoomed:!0,panned:!1,zoom:n,pan:i};var s=n,l={x:-s/a*(t.x-i.x)+t.x,y:-s/a*(t.y-i.y)+t.y};return{zoomed:!0,panned:!0,zoom:s,pan:l}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return null!=t&&t.zoomed&&(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport")),this},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1;if(!e||(nh(e.zoom)||(n=!1),nd(e.pan)||(r=!1),!n&&!r))return this;if(n){var o=e.zoom;o<t.minZoom||o>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=o,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var s=e.pan;nh(s.x)&&(t.pan.x=s.x),nh(s.y)&&(t.pan.y=s.y),i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(nl(e)){var n=e;e=this.mutableElements().filter(n)}else np(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled&&this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=this.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};sY.centre=sY.center,sY.autolockNodes=sY.autolock,sY.autoungrabifyNodes=sY.autoungrabify;var sG={data:aJ.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:aJ.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:aJ.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:aJ.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};sG.attr=sG.data,sG.removeAttr=sG.removeData;var s$=function(e){var t=this,n=(e=nP({},e)).container;n&&!nf(n)&&nf(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{}).cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==nt&&void 0!==n&&!e.headless,o=e;o.layout=nP({name:a?"grid":"null"},o.layout),o.renderer=nP({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new sg(this),listeners:[],aniEles:new sg(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:nh(o.zoom)?o.zoom:1,pan:{x:nd(o.pan)&&nh(o.pan.x)?o.pan.x:0,y:nd(o.pan)&&nh(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom}),l.styleEnabled&&t.setStyle([]);var c=nP({},o,o.renderer);t.initRenderer(c);var u=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(nd(e)||nu(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",r),t.emit("done")});var a=nP({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};!function(e,t){if(e.some(nb))return aI.all(e).then(t);t(e)}([o.style,o.elements],function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),u(a,function(){t.startAnimationLoop(),l.ready=!0,nc(o.ready)&&t.on("ready",o.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on("ready",n)}r&&(r.readies=[]),t.emit("ready")},o.done)})},sX=s$.prototype;nP(sX,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){if(!this.destroyed())return this.stopAnimationLoop(),this.destroyRenderer(),this.emit("destroy"),this._private.destroyed=!0,this},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){if(null==this._private.container)return nt;var e=this._private.container.ownerDocument;return void 0===e||null==e?nt:e.defaultView||nt},mount:function(e){if(null!=e){var t=this._private,n=t.options;return!nf(e)&&nf(e[0])&&(e=e[0]),this.stopAnimationLoop(),this.destroyRenderer(),t.container=e,t.styleEnabled=!0,this.invalidateSize(),this.initRenderer(nP({},n,n.renderer,{name:"null"===n.renderer.name?"canvas":n.renderer.name})),this.startAnimationLoop(),this.style(n.style),this.emit("mount"),this}},unmount:function(){return this.stopAnimationLoop(),this.destroyRenderer(),this.initRenderer({name:"null"}),this.emit("unmount"),this},options:function(){return rc(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements();if(nd(e)){if(t.startBatch(),e.elements){var i={},a=function(e,n){for(var r=[],a=[],o=0;o<e.length;o++){var s=e[o];if(!s.data.id){rl("cy.json() cannot handle elements without an ID attribute");continue}var l=""+s.data.id,c=t.getElementById(l);i[l]=!0,0!==c.length?a.push({ele:c,json:s}):(n&&(s.group=n),r.push(s))}t.add(r);for(var u=0;u<a.length;u++){var d=a[u],h=d.ele,f=d.json;h.json(f)}};if(nu(e.elements))a(e.elements);else for(var o=["nodes","edges"],s=0;s<o.length;s++){var l=o[s],c=e.elements[l];nu(c)&&a(c,l)}var u=t.collection();r.filter(function(e){return!i[e.id()]}).forEach(function(e){e.isParent()?u.merge(e):e.remove()}),u.forEach(function(e){return e.children().move({parent:null})}),u.forEach(function(e){return t.getElementById(e.id()).remove()})}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var d=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],h=0;h<d.length;h++){var f=d[h];null!=e[f]&&t[f](e[f])}return t.endBatch(),this}var p={};e?p.elements=this.elements().map(function(e){return e.json()}):(p.elements={},r.forEach(function(e){var t=e.group();p.elements[t]||(p.elements[t]=[]),p.elements[t].push(e.json())})),this._private.styleEnabled&&(p.style=t.style().json()),p.data=rc(t.data());var g=n.options;return p.zoomingEnabled=n.zoomingEnabled,p.userZoomingEnabled=n.userZoomingEnabled,p.zoom=n.zoom,p.minZoom=n.minZoom,p.maxZoom=n.maxZoom,p.panningEnabled=n.panningEnabled,p.userPanningEnabled=n.userPanningEnabled,p.pan=rc(n.pan),p.boxSelectionEnabled=n.boxSelectionEnabled,p.renderer=rc(g.renderer),p.hideEdgesOnViewport=g.hideEdgesOnViewport,p.textureOnViewport=g.textureOnViewport,p.wheelSensitivity=g.wheelSensitivity,p.motionBlur=g.motionBlur,p.multiClickDebounceTime=g.multiClickDebounceTime,p}}),sX.$id=sX.getElementById,[{add:function(e){var t;if(np(e))if(e._private.cy===this)t=e.restore();else{for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(i.json())}t=new sg(this,n)}else if(nu(e))t=new sg(this,e);else if(nd(e)&&(nu(e.nodes)||nu(e.edges))){for(var a=[],o=["nodes","edges"],s=0,l=o.length;s<l;s++){var c=o[s],u=e[c];if(nu(u))for(var d=0,h=u.length;d<h;d++){var f=nP({group:c},u[d]);a.push(f)}}t=new sg(this,a)}else t=new rN(this,e).collection();return t},remove:function(e){if(np(e));else if(nl(e)){var t=e;e=this.$(t)}return e.remove()}},sE,sT,sA,sO,{notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t);return}if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a=e[i];t.getElementById(i).data(a)}})}},sP,sD,{style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return nx(e)?t.style=e.generateStyle(this):nu(e)?t.style=sH.fromJson(this,e):nl(e)?t.style=sH.fromString(this,e):t.style=sH(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},sY,sG].forEach(function(e){nP(sX,e)});var sq={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},sK={maximal:!1,acyclic:!1},sZ=function(e){return e.scratch("breadthfirst")},sQ=function(e,t){return e.scratch("breadthfirst",t)};function sJ(e){this.options=nP({},sq,sK,e)}sJ.prototype.run=function(){var e,t=this.options,n=t.cy,r=t.eles,i=r.nodes().filter(function(e){return e.isChildless()}),a=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,s=!!t.boundingBox,l=rJ(s?t.boundingBox:structuredClone(n.extent()));if(np(t.roots))e=t.roots;else if(nu(t.roots)){for(var c=[],u=0;u<t.roots.length;u++){var d=t.roots[u],h=n.getElementById(d);c.push(h)}e=n.collection(c)}else if(nl(t.roots))e=n.$(t.roots);else if(a)e=i.roots();else{var f=r.components();e=n.collection();for(var p=0;p<f.length;p++)!function(){var t=f[p],n=t.maxDegree(!1),r=t.filter(function(e){return e.degree(!1)===n});e=e.add(r)}()}var g=[],v={},x=function(e,t){null==g[t]&&(g[t]=[]);var n=g[t].length;g[t].push(e),sQ(e,{index:n,depth:t})},y=function(e,t){var n=sZ(e),r=n.depth,i=n.index;g[r][i]=null,e.isChildless()&&x(e,t)};r.bfs({roots:e,directed:t.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();a.isChildless()&&x(a,i),v[o]=!0}});for(var b=[],w=0;w<i.length;w++){var j=i[w];v[j.id()]||b.push(j)}var N=function(e){for(var t=g[e],n=0;n<t.length;n++){var r=t[n];if(null==r){t.splice(n,1),n--;continue}sQ(r,{depth:e,index:n})}};if(a&&o){var k=[],C={},E=function(e){return k.push(e)};for(i.forEach(function(e){return k.push(e)});k.length>0;){var _=k.shift(),S=function(e,n){for(var i=sZ(e),a=e.incomers().filter(function(e){return e.isNode()&&r.has(e)}),o=-1,s=e.id(),l=0;l<a.length;l++)o=Math.max(o,sZ(a[l]).depth);if(i.depth<=o){if(!t.acyclic&&n[s])return null;var c=o+1;return y(e,c),n[s]=c,!0}return!1}(_,C);if(S)_.outgoers().filter(function(e){return e.isNode()&&r.has(e)}).forEach(E);else if(null===S){rl("Detected double maximal shift for node `"+_.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var T=0;if(t.avoidOverlap)for(var A=0;A<i.length;A++){var O=i[A].layoutDimensions(t),M=O.w,P=O.h;T=Math.max(T,M,P)}var D={},L=function(e){if(D[e.id()])return D[e.id()];for(var t=sZ(e).depth,n=e.neighborhood(),r=0,a=0,o=0;o<n.length;o++){var s=n[o];if(!(s.isEdge()||s.isParent())&&i.has(s)){var l=sZ(s);if(null!=l){var c=l.index,u=l.depth;if(null!=c&&null!=u){var d=g[u].length;u<t&&(r+=c/d,a++)}}}}return r/=a=Math.max(1,a),0===a&&(r=0),D[e.id()]=r,r},I=function(e,t){var n=L(e)-L(t);return 0===n?nM(e.id(),t.id()):n};void 0!==t.depthSort&&(I=t.depthSort);for(var R=g.length,B=0;B<R;B++)g[B].sort(I),N(B);for(var z=[],F=0;F<b.length;F++)z.push(b[F]);if(z.length){g.unshift(z),R=g.length;for(var V=0;V<R;V++)N(V)}for(var U=0,H=0;H<R;H++)U=Math.max(g[H].length,U);var W={x:l.x1+l.w/2,y:l.y1+l.h/2},Y=i.reduce(function(e,n){var r;return r=n.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}),{w:-1===e.w?r.w:(e.w+r.w)/2,h:-1===e.h?r.h:(e.h+r.h)/2}},{w:-1,h:-1}),G=Math.max(1===R?0:s?(l.h-2*t.padding-Y.h)/(R-1):(l.h-2*t.padding-Y.h)/(R+1),T),$=g.reduce(function(e,t){return Math.max(e,t.length)},0),X=function(e){var n=sZ(e),r=n.depth,i=n.index;if(t.circle){var a=Math.min(l.w/2/R,l.h/2/R),o=(a=Math.max(a,T))*r+a-(R>0&&g[0].length<=3?a/2:0),c=2*Math.PI/g[r].length*i;return 0===r&&1===g[0].length&&(o=1),{x:W.x+o*Math.cos(c),y:W.y+o*Math.sin(c)}}var u=g[r].length,d=Math.max(1===u?0:s?(l.w-2*t.padding-Y.w)/((t.grid?$:u)-1):(l.w-2*t.padding-Y.w)/((t.grid?$:u)+1),T);return{x:W.x+(i+1-(u+1)/2)*d,y:W.y+(r+1-(R+1)/2)*G}},q={downward:0,leftward:90,upward:180,rightward:-90};return -1===Object.keys(q).indexOf(t.direction)&&ro("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(q).join(", "))),r.nodes().layoutPositions(this,t,function(e){return function(e,t,n){if(0===n)return e;var r,i,a,o,s=(t.x1+t.x2)/2,l=(t.y1+t.y2)/2,c=t.w/t.h,u=(r=e.x,i=e.y,{x:Math.cos(a=n*Math.PI/180)*(r-s)-Math.sin(a)*(i-l)+s,y:Math.sin(a)*(r-s)+Math.cos(a)*(i-l)+l}),d=(o=u.x,{x:(o-s)*c+s,y:(u.y-l)*(1/c)+l});return{x:d.x,y:d.y}}(X(e),l,q[t.direction])}),this};var s0={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function s1(e){this.options=nP({},s0,e)}s1.prototype.run=function(){var e,t=this.options,n=t.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o=rJ(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),c=0,u=0;u<a.length;u++){var d=a[u].layoutDimensions(t);c=Math.max(c,d.w,d.h)}if(e=nh(t.radius)?t.radius:a.length<=1?0:Math.min(o.h,o.w)/2-c,a.length>1&&t.avoidOverlap){var h=Math.cos(l)-1,f=Math.sin(l)-0;e=Math.max(Math.sqrt((c*=1.75)*c/(h*h+f*f)),e)}return r.nodes().layoutPositions(this,t,function(n,r){var a=t.startAngle+r*l*(i?1:-1),o=e*Math.cos(a),c=e*Math.sin(a);return{x:s.x+o,y:s.y+c}}),this};var s2={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function s5(e){this.options=nP({},s2,e)}s5.prototype.run=function(){for(var e=this.options,t=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,n=e.cy,r=e.eles,i=r.nodes().not(":parent"),a=rJ(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:a.x1+a.w/2,y:a.y1+a.h/2},s=[],l=0,c=0;c<i.length;c++){var u=i[c],d=void 0;d=e.concentric(u),s.push({value:d,node:u}),u._private.scratch.concentric=d}i.updateStyle();for(var h=0;h<i.length;h++){var f=i[h].layoutDimensions(e);l=Math.max(l,f.w,f.h)}s.sort(function(e,t){return t.value-e.value});for(var p=e.levelWidth(i),g=[[]],v=g[0],x=0;x<s.length;x++){var y=s[x];v.length>0&&Math.abs(v[0].value-y.value)>=p&&(v=[],g.push(v)),v.push(y)}var b=l+e.minNodeSpacing;if(!e.avoidOverlap){var w=g.length>0&&g[0].length>1,j=(Math.min(a.w,a.h)/2-b)/(g.length+w?1:0);b=Math.min(b,j)}for(var N=0,k=0;k<g.length;k++){var C=g[k],E=void 0===e.sweep?2*Math.PI-2*Math.PI/C.length:e.sweep,_=C.dTheta=E/Math.max(1,C.length-1);if(C.length>1&&e.avoidOverlap){var S=Math.cos(_)-1,T=Math.sin(_)-0;N=Math.max(Math.sqrt(b*b/(S*S+T*T)),N)}C.r=N,N+=b}if(e.equidistant){for(var A=0,O=0,M=0;M<g.length;M++)A=Math.max(A,g[M].r-O);O=0;for(var P=0;P<g.length;P++){var D=g[P];0===P&&(O=D.r),D.r=O,O+=A}}for(var L={},I=0;I<g.length;I++)for(var R=g[I],B=R.dTheta,z=R.r,F=0;F<R.length;F++){var V=R[F],U=e.startAngle+(t?1:-1)*B*F,H={x:o.x+z*Math.cos(U),y:o.y+z*Math.sin(U)};L[V.node.id()]=H}return r.nodes().layoutPositions(this,e,function(e){return L[e.id()]}),this};var s3={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function s4(e){this.options=nP({},s3,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges().filter(function(e){var n=e.source().data("id"),r=e.target().data("id"),i=t.some(function(e){return e.data("id")===n}),a=t.some(function(e){return e.data("id")===r});return!i||!a});this.options.eles=this.options.eles.not(n)}s4.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(!0===e.animate||!1===e.animate)&&n.emit({type:"layoutstart",layout:n}),u$=!0===e.debug;var r=s6(t,n,e);u$&&uX(r),e.randomize&&s9(r);var i=nK(),a=function(){lt(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!n.stopped&&!(t>=e.numIter)&&(ln(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)a(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var t=e.eles.nodes(),i=le(r,e,t);t.layoutPositions(n,e,i)}},l=0,c=!0;if(!0===e.animate){var u=function(){for(var t=0;c&&t<e.refresh;)c=o(l),l++,t++;c?(nK()-i>=e.animationThreshold&&a(),nQ(u)):(lp(r,e),s())};u()}else{for(;c;)c=o(l),l++;lp(r,e),s()}return this},s4.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},s4.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var s6=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=rJ(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},c=0;c<s.length;c++)for(var u=s[c],d=0;d<u.length;d++){var h=u[d];l[h.id()]=c}for(var c=0;c<o.nodeSize;c++){var f=i[c],p=f.layoutDimensions(n),g={};g.isLocked=f.locked(),g.id=f.data("id"),g.parentId=f.data("parent"),g.cmptId=l[f.id()],g.children=[],g.positionX=f.position("x"),g.positionY=f.position("y"),g.offsetX=0,g.offsetY=0,g.height=p.w,g.width=p.h,g.maxX=g.positionX+g.width/2,g.minX=g.positionX-g.width/2,g.maxY=g.positionY+g.height/2,g.minY=g.positionY-g.height/2,g.padLeft=parseFloat(f.style("padding")),g.padRight=parseFloat(f.style("padding")),g.padTop=parseFloat(f.style("padding")),g.padBottom=parseFloat(f.style("padding")),g.nodeRepulsion=nc(n.nodeRepulsion)?n.nodeRepulsion(f):n.nodeRepulsion,o.layoutNodes.push(g),o.idToIndex[g.id]=c}for(var v=[],x=0,y=-1,b=[],c=0;c<o.nodeSize;c++){var f=o.layoutNodes[c],w=f.parentId;null!=w?o.layoutNodes[o.idToIndex[w]].children.push(f.id):(v[++y]=f.id,b.push(f.id))}for(o.graphSet.push(b);x<=y;){var j=v[x++],N=o.idToIndex[j],h=o.layoutNodes[N],k=h.children;if(k.length>0){o.graphSet.push(k);for(var c=0;c<k.length;c++)v[++y]=k[c]}}for(var c=0;c<o.graphSet.length;c++)for(var C=o.graphSet[c],d=0;d<C.length;d++){var E=o.idToIndex[C[d]];o.indexToGraph[E]=c}for(var c=0;c<o.edgeSize;c++){var _=r[c],S={};S.id=_.data("id"),S.sourceId=_.data("source"),S.targetId=_.data("target");var T=nc(n.idealEdgeLength)?n.idealEdgeLength(_):n.idealEdgeLength,A=nc(n.edgeElasticity)?n.edgeElasticity(_):n.edgeElasticity,O=o.idToIndex[S.sourceId],M=o.idToIndex[S.targetId];if(o.indexToGraph[O]!=o.indexToGraph[M]){for(var P=s8(S.sourceId,S.targetId,o),D=o.graphSet[P],L=0,g=o.layoutNodes[O];-1===D.indexOf(g.id);)g=o.layoutNodes[o.idToIndex[g.parentId]],L++;for(g=o.layoutNodes[M];-1===D.indexOf(g.id);)g=o.layoutNodes[o.idToIndex[g.parentId]],L++;T*=L*n.nestingFactor}S.idealLength=T,S.elasticity=A,o.layoutEdges.push(S)}return o},s8=function(e,t,n){var r=s7(e,t,0,n);return 2>r.count?0:r.graph},s7=function(e,t,n,r){var i=r.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var a=0,o=0;o<i.length;o++){var s=i[o],l=r.idToIndex[s],c=r.layoutNodes[l].children;if(0!==c.length){var u=s7(e,t,r.indexToGraph[r.idToIndex[c[0]]],r);if(0===u.count)continue;if(1!==u.count)return u;if(2==++a)break}}return{count:a,graph:n}},s9=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];0!==a.children.length||a.isLocked||(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},le=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(t){var n=e.layoutNodes[e.idToIndex[t.data("id")]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data("id")]];if(!t.boundingBox)return{x:o.positionX,y:o.positionY};var s=0===i.w?.5:(o.positionX-i.x1)/i.w,l=0===i.h?.5:(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+l*r.h}}},lt=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=le(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},ln=function(e,t,n){lr(e,t),ll(e),lc(e,t),lu(e),ld(e)},lr=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++)la(o,e.layoutNodes[e.idToIndex[r[s]]],e,t)},li=function(e){return -1+2*e*Math.random()},la=function(e,t,n,r){if(e.cmptId===t.cmptId||n.isCompound){var i=t.positionX-e.positionX,a=t.positionY-e.positionY;0===i&&0===a&&(i=li(1),a=li(1));var o=lo(e,t,i,a);if(o>0)var s=r.nodeOverlap*o,l=Math.sqrt(i*i+a*a),c=s*i/l,u=s*a/l;else var d=ls(e,i,a),h=ls(t,-1*i,-1*a),f=h.x-d.x,p=h.y-d.y,g=f*f+p*p,l=Math.sqrt(g),s=(e.nodeRepulsion+t.nodeRepulsion)/g,c=s*f/l,u=s*p/l;e.isLocked||(e.offsetX-=c,e.offsetY-=u),t.isLocked||(t.offsetX+=c,t.offsetY+=u)}},lo=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},ls=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,c={};return 0===t&&0<n||0===t&&0>n?(c.x=r,c.y=i+a/2):0<t&&-1*l<=s&&s<=l?(c.x=r+o/2,c.y=i+o*n/2/t):0>t&&-1*l<=s&&s<=l?(c.x=r-o/2,c.y=i-o*n/2/t):0<n&&(s<=-1*l||s>=l)?(c.x=r+a*t/2/n,c.y=i+a/2):0>n&&(s<=-1*l||s>=l)&&(c.x=r-a*t/2/n,c.y=i-a/2),c},ll=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],l=s.positionX-a.positionX,c=s.positionY-a.positionY;if(0!==l||0!==c){var u=ls(a,l,c),d=ls(s,-1*l,-1*c),h=d.x-u.x,f=d.y-u.y,p=Math.sqrt(h*h+f*f),g=Math.pow(r.idealLength-p,2)/r.elasticity;if(0!==p)var v=g*h/p,x=g*f/p;else var v=0,x=0;a.isLocked||(a.offsetX+=v,a.offsetY+=x),s.isLocked||(s.offsetX-=v,s.offsetY-=x)}}},lc=function(e,t){if(0!==t.gravity)for(var n=0;n<e.graphSet.length;n++){var r=e.graphSet[n],i=r.length;if(0===n)var a=e.clientHeight/2,o=e.clientWidth/2;else var s=e.layoutNodes[e.idToIndex[r[0]]],l=e.layoutNodes[e.idToIndex[s.parentId]],a=l.positionX,o=l.positionY;for(var c=0;c<i;c++){var u=e.layoutNodes[e.idToIndex[r[c]]];if(!u.isLocked){var d=a-u.positionX,h=o-u.positionY,f=Math.sqrt(d*d+h*h);if(f>1){var p=t.gravity*d/f,g=t.gravity*h/f;u.offsetX+=p,u.offsetY+=g}}}}},lu=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0<l.length&&!s.isLocked){for(var c=s.offsetX,u=s.offsetY,d=0;d<l.length;d++){var h=e.layoutNodes[e.idToIndex[l[d]]];h.offsetX+=c,h.offsetY+=u,n[++i]=l[d]}s.offsetX=0,s.offsetY=0}}},ld=function(e,t){for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&(r.maxX=void 0,r.minX=void 0,r.maxY=void 0,r.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];if(!(0<r.children.length)&&!r.isLocked){var i=lh(r.offsetX,r.offsetY,e.temperature);r.positionX+=i.x,r.positionY+=i.y,r.offsetX=0,r.offsetY=0,r.minX=r.positionX-r.width,r.maxX=r.positionX+r.width,r.minY=r.positionY-r.height,r.maxY=r.positionY+r.height,lf(r,e)}}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&!r.isLocked&&(r.positionX=(r.maxX+r.minX)/2,r.positionY=(r.maxY+r.minY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY)}},lh=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},lf=function(e,t){var n=e.parentId;if(null!=n){var r=t.layoutNodes[t.idToIndex[n]],i=!1;if((null==r.maxX||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,i=!0),(null==r.minX||e.minX-r.padLeft<r.minX)&&(r.minX=e.minX-r.padLeft,i=!0),(null==r.maxY||e.maxY+r.padBottom>r.maxY)&&(r.maxY=e.maxY+r.padBottom,i=!0),(null==r.minY||e.minY-r.padTop<r.minY)&&(r.minY=e.minY-r.padTop,i=!0),i)return lf(r,t)}},lp=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}for(var s=0,i=0;i<r.length;i++){var l=r[i];if(l){l.x1=1/0,l.x2=-1/0,l.y1=1/0,l.y2=-1/0;for(var c=0;c<l.length;c++){var u=l[c];l.x1=Math.min(l.x1,u.positionX-u.width/2),l.x2=Math.max(l.x2,u.positionX+u.width/2),l.y1=Math.min(l.y1,u.positionY-u.height/2),l.y2=Math.max(l.y2,u.positionY+u.height/2)}l.w=l.x2-l.x1,l.h=l.y2-l.y1,s+=l.w*l.h}}r.sort(function(e,t){return t.w*t.h-e.w*e.h});for(var d=0,h=0,f=0,p=0,g=Math.sqrt(s)*e.clientWidth/e.clientHeight,i=0;i<r.length;i++){var l=r[i];if(l){for(var c=0;c<l.length;c++){var u=l[c];u.isLocked||(u.positionX+=d-l.x1,u.positionY+=h-l.y1)}d+=l.w+t.componentSpacing,f+=l.w+t.componentSpacing,p=Math.max(p,l.h),f>g&&(h+=p+t.componentSpacing,d=0,f=0,p=0)}}},lm={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function lg(e){this.options=nP({},lm,e)}lg.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().not(":parent");e.sort&&(r=r.sort(e.sort));var i=rJ(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(0===i.h||0===i.w)n.nodes().layoutPositions(this,e,function(e){return{x:i.x1,y:i.y1}});else{var a=r.size(),o=Math.sqrt(a*i.h/i.w),s=Math.round(o),l=Math.round(i.w/i.h*o),c=function(e){if(null==e)return Math.min(s,l);Math.min(s,l)==s?s=e:l=e},u=function(e){if(null==e)return Math.max(s,l);Math.max(s,l)==s?s=e:l=e},d=e.rows,h=null!=e.cols?e.cols:e.columns;if(null!=d&&null!=h)s=d,l=h;else if(null!=d&&null==h)l=Math.ceil(a/(s=d));else if(null==d&&null!=h)s=Math.ceil(a/(l=h));else if(l*s>a){var f=c(),p=u();(f-1)*p>=a?c(f-1):(p-1)*f>=a&&u(p-1)}else for(;l*s<a;){var g=c(),v=u();(v+1)*g>=a?u(v+1):c(g+1)}var x=i.w/l,y=i.h/s;if(e.condense&&(x=0,y=0),e.avoidOverlap)for(var b=0;b<r.length;b++){var w=r[b],j=w._private.position;(null==j.x||null==j.y)&&(j.x=0,j.y=0);var N=w.layoutDimensions(e),k=e.avoidOverlapPadding,C=N.w+k,E=N.h+k;x=Math.max(x,C),y=Math.max(y,E)}for(var _={},S=function(e,t){return!!_["c-"+e+"-"+t]},T=function(e,t){_["c-"+e+"-"+t]=!0},A=0,O=0,M=function(){++O>=l&&(O=0,A++)},P={},D=0;D<r.length;D++){var L=r[D],I=e.position(L);if(I&&(void 0!==I.row||void 0!==I.col)){var R={row:I.row,col:I.col};if(void 0===R.col)for(R.col=0;S(R.row,R.col);)R.col++;else if(void 0===R.row)for(R.row=0;S(R.row,R.col);)R.row++;P[L.id()]=R,T(R.row,R.col)}}r.layoutPositions(this,e,function(e,t){if(e.locked()||e.isParent())return!1;var n,r,a=P[e.id()];if(a)n=a.col*x+x/2+i.x1,r=a.row*y+y/2+i.y1;else{for(;S(A,O);)M();n=O*x+x/2+i.x1,r=A*y+y/2+i.y1,T(A,O),M()}return{x:n,y:r}})}return this};var lv={ready:function(){},stop:function(){}};function lx(e){this.options=nP({},lv,e)}lx.prototype.run=function(){var e=this.options,t=e.eles;return e.cy,this.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),this.one("layoutready",e.ready),this.emit("layoutready"),this.one("layoutstop",e.stop),this.emit("layoutstop"),this},lx.prototype.stop=function(){return this};var ly={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function lb(e){this.options=nP({},ly,e)}lb.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=nc(e.positions);return t.layoutPositions(this,e,function(t,r){var i=function(t){if(null==e.positions){var r;return{x:(r=t.position()).x,y:r.y}}if(n)return e.positions(t);var i=e.positions[t._private.data.id];return null==i?null:i}(t);return!t.locked()&&null!=i&&i}),this};var lw={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function lj(e){this.options=nP({},lw,e)}lj.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=rJ(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.nodes().layoutPositions(this,e,function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}}),this};var lN=[{name:"breadthfirst",impl:sJ},{name:"circle",impl:s1},{name:"concentric",impl:s5},{name:"cose",impl:s4},{name:"grid",impl:lg},{name:"null",impl:lx},{name:"preset",impl:lb},{name:"random",impl:lj}];function lk(e){this.options=e,this.notifications=0}var lC=function(){},lE=function(){throw Error("A headless instance can not render images")};lk.prototype={recalculateRenderedStyle:lC,notify:function(){this.notifications++},init:lC,isHeadless:function(){return!0},png:lE,jpg:lE};var l_={};l_.arrowShapeWidth=.3,l_.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,l=i.x+n/2+o,c=i.y-n/2-o,u=i.y+n/2+o;return s<=e&&e<=l&&c<=t&&t<=u},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=e*Math.sin(r)+t*Math.cos(r);return{x:a*n+i.x,y:o*n+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];a.push(r(s,l,t,n,i))}return a},a=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},s=function(r,s){nl(s)&&(s=e[s]),e[r]=nP({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){return ic(e,t,a(i(this.points,n+2*s,r,o)))},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:rr,roughCollide:rr,draw:ra,spacing:ri,gap:ri}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,a,o,s){var l=i(this.points,n,a,o),c=this.controlPoint,u=r(c[0],c[1],n,a,o);t.arrowShapeImpl(this.name)(e,l,u)},gap:function(e){return .8*o(e)}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,l){var c=a(i(this.points,n+2*l,r,o)),u=a(i(this.pointsTee,n+2*l,r,o));return ic(e,t,c)||ic(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.pointsTee,n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,n,r,o,s,l){var c=Math.pow(o.x-e,2)+Math.pow(o.y-t,2)<=Math.pow((n+2*l)*this.radius,2);return ic(e,t,a(i(this.points,n+2*l,r,o)))||c},draw:function(e,n,r,a,o){var s=i(this.pointsTr,n,r,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),r=t/e;return n[3]=n[3]-r,n[5]=n[5]-r,n},collide:function(e,t,n,r,o,s,l){var c=a(i(this.points,n+2*l,r,o)),u=a(i(this.crossLinePts(n,s),n+2*l,r,o));return ic(e,t,c)||ic(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.crossLinePts(n,o),n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return .525*o(e)}}),s("circle",{radius:.15,collide:function(e,t,n,r,i,a,o){return Math.pow(i.x-e,2)+Math.pow(i.y-t,2)<=Math.pow((n+2*o)*this.radius,2)},draw:function(e,n,r,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return .95*e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}})};var lS={};lS.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),l=n.zoom();return[((e-i)/o-s.x)/l,((t-a)/o-s.y)/l]},lS.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},i={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},a={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},o=e.clientWidth,s=e.clientHeight,l=i.left+i.right,c=i.top+i.bottom,u=a.left+a.right,d=t.width/(o+u),h=t.left+i.left+a.left,f=t.top+i.top+a.top;return this.containerBB=[h,f,o-l,s-c,d]},lS.invalidateContainerClientCoordsCache=function(){this.containerBB=null},lS.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},lS.findNearestElements=function(e,t,n,r){var i,a,o=this,s=this,l=s.getCachedZSortedEles(),c=[],u=s.cy.zoom(),d=s.cy.hasCompoundNodes(),h=(r?24:8)/u,f=(r?8:2)/u,p=(r?8:2)/u,g=1/0;function v(e,t){if(e.isNode())if(a)return;else a=e,c.push(e);if(e.isEdge()&&(null==t||t<g))if(i){if(i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value){for(var n=0;n<c.length;n++)if(c[n].isEdge()){c[n]=e,i=e,g=null!=t?t:g;break}}}else c.push(e),i=e,g=null!=t?t:g}function x(n){var r=n.outerWidth()+2*f,i=n.outerHeight()+2*f,a=r/2,l=i/2,c=n.position(),u="auto"===n.pstyle("corner-radius").value?"auto":n.pstyle("corner-radius").pfValue,d=n._private.rscratch;if(c.x-a<=e&&e<=c.x+a&&c.y-l<=t&&t<=c.y+l&&s.nodeShapes[o.getNodeShape(n)].checkPoint(e,t,0,r,i,c.x,c.y,u,d))return v(n,0),!0}n&&(l=l.interactive);function y(n,r){var i,a=n._private;i=r?r+"-":"",n.boundingBox();var o=a.labelBounds[r||"main"],s=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&s){var l=rv(a.rscratch,"labelX",r),c=rv(a.rscratch,"labelY",r),u=rv(a.rscratch,"labelAngle",r),d=n.pstyle(i+"text-margin-x").pfValue,h=n.pstyle(i+"text-margin-y").pfValue,f=o.x1-p-d,g=o.x2+p-d,x=o.y1-p-h,y=o.y2+p-h;if(u){var b=Math.cos(u),w=Math.sin(u),j=function(e,t){return{x:(e-=l)*b-(t-=c)*w+l,y:e*w+t*b+c}},N=j(f,x),k=j(f,y),C=j(g,x),E=j(g,y);if(ic(e,t,[N.x+d,N.y+h,C.x+d,C.y+h,E.x+d,E.y+h,k.x+d,k.y+h]))return v(n),!0}else if(r8(o,e,t))return v(n),!0}}for(var b=l.length-1;b>=0;b--){var w=l[b];w.isNode()?x(w)||y(w):function(n){var r,i=n._private,a=i.rscratch,l=n.pstyle("width").pfValue,u=n.pstyle("arrow-scale").value,f=l/2+h,p=f*f,g=2*f,y=i.source,b=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var w=a.allpts,j=0;j+3<w.length;j+=2)if(ir(e,t,w[j],w[j+1],w[j+2],w[j+3],g)&&p>(r=il(e,t,w[j],w[j+1],w[j+2],w[j+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType){for(var w=a.allpts,j=0;j+5<a.allpts.length;j+=4)if(ii(e,t,w[j],w[j+1],w[j+2],w[j+3],w[j+4],w[j+5],g)&&p>(r=is(e,t,w[j],w[j+1],w[j+2],w[j+3],w[j+4],w[j+5])))return v(n,r),!0}for(var y=y||i.source,b=b||i.target,N=o.getArrowWidth(l,u),k=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}],j=0;j<k.length;j++){var C=k[j],E=s.arrowShapes[n.pstyle(C.name+"-arrow-shape").value],_=n.pstyle("width").pfValue;if(E.roughCollide(e,t,N,C.angle,{x:C.x,y:C.y},_,h)&&E.collide(e,t,N,C.angle,{x:C.x,y:C.y},_,h))return v(n),!0}d&&c.length>0&&(x(y),x(b))}(w)||y(w)||y(w,"source")||y(w,"target")}return c},lS.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=2/this.cy.zoom(),o=[],s=Math.min(e,n),l=Math.max(e,n),c=Math.min(t,r),u=Math.max(t,r);e=s,n=l;var d=rJ({x1:e,y1:t=c,x2:n,y2:r=u}),h=[{x:d.x1,y:d.y1},{x:d.x2,y:d.y1},{x:d.x2,y:d.y2},{x:d.x1,y:d.y2}],f=[[h[0],h[1]],[h[1],h[2]],[h[2],h[3]],[h[3],h[0]]];function p(e,t){var n=e._private;e.boundingBox();var r=n.labelBounds.main;if(!r)return null;var i=rv(n.rscratch,"labelX",t),o=rv(n.rscratch,"labelY",t),s=rv(n.rscratch,"labelAngle",t),l=e.pstyle("text-margin-x").pfValue,c=e.pstyle("text-margin-y").pfValue,u=r.x1-a-l,d=r.x2+a-l,h=r.y1-a-c,f=r.y2+a-c;if(!s)return[{x:u,y:h},{x:d,y:h},{x:d,y:f},{x:u,y:f}];var p=Math.cos(s),g=Math.sin(s),v=function(e,t){return{x:(e-=i)*p-(t-=o)*g+i,y:e*g+t*p+o}};return[v(u,h),v(d,h),v(d,f),v(u,f)]}for(var g=0;g<i.length;g++){var v=i[g];if(v.isNode()){var x="yes"===v.pstyle("text-events").strValue,y=v.pstyle("box-selection").strValue,b="yes"===v.pstyle("box-select-labels").strValue;if("none"===y)continue;var w=("overlap"===y||b)&&x,j=v.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:w});if("contain"===y){var N=!1;if(b&&x){var k=p(v);k&&iO(k,h)&&(o.push(v),N=!0)}!N&&r9(d,j)&&o.push(v)}else if("overlap"===y&&r6(d,j)){var C=v.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1});if(iO([{x:C.x1,y:C.y1},{x:C.x2,y:C.y1},{x:C.x2,y:C.y2},{x:C.x1,y:C.y2}],h))o.push(v);else{var E=p(v);E&&iO(E,h)&&o.push(v)}}}else{var _=v._private,S=_.rscratch,T=v.pstyle("box-selection").strValue;if("none"===T)continue;if("contain"===T){if(null!=S.startX&&null!=S.startY&&!r8(d,S.startX,S.startY)||null!=S.endX&&null!=S.endY&&!r8(d,S.endX,S.endY))continue;if("bezier"===S.edgeType||"multibezier"===S.edgeType||"self"===S.edgeType||"compound"===S.edgeType||"segments"===S.edgeType||"haystack"===S.edgeType){for(var A=_.rstyle.bezierPts||_.rstyle.linePts||_.rstyle.haystackPts,O=!0,M=0;M<A.length;M++)if(!r7(d,A[M])){O=!1;break}O&&o.push(v)}else"straight"===S.edgeType&&o.push(v)}else if("overlap"===T){var P=!1;if(null!=S.startX&&null!=S.startY&&null!=S.endX&&null!=S.endY&&(r8(d,S.startX,S.startY)||r8(d,S.endX,S.endY)))o.push(v),P=!0;else if(!P&&"haystack"===S.edgeType){for(var D=_.rstyle.haystackPts,L=0;L<D.length;L++)if(r7(d,D[L])){o.push(v),P=!0;break}}if(!P){var I=_.rstyle.bezierPts||_.rstyle.linePts||_.rstyle.haystackPts;if((!I||I.length<2)&&"straight"===S.edgeType&&null!=S.startX&&null!=S.startY&&null!=S.endX&&null!=S.endY&&(I=[{x:S.startX,y:S.startY},{x:S.endX,y:S.endY}]),!I||I.length<2)continue;for(var R=0;R<I.length-1;R++){for(var B=I[R],z=I[R+1],F=0;F<f.length;F++){var V=t6(f[F],2);if(function(e,t,n,r){function i(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}return i(e,n,r)!==i(t,n,r)&&i(e,t,n)!==i(e,t,r)}(B,z,V[0],V[1])){o.push(v),P=!0;break}}if(P)break}}}}}return o};var lT={};lT.calculateArrowAngles=function(e){var t=e._private.rscratch,n="haystack"===t.edgeType,r="bezier"===t.edgeType,i="multibezier"===t.edgeType,a="segments"===t.edgeType,o="compound"===t.edgeType,s="self"===t.edgeType;if(n?(x=t.haystackPts[0],y=t.haystackPts[1],b=t.haystackPts[2],w=t.haystackPts[3]):(x=t.arrowStartX,y=t.arrowStartY,b=t.arrowEndX,w=t.arrowEndY),d=t.midX,h=t.midY,a)g=x-t.segpts[0],v=y-t.segpts[1];else if(i||o||s||r){var l=t.allpts,c=rq(l[0],l[2],l[4],.1),u=rq(l[1],l[3],l[5],.1);g=x-c,v=y-u}else g=x-d,v=y-h;t.srcArrowAngle=rH(g,v);var d=t.midX,h=t.midY;if(n&&(d=(x+b)/2,h=(y+w)/2),g=b-x,v=w-y,a){var l=t.allpts;if(l.length/2%2==0){var f=l.length/2,p=f-2;g=l[f]-l[p],v=l[f+1]-l[p+1]}else if(t.isRound)g=t.midVector[1],v=-t.midVector[0];else{var f=l.length/2-1,p=f-2;g=l[f]-l[p],v=l[f+1]-l[p+1]}}else if(i||o||s){var g,v,x,y,b,w,d,h,j,N,k,C,l=t.allpts;if(t.ctrlpts.length/2%2==0){var E=l.length/2-1,_=E+2,S=_+2;j=rq(l[E],l[_],l[S],0),N=rq(l[E+1],l[_+1],l[S+1],0),k=rq(l[E],l[_],l[S],1e-4),C=rq(l[E+1],l[_+1],l[S+1],1e-4)}else{var _=l.length/2-1,E=_-2,S=_+2;j=rq(l[E],l[_],l[S],.4999),N=rq(l[E+1],l[_+1],l[S+1],.4999),k=rq(l[E],l[_],l[S],.5),C=rq(l[E+1],l[_+1],l[S+1],.5)}g=k-j,v=C-N}if(t.midtgtArrowAngle=rH(g,v),t.midDispX=g,t.midDispY=v,g*=-1,v*=-1,a){var l=t.allpts;if(l.length/2%2==0);else if(!t.isRound){var f=l.length/2-1,T=f+2;g=-(l[T]-l[f]),v=-(l[T+1]-l[f+1])}}if(t.midsrcArrowAngle=rH(g,v),a)g=b-t.segpts[t.segpts.length-2],v=w-t.segpts[t.segpts.length-1];else if(i||o||s||r){var l=t.allpts,A=l.length,c=rq(l[A-6],l[A-4],l[A-2],.9),u=rq(l[A-5],l[A-3],l[A-1],.9);g=b-c,v=w-u}else g=b-d,v=w-h;t.tgtArrowAngle=rH(g,v)},lT.getArrowWidth=lT.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(13.37*e,.9),29)*t,n[e+", "+t]=r),r};var lA,lO,lM,lP,lD,lL,lI,lR,lB,lz,lF,lV,lU,lH,lW,lY,lG,l$,lX,lq,lK,lZ,lQ,lJ,l0,l1,l2,l5,l3,l4,l6,l8,l7,l9,ce,ct,cn,cr,ci,ca,co,cs,cl,cc,cu,cd,ch,cf,cp,cm,cg,cv,cx,cy,cb,cw,cj,cN,ck,cC,cE,c_,cS,cT,cA,cO,cM,cP,cD,cL,cI,cR,cB,cz,cF,cV,cU,cH,cW,cY,cG,c$,cX,cq,cK,cZ,cQ,cJ,c0,c1,c2,c5,c3,c4,c6,c8,c7,c9,ue,ut,un,ur,ui,ua,uo,us,ul,uc,uu,ud,uh,uf,up,um,ug,uv,ux,uy,ub,uw,uj,uN,uk,uC,uE,u_,uS,uT,uA,uO,uM,uP,uD,uL,uI,uR,uB,uz,uF,uV,uU,uH,uW,uY,uG,u$,uX,uq,uK,uZ,uQ,uJ,u0,u1,u2,u5,u3,u4,u6,u8={},u7={},u9=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},de=function(e,t){t.x=-1*e.x,t.y=-1*e.y,t.nx=-1*e.nx,t.ny=-1*e.ny,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},dt=function(e,t,n,r,i){if(e!==x?u9(t,e,u8):de(u7,u8),u9(t,n,u7),uZ=u8.nx*u7.ny-u8.ny*u7.nx,uQ=u8.nx*u7.nx- -(u8.ny*u7.ny),1e-6>Math.abs(u1=Math.asin(Math.max(-1,Math.min(1,uZ))))){uq=t.x,uK=t.y,u5=u4=0;return}uJ=1,u0=!1,uQ<0?u1<0?u1=Math.PI+u1:(u1=Math.PI-u1,uJ=-1,u0=!0):u1>0&&(uJ=-1,u0=!0),u4=void 0!==t.radius?t.radius:r,u2=u1/2,u6=Math.min(u8.len/2,u7.len/2),u5=i?(u3=Math.abs(Math.cos(u2)*u4/Math.sin(u2)))>u6?Math.abs((u3=u6)*Math.sin(u2)/Math.cos(u2)):u4:Math.abs((u3=Math.min(u6,u4))*Math.sin(u2)/Math.cos(u2)),g=t.x+u7.nx*u3,v=t.y+u7.ny*u3,uq=g-u7.ny*u5*uJ,uK=v+u7.nx*u5*uJ,f=t.x+u8.nx*u3,p=t.y+u8.ny*u3,x=t};function dn(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function dr(e,t,n,r){var i=!(arguments.length>4)||void 0===arguments[4]||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(dt(e,t,n,r,i),{cx:uq,cy:uK,radius:u5,startX:f,startY:p,stopX:g,stopY:v,startAngle:u8.ang+Math.PI/2*uJ,endAngle:u7.ang-Math.PI/2*uJ,counterClockwise:u0})}var di=Math.sqrt(.02),da={};function ds(e){var t=[];if(null!=e){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}da.findMidptPtsEtc=function(e,t){var n,r=t.posPts,i=t.intersectionPts,a=t.vectorNormInverse,o=e.pstyle("source-endpoint"),s=e.pstyle("target-endpoint"),l=null!=o.units&&null!=s.units;switch(e.pstyle("edge-distances").value){case"node-position":n=r;break;case"intersection":n=i;break;case"endpoints":if(l){var c,u,d,h=t6(this.manualEndptToPx(e.source()[0],o),2),f=h[0],p=h[1],g=t6(this.manualEndptToPx(e.target()[0],s),2),v=g[0],x=g[1];c=x-p,d=Math.sqrt((u=v-f)*u+c*c),a={x:-c/d,y:u/d},n={x1:f,y1:p,x2:v,y2:x}}else rl("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),n=i}return{midptPts:n,vectorNormInverse:a}},da.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=2*Math.random()*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},i.target={x:Math.cos(a=2*Math.random()*Math.PI),y:Math.sin(a)}}var o=r.source,s=r.target,l=o.position(),c=s.position(),u=o.width(),d=s.width(),h=o.height(),f=s.height(),p=n.pstyle("haystack-radius").value/2;i.haystackPts=i.allpts=[i.source.x*u*p+l.x,i.source.y*h*p+l.y,i.target.x*d*p+c.x,i.target.y*f*p+c.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},da.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),i=e.pstyle("segment-distances"),a=e.pstyle("segment-radii"),o=e.pstyle("radius-type"),s=Math.min(r.pfValue.length,i.pfValue.length),l=a.pfValue[a.pfValue.length-1],c=o.pfValue[o.pfValue.length-1];n.edgeType="segments",n.segpts=[],n.radii=[],n.isArcRadius=[];for(var u=0;u<s;u++){var d=r.pfValue[u],h=i.pfValue[u],f=1-d,p=this.findMidptPtsEtc(e,t),g=p.midptPts,v=p.vectorNormInverse,x={x:g.x1*f+g.x2*d,y:g.y1*f+g.y2*d};n.segpts.push(x.x+v.x*h,x.y+v.y*h),n.radii.push(void 0!==a.pfValue[u]?a.pfValue[u]:l),n.isArcRadius.push((void 0!==o.pfValue[u]?o.pfValue[u]:c)==="arc-radius")}},da.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,c=e.pstyle("loop-direction").pfValue,u=e.pstyle("loop-sweep").pfValue,d=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var h=n,f=d;r&&(h=0,f=l);var p=c-Math.PI/2,g=p-u/2,v=p+u/2,x=String(c+"_"+u);h=void 0===a[x]?a[x]=0:++a[x],i.ctrlpts=[o.x+1.4*Math.cos(g)*f*(h/3+1),o.y+1.4*Math.sin(g)*f*(h/3+1),o.x+1.4*Math.cos(v)*f*(h/3+1),o.y+1.4*Math.sin(v)*f*(h/3+1)]},da.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType="compound";var a=t.srcPos,o=t.tgtPos,s=t.srcW,l=t.srcH,c=t.tgtW,u=t.tgtH,d=e.pstyle("control-point-step-size").pfValue,h=e.pstyle("control-point-distances"),f=h?h.pfValue[0]:void 0,p=n,g=d;r&&(p=0,g=f);var v={x:a.x-s/2,y:a.y-l/2},x={x:o.x-c/2,y:o.y-u/2},y={x:Math.min(v.x,x.x),y:Math.min(v.y,x.y)},b=Math.max(.5,Math.log(.01*s)),w=Math.max(.5,Math.log(.01*c));i.ctrlpts=[y.x,y.y-1.7995514309304248*g*(p/3+1)*b,y.x-1.7995514309304248*g*(p/3+1)*w,y.y]},da.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},da.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=e.pstyle("control-point-step-size").pfValue,s=e.pstyle("control-point-distances"),l=e.pstyle("control-point-weights"),c=s&&l?Math.min(s.value.length,l.value.length):1,u=s?s.pfValue[0]:void 0,d=l.value[0];a.edgeType=r?"multibezier":"bezier",a.ctrlpts=[];for(var h=0;h<c;h++){var f=(.5-t.eles.length/2+n)*o*(i?-1:1),p=void 0,g=rY(f);r&&(u=s?s.pfValue[h]:o,d=l.value[h]);var v=void 0!==(p=r?u:void 0!==u?g*u:void 0)?p:f,x=1-d,y=d,b=this.findMidptPtsEtc(e,t),w=b.midptPts,j=b.vectorNormInverse,N={x:w.x1*x+w.x2*y,y:w.y1*x+w.y2*y};a.ctrlpts.push(N.x+j.x*v,N.y+j.y*v)}},da.findTaxiPoints=function(e,t){var n,r=e._private.rscratch;r.edgeType="segments";var i="vertical",a="horizontal",o="leftward",s="rightward",l="downward",c="upward",u=t.posPts,d=t.srcW,h=t.srcH,f=t.tgtW,p=t.tgtH,g="node-position"!==e.pstyle("edge-distances").value,v=e.pstyle("taxi-direction").value,x=v,y=e.pstyle("taxi-turn"),b="%"===y.units,w=y.pfValue,j=e.pstyle("taxi-turn-min-distance").pfValue,N=u.x2-u.x1,k=u.y2-u.y1,C=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},E=C(N,g?(d+f)/2:0),_=C(k,g?(h+p)/2:0),S=!1;"auto"===x?v=Math.abs(E)>Math.abs(_)?a:i:x===c||x===l?(v=i,S=!0):(x===o||x===s)&&(v=a,S=!0);var T=v===i,A=T?_:E,O=T?k:N,M=rY(O),P=!1;!(S&&(b||w<0))&&(x===l&&O<0||x===c&&O>0||x===o&&O>0||x===s&&O<0)&&(M*=-1,A=M*Math.abs(A),P=!0);var D=function(e){return Math.abs(e)<j||Math.abs(e)>=Math.abs(A)},L=D(n=b?(w<0?1+w:w)*A:(w<0?A:0)+w*M),I=D(Math.abs(A)-Math.abs(n));if((L||I)&&!P)if(T){var R=Math.abs(N)<=f/2;if(Math.abs(O)<=h/2){var B=(u.x1+u.x2)/2;r.segpts=[B,u.y1,B,u.y2]}else if(R){var z=(u.y1+u.y2)/2;r.segpts=[u.x1,z,u.x2,z]}else r.segpts=[u.x1,u.y2]}else{var F=Math.abs(k)<=p/2;if(Math.abs(O)<=d/2){var V=(u.y1+u.y2)/2;r.segpts=[u.x1,V,u.x2,V]}else if(F){var U=(u.x1+u.x2)/2;r.segpts=[U,u.y1,U,u.y2]}else r.segpts=[u.x2,u.y1]}else if(T){var H=u.y1+n+(g?h/2*M:0);r.segpts=[u.x1,H,u.x2,H]}else{var W=u.x1+n+(g?d/2*M:0);r.segpts=[W,u.y1,W,u.y2]}if(r.isRound){var Y=e.pstyle("taxi-radius").value,G="arc-radius"===e.pstyle("radius-type").value[0];r.radii=Array(r.segpts.length/2).fill(Y),r.isArcRadius=Array(r.segpts.length/2).fill(G)}},da.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,c=t.srcShape,u=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,f=t.srcRs,p=t.tgtRs,g=!nh(n.startX)||!nh(n.startY),v=!nh(n.arrowStartX)||!nh(n.arrowStartY),x=!nh(n.endX)||!nh(n.endY),y=!nh(n.arrowEndX)||!nh(n.arrowEndY),b=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),w=rG({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),j=w<b,N=rG({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),k=N<b,C=!1;if(g||v||j){C=!0;var E={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},_=Math.sqrt(E.x*E.x+E.y*E.y),S={x:E.x/_,y:E.y/_},T=Math.max(a,o),A={x:n.ctrlpts[0]+2*S.x*T,y:n.ctrlpts[1]+2*S.y*T},O=c.intersectLine(r.x,r.y,a,o,A.x,A.y,0,d,f);j?(n.ctrlpts[0]=n.ctrlpts[0]+S.x*(b-w),n.ctrlpts[1]=n.ctrlpts[1]+S.y*(b-w)):(n.ctrlpts[0]=O[0]+S.x*b,n.ctrlpts[1]=O[1]+S.y*b)}if(x||y||k){C=!0;var M={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},P=Math.sqrt(M.x*M.x+M.y*M.y),D={x:M.x/P,y:M.y/P},L=Math.max(a,o),I={x:n.ctrlpts[0]+2*D.x*L,y:n.ctrlpts[1]+2*D.y*L},R=u.intersectLine(i.x,i.y,s,l,I.x,I.y,0,h,p);k?(n.ctrlpts[0]=n.ctrlpts[0]+D.x*(b-N),n.ctrlpts[1]=n.ctrlpts[1]+D.y*(b-N)):(n.ctrlpts[0]=R[0]+D.x*b,n.ctrlpts[1]=R[1]+D.y*b)}C&&this.findEndpoints(e)}},da.storeAllpts=function(e){var t=e._private.rscratch;if("multibezier"===t.edgeType||"bezier"===t.edgeType||"self"===t.edgeType||"compound"===t.edgeType){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n,r=0;r+1<t.ctrlpts.length;r+=2)t.allpts.push(t.ctrlpts[r],t.ctrlpts[r+1]),r+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[r]+t.ctrlpts[r+2])/2,(t.ctrlpts[r+1]+t.ctrlpts[r+3])/2);(t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2==0)?(n=t.allpts.length/2-1,t.midX=t.allpts[n],t.midY=t.allpts[n+1]):(n=t.allpts.length/2-3,t.midX=rq(t.allpts[n],t.allpts[n+2],t.allpts[n+4],.5),t.midY=rq(t.allpts[n+1],t.allpts[n+3],t.allpts[n+5],.5))}else if("straight"===t.edgeType)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if("segments"===t.edgeType){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var i=2;i+3<t.allpts.length;i+=2){var a=t.radii[i/2-1],o=t.isArcRadius[i/2-1];t.roundCorners.push(dr({x:t.allpts[i-2],y:t.allpts[i-1]},{x:t.allpts[i],y:t.allpts[i+1],radius:a},{x:t.allpts[i+2],y:t.allpts[i+3]},a,o))}}if(t.segpts.length%4==0){var s=t.segpts.length/2,l=s-2;t.midX=(t.segpts[l]+t.segpts[s])/2,t.midY=(t.segpts[l+1]+t.segpts[s+1])/2}else{var c=t.segpts.length/2-1;if(t.isRound){var u={x:t.segpts[c],y:t.segpts[c+1]},d=t.roundCorners[c/2];if(0===d.radius){var h={x:t.segpts[c+2],y:t.segpts[c+3]};t.midX=u.x,t.midY=u.y,t.midVector=[u.y-h.y,h.x-u.x]}else{var f=[u.x-d.cx,u.y-d.cy],p=d.radius/Math.sqrt(Math.pow(f[0],2)+Math.pow(f[1],2));f=f.map(function(e){return e*p}),t.midX=d.cx+f[0],t.midY=d.cy+f[1],t.midVector=f}}else t.midX=t.segpts[c],t.midY=t.segpts[c+1]}}},da.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||nh(t.startX)&&nh(t.startY)&&nh(t.endX)&&nh(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,rl("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},da.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var n=this,r=n.cy.hasCompoundNodes(),i=new rb,a=function(e,t){return[].concat(t8(e),[+!!t]).join("-")},o=[],s=[],l=0;l<e.length;l++){var c=e[l],u=c._private,d=c.pstyle("curve-style").value;if(!c.removed()&&c.takesUpSpace()){if("haystack"===d){s.push(c);continue}var h="unbundled-bezier"===d||nE(d,"segments")||"straight"===d||"straight-triangle"===d||nE(d,"taxi"),f="unbundled-bezier"===d||"bezier"===d,p=u.source,g=u.target,v=[p.poolIndex(),g.poolIndex()].sort(),x=a(v,h),y=i.get(x);null==y&&(y={eles:[]},o.push({pairId:v,edgeIsUnbundled:h}),i.set(x,y)),y.eles.push(c),h&&(y.hasUnbundled=!0),f&&(y.hasBezier=!0)}}for(var b=0;b<o.length;b++)!function(){var e,s=o[b],l=a(s.pairId,s.edgeIsUnbundled),c=i.get(l);if(!c.hasUnbundled){var u=c.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});rm(c.eles),u.forEach(function(e){return c.eles.push(e)}),c.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var d=c.eles[0],h=d.source(),f=d.target();if(h.poolIndex()>f.poolIndex()){var p=h;h=f,f=p}var g=c.srcPos=h.position(),v=c.tgtPos=f.position(),x=c.srcW=h.outerWidth(),y=c.srcH=h.outerHeight(),w=c.tgtW=f.outerWidth(),j=c.tgtH=f.outerHeight(),N=c.srcShape=n.nodeShapes[t.getNodeShape(h)],k=c.tgtShape=n.nodeShapes[t.getNodeShape(f)],C=c.srcCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,E=c.tgtCornerRadius="auto"===f.pstyle("corner-radius").value?"auto":f.pstyle("corner-radius").pfValue,_=c.tgtRs=f._private.rscratch,S=c.srcRs=h._private.rscratch;c.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var T=0;T<c.eles.length;T++){var A=c.eles[T],O=A[0]._private.rscratch,M=A.pstyle("curve-style").value,P="unbundled-bezier"===M||nE(M,"segments")||nE(M,"taxi"),D=!h.same(A.source());if(!c.calculatedIntersection&&h!==f&&(c.hasBezier||c.hasUnbundled)){c.calculatedIntersection=!0;var L=N.intersectLine(g.x,g.y,x,y,v.x,v.y,0,C,S),I=c.srcIntn=L,R=k.intersectLine(v.x,v.y,w,j,g.x,g.y,0,E,_),B=c.tgtIntn=R,z=c.intersectionPts={x1:L[0],x2:R[0],y1:L[1],y2:R[1]},F=c.posPts={x1:g.x,x2:v.x,y1:g.y,y2:v.y},V=R[1]-L[1],U=R[0]-L[0],H=Math.sqrt(U*U+V*V);nh(H)&&H>=di||(H=Math.sqrt(Math.max(U*U,.01)+Math.max(V*V,.01)));var W=c.vector={x:U,y:V},Y=c.vectorNorm={x:W.x/H,y:W.y/H},G={x:-Y.y,y:Y.x};c.nodesOverlap=!nh(H)||k.checkPoint(L[0],L[1],0,w,j,v.x,v.y,E,_)||N.checkPoint(R[0],R[1],0,x,y,g.x,g.y,C,S),c.vectorNormInverse=G,e={nodesOverlap:c.nodesOverlap,dirCounts:c.dirCounts,calculatedIntersection:!0,hasBezier:c.hasBezier,hasUnbundled:c.hasUnbundled,eles:c.eles,srcPos:v,srcRs:_,tgtPos:g,tgtRs:S,srcW:w,srcH:j,tgtW:x,tgtH:y,srcIntn:B,tgtIntn:I,srcShape:k,tgtShape:N,posPts:{x1:F.x2,y1:F.y2,x2:F.x1,y2:F.y1},intersectionPts:{x1:z.x2,y1:z.y2,x2:z.x1,y2:z.y1},vector:{x:-W.x,y:-W.y},vectorNorm:{x:-Y.x,y:-Y.y},vectorNormInverse:{x:-G.x,y:-G.y}}}var $=D?e:c;O.nodesOverlap=$.nodesOverlap,O.srcIntn=$.srcIntn,O.tgtIntn=$.tgtIntn,O.isRound=M.startsWith("round"),r&&(h.isParent()||h.isChild()||f.isParent()||f.isChild())&&(h.parents().anySame(f)||f.parents().anySame(h)||h.same(f)&&h.isParent())?t.findCompoundLoopPoints(A,$,T,P):h===f?t.findLoopPoints(A,$,T,P):M.endsWith("segments")?t.findSegmentsPoints(A,$):M.endsWith("taxi")?t.findTaxiPoints(A,$):"straight"!==M&&(P||c.eles.length%2!=1||T!==Math.floor(c.eles.length/2))?t.findBezierPoints(A,$,T,P,D):t.findStraightEdgePoints(A),t.findEndpoints(A),t.tryToCorrectInvalidPoints(A,$),t.checkForInvalidEdgeWarning(A),t.storeAllpts(A),t.storeEdgeProjections(A),t.calculateArrowAngles(A),t.recalculateEdgeLabelProjections(A),t.calculateLabelAngles(A)}}();this.findHaystackPoints(s)}},da.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),"segments"===t.edgeType)return ds(t.segpts)},da.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if("bezier"===n||"multibezier"===n||"self"===n||"compound"===n)return ds(t.ctrlpts)},da.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var dl={};dl.manualEndptToPx=function(e,t){var n=e.position(),r=e.outerWidth(),i=e.outerHeight(),a=e._private.rscratch;if(2===t.value.length){var o=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(o[0]=o[0]*r),"%"===t.units[1]&&(o[1]=o[1]*i),o[0]+=n.x,o[1]+=n.y,o}var s=t.pfValue[0];s=-Math.PI/2+s;var l=2*Math.max(r,i),c=[n.x+Math.cos(s)*l,n.y+Math.sin(s)*l];return this.nodeShapes[this.getNodeShape(e)].intersectLine(n.x,n.y,r,i,c[0],c[1],0,"auto"===e.pstyle("corner-radius").value?"auto":e.pstyle("corner-radius").pfValue,a)},dl.findEndpoints=function(e){var t,n,r,i,a,o,s,l,c,u=e.source()[0],d=e.target()[0],h=u.position(),f=d.position(),p=e.pstyle("target-arrow-shape").value,g=e.pstyle("source-arrow-shape").value,v=e.pstyle("target-distance-from-node").pfValue,x=e.pstyle("source-distance-from-node").pfValue,y=u._private.rscratch,b=d._private.rscratch,w=e.pstyle("curve-style").value,j=e._private.rscratch,N=j.edgeType,k=nE(w,"taxi"),C="self"===N||"compound"===N,E="bezier"===N||"multibezier"===N||C,_="bezier"!==N,S="straight"===N||"segments"===N,T="segments"===N,A=C||k,O=e.pstyle("source-endpoint"),M=A?"outside-to-node":O.value,P="auto"===u.pstyle("corner-radius").value?"auto":u.pstyle("corner-radius").pfValue,D=e.pstyle("target-endpoint"),L=A?"outside-to-node":D.value,I="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue;j.srcManEndpt=O,j.tgtManEndpt=D;var R=null!=(t=(null==D||null==(n=D.pfValue)?void 0:n.length)===2?D.pfValue:null)?t:[0,0],B=null!=(r=(null==O||null==(i=O.pfValue)?void 0:i.length)===2?O.pfValue:null)?r:[0,0];if(E){var z=[j.ctrlpts[0],j.ctrlpts[1]];o=_?[j.ctrlpts[j.ctrlpts.length-2],j.ctrlpts[j.ctrlpts.length-1]]:z,s=z}else if(S){var F=T?j.segpts.slice(0,2):[f.x+R[0],f.y+R[1]];o=T?j.segpts.slice(j.segpts.length-2):[h.x+B[0],h.y+B[1]],s=F}if("inside-to-node"===L)a=[f.x,f.y];else if(D.units)a=this.manualEndptToPx(d,D);else if("outside-to-line"===L)a=j.tgtIntn;else if("outside-to-node"===L||"outside-to-node-or-label"===L?l=o:("outside-to-line"===L||"outside-to-line-or-label"===L)&&(l=[h.x,h.y]),a=this.nodeShapes[this.getNodeShape(d)].intersectLine(f.x,f.y,d.outerWidth(),d.outerHeight(),l[0],l[1],0,I,b),"outside-to-node-or-label"===L||"outside-to-line-or-label"===L){var V=d._private.rscratch,U=V.labelWidth,H=V.labelHeight,W=V.labelX,Y=V.labelY,G=U/2,$=H/2,X=d.pstyle("text-valign").value;"top"===X?Y-=$:"bottom"===X&&(Y+=$);var q=d.pstyle("text-halign").value;"left"===q?W-=G:"right"===q&&(W+=G);var K=iw(l[0],l[1],[W-G,Y-$,W+G,Y-$,W+G,Y+$,W-G,Y+$],f.x,f.y);if(K.length>0){var Z=r$(h,rB(a)),Q=r$(h,rB(K)),J=Z;Q<Z&&(a=K,J=Q),K.length>2&&r$(h,{x:K[2],y:K[3]})<J&&(a=[K[2],K[3]])}}var ee=iN(a,o,this.arrowShapes[p].spacing(e)+v),et=iN(a,o,this.arrowShapes[p].gap(e)+v);if(j.endX=et[0],j.endY=et[1],j.arrowEndX=ee[0],j.arrowEndY=ee[1],"inside-to-node"===M)a=[h.x,h.y];else if(O.units)a=this.manualEndptToPx(u,O);else if("outside-to-line"===M)a=j.srcIntn;else if("outside-to-node"===M||"outside-to-node-or-label"===M?c=s:("outside-to-line"===M||"outside-to-line-or-label"===M)&&(c=[f.x,f.y]),a=this.nodeShapes[this.getNodeShape(u)].intersectLine(h.x,h.y,u.outerWidth(),u.outerHeight(),c[0],c[1],0,P,y),"outside-to-node-or-label"===M||"outside-to-line-or-label"===M){var en=u._private.rscratch,er=en.labelWidth,ei=en.labelHeight,ea=en.labelX,eo=en.labelY,es=er/2,el=ei/2,ec=u.pstyle("text-valign").value;"top"===ec?eo-=el:"bottom"===ec&&(eo+=el);var eu=u.pstyle("text-halign").value;"left"===eu?ea-=es:"right"===eu&&(ea+=es);var ed=iw(c[0],c[1],[ea-es,eo-el,ea+es,eo-el,ea+es,eo+el,ea-es,eo+el],h.x,h.y);if(ed.length>0){var eh=r$(f,rB(a)),ef=r$(f,rB(ed)),ep=eh;ef<eh&&(a=[ed[0],ed[1]],ep=ef),ed.length>2&&r$(f,{x:ed[2],y:ed[3]})<ep&&(a=[ed[2],ed[3]])}}var em=iN(a,s,this.arrowShapes[g].spacing(e)+x),eg=iN(a,s,this.arrowShapes[g].gap(e)+x);j.startX=eg[0],j.startY=eg[1],j.arrowStartX=em[0],j.arrowStartY=em[1],(E||_||S)&&(nh(j.startX)&&nh(j.startY)&&nh(j.endX)&&nh(j.endY)?j.badLine=!1:j.badLine=!0)},dl.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),"haystack"===t.edgeType)?{x:t.haystackPts[0],y:t.haystackPts[1]}:{x:t.arrowStartX,y:t.arrowStartY}},dl.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),"haystack"===t.edgeType)?{x:t.haystackPts[2],y:t.haystackPts[3]}:{x:t.arrowEndX,y:t.arrowEndY}};var dc={};dc.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,"multibezier"===r||"bezier"===r||"self"===r||"compound"===r){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)!function(e,t,n){for(var r=function(e,t,n,r){return rq(e,t,n,r)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}(this,e,n.allpts.slice(i,i+6))}else if("segments"===r)for(var a=t.rstyle.linePts=[],i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]});else if("haystack"===r){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},dc.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var du={};du.recalculateNodeLabelProjection=function(e){var t,n;if(!ny(e.pstyle("label").strValue)){var r=e._private,i=e.width(),a=e.height(),o=e.padding(),s=e.position(),l=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,u=r.rscratch,d=r.rstyle;switch(l){case"left":t=s.x-i/2-o;break;case"right":t=s.x+i/2+o;break;default:t=s.x}switch(c){case"top":n=s.y-a/2-o;break;case"bottom":n=s.y+a/2+o;break;default:n=s.y}u.labelX=t,u.labelY=n,d.labelX=t,d.labelY=n,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var dd=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},dh=function(e,t){return dd(t.x-e.x,t.y-e.y)},df=function(e,t,n,r){var i=rQ(0,r-.001,1),a=rQ(0,r+.001,1);return dh(rK(e,t,n,i),rK(e,t,n,a))};du.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){rx(n.rscratch,e,t,r),rx(n.rstyle,e,t,r)};o("labelX",null,t.x),o("labelY",null,t.y),o("labelAutoAngle",null,dd(r.midDispX,r.midDispY));var s=function(){if(s.cache)return s.cache;for(var e=[],t=0;t+5<r.allpts.length;t+=4){var a={x:r.allpts[t],y:r.allpts[t+1]},o={x:r.allpts[t+2],y:r.allpts[t+3]},l={x:r.allpts[t+4],y:r.allpts[t+5]};e.push({p0:a,p1:o,p2:l,startDist:0,length:0,segments:[]})}var c=n.rstyle.bezierPts,u=i.bezierProjPcts.length;function d(e,t,n,r,i){var a=rG(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var h=0;h<e.length;h++){var f=e[h],p=e[h-1];p&&(f.startDist=p.startDist+p.length),d(f,f.p0,c[h*u],0,i.bezierProjPcts[0]);for(var g=0;g<u-1;g++)d(f,c[h*u+g],c[h*u+g+1],i.bezierProjPcts[g],i.bezierProjPcts[g+1]);d(f,c[h*u+u-1],f.p2,i.bezierProjPcts[u-1],1)}return s.cache=e},l=function(n){var i="source"===n;if(a[n]){var l=e.pstyle(n+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var c,u,d=s(),h=0,f=0,p=0;p<d.length;p++){for(var g=d[i?p:d.length-1-p],v=0;v<g.segments.length;v++){var x=g.segments[i?v:g.segments.length-1-v],y=p===d.length-1&&v===g.segments.length-1;if(h=f,(f+=x.length)>=l||y){u={cp:g,segment:x};break}}if(u)break}var b=u.cp,w=u.segment,j=(l-h)/w.length,N=w.t1-w.t0,k=i?w.t0+N*j:w.t1-N*j;k=rQ(0,k,1),t=rK(b.p0,b.p1,b.p2,k),c=df(b.p0,b.p1,b.p2,k);break;case"straight":case"segments":case"haystack":for(var C,E,_,S,T=0,A=r.allpts.length,O=0;O+3<A&&(i?(C={x:r.allpts[O],y:r.allpts[O+1]},E={x:r.allpts[O+2],y:r.allpts[O+3]}):(C={x:r.allpts[A-2-O],y:r.allpts[A-1-O]},E={x:r.allpts[A-4-O],y:r.allpts[A-3-O]}),_=rG(C,E),S=T,!((T+=_)>=l));O+=2);var M=(l-S)/_;t=rZ(C,E,M=rQ(0,M,1)),c=dh(C,E)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,c)}};l("source"),l("target"),this.applyLabelDimensions(e)}},du.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},du.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=n4(r,e._private.labelDimsKey);if(rv(n.rscratch,"prefixedLabelDimsKey",t)!==i){rx(n.rscratch,"prefixedLabelDimsKey",t,i);var a=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,s=e.pstyle("text-wrap").strValue,l=rv(n.rscratch,"labelWrapCachedLines",t)||[],c="wrap"!==s?1:Math.max(l.length,1),u=a.height/c,d=a.width,h=a.height+(c-1)*(o-1)*u;rx(n.rstyle,"labelWidth",t,d),rx(n.rscratch,"labelWidth",t,d),rx(n.rstyle,"labelHeight",t,h),rx(n.rscratch,"labelHeight",t,h),rx(n.rscratch,"labelLineHeight",t,u*o)}},du.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(rx(n.rscratch,e,t,r),r):rv(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var c=i.split("\n"),u=e.pstyle("text-max-width").pfValue,d="anywhere"===e.pstyle("text-overflow-wrap").value,h=[],f=/[\s\u200b]+|$/g,p=0;p<c.length;p++){var g=c[p],v=this.calculateLabelDimensions(e,g).width;if(d&&(g=g.split("").join("​")),v>u){var x,y=g.matchAll(f),b="",w=0,j=t3(y);try{for(j.s();!(x=j.n()).done;){var N=x.value,k=N[0],C=g.substring(w,N.index);w=N.index+k.length;var E=0===b.length?C:b+C+k;this.calculateLabelDimensions(e,E).width<=u?b+=C+k:(b&&h.push(b),b=C+k)}}catch(e){j.e(e)}finally{j.f()}b.match(/^[\s\u200b]+$/)||h.push(b)}else h.push(g)}o("labelWrapCachedLines",h),i=o("labelWrapCachedText",h.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){var _=e.pstyle("text-max-width").pfValue,S="",T=!1;if(this.calculateLabelDimensions(e,i).width<_)return i;for(var A=0;A<i.length&&!(this.calculateLabelDimensions(e,S+i[A]+"…").width>_);A++)S+=i[A],A===i.length-1&&(T=!0);return T||(S+="…"),S}return i},du.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},du.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=e.pstyle("font-style").strValue,i=e.pstyle("font-size").pfValue,a=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=this.labelCalcCanvas,l=this.labelCalcCanvasContext;if(!s){s=this.labelCalcCanvas=n.createElement("canvas"),l=this.labelCalcCanvasContext=s.getContext("2d");var c=s.style;c.position="absolute",c.left="-9999px",c.top="-9999px",c.zIndex="-1",c.visibility="hidden",c.pointerEvents="none"}l.font="".concat(r," ").concat(o," ").concat(i,"px ").concat(a);for(var u=0,d=0,h=t.split("\n"),f=0;f<h.length;f++){var p=h[f];u=Math.max(Math.ceil(l.measureText(p).width),u),d+=i}return{width:u+=0,height:d+=0}},du.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),i=e.pstyle((t?t+"-":"")+"text-rotation"),a=i.strValue;return"none"===a?0:r&&"autorotate"===a?n.labelAutoAngle:"autorotate"===a?0:i.pfValue},du.calculateLabelAngles=function(e){var t=e.isEdge(),n=e._private.rscratch;n.labelAngle=this.calculateLabelAngle(e),t&&(n.sourceLabelAngle=this.calculateLabelAngle(e,"source"),n.targetLabelAngle=this.calculateLabelAngle(e,"target"))};var dp={},dm=!1;dp.getNodeShape=function(e){var t=e.pstyle("shape").value;if("cutrectangle"===t&&(28>e.width()||28>e.height()))return dm||(rl("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),dm=!0),"rectangle";if(e.isParent())if("rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t)return t;else return"rectangle";if("polygon"===t){var n=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(n).name}return t};var dg={};dg.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(t.merge(e),n)for(var r=0;r<e.length;r++){var i=e[r]._private.rstyle;i.clean=!1,i.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",function(e){r(e.target)}).on("style.* background.*",function(e){r(e.target,!1)});var i=function(i){if(i){var a=n.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],l=s._private.rstyle;s.isNode()&&!l.cleanConnected&&(r(s.connectedEdges()),l.cleanConnected=!0)}if(a)for(var c=0;c<a.length;c++)(0,a[c])(i,t);n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},dg.onUpdateEleCalcs=function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},dg.recalculateRenderedStyle=function(e,t){var n=function(e){return e._private.rstyle.cleanConnected};if(0!==e.length){var r=[],i=[];if(!this.destroyed){void 0===t&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,l=s.rstyle;!o.isEdge()||n(o.source())&&n(o.target())||(l.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(e){return!e._private.rstyle.clean&&e.isBundledBezier()})&&(l.clean=!1),t&&l.clean||o.removed()||"none"!==o.pstyle("display").value&&("nodes"===s.group?i.push(o):r.push(o),l.clean=!0)}for(var c=0;c<i.length;c++){var u=i[c],d=u._private.rstyle,h=u.position();this.recalculateNodeLabelProjection(u),d.nodeX=h.x,d.nodeY=h.y,d.nodeW=u.pstyle("width").pfValue,d.nodeH=u.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var f=0;f<r.length;f++){var p=r[f]._private,g=p.rstyle,v=p.rscratch;g.srcX=v.arrowStartX,g.srcY=v.arrowStartY,g.tgtX=v.arrowEndX,g.tgtY=v.arrowEndY,g.midX=v.midX,g.midY=v.midY,g.labelAngle=v.labelAngle,g.sourceLabelAngle=v.sourceLabelAngle,g.targetLabelAngle=v.targetLabelAngle}}}};var dv={};dv.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],i=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):i.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}},dv.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},dv.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(o4),t.interactive=t.filter(function(e){return e.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var dx={};[lS,lT,da,dl,dc,du,dp,dg,dv].forEach(function(e){nP(dx,e)});var dy={};dy.getCachedImage=function(e,t,n){var r=this.imageCache=this.imageCache||{},i=r[e];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;var a=(i=r[e]=r[e]||{}).image=new Image;a.addEventListener("load",n),a.addEventListener("error",function(){a.error=!0});var o="data:";return e.substring(0,o.length).toLowerCase()!==o&&(a.crossOrigin=t="null"===t?null:t),a.src=e,a};var db={};db.registerBinding=function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var a=[],o=0;o<e.length;o++){var s=e[o];if(void 0!==s){var l=this.binder(s);a.push(l.on.apply(l,i))}}return a}var l=this.binder(e);return l.on.apply(l,i)},db.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||!("u"<typeof HTMLElement)&&e instanceof HTMLElement;if(null==t.supportsPassiveEvents){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});n.addEventListener("test",null,a)}catch(e){}t.supportsPassiveEvents=i}var o=function(n,i,a){var o=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(o[2]={capture:null!=a&&a,passive:!1,once:!1}),t.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},db.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},db.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},db.load=function(){var e,t,n,r,i,a,o,s,l,c,u,d,h,f,p,g,v,x,y,b,w,j,N,k,C,E=this,_=E.cy.window(),S=function(e){return e.selected()},T=function(e,t,n,r){null==e&&(e=E.cy);for(var i=0;i<t.length;i++){var a=t[i];e.emit({originalEvent:n,type:a,position:r})}},A=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},O=function(e,t){var n=!0;if(E.cy.hasCompoundNodes()&&e&&e.pannable())for(var r=0;t&&r<t.length;r++){var e=t[r];if(e.isNode()&&e.isParent()&&!e.pannable()){n=!1;break}}else n=!0;return n},M=function(e){e[0]._private.grabbed=!0},P=function(e){e[0]._private.grabbed=!1},D=function(e){e[0]._private.rscratch.inDragLayer=!0},L=function(e){e[0]._private.rscratch.inDragLayer=!1},I=function(e){e[0]._private.rscratch.isGrabTarget=!0},R=function(e){e[0]._private.rscratch.isGrabTarget=!1},B=function(e,t){var n=t.addToList;!n.has(e)&&e.grabbable()&&!e.locked()&&(n.merge(e),M(e))},z=function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var n=e.descendants();t.inDragLayer&&(n.forEach(D),n.connectedEdges().forEach(D)),t.addToList&&B(n,t)}},F=function(e,t){t=t||{};var n=e.cy().hasCompoundNodes();t.inDragLayer&&(e.forEach(D),e.neighborhood().stdFilter(function(e){return!n||e.isEdge()}).forEach(D)),t.addToList&&e.forEach(function(e){B(e,t)}),z(e,t),U(e,{inDragLayer:t.inDragLayer}),E.updateCachedGrabbedEles()},V=function(e){e&&(E.getCachedZSortedEles().forEach(function(e){P(e),L(e),R(e)}),E.updateCachedGrabbedEles())},U=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),i=r.connectedEdges();t.inDragLayer&&(i.forEach(D),r.forEach(D)),t.addToList&&r.forEach(function(e){B(e,t)})}}},H=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},W="u">typeof MutationObserver,Y="u">typeof ResizeObserver;W?(E.removeObserver=new MutationObserver(function(e){for(var t=0;t<e.length;t++){var n=e[t].removedNodes;if(n){for(var r=0;r<n.length;r++)if(n[r]===E.container){E.destroy();break}}}}),E.container.parentNode&&E.removeObserver.observe(E.container.parentNode,{childList:!0})):E.registerBinding(E.container,"DOMNodeRemoved",function(e){E.destroy()});var G=nX(function(){E.cy.resize()},100);W&&(E.styleObserver=new MutationObserver(G),E.styleObserver.observe(E.container,{attributes:!0})),E.registerBinding(_,"resize",G),Y&&(E.resizeObserver=new ResizeObserver(G),E.resizeObserver.observe(E.container));for(var $=function(){E.invalidateContainerClientCoordsCache()},X=E.container;null!=X;){e=X,E.registerBinding(e,"transitionend",$),E.registerBinding(e,"animationend",$),E.registerBinding(e,"scroll",$),X=X.parentNode}E.registerBinding(E.container,"contextmenu",function(e){e.preventDefault()});var q=function(e){for(var t=E.findContainerClientCoords(),n=t[0],r=t[1],i=t[2],a=t[3],o=e.touches?e.touches:[e],s=!1,l=0;l<o.length;l++){var c=o[l];if(n<=c.clientX&&c.clientX<=n+i&&r<=c.clientY&&c.clientY<=r+a){s=!0;break}}if(!s)return!1;for(var u=E.container,d=e.target.parentNode,h=!1;d;){if(d===u){h=!0;break}d=d.parentNode}return!!h};E.registerBinding(E.container,"mousedown",function(e){if(q(e)&&(1!==E.hoverData.which||1===e.which)){e.preventDefault(),H(),E.hoverData.capture=!0,E.hoverData.which=e.which;var t=E.cy,n=[e.clientX,e.clientY],r=E.projectIntoViewport(n[0],n[1]),i=E.selection,a=E.findNearestElements(r[0],r[1],!0,!1),o=a[0],s=E.dragData.possibleDragElements;E.hoverData.mdownPos=r,E.hoverData.mdownGPos=n;var l=function(t){return{originalEvent:e,type:t,position:{x:r[0],y:r[1]}}};if(3==e.which){E.hoverData.cxtStarted=!0;var c={originalEvent:e,type:"cxttapstart",position:{x:r[0],y:r[1]}};o?(o.activate(),o.emit(c),E.hoverData.down=o):t.emit(c),E.hoverData.downTime=new Date().getTime(),E.hoverData.cxtDragged=!1}else if(1==e.which){if(o&&o.activate(),null!=o&&E.nodeIsGrabbable(o)){if(I(o),o.selected()){s=E.dragData.possibleDragElements=t.collection();var u=t.$(function(e){return e.isNode()&&e.selected()&&E.nodeIsGrabbable(e)});F(u,{addToList:s}),o.emit(l("grabon")),u.forEach(function(e){e.emit(l("grab"))})}else F(o,{addToList:s=E.dragData.possibleDragElements=t.collection()}),o.emit(l("grabon")).emit(l("grab"));E.redrawHint("eles",!0),E.redrawHint("drag",!0)}E.hoverData.down=o,E.hoverData.downs=a,E.hoverData.downTime=new Date().getTime(),T(o,["mousedown","tapstart","vmousedown"],e,{x:r[0],y:r[1]}),null==o?(i[4]=1,E.data.bgActivePosistion={x:r[0],y:r[1]},E.redrawHint("select",!0),E.redraw()):o.pannable()&&(i[4]=1),E.hoverData.tapholdCancelled=!1,clearTimeout(E.hoverData.tapholdTimeout),E.hoverData.tapholdTimeout=setTimeout(function(){if(!E.hoverData.tapholdCancelled){var e=E.hoverData.down;e?e.emit(l("taphold")):t.emit(l("taphold"))}},E.tapholdDuration)}i[0]=i[2]=r[0],i[1]=i[3]=r[1]}},!1);var K=function(e){var t=e.getRootNode();if(t&&11===t.nodeType&&void 0!==t.host)return t}(E.container);E.registerBinding([_,K],"mousemove",function(e){var t,n;if(E.hoverData.capture||q(e)){var r=!1,i=E.cy,a=i.zoom(),o=[e.clientX,e.clientY],s=E.projectIntoViewport(o[0],o[1]),l=E.hoverData.mdownPos,c=E.hoverData.mdownGPos,u=E.selection,d=null;E.hoverData.draggingEles||E.hoverData.dragging||E.hoverData.selecting||(d=E.findNearestElement(s[0],s[1],!0,!1));var h=E.hoverData.last,f=E.hoverData.down,p=[s[0]-u[2],s[1]-u[3]],g=E.dragData.possibleDragElements;if(c){var v=o[0]-c[0],x=o[1]-c[1];E.hoverData.isOverThresholdDrag=t=v*v+x*x>=E.desktopTapThreshold2}var y=A(e);t&&(E.hoverData.tapholdCancelled=!0),r=!0,T(d,["mousemove","vmousemove","tapdrag"],e,{x:s[0],y:s[1]});var b=function(t){return{originalEvent:e,type:t,position:{x:s[0],y:s[1]}}},w=function(){E.data.bgActivePosistion=void 0,E.hoverData.selecting||i.emit(b("boxstart")),u[4]=1,E.hoverData.selecting=!0,E.redrawHint("select",!0),E.redraw()};if(3===E.hoverData.which){if(t){var j=b("cxtdrag");f?f.emit(j):i.emit(j),E.hoverData.cxtDragged=!0,(!E.hoverData.cxtOver||d!==E.hoverData.cxtOver)&&(E.hoverData.cxtOver&&E.hoverData.cxtOver.emit(b("cxtdragout")),E.hoverData.cxtOver=d,d&&d.emit(b("cxtdragover")))}}else if(E.hoverData.dragging){if(r=!0,i.panningEnabled()&&i.userPanningEnabled()){if(E.hoverData.justStartedPan){var N=E.hoverData.mdownPos;n={x:(s[0]-N[0])*a,y:(s[1]-N[1])*a},E.hoverData.justStartedPan=!1}else n={x:p[0]*a,y:p[1]*a};i.panBy(n),i.emit(b("dragpan")),E.hoverData.dragged=!0}s=E.projectIntoViewport(e.clientX,e.clientY)}else if(1==u[4]&&(null==f||f.pannable()))t&&(!E.hoverData.dragging&&i.boxSelectionEnabled()&&(y||!i.panningEnabled()||!i.userPanningEnabled())?w():!E.hoverData.selecting&&i.panningEnabled()&&i.userPanningEnabled()&&O(f,E.hoverData.downs)&&(E.hoverData.dragging=!0,E.hoverData.justStartedPan=!0,u[4]=0,E.data.bgActivePosistion=rB(l),E.redrawHint("select",!0),E.redraw()),f&&f.pannable()&&f.active()&&f.unactivate());else{if(f&&f.pannable()&&f.active()&&f.unactivate(),f&&f.grabbed()||d==h||(h&&T(h,["mouseout","tapdragout"],e,{x:s[0],y:s[1]}),d&&T(d,["mouseover","tapdragover"],e,{x:s[0],y:s[1]}),E.hoverData.last=d),f)if(t){if(i.boxSelectionEnabled()&&y)f&&f.grabbed()&&(V(g),f.emit(b("freeon")),g.emit(b("free")),E.dragData.didDrag&&(f.emit(b("dragfreeon")),g.emit(b("dragfree")))),w();else if(f&&f.grabbed()&&E.nodeIsDraggable(f)){var k,C=!E.dragData.didDrag;C&&E.redrawHint("eles",!0),E.dragData.didDrag=!0,E.hoverData.draggingEles||F(g,{inDragLayer:!0});var _={x:0,y:0};if(nh(p[0])&&nh(p[1])&&(_.x+=p[0],_.y+=p[1],C)){var S=E.hoverData.dragDelta;S&&nh(S[0])&&nh(S[1])&&(_.x+=S[0],_.y+=S[1])}E.hoverData.draggingEles=!0,g.silentShift(_).emit(b("position")).emit(b("drag")),E.redrawHint("drag",!0),E.redraw()}}else 0===(k=E.hoverData.dragDelta=E.hoverData.dragDelta||[]).length?(k.push(p[0]),k.push(p[1])):(k[0]+=p[0],k[1]+=p[1]);r=!0}if(u[2]=s[0],u[3]=s[1],r)return e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),!1}},!1),E.registerBinding(_,"mouseup",function(e){if((1!==E.hoverData.which||1===e.which||!E.hoverData.capture)&&E.hoverData.capture){E.hoverData.capture=!1;var i=E.cy,a=E.projectIntoViewport(e.clientX,e.clientY),o=E.selection,s=E.findNearestElement(a[0],a[1],!0,!1),l=E.dragData.possibleDragElements,c=E.hoverData.down,u=A(e);E.data.bgActivePosistion&&(E.redrawHint("select",!0),E.redraw()),E.hoverData.tapholdCancelled=!0,E.data.bgActivePosistion=void 0,c&&c.unactivate();var d=function(t){return{originalEvent:e,type:t,position:{x:a[0],y:a[1]}}};if(3===E.hoverData.which){var h=d("cxttapend");if(c?c.emit(h):i.emit(h),!E.hoverData.cxtDragged){var f=d("cxttap");c?c.emit(f):i.emit(f)}E.hoverData.cxtDragged=!1,E.hoverData.which=null}else if(1===E.hoverData.which){if(T(s,["mouseup","tapend","vmouseup"],e,{x:a[0],y:a[1]}),E.dragData.didDrag||E.hoverData.dragged||E.hoverData.selecting||E.hoverData.isOverThresholdDrag||(T(c,["click","tap","vclick"],e,{x:a[0],y:a[1]}),n=!1,e.timeStamp-r<=i.multiClickDebounceTime()?(t&&clearTimeout(t),n=!0,r=null,T(c,["dblclick","dbltap","vdblclick"],e,{x:a[0],y:a[1]})):(t=setTimeout(function(){n||T(c,["oneclick","onetap","voneclick"],e,{x:a[0],y:a[1]})},i.multiClickDebounceTime()),r=e.timeStamp)),null!=c||E.dragData.didDrag||E.hoverData.selecting||E.hoverData.dragged||A(e)||(i.$(S).unselect(["tapunselect"]),l.length>0&&E.redrawHint("eles",!0),E.dragData.possibleDragElements=l=i.collection()),s!=c||E.dragData.didDrag||E.hoverData.selecting||null==s||!s._private.selectable||(E.hoverData.dragging||("additive"===i.selectionType()||u?s.selected()?s.unselect(["tapunselect"]):s.select(["tapselect"]):u||(i.$(S).unmerge(s).unselect(["tapunselect"]),s.select(["tapselect"]))),E.redrawHint("eles",!0)),E.hoverData.selecting){var p=i.collection(E.getAllInBox(o[0],o[1],o[2],o[3]));E.redrawHint("select",!0),p.length>0&&E.redrawHint("eles",!0),i.emit(d("boxend"));"additive"===i.selectionType()||u||i.$(S).unmerge(p).unselect(),p.emit(d("box")).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(d("boxselect")),E.redraw()}if(E.hoverData.dragging&&(E.hoverData.dragging=!1,E.redrawHint("select",!0),E.redrawHint("eles",!0),E.redraw()),!o[4]){E.redrawHint("drag",!0),E.redrawHint("eles",!0);var g=c&&c.grabbed();V(l),g&&(c.emit(d("freeon")),l.emit(d("free")),E.dragData.didDrag&&(c.emit(d("dragfreeon")),l.emit(d("dragfree"))))}}o[4]=0,E.hoverData.down=null,E.hoverData.cxtStarted=!1,E.hoverData.draggingEles=!1,E.hoverData.selecting=!1,E.hoverData.isOverThresholdDrag=!1,E.dragData.didDrag=!1,E.hoverData.dragged=!1,E.hoverData.dragDelta=[],E.hoverData.mdownPos=null,E.hoverData.mdownGPos=null,E.hoverData.which=null}},!1);var Z=[],Q=1e5,J=function(e,t){for(var n=0;n<e.length;n++)if(e[n]%t!=0)return!1;return!0},ee=function(e){for(var t=Math.abs(e[0]),n=1;n<e.length;n++)if(Math.abs(e[n])!==t)return!1;return!0},et=function(e){var t=!1,n=e.deltaY;if(null==n&&(null!=e.wheelDeltaY?n=e.wheelDeltaY/4:null!=e.wheelDelta&&(n=e.wheelDelta/4)),0!==n){if(null==i)if(Z.length>=4){if(!(i=J(Z,5))){var r=Math.abs(Z[0]);i=ee(Z)&&r>5}if(i)for(var a=0;a<Z.length;a++)Q=Math.min(Math.abs(Z[a]),Q)}else Z.push(n),t=!0;else i&&(Q=Math.min(Math.abs(n),Q));if(!E.scrollingPage){var o=E.cy,s=o.zoom(),l=o.pan(),c=E.projectIntoViewport(e.clientX,e.clientY),u=[c[0]*s+l.x,c[1]*s+l.y];if(E.hoverData.draggingEles||E.hoverData.dragging||E.hoverData.cxtStarted||0!==E.selection[4])return void e.preventDefault();if(o.panningEnabled()&&o.userPanningEnabled()&&o.zoomingEnabled()&&o.userZoomingEnabled()){e.preventDefault(),E.data.wheelZooming=!0,clearTimeout(E.data.wheelTimeout),E.data.wheelTimeout=setTimeout(function(){E.data.wheelZooming=!1,E.redrawHint("eles",!0),E.redraw()},150),t&&Math.abs(n)>5&&(n=5*rY(n)),d=-(n/250),i&&(d/=Q,d*=3),d*=E.wheelSensitivity,1===e.deltaMode&&(d*=33);var d,h=o.zoom()*Math.pow(10,d);"gesturechange"===e.type&&(h=E.gestureStartZoom*e.scale),o.zoom({level:h,renderedPosition:{x:u[0],y:u[1]}}),o.emit({type:"gesturechange"===e.type?"pinchzoom":"scrollzoom",originalEvent:e,position:{x:c[0],y:c[1]}})}}}};E.registerBinding(E.container,"wheel",et,!0),E.registerBinding(_,"scroll",function(e){E.scrollingPage=!0,clearTimeout(E.scrollingPageTimeout),E.scrollingPageTimeout=setTimeout(function(){E.scrollingPage=!1},250)},!0),E.registerBinding(E.container,"gesturestart",function(e){E.gestureStartZoom=E.cy.zoom(),E.hasTouchStarted||e.preventDefault()},!0),E.registerBinding(E.container,"gesturechange",function(e){E.hasTouchStarted||et(e)},!0),E.registerBinding(E.container,"mouseout",function(e){var t=E.projectIntoViewport(e.clientX,e.clientY);E.cy.emit({originalEvent:e,type:"mouseout",position:{x:t[0],y:t[1]}})},!1),E.registerBinding(E.container,"mouseover",function(e){var t=E.projectIntoViewport(e.clientX,e.clientY);E.cy.emit({originalEvent:e,type:"mouseover",position:{x:t[0],y:t[1]}})},!1);var en=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},er=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(E.registerBinding(E.container,"touchstart",y=function(e){if(E.hasTouchStarted=!0,q(e)){H(),E.touchData.capture=!0,E.data.bgActivePosistion=void 0;var t=E.cy,n=E.touchData.now,r=E.touchData.earlier;if(e.touches[0]){var i=E.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);n[0]=i[0],n[1]=i[1]}if(e.touches[1]){var i=E.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);n[2]=i[0],n[3]=i[1]}if(e.touches[2]){var i=E.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);n[4]=i[0],n[5]=i[1]}var y=function(t){return{originalEvent:e,type:t,position:{x:n[0],y:n[1]}}};if(e.touches[1]){E.touchData.singleTouchMoved=!0,V(E.dragData.touchDragEles);var b=E.findContainerClientCoords();f=b[0],p=b[1],g=b[2],v=b[3],a=e.touches[0].clientX-f,o=e.touches[0].clientY-p,s=e.touches[1].clientX-f,l=e.touches[1].clientY-p,x=0<=a&&a<=g&&0<=s&&s<=g&&0<=o&&o<=v&&0<=l&&l<=v;var w=t.pan(),j=t.zoom();if(c=en(a,o,s,l),u=er(a,o,s,l),h=[((d=[(a+s)/2,(o+l)/2])[0]-w.x)/j,(d[1]-w.y)/j],u<4e4&&!e.touches[2]){var N=E.findNearestElement(n[0],n[1],!0,!0),k=E.findNearestElement(n[2],n[3],!0,!0);N&&N.isNode()?(N.activate().emit(y("cxttapstart")),E.touchData.start=N):k&&k.isNode()?(k.activate().emit(y("cxttapstart")),E.touchData.start=k):t.emit(y("cxttapstart")),E.touchData.start&&(E.touchData.start._private.grabbed=!1),E.touchData.cxt=!0,E.touchData.cxtDragged=!1,E.data.bgActivePosistion=void 0,E.redraw();return}}if(e.touches[2])t.boxSelectionEnabled()&&e.preventDefault();else if(e.touches[1]);else if(e.touches[0]){var C=E.findNearestElements(n[0],n[1],!0,!0),_=C[0];if(null!=_&&(_.activate(),E.touchData.start=_,E.touchData.starts=C,E.nodeIsGrabbable(_))){var S=E.dragData.touchDragEles=t.collection(),A=null;E.redrawHint("eles",!0),E.redrawHint("drag",!0),_.selected()?F(A=t.$(function(e){return e.selected()&&E.nodeIsGrabbable(e)}),{addToList:S}):F(_,{addToList:S}),I(_),_.emit(y("grabon")),A?A.forEach(function(e){e.emit(y("grab"))}):_.emit(y("grab"))}T(_,["touchstart","tapstart","vmousedown"],e,{x:n[0],y:n[1]}),null==_&&(E.data.bgActivePosistion={x:i[0],y:i[1]},E.redrawHint("select",!0),E.redraw()),E.touchData.singleTouchMoved=!1,E.touchData.singleTouchStartTime=+new Date,clearTimeout(E.touchData.tapholdTimeout),E.touchData.tapholdTimeout=setTimeout(function(){!1!==E.touchData.singleTouchMoved||E.pinching||E.touchData.selecting||T(E.touchData.start,["taphold"],e,{x:n[0],y:n[1]})},E.tapholdDuration)}if(e.touches.length>=1){for(var O=E.touchData.startPosition=[null,null,null,null,null,null],M=0;M<n.length;M++)O[M]=r[M]=n[M];var P=e.touches[0];E.touchData.startGPosition=[P.clientX,P.clientY]}}},!1),E.registerBinding(_,"touchmove",b=function(e){var t=E.touchData.capture;if(t||q(e)){var n=E.selection,r=E.cy,i=E.touchData.now,d=E.touchData.earlier,g=r.zoom();if(e.touches[0]){var v=E.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);i[0]=v[0],i[1]=v[1]}if(e.touches[1]){var v=E.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);i[2]=v[0],i[3]=v[1]}if(e.touches[2]){var v=E.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);i[4]=v[0],i[5]=v[1]}var y=function(t){return{originalEvent:e,type:t,position:{x:i[0],y:i[1]}}},b=E.touchData.startGPosition;if(t&&e.touches[0]&&b){for(var w=[],j=0;j<i.length;j++)w[j]=i[j]-d[j];var N=e.touches[0].clientX-b[0],k=N*N,C=e.touches[0].clientY-b[1];et=k+C*C>=E.touchTapThreshold2}if(t&&E.touchData.cxt){e.preventDefault();var _=e.touches[0].clientX-f,S=e.touches[0].clientY-p,A=e.touches[1].clientX-f,M=e.touches[1].clientY-p,P=er(_,S,A,M);if(P/u>=2.25||P>=22500){E.touchData.cxt=!1,E.data.bgActivePosistion=void 0,E.redrawHint("select",!0);var D=y("cxttapend");E.touchData.start?(E.touchData.start.unactivate().emit(D),E.touchData.start=null):r.emit(D)}}if(t&&E.touchData.cxt){var D=y("cxtdrag");E.data.bgActivePosistion=void 0,E.redrawHint("select",!0),E.touchData.start?E.touchData.start.emit(D):r.emit(D),E.touchData.start&&(E.touchData.start._private.grabbed=!1),E.touchData.cxtDragged=!0;var L=E.findNearestElement(i[0],i[1],!0,!0);(!E.touchData.cxtOver||L!==E.touchData.cxtOver)&&(E.touchData.cxtOver&&E.touchData.cxtOver.emit(y("cxtdragout")),E.touchData.cxtOver=L,L&&L.emit(y("cxtdragover")))}else if(t&&e.touches[2]&&r.boxSelectionEnabled())e.preventDefault(),E.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,E.touchData.selecting||r.emit(y("boxstart")),E.touchData.selecting=!0,E.touchData.didSelect=!0,n[4]=1,n&&0!==n.length&&void 0!==n[0]?(n[2]=(i[0]+i[2]+i[4])/3,n[3]=(i[1]+i[3]+i[5])/3):(n[0]=(i[0]+i[2]+i[4])/3,n[1]=(i[1]+i[3]+i[5])/3,n[2]=(i[0]+i[2]+i[4])/3+1,n[3]=(i[1]+i[3]+i[5])/3+1),E.redrawHint("select",!0),E.redraw();else if(t&&e.touches[1]&&!E.touchData.didSelect&&r.zoomingEnabled()&&r.panningEnabled()&&r.userZoomingEnabled()&&r.userPanningEnabled()){e.preventDefault(),E.data.bgActivePosistion=void 0,E.redrawHint("select",!0);var I=E.dragData.touchDragEles;if(I){E.redrawHint("drag",!0);for(var R=0;R<I.length;R++){var B=I[R]._private;B.grabbed=!1,B.rscratch.inDragLayer=!1}}var z=E.touchData.start,_=e.touches[0].clientX-f,S=e.touches[0].clientY-p,A=e.touches[1].clientX-f,M=e.touches[1].clientY-p,U=en(_,S,A,M),H=U/c;if(x){var W=_-a,Y=S-o,G=A-s,$=M-l,X=r.zoom(),K=X*H,Z=r.pan(),Q=h[0]*X+Z.x,J=h[1]*X+Z.y,ee={x:-K/X*(Q-Z.x-(W+G)/2)+Q,y:-K/X*(J-Z.y-(Y+$)/2)+J};if(z&&z.active()){var I=E.dragData.touchDragEles;V(I),E.redrawHint("drag",!0),E.redrawHint("eles",!0),z.unactivate().emit(y("freeon")),I.emit(y("free")),E.dragData.didDrag&&(z.emit(y("dragfreeon")),I.emit(y("dragfree")))}r.viewport({zoom:K,pan:ee,cancelOnFailedZoom:!0}),r.emit(y("pinchzoom")),c=U,a=_,o=S,s=A,l=M,E.pinching=!0}if(e.touches[0]){var v=E.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);i[0]=v[0],i[1]=v[1]}if(e.touches[1]){var v=E.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);i[2]=v[0],i[3]=v[1]}if(e.touches[2]){var v=E.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);i[4]=v[0],i[5]=v[1]}}else if(e.touches[0]&&!E.touchData.didSelect){var et,L,ei=E.touchData.start,ea=E.touchData.last;if(E.hoverData.draggingEles||E.swipePanning||(L=E.findNearestElement(i[0],i[1],!0,!0)),t&&null!=ei&&e.preventDefault(),t&&null!=ei&&E.nodeIsDraggable(ei))if(et){var I=E.dragData.touchDragEles,eo=!E.dragData.didDrag;eo&&F(I,{inDragLayer:!0}),E.dragData.didDrag=!0;var es={x:0,y:0};if(nh(w[0])&&nh(w[1])&&(es.x+=w[0],es.y+=w[1],eo)){E.redrawHint("eles",!0);var el=E.touchData.dragDelta;el&&nh(el[0])&&nh(el[1])&&(es.x+=el[0],es.y+=el[1])}E.hoverData.draggingEles=!0,I.silentShift(es).emit(y("position")).emit(y("drag")),E.redrawHint("drag",!0),E.touchData.startPosition[0]==d[0]&&E.touchData.startPosition[1]==d[1]&&E.redrawHint("eles",!0),E.redraw()}else{var el=E.touchData.dragDelta=E.touchData.dragDelta||[];0===el.length?(el.push(w[0]),el.push(w[1])):(el[0]+=w[0],el[1]+=w[1])}if(T(ei||L,["touchmove","tapdrag","vmousemove"],e,{x:i[0],y:i[1]}),ei&&ei.grabbed()||L==ea||(ea&&ea.emit(y("tapdragout")),L&&L.emit(y("tapdragover"))),E.touchData.last=L,t)for(var R=0;R<i.length;R++)i[R]&&E.touchData.startPosition[R]&&et&&(E.touchData.singleTouchMoved=!0);if(t&&(null==ei||ei.pannable())&&r.panningEnabled()&&r.userPanningEnabled()){O(ei,E.touchData.starts)&&(e.preventDefault(),E.data.bgActivePosistion||(E.data.bgActivePosistion=rB(E.touchData.startPosition)),E.swipePanning?(r.panBy({x:w[0]*g,y:w[1]*g}),r.emit(y("dragpan"))):et&&(E.swipePanning=!0,r.panBy({x:N*g,y:C*g}),r.emit(y("dragpan")),ei&&(ei.unactivate(),E.redrawHint("select",!0),E.touchData.start=null)));var v=E.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);i[0]=v[0],i[1]=v[1]}}for(var j=0;j<i.length;j++)d[j]=i[j];t&&e.touches.length>0&&!E.hoverData.draggingEles&&!E.swipePanning&&null!=E.data.bgActivePosistion&&(E.data.bgActivePosistion=void 0,E.redrawHint("select",!0),E.redraw())}},!1),E.registerBinding(_,"touchcancel",w=function(e){var t=E.touchData.start;E.touchData.capture=!1,t&&t.unactivate()}),E.registerBinding(_,"touchend",j=function(e){var t,n=E.touchData.start;if(E.touchData.capture){0===e.touches.length&&(E.touchData.capture=!1),e.preventDefault();var r=E.selection;E.swipePanning=!1,E.hoverData.draggingEles=!1;var i=E.cy,a=i.zoom(),o=E.touchData.now,s=E.touchData.earlier;if(e.touches[0]){var l=E.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);o[0]=l[0],o[1]=l[1]}if(e.touches[1]){var l=E.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);o[2]=l[0],o[3]=l[1]}if(e.touches[2]){var l=E.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);o[4]=l[0],o[5]=l[1]}var c=function(t){return{originalEvent:e,type:t,position:{x:o[0],y:o[1]}}};if(n&&n.unactivate(),E.touchData.cxt){if(t=c("cxttapend"),n?n.emit(t):i.emit(t),!E.touchData.cxtDragged){var u=c("cxttap");n?n.emit(u):i.emit(u)}E.touchData.start&&(E.touchData.start._private.grabbed=!1),E.touchData.cxt=!1,E.touchData.start=null,E.redraw();return}if(!e.touches[2]&&i.boxSelectionEnabled()&&E.touchData.selecting){E.touchData.selecting=!1;var d=i.collection(E.getAllInBox(r[0],r[1],r[2],r[3]));r[0]=void 0,r[1]=void 0,r[2]=void 0,r[3]=void 0,r[4]=0,E.redrawHint("select",!0),i.emit(c("boxend")),d.emit(c("box")).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(c("boxselect")),d.nonempty()&&E.redrawHint("eles",!0),E.redraw()}if(null!=n&&n.unactivate(),e.touches[2])E.data.bgActivePosistion=void 0,E.redrawHint("select",!0);else if(e.touches[1]);else if(e.touches[0]);else if(!e.touches[0]){E.data.bgActivePosistion=void 0,E.redrawHint("select",!0);var h=E.dragData.touchDragEles;if(null!=n){var f=n._private.grabbed;V(h),E.redrawHint("drag",!0),E.redrawHint("eles",!0),f&&(n.emit(c("freeon")),h.emit(c("free")),E.dragData.didDrag&&(n.emit(c("dragfreeon")),h.emit(c("dragfree")))),T(n,["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]}),n.unactivate(),E.touchData.start=null}else T(E.findNearestElement(o[0],o[1],!0,!0),["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]});var p=E.touchData.startPosition[0]-o[0],g=E.touchData.startPosition[1]-o[1];E.touchData.singleTouchMoved||(n||i.$(":selected").unselect(["tapunselect"]),T(n,["tap","vclick"],e,{x:o[0],y:o[1]}),N=!1,e.timeStamp-C<=i.multiClickDebounceTime()?(k&&clearTimeout(k),N=!0,C=null,T(n,["dbltap","vdblclick"],e,{x:o[0],y:o[1]})):(k=setTimeout(function(){N||T(n,["onetap","voneclick"],e,{x:o[0],y:o[1]})},i.multiClickDebounceTime()),C=e.timeStamp)),null!=n&&!E.dragData.didDrag&&n._private.selectable&&(p*p+g*g)*a*a<E.touchTapThreshold2&&!E.pinching&&("single"===i.selectionType()?(i.$(S).unmerge(n).unselect(["tapunselect"]),n.select(["tapselect"])):n.selected()?n.unselect(["tapunselect"]):n.select(["tapselect"]),E.redrawHint("eles",!0)),E.touchData.singleTouchMoved=!0}for(var v=0;v<o.length;v++)s[v]=o[v];E.dragData.didDrag=!1,0===e.touches.length&&(E.touchData.dragDelta=[],E.touchData.startPosition=[null,null,null,null,null,null],E.touchData.startGPosition=null,E.touchData.didSelect=!1),e.touches.length<2&&(1===e.touches.length&&(E.touchData.startGPosition=[e.touches[0].clientX,e.touches[0].clientY]),E.pinching=!1,E.redrawHint("eles",!0),E.redraw())}},!1),"u"<typeof TouchEvent){var ei=[],ea=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},eo=function(e){ei.push({event:e,touch:ea(e)})},es=function(e){for(var t=0;t<ei.length;t++)if(ei[t].event.pointerId===e.pointerId)return void ei.splice(t,1)},el=function(e){var t=ei.filter(function(t){return t.event.pointerId===e.pointerId})[0];t.event=e,t.touch=ea(e)},ec=function(e){e.touches=ei.map(function(e){return e.touch})},eu=function(e){return"mouse"===e.pointerType||4===e.pointerType};E.registerBinding(E.container,"pointerdown",function(e){eu(e)||(e.preventDefault(),eo(e),ec(e),y(e))}),E.registerBinding(E.container,"pointerup",function(e){eu(e)||(es(e),ec(e),j(e))}),E.registerBinding(E.container,"pointercancel",function(e){eu(e)||(es(e),ec(e),w(e))}),E.registerBinding(E.container,"pointermove",function(e){eu(e)||(e.preventDefault(),el(e),ec(e),b(e))})}};var dw={};dw.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl("polygon",e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o,s){return iw(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o,s){return iu(e,t,this.points,a,o,r,i,[0,-1],n)},hasMiterBounds:"rectangle"!==e,miterBounds:function(e,t,n,r,i,a){var o,s,l;return o=this.points,s=function(e,t){if(e.length<3)throw Error("Need at least 3 vertices");var n=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},r=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},i=function(e,t){return{x:e.x*t,y:e.y*t}},a=function(e,t){return e.x*t.y-e.y*t.x},o=e.map(function(e){return{x:e.x,y:e.y}});0>function(e){for(var t=0,n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length];t+=r.x*i.y-i.x*r.y}return t/2}(o)&&o.reverse();for(var s=o.length,l=[],c=0;c<s;c++){var u=o[c],d=r(o[(c+1)%s],u),h=function(e){var t=ie(e.x,e.y);return 0===t?{x:0,y:0}:{x:e.x/t,y:e.y/t}}({x:d.y,y:-d.x});l.push(h)}for(var f=l.map(function(e,r){return{p1:n(o[r],i(e,t)),p2:n(o[(r+1)%s],i(e,t))}}),p=[],g=0;g<s;g++){var v=f[(g-1+s)%s],x=f[g],y=function(e,t,o,s){var l=r(t,e),c=r(s,o),u=a(l,c);if(1e-9>Math.abs(u))return n(e,i(l,.5));var d=a(r(o,e),c)/u;return n(e,i(l,d))}(v.p1,v.p2,x.p1,x.p2);p.push(y)}return p}(ib(o,e,t,n,r),i),l=rJ(),s.forEach(function(e){return r2(l,e.x,e.y)}),l}}},dw.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){return im(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o,s){return ig(e,t,r,i,a,o,n)}}},dw.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(e,n,r,i,a,o,s){if(void 0!==o[s]&&o[s+"-cx"]===e&&o[s+"-cy"]===n)return o[s];o[s]=Array(t.length/2),o[s+"-cx"]=e,o[s+"-cy"]=n;var l=r/2,c=i/2;a="auto"===a?iS(r,i):a;for(var u=Array(t.length/2),d=0;d<t.length/2;d++)u[d]={x:e+l*t[2*d],y:n+c*t[2*d+1]};var h,f,p,g,v=u.length;for(h=0,f=u[v-1];h<v;h++)p=u[h%v],g=u[(h+1)%v],o[s][h]=dr(f,p,g,a),f=p,p=g;return o[s]},draw:function(e,t,n,r,i,a,o){this.renderer.nodeShapeImpl("round-polygon",e,t,n,r,i,this.points,this.getOrCreateCorners(t,n,r,i,a,o,"drawCorners"))},intersectLine:function(e,t,n,r,i,a,o,s,l){return ij(i,a,this.points,e,t,n,r,o,this.getOrCreateCorners(e,t,n,r,s,l,"corners"))},checkPoint:function(e,t,n,r,i,a,o,s,l){return id(e,t,this.points,a,o,r,i,this.getOrCreateCorners(a,o,r,i,s,l,"corners"))}}},dw.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:ik(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){return it(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=r/2,c=i/2,u=2*(s=Math.min(l,c,s="auto"===s?i_(r,i):s));return!!(iu(e,t,this.points,a,o,r,i-u,[0,-1],n)||iu(e,t,this.points,a,o,r-u,i,[0,-1],n)||ig(e,t,u,u,a-l+s,o-c+s,n)||ig(e,t,u,u,a+l-s,o-c+s,n)||ig(e,t,u,u,a+l-s,o+c-s,n)||ig(e,t,u,u,a-l+s,o+c-s,n))}}},dw.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:iT(),points:ik(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,null,a)},generateCutTrianglePts:function(e,t,n,r,i){var a="auto"===i?this.cornerLength:i,o=t/2,s=e/2,l=n-s,c=n+s,u=r-o,d=r+o;return{topLeft:[l,u+a,l+a,u,l+a,u+a],topRight:[c-a,u,c,u+a,c-a,u+a],bottomRight:[c,d-a,c-a,d,c-a,d-a],bottomLeft:[l+a,d,l,d-a,l+a,d-a]}},intersectLine:function(e,t,n,r,i,a,o,s){var l=this.generateCutTrianglePts(n+2*o,r+2*o,e,t,s);return iw(i,a,[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]),e,t)},checkPoint:function(e,t,n,r,i,a,o,s){var l="auto"===s?this.cornerLength:s;if(iu(e,t,this.points,a,o,r,i-2*l,[0,-1],n)||iu(e,t,this.points,a,o,r-2*l,i,[0,-1],n))return!0;var c=this.generateCutTrianglePts(r,i,a,o);return ic(e,t,c.topLeft)||ic(e,t,c.topRight)||ic(e,t,c.bottomRight)||ic(e,t,c.bottomLeft)}}},dw.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:ik(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){var l=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),c=function(e){var t=rK({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.15),n=rK({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.5),r=rK({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.85);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]};return iw(i,a,[].concat(c(l.topLeft),c(l.topRight),c(l.bottomRight),c(l.bottomLeft)),e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,a=e/2,o=n-a,s=n+a,l=r-i,c=r+i,u=iA(e,t),d=u.heightOffset,h=u.widthOffset,f=u.ctrlPtOffsetPct*e,p={topLeft:[o,l+d,o+f,l,o+h,l],topRight:[s-h,l,s-f,l,s,l+d],bottomRight:[s,c-d,s-f,c,s-h,c],bottomLeft:[o+h,c,o+f,c,o,c-d]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(e,t,n,r,i,a,o,s){var l=iA(r,i),c=l.heightOffset,u=l.widthOffset;if(iu(e,t,this.points,a,o,r,i-2*c,[0,-1],n)||iu(e,t,this.points,a,o,r-2*u,i,[0,-1],n))return!0;for(var d=this.generateBarrelBezierPts(r,i,a,o),h=Object.keys(d),f=0;f<h.length;f++){var p=d[h[f]],g=function(e,t,n){var r=n[4],i=n[2],a=n[0],o=n[5],s=n[1],l=Math.min(r,a),c=Math.max(r,a),u=Math.min(o,s),d=Math.max(o,s);if(l<=e&&e<=c&&u<=t&&t<=d){var h=[r-2*i+a,2*(i-r),r],f=ia(h[0],h[1],h[2],e).filter(function(e){return 0<=e&&e<=1});if(f.length>0)return f[0]}return null}(e,t,p);if(null!=g){var v=rq(p[5],p[3],p[1],g);if(p.isTop&&v<=t||p.isBottom&&t<=v)return!0}}return!1}}},dw.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:ik(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){var l=e-(n/2+o),c=t-(r/2+o),u=e+(n/2+o),d=iy(i,a,e,t,l,c,u,c,!1);return d.length>0?d:it(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=2*(s="auto"===s?i_(r,i):s);if(iu(e,t,this.points,a,o,r,i-l,[0,-1],n)||iu(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var c=r/2+2*n,u=i/2+2*n;return!!(ic(e,t,[a-c,o-u,a-c,o,a+c,o,a+c,o-u])||ig(e,t,l,l,a+r/2-s,o+i/2-s,n)||ig(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},dw.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",ik(3,0)),this.generateRoundPolygon("round-triangle",ik(3,0)),this.generatePolygon("rectangle",ik(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",ik(5,0)),this.generateRoundPolygon("round-pentagon",ik(5,0)),this.generatePolygon("hexagon",ik(6,0)),this.generateRoundPolygon("round-hexagon",ik(6,0)),this.generatePolygon("heptagon",ik(7,0)),this.generateRoundPolygon("round-heptagon",ik(7,0)),this.generatePolygon("octagon",ik(8,0)),this.generateRoundPolygon("round-octagon",ik(8,0));var r=Array(20),i=iE(5,0),a=iE(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[2*s]*=o,a[2*s+1]*=o;for(var s=0;s<5;s++)r[4*s]=i[2*s],r[4*s+1]=i[2*s+1],r[4*s+2]=a[2*s],r[4*s+3]=a[2*s+1];r=iC(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l),e.makePolygon=function(e){var n,r="polygon-"+e.join("$");return(n=this[r])?n:t.generatePolygon(r,e)}};var dj={};dj.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},dj.redraw=function(e){e=e||rh(),void 0===this.averageRedrawTime&&(this.averageRedrawTime=0),void 0===this.lastRedrawTime&&(this.lastRedrawTime=0),void 0===this.lastDrawTime&&(this.lastDrawTime=0),this.requestedFrame=!0,this.renderOptions=e},dj.beforeRender=function(e,t){if(!this.destroyed){null==t&&ro("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(e,t){return t.priority-e.priority})}};var dN=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};dj.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function(r){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){dN(e,!0,r);var i=nK();e.render(e.renderOptions);var a=e.lastDrawTime=nK();void 0===e.averageRedrawTime&&(e.averageRedrawTime=a-i),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else dN(e,!1,r);e.skipFrame=!1,nQ(n)}};nQ(n)}};var dk=function(e){this.init(e)},dC=dk.prototype;dC.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],dC.init=function(e){this.options=e,this.cy=e.cy;var t=this.container=e.cy.container(),n=this.cy.window();if(n){var r=n.document,i=r.head,a="__________cytoscape_stylesheet",o="__________cytoscape_container",s=null!=r.getElementById(a);if(0>t.className.indexOf(o)&&(t.className=(t.className||"")+" "+o),!s){var l=r.createElement("style");l.id=a,l.textContent="."+o+" { position: relative; }",i.insertBefore(l,i.children[0])}"static"===n.getComputedStyle(t).getPropertyValue("position")&&rl("A Cytoscape container has style position:static and so can not use UI extensions properly")}this.selection=[void 0,void 0,void 0,void 0,0],this.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],this.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},this.dragData={possibleDragElements:[]},this.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},this.redraws=0,this.showFps=e.showFps,this.debug=e.debug,this.webgl=e.webgl,this.hideEdgesOnViewport=e.hideEdgesOnViewport,this.textureOnViewport=e.textureOnViewport,this.wheelSensitivity=e.wheelSensitivity,this.motionBlurEnabled=e.motionBlur,this.forcedPixelRatio=nh(e.pixelRatio)?e.pixelRatio:null,this.motionBlur=e.motionBlur,this.motionBlurOpacity=e.motionBlurOpacity,this.motionBlurTransparency=1-this.motionBlurOpacity,this.motionBlurPxRatio=1,this.mbPxRBlurry=1,this.minMbLowQualFrames=4,this.fullQualityMb=!1,this.clearedForMotionBlur=[],this.desktopTapThreshold=e.desktopTapThreshold,this.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,this.touchTapThreshold=e.touchTapThreshold,this.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,this.tapholdDuration=500,this.bindings=[],this.beforeRenderCallbacks=[],this.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},this.registerNodeShapes(),this.registerArrowShapes(),this.registerCalculationListeners()},dC.notify=function(e,t){var n=this.cy;if(!this.destroyed){if("init"===e)return void this.load();if("destroy"===e)return void this.destroy();("add"===e||"remove"===e||"move"===e&&n.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&this.invalidateCachedZSortedEles(),"viewport"===e&&this.redrawHint("select",!0),"gc"===e&&this.redrawHint("gc",!0),("load"===e||"resize"===e||"mount"===e)&&(this.invalidateContainerClientCoordsCache(),this.matchCanvasSize(this.container)),this.redrawHint("eles",!0),this.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},dC.destroy=function(){this.destroyed=!0,this.cy.stopAnimationLoop();for(var e=0;e<this.bindings.length;e++){var t=this.bindings[e],n=t.target;(n.off||n.removeEventListener).apply(n,t.args)}if(this.bindings=[],this.beforeRenderCallbacks=[],this.onUpdateEleCalcsFns=[],this.removeObserver&&this.removeObserver.disconnect(),this.styleObserver&&this.styleObserver.disconnect(),this.resizeObserver&&this.resizeObserver.disconnect(),this.labelCalcDiv)try{document.body.removeChild(this.labelCalcDiv)}catch(e){}},dC.isHeadless=function(){return!1},[l_,dx,dy,db,dw,dj].forEach(function(e){nP(dC,e)});var dE=1e3/60,d_=function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=nX(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),i=e.priority||ra;n.beforeRender(function(i,a){var o=nK(),s=n.averageRedrawTime,l=n.lastRedrawTime,c=[],u=n.cy.extent(),d=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var h=nK(),f=h-o,p=h-a;if(l<dE){var g=dE-(i?s:0);if(p>=e.deqFastCost*g)break}else if(i){if(f>=e.deqCost*l||f>=e.deqAvgCost*s)break}else if(p>=e.deqNoDrawCost*dE)break;var v=e.deq(t,d,u);if(v.length>0)for(var x=0;x<v.length;x++)c.push(v[x]);else break}c.length>0&&(e.onDeqd(t,c),!i&&e.shouldRedraw(t,c,d,u)&&r())},i(t))}}},dS=t5(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rr;t2(this,e),this.idsByKey=new rb,this.keyForId=new rb,this.cachesByLvl=new rb,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n},[{key:"getIdsFor",value:function(e){null==e&&ro("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new rj,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new rb,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),dT={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},dA=rf({getKey:null,doesEleInvalidateKey:rr,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:rn,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),dO=function(e,t){this.renderer=e,this.onDequeues=[];var n=dA(t);nP(this,n),this.lookup=new dS(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},dM=dO.prototype;dM.reasons=dT,dM.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},dM.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},dM.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new rS(function(e,t){return t.reqs-e.reqs})},dM.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},dM.getElement=function(e,t,n,r,i){var a,o,s,l=this,c=this.renderer,u=c.cy.zoom(),d=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!l.allowEdgeTxrCaching&&e.isEdge()||!l.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(rW(u*n))),r<-4)r=-4;else if(u>=7.99||r>3)return null;var h=Math.pow(2,r),f=t.h*h,p=t.w*h,g=c.eleTextBiggerThanMin(e,h);if(!this.isVisible(e,g))return null;var v=d.get(e,r);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;if(a=f<=25?25:f<=50?50:50*Math.ceil(f/50),f>1024||p>1024)return null;var x=l.getTextureQueue(a),y=x[x.length-2],b=function(){return l.recycleTexture(a,p)||l.addTexture(a,p)};y||(y=x[x.length-1]),y||(y=b()),y.width-y.usedWidth<p&&(y=b());for(var w=function(e){return e&&e.scaledLabelShown===g},j=i&&i===dT.dequeue,N=i&&i===dT.highQuality,k=i&&i===dT.downscale,C=r+1;C<=3;C++){var E=d.get(e,C);if(E){o=E;break}}var _=o&&o.level===r+1?o:null,S=function(){y.context.drawImage(_.texture.canvas,_.x,0,_.width,_.height,y.usedWidth,0,p,f)};if(y.context.setTransform(1,0,0,1,0,0),y.context.clearRect(y.usedWidth,0,p,a),w(_))S();else if(w(o))if(!N)return l.queueElement(e,o.level-1),o;else{for(var T=o.level;T>r;T--)_=l.getElement(e,t,n,T,dT.downscale);S()}else{if(!j&&!N&&!k)for(var A=r-1;A>=-4;A--){var O=d.get(e,A);if(O){s=O;break}}if(w(s))return l.queueElement(e,r),s;y.context.translate(y.usedWidth,0),y.context.scale(h,h),this.drawElement(y.context,e,t,g,!1),y.context.scale(1/h,1/h),y.context.translate(-y.usedWidth,0)}return v={x:y.usedWidth,texture:y,level:r,scale:h,width:p,height:f,scaledLabelShown:g},y.usedWidth+=Math.ceil(p+8),y.eleCaches.push(v),d.set(e,r,v),l.checkTextureFullness(y),v},dM.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},dM.invalidateElement=function(e){var t=this.lookup,n=[];if(t.isInvalid(e)){for(var r=-4;r<=3;r++){var i=t.getForCachedKey(e,r);i&&n.push(i)}if(t.invalidate(e))for(var a=0;a<n.length;a++){var o=n[a],s=o.texture;s.invalidatedWidth+=o.width,o.invalidated=!0,this.checkTextureUtility(s)}this.removeFromQueue(e)}},dM.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},dM.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?rp(t,e):e.fullnessChecks++},dM.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;rp(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a<i.length;a++){var o=i[a];r.deleteCache(o.key,o.level)}rm(i),this.getRetiredTextureQueue(t).push(e)},dM.addTexture=function(e,t){var n=this.getTextureQueue(e),r={};return n.push(r),r.eleCaches=[],r.height=e,r.width=Math.max(1024,t),r.usedWidth=0,r.invalidatedWidth=0,r.fullnessChecks=0,r.canvas=this.renderer.makeOffscreenCanvas(r.width,r.height),r.context=r.canvas.getContext("2d"),r},dM.recycleTexture=function(e,t){for(var n=this.getTextureQueue(e),r=this.getRetiredTextureQueue(e),i=0;i<r.length;i++){var a=r[i];if(a.width>=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,rm(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),rp(r,a),n.push(a),a}},dM.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},dM.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1;a++)if(t.size()>0){var o=t.pop(),s=o.key,l=o.eles[0],c=i.hasCache(l,o.level);if(n[s]=null,c)continue;r.push(o);var u=this.getBoundingBox(l);this.getElement(l,u,e,o.level,dT.dequeue)}else break;return r},dM.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=rt,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},dM.onDequeue=function(e){this.onDequeues.push(e)},dM.offDequeue=function(e){rp(this.onDequeues,e)},dM.setupDequeueing=d_({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++)(0,e.onDequeues[n])(t)},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++)if(r6(a[o].boundingBox(),r))return!0;return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var dP=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=nK()-500,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=nX(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},50),n.beforeRender(function(e,n){n-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new rS(function(e,t){return t.reqs-e.reqs}),t.setupDequeueing()},dD=dP.prototype,dL=0;dD.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),o={id:dL=++dL%0x1fffffffffffff,bb:e,level:t,width:r,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,l=-o.bb.x1,c=-o.bb.y1;return s.scale(n,n),s.translate(l,c),o},dD.getLayers=function(e,t,n){var r,i,a=this,o=a.renderer.cy.zoom(),s=a.firstGet;if(a.firstGet=!1,null==n){if((n=Math.ceil(rW(o*t)))<-4)n=-4;else if(o>=3.99||n>2)return null}a.validateLayersElesOrdering(n,e);var l=a.layersByLevel,c=Math.pow(2,n),u=l[n]=l[n]||[];if(a.levelIsComplete(n,e))return u;var d=function(t){if(a.validateLayersElesOrdering(t,e),a.levelIsComplete(t,e))return i=l[t],!0},h=function(e){if(!i)for(var t=n+e;-4<=t&&t<=2&&!d(t);t+=e);};h(1),h(-1);for(var f=u.length-1;f>=0;f--){var p=u[f];p.invalid&&rp(u,p)}var g=function(){if(!r){r=rJ();for(var t=0;t<e.length;t++)r1(r,e[t].boundingBox())}return r};if(a.skipping&&!s)return null;for(var v=null,x=e.length/1,y=!s,b=0;b<e.length;b++){var w=e[b],j=w._private.rscratch,N=j.imgLayerCaches=j.imgLayerCaches||{},k=N[n];if(k){v=k;continue}if((!v||v.eles.length>=x||!r9(v.bb,w.boundingBox()))&&!(v=function(e){var t=(e=e||{}).after;g();var i=Math.ceil(r.w*c),o=Math.ceil(r.h*c);if(i>32767||o>32767||i*o>16e6)return null;var s=a.makeLayer(r,n);if(null!=t){var l=u.indexOf(t)+1;u.splice(l,0,s)}else(void 0===e.insert||e.insert)&&u.unshift(s);return s}({insert:!0,after:v})))return null;i||y?a.queueLayer(v,w):a.drawEleInLayer(v,w,n,t),v.eles.push(w),N[n]=v}return i||(y?null:u)},dD.getEleLevelForLayerLevel=function(e,t){return e},dD.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},dD.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i<n.length;i++){var a=n[i];if(a.reqs>0||a.invalid)return!1;r+=a.eles.length}return r===t.length},dD.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0){this.invalidateLayer(i);continue}for(var s=a,o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}},dD.updateElementsInLayers=function(e,t){for(var n=nm(e[0]),r=0;r<e.length;r++)for(var i=n?null:e[r],a=n?e[r]:e[r].ele,o=a._private.rscratch,s=o.imgLayerCaches=o.imgLayerCaches||{},l=-4;l<=2;l++){var c=s[l];c&&(i&&this.getEleLevelForLayerLevel(c.level)!==i.level||t(c,a,i))}},dD.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var n=this.layersByLevel[t];if(n&&n.length>0){e=!0;break}}return e},dD.invalidateElements=function(e){var t=this;0===e.length||(t.lastInvalidationTime=nK(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},dD.invalidateLayer=function(e){if(this.lastInvalidationTime=nK(),!e.invalid){var t=e.level,n=e.eles;rp(this.layersByLevel[t],e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var r=0;r<n.length;r++){var i=n[r]._private.rscratch.imgLayerCaches;i&&(i[t]=null)}}},dD.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(e,n,r){var i=e.replacement;if(i||((i=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])})},dD.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},dD.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,i=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;r.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},dD.dequeue=function(e){for(var t=this.layersQueue,n=[],r=0;r<1&&0!==t.size();){var i=t.peek();if(i.replacement||i.replaces&&i!==i.replaces.replacement||i.invalid){t.pop();continue}var a=i.elesQueue.shift();a&&(this.drawEleInLayer(i,a,i.level,e),r++),0===n.length&&n.push(!0),0===i.elesQueue.length&&(t.pop(),i.reqs=0,i.replaces&&this.applyLayerReplacement(i),this.requestRedraw())}return n},dD.applyLayerReplacement=function(e){var t=this.layersByLevel[e.level],n=e.replaces,r=t.indexOf(n);if(!(r<0)&&!n.invalid){t[r]=e;for(var i=0;i<e.eles.length;i++){var a=e.eles[i]._private,o=a.imgLayerCaches=a.imgLayerCaches||{};o&&(o[e.level]=e)}this.requestRedraw()}},dD.requestRedraw=nX(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),dD.setupDequeueing=d_({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:ra,shouldRedraw:rn,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var dI={};function dR(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function dB(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];0===i&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function dz(e,t,n){e.beginPath&&e.beginPath();for(var r=0;r<t.length;r++){var i=t[r];e.lineTo(i.x,i.y)}var a=n[0];e.moveTo(a.x,a.y);for(var r=1;r<n.length;r++){var i=n[r];e.lineTo(i.x,i.y)}e.closePath&&e.closePath()}function dF(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,2*Math.PI,!1);var a=t[0];e.moveTo(a.x,a.y);for(var o=0;o<t.length;o++){var s=t[o];e.lineTo(s.x,s.y)}e.closePath&&e.closePath()}function dV(e,t,n,r){e.arc(t,n,r,0,2*Math.PI,!1)}dI.arrowShapeImpl=function(e){return(y||(y={polygon:dR,"triangle-backcurve":dB,"triangle-tee":dz,"circle-triangle":dF,"triangle-cross":dz,circle:dV}))[e]};var dU={};dU.drawElement=function(e,t,n,r,i,a){t.isNode()?this.drawNode(e,t,n,r,i,a):this.drawEdge(e,t,n,r,i,a)},dU.drawElementOverlay=function(e,t){t.isNode()?this.drawNodeOverlay(e,t):this.drawEdgeOverlay(e,t)},dU.drawElementUnderlay=function(e,t){t.isNode()?this.drawNodeUnderlay(e,t):this.drawEdgeUnderlay(e,t)},dU.drawCachedElementPortion=function(e,t,n,r,i,a,o,s){var l=n.getBoundingBox(t);if(0!==l.w&&0!==l.h){var c=n.getElement(t,l,r,i,a);if(null!=c){var u,d,h,f,p,g,v=s(this,t);if(0===v)return;var x=o(this,t),y=l.x1,b=l.y1,w=l.w,j=l.h;if(0!==x){var N=n.getRotationPoint(t);h=N.x,f=N.y,e.translate(h,f),e.rotate(x),(p=this.getImgSmoothing(e))||this.setImgSmoothing(e,!0);var k=n.getRotationOffset(t);u=k.x,d=k.y}else u=y,d=b;1!==v&&(g=e.globalAlpha,e.globalAlpha=g*v),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,u,d,w,j),1!==v&&(e.globalAlpha=g),0!==x&&(e.rotate(-x),e.translate(-h,-f),p||this.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var dH=function(){return 0},dW=function(e,t){return e.getTextAngle(t,null)},dY=function(e,t){return e.getTextAngle(t,"source")},dG=function(e,t){return e.getTextAngle(t,"target")},d$=function(e,t){return t.effectiveOpacity()},dX=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};dU.drawCachedElement=function(e,t,n,r,i,a){var o=this.data,s=o.eleTxrCache,l=o.lblTxrCache,c=o.slbTxrCache,u=o.tlbTxrCache,d=t.boundingBox(),h=!0===a?s.reasons.highQuality:null;if(0!==d.w&&0!==d.h&&t.visible()&&(!r||r6(d,r))){var f=t.isEdge(),p=t.element()._private.rscratch.badLine;this.drawElementUnderlay(e,t),this.drawCachedElementPortion(e,t,s,n,i,h,dH,d$),f&&p||this.drawCachedElementPortion(e,t,l,n,i,h,dW,dX),f&&!p&&(this.drawCachedElementPortion(e,t,c,n,i,h,dY,dX),this.drawCachedElementPortion(e,t,u,n,i,h,dG,dX)),this.drawElementOverlay(e,t)}},dU.drawElements=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];this.drawElement(e,r)}},dU.drawCachedElements=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];this.drawCachedElement(e,a,n,r)}},dU.drawCachedNodes=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];a.isNode()&&this.drawCachedElement(e,a,n,r)}},dU.drawLayeredElements=function(e,t,n,r){var i=this.data.lyrTxrCache.getLayers(t,n);if(i)for(var a=0;a<i.length;a++){var o=i[a],s=o.bb;0!==s.w&&0!==s.h&&e.drawImage(o.canvas,s.x1,s.y1,s.w,s.h)}else this.drawCachedElements(e,t,n,r)};var dq={};dq.drawEdge=function(e,t,n){var r,i=!(arguments.length>3)||void 0===arguments[3]||arguments[3],a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],o=!(arguments.length>5)||void 0===arguments[5]||arguments[5],s=this,l=t._private.rscratch;if((!o||t.visible())&&!(l.badLine||null==l.allpts||isNaN(l.allpts[0]))){n&&(r=n,e.translate(-r.x1,-r.y1));var c=o?t.pstyle("opacity").value:1,u=o?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,f=t.pstyle("width").pfValue,p=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,x=c*u,y=c*u,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x;"straight-triangle"===d?(s.eleStrokeStyle(e,t,n),s.drawEdgeTrianglePath(t,e,l.allpts)):(e.lineWidth=f,e.lineCap=p,s.eleStrokeStyle(e,t,n),s.drawEdgePath(t,e,l.allpts,h),e.lineCap="butt")},w=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;s.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var j=t.pstyle("ghost-offset-x").pfValue,N=t.pstyle("ghost-offset-y").pfValue,k=x*t.pstyle("ghost-opacity").value;e.translate(j,N),b(k),w(k),e.translate(-j,-N)}else!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x;if(e.lineWidth=f+g,e.lineCap=p,g>0)s.colorStrokeStyle(e,v[0],v[1],v[2],n);else{e.lineCap="butt";return}"straight-triangle"===d?s.drawEdgeTrianglePath(t,e,l.allpts):(s.drawEdgePath(t,e,l.allpts,h),e.lineCap="butt")}();a&&s.drawEdgeUnderlay(e,t),b(),w(),a&&s.drawEdgeOverlay(e,t),s.drawElementText(e,t,null,i),n&&e.translate(r.x1,r.y1)}};var dK=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this.usePaths(),a=n._private.rscratch,o=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-color")).value;t.lineWidth=2*o,"self"!==a.edgeType||i?t.lineCap="round":t.lineCap="butt",this.colorStrokeStyle(t,s[0],s[1],s[2],r),this.drawEdgePath(n,t,a.allpts,"solid")}}}};dq.drawEdgeOverlay=dK("overlay"),dq.drawEdgeUnderlay=dK("underlay"),dq.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,o=!1,s=this.usePaths(),l=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(s){var u=n.join("$");i.pathCacheKey&&i.pathCacheKey===u?(f=t=i.pathCache,o=!0):(f=t=new Path2D,i.pathCacheKey=u,i.pathCache=f)}if(a.setLineDash)switch(r){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(l),a.lineDashOffset=c;break;case"solid":a.setLineDash([])}if(!o&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<n.length;d+=4)t.quadraticCurveTo(n[d],n[d+1],n[d+2],n[d+3]);break;case"straight":case"haystack":for(var h=2;h+1<n.length;h+=2)t.lineTo(n[h],n[h+1]);break;case"segments":if(i.isRound){var f,p,g=t3(i.roundCorners);try{for(g.s();!(p=g.n()).done;){var v=p.value;dn(t,v)}}catch(e){g.e(e)}finally{g.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var x=2;x+1<n.length;x+=2)t.lineTo(n[x],n[x+1])}t=a,s?t.stroke(f):t.stroke(),t.setLineDash&&t.setLineDash([])},dq.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,i=0;i+1<n.length;i+=2){var a=[n[i+2]-n[i],n[i+3]-n[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=[a[1]/o,-a[0]/o],l=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[i]-l[0],n[i+1]-l[1]),t.lineTo(n[i]+l[0],n[i+1]+l[1]),t.lineTo(n[i+2],n[i+3]),t.closePath(),t.fill()}},dq.drawArrowheads=function(e,t,n){var r=t._private.rscratch,i="haystack"===r.edgeType;i||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),i||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},dq.drawArrowhead=function(e,t,n,r,i,a,o){if(!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a))&&null!=a){var s=t.pstyle(n+"-arrow-shape").value;if("none"!==s){var l="hollow"===t.pstyle(n+"-arrow-fill").value?"both":"filled",c=t.pstyle(n+"-arrow-fill").value,u=t.pstyle("width").pfValue,d=t.pstyle(n+"-arrow-width"),h="match-line"===d.value?u:d.pfValue;"%"===d.units&&(h*=u);var f=t.pstyle("opacity").value;void 0===o&&(o=f);var p=e.globalCompositeOperation;(1!==o||"hollow"===c)&&(e.globalCompositeOperation="destination-out",this.colorFillStyle(e,255,255,255,1),this.colorStrokeStyle(e,255,255,255,1),this.drawArrowShape(t,e,l,u,s,h,r,i,a),e.globalCompositeOperation=p);var g=t.pstyle(n+"-arrow-color").value;this.colorFillStyle(e,g[0],g[1],g[2],o),this.colorStrokeStyle(e,g[0],g[1],g[2],o),this.drawArrowShape(t,e,c,u,s,h,r,i,a)}}},dq.drawArrowShape=function(e,t,n,r,i,a,o,s,l){var c,u=this.usePaths()&&"triangle-cross"!==i,d=!1,h=t,f=e.pstyle("arrow-scale").value,p=this.getArrowWidth(r,f),g=this.arrowShapes[i];if(u){var v=this.arrowPathCache=this.arrowPathCache||[],x=n4(i),y=v[x];null!=y?(c=t=y,d=!0):(c=t=new Path2D,v[x]=c)}!d&&(t.beginPath&&t.beginPath(),u?g.draw(t,1,0,{x:0,y:0},1):g.draw(t,p,l,{x:o,y:s},r),t.closePath&&t.closePath()),t=h,u&&(t.translate(o,s),t.rotate(l),t.scale(p,p)),("filled"===n||"both"===n)&&(u?t.fill(c):t.fill()),("hollow"===n||"both"===n)&&(t.lineWidth=a/(u?p:1),t.lineJoin="miter",u?t.stroke(c):t.stroke()),u&&(t.scale(1/p,1/p),t.rotate(-l),t.translate(-o,-s))};var dZ={};dZ.safeDrawImage=function(e,t,n,r,i,a,o,s,l,c){if(!(i<=0)&&!(a<=0)&&!(l<=0)&&!(c<=0))try{e.drawImage(t,n,r,i,a,o,s,l,c)}catch(e){rl(e)}},dZ.drawInscribedImage=function(e,t,n,r,i){var a=n.position(),o=a.x,s=a.y,l=n.cy().style(),c=l.getIndexedStyle.bind(l),u=c(n,"background-fit","value",r),d=c(n,"background-repeat","value",r),h=n.width(),f=n.height(),p=2*n.padding(),g=h+("inner"===c(n,"background-width-relative-to","value",r)?0:p),v=f+("inner"===c(n,"background-height-relative-to","value",r)?0:p),x=n._private.rscratch,y="node"===c(n,"background-clip","value",r),b=c(n,"background-image-opacity","value",r)*i,w=c(n,"background-image-smoothing","value",r),j=n.pstyle("corner-radius").value;"auto"!==j&&(j=n.pstyle("corner-radius").pfValue);var N=t.width||t.cachedW,k=t.height||t.cachedH;(null==N||null==k)&&(document.body.appendChild(t),N=t.cachedW=t.width||t.offsetWidth,k=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var C=N,E=k;if("auto"!==c(n,"background-width","value",r)&&(C="%"===c(n,"background-width","units",r)?c(n,"background-width","pfValue",r)*g:c(n,"background-width","pfValue",r)),"auto"!==c(n,"background-height","value",r)&&(E="%"===c(n,"background-height","units",r)?c(n,"background-height","pfValue",r)*v:c(n,"background-height","pfValue",r)),0!==C&&0!==E){if("contain"===u){var _=Math.min(g/C,v/E);C*=_,E*=_}else if("cover"===u){var _=Math.max(g/C,v/E);C*=_,E*=_}var S=o-g/2,T=c(n,"background-position-x","units",r),A=c(n,"background-position-x","pfValue",r);"%"===T?S+=(g-C)*A:S+=A;var O=c(n,"background-offset-x","units",r),M=c(n,"background-offset-x","pfValue",r);"%"===O?S+=(g-C)*M:S+=M;var P=s-v/2,D=c(n,"background-position-y","units",r),L=c(n,"background-position-y","pfValue",r);"%"===D?P+=(v-E)*L:P+=L;var I=c(n,"background-offset-y","units",r),R=c(n,"background-offset-y","pfValue",r);"%"===I?P+=(v-E)*R:P+=R,x.pathCache&&(S-=o,P-=s,o=0,s=0);var B=e.globalAlpha;e.globalAlpha=b;var z=this.getImgSmoothing(e),F=!1;if("no"===w&&z?(this.setImgSmoothing(e,!1),F=!0):"yes"!==w||z||(this.setImgSmoothing(e,!0),F=!0),"no-repeat"===d)y&&(e.save(),x.pathCache?e.clip(x.pathCache):(this.nodeShapes[this.getNodeShape(n)].draw(e,o,s,g,v,j,x),e.clip())),this.safeDrawImage(e,t,0,0,N,k,S,P,C,E),y&&e.restore();else{var V=e.createPattern(t,d);e.fillStyle=V,this.nodeShapes[this.getNodeShape(n)].draw(e,o,s,g,v,j,x),e.translate(S,P),e.fill(),e.translate(-S,-P)}e.globalAlpha=B,F&&this.setImgSmoothing(e,z)}};var dQ={};function dJ(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5,o=Math.min(a,r/2,i/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}dQ.eleTextBiggerThanMin=function(e,t){return t||(t=Math.pow(2,Math.ceil(rW(e.cy().zoom()*this.getPixelRatio())))),!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},dQ.drawElementText=function(e,t,n,r,i){var a,o=!(arguments.length>5)||void 0===arguments[5]||arguments[5];if(null==r){if(o&&!this.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;e.textAlign=this.getLabelJustification(t),e.textBaseline="bottom"}else{var l=t.element()._private.rscratch.badLine,c=t.pstyle("label"),u=t.pstyle("source-label"),d=t.pstyle("target-label");if(l||(!c||!c.value)&&(!u||!u.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var h=!n;n&&(a=n,e.translate(-a.x1,-a.y1)),null==i?(this.drawText(e,t,null,h,o),t.isEdge()&&(this.drawText(e,t,"source",h,o),this.drawText(e,t,"target",h,o))):this.drawText(e,t,i,h,o),n&&e.translate(a.x1,a.y1)},dQ.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if((t=this.fontCaches[n]).context===e)return t;return t={context:e},this.fontCaches.push(t),t},dQ.setupTextStyle=function(e,t){var n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,c=t.pstyle("color").value,u=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,c[0],c[1],c[2],s),this.colorStrokeStyle(e,u[0],u[1],u[2],l)},dQ.getTextAngle=function(e,t){var n,r=e._private.rscratch,i=t?t+"-":"",a=e.pstyle(i+"text-rotation");if("autorotate"===a.strValue){var o=rv(r,"labelAngle",t);n=e.isEdge()?o:0}else n="none"===a.strValue?0:a.pfValue;return n},dQ.drawText=function(e,t,n){var r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!i||0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s=rv(a,"labelX",n),l=rv(a,"labelY",n),c=this.getLabelText(t,n);if(null!=c&&""!==c&&!isNaN(s)&&!isNaN(l)){this.setupTextStyle(e,t,i);var u,d,h,f=n?n+"-":"",p=rv(a,"labelWidth",n),g=rv(a,"labelHeight",n),v=t.pstyle(f+"text-margin-x").pfValue,x=t.pstyle(f+"text-margin-y").pfValue,y=t.isEdge(),b=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(y&&(b="center",w="center"),s+=v,l+=x,0!==(h=r?this.getTextAngle(t,n):0)&&(u=s,d=l,e.translate(u,d),e.rotate(h),s=0,l=0),w){case"top":break;case"center":l+=g/2;break;case"bottom":l+=g}var j=t.pstyle("text-background-opacity").value,N=t.pstyle("text-border-opacity").value,k=t.pstyle("text-border-width").pfValue,C=t.pstyle("text-background-padding").pfValue,E=t.pstyle("text-background-shape").strValue,_="round-rectangle"===E||"roundrectangle"===E;if(j>0||k>0&&N>0){var S,T,A=e.fillStyle,O=e.strokeStyle,M=e.lineWidth,P=t.pstyle("text-background-color").value,D=t.pstyle("text-border-color").value,L=t.pstyle("text-border-style").value,I=j>0,R=k>0&&N>0,B=s-C;switch(b){case"left":B-=p;break;case"center":B-=p/2}var z=l-g-C,F=p+2*C,V=g+2*C;if(I&&(e.fillStyle="rgba(".concat(P[0],",").concat(P[1],",").concat(P[2],",").concat(j*o,")")),R&&(e.strokeStyle="rgba(".concat(D[0],",").concat(D[1],",").concat(D[2],",").concat(N*o,")"),e.lineWidth=k,e.setLineDash))switch(L){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=k/4,e.setLineDash([]);break;default:e.setLineDash([])}if(_?(e.beginPath(),dJ(e,B,z,F,V,2)):"circle"===E?(e.beginPath(),S=B,T=Math.min(F,V),e.beginPath(),e.arc(S+F/2,z+V/2,T/2,0,2*Math.PI),e.closePath()):(e.beginPath(),e.rect(B,z,F,V)),I&&e.fill(),R&&e.stroke(),R&&"double"===L){var U=k/2;e.beginPath(),_?dJ(e,B+U,z+U,F-2*U,V-2*U,2):e.rect(B+U,z+U,F-2*U,V-2*U),e.stroke()}e.fillStyle=A,e.strokeStyle=O,e.lineWidth=M,e.setLineDash&&e.setLineDash([])}var H=2*t.pstyle("text-outline-width").pfValue;if(H>0&&(e.lineWidth=H),"wrap"===t.pstyle("text-wrap").value){var W=rv(a,"labelWrapCachedLines",n),Y=rv(a,"labelLineHeight",n),G=p/2,$=this.getLabelJustification(t);switch("auto"===$||("left"===b?"left"===$?s+=-p:"center"===$&&(s+=-G):"center"===b?"left"===$?s+=-G:"right"===$&&(s+=G):"right"===b&&("center"===$?s+=G:"right"===$&&(s+=p))),w){case"top":case"center":case"bottom":l-=(W.length-1)*Y}for(var X=0;X<W.length;X++)H>0&&e.strokeText(W[X],s,l),e.fillText(W[X],s,l),l+=Y}else H>0&&e.strokeText(c,s,l),e.fillText(c,s,l);0!==h&&(e.rotate(-h),e.translate(-u,-d))}}};var d0={};d0.drawNode=function(e,t,n){var r,i,a,o,s=!(arguments.length>3)||void 0===arguments[3]||arguments[3],l=!(arguments.length>4)||void 0===arguments[4]||arguments[4],c=!(arguments.length>5)||void 0===arguments[5]||arguments[5],u=this,d=t._private,h=d.rscratch,f=t.position();if(nh(f.x)&&nh(f.y)&&(!c||t.visible())){var p=c?t.effectiveOpacity():1,g=u.usePaths(),v=!1,x=t.padding();r=t.width()+2*x,i=t.height()+2*x,n&&(o=n,e.translate(-o.x1,-o.y1));for(var y=t.pstyle("background-image").value,b=Array(y.length),w=Array(y.length),j=0,N=0;N<y.length;N++){var k=y[N];if(b[N]=null!=k&&"none"!==k){var C=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",N);j++,w[N]=u.getCachedImage(k,C,function(){d.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var E=t.pstyle("background-blacken").value,_=t.pstyle("border-width").pfValue,S=t.pstyle("background-opacity").value*p,T=t.pstyle("border-color").value,A=t.pstyle("border-style").value,O=t.pstyle("border-join").value,M=t.pstyle("border-cap").value,P=t.pstyle("border-position").value,D=t.pstyle("border-dash-pattern").pfValue,L=t.pstyle("border-dash-offset").pfValue,I=t.pstyle("border-opacity").value*p,R=t.pstyle("outline-width").pfValue,B=t.pstyle("outline-color").value,z=t.pstyle("outline-style").value,F=t.pstyle("outline-opacity").value*p,V=t.pstyle("outline-offset").value,U=t.pstyle("corner-radius").value;"auto"!==U&&(U=t.pstyle("corner-radius").pfValue);var H=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:S;u.eleFillStyle(e,t,n)},W=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:I;u.colorStrokeStyle(e,T[0],T[1],T[2],t)},Y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:F;u.colorStrokeStyle(e,B[0],B[1],B[2],t)},G=function(e,t,n,r){var i,a=u.nodePathCache=u.nodePathCache||[],o=n6("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+U),s=a[o],l=!1;return null!=s?(l=!0,h.pathCache=i=s):(i=new Path2D,a[o]=h.pathCache=i),{path:i,cacheHit:l}},$=t.pstyle("shape").strValue,X=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(f.x,f.y);var q=G(r,i,$,X);a=q.path,v=q.cacheHit}var K=function(){if(!v){var n=f;g&&(n={x:0,y:0}),u.nodeShapes[u.getNodeShape(t)].draw(a||e,n.x,n.y,r,i,U,h)}g?e.fill(a):e.fill()},Z=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,r=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=d.backgrounding,a=0,o=0;o<w.length;o++){var s=t.cy().style().getIndexedStyle(t,"background-image-containment","value",o);if(r&&"over"===s||!r&&"inside"===s){a++;continue}b[o]&&w[o].complete&&!w[o].error&&(a++,u.drawInscribedImage(e,w[o],t,o,n))}d.backgrounding=a!==j,i!==d.backgrounding&&t.updateStyle(!1)},Q=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;u.hasPie(t)&&(u.drawPie(e,t,a),n&&!g&&u.nodeShapes[u.getNodeShape(t)].draw(e,f.x,f.y,r,i,U,h))},J=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;u.hasStripe(t)&&(e.save(),g?e.clip(h.pathCache):(u.nodeShapes[u.getNodeShape(t)].draw(e,f.x,f.y,r,i,U,h),e.clip()),u.drawStripe(e,t,a),e.restore(),n&&!g&&u.nodeShapes[u.getNodeShape(t)].draw(e,f.x,f.y,r,i,U,h))},ee=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,n=E>0?0:255;0!==E&&(u.colorFillStyle(e,n,n,n,(E>0?E:-E)*t),g?e.fill(a):e.fill())},et=function(){if(_>0){if(e.lineWidth=_,e.lineCap=M,e.lineJoin=O,e.setLineDash)switch(A){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(D),e.lineDashOffset=L;break;case"solid":case"double":e.setLineDash([])}if("center"!==P){if(e.save(),e.lineWidth*=2,"inside"===P)g?e.clip(a):e.clip();else{var t=new Path2D;t.rect(-r/2-_,-i/2-_,r+2*_,i+2*_),t.addPath(a),e.clip(t,"evenodd")}g?e.stroke(a):e.stroke(),e.restore()}else g?e.stroke(a):e.stroke();if("double"===A){e.lineWidth=_/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(a):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},en=function(){if(R>0){if(e.lineWidth=R,e.lineCap="butt",e.setLineDash)switch(z){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=f;g&&(n={x:0,y:0});var a=u.getNodeShape(t),o=_;"inside"===P&&(o=0),"outside"===P&&(o*=2);var s=(r+o+(R+V))/r,l=(i+o+(R+V))/i,c=r*s,d=i*l,h=u.nodeShapes[a].points;if(g&&(C=G(c,d,a,h).path),"ellipse"===a)u.drawEllipsePath(C||e,n.x,n.y,c,d);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var p=0,v=0,x=0;"round-diamond"===a?p=(o+V+R)*1.4:"round-heptagon"===a?(p=(o+V+R)*1.075,x=-(o/2+V+R)/35):"round-hexagon"===a?p=(o+V+R)*1.12:"round-pentagon"===a?(p=(o+V+R)*1.13,x=-(o/2+V+R)/15):"round-tag"===a?(p=(o+V+R)*1.12,v=(o/2+R+V)*.07):"round-triangle"===a&&(p=Math.PI/2*(o+V+R),x=-(o+V/2+R)/Math.PI),0!==p&&(s=(r+p)/r,c=r*s,["round-hexagon","round-tag"].includes(a)||(l=(i+p)/i,d=i*l)),U="auto"===U?iS(c,d):U;for(var y=c/2,b=d/2,w=U+(o+R+V)/2,j=Array(h.length/2),N=Array(h.length/2),k=0;k<h.length/2;k++)j[k]={x:n.x+v+y*h[2*k],y:n.y+x+b*h[2*k+1]};var C,E,S,T,A,O=j.length;for(E=0,S=j[O-1];E<O;E++)T=j[E%O],A=j[(E+1)%O],N[E]=dr(S,T,A,w),S=T,T=A;u.drawRoundPolygonPath(C||e,n.x+v,n.y+x,r*s,i*l,h,N)}else["roundrectangle","round-rectangle"].includes(a)?(U="auto"===U?i_(c,d):U,u.drawRoundRectanglePath(C||e,n.x,n.y,c,d,U+(o+R+V)/2)):["cutrectangle","cut-rectangle"].includes(a)?(U="auto"===U?iT():U,u.drawCutRectanglePath(C||e,n.x,n.y,c,d,null,U+(o+R+V)/4)):["bottomroundrectangle","bottom-round-rectangle"].includes(a)?(U="auto"===U?i_(c,d):U,u.drawBottomRoundRectanglePath(C||e,n.x,n.y,c,d,U+(o+R+V)/2)):"barrel"===a?u.drawBarrelPath(C||e,n.x,n.y,c,d):(h=a.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(a)?ih(ip(h,(o+R+V)/r)):ih(ip(h,-((o+R+V)/r))),u.drawPolygonPath(C||e,n.x,n.y,r,i,h));if(g?e.stroke(C):e.stroke(),"double"===z){e.lineWidth=o/3;var M=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(C):e.stroke(),e.globalCompositeOperation=M}e.setLineDash&&e.setLineDash([])}};if("yes"===t.pstyle("ghost").value){var er=t.pstyle("ghost-offset-x").pfValue,ei=t.pstyle("ghost-offset-y").pfValue,ea=t.pstyle("ghost-opacity").value,eo=ea*p;e.translate(er,ei),Y(),en(),H(ea*S),K(),Z(eo,!0),W(ea*I),et(),Q(0!==E||0!==_),J(0!==E||0!==_),Z(eo,!1),ee(eo),e.translate(-er,-ei)}g&&e.translate(-f.x,-f.y),l&&u.drawNodeUnderlay(e,t,f,r,i),g&&e.translate(f.x,f.y),Y(),en(),H(),K(),Z(p,!0),W(),et(),Q(0!==E||0!==_),J(0!==E||0!==_),Z(p,!1),ee(),g&&e.translate(-f.x,-f.y),u.drawElementText(e,t,null,s),l&&u.drawNodeOverlay(e,t,f,r,i),n&&e.translate(o.x1,o.y1)}};var d1=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,n,r,i,a){if(n.visible()){var o=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-opacity")).value,l=n.pstyle("".concat(e,"-color")).value,c=n.pstyle("".concat(e,"-shape")).value,u=n.pstyle("".concat(e,"-corner-radius")).value;if(s>0){if(r=r||n.position(),null==i||null==a){var d=n.padding();i=n.width()+2*d,a=n.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[c].draw(t,r.x,r.y,i+2*o,a+2*o,u),t.fill()}}}};d0.drawNodeOverlay=d1("overlay"),d0.drawNodeUnderlay=d1("underlay"),d0.hasPie=function(e){return(e=e[0])._private.hasPie},d0.hasStripe=function(e){return(e=e[0])._private.hasStripe},d0.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i,a=t.cy().style(),o=t.pstyle("pie-size"),s=t.pstyle("pie-hole"),l=t.pstyle("pie-start-angle").pfValue,c=r.x,u=r.y,d=Math.min(t.width(),t.height())/2,h=0;if(this.usePaths()&&(c=0,u=0),"%"===o.units?d*=o.pfValue:void 0!==o.pfValue&&(d=o.pfValue/2),"%"===s.units?i=d*s.pfValue:void 0!==s.pfValue&&(i=s.pfValue/2),!(i>=d))for(var f=1;f<=a.pieBackgroundN;f++){var p=t.pstyle("pie-"+f+"-background-size").value,g=t.pstyle("pie-"+f+"-background-color").value,v=t.pstyle("pie-"+f+"-background-opacity").value*n,x=p/100;x+h>1&&(x=1-h);var y=1.5*Math.PI+2*Math.PI*h,b=2*Math.PI*x,w=(y+=l)+b;0===p||h>=1||h+x>1||(0===i?(e.beginPath(),e.moveTo(c,u),e.arc(c,u,d,y,w)):(e.beginPath(),e.arc(c,u,d,y,w),e.arc(c,u,i,w,y,!0)),e.closePath(),this.colorFillStyle(e,g[0],g[1],g[2],v),e.fill(),h+=x)}},d0.drawStripe=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=r.x,o=r.y,s=t.width(),l=t.height(),c=0,u=this.usePaths();e.save();var d=t.pstyle("stripe-direction").value,h=t.pstyle("stripe-size");switch(d){case"vertical":break;case"righward":e.rotate(-Math.PI/2)}var f=s,p=l;"%"===h.units?(f*=h.pfValue,p*=h.pfValue):void 0!==h.pfValue&&(f=h.pfValue,p=h.pfValue),u&&(a=0,o=0),o-=f/2,a-=p/2;for(var g=1;g<=i.stripeBackgroundN;g++){var v=t.pstyle("stripe-"+g+"-background-size").value,x=t.pstyle("stripe-"+g+"-background-color").value,y=t.pstyle("stripe-"+g+"-background-opacity").value*n,b=v/100;b+c>1&&(b=1-c),0===v||c>=1||c+b>1||(e.beginPath(),e.rect(a,o+p*c,f,p*b),e.closePath(),this.colorFillStyle(e,x[0],x[1],x[2],y),e.fill(),c+=b)}e.restore()};var d2={};function d5(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw Error(e.getShaderInfoLog(r));return r}function d3(e,t,n){void 0===n&&(n=t);var r=e.makeOffscreenCanvas(t,n),i=r.context=r.getContext("2d");return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function d4(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function d6(e){return"solid"===e.pstyle("background-fill").value&&"none"===e.pstyle("background-image").strValue&&(0===e.pstyle("border-width").value||0===e.pstyle("border-opacity").value||"solid"===e.pstyle("border-style").value)}function d8(e,t,n){var r=e[0]/255,i=e[1]/255,a=e[2]/255,o=n||[,,,,];return o[0]=r*t,o[1]=i*t,o[2]=a*t,o[3]=t,o}function d7(e,t){var n=t||[,,,,];return n[0]=(255&e)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function d9(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function he(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function ht(e,t,n,r){var i=t6(d9(e,n),3),a=i[0],o=i[1],s=i[2],l=he(e,o,t*a),c=a*s,u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,t*c,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,a,o,!1,c,0):o===e.INT&&e.vertexAttribIPointer(r,a,o,c,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var d=Array(t),h=0;h<t;h++)d[h]=function(e,t,n,r,i,a){switch(t){case e.FLOAT:return new Float32Array(n.buffer,a*r,i);case e.INT:return new Int32Array(n.buffer,a*r,i)}}(e,o,l,c,a,h);return u.dataArray=l,u.stride=c,u.size=a,u.getView=function(e){return d[e]},u.setPoint=function(e,t,n){var r=d[e];r[0]=t,r[1]=n},u.bufferSubData=function(t){e.bindBuffer(e.ARRAY_BUFFER,u),t?e.bufferSubData(e.ARRAY_BUFFER,0,l,0,t*a):e.bufferSubData(e.ARRAY_BUFFER,0,l)},u}d2.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},d2.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;i<n.length;i++)if((t=n[i]).context===e){r=!1;break}return r&&(t={context:e},n.push(t)),t},d2.createGradientStyleFor=function(e,t,n,r,i){var a,o=this.usePaths(),s=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===r)if(n.isEdge()){var c=n.sourceEndpoint(),u=n.targetEndpoint(),d=n.midpoint(),h=rG(c,d),f=rG(u,d);a=e.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(h,f))}else{var p=o?{x:0,y:0}:n.position(),g=n.paddedWidth(),v=n.paddedHeight();a=e.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(g,v))}else if(n.isEdge()){var x=n.sourceEndpoint(),y=n.targetEndpoint();a=e.createLinearGradient(x.x,x.y,y.x,y.y)}else{var b=o?{x:0,y:0}:n.position(),w=n.paddedWidth(),j=n.paddedHeight(),N=w/2,k=j/2;switch(n.pstyle("background-gradient-direction").value){case"to-bottom":a=e.createLinearGradient(b.x,b.y-k,b.x,b.y+k);break;case"to-top":a=e.createLinearGradient(b.x,b.y+k,b.x,b.y-k);break;case"to-left":a=e.createLinearGradient(b.x+N,b.y,b.x-N,b.y);break;case"to-right":a=e.createLinearGradient(b.x-N,b.y,b.x+N,b.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(b.x-N,b.y-k,b.x+N,b.y+k);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(b.x-N,b.y+k,b.x+N,b.y-k);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(b.x+N,b.y-k,b.x-N,b.y+k);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(b.x+N,b.y+k,b.x-N,b.y-k)}}if(!a)return null;for(var C=l.length===s.length,E=s.length,_=0;_<E;_++)a.addColorStop(C?l[_]:_/(E-1),"rgba("+s[_][0]+","+s[_][1]+","+s[_][2]+","+i+")");return a},d2.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"background",t,n,r);if(!i)return null;e.fillStyle=i},d2.colorFillStyle=function(e,t,n,r,i){e.fillStyle="rgba("+t+","+n+","+r+","+i+")"},d2.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},d2.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"line",t,n,r);if(!i)return null;e.strokeStyle=i},d2.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle="rgba("+t+","+n+","+r+","+i+")"},d2.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},d2.matchCanvasSize=function(e){var t,n=this.data,r=this.findContainerClientCoords(),i=r[2],a=r[3],o=this.getPixelRatio(),s=this.motionBlurPxRatio;(e===this.data.bufferCanvases[this.MOTIONBLUR_BUFFER_NODE]||e===this.data.bufferCanvases[this.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var l=i*o,c=a*o;if(l!==this.canvasWidth||c!==this.canvasHeight){this.fontCaches=null;var u=n.canvasContainer;u.style.width=i+"px",u.style.height=a+"px";for(var d=0;d<this.CANVAS_LAYERS;d++)(t=n.canvases[d]).width=l,t.height=c,t.style.width=i+"px",t.style.height=a+"px";for(var d=0;d<this.BUFFER_COUNT;d++)(t=n.bufferCanvases[d]).width=l,t.height=c,t.style.width=i+"px",t.style.height=a+"px";this.textureMult=1,o<=1&&(t=n.bufferCanvases[this.TEXTURE_BUFFER],this.textureMult=2,t.width=l*this.textureMult,t.height=c*this.textureMult),this.canvasWidth=l,this.canvasHeight=c,this.pixelRatio=o}},d2.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},d2.clearCanvas=function(){var e=this,t=e.data;function n(t){t.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])},d2.render=function(e){var t=this;e=e||rh();var n=t.cy,r=e.forcedContext,i=e.drawAllLayers,a=e.drawOnlyNodeLayer,o=e.forcedZoom,s=e.forcedPan,l=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,c=t.data,u=c.canvasNeedsRedraw,d=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),h=void 0!==e.motionBlur?e.motionBlur:t.motionBlur,f=t.motionBlurPxRatio,p=n.hasCompoundNodes(),g=t.hoverData.draggingEles,v=!!t.hoverData.selecting||!!t.touchData.selecting,x=h=h&&!r&&t.motionBlurEnabled&&!v;r||(t.prevPxRatio!==l&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint("eles",!0),t.redrawHint("drag",!0)),t.prevPxRatio=l),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),h&&(null==t.mbFrames&&(t.mbFrames=0),t.mbFrames++,t.mbFrames<3&&(x=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!d&&(u[t.NODE]=!0,u[t.SELECT_BOX]=!0);var y=n.style(),b=n.zoom(),w=void 0!==o?o:b,j=n.pan(),N={x:j.x,y:j.y},k={zoom:b,pan:{x:j.x,y:j.y}},C=t.prevViewport;void 0===C||k.zoom!==C.zoom||k.pan.x!==C.pan.x||k.pan.y!==C.pan.y||g&&!p||(t.motionBlurPxRatio=1),s&&(N=s),w*=l,N.x*=l,N.y*=l;var E=t.getCachedZSortedEles();function _(e,n,r,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,i,a),e.globalCompositeOperation=o}function S(e,n){var a,l,u,d;t.clearingMotionBlur||e!==c.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&e!==c.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(a=N,l=w,u=t.canvasWidth,d=t.canvasHeight):(a={x:j.x*f,y:j.y*f},l=b*f,u=t.canvasWidth*f,d=t.canvasHeight*f),e.setTransform(1,0,0,1,0,0),"motionBlur"===n?_(e,0,0,u,d):!r&&(void 0===n||n)&&e.clearRect(0,0,u,d),i||(e.translate(a.x,a.y),e.scale(l,l)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(d||(t.textureDrawLastFrame=!1),d){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var T=t.data.bufferContexts[t.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult});var k=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};k.mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}u[t.DRAG]=!1,u[t.NODE]=!1;var A=c.contexts[t.NODE],O=t.textureCache.texture,k=t.textureCache.viewport;A.setTransform(1,0,0,1,0,0),h?_(A,0,0,k.width,k.height):A.clearRect(0,0,k.width,k.height);var M=y.core("outside-texture-bg-color").value,P=y.core("outside-texture-bg-opacity").value;t.colorFillStyle(A,M[0],M[1],M[2],P),A.fillRect(0,0,k.width,k.height);var b=n.zoom();S(A,!1),A.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l),A.drawImage(O,k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l)}else t.textureOnViewport&&!r&&(t.textureCache=null);var D=n.extent(),L=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),I=t.hideEdgesOnViewport&&L,R=[];if(R[t.NODE]=!u[t.NODE]&&h&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,R[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),R[t.DRAG]=!u[t.DRAG]&&h&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,R[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),u[t.NODE]||i||a||R[t.NODE]){var B=h&&!R[t.NODE]&&1!==f,A=r||(B?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:c.contexts[t.NODE]);S(A,h&&!B?"motionBlur":void 0),I?t.drawCachedNodes(A,E.nondrag,l,D):t.drawLayeredElements(A,E.nondrag,l,D),t.debug&&t.drawDebugPoints(A,E.nondrag),i||h||(u[t.NODE]=!1)}if(!a&&(u[t.DRAG]||i||R[t.DRAG])){var B=h&&!R[t.DRAG]&&1!==f,A=r||(B?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:c.contexts[t.DRAG]);S(A,h&&!B?"motionBlur":void 0),I?t.drawCachedNodes(A,E.drag,l,D):t.drawCachedElements(A,E.drag,l,D),t.debug&&t.drawDebugPoints(A,E.drag),i||h||(u[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,S),h&&1!==f){var z=c.contexts[t.NODE],F=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],V=c.contexts[t.DRAG],U=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],H=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!x?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):_(e,0,0,t.canvasWidth,t.canvasHeight),e.drawImage(n,0,0,t.canvasWidth*f,t.canvasHeight*f,0,0,t.canvasWidth,t.canvasHeight)};(u[t.NODE]||R[t.NODE])&&(H(z,F,R[t.NODE]),u[t.NODE]=!1),(u[t.DRAG]||R[t.DRAG])&&(H(V,U,R[t.DRAG]),u[t.DRAG]=!1)}t.prevViewport=k,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),h&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!d,t.mbFrames=0,u[t.NODE]=!0,u[t.DRAG]=!0,t.redraw()},100)),r||n.emit("render")},d2.drawSelectionRectangle=function(e,t){var n=this.cy,r=this.data,i=n.style(),a=e.drawOnlyNodeLayer,o=e.drawAllLayers,s=r.canvasNeedsRedraw,l=e.forcedContext;if(this.showFps||!a&&s[this.SELECT_BOX]&&!o){var c=l||r.contexts[this.SELECT_BOX];if(t(c),1==this.selection[4]&&(this.hoverData.selecting||this.touchData.selecting)){var u=this.cy.zoom(),d=i.core("selection-box-border-width").value/u;c.lineWidth=d,c.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",c.fillRect(this.selection[0],this.selection[1],this.selection[2]-this.selection[0],this.selection[3]-this.selection[1]),d>0&&(c.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",c.strokeRect(this.selection[0],this.selection[1],this.selection[2]-this.selection[0],this.selection[3]-this.selection[1]))}if(r.bgActivePosistion&&!this.hoverData.selecting){var u=this.cy.zoom(),h=r.bgActivePosistion;c.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",c.beginPath(),c.arc(h.x,h.y,i.core("active-bg-size").pfValue/u,0,2*Math.PI),c.fill()}var f=this.lastRedrawTime;if(this.showFps&&f){var p=Math.round(1e3/(f=Math.round(f))),g="1 frame = "+f+" ms = "+p+" fps";c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",b||(b=c.measureText(g).actualBoundingBoxAscent),c.fillText(g,0,b),c.strokeRect(0,b+10,250,20),c.fillRect(0,b+10,250*Math.min(p/60,1),20)}o||(s[this.SELECT_BOX]=!1)}};var hn="u">typeof Float32Array?Float32Array:Array;function hr(){var e=new hn(9);return hn!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function hi(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function ha(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],h=n[0],f=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=h*r+f*o+c,e[7]=h*i+f*s+u,e[8]=h*a+f*l+d,e}function ho(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],d=t[8],h=Math.sin(n),f=Math.cos(n);return e[0]=f*r+h*o,e[1]=f*i+h*s,e[2]=f*a+h*l,e[3]=f*o-h*r,e[4]=f*s-h*i,e[5]=f*l-h*a,e[6]=c,e[7]=u,e[8]=d,e}function hs(e,t,n){var r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var hl=t5(function e(t,n,r,i){t2(this,e),this.debugID=Math.floor(1e4*Math.random()),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(t,n,n),this.scratch=i(t,n,this.texHeight,"scratch")},[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(e){var t=e.w,n=e.h,r=this.texHeight,i=this.texSize,a=r/n,o=t*a,s=n*a;return o>i&&(a=i/t,o=t*a,s=n*a),{scale:a,texW:o,texH:s}}},{key:"draw",value:function(e,t,n){var r,i,a,o,s,l,c,u=this;if(this.locked)throw Error("can't draw, atlas is locked");var d=this.texSize,h=this.texRows,f=this.texHeight,p=this.getScale(t),g=p.scale,v=p.texW,x=p.texH,y=function(e,r){if(n&&r){var i=r.context,a=e.x,o=f*e.row;i.save(),i.translate(a,o),i.scale(g,g),n(i,t),i.restore()}},b=[null,null],w=function(){y(u.freePointer,u.canvas),b[0]={x:u.freePointer.x,y:u.freePointer.row*f,w:v,h:x},b[1]={x:u.freePointer.x+v,y:u.freePointer.row*f,w:0,h:x},u.freePointer.x+=v,u.freePointer.x==d&&(u.freePointer.x=0,u.freePointer.row++)},j=function(){u.freePointer.x=0,u.freePointer.row++};if(this.freePointer.x+v<=d)w();else{if(this.freePointer.row>=h-1)return!1;this.freePointer.x===d?(j(),w()):this.enableWrapping?(r=u.scratch,i=u.canvas,r.clear(),y({x:0,row:0},r),o=v-(a=d-u.freePointer.x),s=u.freePointer.x,l=u.freePointer.row*f,i.context.drawImage(r,0,0,a,f,s,l,a,f),b[0]={x:s,y:l,w:a,h:x},c=(u.freePointer.row+1)*f,i&&i.context.drawImage(r,a,0,o,f,0,c,o,f),b[1]={x:0,y:c,w:o,h:x},u.freePointer.x=o,u.freePointer.row++):(j(),w())}return this.keyToLocation.set(e,b),this.needsBuffer=!0,b}},{key:"getOffsets",value:function(e){return this.keyToLocation.get(e)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return!(this.freePointer.x+r>t)||this.freePointer.row<n-1}},{key:"bufferIfNeeded",value:function(e){var t;this.texture||(this.texture=(this.debugID,(t=e.createTexture()).buffer=function(n){e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},t.deleteTexture=function(){e.deleteTexture(t)},t)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}]),hc=t5(function e(t,n,r,i){t2(this,e),this.r=t,this.texSize=n,this.texRows=r,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set},[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){return new hl(this.r,this.texSize,this.texRows,this.createTextureCanvas)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas,i=Math.floor(t/n);this.scratch=r(e,t,i,"scratch")}return this.scratch}},{key:"draw",value:function(e,t,n){var r=this.styleKeyToAtlas.get(e);return r||((r=this.atlases[this.atlases.length-1])&&r.canFit(t)||(r&&r.lock(),r=this._createAtlas(),this.atlases.push(r)),r.draw(e,t,n),this.styleKeyToAtlas.set(e,r)),r}},{key:"getAtlas",value:function(e){return this.styleKeyToAtlas.get(e)}},{key:"hasAtlas",value:function(e){return this.styleKeyToAtlas.has(e)}},{key:"markKeyForGC",value:function(e){this.markedKeys.add(e)}},{key:"gc",value:function(){var e=this,t=this.markedKeys;if(0===t.size)return void console.log("nothing to garbage collect");var n,r=[],i=new Map,a=null,o=t3(this.atlases);try{for(o.s();!(n=o.n()).done;)if(function(){var o=n.value,s=o.getKeys(),l=function(e,t){return e.intersection?e.intersection(t):new Set(t8(e).filter(function(e){return t.has(e)}))}(t,s);if(0===l.size)return r.push(o),s.forEach(function(e){return i.set(e,o)}),1;a||(a=e._createAtlas(),r.push(a));var c,u=t3(s);try{for(u.s();!(c=u.n()).done;){var d=c.value;if(!l.has(d)){var h=o.getOffsets(d),f=t6(h,2),p=f[0],g=f[1];a.canFit({w:p.w+g.w,h:p.h})||(a.lock(),a=e._createAtlas(),r.push(a)),o.canvas&&(e._copyTextureToNewAtlas(d,o,a),i.set(d,a))}}}catch(e){u.e(e)}finally{u.f()}o.dispose()}())continue}catch(e){o.e(e)}finally{o.f()}this.atlases=r,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(e,t,n){var r=t6(t.getOffsets(e),2),i=r[0],a=r[1];if(0===a.w)n.draw(e,i,function(e){e.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h)});else{var o=this._getScratchCanvas();o.clear(),o.context.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h),o.context.drawImage(t.canvas,a.x,a.y,a.w,a.h,i.w,0,a.w,a.h);var s=i.w+a.w,l=i.h;n.draw(e,{w:s,h:l},function(e){e.drawImage(o,0,0,s,l,0,0,s,l)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}]),hu=t5(function e(t,n){t2(this,e),this.r=t,this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map},[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(e,t){var n=this.globalOptions,r=n.webglTexSize,i=n.createTextureCanvas,a=t.texRows,o=this._cacheScratchCanvas(i),s=new hc(this.r,r,a,o);this.collections.set(e,s)}},{key:"addRenderType",value:function(e,t){var n=t.collection;if(!this.collections.has(n))throw Error("invalid atlas collection name '".concat(n,"'"));var r=nP({type:e,atlasCollection:this.collections.get(n)},t);this.renderTypes.set(e,r)}},{key:"getRenderTypeOpts",value:function(e){return this.renderTypes.get(e)}},{key:"getAtlasCollection",value:function(e){return this.collections.get(e)}},{key:"_cacheScratchCanvas",value:function(e){var t=-1,n=-1,r=null;return function(i,a,o,s){return s?(r&&a==t&&o==n||(t=a,n=o,r=e(i,a,o)),r):e(i,a,o)}}},{key:"_key",value:function(e,t){return"".concat(e,"-").concat(t)}},{key:"invalidate",value:function(e){var t,n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.forceRedraw,a=void 0!==i&&i,o=r.filterEle,s=void 0===o?function(){return!0}:o,l=r.filterType,c=void 0===l?function(){return!0}:l,u=!1,d=!1,h=t3(e);try{for(h.s();!(t=h.n()).done;){var f=t.value;if(s(f)){var p,g=t3(this.renderTypes.values());try{for(g.s();!(p=g.n()).done;)!function(){var e=p.value,t=e.type;if(c(t)){var r=n.collections.get(e.collection),i=e.getKey(f),o=Array.isArray(i)?i:[i];if(a)o.forEach(function(e){return r.markKeyForGC(e)}),d=!0;else{var s=e.getID?e.getID(f):f.id(),l=n._key(t,s),h=n.typeAndIdToKey.get(l);void 0!==h&&!function(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(o,h)&&(u=!0,n.typeAndIdToKey.delete(l),h.forEach(function(e){return r.markKeyForGC(e)}))}}}()}catch(e){g.e(e)}finally{g.f()}}}}catch(e){h.e(e)}finally{h.f()}return d&&(this.gc(),u=!1),u}},{key:"gc",value:function(){var e,t=t3(this.collections.values());try{for(t.s();!(e=t.n()).done;)e.value.gc()}catch(e){t.e(e)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(e,t,n,r){var i=this.renderTypes.get(t),a=this.collections.get(i.collection),o=!1,s=a.draw(r,n,function(t){i.drawClipped?(t.save(),t.beginPath(),t.rect(0,0,n.w,n.h),t.clip(),i.drawElement(t,e,n,!0,!0),t.restore()):i.drawElement(t,e,n,!0,!0),o=!0});if(o){var l=i.getID?i.getID(e):e.id(),c=this._key(t,l);this.typeAndIdToKey.has(c)?this.typeAndIdToKey.get(c).push(r):this.typeAndIdToKey.set(c,[r])}return s}},{key:"getAtlasInfo",value:function(e,t){var n=this,r=this.renderTypes.get(t),i=r.getKey(e);return(Array.isArray(i)?i:[i]).map(function(i){var a=r.getBoundingBox(e,i),o=n.getOrCreateAtlas(e,t,a,i),s=t6(o.getOffsets(i),2),l=s[0];return{atlas:o,tex:l,tex1:l,tex2:s[1],bb:a}})}},{key:"getDebugInfo",value:function(){var e,t=[],n=t3(this.collections);try{for(n.s();!(e=n.n()).done;){var r=t6(e.value,2),i=r[0],a=r[1].getCounts(),o=a.keyCount,s=a.atlasCount;t.push({type:i,keyCount:o,atlasCount:s})}}catch(e){n.e(e)}finally{n.f()}return t}}]),hd=t5(function e(t){t2(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]},[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(e,t){return t})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(e){return this.batchAtlases.length!==this.maxAtlasesPerBatch||this.batchAtlases.includes(e)}},{key:"getAtlasIndexForBatch",value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw Error("cannot add more atlases to batch");this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}}]),hh={name:"screen",screen:!0},hf={name:"picking",picking:!0},hp=t5(function e(t,n,r){t2(this,e),this.r=t,this.gl=n,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=d3,this.atlasManager=new hu(t,r),this.batchManager=new hd(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(hh),this.pickingProgram=this._createShaderProgram(hf),this.vao=this._createVAO()},[{key:"addAtlasCollection",value:function(e,t){this.atlasManager.addAtlasCollection(e,t)}},{key:"addTextureAtlasRenderType",value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:"addSimpleShapeRenderType",value:function(e,t){this.simpleShapeOptions.set(e,t)}},{key:"invalidate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.type,r=this.atlasManager;return n?r.invalidate(e,{filterType:function(e){return e===n},forceRedraw:!0}):r.invalidate(e)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(e){var t=this.gl,n="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; // a vertex from the unit square\n \n in mat3 aTransform; // used to transform verticies, eg into a bounding box\n in int aVertType; // the type of thing we are rendering\n\n // the z-index that is output when using picking mode\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex; // x/y/w/h of texture in atlas\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in vec2 aLineWidth; // also used for node border width\n\n // simple shapes\n in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]\n in vec4 aColor; // also used for edges\n in vec4 aBorderColor; // aLineWidth is used for border width\n\n // output values passed to the fragment shader\n out vec2 vTexCoord;\n out vec4 vColor;\n out vec2 vPosition;\n // flat values are not interpolated\n flat out int vAtlasId; \n flat out int vVertType;\n flat out vec2 vTopRight;\n flat out vec2 vBotLeft;\n flat out vec4 vCornerRadius;\n flat out vec4 vBorderColor;\n flat out vec2 vBorderWidth;\n flat out vec4 vIndex;\n \n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition; // TODO make this a vec3, simplifies some code below\n\n if(aVertType == ".concat(0,") {\n float texX = aTex.x; // texture coordinates\n float texY = aTex.y;\n float texW = aTex.z;\n float texH = aTex.w;\n\n if(vid == 1 || vid == 2 || vid == 4) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(4," || aVertType == ").concat(7," \n || aVertType == ").concat(5," || aVertType == ").concat(6,") { // simple shapes\n\n // the bounding box is needed by the fragment shader\n vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat\n vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat\n vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated\n\n // calculations are done in the fragment shader, just pass these along\n vColor = aColor;\n vCornerRadius = aCornerRadius;\n vBorderColor = aBorderColor;\n vBorderWidth = aLineWidth;\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(1,") {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n // stretch the unit square into a long skinny rectangle\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vColor = aColor;\n } \n else if(aVertType == ").concat(2,") {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0, p1, p2, pos;\n if(position.x == 0.0) { // The left side of the unit square\n p0 = pointA;\n p1 = pointB;\n p2 = pointC;\n pos = position;\n } else { // The right side of the unit square, use same approach but flip the geometry upside down\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth[0];\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vColor = aColor;\n } \n else if(aVertType == ").concat(3," && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\n }\n else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vVertType = aVertType;\n vIndex = aIndex;\n }\n "),r=this.batchManager.getIndexArray(),i=function(e,t,n){var r=d5(e,e.VERTEX_SHADER,t),i=d5(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw Error("Could not initialize shaders");return a}(t,n,"#version 300 es\n precision highp float;\n\n // declare texture unit for each texture atlas in the batch\n ".concat(r.map(function(e){return"uniform sampler2D uTexture".concat(e,";")}).join("\n "),"\n\n uniform vec4 uBGColor;\n uniform float uZoom;\n\n in vec2 vTexCoord;\n in vec4 vColor;\n in vec2 vPosition; // model coordinates\n\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n flat in vec2 vTopRight;\n flat in vec2 vBotLeft;\n flat in vec4 vCornerRadius;\n flat in vec4 vBorderColor;\n flat in vec2 vBorderWidth;\n\n out vec4 outColor;\n\n ").concat("\n float circleSD(vec2 p, float r) {\n return distance(vec2(0), p) - r; // signed distance\n }\n","\n ").concat("\n float rectangleSD(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);\n }\n","\n ").concat("\n float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {\n cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;\n cr.x = (p.y > 0.0) ? cr.x : cr.y;\n vec2 q = abs(p) - b + cr.x;\n return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;\n }\n","\n ").concat("\n float ellipseSD(vec2 p, vec2 ab) {\n p = abs( p ); // symmetry\n\n // find root with Newton solver\n vec2 q = ab*(p-ab);\n float w = (q.x<q.y)? 1.570796327 : 0.0;\n for( int i=0; i<5; i++ ) {\n vec2 cs = vec2(cos(w),sin(w));\n vec2 u = ab*vec2( cs.x,cs.y);\n vec2 v = ab*vec2(-cs.y,cs.x);\n w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));\n }\n \n // compute final point and distance\n float d = length(p-ab*vec2(cos(w),sin(w)));\n \n // return signed distance\n return (dot(p/ab,p/ab)>1.0) ? d : -d;\n }\n","\n\n vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha\n return vec4( \n top.rgb + (bot.rgb * (1.0 - top.a)),\n top.a + (bot.a * (1.0 - top.a)) \n );\n }\n\n vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance\n // scale to the zoom level so that borders don't look blurry when zoomed in\n // note 1.5 is an aribitrary value chosen because it looks good\n return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); \n }\n\n void main(void) {\n if(vVertType == ").concat(0,") {\n // look up the texel from the texture unit\n ").concat(r.map(function(e){return"if(vAtlasId == ".concat(e,") outColor = texture(uTexture").concat(e,", vTexCoord);")}).join("\n else "),"\n } \n else if(vVertType == ").concat(3,") {\n // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';\n outColor = blend(vColor, uBGColor);\n outColor.a = 1.0; // make opaque, masks out line under arrow\n }\n else if(vVertType == ").concat(4," && vBorderWidth == vec2(0.0)) { // simple rectangle with no border\n outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done\n }\n else if(vVertType == ").concat(4," || vVertType == ").concat(7," \n || vVertType == ").concat(5," || vVertType == ").concat(6,") { // use SDF\n\n float outerBorder = vBorderWidth[0];\n float innerBorder = vBorderWidth[1];\n float borderPadding = outerBorder * 2.0;\n float w = vTopRight.x - vBotLeft.x - borderPadding;\n float h = vTopRight.y - vBotLeft.y - borderPadding;\n vec2 b = vec2(w/2.0, h/2.0); // half width, half height\n vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center\n\n float d; // signed distance\n if(vVertType == ").concat(4,") {\n d = rectangleSD(p, b);\n } else if(vVertType == ").concat(7," && w == h) {\n d = circleSD(p, b.x); // faster than ellipse\n } else if(vVertType == ").concat(7,") {\n d = ellipseSD(p, b);\n } else {\n d = roundRectangleSD(p, b, vCornerRadius.wzyx);\n }\n\n // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling\n // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box\n if(d > 0.0) {\n if(d > outerBorder) {\n discard;\n } else {\n outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);\n }\n } else {\n if(d > innerBorder) {\n vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;\n vec4 innerBorderColor = blend(vBorderColor, vColor);\n outColor = distInterp(innerBorderColor, outerColor, d);\n } \n else {\n vec4 outerColor;\n if(innerBorder == 0.0 && outerBorder == 0.0) {\n outerColor = vec4(0);\n } else if(innerBorder == 0.0) {\n outerColor = vBorderColor;\n } else {\n outerColor = blend(vBorderColor, vColor);\n }\n outColor = distInterp(vColor, outerColor, d - innerBorder);\n }\n }\n }\n else {\n outColor = vColor;\n }\n\n ").concat(e.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "));i.aPosition=t.getAttribLocation(i,"aPosition"),i.aIndex=t.getAttribLocation(i,"aIndex"),i.aVertType=t.getAttribLocation(i,"aVertType"),i.aTransform=t.getAttribLocation(i,"aTransform"),i.aAtlasId=t.getAttribLocation(i,"aAtlasId"),i.aTex=t.getAttribLocation(i,"aTex"),i.aPointAPointB=t.getAttribLocation(i,"aPointAPointB"),i.aPointCPointD=t.getAttribLocation(i,"aPointCPointD"),i.aLineWidth=t.getAttribLocation(i,"aLineWidth"),i.aColor=t.getAttribLocation(i,"aColor"),i.aCornerRadius=t.getAttribLocation(i,"aCornerRadius"),i.aBorderColor=t.getAttribLocation(i,"aBorderColor"),i.uPanZoomMatrix=t.getUniformLocation(i,"uPanZoomMatrix"),i.uAtlasSize=t.getUniformLocation(i,"uAtlasSize"),i.uBGColor=t.getUniformLocation(i,"uBGColor"),i.uZoom=t.getUniformLocation(i,"uZoom"),i.uTextures=[];for(var a=0;a<this.batchManager.getMaxAtlasesPerBatch();a++)i.uTextures.push(t.getUniformLocation(i,"uTexture".concat(a)));return i}},{key:"_createVAO",value:function(){var e,t,n,r,i,a,o=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=o.length/2;var s=this.maxInstances,l=this.gl,c=this.program,u=l.createVertexArray();return l.bindVertexArray(u),e=c.aPosition,n=(t=t6(d9(l,"vec2"),2))[0],i=he(l,r=t[1],o),a=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,a),l.bufferData(l.ARRAY_BUFFER,i,l.STATIC_DRAW),r===l.FLOAT?l.vertexAttribPointer(e,n,r,!1,0,0):r===l.INT&&l.vertexAttribIPointer(e,n,r,0,0),l.enableVertexAttribArray(e),l.bindBuffer(l.ARRAY_BUFFER,null),this.transformBuffer=function(e,t,n){for(var r=new Float32Array(9*t),i=Array(t),a=0;a<t;a++){var o=9*a*4;i[a]=new Float32Array(r.buffer,o,9)}var s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,r.byteLength,e.DYNAMIC_DRAW);for(var l=0;l<3;l++){var c=n+l;e.enableVertexAttribArray(c),e.vertexAttribPointer(c,3,e.FLOAT,!1,36,12*l),e.vertexAttribDivisor(c,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),s.getMatrixView=function(e){return i[e]},s.setData=function(e,t){i[t].set(e,0)},s.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferSubData(e.ARRAY_BUFFER,0,r)},s}(l,s,c.aTransform),this.indexBuffer=ht(l,s,"vec4",c.aIndex),this.vertTypeBuffer=ht(l,s,"int",c.aVertType),this.atlasIdBuffer=ht(l,s,"int",c.aAtlasId),this.texBuffer=ht(l,s,"vec4",c.aTex),this.pointAPointBBuffer=ht(l,s,"vec4",c.aPointAPointB),this.pointCPointDBuffer=ht(l,s,"vec4",c.aPointCPointD),this.lineWidthBuffer=ht(l,s,"vec2",c.aLineWidth),this.colorBuffer=ht(l,s,"vec4",c.aColor),this.cornerRadiusBuffer=ht(l,s,"vec4",c.aCornerRadius),this.borderColorBuffer=ht(l,s,"vec4",c.aBorderColor),l.bindVertexArray(null),u}},{key:"buffers",get:function(){var e=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(e){return nE(e,"Buffer")}).map(function(t){return e[t]})),this._buffers}},{key:"startFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hh;this.panZoomMatrix=e,this.renderTarget=t,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(e,t){return!!e.visible()&&(!t||!t.isVisible||t.isVisible(e))}},{key:"drawTexture",value:function(e,t,n){var r=this.atlasManager,i=this.batchManager,a=r.getRenderTypeOpts(n);if(this._isVisible(e,a)&&(!e.isEdge()||this._isValidEdge(e))){if(this.renderTarget.picking&&a.getTexPickingMode){var o=a.getTexPickingMode(e);if(1===o)return;if(2==o)return void this.drawPickingRectangle(e,t,n)}var s,l=t3(r.getAtlasInfo(e,n));try{for(l.s();!(s=l.n()).done;){var c=s.value,u=c.atlas,d=c.tex1,h=c.tex2;i.canAddToCurrentBatch(u)||this.endBatch();for(var f=i.getAtlasIndexForBatch(u),p=0,g=[[d,!0],[h,!1]];p<g.length;p++){var v=t6(g[p],2),x=v[0],y=v[1];if(0!=x.w){var b=this.instanceCount;this.vertTypeBuffer.getView(b)[0]=0;var w=this.indexBuffer.getView(b);d7(t,w),this.atlasIdBuffer.getView(b)[0]=f;var j=this.texBuffer.getView(b);j[0]=x.x,j[1]=x.y,j[2]=x.w,j[3]=x.h;var N=this.transformBuffer.getMatrixView(b);this.setTransformMatrix(e,N,a,c,y),this.instanceCount++,!y&&this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(e){l.e(e)}finally{l.f()}}}},{key:"setTransformMatrix",value:function(e,t,n,r){var i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=0;if(n.shapeProps&&n.shapeProps.padding&&(a=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,l=r.tex2,c=s.w/(s.w+l.w);i||(c=1-c);var u=this._getAdjustedBB(o,a,i,c);this._applyTransformMatrix(t,u,n,e)}else{var d=n.getBoundingBox(e),h=this._getAdjustedBB(d,a,!0,1);this._applyTransformMatrix(t,h,n,e)}}},{key:"_applyTransformMatrix",value:function(e,t,n,r){hi(e);var i,a,o=n.getRotation?n.getRotation(r):0;if(0!==o){var s=n.getRotationPoint(r);ha(e,e,[s.x,s.y]),ho(e,e,o);var l=n.getRotationOffset(r);i=l.x+(t.xOffset||0),a=l.y+(t.yOffset||0)}else i=t.x1,a=t.y1;ha(e,e,[i,a]),hs(e,e,[t.w,t.h])}},{key:"_getAdjustedBB",value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h,l=e.yOffset;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var c=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(i+=c=o-u,o=u),{x1:i,y1:a,w:o,h:s,xOffset:c,yOffset:l}}},{key:"drawPickingRectangle",value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=4,d7(t,this.indexBuffer.getView(i)),d8([0,0,0],1,this.colorBuffer.getView(i));var a=this.transformBuffer.getMatrixView(i);this.setTransformMatrix(e,a,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var i=r.shapeProps,a=this._getVertTypeForShape(e,i.shape);if(void 0===a||r.isSimple&&!r.isSimple(e))return void this.drawTexture(e,t,n);var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=a,5===a||6===a){var s=r.getBoundingBox(e),l=this._getCornerRadius(e,i.radius,s),c=this.cornerRadiusBuffer.getView(o);c[0]=l,c[1]=l,c[2]=l,c[3]=l,6===a&&(c[0]=0,c[2]=0)}d7(t,this.indexBuffer.getView(o)),d8(e.pstyle(i.color).value,e.pstyle(i.opacity).value,this.colorBuffer.getView(o));var u=this.lineWidthBuffer.getView(o);if(u[0]=0,u[1]=0,i.border){var d=e.pstyle("border-width").value;if(d>0){d8(e.pstyle("border-color").value,e.pstyle("border-opacity").value,this.borderColorBuffer.getView(o));var h=e.pstyle("border-position").value;if("inside"===h)u[0]=0,u[1]=-d;else if("outside"===h)u[0]=d,u[1]=0;else{var f=d/2;u[0]=f,u[1]=-f}}}var p=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,p,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(e,t){switch(e.pstyle(t).value){case"rectangle":return 4;case"ellipse":return 7;case"roundrectangle":case"round-rectangle":return 5;case"bottom-round-rectangle":return 6;default:return}}},{key:"_getCornerRadius",value:function(e,t,n){var r=n.w,i=n.h;return"auto"===e.pstyle(t).value?i_(r,i):Math.min(e.pstyle(t).pfValue,i/2,r/2)}},{key:"drawEdgeArrow",value:function(e,t,n){if(e.visible()){var r,i,a,o=e._private.rscratch;if(("source"===n?(r=o.arrowStartX,i=o.arrowStartY,a=o.srcArrowAngle):(r=o.arrowEndX,i=o.arrowEndY,a=o.tgtArrowAngle),!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a))&&null!=a)&&"none"!==e.pstyle(n+"-arrow-shape").value){var s=e.pstyle(n+"-arrow-color").value,l=e.pstyle("opacity").value,c=e.pstyle("line-opacity").value,u=e.pstyle("width").pfValue,d=e.pstyle("arrow-scale").value,h=this.r.getArrowWidth(u,d),f=this.instanceCount,p=this.transformBuffer.getMatrixView(f);hi(p),ha(p,p,[r,i]),hs(p,p,[h,h]),ho(p,p,a),this.vertTypeBuffer.getView(f)[0]=3,d7(t,this.indexBuffer.getView(f)),d8(s,l*c,this.colorBuffer.getView(f)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle("opacity").value,i=e.pstyle("line-opacity").value,a=e.pstyle("width").pfValue,o=e.pstyle("line-color").value,s=r*i;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==n.length){var l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=1,d7(t,this.indexBuffer.getView(l)),d8(o,s,this.colorBuffer.getView(l)),this.lineWidthBuffer.getView(l)[0]=a;var c=this.pointAPointBBuffer.getView(l);c[0]=n[0],c[1]=n[1],c[2]=n[2],c[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var u=0;u<n.length-2;u+=2){var d=this.instanceCount;this.vertTypeBuffer.getView(d)[0]=2,d7(t,this.indexBuffer.getView(d)),d8(o,s,this.colorBuffer.getView(d)),this.lineWidthBuffer.getView(d)[0]=a;var h=n[u-2],f=n[u-1],p=n[u],g=n[u+1],v=n[u+2],x=n[u+3],y=n[u+4],b=n[u+5];0==u&&(h=2*p-v+.001,f=2*g-x+.001),u==n.length-4&&(y=2*v-p+.001,b=2*x-g+.001);var w=this.pointAPointBBuffer.getView(d);w[0]=h,w[1]=f,w[2]=p,w[3]=g;var j=this.pointCPointDBuffer.getView(d);j[0]=v,j[1]=x,j[2]=y,j[3]=b,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(e){var t=e._private.rscratch;return!(t.badLine||null==t.allpts||isNaN(t.allpts[0]))}},{key:"_getEdgePoints",value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e)){var n=t.allpts;if(4==n.length)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:"_getNumSegments",value:function(e){return Math.min(15,this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(e,t){if(4==e.length)return e;for(var n=Array((t+1)*2),r=0;r<=t;r++)if(0==r)n[0]=e[0],n[1]=e[1];else if(r==t)n[2*r]=e[e.length-2],n[2*r+1]=e[e.length-1];else{var i=r/t;this._setCurvePoint(e,i,n,2*r)}return n}},{key:"_setCurvePoint",value:function(e,t,n,r){if(e.length<=2)n[r]=e[0],n[r+1]=e[1];else{for(var i=Array(e.length-2),a=0;a<i.length;a+=2){var o=(1-t)*e[a]+t*e[a+2],s=(1-t)*e[a+1]+t*e[a+3];i[a]=o,i[a+1]=s}return this._setCurvePoint(i,t,n,r)}}},{key:"endBatch",value:function(){var e=this.gl,t=this.vao,n=this.vertexCount,r=this.instanceCount;if(0!==r){var i,a,o=this.renderTarget.picking?this.pickingProgram:this.program;e.useProgram(o),e.bindVertexArray(t);var s,l=t3(this.buffers);try{for(l.s();!(s=l.n()).done;)s.value.bufferSubData(r)}catch(e){l.e(e)}finally{l.f()}for(var c=this.batchManager.getAtlases(),u=0;u<c.length;u++)c[u].bufferIfNeeded(e);for(var d=0;d<c.length;d++)e.activeTexture(e.TEXTURE0+d),e.bindTexture(e.TEXTURE_2D,c[d].texture),e.uniform1i(o.uTextures[d],d);e.uniform1f(o.uZoom,(a=(i=this.r).pixelRatio,i.cy.zoom()*a)),e.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var h=d8(this.bgColor,1);e.uniform4fv(o.uBGColor,h),e.drawArraysInstanced(e.TRIANGLES,0,n,r),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:r,atlasCount:c.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var e=this.atlasManager.getDebugInfo(),t=e.reduce(function(e,t){return e+t.atlasCount},0),n=this.batchDebugInfo,r=n.reduce(function(e,t){return e+t.count},0);return{atlasInfo:e,totalAtlases:t,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:r}}}]),hm={};function hg(e,t){return rv(e._private.rscratch,"labelWrapCachedLines",t)||[]}hm.initWebgl=function(e,t){var n,r,i,a,o,s,l,c,u=this,d=u.data.contexts[u.WEBGL];e.bgColor=nR((n=u.cy.container())&&n.style&&n.style.backgroundColor||"white"),e.webglTexSize=Math.min(e.webglTexSize,d.getParameter(d.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,d.getParameter(d.MAX_TEXTURE_IMAGE_UNITS)),u.webglDebug=e.webglDebug,u.webglDebugShowAtlases=e.webglDebugShowAtlases,l=d.createFramebuffer(),d.bindFramebuffer(d.FRAMEBUFFER,l),c=d.createTexture(),d.bindTexture(d.TEXTURE_2D,c),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,c,0),d.bindFramebuffer(d.FRAMEBUFFER,null),l.setFramebufferAttachmentSizes=function(e,t){d.bindTexture(d.TEXTURE_2D,c),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,e,t,0,d.RGBA,d.UNSIGNED_BYTE,null)},u.pickingFrameBuffer=l,u.pickingFrameBuffer.needsDraw=!0,u.drawing=new hp(u,d,e);var h=function(e){return function(t){return u.getTextAngle(t,e)}},f=function(e){return function(t){var n=t.pstyle(e);return n&&n.value}},p=function(e){return function(t){return t.pstyle("".concat(e,"-opacity")).value>0}},g=function(e){return"yes"===e.pstyle("text-events").strValue?2:1},v=function(e){var t=e.position(),n=t.x,r=t.y,i=e.outerWidth(),a=e.outerHeight();return{w:i,h:a,x1:n-i/2,y1:r-a/2}};u.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),u.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),u.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),u.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:v,isSimple:d6,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),u.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:v,isVisible:p("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),u.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:v,isVisible:p("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),u.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:g,getKey:hv(t.getLabelKey,null),getBoundingBox:hx(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:h(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:f("label")}),u.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:g,getKey:hv(t.getSourceLabelKey,"source"),getBoundingBox:hx(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:h("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:f("source-label")}),u.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:g,getKey:hv(t.getTargetLabelKey,"target"),getBoundingBox:hx(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:h("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:f("target-label")});var x=nX(function(){console.log("garbage collect flag set"),u.data.gc=!0},1e4);u.onUpdateEleCalcs(function(e,t){var n=!1;t&&t.length>0&&(n|=u.drawing.invalidate(t)),n&&x()}),i=(r=u).render,r.render=function(e){e=e||{};var t,n,a,o,s=r.cy;r.webgl&&(s.zoom()>7.99?((n=(t=r).data.contexts[t.WEBGL]).clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT),i.call(r,e)):(a=r,(o=function(e){e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,a.canvasWidth,a.canvasHeight),e.restore()})(a.data.contexts[a.NODE]),o(a.data.contexts[a.DRAG]),hw(r,e,hh)))},a=r.matchCanvasSize,r.matchCanvasSize=function(e){a.call(r,e),r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth,r.canvasHeight),r.pickingFrameBuffer.needsDraw=!0},r.findNearestElements=function(e,t,n,i){return function(e,t,n){var r,i,a,o=function(e,t,n){var r=d4(e),i=r.pan,a=r.zoom,o=t6((f=t*a+i.x,p=n*a+i.y,[f,p=Math.round(e.canvasHeight-p)]),2),s=o[0],l=o[1],c=e.data.contexts[e.WEBGL];c.bindFramebuffer(c.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(c.viewport(0,0,c.canvas.width,c.canvas.height),hw(e,null,hf),e.pickingFrameBuffer.needsDraw=!1);var u=new Uint8Array(144);c.readPixels(s-3,l-3,6,6,c.RGBA,c.UNSIGNED_BYTE,u),c.bindFramebuffer(c.FRAMEBUFFER,null);for(var d=new Set,h=0;h<36;h++){var f,p,g,v=(g=u.slice(4*h,4*h+4))[0]+(g[1]<<8)+(g[2]<<16)+(g[3]<<24)-1;v>=0&&d.add(v)}return d}(e,t,n),s=e.getCachedZSortedEles(),l=t3(o);try{for(l.s();!(a=l.n()).done;){var c=s[a.value];if(!r&&c.isNode()&&(r=c),!i&&c.isEdge()&&(i=c),r&&i)break}}catch(e){l.e(e)}finally{l.f()}return[r,i].filter(Boolean)}(r,e,t)},o=r.invalidateCachedZSortedEles,r.invalidateCachedZSortedEles=function(){o.call(r),r.pickingFrameBuffer.needsDraw=!0},s=r.notify,r.notify=function(e,t){s.call(r,e,t),"viewport"===e||"bounds"===e?r.pickingFrameBuffer.needsDraw=!0:"background"===e&&r.drawing.invalidate(t,{type:"node-body"})}};var hv=function(e,t){return function(n){var r=e(n),i=hg(n,t);return i.length>1?i.map(function(e,t){return"".concat(r,"_").concat(t)}):r}},hx=function(e,t){return function(n,r){var i=e(n);if("string"==typeof r){var a=r.indexOf("_");if(a>0){var o=Number(r.substring(a+1)),s=hg(n,t),l=i.h/s.length,c=l*o,u=i.y1+c;return{x1:i.x1,w:i.w,y1:u,h:l,yOffset:c}}}return i}};function hy(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=d4(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function hb(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,"node-underlay"),r.drawNode(n,t,"node-body"),r.drawTexture(n,t,"label"),r.drawNode(n,t,"node-overlay")):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,"source"),r.drawEdgeArrow(n,t,"target"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"edge-source-label"),r.drawTexture(n,t,"edge-target-label"))}function hw(e,t,n){e.webglDebug&&(G=performance.now());var r=e.drawing,i=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&e.drawSelectionRectangle(t,function(t){return hy(e,t)}),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var a,o,s,l,c,u,d,h,f,p,g,v,x,y,b,w,j,N,k,C,E,_,S,T,A,O,M,P,D,L,I,R=e.data.contexts[e.WEBGL];n.screen?(R.clearColor(0,0,0,0),R.enable(R.BLEND),R.blendFunc(R.ONE,R.ONE_MINUS_SRC_ALPHA)):R.disable(R.BLEND),R.clear(R.COLOR_BUFFER_BIT|R.DEPTH_BUFFER_BIT),R.viewport(0,0,R.canvas.width,R.canvas.height);var B=(a=e.canvasWidth,o=e.canvasHeight,l=(s=d4(e)).pan,c=s.zoom,ha(u=hr(),u,[l.x,l.y]),hs(u,u,[c,c]),h=d=hr(),h[0]=2/a,h[1]=0,h[2]=0,h[3]=0,h[4]=-2/o,h[5]=0,h[6]=-1,h[7]=1,h[8]=1,p=f=hr(),g=d[0],v=d[1],x=d[2],y=d[3],b=d[4],w=d[5],j=d[6],N=d[7],k=d[8],C=u[0],E=u[1],_=u[2],S=u[3],T=u[4],A=u[5],O=u[6],M=u[7],P=u[8],p[0]=C*g+E*y+_*j,p[1]=C*v+E*b+_*N,p[2]=C*x+E*w+_*k,p[3]=S*g+T*y+A*j,p[4]=S*v+T*b+A*N,p[5]=S*x+T*w+A*k,p[6]=O*g+M*y+P*j,p[7]=O*v+M*b+P*N,p[8]=O*x+M*w+P*k,f),z=e.getCachedZSortedEles();if(i=z.length,r.startFrame(B,n),n.screen){for(var F=0;F<z.nondrag.length;F++)hb(e,F,z.nondrag[F]);for(var V=0;V<z.drag.length;V++)hb(e,V,z.drag[V])}else if(n.picking)for(var U=0;U<z.length;U++)hb(e,U,z[U]);r.endFrame(),n.screen&&e.webglDebugShowAtlases&&((D=e.data.contexts[e.NODE]).save(),hy(e,D),D.strokeStyle="rgba(0, 0, 0, 0.3)",D.beginPath(),D.moveTo(-1e3,0),D.lineTo(1e3,0),D.stroke(),D.beginPath(),D.moveTo(0,-1e3),D.lineTo(0,1e3),D.stroke(),D.restore(),I=0,(L=function(t,n,r){for(var i=t.atlasManager.getAtlasCollection(n),a=e.data.contexts[e.NODE],o=i.atlases,s=0;s<o.length;s++){var l=o[s].canvas;if(l){var c=l.width,u=l.height,d=c*s,h=l.height*r;a.save(),a.scale(.4,.4),a.drawImage(l,d,h),a.strokeStyle="black",a.rect(d,h,c,u),a.stroke(),a.restore()}}})(e.drawing,"node",I++),L(e.drawing,"label",I++)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var H=Math.ceil(performance.now()-G),W=r.getDebugInfo(),Y=["".concat(i," elements"),"".concat(W.totalInstances," instances"),"".concat(W.batchCount," batches"),"".concat(W.totalAtlases," atlases"),"".concat(W.wrappedCount," wrapped textures"),"".concat(W.simpleCount," simple shapes")].join(", ");console.log("WebGL (".concat(n.name,") - frame time ").concat(H,"ms")),console.log("Totals:"),console.log(" ".concat(Y)),console.log("Texture Atlases Used:");var G,$,X=t3(W.atlasInfo);try{for(X.s();!($=X.n()).done;){var q=$.value;console.log(" ".concat(q.type,": ").concat(q.keyCount," keys, ").concat(q.atlasCount," atlases"))}}catch(e){X.e(e)}finally{X.f()}console.log("")}e.data.gc&&(console.log("Garbage Collect!"),e.data.gc=!1,r.gc())}var hj={};hj.drawPolygonPath=function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l<a.length/2;l++)e.lineTo(t+o*a[2*l],n+s*a[2*l+1]);e.closePath()},hj.drawRoundPolygonPath=function(e,t,n,r,i,a,o){o.forEach(function(t){return dn(e,t)}),e.closePath()},hj.drawRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,l="auto"===a?i_(r,i):Math.min(a,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,l),e.arcTo(t+o,n+s,t,n+s,l),e.arcTo(t-o,n+s,t-o,n,l),e.arcTo(t-o,n-s,t,n-s,l),e.lineTo(t,n-s),e.closePath()},hj.drawBottomRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,l="auto"===a?i_(r,i):a;e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.lineTo(t+o,n-s),e.lineTo(t+o,n),e.arcTo(t+o,n+s,t,n+s,l),e.arcTo(t-o,n+s,t-o,n,l),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},hj.drawCutRectanglePath=function(e,t,n,r,i,a,o){var s=r/2,l=i/2,c="auto"===o?iT():o;e.beginPath&&e.beginPath(),e.moveTo(t-s+c,n-l),e.lineTo(t+s-c,n-l),e.lineTo(t+s,n-l+c),e.lineTo(t+s,n+l-c),e.lineTo(t+s-c,n+l),e.lineTo(t-s+c,n+l),e.lineTo(t-s,n+l-c),e.lineTo(t-s,n-l+c),e.closePath()},hj.drawBarrelPath=function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,l=t+a,c=n-o,u=n+o,d=iA(r,i),h=d.widthOffset,f=d.heightOffset,p=d.ctrlPtOffsetPct*h;e.beginPath&&e.beginPath(),e.moveTo(s,c+f),e.lineTo(s,u-f),e.quadraticCurveTo(s+p,u,s+h,u),e.lineTo(l-h,u),e.quadraticCurveTo(l-p,u,l,u-f),e.lineTo(l,c+f),e.quadraticCurveTo(l-p,c,l-h,c),e.lineTo(s+h,c),e.quadraticCurveTo(s+p,c,s,c+f),e.closePath()};for(var hN={},hk={},hC=Math.PI/40,hE=0*Math.PI;hE<2*Math.PI;hE+=hC)hN[hE]=Math.sin(hE),hk[hE]=Math.cos(hE);hj.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,l=i/2,c=0*Math.PI;c<2*Math.PI;c+=hC)a=t-s*hN[c]*0+s*hk[c]*1,o=n+l*hk[c]*0+l*hN[c]*1,0===c?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var h_={};function hS(e){var t=e.indexOf(",");return e.substr(t+1)}function hT(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new aI(function(r,i){try{t.toBlob(function(e){null!=e?r(e):i(Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(e){i(e)}});case"blob":return function(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}(hS(r()),n);case"base64":return hS(r());default:return r()}}h_.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},h_.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=nh(e.maxWidth)||nh(e.maxHeight),s=this.getPixelRatio(),l=1;if(void 0!==e.scale)i*=e.scale,a*=e.scale,l=e.scale;else if(o){var c=1/0,u=1/0;nh(e.maxWidth)&&(c=l*e.maxWidth/i),nh(e.maxHeight)&&(u=l*e.maxHeight/a),i*=l=Math.min(c,u),a*=l}o||(i*=s,a*=s,l*=s);var d=document.createElement("canvas");d.width=i,d.height=a,d.style.width=i+"px",d.style.height=a+"px";var h=d.getContext("2d");if(i>0&&a>0){h.clearRect(0,0,i,a),h.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,f),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var p=t.pan(),g={x:p.x*l,y:p.y*l};l*=t.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,f),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,i,a),h.fill())}return d},h_.png=function(e){return hT(e,this.bufferCanvasImage(e),"image/png")},h_.jpg=function(e){return hT(e,this.bufferCanvasImage(e),"image/jpeg")};var hA={};hA.nodeShapeImpl=function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}};var hO=hM.prototype;function hM(e){var t=this,n=t.cy.window().document;e.webgl&&(hO.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:Array(hO.CANVAS_LAYERS),contexts:Array(hO.CANVAS_LAYERS),canvasNeedsRedraw:Array(hO.CANVAS_LAYERS),bufferCanvases:Array(hO.BUFFER_COUNT),bufferContexts:Array(hO.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var a=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=i,a.position="relative",a.zIndex="0",a.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=i;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};nn&&nn.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;l<hO.CANVAS_LAYERS;l++){var c=t.data.canvases[l]=n.createElement("canvas"),u=hO.CANVAS_TYPES[l];t.data.contexts[l]=c.getContext(u),t.data.contexts[l]||ro("Could not create canvas of type "+u),Object.keys(s).forEach(function(e){c.style[e]=s[e]}),c.style.position="absolute",c.setAttribute("data-id","layer"+l),c.style.zIndex=String(hO.CANVAS_LAYERS-l),t.data.canvasContainer.appendChild(c),t.data.canvasNeedsRedraw[l]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[hO.NODE].setAttribute("data-id","layer"+hO.NODE+"-node"),t.data.canvases[hO.SELECT_BOX].setAttribute("data-id","layer"+hO.SELECT_BOX+"-selectbox"),t.data.canvases[hO.DRAG].setAttribute("data-id","layer"+hO.DRAG+"-drag"),t.data.canvases[hO.WEBGL]&&t.data.canvases[hO.WEBGL].setAttribute("data-id","layer"+hO.WEBGL+"-webgl");for(var l=0;l<hO.BUFFER_COUNT;l++)t.data.bufferCanvases[l]=n.createElement("canvas"),t.data.bufferContexts[l]=t.data.bufferCanvases[l].getContext("2d"),t.data.bufferCanvases[l].style.position="absolute",t.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),t.data.bufferCanvases[l].style.zIndex=String(-l-1),t.data.bufferCanvases[l].style.visibility="hidden";t.pathsEnabled=!0;var d=rJ(),h=function(e){return{x:-e.w/2,y:-e.h/2}},f=function(e){return e[0]._private.nodeKey},p=function(e){return e[0]._private.labelStyleKey},g=function(e){return e[0]._private.sourceLabelStyleKey},v=function(e){return e[0]._private.targetLabelStyleKey},x=function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},y=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"main",a)},b=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"source",a)},w=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"target",a)},j=function(e){return e.boundingBox(),e[0]._private.bodyBounds},N=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||d},k=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||d},C=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||d},E=function(e,t){return t},_=function(e){var t;return{x:((t=j(e)).x1+t.x2)/2,y:(t.y1+t.y2)/2}},S=function(e,t,n){var r=e?e+"-":"";return{x:t.x+n.pstyle(r+"text-margin-x").pfValue,y:t.y+n.pstyle(r+"text-margin-y").pfValue}},T=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},A=function(e){return S("",T(e,"labelX","labelY"),e)},O=function(e){return S("source",T(e,"sourceLabelX","sourceLabelY"),e)},M=function(e){return S("target",T(e,"targetLabelX","targetLabelY"),e)},P=function(e){return h(j(e))},D=function(e){return h(k(e))},L=function(e){return h(C(e))},I=function(e){var t=N(e),n=h(N(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":n.x=-t.w-(t.leftPad||0);break;case"right":n.x=-(t.rightPad||0)}switch(e.pstyle("text-valign").value){case"top":n.y=-t.h-(t.topPad||0);break;case"bottom":n.y=-(t.botPad||0)}}return n},R=t.data.eleTxrCache=new dO(t,{getKey:f,doesEleInvalidateKey:function(e){var t=e[0]._private;return t.oldBackgroundTimestamp!==t.backgroundTimestamp},drawElement:x,getBoundingBox:j,getRotationPoint:_,getRotationOffset:P,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),B=t.data.lblTxrCache=new dO(t,{getKey:p,drawElement:y,getBoundingBox:N,getRotationPoint:A,getRotationOffset:I,isVisible:E}),z=t.data.slbTxrCache=new dO(t,{getKey:g,drawElement:b,getBoundingBox:k,getRotationPoint:O,getRotationOffset:D,isVisible:E}),F=t.data.tlbTxrCache=new dO(t,{getKey:v,drawElement:w,getBoundingBox:C,getRotationPoint:M,getRotationOffset:L,isVisible:E}),V=t.data.lyrTxrCache=new dP(t);t.onUpdateEleCalcs(function(e,t){R.invalidateElements(t),B.invalidateElements(t),z.invalidateElements(t),F.invalidateElements(t),V.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}});var U=function(e){for(var t=0;t<e.length;t++)V.enqueueElementRefinement(e[t].ele)};R.onDequeue(U),B.onDequeue(U),z.onDequeue(U),F.onDequeue(U),e.webgl&&t.initWebgl(e,{getStyleKey:f,getLabelKey:p,getSourceLabelKey:g,getTargetLabelKey:v,drawElement:x,drawLabel:y,drawSourceLabel:b,drawTargetLabel:w,getElementBox:j,getLabelBox:N,getSourceLabelBox:k,getTargetLabelBox:C,getElementRotationPoint:_,getElementRotationOffset:P,getLabelRotationPoint:A,getSourceLabelRotationPoint:O,getTargetLabelRotationPoint:M,getLabelRotationOffset:I,getSourceLabelRotationOffset:D,getTargetLabelRotationOffset:L})}hO.CANVAS_LAYERS=3,hO.SELECT_BOX=0,hO.DRAG=1,hO.NODE=2,hO.WEBGL=3,hO.CANVAS_TYPES=["2d","2d","2d","webgl2"],hO.BUFFER_COUNT=3,hO.TEXTURE_BUFFER=0,hO.MOTIONBLUR_BUFFER_NODE=1,hO.MOTIONBLUR_BUFFER_DRAG=2,hO.redrawHint=function(e,t){switch(e){case"eles":this.data.canvasNeedsRedraw[hO.NODE]=t;break;case"drag":this.data.canvasNeedsRedraw[hO.DRAG]=t;break;case"select":this.data.canvasNeedsRedraw[hO.SELECT_BOX]=t;break;case"gc":this.data.gc=!0}};var hP="u">typeof Path2D;hO.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},hO.usePaths=function(){return hP&&this.pathsEnabled},hO.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},hO.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},hO.makeOffscreenCanvas=function(e,t){var n;return("u"<typeof OffscreenCanvas?"undefined":t9(OffscreenCanvas))!=="undefined"?n=new OffscreenCanvas(e,t):((n=this.cy.window().document.createElement("canvas")).width=e,n.height=t),n},[dI,dU,dq,dZ,dQ,d0,d2,hm,hj,h_,hA].forEach(function(e){nP(hO,e)});var hD=[{name:"null",impl:lk},{name:"base",impl:dk},{name:"canvas",impl:hM}],hL={},hI={};function hR(e,t,n){var r=n,i=function(n){rl("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if("core"===e)if(s$.prototype[t])return i(t);else s$.prototype[t]=n;else if("collection"===e)if(sg.prototype[t])return i(t);else sg.prototype[t]=n;else if("layout"===e){for(var a=function(e){this.options=e,n.call(this,e),nd(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],l=0;l<s.length;l++){var c=s[l];o[c]=o[c]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var u=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return u?u.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var d=function(e){return e._private.cy},h={addEventFields:function(e,t){t.layout=e,t.cy=d(e),t.target=e},bubble:function(){return!0},parent:function(e){return d(e)}};nP(o,{createEmitter:function(){return this._private.emitter=new oK(h,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),aJ.eventAliasesOn(o),r=a}else if("renderer"===e&&"null"!==t&&"base"!==t){var f=hB("renderer","base"),p=f.prototype,g=n.prototype,v=function(){f.apply(this,arguments),n.apply(this,arguments)},x=v.prototype;for(var y in p){var b=p[y];if(null!=g[y])return i(y);x[y]=b}for(var w in g)x[w]=g[w];p.clientFunctions.forEach(function(e){x[e]=x[e]||function(){ro("Renderer does not implement `renderer."+e+"()` on its prototype")}}),r=v}else if("__proto__"===e||"constructor"===e||"prototype"===e)return ro(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return nz({map:hL,keys:[e,t],value:r})}function hB(e,t){return nF({map:hL,keys:[e,t]})}function hz(e,t,n,r,i){return nz({map:hI,keys:[e,t,n,r],value:i})}function hF(e,t,n,r){return nF({map:hI,keys:[e,t,n,r]})}var hV=function(){return 2==arguments.length?hB.apply(null,arguments):3==arguments.length?hR.apply(null,arguments):4==arguments.length?hF.apply(null,arguments):5==arguments.length?hz.apply(null,arguments):void ro("Invalid extension access syntax")};s$.prototype.extension=hV,[{type:"layout",extensions:lN},{type:"renderer",extensions:hD}].forEach(function(e){e.extensions.forEach(function(t){hR(e.type,t.name,t.impl)})});var hU=function(){if(!(this instanceof hU))return new hU;this.length=0},hH=hU.prototype;hH.instanceString=function(){return"stylesheet"},hH.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},hH.css=function(e,t){var n=this.length-1;if(nl(e))this[n].properties.push({name:e,value:t});else if(nd(e))for(var r=Object.keys(e),i=0;i<r.length;i++){var a=r[i],o=e[a];if(null!=o){var s=sH.properties[a]||sH.properties[nN(a)];if(null!=s){var l=s.name;this[n].properties.push({name:l,value:o})}}}return this},hH.style=hH.css,hH.generateStyle=function(e){var t=new sH(e);return this.appendToStyle(t)},hH.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var hW=function(e){return(void 0===e&&(e={}),nd(e))?new s$(e):nl(e)?hV.apply(hV,arguments):void 0};hW.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(hW),e.apply(null,t),this},hW.warnings=function(e){return rs(e)},hW.version="3.33.1",hW.stylesheet=hW.Stylesheet=hU;var hY=e.i(45108);function hG({data:e,height:t=600,showLabels:n=!0,onNodeClick:r,onNodeHover:i,nodeColorFn:a,nodeSizeFn:o,linkColorFn:s,linkWidthFn:l,maxNodes:c}){let u,[d,h]=(0,em.useState)(null),f=(0,em.useRef)(null),p=(0,em.useRef)(!1),g=(0,em.useRef)(""),[v,x]=(0,em.useState)(null),[y,b]=(0,em.useState)(null),[w,j]=(0,em.useState)(null),[N,k]=(0,em.useState)(!0),[C,E]=(0,em.useState)(!1),[_,S]=(0,em.useState)(!1),T=function(){let[e,t]=(0,em.useState)(!1);return(0,em.useEffect)(()=>{let e=()=>{t(document.documentElement.classList.contains("dark"))};e();let n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>n.disconnect()},[]),e}(),A=(0,em.useRef)(r),O=(0,em.useRef)(i),M=(0,em.useRef)(e),P=(0,em.useRef)(a),D=(0,em.useRef)(s),L=(0,em.useRef)(_);A.current=r,O.current=i,M.current=e,P.current=a,D.current=s,L.current=_;let I=(0,em.useMemo)(()=>{let t=[...e.nodes];c&&t.length>c&&(t=t.slice(0,c));let n=new Set(t.map(e=>e.id));return{nodes:t,links:e.links.filter(e=>n.has(e.source)&&n.has(e.target))}},[e,c]);(0,em.useEffect)(()=>(E(!0),()=>E(!1)),[]);let R=(0,em.useMemo)(()=>{let e=new Map;return I.links.forEach(t=>{e.set(t.source,(e.get(t.source)||0)+1),e.set(t.target,(e.get(t.target)||0)+1)}),[...I.nodes.map(t=>{let n=e.get(t.id)||0,r=o?o(t):Math.max(16,Math.min(40,16+4*n));return{data:{id:t.id,label:t.label||t.id.substring(0,8),color:a?a(t):t.color||"#0074d9",size:t.size||r,originalNode:t,connections:n}}}),...I.links.map((e,t)=>({data:{id:`edge-${t}`,source:e.source,target:e.target,color:s?s(e):e.color||"#0074d9",width:l?l(e):e.width||1,type:e.type,entity:e.entity,weight:e.weight,originalLink:e}}))]},[I,a,o,s,l]),B=(0,em.useMemo)(()=>JSON.stringify({nodeCount:I.nodes.length,linkCount:I.links.length,nodeIds:I.nodes.map(e=>e.id).sort().join(","),showLabels:n,isDarkMode:T,maxNodes:c}),[I.nodes,I.links,n,T,c]);return(0,em.useEffect)(()=>{let e=!1,t=setTimeout(()=>{if(e||!C||!d||p.current)return;if(g.current===B)return void console.log("Data signature unchanged, skipping graph initialization");let t=d.getBoundingClientRect();if(0===t.width||0===t.height){console.warn("Container has no dimensions, skipping cytoscape initialization"),k(!1);return}if(0===R.length)return void k(!1);if(f.current&&!f.current.destroyed()){let e=f.current.nodes().length,t=f.current.edges().length,n=R.filter(e=>!e.data.source).length,r=R.filter(e=>e.data.source).length;if(e===n&&t===r){console.log("Graph already initialized with same data, skipping reinitialization"),k(!1);return}console.log("Data changed, destroying existing graph"),f.current.destroy(),f.current=null}k(!0),p.current=!0;let r=T?"#ffffff":"#1f2937",i=T?"rgba(0,0,0,0.8)":"rgba(255,255,255,0.9)";try{console.log("Initializing cytoscape with container:",d),console.log("Elements count:",R.length),console.log("Sample elements:",R.slice(0,2));let e=hW({container:d,elements:[],selectionType:"single",userZoomingEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,layout:{name:"preset"},style:[{selector:"node",style:{"background-color":"data(color)",width:"data(size)",height:"data(size)",label:n?"data(label)":"",color:r,"text-valign":"bottom","text-halign":"center","font-size":"8px","font-weight":500,"text-margin-y":3,"text-wrap":"wrap","text-max-width":"80px","text-background-color":i,"text-background-opacity":.9,"text-background-padding":"2px","text-background-shape":"roundrectangle","border-width":1,"border-color":T?"#ffffff20":"#00000020","border-opacity":.3}},{selector:"node:selected",style:{"border-width":3,"border-color":"#0074d9","border-opacity":1}},{selector:"edge",style:{width:"data(width)","line-color":"data(color)","target-arrow-color":"data(color)","target-arrow-shape":"triangle","target-arrow-size":6,"curve-style":"bezier",opacity:T?.6:.7}},{selector:".dimmed",style:{opacity:.2}},{selector:".focused",style:{"border-width":4,"border-color":"#ff6b35","border-opacity":1,"z-index":999}},{selector:".connected",style:{"border-width":2,"border-color":"#0074d9","border-opacity":.8,opacity:1}},{selector:"edge.connection",style:{width:2,opacity:1,"z-index":100}},{selector:"edge.connection:hover",style:{width:3,opacity:1,"z-index":200}},{selector:"edge:selected",style:{"overlay-opacity":0,"overlay-color":"transparent","overlay-padding":0}}]});f.current=e,console.log("Cytoscape initialized successfully"),R.length>0&&(console.log("Adding elements to cytoscape"),e.add(R),e.layout({name:"fcose",quality:"default",randomize:!1,animate:!0,animationDuration:1500,nodeSeparation:200,idealEdgeLength:()=>250,edgeElasticity:()=>.05,nestingFactor:.05,gravity:.05,numIter:2500,nodeOverlap:30,avoidOverlap:!0,nodeDimensionsIncludeLabels:!0,padding:20,boundingBox:void 0,tile:!0,tilingPaddingVertical:30,tilingPaddingHorizontal:30,uniformNodeDimensions:!1,packComponents:!1}).run(),e.fit()),e.on("tap","node",e=>{let t=e.target.data("originalNode");A.current&&t&&A.current(t)}),e.on("mouseover","node",e=>{let t=e.target.data("originalNode");x(t),O.current&&t&&O.current(t),d&&(d.style.cursor="pointer")}),e.on("mouseout","node",()=>{x(null),O.current&&O.current(null),d&&(d.style.cursor="default")}),e.on("mouseover","edge",e=>{let t=e.target;if(!L.current||!t.hasClass("connection"))return;let n=t.data("originalLink");if(n){b(n);let e=t.renderedMidpoint();j({x:e.x,y:e.y})}}),e.on("mouseout","edge",e=>{let t=e.target;L.current&&t.hasClass("connection")&&(b(null),j(null))}),e.on("select","edge",e=>{e.target.unselect()}),e.on("dblclick","node",t=>{let n=t.target,r=n.id();console.log("Double-clicked node:",r),S(!0),e.elements().removeClass("dimmed focused connected connection");let i=n.neighborhood(),a=i.nodes(),o=i.edges();e.elements().addClass("dimmed"),n.removeClass("dimmed").addClass("focused"),a.removeClass("dimmed").addClass("connected"),o.removeClass("dimmed").addClass("connection");let s=n.union(i);e.animate({fit:{eles:s,padding:100},center:{eles:n}},{duration:800,easing:"ease-out-cubic"})}),e.on("tap",t=>{t.target===e&&(console.log("Clicked background - resetting focus"),S(!1),e.elements().removeClass("dimmed focused connected connection"),e.animate({fit:{eles:e.elements(),padding:50}},{duration:600,easing:"ease-out"}))}),k(!1),p.current=!1,g.current=B}catch(e){console.error("Error initializing cytoscape:",e),k(!1),p.current=!1}},100);return()=>{e=!0,clearTimeout(t),p.current=!1,f.current&&(f.current.destroy(),f.current=null)}},[B,C,d]),(0,em.useEffect)(()=>{let e=()=>{f.current&&(f.current.resize(),f.current.fit(void 0,80))};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,ep.jsxs)("div",{className:"relative w-full rounded-lg overflow-hidden border border-border",style:{height:t},children:[N&&(0,ep.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-background z-10",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading graph..."})]})}),C&&(0,ep.jsx)("div",{ref:h,className:"w-full h-full",style:{backgroundImage:T?"radial-gradient(circle at 1px 1px, rgba(255,255,255,0.08) 1px, transparent 0)":"radial-gradient(circle at 1px 1px, rgba(0,0,0,0.06) 1px, transparent 0)",backgroundSize:"20px 20px",backgroundColor:T?"#0f1419":"#f8fafc"}}),!N&&0===I.nodes.length&&(0,ep.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,ep.jsx)("div",{className:"text-center",children:(0,ep.jsx)("p",{className:"text-muted-foreground",children:"No memories to display"})})}),y&&w&&(0,ep.jsx)("div",{className:"absolute z-30 pointer-events-none",style:{left:w.x,top:w.y,transform:"translate(-50%, -100%) translateY(-8px)"},children:(0,ep.jsxs)("div",{className:`px-3 py-2 rounded-lg shadow-lg text-sm ${T?"bg-gray-800 text-white":"bg-white text-gray-900 border border-gray-200"}`,children:[(0,ep.jsx)("div",{className:"font-medium capitalize mb-1",children:["causes","caused_by","enables","prevents"].includes(u=y.type||"semantic")?`Causal (${u.replace("_"," ")})`:`${u} link`}),y.entity&&(0,ep.jsxs)("div",{className:"text-xs opacity-80",children:["Entity: ",(0,ep.jsx)("span",{className:"font-medium",children:y.entity})]}),void 0!==y.weight&&(0,ep.jsxs)("div",{className:"text-xs opacity-80",children:["Weight: ",(0,ep.jsx)("span",{className:"font-medium",children:y.weight.toFixed(3)})]})]})}),(0,ep.jsx)("div",{className:"absolute bottom-4 right-4 text-xs text-muted-foreground/60 z-20",children:"Drag to pan • Scroll to zoom • Double-click node to focus • Click background to reset"})]})}function h$(e){return{nodes:(e.nodes||[]).map(t=>{let n=e.table_rows?.find(e=>e.id===t.data.id),r=t.data.label;return!r&&n?.text&&(r=n.text.length>40?n.text.substring(0,40)+"...":n.text),r||(r=t.data.id.substring(0,8)),{id:t.data.id,label:r,color:t.data.color,metadata:n}}),links:(e.edges||[]).map(e=>({source:e.data.source,target:e.data.target,color:e.data.color,type:e.data.linkType||("dashed"===e.data.lineStyle?"temporal":"semantic"),entity:e.data.entityName,weight:e.data.weight??e.data.similarity}))}}hW.use(hY.default);let hX=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ON","CS","ON","CS","ON","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ON","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","ON","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],hq=["AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","CS","AL","ON","ON","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","ON","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL"],hK=/[ \t\n\r\f]+/g,hZ=/[\t\n\r\f]| {2,}|^ | $/,hQ=null,hJ=/\p{Script=Arabic}/u,h0=/\p{M}/u,h1=/\p{Nd}/u;function h2(e){return hJ.test(e)}function h5(e){for(let t of e){let e=t.codePointAt(0);if(e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=196608&&e<=201551||e>=63744&&e<=64255||e>=194560&&e<=195103||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519)return!0}return!1}let h3=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),h4=new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),h6=new Set(["'","’"]),h8=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),h7=new Set([":",".","،","؛"]),h9=new Set(["၏"]),fe=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function ft(e){let t=!1;for(let n of e)if(!("\\"===n||h0.test(n))){if(h4.has(n)||h8.has(n)||h6.has(n)){t=!0;continue}return!1}return t}function fn(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(fe.has(n))return!0;if(!h8.has(n))break}return!1}function fr(e){return"space"===e||"preserved-space"===e||"zero-width-break"===e||"hard-break"===e}let fi=/^[A-Za-z][A-Za-z0-9+.-]*:$/,fa=new Set([":","-","/","×",",",".","+","–","—"]),fo=/^[A-Za-z0-9_]+[,:;]*$/,fs=/[,:;]+$/;function fl(e){for(let t of e)if(h1.test(t))return!0;return!1}function fc(e){if(0===e.length)return!1;for(let t of e)if(!(h1.test(t)||fa.has(t)))return!1;return!0}let fu=null,fd=new Map,fh=null,ff=/\p{Emoji_Presentation}/u,fp=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u,fm=null,fg=new Map;function fv(){if(null!==fu)return fu;if("u">typeof OffscreenCanvas)return fu=new OffscreenCanvas(1,1).getContext("2d");if("u">typeof document)return fu=document.createElement("canvas").getContext("2d");throw Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function fx(e,t){let n=t.get(e);return void 0===n&&(n={width:fv().measureText(e).width,containsCJK:h5(e)},t.set(e,n)),n}function fy(){if(null!==fh)return fh;if("u"<typeof navigator)return fh={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1};let e=navigator.userAgent,t="Apple Computer, Inc."===navigator.vendor&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/");return fh={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/"),preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t}}function fb(){return null===fm&&(fm=new Intl.Segmenter(void 0,{granularity:"grapheme"})),fm}function fw(e,t,n){return 0===n?t.width:t.width-(void 0===t.emojiCount&&(t.emojiCount=function(e){let t=0;for(let r of fb().segment(e)){var n;n=r.segment,(ff.test(n)||n.includes("️"))&&t++}return t}(e)),t.emojiCount*n)}function fj(e){return"space"===e||"preserved-space"===e||"tab"===e||"zero-width-break"===e||"soft-hyphen"===e}function fN(e,t,n,r){return r&&null!==t?t[n]-(n>0?t[n-1]:0):e[n]}let fk=null,fC=new WeakMap;function fE(){return null===fk&&(fk=new Intl.Segmenter(void 0,{granularity:"grapheme"})),fk}function f_(e,n,r,i){return function(e,t,n){var r;let i=fE(),a=fy(),{cache:o,emojiCorrection:s}=function(e,t){let n,r;fv().font=e;let i=((n=fd.get(e))||(n=new Map,fd.set(e,n)),n),a=(r=e.match(/(\d+(?:\.\d+)?)\s*px/))?parseFloat(r[1]):16,o=t?function(e,t){let n=fg.get(e);if(void 0!==n)return n;let r=fv();r.font=e;let i=r.measureText("😀").width;if(n=0,i>t+.5&&"u">typeof document&&null!==document.body){let t=document.createElement("span");t.style.font=e,t.style.display="inline-block",t.style.visibility="hidden",t.style.position="absolute",t.textContent="😀",document.body.appendChild(t);let r=t.getBoundingClientRect().width;document.body.removeChild(t),i-r>.5&&(n=i-r)}return fg.set(e,n),n}(e,a):0;return{cache:i,fontSize:a,emojiCorrection:o}}(t,(r=e.normalized,fp.test(r))),l=fw("-",fx("-",o),s),c=8*fw(" ",fx(" ",o),s);if(0===e.len)return n?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableWidths:[],breakablePrefixWidths:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableWidths:[],breakablePrefixWidths:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};let u=[],d=[],h=[],f=[],p=e.chunks.length<=1,g=n?[]:null,v=[],x=[],y=n?[]:null,b=Array.from({length:e.len}),w=Array.from({length:e.len});function j(e,t,n,r,i,a,o,s){"text"!==i&&"space"!==i&&"zero-width-break"!==i&&(p=!1),u.push(t),d.push(n),h.push(r),f.push(i),g?.push(a),v.push(o),x.push(s),null!==y&&y.push(e)}for(let t=0;t<e.len;t++){b[t]=u.length;let n=e.texts[t],r=e.isWordLike[t],c=e.kinds[t],d=e.starts[t];if("soft-hyphen"===c){j(n,0,l,l,c,d,null,null),w[t]=u.length;continue}if("hard-break"===c||"tab"===c){j(n,0,0,0,c,d,null,null),w[t]=u.length;continue}let h=fx(n,o);if("text"===c&&h.containsCJK){let e="",r=0;for(let t of i.segment(n)){let n=t.segment;if(0===e.length){e=n,r=t.index;continue}if(h4.has(e)||h3.has(n)||h8.has(n)||a.carryCJKAfterClosingQuote&&h5(n)&&fn(e)){e+=n;continue}let i=fx(e,o),l=fw(e,i,s);j(e,l,l,l,"text",d+r,null,null),e=n,r=t.index}if(e.length>0){let t=fx(e,o),n=fw(e,t,s);j(e,n,n,n,"text",d+r,null,null)}w[t]=u.length;continue}let f=fw(n,h,s),p="space"===c||"preserved-space"===c||"zero-width-break"===c?0:f,g="space"===c||"zero-width-break"===c?0:f;if(r&&n.length>1){let e=function(e,t,n,r){if(void 0!==t.graphemeWidths)return t.graphemeWidths;let i=[];for(let t of fb().segment(e)){let e=fx(t.segment,n);i.push(fw(t.segment,e,r))}return t.graphemeWidths=i.length>1?i:null,t.graphemeWidths}(n,h,o,s),t=a.preferPrefixWidthsForBreakableRuns?function(e,t,n,r){if(void 0!==t.graphemePrefixWidths)return t.graphemePrefixWidths;let i=[],a=fb(),o="";for(let t of a.segment(e)){let e=fx(o+=t.segment,n);i.push(fw(o,e,r))}return t.graphemePrefixWidths=i.length>1?i:null,t.graphemePrefixWidths}(n,h,o,s):null;j(n,f,p,g,c,d,e,t)}else j(n,f,p,g,c,d,null,null);w[t]=u.length}let N=function(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a.startSegmentIndex<t.length?t[a.startSegmentIndex]:n[n.length-1]??0,s=a.endSegmentIndex<t.length?t[a.endSegmentIndex]:n[n.length-1]??0,l=a.consumedEndSegmentIndex<t.length?t[a.consumedEndSegmentIndex]:n[n.length-1]??0;r.push({startSegmentIndex:o,endSegmentIndex:s,consumedEndSegmentIndex:l})}return r}(e.chunks,b,w),k=null===g?null:function(e,t){let n=function(e){let t=e.length;if(0===t)return null;let n=Array(t),r=0;for(let a=0;a<t;a++){var i;let t=(i=e.charCodeAt(a))<=255?hX[i]:1424<=i&&i<=1524?"R":1536<=i&&i<=1791?hq[255&i]:1792<=i&&i<=2220?"AL":"L";("R"===t||"AL"===t||"AN"===t)&&r++,n[a]=t}if(0===r)return null;let a=t/r<.3?0:1,o=new Int8Array(t);for(let e=0;e<t;e++)o[e]=a;let s=1&a?"R":"L",l=s;for(let e=0;e<t;e++)"NSM"===n[e]?n[e]=l:l=n[e];l=s;for(let e=0;e<t;e++){let t=n[e];"EN"===t?n[e]="AL"===l?"AN":"EN":("R"===t||"L"===t||"AL"===t)&&(l=t)}for(let e=0;e<t;e++)"AL"===n[e]&&(n[e]="R");for(let e=1;e<t-1;e++)"ES"===n[e]&&"EN"===n[e-1]&&"EN"===n[e+1]&&(n[e]="EN"),"CS"===n[e]&&("EN"===n[e-1]||"AN"===n[e-1])&&n[e+1]===n[e-1]&&(n[e]=n[e-1]);for(let e=0;e<t;e++){let r;if("EN"===n[e]){for(r=e-1;r>=0&&"ET"===n[r];r--)n[r]="EN";for(r=e+1;r<t&&"ET"===n[r];r++)n[r]="EN"}}for(let e=0;e<t;e++){let t=n[e];("WS"===t||"ES"===t||"ET"===t||"CS"===t)&&(n[e]="ON")}l=s;for(let e=0;e<t;e++){let t=n[e];"EN"===t?n[e]="L"===l?"L":"EN":("R"===t||"L"===t)&&(l=t)}for(let e=0;e<t;e++){if("ON"!==n[e])continue;let r=e+1;for(;r<t&&"ON"===n[r];)r++;let i=e>0?n[e-1]:s,a=r<t?n[r]:s,o="L"!==i?"R":"L";if(o===("L"!==a?"R":"L"))for(let t=e;t<r;t++)n[t]=o;e=r-1}for(let e=0;e<t;e++)"ON"===n[e]&&(n[e]=s);for(let e=0;e<t;e++){let t=n[e];(1&o[e])==0?"R"===t?o[e]++:("AN"===t||"EN"===t)&&(o[e]+=2):("L"===t||"AN"===t||"EN"===t)&&o[e]++}return o}(e);if(null===n)return null;let r=new Int8Array(t.length);for(let e=0;e<t.length;e++)r[e]=n[t[e]];return r}(e.normalized,g);return null!==y?{widths:u,lineEndFitAdvances:d,lineEndPaintAdvances:h,kinds:f,simpleLineWalkFastPath:p,segLevels:k,breakableWidths:v,breakablePrefixWidths:x,discretionaryHyphenWidth:l,tabStopAdvance:c,chunks:N,segments:y}:{widths:u,lineEndFitAdvances:d,lineEndPaintAdvances:h,kinds:f,simpleLineWalkFastPath:p,segLevels:k,breakableWidths:v,breakablePrefixWidths:x,discretionaryHyphenWidth:l,tabStopAdvance:c,chunks:N}}(function(e,n,r="normal"){let i,a="pre-wrap"===(i=r??"normal")?{mode:i,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:i,preserveOrdinarySpaces:!1,preserveHardBreaks:!1},o="pre-wrap"===a.mode?/[\r\f]/.test(e)?e.replace(/\r\n/g,"\n").replace(/[\r\f]/g,"\n"):e.replace(/\r\n/g,"\n"):function(e){if(!hZ.test(e))return e;let t=e.replace(hK," ");return 32===t.charCodeAt(0)&&(t=t.slice(1)),t.length>0&&32===t.charCodeAt(t.length-1)&&(t=t.slice(0,-1)),t}(e);if(0===o.length)return{normalized:o,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let s=function(e,n,r){let i=(null===hQ&&(hQ=new Intl.Segmenter(t,{granularity:"word"})),hQ),a=0,o=[],s=[],l=[],c=[];for(let t of i.segment(e))for(let e of function(e,t,n,r){let i=[],a=null,o="",s=n,l=!1,c=0;for(let u of e){let e=function(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(" "===e)return"preserved-space";if(" "===e)return"tab";if(t.preserveHardBreaks&&"\n"===e)return"hard-break"}return" "===e?"space":" "===e||" "===e||"⁠"===e||"\uFEFF"===e?"glue":"​"===e?"zero-width-break":"­"===e?"soft-hyphen":"text"}(u,r),d="text"===e&&t;if(null!==a&&e===a&&d===l){o+=u,c+=u.length;continue}null!==a&&i.push({text:o,isWordLike:l,kind:a,start:s}),a=e,o=u,s=n+c,l=d,c+=u.length}return null!==a&&i.push({text:o,isWordLike:l,kind:a,start:s}),i}(t.segment,t.isWordLike??!1,t.index,r)){let t="text"===e.kind;if(n.carryCJKAfterClosingQuote&&t&&a>0&&"text"===l[a-1]&&h5(e.text)&&h5(o[a-1])&&fn(o[a-1]))o[a-1]+=e.text,s[a-1]=s[a-1]||e.isWordLike;else if(t&&a>0&&"text"===l[a-1]&&function(e){for(let t of e)if(!h3.has(t)&&!h8.has(t))return!1;return e.length>0}(e.text)&&h5(o[a-1]))o[a-1]+=e.text,s[a-1]=s[a-1]||e.isWordLike;else{var u,d;t&&a>0&&"text"===l[a-1]&&0!==(u=o[a-1]).length&&h9.has(u[u.length-1])?(o[a-1]+=e.text,s[a-1]=s[a-1]||e.isWordLike):t&&a>0&&"text"===l[a-1]&&e.isWordLike&&h2(e.text)&&h2(d=o[a-1])&&0!==d.length&&h7.has(d[d.length-1])?(o[a-1]+=e.text,s[a-1]=!0):t&&!e.isWordLike&&a>0&&"text"===l[a-1]&&1===e.text.length&&"-"!==e.text&&"—"!==e.text&&function(e,t){if(0===e.length)return!1;for(let n of e)if(n!==t)return!1;return!0}(o[a-1],e.text)||t&&!e.isWordLike&&a>0&&"text"===l[a-1]&&(function(e){if(ft(e))return!0;let t=!1;for(let n of e){if(h8.has(n)){t=!0;continue}if(!(t&&h0.test(n)))return!1}return t}(e.text)||"-"===e.text&&s[a-1])?o[a-1]+=e.text:(o[a]=e.text,s[a]=e.isWordLike,l[a]=e.kind,c[a]=e.start,a++)}}for(let e=1;e<a;e++)"text"===l[e]&&!s[e]&&ft(o[e])&&"text"===l[e-1]&&(o[e-1]+=o[e],s[e-1]=s[e-1]||s[e],o[e]="");for(let e=a-2;e>=0;e--)if("text"===l[e]&&!s[e]&&function(e){if(ft(e))return!0;for(let t of e)if(!h4.has(t)&&!h6.has(t)&&!h0.test(t))return!1;return e.length>0}(o[e])){let t=e+1;for(;t<a&&""===o[t];)t++;t<a&&"text"===l[t]&&(o[t]=o[e]+o[t],c[t]=c[e],o[e]="")}let h=0;for(let e=0;e<a;e++){let t=o[e];0!==t.length&&(h!==e&&(o[h]=t,s[h]=s[e],l[h]=l[e],c[h]=c[e]),h++)}o.length=h,s.length=h,l.length=h,c.length=h;let f=function(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),i=e.starts.slice();for(let e=0;e<t.length-1;e++){if("text"!==r[e]||"text"!==r[e+1]||!h5(t[e])||!h5(t[e+1]))continue;let n=function(e){let t=Array.from(e),n=t.length;for(;n>0;){let e=t[n-1];if(h0.test(e)||h4.has(e)||h6.has(e)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}(t[e]);null!==n&&(t[e]=n.head,t[e+1]=n.tail+t[e+1],i[e+1]=i[e]+n.head.length)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=[],n=[],r=[],i=[];for(let a=0;a<e.len;a++){let o=e.texts[a],s=e.kinds[a],l=e.isWordLike[a];if("text"===s&&l&&fo.test(o)){let s=o,l=a+1;for(;fs.test(s)&&l<e.len&&"text"===e.kinds[l]&&e.isWordLike[l]&&fo.test(e.texts[l]);)s+=e.texts[l],l++;t.push(s),n.push(!0),r.push("text"),i.push(e.starts[a]),a=l-1;continue}t.push(o),n.push(l),r.push(s),i.push(e.starts[a])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=[],n=[],r=[],i=[];for(let a=0;a<e.len;a++){let o=e.texts[a];if("text"===e.kinds[a]&&o.includes("-")){let s=o.split("-"),l=s.length>1;for(let e=0;e<s.length;e++){let t=s[e];if(!l)break;0!==t.length&&fl(t)&&fc(t)||(l=!1)}if(l){let o=0;for(let l=0;l<s.length;l++){let c=s[l],u=l<s.length-1?`${c}-`:c;t.push(u),n.push(!0),r.push("text"),i.push(e.starts[a]+o),o+=u.length}continue}}t.push(o),n.push(e.isWordLike[a]),r.push(e.kinds[a]),i.push(e.starts[a])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=[],n=[],r=[],i=[];for(let a=0;a<e.len;a++){let o=e.texts[a],s=e.kinds[a];if("text"===s&&fc(o)&&fl(o)){let s=o,l=a+1;for(;l<e.len&&"text"===e.kinds[l]&&fc(e.texts[l]);)s+=e.texts[l],l++;t.push(s),n.push(!0),r.push("text"),i.push(e.starts[a]),a=l-1;continue}t.push(o),n.push(e.isWordLike[a]),r.push(s),i.push(e.starts[a])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=[],n=[],r=[],i=[];for(let a=0;a<e.len;a++){let o=e.texts[a];if(t.push(o),n.push(e.isWordLike[a]),r.push(e.kinds[a]),i.push(e.starts[a]),!(o.includes("?")&&(o.includes("://")||o.startsWith("www."))))continue;let s=a+1;if(s>=e.len||fr(e.kinds[s]))continue;let l="",c=e.starts[s],u=s;for(;u<e.len&&!fr(e.kinds[u]);)l+=e.texts[u],u++;l.length>0&&(t.push(l),n.push(!0),r.push("text"),i.push(c),a=u-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),i=e.starts.slice();for(let i=0;i<e.len;i++){if("text"!==r[i]||!function(e,t){let n=e.texts[t];return!!n.startsWith("www.")||fi.test(n)&&t+1<e.len&&"text"===e.kinds[t+1]&&"//"===e.texts[t+1]}(e,i))continue;let a=i+1;for(;a<e.len&&!fr(r[a]);){t[i]+=t[a],n[i]=!0;let e=t[a].includes("?");if(r[a]="text",t[a]="",a++,e)break}}let a=0;for(let e=0;e<t.length;e++){let o=t[e];0!==o.length&&(a!==e&&(t[a]=o,n[a]=n[e],r[a]=r[e],i[a]=i[e]),a++)}return t.length=a,n.length=a,r.length=a,i.length=a,{len:a,texts:t,isWordLike:n,kinds:r,starts:i}}(function(e){let t=[],n=[],r=[],i=[],a=0;for(;a<e.len;){let o=e.texts[a],s=e.isWordLike[a],l=e.kinds[a],c=e.starts[a];if("glue"===l){let u=o,d=c;for(a++;a<e.len&&"glue"===e.kinds[a];)u+=e.texts[a],a++;if(a<e.len&&"text"===e.kinds[a])o=u+e.texts[a],s=e.isWordLike[a],l="text",c=d,a++;else{t.push(u),n.push(!1),r.push("glue"),i.push(d);continue}}else a++;if("text"===l)for(;a<e.len&&"glue"===e.kinds[a];){let t="";for(;a<e.len&&"glue"===e.kinds[a];)t+=e.texts[a],a++;if(a<e.len&&"text"===e.kinds[a]){o+=t+e.texts[a],s=s||e.isWordLike[a],a++;continue}o+=t}t.push(o),n.push(s),r.push(l),i.push(c)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:i}}({len:h,texts:o,isWordLike:s,kinds:l,starts:c})))))));for(let e=0;e<f.len-1;e++){let t=function(e){if(e.length<2||" "!==e[0])return null;let t=e.slice(1);return/^\p{M}+$/u.test(t)?{space:" ",marks:t}:null}(f.texts[e]);null!==t&&("space"===f.kinds[e]||"preserved-space"===f.kinds[e])&&"text"===f.kinds[e+1]&&h2(f.texts[e+1])&&(f.texts[e]=t.space,f.isWordLike[e]=!1,f.kinds[e]="preserved-space"===f.kinds[e]?"preserved-space":"space",f.texts[e+1]=t.marks+f.texts[e+1],f.starts[e+1]=f.starts[e]+t.space.length)}return f}(o,n,a);return{normalized:o,chunks:function(e,t){if(0===e.len)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];let n=[],r=0;for(let t=0;t<e.len;t++)"hard-break"===e.kinds[t]&&(n.push({startSegmentIndex:r,endSegmentIndex:t,consumedEndSegmentIndex:t+1}),r=t+1);return r<e.len&&n.push({startSegmentIndex:r,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),n}(s,a),...s}}(e,fy(),i?.whiteSpace),n,r)}function fS(e,t,n){let r=n.get(e);if(void 0!==r)return r;for(let n of(r=[],fE().segment(t[e])))r.push(n.segment);return n.set(e,r),r}function fT(e){let t=[[56,130,220],[170,130,200],[240,100,60]],n=Math.max(0,Math.min(1,e))*(t.length-1),r=Math.min(Math.floor(n),t.length-2),i=n-r,a=t[r],o=t[r+1],s=Math.round(a[0]+(o[0]-a[0])*i),l=Math.round(a[1]+(o[1]-a[1])*i),c=Math.round(a[2]+(o[2]-a[2])*i);return`rgb(${s},${l},${c})`}let fA='11px Inter, -apple-system, "Segoe UI", sans-serif',fO='600 10px Inter, -apple-system, "Segoe UI", sans-serif',fM='11px "SF Mono", "Fira Code", Consolas, monospace',fP={semantic:"#0074d9",temporal:"#009296",entity:"#f59e0b",causal:"#8b5cf6"},fD="#0074d9";function fL({data:e,height:t=700,onNodeClick:n,nodeColorFn:r,linkColorFn:i,nodeSizeFn:a,nodeHeatFn:o,heatLegendLabel:s,heatLegendEndpoints:l,compactLabels:c,sizeLegendLabel:u}){let d=(0,em.useRef)(null),h=(0,em.useRef)(null),f=(0,em.useRef)(null),p=function(){let[e,t]=(0,em.useState)(!1);return(0,em.useEffect)(()=>{let e=()=>t(document.documentElement.classList.contains("dark"));e();let n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>n.disconnect()},[]),e}(),g=(0,em.useRef)(0),[v,x]=(0,em.useState)(!1),y=(0,em.useRef)({panX:0,panY:0,zoom:.5,targetPanX:0,targetPanY:0,targetZoom:.5,mouseX:-1,mouseY:-1,isDragging:!1,dragStartX:0,dragStartY:0,panStartX:0,panStartY:0,hoverIndex:-1,prevHoverIndex:-2,W:0,H:0,dpr:1}),{preparedNodes:b,linksByNode:w,linksWithIndices:j}=(0,em.useMemo)(()=>{if(!e.nodes.length)return{preparedNodes:[],linksByNode:new Map,linksWithIndices:[]};let t=new Map;e.nodes.forEach((e,n)=>t.set(e.id,n));let n=new Map;for(let t of e.links)n.set(t.source,(n.get(t.source)||0)+1),n.set(t.target,(n.get(t.target)||0)+1);let a=1;for(let e of n.values())e>a&&(a=e);let s=e.nodes.map((t,i)=>{let s=t.label||t.id.substring(0,12),l=r?.(t)||t.color||fD,c=n.get(t.id)||0,u=o?fT(Math.max(0,Math.min(1,o(t)))):fT(Math.sqrt(c/a)),d=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}(t.id),h=e.nodes.length,f=i/h*Math.PI*2+d%100/100*.5,p=30*Math.sqrt(h),g=.3*p+Math.abs(d)%1e3/1e3*p*.7;return{node:t,wx:Math.cos(f)*g+(d%200-100)*.5,wy:Math.sin(f)*g+((d>>8)%200-100)*.5,prepared:f_(s,fA,!0,void 0),preparedHeight:f_(s,fA,!1,void 0),color:l,heatColor:u,linkCount:c}}),l=[],c=new Map;for(let n=0;n<e.links.length;n++){let r=e.links[n],a=t.get(r.source),o=t.get(r.target);if(void 0===a||void 0===o)continue;let s=i?.(r)||r.color||fP[r.type||"semantic"]||fD,u=l.length;l.push({a:a,b:o,color:s,type:r.type||"semantic"}),c.has(a)||c.set(a,[]),c.has(o)||c.set(o,[]),c.get(a).push(u),c.get(o).push(u)}return{preparedNodes:s,linksByNode:c,linksWithIndices:l}},[e,r,i,o]),N=(0,em.useCallback)(()=>{var e,t,n;let r=h.current;if(!r)return;let i=r.getContext("2d");if(!i)return;let o=y.current;e=o.panX,o.panX=e+(o.targetPanX-e)*.12,t=o.panY,o.panY=t+(o.targetPanY-t)*.12,n=o.zoom,o.zoom=n+(o.targetZoom-n)*.12;let{W:d,H:f,dpr:v,zoom:x,panX:C,panY:E,mouseX:_,mouseY:S,hoverIndex:T}=o,A=d/2+C,O=f/2+E;i.clearRect(0,0,r.width,r.height),i.save(),i.scale(v,v),i.fillStyle=p?"#09090b":"#ffffff",i.fillRect(0,0,d,f);let M=new Float32Array(b.length),P=new Float32Array(b.length),D=new Uint8Array(b.length);for(let e=0;e<b.length;e++){let t=b[e],n=A+t.wx*x,r=O+t.wy*x;M[e]=n,P[e]=r,D[e]=+(n>-60&&n<d+60&&r>-60&&r<f+60)}if(_>=0&&!o.isDragging){let e=x>1.5?80:30,t=-1;for(let n=0;n<b.length;n++){if(!D[n])continue;let r=_-M[n],i=S-P[n],a=Math.sqrt(r*r+i*i);a<e&&(e=a,t=n)}o.hoverIndex=t}let L=new Set;if(T>=0)for(let e of w.get(T)||[])L.add(e);let I=0;if(T>=0){for(let e of L){let t=j[e],n=M[t.a],r=P[t.a],a=M[t.b],o=P[t.b];i.strokeStyle=t.color,i.globalAlpha=.5,i.lineWidth=1.5;let s=(n+a)/2+(o-r)*.08,l=(r+o)/2-(a-n)*.08;i.beginPath(),i.moveTo(n,r),i.quadraticCurveTo(s,l,a,o),i.stroke(),I++}i.globalAlpha=1}else{let e=.06+Math.min(.04*x,.1);for(let t of(i.lineWidth=.4,j)){if(I>=6e3)break;let n=M[t.a],r=P[t.a],a=M[t.b],o=P[t.b];if(n<-60&&a<-60||n>d+60&&a>d+60||r<-60&&o<-60||r>f+60&&o>f+60)continue;i.strokeStyle=t.color,i.globalAlpha=e;let s=(n+a)/2+(o-r)*.08,l=(r+o)/2-(a-n)*.08;i.beginPath(),i.moveTo(n,r),i.quadraticCurveTo(s,l,a,o),i.stroke(),I++}i.globalAlpha=1}let R=c?28:90,B=new Set;function z(e,t,n,r){let i=Math.floor(e/R),a=Math.floor((e+n)/R),o=Math.floor(t/R),s=Math.floor((t+r)/R);for(let e=i;e<=a;e++)for(let t=o;t<=s;t++)if(B.has(`${e},${t}`))return!1;return!0}function F(e,t,n,r){let i=Math.floor(e/R),a=Math.floor((e+n)/R),o=Math.floor(t/R),s=Math.floor((t+r)/R);for(let e=i;e<=a;e++)for(let t=o;t<=s;t++)B.add(`${e},${t}`)}let V=0,U=0,H=[];for(let e=0;e<b.length;e++)D[e]&&e!==T&&H.push(e);for(let e of(T>=0&&D[T]&&H.push(T),H)){let t=b[e],n=M[e],r=P[e];U++;let o=e===T,s=L.size>0&&(w.get(e)||[]).some(e=>L.has(e)),l=Math.max(1.5,(a?a(t.node):2.5+Math.min(.15*t.linkCount,2.5))*Math.min(x,2)),u=.45+Math.min(.03*t.linkCount,.5);if(i.beginPath(),i.arc(n,r,l,0,2*Math.PI),i.fillStyle=t.heatColor,i.globalAlpha=o?1:s?.95:T>=0?.08:u,(o||s)&&(i.shadowColor=t.heatColor,i.shadowBlur=o?20:10),i.fill(),t.linkCount>3&&!o&&T<0&&(i.beginPath(),i.arc(n,r,2*l,0,2*Math.PI),i.fillStyle=t.heatColor,i.globalAlpha=.06+Math.min(.005*t.linkCount,.08),i.fill()),i.shadowBlur=0,i.globalAlpha=1,o)k(i,t,e,n,r,l,!0,!0,p,x),V++;else if(x>1.5){let a=Math.min(200,80+25*x),o=n-a/2,c=r+l+4;z(o,c,a,50)&&(F(o,c,a,50),k(i,t,e,n,r,l,!1,s,p,x),V++)}else if(c||x>.5||s){let a=c?60:155,o=c?12:16,u=n+l+5,d=r-8;z(u,d,a,o)&&(F(u,d,a,o),k(i,t,e,n,r,l,!1,s,p,x),V++)}}i.font=fM,i.fillStyle="#71717a",i.textAlign="left",i.fillText(`${b.length} memories \xb7 ${U} visible \xb7 ${V} labels \xb7 ${I} links \xb7 zoom ${x.toFixed(2)}x`,12,f-12),i.textAlign="right";let W=d-12;for(let[e,t]of(i.font=fO,Object.entries(fP).reverse())){let n=i.measureText(e).width;i.fillStyle=p?"#a1a1aa":"#52525b",i.fillText(e,W,f-12),W-=n+4,i.fillStyle=t,i.beginPath(),i.arc(W,f-15,3,0,2*Math.PI),i.fill(),W-=14}i.textAlign="left",i.font=fO,i.fillStyle=p?"#a1a1aa":"#52525b",i.fillText((s||"LINKS").toUpperCase(),12,36);let[Y,G]=l||["few","many"];i.font=fM;let $=Math.max(80,i.measureText(Y).width+i.measureText(G).width+12);for(let e=0;e<$;e++)i.fillStyle=fT(e/$),i.fillRect(12+e,42,1,6);if(i.fillStyle=p?"#a1a1aa":"#71717a",i.fillText(Y,12,60),i.textAlign="right",i.fillText(G,12+$,60),u){i.textAlign="left",i.font=fO,i.fillStyle=p?"#a1a1aa":"#52525b",i.fillText(u.toUpperCase(),12,82),i.font=fM;let e=p?"#a1a1aa":"#71717a";i.fillStyle=e,i.fillText("few",12,98);let t=12+i.measureText("few").width+8;i.fillStyle=p?"#a1a1aa":"#52525b",i.beginPath(),i.arc(t+2,94,2,0,2*Math.PI),i.fill(),i.beginPath(),i.arc(t+14,94,4,0,2*Math.PI),i.fill(),i.beginPath(),i.arc(t+30,94,6,0,2*Math.PI),i.fill(),i.fillStyle=e,i.fillText("many",t+42,98)}i.textAlign="left",i.font=fM,i.fillStyle=p?"#52525b":"#a1a1aa",i.fillText("Scroll to zoom · Drag to pan · Hover to explore · Click to select",12,16),i.restore(),g.current=requestAnimationFrame(N)},[p,b,j,w]);function k(e,t,n,r,i,a,o,s,l,c){if(c>1.5||o){let n=Math.min(220,80+25*c),s=n-16,{lines:u}=function(e,t){let n,r=[];if(0===e.widths.length)return{lineCount:0,height:0,lines:r};let i=(void 0!==(n=fC.get(e))||(n=new Map,fC.set(e,n)),n),a=function(e,t,n){if(e.simpleLineWalkFastPath)return function(e,t,n){let{widths:r,kinds:i,breakableWidths:a,breakablePrefixWidths:o}=e;if(0===r.length)return 0;let s=fy(),l=s.lineFitEpsilon,c=0,u=0,d=!1,h=0,f=0,p=0,g=0,v=-1,x=0;function y(e=p,t=g,r=u){c++,n?.({startSegmentIndex:h,startGraphemeIndex:f,endSegmentIndex:e,endGraphemeIndex:t,width:r}),u=0,d=!1,v=-1,x=0}function b(e,t){d=!0,h=e,f=0,p=e+1,g=0,u=t}function w(e,t,n){d=!0,h=e,f=t,p=e,g=t+1,u=n}function j(e,t){d?(u+=t,p=e+1,g=0):b(e,t)}function N(e,t){fj(i[e])&&(v=e+1,x=u-t)}function k(e,n){let r=a[e],i=o[e]??null;for(let a=n;a<r.length;a++){let n=fN(r,i,a,s.preferPrefixWidthsForBreakableRuns);if(!d){w(e,a,n);continue}u+n>t+l?(y(),w(e,a,n)):(u+=n,p=e,g=a+1)}d&&p===e&&g===r.length&&(p=e+1,g=0)}let C=0;for(;C<r.length;){let e=r[C],n=i[C];if(!d){e>t&&null!==a[C]?k(C,0):b(C,e),N(C,e),C++;continue}if(u+e>t+l){if(fj(n)){j(C,e),y(C+1,0,u-e),C++;continue}if(v>=0){y(v,0,x);continue}if(e>t&&null!==a[C]){y(),k(C,0),C++;continue}y();continue}j(C,e),N(C,e),C++}return d&&y(),c}(e,t,n);let{widths:r,lineEndFitAdvances:i,lineEndPaintAdvances:a,kinds:o,breakableWidths:s,breakablePrefixWidths:l,discretionaryHyphenWidth:c,tabStopAdvance:u,chunks:d}=e;if(0===r.length||0===d.length)return 0;let h=fy(),f=h.lineFitEpsilon,p=0,g=0,v=!1,x=0,y=0,b=0,w=0,j=-1,N=0,k=0,C=null;function E(){j=-1,N=0,k=0,C=null}function _(e=b,t=w,r=g){p++,n?.({startSegmentIndex:x,startGraphemeIndex:y,endSegmentIndex:e,endGraphemeIndex:t,width:r}),g=0,v=!1,E()}function S(e,t){v=!0,x=e,y=0,b=e+1,w=0,g=t}function T(e,t,n){v=!0,x=e,y=t,b=e,w=t+1,g=n}function A(e,t){v?(g+=t,b=e+1,w=0):S(e,t)}function O(e,t){if(!fj(o[e]))return;let n="tab"===o[e]?0:i[e],r="tab"===o[e]?t:a[e];j=e+1,N=g-t+n,k=g-t+r,C=o[e]}function M(e,n){let r=s[e],i=l[e]??null;for(let a=n;a<r.length;a++){let n=fN(r,i,a,h.preferPrefixWidthsForBreakableRuns);if(!v){T(e,a,n);continue}g+n>t+f?(_(),T(e,a,n)):(g+=n,b=e,w=a+1)}v&&b===e&&w===r.length&&(b=e+1,w=0)}for(let e=0;e<d.length;e++){let T=d[e];if(T.startSegmentIndex===T.endSegmentIndex){p++,n?.({startSegmentIndex:T.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:T.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),E();continue}v=!1,g=0,x=T.startSegmentIndex,y=0,b=T.startSegmentIndex,w=0,E();let P=T.startSegmentIndex;for(;P<T.endSegmentIndex;){let e=o[P],n="tab"===e?function(e,t){if(t<=0)return 0;let n=e%t;return 1e-6>=Math.abs(n)?t:t-n}(g,u):r[P];if("soft-hyphen"===e){v&&(b=P+1,w=0,j=P+1,N=g+c,k=g+c,C=e),P++;continue}if(!v){n>t&&null!==s[P]?M(P,0):S(P,n),O(P,n),P++;continue}if(g+n>t+f){let r=g+("tab"===e?0:i[P]),o=g+("tab"===e?n:a[P]);if("soft-hyphen"===C&&h.preferEarlySoftHyphenBreak&&N<=t+f){_(j,0,k);continue}if("soft-hyphen"===C&&function(e){if("soft-hyphen"!==C)return!1;let n=s[e];if(null===n)return!1;let r=h.preferPrefixWidthsForBreakableRuns?l[e]??n:n,i=r!==n,{fitCount:a,fittedWidth:o}=function(e,t,n,r,i,a){let o=0,s=t;for(;o<e.length;){let l=a?t+e[o]:s+e[o];if((o+1<e.length?l+i:l)>n+r)break;s=l,o++}return{fitCount:o,fittedWidth:s}}(r,g,t,f,c,i);return 0!==a&&((g=o,b=e,w=a,E(),a===n.length)?(b=e+1,w=0):(_(e,a,o+c),M(e,a)),!0)}(P)){P++;continue}if(fj(e)&&r<=t+f){A(P,n),_(P+1,0,o),P++;continue}if(j>=0&&N<=t+f){_(j,0,k);continue}if(n>t&&null!==s[P]){_(),M(P,0),P++;continue}_();continue}A(P,n),O(P,n),P++}if(v){let e=j===T.consumedEndSegmentIndex?k:g;_(T.consumedEndSegmentIndex,0,e)}}return p}(e,t,t=>{var n,a,o,s,l;r.push((n=t.width,a=t.startSegmentIndex,o=t.startGraphemeIndex,s=t.endSegmentIndex,l=t.endGraphemeIndex,{text:function(e,t,n,r,i,a,o){let s="",l=a>0&&"soft-hyphen"===t[a-1]&&!(r===a&&i>0);for(let o=r;o<a;o++)"soft-hyphen"!==t[o]&&"hard-break"!==t[o]&&(o===r&&i>0?s+=fS(o,e,n).slice(i).join(""):s+=e[o]);return o>0?(l&&(s+="-"),s+=fS(a,e,n).slice(r===a?i:0,o).join("")):l&&(s+="-"),s}(e.segments,e.kinds,i,a,o,s,l),width:n,start:{segmentIndex:a,graphemeIndex:o},end:{segmentIndex:s,graphemeIndex:l}}))});return{lineCount:a,height:15*a,lines:r}}(t.prepared,s),d=o?Math.min(u.length,5):Math.min(u.length,Math.floor(c)),h=8+15*d+8,f=r-n/2,p=i+a+4;e.fillStyle=o?l?"#1c1c1e":"#f4f4f5":l?"rgba(9,9,11,0.92)":"rgba(255,255,255,0.92)",e.beginPath(),e.roundRect(f,p,n,h,6),e.fill(),e.strokeStyle=o?t.color:l?"rgba(63,63,70,0.5)":"rgba(212,212,216,0.6)",e.lineWidth=o?1.5:.5,e.beginPath(),e.roundRect(f,p,n,h,6),e.stroke(),o&&(e.shadowColor=t.color,e.shadowBlur=15,e.beginPath(),e.roundRect(f,p,n,h,6),e.stroke(),e.shadowBlur=0),e.font=fA,e.fillStyle=o?l?"#e4e4e7":"#18181b":"#71717a",e.textAlign="left";for(let t=0;t<d;t++)e.fillText(u[t].text,f+8,p+8+15*t+11)}else{e.font=fA,e.fillStyle=o?l?"#e4e4e7":"#18181b":l?"#52525b":"#a1a1aa",e.globalAlpha=o?1:s?.85:Math.min(1,(c-.3)*2.5),e.textAlign="left";let n=t.node.label||t.node.id.substring(0,12),u=n.length>45?n.slice(0,45)+"...":n;e.fillText(u,r+a+5,i+4),e.globalAlpha=1}}(0,em.useEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{let t=window.devicePixelRatio||1,n=e.getBoundingClientRect(),r=n.width,i=n.height;e.width=r*t,e.height=i*t,y.current.dpr=t,y.current.W=r,y.current.H=i};if(t(),b.length>0){let e=0;for(let t of b){let n=Math.sqrt(t.wx*t.wx+t.wy*t.wy);n>e&&(e=n)}let t=e>0?Math.min(y.current.W,y.current.H)/(2.5*e):.5;y.current.zoom=t,y.current.targetZoom=t}g.current=requestAnimationFrame(N);let r=()=>t(),i=e=>{e.preventDefault();let t=e.deltaY>0?.9:1.1;y.current.targetZoom=Math.max(.03,Math.min(8,y.current.targetZoom*t))},a=t=>{let n=e.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top;y.current.mouseX=r,y.current.mouseY=i,y.current.isDragging?(y.current.targetPanX=y.current.panStartX+(t.clientX-y.current.dragStartX),y.current.targetPanY=y.current.panStartY+(t.clientY-y.current.dragStartY),e.style.cursor="grabbing",f.current&&(f.current.style.display="none")):(e.style.cursor=y.current.hoverIndex>=0?"pointer":"default",((e,t)=>{let n=f.current;if(!n)return;let r=y.current,i=r.hoverIndex;if(i<0||r.isDragging){n.style.display="none",r.prevHoverIndex=-1;return}let a=b[i]?.node;if(!a){n.style.display="none";return}if(i!==r.prevHoverIndex){r.prevHoverIndex=i;let e=a.metadata,t=e?.text||a.label||a.id,o=e?.entities?String(e.entities).split(",").map(e=>e.trim()).filter(Boolean):[],s=b[i].heatColor,l=b[i].linkCount,c=e?.fact_type||a.group||"memory",u=e?.context&&"N/A"!==e.context?e.context:null,d=Array.isArray(e?.tags)?e.tags:[],h=e?.occurred_start||null,f=e?.occurred_end||null,g=e?.mentioned_at||null,v=e?.proof_count||null,x=e?.document_id||null,y=p?"#a1a1aa":"#71717a",w=p?"#71717a":"#a1a1aa",j=`font-size:10px;color:${w};text-transform:uppercase;letter-spacing:0.04em;font-weight:500`,N=`font-size:12px;color:${p?"#e4e4e7":"#18181b"}`,k="display:flex;justify-content:space-between;align-items:baseline;gap:12px",C='<div style="display:flex;align-items:center;gap:8px;margin-bottom:6px">';C+=`<span style="font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;color:${s};background:${s}18;padding:2px 8px;border-radius:4px">${c}</span><span style="font-size:10px;color:${y}">${l} link${1!==l?"s":""}</span></div><div style="font-size:12px;line-height:1.6;margin-bottom:8px">${t}</div><div style="display:flex;flex-direction:column;gap:4px;border-top:1px solid ${p?"#27272a":"#e4e4e7"};padding-top:8px">`,u&&(C+=`<div style="${k}"><span style="${j}">Context</span><span style="${N}">${u}</span></div>`);let E=e=>e.slice(0,16).replace("T"," ");if(h){let e=E(h),t=f?E(f):null,n=t&&t!==e?`${e} → ${t}`:e;C+=`<div style="${k}"><span style="${j}">Occurred</span><span style="${N}">${n}</span></div>`}if(g&&(C+=`<div style="${k}"><span style="${j}">Mentioned</span><span style="${N}">${E(g)}</span></div>`),v&&v>1&&(C+=`<div style="${k}"><span style="${j}">Evidence</span><span style="${N}">${v} sources</span></div>`),x&&(C+=`<div style="${k}"><span style="${j}">Document</span><span style="font-size:11px;font-family:monospace;color:${y}">${String(x).slice(0,12)}...</span></div>`),C+="</div>",o.length>0&&(1!==o.length||"None"!==o[0])){for(let e of(C+='<div style="margin-top:8px;display:flex;flex-wrap:wrap;gap:4px">',o))C+=`<span style="font-size:10px;background:${p?"#27272a":"#f4f4f5"};color:${p?"#d4d4d8":"#3f3f46"};padding:2px 7px;border-radius:4px">${e}</span>`;C+="</div>"}if(d.length>0){for(let e of(C+='<div style="margin-top:6px;display:flex;flex-wrap:wrap;gap:4px">',d))C+=`<span style="font-size:10px;background:${s}15;color:${s};padding:2px 7px;border-radius:4px">#${e}</span>`;C+="</div>"}n.innerHTML=C+=`<div style="margin-top:8px;font-size:9px;font-family:monospace;color:${w}">${a.id}</div>`}n.style.display="block";let o=n.offsetWidth,s=n.offsetHeight,l=Math.min(e+16,r.W-o-12),c=Math.min(t+16,r.H-s-12);n.style.left=`${Math.max(4,l)}px`,n.style.top=`${Math.max(4,c)}px`})(r,i))},o=e=>{y.current.isDragging=!0,y.current.dragStartX=e.clientX,y.current.dragStartY=e.clientY,y.current.panStartX=y.current.panX,y.current.panStartY=y.current.panY},s=()=>{if(y.current.isDragging){let e=Math.abs(y.current.panX-y.current.panStartX),t=Math.abs(y.current.panY-y.current.panStartY);if(e<3&&t<3&&y.current.hoverIndex>=0){let e=b[y.current.hoverIndex]?.node;e&&n&&n(e)}}y.current.isDragging=!1,e.style.cursor=y.current.hoverIndex>=0?"pointer":"default"},l=()=>{y.current.mouseX=-1,y.current.mouseY=-1,y.current.isDragging=!1,y.current.hoverIndex=-1,f.current&&(f.current.style.display="none")};return window.addEventListener("resize",r),e.addEventListener("wheel",i,{passive:!1}),e.addEventListener("mousemove",a),e.addEventListener("mousedown",o),e.addEventListener("mouseup",s),e.addEventListener("mouseleave",l),()=>{cancelAnimationFrame(g.current),window.removeEventListener("resize",r),e.removeEventListener("wheel",i),e.removeEventListener("mousemove",a),e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",s),e.removeEventListener("mouseleave",l)}},[N,b,n,v]);let C=(0,em.useCallback)(()=>{x(e=>!e)},[]);return(0,em.useEffect)(()=>{if(!v)return;let e=e=>{"Escape"===e.key&&x(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[v]),(0,em.useEffect)(()=>{if(!h.current)return;let e=setTimeout(()=>{let e=window.devicePixelRatio||1,t=h.current.getBoundingClientRect();h.current.width=t.width*e,h.current.height=t.height*e,y.current.dpr=e,y.current.W=t.width,y.current.H=t.height},50);return()=>clearTimeout(e)},[v]),(0,ep.jsxs)("div",{ref:d,style:v?{position:"fixed",inset:0,zIndex:50,background:p?"#09090b":"#ffffff"}:{position:"relative",width:"100%",height:`${t}px`},children:[(0,ep.jsx)("canvas",{ref:h,style:{width:"100%",height:"100%",display:"block"}}),(0,ep.jsxs)("button",{onClick:C,style:{position:"absolute",top:8,right:8,zIndex:21,padding:"6px 10px",borderRadius:6,border:`1px solid ${p?"#27272a":"#e4e4e7"}`,background:p?"#18181b":"#ffffff",color:p?"#a1a1aa":"#71717a",fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",gap:4,opacity:.7,transition:"opacity 0.15s"},onMouseEnter:e=>{e.currentTarget.style.opacity="1"},onMouseLeave:e=>{e.currentTarget.style.opacity="0.7"},title:v?"Exit fullscreen (Esc)":"Enter fullscreen",children:[v?(0,ep.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ep.jsx)("polyline",{points:"4 14 10 14 10 20"}),(0,ep.jsx)("polyline",{points:"20 10 14 10 14 4"}),(0,ep.jsx)("line",{x1:"14",y1:"10",x2:"21",y2:"3"}),(0,ep.jsx)("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}):(0,ep.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ep.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,ep.jsx)("polyline",{points:"9 21 3 21 3 15"}),(0,ep.jsx)("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),(0,ep.jsx)("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),v?"Exit":"Fullscreen"]}),(0,ep.jsx)("div",{ref:f,style:{display:"none",position:"absolute",pointerEvents:"none",zIndex:22,maxWidth:360,padding:"10px 14px",borderRadius:8,fontSize:12,lineHeight:1.5,boxShadow:"0 8px 24px rgba(0,0,0,0.35)",border:`1px solid ${p?"#27272a":"#e4e4e7"}`,background:p?"#18181b":"#ffffff",color:p?"#e4e4e7":"#18181b"}})]})}function fI({value:e,onChange:t,bankId:n,fetchSuggestions:r,placeholder:i="Filter by tag…",className:a,matchMode:o,onMatchModeChange:s,showMatchToggleAt:l=2}){let[c,u]=(0,em.useState)(""),[d,h]=(0,em.useState)([]),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(-1),x=(0,em.useRef)(null),y=(0,em.useMemo)(()=>{if(n)return async e=>{let t=e?`${e}*`:void 0;return(await eP.client.listTags(n,t,20)).items.map(e=>e.tag)}},[n]),b=(0,em.useRef)(void 0);b.current=r??y,(0,em.useEffect)(()=>{let t=b.current;if(!t)return;let n=!1,r=setTimeout(async()=>{try{let r=await t(c.trim());if(n)return;let i=r.filter(t=>!e.includes(t));h(i),v(i.length>0?0:-1)}catch{n||h([])}},150);return()=>{n=!0,clearTimeout(r)}},[c,e]),(0,em.useEffect)(()=>{let e=e=>{x.current&&(x.current.contains(e.target)||p(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let w=n=>{let r=n.trim();!r||e.includes(r)?u(""):(t([...e,r]),u(""),v(-1))},j=n=>{t(e.filter(e=>e!==n))},N=null!=o&&null!=s&&e.length>=l;return(0,ep.jsxs)("div",{className:`flex items-center gap-2 flex-wrap ${a??""}`,children:[(0,ep.jsxs)("div",{ref:x,className:"relative w-56",children:[(0,ep.jsx)(tR,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),(0,ep.jsx)(eL.Input,{type:"text",value:c,onChange:e=>{u(e.target.value),p(!0)},onFocus:()=>p(!0),onKeyDown:t=>{if("ArrowDown"===t.key&&d.length>0){t.preventDefault(),p(!0),v(e=>(e+1)%d.length);return}if("ArrowUp"===t.key&&d.length>0){t.preventDefault(),p(!0),v(e=>e<=0?d.length-1:e-1);return}if("Enter"===t.key||","===t.key){t.preventDefault(),f&&g>=0&&d[g]?w(d[g]):c.trim()&&w(c);return}"Escape"===t.key?p(!1):"Backspace"===t.key&&!c&&e.length>0&&j(e[e.length-1])},placeholder:i,className:"pl-8 h-9"}),f&&d.length>0&&(0,ep.jsx)("div",{className:"absolute z-20 mt-1 w-full bg-popover border border-border rounded-md shadow-md max-h-60 overflow-y-auto",children:d.map((e,t)=>(0,ep.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),w(e)},onMouseEnter:()=>v(t),className:`w-full text-left px-3 py-1.5 text-sm flex items-center gap-2 ${t===g?"bg-accent text-accent-foreground":"text-foreground hover:bg-muted"}`,children:[(0,ep.jsx)(tR,{className:"w-3 h-3 text-muted-foreground"}),(0,ep.jsx)("span",{className:"truncate",children:e})]},e))})]}),e.length>0&&(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map(e=>(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-md bg-primary/10 text-primary border border-primary/20 font-medium leading-none",children:[(0,ep.jsx)("span",{className:"opacity-50 select-none font-mono",children:"#"}),e,(0,ep.jsx)("button",{type:"button",onClick:()=>j(e),className:"opacity-50 hover:opacity-100 transition-opacity ml-0.5","aria-label":`Remove tag ${e}`,children:(0,ep.jsx)(tV.X,{className:"w-3 h-3"})})]},e)),(0,ep.jsx)("button",{type:"button",onClick:()=>t([]),className:"text-xs text-muted-foreground hover:text-foreground underline",children:"Clear"})]}),N&&(0,ep.jsxs)("div",{className:"flex items-center gap-1 bg-muted rounded-md p-0.5 h-9 ml-auto",children:[(0,ep.jsx)("button",{type:"button",onClick:()=>s("any"),className:`px-2 py-1 rounded text-xs font-medium ${"any"===o?"bg-background text-foreground shadow-sm":"text-muted-foreground"}`,title:"Match any selected tag",children:"any"}),(0,ep.jsx)("button",{type:"button",onClick:()=>s("all"),className:`px-2 py-1 rounded text-xs font-medium ${"all"===o?"bg-background text-foreground shadow-sm":"text-muted-foreground"}`,title:"Match all selected tags",children:"all"})]})]})}let fR=(0,ej.default)("chart-scatter",[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor",key:"lysivs"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor",key:"byv1b8"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor",key:"1gjh6j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);var fB=e.i(7233);function fz({factType:e,documentId:t,chunkId:n,compact:r=!1,onExpandToggle:i}){let a,o,s,l,{currentBank:c}=(0,ey.useBank)(),[u,d]=(0,em.useState)("constellation"),[h,f]=(0,em.useState)(r),[p,g]=(0,em.useState)(null),[v,x]=(0,em.useState)(!1),[y,b]=(0,em.useState)(""),[w,j]=(0,em.useState)([]),[N,k]=(0,em.useState)(1),[C,E]=(0,em.useState)(null),[_,S]=(0,em.useState)(null),[T,A]=(0,em.useState)(1e3),[O,M]=(0,em.useState)("mentioned_at"),[P,D]=(0,em.useState)(null),[L,I]=(0,em.useState)(!0),[R,B]=(0,em.useState)(void 0),[z,F]=(0,em.useState)(!0),[V,U]=(0,em.useState)(new Set(["semantic","temporal","entity","causal"])),H=e=>{U(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,em.useEffect)(()=>{let e=e=>{"Escape"===e.key&&C&&E(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[C]);let W=async(r,i,a)=>{if(c){x(!0);try{let o=await eP.client.getGraph({bank_id:c,type:e,limit:r??T,q:i,tags:a,document_id:t,chunk_id:n});if(g(o),"observation"===e){let e=await eP.client.getBankStats(c);D({pending_consolidation:e.pending_consolidation||0,last_consolidated_at:e.last_consolidated_at||null})}}catch(e){}finally{x(!1)}}},Y=(0,em.useMemo)(()=>p?.table_rows??[],[p]),G=(0,em.useMemo)(()=>{if(!p)return{nodes:[],links:[]};let e=h$(p),t=e.links.filter(e=>{var t;let n=(t=e.type)?"semantic"===t||"temporal"===t||"entity"===t?t:["causes","caused_by","enables","prevents"].includes(t)?"causal":"semantic":"semantic";return V.has(n)});return{nodes:e.nodes,links:t}},[p,V]),$=(0,em.useMemo)(()=>{let e=0,t=0,n=0,r=0,i=0,a={};return G.links.forEach(o=>{i++;let s=o.type||"unknown";"semantic"===s?e++:"temporal"===s?t++:"entity"===s?n++:"causes"===s||"caused_by"===s||"enables"===s||"prevents"===s?r++:a[s]=(a[s]||0)+1}),{semantic:e,temporal:t,entity:n,causal:r,total:i,otherTypes:a}},[G]),X=(0,em.useCallback)(e=>{let t=p?.table_rows?.find(t=>t.id===e.id);t&&E(t)},[p]),q=(0,em.useCallback)(e=>e.color||"#0074d9",[]),K=(0,em.useMemo)(()=>{if("observation"!==e||!p?.table_rows)return null;let t=new Map,n=1;for(let e of p.table_rows){let r=e.proof_count??1;t.set(e.id,r),r>n&&(n=r)}return{counts:t,max:n}},[e,p]),Z=(0,em.useMemo)(()=>{if(!p?.table_rows?.length)return null;let e=new Map,t=1/0,n=-1/0;for(let r of p.table_rows){let i=r[O];if(!i)continue;let a=Date.parse(i);!Number.isNaN(a)&&(e.set(r.id,a),a<t&&(t=a),a>n&&(n=a))}return Number.isFinite(t)&&Number.isFinite(n)&&n!==t?{times:e,minT:t,maxT:n}:null},[p,O]),Q=(0,em.useCallback)(e=>{if(!Z)return .5;let t=Z.times.get(e.id);return void 0===t?0:(t-Z.minT)/(Z.maxT-Z.minT)},[Z]),J=(0,em.useCallback)(e=>K?3+Math.min(2*Math.sqrt((K.counts.get(e.id)??1)-1),11):3,[K]),ee=(0,em.useCallback)(e=>"temporal"===e.type?"#009296":"entity"===e.type?"#f59e0b":"causes"===e.type||"caused_by"===e.type||"enables"===e.type||"prevents"===e.type?"#8b5cf6":"#0074d9",[]);return(0,em.useEffect)(()=>{k(1)},[w]),(0,em.useEffect)(()=>{c&&W(void 0,y||void 0,w.length>0?w:void 0)},[w]),(0,em.useEffect)(()=>{c&&W()},[e,c,t,n]),(0,em.useEffect)(()=>{p&&void 0===R&&(G.nodes.length>50?B(20):G.nodes.length>20&&B(20))},[p,G.nodes.length,R]),(0,ep.jsxs)("div",{children:[v&&!p?(0,ep.jsxs)("div",{className:"text-center py-12",children:[(0,ep.jsx)(eH,{className:"w-8 h-8 mx-auto mb-3 text-muted-foreground animate-spin"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Loading memories..."})]}):p&&0===p.total_units?(0,ep.jsxs)("div",{className:"text-center py-20",children:[(0,ep.jsx)(eC.FileText,{className:"w-10 h-10 mx-auto mb-4 text-muted-foreground/50"}),(0,ep.jsx)("h3",{className:"text-base font-medium text-foreground mb-1",children:"No memories"}),!t&&!n&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-6",children:"Add a document to start building this memory bank."}),(0,ep.jsxs)(eD.Button,{variant:"default",size:"sm",className:"gap-1.5",onClick:()=>{let e=document.querySelector("[data-add-document]");e?.click()},children:[(0,ep.jsx)(fB.Plus,{className:"w-4 h-4"}),"Add Document"]})]})]}):p?(0,ep.jsxs)(ep.Fragment,{children:[!h&&(0,ep.jsx)("div",{className:"mb-4 space-y-2",children:(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsxs)("div",{className:"relative max-w-xs flex-1",children:[v?(0,ep.jsx)(eH,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none animate-spin"}):(0,ep.jsx)(ew.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),(0,ep.jsx)(eL.Input,{type:"text",value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),c&&(k(1),W(void 0,y||void 0,w.length>0?w:void 0)))},placeholder:"Filter by text or context (press Enter)...",className:"pl-8 h-9"})]}),(0,ep.jsx)(fI,{value:w,onChange:j,bankId:c})]})}),h?(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-2 px-1",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[p.total_units," memories"]}),(0,ep.jsxs)(eD.Button,{variant:"ghost",size:"sm",onClick:()=>{i?i():f(!1)},className:"h-6 px-2 text-xs gap-1",children:[(0,ep.jsx)(eV,{className:"w-3 h-3"}),"Expand"]})]}):(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[r&&(0,ep.jsxs)(eD.Button,{variant:"ghost",size:"sm",onClick:()=>{i?i():f(!0)},className:"h-7 px-2 text-xs gap-1",children:[(0,ep.jsx)(eU,{className:"w-3 h-3"}),"Compact"]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:y||w.length>0?`${Y.length} matching memories`:p.table_rows?.length<p.total_units?(0,ep.jsxs)("span",{children:["Showing ",p.table_rows?.length??0," of ",p.total_units," total memories",(0,ep.jsx)("button",{onClick:()=>{let e=Math.min(p.total_units,T+1e3);A(e),W(e,y||void 0,w.length>0?w:void 0)},className:"ml-2 text-primary hover:underline",children:"Load more"})]}):`${p.total_units} total memories`}),"observation"===e&&P&&(0,ep.jsx)("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs font-medium border ${0===P.pending_consolidation?"bg-green-500/10 text-green-700 dark:text-green-400 border-green-500/20":"bg-amber-500/10 text-amber-700 dark:text-amber-400 border-amber-500/20"}`,title:0===P.pending_consolidation?`All memories consolidated${P.last_consolidated_at?` (last: ${new Date(P.last_consolidated_at).toLocaleString()})`:""}`:`${P.pending_consolidation} memories pending consolidation`,children:0===P.pending_consolidation?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"In Sync"]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),P.pending_consolidation," Pending",(0,ep.jsx)("button",{onClick:()=>W(T,y||void 0,w.length>0?w:void 0),disabled:v,className:"ml-0.5 opacity-70 hover:opacity-100 disabled:opacity-40 transition-opacity",title:"Refresh observations",children:(0,ep.jsx)(eH,{className:`w-3 h-3 ${v?"animate-spin":""}`})})]})})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,ep.jsxs)("button",{onClick:()=>d("constellation"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"constellation"===u?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(fR,{className:"w-4 h-4"}),"Constellation"]}),(0,ep.jsxs)("button",{onClick:()=>d("graph"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"graph"===u?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(eG,{className:"w-4 h-4"}),"Graph"]}),(0,ep.jsxs)("button",{onClick:()=>d("table"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"table"===u?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(e$,{className:"w-4 h-4"}),"Table"]}),(0,ep.jsxs)("button",{onClick:()=>d("timeline"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"timeline"===u?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(eI,{className:"w-4 h-4"}),"Timeline"]})]})]}),!h&&"graph"===u&&(0,ep.jsxs)("div",{className:"flex gap-0",children:[(0,ep.jsx)("div",{className:"flex-1 min-w-0",children:(0,ep.jsx)(hG,{data:G,height:700,showLabels:L,onNodeClick:X,maxNodes:R,nodeColorFn:q,linkColorFn:ee})}),(0,ep.jsx)("button",{onClick:()=>F(!z),className:"flex-shrink-0 w-5 h-[700px] bg-transparent hover:bg-muted/50 flex items-center justify-center transition-colors",title:z?"Hide panel":"Show panel",children:z?(0,ep.jsx)(eS.ChevronRight,{className:"w-3 h-3 text-muted-foreground/60"}):(0,ep.jsx)(e_,{className:"w-3 h-3 text-muted-foreground/60"})}),(0,ep.jsx)("div",{className:`${z?"w-80":"w-0"} transition-all duration-300 overflow-hidden flex-shrink-0`,children:(0,ep.jsx)("div",{className:"w-80 h-[700px] bg-card border-l border-border overflow-y-auto",children:C?(0,ep.jsx)(t0,{memory:C,onClose:()=>E(null),inPanel:!0,bankId:c||void 0}):(0,ep.jsxs)("div",{className:"p-4 space-y-5",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold mb-3 text-foreground",children:"Graph"}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:"#0074d9"}}),(0,ep.jsx)("span",{className:"text-foreground",children:"Nodes"})]}),(0,ep.jsxs)("span",{className:"font-mono text-foreground",children:[Math.min(R??G.nodes.length,G.nodes.length),"/",G.nodes.length]})]}),(0,ep.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mt-2 mb-1",children:["Links (",$.total,")"," ",(0,ep.jsx)("span",{className:"text-muted-foreground/60",children:"· click to filter"})]}),(0,ep.jsxs)("button",{onClick:()=>H("semantic"),className:`w-full flex items-center justify-between text-sm px-2 py-1 rounded transition-all ${V.has("semantic")?"hover:bg-muted":"opacity-40 hover:opacity-60"}`,children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("div",{className:"w-4 h-0.5 bg-[#0074d9]"}),(0,ep.jsx)("span",{className:"text-foreground",children:"Semantic"})]}),(0,ep.jsx)("span",{className:`font-mono ${0===$.semantic?"text-destructive":"text-foreground"}`,children:$.semantic})]}),(0,ep.jsxs)("button",{onClick:()=>H("temporal"),className:`w-full flex items-center justify-between text-sm px-2 py-1 rounded transition-all ${V.has("temporal")?"hover:bg-muted":"opacity-40 hover:opacity-60"}`,children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("div",{className:"w-4 h-0.5 bg-[#009296]"}),(0,ep.jsx)("span",{className:"text-foreground",children:"Temporal"})]}),(0,ep.jsx)("span",{className:`font-mono ${0===$.temporal?"text-destructive":"text-foreground"}`,children:$.temporal})]}),(0,ep.jsxs)("button",{onClick:()=>H("entity"),className:`w-full flex items-center justify-between text-sm px-2 py-1 rounded transition-all ${V.has("entity")?"hover:bg-muted":"opacity-40 hover:opacity-60"}`,children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("div",{className:"w-4 h-0.5 bg-[#f59e0b]"}),(0,ep.jsx)("span",{className:"text-foreground",children:"Entity"})]}),(0,ep.jsx)("span",{className:"font-mono text-foreground",children:$.entity})]}),(0,ep.jsxs)("button",{onClick:()=>H("causal"),className:`w-full flex items-center justify-between text-sm px-2 py-1 rounded transition-all ${V.has("causal")?"hover:bg-muted":"opacity-40 hover:opacity-60"}`,children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("div",{className:"w-4 h-0.5 bg-[#8b5cf6]"}),(0,ep.jsx)("span",{className:"text-foreground",children:"Causal"})]}),(0,ep.jsx)("span",{className:`font-mono ${0===$.causal?"text-muted-foreground":"text-foreground"}`,children:$.causal})]}),Object.entries($.otherTypes||{}).map(([e,t])=>(0,ep.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ep.jsx)("span",{className:"text-muted-foreground capitalize ml-6",children:e}),(0,ep.jsx)("span",{className:"font-mono text-muted-foreground",children:t})]},e))]})]}),(0,ep.jsx)("div",{className:"border-t border-border"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold mb-3 text-foreground",children:"Display"}),(0,ep.jsx)("div",{className:"space-y-4",children:(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)(e6,{htmlFor:"show-labels",className:"text-sm text-foreground",children:"Show labels"}),(0,ep.jsx)(tL.Switch,{id:"show-labels",checked:L,onCheckedChange:I})]})})]}),(0,ep.jsx)("div",{className:"border-t border-border"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold mb-3 text-foreground",children:"Performance"}),(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ep.jsx)(e6,{className:"text-sm text-foreground",children:"Max nodes"}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:G.nodes.length>50?`${R??50} / ${G.nodes.length}`:`${R??"All"} / ${G.nodes.length}`})]}),(0,ep.jsx)(tD,{value:[G.nodes.length>50?R||20:R||Math.min(G.nodes.length,20)],min:10,max:Math.min(Math.max(G.nodes.length,10),50),step:10,onValueChange:([e])=>{let t=Math.min(G.nodes.length,50);G.nodes.length>50?B(e):B(e>=t?void 0:e)},className:"w-full"})]}),(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:["All links between visible nodes are shown.",G.nodes.length>50&&(0,ep.jsxs)("span",{className:"block text-amber-600 dark:text-amber-400 mt-1",children:["⚠️ Limited to 50 nodes for performance. Total:"," ",G.nodes.length]})]})]})]}),(0,ep.jsx)("div",{className:"border-t border-border"}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground/60 text-center pt-2",children:"Click a node to see details"})]})})})]}),(h||"constellation"===u)&&(0,ep.jsxs)("div",{className:"flex gap-0",children:[(0,ep.jsx)("div",{className:"flex-1 min-w-0 border border-border rounded-lg overflow-hidden",children:(0,ep.jsx)(fL,{data:G,height:h?300:700,onNodeClick:X,nodeColorFn:q,linkColorFn:ee,nodeSizeFn:"observation"===e?J:void 0,sizeLegendLabel:"observation"===e?"source facts":void 0,nodeHeatFn:Z?Q:void 0,heatLegendLabel:Z?`recency \xb7 ${({mentioned_at:"mentioned",occurred_start:"occurred (start)",occurred_end:"occurred (end)"})[O]}`:void 0,heatLegendEndpoints:Z?[new Date(Z.minT).toISOString().slice(0,10),new Date(Z.maxT).toISOString().slice(0,10)]:void 0},h?"compact":"full")}),!h&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("button",{onClick:()=>F(!z),className:"flex-shrink-0 w-5 h-[700px] bg-transparent hover:bg-muted/50 flex items-center justify-center transition-colors",title:z?"Hide panel":"Show panel",children:z?(0,ep.jsx)(eS.ChevronRight,{className:"w-3 h-3 text-muted-foreground"}):(0,ep.jsx)(e_,{className:"w-3 h-3 text-muted-foreground"})}),z&&(0,ep.jsx)("div",{className:"w-72 flex-shrink-0 border border-border rounded-lg bg-muted/20 overflow-y-auto h-[700px]",children:C?(0,ep.jsx)(t0,{memory:C,onClose:()=>E(null),inPanel:!0,bankId:c||void 0}):(0,ep.jsxs)("div",{className:"p-4 space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:"Constellation View"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Canvas-rendered memory map with spatial label deconfliction. Scroll to zoom, drag to pan, hover to explore entity connections. Click a memory to view details."}),(0,ep.jsxs)("div",{className:"space-y-2 pt-2",children:[(0,ep.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Color by"}),(0,ep.jsxs)(tI.Select,{value:O,onValueChange:e=>M(e),children:[(0,ep.jsx)(tI.SelectTrigger,{className:"h-8 w-full text-xs",children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"mentioned_at",children:"Mentioned"}),(0,ep.jsx)(tI.SelectItem,{value:"occurred_start",children:"Occurred (start)"}),(0,ep.jsx)(tI.SelectItem,{value:"occurred_end",children:"Occurred (end)"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-2 pt-2",children:[(0,ep.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:"Link types"}),Object.entries({semantic:"#0074d9",temporal:"#009296",entity:"#f59e0b",causal:"#8b5cf6"}).map(([e,t])=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 cursor-pointer",onClick:()=>H(e),children:[(0,ep.jsx)("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:t,opacity:V.has(e)?1:.2}}),(0,ep.jsx)("span",{className:`text-xs capitalize ${V.has(e)?"text-foreground":"text-muted-foreground line-through"}`,children:e})]},e))]}),(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground space-y-1 pt-2",children:[(0,ep.jsxs)("div",{children:["Nodes:"," ",(0,ep.jsx)("span",{className:"text-foreground",children:G.nodes.length})]}),(0,ep.jsxs)("div",{children:["Links:"," ",(0,ep.jsx)("span",{className:"text-foreground",children:G.links.length})]})]})]})})]})]}),!h&&"table"===u&&(0,ep.jsx)("div",{children:(0,ep.jsx)("div",{className:"w-full",children:(0,ep.jsx)("div",{className:"pb-4",children:Y.length>0?(a=Math.ceil(Y.length/100),s=(o=(N-1)*100)+100,l=Y.slice(o,s),(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)(eX,{className:"table-fixed",children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"observation"===e?"w-[35%]":"w-[38%]",children:"observation"===e?"Observation":"Memory"}),(0,ep.jsx)(eQ,{className:"w-[15%]",children:"Entities"}),(0,ep.jsx)(eQ,{className:"w-[15%]",children:"Tags"}),"observation"===e&&(0,ep.jsx)(eQ,{className:"w-[10%]",children:"Sources"}),(0,ep.jsx)(eQ,{className:"observation"===e?"w-[12%]":"w-[16%]",children:"Occurred"}),(0,ep.jsx)(eQ,{className:"observation"===e?"w-[13%]":"w-[16%]",children:"Mentioned"})]})}),(0,ep.jsx)(eK,{children:l.map((t,n)=>{let r=t.occurred_start?new Date(t.occurred_start).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null,i=t.mentioned_at?new Date(t.mentioned_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null;return(0,ep.jsxs)(eZ,{onClick:()=>S(t.id),className:"cursor-pointer hover:bg-muted/50",children:[(0,ep.jsxs)(eJ,{className:"py-2",children:[(0,ep.jsx)("div",{className:"line-clamp-2 text-sm leading-snug text-foreground",children:t.text}),t.context&&"observation"!==e&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:t.context})]}),(0,ep.jsx)(eJ,{className:"py-2",children:t.entities?(0,ep.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[t.entities.split(", ").slice(0,2).map((e,t)=>(0,ep.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:e},t)),t.entities.split(", ").length>2&&(0,ep.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["+",t.entities.split(", ").length-2]})]}):(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:"-"})}),(0,ep.jsx)(eJ,{className:"py-2",children:t.tags&&t.tags.length>0?(0,ep.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[t.tags.slice(0,2).map((e,t)=>(0,ep.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md bg-amber-500/10 text-amber-700 border border-amber-500/20 font-medium font-mono",children:["#",e]},t)),t.tags.length>2&&(0,ep.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["+",t.tags.length-2]})]}):(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:"-"})}),"observation"===e&&(0,ep.jsx)(eJ,{className:"text-xs py-2 text-foreground",children:t.proof_count??1}),(0,ep.jsx)(eJ,{className:"text-xs py-2 text-foreground",children:r||(0,ep.jsx)("span",{className:"text-muted-foreground",children:"-"})}),(0,ep.jsx)(eJ,{className:"text-xs py-2 text-foreground",children:i||(0,ep.jsx)("span",{className:"text-muted-foreground",children:"-"})})]},t.id||n)})})]}),a>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[o+1,"-",Math.min(s,Y.length)," of"," ",Y.length]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>k(1),disabled:1===N,className:"h-7 w-7 p-0",children:(0,ep.jsx)(ez,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>k(e=>Math.max(1,e-1)),disabled:1===N,className:"h-7 w-7 p-0",children:(0,ep.jsx)(e_,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[N," / ",a]}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>k(e=>Math.min(a,e+1)),disabled:N===a,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>k(a),disabled:N===a,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})})]})]})]})):(0,ep.jsx)("div",{className:"text-center py-12 text-muted-foreground",children:p.table_rows?.length>0?"No memories match your filter":"No memories found"})})})}),!h&&"timeline"===u&&(0,ep.jsx)(fF,{data:p,filteredRows:Y,bankId:c||void 0,onMemoryClick:e=>S(e)})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"📊"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No data available"})]})}),(0,ep.jsx)(tJ,{memoryId:_,onClose:()=>S(null)})]})}function fF({data:e,filteredRows:t,bankId:n,onMemoryClick:r}){let[i,a]=(0,em.useState)("month"),[o,s]=(0,em.useState)(0),l=(0,em.useRef)(null),{sortedItems:c,itemsWithoutDates:u}=(0,em.useMemo)(()=>t&&0!==t.length?{sortedItems:t.filter(e=>e.occurred_start).sort((e,t)=>new Date(e.occurred_start).getTime()-new Date(t.occurred_start).getTime()),itemsWithoutDates:t.filter(e=>!e.occurred_start)}:{sortedItems:[],itemsWithoutDates:[]},[t]),d=(0,em.useMemo)(()=>{if(0===c.length)return[];let e={};return c.forEach(t=>{let n=new Date(t.occurred_start),r=(e=>{let t=e.getFullYear(),n=e.getMonth(),r=e.getDate();switch(i){case"year":return`${t}`;case"month":return`${t}-${String(n+1).padStart(2,"0")}`;case"week":let a=new Date(e);return a.setDate(r-e.getDay()),`${a.getFullYear()}-W${String(Math.ceil(a.getDate()/7)).padStart(2,"0")}-${String(a.getMonth()+1).padStart(2,"0")}-${String(a.getDate()).padStart(2,"0")}`;case"day":return`${t}-${String(n+1).padStart(2,"0")}-${String(r).padStart(2,"0")}`}})(n);if(!e[r]){let t=n;if("week"===i){let e=r.split("-");t=new Date(parseInt(e[0]),parseInt(e[2])-1,parseInt(e[3]))}e[r]={items:[],date:t}}e[r].items.push(t)}),Object.entries(e).sort(([,e],[,t])=>e.date.getTime()-t.date.getTime()).map(([e,{items:t,date:n}])=>({key:e,label:((e,t)=>{switch(i){case"year":return e;case"month":return t.toLocaleDateString("en-US",{year:"numeric",month:"short"});case"week":let n=new Date(t);return n.setDate(t.getDate()+6),`${t.toLocaleDateString("en-US",{month:"short",day:"numeric"})} - ${n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}`;case"day":return t.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",year:"numeric"})}})(e,n),items:t,date:n}))},[c,i]),h=(0,em.useMemo)(()=>0===c.length?null:{first:new Date(c[0].occurred_start),last:new Date(c[c.length-1].occurred_start)},[c]),f=e=>{let t=Math.max(0,Math.min(e,d.length-1));s(t);let n=document.getElementById(`timeline-group-${t}`);n?.scrollIntoView({behavior:"smooth",block:"start"})};if(0===c.length)return(0,ep.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,ep.jsx)(eI,{className:"w-12 h-12 text-muted-foreground mb-3"}),(0,ep.jsx)("div",{className:"text-base font-medium text-foreground mb-1",children:"No Timeline Data"}),(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground text-center max-w-md",children:["No memories have occurred_at dates.",u.length>0&&(0,ep.jsxs)("span",{className:"block mt-1",children:[u.length," memories without dates in Table View."]})]})]});let p=e=>{let t=new Date(e);return{date:t.toLocaleDateString("en-US",{month:"short",day:"numeric"}),time:t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}};return(0,ep.jsx)("div",{className:"px-4",children:(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-3 gap-4",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[c.length," memories",u.length>0&&` \xb7 ${u.length} without dates`,h&&(0,ep.jsxs)("span",{className:"ml-2 text-foreground",children:["(",h.first.toLocaleDateString("en-US",{month:"short",year:"numeric"})," ","→ ",h.last.toLocaleDateString("en-US",{month:"short",year:"numeric"}),")"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsxs)("div",{className:"flex items-center border border-border rounded mr-2",children:[(0,ep.jsx)(eD.Button,{variant:"secondary",size:"sm",onClick:()=>{let e=["year","month","week","day"],t=e.indexOf(i);t>0&&a(e[t-1])},disabled:"year"===i,className:"h-7 w-7 p-0",title:"Zoom out",children:(0,ep.jsx)(eB,{className:"h-3 w-3"})}),(0,ep.jsx)("span",{className:"text-[10px] px-2 min-w-[50px] text-center border-x border-border text-foreground",children:{year:"Year",month:"Month",week:"Week",day:"Day"}[i]}),(0,ep.jsx)(eD.Button,{variant:"secondary",size:"sm",onClick:()=>{let e=["year","month","week","day"],t=e.indexOf(i);t<e.length-1&&a(e[t+1])},disabled:"day"===i,className:"h-7 w-7 p-0",title:"Zoom in",children:(0,ep.jsx)(eR,{className:"h-3 w-3"})})]}),(0,ep.jsxs)("div",{className:"flex items-center border border-border rounded",children:[(0,ep.jsx)(eD.Button,{variant:"secondary",size:"sm",onClick:()=>f(0),disabled:d.length<=1,className:"h-7 w-7 p-0",title:"First",children:(0,ep.jsx)(ez,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"secondary",size:"sm",onClick:()=>f(o-1),disabled:0===o,className:"h-7 w-7 p-0",title:"Previous",children:(0,ep.jsx)(e_,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-[10px] px-2 min-w-[60px] text-center border-x border-border text-foreground",children:[o+1," / ",d.length]}),(0,ep.jsx)(eD.Button,{variant:"secondary",size:"sm",onClick:()=>f(o+1),disabled:o>=d.length-1,className:"h-7 w-7 p-0",title:"Next",children:(0,ep.jsx)(eS.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"secondary",size:"sm",onClick:()=>f(d.length-1),disabled:d.length<=1,className:"h-7 w-7 p-0",title:"Last",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})})]})]})]}),(0,ep.jsxs)("div",{ref:l,className:"relative max-h-[550px] overflow-y-auto pr-2",children:[(0,ep.jsx)("div",{className:"absolute left-[60px] top-0 bottom-0 w-0.5 bg-border"}),d.map((e,t)=>(0,ep.jsxs)("div",{id:`timeline-group-${t}`,className:"mb-4",children:[(0,ep.jsxs)("div",{className:"flex items-center mb-2 cursor-pointer hover:opacity-80",onClick:()=>s(t),children:[(0,ep.jsx)("div",{className:"w-[60px] text-right pr-3",children:(0,ep.jsx)("span",{className:"text-xs font-semibold text-primary",children:e.label})}),(0,ep.jsx)("div",{className:"w-2 h-2 rounded-full bg-primary z-10"}),(0,ep.jsxs)("span",{className:"ml-2 text-[10px] text-muted-foreground",children:[e.items.length," ",1===e.items.length?"item":"items"]})]}),(0,ep.jsx)("div",{className:"space-y-1",children:e.items.map((e,t)=>(0,ep.jsxs)("div",{onClick:()=>r(e.id),className:"flex items-start cursor-pointer group hover:opacity-80",children:[(0,ep.jsxs)("div",{className:"w-[60px] text-right pr-3 pt-1 flex-shrink-0",children:[(0,ep.jsx)("div",{className:"text-[10px] text-muted-foreground",children:p(e.occurred_start).date}),(0,ep.jsx)("div",{className:"text-[9px] text-muted-foreground/70",children:p(e.occurred_start).time})]}),(0,ep.jsx)("div",{className:"flex-shrink-0 pt-2",children:(0,ep.jsx)("div",{className:"w-1.5 h-1.5 rounded-full z-10 bg-muted-foreground/50 group-hover:bg-primary"})}),(0,ep.jsxs)("div",{className:"ml-3 flex-1 p-2 rounded border transition-colors bg-card border-border hover:border-primary/50",children:[(0,ep.jsx)("p",{className:"text-xs text-foreground line-clamp-2 leading-relaxed",children:e.text}),e.context&&(0,ep.jsx)("p",{className:"text-[10px] text-muted-foreground mt-1 truncate",children:e.context}),e.entities&&(0,ep.jsxs)("div",{className:"flex gap-1 mt-1 flex-wrap",children:[e.entities.split(", ").slice(0,3).map((e,t)=>(0,ep.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:e},t)),e.entities.split(", ").length>3&&(0,ep.jsxs)("span",{className:"text-[9px] text-muted-foreground",children:["+",e.entities.split(", ").length-3]})]})]})]},e.id||t))})]},e.key))]})]})})}var fV=e.i(26330),fU=e.i(3536),fH=e.i(65491),fW=e.i(10772),fY=e.i(53660),fG=e.i(74606),f$=e.i(96626),fX=e.i(42727),fq=Symbol("radix.slottable");function fK(e){return em.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===fq}var fZ=e.i(30207),fQ=e.i(86312),fJ=e.i(85369),f0=["Enter"," "],f1=["ArrowUp","PageDown","End"],f2=["ArrowDown","PageUp","Home",...f1],f5={ltr:[...f0,"ArrowRight"],rtl:[...f0,"ArrowLeft"]},f3={ltr:["ArrowLeft"],rtl:["ArrowRight"]},f4="Menu",[f6,f8,f7]=(0,to.createCollection)(f4),[f9,pe]=(0,te.createContextScope)(f4,[f7,fY.createPopperScope,fX.createRovingFocusGroupScope]),pt=(0,fY.createPopperScope)(),pn=(0,fX.createRovingFocusGroupScope)(),[pr,pi]=f9(f4),[pa,po]=f9(f4),ps=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=pt(t),[l,c]=em.useState(null),u=em.useRef(!1),d=(0,fZ.useCallbackRef)(a),h=(0,tn.useDirection)(i);return em.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,ep.jsx)(fY.Root,{...s,children:(0,ep.jsx)(pr,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,ep.jsx)(pa,{scope:t,onClose:em.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:o,children:r})})})};ps.displayName=f4;var pl=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=pt(n);return(0,ep.jsx)(fY.Anchor,{...i,...r,ref:t})});pl.displayName="MenuAnchor";var pc="MenuPortal",[pu,pd]=f9(pc,{forceMount:void 0}),ph=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=pi(pc,t);return(0,ep.jsx)(pu,{scope:t,forceMount:n,children:(0,ep.jsx)(f$.Presence,{present:n||a.open,children:(0,ep.jsx)(fG.Portal,{asChild:!0,container:i,children:r})})})};ph.displayName=pc;var pf="MenuContent",[pp,pm]=f9(pf),pg=em.forwardRef((e,t)=>{let n=pd(pf,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=pi(pf,e.__scopeMenu),o=po(pf,e.__scopeMenu);return(0,ep.jsx)(f6.Provider,{scope:e.__scopeMenu,children:(0,ep.jsx)(f$.Presence,{present:r||a.open,children:(0,ep.jsx)(f6.Slot,{scope:e.__scopeMenu,children:o.modal?(0,ep.jsx)(pv,{...i,ref:t}):(0,ep.jsx)(px,{...i,ref:t})})})})}),pv=em.forwardRef((e,t)=>{let n=pi(pf,e.__scopeMenu),r=em.useRef(null),i=(0,e9.useComposedRefs)(t,r);return em.useEffect(()=>{let e=r.current;if(e)return(0,fQ.hideOthers)(e)},[]),(0,ep.jsx)(pb,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:(0,e7.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),px=em.forwardRef((e,t)=>{let n=pi(pf,e.__scopeMenu);return(0,ep.jsx)(pb,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),py=((o=em.forwardRef((e,t)=>{let{children:n,...r}=e;if(em.isValidElement(n)){var i;let e,a,o=(i=n,(a=(e=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.ref:(a=(e=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?i.props.ref:i.props.ref||i.ref),s=function(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...a}:"className"===r&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==em.Fragment&&(s.ref=t?(0,e9.composeRefs)(t,o):o),em.cloneElement(n,s)}return em.Children.count(n)>1?em.Children.only(null):null})).displayName="MenuContent.ScrollLock.SlotClone",n=o,(r=em.forwardRef((e,t)=>{let{children:r,...i}=e,a=em.Children.toArray(r),o=a.find(fK);if(o){let e=o.props.children,r=a.map(t=>t!==o?t:em.Children.count(e)>1?em.Children.only(null):em.isValidElement(e)?e.props.children:null);return(0,ep.jsx)(n,{...i,ref:t,children:em.isValidElement(e)?em.cloneElement(e,void 0,r):null})}return(0,ep.jsx)(n,{...i,ref:t,children:r})})).displayName="MenuContent.ScrollLock.Slot",r),pb=em.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,disableOutsideScroll:p,...g}=e,v=pi(pf,n),x=po(pf,n),y=pt(n),b=pn(n),w=f8(n),[j,N]=em.useState(null),k=em.useRef(null),C=(0,e9.useComposedRefs)(t,k,v.onContentChange),E=em.useRef(0),_=em.useRef(""),S=em.useRef(0),T=em.useRef(null),A=em.useRef("right"),O=em.useRef(0),M=p?fJ.RemoveScroll:em.Fragment;em.useEffect(()=>()=>window.clearTimeout(E.current),[]),(0,fU.useFocusGuards)();let P=em.useCallback(e=>{var t,n;return A.current===T.current?.side&&(t=e,!!(n=T.current?.area)&&function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],l=o.x,c=o.y,u=s.x,d=s.y;c>r!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(i=!i)}return i}({x:t.clientX,y:t.clientY},n))},[]);return(0,ep.jsx)(pp,{scope:n,searchRef:_,onItemEnter:em.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:em.useCallback(e=>{P(e)||(k.current?.focus(),N(null))},[P]),onTriggerLeave:em.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:S,onPointerGraceIntentChange:em.useCallback(e=>{T.current=e},[]),children:(0,ep.jsx)(M,{...p?{as:py,allowPinchZoom:!0}:void 0,children:(0,ep.jsx)(fH.FocusScope,{asChild:!0,trapped:i,onMountAutoFocus:(0,e7.composeEventHandlers)(a,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,ep.jsx)(fV.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:f,children:(0,ep.jsx)(fX.Root,{asChild:!0,...b,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:j,onCurrentTabStopIdChange:N,onEntryFocus:(0,e7.composeEventHandlers)(l,e=>{x.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,ep.jsx)(fY.Content,{role:"menu","aria-orientation":"vertical","data-state":pG(v.open),"data-radix-menu-content":"",dir:x.dir,...y,...g,ref:C,style:{outline:"none",...g.style},onKeyDown:(0,e7.composeEventHandlers)(g.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=1===e.key.length;if(t){var i;let t,a,o,s,l,c;"Tab"===e.key&&e.preventDefault(),!n&&r&&(i=e.key,t=_.current+i,a=w().filter(e=>!e.disabled),o=document.activeElement,s=a.find(e=>e.ref.current===o)?.textValue,l=function(e,t,n){var r;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,a=n?e.indexOf(n):-1,o=(r=Math.max(a,0),e.map((t,n)=>e[(r+n)%e.length]));1===i.length&&(o=o.filter(e=>e!==n));let s=o.find(e=>e.toLowerCase().startsWith(i.toLowerCase()));return s!==n?s:void 0}(a.map(e=>e.textValue),t,s),c=a.find(e=>e.textValue===l)?.ref.current,function e(t){_.current=t,window.clearTimeout(E.current),""!==t&&(E.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let a=k.current;if(e.target!==a||!f2.includes(e.key))return;e.preventDefault();let o=w().filter(e=>!e.disabled).map(e=>e.ref.current);f1.includes(e.key)&&o.reverse(),function(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}(o)}),onBlur:(0,e7.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),_.current="")}),onPointerMove:(0,e7.composeEventHandlers)(e.onPointerMove,pq(e=>{let t=e.target,n=O.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>O.current?"right":"left",O.current=e.clientX)}))})})})})})})});pg.displayName=pf;var pw=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(ta.Primitive.div,{role:"group",...r,ref:t})});pw.displayName="MenuGroup";var pj=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(ta.Primitive.div,{...r,ref:t})});pj.displayName="MenuLabel";var pN="MenuItem",pk="menu.itemSelect",pC=em.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=em.useRef(null),o=po(pN,e.__scopeMenu),s=pm(pN,e.__scopeMenu),l=(0,e9.useComposedRefs)(t,a),c=em.useRef(!1);return(0,ep.jsx)(pE,{...i,ref:l,disabled:n,onClick:(0,e7.composeEventHandlers)(e.onClick,()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(pk,{bubbles:!0,cancelable:!0});e.addEventListener(pk,e=>r?.(e),{once:!0}),(0,ta.dispatchDiscreteCustomEvent)(e,t),t.defaultPrevented?c.current=!1:o.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:(0,e7.composeEventHandlers)(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:(0,e7.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==s.searchRef.current;n||t&&" "===e.key||f0.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});pC.displayName=pN;var pE=em.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=pm(pN,n),s=pn(n),l=em.useRef(null),c=(0,e9.useComposedRefs)(t,l),[u,d]=em.useState(!1),[h,f]=em.useState("");return em.useEffect(()=>{let e=l.current;e&&f((e.textContent??"").trim())},[a.children]),(0,ep.jsx)(f6.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:(0,ep.jsx)(fX.Item,{asChild:!0,...s,focusable:!r,children:(0,ep.jsx)(ta.Primitive.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:c,onPointerMove:(0,e7.composeEventHandlers)(e.onPointerMove,pq(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,e7.composeEventHandlers)(e.onPointerLeave,pq(e=>o.onItemLeave(e))),onFocus:(0,e7.composeEventHandlers)(e.onFocus,()=>d(!0)),onBlur:(0,e7.composeEventHandlers)(e.onBlur,()=>d(!1))})})})}),p_=em.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,ep.jsx)(pL,{scope:e.__scopeMenu,checked:n,children:(0,ep.jsx)(pC,{role:"menuitemcheckbox","aria-checked":p$(n)?"mixed":n,...i,ref:t,"data-state":pX(n),onSelect:(0,e7.composeEventHandlers)(i.onSelect,()=>r?.(!!p$(n)||!n),{checkForDefaultPrevented:!1})})})});p_.displayName="MenuCheckboxItem";var pS="MenuRadioGroup",[pT,pA]=f9(pS,{value:void 0,onValueChange:()=>{}}),pO=em.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=(0,fZ.useCallbackRef)(r);return(0,ep.jsx)(pT,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,ep.jsx)(pw,{...i,ref:t})})});pO.displayName=pS;var pM="MenuRadioItem",pP=em.forwardRef((e,t)=>{let{value:n,...r}=e,i=pA(pM,e.__scopeMenu),a=n===i.value;return(0,ep.jsx)(pL,{scope:e.__scopeMenu,checked:a,children:(0,ep.jsx)(pC,{role:"menuitemradio","aria-checked":a,...r,ref:t,"data-state":pX(a),onSelect:(0,e7.composeEventHandlers)(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});pP.displayName=pM;var pD="MenuItemIndicator",[pL,pI]=f9(pD,{checked:!1}),pR=em.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=pI(pD,n);return(0,ep.jsx)(f$.Presence,{present:r||p$(a.checked)||!0===a.checked,children:(0,ep.jsx)(ta.Primitive.span,{...i,ref:t,"data-state":pX(a.checked)})})});pR.displayName=pD;var pB=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,ep.jsx)(ta.Primitive.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});pB.displayName="MenuSeparator";var pz=em.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=pt(n);return(0,ep.jsx)(fY.Arrow,{...i,...r,ref:t})});pz.displayName="MenuArrow";var[pF,pV]=f9("MenuSub"),pU="MenuSubTrigger",pH=em.forwardRef((e,t)=>{let n=pi(pU,e.__scopeMenu),r=po(pU,e.__scopeMenu),i=pV(pU,e.__scopeMenu),a=pm(pU,e.__scopeMenu),o=em.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=a,c={__scopeMenu:e.__scopeMenu},u=em.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return em.useEffect(()=>u,[u]),em.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),l(null)}},[s,l]),(0,ep.jsx)(pl,{asChild:!0,...c,children:(0,ep.jsx)(pE,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":pG(n.open),...e,ref:(0,e9.composeRefs)(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:(0,e7.composeEventHandlers)(e.onPointerMove,pq(t=>{a.onItemEnter(t),!t.defaultPrevented&&(e.disabled||n.open||o.current||(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100)))})),onPointerLeave:(0,e7.composeEventHandlers)(e.onPointerLeave,pq(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i="right"===r,o=t[i?"left":"right"],l=t[i?"right":"left"];a.onPointerGraceIntentChange({area:[{x:e.clientX+(i?-5:5),y:e.clientY},{x:o,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:o,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:(0,e7.composeEventHandlers)(e.onKeyDown,t=>{let i=""!==a.searchRef.current;e.disabled||i&&" "===t.key||f5[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});pH.displayName=pU;var pW="MenuSubContent",pY=em.forwardRef((e,t)=>{let n=pd(pf,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=pi(pf,e.__scopeMenu),o=po(pf,e.__scopeMenu),s=pV(pW,e.__scopeMenu),l=em.useRef(null),c=(0,e9.useComposedRefs)(t,l);return(0,ep.jsx)(f6.Provider,{scope:e.__scopeMenu,children:(0,ep.jsx)(f$.Presence,{present:r||a.open,children:(0,ep.jsx)(f6.Slot,{scope:e.__scopeMenu,children:(0,ep.jsx)(pb,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:c,align:"start",side:"rtl"===o.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,e7.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:(0,e7.composeEventHandlers)(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:(0,e7.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=f3[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});function pG(e){return e?"open":"closed"}function p$(e){return"indeterminate"===e}function pX(e){return p$(e)?"indeterminate":e?"checked":"unchecked"}function pq(e){return t=>"mouse"===t.pointerType?e(t):void 0}pY.displayName=pW;var pK="DropdownMenu",[pZ,pQ]=(0,te.createContextScope)(pK,[pe]),pJ=pe(),[p0,p1]=pZ(pK),p2=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,l=pJ(t),c=em.useRef(null),[u,d]=(0,tt.useControllableState)({prop:i,defaultProp:a??!1,onChange:o,caller:pK});return(0,ep.jsx)(p0,{scope:t,triggerId:(0,fW.useId)(),triggerRef:c,contentId:(0,fW.useId)(),open:u,onOpenChange:d,onOpenToggle:em.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,ep.jsx)(ps,{...l,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};p2.displayName=pK;var p5="DropdownMenuTrigger",p3=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=p1(p5,n),o=pJ(n);return(0,ep.jsx)(pl,{asChild:!0,...o,children:(0,ep.jsx)(ta.Primitive.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:(0,e9.composeRefs)(t,a.triggerRef),onPointerDown:(0,e7.composeEventHandlers)(e.onPointerDown,e=>{!r&&0===e.button&&!1===e.ctrlKey&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:(0,e7.composeEventHandlers)(e.onKeyDown,e=>{!r&&(["Enter"," "].includes(e.key)&&a.onOpenToggle(),"ArrowDown"===e.key&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});p3.displayName=p5;var p4=e=>{let{__scopeDropdownMenu:t,...n}=e,r=pJ(t);return(0,ep.jsx)(ph,{...r,...n})};p4.displayName="DropdownMenuPortal";var p6="DropdownMenuContent",p8=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=p1(p6,n),a=pJ(n),o=em.useRef(!1);return(0,ep.jsx)(pg,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:(0,e7.composeEventHandlers)(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:(0,e7.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey,r=2===t.button||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});p8.displayName=p6,em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pJ(n);return(0,ep.jsx)(pw,{...i,...r,ref:t})}).displayName="DropdownMenuGroup";var p7=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pJ(n);return(0,ep.jsx)(pj,{...i,...r,ref:t})});p7.displayName="DropdownMenuLabel";var p9=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pJ(n);return(0,ep.jsx)(pC,{...i,...r,ref:t})});p9.displayName="DropdownMenuItem";var me=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pJ(n);return(0,ep.jsx)(p_,{...i,...r,ref:t})});me.displayName="DropdownMenuCheckboxItem",em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pJ(n);return(0,ep.jsx)(pO,{...i,...r,ref:t})}).displayName="DropdownMenuRadioGroup";var mt=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pJ(n);return(0,ep.jsx)(pP,{...i,...r,ref:t})});mt.displayName="DropdownMenuRadioItem";var mn=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pJ(n);return(0,ep.jsx)(pR,{...i,...r,ref:t})});mn.displayName="DropdownMenuItemIndicator";var mr=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pJ(n);return(0,ep.jsx)(pB,{...i,...r,ref:t})});mr.displayName="DropdownMenuSeparator",em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pJ(n);return(0,ep.jsx)(pz,{...i,...r,ref:t})}).displayName="DropdownMenuArrow";var mi=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pJ(n);return(0,ep.jsx)(pH,{...i,...r,ref:t})});mi.displayName="DropdownMenuSubTrigger";var ma=em.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pJ(n);return(0,ep.jsx)(pY,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ma.displayName="DropdownMenuSubContent";let mo=(0,ej.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);em.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,ep.jsxs)(mi,{ref:i,className:(0,eA.cn)("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[n,(0,ep.jsx)(eS.ChevronRight,{className:"ml-auto"})]})).displayName=mi.displayName,em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(ma,{ref:n,className:(0,eA.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t})).displayName=ma.displayName;let ms=em.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,ep.jsx)(p4,{children:(0,ep.jsx)(p8,{ref:r,sideOffset:t,className:(0,eA.cn)("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));ms.displayName=p8.displayName;let ml=em.forwardRef(({className:e,inset:t,...n},r)=>(0,ep.jsx)(p9,{ref:r,className:(0,eA.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...n}));ml.displayName=p9.displayName,em.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,ep.jsxs)(me,{ref:i,className:(0,eA.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[(0,ep.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ep.jsx)(mn,{children:(0,ep.jsx)(tF.Check,{className:"h-4 w-4"})})}),t]})).displayName=me.displayName,em.forwardRef(({className:e,children:t,...n},r)=>(0,ep.jsxs)(mt,{ref:r,className:(0,eA.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[(0,ep.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,ep.jsx)(mn,{children:(0,ep.jsx)(mo,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=mt.displayName,em.forwardRef(({className:e,inset:t,...n},r)=>(0,ep.jsx)(p7,{ref:r,className:(0,eA.cn)("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n})).displayName=p7.displayName;let mc=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(mr,{ref:n,className:(0,eA.cn)("-mx-1 my-1 h-px bg-muted",e),...t}));mc.displayName=mr.displayName;var mu=e.i(26999),md=Symbol("radix.slottable"),mh="AlertDialog",[mf,mp]=(0,te.createContextScope)(mh,[mu.createDialogScope]),mm=(0,mu.createDialogScope)(),mg=e=>{let{__scopeAlertDialog:t,...n}=e,r=mm(t);return(0,ep.jsx)(mu.Root,{...r,...n,modal:!0})};mg.displayName=mh,em.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=mm(n);return(0,ep.jsx)(mu.Trigger,{...i,...r,ref:t})}).displayName="AlertDialogTrigger";var mv=e=>{let{__scopeAlertDialog:t,...n}=e,r=mm(t);return(0,ep.jsx)(mu.Portal,{...r,...n})};mv.displayName="AlertDialogPortal";var mx=em.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=mm(n);return(0,ep.jsx)(mu.Overlay,{...i,...r,ref:t})});mx.displayName="AlertDialogOverlay";var my="AlertDialogContent",[mb,mw]=mf(my),mj=((i=({children:e})=>(0,ep.jsx)(ep.Fragment,{children:e})).displayName="AlertDialogContent.Slottable",i.__radixId=md,i),mN=em.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=mm(n),o=em.useRef(null),s=(0,e9.useComposedRefs)(t,o),l=em.useRef(null);return(0,ep.jsx)(mu.WarningProvider,{contentName:my,titleName:mk,docsSlug:"alert-dialog",children:(0,ep.jsx)(mb,{scope:n,cancelRef:l,children:(0,ep.jsxs)(mu.Content,{role:"alertdialog",...a,...i,ref:s,onOpenAutoFocus:(0,e7.composeEventHandlers)(i.onOpenAutoFocus,e=>{e.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,ep.jsx)(mj,{children:r}),(0,ep.jsx)(mO,{contentRef:o})]})})})});mN.displayName=my;var mk="AlertDialogTitle",mC=em.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=mm(n);return(0,ep.jsx)(mu.Title,{...i,...r,ref:t})});mC.displayName=mk;var mE="AlertDialogDescription",m_=em.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=mm(n);return(0,ep.jsx)(mu.Description,{...i,...r,ref:t})});m_.displayName=mE;var mS=em.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=mm(n);return(0,ep.jsx)(mu.Close,{...i,...r,ref:t})});mS.displayName="AlertDialogAction";var mT="AlertDialogCancel",mA=em.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=mw(mT,n),a=mm(n),o=(0,e9.useComposedRefs)(t,i);return(0,ep.jsx)(mu.Close,{...a,...r,ref:o})});mA.displayName=mT;var mO=({contentRef:e})=>{let t=`\`${my}\` requires a description for the component to be accessible for screen reader users.
2
-
3
- You can add a description to the \`${my}\` by passing a \`${mE}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
4
-
5
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${my}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
6
-
7
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return em.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null};let mM=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(mx,{className:(0,eA.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));mM.displayName=mx.displayName;let mP=em.forwardRef(({className:e,...t},n)=>(0,ep.jsxs)(mv,{children:[(0,ep.jsx)(mM,{}),(0,ep.jsx)(mN,{ref:n,className:(0,eA.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));mP.displayName=mN.displayName;let mD=({className:e,...t})=>(0,ep.jsx)("div",{className:(0,eA.cn)("flex flex-col space-y-2 text-center sm:text-left",e),...t});mD.displayName="AlertDialogHeader";let mL=({className:e,...t})=>(0,ep.jsx)("div",{className:(0,eA.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});mL.displayName="AlertDialogFooter";let mI=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(mC,{ref:n,className:(0,eA.cn)("text-lg font-semibold",e),...t}));mI.displayName=mC.displayName;let mR=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(m_,{ref:n,className:(0,eA.cn)("text-sm text-muted-foreground",e),...t}));mR.displayName=m_.displayName;let mB=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(mS,{ref:n,className:(0,eA.cn)((0,eD.buttonVariants)(),e),...t}));mB.displayName=mS.displayName;let mz=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)(mA,{ref:n,className:(0,eA.cn)((0,eD.buttonVariants)({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));mz.displayName=mA.displayName;let mF=(0,ej.default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),mV=(0,ej.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),mU=(0,ej.default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);var mH=e.i(64659);function mW(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return"just now";let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);if(i<30)return`${i}d ago`;let a=Math.floor(i/30);return a<12?`${a}mo ago`:`${Math.floor(a/12)}y ago`}function mY(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function mG({metadata:e}){let t=Object.entries(e);return 0===t.length?(0,ep.jsx)("span",{children:"-"}):(0,ep.jsxs)("div",{className:"flex flex-wrap gap-1",children:[t.slice(0,3).map(([e,t])=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium",children:[e,"=",String(t)]},e)),t.length>3&&(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",t.length-3]})]})}function m$({children:e}){return(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground mb-1",children:e})}function mX({title:e,icon:t,children:n}){return(0,ep.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5 px-4 py-2 border-b border-border bg-muted/40 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[t,e]}),(0,ep.jsx)("div",{className:"p-4 space-y-4",children:n})]})}function mq({label:e,value:t}){return(0,ep.jsxs)("div",{children:[(0,ep.jsx)(m$,{children:e}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:t})]})}function mK({nodesByFactType:e}){let t=e??{world:0,experience:0,observation:0},n=t.world+t.experience+t.observation,r=[{name:"World",value:t.world,color:"#8b5cf6"},{name:"Experience",value:t.experience,color:"#ec4899"},{name:"Observations",value:t.observation,color:"#6366f1"}];return(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("h4",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em]",children:"Memory composition"}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:n.toLocaleString()})]}),0===n?(0,ep.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:"No memories yet"}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:r.filter(e=>e.value>0).map(e=>(0,ep.jsx)("div",{className:"h-full",style:{width:`${e.value/n*100}%`,backgroundColor:e.color},title:`${e.name}: ${e.value.toLocaleString()}`},e.name))}),(0,ep.jsx)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:r.map(e=>(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color}}),(0,ep.jsx)("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:e.name})]}),(0,ep.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums",children:e.value.toLocaleString()}),(0,ep.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:n>0?`${(e.value/n*100).toFixed(0)}%`:"0%"})]})]},e.name))})]})]})}function mZ({chunkFactType:e,setChunkFactType:t}){return(0,ep.jsx)("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border bg-muted/30",children:["world","experience","observation"].map(n=>(0,ep.jsx)("button",{onClick:()=>t(n),className:`px-2 py-0.5 rounded text-[11px] font-medium transition-colors ${e===n?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"observation"===n?"Obs":n.charAt(0).toUpperCase()+n.slice(1)},n))})}function mQ({chunk:e}){let[t,n]=(0,em.useState)(!1),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)("world"),s=e.chunk_text??"",l=s.length>150?s.slice(0,150)+"...":s;return(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("button",{className:"w-full flex items-center gap-3 px-4 py-2 text-left hover:bg-muted/30 transition-colors",onClick:()=>n(!t),children:[(0,ep.jsx)(mH.ChevronDown,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform ${t?"":"-rotate-90"}`}),(0,ep.jsxs)("span",{className:"text-xs font-mono text-muted-foreground shrink-0",children:["#",e.chunk_index]}),(0,ep.jsxs)("span",{className:"text-[11px] text-muted-foreground/60 shrink-0",children:[s.length.toLocaleString()," chars"]}),!t&&(0,ep.jsx)("span",{className:"text-xs text-foreground/50 truncate",children:l})]}),t&&(r?(0,ep.jsxs)("div",{style:{height:"500px"},className:"flex flex-col border-t border-border",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/30 border-b border-border",children:[(0,ep.jsx)(mZ,{chunkFactType:a,setChunkFactType:o}),(0,ep.jsx)("div",{className:"flex-1"}),(0,ep.jsxs)(eD.Button,{variant:"ghost",size:"sm",onClick:()=>i(!1),className:"h-6 px-2 text-xs gap-1",children:[(0,ep.jsx)(eU,{className:"w-3 h-3"}),"Compact"]})]}),(0,ep.jsx)("div",{className:"flex-1 min-h-0",children:(0,ep.jsx)(fz,{factType:a,chunkId:e.chunk_id},`${e.chunk_id}-${a}-full`)})]}):(0,ep.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border",style:{height:"350px"},children:[(0,ep.jsx)("div",{className:"overflow-y-auto",children:(0,ep.jsx)("pre",{className:"px-4 py-3 text-[11px] leading-5 text-foreground/80 whitespace-pre-wrap font-mono",children:s})}),(0,ep.jsxs)("div",{className:"flex flex-col overflow-hidden",children:[(0,ep.jsx)(mZ,{chunkFactType:a,setChunkFactType:o}),(0,ep.jsx)("div",{className:"flex-1 min-h-0",children:(0,ep.jsx)(fz,{factType:a,chunkId:e.chunk_id,compact:!0,onExpandToggle:()=>i(!0)},`${e.chunk_id}-${a}-compact`)})]})]}))]})}function mJ(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)(""),[s,l]=(0,em.useState)(0),[c,u]=(0,em.useState)(1),d=Math.ceil(s/50),h=(c-1)*50,[f,p]=(0,em.useState)(null),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(null),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(""),[k,C]=(0,em.useState)(!1),[E,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(""),[A,O]=(0,em.useState)(!1),[M,P]=(0,em.useState)([]),[D,L]=(0,em.useState)(0),[I,R]=(0,em.useState)(!1),[B,z]=(0,em.useState)(!1),[F,V]=(0,em.useState)(!1),[U,H]=(0,em.useState)(null),[W,Y]=(0,em.useState)(null),[G,$]=(0,em.useState)(null),X=async(t=1)=>{if(e){i(!0);try{let r=await eP.client.listDocuments({bank_id:e,q:a,limit:50,offset:(t-1)*50});n(r.items||[]),l(r.total||0)}catch(e){}finally{i(!1)}}},q=e=>{u(e),X(e)},K=async t=>{if(e){v(!0),p({id:t}),w(!1),N(""),_(!1),T(""),P([]),L(0),z(!1);try{let n=await eP.client.getDocument(t,e);p(n)}catch(e){p(null)}finally{v(!1)}}},Z=async t=>{if(e){R(!0);try{let n=await eP.client.listDocumentChunks({document_id:t,bank_id:e,limit:100});P(n.items||[]),L(n.total||0),z(!0)}catch(e){}finally{R(!1)}}},Q=async()=>{if(e&&f){V(!0);try{let t=await eP.client.reprocessDocument(f.id,e);H({success:!0,message:`Reprocessing started (operation: ${t.operation_id})`})}catch(e){H({success:!1,message:"Error reprocessing document: "+e.message})}finally{V(!1)}}},J=async()=>{if(!e||!W)return;let t=W.id;y(t),Y(null);try{let n=await eP.client.deleteDocument(t,e);$({success:!0,message:`Deleted document and ${n.memory_units_deleted} memory units.`}),f?.id===t&&p(null),X(c)}catch(e){console.error("Error deleting document:",e),$({success:!1,message:"Error deleting document: "+e.message})}finally{y(null)}},ee=()=>{w(!1),N("")},et=async()=>{if(!e||!f||!S.trim())return;let t=f.retain_params??{},n={content:S,document_id:f.id};t.context&&(n.context=t.context),t.event_date&&(n.timestamp=t.event_date),t.metadata&&Object.keys(t.metadata).length>0&&(n.metadata=t.metadata),f.tags&&f.tags.length>0&&(n.tags=f.tags),O(!0);try{await eP.client.retain({bank_id:e,items:[n],async:!1});let t=await eP.client.getDocument(f.id,e);p(t),_(!1),T(""),X(c)}catch(e){console.error("Error updating document content:",e)}finally{O(!1)}},en=async()=>{if(!e||!f)return;let t=j.split(",").map(e=>e.trim()).filter(e=>e.length>0);C(!0);try{await eP.client.updateDocument(f.id,e,t),p({...f,tags:t}),n(e=>e.map(e=>e.id===f.id?{...e,tags:t}:e)),w(!1),N("")}catch(e){console.error("Error updating document tags:",e)}finally{C(!1)}};return(0,em.useEffect)(()=>{e&&(u(1),X(1))},[e]),(0,em.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{u(1),X(1)},300);return()=>clearTimeout(t)},[a]),(0,ep.jsxs)("div",{children:[r?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading documents..."})]})}):t.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"mb-4 text-sm text-muted-foreground",children:[s," ",1===s?"document":"documents"]}),(0,ep.jsxs)("div",{className:"w-full",children:[(0,ep.jsx)("div",{className:"px-5 mb-4",children:(0,ep.jsx)(eL.Input,{type:"text",value:a,onChange:e=>o(e.target.value),placeholder:"Search documents (ID)...",className:"max-w-2xl"})}),(0,ep.jsx)("div",{className:"overflow-x-auto px-5 pb-5",children:(0,ep.jsxs)(eX,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{children:"Document ID"}),(0,ep.jsx)(eQ,{children:"Created"}),(0,ep.jsx)(eQ,{children:"Updated"}),(0,ep.jsx)(eQ,{children:"Tags"}),(0,ep.jsx)(eQ,{children:"Metadata"}),(0,ep.jsx)(eQ,{children:"Size"}),(0,ep.jsx)(eQ,{children:"Memory Units"})]})}),(0,ep.jsx)(eK,{children:t.length>0?t.map(e=>(0,ep.jsxs)(eZ,{className:`cursor-pointer hover:bg-muted/50 ${f?.id===e.id?"bg-primary/10":""}`,onClick:()=>K(e.id),children:[(0,ep.jsx)(eJ,{className:"text-card-foreground font-mono text-xs break-all",children:e.id}),(0,ep.jsx)(eJ,{className:"text-card-foreground",title:e.created_at?new Date(e.created_at).toLocaleString():"",children:e.created_at?mW(e.created_at):"N/A"}),(0,ep.jsx)(eJ,{className:"text-card-foreground",title:e.updated_at?new Date(e.updated_at).toLocaleString():"",children:e.updated_at?mW(e.updated_at):"N/A"}),(0,ep.jsx)(eJ,{className:"text-card-foreground",children:e.tags&&e.tags.length>0?(0,ep.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.tags.slice(0,3).map((e,t)=>(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:e},t)),e.tags.length>3&&(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 text-muted-foreground",children:["+",e.tags.length-3]})]}):"-"}),(0,ep.jsx)(eJ,{className:"text-card-foreground",children:e.document_metadata&&Object.keys(e.document_metadata).length>0?(0,ep.jsx)(mG,{metadata:e.document_metadata}):"-"}),(0,ep.jsx)(eJ,{className:"text-card-foreground",children:mY(e.text_length||0)}),(0,ep.jsx)(eJ,{className:"text-card-foreground",children:e.memory_unit_count})]},e.id)):(0,ep.jsx)(eZ,{children:(0,ep.jsx)(eJ,{colSpan:7,className:"text-center",children:'Click "Load Documents" to view data'})})})]})}),d>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t px-5",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[h+1,"-",Math.min(h+50,s)," of ",s]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>q(1),disabled:1===c||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(ez,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>q(c-1),disabled:1===c||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(e_,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[c," / ",d]}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>q(c+1),disabled:c===d||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>q(d),disabled:c===d||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})})]})]})]})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"📄"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No documents found"})]})}),(0,ep.jsx)(tW.Dialog,{open:!!f,onOpenChange:e=>!e&&p(null),children:(0,ep.jsxs)(tW.DialogContent,{className:"w-[95vw] max-w-[95vw] h-[92vh] sm:max-w-[95vw] flex flex-col overflow-hidden",children:[(0,ep.jsx)(tW.DialogHeader,{className:"pr-10",children:(0,ep.jsx)(tW.DialogTitle,{className:"flex items-center gap-2",children:(0,ep.jsx)("span",{className:"truncate font-mono text-sm",children:f?.id??"Document"})})}),g?(0,ep.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading document..."})]})}):f?(0,ep.jsxs)(tG.Tabs,{defaultValue:"general",className:"flex-1 flex flex-col overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ep.jsxs)(tG.TabsList,{className:"grid grid-cols-3 w-full max-w-md",children:[(0,ep.jsxs)(tG.TabsTrigger,{value:"general",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eT,{className:"w-3.5 h-3.5"}),"General"]}),(0,ep.jsxs)(tG.TabsTrigger,{value:"content",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),"Content"]}),(0,ep.jsxs)(tG.TabsTrigger,{value:"chunks",className:"flex items-center gap-1.5",onClick:()=>{!B&&f?.id&&Z(f.id)},children:[(0,ep.jsx)(t$,{className:"w-3.5 h-3.5"}),"Chunks",B?` (${D})`:""]})]}),(0,ep.jsxs)(p2,{children:[(0,ep.jsx)(p3,{asChild:!0,children:(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0",disabled:F,"aria-label":"Actions",children:(0,ep.jsx)(mU,{className:"h-4 w-4"})})}),(0,ep.jsxs)(ms,{align:"end",children:[(0,ep.jsxs)(ml,{onClick:Q,disabled:F,children:[(0,ep.jsx)(eH,{className:"h-4 w-4 mr-2"}),"Reprocess"]}),(0,ep.jsx)(mc,{}),(0,ep.jsxs)(ml,{onClick:()=>{Y({id:f.id,memoryCount:f.memory_unit_count})},className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ep.jsx)(mF,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,ep.jsx)(tG.TabsContent,{value:"content",className:"mt-0",children:void 0!==f.original_text&&(E?(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("div",{className:"flex items-center justify-end mb-2",children:(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(eD.Button,{size:"sm",onClick:et,disabled:A||!S.trim(),className:"h-7 px-3 gap-1 text-xs",children:[A?(0,ep.jsx)("span",{className:"animate-spin",children:"⏳"}):(0,ep.jsx)(tF.Check,{className:"h-3 w-3"}),"Save"]}),(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",onClick:()=>{_(!1),T("")},disabled:A,className:"h-7 px-3 gap-1 text-xs",children:[(0,ep.jsx)(tV.X,{className:"h-3 w-3"}),"Cancel"]})]})}),(0,ep.jsx)("textarea",{value:S,onChange:e=>T(e.target.value),className:"w-full min-h-[400px] max-h-[600px] p-4 bg-muted/50 rounded-lg border border-border text-sm font-mono leading-relaxed text-card-foreground resize-y",autoFocus:!0}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Saving will re-ingest this document via retain (upsert). Existing memory units for this document will be replaced."})]}):(0,ep.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border bg-muted/50 text-xs text-muted-foreground",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),(0,ep.jsx)("span",{className:"font-semibold uppercase tracking-wide",children:"Stored content"}),(0,ep.jsxs)("span",{className:"text-muted-foreground/70",children:["·"," ",f.original_text?.length?.toLocaleString()??0," chars"]})]}),(0,ep.jsxs)(eD.Button,{variant:"ghost",size:"sm",onClick:()=>{T(f?.original_text??""),_(!0)},className:"h-6 px-2 gap-1 text-xs",children:[(0,ep.jsx)(mV,{className:"h-3 w-3"}),"Edit"]})]}),(0,ep.jsx)("pre",{className:"p-4 text-[11px] leading-5 text-foreground/80 whitespace-pre-wrap font-mono",children:f.original_text})]}))}),(0,ep.jsx)(tG.TabsContent,{value:"general",className:"mt-0",children:(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)(tG.Tabs,{defaultValue:"world",className:"flex flex-col",children:[(0,ep.jsxs)(tG.TabsList,{className:"w-fit",children:[(0,ep.jsx)(tG.TabsTrigger,{value:"world",children:"World"}),(0,ep.jsx)(tG.TabsTrigger,{value:"experience",children:"Experience"}),(0,ep.jsx)(tG.TabsTrigger,{value:"observation",children:"Observations"})]}),(0,ep.jsxs)("div",{className:"mt-2",children:[(0,ep.jsx)(tG.TabsContent,{value:"world",className:"mt-0",children:(0,ep.jsx)(fz,{factType:"world",documentId:f.id,compact:!0})}),(0,ep.jsx)(tG.TabsContent,{value:"experience",className:"mt-0",children:(0,ep.jsx)(fz,{factType:"experience",documentId:f.id,compact:!0})}),(0,ep.jsx)(tG.TabsContent,{value:"observation",className:"mt-0",children:(0,ep.jsx)(fz,{factType:"observation",documentId:f.id,compact:!0})})]})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ep.jsxs)(mX,{title:"Document",icon:(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),children:[f.created_at&&(0,ep.jsx)(mq,{label:"Created",value:new Date(f.created_at).toLocaleString()}),f.updated_at&&(0,ep.jsx)(mq,{label:"Updated",value:new Date(f.updated_at).toLocaleString()}),f.original_text&&(0,ep.jsx)(mq,{label:"Size",value:mY(new Blob([f.original_text]).size)}),(0,ep.jsx)(mq,{label:"Tags",value:b?(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eL.Input,{value:j,onChange:e=>N(e.target.value),placeholder:"tag1, tag2, tag3",className:"text-sm h-7 w-64",onKeyDown:e=>{"Enter"===e.key&&en(),"Escape"===e.key&&ee()},autoFocus:!0}),(0,ep.jsx)(eD.Button,{size:"sm",onClick:en,disabled:k,className:"h-7 w-7 p-0",children:k?(0,ep.jsx)("span",{className:"animate-spin text-xs",children:"⏳"}):(0,ep.jsx)(tF.Check,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:ee,disabled:k,className:"h-7 w-7 p-0",children:(0,ep.jsx)(tV.X,{className:"h-3 w-3"})})]}):(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[f.tags&&f.tags.length>0?(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:f.tags.map((e,t)=>(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-medium",children:e},t))}):(0,ep.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"none"}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",onClick:()=>{N((f?.tags??[]).join(", ")),w(!0)},className:"h-6 w-6 p-0",children:(0,ep.jsx)(mV,{className:"h-3 w-3"})})]})}),f.retain_params?.context&&(0,ep.jsx)(mq,{label:"Context",value:f.retain_params.context}),f.retain_params?.event_date&&(0,ep.jsx)(mq,{label:"Event Date",value:new Date(f.retain_params.event_date).toLocaleString()}),f.retain_params?.metadata&&Object.keys(f.retain_params.metadata).length>0&&(0,ep.jsx)(mq,{label:"Metadata",value:(0,ep.jsx)(mG,{metadata:f.retain_params.metadata})})]}),(0,ep.jsx)(mX,{title:"Memory Composition",icon:(0,ep.jsx)(eG,{className:"w-3.5 h-3.5"}),children:(0,ep.jsx)(mK,{nodesByFactType:f.nodes_by_fact_type})})]})]})}),(0,ep.jsx)(tG.TabsContent,{value:"chunks",className:"mt-0",children:I?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading chunks..."})]})}):M.length>0?(0,ep.jsx)("div",{className:"rounded-lg border border-border overflow-hidden divide-y divide-border",children:M.map(e=>(0,ep.jsx)(mQ,{chunk:e},e.chunk_id))}):B?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"📄"}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No chunks found for this document"})]})}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)("div",{className:"text-center",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Click the Chunks tab to load chunks"})})})})]})]}):null]})}),(0,ep.jsx)(mg,{open:!!W,onOpenChange:e=>!e&&Y(null),children:(0,ep.jsxs)(mP,{children:[(0,ep.jsxs)(mD,{children:[(0,ep.jsx)(mI,{children:"Delete Document"}),(0,ep.jsxs)(mR,{children:["Are you sure you want to delete document"," ",(0,ep.jsxs)("span",{className:"font-mono font-semibold",children:['"',W?.id,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),"This will also delete"," ",W?.memoryCount!==void 0?(0,ep.jsxs)("span",{className:"font-semibold",children:[W.memoryCount," memory units"]}):"all memory units"," ","extracted from this document.",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mz,{children:"Cancel"}),(0,ep.jsx)(mB,{onClick:J,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),(0,ep.jsx)(mg,{open:!!G,onOpenChange:e=>!e&&$(null),children:(0,ep.jsxs)(mP,{children:[(0,ep.jsxs)(mD,{children:[(0,ep.jsx)(mI,{children:G?.success?"Document Deleted":"Error"}),(0,ep.jsx)(mR,{children:G?.message})]}),(0,ep.jsx)(mL,{children:(0,ep.jsx)(mB,{onClick:()=>$(null),children:"OK"})})]})}),(0,ep.jsx)(mg,{open:!!U,onOpenChange:e=>!e&&H(null),children:(0,ep.jsxs)(mP,{children:[(0,ep.jsxs)(mD,{children:[(0,ep.jsx)(mI,{children:U?.success?"Reprocessing Started":"Error"}),(0,ep.jsx)(mR,{children:U?.message})]}),(0,ep.jsx)(mL,{children:(0,ep.jsx)(mB,{onClick:()=>H(null),children:"OK"})})]})})]})}function m0(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)(null),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)("relations"),[d,h]=(0,em.useState)(null),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(1),[x,y]=(0,em.useState)(0),b=Math.ceil(x/50),w=(g-1)*50,j=async(t=1)=>{if(e){i(!0);try{let r=await eP.client.listEntities({bank_id:e,limit:50,offset:(t-1)*50});n(r.items||[]),y(r.total||0)}catch(e){}finally{i(!1)}}},N=async t=>{if(e){l(!0);try{let n=await eP.client.getEntity(t,e);o(n)}catch(e){}finally{l(!1)}}},k=e=>{v(e),j(e)},C=(0,em.useCallback)(async()=>{if(e){p(!0);try{let t=await eP.client.getEntityGraph({bank_id:e,limit:2e3,min_count:1});h(t)}catch(e){}finally{p(!1)}}},[e]);(0,em.useEffect)(()=>{e&&(v(1),j(1),o(null),h(null))},[e]),(0,em.useEffect)(()=>{"relations"!==c||!e||d||f||C()},[c,e,d,f,C]);let E=(0,em.useMemo)(()=>d?h$(d):{nodes:[],links:[]},[d]),_=(0,em.useMemo)(()=>{let e=new Map;for(let t of E.links){let n="number"==typeof t.weight&&t.weight>0?t.weight:1;e.set(t.source,(e.get(t.source)||0)+n),e.set(t.target,(e.get(t.target)||0)+n)}return e},[E]),S=(0,em.useMemo)(()=>{let e=1;for(let t of _.values())t>e&&(e=t);return e},[_]),T=(0,em.useCallback)(e=>3+11*Math.sqrt((_.get(e.id)||0)/S),[_,S]),A=(0,em.useMemo)(()=>{let e=d?.edges||[];if(!e.length)return null;let t=new Map,n=1/0,r=-1/0;for(let i of e){let e=i.data.lastCooccurred;if(!e)continue;let a=Date.parse(e);if(!Number.isNaN(a)){for(let e of[i.data.source,i.data.target]){let n=t.get(e);(void 0===n||a>n)&&t.set(e,a)}a<n&&(n=a),a>r&&(r=a)}}return Number.isFinite(n)&&Number.isFinite(r)&&r!==n?{times:t,minT:n,maxT:r}:null},[d]),O=(0,em.useCallback)(e=>{if(!A)return .5;let t=A.times.get(e.id);return void 0===t?0:(t-A.minT)/(A.maxT-A.minT)},[A]),M=(0,em.useCallback)(e=>{N(e.id)},[e]),P=e=>e?new Date(e).toLocaleDateString():"N/A";return(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"mb-4 flex items-center justify-end",children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,ep.jsxs)("button",{onClick:()=>u("relations"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"relations"===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(fR,{className:"w-4 h-4"}),"Relations"]}),(0,ep.jsxs)("button",{onClick:()=>u("list"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"list"===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(e$,{className:"w-4 h-4"}),"List"]})]})}),"relations"===c&&(0,ep.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:f?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading entity graph..."})]})}):E.nodes.length>0?(0,ep.jsx)(fL,{data:E,height:700,onNodeClick:M,nodeSizeFn:T,nodeHeatFn:A?O:void 0,heatLegendLabel:A?"recency · last co-occurrence":void 0,heatLegendEndpoints:A?[new Date(A.minT).toISOString().slice(0,10),new Date(A.maxT).toISOString().slice(0,10)]:void 0,sizeLegendLabel:"co-occurrences",compactLabels:!0}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No entity co-occurrences yet"}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:"Two entities co-occur when they appear in the same memory."})]})})}),"list"===c&&(0,ep.jsx)("div",{children:r?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading entities..."})]})}):t.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"mb-4 text-sm text-muted-foreground",children:[x," ",1===x?"entity":"entities"]}),(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eX,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{children:"Name"}),(0,ep.jsx)(eQ,{children:"Mentions"}),(0,ep.jsx)(eQ,{children:"First Seen"}),(0,ep.jsx)(eQ,{children:"Last Seen"})]})}),(0,ep.jsx)(eK,{children:t.map(e=>(0,ep.jsxs)(eZ,{onClick:()=>N(e.id),className:`cursor-pointer hover:bg-muted/50 ${a?.id===e.id?"bg-primary/10":""}`,children:[(0,ep.jsx)(eJ,{className:"font-medium text-card-foreground",children:e.canonical_name}),(0,ep.jsx)(eJ,{className:"text-card-foreground",children:e.mention_count}),(0,ep.jsx)(eJ,{className:"text-card-foreground",children:P(e.first_seen)}),(0,ep.jsx)(eJ,{className:"text-card-foreground",children:P(e.last_seen)})]},e.id))})]})}),b>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[w+1,"-",Math.min(w+50,x)," of ",x]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>k(1),disabled:1===g||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(ez,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>k(g-1),disabled:1===g||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(e_,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[g," / ",b]}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>k(g+1),disabled:g===b||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>k(b),disabled:g===b||r,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})})]})]})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsxs)("div",{className:"text-center",children:[(0,ep.jsx)("div",{className:"text-4xl mb-2",children:"..."}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:"No entities found"}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:"Entities are extracted from facts when memories are added."})]})})}),a&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l-2 border-primary shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:(0,ep.jsxs)("div",{className:"p-5",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-card-foreground",children:a.canonical_name}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Entity details"})]}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",onClick:()=>o(null),className:"h-8 w-8 p-0",children:(0,ep.jsx)("span",{className:"text-lg",children:"x"})})]}),(0,ep.jsxs)("div",{className:"space-y-5",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Mentions"}),(0,ep.jsx)("div",{className:"text-lg font-semibold text-card-foreground",children:a.mention_count})]}),(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"First Seen"}),(0,ep.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:P(a.first_seen)})]})]}),(0,ep.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,ep.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Entity ID"}),(0,ep.jsx)("code",{className:"text-xs font-mono break-all text-muted-foreground",children:a.id})]})]})]})})]})}var m1=e.i(32089);let m2=["world","experience","observation"],m5={world:{label:"World",active:"bg-violet-500/15 text-violet-700 border-violet-400 dark:text-violet-300 dark:border-violet-500",inactive:"border-border text-muted-foreground hover:border-violet-300 hover:text-violet-600 dark:hover:text-violet-400",dot:"bg-violet-500"},experience:{label:"Experience",active:"bg-pink-500/15 text-pink-700 border-pink-400 dark:text-pink-300 dark:border-pink-500",inactive:"border-border text-muted-foreground hover:border-pink-300 hover:text-pink-600 dark:hover:text-pink-400",dot:"bg-pink-500"},observation:{label:"Observation",active:"bg-indigo-500/15 text-indigo-700 border-indigo-400 dark:text-indigo-300 dark:border-indigo-500",inactive:"border-border text-muted-foreground hover:border-indigo-300 hover:text-indigo-600 dark:hover:text-indigo-400",dot:"bg-indigo-500"}};function m3({ft:e,active:t,onToggle:n}){let r=m5[e];return(0,ep.jsxs)("button",{type:"button",onClick:n,className:(0,eA.cn)("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-all",t?r.active:r.inactive),children:[(0,ep.jsx)("span",{className:(0,eA.cn)("h-1.5 w-1.5 rounded-full",t?r.dot:"bg-muted-foreground/50")}),r.label]})}function m4({value:e,onChange:t,label:n="Fact types:"}){return(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[n&&(0,ep.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:n}),(0,ep.jsx)("div",{className:"flex gap-1.5",children:m2.map(n=>(0,ep.jsx)(m3,{ft:n,active:e.includes(n),onToggle:()=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n])},n))})]})}function m6({value:e,onChange:t}){return(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:m2.map(n=>(0,ep.jsx)(m3,{ft:n,active:e.includes(n),onToggle:()=>t(e.includes(n)?e.filter(e=>e!==n):[...e,n])},n))})}var m8=e.i(73104),m7=e.i(52571);let m9=(0,ej.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),ge=(0,ej.default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]),gt=(0,ej.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),gn=(0,ej.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var gr=e.i(1864);"function"==typeof SuppressedError&&SuppressedError;var gi=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach(function(t){e.addRange(t)}),t&&t.focus()}},ga={"text/plain":"Text","text/html":"Url",default:"Text"},go=function(e,t){var n,r,i,a,o,s,l,c,u=!1;t||(t={}),i=t.debug||!1;try{if(o=gi(),s=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=ga[t.format]||ga.default;window.clipboardData.setData(r,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(c),s.selectNodeContents(c),l.addRange(s),!document.execCommand("copy"))throw Error("copy command was unsuccessful");u=!0}catch(o){i&&console.error("unable to copy using execCommand: ",o),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(o){i&&console.error("unable to copy using clipboardData: ",o),i&&console.error("falling back to prompt"),n="message"in t?t.message:"Copy to clipboard: #{key}, Enter",r=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",a=n.replace(/#{\s*key\s*}/g,r),window.prompt(a,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(s):l.removeAllRanges()),c&&document.body.removeChild(c),o()}return u};function gs(e){return"[object Object]"===Object.prototype.toString.call(e)}function gl(e){return Array.isArray(e)?e.length:gs(e)?Object.keys(e).length:0}function gc(e,t,n,r,i,a){if(a&&void 0!==a.collapsed)return!!a.collapsed;if("boolean"==typeof r)return r;if("number"==typeof r&&t>r)return!0;let o=gl(e);if("function"==typeof r){let i=gh(r,[{node:e,depth:t,indexOrName:n,size:o}]);if("boolean"==typeof i)return i}return!!(Array.isArray(e)&&o>i||gs(e)&&o>i)}function gu(e,t,n,r,i,a){if(a&&void 0!==a.collapsed)return!!a.collapsed;if("boolean"==typeof r)return r;if("number"==typeof r&&t>r)return!0;let o=Math.ceil(e.length/100);if("function"==typeof r){let i=gh(r,[{node:e,depth:t,indexOrName:n,size:o}]);if("boolean"==typeof i)return i}return!!(Array.isArray(e)&&o>i||gs(e)&&o>i)}function gd(e,t,n){return"boolean"==typeof e?e:"number"==typeof e&&!!(t>e)||"collapsed"===e&&!!n||"expanded"===e&&!n}function gh(e,t){try{return e(...t)}catch(e){reportError(e)}}function gf(e){if(!0===e||gs(e)&&!0===e.add)return!0}function gp(e){if(!0===e||gs(e)&&!0===e.edit)return!0}function gm(e){if(!0===e||gs(e)&&!0===e.delete)return!0}function gg(e){return!e||void 0===e.add||!!e.add}function gv(e){return!e||void 0===e.edit||!!e.edit}function gx(e){return!e||void 0===e.delete||!!e.delete}function gy(e){return!e||void 0===e.enableClipboard||!!e.enableClipboard}function gb(){return(gb=Object.assign.bind()).apply(this,arguments)}var gw=function(e){return em.createElement("svg",gb({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),w||(w=em.createElement("path",{fill:"currentColor",d:"M12.473 5.806a.666.666 0 0 0-.946 0L8.473 8.86a.667.667 0 0 1-.946 0L4.473 5.806a.667.667 0 1 0-.946.94l3.06 3.06a2 2 0 0 0 2.826 0l3.06-3.06a.667.667 0 0 0 0-.94Z"})))};function gj(){return(gj=Object.assign.bind()).apply(this,arguments)}var gN=function(e){return em.createElement("svg",gj({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),j||(j=em.createElement("path",{fill:"currentColor",d:"M17.542 2.5h-4.75a3.963 3.963 0 0 0-3.959 3.958v4.75a3.963 3.963 0 0 0 3.959 3.959h4.75a3.963 3.963 0 0 0 3.958-3.959v-4.75A3.963 3.963 0 0 0 17.542 2.5Zm2.375 8.708a2.378 2.378 0 0 1-2.375 2.375h-4.75a2.378 2.378 0 0 1-2.375-2.375v-4.75a2.378 2.378 0 0 1 2.375-2.375h4.75a2.378 2.378 0 0 1 2.375 2.375v4.75Zm-4.75 6.334a3.963 3.963 0 0 1-3.959 3.958h-4.75A3.963 3.963 0 0 1 2.5 17.542v-4.75a3.963 3.963 0 0 1 3.958-3.959.791.791 0 1 1 0 1.584 2.378 2.378 0 0 0-2.375 2.375v4.75a2.378 2.378 0 0 0 2.375 2.375h4.75a2.378 2.378 0 0 0 2.375-2.375.792.792 0 1 1 1.584 0Z"})))};function gk(){return(gk=Object.assign.bind()).apply(this,arguments)}var gC=function(e){return em.createElement("svg",gk({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),N||(N=em.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.755 3.755 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.755 3.755 0 0 0 17.25 3Zm2.25 14.25a2.25 2.25 0 0 1-2.25 2.25H6.75a2.25 2.25 0 0 1-2.25-2.25V6.75A2.25 2.25 0 0 1 6.75 4.5h10.5a2.25 2.25 0 0 1 2.25 2.25v10.5Z"})),k||(k=em.createElement("path",{fill:"#14C786",d:"M10.312 14.45 7.83 11.906a.625.625 0 0 0-.896 0 .659.659 0 0 0 0 .918l2.481 2.546a1.264 1.264 0 0 0 .896.381 1.237 1.237 0 0 0 .895-.38l5.858-6.011a.658.658 0 0 0 0-.919.625.625 0 0 0-.896 0l-5.857 6.01Z"})))};function gE({node:e,nodeMeta:t}){let{customizeCopy:n,CopyComponent:r,CopiedComponent:i}=(0,em.useContext)(gG),[a,o]=(0,em.useState)(!1),s=r=>{r.stopPropagation();let i=n(e,t);"string"==typeof i&&i&&function(e){var t,n,r,i;t=this,n=void 0,r=void 0,i=function*(){try{yield navigator.clipboard.writeText(e)}catch(t){go(e)}},new(r||(r=Promise))(function(e,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r(function(e){e(n)})).then(o,s)}l((i=i.apply(t,n||[])).next())})}(i),o(!0),setTimeout(()=>o(!1),3e3)};return a?"function"==typeof i?(0,ep.jsx)(i,{className:"json-view--copy",style:{display:"inline-block"}}):(0,ep.jsx)(gC,{className:"json-view--copy",style:{display:"inline-block"}}):"function"==typeof r?(0,ep.jsx)(r,{onClick:s,className:"json-view--copy"}):(0,ep.jsx)(gN,{onClick:s,className:"json-view--copy"})}function g_({indexOrName:e,value:t,depth:n,deleteHandle:r,editHandle:i,parent:a,parentPath:o}){let{displayArrayIndex:s}=(0,em.useContext)(gG),l=Array.isArray(a);return(0,ep.jsxs)("div",Object.assign({className:"json-view--pair"},{children:[!l||l&&s?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",Object.assign({className:"number"==typeof e?"json-view--index":"json-view--property"},{children:e})),":"," "]}):(0,ep.jsx)(ep.Fragment,{}),(0,ep.jsx)(gW,{node:t,depth:n+1,deleteHandle:(e,t)=>r(e,t),editHandle:(e,t,n,r)=>i(e,t,n,r),parent:a,indexOrName:e,parentPath:o})]}))}function gS(){return(gS=Object.assign.bind()).apply(this,arguments)}var gT=function(e){return em.createElement("svg",gS({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),C||(C=em.createElement("path",{fill:"currentColor",d:"M18.75 6h-2.325a3.757 3.757 0 0 0-3.675-3h-1.5a3.757 3.757 0 0 0-3.675 3H5.25a.75.75 0 0 0 0 1.5H6v9.75A3.754 3.754 0 0 0 9.75 21h4.5A3.754 3.754 0 0 0 18 17.25V7.5h.75a.75.75 0 1 0 0-1.5Zm-7.5-1.5h1.5A2.255 2.255 0 0 1 14.872 6H9.128a2.255 2.255 0 0 1 2.122-1.5Zm5.25 12.75a2.25 2.25 0 0 1-2.25 2.25h-4.5a2.25 2.25 0 0 1-2.25-2.25V7.5h9v9.75Z"})),E||(E=em.createElement("path",{fill:"#DA0000",d:"M10.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75ZM13.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75Z"})))};function gA(){return(gA=Object.assign.bind()).apply(this,arguments)}var gO=function(e){return em.createElement("svg",gA({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),_||(_=em.createElement("path",{fill:"currentColor",d:"M21 6.75v10.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3h10.5A3.754 3.754 0 0 1 21 6.75Zm-1.5 0c0-1.24-1.01-2.25-2.25-2.25H6.75C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25V6.75Z"})),S||(S=em.createElement("path",{fill:"#14C786",d:"M15 12.75a.75.75 0 1 0 0-1.5h-2.25V9a.75.75 0 1 0-1.5 0v2.25H9a.75.75 0 1 0 0 1.5h2.25V15a.75.75 0 1 0 1.5 0v-2.25H15Z"})))};function gM(){return(gM=Object.assign.bind()).apply(this,arguments)}var gP=function(e){return em.createElement("svg",gM({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),T||(T=em.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})),A||(A=em.createElement("path",{fill:"#14C786",d:"m10.85 13.96-1.986-2.036a.5.5 0 0 0-.716 0 .527.527 0 0 0 0 .735l1.985 2.036a1.01 1.01 0 0 0 .717.305.99.99 0 0 0 .716-.305l4.686-4.808a.526.526 0 0 0 0-.735.5.5 0 0 0-.716 0l-4.687 4.809Z"})))};function gD(){return(gD=Object.assign.bind()).apply(this,arguments)}var gL=function(e){return em.createElement("svg",gD({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),O||(O=em.createElement("path",{fill:"#DA0000",d:"M15 9a.75.75 0 0 0-1.06 0L12 10.94 10.06 9A.75.75 0 0 0 9 10.06L10.94 12 9 13.94A.75.75 0 0 0 10.06 15L12 13.06 13.94 15A.75.75 0 0 0 15 13.94L13.06 12 15 10.06A.75.75 0 0 0 15 9Z"})),M||(M=em.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})))};function gI({originNode:e,node:t,depth:n,index:r,deleteHandle:i,customOptions:a,startIndex:o,parent:s,parentPath:l}){let{enableClipboard:c,src:u,onEdit:d,onChange:h,forceUpdate:f,displaySize:p,CustomOperation:g}=(0,em.useContext)(gG),v=[...l,String(r)],[x,y]=(0,em.useState)(!0),b=(0,em.useCallback)((t,r,i)=>{e[t]=r,d&&d({newValue:r,oldValue:i,depth:n,src:u,indexOrName:t,parentType:"array",parentPath:l}),h&&h({type:"edit",depth:n,src:u,indexOrName:t,parentType:"array",parentPath:l}),f()},[t,d,h,f]),w=t=>{e.splice(t,1),i&&i(t,l),f()},j=(0,ep.jsxs)(ep.Fragment,{children:[!x&&(0,ep.jsxs)("span",Object.assign({onClick:()=>y(!0),className:"jv-size-chevron"},{children:[gd(p,n,x)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[gl(t)," Items"]})),(0,ep.jsx)(gw,{className:"jv-chevron"})]})),!x&&c&&gy(a)&&(0,ep.jsx)(gE,{node:t,nodeMeta:{depth:n,indexOrName:r,parent:s,parentPath:l,currentPath:v}}),"function"==typeof g?(0,ep.jsx)(g,{node:t}):null]});return(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{children:"["}),j,x?(0,ep.jsxs)("button",Object.assign({onClick:()=>y(!1),className:"jv-button"},{children:[o," ... ",o+t.length-1]})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:t.map((e,i)=>(0,ep.jsx)(g_,{indexOrName:i+o,value:e,depth:n,parent:t,deleteHandle:w,editHandle:b,parentPath:l},String(r)+String(i)))})),(0,ep.jsx)("span",{children:"]"})]})}function gR({node:e,depth:t,deleteHandle:n,indexOrName:r,customOptions:i,parent:a,parentPath:o}){let s=void 0!==r?[...o,String(r)]:o,l=[];for(let t=0;t<e.length;t+=100)l.push(e.slice(t,t+100));let{collapsed:c,enableClipboard:u,collapseObjectsAfterLength:d,editable:h,onDelete:f,src:p,onAdd:g,CustomOperation:v,onChange:x,forceUpdate:y,displaySize:b}=(0,em.useContext)(gG),[w,j]=(0,em.useState)(gu(e,t,r,c,d,i));(0,em.useEffect)(()=>{j(gu(e,t,r,c,d,i))},[c,d]);let[N,k]=(0,em.useState)(!1),[C,E]=(0,em.useState)(!1),_=()=>{e.push(null),g&&g({indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:o}),x&&x({type:"add",indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:o}),y()},S=N||C,T=(0,ep.jsxs)(ep.Fragment,{children:[!w&&!S&&(0,ep.jsxs)("span",Object.assign({onClick:()=>j(!0),className:"jv-size-chevron"},{children:[gd(b,t,w)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[e.length," Items"]})),(0,ep.jsx)(gw,{className:"jv-chevron"})]})),S&&(0,ep.jsx)(gP,{className:"json-view--edit",style:{display:"inline-block"},onClick:C?_:()=>{k(!1),n&&n(r,o),f&&f({value:e,depth:t,src:p,indexOrName:r,parentType:"array",parentPath:o}),x&&x({type:"delete",depth:t,src:p,indexOrName:r,parentType:"array",parentPath:o})}}),S&&(0,ep.jsx)(gL,{className:"json-view--edit",style:{display:"inline-block"},onClick:()=>{k(!1),E(!1)}}),!w&&!S&&u&&gy(i)&&(0,ep.jsx)(gE,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:a,parentPath:o,currentPath:s}}),!w&&!S&&gf(h)&&gg(i)&&(0,ep.jsx)(gO,{className:"json-view--edit",onClick:()=>{_()}}),!w&&!S&&gm(h)&&gx(i)&&n&&(0,ep.jsx)(gT,{className:"json-view--edit",onClick:()=>k(!0)}),"function"==typeof v?(0,ep.jsx)(v,{node:e}):null]});return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{children:"["}),T,w?(0,ep.jsx)("button",Object.assign({onClick:()=>j(!1),className:"jv-button"},{children:"..."})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:l.map((a,s)=>(0,ep.jsx)(gI,{originNode:e,node:a,depth:t,index:s,startIndex:100*s,deleteHandle:n,customOptions:i,parentPath:o},String(r)+String(s)))})),(0,ep.jsx)("span",{children:"]"}),w&&gd(b,t,w)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>j(!1),className:"jv-size"},{children:[e.length," Items"]}))]})}function gB({node:e,depth:t,indexOrName:n,deleteHandle:r,customOptions:i,parent:a,parentPath:o}){let{collapsed:s,onCollapse:l,enableClipboard:c,ignoreLargeArray:u,collapseObjectsAfterLength:d,editable:h,onDelete:f,src:p,onAdd:g,onEdit:v,onChange:x,forceUpdate:y,displaySize:b,CustomOperation:w}=(0,em.useContext)(gG),j=void 0!==n?[...o,String(n)]:o;if(!u&&Array.isArray(e)&&e.length>100)return(0,ep.jsx)(gR,{node:e,depth:t,indexOrName:n,deleteHandle:r,customOptions:i,parentPath:j});let N=gs(e),[k,C]=(0,em.useState)(gc(e,t,n,s,d,i)),E=r=>{null==l||l({isCollapsing:!r,node:e,depth:t,indexOrName:n}),C(r)};(0,em.useEffect)(()=>{E(gc(e,t,n,s,d,i))},[s,d]);let _=(0,em.useCallback)((n,r,i)=>{Array.isArray(e)?e[+n]=r:e&&(e[n]=r),v&&v({newValue:r,oldValue:i,depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j}),x&&x({type:"edit",depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j}),y()},[e,v,x,y]),S=t=>{Array.isArray(e)?e.splice(+t,1):e&&delete e[t],y()},[T,A]=(0,em.useState)(!1),[O,M]=(0,em.useState)(!1),P=(0,em.useRef)(null),D=()=>{var n;if(N){let r=null==(n=P.current)?void 0:n.value;r&&(e[r]=null,P.current&&(P.current.value=""),M(!1),g&&g({indexOrName:r,depth:t,src:p,parentType:"object",parentPath:j}),x&&x({type:"add",indexOrName:r,depth:t,src:p,parentType:"object",parentPath:j}))}else Array.isArray(e)&&(e.push(null),g&&g({indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:j}),x&&x({type:"add",indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:j}));y()},L=T||O,I=()=>{A(!1),M(!1)},R=(0,ep.jsxs)(ep.Fragment,{children:[!k&&!L&&(0,ep.jsxs)("span",Object.assign({onClick:()=>E(!0),className:"jv-size-chevron"},{children:[gd(b,t,k)&&(0,ep.jsxs)("span",Object.assign({className:"jv-size"},{children:[gl(e)," Items"]})),(0,ep.jsx)(gw,{className:"jv-chevron"})]})),O&&N&&(0,ep.jsx)("input",{className:"json-view--input",placeholder:"property",ref:P,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),D()):"Escape"===e.key&&I()}}),L&&(0,ep.jsx)(gP,{className:"json-view--edit",style:{display:"inline-block"},onClick:O?D:()=>{A(!1),r&&r(n,j),f&&f({value:e,depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j}),x&&x({type:"delete",depth:t,src:p,indexOrName:n,parentType:N?"object":"array",parentPath:j})}}),L&&(0,ep.jsx)(gL,{className:"json-view--edit",style:{display:"inline-block"},onClick:I}),!k&&!L&&c&&gy(i)&&(0,ep.jsx)(gE,{node:e,nodeMeta:{depth:t,indexOrName:n,parent:a,parentPath:o,currentPath:j}}),!k&&!L&&gf(h)&&gg(i)&&(0,ep.jsx)(gO,{className:"json-view--edit",onClick:()=>{N?(M(!0),setTimeout(()=>{var e;return null==(e=P.current)?void 0:e.focus()})):D()}}),!k&&!L&&gm(h)&&gx(i)&&r&&(0,ep.jsx)(gT,{className:"json-view--edit",onClick:()=>A(!0)}),"function"==typeof w?(0,ep.jsx)(w,{node:e}):null]});return Array.isArray(e)?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{children:"["}),R,k?(0,ep.jsx)("button",Object.assign({onClick:()=>E(!1),className:"jv-button"},{children:"..."})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:e.map((r,i)=>(0,ep.jsx)(g_,{indexOrName:i,value:r,depth:t,parent:e,deleteHandle:S,editHandle:_,parentPath:j},String(n)+String(i)))})),(0,ep.jsx)("span",{children:"]"}),k&&gd(b,t,k)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>E(!1),className:"jv-size"},{children:[gl(e)," Items"]}))]}):N?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("span",{children:"{"}),R,k?(0,ep.jsx)("button",Object.assign({onClick:()=>E(!1),className:"jv-button"},{children:"..."})):(0,ep.jsx)("div",Object.assign({className:"jv-indent"},{children:Object.entries(e).map(([r,i])=>(0,ep.jsx)(g_,{indexOrName:r,value:i,depth:t,parent:e,deleteHandle:S,editHandle:_,parentPath:j},String(n)+String(r)))})),(0,ep.jsx)("span",{children:"}"}),k&&gd(b,t,k)&&(0,ep.jsxs)("span",Object.assign({onClick:()=>E(!1),className:"jv-size"},{children:[gl(e)," Items"]}))]}):(0,ep.jsx)("span",{children:String(e)})}let gz=em.default.forwardRef(({str:e,className:t,ctrlClick:n},r)=>{let{collapseStringMode:i,collapseStringsAfterLength:a,customizeCollapseStringUI:o}=(0,em.useContext)(gG),[s,l]=(0,em.useState)(!0),c=(0,em.useRef)(null);a=a>0?a:0;let u=e.replace(/\s+/g," "),d="function"==typeof o?o(u,s):"string"==typeof o?o:"...",h=e=>{var t;if((e.ctrlKey||e.metaKey)&&n)n(e);else{let e=window.getSelection();if(e&&e.anchorOffset!==e.focusOffset&&(null==(t=e.anchorNode)?void 0:t.parentElement)===c.current)return;l(!s)}};if(e.length<=a)return(0,ep.jsxs)("span",Object.assign({ref:c,className:t,onClick:n},{children:['"',e,'"']}));if("address"===i)return e.length<=10?(0,ep.jsxs)("span",Object.assign({ref:c,className:t,onClick:n},{children:['"',e,'"']})):(0,ep.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[u.slice(0,6),d,u.slice(-4)]:e,'"']}));if("directly"===i)return(0,ep.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[u.slice(0,a),d]:e,'"']}));if("word"===i){let n=a,r=a+1,i=u,o=1;for(;;){if(/\W/.test(e[n])){i=e.slice(0,n);break}if(/\W/.test(e[r])){i=e.slice(0,r);break}if(6===o){i=e.slice(0,a);break}o++,n--,r++}return(0,ep.jsxs)("span",Object.assign({ref:c,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[i,d]:e,'"']}))}return(0,ep.jsxs)("span",Object.assign({ref:c,className:t},{children:['"',e,'"']}))});function gF(){return(gF=Object.assign.bind()).apply(this,arguments)}var gV=function(e){return em.createElement("svg",gF({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),P||(P=em.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.754 3.754 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.754 3.754 0 0 0 17.25 3Zm2.25 14.25c0 1.24-1.01 2.25-2.25 2.25H6.75c-1.24 0-2.25-1.01-2.25-2.25V6.75c0-1.24 1.01-2.25 2.25-2.25h10.5c1.24 0 2.25 1.01 2.25 2.25v10.5Zm-6.09-9.466-5.031 5.03a2.981 2.981 0 0 0-.879 2.121v1.19c0 .415.336.75.75.75h1.19c.8 0 1.554-.312 2.12-.879l5.03-5.03a2.252 2.252 0 0 0 0-3.182c-.85-.85-2.331-.85-3.18 0Zm-2.91 7.151c-.28.28-.666.44-1.06.44H9v-.44c0-.4.156-.777.44-1.06l3.187-3.188 1.06 1.061-3.187 3.188Zm5.03-5.03-.782.783-1.06-1.061.782-.782a.766.766 0 0 1 1.06 0 .75.75 0 0 1 0 1.06Z"})))};function gU(){return(gU=Object.assign.bind()).apply(this,arguments)}var gH=function(e){return em.createElement("svg",gU({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),D||(D=em.createElement("path",{fill:"currentColor",d:"M6.75 3h5.5v1.5h-5.5C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25v-5.5H21v5.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3Z"})),L||(L=em.createElement("path",{fill:"currentColor",d:"M20.013 3h-3.946a.987.987 0 0 0 0 1.973h1.564l-6.342 6.342a1.004 1.004 0 0 0 0 1.396 1.004 1.004 0 0 0 1.396 0l6.342-6.342v1.564a.987.987 0 0 0 1.973 0V3.987A.987.987 0 0 0 20.013 3Z"})))};function gW({node:e,depth:t,deleteHandle:n,indexOrName:r,parent:i,editHandle:a,parentPath:o}){let s,{collapseStringsAfterLength:l,enableClipboard:c,editable:u,src:d,onDelete:h,onChange:f,customizeNode:p,matchesURL:g,urlRegExp:v,EditComponent:x,DoneComponent:y,CancelComponent:b,CustomOperation:w}=(0,em.useContext)(gG);if("function"==typeof p&&(s=gh(p,[{node:e,depth:t,indexOrName:r}])),s){if((0,em.isValidElement)(s))return s;else if("function"==typeof s){let n=s;return(0,ep.jsx)(n,{node:e,depth:t,indexOrName:r})}}if(Array.isArray(e)||gs(e))return(0,ep.jsx)(gB,{parent:i,node:e,depth:t,indexOrName:r,deleteHandle:n,parentPath:o,customOptions:"object"==typeof s?s:void 0});{var j;let p=typeof e,N=void 0!==r?[...o,String(r)]:o,[k,C]=(0,em.useState)(!1),[E,_]=(0,em.useState)(!1),S=(0,em.useRef)(null),T=()=>{C(!0),setTimeout(()=>{var e,t;null==(e=window.getSelection())||e.selectAllChildren(S.current),null==(t=S.current)||t.focus()})},A=(0,em.useCallback)(()=>{let t=S.current.innerText;try{let n=JSON.parse(t);a&&a(r,n,e,o)}catch(i){let n="string"===p?t.trim().replace(/^\"([\s\S]+?)\"$/,"$1"):t;a&&a(r,n,e,o)}C(!1)},[a,r,e,o,p]),O=()=>{C(!1),_(!1)},M=()=>{_(!1),n&&n(r,o),h&&h({value:e,depth:t,src:d,indexOrName:r,parentType:Array.isArray(i)?"array":"object",parentPath:o}),f&&f({depth:t,src:d,indexOrName:r,parentType:Array.isArray(i)?"array":"object",type:"delete",parentPath:o})},P=(0,em.useCallback)(e=>{"Enter"===e.key?(e.preventDefault(),A()):"Escape"===e.key&&O()},[A]),D=k||E,L=!D&&gp(u)&&gv(s)&&a?e=>{(e.ctrlKey||e.metaKey)&&T()}:void 0,I=(0,ep.jsxs)(ep.Fragment,{children:[D&&("function"==typeof y?(0,ep.jsx)(y,{className:"json-view--edit",style:{display:"inline-block"},onClick:E?M:A}):(0,ep.jsx)(gP,{className:"json-view--edit",style:{display:"inline-block"},onClick:E?M:A})),D&&("function"==typeof b?(0,ep.jsx)(b,{className:"json-view--edit",style:{display:"inline-block"},onClick:O}):(0,ep.jsx)(gL,{className:"json-view--edit",style:{display:"inline-block"},onClick:O})),!D&&c&&gy(s)&&(0,ep.jsx)(gE,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:i,parentPath:o,currentPath:N}}),!D&&g&&"string"===p&&v.test(e)&&(!(j=s)||void 0===j.matchesURL||!!j.matchesURL)&&(0,ep.jsx)("a",Object.assign({href:e,target:"_blank",className:"json-view--link"},{children:(0,ep.jsx)(gH,{})})),!D&&gp(u)&&gv(s)&&a&&("function"==typeof x?(0,ep.jsx)(x,{className:"json-view--edit",onClick:T}):(0,ep.jsx)(gV,{className:"json-view--edit",onClick:T})),!D&&gm(u)&&gx(s)&&n&&(0,ep.jsx)(gT,{className:"json-view--edit",onClick:()=>_(!0)}),"function"==typeof w?(0,ep.jsx)(w,{node:e}):null]}),R="json-view--string";switch(p){case"number":case"bigint":R="json-view--number";break;case"boolean":R="json-view--boolean";break;case"object":R="json-view--null"}"string"==typeof(null==s?void 0:s.className)&&(R+=" "+s.className),E&&(R+=" json-view--deleting");let B=String(e);"bigint"===p&&(B+="n");let z=(0,em.useMemo)(()=>(0,ep.jsx)("span",{contentEditable:!0,className:R,dangerouslySetInnerHTML:{__html:"string"===p?`"${B}"`:B},ref:S,onKeyDown:P}),[B,p,P]);return"string"===p?(0,ep.jsxs)(ep.Fragment,{children:[k?z:e.length>l?(0,ep.jsx)(gz,{str:e,ref:S,className:R,ctrlClick:L}):(0,ep.jsxs)("span",Object.assign({className:R,onClick:L},{children:['"',B,'"']})),I]}):(0,ep.jsxs)(ep.Fragment,{children:[k?z:(0,ep.jsx)("span",Object.assign({className:R,onClick:L},{children:B})),I]})}}let gY=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,gG=(0,em.createContext)({src:void 0,collapseStringsAfterLength:99,collapseStringMode:"directly",customizeCollapseStringUI:void 0,collapseObjectsAfterLength:20,collapsed:!1,onCollapse:void 0,enableClipboard:!0,editable:!1,onEdit:void 0,onDelete:void 0,onAdd:void 0,onChange:void 0,forceUpdate:()=>{},customizeNode:void 0,customizeCopy:()=>{},displaySize:void 0,displayArrayIndex:!0,matchesURL:!1,urlRegExp:gY,ignoreLargeArray:!1,CopyComponent:void 0,CopiedComponent:void 0,EditComponent:void 0,CancelComponent:void 0,DoneComponent:void 0,CustomOperation:void 0});function g$({src:e,collapseStringsAfterLength:t=99,collapseStringMode:n="directly",customizeCollapseStringUI:r,collapseObjectsAfterLength:i=99,collapsed:a,onCollapse:o,enableClipboard:s=!0,editable:l=!1,onEdit:c,onDelete:u,onAdd:d,onChange:h,dark:f=!1,theme:p="default",customizeNode:g,customizeCopy:v=e=>(function(e){if("string"==typeof e)return e;try{return JSON.stringify(e,(e,t)=>{switch(typeof t){case"bigint":return String(t)+"n";case"number":case"boolean":case"object":case"string":return t;default:return String(t)}},void 0)}catch(e){return`${e.name}: ${e.message}`||"JSON.stringify failed"}})(e),displaySize:x,displayArrayIndex:y=!0,style:b,className:w,matchesURL:j=!1,urlRegExp:N=gY,ignoreLargeArray:k=!1,CopyComponent:C,CopiedComponent:E,EditComponent:_,CancelComponent:S,DoneComponent:T,CustomOperation:A}){let[O,M]=(0,em.useState)(0),P=(0,em.useCallback)(()=>M(e=>++e),[]),[D,L]=(0,em.useState)(e);return(0,em.useEffect)(()=>L(e),[e]),(0,ep.jsx)(gG.Provider,Object.assign({value:{src:D,collapseStringsAfterLength:t,collapseStringMode:n,customizeCollapseStringUI:r,collapseObjectsAfterLength:i,collapsed:a,onCollapse:o,enableClipboard:s,editable:l,onEdit:c,onDelete:u,onAdd:d,onChange:h,forceUpdate:P,customizeNode:g,customizeCopy:v,displaySize:x,displayArrayIndex:y,matchesURL:j,urlRegExp:N,ignoreLargeArray:k,CopyComponent:C,CopiedComponent:E,EditComponent:_,CancelComponent:S,DoneComponent:T,CustomOperation:A}},{children:(0,ep.jsx)("code",Object.assign({className:"json-view"+(f?" dark":"")+(p&&"default"!==p?" json-view_"+p:"")+(w?" "+w:""),style:b},{children:(0,ep.jsx)(gW,{node:D,depth:1,editHandle:(e,t,n,r)=>{L(t),c&&c({newValue:t,oldValue:n,depth:1,src:D,indexOrName:e,parentType:null,parentPath:r}),h&&h({type:"edit",depth:1,src:D,indexOrName:e,parentType:null,parentPath:r})},deleteHandle:(e,t)=>{L(void 0),u&&u({value:D,depth:1,src:D,indexOrName:e,parentType:null,parentPath:t}),h&&h({depth:1,src:D,indexOrName:e,parentType:null,type:"delete",parentPath:t})},parentPath:[]})}))}))}var tU=tU;let gX=(0,ej.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function gq(){}function gK(){}let gZ=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gQ=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gJ={};function g0(e,t){return((t||gJ).jsx?gQ:gZ).test(e)}let g1=/[ \t\n\f\r]/g;function g2(e){return""===e.replace(g1,"")}class g5{constructor(e,t){this.attribute=t,this.property=e}}g5.prototype.attribute="",g5.prototype.booleanish=!1,g5.prototype.boolean=!1,g5.prototype.commaOrSpaceSeparated=!1,g5.prototype.commaSeparated=!1,g5.prototype.defined=!1,g5.prototype.mustUseProperty=!1,g5.prototype.number=!1,g5.prototype.overloadedBoolean=!1,g5.prototype.property="",g5.prototype.spaceSeparated=!1,g5.prototype.space=void 0;let g3=0,g4=vn(),g6=vn(),g8=vn(),g7=vn(),g9=vn(),ve=vn(),vt=vn();function vn(){return 2**++g3}e.s(["boolean",0,g4,"booleanish",0,g6,"commaOrSpaceSeparated",0,vt,"commaSeparated",0,ve,"number",0,g7,"overloadedBoolean",0,g8,"spaceSeparated",0,g9],744);var vr=e.i(744);let vi=Object.keys(vr);class va extends g5{constructor(e,t,n,r){let i=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",r),"number"==typeof n)for(;++i<vi.length;){const e=vi[i];!function(e,t,n){n&&(e[t]=n)}(this,vi[i],(n&vr[e])===vr[e])}}}function vo(e){return e.toLowerCase()}va.prototype.defined=!0;let vs=/[A-Z]/g,vl=/-[a-z]/g,vc=/^data[-\w.:]+$/i;function vu(e){return"-"+e.toLowerCase()}function vd(e){return e.charAt(1).toUpperCase()}let vh={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class vf{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function vp(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new vf(n,r,t)}function vm(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new va(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[vo(r)]=r,n[vo(a.attribute)]=r}return new vf(t,n,e.space)}vf.prototype.normal={},vf.prototype.property={},vf.prototype.space=void 0;let vg=vm({properties:{ariaActiveDescendant:null,ariaAtomic:g6,ariaAutoComplete:null,ariaBusy:g6,ariaChecked:g6,ariaColCount:g7,ariaColIndex:g7,ariaColSpan:g7,ariaControls:g9,ariaCurrent:null,ariaDescribedBy:g9,ariaDetails:null,ariaDisabled:g6,ariaDropEffect:g9,ariaErrorMessage:null,ariaExpanded:g6,ariaFlowTo:g9,ariaGrabbed:g6,ariaHasPopup:null,ariaHidden:g6,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:g9,ariaLevel:g7,ariaLive:null,ariaModal:g6,ariaMultiLine:g6,ariaMultiSelectable:g6,ariaOrientation:null,ariaOwns:g9,ariaPlaceholder:null,ariaPosInSet:g7,ariaPressed:g6,ariaReadOnly:g6,ariaRelevant:null,ariaRequired:g6,ariaRoleDescription:g9,ariaRowCount:g7,ariaRowIndex:g7,ariaRowSpan:g7,ariaSelected:g6,ariaSetSize:g7,ariaSort:null,ariaValueMax:g7,ariaValueMin:g7,ariaValueNow:g7,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function vv(e,t){return t in e?e[t]:t}function vx(e,t){return vv(e,t.toLowerCase())}let vy=vm({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ve,acceptCharset:g9,accessKey:g9,action:null,allow:null,allowFullScreen:g4,allowPaymentRequest:g4,allowUserMedia:g4,alt:null,as:null,async:g4,autoCapitalize:null,autoComplete:g9,autoFocus:g4,autoPlay:g4,blocking:g9,capture:null,charSet:null,checked:g4,cite:null,className:g9,cols:g7,colSpan:null,content:null,contentEditable:g6,controls:g4,controlsList:g9,coords:g7|ve,crossOrigin:null,data:null,dateTime:null,decoding:null,default:g4,defer:g4,dir:null,dirName:null,disabled:g4,download:g8,draggable:g6,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:g4,formTarget:null,headers:g9,height:g7,hidden:g8,high:g7,href:null,hrefLang:null,htmlFor:g9,httpEquiv:g9,id:null,imageSizes:null,imageSrcSet:null,inert:g4,inputMode:null,integrity:null,is:null,isMap:g4,itemId:null,itemProp:g9,itemRef:g9,itemScope:g4,itemType:g9,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:g4,low:g7,manifest:null,max:null,maxLength:g7,media:null,method:null,min:null,minLength:g7,multiple:g4,muted:g4,name:null,nonce:null,noModule:g4,noValidate:g4,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:g4,optimum:g7,pattern:null,ping:g9,placeholder:null,playsInline:g4,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:g4,referrerPolicy:null,rel:g9,required:g4,reversed:g4,rows:g7,rowSpan:g7,sandbox:g9,scope:null,scoped:g4,seamless:g4,selected:g4,shadowRootClonable:g4,shadowRootDelegatesFocus:g4,shadowRootMode:null,shape:null,size:g7,sizes:null,slot:null,span:g7,spellCheck:g6,src:null,srcDoc:null,srcLang:null,srcSet:null,start:g7,step:null,style:null,tabIndex:g7,target:null,title:null,translate:null,type:null,typeMustMatch:g4,useMap:null,value:g6,width:g7,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:g9,axis:null,background:null,bgColor:null,border:g7,borderColor:null,bottomMargin:g7,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:g4,declare:g4,event:null,face:null,frame:null,frameBorder:null,hSpace:g7,leftMargin:g7,link:null,longDesc:null,lowSrc:null,marginHeight:g7,marginWidth:g7,noResize:g4,noHref:g4,noShade:g4,noWrap:g4,object:null,profile:null,prompt:null,rev:null,rightMargin:g7,rules:null,scheme:null,scrolling:g6,standby:null,summary:null,text:null,topMargin:g7,valueType:null,version:null,vAlign:null,vLink:null,vSpace:g7,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:g4,disableRemotePlayback:g4,prefix:null,property:null,results:g7,security:null,unselectable:null},space:"html",transform:vx}),vb=vm({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vt,accentHeight:g7,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:g7,amplitude:g7,arabicForm:null,ascent:g7,attributeName:null,attributeType:null,azimuth:g7,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:g7,by:null,calcMode:null,capHeight:g7,className:g9,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:g7,diffuseConstant:g7,direction:null,display:null,dur:null,divisor:g7,dominantBaseline:null,download:g4,dx:null,dy:null,edgeMode:null,editable:null,elevation:g7,enableBackground:null,end:null,event:null,exponent:g7,externalResourcesRequired:null,fill:null,fillOpacity:g7,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ve,g2:ve,glyphName:ve,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:g7,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:g7,horizOriginX:g7,horizOriginY:g7,id:null,ideographic:g7,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:g7,k:g7,k1:g7,k2:g7,k3:g7,k4:g7,kernelMatrix:vt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:g7,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:g7,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:g7,overlineThickness:g7,paintOrder:null,panose1:null,path:null,pathLength:g7,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:g9,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:g7,pointsAtY:g7,pointsAtZ:g7,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vt,rev:vt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vt,requiredFeatures:vt,requiredFonts:vt,requiredFormats:vt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:g7,specularExponent:g7,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:g7,strikethroughThickness:g7,string:null,stroke:null,strokeDashArray:vt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:g7,strokeOpacity:g7,strokeWidth:null,style:null,surfaceScale:g7,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vt,tabIndex:g7,tableValues:null,target:null,targetX:g7,targetY:g7,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:g7,underlineThickness:g7,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:g7,values:null,vAlphabetic:g7,vMathematical:g7,vectorEffect:null,vHanging:g7,vIdeographic:g7,version:null,vertAdvY:g7,vertOriginX:g7,vertOriginY:g7,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:g7,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:vv}),vw=vm({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),vj=vm({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:vx}),vN=vm({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),vk=vp([vg,vy,vw,vj,vN],"html"),vC=vp([vg,vb,vw,vj,vN],"svg");var vE=e.i(15511);let v_=vT("end"),vS=vT("start");function vT(e){return function(t){let n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function vA(e){return e&&"object"==typeof e?"position"in e||"type"in e?vM(e.position):"start"in e||"end"in e?vM(e):"line"in e||"column"in e?vO(e):"":""}function vO(e){return vP(e&&e.line)+":"+vP(e&&e.column)}function vM(e){return vO(e&&e.start)+"-"+vO(e&&e.end)}function vP(e){return e&&"number"==typeof e?e:1}class vD extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},a=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=o?o.line:void 0,this.name=vA(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}vD.prototype.file="",vD.prototype.name="",vD.prototype.reason="",vD.prototype.message="",vD.prototype.stack="",vD.prototype.column=void 0,vD.prototype.line=void 0,vD.prototype.ancestors=void 0,vD.prototype.cause=void 0,vD.prototype.fatal=void 0,vD.prototype.place=void 0,vD.prototype.ruleId=void 0,vD.prototype.source=void 0;let vL={}.hasOwnProperty,vI=new Map,vR=/[A-Z]/g,vB=new Set(["table","tbody","thead","tfoot","tr"]),vz=new Set(["td","th"]),vF="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vV(e,t,n){var r,i,a,o,s,l,c,u,d;let h,f,p,g,v,x,y,b,w,j,N;return"element"===t.type?(r=e,i=t,a=n,f=h=r.schema,"svg"===i.tagName.toLowerCase()&&"html"===h.space&&(r.schema=vC),r.ancestors.push(i),p=vY(r,i.tagName,!1),g=function(e,t){let n,r,i={};for(r in t.properties)if("children"!==r&&vL.call(t.properties,r)){let a=function(e,t,n){let r=function(e,t){let n=vo(t),r=t,i=g5;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&vc.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(vl,vd);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!vl.test(e)){let n=e.replace(vs,vu);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=va}return new i(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){var i;let t;if(Array.isArray(n)&&(n=r.commaSeparated?(t={},(""===(i=n)[i.length-1]?[...i,""]:i).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return(0,vE.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let t=new vD("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=vF+"#cannot-parse-style-attribute",t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,n={};for(t in e)vL.call(e,t)&&(n[function(e){let t=e.replace(vR,v$);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return n}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?vh[r.property]||r.property:r.attribute,n]}}(e,r,t.properties[r]);if(a){let[r,o]=a;e.tableCellAlignToStyle&&"align"===r&&"string"==typeof o&&vz.has(t.tagName)?n=o:i[r]=o}}return n&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=n),i}(r,i),v=vW(r,i),vB.has(i.tagName)&&(v=v.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&g2(e.value):g2(e))})),vU(r,g,p,i),vH(g,v),r.ancestors.pop(),r.schema=h,r.create(i,p,g,a)):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return gq("ExpressionStatement"===n.type),e.evaluater.evaluateExpression(n.expression)}vG(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?(o=e,s=t,l=n,y=x=o.schema,"svg"===s.name&&"html"===x.space&&(o.schema=vC),o.ancestors.push(s),b=null===s.name?o.Fragment:vY(o,s.name,!0),w=function(e,t){let n={};for(let r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];gq("ExpressionStatement"===t.type);let i=t.expression;gq("ObjectExpression"===i.type);let a=i.properties[0];gq("SpreadElement"===a.type),Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else vG(e,t.position);else{let i,a=r.name;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];gq("ExpressionStatement"===t.type),i=e.evaluater.evaluateExpression(t.expression)}else vG(e,t.position);else i=null===r.value||r.value;n[a]=i}return n}(o,s),j=vW(o,s),vU(o,w,b,s),vH(w,j),o.ancestors.pop(),o.schema=x,o.create(s,b,w,l)):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vG(e,t.position)}(e,t):"root"===t.type?(c=e,u=t,d=n,vH(N={},vW(c,u)),c.create(u,c.Fragment,N,d)):"text"===t.type?t.value:void 0}function vU(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function vH(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function vW(e,t){let n=[],r=-1,i=e.passKeys?new Map:vI;for(;++r<t.children.length;){let a,o=t.children[r];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=i.get(e)||0;a=e+"-"+t,i.set(e,t+1)}}let s=vV(e,o,a);void 0!==s&&n.push(s)}return n}function vY(e,t,n){let r;if(n)if(t.includes(".")){let e,n=t.split("."),i=-1;for(;++i<n.length;){let t=g0(n[i])?{type:"Identifier",name:n[i]}:{type:"Literal",value:n[i]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(i&&"Literal"===t.type),optional:!1}:t}gq(e,"always a result"),r=e}else r=g0(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){let t=r.value;return vL.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);vG(e)}function vG(e,t){let n=new vD("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=vF+"#cannot-handle-mdx-estrees-without-createevaluater",n}function v$(e){return"-"+e.toLowerCase()}let vX={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},vq={};function vK(e,t){let n=t||vq;return vZ(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function vZ(e,t,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return vQ(e.children,t,n)}return Array.isArray(e)?vQ(e,t,n):""}function vQ(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=vZ(e[i],t,n);return r.join("")}function vJ(e,t,n,r){let i,a=e.length,o=0;if(t=t<0?-t>a?0:a+t:t>a?a:t,n=n>0?n:0,r.length<1e4)(i=Array.from(r)).unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);o<r.length;)(i=r.slice(o,o+1e4)).unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function v0(e,t){return e.length>0?(vJ(e,e.length,0,t),e):t}let v1={}.hasOwnProperty;function v2(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let r,i=(v1.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];if(a)for(r in a){v1.call(i,r)||(i[r]=[]);let e=a[r];!function(e,t){let n=-1,r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);vJ(e,0,0,r)}(i[r],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}function v5(e){return null!==e&&e<-2}function v3(e){return -2===e||-1===e||32===e}function v4(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function v6(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return v3(r)?(e.enter(n),function r(o){return v3(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}v4(/[A-Za-z]/),v4(/[\dA-Za-z]/),v4(/[#-'*+\--9=?A-Z^-~]/),v4(/\d/),v4(/[\dA-Fa-f]/),v4(/[!-/:-@[-`{-~]/),v4(/\p{P}|\p{S}/u),v4(/\s/);let v8={tokenize:function(e){let t,n=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),v6(e,n,"linePrefix"))},function(n){return e.enter("paragraph"),function n(r){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return v5(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},v7={tokenize:function(e){let t,n,r,i=this,a=[],o=0;return s;function s(t){if(o<a.length){let n=a[o];return i.containerState=n[1],e.attempt(n[0].continuation,l,c)(t)}return c(t)}function l(e){if(o++,i.containerState._closeFlow){let n;i.containerState._closeFlow=void 0,t&&x();let r=i.events.length,a=r;for(;a--;)if("exit"===i.events[a][0]&&"chunkFlow"===i.events[a][1].type){n=i.events[a][1].end;break}v(o);let s=r;for(;s<i.events.length;)i.events[s][1].end={...n},s++;return vJ(i.events,a+1,0,i.events.slice(r)),i.events.length=s,c(e)}return s(e)}function c(n){if(o===a.length){if(!t)return h(n);if(t.currentConstruct&&t.currentConstruct.concrete)return p(n);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(v9,u,d)(n)}function u(e){return t&&x(),v(o),h(e)}function d(e){return i.parser.lazy[i.now().line]=o!==a.length,r=i.now().offset,p(e)}function h(t){return i.containerState={},e.attempt(v9,f,p)(t)}function f(e){return o++,a.push([i.currentConstruct,i.containerState]),h(e)}function p(r){if(null===r){t&&x(),v(0),e.consume(r);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:n}),function t(n){if(null===n){g(e.exit("chunkFlow"),!0),v(0),e.consume(n);return}return v5(n)?(e.consume(n),g(e.exit("chunkFlow")),o=0,i.interrupt=void 0,s):(e.consume(n),t)}(r)}function g(e,a){let s=i.sliceStream(e);if(a&&s.push(null),e.previous=n,n&&(n.next=e),n=e,t.defineSkip(e.start),t.write(s),i.parser.lazy[e.start.line]){let e,n,a=t.events.length;for(;a--;)if(t.events[a][1].start.offset<r&&(!t.events[a][1].end||t.events[a][1].end.offset>r))return;let s=i.events.length,l=s;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){n=i.events[l][1].end;break}e=!0}for(v(o),a=s;a<i.events.length;)i.events[a][1].end={...n},a++;vJ(i.events,l+1,0,i.events.slice(s)),i.events.length=a}}function v(t){let n=a.length;for(;n-- >t;){let t=a[n];i.containerState=t[1],t[0].exit.call(i,e)}a.length=t}function x(){t.write([null]),n=void 0,t=void 0,i.containerState._closeFlow=void 0}}},v9={tokenize:function(e,t,n){return v6(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},xe=xc(/[A-Za-z]/),xt=xc(/[\dA-Za-z]/),xn=xc(/[#-'*+\--9=?A-Z^-~]/),xr=xc(/\d/),xi=xc(/[\dA-Fa-f]/),xa=xc(/[!-/:-@[-`{-~]/);function xo(e){return null!==e&&e<-2}function xs(e){return null!==e&&(e<0||32===e)}function xl(e){return -2===e||-1===e||32===e}function xc(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xu(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return xl(r)?(e.enter(n),function r(o){return xl(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}xc(/\p{P}|\p{S}/u),xc(/\s/);let xd={partial:!0,tokenize:function(e,t,n){return function(t){return xl(t)?xu(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||xo(e)?t(e):n(e)}}};class xh{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=null==t?1/0:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(t||0),1/0);return n&&xf(this.left,n),r.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),xf(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),xf(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);xf(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);xf(this.left,t.reverse())}}}function xf(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function xp(e){let t,n,r,i,a,o,s,l={},c=-1,u=new xh(e);for(;++c<u.length;){for(;c in l;)c=l[c];if(t=u.get(c),c&&"chunkFlow"===t[1].type&&"listItemPrefix"===u.get(c-1)[1].type&&((r=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[r][1].type&&(r+=2),r<o.length&&"content"===o[r][1].type))for(;++r<o.length&&"content"!==o[r][1].type;)"chunkText"===o[r][1].type&&(o[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let n,r,i=e.get(t)[1],a=e.get(t)[2],o=t-1,s=[],l=i._tokenizer;!l&&(l=a.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let c=l.events,u=[],d={},h=-1,f=i,p=0,g=0,v=[0];for(;f;){for(;e.get(++o)[1]!==f;);s.push(o),!f._tokenizer&&(n=a.sliceStream(f),f.next||n.push(null),r&&l.defineSkip(f.start),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(n),f._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),r=f,f=f.next}for(f=i;++h<c.length;)"exit"===c[h][0]&&"enter"===c[h-1][0]&&c[h][1].type===c[h-1][1].type&&c[h][1].start.line!==c[h][1].end.line&&(g=h+1,v.push(g),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(l.events=[],f?(f._tokenizer=void 0,f.previous=void 0):v.pop(),h=v.length;h--;){let t=c.slice(v[h],v[h+1]),n=s.pop();u.push([n,n+t.length-1]),e.splice(n,2,t)}for(u.reverse(),h=-1;++h<u.length;)d[p+u[h][0]]=p+u[h][1],p+=u[h][1]-u[h][0]-1;return d}(u,c)),c=l[c],s=!0);else if(t[1]._container){for(r=c,n=void 0;r--;)if("lineEnding"===(i=u.get(r))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(n&&(u.get(n)[1].type="lineEndingBlank"),i[1].type="lineEnding",n=r);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;n&&(t[1].end={...u.get(n)[1].start},(a=u.slice(n,c)).unshift(t),u.splice(n,c-n+1,a))}}return vJ(e,0,1/0,u.slice(0)),!s}let xm={resolve:function(e){return xp(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):xo(t)?e.check(xg,a,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function a(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},xg={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),xu(e,i,"linePrefix")};function i(i){if(null===i||xo(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}},xv={tokenize:function(e){let t=this,n=e.attempt(xd,function(r){return null===r?void e.consume(r):(e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n)},e.attempt(this.parser.constructs.flowInitial,r,v6(e,e.attempt(this.parser.constructs.flow,r,e.attempt(xm,r)),"linePrefix")));return n;function r(r){return null===r?void e.consume(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n)}}},xx={resolveAll:xj()},xy=xw("string"),xb=xw("text");function xw(e){return{resolveAll:xj("text"===e?xN:void 0),tokenize:function(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return l(e)?i(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),s)}function s(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),s)}function l(e){if(null===e)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function xj(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function xN(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r,i=e[n-1][1],a=t.sliceStream(i),o=a.length,s=-1,l=0;for(;o--;){let e=a[o];if("string"==typeof e){for(s=e.length;32===e.charCodeAt(s-1);)l++,s--;if(s)break;s=-1}else if(-2===e)r=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){let a={type:n===e.length||r||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):(e.splice(n,0,["enter",a,t],["exit",a,t]),n+=2)}n++}return e}xE(/[A-Za-z]/),xE(/[\dA-Za-z]/),xE(/[#-'*+\--9=?A-Z^-~]/),xE(/\d/),xE(/[\dA-Fa-f]/),xE(/[!-/:-@[-`{-~]/);let xk=xE(/\p{P}|\p{S}/u),xC=xE(/\s/);function xE(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function x_(e){return null===e||null!==e&&(e<0||32===e)||xC(e)?1:xk(e)?2:void 0}function xS(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}let xT={name:"attention",resolveAll:function(e,t){let n,r,i,a,o,s,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close){for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;s=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;let d={...e[n][1].end},h={...e[u][1].start};xA(d,-s),xA(h,s),a={type:s>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},o={type:s>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:h},i={type:s>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[u][1].start}},r={type:s>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[n][1].end={...a.start},e[u][1].start={...o.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=v0(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=v0(l,[["enter",r,t],["enter",a,t],["exit",a,t],["enter",i,t]]),l=v0(l,xS(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),l=v0(l,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=v0(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,vJ(e,n-1,u-n+3,l),u=n+l.length-c-2;break}}for(u=-1;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){let n,r=this.parser.constructs.attentionMarkers.null,i=this.previous,a=x_(i);return function(o){return n=o,e.enter("attentionSequence"),function o(s){if(s===n)return e.consume(s),o;let l=e.exit("attentionSequence"),c=x_(s),u=!c||2===c&&a||r.includes(s),d=!a||2===a&&c||r.includes(i);return l._open=!!(42===n?u:u&&(a||!d)),l._close=!!(42===n?d:d&&(c||!u)),t(s)}(o)}}};function xA(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let xO={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return xl(t)?xu(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(xO,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return xl(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}},xM={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return xa(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},xP=document.createElement("i");function xD(e){let t="&"+e+";";xP.innerHTML=t;let n=xP.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let xL={name:"characterReference",tokenize:function(e,t,n){let r,i,a=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),s};function s(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),r=31,i=xt,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,i=xi,c):(e.enter("characterReferenceValue"),r=7,i=xr,c(t))}function c(s){if(59===s&&o){let r=e.exit("characterReferenceValue");return i!==xt||xD(a.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(s),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(s)}return i(s)&&o++<r?(e.consume(s),c):n(s)}}},xI={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},xR={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){let r,i=this,a={partial:!0,tokenize:function(e,t,n){let a=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),xl(t)?xu(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(i){return i===r?(a++,e.consume(i),t):a>=s?(e.exit("codeFencedFenceSequence"),xl(i)?xu(e,c,"whitespace")(i):c(i)):n(i)}(t)):n(t)}function c(r){return null===r||xo(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}},o=0,s=0;return function(t){var a;let c;return a=t,o=(c=i.events[i.events.length-1])&&"linePrefix"===c[1].type?c[2].sliceSerialize(c[1],!0).length:0,r=a,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===r?(s++,e.consume(i),t):s<3?n(i):(e.exit("codeFencedFenceSequence"),xl(i)?xu(e,l,"whitespace")(i):l(i))}(a)};function l(a){return null===a||xo(a)?(e.exit("codeFencedFence"),i.interrupt?t(a):e.check(xI,u,p)(a)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||xo(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):xl(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),xu(e,c,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(a))}function c(t){return null===t||xo(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||xo(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===r?n(i):(e.consume(i),t)}(t))}function u(t){return e.attempt(a,p,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return o>0&&xl(t)?xu(e,f,"linePrefix",o+1)(t):f(t)}function f(t){return null===t||xo(t)?e.check(xI,u,p)(t):(e.enter("codeFlowValue"),function t(n){return null===n||xo(n)?(e.exit("codeFlowValue"),f(n)):(e.consume(n),t)}(t))}function p(n){return e.exit("codeFenced"),t(n)}}},xB={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),xu(e,i,"linePrefix",5)(t)};function i(t){let i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(n){return null===n?a(n):xo(n)?e.attempt(xz,t,a)(n):(e.enter("codeFlowValue"),function n(r){return null===r||xo(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function a(n){return e.exit("codeIndented"),t(n)}}},xz={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):xo(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):xu(e,a,"linePrefix",5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):xo(e)?i(e):n(e)}}};function xF(e){return null!==e&&(e<32||127===e)}function xV(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xU(e,t,n,r,i,a,o,s,l){let c=l||1/0,u=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),d):null===t||32===t||41===t||xF(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),p(t))};function d(n){return 62===n?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(s),d(t)):null===t||60===t||null!==t&&t<-2?n(t):(e.consume(t),92===t?f:h)}function f(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function p(i){return!u&&(null===i||41===i||null!==i&&(i<0||32===i))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(i)):u<c&&40===i?(e.consume(i),u++,p):41===i?(e.consume(i),u--,p):null===i||32===i||40===i||xF(i)?n(i):(e.consume(i),92===i?g:p)}function g(t){return 40===t||41===t||92===t?(e.consume(t),p):p(t)}}function xH(e){return null!==e&&e<-2}function xW(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xY(e,t,n,r,i,a){let o,s=this,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),c};function c(d){return l>999||null===d||91===d||93===d&&!o||94===d&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):93===d?(e.exit(a),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):xH(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||xH(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),o||(o=-2!==t&&-1!==t&&32!==t),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,u):u(t)}}function xG(e){return null!==e&&e<-2}function x$(e){return -2===e||-1===e||32===e}function xX(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xq(e,t,n,r,i,a){let o;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=40===t?41:t,s):n(t)};function s(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){if(t===o)return e.exit(a),s(o);if(null===t)return n(t);if(xG(t)){var r,i;let n,a;return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),r=l,i="linePrefix",n=1/0,a=0,function(t){return x$(t)?(e.enter(i),function t(o){return x$(o)&&a++<n?(e.consume(o),t):(e.exit(i),r(o))}(t)):r(t)}}return e.enter("chunkString",{contentType:"string"}),c(t)}function c(t){return t===o||null===t||xG(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return t===o||92===t?(e.consume(t),c):c(t)}}function xK(e){return -2===e||-1===e||32===e}function xZ(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function xQ(e,t){let n;return function r(i){var a,o;if(null!==i&&i<-2)return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r;if(xK(i)){let t,s;return(a=r,o=n?"linePrefix":"lineSuffix",t=1/0,s=0,function(n){return xK(n)?(e.enter(o),function n(r){return xK(r)&&s++<t?(e.consume(r),n):(e.exit(o),a(r))}(n)):a(n)})(i)}return t(i)}}function xJ(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}xV(/[A-Za-z]/),xV(/[\dA-Za-z]/),xV(/[#-'*+\--9=?A-Z^-~]/),xV(/\d/),xV(/[\dA-Fa-f]/),xV(/[!-/:-@[-`{-~]/),xV(/\p{P}|\p{S}/u),xV(/\s/),xW(/[A-Za-z]/),xW(/[\dA-Za-z]/),xW(/[#-'*+\--9=?A-Z^-~]/),xW(/\d/),xW(/[\dA-Fa-f]/),xW(/[!-/:-@[-`{-~]/),xW(/\p{P}|\p{S}/u),xW(/\s/),xX(/[A-Za-z]/),xX(/[\dA-Za-z]/),xX(/[#-'*+\--9=?A-Z^-~]/),xX(/\d/),xX(/[\dA-Fa-f]/),xX(/[!-/:-@[-`{-~]/),xX(/\p{P}|\p{S}/u),xX(/\s/),xZ(/[A-Za-z]/),xZ(/[\dA-Za-z]/),xZ(/[#-'*+\--9=?A-Z^-~]/),xZ(/\d/),xZ(/[\dA-Fa-f]/),xZ(/[!-/:-@[-`{-~]/),xZ(/\p{P}|\p{S}/u),xZ(/\s/);let x0={partial:!0,tokenize:function(e,t,n){return function(t){return xs(t)?xQ(e,r)(t):n(t)};function r(t){return xq(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return xl(t)?xu(e,a,"whitespace")(t):a(t)}function a(e){return null===e||xo(e)?t(e):n(e)}}},x1=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],x2=["pre","script","style","textarea"],x5={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(xd,t,n)}}},x3={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return xo(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},x4={name:"labelEnd",resolveAll:function(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&vJ(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,i,a,o=e.length,s=0;for(;o--;)if(n=e[o][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[o][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[o][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=o,"labelLink"!==n.type)){s=2;break}}else"labelEnd"===n.type&&(i=o);let l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},u={type:"labelText",start:{...e[r+s+2][1].end},end:{...e[i-2][1].start}};return a=v0(a=[["enter",l,t],["enter",c,t]],e.slice(r+1,r+s+3)),a=v0(a,[["enter",u,t]]),a=v0(a,xS(t.parser.constructs.insideSpan.null,e.slice(r+s+4,i-3),t)),a=v0(a,[["exit",u,t],e[i-2],e[i-1],["exit",c,t]]),a=v0(a,e.slice(i+1)),a=v0(a,[["exit",l,t]]),vJ(e,r,e.length,a),e},tokenize:function(e,t,n){let r,i,a=this,o=a.events.length;for(;o--;)if(("labelImage"===a.events[o][1].type||"labelLink"===a.events[o][1].type)&&!a.events[o][1]._balanced){r=a.events[o][1];break}return function(t){return r?r._inactive?u(t):(i=a.parser.defined.includes(xJ(a.sliceSerialize({start:r.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),s):n(t)};function s(t){return 40===t?e.attempt(x6,c,i?c:u)(t):91===t?e.attempt(x8,c,i?l:u)(t):i?c(t):u(t)}function l(t){return e.attempt(x7,c,u)(t)}function c(e){return t(e)}function u(e){return r._balanced=!0,n(e)}}},x6={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return xs(t)?xQ(e,i)(t):i(t)}function i(t){return 41===t?c(t):xU(e,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function a(t){return xs(t)?xQ(e,s)(t):c(t)}function o(e){return n(e)}function s(t){return 34===t||39===t||40===t?xq(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return xs(t)?xQ(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},x8={tokenize:function(e,t,n){let r=this;return function(t){return xY.call(r,e,i,a,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(xJ(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function a(e){return n(e)}}},x7={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},x9={name:"labelStartImage",resolveAll:x4.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),a):n(t)}function a(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},ye={name:"labelStartLink",resolveAll:x4.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},yt={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),xu(e,t,"linePrefix")}}},yn={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(a){var o;return e.enter("thematicBreak"),r=o=a,function a(o){return o===r?(e.enter("thematicBreakSequence"),function t(n){return n===r?(e.consume(n),i++,t):(e.exit("thematicBreakSequence"),xl(n)?xu(e,a,"whitespace")(n):a(n))}(o)):i>=3&&(null===o||xo(o))?(e.exit("thematicBreak"),t(o)):n(o)}(o)}}},yr={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(xd,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,xu(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!xl(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ya,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,xu(e,e.attempt(yr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,o=0;return function(t){let i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:xr(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(yn,n,s)(t):s(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return xr(i)&&++o<10?(e.consume(i),t):(!r.interrupt||o<2)&&(r.containerState.marker?i===r.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),s(i)):n(i)}(t)}return n(t)};function s(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(xd,r.interrupt?n:l,e.attempt(yi,u,c))}function l(e){return r.containerState.initialBlankLine=!0,a++,u(e)}function c(t){return xl(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),u):n(t)}function u(n){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},yi={partial:!0,tokenize:function(e,t,n){let r=this;return xu(e,function(e){let i=r.events[r.events.length-1];return!xl(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},ya={partial:!0,tokenize:function(e,t,n){let r=this;return xu(e,function(e){let i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},yo={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,a=e.length;for(;a--;)if("enter"===e[a][0]){if("content"===e[a][1].type){n=a;break}"paragraph"===e[a][1].type&&(r=a)}else"content"===e[a][1].type&&e.splice(a,1),i||"definition"!==e[a][1].type||(i=a);let o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,n){let r,i=this;return function(t){var o;let s,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){s="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||s)?(e.enter("setextHeadingLine"),r=t,o=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),xl(n)?xu(e,a,"lineSuffix")(n):a(n))}(o)):n(t)};function a(r){return null===r||xo(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,n){let r,i=this;return function(t){var r;return e.enter("definition"),r=t,xY.call(i,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function a(t){return(r=xJ(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):n(t)}function o(t){return xs(t)?xQ(e,s)(t):s(t)}function s(t){return xU(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(x0,c,c)(t)}function c(t){return xl(t)?xu(e,u,"whitespace")(t):u(t)}function u(a){return null===a||xo(a)?(e.exit("definition"),i.parser.defined.push(r),t(a)):n(a)}}}},"disable",0,{null:[]},"document",0,{42:yr,43:yr,45:yr,48:yr,49:yr,50:yr,51:yr,52:yr,53:yr,54:yr,55:yr,56:yr,57:yr,62:xO},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,a=3;return"whitespace"===e[3][1].type&&(a+=2),i-2>a&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(a===i-1||i-4>a&&"whitespace"===e[i-2][1].type)&&(i-=a+1===i?2:4),i>a&&(n={type:"atxHeadingText",start:e[a][1].start,end:e[i][1].end},r={type:"chunkText",start:e[a][1].start,end:e[i][1].end,contentType:"text"},vJ(e,a,i-a+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(i){var a;return e.enter("atxHeading"),a=i,e.enter("atxHeadingSequence"),function i(a){return 35===a&&r++<6?(e.consume(a),i):null===a||xs(a)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function t(r){return 35===r?(e.consume(r),t):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||xo(r)?(e.exit("atxHeading"),t(r)):xl(r)?xu(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||xs(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(a)):n(a)}(a)}}},42:yn,45:[yo,yn],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,n){let r,i,a,o,s,l=this;return function(t){var n;return n=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),c};function c(o){return 33===o?(e.consume(o),u):47===o?(e.consume(o),i=!0,f):63===o?(e.consume(o),r=3,l.interrupt?t:P):xe(o)?(e.consume(o),a=String.fromCharCode(o),p):n(o)}function u(i){return 45===i?(e.consume(i),r=2,d):91===i?(e.consume(i),r=5,o=0,h):xe(i)?(e.consume(i),r=4,l.interrupt?t:P):n(i)}function d(r){return 45===r?(e.consume(r),l.interrupt?t:P):n(r)}function h(r){let i="CDATA[";return r===i.charCodeAt(o++)?(e.consume(r),o===i.length)?l.interrupt?t:C:h:n(r)}function f(t){return xe(t)?(e.consume(t),a=String.fromCharCode(t),p):n(t)}function p(o){if(null===o||47===o||62===o||xs(o)){let s=47===o,c=a.toLowerCase();return!s&&!i&&x2.includes(c)?(r=1,l.interrupt?t(o):C(o)):x1.includes(a.toLowerCase())?(r=6,s)?(e.consume(o),g):l.interrupt?t(o):C(o):(r=7,l.interrupt&&!l.parser.lazy[l.now().line]?n(o):i?function t(n){return xl(n)?(e.consume(n),t):N(n)}(o):v(o))}return 45===o||xt(o)?(e.consume(o),a+=String.fromCharCode(o),p):n(o)}function g(r){return 62===r?(e.consume(r),l.interrupt?t:C):n(r)}function v(t){return 47===t?(e.consume(t),N):58===t||95===t||xe(t)?(e.consume(t),x):xl(t)?(e.consume(t),v):N(t)}function x(t){return 45===t||46===t||58===t||95===t||xt(t)?(e.consume(t),x):y(t)}function y(t){return 61===t?(e.consume(t),b):xl(t)?(e.consume(t),y):v(t)}function b(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),s=t,w):xl(t)?(e.consume(t),b):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||xs(n)?y(n):(e.consume(n),t)}(t)}function w(t){return t===s?(e.consume(t),s=null,j):null===t||xo(t)?n(t):(e.consume(t),w)}function j(e){return 47===e||62===e||xl(e)?v(e):n(e)}function N(t){return 62===t?(e.consume(t),k):n(t)}function k(t){return null===t||xo(t)?C(t):xl(t)?(e.consume(t),k):n(t)}function C(t){return 45===t&&2===r?(e.consume(t),T):60===t&&1===r?(e.consume(t),A):62===t&&4===r?(e.consume(t),D):63===t&&3===r?(e.consume(t),P):93===t&&5===r?(e.consume(t),M):xo(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(x5,L,E)(t)):null===t||xo(t)?(e.exit("htmlFlowData"),E(t)):(e.consume(t),C)}function E(t){return e.check(x3,_,L)(t)}function _(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),S}function S(t){return null===t||xo(t)?E(t):(e.enter("htmlFlowData"),C(t))}function T(t){return 45===t?(e.consume(t),P):C(t)}function A(t){return 47===t?(e.consume(t),a="",O):C(t)}function O(t){if(62===t){let n=a.toLowerCase();return x2.includes(n)?(e.consume(t),D):C(t)}return xe(t)&&a.length<8?(e.consume(t),a+=String.fromCharCode(t),O):C(t)}function M(t){return 93===t?(e.consume(t),P):C(t)}function P(t){return 62===t?(e.consume(t),D):45===t&&2===r?(e.consume(t),P):C(t)}function D(t){return null===t||xo(t)?(e.exit("htmlFlowData"),L(t)):(e.consume(t),D)}function L(n){return e.exit("htmlFlow"),t(n)}}},61:yo,95:yn,96:xR,126:xR},"flowInitial",0,{[-2]:xB,[-1]:xB,32:xB},"insideSpan",0,{null:[xT,xx]},"string",0,{38:xL,92:xM},"text",0,{[-5]:yt,[-4]:yt,[-3]:yt,33:x9,38:xL,42:xT,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return xe(t)?(e.consume(t),a):64===t?n(t):s(t)}function a(t){return 43===t||45===t||46===t||xt(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,o):(43===n||45===n||46===n||xt(n))&&r++<32?(e.consume(n),t):(r=0,s(n))}(t)):s(t)}function o(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||null!==r&&(r<32||127===r)?n(r):(e.consume(r),o)}function s(t){return 64===t?(e.consume(t),l):xn(t)?(e.consume(t),s):n(t)}function l(i){return xt(i)?function i(a){return 46===a?(e.consume(a),r=0,l):62===a?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(a),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(a){if((45===a||xt(a))&&r++<63){let n=45===a?t:i;return e.consume(a),n}return n(a)}(a)}(i):n(i)}}},{name:"htmlText",tokenize:function(e,t,n){let r,i,a,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),s};function s(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),w):63===t?(e.consume(t),y):xe(t)?(e.consume(t),N):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),i=0,f):xe(t)?(e.consume(t),x):n(t)}function c(t){return 45===t?(e.consume(t),h):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),d):xo(t)?(a=u,O(t)):(e.consume(t),u)}function d(t){return 45===t?(e.consume(t),h):u(t)}function h(e){return 62===e?A(e):45===e?d(e):u(e)}function f(t){let r="CDATA[";return t===r.charCodeAt(i++)?(e.consume(t),i===r.length?p:f):n(t)}function p(t){return null===t?n(t):93===t?(e.consume(t),g):xo(t)?(a=p,O(t)):(e.consume(t),p)}function g(t){return 93===t?(e.consume(t),v):p(t)}function v(t){return 62===t?A(t):93===t?(e.consume(t),v):p(t)}function x(t){return null===t||62===t?A(t):xo(t)?(a=x,O(t)):(e.consume(t),x)}function y(t){return null===t?n(t):63===t?(e.consume(t),b):xo(t)?(a=y,O(t)):(e.consume(t),y)}function b(e){return 62===e?A(e):y(e)}function w(t){return xe(t)?(e.consume(t),j):n(t)}function j(t){return 45===t||xt(t)?(e.consume(t),j):function t(n){return xo(n)?(a=t,O(n)):xl(n)?(e.consume(n),t):A(n)}(t)}function N(t){return 45===t||xt(t)?(e.consume(t),N):47===t||62===t||xs(t)?k(t):n(t)}function k(t){return 47===t?(e.consume(t),A):58===t||95===t||xe(t)?(e.consume(t),C):xo(t)?(a=k,O(t)):xl(t)?(e.consume(t),k):A(t)}function C(t){return 45===t||46===t||58===t||95===t||xt(t)?(e.consume(t),C):function t(n){return 61===n?(e.consume(n),E):xo(n)?(a=t,O(n)):xl(n)?(e.consume(n),t):k(n)}(t)}function E(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,_):xo(t)?(a=E,O(t)):xl(t)?(e.consume(t),E):(e.consume(t),S)}function _(t){return t===r?(e.consume(t),r=void 0,T):null===t?n(t):xo(t)?(a=_,O(t)):(e.consume(t),_)}function S(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||xs(t)?k(t):(e.consume(t),S)}function T(e){return 47===e||62===e||xs(e)?k(e):n(e)}function A(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function O(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),M}function M(t){return xl(t)?xu(e,P,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):P(t)}function P(t){return e.enter("htmlTextData"),a(t)}}}],91:ye,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return xo(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},xM],93:x4,95:xT,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,a=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),a++,t):(e.exit("codeTextSequence"),o(n))}(t)};function o(l){return null===l?n(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(i=e.enter("codeTextSequence"),r=0,function n(o){return 96===o?(e.consume(o),r++,n):r===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(i.type="codeTextData",s(o))}(l)):xo(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),s(l))}function s(t){return null===t||32===t||96===t||xo(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),s)}}}}],4127);var ys=e.i(4127);let yl=/[\0\t\n\r]/g;function yc(e,t){let n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let yu=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function yd(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return yc(n.slice(t?2:1),t?16:10)}return xD(n)||e}let yh={}.hasOwnProperty;function yf(e){return{line:e.line,column:e.column,offset:e.offset}}function yp(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+vA({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vA({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+vA({start:t.start,end:t.end})+") is still open")}function ym(e){let t=this;t.parser=function(n){var r,i;let a,o,s,l;return"string"!=typeof(r={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=r,r=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(x),autolinkProtocol:c,autolinkEmail:c,atxHeading:r(p),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:c,characterReference:c,codeFenced:r(f),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(f,i),codeText:r(function(){return{type:"inlineCode",value:""}},i),codeTextData:c,data:c,codeFlowValue:c,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(g),hardBreakTrailing:r(g),htmlFlow:r(v,i),htmlFlowData:c,htmlText:r(v,i),htmlTextData:c,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:r(x),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(y,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(y),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(p),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){u.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){u.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:u,characterReferenceMarkerHexadecimal:h,characterReferenceMarkerNumeric:h,characterReferenceValue:function(e){let t,n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(t=yc(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=xD(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=yf(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:u,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:u,data:u,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=xJ(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(d),hardBreakTrailing:o(d),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:u,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:u,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=t},labelText:function(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=t.replace(yu,yd),n.identifier=xJ(t).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=yf(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(c.call(this,e),u.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=xJ(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,n){let r=-1;for(;++r<n.length;){let i=n[r];Array.isArray(i)?e(t,i):function(e,t){let n;for(n in t)if(yh.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},o={stack:[r],tokenStack:[],config:t,enter:a,exit:s,buffer:i,resume:l,data:n},c=[],u=-1;for(;++u<e.length;)("listOrdered"===e[u][1].type||"listUnordered"===e[u][1].type)&&("enter"===e[u][0]?c.push(u):u=function(e,t,n){let r,i,a,o,s=t-1,l=-1,c=!1;for(;++s<=n;){let t=e[s];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||o||l||a||(a=s),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let o=s;for(i=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}a&&(!i||a<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||s,0,["exit",r,t[2]]),s++,n++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(s,0,["enter",i,t[2]]),s++,n++,a=void 0,o=!0}}}return e[t][1]._spread=c,n}(e,c.pop(),u));for(u=-1;++u<e.length;){let n=t[e[u][0]];yh.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},o),e[u][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||yp).call(o,void 0,e[0])}for(r.position={start:yf(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:yf(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)r=t.transforms[u](r)||r;return r};function r(e,t){return function(n){a.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:yf(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),s.call(this,t)}}function s(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||yp).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+vA({start:e.start,end:e.end})+"): it’s not open");n.position.end=yf(e.end)}function l(){return vK(this.stack.pop())}function c(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:yf(e.start),end:void 0},t.push(n)),this.stack.push(n)}function u(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=yf(e.end)}function d(){this.data.atHardBreak=!0}function h(e){this.data.characterReferenceType=e.type}function f(){return{type:"code",lang:null,meta:null,value:""}}function p(){return{type:"heading",depth:0,children:[]}}function g(){return{type:"break"}}function v(){return{type:"html",value:""}}function x(){return{type:"link",title:null,url:"",children:[]}}function y(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!xp(e););return e}((function(e){let t={constructs:v2([ys,...(e||{}).extensions||[]]),content:n(v8),defined:[],document:n(v7),flow:n(xv),lazy:{},string:n(xy),text:n(xb)};return t;function n(e){return function(n){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],l={attempt:p(function(e,t){g(e,t.from)}),check:p(f),consume:function(e){v5(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,v()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),c.events.push(["enter",n,c]),s.push(n),n},exit:function(e){let t=s.pop();return t.end=h(),c.events.push(["exit",t,c]),t},interrupt:p(f,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,v()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let a,o=e[r];if("string"==typeof o)a=o;else switch(o){case -5:a="\r";break;case -4:a="\n";break;case -3:a="\r\n";break;case -2:a=t?" ":" ";break;case -1:if(!t&&n)continue;a=" ";break;default:a=String.fromCharCode(o)}n=-2===o,i.push(a)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(o=v0(o,e),function(){let e;for(;r._index<o.length;){let n=o[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;){var t;t=n.charCodeAt(r._bufferIndex),u=u(t)}else u=u(n)}}(),null!==o[o.length-1])?[]:(g(t,0),c.events=xS(a,c.events,c),c.events)}},u=t.tokenize.call(c,l);return t.resolveAll&&a.push(t),c;function d(e){return function(e,t){let n,r=t.start._index,i=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;if(r===a)n=[e[r].slice(i,o)];else{if(n=e.slice(r,a),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}o>0&&n.push(e[a].slice(0,o))}return n}(o,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function f(e,t){t.restore()}function p(e,t){return function(n,i,a){var o;let u,d,f,p;return Array.isArray(n)?g(n):"tokenize"in n?g([n]):(o=n,function(e){let t=null!==e&&o[e],n=null!==e&&o.null;return g([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function g(e){return(u=e,d=0,0===e.length)?a:x(e[d])}function x(e){return function(n){let i,a,o,u,d;return(i=h(),a=c.previous,o=c.currentConstruct,u=c.events.length,d=Array.from(s),p={from:u,restore:function(){r=i,c.previous=a,c.currentConstruct=o,c.events.length=u,s=d,v()}},f=e,e.partial||(c.currentConstruct=e),e.name&&c.parser.constructs.disable.null.includes(e.name))?b(n):e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,y,b)(n)}}function y(t){return e(f,p),i}function b(e){return(p.restore(),++d<u.length)?x(u[d]):a}}}function g(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&vJ(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function v(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(t,e,n)}}})(i).document().write((o=1,s="",l=!0,function(e,t,n){let r,i,c,u,d,h=[];for(e=s+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),c=0,s="",l&&(65279===e.charCodeAt(0)&&c++,l=void 0);c<e.length;){if(yl.lastIndex=c,u=(r=yl.exec(e))&&void 0!==r.index?r.index:e.length,d=e.charCodeAt(u),!r){s=e.slice(c);break}if(10===d&&c===u&&a)h.push(-3),a=void 0;else switch(a&&(h.push(-5),a=void 0),c<u&&(h.push(e.slice(c,u)),o+=u-c),d){case 0:h.push(65533),o++;break;case 9:for(i=4*Math.ceil(o/4),h.push(-2);o++<i;)h.push(-1);break;case 10:h.push(-4),o=1;break;default:a=!0,o=1}c=u+1}return n&&(a&&h.push(-5),s&&h.push(s),h.push(null)),h})(n,r,!0))))}}let yg="object"==typeof self?self:globalThis,yv=e=>{var t;let n,r;return(t=new Map,n=(e,n)=>(t.set(n,e),e),r=i=>{if(t.has(i))return t.get(i);let[a,o]=e[i];switch(a){case 0:case -1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new yg[e](t),i)}case 8:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new yg[a](o),i)})(0)},{toString:yx}={},{keys:yy}=Object,yb=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=yx.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},yw=([e,t])=>0===e&&("function"===t||"symbol"===t),yj=(e,{json:t,lossy:n}={})=>{var r,i,a;let o,s,l=[];return(r=!(t||n),i=!!t,a=new Map,o=(e,t)=>{let n=l.push(e)-1;return a.set(t,n),n},s=e=>{if(a.has(e))return a.get(e);let[t,n]=yb(e);switch(t){case 0:{let i=e;switch(n){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(r)throw TypeError("unable to serialize "+n);i=null;break;case"undefined":return o([-1],e)}return o([t,i],e)}case 1:{if(n){let t=e;return"DataView"===n?t=new Uint8Array(e.buffer):"ArrayBuffer"===n&&(t=new Uint8Array(e)),o([n,[...t]],e)}let r=[],i=o([t,r],e);for(let t of e)r.push(s(t));return i}case 2:{if(n)switch(n){case"BigInt":return o([n,e.toString()],e);case"Boolean":case"Number":case"String":return o([n,e.valueOf()],e)}if(i&&"toJSON"in e)return s(e.toJSON());let a=[],l=o([t,a],e);for(let t of yy(e))(r||!yw(yb(e[t])))&&a.push([s(t),s(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:n,flags:r}=e;return o([t,{source:n,flags:r}],e)}case 5:{let n=[],i=o([t,n],e);for(let[t,i]of e)(r||!(yw(yb(t))||yw(yb(i))))&&n.push([s(t),s(i)]);return i}case 6:{let n=[],i=o([t,n],e);for(let t of e)(r||!yw(yb(t)))&&n.push(s(t));return i}}let{message:l}=e;return o([t,{name:n,message:l}],e)})(e),l},yN="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?yv(yj(e,t)):structuredClone(e):(e,t)=>yv(yj(e,t));yC(/[A-Za-z]/);let yk=yC(/[\dA-Za-z]/);function yC(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function yE(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o="";if(37===a&&yk(e.charCodeAt(n+1))&&yk(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o="�"}else o=String.fromCharCode(a);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function y_(e,t){let n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function yS(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}yC(/[#-'*+\--9=?A-Z^-~]/),yC(/\d/),yC(/[\dA-Fa-f]/),yC(/[!-/:-@[-`{-~]/),yC(/\p{P}|\p{S}/u),yC(/\s/);let yT=function(e){var t,n;if(null==e)return yO;if("function"==typeof e)return yA(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=yT(e[n]);return yA(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(t=e,yA(function(e){let n;for(n in t)if(e[n]!==t[n])return!1;return!0}))}if("string"==typeof e){return n=e,yA(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function yA(e){return function(t,n,r){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function yO(){return!0}let yM=[];function yP(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;let a=yT(i),o=r?-1:1;(function e(i,s,l){let c=i&&"object"==typeof i?i:{};if("string"==typeof c.type){let e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(u,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return u;function u(){var c;let u,d,h,f=yM;if((!t||a(i,s,l[l.length-1]||void 0))&&!1===(f=Array.isArray(c=n(i,l))?c:"number"==typeof c?[!0,c]:null==c?yM:[c])[0])return f;if("children"in i&&i.children&&i.children&&"skip"!==f[0])for(d=(r?i.children.length:-1)+o,h=l.concat(i);d>-1&&d<i.children.length;){if(!1===(u=e(i.children[d],d,h)())[0])return u;d="number"==typeof u[1]?u[1]:d+o}return f}})(e,void 0,[])()}function yD(e,t,n,r){let i,a,o;"function"==typeof t&&"function"!=typeof n?(a=void 0,o=t,i=n):(a=t,o=n,i=r),yP(e,a,function(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)},i)}function yL(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),a=i[0];a&&"text"===a.type?a.value="["+a.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&"text"===o.type?o.value+=r:i.push({type:"text",value:r}),i}function yI(e){let t=e.spread;return null==t?e.children.length>1:t}function yR(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}let yB={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a={type:"element",tagName:"pre",properties:{},children:[a=e.applyData(t,a)]},e.patch(t,a),a},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){let n,r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=yE(i.toLowerCase()),o=e.footnoteOrder.indexOf(i),s=e.footnoteCounts.get(i);void 0===s?(s=0,e.footnoteOrder.push(i),n=e.footnoteOrder.length):n=o+1,s+=1,e.footnoteCounts.set(i,s);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+a,id:r+"fnref-"+a+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yL(e,t);let i={src:yE(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);let a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)},image:function(e,t){let n={src:yE(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yL(e,t);let i={href:yE(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);let a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)},link:function(e,t){let n={href:yE(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=yI(n[r])}return t}(n):yI(t),a={},o=[];if("boolean"==typeof t.checked){let e,n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<r.length;){let e=r[s];(i||0!==s||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?o.push(e):o.push(...e.children)}let l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let c={type:"element",tagName:"li",properties:a,children:o};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){let n={},r=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){let e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)},paragraph:function(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=vS(t.children[1]),o=v_(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",a=n&&"table"===n.type?n.align:void 0,o=a?a.length:t.children.length,s=-1,l=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let c={type:"element",tagName:i,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),l.push(c)}let c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){let n={type:"text",value:function(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(yR(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(yR(t.slice(i),i>0,!1)),a.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:yz,yaml:yz,definition:yz,footnoteDefinition:yz};function yz(){}let yF={}.hasOwnProperty,yV={};function yU(e,t){e.position&&(t.position=function(e){let t=vS(e),n=v_(e);if(t&&n)return{start:t,end:n}}(e))}function yH(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,yN(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function yW(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function yY(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function yG(e,t){let n,r,i,a,o=(n=t||yV,r=new Map,i=new Map,a={all:function(e){let t=[];if("children"in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=yY(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=yY(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:yH,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...yB,...n.handlers},one:function(e,t){let n=e.type,r=a.handlers[n];if(yF.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if("children"in e){let{children:t,...n}=e,r=yN(n);return r.children=a.all(e),r}return yN(e)}return(a.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(yF.call(n,"hProperties")||yF.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)})(a,e,t)},options:n,patch:yU,wrap:yW},yD(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a),s=o.one(e,void 0),l=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||y_,r=e.options.footnoteBackLabel||yS,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),c=yE(o.toLowerCase()),u=0,d=[],h=e.footnoteCounts.get(o);for(;void 0!==h&&++u<=h;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,u);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,u),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let f=a[a.length-1];if(f&&"element"===f.type&&"p"===f.tagName){let e=f.children[f.children.length-1];e&&"text"===e.type?e.value+=" ":f.children.push({type:"text",value:" "}),f.children.push(...d)}else a.push(...d);let p={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(a,!0)};e.patch(i,p),s.push(p)}if(0!==s.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...yN(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:"\n"}]}}(o),c=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return l&&(gq("children"in c),c.children.push({type:"text",value:"\n"},l)),c}function y$(e,t){return e&&"run"in e?async function(n,r){let i=yG(n,{file:r,...t});await e.run(i,r)}:function(n,r){return yG(n,{file:r,...e||t})}}function yX(e){if(e)throw e}var yq=e.i(4100);function yK(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let yZ=function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');y1(e);let r=0,i=-1,a=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else i<0&&(n=!0,i=a+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let o=-1,s=t.length-1;for(;a--;)if(47===e.codePointAt(a)){if(n){r=a+1;break}}else o<0&&(n=!0,o=a+1),s>-1&&(e.codePointAt(a)===t.codePointAt(s--)?s<0&&(i=a):(s=-1,i=o));return r===i?i=o:i<0&&(i=e.length),e.slice(r,i)},yQ=function(e){let t;if(y1(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},yJ=function(e){let t;y1(e);let n=e.length,r=-1,i=0,a=-1,o=0;for(;n--;){let s=e.codePointAt(n);if(47===s){if(t){i=n+1;break}continue}r<0&&(t=!0,r=n+1),46===s?a<0?a=n:1!==o&&(o=1):a>-1&&(o=-1)}return a<0||r<0||0===o||1===o&&a===r-1&&a===i+1?"":e.slice(a,r)},y0=function(...e){var t;let n,r,i,a=-1;for(;++a<e.length;)y1(e[a]),e[a]&&(i=void 0===i?e[a]:i+"/"+e[a]);return void 0===i?".":(y1(t=i),n=47===t.codePointAt(0),0!==(r=function(e,t){let n,r,i="",a=0,o=-1,s=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else if(47===n)break;else n=47;if(47===n){if(o===l-1||1===s);else if(o!==l-1&&2===s){if(i.length<2||2!==a||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",a=0):a=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),o=l,s=0;continue}}else if(i.length>0){i="",a=0,o=l,s=0;continue}}t&&(i=i.length>0?i+"/..":"..",a=2)}else i.length>0?i+="/"+e.slice(o+1,l):i=e.slice(o+1,l),a=l-o-1;o=l,s=0}else 46===n&&s>-1?s++:s=-1}return i}(t,!n)).length||n||(r="."),r.length>0&&47===t.codePointAt(t.length-1)&&(r+="/"),n?"/"+r:r)};function y1(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function y2(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let y5=["history","path","basename","stem","extname","dirname"];class y3{constructor(e){let t,n;t=e?y2(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<y5.length;){const e=y5[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)y5.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?yZ(this.path):void 0}set basename(e){y6(e,"basename"),y4(e,"basename"),this.path=y0(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?yQ(this.path):void 0}set dirname(e){y8(this.basename,"dirname"),this.path=y0(e||"",this.basename)}get extname(){return"string"==typeof this.path?yJ(this.path):void 0}set extname(e){if(y4(e,"extname"),y8(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=y0(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){y2(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!y2(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){let e=t.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),y6(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?yZ(this.path,this.extname):void 0}set stem(e){y6(e,"stem"),y4(e,"stem"),this.path=y0(this.dirname||"",e+(this.extname||""))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new vD(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function y4(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function y6(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function y8(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let y7=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},y9={}.hasOwnProperty;class be extends y7{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let n=-1,r=t.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);!function i(a,...o){let s=e[++n],l=-1;if(a)return void r(a);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,s?(function(e,t){let n;return function(...t){let a,o=e.length>t.length;o&&t.push(r);try{a=e.apply(this,t)}catch(e){if(o&&n)throw e;return r(e)}o||(a&&a.then&&"function"==typeof a.then?a.then(i,r):a instanceof Error?r(a):i(a))};function r(e,...i){n||(n=!0,t(e,...i))}function i(e){r(null,e)}})(s,i)(...o):r(null,...o)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){let e=new be,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data((0,yq.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(bi("data",this.frozen),this.namespace[e]=t,this):y9.call(this.namespace,e)&&this.namespace[e]||void 0:e?(bi("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let n=e.call(this,...t);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=bs(e),n=this.parser||this.Parser;return bn("parse",n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),bn("process",this.parser||this.Parser),br("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=bs(e),o=n.parse(a);function s(e,n){e||!n?i(e):r?r(n):(gq(t,"`done` is defined if `resolve` is not"),t(void 0,n))}n.run(o,a,function(e,t,r){var i,a;if(e||!t||!r)return s(e);let o=n.stringify(t,r);"string"==typeof(i=o)||(a=i)&&"object"==typeof a&&"byteLength"in a&&"byteOffset"in a?r.value=o:r.result=o,s(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),bn("processSync",this.parser||this.Parser),br("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,yX(e),t=r}),bo("processSync","process",n),gq(t,"we either bailed on an error or have a tree"),t}run(e,t,n){ba(e),this.freeze();let r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){gq("function"!=typeof t,"`file` can’t be a `done` anymore, we checked");let o=bs(t);r.run(e,o,function(t,r,o){let s=r||e;t?a(t):i?i(s):(gq(n,"`done` is defined if `resolve` is not"),n(void 0,s,o))})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){yX(e),n=t,r=!0}),bo("runSync","run",r),gq(n,"we either bailed on an error or have a tree"),n}stringify(e,t){this.freeze();let n=bs(t),r=this.compiler||this.Compiler;return br("stringify",r),ba(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(bi("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?a(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(e.plugins),e.settings&&(r.settings=(0,yq.default)(!0,r.settings,e.settings))}function a(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...n]=e;o(t,n)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];yK(o)&&yK(r)&&(r=(0,yq.default)(!0,o,r)),n[i]=[e,r,...a]}}}}let bt=new be().freeze();function bn(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function br(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function bi(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ba(e){if(!yK(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function bo(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function bs(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new y3(e)}let bl=[],bc={allowDangerousHtml:!0},bu=/^(https?|ircs?|mailto|xmpp)$/i,bd=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function bh(e){var t;let n,r,i,a,o,s=(n=(t=e).rehypePlugins||bl,r=t.remarkPlugins||bl,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...bc}:bc,bt().use(ym).use(r).use(y$,i).use(n)),l=(a=e.children||"",o=new y3,"string"==typeof a?o.value=a:gK("Unexpected value `"+a+"` for `children` prop, expected `string`"),o);return function(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||bf;for(let e of bd)Object.hasOwn(t,e.from)&&gK("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return n&&a&&gK("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),yD(e,function(e,t,i){if("raw"===e.type&&i&&"number"==typeof t)return o?i.children.splice(t,1):i.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in vX)if(Object.hasOwn(vX,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=vX[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=l(String(n||""),t,e))}}if("element"===e.type){let o=n?!n.includes(e.tagName):!!a&&a.includes(e.tagName);if(!o&&r&&"number"==typeof t&&(o=!r(e,t,i)),o&&i&&"number"==typeof t)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}),function(e,t){var n,r,i,a;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let s=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");n=s,r=t.jsxDEV,o=function(e,t,i,a){let o=Array.isArray(i.children),s=vS(e);return r(t,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:n,lineNumber:s?s.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=t.jsx,a=t.jsxs,o=function(e,t,n,r){let o=Array.isArray(n.children)?a:i;return r?o(t,n,r):o(t,n)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:s,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?vC:vk,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},c=vV(l,e,void 0);return c&&"string"!=typeof c?c:l.create(e,l.Fragment,{children:c||void 0},void 0)}(e,{Fragment:ep.Fragment,components:i,ignoreInvalidStyle:!0,jsx:ep.jsx,jsxs:ep.jsxs,passKeys:!0,passNode:!0})}(s.runSync(s.parse(l),l),e)}function bf(e){let t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return -1===t||-1!==i&&t>i||-1!==n&&t>n||-1!==r&&t>r||bu.test(e.slice(0,t))?e:""}function bp(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}bv(/[A-Za-z]/),bv(/[\dA-Za-z]/),bv(/[#-'*+\--9=?A-Z^-~]/),bv(/\d/),bv(/[\dA-Fa-f]/),bv(/[!-/:-@[-`{-~]/);let bm=bv(/\p{P}|\p{S}/u),bg=bv(/\s/);function bv(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let bx="phrasing",by=["autolink","link","image","label"];function bb(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function bw(e){this.config.enter.autolinkProtocol.call(this,e)}function bj(e){this.config.exit.autolinkProtocol.call(this,e)}function bN(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];gq("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function bk(e){this.config.exit.autolinkEmail.call(this,e)}function bC(e){this.exit(e)}function bE(e){!function(e,t,n){let r=yT((n||{}).ignore||[]),i=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){var i;let e=n[r];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),a=-1;for(;++a<i.length;)yP(e,"text",o);function o(e,t){let n,o=-1;for(;++o<t.length;){let e=t[o],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,l=n.children.indexOf(e),c=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1===a?r.lastIndex=n+1:(s!==n&&u.push({type:"text",value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}return c?(s<e.value.length&&u.push({type:"text",value:e.value.slice(s)}),n.children.splice(l,1,...u)):u=[e],l+u.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,b_],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,bS]],{ignore:["link","linkReference"]})}function b_(e,t,n,r,i){let a,o="";if(!bT(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",o="http://"),(a=n.split(".")).length<2||a[a.length-1]&&(/_/.test(a[a.length-1])||!/[a-zA-Z\d]/.test(a[a.length-1]))||a[a.length-2]&&(/_/.test(a[a.length-2])||!/[a-zA-Z\d]/.test(a[a.length-2])))return!1;let s=function(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")"),i=bp(e,"("),a=bp(e,")");for(;-1!==r&&i>a;)e+=n.slice(0,r+1),r=(n=n.slice(r+1)).indexOf(")"),a++;return[e,n]}(n+r);if(!s[0])return!1;let l={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function bS(e,t,n,r){return!(!bT(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function bT(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||bg(n)||bm(n))&&(!t||47!==n)}function bA(){this.buffer()}function bO(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function bM(){this.buffer()}function bP(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function bD(e){let t=this.resume(),n=this.stack[this.stack.length-1];gq("footnoteReference"===n.type),n.identifier=xJ(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bL(e){this.exit(e)}function bI(e){let t=this.resume(),n=this.stack[this.stack.length-1];gq("footnoteDefinition"===n.type),n.identifier=xJ(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bR(e){this.exit(e)}function bB(e,t,n,r){let i=n.createTracker(r),a=i.move("[^"),o=n.enter("footnoteReference"),s=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{after:"]",before:a})),s(),o(),a+=i.move("]")}function bz(e,t,n){return 0===t?e:bF(e,t,n)}function bF(e,t,n){return(n?"":" ")+e}bB.peek=function(){return"["};let bV=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function bU(e){this.enter({type:"delete",children:[]},e)}function bH(e){this.exit(e)}function bW(e,t,n,r){let i=n.createTracker(r),a=n.enter("strikethrough"),o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),a(),o}function bY(e){return e.length}function bG(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}bW.peek=function(){return"~"};function b$(e,t,n){let r=e.value||"",i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){let e,t=n.unsafe[a],i=n.compilePattern(t);if(t.atBreak)for(;e=i.exec(r);){let t=e.index;10===r.charCodeAt(t)&&13===r.charCodeAt(t-1)&&t--,r=r.slice(0,t)+" "+r.slice(e.index+1)}}return i+r+i}b$.peek=function(){return"`"};yT(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let bX=function(e,t,n,r){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n),a=n.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(a=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+a);let o=a.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let s=n.createTracker(r);s.move(a+" ".repeat(o-a.length)),s.shift(o);let l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,s.current()),function(e,t,n){return t?(n?"":" ".repeat(o))+e:(n?a:a+" ".repeat(o-a.length))+e});return l(),c};function bq(e){let t=e._align;gq(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function bK(e){this.exit(e),this.data.inTable=void 0}function bZ(e){this.enter({type:"tableRow",children:[]},e)}function bQ(e){this.exit(e)}function bJ(e){this.enter({type:"tableCell",children:[]},e)}function b0(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,b1));let n=this.stack[this.stack.length-1];gq("inlineCode"===n.type),n.value=t,this.exit(e)}function b1(e,t){return"|"===t?t:e}function b2(e){let t=this.stack[this.stack.length-2];gq("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function b5(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];gq("paragraph"===e.type);let n=e.children[0];if(n&&"text"===n.type){let r,i=t.children,a=-1;for(;++a<i.length;){let e=i[a];if("paragraph"===e.type){r=e;break}}r===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function b3(e,t,n,r){let i=e.children[0],a="boolean"==typeof e.checked&&i&&"paragraph"===i.type,o="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);a&&s.move(o);let l=bX(e,t,n,{...r,...s.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}let b4=we(/[A-Za-z]/),b6=we(/[\dA-Za-z]/);function b8(e){return null!==e&&(e<0||32===e)}we(/[#-'*+\--9=?A-Z^-~]/),we(/\d/),we(/[\dA-Fa-f]/),we(/[!-/:-@[-`{-~]/);let b7=we(/\p{P}|\p{S}/u),b9=we(/\s/);function we(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}let wt={tokenize:function(e,t,n){let r=0;return function t(a){return(87===a||119===a)&&r<3?(r++,e.consume(a),t):46===a&&3===r?(e.consume(a),i):n(a)};function i(e){return null===e?n(e):t(e)}},partial:!0},wn={tokenize:function(e,t,n){let r,i,a;return o;function o(t){return 46===t||95===t?e.check(wi,l,s)(t):null===t||b8(t)||b9(t)||45!==t&&b7(t)?l(t):(a=!0,e.consume(t),o)}function s(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),o}function l(e){return i||r||!a?n(e):t(e)}},partial:!0},wr={tokenize:function(e,t){let n=0,r=0;return i;function i(o){return 40===o?(n++,e.consume(o),i):41===o&&r<n?a(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(wi,t,a)(o):null===o||b8(o)||b9(o)?t(o):(e.consume(o),i)}function a(t){return 41===t&&r++,e.consume(t),i}},partial:!0},wi={tokenize:function(e,t,n){return r;function r(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),r):38===o?(e.consume(o),a):93===o?(e.consume(o),i):60===o||null===o||b8(o)||b9(o)?t(o):n(o)}function i(e){return null===e||40===e||91===e||b8(e)||b9(e)?t(e):r(e)}function a(t){return b4(t)?function t(i){return 59===i?(e.consume(i),r):b4(i)?(e.consume(i),t):n(i)}(t):n(t)}},partial:!0},wa={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return b6(e)?n(e):t(e)}},partial:!0},wo={name:"wwwAutolink",tokenize:function(e,t,n){let r=this;return function(t){return 87!==t&&119!==t||!wd.call(r,r.previous)||wm(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(wt,e.attempt(wn,e.attempt(wr,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:wd},ws={name:"protocolAutolink",tokenize:function(e,t,n){let r=this,i="",a=!1;return function(t){return(72===t||104===t)&&wh.call(r,r.previous)&&!wm(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),o):n(t)};function o(t){if(b4(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),o;if(58===t){let n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),s}return n(t)}function s(t){return 47===t?(e.consume(t),a)?l:(a=!0,s):n(t)}function l(t){return null===t||null!==t&&(t<32||127===t)||b8(t)||b9(t)||b7(t)?n(t):e.attempt(wn,e.attempt(wr,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:wh},wl={name:"emailAutolink",tokenize:function(e,t,n){let r,i,a=this;return function(t){return!wp(t)||!wf.call(a,a.previous)||wm(a.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(r){return wp(r)?(e.consume(r),t):64===r?(e.consume(r),o):n(r)}(t))};function o(t){return 46===t?e.check(wa,l,s)(t):45===t||95===t||b6(t)?(i=!0,e.consume(t),o):l(t)}function s(t){return e.consume(t),r=!0,o}function l(o){return i&&r&&b4(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):n(o)}},previous:wf},wc={},wu=48;for(;wu<123;)wc[wu]=wl,58==++wu?wu=65:91===wu&&(wu=97);function wd(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||b8(e)}function wh(e){return!b4(e)}function wf(e){return!(47===e||wp(e))}function wp(e){return 43===e||45===e||46===e||95===e||b6(e)}function wm(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function wg(e){return null!==e&&(e<0||32===e)}function wv(e){return -2===e||-1===e||32===e}function wx(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function wy(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return wv(r)?(e.enter(n),function r(o){return wv(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}wc[43]=wl,wc[45]=wl,wc[46]=wl,wc[95]=wl,wc[72]=[wl,ws],wc[104]=[wl,ws],wc[87]=[wl,wo],wc[119]=[wl,wo],wx(/[A-Za-z]/),wx(/[\dA-Za-z]/),wx(/[#-'*+\--9=?A-Z^-~]/),wx(/\d/),wx(/[\dA-Fa-f]/),wx(/[!-/:-@[-`{-~]/),wx(/\p{P}|\p{S}/u),wx(/\s/);let wb={tokenize:function(e,t,n){let r=this;return wy(e,function(e){let i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function ww(e,t,n){let r,i=this,a=i.events.length,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;a--;){let e=i.events[a][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(a){if(!r||!r._balanced)return n(a);let s=xJ(i.sliceSerialize({start:r.end,end:i.now()}));return 94===s.codePointAt(0)&&o.includes(s.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a)):n(a)}}function wj(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function wN(e,t,n){let r,i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]),o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),s};function s(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(s){if(o>999||93===s&&!r||null===s||91===s||wg(s))return n(s);if(93===s){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return a.includes(xJ(i.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(s)}return wg(s)||(r=!0),o++,e.consume(s),92===s?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function wk(e,t,n){let r,i,a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),s=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(s>999||93===t&&!i||null===t||91===t||wg(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return r=xJ(a.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return wg(t)||(i=!0),s++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),s++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o.includes(r)||o.push(r),wy(e,h,"gfmFootnoteDefinitionWhitespace")):n(t)}function h(e){return t(e)}}function wC(e,t,n){return e.check(xd,t,e.attempt(wb,t,n))}function wE(e){e.exit("gfmFootnoteDefinition")}function w_(e){return null!==e&&e<-2}function wS(e){return null!==e&&(e<0||32===e)}function wT(e){return -2===e||-1===e||32===e}function wA(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function wO(e,t,n,r){let i=r?r-1:1/0,a=0;return function(r){return wT(r)?(e.enter(n),function r(o){return wT(o)&&a++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}wA(/[A-Za-z]/),wA(/[\dA-Za-z]/),wA(/[#-'*+\--9=?A-Z^-~]/),wA(/\d/),wA(/[\dA-Fa-f]/),wA(/[!-/:-@[-`{-~]/),wA(/\p{P}|\p{S}/u),wA(/\s/);class wM{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}}function wP(e,t,n){let r,i=this,a=0,o=0;return function(e){let t=i.events.length-1;for(;t>-1;){let e=i.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?i.events[t][1].type:null,a="tableHead"===r||"tableRow"===r?y:s;return a===y&&i.parser.lazy[i.now().line]?n(e):a(e)};function s(t){var n;return e.enter("tableHead"),e.enter("tableRow"),124===(n=t)||(r=!0,o+=1),l(n)}function l(t){return null===t?n(t):w_(t)?o>1?(o=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):wT(t)?wO(e,l,"whitespace")(t):(o+=1,r&&(r=!1,a+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),r=!0,l):(e.enter("data"),c(t))}function c(t){return null===t||124===t||wS(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return(i.interrupt=!1,i.parser.lazy[i.now().line])?n(t):(e.enter("tableDelimiterRow"),r=!1,wT(t))?wO(e,h,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):h(t)}function h(t){return 45===t||58===t?p(t):124===t?(r=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):n(t)}function f(t){return wT(t)?wO(e,p,"whitespace")(t):p(t)}function p(t){return 58===t?(o+=1,r=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),g):45===t?(o+=1,g(t)):null===t||w_(t)?x(t):n(t)}function g(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(r=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(n))}(t)):n(t)}function v(t){return wT(t)?wO(e,x,"whitespace")(t):x(t)}function x(i){if(124===i)return h(i);if(null===i||w_(i))return r&&a===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(i)):n(i);return n(i)}function y(t){return e.enter("tableRow"),b(t)}function b(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),b):null===n||w_(n)?(e.exit("tableRow"),t(n)):wT(n)?wO(e,b,"whitespace")(n):(e.enter("data"),w(n))}function w(t){return null===t||124===t||wS(t)?(e.exit("data"),b(t)):(e.consume(t),92===t?j:w)}function j(t){return 92===t||124===t?(e.consume(t),w):w(t)}}function wD(e,t){let n,r,i,a=-1,o=!0,s=0,l=[0,0,0,0],c=[0,0,0,0],u=!1,d=0,h=new wM;for(;++a<e.length;){let f=e[a],p=f[1];"enter"===f[0]?"tableHead"===p.type?(u=!1,0!==d&&(wI(h,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(a,0,[["enter",n,t]])):"tableRow"===p.type||"tableDelimiterRow"===p.type?(o=!0,i=void 0,l=[0,0,0,0],c=[0,a+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},h.add(a,0,[["enter",r,t]])),s="tableDelimiterRow"===p.type?2:r?3:1):s&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)?(o=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],i=wL(h,t,l,s,void 0,i),l=[0,0,0,0]),c[2]=a)):"tableCellDivider"===p.type&&(o?o=!1:(0!==l[1]&&(c[0]=c[1],i=wL(h,t,l,s,void 0,i)),c=[(l=c)[1],a,0,0])):"tableHead"===p.type?(u=!0,d=a):"tableRow"===p.type||"tableDelimiterRow"===p.type?(d=a,0!==l[1]?(c[0]=c[1],i=wL(h,t,l,s,a,i)):0!==c[1]&&(i=wL(h,t,c,s,a,i)),s=0):s&&("data"===p.type||"tableDelimiterMarker"===p.type||"tableDelimiterFiller"===p.type)&&(c[3]=a)}for(0!==d&&wI(h,t,d,n,r),h.consume(t.events),a=-1;++a<t.events.length;){let e=t.events[a];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}(t.events,a))}return e}function wL(e,t,n,r,i,a){0!==n[0]&&(a.end=Object.assign({},wR(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));let o=wR(t.events,n[1]);if(a={type:1===r?"tableHeader":2===r?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(n[1],0,[["enter",a,t]]),0!==n[2]){let i=wR(t.events,n[2]),a=wR(t.events,n[3]),o={type:"tableContent",start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[["enter",o,t]]),2!==r){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",o,t]])}return void 0!==i&&(a.end=Object.assign({},wR(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function wI(e,t,n,r,i){let a=[],o=wR(t.events,n);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),r.end=Object.assign({},o),a.push(["exit",r,t]),e.add(n+1,0,a)}function wR(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}function wB(e){return -2===e||-1===e||32===e}function wz(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}wz(/[A-Za-z]/),wz(/[\dA-Za-z]/),wz(/[#-'*+\--9=?A-Z^-~]/),wz(/\d/),wz(/[\dA-Fa-f]/),wz(/[!-/:-@[-`{-~]/),wz(/\p{P}|\p{S}/u),wz(/\s/);let wF={name:"tasklistCheck",tokenize:function(e,t,n){let r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):n(t)};function i(t){return null!==t&&(t<0||32===t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),a):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),a):n(t)}function a(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(t)}function o(r){return null!==r&&r<-2?t(r):wB(r)?e.check({tokenize:wV},t,n)(r):n(r)}}};function wV(e,t,n){var r,i;let a,o;return r=function(e){return null===e?n(e):t(e)},i="whitespace",a=1/0,o=0,function(t){return wB(t)?(e.enter(i),function t(n){return wB(n)&&o++<a?(e.consume(n),t):(e.exit(i),r(n))}(t)):r(t)}}let wU={};function wH(e){let t,n,r,i=e||wU,a=this.data(),o=a.micromarkExtensions||(a.micromarkExtensions=[]),s=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),l=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);o.push(v2([{text:wc},{document:{91:{name:"gfmFootnoteDefinition",tokenize:wk,continuation:{tokenize:wC},exit:wE}},text:{91:{name:"gfmFootnoteCall",tokenize:wN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ww,resolveTo:wj}}},(t=(i||{}).singleTilde,n={name:"strikethrough",tokenize:function(e,n,r){let i=this.previous,a=this.events,o=0;return function(s){return 126===i&&"characterEscape"!==a[a.length-1][1].type?r(s):(e.enter("strikethroughSequenceTemporary"),function a(s){let l=x_(i);if(126===s)return o>1?r(s):(e.consume(s),o++,a);if(o<2&&!t)return r(s);let c=e.exit("strikethroughSequenceTemporary"),u=x_(s);return c._open=!u||2===u&&!!l,c._close=!l||2===l&&!!u,n(s)}(s))}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",a,t]],s=t.parser.constructs.insideSpan.null;s&&vJ(o,o.length,0,xS(s,e.slice(r+1,n),t)),vJ(o,o.length,0,[["exit",a,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),vJ(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}},null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:wP,resolveAll:wD}}},{text:{91:wF}}])),s.push([{transforms:[bE],enter:{literalAutolink:bb,literalAutolinkEmail:bw,literalAutolinkHttp:bw,literalAutolinkWww:bw},exit:{literalAutolink:bC,literalAutolinkEmail:bk,literalAutolinkHttp:bj,literalAutolinkWww:bN}},{enter:{gfmFootnoteCallString:bA,gfmFootnoteCall:bO,gfmFootnoteDefinitionLabelString:bM,gfmFootnoteDefinition:bP},exit:{gfmFootnoteCallString:bD,gfmFootnoteCall:bL,gfmFootnoteDefinitionLabelString:bI,gfmFootnoteDefinition:bR}},{canContainEols:["delete"],enter:{strikethrough:bU},exit:{strikethrough:bH}},{enter:{table:bq,tableData:bJ,tableHeader:bJ,tableRow:bZ},exit:{codeText:b0,table:bK,tableData:bQ,tableHeader:bQ,tableRow:bQ}},{exit:{taskListCheckValueChecked:b2,taskListCheckValueUnchecked:b2,paragraph:b5}}]),l.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:bx,notInConstruct:by},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:bx,notInConstruct:by},{character:":",before:"[ps]",after:"\\/",inConstruct:bx,notInConstruct:by}]},(r=!1,i&&i.firstLineBlank&&(r=!0),{handlers:{footnoteDefinition:function(e,t,n,i){let a=n.createTracker(i),o=a.move("[^"),s=n.enter("footnoteDefinition"),l=n.enter("label");return o+=a.move(n.safe(n.associationId(e),{before:o,after:"]"})),l(),o+=a.move("]:"),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((r?"\n":" ")+n.indentLines(n.containerFlow(e,a.current()),r?bF:bz))),s(),o},footnoteReference:bB},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:bV}],handlers:{delete:bW}},function(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=b$(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return s(function(e,t,n){let r=e.children,i=-1,a=[],o=t.enter("table");for(;++i<r.length;)a[i]=l(r[i],t,n);return o(),a}(e,n,r),e.align)},tableCell:o,tableRow:function(e,t,n,r){let i=s([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function o(e,t,n,r){let i=n.enter("tableCell"),o=n.enter("phrasing"),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function s(e,t){return function(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||bY,a=[],o=[],s=[],l=[],c=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>c&&(c=e[u].length);++a<e[u].length;){var d;let o=null==(d=e[u][a])?"":String(d);if(!1!==n.alignDelimiters){let e=i(o);r[a]=e,(void 0===l[a]||e>l[a])&&(l[a]=e)}t.push(o)}o[u]=t,s[u]=r}let h=-1;if("object"==typeof r&&"length"in r)for(;++h<c;)a[h]=bG(r[h]);else{let e=bG(r);for(;++h<c;)a[h]=e}h=-1;let f=[],p=[];for(;++h<c;){let e=a[h],t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[h]-t.length-r.length),o=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&((i=t.length+i+r.length)>l[h]&&(l[h]=i),p[h]=i),f[h]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let g=[];for(;++u<o.length;){let e=o[u],t=s[u];h=-1;let r=[];for(;++h<c;){let i=e[h]||"",o="",s="";if(!1!==n.alignDelimiters){let e=l[h]-(t[h]||0),n=a[h];114===n?o=" ".repeat(e):99===n?e%2?(o=" ".repeat(e/2+.5),s=" ".repeat(e/2-.5)):s=o=" ".repeat(e/2):s=" ".repeat(e)}!1===n.delimiterStart||h||r.push("|"),!1!==n.padding&&(!1!==n.alignDelimiters||""!==i)&&(!1!==n.delimiterStart||h)&&r.push(" "),!1!==n.alignDelimiters&&r.push(o),r.push(i),!1!==n.alignDelimiters&&r.push(s),!1!==n.padding&&r.push(" "),(!1!==n.delimiterEnd||h!==c-1)&&r.push("|")}g.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return g.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){let r=e.children,i=-1,a=[],s=t.enter("tableRow");for(;++i<r.length;)a[i]=o(r[i],e,t,n);return s(),a}}(i),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:b3}}]})}function wW({children:e,className:t}){return(0,ep.jsx)("div",{className:(0,eA.cn)("text-[13px] leading-6 text-foreground/90 space-y-2 [&>:first-child]:mt-0",t),children:(0,ep.jsx)(bh,{remarkPlugins:[wH],components:{h1:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...e}),h2:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-4 mb-1",...e}),h3:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...e}),h4:e=>(0,ep.jsx)("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mt-3 mb-1",...e}),p:e=>(0,ep.jsx)("p",{className:"my-1.5",...e}),ul:e=>(0,ep.jsx)("ul",{className:"list-disc pl-5 my-1.5 space-y-0.5",...e}),ol:e=>(0,ep.jsx)("ol",{className:"list-decimal pl-5 my-1.5 space-y-0.5",...e}),li:e=>(0,ep.jsx)("li",{className:"leading-6",...e}),strong:e=>(0,ep.jsx)("strong",{className:"font-semibold text-foreground",...e}),code:e=>(0,ep.jsx)("code",{className:"text-[12px] font-mono bg-muted/70 px-1 py-0.5 rounded",...e}),a:e=>(0,ep.jsx)("a",{className:"text-primary underline",...e}),table:e=>(0,ep.jsx)("div",{className:"overflow-x-auto my-2",children:(0,ep.jsx)("table",{className:"text-[12px] border-collapse",...e})}),th:e=>(0,ep.jsx)("th",{className:"text-left font-semibold px-2 py-1 border-b border-border",...e}),td:e=>(0,ep.jsx)("td",{className:"px-2 py-1 border-b border-border/50",...e})},children:e})})}var wY=e.i(59411),tU=tU;function wG({directiveId:e,onClose:t}){let n,{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(null),[o,s]=(0,em.useState)(!1),[l,c]=(0,em.useState)(null);(0,em.useEffect)(()=>{e&&r&&(async()=>{s(!0),c(null),a(null);try{let t=await eP.client.getDirective(r,e);a(t)}catch(e){console.error("Error loading directive:",e),c(e.message)}finally{s(!1)}})()},[e,r]);let u=null!==e;return(0,ep.jsx)(tW.Dialog,{open:u,onOpenChange:e=>!e&&t(),children:(0,ep.jsxs)(tW.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col p-6",children:[(0,ep.jsx)(wY.VisuallyHidden,{children:(0,ep.jsx)(tW.DialogTitle,{children:"Directive Details"})}),o?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)(tU.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):l?(0,ep.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,ep.jsx)("div",{className:"text-center text-destructive",children:(0,ep.jsxs)("div",{className:"text-sm",children:["Error: ",l]})})}):i?(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-6",children:[(0,ep.jsxs)("div",{className:"pb-5 border-b border-border",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-foreground",children:i.name}),!i.is_active&&(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded-full bg-red-500/10 text-red-600 dark:text-red-400 text-xs font-medium",children:"Inactive"})]}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground/70",children:i.id})]}),(0,ep.jsxs)("div",{className:"flex gap-8",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:"Created"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:(n=new Date(i.created_at),`${n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${n.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`)})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:"Priority"}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:i.priority})]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Content"}),(0,ep.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,ep.jsx)(bh,{remarkPlugins:[wH],children:i.content})})]}),i.tags&&i.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.tags.map((e,t)=>(0,ep.jsx)("span",{className:"px-2 py-0.5 bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded text-xs",children:e},t))})]})]}):null]})})}function w$(e){let t=new Date(e).getTime(),n=Math.round((Date.now()-t)/1e3);if(60>Math.abs(n))return n>=0?"just now":"in a moment";let r=n,i="second";for(let[e,t]of[[60,"second"],[60,"minute"],[24,"hour"],[7,"day"],[4.345,"week"],[12,"month"],[1/0,"year"]]){if(Math.abs(r)<e)break;r/=e,i=t}return new Intl.RelativeTimeFormat("en",{numeric:"auto"}).format(-Math.round(r),i)}function wX(e){let t=new Date(e);return`${t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} at ${t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}function wq(e){return"directives"===e?{label:"directive",color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}:"mental-models"===e?{label:"mental model",color:"bg-indigo-500/10 text-indigo-600 dark:text-indigo-400"}:"world"===e?{label:"world",color:"bg-blue-500/10 text-blue-600 dark:text-blue-400"}:"experience"===e?{label:"experience",color:"bg-green-500/10 text-green-600 dark:text-green-400"}:"observation"===e?{label:"observation",color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"}:{label:e,color:"bg-slate-500/10 text-slate-600 dark:text-slate-400"}}let wK=["observation","experience","world","directives","mental-models"];function wZ({based_on:e,onViewMemory:t,onViewDirective:n}){let r=(0,em.useMemo)(()=>{if(!e)return[];let t=Object.entries(e).map(([e,t])=>({factType:e,facts:t??[]})).filter(e=>e.facts.length>0);return t.sort((e,t)=>{let n=wK.indexOf(e.factType),r=wK.indexOf(t.factType);return(-1===n?999:n)-(-1===r?999:r)}),t},[e]);return 0===r.length?(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No based_on data."}):(0,ep.jsx)("div",{className:"space-y-4",children:r.map(e=>{let r=wq(e.factType);return(0,ep.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${r.color}`,children:r.label}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:e.facts.length})]}),(0,ep.jsx)("ul",{className:"divide-y divide-border/50",children:e.facts.map((r,i)=>{let a="directives"===e.factType&&!!n||"directives"!==e.factType&&"mental-models"!==e.factType&&!!t;return(0,ep.jsxs)("li",{className:"group flex items-start gap-3 px-3 py-2 hover:bg-muted/30",children:[(0,ep.jsxs)("p",{className:"text-sm text-foreground leading-relaxed flex-1 min-w-0",children:[r.text,r.context&&(0,ep.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5",children:r.context})]}),a&&(0,ep.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===e.factType?n?.(r.id):t?.(r.id)},children:"View →"})]},r.id||i)})})]},e.factType)})})}function wQ(e){return e.match(/\s+|[A-Za-z0-9_]+|[^\s\w]/g)||[]}function wJ(e){return/^\s+$/.test(e)?" ":e}function w0(e,t){return e.map((e,n)=>"same"===e.type?(0,ep.jsx)("span",{children:e.text},n):(0,ep.jsx)("span",{className:"left"===t?"bg-red-500/25 text-red-800 dark:text-red-300 rounded-sm px-0.5":"bg-green-500/25 text-green-800 dark:text-green-300 rounded-sm px-0.5",children:e.text},n))}function w1({before:e,after:t}){let{left:n,right:r}=function(e,t){let n=e.split("\n"),r=t.split("\n"),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=n[e-1]===r[t-1]?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=[],l=i,c=a;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===r[c-1]?(s.push({type:"same",text:n[l-1]}),l--,c--):c>0&&(0===l||o[l][c-1]>=o[l-1][c])?(s.push({type:"added",text:r[c-1]}),c--):(s.push({type:"removed",text:n[l-1]}),l--);s.reverse();let u=[],d=[],h=0;for(;h<s.length;){let e=s[h];if("same"===e.type){u.push({type:"same",spans:[{type:"same",text:e.text}]}),d.push({type:"same",spans:[{type:"same",text:e.text}]}),h++;continue}let t=[],n=[];for(;h<s.length&&"same"!==s[h].type;)"removed"===s[h].type?t.push(s[h].text):n.push(s[h].text),h++;let r=Math.max(t.length,n.length);for(let e=0;e<r;e++){let r=e<t.length?t[e]:null,i=e<n.length?n[e]:null;if(null!==r&&null!==i){let e=function(e,t){let n=wQ(e),r=wQ(t),i=n.length,a=r.length,o=Array.from({length:i+1},()=>Array(a+1).fill(0));for(let e=1;e<=i;e++)for(let t=1;t<=a;t++)o[e][t]=wJ(n[e-1])===wJ(r[t-1])?o[e-1][t-1]+1:Math.max(o[e-1][t],o[e][t-1]);let s=[],l=[],c=i,u=a,d=[],h=[];for(;c>0||u>0;)if(c>0&&u>0&&wJ(n[c-1])===wJ(r[u-1]))d.push({type:"same",text:n[c-1]}),h.push({type:"same",text:r[u-1]}),c--,u--;else if(u>0&&(0===c||o[c][u-1]>=o[c-1][u])){let e=r[u-1];h.push({type:/^\s+$/.test(e)?"same":"added",text:e}),u--}else{let e=n[c-1];d.push({type:/^\s+$/.test(e)?"same":"removed",text:e}),c--}for(;d.length;)s.push(d.pop());for(;h.length;)l.push(h.pop());return{left:s,right:l}}(r,i),t=e.left.some(e=>"same"!==e.type)?"removed":"same",n=e.right.some(e=>"same"!==e.type)?"added":"same";u.push({type:t,spans:e.left}),d.push({type:n,spans:e.right})}else null!==r?(u.push({type:"removed",spans:[{type:"removed",text:r}]}),d.push({type:"same",spans:[{type:"same",text:""}]})):null!==i&&(u.push({type:"same",spans:[{type:"same",text:""}]}),d.push({type:"added",spans:[{type:"added",text:i}]}))}}return{left:u,right:d}}(e,t);return n.some(e=>"same"!==e.type)||r.some(e=>"same"!==e.type)?(0,ep.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border border border-border rounded-md overflow-hidden text-xs font-mono",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"px-3 py-1.5 bg-muted text-muted-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:"Before"}),n.map((e,t)=>(0,ep.jsx)("div",{className:`px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem] ${"removed"===e.type?"bg-red-500/5":""}`,children:w0(e.spans,"left")},t))]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"px-3 py-1.5 bg-muted text-muted-foreground font-sans font-semibold text-xs uppercase tracking-wide border-b border-border",children:"After"}),r.map((e,t)=>(0,ep.jsx)("div",{className:`px-3 py-0.5 whitespace-pre-wrap leading-5 min-h-[1.25rem] ${"added"===e.type?"bg-green-500/5":""}`,children:w0(e.spans,"right")},t))]})]}):(0,ep.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"unchanged"})}function w2({before:e,after:t,onViewMemory:n,onViewDirective:r}){let i=(0,em.useMemo)(()=>{let n=new Set([...Object.keys(e??{}),...Object.keys(t??{})]),r=[];for(let i of n){let n=(e?.[i]??[]).filter(Boolean),a=(t?.[i]??[]).filter(Boolean),o=new Set(n.map(e=>e.id)),s=new Set(a.map(e=>e.id)),l=a.filter(e=>!o.has(e.id)),c=n.filter(e=>!s.has(e.id)),u=a.filter(e=>o.has(e.id));(0!==l.length||0!==c.length||0!==u.length)&&r.push({factType:i,added:l,removed:c,kept:u})}return r.sort((e,t)=>{let n=wK.indexOf(e.factType),r=wK.indexOf(t.factType);return(-1===n?999:n)-(-1===r?999:r)}),r},[e,t]);if(0===i.length)return(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No based_on data."});let a=(e,t,i)=>(0,ep.jsxs)("li",{className:`group flex items-start gap-2 px-3 py-2 ${"added"===i?"bg-green-500/10 border-l-2 border-green-500":"removed"===i?"bg-red-500/10 border-l-2 border-red-500 text-muted-foreground line-through decoration-red-500/50":""}`,children:[(0,ep.jsx)("span",{className:`font-mono text-sm shrink-0 ${"added"===i?"text-green-600 dark:text-green-400":"removed"===i?"text-red-600 dark:text-red-400":"text-muted-foreground/40"}`,children:"added"===i?"+":"removed"===i?"−":" "}),(0,ep.jsxs)("p",{className:"text-sm leading-relaxed flex-1 min-w-0",children:[e.text,e.context&&(0,ep.jsx)("span",{className:"block text-xs text-muted-foreground italic mt-0.5 no-underline",children:e.context})]}),("directives"===t&&!!r||"directives"!==t&&"mental-models"!==t&&!!n)&&"removed"!==i&&(0,ep.jsx)("button",{className:"text-xs text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0 mt-0.5",onClick:()=>{"directives"===t?r(e.id):n(e.id)},children:"View →"})]},`${i}-${e.id}`);return(0,ep.jsx)("div",{className:"space-y-4",children:i.map(e=>{let t=wq(e.factType);return(0,ep.jsxs)("div",{className:"rounded-lg border border-border/60 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-muted/40 border-b border-border/60",children:[(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide ${t.color}`,children:t.label}),e.added.length>0&&(0,ep.jsxs)("span",{className:"text-xs text-green-600 dark:text-green-400",children:["+",e.added.length]}),e.removed.length>0&&(0,ep.jsxs)("span",{className:"text-xs text-red-600 dark:text-red-400",children:["−",e.removed.length]}),e.kept.length>0&&(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.kept.length," kept"]})]}),(0,ep.jsxs)("ul",{className:"divide-y divide-border/40",children:[e.added.map(t=>a(t,e.factType,"added")),e.removed.map(t=>a(t,e.factType,"removed")),e.kept.map(t=>a(t,e.factType,"kept"))]})]},e.factType)})})}function w5({history:e,currentContent:t,currentBasedOn:n,onViewMemory:r,onViewDirective:i}){let[a,o]=(0,em.useState)(0),s=e[a],l=0===a?t:e[a-1].previous_content??"",c=s.previous_reflect_response?.based_on,u=0===a?n:e[a-1].previous_reflect_response?.based_on,d=s.previous_reflect_response??null;return(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,ep.jsxs)("span",{className:"font-semibold text-foreground",children:["v",e.length-a]})," →"," ",(0,ep.jsxs)("span",{className:"font-semibold text-foreground",children:["v",e.length-a+1,0===a?" (current)":""]})," ","· changed ",new Date(s.changed_at).toLocaleString()]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:a===e.length-1,onClick:()=>o(a+1),children:(0,ep.jsx)(e_,{className:"h-3.5 w-3.5"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",className:"h-7 w-7 p-0",disabled:0===a,onClick:()=>o(a-1),children:(0,ep.jsx)(eS.ChevronRight,{className:"h-3.5 w-3.5"})})]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(w9,{children:"Content diff"}),null!==s.previous_content?(0,ep.jsx)(w1,{before:s.previous_content,after:l}):(0,ep.jsx)("div",{className:"border border-border rounded-lg p-3",children:(0,ep.jsx)("span",{className:"text-sm text-muted-foreground italic",children:"Previous content not available"})})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(w9,{children:"Based on diff"}),d?.based_on?(0,ep.jsx)(w2,{before:c,after:u,onViewMemory:r,onViewDirective:i}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"Not captured for this version (recorded before reflect snapshots were tracked)."})]})]})}function w3({mentalModelId:e,onClose:t,onEdit:n,onDelete:r,onRefreshed:i,initialTab:a="content"}){let{currentBank:o}=(0,ey.useBank)(),[s,l]=(0,em.useState)(null),[c,u]=(0,em.useState)(!1),[d,h]=(0,em.useState)(null),[f,p]=(0,em.useState)(a),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(null),[j,N]=(0,em.useState)(null),[k,C]=(0,em.useState)(null),[E,_]=(0,em.useState)(!1);(0,em.useEffect)(()=>{e&&o&&(async()=>{u(!0),h(null),l(null),C(null),p(a);try{let t=await eP.client.getMentalModel(o,e);l(t)}catch(e){console.error("Error loading mental model:",e),h(e.message)}finally{u(!1)}})()},[e,o,a]),(0,em.useEffect)(()=>{"history"===f&&s&&o&&null===k&&(async()=>{_(!0);try{let e=await eP.client.getMentalModelHistory(o,s.id);C(e)}catch(e){console.error("Error loading mental model history:",e),C([])}finally{_(!1)}})()},[f,s,o,k]);let S=async()=>{if(o&&s){y(!0);try{let e=await eP.client.getMentalModel(o,s.id);l(e),C(null)}catch(e){console.error("Error reloading mental model:",e)}finally{y(!1)}}},T=async()=>{if(!o||!s)return;v(!0);let e=s.last_refreshed_at;try{await eP.client.refreshMentalModel(o,s.id);let t=0,n=async()=>{t++;try{let r=await eP.client.getMentalModel(o,s.id);if(r.last_refreshed_at!==e){l(r),C(null),i?.(r),v(!1);return}if(t>=120){v(!1),ev.toast.error("Refresh timeout",{description:"Refresh is taking longer than expected. Check the operations list for status."});return}setTimeout(n,1e3)}catch(e){console.error("Error polling mental model:",e),v(!1)}};setTimeout(n,1e3)}catch{v(!1)}},A=null!==e,O=s?.reflect_response?.based_on,M=O?Object.values(O).reduce((e,t)=>e+(t?.length??0),0):0;return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tW.Dialog,{open:A,onOpenChange:e=>!e&&t(),children:(0,ep.jsxs)(tW.DialogContent,{className:"w-[95vw] max-w-[95vw] h-[92vh] sm:max-w-[95vw] flex flex-col overflow-hidden",children:[(0,ep.jsx)(tW.DialogHeader,{className:"pr-10",children:(0,ep.jsxs)(tW.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"truncate",children:s?.name??"Mental Model"}),s&&(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:S,disabled:x,title:"Reload data",children:(0,ep.jsx)(eH,{className:`h-3.5 w-3.5 ${x?"animate-spin":""}`})}),s?.trigger?.refresh_after_consolidation&&(0,ep.jsxs)("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-500/10 text-green-600 dark:text-green-400 text-xs font-medium",children:[(0,ep.jsx)(gX,{className:"w-3 h-3"}),"Auto refresh"]})]})}),c?(0,ep.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,ep.jsx)(tU.default,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):d?(0,ep.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,ep.jsx)("div",{className:"text-center text-destructive",children:(0,ep.jsxs)("div",{className:"text-sm",children:["Error: ",d]})})}):s?(0,ep.jsxs)(tG.Tabs,{value:f,onValueChange:e=>p(e),className:"flex-1 flex flex-col overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ep.jsxs)(tG.TabsList,{className:"grid grid-cols-3 w-full max-w-md",children:[(0,ep.jsxs)(tG.TabsTrigger,{value:"content",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),"Content"]}),(0,ep.jsxs)(tG.TabsTrigger,{value:"configuration",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eT,{className:"w-3.5 h-3.5"}),"Configuration"]}),(0,ep.jsxs)(tG.TabsTrigger,{value:"history",className:"flex items-center gap-1.5",children:[(0,ep.jsx)(tH,{className:"w-3.5 h-3.5"}),"History"]})]}),(0,ep.jsxs)(p2,{children:[(0,ep.jsx)(p3,{asChild:!0,children:(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 shrink-0",disabled:g,"aria-label":"Actions",children:(0,ep.jsx)(mU,{className:"h-4 w-4"})})}),(0,ep.jsxs)(ms,{align:"end",children:[n&&(0,ep.jsxs)(ml,{onClick:()=>n(s),children:[(0,ep.jsx)(mV,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,ep.jsxs)(ml,{onClick:T,disabled:g,children:[(0,ep.jsx)(eH,{className:"h-4 w-4 mr-2"}),"Refresh Manually"]}),r&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mc,{}),(0,ep.jsxs)(ml,{onClick:()=>r(s),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ep.jsx)(mF,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-4",children:[(0,ep.jsxs)(tG.TabsContent,{value:"content",className:"mt-0 space-y-6",children:[(0,ep.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-border bg-muted/50 text-xs text-muted-foreground",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),(0,ep.jsx)("span",{className:"font-semibold uppercase tracking-wide",children:"Stored content"}),(0,ep.jsxs)("span",{className:"text-muted-foreground/70",children:["· ",s.content.length.toLocaleString()," chars"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[!0===s.is_stale?(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-amber-500/15 text-amber-700 dark:text-amber-400",title:"New memories in this mental model's scope have been ingested since it was last refreshed",children:"Stale"}):!1===s.is_stale?(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide bg-green-500/15 text-green-700 dark:text-green-400",title:"No new memories in this mental model's scope since it was last refreshed",children:"In sync"}):null,(0,ep.jsxs)("span",{title:wX(s.last_refreshed_at),className:"flex items-center gap-1",children:[(0,ep.jsx)(eH,{className:"w-3 h-3"}),"Last refreshed ",w$(s.last_refreshed_at)]})]})]}),(0,ep.jsx)(wW,{className:"p-4",children:s.content})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(w9,{children:["Based On",M>0?` (${M})`:""]}),s.reflect_response?(0,ep.jsx)(wZ,{based_on:O,onViewMemory:e=>w(e),onViewDirective:e=>N(e)}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:'No source data available. Click "Refresh" to regenerate with source tracking.'})]})]}),(0,ep.jsx)(tG.TabsContent,{value:"configuration",className:"mt-0",children:(0,ep.jsx)(w7,{mentalModel:s})}),(0,ep.jsx)(tG.TabsContent,{value:"history",className:"mt-0",children:E?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(tU.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):k&&k.length>0?(0,ep.jsx)(w5,{history:k,currentContent:s.content,currentBasedOn:O,onViewMemory:e=>w(e),onViewDirective:e=>N(e)}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No history recorded yet."})})]})]}):null]})}),b&&(0,ep.jsx)(tJ,{memoryId:b,onClose:()=>w(null)}),j&&(0,ep.jsx)(wG,{directiveId:j,onClose:()=>N(null)})]})}function w4({label:e,value:t}){return(0,ep.jsxs)("div",{children:[(0,ep.jsx)(w9,{children:e}),(0,ep.jsx)("div",{className:"text-sm text-foreground",children:t})]})}function w6({title:e,icon:t,children:n}){return(0,ep.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5 px-4 py-2 border-b border-border bg-muted/40 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[t,e]}),(0,ep.jsx)("div",{className:"p-4 space-y-4",children:n})]})}function w8({label:e,color:t}){return(0,ep.jsx)("span",{className:`px-2 py-0.5 rounded text-xs ${t??"bg-muted text-foreground border border-border/60"}`,children:e})}function w7({mentalModel:e}){let t=e.trigger??{refresh_after_consolidation:!1},n=t.fact_types??[],r=t.tag_groups??[],i=t.exclude_mental_model_ids??[];return(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ep.jsxs)(w6,{title:"Identity",icon:(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(w4,{label:"ID",value:(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground break-all",children:e.id})}),(0,ep.jsx)(w4,{label:"Name",value:e.name}),e.source_query&&(0,ep.jsx)(w4,{label:"Source Query",value:e.source_query}),(0,ep.jsx)(w4,{label:"Tags",value:e.tags?.length>0?(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.tags.map(e=>(0,ep.jsx)(w8,{label:e,color:"bg-amber-500/10 text-amber-600 dark:text-amber-400"},e))}):(0,ep.jsx)("span",{className:"text-muted-foreground italic text-sm",children:"none"})})]}),(0,ep.jsxs)(w6,{title:"Timing",icon:(0,ep.jsx)(eH,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(w4,{label:"Created",value:wX(e.created_at)}),(0,ep.jsx)(w4,{label:"Last Refreshed",value:(0,ep.jsx)("span",{title:wX(e.last_refreshed_at),children:w$(e.last_refreshed_at)})}),(0,ep.jsx)(w4,{label:"Max Tokens",value:e.max_tokens.toLocaleString()})]}),(0,ep.jsxs)(w6,{title:"Refresh Trigger",icon:(0,ep.jsx)(gX,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(w4,{label:"Refresh mode",value:"delta"===t.mode?(0,ep.jsx)(w8,{label:"Delta",color:"bg-purple-500/10 text-purple-600 dark:text-purple-400"}):(0,ep.jsx)(w8,{label:"Full"})}),(0,ep.jsx)(w4,{label:"Auto-refresh after consolidation",value:t.refresh_after_consolidation?(0,ep.jsx)(w8,{label:"Enabled",color:"bg-green-500/10 text-green-600 dark:text-green-400"}):(0,ep.jsx)(w8,{label:"Disabled"})}),(0,ep.jsx)(w4,{label:"Fact types",value:n.length>0?(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:n.map(e=>{let t=wq(e);return(0,ep.jsx)(w8,{label:t.label,color:t.color},e)})}):(0,ep.jsx)("span",{className:"text-muted-foreground italic text-sm",children:"all"})}),(0,ep.jsx)(w4,{label:"Exclude mental models",value:t.exclude_mental_models?"Yes":"No"}),i.length>0&&(0,ep.jsx)(w4,{label:"Excluded IDs",value:(0,ep.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.map(e=>(0,ep.jsx)("code",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-muted border border-border/60",children:e},e))})})]}),(0,ep.jsxs)(w6,{title:"Recall Parameters",icon:(0,ep.jsx)(eT,{className:"w-3.5 h-3.5"}),children:[(0,ep.jsx)(w4,{label:"Include chunks",value:null==t.include_chunks?"default":t.include_chunks?"Yes":"No"}),(0,ep.jsx)(w4,{label:"Recall max tokens",value:null!=t.recall_max_tokens?t.recall_max_tokens.toLocaleString():"default"}),(0,ep.jsx)(w4,{label:"Recall chunks max tokens",value:null!=t.recall_chunks_max_tokens?t.recall_chunks_max_tokens.toLocaleString():"default"}),(0,ep.jsx)(w4,{label:"Tags match",value:t.tags_match?(0,ep.jsx)(w8,{label:t.tags_match}):"default"})]}),r.length>0&&(0,ep.jsx)("div",{className:"md:col-span-2",children:(0,ep.jsx)(w6,{title:"Tag Groups",icon:(0,ep.jsx)(eT,{className:"w-3.5 h-3.5"}),children:(0,ep.jsx)("pre",{className:"text-xs font-mono bg-muted/40 rounded p-3 overflow-x-auto border border-border/60",children:JSON.stringify(r,null,2)})})})]})}function w9({children:e}){return(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:e})}function je(){let e,t,n,r,i,a,o,s,l,c,u,{currentBank:d}=(0,ey.useBank)(),[h,f]=(0,em.useState)(""),[p,g]=(0,em.useState)("mid"),[v,x]=(0,em.useState)(4096),[y,b]=(0,em.useState)(!0),[w,j]=(0,em.useState)(!0),[N,k]=(0,em.useState)("answer"),[C,E]=(0,em.useState)(null),[_,S]=(0,em.useState)(!1),[T,A]=(0,em.useState)(""),[O,M]=(0,em.useState)("any"),[P,D]=(0,em.useState)([]),[L,I]=(0,em.useState)(!1),[R,B]=(0,em.useState)(""),[z,F]=(0,em.useState)(""),[V,U]=(0,em.useState)(!1),[H,W]=(0,em.useState)(!1),[Y,G]=(0,em.useState)(null),[$,X]=(0,em.useState)(null),[q,K]=(0,em.useState)(null),[Z,Q]=(0,em.useState)(!1),[J,ee]=(0,em.useState)(null),[et,en]=(0,em.useState)(null),[er,ei]=(0,em.useState)(!1),[ea,eo]=(0,em.useState)(null),[es,el]=(0,em.useState)("world"),ec="General Feedback",eu=async e=>{if(ee(e),en(null),d&&e?.id){ei(!0);try{let t=await eP.client.listObservations(d),n=t.items?.find(t=>t.id===e.id);en(n||e)}catch(t){console.error("Failed to load observation:",t),en(e)}finally{ei(!1)}}},ed=async()=>{if(d&&z.trim()){U(!0);try{let e=await eP.client.listDirectives(d),t=e.items?.find(e=>e.name===ec);if(t){let e=t.content?`${t.content}
8
- ${z.trim()}`:z.trim();await eP.client.updateDirective(d,t.id,{content:e})}else await eP.client.createDirective(d,{name:ec,content:z.trim()});F(""),W(!0),setTimeout(()=>W(!1),3e3)}catch(e){}finally{U(!1)}}},eh=async()=>{if(d&&h){S(!0),k("answer");try{let e=T.split(",").map(e=>e.trim()).filter(e=>e.length>0),t=R.split(",").map(e=>e.trim()).filter(e=>e.length>0),n=await eP.client.reflect({bank_id:d,query:h,budget:p,max_tokens:v,include_facts:y,include_tool_calls:w,...e.length>0&&{tags:e,tags_match:O},...P.length>0&&{fact_types:P},...L&&{exclude_mental_models:!0},...t.length>0&&{exclude_mental_model_ids:t}});E(n)}catch(e){}finally{S(!1)}}};return d?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(m8.Card,{children:(0,ep.jsxs)(m8.CardContent,{className:"pt-6",children:[(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsxs)("div",{className:"flex-1 relative",children:[(0,ep.jsx)(eN,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eL.Input,{type:"text",value:h,onChange:e=>f(e.target.value),placeholder:"What would you like to reflect on?",className:"pl-10 h-12 text-lg",onKeyDown:e=>"Enter"===e.key&&eh()})]}),(0,ep.jsx)(eD.Button,{onClick:eh,disabled:_||!h,className:"h-12 px-8",children:_?"Reflecting...":"Reflect"})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Budget:"}),(0,ep.jsxs)(tI.Select,{value:p,onValueChange:e=>g(e),children:[(0,ep.jsx)(tI.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(tI.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(tI.SelectItem,{value:"high",children:"High"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Tokens:"}),(0,ep.jsx)(eL.Input,{type:"number",value:v,onChange:e=>x(parseInt(e.target.value)||4096),className:"w-24 h-8"})]}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m1.Checkbox,{checked:y,onCheckedChange:e=>b(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Include Source"})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m1.Checkbox,{checked:w,onCheckedChange:e=>j(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Include Tools"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,ep.jsx)(tR,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eL.Input,{type:"text",value:T,onChange:e=>A(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(tI.Select,{value:O,onValueChange:e=>M(e),children:[(0,ep.jsx)(tI.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(tI.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(tI.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(tI.SelectItem,{value:"all_strict",children:"All (strict)"})]})]})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsx)(m4,{value:P,onChange:D}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m1.Checkbox,{checked:L,onCheckedChange:e=>I(e)}),(0,ep.jsx)("span",{className:"text-sm",children:"Exclude mental models"})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Exclude IDs:"}),(0,ep.jsx)(eL.Input,{type:"text",value:R,onChange:e=>B(e.target.value),placeholder:"model-a, model-b",className:"h-8 w-48"})]})]})]})}),_&&(0,ep.jsx)(m8.Card,{children:(0,ep.jsxs)(m8.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Reflecting on memories..."})]})}),!_&&C&&(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[C.usage&&(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Input tokens:"}),(0,ep.jsx)("span",{className:"font-semibold",children:C.usage.input_tokens?.toLocaleString()})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Output tokens:"}),(0,ep.jsx)("span",{className:"font-semibold",children:C.usage.output_tokens?.toLocaleString()})]})]}),C.trace?.tool_calls&&(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Tool calls:"}),(0,ep.jsx)("span",{className:"font-semibold",children:C.trace.tool_calls.length}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:["(",C.trace.tool_calls.reduce((e,t)=>e+t.duration_ms,0),"ms)"]})]}),C.trace?.llm_calls&&(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"LLM calls:"}),(0,ep.jsx)("span",{className:"font-semibold",children:C.trace.llm_calls.length}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:["(",C.trace.llm_calls.reduce((e,t)=>e+t.duration_ms,0),"ms)"]})]}),(0,ep.jsx)("div",{className:"flex-1"}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["answer","trace","json"].map(e=>(0,ep.jsx)("button",{onClick:()=>k(e),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${N===e?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"answer"===e?"Answer":"trace"===e?"Trace":"JSON"},e))})]}),"answer"===N&&(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)(m8.Card,{children:[(0,ep.jsx)(m8.CardHeader,{children:(0,ep.jsx)(m8.CardTitle,{children:"Answer"})}),(0,ep.jsx)(m8.CardContent,{children:(0,ep.jsx)("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:(0,ep.jsx)(bh,{remarkPlugins:[wH],children:C.text})})})]}),(0,ep.jsxs)(m8.Card,{className:"border-blue-200 dark:border-blue-800",children:[(0,ep.jsxs)(m8.CardHeader,{className:"py-4",children:[(0,ep.jsxs)(m8.CardTitle,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(ge,{className:"w-4 h-4"}),"Add Directive"]}),(0,ep.jsx)(m8.CardDescription,{className:"text-xs",children:"Hard rules injected into prompts that the agent must follow"})]}),(0,ep.jsx)(m8.CardContent,{className:"pt-0",children:H?(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[(0,ep.jsx)("span",{className:"text-lg",children:"✓"}),(0,ep.jsxs)("span",{className:"text-sm font-medium",children:["Directive saved to ",ec]})]}):(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsx)(gr.Textarea,{value:z,onChange:e=>F(e.target.value),placeholder:"e.g., Always respond in formal English...",className:"flex-1 min-h-[60px] resize-none",onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&ed()}}),(0,ep.jsx)(eD.Button,{onClick:ed,disabled:V||!z.trim(),className:"self-end",children:V?"Saving...":"Save"})]})})]})]}),"trace"===N&&(0,ep.jsxs)("div",{className:"space-y-4",children:[C.observations_created&&C.observations_created.length>0&&(0,ep.jsxs)(m8.Card,{className:"border-emerald-200 dark:border-emerald-800",children:[(0,ep.jsxs)(m8.CardHeader,{className:"bg-emerald-50 dark:bg-emerald-950 py-3",children:[(0,ep.jsxs)(m8.CardTitle,{className:"flex items-center gap-2 text-base",children:[(0,ep.jsx)(m9,{className:"w-4 h-4 text-emerald-600"}),"Observations Created (",C.observations_created.length,")"]}),(0,ep.jsx)(m8.CardDescription,{className:"text-xs",children:"New observations learned during this reflection"})]}),(0,ep.jsx)(m8.CardContent,{className:"pt-4",children:(0,ep.jsx)("div",{className:"space-y-2",children:C.observations_created.map((e,t)=>(0,ep.jsxs)("div",{className:"p-3 bg-emerald-50 dark:bg-emerald-950/50 rounded-lg border border-emerald-200 dark:border-emerald-800",children:[(0,ep.jsx)("div",{className:"font-medium text-sm text-emerald-900 dark:text-emerald-100",children:e.name}),(0,ep.jsx)("div",{className:"text-xs text-emerald-700 dark:text-emerald-300 mt-1",children:e.description}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-2 font-mono",children:["ID: ",e.id]})]},t))})})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,ep.jsxs)(m8.Card,{className:"h-fit",children:[(0,ep.jsxs)(m8.CardHeader,{className:"pb-3",children:[(0,ep.jsx)(m8.CardTitle,{className:"text-base",children:"Execution Trace"}),(0,ep.jsxs)(m8.CardDescription,{className:"text-xs",children:[C.iterations||0," iteration",1!==(C.iterations||0)?"s":""," •"," ",(C.trace?.llm_calls?.reduce((e,t)=>e+t.duration_ms,0)||0)+(C.trace?.tool_calls?.reduce((e,t)=>e+t.duration_ms,0)||0),"ms total"]})]}),(0,ep.jsx)(m8.CardContent,{children:w?C.trace?.llm_calls&&C.trace.llm_calls.length>0||C.trace?.tool_calls&&C.trace.tool_calls.length>0?(0,ep.jsx)("div",{className:"max-h-[500px] overflow-y-auto pr-2",children:(e=C.trace?.llm_calls||[],t=C.trace?.tool_calls||[],n=[],e.forEach((r,i)=>{let a=t.filter(e=>e.iteration===i+1),o=i===e.length-1,s=r.scope.includes("final")||o&&0===a.length,l=s?e.length:i+1;n.push({type:"llm",llm:r,iteration:l,isFinal:s}),a.length>0&&n.push({type:"tools",tools:a,iteration:i+1})}),n.map((e,t)=>(0,ep.jsxs)("div",{className:"relative",children:[t<n.length-1&&(0,ep.jsx)("div",{className:"absolute left-3 top-6 bottom-0 w-0.5 bg-border"}),"llm"===e.type?(0,ep.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,ep.jsx)("div",{className:`w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 ${e.isFinal?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":"bg-primary/10 text-primary"}`,children:e.isFinal?(0,ep.jsx)(tF.Check,{className:"w-3.5 h-3.5",strokeWidth:2.5}):(0,ep.jsx)("span",{className:"text-[10px] font-semibold",children:e.iteration})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("span",{className:"font-medium text-sm",children:e.isFinal?"Response generated":"Agent decided"}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),e.llm.duration_ms,"ms"]})]}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:e.isFinal?"Final answer":"Called tools below"})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 pb-3",children:[(0,ep.jsx)("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-blue-500/15 text-blue-600 dark:text-blue-400 flex-shrink-0",children:(0,ep.jsx)(gn,{className:"w-3 h-3",fill:"currentColor"})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Executing ",e.tools?.length," tool",e.tools?.length!==1?"s":""]}),e.tools?.map((e,t)=>(0,ep.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-muted/50",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground",children:e.tool}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),e.duration_ms,"ms"]})]}),(0,ep.jsxs)("div",{className:"p-2 space-y-2",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:"Input:"}),(0,ep.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,ep.jsx)(g$,{src:e.input,collapsed:1,theme:"default"})})]}),e.output&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-[10px] font-semibold text-muted-foreground mb-1",children:"Output:"}),(0,ep.jsx)("div",{className:"bg-muted p-1.5 rounded text-xs overflow-auto max-h-32",children:(0,ep.jsx)(g$,{src:e.output,collapsed:1,theme:"default"})})]})]})]},t))]})]})]},t)))}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(m7.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"No operations"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"No LLM or tool calls were made during this reflection."})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(m7.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"Not included"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:'Enable "Include Tool Calls" to see trace.'})]})]})})]}),(0,ep.jsxs)(m8.Card,{className:"h-fit",children:[(0,ep.jsxs)(m8.CardHeader,{className:"pb-3",children:[(0,ep.jsx)(m8.CardTitle,{className:"text-base",children:"Based On"}),(0,ep.jsxs)(m8.CardDescription,{className:"text-xs",children:[(C.based_on?.memories?.length||0)+(C.based_on?.observations?.filter(e=>"directive"!==e.subtype)?.length||0)+(C.based_on?.directives?.length||0)," ","items used"]})]}),(0,ep.jsx)(m8.CardContent,{children:y?C.based_on?.memories&&C.based_on.memories.length>0||C.based_on?.mental_models&&C.based_on.mental_models.length>0||C.based_on?.directives&&C.based_on.directives.length>0||C.based_on?.observations&&C.based_on.observations.length>0?(i=(r=C.based_on?.memories||[]).filter(e=>"world"===e.type),a=r.filter(e=>"experience"===e.type),o=C.based_on?.mental_models||[],s=(C.based_on?.observations||[]).filter(e=>"directive"!==e.subtype),c=[{id:"directives",label:"Directives",count:(l=C.based_on?.directives||[]).length},{id:"mental_models",label:"Mental Models",count:o.length},{id:"observations",label:"Observations",count:s.length},{id:"world",label:"World",count:i.length},{id:"experience",label:"Experience",count:a.length}],u=(()=>{switch(es){case"directives":return l;case"mental_models":return o;case"observations":return s;case"world":return i;case"experience":return a;default:return[]}})(),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"flex items-center gap-1 bg-muted rounded-lg p-1 mb-4",children:c.map(e=>(0,ep.jsxs)("button",{onClick:()=>el(e.id),className:`flex-1 px-3 py-1.5 rounded-md text-sm font-medium transition-all ${es===e.id?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.label," (",e.count,")"]},e.id))}),u.length>0?(0,ep.jsx)("div",{className:"max-h-[400px] overflow-y-auto pr-2 space-y-3",children:u.map((e,t)=>{let n,r;return(0,ep.jsx)("div",{className:`p-4 bg-muted/50 rounded-lg border border-border/50 ${"directives"!==es?"cursor-pointer hover:bg-muted/80 transition-colors":""}`,onClick:()=>{"directives"!==es&&("observations"===es?eu(e):"mental_models"===es?eo(e.id):G(e.id))},children:"directives"===es?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"font-medium text-sm",children:e.name}),e.content&&(0,ep.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:e.content})]}):"observations"===es?(0,ep.jsx)("div",{className:"font-medium text-sm",children:e.name}):"mental_models"===es?(r=(n=e.text?.indexOf(": ")??-1)>0?e.text.slice(0,n):e.id,(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"font-medium text-sm",children:r}),(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground",children:e.id})]})):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("p",{className:"text-sm text-foreground leading-relaxed",children:e.text}),e.context&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-2",children:e.context})]})},e.id||t)})}):(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground text-center py-4",children:["No ",es," items"]})]})):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-lg",children:[(0,ep.jsx)(m7.Info,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-amber-900 dark:text-amber-100",children:"No facts found"}),(0,ep.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-300 mt-0.5",children:"No memories were used to generate this answer."})]})]}):(0,ep.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-muted border border-border rounded-lg",children:[(0,ep.jsx)(m7.Info,{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0"}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"font-medium text-sm text-foreground",children:"Not included"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:'Enable "Include Source" to see memories.'})]})]})})]})]})]}),"json"===N&&(0,ep.jsxs)(m8.Card,{children:[(0,ep.jsx)(m8.CardHeader,{children:(0,ep.jsx)(m8.CardTitle,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(m8.CardContent,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(g$,{src:C,collapsed:2,theme:"default"})})})]})]}),!_&&!C&&(0,ep.jsx)(m8.Card,{className:"border-dashed",children:(0,ep.jsxs)(m8.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(eN,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ready to Reflect"}),(0,ep.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:"Enter a question above to query the memory bank and generate a disposition-aware response."})]})}),(0,ep.jsx)(tJ,{memoryId:Y,onClose:()=>G(null)}),$&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(gt,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Directive"})]}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"icon",onClick:()=>{X(null),K(null)},children:(0,ep.jsx)(tV.X,{className:"w-4 h-4"})})]}),Z?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Name"}),(0,ep.jsx)("p",{className:"mt-1 font-medium",children:q?.name||$.name})]}),q?.description&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Description"}),(0,ep.jsx)("p",{className:"mt-1 text-sm",children:q.description})]}),q?.tags&&q.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:q.tags.map(e=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(tR,{className:"w-2.5 h-2.5"}),e]},e))})]}),(q?.content||$.content)&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Content"}),(0,ep.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:q?.content||$.content})})]}),(0,ep.jsxs)("div",{className:"pt-2 border-t",children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:$.id})]})]})]})}),J&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(m9,{className:"w-5 h-5"}),(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:"Observation"})]}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"icon",onClick:()=>{ee(null),en(null)},children:(0,ep.jsx)(tV.X,{className:"w-4 h-4"})})]}),er?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Text"}),(0,ep.jsx)("div",{className:"mt-1 prose prose-sm max-w-none dark:prose-invert",children:(0,ep.jsx)(bh,{remarkPlugins:[wH],children:et?.text||J.text})})]}),et?.tags&&et.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:et.tags.map(e=>(0,ep.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1",children:[(0,ep.jsx)(tR,{className:"w-2.5 h-2.5"}),e]},e))})]}),et?.source_memories&&et.source_memories.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:["Source Memories (",et.source_memories.length,")"]}),(0,ep.jsx)("div",{className:"space-y-2",children:et.source_memories.map((e,t)=>(0,ep.jsx)("div",{className:"p-3 bg-muted rounded-lg",children:(0,ep.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:e.text||("string"==typeof e?e:"")})},t))})]}),(0,ep.jsxs)("div",{className:"pt-2 border-t",children:[(0,ep.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:J.id})]})]})]})}),(0,ep.jsx)(w3,{mentalModelId:ea,onClose:()=>eo(null)})]}):(0,ep.jsx)(m8.Card,{className:"border-dashed",children:(0,ep.jsxs)(m8.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(ek,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to start reflecting."})]})})}let jt=(0,ej.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function jn(){let e,t,n,r,i,a,o,s,l,c,u,d,h,f,{currentBank:p}=(0,ey.useBank)(),[g,v]=(0,em.useState)(""),[x,y]=(0,em.useState)(["world"]),[b,w]=(0,em.useState)("mid"),[j,N]=(0,em.useState)(4096),[k,C]=(0,em.useState)(""),[E,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(""),[M,P]=(0,em.useState)("any"),[D,L]=(0,em.useState)(null),[I,R]=(0,em.useState)(null),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(null),[U,H]=(0,em.useState)(null),[W,Y]=(0,em.useState)(!1),[G,$]=(0,em.useState)("results"),[X,q]=(0,em.useState)(null),[K,Z]=(0,em.useState)(new Set),[Q,J]=(0,em.useState)(new Set),ee=e=>{Z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},et=e=>{J(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},en=e=>{let t=e.id||e.node_id;q(D?.find(e=>e.id===t||e.node_id===t)||e)},er=async()=>{if(!p)return void ev.toast.error("Validation error",{description:"Please select a memory bank first"});if(g){if(0===x.length)return void ev.toast.error("Validation error",{description:"Please select at least one type (World, Experience, or Observations)"});Y(!0);try{let e=A.split(",").map(e=>e.trim()).filter(e=>e.length>0),t={bank_id:p,query:g,types:x,budget:b,max_tokens:j,trace:!0,include:{entities:S?{max_tokens:500}:null,chunks:E?{max_tokens:8192}:null},...k&&{query_timestamp:k},...e.length>0&&{tags:e,tags_match:M}},n=await eP.client.recall(t);L(n.results||[]),R(n.entities||null),z(n.chunks||null),V(n.observations||null),H(n.trace||null),$("results")}catch(e){}finally{Y(!1)}}};return p?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(m8.Card,{children:(0,ep.jsxs)(m8.CardContent,{className:"pt-6",children:[(0,ep.jsxs)("div",{className:"flex gap-3",children:[(0,ep.jsxs)("div",{className:"flex-1 relative",children:[(0,ep.jsx)(ew.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eL.Input,{type:"text",value:g,onChange:e=>v(e.target.value),placeholder:"What would you like to recall?",className:"pl-10 h-12 text-lg",onKeyDown:e=>"Enter"===e.key&&er()})]}),(0,ep.jsx)(eD.Button,{onClick:er,disabled:W||!g,className:"h-12 px-8",children:W?"Searching...":"Recall"})]}),(0,ep.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,ep.jsx)(m4,{value:x,onChange:y,label:"Types:"}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(gX,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsxs)(tI.Select,{value:b,onValueChange:e=>w(e),children:[(0,ep.jsx)(tI.SelectTrigger,{className:"w-24 h-8",children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"low",children:"Low"}),(0,ep.jsx)(tI.SelectItem,{value:"mid",children:"Mid"}),(0,ep.jsx)(tI.SelectItem,{value:"high",children:"High"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:"Tokens:"}),(0,ep.jsx)(eL.Input,{type:"number",value:j,onChange:e=>N(parseInt(e.target.value)),className:"w-24 h-8"})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eY,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)(eL.Input,{type:"datetime-local",value:k,onChange:e=>C(e.target.value),className:"h-8",placeholder:"Query date"})]}),(0,ep.jsx)("div",{className:"h-6 w-px bg-border"}),(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m1.Checkbox,{checked:E,onCheckedChange:e=>_(e)}),(0,ep.jsx)(eC.FileText,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-sm",children:"Chunks"})]}),(0,ep.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,ep.jsx)(m1.Checkbox,{checked:S,onCheckedChange:e=>T(e)}),(0,ep.jsx)(eE,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-sm",children:"Entities"})]})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[(0,ep.jsx)(tR,{className:"h-4 w-4 text-muted-foreground"}),(0,ep.jsx)("div",{className:"flex-1 max-w-md",children:(0,ep.jsx)(eL.Input,{type:"text",value:A,onChange:e=>O(e.target.value),placeholder:"Filter by tags (comma-separated)",className:"h-8"})}),(0,ep.jsxs)(tI.Select,{value:M,onValueChange:e=>P(e),children:[(0,ep.jsx)(tI.SelectTrigger,{className:"w-40 h-8",children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"any",children:"Any (incl. untagged)"}),(0,ep.jsx)(tI.SelectItem,{value:"all",children:"All (incl. untagged)"}),(0,ep.jsx)(tI.SelectItem,{value:"any_strict",children:"Any (strict)"}),(0,ep.jsx)(tI.SelectItem,{value:"all_strict",children:"All (strict)"})]})]})]})]})}),W&&(0,ep.jsx)(m8.Card,{children:(0,ep.jsxs)(m8.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Searching memories..."})]})}),!W&&D&&(0,ep.jsxs)("div",{className:"space-y-4",children:[U?.summary&&(0,ep.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Results:"}),(0,ep.jsx)("span",{className:"font-semibold",children:D.length})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Duration:"}),(0,ep.jsxs)("span",{className:"font-semibold",children:[U.summary.total_duration_seconds?.toFixed(2),"s"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Nodes visited:"}),(0,ep.jsx)("span",{className:"font-semibold",children:U.summary.total_nodes_visited})]}),(0,ep.jsx)("div",{className:"flex-1"}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["results","trace","json"].map(e=>(0,ep.jsx)("button",{onClick:()=>$(e),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${G===e?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"results"===e?"Results":"trace"===e?"Trace":"JSON"},e))})]}),"results"===G&&(0,ep.jsxs)("div",{className:"space-y-4",children:[F&&F.length>0&&(0,ep.jsxs)(m8.Card,{className:"border-orange-500/30 bg-orange-500/5",children:[(0,ep.jsx)(m8.CardHeader,{className:"py-3",children:(0,ep.jsxs)(m8.CardTitle,{className:"text-base flex items-center gap-2",children:[(0,ep.jsx)(ek,{className:"h-4 w-4 text-orange-500"}),(0,ep.jsx)("span",{children:"Observations"}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",F.length,")"]})]})}),(0,ep.jsx)(m8.CardContent,{className:"pt-0 space-y-2",children:F.map((e,t)=>(0,ep.jsxs)("div",{className:"p-3 bg-background rounded-lg border border-orange-500/20",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground",children:e.text}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded bg-orange-500/10 text-orange-600",children:"Observation"}),(0,ep.jsxs)("span",{children:["Proof count: ",e.proof_count||1]}),(0,ep.jsxs)("span",{children:["Relevance: ",(e.relevance||0).toFixed(3)]})]})]},e.id||t))})]}),(0,ep.jsx)("div",{className:"space-y-3",children:0!==D.length||F&&0!==F.length?D.map((e,t)=>{let n=U?.visits?.find(t=>t.node_id===e.id),r=n?n.weights.final_weight:e.score||0;return(0,ep.jsx)(m8.Card,{className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>q(e),children:(0,ep.jsx)(m8.CardContent,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-start gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-semibold text-primary",children:t+1})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-foreground",children:e.text}),(0,ep.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"px-2 py-0.5 rounded bg-muted capitalize",children:e.type||"world"}),e.context&&(0,ep.jsx)("span",{className:"truncate max-w-xs",children:e.context}),e.occurred_start&&(0,ep.jsx)("span",{children:new Date(e.occurred_start).toLocaleDateString()})]})]}),(0,ep.jsxs)("div",{className:"flex-shrink-0 text-right",children:[(0,ep.jsx)("div",{className:"text-sm font-semibold",children:(r??0).toFixed(3)}),(0,ep.jsx)("div",{className:"text-xs text-muted-foreground",children:"score"})]}),(0,ep.jsx)(eS.ChevronRight,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"})]})})},t)}):(0,ep.jsx)(m8.Card,{children:(0,ep.jsxs)(m8.CardContent,{className:"flex flex-col items-center justify-center py-12",children:[(0,ep.jsx)(ew.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"No memories found for this query."})]})})})]}),"trace"===G&&U&&(0,ep.jsxs)("div",{className:"space-y-4",children:[U.retrieval_results&&U.retrieval_results.length>0&&(e={},U.retrieval_results.forEach(t=>{let n=t.fact_type||"all";e[n]||(e[n]=[]),e[n].push(t)}),t=Object.keys(e),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mb-3 flex items-center gap-2",children:[(0,ep.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,ep.jsx)("span",{children:"PARALLEL RETRIEVAL"}),(0,ep.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,ep.jsx)("div",{className:"space-y-2",children:t.map((t,n)=>{let r=e[t],i=`lane-${t}`,a=K.has(i),o=r.reduce((e,t)=>e+(t.results?.length||0),0),s=Math.max(...r.map(e=>e.duration_seconds||0)),l={world:{bg:"bg-blue-500/10",text:"text-blue-500",border:"border-blue-500/30"},experience:{bg:"bg-green-500/10",text:"text-green-500",border:"border-green-500/30"},opinion:{bg:"bg-purple-500/10",text:"text-purple-500",border:"border-purple-500/30"},all:{bg:"bg-gray-500/10",text:"text-gray-500",border:"border-gray-500/30"}},c=l[t]||l.all;return(0,ep.jsx)(m8.Card,{className:`transition-colors ${a?"border-primary":c.border}`,children:(0,ep.jsxs)(m8.CardContent,{className:"py-3 px-4",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-3 cursor-pointer",onClick:()=>ee(i),children:[(0,ep.jsx)("div",{className:`w-8 h-8 rounded-lg ${c.bg} flex items-center justify-center`,children:(0,ep.jsx)("span",{className:`text-sm font-bold ${c.text} capitalize`,children:t.charAt(0).toUpperCase()})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground capitalize",children:t}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[r.length," methods"]})]}),(0,ep.jsx)("div",{className:"flex gap-1.5 mt-1",children:r.map((e,t)=>(0,ep.jsxs)("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-muted text-muted-foreground capitalize",children:[e.method_name,": ",e.results?.length||0]},t))})]}),(0,ep.jsxs)("div",{className:"text-right",children:[(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:o}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[s.toFixed(2),"s"]})]}),a?(0,ep.jsx)(mH.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eS.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]}),a&&(0,ep.jsx)("div",{className:"mt-4 pt-4 border-t border-border",children:(0,ep.jsx)("div",{className:`grid gap-3 ${1===r.length?"grid-cols-1":2===r.length?"grid-cols-2":3===r.length?"grid-cols-3":"grid-cols-4"}`,children:r.map((e,t)=>{let n,r,a,o,s=`${i}-method-${t}`,l=K.has(s),c=e.results||[];return(0,ep.jsxs)("div",{className:"flex flex-col",children:[(0,ep.jsxs)("div",{className:`p-3 rounded-lg cursor-pointer transition-colors ${l?"bg-primary/10 border border-primary":"bg-muted/50 hover:bg-muted"}`,onClick:e=>{e.stopPropagation(),ee(s)},children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground capitalize",children:e.method_name}),"temporal"===e.method_name&&e.metadata?.constraint&&(0,ep.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[(0,ep.jsx)(eI,{className:"h-3 w-3"}),e.metadata.constraint.start?new Date(e.metadata.constraint.start).toLocaleDateString():"any"," → ",e.metadata.constraint.end?new Date(e.metadata.constraint.end).toLocaleDateString():"any"]})]}),l?(0,ep.jsx)(mH.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,ep.jsx)(eS.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),(0,ep.jsxs)("div",{className:"flex items-end justify-between",children:[(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:c.length}),(0,ep.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[e.duration_seconds?.toFixed(2),"s"]})]})]}),l&&c.length>0&&(n=`results-${s}`,a=(r=Q.has(n))?c:c.slice(0,5),o=c.length>5,(0,ep.jsxs)("div",{className:"mt-2 space-y-1.5 max-h-[300px] overflow-y-auto",children:[a.map((e,t)=>(0,ep.jsx)("div",{className:"p-2 bg-background rounded cursor-pointer hover:bg-muted/50 transition-colors border border-border",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ep.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-xs text-foreground line-clamp-2",children:e.text}),(0,ep.jsx)("div",{className:"flex items-center gap-2 mt-1",children:(0,ep.jsx)("span",{className:"text-[10px] text-muted-foreground",children:(e.score||e.similarity||0).toFixed(4)})})]})]})},t)),o&&(0,ep.jsx)("button",{className:"w-full text-[10px] text-primary hover:text-primary/80 py-1.5 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(n)},children:r?"Show less":`View all ${c.length} results`})]}))]},s)})})})]})},i)})}),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)("div",{className:"flex items-center gap-2",children:t.map((e,t)=>{let n={world:"bg-blue-500",experience:"bg-green-500",opinion:"bg-purple-500",all:"bg-gray-500"};return(0,ep.jsx)("div",{className:"flex flex-col items-center",children:(0,ep.jsx)("div",{className:`w-1 h-4 ${n[e]||n.all} rounded-full opacity-50`})},t)})})}),(0,ep.jsx)("div",{className:"flex justify-center",children:(0,ep.jsx)(jt,{className:"h-5 w-5 text-muted-foreground/50"})})]})),U.rrf_merged&&(n="rrf-merge",r=K.has(n),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(m8.Card,{className:`cursor-pointer transition-colors ${r?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(n),children:(0,ep.jsx)(m8.CardContent,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-purple-500/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-purple-500",children:"∪"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"RRF Fusion"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:"merge"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:"Reciprocal Rank Fusion of all retrieval results"})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.rrf_merged.length}),r?(0,ep.jsx)(mH.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eS.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),r&&U.rrf_merged.length>0&&(i="results-rrf",o=(a=Q.has(i))?U.rrf_merged:U.rrf_merged.slice(0,5),s=U.rrf_merged.length>5,(0,ep.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[o.map((e,t)=>(0,ep.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground mt-1",children:["RRF Score: ",(e.rrf_score||e.score||0).toFixed(4)]})]})]})},t)),s&&(0,ep.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(i)},children:a?"Show less":`View all ${U.rrf_merged.length} results`})]})),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)(jt,{className:"h-4 w-4 text-muted-foreground/50"})})]})),U.reranked&&(l="reranking",c=K.has(l),(0,ep.jsxs)("div",{children:[(0,ep.jsx)(m8.Card,{className:`cursor-pointer transition-colors ${c?"border-primary":"hover:border-primary/50"}`,onClick:()=>ee(l),children:(0,ep.jsx)(m8.CardContent,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-amber-500/10 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-amber-500",children:"⚡"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"Combined Scoring"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:"rerank"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:(0,ep.jsx)("span",{className:"font-mono text-xs",children:"ce × recency_boost(±10%) × temporal_boost(±10%)"})})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.reranked.length}),c?(0,ep.jsx)(mH.ChevronDown,{className:"h-5 w-5 text-muted-foreground"}):(0,ep.jsx)(eS.ChevronRight,{className:"h-5 w-5 text-muted-foreground"})]})})}),c&&U.reranked.length>0&&(u="results-rerank",h=(d=Q.has(u))?U.reranked:U.reranked.slice(0,5),f=U.reranked.length>5,(0,ep.jsxs)("div",{className:"ml-6 mt-2 space-y-2 border-l-2 border-muted pl-4 max-h-[400px] overflow-y-auto",children:[h.map((e,t)=>{let n=e.score_components||{};return(0,ep.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),en(e)},children:(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,ep.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-2 text-[10px] text-muted-foreground font-mono",children:[(0,ep.jsxs)("span",{className:"font-semibold text-foreground",children:["= ",(e.rerank_score||e.score||0).toFixed(4)]}),void 0!==n.cross_encoder_score_normalized&&(0,ep.jsxs)("span",{title:"Cross-encoder score (primary relevance signal)",children:["CE: ",n.cross_encoder_score_normalized.toFixed(3)]}),void 0!==n.temporal&&.5!==n.temporal&&(0,ep.jsxs)("span",{title:"Temporal proximity boost (±10% — only active for temporal queries)",children:["Tmp: ",n.temporal.toFixed(3)]}),void 0!==n.recency&&(0,ep.jsxs)("span",{title:"Recency boost (±10% — based on memory age)",children:["Rec: ",n.recency.toFixed(3)]})]})]})]})},t)}),f&&(0,ep.jsx)("button",{className:"w-full text-xs text-primary hover:text-primary/80 py-2 hover:bg-muted/50 rounded transition-colors",onClick:e=>{e.stopPropagation(),et(u)},children:d?"Show less":`View all ${U.reranked.length} results`})]})),(0,ep.jsx)("div",{className:"flex justify-center py-2",children:(0,ep.jsx)(jt,{className:"h-4 w-4 text-muted-foreground/50"})})]})),(0,ep.jsx)(m8.Card,{className:"border-primary bg-primary/5",children:(0,ep.jsx)(m8.CardContent,{className:"py-4",children:(0,ep.jsxs)("div",{className:"flex items-center gap-4",children:[(0,ep.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center",children:(0,ep.jsx)("span",{className:"text-sm font-bold text-primary",children:"✓"})}),(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:"Final Results"}),(0,ep.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-primary/20 text-primary",children:"output"})]}),(0,ep.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:"Top results after all processing steps"})]}),(0,ep.jsx)("div",{className:"text-2xl font-bold text-primary",children:D?.length||0})]})})})]}),"json"===G&&(0,ep.jsxs)(m8.Card,{children:[(0,ep.jsx)(m8.CardHeader,{children:(0,ep.jsx)(m8.CardTitle,{className:"text-lg",children:"Raw Response"})}),(0,ep.jsx)(m8.CardContent,{children:(0,ep.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,ep.jsx)(g$,{src:{results:D,...I&&{entities:I},...B&&{chunks:B},...F&&{observations:F},trace:U},collapsed:2,theme:"default"})})})]})]}),!W&&!D&&(0,ep.jsx)(m8.Card,{className:"border-dashed",children:(0,ep.jsxs)(m8.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(ew.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ready to Recall"}),(0,ep.jsx)("p",{className:"text-muted-foreground text-center max-w-md",children:"Enter a query above to search through your memories. Use filters to narrow down by fact type, budget, and more."})]})}),X&&(0,ep.jsx)("div",{className:"fixed right-0 top-0 h-screen w-[420px] bg-card border-l shadow-2xl z-50 overflow-y-auto",children:(0,ep.jsx)(t0,{memory:X,onClose:()=>q(null),inPanel:!0,bankId:p||void 0})})]}):(0,ep.jsx)(m8.Card,{className:"border-dashed",children:(0,ep.jsxs)(m8.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,ep.jsx)(ek,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to start recalling."})]})})}var jr=e.i(78152);let ji=(0,ej.default)("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);var ja=e.i(82458),ja=ja,tU=tU;let jo={skepticism:{label:"Skepticism",shortLabel:"S",description:"How skeptical vs trusting when forming observations",lowLabel:"Trusting",highLabel:"Skeptical"},literalism:{label:"Literalism",shortLabel:"L",description:"How literally to interpret information when forming observations",lowLabel:"Flexible",highLabel:"Literal"},empathy:{label:"Empathy",shortLabel:"E",description:"How much to consider emotional context when forming observations",lowLabel:"Detached",highLabel:"Empathetic"}};function js({hideReflectFields:e=!1}){let t=(0,eg.useRouter)(),{currentBank:n,setCurrentBank:r,loadBanks:i}=(0,ey.useBank)(),{features:a}=(0,jr.useFeatures)();a?.observations;let[o,s]=(0,em.useState)(null),[l,c]=(0,em.useState)(null),[u,d]=(0,em.useState)([]),[h,f]=(0,em.useState)(0),[p,g]=(0,em.useState)([]),[v,x]=(0,em.useState)(0),[y,b]=(0,em.useState)(!1),[w,j]=(0,em.useState)(!1),[N,k]=(0,em.useState)(!1),[C,E]=(0,em.useState)(!1),[_,S]=(0,em.useState)(null),[T,A]=(0,em.useState)(null),[O,M]=(0,em.useState)(!1),[P,D]=(0,em.useState)(!1),[L,I]=(0,em.useState)(!1),[R,B]=(0,em.useState)(!1),[z,F]=(0,em.useState)(!1),[V,U]=(0,em.useState)(!1),[H,W]=(0,em.useState)(null),[Y]=(0,em.useState)(10),[G,$]=(0,em.useState)(0),[X,q]=(0,em.useState)(null),K=async(e=H,t=G)=>{if(n)try{let r=await eP.client.listOperations(n,{status:e||void 0,limit:Y,offset:t});d(r.operations||[]),f(r.total||0)}catch(e){console.error("Error loading operations:",e)}},Z=async(e=!1)=>{if(n){if(e){try{let[e,t,r]=await Promise.all([eP.client.getBankStats(n),eP.client.listDirectives(n),eP.client.listMentalModels(n)]);c(e),g(t.items||[]),x(r.items?.length||0)}catch(e){console.error("Error refreshing stats:",e)}return}b(!0);try{let[e,t,r,i]=await Promise.all([eP.client.getBankProfile(n),eP.client.getBankStats(n),eP.client.listDirectives(n),eP.client.listMentalModels(n)]);s(e),c(t),g(r.items||[]),x(i.items?.length||0),await K()}catch(e){}finally{b(!1)}}},Q=async()=>{if(n){I(!0);try{await eP.client.deleteBank(n),D(!1),r(null),await i(),t.push("/")}catch(e){}finally{I(!1)}}},J=async()=>{if(n){F(!0);try{let e=await eP.client.clearObservations(n);B(!1),await Z(),ev.toast.success("Success",{description:e.message||"Observations cleared successfully"})}catch(e){}finally{F(!1)}}},ee=async()=>{if(n&&T){M(!0);try{await eP.client.deleteDirective(n,T.id),g(e=>e.filter(e=>e.id!==T.id)),_?.id===T.id&&S(null),A(null)}catch(e){}finally{M(!1)}}};return((0,em.useEffect)(()=>{if(n){Z();let e=setInterval(()=>Z(!0),5e3);return()=>clearInterval(e)}},[n]),(0,em.useEffect)(()=>{let e=e=>{"Escape"===e.key&&S(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),n)?y&&!o?(0,ep.jsx)(m8.Card,{children:(0,ep.jsxs)(m8.CardContent,{className:"text-center py-10",children:[(0,ep.jsx)(eY,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"}),(0,ep.jsx)("div",{className:"text-lg text-muted-foreground",children:"Loading profile..."})]})}):(0,ep.jsxs)("div",{className:"space-y-6",children:[!e&&(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,ep.jsxs)(m8.Card,{children:[(0,ep.jsx)(m8.CardHeader,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(m8.CardTitle,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(m9,{className:"w-5 h-5 text-primary"}),"Disposition Profile"]}),(0,ep.jsx)(m8.CardDescription,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)(eD.Button,{onClick:()=>j(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(mV,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(m8.CardContent,{children:o&&(0,ep.jsx)("div",{className:"space-y-4",children:Object.keys(jo).map(e=>(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:jo[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:jo[e].description})]}),(0,ep.jsxs)("span",{className:"text-sm font-bold text-primary",children:[o.disposition[e],"/5"]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:jo[e].lowLabel}),(0,ep.jsx)("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:(0,ep.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${(o.disposition[e]-1)/4*100}%`}})}),(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:jo[e].highLabel})]})]},e))})})]}),(0,ep.jsxs)(m8.Card,{children:[(0,ep.jsx)(m8.CardHeader,{className:"pb-2",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)(m8.CardTitle,{className:"flex items-center gap-2 text-lg",children:[(0,ep.jsx)(ji,{className:"w-5 h-5 text-primary"}),"Mission"]}),(0,ep.jsx)(m8.CardDescription,{children:"Affects how observations, reflect, and mental models are created"})]}),(0,ep.jsx)(eD.Button,{onClick:()=>k(!0),variant:"ghost",size:"sm",children:(0,ep.jsx)(mV,{className:"h-4 w-4"})})]})}),(0,ep.jsx)(m8.CardContent,{children:(0,ep.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap leading-relaxed",children:o?.mission||"No mission set. Set a mission to derive structural mental models and personalize reflect responses."})})]})]}),(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,ep.jsx)(ja.default,{className:"w-5 h-5 text-rose-500"}),"Directives"]}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:"Hard rules that must be followed during reflect"})]}),(0,ep.jsxs)(eD.Button,{onClick:()=>E(!0),variant:"outline",size:"sm",className:"h-8",children:[(0,ep.jsx)(fB.Plus,{className:"w-4 h-4 mr-1"}),"Add"]})]}),p.length>0?(0,ep.jsx)("div",{className:"grid grid-cols-2 gap-3",children:p.map(e=>(0,ep.jsx)(m8.Card,{className:`cursor-pointer transition-colors border-rose-500/30 ${_?.id===e.id?"bg-rose-500/10 border-rose-500":"hover:bg-rose-500/5"}`,onClick:()=>S(e),children:(0,ep.jsx)(m8.CardContent,{className:"p-3",children:(0,ep.jsxs)("div",{className:"flex items-start gap-2",children:[(0,ep.jsx)(ja.default,{className:"w-4 h-4 text-rose-500 shrink-0 mt-0.5"}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("span",{className:"font-medium text-sm text-foreground",children:e.name}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-1",children:e.content}),e.tags&&e.tags.length>0&&(0,ep.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[(0,ep.jsx)(tR,{className:"w-3 h-3 text-muted-foreground"}),e.tags.map(e=>(0,ep.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:e},e))]})]})]})})},e.id))}):(0,ep.jsxs)("div",{className:"p-6 border border-dashed border-rose-500/30 rounded-lg text-center",children:[(0,ep.jsx)(ja.default,{className:"w-6 h-6 mx-auto mb-2 text-rose-500/50"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:"No directives yet. Directives are hard rules that must be followed during reflect."})]})]}),(0,ep.jsx)(mg,{open:P,onOpenChange:D,children:(0,ep.jsxs)(mP,{children:[(0,ep.jsxs)(mD,{children:[(0,ep.jsx)(mI,{children:"Delete Memory Bank"}),(0,ep.jsx)(mR,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to delete the memory bank"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:n}),"?"]}),(0,ep.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:"This action cannot be undone. All memories, entities, documents, and the bank profile will be permanently deleted."}),l&&(0,ep.jsxs)("p",{children:["This will delete ",l.total_nodes," memories, ",l.total_documents," ","documents, and ",l.total_links," links."]})]})})]}),(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mz,{disabled:L,children:"Cancel"}),(0,ep.jsx)(mB,{onClick:Q,disabled:L,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:L?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eH,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mF,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(mg,{open:R,onOpenChange:B,children:(0,ep.jsxs)(mP,{children:[(0,ep.jsxs)(mD,{children:[(0,ep.jsx)(mI,{children:"Clear Observations"}),(0,ep.jsx)(mR,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to clear all observations for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:n}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"This will delete all consolidated knowledge. Observations will be regenerated the next time consolidation runs."}),l&&l.total_observations>0&&(0,ep.jsxs)("p",{children:["This will delete ",l.total_observations," observations."]})]})})]}),(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mz,{disabled:z,children:"Cancel"}),(0,ep.jsx)(mB,{onClick:J,disabled:z,className:"bg-amber-500 text-white hover:bg-amber-600",children:z?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tU.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mF,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})}),(0,ep.jsx)(ju,{open:C,mode:"create",onClose:()=>E(!1),onCreated:e=>{g(t=>[e,...t]),E(!1)}}),(0,ep.jsx)(mg,{open:!!T,onOpenChange:e=>!e&&A(null),children:(0,ep.jsxs)(mP,{children:[(0,ep.jsxs)(mD,{children:[(0,ep.jsx)(mI,{children:"Delete Directive"}),(0,ep.jsxs)(mR,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',T?.name,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(mL,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(mz,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(mB,{onClick:ee,disabled:O,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[O?(0,ep.jsx)(tU.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),_&&(0,ep.jsx)(jd,{directive:_,onClose:()=>S(null),onDelete:()=>A({id:_.id,name:_.name}),onUpdated:e=>{g(t=>t.map(t=>t.id===e.id?e:t)),S(e)}}),w&&o&&(0,ep.jsx)(jl,{disposition:o.disposition,onClose:()=>j(!1),onSaved:async()=>{await Z(),j(!1)}}),N&&o&&(0,ep.jsx)(jc,{mission:o.mission||"",onClose:()=>k(!1),onSaved:async()=>{await Z(),k(!1)}})]}):(0,ep.jsx)(m8.Card,{children:(0,ep.jsxs)(m8.CardContent,{className:"p-10 text-center",children:[(0,ep.jsx)("h3",{className:"text-xl font-semibold mb-2 text-card-foreground",children:"No Bank Selected"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Please select a memory bank from the dropdown above to view its profile."})]})})}function jl({disposition:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)(e),l=async()=>{if(r){a(!0);try{await eP.client.updateBankConfig(r,{disposition_skepticism:o.skepticism,disposition_literalism:o.literalism,disposition_empathy:o.empathy}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tW.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tW.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tW.DialogHeader,{children:[(0,ep.jsx)(tW.DialogTitle,{children:"Edit Disposition Traits"}),(0,ep.jsx)(tW.DialogDescription,{children:"Traits that shape the reasoning and perspective"})]}),(0,ep.jsx)("div",{className:"space-y-4 py-4",children:Object.keys(jo).map(e=>(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-center",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:jo[e].label}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:jo[e].description})]}),(0,ep.jsxs)("span",{className:"text-sm font-bold text-primary",children:[o[e],"/5"]})]}),(0,ep.jsxs)("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[(0,ep.jsx)("span",{children:jo[e].lowLabel}),(0,ep.jsx)("span",{children:jo[e].highLabel})]}),(0,ep.jsx)("input",{type:"range",min:"1",max:"5",step:"1",value:o[e],onChange:t=>s(n=>({...n,[e]:parseInt(t.target.value)})),className:"w-full h-2 bg-muted rounded-lg appearance-none cursor-pointer accent-primary"})]},e))}),(0,ep.jsxs)(tW.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eH,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function jc({mission:e,onClose:t,onSaved:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)(e),l=async()=>{if(r){a(!0);try{await eP.client.updateBankConfig(r,{reflect_mission:o||null}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tW.Dialog,{open:!0,onOpenChange:t,children:(0,ep.jsxs)(tW.DialogContent,{className:"max-w-xl",children:[(0,ep.jsxs)(tW.DialogHeader,{children:[(0,ep.jsx)(tW.DialogTitle,{children:"Edit Mission"}),(0,ep.jsx)(tW.DialogDescription,{children:"Affects how observations, reflect, and mental models are created"})]}),(0,ep.jsx)("div",{className:"space-y-2 py-4",children:(0,ep.jsx)(gr.Textarea,{value:o,onChange:e=>s(e.target.value),placeholder:"e.g., I am a PM for the engineering team. I help coordinate sprints and track project progress...",rows:8,className:"resize-none"})}),(0,ep.jsxs)(tW.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{onClick:t,variant:"outline",disabled:i,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:l,disabled:i,children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(eH,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})}function ju({open:e,mode:t,directive:n,onClose:r,onCreated:i,onSaved:a}){let{currentBank:o}=(0,ey.useBank)(),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)({name:"",content:"",tags:""});(0,em.useEffect)(()=>{"edit"===t&&n?u({name:n.name,content:n.content,tags:(n.tags||[]).join(", ")}):"create"===t&&u({name:"",content:"",tags:""})},[e,t,n]);let d=async()=>{if(o&&c.name.trim()&&c.content.trim()){l(!0);try{let e=c.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0);if("create"===t){let t=await eP.client.createDirective(o,{name:c.name.trim(),content:c.content.trim(),tags:e.length>0?e:void 0});u({name:"",content:"",tags:""}),i?.(t)}else if(n){let t=await eP.client.updateDirective(o,n.id,{name:c.name.trim(),content:c.content.trim(),tags:e});a?.(t),r()}}catch(e){}finally{l(!1)}}},h=()=>{"create"===t&&u({name:"",content:"",tags:""}),r()};return(0,ep.jsx)(tW.Dialog,{open:e,onOpenChange:e=>!e&&h(),children:(0,ep.jsxs)(tW.DialogContent,{className:"sm:max-w-lg",children:[(0,ep.jsxs)(tW.DialogHeader,{children:[(0,ep.jsxs)(tW.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)(ja.default,{className:"w-5 h-5 text-rose-500"}),"create"===t?"Create":"Edit"," Directive"]}),(0,ep.jsx)(tW.DialogDescription,{children:"Directives are hard rules that must be followed during reflect."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eL.Input,{value:c.name,onChange:e=>u({...c,name:e.target.value}),placeholder:"e.g., Competitor Policy"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Rule *"}),(0,ep.jsx)(gr.Textarea,{value:c.content,onChange:e=>u({...c,content:e.target.value}),placeholder:"e.g., Never mention competitor products directly.",className:"min-h-[120px]"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("label",{className:"text-sm font-medium text-foreground",children:["Tags ",(0,ep.jsx)("span",{className:"text-muted-foreground font-normal",children:"(optional)"})]}),(0,ep.jsx)(eL.Input,{value:c.tags,onChange:e=>u({...c,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"})]})]}),(0,ep.jsxs)(tW.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:h,disabled:s,children:"Cancel"}),(0,ep.jsxs)(eD.Button,{onClick:d,disabled:s||!c.name.trim()||!c.content.trim(),className:"bg-rose-500 hover:bg-rose-600",children:[s?(0,ep.jsx)(tU.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"create"===t?"Create":"Save"]})]})]})})}function jd({directive:e,onClose:t,onDelete:n,onUpdated:r}){let[i,a]=(0,em.useState)(!1);return(0,ep.jsxs)("div",{className:"fixed right-0 top-0 h-screen w-1/2 bg-card border-l-2 border-rose-500 shadow-2xl z-50 overflow-y-auto animate-in slide-in-from-right duration-300 ease-out",children:[(0,ep.jsxs)("div",{className:"p-6",children:[(0,ep.jsxs)("div",{className:"flex justify-between items-start mb-8 pb-5 border-b border-border",children:[(0,ep.jsxs)("div",{className:"flex items-start gap-3",children:[(0,ep.jsx)(ja.default,{className:"w-5 h-5 text-rose-500"}),(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-xl font-bold text-foreground",children:e.name}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",onClick:()=>a(!0),className:"h-7 w-7 p-0",children:(0,ep.jsx)(mV,{className:"h-3.5 w-3.5"})})]}),(0,ep.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-rose-500/10 text-rose-600 dark:text-rose-400",children:"directive"})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",onClick:n,className:"h-8 w-8 p-0 text-muted-foreground hover:text-rose-500",children:(0,ep.jsx)(mF,{className:"h-4 w-4"})}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:(0,ep.jsx)(tV.X,{className:"h-4 w-4"})})]})]}),(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Rule"}),(0,ep.jsx)("div",{className:"prose prose-base dark:prose-invert max-w-none",children:(0,ep.jsx)(bh,{remarkPlugins:[wH],children:e.content})})]}),e.tags&&e.tags.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Tags"}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:e.tags.map(e=>(0,ep.jsx)("span",{className:"px-2 py-1 rounded bg-muted text-muted-foreground text-sm",children:e},e))})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:"ID"}),(0,ep.jsx)("code",{className:"text-sm font-mono break-all text-muted-foreground",children:e.id})]})]})]}),(0,ep.jsx)(ju,{open:i,mode:"edit",directive:e,onClose:()=>a(!1),onSaved:r})]})}let jh=(0,e3.cva)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),jf=em.forwardRef(({className:e,variant:t,...n},r)=>(0,ep.jsx)("div",{ref:r,role:"alert",className:(0,eA.cn)(jh({variant:t}),e),...n}));jf.displayName="Alert",em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("h5",{ref:n,className:(0,eA.cn)("mb-1 font-medium leading-none tracking-tight",e),...t})).displayName="AlertTitle";let jp=em.forwardRef(({className:e,...t},n)=>(0,ep.jsx)("div",{ref:n,className:(0,eA.cn)("text-sm [&_p]:leading-relaxed",e),...t}));jp.displayName="AlertDescription";var tU=tU;let jm=(0,ej.default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),jg=[{value:"HARM_CATEGORY_HARASSMENT",label:"Harassment"},{value:"HARM_CATEGORY_HATE_SPEECH",label:"Hate Speech"},{value:"HARM_CATEGORY_SEXUALLY_EXPLICIT",label:"Sexually Explicit"},{value:"HARM_CATEGORY_DANGEROUS_CONTENT",label:"Dangerous Content"}],jv=[{value:"HARM_BLOCK_THRESHOLD_UNSPECIFIED",label:"Unspecified (use Gemini default)"},{value:"OFF",label:"Off (filter disabled)"},{value:"BLOCK_NONE",label:"Block none"},{value:"BLOCK_LOW_AND_ABOVE",label:"Block low & above"},{value:"BLOCK_MEDIUM_AND_ABOVE",label:"Block medium & above"},{value:"BLOCK_ONLY_HIGH",label:"Block only high"}],jx=jg.map(e=>({category:e.value,threshold:"BLOCK_NONE"})),jy=[{label:"Core",tools:["retain","sync_retain","recall","reflect"]},{label:"Bank management",tools:["list_banks","create_bank","get_bank","get_bank_stats","update_bank","delete_bank","clear_memories"]},{label:"Mental models",tools:["list_mental_models","get_mental_model","create_mental_model","update_mental_model","delete_mental_model","refresh_mental_model"]},{label:"Directives",tools:["list_directives","create_directive","delete_directive"]},{label:"Memories",tools:["list_memories","get_memory"]},{label:"Documents",tools:["list_documents","get_document","delete_document"]},{label:"Operations",tools:["list_operations","get_operation","cancel_operation"]},{label:"Tags",tools:["list_tags"]}],jb=jy.flatMap(e=>e.tools);function jw(e){return Array.isArray(e)?e:e&&"object"==typeof e&&Array.isArray(e.attributes)?e.attributes:null}function jj(e){return{retain_chunk_size:e.retain_chunk_size??null,retain_extraction_mode:e.retain_extraction_mode??null,retain_mission:e.retain_mission??null,retain_custom_instructions:e.retain_custom_instructions??null,entities_allow_free_form:e.entities_allow_free_form??null,entity_labels:jw(e.entity_labels)}}function jN(e){return{retain_default_strategy:e.retain_default_strategy??null,retain_strategies:e.retain_strategies??null}}function jk(e){return{enable_observations:e.enable_observations??null,consolidation_llm_batch_size:e.consolidation_llm_batch_size??null,consolidation_source_facts_max_tokens:e.consolidation_source_facts_max_tokens??null,consolidation_source_facts_max_tokens_per_observation:e.consolidation_source_facts_max_tokens_per_observation??null,observations_mission:e.observations_mission??null,max_observations_per_scope:e.max_observations_per_scope??null}}function jC(e){return{mcp_enabled_tools:e.mcp_enabled_tools??null}}function jE(e){return{llm_gemini_safety_settings:e.llm_gemini_safety_settings??null}}let j_={reflect_mission:"",disposition_skepticism:3,disposition_literalism:3,disposition_empathy:3};function jS(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,jr.useFeatures)(),n=t?.bank_config_api??!0,[r,i]=(0,em.useState)(!0),[a,o]=(0,em.useState)({}),[s,l]=(0,em.useState)(j_),[c,u]=(0,em.useState)(jj({})),[d,h]=(0,em.useState)(jN({})),[f,p]=(0,em.useState)(jk({})),[g,v]=(0,em.useState)(j_),[x,y]=(0,em.useState)(jC({})),[b,w]=(0,em.useState)(jE({})),[j,N]=(0,em.useState)(!1),[k,C]=(0,em.useState)(!1),[E,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(!1),[M,P]=(0,em.useState)(null),[D,L]=(0,em.useState)(null),[I,R]=(0,em.useState)(null),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(null),U=(0,em.useMemo)(()=>JSON.stringify(c)!==JSON.stringify(jj(a))||JSON.stringify(d)!==JSON.stringify(jN(a)),[c,d,a]),H=(0,em.useMemo)(()=>JSON.stringify(f)!==JSON.stringify(jk(a)),[f,a]),W=(0,em.useMemo)(()=>JSON.stringify(g)!==JSON.stringify(s),[g,s]),Y=(0,em.useMemo)(()=>JSON.stringify(x)!==JSON.stringify(jC(a)),[x,a]),G=(0,em.useMemo)(()=>JSON.stringify(b)!==JSON.stringify(jE(a)),[b,a]);(0,em.useEffect)(()=>{e&&$()},[e]);let $=async()=>{if(e){i(!0);try{let[t,n]=await Promise.all([eP.client.getBankConfig(e),eP.client.getBankProfile(e)]),r=t.config,i={reflect_mission:n.mission??"",disposition_skepticism:r.disposition_skepticism??n.disposition?.skepticism??3,disposition_literalism:r.disposition_literalism??n.disposition?.literalism??3,disposition_empathy:r.disposition_empathy??n.disposition?.empathy??3};o(r),l(i),u(jj(r)),h(jN(r)),p(jk(r)),v(i),y(jC(r)),w(jE(r))}catch(e){console.error("Failed to load bank data:",e)}finally{i(!1)}}},X=async()=>{if(e){N(!0),P(null);try{let t={...c,...d};await eP.client.updateBankConfig(e,t),o(e=>({...e,...t}))}catch(e){P(e.message||"Failed to save retain settings")}finally{N(!1)}}},q=async()=>{if(e){C(!0),L(null);try{await eP.client.updateBankConfig(e,f),o(e=>({...e,...f}))}catch(e){L(e.message||"Failed to save observations settings")}finally{C(!1)}}},K=async()=>{if(e){_(!0),R(null);try{await eP.client.updateBankConfig(e,{reflect_mission:g.reflect_mission||null,disposition_skepticism:g.disposition_skepticism,disposition_literalism:g.disposition_literalism,disposition_empathy:g.disposition_empathy}),l(g)}catch(e){R(e.message||"Failed to save reflect settings")}finally{_(!1)}}},Z=async()=>{if(e){T(!0),z(null);try{await eP.client.updateBankConfig(e,x),o(e=>({...e,...x}))}catch(e){z(e.message||"Failed to save MCP settings")}finally{T(!1)}}},Q=async()=>{if(e){O(!0),V(null);try{await eP.client.updateBankConfig(e,b),o(e=>({...e,...b}))}catch(e){V(e.message||"Failed to save Gemini settings")}finally{O(!1)}}};return e?n?r?(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(tU.default,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,ep.jsx)(ep.Fragment,{children:(0,ep.jsxs)("div",{className:"space-y-8",children:[(0,ep.jsxs)(jL,{title:"Retain",description:"Default extraction settings and named strategies. Pass a strategy name on retain requests to override defaults per-item.",error:M,dirty:U,saving:j,onSave:X,children:[(0,ep.jsx)(jI,{label:"Default strategy",description:"Applied automatically when no strategy is specified on a request.",children:(0,ep.jsxs)(tI.Select,{value:d.retain_default_strategy??"__none__",onValueChange:e=>h(t=>({...t,retain_default_strategy:"__none__"===e?null:e})),children:[(0,ep.jsx)(tI.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"__none__",children:(0,ep.jsx)("span",{className:"text-muted-foreground italic",children:"Default"})}),Object.keys(d.retain_strategies??{}).map(e=>(0,ep.jsx)(tI.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(jP,{defaultValues:c,onDefaultChange:e=>u(t=>({...t,...e})),strategies:d.retain_strategies,onStrategiesChange:e=>h(t=>({...t,retain_strategies:e}))})]}),(0,ep.jsxs)(jL,{title:"Observations",description:"Control how facts are synthesized into durable observations",error:D,dirty:H,saving:k,onSave:q,children:[(0,ep.jsx)(jI,{label:"Enable Observations",description:"Enable automatic consolidation of facts into observations",children:(0,ep.jsx)("div",{className:"flex justify-end",children:(0,ep.jsx)(tL.Switch,{checked:f.enable_observations??!1,onCheckedChange:e=>p(t=>({...t,enable_observations:e}))})})}),(0,ep.jsx)(jR,{label:"Mission",description:"What this bank should synthesise into durable observations. Replaces the built-in consolidation rules — leave blank to use the server default.",value:f.observations_mission??"",onChange:e=>p(t=>({...t,observations_mission:e||null})),placeholder:"e.g. Observations are stable facts about people and projects. Always include preferences, skills, and recurring patterns. Ignore one-off events and ephemeral state.",rows:3}),(0,ep.jsx)(jI,{label:"LLM Batch Size",description:"Number of facts sent to the LLM in a single consolidation call. Higher values reduce LLM calls at the cost of larger prompts. Leave blank to use the server default.",children:(0,ep.jsx)(eL.Input,{type:"number",min:1,max:64,value:f.consolidation_llm_batch_size??"",onChange:e=>p(t=>({...t,consolidation_llm_batch_size:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jI,{label:"Source Facts Max Tokens",description:"Total token budget for source facts included with observations during consolidation. -1 = unlimited.",children:(0,ep.jsx)(eL.Input,{type:"number",min:-1,value:f.consolidation_source_facts_max_tokens??"",onChange:e=>p(t=>({...t,consolidation_source_facts_max_tokens:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jI,{label:"Source Facts Max Tokens Per Observation",description:"Per-observation token cap for source facts during consolidation. Each observation gets at most this many tokens of source facts. -1 = unlimited.",children:(0,ep.jsx)(eL.Input,{type:"number",min:-1,value:f.consolidation_source_facts_max_tokens_per_observation??"",onChange:e=>p(t=>({...t,consolidation_source_facts_max_tokens_per_observation:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})}),(0,ep.jsx)(jI,{label:"Max Observations Per Scope",description:"Maximum number of observations allowed per tag scope. When the limit is reached, only updates and deletes are allowed. Observations with no tags are not subject to this limit. -1 = unlimited.",children:(0,ep.jsx)(eL.Input,{type:"number",min:-1,value:f.max_observations_per_scope??"",onChange:e=>p(t=>({...t,max_observations_per_scope:e.target.value?parseInt(e.target.value,10):null})),placeholder:"Server default"})})]}),(0,ep.jsxs)(jL,{title:"Reflect",description:"Shape how the bank reasons and responds in reflect operations",error:I,dirty:W,saving:E,onSave:K,children:[(0,ep.jsx)(jR,{label:"Mission",description:"Agent identity and purpose. Used as framing context in reflect.",value:g.reflect_mission,onChange:e=>v(t=>({...t,reflect_mission:e})),placeholder:"e.g. You are a senior engineering assistant. Always ground answers in documented decisions and rationale. Ignore speculation. Be direct and precise.",rows:3}),(0,ep.jsx)(jB,{label:"Skepticism",description:"How skeptical vs trusting when evaluating claims",lowLabel:"Trusting",highLabel:"Skeptical",value:g.disposition_skepticism,onChange:e=>v(t=>({...t,disposition_skepticism:e}))}),(0,ep.jsx)(jB,{label:"Literalism",description:"How literally to interpret information",lowLabel:"Flexible",highLabel:"Literal",value:g.disposition_literalism,onChange:e=>v(t=>({...t,disposition_literalism:e}))}),(0,ep.jsx)(jB,{label:"Empathy",description:"How much to weight emotional context",lowLabel:"Detached",highLabel:"Empathetic",value:g.disposition_empathy,onChange:e=>v(t=>({...t,disposition_empathy:e}))})]}),(0,ep.jsxs)(jL,{title:"MCP Tools",description:"Restrict which MCP tools this bank exposes to agents",error:B,dirty:Y,saving:S,onSave:Z,children:[(0,ep.jsx)(jI,{label:"Restrict tools",description:"When off, all tools are available. When on, only the selected tools can be invoked for this bank.",children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,ep.jsx)(tL.Switch,{checked:null!==x.mcp_enabled_tools,onCheckedChange:e=>y({mcp_enabled_tools:e?[...jb]:null})}),(0,ep.jsx)(e6,{className:"text-xs text-muted-foreground",children:null!==x.mcp_enabled_tools?"Enabled":"Disabled"})]})}),null!==x.mcp_enabled_tools&&(0,ep.jsx)(jD,{selected:x.mcp_enabled_tools,onChange:e=>y({mcp_enabled_tools:e})})]}),(0,ep.jsx)(jL,{title:"Models",description:"Provider-specific model settings",error:F,dirty:G,saving:A,onSave:Q,children:(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,ep.jsx)("p",{className:"text-sm font-semibold",children:"Gemini / Vertex AI"}),(0,ep.jsxs)("div",{className:"pl-4 border-l-2 border-border/40 space-y-4",children:[(0,ep.jsx)(jI,{label:"Safety settings",description:(0,ep.jsxs)(ep.Fragment,{children:["When off, Gemini's default safety thresholds are used. When on, configure thresholds per harm category."," ",(0,ep.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:"Learn more"})]}),children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,ep.jsx)(tL.Switch,{checked:null!==b.llm_gemini_safety_settings,onCheckedChange:e=>w({llm_gemini_safety_settings:e?[...jx]:null})}),(0,ep.jsx)(e6,{className:"text-xs text-muted-foreground",children:null!==b.llm_gemini_safety_settings?"Custom":"Default"})]})}),null!==b.llm_gemini_safety_settings&&(0,ep.jsx)(jU,{value:b.llm_gemini_safety_settings,onChange:e=>w({llm_gemini_safety_settings:e})})]})]})})]})}):(0,ep.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-3 text-center",children:[(0,ep.jsx)("p",{className:"text-base font-medium text-foreground",children:"Bank configuration is disabled"}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground max-w-sm",children:["Set"," ",(0,ep.jsx)("code",{className:"font-mono text-xs bg-muted px-1 py-0.5 rounded",children:"HINDSIGHT_API_ENABLE_BANK_CONFIG_API=true"})," ","to enable per-bank configuration."]})]}):(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)("p",{className:"text-muted-foreground",children:"No bank selected"})})}let jT=["concise","verbose","verbatim","chunks","custom"],jA="__inherit__";function jO({values:e,onChange:t,isOverride:n=!1}){let r=e.retain_extraction_mode??(n?jA:""),i="custom"===e.retain_extraction_mode;return(0,ep.jsxs)("div",{className:"divide-y divide-border/40",children:[(0,ep.jsx)(jI,{label:"Extraction Mode",description:"How aggressively to extract facts. concise = selective, verbose = capture everything, verbatim = store chunks as-is (still extract entities/time), chunks = no LLM, custom = write your own rules.",children:(0,ep.jsxs)(tI.Select,{value:r,onValueChange:e=>t({retain_extraction_mode:e===jA?null:e||null}),children:[(0,ep.jsx)(tI.SelectTrigger,{className:"w-full",children:(0,ep.jsx)(tI.SelectValue,{placeholder:n?"Inherited from default":void 0})}),(0,ep.jsxs)(tI.SelectContent,{children:[n&&(0,ep.jsx)(tI.SelectItem,{value:jA,children:(0,ep.jsx)("span",{className:"text-muted-foreground italic",children:"inherited"})}),jT.map(e=>(0,ep.jsx)(tI.SelectItem,{value:e,children:e},e))]})]})}),(0,ep.jsx)(jI,{label:"Chunk Size",description:"Size of text chunks for processing (characters)",children:(0,ep.jsx)(eL.Input,{type:"number",min:500,max:8e3,value:e.retain_chunk_size??"",onChange:e=>t({retain_chunk_size:e.target.value?parseFloat(e.target.value):null}),placeholder:n?"Inherited from default":void 0})}),(0,ep.jsx)(jR,{label:"Mission",description:"What this bank should pay attention to during extraction. Steers the LLM without replacing the extraction rules.",value:e.retain_mission??"",onChange:e=>t({retain_mission:e||null}),placeholder:n?"Inherited from default":"e.g. Always include technical decisions, API design choices, and architectural trade-offs.",rows:3}),i&&(0,ep.jsx)(jR,{label:"Custom Extraction Prompt",description:"Replaces the built-in extraction rules entirely. Only active when Extraction Mode is set to custom.",value:e.retain_custom_instructions??"",onChange:e=>t({retain_custom_instructions:e||null}),rows:5}),(0,ep.jsx)(jI,{label:"Free Form Entities",description:"Extract regular named entities (people, places, concepts) alongside entity labels. Disable to restrict extraction to entity labels only.",children:(0,ep.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,ep.jsx)(e6,{className:"text-sm text-muted-foreground cursor-pointer select-none",children:e.entities_allow_free_form??!0?"Enabled":"Disabled"}),(0,ep.jsx)(tL.Switch,{checked:e.entities_allow_free_form??!0,onCheckedChange:e=>t({entities_allow_free_form:e})})]})}),(0,ep.jsx)(jV,{value:e.entity_labels??[],onChange:e=>t({entity_labels:e.length>0?e:null})})]})}function jM(e){return e?Object.entries(e).map(([e,t],n)=>({id:n,name:e,values:{retain_extraction_mode:t.retain_extraction_mode??null,retain_chunk_size:t.retain_chunk_size??null,retain_mission:t.retain_mission??null,retain_custom_instructions:t.retain_custom_instructions??null,entities_allow_free_form:t.entities_allow_free_form??null,entity_labels:jw(t.entity_labels)}})):[]}function jP({defaultValues:e,onDefaultChange:t,strategies:n,onStrategiesChange:r}){let[i,a]=(0,em.useState)(()=>jM(n)),[o,s]=(0,em.useState)("default"),[l,c]=(0,em.useState)(null),u=(0,em.useRef)(!1),d=JSON.stringify(n);(0,em.useEffect)(()=>{if(u.current){u.current=!1;return}a(jM(n))},[d]);let h=e=>{u.current=!0,a(e),r(function(e){let t={};for(let n of e){if(!n.name.trim())continue;let e={};null!==n.values.retain_extraction_mode&&(e.retain_extraction_mode=n.values.retain_extraction_mode),null!==n.values.retain_chunk_size&&(e.retain_chunk_size=n.values.retain_chunk_size),n.values.retain_mission&&(e.retain_mission=n.values.retain_mission),n.values.retain_custom_instructions&&(e.retain_custom_instructions=n.values.retain_custom_instructions),null!==n.values.entities_allow_free_form&&(e.entities_allow_free_form=n.values.entities_allow_free_form),null!==n.values.entity_labels&&(e.entity_labels=n.values.entity_labels),t[n.name.trim()]=e}return Object.keys(t).length>0?t:null}(e))},f=(e,t)=>{h(i.map(n=>n.id===e?{...n,...t}:n))},p="default"!==o?i.find(e=>e.id===o):null;return(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"border-b border-border px-6 flex items-stretch gap-1 flex-wrap",children:[(0,ep.jsx)("button",{type:"button",onClick:()=>s("default"),className:`relative py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px ${"default"===o?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,children:"Default"}),i.map(e=>(0,ep.jsxs)("div",{className:`relative flex items-center gap-2 py-3 px-4 text-sm font-semibold transition-colors border-b-2 -mb-px cursor-pointer ${o===e.id?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,onClick:()=>s(e.id),children:[(0,ep.jsx)("span",{className:"font-mono",children:e.name||(0,ep.jsx)("span",{className:"italic font-normal opacity-50",children:"unnamed"})}),(0,ep.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),c(e)},className:"opacity-40 hover:opacity-100 hover:text-destructive transition-opacity text-base leading-none",children:"×"})]},e.id)),(0,ep.jsxs)("button",{type:"button",onClick:()=>{let e=Date.now();h([...i,{id:e,name:"",values:{retain_extraction_mode:null,retain_chunk_size:null,retain_mission:null,retain_custom_instructions:null,entities_allow_free_form:null,entity_labels:null}}]),s(e)},className:"py-3 px-3 text-sm text-muted-foreground hover:text-primary transition-colors flex items-center gap-1.5",children:[(0,ep.jsx)(fB.Plus,{className:"h-3.5 w-3.5"}),"Add strategy"]})]}),(0,ep.jsx)("div",{children:"default"===o?(0,ep.jsx)(jO,{values:e,onChange:t}):p?(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"px-6 py-3 flex items-center gap-3 border-b border-border/40",children:[(0,ep.jsx)("label",{className:"text-xs text-muted-foreground shrink-0",children:"Name"}),(0,ep.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,ep.jsx)(eL.Input,{value:p.name,onChange:e=>f(p.id,{name:e.target.value}),placeholder:"strategy name (e.g. fast)",className:`h-7 text-xs font-mono max-w-[200px] ${!p.name.trim()?"border-destructive focus-visible:ring-destructive":""}`}),!p.name.trim()&&(0,ep.jsx)("p",{className:"text-xs text-destructive",children:"Name is required"})]})]}),(0,ep.jsx)(jO,{values:p.values,onChange:e=>f(p.id,{values:{...p.values,...e}}),isOverride:!0})]}):null}),(0,ep.jsx)(mg,{open:null!==l,onOpenChange:e=>{e||c(null)},children:(0,ep.jsxs)(mP,{children:[(0,ep.jsxs)(mD,{children:[(0,ep.jsxs)(mI,{children:["Delete strategy “",l?.name||"unnamed","”?"]}),(0,ep.jsx)(mR,{children:"This will remove the strategy and all its overrides. This cannot be undone."})]}),(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mz,{children:"Cancel"}),(0,ep.jsx)(mB,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{if(l){var e;e=l.id,h(i.filter(t=>t.id!==e)),o===e&&s("default"),c(null)}},children:"Delete"})]})]})})]})}function jD({selected:e,onChange:t}){let n=new Set(e),r=jb.every(e=>n.has(e)),i=0===e.length;return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.length," of ",jb.length," tools enabled"]}),(0,ep.jsx)("button",{type:"button",onClick:()=>{t(r?[]:[...jb])},className:"text-xs text-primary hover:underline",children:r?"Deselect all":"Select all"})]}),(0,ep.jsx)("div",{className:"space-y-4",children:jy.map(e=>{let r=e.tools.filter(e=>n.has(e)).length===e.tools.length;return(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,ep.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e.label}),(0,ep.jsx)("button",{type:"button",onClick:()=>{let i=new Set(n);r?e.tools.forEach(e=>i.delete(e)):e.tools.forEach(e=>i.add(e)),t(jb.filter(e=>i.has(e)))},className:"text-xs text-primary hover:underline",children:r?"Deselect":"Select all"})]}),(0,ep.jsx)("div",{className:"flex flex-wrap gap-2",children:e.tools.map(e=>{let r=n.has(e);return(0,ep.jsx)("button",{type:"button",onClick:()=>{let r;(r=new Set(n)).has(e)?r.delete(e):r.add(e),t(jb.filter(e=>r.has(e)))},className:`px-2.5 py-1 rounded text-xs font-mono transition-colors border ${r?"bg-primary text-primary-foreground border-primary":"bg-muted/30 text-muted-foreground border-border/40 hover:border-primary/40"}`,children:e},e)})})]},e.label)})}),i&&(0,ep.jsx)("p",{className:"text-xs text-destructive",children:"Warning: no tools selected — agents will be blocked from all MCP calls for this bank."})]})}function jL({title:e,description:t,children:n,error:r,dirty:i,saving:a,onSave:o}){return(0,ep.jsxs)("section",{className:"space-y-3",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h2",{className:"text-lg font-semibold",children:e}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:t})]}),(0,ep.jsxs)(m8.Card,{className:"bg-muted/20 border-border/40",children:[(0,ep.jsx)("div",{className:"divide-y divide-border/40",children:n}),r&&(0,ep.jsx)("div",{className:"px-6 pb-2 pt-2",children:(0,ep.jsxs)(jf,{variant:"destructive",children:[(0,ep.jsx)(jm,{className:"h-4 w-4"}),(0,ep.jsx)(jp,{children:r})]})}),(0,ep.jsx)("div",{className:"px-6 py-4 flex justify-end border-t border-border/40",children:(0,ep.jsx)(eD.Button,{size:"sm",disabled:!i||a,onClick:o,children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tU.default,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):"Save changes"})})]})]})}function jI({label:e,description:t,children:n}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[(0,ep.jsxs)("div",{className:"flex-1",children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsx)("div",{className:"md:w-64 shrink-0",children:n})]})})}function jR({label:e,description:t,value:n,onChange:r,placeholder:i,rows:a}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsx)(gr.Textarea,{value:n,onChange:e=>r(e.target.value),placeholder:i,rows:a??3,className:"font-mono text-sm"})]})})}function jB({label:e,description:t,lowLabel:n,highLabel:r,value:i,onChange:a}){return(0,ep.jsx)("div",{className:"px-6 py-4",children:(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:e}),t&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[n&&(0,ep.jsx)("span",{className:"text-xs text-muted-foreground w-16 text-right shrink-0",children:n}),(0,ep.jsx)("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(e=>(0,ep.jsx)("button",{type:"button",onClick:()=>a(e),className:`w-4 h-4 rounded-full transition-colors hover:opacity-80 ${e<=i?"bg-primary":"bg-muted"}`},e))}),r&&(0,ep.jsx)("span",{className:"text-xs text-muted-foreground w-20 shrink-0",children:r}),(0,ep.jsxs)("span",{className:"text-xs font-mono text-muted-foreground ml-1 shrink-0",children:[i,"/5"]})]})]})})}let jz={text:"Text",value:"Single value","multi-values":"Multi-values",map:"Map"};function jF({fields:e,onChange:t,depth:n,extraControls:r,examplePrefix:i}){let[a,o]=(0,em.useState)({}),s=(n,r)=>{let i={};for(let[t,a]of Object.entries(e))i[t]=t===n?{...a,...r}:a;t(i)},l=0===n;return(0,ep.jsxs)("div",{className:l?"space-y-1.5 py-1":"space-y-1.5 py-1 ml-3 border-l-2 border-border/40 pl-3",children:[0===Object.keys(e).length&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No fields yet."}),Object.entries(e).map(([c,u],d)=>{let h="map"===u.type,f="value"===u.type||"multi-values"===u.type,p=a[d]??!0,g=h||f;return(0,ep.jsxs)("div",{className:"space-y-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[g?(0,ep.jsx)("button",{type:"button",onClick:()=>o(e=>({...e,[d]:!p})),className:"text-muted-foreground hover:text-foreground shrink-0 p-0.5 rounded hover:bg-muted/50",children:p?(0,ep.jsx)(mH.ChevronDown,{className:"h-3.5 w-3.5"}):(0,ep.jsx)(eS.ChevronRight,{className:"h-3.5 w-3.5"})}):(0,ep.jsx)("span",{className:"w-[18px] shrink-0"}),(0,ep.jsx)(eL.Input,{placeholder:"field name",value:c,onChange:n=>((n,r)=>{let i={};for(let[t,a]of Object.entries(e))i[t===n?r:t]=a;t(i)})(c,n.target.value),className:"h-7 text-xs font-mono w-28 shrink-0"}),(0,ep.jsx)(eL.Input,{placeholder:"extractor hint: what to extract",value:u.description,onChange:e=>s(c,{description:e.target.value}),className:"h-7 text-xs flex-1 min-w-0"}),(0,ep.jsxs)(tI.Select,{value:u.type,onValueChange:e=>s(c,{type:e,..."map"===e?{fields:u.fields??{},values:void 0}:{},..."text"===e?{fields:void 0,values:void 0}:{},..."value"===e||"multi-values"===e?{fields:void 0,values:u.values??[]}:{}}),children:[(0,ep.jsx)(tI.SelectTrigger,{className:"h-7 text-xs w-[120px] shrink-0 px-2 py-0",children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsx)(tI.SelectContent,{children:Object.entries(jz).map(([e,t])=>(0,ep.jsx)(tI.SelectItem,{value:e,className:"text-xs",children:t},e))})]}),r,(0,ep.jsx)("button",{type:"button",onClick:()=>{let n;return n={...e},void(delete n[c],t(n))},className:"text-muted-foreground hover:text-destructive shrink-0 p-0.5 rounded hover:bg-destructive/10",children:(0,ep.jsx)(mF,{className:"h-3.5 w-3.5"})})]}),l&&i&&c&&(0,ep.jsx)("div",{className:"ml-[18px] pl-1.5",children:(0,ep.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground/60 leading-none",children:"map"===u.type&&u.fields&&Object.keys(u.fields).length>0?`e.g. ${Object.keys(u.fields).slice(0,2).map(e=>`${i}:${e}:<value>`).join(", ")}`:"text"===u.type?`e.g. ${i}:<any text>`:(u.values?.length??0)>0?`e.g. ${i}:${u.values[0].value||"<value>"}`:`e.g. ${i}:<value>`})}),p&&h&&(0,ep.jsx)(jF,{fields:u.fields??{},onChange:e=>s(c,{fields:e}),depth:n+1,examplePrefix:i?`${i}:${c}`:void 0}),p&&f&&(0,ep.jsxs)("div",{className:"ml-6 space-y-0.5 py-1",children:[0===(u.values??[]).length&&(0,ep.jsx)("p",{className:"text-[11px] text-muted-foreground italic",children:"No values yet."}),(u.values??[]).map((e,t)=>(0,ep.jsxs)("div",{className:"flex items-center gap-1.5 group/val",children:[(0,ep.jsx)("span",{className:"text-muted-foreground/50 text-[10px] shrink-0",children:"•"}),(0,ep.jsx)(eL.Input,{placeholder:"value",value:e.value,onChange:n=>{let r=[...u.values??[]];r[t]={...e,value:n.target.value},s(c,{values:r})},className:"h-6 text-[11px] font-mono w-24 shrink-0 border-dashed"}),(0,ep.jsx)(eL.Input,{placeholder:"extractor hint: when to pick this value",value:e.description,onChange:n=>{let r=[...u.values??[]];r[t]={...e,description:n.target.value},s(c,{values:r})},className:"h-6 text-[11px] flex-1 min-w-0 border-dashed"}),(0,ep.jsx)("button",{type:"button",onClick:()=>{s(c,{values:(u.values??[]).filter((e,n)=>n!==t)})},className:"text-muted-foreground/40 hover:text-destructive shrink-0 p-0.5 rounded hover:bg-destructive/10 opacity-0 group-hover/val:opacity-100 transition-opacity",children:(0,ep.jsx)(mF,{className:"h-3 w-3"})})]},t)),(0,ep.jsxs)("button",{type:"button",onClick:()=>{s(c,{values:[...u.values??[],{value:"",description:""}]})},className:"text-[11px] text-muted-foreground/60 hover:text-foreground inline-flex items-center gap-1 ml-2.5",children:[(0,ep.jsx)(fB.Plus,{className:"h-2.5 w-2.5"}),"value"]})]})]},d)}),(0,ep.jsxs)("button",{type:"button",onClick:()=>{t({...e,"":{type:"text",description:""}})},className:"text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1",children:[(0,ep.jsx)(fB.Plus,{className:"h-3 w-3"}),"field"]})]})}function jV({value:e,onChange:t}){let n=(n,r)=>{t(e.map((e,t)=>t===n?{...e,...r}:e))};return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm font-medium",children:"Entity Labels"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Extracted per memory at retain time. Every field is optional — only filled when clearly applicable."})]}),e.length>0&&(0,ep.jsxs)("span",{className:"text-xs bg-primary/10 text-primary px-2 py-0.5 rounded-full shrink-0",children:[e.length," label",1!==e.length?"s":""]})]}),0===e.length&&(0,ep.jsx)("p",{className:"text-xs text-muted-foreground italic",children:"No entity labels defined."}),(0,ep.jsx)("div",{className:"space-y-2",children:e.map((r,i)=>(0,ep.jsx)("div",{className:"border border-border/50 rounded-md bg-background",children:(0,ep.jsx)(jF,{fields:{[r.key]:{type:r.type,description:r.description,values:r.values,fields:r.fields}},onChange:r=>{let a=Object.entries(r);if(0===a.length)t(e.filter((e,t)=>t!==i));else{let[e,t]=a[0];n(i,{key:e,type:t.type,description:t.description,values:t.values??[],fields:t.fields??{}})}},depth:0,extraControls:(0,ep.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0 cursor-pointer select-none",title:"Also store extracted values as tags on the memory (not just entities)",children:[(0,ep.jsx)(m1.Checkbox,{checked:r.tag,onCheckedChange:e=>n(i,{tag:!!e}),className:"h-4 w-4"}),"+ tag"]}),examplePrefix:r.key})},i))}),(0,ep.jsxs)("button",{type:"button",onClick:()=>{t([...e,{key:"",description:"",type:"value",optional:!0,tag:!1,values:[],fields:{}}])},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",children:[(0,ep.jsx)(fB.Plus,{className:"h-3.5 w-3.5"}),"Add label"]})]})}function jU({value:e,onChange:t}){let n=t=>e.find(e=>e.category===t)?.threshold??"BLOCK_MEDIUM_AND_ABOVE";return(0,ep.jsxs)("div",{className:"px-6 py-4 space-y-3",children:[(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:['Set the blocking threshold for each harm category. "Off" disables the filter entirely (default for Gemini 2.5+). Lower thresholds block more content.'," ",(0,ep.jsx)("a",{href:"https://ai.google.dev/gemini-api/docs/safety-settings",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:"Learn more"})]}),(0,ep.jsx)("div",{className:"space-y-2",children:jg.map(e=>(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,ep.jsx)("span",{className:"text-sm",children:e.label}),(0,ep.jsxs)(tI.Select,{value:n(e.value),onValueChange:r=>{var i;return i=e.value,void t(jg.map(e=>({category:e.value,threshold:e.value===i?r:n(e.value)})))},children:[(0,ep.jsx)(tI.SelectTrigger,{className:"w-48 h-8 text-xs",children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsx)(tI.SelectContent,{children:jv.map(e=>(0,ep.jsx)(tI.SelectItem,{value:e.value,className:"text-xs",children:e.label},e.value))})]})]},e.value))})]})}let jH=(0,ej.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),jW=(0,ej.default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),jY=(0,ej.default)("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);var jG=e.i(23287),jG=jG;let j$=(0,ej.default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),jX=(0,ej.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.i(34471);var jq=Symbol.for("immer-nothing"),jK=Symbol.for("immer-draftable"),jZ=Symbol.for("immer-state");function jQ(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var jJ=Object,j0=jJ.getPrototypeOf,j1="constructor",j2="prototype",j5="configurable",j3="enumerable",j4="writable",j6="value",j8=e=>!!e&&!!e[jZ];function j7(e){return!!e&&(Nt(e)||Ns(e)||!!e[jK]||!!e[j1]?.[jK]||Nl(e)||Nc(e))}var j9=jJ[j2][j1].toString(),Ne=new WeakMap;function Nt(e){if(!e||!Nu(e))return!1;let t=j0(e);if(null===t||t===jJ[j2])return!0;let n=jJ.hasOwnProperty.call(t,j1)&&t[j1];if(n===Object)return!0;if(!Nd(n))return!1;let r=Ne.get(n);return void 0===r&&(r=Function.toString.call(n),Ne.set(n,r)),r===j9}function Nn(e,t,n=!0){0===Nr(e)?(n?Reflect.ownKeys(e):jJ.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Nr(e){let t=e[jZ];return t?t.type_:Ns(e)?1:Nl(e)?2:3*!!Nc(e)}var Ni=(e,t,n=Nr(e))=>2===n?e.has(t):jJ[j2].hasOwnProperty.call(e,t),Na=(e,t,n=Nr(e))=>2===n?e.get(t):e[t],No=(e,t,n,r=Nr(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n},Ns=Array.isArray,Nl=e=>e instanceof Map,Nc=e=>e instanceof Set,Nu=e=>"object"==typeof e,Nd=e=>"function"==typeof e,Nh=e=>e.modified_?e.copy_:e.base_;function Nf(e,t){if(Nl(e))return new Map(e);if(Nc(e))return new Set(e);if(Ns(e))return Array[j2].slice.call(e);let n=Nt(e);if(!0!==t&&("class_only"!==t||n)){let t=j0(e);if(null!==t&&n)return{...e};let r=jJ.create(t);return jJ.assign(r,e)}{let t=jJ.getOwnPropertyDescriptors(e);delete t[jZ];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a[j4]&&(a[j4]=!0,a[j5]=!0),(a.get||a.set)&&(t[i]={[j5]:!0,[j4]:!0,[j3]:a[j3],[j6]:e[i]})}return jJ.create(j0(e),t)}}function Np(e,t=!1){return Ng(e)||j8(e)||!j7(e)||(Nr(e)>1&&jJ.defineProperties(e,{set:Nm,add:Nm,clear:Nm,delete:Nm}),jJ.freeze(e),t&&Nn(e,(e,t)=>{Np(t,!0)},!1)),e}var Nm={[j6]:function(){jQ(2)}};function Ng(e){return!(null!==e&&Nu(e))||jJ.isFrozen(e)}var Nv="MapSet",Nx="Patches",Ny="ArrayMethods",Nb={};function Nw(e){let t=Nb[e];return t||jQ(0,e),t}var Nj=e=>!!Nb[e];function NN(e,t){t&&(e.patchPlugin_=Nw(Nx),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Nk(e){NC(e),e.drafts_.forEach(N_),e.drafts_=null}function NC(e){e===I&&(I=e.parent_)}var NE=e=>I={drafts_:[],parent_:I,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Nj(Nv)?Nw(Nv):void 0,arrayMethodsPlugin_:Nj(Ny)?Nw(Ny):void 0};function N_(e){let t=e[jZ];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function NS(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(void 0!==e&&e!==n){n[jZ].modified_&&(Nk(t),jQ(4)),j7(e)&&(e=NT(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[jZ].base_,e,t)}else e=NT(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Np(t,n)}(t,e,!0),Nk(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==jq?e:void 0}function NT(e,t){if(Ng(t))return t;let n=t[jZ];if(!n)return NL(t,e.handledSet_,e);if(!NO(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);ND(n,e)}return n.copy_}function NA(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var NO=(e,t)=>e.scope_===t,NM=[];function NP(e,t,n,r){let i=e.copy_||e.base_,a=e.type_;if(void 0!==r&&Na(i,r,a)===t)return void No(i,r,n,a);if(!e.draftLocations_){let t=e.draftLocations_=new Map;Nn(i,(e,n)=>{if(j8(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}for(let r of e.draftLocations_.get(t)??NM)No(i,r,n,a)}function ND(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}NA(e)}}function NL(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||j8(e)||t.has(e)||!j7(e)||Ng(e)||(t.add(e),Nn(e,(r,i)=>{if(j8(i)){let t=i[jZ];NO(t,n)&&(No(e,r,Nh(t),e.type_),NA(t))}else j7(i)&&NL(i,t,n)})),e}var NI={get(e,t){let n;if(t===jZ)return e;let r=e.scope_.arrayMethodsPlugin_,i=1===e.type_&&"string"==typeof t;if(i&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);let a=e.copy_||e.base_;if(!Ni(a,t,e.type_)){var o;let n;return o=e,(n=Nz(a,t))?j6 in n?n[j6]:n.get?.call(o.draft_):void 0}let s=a[t];if(e.finalized_||!j7(s)||i&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&Number.isInteger(n=+t)&&String(n)===t)return s;if(s===NB(e.base_,t)){NV(e);let n=1===e.type_?+t:t,r=NU(e.scope_,s,e,n);return e.copy_[n]=r}return s},has:(e,t)=>t in(e.copy_||e.base_),ownKeys:e=>Reflect.ownKeys(e.copy_||e.base_),set(e,t,n){let r=Nz(e.copy_||e.base_,t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=NB(e.copy_||e.base_,t),i=r?.[jZ];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if((n===r?0!==n||1/n==1/r:n!=n&&r!=r)&&(void 0!==n||Ni(e.base_,t,e.type_)))return!0;NV(e),NF(e)}return!!(e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=n,e.assigned_.set(t,!0),!function(e,t,n){let{scope_:r}=e;if(j8(n)){let i=n[jZ];NO(i,r)&&i.callbacks_.push(function(){NV(e),NP(e,n,Nh(i),t)})}else j7(n)&&e.callbacks_.push(function(){let i=e.copy_||e.base_;3===e.type_?i.has(n)&&NL(n,r.handledSet_,r):Na(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&NL(Na(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n),!0)},deleteProperty:(e,t)=>(NV(e),void 0!==NB(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),NF(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=e.copy_||e.base_,r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[j4]:!0,[j5]:1!==e.type_||"length"!==t,[j3]:r[j3],[j6]:n[t]}:r},defineProperty(){jQ(11)},getPrototypeOf:e=>j0(e.base_),setPrototypeOf(){jQ(12)}},NR={};for(let e in NI){let t=NI[e];NR[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function NB(e,t){let n=e[jZ];return(n?n.copy_||n.base_:e)[t]}function Nz(e,t){if(!(t in e))return;let n=j0(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=j0(n)}}function NF(e){!e.modified_&&(e.modified_=!0,e.parent_&&NF(e.parent_))}function NV(e){e.copy_||(e.assigned_=new Map,e.copy_=Nf(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function NU(e,t,n,r){let[i,a]=Nl(t)?Nw(Nv).proxyMap_(t,n):Nc(t)?Nw(Nv).proxySet_(t,n):function(e,t){let n=Ns(e),r={type_:+!!n,scope_:t?t.scope_:I,modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=NI;n&&(i=[r],a=NR);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}(t,n);if((n?.scope_??I).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&void 0!==r)n.callbacks_.push(function(e){if(!a||!NO(a,e))return;e.mapSetPlugin_?.fixSetContents(a);let t=Nh(a);NP(n,a.draft_??a,t,r),ND(a,e)});else a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)});return i}function NH(e){return j8(e)||jQ(10,e),function e(t){let n;if(!j7(t)||Ng(t))return t;let r=t[jZ],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=Nf(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=Nf(t,!0);return Nn(n,(t,r)=>{No(n,t,e(r))},i),r&&(r.finalized_=!1),n}(e)}NR.deleteProperty=function(e,t){return NR.set.call(this,e,t,void 0)},NR.set=function(e,t,n){return NI.set.call(this,e[0],t,n,e[0])};var NW=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{let r;if(Nd(e)&&!Nd(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}if(Nd(t)||jQ(6),void 0===n||Nd(n)||jQ(7),j7(e)){let i=NE(this),a=NU(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Nk(i):NC(i)}return NN(i,n),NS(r,i)}if(e&&Nu(e))jQ(1,e);else{if(void 0===(r=t(e))&&(r=e),r===jq&&(r=void 0),this.autoFreeze_&&Np(r,!0),n){let t=[],i=[];Nw(Nx).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return Nd(e)?(t,...n)=>this.produceWithPatches(t,t=>e(t,...n)):[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},(e=>"boolean"==typeof e)(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),(e=>"boolean"==typeof e)(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),(e=>"boolean"==typeof e)(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){j7(e)||jQ(8),j8(e)&&(e=NH(e));let t=NE(this),n=NU(t,e,void 0);return n[jZ].isManual_=!0,NC(t),n}finishDraft(e,t){let n=e&&e[jZ];n&&n.isManual_||jQ(9);let{scope_:r}=n;return NN(r,t),NS(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Nw(Nx).applyPatches_;return j8(e)?r(e,t):this.produce(e,e=>r(e,t))}}().produce,NY=e=>Array.isArray(e)?e:[e],NG=0,N$=class{revision=NG;_value;_lastValue;_isEqual=NX;constructor(e,t=NX){this._value=this._lastValue=e,this._isEqual=t}get value(){return this._value}set value(e){this.value!==e&&(this._value=e,this.revision=++NG)}};function NX(e,t){return e===t}function Nq(e){return e instanceof N$||console.warn("Not a valid cell! ",e),e.value}var NK=(e,t)=>!1;function NZ(){return function(e=NX){return new N$(null,e)}(NK)}var NQ=e=>{let t=e.collectionTag;null===t&&(t=e.collectionTag=NZ()),Nq(t)};Symbol();var NJ=0,N0=Object.getPrototypeOf({}),N1=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy(this,N2);tag=NZ();tags={};children={};collectionTag=null;id=NJ++},N2={get:(e,t)=>(function(){let{value:n}=e,r=Reflect.get(n,t);if("symbol"==typeof t||t in N0)return r;if("object"==typeof r&&null!==r){var i;let n=e.children[t];return void 0===n&&(n=e.children[t]=Array.isArray(i=r)?new N5(i):new N1(i)),n.tag&&Nq(n.tag),n.proxy}{let n=e.tags[t];return void 0===n&&((n=e.tags[t]=NZ()).value=r),Nq(n),r}})(),ownKeys:e=>(NQ(e),Reflect.ownKeys(e.value)),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e.value,t),has:(e,t)=>Reflect.has(e.value,t)},N5=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy([this],N3);tag=NZ();tags={};children={};collectionTag=null;id=NJ++},N3={get:([e],t)=>("length"===t&&NQ(e),N2.get(e,t)),ownKeys:([e])=>N2.ownKeys(e),getOwnPropertyDescriptor:([e],t)=>N2.getOwnPropertyDescriptor(e,t),has:([e],t)=>N2.has(e,t)},N4="u">typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function N6(){return{s:0,v:void 0,o:null,p:null}}function N8(e,t={}){let n,r=N6(),{resultEqualityCheck:i}=t,a=0;function o(){let t,o=r,{length:s}=arguments;for(let e=0;e<s;e++){let t=arguments[e];if("function"==typeof t||"object"==typeof t&&null!==t){let e=o.o;null===e&&(o.o=e=new WeakMap);let n=e.get(t);void 0===n?(o=N6(),e.set(t,o)):o=n}else{let e=o.p;null===e&&(o.p=e=new Map);let n=e.get(t);void 0===n?(o=N6(),e.set(t,o)):o=n}}let l=o;if(1===o.s)t=o.v;else if(t=e.apply(null,arguments),a++,i){let e=n?.deref?.()??n;null!=e&&i(e,t)&&(t=e,0!==a&&a--),n="object"==typeof t&&null!==t||"function"==typeof t?new N4(t):t}return l.s=1,l.v=t,t}return o.clearCache=()=>{r=N6(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}var N7=function(e,...t){let n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r,i=0,a=0,o={},s=e.pop();"object"==typeof s&&(o=s,s=e.pop()),function(e,t=`expected a function, instead received ${typeof e}`){if("function"!=typeof e)throw TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);let{memoize:l,memoizeOptions:c=[],argsMemoize:u=N8,argsMemoizeOptions:d=[],devModeChecks:h={}}={...n,...o},f=NY(c),p=NY(d),g=(!function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){let n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw TypeError(`${t}[${n}]`)}}(t=Array.isArray(e[0])?e[0]:e,"createSelector expects all input-selectors to be functions, but received the following types: "),t),v=l(function(){return i++,s.apply(null,arguments)},...f);return Object.assign(u(function(){a++;let e=function(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}(g,arguments);return r=v.apply(null,e)},...p),{resultFunc:s,memoizedResultFunc:v,dependencies:g,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>r,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:l,argsMemoize:u})};return Object.assign(r,{withTypes:()=>r}),r}(N8),N9=Object.assign((e,t=N7)=>{!function(e,t=`expected an object, instead received ${typeof e}`){if("object"!=typeof e)throw TypeError(t)}(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>N9});function ke(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var kt="function"==typeof Symbol&&Symbol.observable||"@@observable",kn=()=>Math.random().toString(36).substring(7).split("").join("."),kr={INIT:`@@redux/INIT${kn()}`,REPLACE:`@@redux/REPLACE${kn()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${kn()}`};function ki(e){if("object"!=typeof e||null===e)return!1;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||null===Object.getPrototypeOf(e)}function ka(e){let t,n=Object.keys(e),r={};for(let t=0;t<n.length;t++){let i=n[t];"function"==typeof e[i]&&(r[i]=e[i])}let i=Object.keys(r);try{Object.keys(r).forEach(e=>{let t=r[e];if(void 0===t(void 0,{type:kr.INIT}))throw Error(ke(12));if(void 0===t(void 0,{type:kr.PROBE_UNKNOWN_ACTION()}))throw Error(ke(13))})}catch(e){t=e}return function(e={},n){if(t)throw t;let a=!1,o={};for(let t=0;t<i.length;t++){let s=i[t],l=r[s],c=e[s],u=l(c,n);if(void 0===u)throw n&&n.type,Error(ke(14));o[s]=u,a=a||u!==c}return(a=a||i.length!==Object.keys(e).length)?o:e}}function ko(...e){return 0===e.length?e=>e:1===e.length?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function ks(e){return ki(e)&&"type"in e&&"string"==typeof e.type}function kl(e){return({dispatch:t,getState:n})=>r=>i=>"function"==typeof i?i(t,n,e):r(i)}var kc=kl(),ku="u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!=arguments.length)return"object"==typeof arguments[0]?ko:ko.apply(null,arguments)};function kd(e,t){function n(...r){if(t){let n=t(...r);if(!n)throw Error(k0(0));return{type:e,payload:n.payload,..."meta"in n&&{meta:n.meta},..."error"in n&&{error:n.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>ks(t)&&t.type===e,n}"u">typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var kh=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return 1===t.length&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function kf(e){return j7(e)?NW(e,()=>{}):e}function kp(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}var km="RTK_autoBatch",kg=()=>e=>({payload:e,meta:{[km]:!0}}),kv=e=>t=>{setTimeout(t,e)},kx=(e={type:"raf"})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,l="tick"===e.type?queueMicrotask:"raf"===e.type?"u">typeof window&&window.requestAnimationFrame?window.requestAnimationFrame:kv(10):"callback"===e.type?e.queueNotification:kv(e.timeout),c=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return(a=!(i=!e?.meta?.[km]))&&!o&&(o=!0,l(c)),r.dispatch(e)}finally{i=!0}}})};function ky(e){let t,n={},r=[],i={addCase(e,t){let r="string"==typeof e?e:e.type;if(!r)throw Error(k0(28));if(r in n)throw Error(k0(29));return n[r]=t,i},addAsyncThunk:(e,t)=>(t.pending&&(n[e.pending.type]=t.pending),t.rejected&&(n[e.rejected.type]=t.rejected),t.fulfilled&&(n[e.fulfilled.type]=t.fulfilled),t.settled&&r.push({matcher:e.settled,reducer:t.settled}),i),addMatcher:(e,t)=>(r.push({matcher:e,reducer:t}),i),addDefaultCase:e=>(t=e,i)};return e(i),[n,r,t]}var kb=Symbol.for("rtk-slice-createasyncthunk"),kw=((c=kw||{}).reducer="reducer",c.reducerWithPrepare="reducerWithPrepare",c.asyncThunk="asyncThunk",c),kj=function({creators:e}={}){let t=e?.asyncThunk?.[kb];return function(e){let n,{name:r,reducerPath:i=r}=e;if(!r)throw Error(k0(11));let a=("function"==typeof e.reducers?e.reducers(function(){function e(e,t){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer:e=>Object.assign({[e.name]:(...t)=>e(...t)}[e.name],{_reducerDefinitionType:"reducer"}),preparedReducer:(e,t)=>({_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:t}),asyncThunk:e}}()):e.reducers)||{},o=Object.keys(a),s={},l={},c={},u=[],d={addCase(e,t){let n="string"==typeof e?e:e.type;if(!n)throw Error(k0(12));if(n in l)throw Error(k0(13));return l[n]=t,d},addMatcher:(e,t)=>(u.push({matcher:e,reducer:t}),d),exposeAction:(e,t)=>(c[e]=t,d),exposeCaseReducer:(e,t)=>(s[e]=t,d)};function h(){let[t={},n=[],r]="function"==typeof e.extraReducers?ky(e.extraReducers):[e.extraReducers],i={...t,...l};return function(e,t){let n,[r,i,a]=ky(t);if("function"==typeof e)n=()=>kf(e());else{let t=kf(e);n=()=>t}function o(e=n(),t){let s=[r[t.type],...i.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return 0===s.filter(e=>!!e).length&&(s=[a]),s.reduce((e,n)=>{if(n)if(j8(e)){let r=n(e,t);return void 0===r?e:r}else{if(j7(e))return NW(e,e=>n(e,t));let r=n(e,t);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return e},e)}return o.getInitialState=n,o}(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of u)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}o.forEach(n=>{let i=a[n],o={reducerName:n,type:`${r}/${n}`,createNotation:"function"==typeof e.reducers};"asyncThunk"===i._reducerDefinitionType?function({type:e,reducerName:t},n,r,i){if(!i)throw Error(k0(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:c,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),l&&r.addCase(d.rejected,l),c&&r.addMatcher(d.settled,c),r.exposeCaseReducer(t,{fulfilled:o||kN,pending:s||kN,rejected:l||kN,settled:c||kN})}(o,i,d,t):function({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&"reducerWithPrepare"!==r._reducerDefinitionType)throw Error(k0(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?kd(e,o):kd(e))}(o,i,d)});let f=e=>e,p=new Map,g=new WeakMap;function v(e,t){return n||(n=h()),n(e,t)}function x(){return n||(n=h()),n.getInitialState()}function y(t,n=!1){function r(e){let i=e[t];return void 0===i&&n&&(i=kp(g,r,x)),i}function i(t=f){let r=kp(p,n,()=>new WeakMap);return kp(r,t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=function(e,t,n,r){function i(a,...o){let s=t(a);return void 0===s&&r&&(s=n()),e(s,...o)}return i.unwrapped=e,i}(a,t,()=>kp(g,t,x),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let b={name:r,reducer:v,actions:c,caseReducers:s,getInitialState:x,...y(i),injectInto(e,{reducerPath:t,...n}={}){let r=t??i;return e.inject({reducerPath:r,reducer:v},n),{...b,...y(r,!0)}}};return b}}();function kN(){}var kk="listener",kC="completed",kE="cancelled",k_=`task-${kE}`,kS=`task-${kC}`,kT=`${kk}-${kE}`,kA=`${kk}-${kC}`,kO=class{constructor(e){this.code=e,this.message=`task ${kE} (reason: ${e})`}name="TaskAbortError";message},kM=(e,t)=>{if("function"!=typeof e)throw TypeError(k0(32))},kP=()=>{},kD=(e,t=kP)=>(e.catch(t),e),kL=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),kI=e=>{if(e.aborted)throw new kO(e.reason)};function kR(e,t){let n=kP;return new Promise((r,i)=>{let a=()=>i(new kO(e.reason));e.aborted?a():(n=kL(e,a),t.finally(()=>n()).then(r,i))}).finally(()=>{n=kP})}var kB=async(e,t)=>{try{await Promise.resolve();let t=await e();return{status:"ok",value:t}}catch(e){return{status:e instanceof kO?"cancelled":"rejected",error:e}}finally{t?.()}},kz=e=>t=>kD(kR(e,t).then(t=>(kI(e),t))),kF=e=>{let t=kz(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:kV}=Object,kU={},kH="listenerMiddleware",kW=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=kd(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(i);else throw Error(k0(21));return kM(a,"options.listener"),{predicate:i,type:t,effect:a}},kY=kV(e=>{let{type:t,predicate:n,effect:r}=kW(e);return{id:((e=21)=>{let t="",n=e;for(;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t})(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(k0(22))}}},{withTypes:()=>kY}),kG=(e,t)=>{let{type:n,effect:r,predicate:i}=kW(t);return Array.from(e.values()).find(e=>("string"==typeof n?e.type===n:e.predicate===i)&&e.effect===r)},k$=e=>{e.pending.forEach(e=>{e.abort(kT)})},kX=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},kq=kV(kd(`${kH}/add`),{withTypes:()=>kq}),kK=kd(`${kH}/removeAll`),kZ=kV(kd(`${kH}/remove`),{withTypes:()=>kZ}),kQ=(...e)=>{console.error(`${kH}/error`,...e)},kJ=(e={})=>{let t=new Map,n=new Map,{extra:r,onError:i=kQ}=e;kM(i,"onError");let a=e=>{var n;return(n=kG(t,e)??kY(e)).unsubscribe=()=>t.delete(n.id),t.set(n.id,n),e=>{n.unsubscribe(),e?.cancelActive&&k$(n)}};kV(a,{withTypes:()=>a});let o=e=>{let n=kG(t,e);return n&&(n.unsubscribe(),e.cancelActive&&k$(n)),!!n};kV(o,{withTypes:()=>o});let s=async(e,o,s,l)=>{var c,u;let d,h=new AbortController,f=(c=h.signal,d=async(e,t)=>{kI(c);let n=()=>{},r=[new Promise((t,r)=>{let i=a({predicate:e,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});n=()=>{i(),r()}})];null!=t&&r.push(new Promise(e=>setTimeout(e,t,null)));try{let e=await kR(c,Promise.race(r));return kI(c),e}finally{n()}},(e,t)=>kD(d(e,t))),p=[];try{let i;e.pending.add(h),i=n.get(e)??0,n.set(e,i+1),await Promise.resolve(e.effect(o,kV({},s,{getOriginalState:l,condition:(e,t)=>f(e,t).then(Boolean),take:f,delay:kF(h.signal),pause:kz(h.signal),extra:r,signal:h.signal,fork:(u=h.signal,(e,t)=>{kM(e,"taskExecutor");let n=new AbortController;kL(u,()=>n.abort(u.reason));let r=kB(async()=>{kI(u),kI(n.signal);let t=await e({pause:kz(n.signal),delay:kF(n.signal),signal:n.signal});return kI(n.signal),t},()=>n.abort(kS));return t?.autoJoin&&p.push(r.catch(kP)),{result:kz(u)(r),cancel(){n.abort(k_)}}}),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==h&&(e.abort(kT),n.delete(e))})},cancel:()=>{h.abort(kT),e.pending.delete(h)},throwIfCancelled:()=>{kI(h.signal)}})))}catch(e){e instanceof kO||kX(i,e,{raisedBy:"effect"})}finally{let t;await Promise.all(p),h.abort(kA),1===(t=n.get(e)??1)?n.delete(e):n.set(e,t-1),e.pending.delete(h)}},l=()=>{for(let e of n.keys())k$(e);t.clear()};return{middleware:e=>n=>r=>{let c;if(!ks(r))return n(r);if(kq.match(r))return a(r.payload);if(kK.match(r))return void l();if(kZ.match(r))return o(r.payload);let u=e.getState(),d=()=>{if(u===kU)throw Error(k0(23));return u};try{if(c=n(r),t.size>0){let n=e.getState();for(let a of Array.from(t.values())){let t=!1;try{t=a.predicate(r,n,u)}catch(e){t=!1,kX(i,e,{raisedBy:"predicate"})}t&&s(a,r,e,d)}}}finally{u=kU}return c},startListening:a,stopListening:o,clearListeners:l}};function k0(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}Symbol.for("rtk-state-proxy-original");var k1=e.i(92068);function k2(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function k5(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.reduce((e,t,r)=>{var i=n[r-1];return"string"==typeof i?e+i+t:void 0!==i?e+k2(i)+t:e+t},"")}var k3=e=>0===e?0:e>0?1:-1,k4=e=>"number"==typeof e&&e!=+e,k6=e=>"string"==typeof e&&e.indexOf("%")===e.length-1,k8=e=>("number"==typeof e||e instanceof Number)&&!k4(e),k7=e=>k8(e)||"string"==typeof e,k9=0,Ce=e=>{var t=++k9;return"".concat(e||"").concat(t)},Ct=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!k8(e)&&"string"!=typeof e)return r;if(k6(e)){if(null==t)return r;var a=e.indexOf("%");n=t*parseFloat(e.slice(0,a))/100}else n=+e;return k4(n)&&(n=r),i&&null!=t&&n>t&&(n=t),n},Cn=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(n[String(e[r])])return!0;else n[String(e[r])]=!0;return!1};function Cr(e,t,n){return k8(e)&&k8(t)?k2(e+n*(t-e)):t}function Ci(e,t,n){if(e&&e.length)return e.find(e=>e&&("function"==typeof t?t(e):(0,k1.default)(e,t))===n)}var Ca=e=>null==e?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function Co(e){return null!=e}function Cs(){}function Cl(e,t){if(t){var n=Number.parseInt(t,10);if(!k4(n))return null==e?void 0:e[n]}}var Cc=kj({name:"options",initialState:{chartName:"",tooltipPayloadSearcher:void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},reducers:{createEventEmitter:e=>{null==e.eventEmitter&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),Cu=Cc.reducer,{createEventEmitter:Cd}=Cc.actions,Ch=(e.i(13027),{notify(){},get:()=>[]}),Cf="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Cp="u">typeof navigator&&"ReactNative"===navigator.product,Cm=Cf||Cp?em.useLayoutEffect:em.useEffect;function Cg(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}var Cv=Symbol.for("react-redux-context"),Cx="u">typeof globalThis?globalThis:{},Cy=function(){if(!em.createContext)return{};let e=Cx[Cv]??=new Map,t=e.get(em.createContext);return t||(t=em.createContext(null),e.set(em.createContext,t)),t}(),Cb=function(e){let{children:t,context:n,serverState:r,store:i}=e,a=em.useMemo(()=>{let e=function(e){let t,n=Ch,r=0,i=!1;function a(){l.onStateChange&&l.onStateChange()}function o(){if(r++,!t){let r,i;t=e.subscribe(a),r=null,i=null,n={clear(){r=null,i=null},notify(){let e=r;for(;e;)e.callback(),e=e.next},get(){let e=[],t=r;for(;t;)e.push(t),t=t.next;return e},subscribe(e){let t=!0,n=i={callback:e,next:null,prev:i};return n.prev?n.prev.next=n:r=n,function(){t&&null!==r&&(t=!1,n.next?n.next.prev=n.prev:i=n.prev,n.prev?n.prev.next=n.next:r=n.next)}}}}}function s(){r--,t&&0===r&&(t(),t=void 0,n.clear(),n=Ch)}let l={addNestedSub:function(e){o();let t=n.subscribe(e),r=!1;return()=>{r||(r=!0,t(),s())}},notifyNestedSubs:function(){n.notify()},handleChangeWrapper:a,isSubscribed:function(){return i},trySubscribe:function(){i||(i=!0,o())},tryUnsubscribe:function(){i&&(i=!1,s())},getListeners:()=>n};return l}(i);return{store:i,subscription:e,getServerState:r?()=>r:void 0}},[i,r]),o=em.useMemo(()=>i.getState(),[i]);return Cm(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]),em.createElement((n||Cy).Provider,{value:a},t)};function Cw(e=Cy){return function(){return em.useContext(e)}}var Cj=Cw(),CN=Symbol.for("immer-nothing"),Ck=Symbol.for("immer-draftable"),CC=Symbol.for("immer-state");function CE(e){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var C_=Object.getPrototypeOf;function CS(e){return!!e&&!!e[CC]}function CT(e){return!!e&&(CM(e)||Array.isArray(e)||!!e[Ck]||!!e.constructor?.[Ck]||CR(e)||CB(e))}var CA=Object.prototype.constructor.toString(),CO=new WeakMap;function CM(e){if(!e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;let n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if("function"!=typeof n)return!1;let r=CO.get(n);return void 0===r&&(r=Function.toString.call(n),CO.set(n,r)),r===CA}function CP(e,t,n=!0){0===CD(e)?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function CD(e){let t=e[CC];return t?t.type_:Array.isArray(e)?1:CR(e)?2:3*!!CB(e)}function CL(e,t){return 2===CD(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function CI(e,t,n){let r=CD(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function CR(e){return e instanceof Map}function CB(e){return e instanceof Set}function Cz(e){return e.copy_||e.base_}function CF(e,t){if(CR(e))return new Map(e);if(CB(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=CM(e);if(!0!==t&&("class_only"!==t||n)){let t=C_(e);return null!==t&&n?{...e}:Object.assign(Object.create(t),e)}{let t=Object.getOwnPropertyDescriptors(e);delete t[CC];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(C_(e),t)}}function CV(e,t=!1){return CH(e)||CS(e)||!CT(e)||(CD(e)>1&&Object.defineProperties(e,{set:CU,add:CU,clear:CU,delete:CU}),Object.freeze(e),t&&Object.values(e).forEach(e=>CV(e,!0))),e}var CU={value:function(){CE(2)}};function CH(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var CW={};function CY(e){let t=CW[e];return t||CE(0,e),t}function CG(e,t){t&&(CY("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function C$(e){CX(e),e.drafts_.forEach(CK),e.drafts_=null}function CX(e){e===R&&(R=e.parent_)}function Cq(e){return R={drafts_:[],parent_:R,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function CK(e){let t=e[CC];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function CZ(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return void 0!==e&&e!==n?(n[CC].modified_&&(C$(t),CE(4)),CT(e)&&(e=CQ(t,e),t.parent_||C0(t,e)),t.patches_&&CY("Patches").generateReplacementPatches_(n[CC].base_,e,t.patches_,t.inversePatches_)):e=CQ(t,n,[]),C$(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==CN?e:void 0}function CQ(e,t,n){if(CH(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[CC];if(!i)return CP(t,(r,a)=>CJ(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return C0(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,o=!1;3===i.type_&&(a=new Set(t),t.clear(),o=!0),CP(a,(r,a)=>CJ(e,i,t,r,a,n,o),r),C0(e,t,!1),n&&e.patches_&&CY("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function CJ(e,t,n,r,i,a,o){if(null==i||"object"!=typeof i&&!o)return;let s=CH(i);if(!s||o){if(CS(i)){let o=CQ(e,i,a&&t&&3!==t.type_&&!CL(t.assigned_,r)?a.concat(r):void 0);if(CI(n,r,o),!CS(o))return;e.canAutoFreeze_=!1}else o&&n.add(i);if(CT(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;CQ(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof r&&(CR(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&C0(e,i)}}}function C0(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&CV(t,n)}var C1={get(e,t){if(t===CC)return e;let n=Cz(e);if(!CL(n,t)){var r;let i;return r=e,(i=C3(n,t))?"value"in i?i.value:i.get?.call(r.draft_):void 0}let i=n[t];return e.finalized_||!CT(i)?i:i===C5(e.base_,t)?(C6(e),e.copy_[t]=C7(i,e)):i},has:(e,t)=>t in Cz(e),ownKeys:e=>Reflect.ownKeys(Cz(e)),set(e,t,n){let r=C3(Cz(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=C5(Cz(e),t),i=r?.[CC];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if((n===r?0!==n||1/n==1/r:n!=n&&r!=r)&&(void 0!==n||CL(e.base_,t)))return!0;C6(e),C4(e)}return!!(e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t]))||(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty:(e,t)=>(void 0!==C5(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,C6(e),C4(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){let n=Cz(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){CE(11)},getPrototypeOf:e=>C_(e.base_),setPrototypeOf(){CE(12)}},C2={};function C5(e,t){let n=e[CC];return(n?Cz(n):e)[t]}function C3(e,t){if(!(t in e))return;let n=C_(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=C_(n)}}function C4(e){!e.modified_&&(e.modified_=!0,e.parent_&&C4(e.parent_))}function C6(e){e.copy_||(e.copy_=CF(e.base_,e.scope_.immer_.useStrictShallowCopy_))}CP(C1,(e,t)=>{C2[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),C2.deleteProperty=function(e,t){return C2.set.call(this,e,t,void 0)},C2.set=function(e,t,n){return C1.set.call(this,e[0],t,n,e[0])};var C8=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{let r;if("function"==typeof e&&"function"!=typeof t){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}if("function"!=typeof t&&CE(6),void 0!==n&&"function"!=typeof n&&CE(7),CT(e)){let i=Cq(this),a=C7(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?C$(i):CX(i)}return CG(i,n),CZ(r,i)}if(e&&"object"==typeof e)CE(1,e);else{if(void 0===(r=t(e))&&(r=e),r===CN&&(r=void 0),this.autoFreeze_&&CV(r,!0),n){let t=[],i=[];CY("Patches").generateReplacementPatches_(e,r,t,i),n(t,i)}return r}},this.produceWithPatches=(e,t)=>{let n,r;return"function"==typeof e?(t,...n)=>this.produceWithPatches(t,t=>e(t,...n)):[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){var t;CT(e)||CE(8),CS(e)&&(CS(t=e)||CE(10,t),e=function e(t){let n;if(!CT(t)||CH(t))return t;let r=t[CC],i=!0;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=CF(t,r.scope_.immer_.useStrictShallowCopy_),i=r.scope_.immer_.shouldUseStrictIteration()}else n=CF(t,!0);return CP(n,(t,r)=>{CI(n,t,e(r))},i),r&&(r.finalized_=!1),n}(t));let n=Cq(this),r=C7(e,void 0);return r[CC].isManual_=!0,CX(n),r}finishDraft(e,t){let n=e&&e[CC];n&&n.isManual_||CE(9);let{scope_:r}=n;return CG(r,t),CZ(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=CY("Patches").applyPatches_;return CS(e)?r(e,t):this.produce(e,e=>r(e,t))}};function C7(e,t){let n=CR(e)?CY("MapSet").proxyMap_(e,t):CB(e)?CY("MapSet").proxySet_(e,t):function(e,t){let n=Array.isArray(e),r={type_:+!!n,scope_:t?t.scope_:R,modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=C1;n&&(i=[r],a=C2);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}(e,t);return(t?t.scope_:R).drafts_.push(n),n}new C8().produce;var C9={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Ee=kj({name:"tooltip",initialState:{itemInteraction:{click:C9,hover:C9},axisInteraction:{click:C9,hover:C9},keyboardInteraction:C9,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:kg()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NH(e).tooltipItemPayloads.indexOf(n);i>-1&&(e.tooltipItemPayloads[i]=r)},prepare:kg()},removeTooltipEntrySettings:{reducer(e,t){var n=NH(e).tooltipItemPayloads.indexOf(t.payload);n>-1&&e.tooltipItemPayloads.splice(n,1)},prepare:kg()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:Et,replaceTooltipEntrySettings:En,removeTooltipEntrySettings:Er,setTooltipSettingsState:Ei,setActiveMouseOverItemIndex:Ea,mouseLeaveItem:Eo,mouseLeaveChart:Es,setActiveClickItemIndex:El,setMouseOverAxisIndex:Ec,setMouseClickAxisIndex:Eu,setSyncInteraction:Ed,setKeyboardInteraction:Eh}=Ee.actions,Ef=Ee.reducer,Ep=kj({name:"chartData",initialState:{chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},reducers:{setChartData(e,t){if(e.chartData=t.payload,null==t.payload){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:n,endIndex:r}=t.payload;null!=n&&(e.dataStartIndex=n),null!=r&&(e.dataEndIndex=r)}}}),{setChartData:Em,setDataStartEndIndexes:Eg,setComputedData:Ev}=Ep.actions,Ex=Ep.reducer,Ey=kj({name:"chartLayout",initialState:{layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=null!=(n=t.payload.top)?n:0,e.margin.right=null!=(r=t.payload.right)?r:0,e.margin.bottom=null!=(i=t.payload.bottom)?i:0,e.margin.left=null!=(a=t.payload.left)?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:Eb,setLayout:Ew,setChartSize:Ej,setScale:EN}=Ey.actions,Ek=Ey.reducer,EC=e.i(30224),EE=(0,em.createContext)(null),E_=e=>e,ES=()=>{var e=(0,em.useContext)(EE);return e?e.store.dispatch:E_},ET=()=>{},EA=()=>ET,EO=(e,t)=>e===t;function EM(e){var t=(0,em.useContext)(EE);return(0,EC.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:EA,t?t.store.getState:ET,t?t.store.getState:ET,t?e:ET,EO)}var EP=e.i(42342),ED=e=>e.legend.settings;function EL(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function EI(e){return function(){return e}}function ER(e,t){if((i=e.length)>1)for(var n,r,i,a=1,o=e[t[0]],s=o.length;a<i;++a)for(r=o,o=e[t[a]],n=0;n<s;++n)o[n][1]+=o[n][0]=isNaN(r[n][1])?r[n][0]:r[n][1]}function EB(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function Ez(e,t){return e[t]}function EF(e){let t=[];return t.key=e,t}function EV(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function EU(e){return Number.isFinite(e)}function EH(e){return"number"==typeof e&&e>0&&Number.isFinite(e)}function EW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function EY(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?EW(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EW(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function EG(e,t,n){return null==e||null==t?n:k7(t)?(0,k1.default)(e,t,n):"function"==typeof t?t(e):n}N7([e=>e.legend.payload,ED],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?(0,EP.default)(r,n):r}),Array.prototype.slice;var E$=(e,t)=>"horizontal"===e&&"xAxis"===t||"vertical"===e&&"yAxis"===t||"centric"===e&&"angleAxis"===t||"radial"===e&&"radiusAxis"===t,EX=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},Eq=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:l,categoricalDomain:c,tickCount:u,ticks:d,niceTicks:h,axisType:f}=e;if(!o)return null;var p="scaleBand"===s&&o.bandwidth?o.bandwidth()/2:2,g=(t||n)&&"category"===i&&o.bandwidth?o.bandwidth()/p:0;return(g="angleAxis"===f&&a&&a.length>=2?2*k3(a[0]-a[1])*g:g,t&&(d||h))?(d||h||[]).map((e,t)=>({coordinate:o(r?r.indexOf(e):e)+g,value:e,offset:g,index:t})).filter(e=>!k4(e.coordinate)):l&&c?c.map((e,t)=>({coordinate:o(e)+g,value:e,index:t,offset:g})):o.ticks&&!n&&null!=u?o.ticks(u).map((e,t)=>({coordinate:o(e)+g,value:e,offset:g,index:t})):o.domain().map((e,t)=>({coordinate:o(e)+g,value:r?r[e]:e,index:t,offset:g}))},EK={sign:e=>{var t,n=e.length;if(!(n<=0)){var r=null==(t=e[0])?void 0:t.length;if(null!=r&&!(r<=0))for(var i=0;i<r;++i)for(var a=0,o=0,s=0;s<n;++s){var l=e[s],c=null==l?void 0:l[i];if(null!=c){var u=c[1],d=c[0],h=k4(u)?d:u;h>=0?(c[0]=a,c[1]=a+h,a=u):(c[0]=o,c[1]=o+h,o=u)}}}},expand:function(e,t){if((r=e.length)>0){for(var n,r,i,a=0,o=e[0].length;a<o;++a){for(i=n=0;n<r;++n)i+=e[n][a][1]||0;if(i)for(n=0;n<r;++n)e[n][a][1]/=i}ER(e,t)}},none:ER,silhouette:function(e,t){if((n=e.length)>0){for(var n,r=0,i=e[t[0]],a=i.length;r<a;++r){for(var o=0,s=0;o<n;++o)s+=e[o][r][1]||0;i[r][1]+=i[r][0]=-s/2}ER(e,t)}},wiggle:function(e,t){if((i=e.length)>0&&(r=(n=e[t[0]]).length)>0){for(var n,r,i,a=0,o=1;o<r;++o){for(var s=0,l=0,c=0;s<i;++s){for(var u=e[t[s]],d=u[o][1]||0,h=(d-(u[o-1][1]||0))/2,f=0;f<s;++f){var p=e[t[f]];h+=(p[o][1]||0)-(p[o-1][1]||0)}l+=d,c+=h*d}n[o-1][1]+=n[o-1][0]=a,l&&(a-=c/l)}n[o-1][1]+=n[o-1][0]=a,ER(e,t)}},positive:e=>{var t,n=e.length;if(!(n<=0)){var r=null==(t=e[0])?void 0:t.length;if(null!=r&&!(r<=0))for(var i=0;i<r;++i)for(var a=0,o=0;o<n;++o){var s=e[o],l=null==s?void 0:s[i];if(null!=l){var c=k4(l[1])?l[0]:l[1];c>=0?(l[0]=a,l[1]=a+c,a=l[1]):(l[0]=0,l[1]=0)}}}}};function EZ(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if("category"===t.type){if(!t.allowDuplicatedCategory&&t.dataKey&&null!=i[t.dataKey]){var s=Ci(n,"value",i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var l=EG(i,null==o?t.dataKey:o);return null==l?null:t.scale(l)}var EQ=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,EJ=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,E0=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,EP.default)(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var l=i[o],c=i[o-1];a=Math.min(((null==l?void 0:l.coordinate)||0)-((null==c?void 0:c.coordinate)||0),a)}return a===1/0?0:a}return n?void 0:0};function E1(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return EY(EY({},t),{},{dataKey:n,payload:r,value:i,name:a})}function E2(e,t){return e?String(e):"string"==typeof t?t:void 0}var E5=e=>e.layout.width,E3=e=>e.layout.height,E4=e=>e.layout.scale,E6=e=>e.layout.margin,E8=N7(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),E7=N7(e=>e.cartesianAxis.yAxis,e=>Object.values(e));function E9(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?E9(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E9(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var _t=N7([E5,E3,E6,e=>e.brush.height,function(e){return E7(e).reduce((e,t)=>"left"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return E7(e).reduce((e,t)=>"right"!==t.orientation||t.mirror||t.hide?e:e+("number"==typeof t.width?t.width:60),0)},function(e){return E8(e).reduce((e,t)=>"top"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},function(e){return E8(e).reduce((e,t)=>"bottom"!==t.orientation||t.mirror||t.hide?e:e+t.height,0)},ED,e=>e.legend.size],(e,t,n,r,i,a,o,s,l,c)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=_e(_e({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),h=d.bottom;d.bottom+=r;var f=e-(d=((e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if(("vertical"===s||"horizontal"===s&&"middle"===o)&&"center"!==a&&k8(e[a]))return EY(EY({},e),{},{[a]:e[a]+(r||0)});if(("horizontal"===s||"vertical"===s&&"center"===a)&&"middle"!==o&&k8(e[o]))return EY(EY({},e),{},{[o]:e[o]+(i||0)})}return e})(d,l,c)).left-d.right,p=t-d.top-d.bottom;return _e(_e({brushBottom:h},d),{},{width:Math.max(f,0),height:Math.max(p,0)})}),_n=N7(_t,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),_r=N7(E5,E3,(e,t)=>({x:0,y:0,width:e,height:t})),_i=(0,em.createContext)(null),_a=()=>null!=(0,em.useContext)(_i),_o=e=>e.brush,_s=N7([_o,_t,E6],(e,t,n)=>({height:e.height,x:k8(e.x)?e.x:t.left,y:k8(e.y)?e.y:t.top+t.height+t.brushBottom-((null==n?void 0:n.bottom)||0),width:k8(e.width)?e.width:t.width})),_l=e.i(7670),_c=e.i(58723),_u=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if("u">typeof console&&console.warn&&(void 0===t&&console.warn("LogUtils requires an error message argument"),!e))if(void 0===t)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;console.warn(t.replace(/%s/g,()=>r[a++]))}},_d=(e,t,n)=>{var{width:r="100%",height:i="100%",aspect:a,maxHeight:o}=n,s=k6(r)?e:Number(r),l=k6(i)?t:Number(i);return a&&a>0&&(s?l=s/a:l&&(s=l*a),o&&null!=l&&l>o&&(l=o)),{calculatedWidth:s,calculatedHeight:l}},_h={width:0,height:0,overflow:"visible"},_f={width:0,overflowX:"visible"},_p={height:0,overflowY:"visible"},_m={};function _g(){return(_g=Object.assign.bind()).apply(null,arguments)}function _v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_v(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_v(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var _y=(0,em.createContext)({width:-1,height:-1});function _b(e){var{children:t,width:n,height:r}=e,i=(0,em.useMemo)(()=>({width:n,height:r}),[n,r]);return EH(i.width)&&EH(i.height)?em.createElement(_y.Provider,{value:i},t):null}var _w=()=>(0,em.useContext)(_y),_j=(0,em.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r={width:-1,height:-1},width:i,height:a,minWidth:o=0,minHeight:s,maxHeight:l,children:c,debounce:u=0,id:d,className:h,onResize:f,style:p={}}=e,g=(0,em.useRef)(null),v=(0,em.useRef)();v.current=f,(0,em.useImperativeHandle)(t,()=>g.current);var[x,y]=(0,em.useState)({containerWidth:r.width,containerHeight:r.height}),b=(0,em.useCallback)((e,t)=>{y(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,em.useEffect)(()=>{if(null==g.current||"u"<typeof ResizeObserver)return Cs;var e=e=>{var t,{width:n,height:r}=e[0].contentRect;b(n,r),null==(t=v.current)||t.call(v,n,r)};u>0&&(e=(0,_c.default)(e,u,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=g.current.getBoundingClientRect();return b(n,r),t.observe(g.current),()=>{t.disconnect()}},[b,u]);var{containerWidth:w,containerHeight:j}=x;_u(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:N,calculatedHeight:k}=_d(w,j,{width:i,height:a,aspect:n,maxHeight:l});return _u(null!=N&&N>0||null!=k&&k>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",N,k,i,a,o,s,n),em.createElement("div",{id:d?"".concat(d):void 0,className:(0,_l.clsx)("recharts-responsive-container",h),style:_x(_x({},p),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:g},em.createElement("div",{style:(e=>{var{width:t,height:n}=e,r=k6(t),i=k6(n);return r&&i?_h:r?_f:i?_p:_m})({width:i,height:a})},em.createElement(_b,{width:N,height:k},c)))}),_N=(0,em.forwardRef)((e,t)=>{var n=_w();if(EH(n.width)&&EH(n.height))return e.children;var{width:r,height:i}=function(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return void 0===i&&void 0===a?(i="100%",a="100%"):void 0===i?i=r&&r>0?void 0:"100%":void 0===a&&(a=r&&r>0?void 0:"100%"),{width:i,height:a}}({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=_d(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return k8(a)&&k8(o)?em.createElement(_b,{width:a,height:o},e.children):em.createElement(_j,_g({},e,{width:r,height:i,ref:t}))});function _k(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var _C=()=>{var e,t=_a(),n=EM(_n),r=EM(_s),i=null==(e=EM(_o))?void 0:e.padding;return t&&r&&i?{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}:n},_E={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},__=()=>{var e;return null!=(e=EM(_t))?e:_E},_S=e=>e.layout.layoutType,_T=e=>{var t=ES(),n=_a(),{width:r,height:i}=e,a=_w(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,em.useEffect)(()=>{!n&&EH(o)&&EH(s)&&t(Ej({width:o,height:s}))},[t,n,o,s]),null},_A=e.i(66814);function _O(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function _M(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}e.s([],25212),e.i(25212),e.s([],67155),e.i(67155);class _P extends Map{constructor(e,t=_L){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(_D(this,e))}has(e){return super.has(_D(this,e))}set(e,t){return super.set(function({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}(this,e),t)}delete(e){return super.delete(function({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}(this,e))}}function _D({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function _L(e){return null!==e&&"object"==typeof e?e.valueOf():e}let _I=Symbol("implicit");function _R(){var e=new _P,t=[],n=[],r=_I;function i(i){let a=e.get(i);if(void 0===a){if(r!==_I)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();for(let r of(t=[],e=new _P,n))e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return _R(t,n).unknown(r)},_O.apply(i,arguments),i}function _B(){var e,t,n=_R().unknown(void 0),r=n.domain,i=n.range,a=0,o=1,s=!1,l=0,c=0,u=.5;function d(){var n=r().length,d=o<a,h=d?o:a,f=d?a:o;e=(f-h)/Math.max(1,n-l+2*c),s&&(e=Math.floor(e)),h+=(f-h-e*(n-l))*u,t=e*(1-l),s&&(h=Math.round(h),t=Math.round(t));var p=(function(e,t,n){e*=1,t*=1,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=Array(i);++r<i;)a[r]=e+r*n;return a})(n).map(function(t){return h+e*t});return i(d?p.reverse():p)}return delete n.unknown,n.domain=function(e){return arguments.length?(r(e),d()):r()},n.range=function(e){return arguments.length?([a,o]=e,a*=1,o*=1,d()):[a,o]},n.rangeRound=function(e){return[a,o]=e,a*=1,o*=1,s=!0,d()},n.bandwidth=function(){return t},n.step=function(){return e},n.round=function(e){return arguments.length?(s=!!e,d()):s},n.padding=function(e){return arguments.length?(l=Math.min(1,c=+e),d()):l},n.paddingInner=function(e){return arguments.length?(l=Math.min(1,e),d()):l},n.paddingOuter=function(e){return arguments.length?(c=+e,d()):c},n.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},n.copy=function(){return _B(r(),[a,o]).round(s).paddingInner(l).paddingOuter(c).align(u)},_O.apply(d(),arguments)}function _z(){return function e(t){var n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return e(n())},t}(_B.apply(null,arguments).paddingInner(1))}let _F=Math.sqrt(50),_V=Math.sqrt(10),_U=Math.sqrt(2);function _H(e,t,n){let r,i,a,o=(t-e)/Math.max(0,n),s=Math.floor(Math.log10(o)),l=o/Math.pow(10,s),c=l>=_F?10:l>=_V?5:l>=_U?2:1;return(s<0?(r=Math.round(e*(a=Math.pow(10,-s)/c)),i=Math.round(t*a),r/a<e&&++r,i/a>t&&--i,a=-a):(r=Math.round(e/(a=Math.pow(10,s)*c)),i=Math.round(t/a),r*a<e&&++r,i*a>t&&--i),i<r&&.5<=n&&n<2)?_H(e,t,2*n):[r,i,a]}function _W(e,t,n){if(t*=1,e*=1,!((n*=1)>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?_H(t,e,n):_H(e,t,n);if(!(a>=i))return[];let s=a-i+1,l=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)l[e]=-((a-e)/o);else for(let e=0;e<s;++e)l[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)l[e]=-((i+e)/o);else for(let e=0;e<s;++e)l[e]=(i+e)*o;return l}function _Y(e,t,n){return _H(e*=1,t*=1,n*=1)[2]}function _G(e,t,n){t*=1,e*=1,n*=1;let r=t<e,i=r?_Y(t,e,n):_Y(e,t,n);return(r?-1:1)*(i<0?-(1/i):i)}function _$(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function _X(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function _q(e){let t,n,r;function i(e,r,a=0,o=e.length){if(a<o){if(0!==t(r,r))return o;do{let t=a+o>>>1;0>n(e[t],r)?a=t+1:o=t}while(a<o)}return a}return 2!==e.length?(t=_$,n=(t,n)=>_$(e(t),n),r=(t,n)=>e(t)-n):(t=e===_$||e===_X?e:_K,n=e,r=e),{left:i,center:function(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o},right:function(e,r,i=0,a=e.length){if(i<a){if(0!==t(r,r))return a;do{let t=i+a>>>1;0>=n(e[t],r)?i=t+1:a=t}while(i<a)}return i}}}function _K(){return 0}function _Z(e){return null===e?NaN:+e}let _Q=_q(_$),_J=_Q.right;function _0(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _1(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function _2(){}_Q.left,_q(_Z).center;var _5="\\s*([+-]?\\d+)\\s*",_3="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_4="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_6=/^#([0-9a-f]{3,8})$/,_8=RegExp(`^rgb\\(${_5},${_5},${_5}\\)$`),_7=RegExp(`^rgb\\(${_4},${_4},${_4}\\)$`),_9=RegExp(`^rgba\\(${_5},${_5},${_5},${_3}\\)$`),Se=RegExp(`^rgba\\(${_4},${_4},${_4},${_3}\\)$`),St=RegExp(`^hsl\\(${_3},${_4},${_4}\\)$`),Sn=RegExp(`^hsla\\(${_3},${_4},${_4},${_3}\\)$`),Sr={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function Si(){return this.rgb().formatHex()}function Sa(){return this.rgb().formatRgb()}function So(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_6.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Ss(t):3===n?new Su(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Sl(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Sl(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=_8.exec(e))?new Su(t[1],t[2],t[3],1):(t=_7.exec(e))?new Su(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=_9.exec(e))?Sl(t[1],t[2],t[3],t[4]):(t=Se.exec(e))?Sl(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=St.exec(e))?Sg(t[1],t[2]/100,t[3]/100,1):(t=Sn.exec(e))?Sg(t[1],t[2]/100,t[3]/100,t[4]):Sr.hasOwnProperty(e)?Ss(Sr[e]):"transparent"===e?new Su(NaN,NaN,NaN,0):null}function Ss(e){return new Su(e>>16&255,e>>8&255,255&e,1)}function Sl(e,t,n,r){return r<=0&&(e=t=n=NaN),new Su(e,t,n,r)}function Sc(e,t,n,r){var i;return 1==arguments.length?((i=e)instanceof _2||(i=So(i)),i)?new Su((i=i.rgb()).r,i.g,i.b,i.opacity):new Su:new Su(e,t,n,null==r?1:r)}function Su(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Sd(){return`#${Sm(this.r)}${Sm(this.g)}${Sm(this.b)}`}function Sh(){let e=Sf(this.opacity);return`${1===e?"rgb(":"rgba("}${Sp(this.r)}, ${Sp(this.g)}, ${Sp(this.b)}${1===e?")":`, ${e})`}`}function Sf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Sp(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Sm(e){return((e=Sp(e))<16?"0":"")+e.toString(16)}function Sg(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Sx(e,t,n,r)}function Sv(e){if(e instanceof Sx)return new Sx(e.h,e.s,e.l,e.opacity);if(e instanceof _2||(e=So(e)),!e)return new Sx;if(e instanceof Sx)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,l=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new Sx(o,s,l,e.opacity)}function Sx(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Sy(e){return(e=(e||0)%360)<0?e+360:e}function Sb(e){return Math.max(0,Math.min(1,e||0))}function Sw(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}function Sj(e,t,n,r,i){var a=e*e,o=a*e;return((1-3*e+3*a-o)*t+(4-6*a+3*o)*n+(1+3*e+3*a-3*o)*r+o*i)/6}_0(_2,So,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Si,formatHex:Si,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Sv(this).formatHsl()},formatRgb:Sa,toString:Sa}),_0(Su,Sc,_1(_2,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new Su(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Su(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Su(Sp(this.r),Sp(this.g),Sp(this.b),Sf(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Sd,formatHex:Sd,formatHex8:function(){return`#${Sm(this.r)}${Sm(this.g)}${Sm(this.b)}${Sm((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:Sh,toString:Sh})),_0(Sx,function(e,t,n,r){return 1==arguments.length?Sv(e):new Sx(e,t,n,null==r?1:r)},_1(_2,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new Sx(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Sx(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Su(Sw(e>=240?e-240:e+120,i,r),Sw(e,i,r),Sw(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Sx(Sy(this.h),Sb(this.s),Sb(this.l),Sf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Sf(this.opacity);return`${1===e?"hsl(":"hsla("}${Sy(this.h)}, ${100*Sb(this.s)}%, ${100*Sb(this.l)}%${1===e?")":`, ${e})`}`}}));let SN=e=>()=>e;function Sk(e,t){var n=t-e;return n?function(t){return e+t*n}:SN(isNaN(e)?t:e)}let SC=function e(t){var n,r=1==(n=+t)?Sk:function(e,t){var r,i,a;return t-e?(r=e,i=t,r=Math.pow(r,a=n),i=Math.pow(i,a)-r,a=1/a,function(e){return Math.pow(r+e*i,a)}):SN(isNaN(e)?t:e)};function i(e,t){var n=r((e=Sc(e)).r,(t=Sc(t)).r),i=r(e.g,t.g),a=r(e.b,t.b),o=Sk(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return i.gamma=e,i}(1);function SE(e){return function(t){var n,r,i=t.length,a=Array(i),o=Array(i),s=Array(i);for(n=0;n<i;++n)r=Sc(t[n]),a[n]=r.r||0,o[n]=r.g||0,s[n]=r.b||0;return a=e(a),o=e(o),s=e(s),r.opacity=1,function(e){return r.r=a(e),r.g=o(e),r.b=s(e),r+""}}}function S_(e,t){return e*=1,t*=1,function(n){return e*(1-n)+t*n}}SE(function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],o=r>0?e[r-1]:2*i-a,s=r<t-1?e[r+2]:2*a-i;return Sj((n-r/t)*t,o,i,a,s)}}),SE(function(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],a=e[r%t],o=e[(r+1)%t],s=e[(r+2)%t];return Sj((n-r/t)*t,i,a,o,s)}});var SS=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ST=RegExp(SS.source,"g");function SA(e,t){var n,r,i=typeof t;return null==t||"boolean"===i?SN(t):("number"===i?S_:"string"===i?(r=So(t))?(t=r,SC):function(e,t){var n,r,i,a,o,s=SS.lastIndex=ST.lastIndex=0,l=-1,c=[],u=[];for(e+="",t+="";(i=SS.exec(e))&&(a=ST.exec(t));)(o=a.index)>s&&(o=t.slice(s,o),c[l]?c[l]+=o:c[++l]=o),(i=i[0])===(a=a[0])?c[l]?c[l]+=a:c[++l]=a:(c[++l]=null,u.push({i:l,x:S_(i,a)})),s=ST.lastIndex;return s<t.length&&(o=t.slice(s),c[l]?c[l]+=o:c[++l]=o),c.length<2?u[0]?(n=u[0].x,function(e){return n(e)+""}):(r=t,function(){return r}):(t=u.length,function(e){for(var n,r=0;r<t;++r)c[(n=u[r]).i]=n.x(e);return c.join("")})}:t instanceof So?SC:t instanceof Date?function(e,t){var n=new Date;return e*=1,t*=1,function(r){return n.setTime(e*(1-r)+t*r),n}}:!ArrayBuffer.isView(n=t)||n instanceof DataView?Array.isArray(t)?function(e,t){var n,r=t?t.length:0,i=e?Math.min(r,e.length):0,a=Array(i),o=Array(r);for(n=0;n<i;++n)a[n]=SA(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<i;++n)o[n]=a[n](e);return o}}:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?function(e,t){var n,r={},i={};for(n in(null===e||"object"!=typeof e)&&(e={}),(null===t||"object"!=typeof t)&&(t={}),t)n in e?r[n]=SA(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}:S_:function(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;n<r;++n)i[n]=e[n]*(1-a)+t[n]*a;return i}})(e,t)}function SO(e,t){return e*=1,t*=1,function(n){return Math.round(e*(1-n)+t*n)}}function SM(e){return+e}var SP=[0,1];function SD(e){return e}function SL(e,t){var n;return(t-=e*=1)?function(n){return(n-e)/t}:(n=isNaN(t)?NaN:.5,function(){return n})}function SI(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=SL(i,r),a=n(o,a)):(r=SL(r,i),a=n(a,o)),function(e){return a(r(e))}}function SR(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=SL(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=_J(e,t,1,r)-1;return a[n](i[n](t))}}function SB(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Sz(){var e,t,n,r,i,a,o=SP,s=SP,l=SA,c=SD;function u(){var e,t,n,l=Math.min(o.length,s.length);return c!==SD&&(e=o[0],t=o[l-1],e>t&&(n=e,e=t,t=n),c=function(n){return Math.max(e,Math.min(t,n))}),r=l>2?SR:SI,i=a=null,d}function d(t){return null==t||isNaN(t*=1)?n:(i||(i=r(o.map(e),s,l)))(e(c(t)))}return d.invert=function(n){return c(t((a||(a=r(s,o.map(e),S_)))(n)))},d.domain=function(e){return arguments.length?(o=Array.from(e,SM),u()):o.slice()},d.range=function(e){return arguments.length?(s=Array.from(e),u()):s.slice()},d.rangeRound=function(e){return s=Array.from(e),l=SO,u()},d.clamp=function(e){return arguments.length?(c=!!e||SD,u()):c!==SD},d.interpolate=function(e){return arguments.length?(l=e,u()):l},d.unknown=function(e){return arguments.length?(n=e,d):n},function(n,r){return e=n,t=r,u()}}function SF(){return Sz()(SD,SD)}function SV(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function SU(e){return(e=SV(Math.abs(e)))?e[1]:NaN}var SH=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function SW(e){var t;if(!(t=SH.exec(e)))throw Error("invalid format: "+e);return new SY({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function SY(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function SG(e,t){var n=SV(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+Array(i-r.length+2).join("0")}SW.prototype=SY.prototype,SY.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};let S$={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>SG(100*e,t),r:SG,s:function(e,t){var n=SV(e,t);if(!n)return e+"";var r=n[0],i=n[1],a=i-(B=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+Array(1-a).join("0")+SV(e,Math.max(0,t+a-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function SX(e){return e}var Sq=Array.prototype.map,SK=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function SZ(e,t,n,r){var i,a,o=_G(e,t,n);switch((r=SW(null==r?",f":r)).type){case"s":var s=Math.max(Math.abs(e),Math.abs(t));return null!=r.precision||isNaN(a=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(SU(s)/3)))-SU(Math.abs(o))))||(r.precision=a),V(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(a=Math.max(0,SU(Math.abs(Math.max(Math.abs(e),Math.abs(t)))-(i=Math.abs(i=o)))-SU(i))+1)||(r.precision=a-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(a=Math.max(0,-SU(Math.abs(o))))||(r.precision=a-("%"===r.type)*2)}return F(r)}function SQ(e){var t=e.domain;return e.ticks=function(e){var n=t();return _W(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){var r=t();return SZ(r[0],r[r.length-1],null==e?10:e,n)},e.nice=function(n){null==n&&(n=10);var r,i,a=t(),o=0,s=a.length-1,l=a[o],c=a[s],u=10;for(c<l&&(i=l,l=c,c=i,i=o,o=s,s=i);u-- >0;){if((i=_Y(l,c,n))===r)return a[o]=l,a[s]=c,t(a);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else if(i<0)l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i;else break;r=i}return e},e}function SJ(){var e=SF();return e.copy=function(){return SB(e,SJ())},_O.apply(e,arguments),SQ(e)}function S0(e){var t;function n(e){return null==e||isNaN(e*=1)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,SM),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return S0(e).unknown(t)},e=arguments.length?Array.from(e,SM):[0,1],SQ(n)}function S1(e,t){e=e.slice();var n,r=0,i=e.length-1,a=e[r],o=e[i];return o<a&&(n=r,r=i,i=n,n=a,a=o,o=n),e[r]=t.floor(a),e[i]=t.ceil(o),e}function S2(e){return Math.log(e)}function S5(e){return Math.exp(e)}function S3(e){return-Math.log(-e)}function S4(e){return-Math.exp(-e)}function S6(e){return isFinite(e)?+("1e"+e):e<0?0:e}function S8(e){return(t,n)=>-e(-t,n)}function S7(e){let t,n,r=e(S2,S5),i=r.domain,a=10;function o(){var o,s;return t=(o=a)===Math.E?Math.log:10===o&&Math.log10||2===o&&Math.log2||(o=Math.log(o),e=>Math.log(e)/o),n=10===(s=a)?S6:s===Math.E?Math.exp:e=>Math.pow(s,e),i()[0]<0?(t=S8(t),n=S8(n),e(S3,S4)):e(S2,S5),r}return r.base=function(e){return arguments.length?(a=+e,o()):a},r.domain=function(e){return arguments.length?(i(e),o()):i()},r.ticks=e=>{let r,o,s=i(),l=s[0],c=s[s.length-1],u=c<l;u&&([l,c]=[c,l]);let d=t(l),h=t(c),f=null==e?10:+e,p=[];if(!(a%1)&&h-d<f){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(r=1;r<a;++r)if(!((o=d<0?r/n(-d):r*n(d))<l)){if(o>c)break;p.push(o)}}else for(;d<=h;++d)for(r=a-1;r>=1;--r)if(!((o=d>0?r/n(-d):r*n(d))<l)){if(o>c)break;p.push(o)}2*p.length<f&&(p=_W(l,c,f))}else p=_W(d,h,Math.min(h-d,f)).map(n);return u?p.reverse():p},r.tickFormat=(e,i)=>{if(null==e&&(e=10),null==i&&(i=10===a?"s":","),"function"!=typeof i&&(a%1||null!=(i=SW(i)).precision||(i.trim=!0),i=F(i)),e===1/0)return i;let o=Math.max(1,a*e/r.ticks().length);return e=>{let r=e/n(Math.round(t(e)));return r*a<a-.5&&(r*=a),r<=o?i(e):""}},r.nice=()=>i(S1(i(),{floor:e=>n(Math.floor(t(e))),ceil:e=>n(Math.ceil(t(e)))})),r}function S9(){let e=S7(Sz()).domain([1,10]);return e.copy=()=>SB(e,S9()).base(e.base()),_O.apply(e,arguments),e}function Te(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Tt(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Tn(e){var t=1,n=e(Te(1),Tt(t));return n.constant=function(n){return arguments.length?e(Te(t=+n),Tt(t)):t},SQ(n)}function Tr(){var e=Tn(Sz());return e.copy=function(){return SB(e,Tr()).constant(e.constant())},_O.apply(e,arguments)}function Ti(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Ta(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function To(e){return e<0?-e*e:e*e}function Ts(e){var t=e(SD,SD),n=1;return t.exponent=function(t){return arguments.length?1==(n=+t)?e(SD,SD):.5===n?e(Ta,To):e(Ti(n),Ti(1/n)):n},SQ(t)}function Tl(){var e=Ts(Sz());return e.copy=function(){return SB(e,Tl()).exponent(e.exponent())},_O.apply(e,arguments),e}function Tc(){return Tl.apply(null,arguments).exponent(.5)}function Tu(e){return Math.sign(e)*e*e}function Td(){var e,t=SF(),n=[0,1],r=!1;function i(n){var i,a=Math.sign(i=t(n))*Math.sqrt(Math.abs(i));return isNaN(a)?e:r?Math.round(a):a}return i.invert=function(e){return t.invert(Tu(e))},i.domain=function(e){return arguments.length?(t.domain(e),i):t.domain()},i.range=function(e){return arguments.length?(t.range((n=Array.from(e,SM)).map(Tu)),i):n.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(r=!!e,i):r},i.clamp=function(e){return arguments.length?(t.clamp(e),i):t.clamp()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return Td(t.domain(),n).round(r).clamp(t.clamp()).unknown(e)},_O.apply(i,arguments),SQ(i)}function Th(e,t){let n;if(void 0===t)for(let t of e)null!=t&&(n<t||void 0===n&&t>=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function Tf(e,t){let n;if(void 0===t)for(let t of e)null!=t&&(n>t||void 0===n&&t>=t)&&(n=t);else{let r=-1;for(let i of e)null!=(i=t(i,++r,e))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function Tp(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:+(e>t))}function Tm(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Tg(){var e,t=[],n=[],r=[];function i(){var e=0,i=Math.max(1,n.length);for(r=Array(i-1);++e<i;)r[e-1]=function(e,t,n=_Z){if(!(!(r=e.length)||isNaN(t*=1))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(n(e[a+1],a+1,e)-o)*(i-a)}}(t,e/i);return a}function a(t){return null==t||isNaN(t*=1)?e:n[_J(r,t)]}return a.invertExtent=function(e){var i=n.indexOf(e);return i<0?[NaN,NaN]:[i>0?r[i-1]:t[0],i<r.length?r[i]:t[t.length-1]]},a.domain=function(e){if(!arguments.length)return t.slice();for(let n of(t=[],e))null==n||isNaN(n*=1)||t.push(n);return t.sort(_$),i()},a.range=function(e){return arguments.length?(n=Array.from(e),i()):n.slice()},a.unknown=function(t){return arguments.length?(e=t,a):e},a.quantiles=function(){return r.slice()},a.copy=function(){return Tg().domain(t).range(n).unknown(e)},_O.apply(a,arguments)}function Tv(){var e,t=0,n=1,r=1,i=[.5],a=[0,1];function o(t){return null!=t&&t<=t?a[_J(i,t,0,r)]:e}function s(){var e=-1;for(i=Array(r);++e<r;)i[e]=((e+1)*n-(e-r)*t)/(r+1);return o}return o.domain=function(e){return arguments.length?([t,n]=e,t*=1,n*=1,s()):[t,n]},o.range=function(e){return arguments.length?(r=(a=Array.from(e)).length-1,s()):a.slice()},o.invertExtent=function(e){var o=a.indexOf(e);return o<0?[NaN,NaN]:o<1?[t,i[0]]:o>=r?[i[r-1],n]:[i[o-1],i[o]]},o.unknown=function(t){return arguments.length&&(e=t),o},o.thresholds=function(){return i.slice()},o.copy=function(){return Tv().domain([t,n]).range(a).unknown(e)},_O.apply(SQ(o),arguments)}function Tx(){var e,t=[.5],n=[0,1],r=1;function i(i){return null!=i&&i<=i?n[_J(t,i,0,r)]:e}return i.domain=function(e){return arguments.length?(r=Math.min((t=Array.from(e)).length,n.length-1),i):t.slice()},i.range=function(e){return arguments.length?(n=Array.from(e),r=Math.min(t.length,n.length-1),i):n.slice()},i.invertExtent=function(e){var r=n.indexOf(e);return[t[r-1],t[r]]},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return Tx().domain(t).range(n).unknown(e)},_O.apply(i,arguments)}F=(z=function(e){var t,n,r,i=void 0===e.grouping||void 0===e.thousands?SX:(t=Sq.call(e.grouping,Number),n=e.thousands+"",function(e,r){for(var i=e.length,a=[],o=0,s=t[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),a.push(e.substring(i-=s,i+s)),!((l+=s+1)>r));)s=t[o=(o+1)%t.length];return a.reverse().join(n)}),a=void 0===e.currency?"":e.currency[0]+"",o=void 0===e.currency?"":e.currency[1]+"",s=void 0===e.decimal?".":e.decimal+"",l=void 0===e.numerals?SX:(r=Sq.call(e.numerals,String),function(e){return e.replace(/[0-9]/g,function(e){return r[+e]})}),c=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",d=void 0===e.nan?"NaN":e.nan+"";function h(e){var t=(e=SW(e)).fill,n=e.align,r=e.sign,h=e.symbol,f=e.zero,p=e.width,g=e.comma,v=e.precision,x=e.trim,y=e.type;"n"===y?(g=!0,y="g"):S$[y]||(void 0===v&&(v=12),x=!0,y="g"),(f||"0"===t&&"="===n)&&(f=!0,t="0",n="=");var b="$"===h?a:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===h?o:/[%p]/.test(y)?c:"",j=S$[y],N=/[defgprs%]/.test(y);function k(e){var a,o,c,h=b,k=w;if("c"===y)k=j(e)+k,e="";else{var C=(e*=1)<0||1/e<0;if(e=isNaN(e)?d:j(Math.abs(e),v),x&&(e=function(e){e:for(var t,n=e.length,r=1,i=-1;r<n;++r)switch(e[r]){case".":i=t=r;break;case"0":0===i&&(i=r),t=r;break;default:if(!+e[r])break e;i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(t+1):e}(e)),C&&0==+e&&"+"!==r&&(C=!1),h=(C?"("===r?r:u:"-"===r||"("===r?"":r)+h,k=("s"===y?SK[8+B/3]:"")+k+(C&&"("===r?")":""),N){for(a=-1,o=e.length;++a<o;)if(48>(c=e.charCodeAt(a))||c>57){k=(46===c?s+e.slice(a+1):e.slice(a))+k,e=e.slice(0,a);break}}}g&&!f&&(e=i(e,1/0));var E=h.length+e.length+k.length,_=E<p?Array(p-E+1).join(t):"";switch(g&&f&&(e=i(_+e,_.length?p-k.length:1/0),_=""),n){case"<":e=h+e+k+_;break;case"=":e=h+_+e+k;break;case"^":e=_.slice(0,E=_.length>>1)+h+e+k+_.slice(E);break;default:e=_+h+e+k}return l(e)}return v=void 0===v?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),k.toString=function(){return e+""},k}return{format:h,formatPrefix:function(e,t){var n=h(((e=SW(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(SU(t)/3))),i=Math.pow(10,-r),a=SK[8+r/3];return function(e){return n(i*e)+a}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,V=z.formatPrefix;let Ty=new Date,Tb=new Date;function Tw(e,t,n,r){function i(t){return e(t=0==arguments.length?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),null==n?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o,s=[];if(n=i.ceil(n),a=null==a?1:Math.floor(a),!(n<r)||!(a>0))return s;do s.push(o=new Date(+n)),t(n,a),e(n);while(o<n&&n<r)return s},i.filter=n=>Tw(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(Ty.setTime(+t),Tb.setTime(+r),e(Ty),e(Tb),Math.floor(n(Ty,Tb))),i.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?i.filter(r?t=>r(t)%e==0:t=>i.count(0,t)%e==0):i:null),i}let Tj=Tw(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Tj.every=e=>isFinite(e=Math.floor(e))&&e>0?Tw(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}):null,Tj.range;let TN=Tw(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());TN.every=e=>isFinite(e=Math.floor(e))&&e>0?Tw(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}):null,TN.range;let Tk=Tw(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Tk.range;let TC=Tw(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());TC.range;function TE(e){return Tw(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+7*t)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}let T_=TE(0),TS=TE(1),TT=TE(2),TA=TE(3),TO=TE(4),TM=TE(5),TP=TE(6);function TD(e){return Tw(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+7*t)},(e,t)=>(t-e)/6048e5)}T_.range,TS.range,TT.range,TA.range,TO.range,TM.range,TP.range;let TL=TD(0),TI=TD(1),TR=TD(2),TB=TD(3),Tz=TD(4),TF=TD(5),TV=TD(6);TL.range,TI.range,TR.range,TB.range,Tz.range,TF.range,TV.range;let TU=Tw(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1);TU.range;let TH=Tw(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1);TH.range;let TW=Tw(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5));TW.range;let TY=Tw(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds()-6e4*e.getMinutes())},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getHours());TY.range;let TG=Tw(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+36e5*t)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours());TG.range;let T$=Tw(e=>{e.setTime(e-e.getMilliseconds()-1e3*e.getSeconds())},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getMinutes());T$.range;let TX=Tw(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+6e4*t)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes());TX.range;let Tq=Tw(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+1e3*t)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds());Tq.range;let TK=Tw(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);function TZ(e,t,n,r,i,a){let o=[[Tq,1,1e3],[Tq,5,5e3],[Tq,15,15e3],[Tq,30,3e4],[a,1,6e4],[a,5,3e5],[a,15,9e5],[a,30,18e5],[i,1,36e5],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,864e5],[r,2,1728e5],[n,1,6048e5],[t,1,2592e6],[t,3,7776e6],[e,1,31536e6]];function s(t,n,r){let i=Math.abs(n-t)/r,a=_q(([,,e])=>e).right(o,i);if(a===o.length)return e.every(_G(t/31536e6,n/31536e6,r));if(0===a)return TK.every(Math.max(_G(t,n,r),1));let[s,l]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(l)}return[function(e,t,n){let r=t<e;r&&([e,t]=[t,e]);let i=n&&"function"==typeof n.range?n:s(e,t,n),a=i?i.range(e,+t+1):[];return r?a.reverse():a},s]}TK.every=e=>isFinite(e=Math.floor(e))&&e>0?e>1?Tw(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):TK:null,TK.range;let[TQ,TJ]=TZ(TN,TC,TL,TW,TG,TX),[T0,T1]=TZ(Tj,Tk,T_,TU,TY,T$);function T2(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function T5(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function T3(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}var T4={"-":"",_:" ",0:"0"},T6=/^\s*\d+/,T8=/^%/,T7=/[\\^$*+?|[\]().{}]/g;function T9(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function Ae(e){return e.replace(T7,"\\$&")}function At(e){return RegExp("^(?:"+e.map(Ae).join("|")+")","i")}function An(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function Ar(e,t,n){var r=T6.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Ai(e,t,n){var r=T6.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Aa(e,t,n){var r=T6.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Ao(e,t,n){var r=T6.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function As(e,t,n){var r=T6.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Al(e,t,n){var r=T6.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Ac(e,t,n){var r=T6.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Au(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Ad(e,t,n){var r=T6.exec(t.slice(n,n+1));return r?(e.q=3*r[0]-3,n+r[0].length):-1}function Ah(e,t,n){var r=T6.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Af(e,t,n){var r=T6.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Ap(e,t,n){var r=T6.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Am(e,t,n){var r=T6.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Ag(e,t,n){var r=T6.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Av(e,t,n){var r=T6.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Ax(e,t,n){var r=T6.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Ay(e,t,n){var r=T6.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Ab(e,t,n){var r=T8.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Aw(e,t,n){var r=T6.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Aj(e,t,n){var r=T6.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function AN(e,t){return T9(e.getDate(),t,2)}function Ak(e,t){return T9(e.getHours(),t,2)}function AC(e,t){return T9(e.getHours()%12||12,t,2)}function AE(e,t){return T9(1+TU.count(Tj(e),e),t,3)}function A_(e,t){return T9(e.getMilliseconds(),t,3)}function AS(e,t){return A_(e,t)+"000"}function AT(e,t){return T9(e.getMonth()+1,t,2)}function AA(e,t){return T9(e.getMinutes(),t,2)}function AO(e,t){return T9(e.getSeconds(),t,2)}function AM(e){var t=e.getDay();return 0===t?7:t}function AP(e,t){return T9(T_.count(Tj(e)-1,e),t,2)}function AD(e){var t=e.getDay();return t>=4||0===t?TO(e):TO.ceil(e)}function AL(e,t){return e=AD(e),T9(TO.count(Tj(e),e)+(4===Tj(e).getDay()),t,2)}function AI(e){return e.getDay()}function AR(e,t){return T9(TS.count(Tj(e)-1,e),t,2)}function AB(e,t){return T9(e.getFullYear()%100,t,2)}function Az(e,t){return T9((e=AD(e)).getFullYear()%100,t,2)}function AF(e,t){return T9(e.getFullYear()%1e4,t,4)}function AV(e,t){var n=e.getDay();return T9((e=n>=4||0===n?TO(e):TO.ceil(e)).getFullYear()%1e4,t,4)}function AU(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+T9(t/60|0,"0",2)+T9(t%60,"0",2)}function AH(e,t){return T9(e.getUTCDate(),t,2)}function AW(e,t){return T9(e.getUTCHours(),t,2)}function AY(e,t){return T9(e.getUTCHours()%12||12,t,2)}function AG(e,t){return T9(1+TH.count(TN(e),e),t,3)}function A$(e,t){return T9(e.getUTCMilliseconds(),t,3)}function AX(e,t){return A$(e,t)+"000"}function Aq(e,t){return T9(e.getUTCMonth()+1,t,2)}function AK(e,t){return T9(e.getUTCMinutes(),t,2)}function AZ(e,t){return T9(e.getUTCSeconds(),t,2)}function AQ(e){var t=e.getUTCDay();return 0===t?7:t}function AJ(e,t){return T9(TL.count(TN(e)-1,e),t,2)}function A0(e){var t=e.getUTCDay();return t>=4||0===t?Tz(e):Tz.ceil(e)}function A1(e,t){return e=A0(e),T9(Tz.count(TN(e),e)+(4===TN(e).getUTCDay()),t,2)}function A2(e){return e.getUTCDay()}function A5(e,t){return T9(TI.count(TN(e)-1,e),t,2)}function A3(e,t){return T9(e.getUTCFullYear()%100,t,2)}function A4(e,t){return T9((e=A0(e)).getUTCFullYear()%100,t,2)}function A6(e,t){return T9(e.getUTCFullYear()%1e4,t,4)}function A8(e,t){var n=e.getUTCDay();return T9((e=n>=4||0===n?Tz(e):Tz.ceil(e)).getUTCFullYear()%1e4,t,4)}function A7(){return"+0000"}function A9(){return"%"}function Oe(e){return+e}function Ot(e){return Math.floor(e/1e3)}function On(e){return new Date(e)}function Or(e){return e instanceof Date?+e:+new Date(+e)}function Oi(e,t,n,r,i,a,o,s,l,c){var u=SF(),d=u.invert,h=u.domain,f=c(".%L"),p=c(":%S"),g=c("%I:%M"),v=c("%I %p"),x=c("%a %d"),y=c("%b %d"),b=c("%B"),w=c("%Y");function j(e){return(l(e)<e?f:s(e)<e?p:o(e)<e?g:a(e)<e?v:r(e)<e?i(e)<e?x:y:n(e)<e?b:w)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?h(Array.from(e,Or)):h().map(On)},u.ticks=function(t){var n=h();return e(n[0],n[n.length-1],null==t?10:t)},u.tickFormat=function(e,t){return null==t?j:c(t)},u.nice=function(e){var n=h();return e&&"function"==typeof e.range||(e=t(n[0],n[n.length-1],null==e?10:e)),e?h(S1(n,e)):u},u.copy=function(){return SB(u,Oi(e,t,n,r,i,a,o,s,l,c))},u}function Oa(){return _O.apply(Oi(T0,T1,Tj,Tk,T_,TU,TY,T$,Tq,H).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Oo(){return _O.apply(Oi(TQ,TJ,TN,TC,TL,TH,TG,TX,Tq,W).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Os(){var e,t,n,r,i,a=0,o=1,s=SD,l=!1;function c(t){return null==t||isNaN(t*=1)?i:s(0===n?.5:(t=(r(t)-e)*n,l?Math.max(0,Math.min(1,t)):t))}function u(e){return function(t){var n,r;return arguments.length?([n,r]=t,s=e(n,r),c):[s(0),s(1)]}}return c.domain=function(i){return arguments.length?([a,o]=i,e=r(a*=1),t=r(o*=1),n=e===t?0:1/(t-e),c):[a,o]},c.clamp=function(e){return arguments.length?(l=!!e,c):l},c.interpolator=function(e){return arguments.length?(s=e,c):s},c.range=u(SA),c.rangeRound=u(SO),c.unknown=function(e){return arguments.length?(i=e,c):i},function(i){return r=i,e=i(a),t=i(o),n=e===t?0:1/(t-e),c}}function Ol(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Oc(){var e=SQ(Os()(SD));return e.copy=function(){return Ol(e,Oc())},_M.apply(e,arguments)}function Ou(){var e=S7(Os()).domain([1,10]);return e.copy=function(){return Ol(e,Ou()).base(e.base())},_M.apply(e,arguments)}function Od(){var e=Tn(Os());return e.copy=function(){return Ol(e,Od()).constant(e.constant())},_M.apply(e,arguments)}function Oh(){var e=Ts(Os());return e.copy=function(){return Ol(e,Oh()).exponent(e.exponent())},_M.apply(e,arguments)}function Of(){return Oh.apply(null,arguments).exponent(.5)}function Op(){var e=[],t=SD;function n(n){if(null!=n&&!isNaN(n*=1))return t((_J(e,n,1)-1)/(e.length-1))}return n.domain=function(t){if(!arguments.length)return e.slice();for(let n of(e=[],t))null==n||isNaN(n*=1)||e.push(n);return e.sort(_$),n},n.interpolator=function(e){return arguments.length?(t=e,n):t},n.range=function(){return e.map((n,r)=>t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>(function(e,t){if(!(!(n=(e=Float64Array.from(function*(e,t){if(void 0===t)for(let t of e)null!=t&&(t*=1)>=t&&(yield t);else{let n=-1;for(let r of e)null!=(r=t(r,++n,e))&&(r*=1)>=r&&(yield r)}}(e,void 0))).length)||isNaN(t*=1))){if(t<=0||n<2)return Tf(e);if(t>=1)return Th(e);var n,r=(n-1)*t,i=Math.floor(r),a=Th((function e(t,n,r=0,i=1/0,a){if(n=Math.floor(n),r=Math.floor(Math.max(0,r)),i=Math.floor(Math.min(t.length-1,i)),!(r<=n&&n<=i))return t;for(a=void 0===a?Tp:function(e=_$){if(e===_$)return Tp;if("function"!=typeof e)throw TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}(a);i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,l=Math.log(o),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(o-c)/o)*(s-o/2<0?-1:1),d=Math.max(r,Math.floor(n-s*c/o+u)),h=Math.min(i,Math.floor(n+(o-s)*c/o+u));e(t,n,d,h,a)}let o=t[n],s=r,l=i;for(Tm(t,r,n),a(t[i],o)>0&&Tm(t,r,i);s<l;){for(Tm(t,s,l),++s,--l;0>a(t[s],o);)++s;for(;a(t[l],o)>0;)--l}0===a(t[r],o)?Tm(t,r,l):Tm(t,++l,i),l<=n&&(r=l+1),n<=l&&(i=l-1)}return t})(e,i).subarray(0,i+1));return a+(Tf(e.subarray(i+1))-a)*(r-i)}})(e,r/t))},n.copy=function(){return Op(t).domain(e)},_M.apply(n,arguments)}function Om(){var e,t,n,r,i,a,o,s=0,l=.5,c=1,u=1,d=SD,h=!1;function f(e){return isNaN(e*=1)?o:(e=.5+((e=+a(e))-t)*(u*e<u*t?r:i),d(h?Math.max(0,Math.min(1,e)):e))}function p(e){return function(t){var n,r,i;return arguments.length?([n,r,i]=t,d=function(e,t){void 0===t&&(t=e,e=SA);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(e){var t=Math.max(0,Math.min(r-1,Math.floor(e*=r)));return a[t](e-t)}}(e,[n,r,i]),f):[d(0),d(.5),d(1)]}}return f.domain=function(o){return arguments.length?([s,l,c]=o,e=a(s*=1),t=a(l*=1),n=a(c*=1),r=e===t?0:.5/(t-e),i=t===n?0:.5/(n-t),u=t<e?-1:1,f):[s,l,c]},f.clamp=function(e){return arguments.length?(h=!!e,f):h},f.interpolator=function(e){return arguments.length?(d=e,f):d},f.range=p(SA),f.rangeRound=p(SO),f.unknown=function(e){return arguments.length?(o=e,f):o},function(o){return a=o,e=o(s),t=o(l),n=o(c),r=e===t?0:.5/(t-e),i=t===n?0:.5/(n-t),u=t<e?-1:1,f}}function Og(){var e=SQ(Om()(SD));return e.copy=function(){return Ol(e,Og())},_M.apply(e,arguments)}function Ov(){var e=S7(Om()).domain([.1,1,10]);return e.copy=function(){return Ol(e,Ov()).base(e.base())},_M.apply(e,arguments)}function Ox(){var e=Tn(Om());return e.copy=function(){return Ol(e,Ox()).constant(e.constant())},_M.apply(e,arguments)}function Oy(){var e=Ts(Om());return e.copy=function(){return Ol(e,Oy()).exponent(e.exponent())},_M.apply(e,arguments)}function Ob(){return Oy.apply(null,arguments).exponent(.5)}H=(U=function(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,l=e.shortMonths,c=At(i),u=An(i),d=At(a),h=An(a),f=At(o),p=An(o),g=At(s),v=An(s),x=At(l),y=An(l),b={a:function(e){return o[e.getDay()]},A:function(e){return a[e.getDay()]},b:function(e){return l[e.getMonth()]},B:function(e){return s[e.getMonth()]},c:null,d:AN,e:AN,f:AS,g:Az,G:AV,H:Ak,I:AC,j:AE,L:A_,m:AT,M:AA,p:function(e){return i[+(e.getHours()>=12)]},q:function(e){return 1+~~(e.getMonth()/3)},Q:Oe,s:Ot,S:AO,u:AM,U:AP,V:AL,w:AI,W:AR,x:null,X:null,y:AB,Y:AF,Z:AU,"%":A9},w={a:function(e){return o[e.getUTCDay()]},A:function(e){return a[e.getUTCDay()]},b:function(e){return l[e.getUTCMonth()]},B:function(e){return s[e.getUTCMonth()]},c:null,d:AH,e:AH,f:AX,g:A4,G:A8,H:AW,I:AY,j:AG,L:A$,m:Aq,M:AK,p:function(e){return i[+(e.getUTCHours()>=12)]},q:function(e){return 1+~~(e.getUTCMonth()/3)},Q:Oe,s:Ot,S:AZ,u:AQ,U:AJ,V:A1,w:A2,W:A5,x:null,X:null,y:A3,Y:A6,Z:A7,"%":A9},j={a:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(e,t,n){var r=x.exec(t.slice(n));return r?(e.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(e,n,r){return C(e,t,n,r)},d:Af,e:Af,f:Ay,g:Ac,G:Al,H:Am,I:Am,j:Ap,L:Ax,m:Ah,M:Ag,p:function(e,t,n){var r=c.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:Ad,Q:Aw,s:Aj,S:Av,u:Ai,U:Aa,V:Ao,w:Ar,W:As,x:function(e,t,r){return C(e,n,t,r)},X:function(e,t,n){return C(e,r,t,n)},y:Ac,Y:Al,Z:Au,"%":Ab};function N(e,t){return function(n){var r,i,a,o=[],s=-1,l=0,c=e.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===e.charCodeAt(s)&&(o.push(e.slice(l,s)),null!=(i=T4[r=e.charAt(++s)])?r=e.charAt(++s):i="e"===r?" ":"0",(a=t[r])&&(r=a(n,i)),o.push(r),l=s+1);return o.push(e.slice(l,s)),o.join("")}}function k(e,t){return function(n){var r,i,a=T3(1900,void 0,1);if(C(a,e,n+="",0)!=n.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(!t||"Z"in a||(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(r=(i=(r=T5(T3(a.y,0,1))).getUTCDay())>4||0===i?TI.ceil(r):TI(r),r=TH.offset(r,(a.V-1)*7),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(r=(i=(r=T2(T3(a.y,0,1))).getDay())>4||0===i?TS.ceil(r):TS(r),r=TU.offset(r,(a.V-1)*7),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:+("W"in a)),i="Z"in a?T5(T3(a.y,0,1)).getUTCDay():T2(T3(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,T5(a)):T2(a)}}function C(e,t,n,r){for(var i,a,o=0,s=t.length,l=n.length;o<s;){if(r>=l)return -1;if(37===(i=t.charCodeAt(o++))){if(!(a=j[(i=t.charAt(o++))in T4?t.charAt(o++):i])||(r=a(e,n,r))<0)return -1}else if(i!=n.charCodeAt(r++))return -1}return r}return b.x=N(n,b),b.X=N(r,b),b.c=N(t,b),w.x=N(n,w),w.X=N(r,w),w.c=N(t,w),{format:function(e){var t=N(e+="",b);return t.toString=function(){return e},t},parse:function(e){var t=k(e+="",!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=N(e+="",w);return t.toString=function(){return e},t},utcParse:function(e){var t=k(e+="",!0);return t.toString=function(){return e},t}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,U.parse,W=U.utcFormat,U.utcParse,e.s(["scaleBand",0,_B,"scaleDiverging",0,Og,"scaleDivergingLog",0,Ov,"scaleDivergingPow",0,Oy,"scaleDivergingSqrt",0,Ob,"scaleDivergingSymlog",0,Ox,"scaleIdentity",0,S0,"scaleImplicit",0,_I,"scaleLinear",0,SJ,"scaleLog",0,S9,"scaleOrdinal",0,_R,"scalePoint",0,_z,"scalePow",0,Tl,"scaleQuantile",0,Tg,"scaleQuantize",0,Tv,"scaleRadial",0,Td,"scaleSequential",0,Oc,"scaleSequentialLog",0,Ou,"scaleSequentialPow",0,Oh,"scaleSequentialQuantile",0,Op,"scaleSequentialSqrt",0,Of,"scaleSequentialSymlog",0,Od,"scaleSqrt",0,Tc,"scaleSymlog",0,Tr,"scaleThreshold",0,Tx,"scaleTime",0,Oa,"scaleUtc",0,Oo,"tickFormat",0,SZ],29061),e.i(29061),e.s(["scaleBand",0,_B,"scaleDiverging",0,Og,"scaleDivergingLog",0,Ov,"scaleDivergingPow",0,Oy,"scaleDivergingSqrt",0,Ob,"scaleDivergingSymlog",0,Ox,"scaleIdentity",0,S0,"scaleImplicit",0,_I,"scaleLinear",0,SJ,"scaleLog",0,S9,"scaleOrdinal",0,_R,"scalePoint",0,_z,"scalePow",0,Tl,"scaleQuantile",0,Tg,"scaleQuantize",0,Tv,"scaleRadial",0,Td,"scaleSequential",0,Oc,"scaleSequentialLog",0,Ou,"scaleSequentialPow",0,Oh,"scaleSequentialQuantile",0,Op,"scaleSequentialSqrt",0,Of,"scaleSequentialSymlog",0,Od,"scaleSqrt",0,Tc,"scaleSymlog",0,Tr,"scaleThreshold",0,Tx,"scaleTime",0,Oa,"scaleUtc",0,Oo,"tickFormat",0,SZ],79357);var Ow=e.i(79357),Oj=e=>e.chartData,ON=N7([Oj],e=>{var t=null!=e.chartData?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Ok=(e,t,n,r)=>r?ON(e):Oj(e);function OC(e){if(Array.isArray(e)&&2===e.length){var[t,n]=e;if(EU(t)&&EU(n))return!0}return!1}function OE(e,t,n){return n?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function O_(e,t){if(t&&"function"!=typeof e&&Array.isArray(e)&&2===e.length){var n,r,[i,a]=e;if(EU(i))n=i;else if("function"==typeof i)return;if(EU(a))r=a;else if("function"==typeof a)return;var o=[n,r];if(OC(o))return o}}var OS=e.i(51655),OT=e=>e,OA={},OO=e=>function t(){let n;return 0==arguments.length||1==arguments.length&&(n=arguments.length<=0?void 0:arguments[0],n===OA)?t:e(...arguments)},OM=(e,t)=>1===e?t:OO(function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var a=r.filter(e=>e!==OA).length;return a>=e?t(...r):OM(e-a,OO(function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t(...r.map(e=>e===OA?n.shift():e),...n)}))}),OP=(e,t)=>{for(var n=[],r=e;r<t;++r)n[r-e]=r;return n},OD=OM((a=(e,t)=>Array.isArray(t)?t.map(e):Object.keys(t).map(e=>t[e]).map(e)).length,a),OL=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.length)return OT;var r=t.reverse(),i=r[0],a=r.slice(1);return function(){return a.reduce((e,t)=>t(e),i(...arguments))}};function OI(e){return 0===e?1:Math.floor(new OS.default(e).abs().log(10).toNumber())+1}function OR(e,t,n){for(var r=new OS.default(e),i=0,a=[];r.lt(t)&&i<1e5;)a.push(r.toNumber()),r=r.add(n),i++;return a}var OB=e=>{var[t,n]=e,[r,i]=[t,n];return t>n&&([r,i]=[n,t]),[r,i]},Oz=(e,t,n)=>{if(e.lte(0))return new OS.default(0);var r=OI(e.toNumber()),i=new OS.default(10).pow(r),a=e.div(i),o=1!==r?.05:.1,s=new OS.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return new OS.default(t?s.toNumber():Math.ceil(s.toNumber()))},OF=function(e,t,n,r){var i,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new OS.default(0),tickMin:new OS.default(0),tickMax:new OS.default(0)};var o=Oz(new OS.default(t).sub(e).div(n-1),r,a),s=Math.ceil((i=e<=0&&t>=0?new OS.default(0):(i=new OS.default(e).add(t).div(2)).sub(new OS.default(i).mod(o))).sub(e).div(o).toNumber()),l=Math.ceil(new OS.default(t).sub(i).div(o).toNumber()),c=s+l+1;return c>n?OF(e,t,n,r,a+1):(c<n&&(l=t>0?l+(n-c):l,s=t>0?s:s+(n-c)),{step:o,tickMin:i.sub(new OS.default(s).mul(o)),tickMax:i.add(new OS.default(l).mul(o))})},OV=function(e){var[t,n]=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(r,2),[o,s]=OB([t,n]);if(o===-1/0||s===1/0){var l=s===1/0?[o,...OP(0,r-1).map(()=>1/0)]:[...OP(0,r-1).map(()=>-1/0),s];return t>n?l.reverse():l}if(o===s){var c=new OS.default(1),u=new OS.default(o);if(!u.isint()&&i){var d=Math.abs(o);d<1?(c=new OS.default(10).pow(OI(o)-1),u=new OS.default(Math.floor(u.div(c).toNumber())).mul(c)):d>1&&(u=new OS.default(Math.floor(o)))}else 0===o?u=new OS.default(Math.floor((r-1)/2)):i||(u=new OS.default(Math.floor(o)));var h=Math.floor((r-1)/2);return OL(OD(e=>u.add(new OS.default(e-h).mul(c)).toNumber()),OP)(0,r)}var{step:f,tickMin:p,tickMax:g}=OF(o,s,a,i,0),v=OR(p,g.add(new OS.default(.1).mul(f)),f);return t>n?v.reverse():v},OU=function(e,t){var[n,r]=e,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],[a,o]=OB([n,r]);if(a===-1/0||o===1/0)return[n,r];if(a===o)return[a];var s=Math.max(t,2),l=Oz(new OS.default(o).sub(a).div(s-1),i,0),c=[...OR(new OS.default(a),new OS.default(o),l),o];return!1===i&&(c=c.map(e=>Math.round(e))),n>r?c.reverse():c},OH=e=>e.rootProps.stackOffset,OW=e=>e.rootProps.reverseStackOrder,OY=e=>e.options.chartName,OG=e=>e.rootProps.syncId,O$=e=>e.rootProps.syncMethod,OX=e=>e.options.eventEmitter;function Oq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function OK(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Oq(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Oq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var OZ=Math.PI/180,OQ=(e,t,n,r)=>({x:e+Math.cos(-OZ*r)*n,y:t+Math.sin(-OZ*r)*n}),OJ={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},O0={allowDecimals:!1,allowDuplicatedCategory:!0,angleAxisId:0,axisLine:!0,axisLineType:"polygon",cx:0,cy:0,orientation:"outer",reversed:!1,scale:"auto",tick:!0,tickLine:!0,tickSize:8,type:"category",zIndex:OJ.axis},O1={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,angle:0,axisLine:!0,includeHidden:!1,hide:!1,label:!1,orientation:"right",radiusAxisId:0,reversed:!1,scale:"auto",stroke:"#ccc",tick:!0,tickCount:5,type:"number",zIndex:OJ.axis},O2=(e,t)=>{if(e&&t)return null!=e&&e.reversed?[t[1],t[0]]:t},O5={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:O0.angleAxisId,includeHidden:!1,name:void 0,reversed:O0.reversed,scale:O0.scale,tick:O0.tick,tickCount:void 0,ticks:void 0,type:O0.type,unit:void 0},O3={allowDataOverflow:O1.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:O1.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:O1.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:O1.scale,tick:O1.tick,tickCount:O1.tickCount,ticks:void 0,type:O1.type,unit:void 0},O4={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:O0.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:O0.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:O0.scale,tick:O0.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},O6={allowDataOverflow:O1.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:O1.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:O1.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:O1.scale,tick:O1.tick,tickCount:O1.tickCount,ticks:void 0,type:"category",unit:void 0},O8=(e,t)=>null!=e.polarAxis.angleAxis[t]?e.polarAxis.angleAxis[t]:"radial"===e.layout.layoutType?O4:O5,O7=(e,t)=>null!=e.polarAxis.radiusAxis[t]?e.polarAxis.radiusAxis[t]:"radial"===e.layout.layoutType?O6:O3,O9=e=>e.polarOptions,Me=N7([E5,E3,_t],function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0,width:0,height:0,brushBottom:0};return Math.min(Math.abs(e-(n.left||0)-(n.right||0)),Math.abs(t-(n.top||0)-(n.bottom||0)))/2}),Mt=N7([O9,Me],(e,t)=>{if(null!=e)return Ct(e.innerRadius,t,0)}),Mn=N7([O9,Me],(e,t)=>{if(null!=e)return Ct(e.outerRadius,t,.8*t)}),Mr=N7([O9],e=>{if(null==e)return[0,0];var{startAngle:t,endAngle:n}=e;return[t,n]});N7([O8,Mr],O2);var Mi=N7([Me,Mt,Mn],(e,t,n)=>{if(null!=e&&null!=t&&null!=n)return[t,n]});N7([O7,Mi],O2);var Ma=N7([_S,O9,Mt,Mn,E5,E3],(e,t,n,r,i,a)=>{if(("centric"===e||"radial"===e)&&null!=t&&null!=n&&null!=r){var{cx:o,cy:s,startAngle:l,endAngle:c}=t;return{cx:Ct(o,i,i/2),cy:Ct(s,a,a/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),Mo=(e,t)=>t,Ms=(e,t,n)=>n;function Ml(e){return null==e?void 0:e.id}function Mc(e,t,n){var{chartData:r=[]}=t,{allowDuplicatedCategory:i,dataKey:a}=n,o=new Map;return e.forEach(e=>{var t,n=null!=(t=e.data)?t:r;if(null!=n&&0!==n.length){var s=Ml(e);n.forEach((t,n)=>{var r,l=null==a||i?n:String(EG(t,a,null)),c=EG(t,e.dataKey,0);Object.assign(r=o.has(l)?o.get(l):{},{[s]:c}),o.set(l,r)})}}),Array.from(o.values())}function Mu(e){return"stackId"in e&&null!=e.stackId&&null!=e.dataKey}var Md=(e,t)=>e===t||null!=e&&null!=t&&e[0]===t[0]&&e[1]===t[1];function Mh(e,t){return!!(Array.isArray(e)&&Array.isArray(t))&&0===e.length&&0===t.length||e===t}var Mf=e=>{var t=_S(e);return"horizontal"===t?"xAxis":"vertical"===t?"yAxis":"centric"===t?"angleAxis":"radiusAxis"},Mp=e=>e.tooltip.settings.axisId;function Mm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Mg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mm(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mm(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Mv=[0,"auto"],Mx={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0},My=(e,t)=>e.cartesianAxis.xAxis[t],Mb=(e,t)=>{var n=My(e,t);return null==n?Mx:n},Mw={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Mv,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:60},Mj=(e,t)=>e.cartesianAxis.yAxis[t],MN=(e,t)=>{var n=Mj(e,t);return null==n?Mw:n},Mk={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},MC=(e,t)=>{var n=e.cartesianAxis.zAxis[t];return null==n?Mk:n},ME=(e,t,n)=>{switch(t){case"xAxis":return Mb(e,n);case"yAxis":return MN(e,n);case"zAxis":return MC(e,n);case"angleAxis":return O8(e,n);case"radiusAxis":return O7(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},M_=(e,t,n)=>{switch(t){case"xAxis":return Mb(e,n);case"yAxis":return MN(e,n);case"angleAxis":return O8(e,n);case"radiusAxis":return O7(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},MS=e=>e.graphicalItems.cartesianItems.some(e=>"bar"===e.type)||e.graphicalItems.polarItems.some(e=>"radialBar"===e.type);function MT(e,t){return n=>{switch(e){case"xAxis":return"xAxisId"in n&&n.xAxisId===t;case"yAxis":return"yAxisId"in n&&n.yAxisId===t;case"zAxis":return"zAxisId"in n&&n.zAxisId===t;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===t;default:return!1}}}var MA=e=>e.graphicalItems.cartesianItems,MO=N7([Mo,Ms],MT),MM=(e,t,n)=>e.filter(n).filter(e=>(null==t?void 0:t.includeHidden)===!0||!e.hide),MP=N7([MA,ME,MO],MM,{memoizeOptions:{resultEqualityCheck:Mh}}),MD=N7([MP],e=>e.filter(e=>"area"===e.type||"bar"===e.type).filter(Mu)),ML=e=>e.filter(e=>!("stackId"in e)||void 0===e.stackId),MI=N7([MP],ML),MR=e=>e.map(e=>e.data).filter(Boolean).flat(1),MB=N7([MP],MR,{memoizeOptions:{resultEqualityCheck:Mh}}),Mz=(e,t)=>{var{chartData:n=[],dataStartIndex:r,dataEndIndex:i}=t;return e.length>0?e:n.slice(r,i+1)},MF=N7([MB,Ok],Mz),MV=(e,t,n)=>(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:EG(e,t.dataKey)})):n.length>0?n.map(e=>e.dataKey).flatMap(t=>e.map(e=>({value:EG(e,t)}))):e.map(e=>({value:e})),MU=N7([MF,ME,MP],MV);function MH(e,t){switch(e){case"xAxis":return"x"===t.direction;case"yAxis":return"y"===t.direction;default:return!1}}function MW(e){if(k7(e)||e instanceof Date){var t=Number(e);if(EU(t))return t}}function MY(e){if(Array.isArray(e)){var t=[MW(e[0]),MW(e[1])];return OC(t)?t:void 0}var n=MW(e);if(null!=n)return[n,n]}function MG(e){return e.map(MW).filter(Co)}var M$=e=>{var t=Mf(e),n=Mp(e);return M_(e,t,n)},MX=N7([M$],e=>null==e?void 0:e.dataKey),Mq=N7([MD,Ok,M$],Mc),MK=(e,t,n,r)=>Object.fromEntries(Object.entries(t.reduce((e,t)=>{if(null==t.stackId)return e;var n=e[t.stackId];return null==n&&(n=[]),n.push(t),e[t.stackId]=n,e},{})).map(t=>{var i,a,o,[s,l]=t,c=r?[...l].reverse():l,u=c.map(Ml);return[s,{stackedData:(a=null!=(i=EK[n])?i:ER,(o=(function(){var e=EI([]),t=EB,n=ER,r=Ez;function i(i){var a,o,s=Array.from(e.apply(this,arguments),EF),l=s.length,c=-1;for(let e of i)for(a=0,++c;a<l;++a)(s[a][c]=[0,+r(e,s[a].key,c,i)]).data=e;for(a=0,o=EL(t(s));a<l;++a)s[o[a]].index=a;return n(s,o),s}return i.keys=function(t){return arguments.length?(e="function"==typeof t?t:EI(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r="function"==typeof e?e:EI(+e),i):r},i.order=function(e){return arguments.length?(t=null==e?EB:"function"==typeof e?e:EI(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=null==e?ER:e,i):n},i})().keys(u).value((e,t)=>Number(EG(e,t,0))).order(EB).offset(a)(e)).forEach((t,n)=>{t.forEach((t,r)=>{var i=EG(e[r],u[n],0);Array.isArray(i)&&2===i.length&&k8(i[0])&&k8(i[1])&&(t[0]=i[0],t[1]=i[1])})}),o),graphicalItems:c}]})),MZ=N7([Mq,MD,OH,OW],MK),MQ=(e,t,n,r)=>{var{dataStartIndex:i,dataEndIndex:a}=t;if(null==r&&"zAxis"!==n){var o=((e,t,n)=>{if(null!=e){let r;return[(r=Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i,a=[Math.min(...i=EV(r,t,n).flat(2).filter(k8)),Math.max(...i)];return EU(a[0])&&EU(a[1])?[Math.min(e[0],a[0]),Math.max(e[1],a[1])]:e},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))[0]===1/0?0:r[0],r[1]===-1/0?0:r[1]]}})(e,i,a);if(null==o||0!==o[0]||0!==o[1])return o}},MJ=N7([ME],e=>e.allowDataOverflow),M0=e=>{var t;if(null==e||!("domain"in e))return Mv;if(null!=e.domain)return e.domain;if("ticks"in e&&null!=e.ticks){if("number"===e.type){var n=MG(e.ticks);return[Math.min(...n),Math.max(...n)]}if("category"===e.type)return e.ticks.map(String)}return null!=(t=null==e?void 0:e.domain)?t:Mv},M1=N7([ME],M0),M2=N7([M1,MJ],O_),M5=N7([MZ,Oj,Mo,M2],MQ,{memoizeOptions:{resultEqualityCheck:Md}}),M3=e=>e.errorBars,M4=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.filter(Boolean);if(0!==r.length){var i=r.flat();return[Math.min(...i),Math.max(...i)]}},M6=(e,t,n,r,i)=>{var a,o;if(n.length>0&&e.forEach(e=>{n.forEach(n=>{var s,l,c=null==(s=r[n.id])?void 0:s.filter(e=>MH(i,e)),u=EG(e,null!=(l=t.dataKey)?l:n.dataKey),d=!(!c||"number"!=typeof u||k4(u))&&c.length?MG(c.flatMap(t=>{var n,r,i=EG(e,t.dataKey);if(Array.isArray(i)?[n,r]=i:n=r=i,EU(n)&&EU(r))return[u-n,u+r]})):[];if(d.length>=2){var h=Math.min(...d),f=Math.max(...d);(null==a||h<a)&&(a=h),(null==o||f>o)&&(o=f)}var p=MY(u);null!=p&&(a=null==a?p[0]:Math.min(a,p[0]),o=null==o?p[1]:Math.max(o,p[1]))})}),(null==t?void 0:t.dataKey)!=null&&e.forEach(e=>{var n=MY(EG(e,t.dataKey));null!=n&&(a=null==a?n[0]:Math.min(a,n[0]),o=null==o?n[1]:Math.max(o,n[1]))}),EU(a)&&EU(o))return[a,o]},M8=N7([MF,ME,MI,M3,Mo],M6,{memoizeOptions:{resultEqualityCheck:Md}});function M7(e){var{value:t}=e;if(k7(t)||t instanceof Date)return t}var M9=e=>e.referenceElements.dots,Pe=(e,t,n)=>e.filter(e=>"extendDomain"===e.ifOverflow).filter(e=>"xAxis"===t?e.xAxisId===n:e.yAxisId===n),Pt=N7([M9,Mo,Ms],Pe),Pn=e=>e.referenceElements.areas,Pr=N7([Pn,Mo,Ms],Pe),Pi=e=>e.referenceElements.lines,Pa=N7([Pi,Mo,Ms],Pe),Po=(e,t)=>{if(null!=e){var n=MG(e.map(e=>"xAxis"===t?e.x:e.y));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Ps=N7(Pt,Mo,Po),Pl=(e,t)=>{if(null!=e){var n=MG(e.flatMap(e=>["xAxis"===t?e.x1:e.y1,"xAxis"===t?e.x2:e.y2]));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Pc=N7([Pr,Mo],Pl),Pu=(e,t)=>{if(null!=e){var n=e.flatMap(e=>"xAxis"===t?function(e){if(null!=e.x)return MG([e.x]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.x);return null==n||0===n.length?[]:MG(n)}(e):function(e){if(null!=e.y)return MG([e.y]);var t,n=null==(t=e.segment)?void 0:t.map(e=>e.y);return null==n||0===n.length?[]:MG(n)}(e));if(0!==n.length)return[Math.min(...n),Math.max(...n)]}},Pd=N7([Pa,Mo],Pu),Ph=N7(Ps,Pd,Pc,(e,t,n)=>M4(e,n,t)),Pf=(e,t,n,r,i,a,o,s)=>null!=n?n:function(e,t,n){if(n||null!=t){if("function"==typeof e&&null!=t)try{var r=e(t,n);if(OC(r))return OE(r,t,n)}catch(e){}if(Array.isArray(e)&&2===e.length){var i,a,[o,s]=e;if("auto"===o)null!=t&&(i=Math.min(...t));else if(k8(o))i=o;else if("function"==typeof o)try{null!=t&&(i=o(null==t?void 0:t[0]))}catch(e){}else if("string"==typeof o&&EQ.test(o)){var l=EQ.exec(o);if(null==l||null==l[1]||null==t)i=void 0;else{var c=+l[1];i=t[0]-c}}else i=null==t?void 0:t[0];if("auto"===s)null!=t&&(a=Math.max(...t));else if(k8(s))a=s;else if("function"==typeof s)try{null!=t&&(a=s(null==t?void 0:t[1]))}catch(e){}else if("string"==typeof s&&EJ.test(s)){var u=EJ.exec(s);if(null==u||null==u[1]||null==t)a=void 0;else{var d=+u[1];a=t[1]+d}}else a=null==t?void 0:t[1];var h=[i,a];if(OC(h))return null==t?h:OE(h,t,n)}}}(t,"vertical"===o&&"xAxis"===s||"horizontal"===o&&"yAxis"===s?M4(r,a,i):M4(a,i),e.allowDataOverflow),Pp=N7([ME,M1,M2,M5,M8,Ph,_S,Mo],Pf,{memoizeOptions:{resultEqualityCheck:Md}}),Pm=[0,1],Pg=(e,t,n,r,i,a,o)=>{if(null!=e&&null!=n&&0!==n.length||void 0!==o){var s,l,{dataKey:c,type:u}=e,d=E$(t,a);return d&&null==c?(0,_A.default)(0,null!=(l=null==n?void 0:n.length)?l:0):"category"===u?(s=r.map(M7).filter(e=>null!=e),d&&(null==e.dataKey||e.allowDuplicatedCategory&&Cn(s))?(0,_A.default)(0,r.length):e.allowDuplicatedCategory?s:Array.from(new Set(s))):"expand"===i?Pm:o}},Pv=N7([ME,_S,MF,MU,OH,Mo,Pp],Pg),Px=(e,t,n,r,i)=>{if(null!=e){var{scale:a,type:o}=e;if("auto"===a)return"radial"===t&&"radiusAxis"===i?"band":"radial"===t&&"angleAxis"===i?"linear":"category"===o&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?"point":"category"===o?"band":"linear";if("string"==typeof a){var s="scale".concat(Ca(a));return s in Ow?s:"point"}}},Py=N7([ME,_S,MS,OY,Mo],Px);function Pb(e,t,n,r){if(null!=n&&null!=r){if("function"==typeof e.scale)return e.scale.copy().domain(n).range(r);var i=function(e){if(null!=e){if(e in Ow)return Ow[e]();var t="scale".concat(Ca(e));if(t in Ow)return Ow[t]()}}(t);if(null!=i){var a=i.domain(n).range(r);return(e=>{var t=e.domain();if(t&&!(t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-1e-4,a=Math.max(r[0],r[1])+1e-4,o=e(t[0]),s=e(t[n-1]);(o<i||o>a||s<i||s>a)&&e.domain([t[0],t[n-1]])}})(a),a}}}var Pw=(e,t,n)=>{var r=M0(t);if("auto"===n||"linear"===n){if(null!=t&&t.tickCount&&Array.isArray(r)&&("auto"===r[0]||"auto"===r[1])&&OC(e))return OV(e,t.tickCount,t.allowDecimals);if(null!=t&&t.tickCount&&"number"===t.type&&OC(e))return OU(e,t.tickCount,t.allowDecimals)}},Pj=N7([Pv,M_,Py],Pw),PN=(e,t,n,r)=>"angleAxis"!==r&&(null==e?void 0:e.type)==="number"&&OC(t)&&Array.isArray(n)&&n.length>0?[Math.min(t[0],n[0]),Math.max(t[1],n[n.length-1])]:t,Pk=N7([ME,Pv,Pj,Mo],PN),PC=N7(MU,ME,(e,t)=>{if(t&&"number"===t.type){var n=1/0,r=Array.from(MG(e.map(e=>e.value))).sort((e,t)=>e-t),i=r[0],a=r[r.length-1];if(null==i||null==a)return 1/0;var o=a-i;if(0===o)return 1/0;for(var s=0;s<r.length-1;s++){var l=r[s],c=r[s+1];null!=l&&null!=c&&(n=Math.min(n,c-l))}return n/o}}),PE=N7(PC,_S,e=>e.rootProps.barCategoryGap,_t,(e,t,n,r,i)=>i,(e,t,n,r,i)=>{if(!EU(e))return 0;var a="vertical"===t?r.height:r.width;if("gap"===i)return e*a/2;if("no-gap"===i){var o=Ct(n,e*a),s=e*a/2;return s-o-(s-o)/a*o}return 0}),P_=N7(Mb,(e,t,n)=>{var r=Mb(e,t);return null==r||"string"!=typeof r.padding?0:PE(e,"xAxis",t,n,r.padding)},(e,t)=>{if(null==e)return{left:0,right:0};var n,r,{padding:i}=e;return"string"==typeof i?{left:t,right:t}:{left:(null!=(n=i.left)?n:0)+t,right:(null!=(r=i.right)?r:0)+t}}),PS=N7(MN,(e,t,n)=>{var r=MN(e,t);return null==r||"string"!=typeof r.padding?0:PE(e,"yAxis",t,n,r.padding)},(e,t)=>{if(null==e)return{top:0,bottom:0};var n,r,{padding:i}=e;return"string"==typeof i?{top:t,bottom:t}:{top:(null!=(n=i.top)?n:0)+t,bottom:(null!=(r=i.bottom)?r:0)+t}}),PT=N7([_t,P_,_s,_o,(e,t,n)=>n],(e,t,n,r,i)=>{var{padding:a}=r;return i?[a.left,n.width-a.right]:[e.left+t.left,e.left+e.width-t.right]}),PA=N7([_t,_S,PS,_s,_o,(e,t,n)=>n],(e,t,n,r,i,a)=>{var{padding:o}=i;return a?[r.height-o.bottom,o.top]:"horizontal"===t?[e.top+e.height-n.bottom,e.top+n.top]:[e.top+n.top,e.top+e.height-n.bottom]}),PO=(e,t,n,r)=>{var i;switch(t){case"xAxis":return PT(e,n,r);case"yAxis":return PA(e,n,r);case"zAxis":return null==(i=MC(e,n))?void 0:i.range;case"angleAxis":return Mr(e);case"radiusAxis":return Mi(e,n);default:return}},PM=N7([ME,PO],O2),PP=N7([ME,Py,Pk,PM],Pb);function PD(e,t){return e.id<t.id?-1:+(e.id>t.id)}N7([MP,M3,Mo],(e,t,n)=>e.flatMap(e=>t[e.id]).filter(Boolean).filter(e=>MH(n,e)));var PL=(e,t)=>t,PI=(e,t,n)=>n,PR=N7(E8,PL,PI,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(PD)),PB=N7(E7,PL,PI,(e,t,n)=>e.filter(e=>e.orientation===t).filter(e=>e.mirror===n).sort(PD)),Pz=(e,t)=>({width:e.width,height:t.height}),PF=N7(_t,Mb,Pz),PV=N7(E3,_t,PR,PL,PI,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s=Pz(t,n);null==a&&(a=((e,t,n)=>{switch(t){case"top":return e.top;case"bottom":return n-e.bottom;default:return 0}})(t,r,e));var l="top"===r&&!i||"bottom"===r&&i;o[n.id]=a-Number(l)*s.height,a+=(l?-1:1)*s.height}),o}),PU=N7(E5,_t,PB,PL,PI,(e,t,n,r,i)=>{var a,o={};return n.forEach(n=>{var s={width:"number"==typeof n.width?n.width:60,height:t.height};null==a&&(a=((e,t,n)=>{switch(t){case"left":return e.left;case"right":return n-e.right;default:return 0}})(t,r,e));var l="left"===r&&!i||"right"===r&&i;o[n.id]=a-Number(l)*s.width,a+=(l?-1:1)*s.width}),o}),PH=N7([_t,Mb,(e,t)=>{var n=Mb(e,t);if(null!=n)return PV(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:e.left,y:0}:{x:e.left,y:i}}}),PW=N7([_t,MN,(e,t)=>{var n=MN(e,t);if(null!=n)return PU(e,n.orientation,n.mirror)},(e,t)=>t],(e,t,n,r)=>{if(null!=t){var i=null==n?void 0:n[r];return null==i?{x:0,y:e.top}:{x:i,y:e.top}}}),PY=N7(_t,MN,(e,t)=>({width:"number"==typeof t.width?t.width:60,height:e.height})),PG=(e,t,n,r)=>{if(null!=n){var{allowDuplicatedCategory:i,type:a,dataKey:o}=n,s=E$(e,r),l=t.map(e=>e.value);if(o&&s&&"category"===a&&i&&Cn(l))return l}},P$=N7([_S,MU,ME,Mo],PG),PX=(e,t,n,r)=>{if(null!=n&&null!=n.dataKey){var{type:i,scale:a}=n;if(E$(e,r)&&("number"===i||"auto"!==a))return t.map(e=>e.value)}},Pq=N7([_S,MU,M_,Mo],PX),PK=N7([_S,(e,t,n)=>{switch(t){case"xAxis":return Mb(e,n);case"yAxis":return MN(e,n);default:throw Error("Unexpected axis type: ".concat(t))}},Py,PP,P$,Pq,PO,Pj,Mo],(e,t,n,r,i,a,o,s,l)=>{if(null!=t){var c=E$(e,l);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:l,categoricalDomain:a,duplicateDomain:i,isCategorical:c,niceTicks:s,range:o,realScaleType:n,scale:r}}}),PZ=N7([_S,M_,Py,PP,Pj,PO,P$,Pq,Mo],(e,t,n,r,i,a,o,s,l)=>{if(null!=t&&null!=r){var c=E$(e,l),{type:u,ticks:d,tickCount:h}=t,f="scaleBand"===n&&"function"==typeof r.bandwidth?r.bandwidth()/2:2,p="category"===u&&r.bandwidth?r.bandwidth()/f:0;p="angleAxis"===l&&null!=a&&a.length>=2?2*k3(a[0]-a[1])*p:p;var g=d||i;return g?g.map((e,t)=>({index:t,coordinate:r(o?o.indexOf(e):e)+p,value:e,offset:p})).filter(e=>EU(e.coordinate)):c&&s?s.map((e,t)=>({coordinate:r(e)+p,value:e,index:t,offset:p})).filter(e=>EU(e.coordinate)):r.ticks?r.ticks(h).map(e=>({coordinate:r(e)+p,value:e,offset:p})):r.domain().map((e,t)=>({coordinate:r(e)+p,value:o?o[e]:e,index:t,offset:p}))}}),PQ=N7([_S,M_,PP,PO,P$,Pq,Mo],(e,t,n,r,i,a,o)=>{if(null!=t&&null!=n&&null!=r&&r[0]!==r[1]){var s=E$(e,o),{tickCount:l}=t,c=0;return(c="angleAxis"===o&&(null==r?void 0:r.length)>=2?2*k3(r[0]-r[1])*c:c,s&&a)?a.map((e,t)=>({coordinate:n(e)+c,value:e,index:t,offset:c})):n.ticks?n.ticks(l).map(e=>({coordinate:n(e)+c,value:e,offset:c})):n.domain().map((e,t)=>({coordinate:n(e)+c,value:i?i[e]:e,index:t,offset:c}))}}),PJ=N7(ME,PP,(e,t)=>{if(null!=e&&null!=t)return Mg(Mg({},e),{},{scale:t})}),P0=N7([ME,Py,Pv,PM],Pb);N7((e,t,n)=>MC(e,n),P0,(e,t)=>{if(null!=e&&null!=t)return Mg(Mg({},e),{},{scale:t})});var P1=N7([_S,E8,E7],(e,t,n)=>{switch(e){case"horizontal":return t.some(e=>e.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(e=>e.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),P2=e=>e.options.defaultTooltipEventType,P5=e=>e.options.validateTooltipEventTypes;function P3(e,t,n){if(null==e)return t;var r=e?"axis":"item";return null==n?t:n.includes(r)?r:t}function P4(e,t){return P3(t,P2(e),P5(e))}var P6=(e,t)=>{var n,r=Number(t);if(!k4(r)&&null!=t)return r>=0?null==e||null==(n=e[r])?void 0:n.value:void 0};function P8(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function P7(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P8(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P8(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var P9=(e,t,n,r)=>{if(null==t)return C9;var i,a,o,s=(i=e,a=t,o=n,"axis"===a?"click"===o?i.axisInteraction.click:i.axisInteraction.hover:"click"===o?i.itemInteraction.click:i.itemInteraction.hover);if(null==s)return C9;if(s.active)return s;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&null!=e.syncInteraction.index)return e.syncInteraction;var l=!0===e.settings.active;if(null!=s.index){if(l)return P7(P7({},s),{},{active:!0})}else if(null!=r)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return P7(P7({},C9),{},{coordinate:s.coordinate})},De=(e,t,n,r)=>{var i=null==e?void 0:e.index;if(null==i)return null;var a=Number(i);if(!EU(a))return i;var o=Infinity;t.length>0&&(o=t.length-1);var s=Math.max(0,Math.min(a,o)),l=t[s];return null==l?String(s):!function(e,t,n){if(null==n||null==t)return!0;var r=EG(e,t);return!(null!=r&&OC(n))||function(e,t){var n=function(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var n=Number(e);return Number.isFinite(n)?n:void 0}(e),r=t[0],i=t[1];if(void 0===n)return!1;var a=Math.min(r,i),o=Math.max(r,i);return n>=a&&n<=o}(r,n)}(l,n,r)?null:String(s)},Dt=(e,t,n,r,i,a,o,s)=>{if(null!=a&&null!=s){var l=o[0],c=null==l?void 0:s(l.positions,a);if(null!=c)return c;var u=null==i?void 0:i[Number(a)];if(u)if("horizontal"===n)return{x:u.coordinate,y:(r.top+t)/2};else return{x:(r.left+e)/2,y:u.coordinate}}},Dn=(e,t,n,r)=>{if("axis"===t)return e.tooltipItemPayloads;if(0===e.tooltipItemPayloads.length)return[];if(null==(i="hover"===n?e.itemInteraction.hover.graphicalItemId:e.itemInteraction.click.graphicalItemId)&&null!=r){var i,a=e.tooltipItemPayloads[0];return null!=a?[a]:[]}return e.tooltipItemPayloads.filter(e=>{var t;return(null==(t=e.settings)?void 0:t.graphicalItemId)===i})},Dr=e=>e.options.tooltipPayloadSearcher,Di=e=>e.tooltip;function Da(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Do(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Da(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Da(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ds=(e,t,n,r,i,a,o)=>{if(null!=t&&null!=a){var{chartData:s,computedData:l,dataStartIndex:c,dataEndIndex:u}=n;return e.reduce((e,n)=>{var d,h,f,{dataDefinedOnItem:p,settings:g}=n,v=null!=p?p:s,x=Array.isArray(v)?EV(v,c,u):v,y=null!=(d=null==g?void 0:g.dataKey)?d:r,b=null==g?void 0:g.nameKey;return Array.isArray(h=r&&Array.isArray(x)&&!Array.isArray(x[0])&&"axis"===o?Ci(x,r,i):a(x,t,l,b))?h.forEach(t=>{var n=Do(Do({},g),{},{name:t.name,unit:t.unit,color:void 0,fill:void 0});e.push(E1({tooltipEntrySettings:n,dataKey:t.dataKey,payload:t.payload,value:EG(t.payload,t.dataKey),name:t.name}))}):e.push(E1({tooltipEntrySettings:g,dataKey:y,payload:h,value:EG(h,y),name:null!=(f=EG(h,b))?f:null==g?void 0:g.name})),e},[])}},Dl=N7([M$,_S,MS,OY,Mf],Px),Dc=N7([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),Du=N7([Mf,Mp],MT),Dd=N7([Dc,M$,Du],MM,{memoizeOptions:{resultEqualityCheck:Mh}}),Dh=N7([Dd],e=>e.filter(Mu)),Df=N7([Dd],MR,{memoizeOptions:{resultEqualityCheck:Mh}}),Dp=N7([Df,Oj],Mz),Dm=N7([Dh,Oj,M$],Mc),Dg=N7([Dp,M$,Dd],MV),Dv=N7([M$],M0),Dx=N7([M$],e=>e.allowDataOverflow),Dy=N7([Dv,Dx],O_),Db=N7([Dd],e=>e.filter(Mu)),Dw=N7([Dm,Db,OH,OW],MK),Dj=N7([Dw,Oj,Mf,Dy],MQ),DN=N7([Dd],ML),Dk=N7([Dp,M$,DN,M3,Mf],M6,{memoizeOptions:{resultEqualityCheck:Md}}),DC=N7([M9,Mf,Mp],Pe),DE=N7([DC,Mf],Po),D_=N7([Pn,Mf,Mp],Pe),DS=N7([D_,Mf],Pl),DT=N7([Pi,Mf,Mp],Pe),DA=N7([DT,Mf],Pu),DO=N7([DE,DA,DS],M4),DM=N7([M$,Dv,Dy,Dj,Dk,DO,_S,Mf],Pf),DP=N7([M$,_S,Dp,Dg,OH,Mf,DM],Pg),DD=N7([DP,M$,Dl],Pw),DL=N7([M$,DP,DD,Mf],PN),DI=e=>{var t=Mf(e),n=Mp(e);return PO(e,t,n,!1)},DR=N7([M$,DI],O2),DB=N7([M$,Dl,DL,DR],Pb),Dz=N7([_S,Dg,M$,Mf],PG),DF=N7([_S,Dg,M$,Mf],PX),DV=N7([_S,M$,Dl,DB,DI,Dz,DF,Mf],(e,t,n,r,i,a,o,s)=>{if(t){var{type:l}=t,c=E$(e,s);if(r){var u="scaleBand"===n&&r.bandwidth?r.bandwidth()/2:2,d="category"===l&&r.bandwidth?r.bandwidth()/u:0;return(d="angleAxis"===s&&null!=i&&(null==i?void 0:i.length)>=2?2*k3(i[0]-i[1])*d:d,c&&o)?o.map((e,t)=>({coordinate:r(e)+d,value:e,index:t,offset:d})):r.domain().map((e,t)=>({coordinate:r(e)+d,value:a?a[e]:e,index:t,offset:d}))}}}),DU=N7([P2,P5,e=>e.tooltip.settings],(e,t,n)=>P3(n.shared,e,t)),DH=e=>e.tooltip.settings.trigger,DW=e=>e.tooltip.settings.defaultIndex,DY=N7([Di,DU,DH,DW],P9),DG=N7([DY,Dp,MX,DP],De),D$=N7([DV,DG],P6),DX=N7([DY],e=>{if(e)return e.dataKey});N7([DY],e=>{if(e)return e.graphicalItemId});var Dq=N7([Di,DU,DH,DW],Dn),DK=N7([E5,E3,_S,_t,DV,DW,Dq,Dr],Dt),DZ=N7([DY,DK],(e,t)=>null!=e&&e.coordinate?e.coordinate:t),DQ=N7([DY],e=>{var t;return null!=(t=null==e?void 0:e.active)&&t}),DJ=N7([Dq,DG,Oj,MX,D$,Dr,DU],Ds),D0=N7([DJ],e=>{if(null!=e)return Array.from(new Set(e.map(e=>e.payload).filter(e=>null!=e)))});function D1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function D2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D1(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var D5=(e,t,n,r,i)=>{var a=null!=(d=null==t?void 0:t.length)?d:0;if(a<=1||null==e)return 0;if("angleAxis"===r&&null!=i&&1e-6>=Math.abs(Math.abs(i[1]-i[0])-360))for(var o=0;o<a;o++){var s=o>0?null==(h=n[o-1])?void 0:h.coordinate:null==(f=n[a-1])?void 0:f.coordinate,l=null==(p=n[o])?void 0:p.coordinate,c=o>=a-1?null==(g=n[0])?void 0:g.coordinate:null==(v=n[o+1])?void 0:v.coordinate,u=void 0;if(null!=s&&null!=l&&null!=c)if(k3(l-s)!==k3(c-l)){var d,h,f,p,g,v,x,y=[];if(k3(c-l)===k3(i[1]-i[0])){u=c;var b=l+i[1]-i[0];y[0]=Math.min(b,(b+s)/2),y[1]=Math.max(b,(b+s)/2)}else{u=s;var w=c+i[1]-i[0];y[0]=Math.min(l,(w+l)/2),y[1]=Math.max(l,(w+l)/2)}var j=[Math.min(l,(u+l)/2),Math.max(l,(u+l)/2)];if(e>j[0]&&e<=j[1]||e>=y[0]&&e<=y[1])return null==(x=n[o])?void 0:x.index}else{var N,k=Math.min(s,c),C=Math.max(s,c);if(e>(k+l)/2&&e<=(C+l)/2)return null==(N=n[o])?void 0:N.index}}else if(t)for(var E=0;E<a;E++){var _=t[E];if(null!=_){var S=t[E+1],T=t[E-1];if(0===E&&null!=S&&e<=(_.coordinate+S.coordinate)/2||E===a-1&&null!=T&&e>(_.coordinate+T.coordinate)/2||E>0&&E<a-1&&null!=T&&null!=S&&e>(_.coordinate+T.coordinate)/2&&e<=(_.coordinate+S.coordinate)/2)return _.index}}return -1},D3=(e,t)=>t,D4=(e,t,n)=>n,D6=(e,t,n,r)=>r,D8=N7(DV,e=>(0,EP.default)(e,e=>e.coordinate)),D7=N7([Di,D3,D4,D6],P9),D9=N7([D7,Dp,MX,DP],De),Le=N7([Di,D3,D4,D6],Dn),Lt=N7([E5,E3,_S,_t,DV,D6,Le,Dr],Dt),Ln=N7([D7,Lt],(e,t)=>{var n;return null!=(n=e.coordinate)?n:t}),Lr=N7([DV,D9],P6),Li=N7([Le,D9,Oj,MX,Lr,Dr,D3],Ds),La=N7([D7,D9],(e,t)=>({isActive:e.active&&null!=t,activeIndex:t})),Lo=N7([(e,t)=>t,_S,Ma,Mf,DR,DV,D8,_t],(e,t,n,r,i,a,o,s)=>{if(e&&t&&r&&i&&a){if("horizontal"===t||"vertical"===t){if(!e||!r||!i||!a)return;if(function(e,t){var{chartX:n,chartY:r}=e;return n>=t.left&&n<=t.left+t.width&&r>=t.top&&r<=t.top+t.height}(e,s)){var l=D5("horizontal"===t?e.chartX:"vertical"===t?e.chartY:void 0,o,a,r,i),c=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("horizontal"===e)return{x:i.coordinate,y:r.chartY};if("vertical"===e)return{x:r.chartX,y:i.coordinate}}return{x:0,y:0}})(t,a,l,e);return{activeIndex:String(l),activeCoordinate:c}}return}if(e&&r&&i&&a&&n){var u=((e,t)=>{var n,{chartX:r,chartY:i}=e,{radius:a,angle:o}=((e,t)=>{var{x:n,y:r}=e,{cx:i,cy:a}=t,o=((e,t)=>{var{x:n,y:r}=e,{x:i,y:a}=t;return Math.sqrt((n-i)**2+(r-a)**2)})({x:n,y:r},{x:i,y:a});if(o<=0)return{radius:o,angle:0};var s=Math.acos((n-i)/o);return r>a&&(s=2*Math.PI-s),{radius:o,angle:180*s/Math.PI,angleInRadian:s}})({x:r,y:i},t),{innerRadius:s,outerRadius:l}=t;if(a<s||a>l||0===a)return null;var{startAngle:c,endAngle:u}=(e=>{var{startAngle:t,endAngle:n}=e,r=Math.min(Math.floor(t/360),Math.floor(n/360));return{startAngle:t-360*r,endAngle:n-360*r}})(t),d=o;if(c<=u){for(;d>u;)d-=360;for(;d<c;)d+=360;n=d>=c&&d<=u}else{for(;d>c;)d-=360;for(;d<u;)d+=360;n=d>=u&&d<=c}return n?OK(OK({},t),{},{radius:a,angle:((e,t)=>{var{startAngle:n,endAngle:r}=t;return e+360*Math.min(Math.floor(n/360),Math.floor(r/360))})(d,t)}):null})(e,n);if(u){var d=D5("centric"===t?u.angle:u.radius,o,a,r,i),h=((e,t,n,r)=>{var i=t.find(e=>e&&e.index===n);if(i){if("centric"===e){var a=i.coordinate,{radius:o}=r;return D2(D2(D2({},r),OQ(r.cx,r.cy,o,a)),{},{angle:a,radius:o})}var s=i.coordinate,{angle:l}=r;return D2(D2(D2({},r),OQ(r.cx,r.cy,s,l)),{},{angle:l,radius:s})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}})(t,a,d,u);return{activeIndex:String(d),activeCoordinate:h}}return}}}),Ls=e=>{var t=e.currentTarget.getBoundingClientRect(),n=t.width/e.currentTarget.offsetWidth,r=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/n),chartY:Math.round((e.clientY-t.top)/r)}},Ll=kd("mouseClick"),Lc=kJ();Lc.startListening({actionCreator:Ll,effect:(e,t)=>{var n=e.payload,r=Lo(t.getState(),Ls(n));(null==r?void 0:r.activeIndex)!=null&&t.dispatch(Eu({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var Lu=kd("mouseMove"),Ld=kJ(),Lh=null;function Lf(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":"children"===e&&"object"==typeof t&&null!==t?"<<CHILDREN>>":t}function Lp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Lp(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}Ld.startListening({actionCreator:Lu,effect:(e,t)=>{var n=e.payload;null!==Lh&&cancelAnimationFrame(Lh);var r=Ls(n);Lh=requestAnimationFrame(()=>{var e=t.getState();if("axis"===P4(e,e.tooltip.settings.shared)){var n=Lo(e,r);(null==n?void 0:n.activeIndex)!=null?t.dispatch(Ec({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate})):t.dispatch(Es())}Lh=null})}});var Lg=kj({name:"cartesianAxis",initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:kg()},replaceXAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.xAxis[n.id]&&(n.id!==r.id&&delete e.xAxis[n.id],e.xAxis[r.id]=r)},prepare:kg()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:kg()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:kg()},replaceYAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.yAxis[n.id]&&(n.id!==r.id&&delete e.yAxis[n.id],e.yAxis[r.id]=r)},prepare:kg()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:kg()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:kg()},replaceZAxis:{reducer(e,t){var{prev:n,next:r}=t.payload;void 0!==e.zAxis[n.id]&&(n.id!==r.id&&delete e.zAxis[n.id],e.zAxis[r.id]=r)},prepare:kg()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:kg()},updateYAxisWidth(e,t){var{id:n,width:r}=t.payload,i=e.yAxis[n];if(i){var a=i.widthHistory||[];if(3===a.length&&a[0]===a[2]&&r===a[1]&&r!==i.width&&1>=Math.abs(r-a[0]))return;var o=[...a,r].slice(-3);e.yAxis[n]=Lm(Lm({},e.yAxis[n]),{},{width:r,widthHistory:o})}}}}),{addXAxis:Lv,replaceXAxis:Lx,removeXAxis:Ly,addYAxis:Lb,replaceYAxis:Lw,removeYAxis:Lj,addZAxis:LN,replaceZAxis:Lk,removeZAxis:LC,updateYAxisWidth:LE}=Lg.actions,L_=Lg.reducer,LS=kj({name:"graphicalItems",initialState:{cartesianItems:[],polarItems:[]},reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:kg()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NH(e).cartesianItems.indexOf(n);i>-1&&(e.cartesianItems[i]=r)},prepare:kg()},removeCartesianGraphicalItem:{reducer(e,t){var n=NH(e).cartesianItems.indexOf(t.payload);n>-1&&e.cartesianItems.splice(n,1)},prepare:kg()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:kg()},removePolarGraphicalItem:{reducer(e,t){var n=NH(e).polarItems.indexOf(t.payload);n>-1&&e.polarItems.splice(n,1)},prepare:kg()}}}),{addCartesianGraphicalItem:LT,replaceCartesianGraphicalItem:LA,removeCartesianGraphicalItem:LO,addPolarGraphicalItem:LM,removePolarGraphicalItem:LP}=LS.actions,LD=LS.reducer,LL=kj({name:"referenceElements",initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=NH(e).dots.findIndex(e=>e===t.payload);-1!==n&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=NH(e).areas.findIndex(e=>e===t.payload);-1!==n&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var n=NH(e).lines.findIndex(e=>e===t.payload);-1!==n&&e.lines.splice(n,1)}}}),{addDot:LI,removeDot:LR,addArea:LB,removeArea:Lz,addLine:LF,removeLine:LV}=LL.actions,LU=LL.reducer,LH={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},LW=kj({name:"brush",initialState:LH,reducers:{setBrushSettings:(e,t)=>null==t.payload?LH:t.payload}}),{setBrushSettings:LY}=LW.actions,LG=LW.reducer,L$=kj({name:"legend",initialState:{settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:kg()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=NH(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:kg()},removeLegendPayload:{reducer(e,t){var n=NH(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:kg()}}}),{setLegendSize:LX,setLegendSettings:Lq,addLegendPayload:LK,replaceLegendPayload:LZ,removeLegendPayload:LQ}=L$.actions,LJ=L$.reducer,L0={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},L1=kj({name:"rootProps",initialState:L0,reducers:{updateOptions:(e,t)=>{var n;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=null!=(n=t.payload.barGap)?n:L0.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),L2=L1.reducer,{updateOptions:L5}=L1.actions,L3=kj({name:"polarAxis",initialState:{radiusAxis:{},angleAxis:{}},reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:L4,removeRadiusAxis:L6,addAngleAxis:L8,removeAngleAxis:L7}=L3.actions,L9=L3.reducer,Ie=kj({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,t)=>t.payload}}),{updatePolarOptions:It}=Ie.actions,In=Ie.reducer,Ir=kd("keyDown"),Ii=kd("focus"),Ia=kJ();Ia.startListening({actionCreator:Ir,effect:(e,t)=>{var n=t.getState();if(!1===n.rootProps.accessibilityLayer)return;var{keyboardInteraction:r}=n.tooltip,i=e.payload;if("ArrowRight"===i||"ArrowLeft"===i||"Enter"===i){var a=De(r,Dp(n),MX(n),DP(n)),o=null==a?-1:Number(a);if(Number.isFinite(o)&&!(o<0)){var s=DV(n);if("Enter"===i){var l=Lt(n,"axis","hover",String(r.index));t.dispatch(Eh({active:!r.active,activeIndex:r.index,activeCoordinate:l}));return}var c=o+("ArrowRight"===i?1:-1)*("left-to-right"===P1(n)?1:-1);if(null!=s&&!(c>=s.length)&&!(c<0)){var u=Lt(n,"axis","hover",String(c));t.dispatch(Eh({active:!0,activeIndex:c.toString(),activeCoordinate:u}))}}}}}),Ia.startListening({actionCreator:Ii,effect:(e,t)=>{var n=t.getState();if(!1!==n.rootProps.accessibilityLayer){var{keyboardInteraction:r}=n.tooltip;if(!r.active&&null==r.index){var i=Lt(n,"axis","hover",String("0"));t.dispatch(Eh({active:!0,activeIndex:"0",activeCoordinate:i}))}}}});var Io=kd("externalEvent"),Is=kJ(),Il=new Map;Is.startListening({actionCreator:Io,effect:(e,t)=>{var{handler:n,reactEvent:r}=e.payload;if(null!=n){r.persist();var i=r.type,a=Il.get(i);void 0!==a&&cancelAnimationFrame(a);var o=requestAnimationFrame(()=>{try{var e=t.getState(),a={activeCoordinate:DZ(e),activeDataKey:DX(e),activeIndex:DG(e),activeLabel:D$(e),activeTooltipIndex:DG(e),isTooltipActive:DQ(e)};n(a,r)}finally{Il.delete(i)}});Il.set(i,o)}}});var Ic=N7([Di],e=>e.tooltipItemPayloads),Iu=N7([Ic,Dr,(e,t)=>t,(e,t,n)=>n],(e,t,n,r)=>{var i=e.find(e=>e.settings.graphicalItemId===r);if(null!=i){var{positions:a}=i;if(null!=a)return t(a,n)}}),Id=kd("touchMove"),Ih=kJ();Ih.startListening({actionCreator:Id,effect:(e,t)=>{var n=e.payload;if(null!=n.touches&&0!==n.touches.length){var r=t.getState(),i=P4(r,r.tooltip.settings.shared);if("axis"===i){var a=n.touches[0];if(null==a)return;var o=Lo(r,Ls({clientX:a.clientX,clientY:a.clientY,currentTarget:n.currentTarget}));(null==o?void 0:o.activeIndex)!=null&&t.dispatch(Ec({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if("item"===i){var s,l=n.touches[0];if(null==document.elementFromPoint||null==l)return;var c=document.elementFromPoint(l.clientX,l.clientY);if(!c||!c.getAttribute)return;var u=c.getAttribute("data-recharts-item-index"),d=null!=(s=c.getAttribute("data-recharts-item-id"))?s:void 0,h=Dd(r).find(e=>e.id===d);if(null==u||null==h||null==d)return;var{dataKey:f}=h,p=Iu(r,u,d);t.dispatch(Ea({activeDataKey:f,activeIndex:u,activeCoordinate:p,activeGraphicalItemId:d}))}}}});var If=kj({name:"errorBars",initialState:{},reducers:{addErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]||(e[n]=[]),e[n].push(r)},replaceErrorBar:(e,t)=>{var{itemId:n,prev:r,next:i}=t.payload;e[n]&&(e[n]=e[n].map(e=>e.dataKey===r.dataKey&&e.direction===r.direction?i:e))},removeErrorBar:(e,t)=>{var{itemId:n,errorBar:r}=t.payload;e[n]&&(e[n]=e[n].filter(e=>e.dataKey!==r.dataKey||e.direction!==r.direction))}}}),{addErrorBar:Ip,replaceErrorBar:Im,removeErrorBar:Ig}=If.actions,Iv=If.reducer,Ix={devToolsEnabled:!0,isSsr:!("u">typeof window&&window.document&&window.document.createElement&&window.setTimeout)};function Iy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ib(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Iy(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Iy(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Iw={zIndexMap:Object.values(OJ).reduce((e,t)=>Ib(Ib({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),{})},Ij=new Set(Object.values(OJ)),IN=kj({name:"zIndex",initialState:Iw,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]?e.zIndexMap[n].consumers+=1:e.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:kg()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(e.zIndexMap[n].consumers-=1,e.zIndexMap[n].consumers<=0&&!Ij.has(n)&&delete e.zIndexMap[n])},prepare:kg()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n,element:r,isPanorama:i}=t.payload;e.zIndexMap[n]?i?e.zIndexMap[n].panoramaElement=r:e.zIndexMap[n].element=r:e.zIndexMap[n]={consumers:0,element:i?void 0:r,panoramaElement:i?r:void 0}},prepare:kg()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:n}=t.payload;e.zIndexMap[n]&&(t.payload.isPanorama?e.zIndexMap[n].panoramaElement=void 0:e.zIndexMap[n].element=void 0)},prepare:kg()}}}),{registerZIndexPortal:Ik,unregisterZIndexPortal:IC,registerZIndexPortalElement:IE,unregisterZIndexPortalElement:I_}=IN.actions,IS=ka({brush:LG,cartesianAxis:L_,chartData:Ex,errorBars:Iv,graphicalItems:LD,layout:Ek,legend:LJ,options:Cu,polarAxis:L9,polarOptions:In,referenceElements:LU,rootProps:L2,tooltip:Ef,zIndex:IN.reducer}),IT=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Chart";return function(e){let t,n,r,i=function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new kh;return t&&("boolean"==typeof t?a.push(kc):a.push(kl(t.extraArgument))),a},{reducer:a,middleware:o,devTools:s=!0,duplicateMiddlewareCheck:l=!0,preloadedState:c,enhancers:u}=e||{};if("function"==typeof a)t=a;else if(ki(a))t=ka(a);else throw Error(k0(1));n="function"==typeof o?o(i):i();let d=ko;s&&(d=ku({trace:!1,..."object"==typeof s&&s}));let h=(r=function(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(ke(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=ko(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}(...n),function(e){let{autoBatch:t=!0}=e??{},n=new kh(r);return t&&n.push(kx("object"==typeof t?t:void 0)),n});return function e(t,n,r){if("function"!=typeof t)throw Error(ke(2));if("function"==typeof n&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw Error(ke(0));if("function"==typeof n&&void 0===r&&(r=n,n=void 0),void 0!==r){if("function"!=typeof r)throw Error(ke(1));return r(e)(t,n)}let i=t,a=n,o=new Map,s=o,l=0,c=!1;function u(){s===o&&(s=new Map,o.forEach((e,t)=>{s.set(t,e)}))}function d(){if(c)throw Error(ke(3));return a}function h(e){if("function"!=typeof e)throw Error(ke(4));if(c)throw Error(ke(5));let t=!0;u();let n=l++;return s.set(n,e),function(){if(t){if(c)throw Error(ke(6));t=!1,u(),s.delete(n),o=null}}}function f(e){if(!ki(e))throw Error(ke(7));if(void 0===e.type)throw Error(ke(8));if("string"!=typeof e.type)throw Error(ke(17));if(c)throw Error(ke(9));try{c=!0,a=i(a,e)}finally{c=!1}return(o=s).forEach(e=>{e()}),e}return f({type:kr.INIT}),{dispatch:f,subscribe:h,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw Error(ke(10));i=e,f({type:kr.REPLACE})},[kt]:function(){return{subscribe(e){if("object"!=typeof e||null===e)throw Error(ke(11));function t(){e.next&&e.next(d())}return t(),{unsubscribe:h(t)}},[kt](){return this}}}}}(t,c,d(..."function"==typeof u?u(h):h()))}({reducer:IS,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes("es6")}).concat([Lc.middleware,Ld.middleware,Ia.middleware,Is.middleware,Ih.middleware]),enhancers:e=>{var t=e;return"function"==typeof e&&(t=e()),t.concat(kx({type:"raf"}))},devTools:Ix.devToolsEnabled&&{serialize:{replacer:Lf},name:"recharts-".concat(t)}})};function IA(e){var{preloadedState:t,children:n,reduxStoreName:r}=e,i=_a(),a=(0,em.useRef)(null);return i?n:(null==a.current&&(a.current=IT(t,r)),em.createElement(Cb,{context:EE,store:a.current},n))}var IO=e=>{var{chartData:t}=e,n=ES(),r=_a();return(0,em.useEffect)(()=>r?()=>{}:(n(Em(t)),()=>{n(Em(void 0))}),[t,n,r]),null},IM=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function IP(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(IM.has(n)){if(null==e[n]&&null==t[n])continue;if(!function(e,t){if(Cg(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Cg(e[n[r]],t[n[r]]))return!1;return!0}(e[n],t[n]))return!1}else{var r,i;if(r=e[n],i=t[n],(null!=r||null!=i)&&("number"==typeof r&&"number"==typeof i?r!==i&&(r==r||i==i):r!==i))return!1}return!0}var ID=(0,em.memo)(function(e){var{layout:t,margin:n}=e,r=ES(),i=_a();return(0,em.useEffect)(()=>{i||(r(Ew(t)),r(Eb(n)))},[r,i,t,n]),null},IP);function IL(e){var t=ES();return(0,em.useEffect)(()=>{t(L5(e))},[t,e]),null}var II=()=>{var e;return null==(e=EM(e=>e.rootProps.accessibilityLayer))||e},IR=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function IB(e){return"string"==typeof e&&IR.includes(e)}var Iz=new Set(["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"]);function IF(e){return"string"==typeof e&&Iz.has(e)}function IV(e){return"string"==typeof e&&e.startsWith("data-")}function IU(e){if("object"!=typeof e||null===e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IF(n)||IV(n))&&(t[n]=e[n]);return t}function IH(e){return null==e?null:(0,em.isValidElement)(e)&&"object"==typeof e.props&&null!==e.props?IU(e.props):"object"!=typeof e||Array.isArray(e)?null:IU(e)}function IW(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(IF(n)||IV(n)||IB(n))&&(t[n]=e[n]);return t}var IY=["children","width","height","viewBox","className","style","title","desc"];function IG(){return(IG=Object.assign.bind()).apply(null,arguments)}var I$=(0,em.forwardRef)((e,t)=>{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:l,desc:c}=e,u=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,IY),d=a||{width:r,height:i,x:0,y:0},h=(0,_l.clsx)("recharts-surface",o);return em.createElement("svg",IG({},IW(u),{className:h,width:r,height:i,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height),ref:t}),em.createElement("title",null,l),em.createElement("desc",null,c),n)}),IX=N7(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,n)=>n,(e,t,n)=>{if(null!=t){var r=e[t];if(null!=r)return n?r.panoramaElement:r.element}}),Iq=N7(e=>e.zIndex.zIndexMap,e=>Array.from(new Set(Object.keys(e).map(e=>parseInt(e,10)).concat(Object.values(OJ)))).sort((e,t)=>e-t),{memoizeOptions:{resultEqualityCheck:function(e,t){if(e.length===t.length){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return!1}}});function IK(e){var{zIndex:t,isPanorama:n}=e,r=(0,em.useRef)(null),i=ES();return(0,em.useLayoutEffect)(()=>(r.current&&i(IE({zIndex:t,element:r.current,isPanorama:n})),()=>{i(I_({zIndex:t,isPanorama:n}))}),[i,t,n]),em.createElement("g",{tabIndex:-1,ref:r})}function IZ(e){var{children:t,isPanorama:n}=e,r=EM(Iq);if(!r||0===r.length)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return em.createElement(em.Fragment,null,i.map(e=>em.createElement(IK,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>em.createElement(IK,{key:e,zIndex:e,isPanorama:n})))}var IQ=["children"];function IJ(){return(IJ=Object.assign.bind()).apply(null,arguments)}var I0={width:"100%",height:"100%",display:"block"},I1=(0,em.forwardRef)((e,t)=>{var n,r,i=EM(E5),a=EM(E3),o=II();if(!EH(i)||!EH(a))return null;var{children:s,otherAttributes:l,title:c,desc:u}=e;return null!=l&&(n="number"==typeof l.tabIndex?l.tabIndex:o?0:void 0,r="string"==typeof l.role?l.role:o?"application":void 0),em.createElement(I$,IJ({},l,{title:c,desc:u,role:r,tabIndex:n,width:i,height:a,style:I0,ref:t}),s)}),I2=e=>{var{children:t}=e,n=EM(_s);if(!n)return null;var{width:r,height:i,y:a,x:o}=n;return em.createElement(I$,{width:r,height:i,x:o,y:a},t)},I5=(0,em.forwardRef)((e,t)=>{var{children:n}=e,r=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,IQ);return _a()?em.createElement(I2,null,em.createElement(IZ,{isPanorama:!0},n)):em.createElement(I1,IJ({ref:t},r),em.createElement(IZ,{isPanorama:!1},n))}),I3=new(e.i(29942)).default,I4="recharts.syncEvent.tooltip",I6="recharts.syncEvent.brush";function I8(e){return e.tooltip.syncInteraction}var I7=["x","y"];function I9(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I9(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I9(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Rt=(0,em.createContext)(null),Rn=(0,em.createContext)(null);function Rr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ri(){return(Ri=Object.assign.bind()).apply(null,arguments)}var Ra=()=>{var e,t,n,r,i,a,o,s,l,c,u,d;return e=ES(),(0,em.useEffect)(()=>{e(Cd())},[e]),t=EM(OG),n=EM(OX),r=ES(),i=EM(O$),a=EM(DV),o=EM(_S),s=_C(),l=EM(e=>e.rootProps.className),(0,em.useEffect)(()=>{if(null==t)return Cs;var e=(e,l,c)=>{if(n!==c&&t===e){if("index"===i){if(s&&null!=l&&null!=(u=l.payload)&&u.coordinate&&l.payload.sourceViewBox){var u,d,h=l.payload.coordinate,{x:f,y:p}=h,g=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(h,I7),{x:v,y:x,width:y,height:b}=l.payload.sourceViewBox,w=Re(Re({},g),{},{x:s.x+(y?(f-v)/y:0)*s.width,y:s.y+(b?(p-x)/b:0)*s.height});r(Re(Re({},l),{},{payload:Re(Re({},l.payload),{},{coordinate:w})}))}else r(l);return}if(null!=a){if("function"==typeof i){var j=i(a,{activeTooltipIndex:null==l.payload.index?void 0:Number(l.payload.index),isTooltipActive:l.payload.active,activeIndex:null==l.payload.index?void 0:Number(l.payload.index),activeLabel:l.payload.label,activeDataKey:l.payload.dataKey,activeCoordinate:l.payload.coordinate});d=a[j]}else"value"===i&&(d=a.find(e=>String(e.value)===l.payload.label));var{coordinate:N}=l.payload;if(null==d||!1===l.payload.active||null==N||null==s)return void r(Ed({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));var{x:k,y:C}=N,E=Math.min(k,s.x+s.width),_=Math.min(C,s.y+s.height),S={x:"horizontal"===o?d.coordinate:E,y:"horizontal"===o?_:d.coordinate};r(Ed({active:l.payload.active,coordinate:S,dataKey:l.payload.dataKey,index:String(d.index),label:l.payload.label,sourceViewBox:l.payload.sourceViewBox,graphicalItemId:l.payload.graphicalItemId}))}}};return I3.on(I4,e),()=>{I3.off(I4,e)}},[l,r,n,t,i,a,o,s]),c=EM(OG),u=EM(OX),d=ES(),(0,em.useEffect)(()=>{if(null==c)return Cs;var e=(e,t,n)=>{u!==n&&c===e&&d(Eg(t))};return I3.on(I6,e),()=>{I3.off(I6,e)}},[d,u,c]),null};function Ro(e){if("number"==typeof e)return e;if("string"==typeof e){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var Rs=(0,em.forwardRef)((e,t)=>{var n,r,i=(0,em.useRef)(null),[a,o]=(0,em.useState)({containerWidth:Ro(null==(n=e.style)?void 0:n.width),containerHeight:Ro(null==(r=e.style)?void 0:r.height)}),s=(0,em.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),l=(0,em.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e&&"u">typeof ResizeObserver){var{width:n,height:r}=e.getBoundingClientRect();s(n,r);var a=new ResizeObserver(e=>{var{width:t,height:n}=e[0].contentRect;s(t,n)});a.observe(e),i.current=a}},[t,s]);return(0,em.useEffect)(()=>()=>{var e=i.current;null!=e&&e.disconnect()},[s]),em.createElement(em.Fragment,null,em.createElement(_T,{width:a.containerWidth,height:a.containerHeight}),em.createElement("div",Ri({ref:l},e)))}),Rl=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e,[i,a]=(0,em.useState)({containerWidth:Ro(n),containerHeight:Ro(r)}),o=(0,em.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,em.useCallback)(e=>{if("function"==typeof t&&t(e),null!=e){var{width:n,height:r}=e.getBoundingClientRect();o(n,r)}},[t,o]);return em.createElement(em.Fragment,null,em.createElement(_T,{width:i.containerWidth,height:i.containerHeight}),em.createElement("div",Ri({ref:s},e)))}),Rc=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e;return em.createElement(em.Fragment,null,em.createElement(_T,{width:n,height:r}),em.createElement("div",Ri({ref:t},e)))}),Ru=(0,em.forwardRef)((e,t)=>{var{width:n,height:r}=e;return k6(n)||k6(r)?em.createElement(Rl,Ri({},e,{ref:t})):em.createElement(Rc,Ri({},e,{ref:t}))}),Rd=(0,em.forwardRef)((e,t)=>{var{children:n,className:r,height:i,onClick:a,onContextMenu:o,onDoubleClick:s,onMouseDown:l,onMouseEnter:c,onMouseLeave:u,onMouseMove:d,onMouseUp:h,onTouchEnd:f,onTouchMove:p,onTouchStart:g,style:v,width:x,responsive:y,dispatchTouchEvents:b=!0}=e,w=(0,em.useRef)(null),j=ES(),[N,k]=(0,em.useState)(null),[C,E]=(0,em.useState)(null),_=function(){var e=ES(),[t,n]=(0,em.useState)(null),r=EM(E4);return(0,em.useEffect)(()=>{if(null!=t){var n=t.getBoundingClientRect().width/t.offsetWidth;EU(n)&&n!==r&&e(EN(n))}},[t,e,r]),n}(),S=_w(),T=(null==S?void 0:S.width)>0?S.width:x,A=(null==S?void 0:S.height)>0?S.height:i,O=(0,em.useCallback)(e=>{_(e),"function"==typeof t&&t(e),k(e),E(e),null!=e&&(w.current=e)},[_,t,k,E]),M=(0,em.useCallback)(e=>{j(Ll(e)),j(Io({handler:a,reactEvent:e}))},[j,a]),P=(0,em.useCallback)(e=>{j(Lu(e)),j(Io({handler:c,reactEvent:e}))},[j,c]),D=(0,em.useCallback)(e=>{j(Es()),j(Io({handler:u,reactEvent:e}))},[j,u]),L=(0,em.useCallback)(e=>{j(Lu(e)),j(Io({handler:d,reactEvent:e}))},[j,d]),I=(0,em.useCallback)(()=>{j(Ii())},[j]),R=(0,em.useCallback)(e=>{j(Ir(e.key))},[j]),B=(0,em.useCallback)(e=>{j(Io({handler:o,reactEvent:e}))},[j,o]),z=(0,em.useCallback)(e=>{j(Io({handler:s,reactEvent:e}))},[j,s]),F=(0,em.useCallback)(e=>{j(Io({handler:l,reactEvent:e}))},[j,l]),V=(0,em.useCallback)(e=>{j(Io({handler:h,reactEvent:e}))},[j,h]),U=(0,em.useCallback)(e=>{j(Io({handler:g,reactEvent:e}))},[j,g]),H=(0,em.useCallback)(e=>{b&&j(Id(e)),j(Io({handler:p,reactEvent:e}))},[j,b,p]),W=(0,em.useCallback)(e=>{j(Io({handler:f,reactEvent:e}))},[j,f]);return em.createElement(Rt.Provider,{value:N},em.createElement(Rn.Provider,{value:C},em.createElement(!0===y?Rs:Ru,{width:null!=T?T:null==v?void 0:v.width,height:null!=A?A:null==v?void 0:v.height,className:(0,_l.clsx)("recharts-wrapper",r),style:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rr(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({position:"relative",cursor:"default",width:T,height:A},v),onClick:M,onContextMenu:B,onDoubleClick:z,onFocus:I,onKeyDown:R,onMouseDown:F,onMouseEnter:P,onMouseLeave:D,onMouseMove:L,onMouseUp:V,onTouchEnd:W,onTouchMove:H,onTouchStart:U,ref:O},em.createElement(Ra,null),n)))}),Rh=N7([_t],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),Rf=N7([Rh,E5,E3],(e,t,n)=>{if(e&&null!=t&&null!=n)return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),Rp=(0,em.createContext)(void 0),Rm=e=>{var{children:t}=e,[n]=(0,em.useState)("".concat(Ce("recharts"),"-clip")),r=EM(Rf);if(null==r)return null;var{x:i,y:a,width:o,height:s}=r;return em.createElement(Rp.Provider,{value:n},em.createElement("defs",null,em.createElement("clipPath",{id:n},em.createElement("rect",{x:i,y:a,height:s,width:o}))),t)},Rg=["width","height","responsive","children","className","style","compact","title","desc"],Rv=(0,em.forwardRef)((e,t)=>{var{width:n,height:r,responsive:i,children:a,className:o,style:s,compact:l,title:c,desc:u}=e,d=IU(function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Rg));return l?em.createElement(em.Fragment,null,em.createElement(_T,{width:n,height:r}),em.createElement(I5,{otherAttributes:d,title:c,desc:u},a)):em.createElement(Rd,{className:o,style:s,width:n,height:r,responsive:null!=i&&i,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},em.createElement(I5,{otherAttributes:d,title:c,desc:u,ref:t},em.createElement(Rm,null,a)))});function Rx(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ry(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rx(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rx(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},e);return Object.keys(t).reduce((e,n)=>(void 0===e[n]&&void 0!==t[n]&&(e[n]=t[n]),e),n)}function Rb(){return(Rb=Object.assign.bind()).apply(null,arguments)}var Rw={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},Rj=(0,em.forwardRef)(function(e,t){var n,r=Ry(e.categoricalChartProps,Rw),{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,categoricalChartProps:l}=e;return em.createElement(IA,{preloadedState:{options:{chartName:i,defaultTooltipEventType:a,validateTooltipEventTypes:o,tooltipPayloadSearcher:s,eventEmitter:void 0}},reduxStoreName:null!=(n=l.id)?n:i},em.createElement(IO,{chartData:l.data}),em.createElement(ID,{layout:r.layout,margin:r.margin}),em.createElement(IL,{baseValue:r.baseValue,accessibilityLayer:r.accessibilityLayer,barCategoryGap:r.barCategoryGap,maxBarSize:r.maxBarSize,stackOffset:r.stackOffset,barGap:r.barGap,barSize:r.barSize,syncId:r.syncId,syncMethod:r.syncMethod,className:r.className,reverseStackOrder:r.reverseStackOrder}),em.createElement(Rv,Rb({},r,{ref:t})))}),RN=["axis"],Rk=(0,em.forwardRef)((e,t)=>em.createElement(Rj,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:RN,tooltipPayloadSearcher:Cl,categoricalChartProps:e,ref:t})),RC=em;function RE(e){this._context=e}function R_(e){return new RE(e)}RE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};let RS=Math.PI,RT=2*RS,RA=RT-1e-6;function RO(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}class RM{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==e?RO:function(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return RO;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e*=1,t*=1,n*=1,r*=1,(i*=1)<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,l=r-t,c=a-e,u=o-t,d=c*c+u*u;if(null===this._x1)this._append`M${this._x1=e},${this._y1=t}`;else if(d>1e-6)if(Math.abs(u*s-l*c)>1e-6&&i){let h=n-a,f=r-o,p=s*s+l*l,g=Math.sqrt(p),v=Math.sqrt(d),x=i*Math.tan((RS-Math.acos((p+d-(h*h+f*f))/(2*g*v)))/2),y=x/v,b=x/g;Math.abs(y-1)>1e-6&&this._append`L${e+y*c},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*h>c*f)},${this._x1=e+b*s},${this._y1=t+b*l}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,r,i,a){if(e*=1,t*=1,n*=1,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),l=e+o,c=t+s,u=1^a,d=a?r-i:i-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-c)>1e-6)&&this._append`L${l},${c}`,n&&(d<0&&(d=d%RT+RT),d>RA?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=l},${this._y1=c}`:d>1e-6&&this._append`A${n},${n},0,${+(d>=RS)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n*=1}v${+r}h${-n}Z`}toString(){return this._}}function RP(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new RM(t)}function RD(e){return e[0]}function RL(e){return e[1]}function RI(e,t){var n=EI(!0),r=null,i=R_,a=null,o=RP(s);function s(s){var l,c,u,d=(s=EL(s)).length,h=!1;for(null==r&&(a=i(u=o())),l=0;l<=d;++l)!(l<d&&n(c=s[l],l,s))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+e(c,l,s),+t(c,l,s));if(u)return a=null,u+""||null}return e="function"==typeof e?e:void 0===e?RD:EI(e),t="function"==typeof t?t:void 0===t?RL:EI(t),s.x=function(t){return arguments.length?(e="function"==typeof t?t:EI(+t),s):e},s.y=function(e){return arguments.length?(t="function"==typeof e?e:EI(+e),s):t},s.defined=function(e){return arguments.length?(n="function"==typeof e?e:EI(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,null!=r&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(null==e?r=a=null:a=i(r=e),s):r},s}function RR(e,t,n){var r=null,i=EI(!0),a=null,o=R_,s=null,l=RP(c);function c(c){var u,d,h,f,p,g=(c=EL(c)).length,v=!1,x=Array(g),y=Array(g);for(null==a&&(s=o(p=l())),u=0;u<=g;++u){if(!(u<g&&i(f=c[u],u,c))===v)if(v=!v)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),h=u-1;h>=d;--h)s.point(x[h],y[h]);s.lineEnd(),s.areaEnd()}v&&(x[u]=+e(f,u,c),y[u]=+t(f,u,c),s.point(r?+r(f,u,c):x[u],n?+n(f,u,c):y[u]))}if(p)return s=null,p+""||null}function u(){return RI().defined(i).curve(o).context(a)}return e="function"==typeof e?e:void 0===e?RD:EI(+e),t="function"==typeof t?t:void 0===t?EI(0):EI(+t),n="function"==typeof n?n:void 0===n?RL:EI(+n),c.x=function(t){return arguments.length?(e="function"==typeof t?t:EI(+t),r=null,c):e},c.x0=function(t){return arguments.length?(e="function"==typeof t?t:EI(+t),c):e},c.x1=function(e){return arguments.length?(r=null==e?null:"function"==typeof e?e:EI(+e),c):r},c.y=function(e){return arguments.length?(t="function"==typeof e?e:EI(+e),n=null,c):t},c.y0=function(e){return arguments.length?(t="function"==typeof e?e:EI(+e),c):t},c.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:EI(+e),c):n},c.lineX0=c.lineY0=function(){return u().x(e).y(t)},c.lineY1=function(){return u().x(e).y(n)},c.lineX1=function(){return u().x(r).y(t)},c.defined=function(e){return arguments.length?(i="function"==typeof e?e:EI(!!e),c):i},c.curve=function(e){return arguments.length?(o=e,null!=a&&(s=o(a)),c):o},c.context=function(e){return arguments.length?(null==e?a=s=null:s=o(a=e),c):a},c}function RB(){}function Rz(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function RF(e){this._context=e}function RV(e){this._context=e}function RU(e){this._context=e}RM.prototype,RF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Rz(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Rz(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},RV.prototype={areaStart:RB,areaEnd:RB,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Rz(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},RU.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Rz(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};class RH{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}}function RW(e){this._context=e}RW.prototype={areaStart:RB,areaEnd:RB,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e*=1,t*=1,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function RY(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0);return((a<0?-1:1)+(o<0?-1:1))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs((a*i+o*r)/(r+i)))||0}function RG(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function R$(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function RX(e){this._context=e}function Rq(e){this._context=new RK(e)}function RK(e){this._context=e}function RZ(e){this._context=e}function RQ(e){var t,n,r=e.length-1,i=Array(r),a=Array(r),o=Array(r);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/a[t-1],a[t]-=n,o[t]-=n*o[t-1];for(i[r-1]=o[r-1]/a[r-1],t=r-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(t=0,a[r-1]=(e[r]+i[r-1])/2;t<r-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function RJ(e,t){this._context=e,this._t=t}RX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:R$(this,this._t0,RG(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t*=1,(e*=1)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,R$(this,RG(this,n=RY(this,e,t)),n);break;default:R$(this,this._t0,n=RY(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(Rq.prototype=Object.create(RX.prototype)).point=function(e,t){RX.prototype.point.call(this,t,e)},RK.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}},RZ.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),2===n)this._context.lineTo(e[1],t[1]);else for(var r=RQ(e),i=RQ(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},RJ.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e*=1,t*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var R0=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,R1=(e,t)=>{if(!e||"function"==typeof e||"boolean"==typeof e)return null;var n=e;if((0,em.isValidElement)(e)&&(n=e.props),"object"!=typeof n&&"function"!=typeof n)return null;var r={};return Object.keys(n).forEach(e=>{IB(e)&&(r[e]=t||(t=>n[e](n,t)))}),r};function R2(){return(R2=Object.assign.bind()).apply(null,arguments)}function R5(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R3(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R5(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R5(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var R4={curveBasisClosed:function(e){return new RV(e)},curveBasisOpen:function(e){return new RU(e)},curveBasis:function(e){return new RF(e)},curveBumpX:function(e){return new RH(e,!0)},curveBumpY:function(e){return new RH(e,!1)},curveLinearClosed:function(e){return new RW(e)},curveLinear:R_,curveMonotoneX:function(e){return new RX(e)},curveMonotoneY:function(e){return new Rq(e)},curveNatural:function(e){return new RZ(e)},curveStep:function(e){return new RJ(e,.5)},curveStepAfter:function(e){return new RJ(e,1)},curveStepBefore:function(e){return new RJ(e,0)}},R6=e=>EU(e.x)&&EU(e.y),R8=e=>null!=e.base&&R6(e.base)&&R6(e),R7=e=>e.x,R9=e=>e.y,Be=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=EM(_S);if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?(e=>{var{type:t="linear",points:n=[],baseLine:r,layout:i,connectNulls:a=!1}=e,o=((e,t)=>{if("function"==typeof e)return e;var n="curve".concat(Ca(e));return("curveMonotone"===n||"curveBump"===n)&&t?R4["".concat(n).concat("vertical"===t?"Y":"X")]:R4[n]||R_})(t,i),s=a?n.filter(R6):n;if(Array.isArray(r)){var l=n.map((e,t)=>R3(R3({},e),{},{base:r[t]}));return("vertical"===i?RR().y(R9).x1(R7).x0(e=>e.base.x):RR().x(R7).y1(R9).y0(e=>e.base.y)).defined(R8).curve(o)(a?l.filter(R8):l)}return("vertical"===i&&k8(r)?RR().y(R9).x1(R7).x0(r):k8(r)?RR().x(R7).y1(R9).y0(r):RI().x(R7).y(R9)).defined(R6).curve(o)(s)})(o):r;return em.createElement("path",R2({},IU(e),R1(e),{className:(0,_l.clsx)("recharts-curve",t),d:null===s?void 0:s,ref:i}))},Bt=["children","className"];function Bn(){return(Bn=Object.assign.bind()).apply(null,arguments)}var Br=em.forwardRef((e,t)=>{var{children:n,className:r}=e,i=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Bt),a=(0,_l.clsx)("recharts-layer",r);return em.createElement("g",Bn({className:a},IW(i),{ref:t}),n)}),Bi=e.i(4178);function Ba(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var Bo=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ba(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ba(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},{cacheSize:2e3,enableCache:!0}),Bs=new class{constructor(e){!function(e,t,n){var r;(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"cache",new Map),this.maxSize=e}get(e){var t=this.cache.get(e);return void 0!==t&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;null!=n&&this.cache.delete(n)}this.cache.set(e,t)}clear(){this.cache.clear()}size(){return this.cache.size}}(Bo.cacheSize),Bl={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},Bc="recharts_measurement_span",Bu=(e,t)=>{try{var n=document.getElementById(Bc);n||((n=document.createElement("span")).setAttribute("id",Bc),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Bl,t),n.textContent="".concat(e);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch(e){return{width:0,height:0}}},Bd=function(e){var t,n,r,i,a,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||Ix.isSsr)return{width:0,height:0};if(!Bo.enableCache)return Bu(e,s);var l=(t=s.fontSize||"",n=s.fontFamily||"",r=s.fontWeight||"",i=s.fontStyle||"",a=s.letterSpacing||"",o=s.textTransform||"","".concat(e,"|").concat(t,"|").concat(n,"|").concat(r,"|").concat(i,"|").concat(a,"|").concat(o)),c=Bs.get(l);if(c)return c;var u=Bu(e,s);return Bs.set(l,u),u},Bh=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Bf=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Bp=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,Bm=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,Bg={cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,in:96,Q:96/101.6,px:1},Bv=["cm","mm","pt","pc","in","Q","px"];class Bx{static parse(e){var t,[,n,r]=null!=(t=Bm.exec(e))?t:[];return null==n?Bx.NaN:new Bx(parseFloat(n),null!=r?r:"")}constructor(e,t){this.num=e,this.unit=t,this.num=e,this.unit=t,k4(e)&&(this.unit=""),""===t||Bp.test(t)||(this.num=NaN,this.unit=""),function(e){return Bv.includes(e)}(t)&&(this.num=function(e,t){return e*Bg[t]}(e,t),this.unit="px")}add(e){return this.unit!==e.unit?new Bx(NaN,""):new Bx(this.num+e.num,this.unit)}subtract(e){return this.unit!==e.unit?new Bx(NaN,""):new Bx(this.num-e.num,this.unit)}multiply(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Bx(NaN,""):new Bx(this.num*e.num,this.unit||e.unit)}divide(e){return""!==this.unit&&""!==e.unit&&this.unit!==e.unit?new Bx(NaN,""):new Bx(this.num/e.num,this.unit||e.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return k4(this.num)}}function By(e){if(null==e||e.includes("NaN"))return"NaN";for(var t=e;t.includes("*")||t.includes("/");){var n,[,r,i,a]=null!=(n=Bh.exec(t))?n:[],o=Bx.parse(null!=r?r:""),s=Bx.parse(null!=a?a:""),l="*"===i?o.multiply(s):o.divide(s);if(l.isNaN())return"NaN";t=t.replace(Bh,l.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var c,[,u,d,h]=null!=(c=Bf.exec(t))?c:[],f=Bx.parse(null!=u?u:""),p=Bx.parse(null!=h?h:""),g="+"===d?f.add(p):f.subtract(p);if(g.isNaN())return"NaN";t=t.replace(Bf,g.toString())}return t}u="NaN",d=new Bx(NaN,""),(u="symbol"==typeof(s=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(u,"string"))?s:s+"")in Bx?Object.defineProperty(Bx,u,{value:d,enumerable:!0,configurable:!0,writable:!0}):Bx[u]=d;var Bb=/\(([^()]*)\)/;function Bw(e){var t=function(e){try{var t;return t=e.replace(/\s+/g,""),t=function(e){for(var t,n=e;null!=(t=Bb.exec(n));){var[,r]=t;n=n.replace(Bb,By(r))}return n}(t),t=By(t)}catch(e){return"NaN"}}(e.slice(5,-1));return"NaN"===t?"":t}var Bj=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],BN=["dx","dy","angle","className","breakAll"];function Bk(){return(Bk=Object.assign.bind()).apply(null,arguments)}function BC(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var BE=/[ \f\n\r\t\v\u2028\u2029]+/,B_=e=>{var{children:t,breakAll:n,style:r}=e;try{var i=[];null!=t&&(i=n?t.toString().split(""):t.toString().split(BE));var a=i.map(e=>({word:e,width:Bd(e,r).width})),o=n?0:Bd(" ",r).width;return{wordsWithComputedWidth:a,spaceWidth:o}}catch(e){return null}},BS=(e,t,n,r)=>e.reduce((e,i)=>{var{word:a,width:o}=i,s=e[e.length-1];return s&&null!=o&&(null==t||r||s.width+o+n<Number(t))?(s.words.push(a),s.width+=o+n):e.push({words:[a],width:o}),e},[]),BT=e=>e.reduce((e,t)=>e.width>t.width?e:t),BA=(e,t,n,r,i,a,o,s)=>{var l=B_({breakAll:n,style:r,children:e.slice(0,t)+"…"});if(!l)return[!1,[]];var c=BS(l.wordsWithComputedWidth,a,o,s);return[c.length>i||BT(c).width>Number(a),c]},BO=e=>[{words:null==e?[]:e.toString().split(BE),width:void 0}],BM="#808080",BP={angle:0,breakAll:!1,capHeight:"0.71em",fill:BM,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},BD=(0,em.forwardRef)((e,t)=>{var n,r=Ry(e,BP),{x:i,y:a,lineHeight:o,capHeight:s,fill:l,scaleToFit:c,textAnchor:u,verticalAnchor:d}=r,h=BC(r,Bj),f=(0,em.useMemo)(()=>(e=>{var{width:t,scaleToFit:n,children:r,style:i,breakAll:a,maxLines:o}=e;if((t||n)&&!Ix.isSsr){var s=B_({breakAll:a,children:r,style:i});if(!s)return BO(r);var{wordsWithComputedWidth:l,spaceWidth:c}=s;return((e,t,n,r,i)=>{var a,{maxLines:o,children:s,style:l,breakAll:c}=e,u=k8(o),d=String(s),h=BS(t,r,n,i);if(!u||i||!(h.length>o||BT(h).width>Number(r)))return h;for(var f=0,p=d.length-1,g=0;f<=p&&g<=d.length-1;){var v=Math.floor((f+p)/2),[x,y]=BA(d,v-1,c,l,o,r,n,i),[b]=BA(d,v,c,l,o,r,n,i);if(x||b||(f=v+1),x&&b&&(p=v-1),!x&&b){a=y;break}g++}return a||h})({breakAll:a,children:r,maxLines:o,style:i},l,c,t,!!n)}return BO(r)})({breakAll:h.breakAll,children:h.children,maxLines:h.maxLines,scaleToFit:c,style:h.style,width:h.width}),[h.breakAll,h.children,h.maxLines,c,h.style,h.width]),{dx:p,dy:g,angle:v,className:x,breakAll:y}=h,b=BC(h,BN);if(!k7(i)||!k7(a)||0===f.length)return null;var w=Number(i)+(k8(p)?p:0),j=Number(a)+(k8(g)?g:0);if(!EU(w)||!EU(j))return null;switch(d){case"start":n=Bw("calc(".concat(s,")"));break;case"middle":n=Bw("calc(".concat((f.length-1)/2," * -").concat(o," + (").concat(s," / 2))"));break;default:n=Bw("calc(".concat(f.length-1," * -").concat(o,")"))}var N=[];if(c){var k=f[0].width,{width:C}=h;N.push("scale(".concat(k8(C)&&k8(k)?C/k:1,")"))}return v&&N.push("rotate(".concat(v,", ").concat(w,", ").concat(j,")")),N.length&&(b.transform=N.join(" ")),em.createElement("text",Bk({},IW(b),{ref:t,x:w,y:j,className:(0,_l.clsx)("recharts-text",x),textAnchor:u,fill:l.includes("url")?BM:l}),f.map((e,t)=>{var r=e.words.join(y?"":" ");return em.createElement("tspan",{x:w,dy:0===t?n:o,key:"".concat(r,"-").concat(t)},r)}))});function BL(e){var{zIndex:t,children:n}=e,r=void 0!==EM(_S)&&void 0!==t&&0!==t,i=_a(),a=ES();(0,em.useLayoutEffect)(()=>r?(a(Ik({zIndex:t})),()=>{a(IC({zIndex:t}))}):Cs,[a,t,r]);var o=EM(e=>IX(e,t,i));return r?o?(0,e0.createPortal)(n,o):null:n}BD.displayName="Text";var BI=["labelRef"],BR=["content"];function BB(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Bz(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function BF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bz(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bz(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function BV(){return(BV=Object.assign.bind()).apply(null,arguments)}var BU=(0,em.createContext)(null),BH=e=>{var{x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o,children:s}=e,l=(0,em.useMemo)(()=>({x:t,y:n,upperWidth:r,lowerWidth:i,width:a,height:o}),[t,n,r,i,a,o]);return em.createElement(BU.Provider,{value:l},s)},BW=()=>{var e=(0,em.useContext)(BU),t=_C();return e||_k(t)},BY=(0,em.createContext)(null),BG=e=>null!=e&&"function"==typeof e,B$=e=>"cx"in e&&k8(e.cx),BX={angle:0,offset:5,zIndex:OJ.label,position:"middle",textBreakAll:!1};function Bq(e){var t,n,r,i,a,o,s=Ry(e,BX),{viewBox:l,position:c,value:u,children:d,content:h,className:f="",textBreakAll:p,labelRef:g}=s,v=(t=(0,em.useContext)(BY),n=EM(Ma),t||n),x=BW();if(!(i=null==l?"center"===c?x:null!=v?v:x:B$(l)?l:_k(l))||null==u&&null==d&&!(0,em.isValidElement)(h)&&"function"!=typeof h)return null;var y=BF(BF({},s),{},{viewBox:i});if((0,em.isValidElement)(h)){var{labelRef:b}=y,w=BB(y,BI);return(0,em.cloneElement)(h,w)}if("function"==typeof h){var{content:j}=y,N=BB(y,BR);if(a=(0,em.createElement)(h,N),(0,em.isValidElement)(a))return a}else a=(e=>{var{value:t,formatter:n}=e,r=null==e.children?t:e.children;return"function"==typeof n?n(r):r})(s);var k=IW(s);if(B$(i)){if("insideStart"===c||"insideEnd"===c||"end"===c)return((e,t,n,r,i)=>{var a,o,{offset:s,className:l}=e,{cx:c,cy:u,innerRadius:d,outerRadius:h,startAngle:f,endAngle:p,clockWise:g}=i,v=(d+h)/2,x=k3(p-f)*Math.min(Math.abs(p-f),360),y=x>=0?1:-1;switch(t){case"insideStart":a=f+y*s,o=g;break;case"insideEnd":a=p-y*s,o=!g;break;case"end":a=p+y*s,o=g;break;default:throw Error("Unsupported position ".concat(t))}o=x<=0?o:!o;var b=OQ(c,u,v,a),w=OQ(c,u,v,a+(o?1:-1)*359),j="M".concat(b.x,",").concat(b.y,"\n A").concat(v,",").concat(v,",0,1,").concat(+!o,",\n ").concat(w.x,",").concat(w.y),N=null==e.id?Ce("recharts-radial-line-"):e.id;return em.createElement("text",BV({},r,{dominantBaseline:"central",className:(0,_l.clsx)("recharts-radial-bar-label",l)}),em.createElement("defs",null,em.createElement("path",{id:N,d:j})),em.createElement("textPath",{xlinkHref:"#".concat(N)},n))})(s,c,a,k,i);o=((e,t,n)=>{var{cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:s,endAngle:l}=e,c=(s+l)/2;if("outside"===n){var{x:u,y:d}=OQ(r,i,o+t,c);return{x:u,y:d,textAnchor:u>=r?"start":"end",verticalAnchor:"middle"}}if("center"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===n)return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var{x:h,y:f}=OQ(r,i,(a+o)/2,c);return{x:h,y:f,textAnchor:"middle",verticalAnchor:"middle"}})(i,s.offset,s.position)}else o=((e,t)=>{var n,{parentViewBox:r,offset:i,position:a}=e;null==r||B$(r)||(n=r);var{x:o,y:s,upperWidth:l,lowerWidth:c,height:u}=t,d=o+(l-c)/2,h=(o+d)/2,f=(l+c)/2,p=u>=0?1:-1,g=p*i,v=p>0?"end":"start",x=p>0?"start":"end",y=l>=0?1:-1,b=y*i,w=y>0?"end":"start",j=y>0?"start":"end";if("top"===a)return BF(BF({},{x:o+l/2,y:s-g,textAnchor:"middle",verticalAnchor:v}),n?{height:Math.max(s-n.y,0),width:l}:{});if("bottom"===a)return BF(BF({},{x:d+c/2,y:s+u+g,textAnchor:"middle",verticalAnchor:x}),n?{height:Math.max(n.y+n.height-(s+u),0),width:c}:{});if("left"===a){var N={x:h-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"};return BF(BF({},N),n?{width:Math.max(N.x-n.x,0),height:u}:{})}if("right"===a){var k={x:h+f+b,y:s+u/2,textAnchor:j,verticalAnchor:"middle"};return BF(BF({},k),n?{width:Math.max(n.x+n.width-k.x,0),height:u}:{})}var C=n?{width:f,height:u}:{};return"insideLeft"===a?BF({x:h+b,y:s+u/2,textAnchor:j,verticalAnchor:"middle"},C):"insideRight"===a?BF({x:h+f-b,y:s+u/2,textAnchor:w,verticalAnchor:"middle"},C):"insideTop"===a?BF({x:o+l/2,y:s+g,textAnchor:"middle",verticalAnchor:x},C):"insideBottom"===a?BF({x:d+c/2,y:s+u-g,textAnchor:"middle",verticalAnchor:v},C):"insideTopLeft"===a?BF({x:o+b,y:s+g,textAnchor:j,verticalAnchor:x},C):"insideTopRight"===a?BF({x:o+l-b,y:s+g,textAnchor:w,verticalAnchor:x},C):"insideBottomLeft"===a?BF({x:d+b,y:s+u-g,textAnchor:j,verticalAnchor:v},C):"insideBottomRight"===a?BF({x:d+c-b,y:s+u-g,textAnchor:w,verticalAnchor:v},C):a&&"object"==typeof a&&(k8(a.x)||k6(a.x))&&(k8(a.y)||k6(a.y))?BF({x:o+Ct(a.x,f),y:s+Ct(a.y,u),textAnchor:"end",verticalAnchor:"end"},C):BF({x:o+l/2,y:s+u/2,textAnchor:"middle",verticalAnchor:"middle"},C)})(s,i);return em.createElement(BL,{zIndex:s.zIndex},em.createElement(BD,BV({ref:g,className:(0,_l.clsx)("recharts-label",f)},k,o,{textAnchor:"start"===(r=k.textAnchor)||"middle"===r||"end"===r||"inherit"===r?k.textAnchor:o.textAnchor,breakAll:p}),a))}function BK(e){var{label:t,labelRef:n}=e;return((e,t,n)=>{if(!e)return null;var r={viewBox:t,labelRef:n};return!0===e?em.createElement(Bq,BV({key:"label-implicit"},r)):k7(e)?em.createElement(Bq,BV({key:"label-implicit",value:e},r)):(0,em.isValidElement)(e)?e.type===Bq?(0,em.cloneElement)(e,BF({key:"label-implicit"},r)):em.createElement(Bq,BV({key:"label-implicit",content:e},r)):BG(e)?em.createElement(Bq,BV({key:"label-implicit",content:e},r)):e&&"object"==typeof e?em.createElement(Bq,BV({},e,{key:"label-implicit"},r)):null})(t,BW(),n)||null}Bq.displayName="Label";var BZ=["valueAccessor"],BQ=["dataKey","clockWise","id","textBreakAll","zIndex"];function BJ(){return(BJ=Object.assign.bind()).apply(null,arguments)}function B0(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var B1=e=>Array.isArray(e.value)?(0,Bi.default)(e.value):e.value,B2=(0,em.createContext)(void 0),B5=B2.Provider,B3=(0,em.createContext)(void 0);function B4(e){var{valueAccessor:t=B1}=e,n=B0(e,BZ),{dataKey:r,clockWise:i,id:a,textBreakAll:o,zIndex:s}=n,l=B0(n,BQ),c=(0,em.useContext)(B2),u=(0,em.useContext)(B3),d=c||u;return d&&d.length?em.createElement(BL,{zIndex:null!=s?s:OJ.label},em.createElement(Br,{className:"recharts-label-list"},d.map((e,i)=>{var s,c=null==r?t(e,i):EG(e&&e.payload,r),u=null==a?{}:{id:"".concat(a,"-").concat(i)};return em.createElement(Bq,BJ({key:"label-".concat(i)},IW(e),l,u,{fill:null!=(s=n.fill)?s:e.fill,parentViewBox:e.parentViewBox,value:c,textBreakAll:o,viewBox:e.viewBox,index:i,zIndex:0}))}))):null}function B6(e){var{label:t}=e;return t?!0===t?em.createElement(B4,{key:"labelList-implicit"}):em.isValidElement(t)||BG(t)?em.createElement(B4,{key:"labelList-implicit",content:t}):"object"==typeof t?em.createElement(B4,BJ({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function B8(){return(B8=Object.assign.bind()).apply(null,arguments)}B3.Provider,B4.displayName="LabelList";var B7=e=>{var{cx:t,cy:n,r,className:i}=e,a=(0,_l.clsx)("recharts-dot",i);return k8(t)&&k8(n)&&k8(r)?em.createElement("circle",B8({},IU(e),R1(e),{className:a,cx:t,cy:n,r:r})):null},B9=(e.i(79684),e=>!e||"object"!=typeof e||!("clipDot"in e)||!!e.clipDot),ze=["points"];function zt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zt(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zr(){return(zr=Object.assign.bind()).apply(null,arguments)}function zi(e){var{option:t,dotProps:n,className:r}=e;if((0,em.isValidElement)(t))return(0,em.cloneElement)(t,n);if("function"==typeof t)return t(n);var i=(0,_l.clsx)(r,"boolean"!=typeof t?t.className:""),a=null!=n?n:{},{points:o}=a,s=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(a,ze);return em.createElement(B7,zr({},s,{className:i}))}function za(e){var{points:t,dot:n,className:r,dotClassName:i,dataKey:a,baseProps:o,needClip:s,clipPathId:l,zIndex:c=OJ.scatter}=e;if(null==t||!n&&1!==t.length)return null;var u=B9(n),d=null==n?null:(0,em.isValidElement)(n)?IW(n.props):"object"!=typeof n||Array.isArray(n)?null:IW(n),h=t.map((e,r)=>{var s,l,c=zn(zn(zn({r:3},o),d),{},{index:r,cx:null!=(s=e.x)?s:void 0,cy:null!=(l=e.y)?l:void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return em.createElement(zi,{key:"dot-".concat(r),option:n,dotProps:c,className:i})}),f={};return s&&null!=l&&(f.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(l,")")),em.createElement(BL,{zIndex:c},em.createElement(Br,zr({className:r},f),h))}function zo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zo(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zl=e=>{var t,{point:n,childIndex:r,mainColor:i,activeDot:a,dataKey:o,clipPath:s}=e;if(!1===a||null==n.x||null==n.y)return null;var l=zs(zs(zs({},{index:r,dataKey:o,cx:n.x,cy:n.y,r:4,fill:null!=i?i:"none",strokeWidth:2,stroke:"#fff",payload:n.payload,value:n.value}),IH(a)),R1(a));return t=(0,em.isValidElement)(a)?(0,em.cloneElement)(a,l):"function"==typeof a?a(l):em.createElement(B7,l),em.createElement(Br,{className:"recharts-active-dot",clipPath:s},t)};function zc(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=OJ.activeDot}=e,s=EM(DG),l=EM(D0);if(null==t||null==l)return null;var c=t.find(e=>l.includes(e.payload));return null==c?null:em.createElement(BL,{zIndex:o},em.createElement(zl,{point:c,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}function zu(e){var{tooltipEntrySettings:t}=e,n=ES(),r=_a(),i=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{r||(null===i.current?n(Et(t)):i.current!==t&&n(En({prev:i.current,next:t})),i.current=t)},[t,n,r]),(0,em.useLayoutEffect)(()=>()=>{i.current&&(n(Er(i.current)),i.current=null)},[n]),null}function zd(e,t){var n,r,i=EM(t=>Mb(t,e)),a=EM(e=>MN(e,t)),o=null!=(n=null==i?void 0:i.allowDataOverflow)?n:Mx.allowDataOverflow,s=null!=(r=null==a?void 0:a.allowDataOverflow)?r:Mw.allowDataOverflow;return{needClip:o||s,needClipX:o,needClipY:s}}function zh(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,i=EM(Rf),{needClipX:a,needClipY:o,needClip:s}=zd(t,n);if(!s||!i)return null;var{x:l,y:c,width:u,height:d}=i;return em.createElement("clipPath",{id:"clipPath-".concat(r)},em.createElement("rect",{x:a?l:l-u/2,y:o?c:c-d/2,width:a?u:2*u,height:o?d:2*d}))}function zf(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.xAxisId)?n:0}function zp(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.yAxisId)?n:0}var zm=(e,t,n)=>PJ(e,"xAxis",zf(e,t),n),zg=(e,t,n)=>PQ(e,"xAxis",zf(e,t),n),zv=(e,t,n)=>PJ(e,"yAxis",zp(e,t),n),zx=(e,t,n)=>PQ(e,"yAxis",zp(e,t),n),zy=N7([_S,zm,zv,zg,zx],(e,t,n,r,i)=>E$(e,"xAxis")?E0(t,r,!1):E0(n,i,!1)),zb=N7([MA,(e,t)=>t],(e,t)=>e.filter(e=>"area"===e.type).find(e=>e.id===t)),zw=e=>E$(_S(e),"xAxis")?"yAxis":"xAxis",zj=N7([zb,(e,t,n)=>MZ(e,zw(e),"yAxis"===zw(e)?zp(e,t):zf(e,t),n)],(e,t)=>{if(null!=e&&null!=t){var n,{stackId:r}=e,i=Ml(e);if(null!=r&&null!=i){var a=null==(n=t[r])?void 0:n.stackedData,o=null==a?void 0:a.find(e=>e.key===i);if(null!=o)return o.map(e=>[e[0],e[1]])}}}),zN=N7([_S,zm,zv,zg,zx,zj,(e,t,n)=>n?ON(e):Oj(e),zy,zb,e=>e.rootProps.baseValue],(e,t,n,r,i,a,o,s,l,c)=>{var u,{chartData:d,dataStartIndex:h,dataEndIndex:f}=o;if(null!=l&&("horizontal"===e||"vertical"===e)&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=s){var{data:p}=l;if(null!=(u=p&&p.length>0?p:null==d?void 0:d.slice(h,f+1)))return function(e){var t,{areaSettings:{connectNulls:n,baseValue:r,dataKey:i},stackedData:a,layout:o,chartBaseValue:s,xAxis:l,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:h,yAxisTicks:f,bandSize:p}=e,g=a&&a.length,v=((e,t,n,r,i)=>{var a=null!=n?n:t;if(k8(a))return a;var o="horizontal"===e?i:r,s=o.scale.domain();if("number"===o.type){var l=Math.max(s[0],s[1]),c=Math.min(s[0],s[1]);return"dataMin"===a?c:"dataMax"===a||l<0?l:Math.max(Math.min(s[0],s[1]),0)}return"dataMin"===a?s[0]:"dataMax"===a?s[1]:s[0]})(o,s,r,l,c),x="horizontal"===o,y=!1,b=u.map((e,t)=>{if(g)s=a[d+t];else{var r,o,s,u=EG(e,i);Array.isArray(u)?(s=u,y=!0):s=[v,u]}var b=null!=(r=null==(o=s)?void 0:o[1])?r:null,w=null==b||g&&!n&&null==EG(e,i);return x?{x:EZ({axis:l,ticks:h,bandSize:p,entry:e,index:t}),y:w?null:c.scale(b),value:s,payload:e}:{x:w?null:l.scale(b),y:EZ({axis:c,ticks:f,bandSize:p,entry:e,index:t}),value:s,payload:e}});return t=g||y?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return x?{x:e.x,y:null!=t&&null!=e.y?c.scale(t):null,payload:e.payload}:{x:null!=t?l.scale(t):null,y:e.y,payload:e.payload}}):x?c.scale(v):l.scale(v),{points:b,baseLine:t,isRange:y}}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:h,areaSettings:l,stackedData:a,displayedData:u,chartBaseValue:c,bandSize:s})}});function zk(e){var{legendPayload:t}=e,n=ES(),r=_a(),i=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{r||(null===i.current?n(LK(t)):i.current!==t&&n(LZ({prev:i.current,next:t})),i.current=t)},[n,r,t]),(0,em.useLayoutEffect)(()=>()=>{i.current&&(n(LQ(i.current)),i.current=null)},[n]),null}function zC(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"animation-",n=(0,em.useRef)(Ce(t)),r=(0,em.useRef)(e);return r.current!==e&&(n.current=Ce(t),r.current=e),n.current}var zE=null!=(Y=em["useId".toString()])?Y:()=>{var[e]=em.useState(()=>Ce("uid-"));return e},z_=(0,em.createContext)(void 0),zS=e=>{var t,n,{id:r,type:i,children:a}=e,o=(t="recharts-".concat(i),n=zE(),r||(t?"".concat(t,"-").concat(n):n));return em.createElement(z_.Provider,{value:o},a(o))},zT=(0,em.memo)(e=>{var t=ES(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(LT(e)):n.current!==e&&t(LA({prev:n.current,next:e})),n.current=e},[t,e]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(LO(n.current)),n.current=null)},[t]),null});function zA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zA(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zA(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zM=(e,t,n)=>e.map(e=>"".concat(e.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase()))," ").concat(t,"ms ").concat(n)).join(","),zP=(e,t)=>Object.keys(t).reduce((n,r)=>zO(zO({},n),{},{[r]:e(r,t[r])}),{});function zD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zL(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zD(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zD(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zI=(e,t,n)=>e+(t-e)*n,zR=e=>{var{from:t,to:n}=e;return t!==n},zB=(e,t,n)=>{var r=zP((t,n)=>{if(zR(n)){var[r,i]=e(n.from,n.to,n.velocity);return zL(zL({},n),{},{from:r,velocity:i})}return n},t);return n<1?zP((e,t)=>zR(t)&&null!=r[e]?zL(zL({},t),{},{velocity:zI(t.velocity,r[e].velocity,n),from:zI(t.from,r[e].from,n)}):t,t):zB(e,r,n-1)},zz=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],zF=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),zV=(e,t)=>n=>zF(zz(e,t),n),zU=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(1===t.length)switch(t[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:var r=(e=>{var t,n=e.split("(");if(2!==n.length||"cubic-bezier"!==n[0])return null;var r=null==(t=n[1])||null==(t=t.split(")")[0])?void 0:t.split(",");if(null==r||4!==r.length)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]})(t[0]);if(r)return r}return 4===t.length?t:[0,0,1,1]},zH=function(){return((e,t,n,r)=>{var i=zV(e,n),a=zV(t,r),o=t=>zF([...zz(e,n).map((e,t)=>e*t).slice(1),0],t),s=e=>e>1?1:e<0?0:e,l=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var l=i(n)-t,c=o(n);if(1e-4>Math.abs(l-t)||c<1e-4)break;n=s(n-l/c)}return a(n)};return l.isStepper=!1,l})(...zU(...arguments))},zW=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{stiff:t=100,damping:n=8,dt:r=17}=e,i=(e,i,a)=>{var o=a+(-(e-i)*t-a*n)*r/1e3,s=a*r/1e3+e;return 1e-4>Math.abs(s-i)&&1e-4>Math.abs(o)?[i,0]:[s,o]};return i.isStepper=!0,i.dt=r,i};class zY{setTimeout(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):"function"==typeof requestAnimationFrame&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{null!=r&&cancelAnimationFrame(r)}}}var zG=(0,em.createContext)(function(){var e,t,n,r,i;return e=new zY,t=()=>null,n=!1,r=null,i=a=>{if(!n){if(Array.isArray(a)){if(!a.length)return;var[o,...s]=a;if("number"==typeof o){r=e.setTimeout(i.bind(null,s),o);return}i(o),r=e.setTimeout(i.bind(null,s));return}"string"==typeof a&&t(a),"object"==typeof a&&t(a),"function"==typeof a&&a()}},{stop:()=>{n=!0},start:e=>{n=!1,r&&(r(),r=null),i(e)},subscribe:e=>(t=e,()=>{t=()=>null}),getTimeoutController:()=>e}}),z$={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},zX={t:0},zq={t:1};function zK(e){var t,n,r,i=Ry(e,z$),{isActive:a,canBegin:o,duration:s,easing:l,begin:c,onAnimationEnd:u,onAnimationStart:d,children:h}=i,f="auto"===a?!Ix.isSsr:a,p=(t=i.animationId,n=i.animationManager,r=(0,em.useContext)(zG),(0,em.useMemo)(()=>null!=n?n:r(t),[t,n,r])),[g,v]=(0,em.useState)(f?zX:zq),x=(0,em.useRef)(null);return(0,em.useEffect)(()=>{f||v(zq)},[f]),(0,em.useEffect)(()=>{if(!f||!o)return Cs;var e=((e,t,n,r,i,a)=>{var o,s,l,c,u,d,h,f,p=[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e)));return null==n?()=>(i(zL(zL({},e),t)),()=>{}):!0===n.isStepper?(s=p.reduce((n,r)=>zL(zL({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),l=null,c=r=>{o||(o=r);var u=(r-o)/n.dt;s=zB(n,s,u),i(zL(zL(zL({},e),t),zP((e,t)=>t.from,s))),o=r,Object.values(s).filter(zR).length&&(l=a.setTimeout(c))},()=>(l=a.setTimeout(c),()=>{var e;null==(e=l)||e()})):(d=null,h=p.reduce((n,r)=>{var i=e[r],a=t[r];return null==i||null==a?n:zL(zL({},n),{},{[r]:[i,a]})},{}),f=o=>{u||(u=o);var s=(o-u)/r,l=zP((e,t)=>zI(...t,n(s)),h);if(i(zL(zL(zL({},e),t),l)),s<1)d=a.setTimeout(f);else{var c=zP((e,t)=>zI(...t,n(1)),h);i(zL(zL(zL({},e),t),c))}},()=>(d=a.setTimeout(f),()=>{var e;null==(e=d)||e()}))})(zX,zq,(e=>{if("string"==typeof e)switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return zH(e);case"spring":return zW();default:if("cubic-bezier"===e.split("(")[0])return zH(e)}return"function"==typeof e?e:null})(l),s,v,p.getTimeoutController());return p.start([d,c,()=>{x.current=e()},s,u]),()=>{p.stop(),x.current&&x.current(),u()}},[f,o,s,l,c,d,u,p]),h(g.t)}function zZ(e){var t=IH(e);if(null!=t){var{r:n,strokeWidth:r}=t,i=Number(n),a=Number(r);return(Number.isNaN(i)||i<0)&&(i=3),(Number.isNaN(a)||a<0)&&(a=2),{r:i,strokeWidth:a}}return{r:3,strokeWidth:2}}var zQ=["id"],zJ=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function z0(){return(z0=Object.assign.bind()).apply(null,arguments)}function z1(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function z2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function z5(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z2(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z2(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function z3(e,t){return e&&"none"!==e?e:t}var z4=RC.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:E2(o,t),hide:s,type:c,color:z3(r,a),unit:l,graphicalItemId:u}};return RC.createElement(zu,{tooltipEntrySettings:d})});function z6(e){var{clipPathId:t,points:n,props:r}=e,{needClip:i,dot:a,dataKey:o}=r,s=IU(r);return RC.createElement(za,{points:n,dot:a,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function z8(e){var{showLabels:t,children:n,points:r}=e,i=r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return z5(z5({},r),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:r,fill:void 0})});return RC.createElement(B5,{value:t?i:void 0},n)}function z7(e){var{points:t,baseLine:n,needClip:r,clipPathId:i,props:a}=e,{layout:o,type:s,stroke:l,connectNulls:c,isRange:u}=a,{id:d}=a,h=z1(a,zQ),f=IU(h),p=IW(h);return RC.createElement(RC.Fragment,null,(null==t?void 0:t.length)>1&&RC.createElement(Br,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},RC.createElement(Be,z0({},p,{id:d,points:t,connectNulls:c,type:s,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),"none"!==l&&RC.createElement(Be,z0({},f,{className:"recharts-area-curve",layout:o,type:s,connectNulls:c,fill:"none",points:t})),"none"!==l&&u&&RC.createElement(Be,z0({},f,{className:"recharts-area-curve",layout:o,type:s,connectNulls:c,fill:"none",points:n}))),RC.createElement(z6,{points:t,props:h,clipPathId:i}))}function z9(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,s=null==(t=a[0])?void 0:t.y,l=null==(n=a[a.length-1])?void 0:n.y;if(!EU(s)||!EU(l))return null;var c=r*Math.abs(s-l),u=Math.max(...a.map(e=>e.x||0));return(k8(i)?u=Math.max(i,u):i&&Array.isArray(i)&&i.length&&(u=Math.max(...i.map(e=>e.x||0),u)),k8(u))?RC.createElement("rect",{x:0,y:s<l?s:s-c,width:u+(o?parseInt("".concat(o),10):1),height:Math.floor(c)}):null}function Fe(e){var t,n,{alpha:r,baseLine:i,points:a,strokeWidth:o}=e,s=null==(t=a[0])?void 0:t.x,l=null==(n=a[a.length-1])?void 0:n.x;if(!EU(s)||!EU(l))return null;var c=r*Math.abs(s-l),u=Math.max(...a.map(e=>e.y||0));return(k8(i)?u=Math.max(i,u):i&&Array.isArray(i)&&i.length&&(u=Math.max(...i.map(e=>e.y||0),u)),k8(u))?RC.createElement("rect",{x:s<l?s:s-c,y:0,width:c,height:Math.floor(u+(o?parseInt("".concat(o),10):1))}):null}function Ft(e){var{alpha:t,layout:n,points:r,baseLine:i,strokeWidth:a}=e;return"vertical"===n?RC.createElement(z9,{alpha:t,points:r,baseLine:i,strokeWidth:a}):RC.createElement(Fe,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function Fn(e){var{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a}=e,{points:o,baseLine:s,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,onAnimationStart:h,onAnimationEnd:f}=r,p=zC((0,RC.useMemo)(()=>({points:o,baseLine:s}),[o,s]),"recharts-area-"),g=(()=>{var e=EM(_S);if("horizontal"===e||"vertical"===e)return e})(),[v,x]=(0,RC.useState)(!1),y=(0,RC.useCallback)(()=>{"function"==typeof f&&f(),x(!1)},[f]),b=(0,RC.useCallback)(()=>{"function"==typeof h&&h(),x(!0)},[h]);if(null==g)return null;var w=i.current,j=a.current;return RC.createElement(z8,{showLabels:!v,points:o},r.children,RC.createElement(zK,{animationId:p,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:y,onAnimationStart:b,key:p},e=>{if(w){var c,u=w.length/o.length,d=1===e?o:o.map((t,n)=>{var r=Math.floor(n*u);if(w[r]){var i=w[r];return z5(z5({},t),{},{x:Cr(i.x,t.x,e),y:Cr(i.y,t.y,e)})}return t});if(k8(s))c=Cr(j,s,e);else c=null==s||k4(s)?Cr(j,0,e):s.map((t,n)=>{var r=Math.floor(n*u);if(Array.isArray(j)&&j[r]){var i=j[r];return z5(z5({},t),{},{x:Cr(i.x,t.x,e),y:Cr(i.y,t.y,e)})}return t});return e>0&&(i.current=d,a.current=c),RC.createElement(z7,{points:d,baseLine:c,needClip:t,clipPathId:n,props:r})}return e>0&&(i.current=o,a.current=s),RC.createElement(Br,null,l&&RC.createElement("defs",null,RC.createElement("clipPath",{id:"animationClipPath-".concat(n)},RC.createElement(Ft,{alpha:e,points:o,baseLine:s,layout:g,strokeWidth:r.strokeWidth}))),RC.createElement(Br,{clipPath:"url(#animationClipPath-".concat(n,")")},RC.createElement(z7,{points:o,baseLine:s,needClip:t,clipPathId:n,props:r})))}),RC.createElement(B6,{label:r.label}))}function Fr(e){var{needClip:t,clipPathId:n,props:r}=e,i=(0,RC.useRef)(null),a=(0,RC.useRef)();return RC.createElement(Fn,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}class Fi extends RC.PureComponent{render(){var{hide:e,dot:t,points:n,className:r,top:i,left:a,needClip:o,xAxisId:s,yAxisId:l,width:c,height:u,id:d,baseLine:h,zIndex:f}=this.props;if(e)return null;var p=(0,_l.clsx)("recharts-area",r),{r:g,strokeWidth:v}=zZ(t),x=B9(t),y=2*g+v,b=o?"url(#clipPath-".concat(x?"":"dots-").concat(d,")"):void 0;return RC.createElement(BL,{zIndex:f},RC.createElement(Br,{className:p},o&&RC.createElement("defs",null,RC.createElement(zh,{clipPathId:d,xAxisId:s,yAxisId:l}),!x&&RC.createElement("clipPath",{id:"clipPath-dots-".concat(d)},RC.createElement("rect",{x:a-y/2,y:i-y/2,width:c+y,height:u+y}))),RC.createElement(Fr,{needClip:o,clipPathId:d,props:this.props})),RC.createElement(zc,{points:n,mainColor:z3(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:b}),this.props.isRange&&Array.isArray(h)&&RC.createElement(zc,{points:h,mainColor:z3(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:b}))}}var Fa={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:OJ.area};function Fo(e){var t,n=Ry(e,Fa),{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:l,fill:c,fillOpacity:u,hide:d,isAnimationActive:h,legendType:f,stroke:p,xAxisId:g,yAxisId:v}=n,x=z1(n,zJ),y=EM(_S),b=EM(OY),{needClip:w}=zd(g,v),j=_a(),{points:N,isRange:k,baseLine:C}=null!=(t=EM(t=>zN(t,e.id,j)))?t:{},E=EM(Rf);if("horizontal"!==y&&"vertical"!==y||null==E||"AreaChart"!==b&&"ComposedChart"!==b)return null;var{height:_,width:S,x:T,y:A}=E;return N&&N.length?RC.createElement(Fi,z0({},x,{activeDot:r,animationBegin:i,animationDuration:a,animationEasing:o,baseLine:C,connectNulls:s,dot:l,fill:c,fillOpacity:u,height:_,hide:d,layout:y,isAnimationActive:"auto"===h?!Ix.isSsr:h,isRange:k,legendType:f,needClip:w,points:N,stroke:p,width:S,left:T,top:A,xAxisId:g,yAxisId:v})):null}var Fs=RC.memo(function(e){var t=Ry(e,Fa),n=_a();return RC.createElement(zS,{id:t.id,type:"area"},e=>{var r;return RC.createElement(RC.Fragment,null,RC.createElement(zk,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,fill:i,legendType:a,hide:o}=e;return[{inactive:o,dataKey:t,type:a,color:z3(r,i),value:E2(n,t),payload:e}]})(t)}),RC.createElement(z4,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),RC.createElement(zT,{type:"area",id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:null==(r=t.stackId)?void 0:String(r),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),RC.createElement(Fo,z0({},t,{id:e})))})},IP);Fs.displayName="Area";class Fl{static create(e){return new Fl(e)}constructor(e){this.scale=e}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}apply(e){var{bandAware:t,position:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==e){if(n)switch(n){case"start":default:return this.scale(e);case"middle":var r=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+r;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(e)+i}if(t){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+a}return this.scale(e)}}isInRange(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}(h="symbol"==typeof(l=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(h="EPS","string"))?l:l+"")in Fl?Object.defineProperty(Fl,h,{value:1e-4,enumerable:!0,configurable:!0,writable:!0}):Fl[h]=1e-4;var Fc=function(e){var{width:t,height:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(r%180+180)%180*Math.PI/180,a=Math.atan(n/t);return Math.abs(i>a&&i<Math.PI-a?n/Math.sin(i):t/Math.cos(i))};function Fu(e,t){if(t<1)return[];if(1===t)return e;for(var n=[],r=0;r<e.length;r+=t){var i=e[r];void 0!==i&&n.push(i)}return n}function Fd(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function Fh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ff(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fh(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fp(e,t,n){var r,{tick:i,ticks:a,viewBox:o,minTickGap:s,orientation:l,interval:c,tickFormatter:u,unit:d,angle:h}=e;if(!a||!a.length||!i)return[];if(k8(c)||Ix.isSsr)return null!=(r=Fu(a,(k8(c)?c:0)+1))?r:[];var f="top"===l||"bottom"===l?"width":"height",p=d&&"width"===f?Bd(d,{fontSize:t,letterSpacing:n}):{width:0,height:0},g=(e,r)=>{var i,a="function"==typeof u?u(e.value,r):e.value;return"width"===f?(i=Bd(a,{fontSize:t,letterSpacing:n}),Fc({width:i.width+p.width,height:i.height+p.height},h)):Bd(a,{fontSize:t,letterSpacing:n})[f]},v=a.length>=2?k3(a[1].coordinate-a[0].coordinate):1,x=function(e,t,n){var r="width"===n,{x:i,y:a,width:o,height:s}=e;return 1===t?{start:r?i:a,end:r?i+o:a+s}:{start:r?i+o:a+s,end:r?i:a}}(o,v,f);return"equidistantPreserveStart"===c?function(e,t,n,r,i){for(var a,o=(r||[]).slice(),{start:s,end:l}=t,c=0,u=1,d=s;u<=o.length;)if(a=function(){var t,a=null==r?void 0:r[c];if(void 0===a)return{v:Fu(r,u)};var o=c,h=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=0===c||Fd(e,f,h,d,l);p||(c=0,d=s,u+=1),p&&(d=f+e*(h()/2+i),c+=u)}())return a.v;return[]}(v,x,g,a,s):"equidistantPreserveEnd"===c?function(e,t,n,r,i){var a=(r||[]).slice().length;if(0===a)return[];for(var{start:o,end:s}=t,l=1;l<=a;l++){for(var c=(a-1)%l,u=o,d=!0,h=c;h<a&&!function(){var t,a=r[h],o=h,l=()=>(void 0===t&&(t=n(a,o)),t),f=a.coordinate,p=h===c||Fd(e,f,l,u,s);if(!p)return d=!1,1;p&&(u=f+e*(l()/2+i))}();h+=l);if(d){for(var f=[],p=c;p<a;p+=l)f.push(r[p]);return f}}return[]}(v,x,g,a,s):("preserveStart"===c||"preserveStartEnd"===c?function(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,{start:l,end:c}=t;if(a){var u=r[s-1],d=n(u,s-1),h=e*(u.coordinate+e*d/2-c);o[s-1]=u=Ff(Ff({},u),{},{tickCoord:h>0?u.coordinate-h*e:u.coordinate}),null!=u.tickCoord&&Fd(e,u.tickCoord,()=>d,l,c)&&(c=u.tickCoord-e*(d/2+i),o[s-1]=Ff(Ff({},u),{},{isShow:!0}))}for(var f=a?s-1:s,p=function(t){var r,a=o[t],s=()=>(void 0===r&&(r=n(a,t)),r);if(0===t){var u=e*(a.coordinate-e*s()/2-l);o[t]=a=Ff(Ff({},a),{},{tickCoord:u<0?a.coordinate-u*e:a.coordinate})}else o[t]=a=Ff(Ff({},a),{},{tickCoord:a.coordinate});null!=a.tickCoord&&Fd(e,a.tickCoord,s,l,c)&&(l=a.tickCoord+e*(s()/2+i),o[t]=Ff(Ff({},a),{},{isShow:!0}))},g=0;g<f;g++)p(g);return o}(v,x,g,a,s,"preserveStartEnd"===c):function(e,t,n,r,i){for(var a=(r||[]).slice(),o=a.length,{start:s}=t,{end:l}=t,c=function(t){var r,c=a[t],u=()=>(void 0===r&&(r=n(c,t)),r);if(t===o-1){var d=e*(c.coordinate+e*u()/2-l);a[t]=c=Ff(Ff({},c),{},{tickCoord:d>0?c.coordinate-d*e:c.coordinate})}else a[t]=c=Ff(Ff({},c),{},{tickCoord:c.coordinate});null!=c.tickCoord&&Fd(e,c.tickCoord,u,s,l)&&(l=c.tickCoord-e*(u()/2+i),a[t]=Ff(Ff({},c),{},{isShow:!0}))},u=o-1;u>=0;u--)c(u);return a}(v,x,g,a,s)).filter(e=>e.isShow)}var Fm=["axisLine","width","height","className","hide","ticks","axisType"];function Fg(){return(Fg=Object.assign.bind()).apply(null,arguments)}function Fv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fx(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fv(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Fy={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:OJ.axis};function Fb(e){var{x:t,y:n,width:r,height:i,orientation:a,mirror:o,axisLine:s,otherSvgProps:l}=e;if(!s)return null;var c=Fx(Fx(Fx({},l),IU(s)),{},{fill:"none"});if("top"===a||"bottom"===a){var u=+("top"===a&&!o||"bottom"===a&&o);c=Fx(Fx({},c),{},{x1:t,y1:n+u*i,x2:t+r,y2:n+u*i})}else{var d=+("left"===a&&!o||"right"===a&&o);c=Fx(Fx({},c),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return em.createElement("line",Fg({},c,{className:(0,_l.clsx)("recharts-cartesian-axis-line",(0,k1.default)(s,"className"))}))}function Fw(e){var t,{option:n,tickProps:r,value:i}=e,a=(0,_l.clsx)(r.className,"recharts-cartesian-axis-tick-value");if(em.isValidElement(n))t=em.cloneElement(n,Fx(Fx({},r),{},{className:a}));else if("function"==typeof n)t=n(Fx(Fx({},r),{},{className:a}));else{var o="recharts-cartesian-axis-tick-value";"boolean"!=typeof n&&(o=(0,_l.clsx)(o,null==n?void 0:n.className)),t=em.createElement(BD,Fg({},r,{className:o}),i)}return t}var Fj=(0,em.forwardRef)((e,t)=>{var{ticks:n=[],tick:r,tickLine:i,stroke:a,tickFormatter:o,unit:s,padding:l,tickTextProps:c,orientation:u,mirror:d,x:h,y:f,width:p,height:g,tickSize:v,tickMargin:x,fontSize:y,letterSpacing:b,getTicksConfig:w,events:j,axisType:N}=e,k=Fp(Fx(Fx({},w),{},{ticks:n}),y,b),C=function(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}(u,d),E=function(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}(u,d),_=IU(w),S=IH(r),T={};"object"==typeof i&&(T=i);var A=Fx(Fx({},_),{},{fill:"none"},T),O=k.map(e=>Fx({entry:e},function(e,t,n,r,i,a,o,s,l){var c,u,d,h,f,p,g=s?-1:1,v=e.tickSize||o,x=k8(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case"top":c=u=e.coordinate,p=(d=(h=n+!s*i)-g*v)-g*l,f=x;break;case"left":d=h=e.coordinate,f=(c=(u=t+!s*r)-g*v)-g*l,p=x;break;case"right":d=h=e.coordinate,f=(c=(u=t+s*r)+g*v)+g*l,p=x;break;default:c=u=e.coordinate,p=(d=(h=n+s*i)+g*v)+g*l,f=x}return{line:{x1:c,y1:d,x2:u,y2:h},tick:{x:f,y:p}}}(e,h,f,p,g,u,v,d,x))),M=O.map(e=>{var{entry:t,line:n}=e;return em.createElement(Br,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},i&&em.createElement("line",Fg({},A,n,{className:(0,_l.clsx)("recharts-cartesian-axis-tick-line",(0,k1.default)(i,"className"))})))}),P=O.map((e,t)=>{var{entry:n,tick:i}=e,u=Fx(Fx(Fx(Fx({textAnchor:C,verticalAnchor:E},_),{},{stroke:"none",fill:a},S),i),{},{index:t,payload:n,visibleTicksCount:k.length,tickFormatter:o,padding:l},c);return em.createElement(Br,Fg({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(n.value,"-").concat(n.coordinate,"-").concat(n.tickCoord)},((e,t,n)=>{if(null===e||"object"!=typeof e&&"function"!=typeof e)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];IB(i)&&"function"==typeof a&&(r||(r={}),r[i]=e=>(a(t,n,e),null))}),r})(j,n,t)),r&&em.createElement(Fw,{option:r,tickProps:u,value:"".concat("function"==typeof o?o(n.value,t):n.value).concat(s||"")}))});return em.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(N,"-ticks")},P.length>0&&em.createElement(BL,{zIndex:OJ.label},em.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(N,"-tick-labels"),ref:t},P)),M.length>0&&em.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(N,"-tick-lines")},M))}),FN=(0,em.forwardRef)((e,t)=>{var{axisLine:n,width:r,height:i,className:a,hide:o,ticks:s,axisType:l}=e,c=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Fm),[u,d]=(0,em.useState)(""),[h,f]=(0,em.useState)(""),p=(0,em.useRef)(null);(0,em.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>{var t;return(e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:i=0,tickMargin:a=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var s=n?n.getBoundingClientRect().width:0;return Math.round(o+(i+a)+s+(n?r:0))}return 0})({ticks:p.current,label:null==(t=e.labelRef)?void 0:t.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var g=(0,em.useCallback)(e=>{if(e){var t=e.getElementsByClassName("recharts-cartesian-axis-tick-value");p.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==u||a!==h)&&(d(i),f(a))}}},[u,h]);return o||null!=r&&r<=0||null!=i&&i<=0?null:em.createElement(BL,{zIndex:e.zIndex},em.createElement(Br,{className:(0,_l.clsx)("recharts-cartesian-axis",a)},em.createElement(Fb,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:IU(e)}),em.createElement(Fj,{ref:g,axisType:l,events:c,fontSize:u,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y}),em.createElement(BH,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},em.createElement(BK,{label:e.label,labelRef:e.labelRef}),e.children)))}),Fk=em.forwardRef((e,t)=>{var n=Ry(e,Fy);return em.createElement(FN,Fg({},n,{ref:t}))});Fk.displayName="CartesianAxis";var FC=["domain","range"],FE=["domain","range"];function F_(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FS(e,t){return e===t||!!(Array.isArray(e)&&2===e.length&&Array.isArray(t))&&2===t.length&&e[0]===t[0]&&e[1]===t[1]}function FT(e,t){if(e===t)return!0;var{domain:n,range:r}=e,i=F_(e,FC),{domain:a,range:o}=t,s=F_(t,FE);return!!FS(n,a)&&!!FS(r,o)&&IP(i,s)}var FA=["dangerouslySetInnerHTML","ticks","scale"],FO=["id","scale"];function FM(){return(FM=Object.assign.bind()).apply(null,arguments)}function FP(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FD(e){var t=ES(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(Lv(e)):n.current!==e&&t(Lx({prev:n.current,next:e})),n.current=e},[e,t]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(Ly(n.current)),n.current=null)},[t]),null}var FL=e=>{var{xAxisId:t,className:n}=e,r=EM(_r),i=_a(),a="xAxis",o=EM(e=>PZ(e,a,t,i)),s=EM(e=>PF(e,t)),l=EM(e=>PH(e,t)),c=EM(e=>My(e,t));if(null==s||null==l||null==c)return null;var{dangerouslySetInnerHTML:u,ticks:d,scale:h}=e,f=FP(e,FA),{id:p,scale:g}=c,v=FP(c,FO);return em.createElement(Fk,FM({},f,v,{x:l.x,y:l.y,width:s.width,height:s.height,className:(0,_l.clsx)("recharts-".concat(a," ").concat(a),n),viewBox:r,ticks:o,axisType:a}))},FI={allowDataOverflow:Mx.allowDataOverflow,allowDecimals:Mx.allowDecimals,allowDuplicatedCategory:Mx.allowDuplicatedCategory,angle:Mx.angle,axisLine:Fy.axisLine,height:Mx.height,hide:!1,includeHidden:Mx.includeHidden,interval:Mx.interval,minTickGap:Mx.minTickGap,mirror:Mx.mirror,orientation:Mx.orientation,padding:Mx.padding,reversed:Mx.reversed,scale:Mx.scale,tick:Mx.tick,tickCount:Mx.tickCount,tickLine:Fy.tickLine,tickSize:Fy.tickSize,type:Mx.type,xAxisId:0},FR=em.memo(e=>{var t=Ry(e,FI);return em.createElement(em.Fragment,null,em.createElement(FD,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),em.createElement(FL,t))},FT);FR.displayName="XAxis";var FB=["dangerouslySetInnerHTML","ticks","scale"],Fz=["id","scale"];function FF(){return(FF=Object.assign.bind()).apply(null,arguments)}function FV(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function FU(e){var t=ES(),n=(0,em.useRef)(null);return(0,em.useLayoutEffect)(()=>{null===n.current?t(Lb(e)):n.current!==e&&t(Lw({prev:n.current,next:e})),n.current=e},[e,t]),(0,em.useLayoutEffect)(()=>()=>{n.current&&(t(Lj(n.current)),n.current=null)},[t]),null}var FH=e=>{var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,em.useRef)(null),o=(0,em.useRef)(null),s=EM(_r),l=_a(),c=ES(),u="yAxis",d=EM(e=>PY(e,t)),h=EM(e=>PW(e,t)),f=EM(e=>PZ(e,u,t,l)),p=EM(e=>Mj(e,t));if((0,em.useLayoutEffect)(()=>{if(!("auto"!==r||!d||BG(i)||(0,em.isValidElement)(i))&&null!=p){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&c(LE({id:t,width:n}))}}},[f,d,c,i,t,r,p]),null==d||null==h||null==p)return null;var{dangerouslySetInnerHTML:g,ticks:v,scale:x}=e,y=FV(e,FB),{id:b,scale:w}=p,j=FV(p,Fz);return em.createElement(Fk,FF({},y,j,{ref:a,labelRef:o,x:h.x,y:h.y,tickTextProps:"auto"===r?{width:void 0}:{width:r},width:d.width,height:d.height,className:(0,_l.clsx)("recharts-".concat(u," ").concat(u),n),viewBox:s,ticks:f,axisType:u}))},FW={allowDataOverflow:Mw.allowDataOverflow,allowDecimals:Mw.allowDecimals,allowDuplicatedCategory:Mw.allowDuplicatedCategory,angle:Mw.angle,axisLine:Fy.axisLine,hide:!1,includeHidden:Mw.includeHidden,interval:Mw.interval,minTickGap:Mw.minTickGap,mirror:Mw.mirror,orientation:Mw.orientation,padding:Mw.padding,reversed:Mw.reversed,scale:Mw.scale,tick:Mw.tick,tickCount:Mw.tickCount,tickLine:Fy.tickLine,tickSize:Fy.tickSize,type:Mw.type,width:Mw.width,yAxisId:0},FY=em.memo(e=>{var t=Ry(e,FW);return em.createElement(em.Fragment,null,em.createElement(FU,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),em.createElement(FH,t))},FT);function FG(){return(FG=Object.assign.bind()).apply(null,arguments)}function F$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function FX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F$(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fq(e){return Array.isArray(e)&&k7(e[0])&&k7(e[1])?e.join(" ~ "):e}FY.displayName="YAxis";var FK=e=>{var{separator:t=" : ",contentStyle:n={},itemStyle:r={},labelStyle:i={},payload:a,formatter:o,itemSorter:s,wrapperClassName:l,labelClassName:c,label:u,labelFormatter:d,accessibilityLayer:h=!1}=e,f=FX({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},n),p=FX({margin:0},i),g=null!=u,v=g?u:"",x=(0,_l.clsx)("recharts-default-tooltip",l),y=(0,_l.clsx)("recharts-tooltip-label",c);return g&&d&&null!=a&&(v=d(u,a)),em.createElement("div",FG({className:x,style:f},h?{role:"status","aria-live":"assertive"}:{}),em.createElement("p",{className:y,style:p},em.isValidElement(v)?v:"".concat(v)),(()=>{if(a&&a.length){var e=(s?(0,EP.default)(a,s):a).map((e,n)=>{if("none"===e.type)return null;var i=e.formatter||o||Fq,{value:s,name:l}=e,c=s,u=l,d=i(s,l,e,n,a);if(Array.isArray(d))[c,u]=d;else{if(null==d)return null;c=d}var h=FX({display:"block",paddingTop:4,paddingBottom:4,color:e.color||"#000"},r);return em.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(n),style:h},k7(u)?em.createElement("span",{className:"recharts-tooltip-item-name"},u):null,k7(u)?em.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,em.createElement("span",{className:"recharts-tooltip-item-value"},c),em.createElement("span",{className:"recharts-tooltip-item-unit"},e.unit||""))});return em.createElement("ul",{className:"recharts-tooltip-item-list",style:{padding:0,margin:0}},e)}return null})())},FZ=em,FQ="recharts-tooltip-wrapper",FJ={visibility:"hidden"};function F0(e){var{allowEscapeViewBox:t,coordinate:n,key:r,offsetTopLeft:i,position:a,reverseDirection:o,tooltipDimension:s,viewBox:l,viewBoxDimension:c}=e;if(a&&k8(a[r]))return a[r];var u=n[r]-s-(i>0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var h=l[r];return null==h?0:o[r]?u<h?Math.max(d,h):Math.max(u,h):null==c?0:d+s>h+c?Math.max(u,h):Math.max(d,h)}function F1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function F2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F1(Object(n),!0).forEach(function(t){F5(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function F5(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:r+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class F3 extends FZ.PureComponent{constructor(){super(...arguments),F5(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),F5(this,"handleKeyDown",e=>{if("Escape"===e.key){var t,n,r,i;this.setState({dismissed:!0,dismissedAtCoordinate:{x:null!=(t=null==(n=this.props.coordinate)?void 0:n.x)?t:0,y:null!=(r=null==(i=this.props.coordinate)?void 0:i.y)?r:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var e,t;this.state.dismissed&&((null==(e=this.props.coordinate)?void 0:e.x)!==this.state.dismissedAtCoordinate.x||(null==(t=this.props.coordinate)?void 0:t.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:e,allowEscapeViewBox:t,animationDuration:n,animationEasing:r,children:i,coordinate:a,hasPayload:o,isAnimationActive:s,offset:l,position:c,reverseDirection:u,useTranslate3d:d,viewBox:h,wrapperStyle:f,lastBoundingBox:p,innerRef:g,hasPortalFromProps:v}=this.props,{cssClasses:x,cssProperties:y}=function(e){var t,n,r,{allowEscapeViewBox:i,coordinate:a,offsetTopLeft:o,position:s,reverseDirection:l,tooltipBox:c,useTranslate3d:u,viewBox:d}=e;return{cssProperties:t=c.height>0&&c.width>0&&a?function(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}({translateX:n=F0({allowEscapeViewBox:i,coordinate:a,key:"x",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.width,viewBox:d,viewBoxDimension:d.width}),translateY:r=F0({allowEscapeViewBox:i,coordinate:a,key:"y",offsetTopLeft:o,position:s,reverseDirection:l,tooltipDimension:c.height,viewBox:d,viewBoxDimension:d.height}),useTranslate3d:u}):FJ,cssClasses:function(e){var{coordinate:t,translateX:n,translateY:r}=e;return(0,_l.clsx)(FQ,{["".concat(FQ,"-right")]:k8(n)&&t&&k8(t.x)&&n>=t.x,["".concat(FQ,"-left")]:k8(n)&&t&&k8(t.x)&&n<t.x,["".concat(FQ,"-bottom")]:k8(r)&&t&&k8(t.y)&&r>=t.y,["".concat(FQ,"-top")]:k8(r)&&t&&k8(t.y)&&r<t.y})}({translateX:n,translateY:r,coordinate:a})}}({allowEscapeViewBox:t,coordinate:a,offsetTopLeft:l,position:c,reverseDirection:u,tooltipBox:{height:p.height,width:p.width},useTranslate3d:d,viewBox:h}),b=v?{}:F2(F2({transition:s&&e?"transform ".concat(n,"ms ").concat(r):void 0},y),{},{pointerEvents:"none",visibility:!this.state.dismissed&&e&&o?"visible":"hidden",position:"absolute",top:0,left:0}),w=F2(F2({},b),{},{visibility:!this.state.dismissed&&e&&o?"visible":"hidden"},f);return FZ.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:x,style:w,ref:g},i)}}var F4=e.i(92809),F6=["x","y","top","left","width","height","className"];function F8(){return(F8=Object.assign.bind()).apply(null,arguments)}function F7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var F9=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=e,l=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F7(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F7(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({x:t,y:n,top:r,left:i,width:a,height:o},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,F6));return k8(t)&&k8(n)&&k8(a)&&k8(o)&&k8(r)&&k8(i)?em.createElement("path",F8({},IW(l),{className:(0,_l.clsx)("recharts-cross",s),d:"M".concat(t,",").concat(r,"v").concat(o,"M").concat(i,",").concat(n,"h").concat(a)})):null},Ve=["radius"],Vt=["radius"];function Vn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vn(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vi(){return(Vi=Object.assign.bind()).apply(null,arguments)}function Va(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Vo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Vs=(e,t,n,r,i)=>{var a,o=k2(n),s=k2(r),l=Math.min(Math.abs(o)/2,Math.abs(s)/2),c=s>=0?1:-1,u=o>=0?1:-1,d=+(s>=0&&o>=0||s<0&&o<0);if(l>0&&i instanceof Array){for(var h=[0,0,0,0],f=0;f<4;f++)h[f]=i[f]>l?l:i[f];a=k5(G||(G=Vo(["M",",",""])),e,t+c*h[0]),h[0]>0&&(a+=k5($||($=Vo(["A ",",",",0,0,",",",",",""])),h[0],h[0],d,e+u*h[0],t)),a+=k5(X||(X=Vo(["L ",",",""])),e+n-u*h[1],t),h[1]>0&&(a+=k5(q||(q=Vo(["A ",",",",0,0,",",\n ",",",""])),h[1],h[1],d,e+n,t+c*h[1])),a+=k5(K||(K=Vo(["L ",",",""])),e+n,t+r-c*h[2]),h[2]>0&&(a+=k5(Z||(Z=Vo(["A ",",",",0,0,",",\n ",",",""])),h[2],h[2],d,e+n-u*h[2],t+r)),a+=k5(Q||(Q=Vo(["L ",",",""])),e+u*h[3],t+r),h[3]>0&&(a+=k5(J||(J=Vo(["A ",",",",0,0,",",\n ",",",""])),h[3],h[3],d,e,t+r-c*h[3])),a+="Z"}else if(l>0&&i===+i&&i>0){var p=Math.min(l,i);a=k5(ee||(ee=Vo(["M ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",",","\n L ",",","\n A ",",",",0,0,",",",","," Z"])),e,t+c*p,p,p,d,e+u*p,t,e+n-u*p,t,p,p,d,e+n,t+c*p,e+n,t+r-c*p,p,p,d,e+n-u*p,t+r,e+u*p,t+r,p,p,d,e,t+r-c*p)}else a=k5(et||(et=Vo(["M ",","," h "," v "," h "," Z"])),e,t,n,r,-n);return a},Vl={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Vc=e=>{var t=Ry(e,Vl),n=(0,em.useRef)(null),[r,i]=(0,em.useState)(-1);(0,em.useEffect)(()=>{if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&i(e)}catch(e){}},[]);var{x:a,y:o,width:s,height:l,radius:c,className:u}=t,{animationEasing:d,animationDuration:h,animationBegin:f,isAnimationActive:p,isUpdateAnimationActive:g}=t,v=(0,em.useRef)(s),x=(0,em.useRef)(l),y=(0,em.useRef)(a),b=(0,em.useRef)(o),w=zC((0,em.useMemo)(()=>({x:a,y:o,width:s,height:l,radius:c}),[a,o,s,l,c]),"rectangle-");if(a!==+a||o!==+o||s!==+s||l!==+l||0===s||0===l)return null;var j=(0,_l.clsx)("recharts-rectangle",u);if(!g){var N=IW(t),{radius:k}=N,C=Va(N,Ve);return em.createElement("path",Vi({},C,{x:k2(a),y:k2(o),width:k2(s),height:k2(l),radius:"number"==typeof c?c:void 0,className:j,d:Vs(a,o,s,l,c)}))}var E=v.current,_=x.current,S=y.current,T=b.current,A="0px ".concat(-1===r?1:r,"px"),O="".concat(r,"px 0px"),M=zM(["strokeDasharray"],h,"string"==typeof d?d:Vl.animationEasing);return em.createElement(zK,{animationId:w,key:w,canBegin:r>0,duration:h,easing:d,isActive:g,begin:f},e=>{var r,i=Cr(E,s,e),u=Cr(_,l,e),d=Cr(S,a,e),h=Cr(T,o,e);n.current&&(v.current=i,x.current=u,y.current=d,b.current=h),r=p?e>0?{transition:M,strokeDasharray:O}:{strokeDasharray:A}:{strokeDasharray:O};var f=IW(t),{radius:g}=f,w=Va(f,Vt);return em.createElement("path",Vi({},w,{radius:"number"==typeof c?c:void 0,className:j,d:Vs(d,h,i,u,c),ref:n,style:Vr(Vr({},r),t.style)}))})};function Vu(e){var{cx:t,cy:n,radius:r,startAngle:i,endAngle:a}=e;return{points:[OQ(t,n,r,i),OQ(t,n,r,a)],cx:t,cy:n,radius:r,startAngle:i,endAngle:a}}function Vd(){return(Vd=Object.assign.bind()).apply(null,arguments)}function Vh(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Vf=e=>{var{cx:t,cy:n,radius:r,angle:i,sign:a,isExternal:o,cornerRadius:s,cornerIsExternal:l}=e,c=s*(o?1:-1)+r,u=Math.asin(s/c)/OZ,d=l?i:i+a*u,h=OQ(t,n,c,d);return{center:h,circleTangency:OQ(t,n,r,d),lineTangency:OQ(t,n,c*Math.cos(u*OZ),l?i-a*u:i),theta:u}},Vp=e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:a,endAngle:o}=e,s=k3(o-a)*Math.min(Math.abs(o-a),359.999),l=a+s,c=OQ(t,n,i,a),u=OQ(t,n,i,l),d=k5(en||(en=Vh(["M ",",","\n A ",",",",0,\n ",",",",\n ",",","\n "])),c.x,c.y,i,i,+(Math.abs(s)>180),+(a>l),u.x,u.y);if(r>0){var h=OQ(t,n,r,a),f=OQ(t,n,r,l);d+=k5(er||(er=Vh(["L ",",","\n A ",",",",0,\n ",",",",\n ",","," Z"])),f.x,f.y,r,r,+(Math.abs(s)>180),+(a<=l),h.x,h.y)}else d+=k5(ei||(ei=Vh(["L ",","," Z"])),t,n);return d},Vm={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Vg=e=>{var t,n=Ry(e,Vm),{cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:s,forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d,className:h}=n;if(o<a||u===d)return null;var f=(0,_l.clsx)("recharts-sector",h),p=o-a,g=Ct(s,p,0,!0);return t=g>0&&360>Math.abs(u-d)?(e=>{var{cx:t,cy:n,innerRadius:r,outerRadius:i,cornerRadius:a,forceCornerRadius:o,cornerIsExternal:s,startAngle:l,endAngle:c}=e,u=k3(c-l),{circleTangency:d,lineTangency:h,theta:f}=Vf({cx:t,cy:n,radius:i,angle:l,sign:u,cornerRadius:a,cornerIsExternal:s}),{circleTangency:p,lineTangency:g,theta:v}=Vf({cx:t,cy:n,radius:i,angle:c,sign:-u,cornerRadius:a,cornerIsExternal:s}),x=s?Math.abs(l-c):Math.abs(l-c)-f-v;if(x<0)return o?k5(ea||(ea=Vh(["M ",",","\n a",",",",0,0,1,",",0\n a",",",",0,0,1,",",0\n "])),h.x,h.y,a,a,2*a,a,a,-(2*a)):Vp({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var y=k5(eo||(eo=Vh(["M ",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","\n "])),h.x,h.y,a,a,+(u<0),d.x,d.y,i,i,+(x>180),+(u<0),p.x,p.y,a,a,+(u<0),g.x,g.y);if(r>0){var{circleTangency:b,lineTangency:w,theta:j}=Vf({cx:t,cy:n,radius:r,angle:l,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),{circleTangency:N,lineTangency:k,theta:C}=Vf({cx:t,cy:n,radius:r,angle:c,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),E=s?Math.abs(l-c):Math.abs(l-c)-j-C;if(E<0&&0===a)return"".concat(y,"L").concat(t,",").concat(n,"Z");y+=k5(es||(es=Vh(["L",",","\n A",",",",0,0,",",",",","\n A",",",",0,",",",",",",","\n A",",",",0,0,",",",",","Z"])),k.x,k.y,a,a,+(u<0),N.x,N.y,r,r,+(E>180),+(u>0),b.x,b.y,a,a,+(u<0),w.x,w.y)}else y+=k5(el||(el=Vh(["L",",","Z"])),t,n);return y})({cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(g,p/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:u,endAngle:d}):Vp({cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:u,endAngle:d}),em.createElement("path",Vd({},IW(n),{className:f,d:t}))};function Vv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vx(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vv(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vy(){return(Vy=Object.assign.bind()).apply(null,arguments)}function Vb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vw(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vb(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vj(e){var{cursor:t,cursorComp:n,cursorProps:r}=e;return(0,em.isValidElement)(t)?(0,em.cloneElement)(t,r):(0,em.createElement)(n,r)}function VN(e){var t,n,r,i,a,{coordinate:o,payload:s,index:l,offset:c,tooltipAxisBandSize:u,layout:d,cursor:h,tooltipEventType:f,chartName:p}=e;if(!h||!o||"ScatterChart"!==p&&"axis"!==f)return null;if("ScatterChart"===p)r=o,i=F9,a=OJ.cursorLine;else if("BarChart"===p)t=u/2,r={stroke:"none",fill:"#ccc",x:"horizontal"===d?o.x-t:c.left+.5,y:"horizontal"===d?c.top+.5:o.y-t,width:"horizontal"===d?u:c.width-1,height:"horizontal"===d?c.height-1:u},i=Vc,a=OJ.cursorRectangle;else if("radial"===d&&R0(o)){var{cx:g,cy:v,radius:x,startAngle:y,endAngle:b}=Vu(o);r={cx:g,cy:v,startAngle:y,endAngle:b,innerRadius:x,outerRadius:x},i=Vg,a=OJ.cursorLine}else r={points:function(e,t,n){if("horizontal"===e)return[{x:t.x,y:n.top},{x:t.x,y:n.top+n.height}];if("vertical"===e)return[{x:n.left,y:t.y},{x:n.left+n.width,y:t.y}];if(R0(t)){if("centric"===e){var{cx:r,cy:i,innerRadius:a,outerRadius:o,angle:s}=t,l=OQ(r,i,a,s),c=OQ(r,i,o,s);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return Vu(t)}}(d,o,c)},i=Be,a=OJ.cursorLine;var w="object"==typeof h&&"className"in h?h.className:void 0,j=Vw(Vw(Vw(Vw({stroke:"#ccc",pointerEvents:"none"},c),r),IH(h)),{},{payload:s,payloadIndex:l,className:(0,_l.clsx)("recharts-tooltip-cursor",w)});return em.createElement(BL,{zIndex:null!=(n=e.zIndex)?n:a},em.createElement(Vj,{cursor:h,cursorComp:i,cursorProps:j}))}function Vk(e){var t,n,r,i=(t=EM(M$),n=EM(DV),r=EM(DB),t&&r?E0(Vx(Vx({},t),{},{scale:r}),n):E0(void 0,n)),a=__(),o=EM(_S),s=EM(OY);return null==i||null==a||null==o||null==s?null:em.createElement(VN,Vy({},e,{offset:a,layout:o,tooltipAxisBandSize:i,chartName:s}))}function VC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VE(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?VC(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VC(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function V_(e){return e.dataKey}var VS=[],VT={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function VA(e){var t,n,r,i,a,o,s,l,c,u,d,h=Ry(e,VT),{active:f,allowEscapeViewBox:p,animationDuration:g,animationEasing:v,content:x,filterNull:y,isAnimationActive:b,offset:w,payloadUniqBy:j,position:N,reverseDirection:k,useTranslate3d:C,wrapperStyle:E,cursor:_,shared:S,trigger:T,defaultIndex:A,portal:O,axisId:M}=h,P=ES(),D="number"==typeof A?String(A):A;(0,em.useEffect)(()=>{P(Ei({shared:S,trigger:T,axisId:M,active:f,defaultIndex:D}))},[P,S,T,M,f,D]);var L=_C(),I=II(),R=EM(e=>P4(e,S)),{activeIndex:B,isActive:z}=null!=(u=EM(e=>La(e,R,T,D)))?u:{},F=EM(e=>Li(e,R,T,D)),V=EM(e=>Lr(e,R,T,D)),U=EM(e=>Ln(e,R,T,D)),H=(0,em.useContext)(Rt),W=null!=(d=null!=f?f:z)&&d,[Y,G]=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],[t,n]=(0,em.useState)({height:0,left:0,top:0,width:0}),r=(0,em.useCallback)(e=>{if(null!=e){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>1||Math.abs(i.left-t.left)>1||Math.abs(i.top-t.top)>1||Math.abs(i.width-t.width)>1)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}([F,W]),$="axis"===R?V:void 0;t=EM(e=>((e,t,n)=>{if(null!=t){var r=Di(e);return"axis"===t?"hover"===n?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:"hover"===n?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}})(e,R,T)),n=EM(OX),r=EM(OG),i=EM(O$),o=null==(a=EM(I8))?void 0:a.active,s=_C(),(0,em.useEffect)(()=>{if(!o&&null!=r&&null!=n){var e=Ed({active:W,coordinate:U,dataKey:t,index:B,label:"number"==typeof $?String($):$,sourceViewBox:s,graphicalItemId:void 0});I3.emit(I4,r,e,n)}},[o,U,t,B,$,n,r,i,W,s]);var X=null!=O?O:H;if(null==X||null==L||null==R)return null;var q=null!=F?F:VS;W||(q=VS),y&&q.length&&(l=q.filter(e=>null!=e.value&&(!0!==e.hide||h.includeHidden)),q=!0===j?(0,F4.default)(l,V_):"function"==typeof j?(0,F4.default)(l,j):l);var K=q.length>0,Z=em.createElement(F3,{allowEscapeViewBox:p,animationDuration:g,animationEasing:v,isAnimationActive:b,active:W,coordinate:U,hasPayload:K,offset:w,position:N,reverseDirection:k,useTranslate3d:C,viewBox:L,wrapperStyle:E,lastBoundingBox:Y,innerRef:G,hasPortalFromProps:!!O},(c=VE(VE({},h),{},{payload:q,label:$,active:W,activeIndex:B,coordinate:U,accessibilityLayer:I}),em.isValidElement(x)?em.cloneElement(x,c):"function"==typeof x?em.createElement(x,c):em.createElement(FK,c)));return em.createElement(em.Fragment,null,(0,e0.createPortal)(Z,X),W&&em.createElement(Vk,{cursor:_,tooltipEventType:R,coordinate:U,payload:q,index:B}))}var VO=["x1","y1","x2","y2","key"],VM=["offset"],VP=["xAxisId","yAxisId"],VD=["xAxisId","yAxisId"];function VL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VI(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?VL(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VR(){return(VR=Object.assign.bind()).apply(null,arguments)}function VB(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Vz=e=>{var{fill:t}=e;if(!t||"none"===t)return null;var{fillOpacity:n,x:r,y:i,width:a,height:o,ry:s}=e;return em.createElement("rect",{x:r,y:i,ry:s,width:a,height:o,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function VF(e){var{option:t,lineItemProps:n}=e;if(em.isValidElement(t))r=em.cloneElement(t,n);else if("function"==typeof t)r=t(n);else{var r,i,{x1:a,y1:o,x2:s,y2:l,key:c}=n,u=null!=(i=IU(VB(n,VO)))?i:{},{offset:d}=u,h=VB(u,VM);r=em.createElement("line",VR({},h,{x1:a,y1:o,x2:s,y2:l,fill:"none",key:c}))}return r}function VV(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=VB(e,VP),l=i.map((e,i)=>{var a=VI(VI({},s),{},{x1:t,y1:e,x2:t+n,y2:e,key:"line-".concat(i),index:i});return em.createElement(VF,{key:"line-".concat(i),option:r,lineItemProps:a})});return em.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function VU(e){var{y:t,height:n,vertical:r=!0,verticalPoints:i}=e;if(!r||!i||!i.length)return null;var{xAxisId:a,yAxisId:o}=e,s=VB(e,VD),l=i.map((e,i)=>{var a=VI(VI({},s),{},{x1:e,y1:t,x2:e,y2:t+n,key:"line-".concat(i),index:i});return em.createElement(VF,{option:r,lineItemProps:a,key:"line-".concat(i)})});return em.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function VH(e){var{horizontalFill:t,fillOpacity:n,x:r,y:i,width:a,height:o,horizontalPoints:s,horizontal:l=!0}=e;if(!l||!t||!t.length||null==s)return null;var c=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==c[0]&&c.unshift(0);var u=c.map((e,s)=>{var l=c[s+1]?c[s+1]-e:i+o-e;if(l<=0)return null;var u=s%t.length;return em.createElement("rect",{key:"react-".concat(s),y:e,x:r,height:l,width:a,stroke:"none",fill:t[u],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return em.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function VW(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:i,y:a,width:o,height:s,verticalPoints:l}=e;if(!t||!n||!n.length)return null;var c=l.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==c[0]&&c.unshift(0);var u=c.map((e,t)=>{var l=c[t+1]?c[t+1]-e:i+o-e;if(l<=0)return null;var u=t%n.length;return em.createElement("rect",{key:"react-".concat(t),x:e,y:a,width:l,height:s,stroke:"none",fill:n[u],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return em.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var VY=(e,t)=>{var{xAxis:n,width:r,height:i,offset:a}=e;return EX(Fp(VI(VI(VI({},Fy),n),{},{ticks:Eq(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},VG=(e,t)=>{var{yAxis:n,width:r,height:i,offset:a}=e;return EX(Fp(VI(VI(VI({},Fy),n),{},{ticks:Eq(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},V$={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:OJ.grid};function VX(e){var t=EM(E5),n=EM(E3),r=__(),i=VI(VI({},Ry(e,V$)),{},{x:k8(e.x)?e.x:r.left,y:k8(e.y)?e.y:r.top,width:k8(e.width)?e.width:r.width,height:k8(e.height)?e.height:r.height}),{xAxisId:a,yAxisId:o,x:s,y:l,width:c,height:u,syncWithTicks:d,horizontalValues:h,verticalValues:f}=i,p=_a(),g=EM(e=>PK(e,"xAxis",a,p)),v=EM(e=>PK(e,"yAxis",o,p));if(!EH(c)||!EH(u)||!k8(s)||!k8(l))return null;var x=i.verticalCoordinatesGenerator||VY,y=i.horizontalCoordinatesGenerator||VG,{horizontalPoints:b,verticalPoints:w}=i;if((!b||!b.length)&&"function"==typeof y){var j=h&&h.length,N=y({yAxis:v?VI(VI({},v),{},{ticks:j?h:v.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!j||d);_u(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(b=N)}if((!w||!w.length)&&"function"==typeof x){var k=f&&f.length,C=x({xAxis:g?VI(VI({},g),{},{ticks:k?f:g.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!k||d);_u(Array.isArray(C),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof C,"]")),Array.isArray(C)&&(w=C)}return em.createElement(BL,{zIndex:i.zIndex},em.createElement("g",{className:"recharts-cartesian-grid"},em.createElement(Vz,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),em.createElement(VH,VR({},i,{horizontalPoints:b})),em.createElement(VW,VR({},i,{verticalPoints:w})),em.createElement(VV,VR({},i,{offset:r,horizontalPoints:b,xAxis:g,yAxis:v})),em.createElement(VU,VR({},i,{offset:r,verticalPoints:w,xAxis:g,yAxis:v}))))}VX.displayName="CartesianGrid";let Vq=["1h","12h","1d","7d","30d","90d"],VK={created_at:{short:"Ingested",long:"When records were ingested"},mentioned_at:{short:"Mentioned",long:"When facts were mentioned (event time)"},occurred_start:{short:"Occurred",long:"When the underlying event started"}},VZ=["created_at","mentioned_at","occurred_start"],VQ="#8b5cf6",VJ="#ec4899",V0="#6366f1",V1="var(--chart-5)",V2="var(--muted-foreground)",V5={world:{label:"World",color:VQ},experience:{label:"Experience",color:VJ},observation:{label:"Observations",color:V0}};function V3(e){if(e<1e3)return e.toString();if(e<1e6){let t=e/1e3;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}k`}if(e<1e9){let t=e/1e6;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}M`}let t=e/1e9;return`${t>=10?t.toFixed(0):t.toFixed(1).replace(/\.0$/,"")}B`}function V4({value:e,className:t}){return(0,ep.jsx)("span",{className:t,title:e.toLocaleString(),children:V3(e)})}function V6({active:e,payload:t,label:n,valueLabel:r}){return e&&t&&0!==t.length?(0,ep.jsxs)("div",{className:"rounded-lg border border-border/60 bg-popover/95 backdrop-blur-sm px-3 py-2 shadow-md",children:[null!=n&&(0,ep.jsx)("div",{className:"text-[11px] font-medium text-foreground mb-1.5",children:n}),(0,ep.jsx)("div",{className:"space-y-1",children:t.map((e,t)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color||e.payload?.fill}}),(0,ep.jsx)("span",{className:"text-muted-foreground",children:e.name||r||"Value"}),(0,ep.jsx)("span",{className:"ml-auto pl-3 font-semibold tabular-nums text-foreground",children:(e.value??0).toLocaleString()})]},t))})]}):null}function V8({children:e}){return(0,ep.jsx)("h3",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em] mb-3",children:e})}function V7(e){if(!e)return"Never";let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let n=Math.floor(t/60);if(n<24)return`${n}h ago`;let r=Math.floor(n/24);return`${r}d ago`}function V9(e){return new Date(/[+Z-]$/.test(e)||/[+-]\d\d:?\d\d$/.test(e)?e:`${e}Z`)}function Ue({done:e,total:t,doneColor:n}){let r=Math.round(100*(t>0?e/t:0));return(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground",children:[(0,ep.jsx)("span",{className:"tabular-nums font-semibold text-foreground text-sm",children:e.toLocaleString()}),(0,ep.jsxs)("span",{className:"text-muted-foreground",children:[" / ",t.toLocaleString()]})]}),(0,ep.jsxs)("span",{className:"text-xs font-semibold tabular-nums text-foreground",children:[r,"%"]})]}),(0,ep.jsx)("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:(0,ep.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r}%`,backgroundColor:n}})})]})}function Ut({title:e,items:t,emptyLabel:n}){let r=t.reduce((e,t)=>e+t.value,0);return(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("h4",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-[0.08em]",children:e}),(0,ep.jsx)(V4,{value:r,className:"text-xs text-muted-foreground tabular-nums"})]}),0===r?(0,ep.jsx)("div",{className:"text-xs text-muted-foreground py-2",children:n}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:t.filter(e=>e.value>0).map(e=>(0,ep.jsx)("div",{className:"h-full",style:{width:`${e.value/r*100}%`,backgroundColor:e.color},title:`${e.name}: ${e.value.toLocaleString()}`},e.name))}),(0,ep.jsx)("div",{className:"grid grid-cols-3 gap-3 text-sm",children:t.map(e=>(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px]",style:{backgroundColor:e.color}}),(0,ep.jsx)("span",{className:"text-[11px] uppercase tracking-wider text-muted-foreground font-medium",children:e.name})]}),(0,ep.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,ep.jsx)(V4,{value:e.value,className:"text-base font-semibold tabular-nums"}),(0,ep.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:r>0?`${(e.value/r*100).toFixed(0)}%`:"0%"})]})]},e.name))})]})]})}function Un({icon:e,label:t,value:n}){return(0,ep.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,ep.jsx)("div",{className:"p-2 rounded-md bg-muted",children:(0,ep.jsx)(e,{className:"w-4 h-4 text-muted-foreground"})}),(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:t}),(0,ep.jsx)(V4,{value:n,className:"text-2xl font-semibold text-foreground leading-tight tabular-nums block"})]})]})}let Ur=["completed","processing","pending","failed","cancelled"],Ui={completed:"#10b981",processing:"#3b82f6",pending:"#f59e0b",failed:"#ef4444",cancelled:"#6b7280"},Ua={completed:"completed",processing:"processing",pending:"pending",failed:"failed",cancelled:"cancelled"};function Uo({byStatus:e}){let t=Ur.map(t=>({status:t,label:Ua[t],value:e[t]||0,color:Ui[t]}));for(let[n,r]of Object.entries(e))Ur.includes(n)||t.push({status:n,label:n,value:r,color:V2});let n=t.reduce((e,t)=>e+t.value,0),r=t.filter(e=>e.value>0);return(0,ep.jsxs)(m8.Card,{children:[(0,ep.jsxs)(m8.CardHeader,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,ep.jsxs)(m8.CardTitle,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,ep.jsx)(jY,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Operations"]}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,ep.jsx)(V4,{value:n})," total"]})]}),(0,ep.jsx)(m8.CardContent,{children:0===n?(0,ep.jsx)("div",{className:"h-[100px] flex items-center justify-center text-sm text-muted-foreground",children:"No operations yet"}):(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("div",{className:"h-1.5 flex w-full rounded-full overflow-hidden bg-muted",children:r.map(e=>(0,ep.jsx)("div",{className:"h-full",style:{width:`${e.value/n*100}%`,backgroundColor:e.color},title:`${e.label}: ${e.value.toLocaleString()}`},e.status))}),(0,ep.jsx)("div",{className:"space-y-1.5",children:r.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px] flex-shrink-0",style:{backgroundColor:e.color}}),(0,ep.jsx)("span",{className:"text-muted-foreground flex-1",children:e.label}),(0,ep.jsx)(V4,{value:e.value,className:"font-semibold tabular-nums text-foreground"}),(0,ep.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums w-9 text-right",children:[(e.value/n*100).toFixed(0),"%"]})]},e.status))})]})})]})}function Us({done:e,pending:t,failed:n,total:r,lastConsolidatedAt:i}){let[a,o]=(0,em.useState)(!1),s=n>0;return(0,ep.jsxs)(m8.Card,{children:[(0,ep.jsx)(m8.CardHeader,{className:"pb-2",children:(0,ep.jsx)(m8.CardTitle,{className:"text-sm font-semibold",children:"Consolidation"})}),(0,ep.jsxs)(m8.CardContent,{className:"space-y-4",children:[(0,ep.jsx)(Ue,{done:e,total:r,doneColor:V1}),(0,ep.jsxs)("div",{className:"grid grid-cols-4 gap-3 pt-1",children:[(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jG.default,{className:"w-3 h-3 text-emerald-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Done"})]}),(0,ep.jsx)(V4,{value:e,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jm,{className:"w-3 h-3 text-amber-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Pending"})]}),(0,ep.jsx)(V4,{value:t,className:"text-base font-semibold tabular-nums text-foreground block"})]}),(0,ep.jsxs)("button",{type:"button",onClick:()=>s&&o(!0),disabled:!s,className:`text-left space-y-0.5 rounded-md -mx-1 px-1 py-0.5 transition-colors ${s?"cursor-pointer hover:bg-red-500/10 focus:outline-none focus:ring-2 focus:ring-red-500/40":"cursor-default"}`,title:s?"View failed memories":void 0,children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(j$,{className:`w-3 h-3 ${s?"text-red-600 dark:text-red-400":"text-muted-foreground/50"}`}),(0,ep.jsx)("span",{className:`text-[10px] uppercase tracking-wider font-medium ${s?"text-red-600 dark:text-red-400":"text-muted-foreground"}`,children:"Failed"})]}),(0,ep.jsxs)("span",{className:`text-base font-semibold tabular-nums block ${s?"text-red-600 dark:text-red-400":"text-foreground"}`,children:[(0,ep.jsx)(V4,{value:n}),s&&(0,ep.jsx)(jX,{className:"inline w-3 h-3 ml-1 opacity-70"})]})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(eY,{className:"w-3 h-3 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Last"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold text-foreground block leading-tight",children:V7(i)})]})]})]}),(0,ep.jsx)(Ul,{open:a,onOpenChange:o})]})}function Ul({open:e,onOpenChange:t}){let{currentBank:n}=(0,ey.useBank)(),[r,i]=(0,em.useState)([]),[a,o]=(0,em.useState)(0),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)(!1),[d,h]=(0,em.useState)(0);(0,em.useEffect)(()=>{if(!e||!n)return;let t=!1;return l(!0),eP.client.listMemories(n,{consolidationState:"failed",limit:200}).then(e=>{t||(i(e.items),o(e.total))}).catch(()=>{}).finally(()=>{t||l(!1)}),()=>{t=!0}},[e,n,d]);let f=async()=>{if(n){u(!0);try{let e=await eP.client.recoverConsolidation(n);e.retried_count>0&&await eP.client.triggerConsolidation(n),ev.toast.success(`Queued ${e.retried_count} memor${1===e.retried_count?"y":"ies"} for re-consolidation`),h(e=>e+1)}catch{}finally{u(!1)}}};return(0,ep.jsx)(tW.Dialog,{open:e,onOpenChange:t,children:(0,ep.jsxs)(tW.DialogContent,{className:"max-w-4xl max-h-[80vh] flex flex-col",children:[(0,ep.jsxs)(tW.DialogHeader,{children:[(0,ep.jsxs)(tW.DialogTitle,{className:"flex items-center gap-2",children:[(0,ep.jsx)(j$,{className:"w-4 h-4 text-red-600 dark:text-red-400"}),"Failed consolidations"]}),(0,ep.jsx)(tW.DialogDescription,{children:"Source memories whose consolidation permanently failed. Recovery resets them so they are retried on the next consolidation run."})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between gap-2 py-2",children:[(0,ep.jsx)("span",{className:"text-sm text-muted-foreground",children:s?"Loading…":`${a} failed`}),(0,ep.jsxs)(eD.Button,{size:"sm",onClick:f,disabled:c||s||0===a,children:[(0,ep.jsx)(eH,{className:`w-3.5 h-3.5 mr-1.5 ${c?"animate-spin":""}`}),"Recover all"]})]}),(0,ep.jsx)("div",{className:"flex-1 min-h-0 overflow-auto border border-border rounded-md",children:(0,ep.jsxs)(eX,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"w-[140px]",children:"Failed at"}),(0,ep.jsx)(eQ,{className:"w-[100px]",children:"Type"}),(0,ep.jsx)(eQ,{children:"Text"})]})}),(0,ep.jsxs)(eK,{children:[0===r.length&&!s&&(0,ep.jsx)(eZ,{children:(0,ep.jsx)(eJ,{colSpan:3,className:"text-center text-muted-foreground py-8",children:"No failed consolidations."})}),r.map(e=>(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eJ,{className:"text-xs text-muted-foreground whitespace-nowrap",children:V7(e.consolidation_failed_at)}),(0,ep.jsx)(eJ,{className:"text-xs capitalize",children:e.fact_type}),(0,ep.jsxs)(eJ,{className:"text-sm",children:[(0,ep.jsx)("div",{className:"line-clamp-2",children:e.text}),e.context&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:e.context})]})]},e.id))]})]})})]})})}function Uc({models:e,lastConsolidatedAt:t}){let n=e.length,r=t?new Date(t).getTime():0,i=e.filter(e=>!r||!!e.last_refreshed_at&&new Date(e.last_refreshed_at).getTime()>=r).length,a=n-i;return(0,ep.jsxs)(m8.Card,{children:[(0,ep.jsx)(m8.CardHeader,{className:"pb-2",children:(0,ep.jsxs)(m8.CardTitle,{className:"text-sm font-semibold flex items-center gap-2",children:[(0,ep.jsx)(m9,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Mental Models"]})}),(0,ep.jsx)(m8.CardContent,{className:"space-y-4",children:0===n?(0,ep.jsx)("div",{className:"text-sm text-muted-foreground py-4",children:"No mental models"}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(Ue,{done:i,total:n,doneColor:V1}),(0,ep.jsxs)("div",{className:"grid grid-cols-3 gap-3 pt-1",children:[(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jG.default,{className:"w-3 h-3 text-emerald-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Up to date"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:i})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(jm,{className:"w-3 h-3 text-amber-500"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Stale"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:a})]}),(0,ep.jsxs)("div",{className:"space-y-0.5",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ep.jsx)(m9,{className:"w-3 h-3 text-muted-foreground"}),(0,ep.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-medium",children:"Total"})]}),(0,ep.jsx)("span",{className:"text-base font-semibold tabular-nums text-foreground block",children:n})]})]})]})})]})}let Uu={fontSize:11,fill:V2,fontWeight:500};function Ud(){let{currentBank:e}=(0,ey.useBank)(),{features:t}=(0,jr.useFeatures)(),n=t?.observations??!1,[r,i]=(0,em.useState)(null),[a,o]=(0,em.useState)([]),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)("7d"),[d,h]=(0,em.useState)("created_at"),[f,p]=(0,em.useState)({trunc:"day",buckets:[]}),[g,v]=(0,em.useState)({world:!0,experience:!0,observation:!0}),x=async()=>{if(e){l(!0);try{let[t,n]=await Promise.all([eP.client.getBankStats(e),eP.client.listMentalModels(e)]);i(t),o(n.items||[])}catch(e){console.error("Error loading bank stats:",e)}finally{l(!1)}}},y=async()=>{if(e)try{let t=await eP.client.getMemoriesTimeseries(e,c,d);p({trunc:t.trunc,buckets:t.buckets||[]})}catch(e){console.error("Error loading memories timeseries:",e)}};if((0,em.useEffect)(()=>{if(e){x();let e=setInterval(x,5e3);return()=>clearInterval(e)}},[e]),(0,em.useEffect)(()=>{if(e){y();let e=setInterval(y,5e3);return()=>clearInterval(e)}},[e,c,d]),s&&!r)return(0,ep.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,ep.jsx)(eY,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"})});if(!r)return null;let b=n?["world","experience","observation"]:["world","experience"],w=f.buckets.map(e=>{var t,n,r,i;let a,o;return{...e,label:(t=e.time,n=f.trunc,a=V9(t),"day"===n?a.toLocaleDateString(void 0,{month:"short",day:"numeric"}):a.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})),tooltipLabel:(r=e.time,i=f.trunc,o=V9(r),"day"===i?o.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):o.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}))}}),j=w.reduce((e,t)=>e+b.reduce((e,n)=>e+(g[n]&&t[n]||0),0),0),N=Math.max(0,r.total_nodes-r.pending_consolidation);return(0,ep.jsxs)("div",{className:"space-y-8",children:[(0,ep.jsxs)("section",{children:[(0,ep.jsx)(V8,{children:"Memory store"}),(0,ep.jsx)(m8.Card,{children:(0,ep.jsxs)(m8.CardContent,{className:"p-0",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 md:divide-x divide-y md:divide-y-0 divide-border/60",children:[(0,ep.jsx)(Un,{icon:ek,label:"Memories",value:r.total_nodes}),(0,ep.jsx)(Un,{icon:jW,label:"Documents",value:r.total_documents}),(0,ep.jsx)(Un,{icon:jH,label:"Links",value:r.total_links})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 md:divide-x divide-y md:divide-y-0 divide-border/60 border-t border-border/60",children:[(0,ep.jsx)("div",{className:"p-5",children:(0,ep.jsx)(Ut,{title:"Memory composition",items:[{name:"World",value:r.nodes_by_fact_type?.world||0,color:VQ},{name:"Experience",value:r.nodes_by_fact_type?.experience||0,color:VJ},...n?[{name:"Observations",value:r.total_observations||0,color:V0}]:[]],emptyLabel:"No memories yet"})}),(0,ep.jsx)("div",{className:"p-5",children:(0,ep.jsx)(Ut,{title:"Link types",items:[{name:"Temporal",value:r.links_by_link_type?.temporal||0,color:"#009296"},{name:"Semantic",value:r.links_by_link_type?.semantic||0,color:"#0074d9"},{name:"Entity",value:r.links_by_link_type?.entity||0,color:"#f59e0b"}],emptyLabel:"No links yet"})})]})]})})]}),(0,ep.jsxs)("section",{children:[(0,ep.jsx)(V8,{children:"Consolidation"}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,ep.jsx)(Us,{done:N,pending:r.pending_consolidation,failed:r.failed_consolidation??0,total:r.total_nodes,lastConsolidatedAt:r.last_consolidated_at}),(0,ep.jsx)(Uc,{models:a,lastConsolidatedAt:r.last_consolidated_at})]})]}),(0,ep.jsxs)("section",{children:[(0,ep.jsx)(V8,{children:"Activity"}),(0,ep.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,ep.jsxs)(m8.Card,{className:"lg:col-span-2",children:[(0,ep.jsxs)(m8.CardHeader,{className:"pb-2 space-y-2",children:[(0,ep.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,ep.jsxs)(m8.CardTitle,{className:"text-sm font-semibold",children:["Memories by ",VK[d].short.toLowerCase()," time"]}),(0,ep.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5",children:Vq.map(e=>(0,ep.jsx)("button",{onClick:()=>u(e),className:`px-2 py-0.5 text-[11px] font-medium rounded transition-colors tabular-nums ${c===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e},e))})]}),(0,ep.jsx)("div",{className:"flex items-center gap-0.5 rounded-md bg-muted/60 p-0.5 w-fit",children:VZ.map(e=>(0,ep.jsx)("button",{onClick:()=>h(e),title:VK[e].long,className:`px-2 py-0.5 text-[11px] font-medium rounded transition-colors ${d===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:VK[e].short},e))}),(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)("div",{className:"flex items-center gap-1.5",children:b.map(e=>{let t=V5[e],n=g[e];return(0,ep.jsxs)("button",{onClick:()=>v(t=>({...t,[e]:!t[e]})),className:`flex items-center gap-1.5 px-2 py-0.5 rounded-md text-[11px] font-medium transition-all ${n?"bg-muted text-foreground":"bg-transparent text-muted-foreground/60 hover:text-muted-foreground"}`,children:[(0,ep.jsx)("span",{className:"w-2 h-2 rounded-[2px] transition-opacity",style:{backgroundColor:t.color,opacity:n?1:.3}}),t.label]},e)})}),(0,ep.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(0,ep.jsx)(V4,{value:j})," total"]})]})]}),(0,ep.jsx)(m8.CardContent,{children:0===w.length||0===j?(0,ep.jsx)("div",{className:"h-[180px] flex items-center justify-center text-sm text-muted-foreground",children:"No memories ingested in this period"}):(0,ep.jsx)("div",{className:"h-[180px]",children:(0,ep.jsx)(_N,{width:"100%",height:"100%",children:(0,ep.jsxs)(Rk,{data:w,margin:{top:8,right:8,bottom:0,left:-10},children:[(0,ep.jsx)("defs",{children:b.map(e=>(0,ep.jsxs)("linearGradient",{id:`grad-${e}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ep.jsx)("stop",{offset:"0%",stopColor:V5[e].color,stopOpacity:.35}),(0,ep.jsx)("stop",{offset:"100%",stopColor:V5[e].color,stopOpacity:0})]},e))}),(0,ep.jsx)(VX,{vertical:!1,stroke:"var(--border)",strokeOpacity:.5,strokeDasharray:"2 4"}),(0,ep.jsx)(FR,{dataKey:"label",tick:Uu,axisLine:!1,tickLine:!1,dy:4,minTickGap:20}),(0,ep.jsx)(FY,{tick:Uu,axisLine:!1,tickLine:!1,width:40,allowDecimals:!1,tickFormatter:e=>V3(e)}),(0,ep.jsx)(VA,{content:(0,ep.jsx)(V6,{}),labelFormatter:(e,t)=>t?.[0]?.payload?.tooltipLabel||"",cursor:{stroke:V2,strokeWidth:1,strokeDasharray:"3 3"}}),b.map(e=>g[e]?(0,ep.jsx)(Fs,{type:"monotone",dataKey:e,name:V5[e].label,stackId:"a",stroke:V5[e].color,strokeWidth:2,fill:`url(#grad-${e})`,isAnimationActive:!1},e):null)]})})})})]}),(0,ep.jsx)(Uo,{byStatus:r.operations_by_status||{}})]})]})]})}var tU=tU;let Uh=(0,ej.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Uf=(0,ej.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]),Up=(0,ej.default)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),Um=[{value:"all",label:"All types"},{value:"retain",label:"Retain"},{value:"consolidation",label:"Consolidation"},{value:"refresh_mental_model",label:"Mental Model Refresh"},{value:"file_convert_retain",label:"File Convert & Retain"},{value:"webhook_delivery",label:"Webhook Delivery"}];function Ug(){let e,t,n,{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)([]),[o,s]=(0,em.useState)(0),[l,c]=(0,em.useState)(null),[u,d]=(0,em.useState)(null),[h]=(0,em.useState)(10),[f,p]=(0,em.useState)(0),[g,v]=(0,em.useState)(null),[x,y]=(0,em.useState)(null),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(null),[k,C]=(0,em.useState)(!1),[E,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(null),M=(0,em.useCallback)(async(e=l,t=f,n=u)=>{if(r){w(!0);try{let i=await eP.client.listOperations(r,{status:e||void 0,type:n||void 0,limit:h,offset:t,excludeParents:!0});a(i.operations||[]),s(i.total||0)}catch(e){console.error("Error loading operations:",e)}finally{w(!1)}}},[r,l,f,u,h]),P=e=>{p(e),M(l,e,u)},D=async e=>{if(r){v(e);try{await eP.client.cancelOperation(r,e),await M()}catch(e){}finally{v(null)}}},L=async e=>{if(r){y(e);try{await eP.client.retryOperation(r,e),await M()}catch(e){}finally{y(null)}}},I=async e=>{if(r){_(!0),C(!0),O(null);try{let t=await eP.client.getOperationStatus(r,e);N(t)}catch(e){console.error("Error loading operation details:",e),N({error:"Failed to load operation details"})}finally{_(!1)}}},R=async()=>{if(r&&j?.operation_id){T(!0);try{let e=j.operation_id,t=await eP.client.getOperationStatus(r,e,{includePayload:!0});N(t),O(e)}catch(e){console.error("Error loading raw payload:",e)}finally{T(!1)}}};return((0,em.useEffect)(()=>{if(r){M(l,f,u);let e=setInterval(()=>M(l,f,u),5e3);return()=>clearInterval(e)}},[r,l,f,u]),r)?(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-lg font-semibold",children:"Background Operations"}),(0,ep.jsx)("button",{onClick:()=>M(),className:"p-1 rounded hover:bg-muted transition-colors",title:"Refresh operations",disabled:b,children:(0,ep.jsx)(eH,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${b?"animate-spin":""}`})})]}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:[o," operation",1!==o?"s":"",l?` (${l})`:""]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsxs)(tI.Select,{value:u??"all",onValueChange:e=>{var t;d(t="all"===e?null:e),p(0),M(l,0,t)},children:[(0,ep.jsx)(tI.SelectTrigger,{className:"h-9 w-[180px] text-sm",children:(0,ep.jsx)(tI.SelectValue,{placeholder:"All types"})}),(0,ep.jsx)(tI.SelectContent,{children:Um.map(e=>(0,ep.jsx)(tI.SelectItem,{value:e.value,children:(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{children:e.label}),"all"!==e.value&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground font-mono",children:e.value})]})},e.value))})]}),(0,ep.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:[{value:null,label:"All"},{value:"pending",label:"Pending"},{value:"processing",label:"Processing"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"},{value:"cancelled",label:"Cancelled"}].map(e=>(0,ep.jsx)("button",{onClick:()=>{var t;c(t=e.value),p(0),M(t,0,u)},className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${l===e.value?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:e.label},e.value??"all"))})]})]}),(0,ep.jsx)("div",{children:i.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eX,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eQ,{children:"Type"}),(0,ep.jsx)(eQ,{children:"Created"}),(0,ep.jsx)(eQ,{children:"Status"}),(0,ep.jsx)(eQ,{className:"w-[80px]"})]})}),(0,ep.jsx)(eK,{children:i.map(e=>(0,ep.jsxs)(eZ,{className:`cursor-pointer hover:bg-muted/50 ${"failed"===e.status?"bg-red-500/5":""}`,onClick:()=>I(e.id),children:[(0,ep.jsx)(eJ,{className:"font-mono text-xs text-muted-foreground",children:e.id.substring(0,8)}),(0,ep.jsx)(eJ,{className:"font-medium",children:e.task_type}),(0,ep.jsx)(eJ,{className:"text-sm text-muted-foreground",children:new Date(e.created_at).toLocaleString()}),(0,ep.jsxs)(eJ,{children:["pending"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"pending"]}),"processing"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:[(0,ep.jsx)(tU.default,{className:"w-3 h-3 animate-spin"}),"processing"]}),"failed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",title:e.error_message??void 0,children:[(0,ep.jsx)(jm,{className:"w-3 h-3"}),"failed"]}),"completed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"completed"]}),"cancelled"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400 border border-gray-500/20",children:[(0,ep.jsx)(Up,{className:"w-3 h-3"}),"cancelled"]})]}),(0,ep.jsxs)(eJ,{children:["pending"===e.status&&(0,ep.jsxs)(eD.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:t=>{t.stopPropagation(),D(e.id)},disabled:g===e.id,children:[g===e.id?(0,ep.jsx)(tU.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(tV.X,{className:"w-3 h-3 mr-1"}),g===e.id?"":"Cancel"]}),("failed"===e.status||"cancelled"===e.status)&&(0,ep.jsxs)(eD.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-blue-600 dark:hover:text-blue-400",onClick:t=>{t.stopPropagation(),L(e.id)},disabled:x===e.id,children:[x===e.id?(0,ep.jsx)(tU.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(Uh,{className:"w-3 h-3 mr-1"}),x===e.id?"":"Retry"]})]})]},e.id))})]})}),o>h&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Showing ",f+1,"-",Math.min(f+h,o)," of"," ",o]}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>P(Math.max(0,f-h)),disabled:0===f,children:"Previous"}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>P(f+h),disabled:f+h>=o,children:"Next"})]})]})]}):(0,ep.jsxs)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:["No ",l?`${l} `:"","operations"]})}),(0,ep.jsx)(tW.Dialog,{open:k,onOpenChange:C,children:(0,ep.jsxs)(tW.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tW.DialogHeader,{children:[(0,ep.jsx)(tW.DialogTitle,{children:"Operation Details"}),(0,ep.jsx)(tW.DialogDescription,{children:j?.operation_id&&(0,ep.jsx)("span",{className:"font-mono text-xs",children:j.operation_id})})]}),E?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)(tU.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):j?(0,ep.jsx)("div",{className:"space-y-4",children:j.error?(0,ep.jsx)("div",{className:"text-red-600 dark:text-red-400",children:j.error}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Status"}),(0,ep.jsxs)("div",{className:"mt-1",children:["pending"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"pending"]}),"processing"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:[(0,ep.jsx)(tU.default,{className:"w-3 h-3 animate-spin"}),"processing"]}),"failed"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,ep.jsx)(jm,{className:"w-3 h-3"}),"failed"]}),"completed"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"completed"]}),"cancelled"===j.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400 border border-gray-500/20",children:[(0,ep.jsx)(Up,{className:"w-3 h-3"}),"cancelled"]})]})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Type"}),(0,ep.jsx)("div",{className:"mt-1 font-mono text-sm",children:j.operation_type})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Created"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.created_at?new Date(j.created_at).toLocaleString():"N/A"})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Updated"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.updated_at?new Date(j.updated_at).toLocaleString():"N/A"})]}),j.completed_at&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Completed"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:new Date(j.completed_at).toLocaleString()})]}),j.result_metadata?.items_count!==void 0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Total Items"}),(0,ep.jsx)("div",{className:"mt-1 text-sm",children:j.result_metadata.items_count})]})]}),("pending"===j.status||"failed"===j.status||"cancelled"===j.status)&&(0,ep.jsxs)("div",{className:"flex gap-2",children:["pending"===j.status&&(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>D(j.operation_id),disabled:g===j.operation_id,children:[g===j.operation_id?(0,ep.jsx)(tU.default,{className:"w-3 h-3 animate-spin mr-1"}):(0,ep.jsx)(tV.X,{className:"w-3 h-3 mr-1"}),"Cancel"]}),("failed"===j.status||"cancelled"===j.status)&&(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>L(j.operation_id),disabled:x===j.operation_id,children:[x===j.operation_id?(0,ep.jsx)(tU.default,{className:"w-3 h-3 animate-spin mr-1"}):(0,ep.jsx)(Uh,{className:"w-3 h-3 mr-1"}),"Retry"]})]}),j.result_metadata&&Object.keys(j.result_metadata).length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:"Metadata"}),(0,ep.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(j.result_metadata,null,2)})]}),j.error_message&&(0,ep.jsxs)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/5 p-3",children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-red-600 dark:text-red-400 mb-1",children:"Error"}),(0,ep.jsx)("div",{className:"text-sm text-red-600/80 dark:text-red-400/80 font-mono",children:j.error_message})]}),j.child_operations&&j.child_operations.length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"text-sm font-medium text-muted-foreground mb-2",children:["Sub-batches (",j.result_metadata?.num_sub_batches||j.child_operations.length,")"]}),(0,ep.jsxs)(eX,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"w-[60px]",children:"Index"}),(0,ep.jsx)(eQ,{className:"w-[100px]",children:"ID"}),(0,ep.jsx)(eQ,{className:"w-[80px]",children:"Items"}),(0,ep.jsx)(eQ,{children:"Status"})]})}),(0,ep.jsx)(eK,{children:j.child_operations.map(e=>(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eJ,{className:"text-sm",children:e.sub_batch_index}),(0,ep.jsx)(eJ,{className:"font-mono text-xs text-muted-foreground",children:e.operation_id.substring(0,8)}),(0,ep.jsx)(eJ,{className:"text-sm",children:e.items_count}),(0,ep.jsxs)(eJ,{children:["pending"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"pending"]}),"processing"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400",children:[(0,ep.jsx)(tU.default,{className:"w-3 h-3 animate-spin"}),"processing"]}),"failed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400",title:e.error_message??void 0,children:[(0,ep.jsx)(jm,{className:"w-3 h-3"}),"failed"]}),"completed"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"completed"]}),"cancelled"===e.status&&(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-gray-500/10 text-gray-600 dark:text-gray-400",children:[(0,ep.jsx)(Up,{className:"w-3 h-3"}),"cancelled"]})]})]},e.operation_id))})]})]}),(e=A===j.operation_id,t=!!j.task_payload,n=!!j.result_metadata?.is_parent,(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,ep.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Raw payload"}),!e&&(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:R,disabled:S,children:[S?(0,ep.jsx)(tU.default,{className:"w-3 h-3 mr-1 animate-spin"}):(0,ep.jsx)(Uf,{className:"w-3 h-3 mr-1"}),"Load raw"]})]}),t?(0,ep.jsx)("pre",{className:"rounded-lg border bg-muted/30 p-3 text-xs font-mono overflow-x-auto max-h-96 whitespace-pre-wrap break-words",children:JSON.stringify(j.task_payload,null,2)}):e?(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:n?"This is a parent operation — the raw payload is stored on each sub-batch. Open a child operation to inspect its payload.":"No raw payload stored for this operation."}):(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Shows the full parameters the operation was submitted with (may be large)."})]}))]})}):null]})})]}):null}var tU=tU;let Uv=(0,ej.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);function Ux(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)("files"),[s,l]=(0,em.useState)(""),[c,u]=(0,em.useState)(1),[d,h]=(0,em.useState)(!1),[f,p]=(0,em.useState)(null),[g,v]=(0,em.useState)(null),[x,y]=(0,em.useState)([]),[b,w]=(0,em.useState)("any"),[j,N]=(0,em.useState)(!1),[k,C]=(0,em.useState)(null),[E,_]=(0,em.useState)(null),[S,T]=(0,em.useState)(!1),A=t.filter(e=>{if(!s)return!0;let t=s.toLowerCase();return e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.source_query.toLowerCase().includes(t)||e.content.toLowerCase().includes(t)}),O=async()=>{if(e){i(!0);try{let t=await eP.client.listMentalModels(e,x.length>0?x:void 0,x.length>0?b:void 0);n(t.items||[])}catch(e){console.error("Error loading mental models:",e)}finally{i(!1)}}},[M,P]=(0,em.useState)(new Set),D=async t=>{if(!e)return;let r=t.last_refreshed_at;P(e=>new Set(e).add(t.id));try{await eP.client.refreshMentalModel(e,t.id);for(let i=0;i<120;i++){await new Promise(e=>setTimeout(e,1e3));let i=await eP.client.getMentalModel(e,t.id);if(i.last_refreshed_at!==r){n(e=>e.map(e=>e.id===t.id?i:e)),f?.id===t.id&&p(i),ev.toast.success("Mental model refreshed");return}}ev.toast.error("Refresh timeout")}catch{}finally{P(e=>{let n=new Set(e);return n.delete(t.id),n})}},L=async()=>{if(e&&E){T(!0);try{await eP.client.deleteMentalModel(e,E.id),n(e=>e.filter(e=>e.id!==E.id)),f?.id===E.id&&p(null),_(null)}catch(e){}finally{T(!1)}}};if((0,em.useEffect)(()=>{e&&O()},[e,x,b]),(0,em.useEffect)(()=>{let e=e=>{"Escape"===e.key&&p(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,em.useEffect)(()=>{u(1)},[s,x,b]),!e)return(0,ep.jsx)(m8.Card,{children:(0,ep.jsx)(m8.CardContent,{className:"p-10 text-center",children:(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to view mental models."})})});let I=Math.ceil(A.length/100),R=(c-1)*100,B=R+100,z=A.slice(R,B);return(0,ep.jsxs)("div",{children:[r?(0,ep.jsxs)("div",{className:"text-center py-12",children:[(0,ep.jsx)(eH,{className:"w-8 h-8 mx-auto mb-3 text-muted-foreground animate-spin"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Loading..."})]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)("div",{className:"mb-4 flex items-center gap-3 flex-wrap",children:[(0,ep.jsx)(eL.Input,{type:"text",value:s,onChange:e=>l(e.target.value),placeholder:"Filter mental models by name, query, or content...",className:"w-80 h-9"}),(0,ep.jsx)(fI,{value:x,onChange:y,fetchSuggestions:async t=>{if(!e)return[];let n=t?`${t}*`:void 0;return(await eP.client.listTags(e,n,20,"mental_models")).items.map(e=>e.tag)},matchMode:b,onMatchModeChange:w,className:"flex-1 min-w-[260px]"}),(0,ep.jsxs)(eD.Button,{onClick:()=>h(!0),size:"sm",children:[(0,ep.jsx)(fB.Plus,{className:"w-4 h-4 mr-2"}),"Add Mental Model"]})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,ep.jsx)("div",{className:"text-sm text-muted-foreground",children:s||x.length>0?`${A.length} of ${t.length} mental models`:`${t.length} mental model${1!==t.length?"s":""}`}),(0,ep.jsx)("div",{className:"flex items-center gap-3",children:(0,ep.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,ep.jsxs)("button",{onClick:()=>o("files"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"files"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(jW,{className:"w-4 h-4"}),"List"]}),(0,ep.jsxs)("button",{onClick:()=>o("dashboard"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-all flex items-center gap-1.5 ${"dashboard"===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,ep.jsx)(Uv,{className:"w-4 h-4"}),"Dashboard"]})]})})]}),A.length>0?(0,ep.jsxs)(ep.Fragment,{children:["dashboard"===a&&(0,ep.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:z.map(e=>(0,ep.jsx)(m8.Card,{className:`cursor-pointer transition-all hover:shadow-md hover:border-primary/50 ${f?.id===e.id?"border-primary shadow-md":""}`,onClick:()=>p(e),children:(0,ep.jsxs)(m8.CardContent,{className:"p-4",children:[(0,ep.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,ep.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,ep.jsx)("h3",{className:"font-semibold text-foreground mb-1 truncate",children:e.name}),(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("code",{className:"text-xs font-mono text-muted-foreground truncate",children:e.id}),(0,ep.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium flex-shrink-0 ${e.trigger?.refresh_after_consolidation?"bg-green-500/10 text-green-600 dark:text-green-400":"bg-slate-500/10 text-slate-600 dark:text-slate-400"}`,children:e.trigger?.refresh_after_consolidation?"Auto Refresh":"Manual"})]})]}),(0,ep.jsx)(Uy,{m:e,refreshing:M.has(e.id),onEdit:e=>{C(e),N(!0)},onRefresh:D,onDelete:e=>_({id:e.id,name:e.name}),triggerClassName:"h-7 w-7 ml-2 flex-shrink-0"})]}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:e.source_query}),(0,ep.jsxs)("div",{className:"relative mb-3 border-t border-border pt-3 max-h-40 overflow-hidden",children:[(0,ep.jsx)(wW,{children:e.content}),(0,ep.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-card to-transparent"})]}),(0,ep.jsxs)("div",{className:"flex items-center justify-between text-xs border-t border-border pt-3",children:[(0,ep.jsx)("div",{className:"flex items-center gap-2",children:e.tags.length>0&&(0,ep.jsxs)("div",{className:"flex gap-1",children:[e.tags.slice(0,2).map(e=>(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e},e)),e.tags.length>2&&(0,ep.jsxs)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-muted text-muted-foreground",children:["+",e.tags.length-2]})]})}),(0,ep.jsx)("div",{className:"text-muted-foreground",title:wX(e.last_refreshed_at),children:w$(e.last_refreshed_at)})]})]})},e.id))}),"files"===a&&(0,ep.jsx)(Uj,{mentalModels:A,selectedId:g,onSelect:v,onOpenDetail:p,refreshingIds:M,onEdit:e=>{C(e),N(!0)},onRefresh:D,onDelete:e=>_({id:e.id,name:e.name})}),"files"!==a&&I>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,ep.jsxs)("div",{className:"text-xs text-muted-foreground",children:[R+1,"-",Math.min(B,A.length)," of"," ",A.length]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>u(1),disabled:1===c,className:"h-7 w-7 p-0",children:(0,ep.jsx)(ez,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>u(e=>Math.max(1,e-1)),disabled:1===c,className:"h-7 w-7 p-0",children:(0,ep.jsx)(e_,{className:"h-3 w-3"})}),(0,ep.jsxs)("span",{className:"text-xs px-2",children:[c," / ",I]}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>u(e=>Math.min(I,e+1)),disabled:c===I,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eS.ChevronRight,{className:"h-3 w-3"})}),(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>u(I),disabled:c===I,className:"h-7 w-7 p-0",children:(0,ep.jsx)(eF,{className:"h-3 w-3"})})]})]})]}):(0,ep.jsxs)("div",{className:"p-6 border border-dashed border-border rounded-lg text-center",children:[(0,ep.jsx)(eN,{className:"w-6 h-6 mx-auto mb-2 text-muted-foreground"}),(0,ep.jsx)("p",{className:"text-sm text-muted-foreground",children:s?"No mental models match your filter":"No mental models yet. Create a mental model to generate and save a summary from your memories."})]})]}),(0,ep.jsx)(Ub,{open:d,onClose:()=>h(!1),onCreated:()=>{h(!1),O()}}),(0,ep.jsx)(mg,{open:!!E,onOpenChange:e=>!e&&_(null),children:(0,ep.jsxs)(mP,{children:[(0,ep.jsxs)(mD,{children:[(0,ep.jsx)(mI,{children:"Delete Mental Model"}),(0,ep.jsxs)(mR,{children:["Are you sure you want to delete"," ",(0,ep.jsxs)("span",{className:"font-semibold",children:['"',E?.name,'"']}),"?",(0,ep.jsx)("br",{}),(0,ep.jsx)("br",{}),(0,ep.jsx)("span",{className:"text-destructive font-semibold",children:"This action cannot be undone."})]})]}),(0,ep.jsxs)(mL,{className:"flex-row justify-end space-x-2",children:[(0,ep.jsx)(mz,{className:"mt-0",children:"Cancel"}),(0,ep.jsxs)(mB,{onClick:L,disabled:S,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[S?(0,ep.jsx)(tU.default,{className:"w-4 h-4 animate-spin mr-1"}):null,"Delete"]})]})]})}),(0,ep.jsx)(w3,{mentalModelId:f?.id??null,onClose:()=>p(null),onDelete:e=>_({id:e.id,name:e.name}),onEdit:e=>{C(e),N(!0)},onRefreshed:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e)}}),k&&(0,ep.jsx)(Uw,{open:j,mentalModel:k,onClose:()=>{N(!1),C(null)},onUpdated:e=>{n(t=>t.map(t=>t.id===e.id?e:t)),p(e),N(!1),C(null)}})]})}function Uy({m:e,refreshing:t,onEdit:n,onRefresh:r,onDelete:i,triggerClassName:a}){return(0,ep.jsxs)(p2,{children:[(0,ep.jsx)(p3,{asChild:!0,children:(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",className:`p-0 text-muted-foreground ${a??"h-8 w-8"}`,onClick:e=>e.stopPropagation(),"aria-label":"Actions",children:(0,ep.jsx)(mU,{className:"h-4 w-4"})})}),(0,ep.jsxs)(ms,{align:"end",onClick:e=>e.stopPropagation(),children:[(0,ep.jsxs)(ml,{onClick:()=>n(e),children:[(0,ep.jsx)(mV,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,ep.jsxs)(ml,{onClick:()=>r(e),disabled:t,children:[(0,ep.jsx)(eH,{className:`h-4 w-4 mr-2 ${t?"animate-spin":""}`}),"Refresh Manually"]}),(0,ep.jsx)(mc,{}),(0,ep.jsxs)(ml,{onClick:()=>i(e),className:"text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400 focus:bg-red-500/10",children:[(0,ep.jsx)(mF,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})}function Ub({open:e,onClose:t,onCreated:n}){let{currentBank:r}=(0,ey.useBank)(),[i,a]=(0,em.useState)(!1),[o,s]=(0,em.useState)({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),l=async()=>{if(r&&o.name.trim()&&o.sourceQuery.trim()){a(!0);try{let e,t=o.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),i=parseInt(o.maxTokens)||2048,a=o.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(o.tagGroups.trim())try{e=JSON.parse(o.tagGroups.trim())}catch{ev.toast.error("Invalid JSON in Tag Groups field");return}let l=o.recallMaxTokens.trim()?parseInt(o.recallMaxTokens,10):void 0,c=o.recallChunksMaxTokens.trim()?parseInt(o.recallChunksMaxTokens,10):void 0,u="true"===o.includeChunks||"false"!==o.includeChunks&&void 0;await eP.client.createMentalModel(r,{id:o.id.trim()||void 0,name:o.name.trim(),source_query:o.sourceQuery.trim(),tags:t.length>0?t:void 0,max_tokens:i,trigger:{mode:o.mode,refresh_after_consolidation:o.autoRefresh,fact_types:o.factTypes.length>0?o.factTypes:void 0,exclude_mental_models:o.excludeMentalModels||void 0,exclude_mental_model_ids:a.length>0?a:void 0,tags_match:o.tagsMatch||void 0,tag_groups:e,include_chunks:u,recall_max_tokens:l,recall_chunks_max_tokens:c}}),s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),n()}catch(e){}finally{a(!1)}}};return(0,ep.jsx)(tW.Dialog,{open:e,onOpenChange:e=>{e||(s({id:"",name:"",sourceQuery:"",maxTokens:"2048",tags:"",autoRefresh:!1,mode:"full",factTypes:[],excludeMentalModels:!1,excludeMentalModelIds:"",tagsMatch:"",tagGroups:"",includeChunks:"",recallMaxTokens:"",recallChunksMaxTokens:""}),t())},children:(0,ep.jsxs)(tW.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,ep.jsxs)(tW.DialogHeader,{children:[(0,ep.jsx)(tW.DialogTitle,{children:"Create Mental Model"}),(0,ep.jsx)(tW.DialogDescription,{children:"Create a mental model by running a query. The content will be auto-generated and can be refreshed later."})]}),(0,ep.jsxs)(tG.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,ep.jsxs)(tG.TabsList,{className:"w-full",children:[(0,ep.jsx)(tG.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(tG.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 pr-1",children:[(0,ep.jsxs)(tG.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"ID"}),(0,ep.jsx)(eL.Input,{value:o.id,onChange:e=>s({...o,id:e.target.value}),placeholder:"e.g., team-communication"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eL.Input,{value:o.name,onChange:e=>s({...o,name:e.target.value}),placeholder:"e.g., Team Communication Preferences"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Source Query *"}),(0,ep.jsx)(eL.Input,{value:o.sourceQuery,onChange:e=>s({...o,sourceQuery:e.target.value}),placeholder:"e.g., How does the team prefer to communicate?"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Max Tokens"}),(0,ep.jsx)(eL.Input,{type:"number",value:o.maxTokens,onChange:e=>s({...o,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(tG.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Refresh"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(m1.Checkbox,{id:"auto-refresh",checked:o.autoRefresh,onCheckedChange:e=>s({...o,autoRefresh:!0===e})}),(0,ep.jsx)("label",{htmlFor:"auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:"Auto-refresh after consolidation"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Refresh mode"}),(0,ep.jsxs)(tI.Select,{value:o.mode,onValueChange:e=>s({...o,mode:e}),children:[(0,ep.jsx)(tI.SelectTrigger,{children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"full",children:"Full — regenerate from scratch each refresh"}),(0,ep.jsx)(tI.SelectItem,{value:"delta",children:"Delta — surgical edits, preserve unchanged content"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Delta mode applies minimal changes to the existing content. Falls back to a full rewrite on the first refresh and whenever the source query changes."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Other Mental Models"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(m1.Checkbox,{id:"exclude-mental-models",checked:o.excludeMentalModels,onCheckedChange:e=>s({...o,excludeMentalModels:!0===e})}),(0,ep.jsx)("label",{htmlFor:"exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:"Exclude all mental models"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Exclude Mental Model IDs"}),(0,ep.jsx)(eL.Input,{value:o.excludeMentalModelIds,onChange:e=>s({...o,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Tags"}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags"}),(0,ep.jsx)(eL.Input,{value:o.tags,onChange:e=>s({...o,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"}),(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Tags scope the model during reflect ",(0,ep.jsx)("strong",{children:"and"})," filter source memories during refresh (default ",(0,ep.jsx)("code",{children:"all_strict"}),": only memories carrying every listed tag are read). If no memories have these tags yet, refresh will produce empty content — backfill tags on memories, or adjust ",(0,ep.jsx)("em",{children:"Tags Match"})," /"," ",(0,ep.jsx)("em",{children:"Tag Groups"})," below."]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags Match"}),(0,ep.jsxs)(tI.Select,{value:o.tagsMatch,onValueChange:e=>s({...o,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(tI.SelectTrigger,{children:(0,ep.jsx)(tI.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(tI.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(tI.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(tI.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(tI.SelectItem,{value:"all_strict",children:"all_strict — AND matching, excludes untagged"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Controls how the model's tags filter memories during refresh."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tag Groups (JSON)"}),(0,ep.jsx)(gr.Textarea,{value:o.tagGroups,onChange:e=>s({...o,tagGroups:e.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Compound boolean tag expressions for refresh filtering. Overrides flat tags when set."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Recall"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Override how the internal recall behaves when this model refreshes. Leave blank to inherit the bank/global default."}),(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(m6,{value:o.factTypes,onChange:e=>s({...o,factTypes:e})}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to include all types."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Include chunks"}),(0,ep.jsxs)(tI.Select,{value:o.includeChunks||"default",onValueChange:e=>s({...o,includeChunks:"default"===e?"":e}),children:[(0,ep.jsx)(tI.SelectTrigger,{children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"default",children:"Default (inherit)"}),(0,ep.jsx)(tI.SelectItem,{value:"true",children:"Yes — include raw chunk text"}),(0,ep.jsx)(tI.SelectItem,{value:"false",children:"No — skip chunks (smaller prompt)"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall max tokens"}),(0,ep.jsx)(eL.Input,{type:"number",value:o.recallMaxTokens,onChange:e=>s({...o,recallMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for facts returned by recall."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall chunks max tokens"}),(0,ep.jsx)(eL.Input,{type:"number",value:o.recallChunksMaxTokens,onChange:e=>s({...o,recallChunksMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for raw chunk text returned by recall."})]})]})]})]})]}),(0,ep.jsxs)(tW.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:t,disabled:i,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:l,disabled:i||!o.name.trim()||!o.sourceQuery.trim(),children:i?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tU.default,{className:"w-4 h-4 animate-spin mr-1"}),"Generating..."]}):"Create"})]})]})})}function Uw({open:e,mentalModel:t,onClose:n,onUpdated:r}){let{currentBank:i}=(0,ey.useBank)(),[a,o]=(0,em.useState)(!1),s=()=>({name:t.name,sourceQuery:t.source_query,maxTokens:String(t.max_tokens||2048),tags:t.tags.join(", "),autoRefresh:t.trigger?.refresh_after_consolidation||!1,mode:t.trigger?.mode||"full",factTypes:t.trigger?.fact_types||[],excludeMentalModels:t.trigger?.exclude_mental_models||!1,excludeMentalModelIds:(t.trigger?.exclude_mental_model_ids||[]).join(", "),tagsMatch:t.trigger?.tags_match||"",tagGroups:t.trigger?.tag_groups?JSON.stringify(t.trigger.tag_groups,null,2):"",includeChunks:t.trigger?.include_chunks===!0?"true":t.trigger?.include_chunks===!1?"false":"",recallMaxTokens:t.trigger?.recall_max_tokens!=null?String(t.trigger.recall_max_tokens):"",recallChunksMaxTokens:t.trigger?.recall_chunks_max_tokens!=null?String(t.trigger.recall_chunks_max_tokens):""}),[l,c]=(0,em.useState)(s);(0,em.useEffect)(()=>{e&&c(s())},[e,t]);let u=async()=>{if(i&&l.name.trim()&&l.sourceQuery.trim()){o(!0);try{let e,a=l.tags.split(",").map(e=>e.trim()).filter(e=>e.length>0),o=parseInt(l.maxTokens)||2048,s=l.excludeMentalModelIds.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(l.tagGroups.trim())try{e=JSON.parse(l.tagGroups.trim())}catch{ev.toast.error("Invalid JSON in Tag Groups field");return}let c=l.recallMaxTokens.trim()?parseInt(l.recallMaxTokens,10):void 0,u=l.recallChunksMaxTokens.trim()?parseInt(l.recallChunksMaxTokens,10):void 0,d="true"===l.includeChunks||"false"!==l.includeChunks&&void 0,h=await eP.client.updateMentalModel(i,t.id,{name:l.name.trim(),source_query:l.sourceQuery.trim(),tags:a.length>0?a:void 0,max_tokens:o,trigger:{mode:l.mode,refresh_after_consolidation:l.autoRefresh,fact_types:l.factTypes.length>0?l.factTypes:void 0,exclude_mental_models:l.excludeMentalModels||void 0,exclude_mental_model_ids:s.length>0?s:void 0,tags_match:l.tagsMatch||void 0,tag_groups:e,include_chunks:d,recall_max_tokens:c,recall_chunks_max_tokens:u}});r(h),n()}catch(e){}finally{o(!1)}}};return(0,ep.jsx)(tW.Dialog,{open:e,onOpenChange:e=>!e&&n(),children:(0,ep.jsxs)(tW.DialogContent,{className:"sm:max-w-2xl max-h-[90vh] flex flex-col",children:[(0,ep.jsxs)(tW.DialogHeader,{children:[(0,ep.jsx)(tW.DialogTitle,{children:"Update Mental Model"}),(0,ep.jsx)(tW.DialogDescription,{children:"Update the mental model configuration. Changes will take effect immediately."})]}),(0,ep.jsxs)(tG.Tabs,{defaultValue:"general",className:"py-2 flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,ep.jsxs)(tG.TabsList,{className:"w-full",children:[(0,ep.jsx)(tG.TabsTrigger,{value:"general",className:"flex-1",children:"General"}),(0,ep.jsx)(tG.TabsTrigger,{value:"options",className:"flex-1",children:"Options"})]}),(0,ep.jsxs)("div",{className:"flex-1 overflow-y-auto mt-2 pr-1",children:[(0,ep.jsxs)(tG.TabsContent,{value:"general",className:"space-y-4 pt-4",children:[(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),(0,ep.jsx)(eL.Input,{value:t.id,disabled:!0,className:"bg-muted"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Name *"}),(0,ep.jsx)(eL.Input,{value:l.name,onChange:e=>c({...l,name:e.target.value}),placeholder:"e.g., Team Communication Preferences"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Source Query *"}),(0,ep.jsx)(eL.Input,{value:l.sourceQuery,onChange:e=>c({...l,sourceQuery:e.target.value}),placeholder:"e.g., How does the team prefer to communicate?"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Max Tokens"}),(0,ep.jsx)(eL.Input,{type:"number",value:l.maxTokens,onChange:e=>c({...l,maxTokens:e.target.value}),placeholder:"2048",min:"256",max:"8192"})]})]}),(0,ep.jsxs)(tG.TabsContent,{value:"options",className:"space-y-6 pt-4",children:[(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Refresh"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(m1.Checkbox,{id:"update-auto-refresh",checked:l.autoRefresh,onCheckedChange:e=>c({...l,autoRefresh:!0===e})}),(0,ep.jsx)("label",{htmlFor:"update-auto-refresh",className:"text-sm font-medium text-foreground cursor-pointer",children:"Auto-refresh after consolidation"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Refresh mode"}),(0,ep.jsxs)(tI.Select,{value:l.mode,onValueChange:e=>c({...l,mode:e}),children:[(0,ep.jsx)(tI.SelectTrigger,{children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"full",children:"Full — regenerate from scratch each refresh"}),(0,ep.jsx)(tI.SelectItem,{value:"delta",children:"Delta — surgical edits, preserve unchanged content"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Delta mode applies minimal changes to the existing content. Falls back to a full rewrite on the first refresh and whenever the source query changes."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Other Mental Models"}),(0,ep.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,ep.jsx)(m1.Checkbox,{id:"update-exclude-mental-models",checked:l.excludeMentalModels,onCheckedChange:e=>c({...l,excludeMentalModels:!0===e})}),(0,ep.jsx)("label",{htmlFor:"update-exclude-mental-models",className:"text-sm font-medium text-foreground cursor-pointer",children:"Exclude all mental models"})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Exclude Mental Model IDs"}),(0,ep.jsx)(eL.Input,{value:l.excludeMentalModelIds,onChange:e=>c({...l,excludeMentalModelIds:e.target.value}),placeholder:"e.g., model-a, model-b (comma-separated)"})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Tags"}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags"}),(0,ep.jsx)(eL.Input,{value:l.tags,onChange:e=>c({...l,tags:e.target.value}),placeholder:"e.g., project-x, team-alpha (comma-separated)"}),(0,ep.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Tags scope the model during reflect ",(0,ep.jsx)("strong",{children:"and"})," filter source memories during refresh (default ",(0,ep.jsx)("code",{children:"all_strict"}),": only memories carrying every listed tag are read). If no memories have these tags yet, refresh will produce empty content — backfill tags on memories, or adjust ",(0,ep.jsx)("em",{children:"Tags Match"})," /"," ",(0,ep.jsx)("em",{children:"Tag Groups"})," below."]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tags Match"}),(0,ep.jsxs)(tI.Select,{value:l.tagsMatch||"default",onValueChange:e=>c({...l,tagsMatch:"default"===e?"":e}),children:[(0,ep.jsx)(tI.SelectTrigger,{children:(0,ep.jsx)(tI.SelectValue,{placeholder:"Default (all_strict when tags set)"})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"default",children:"Default (all_strict when tags set)"}),(0,ep.jsx)(tI.SelectItem,{value:"any",children:"any — OR matching, includes untagged"}),(0,ep.jsx)(tI.SelectItem,{value:"all",children:"all — AND matching, includes untagged"}),(0,ep.jsx)(tI.SelectItem,{value:"any_strict",children:"any_strict — OR matching, excludes untagged"}),(0,ep.jsx)(tI.SelectItem,{value:"all_strict",children:"all_strict — AND matching, excludes untagged"})]})]}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Controls how the model's tags filter memories during refresh."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Tag Groups (JSON)"}),(0,ep.jsx)(gr.Textarea,{value:l.tagGroups,onChange:e=>c({...l,tagGroups:e.target.value}),placeholder:'e.g., [{"or": [{"tags": ["user:alice"], "match": "all_strict"}, {"tags": ["shared"]}]}]',rows:3,className:"font-mono text-xs"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Compound boolean tag expressions for refresh filtering. Overrides flat tags when set."})]})]}),(0,ep.jsxs)("section",{className:"space-y-4",children:[(0,ep.jsx)("h3",{className:"text-sm font-semibold text-foreground border-b pb-1",children:"Recall"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Override how the internal recall behaves when this model refreshes. Leave blank to inherit the bank/global default."}),(0,ep.jsxs)("div",{className:"space-y-3",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Fact Types"}),(0,ep.jsx)(m6,{value:l.factTypes,onChange:e=>c({...l,factTypes:e})}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to include all types."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Include chunks"}),(0,ep.jsxs)(tI.Select,{value:l.includeChunks||"default",onValueChange:e=>c({...l,includeChunks:"default"===e?"":e}),children:[(0,ep.jsx)(tI.SelectTrigger,{children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"default",children:"Default (inherit)"}),(0,ep.jsx)(tI.SelectItem,{value:"true",children:"Yes — include raw chunk text"}),(0,ep.jsx)(tI.SelectItem,{value:"false",children:"No — skip chunks (smaller prompt)"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall max tokens"}),(0,ep.jsx)(eL.Input,{type:"number",value:l.recallMaxTokens,onChange:e=>c({...l,recallMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for facts returned by recall."})]}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Recall chunks max tokens"}),(0,ep.jsx)(eL.Input,{type:"number",value:l.recallChunksMaxTokens,onChange:e=>c({...l,recallChunksMaxTokens:e.target.value}),placeholder:"Default (inherit)",min:"0"}),(0,ep.jsx)("p",{className:"text-xs text-muted-foreground",children:"Token budget for raw chunk text returned by recall."})]})]})]})]})]}),(0,ep.jsxs)(tW.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:n,disabled:a,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:u,disabled:a||!l.name.trim()||!l.sourceQuery.trim(),children:a?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tU.default,{className:"w-4 h-4 animate-spin mr-1"}),"Updating..."]}):"Update"})]})]})})}function Uj({mentalModels:e,selectedId:t,onSelect:n,onOpenDetail:r,refreshingIds:i,onEdit:a,onRefresh:o,onDelete:s}){let l=t&&e.some(e=>e.id===t)?t:e[0]?.id??null,c=e.find(e=>e.id===l)??null;return(0,ep.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-[320px_1fr] gap-0 overflow-hidden min-h-[600px]",children:[(0,ep.jsx)("aside",{className:"border-r border-border bg-muted/30 overflow-y-auto max-h-[calc(100vh-260px)]",children:(0,ep.jsx)("ul",{className:"py-1",children:e.map(e=>{let t=e.id===l;return(0,ep.jsx)("li",{children:(0,ep.jsxs)("button",{onClick:()=>n(e.id),className:`w-full flex items-start gap-2 px-3 py-2 text-left transition-colors border-l-2 ${t?"bg-primary/10 border-primary text-foreground":"border-transparent text-muted-foreground hover:bg-muted hover:text-foreground"}`,title:`${e.name}
9
- ${e.source_query}`,children:[(0,ep.jsx)(eC.FileText,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5"}),(0,ep.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("span",{className:`truncate text-sm font-medium ${t?"text-foreground":""}`,children:e.name}),(0,ep.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",title:wX(e.last_refreshed_at),children:w$(e.last_refreshed_at)})]}),e.source_query&&(0,ep.jsx)("div",{className:"text-xs text-muted-foreground/80 truncate italic mt-0.5",children:e.source_query})]})]})},e.id)})})}),(0,ep.jsx)("section",{className:"overflow-y-auto max-h-[calc(100vh-260px)]",children:c?(0,ep.jsxs)("article",{className:"p-6",children:[(0,ep.jsx)("header",{className:"mb-4 pb-4 border-b border-border",children:(0,ep.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,ep.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ep.jsx)("h2",{className:"text-xl font-semibold text-foreground",children:c.name}),c.source_query&&(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground mt-1 italic",children:["“",c.source_query,"”"]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[(0,ep.jsxs)("span",{title:wX(c.last_refreshed_at),children:["Refreshed ",w$(c.last_refreshed_at)]}),c.tags.length>0&&(0,ep.jsx)("div",{className:"flex gap-1",children:c.tags.map(e=>(0,ep.jsx)("span",{className:"px-1.5 py-0.5 rounded text-xs bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e},e))})]})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,ep.jsx)(eD.Button,{variant:"outline",size:"sm",onClick:()=>r(c),children:"Open"}),(0,ep.jsx)(Uy,{m:c,refreshing:i.has(c.id),onEdit:a,onRefresh:o,onDelete:s})]})]})}),c.content?(0,ep.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:(0,ep.jsx)(wW,{children:c.content})}):(0,ep.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No content yet. Refresh this mental model to generate content."})]}):(0,ep.jsxs)("div",{className:"p-10 text-center text-muted-foreground",children:[(0,ep.jsx)(eC.FileText,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),(0,ep.jsx)("p",{className:"text-sm",children:"Select a mental model to view its content."})]})})]})}let UN=(0,ej.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var tU=tU;let Uk=["consolidation.completed","retain.completed"],UC={url:"",secret:"",event_types:["consolidation.completed"],enabled:!0,http_config:{method:"POST",timeout_seconds:30,headers:[],params:[]}};function UE(e){return Object.fromEntries(e.filter(e=>e.key.trim()).map(e=>[e.key,e.value]))}function U_(e){return{method:e.method,timeout_seconds:e.timeout_seconds,headers:UE(e.headers),params:UE(e.params)}}function US({label:e,pairs:t,onChange:n}){let r=(e,r,i)=>{n(t.map((t,n)=>n===e?{...t,[r]:i}:t))};return(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsx)(e6,{children:e}),(0,ep.jsxs)(eD.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs px-2",onClick:()=>n([...t,{key:"",value:""}]),children:[(0,ep.jsx)(fB.Plus,{className:"w-3 h-3 mr-1"}),"Add"]})]}),t.length>0&&(0,ep.jsx)("div",{className:"space-y-1.5",children:t.map((e,i)=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(eL.Input,{placeholder:"Key",value:e.key,onChange:e=>r(i,"key",e.target.value),className:"h-8 text-sm flex-1"}),(0,ep.jsx)(eL.Input,{placeholder:"Value",value:e.value,onChange:e=>r(i,"value",e.target.value),className:"h-8 text-sm flex-1"}),(0,ep.jsx)("button",{type:"button",onClick:()=>n(t.filter((e,t)=>t!==i)),className:"text-muted-foreground hover:text-foreground shrink-0",children:(0,ep.jsx)(tV.X,{className:"w-4 h-4"})})]},i))})]})}function UT({delivery:e,formatDate:t}){var n;let[r,i]=(0,em.useState)(!1),a=e.last_response_body||e.last_error;return(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsxs)(eZ,{className:a?"cursor-pointer hover:bg-muted/40":void 0,onClick:()=>a&&i(e=>!e),children:[(0,ep.jsx)(eJ,{className:"w-8 pl-3 pr-0",children:a?r?(0,ep.jsx)(mH.ChevronDown,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)(eS.ChevronRight,{className:"w-4 h-4 text-muted-foreground"}):(0,ep.jsx)("span",{className:"w-4 h-4 inline-block"})}),(0,ep.jsx)(eJ,{children:"completed"===(n=e.status)?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"delivered"]}):"pending"===n?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/20",children:[(0,ep.jsx)(eY,{className:"w-3 h-3"}),"pending"]}):"failed"===n?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,ep.jsx)(jm,{className:"w-3 h-3"}),"failed"]}):(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:n})}),(0,ep.jsx)(eJ,{children:null!=e.last_response_status?(0,ep.jsx)("span",{className:`font-mono text-xs px-1.5 py-0.5 rounded border ${e.last_response_status>=200&&e.last_response_status<300?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20"}`,children:e.last_response_status}):(0,ep.jsx)("span",{className:"text-muted-foreground text-xs",children:"—"})}),(0,ep.jsx)(eJ,{className:"text-center text-sm",children:e.attempts}),(0,ep.jsx)(eJ,{className:"font-mono text-xs text-muted-foreground",children:e.event_type}),(0,ep.jsx)(eJ,{className:"text-xs text-muted-foreground whitespace-nowrap",children:t(e.created_at)})]}),r&&a&&(0,ep.jsx)(eZ,{className:"bg-muted/20 hover:bg-muted/20",children:(0,ep.jsx)(eJ,{colSpan:6,className:"px-4 py-3",children:(0,ep.jsxs)("div",{className:"space-y-3",children:[e.last_error&&(0,ep.jsxs)("div",{className:"space-y-1",children:[(0,ep.jsx)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Error"}),(0,ep.jsx)("p",{className:"font-mono text-xs text-red-600 dark:text-red-400 break-all",children:e.last_error})]}),e.last_response_body&&(0,ep.jsxs)("div",{className:"space-y-1",children:[(0,ep.jsxs)("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:["Response Body",e.last_attempt_at&&(0,ep.jsxs)("span",{className:"ml-2 normal-case font-normal",children:["· ",t(e.last_attempt_at)]})]}),(0,ep.jsx)("pre",{className:"font-mono text-xs bg-background rounded p-2 overflow-x-auto whitespace-pre-wrap break-all max-h-40 overflow-y-auto border border-border",children:e.last_response_body})]})]})})})]})}function UA(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(!1),[a,o]=(0,em.useState)(!1),[s,l]=(0,em.useState)(!1),[c,u]=(0,em.useState)(null),[d,h]=(0,em.useState)(null),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(UC),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(null),[j,N]=(0,em.useState)(UC),[k,C]=(0,em.useState)(!1),[E,_]=(0,em.useState)(!1),[S,T]=(0,em.useState)(!1),[A,O]=(0,em.useState)(!1),[M,P]=(0,em.useState)(null),[D,L]=(0,em.useState)([]),[I,R]=(0,em.useState)(!1),[B,z]=(0,em.useState)(null),[F,V]=(0,em.useState)(!1),U=async()=>{if(e){i(!0);try{let t=await eP.client.listWebhooks(e);n(t.items||[])}catch(e){console.error("Error loading webhooks:",e)}finally{i(!1)}}};(0,em.useEffect)(()=>{e&&U()},[e]);let H=async()=>{if(e&&g.url){l(!0);try{await eP.client.createWebhook(e,{url:g.url,secret:g.secret||void 0,event_types:g.event_types.length>0?g.event_types:void 0,enabled:g.enabled,http_config:U_(g.http_config)}),o(!1),v(UC),p(!1),await U()}catch(e){}finally{l(!1)}}},W=async t=>{if(e){u(t),h(null);try{await eP.client.deleteWebhook(e,t),await U()}catch(e){}finally{u(null)}}},Y=async()=>{if(e&&b&&j.url){T(!0);try{let t={url:j.url,event_types:j.event_types,enabled:j.enabled,http_config:U_(j.http_config)};E?t.secret=null:j.secret&&(t.secret=j.secret),await eP.client.updateWebhook(e,b.id,t),y(!1),await U()}catch{}finally{T(!1)}}},G=async t=>{if(e){P(t),O(!0),L([]),z(null),R(!0);try{let n=await eP.client.listWebhookDeliveries(e,t.id,50);L(n.items||[]),z(n.next_cursor??null)}catch(e){console.error("Error loading deliveries:",e)}finally{R(!1)}}},$=async()=>{if(e&&M&&B){V(!0);try{let t=await eP.client.listWebhookDeliveries(e,M.id,50,B);L(e=>[...e,...t.items||[]]),z(t.next_cursor??null)}catch(e){console.error("Error loading more deliveries:",e)}finally{V(!1)}}},X=e=>e?new Date(e).toLocaleString():"N/A";return e?(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)("h3",{className:"text-lg font-semibold",children:"Webhooks"}),(0,ep.jsx)("button",{onClick:()=>U(),className:"p-1 rounded hover:bg-muted transition-colors",title:"Refresh webhooks",disabled:r,children:(0,ep.jsx)(eH,{className:`w-4 h-4 text-muted-foreground hover:text-foreground ${r?"animate-spin":""}`})})]}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground",children:[t.length," webhook",1!==t.length?"s":""]})]}),(0,ep.jsxs)(eD.Button,{size:"sm",onClick:()=>o(!0),children:[(0,ep.jsx)(fB.Plus,{className:"w-4 h-4 mr-2"}),"Add Webhook"]})]}),t.length>0?(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eX,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{children:"URL"}),(0,ep.jsx)(eQ,{children:"Method"}),(0,ep.jsx)(eQ,{children:"Event Types"}),(0,ep.jsx)(eQ,{children:"Status"}),(0,ep.jsx)(eQ,{children:"Created At"}),(0,ep.jsx)(eQ,{className:"w-[120px]"})]})}),(0,ep.jsx)(eK,{children:t.map(e=>(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eJ,{className:"font-mono text-sm max-w-[300px] truncate",children:(0,ep.jsx)("span",{title:e.url,children:e.url})}),(0,ep.jsx)(eJ,{children:(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono font-medium bg-muted text-muted-foreground border border-border",children:e.http_config?.method||"POST"})}),(0,ep.jsx)(eJ,{children:(0,ep.jsx)("div",{className:"flex flex-wrap gap-1",children:e.event_types.length>0?e.event_types.map(e=>(0,ep.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 border border-blue-500/20",children:e},e)):(0,ep.jsx)("span",{className:"text-xs text-muted-foreground",children:"All events"})})}),(0,ep.jsx)(eJ,{children:e.enabled?(0,ep.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:[(0,ep.jsx)(eW,{className:"w-3 h-3"}),"Enabled"]}):(0,ep.jsx)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:"Disabled"})}),(0,ep.jsx)(eJ,{className:"text-sm text-muted-foreground",children:X(e.created_at)}),(0,ep.jsx)(eJ,{children:(0,ep.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ep.jsxs)(eD.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>G(e),title:"View deliveries",children:[(0,ep.jsx)(eU,{className:"w-3 h-3 mr-1"}),"Deliveries"]}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{let t;return w(e),void(N((t=e.http_config??{method:"POST",timeout_seconds:30,headers:{},params:{}},{url:e.url,secret:"",event_types:e.event_types,enabled:e.enabled,http_config:{method:t.method,timeout_seconds:t.timeout_seconds,headers:Object.entries(t.headers??{}).map(([e,t])=>({key:e,value:t})),params:Object.entries(t.params??{}).map(([e,t])=>({key:e,value:t}))}})),C(!1),_(!1),y(!0))},title:"Edit webhook",children:(0,ep.jsx)(mV,{className:"w-3 h-3"})}),(0,ep.jsx)(eD.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground hover:text-red-600 dark:hover:text-red-400",onClick:()=>h(e),disabled:c===e.id,title:"Delete webhook",children:c===e.id?(0,ep.jsx)(tU.default,{className:"w-3 h-3 animate-spin"}):(0,ep.jsx)(mF,{className:"w-3 h-3"})})]})})]},e.id))})]})}):(0,ep.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:"No webhooks configured. Add a webhook to receive event notifications."}),(0,ep.jsx)(tW.Dialog,{open:a,onOpenChange:e=>{e||(v(UC),p(!1)),o(e)},children:(0,ep.jsxs)(tW.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tW.DialogHeader,{children:[(0,ep.jsx)(tW.DialogTitle,{children:"Add Webhook"}),(0,ep.jsx)(tW.DialogDescription,{children:"Configure a webhook endpoint to receive event notifications."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e6,{children:"Type"}),(0,ep.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e6,{htmlFor:"webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eL.Input,{id:"webhook-url",type:"url",placeholder:"https://example.com/webhook",value:g.url,onChange:e=>v(t=>({...t,url:e.target.value}))})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e6,{children:"Method"}),(0,ep.jsxs)(tI.Select,{value:g.http_config.method,onValueChange:e=>v(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(tI.SelectTrigger,{children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(tI.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e6,{htmlFor:"webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eL.Input,{id:"webhook-timeout",type:"number",min:1,max:300,value:g.http_config.timeout_seconds,onChange:e=>v(t=>({...t,http_config:{...t.http_config,timeout_seconds:parseInt(e.target.value)||30}}))})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e6,{htmlFor:"webhook-secret",children:["Secret ",(0,ep.jsx)("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),(0,ep.jsxs)("div",{className:"relative",children:[(0,ep.jsx)(eL.Input,{id:"webhook-secret",type:f?"text":"password",placeholder:"Signing secret",value:g.secret,onChange:e=>v(t=>({...t,secret:e.target.value})),className:"pr-10"}),(0,ep.jsx)("button",{type:"button",onClick:()=>p(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:f?(0,ep.jsx)(UN,{className:"w-4 h-4"}):(0,ep.jsx)(eU,{className:"w-4 h-4"})})]})]}),(0,ep.jsx)(US,{label:"Custom Headers",pairs:g.http_config.headers,onChange:e=>v(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(US,{label:"Query Parameters",pairs:g.http_config.params,onChange:e=>v(t=>({...t,http_config:{...t.http_config,params:e}}))}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)(e6,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:Uk.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(m1.Checkbox,{id:`event-${e}`,checked:g.event_types.includes(e),onCheckedChange:()=>{v(t=>({...t,event_types:t.event_types.includes(e)?t.event_types.filter(t=>t!==e):[...t.event_types,e]}))}}),(0,ep.jsx)(e6,{htmlFor:`event-${e}`,className:"font-mono text-sm cursor-pointer",children:e})]},e))})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)(tL.Switch,{id:"webhook-enabled",checked:g.enabled,onCheckedChange:e=>v(t=>({...t,enabled:e}))}),(0,ep.jsx)(e6,{htmlFor:"webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tW.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:()=>o(!1),disabled:s,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:H,disabled:s||!g.url,children:s?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tU.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Creating..."]}):"Create Webhook"})]})]})}),(0,ep.jsx)(tW.Dialog,{open:x,onOpenChange:e=>{e||(w(null),N(UC),C(!1),_(!1)),y(e)},children:(0,ep.jsxs)(tW.DialogContent,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[(0,ep.jsxs)(tW.DialogHeader,{children:[(0,ep.jsx)(tW.DialogTitle,{children:"Edit Webhook"}),(0,ep.jsx)(tW.DialogDescription,{children:"Update the webhook configuration."})]}),(0,ep.jsxs)("div",{className:"space-y-4 py-2",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e6,{children:"Type"}),(0,ep.jsx)("div",{className:"flex items-center h-9 px-3 rounded-md border border-border bg-muted text-sm text-muted-foreground",children:"HTTP"})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsxs)(e6,{htmlFor:"edit-webhook-url",children:["URL ",(0,ep.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,ep.jsx)(eL.Input,{id:"edit-webhook-url",type:"url",placeholder:"https://example.com/webhook",value:j.url,onChange:e=>N(t=>({...t,url:e.target.value}))})]}),(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e6,{children:"Method"}),(0,ep.jsxs)(tI.Select,{value:j.http_config.method,onValueChange:e=>N(t=>({...t,http_config:{...t.http_config,method:e}})),children:[(0,ep.jsx)(tI.SelectTrigger,{children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsxs)(tI.SelectContent,{children:[(0,ep.jsx)(tI.SelectItem,{value:"POST",children:"POST"}),(0,ep.jsx)(tI.SelectItem,{value:"GET",children:"GET"})]})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e6,{htmlFor:"edit-webhook-timeout",children:"Timeout (seconds)"}),(0,ep.jsx)(eL.Input,{id:"edit-webhook-timeout",type:"number",min:1,max:300,value:j.http_config.timeout_seconds,onChange:e=>N(t=>({...t,http_config:{...t.http_config,timeout_seconds:parseInt(e.target.value)||30}}))})]})]}),(0,ep.jsxs)("div",{className:"space-y-1.5",children:[(0,ep.jsx)(e6,{htmlFor:"edit-webhook-secret",children:"Secret"}),(0,ep.jsxs)("div",{className:"relative",children:[(0,ep.jsx)(eL.Input,{id:"edit-webhook-secret",type:k?"text":"password",placeholder:"Leave blank to keep existing",value:j.secret,disabled:E,onChange:e=>N(t=>({...t,secret:e.target.value})),className:"pr-10"}),(0,ep.jsx)("button",{type:"button",onClick:()=>C(e=>!e),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:k?(0,ep.jsx)(UN,{className:"w-4 h-4"}):(0,ep.jsx)(eU,{className:"w-4 h-4"})})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,ep.jsx)(m1.Checkbox,{id:"edit-clear-secret",checked:E,onCheckedChange:e=>{_(!!e),e&&N(e=>({...e,secret:""}))}}),(0,ep.jsx)(e6,{htmlFor:"edit-clear-secret",className:"text-xs text-muted-foreground cursor-pointer",children:"Clear existing secret"})]})]}),(0,ep.jsx)(US,{label:"Custom Headers",pairs:j.http_config.headers,onChange:e=>N(t=>({...t,http_config:{...t.http_config,headers:e}}))}),(0,ep.jsx)(US,{label:"Query Parameters",pairs:j.http_config.params,onChange:e=>N(t=>({...t,http_config:{...t.http_config,params:e}}))}),(0,ep.jsxs)("div",{className:"space-y-2",children:[(0,ep.jsx)(e6,{children:"Event Types"}),(0,ep.jsx)("div",{className:"space-y-2",children:Uk.map(e=>(0,ep.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ep.jsx)(m1.Checkbox,{id:`edit-event-${e}`,checked:j.event_types.includes(e),onCheckedChange:()=>N(t=>({...t,event_types:t.event_types.includes(e)?t.event_types.filter(t=>t!==e):[...t.event_types,e]}))}),(0,ep.jsx)(e6,{htmlFor:`edit-event-${e}`,className:"font-mono text-sm cursor-pointer",children:e})]},e))})]}),(0,ep.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ep.jsx)(tL.Switch,{id:"edit-webhook-enabled",checked:j.enabled,onCheckedChange:e=>N(t=>({...t,enabled:e}))}),(0,ep.jsx)(e6,{htmlFor:"edit-webhook-enabled",children:"Enabled"})]})]}),(0,ep.jsxs)(tW.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:()=>y(!1),disabled:S,children:"Cancel"}),(0,ep.jsx)(eD.Button,{onClick:Y,disabled:S||!j.url,children:S?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tU.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})}),(0,ep.jsx)(tW.Dialog,{open:!!d,onOpenChange:e=>{e||h(null)},children:(0,ep.jsxs)(tW.DialogContent,{className:"max-w-md",children:[(0,ep.jsxs)(tW.DialogHeader,{children:[(0,ep.jsx)(tW.DialogTitle,{children:"Delete Webhook"}),(0,ep.jsx)(tW.DialogDescription,{children:"Are you sure you want to delete this webhook? This action cannot be undone and all pending deliveries will be cancelled."})]}),d&&(0,ep.jsx)("div",{className:"py-2",children:(0,ep.jsx)("p",{className:"font-mono text-sm truncate text-muted-foreground bg-muted px-3 py-2 rounded-md border border-border",children:d.url})}),(0,ep.jsxs)(tW.DialogFooter,{children:[(0,ep.jsx)(eD.Button,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),(0,ep.jsx)(eD.Button,{variant:"destructive",onClick:()=>d&&W(d.id),disabled:!!c,children:c?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tU.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete Webhook"})]})]})}),(0,ep.jsx)(tW.Dialog,{open:A,onOpenChange:e=>{e||(L([]),z(null)),O(e)},children:(0,ep.jsxs)(tW.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsxs)(tW.DialogHeader,{children:[(0,ep.jsx)(tW.DialogTitle,{children:"Webhook Deliveries"}),M&&(0,ep.jsx)(tW.DialogDescription,{className:"font-mono text-xs truncate",children:M.url})]}),I?(0,ep.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,ep.jsx)(tU.default,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):D.length>0?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)("div",{className:"overflow-x-auto",children:(0,ep.jsxs)(eX,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"w-8 pl-3 pr-0"}),(0,ep.jsx)(eQ,{children:"Status"}),(0,ep.jsx)(eQ,{children:"HTTP"}),(0,ep.jsx)(eQ,{className:"text-center",children:"Attempts"}),(0,ep.jsx)(eQ,{children:"Event"}),(0,ep.jsx)(eQ,{children:"Created At"})]})}),(0,ep.jsx)(eK,{children:D.map(e=>(0,ep.jsx)(UT,{delivery:e,formatDate:X},e.id))})]})}),B&&(0,ep.jsx)("div",{className:"flex justify-center pt-2",children:(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",onClick:$,disabled:F,children:[F&&(0,ep.jsx)(tU.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Load more"]})})]}):(0,ep.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:"No deliveries yet for this webhook."})]})})]}):null}var UO=["axis"],UM=(0,em.forwardRef)((e,t)=>em.createElement(Rj,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:UO,tooltipPayloadSearcher:Cl,categoricalChartProps:e,ref:t})),UP=em,UD=["children"],UL=(0,em.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function UI(e){var{children:t}=e,n=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,UD);return em.createElement(UL.Provider,{value:n},t)}var UR=(e,t,n,r)=>PJ(e,"xAxis",t,r),UB=(e,t,n,r)=>PQ(e,"xAxis",t,r),Uz=(e,t,n,r)=>PJ(e,"yAxis",n,r),UF=(e,t,n,r)=>PQ(e,"yAxis",n,r),UV=N7([_S,UR,Uz,UB,UF],(e,t,n,r,i)=>E$(e,"xAxis")?E0(t,r,!1):E0(n,i,!1));function UU(e){return"line"===e.type}var UH=N7([MA,(e,t,n,r,i)=>i],(e,t)=>e.filter(UU).find(e=>e.id===t)),UW=N7([_S,UR,Uz,UB,UF,UH,UV,Ok],(e,t,n,r,i,a,o,s)=>{var l,{chartData:c,dataStartIndex:u,dataEndIndex:d}=s;if(null!=a&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=o&&("horizontal"===e||"vertical"===e)){var{dataKey:h,data:f}=a;if(null!=(l=null!=f&&f.length>0?f:null==c?void 0:c.slice(u,d+1)))return function(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:s,displayedData:l}=e;return l.map((e,l)=>{var c=EG(e,o);if("horizontal"===t)return{x:EZ({axis:n,ticks:i,bandSize:s,entry:e,index:l}),y:null==c?null:r.scale(c),value:c,payload:e};var u=null==c?null:n.scale(c),d=EZ({axis:r,ticks:a,bandSize:s,entry:e,index:l});return null==u||null==d?null:{x:u,y:d,value:c,payload:e}}).filter(Boolean)}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:h,bandSize:o,displayedData:l})}}),UY=e.i(7328);function UG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U$(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?UG(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function UX(){return(UX=Object.assign.bind()).apply(null,arguments)}function Uq(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var UK=(e,t,n,r,i)=>{var a=n-r;return k5(ec||(ec=Uq(["M ",",",""])),e,t)+k5(eu||(eu=Uq(["L ",",",""])),e+n,t)+k5(ed||(ed=Uq(["L ",",",""])),e+n-a/2,t+i)+k5(eh||(eh=Uq(["L ",",",""])),e+n-a/2-r,t+i)+k5(ef||(ef=Uq(["L ",","," Z"])),e,t)},UZ={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},UQ=e=>{var t=Ry(e,UZ),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:s}=t,{animationEasing:l,animationDuration:c,animationBegin:u,isUpdateAnimationActive:d}=t,h=(0,em.useRef)(null),[f,p]=(0,em.useState)(-1),g=(0,em.useRef)(i),v=(0,em.useRef)(a),x=(0,em.useRef)(o),y=(0,em.useRef)(n),b=(0,em.useRef)(r),w=zC(e,"trapezoid-");if((0,em.useEffect)(()=>{if(h.current&&h.current.getTotalLength)try{var e=h.current.getTotalLength();e&&p(e)}catch(e){}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||0===i&&0===a||0===o)return null;var j=(0,_l.clsx)("recharts-trapezoid",s);if(!d)return em.createElement("g",null,em.createElement("path",UX({},IW(t),{className:j,d:UK(n,r,i,a,o)})));var N=g.current,k=v.current,C=x.current,E=y.current,_=b.current,S="0px ".concat(-1===f?1:f,"px"),T="".concat(f,"px 0px"),A=zM(["strokeDasharray"],c,l);return em.createElement(zK,{animationId:w,key:w,canBegin:f>0,duration:c,easing:l,isActive:d,begin:u},e=>{var s=Cr(N,i,e),l=Cr(k,a,e),c=Cr(C,o,e),u=Cr(E,n,e),d=Cr(_,r,e);h.current&&(g.current=s,v.current=l,x.current=c,y.current=u,b.current=d);var f=e>0?{transition:A,strokeDasharray:T}:{strokeDasharray:S};return em.createElement("path",UX({},IW(t),{className:j,d:UK(u,d,s,l,c),ref:h,style:U$(U$({},f),t.style)}))})};let UJ=Math.cos,U0=Math.sin,U1=Math.sqrt,U2=Math.PI,U5=2*U2;U1(3);let U3={draw(e,t){let n=U1(t/U2);e.moveTo(n,0),e.arc(0,0,n,0,U5)}},U4=U1(1/3),U6=2*U4,U8=U0(U2/10)/U0(7*U2/10),U7=U0(U5/10)*U8,U9=-UJ(U5/10)*U8,He=U1(3);U1(3);let Ht=U1(3)/2,Hn=1/U1(12),Hr=(Hn/2+1)*3;var Hi=["type","size","sizeType"];function Ha(){return(Ha=Object.assign.bind()).apply(null,arguments)}function Ho(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ho(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ho(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Hl={symbolCircle:U3,symbolCross:{draw(e,t){let n=U1(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},symbolDiamond:{draw(e,t){let n=U1(t/U6),r=n*U4;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},symbolSquare:{draw(e,t){let n=U1(t),r=-n/2;e.rect(r,r,n,n)}},symbolStar:{draw(e,t){let n=U1(.8908130915292852*t),r=U7*n,i=U9*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=U5*t/5,o=UJ(a),s=U0(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},symbolTriangle:{draw(e,t){let n=-U1(t/(3*He));e.moveTo(0,2*n),e.lineTo(-He*n,-n),e.lineTo(He*n,-n),e.closePath()}},symbolWye:{draw(e,t){let n=U1(t/Hr),r=n/2,i=n*Hn,a=n*Hn+n,o=-r;e.moveTo(r,i),e.lineTo(r,a),e.lineTo(o,a),e.lineTo(-.5*r-Ht*i,Ht*r+-.5*i),e.lineTo(-.5*r-Ht*a,Ht*r+-.5*a),e.lineTo(-.5*o-Ht*a,Ht*o+-.5*a),e.lineTo(-.5*r+Ht*i,-.5*i-Ht*r),e.lineTo(-.5*r+Ht*a,-.5*a-Ht*r),e.lineTo(-.5*o+Ht*a,-.5*a-Ht*o),e.closePath()}}},Hc=Math.PI/180,Hu=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=Hs(Hs({},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Hi)),{},{type:t,size:n,sizeType:r}),a="circle";"string"==typeof t&&(a=t);var{className:o,cx:s,cy:l}=i,c=IW(i);return k8(s)&&k8(l)&&k8(n)?em.createElement("path",Ha({},c,{className:(0,_l.clsx)("recharts-symbols",o),transform:"translate(".concat(s,", ").concat(l,")"),d:(()=>{var e,t=(e=a,Hl["symbol".concat(Ca(e))]||U3),i=(function(e,t){let n=null,r=RP(i);function i(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return e="function"==typeof e?e:EI(e||U3),t="function"==typeof t?t:EI(void 0===t?64:+t),i.type=function(t){return arguments.length?(e="function"==typeof t?t:EI(t),i):e},i.size=function(e){return arguments.length?(t="function"==typeof e?e:EI(+e),i):t},i.context=function(e){return arguments.length?(n=null==e?null:e,i):n},i})().type(t).size(((e,t,n)=>{if("area"===t)return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":var r=18*Hc;return 1.25*e*e*(Math.tan(r)-Math.tan(2*r)*Math.tan(r)**2);case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}})(n,r,a))();if(null!==i)return i})()})):null};Hu.registerSymbol=(e,t)=>{Hl["symbol".concat(Ca(e))]=t};var Hd=["option","shapeType","activeClassName"];function Hh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hh(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hp(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return em.createElement(Vc,n);case"trapezoid":return em.createElement(UQ,n);case"sector":return em.createElement(Vg,n);case"symbols":if("symbols"===t)return em.createElement(Hu,n);break;case"curve":return em.createElement(Be,n);default:return null}}function Hm(e){var t,{option:n,shapeType:r,activeClassName:i="recharts-active-shape"}=e,a=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Hd);if((0,em.isValidElement)(n))t=(0,em.cloneElement)(n,Hf(Hf({},a),(0,em.isValidElement)(n)?n.props:n));else if("function"==typeof n)t=n(a,a.index);else if((0,UY.default)(n)&&"boolean"!=typeof n){var o=Hf(Hf({},a),n);t=em.createElement(Hp,{shapeType:r,elementProps:o})}else t=em.createElement(Hp,{shapeType:r,elementProps:a});return a.isActive?em.createElement(Br,{className:i},t):t}var Hg=["id"],Hv=["type","layout","connectNulls","needClip","shape"],Hx=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Hy(){return(Hy=Object.assign.bind()).apply(null,arguments)}function Hb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hw(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hb(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hj(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var HN=UP.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:E2(o,t),hide:s,type:c,color:r,unit:l,graphicalItemId:u}};return UP.createElement(zu,{tooltipEntrySettings:d})}),Hk=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function HC(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,l=IU(Hj(r,Hg));return UP.createElement(za,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:l,needClip:o,clipPathId:t})}function HE(e){var{showLabels:t,children:n,points:r}=e,i=(0,UP.useMemo)(()=>null==r?void 0:r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Hw(Hw({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[r]);return UP.createElement(B5,{value:t?i:void 0},n)}function H_(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:s,connectNulls:l,needClip:c,shape:u}=a,d=Hw(Hw({},IW(Hj(a,Hv))),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(t,")"):void 0,points:r,type:o,layout:s,connectNulls:l,strokeDasharray:null!=i?i:a.strokeDasharray});return UP.createElement(UP.Fragment,null,(null==r?void 0:r.length)>1&&UP.createElement(Hm,Hy({shapeType:"curve",option:u},d,{pathRef:n})),UP.createElement(HC,{points:r,clipPathId:t,props:a}))}function HS(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:s,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,animateNewValues:h,width:f,height:p,onAnimationEnd:g,onAnimationStart:v}=n,x=i.current,y=zC(o,"recharts-line-"),b=(0,UP.useRef)(y),[w,j]=(0,UP.useState)(!1),N=(0,UP.useCallback)(()=>{"function"==typeof g&&g(),j(!1)},[g]),k=(0,UP.useCallback)(()=>{"function"==typeof v&&v(),j(!0)},[v]),C=function(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(e){return 0}}(r.current),E=(0,UP.useRef)(0);b.current!==y&&(E.current=a.current,b.current=y);var _=E.current;return UP.createElement(HE,{points:o,showLabels:!w},n.children,UP.createElement(zK,{animationId:y,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:N,onAnimationStart:k,key:y},e=>{var c,u=Math.min(Cr(_,C+_,e),C);if(c=l?s?((e,t,n)=>{var r=n.reduce((e,t)=>e+t);if(!r)return Hk(t,e);for(var i=Math.floor(e/r),a=e%r,o=t-e,s=[],l=0,c=0;l<n.length;c+=n[l],++l)if(c+n[l]>a){s=[...n.slice(0,l),a-c];break}var u=s.length%2==0?[0,o]:[o];return[...function(e,t){for(var n=e.length%2!=0?[...e,0]:e,r=[],i=0;i<t;++i)r=[...r,...n];return r}(n,i),...s,...u].map(e=>"".concat(e,"px")).join(", ")})(u,C,"".concat(s).split(/[,\s]+/gim).map(e=>parseFloat(e))):Hk(C,u):null==s?void 0:String(s),e>0&&C>0&&(i.current=o,a.current=Math.max(a.current,u)),x){var d=x.length/o.length,g=1===e?o:o.map((t,n)=>{var r=Math.floor(n*d);if(x[r]){var i=x[r];return Hw(Hw({},t),{},{x:Cr(i.x,t.x,e),y:Cr(i.y,t.y,e)})}return h?Hw(Hw({},t),{},{x:Cr(2*f,t.x,e),y:Cr(p/2,t.y,e)}):Hw(Hw({},t),{},{x:t.x,y:t.y})});return i.current=g,UP.createElement(H_,{props:n,points:g,clipPathId:t,pathRef:r,strokeDasharray:c})}return UP.createElement(H_,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:c})}),UP.createElement(B6,{label:n.label}))}function HT(e){var{clipPathId:t,props:n}=e,r=(0,UP.useRef)(null),i=(0,UP.useRef)(0),a=(0,UP.useRef)(null);return UP.createElement(HS,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var HA=(e,t)=>{var n,r;return{x:null!=(n=e.x)?n:void 0,y:null!=(r=e.y)?r:void 0,value:e.value,errorVal:EG(e.payload,t)}};class HO extends UP.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:s,width:l,height:c,id:u,needClip:d,zIndex:h}=this.props;if(e)return null;var f=(0,_l.clsx)("recharts-line",r),{r:p,strokeWidth:g}=zZ(t),v=B9(t),x=2*p+g,y=d?"url(#clipPath-".concat(v?"":"dots-").concat(u,")"):void 0;return UP.createElement(BL,{zIndex:h},UP.createElement(Br,{className:f},d&&UP.createElement("defs",null,UP.createElement(zh,{clipPathId:u,xAxisId:i,yAxisId:a}),!v&&UP.createElement("clipPath",{id:"clipPath-dots-".concat(u)},UP.createElement("rect",{x:s-x/2,y:o-x/2,width:l+x,height:c+x}))),UP.createElement(UI,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:HA,errorBarOffset:0},UP.createElement(HT,{props:this.props,clipPathId:u}))),UP.createElement(zc,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:y}))}}var HM={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:OJ.line,type:"linear"};function HP(e){var t=Ry(e,HM),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:l,hide:c,isAnimationActive:u,label:d,legendType:h,xAxisId:f,yAxisId:p,id:g}=t,v=Hj(t,Hx),{needClip:x}=zd(f,p),y=EM(Rf),b=EM(_S),w=_a(),j=EM(e=>UW(e,f,p,w,g));if("horizontal"!==b&&"vertical"!==b||null==j||null==y)return null;var{height:N,width:k,x:C,y:E}=y;return UP.createElement(HO,Hy({},v,{id:g,connectNulls:s,dot:l,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:c,label:d,legendType:h,xAxisId:f,yAxisId:p,points:j,layout:b,height:N,width:k,left:C,top:E,needClip:x}))}var HD=UP.memo(function(e){var t=Ry(e,HM),n=_a();return UP.createElement(zS,{id:t.id,type:"line"},e=>UP.createElement(UP.Fragment,null,UP.createElement(zk,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:E2(n,t),payload:e}]})(t)}),UP.createElement(HN,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),UP.createElement(zT,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),UP.createElement(HP,Hy({},t,{id:e}))))},IP);HD.displayName="Line";let HL=[{value:"all",label:"All actions"},{value:"retain",label:"Retain"},{value:"recall",label:"Recall"},{value:"reflect",label:"Reflect"},{value:"create_bank",label:"Create Bank"},{value:"update_bank",label:"Update Bank"},{value:"delete_bank",label:"Delete Bank"},{value:"clear_memories",label:"Clear Memories"},{value:"consolidation",label:"Consolidation"},{value:"batch_retain",label:"Batch Retain"},{value:"create_mental_model",label:"Create Mental Model"},{value:"refresh_mental_model",label:"Refresh Mental Model"},{value:"delete_mental_model",label:"Delete Mental Model"},{value:"create_directive",label:"Create Directive"},{value:"delete_directive",label:"Delete Directive"},{value:"file_convert_retain",label:"File Convert & Retain"},{value:"webhook_delivery",label:"Webhook Delivery"}],HI=[{value:"all",label:"All transports"},{value:"http",label:"HTTP"},{value:"mcp",label:"MCP"},{value:"system",label:"System"}],HR=[{value:"1d",label:"Today"},{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"}];function HB(e,t){if(!e||!t)return"—";let n=new Date(e).getTime(),r=new Date(t).getTime()-n;return r<1e3?`${r}ms`:r<6e4?`${(r/1e3).toFixed(1)}s`:`${(r/6e4).toFixed(1)}m`}function Hz(e){return e?new Date(e).toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"—"}function HF({transport:e}){let t={http:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",mcp:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",system:"bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300"};return(0,ep.jsx)("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${t[e]||t.system}`,children:e})}function HV({bankId:e}){let[t,n]=(0,em.useState)("7d"),[r,i]=(0,em.useState)(null),[a,o]=(0,em.useState)([]),[s,l]=(0,em.useState)("day"),[c,u]=(0,em.useState)(!1),d=(0,em.useCallback)(async(n=t,i=r)=>{u(!0);try{let t=await eP.client.getAuditLogStats(e,{period:n,action:i||void 0});o(t.buckets||[]),l(t.trunc||"day")}catch(e){console.error("Error loading audit stats:",e)}finally{u(!1)}},[e,t,r]);(0,em.useEffect)(()=>{d()},[e]);let h=a.map(e=>{var t;let n;return{time:(t=e.time,n=new Date(t),"hour"===s?n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):n.toLocaleDateString(void 0,{month:"short",day:"numeric"})),total:e.total}});return(0,ep.jsxs)(m8.Card,{children:[(0,ep.jsxs)(m8.CardHeader,{className:"pb-2 flex flex-row items-center justify-between space-y-0 gap-3",children:[(0,ep.jsx)(m8.CardTitle,{className:"text-sm font-semibold",children:"Request Volume"}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(tI.Select,{value:r||"all",onValueChange:e=>{let n="all"===e?null:e;i(n),d(t,n)},children:[(0,ep.jsx)(tI.SelectTrigger,{className:"w-[160px] h-8 text-xs",children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsx)(tI.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:HL.map(e=>(0,ep.jsx)(tI.SelectItem,{value:e.value,children:e.label},e.value))})]}),HR.map(e=>(0,ep.jsx)(eD.Button,{variant:t===e.value?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{n(e.value),d(e.value,r)},children:e.label},e.value))]})]}),(0,ep.jsx)(m8.CardContent,{children:(0,ep.jsx)("div",{className:"h-[120px]",children:c?(0,ep.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading..."}):0===h.length?(0,ep.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"No data for this period"}):(0,ep.jsx)(_N,{width:"100%",height:"100%",children:(0,ep.jsxs)(UM,{data:h,margin:{top:5,right:5,bottom:0,left:5},children:[(0,ep.jsx)(FR,{dataKey:"time",tick:{fontSize:10},axisLine:!1,tickLine:!1,className:"text-muted-foreground"}),(0,ep.jsx)(VA,{contentStyle:{backgroundColor:"var(--popover)",border:"1px solid var(--border)",borderRadius:"6px",fontSize:"12px",padding:"4px 8px"}}),(0,ep.jsx)(HD,{type:"monotone",dataKey:"total",stroke:"var(--primary)",strokeWidth:2,dot:!1,activeDot:{r:3}})]})})})})]})}function HU(){let{currentBank:e}=(0,ey.useBank)(),[t,n]=(0,em.useState)([]),[r,i]=(0,em.useState)(0),[a,o]=(0,em.useState)(null),[s,l]=(0,em.useState)(null),[c,u]=(0,em.useState)("all"),[d]=(0,em.useState)(20),[h,f]=(0,em.useState)(0),[p,g]=(0,em.useState)(!1),[v,x]=(0,em.useState)(null),[y,b]=(0,em.useState)(!1),w=(0,em.useCallback)(e=>{if("all"===e)return{};let t=new Date,n=new Date;return"1h"===e?n.setHours(t.getHours()-1):"1d"===e?n.setDate(t.getDate()-1):"7d"===e?n.setDate(t.getDate()-7):"30d"===e&&n.setDate(t.getDate()-30),{start_date:n.toISOString()}},[]),j=(0,em.useCallback)(async(t=a,r=s,o=c,l=h)=>{if(e){g(!0);try{let a=w(o),s=await eP.client.listAuditLogs(e,{action:t||void 0,transport:r||void 0,start_date:a.start_date,end_date:a.end_date,limit:d,offset:l});n(s.items||[]),i(s.total||0)}catch(e){console.error("Error loading audit logs:",e)}finally{g(!1)}}},[e,a,s,c,h,d,w]),N=e=>{f(e),j(a,s,c,e)};(0,em.useEffect)(()=>{e&&j(a,s,c,h)},[e]);let k=Math.ceil(r/d),C=Math.floor(h/d)+1;return e?(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(HV,{bankId:e}),(0,ep.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,ep.jsxs)(tI.Select,{value:a||"all",onValueChange:e=>{let t="all"===e?null:e;o(t),f(0),j(t,s,c,0)},children:[(0,ep.jsx)(tI.SelectTrigger,{className:"w-[180px]",children:(0,ep.jsx)(tI.SelectValue,{placeholder:"All actions"})}),(0,ep.jsx)(tI.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:HL.map(e=>(0,ep.jsx)(tI.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(tI.Select,{value:s||"all",onValueChange:e=>{let t="all"===e?null:e;l(t),f(0),j(a,t,c,0)},children:[(0,ep.jsx)(tI.SelectTrigger,{className:"w-[160px]",children:(0,ep.jsx)(tI.SelectValue,{placeholder:"All transports"})}),(0,ep.jsx)(tI.SelectContent,{position:"popper",className:"max-h-[300px] overflow-y-auto",children:HI.map(e=>(0,ep.jsx)(tI.SelectItem,{value:e.value,children:e.label},e.value))})]}),(0,ep.jsxs)(tI.Select,{value:c,onValueChange:e=>{u(e),f(0),j(a,s,e,0)},children:[(0,ep.jsx)(tI.SelectTrigger,{className:"w-[150px]",children:(0,ep.jsx)(tI.SelectValue,{})}),(0,ep.jsxs)(tI.SelectContent,{position:"popper",children:[(0,ep.jsx)(tI.SelectItem,{value:"all",children:"All time"}),(0,ep.jsx)(tI.SelectItem,{value:"1h",children:"Last hour"}),(0,ep.jsx)(tI.SelectItem,{value:"1d",children:"Last 24 hours"}),(0,ep.jsx)(tI.SelectItem,{value:"7d",children:"Last 7 days"}),(0,ep.jsx)(tI.SelectItem,{value:"30d",children:"Last 30 days"})]})]}),(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",onClick:()=>j(a,s,c,h),disabled:p,children:[(0,ep.jsx)(eH,{className:`w-4 h-4 mr-1 ${p?"animate-spin":""}`}),"Refresh"]}),(0,ep.jsxs)("span",{className:"text-sm text-muted-foreground ml-auto",children:[r," ",1===r?"entry":"entries"]})]}),(0,ep.jsxs)(eX,{children:[(0,ep.jsx)(eq,{children:(0,ep.jsxs)(eZ,{children:[(0,ep.jsx)(eQ,{className:"w-[200px]",children:"Time"}),(0,ep.jsx)(eQ,{children:"Action"}),(0,ep.jsx)(eQ,{className:"w-[100px]",children:"Transport"}),(0,ep.jsx)(eQ,{className:"w-[100px]",children:"Duration"})]})}),(0,ep.jsx)(eK,{children:0===t.length?(0,ep.jsx)(eZ,{children:(0,ep.jsx)(eJ,{colSpan:4,className:"text-center text-muted-foreground py-8",children:p?"Loading...":"No audit logs found"})}):t.map(e=>(0,ep.jsxs)(eZ,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>{x(e),b(!0)},children:[(0,ep.jsx)(eJ,{className:"text-sm font-mono",children:Hz(e.started_at)}),(0,ep.jsx)(eJ,{className:"font-medium",children:e.action}),(0,ep.jsx)(eJ,{children:(0,ep.jsx)(HF,{transport:e.transport})}),(0,ep.jsx)(eJ,{className:"text-sm text-muted-foreground font-mono",children:HB(e.started_at,e.ended_at)})]},e.id))})]}),k>1&&(0,ep.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ep.jsxs)("span",{className:"text-sm text-muted-foreground",children:["Page ",C," of ",k]}),(0,ep.jsxs)("div",{className:"flex gap-2",children:[(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",onClick:()=>N(Math.max(0,h-d)),disabled:0===h,children:[(0,ep.jsx)(e_,{className:"w-4 h-4 mr-1"}),"Previous"]}),(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",onClick:()=>N(h+d),disabled:h+d>=r,children:["Next",(0,ep.jsx)(eS.ChevronRight,{className:"w-4 h-4 ml-1"})]})]})]}),(0,ep.jsx)(tW.Dialog,{open:y,onOpenChange:b,children:(0,ep.jsxs)(tW.DialogContent,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,ep.jsx)(tW.DialogHeader,{children:(0,ep.jsxs)(tW.DialogTitle,{children:["Audit Log: ",v?.action]})}),v&&(0,ep.jsxs)("div",{className:"space-y-4",children:[(0,ep.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Action:"})," ",(0,ep.jsx)("span",{className:"font-medium",children:v.action})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Transport:"})," ",(0,ep.jsx)(HF,{transport:v.transport})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Started:"})," ",(0,ep.jsx)("span",{className:"font-mono",children:Hz(v.started_at)})]}),(0,ep.jsxs)("div",{children:[(0,ep.jsx)("span",{className:"text-muted-foreground",children:"Duration:"})," ",(0,ep.jsx)("span",{className:"font-mono",children:HB(v.started_at,v.ended_at)})]})]}),v.request&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Request"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto max-h-[200px] overflow-y-auto",children:JSON.stringify(v.request,null,2)})]}),v.response&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Response"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto max-h-[200px] overflow-y-auto",children:JSON.stringify(v.response,null,2)})]}),v.metadata&&Object.keys(v.metadata).length>0&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h4",{className:"text-sm font-semibold mb-2",children:"Metadata"}),(0,ep.jsx)("pre",{className:"bg-muted p-3 rounded-md text-xs overflow-x-auto",children:JSON.stringify(v.metadata,null,2)})]})]})]})})]}):null}let HH=(0,ej.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var tU=tU;e.s(["default",0,function(){(0,eg.useParams)();let e=(0,eg.useRouter)(),t=(0,eg.useSearchParams)(),{features:n}=(0,jr.useFeatures)(),{currentBank:r,setCurrentBank:i,loadBanks:a}=(0,ey.useBank)(),o=t.get("view")||"profile",s=t.get("subTab")||"world",l=t.get("bankConfigTab")||"general",c=n?.observations??!1,u=n?.bank_config_api??!1,[d,h]=(0,em.useState)(!1),[f,p]=(0,em.useState)(!1),[g,v]=(0,em.useState)(!1),[x,y]=(0,em.useState)(!1),[b,w]=(0,em.useState)(!1),[j,N]=(0,em.useState)(!1),[k,C]=(0,em.useState)(!1),[E,_]=(0,em.useState)(!1),S=t=>{r&&e.push((0,eb.bankRoute)(r,`?view=data&subTab=${t}`))},T=t=>{r&&e.push((0,eb.bankRoute)(r,`?view=profile&bankConfigTab=${t}`))},A=async()=>{if(r){p(!0);try{await eP.client.deleteBank(r),h(!1),i(null),await a(),e.push("/")}catch(e){}finally{p(!1)}}},O=async()=>{if(r){y(!0);try{let e=await eP.client.clearObservations(r);v(!1),ev.toast.success("Success",{description:e.message||"Observations cleared successfully"})}catch(e){}finally{y(!1)}}},M=async()=>{if(r){_(!0);try{await eP.client.resetBankConfig(r),C(!1)}catch{}finally{_(!1)}}},P=async()=>{if(r){w(!0);try{await eP.client.triggerConsolidation(r)}catch(e){}finally{w(!1)}}},D=async()=>{if(r){N(!0);try{let e=await eP.client.recoverConsolidation(r);ev.toast.success(`Recovered ${e.retried_count} failed ${1===e.retried_count?"memory":"memories"} for re-consolidation`)}catch(e){}finally{N(!1)}}};return(0,ep.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,ep.jsx)(ex.BankSelector,{}),(0,ep.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,ep.jsx)(eM,{currentTab:o,onTabChange:t=>{r&&e.push((0,eb.bankRoute)(r,`?view=${t}`))}}),(0,ep.jsx)("main",{className:"flex-1 overflow-y-auto",children:(0,ep.jsxs)("div",{className:"p-6",children:["profile"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsxs)("div",{className:"flex justify-between items-start mb-6",children:[(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Bank Configuration"}),(0,ep.jsx)("p",{className:"text-muted-foreground",children:"Manage bank settings, profile, and operations."})]}),(0,ep.jsxs)(p2,{children:[(0,ep.jsx)(p3,{asChild:!0,children:(0,ep.jsxs)(eD.Button,{variant:"outline",size:"sm",children:["Actions",(0,ep.jsx)(mU,{className:"w-4 h-4 ml-2"})]})}),(0,ep.jsxs)(ms,{align:"end",className:"w-48",children:[(0,ep.jsxs)(ml,{onClick:async()=>{if(r)try{let e=await eP.client.exportBankTemplate(r),t=JSON.stringify(e,null,2);await navigator.clipboard.writeText(t),ev.toast.success("Template copied to clipboard")}catch{ev.toast.error("Failed to export template")}},children:[(0,ep.jsx)(HH,{className:"w-4 h-4 mr-2"}),"Export Template"]}),(0,ep.jsx)(mc,{}),(0,ep.jsxs)(ml,{onClick:P,disabled:b||!c,title:c?void 0:"Observations feature is not enabled",children:[b?(0,ep.jsx)(tU.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(m9,{className:"w-4 h-4 mr-2"}),b?"Consolidating...":"Run Consolidation",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsxs)(ml,{onClick:D,disabled:j||!c,title:c?void 0:"Observations feature is not enabled",children:[j?(0,ep.jsx)(tU.default,{className:"w-4 h-4 mr-2 animate-spin"}):(0,ep.jsx)(Uh,{className:"w-4 h-4 mr-2"}),j?"Recovering...":"Recover Consolidation",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsxs)(ml,{onClick:()=>v(!0),disabled:!c,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:c?void 0:"Observations feature is not enabled",children:[(0,ep.jsx)(mF,{className:"w-4 h-4 mr-2"}),"Clear Observations",!c&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsx)(mc,{}),(0,ep.jsxs)(ml,{onClick:()=>C(!0),disabled:!u,className:"text-amber-600 dark:text-amber-400 focus:text-amber-700 dark:focus:text-amber-300",title:u?void 0:"Bank Config API is disabled",children:[(0,ep.jsx)(Uh,{className:"w-4 h-4 mr-2"}),"Reset Configuration",!u&&(0,ep.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:"Off"})]}),(0,ep.jsx)(mc,{}),(0,ep.jsxs)(ml,{onClick:()=>h(!0),className:"text-red-600 dark:text-red-400 focus:text-red-700 dark:focus:text-red-300",children:[(0,ep.jsx)(mF,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})]})]})]}),(0,ep.jsx)("div",{className:"mb-6 border-b border-border",children:(0,ep.jsxs)("div",{className:"flex gap-1",children:[(0,ep.jsxs)("button",{onClick:()=>T("general"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"general"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["General","general"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),u&&(0,ep.jsxs)("button",{onClick:()=>T("configuration"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"configuration"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Configuration","configuration"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>T("webhooks"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"webhooks"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Webhooks","webhooks"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>T("audit-logs"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"audit-logs"===l?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Audit Logs","audit-logs"===l&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,ep.jsxs)("div",{children:["general"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Overview statistics and background operations for this memory bank."}),(0,ep.jsxs)("div",{className:"space-y-6",children:[(0,ep.jsx)(Ud,{}),(0,ep.jsx)(Ug,{}),(0,ep.jsx)(js,{hideReflectFields:!0})]})]}),"configuration"===l&&u&&(0,ep.jsx)("div",{className:"space-y-6",children:(0,ep.jsx)(jS,{})}),"webhooks"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Manage webhook endpoints to receive event notifications from this memory bank."}),(0,ep.jsx)(UA,{})]}),"audit-logs"===l&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"View audit trail of all operations performed on this memory bank."}),(0,ep.jsx)(HU,{})]})]})]}),"recall"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Recall"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Analyze memory recall with detailed trace information and retrieval methods."}),(0,ep.jsx)(jn,{})]}),"reflect"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Reflect"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Run an agentic loop that autonomously gathers evidence and reasons through the lens of the bank's disposition to generate contextual responses."}),(0,ep.jsx)(je,{})]}),"data"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Memories"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"View and explore different types of memories stored in this memory bank."}),(0,ep.jsx)("div",{className:"mb-6 border-b border-border",children:(0,ep.jsxs)("div",{className:"flex gap-1",children:[(0,ep.jsxs)("button",{onClick:()=>S("world"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"world"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["World Facts","world"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("experience"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"experience"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Experience","experience"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("observations"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"observations"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Observations",!c&&(0,ep.jsx)("span",{className:"ml-2 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"Off"}),"observations"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,ep.jsxs)("button",{onClick:()=>S("mental-models"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"mental-models"===s?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Mental Models","mental-models"===s&&(0,ep.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,ep.jsxs)("div",{children:["world"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Objective facts about the world received from external sources."}),(0,ep.jsx)(fz,{factType:"world"},"world")]}),"experience"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"The bank's own actions, interactions, and first-person experiences."}),(0,ep.jsx)(fz,{factType:"experience"},"experience")]}),"observations"===s&&(c?(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Consolidated knowledge synthesized from facts — patterns, preferences, and learnings that emerge from accumulated evidence."}),(0,ep.jsx)(fz,{factType:"observation"},"observations")]}):(0,ep.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,ep.jsx)("div",{className:"text-muted-foreground mb-2",children:(0,ep.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,ep.jsx)("path",{d:"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2Z"}),(0,ep.jsx)("path",{d:"M12 8v4"}),(0,ep.jsx)("path",{d:"M12 16h.01"})]})}),(0,ep.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-1",children:"Observations Not Enabled"}),(0,ep.jsxs)("p",{className:"text-sm text-muted-foreground max-w-md",children:["Observations consolidation is disabled on this server. Set"," ",(0,ep.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-xs",children:"HINDSIGHT_API_ENABLE_OBSERVATIONS=true"})," ","to enable."]})]})),"mental-models"===s&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"User-curated summaries generated from queries — reusable knowledge snapshots that can be refreshed as memories evolve."}),(0,ep.jsx)(Ux,{},"mental-models")]})]})]}),"documents"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Documents"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Manage documents and retain new memories."}),(0,ep.jsx)(mJ,{})]}),"entities"===o&&(0,ep.jsxs)("div",{children:[(0,ep.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Entities"}),(0,ep.jsx)("p",{className:"text-muted-foreground mb-6",children:"Explore entities (people, organizations, places) mentioned in memories."}),(0,ep.jsx)(m0,{})]})]})})]}),(0,ep.jsx)(mg,{open:d,onOpenChange:h,children:(0,ep.jsxs)(mP,{children:[(0,ep.jsxs)(mD,{children:[(0,ep.jsx)(mI,{children:"Delete Memory Bank"}),(0,ep.jsx)(mR,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to delete the memory bank"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-red-600 dark:text-red-400 font-medium",children:"This action cannot be undone. All memories, entities, documents, and the bank profile will be permanently deleted."})]})})]}),(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mz,{disabled:f,children:"Cancel"}),(0,ep.jsx)(mB,{onClick:A,disabled:f,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:f?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tU.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Deleting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mF,{className:"w-4 h-4 mr-2"}),"Delete Bank"]})})]})]})}),(0,ep.jsx)(mg,{open:k,onOpenChange:C,children:(0,ep.jsxs)(mP,{children:[(0,ep.jsxs)(mD,{children:[(0,ep.jsx)(mI,{children:"Reset Configuration"}),(0,ep.jsx)(mR,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to reset all configuration overrides for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"All per-bank settings (retain, observations, reflect) will revert to server defaults. This does not affect memories, entities, or the bank profile."})]})})]}),(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mz,{disabled:E,children:"Cancel"}),(0,ep.jsx)(mB,{onClick:M,disabled:E,children:E?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tU.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Resetting..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(Uh,{className:"w-4 h-4 mr-2"}),"Reset Configuration"]})})]})]})}),(0,ep.jsx)(mg,{open:g,onOpenChange:v,children:(0,ep.jsxs)(mP,{children:[(0,ep.jsxs)(mD,{children:[(0,ep.jsx)(mI,{children:"Clear Observations"}),(0,ep.jsx)(mR,{asChild:!0,children:(0,ep.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,ep.jsxs)("p",{children:["Are you sure you want to clear all observations for"," ",(0,ep.jsx)("span",{className:"font-semibold text-foreground",children:r}),"?"]}),(0,ep.jsx)("p",{className:"text-amber-600 dark:text-amber-400 font-medium",children:"This will delete all consolidated knowledge. Observations will be regenerated the next time consolidation runs."})]})})]}),(0,ep.jsxs)(mL,{children:[(0,ep.jsx)(mz,{disabled:x,children:"Cancel"}),(0,ep.jsx)(mB,{onClick:O,disabled:x,className:"bg-amber-500 text-white hover:bg-amber-600",children:x?(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(tU.default,{className:"w-4 h-4 mr-2 animate-spin"}),"Clearing..."]}):(0,ep.jsxs)(ep.Fragment,{children:[(0,ep.jsx)(mF,{className:"w-4 h-4 mr-2"}),"Clear Observations"]})})]})]})})]})}],37578)}]);