@vectorize-io/hindsight-control-plane 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +86 -0
- package/package.json +69 -0
- package/public/favicon.png +0 -0
- package/public/logo.png +0 -0
- package/standalone/.next/BUILD_ID +1 -0
- package/standalone/.next/app-path-routes-manifest.json +24 -0
- package/standalone/.next/build-manifest.json +21 -0
- package/standalone/.next/package.json +1 -0
- package/standalone/.next/prerender-manifest.json +113 -0
- package/standalone/.next/required-server-files.json +317 -0
- package/standalone/.next/routes-manifest.json +193 -0
- package/standalone/.next/server/app/_global-error/page/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/_global-error/page/build-manifest.json +18 -0
- package/standalone/.next/server/app/_global-error/page/next-font-manifest.json +6 -0
- package/standalone/.next/server/app/_global-error/page/react-loadable-manifest.json +1 -0
- package/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/_global-error/page.js +10 -0
- package/standalone/.next/server/app/_global-error/page.js.map +5 -0
- package/standalone/.next/server/app/_global-error/page.js.nft.json +1 -0
- package/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/_global-error.html +2 -0
- package/standalone/.next/server/app/_global-error.meta +15 -0
- package/standalone/.next/server/app/_global-error.rsc +12 -0
- package/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +5 -0
- package/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +12 -0
- package/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +7 -0
- package/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +4 -0
- package/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
- package/standalone/.next/server/app/_not-found/page/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/_not-found/page/build-manifest.json +18 -0
- package/standalone/.next/server/app/_not-found/page/next-font-manifest.json +6 -0
- package/standalone/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -0
- package/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/_not-found/page.js +13 -0
- package/standalone/.next/server/app/_not-found/page.js.map +5 -0
- package/standalone/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/_not-found.html +1 -0
- package/standalone/.next/server/app/_not-found.meta +16 -0
- package/standalone/.next/server/app/_not-found.rsc +16 -0
- package/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +16 -0
- package/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +8 -0
- package/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +7 -0
- package/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
- package/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +4 -0
- package/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -0
- package/standalone/.next/server/app/api/banks/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/banks/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/banks/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/banks/route.js +6 -0
- package/standalone/.next/server/app/api/banks/route.js.map +5 -0
- package/standalone/.next/server/app/api/banks/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/banks/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/chunks/[chunkId]/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/chunks/[chunkId]/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/chunks/[chunkId]/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/chunks/[chunkId]/route.js +6 -0
- package/standalone/.next/server/app/api/chunks/[chunkId]/route.js.map +5 -0
- package/standalone/.next/server/app/api/chunks/[chunkId]/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/chunks/[chunkId]/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/documents/[documentId]/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/documents/[documentId]/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/documents/[documentId]/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/documents/[documentId]/route.js +6 -0
- package/standalone/.next/server/app/api/documents/[documentId]/route.js.map +5 -0
- package/standalone/.next/server/app/api/documents/[documentId]/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/documents/[documentId]/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/documents/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/documents/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/documents/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/documents/route.js +6 -0
- package/standalone/.next/server/app/api/documents/route.js.map +5 -0
- package/standalone/.next/server/app/api/documents/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/documents/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/entities/[entityId]/regenerate/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/entities/[entityId]/regenerate/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/entities/[entityId]/regenerate/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/entities/[entityId]/regenerate/route.js +6 -0
- package/standalone/.next/server/app/api/entities/[entityId]/regenerate/route.js.map +5 -0
- package/standalone/.next/server/app/api/entities/[entityId]/regenerate/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/entities/[entityId]/regenerate/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/entities/[entityId]/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/entities/[entityId]/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/entities/[entityId]/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/entities/[entityId]/route.js +6 -0
- package/standalone/.next/server/app/api/entities/[entityId]/route.js.map +5 -0
- package/standalone/.next/server/app/api/entities/[entityId]/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/entities/[entityId]/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/entities/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/entities/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/entities/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/entities/route.js +6 -0
- package/standalone/.next/server/app/api/entities/route.js.map +5 -0
- package/standalone/.next/server/app/api/entities/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/entities/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/graph/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/graph/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/graph/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/graph/route.js +6 -0
- package/standalone/.next/server/app/api/graph/route.js.map +5 -0
- package/standalone/.next/server/app/api/graph/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/graph/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/health/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/health/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/health/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/health/route.js +6 -0
- package/standalone/.next/server/app/api/health/route.js.map +5 -0
- package/standalone/.next/server/app/api/health/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/health/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/list/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/list/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/list/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/list/route.js +6 -0
- package/standalone/.next/server/app/api/list/route.js.map +5 -0
- package/standalone/.next/server/app/api/list/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/list/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/memories/retain/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/memories/retain/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/memories/retain/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/memories/retain/route.js +6 -0
- package/standalone/.next/server/app/api/memories/retain/route.js.map +5 -0
- package/standalone/.next/server/app/api/memories/retain/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/memories/retain/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/memories/retain_async/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/memories/retain_async/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/memories/retain_async/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/memories/retain_async/route.js +6 -0
- package/standalone/.next/server/app/api/memories/retain_async/route.js.map +5 -0
- package/standalone/.next/server/app/api/memories/retain_async/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/memories/retain_async/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/operations/[agentId]/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/operations/[agentId]/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/operations/[agentId]/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/operations/[agentId]/route.js +6 -0
- package/standalone/.next/server/app/api/operations/[agentId]/route.js.map +5 -0
- package/standalone/.next/server/app/api/operations/[agentId]/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/operations/[agentId]/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/profile/[bankId]/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/profile/[bankId]/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/profile/[bankId]/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/profile/[bankId]/route.js +6 -0
- package/standalone/.next/server/app/api/profile/[bankId]/route.js.map +5 -0
- package/standalone/.next/server/app/api/profile/[bankId]/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/profile/[bankId]/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/recall/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/recall/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/recall/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/recall/route.js +6 -0
- package/standalone/.next/server/app/api/recall/route.js.map +5 -0
- package/standalone/.next/server/app/api/recall/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/recall/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/reflect/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/reflect/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/reflect/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/reflect/route.js +6 -0
- package/standalone/.next/server/app/api/reflect/route.js.map +5 -0
- package/standalone/.next/server/app/api/reflect/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/reflect/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/api/stats/[agentId]/route/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/api/stats/[agentId]/route/build-manifest.json +11 -0
- package/standalone/.next/server/app/api/stats/[agentId]/route/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/api/stats/[agentId]/route.js +6 -0
- package/standalone/.next/server/app/api/stats/[agentId]/route.js.map +5 -0
- package/standalone/.next/server/app/api/stats/[agentId]/route.js.nft.json +1 -0
- package/standalone/.next/server/app/api/stats/[agentId]/route_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/banks/[bankId]/page/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/banks/[bankId]/page/build-manifest.json +18 -0
- package/standalone/.next/server/app/banks/[bankId]/page/next-font-manifest.json +6 -0
- package/standalone/.next/server/app/banks/[bankId]/page/react-loadable-manifest.json +1 -0
- package/standalone/.next/server/app/banks/[bankId]/page/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/banks/[bankId]/page.js +15 -0
- package/standalone/.next/server/app/banks/[bankId]/page.js.map +5 -0
- package/standalone/.next/server/app/banks/[bankId]/page.js.nft.json +1 -0
- package/standalone/.next/server/app/banks/[bankId]/page_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/dashboard/page/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/dashboard/page/build-manifest.json +18 -0
- package/standalone/.next/server/app/dashboard/page/next-font-manifest.json +6 -0
- package/standalone/.next/server/app/dashboard/page/react-loadable-manifest.json +1 -0
- package/standalone/.next/server/app/dashboard/page/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/dashboard/page.js +15 -0
- package/standalone/.next/server/app/dashboard/page.js.map +5 -0
- package/standalone/.next/server/app/dashboard/page.js.nft.json +1 -0
- package/standalone/.next/server/app/dashboard/page_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app/dashboard.html +1 -0
- package/standalone/.next/server/app/dashboard.meta +15 -0
- package/standalone/.next/server/app/dashboard.rsc +20 -0
- package/standalone/.next/server/app/dashboard.segments/_full.segment.rsc +20 -0
- package/standalone/.next/server/app/dashboard.segments/_head.segment.rsc +8 -0
- package/standalone/.next/server/app/dashboard.segments/_index.segment.rsc +7 -0
- package/standalone/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -0
- package/standalone/.next/server/app/dashboard.segments/dashboard/__PAGE__.segment.rsc +9 -0
- package/standalone/.next/server/app/dashboard.segments/dashboard.segment.rsc +4 -0
- package/standalone/.next/server/app/index.html +1 -0
- package/standalone/.next/server/app/index.meta +16 -0
- package/standalone/.next/server/app/index.rsc +17 -0
- package/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +6 -0
- package/standalone/.next/server/app/index.segments/_full.segment.rsc +17 -0
- package/standalone/.next/server/app/index.segments/_head.segment.rsc +8 -0
- package/standalone/.next/server/app/index.segments/_index.segment.rsc +7 -0
- package/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -0
- package/standalone/.next/server/app/page/app-paths-manifest.json +3 -0
- package/standalone/.next/server/app/page/build-manifest.json +18 -0
- package/standalone/.next/server/app/page/next-font-manifest.json +6 -0
- package/standalone/.next/server/app/page/react-loadable-manifest.json +1 -0
- package/standalone/.next/server/app/page/server-reference-manifest.json +4 -0
- package/standalone/.next/server/app/page.js +16 -0
- package/standalone/.next/server/app/page.js.map +5 -0
- package/standalone/.next/server/app/page.js.nft.json +1 -0
- package/standalone/.next/server/app/page_client-reference-manifest.js +2 -0
- package/standalone/.next/server/app-paths-manifest.json +24 -0
- package/standalone/.next/server/chunks/4ca55_ndsight-control-plane__next-internal_server_app_api_banks_route_actions_99be6b43.js +3 -0
- package/standalone/.next/server/chunks/4ca55_ndsight-control-plane__next-internal_server_app_api_graph_route_actions_01c8a147.js +3 -0
- package/standalone/.next/server/chunks/5512b_dsight-control-plane__next-internal_server_app_api_health_route_actions_9dd1d809.js +3 -0
- package/standalone/.next/server/chunks/5512b_dsight-control-plane__next-internal_server_app_api_recall_route_actions_154c90a0.js +3 -0
- package/standalone/.next/server/chunks/79729_indsight-control-plane__next-internal_server_app_api_list_route_actions_928a8078.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__02a1e7f7._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__0f1b189c._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__228c769f._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__317b54d0._.js +21 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__464d3847._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__5e1d146d._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__6ee44ea3._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__73093267._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__81c0d784._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__9a7529ab._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__9c3dd746._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__bae0f53c._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__be9afc00._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__d2485edb._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__d4b39930._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__d4f9d631._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__e5a6b81d._.js +3 -0
- package/standalone/.next/server/chunks/[root-of-the-server]__f318615b._.js +3 -0
- package/standalone/.next/server/chunks/[turbopack]_runtime.js +770 -0
- package/standalone/.next/server/chunks/a6ea4_server_app_api_entities_[entityId]_regenerate_route_actions_3253250f.js +3 -0
- package/standalone/.next/server/chunks/e51bf__next-internal_server_app_api_chunks_[chunkId]_route_actions_03be08f6.js +3 -0
- package/standalone/.next/server/chunks/e51bf__next-internal_server_app_api_documents_[documentId]_route_actions_025f2dd6.js +3 -0
- package/standalone/.next/server/chunks/e51bf__next-internal_server_app_api_documents_route_actions_fca16a88.js +3 -0
- package/standalone/.next/server/chunks/e51bf__next-internal_server_app_api_entities_[entityId]_route_actions_c338d0cd.js +3 -0
- package/standalone/.next/server/chunks/e51bf__next-internal_server_app_api_entities_route_actions_f5ea1ca0.js +3 -0
- package/standalone/.next/server/chunks/e51bf__next-internal_server_app_api_memories_retain_async_route_actions_c08bfcdb.js +3 -0
- package/standalone/.next/server/chunks/e51bf__next-internal_server_app_api_memories_retain_route_actions_d10f6a07.js +3 -0
- package/standalone/.next/server/chunks/e51bf__next-internal_server_app_api_operations_[agentId]_route_actions_1f7c4bc6.js +3 -0
- package/standalone/.next/server/chunks/e51bf__next-internal_server_app_api_profile_[bankId]_route_actions_22dd8677.js +3 -0
- package/standalone/.next/server/chunks/e51bf__next-internal_server_app_api_reflect_route_actions_0b8dd978.js +3 -0
- package/standalone/.next/server/chunks/e51bf__next-internal_server_app_api_stats_[agentId]_route_actions_17816f15.js +3 -0
- package/standalone/.next/server/chunks/ssr/4ca55_ndsight-control-plane__next-internal_server_app__not-found_page_actions_a6d92cb7.js +3 -0
- package/standalone/.next/server/chunks/ssr/79729_indsight-control-plane__next-internal_server_app_dashboard_page_actions_aff4b92b.js +3 -0
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__2454dfbf._.js +3 -0
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__3f6f18bb._.js +3 -0
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__6199c710._.js +3 -0
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__655f8d11._.js +6 -0
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__8dd83d7a._.js +3 -0
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__915ad491._.js +3 -0
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__b9356576._.js +4 -0
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__bce2f57e._.js +3 -0
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__d88eb440._.js +3 -0
- package/standalone/.next/server/chunks/ssr/[root-of-the-server]__e93b5ed6._.js +3 -0
- package/standalone/.next/server/chunks/ssr/[turbopack]_runtime.js +770 -0
- package/standalone/.next/server/chunks/ssr/_26df66d0._.js +4 -0
- package/standalone/.next/server/chunks/ssr/_3476210c._.js +6 -0
- package/standalone/.next/server/chunks/ssr/_453ded79._.js +3 -0
- package/standalone/.next/server/chunks/ssr/_53a4aa41._.js +4 -0
- package/standalone/.next/server/chunks/ssr/_5e906836._.js +9 -0
- package/standalone/.next/server/chunks/ssr/_8362f37b._.js +6 -0
- package/standalone/.next/server/chunks/ssr/_944e56a6._.js +4 -0
- package/standalone/.next/server/chunks/ssr/_ad0e821a._.js +3 -0
- package/standalone/.next/server/chunks/ssr/e51bf__next-internal_server_app__global-error_page_actions_1e722cdc.js +3 -0
- package/standalone/.next/server/chunks/ssr/e51bf__next-internal_server_app_banks_[bankId]_page_actions_7613b8e1.js +3 -0
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane__next-internal_server_app_page_actions_5b200f30.js +3 -0
- package/standalone/.next/server/chunks/ssr/hindsight-control-plane_src_fe96d618._.js +3 -0
- package/standalone/.next/server/chunks/ssr/node_modules_5363a9de._.js +3 -0
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_08570d7f._.js +4 -0
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_cc88faaa._.js +3 -0
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_9774470f._.js +3 -0
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_forbidden_45780354.js +3 -0
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_global-error_ece394eb.js +3 -0
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_client_components_builtin_unauthorized_15817684.js +3 -0
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_3fe9760a._.js +6 -0
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_89742413.js +4 -0
- package/standalone/.next/server/chunks/ssr/node_modules_next_dist_server_route-modules_app-page_vendored_ssr_8ca85a16._.js +3 -0
- package/standalone/.next/server/functions-config-manifest.json +4 -0
- package/standalone/.next/server/middleware-build-manifest.js +22 -0
- package/standalone/.next/server/middleware-manifest.json +6 -0
- package/standalone/.next/server/next-font-manifest.js +1 -0
- package/standalone/.next/server/next-font-manifest.json +6 -0
- package/standalone/.next/server/pages/404.html +1 -0
- package/standalone/.next/server/pages/500.html +2 -0
- package/standalone/.next/server/pages-manifest.json +4 -0
- package/standalone/.next/server/server-reference-manifest.js +1 -0
- package/standalone/.next/server/server-reference-manifest.json +5 -0
- package/standalone/.next/static/chunks/023d923a37d494fc.js +1 -0
- package/standalone/.next/static/chunks/066a685143de5f7e.js +7 -0
- package/standalone/.next/static/chunks/0e1b9f3295e06ab1.js +1 -0
- package/standalone/.next/static/chunks/247eb132b7f7b574.js +1 -0
- package/standalone/.next/static/chunks/497f7b5edc7d3fce.js +1 -0
- package/standalone/.next/static/chunks/4a2e6ca9bc162ffe.js +4 -0
- package/standalone/.next/static/chunks/5d98431bbd7c934d.js +1 -0
- package/standalone/.next/static/chunks/8edb6029308e90e6.css +1 -0
- package/standalone/.next/static/chunks/9ab4ce518df78558.css +2 -0
- package/standalone/.next/static/chunks/a6dad97d9634a72d.js +1 -0
- package/standalone/.next/static/chunks/b6f4e02e299e89ec.js +1 -0
- package/standalone/.next/static/chunks/b93cf0798d24e38a.js +1 -0
- package/standalone/.next/static/chunks/bc4b7a284f8824f8.js +1 -0
- package/standalone/.next/static/chunks/d0cdc56d06040c69.js +2 -0
- package/standalone/.next/static/chunks/ff1a16fafef87110.js +1 -0
- package/standalone/.next/static/chunks/turbopack-030018f439265ea0.js +3 -0
- package/standalone/.next/static/sW64pgiMutF_hND5cO6Oe/_buildManifest.js +11 -0
- package/standalone/.next/static/sW64pgiMutF_hND5cO6Oe/_clientMiddlewareManifest.json +1 -0
- package/standalone/.next/static/sW64pgiMutF_hND5cO6Oe/_ssgManifest.js +1 -0
- package/standalone/package.json +69 -0
- package/standalone/public/favicon.png +0 -0
- package/standalone/public/logo.png +0 -0
- package/standalone/server.js +38 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,98183,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={assign:function(){return l},searchParamsToUrlQuery:function(){return i},urlQueryToSearchParams:function(){return s}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});function i(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function o(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function s(e){let t=new URLSearchParams;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let e of n)t.append(r,o(e));else t.set(r,o(n));return t}function l(e,...t){for(let r of t){for(let t of r.keys())e.delete(t);for(let[t,n]of r.entries())e.append(t,n)}return e}},95057,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={formatUrl:function(){return s},formatWithValidation:function(){return u},urlObjectKeys:function(){return l}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let i=e.r(90809)._(e.r(98183)),o=/https?|ftp|gopher|file/;function s(e){let{auth:t,hostname:r}=e,n=e.protocol||"",a=e.pathname||"",s=e.hash||"",l=e.query||"",u=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?u=t+e.host:r&&(u=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(u+=":"+e.port)),l&&"object"==typeof l&&(l=String(i.urlQueryToSearchParams(l)));let c=e.search||l&&`?${l}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||o.test(n))&&!1!==u?(u="//"+(u||""),a&&"/"!==a[0]&&(a="/"+a)):u||(u=""),s&&"#"!==s[0]&&(s="#"+s),c&&"?"!==c[0]&&(c="?"+c),a=a.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${n}${u}${a}${c}${s}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function u(e){return s(e)}},18967,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={DecodeError:function(){return y},MiddlewareNotFoundError:function(){return j},MissingStaticPage:function(){return w},NormalizeError:function(){return x},PageNotFoundError:function(){return b},SP:function(){return g},ST:function(){return v},WEB_VITALS:function(){return i},execOnce:function(){return o},getDisplayName:function(){return d},getLocationOrigin:function(){return u},getURL:function(){return c},isAbsoluteUrl:function(){return l},isResSent:function(){return h},loadGetInitialProps:function(){return p},normalizeRepeatedSlashes:function(){return f},stringifyError:function(){return N}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let i=["CLS","FCP","FID","INP","LCP","TTFB"];function o(e){let t,r=!1;return(...n)=>(r||(r=!0,t=e(...n)),t)}let s=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,l=e=>s.test(e);function u(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function c(){let{href:e}=window.location,t=u();return e.substring(t.length)}function d(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function h(e){return e.finished||e.headersSent}function f(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function p(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await p(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&h(r))return n;if(!n)throw Object.defineProperty(Error(`"${d(e)}.getInitialProps()" should resolve to an object. But found "${n}" instead.`),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return n}let g="undefined"!=typeof performance,v=g&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class y extends Error{}class x extends Error{}class b extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class w extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class j extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function N(e){return JSON.stringify({message:e.message,stack:e.stack})}},73668,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return i}});let n=e.r(18967),a=e.r(52817);function i(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,a.hasBasePath)(r.pathname)}catch(e){return!1}}},84508,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},22016,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return y},useLinkStatus:function(){return b}};for(var a in n)Object.defineProperty(r,a,{enumerable:!0,get:n[a]});let i=e.r(90809),o=e.r(43476),s=i._(e.r(71645)),l=e.r(95057),u=e.r(8372),c=e.r(18581),d=e.r(18967),h=e.r(5550);e.r(33525);let f=e.r(91949),p=e.r(73668),g=e.r(9396);function v(e){return"string"==typeof e?e:(0,l.formatUrl)(e)}function y(t){var r;let n,a,i,[l,y]=(0,s.useOptimistic)(f.IDLE_LINK_STATUS),b=(0,s.useRef)(null),{href:w,as:j,children:N,prefetch:k=null,passHref:C,replace:E,shallow:S,scroll:T,onClick:P,onMouseEnter:_,onTouchStart:D,legacyBehavior:B=!1,onNavigate:M,ref:A,unstable_dynamicOnHover:R,...I}=t;n=N,B&&("string"==typeof n||"number"==typeof n)&&(n=(0,o.jsx)("a",{children:n}));let L=s.default.useContext(u.AppRouterContext),O=!1!==k,z=!1!==k?null===(r=k)||"auto"===r?g.FetchStrategy.PPR:g.FetchStrategy.Full:g.FetchStrategy.PPR,{href:V,as:F}=s.default.useMemo(()=>{let e=v(w);return{href:e,as:j?v(j):e}},[w,j]);if(B){if(n?.$$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(n)}let H=B?a&&"object"==typeof a&&a.ref:A,q=s.default.useCallback(e=>(null!==L&&(b.current=(0,f.mountLinkInstance)(e,V,L,z,O,y)),()=>{b.current&&((0,f.unmountLinkForCurrentNavigation)(b.current),b.current=null),(0,f.unmountPrefetchableInstance)(e)}),[O,V,L,z,y]),X={ref:(0,c.useMergedRef)(q,H),onClick(t){B||"function"!=typeof P||P(t),B&&a.props&&"function"==typeof a.props.onClick&&a.props.onClick(t),!L||t.defaultPrevented||function(t,r,n,a,i,o,l){if("undefined"!=typeof window){let u,{nodeName:c}=t.currentTarget;if("A"===c.toUpperCase()&&((u=t.currentTarget.getAttribute("target"))&&"_self"!==u||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,p.isLocalURL)(r)){i&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),l){let e=!1;if(l({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:d}=e.r(99781);s.default.startTransition(()=>{d(n||r,i?"replace":"push",o??!0,a.current)})}}(t,V,F,b,E,T,M)},onMouseEnter(e){B||"function"!=typeof _||_(e),B&&a.props&&"function"==typeof a.props.onMouseEnter&&a.props.onMouseEnter(e),L&&O&&(0,f.onNavigationIntent)(e.currentTarget,!0===R)},onTouchStart:function(e){B||"function"!=typeof D||D(e),B&&a.props&&"function"==typeof a.props.onTouchStart&&a.props.onTouchStart(e),L&&O&&(0,f.onNavigationIntent)(e.currentTarget,!0===R)}};return(0,d.isAbsoluteUrl)(F)?X.href=F:B&&!C&&("a"!==a.type||"href"in a.props)||(X.href=(0,h.addBasePath)(F)),i=B?s.default.cloneElement(a,X):(0,o.jsx)("a",{...I,...X,children:n}),(0,o.jsx)(x.Provider,{value:l,children:i})}e.r(84508);let x=(0,s.createContext)(f.IDLE_LINK_STATUS),b=()=>(0,s.useContext)(x);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},37578,e=>{"use strict";let t,r,n;var a,i,o,s,l,u,c,d,h,f,p,g,v,y,x,b,w,j,N,k,C,E,S=e.i(43476),T=e.i(18566),P=e.i(99729),_=e.i(71645),D=e.i(59321),B=e.i(55436),M=e.i(75254);let A=(0,M.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"}]]),R=(0,M.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"}]]),I=(0,M.default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),L=(0,M.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"}]]),O=(0,M.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),z=(0,M.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),V=(0,M.default)("box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);var F=e.i(68373),H=e.i(22016);function q({currentTab:e,onTabChange:t}){let{currentBank:r}=(0,D.useBank)(),[n,a]=(0,_.useState)(!0);if(!r)return null;let i=[{id:"data",label:"Memories",icon:R},{id:"recall",label:"Recall",icon:B.Search},{id:"reflect",label:"Reflect",icon:A},{id:"documents",label:"Documents",icon:I},{id:"entities",label:"Entities",icon:L},{id:"profile",label:"Memory Bank",icon:V}];return(0,S.jsxs)("aside",{className:(0,F.cn)("bg-card border-r border-border flex flex-col transition-all duration-300",n?"w-16":"w-64"),children:[(0,S.jsx)("nav",{className:"flex-1 p-3 pt-4",children:(0,S.jsx)("ul",{className:"space-y-1",children:i.map(a=>{let i=a.icon,o=e===a.id,s=`/banks/${r}?view=${a.id}`;return(0,S.jsx)("li",{children:(0,S.jsxs)(H.default,{href:s,onClick:e=>{0!==e.button||e.ctrlKey||e.metaKey||(e.preventDefault(),t(a.id))},className:(0,F.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",n&&"justify-center px-0"),title:n?a.label:void 0,children:[(0,S.jsx)(i,{className:"w-5 h-5 flex-shrink-0"}),!n&&(0,S.jsx)("span",{children:a.label})]})},a.id)})})}),(0,S.jsx)("div",{className:"p-3 border-t border-border",children:(0,S.jsx)("button",{onClick:()=>a(!n),className:(0,F.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",n&&"justify-center px-0"),title:n?"Expand sidebar":"Collapse sidebar",children:n?(0,S.jsx)(z,{className:"w-5 h-5"}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O,{className:"w-5 h-5"}),(0,S.jsx)("span",{children:"Collapse"})]})})})]})}var X=e.i(7122),Y=e.i(88029),W=e.i(80208);let U=(0,M.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 $=e.i(43531);let K=(0,M.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"}]]),G=(0,M.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"}]]),Z=(0,M.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"}]]),Q=(0,M.default)("chevrons-left",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]),J=(0,M.default)("chevrons-right",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]),ee=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("div",{className:"relative w-full overflow-auto",children:(0,S.jsx)("table",{ref:r,className:(0,F.cn)("w-full caption-bottom text-sm",e),...t})}));ee.displayName="Table";let et=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("thead",{ref:r,className:(0,F.cn)("[&_tr]:border-b",e),...t}));et.displayName="TableHeader";let er=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("tbody",{ref:r,className:(0,F.cn)("[&_tr:last-child]:border-0",e),...t}));er.displayName="TableBody",_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("tfoot",{ref:r,className:(0,F.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t})).displayName="TableFooter";let en=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("tr",{ref:r,className:(0,F.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));en.displayName="TableRow";let ea=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("th",{ref:r,className:(0,F.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));ea.displayName="TableHead";let ei=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("td",{ref:r,className:(0,F.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));ei.displayName="TableCell",_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("caption",{ref:r,className:(0,F.cn)("mt-4 text-sm text-muted-foreground",e),...t})).displayName="TableCaption";var eo=e.i(74080),es=e.i(91918),el=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=(0,es.createSlot)(`Primitive.${t}`),n=_.forwardRef((e,n)=>{let{asChild:a,...i}=e;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,S.jsx)(a?r:t,{...i,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),eu=_.forwardRef((e,t)=>(0,S.jsx)(el.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));eu.displayName="Label";let ec=(0,e.i(25913).cva)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ed=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)(eu,{ref:r,className:(0,F.cn)(ec(),e),...t}));function eh(e,[t,r]){return Math.min(r,Math.max(t,e))}ed.displayName=eu.displayName;var ef=e.i(81140),ep=e.i(20783),eg=e.i(30030),em=e.i(69340),ev=_.createContext(void 0);function ey(e){let t=_.useContext(ev);return e||t||"ltr"}var ex=e.i(99682),eb=e.i(35804),ew=e.i(48425);function ej(e){var t;let r,n=(t=e,(r=_.forwardRef((e,t)=>{let{children:r,...n}=e;if(_.isValidElement(r)){var a;let e,i,o=(a=r,(i=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(i=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),s=function(e,t){let r={...t};for(let n in t){let a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...e)=>{let t=i(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...i}:"className"===n&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==_.Fragment&&(s.ref=t?(0,ep.composeRefs)(t,o):o),_.cloneElement(r,s)}return _.Children.count(r)>1?_.Children.only(null):null})).displayName=`${t}.SlotClone`,r),a=_.forwardRef((e,t)=>{let{children:r,...a}=e,i=_.Children.toArray(r),o=i.find(ek);if(o){let e=o.props.children,r=i.map(t=>t!==o?t:_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null);return(0,S.jsx)(n,{...a,ref:t,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,S.jsx)(n,{...a,ref:t,children:r})});return a.displayName=`${e}.Slot`,a}var eN=Symbol("radix.slottable");function ek(e){return _.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===eN}function eC(e){let t=e+"CollectionProvider",[r,n]=(0,eg.createContextScope)(t),[a,i]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:r}=e,n=_.default.useRef(null),i=_.default.useRef(new Map).current;return(0,S.jsx)(a,{scope:t,itemMap:i,collectionRef:n,children:r})};o.displayName=t;let s=e+"CollectionSlot",l=ej(s),u=_.default.forwardRef((e,t)=>{let{scope:r,children:n}=e,a=i(s,r),o=(0,ep.useComposedRefs)(t,a.collectionRef);return(0,S.jsx)(l,{ref:o,children:n})});u.displayName=s;let c=e+"CollectionItemSlot",d="data-radix-collection-item",h=ej(c),f=_.default.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,o=_.default.useRef(null),s=(0,ep.useComposedRefs)(t,o),l=i(c,r);return _.default.useEffect(()=>(l.itemMap.set(o,{ref:o,...a}),()=>void l.itemMap.delete(o))),(0,S.jsx)(h,{...{[d]:""},ref:s,children:n})});return f.displayName=c,[{Provider:o,Slot:u,ItemSlot:f},function(t){let r=i(e+"CollectionConsumer",t);return _.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},n]}var eE=new WeakMap;function eS(e,t){var r,n;let a,i,o;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let s=(r=e,n=t,a=r.length,(o=(i=eT(n))>=0?i:a+i)<0||o>=a?-1:o);return -1===s?void 0:e[s]}function eT(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#e;constructor(e){super(e),this.#e=[...super.keys()],eE.set(this,!0)}set(e,t){return eE.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,r){let n,a=this.has(t),i=this.#e.length,o=eT(e),s=o>=0?o:i+o,l=s<0||s>=i?-1:s;if(l===this.size||a&&l===this.size-1||-1===l)return this.set(t,r),this;let u=this.size+ +!a;o<0&&s++;let c=[...this.#e],d=!1;for(let e=s;e<u;e++)if(s===e){let i=c[e];c[e]===t&&(i=c[e+1]),a&&this.delete(t),n=this.get(i),this.set(t,r)}else{d||c[e-1]!==t||(d=!0);let r=c[d?e:e-1],a=n;n=this.get(r),this.delete(r),this.set(r,a)}return this}with(t,r,n){let a=new e(this);return a.insert(t,r,n),a}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n,t,r)}after(e){let t=this.#e.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let n=this.#e.indexOf(e);return -1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=eS(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=eS(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return eS(this.#e,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(t,r){let n=[],a=0;for(let e of this)Reflect.apply(t,r,[e,a,this])&&n.push(e),a++;return new e(n)}map(t,r){let n=[],a=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,a,this])]),a++;return new e(n)}reduce(...e){let[t,r]=e,n=0,a=r??this.at(0);for(let r of this)a=0===n&&1===e.length?r:Reflect.apply(t,this,[a,r,n,this]),n++;return a}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let a=this.at(r);n=r===this.size-1&&1===e.length?a:Reflect.apply(t,this,[n,a,r,this])}return n}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,a=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(a=r-1);for(let e=t;e<=a;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}});var eP=["PageUp","PageDown"],e_=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],eD={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},eB="Slider",[eM,eA,eR]=eC(eB),[eI,eL]=(0,eg.createContextScope)(eB,[eR]),[eO,ez]=eI(eB),eV=_.forwardRef((e,t)=>{let{name:r,min:n=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:s=!1,minStepsBetweenThumbs:l=0,defaultValue:u=[n],value:c,onValueChange:d=()=>{},onValueCommit:h=()=>{},inverted:f=!1,form:p,...g}=e,v=_.useRef(new Set),y=_.useRef(0),x="horizontal"===o,[b=[],w]=(0,em.useControllableState)({prop:c,defaultProp:u,onChange:e=>{let t=[...v.current];t[y.current]?.focus(),d(e)}}),j=_.useRef(b);function N(e,t,{commit:r}={commit:!1}){let o,s=(String(i).split(".")[1]||"").length,u=eh(Math.round((Math.round((e-n)/i)*i+n)*(o=Math.pow(10,s)))/o,[n,a]);w((e=[])=>{let n=function(e=[],t,r){let n=[...e];return n[r]=t,n.sort((e,t)=>e-t)}(e,u,t);if(!function(e,t){if(t>0)return Math.min(...e.slice(0,-1).map((t,r)=>e[r+1]-t))>=t;return!0}(n,l*i))return e;{y.current=n.indexOf(u);let t=String(n)!==String(e);return t&&r&&h(n),t?n:e}})}return(0,S.jsx)(eO,{scope:e.__scopeSlider,name:r,disabled:s,min:n,max:a,valueIndexToChangeRef:y,thumbs:v.current,values:b,orientation:o,form:p,children:(0,S.jsx)(eM.Provider,{scope:e.__scopeSlider,children:(0,S.jsx)(eM.Slot,{scope:e.__scopeSlider,children:(0,S.jsx)(x?eq:eX,{"aria-disabled":s,"data-disabled":s?"":void 0,...g,ref:t,onPointerDown:(0,ef.composeEventHandlers)(g.onPointerDown,()=>{s||(j.current=b)}),min:n,max:a,inverted:f,onSlideStart:s?void 0:function(e){let t=function(e,t){if(1===e.length)return 0;let r=e.map(e=>Math.abs(e-t)),n=Math.min(...r);return r.indexOf(n)}(b,e);N(e,t)},onSlideMove:s?void 0:function(e){N(e,y.current)},onSlideEnd:s?void 0:function(){let e=j.current[y.current];b[y.current]!==e&&h(b)},onHomeKeyDown:()=>!s&&N(n,0,{commit:!0}),onEndKeyDown:()=>!s&&N(a,b.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!s){let r=eP.includes(e.key)||e.shiftKey&&e_.includes(e.key),n=y.current;N(b[n]+i*(r?10:1)*t,n,{commit:!0})}}})})})})});eV.displayName=eB;var[eF,eH]=eI(eB,{startEdge:"left",endEdge:"right",size:"width",direction:1}),eq=_.forwardRef((e,t)=>{let{min:r,max:n,dir:a,inverted:i,onSlideStart:o,onSlideMove:s,onSlideEnd:l,onStepKeyDown:u,...c}=e,[d,h]=_.useState(null),f=(0,ep.useComposedRefs)(t,e=>h(e)),p=_.useRef(void 0),g=ey(a),v="ltr"===g,y=v&&!i||!v&&i;function x(e){let t=p.current||d.getBoundingClientRect(),a=e1([0,t.width],y?[r,n]:[n,r]);return p.current=t,a(e-t.left)}return(0,S.jsx)(eF,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:(0,S.jsx)(eY,{dir:g,"data-orientation":"horizontal",...c,ref:f,style:{...c.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:e=>{let t=x(e.clientX);o?.(t)},onSlideMove:e=>{let t=x(e.clientX);s?.(t)},onSlideEnd:()=>{p.current=void 0,l?.()},onStepKeyDown:e=>{let t=eD[y?"from-left":"from-right"].includes(e.key);u?.({event:e,direction:t?-1:1})}})})}),eX=_.forwardRef((e,t)=>{let{min:r,max:n,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:s,onStepKeyDown:l,...u}=e,c=_.useRef(null),d=(0,ep.useComposedRefs)(t,c),h=_.useRef(void 0),f=!a;function p(e){let t=h.current||c.current.getBoundingClientRect(),a=e1([0,t.height],f?[n,r]:[r,n]);return h.current=t,a(e-t.top)}return(0,S.jsx)(eF,{scope:e.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1,children:(0,S.jsx)(eY,{"data-orientation":"vertical",...u,ref:d,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:e=>{let t=p(e.clientY);i?.(t)},onSlideMove:e=>{let t=p(e.clientY);o?.(t)},onSlideEnd:()=>{h.current=void 0,s?.()},onStepKeyDown:e=>{let t=eD[f?"from-bottom":"from-top"].includes(e.key);l?.({event:e,direction:t?-1:1})}})})}),eY=_.forwardRef((e,t)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:s,onStepKeyDown:l,...u}=e,c=ez(eB,r);return(0,S.jsx)(ew.Primitive.span,{...u,ref:t,onKeyDown:(0,ef.composeEventHandlers)(e.onKeyDown,e=>{"Home"===e.key?(o(e),e.preventDefault()):"End"===e.key?(s(e),e.preventDefault()):eP.concat(e_).includes(e.key)&&(l(e),e.preventDefault())}),onPointerDown:(0,ef.composeEventHandlers)(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),c.thumbs.has(t)?t.focus():n(e)}),onPointerMove:(0,ef.composeEventHandlers)(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&a(e)}),onPointerUp:(0,ef.composeEventHandlers)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),i(e))})})}),eW="SliderTrack",eU=_.forwardRef((e,t)=>{let{__scopeSlider:r,...n}=e,a=ez(eW,r);return(0,S.jsx)(ew.Primitive.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...n,ref:t})});eU.displayName=eW;var e$="SliderRange",eK=_.forwardRef((e,t)=>{let{__scopeSlider:r,...n}=e,a=ez(e$,r),i=eH(e$,r),o=_.useRef(null),s=(0,ep.useComposedRefs)(t,o),l=a.values.length,u=a.values.map(e=>e0(e,a.min,a.max)),c=l>1?Math.min(...u):0,d=100-Math.max(...u);return(0,S.jsx)(ew.Primitive.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...n,ref:s,style:{...e.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});eK.displayName=e$;var eG="SliderThumb",eZ=_.forwardRef((e,t)=>{let r=eA(e.__scopeSlider),[n,a]=_.useState(null),i=(0,ep.useComposedRefs)(t,e=>a(e)),o=_.useMemo(()=>n?r().findIndex(e=>e.ref.current===n):-1,[r,n]);return(0,S.jsx)(eQ,{...e,ref:i,index:o})}),eQ=_.forwardRef((e,t)=>{var r,n,a,i,o;let s,l,{__scopeSlider:u,index:c,name:d,...h}=e,f=ez(eG,u),p=eH(eG,u),[g,v]=_.useState(null),y=(0,ep.useComposedRefs)(t,e=>v(e)),x=!g||f.form||!!g.closest("form"),b=(0,eb.useSize)(g),w=f.values[c],j=void 0===w?0:e0(w,f.min,f.max),N=(r=c,(n=f.values.length)>2?`Value ${r+1} of ${n}`:2===n?["Minimum","Maximum"][r]:void 0),k=b?.[p.size],C=k?(a=k,i=j,o=p.direction,l=e1([0,50],[0,s=a/2]),(s-l(i)*o)*o):0;return _.useEffect(()=>{if(g)return f.thumbs.add(g),()=>{f.thumbs.delete(g)}},[g,f.thumbs]),(0,S.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[p.startEdge]:`calc(${j}% + ${C}px)`},children:[(0,S.jsx)(eM.ItemSlot,{scope:e.__scopeSlider,children:(0,S.jsx)(ew.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:y,style:void 0===w?{display:"none"}:e.style,onFocus:(0,ef.composeEventHandlers)(e.onFocus,()=>{f.valueIndexToChangeRef.current=c})})}),x&&(0,S.jsx)(eJ,{name:d??(f.name?f.name+(f.values.length>1?"[]":""):void 0),form:f.form,value:w},c)]})});eZ.displayName=eG;var eJ=_.forwardRef(({__scopeSlider:e,value:t,...r},n)=>{let a=_.useRef(null),i=(0,ep.useComposedRefs)(a,n),o=(0,ex.usePrevious)(t);return _.useEffect(()=>{let e=a.current;if(!e)return;let r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;if(o!==t&&r){let n=new Event("input",{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,S.jsx)(ew.Primitive.input,{style:{display:"none"},...r,ref:i,defaultValue:t})});function e0(e,t,r){return eh(100/(r-t)*(e-t),[0,100])}function e1(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}eJ.displayName="RadioBubbleInput";let e2=_.forwardRef(({className:e,...t},r)=>(0,S.jsxs)(eV,{ref:r,className:(0,F.cn)("relative flex w-full touch-none select-none items-center",e),...t,children:[(0,S.jsx)(eU,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:(0,S.jsx)(eK,{className:"absolute h-full bg-primary"})}),(0,S.jsx)(eZ,{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"})]}));e2.displayName=eV.displayName;var e5="Switch",[e3,e4]=(0,eg.createContextScope)(e5),[e6,e7]=e3(e5),e9=_.forwardRef((e,t)=>{let{__scopeSwitch:r,name:n,checked:a,defaultChecked:i,required:o,disabled:s,value:l="on",onCheckedChange:u,form:c,...d}=e,[h,f]=_.useState(null),p=(0,ep.useComposedRefs)(t,e=>f(e)),g=_.useRef(!1),v=!h||c||!!h.closest("form"),[y,x]=(0,em.useControllableState)({prop:a,defaultProp:i??!1,onChange:u,caller:e5});return(0,S.jsxs)(e6,{scope:r,checked:y,disabled:s,children:[(0,S.jsx)(ew.Primitive.button,{type:"button",role:"switch","aria-checked":y,"aria-required":o,"data-state":tr(y),"data-disabled":s?"":void 0,disabled:s,value:l,...d,ref:p,onClick:(0,ef.composeEventHandlers)(e.onClick,e=>{x(e=>!e),v&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),v&&(0,S.jsx)(tt,{control:h,bubbles:!g.current,name:n,value:l,checked:y,required:o,disabled:s,form:c,style:{transform:"translateX(-100%)"}})]})});e9.displayName=e5;var e8="SwitchThumb",te=_.forwardRef((e,t)=>{let{__scopeSwitch:r,...n}=e,a=e7(e8,r);return(0,S.jsx)(ew.Primitive.span,{"data-state":tr(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});te.displayName=e8;var tt=_.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...a},i)=>{let o=_.useRef(null),s=(0,ep.useComposedRefs)(o,i),l=(0,ex.usePrevious)(r),u=(0,eb.useSize)(t);return _.useEffect(()=>{let e=o.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(l!==r&&t){let a=new Event("click",{bubbles:n});t.call(e,r),e.dispatchEvent(a)}},[l,r,n]),(0,S.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:s,style:{...a.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function tr(e){return e?"checked":"unchecked"}tt.displayName="SwitchBubbleInput";let tn=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)(e9,{className:(0,F.cn)("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:(0,S.jsx)(te,{className:(0,F.cn)("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));tn.displayName=e9.displayName;var ta=e.i(37727),ti=e.i(76223);function to({type:e,id:t,onClose:r}){let{currentBank:n}=(0,D.useBank)(),[a,i]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),[l,u]=(0,_.useState)(null);(0,_.useEffect)(()=>{t&&(async()=>{s(!0),u(null);try{if("document"===e){if(!n)return void u("No bank selected");let e=await X.client.getDocument(t,n);i(e)}else{let e=await X.client.getChunk(t);i(e)}}catch(t){console.error(`Error loading ${e}:`,t),u(t.message)}finally{s(!1)}})()},[t,e,n]);let c=null!==t;return(0,S.jsx)(ti.Dialog,{open:c,onOpenChange:e=>!e&&r(),children:(0,S.jsxs)(ti.DialogContent,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[(0,S.jsxs)(ti.DialogHeader,{children:[(0,S.jsx)(ti.DialogTitle,{children:"document"===e?"Document Details":"Chunk Details"}),(0,S.jsx)(ti.DialogDescription,{children:"document"===e?"View the original document text and metadata":"View the chunk text and metadata"})]}),(0,S.jsx)("div",{className:"flex-1 overflow-y-auto",children:o?(0,S.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,S.jsxs)("div",{className:"text-center",children:[(0,S.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,S.jsxs)("div",{className:"text-sm text-muted-foreground",children:["Loading ",e,"..."]})]})}):l?(0,S.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,S.jsxs)("div",{className:"text-center text-destructive",children:[(0,S.jsx)("div",{className:"text-4xl mb-2",children:"❌"}),(0,S.jsxs)("div",{className:"text-sm",children:["Error: ",l]})]})}):a?(0,S.jsx)("div",{className:"space-y-4",children:"document"===e?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{className:"space-y-3",children:[(0,S.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Document ID"}),(0,S.jsx)("div",{className:"text-sm font-mono break-all text-foreground",children:a.id})]}),a.created_at&&(0,S.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,S.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Created"}),(0,S.jsx)("div",{className:"text-sm text-foreground",children:new Date(a.created_at).toLocaleString()})]}),(0,S.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Memory Units"}),(0,S.jsx)("div",{className:"text-sm text-foreground",children:a.memory_unit_count})]})]}),a.original_text&&(0,S.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Text Length"}),(0,S.jsxs)("div",{className:"text-sm text-foreground",children:[a.original_text.length.toLocaleString()," characters"]})]})]}),a.original_text&&(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-sm font-bold text-foreground mb-2",children:"Original Text"}),(0,S.jsx)("div",{className:"p-4 bg-muted rounded-lg border border-border max-h-[300px] overflow-y-auto",children:(0,S.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono text-foreground",children:a.original_text})})]})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{className:"space-y-3",children:[(0,S.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Chunk ID"}),(0,S.jsx)("div",{className:"text-sm font-mono break-all text-foreground",children:a.chunk_id})]}),(0,S.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,S.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Document ID"}),(0,S.jsx)("div",{className:"text-sm font-mono break-all text-foreground",children:a.document_id})]}),(0,S.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Chunk Index"}),(0,S.jsx)("div",{className:"text-sm text-foreground",children:a.chunk_index})]})]}),a.created_at&&(0,S.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Created"}),(0,S.jsx)("div",{className:"text-sm text-foreground",children:new Date(a.created_at).toLocaleString()})]}),a.chunk_text&&(0,S.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-1",children:"Text Length"}),(0,S.jsxs)("div",{className:"text-sm text-foreground",children:[a.chunk_text.length.toLocaleString()," characters"]})]})]}),a.chunk_text&&(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-sm font-bold text-foreground mb-2",children:"Chunk Text"}),(0,S.jsx)("div",{className:"p-4 bg-muted rounded-lg border border-border max-h-[300px] overflow-y-auto",children:(0,S.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono text-foreground",children:a.chunk_text})})]})]})}):null})]})})}function ts({memory:e,onClose:t,compact:r=!1,inPanel:n=!1}){let[a,i]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),c=async e=>{try{await navigator.clipboard.writeText(e),i(e),setTimeout(()=>i(null),2e3)}catch(e){console.error("Failed to copy:",e)}},d=e=>{s("document"),u(e)},h=e=>{s("chunk"),u(e)},f=()=>{s(null),u(null)};if(!e)return null;let p=e.id||e.node_id,g=r?"text-[10px]":"text-xs",v=r?"text-xs":"text-sm";return n?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{className:"p-5",children:[(0,S.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:"text-xl font-bold text-foreground",children:"Memory Details"}),(0,S.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Full memory content and metadata"})]}),(0,S.jsx)(Y.Button,{variant:"secondary",size:"sm",onClick:t,className:"h-8 w-8 p-0",children:(0,S.jsx)(ta.X,{className:"h-5 w-5"})})]}),(0,S.jsxs)("div",{className:"space-y-5",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Full Text"}),(0,S.jsx)("div",{className:"text-sm whitespace-pre-wrap leading-relaxed text-foreground",children:e.text})]}),e.context&&(0,S.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Context"}),(0,S.jsx)("div",{className:"text-sm text-foreground",children:e.context})]}),(0,S.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,S.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Occurred"}),(0,S.jsx)("div",{className:"text-sm font-medium text-foreground",children:e.occurred_start?new Date(e.occurred_start).toLocaleString():"N/A"})]}),(0,S.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Mentioned"}),(0,S.jsx)("div",{className:"text-sm font-medium text-foreground",children:e.mentioned_at?new Date(e.mentioned_at).toLocaleString():"N/A"})]})]}),e.entities&&(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-3",children:"Entities"}),(0,S.jsx)("div",{className:"flex flex-wrap gap-2",children:(Array.isArray(e.entities)?e.entities:String(e.entities).split(", ")).map((e,t)=>{let r="string"==typeof e?e:e?.name||JSON.stringify(e);return(0,S.jsx)("span",{className:"text-sm px-3 py-1.5 rounded-full bg-primary/10 text-primary font-medium",children:r},t)})})]}),p&&(0,S.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Memory ID"}),(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("code",{className:"text-xs font-mono break-all flex-1 text-muted-foreground",children:p}),(0,S.jsx)(Y.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 flex-shrink-0",onClick:()=>c(p),children:a===p?(0,S.jsx)($.Check,{className:"h-4 w-4 text-green-600"}):(0,S.jsx)(U,{className:"h-4 w-4"})})]})]}),(e.document_id||e.chunk_id)&&(0,S.jsxs)("div",{className:"flex gap-3 pt-2",children:[e.document_id&&(0,S.jsx)(Y.Button,{onClick:()=>d(e.document_id),variant:"secondary",className:"flex-1",children:"View Document"}),e.chunk_id&&(0,S.jsx)(Y.Button,{onClick:()=>h(e.chunk_id),variant:"secondary",className:"flex-1",children:"View Chunk"})]})]})]}),o&&l&&(0,S.jsx)(to,{type:o,id:l,onClose:f})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{className:`bg-card border-2 border-primary rounded-lg ${r?"p-3":"p-4"} sticky top-4 max-h-[calc(100vh-120px)] overflow-y-auto`,children:[(0,S.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:`${r?"text-sm":"text-lg"} font-bold text-card-foreground`,children:"Memory Details"}),!r&&(0,S.jsx)("p",{className:"text-sm text-muted-foreground",children:"Full memory content and metadata"})]}),(0,S.jsx)(Y.Button,{variant:"ghost",size:"sm",onClick:t,className:r?"h-6 w-6 p-0":"h-8 w-8 p-0",children:(0,S.jsx)(ta.X,{className:r?"h-3 w-3":"h-4 w-4"})})]}),(0,S.jsxs)("div",{className:r?"space-y-2":"space-y-4",children:[(0,S.jsxs)("div",{className:`${r?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,S.jsx)("div",{className:`${g} font-bold text-muted-foreground uppercase mb-1`,children:"Full Text"}),(0,S.jsx)("div",{className:`${v} whitespace-pre-wrap`,children:e.text})]}),e.context&&(0,S.jsxs)("div",{className:`${r?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,S.jsx)("div",{className:`${g} font-bold text-muted-foreground uppercase mb-1`,children:"Context"}),(0,S.jsx)("div",{className:v,children:e.context})]}),(0,S.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,S.jsxs)("div",{className:`${r?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,S.jsx)("div",{className:`${g} font-bold text-muted-foreground uppercase mb-1`,children:"Occurred"}),(0,S.jsx)("div",{className:v,children:e.occurred_start?new Date(e.occurred_start).toLocaleString():"N/A"})]}),(0,S.jsxs)("div",{className:`${r?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,S.jsx)("div",{className:`${g} font-bold text-muted-foreground uppercase mb-1`,children:"Mentioned"}),(0,S.jsx)("div",{className:v,children:e.mentioned_at?new Date(e.mentioned_at).toLocaleString():"N/A"})]})]}),e.entities&&(0,S.jsxs)("div",{className:`${r?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,S.jsx)("div",{className:`${g} font-bold text-muted-foreground uppercase mb-2`,children:"Entities"}),(0,S.jsx)("div",{className:"flex flex-wrap gap-1",children:(Array.isArray(e.entities)?e.entities:String(e.entities).split(", ")).map((e,t)=>{let n="string"==typeof e?e:e?.name||JSON.stringify(e);return(0,S.jsx)("span",{className:`${r?"text-[10px] px-1.5 py-0.5":"text-xs px-2 py-1"} rounded bg-secondary text-secondary-foreground`,children:n},t)})})]}),p&&(0,S.jsxs)("div",{className:`${r?"p-2":"p-3"} bg-muted rounded-lg`,children:[(0,S.jsx)("div",{className:`${g} font-bold text-muted-foreground uppercase mb-1`,children:"Memory ID"}),(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("span",{className:`${r?"text-[10px]":"text-sm"} font-mono break-all`,children:p}),(0,S.jsx)(Y.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 flex-shrink-0",onClick:()=>c(p),children:a===p?(0,S.jsx)($.Check,{className:"h-3 w-3 text-green-600"}):(0,S.jsx)(U,{className:"h-3 w-3"})})]})]}),(e.document_id||e.chunk_id)&&(0,S.jsxs)("div",{className:`flex gap-2 ${r?"pt-1":""}`,children:[e.document_id&&(0,S.jsx)(Y.Button,{onClick:()=>d(e.document_id),size:"sm",variant:"secondary",className:`flex-1 ${r?"h-7 text-xs":""}`,children:"View Document"}),e.chunk_id&&(0,S.jsx)(Y.Button,{onClick:()=>h(e.chunk_id),size:"sm",variant:"secondary",className:`flex-1 ${r?"h-7 text-xs":""}`,children:"View Chunk"})]})]})]}),o&&l&&(0,S.jsx)(to,{type:o,id:l,onClose:f})]})}function tl(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function tu(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function tc(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,tg(n.key),n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function td(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=tv(e))||t){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw i}}}}function th(e,t,r){return(t=tg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tf(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i,o,s=[],l=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw a}}return s}}(e,t)||tv(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 tp(e){return function(e){if(Array.isArray(e))return tl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||tv(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 tg(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function tm(e){return(tm="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 tv(e,t){if(e){if("string"==typeof e)return tl(e,t);var r=({}).toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?tl(e,t):void 0}}var ty="undefined"==typeof window?null:window,tx=ty?ty.navigator:null;ty&&ty.document;var tb=tm(""),tw=tm({}),tj=tm(function(){}),tN="undefined"==typeof HTMLElement?"undefined":tm(HTMLElement),tk=function(e){return e&&e.instanceString&&tE(e.instanceString)?e.instanceString():null},tC=function(e){return null!=e&&tm(e)==tb},tE=function(e){return null!=e&&tm(e)===tj},tS=function(e){return!tD(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},tT=function(e){return null!=e&&tm(e)===tw&&!tS(e)&&e.constructor===Object},tP=function(e){return null!=e&&tm(e)===tm(1)&&!isNaN(e)},t_=function(e){if("undefined"!==tN)return null!=e&&e instanceof HTMLElement},tD=function(e){return tB(e)||tM(e)},tB=function(e){return"collection"===tk(e)&&e._private.single},tM=function(e){return"collection"===tk(e)&&!e._private.single},tA=function(e){return"core"===tk(e)},tR=function(e){return"stylesheet"===tk(e)},tI=function(e){return null==e||!!(""===e||e.match(/^\s+$/))},tL=function(e){return null!=e&&tm(e)===tw&&tE(e.then)},tO=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 r=function(){var n,a=arguments,i=t.apply(this,a),o=r.cache;return(n=o[i])||(n=o[i]=e.apply(this,a)),n};return r.cache={},r},tz=tO(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),tV=tO(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),tF=tO(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),tH=function(e){return tI(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},tq=function(e,t){return e.slice(-1*t.length)===t},tX="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",tY="rgb[a]?\\(("+tX+"[%]?)\\s*,\\s*("+tX+"[%]?)\\s*,\\s*("+tX+"[%]?)(?:\\s*,\\s*("+tX+"))?\\)",tW="rgb[a]?\\((?:"+tX+"[%]?)\\s*,\\s*(?:"+tX+"[%]?)\\s*,\\s*(?:"+tX+"[%]?)(?:\\s*,\\s*(?:"+tX+"))?\\)",tU="hsl[a]?\\(("+tX+")\\s*,\\s*("+tX+"[%])\\s*,\\s*("+tX+"[%])(?:\\s*,\\s*("+tX+"))?\\)",t$="hsl[a]?\\((?:"+tX+")\\s*,\\s*(?:"+tX+"[%])\\s*,\\s*(?:"+tX+"[%])(?:\\s*,\\s*(?:"+tX+"))?\\)",tK=function(e,t){return e<t?-1:+(e>t)},tG=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,r=1;r<t.length;r++){var n=t[r];if(null!=n)for(var a=Object.keys(n),i=0;i<a.length;i++){var o=a[i];e[o]=n[o]}}return e},tZ=function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,r,n;return 4===e.length?(t=parseInt(e[1]+e[1],16),r=parseInt(e[2]+e[2],16),n=parseInt(e[3]+e[3],16)):(t=parseInt(e[1]+e[2],16),r=parseInt(e[3]+e[4],16),n=parseInt(e[5]+e[6],16)),[t,r,n]}},tQ=function(e){function t(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}var r,n,a,i,o,s,l,u,c=RegExp("^"+tU+"$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(a=parseFloat(c[2]))<0||a>100||(a/=100,(i=parseFloat(c[3]))<0||i>100)||(i/=100,void 0!==(o=c[4])&&((o=parseFloat(o))<0||o>1)))return;if(0===a)s=l=u=Math.round(255*i);else{var d=i<.5?i*(1+a):i+a-i*a,h=2*i-d;s=Math.round(255*t(h,d,n+1/3)),l=Math.round(255*t(h,d,n)),u=Math.round(255*t(h,d,n-1/3))}r=[s,l,u,o]}return r},tJ=function(e){var t,r=RegExp("^"+tY+"$").exec(e);if(r){t=[];for(var n=[],a=1;a<=3;a++){var i=r[a];if("%"===i[i.length-1]&&(n[a]=!0),i=parseFloat(i),n[a]&&(i=i/100*255),i<0||i>255)return;t.push(Math.floor(i))}var o=n[1]||n[2]||n[3],s=n[1]&&n[2]&&n[3];if(o&&!s)return;var l=r[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t},t0=function(e){return(tS(e)?e:null)||t1[e.toLowerCase()]||tZ(e)||tJ(e)||tQ(e)},t1={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]},t2=function(e){for(var t=e.map,r=e.keys,n=r.length,a=0;a<n;a++){var i=r[a];if(tT(i))throw Error("Tried to set map with object key");a<r.length-1?(null==t[i]&&(t[i]={}),t=t[i]):t[i]=e.value}},t5=function(e){for(var t=e.map,r=e.keys,n=r.length,a=0;a<n;a++){var i=r[a];if(tT(i))throw Error("Tried to get map with object key");if(null==(t=t[i]))break}return t},t3="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:e.g;function t4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t6(){return sZ?sG:(sZ=1,sG=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)})}function t7(){if(s1)return s0;s1=1;var e=sJ?sQ:(sJ=1,sQ="object"==typeof t3&&t3&&t3.Object===Object&&t3),t="object"==typeof self&&self&&self.Object===Object&&self;return s0=e||t||Function("return this")()}function t9(){return s8?s9:(s8=1,s9=t7().Symbol)}function t8(){if(li)return la;li=1;var e=t9(),t=function(){if(lt)return le;lt=1;var e=t9(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,a=e?e.toStringTag:void 0;return le=function(e){var t=r.call(e,a),i=e[a];try{e[a]=void 0;var o=!0}catch(e){}var s=n.call(e);return o&&(t?e[a]=i:delete e[a]),s}}(),r=function(){if(ln)return lr;ln=1;var e=Object.prototype.toString;return lr=function(t){return e.call(t)}}(),n=e?e.toStringTag:void 0;return la=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":n&&n in Object(e)?t(e):r(e)}}function re(){if(lu)return ll;lu=1;var e=t8(),t=ls?lo:(ls=1,lo=function(e){return null!=e&&"object"==typeof e});return ll=function(r){return"symbol"==typeof r||t(r)&&"[object Symbol]"==e(r)}}var rt=t4(function(){if(lf)return lh;lf=1;var e=t6(),t=function(){if(s5)return s2;s5=1;var e=t7();return s2=function(){return e.Date.now()}}(),r=function(){if(ld)return lc;ld=1;var e=function(){if(s7)return s6;s7=1;var e=function(){if(s4)return s3;s4=1;var e=/\s/;return s3=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}}(),t=/^\s+/;return s6=function(r){return r?r.slice(0,e(r)+1).replace(t,""):r}}(),t=t6(),r=re(),n=0/0,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;return lc=function(l){if("number"==typeof l)return l;if(r(l))return n;if(t(l)){var u="function"==typeof l.valueOf?l.valueOf():l;l=t(u)?u+"":u}if("string"!=typeof l)return 0===l?l:+l;l=e(l);var c=i.test(l);return c||o.test(l)?s(l.slice(2),c?2:8):a.test(l)?n:+l}}(),n=Math.max,a=Math.min;return lh=function(i,o,s){var l,u,c,d,h,f,p=0,g=!1,v=!1,y=!0;if("function"!=typeof i)throw TypeError("Expected a function");function x(e){var t=l,r=u;return l=u=void 0,p=e,d=i.apply(r,t)}function b(e){var t=e-f,r=e-p;return void 0===f||t>=o||t<0||v&&r>=c}function w(){var e,r,n,i=t();if(b(i))return j(i);h=setTimeout(w,(e=i-f,r=i-p,n=o-e,v?a(n,c-r):n))}function j(e){return(h=void 0,y&&l)?x(e):(l=u=void 0,d)}function N(){var e,r=t(),n=b(r);if(l=arguments,u=this,f=r,n){if(void 0===h)return p=e=f,h=setTimeout(w,o),g?x(e):d;if(v)return clearTimeout(h),h=setTimeout(w,o),x(f)}return void 0===h&&(h=setTimeout(w,o)),d}return o=r(o)||0,e(s)&&(g=!!s.leading,c=(v="maxWait"in s)?n(r(s.maxWait)||0,o):c,y="trailing"in s?!!s.trailing:y),N.cancel=function(){void 0!==h&&clearTimeout(h),p=0,l=f=u=h=void 0},N.flush=function(){return void 0===h?d:j(t())},N}}()),rr=ty?ty.performance:null,rn=rr&&rr.now?function(){return rr.now()}:function(){return Date.now()},ra=function(){if(ty){if(ty.requestAnimationFrame)return function(e){ty.requestAnimationFrame(e)};else if(ty.mozRequestAnimationFrame)return function(e){ty.mozRequestAnimationFrame(e)};else if(ty.webkitRequestAnimationFrame)return function(e){ty.webkitRequestAnimationFrame(e)};else if(ty.msRequestAnimationFrame)return function(e){ty.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(rn())},1e3/60)}}(),ri=function(e){return ra(e)},ro=function(e){for(var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,n=r;!(t=e.next()).done;)n=65599*n+t.value|0;return n},rs=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return 65599*t+e|0},rl=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},ru=function(e){return 2097152*e[0]+e[1]},rc=function(e,t){return[rs(e[0],t[0]),rl(e[1],t[1])]},rd=function(e,t){var r={value:0,done:!1},n=0,a=e.length;return ro({next:function(){return n<a?r.value=e[n++]:r.done=!0,r}},t)},rh=function(e,t){var r={value:0,done:!1},n=0,a=e.length;return ro({next:function(){return n<a?r.value=e.charCodeAt(n++):r.done=!0,r}},t)},rf=function(){return rp(arguments)},rp=function(e){for(var t,r=0;r<e.length;r++){var n=e[r];t=0===r?rh(n):rh(n,t)}return t},rg=!0,rm=null!=console.warn,rv=null!=console.trace,ry=Number.MAX_SAFE_INTEGER||0x1fffffffffffff,rx=function(){return!0},rb=function(){return!1},rw=function(){return 0},rj=function(){},rN=function(e){throw Error(e)},rk=function(e){if(void 0===e)return rg;rg=!!e},rC=function(e){rk()&&(rm?console.warn(e):(console.log(e),rv&&console.trace()))},rE=function(e){return null==e?e:tS(e)?e.slice():tT(e)?tG({},e):e},rS=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},rT={},rP=function(){return rT},r_=function(e){var t=Object.keys(e);return function(r){for(var n={},a=0;a<t.length;a++){var i=t[a],o=null==r?void 0:r[i];n[i]=void 0===o?e[i]:o}return n}},rD=function(e,t,r){for(var n=e.length-1;n>=0;n--)e[n]===t&&e.splice(n,1)},rB=function(e){e.splice(0,e.length)},rM=function(e,t){for(var r=0;r<t.length;r++){var n=t[r];e.push(n)}},rA=function(e,t,r){return r&&(t=tF(r,t)),e[t]},rR=function(e,t,r,n){r&&(t=tF(r,t)),e[t]=n},rI=tc(function e(){tu(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]}}]),rL="undefined"!=typeof Map?Map:rI,rO=tc(function e(t){if(tu(this,e),this._obj=Object.create(null),this.size=0,null!=t){var r;r=null!=t.instanceString&&t.instanceString()===this.instanceString()?t.toArray():t;for(var n=0;n<r.length;n++)this.add(r[n])}},[{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)}}]),rz=("undefined"==typeof Set?"undefined":tm(Set))!=="undefined"?Set:rO,rV=function(e,t){var r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(void 0===e||void 0===t||!tA(e))return void rN("An element must have a core reference and parameters set");var n=t.group;if(null==n&&(n=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"!==n&&"edges"!==n)return void rN("An element must be of type `nodes` or `edges`; you specified `"+n+"`");this.length=1,this[0]=this;var a=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:n,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"===n:!!t.pannable,active:!1,classes:new rz,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==a.position.x&&(a.position.x=0),null==a.position.y&&(a.position.y=0),t.renderedPosition){var i=t.renderedPosition,o=e.pan(),s=e.zoom();a.position={x:(i.x-o.x)/s,y:(i.y-o.y)/s}}var l=[];tS(t.classes)?l=t.classes:tC(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u<c;u++){var d=l[u];d&&""!==d&&a.classes.add(d)}this.createEmitter(),(void 0===r||r)&&this.restore();var h=t.style||t.css;h&&(rC("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h))},rF=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,r,n){tT(t)&&!tD(t)&&(t=(a=t).roots||a.root,r=a.visit,n=a.directed),n=2!=arguments.length||tE(r)?n:r,r=tE(r)?r:function(){};for(var a,i,o,s=this._private.cy,l=t=tC(t)?this.filter(t):t,u=[],c=[],d={},h={},f={},p=0,g=this.byGroup(),v=g.nodes,y=g.edges,x=0;x<l.length;x++){var b=l[x],w=b.id();b.isNode()&&(u.unshift(b),e.bfs&&(f[w]=!0,c.push(b)),h[w]=0)}for(;0!==u.length&&(0===(o=function(){var t,a=e.bfs?u.shift():u.pop(),o=a.id();if(e.dfs){if(f[o])return 0;f[o]=!0,c.push(a)}var s=h[o],l=d[o],g=null!=l?l.source():null,x=null!=l?l.target():null,b=null==l?void 0:a.same(g)?x[0]:g[0];if(!0===(t=r(a,l,b,p++,s)))return i=a,1;if(!1===t)return 1;for(var w=a.connectedEdges().filter(function(e){return(!n||e.source().same(a))&&y.has(e)}),j=0;j<w.length;j++){var N=w[j],k=N.connectedNodes().filter(function(e){return!e.same(a)&&v.has(e)}),C=k.id();0===k.length||f[C]||(k=k[0],u.push(k),e.bfs&&(f[C]=!0,c.push(k)),d[C]=N,h[C]=h[o]+1)}}())||1!==o););for(var j=s.collection(),N=0;N<c.length;N++){var k=c[N],C=d[k.id()];null!=C&&j.push(C),j.push(k)}return{path:s.collection(j),found:s.collection(i)}}},rH={breadthFirstSearch:rF({bfs:!0}),depthFirstSearch:rF({dfs:!0})};rH.bfs=rH.breadthFirstSearch,rH.dfs=rH.depthFirstSearch;var rq={exports:{}},rX=rq.exports,rY=t4(lm?lg:(lm=1,lg=function(){return lp?rq.exports:(lp=1,(function(){var e,t,r,n,a,i,o,s,l,u,c,d,h,f,p;r=Math.floor,u=Math.min,t=function(e,t){return e<t?-1:+(e>t)},l=function(e,n,a,i,o){var s;if(null==a&&(a=0),null==o&&(o=t),a<0)throw Error("lo must be non-negative");for(null==i&&(i=e.length);a<i;)0>o(n,e[s=r((a+i)/2)])?i=s:a=s+1;return[].splice.apply(e,[a,a-a].concat(n)),n},i=function(e,r,n){return null==n&&(n=t),e.push(r),f(e,0,e.length-1,n)},a=function(e,r){var n,a;return null==r&&(r=t),n=e.pop(),e.length?(a=e[0],e[0]=n,p(e,0,r)):a=n,a},s=function(e,r,n){var a;return null==n&&(n=t),a=e[0],e[0]=r,p(e,0,n),a},o=function(e,r,n){var a;return null==n&&(n=t),e.length&&0>n(e[0],r)&&(r=(a=[e[0],r])[0],e[0]=a[1],p(e,0,n)),r},n=function(e,n){var a,i,o,s,l,u;for(null==n&&(n=t),s=(function(){u=[];for(var t=0,n=r(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)u.push(t);return u}).apply(this).reverse(),l=[],i=0,o=s.length;i<o;i++)a=s[i],l.push(p(e,a,n));return l},h=function(e,r,n){var a;if(null==n&&(n=t),-1!==(a=e.indexOf(r)))return f(e,0,a,n),p(e,a,n)},c=function(e,r,a){var i,s,l,u;if(null==a&&(a=t),!(i=e.slice(0,r)).length)return i;for(n(i,a),s=0,l=(u=e.slice(r)).length;s<l;s++)o(i,u[s],a);return i.sort(a).reverse()},d=function(e,r,i){var o,s,c,d,h,f,p,g,v;if(null==i&&(i=t),10*r<=e.length){if(!(c=e.slice(0,r).sort(i)).length)return c;for(d=0,s=c[c.length-1],f=(p=e.slice(r)).length;d<f;d++)0>i(o=p[d],s)&&(l(c,o,0,null,i),c.pop(),s=c[c.length-1]);return c}for(n(e,i),v=[],h=0,g=u(r,e.length);0<=g?h<g:h>g;0<=g?++h:--h)v.push(a(e,i));return v},f=function(e,r,n,a){var i,o,s;for(null==a&&(a=t),i=e[n];n>r;){if(0>a(i,o=e[s=n-1>>1])){e[n]=o,n=s;continue}break}return e[n]=i},p=function(e,r,n){var a,i,o,s,l;for(null==n&&(n=t),i=e.length,l=r,o=e[r],a=2*r+1;a<i;)(s=a+1)<i&&!(0>n(e[a],e[s]))&&(a=s),e[r]=e[a],a=2*(r=a)+1;return e[r]=o,f(e,l,r,n)},e=function(){function e(e){this.cmp=null!=e?e:t,this.nodes=[]}return e.push=i,e.pop=a,e.replace=s,e.pushpop=o,e.heapify=n,e.updateItem=h,e.nlargest=c,e.nsmallest=d,e.prototype.push=function(e){return i(this.nodes,e,this.cmp)},e.prototype.pop=function(){return a(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return -1!==this.nodes.indexOf(e)},e.prototype.replace=function(e){return s(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return o(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return n(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return h(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return 0===this.nodes.length},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return(t=new e).nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),rq.exports=e}).call(rX),rq.exports)}())),rW=r_({root:null,weight:function(e){return 1},directed:!1}),rU=r_({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),r$=r_({weight:function(e){return 1},directed:!1}),rK=r_({weight:function(e){return 1},directed:!1,root:null}),rG=Math.sqrt(2),rZ=function(e,t,r){0===r.length&&rN("Karger-Stein must be run on a connected (sub)graph");for(var n=r[e],a=n[1],i=n[2],o=t[a],s=t[i],l=r.length-1;l>=0;l--){var u=r[l],c=u[1],d=u[2];(t[c]===o&&t[d]===s||t[c]===s&&t[d]===o)&&r.splice(l,1)}for(var h=0;h<r.length;h++){var f=r[h];f[1]===s?(r[h]=f.slice(),r[h][1]=o):f[2]===s&&(r[h]=f.slice(),r[h][2]=o)}for(var p=0;p<t.length;p++)t[p]===s&&(t[p]=o);return r},rQ=function(e,t,r,n){for(;r>n;)t=rZ(Math.floor(Math.random()*t.length),e,t),r--;return t},rJ=function(e,t,r){return{x:e.x*t+r.x,y:e.y*t+r.y}},r0=function(e,t,r){return{x:(e.x-r.x)/t,y:(e.y-r.y)/t}},r1=function(e){return{x:e[0],y:e[1]}},r2=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=1/0,a=t;a<r;a++){var i=e[a];isFinite(i)&&(n=Math.min(i,n))}return n},r5=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=-1/0,a=t;a<r;a++){var i=e[a];isFinite(i)&&(n=Math.max(i,n))}return n},r3=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=0,a=0,i=t;i<r;i++){var o=e[i];isFinite(o)&&(n+=o,a++)}return n/a},r4=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,n=!(arguments.length>3)||void 0===arguments[3]||arguments[3],a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],i=!(arguments.length>5)||void 0===arguments[5]||arguments[5];n?e=e.slice(t,r):(r<e.length&&e.splice(r,e.length-r),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];i?!isFinite(l)&&(e[s]=-1/0,o++):e.splice(s,1)}a&&e.sort(function(e,t){return e-t});var u=e.length,c=Math.floor(u/2);return u%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},r6=function(e,t){return Math.atan2(t,e)-Math.PI/2},r7=Math.log2||function(e){return Math.log(e)/Math.log(2)},r9=function(e){return e>0?1:e<0?-1:0},r8=function(e,t){return Math.sqrt(ne(e,t))},ne=function(e,t){var r=t.x-e.x,n=t.y-e.y;return r*r+n*n},nt=function(e){for(var t=e.length,r=0,n=0;n<t;n++)r+=e[n];for(var a=0;a<t;a++)e[a]=e[a]/r;return e},nr=function(e,t,r,n){return(1-n)*(1-n)*e+2*(1-n)*n*t+n*n*r},nn=function(e,t,r,n){return{x:nr(e.x,t.x,r.x,n),y:nr(e.y,t.y,r.y,n)}},na=function(e,t,r,n){var a={x:t.x-e.x,y:t.y-e.y},i=r8(e,t),o={x:a.x/i,y:a.y/i};return r=null==r?0:r,n=null!=n?n:r*i,{x:e.x+o.x*n,y:e.y+o.y*n}},ni=function(e,t,r){return Math.max(e,Math.min(r,t))},no=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}}},ns=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},nl=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},nu=function(e,t,r){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,r),e.y2=Math.max(e.y2,r),e.h=e.y2-e.y1},nc=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},nd=function(e){var t,r,n,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===i.length)t=r=n=a=i[0];else if(2===i.length)t=n=i[0],a=r=i[1];else if(4===i.length){var o=tf(i,4);t=o[0],r=o[1],n=o[2],a=o[3]}return e.x1-=a,e.x2+=r,e.y1-=t,e.y2+=n,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},nh=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},nf=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},np=function(e,t,r){return e.x1<=t&&t<=e.x2&&e.y1<=r&&r<=e.y2},ng=function(e,t){return np(e,t.x,t.y)},nm=function(e,t){return np(e,t.x1,t.y1)&&np(e,t.x2,t.y2)},nv=null!=(lv=Math.hypot)?lv:function(e,t){return Math.sqrt(e*e+t*t)},ny=function(e,t,r,n,a,i,o){var s,l,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===u?nH(a,i):u,d=a/2,h=i/2,f=(c=Math.min(c,d,h))!==d,p=c!==h;if(f){var g=r-d+c-o,v=n-h-o,y=r+d-c+o;if((s=nA(e,t,r,n,g,v,y,v,!1)).length>0)return s}if(p){var x=r+d+o,b=n-h+c-o,w=n+h-c+o;if((s=nA(e,t,r,n,x,b,x,w,!1)).length>0)return s}if(f){var j=r-d+c-o,N=n+h+o,k=r+d-c+o;if((s=nA(e,t,r,n,j,N,k,N,!1)).length>0)return s}if(p){var C=r-d-o,E=n-h+c-o,S=n+h-c+o;if((s=nA(e,t,r,n,C,E,C,S,!1)).length>0)return s}var T=r-d+c,P=n-h+c;if((l=nB(e,t,r,n,T,P,c+o)).length>0&&l[0]<=T&&l[1]<=P)return[l[0],l[1]];var _=r+d-c,D=n-h+c;if((l=nB(e,t,r,n,_,D,c+o)).length>0&&l[0]>=_&&l[1]<=D)return[l[0],l[1]];var B=r+d-c,M=n+h-c;if((l=nB(e,t,r,n,B,M,c+o)).length>0&&l[0]>=B&&l[1]>=M)return[l[0],l[1]];var A=r-d+c,R=n+h-c;return(l=nB(e,t,r,n,A,R,c+o)).length>0&&l[0]<=A&&l[1]>=R?[l[0],l[1]]:[]},nx=function(e,t,r,n,a,i,o){var s=Math.min(r,a),l=Math.max(r,a),u=Math.min(n,i),c=Math.max(n,i);return s-o<=e&&e<=l+o&&u-o<=t&&t<=c+o},nb=function(e,t,r,n,a,i,o,s,l){var u={x1:Math.min(r,o,a)-l,x2:Math.max(r,o,a)+l,y1:Math.min(n,s,i)-l,y2:Math.max(n,s,i)+l};return!(e<u.x1)&&!(e>u.x2)&&!(t<u.y1)&&!(t>u.y2)},nw=function(e,t,r,n){var a=t*t-4*e*(r-=n);if(a<0)return[];var i=Math.sqrt(a),o=2*e;return[(-t+i)/o,(-t-i)/o]},nj=function(e,t,r,n,a){var i,o,s,l,u,c,d,h;if(0===e&&(e=1e-5),t/=e,r/=e,n/=e,i=(o=(3*r-t*t)/9)*o*o+(s=(-(27*n)+t*(9*r-t*t*2))/54)*s,a[1]=0,d=t/3,i>0){u=(u=s+Math.sqrt(i))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(i))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),a[0]=-d+u+c,d+=(u+c)/2,a[4]=a[2]=-d,d=Math.sqrt(3)*(-c+u)/2,a[3]=d,a[5]=-d;return}if(a[5]=a[3]=0,0===i){h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),a[0]=-d+2*h,a[4]=a[2]=-(h+d);return}l=Math.acos(s/Math.sqrt(l=(o=-o)*o*o)),h=2*Math.sqrt(o),a[0]=-d+h*Math.cos(l/3),a[2]=-d+h*Math.cos((l+2*Math.PI)/3),a[4]=-d+h*Math.cos((l+4*Math.PI)/3)},nN=function(e,t,r,n,a,i,o,s){var l,u=[];nj(r*r-4*r*a+2*r*o+4*a*a-4*a*o+o*o+n*n-4*n*i+2*n*s+4*i*i-4*i*s+s*s,9*r*a-3*r*r-3*r*o-6*a*a+3*a*o+9*n*i-3*n*n-3*n*s-6*i*i+3*i*s,3*r*r-6*r*a+r*o-r*e+2*a*a+2*a*e-o*e+3*n*n-6*n*i+n*s-n*t+2*i*i+2*i*t-s*t,r*a-r*r+r*e-a*e+n*i-n*n+n*t-i*t,u);for(var c=[],d=0;d<6;d+=2)1e-7>Math.abs(u[d+1])&&u[d]>=0&&u[d]<=1&&c.push(u[d]);c.push(1),c.push(0);for(var h=-1,f=0;f<c.length;f++)l=Math.pow(Math.pow(1-c[f],2)*r+2*(1-c[f])*c[f]*a+c[f]*c[f]*o-e,2)+Math.pow(Math.pow(1-c[f],2)*n+2*(1-c[f])*c[f]*i+c[f]*c[f]*s-t,2),h>=0?l<h&&(h=l):h=l;return h},nk=function(e,t,r,n,a,i){var o=[e-r,t-n],s=[a-r,i-n],l=s[0]*s[0]+s[1]*s[1],u=o[0]*o[0]+o[1]*o[1],c=o[0]*s[0]+o[1]*s[1],d=c*c/l;return c<0?u:d>l?(e-a)*(e-a)+(t-i)*(t-i):u-d},nC=function(e,t,r){for(var n,a,i,o,s=0,l=0;l<r.length/2;l++)if(n=r[2*l],a=r[2*l+1],l+1<r.length/2?(i=r[(l+1)*2],o=r[(l+1)*2+1]):(i=r[(l+1-r.length/2)*2],o=r[(l+1-r.length/2)*2+1]),n==e&&i==e);else{if((!(n>=e)||!(e>=i))&&(!(n<=e)||!(e<=i)))continue;(e-n)/(i-n)*(o-a)+a>t&&s++}return s%2!=0},nE=function(e,t,r,n,a,i,o,s,l){var u,c=Array(r.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d=Math.cos(-u),h=Math.sin(-u),f=0;f<c.length/2;f++)c[2*f]=i/2*(r[2*f]*d-r[2*f+1]*h),c[2*f+1]=o/2*(r[2*f+1]*d+r[2*f]*h),c[2*f]+=n,c[2*f+1]+=a;return nC(e,t,l>0?nT(nP(c,-l)):c)},nS=function(e,t,r,n,a,i,o,s){for(var l=Array(2*r.length),u=0;u<s.length;u++){var c=s[u];if(l[4*u+0]=c.startX,l[4*u+1]=c.startY,l[4*u+2]=c.stopX,l[4*u+3]=c.stopY,Math.pow(c.cx-e,2)+Math.pow(c.cy-t,2)<=Math.pow(c.radius,2))return!0}return nC(e,t,l)},nT=function(e){for(var t,r,n,a,i,o,s,l,u=Array(e.length/2),c=0;c<e.length/4;c++){t=e[4*c],r=e[4*c+1],n=e[4*c+2],a=e[4*c+3],c<e.length/4-1?(i=e[(c+1)*4],o=e[(c+1)*4+1],s=e[(c+1)*4+2],l=e[(c+1)*4+3]):(i=e[0],o=e[1],s=e[2],l=e[3]);var d=nA(t,r,n,a,i,o,s,l,!0);u[2*c]=d[0],u[2*c+1]=d[1]}return u},nP=function(e,t){for(var r,n,a,i,o=Array(2*e.length),s=0;s<e.length/2;s++){r=e[2*s],n=e[2*s+1],s<e.length/2-1?(a=e[(s+1)*2],i=e[(s+1)*2+1]):(a=e[0],i=e[1]);var l=i-n,u=-(a-r),c=Math.sqrt(l*l+u*u),d=l/c,h=u/c;o[4*s]=r+d*t,o[4*s+1]=n+h*t,o[4*s+2]=a+d*t,o[4*s+3]=i+h*t}return o},n_=function(e,t,r,n,a,i){var o=r-e,s=n-t,l=Math.sqrt((o/=a)*o+(s/=i)*s),u=l-1;if(u<0)return[];var c=u/l;return[(r-e)*c+e,(n-t)*c+t]},nD=function(e,t,r,n,a,i,o){return e-=a,t-=i,(e/=r/2+o)*e+(t/=n/2+o)*t<=1},nB=function(e,t,r,n,a,i,o){var s=[r-e,n-t],l=[e-a,t-i],u=s[0]*s[0]+s[1]*s[1],c=2*(l[0]*s[0]+l[1]*s[1]),d=c*c-4*u*(l[0]*l[0]+l[1]*l[1]-o*o);if(d<0)return[];var h=(-c+Math.sqrt(d))/(2*u),f=(-c-Math.sqrt(d))/(2*u),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 y=v[0]*s[0]+e,x=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,x]:[y,x,v[1]*s[0]+e,v[1]*s[1]+t]:[y,x]},nM=function(e,t,r){return t<=e&&e<=r||r<=e&&e<=t?e:e<=t&&t<=r||r<=t&&t<=e?t:r},nA=function(e,t,r,n,a,i,o,s,l){var u=e-a,c=r-e,d=o-a,h=t-i,f=n-t,p=s-i,g=d*h-p*u,v=c*h-f*u,y=p*c-d*f;if(0!==y){var x=g/y,b=v/y;return -.001<=x&&x<=1.001&&-.001<=b&&b<=1.001||l?[e+x*c,t+x*f]:[]}return 0!==g&&0!==v?[]:nM(e,r,o)===o?[o,s]:nM(e,r,a)===a?[a,i]:nM(a,o,r)===r?[r,n]:[]},nR=function(e,t,r,n,a){var i=[],o=n/2,s=a/2;i.push({x:t+o*e[0],y:r+s*e[1]});for(var l=1;l<e.length/2;l++)i.push({x:t+o*e[2*l],y:r+s*e[2*l+1]});return i},nI=function(e,t,r,n,a,i,o,s){var l,u,c,d,h,f,p=[],g=Array(r.length),v=!0;if(null==i&&(v=!1),v){for(var y=0;y<g.length/2;y++)g[2*y]=r[2*y]*i+n,g[2*y+1]=r[2*y+1]*o+a;u=s>0?nT(nP(g,-s)):g}else u=r;for(var x=0;x<u.length/2;x++)c=u[2*x],d=u[2*x+1],x<u.length/2-1?(h=u[(x+1)*2],f=u[(x+1)*2+1]):(h=u[0],f=u[1]),0!==(l=nA(e,t,n,a,c,d,h,f)).length&&p.push(l[0],l[1]);return p},nL=function(e,t,r,n,a,i,o,s,l){var u,c=[],d=Array(2*r.length);l.forEach(function(r,i){0===i?(d[d.length-2]=r.startX,d[d.length-1]=r.startY):(d[4*i-2]=r.startX,d[4*i-1]=r.startY),d[4*i]=r.stopX,d[4*i+1]=r.stopY,0!==(u=nB(e,t,n,a,r.cx,r.cy,r.radius)).length&&c.push(u[0],u[1])});for(var h=0;h<d.length/4;h++)0!==(u=nA(e,t,n,a,d[4*h],d[4*h+1],d[4*h+2],d[4*h+3],!1)).length&&c.push(u[0],u[1]);if(c.length>2){for(var f=[c[0],c[1]],p=Math.pow(f[0]-e,2)+Math.pow(f[1]-t,2),g=1;g<c.length/2;g++){var v=Math.pow(c[2*g]-e,2)+Math.pow(c[2*g+1]-t,2);v<=p&&(f[0]=c[2*g],f[1]=c[2*g+1],p=v)}return f}return c},nO=function(e,t,r){var n=[e[0]-t[0],e[1]-t[1]],a=Math.sqrt(n[0]*n[0]+n[1]*n[1]),i=(a-r)/a;return i<0&&(i=1e-5),[t[0]+i*n[0],t[1]+i*n[1]]},nz=function(e,t){var r=nF(e,t);return nV(r)},nV=function(e){for(var t,r,n=e.length/2,a=1/0,i=1/0,o=-1/0,s=-1/0,l=0;l<n;l++)t=e[2*l],r=e[2*l+1],a=Math.min(a,t),o=Math.max(o,t),i=Math.min(i,r),s=Math.max(s,r);for(var u=2/(o-a),c=2/(s-i),d=0;d<n;d++)t=e[2*d]=e[2*d]*u,r=e[2*d+1]=e[2*d+1]*c,a=Math.min(a,t),o=Math.max(o,t),i=Math.min(i,r),s=Math.max(s,r);if(i<-1)for(var h=0;h<n;h++)r=e[2*h+1]=e[2*h+1]+(-1-i);return e},nF=function(e,t){var r,n=1/e*2*Math.PI,a=e%2==0?Math.PI/2+n/2:Math.PI/2;a+=t;for(var i=Array(2*e),o=0;o<e;o++)r=o*n+a,i[2*o]=Math.cos(r),i[2*o+1]=Math.sin(-r);return i},nH=function(e,t){return Math.min(e/4,t/4,8)},nq=function(e,t){return Math.min(e/10,t/10,8)},nX=function(){return 8},nY=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function nW(e,t){function r(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],a=e[(r+1)%e.length],i={x:a.x-n.x,y:a.y-n.y},o={x:-i.y,y:i.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 n(e,t){var r,n=1/0,a=-1/0,i=td(e);try{for(i.s();!(r=i.n()).done;){var o=r.value,s=o.x*t.x+o.y*t.y;n=Math.min(n,s),a=Math.max(a,s)}}catch(e){i.e(e)}finally{i.f()}return{min:n,max:a}}var a,i=td([].concat(tp(r(e)),tp(r(t))));try{for(i.s();!(a=i.n()).done;){var o=a.value,s=n(e,o),l=n(t,o);if(s.max<l.min||l.max<s.min)return!1}}catch(e){i.e(e)}finally{i.f()}return!0}var nU=r_({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),n$=r_({root:null,weight:function(e){return 1},directed:!1,alpha:0}),nK={degreeCentralityNormalized:function(e){e=n$(e);var t=this.cy(),r=this.nodes(),n=r.length;if(e.directed){for(var a={},i={},o=0,s=0,l=0;l<n;l++){var u=r[l],c=u.id();e.root=u;var d=this.degreeCentrality(e);o<d.indegree&&(o=d.indegree),s<d.outdegree&&(s=d.outdegree),a[c]=d.indegree,i[c]=d.outdegree}return{indegree:function(e){return 0==o?0:(tC(e)&&(e=t.filter(e)),a[e.id()]/o)},outdegree:function(e){return 0===s?0:(tC(e)&&(e=t.filter(e)),i[e.id()]/s)}}}for(var h={},f=0,p=0;p<n;p++){var g=r[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:(tC(e)&&(e=t.filter(e)),h[e.id()]/f)}}},degreeCentrality:function(e){e=n$(e);var t=this.cy(),r=this,n=e,a=n.root,i=n.weight,o=n.directed,s=n.alpha;if(a=t.collection(a)[0],o){for(var l=a.connectedEdges(),u=l.filter(function(e){return e.target().same(a)&&r.has(e)}),c=l.filter(function(e){return e.source().same(a)&&r.has(e)}),d=u.length,h=c.length,f=0,p=0,g=0;g<u.length;g++)f+=i(u[g]);for(var v=0;v<c.length;v++)p+=i(c[v]);return{indegree:Math.pow(d,1-s)*Math.pow(f,s),outdegree:Math.pow(h,1-s)*Math.pow(p,s)}}for(var y=a.connectedEdges().intersection(r),x=y.length,b=0,w=0;w<y.length;w++)b+=i(y[w]);return{degree:Math.pow(x,1-s)*Math.pow(b,s)}}};nK.dc=nK.degreeCentrality,nK.dcn=nK.degreeCentralityNormalised=nK.degreeCentralityNormalized;var nG=r_({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),nZ={closenessCentralityNormalized:function(e){for(var t=nG(e),r=t.harmonic,n=t.weight,a=t.directed,i=this.cy(),o={},s=0,l=this.nodes(),u=this.floydWarshall({weight:n,directed:a}),c=0;c<l.length;c++){for(var d=0,h=l[c],f=0;f<l.length;f++)if(c!==f){var p=u.distance(h,l[f]);r?d+=1/p:d+=p}r||(d=1/d),s<d&&(s=d),o[h.id()]=d}return{closeness:function(e){return 0==s?0:o[e=tC(e)?i.filter(e)[0].id():e.id()]/s}}},closenessCentrality:function(e){var t=nG(e),r=t.root,n=t.weight,a=t.directed,i=t.harmonic;r=this.filter(r)[0];for(var o=this.dijkstra({root:r,weight:n,directed:a}),s=0,l=this.nodes(),u=0;u<l.length;u++){var c=l[u];if(!c.same(r)){var d=o.distanceTo(c);i?s+=1/d:s+=d}}return i?s:1/s}};nZ.cc=nZ.closenessCentrality,nZ.ccn=nZ.closenessCentralityNormalised=nZ.closenessCentralityNormalized;var nQ=r_({weight:null,directed:!1}),nJ={betweennessCentrality:function(e){for(var t=nQ(e),r=t.directed,n=t.weight,a=null!=n,i=this.cy(),o=this.nodes(),s={},l={},u=0,c=function(e,t){l[e]=t,t>u&&(u=t)},d=function(e){return l[e]},h=0;h<o.length;h++){var f=o[h],p=f.id();r?s[p]=f.outgoers().nodes():s[p]=f.openNeighborhood().nodes(),c(p,0)}for(var g=0;g<o.length;g++)!function(){for(var e=o[g].id(),t=[],r={},l={},u={},h=new rY(function(e,t){return u[e]-u[t]}),f=0;f<o.length;f++){var p=o[f].id();r[p]=[],l[p]=0,u[p]=1/0}for(l[e]=1,u[e]=0,h.push(e);!h.empty();){var v=h.pop();if(t.push(v),a)for(var y=0;y<s[v].length;y++){var x=s[v][y],b=i.getElementById(v),w=n(b.edgesTo(x).length>0?b.edgesTo(x)[0]:x.edgesTo(b)[0]);u[x=x.id()]>u[v]+w&&(u[x]=u[v]+w,0>h.nodes.indexOf(x)?h.push(x):h.updateItem(x),l[x]=0,r[x]=[]),u[x]==u[v]+w&&(l[x]=l[x]+l[v],r[x].push(v))}else for(var j=0;j<s[v].length;j++){var N=s[v][j].id();u[N]==1/0&&(h.push(N),u[N]=u[v]+1),u[N]==u[v]+1&&(l[N]=l[N]+l[v],r[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(),S=0;S<r[E].length;S++){var T=r[E][S];k[T]=k[T]+l[T]/l[E]*(1+k[E])}E!=o[g].id()&&c(E,d(E)+k[E])}}();var v={betweenness:function(e){return d(i.collection(e).id())},betweennessNormalized:function(e){return 0==u?0:d(i.collection(e).id())/u}};return v.betweennessNormalised=v.betweennessNormalized,v}};nJ.bc=nJ.betweennessCentrality;var n0=r_({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),n1=function(e,t){for(var r=0,n=0;n<t.length;n++)r+=t[n](e);return r},n2=function(e,t,r){for(var n=0;n<t;n++)e[n*t+n]=r},n5=function(e,t){for(var r,n=0;n<t;n++){r=0;for(var a=0;a<t;a++)r+=e[a*t+n];for(var i=0;i<t;i++)e[i*t+n]=e[i*t+n]/r}},n3=function(e,t,r){for(var n=Array(r*r),a=0;a<r;a++){for(var i=0;i<r;i++)n[a*r+i]=0;for(var o=0;o<r;o++)for(var s=0;s<r;s++)n[a*r+s]+=e[a*r+o]*t[o*r+s]}return n},n4=function(e,t,r){for(var n=e.slice(0),a=1;a<r;a++)e=n3(e,n,t);return e},n6=function(e,t,r){for(var n=Array(t*t),a=0;a<t*t;a++)n[a]=Math.pow(e[a],r);return n5(n,t),n},n7=function(e,t,r,n){for(var a=0;a<r;a++)if(Math.round(e[a]*Math.pow(10,n))/Math.pow(10,n)!=Math.round(t[a]*Math.pow(10,n))/Math.pow(10,n))return!1;return!0},n9=function(e,t,r,n){for(var a=[],i=0;i<t;i++){for(var o=[],s=0;s<t;s++)Math.round(1e3*e[i*t+s])/1e3>0&&o.push(r[s]);0!==o.length&&a.push(n.collection(o))}return a},n8=function(e,t){for(var r=0;r<e.length;r++)if(!t[r]||e[r].id()!==t[r].id())return!1;return!0},ae=function(e){for(var t=0;t<e.length;t++)for(var r=0;r<e.length;r++)t!=r&&n8(e[t],e[r])&&e.splice(r,1);return e},at=function(e){for(var t=this.nodes(),r=this.edges(),n=this.cy(),a=n0(e),i={},o=0;o<t.length;o++)i[t[o].id()]=o;for(var s,l=t.length,u=l*l,c=Array(u),d=0;d<u;d++)c[d]=0;for(var h=0;h<r.length;h++){var f=r[h],p=i[f.source().id()],g=i[f.target().id()],v=n1(f,a.attributes);c[p*l+g]+=v,c[g*l+p]+=v}n2(c,l,a.multFactor),n5(c,l);for(var y=!0,x=0;y&&x<a.maxIterations;)y=!1,n7(c=n6(s=n4(c,l,a.expandFactor),l,a.inflateFactor),s,u,4)||(y=!0),x++;var b=n9(c,l,t,n);return ae(b)},ar=function(e){return e},an=function(e,t){return Math.abs(t-e)},aa=function(e,t,r){return e+an(t,r)},ai=function(e,t,r){return e+Math.pow(r-t,2)},ao=function(e){return Math.sqrt(e)},as=function(e,t,r){return Math.max(e,an(t,r))},al=function(e,t,r,n,a){for(var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:ar,o=n,s=0;s<e;s++)o=a(o,t(s),r(s));return i(o)},au={euclidean:function(e,t,r){return e>=2?al(e,t,r,0,ai,ao):al(e,t,r,0,aa)},squaredEuclidean:function(e,t,r){return al(e,t,r,0,ai)},manhattan:function(e,t,r){return al(e,t,r,0,aa)},max:function(e,t,r){return al(e,t,r,-1/0,as)}};function ac(e,t,r,n,a,i){var o;return(o=tE(e)?e:au[e]||au.euclidean,0===t&&tE(e))?o(a,i):o(t,r,n,a,i)}au["squared-euclidean"]=au.squaredEuclidean,au.squaredeuclidean=au.squaredEuclidean;var ad=r_({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),ah=function(e){return ad(e)},af=function(e,t,r,n,a){var i="kMedoids"!==a?function(e){return r[e]}:function(e){return n[e](r)};return ac(e,n.length,i,function(e){return n[e](t)},r,t)},ap=function(e,t,r){for(var n=r.length,a=Array(n),i=Array(n),o=Array(t),s=null,l=0;l<n;l++)a[l]=e.min(r[l]).value,i[l]=e.max(r[l]).value;for(var u=0;u<t;u++){s=[];for(var c=0;c<n;c++)s[c]=Math.random()*(i[c]-a[c])+a[c];o[u]=s}return o},ag=function(e,t,r,n,a){for(var i=1/0,o=0,s=0;s<t.length;s++){var l=af(r,e,t[s],n,a);l<i&&(i=l,o=s)}return o},am=function(e,t,r){for(var n=[],a=null,i=0;i<t.length;i++)r[(a=t[i]).id()]===e&&n.push(a);return n},av=function(e,t,r){for(var n=0;n<e.length;n++)for(var a=0;a<e[n].length;a++)if(Math.abs(e[n][a]-t[n][a])>r)return!1;return!0},ay=function(e,t,r){for(var n=0;n<r;n++)if(e===t[n])return!0;return!1},ax=function(e,t){var r=Array(t);if(e.length<50)for(var n=0;n<t;n++){for(var a=e[Math.floor(Math.random()*e.length)];ay(a,r,n);)a=e[Math.floor(Math.random()*e.length)];r[n]=a}else for(var i=0;i<t;i++)r[i]=e[Math.floor(Math.random()*e.length)];return r},ab=function(e,t,r){for(var n=0,a=0;a<t.length;a++)n+=af("manhattan",t[a],e,r,"kMedoids");return n},aw=function(e,t,r,n,a){for(var i,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)n[s][l]=Math.pow(r[s][l],a.m);for(var u=0;u<e.length;u++)for(var c=0;c<a.attributes.length;c++){i=0,o=0;for(var d=0;d<t.length;d++)i+=n[d][u]*a.attributes[c](t[d]),o+=n[d][u];e[u][c]=i/o}},aj=function(e,t,r,n,a){for(var i,o=0;o<e.length;o++)t[o]=e[o].slice();for(var s=2/(a.m-1),l=0;l<r.length;l++)for(var u=0;u<n.length;u++){i=0;for(var c=0;c<r.length;c++)i+=Math.pow(af(a.distance,n[u],r[l],a.attributes,"cmeans")/af(a.distance,n[u],r[c],a.attributes,"cmeans"),s);e[u][l]=1/i}},aN=function(e,t,r,n){for(var a,i,o=Array(r.k),s=0;s<o.length;s++)o[s]=[];for(var l=0;l<t.length;l++){a=-1/0,i=-1;for(var u=0;u<t[0].length;u++)t[l][u]>a&&(a=t[l][u],i=u);o[i].push(e[l])}for(var c=0;c<o.length;c++)o[c]=n.collection(o[c]);return o},ak=function(e){var t,r,n,a,i=this.cy(),o=this.nodes(),s=ah(e);n=Array(o.length);for(var l=0;l<o.length;l++)n[l]=Array(s.k);r=Array(o.length);for(var u=0;u<o.length;u++)r[u]=Array(s.k);for(var c=0;c<o.length;c++){for(var d=0,h=0;h<s.k;h++)r[c][h]=Math.random(),d+=r[c][h];for(var f=0;f<s.k;f++)r[c][f]=r[c][f]/d}t=Array(s.k);for(var p=0;p<s.k;p++)t[p]=Array(s.attributes.length);a=Array(o.length);for(var g=0;g<o.length;g++)a[g]=Array(s.k);for(var v=!0,y=0;v&&y<s.maxIterations;)v=!1,aw(t,o,r,a,s),aj(r,n,t,o,s),av(r,n,s.sensitivityThreshold)||(v=!0),y++;return{clusters:aN(o,r,s,i),degreeOfMembership:r}},aC=r_({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),aE={single:"min",complete:"max"},aS=function(e){var t=aC(e),r=aE[t.linkage];return null!=r&&(t.linkage=r),t},aT=function(e,t,r,n,a){for(var i,o,s=0,l=1/0,u=a.attributes,c=function(e,t){return ac(a.distance,u.length,function(t){return u[t](e)},function(e){return u[e](t)},e,t)},d=0;d<e.length;d++){var h=e[d].key,f=r[h][n[h]];f<l&&(s=h,l=f)}if("threshold"===a.mode&&l>=a.threshold||"dendrogram"===a.mode&&1===e.length)return!1;var p=t[s],g=t[n[s]];o="dendrogram"===a.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 y=e[v];p.key===y.key?i=1/0:"min"===a.linkage?(i=r[p.key][y.key],r[p.key][y.key]>r[g.key][y.key]&&(i=r[g.key][y.key])):"max"===a.linkage?(i=r[p.key][y.key],r[p.key][y.key]<r[g.key][y.key]&&(i=r[g.key][y.key])):i="mean"===a.linkage?(r[p.key][y.key]*p.size+r[g.key][y.key]*g.size)/(p.size+g.size):"dendrogram"===a.mode?c(y.value,p.value):c(y.value[0],p.value[0]),r[p.key][y.key]=r[y.key][p.key]=i}for(var x=0;x<e.length;x++){var b=e[x].key;if(n[b]===p.key||n[b]===g.key){for(var w=b,j=0;j<e.length;j++){var N=e[j].key;r[b][N]<r[b][w]&&(w=N)}n[b]=w}e[x].index=x}return p.key=g.key=p.index=g.index=null,!0},aP=function(e,t,r){e&&(e.value?t.push(e.value):(e.left&&aP(e.left,t),e.right&&aP(e.right,t)))},a_=function(e,t){if(!e)return"";if(e.left&&e.right){var r=a_(e.left,t),n=a_(e.right,t),a=t.add({group:"nodes",data:{id:r+","+n}});return t.add({group:"edges",data:{source:r,target:a.id()}}),t.add({group:"edges",data:{source:n,target:a.id()}}),a.id()}if(e.value)return e.value.id()},aD=function(e,t,r){if(!e)return[];var n=[],a=[],i=[];if(0===t)return e.left&&aP(e.left,n),e.right&&aP(e.right,a),i=n.concat(a),[r.collection(i)];if(1===t)if(e.value)return[r.collection(e.value)];else return e.left&&aP(e.left,n),e.right&&aP(e.right,a),[r.collection(n),r.collection(a)];return e.value?[r.collection(e.value)]:(e.left&&(n=aD(e.left,t-1,r)),e.right&&(a=aD(e.right,t-1,r)),n.concat(a))},aB=function(e){for(var t,r=this.cy(),n=this.nodes(),a=aS(e),i=a.attributes,o=function(e,t){return ac(a.distance,i.length,function(t){return i[t](e)},function(e){return i[e](t)},e,t)},s=[],l=[],u=[],c=[],d=0;d<n.length;d++){var h={value:"dendrogram"===a.mode?n[d]:[n[d]],key:d,index:d};s[d]=h,c[d]=h,l[d]=[],u[d]=0}for(var f=0;f<s.length;f++)for(var p=0;p<=f;p++){var g=void 0;g="dendrogram"===a.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][u[f]]&&(u[f]=p)}for(var v=aT(s,c,l,u,a);v;)v=aT(s,c,l,u,a);return"dendrogram"===a.mode?(t=aD(s[0],a.dendrogramDepth,r),a.addDendrogram&&a_(s[0],r)):(t=Array(s.length),s.forEach(function(e,n){e.key=e.index=null,t[n]=r.collection(e.value)})),t},aM=r_({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),aA=function(e){var t=e.damping,r=e.preference;.5<=t&&t<1||rN("Damping must range on [0.5, 1). Got: ".concat(t));var n=["median","mean","min","max"];return n.some(function(e){return e===r})||tP(r)||rN("Preference must be one of [".concat(n.map(function(e){return"'".concat(e,"'")}).join(", "),"] or a number. Got: ").concat(r)),aM(e)},aR=function(e,t,r,n){var a=function(e,t){return n[t](e)};return-ac(e,n.length,function(e){return a(t,e)},function(e){return a(r,e)},t,r)},aI=function(e,t){return"median"===t?r4(e):"mean"===t?r3(e):"min"===t?r2(e):"max"===t?r5(e):t},aL=function(e,t,r){for(var n=[],a=0;a<e;a++)t[a*e+a]+r[a*e+a]>0&&n.push(a);return n},aO=function(e,t,r){for(var n=[],a=0;a<e;a++){for(var i=-1,o=-1/0,s=0;s<r.length;s++){var l=r[s];t[a*e+l]>o&&(i=l,o=t[a*e+l])}i>0&&n.push(i)}for(var u=0;u<r.length;u++)n[r[u]]=r[u];return n},az=function(e,t,r){for(var n=aO(e,t,r),a=0;a<r.length;a++){for(var i=[],o=0;o<n.length;o++)n[o]===r[a]&&i.push(o);for(var s=-1,l=-1/0,u=0;u<i.length;u++){for(var c=0,d=0;d<i.length;d++)c+=t[i[d]*e+i[u]];c>l&&(s=u,l=c)}r[a]=i[s]}return aO(e,t,r)},aV=function(e){for(var t,r,n,a,i,o,s,l=this.cy(),u=this.nodes(),c=aA(e),d={},h=0;h<u.length;h++)d[u[h].id()]=h;n=Array(r=(t=u.length)*t);for(var f=0;f<r;f++)n[f]=-1/0;for(var p=0;p<t;p++)for(var g=0;g<t;g++)p!==g&&(n[p*t+g]=aR(c.distance,u[p],u[g],c.attributes));a=aI(n,c.preference);for(var v=0;v<t;v++)n[v*t+v]=a;i=Array(r);for(var y=0;y<r;y++)i[y]=0;o=Array(r);for(var x=0;x<r;x++)o[x]=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*c.minIterations),C=0;C<k.length;C++)k[C]=0;for(s=0;s<c.maxIterations;s++){for(var E=0;E<t;E++){for(var S=-1/0,T=-1/0,P=-1,_=0,D=0;D<t;D++)b[D]=i[E*t+D],(_=o[E*t+D]+n[E*t+D])>=S?(T=S,S=_,P=D):_>T&&(T=_);for(var B=0;B<t;B++)i[E*t+B]=(1-c.damping)*(n[E*t+B]-S)+c.damping*b[B];i[E*t+P]=(1-c.damping)*(n[E*t+P]-T)+c.damping*b[P]}for(var M=0;M<t;M++){for(var A=0,R=0;R<t;R++)b[R]=o[R*t+M],w[R]=Math.max(0,i[R*t+M]),A+=w[R];A-=w[M],w[M]=i[M*t+M],A+=w[M];for(var I=0;I<t;I++)o[I*t+M]=(1-c.damping)*Math.min(0,A-w[I])+c.damping*b[I];o[M*t+M]=(1-c.damping)*(A-w[M])+c.damping*b[M]}for(var L=0,O=0;O<t;O++){var z=+(o[O*t+O]+i[O*t+O]>0);k[s%c.minIterations*t+O]=z,L+=z}if(L>0&&(s>=c.minIterations-1||s==c.maxIterations-1)){for(var V=0,F=0;F<t;F++){j[F]=0;for(var H=0;H<c.minIterations;H++)j[F]+=k[H*t+F];(0===j[F]||j[F]===c.minIterations)&&V++}if(V===t)break}}for(var q=aL(t,i,o),X=az(t,n,q),Y={},W=0;W<q.length;W++)Y[q[W]]=[];for(var U=0;U<u.length;U++){var $=X[d[u[U].id()]];null!=$&&Y[$].push(u[U])}for(var K=Array(q.length),G=0;G<q.length;G++)K[G]=l.collection(Y[q[G]]);return K},aF=r_({root:void 0,directed:!1}),aH=function(){var e=this,t={},r=0,n=0,a=[],i=[],o={},s=function(r,n){for(var o=i.length-1,s=[],l=e.spawn();i[o].x!=r||i[o].y!=n;)s.push(i.pop().edge),o--;s.push(i.pop().edge),s.forEach(function(r){var n=r.connectedNodes().intersection(e);l.merge(r),n.forEach(function(r){var n=r.id(),a=r.connectedEdges().intersection(e);l.merge(r),t[n].cutVertex?l.merge(a.filter(function(e){return e.isLoop()})):l.merge(a)})}),a.push(l)},l=function(u,c,d){u===d&&(n+=1),t[c]={id:r,low:r++,cutVertex:!1};var h,f,p,g,v=e.getElementById(c).connectedEdges().intersection(e);0===v.size()?a.push(e.spawn(e.getElementById(c))):v.forEach(function(e){h=e.source().id(),f=e.target().id(),(p=h===c?f:h)!==d&&(o[g=e.id()]||(o[g]=!0,i.push({x:c,y:p,edge:e})),p in t?t[c].low=Math.min(t[c].low,t[p].id):(l(u,p,c),t[c].low=Math.min(t[c].low,t[p].low),t[c].id<=t[p].low&&(t[c].cutVertex=!0,s(c,p))))})};e.forEach(function(e){if(e.isNode()){var r=e.id();r in t||(n=0,l(r,r),t[r].cutVertex=n>1)}});var u=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(u),components:a}},aq=function(){var e=this,t={},r=0,n=[],a=[],i=e.spawn(e),o=function(s){if(a.push(s),t[s]={index:r,low:r++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var r=e.target().id();r!==s&&(r in t||o(r),t[r].explored||(t[s].low=Math.min(t[s].low,t[r].low)))}),t[s].index===t[s].low){for(var l=e.spawn();;){var u=a.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),d=l.merge(c);n.push(d),i=i.difference(d)}};return e.forEach(function(e){if(e.isNode()){var r=e.id();r in t||o(r)}}),{cut:i,components:n}},aX={};[rH,{dijkstra:function(e){if(!tT(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var r=rW(e),n=r.root,a=r.weight,i=r.directed,o=this,s=tC(n)?this.filter(n)[0]:n[0],l={},u={},c={},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 rY(function(e,t){return p(e)-p(t)}),v=0;v<h.length;v++){var y=h[v];l[y.id()]=y.same(s)?0:1/0,g.push(y)}for(;g.size()>0;){var x=g.pop(),b=p(x);if(c[x.id()]=b,b!==1/0)for(var w=x.neighborhood().intersect(h),j=0;j<w.length;j++){var N=w[j],k=N.id(),C=function(e,t){for(var r,n=(i?e.edgesTo(t):e.edgesWith(t)).intersect(f),o=1/0,s=0;s<n.length;s++){var l=n[s],u=a(l);(u<o||!r)&&(o=u,r=l)}return{edge:r,dist:o}}(x,N),E=b+C.dist;E<p(N)&&(l[N.id()]=E,g.updateItem(N),u[k]={node:x,edge:C.edge})}}return{distanceTo:function(e){return c[(tC(e)?h.filter(e)[0]:e[0]).id()]},pathTo:function(e){var t=tC(e)?h.filter(e)[0]:e[0],r=[],n=t,a=n.id();if(t.length>0)for(r.unshift(t);u[a];){var i=u[a];r.unshift(i.edge),r.unshift(i.node),a=(n=i.node).id()}return o.spawn(r)}}}},{kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),r=t.nodes,n=t.edges,a=r.length,i=Array(a),o=function(e){for(var t=0;t<i.length;t++)if(i[t].has(e))return t},s=0;s<a;s++)i[s]=this.spawn(r[s]);for(var l=n.sort(function(t,r){return e(t)-e(r)}),u=0;u<l.length;u++){var c=l[u],d=c.source()[0],h=c.target()[0],f=o(d),p=o(h),g=i[f],v=i[p];f!==p&&(r.merge(c),g.merge(v),i.splice(p,1))}return r}},{aStar:function(e){var t,r,n=this.cy(),a=rU(e),i=a.root,o=a.goal,s=a.heuristic,l=a.directed,u=a.weight;i=n.collection(i)[0],o=n.collection(o)[0];var c=i.id(),d=o.id(),h={},f={},p={},g=new rY(function(e,t){return f[e.id()]-f[t.id()]}),v=new rz,y={},x={},b=function(e,t){g.push(e),v.add(t)};b(i,c),h[c]=0,f[c]=s(i);for(var w=0;g.size()>0;){if(r=(t=g.pop()).id(),v.delete(r),w++,r===d){for(var j=[],N=o,k=d,C=x[k];j.unshift(N),null!=C&&j.unshift(C),null!=(N=y[k]);)C=x[k=N.id()];return{found:!0,distance:h[r],path:this.spawn(j),steps:w}}p[r]=!0;for(var E=t._private.edges,S=0;S<E.length;S++){var T=E[S];if(this.hasElementWithId(T.id())&&(!l||T.data("source")===r)){var P=T.source(),_=T.target(),D=P.id()!==r?P:_,B=D.id();if(this.hasElementWithId(B)&&!p[B]){var M=h[r]+u(T);if(!v.has(B)){h[B]=M,f[B]=M+s(D),b(D,B),y[B]=t,x[B]=T;continue}M<h[B]&&(h[B]=M,f[B]=M+s(D),y[B]=t,x[B]=T)}}}}return{found:!1,distance:void 0,path:void 0,steps:w}}},{floydWarshall:function(e){for(var t=this.cy(),r=r$(e),n=r.weight,a=r.directed,i=this.byGroup(),o=i.nodes,s=i.edges,l=o.length,u=l*l,c=function(e){return o.indexOf(e)},d=function(e){return o[e]},h=Array(u),f=0;f<u;f++){var p=f%l;(f-p)/l===p?h[f]=0:h[f]=1/0}for(var g=Array(u),v=Array(u),y=0;y<s.length;y++){var x=s[y],b=x.source()[0],w=x.target()[0];if(b!==w){var j=c(b),N=c(w),k=j*l+N,C=n(x);if(h[k]>C&&(h[k]=C,g[k]=N,v[k]=x),!a){var E=N*l+j;!a&&h[E]>C&&(h[E]=C,g[E]=j,v[E]=x)}}}for(var S=0;S<l;S++)for(var T=0;T<l;T++)for(var P=T*l+S,_=0;_<l;_++){var D=T*l+_,B=S*l+_;h[P]+h[B]<h[D]&&(h[D]=h[P]+h[B],g[D]=g[P])}var M=function(e){return c((tC(e)?t.filter(e):e)[0])};return{distance:function(e,t){return h[M(e)*l+M(t)]},path:function(e,r){var n,a=M(e),i=M(r),o=d(a);if(a===i)return o.collection();if(null==g[a*l+i])return t.collection();var s=t.collection(),u=a;for(s.merge(o);a!==i;)u=a,a=g[a*l+i],n=v[u*l+a],s.merge(n),s.merge(d(a));return s}}}},{bellmanFord:function(e){var t=this,r=rK(e),n=r.weight,a=r.directed,i=r.root,o=this,s=this.cy(),l=this.byGroup(),u=l.edges,c=l.nodes,d=c.length,h=new rL,f=!1,p=[];i=s.collection(i)[0],u.unmergeBy(function(e){return e.isLoop()});for(var g=u.length,v=function(e){var t=h.get(e.id());return t||(t={},h.set(e.id(),t)),t},y=function(e){return(tC(e)?s.$(e):e)[0]},x=0;x<d;x++){var b=c[x],w=v(b);b.same(i)?w.dist=0:w.dist=1/0,w.pred=null,w.edge=null}for(var j=!1,N=function(e,t,r,n,a,i){var o=n.dist+i;o<a.dist&&!r.same(n.edge)&&(a.dist=o,a.pred=e,a.edge=r,j=!0)},k=1;k<d;k++){j=!1;for(var C=0;C<g;C++){var E=u[C],S=E.source(),T=E.target(),P=n(E),_=v(S),D=v(T);N(S,T,E,_,D,P),a||N(T,S,E,D,_,P)}if(!j)break}if(j)for(var B=[],M=0;M<g;M++){var A=u[M],R=A.source(),I=A.target(),L=n(A),O=v(R).dist,z=v(I).dist;if(O+L<z||!a&&z+L<O)if(f||(rC("Graph contains a negative weight cycle for Bellman-Ford"),f=!0),!1!==e.findNegativeWeightCycles){var V=[];O+L<z&&V.push(R),!a&&z+L<O&&V.push(I);for(var F=V.length,H=0;H<F;H++){var q=V[H],X=[q];X.push(v(q).edge);for(var Y=v(q).pred;-1===X.indexOf(Y);)X.push(Y),X.push(v(Y).edge),Y=v(Y).pred;for(var W=(X=X.slice(X.indexOf(Y)))[0].id(),U=0,$=2;$<X.length;$+=2)X[$].id()<W&&(W=X[$].id(),U=$);(X=X.slice(U).concat(X.slice(0,U))).push(X[0]);var K=X.map(function(e){return e.id()}).join(",");-1===B.indexOf(K)&&(p.push(o.spawn(X)),B.push(K))}}else break}return{distanceTo:function(e){return v(y(e)).dist},pathTo:function(e){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i,n=y(e),a=[],s=n;;){if(null==s)return t.spawn();var l=v(s),u=l.edge,c=l.pred;if(a.unshift(s[0]),s.same(r)&&a.length>0)break;null!=u&&a.unshift(u),s=c}return o.spawn(a)},hasNegativeWeightCycle:f,negativeWeightCycles:p}}},{kargerStein:function(){var e=this,t=this.byGroup(),r=t.nodes,n=t.edges;n.unmergeBy(function(e){return e.isLoop()});var a=r.length,i=n.length,o=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),s=Math.floor(a/rG);if(a<2)return void rN("At least 2 nodes are required for Karger-Stein algorithm");for(var l=[],u=0;u<i;u++){var c=n[u];l.push([u,r.indexOf(c.source()),r.indexOf(c.target())])}for(var d=1/0,h=[],f=Array(a),p=Array(a),g=Array(a),v=function(e,t){for(var r=0;r<a;r++)t[r]=e[r]},y=0;y<=o;y++){for(var x=0;x<a;x++)p[x]=x;var b=rQ(p,l.slice(),a,s),w=b.slice();v(p,g);var j=rQ(p,b,s,2),N=rQ(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 n[e[0]]})),C=this.spawn(),E=this.spawn(),S=f[0],T=0;T<f.length;T++){var P=f[T],_=r[T];P===S?C.merge(_):E.merge(_)}var D=function(t){var r=e.spawn();return t.forEach(function(t){r.merge(t),t.connectedEdges().forEach(function(t){e.contains(t)&&!k.contains(t)&&r.merge(t)})}),r};return{cut:k,components:[D(C),D(E)],partition1:C,partition2:E}}},{pageRank:function(e){for(var t,r=nU(e),n=r.dampingFactor,a=r.precision,i=r.iterations,o=r.weight,s=this._private.cy,l=this.byGroup(),u=l.nodes,c=l.edges,d=u.length,h=d*d,f=c.length,p=Array(h),g=Array(d),v=(1-n)/d,y=0;y<d;y++){for(var x=0;x<d;x++)p[y*d+x]=0;g[y]=0}for(var b=0;b<f;b++){var w=c[b],j=w.data("source"),N=w.data("target");if(j!==N){var k=u.indexOfId(j),C=u.indexOfId(N),E=o(w),S=C*d+k;p[S]+=E,g[k]+=E}}for(var T=1/d+v,P=0;P<d;P++)if(0===g[P])for(var _=0;_<d;_++)p[_*d+P]=T;else for(var D=0;D<d;D++){var B=D*d+P;p[B]=p[B]/g[P]+v}for(var M=Array(d),A=Array(d),R=0;R<d;R++)M[R]=1;for(var I=0;I<i;I++){for(var L=0;L<d;L++)A[L]=0;for(var O=0;O<d;O++)for(var z=0;z<d;z++){var V=O*d+z;A[O]+=p[V]*M[z]}nt(A),t=M,M=A,A=t;for(var F=0,H=0;H<d;H++){var q=t[H]-M[H];F+=q*q}if(F<a)break}return{rank:function(e){return e=s.collection(e)[0],M[u.indexOf(e)]}}}},nK,nZ,nJ,{markovClustering:at,mcl:at},{kMeans:function(e){var t,r=this.cy(),n=this.nodes(),a=null,i=ah(e),o=Array(i.k),s={};i.testMode?"number"==typeof i.testCentroids?(i.testCentroids,t=ap(n,i.k,i.attributes)):t="object"===tm(i.testCentroids)?i.testCentroids:ap(n,i.k,i.attributes):t=ap(n,i.k,i.attributes);for(var l=!0,u=0;l&&u<i.maxIterations;){for(var c=0;c<n.length;c++)s[(a=n[c]).id()]=ag(a,t,i.distance,i.attributes,"kMeans");l=!1;for(var d=0;d<i.k;d++){var h=am(d,n,s);if(0!==h.length){for(var f=i.attributes.length,p=t[d],g=Array(f),v=Array(f),y=0;y<f;y++){v[y]=0;for(var x,b=0;b<h.length;b++)a=h[b],v[y]+=i.attributes[y](a);g[y]=v[y]/h.length,x=g[y],Math.abs(p[y]-x)<=i.sensitivityThreshold||(l=!0)}t[d]=g,o[d]=r.collection(h)}}u++}return o},kMedoids:function(e){var t,r,n=this.cy(),a=this.nodes(),i=null,o=ah(e),s=Array(o.k),l={},u=Array(o.k);o.testMode?"number"==typeof o.testCentroids||(t="object"===tm(o.testCentroids)?o.testCentroids:ax(a,o.k)):t=ax(a,o.k);for(var c=!0,d=0;c&&d<o.maxIterations;){for(var h=0;h<a.length;h++)l[(i=a[h]).id()]=ag(i,t,o.distance,o.attributes,"kMedoids");c=!1;for(var f=0;f<t.length;f++){var p=am(f,a,l);if(0!==p.length){u[f]=ab(t[f],p,o.attributes);for(var g=0;g<p.length;g++)(r=ab(p[g],p,o.attributes))<u[f]&&(u[f]=r,t[f]=p[g],c=!0);s[f]=n.collection(p)}}d++}return s},fuzzyCMeans:ak,fcm:ak},{hierarchicalClustering:aB,hca:aB},{affinityPropagation:aV,ap:aV},{hierholzer:function(e){if(!tT(e)){var t,r,n,a=arguments;e={root:a[0],directed:a[1]}}var i=aF(e),o=i.root,s=i.directed,l=!1;o&&(n=tC(o)?this.filter(o)[0].id():o[0].id());var u={},c={};s?this.forEach(function(e){var n=e.id();if(e.isNode()){var a=e.indegree(!0),i=e.outdegree(!0),o=a-i,s=i-a;1==o?t?l=!0:t=n:1==s?r?l=!0:r=n:(s>1||o>1)&&(l=!0),u[n]=[],e.outgoers().forEach(function(e){e.isEdge()&&u[n].push(e.id())})}else c[n]=[void 0,e.target().id()]}):this.forEach(function(e){var n=e.id();e.isNode()?(e.degree(!0)%2&&(t?r?l=!0:r=n:t=n),u[n]=[],e.connectedEdges().forEach(function(e){return u[n].push(e.id())})):c[n]=[e.source().id(),e.target().id()]});var d={found:!1,trail:void 0};if(l)return d;if(r&&t)if(s){if(n&&r!=n)return d;n=r}else{if(n&&r!=n&&t!=n)return d;n||(n=r)}else n||(n=this[0].id());var h=function(e){for(var t,r,n,a=e,i=[e];u[a].length;)r=c[t=u[a].shift()][0],a!=(n=c[t][1])?(u[n]=u[n].filter(function(e){return e!=t}),a=n):s||a==r||(u[r]=u[r].filter(function(e){return e!=t}),a=r),i.unshift(t),i.unshift(a);return i},f=[],p=[];for(p=h(n);1!=p.length;)0==u[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())),u)if(u[g].length)return d;return d.found=!0,d.trail=this.spawn(f,!0),d}},{hopcroftTarjanBiconnected:aH,htbc:aH,htb:aH,hopcroftTarjanBiconnectedComponents:aH},{tarjanStronglyConnected:aq,tsc:aq,tscc:aq,tarjanStronglyConnectedComponents:aq}].forEach(function(e){tG(aX,e)});var aY=function(e){if(!(this instanceof aY))return new aY(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))};aY.prototype={fulfill:function(e){return aW(this,1,"fulfillValue",e)},reject:function(e){return aW(this,2,"rejectReason",e)},then:function(e,t){var r=new aY;return this.onFulfilled.push(aK(e,r,"fulfill")),this.onRejected.push(aK(t,r,"reject")),aU(this),r.proxy}};var aW=function(e,t,r,n){return 0===e.state&&(e.state=t,e[r]=n,aU(e)),e},aU=function(e){1===e.state?a$(e,"onFulfilled",e.fulfillValue):2===e.state&&a$(e,"onRejected",e.rejectReason)},a$=function(e,t,r){if(0!==e[t].length){var n=e[t];e[t]=[];var a=function(){for(var e=0;e<n.length;e++)n[e](r)};"function"==typeof setImmediate?setImmediate(a):setTimeout(a,0)}},aK=function(e,t,r){return function(n){if("function"!=typeof e)t[r].call(t,n);else{var a;try{a=e(n)}catch(e){t.reject(e);return}aG(t,a)}}},aG=function(e,t){if(e===t||e.proxy===t)return void e.reject(TypeError("cannot resolve promise with itself"));if("object"===tm(t)&&null!==t||"function"==typeof t)try{r=t.then}catch(t){e.reject(t);return}if("function"==typeof r){var r,n=!1;try{r.call(t,function(r){n||(n=!0,r===t?e.reject(TypeError("circular thenable chain")):aG(e,r))},function(t){n||(n=!0,e.reject(t))})}catch(t){n||e.reject(t)}return}e.fulfill(t)};aY.all=function(e){return new aY(function(t,r){for(var n=Array(e.length),a=0,i=function(r,i){n[r]=i,++a===e.length&&t(n)},o=0;o<e.length;o++)!function(t){var n=e[t];null!=n&&null!=n.then?n.then(function(e){i(t,e)},function(e){r(e)}):i(t,n)}(o)})},aY.resolve=function(e){return new aY(function(t,r){t(e)})},aY.reject=function(e){return new aY(function(t,r){r(e)})};var aZ="undefined"!=typeof Promise?Promise:aY,aQ=function(e,t,r){var n=tA(e),a=this._private=tG({duration:1e3},t,r);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&tE(a.complete)&&a.completes.push(a.complete),!n){var i=e.position();a.startPosition=a.startPosition||{x:i.x,y:i.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(n){var o=e.pan();a.startPan={x:o.x,y:o.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},aJ=aQ.prototype;function a0(){return lx?ly:(lx=1,ly=Array.isArray)}function a1(){if(lR)return lA;lR=1;var e=function(){if(lD)return l_;lD=1;var e=function(){if(lN)return lj;lN=1;var e=t8(),t=t6();return lj=function(r){if(!t(r))return!1;var n=e(r);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}(),t=function(){if(lS)return lE;lS=1;var e,t=lC?lk:(lC=1,lk=t7()["__core-js_shared__"]),r=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return lE=function(e){return!!r&&r in e}}(),r=t6(),n=function(){if(lP)return lT;lP=1;var e=Function.prototype.toString;return lT=function(t){if(null!=t){try{return e.call(t)}catch(e){}try{return t+""}catch(e){}}return""}}(),a=/^\[object .+?Constructor\]$/,i=Object.prototype,o=Function.prototype.toString,s=i.hasOwnProperty,l=RegExp("^"+o.call(s).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return l_=function(i){return!(!r(i)||t(i))&&(e(i)?l:a).test(n(i))}}(),t=lM?lB:(lM=1,lB=function(e,t){return null==e?void 0:e[t]});return lA=function(r,n){var a=t(r,n);return e(a)?a:void 0}}function a2(){return lL?lI:(lL=1,lI=a1()(Object,"create"))}function a5(){return lJ?lQ:(lJ=1,lQ=function(e,t){return e===t||e!=e&&t!=t})}function a3(){if(l1)return l0;l1=1;var e=a5();return l0=function(t,r){for(var n=t.length;n--;)if(e(t[n][0],r))return n;return -1}}function a4(){if(uu)return ul;uu=1;var e=us?uo:(us=1,uo=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e});return ul=function(t,r){var n=t.__data__;return e(r)?n["string"==typeof r?"string":"hash"]:n.map}}function a6(){if(uC)return uk;uC=1;var e=function(){if(uN)return uj;uN=1;var e=function(){if(uw)return ub;uw=1;var e=function(){if(ux)return uy;ux=1;var e=function(){if(ui)return ua;ui=1;var e=function(){if(lK)return l$;lK=1;var e=function(){if(lz)return lO;lz=1;var e=a2();return lO=function(){this.__data__=e?e(null):{},this.size=0}}(),t=lF?lV:(lF=1,lV=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t}),r=function(){if(lq)return lH;lq=1;var e=a2(),t=Object.prototype.hasOwnProperty;return lH=function(r){var n=this.__data__;if(e){var a=n[r];return"__lodash_hash_undefined__"===a?void 0:a}return t.call(n,r)?n[r]:void 0}}(),n=function(){if(lY)return lX;lY=1;var e=a2(),t=Object.prototype.hasOwnProperty;return lX=function(r){var n=this.__data__;return e?void 0!==n[r]:t.call(n,r)}}(),a=function(){if(lU)return lW;lU=1;var e=a2();return lW=function(t,r){var n=this.__data__;return this.size+=+!this.has(t),n[t]=e&&void 0===r?"__lodash_hash_undefined__":r,this}}();function i(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=r,i.prototype.has=n,i.prototype.set=a,l$=i}(),t=function(){if(ut)return ue;ut=1;var e=lZ?lG:(lZ=1,lG=function(){this.__data__=[],this.size=0}),t=function(){if(l5)return l2;l5=1;var e=a3(),t=Array.prototype.splice;return l2=function(r){var n=this.__data__,a=e(n,r);return!(a<0)&&(a==n.length-1?n.pop():t.call(n,a,1),--this.size,!0)}}(),r=function(){if(l4)return l3;l4=1;var e=a3();return l3=function(t){var r=this.__data__,n=e(r,t);return n<0?void 0:r[n][1]}}(),n=function(){if(l7)return l6;l7=1;var e=a3();return l6=function(t){return e(this.__data__,t)>-1}}(),a=function(){if(l8)return l9;l8=1;var e=a3();return l9=function(t,r){var n=this.__data__,a=e(n,t);return a<0?(++this.size,n.push([t,r])):n[a][1]=r,this}}();function i(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=r,i.prototype.has=n,i.prototype.set=a,ue=i}(),r=un?ur:(un=1,ur=a1()(t7(),"Map"));return ua=function(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}}(),t=function(){if(ud)return uc;ud=1;var e=a4();return uc=function(t){var r=e(this,t).delete(t);return this.size-=!!r,r}}(),r=function(){if(uf)return uh;uf=1;var e=a4();return uh=function(t){return e(this,t).get(t)}}(),n=function(){if(ug)return up;ug=1;var e=a4();return up=function(t){return e(this,t).has(t)}}(),a=function(){if(uv)return um;uv=1;var e=a4();return um=function(t,r){var n=e(this,t),a=n.size;return n.set(t,r),this.size+=+(n.size!=a),this}}();function i(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=r,i.prototype.has=n,i.prototype.set=a,uy=i}();function t(r,n){if("function"!=typeof r||null!=n&&"function"!=typeof n)throw TypeError("Expected a function");var a=function(){var e=arguments,t=n?n.apply(this,e):e[0],i=a.cache;if(i.has(t))return i.get(t);var o=r.apply(this,e);return a.cache=i.set(t,o)||i,o};return a.cache=new(t.Cache||e),a}return t.Cache=e,ub=t}();return uj=function(t){var r=e(t,function(e){return 500===n.size&&n.clear(),e}),n=r.cache;return r}}(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g;return uk=e(function(e){var n=[];return 46===e.charCodeAt(0)&&n.push(""),e.replace(t,function(e,t,a,i){n.push(a?i.replace(r,"$1"):t||e)}),n})}function a7(){return uS?uE:(uS=1,uE=function(e,t){for(var r=-1,n=null==e?0:e.length,a=Array(n);++r<n;)a[r]=t(e[r],r,e);return a})}function a9(){if(uD)return u_;uD=1;var e=function(){if(uP)return uT;uP=1;var e=t9(),t=a7(),r=a0(),n=re(),a=e?e.prototype:void 0,i=a?a.toString:void 0;return uT=function e(a){if("string"==typeof a)return a;if(r(a))return t(a,e)+"";if(n(a))return i?i.call(a):"";var o=a+"";return"0"==o&&1/a==-1/0?"-0":o}}();return u_=function(t){return null==t?"":e(t)}}function a8(){if(uM)return uB;uM=1;var e=a0(),t=function(){if(lw)return lb;lw=1;var e=a0(),t=re(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;return lb=function(a,i){if(e(a))return!1;var o=typeof a;return!!("number"==o||"symbol"==o||"boolean"==o||null==a||t(a))||n.test(a)||!r.test(a)||null!=i&&a in Object(i)}}(),r=a6(),n=a9();return uB=function(a,i){return e(a)?a:t(a,i)?[a]:r(n(a))}}function ie(){if(uR)return uA;uR=1;var e=re();return uA=function(t){if("string"==typeof t||e(t))return t;var r=t+"";return"0"==r&&1/t==-1/0?"-0":r}}tG(aJ,{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),tD(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,r=t.playing;return void 0===e?t.progress:(r&&this.pause(),t.progress=e,t.started=!1,r&&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 r=function(t,r){var n=e[t];null!=n&&(e[t]=e[r],e[r]=n)};if(r("zoom","startZoom"),r("pan","startPan"),r("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var a=e.style[n],i=a.name,o=e.startStyle[i];e.startStyle[i]=a,e.style[n]=o}return t&&this.play(),this},promise:function(e){var t,r=this._private;return t="frame"===e?r.frames:r.completes,new aZ(function(e,r){t.push(function(){e()})})}}),aJ.complete=aJ.completed,aJ.run=aJ.play,aJ.running=aJ.playing;var it=t4(function(){if(uz)return uO;uz=1;var e=function(){if(uL)return uI;uL=1;var e=a8(),t=ie();return uI=function(r,n){n=e(n,r);for(var a=0,i=n.length;null!=r&&a<i;)r=r[t(n[a++])];return a&&a==i?r:void 0}}();return uO=function(t,r,n){var a=null==t?void 0:e(t,r);return void 0===a?n:a}}()),ir=t4(function(){if(uZ)return uG;uZ=1;var e=function(){if(uK)return u$;uK=1;var e=function(){if(uY)return uX;uY=1;var e=function(){if(uq)return uH;uq=1;var e=function(){if(uF)return uV;uF=1;var e=a1();return uV=function(){try{var t=e(Object,"defineProperty");return t({},"",{}),t}catch(e){}}()}();return uH=function(t,r,n){"__proto__"==r&&e?e(t,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[r]=n}}(),t=a5(),r=Object.prototype.hasOwnProperty;return uX=function(n,a,i){var o=n[a];r.call(n,a)&&t(o,i)&&(void 0!==i||a in n)||e(n,a,i)}}(),t=a8(),r=function(){if(uU)return uW;uU=1;var e=/^(?:0|[1-9]\d*)$/;return uW=function(t,r){var n=typeof t;return!!(r=null==r?0x1fffffffffffff:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}}(),n=t6(),a=ie();return u$=function(i,o,s,l){if(!n(i))return i;o=t(o,i);for(var u=-1,c=o.length,d=c-1,h=i;null!=h&&++u<c;){var f=a(o[u]),p=s;if("__proto__"===f||"constructor"===f||"prototype"===f)break;if(u!=d){var g=h[f];void 0===(p=l?l(g,f,h):void 0)&&(p=n(g)?g:r(o[u+1])?[]:{})}e(h,f,p),h=h[f]}return i}}();return uG=function(t,r,n){return null==t?t:e(t,r,n)}}()),ia=t4(function(){if(u1)return u0;u1=1;var e=a7(),t=uJ?uQ:(uJ=1,uQ=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}),r=a0(),n=re(),a=a6(),i=ie(),o=a9();return u0=function(s){return r(s)?e(s,i):n(s)?[s]:t(a(o(s)))}}()),ii={};[{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 r=void 0!==this.length,n=r?this:[this],a=this._private.cy||this,i=!r,o=!i;if(!a.styleEnabled())return this;var s=a.style();if(0===Object.keys(e=tG({},e,t)).length)return new aQ(n[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,u=a.pan(),c=a.zoom();e.position=r0(l,c,u)}if(i&&null!=e.panBy){var d=e.panBy,h=a.pan();e.pan={x:h.x+d.x,y:h.y+d.y}}var f=e.center||e.centre;if(i&&null!=f){var p=a.getCenterPan(f.eles,e.zoom);null!=p&&(e.pan=p)}if(i&&null!=e.fit){var g=e.fit,v=a.getFitViewport(g.eles||g.boundingBox,g.padding);null!=v&&(e.pan=v.pan,e.zoom=v.zoom)}if(i&&tT(e.zoom)){var y=a.getZoomedViewport(e.zoom);null!=y?(y.zoomed&&(e.zoom=y.zoom),y.panned&&(e.pan=y.pan)):e.zoom=null}return new aQ(n[0],e)}},animate:function(){return function(e,t){var r=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=tG({},e,t));for(var n=0;n<r.length;n++){var a=r[n],i=a.animated()&&(void 0===e.queue||e.queue);a.animation(e,i?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var r=void 0!==this.length?this:[this],n=this._private.cy||this;if(!n.styleEnabled())return this;for(var a=0;a<r.length;a++){for(var i=r[a]._private,o=i.animation.current,s=0;s<o.length;s++){var l=o[s]._private;t&&(l.duration=0)}e&&(i.animation.queue=[]),t||(i.animation.current=[])}return n.notify("draw"),this}}},{data:function(e){return e=tG({},{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,r){var n,a=e,i=void 0!==this.length,o=i?this:[this],s=i?this[0]:this;if(tC(t)){var l,u=-1!==t.indexOf(".")&&ia(t);if(a.allowGetting&&void 0===r)return s&&(a.beforeGet(s),l=u&&void 0===s._private[a.field][t]?it(s._private[a.field],u):s._private[a.field][t]),l;if(a.allowSetting&&void 0!==r&&!a.immutableKeys[t]){var c=th({},t,r);a.beforeSet(this,c);for(var d=0,h=o.length;d<h;d++){var f=o[d];a.canSet(f)&&(u&&void 0===s._private[a.field][t]?ir(f._private[a.field],u,r):f._private[a.field][t]=r)}a.updateStyle&&this.updateStyle(),a.onSet(this),a.settingTriggersEvent&&this[a.triggerFnName](a.settingEvent)}}else if(a.allowSetting&&tT(t)){var p,g,v=Object.keys(t);a.beforeSet(this,t);for(var y=0;y<v.length;y++)if(g=t[p=v[y]],!a.immutableKeys[p])for(var x=0;x<o.length;x++){var b=o[x];a.canSet(b)&&(b._private[a.field][p]=g)}a.updateStyle&&this.updateStyle(),a.onSet(this),a.settingTriggersEvent&&this[a.triggerFnName](a.settingEvent)}else if(a.allowBinding&&tE(t))this.on(a.bindingEvent,t);else if(a.allowGetting&&void 0===t)return s&&(a.beforeGet(s),n=s._private[a.field]),n;return this}},removeData:function(e){return e=tG({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var r=e,n=void 0!==this.length?this:[this];if(tC(t)){for(var a=t.split(/\s+/),i=a.length,o=0;o<i;o++){var s=a[o];if(!tI(s)&&!r.immutableKeys[s])for(var l=0,u=n.length;l<u;l++)n[l]._private[r.field][s]=void 0}r.triggerEvent&&this[r.triggerFnName](r.event)}else if(void 0===t){for(var c=0,d=n.length;c<d;c++)for(var h=n[c]._private[r.field],f=Object.keys(h),p=0;p<f.length;p++){var g=f[p];r.immutableKeys[g]||(h[g]=void 0)}r.triggerEvent&&this[r.triggerFnName](r.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 r=this,n=Array.prototype.slice.call(arguments,0);return new aZ(function(e,t){var a=n.concat([function(t){r.off.apply(r,i),e(t)}]),i=a.concat([]);r.on.apply(r,a)})}}}].forEach(function(e){tG(ii,e)});var io={animate:ii.animate(),animation:ii.animation(),animated:ii.animated(),clearQueue:ii.clearQueue(),delay:ii.delay(),delayAnimation:ii.delayAnimation(),stop:ii.stop()},is={classes:function(e){if(void 0===e){var t=[];return this[0]._private.classes.forEach(function(e){return t.push(e)}),t}tS(e)||(e=(e||"").match(/\S+/g)||[]);for(var r=[],n=new rz(e),a=0;a<this.length;a++){for(var i=this[a],o=i._private,s=o.classes,l=!1,u=0;u<e.length;u++){var c=e[u];if(!s.has(c)){l=!0;break}}l||(l=s.size!==e.length),l&&(o.classes=n,r.push(i))}return r.length>0&&this.spawn(r).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){tS(e)||(e=e.match(/\S+/g)||[]);for(var r=void 0===t,n=[],a=0,i=this.length;a<i;a++)for(var o=this[a],s=o._private.classes,l=!1,u=0;u<e.length;u++){var c=e[u],d=s.has(c),h=!1;t||r&&!d?(s.add(c),h=!0):(!t||r&&d)&&(s.delete(c),h=!0),!l&&h&&(n.push(o),l=!0)}return n.length>0&&this.spawn(n).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var r=this;if(null==t)t=250;else if(0===t)return r;return r.addClass(e),setTimeout(function(){r.removeClass(e)},t),r}};is.className=is.classNames=is.classes;var il={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:tX,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};for(sK=0,il.variable="(?:[\\w-.]|(?:\\\\"+il.metaChar+"))+",il.className="(?:[\\w-]|(?:\\\\"+il.metaChar+"))+",il.value=il.string+"|"+il.number,il.id=il.variable,sU=il.comparatorOp.split("|");sK<sU.length;sK++)s$=sU[sK],il.comparatorOp+="|@"+s$;for(sK=0,sU=il.comparatorOp.split("|");sK<sU.length;sK++)(s$=sU[sK]).indexOf("!")>=0||"="!==s$&&(il.comparatorOp+="|\\!"+s$);var iu=function(){return{checks:[]}},ic=[{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*tK(e.selector,t.selector)}),id=function(){for(var e,t={},r=0;r<ic.length;r++)t[(e=ic[r]).selector]=e.matches;return t}(),ih="("+ic.map(function(e){return e.selector}).join("|")+")",ip=function(e){return e.replace(RegExp("\\\\("+il.metaChar+")","g"),function(e,t){return t})},ig=function(e,t,r){e[e.length-1]=r},im=[{name:"group",query:!0,regex:"("+il.group+")",populate:function(e,t,r){var n=tf(r,1)[0];t.checks.push({type:0,value:"*"===n?n:n+"s"})}},{name:"state",query:!0,regex:ih,populate:function(e,t,r){var n=tf(r,1)[0];t.checks.push({type:7,value:n})}},{name:"id",query:!0,regex:"\\#("+il.id+")",populate:function(e,t,r){var n=tf(r,1)[0];t.checks.push({type:8,value:ip(n)})}},{name:"className",query:!0,regex:"\\.("+il.className+")",populate:function(e,t,r){var n=tf(r,1)[0];t.checks.push({type:9,value:ip(n)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+il.variable+")\\s*\\]",populate:function(e,t,r){var n=tf(r,1)[0];t.checks.push({type:4,field:ip(n)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+il.variable+")\\s*("+il.comparatorOp+")\\s*("+il.value+")\\s*\\]",populate:function(e,t,r){var n=tf(r,3),a=n[0],i=n[1],o=n[2];o=null!=RegExp("^"+il.string+"$").exec(o)?o.substring(1,o.length-1):parseFloat(o),t.checks.push({type:3,field:ip(a),operator:i,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+il.boolOp+")\\s*("+il.variable+")\\s*\\]",populate:function(e,t,r){var n=tf(r,2),a=n[0],i=n[1];t.checks.push({type:5,field:ip(i),operator:a})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+il.meta+")\\s*("+il.comparatorOp+")\\s*("+il.number+")\\s*\\]\\]",populate:function(e,t,r){var n=tf(r,3),a=n[0],i=n[1],o=n[2];t.checks.push({type:6,field:ip(a),operator:i,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:il.separator,populate:function(e,t){var r=e.currentSubject,n=e.edgeCount,a=e.compoundCount,i=e[e.length-1];return null!=r&&(i.subject=r,e.currentSubject=null),i.edgeCount=n,i.compoundCount=a,e.edgeCount=0,e.compoundCount=0,e[e.length++]=iu()}},{name:"directedEdge",separator:!0,regex:il.directedEdge,populate:function(e,t){if(null==e.currentSubject){var r=iu(),n=iu();return r.checks.push({type:11,source:t,target:n}),ig(e,t,r),e.edgeCount++,n}var a=iu(),i=iu();return a.checks.push({type:12,source:t,target:i}),ig(e,t,a),e.edgeCount++,i}},{name:"undirectedEdge",separator:!0,regex:il.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var r=iu(),n=iu();return r.checks.push({type:10,nodes:[t,n]}),ig(e,t,r),e.edgeCount++,n}var a=iu(),i=iu();return a.checks.push({type:14,node:t,neighbor:i}),ig(e,t,a),i}},{name:"child",separator:!0,regex:il.child,populate:function(e,t){if(null==e.currentSubject){var r=iu(),n=iu(),a=e[e.length-1];return r.checks.push({type:15,parent:a,child:n}),ig(e,t,r),e.compoundCount++,n}if(e.currentSubject===t){var i=iu(),o=e[e.length-1],s=iu(),l=iu(),u=iu(),c=iu();return i.checks.push({type:19,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:20}],c.checks.push({type:20}),s.checks.push({type:17,parent:c,child:u}),ig(e,o,i),e.currentSubject=l,e.compoundCount++,u}var d=iu(),h=iu(),f=[{type:17,parent:d,child:h}];return d.checks=t.checks,t.checks=f,e.compoundCount++,h}},{name:"descendant",separator:!0,regex:il.descendant,populate:function(e,t){if(null==e.currentSubject){var r=iu(),n=iu(),a=e[e.length-1];return r.checks.push({type:16,ancestor:a,descendant:n}),ig(e,t,r),e.compoundCount++,n}if(e.currentSubject===t){var i=iu(),o=e[e.length-1],s=iu(),l=iu(),u=iu(),c=iu();return i.checks.push({type:19,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:20}],c.checks.push({type:20}),s.checks.push({type:18,ancestor:c,descendant:u}),ig(e,o,i),e.currentSubject=l,e.compoundCount++,u}var d=iu(),h=iu(),f=[{type:18,ancestor:d,descendant:h}];return d.checks=t.checks,t.checks=f,e.compoundCount++,h}},{name:"subject",modifier:!0,regex:il.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return rC("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var r=e[e.length-1].checks[0],n=null==r?null:r.type;11===n?r.type=13:10===n&&(r.type=14,r.node=r.nodes[1],r.neighbor=r.nodes[0],r.nodes=null)}}];im.forEach(function(e){return e.regexObj=RegExp("^"+e.regex)});var iv=function(e){for(var t,r,n,a=0;a<im.length;a++){var i=im[a],o=i.name,s=e.match(i.regexObj);if(null!=s){r=s,t=i,n=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:r,name:n,remaining:e}},iy=function(e){var t=e.match(/^\s+/);if(t){var r=t[0];e=e.substring(r.length)}return e},ix=function(e,t,r){var n,a,i,o=tC(e),s=tP(e),l=tC(r),u=!1,c=!1,d=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(a=o||s?""+e:"",i=""+r),u&&(e=a=a.toLowerCase(),r=i=i.toLowerCase()),t){case"*=":n=a.indexOf(i)>=0;break;case"$=":n=a.indexOf(i,a.length-i.length)>=0;break;case"^=":n=0===a.indexOf(i);break;case"=":n=e===r;break;case">":d=!0,n=e>r;break;case">=":d=!0,n=e>=r;break;case"<":d=!0,n=e<r;break;case"<=":d=!0,n=e<=r;break;default:n=!1}return c&&(null!=e||!d)&&(n=!n),n},ib=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}},iw=function(e,t){return e.data(t)},ij=[],iN=function(e,t){return e.checks.every(function(e){return ij[e.type](e,t)})};ij[0]=function(e,t){var r=e.value;return"*"===r||r===t.group()},ij[7]=function(e,t){var r;return r=e.value,id[r](t)},ij[8]=function(e,t){var r=e.value;return t.id()===r},ij[9]=function(e,t){var r=e.value;return t.hasClass(r)},ij[6]=function(e,t){var r=e.field,n=e.operator,a=e.value;return ix(t[r](),n,a)},ij[3]=function(e,t){var r=e.field,n=e.operator,a=e.value;return ix(iw(t,r),n,a)},ij[5]=function(e,t){var r=e.field,n=e.operator;return ib(iw(t,r),n)},ij[4]=function(e,t){var r=e.field;return e.operator,void 0!==iw(t,r)},ij[10]=function(e,t){var r=e.nodes[0],n=e.nodes[1],a=t.source(),i=t.target();return iN(r,a)&&iN(n,i)||iN(n,a)&&iN(r,i)},ij[14]=function(e,t){return iN(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&iN(e.neighbor,t)})},ij[11]=function(e,t){return iN(e.source,t.source())&&iN(e.target,t.target())},ij[12]=function(e,t){return iN(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&iN(e.target,t)})},ij[13]=function(e,t){return iN(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&iN(e.source,t)})},ij[15]=function(e,t){return iN(e.child,t)&&iN(e.parent,t.parent())},ij[17]=function(e,t){return iN(e.parent,t)&&t.children().some(function(t){return iN(e.child,t)})},ij[16]=function(e,t){return iN(e.descendant,t)&&t.ancestors().some(function(t){return iN(e.ancestor,t)})},ij[18]=function(e,t){return iN(e.ancestor,t)&&t.descendants().some(function(t){return iN(e.descendant,t)})},ij[19]=function(e,t){return iN(e.subject,t)&&iN(e.left,t)&&iN(e.right,t)},ij[20]=function(){return!0},ij[1]=function(e,t){return e.value.has(t)},ij[2]=function(e,t){return(0,e.value)(t)};var ik=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||tC(e)&&e.match(/^\s*$/)||(tD(e)?this.addQuery({checks:[{type:1,value:e.collection()}]}):tE(e)?this.addQuery({checks:[{type:2,value:e}]}):tC(e)?this.parse(e)||(this.invalid=!0):rN("A selector must be created from a string; found "))},iC=ik.prototype;[{parse:function(e){var t=this.inputText=e,r=this[0]=iu();for(this.length=1,t=iy(t);;){var n=iv(t);if(null==n.expr)return rC("The selector `"+e+"`is invalid"),!1;var a=n.match.slice(1),i=n.expr.populate(this,r,a);if(!1===i)return!1;if(null!=i&&(r=i),(t=n.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 rC("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return rC("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&rC("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 tC(t)?'"'+t+'"':e(t)},r=function(e){return" "+e+" "},n=function(n,i){var o=n.type,s=n.value;switch(o){case 0:var l=e(s);return l.substring(0,l.length-1);case 3:return"["+n.field+r(e(n.operator))+t(s)+"]";case 5:var u=n.operator,c=n.field;return"["+e(u)+c+"]";case 4:return"["+n.field+"]";case 6:var d=n.operator;return"[["+n.field+r(e(d))+t(s)+"]]";case 7:return s;case 8:return"#"+s;case 9:return"."+s;case 17:case 15:return a(n.parent,i)+r(">")+a(n.child,i);case 18:case 16:return a(n.ancestor,i)+" "+a(n.descendant,i);case 19:var h=a(n.left,i),f=a(n.subject,i),p=a(n.right,i);return h+(h.length>0?" ":"")+f+p;case 20:return""}},a=function(e,t){return e.checks.reduce(function(r,a,i){return r+(t===e&&0===i?"$":"")+n(a,t)},"")},i="",o=0;o<this.length;o++){var s=this[o];i+=a(s,s.subject),this.length>1&&o<this.length-1&&(i+=", ")}return this.toStringCache=i,i}},{matches:function(e){for(var t=0;t<this.length;t++)if(iN(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 r=function(e){for(var r=0;r<t.length;r++)if(iN(t[r],e))return!0;return!1};return null==t.text()&&(r=function(){return!0}),e.filter(r)}}].forEach(function(e){return tG(iC,e)}),iC.text=function(){return this.inputText},iC.size=function(){return this.length},iC.eq=function(e){return this[e]},iC.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},iC.addQuery=function(e){this[this.length++]=e},iC.selector=iC.toString;var iE={allAre:function(e){var t=new ik(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new ik(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var r=0;r<this.length;r++)if(t?e.apply(t,[this[r],r,this]):e(this[r],r,this))return!0;return!1},every:function(e,t){for(var r=0;r<this.length;r++)if(!(t?e.apply(t,[this[r],r,this]):e(this[r],r,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())})}};iE.allAreNeighbours=iE.allAreNeighbors,iE.has=iE.contains,iE.equal=iE.equals=iE.same;var iS=function(e,t){return function(r,n,a,i){if(null==r?o="":tD(r)&&1===r.length&&(o=r.id()),1!==this.length||!o)return e.call(this,r,n,a,i);var o,s=this[0]._private,l=s.traversalCache=s.traversalCache||{},u=l[t]=l[t]||[],c=rh(o),d=u[c];return d||(u[c]=e.call(this,r,n,a,i))}},iT={parent:function(e){var t=[];if(1===this.length){var r=this[0]._private.parent;if(r)return r}for(var n=0;n<this.length;n++){var a=this[n]._private.parent;a&&t.push(a)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],r=this.parent();r.nonempty();){for(var n=0;n<r.length;n++){var a=r[n];t.push(a)}r=r.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,r=0;r<this.length;r++){var n=this[r].parents();t=(t=t||n).intersect(n)}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:iS(function(e){for(var t=[],r=0;r<this.length;r++)for(var n=this[r]._private.children,a=0;a<n.length;a++)t.push(n[a]);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(r){for(var n=0;n<r.length;n++){var a=r[n];t.push(a),a.children().nonempty()&&e(a.children())}}(this.children()),this.spawn(t,!0).filter(e)}};function iP(e,t,r,n){for(var a=[],i=new rz,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];r?a.push(l):o&&n(a,i,l)}for(;a.length>0;){var u=a.shift();t(u),i.add(u.id()),o&&n(a,i,u)}return e}function i_(e,t,r){if(r.isParent())for(var n=r._private.children,a=0;a<n.length;a++){var i=n[a];t.has(i.id())||e.push(i)}}function iD(e,t,r){if(r.isChild()){var n=r._private.parent;t.has(n.id())||e.push(n)}}function iB(e,t,r){iD(e,t,r),i_(e,t,r)}iT.forEachDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return iP(this,e,t,i_)},iT.forEachUp=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return iP(this,e,t,iD)},iT.forEachUpAndDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return iP(this,e,t,iB)},iT.ancestors=iT.parents,(u2=u5={data:ii.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:ii.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ii.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ii.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ii.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ii.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=u2.data,u2.removeAttr=u2.removeData;var iM={};function iA(e){return function(t){if(void 0===t&&(t=!0),0!==this.length)if(!this.isNode()||this.removed())return;else{for(var r=0,n=this[0],a=n._private.edges,i=0;i<a.length;i++){var o=a[i];!t&&o.isLoop()||(r+=e(n,o))}return r}}}function iR(e,t){return function(r){for(var n,a=this.nodes(),i=0;i<a.length;i++){var o=a[i][e](r);void 0!==o&&(void 0===n||t(o,n))&&(n=o)}return n}}tG(iM,{degree:iA(function(e,t){return t.source().same(t.target())?2:1}),indegree:iA(function(e,t){return+!!t.target().same(e)}),outdegree:iA(function(e,t){return+!!t.source().same(e)})}),tG(iM,{minDegree:iR("degree",function(e,t){return e<t}),maxDegree:iR("degree",function(e,t){return e>t}),minIndegree:iR("indegree",function(e,t){return e<t}),maxIndegree:iR("indegree",function(e,t){return e>t}),minOutdegree:iR("outdegree",function(e,t){return e<t}),maxOutdegree:iR("outdegree",function(e,t){return e>t})}),tG(iM,{totalDegree:function(e){for(var t=0,r=this.nodes(),n=0;n<r.length;n++)t+=r[n].degree(e);return t}});var iI=function(e,t,r){for(var n=0;n<e.length;n++){var a=e[n];if(!a.locked()){var i=a._private.position,o={x:null!=t.x?t.x-i.x:0,y:null!=t.y?t.y-i.y:0};a.isParent()&&(0!==o.x||0!==o.y)&&a.children().shift(o,r),a.dirtyBoundingBoxCache()}}},iL={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){iI(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};(u3=u4={position:ii.data(iL),silentPosition:ii.data(tG({},iL,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){iI(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(tT(e))t?this.silentPosition(e):this.position(e);else if(tE(e)){var r=this.cy();r.startBatch();for(var n=0;n<this.length;n++){var a=this[n],i=void 0;(i=e(a,n))&&(t?a.silentPosition(i):a.position(i))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,r){var n;if(tT(e)?(n={x:tP(e.x)?e.x:0,y:tP(e.y)?e.y:0},r=t):tC(e)&&tP(t)&&((n={x:0,y:0})[e]=t),null!=n){var a=this.cy();a.startBatch();for(var i=0;i<this.length;i++){var o=this[i];if(!(a.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),l={x:s.x+n.x,y:s.y+n.y};r?o.silentPosition(l):o.position(l)}}a.endBatch()}return this},silentShift:function(e,t){return tT(e)?this.shift(e,!0):tC(e)&&tP(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var r=this[0],n=this.cy(),a=n.zoom(),i=n.pan(),o=tT(e)?e:void 0,s=void 0!==o||void 0!==t&&tC(e);if(r&&r.isNode())if(!s)return(o=rJ(r.position(),a,i),void 0===e)?o:o[e];else for(var l=0;l<this.length;l++){var u=this[l];void 0!==t?u.position(e,(t-i[e])/a):void 0!==o&&u.position(r0(o,a,i))}else if(!s)return;return this},relativePosition:function(e,t){var r=this[0],n=this.cy(),a=tT(e)?e:void 0,i=void 0!==a||void 0!==t&&tC(e),o=n.hasCompoundNodes();if(r&&r.isNode())if(i)for(var s=0;s<this.length;s++){var l=this[s],u=o?l.parent():null,c=u&&u.length>0;c&&(u=u[0]);var d=c?u.position():{x:0,y:0};void 0!==t?l.position(e,t+d[e]):void 0!==a&&l.position({x:a.x+d.x,y:a.y+d.y})}else{var h=r.position(),f=o?r.parent():null,p=f&&f.length>0;p&&(f=f[0]);var g=p?f.position():{x:0,y:0};return(a={x:h.x-g.x,y:h.y-g.y},void 0===e)?a:a[e]}else if(!i)return;return this}}).modelPosition=u3.point=u3.position,u3.modelPositions=u3.points=u3.positions,u3.renderedPoint=u3.renderedPosition,u3.relativePoint=u3.relativePosition,u6=u7={},u7.renderedBoundingBox=function(e){var t=this.boundingBox(e),r=this.cy(),n=r.zoom(),a=r.pan(),i=t.x1*n+a.x,o=t.x2*n+a.x,s=t.y1*n+a.y,l=t.y2*n+a.y;return{x1:i,x2:o,y1:s,y2:l,w:o-i,h:l-s}},u7.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 r=t._private;r.compoundBoundsClean=!1,r.bbCache=null,e||t.emitAndNotify("bounds")}}),this},u7.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 r=0;r<this.length;r++){var n=this[r],a=n._private;(!a.compoundBoundsClean||e)&&(!function(e){if(e.isParent()){var t=e._private,r=e.children(),n="include"===e.pstyle("compound-sizing-wrt-labels").value,a={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")}},i=r.boundingBox({includeLabels:n,includeOverlays:!1,useCache:!1}),o=t.position;(0===i.w||0===i.h)&&((i={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-i.w/2,i.x2=o.x+i.w/2,i.y1=o.y-i.h/2,i.y2=o.y+i.h/2);var s=a.width.left.value;"px"===a.width.left.units&&a.width.val>0&&(s=100*s/a.width.val);var l=a.width.right.value;"px"===a.width.right.units&&a.width.val>0&&(l=100*l/a.width.val);var u=a.height.top.value;"px"===a.height.top.units&&a.height.val>0&&(u=100*u/a.height.val);var c=a.height.bottom.value;"px"===a.height.bottom.units&&a.height.val>0&&(c=100*c/a.height.val);var d=y(a.width.val-i.w,s,l),h=d.biasDiff,f=d.biasComplementDiff,p=y(a.height.val-i.h,u,c),g=p.biasDiff,v=p.biasComplementDiff;t.autoPadding=function(e,t,r,n){if("%"===r.units)switch(n){case"width":return e>0?r.pfValue*e:0;case"height":return t>0?r.pfValue*t:0;case"average":return e>0&&t>0?r.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?r.pfValue*t:r.pfValue*e:0;case"max":return e>0&&t>0?e>t?r.pfValue*e:r.pfValue*t:0;default:return 0}return"px"===r.units?r.pfValue:0}(i.w,i.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(i.w,a.width.val),o.x=(-h+i.x1+i.x2+f)/2,t.autoHeight=Math.max(i.h,a.height.val),o.y=(-g+i.y1+i.y2+v)/2}function y(e,t,r){var n=0,a=0,i=t+r;return e>0&&i>0&&(n=t/i*e,a=r/i*e),{biasDiff:n,biasComplementDiff:a}}}(n),t.batching()||(a.compoundBoundsClean=!0))}return this};var iO=function(e){return e===1/0||e===-1/0?0:e},iz=function(e,t,r,n,a){n-t==0||a-r==0||null!=t&&null!=r&&null!=n&&null!=a&&(e.x1=t<e.x1?t:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=r<e.y1?r:e.y1,e.y2=a>e.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},iV=function(e,t){return null==t?e:iz(e,t.x1,t.y1,t.x2,t.y2)},iF=function(e,t,r){return rA(e,t,r)},iH=function(e,t,r){if(!t.cy().headless()){var n,a,i=t._private,o=i.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(r+"-arrow-shape").value){"source"===r?(n=o.srcX,a=o.srcY):"target"===r?(n=o.tgtX,a=o.tgtY):(n=o.midX,a=o.midY);var l=i.arrowBounds=i.arrowBounds||{},u=l[r]=l[r]||{};u.x1=n-s,u.y1=a-s,u.x2=n+s,u.y2=a+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,nc(u,1),iz(e,u.x1,u.y1,u.x2,u.y2)}}},iq=function(e,t,r){if(!t.cy().headless()){i=r?r+"-":"";var n=t._private,a=n.rstyle;if(t.pstyle(i+"label").strValue){var i,o,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=iF(a,"labelWidth",r),f=iF(a,"labelHeight",r),p=iF(a,"labelX",r),g=iF(a,"labelY",r),v=t.pstyle(i+"text-margin-x").pfValue,y=t.pstyle(i+"text-margin-y").pfValue,x=t.isEdge(),b=t.pstyle(i+"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(x)o=p-k,s=p+k,l=g-C,u=g+C;else{switch(c.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,u=g;break;case"center":l=g-C,u=g+C;break;case"bottom":l=g,u=g+f}}var E=v-Math.max(w,j)-N-2,S=v+Math.max(w,j)+N+2,T=y-Math.max(w,j)-N-2,P=y+Math.max(w,j)+N+2;o+=E,s+=S,l+=T,u+=P;var _=r||"main",D=n.labelBounds,B=D[_]=D[_]||{};B.x1=o,B.y1=l,B.x2=s,B.y2=u,B.w=s-o,B.h=u-l,B.leftPad=E,B.rightPad=S,B.topPad=T,B.botPad=P;var M=x&&"autorotate"===b.strValue,A=null!=b.pfValue&&0!==b.pfValue;if(M||A){var R=M?iF(n.rstyle,"labelAngle",r):b.pfValue,I=Math.cos(R),L=Math.sin(R),O=(o+s)/2,z=(l+u)/2;if(!x){switch(c.value){case"left":O=s;break;case"right":O=o}switch(d.value){case"top":z=u;break;case"bottom":z=l}}var V=function(e,t){return{x:(e-=O)*I-(t-=z)*L+O,y:e*L+t*I+z}},F=V(o,l),H=V(o,u),q=V(s,l),X=V(s,u);o=Math.min(F.x,H.x,q.x,X.x),s=Math.max(F.x,H.x,q.x,X.x),l=Math.min(F.y,H.y,q.y,X.y),u=Math.max(F.y,H.y,q.y,X.y)}var Y=_+"Rot",W=D[Y]=D[Y]||{};W.x1=o,W.y1=l,W.x2=s,W.y2=u,W.w=s-o,W.h=u-l,iz(e,o,l,s,u),iz(n.labelBounds.all,o,l,s,u)}return e}},iX=function(e,t){if(!t.cy().headless()){var r=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value+t.pstyle("outline-offset").value;iY(e,t,r,n,"outside",n/2)}},iY=function(e,t,r,n,a,i){if(0!==r&&!(n<=0)&&"inside"!==a){var o=t.cy(),s=t.pstyle("shape").value,l=o.renderer().nodeShapes[s],u=t.position(),c=u.x,d=u.y,h=t.width(),f=t.height();l.hasMiterBounds?("center"===a&&(n/=2),iV(e,l.miterBounds(c,d,h,f,n))):null!=i&&i>0&&nd(e,[i,i,i,i])}},iW=function(e,t){if(!t.cy().headless()){var r=t.pstyle("border-opacity").value,n=t.pstyle("border-width").pfValue,a=t.pstyle("border-position").value;iY(e,t,r,n,a)}},iU=function(e,t){var r=e._private.cy,n=r.styleEnabled(),a=r.headless(),i=no(),o=e._private,s=e.isNode(),l=e.isEdge(),u=o.rstyle,c=s&&n?e.pstyle("bounds-expansion").pfValue:[0],d=function(e){return"none"!==e.pstyle("display").value},h=!n||d(e)&&(!l||d(e.source())&&d(e.target()));if(h){var f=0;n&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(f=e.pstyle("overlay-padding").value);var p=0;n&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(p=e.pstyle("underlay-padding").value);var g=Math.max(f,p),v=0;if(n&&(v=e.pstyle("width").pfValue/2),s&&t.includeNodes){var y=e.position();C=y.x,E=y.y;var x=e.outerWidth()/2,b=e.outerHeight()/2;w=C-x,j=C+x,iz(i,w,N=E-b,j,k=E+b),n&&iX(i,e),n&&t.includeOutlines&&!a&&iX(i,e),n&&iW(i,e)}else if(l&&t.includeEdges)if(n&&!a){var w,j,N,k,C,E,S,T=e.pstyle("curve-style").strValue;if(w=Math.min(u.srcX,u.midX,u.tgtX),j=Math.max(u.srcX,u.midX,u.tgtX),N=Math.min(u.srcY,u.midY,u.tgtY),k=Math.max(u.srcY,u.midY,u.tgtY),w-=v,j+=v,iz(i,w,N-=v,j,k+=v),"haystack"===T){var P=u.haystackPts;if(P&&2===P.length){if(w=P[0].x,N=P[0].y,j=P[1].x,k=P[1].y,w>j){var _=w;w=j,j=_}if(N>k){var D=N;N=k,k=D}iz(i,w-v,N-v,j+v,k+v)}}else if("bezier"===T||"unbundled-bezier"===T||tq(T,"segments")||tq(T,"taxi")){switch(T){case"bezier":case"unbundled-bezier":S=u.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":S=u.linePts}if(null!=S)for(var B=0;B<S.length;B++){var M=S[B];w=M.x-v,j=M.x+v,iz(i,w,N=M.y-v,j,k=M.y+v)}}}else{var A=e.source().position(),R=e.target().position();if(w=A.x,j=R.x,N=A.y,k=R.y,w>j){var I=w;w=j,j=I}if(N>k){var L=N;N=k,k=L}w-=v,j+=v,iz(i,w,N-=v,j,k+=v)}if(n&&t.includeEdges&&l&&(iH(i,e,"mid-source"),iH(i,e,"mid-target"),iH(i,e,"source"),iH(i,e,"target")),n&&"yes"===e.pstyle("ghost").value){var O=e.pstyle("ghost-offset-x").pfValue,z=e.pstyle("ghost-offset-y").pfValue;iz(i,i.x1+O,i.y1+z,i.x2+O,i.y2+z)}var V=o.bodyBounds=o.bodyBounds||{};nh(V,i),nd(V,c),nc(V,1),n&&(w=i.x1,j=i.x2,N=i.y1,k=i.y2,iz(i,w-g,N-g,j+g,k+g));var F=o.overlayBounds=o.overlayBounds||{};nh(F,i),nd(F,c),nc(F,1);var H=o.labelBounds=o.labelBounds||{};null!=H.all?ns(H.all):H.all=no(),n&&t.includeLabels&&(t.includeMainLabels&&iq(i,e,null),l&&(t.includeSourceLabels&&iq(i,e,"source"),t.includeTargetLabels&&iq(i,e,"target")))}return i.x1=iO(i.x1),i.y1=iO(i.y1),i.x2=iO(i.x2),i.y2=iO(i.y2),i.w=iO(i.x2-i.x1),i.h=iO(i.y2-i.y1),i.w>0&&i.h>0&&h&&(nd(i,c),nc(i,1)),i},i$=function(e){var t=0,r=function(e){return!!e<<t++};return 0+r(e.incudeNodes)+r(e.includeEdges)+r(e.includeLabels)+r(e.includeMainLabels)+r(e.includeSourceLabels)+r(e.includeTargetLabels)+r(e.includeOverlays)+r(e.includeOutlines)},iK=function(e){var t=function(e){return Math.round(e)};if(e.isEdge()){var r=e.source().position(),n=e.target().position();return rd([t(r.x),t(r.y),t(n.x),t(n.y)])}var a=e.position();return rd([t(a.x),t(a.y)])},iG=function(e,t){var r,n=e._private,a=e.isEdge(),i=null==t?iQ:i$(t);if(null==n.bbCache?(n.bbCache=r=iU(e,iZ),n.bbCachePosKey=iK(e)):r=n.bbCache,i!==iQ){var o=e.isNode();r=no(),(t.includeNodes&&o||t.includeEdges&&!o)&&(t.includeOverlays?iV(r,n.overlayBounds):iV(r,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!a||t.includeSourceLabels&&t.includeTargetLabels)?iV(r,n.labelBounds.all):(t.includeMainLabels&&iV(r,n.labelBounds.mainRot),t.includeSourceLabels&&iV(r,n.labelBounds.sourceRot),t.includeTargetLabels&&iV(r,n.labelBounds.targetRot))),r.w=r.x2-r.x1,r.h=r.y2-r.y1}return r},iZ={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},iQ=i$(iZ),iJ=r_(iZ);u7.boundingBox=function(e){var t,r=void 0===e||void 0===e.useCache||!0===e.useCache,n=tO(function(e){var t=e._private;return null==t.bbCache||t.styleDirty||t.bbCachePosKey!==iK(e)},function(e){return e.id()});if(r&&1===this.length&&!n(this[0]))e=void 0===e?iZ:iJ(e),t=iG(this[0],e);else{t=no();var a=iJ(e=e||iZ),i=this.cy().styleEnabled();this.edges().forEach(n),this.nodes().forEach(n),i&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var o=0;o<this.length;o++){var s=this[o];n(s)&&s.dirtyBoundingBoxCache(),iV(t,iG(s,a))}}return t.x1=iO(t.x1),t.y1=iO(t.y1),t.x2=iO(t.x2),t.y2=iO(t.y2),t.w=iO(t.x2-t.x1),t.h=iO(t.y2-t.y1),t},u7.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},u7.boundingBoxAt=function(e){var t,r=this.nodes(),n=this.cy(),a=n.hasCompoundNodes(),i=n.collection();if(a&&(i=r.filter(function(e){return e.isParent()}),r=r.not(i)),tT(e)){var o=e;e=function(){return o}}n.startBatch(),r.forEach(function(t,r){return t._private.bbAtOldPos=e(t,r)}).silentPositions(e),a&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.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 r.silentPositions(function(e){return e._private.bbAtOldPos}),a&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),n.endBatch(),s},u6.boundingbox=u6.bb=u6.boundingBox,u6.renderedBoundingbox=u6.renderedBoundingBox,u9=u8={};var i0=function(e){e.uppercaseName=tH(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=tH(e.outerName),u9[e.name]=function(){var t=this[0],r=t._private,n=r.cy._private.styleEnabled;if(t)if(!n)return 1;else{if(t.isParent())return t.updateCompoundBounds(),r[e.autoName]||0;var a=t.pstyle(e.name);return"label"===a.strValue?(t.recalculateRenderedStyle(),r.rstyle[e.labelName]||0):a.pfValue}},u9["outer"+e.uppercaseName]=function(){var t=this[0],r=t._private.cy._private.styleEnabled;if(t)if(!r)return 1;else{var n=t[e.name](),a=t.pstyle("border-position").value;return n+("center"===a?t.pstyle("border-width").pfValue:"outside"===a?2*t.pstyle("border-width").pfValue:0)+2*t.padding()}},u9["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},u9["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};i0({name:"width"}),i0({name:"height"}),u8.padding=function(){var e=this[0],t=e._private;return e.isParent()&&(e.updateCompoundBounds(),void 0!==t.autoPadding)?t.autoPadding:e.pstyle("padding").pfValue},u8.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},u8.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var i1=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},i2=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var r=e.cy();return rJ(t(e),r.zoom(),r.pan())}},i5=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var r=e.cy(),n=r.pan(),a=r.zoom();return t(e).map(function(e){return rJ(e,a,n)})}},i3={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)}}},i4=tG({},u4,u7,u8,Object.keys(i3).reduce(function(e,t){var r=i3[t],n="rendered"+t[0].toUpperCase()+t.substr(1);return e[t]=function(){return i1(this,r.get)},r.mult?e[n]=function(){return i5(this,r.get)}:e[n]=function(){return i2(this,r.get)},e},{})),i6=function(e,t){this.recycle(e,t)};function i7(){return!1}function i9(){return!0}i6.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=i7,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?i9:i7):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 r=this.position,n=this.cy.zoom(),a=this.cy.pan();this.renderedPosition={x:r.x*n+a.x,y:r.y*n+a.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=i9;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=i9;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=i9,this.stopPropagation()},isDefaultPrevented:i7,isPropagationStopped:i7,isImmediatePropagationStopped:i7};var i8=/^([^.]+)(\.(?:[^.]+))?$/,oe={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},ot=Object.keys(oe),or={};function on(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:or,t=arguments.length>1?arguments[1]:void 0,r=0;r<ot.length;r++){var n=ot[r];this[n]=e[n]||oe[n]}this.context=t||this.context,this.listeners=[],this.emitting=0}var oa=on.prototype,oi=function(e,t,r,n,a,i,o){tE(n)&&(a=n,n=null),o&&(i=null==i?o:tG({},i,o));for(var s=tS(r)?r:r.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!tI(u)){var c=u.match(i8);if(c&&!1===t(e,u,c[1],c[2]?c[2]:null,n,a,i))break}}},oo=function(e,t){return e.addEventFields(e.context,t),new i6(t.type,t)},os=function(e,t,r){if("event"===tk(r))return void t(e,r);if(tT(r))return void t(e,oo(e,r));for(var n=tS(r)?r:r.split(/\s+/),a=0;a<n.length;a++){var i=n[a];if(!tI(i)){var o=i.match(i8);if(o){var s=oo(e,{type:o[1],namespace:o[2]?o[2]:null,target:e.context});t(e,s)}}}};oa.on=oa.addListener=function(e,t,r,n,a){return oi(this,function(e,t,r,n,a,i,o){tE(i)&&e.listeners.push({event:t,callback:i,type:r,namespace:n,qualifier:a,conf:o})},e,t,r,n,a),this},oa.one=function(e,t,r,n){return this.on(e,t,r,n,{one:!0})},oa.removeListener=oa.off=function(e,t,r,n){var a=this;0!==this.emitting&&(this.listeners=this.listeners.slice());for(var i=this.listeners,o=function(o){var s=i[o];oi(a,function(t,r,n,a,l,u){if((s.type===n||"*"===e)&&(!a&&".*"!==s.namespace||s.namespace===a)&&(!l||t.qualifierCompare(s.qualifier,l))&&(!u||s.callback===u))return i.splice(o,1),!1},e,t,r,n)},s=i.length-1;s>=0;s--)o(s);return this},oa.removeAllListeners=function(){return this.removeListener("*")},oa.emit=oa.trigger=function(e,t,r){var n=this.listeners,a=n.length;return this.emitting++,tS(t)||(t=[t]),os(this,function(e,i){null!=r&&(a=(n=[{event:i.event,type:i.type,namespace:i.namespace,callback:r}]).length);for(var o=0;o<a;o++)!function(){var r=n[o];if(r.type===i.type&&(!r.namespace||r.namespace===i.namespace||".*"===r.namespace)&&e.eventMatches(e.context,r,i)){var a=[i];null!=t&&rM(a,t),e.beforeEmit(e.context,r,i),r.conf&&r.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==r}));var s=e.callbackContext(e.context,r,i),l=r.callback.apply(s,a);e.afterEmit(e.context,r,i),!1===l&&(i.stopPropagation(),i.preventDefault())}}();e.bubble(e.context)&&!i.isPropagationStopped()&&e.parent(e.context).emit(i,t)},e),this.emitting--,this};var ol={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,r){var n=t.qualifier;return null==n||e!==r.target&&tB(r.target)&&n.matches(r.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,r){return null!=t.qualifier?r.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()}},ou=function(e){return tC(e)?new ik(e):e},oc={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],r=t._private;r.emitter||(r.emitter=new on(ol,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,r){for(var n=ou(t),a=0;a<this.length;a++)this[a].emitter().on(e,n,r);return this},removeListener:function(e,t,r){for(var n=ou(t),a=0;a<this.length;a++)this[a].emitter().removeListener(e,n,r);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,r){for(var n=ou(t),a=0;a<this.length;a++)this[a].emitter().one(e,n,r);return this},once:function(e,t,r){for(var n=ou(t),a=0;a<this.length;a++)this[a].emitter().on(e,n,r,{once:!0,onceCollection:this})},emit:function(e,t){for(var r=0;r<this.length;r++)this[r].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}};ii.eventAliasesOn(oc);var od={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(),r=0;r<this.length;r++){var n=this[r];n.isNode()?e.push(n):t.push(n)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(tC(e)||tD(e))return new ik(e).filter(this);if(tE(e)){for(var r=this.spawn(),n=0;n<this.length;n++){var a=this[n];(t?e.apply(t,[a,n,this]):e(a,n,this))&&r.push(a)}return r}return this.spawn()},not:function(e){if(!e)return this;tC(e)&&(e=this.filter(e));for(var t=this.spawn(),r=0;r<this.length;r++){var n=this[r];e.has(n)||t.push(n)}return t},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(tC(e))return this.filter(e);for(var t=this.spawn(),r=this.length<e.length,n=r?this:e,a=r?e:this,i=0;i<n.length;i++){var o=n[i];a.has(o)&&t.push(o)}return t},xor:function(e){var t=this._private.cy;tC(e)&&(e=t.$(e));var r=this.spawn(),n=e,a=function(e,t){for(var n=0;n<e.length;n++){var a=e[n],i=a._private.data.id;t.hasElementWithId(i)||r.push(a)}};return a(this,n),a(n,this),r},diff:function(e){var t=this._private.cy;tC(e)&&(e=t.$(e));var r=this.spawn(),n=this.spawn(),a=this.spawn(),i=e,o=function(e,t,r){for(var n=0;n<e.length;n++){var i=e[n],o=i._private.data.id;t.hasElementWithId(o)?a.merge(i):r.push(i)}};return o(this,i,r),o(i,this,n),{left:r,right:n,both:a}},add:function(e){var t=this._private.cy;if(!e)return this;if(tC(e)){var r=e;e=t.mutableElements().filter(r)}for(var n=this.spawnSelf(),a=0;a<e.length;a++){var i=e[a];this.has(i)||n.push(i)}return n},merge:function(e){var t=this._private,r=t.cy;if(!e)return this;if(e&&tC(e)){var n=e;e=r.mutableElements().filter(n)}for(var a=t.map,i=0;i<e.length;i++){var o=e[i],s=o._private.data.id;if(!a.has(s)){var l=this.length++;this[l]=o,a.set(s,{ele:o,index:l})}}return this},unmergeAt:function(e){var t=this[e].id(),r=this._private.map;this[e]=void 0,r.delete(t);var n=e===this.length-1;if(this.length>1&&!n){var a=this.length-1,i=this[a],o=i._private.data.id;this[a]=void 0,this[e]=i,r.set(o,{ele:i,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,r=e._private.data.id,n=t.map.get(r);if(!n)return this;var a=n.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&tC(e)){var r=e;e=t.mutableElements().filter(r)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);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 r=[],n=0;n<this.length;n++){var a=this[n],i=t?e.apply(t,[a,n,this]):e(a,n,this);r.push(i)}return r},reduce:function(e,t){for(var r=t,n=0;n<this.length;n++)r=e(r,this[n],n,this);return r},max:function(e,t){for(var r,n=-1/0,a=0;a<this.length;a++){var i=this[a],o=t?e.apply(t,[i,a,this]):e(i,a,this);o>n&&(n=o,r=i)}return{value:n,ele:r}},min:function(e,t){for(var r,n=1/0,a=0;a<this.length;a++){var i=this[a],o=t?e.apply(t,[i,a,this]):e(i,a,this);o<n&&(n=o,r=i)}return{value:n,ele:r}}};od.u=od["|"]=od["+"]=od.union=od.or=od.add,od["\\"]=od["!"]=od["-"]=od.difference=od.relativeComplement=od.subtract=od.not,od.n=od["&"]=od["."]=od.and=od.intersection=od.intersect,od["^"]=od["(+)"]=od["(-)"]=od.symmetricDifference=od.symdiff=od.xor,od.fnFilter=od.filterFn=od.stdFilter=od.filter,od.complement=od.abscomp=od.absoluteComplement;var oh=function(e,t){var r=e.cy().hasCompoundNodes();function n(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?r?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?ry:0}var a=n(e)-n(t);if(0!==a)return a;function i(e){return"auto"===e.pstyle("z-index-compare").value?+!!e.isNode():0}var o=i(e)-i(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()},of={forEach:function(e,t){if(tE(e))for(var r=this.length,n=0;n<r;n++){var a=this[n];if(!1===(t?e.apply(t,[a,n,this]):e(a,n,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 r=[],n=this.length;null==t&&(t=n),null==e&&(e=0),e<0&&(e=n+e),t<0&&(t=n+t);for(var a=e;a>=0&&a<t&&a<n;a++)r.push(this[a]);return this.spawn(r)},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(!tE(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(oh)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var r=t.data.parent?e.parents().size():0;return e.isParent()?r:ry-1}var n=t.source,a=t.target;return Math.max(n.zDepth(),a.zDepth(),0)}}};of.each=of.forEach,("undefined"==typeof Symbol?"undefined":tm(Symbol))!="undefined"&&"undefined"!=tm(Symbol.iterator)&&(of[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},r=0,n=this.length;return th({next:function(){return r<n?t.value=e[r++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})});var op=r_({nodeDimensionsIncludeLabels:!1}),og={layoutDimensions:function(e){if(e=op(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var t,r=this.boundingBox();t={w:r.w,h:r.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,r){var n=this.nodes().filter(function(e){return!e.isParent()}),a=this.cy(),i=t.eles,o=function(e){return e.id()},s=tO(r,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(e,t,r){var n={x:t.x1+t.w/2,y:t.y1+t.h/2},a={x:(r.x-n.x)*e,y:(r.y-n.y)*e};return{x:n.x+a.x,y:n.y+a.y}},u=t.spacingFactor&&1!==t.spacingFactor,c=function(){if(!u)return null;for(var e=no(),t=0;t<n.length;t++){var r=s(n[t],t);nu(e,r.x,r.y)}return e}(),d=tO(function(e,r){var n=s(e,r);return u&&(n=l(Math.abs(t.spacingFactor),c,n)),null!=t.transform&&(n=t.transform(e,n)),n},o);if(t.animate){for(var h=0;h<n.length;h++){var f=n[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=a.animation({fit:{boundingBox:i.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 y=a.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(y)}e.animations.forEach(function(e){return e.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),aZ.all(e.animations.map(function(e){return e.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(d),t.fit&&a.fit(t.eles,t.padding),null!=t.zoom&&a.zoom(t.zoom),t.pan&&a.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(tG({},e,{eles:this}))}};function om(e,t,r){var n,a=r._private,i=a.styleCache=a.styleCache||[];return null!=(n=i[e])?n:n=i[e]=t(r)}function ov(e,t){return e=rh(e),function(r){return om(e,t,r)}}function oy(e,t){e=rh(e);var r=function(e){return t.call(e)};return function(){var t=this[0];if(t)return om(e,r,t)}}og.createLayout=og.makeLayout=og.layout;var ox={recalculateRenderedStyle:function(e){var t=this.cy(),r=t.renderer(),n=t.styleEnabled();return r&&n&&r.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),r=function(e){return e._private.styleCache=null};return t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(r)):this.forEach(function(e){r(e),e.connectedEdges().forEach(r)}),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 r=t.hasCompoundNodes(),n=this;e=!!e||void 0===e,r&&(n=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var a=n;return e?a.emitAndNotify("style"):a.emit("style"),n.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 r=this[t];r._private.styleDirty&&(r._private.styleDirty=!1,e.style().apply(r))}},parsedStyle:function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=this[0],n=r.cy();if(n.styleEnabled()&&r){r._private.styleDirty&&(r._private.styleDirty=!1,n.style().apply(r));var a=r._private.style[e];return null!=a?a:t?n.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var r=t.pstyle(e);return void 0!==r.pfValue?r.pfValue:r.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 r=this[0];if(r)return t.style().getRenderedStyle(r,e)},style:function(e,t){var r=this.cy();if(!r.styleEnabled())return this;var n=r.style();if(tT(e))n.applyBypass(this,e,!1),this.emitAndNotify("style");else if(tC(e))if(void 0===t){var a=this[0];return a?n.getStylePropertyValue(a,e):void 0}else n.applyBypass(this,e,t,!1),this.emitAndNotify("style");else if(void 0===e){var i=this[0];return i?n.getRawStyle(i):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var r=t.style();if(void 0===e)for(var n=0;n<this.length;n++){var a=this[n];r.removeAllBypasses(a,!1)}else{e=e.split(/\s+/);for(var i=0;i<this.length;i++){var o=this[i];r.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(),r=this[0];if(r){var n=r._private,a=r.pstyle("opacity").value;if(!t)return a;var i=n.data.parent?r.parents():null;if(i)for(var o=0;o<i.length;o++)a*=i[o].pstyle("opacity").value;return a}},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 ob(e,t){var r=e._private.data.parent?e.parents():null;if(r){for(var n=0;n<r.length;n++)if(!t(r[n]))return!1}return!0}function ow(e){var t=e.ok,r=e.edgeOkViaNode||e.ok,n=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var a=this[0],i=e.hasCompoundNodes();if(a){var o=a._private;if(!t(a))return!1;if(a.isNode())return!i||ob(a,n);var s=o.source,l=o.target;return r(s)&&(!i||ob(s,r))&&(s===l||r(l)&&(!i||ob(l,r)))}}}var oj=ov("eleTakesUpSpace",function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())});ox.takesUpSpace=oy("takesUpSpace",ow({ok:oj})),ox.interactive=oy("interactive",ow({ok:ov("eleInteractive",function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&oj(e)}),parentOk:ov("parentInteractive",function(e){return"visible"===e.pstyle("visibility").value&&oj(e)}),edgeOkViaNode:oj})),ox.noninteractive=function(){var e=this[0];if(e)return!e.interactive()},ox.visible=oy("visible",ow({ok:ov("eleVisible",function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&oj(e)}),edgeOkViaNode:oj})),ox.hidden=function(){var e=this[0];if(e)return!e.visible()},ox.isBundledBezier=oy("isBundledBezier",function(){return!!this.cy().styleEnabled()&&!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace()}),ox.bypass=ox.css=ox.style,ox.renderedCss=ox.renderedStyle,ox.removeBypass=ox.removeCss=ox.removeStyle,ox.pstyle=ox.parsedStyle;var oN={};function ok(e){return function(){var t=arguments,r=[];if(2===t.length){var n=t[0],a=t[1];this.on(e.event,n,a)}else if(1===t.length&&tE(t[0])){var i=t[0];this.on(e.event,i)}else if(0===t.length||1===t.length&&tS(t[0])){for(var o=1===t.length?t[0]:null,s=0;s<this.length;s++){var l=this[s],u=!e.ableField||l._private[e.ableField],c=l._private[e.field]!=e.value;if(e.overrideAble){var d=e.overrideAble(l);if(void 0!==d&&(u=d,!d))return this}u&&(l._private[e.field]=e.value,c&&r.push(l))}var h=this.spawn(r);h.updateStyle(),h.emit(e.event),o&&h.emit(o)}return this}}function oC(e){oN[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var r=e.overrideField(t);if(void 0!==r)return r}return t._private[e.field]}},oN[e.on]=ok({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),oN[e.off]=ok({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}oC({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),oC({field:"grabbable",overrideField:function(e){return!(e.cy().autoungrabify()||e.pannable())&&void 0},on:"grabify",off:"ungrabify"}),oC({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),oC({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),oN.deselect=oN.unselect,oN.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},oC({field:"active",on:"activate",off:"unactivate"}),oC({field:"pannable",on:"panify",off:"unpanify"}),oN.inactive=function(){var e=this[0];if(e)return!e._private.active};var oE={},oS=function(e){return function(t){for(var r=[],n=0;n<this.length;n++){var a=this[n];if(a.isNode()){for(var i=!1,o=a.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target();if(e.noIncomingEdges&&c===a&&u!==a||e.noOutgoingEdges&&u===a&&c!==a){i=!0;break}}i||r.push(a)}}return this.spawn(r,!0).filter(t)}},oT=function(e){return function(t){for(var r=[],n=0;n<this.length;n++){var a=this[n];if(a.isNode())for(var i=a.connectedEdges(),o=0;o<i.length;o++){var s=i[o],l=s.source(),u=s.target();e.outgoing&&l===a?(r.push(s),r.push(u)):e.incoming&&u===a&&(r.push(s),r.push(l))}}return this.spawn(r,!0).filter(t)}},oP=function(e){return function(t){for(var r=this,n=[],a={};;){var i=e.outgoing?r.outgoers():r.incomers();if(0===i.length)break;for(var o=!1,s=0;s<i.length;s++){var l=i[s],u=l.id();a[u]||(a[u]=!0,n.push(l),o=!0)}if(!o)break;r=i}return this.spawn(n,!0).filter(t)}};function o_(e){return function(t){for(var r=[],n=0;n<this.length;n++){var a=this[n]._private[e.attr];a&&r.push(a)}return this.spawn(r,!0).filter(t)}}function oD(e){return function(t){var r=[],n=this._private.cy,a=e||{};tC(t)&&(t=n.$(t));for(var i=0;i<t.length;i++)for(var o=t[i]._private.edges,s=0;s<o.length;s++){var l=o[s],u=l._private.data,c=this.hasElementWithId(u.source)&&t.hasElementWithId(u.target),d=t.hasElementWithId(u.source)&&this.hasElementWithId(u.target);if(c||d){if((a.thisIsSrc||a.thisIsTgt)&&(a.thisIsSrc&&!c||a.thisIsTgt&&!d))continue;r.push(l)}}return this.spawn(r,!0)}}function oB(e){return e=tG({},{codirected:!1},e),function(t){for(var r=[],n=this.edges(),a=e,i=0;i<n.length;i++)for(var o=n[i]._private,s=o.source,l=s._private.data.id,u=o.data.target,c=s._private.edges,d=0;d<c.length;d++){var h=c[d],f=h._private.data,p=f.target,g=f.source,v=p===u&&g===l,y=l===p&&u===g;(a.codirected&&v||!a.codirected&&(v||y))&&r.push(h)}return this.spawn(r,!0).filter(t)}}oE.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},tG(oE,{roots:oS({noIncomingEdges:!0}),leaves:oS({noOutgoingEdges:!0}),outgoers:iS(oT({outgoing:!0}),"outgoers"),successors:oP({outgoing:!0}),incomers:iS(oT({incoming:!0}),"incomers"),predecessors:oP({})}),tG(oE,{neighborhood:iS(function(e){for(var t=[],r=this.nodes(),n=0;n<r.length;n++)for(var a=r[n],i=a.connectedEdges(),o=0;o<i.length;o++){var s=i[o],l=s.source(),u=s.target(),c=a===l?u:l;c.length>0&&t.push(c[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)}}),oE.neighbourhood=oE.neighborhood,oE.closedNeighbourhood=oE.closedNeighborhood,oE.openNeighbourhood=oE.openNeighborhood,tG(oE,{source:iS(function(e){var t,r=this[0];return r&&(t=r._private.source||r.cy().collection()),t&&e?t.filter(e):t},"source"),target:iS(function(e){var t,r=this[0];return r&&(t=r._private.target||r.cy().collection()),t&&e?t.filter(e):t},"target"),sources:o_({attr:"source"}),targets:o_({attr:"target"})}),tG(oE,{edgesWith:iS(oD(),"edgesWith"),edgesTo:iS(oD({thisIsSrc:!0}),"edgesTo")}),tG(oE,{connectedEdges:iS(function(e){for(var t=[],r=0;r<this.length;r++){var n=this[r];if(n.isNode())for(var a=n._private.edges,i=0;i<a.length;i++){var o=a[i];t.push(o)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:iS(function(e){for(var t=[],r=0;r<this.length;r++){var n=this[r];n.isEdge()&&(t.push(n.source()[0]),t.push(n.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:iS(oB(),"parallelEdges"),codirectedEdges:iS(oB({codirected:!0}),"codirectedEdges")}),tG(oE,{components:function(e){var t=this,r=t.cy(),n=r.collection(),a=null==e?t.nodes():e.nodes(),i=[];null!=e&&a.empty()&&(a=e.sources());var o=function(e,t){n.merge(e),a.unmerge(e),t.merge(e)};if(a.empty())return t.spawn();do!function(){var e=r.collection();i.push(e);var n=a[0];o(n,e),t.bfs({directed:!1,roots:n,visit:function(t){return o(t,e)}}),e.forEach(function(r){r.connectedEdges().forEach(function(r){t.has(r)&&e.has(r.source())&&e.has(r.target())&&e.merge(r)})})}();while(a.length>0)return i},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),oE.componentsOf=oE.components;var oM=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0===e)return void rN("A collection must have a reference to the core");var a=new rL,i=!1;if(t){if(t.length>0&&tT(t[0])&&!tB(t[0])){i=!0;for(var o=[],s=new rz,l=0,u=t.length;l<u;l++){var c=t[l];null==c.data&&(c.data={});var d=c.data;if(null==d.id)d.id=rS();else if(e.hasElementWithId(d.id)||s.has(d.id))continue;var h=new rV(e,c,!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;(!r||!a.has(v))&&(r&&a.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 rL,t=this.eles,r=0;r<t.length;r++){var n=t[r];e.set(n.id(),{index:r,ele:n})}}},r&&(this._private.map=a),i&&!n&&this.restore()},oA=rV.prototype=oM.prototype=Object.create(Array.prototype);oA.instanceString=function(){return"collection"},oA.spawn=function(e,t){return new oM(this.cy(),e,t)},oA.spawnSelf=function(){return this.spawn(this)},oA.cy=function(){return this._private.cy},oA.renderer=function(){return this._private.cy.renderer()},oA.element=function(){return this[0]},oA.collection=function(){return tM(this)?this:new oM(this._private.cy,[this])},oA.unique=function(){return new oM(this._private.cy,this,!0)},oA.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},oA.getElementById=function(e){e=""+e;var t=this._private.cy,r=this._private.map.get(e);return r?r.ele:new oM(t)},oA.$id=oA.getElementById,oA.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},oA.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},oA.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},oA.json=function(e){var t=this.element(),r=this.cy();if(null==t&&e)return this;if(null!=t){var n=t._private;if(tT(e)){if(r.startBatch(),e.data){t.data(e.data);var a=n.data;if(t.isEdge()){var i=!1,o={},s=e.data.source,l=e.data.target;null!=s&&s!=a.source&&(o.source=""+s,i=!0),null!=l&&l!=a.target&&(o.target=""+l,i=!0),i&&(t=t.move(o))}else{var u="parent"in e.data,c=e.data.parent;u&&(null!=c||null!=a.parent)&&c!=a.parent&&(void 0===c&&(c=null),null!=c&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var d=function(r,a,i){var o=e[r];null!=o&&o!==n[r]&&(o?t[a]():t[i]())};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),r.endBatch(),this}if(void 0===e){var h={data:rE(n.data),position:rE(n.position),group:n.group,removed:n.removed,selected:n.selected,selectable:n.selectable,locked:n.locked,grabbable:n.grabbable,pannable:n.pannable,classes:null};h.classes="";var f=0;return n.classes.forEach(function(e){return h.classes+=0==f++?e:" "+e}),h}}},oA.jsons=function(){for(var e=[],t=0;t<this.length;t++){var r=this[t].json();e.push(r)}return e},oA.clone=function(){for(var e=this.cy(),t=[],r=0;r<this.length;r++){var n=new rV(e,this[r].json(),!1);t.push(n)}return new oM(e,t)},oA.copy=oA.clone,oA.restore=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=this.cy(),n=r._private,a=[],i=[],o=0,s=this.length;o<s;o++){var l=this[o];(!t||l.removed())&&(l.isNode()?a.push(l):i.push(l))}D=a.concat(i);var u=function(){D.splice(B,1),B--};for(B=0;B<D.length;B++){var c=D[B],d=c._private,h=d.data;if(c.clearTraversalCache(),t||d.removed){if(void 0===h.id)h.id=rS();else if(tP(h.id))h.id=""+h.id;else if(tI(h.id)||!tC(h.id)){rN("Can not create element with invalid string ID `"+h.id+"`"),u();continue}else if(r.hasElementWithId(h.id)){rN("Can not create second element with ID `"+h.id+"`"),u();continue}}var f=h.id;if(c.isNode()){var p=d.position;null==p.x&&(p.x=0),null==p.y&&(p.y=0)}if(c.isEdge()){for(var g=["source","target"],v=g.length,y=!1,x=0;x<v;x++){var b=g[x],w=h[b];tP(w)&&(w=h[b]=""+h[b]),null==w||""===w?(rN("Can not create edge `"+f+"` with unspecified "+b),y=!0):r.hasElementWithId(w)||(rN("Can not create edge `"+f+"` with nonexistant "+b+" `"+w+"`"),y=!0)}if(y){u();continue}var j=r.getElementById(h.source),N=r.getElementById(h.target);j.same(N)?j._private.edges.push(c):(j._private.edges.push(c),N._private.edges.push(c)),c._private.source=j,c._private.target=N}d.map=new rL,d.map.set(f,{ele:c,index:0}),d.removed=!1,t&&r.addToPool(c)}for(var k=0;k<a.length;k++){var C=a[k],E=C._private.data;tP(E.parent)&&(E.parent=""+E.parent);var S=E.parent;if(null!=S||C._private.parent){var T=C._private.parent?r.collection().merge(C._private.parent):r.getElementById(S);if(T.empty())E.parent=void 0;else if(T[0].removed())rC("Node added with missing parent, reference to parent removed"),E.parent=void 0,C._private.parent=null;else{for(var P=!1,_=T;!_.empty();){if(C.same(_)){P=!0,E.parent=void 0;break}_=_.parent()}P||(T[0]._private.children.push(C),C._private.parent=T[0],n.hasCompoundNodes=!0)}}}if(D.length>0){for(var D,B,M,A=D.length===this.length?this:new oM(r,D),R=0;R<A.length;R++){var I=A[R];I.isNode()||(I.parallelEdges().clearTraversalCache(),I.source().clearTraversalCache(),I.target().clearTraversalCache())}(n.hasCompoundNodes?r.collection().merge(A).merge(A.connectedNodes()).merge(A.parent()):A).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?A.emitAndNotify("add"):t&&A.emit("add")}return this},oA.removed=function(){var e=this[0];return e&&e._private.removed},oA.inside=function(){var e=this[0];return e&&!e._private.removed},oA.remove=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],r=[],n={},a=this._private.cy,i=0,o=this.length;i<o;i++)!function e(a){var i=n[a.id()];if(!(t&&a.removed())&&!i)if(n[a.id()]=!0,a.isNode()){r.push(a);for(var o=a._private.edges,s=0;s<o.length;s++)e(o[s]);for(var l=a._private.children,u=0;u<l.length;u++)e(l[u])}else r.unshift(a)}(this[i]);function s(e,t){rD(e._private.edges,t),e.clearTraversalCache()}var l=[];l.ids={},this.dirtyCompoundBoundsCache(),t&&a.removeFromPool(r);for(var u=0;u<r.length;u++){var c=r[u];if(c.isEdge()){var d=c.source()[0],h=c.target()[0];s(d,c),s(h,c);for(var f=c.parallelEdges(),p=0;p<f.length;p++){var g=f[p];g.clearTraversalCache(),g.isBundledBezier()&&g.dirtyBoundingBoxCache()}}else{var v=c.parent();0!==v.length&&function(e,t){t=t[0];var r=(e=e[0])._private.children,n=e.id();rD(r,t),t._private.parent=null,l.ids[n]||(l.ids[n]=!0,l.push(e))}(v,c)}t&&(c._private.removed=!0)}var y=a._private.elements;a._private.hasCompoundNodes=!1;for(var x=0;x<y.length;x++)if(y[x].isParent()){a._private.hasCompoundNodes=!0;break}var b=new oM(this.cy(),r);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},oA.move=function(e){var t=this._private.cy,r=this,n=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var a=n(e.source),i=n(e.target),o=null!=a&&t.hasElementWithId(a),s=null!=i&&t.hasElementWithId(i);(o||s)&&(t.batch(function(){r.remove(!1,!1),r.emitAndNotify("moveout");for(var e=0;e<r.length;e++){var t=r[e],n=t._private.data;t.isEdge()&&(o&&(n.source=a),s&&(n.target=i))}r.restore(!1,!1)}),r.emitAndNotify("move"))}else if(void 0!==e.parent){var l=n(e.parent);if(null===l||t.hasElementWithId(l)){var u=null===l?void 0:l;t.batch(function(){var e=r.remove(!1,!1);e.emitAndNotify("moveout");for(var t=0;t<r.length;t++){var n=r[t],a=n._private.data;n.isNode()&&(a.parent=u)}e.restore(!1,!1)}),r.emitAndNotify("move")}}return this},[aX,io,is,iE,iT,u5,iM,i4,oc,od,{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}},of,og,ox,oN,oE].forEach(function(e){tG(oA,e)});var oR=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,r,n){var a={x:t.x+n.dx*r,v:t.v+n.dv*r,tension:t.tension,friction:t.friction};return{dx:a.v,dv:e(a)}}return function r(n,a,i){var o,s,l,u,c,d,h,f,p,g,v,y={x:-1,v:0,tension:null,friction:null},x=[0],b=0;for(n=parseFloat(n)||500,a=parseFloat(a)||20,i=i||null,y.tension=n,y.friction=a,g=(p=null!==i)?(b=r(n,a))/i*.016:.016;o=v||y,s=g,l={dx:o.v,dv:e(o)},u=t(o,.5*s,l),c=t(o,.5*s,u),d=t(o,s,c),h=1/6*(l.dx+2*(u.dx+c.dx)+d.dx),f=1/6*(l.dv+2*(u.dv+c.dv)+d.dv),o.x=o.x+h*s,o.v=o.v+f*s,v=o,x.push(1+v.x),b+=16,Math.abs(v.x)>1e-4&&Math.abs(v.v)>1e-4;);return p?function(e){return x[e*(x.length-1)|0]}:b}}(),oI=function(e,t,r,n){var a=function(e,t,r,n){var a="undefined"!=typeof Float32Array;if(4!=arguments.length)return!1;for(var i=0;i<4;++i)if("number"!=typeof arguments[i]||isNaN(arguments[i])||!isFinite(arguments[i]))return!1;e=Math.min(e,1),r=Math.min(r,1),e=Math.max(e,0),r=Math.max(r,0);var o=a?new Float32Array(11):Array(11);function s(e,t,r){return(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e}function l(e,t,r){return 3*(1-3*r+3*t)*e*e+2*(3*r-6*t)*e+3*t}var u=!1,c=function(a){return(u||(u=!0,(e!==t||r!==n)&&function(){for(var t=0;t<11;++t)o[t]=s(.1*t,e,r)}()),e===t&&r===n)?a:0===a?0:1===a?1:s(function(t){for(var n=0,a=1;10!==a&&o[a]<=t;++a)n+=.1;var i=n+(t-o[--a])/(o[a+1]-o[a])*.1,u=l(i,e,r);if(u>=.001){for(var c=i,d=0;d<4;++d){var h=l(c,e,r);if(0===h)break;var f=s(c,e,r)-t;c-=f/h}return c}return 0===u?i:function(t,n,a){var i,o,l=0;do(i=s(o=n+(a-n)/2,e,r)-t)>0?a=o:n=o;while(Math.abs(i)>1e-7&&++l<10)return o}(t,n,n+.1)}(a),t,n)};c.getControlPoints=function(){return[{x:e,y:t},{x:r,y:n}]};var d="generateBezier("+[e,t,r,n]+")";return c.toString=function(){return d},c}(e,t,r,n);return function(e,t,r){return e+(t-e)*a(r)}},oL={linear:function(e,t,r){return e+(t-e)*r},ease:oI(.25,.1,.25,1),"ease-in":oI(.42,0,1,1),"ease-out":oI(0,0,.58,1),"ease-in-out":oI(.42,0,.58,1),"ease-in-sine":oI(.47,0,.745,.715),"ease-out-sine":oI(.39,.575,.565,1),"ease-in-out-sine":oI(.445,.05,.55,.95),"ease-in-quad":oI(.55,.085,.68,.53),"ease-out-quad":oI(.25,.46,.45,.94),"ease-in-out-quad":oI(.455,.03,.515,.955),"ease-in-cubic":oI(.55,.055,.675,.19),"ease-out-cubic":oI(.215,.61,.355,1),"ease-in-out-cubic":oI(.645,.045,.355,1),"ease-in-quart":oI(.895,.03,.685,.22),"ease-out-quart":oI(.165,.84,.44,1),"ease-in-out-quart":oI(.77,0,.175,1),"ease-in-quint":oI(.755,.05,.855,.06),"ease-out-quint":oI(.23,1,.32,1),"ease-in-out-quint":oI(.86,0,.07,1),"ease-in-expo":oI(.95,.05,.795,.035),"ease-out-expo":oI(.19,1,.22,1),"ease-in-out-expo":oI(1,0,0,1),"ease-in-circ":oI(.6,.04,.98,.335),"ease-out-circ":oI(.075,.82,.165,1),"ease-in-out-circ":oI(.785,.135,.15,.86),spring:function(e,t,r){if(0===r)return oL.linear;var n=oR(e,t,r);return function(e,t,r){return e+(t-e)*n(r)}},"cubic-bezier":oI};function oO(e,t,r,n,a){if(1===n||t===r)return r;var i=a(t,r,n);return null==e||((e.roundValue||e.color)&&(i=Math.round(i)),void 0!==e.min&&(i=Math.max(i,e.min)),void 0!==e.max&&(i=Math.min(i,e.max))),i}function oz(e,t){return null==e.pfValue&&null==e.value?e:null!=e.pfValue&&(null==t||"%"!==t.type.units)?e.pfValue:e.value}function oV(e,t,r,n,a){var i=null!=a?a.type:null;r<0?r=0:r>1&&(r=1);var o=oz(e,a),s=oz(t,a);if(tP(o)&&tP(s))return oO(i,o,s,r,n);if(tS(o)&&tS(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],d=s[u];if(null!=c&&null!=d){var h=oO(i,c,d,r,n);l.push(h)}else l.push(d)}return l}}function oF(e,t){return null!=e&&null!=t&&(!!(tP(e)&&tP(t))||!!e&&!!t)}function oH(e,t){var r=t._private.aniEles,n=[];function a(t,r){var a=t._private,i=a.animation.current,o=a.animation.queue,s=!1;if(0===i.length){var l=o.shift();l&&i.push(l)}for(var u=function(e){for(var t=e.length-1;t>=0;t--)(0,e[t])();e.splice(0,e.length)},c=i.length-1;c>=0;c--){var d=i[c],h=d._private;if(h.stopped){i.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.frames);continue}(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||function(e,t,r,n){var a=t._private;a.started=!0,a.startTime=r-a.progress*a.duration}(0,d,e),function(e,t,r,n){var a,i,o,s,l=!n,u=e._private,c=t._private,d=c.easing,h=c.startTime,f=(n?e:e.cy()).style();c.easingImpl||(null==d?c.easingImpl=oL.linear:(a=tC(d)?f.parse("transition-timing-function",d).value:d,tC(a)?(i=a,o=[]):(i=a[1],o=a.slice(2).map(function(e){return+e})),o.length>0?("spring"===i&&o.push(c.duration),c.easingImpl=oL[i].apply(null,o)):c.easingImpl=oL[i]));var p=c.easingImpl;if(s=0===c.duration?1:(r-h)/c.duration,c.applying&&(s=c.progress),s<0?s=0:s>1&&(s=1),null==c.delay){var g=c.startPosition,v=c.position;if(v&&l&&!e.locked()){var y={};oF(g.x,v.x)&&(y.x=oV(g.x,v.x,s,p)),oF(g.y,v.y)&&(y.y=oV(g.y,v.y,s,p)),e.position(y)}var x=c.startPan,b=c.pan,w=u.pan,j=null!=b&&n;j&&(oF(x.x,b.x)&&(w.x=oV(x.x,b.x,s,p)),oF(x.y,b.y)&&(w.y=oV(x.y,b.y,s,p)),e.emit("pan"));var N=c.startZoom,k=c.zoom,C=null!=k&&n;C&&(oF(N,k)&&(u.zoom=ni(u.minZoom,oV(N,k,s,p),u.maxZoom)),e.emit("zoom")),(j||C)&&e.emit("viewport");var E=c.style;if(E&&E.length>0&&l){for(var S=0;S<E.length;S++){var T=E[S],P=T.name,_=c.startStyle[P],D=f.properties[_.name],B=oV(_,T,s,p,D);f.overrideBypass(e,P,B)}e.emit("style")}}c.progress=s}(t,d,e,r),h.applying&&(h.applying=!1),u(h.frames),null!=h.step&&h.step(e),d.completed()&&(i.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.completes)),s=!0)}return r||0!==i.length||0!==o.length||n.push(t),s}for(var i=!1,o=0;o<r.length;o++){var s=a(r[o]);i=i||s}var l=a(t,!0);(i||l)&&(r.length>0?t.notify("draw",r):t.notify("draw")),r.unmerge(n),t.emit("step")}var oq={animate:ii.animate(),animation:ii.animation(),animated:ii.animated(),clearQueue:ii.clearQueue(),delay:ii.delay(),delayAnimation:ii.delayAnimation(),stop:ii.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,r){oH(r,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&ri(function(r){oH(r,e),t()})}()}}},oX={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,r){var n=t.qualifier;return null==n||e!==r.target&&tB(r.target)&&n.matches(r.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,r){return null!=t.qualifier?r.target:e}},oY=function(e){return tC(e)?new ik(e):e},oW={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new on(oX,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,r){return this.emitter().on(e,oY(t),r),this},removeListener:function(e,t,r){return this.emitter().removeListener(e,oY(t),r),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,r){return this.emitter().one(e,oY(t),r),this},once:function(e,t,r){return this.emitter().one(e,oY(t),r),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}};ii.eventAliasesOn(oW);var oU={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)}};oU.jpeg=oU.jpg;var o$={layout:function(e){if(null==e)return void rN("Layout options must be specified to make a layout");if(null==e.name)return void rN("A `name` must be specified to make a layout");var t,r=e.name,n=this.extension("layout",r);return null==n?void rN("No such layout `"+r+"` found. Did you forget to import it and `cytoscape.use()` it?"):(t=tC(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$(),new n(tG({},e,{cy:this,eles:t})))}};o$.createLayout=o$.makeLayout=o$.layout;var oK=r_({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]}),oG={renderTo:function(e,t,r,n){return this._private.renderer.renderTo(e,t,r,n),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 rN("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));void 0!==e.wheelSensitivity&&rC("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 r=oK(e);r.cy=this,this._private.renderer=new t(r),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)}};oG.invalidateDimensions=oG.resize;var oZ={collection:function(e,t){return tC(e)?this.$(e):tD(e)?e.collection():tS(e)?(t||(t={}),new oM(this,e,t.unique,t.removed)):new oM(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}};oZ.elements=oZ.filter=oZ.$;var oQ={};oQ.apply=function(e){for(var t=this._private.cy.collection(),r=0;r<e.length;r++){var n=e[r],a=this.getContextMeta(n);if(!a.empty){var i=this.getContextStyle(a),o=this.applyContextStyle(a,i,n);n._private.appliedInitStyle?this.updateTransitions(n,o.diffProps):n._private.appliedInitStyle=!0,this.updateStyleHints(n)&&t.push(n)}}return t},oQ.getPropertiesDiff=function(e,t){var r=this._private.propDiffs=this._private.propDiffs||{},n=e+"-"+t,a=r[n];if(a)return a;for(var i=[],o={},s=0;s<this.length;s++){var l=this[s],u="t"===e[s],c="t"===t[s],d=u!==c,h=l.mappedProperties.length>0;if(d||c&&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,y=!1,x=s+1;x<this.length;x++){var b=this[x];if("t"===t[x]&&(y=null!=b.properties[g.name]))break}o[v]||y||(o[v]=!0,i.push(v))}}}return r[n]=i,i},oQ.getContextMeta=function(e){for(var t,r="",n=e._private.styleCxtKey||"",a=0;a<this.length;a++){var i=this[a];i.selector&&i.selector.matches(e)?r+="t":r+="f"}return t=this.getPropertiesDiff(n,r),e._private.styleCxtKey=r,{key:r,diffPropNames:t,empty:0===t.length}},oQ.getContextStyle=function(e){var t=e.key,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var n={_private:{key:t}},a=0;a<this.length;a++){var i=this[a];if("t"===t[a])for(var o=0;o<i.properties.length;o++){var s=i.properties[o];n[s.name]=s}}return r[t]=n,n},oQ.applyContextStyle=function(e,t,r){for(var n=e.diffPropNames,a={},i=this.types,o=0;o<n.length;o++){var s=n[o],l=t[s],u=r.pstyle(s);if(!l)if(!u)continue;else l=u.bypass?{name:s,deleteBypassed:!0}:{name:s,delete:!0};if(u!==l){if(l.mapped===i.fn&&null!=u&&null!=u.mapping&&u.mapping.value===l.value){var c=u.mapping;if((c.fnValue=l.value(r))===c.prevFnValue)continue}var d=a[s]={prev:u};this.applyParsedProperty(r,l),d.next=r.pstyle(s),d.next&&d.next.bypass&&(d.next=d.next.bypassed)}}return{diffProps:a}},oQ.updateStyleHints=function(e){var t=e._private,r=this,n=r.propertyGroupNames,a=r.propertyGroupKeys,i=function(e,t,n){return r.getPropertiesHash(e,t,n)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,l=e._private.style;n=Object.keys(l);for(var u=0;u<a.length;u++){var c=a[u];t.styleKeys[c]=[9261,5381]}for(var d=function(e,r){return t.styleKeys[r][0]=rs(e,t.styleKeys[r][0])},h=function(e,r){return t.styleKeys[r][1]=rl(e,t.styleKeys[r][1])},f=function(e,t){for(var r=0;r<e.length;r++){var n=e.charCodeAt(r);d(n,t),h(n,t)}},p=0;p<n.length;p++){var g=n[p],v=l[g];if(null!=v){var y,x,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,S=C||E,T=v.units;w.number&&S&&!w.multiple?(d(x=-128<(y=C?N:k)&&y<128&&Math.floor(y)!==y?2e9-(1024*y|0):y,j),h(x,j),C||null==T||f(T,j)):f(v.strValue,j)}}for(var P=[9261,5381],_=0;_<a.length;_++){var D=a[_],B=t.styleKeys[D];P[0]=rs(B[0],P[0]),P[1]=rl(B[1],P[1])}t.styleKey=2097152*P[0]+P[1];var M=t.styleKeys;t.labelDimsKey=ru(M.labelDimensions);var A=i(e,["label"],M.labelDimensions);if(t.labelKey=ru(A),t.labelStyleKey=ru(rc(M.commonLabel,A)),!s){var R=i(e,["source-label"],M.labelDimensions);t.sourceLabelKey=ru(R),t.sourceLabelStyleKey=ru(rc(M.commonLabel,R));var I=i(e,["target-label"],M.labelDimensions);t.targetLabelKey=ru(I),t.targetLabelStyleKey=ru(rc(M.commonLabel,I))}if(s){var L=t.styleKeys,O=L.nodeBody,z=L.nodeBorder,V=L.nodeOutline,F=L.backgroundImage,H=L.compound,q=L.pie,X=L.stripe;t.nodeKey=ru([O,z,V,F,H,q,X].filter(function(e){return null!=e}).reduce(rc,[9261,5381])),t.hasPie=null!=q&&9261!==q[0]&&5381!==q[1],t.hasStripe=null!=X&&9261!==X[0]&&5381!==X[1]}return o!==t.styleKey},oQ.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},oQ.applyParsedProperty=function(e,t){var r=this,n=t,a=e._private.style,i=r.types,o=r.properties[n.name].type,s=n.bypass,l=a[n.name],u=l&&l.bypass,c=e._private,d="mapping",h=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},f=function(){var t=h(l),a=h(n);r.checkTriggers(e,n.name,t,a)};if("curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(n=t=this.parse(t.name,"bezier",s)),n.delete)return a[n.name]=void 0,f(),!0;if(n.deleteBypassed)if(!l)return f(),!0;else if(l.bypass)return l.bypassed=void 0,f(),!0;else return!1;if(n.deleteBypass)if(!l)return f(),!0;else if(l.bypass)return a[n.name]=l.bypassed,f(),!0;else return!1;var p=function(){rC("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+n.name+"` with data field `"+n.field+"`); try a `["+n.field+"]` selector to limit scope to elements with `"+n.field+"` defined")};switch(n.mapped){case i.mapData:for(var g,v,y=n.field.split("."),x=c.data,b=0;b<y.length&&x;b++)x=x[y[b]];if(null==x)return p(),!1;if(!tP(x))return rC("Do not use continuous mappers without specifying numeric data (i.e. `"+n.field+": "+x+"` for `"+e.id()+"` is non-numeric)"),!1;var w=n.fieldMax-n.fieldMin;if((v=0===w?0:(x-n.fieldMin)/w)<0?v=0:v>1&&(v=1),o.color){var j=n.valueMin[0],N=n.valueMax[0],k=n.valueMin[1],C=n.valueMax[1],E=n.valueMin[2],S=n.valueMax[2],T=null==n.valueMin[3]?1:n.valueMin[3],P=[Math.round(j+(N-j)*v),Math.round(k+(C-k)*v),Math.round(E+(S-E)*v),Math.round(T+((null==n.valueMax[3]?1:n.valueMax[3])-T)*v)];g={bypass:n.bypass,name:n.name,value:P,strValue:"rgb("+P[0]+", "+P[1]+", "+P[2]+")"}}else{if(!o.number)return!1;var _=n.valueMin+(n.valueMax-n.valueMin)*v;g=this.parse(n.name,_,n.bypass,d)}if(!g)return p(),!1;g.mapping=n,n=g;break;case i.data:for(var D=n.field.split("."),B=c.data,M=0;M<D.length&&B;M++)B=B[D[M]];if(null!=B&&(g=this.parse(n.name,B,n.bypass,d)),!g)return p(),!1;g.mapping=n,n=g;break;case i.fn:var A=n.value,R=null!=n.fnValue?n.fnValue:A(e);if(n.prevFnValue=R,null==R)return rC("Custom function mappers may not return null (i.e. `"+n.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(g=this.parse(n.name,R,n.bypass,d)))return rC("Custom function mappers may not return invalid values for the property type (i.e. `"+n.name+"` for ele `"+e.id()+"` is invalid)"),!1;g.mapping=rE(n),n=g;break;case void 0:break;default:return!1}return s?(u?n.bypassed=l.bypassed:n.bypassed=l,a[n.name]=n):u?l.bypassed=n:a[n.name]=n,f(),!0},oQ.cleanElements=function(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(this.clearStyleHints(n),n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),t)for(var a=n._private.style,i=Object.keys(a),o=0;o<i.length;o++){var s=i[o],l=a[s];null!=l&&(l.bypass?l.bypassed=null:a[s]=null)}else n._private.style={}}},oQ.update=function(){this._private.cy.mutableElements().updateStyle()},oQ.updateTransitions=function(e,t){var r=this,n=e._private,a=e.pstyle("transition-property").value,i=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var s={},l=!1,u=0;u<a.length;u++){var c=a[u],d=e.pstyle(c),h=t[c];if(h){var f=h.prev,p=null!=h.next?h.next:d,g=!1,v=void 0;f&&(tP(f.pfValue)&&tP(p.pfValue)?(g=p.pfValue-f.pfValue,v=f.pfValue+1e-6*g):tP(f.value)&&tP(p.value)?(g=p.value-f.value,v=f.value+1e-6*g):tS(f.value)&&tS(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[c]=p.strValue,this.applyBypass(e,c,v),l=!0))}}if(!l)return;n.transitioning=!0,new aZ(function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:i,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(e,a),e.emitAndNotify("style"),n.transitioning=!1})}else n.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),n.transitioning=!1)},oQ.checkTrigger=function(e,t,r,n,a,i){var o=this.properties[t],s=a(o);!e.removed()&&null!=s&&s(r,n,e)&&i(o)},oQ.checkZOrderTrigger=function(e,t,r,n){var a=this;this.checkTrigger(e,t,r,n,function(e){return e.triggersZOrder},function(){a._private.cy.notify("zorder",e)})},oQ.checkBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},oQ.checkConnectedEdgesBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},oQ.checkParallelEdgesBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},oQ.checkTriggers=function(e,t,r,n){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,r,n),this.checkBoundsTrigger(e,t,r,n),this.checkConnectedEdgesBoundsTrigger(e,t,r,n),this.checkParallelEdgesBoundsTrigger(e,t,r,n)};var oJ={};oJ.applyBypass=function(e,t,r,n){var a=[];if("*"===t||"**"===t){if(void 0!==r)for(var i=0;i<this.properties.length;i++){var o=this.properties[i].name,s=this.parse(o,r,!0);s&&a.push(s)}}else if(tC(t)){var l=this.parse(t,r,!0);l&&a.push(l)}else{if(!tT(t))return!1;n=r;for(var u=Object.keys(t),c=0;c<u.length;c++){var d=u[c],h=t[d];if(void 0===h&&(h=t[tV(d)]),void 0!==h){var f=this.parse(d,h,!0);f&&a.push(f)}}}if(0===a.length)return!1;for(var p=!1,g=0;g<e.length;g++){for(var v=e[g],y={},x=void 0,b=0;b<a.length;b++){var w=a[b];if(n){var j=v.pstyle(w.name);x=y[w.name]={prev:j}}p=this.applyParsedProperty(v,rE(w))||p,n&&(x.next=v.pstyle(w.name))}p&&this.updateStyleHints(v),n&&this.updateTransitions(v,y,!0)}return p},oJ.overrideBypass=function(e,t,r){t=tz(t);for(var n=0;n<e.length;n++){var a=e[n],i=a._private.style[t],o=this.properties[t].type,s=o.color,l=o.mutiple,u=i?null!=i.pfValue?i.pfValue:i.value:null;i&&i.bypass?(i.value=r,null!=i.pfValue&&(i.pfValue=r),s?i.strValue="rgb("+r.join(",")+")":l?i.strValue=r.join(" "):i.strValue=""+r,this.updateStyleHints(a)):this.applyBypass(a,t,r),this.checkTriggers(a,t,u,r)}},oJ.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},oJ.removeBypasses=function(e,t,r){for(var n=0;n<e.length;n++){for(var a=e[n],i={},o=0;o<t.length;o++){var s=t[o],l=this.properties[s],u=a.pstyle(l.name);if(u&&u.bypass){var c=this.parse(s,"",!0),d=i[l.name]={prev:u};this.applyParsedProperty(a,c),d.next=a.pstyle(l.name)}}this.updateStyleHints(a),r&&this.updateTransitions(a,i,!0)}};var o0={};o0.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},o0.containerCss=function(e){var t=this._private.cy,r=t.container(),n=t.window();if(n&&r&&n.getComputedStyle)return n.getComputedStyle(r).getPropertyValue(e)};var o1={};o1.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},o1.getRawStyle=function(e,t){if(e=e[0]){for(var r={},n=0;n<this.properties.length;n++){var a=this.properties[n],i=this.getStylePropertyValue(e,a.name,t);null!=i&&(r[a.name]=i,r[tV(a.name)]=i)}return r}},o1.getIndexedStyle=function(e,t,r,n){var a=e.pstyle(t)[r][n];return null!=a?a:e.cy().style().getDefaultProperty(t)[r][0]},o1.getStylePropertyValue=function(e,t,r){if(e=e[0]){var n=this.properties[t];n.alias&&(n=n.pointsTo);var a=n.type,i=e.pstyle(n.name);if(i){var o=i.value,s=i.units,l=i.strValue;if(r&&a.number&&null!=o&&tP(o)){var u=e.cy().zoom(),c=function(e){return e*u},d=function(e,t){return c(e)+t},h=tS(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 tC(e)?e:""+c(e)}).join(" "):""+c(o)}if(null!=l)return l}return null}},o1.getAnimationStartStyle=function(e,t){for(var r={},n=0;n<t.length;n++){var a=t[n].name,i=e.pstyle(a);void 0!==i&&(i=tT(i)?this.parse(a,i.strValue):this.parse(a,i)),i&&(r[a]=i)}return r},o1.getPropsList=function(e){var t=[],r=this.properties;if(e)for(var n=Object.keys(e),a=0;a<n.length;a++){var i=n[a],o=e[i],s=r[i]||r[tz(i)],l=this.parse(s.name,o);l&&t.push(l)}return t},o1.getNonDefaultPropertiesHash=function(e,t,r){var n,a,i,o,s,l,u=r.slice();for(s=0;s<t.length;s++)if(n=t[s],null!=(a=e.pstyle(n,!1)))if(null!=a.pfValue)u[0]=rs(o,u[0]),u[1]=rl(o,u[1]);else for(l=0,i=a.strValue;l<i.length;l++)o=i.charCodeAt(l),u[0]=rs(o,u[0]),u[1]=rl(o,u[1]);return u},o1.getPropertiesHash=o1.getNonDefaultPropertiesHash;var o2={};o2.appendFromJson=function(e){for(var t=0;t<e.length;t++){var r=e[t],n=r.selector,a=r.style||r.css,i=Object.keys(a);this.selector(n);for(var o=0;o<i.length;o++){var s=i[o],l=a[s];this.css(s,l)}}return this},o2.fromJson=function(e){return this.resetToDefault(),this.appendFromJson(e),this},o2.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var r=this[t],n=r.selector,a=r.properties,i={},o=0;o<a.length;o++){var s=a[o];i[s.name]=s.strValue}e.push({selector:n?n.toString():"core",style:i})}return e};var o5={};o5.appendFromString=function(e){var t,r,n,a=""+e;function i(){a=a.length>t.length?a.substr(t.length):""}function o(){r=r.length>n.length?r.substr(n.length):""}for(a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");!a.match(/^\s*$/);){var s=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){rC("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}t=s[0];var l=s[1];if("core"!==l&&new ik(l).invalid){rC("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),i();continue}var u=s[2],c=!1;r=u;for(var d=[];!r.match(/^\s*$/);){var h=r.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!h){rC("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}n=h[0];var f=h[1],p=h[2];if(!this.properties[f]){rC("Skipping property: Invalid property name in: "+n),o();continue}if(!this.parse(f,p)){rC("Skipping property: Invalid property definition in: "+n),o();continue}d.push({name:f,val:p}),o()}if(c){i();break}this.selector(l);for(var g=0;g<d.length;g++){var v=d[g];this.css(v.name,v.val)}i()}return this},o5.fromString=function(e){return this.resetToDefault(),this.appendFromString(e),this};var o3={};!function(){var e=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},t=function(e){var t=tX+"|\\w+|"+tW+"|"+t$+"|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+e+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+tX+")\\s*\\,\\s*("+tX+")\\s*,\\s*("+t+")\\s*\\,\\s*("+t+")\\)$"},r=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];o3.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:r,singleRegexMatchValue:!0},urls:{regexes:r,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 tC(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+tX+")\\s*,\\s*("+tX+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+tX+")\\s*,\\s*("+tX+")\\s*,\\s*("+tX+")\\s*,\\s*("+tX+")\\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 n=function(e,t){return(null==e||null==t)&&e!==t||0==e&&0!=t||0!=e&&0==t},a=function(e,t){return e!=t},i=o3.types,o=[{name:"label",type:i.text,triggersBounds:a,triggersZOrder:function(e,t){var r=tI(e),n=tI(t);return r&&!n||!r&&n}},{name:"text-rotation",type:i.textRotation,triggersBounds:a},{name:"text-margin-x",type:i.bidirectionalSize,triggersBounds:a},{name:"text-margin-y",type:i.bidirectionalSize,triggersBounds:a}],s=[{name:"source-label",type:i.text,triggersBounds:a},{name:"source-text-rotation",type:i.textRotation,triggersBounds:a},{name:"source-text-margin-x",type:i.bidirectionalSize,triggersBounds:a},{name:"source-text-margin-y",type:i.bidirectionalSize,triggersBounds:a},{name:"source-text-offset",type:i.size,triggersBounds:a}],l=[{name:"target-label",type:i.text,triggersBounds:a},{name:"target-text-rotation",type:i.textRotation,triggersBounds:a},{name:"target-text-margin-x",type:i.bidirectionalSize,triggersBounds:a},{name:"target-text-margin-y",type:i.bidirectionalSize,triggersBounds:a},{name:"target-text-offset",type:i.size,triggersBounds:a}],u=[{name:"font-family",type:i.fontFamily,triggersBounds:a},{name:"font-style",type:i.fontStyle,triggersBounds:a},{name:"font-weight",type:i.fontWeight,triggersBounds:a},{name:"font-size",type:i.size,triggersBounds:a},{name:"text-transform",type:i.textTransform,triggersBounds:a},{name:"text-wrap",type:i.textWrap,triggersBounds:a},{name:"text-overflow-wrap",type:i.textOverflowWrap,triggersBounds:a},{name:"text-max-width",type:i.size,triggersBounds:a},{name:"text-outline-width",type:i.size,triggersBounds:a},{name:"line-height",type:i.positiveNumber,triggersBounds:a}],c=[{name:"text-valign",type:i.valign,triggersBounds:a},{name:"text-halign",type:i.halign,triggersBounds:a},{name:"color",type:i.color},{name:"text-outline-color",type:i.color},{name:"text-outline-opacity",type:i.zeroOneNumber},{name:"text-background-color",type:i.color},{name:"text-background-opacity",type:i.zeroOneNumber},{name:"text-background-padding",type:i.size,triggersBounds:a},{name:"text-border-opacity",type:i.zeroOneNumber},{name:"text-border-color",type:i.color},{name:"text-border-width",type:i.size,triggersBounds:a},{name:"text-border-style",type:i.borderStyle,triggersBounds:a},{name:"text-background-shape",type:i.textBackgroundShape,triggersBounds:a},{name:"text-justification",type:i.justification},{name:"box-select-labels",type:i.bool,triggersBounds:a}],d=[{name:"events",type:i.bool,triggersZOrder:a},{name:"text-events",type:i.bool,triggersZOrder:a},{name:"box-selection",type:i.boxSelection,triggersZOrder:a}],h=[{name:"display",type:i.display,triggersZOrder:a,triggersBounds:a,triggersBoundsOfConnectedEdges:a,triggersBoundsOfParallelEdges:function(e,t,r){return e!==t&&"bezier"===r.pstyle("curve-style").value}},{name:"visibility",type:i.visibility,triggersZOrder:a},{name:"opacity",type:i.zeroOneNumber,triggersZOrder:n},{name:"text-opacity",type:i.zeroOneNumber},{name:"min-zoomed-font-size",type:i.size},{name:"z-compound-depth",type:i.zCompoundDepth,triggersZOrder:a},{name:"z-index-compare",type:i.zIndexCompare,triggersZOrder:a},{name:"z-index",type:i.number,triggersZOrder:a}],f=[{name:"overlay-padding",type:i.size,triggersBounds:a},{name:"overlay-color",type:i.color},{name:"overlay-opacity",type:i.zeroOneNumber,triggersBounds:n},{name:"overlay-shape",type:i.overlayShape,triggersBounds:a},{name:"overlay-corner-radius",type:i.cornerRadius}],p=[{name:"underlay-padding",type:i.size,triggersBounds:a},{name:"underlay-color",type:i.color},{name:"underlay-opacity",type:i.zeroOneNumber,triggersBounds:n},{name:"underlay-shape",type:i.overlayShape,triggersBounds:a},{name:"underlay-corner-radius",type:i.cornerRadius}],g=[{name:"transition-property",type:i.propList},{name:"transition-duration",type:i.time},{name:"transition-delay",type:i.time},{name:"transition-timing-function",type:i.easing}],v=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},y=[{name:"height",type:i.nodeSize,triggersBounds:a,hashOverride:v},{name:"width",type:i.nodeSize,triggersBounds:a,hashOverride:v},{name:"shape",type:i.nodeShape,triggersBounds:a},{name:"shape-polygon-points",type:i.polygonPointList,triggersBounds:a},{name:"corner-radius",type:i.cornerRadius},{name:"background-color",type:i.color},{name:"background-fill",type:i.fill},{name:"background-opacity",type:i.zeroOneNumber},{name:"background-blacken",type:i.nOneOneNumber},{name:"background-gradient-stop-colors",type:i.colors},{name:"background-gradient-stop-positions",type:i.percentages},{name:"background-gradient-direction",type:i.gradientDirection},{name:"padding",type:i.sizeMaybePercent,triggersBounds:a},{name:"padding-relative-to",type:i.paddingRelativeTo,triggersBounds:a},{name:"bounds-expansion",type:i.boundsExpansion,triggersBounds:a}],x=[{name:"border-color",type:i.color},{name:"border-opacity",type:i.zeroOneNumber},{name:"border-width",type:i.size,triggersBounds:a},{name:"border-style",type:i.borderStyle},{name:"border-cap",type:i.lineCap},{name:"border-join",type:i.lineJoin},{name:"border-dash-pattern",type:i.numbers},{name:"border-dash-offset",type:i.number},{name:"border-position",type:i.linePosition}],b=[{name:"outline-color",type:i.color},{name:"outline-opacity",type:i.zeroOneNumber},{name:"outline-width",type:i.size,triggersBounds:a},{name:"outline-style",type:i.borderStyle},{name:"outline-offset",type:i.size,triggersBounds:a}],w=[{name:"background-image",type:i.urls},{name:"background-image-crossorigin",type:i.bgCrossOrigin},{name:"background-image-opacity",type:i.zeroOneNumbers},{name:"background-image-containment",type:i.bgContainment},{name:"background-image-smoothing",type:i.bools},{name:"background-position-x",type:i.bgPos},{name:"background-position-y",type:i.bgPos},{name:"background-width-relative-to",type:i.bgRelativeTo},{name:"background-height-relative-to",type:i.bgRelativeTo},{name:"background-repeat",type:i.bgRepeat},{name:"background-fit",type:i.bgFit},{name:"background-clip",type:i.bgClip},{name:"background-width",type:i.bgWH},{name:"background-height",type:i.bgWH},{name:"background-offset-x",type:i.bgPos},{name:"background-offset-y",type:i.bgPos}],j=[{name:"position",type:i.position,triggersBounds:a},{name:"compound-sizing-wrt-labels",type:i.compoundIncludeLabels,triggersBounds:a},{name:"min-width",type:i.size,triggersBounds:a},{name:"min-width-bias-left",type:i.sizeMaybePercent,triggersBounds:a},{name:"min-width-bias-right",type:i.sizeMaybePercent,triggersBounds:a},{name:"min-height",type:i.size,triggersBounds:a},{name:"min-height-bias-top",type:i.sizeMaybePercent,triggersBounds:a},{name:"min-height-bias-bottom",type:i.sizeMaybePercent,triggersBounds:a}],N=[{name:"line-style",type:i.lineStyle},{name:"line-color",type:i.color},{name:"line-fill",type:i.fill},{name:"line-cap",type:i.lineCap},{name:"line-opacity",type:i.zeroOneNumber},{name:"line-dash-pattern",type:i.numbers},{name:"line-dash-offset",type:i.number},{name:"line-outline-width",type:i.size},{name:"line-outline-color",type:i.color},{name:"line-gradient-stop-colors",type:i.colors},{name:"line-gradient-stop-positions",type:i.percentages},{name:"curve-style",type:i.curveStyle,triggersBounds:a,triggersBoundsOfParallelEdges:function(e,t){return e!==t&&("bezier"===e||"bezier"===t)}},{name:"haystack-radius",type:i.zeroOneNumber,triggersBounds:a},{name:"source-endpoint",type:i.edgeEndpoint,triggersBounds:a},{name:"target-endpoint",type:i.edgeEndpoint,triggersBounds:a},{name:"control-point-step-size",type:i.size,triggersBounds:a},{name:"control-point-distances",type:i.bidirectionalSizes,triggersBounds:a},{name:"control-point-weights",type:i.numbers,triggersBounds:a},{name:"segment-distances",type:i.bidirectionalSizes,triggersBounds:a},{name:"segment-weights",type:i.numbers,triggersBounds:a},{name:"segment-radii",type:i.numbers,triggersBounds:a},{name:"radius-type",type:i.radiusType,triggersBounds:a},{name:"taxi-turn",type:i.bidirectionalSizeMaybePercent,triggersBounds:a},{name:"taxi-turn-min-distance",type:i.size,triggersBounds:a},{name:"taxi-direction",type:i.axisDirection,triggersBounds:a},{name:"taxi-radius",type:i.number,triggersBounds:a},{name:"edge-distances",type:i.edgeDistances,triggersBounds:a},{name:"arrow-scale",type:i.positiveNumber,triggersBounds:a},{name:"loop-direction",type:i.angle,triggersBounds:a},{name:"loop-sweep",type:i.angle,triggersBounds:a},{name:"source-distance-from-node",type:i.size,triggersBounds:a},{name:"target-distance-from-node",type:i.size,triggersBounds:a}],k=[{name:"ghost",type:i.bool,triggersBounds:a},{name:"ghost-offset-x",type:i.bidirectionalSize,triggersBounds:a},{name:"ghost-offset-y",type:i.bidirectionalSize,triggersBounds:a},{name:"ghost-opacity",type:i.zeroOneNumber}],C=[{name:"selection-box-color",type:i.color},{name:"selection-box-opacity",type:i.zeroOneNumber},{name:"selection-box-border-color",type:i.color},{name:"selection-box-border-width",type:i.size},{name:"active-bg-color",type:i.color},{name:"active-bg-opacity",type:i.zeroOneNumber},{name:"active-bg-size",type:i.size},{name:"outside-texture-bg-color",type:i.color},{name:"outside-texture-bg-opacity",type:i.zeroOneNumber}],E=[];o3.pieBackgroundN=16,E.push({name:"pie-size",type:i.sizeMaybePercent}),E.push({name:"pie-hole",type:i.sizeMaybePercent}),E.push({name:"pie-start-angle",type:i.angle});for(var S=1;S<=o3.pieBackgroundN;S++)E.push({name:"pie-"+S+"-background-color",type:i.color}),E.push({name:"pie-"+S+"-background-size",type:i.percent}),E.push({name:"pie-"+S+"-background-opacity",type:i.zeroOneNumber});var T=[];o3.stripeBackgroundN=16,T.push({name:"stripe-size",type:i.sizeMaybePercent}),T.push({name:"stripe-direction",type:i.axisDirectionPrimary});for(var P=1;P<=o3.stripeBackgroundN;P++)T.push({name:"stripe-"+P+"-background-color",type:i.color}),T.push({name:"stripe-"+P+"-background-size",type:i.percent}),T.push({name:"stripe-"+P+"-background-opacity",type:i.zeroOneNumber});var _=[],D=o3.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:i.arrowShape,triggersBounds:a},{name:"arrow-color",type:i.color},{name:"arrow-fill",type:i.arrowFill},{name:"arrow-width",type:i.arrowWidth}].forEach(function(e){D.forEach(function(t){var r=t+"-"+e.name,n=e.type,a=e.triggersBounds;_.push({name:r,type:n,triggersBounds:a})})},{});var B=o3.properties=[].concat(d,g,h,f,p,k,c,u,o,s,l,y,x,b,w,E,T,j,N,_,C),M=o3.propertyGroups={behavior:d,transition:g,visibility:h,overlay:f,underlay:p,ghost:k,commonLabel:c,labelDimensions:u,mainLabel:o,sourceLabel:s,targetLabel:l,nodeBody:y,nodeBorder:x,nodeOutline:b,backgroundImage:w,pie:E,stripe:T,compound:j,edgeLine:N,edgeArrow:_,core:C},A=o3.propertyGroupNames={};(o3.propertyGroupKeys=Object.keys(M)).forEach(function(e){A[e]=M[e].map(function(e){return e.name}),M[e].forEach(function(t){return t.groupKey=e})});var R=o3.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"}];o3.propertyNames=B.map(function(e){return e.name});for(var I=0;I<B.length;I++){var L=B[I];B[L.name]=L}for(var O=0;O<R.length;O++){var z=R[O],V=B[z.pointsTo],F={name:z.name,alias:!0,pointsTo:V};B.push(F),B[z.name]=F}}(),o3.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},o3.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=tG({"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 r=1;r<=o3.pieBackgroundN;r++){var n=t.name.replace("{{i}}",r),a=t.value;e[n]=a}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 r=1;r<=o3.stripeBackgroundN;r++){var n=t.name.replace("{{i}}",r),a=t.value;e[n]=a}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 o3.arrowPrefixes.forEach(function(r){var n=r+"-"+t.name,a=t.value;e[n]=a}),e},{})),r={},n=0;n<this.properties.length;n++){var a=this.properties[n];if(!a.pointsTo){var i=a.name,o=t[i],s=this.parse(i,o);r[i]=s}}return e.defaultProperties=r,e.defaultProperties},o3.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 o4={};o4.parse=function(e,t,r,n){if(tE(t))return this.parseImplWarn(e,t,r,n);var a,i=rf(e,""+t,r?"t":"f","mapping"===n||!0===n||!1===n||null==n?"dontcare":n),o=this.propCache=this.propCache||[];return(a=o[i])||(a=o[i]=this.parseImplWarn(e,t,r,n)),(r||"mapping"===n)&&(a=rE(a))&&(a.value=rE(a.value)),a},o4.parseImplWarn=function(e,t,r,n){var a=this.parseImpl(e,t,r,n);return a||null==t||rC("The style property `".concat(e,": ").concat(t,"` is invalid")),a&&("width"===a.name||"height"===a.name)&&"label"===t&&rC("The style value of `label` is deprecated for `"+a.name+"`"),a},o4.parseImpl=function(e,t,r,n){e=tz(e);var a=this.properties[e],i=t,o=this.types;if(!a||void 0===t)return null;a.alias&&(e=(a=a.pointsTo).name);var s=tC(t);s&&(t=t.trim());var l=a.type;if(!l)return null;if(r&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(tE(t))return{name:e,value:t,strValue:"fn",mapped:o.fn,bypass:r};if(!s||n||t.length<7||"a"!==t[1]);else if(t.length>=7&&"d"===t[0]&&(g=new RegExp(o.data.regex).exec(t))){if(r)return!1;var u=o.data;return{name:e,value:g,strValue:""+t,mapped:u,field:g[1],bypass:r}}else if(t.length>=10&&"m"===t[0]&&(v=new RegExp(o.mapData.regex).exec(t))){if(r||l.multiple)return!1;var c=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 rC("`"+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:c,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:d.value,valueMax:h.value,bypass:r}}if(l.multiple&&"multiple"!==n){if(y=s?t.split(/\s+/):tS(t)?t:[t],l.evenMultiple&&y.length%2!=0)return null;for(var g,v,y,x=[],b=[],w=[],j="",N=!1,k=0;k<y.length;k++){var C=this.parse(e,y[k],r,"multiple");N=N||tC(C.value),x.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(x,b))return null;if(l.singleEnum&&N)if(1===x.length&&tC(x[0]))return{name:e,value:x[0],strValue:x[0],bypass:r};else return null;return{name:e,value:x,pfValue:w,strValue:j,bypass:r,units:b}}var E=function(){for(var n=0;n<l.enums.length;n++)if(l.enums[n]===t)return{name:e,value:t,strValue:""+t,bypass:r};return null};if(l.number){var S,T,P="px";if(l.units&&(T=l.units),l.implicitUnits&&(P=l.implicitUnits),!l.unitless)if(s){var _="px|em"+(l.allowPercent?"|\\%":"");T&&(_=T);var D=t.match("^("+tX+")("+_+")?$");D&&(t=D[1],T=D[2]||P)}else(!T||l.implicitUnits)&&(T=P);if(isNaN(t=parseFloat(t))&&void 0===l.enums)return null;if(isNaN(t)&&void 0!==l.enums)return t=i,E();if(l.integer&&!(tP(S=t)&&Math.floor(S)===S)||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 B={name:e,value:t,strValue:""+t+(T||""),units:T,bypass:r};return l.unitless||"px"!==T&&"em"!==T?B.pfValue=t:B.pfValue="px"!==T&&T?this.getEmSizeInPixels()*t:t,("ms"===T||"s"===T)&&(B.pfValue="ms"===T?t:1e3*t),("deg"===T||"rad"===T)&&(B.pfValue="rad"===T?t:Math.PI*t/180),"%"===T&&(B.pfValue=t/100),B}if(l.propList){var M=[],A=""+t;if("none"===A);else{for(var R=A.split(/\s*,\s*|\s+/),I=0;I<R.length;I++){var L=R[I].trim();this.properties[L]?M.push(L):rC("`"+L+"` is not a valid property name")}if(0===M.length)return null}return{name:e,value:M,strValue:0===M.length?"none":M.join(" "),bypass:r}}if(l.color){var O=t0(t);return O?{name:e,value:O,pfValue:O,strValue:"rgb("+O[0]+","+O[1]+","+O[2]+")",bypass:r}:null}if(l.regex||l.regexes){if(l.enums){var z=E();if(z)return z}for(var V=l.regexes?l.regexes:[l.regex],F=0;F<V.length;F++){var H=new RegExp(V[F]).exec(t);if(H)return{name:e,value:l.singleRegexMatchValue?H[1]:H,strValue:""+t,bypass:r}}return null}if(l.string)return{name:e,value:""+t,strValue:""+t,bypass:r};else if(l.enums)return E();else return null};var o6=function(e){return this instanceof o6?tA(e)?void(this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()):void rN("A style must have a core reference"):new o6(e)},o7=o6.prototype;o7.instanceString=function(){return"style"},o7.clear=function(){for(var e=this._private,t=e.cy.elements(),r=0;r<this.length;r++)this[r]=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},o7.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},o7.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},o7.selector=function(e){var t="core"===e?null:new ik(e),r=this.length++;return this[r]={selector:t,properties:[],mappedProperties:[],index:r},this},o7.css=function(){var e=arguments;if(1===e.length)for(var t=e[0],r=0;r<this.properties.length;r++){var n=this.properties[r],a=t[n.name];void 0===a&&(a=t[tV(n.name)]),void 0!==a&&this.cssRule(n.name,a)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},o7.style=o7.css,o7.cssRule=function(e,t){var r=this.parse(e,t);if(r){var n=this.length-1;this[n].properties.push(r),this[n].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.name.match(/stripe-(\d+)-background-size/)&&r.value&&(this._private.hasStripe=!0),r.mapped&&this[n].mappedProperties.push(r),this[n].selector||(this._private.coreStyle[r.name]=r)}return this},o7.append=function(e){return tR(e)?e.appendToStyle(this):tS(e)?this.appendFromJson(e):tC(e)&&this.appendFromString(e),this},o6.fromJson=function(e,t){var r=new o6(e);return r.fromJson(t),r},o6.fromString=function(e,t){return new o6(e).fromString(t)},[oQ,oJ,o0,o1,o2,o5,o3,o4].forEach(function(e){tG(o7,e)}),o6.types=o7.types,o6.properties=o7.properties,o6.propertyGroups=o7.propertyGroups,o6.propertyGroupNames=o7.propertyGroupNames,o6.propertyGroupKeys=o7.propertyGroupKeys;var o9={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,r,n,a,i=arguments,o=this._private.pan;switch(i.length){case 0:return o;case 1:if(tC(i[0]))return o[e=i[0]];if(tT(i[0])){if(!this._private.panningEnabled)return this;n=(r=i[0]).x,a=r.y,tP(n)&&(o.x=n),tP(a)&&(o.y=a),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;e=i[0],t=i[1],("x"===e||"y"===e)&&tP(t)&&(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var r,n,a,i=arguments,o=this._private.pan;if(!this._private.panningEnabled)return this;switch(i.length){case 1:tT(e)&&(n=(r=i[0]).x,a=r.y,tP(n)&&(o.x+=n),tP(a)&&(o.y+=a),this.emit("pan viewport"));break;case 2:("x"===e||"y"===e)&&tP(t)&&(o[e]+=t),this.emit("pan viewport")}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var r=this.getFitViewport(e,t);if(r){var n=this._private;n.zoom=r.zoom,n.pan=r.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(tP(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){if(tC(e)){var r,n,a,i=e;e=this.$(i)}else if(tT(r=e)&&tP(r.x1)&&tP(r.x2)&&tP(r.y1)&&tP(r.y2)){var o=e;(n={x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1}else tD(e)||(e=this.mutableElements());if(!(tD(e)&&e.empty())){n=n||e.boundingBox();var s=this.width(),l=this.height();if(t=tP(t)?t:0,!isNaN(s)&&!isNaN(l)&&s>0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){a=(a=(a=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:a)<this._private.minZoom?this._private.minZoom:a;var u={x:(s-a*(n.x1+n.x2))/2,y:(l-a*(n.y1+n.y2))/2};return{zoom:a,pan:u}}}}},zoomRange:function(e,t){var r=this._private;if(null==t){var n=e;e=n.min,t=n.max}return tP(e)&&tP(t)&&e<=t?(r.minZoom=e,r.maxZoom=t):tP(e)&&void 0===t&&e<=r.maxZoom?r.minZoom=e:tP(t)&&void 0===e&&t>=r.minZoom&&(r.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,r,n=this._private,a=n.pan,i=n.zoom,o=!1;if(n.zoomingEnabled||(o=!0),tP(e)?r=e:tT(e)&&(r=e.level,null!=e.position?t=rJ(e.position,i,a):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||n.panningEnabled||(o=!0)),r=(r=r>n.maxZoom?n.maxZoom:r)<n.minZoom?n.minZoom:r,o||!tP(r)||r===i||null!=t&&(!tP(t.x)||!tP(t.y)))return null;if(null==t)return{zoomed:!0,panned:!1,zoom:r,pan:a};var s=r,l={x:-s/i*(t.x-a.x)+t.x,y:-s/i*(t.y-a.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),r=this._private;return null!=t&&t.zoomed&&(r.zoom=t.zoom,t.panned&&(r.pan.x=t.pan.x,r.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport")),this},viewport:function(e){var t=this._private,r=!0,n=!0,a=[],i=!1;if(!e||(tP(e.zoom)||(r=!1),tT(e.pan)||(n=!1),!r&&!n))return this;if(r){var o=e.zoom;o<t.minZoom||o>t.maxZoom||!t.zoomingEnabled?i=!0:(t.zoom=o,a.push("zoom"))}if(n&&(!i||!e.cancelOnFailedZoom)&&t.panningEnabled){var s=e.pan;tP(s.x)&&(t.pan.x=s.x),tP(s.y)&&(t.pan.y=s.y),a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.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(tC(e)){var r=e;e=this.mutableElements().filter(r)}else tD(e)||(e=this.mutableElements());if(0!==e.length){var n=e.boundingBox(),a=this.width(),i=this.height();return{x:(a-(t=void 0===t?this._private.zoom:t)*(n.x1+n.x2))/2,y:(i-t*(n.y1+n.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,r=this._private,n=r.container;return r.sizeCache=r.sizeCache||(n?(e=this.window().getComputedStyle(n),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:n.clientWidth-t("padding-left")-t("padding-right"),height:n.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,r=this.renderedExtent(),n={x1:(r.x1-e.x)/t,x2:(r.x2-e.x)/t,y1:(r.y1-e.y)/t,y2:(r.y2-e.y)/t};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},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}};o9.centre=o9.center,o9.autolockNodes=o9.autolock,o9.autoungrabifyNodes=o9.autoungrabify;var o8={data:ii.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ii.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ii.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ii.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};o8.attr=o8.data,o8.removeAttr=o8.removeData;var se=function(e){var t=this,r=(e=tG({},e)).container;r&&!t_(r)&&t_(r[0])&&(r=r[0]);var n=r?r._cyreg:null;(n=n||{}).cy&&(n.cy.destroy(),n={});var a=n.readies=n.readies||[];r&&(r._cyreg=n),n.cy=t;var i=void 0!==ty&&void 0!==r&&!e.headless,o=e;o.layout=tG({name:i?"grid":"null"},o.layout),o.renderer=tG({name:i?"canvas":"null"},o.renderer);var s=function(e,t,r){return void 0!==t?t:void 0!==r?r:e},l=this._private={container:r,ready:!1,options:o,elements:new oM(this),listeners:[],aniEles:new oM(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?i:o.styleEnabled,zoom:tP(o.zoom)?o.zoom:1,pan:{x:tT(o.pan)&&tP(o.pan.x)?o.pan.x:0,y:tT(o.pan)&&tP(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 u=tG({},o,o.renderer);t.initRenderer(u);var c=function(e,r,n){t.notifications(!1);var a=t.mutableElements();a.length>0&&a.remove(),null!=e&&(tT(e)||tS(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.one("load",r),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",n),t.emit("done")});var i=tG({},t._private.options.layout);i.eles=t.elements(),t.layout(i).run()};!function(e,t){if(e.some(tL))return aZ.all(e).then(t);t(e)}([o.style,o.elements],function(e){var r=e[0],i=e[1];l.styleEnabled&&t.style().append(r),c(i,function(){t.startAnimationLoop(),l.ready=!0,tE(o.ready)&&t.on("ready",o.ready);for(var e=0;e<a.length;e++){var r=a[e];t.on("ready",r)}n&&(n.readies=[]),t.emit("ready")},o.done)})},st=se.prototype;tG(st,{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 ty;var e=this._private.container.ownerDocument;return void 0===e||null==e?ty:e.defaultView||ty},mount:function(e){if(null!=e){var t=this._private,r=t.options;return!t_(e)&&t_(e[0])&&(e=e[0]),this.stopAnimationLoop(),this.destroyRenderer(),t.container=e,t.styleEnabled=!0,this.invalidateSize(),this.initRenderer(tG({},r,r.renderer,{name:"null"===r.renderer.name?"canvas":r.renderer.name})),this.startAnimationLoop(),this.style(r.style),this.emit("mount"),this}},unmount:function(){return this.stopAnimationLoop(),this.destroyRenderer(),this.initRenderer({name:"null"}),this.emit("unmount"),this},options:function(){return rE(this._private.options)},json:function(e){var t=this,r=t._private,n=t.mutableElements();if(tT(e)){if(t.startBatch(),e.elements){var a={},i=function(e,r){for(var n=[],i=[],o=0;o<e.length;o++){var s=e[o];if(!s.data.id){rC("cy.json() cannot handle elements without an ID attribute");continue}var l=""+s.data.id,u=t.getElementById(l);a[l]=!0,0!==u.length?i.push({ele:u,json:s}):(r&&(s.group=r),n.push(s))}t.add(n);for(var c=0;c<i.length;c++){var d=i[c],h=d.ele,f=d.json;h.json(f)}};if(tS(e.elements))i(e.elements);else for(var o=["nodes","edges"],s=0;s<o.length;s++){var l=o[s],u=e.elements[l];tS(u)&&i(u,l)}var c=t.collection();n.filter(function(e){return!a[e.id()]}).forEach(function(e){e.isParent()?c.merge(e):e.remove()}),c.forEach(function(e){return e.children().move({parent:null})}),c.forEach(function(e){return t.getElementById(e.id()).remove()})}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==r.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==r.pan.x||e.pan.y!==r.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={},n.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=rE(t.data());var g=r.options;return p.zoomingEnabled=r.zoomingEnabled,p.userZoomingEnabled=r.userZoomingEnabled,p.zoom=r.zoom,p.minZoom=r.minZoom,p.maxZoom=r.maxZoom,p.panningEnabled=r.panningEnabled,p.userPanningEnabled=r.userPanningEnabled,p.pan=rE(r.pan),p.boxSelectionEnabled=r.boxSelectionEnabled,p.renderer=rE(g.renderer),p.hideEdgesOnViewport=g.hideEdgesOnViewport,p.textureOnViewport=g.textureOnViewport,p.wheelSensitivity=g.wheelSensitivity,p.motionBlur=g.motionBlur,p.multiClickDebounceTime=g.multiClickDebounceTime,p}}),st.$id=st.getElementById,[{add:function(e){var t;if(tD(e))if(e._private.cy===this)t=e.restore();else{for(var r=[],n=0;n<e.length;n++){var a=e[n];r.push(a.json())}t=new oM(this,r)}else if(tS(e))t=new oM(this,e);else if(tT(e)&&(tS(e.nodes)||tS(e.edges))){for(var i=[],o=["nodes","edges"],s=0,l=o.length;s<l;s++){var u=o[s],c=e[u];if(tS(c))for(var d=0,h=c.length;d<h;d++){var f=tG({group:u},c[d]);i.push(f)}}t=new oM(this,i)}else t=new rV(this,e).collection();return t},remove:function(e){if(tD(e));else if(tC(e)){var t=e;e=this.$(t)}return e.remove()}},oq,oW,oU,o$,{notify:function(e,t){var r=this._private;if(this.batching()){r.batchNotifications=r.batchNotifications||{};var n=r.batchNotifications[e]=r.batchNotifications[e]||this.collection();null!=t&&n.merge(t);return}if(r.notificationsEnabled){var a=this.renderer();!this.destroyed()&&a&&a.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(r){var n=e.batchNotifications[r];n.empty()?t.notify(r):t.notify(r,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var r=Object.keys(e),n=0;n<r.length;n++){var a=r[n],i=e[a];t.getElementById(a).data(i)}})}},oG,oZ,{style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return tR(e)?t.style=e.generateStyle(this):tS(e)?t.style=o6.fromJson(this,e):tC(e)?t.style=o6.fromString(this,e):t.style=o6(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},o9,o8].forEach(function(e){tG(st,e)});var sr={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}},sn={maximal:!1,acyclic:!1},sa=function(e){return e.scratch("breadthfirst")},si=function(e,t){return e.scratch("breadthfirst",t)};function so(e){this.options=tG({},sr,sn,e)}so.prototype.run=function(){var e,t=this.options,r=t.cy,n=t.eles,a=n.nodes().filter(function(e){return e.isChildless()}),i=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,s=!!t.boundingBox,l=no(s?t.boundingBox:structuredClone(r.extent()));if(tD(t.roots))e=t.roots;else if(tS(t.roots)){for(var u=[],c=0;c<t.roots.length;c++){var d=t.roots[c],h=r.getElementById(d);u.push(h)}e=r.collection(u)}else if(tC(t.roots))e=r.$(t.roots);else if(i)e=a.roots();else{var f=n.components();e=r.collection();for(var p=0;p<f.length;p++)!function(){var t=f[p],r=t.maxDegree(!1),n=t.filter(function(e){return e.degree(!1)===r});e=e.add(n)}()}var g=[],v={},y=function(e,t){null==g[t]&&(g[t]=[]);var r=g[t].length;g[t].push(e),si(e,{index:r,depth:t})},x=function(e,t){var r=sa(e),n=r.depth,a=r.index;g[n][a]=null,e.isChildless()&&y(e,t)};n.bfs({roots:e,directed:t.directed,visit:function(e,t,r,n,a){var i=e[0],o=i.id();i.isChildless()&&y(i,a),v[o]=!0}});for(var b=[],w=0;w<a.length;w++){var j=a[w];v[j.id()]||b.push(j)}var N=function(e){for(var t=g[e],r=0;r<t.length;r++){var n=t[r];if(null==n){t.splice(r,1),r--;continue}si(n,{depth:e,index:r})}};if(i&&o){var k=[],C={},E=function(e){return k.push(e)};for(a.forEach(function(e){return k.push(e)});k.length>0;){var S=k.shift(),T=function(e,r){for(var a=sa(e),i=e.incomers().filter(function(e){return e.isNode()&&n.has(e)}),o=-1,s=e.id(),l=0;l<i.length;l++)o=Math.max(o,sa(i[l]).depth);if(a.depth<=o){if(!t.acyclic&&r[s])return null;var u=o+1;return x(e,u),r[s]=u,!0}return!1}(S,C);if(T)S.outgoers().filter(function(e){return e.isNode()&&n.has(e)}).forEach(E);else if(null===T){rC("Detected double maximal shift for node `"+S.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var P=0;if(t.avoidOverlap)for(var _=0;_<a.length;_++){var D=a[_].layoutDimensions(t),B=D.w,M=D.h;P=Math.max(P,B,M)}var A={},R=function(e){if(A[e.id()])return A[e.id()];for(var t=sa(e).depth,r=e.neighborhood(),n=0,i=0,o=0;o<r.length;o++){var s=r[o];if(!(s.isEdge()||s.isParent())&&a.has(s)){var l=sa(s);if(null!=l){var u=l.index,c=l.depth;if(null!=u&&null!=c){var d=g[c].length;c<t&&(n+=u/d,i++)}}}}return n/=i=Math.max(1,i),0===i&&(n=0),A[e.id()]=n,n},I=function(e,t){var r=R(e)-R(t);return 0===r?tK(e.id(),t.id()):r};void 0!==t.depthSort&&(I=t.depthSort);for(var L=g.length,O=0;O<L;O++)g[O].sort(I),N(O);for(var z=[],V=0;V<b.length;V++)z.push(b[V]);if(z.length){g.unshift(z),L=g.length;for(var F=0;F<L;F++)N(F)}for(var H=0,q=0;q<L;q++)H=Math.max(g[q].length,H);var X={x:l.x1+l.w/2,y:l.y1+l.h/2},Y=a.reduce(function(e,r){var n;return n=r.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}),{w:-1===e.w?n.w:(e.w+n.w)/2,h:-1===e.h?n.h:(e.h+n.h)/2}},{w:-1,h:-1}),W=Math.max(1===L?0:s?(l.h-2*t.padding-Y.h)/(L-1):(l.h-2*t.padding-Y.h)/(L+1),P),U=g.reduce(function(e,t){return Math.max(e,t.length)},0),$=function(e){var r=sa(e),n=r.depth,a=r.index;if(t.circle){var i=Math.min(l.w/2/L,l.h/2/L),o=(i=Math.max(i,P))*n+i-(L>0&&g[0].length<=3?i/2:0),u=2*Math.PI/g[n].length*a;return 0===n&&1===g[0].length&&(o=1),{x:X.x+o*Math.cos(u),y:X.y+o*Math.sin(u)}}var c=g[n].length,d=Math.max(1===c?0:s?(l.w-2*t.padding-Y.w)/((t.grid?U:c)-1):(l.w-2*t.padding-Y.w)/((t.grid?U:c)+1),P);return{x:X.x+(a+1-(c+1)/2)*d,y:X.y+(n+1-(L+1)/2)*W}},K={downward:0,leftward:90,upward:180,rightward:-90};return -1===Object.keys(K).indexOf(t.direction)&&rN("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(K).join(", "))),n.nodes().layoutPositions(this,t,function(e){return function(e,t,r){if(0===r)return e;var n,a,i,o,s=(t.x1+t.x2)/2,l=(t.y1+t.y2)/2,u=t.w/t.h,c=(n=e.x,a=e.y,{x:Math.cos(i=r*Math.PI/180)*(n-s)-Math.sin(i)*(a-l)+s,y:Math.sin(i)*(n-s)+Math.cos(i)*(a-l)+l}),d=(o=c.x,{x:(o-s)*u+s,y:(c.y-l)*(1/u)+l});return{x:d.x,y:d.y}}($(e),l,K[t.direction])}),this};var ss={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 sl(e){this.options=tG({},ss,e)}sl.prototype.run=function(){var e,t=this.options,r=t.cy,n=t.eles,a=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,i=n.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));for(var o=no(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.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/i.length:t.sweep)/Math.max(1,i.length-1),u=0,c=0;c<i.length;c++){var d=i[c].layoutDimensions(t);u=Math.max(u,d.w,d.h)}if(e=tP(t.radius)?t.radius:i.length<=1?0:Math.min(o.h,o.w)/2-u,i.length>1&&t.avoidOverlap){var h=Math.cos(l)-1,f=Math.sin(l)-0;e=Math.max(Math.sqrt((u*=1.75)*u/(h*h+f*f)),e)}return n.nodes().layoutPositions(this,t,function(r,n){var i=t.startAngle+n*l*(a?1:-1),o=e*Math.cos(i),u=e*Math.sin(i);return{x:s.x+o,y:s.y+u}}),this};var su={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 sc(e){this.options=tG({},su,e)}sc.prototype.run=function(){for(var e=this.options,t=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,r=e.cy,n=e.eles,a=n.nodes().not(":parent"),i=no(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:i.x1+i.w/2,y:i.y1+i.h/2},s=[],l=0,u=0;u<a.length;u++){var c=a[u],d=void 0;d=e.concentric(c),s.push({value:d,node:c}),c._private.scratch.concentric=d}a.updateStyle();for(var h=0;h<a.length;h++){var f=a[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(a),g=[[]],v=g[0],y=0;y<s.length;y++){var x=s[y];v.length>0&&Math.abs(v[0].value-x.value)>=p&&(v=[],g.push(v)),v.push(x)}var b=l+e.minNodeSpacing;if(!e.avoidOverlap){var w=g.length>0&&g[0].length>1,j=(Math.min(i.w,i.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,S=C.dTheta=E/Math.max(1,C.length-1);if(C.length>1&&e.avoidOverlap){var T=Math.cos(S)-1,P=Math.sin(S)-0;N=Math.max(Math.sqrt(b*b/(T*T+P*P)),N)}C.r=N,N+=b}if(e.equidistant){for(var _=0,D=0,B=0;B<g.length;B++)_=Math.max(_,g[B].r-D);D=0;for(var M=0;M<g.length;M++){var A=g[M];0===M&&(D=A.r),A.r=D,D+=_}}for(var R={},I=0;I<g.length;I++)for(var L=g[I],O=L.dTheta,z=L.r,V=0;V<L.length;V++){var F=L[V],H=e.startAngle+(t?1:-1)*O*V,q={x:o.x+z*Math.cos(H),y:o.y+z*Math.sin(H)};R[F.node.id()]=q}return n.nodes().layoutPositions(this,e,function(e){return R[e.id()]}),this};var sd={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 sh(e){this.options=tG({},sd,e),this.options.layout=this;var t=this.options.eles.nodes(),r=this.options.eles.edges().filter(function(e){var r=e.source().data("id"),n=e.target().data("id"),a=t.some(function(e){return e.data("id")===r}),i=t.some(function(e){return e.data("id")===n});return!a||!i});this.options.eles=this.options.eles.not(r)}sh.prototype.run=function(){var e=this.options,t=e.cy,r=this;r.stopped=!1,(!0===e.animate||!1===e.animate)&&r.emit({type:"layoutstart",layout:r}),ce=!0===e.debug;var n=sf(t,r,e);ce&&ct(n),e.randomize&&sm(n);var a=rn(),i=function(){sy(n,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!r.stopped&&!(t>=e.numIter)&&(sx(n,e),n.temperature=n.temperature*e.coolingFactor,!(n.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)i(),r.one("layoutstop",e.stop),r.emit({type:"layoutstop",layout:r});else{var t=e.eles.nodes(),a=sv(n,e,t);t.layoutPositions(r,e,a)}},l=0,u=!0;if(!0===e.animate){var c=function(){for(var t=0;u&&t<e.refresh;)u=o(l),l++,t++;u?(rn()-a>=e.animationThreshold&&i(),ri(c)):(sD(n,e),s())};c()}else{for(;u;)u=o(l),l++;sD(n,e),s()}return this},sh.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},sh.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var sf=function(e,t,r){for(var n=r.eles.edges(),a=r.eles.nodes(),i=no(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:r.initialTemp,clientWidth:i.w,clientHeight:i.h,boundingBox:i},s=r.eles.components(),l={},u=0;u<s.length;u++)for(var c=s[u],d=0;d<c.length;d++){var h=c[d];l[h.id()]=u}for(var u=0;u<o.nodeSize;u++){var f=a[u],p=f.layoutDimensions(r),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=tE(r.nodeRepulsion)?r.nodeRepulsion(f):r.nodeRepulsion,o.layoutNodes.push(g),o.idToIndex[g.id]=u}for(var v=[],y=0,x=-1,b=[],u=0;u<o.nodeSize;u++){var f=o.layoutNodes[u],w=f.parentId;null!=w?o.layoutNodes[o.idToIndex[w]].children.push(f.id):(v[++x]=f.id,b.push(f.id))}for(o.graphSet.push(b);y<=x;){var j=v[y++],N=o.idToIndex[j],h=o.layoutNodes[N],k=h.children;if(k.length>0){o.graphSet.push(k);for(var u=0;u<k.length;u++)v[++x]=k[u]}}for(var u=0;u<o.graphSet.length;u++)for(var C=o.graphSet[u],d=0;d<C.length;d++){var E=o.idToIndex[C[d]];o.indexToGraph[E]=u}for(var u=0;u<o.edgeSize;u++){var S=n[u],T={};T.id=S.data("id"),T.sourceId=S.data("source"),T.targetId=S.data("target");var P=tE(r.idealEdgeLength)?r.idealEdgeLength(S):r.idealEdgeLength,_=tE(r.edgeElasticity)?r.edgeElasticity(S):r.edgeElasticity,D=o.idToIndex[T.sourceId],B=o.idToIndex[T.targetId];if(o.indexToGraph[D]!=o.indexToGraph[B]){for(var M=sp(T.sourceId,T.targetId,o),A=o.graphSet[M],R=0,g=o.layoutNodes[D];-1===A.indexOf(g.id);)g=o.layoutNodes[o.idToIndex[g.parentId]],R++;for(g=o.layoutNodes[B];-1===A.indexOf(g.id);)g=o.layoutNodes[o.idToIndex[g.parentId]],R++;P*=R*r.nestingFactor}T.idealLength=P,T.elasticity=_,o.layoutEdges.push(T)}return o},sp=function(e,t,r){var n=sg(e,t,0,r);return 2>n.count?0:n.graph},sg=function(e,t,r,n){var a=n.graphSet[r];if(-1<a.indexOf(e)&&-1<a.indexOf(t))return{count:2,graph:r};for(var i=0,o=0;o<a.length;o++){var s=a[o],l=n.idToIndex[s],u=n.layoutNodes[l].children;if(0!==u.length){var c=sg(e,t,n.indexToGraph[n.idToIndex[u[0]]],n);if(0===c.count)continue;if(1!==c.count)return c;if(2==++i)break}}return{count:i,graph:r}},sm=function(e,t){for(var r=e.clientWidth,n=e.clientHeight,a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];0!==i.children.length||i.isLocked||(i.positionX=Math.random()*r,i.positionY=Math.random()*n)}},sv=function(e,t,r){var n=e.boundingBox,a={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(r.forEach(function(t){var r=e.layoutNodes[e.idToIndex[t.data("id")]];a.x1=Math.min(a.x1,r.positionX),a.x2=Math.max(a.x2,r.positionX),a.y1=Math.min(a.y1,r.positionY),a.y2=Math.max(a.y2,r.positionY)}),a.w=a.x2-a.x1,a.h=a.y2-a.y1),function(r,i){var o=e.layoutNodes[e.idToIndex[r.data("id")]];if(!t.boundingBox)return{x:o.positionX,y:o.positionY};var s=0===a.w?.5:(o.positionX-a.x1)/a.w,l=0===a.h?.5:(o.positionY-a.y1)/a.h;return{x:n.x1+s*n.w,y:n.y1+l*n.h}}},sy=function(e,t,r){var n=r.layout,a=r.eles.nodes(),i=sv(e,r,a);a.positions(i),!0!==e.ready&&(e.ready=!0,n.one("layoutready",r.ready),n.emit({type:"layoutready",layout:this}))},sx=function(e,t,r){sb(e,t),sC(e),sE(e,t),sS(e),sT(e)},sb=function(e,t){for(var r=0;r<e.graphSet.length;r++)for(var n=e.graphSet[r],a=n.length,i=0;i<a;i++)for(var o=e.layoutNodes[e.idToIndex[n[i]]],s=i+1;s<a;s++)sj(o,e.layoutNodes[e.idToIndex[n[s]]],e,t)},sw=function(e){return -1+2*e*Math.random()},sj=function(e,t,r,n){if(e.cmptId===t.cmptId||r.isCompound){var a=t.positionX-e.positionX,i=t.positionY-e.positionY;0===a&&0===i&&(a=sw(1),i=sw(1));var o=sN(e,t,a,i);if(o>0)var s=n.nodeOverlap*o,l=Math.sqrt(a*a+i*i),u=s*a/l,c=s*i/l;else var d=sk(e,a,i),h=sk(t,-1*a,-1*i),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,u=s*f/l,c=s*p/l;e.isLocked||(e.offsetX-=u,e.offsetY-=c),t.isLocked||(t.offsetX+=u,t.offsetY+=c)}},sN=function(e,t,r,n){if(r>0)var a=e.maxX-t.minX;else var a=t.maxX-e.minX;if(n>0)var i=e.maxY-t.minY;else var i=t.maxY-e.minY;return a>=0&&i>=0?Math.sqrt(a*a+i*i):0},sk=function(e,t,r){var n=e.positionX,a=e.positionY,i=e.height||1,o=e.width||1,s=r/t,l=i/o,u={};return 0===t&&0<r||0===t&&0>r?(u.x=n,u.y=a+i/2):0<t&&-1*l<=s&&s<=l?(u.x=n+o/2,u.y=a+o*r/2/t):0>t&&-1*l<=s&&s<=l?(u.x=n-o/2,u.y=a-o*r/2/t):0<r&&(s<=-1*l||s>=l)?(u.x=n+i*t/2/r,u.y=a+i/2):0>r&&(s<=-1*l||s>=l)&&(u.x=n-i*t/2/r,u.y=a-i/2),u},sC=function(e,t){for(var r=0;r<e.edgeSize;r++){var n=e.layoutEdges[r],a=e.idToIndex[n.sourceId],i=e.layoutNodes[a],o=e.idToIndex[n.targetId],s=e.layoutNodes[o],l=s.positionX-i.positionX,u=s.positionY-i.positionY;if(0!==l||0!==u){var c=sk(i,l,u),d=sk(s,-1*l,-1*u),h=d.x-c.x,f=d.y-c.y,p=Math.sqrt(h*h+f*f),g=Math.pow(n.idealLength-p,2)/n.elasticity;if(0!==p)var v=g*h/p,y=g*f/p;else var v=0,y=0;i.isLocked||(i.offsetX+=v,i.offsetY+=y),s.isLocked||(s.offsetX-=v,s.offsetY-=y)}}},sE=function(e,t){if(0!==t.gravity)for(var r=0;r<e.graphSet.length;r++){var n=e.graphSet[r],a=n.length;if(0===r)var i=e.clientHeight/2,o=e.clientWidth/2;else var s=e.layoutNodes[e.idToIndex[n[0]]],l=e.layoutNodes[e.idToIndex[s.parentId]],i=l.positionX,o=l.positionY;for(var u=0;u<a;u++){var c=e.layoutNodes[e.idToIndex[n[u]]];if(!c.isLocked){var d=i-c.positionX,h=o-c.positionY,f=Math.sqrt(d*d+h*h);if(f>1){var p=t.gravity*d/f,g=t.gravity*h/f;c.offsetX+=p,c.offsetY+=g}}}}},sS=function(e,t){var r=[],n=0,a=-1;for(r.push.apply(r,e.graphSet[0]),a+=e.graphSet[0].length;n<=a;){var i=r[n++],o=e.idToIndex[i],s=e.layoutNodes[o],l=s.children;if(0<l.length&&!s.isLocked){for(var u=s.offsetX,c=s.offsetY,d=0;d<l.length;d++){var h=e.layoutNodes[e.idToIndex[l[d]]];h.offsetX+=u,h.offsetY+=c,r[++a]=l[d]}s.offsetX=0,s.offsetY=0}}},sT=function(e,t){for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];if(!(0<n.children.length)&&!n.isLocked){var a=sP(n.offsetX,n.offsetY,e.temperature);n.positionX+=a.x,n.positionY+=a.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,s_(n,e)}}for(var r=0;r<e.nodeSize;r++){var n=e.layoutNodes[r];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},sP=function(e,t,r){var n=Math.sqrt(e*e+t*t);if(n>r)var a={x:r*e/n,y:r*t/n};else var a={x:e,y:t};return a},s_=function(e,t){var r=e.parentId;if(null!=r){var n=t.layoutNodes[t.idToIndex[r]],a=!1;if((null==n.maxX||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,a=!0),(null==n.minX||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,a=!0),(null==n.maxY||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,a=!0),(null==n.minY||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,a=!0),a)return s_(n,t)}},sD=function(e,t){for(var r=e.layoutNodes,n=[],a=0;a<r.length;a++){var i=r[a],o=i.cmptId;(n[o]=n[o]||[]).push(i)}for(var s=0,a=0;a<n.length;a++){var l=n[a];if(l){l.x1=1/0,l.x2=-1/0,l.y1=1/0,l.y2=-1/0;for(var u=0;u<l.length;u++){var c=l[u];l.x1=Math.min(l.x1,c.positionX-c.width/2),l.x2=Math.max(l.x2,c.positionX+c.width/2),l.y1=Math.min(l.y1,c.positionY-c.height/2),l.y2=Math.max(l.y2,c.positionY+c.height/2)}l.w=l.x2-l.x1,l.h=l.y2-l.y1,s+=l.w*l.h}}n.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,a=0;a<n.length;a++){var l=n[a];if(l){for(var u=0;u<l.length;u++){var c=l[u];c.isLocked||(c.positionX+=d-l.x1,c.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)}}},sB={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 sM(e){this.options=tG({},sB,e)}sM.prototype.run=function(){var e=this.options,t=e.cy,r=e.eles,n=r.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var a=no(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,e,function(e){return{x:a.x1,y:a.y1}});else{var i=n.size(),o=Math.sqrt(i*a.h/a.w),s=Math.round(o),l=Math.round(a.w/a.h*o),u=function(e){if(null==e)return Math.min(s,l);Math.min(s,l)==s?s=e:l=e},c=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(i/(s=d));else if(null==d&&null!=h)s=Math.ceil(i/(l=h));else if(l*s>i){var f=u(),p=c();(f-1)*p>=i?u(f-1):(p-1)*f>=i&&c(p-1)}else for(;l*s<i;){var g=u(),v=c();(v+1)*g>=i?c(v+1):u(g+1)}var y=a.w/l,x=a.h/s;if(e.condense&&(y=0,x=0),e.avoidOverlap)for(var b=0;b<n.length;b++){var w=n[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;y=Math.max(y,C),x=Math.max(x,E)}for(var S={},T=function(e,t){return!!S["c-"+e+"-"+t]},P=function(e,t){S["c-"+e+"-"+t]=!0},_=0,D=0,B=function(){++D>=l&&(D=0,_++)},M={},A=0;A<n.length;A++){var R=n[A],I=e.position(R);if(I&&(void 0!==I.row||void 0!==I.col)){var L={row:I.row,col:I.col};if(void 0===L.col)for(L.col=0;T(L.row,L.col);)L.col++;else if(void 0===L.row)for(L.row=0;T(L.row,L.col);)L.row++;M[R.id()]=L,P(L.row,L.col)}}n.layoutPositions(this,e,function(e,t){if(e.locked()||e.isParent())return!1;var r,n,i=M[e.id()];if(i)r=i.col*y+y/2+a.x1,n=i.row*x+x/2+a.y1;else{for(;T(_,D);)B();r=D*y+y/2+a.x1,n=_*x+x/2+a.y1,P(_,D),B()}return{x:r,y:n}})}return this};var sA={ready:function(){},stop:function(){}};function sR(e){this.options=tG({},sA,e)}sR.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},sR.prototype.stop=function(){return this};var sI={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 sL(e){this.options=tG({},sI,e)}sL.prototype.run=function(){var e=this.options,t=e.eles.nodes(),r=tE(e.positions);return t.layoutPositions(this,e,function(t,n){var a=function(t){if(null==e.positions){var n;return{x:(n=t.position()).x,y:n.y}}if(r)return e.positions(t);var a=e.positions[t._private.data.id];return null==a?null:a}(t);return!t.locked()&&null!=a&&a}),this};var sO={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 sz(e){this.options=tG({},sO,e)}sz.prototype.run=function(){var e=this.options,t=e.cy,r=e.eles,n=no(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return r.nodes().layoutPositions(this,e,function(e,t){return{x:n.x1+Math.round(Math.random()*n.w),y:n.y1+Math.round(Math.random()*n.h)}}),this};var sV=[{name:"breadthfirst",impl:so},{name:"circle",impl:sl},{name:"concentric",impl:sc},{name:"cose",impl:sh},{name:"grid",impl:sM},{name:"null",impl:sR},{name:"preset",impl:sL},{name:"random",impl:sz}];function sF(e){this.options=e,this.notifications=0}var sH=function(){},sq=function(){throw Error("A headless instance can not render images")};sF.prototype={recalculateRenderedStyle:sH,notify:function(){this.notifications++},init:sH,isHeadless:function(){return!0},png:sq,jpg:sq};var sX={};sX.arrowShapeWidth=.3,sX.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,r=function(e,t,r,n,a,i,o){var s=a.x-r/2-o,l=a.x+r/2+o,u=a.y-r/2-o,c=a.y+r/2+o;return s<=e&&e<=l&&u<=t&&t<=c},n=function(e,t,r,n,a){var i=e*Math.cos(n)-t*Math.sin(n),o=e*Math.sin(n)+t*Math.cos(n);return{x:i*r+a.x,y:o*r+a.y}},a=function(e,t,r,a){for(var i=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];i.push(n(s,l,t,r,a))}return i},i=function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];t.push(n.x,n.y)}return t},o=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},s=function(n,s){tC(s)&&(s=e[s]),e[n]=tG({name:n,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,r,n,o,s){return nC(e,t,i(a(this.points,r+2*s,n,o)))},roughCollide:r,draw:function(e,r,n,i){var o=a(this.points,r,n,i);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:rb,roughCollide:rb,draw:rj,spacing:rw,gap:rw}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(e,r,i,o,s){var l=a(this.points,r,i,o),u=this.controlPoint,c=n(u[0],u[1],r,i,o);t.arrowShapeImpl(this.name)(e,l,c)},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,r,n,o,s,l){var u=i(a(this.points,r+2*l,n,o)),c=i(a(this.pointsTee,r+2*l,n,o));return nC(e,t,u)||nC(e,t,c)},draw:function(e,r,n,i,o){var s=a(this.points,r,n,i),l=a(this.pointsTee,r,n,i);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,r,n,o,s,l){var u=Math.pow(o.x-e,2)+Math.pow(o.y-t,2)<=Math.pow((r+2*l)*this.radius,2);return nC(e,t,i(a(this.points,r+2*l,n,o)))||u},draw:function(e,r,n,i,o){var s=a(this.pointsTr,r,n,i);t.arrowShapeImpl(this.name)(e,s,i.x,i.y,this.radius*r)},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 r=this.baseCrossLinePts.slice(),n=t/e;return r[3]=r[3]-n,r[5]=r[5]-n,r},collide:function(e,t,r,n,o,s,l){var u=i(a(this.points,r+2*l,n,o)),c=i(a(this.crossLinePts(r,s),r+2*l,n,o));return nC(e,t,u)||nC(e,t,c)},draw:function(e,r,n,i,o){var s=a(this.points,r,n,i),l=a(this.crossLinePts(r,o),r,n,i);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,r,n,a,i,o){return Math.pow(a.x-e,2)+Math.pow(a.y-t,2)<=Math.pow((r+2*o)*this.radius,2)},draw:function(e,r,n,a,i){t.arrowShapeImpl(this.name)(e,a.x,a.y,this.radius*r)},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 sY={};sY.projectIntoViewport=function(e,t){var r=this.cy,n=this.findContainerClientCoords(),a=n[0],i=n[1],o=n[4],s=r.pan(),l=r.zoom();return[((e-a)/o-s.x)/l,((t-i)/o-s.y)/l]},sY.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),r=this.cy.window().getComputedStyle(e),n=function(e){return parseFloat(r.getPropertyValue(e))},a={left:n("padding-left"),right:n("padding-right"),top:n("padding-top"),bottom:n("padding-bottom")},i={left:n("border-left-width"),right:n("border-right-width"),top:n("border-top-width"),bottom:n("border-bottom-width")},o=e.clientWidth,s=e.clientHeight,l=a.left+a.right,u=a.top+a.bottom,c=i.left+i.right,d=t.width/(o+c),h=t.left+a.left+i.left,f=t.top+a.top+i.top;return this.containerBB=[h,f,o-l,s-u,d]},sY.invalidateContainerClientCoordsCache=function(){this.containerBB=null},sY.findNearestElement=function(e,t,r,n){return this.findNearestElements(e,t,r,n)[0]},sY.findNearestElements=function(e,t,r,n){var a,i,o=this,s=this,l=s.getCachedZSortedEles(),u=[],c=s.cy.zoom(),d=s.cy.hasCompoundNodes(),h=(n?24:8)/c,f=(n?8:2)/c,p=(n?8:2)/c,g=1/0;function v(e,t){if(e.isNode())if(i)return;else i=e,u.push(e);if(e.isEdge()&&(null==t||t<g))if(a){if(a.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&a.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value){for(var r=0;r<u.length;r++)if(u[r].isEdge()){u[r]=e,a=e,g=null!=t?t:g;break}}}else u.push(e),a=e,g=null!=t?t:g}function y(r){var n=r.outerWidth()+2*f,a=r.outerHeight()+2*f,i=n/2,l=a/2,u=r.position(),c="auto"===r.pstyle("corner-radius").value?"auto":r.pstyle("corner-radius").pfValue,d=r._private.rscratch;if(u.x-i<=e&&e<=u.x+i&&u.y-l<=t&&t<=u.y+l&&s.nodeShapes[o.getNodeShape(r)].checkPoint(e,t,0,n,a,u.x,u.y,c,d))return v(r,0),!0}r&&(l=l.interactive);function x(r,n){var a,i=r._private;a=n?n+"-":"",r.boundingBox();var o=i.labelBounds[n||"main"],s=r.pstyle(a+"label").value;if("yes"===r.pstyle("text-events").strValue&&s){var l=rA(i.rscratch,"labelX",n),u=rA(i.rscratch,"labelY",n),c=rA(i.rscratch,"labelAngle",n),d=r.pstyle(a+"text-margin-x").pfValue,h=r.pstyle(a+"text-margin-y").pfValue,f=o.x1-p-d,g=o.x2+p-d,y=o.y1-p-h,x=o.y2+p-h;if(c){var b=Math.cos(c),w=Math.sin(c),j=function(e,t){return{x:(e-=l)*b-(t-=u)*w+l,y:e*w+t*b+u}},N=j(f,y),k=j(f,x),C=j(g,y),E=j(g,x);if(nC(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(r),!0}else if(np(o,e,t))return v(r),!0}}for(var b=l.length-1;b>=0;b--){var w=l[b];w.isNode()?y(w)||x(w):function(r){var n,a=r._private,i=a.rscratch,l=r.pstyle("width").pfValue,c=r.pstyle("arrow-scale").value,f=l/2+h,p=f*f,g=2*f,x=a.source,b=a.target;if("segments"===i.edgeType||"straight"===i.edgeType||"haystack"===i.edgeType){for(var w=i.allpts,j=0;j+3<w.length;j+=2)if(nx(e,t,w[j],w[j+1],w[j+2],w[j+3],g)&&p>(n=nk(e,t,w[j],w[j+1],w[j+2],w[j+3])))return v(r,n),!0}else if("bezier"===i.edgeType||"multibezier"===i.edgeType||"self"===i.edgeType||"compound"===i.edgeType){for(var w=i.allpts,j=0;j+5<i.allpts.length;j+=4)if(nb(e,t,w[j],w[j+1],w[j+2],w[j+3],w[j+4],w[j+5],g)&&p>(n=nN(e,t,w[j],w[j+1],w[j+2],w[j+3],w[j+4],w[j+5])))return v(r,n),!0}for(var x=x||a.source,b=b||a.target,N=o.getArrowWidth(l,c),k=[{name:"source",x:i.arrowStartX,y:i.arrowStartY,angle:i.srcArrowAngle},{name:"target",x:i.arrowEndX,y:i.arrowEndY,angle:i.tgtArrowAngle},{name:"mid-source",x:i.midX,y:i.midY,angle:i.midsrcArrowAngle},{name:"mid-target",x:i.midX,y:i.midY,angle:i.midtgtArrowAngle}],j=0;j<k.length;j++){var C=k[j],E=s.arrowShapes[r.pstyle(C.name+"-arrow-shape").value],S=r.pstyle("width").pfValue;if(E.roughCollide(e,t,N,C.angle,{x:C.x,y:C.y},S,h)&&E.collide(e,t,N,C.angle,{x:C.x,y:C.y},S,h))return v(r),!0}d&&u.length>0&&(y(x),y(b))}(w)||x(w)||x(w,"source")||x(w,"target")}return u},sY.getAllInBox=function(e,t,r,n){var a=this.getCachedZSortedEles().interactive,i=2/this.cy.zoom(),o=[],s=Math.min(e,r),l=Math.max(e,r),u=Math.min(t,n),c=Math.max(t,n);e=s,r=l;var d=no({x1:e,y1:t=u,x2:r,y2:n=c}),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 r=e._private;e.boundingBox();var n=r.labelBounds.main;if(!n)return null;var a=rA(r.rscratch,"labelX",t),o=rA(r.rscratch,"labelY",t),s=rA(r.rscratch,"labelAngle",t),l=e.pstyle("text-margin-x").pfValue,u=e.pstyle("text-margin-y").pfValue,c=n.x1-i-l,d=n.x2+i-l,h=n.y1-i-u,f=n.y2+i-u;if(!s)return[{x:c,y:h},{x:d,y:h},{x:d,y:f},{x:c,y:f}];var p=Math.cos(s),g=Math.sin(s),v=function(e,t){return{x:(e-=a)*p-(t-=o)*g+a,y:e*g+t*p+o}};return[v(c,h),v(d,h),v(d,f),v(c,f)]}for(var g=0;g<a.length;g++){var v=a[g];if(v.isNode()){var y="yes"===v.pstyle("text-events").strValue,x=v.pstyle("box-selection").strValue,b="yes"===v.pstyle("box-select-labels").strValue;if("none"===x)continue;var w=("overlap"===x||b)&&y,j=v.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:w});if("contain"===x){var N=!1;if(b&&y){var k=p(v);k&&nW(k,h)&&(o.push(v),N=!0)}!N&&nm(d,j)&&o.push(v)}else if("overlap"===x&&nf(d,j)){var C=v.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1});if(nW([{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&&nW(E,h)&&o.push(v)}}}else{var S=v._private,T=S.rscratch,P=v.pstyle("box-selection").strValue;if("none"===P)continue;if("contain"===P){if(null!=T.startX&&null!=T.startY&&!np(d,T.startX,T.startY)||null!=T.endX&&null!=T.endY&&!np(d,T.endX,T.endY))continue;if("bezier"===T.edgeType||"multibezier"===T.edgeType||"self"===T.edgeType||"compound"===T.edgeType||"segments"===T.edgeType||"haystack"===T.edgeType){for(var _=S.rstyle.bezierPts||S.rstyle.linePts||S.rstyle.haystackPts,D=!0,B=0;B<_.length;B++)if(!ng(d,_[B])){D=!1;break}D&&o.push(v)}else"straight"===T.edgeType&&o.push(v)}else if("overlap"===P){var M=!1;if(null!=T.startX&&null!=T.startY&&null!=T.endX&&null!=T.endY&&(np(d,T.startX,T.startY)||np(d,T.endX,T.endY)))o.push(v),M=!0;else if(!M&&"haystack"===T.edgeType){for(var A=S.rstyle.haystackPts,R=0;R<A.length;R++)if(ng(d,A[R])){o.push(v),M=!0;break}}if(!M){var I=S.rstyle.bezierPts||S.rstyle.linePts||S.rstyle.haystackPts;if((!I||I.length<2)&&"straight"===T.edgeType&&null!=T.startX&&null!=T.startY&&null!=T.endX&&null!=T.endY&&(I=[{x:T.startX,y:T.startY},{x:T.endX,y:T.endY}]),!I||I.length<2)continue;for(var L=0;L<I.length-1;L++){for(var O=I[L],z=I[L+1],V=0;V<f.length;V++){var F=tf(f[V],2);if(function(e,t,r,n){function a(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}return a(e,r,n)!==a(t,r,n)&&a(e,t,r)!==a(e,t,n)}(O,z,F[0],F[1])){o.push(v),M=!0;break}}if(M)break}}}}}return o};var sW={};sW.calculateArrowAngles=function(e){var t=e._private.rscratch,r="haystack"===t.edgeType,n="bezier"===t.edgeType,a="multibezier"===t.edgeType,i="segments"===t.edgeType,o="compound"===t.edgeType,s="self"===t.edgeType;if(r?(y=t.haystackPts[0],x=t.haystackPts[1],b=t.haystackPts[2],w=t.haystackPts[3]):(y=t.arrowStartX,x=t.arrowStartY,b=t.arrowEndX,w=t.arrowEndY),d=t.midX,h=t.midY,i)g=y-t.segpts[0],v=x-t.segpts[1];else if(a||o||s||n){var l=t.allpts,u=nr(l[0],l[2],l[4],.1),c=nr(l[1],l[3],l[5],.1);g=y-u,v=x-c}else g=y-d,v=x-h;t.srcArrowAngle=r6(g,v);var d=t.midX,h=t.midY;if(r&&(d=(y+b)/2,h=(x+w)/2),g=b-y,v=w-x,i){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(a||o||s){var g,v,y,x,b,w,d,h,j,N,k,C,l=t.allpts;if(t.ctrlpts.length/2%2==0){var E=l.length/2-1,S=E+2,T=S+2;j=nr(l[E],l[S],l[T],0),N=nr(l[E+1],l[S+1],l[T+1],0),k=nr(l[E],l[S],l[T],1e-4),C=nr(l[E+1],l[S+1],l[T+1],1e-4)}else{var S=l.length/2-1,E=S-2,T=S+2;j=nr(l[E],l[S],l[T],.4999),N=nr(l[E+1],l[S+1],l[T+1],.4999),k=nr(l[E],l[S],l[T],.5),C=nr(l[E+1],l[S+1],l[T+1],.5)}g=k-j,v=C-N}if(t.midtgtArrowAngle=r6(g,v),t.midDispX=g,t.midDispY=v,g*=-1,v*=-1,i){var l=t.allpts;if(l.length/2%2==0);else if(!t.isRound){var f=l.length/2-1,P=f+2;g=-(l[P]-l[f]),v=-(l[P+1]-l[f+1])}}if(t.midsrcArrowAngle=r6(g,v),i)g=b-t.segpts[t.segpts.length-2],v=w-t.segpts[t.segpts.length-1];else if(a||o||s||n){var l=t.allpts,_=l.length,u=nr(l[_-6],l[_-4],l[_-2],.9),c=nr(l[_-5],l[_-3],l[_-1],.9);g=b-u,v=w-c}else g=b-d,v=w-h;t.tgtArrowAngle=r6(g,v)},sW.getArrowWidth=sW.getArrowHeight=function(e,t){var r=this.arrowWidthCache=this.arrowWidthCache||{},n=r[e+", "+t];return n||(n=Math.max(Math.pow(13.37*e,.9),29)*t,r[e+", "+t]=n),n};var sU,s$,sK,sG,sZ,sQ,sJ,s0,s1,s2,s5,s3,s4,s6,s7,s9,s8,le,lt,lr,ln,la,li,lo,ls,ll,lu,lc,ld,lh,lf,lp,lg,lm,lv,ly,lx,lb,lw,lj,lN,lk,lC,lE,lS,lT,lP,l_,lD,lB,lM,lA,lR,lI,lL,lO,lz,lV,lF,lH,lq,lX,lY,lW,lU,l$,lK,lG,lZ,lQ,lJ,l0,l1,l2,l5,l3,l4,l6,l7,l9,l8,ue,ut,ur,un,ua,ui,uo,us,ul,uu,uc,ud,uh,uf,up,ug,um,uv,uy,ux,ub,uw,uj,uN,uk,uC,uE,uS,uT,uP,u_,uD,uB,uM,uA,uR,uI,uL,uO,uz,uV,uF,uH,uq,uX,uY,uW,uU,u$,uK,uG,uZ,uQ,uJ,u0,u1,u2,u5,u3,u4,u6,u7,u9,u8,ce,ct,cr,cn,ca,ci,co,cs,cl,cu,cc,cd,ch,cf,cp={},cg={},cm=function(e,t,r){r.x=t.x-e.x,r.y=t.y-e.y,r.len=Math.sqrt(r.x*r.x+r.y*r.y),r.nx=r.x/r.len,r.ny=r.y/r.len,r.ang=Math.atan2(r.ny,r.nx)},cv=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},cy=function(e,t,r,n,u){if(e!==l?cm(t,e,cp):cv(cg,cp),cm(t,r,cg),ca=cp.nx*cg.ny-cp.ny*cg.nx,ci=cp.nx*cg.nx- -(cp.ny*cg.ny),1e-6>Math.abs(cl=Math.asin(Math.max(-1,Math.min(1,ca))))){cr=t.x,cn=t.y,cc=ch=0;return}co=1,cs=!1,ci<0?cl<0?cl=Math.PI+cl:(cl=Math.PI-cl,co=-1,cs=!0):cl>0&&(co=-1,cs=!0),ch=void 0!==t.radius?t.radius:n,cu=cl/2,cf=Math.min(cp.len/2,cg.len/2),cc=u?(cd=Math.abs(Math.cos(cu)*ch/Math.sin(cu)))>cf?Math.abs((cd=cf)*Math.sin(cu)/Math.cos(cu)):ch:Math.abs((cd=Math.min(cf,ch))*Math.sin(cu)/Math.cos(cu)),o=t.x+cg.nx*cd,s=t.y+cg.ny*cd,cr=o-cg.ny*cc*co,cn=s+cg.nx*cc*co,a=t.x+cp.nx*cd,i=t.y+cp.ny*cd,l=t};function cx(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 cb(e,t,r,n){var l=!(arguments.length>4)||void 0===arguments[4]||arguments[4];return 0===n||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}:(cy(e,t,r,n,l),{cx:cr,cy:cn,radius:cc,startX:a,startY:i,stopX:o,stopY:s,startAngle:cp.ang+Math.PI/2*co,endAngle:cg.ang-Math.PI/2*co,counterClockwise:cs})}var cw=Math.sqrt(.02),cj={};function cN(e){var t=[];if(null!=e){for(var r=0;r<e.length;r+=2){var n=e[r],a=e[r+1];t.push({x:n,y:a})}return t}}cj.findMidptPtsEtc=function(e,t){var r,n=t.posPts,a=t.intersectionPts,i=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":r=n;break;case"intersection":r=a;break;case"endpoints":if(l){var u,c,d,h=tf(this.manualEndptToPx(e.source()[0],o),2),f=h[0],p=h[1],g=tf(this.manualEndptToPx(e.target()[0],s),2),v=g[0],y=g[1];u=y-p,d=Math.sqrt((c=v-f)*c+u*u),i={x:-u/d,y:c/d},r={x1:f,y1:p,x2:v,y2:y}}else rC("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).")),r=a}return{midptPts:r,vectorNormInverse:i}},cj.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var r=e[t],n=r._private,a=n.rscratch;if(!a.haystack){var i=2*Math.random()*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},a.target={x:Math.cos(i=2*Math.random()*Math.PI),y:Math.sin(i)}}var o=n.source,s=n.target,l=o.position(),u=s.position(),c=o.width(),d=s.width(),h=o.height(),f=s.height(),p=r.pstyle("haystack-radius").value/2;a.haystackPts=a.allpts=[a.source.x*c*p+l.x,a.source.y*h*p+l.y,a.target.x*d*p+u.x,a.target.y*f*p+u.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}},cj.findSegmentsPoints=function(e,t){var r=e._private.rscratch,n=e.pstyle("segment-weights"),a=e.pstyle("segment-distances"),i=e.pstyle("segment-radii"),o=e.pstyle("radius-type"),s=Math.min(n.pfValue.length,a.pfValue.length),l=i.pfValue[i.pfValue.length-1],u=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var c=0;c<s;c++){var d=n.pfValue[c],h=a.pfValue[c],f=1-d,p=this.findMidptPtsEtc(e,t),g=p.midptPts,v=p.vectorNormInverse,y={x:g.x1*f+g.x2*d,y:g.y1*f+g.y2*d};r.segpts.push(y.x+v.x*h,y.y+v.y*h),r.radii.push(void 0!==i.pfValue[c]?i.pfValue[c]:l),r.isArcRadius.push((void 0!==o.pfValue[c]?o.pfValue[c]:u)==="arc-radius")}},cj.findLoopPoints=function(e,t,r,n){var a=e._private.rscratch,i=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,u=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,d=e.pstyle("control-point-step-size").pfValue;a.edgeType="self";var h=r,f=d;n&&(h=0,f=l);var p=u-Math.PI/2,g=p-c/2,v=p+c/2,y=String(u+"_"+c);h=void 0===i[y]?i[y]=0:++i[y],a.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)]},cj.findCompoundLoopPoints=function(e,t,r,n){var a=e._private.rscratch;a.edgeType="compound";var i=t.srcPos,o=t.tgtPos,s=t.srcW,l=t.srcH,u=t.tgtW,c=t.tgtH,d=e.pstyle("control-point-step-size").pfValue,h=e.pstyle("control-point-distances"),f=h?h.pfValue[0]:void 0,p=r,g=d;n&&(p=0,g=f);var v={x:i.x-s/2,y:i.y-l/2},y={x:o.x-u/2,y:o.y-c/2},x={x:Math.min(v.x,y.x),y:Math.min(v.y,y.y)},b=Math.max(.5,Math.log(.01*s)),w=Math.max(.5,Math.log(.01*u));a.ctrlpts=[x.x,x.y-1.7995514309304248*g*(p/3+1)*b,x.x-1.7995514309304248*g*(p/3+1)*w,x.y]},cj.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},cj.findBezierPoints=function(e,t,r,n,a){var i=e._private.rscratch,o=e.pstyle("control-point-step-size").pfValue,s=e.pstyle("control-point-distances"),l=e.pstyle("control-point-weights"),u=s&&l?Math.min(s.value.length,l.value.length):1,c=s?s.pfValue[0]:void 0,d=l.value[0];i.edgeType=n?"multibezier":"bezier",i.ctrlpts=[];for(var h=0;h<u;h++){var f=(.5-t.eles.length/2+r)*o*(a?-1:1),p=void 0,g=r9(f);n&&(c=s?s.pfValue[h]:o,d=l.value[h]);var v=void 0!==(p=n?c:void 0!==c?g*c:void 0)?p:f,y=1-d,x=d,b=this.findMidptPtsEtc(e,t),w=b.midptPts,j=b.vectorNormInverse,N={x:w.x1*y+w.x2*x,y:w.y1*y+w.y2*x};i.ctrlpts.push(N.x+j.x*v,N.y+j.y*v)}},cj.findTaxiPoints=function(e,t){var r,n=e._private.rscratch;n.edgeType="segments";var a="vertical",i="horizontal",o="leftward",s="rightward",l="downward",u="upward",c=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,y=v,x=e.pstyle("taxi-turn"),b="%"===x.units,w=x.pfValue,j=e.pstyle("taxi-turn-min-distance").pfValue,N=c.x2-c.x1,k=c.y2-c.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),S=C(k,g?(h+p)/2:0),T=!1;"auto"===y?v=Math.abs(E)>Math.abs(S)?i:a:y===u||y===l?(v=a,T=!0):(y===o||y===s)&&(v=i,T=!0);var P=v===a,_=P?S:E,D=P?k:N,B=r9(D),M=!1;!(T&&(b||w<0))&&(y===l&&D<0||y===u&&D>0||y===o&&D>0||y===s&&D<0)&&(B*=-1,_=B*Math.abs(_),M=!0);var A=function(e){return Math.abs(e)<j||Math.abs(e)>=Math.abs(_)},R=A(r=b?(w<0?1+w:w)*_:(w<0?_:0)+w*B),I=A(Math.abs(_)-Math.abs(r));if((R||I)&&!M)if(P){var L=Math.abs(N)<=f/2;if(Math.abs(D)<=h/2){var O=(c.x1+c.x2)/2;n.segpts=[O,c.y1,O,c.y2]}else if(L){var z=(c.y1+c.y2)/2;n.segpts=[c.x1,z,c.x2,z]}else n.segpts=[c.x1,c.y2]}else{var V=Math.abs(k)<=p/2;if(Math.abs(D)<=d/2){var F=(c.y1+c.y2)/2;n.segpts=[c.x1,F,c.x2,F]}else if(V){var H=(c.x1+c.x2)/2;n.segpts=[H,c.y1,H,c.y2]}else n.segpts=[c.x2,c.y1]}else if(P){var q=c.y1+r+(g?h/2*B:0);n.segpts=[c.x1,q,c.x2,q]}else{var X=c.x1+r+(g?d/2*B:0);n.segpts=[X,c.y1,X,c.y2]}if(n.isRound){var Y=e.pstyle("taxi-radius").value,W="arc-radius"===e.pstyle("radius-type").value[0];n.radii=Array(n.segpts.length/2).fill(Y),n.isArcRadius=Array(n.segpts.length/2).fill(W)}},cj.tryToCorrectInvalidPoints=function(e,t){var r=e._private.rscratch;if("bezier"===r.edgeType){var n=t.srcPos,a=t.tgtPos,i=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,f=t.srcRs,p=t.tgtRs,g=!tP(r.startX)||!tP(r.startY),v=!tP(r.arrowStartX)||!tP(r.arrowStartY),y=!tP(r.endX)||!tP(r.endY),x=!tP(r.arrowEndX)||!tP(r.arrowEndY),b=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),w=r8({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),j=w<b,N=r8({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),k=N<b,C=!1;if(g||v||j){C=!0;var E={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},S=Math.sqrt(E.x*E.x+E.y*E.y),T={x:E.x/S,y:E.y/S},P=Math.max(i,o),_={x:r.ctrlpts[0]+2*T.x*P,y:r.ctrlpts[1]+2*T.y*P},D=u.intersectLine(n.x,n.y,i,o,_.x,_.y,0,d,f);j?(r.ctrlpts[0]=r.ctrlpts[0]+T.x*(b-w),r.ctrlpts[1]=r.ctrlpts[1]+T.y*(b-w)):(r.ctrlpts[0]=D[0]+T.x*b,r.ctrlpts[1]=D[1]+T.y*b)}if(y||x||k){C=!0;var B={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},M=Math.sqrt(B.x*B.x+B.y*B.y),A={x:B.x/M,y:B.y/M},R=Math.max(i,o),I={x:r.ctrlpts[0]+2*A.x*R,y:r.ctrlpts[1]+2*A.y*R},L=c.intersectLine(a.x,a.y,s,l,I.x,I.y,0,h,p);k?(r.ctrlpts[0]=r.ctrlpts[0]+A.x*(b-N),r.ctrlpts[1]=r.ctrlpts[1]+A.y*(b-N)):(r.ctrlpts[0]=L[0]+A.x*b,r.ctrlpts[1]=L[1]+A.y*b)}C&&this.findEndpoints(e)}},cj.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 r,n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);(t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2==0)?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,t.midX=nr(t.allpts[r],t.allpts[r+2],t.allpts[r+4],.5),t.midY=nr(t.allpts[r+1],t.allpts[r+3],t.allpts[r+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 a=2;a+3<t.allpts.length;a+=2){var i=t.radii[a/2-1],o=t.isArcRadius[a/2-1];t.roundCorners.push(cb({x:t.allpts[a-2],y:t.allpts[a-1]},{x:t.allpts[a],y:t.allpts[a+1],radius:i},{x:t.allpts[a+2],y:t.allpts[a+3]},i,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 u=t.segpts.length/2-1;if(t.isRound){var c={x:t.segpts[u],y:t.segpts[u+1]},d=t.roundCorners[u/2];if(0===d.radius){var h={x:t.segpts[u+2],y:t.segpts[u+3]};t.midX=c.x,t.midY=c.y,t.midVector=[c.y-h.y,h.x-c.x]}else{var f=[c.x-d.cx,c.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[u],t.midY=t.segpts[u+1]}}},cj.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||tP(t.startX)&&tP(t.startY)&&tP(t.endX)&&tP(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,rC("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."))},cj.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var r=this,n=r.cy.hasCompoundNodes(),a=new rL,i=function(e,t){return[].concat(tp(e),[+!!t]).join("-")},o=[],s=[],l=0;l<e.length;l++){var u=e[l],c=u._private,d=u.pstyle("curve-style").value;if(!u.removed()&&u.takesUpSpace()){if("haystack"===d){s.push(u);continue}var h="unbundled-bezier"===d||tq(d,"segments")||"straight"===d||"straight-triangle"===d||tq(d,"taxi"),f="unbundled-bezier"===d||"bezier"===d,p=c.source,g=c.target,v=[p.poolIndex(),g.poolIndex()].sort(),y=i(v,h),x=a.get(y);null==x&&(x={eles:[]},o.push({pairId:v,edgeIsUnbundled:h}),a.set(y,x)),x.eles.push(u),h&&(x.hasUnbundled=!0),f&&(x.hasBezier=!0)}}for(var b=0;b<o.length;b++)!function(){var e,s=o[b],l=i(s.pairId,s.edgeIsUnbundled),u=a.get(l);if(!u.hasUnbundled){var c=u.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});rB(u.eles),c.forEach(function(e){return u.eles.push(e)}),u.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var d=u.eles[0],h=d.source(),f=d.target();if(h.poolIndex()>f.poolIndex()){var p=h;h=f,f=p}var g=u.srcPos=h.position(),v=u.tgtPos=f.position(),y=u.srcW=h.outerWidth(),x=u.srcH=h.outerHeight(),w=u.tgtW=f.outerWidth(),j=u.tgtH=f.outerHeight(),N=u.srcShape=r.nodeShapes[t.getNodeShape(h)],k=u.tgtShape=r.nodeShapes[t.getNodeShape(f)],C=u.srcCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,E=u.tgtCornerRadius="auto"===f.pstyle("corner-radius").value?"auto":f.pstyle("corner-radius").pfValue,S=u.tgtRs=f._private.rscratch,T=u.srcRs=h._private.rscratch;u.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var P=0;P<u.eles.length;P++){var _=u.eles[P],D=_[0]._private.rscratch,B=_.pstyle("curve-style").value,M="unbundled-bezier"===B||tq(B,"segments")||tq(B,"taxi"),A=!h.same(_.source());if(!u.calculatedIntersection&&h!==f&&(u.hasBezier||u.hasUnbundled)){u.calculatedIntersection=!0;var R=N.intersectLine(g.x,g.y,y,x,v.x,v.y,0,C,T),I=u.srcIntn=R,L=k.intersectLine(v.x,v.y,w,j,g.x,g.y,0,E,S),O=u.tgtIntn=L,z=u.intersectionPts={x1:R[0],x2:L[0],y1:R[1],y2:L[1]},V=u.posPts={x1:g.x,x2:v.x,y1:g.y,y2:v.y},F=L[1]-R[1],H=L[0]-R[0],q=Math.sqrt(H*H+F*F);tP(q)&&q>=cw||(q=Math.sqrt(Math.max(H*H,.01)+Math.max(F*F,.01)));var X=u.vector={x:H,y:F},Y=u.vectorNorm={x:X.x/q,y:X.y/q},W={x:-Y.y,y:Y.x};u.nodesOverlap=!tP(q)||k.checkPoint(R[0],R[1],0,w,j,v.x,v.y,E,S)||N.checkPoint(L[0],L[1],0,y,x,g.x,g.y,C,T),u.vectorNormInverse=W,e={nodesOverlap:u.nodesOverlap,dirCounts:u.dirCounts,calculatedIntersection:!0,hasBezier:u.hasBezier,hasUnbundled:u.hasUnbundled,eles:u.eles,srcPos:v,srcRs:S,tgtPos:g,tgtRs:T,srcW:w,srcH:j,tgtW:y,tgtH:x,srcIntn:O,tgtIntn:I,srcShape:k,tgtShape:N,posPts:{x1:V.x2,y1:V.y2,x2:V.x1,y2:V.y1},intersectionPts:{x1:z.x2,y1:z.y2,x2:z.x1,y2:z.y1},vector:{x:-X.x,y:-X.y},vectorNorm:{x:-Y.x,y:-Y.y},vectorNormInverse:{x:-W.x,y:-W.y}}}var U=A?e:u;D.nodesOverlap=U.nodesOverlap,D.srcIntn=U.srcIntn,D.tgtIntn=U.tgtIntn,D.isRound=B.startsWith("round"),n&&(h.isParent()||h.isChild()||f.isParent()||f.isChild())&&(h.parents().anySame(f)||f.parents().anySame(h)||h.same(f)&&h.isParent())?t.findCompoundLoopPoints(_,U,P,M):h===f?t.findLoopPoints(_,U,P,M):B.endsWith("segments")?t.findSegmentsPoints(_,U):B.endsWith("taxi")?t.findTaxiPoints(_,U):"straight"!==B&&(M||u.eles.length%2!=1||P!==Math.floor(u.eles.length/2))?t.findBezierPoints(_,U,P,M,A):t.findStraightEdgePoints(_),t.findEndpoints(_),t.tryToCorrectInvalidPoints(_,U),t.checkForInvalidEdgeWarning(_),t.storeAllpts(_),t.storeEdgeProjections(_),t.calculateArrowAngles(_),t.recalculateEdgeLabelProjections(_),t.calculateLabelAngles(_)}}();this.findHaystackPoints(s)}},cj.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),"segments"===t.edgeType)return cN(t.segpts)},cj.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var r=t.edgeType;if("bezier"===r||"multibezier"===r||"self"===r||"compound"===r)return cN(t.ctrlpts)},cj.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var ck={};ck.manualEndptToPx=function(e,t){var r=e.position(),n=e.outerWidth(),a=e.outerHeight(),i=e._private.rscratch;if(2===t.value.length){var o=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(o[0]=o[0]*n),"%"===t.units[1]&&(o[1]=o[1]*a),o[0]+=r.x,o[1]+=r.y,o}var s=t.pfValue[0];s=-Math.PI/2+s;var l=2*Math.max(n,a),u=[r.x+Math.cos(s)*l,r.y+Math.sin(s)*l];return this.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,n,a,u[0],u[1],0,"auto"===e.pstyle("corner-radius").value?"auto":e.pstyle("corner-radius").pfValue,i)},ck.findEndpoints=function(e){var t,r,n,a,i,o,s,l,u,c=e.source()[0],d=e.target()[0],h=c.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,y=e.pstyle("source-distance-from-node").pfValue,x=c._private.rscratch,b=d._private.rscratch,w=e.pstyle("curve-style").value,j=e._private.rscratch,N=j.edgeType,k=tq(w,"taxi"),C="self"===N||"compound"===N,E="bezier"===N||"multibezier"===N||C,S="bezier"!==N,T="straight"===N||"segments"===N,P="segments"===N,_=C||k,D=e.pstyle("source-endpoint"),B=_?"outside-to-node":D.value,M="auto"===c.pstyle("corner-radius").value?"auto":c.pstyle("corner-radius").pfValue,A=e.pstyle("target-endpoint"),R=_?"outside-to-node":A.value,I="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue;j.srcManEndpt=D,j.tgtManEndpt=A;var L=null!=(t=(null==A||null==(r=A.pfValue)?void 0:r.length)===2?A.pfValue:null)?t:[0,0],O=null!=(n=(null==D||null==(a=D.pfValue)?void 0:a.length)===2?D.pfValue:null)?n:[0,0];if(E){var z=[j.ctrlpts[0],j.ctrlpts[1]];o=S?[j.ctrlpts[j.ctrlpts.length-2],j.ctrlpts[j.ctrlpts.length-1]]:z,s=z}else if(T){var V=P?j.segpts.slice(0,2):[f.x+L[0],f.y+L[1]];o=P?j.segpts.slice(j.segpts.length-2):[h.x+O[0],h.y+O[1]],s=V}if("inside-to-node"===R)i=[f.x,f.y];else if(A.units)i=this.manualEndptToPx(d,A);else if("outside-to-line"===R)i=j.tgtIntn;else if("outside-to-node"===R||"outside-to-node-or-label"===R?l=o:("outside-to-line"===R||"outside-to-line-or-label"===R)&&(l=[h.x,h.y]),i=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"===R||"outside-to-line-or-label"===R){var F=d._private.rscratch,H=F.labelWidth,q=F.labelHeight,X=F.labelX,Y=F.labelY,W=H/2,U=q/2,$=d.pstyle("text-valign").value;"top"===$?Y-=U:"bottom"===$&&(Y+=U);var K=d.pstyle("text-halign").value;"left"===K?X-=W:"right"===K&&(X+=W);var G=nI(l[0],l[1],[X-W,Y-U,X+W,Y-U,X+W,Y+U,X-W,Y+U],f.x,f.y);if(G.length>0){var Z=ne(h,r1(i)),Q=ne(h,r1(G)),J=Z;Q<Z&&(i=G,J=Q),G.length>2&&ne(h,{x:G[2],y:G[3]})<J&&(i=[G[2],G[3]])}}var ee=nO(i,o,this.arrowShapes[p].spacing(e)+v),et=nO(i,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"===B)i=[h.x,h.y];else if(D.units)i=this.manualEndptToPx(c,D);else if("outside-to-line"===B)i=j.srcIntn;else if("outside-to-node"===B||"outside-to-node-or-label"===B?u=s:("outside-to-line"===B||"outside-to-line-or-label"===B)&&(u=[f.x,f.y]),i=this.nodeShapes[this.getNodeShape(c)].intersectLine(h.x,h.y,c.outerWidth(),c.outerHeight(),u[0],u[1],0,M,x),"outside-to-node-or-label"===B||"outside-to-line-or-label"===B){var er=c._private.rscratch,en=er.labelWidth,ea=er.labelHeight,ei=er.labelX,eo=er.labelY,es=en/2,el=ea/2,eu=c.pstyle("text-valign").value;"top"===eu?eo-=el:"bottom"===eu&&(eo+=el);var ec=c.pstyle("text-halign").value;"left"===ec?ei-=es:"right"===ec&&(ei+=es);var ed=nI(u[0],u[1],[ei-es,eo-el,ei+es,eo-el,ei+es,eo+el,ei-es,eo+el],h.x,h.y);if(ed.length>0){var eh=ne(f,r1(i)),ef=ne(f,r1(ed)),ep=eh;ef<eh&&(i=[ed[0],ed[1]],ep=ef),ed.length>2&&ne(f,{x:ed[2],y:ed[3]})<ep&&(i=[ed[2],ed[3]])}}var eg=nO(i,s,this.arrowShapes[g].spacing(e)+y),em=nO(i,s,this.arrowShapes[g].gap(e)+y);j.startX=em[0],j.startY=em[1],j.arrowStartX=eg[0],j.arrowStartY=eg[1],(E||S||T)&&(tP(j.startX)&&tP(j.startY)&&tP(j.endX)&&tP(j.endY)?j.badLine=!1:j.badLine=!0)},ck.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}},ck.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 cC={};cC.storeEdgeProjections=function(e){var t=e._private,r=t.rscratch,n=r.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,"multibezier"===n||"bezier"===n||"self"===n||"compound"===n){t.rstyle.bezierPts=[];for(var a=0;a+5<r.allpts.length;a+=4)!function(e,t,r){for(var n=function(e,t,r,n){return nr(e,t,r,n)},a=t._private.rstyle.bezierPts,i=0;i<e.bezierProjPcts.length;i++){var o=e.bezierProjPcts[i];a.push({x:n(r[0],r[2],r[4],o),y:n(r[1],r[3],r[5],o)})}}(this,e,r.allpts.slice(a,a+6))}else if("segments"===n)for(var i=t.rstyle.linePts=[],a=0;a+1<r.allpts.length;a+=2)i.push({x:r.allpts[a],y:r.allpts[a+1]});else if("haystack"===n){var o=r.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},cC.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var cE={};cE.recalculateNodeLabelProjection=function(e){var t,r;if(!tI(e.pstyle("label").strValue)){var n=e._private,a=e.width(),i=e.height(),o=e.padding(),s=e.position(),l=e.pstyle("text-halign").strValue,u=e.pstyle("text-valign").strValue,c=n.rscratch,d=n.rstyle;switch(l){case"left":t=s.x-a/2-o;break;case"right":t=s.x+a/2+o;break;default:t=s.x}switch(u){case"top":r=s.y-i/2-o;break;case"bottom":r=s.y+i/2+o;break;default:r=s.y}c.labelX=t,c.labelY=r,d.labelX=t,d.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var cS=function(e,t){var r=Math.atan(t/e);return 0===e&&r<0&&(r*=-1),r},cT=function(e,t){return cS(t.x-e.x,t.y-e.y)},cP=function(e,t,r,n){var a=ni(0,n-.001,1),i=ni(0,n+.001,1);return cT(nn(e,t,r,a),nn(e,t,r,i))};cE.recalculateEdgeLabelProjections=function(e){var t,r=e._private,n=r.rscratch,a=this,i={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(i.mid||i.source||i.target){t={x:n.midX,y:n.midY};var o=function(e,t,n){rR(r.rscratch,e,t,n),rR(r.rstyle,e,t,n)};o("labelX",null,t.x),o("labelY",null,t.y),o("labelAutoAngle",null,cS(n.midDispX,n.midDispY));var s=function(){if(s.cache)return s.cache;for(var e=[],t=0;t+5<n.allpts.length;t+=4){var i={x:n.allpts[t],y:n.allpts[t+1]},o={x:n.allpts[t+2],y:n.allpts[t+3]},l={x:n.allpts[t+4],y:n.allpts[t+5]};e.push({p0:i,p1:o,p2:l,startDist:0,length:0,segments:[]})}var u=r.rstyle.bezierPts,c=a.bezierProjPcts.length;function d(e,t,r,n,a){var i=r8(t,r),o=e.segments[e.segments.length-1],s={p0:t,p1:r,t0:n,t1:a,startDist:o?o.startDist+o.length:0,length:i};e.segments.push(s),e.length+=i}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,u[h*c],0,a.bezierProjPcts[0]);for(var g=0;g<c-1;g++)d(f,u[h*c+g],u[h*c+g+1],a.bezierProjPcts[g],a.bezierProjPcts[g+1]);d(f,u[h*c+c-1],f.p2,a.bezierProjPcts[c-1],1)}return s.cache=e},l=function(r){var a="source"===r;if(i[r]){var l=e.pstyle(r+"-text-offset").pfValue;switch(n.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var u,c,d=s(),h=0,f=0,p=0;p<d.length;p++){for(var g=d[a?p:d.length-1-p],v=0;v<g.segments.length;v++){var y=g.segments[a?v:g.segments.length-1-v],x=p===d.length-1&&v===g.segments.length-1;if(h=f,(f+=y.length)>=l||x){c={cp:g,segment:y};break}}if(c)break}var b=c.cp,w=c.segment,j=(l-h)/w.length,N=w.t1-w.t0,k=a?w.t0+N*j:w.t1-N*j;k=ni(0,k,1),t=nn(b.p0,b.p1,b.p2,k),u=cP(b.p0,b.p1,b.p2,k);break;case"straight":case"segments":case"haystack":for(var C,E,S,T,P=0,_=n.allpts.length,D=0;D+3<_&&(a?(C={x:n.allpts[D],y:n.allpts[D+1]},E={x:n.allpts[D+2],y:n.allpts[D+3]}):(C={x:n.allpts[_-2-D],y:n.allpts[_-1-D]},E={x:n.allpts[_-4-D],y:n.allpts[_-3-D]}),S=r8(C,E),T=P,!((P+=S)>=l));D+=2);var B=(l-T)/S;t=na(C,E,B=ni(0,B,1)),u=cT(C,E)}o("labelX",r,t.x),o("labelY",r,t.y),o("labelAutoAngle",r,u)}};l("source"),l("target"),this.applyLabelDimensions(e)}},cE.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},cE.applyPrefixedLabelDimensions=function(e,t){var r=e._private,n=this.getLabelText(e,t),a=rh(n,e._private.labelDimsKey);if(rA(r.rscratch,"prefixedLabelDimsKey",t)!==a){rR(r.rscratch,"prefixedLabelDimsKey",t,a);var i=this.calculateLabelDimensions(e,n),o=e.pstyle("line-height").pfValue,s=e.pstyle("text-wrap").strValue,l=rA(r.rscratch,"labelWrapCachedLines",t)||[],u="wrap"!==s?1:Math.max(l.length,1),c=i.height/u,d=i.width,h=i.height+(u-1)*(o-1)*c;rR(r.rstyle,"labelWidth",t,d),rR(r.rscratch,"labelWidth",t,d),rR(r.rstyle,"labelHeight",t,h),rR(r.rscratch,"labelHeight",t,h),rR(r.rscratch,"labelLineHeight",t,c*o)}},cE.getLabelText=function(e,t){var r=e._private,n=t?t+"-":"",a=e.pstyle(n+"label").strValue,i=e.pstyle("text-transform").value,o=function(e,n){return n?(rR(r.rscratch,e,t,n),n):rA(r.rscratch,e,t)};if(!a)return"";"none"==i||("uppercase"==i?a=a.toUpperCase():"lowercase"==i&&(a=a.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 u=a.split("\n"),c=e.pstyle("text-max-width").pfValue,d="anywhere"===e.pstyle("text-overflow-wrap").value,h=[],f=/[\s\u200b]+|$/g,p=0;p<u.length;p++){var g=u[p],v=this.calculateLabelDimensions(e,g).width;if(d&&(g=g.split("").join("")),v>c){var y,x=g.matchAll(f),b="",w=0,j=td(x);try{for(j.s();!(y=j.n()).done;){var N=y.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<=c?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),a=o("labelWrapCachedText",h.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){var S=e.pstyle("text-max-width").pfValue,T="",P=!1;if(this.calculateLabelDimensions(e,a).width<S)return a;for(var _=0;_<a.length&&!(this.calculateLabelDimensions(e,T+a[_]+"…").width>S);_++)T+=a[_],_===a.length-1&&(P=!0);return P||(T+="…"),T}return a},cE.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,r=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(r){case"left":return"right";case"right":return"left";default:return"center"}},cE.calculateLabelDimensions=function(e,t){var r=this.cy.window().document,n=e.pstyle("font-style").strValue,a=e.pstyle("font-size").pfValue,i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=this.labelCalcCanvas,l=this.labelCalcCanvasContext;if(!s){s=this.labelCalcCanvas=r.createElement("canvas"),l=this.labelCalcCanvasContext=s.getContext("2d");var u=s.style;u.position="absolute",u.left="-9999px",u.top="-9999px",u.zIndex="-1",u.visibility="hidden",u.pointerEvents="none"}l.font="".concat(n," ").concat(o," ").concat(a,"px ").concat(i);for(var c=0,d=0,h=t.split("\n"),f=0;f<h.length;f++){var p=h[f];c=Math.max(Math.ceil(l.measureText(p).width),c),d+=a}return{width:c+=0,height:d+=0}},cE.calculateLabelAngle=function(e,t){var r=e._private.rscratch,n=e.isEdge(),a=e.pstyle((t?t+"-":"")+"text-rotation"),i=a.strValue;return"none"===i?0:n&&"autorotate"===i?r.labelAutoAngle:"autorotate"===i?0:a.pfValue},cE.calculateLabelAngles=function(e){var t=e.isEdge(),r=e._private.rscratch;r.labelAngle=this.calculateLabelAngle(e),t&&(r.sourceLabelAngle=this.calculateLabelAngle(e,"source"),r.targetLabelAngle=this.calculateLabelAngle(e,"target"))};var c_={},cD=!1;c_.getNodeShape=function(e){var t=e.pstyle("shape").value;if("cutrectangle"===t&&(28>e.width()||28>e.height()))return cD||(rC("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),cD=!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 r=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(r).name}return t};var cB={};cB.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),r=this,n=function(e){var r=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(t.merge(e),r)for(var n=0;n<e.length;n++){var a=e[n]._private.rstyle;a.clean=!1,a.cleanConnected=!1}};r.binder(e).on("bounds.* dirty.*",function(e){n(e.target)}).on("style.* background.*",function(e){n(e.target,!1)});var a=function(a){if(a){var i=r.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],l=s._private.rstyle;s.isNode()&&!l.cleanConnected&&(n(s.connectedEdges()),l.cleanConnected=!0)}if(i)for(var u=0;u<i.length;u++)(0,i[u])(a,t);r.recalculateRenderedStyle(t),t=e.collection()}};r.flushRenderedStyleQueue=function(){a(!0)},r.beforeRender(a,r.beforeRenderPriorities.eleCalcs)},cB.onUpdateEleCalcs=function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},cB.recalculateRenderedStyle=function(e,t){var r=function(e){return e._private.rstyle.cleanConnected};if(0!==e.length){var n=[],a=[];if(!this.destroyed){void 0===t&&(t=!0);for(var i=0;i<e.length;i++){var o=e[i],s=o._private,l=s.rstyle;!o.isEdge()||r(o.source())&&r(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?a.push(o):n.push(o),l.clean=!0)}for(var u=0;u<a.length;u++){var c=a[u],d=c._private.rstyle,h=c.position();this.recalculateNodeLabelProjection(c),d.nodeX=h.x,d.nodeY=h.y,d.nodeW=c.pstyle("width").pfValue,d.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var f=0;f<n.length;f++){var p=n[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 cM={};cM.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],r=0;r<e.length;r++){var n=e[r],a=n._private.rscratch;n.grabbed()&&!n.isParent()?t.push(n):a.inDragLayer?e.drag.push(n):e.nondrag.push(n)}for(var r=0;r<t.length;r++){var n=t[r];e.drag.push(n)}}},cM.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},cM.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(oh),t.interactive=t.filter(function(e){return e.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var cA={};[sY,sW,cj,ck,cC,cE,c_,cB,cM].forEach(function(e){tG(cA,e)});var cR={};cR.getCachedImage=function(e,t,r){var n=this.imageCache=this.imageCache||{},a=n[e];if(a)return a.image.complete||a.image.addEventListener("load",r),a.image;var i=(a=n[e]=n[e]||{}).image=new Image;i.addEventListener("load",r),i.addEventListener("error",function(){i.error=!0});var o="data:";return e.substring(0,o.length).toLowerCase()!==o&&(i.crossOrigin=t="null"===t?null:t),i.src=e,i};var cI={};cI.registerBinding=function(e,t,r,n){var a=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var i=[],o=0;o<e.length;o++){var s=e[o];if(void 0!==s){var l=this.binder(s);i.push(l.on.apply(l,a))}}return i}var l=this.binder(e);return l.on.apply(l,a)},cI.binder=function(e){var t=this,r=t.cy.window(),n=e===r||e===r.document||e===r.document.body||"undefined"!=typeof HTMLElement&&e instanceof HTMLElement;if(null==t.supportsPassiveEvents){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});r.addEventListener("test",null,i)}catch(e){}t.supportsPassiveEvents=a}var o=function(r,a,i){var o=Array.prototype.slice.call(arguments);return n&&t.supportsPassiveEvents&&(o[2]={capture:null!=i&&i,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}},cI.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},cI.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},cI.load=function(){var e,t,r,n,a,i,o,s,l,u,c,d,h,f,p,g,v,y,x,b,w,j,N,k,C,E=this,S=E.cy.window(),T=function(e){return e.selected()},P=function(e,t,r,n){null==e&&(e=E.cy);for(var a=0;a<t.length;a++){var i=t[a];e.emit({originalEvent:r,type:i,position:n})}},_=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},D=function(e,t){var r=!0;if(E.cy.hasCompoundNodes()&&e&&e.pannable())for(var n=0;t&&n<t.length;n++){var e=t[n];if(e.isNode()&&e.isParent()&&!e.pannable()){r=!1;break}}else r=!0;return r},B=function(e){e[0]._private.grabbed=!0},M=function(e){e[0]._private.grabbed=!1},A=function(e){e[0]._private.rscratch.inDragLayer=!0},R=function(e){e[0]._private.rscratch.inDragLayer=!1},I=function(e){e[0]._private.rscratch.isGrabTarget=!0},L=function(e){e[0]._private.rscratch.isGrabTarget=!1},O=function(e,t){var r=t.addToList;!r.has(e)&&e.grabbable()&&!e.locked()&&(r.merge(e),B(e))},z=function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var r=e.descendants();t.inDragLayer&&(r.forEach(A),r.connectedEdges().forEach(A)),t.addToList&&O(r,t)}},V=function(e,t){t=t||{};var r=e.cy().hasCompoundNodes();t.inDragLayer&&(e.forEach(A),e.neighborhood().stdFilter(function(e){return!r||e.isEdge()}).forEach(A)),t.addToList&&e.forEach(function(e){O(e,t)}),z(e,t),H(e,{inDragLayer:t.inDragLayer}),E.updateCachedGrabbedEles()},F=function(e){e&&(E.getCachedZSortedEles().forEach(function(e){M(e),R(e),L(e)}),E.updateCachedGrabbedEles())},H=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var r=e.ancestors().orphans();if(!r.same(e)){var n=r.descendants().spawnSelf().merge(r).unmerge(e).unmerge(e.descendants()),a=n.connectedEdges();t.inDragLayer&&(a.forEach(A),n.forEach(A)),t.addToList&&n.forEach(function(e){O(e,t)})}}},q=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},X="undefined"!=typeof MutationObserver,Y="undefined"!=typeof ResizeObserver;X?(E.removeObserver=new MutationObserver(function(e){for(var t=0;t<e.length;t++){var r=e[t].removedNodes;if(r){for(var n=0;n<r.length;n++)if(r[n]===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 W=rt(function(){E.cy.resize()},100);X&&(E.styleObserver=new MutationObserver(W),E.styleObserver.observe(E.container,{attributes:!0})),E.registerBinding(S,"resize",W),Y&&(E.resizeObserver=new ResizeObserver(W),E.resizeObserver.observe(E.container));for(var U=function(){E.invalidateContainerClientCoordsCache()},$=E.container;null!=$;){e=$,E.registerBinding(e,"transitionend",U),E.registerBinding(e,"animationend",U),E.registerBinding(e,"scroll",U),$=$.parentNode}E.registerBinding(E.container,"contextmenu",function(e){e.preventDefault()});var K=function(e){for(var t=E.findContainerClientCoords(),r=t[0],n=t[1],a=t[2],i=t[3],o=e.touches?e.touches:[e],s=!1,l=0;l<o.length;l++){var u=o[l];if(r<=u.clientX&&u.clientX<=r+a&&n<=u.clientY&&u.clientY<=n+i){s=!0;break}}if(!s)return!1;for(var c=E.container,d=e.target.parentNode,h=!1;d;){if(d===c){h=!0;break}d=d.parentNode}return!!h};E.registerBinding(E.container,"mousedown",function(e){if(K(e)&&(1!==E.hoverData.which||1===e.which)){e.preventDefault(),q(),E.hoverData.capture=!0,E.hoverData.which=e.which;var t=E.cy,r=[e.clientX,e.clientY],n=E.projectIntoViewport(r[0],r[1]),a=E.selection,i=E.findNearestElements(n[0],n[1],!0,!1),o=i[0],s=E.dragData.possibleDragElements;E.hoverData.mdownPos=n,E.hoverData.mdownGPos=r;var l=function(t){return{originalEvent:e,type:t,position:{x:n[0],y:n[1]}}};if(3==e.which){E.hoverData.cxtStarted=!0;var u={originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}};o?(o.activate(),o.emit(u),E.hoverData.down=o):t.emit(u),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 c=t.$(function(e){return e.isNode()&&e.selected()&&E.nodeIsGrabbable(e)});V(c,{addToList:s}),o.emit(l("grabon")),c.forEach(function(e){e.emit(l("grab"))})}else V(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=i,E.hoverData.downTime=new Date().getTime(),P(o,["mousedown","tapstart","vmousedown"],e,{x:n[0],y:n[1]}),null==o?(a[4]=1,E.data.bgActivePosistion={x:n[0],y:n[1]},E.redrawHint("select",!0),E.redraw()):o.pannable()&&(a[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)}a[0]=a[2]=n[0],a[1]=a[3]=n[1]}},!1);var G=function(e){var t=e.getRootNode();if(t&&11===t.nodeType&&void 0!==t.host)return t}(E.container);E.registerBinding([S,G],"mousemove",function(e){var t,r;if(E.hoverData.capture||K(e)){var n=!1,a=E.cy,i=a.zoom(),o=[e.clientX,e.clientY],s=E.projectIntoViewport(o[0],o[1]),l=E.hoverData.mdownPos,u=E.hoverData.mdownGPos,c=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]-c[2],s[1]-c[3]],g=E.dragData.possibleDragElements;if(u){var v=o[0]-u[0],y=o[1]-u[1];E.hoverData.isOverThresholdDrag=t=v*v+y*y>=E.desktopTapThreshold2}var x=_(e);t&&(E.hoverData.tapholdCancelled=!0),n=!0,P(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||a.emit(b("boxstart")),c[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):a.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(n=!0,a.panningEnabled()&&a.userPanningEnabled()){if(E.hoverData.justStartedPan){var N=E.hoverData.mdownPos;r={x:(s[0]-N[0])*i,y:(s[1]-N[1])*i},E.hoverData.justStartedPan=!1}else r={x:p[0]*i,y:p[1]*i};a.panBy(r),a.emit(b("dragpan")),E.hoverData.dragged=!0}s=E.projectIntoViewport(e.clientX,e.clientY)}else if(1==c[4]&&(null==f||f.pannable()))t&&(!E.hoverData.dragging&&a.boxSelectionEnabled()&&(x||!a.panningEnabled()||!a.userPanningEnabled())?w():!E.hoverData.selecting&&a.panningEnabled()&&a.userPanningEnabled()&&D(f,E.hoverData.downs)&&(E.hoverData.dragging=!0,E.hoverData.justStartedPan=!0,c[4]=0,E.data.bgActivePosistion=r1(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&&P(h,["mouseout","tapdragout"],e,{x:s[0],y:s[1]}),d&&P(d,["mouseover","tapdragover"],e,{x:s[0],y:s[1]}),E.hoverData.last=d),f)if(t){if(a.boxSelectionEnabled()&&x)f&&f.grabbed()&&(F(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||V(g,{inDragLayer:!0});var S={x:0,y:0};if(tP(p[0])&&tP(p[1])&&(S.x+=p[0],S.y+=p[1],C)){var T=E.hoverData.dragDelta;T&&tP(T[0])&&tP(T[1])&&(S.x+=T[0],S.y+=T[1])}E.hoverData.draggingEles=!0,g.silentShift(S).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]);n=!0}if(c[2]=s[0],c[3]=s[1],n)return e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),!1}},!1),E.registerBinding(S,"mouseup",function(e){if((1!==E.hoverData.which||1===e.which||!E.hoverData.capture)&&E.hoverData.capture){E.hoverData.capture=!1;var a=E.cy,i=E.projectIntoViewport(e.clientX,e.clientY),o=E.selection,s=E.findNearestElement(i[0],i[1],!0,!1),l=E.dragData.possibleDragElements,u=E.hoverData.down,c=_(e);E.data.bgActivePosistion&&(E.redrawHint("select",!0),E.redraw()),E.hoverData.tapholdCancelled=!0,E.data.bgActivePosistion=void 0,u&&u.unactivate();var d=function(t){return{originalEvent:e,type:t,position:{x:i[0],y:i[1]}}};if(3===E.hoverData.which){var h=d("cxttapend");if(u?u.emit(h):a.emit(h),!E.hoverData.cxtDragged){var f=d("cxttap");u?u.emit(f):a.emit(f)}E.hoverData.cxtDragged=!1,E.hoverData.which=null}else if(1===E.hoverData.which){if(P(s,["mouseup","tapend","vmouseup"],e,{x:i[0],y:i[1]}),E.dragData.didDrag||E.hoverData.dragged||E.hoverData.selecting||E.hoverData.isOverThresholdDrag||(P(u,["click","tap","vclick"],e,{x:i[0],y:i[1]}),r=!1,e.timeStamp-n<=a.multiClickDebounceTime()?(t&&clearTimeout(t),r=!0,n=null,P(u,["dblclick","dbltap","vdblclick"],e,{x:i[0],y:i[1]})):(t=setTimeout(function(){r||P(u,["oneclick","onetap","voneclick"],e,{x:i[0],y:i[1]})},a.multiClickDebounceTime()),n=e.timeStamp)),null!=u||E.dragData.didDrag||E.hoverData.selecting||E.hoverData.dragged||_(e)||(a.$(T).unselect(["tapunselect"]),l.length>0&&E.redrawHint("eles",!0),E.dragData.possibleDragElements=l=a.collection()),s!=u||E.dragData.didDrag||E.hoverData.selecting||null==s||!s._private.selectable||(E.hoverData.dragging||("additive"===a.selectionType()||c?s.selected()?s.unselect(["tapunselect"]):s.select(["tapselect"]):c||(a.$(T).unmerge(s).unselect(["tapunselect"]),s.select(["tapselect"]))),E.redrawHint("eles",!0)),E.hoverData.selecting){var p=a.collection(E.getAllInBox(o[0],o[1],o[2],o[3]));E.redrawHint("select",!0),p.length>0&&E.redrawHint("eles",!0),a.emit(d("boxend"));"additive"===a.selectionType()||c||a.$(T).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=u&&u.grabbed();F(l),g&&(u.emit(d("freeon")),l.emit(d("free")),E.dragData.didDrag&&(u.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 r=0;r<e.length;r++)if(e[r]%t!=0)return!1;return!0},ee=function(e){for(var t=Math.abs(e[0]),r=1;r<e.length;r++)if(Math.abs(e[r])!==t)return!1;return!0},et=function(e){var t=!1,r=e.deltaY;if(null==r&&(null!=e.wheelDeltaY?r=e.wheelDeltaY/4:null!=e.wheelDelta&&(r=e.wheelDelta/4)),0!==r){if(null==a)if(Z.length>=4){if(!(a=J(Z,5))){var n=Math.abs(Z[0]);a=ee(Z)&&n>5}if(a)for(var i=0;i<Z.length;i++)Q=Math.min(Math.abs(Z[i]),Q)}else Z.push(r),t=!0;else a&&(Q=Math.min(Math.abs(r),Q));if(!E.scrollingPage){var o=E.cy,s=o.zoom(),l=o.pan(),u=E.projectIntoViewport(e.clientX,e.clientY),c=[u[0]*s+l.x,u[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(r)>5&&(r=5*r9(r)),d=-(r/250),a&&(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:c[0],y:c[1]}}),o.emit({type:"gesturechange"===e.type?"pinchzoom":"scrollzoom",originalEvent:e,position:{x:u[0],y:u[1]}})}}}};E.registerBinding(E.container,"wheel",et,!0),E.registerBinding(S,"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 er=function(e,t,r,n){return Math.sqrt((r-e)*(r-e)+(n-t)*(n-t))},en=function(e,t,r,n){return(r-e)*(r-e)+(n-t)*(n-t)};if(E.registerBinding(E.container,"touchstart",x=function(e){if(E.hasTouchStarted=!0,K(e)){q(),E.touchData.capture=!0,E.data.bgActivePosistion=void 0;var t=E.cy,r=E.touchData.now,n=E.touchData.earlier;if(e.touches[0]){var a=E.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);r[0]=a[0],r[1]=a[1]}if(e.touches[1]){var a=E.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);r[2]=a[0],r[3]=a[1]}if(e.touches[2]){var a=E.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);r[4]=a[0],r[5]=a[1]}var x=function(t){return{originalEvent:e,type:t,position:{x:r[0],y:r[1]}}};if(e.touches[1]){E.touchData.singleTouchMoved=!0,F(E.dragData.touchDragEles);var b=E.findContainerClientCoords();f=b[0],p=b[1],g=b[2],v=b[3],i=e.touches[0].clientX-f,o=e.touches[0].clientY-p,s=e.touches[1].clientX-f,l=e.touches[1].clientY-p,y=0<=i&&i<=g&&0<=s&&s<=g&&0<=o&&o<=v&&0<=l&&l<=v;var w=t.pan(),j=t.zoom();if(u=er(i,o,s,l),c=en(i,o,s,l),h=[((d=[(i+s)/2,(o+l)/2])[0]-w.x)/j,(d[1]-w.y)/j],c<4e4&&!e.touches[2]){var N=E.findNearestElement(r[0],r[1],!0,!0),k=E.findNearestElement(r[2],r[3],!0,!0);N&&N.isNode()?(N.activate().emit(x("cxttapstart")),E.touchData.start=N):k&&k.isNode()?(k.activate().emit(x("cxttapstart")),E.touchData.start=k):t.emit(x("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(r[0],r[1],!0,!0),S=C[0];if(null!=S&&(S.activate(),E.touchData.start=S,E.touchData.starts=C,E.nodeIsGrabbable(S))){var T=E.dragData.touchDragEles=t.collection(),_=null;E.redrawHint("eles",!0),E.redrawHint("drag",!0),S.selected()?V(_=t.$(function(e){return e.selected()&&E.nodeIsGrabbable(e)}),{addToList:T}):V(S,{addToList:T}),I(S),S.emit(x("grabon")),_?_.forEach(function(e){e.emit(x("grab"))}):S.emit(x("grab"))}P(S,["touchstart","tapstart","vmousedown"],e,{x:r[0],y:r[1]}),null==S&&(E.data.bgActivePosistion={x:a[0],y:a[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||P(E.touchData.start,["taphold"],e,{x:r[0],y:r[1]})},E.tapholdDuration)}if(e.touches.length>=1){for(var D=E.touchData.startPosition=[null,null,null,null,null,null],B=0;B<r.length;B++)D[B]=n[B]=r[B];var M=e.touches[0];E.touchData.startGPosition=[M.clientX,M.clientY]}}},!1),E.registerBinding(S,"touchmove",b=function(e){var t=E.touchData.capture;if(t||K(e)){var r=E.selection,n=E.cy,a=E.touchData.now,d=E.touchData.earlier,g=n.zoom();if(e.touches[0]){var v=E.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);a[0]=v[0],a[1]=v[1]}if(e.touches[1]){var v=E.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);a[2]=v[0],a[3]=v[1]}if(e.touches[2]){var v=E.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);a[4]=v[0],a[5]=v[1]}var x=function(t){return{originalEvent:e,type:t,position:{x:a[0],y:a[1]}}},b=E.touchData.startGPosition;if(t&&e.touches[0]&&b){for(var w=[],j=0;j<a.length;j++)w[j]=a[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 S=e.touches[0].clientX-f,T=e.touches[0].clientY-p,_=e.touches[1].clientX-f,B=e.touches[1].clientY-p,M=en(S,T,_,B);if(M/c>=2.25||M>=22500){E.touchData.cxt=!1,E.data.bgActivePosistion=void 0,E.redrawHint("select",!0);var A=x("cxttapend");E.touchData.start?(E.touchData.start.unactivate().emit(A),E.touchData.start=null):n.emit(A)}}if(t&&E.touchData.cxt){var A=x("cxtdrag");E.data.bgActivePosistion=void 0,E.redrawHint("select",!0),E.touchData.start?E.touchData.start.emit(A):n.emit(A),E.touchData.start&&(E.touchData.start._private.grabbed=!1),E.touchData.cxtDragged=!0;var R=E.findNearestElement(a[0],a[1],!0,!0);(!E.touchData.cxtOver||R!==E.touchData.cxtOver)&&(E.touchData.cxtOver&&E.touchData.cxtOver.emit(x("cxtdragout")),E.touchData.cxtOver=R,R&&R.emit(x("cxtdragover")))}else if(t&&e.touches[2]&&n.boxSelectionEnabled())e.preventDefault(),E.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,E.touchData.selecting||n.emit(x("boxstart")),E.touchData.selecting=!0,E.touchData.didSelect=!0,r[4]=1,r&&0!==r.length&&void 0!==r[0]?(r[2]=(a[0]+a[2]+a[4])/3,r[3]=(a[1]+a[3]+a[5])/3):(r[0]=(a[0]+a[2]+a[4])/3,r[1]=(a[1]+a[3]+a[5])/3,r[2]=(a[0]+a[2]+a[4])/3+1,r[3]=(a[1]+a[3]+a[5])/3+1),E.redrawHint("select",!0),E.redraw();else if(t&&e.touches[1]&&!E.touchData.didSelect&&n.zoomingEnabled()&&n.panningEnabled()&&n.userZoomingEnabled()&&n.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 L=0;L<I.length;L++){var O=I[L]._private;O.grabbed=!1,O.rscratch.inDragLayer=!1}}var z=E.touchData.start,S=e.touches[0].clientX-f,T=e.touches[0].clientY-p,_=e.touches[1].clientX-f,B=e.touches[1].clientY-p,H=er(S,T,_,B),q=H/u;if(y){var X=S-i,Y=T-o,W=_-s,U=B-l,$=n.zoom(),G=$*q,Z=n.pan(),Q=h[0]*$+Z.x,J=h[1]*$+Z.y,ee={x:-G/$*(Q-Z.x-(X+W)/2)+Q,y:-G/$*(J-Z.y-(Y+U)/2)+J};if(z&&z.active()){var I=E.dragData.touchDragEles;F(I),E.redrawHint("drag",!0),E.redrawHint("eles",!0),z.unactivate().emit(x("freeon")),I.emit(x("free")),E.dragData.didDrag&&(z.emit(x("dragfreeon")),I.emit(x("dragfree")))}n.viewport({zoom:G,pan:ee,cancelOnFailedZoom:!0}),n.emit(x("pinchzoom")),u=H,i=S,o=T,s=_,l=B,E.pinching=!0}if(e.touches[0]){var v=E.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);a[0]=v[0],a[1]=v[1]}if(e.touches[1]){var v=E.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);a[2]=v[0],a[3]=v[1]}if(e.touches[2]){var v=E.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);a[4]=v[0],a[5]=v[1]}}else if(e.touches[0]&&!E.touchData.didSelect){var et,R,ea=E.touchData.start,ei=E.touchData.last;if(E.hoverData.draggingEles||E.swipePanning||(R=E.findNearestElement(a[0],a[1],!0,!0)),t&&null!=ea&&e.preventDefault(),t&&null!=ea&&E.nodeIsDraggable(ea))if(et){var I=E.dragData.touchDragEles,eo=!E.dragData.didDrag;eo&&V(I,{inDragLayer:!0}),E.dragData.didDrag=!0;var es={x:0,y:0};if(tP(w[0])&&tP(w[1])&&(es.x+=w[0],es.y+=w[1],eo)){E.redrawHint("eles",!0);var el=E.touchData.dragDelta;el&&tP(el[0])&&tP(el[1])&&(es.x+=el[0],es.y+=el[1])}E.hoverData.draggingEles=!0,I.silentShift(es).emit(x("position")).emit(x("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(P(ea||R,["touchmove","tapdrag","vmousemove"],e,{x:a[0],y:a[1]}),ea&&ea.grabbed()||R==ei||(ei&&ei.emit(x("tapdragout")),R&&R.emit(x("tapdragover"))),E.touchData.last=R,t)for(var L=0;L<a.length;L++)a[L]&&E.touchData.startPosition[L]&&et&&(E.touchData.singleTouchMoved=!0);if(t&&(null==ea||ea.pannable())&&n.panningEnabled()&&n.userPanningEnabled()){D(ea,E.touchData.starts)&&(e.preventDefault(),E.data.bgActivePosistion||(E.data.bgActivePosistion=r1(E.touchData.startPosition)),E.swipePanning?(n.panBy({x:w[0]*g,y:w[1]*g}),n.emit(x("dragpan"))):et&&(E.swipePanning=!0,n.panBy({x:N*g,y:C*g}),n.emit(x("dragpan")),ea&&(ea.unactivate(),E.redrawHint("select",!0),E.touchData.start=null)));var v=E.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);a[0]=v[0],a[1]=v[1]}}for(var j=0;j<a.length;j++)d[j]=a[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(S,"touchcancel",w=function(e){var t=E.touchData.start;E.touchData.capture=!1,t&&t.unactivate()}),E.registerBinding(S,"touchend",j=function(e){var t,r=E.touchData.start;if(E.touchData.capture){0===e.touches.length&&(E.touchData.capture=!1),e.preventDefault();var n=E.selection;E.swipePanning=!1,E.hoverData.draggingEles=!1;var a=E.cy,i=a.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 u=function(t){return{originalEvent:e,type:t,position:{x:o[0],y:o[1]}}};if(r&&r.unactivate(),E.touchData.cxt){if(t=u("cxttapend"),r?r.emit(t):a.emit(t),!E.touchData.cxtDragged){var c=u("cxttap");r?r.emit(c):a.emit(c)}E.touchData.start&&(E.touchData.start._private.grabbed=!1),E.touchData.cxt=!1,E.touchData.start=null,E.redraw();return}if(!e.touches[2]&&a.boxSelectionEnabled()&&E.touchData.selecting){E.touchData.selecting=!1;var d=a.collection(E.getAllInBox(n[0],n[1],n[2],n[3]));n[0]=void 0,n[1]=void 0,n[2]=void 0,n[3]=void 0,n[4]=0,E.redrawHint("select",!0),a.emit(u("boxend")),d.emit(u("box")).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(u("boxselect")),d.nonempty()&&E.redrawHint("eles",!0),E.redraw()}if(null!=r&&r.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!=r){var f=r._private.grabbed;F(h),E.redrawHint("drag",!0),E.redrawHint("eles",!0),f&&(r.emit(u("freeon")),h.emit(u("free")),E.dragData.didDrag&&(r.emit(u("dragfreeon")),h.emit(u("dragfree")))),P(r,["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]}),r.unactivate(),E.touchData.start=null}else P(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||(r||a.$(":selected").unselect(["tapunselect"]),P(r,["tap","vclick"],e,{x:o[0],y:o[1]}),N=!1,e.timeStamp-C<=a.multiClickDebounceTime()?(k&&clearTimeout(k),N=!0,C=null,P(r,["dbltap","vdblclick"],e,{x:o[0],y:o[1]})):(k=setTimeout(function(){N||P(r,["onetap","voneclick"],e,{x:o[0],y:o[1]})},a.multiClickDebounceTime()),C=e.timeStamp)),null!=r&&!E.dragData.didDrag&&r._private.selectable&&(p*p+g*g)*i*i<E.touchTapThreshold2&&!E.pinching&&("single"===a.selectionType()?(a.$(T).unmerge(r).unselect(["tapunselect"]),r.select(["tapselect"])):r.selected()?r.unselect(["tapunselect"]):r.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),"undefined"==typeof TouchEvent){var ea=[],ei=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){ea.push({event:e,touch:ei(e)})},es=function(e){for(var t=0;t<ea.length;t++)if(ea[t].event.pointerId===e.pointerId)return void ea.splice(t,1)},el=function(e){var t=ea.filter(function(t){return t.event.pointerId===e.pointerId})[0];t.event=e,t.touch=ei(e)},eu=function(e){e.touches=ea.map(function(e){return e.touch})},ec=function(e){return"mouse"===e.pointerType||4===e.pointerType};E.registerBinding(E.container,"pointerdown",function(e){ec(e)||(e.preventDefault(),eo(e),eu(e),x(e))}),E.registerBinding(E.container,"pointerup",function(e){ec(e)||(es(e),eu(e),j(e))}),E.registerBinding(E.container,"pointercancel",function(e){ec(e)||(es(e),eu(e),w(e))}),E.registerBinding(E.container,"pointermove",function(e){ec(e)||(e.preventDefault(),el(e),eu(e),b(e))})}};var cL={};cL.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,r,n,a,i){this.renderer.nodeShapeImpl("polygon",e,t,r,n,a,this.points)},intersectLine:function(e,t,r,n,a,i,o,s){return nI(a,i,this.points,e,t,r/2,n/2,o)},checkPoint:function(e,t,r,n,a,i,o,s){return nE(e,t,this.points,i,o,n,a,[0,-1],r)},hasMiterBounds:"rectangle"!==e,miterBounds:function(e,t,r,n,a,i){var o,s,l;return o=this.points,s=function(e,t){if(e.length<3)throw Error("Need at least 3 vertices");var r=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},n=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},a=function(e,t){return{x:e.x*t,y:e.y*t}},i=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,r=0;r<e.length;r++){var n=e[r],a=e[(r+1)%e.length];t+=n.x*a.y-a.x*n.y}return t/2}(o)&&o.reverse();for(var s=o.length,l=[],u=0;u<s;u++){var c=o[u],d=n(o[(u+1)%s],c),h=function(e){var t=nv(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,n){return{p1:r(o[n],a(e,t)),p2:r(o[(n+1)%s],a(e,t))}}),p=[],g=0;g<s;g++){var v=f[(g-1+s)%s],y=f[g],x=function(e,t,o,s){var l=n(t,e),u=n(s,o),c=i(l,u);if(1e-9>Math.abs(c))return r(e,a(l,.5));var d=i(n(o,e),u)/c;return r(e,a(l,d))}(v.p1,v.p2,y.p1,y.p2);p.push(x)}return p}(nR(o,e,t,r,n),a),l=no(),s.forEach(function(e){return nu(l,e.x,e.y)}),l}}},cL.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,r,n,a,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,a)},intersectLine:function(e,t,r,n,a,i,o,s){return n_(a,i,e,t,r/2+o,n/2+o)},checkPoint:function(e,t,r,n,a,i,o,s){return nD(e,t,n,a,i,o,r)}}},cL.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(e,r,n,a,i,o,s){if(void 0!==o[s]&&o[s+"-cx"]===e&&o[s+"-cy"]===r)return o[s];o[s]=Array(t.length/2),o[s+"-cx"]=e,o[s+"-cy"]=r;var l=n/2,u=a/2;i="auto"===i?nq(n,a):i;for(var c=Array(t.length/2),d=0;d<t.length/2;d++)c[d]={x:e+l*t[2*d],y:r+u*t[2*d+1]};var h,f,p,g,v=c.length;for(h=0,f=c[v-1];h<v;h++)p=c[h%v],g=c[(h+1)%v],o[s][h]=cb(f,p,g,i),f=p,p=g;return o[s]},draw:function(e,t,r,n,a,i,o){this.renderer.nodeShapeImpl("round-polygon",e,t,r,n,a,this.points,this.getOrCreateCorners(t,r,n,a,i,o,"drawCorners"))},intersectLine:function(e,t,r,n,a,i,o,s,l){return nL(a,i,this.points,e,t,r,n,o,this.getOrCreateCorners(e,t,r,n,s,l,"corners"))},checkPoint:function(e,t,r,n,a,i,o,s,l){return nS(e,t,this.points,i,o,n,a,this.getOrCreateCorners(i,o,n,a,s,l,"corners"))}}},cL.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:nz(4,0),draw:function(e,t,r,n,a,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,a,this.points,i)},intersectLine:function(e,t,r,n,a,i,o,s){return ny(a,i,e,t,r,n,o,s)},checkPoint:function(e,t,r,n,a,i,o,s){var l=n/2,u=a/2,c=2*(s=Math.min(l,u,s="auto"===s?nH(n,a):s));return!!(nE(e,t,this.points,i,o,n,a-c,[0,-1],r)||nE(e,t,this.points,i,o,n-c,a,[0,-1],r)||nD(e,t,c,c,i-l+s,o-u+s,r)||nD(e,t,c,c,i+l-s,o-u+s,r)||nD(e,t,c,c,i+l-s,o+u-s,r)||nD(e,t,c,c,i-l+s,o+u-s,r))}}},cL.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:nX(),points:nz(4,0),draw:function(e,t,r,n,a,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,a,null,i)},generateCutTrianglePts:function(e,t,r,n,a){var i="auto"===a?this.cornerLength:a,o=t/2,s=e/2,l=r-s,u=r+s,c=n-o,d=n+o;return{topLeft:[l,c+i,l+i,c,l+i,c+i],topRight:[u-i,c,u,c+i,u-i,c+i],bottomRight:[u,d-i,u-i,d,u-i,d-i],bottomLeft:[l+i,d,l,d-i,l+i,d-i]}},intersectLine:function(e,t,r,n,a,i,o,s){var l=this.generateCutTrianglePts(r+2*o,n+2*o,e,t,s);return nI(a,i,[].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,r,n,a,i,o,s){var l="auto"===s?this.cornerLength:s;if(nE(e,t,this.points,i,o,n,a-2*l,[0,-1],r)||nE(e,t,this.points,i,o,n-2*l,a,[0,-1],r))return!0;var u=this.generateCutTrianglePts(n,a,i,o);return nC(e,t,u.topLeft)||nC(e,t,u.topRight)||nC(e,t,u.bottomRight)||nC(e,t,u.bottomLeft)}}},cL.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:nz(4,0),draw:function(e,t,r,n,a,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,a)},intersectLine:function(e,t,r,n,a,i,o,s){var l=this.generateBarrelBezierPts(r+2*o,n+2*o,e,t),u=function(e){var t=nn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.15),r=nn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.5),n=nn({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,r.x,r.y,n.x,n.y,e[4],e[5]]};return nI(a,i,[].concat(u(l.topLeft),u(l.topRight),u(l.bottomRight),u(l.bottomLeft)),e,t)},generateBarrelBezierPts:function(e,t,r,n){var a=t/2,i=e/2,o=r-i,s=r+i,l=n-a,u=n+a,c=nY(e,t),d=c.heightOffset,h=c.widthOffset,f=c.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,u-d,s-f,u,s-h,u],bottomLeft:[o+h,u,o+f,u,o,u-d]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(e,t,r,n,a,i,o,s){var l=nY(n,a),u=l.heightOffset,c=l.widthOffset;if(nE(e,t,this.points,i,o,n,a-2*u,[0,-1],r)||nE(e,t,this.points,i,o,n-2*c,a,[0,-1],r))return!0;for(var d=this.generateBarrelBezierPts(n,a,i,o),h=Object.keys(d),f=0;f<h.length;f++){var p=d[h[f]],g=function(e,t,r){var n=r[4],a=r[2],i=r[0],o=r[5],s=r[1],l=Math.min(n,i),u=Math.max(n,i),c=Math.min(o,s),d=Math.max(o,s);if(l<=e&&e<=u&&c<=t&&t<=d){var h=[n-2*a+i,2*(a-n),n],f=nw(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=nr(p[5],p[3],p[1],g);if(p.isTop&&v<=t||p.isBottom&&t<=v)return!0}}return!1}}},cL.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:nz(4,0),draw:function(e,t,r,n,a,i){this.renderer.nodeShapeImpl(this.name,e,t,r,n,a,this.points,i)},intersectLine:function(e,t,r,n,a,i,o,s){var l=e-(r/2+o),u=t-(n/2+o),c=e+(r/2+o),d=nA(a,i,e,t,l,u,c,u,!1);return d.length>0?d:ny(a,i,e,t,r,n,o,s)},checkPoint:function(e,t,r,n,a,i,o,s){var l=2*(s="auto"===s?nH(n,a):s);if(nE(e,t,this.points,i,o,n,a-l,[0,-1],r)||nE(e,t,this.points,i,o,n-l,a,[0,-1],r))return!0;var u=n/2+2*r,c=a/2+2*r;return!!(nC(e,t,[i-u,o-c,i-u,o,i+u,o,i+u,o-c])||nD(e,t,l,l,i+n/2-s,o+a/2-s,r)||nD(e,t,l,l,i-n/2+s,o+a/2-s,r))}}},cL.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",nz(3,0)),this.generateRoundPolygon("round-triangle",nz(3,0)),this.generatePolygon("rectangle",nz(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r),this.generatePolygon("pentagon",nz(5,0)),this.generateRoundPolygon("round-pentagon",nz(5,0)),this.generatePolygon("hexagon",nz(6,0)),this.generateRoundPolygon("round-hexagon",nz(6,0)),this.generatePolygon("heptagon",nz(7,0)),this.generateRoundPolygon("round-heptagon",nz(7,0)),this.generatePolygon("octagon",nz(8,0)),this.generateRoundPolygon("round-octagon",nz(8,0));var n=Array(20),a=nF(5,0),i=nF(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<i.length/2;s++)i[2*s]*=o,i[2*s+1]*=o;for(var s=0;s<5;s++)n[4*s]=a[2*s],n[4*s+1]=a[2*s+1],n[4*s+2]=i[2*s],n[4*s+3]=i[2*s+1];n=nV(n),this.generatePolygon("star",n),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 r,n="polygon-"+e.join("$");return(r=this[n])?r:t.generatePolygon(n,e)}};var cO={};cO.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},cO.redraw=function(e){e=e||rP(),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},cO.beforeRender=function(e,t){if(!this.destroyed){null==t&&rN("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:e,priority:t}),r.sort(function(e,t){return t.priority-e.priority})}};var cz=function(e,t,r){for(var n=e.beforeRenderCallbacks,a=0;a<n.length;a++)n[a].fn(t,r)};cO.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var r=function(n){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){cz(e,!0,n);var a=rn();e.render(e.renderOptions);var i=e.lastDrawTime=rn();void 0===e.averageRedrawTime&&(e.averageRedrawTime=i-a),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=i-a;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else cz(e,!1,n);e.skipFrame=!1,ri(r)}};ri(r)}};var cV=function(e){this.init(e)},cF=cV.prototype;cF.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],cF.init=function(e){this.options=e,this.cy=e.cy;var t=this.container=e.cy.container(),r=this.cy.window();if(r){var n=r.document,a=n.head,i="__________cytoscape_stylesheet",o="__________cytoscape_container",s=null!=n.getElementById(i);if(0>t.className.indexOf(o)&&(t.className=(t.className||"")+" "+o),!s){var l=n.createElement("style");l.id=i,l.textContent="."+o+" { position: relative; }",a.insertBefore(l,a.children[0])}"static"===r.getComputedStyle(t).getPropertyValue("position")&&rC("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=tP(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()},cF.notify=function(e,t){var r=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&&r.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()}},cF.destroy=function(){this.destroyed=!0,this.cy.stopAnimationLoop();for(var e=0;e<this.bindings.length;e++){var t=this.bindings[e],r=t.target;(r.off||r.removeEventListener).apply(r,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){}},cF.isHeadless=function(){return!1},[sX,cA,cR,cI,cL,cO].forEach(function(e){tG(cF,e)});var cH=1e3/60,cq=function(e){return function(){var t=this,r=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var n=rt(function(){r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},e.deqRedrawThreshold),a=e.priority||rj;r.beforeRender(function(a,i){var o=rn(),s=r.averageRedrawTime,l=r.lastRedrawTime,u=[],c=r.cy.extent(),d=r.getPixelRatio();for(a||r.flushRenderedStyleQueue();;){var h=rn(),f=h-o,p=h-i;if(l<cH){var g=cH-(a?s:0);if(p>=e.deqFastCost*g)break}else if(a){if(f>=e.deqCost*l||f>=e.deqAvgCost*s)break}else if(p>=e.deqNoDrawCost*cH)break;var v=e.deq(t,d,c);if(v.length>0)for(var y=0;y<v.length;y++)u.push(v[y]);else break}u.length>0&&(e.onDeqd(t,u),!a&&e.shouldRedraw(t,u,d,c)&&n())},a(t))}}},cX=tc(function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rb;tu(this,e),this.idsByKey=new rL,this.keyForId=new rL,this.cachesByLvl=new rL,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=r},[{key:"getIdsFor",value:function(e){null==e&&rN("Can not get id list for null key");var t=this.idsByKey,r=this.idsByKey.get(e);return r||(r=new rz,t.set(e,r)),r}},{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(),r=this.keyForId.get(t),n=this.getKey(e);this.deleteIdForKey(r,t),this.addIdForKey(n,t),this.keyForId.set(t,n)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),r=this.keyForId.get(t);this.deleteIdForKey(r,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,r=this.lvls,n=t.get(e);return n||(n=new rL,t.set(e,n),r.push(e)),n}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var r=this.getKey(e),n=this.getCache(r,t);return null!=n&&this.updateKeyMappingFor(e),n}},{key:"getForCachedKey",value:function(e,t){var r=this.keyForId.get(e.id());return this.getCache(r,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var r=this.getKey(e);return this.hasCache(r,t)}},{key:"setCache",value:function(e,t,r){r.key=e,this.getCachesAt(t).set(e,r)}},{key:"set",value:function(e,t,r){var n=this.getKey(e);this.setCache(n,t,r),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var r=this.getKey(e);this.deleteCache(r,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach(function(r){return t.deleteCache(e,r)})}},{key:"invalidate",value:function(e){var t=e.id(),r=this.keyForId.get(t);this.deleteKeyMappingFor(e);var n=this.doesEleInvalidateKey(e);return n&&this.invalidateKey(r),n||0===this.getNumberOfIdsForKey(r)}}]),cY={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},cW=r_({getKey:null,doesEleInvalidateKey:rb,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:rx,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),cU=function(e,t){this.renderer=e,this.onDequeues=[];var r=cW(t);tG(this,r),this.lookup=new cX(r.getKey,r.doesEleInvalidateKey),this.setupDequeueing()},c$=cU.prototype;c$.reasons=cY,c$.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},c$.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},c$.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new rY(function(e,t){return t.reqs-e.reqs})},c$.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},c$.getElement=function(e,t,r,n,a){var i,o,s,l=this,u=this.renderer,c=u.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==n&&(n=Math.ceil(r7(c*r))),n<-4)n=-4;else if(c>=7.99||n>3)return null;var h=Math.pow(2,n),f=t.h*h,p=t.w*h,g=u.eleTextBiggerThanMin(e,h);if(!this.isVisible(e,g))return null;var v=d.get(e,n);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;if(i=f<=25?25:f<=50?50:50*Math.ceil(f/50),f>1024||p>1024)return null;var y=l.getTextureQueue(i),x=y[y.length-2],b=function(){return l.recycleTexture(i,p)||l.addTexture(i,p)};x||(x=y[y.length-1]),x||(x=b()),x.width-x.usedWidth<p&&(x=b());for(var w=function(e){return e&&e.scaledLabelShown===g},j=a&&a===cY.dequeue,N=a&&a===cY.highQuality,k=a&&a===cY.downscale,C=n+1;C<=3;C++){var E=d.get(e,C);if(E){o=E;break}}var S=o&&o.level===n+1?o:null,T=function(){x.context.drawImage(S.texture.canvas,S.x,0,S.width,S.height,x.usedWidth,0,p,f)};if(x.context.setTransform(1,0,0,1,0,0),x.context.clearRect(x.usedWidth,0,p,i),w(S))T();else if(w(o))if(!N)return l.queueElement(e,o.level-1),o;else{for(var P=o.level;P>n;P--)S=l.getElement(e,t,r,P,cY.downscale);T()}else{if(!j&&!N&&!k)for(var _=n-1;_>=-4;_--){var D=d.get(e,_);if(D){s=D;break}}if(w(s))return l.queueElement(e,n),s;x.context.translate(x.usedWidth,0),x.context.scale(h,h),this.drawElement(x.context,e,t,g,!1),x.context.scale(1/h,1/h),x.context.translate(-x.usedWidth,0)}return v={x:x.usedWidth,texture:x,level:n,scale:h,width:p,height:f,scaledLabelShown:g},x.usedWidth+=Math.ceil(p+8),x.eleCaches.push(v),d.set(e,n,v),l.checkTextureFullness(x),v},c$.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},c$.invalidateElement=function(e){var t=this.lookup,r=[];if(t.isInvalid(e)){for(var n=-4;n<=3;n++){var a=t.getForCachedKey(e,n);a&&r.push(a)}if(t.invalidate(e))for(var i=0;i<r.length;i++){var o=r[i],s=o.texture;s.invalidatedWidth+=o.width,o.invalidated=!0,this.checkTextureUtility(s)}this.removeFromQueue(e)}},c$.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},c$.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?rD(t,e):e.fullnessChecks++},c$.retireTexture=function(e){var t=e.height,r=this.getTextureQueue(t),n=this.lookup;rD(r,e),e.retired=!0;for(var a=e.eleCaches,i=0;i<a.length;i++){var o=a[i];n.deleteCache(o.key,o.level)}rB(a),this.getRetiredTextureQueue(t).push(e)},c$.addTexture=function(e,t){var r=this.getTextureQueue(e),n={};return r.push(n),n.eleCaches=[],n.height=e,n.width=Math.max(1024,t),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=this.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n},c$.recycleTexture=function(e,t){for(var r=this.getTextureQueue(e),n=this.getRetiredTextureQueue(e),a=0;a<n.length;a++){var i=n[a];if(i.width>=t)return i.retired=!1,i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,rB(i.eleCaches),i.context.setTransform(1,0,0,1,0,0),i.context.clearRect(0,0,i.width,i.height),rD(n,i),r.push(i),i}},c$.queueElement=function(e,t){var r=this.getElementQueue(),n=this.getElementKeyToQueue(),a=this.getKey(e),i=n[a];if(i)i.level=Math.max(i.level,t),i.eles.merge(e),i.reqs++,r.updateItem(i);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:a};r.push(o),n[a]=o}},c$.dequeue=function(e){for(var t=this.getElementQueue(),r=this.getElementKeyToQueue(),n=[],a=this.lookup,i=0;i<1;i++)if(t.size()>0){var o=t.pop(),s=o.key,l=o.eles[0],u=a.hasCache(l,o.level);if(r[s]=null,u)continue;n.push(o);var c=this.getBoundingBox(l);this.getElement(l,c,e,o.level,cY.dequeue)}else break;return n},c$.removeFromQueue=function(e){var t=this.getElementQueue(),r=this.getElementKeyToQueue(),n=this.getKey(e),a=r[n];null!=a&&(1===a.eles.length?(a.reqs=ry,t.updateItem(a),t.pop(),r[n]=null):a.eles.unmerge(e))},c$.onDequeue=function(e){this.onDequeues.push(e)},c$.offDequeue=function(e){rD(this.onDequeues,e)},c$.setupDequeueing=cq({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,r){return e.dequeue(t,r)},onDeqd:function(e,t){for(var r=0;r<e.onDequeues.length;r++)(0,e.onDequeues[r])(t)},shouldRedraw:function(e,t,r,n){for(var a=0;a<t.length;a++)for(var i=t[a].eles,o=0;o<i.length;o++)if(nf(i[o].boundingBox(),n))return!0;return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var cK=function(e){var t=this,r=t.renderer=e,n=r.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=rn()-500,t.skipping=!1,t.eleTxrDeqs=n.collection(),t.scheduleElementRefinement=rt(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},50),r.beforeRender(function(e,r){r-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1},r.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new rY(function(e,t){return t.reqs-e.reqs}),t.setupDequeueing()},cG=cK.prototype,cZ=0;cG.makeLayer=function(e,t){var r=Math.pow(2,t),n=Math.ceil(e.w*r),a=Math.ceil(e.h*r),i=this.renderer.makeOffscreenCanvas(n,a),o={id:cZ=++cZ%0x1fffffffffffff,bb:e,level:t,width:n,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,l=-o.bb.x1,u=-o.bb.y1;return s.scale(r,r),s.translate(l,u),o},cG.getLayers=function(e,t,r){var n,a,i=this,o=i.renderer.cy.zoom(),s=i.firstGet;if(i.firstGet=!1,null==r){if((r=Math.ceil(r7(o*t)))<-4)r=-4;else if(o>=3.99||r>2)return null}i.validateLayersElesOrdering(r,e);var l=i.layersByLevel,u=Math.pow(2,r),c=l[r]=l[r]||[];if(i.levelIsComplete(r,e))return c;var d=function(t){if(i.validateLayersElesOrdering(t,e),i.levelIsComplete(t,e))return a=l[t],!0},h=function(e){if(!a)for(var t=r+e;-4<=t&&t<=2&&!d(t);t+=e);};h(1),h(-1);for(var f=c.length-1;f>=0;f--){var p=c[f];p.invalid&&rD(c,p)}var g=function(){if(!n){n=no();for(var t=0;t<e.length;t++)nl(n,e[t].boundingBox())}return n};if(i.skipping&&!s)return null;for(var v=null,y=e.length/1,x=!s,b=0;b<e.length;b++){var w=e[b],j=w._private.rscratch,N=j.imgLayerCaches=j.imgLayerCaches||{},k=N[r];if(k){v=k;continue}if((!v||v.eles.length>=y||!nm(v.bb,w.boundingBox()))&&!(v=function(e){var t=(e=e||{}).after;g();var a=Math.ceil(n.w*u),o=Math.ceil(n.h*u);if(a>32767||o>32767||a*o>16e6)return null;var s=i.makeLayer(n,r);if(null!=t){var l=c.indexOf(t)+1;c.splice(l,0,s)}else(void 0===e.insert||e.insert)&&c.unshift(s);return s}({insert:!0,after:v})))return null;a||x?i.queueLayer(v,w):i.drawEleInLayer(v,w,r,t),v.eles.push(w),N[r]=v}return a||(x?null:c)},cG.getEleLevelForLayerLevel=function(e,t){return e},cG.drawEleInLayer=function(e,t,r,n){var a=this.renderer,i=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(r=this.getEleLevelForLayerLevel(r,n),a.setImgSmoothing(i,!1),a.drawCachedElement(i,t,null,null,r,!0),a.setImgSmoothing(i,!0))},cG.levelIsComplete=function(e,t){var r=this.layersByLevel[e];if(!r||0===r.length)return!1;for(var n=0,a=0;a<r.length;a++){var i=r[a];if(i.reqs>0||i.invalid)return!1;n+=i.eles.length}return n===t.length},cG.validateLayersElesOrdering=function(e,t){var r=this.layersByLevel[e];if(r)for(var n=0;n<r.length;n++){for(var a=r[n],i=-1,o=0;o<t.length;o++)if(a.eles[0]===t[o]){i=o;break}if(i<0){this.invalidateLayer(a);continue}for(var s=i,o=0;o<a.eles.length;o++)if(a.eles[o]!==t[s+o]){this.invalidateLayer(a);break}}},cG.updateElementsInLayers=function(e,t){for(var r=tB(e[0]),n=0;n<e.length;n++)for(var a=r?null:e[n],i=r?e[n]:e[n].ele,o=i._private.rscratch,s=o.imgLayerCaches=o.imgLayerCaches||{},l=-4;l<=2;l++){var u=s[l];u&&(a&&this.getEleLevelForLayerLevel(u.level)!==a.level||t(u,i,a))}},cG.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var r=this.layersByLevel[t];if(r&&r.length>0){e=!0;break}}return e},cG.invalidateElements=function(e){var t=this;0===e.length||(t.lastInvalidationTime=rn(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,r,n){t.invalidateLayer(e)}))},cG.invalidateLayer=function(e){if(this.lastInvalidationTime=rn(),!e.invalid){var t=e.level,r=e.eles;rD(this.layersByLevel[t],e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var n=0;n<r.length;n++){var a=r[n]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},cG.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(e,r,n){var a=e.replacement;if(a||((a=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,a.eles=e.eles),!a.reqs)for(var i=0;i<a.eles.length;i++)t.queueLayer(a,a.eles[i])})},cG.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},cG.queueLayer=function(e,t){var r=this.layersQueue,n=e.elesQueue,a=n.hasId=n.hasId||{};if(!e.replacement){if(t){if(a[t.id()])return;n.push(t),a[t.id()]=!0}e.reqs?(e.reqs++,r.updateItem(e)):(e.reqs=1,r.push(e))}},cG.dequeue=function(e){for(var t=this.layersQueue,r=[],n=0;n<1&&0!==t.size();){var a=t.peek();if(a.replacement||a.replaces&&a!==a.replaces.replacement||a.invalid){t.pop();continue}var i=a.elesQueue.shift();i&&(this.drawEleInLayer(a,i,a.level,e),n++),0===r.length&&r.push(!0),0===a.elesQueue.length&&(t.pop(),a.reqs=0,a.replaces&&this.applyLayerReplacement(a),this.requestRedraw())}return r},cG.applyLayerReplacement=function(e){var t=this.layersByLevel[e.level],r=e.replaces,n=t.indexOf(r);if(!(n<0)&&!r.invalid){t[n]=e;for(var a=0;a<e.eles.length;a++){var i=e.eles[a]._private,o=i.imgLayerCaches=i.imgLayerCaches||{};o&&(o[e.level]=e)}this.requestRedraw()}},cG.requestRedraw=rt(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),cG.setupDequeueing=cq({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:rj,shouldRedraw:rx,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var cQ={};function cJ(e,t){for(var r=0;r<t.length;r++){var n=t[r];e.lineTo(n.x,n.y)}}function c0(e,t,r){for(var n,a=0;a<t.length;a++){var i=t[a];0===a&&(n=i),e.lineTo(i.x,i.y)}e.quadraticCurveTo(r.x,r.y,n.x,n.y)}function c1(e,t,r){e.beginPath&&e.beginPath();for(var n=0;n<t.length;n++){var a=t[n];e.lineTo(a.x,a.y)}var i=r[0];e.moveTo(i.x,i.y);for(var n=1;n<r.length;n++){var a=r[n];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function c2(e,t,r,n,a){e.beginPath&&e.beginPath(),e.arc(r,n,a,0,2*Math.PI,!1);var i=t[0];e.moveTo(i.x,i.y);for(var o=0;o<t.length;o++){var s=t[o];e.lineTo(s.x,s.y)}e.closePath&&e.closePath()}function c5(e,t,r,n){e.arc(t,r,n,0,2*Math.PI,!1)}cQ.arrowShapeImpl=function(e){return(u||(u={polygon:cJ,"triangle-backcurve":c0,"triangle-tee":c1,"circle-triangle":c2,"triangle-cross":c1,circle:c5}))[e]};var c3={};c3.drawElement=function(e,t,r,n,a,i){t.isNode()?this.drawNode(e,t,r,n,a,i):this.drawEdge(e,t,r,n,a,i)},c3.drawElementOverlay=function(e,t){t.isNode()?this.drawNodeOverlay(e,t):this.drawEdgeOverlay(e,t)},c3.drawElementUnderlay=function(e,t){t.isNode()?this.drawNodeUnderlay(e,t):this.drawEdgeUnderlay(e,t)},c3.drawCachedElementPortion=function(e,t,r,n,a,i,o,s){var l=r.getBoundingBox(t);if(0!==l.w&&0!==l.h){var u=r.getElement(t,l,n,a,i);if(null!=u){var c,d,h,f,p,g,v=s(this,t);if(0===v)return;var y=o(this,t),x=l.x1,b=l.y1,w=l.w,j=l.h;if(0!==y){var N=r.getRotationPoint(t);h=N.x,f=N.y,e.translate(h,f),e.rotate(y),(p=this.getImgSmoothing(e))||this.setImgSmoothing(e,!0);var k=r.getRotationOffset(t);c=k.x,d=k.y}else c=x,d=b;1!==v&&(g=e.globalAlpha,e.globalAlpha=g*v),e.drawImage(u.texture.canvas,u.x,0,u.width,u.height,c,d,w,j),1!==v&&(e.globalAlpha=g),0!==y&&(e.rotate(-y),e.translate(-h,-f),p||this.setImgSmoothing(e,!1))}else r.drawElement(e,t)}};var c4=function(){return 0},c6=function(e,t){return e.getTextAngle(t,null)},c7=function(e,t){return e.getTextAngle(t,"source")},c9=function(e,t){return e.getTextAngle(t,"target")},c8=function(e,t){return t.effectiveOpacity()},de=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};c3.drawCachedElement=function(e,t,r,n,a,i){var o=this.data,s=o.eleTxrCache,l=o.lblTxrCache,u=o.slbTxrCache,c=o.tlbTxrCache,d=t.boundingBox(),h=!0===i?s.reasons.highQuality:null;if(0!==d.w&&0!==d.h&&t.visible()&&(!n||nf(d,n))){var f=t.isEdge(),p=t.element()._private.rscratch.badLine;this.drawElementUnderlay(e,t),this.drawCachedElementPortion(e,t,s,r,a,h,c4,c8),f&&p||this.drawCachedElementPortion(e,t,l,r,a,h,c6,de),f&&!p&&(this.drawCachedElementPortion(e,t,u,r,a,h,c7,de),this.drawCachedElementPortion(e,t,c,r,a,h,c9,de)),this.drawElementOverlay(e,t)}},c3.drawElements=function(e,t){for(var r=0;r<t.length;r++){var n=t[r];this.drawElement(e,n)}},c3.drawCachedElements=function(e,t,r,n){for(var a=0;a<t.length;a++){var i=t[a];this.drawCachedElement(e,i,r,n)}},c3.drawCachedNodes=function(e,t,r,n){for(var a=0;a<t.length;a++){var i=t[a];i.isNode()&&this.drawCachedElement(e,i,r,n)}},c3.drawLayeredElements=function(e,t,r,n){var a=this.data.lyrTxrCache.getLayers(t,r);if(a)for(var i=0;i<a.length;i++){var o=a[i],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,r,n)};var dt={};dt.drawEdge=function(e,t,r){var n,a=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(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]))){r&&(n=r,e.translate(-n.x1,-n.y1));var u=o?t.pstyle("opacity").value:1,c=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,y=u*c,x=u*c,b=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===d?(s.eleStrokeStyle(e,t,r),s.drawEdgeTrianglePath(t,e,l.allpts)):(e.lineWidth=f,e.lineCap=p,s.eleStrokeStyle(e,t,r),s.drawEdgePath(t,e,l.allpts,h),e.lineCap="butt")},w=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:x;s.drawArrowheads(e,t,r)};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=y*t.pstyle("ghost-opacity").value;e.translate(j,N),b(k),w(k),e.translate(-j,-N)}else!function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;if(e.lineWidth=f+g,e.lineCap=p,g>0)s.colorStrokeStyle(e,v[0],v[1],v[2],r);else{e.lineCap="butt";return}"straight-triangle"===d?s.drawEdgeTrianglePath(t,e,l.allpts):(s.drawEdgePath(t,e,l.allpts,h),e.lineCap="butt")}();i&&s.drawEdgeUnderlay(e,t),b(),w(),i&&s.drawEdgeOverlay(e,t),s.drawElementText(e,t,null,a),r&&e.translate(n.x1,n.y1)}};var dr=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,r){if(r.visible()){var n=r.pstyle("".concat(e,"-opacity")).value;if(0!==n){var a=this.usePaths(),i=r._private.rscratch,o=r.pstyle("".concat(e,"-padding")).pfValue,s=r.pstyle("".concat(e,"-color")).value;t.lineWidth=2*o,"self"!==i.edgeType||a?t.lineCap="round":t.lineCap="butt",this.colorStrokeStyle(t,s[0],s[1],s[2],n),this.drawEdgePath(r,t,i.allpts,"solid")}}}};dt.drawEdgeOverlay=dr("overlay"),dt.drawEdgeUnderlay=dr("underlay"),dt.drawEdgePath=function(e,t,r,n){var a=e._private.rscratch,i=t,o=!1,s=this.usePaths(),l=e.pstyle("line-dash-pattern").pfValue,u=e.pstyle("line-dash-offset").pfValue;if(s){var c=r.join("$");a.pathCacheKey&&a.pathCacheKey===c?(f=t=a.pathCache,o=!0):(f=t=new Path2D,a.pathCacheKey=c,a.pathCache=f)}if(i.setLineDash)switch(n){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=u;break;case"solid":i.setLineDash([])}if(!o&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(r[0],r[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<r.length;d+=4)t.quadraticCurveTo(r[d],r[d+1],r[d+2],r[d+3]);break;case"straight":case"haystack":for(var h=2;h+1<r.length;h+=2)t.lineTo(r[h],r[h+1]);break;case"segments":if(a.isRound){var f,p,g=td(a.roundCorners);try{for(g.s();!(p=g.n()).done;){var v=p.value;cx(t,v)}}catch(e){g.e(e)}finally{g.f()}t.lineTo(r[r.length-2],r[r.length-1])}else for(var y=2;y+1<r.length;y+=2)t.lineTo(r[y],r[y+1])}t=i,s?t.stroke(f):t.stroke(),t.setLineDash&&t.setLineDash([])},dt.drawEdgeTrianglePath=function(e,t,r){t.fillStyle=t.strokeStyle;for(var n=e.pstyle("width").pfValue,a=0;a+1<r.length;a+=2){var i=[r[a+2]-r[a],r[a+3]-r[a+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],l=[s[0]*n/2,s[1]*n/2];t.beginPath(),t.moveTo(r[a]-l[0],r[a+1]-l[1]),t.lineTo(r[a]+l[0],r[a+1]+l[1]),t.lineTo(r[a+2],r[a+3]),t.closePath(),t.fill()}},dt.drawArrowheads=function(e,t,r){var n=t._private.rscratch,a="haystack"===n.edgeType;a||this.drawArrowhead(e,t,"source",n.arrowStartX,n.arrowStartY,n.srcArrowAngle,r),this.drawArrowhead(e,t,"mid-target",n.midX,n.midY,n.midtgtArrowAngle,r),this.drawArrowhead(e,t,"mid-source",n.midX,n.midY,n.midsrcArrowAngle,r),a||this.drawArrowhead(e,t,"target",n.arrowEndX,n.arrowEndY,n.tgtArrowAngle,r)},dt.drawArrowhead=function(e,t,r,n,a,i,o){if(!(isNaN(n)||null==n||isNaN(a)||null==a||isNaN(i))&&null!=i){var s=t.pstyle(r+"-arrow-shape").value;if("none"!==s){var l="hollow"===t.pstyle(r+"-arrow-fill").value?"both":"filled",u=t.pstyle(r+"-arrow-fill").value,c=t.pstyle("width").pfValue,d=t.pstyle(r+"-arrow-width"),h="match-line"===d.value?c:d.pfValue;"%"===d.units&&(h*=c);var f=t.pstyle("opacity").value;void 0===o&&(o=f);var p=e.globalCompositeOperation;(1!==o||"hollow"===u)&&(e.globalCompositeOperation="destination-out",this.colorFillStyle(e,255,255,255,1),this.colorStrokeStyle(e,255,255,255,1),this.drawArrowShape(t,e,l,c,s,h,n,a,i),e.globalCompositeOperation=p);var g=t.pstyle(r+"-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,u,c,s,h,n,a,i)}}},dt.drawArrowShape=function(e,t,r,n,a,i,o,s,l){var u,c=this.usePaths()&&"triangle-cross"!==a,d=!1,h=t,f=e.pstyle("arrow-scale").value,p=this.getArrowWidth(n,f),g=this.arrowShapes[a];if(c){var v=this.arrowPathCache=this.arrowPathCache||[],y=rh(a),x=v[y];null!=x?(u=t=x,d=!0):(u=t=new Path2D,v[y]=u)}!d&&(t.beginPath&&t.beginPath(),c?g.draw(t,1,0,{x:0,y:0},1):g.draw(t,p,l,{x:o,y:s},n),t.closePath&&t.closePath()),t=h,c&&(t.translate(o,s),t.rotate(l),t.scale(p,p)),("filled"===r||"both"===r)&&(c?t.fill(u):t.fill()),("hollow"===r||"both"===r)&&(t.lineWidth=i/(c?p:1),t.lineJoin="miter",c?t.stroke(u):t.stroke()),c&&(t.scale(1/p,1/p),t.rotate(-l),t.translate(-o,-s))};var dn={};dn.safeDrawImage=function(e,t,r,n,a,i,o,s,l,u){if(!(a<=0)&&!(i<=0)&&!(l<=0)&&!(u<=0))try{e.drawImage(t,r,n,a,i,o,s,l,u)}catch(e){rC(e)}},dn.drawInscribedImage=function(e,t,r,n,a){var i=r.position(),o=i.x,s=i.y,l=r.cy().style(),u=l.getIndexedStyle.bind(l),c=u(r,"background-fit","value",n),d=u(r,"background-repeat","value",n),h=r.width(),f=r.height(),p=2*r.padding(),g=h+("inner"===u(r,"background-width-relative-to","value",n)?0:p),v=f+("inner"===u(r,"background-height-relative-to","value",n)?0:p),y=r._private.rscratch,x="node"===u(r,"background-clip","value",n),b=u(r,"background-image-opacity","value",n)*a,w=u(r,"background-image-smoothing","value",n),j=r.pstyle("corner-radius").value;"auto"!==j&&(j=r.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"!==u(r,"background-width","value",n)&&(C="%"===u(r,"background-width","units",n)?u(r,"background-width","pfValue",n)*g:u(r,"background-width","pfValue",n)),"auto"!==u(r,"background-height","value",n)&&(E="%"===u(r,"background-height","units",n)?u(r,"background-height","pfValue",n)*v:u(r,"background-height","pfValue",n)),0!==C&&0!==E){if("contain"===c){var S=Math.min(g/C,v/E);C*=S,E*=S}else if("cover"===c){var S=Math.max(g/C,v/E);C*=S,E*=S}var T=o-g/2,P=u(r,"background-position-x","units",n),_=u(r,"background-position-x","pfValue",n);"%"===P?T+=(g-C)*_:T+=_;var D=u(r,"background-offset-x","units",n),B=u(r,"background-offset-x","pfValue",n);"%"===D?T+=(g-C)*B:T+=B;var M=s-v/2,A=u(r,"background-position-y","units",n),R=u(r,"background-position-y","pfValue",n);"%"===A?M+=(v-E)*R:M+=R;var I=u(r,"background-offset-y","units",n),L=u(r,"background-offset-y","pfValue",n);"%"===I?M+=(v-E)*L:M+=L,y.pathCache&&(T-=o,M-=s,o=0,s=0);var O=e.globalAlpha;e.globalAlpha=b;var z=this.getImgSmoothing(e),V=!1;if("no"===w&&z?(this.setImgSmoothing(e,!1),V=!0):"yes"!==w||z||(this.setImgSmoothing(e,!0),V=!0),"no-repeat"===d)x&&(e.save(),y.pathCache?e.clip(y.pathCache):(this.nodeShapes[this.getNodeShape(r)].draw(e,o,s,g,v,j,y),e.clip())),this.safeDrawImage(e,t,0,0,N,k,T,M,C,E),x&&e.restore();else{var F=e.createPattern(t,d);e.fillStyle=F,this.nodeShapes[this.getNodeShape(r)].draw(e,o,s,g,v,j,y),e.translate(T,M),e.fill(),e.translate(-T,-M)}e.globalAlpha=O,V&&this.setImgSmoothing(e,z)}};var da={};function di(e,t,r,n,a){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5,o=Math.min(i,n/2,a/2);e.beginPath(),e.moveTo(t+o,r),e.lineTo(t+n-o,r),e.quadraticCurveTo(t+n,r,t+n,r+o),e.lineTo(t+n,r+a-o),e.quadraticCurveTo(t+n,r+a,t+n-o,r+a),e.lineTo(t+o,r+a),e.quadraticCurveTo(t,r+a,t,r+a-o),e.lineTo(t,r+o),e.quadraticCurveTo(t,r,t+o,r),e.closePath()}da.eleTextBiggerThanMin=function(e,t){return t||(t=Math.pow(2,Math.ceil(r7(e.cy().zoom()*this.getPixelRatio())))),!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},da.drawElementText=function(e,t,r,n,a){var i,o=!(arguments.length>5)||void 0===arguments[5]||arguments[5];if(null==n){if(o&&!this.eleTextBiggerThanMin(t))return}else if(!1===n)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,u=t.pstyle("label"),c=t.pstyle("source-label"),d=t.pstyle("target-label");if(l||(!u||!u.value)&&(!c||!c.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var h=!r;r&&(i=r,e.translate(-i.x1,-i.y1)),null==a?(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,a,h,o),r&&e.translate(i.x1,i.y1)},da.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if((t=this.fontCaches[r]).context===e)return t;return t={context:e},this.fontCaches.push(t),t},da.setupTextStyle=function(e,t){var r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",i=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=r?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=n+" "+o+" "+a+" "+i,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},da.getTextAngle=function(e,t){var r,n=e._private.rscratch,a=t?t+"-":"",i=e.pstyle(a+"text-rotation");if("autorotate"===i.strValue){var o=rA(n,"labelAngle",t);r=e.isEdge()?o:0}else r="none"===i.strValue?0:i.pfValue;return r},da.drawText=function(e,t,r){var n=!(arguments.length>3)||void 0===arguments[3]||arguments[3],a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],i=t._private.rscratch,o=a?t.effectiveOpacity():1;if(!a||0!==o&&0!==t.pstyle("text-opacity").value){"main"===r&&(r=null);var s=rA(i,"labelX",r),l=rA(i,"labelY",r),u=this.getLabelText(t,r);if(null!=u&&""!==u&&!isNaN(s)&&!isNaN(l)){this.setupTextStyle(e,t,a);var c,d,h,f=r?r+"-":"",p=rA(i,"labelWidth",r),g=rA(i,"labelHeight",r),v=t.pstyle(f+"text-margin-x").pfValue,y=t.pstyle(f+"text-margin-y").pfValue,x=t.isEdge(),b=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(x&&(b="center",w="center"),s+=v,l+=y,0!==(h=n?this.getTextAngle(t,r):0)&&(c=s,d=l,e.translate(c,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,S="round-rectangle"===E||"roundrectangle"===E;if(j>0||k>0&&N>0){var T,P,_=e.fillStyle,D=e.strokeStyle,B=e.lineWidth,M=t.pstyle("text-background-color").value,A=t.pstyle("text-border-color").value,R=t.pstyle("text-border-style").value,I=j>0,L=k>0&&N>0,O=s-C;switch(b){case"left":O-=p;break;case"center":O-=p/2}var z=l-g-C,V=p+2*C,F=g+2*C;if(I&&(e.fillStyle="rgba(".concat(M[0],",").concat(M[1],",").concat(M[2],",").concat(j*o,")")),L&&(e.strokeStyle="rgba(".concat(A[0],",").concat(A[1],",").concat(A[2],",").concat(N*o,")"),e.lineWidth=k,e.setLineDash))switch(R){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(S?(e.beginPath(),di(e,O,z,V,F,2)):"circle"===E?(e.beginPath(),T=O,P=Math.min(V,F),e.beginPath(),e.arc(T+V/2,z+F/2,P/2,0,2*Math.PI),e.closePath()):(e.beginPath(),e.rect(O,z,V,F)),I&&e.fill(),L&&e.stroke(),L&&"double"===R){var H=k/2;e.beginPath(),S?di(e,O+H,z+H,V-2*H,F-2*H,2):e.rect(O+H,z+H,V-2*H,F-2*H),e.stroke()}e.fillStyle=_,e.strokeStyle=D,e.lineWidth=B,e.setLineDash&&e.setLineDash([])}var q=2*t.pstyle("text-outline-width").pfValue;if(q>0&&(e.lineWidth=q),"wrap"===t.pstyle("text-wrap").value){var X=rA(i,"labelWrapCachedLines",r),Y=rA(i,"labelLineHeight",r),W=p/2,U=this.getLabelJustification(t);switch("auto"===U||("left"===b?"left"===U?s+=-p:"center"===U&&(s+=-W):"center"===b?"left"===U?s+=-W:"right"===U&&(s+=W):"right"===b&&("center"===U?s+=W:"right"===U&&(s+=p))),w){case"top":case"center":case"bottom":l-=(X.length-1)*Y}for(var $=0;$<X.length;$++)q>0&&e.strokeText(X[$],s,l),e.fillText(X[$],s,l),l+=Y}else q>0&&e.strokeText(u,s,l),e.fillText(u,s,l);0!==h&&(e.rotate(-h),e.translate(-c,-d))}}};var ds={};ds.drawNode=function(e,t,r){var n,a,i,o,s=!(arguments.length>3)||void 0===arguments[3]||arguments[3],l=!(arguments.length>4)||void 0===arguments[4]||arguments[4],u=!(arguments.length>5)||void 0===arguments[5]||arguments[5],c=this,d=t._private,h=d.rscratch,f=t.position();if(tP(f.x)&&tP(f.y)&&(!u||t.visible())){var p=u?t.effectiveOpacity():1,g=c.usePaths(),v=!1,y=t.padding();n=t.width()+2*y,a=t.height()+2*y,r&&(o=r,e.translate(-o.x1,-o.y1));for(var x=t.pstyle("background-image").value,b=Array(x.length),w=Array(x.length),j=0,N=0;N<x.length;N++){var k=x[N];if(b[N]=null!=k&&"none"!==k){var C=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",N);j++,w[N]=c.getCachedImage(k,C,function(){d.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var E=t.pstyle("background-blacken").value,S=t.pstyle("border-width").pfValue,T=t.pstyle("background-opacity").value*p,P=t.pstyle("border-color").value,_=t.pstyle("border-style").value,D=t.pstyle("border-join").value,B=t.pstyle("border-cap").value,M=t.pstyle("border-position").value,A=t.pstyle("border-dash-pattern").pfValue,R=t.pstyle("border-dash-offset").pfValue,I=t.pstyle("border-opacity").value*p,L=t.pstyle("outline-width").pfValue,O=t.pstyle("outline-color").value,z=t.pstyle("outline-style").value,V=t.pstyle("outline-opacity").value*p,F=t.pstyle("outline-offset").value,H=t.pstyle("corner-radius").value;"auto"!==H&&(H=t.pstyle("corner-radius").pfValue);var q=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:T;c.eleFillStyle(e,t,r)},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:I;c.colorStrokeStyle(e,P[0],P[1],P[2],t)},Y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:V;c.colorStrokeStyle(e,O[0],O[1],O[2],t)},W=function(e,t,r,n){var a,i=c.nodePathCache=c.nodePathCache||[],o=rf("polygon"===r?r+","+n.join(","):r,""+t,""+e,""+H),s=i[o],l=!1;return null!=s?(l=!0,h.pathCache=a=s):(a=new Path2D,i[o]=h.pathCache=a),{path:a,cacheHit:l}},U=t.pstyle("shape").strValue,$=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(f.x,f.y);var K=W(n,a,U,$);i=K.path,v=K.cacheHit}var G=function(){if(!v){var r=f;g&&(r={x:0,y:0}),c.nodeShapes[c.getNodeShape(t)].draw(i||e,r.x,r.y,n,a,H,h)}g?e.fill(i):e.fill()},Z=function(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],a=d.backgrounding,i=0,o=0;o<w.length;o++){var s=t.cy().style().getIndexedStyle(t,"background-image-containment","value",o);if(n&&"over"===s||!n&&"inside"===s){i++;continue}b[o]&&w[o].complete&&!w[o].error&&(i++,c.drawInscribedImage(e,w[o],t,o,r))}d.backgrounding=i!==j,a!==d.backgrounding&&t.updateStyle(!1)},Q=function(){var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;c.hasPie(t)&&(c.drawPie(e,t,i),r&&!g&&c.nodeShapes[c.getNodeShape(t)].draw(e,f.x,f.y,n,a,H,h))},J=function(){var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;c.hasStripe(t)&&(e.save(),g?e.clip(h.pathCache):(c.nodeShapes[c.getNodeShape(t)].draw(e,f.x,f.y,n,a,H,h),e.clip()),c.drawStripe(e,t,i),e.restore(),r&&!g&&c.nodeShapes[c.getNodeShape(t)].draw(e,f.x,f.y,n,a,H,h))},ee=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,r=E>0?0:255;0!==E&&(c.colorFillStyle(e,r,r,r,(E>0?E:-E)*t),g?e.fill(i):e.fill())},et=function(){if(S>0){if(e.lineWidth=S,e.lineCap=B,e.lineJoin=D,e.setLineDash)switch(_){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(A),e.lineDashOffset=R;break;case"solid":case"double":e.setLineDash([])}if("center"!==M){if(e.save(),e.lineWidth*=2,"inside"===M)g?e.clip(i):e.clip();else{var t=new Path2D;t.rect(-n/2-S,-a/2-S,n+2*S,a+2*S),t.addPath(i),e.clip(t,"evenodd")}g?e.stroke(i):e.stroke(),e.restore()}else g?e.stroke(i):e.stroke();if("double"===_){e.lineWidth=S/3;var r=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(i):e.stroke(),e.globalCompositeOperation=r}e.setLineDash&&e.setLineDash([])}},er=function(){if(L>0){if(e.lineWidth=L,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 r=f;g&&(r={x:0,y:0});var i=c.getNodeShape(t),o=S;"inside"===M&&(o=0),"outside"===M&&(o*=2);var s=(n+o+(L+F))/n,l=(a+o+(L+F))/a,u=n*s,d=a*l,h=c.nodeShapes[i].points;if(g&&(C=W(u,d,i,h).path),"ellipse"===i)c.drawEllipsePath(C||e,r.x,r.y,u,d);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(i)){var p=0,v=0,y=0;"round-diamond"===i?p=(o+F+L)*1.4:"round-heptagon"===i?(p=(o+F+L)*1.075,y=-(o/2+F+L)/35):"round-hexagon"===i?p=(o+F+L)*1.12:"round-pentagon"===i?(p=(o+F+L)*1.13,y=-(o/2+F+L)/15):"round-tag"===i?(p=(o+F+L)*1.12,v=(o/2+L+F)*.07):"round-triangle"===i&&(p=Math.PI/2*(o+F+L),y=-(o+F/2+L)/Math.PI),0!==p&&(s=(n+p)/n,u=n*s,["round-hexagon","round-tag"].includes(i)||(l=(a+p)/a,d=a*l)),H="auto"===H?nq(u,d):H;for(var x=u/2,b=d/2,w=H+(o+L+F)/2,j=Array(h.length/2),N=Array(h.length/2),k=0;k<h.length/2;k++)j[k]={x:r.x+v+x*h[2*k],y:r.y+y+b*h[2*k+1]};var C,E,T,P,_,D=j.length;for(E=0,T=j[D-1];E<D;E++)P=j[E%D],_=j[(E+1)%D],N[E]=cb(T,P,_,w),T=P,P=_;c.drawRoundPolygonPath(C||e,r.x+v,r.y+y,n*s,a*l,h,N)}else["roundrectangle","round-rectangle"].includes(i)?(H="auto"===H?nH(u,d):H,c.drawRoundRectanglePath(C||e,r.x,r.y,u,d,H+(o+L+F)/2)):["cutrectangle","cut-rectangle"].includes(i)?(H="auto"===H?nX():H,c.drawCutRectanglePath(C||e,r.x,r.y,u,d,null,H+(o+L+F)/4)):["bottomroundrectangle","bottom-round-rectangle"].includes(i)?(H="auto"===H?nH(u,d):H,c.drawBottomRoundRectanglePath(C||e,r.x,r.y,u,d,H+(o+L+F)/2)):"barrel"===i?c.drawBarrelPath(C||e,r.x,r.y,u,d):(h=i.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(i)?nT(nP(h,(o+L+F)/n)):nT(nP(h,-((o+L+F)/n))),c.drawPolygonPath(C||e,r.x,r.y,n,a,h));if(g?e.stroke(C):e.stroke(),"double"===z){e.lineWidth=o/3;var B=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(C):e.stroke(),e.globalCompositeOperation=B}e.setLineDash&&e.setLineDash([])}};if("yes"===t.pstyle("ghost").value){var en=t.pstyle("ghost-offset-x").pfValue,ea=t.pstyle("ghost-offset-y").pfValue,ei=t.pstyle("ghost-opacity").value,eo=ei*p;e.translate(en,ea),Y(),er(),q(ei*T),G(),Z(eo,!0),X(ei*I),et(),Q(0!==E||0!==S),J(0!==E||0!==S),Z(eo,!1),ee(eo),e.translate(-en,-ea)}g&&e.translate(-f.x,-f.y),l&&c.drawNodeUnderlay(e,t,f,n,a),g&&e.translate(f.x,f.y),Y(),er(),q(),G(),Z(p,!0),X(),et(),Q(0!==E||0!==S),J(0!==E||0!==S),Z(p,!1),ee(),g&&e.translate(-f.x,-f.y),c.drawElementText(e,t,null,s),l&&c.drawNodeOverlay(e,t,f,n,a),r&&e.translate(o.x1,o.y1)}};var dl=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,r,n,a,i){if(r.visible()){var o=r.pstyle("".concat(e,"-padding")).pfValue,s=r.pstyle("".concat(e,"-opacity")).value,l=r.pstyle("".concat(e,"-color")).value,u=r.pstyle("".concat(e,"-shape")).value,c=r.pstyle("".concat(e,"-corner-radius")).value;if(s>0){if(n=n||r.position(),null==a||null==i){var d=r.padding();a=r.width()+2*d,i=r.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,n.x,n.y,a+2*o,i+2*o,c),t.fill()}}}};ds.drawNodeOverlay=dl("overlay"),ds.drawNodeUnderlay=dl("underlay"),ds.hasPie=function(e){return(e=e[0])._private.hasPie},ds.hasStripe=function(e){return(e=e[0])._private.hasStripe},ds.drawPie=function(e,t,r,n){t=t[0],n=n||t.position();var a,i=t.cy().style(),o=t.pstyle("pie-size"),s=t.pstyle("pie-hole"),l=t.pstyle("pie-start-angle").pfValue,u=n.x,c=n.y,d=Math.min(t.width(),t.height())/2,h=0;if(this.usePaths()&&(u=0,c=0),"%"===o.units?d*=o.pfValue:void 0!==o.pfValue&&(d=o.pfValue/2),"%"===s.units?a=d*s.pfValue:void 0!==s.pfValue&&(a=s.pfValue/2),!(a>=d))for(var f=1;f<=i.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*r,y=p/100;y+h>1&&(y=1-h);var x=1.5*Math.PI+2*Math.PI*h,b=2*Math.PI*y,w=(x+=l)+b;0===p||h>=1||h+y>1||(0===a?(e.beginPath(),e.moveTo(u,c),e.arc(u,c,d,x,w)):(e.beginPath(),e.arc(u,c,d,x,w),e.arc(u,c,a,w,x,!0)),e.closePath(),this.colorFillStyle(e,g[0],g[1],g[2],v),e.fill(),h+=y)}},ds.drawStripe=function(e,t,r,n){t=t[0],n=n||t.position();var a=t.cy().style(),i=n.x,o=n.y,s=t.width(),l=t.height(),u=0,c=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),c&&(i=0,o=0),o-=f/2,i-=p/2;for(var g=1;g<=a.stripeBackgroundN;g++){var v=t.pstyle("stripe-"+g+"-background-size").value,y=t.pstyle("stripe-"+g+"-background-color").value,x=t.pstyle("stripe-"+g+"-background-opacity").value*r,b=v/100;b+u>1&&(b=1-u),0===v||u>=1||u+b>1||(e.beginPath(),e.rect(i,o+p*u,f,p*b),e.closePath(),this.colorFillStyle(e,y[0],y[1],y[2],x),e.fill(),u+=b)}e.restore()};var du={};function dc(e,t,r){var n=e.createShader(t);if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS))throw Error(e.getShaderInfoLog(n));return n}function dd(e,t,r){void 0===r&&(r=t);var n=e.makeOffscreenCanvas(t,r),a=n.context=n.getContext("2d");return n.clear=function(){return a.clearRect(0,0,n.width,n.height)},n.clear(),n}function dh(e){var t=e.pixelRatio,r=e.cy.zoom(),n=e.cy.pan();return{zoom:r*t,pan:{x:n.x*t,y:n.y*t}}}function df(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 dp(e,t,r){var n=e[0]/255,a=e[1]/255,i=e[2]/255,o=r||[,,,,];return o[0]=n*t,o[1]=a*t,o[2]=i*t,o[3]=t,o}function dg(e,t){var r=t||[,,,,];return r[0]=(255&e)/255,r[1]=(e>>8&255)/255,r[2]=(e>>16&255)/255,r[3]=(e>>24&255)/255,r}function dm(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 dv(e,t,r){switch(t){case e.FLOAT:return new Float32Array(r);case e.INT:return new Int32Array(r)}}function dy(e,t,r,n){var a=tf(dm(e,r),3),i=a[0],o=a[1],s=a[2],l=dv(e,o,t*i),u=i*s,c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,t*u,e.DYNAMIC_DRAW),e.enableVertexAttribArray(n),o===e.FLOAT?e.vertexAttribPointer(n,i,o,!1,u,0):o===e.INT&&e.vertexAttribIPointer(n,i,o,u,0),e.vertexAttribDivisor(n,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var d=Array(t),h=0;h<t;h++)d[h]=function(e,t,r,n,a,i){switch(t){case e.FLOAT:return new Float32Array(r.buffer,i*n,a);case e.INT:return new Int32Array(r.buffer,i*n,a)}}(e,o,l,u,i,h);return c.dataArray=l,c.stride=u,c.size=i,c.getView=function(e){return d[e]},c.setPoint=function(e,t,r){var n=d[e];n[0]=t,n[1]=r},c.bufferSubData=function(t){e.bindBuffer(e.ARRAY_BUFFER,c),t?e.bufferSubData(e.ARRAY_BUFFER,0,l,0,t*i):e.bufferSubData(e.ARRAY_BUFFER,0,l)},c}du.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=this.cy.window(),r=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/r},du.paintCache=function(e){for(var t,r=this.paintCaches=this.paintCaches||[],n=!0,a=0;a<r.length;a++)if((t=r[a]).context===e){n=!1;break}return n&&(t={context:e},r.push(t)),t},du.createGradientStyleFor=function(e,t,r,n,a){var i,o=this.usePaths(),s=r.pstyle(t+"-gradient-stop-colors").value,l=r.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===n)if(r.isEdge()){var u=r.sourceEndpoint(),c=r.targetEndpoint(),d=r.midpoint(),h=r8(u,d),f=r8(c,d);i=e.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(h,f))}else{var p=o?{x:0,y:0}:r.position(),g=r.paddedWidth(),v=r.paddedHeight();i=e.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(g,v))}else if(r.isEdge()){var y=r.sourceEndpoint(),x=r.targetEndpoint();i=e.createLinearGradient(y.x,y.y,x.x,x.y)}else{var b=o?{x:0,y:0}:r.position(),w=r.paddedWidth(),j=r.paddedHeight(),N=w/2,k=j/2;switch(r.pstyle("background-gradient-direction").value){case"to-bottom":i=e.createLinearGradient(b.x,b.y-k,b.x,b.y+k);break;case"to-top":i=e.createLinearGradient(b.x,b.y+k,b.x,b.y-k);break;case"to-left":i=e.createLinearGradient(b.x+N,b.y,b.x-N,b.y);break;case"to-right":i=e.createLinearGradient(b.x-N,b.y,b.x+N,b.y);break;case"to-bottom-right":case"to-right-bottom":i=e.createLinearGradient(b.x-N,b.y-k,b.x+N,b.y+k);break;case"to-top-right":case"to-right-top":i=e.createLinearGradient(b.x-N,b.y+k,b.x+N,b.y-k);break;case"to-bottom-left":case"to-left-bottom":i=e.createLinearGradient(b.x+N,b.y-k,b.x-N,b.y+k);break;case"to-top-left":case"to-left-top":i=e.createLinearGradient(b.x+N,b.y+k,b.x-N,b.y-k)}}if(!i)return null;for(var C=l.length===s.length,E=s.length,S=0;S<E;S++)i.addColorStop(C?l[S]:S/(E-1),"rgba("+s[S][0]+","+s[S][1]+","+s[S][2]+","+a+")");return i},du.gradientFillStyle=function(e,t,r,n){var a=this.createGradientStyleFor(e,"background",t,r,n);if(!a)return null;e.fillStyle=a},du.colorFillStyle=function(e,t,r,n,a){e.fillStyle="rgba("+t+","+r+","+n+","+a+")"},du.eleFillStyle=function(e,t,r){var n=t.pstyle("background-fill").value;if("linear-gradient"===n||"radial-gradient"===n)this.gradientFillStyle(e,t,n,r);else{var a=t.pstyle("background-color").value;this.colorFillStyle(e,a[0],a[1],a[2],r)}},du.gradientStrokeStyle=function(e,t,r,n){var a=this.createGradientStyleFor(e,"line",t,r,n);if(!a)return null;e.strokeStyle=a},du.colorStrokeStyle=function(e,t,r,n,a){e.strokeStyle="rgba("+t+","+r+","+n+","+a+")"},du.eleStrokeStyle=function(e,t,r){var n=t.pstyle("line-fill").value;if("linear-gradient"===n||"radial-gradient"===n)this.gradientStrokeStyle(e,t,n,r);else{var a=t.pstyle("line-color").value;this.colorStrokeStyle(e,a[0],a[1],a[2],r)}},du.matchCanvasSize=function(e){var t,r=this.data,n=this.findContainerClientCoords(),a=n[2],i=n[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=a*o,u=i*o;if(l!==this.canvasWidth||u!==this.canvasHeight){this.fontCaches=null;var c=r.canvasContainer;c.style.width=a+"px",c.style.height=i+"px";for(var d=0;d<this.CANVAS_LAYERS;d++)(t=r.canvases[d]).width=l,t.height=u,t.style.width=a+"px",t.style.height=i+"px";for(var d=0;d<this.BUFFER_COUNT;d++)(t=r.bufferCanvases[d]).width=l,t.height=u,t.style.width=a+"px",t.style.height=i+"px";this.textureMult=1,o<=1&&(t=r.bufferCanvases[this.TEXTURE_BUFFER],this.textureMult=2,t.width=l*this.textureMult,t.height=u*this.textureMult),this.canvasWidth=l,this.canvasHeight=u,this.pixelRatio=o}},du.renderTo=function(e,t,r,n){this.render({forcedContext:e,forcedZoom:t,forcedPan:r,drawAllLayers:!0,forcedPxRatio:n})},du.clearCanvas=function(){var e=this,t=e.data;function r(t){t.clearRect(0,0,e.canvasWidth,e.canvasHeight)}r(t.contexts[e.NODE]),r(t.contexts[e.DRAG])},du.render=function(e){var t=this;e=e||rP();var r=t.cy,n=e.forcedContext,a=e.drawAllLayers,i=e.drawOnlyNodeLayer,o=e.forcedZoom,s=e.forcedPan,l=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,u=t.data,c=u.canvasNeedsRedraw,d=t.textureOnViewport&&!n&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),h=void 0!==e.motionBlur?e.motionBlur:t.motionBlur,f=t.motionBlurPxRatio,p=r.hasCompoundNodes(),g=t.hoverData.draggingEles,v=!!t.hoverData.selecting||!!t.touchData.selecting,y=h=h&&!n&&t.motionBlurEnabled&&!v;n||(t.prevPxRatio!==l&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint("eles",!0),t.redrawHint("drag",!0)),t.prevPxRatio=l),!n&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),h&&(null==t.mbFrames&&(t.mbFrames=0),t.mbFrames++,t.mbFrames<3&&(y=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!d&&(c[t.NODE]=!0,c[t.SELECT_BOX]=!0);var x=r.style(),b=r.zoom(),w=void 0!==o?o:b,j=r.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 S(e,r,n,a,i){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(r,n,a,i),e.globalCompositeOperation=o}function T(e,r){var i,l,c,d;t.clearingMotionBlur||e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(i=N,l=w,c=t.canvasWidth,d=t.canvasHeight):(i={x:j.x*f,y:j.y*f},l=b*f,c=t.canvasWidth*f,d=t.canvasHeight*f),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?S(e,0,0,c,d):!n&&(void 0===r||r)&&e.clearRect(0,0,c,d),a||(e.translate(i.x,i.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=r.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var P=t.data.bufferContexts[t.TEXTURE_BUFFER];P.setTransform(1,0,0,1,0,0),P.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:P,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult});var k=t.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:t.canvasWidth,height:t.canvasHeight};k.mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var _=u.contexts[t.NODE],D=t.textureCache.texture,k=t.textureCache.viewport;_.setTransform(1,0,0,1,0,0),h?S(_,0,0,k.width,k.height):_.clearRect(0,0,k.width,k.height);var B=x.core("outside-texture-bg-color").value,M=x.core("outside-texture-bg-opacity").value;t.colorFillStyle(_,B[0],B[1],B[2],M),_.fillRect(0,0,k.width,k.height);var b=r.zoom();T(_,!1),_.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l),_.drawImage(D,k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l)}else t.textureOnViewport&&!n&&(t.textureCache=null);var A=r.extent(),R=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),I=t.hideEdgesOnViewport&&R,L=[];if(L[t.NODE]=!c[t.NODE]&&h&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,L[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),L[t.DRAG]=!c[t.DRAG]&&h&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,L[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||a||i||L[t.NODE]){var O=h&&!L[t.NODE]&&1!==f,_=n||(O?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:u.contexts[t.NODE]);T(_,h&&!O?"motionBlur":void 0),I?t.drawCachedNodes(_,E.nondrag,l,A):t.drawLayeredElements(_,E.nondrag,l,A),t.debug&&t.drawDebugPoints(_,E.nondrag),a||h||(c[t.NODE]=!1)}if(!i&&(c[t.DRAG]||a||L[t.DRAG])){var O=h&&!L[t.DRAG]&&1!==f,_=n||(O?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:u.contexts[t.DRAG]);T(_,h&&!O?"motionBlur":void 0),I?t.drawCachedNodes(_,E.drag,l,A):t.drawCachedElements(_,E.drag,l,A),t.debug&&t.drawDebugPoints(_,E.drag),a||h||(c[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,T),h&&1!==f){var z=u.contexts[t.NODE],V=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],F=u.contexts[t.DRAG],H=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],q=function(e,r,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):S(e,0,0,t.canvasWidth,t.canvasHeight),e.drawImage(r,0,0,t.canvasWidth*f,t.canvasHeight*f,0,0,t.canvasWidth,t.canvasHeight)};(c[t.NODE]||L[t.NODE])&&(q(z,V,L[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||L[t.DRAG])&&(q(F,H,L[t.DRAG]),c[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,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()},100)),n||r.emit("render")},du.drawSelectionRectangle=function(e,t){var r=this.cy,n=this.data,a=r.style(),i=e.drawOnlyNodeLayer,o=e.drawAllLayers,s=n.canvasNeedsRedraw,l=e.forcedContext;if(this.showFps||!i&&s[this.SELECT_BOX]&&!o){var u=l||n.contexts[this.SELECT_BOX];if(t(u),1==this.selection[4]&&(this.hoverData.selecting||this.touchData.selecting)){var d=this.cy.zoom(),h=a.core("selection-box-border-width").value/d;u.lineWidth=h,u.fillStyle="rgba("+a.core("selection-box-color").value[0]+","+a.core("selection-box-color").value[1]+","+a.core("selection-box-color").value[2]+","+a.core("selection-box-opacity").value+")",u.fillRect(this.selection[0],this.selection[1],this.selection[2]-this.selection[0],this.selection[3]-this.selection[1]),h>0&&(u.strokeStyle="rgba("+a.core("selection-box-border-color").value[0]+","+a.core("selection-box-border-color").value[1]+","+a.core("selection-box-border-color").value[2]+","+a.core("selection-box-opacity").value+")",u.strokeRect(this.selection[0],this.selection[1],this.selection[2]-this.selection[0],this.selection[3]-this.selection[1]))}if(n.bgActivePosistion&&!this.hoverData.selecting){var d=this.cy.zoom(),f=n.bgActivePosistion;u.fillStyle="rgba("+a.core("active-bg-color").value[0]+","+a.core("active-bg-color").value[1]+","+a.core("active-bg-color").value[2]+","+a.core("active-bg-opacity").value+")",u.beginPath(),u.arc(f.x,f.y,a.core("active-bg-size").pfValue/d,0,2*Math.PI),u.fill()}var p=this.lastRedrawTime;if(this.showFps&&p){var g=Math.round(1e3/(p=Math.round(p))),v="1 frame = "+p+" ms = "+g+" fps";u.setTransform(1,0,0,1,0,0),u.fillStyle="rgba(255, 0, 0, 0.75)",u.strokeStyle="rgba(255, 0, 0, 0.75)",u.font="30px Arial",c||(c=u.measureText(v).actualBoundingBoxAscent),u.fillText(v,0,c),u.strokeRect(0,c+10,250,20),u.fillRect(0,c+10,250*Math.min(g/60,1),20)}o||(s[this.SELECT_BOX]=!1)}};var dx="undefined"!=typeof Float32Array?Float32Array:Array;function db(){var e=new dx(9);return dx!=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 dw(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 dj(e,t,r){var n=t[0],a=t[1],i=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],h=r[0],f=r[1];return e[0]=n,e[1]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=l,e[6]=h*n+f*o+u,e[7]=h*a+f*s+c,e[8]=h*i+f*l+d,e}function dN(e,t,r){var n=t[0],a=t[1],i=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],h=Math.sin(r),f=Math.cos(r);return e[0]=f*n+h*o,e[1]=f*a+h*s,e[2]=f*i+h*l,e[3]=f*o-h*n,e[4]=f*s-h*a,e[5]=f*l-h*i,e[6]=u,e[7]=c,e[8]=d,e}function dk(e,t,r){var n=r[0],a=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*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 dC=tc(function e(t,r,n,a){tu(this,e),this.debugID=Math.floor(1e4*Math.random()),this.r=t,this.texSize=r,this.texRows=n,this.texHeight=Math.floor(r/n),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=a(t,r,r),this.scratch=a(t,r,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,r=e.h,n=this.texHeight,a=this.texSize,i=n/r,o=t*i,s=r*i;return o>a&&(i=a/t,o=t*i,s=r*i),{scale:i,texW:o,texH:s}}},{key:"draw",value:function(e,t,r){var n,a,i,o,s,l,u,c=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,y=p.texH,x=function(e,n){if(r&&n){var a=n.context,i=e.x,o=f*e.row;a.save(),a.translate(i,o),a.scale(g,g),r(a,t),a.restore()}},b=[null,null],w=function(){x(c.freePointer,c.canvas),b[0]={x:c.freePointer.x,y:c.freePointer.row*f,w:v,h:y},b[1]={x:c.freePointer.x+v,y:c.freePointer.row*f,w:0,h:y},c.freePointer.x+=v,c.freePointer.x==d&&(c.freePointer.x=0,c.freePointer.row++)},j=function(){c.freePointer.x=0,c.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?(n=c.scratch,a=c.canvas,n.clear(),x({x:0,row:0},n),o=v-(i=d-c.freePointer.x),s=c.freePointer.x,l=c.freePointer.row*f,a.context.drawImage(n,0,0,i,f,s,l,i,f),b[0]={x:s,y:l,w:i,h:y},u=(c.freePointer.row+1)*f,a&&a.context.drawImage(n,i,0,o,f,0,u,o,f),b[1]={x:0,y:u,w:o,h:y},c.freePointer.x=o,c.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,r=this.texRows,n=this.getScale(e).texW;return!(this.freePointer.x+n>t)||this.freePointer.row<r-1}},{key:"bufferIfNeeded",value:function(e){var t;this.texture||(this.texture=(this.debugID,(t=e.createTexture()).buffer=function(r){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,r),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}}]),dE=tc(function e(t,r,n,a){tu(this,e),this.r=t,this.texSize=r,this.texRows=n,this.createTextureCanvas=a,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 dC(this.r,this.texSize,this.texRows,this.createTextureCanvas)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var e=this.r,t=this.texSize,r=this.texRows,n=this.createTextureCanvas,a=Math.floor(t/r);this.scratch=n(e,t,a,"scratch")}return this.scratch}},{key:"draw",value:function(e,t,r){var n=this.styleKeyToAtlas.get(e);return n||((n=this.atlases[this.atlases.length-1])&&n.canFit(t)||(n&&n.lock(),n=this._createAtlas(),this.atlases.push(n)),n.draw(e,t,r),this.styleKeyToAtlas.set(e,n)),n}},{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 r,n=[],a=new Map,i=null,o=td(this.atlases);try{for(o.s();!(r=o.n()).done;)if(function(){var o=r.value,s=o.getKeys(),l=function(e,t){return e.intersection?e.intersection(t):new Set(tp(e).filter(function(e){return t.has(e)}))}(t,s);if(0===l.size)return n.push(o),s.forEach(function(e){return a.set(e,o)}),1;i||(i=e._createAtlas(),n.push(i));var u,c=td(s);try{for(c.s();!(u=c.n()).done;){var d=u.value;if(!l.has(d)){var h=o.getOffsets(d),f=tf(h,2),p=f[0],g=f[1];i.canFit({w:p.w+g.w,h:p.h})||(i.lock(),i=e._createAtlas(),n.push(i)),o.canvas&&(e._copyTextureToNewAtlas(d,o,i),a.set(d,i))}}}catch(e){c.e(e)}finally{c.f()}o.dispose()}())continue}catch(e){o.e(e)}finally{o.f()}this.atlases=n,this.styleKeyToAtlas=a,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(e,t,r){var n=tf(t.getOffsets(e),2),a=n[0],i=n[1];if(0===i.w)r.draw(e,a,function(e){e.drawImage(t.canvas,a.x,a.y,a.w,a.h,0,0,a.w,a.h)});else{var o=this._getScratchCanvas();o.clear(),o.context.drawImage(t.canvas,a.x,a.y,a.w,a.h,0,0,a.w,a.h),o.context.drawImage(t.canvas,i.x,i.y,i.w,i.h,a.w,0,i.w,i.h);var s=a.w+i.w,l=a.h;r.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}}}]),dS=tc(function e(t,r){tu(this,e),this.r=t,this.globalOptions=r,this.atlasSize=r.webglTexSize,this.maxAtlasesPerBatch=r.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 r=this.globalOptions,n=r.webglTexSize,a=r.createTextureCanvas,i=t.texRows,o=this._cacheScratchCanvas(a),s=new dE(this.r,n,i,o);this.collections.set(e,s)}},{key:"addRenderType",value:function(e,t){var r=t.collection;if(!this.collections.has(r))throw Error("invalid atlas collection name '".concat(r,"'"));var n=tG({type:e,atlasCollection:this.collections.get(r)},t);this.renderTypes.set(e,n)}},{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,r=-1,n=null;return function(a,i,o,s){return s?(n&&i==t&&o==r||(t=i,r=o,n=e(a,i,o)),n):e(a,i,o)}}},{key:"_key",value:function(e,t){return"".concat(e,"-").concat(t)}},{key:"invalidate",value:function(e){var t,r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.forceRedraw,i=void 0!==a&&a,o=n.filterEle,s=void 0===o?function(){return!0}:o,l=n.filterType,u=void 0===l?function(){return!0}:l,c=!1,d=!1,h=td(e);try{for(h.s();!(t=h.n()).done;){var f=t.value;if(s(f)){var p,g=td(this.renderTypes.values());try{for(g.s();!(p=g.n()).done;)!function(){var e=p.value,t=e.type;if(u(t)){var n=r.collections.get(e.collection),a=e.getKey(f),o=Array.isArray(a)?a:[a];if(i)o.forEach(function(e){return n.markKeyForGC(e)}),d=!0;else{var s=e.getID?e.getID(f):f.id(),l=r._key(t,s),h=r.typeAndIdToKey.get(l);void 0!==h&&!function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(o,h)&&(c=!0,r.typeAndIdToKey.delete(l),h.forEach(function(e){return n.markKeyForGC(e)}))}}}()}catch(e){g.e(e)}finally{g.f()}}}}catch(e){h.e(e)}finally{h.f()}return d&&(this.gc(),c=!1),c}},{key:"gc",value:function(){var e,t=td(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,r,n){var a=this.renderTypes.get(t),i=this.collections.get(a.collection),o=!1,s=i.draw(n,r,function(t){a.drawClipped?(t.save(),t.beginPath(),t.rect(0,0,r.w,r.h),t.clip(),a.drawElement(t,e,r,!0,!0),t.restore()):a.drawElement(t,e,r,!0,!0),o=!0});if(o){var l=a.getID?a.getID(e):e.id(),u=this._key(t,l);this.typeAndIdToKey.has(u)?this.typeAndIdToKey.get(u).push(n):this.typeAndIdToKey.set(u,[n])}return s}},{key:"getAtlasInfo",value:function(e,t){var r=this,n=this.renderTypes.get(t),a=n.getKey(e);return(Array.isArray(a)?a:[a]).map(function(a){var i=n.getBoundingBox(e,a),o=r.getOrCreateAtlas(e,t,i,a),s=tf(o.getOffsets(a),2),l=s[0];return{atlas:o,tex:l,tex1:l,tex2:s[1],bb:i}})}},{key:"getDebugInfo",value:function(){var e,t=[],r=td(this.collections);try{for(r.s();!(e=r.n()).done;){var n=tf(e.value,2),a=n[0],i=n[1].getCounts(),o=i.keyCount,s=i.atlasCount;t.push({type:a,keyCount:o,atlasCount:s})}}catch(e){r.e(e)}finally{r.f()}return t}}]),dT=tc(function e(t){tu(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}}]),dP={name:"screen",screen:!0},d_={name:"picking",picking:!0},dD=tc(function e(t,r,n){tu(this,e),this.r=t,this.gl=r,this.maxInstances=n.webglBatchSize,this.atlasSize=n.webglTexSize,this.bgColor=n.bgColor,this.debug=n.webglDebug,this.batchDebugInfo=[],n.enableWrapping=!0,n.createTextureCanvas=dd,this.atlasManager=new dS(t,n),this.batchManager=new dT(n),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(dP),this.pickingProgram=this._createShaderProgram(d_),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]:{},r=t.type,n=this.atlasManager;return r?n.invalidate(e,{filterType:function(e){return e===r},forceRedraw:!0}):n.invalidate(e)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(e){var t=this.gl,r="#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 "),n=this.batchManager.getIndexArray(),a=function(e,t,r){var n=dc(e,e.VERTEX_SHADER,t),a=dc(e,e.FRAGMENT_SHADER,r),i=e.createProgram();if(e.attachShader(i,n),e.attachShader(i,a),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw Error("Could not initialize shaders");return i}(t,r,"#version 300 es\n precision highp float;\n\n // declare texture unit for each texture atlas in the batch\n ".concat(n.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(n.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 "));a.aPosition=t.getAttribLocation(a,"aPosition"),a.aIndex=t.getAttribLocation(a,"aIndex"),a.aVertType=t.getAttribLocation(a,"aVertType"),a.aTransform=t.getAttribLocation(a,"aTransform"),a.aAtlasId=t.getAttribLocation(a,"aAtlasId"),a.aTex=t.getAttribLocation(a,"aTex"),a.aPointAPointB=t.getAttribLocation(a,"aPointAPointB"),a.aPointCPointD=t.getAttribLocation(a,"aPointCPointD"),a.aLineWidth=t.getAttribLocation(a,"aLineWidth"),a.aColor=t.getAttribLocation(a,"aColor"),a.aCornerRadius=t.getAttribLocation(a,"aCornerRadius"),a.aBorderColor=t.getAttribLocation(a,"aBorderColor"),a.uPanZoomMatrix=t.getUniformLocation(a,"uPanZoomMatrix"),a.uAtlasSize=t.getUniformLocation(a,"uAtlasSize"),a.uBGColor=t.getUniformLocation(a,"uBGColor"),a.uZoom=t.getUniformLocation(a,"uZoom"),a.uTextures=[];for(var i=0;i<this.batchManager.getMaxAtlasesPerBatch();i++)a.uTextures.push(t.getUniformLocation(a,"uTexture".concat(i)));return a}},{key:"_createVAO",value:function(){var e,t,r,n,a,i,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,u=this.program,c=l.createVertexArray();return l.bindVertexArray(c),e=u.aPosition,r=(t=tf(dm(l,"vec2"),2))[0],a=dv(l,n=t[1],o),i=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,i),l.bufferData(l.ARRAY_BUFFER,a,l.STATIC_DRAW),n===l.FLOAT?l.vertexAttribPointer(e,r,n,!1,0,0):n===l.INT&&l.vertexAttribIPointer(e,r,n,0,0),l.enableVertexAttribArray(e),l.bindBuffer(l.ARRAY_BUFFER,null),this.transformBuffer=function(e,t,r){for(var n=new Float32Array(9*t),a=Array(t),i=0;i<t;i++){var o=9*i*4;a[i]=new Float32Array(n.buffer,o,9)}var s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,n.byteLength,e.DYNAMIC_DRAW);for(var l=0;l<3;l++){var u=r+l;e.enableVertexAttribArray(u),e.vertexAttribPointer(u,3,e.FLOAT,!1,36,12*l),e.vertexAttribDivisor(u,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),s.getMatrixView=function(e){return a[e]},s.setData=function(e,t){a[t].set(e,0)},s.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferSubData(e.ARRAY_BUFFER,0,n)},s}(l,s,u.aTransform),this.indexBuffer=dy(l,s,"vec4",u.aIndex),this.vertTypeBuffer=dy(l,s,"int",u.aVertType),this.atlasIdBuffer=dy(l,s,"int",u.aAtlasId),this.texBuffer=dy(l,s,"vec4",u.aTex),this.pointAPointBBuffer=dy(l,s,"vec4",u.aPointAPointB),this.pointCPointDBuffer=dy(l,s,"vec4",u.aPointCPointD),this.lineWidthBuffer=dy(l,s,"vec2",u.aLineWidth),this.colorBuffer=dy(l,s,"vec4",u.aColor),this.cornerRadiusBuffer=dy(l,s,"vec4",u.aCornerRadius),this.borderColorBuffer=dy(l,s,"vec4",u.aBorderColor),l.bindVertexArray(null),c}},{key:"buffers",get:function(){var e=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(e){return tq(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]:dP;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,r){var n=this.atlasManager,a=this.batchManager,i=n.getRenderTypeOpts(r);if(this._isVisible(e,i)&&(!e.isEdge()||this._isValidEdge(e))){if(this.renderTarget.picking&&i.getTexPickingMode){var o=i.getTexPickingMode(e);if(1===o)return;if(2==o)return void this.drawPickingRectangle(e,t,r)}var s,l=td(n.getAtlasInfo(e,r));try{for(l.s();!(s=l.n()).done;){var u=s.value,c=u.atlas,d=u.tex1,h=u.tex2;a.canAddToCurrentBatch(c)||this.endBatch();for(var f=a.getAtlasIndexForBatch(c),p=0,g=[[d,!0],[h,!1]];p<g.length;p++){var v=tf(g[p],2),y=v[0],x=v[1];if(0!=y.w){var b=this.instanceCount;this.vertTypeBuffer.getView(b)[0]=0;var w=this.indexBuffer.getView(b);dg(t,w),this.atlasIdBuffer.getView(b)[0]=f;var j=this.texBuffer.getView(b);j[0]=y.x,j[1]=y.y,j[2]=y.w,j[3]=y.h;var N=this.transformBuffer.getMatrixView(b);this.setTransformMatrix(e,N,i,u,x),this.instanceCount++,!x&&this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(e){l.e(e)}finally{l.f()}}}},{key:"setTransformMatrix",value:function(e,t,r,n){var a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],i=0;if(r.shapeProps&&r.shapeProps.padding&&(i=e.pstyle(r.shapeProps.padding).pfValue),n){var o=n.bb,s=n.tex1,l=n.tex2,u=s.w/(s.w+l.w);a||(u=1-u);var c=this._getAdjustedBB(o,i,a,u);this._applyTransformMatrix(t,c,r,e)}else{var d=r.getBoundingBox(e),h=this._getAdjustedBB(d,i,!0,1);this._applyTransformMatrix(t,h,r,e)}}},{key:"_applyTransformMatrix",value:function(e,t,r,n){dw(e);var a,i,o=r.getRotation?r.getRotation(n):0;if(0!==o){var s=r.getRotationPoint(n);dj(e,e,[s.x,s.y]),dN(e,e,o);var l=r.getRotationOffset(n);a=l.x+(t.xOffset||0),i=l.y+(t.yOffset||0)}else a=t.x1,i=t.y1;dj(e,e,[a,i]),dk(e,e,[t.w,t.h])}},{key:"_getAdjustedBB",value:function(e,t,r,n){var a=e.x1,i=e.y1,o=e.w,s=e.h,l=e.yOffset;t&&(a-=t,i-=t,o+=2*t,s+=2*t);var u=0,c=o*n;return r&&n<1?o=c:!r&&n<1&&(a+=u=o-c,o=c),{x1:a,y1:i,w:o,h:s,xOffset:u,yOffset:l}}},{key:"drawPickingRectangle",value:function(e,t,r){var n=this.atlasManager.getRenderTypeOpts(r),a=this.instanceCount;this.vertTypeBuffer.getView(a)[0]=4,dg(t,this.indexBuffer.getView(a)),dp([0,0,0],1,this.colorBuffer.getView(a));var i=this.transformBuffer.getMatrixView(a);this.setTransformMatrix(e,i,n),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(e,t,r){var n=this.simpleShapeOptions.get(r);if(this._isVisible(e,n)){var a=n.shapeProps,i=this._getVertTypeForShape(e,a.shape);if(void 0===i||n.isSimple&&!n.isSimple(e))return void this.drawTexture(e,t,r);var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=i,5===i||6===i){var s=n.getBoundingBox(e),l=this._getCornerRadius(e,a.radius,s),u=this.cornerRadiusBuffer.getView(o);u[0]=l,u[1]=l,u[2]=l,u[3]=l,6===i&&(u[0]=0,u[2]=0)}dg(t,this.indexBuffer.getView(o)),dp(e.pstyle(a.color).value,e.pstyle(a.opacity).value,this.colorBuffer.getView(o));var c=this.lineWidthBuffer.getView(o);if(c[0]=0,c[1]=0,a.border){var d=e.pstyle("border-width").value;if(d>0){dp(e.pstyle("border-color").value,e.pstyle("border-opacity").value,this.borderColorBuffer.getView(o));var h=e.pstyle("border-position").value;if("inside"===h)c[0]=0,c[1]=-d;else if("outside"===h)c[0]=d,c[1]=0;else{var f=d/2;c[0]=f,c[1]=-f}}}var p=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,p,n),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,r){var n=r.w,a=r.h;return"auto"===e.pstyle(t).value?nH(n,a):Math.min(e.pstyle(t).pfValue,a/2,n/2)}},{key:"drawEdgeArrow",value:function(e,t,r){if(e.visible()){var n,a,i,o=e._private.rscratch;if(("source"===r?(n=o.arrowStartX,a=o.arrowStartY,i=o.srcArrowAngle):(n=o.arrowEndX,a=o.arrowEndY,i=o.tgtArrowAngle),!(isNaN(n)||null==n||isNaN(a)||null==a||isNaN(i))&&null!=i)&&"none"!==e.pstyle(r+"-arrow-shape").value){var s=e.pstyle(r+"-arrow-color").value,l=e.pstyle("opacity").value,u=e.pstyle("line-opacity").value,c=e.pstyle("width").pfValue,d=e.pstyle("arrow-scale").value,h=this.r.getArrowWidth(c,d),f=this.instanceCount,p=this.transformBuffer.getMatrixView(f);dw(p),dj(p,p,[n,a]),dk(p,p,[h,h]),dN(p,p,i),this.vertTypeBuffer.getView(f)[0]=3,dg(t,this.indexBuffer.getView(f)),dp(s,l*u,this.colorBuffer.getView(f)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(e,t){if(e.visible()){var r=this._getEdgePoints(e);if(r){var n=e.pstyle("opacity").value,a=e.pstyle("line-opacity").value,i=e.pstyle("width").pfValue,o=e.pstyle("line-color").value,s=n*a;if(r.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==r.length){var l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=1,dg(t,this.indexBuffer.getView(l)),dp(o,s,this.colorBuffer.getView(l)),this.lineWidthBuffer.getView(l)[0]=i;var u=this.pointAPointBBuffer.getView(l);u[0]=r[0],u[1]=r[1],u[2]=r[2],u[3]=r[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var c=0;c<r.length-2;c+=2){var d=this.instanceCount;this.vertTypeBuffer.getView(d)[0]=2,dg(t,this.indexBuffer.getView(d)),dp(o,s,this.colorBuffer.getView(d)),this.lineWidthBuffer.getView(d)[0]=i;var h=r[c-2],f=r[c-1],p=r[c],g=r[c+1],v=r[c+2],y=r[c+3],x=r[c+4],b=r[c+5];0==c&&(h=2*p-v+.001,f=2*g-y+.001),c==r.length-4&&(x=2*v-p+.001,b=2*y-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]=y,j[2]=x,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 r=t.allpts;if(4==r.length)return r;var n=this._getNumSegments(e);return this._getCurveSegmentPoints(r,n)}}},{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 r=Array((t+1)*2),n=0;n<=t;n++)if(0==n)r[0]=e[0],r[1]=e[1];else if(n==t)r[2*n]=e[e.length-2],r[2*n+1]=e[e.length-1];else{var a=n/t;this._setCurvePoint(e,a,r,2*n)}return r}},{key:"_setCurvePoint",value:function(e,t,r,n){if(e.length<=2)r[n]=e[0],r[n+1]=e[1];else{for(var a=Array(e.length-2),i=0;i<a.length;i+=2){var o=(1-t)*e[i]+t*e[i+2],s=(1-t)*e[i+1]+t*e[i+3];a[i]=o,a[i+1]=s}return this._setCurvePoint(a,t,r,n)}}},{key:"endBatch",value:function(){var e=this.gl,t=this.vao,r=this.vertexCount,n=this.instanceCount;if(0!==n){var a,i,o=this.renderTarget.picking?this.pickingProgram:this.program;e.useProgram(o),e.bindVertexArray(t);var s,l=td(this.buffers);try{for(l.s();!(s=l.n()).done;)s.value.bufferSubData(n)}catch(e){l.e(e)}finally{l.f()}for(var u=this.batchManager.getAtlases(),c=0;c<u.length;c++)u[c].bufferIfNeeded(e);for(var d=0;d<u.length;d++)e.activeTexture(e.TEXTURE0+d),e.bindTexture(e.TEXTURE_2D,u[d].texture),e.uniform1i(o.uTextures[d],d);e.uniform1f(o.uZoom,(i=(a=this.r).pixelRatio,a.cy.zoom()*i)),e.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var h=dp(this.bgColor,1);e.uniform4fv(o.uBGColor,h),e.drawArraysInstanced(e.TRIANGLES,0,r,n),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:n,atlasCount:u.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var e=this.atlasManager.getDebugInfo(),t=e.reduce(function(e,t){return e+t.atlasCount},0),r=this.batchDebugInfo,n=r.reduce(function(e,t){return e+t.count},0);return{atlasInfo:e,totalAtlases:t,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:r.length,batchInfo:r,totalInstances:n}}}]),dB={};function dM(e,t){return rA(e._private.rscratch,"labelWrapCachedLines",t)||[]}dB.initWebgl=function(e,t){var r,n,a,i,o,s,l,u,c=this,d=c.data.contexts[c.WEBGL];e.bgColor=t0((r=c.cy.container())&&r.style&&r.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)),c.webglDebug=e.webglDebug,c.webglDebugShowAtlases=e.webglDebugShowAtlases,l=d.createFramebuffer(),d.bindFramebuffer(d.FRAMEBUFFER,l),u=d.createTexture(),d.bindTexture(d.TEXTURE_2D,u),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,u,0),d.bindFramebuffer(d.FRAMEBUFFER,null),l.setFramebufferAttachmentSizes=function(e,t){d.bindTexture(d.TEXTURE_2D,u),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,e,t,0,d.RGBA,d.UNSIGNED_BYTE,null)},c.pickingFrameBuffer=l,c.pickingFrameBuffer.needsDraw=!0,c.drawing=new dD(c,d,e);var h=function(e){return function(t){return c.getTextAngle(t,e)}},f=function(e){return function(t){var r=t.pstyle(e);return r&&r.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(),r=t.x,n=t.y,a=e.outerWidth(),i=e.outerHeight();return{w:a,h:i,x1:r-a/2,y1:n-i/2}};c.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),c.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),c.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),c.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:v,isSimple:df,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),c.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"}}),c.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"}}),c.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:g,getKey:dA(t.getLabelKey,null),getBoundingBox:dR(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:h(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:f("label")}),c.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:g,getKey:dA(t.getSourceLabelKey,"source"),getBoundingBox:dR(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:h("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:f("source-label")}),c.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:g,getKey:dA(t.getTargetLabelKey,"target"),getBoundingBox:dR(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:h("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:f("target-label")});var y=rt(function(){console.log("garbage collect flag set"),c.data.gc=!0},1e4);c.onUpdateEleCalcs(function(e,t){var r=!1;t&&t.length>0&&(r|=c.drawing.invalidate(t)),r&&y()}),a=(n=c).render,n.render=function(e){e=e||{};var t,r,i,o,s=n.cy;n.webgl&&(s.zoom()>7.99?((r=(t=n).data.contexts[t.WEBGL]).clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),a.call(n,e)):(i=n,(o=function(e){e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,i.canvasWidth,i.canvasHeight),e.restore()})(i.data.contexts[i.NODE]),o(i.data.contexts[i.DRAG]),dO(n,e,dP)))},i=n.matchCanvasSize,n.matchCanvasSize=function(e){i.call(n,e),n.pickingFrameBuffer.setFramebufferAttachmentSizes(n.canvasWidth,n.canvasHeight),n.pickingFrameBuffer.needsDraw=!0},n.findNearestElements=function(e,t,r,a){return function(e,t,r){var n,a,i,o=function(e,t,r,n,a){var i=dh(e),o=i.pan,s=i.zoom,l=tf((g=t*s+o.x,v=r*s+o.y,[g,v=Math.round(e.canvasHeight-v)]),2),u=l[0],c=l[1],d=e.data.contexts[e.WEBGL];d.bindFramebuffer(d.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(d.viewport(0,0,d.canvas.width,d.canvas.height),dO(e,null,d_),e.pickingFrameBuffer.needsDraw=!1);var h=new Uint8Array(144);d.readPixels(u-3,c-3,6,6,d.RGBA,d.UNSIGNED_BYTE,h),d.bindFramebuffer(d.FRAMEBUFFER,null);for(var f=new Set,p=0;p<36;p++){var g,v,y,x=(y=h.slice(4*p,4*p+4))[0]+(y[1]<<8)+(y[2]<<16)+(y[3]<<24)-1;x>=0&&f.add(x)}return f}(e,t,r),s=e.getCachedZSortedEles(),l=td(o);try{for(l.s();!(i=l.n()).done;){var u=s[i.value];if(!n&&u.isNode()&&(n=u),!a&&u.isEdge()&&(a=u),n&&a)break}}catch(e){l.e(e)}finally{l.f()}return[n,a].filter(Boolean)}(n,e,t)},o=n.invalidateCachedZSortedEles,n.invalidateCachedZSortedEles=function(){o.call(n),n.pickingFrameBuffer.needsDraw=!0},s=n.notify,n.notify=function(e,t){s.call(n,e,t),"viewport"===e||"bounds"===e?n.pickingFrameBuffer.needsDraw=!0:"background"===e&&n.drawing.invalidate(t,{type:"node-body"})}};var dA=function(e,t){return function(r){var n=e(r),a=dM(r,t);return a.length>1?a.map(function(e,t){return"".concat(n,"_").concat(t)}):n}},dR=function(e,t){return function(r,n){var a=e(r);if("string"==typeof n){var i=n.indexOf("_");if(i>0){var o=Number(n.substring(i+1)),s=dM(r,t),l=a.h/s.length,u=l*o,c=a.y1+u;return{x1:a.x1,w:a.w,y1:c,h:l,yOffset:u}}}return a}};function dI(e,t){var r=e.canvasWidth,n=e.canvasHeight,a=dh(e),i=a.pan,o=a.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,r,n),t.translate(i.x,i.y),t.scale(o,o)}function dL(e,t,r){var n=e.drawing;t+=1,r.isNode()?(n.drawNode(r,t,"node-underlay"),n.drawNode(r,t,"node-body"),n.drawTexture(r,t,"label"),n.drawNode(r,t,"node-overlay")):(n.drawEdgeLine(r,t),n.drawEdgeArrow(r,t,"source"),n.drawEdgeArrow(r,t,"target"),n.drawTexture(r,t,"label"),n.drawTexture(r,t,"edge-source-label"),n.drawTexture(r,t,"edge-target-label"))}function dO(e,t,r){e.webglDebug&&(W=performance.now());var n=e.drawing,a=0;if(r.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&e.drawSelectionRectangle(t,function(t){return dI(e,t)}),e.data.canvasNeedsRedraw[e.NODE]||r.picking){var i,o,s,l,u,c,d,h,f,p,g,v,y,x,b,w,j,N,k,C,E,S,T,P,_,D,B,M,A,R,I,L=e.data.contexts[e.WEBGL];r.screen?(L.clearColor(0,0,0,0),L.enable(L.BLEND),L.blendFunc(L.ONE,L.ONE_MINUS_SRC_ALPHA)):L.disable(L.BLEND),L.clear(L.COLOR_BUFFER_BIT|L.DEPTH_BUFFER_BIT),L.viewport(0,0,L.canvas.width,L.canvas.height);var O=(i=e.canvasWidth,o=e.canvasHeight,l=(s=dh(e)).pan,u=s.zoom,dj(c=db(),c,[l.x,l.y]),dk(c,c,[u,u]),h=d=db(),h[0]=2/i,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=db(),g=d[0],v=d[1],y=d[2],x=d[3],b=d[4],w=d[5],j=d[6],N=d[7],k=d[8],C=c[0],E=c[1],S=c[2],T=c[3],P=c[4],_=c[5],D=c[6],B=c[7],M=c[8],p[0]=C*g+E*x+S*j,p[1]=C*v+E*b+S*N,p[2]=C*y+E*w+S*k,p[3]=T*g+P*x+_*j,p[4]=T*v+P*b+_*N,p[5]=T*y+P*w+_*k,p[6]=D*g+B*x+M*j,p[7]=D*v+B*b+M*N,p[8]=D*y+B*w+M*k,f),z=e.getCachedZSortedEles();if(a=z.length,n.startFrame(O,r),r.screen){for(var V=0;V<z.nondrag.length;V++)dL(e,V,z.nondrag[V]);for(var F=0;F<z.drag.length;F++)dL(e,F,z.drag[F])}else if(r.picking)for(var H=0;H<z.length;H++)dL(e,H,z[H]);n.endFrame(),r.screen&&e.webglDebugShowAtlases&&((A=e.data.contexts[e.NODE]).save(),dI(e,A),A.strokeStyle="rgba(0, 0, 0, 0.3)",A.beginPath(),A.moveTo(-1e3,0),A.lineTo(1e3,0),A.stroke(),A.beginPath(),A.moveTo(0,-1e3),A.lineTo(0,1e3),A.stroke(),A.restore(),I=0,(R=function(t,r,n){for(var a=t.atlasManager.getAtlasCollection(r),i=e.data.contexts[e.NODE],o=a.atlases,s=0;s<o.length;s++){var l=o[s].canvas;if(l){var u=l.width,c=l.height,d=u*s,h=l.height*n;i.save(),i.scale(.4,.4),i.drawImage(l,d,h),i.strokeStyle="black",i.rect(d,h,u,c),i.stroke(),i.restore()}}})(e.drawing,"node",I++),R(e.drawing,"label",I++)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var q=Math.ceil(performance.now()-W),X=n.getDebugInfo(),Y=["".concat(a," elements"),"".concat(X.totalInstances," instances"),"".concat(X.batchCount," batches"),"".concat(X.totalAtlases," atlases"),"".concat(X.wrappedCount," wrapped textures"),"".concat(X.simpleCount," simple shapes")].join(", ");console.log("WebGL (".concat(r.name,") - frame time ").concat(q,"ms")),console.log("Totals:"),console.log(" ".concat(Y)),console.log("Texture Atlases Used:");var W,U,$=td(X.atlasInfo);try{for($.s();!(U=$.n()).done;){var K=U.value;console.log(" ".concat(K.type,": ").concat(K.keyCount," keys, ").concat(K.atlasCount," atlases"))}}catch(e){$.e(e)}finally{$.f()}console.log("")}e.data.gc&&(console.log("Garbage Collect!"),e.data.gc=!1,n.gc())}var dz={};dz.drawPolygonPath=function(e,t,r,n,a,i){var o=n/2,s=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*i[0],r+s*i[1]);for(var l=1;l<i.length/2;l++)e.lineTo(t+o*i[2*l],r+s*i[2*l+1]);e.closePath()},dz.drawRoundPolygonPath=function(e,t,r,n,a,i,o){o.forEach(function(t){return cx(e,t)}),e.closePath()},dz.drawRoundRectanglePath=function(e,t,r,n,a,i){var o=n/2,s=a/2,l="auto"===i?nH(n,a):Math.min(i,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,r-s),e.arcTo(t+o,r-s,t+o,r,l),e.arcTo(t+o,r+s,t,r+s,l),e.arcTo(t-o,r+s,t-o,r,l),e.arcTo(t-o,r-s,t,r-s,l),e.lineTo(t,r-s),e.closePath()},dz.drawBottomRoundRectanglePath=function(e,t,r,n,a,i){var o=n/2,s=a/2,l="auto"===i?nH(n,a):i;e.beginPath&&e.beginPath(),e.moveTo(t,r-s),e.lineTo(t+o,r-s),e.lineTo(t+o,r),e.arcTo(t+o,r+s,t,r+s,l),e.arcTo(t-o,r+s,t-o,r,l),e.lineTo(t-o,r-s),e.lineTo(t,r-s),e.closePath()},dz.drawCutRectanglePath=function(e,t,r,n,a,i,o){var s=n/2,l=a/2,u="auto"===o?nX():o;e.beginPath&&e.beginPath(),e.moveTo(t-s+u,r-l),e.lineTo(t+s-u,r-l),e.lineTo(t+s,r-l+u),e.lineTo(t+s,r+l-u),e.lineTo(t+s-u,r+l),e.lineTo(t-s+u,r+l),e.lineTo(t-s,r+l-u),e.lineTo(t-s,r-l+u),e.closePath()},dz.drawBarrelPath=function(e,t,r,n,a){var i=n/2,o=a/2,s=t-i,l=t+i,u=r-o,c=r+o,d=nY(n,a),h=d.widthOffset,f=d.heightOffset,p=d.ctrlPtOffsetPct*h;e.beginPath&&e.beginPath(),e.moveTo(s,u+f),e.lineTo(s,c-f),e.quadraticCurveTo(s+p,c,s+h,c),e.lineTo(l-h,c),e.quadraticCurveTo(l-p,c,l,c-f),e.lineTo(l,u+f),e.quadraticCurveTo(l-p,u,l-h,u),e.lineTo(s+h,u),e.quadraticCurveTo(s+p,u,s,u+f),e.closePath()};for(var dV={},dF={},dH=Math.PI/40,dq=0*Math.PI;dq<2*Math.PI;dq+=dH)dV[dq]=Math.sin(dq),dF[dq]=Math.cos(dq);dz.drawEllipsePath=function(e,t,r,n,a){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,r,n/2,a/2,0,0,2*Math.PI);else for(var i,o,s=n/2,l=a/2,u=0*Math.PI;u<2*Math.PI;u+=dH)i=t-s*dV[u]*0+s*dF[u]*1,o=r+l*dF[u]*0+l*dV[u]*1,0===u?e.moveTo(i,o):e.lineTo(i,o);e.closePath()};var dX={};function dY(e){var t=e.indexOf(",");return e.substr(t+1)}function dW(e,t,r){var n=function(){return t.toDataURL(r,e.quality)};switch(e.output){case"blob-promise":return new aZ(function(n,a){try{t.toBlob(function(e){null!=e?n(e):a(Error("`canvas.toBlob()` sent a null value in its callback"))},r,e.quality)}catch(e){a(e)}});case"blob":return function(e,t){for(var r=atob(e),n=new ArrayBuffer(r.length),a=new Uint8Array(n),i=0;i<r.length;i++)a[i]=r.charCodeAt(i);return new Blob([n],{type:t})}(dY(n()),r);case"base64":return dY(n());default:return n()}}dX.createBuffer=function(e,t){var r=document.createElement("canvas");return r.width=e,r.height=t,[r,r.getContext("2d")]},dX.bufferCanvasImage=function(e){var t=this.cy,r=t.mutableElements().boundingBox(),n=this.findContainerClientCoords(),a=e.full?Math.ceil(r.w):n[2],i=e.full?Math.ceil(r.h):n[3],o=tP(e.maxWidth)||tP(e.maxHeight),s=this.getPixelRatio(),l=1;if(void 0!==e.scale)a*=e.scale,i*=e.scale,l=e.scale;else if(o){var u=1/0,c=1/0;tP(e.maxWidth)&&(u=l*e.maxWidth/a),tP(e.maxHeight)&&(c=l*e.maxHeight/i),a*=l=Math.min(u,c),i*=l}o||(a*=s,i*=s,l*=s);var d=document.createElement("canvas");d.width=a,d.height=i,d.style.width=a+"px",d.style.height=i+"px";var h=d.getContext("2d");if(a>0&&i>0){h.clearRect(0,0,a,i),h.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)h.translate(-r.x1*l,-r.y1*l),h.scale(l,l),this.drawElements(h,f),h.scale(1/l,1/l),h.translate(r.x1*l,r.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,a,i),h.fill())}return d},dX.png=function(e){return dW(e,this.bufferCanvasImage(e),"image/png")},dX.jpg=function(e){return dW(e,this.bufferCanvasImage(e),"image/jpeg")};var dU={};dU.nodeShapeImpl=function(e,t,r,n,a,i,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,r,n,a,i);case"polygon":return this.drawPolygonPath(t,r,n,a,i,o);case"round-polygon":return this.drawRoundPolygonPath(t,r,n,a,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,r,n,a,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,r,n,a,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,r,n,a,i,s);case"barrel":return this.drawBarrelPath(t,r,n,a,i)}};var d$=dK.prototype;function dK(e){var t=this,r=t.cy.window().document;e.webgl&&(d$.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:Array(d$.CANVAS_LAYERS),contexts:Array(d$.CANVAS_LAYERS),canvasNeedsRedraw:Array(d$.CANVAS_LAYERS),bufferCanvases:Array(d$.BUFFER_COUNT),bufferContexts:Array(d$.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=r.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[n]=a,i.position="relative",i.zIndex="0",i.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[n]=a;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"};tx&&tx.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;l<d$.CANVAS_LAYERS;l++){var u=t.data.canvases[l]=r.createElement("canvas"),c=d$.CANVAS_TYPES[l];t.data.contexts[l]=u.getContext(c),t.data.contexts[l]||rN("Could not create canvas of type "+c),Object.keys(s).forEach(function(e){u.style[e]=s[e]}),u.style.position="absolute",u.setAttribute("data-id","layer"+l),u.style.zIndex=String(d$.CANVAS_LAYERS-l),t.data.canvasContainer.appendChild(u),t.data.canvasNeedsRedraw[l]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[d$.NODE].setAttribute("data-id","layer"+d$.NODE+"-node"),t.data.canvases[d$.SELECT_BOX].setAttribute("data-id","layer"+d$.SELECT_BOX+"-selectbox"),t.data.canvases[d$.DRAG].setAttribute("data-id","layer"+d$.DRAG+"-drag"),t.data.canvases[d$.WEBGL]&&t.data.canvases[d$.WEBGL].setAttribute("data-id","layer"+d$.WEBGL+"-webgl");for(var l=0;l<d$.BUFFER_COUNT;l++)t.data.bufferCanvases[l]=r.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=no(),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},y=function(e,r,n,a,i){return t.drawElement(e,r,n,!1,!1,i)},x=function(e,r,n,a,i){return t.drawElementText(e,r,n,a,"main",i)},b=function(e,r,n,a,i){return t.drawElementText(e,r,n,a,"source",i)},w=function(e,r,n,a,i){return t.drawElementText(e,r,n,a,"target",i)},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},S=function(e){var t;return{x:((t=j(e)).x1+t.x2)/2,y:(t.y1+t.y2)/2}},T=function(e,t,r){var n=e?e+"-":"";return{x:t.x+r.pstyle(n+"text-margin-x").pfValue,y:t.y+r.pstyle(n+"text-margin-y").pfValue}},P=function(e,t,r){var n=e[0]._private.rscratch;return{x:n[t],y:n[r]}},_=function(e){return T("",P(e,"labelX","labelY"),e)},D=function(e){return T("source",P(e,"sourceLabelX","sourceLabelY"),e)},B=function(e){return T("target",P(e,"targetLabelX","targetLabelY"),e)},M=function(e){return h(j(e))},A=function(e){return h(k(e))},R=function(e){return h(C(e))},I=function(e){var t=N(e),r=h(N(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":r.x=-t.w-(t.leftPad||0);break;case"right":r.x=-(t.rightPad||0)}switch(e.pstyle("text-valign").value){case"top":r.y=-t.h-(t.topPad||0);break;case"bottom":r.y=-(t.botPad||0)}}return r},L=t.data.eleTxrCache=new cU(t,{getKey:f,doesEleInvalidateKey:function(e){var t=e[0]._private;return t.oldBackgroundTimestamp!==t.backgroundTimestamp},drawElement:y,getBoundingBox:j,getRotationPoint:S,getRotationOffset:M,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),O=t.data.lblTxrCache=new cU(t,{getKey:p,drawElement:x,getBoundingBox:N,getRotationPoint:_,getRotationOffset:I,isVisible:E}),z=t.data.slbTxrCache=new cU(t,{getKey:g,drawElement:b,getBoundingBox:k,getRotationPoint:D,getRotationOffset:A,isVisible:E}),V=t.data.tlbTxrCache=new cU(t,{getKey:v,drawElement:w,getBoundingBox:C,getRotationPoint:B,getRotationOffset:R,isVisible:E}),F=t.data.lyrTxrCache=new cK(t);t.onUpdateEleCalcs(function(e,t){L.invalidateElements(t),O.invalidateElements(t),z.invalidateElements(t),V.invalidateElements(t),F.invalidateElements(t);for(var r=0;r<t.length;r++){var n=t[r]._private;n.oldBackgroundTimestamp=n.backgroundTimestamp}});var H=function(e){for(var t=0;t<e.length;t++)F.enqueueElementRefinement(e[t].ele)};L.onDequeue(H),O.onDequeue(H),z.onDequeue(H),V.onDequeue(H),e.webgl&&t.initWebgl(e,{getStyleKey:f,getLabelKey:p,getSourceLabelKey:g,getTargetLabelKey:v,drawElement:y,drawLabel:x,drawSourceLabel:b,drawTargetLabel:w,getElementBox:j,getLabelBox:N,getSourceLabelBox:k,getTargetLabelBox:C,getElementRotationPoint:S,getElementRotationOffset:M,getLabelRotationPoint:_,getSourceLabelRotationPoint:D,getTargetLabelRotationPoint:B,getLabelRotationOffset:I,getSourceLabelRotationOffset:A,getTargetLabelRotationOffset:R})}d$.CANVAS_LAYERS=3,d$.SELECT_BOX=0,d$.DRAG=1,d$.NODE=2,d$.WEBGL=3,d$.CANVAS_TYPES=["2d","2d","2d","webgl2"],d$.BUFFER_COUNT=3,d$.TEXTURE_BUFFER=0,d$.MOTIONBLUR_BUFFER_NODE=1,d$.MOTIONBLUR_BUFFER_DRAG=2,d$.redrawHint=function(e,t){switch(e){case"eles":this.data.canvasNeedsRedraw[d$.NODE]=t;break;case"drag":this.data.canvasNeedsRedraw[d$.DRAG]=t;break;case"select":this.data.canvasNeedsRedraw[d$.SELECT_BOX]=t;break;case"gc":this.data.gc=!0}};var dG="undefined"!=typeof Path2D;d$.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},d$.usePaths=function(){return dG&&this.pathsEnabled},d$.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},d$.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},d$.makeOffscreenCanvas=function(e,t){var r;return("undefined"==typeof OffscreenCanvas?"undefined":tm(OffscreenCanvas))!=="undefined"?r=new OffscreenCanvas(e,t):((r=this.cy.window().document.createElement("canvas")).width=e,r.height=t),r},[cQ,c3,dt,dn,da,ds,du,dB,dz,dX,dU].forEach(function(e){tG(d$,e)});var dZ=[{name:"null",impl:sF},{name:"base",impl:cV},{name:"canvas",impl:dK}],dQ={},dJ={};function d0(e,t,r){var n=r,a=function(r){rC("Can not register `"+t+"` for `"+e+"` since `"+r+"` already exists in the prototype and can not be overridden")};if("core"===e)if(se.prototype[t])return a(t);else se.prototype[t]=r;else if("collection"===e)if(oM.prototype[t])return a(t);else oM.prototype[t]=r;else if("layout"===e){for(var i=function(e){this.options=e,r.call(this,e),tT(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(r.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||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 c=r.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var r=0;r<t.length;r++)t[r].stop()}return c?c.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)}};tG(o,{createEmitter:function(){return this._private.emitter=new on(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}}),ii.eventAliasesOn(o),n=i}else if("renderer"===e&&"null"!==t&&"base"!==t){var f=d1("renderer","base"),p=f.prototype,g=r.prototype,v=function(){f.apply(this,arguments),r.apply(this,arguments)},y=v.prototype;for(var x in p){var b=p[x];if(null!=g[x])return a(x);y[x]=b}for(var w in g)y[w]=g[w];p.clientFunctions.forEach(function(e){y[e]=y[e]||function(){rN("Renderer does not implement `renderer."+e+"()` on its prototype")}}),n=v}else if("__proto__"===e||"constructor"===e||"prototype"===e)return rN(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return t2({map:dQ,keys:[e,t],value:n})}function d1(e,t){return t5({map:dQ,keys:[e,t]})}function d2(e,t,r,n,a){return t2({map:dJ,keys:[e,t,r,n],value:a})}function d5(e,t,r,n){return t5({map:dJ,keys:[e,t,r,n]})}var d3=function(){return 2==arguments.length?d1.apply(null,arguments):3==arguments.length?d0.apply(null,arguments):4==arguments.length?d5.apply(null,arguments):5==arguments.length?d2.apply(null,arguments):void rN("Invalid extension access syntax")};se.prototype.extension=d3,[{type:"layout",extensions:sV},{type:"renderer",extensions:dZ}].forEach(function(e){e.extensions.forEach(function(t){d0(e.type,t.name,t.impl)})});var d4=function(){if(!(this instanceof d4))return new d4;this.length=0},d6=d4.prototype;d6.instanceString=function(){return"stylesheet"},d6.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},d6.css=function(e,t){var r=this.length-1;if(tC(e))this[r].properties.push({name:e,value:t});else if(tT(e))for(var n=Object.keys(e),a=0;a<n.length;a++){var i=n[a],o=e[i];if(null!=o){var s=o6.properties[i]||o6.properties[tV(i)];if(null!=s){var l=s.name;this[r].properties.push({name:l,value:o})}}}return this},d6.style=d6.css,d6.generateStyle=function(e){var t=new o6(e);return this.appendToStyle(t)},d6.appendToStyle=function(e){for(var t=0;t<this.length;t++){var r=this[t],n=r.selector,a=r.properties;e.selector(n);for(var i=0;i<a.length;i++){var o=a[i];e.css(o.name,o.value)}}return e};var d7=function(e){return(void 0===e&&(e={}),tT(e))?new se(e):tC(e)?d3.apply(d3,arguments):void 0};d7.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(d7),e.apply(null,t),this},d7.warnings=function(e){return rk(e)},d7.version="3.33.1",d7.stylesheet=d7.Stylesheet=d4;let d9="#0074d9",d8="#0074d9";function he({data:e,height:t=600,showLabels:r=!0,onNodeClick:n,onNodeHover:a,nodeColorFn:i,nodeSizeFn:o,linkColorFn:s,linkWidthFn:l,maxNodes:u}){let c,d=(0,_.useRef)(null),h=(0,_.useRef)(null),[f,p]=(0,_.useState)(null),[g,v]=(0,_.useState)(null),[y,x]=(0,_.useState)(null),[b,w]=(0,_.useState)(!0),j=function(){let[e,t]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{let e=()=>{t(document.documentElement.classList.contains("dark"))};e();let r=new MutationObserver(e);return r.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),e}(),N=(0,_.useRef)(n),k=(0,_.useRef)(a),C=(0,_.useRef)(e),E=(0,_.useRef)(i),T=(0,_.useRef)(s);N.current=n,k.current=a,C.current=e,E.current=i,T.current=s;let P=(0,_.useMemo)(()=>{let t=[...e.nodes];u&&t.length>u&&(t=t.slice(0,u));let r=new Set(t.map(e=>e.id));return{nodes:t,links:e.links.filter(e=>r.has(e.source)&&r.has(e.target))}},[e,u]),D=(0,_.useMemo)(()=>[...P.nodes.map(e=>({data:{id:e.id,label:e.label||e.id.substring(0,8),color:i?i(e):e.color||d9,size:o?o(e):e.size||20,originalNode:e}})),...P.links.map((e,t)=>({data:{id:`edge-${t}`,source:e.source,target:e.target,color:s?s(e):e.color||d8,width:l?l(e):e.width||1,type:e.type,entity:e.entity,weight:e.weight,originalLink:e}}))],[P,i,o,s,l]);return(0,_.useEffect)(()=>{if(!d.current)return;if(0===D.length)return void w(!1);w(!0);let e=d7({container:d.current,elements:D,style:[{selector:"node",style:{"background-fill":"radial-gradient","background-gradient-stop-colors":["#0074d9","#005bb5"],"background-gradient-stop-positions":["0%","100%"],width:"data(size)",height:"data(size)",label:r?"data(label)":"",color:j?"#ffffff":"#1f2937","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":j?"rgba(0,0,0,0.8)":"rgba(255,255,255,0.9)","text-background-opacity":.9,"text-background-padding":"2px","text-background-shape":"roundrectangle","border-width":0,"z-index":0}},{selector:"node:selected",style:{"border-width":3,"border-color":"#0074d9","border-opacity":1}},{selector:"node:active",style:{"overlay-opacity":0}},{selector:"edge",style:{width:"data(width)","line-color":"data(color)","target-arrow-color":"data(color)","curve-style":"bezier",opacity:j?.5:.6,"z-index":1}},{selector:"edge:selected",style:{opacity:1,width:3}},{selector:".dimmed",style:{opacity:.15}},{selector:"node.highlighted",style:{opacity:1,"border-width":3,"border-color":"#0074d9","border-opacity":1}},{selector:"edge.highlighted",style:{opacity:.9,width:2}}],layout:{name:"cose",animate:!1,randomize:!0,nodeRepulsion:()=>1e5,idealEdgeLength:()=>300,edgeElasticity:()=>20,nestingFactor:.1,gravity:.01,numIter:2500,coolingFactor:.95,minTemp:1,nodeOverlap:20,nodeDimensionsIncludeLabels:!0,padding:50},minZoom:.1,maxZoom:5,wheelSensitivity:.3});return h.current=e,e.on("tap","node",t=>{let r=t.target,n=r.data("originalNode");N.current&&n&&N.current(n);let a=C.current,i=n.id,o=a.links.filter(e=>e.source===i||e.target===i),s=new Set;o.forEach(e=>{s.add(e.source),s.add(e.target)});let l=new Set(e.nodes().map(e=>e.id())),u=[],c=[];s.forEach(e=>{if(!l.has(e)){let t=a.nodes.find(t=>t.id===e);t&&u.push({group:"nodes",data:{id:t.id,label:t.label||t.id.substring(0,8),color:E.current?E.current(t):t.color||d9,size:t.size||20,originalNode:t,isTemporary:!0}})}});let d=new Set(e.edges().map(e=>`${e.data("source")}-${e.data("target")}`));if(o.forEach((e,t)=>{let r=`${e.source}-${e.target}`,n=`${e.target}-${e.source}`;d.has(r)||d.has(n)||c.push({group:"edges",data:{id:`temp-edge-${t}-${Date.now()}`,source:e.source,target:e.target,color:T.current?T.current(e):e.color||d8,width:e.width||1,type:e.type,isTemporary:!0}})}),u.length>0||c.length>0){e.add([...u,...c]);let t=r.position();e.nodes("[?isTemporary]").forEach((e,r)=>{let n=2*Math.PI*r/u.length;e.position({x:t.x+150*Math.cos(n),y:t.y+150*Math.sin(n)})})}let h=r.neighborhood().add(r);e.elements().addClass("dimmed"),h.removeClass("dimmed"),h.addClass("highlighted"),e.animate({fit:{eles:h,padding:50}},{duration:400})}),e.on("tap",t=>{t.target===e&&(e.elements("[?isTemporary]").remove(),e.elements().removeClass("dimmed highlighted"),e.animate({fit:{eles:e.elements(),padding:50}},{duration:400}))}),e.on("mouseover","node",e=>{let t=e.target.data("originalNode");p(t),k.current&&t&&k.current(t),d.current.style.cursor="pointer"}),e.on("mouseout","node",()=>{p(null),k.current&&k.current(null),d.current.style.cursor="default"}),e.on("mouseover","edge",e=>{let t=e.target,r=t.data("originalLink");if(r){v(r);let e=t.renderedMidpoint();x({x:e.x,y:e.y})}d.current.style.cursor="pointer"}),e.on("mouseout","edge",()=>{v(null),x(null),d.current.style.cursor="default"}),e.layout({name:"cose",animate:!1,randomize:!0,nodeRepulsion:()=>1e5,idealEdgeLength:()=>300,edgeElasticity:()=>20,nestingFactor:.1,gravity:.01,numIter:2500,coolingFactor:.95,minTemp:1,nodeOverlap:20,nodeDimensionsIncludeLabels:!0,padding:50}).run(),e.fit(void 0,50),w(!1),()=>{e.destroy()}},[D,r,j]),(0,_.useEffect)(()=>{let e=()=>{h.current&&(h.current.resize(),h.current.fit(void 0,50))};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,S.jsxs)("div",{className:"relative w-full rounded-lg overflow-hidden border border-border",style:{height:t},children:[b&&(0,S.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-background z-10",children:(0,S.jsxs)("div",{className:"text-center",children:[(0,S.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),(0,S.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading graph..."})]})}),(0,S.jsx)("div",{ref:d,className:"w-full h-full",style:{background:j?"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:j?"#0f1419":"#f8fafc"}}),!b&&0===P.nodes.length&&(0,S.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,S.jsx)("div",{className:"text-center",children:(0,S.jsx)("p",{className:"text-muted-foreground",children:"No memories to display"})})}),g&&y&&(0,S.jsx)("div",{className:"absolute z-30 pointer-events-none",style:{left:y.x,top:y.y,transform:"translate(-50%, -100%) translateY(-8px)"},children:(0,S.jsxs)("div",{className:`px-3 py-2 rounded-lg shadow-lg text-sm ${j?"bg-gray-800 text-white":"bg-white text-gray-900 border border-gray-200"}`,children:[(0,S.jsx)("div",{className:"font-medium capitalize mb-1",children:["causes","caused_by","enables","prevents"].includes(c=g.type||"semantic")?`Causal (${c.replace("_"," ")})`:`${c} link`}),g.entity&&(0,S.jsxs)("div",{className:"text-xs opacity-80",children:["Entity: ",(0,S.jsx)("span",{className:"font-medium",children:g.entity})]}),void 0!==g.weight&&(0,S.jsxs)("div",{className:"text-xs opacity-80",children:["Weight: ",(0,S.jsx)("span",{className:"font-medium",children:g.weight.toFixed(3)})]})]})}),(0,S.jsx)("div",{className:"absolute bottom-4 right-4 text-xs text-muted-foreground/60 z-20",children:"Drag to pan • Scroll to zoom • Click node to focus"})]})}function ht({factType:e}){let t,r,n,a,{currentBank:i}=(0,D.useBank)(),[o,s]=(0,_.useState)("graph"),[l,u]=(0,_.useState)(null),[c,d]=(0,_.useState)(!1),[h,f]=(0,_.useState)(""),[p,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(1),[x,b]=(0,_.useState)(null),[w,j]=(0,_.useState)(null),[N,k]=(0,_.useState)(!0),[C,E]=(0,_.useState)(50),[T,P]=(0,_.useState)(!0),[B,M]=(0,_.useState)(new Set(["semantic","temporal","entity","causal"])),A=e=>{M(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})};(0,_.useEffect)(()=>{let e=e=>{"Escape"===e.key&&x&&b(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[x]);let R=async e=>{try{await navigator.clipboard.writeText(e),g(e),setTimeout(()=>g(null),2e3)}catch(e){console.error("Failed to copy:",e)}},I=async()=>{if(i){d(!0);try{let t=await X.client.getGraph({bank_id:i,type:e});u(t)}catch(t){console.error("Error loading data:",t),alert(`Error loading ${e} data: `+t.message)}finally{d(!1)}}},L=(0,_.useMemo)(()=>{if(!l?.table_rows)return[];if(!h)return l.table_rows;let e=h.toLowerCase();return l.table_rows.filter(t=>t.text?.toLowerCase().includes(e))},[l,h]),V=(0,_.useMemo)(()=>new Set(L.map(e=>e.id)),[L]),F=(0,_.useMemo)(()=>{if(!l)return{nodes:[],links:[]};let e={nodes:(l.nodes||[]).map(e=>{let t=l.table_rows?.find(t=>t.id===e.data.id),r=e.data.label;return!r&&t?.text&&(r=t.text.length>40?t.text.substring(0,40)+"...":t.text),r||(r=e.data.id.substring(0,8)),{id:e.data.id,label:r,color:e.data.color,metadata:t}}),links:(l.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}))},t=e.nodes,r=e.links;if(h){let n=e.nodes.filter(e=>V.has(e.id)),a=new Set(n.map(e=>e.id));t=n,r=e.links.filter(e=>a.has(e.source)&&a.has(e.target))}return{nodes:t,links:r=r.filter(e=>{var t;let r=(t=e.type)?"semantic"===t||"temporal"===t||"entity"===t?t:["causes","caused_by","enables","prevents"].includes(t)?"causal":"semantic":"semantic";return B.has(r)})}},[l,h,V,B]),H=(0,_.useMemo)(()=>{let e=0,t=0,r=0,n=0,a=0,i={};return F.links.forEach(o=>{a++;let s=o.type||"unknown";"semantic"===s?e++:"temporal"===s?t++:"entity"===s?r++:"causes"===s||"caused_by"===s||"enables"===s||"prevents"===s?n++:i[s]=(i[s]||0)+1}),{semantic:e,temporal:t,entity:r,causal:n,total:a,otherTypes:i}},[F]),q=(0,_.useCallback)(e=>{let t=l?.table_rows?.find(t=>t.id===e.id);t&&b(t)},[l]),K=(0,_.useCallback)(e=>e.color||"#0074d9",[]),G=(0,_.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,_.useEffect)(()=>{y(1)},[h]),(0,_.useEffect)(()=>{i&&I()},[e,i]),(0,S.jsx)("div",{children:c?(0,S.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,S.jsxs)("div",{className:"text-center",children:[(0,S.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,S.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading memories..."})]})}):l?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"mb-4",children:(0,S.jsx)(W.Input,{type:"text",value:h,onChange:e=>f(e.target.value),placeholder:"Filter memories by text...",className:"max-w-md"})}),(0,S.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,S.jsx)("div",{className:"text-sm text-muted-foreground",children:h?`${L.length} of ${l.total_units} memories`:`${l.total_units} total memories`}),(0,S.jsxs)("div",{className:"flex items-center gap-2 bg-muted rounded-lg p-1",children:[(0,S.jsx)("button",{onClick:()=>s("graph"),className:`px-4 py-2 rounded-md text-sm font-medium transition-all ${"graph"===o?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Graph View"}),(0,S.jsx)("button",{onClick:()=>s("table"),className:`px-4 py-2 rounded-md text-sm font-medium transition-all ${"table"===o?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Table View"}),(0,S.jsx)("button",{onClick:()=>s("timeline"),className:`px-4 py-2 rounded-md text-sm font-medium transition-all ${"timeline"===o?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Timeline View"})]})]}),"graph"===o&&(0,S.jsxs)("div",{className:"flex gap-0",children:[(0,S.jsx)("div",{className:"flex-1 min-w-0",children:(0,S.jsx)(he,{data:F,height:700,showLabels:N,onNodeClick:q,maxNodes:C,nodeColorFn:K,linkColorFn:G})}),(0,S.jsx)("button",{onClick:()=>P(!T),className:"flex-shrink-0 w-5 h-[700px] bg-transparent hover:bg-muted/50 flex items-center justify-center transition-colors",title:T?"Hide panel":"Show panel",children:T?(0,S.jsx)(z,{className:"w-3 h-3 text-muted-foreground/60"}):(0,S.jsx)(O,{className:"w-3 h-3 text-muted-foreground/60"})}),(0,S.jsx)("div",{className:`${T?"w-80":"w-0"} transition-all duration-300 overflow-hidden flex-shrink-0`,children:(0,S.jsx)("div",{className:"w-80 h-[700px] bg-card border-l border-border overflow-y-auto",children:x?(0,S.jsx)(ts,{memory:x,onClose:()=>b(null),inPanel:!0}):(0,S.jsxs)("div",{className:"p-4 space-y-5",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:"text-sm font-semibold mb-3 text-foreground",children:"Graph"}),(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:"#0074d9"}}),(0,S.jsx)("span",{className:"text-foreground",children:"Nodes"})]}),(0,S.jsxs)("span",{className:"font-mono text-foreground",children:[Math.min(C??F.nodes.length,F.nodes.length),"/",F.nodes.length]})]}),(0,S.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mt-2 mb-1",children:["Links (",H.total,")"," ",(0,S.jsx)("span",{className:"text-muted-foreground/60",children:"· click to filter"})]}),(0,S.jsxs)("button",{onClick:()=>A("semantic"),className:`w-full flex items-center justify-between text-sm px-2 py-1 rounded transition-all ${B.has("semantic")?"hover:bg-muted":"opacity-40 hover:opacity-60"}`,children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("div",{className:"w-4 h-0.5 bg-[#0074d9]"}),(0,S.jsx)("span",{className:"text-foreground",children:"Semantic"})]}),(0,S.jsx)("span",{className:`font-mono ${0===H.semantic?"text-destructive":"text-foreground"}`,children:H.semantic})]}),(0,S.jsxs)("button",{onClick:()=>A("temporal"),className:`w-full flex items-center justify-between text-sm px-2 py-1 rounded transition-all ${B.has("temporal")?"hover:bg-muted":"opacity-40 hover:opacity-60"}`,children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("div",{className:"w-4 h-0.5 bg-[#009296]"}),(0,S.jsx)("span",{className:"text-foreground",children:"Temporal"})]}),(0,S.jsx)("span",{className:`font-mono ${0===H.temporal?"text-destructive":"text-foreground"}`,children:H.temporal})]}),(0,S.jsxs)("button",{onClick:()=>A("entity"),className:`w-full flex items-center justify-between text-sm px-2 py-1 rounded transition-all ${B.has("entity")?"hover:bg-muted":"opacity-40 hover:opacity-60"}`,children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("div",{className:"w-4 h-0.5 bg-[#f59e0b]"}),(0,S.jsx)("span",{className:"text-foreground",children:"Entity"})]}),(0,S.jsx)("span",{className:"font-mono text-foreground",children:H.entity})]}),(0,S.jsxs)("button",{onClick:()=>A("causal"),className:`w-full flex items-center justify-between text-sm px-2 py-1 rounded transition-all ${B.has("causal")?"hover:bg-muted":"opacity-40 hover:opacity-60"}`,children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("div",{className:"w-4 h-0.5 bg-[#8b5cf6]"}),(0,S.jsx)("span",{className:"text-foreground",children:"Causal"})]}),(0,S.jsx)("span",{className:`font-mono ${0===H.causal?"text-muted-foreground":"text-foreground"}`,children:H.causal})]}),Object.entries(H.otherTypes||{}).map(([e,t])=>(0,S.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,S.jsx)("span",{className:"text-muted-foreground capitalize ml-6",children:e}),(0,S.jsx)("span",{className:"font-mono text-muted-foreground",children:t})]},e))]})]}),(0,S.jsx)("div",{className:"border-t border-border"}),(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:"text-sm font-semibold mb-3 text-foreground",children:"Display"}),(0,S.jsx)("div",{className:"space-y-4",children:(0,S.jsxs)("div",{className:"flex items-center justify-between",children:[(0,S.jsx)(ed,{htmlFor:"show-labels",className:"text-sm text-foreground",children:"Show labels"}),(0,S.jsx)(tn,{id:"show-labels",checked:N,onCheckedChange:k})]})})]}),(0,S.jsx)("div",{className:"border-t border-border"}),(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:"text-sm font-semibold mb-3 text-foreground",children:"Performance"}),(0,S.jsxs)("div",{className:"space-y-4",children:[(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,S.jsx)(ed,{className:"text-sm text-foreground",children:"Max nodes"}),(0,S.jsxs)("span",{className:"text-xs text-muted-foreground",children:[C??"All"," / ",F.nodes.length]})]}),(0,S.jsx)(e2,{value:[C??F.nodes.length],min:10,max:Math.max(F.nodes.length,10),step:10,onValueChange:([e])=>E(e>=F.nodes.length?void 0:e),className:"w-full"})]}),(0,S.jsx)("p",{className:"text-xs text-muted-foreground",children:"All links between visible nodes are shown."})]})]}),(0,S.jsx)("div",{className:"border-t border-border"}),(0,S.jsx)("div",{className:"text-xs text-muted-foreground/60 text-center pt-2",children:"Click a node to see details"})]})})})]}),"table"===o&&(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"w-full",children:(0,S.jsx)("div",{className:"pb-4",children:L.length>0?(t=Math.ceil(L.length/100),n=(r=(v-1)*100)+100,a=L.slice(r,n),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:"border rounded-lg overflow-hidden",children:(0,S.jsxs)(ee,{className:"table-fixed",children:[(0,S.jsx)(et,{children:(0,S.jsxs)(en,{className:"bg-muted/50",children:[(0,S.jsx)(ea,{className:"w-[45%]",children:"Memory"}),(0,S.jsx)(ea,{className:"w-[20%]",children:"Entities"}),(0,S.jsx)(ea,{className:"w-[15%]",children:"Occurred"}),(0,S.jsx)(ea,{className:"w-[15%]",children:"Mentioned"}),(0,S.jsx)(ea,{className:"w-[5%]"})]})}),(0,S.jsx)(er,{children:a.map((e,t)=>{let r=e.occurred_start?new Date(e.occurred_start).toLocaleDateString("en-US",{month:"short",day:"numeric"}):null,n=e.mentioned_at?new Date(e.mentioned_at).toLocaleDateString("en-US",{month:"short",day:"numeric"}):null;return(0,S.jsxs)(en,{onClick:()=>j(e),className:`cursor-pointer hover:bg-muted/50 ${w?.id===e.id?"bg-primary/10":""}`,children:[(0,S.jsxs)(ei,{className:"py-2",children:[(0,S.jsx)("div",{className:"line-clamp-2 text-sm leading-snug text-foreground",children:e.text}),e.context&&(0,S.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.context})]}),(0,S.jsx)(ei,{className:"py-2",children:e.entities?(0,S.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[e.entities.split(", ").slice(0,2).map((e,t)=>(0,S.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:e},t)),e.entities.split(", ").length>2&&(0,S.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["+",e.entities.split(", ").length-2]})]}):(0,S.jsx)("span",{className:"text-xs text-muted-foreground",children:"-"})}),(0,S.jsx)(ei,{className:"text-xs py-2 text-foreground",children:r||(0,S.jsx)("span",{className:"text-muted-foreground",children:"-"})}),(0,S.jsx)(ei,{className:"text-xs py-2 text-foreground",children:n||(0,S.jsx)("span",{className:"text-muted-foreground",children:"-"})}),(0,S.jsx)(ei,{className:"py-2",children:(0,S.jsx)(Y.Button,{onClick:t=>{t.stopPropagation(),R(e.id)},size:"sm",variant:"secondary",className:"h-6 w-6 p-0",title:"Copy ID",children:p===e.id?(0,S.jsx)($.Check,{className:"h-3 w-3 text-green-600"}):(0,S.jsx)(U,{className:"h-3 w-3"})})})]},e.id||t)})})]})}),t>1&&(0,S.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-3 border-t",children:[(0,S.jsxs)("div",{className:"text-xs text-muted-foreground",children:[r+1,"-",Math.min(n,L.length)," of"," ",L.length]}),(0,S.jsxs)("div",{className:"flex items-center gap-1",children:[(0,S.jsx)(Y.Button,{variant:"outline",size:"sm",onClick:()=>y(1),disabled:1===v,className:"h-7 w-7 p-0",children:(0,S.jsx)(Q,{className:"h-3 w-3"})}),(0,S.jsx)(Y.Button,{variant:"outline",size:"sm",onClick:()=>y(e=>Math.max(1,e-1)),disabled:1===v,className:"h-7 w-7 p-0",children:(0,S.jsx)(O,{className:"h-3 w-3"})}),(0,S.jsxs)("span",{className:"text-xs px-2",children:[v," / ",t]}),(0,S.jsx)(Y.Button,{variant:"outline",size:"sm",onClick:()=>y(e=>Math.min(t,e+1)),disabled:v===t,className:"h-7 w-7 p-0",children:(0,S.jsx)(z,{className:"h-3 w-3"})}),(0,S.jsx)(Y.Button,{variant:"outline",size:"sm",onClick:()=>y(t),disabled:v===t,className:"h-7 w-7 p-0",children:(0,S.jsx)(J,{className:"h-3 w-3"})})]})]})]})):(0,S.jsx)("div",{className:"text-center py-12 text-muted-foreground",children:l.table_rows?.length>0?"No memories match your filter":"No memories found"})})}),w&&(0,S.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,S.jsx)(ts,{memory:w,onClose:()=>j(null),inPanel:!0})})]}),"timeline"===o&&(0,S.jsx)(hr,{data:l,filteredRows:L})]}):(0,S.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,S.jsxs)("div",{className:"text-center",children:[(0,S.jsx)("div",{className:"text-4xl mb-2",children:"📊"}),(0,S.jsx)("div",{className:"text-sm text-muted-foreground",children:"No data available"})]})})})}function hr({data:e,filteredRows:t}){let[r,n]=(0,_.useState)(null),[a,i]=(0,_.useState)("month"),[o,s]=(0,_.useState)(0),l=(0,_.useRef)(null),{sortedItems:u,itemsWithoutDates:c}=(0,_.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,_.useMemo)(()=>{if(0===u.length)return[];let e={};return u.forEach(t=>{let r=new Date(t.occurred_start),n=(e=>{let t=e.getFullYear(),r=e.getMonth(),n=e.getDate();switch(a){case"year":return`${t}`;case"month":return`${t}-${String(r+1).padStart(2,"0")}`;case"week":let i=new Date(e);return i.setDate(n-e.getDay()),`${i.getFullYear()}-W${String(Math.ceil(i.getDate()/7)).padStart(2,"0")}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`;case"day":return`${t}-${String(r+1).padStart(2,"0")}-${String(n).padStart(2,"0")}`}})(r);if(!e[n]){let t=r;if("week"===a){let e=n.split("-");t=new Date(parseInt(e[0]),parseInt(e[2])-1,parseInt(e[3]))}e[n]={items:[],date:t}}e[n].items.push(t)}),Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,{items:t,date:r}])=>({key:e,label:((e,t)=>{switch(a){case"year":return e;case"month":return t.toLocaleDateString("en-US",{year:"numeric",month:"short"});case"week":let r=new Date(t);return r.setDate(t.getDate()+6),`${t.toLocaleDateString("en-US",{month:"short",day:"numeric"})} - ${r.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,r),items:t,date:r}))},[u,a]),h=(0,_.useMemo)(()=>0===u.length?null:{first:new Date(u[0].occurred_start),last:new Date(u[u.length-1].occurred_start)},[u]),f=e=>{let t=Math.max(0,Math.min(e,d.length-1));s(t);let r=document.getElementById(`timeline-group-${t}`);r?.scrollIntoView({behavior:"smooth",block:"start"})};if(0===u.length)return(0,S.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,S.jsx)(K,{className:"w-12 h-12 text-muted-foreground mb-3"}),(0,S.jsx)("div",{className:"text-base font-medium text-foreground mb-1",children:"No Timeline Data"}),(0,S.jsxs)("div",{className:"text-xs text-muted-foreground text-center max-w-md",children:["No memories have occurred_at dates.",c.length>0&&(0,S.jsxs)("span",{className:"block mt-1",children:[c.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,S.jsxs)("div",{className:"px-4",children:[(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"flex items-center justify-between mb-3 gap-4",children:[(0,S.jsxs)("div",{className:"text-xs text-muted-foreground",children:[u.length," memories",c.length>0&&` \xb7 ${c.length} without dates`,h&&(0,S.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,S.jsxs)("div",{className:"flex items-center gap-1",children:[(0,S.jsxs)("div",{className:"flex items-center border border-border rounded mr-2",children:[(0,S.jsx)(Y.Button,{variant:"secondary",size:"sm",onClick:()=>{let e=["year","month","week","day"],t=e.indexOf(a);t>0&&i(e[t-1])},disabled:"year"===a,className:"h-7 w-7 p-0",title:"Zoom out",children:(0,S.jsx)(Z,{className:"h-3 w-3"})}),(0,S.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"}[a]}),(0,S.jsx)(Y.Button,{variant:"secondary",size:"sm",onClick:()=>{let e=["year","month","week","day"],t=e.indexOf(a);t<e.length-1&&i(e[t+1])},disabled:"day"===a,className:"h-7 w-7 p-0",title:"Zoom in",children:(0,S.jsx)(G,{className:"h-3 w-3"})})]}),(0,S.jsxs)("div",{className:"flex items-center border border-border rounded",children:[(0,S.jsx)(Y.Button,{variant:"secondary",size:"sm",onClick:()=>f(0),disabled:d.length<=1,className:"h-7 w-7 p-0",title:"First",children:(0,S.jsx)(Q,{className:"h-3 w-3"})}),(0,S.jsx)(Y.Button,{variant:"secondary",size:"sm",onClick:()=>f(o-1),disabled:0===o,className:"h-7 w-7 p-0",title:"Previous",children:(0,S.jsx)(O,{className:"h-3 w-3"})}),(0,S.jsxs)("span",{className:"text-[10px] px-2 min-w-[60px] text-center border-x border-border text-foreground",children:[o+1," / ",d.length]}),(0,S.jsx)(Y.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,S.jsx)(z,{className:"h-3 w-3"})}),(0,S.jsx)(Y.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,S.jsx)(J,{className:"h-3 w-3"})})]})]})]}),(0,S.jsxs)("div",{ref:l,className:"relative max-h-[550px] overflow-y-auto pr-2",children:[(0,S.jsx)("div",{className:"absolute left-[60px] top-0 bottom-0 w-0.5 bg-border"}),d.map((e,t)=>(0,S.jsxs)("div",{id:`timeline-group-${t}`,className:"mb-4",children:[(0,S.jsxs)("div",{className:"flex items-center mb-2 cursor-pointer hover:opacity-80",onClick:()=>s(t),children:[(0,S.jsx)("div",{className:"w-[60px] text-right pr-3",children:(0,S.jsx)("span",{className:"text-xs font-semibold text-primary",children:e.label})}),(0,S.jsx)("div",{className:"w-2 h-2 rounded-full bg-primary z-10"}),(0,S.jsxs)("span",{className:"ml-2 text-[10px] text-muted-foreground",children:[e.items.length," ",1===e.items.length?"item":"items"]})]}),(0,S.jsx)("div",{className:"space-y-1",children:e.items.map((e,t)=>(0,S.jsxs)("div",{onClick:()=>n(e),className:`flex items-start cursor-pointer group ${r?.id===e.id?"opacity-100":"hover:opacity-80"}`,children:[(0,S.jsxs)("div",{className:"w-[60px] text-right pr-3 pt-1 flex-shrink-0",children:[(0,S.jsx)("div",{className:"text-[10px] text-muted-foreground",children:p(e.occurred_start).date}),(0,S.jsx)("div",{className:"text-[9px] text-muted-foreground/70",children:p(e.occurred_start).time})]}),(0,S.jsx)("div",{className:"flex-shrink-0 pt-2",children:(0,S.jsx)("div",{className:`w-1.5 h-1.5 rounded-full z-10 ${r?.id===e.id?"bg-primary":"bg-muted-foreground/50 group-hover:bg-primary"}`})}),(0,S.jsxs)("div",{className:`ml-3 flex-1 p-2 rounded border transition-colors ${r?.id===e.id?"bg-primary/10 border-primary":"bg-card border-border hover:border-primary/50"}`,children:[(0,S.jsx)("p",{className:"text-xs text-foreground line-clamp-2 leading-relaxed",children:e.text}),e.context&&(0,S.jsx)("p",{className:"text-[10px] text-muted-foreground mt-1 truncate",children:e.context}),e.entities&&(0,S.jsxs)("div",{className:"flex gap-1 mt-1 flex-wrap",children:[e.entities.split(", ").slice(0,3).map((e,t)=>(0,S.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,S.jsxs)("span",{className:"text-[9px] text-muted-foreground",children:["+",e.entities.split(", ").length-3]})]})]})]},e.id||t))})]},e.key))]})]}),r&&(0,S.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,S.jsx)(ts,{memory:r,onClose:()=>n(null),inPanel:!0})})]})}function hn(){let{currentBank:e}=(0,D.useBank)(),[t,r]=(0,_.useState)([]),[n,a]=(0,_.useState)(!1),[i,o]=(0,_.useState)(""),[s,l]=(0,_.useState)(0),[u,c]=(0,_.useState)(null),[d,h]=(0,_.useState)(!1),f=async()=>{if(e){a(!0);try{let t=await X.client.listDocuments({bank_id:e,q:i,limit:100});r(t.items||[]),l(t.total||0)}catch(e){console.error("Error loading documents:",e),alert("Error loading documents: "+e.message)}finally{a(!1)}}},p=async t=>{if(e){h(!0),c({id:t});try{let r=await X.client.getDocument(t,e);c(r)}catch(e){console.error("Error loading document:",e),alert("Error loading document: "+e.message),c(null)}finally{h(!1)}}};return(0,_.useEffect)(()=>{e&&f()},[e]),(0,S.jsxs)("div",{children:[n?(0,S.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,S.jsxs)("div",{className:"text-center",children:[(0,S.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,S.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading documents..."})]})}):t.length>0?(0,S.jsxs)("div",{className:"mb-4 text-sm text-muted-foreground",children:[s," total documents"]}):(0,S.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,S.jsxs)("div",{className:"text-center",children:[(0,S.jsx)("div",{className:"text-4xl mb-2",children:"📄"}),(0,S.jsx)("div",{className:"text-sm text-muted-foreground",children:"No documents found"})]})}),t.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{className:"w-full",children:[(0,S.jsx)("div",{className:"px-5 mb-4",children:(0,S.jsx)(W.Input,{type:"text",value:i,onChange:e=>o(e.target.value),placeholder:"Search documents (ID)...",className:"max-w-2xl"})}),(0,S.jsx)("div",{className:"overflow-x-auto px-5 pb-5",children:(0,S.jsxs)(ee,{children:[(0,S.jsx)(et,{children:(0,S.jsxs)(en,{children:[(0,S.jsx)(ea,{children:"Document ID"}),(0,S.jsx)(ea,{children:"Created"}),(0,S.jsx)(ea,{children:"Context"}),(0,S.jsx)(ea,{children:"Text Length"}),(0,S.jsx)(ea,{children:"Memory Units"}),(0,S.jsx)(ea,{children:"Actions"})]})}),(0,S.jsx)(er,{children:t.length>0?t.map(e=>(0,S.jsxs)(en,{className:`cursor-pointer hover:bg-muted/50 ${u?.id===e.id?"bg-primary/10":""}`,onClick:()=>p(e.id),children:[(0,S.jsx)(ei,{title:e.id,className:"text-card-foreground",children:e.id.length>30?e.id.substring(0,30)+"...":e.id}),(0,S.jsx)(ei,{className:"text-card-foreground",children:e.created_at?new Date(e.created_at).toLocaleString():"N/A"}),(0,S.jsx)(ei,{className:"text-card-foreground",children:e.retain_params?.context||"-"}),(0,S.jsxs)(ei,{className:"text-card-foreground",children:[e.text_length?.toLocaleString()," chars"]}),(0,S.jsx)(ei,{className:"text-card-foreground",children:e.memory_unit_count}),(0,S.jsx)(ei,{children:(0,S.jsx)(Y.Button,{onClick:t=>{t.stopPropagation(),p(e.id)},size:"sm",variant:u?.id===e.id?"default":"secondary",title:"View original text",children:"View Text"})})]},e.id)):(0,S.jsx)(en,{children:(0,S.jsx)(ei,{colSpan:6,className:"text-center",children:'Click "Load Documents" to view data'})})})]})})]}),u&&(0,S.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,S.jsxs)("div",{className:"p-5",children:[(0,S.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:"text-xl font-bold text-foreground",children:"Document Details"}),(0,S.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Original document text and metadata"})]}),(0,S.jsxs)(Y.Button,{variant:"secondary",size:"sm",onClick:()=>c(null),className:"h-9 px-3 gap-2",children:[(0,S.jsx)(ta.X,{className:"h-4 w-4"}),"Close"]})]}),d?(0,S.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,S.jsxs)("div",{className:"text-center",children:[(0,S.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,S.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading document..."})]})}):(0,S.jsxs)("div",{className:"space-y-5",children:[(0,S.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Document ID"}),(0,S.jsx)("div",{className:"text-sm font-mono break-all text-card-foreground",children:u.id})]}),u.created_at&&(0,S.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,S.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Created"}),(0,S.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:new Date(u.created_at).toLocaleString()})]}),(0,S.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Memory Units"}),(0,S.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:u.memory_unit_count})]})]}),u.original_text&&(0,S.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Text Length"}),(0,S.jsxs)("div",{className:"text-sm font-medium text-card-foreground",children:[u.original_text.length.toLocaleString()," characters"]})]}),u.retain_params&&(0,S.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Retain Parameters"}),(0,S.jsxs)("div",{className:"text-sm space-y-2 text-card-foreground",children:[u.retain_params.context&&(0,S.jsxs)("div",{children:[(0,S.jsx)("span",{className:"font-semibold",children:"Context:"})," ",u.retain_params.context]}),u.retain_params.event_date&&(0,S.jsxs)("div",{children:[(0,S.jsx)("span",{className:"font-semibold",children:"Event Date:"})," ",new Date(u.retain_params.event_date).toLocaleString()]}),u.retain_params.metadata&&(0,S.jsxs)("div",{className:"mt-2",children:[(0,S.jsx)("span",{className:"font-semibold",children:"Metadata:"}),(0,S.jsx)("pre",{className:"mt-1 text-xs bg-background p-2 rounded text-card-foreground",children:JSON.stringify(u.retain_params.metadata,null,2)})]})]})]}),u.original_text&&(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Original Text"}),(0,S.jsx)("div",{className:"p-4 bg-muted/50 rounded-lg border border-border max-h-[400px] overflow-y-auto",children:(0,S.jsx)("pre",{className:"text-sm whitespace-pre-wrap font-mono leading-relaxed text-card-foreground",children:u.original_text})})]})]})]})})]})]})}function ha(){let{currentBank:e}=(0,D.useBank)(),[t,r]=(0,_.useState)([]),[n,a]=(0,_.useState)(!1),[i,o]=(0,_.useState)(null),[s,l]=(0,_.useState)(!1),[u,c]=(0,_.useState)(!1),d=async()=>{if(e){a(!0);try{let t=await X.client.listEntities({bank_id:e,limit:100});r(t.items||[])}catch(e){console.error("Error loading entities:",e),alert("Error loading entities: "+e.message)}finally{a(!1)}}},h=async t=>{if(e){l(!0);try{let r=await X.client.getEntity(t,e);o(r)}catch(e){console.error("Error loading entity detail:",e),alert("Error loading entity detail: "+e.message)}finally{l(!1)}}},f=async()=>{if(e&&i){c(!0);try{await X.client.regenerateEntityObservations(i.id,e),await h(i.id)}catch(e){console.error("Error regenerating observations:",e),alert("Error regenerating observations: "+e.message)}finally{c(!1)}}};(0,_.useEffect)(()=>{e&&(d(),o(null))},[e]);let p=e=>e?new Date(e).toLocaleDateString():"N/A";return(0,S.jsxs)("div",{children:[(0,S.jsx)("div",{children:n?(0,S.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,S.jsxs)("div",{className:"text-center",children:[(0,S.jsx)("div",{className:"text-4xl mb-2",children:"⏳"}),(0,S.jsx)("div",{className:"text-sm text-muted-foreground",children:"Loading entities..."})]})}):t.length>0?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{className:"mb-4 text-sm text-muted-foreground",children:[t.length," entities"]}),(0,S.jsx)("div",{className:"overflow-x-auto",children:(0,S.jsxs)(ee,{children:[(0,S.jsx)(et,{children:(0,S.jsxs)(en,{children:[(0,S.jsx)(ea,{children:"Name"}),(0,S.jsx)(ea,{children:"Mentions"}),(0,S.jsx)(ea,{children:"First Seen"}),(0,S.jsx)(ea,{children:"Last Seen"})]})}),(0,S.jsx)(er,{children:t.map(e=>(0,S.jsxs)(en,{onClick:()=>h(e.id),className:`cursor-pointer hover:bg-muted/50 ${i?.id===e.id?"bg-primary/10":""}`,children:[(0,S.jsx)(ei,{className:"font-medium text-card-foreground",children:e.canonical_name}),(0,S.jsx)(ei,{className:"text-card-foreground",children:e.mention_count}),(0,S.jsx)(ei,{className:"text-card-foreground",children:p(e.first_seen)}),(0,S.jsx)(ei,{className:"text-card-foreground",children:p(e.last_seen)})]},e.id))})]})})]}):(0,S.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,S.jsxs)("div",{className:"text-center",children:[(0,S.jsx)("div",{className:"text-4xl mb-2",children:"👥"}),(0,S.jsx)("div",{className:"text-sm text-muted-foreground",children:"No entities found"}),(0,S.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:"Entities are extracted from facts when memories are added."})]})})}),i&&(0,S.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,S.jsxs)("div",{className:"p-5",children:[(0,S.jsxs)("div",{className:"flex justify-between items-center mb-6 pb-4 border-b border-border",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h3",{className:"text-xl font-bold text-card-foreground",children:i.canonical_name}),(0,S.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Entity details"})]}),(0,S.jsx)(Y.Button,{variant:"ghost",size:"sm",onClick:()=>o(null),className:"h-8 w-8 p-0",children:(0,S.jsx)("span",{className:"text-lg",children:"×"})})]}),(0,S.jsxs)("div",{className:"space-y-5",children:[(0,S.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,S.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Mentions"}),(0,S.jsx)("div",{className:"text-lg font-semibold text-card-foreground",children:i.mention_count})]}),(0,S.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"First Seen"}),(0,S.jsx)("div",{className:"text-sm font-medium text-card-foreground",children:p(i.first_seen)})]})]}),(0,S.jsxs)("div",{className:"p-4 bg-muted/50 rounded-lg",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase mb-2",children:"Entity ID"}),(0,S.jsx)("code",{className:"text-xs font-mono break-all text-muted-foreground",children:i.id})]}),(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,S.jsx)("div",{className:"text-xs font-bold text-muted-foreground uppercase",children:"Observations"}),(0,S.jsx)(Y.Button,{onClick:f,disabled:u,variant:"outline",size:"sm",children:u?"Regenerating...":"Regenerate"})]}),s?(0,S.jsx)("div",{className:"text-muted-foreground text-sm",children:"Loading observations..."}):i.observations&&i.observations.length>0?(0,S.jsx)("ul",{className:"space-y-2",children:i.observations.map((e,t)=>(0,S.jsxs)("li",{className:"p-3 bg-muted/50 rounded-lg",children:[(0,S.jsx)("div",{className:"text-sm text-card-foreground",children:e.text}),e.mentioned_at&&(0,S.jsx)("div",{className:"text-xs text-muted-foreground mt-2",children:p(e.mentioned_at)})]},t))}):(0,S.jsx)("div",{className:"text-muted-foreground text-sm p-4 bg-muted/50 rounded-lg",children:'No observations yet. Click "Regenerate" to generate observations from facts.'})]})]})]})})]})}var hi=e.i(1864),ho=e.i(26330),hs=e.i(3536),hl=e.i(65491),hu=e.i(10772),hc=e.i(53660),hd=e.i(74606),hh=Symbol("radix.slottable");function hf(e){return _.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===hh}var hp=e.i(30207),hg=e.i(34620),hm=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});_.forwardRef((e,t)=>(0,S.jsx)(ew.Primitive.span,{...e,ref:t,style:{...hm,...e.style}})).displayName="VisuallyHidden";var hv=e.i(86312),hy=e.i(85369),hx=[" ","Enter","ArrowUp","ArrowDown"],hb=[" ","Enter"],hw="Select",[hj,hN,hk]=eC(hw),[hC,hE]=(0,eg.createContextScope)(hw,[hk,hc.createPopperScope]),hS=(0,hc.createPopperScope)(),[hT,hP]=hC(hw),[h_,hD]=hC(hw),hB=e=>{let{__scopeSelect:t,children:r,open:n,defaultOpen:a,onOpenChange:i,value:o,defaultValue:s,onValueChange:l,dir:u,name:c,autoComplete:d,disabled:h,required:f,form:p}=e,g=hS(t),[v,y]=_.useState(null),[x,b]=_.useState(null),[w,j]=_.useState(!1),N=ey(u),[k,C]=(0,em.useControllableState)({prop:n,defaultProp:a??!1,onChange:i,caller:hw}),[E,T]=(0,em.useControllableState)({prop:o,defaultProp:s,onChange:l,caller:hw}),P=_.useRef(null),D=!v||p||!!v.closest("form"),[B,M]=_.useState(new Set),A=Array.from(B).map(e=>e.props.value).join(";");return(0,S.jsx)(hc.Root,{...g,children:(0,S.jsxs)(hT,{required:f,scope:t,trigger:v,onTriggerChange:y,valueNode:x,onValueNodeChange:b,valueNodeHasChildren:w,onValueNodeHasChildrenChange:j,contentId:(0,hu.useId)(),value:E,onValueChange:T,open:k,onOpenChange:C,dir:N,triggerPointerDownPosRef:P,disabled:h,children:[(0,S.jsx)(hj.Provider,{scope:t,children:(0,S.jsx)(h_,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(e=>{M(t=>new Set(t).add(e))},[]),onNativeOptionRemove:_.useCallback(e=>{M(t=>{let r=new Set(t);return r.delete(e),r})},[]),children:r})}),D?(0,S.jsxs)(fs,{"aria-hidden":!0,required:f,tabIndex:-1,name:c,autoComplete:d,value:E,onChange:e=>T(e.target.value),disabled:h,form:p,children:[void 0===E?(0,S.jsx)("option",{value:""}):null,Array.from(B)]},A):null]})})};hB.displayName=hw;var hM="SelectTrigger",hA=_.forwardRef((e,t)=>{let{__scopeSelect:r,disabled:n=!1,...a}=e,i=hS(r),o=hP(hM,r),s=o.disabled||n,l=(0,ep.useComposedRefs)(t,o.onTriggerChange),u=hN(r),c=_.useRef("touch"),[d,h,f]=fu(e=>{let t=u().filter(e=>!e.disabled),r=t.find(e=>e.value===o.value),n=fc(t,e,r);void 0!==n&&o.onValueChange(n.value)}),p=e=>{s||(o.onOpenChange(!0),f()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,S.jsx)(hc.Anchor,{asChild:!0,...i,children:(0,S.jsx)(ew.Primitive.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":fl(o.value)?"":void 0,...a,ref:l,onClick:(0,ef.composeEventHandlers)(a.onClick,e=>{e.currentTarget.focus(),"mouse"!==c.current&&p(e)}),onPointerDown:(0,ef.composeEventHandlers)(a.onPointerDown,e=>{c.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(p(e),e.preventDefault())}),onKeyDown:(0,ef.composeEventHandlers)(a.onKeyDown,e=>{let t=""!==d.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||h(e.key),(!t||" "!==e.key)&&hx.includes(e.key)&&(p(),e.preventDefault())})})})});hA.displayName=hM;var hR="SelectValue",hI=_.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:a,children:i,placeholder:o="",...s}=e,l=hP(hR,r),{onValueNodeHasChildrenChange:u}=l,c=void 0!==i,d=(0,ep.useComposedRefs)(t,l.onValueNodeChange);return(0,hg.useLayoutEffect)(()=>{u(c)},[u,c]),(0,S.jsx)(ew.Primitive.span,{...s,ref:d,style:{pointerEvents:"none"},children:fl(l.value)?(0,S.jsx)(S.Fragment,{children:o}):i})});hI.displayName=hR;var hL=_.forwardRef((e,t)=>{let{__scopeSelect:r,children:n,...a}=e;return(0,S.jsx)(ew.Primitive.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});hL.displayName="SelectIcon";var hO=e=>(0,S.jsx)(hd.Portal,{asChild:!0,...e});hO.displayName="SelectPortal";var hz="SelectContent",hV=_.forwardRef((e,t)=>{let r=hP(hz,e.__scopeSelect),[n,a]=_.useState();return((0,hg.useLayoutEffect)(()=>{a(new DocumentFragment)},[]),r.open)?(0,S.jsx)(hX,{...e,ref:t}):n?eo.createPortal((0,S.jsx)(hF,{scope:e.__scopeSelect,children:(0,S.jsx)(hj.Slot,{scope:e.__scopeSelect,children:(0,S.jsx)("div",{children:e.children})})}),n):null});hV.displayName=hz;var[hF,hH]=hC(hz),hq=((n=_.forwardRef((e,t)=>{let{children:r,...n}=e;if(_.isValidElement(r)){var a;let e,i,o=(a=r,(i=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(i=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),s=function(e,t){let r={...t};for(let n in t){let a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...e)=>{let t=i(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...i}:"className"===n&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==_.Fragment&&(s.ref=t?(0,ep.composeRefs)(t,o):o),_.cloneElement(r,s)}return _.Children.count(r)>1?_.Children.only(null):null})).displayName="SelectContent.RemoveScroll.SlotClone",t=n,(r=_.forwardRef((e,r)=>{let{children:n,...a}=e,i=_.Children.toArray(n),o=i.find(hf);if(o){let e=o.props.children,n=i.map(t=>t!==o?t:_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null);return(0,S.jsx)(t,{...a,ref:r,children:_.isValidElement(e)?_.cloneElement(e,void 0,n):null})}return(0,S.jsx)(t,{...a,ref:r,children:n})})).displayName="SelectContent.RemoveScroll.Slot",r),hX=_.forwardRef((e,t)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:h,collisionPadding:f,sticky:p,hideWhenDetached:g,avoidCollisions:v,...y}=e,x=hP(hz,r),[b,w]=_.useState(null),[j,N]=_.useState(null),k=(0,ep.useComposedRefs)(t,e=>w(e)),[C,E]=_.useState(null),[T,P]=_.useState(null),D=hN(r),[B,M]=_.useState(!1),A=_.useRef(!1);_.useEffect(()=>{if(b)return(0,hv.hideOthers)(b)},[b]),(0,hs.useFocusGuards)();let R=_.useCallback(e=>{let[t,...r]=D().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(let r of e)if(r===a||(r?.scrollIntoView({block:"nearest"}),r===t&&j&&(j.scrollTop=0),r===n&&j&&(j.scrollTop=j.scrollHeight),r?.focus(),document.activeElement!==a))return},[D,j]),I=_.useCallback(()=>R([C,b]),[R,C,b]);_.useEffect(()=>{B&&I()},[B,I]);let{onOpenChange:L,triggerPointerDownPosRef:O}=x;_.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(O.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(O.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():b.contains(r.target)||L(!1),document.removeEventListener("pointermove",t),O.current=null};return null!==O.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[b,L,O]),_.useEffect(()=>{let e=()=>L(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[L]);let[z,V]=fu(e=>{let t=D().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=fc(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),F=_.useCallback((e,t,r)=>{let n=!A.current&&!r;(void 0!==x.value&&x.value===t||n)&&(E(e),n&&(A.current=!0))},[x.value]),H=_.useCallback(()=>b?.focus(),[b]),q=_.useCallback((e,t,r)=>{let n=!A.current&&!r;(void 0!==x.value&&x.value===t||n)&&P(e)},[x.value]),X="popper"===n?hW:hY,Y=X===hW?{side:s,sideOffset:l,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:h,collisionPadding:f,sticky:p,hideWhenDetached:g,avoidCollisions:v}:{};return(0,S.jsx)(hF,{scope:r,content:b,viewport:j,onViewportChange:N,itemRefCallback:F,selectedItem:C,onItemLeave:H,itemTextRefCallback:q,focusSelectedItem:I,selectedItemText:T,position:n,isPositioned:B,searchRef:z,children:(0,S.jsx)(hy.RemoveScroll,{as:hq,allowPinchZoom:!0,children:(0,S.jsx)(hl.FocusScope,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:(0,ef.composeEventHandlers)(a,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,S.jsx)(ho.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:(0,S.jsx)(X,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...y,...Y,onPlaced:()=>M(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:(0,ef.composeEventHandlers)(y.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||V(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=D().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>R(t)),e.preventDefault()}})})})})})})});hX.displayName="SelectContentImpl";var hY=_.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:n,...a}=e,i=hP(hz,r),o=hH(hz,r),[s,l]=_.useState(null),[u,c]=_.useState(null),d=(0,ep.useComposedRefs)(t,e=>c(e)),h=hN(r),f=_.useRef(!1),p=_.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:y,focusSelectedItem:x}=o,b=_.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&u&&g&&v&&y){let e=i.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),r=i.valueNode.getBoundingClientRect(),a=y.getBoundingClientRect();if("rtl"!==i.dir){let n=a.left-t.left,i=r.left-n,o=e.left-i,l=e.width+o,u=Math.max(l,t.width),c=eh(i,[10,Math.max(10,window.innerWidth-10-u)]);s.style.minWidth=l+"px",s.style.left=c+"px"}else{let n=t.right-a.right,i=window.innerWidth-r.right-n,o=window.innerWidth-e.right-i,l=e.width+o,u=Math.max(l,t.width),c=eh(i,[10,Math.max(10,window.innerWidth-10-u)]);s.style.minWidth=l+"px",s.style.right=c+"px"}let o=h(),l=window.innerHeight-20,c=g.scrollHeight,d=window.getComputedStyle(u),p=parseInt(d.borderTopWidth,10),x=parseInt(d.paddingTop,10),b=parseInt(d.borderBottomWidth,10),w=p+x+c+parseInt(d.paddingBottom,10)+b,j=Math.min(5*v.offsetHeight,w),N=window.getComputedStyle(g),k=parseInt(N.paddingTop,10),C=parseInt(N.paddingBottom,10),E=e.top+e.height/2-10,S=v.offsetHeight/2,T=p+x+(v.offsetTop+S);if(T<=E){let e=o.length>0&&v===o[o.length-1].ref.current;s.style.bottom="0px";let t=Math.max(l-E,S+(e?C:0)+(u.clientHeight-g.offsetTop-g.offsetHeight)+b);s.style.height=T+t+"px"}else{let e=o.length>0&&v===o[0].ref.current;s.style.top="0px";let t=Math.max(E,p+g.offsetTop+(e?k:0)+S);s.style.height=t+(w-T)+"px",g.scrollTop=T-E+g.offsetTop}s.style.margin="10px 0",s.style.minHeight=j+"px",s.style.maxHeight=l+"px",n?.(),requestAnimationFrame(()=>f.current=!0)}},[h,i.trigger,i.valueNode,s,u,g,v,y,i.dir,n]);(0,hg.useLayoutEffect)(()=>b(),[b]);let[w,j]=_.useState();(0,hg.useLayoutEffect)(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);let N=_.useCallback(e=>{e&&!0===p.current&&(b(),x?.(),p.current=!1)},[b,x]);return(0,S.jsx)(hU,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:f,onScrollButtonChange:N,children:(0,S.jsx)("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:(0,S.jsx)(ew.Primitive.div,{...a,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});hY.displayName="SelectItemAlignedPosition";var hW=_.forwardRef((e,t)=>{let{__scopeSelect:r,align:n="start",collisionPadding:a=10,...i}=e,o=hS(r);return(0,S.jsx)(hc.Content,{...o,...i,ref:t,align:n,collisionPadding:a,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});hW.displayName="SelectPopperPosition";var[hU,h$]=hC(hz,{}),hK="SelectViewport",hG=_.forwardRef((e,t)=>{let{__scopeSelect:r,nonce:n,...a}=e,i=hH(hK,r),o=h$(hK,r),s=(0,ep.useComposedRefs)(t,i.onViewportChange),l=_.useRef(0);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),(0,S.jsx)(hj.Slot,{scope:r,children:(0,S.jsx)(ew.Primitive.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:(0,ef.composeEventHandlers)(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=o;if(n?.current&&r){let e=Math.abs(l.current-t.scrollTop);if(e>0){let n=window.innerHeight-20,a=Math.max(parseFloat(r.style.minHeight),parseFloat(r.style.height));if(a<n){let i=a+e,o=Math.min(n,i),s=i-o;r.style.height=o+"px","0px"===r.style.bottom&&(t.scrollTop=s>0?s:0,r.style.justifyContent="flex-end")}}}l.current=t.scrollTop})})})]})});hG.displayName=hK;var hZ="SelectGroup",[hQ,hJ]=hC(hZ);_.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=(0,hu.useId)();return(0,S.jsx)(hQ,{scope:r,id:a,children:(0,S.jsx)(ew.Primitive.div,{role:"group","aria-labelledby":a,...n,ref:t})})}).displayName=hZ;var h0="SelectLabel",h1=_.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=hJ(h0,r);return(0,S.jsx)(ew.Primitive.div,{id:a.id,...n,ref:t})});h1.displayName=h0;var h2="SelectItem",[h5,h3]=hC(h2),h4=_.forwardRef((e,t)=>{let{__scopeSelect:r,value:n,disabled:a=!1,textValue:i,...o}=e,s=hP(h2,r),l=hH(h2,r),u=s.value===n,[c,d]=_.useState(i??""),[h,f]=_.useState(!1),p=(0,ep.useComposedRefs)(t,e=>l.itemRefCallback?.(e,n,a)),g=(0,hu.useId)(),v=_.useRef("touch"),y=()=>{a||(s.onValueChange(n),s.onOpenChange(!1))};if(""===n)throw Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,S.jsx)(h5,{scope:r,value:n,disabled:a,textId:g,isSelected:u,onItemTextChange:_.useCallback(e=>{d(t=>t||(e?.textContent??"").trim())},[]),children:(0,S.jsx)(hj.ItemSlot,{scope:r,value:n,disabled:a,textValue:c,children:(0,S.jsx)(ew.Primitive.div,{role:"option","aria-labelledby":g,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:p,onFocus:(0,ef.composeEventHandlers)(o.onFocus,()=>f(!0)),onBlur:(0,ef.composeEventHandlers)(o.onBlur,()=>f(!1)),onClick:(0,ef.composeEventHandlers)(o.onClick,()=>{"mouse"!==v.current&&y()}),onPointerUp:(0,ef.composeEventHandlers)(o.onPointerUp,()=>{"mouse"===v.current&&y()}),onPointerDown:(0,ef.composeEventHandlers)(o.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:(0,ef.composeEventHandlers)(o.onPointerMove,e=>{v.current=e.pointerType,a?l.onItemLeave?.():"mouse"===v.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:(0,ef.composeEventHandlers)(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:(0,ef.composeEventHandlers)(o.onKeyDown,e=>{(l.searchRef?.current===""||" "!==e.key)&&(hb.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});h4.displayName=h2;var h6="SelectItemText",h7=_.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:a,...i}=e,o=hP(h6,r),s=hH(h6,r),l=h3(h6,r),u=hD(h6,r),[c,d]=_.useState(null),h=(0,ep.useComposedRefs)(t,e=>d(e),l.onItemTextChange,e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),f=c?.textContent,p=_.useMemo(()=>(0,S.jsx)("option",{value:l.value,disabled:l.disabled,children:f},l.value),[l.disabled,l.value,f]),{onNativeOptionAdd:g,onNativeOptionRemove:v}=u;return(0,hg.useLayoutEffect)(()=>(g(p),()=>v(p)),[g,v,p]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(ew.Primitive.span,{id:l.textId,...i,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?eo.createPortal(i.children,o.valueNode):null]})});h7.displayName=h6;var h9="SelectItemIndicator",h8=_.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return h3(h9,r).isSelected?(0,S.jsx)(ew.Primitive.span,{"aria-hidden":!0,...n,ref:t}):null});h8.displayName=h9;var fe="SelectScrollUpButton",ft=_.forwardRef((e,t)=>{let r=hH(fe,e.__scopeSelect),n=h$(fe,e.__scopeSelect),[a,i]=_.useState(!1),o=(0,ep.useComposedRefs)(t,n.onScrollButtonChange);return(0,hg.useLayoutEffect)(()=>{if(r.viewport&&r.isPositioned){let e=function(){i(t.scrollTop>0)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),a?(0,S.jsx)(fa,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});ft.displayName=fe;var fr="SelectScrollDownButton",fn=_.forwardRef((e,t)=>{let r=hH(fr,e.__scopeSelect),n=h$(fr,e.__scopeSelect),[a,i]=_.useState(!1),o=(0,ep.useComposedRefs)(t,n.onScrollButtonChange);return(0,hg.useLayoutEffect)(()=>{if(r.viewport&&r.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;i(Math.ceil(t.scrollTop)<e)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),a?(0,S.jsx)(fa,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});fn.displayName=fr;var fa=_.forwardRef((e,t)=>{let{__scopeSelect:r,onAutoScroll:n,...a}=e,i=hH("SelectScrollButton",r),o=_.useRef(null),s=hN(r),l=_.useCallback(()=>{null!==o.current&&(window.clearInterval(o.current),o.current=null)},[]);return _.useEffect(()=>()=>l(),[l]),(0,hg.useLayoutEffect)(()=>{let e=s().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,S.jsx)(ew.Primitive.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:(0,ef.composeEventHandlers)(a.onPointerDown,()=>{null===o.current&&(o.current=window.setInterval(n,50))}),onPointerMove:(0,ef.composeEventHandlers)(a.onPointerMove,()=>{i.onItemLeave?.(),null===o.current&&(o.current=window.setInterval(n,50))}),onPointerLeave:(0,ef.composeEventHandlers)(a.onPointerLeave,()=>{l()})})}),fi=_.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return(0,S.jsx)(ew.Primitive.div,{"aria-hidden":!0,...n,ref:t})});fi.displayName="SelectSeparator";var fo="SelectArrow";_.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=hS(r),i=hP(fo,r),o=hH(fo,r);return i.open&&"popper"===o.position?(0,S.jsx)(hc.Arrow,{...a,...n,ref:t}):null}).displayName=fo;var fs=_.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{let a=_.useRef(null),i=(0,ep.useComposedRefs)(n,a),o=(0,ex.usePrevious)(t);return _.useEffect(()=>{let e=a.current;if(!e)return;let r=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(o!==t&&r){let n=new Event("change",{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,S.jsx)(ew.Primitive.select,{...r,style:{...hm,...r.style},ref:i,defaultValue:t})});function fl(e){return""===e||void 0===e}function fu(e){let t=(0,hp.useCallbackRef)(e),r=_.useRef(""),n=_.useRef(0),a=_.useCallback(e=>{let a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),i=_.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,a,i]}function fc(e,t,r){var n,a;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=r?e.indexOf(r):-1,s=(n=e,a=Math.max(o,0),n.map((e,t)=>n[(a+t)%n.length]));1===i.length&&(s=s.filter(e=>e!==r));let l=s.find(e=>e.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==r?l:void 0}fs.displayName="SelectBubbleInput";let fd=(0,M.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),fh=(0,M.default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),ff=_.forwardRef(({className:e,children:t,...r},n)=>(0,S.jsxs)(hA,{ref:n,className:(0,F.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,(0,S.jsx)(hL,{asChild:!0,children:(0,S.jsx)(fd,{className:"h-4 w-4 opacity-50"})})]}));ff.displayName=hA.displayName;let fp=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)(ft,{ref:r,className:(0,F.cn)("flex cursor-default items-center justify-center py-1",e),...t,children:(0,S.jsx)(fh,{className:"h-4 w-4"})}));fp.displayName=ft.displayName;let fg=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)(fn,{ref:r,className:(0,F.cn)("flex cursor-default items-center justify-center py-1",e),...t,children:(0,S.jsx)(fd,{className:"h-4 w-4"})}));fg.displayName=fn.displayName;let fm=_.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>(0,S.jsx)(hO,{children:(0,S.jsxs)(hV,{ref:a,className:(0,F.cn)("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover 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-select-content-transform-origin]","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[(0,S.jsx)(fp,{}),(0,S.jsx)(hG,{className:(0,F.cn)("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,S.jsx)(fg,{})]})}));fm.displayName=hV.displayName,_.forwardRef(({className:e,...t},r)=>(0,S.jsx)(h1,{ref:r,className:(0,F.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t})).displayName=h1.displayName;let fv=_.forwardRef(({className:e,children:t,...r},n)=>(0,S.jsxs)(h4,{ref:n,className:(0,F.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[(0,S.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,S.jsx)(h8,{children:(0,S.jsx)($.Check,{className:"h-4 w-4"})})}),(0,S.jsx)(h7,{children:t})]}));fv.displayName=h4.displayName,_.forwardRef(({className:e,...t},r)=>(0,S.jsx)(fi,{ref:r,className:(0,F.cn)("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=fi.displayName;var fy=e.i(32089);let fx=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("div",{ref:r,className:(0,F.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));fx.displayName="Card";let fb=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("div",{ref:r,className:(0,F.cn)("flex flex-col space-y-1.5 p-6",e),...t}));fb.displayName="CardHeader";let fw=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("div",{ref:r,className:(0,F.cn)("text-2xl font-semibold leading-none tracking-tight",e),...t}));fw.displayName="CardTitle";let fj=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("div",{ref:r,className:(0,F.cn)("text-sm text-muted-foreground",e),...t}));fj.displayName="CardDescription";let fN=_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("div",{ref:r,className:(0,F.cn)("p-6 pt-0",e),...t}));fN.displayName="CardContent",_.forwardRef(({className:e,...t},r)=>(0,S.jsx)("div",{ref:r,className:(0,F.cn)("flex items-center p-6 pt-0",e),...t})).displayName="CardFooter";let fk=(0,M.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);"function"==typeof SuppressedError&&SuppressedError;var fC=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));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||r.forEach(function(t){e.addRange(t)}),t&&t.focus()}},fE={"text/plain":"Text","text/html":"Url",default:"Text"},fS=function(e,t){var r,n,a,i,o,s,l,u,c=!1;t||(t={}),a=t.debug||!1;try{if(o=fC(),s=document.createRange(),l=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){a&&console.warn("unable to use e.clipboardData"),a&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var n=fE[t.format]||fE.default;window.clipboardData.setData(n,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))}),document.body.appendChild(u),s.selectNodeContents(u),l.addRange(s),!document.execCommand("copy"))throw Error("copy command was unsuccessful");c=!0}catch(o){a&&console.error("unable to copy using execCommand: ",o),a&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(o){a&&console.error("unable to copy using clipboardData: ",o),a&&console.error("falling back to prompt"),r="message"in t?t.message:"Copy to clipboard: #{key}, Enter",n=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",i=r.replace(/#{\s*key\s*}/g,n),window.prompt(i,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(s):l.removeAllRanges()),u&&document.body.removeChild(u),o()}return c};function fT(e){return"[object Object]"===Object.prototype.toString.call(e)}function fP(e){return Array.isArray(e)?e.length:fT(e)?Object.keys(e).length:0}function f_(e,t,r,n,a,i){if(i&&void 0!==i.collapsed)return!!i.collapsed;if("boolean"==typeof n)return n;if("number"==typeof n&&t>n)return!0;let o=fP(e);if("function"==typeof n){let a=fM(n,[{node:e,depth:t,indexOrName:r,size:o}]);if("boolean"==typeof a)return a}return!!(Array.isArray(e)&&o>a||fT(e)&&o>a)}function fD(e,t,r,n,a,i){if(i&&void 0!==i.collapsed)return!!i.collapsed;if("boolean"==typeof n)return n;if("number"==typeof n&&t>n)return!0;let o=Math.ceil(e.length/100);if("function"==typeof n){let a=fM(n,[{node:e,depth:t,indexOrName:r,size:o}]);if("boolean"==typeof a)return a}return!!(Array.isArray(e)&&o>a||fT(e)&&o>a)}function fB(e,t,r){return"boolean"==typeof e?e:"number"==typeof e&&!!(t>e)||"collapsed"===e&&!!r||"expanded"===e&&!r}function fM(e,t){try{return e(...t)}catch(e){reportError(e)}}function fA(e){if(!0===e||fT(e)&&!0===e.add)return!0}function fR(e){if(!0===e||fT(e)&&!0===e.edit)return!0}function fI(e){if(!0===e||fT(e)&&!0===e.delete)return!0}function fL(e){return!e||void 0===e.add||!!e.add}function fO(e){return!e||void 0===e.edit||!!e.edit}function fz(e){return!e||void 0===e.delete||!!e.delete}function fV(e){return!e||void 0===e.enableClipboard||!!e.enableClipboard}function fF(){return(fF=Object.assign.bind()).apply(this,arguments)}var fH=function(e){return _.createElement("svg",fF({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),d||(d=_.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 fq(){return(fq=Object.assign.bind()).apply(this,arguments)}var fX=function(e){return _.createElement("svg",fq({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),h||(h=_.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 fY(){return(fY=Object.assign.bind()).apply(this,arguments)}var fW=function(e){return _.createElement("svg",fY({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),f||(f=_.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"})),p||(p=_.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 fU({node:e,nodeMeta:t}){let{customizeCopy:r,CopyComponent:n,CopiedComponent:a}=(0,_.useContext)(pn),[i,o]=(0,_.useState)(!1),s=n=>{n.stopPropagation();let a=r(e,t);"string"==typeof a&&a&&function(e){var t,r,n,a;t=this,r=void 0,n=void 0,a=function*(){try{yield navigator.clipboard.writeText(e)}catch(t){fS(e)}},new(n||(n=Promise))(function(e,i){function o(e){try{l(a.next(e))}catch(e){i(e)}}function s(e){try{l(a.throw(e))}catch(e){i(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof n?r:new n(function(e){e(r)})).then(o,s)}l((a=a.apply(t,r||[])).next())})}(a),o(!0),setTimeout(()=>o(!1),3e3)};return i?"function"==typeof a?(0,S.jsx)(a,{className:"json-view--copy",style:{display:"inline-block"}}):(0,S.jsx)(fW,{className:"json-view--copy",style:{display:"inline-block"}}):"function"==typeof n?(0,S.jsx)(n,{onClick:s,className:"json-view--copy"}):(0,S.jsx)(fX,{onClick:s,className:"json-view--copy"})}function f$({indexOrName:e,value:t,depth:r,deleteHandle:n,editHandle:a,parent:i,parentPath:o}){let{displayArrayIndex:s}=(0,_.useContext)(pn),l=Array.isArray(i);return(0,S.jsxs)("div",Object.assign({className:"json-view--pair"},{children:[!l||l&&s?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("span",Object.assign({className:"number"==typeof e?"json-view--index":"json-view--property"},{children:e})),":"," "]}):(0,S.jsx)(S.Fragment,{}),(0,S.jsx)(pt,{node:t,depth:r+1,deleteHandle:(e,t)=>n(e,t),editHandle:(e,t,r,n)=>a(e,t,r,n),parent:i,indexOrName:e,parentPath:o})]}))}function fK(){return(fK=Object.assign.bind()).apply(this,arguments)}var fG=function(e){return _.createElement("svg",fK({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),g||(g=_.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"})),v||(v=_.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 fZ(){return(fZ=Object.assign.bind()).apply(this,arguments)}var fQ=function(e){return _.createElement("svg",fZ({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),y||(y=_.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"})),x||(x=_.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 fJ(){return(fJ=Object.assign.bind()).apply(this,arguments)}var f0=function(e){return _.createElement("svg",fJ({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),b||(b=_.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"})),w||(w=_.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 f1(){return(f1=Object.assign.bind()).apply(this,arguments)}var f2=function(e){return _.createElement("svg",f1({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),j||(j=_.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"})),N||(N=_.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 f5({originNode:e,node:t,depth:r,index:n,deleteHandle:a,customOptions:i,startIndex:o,parent:s,parentPath:l}){let{enableClipboard:u,src:c,onEdit:d,onChange:h,forceUpdate:f,displaySize:p,CustomOperation:g}=(0,_.useContext)(pn),v=[...l,String(n)],[y,x]=(0,_.useState)(!0),b=(0,_.useCallback)((t,n,a)=>{e[t]=n,d&&d({newValue:n,oldValue:a,depth:r,src:c,indexOrName:t,parentType:"array",parentPath:l}),h&&h({type:"edit",depth:r,src:c,indexOrName:t,parentType:"array",parentPath:l}),f()},[t,d,h,f]),w=t=>{e.splice(t,1),a&&a(t,l),f()},j=(0,S.jsxs)(S.Fragment,{children:[!y&&(0,S.jsxs)("span",Object.assign({onClick:()=>x(!0),className:"jv-size-chevron"},{children:[fB(p,r,y)&&(0,S.jsxs)("span",Object.assign({className:"jv-size"},{children:[fP(t)," Items"]})),(0,S.jsx)(fH,{className:"jv-chevron"})]})),!y&&u&&fV(i)&&(0,S.jsx)(fU,{node:t,nodeMeta:{depth:r,indexOrName:n,parent:s,parentPath:l,currentPath:v}}),"function"==typeof g?(0,S.jsx)(g,{node:t}):null]});return(0,S.jsxs)("div",{children:[(0,S.jsx)("span",{children:"["}),j,y?(0,S.jsxs)("button",Object.assign({onClick:()=>x(!1),className:"jv-button"},{children:[o," ... ",o+t.length-1]})):(0,S.jsx)("div",Object.assign({className:"jv-indent"},{children:t.map((e,a)=>(0,S.jsx)(f$,{indexOrName:a+o,value:e,depth:r,parent:t,deleteHandle:w,editHandle:b,parentPath:l},String(n)+String(a)))})),(0,S.jsx)("span",{children:"]"})]})}function f3({node:e,depth:t,deleteHandle:r,indexOrName:n,customOptions:a,parent:i,parentPath:o}){let s=void 0!==n?[...o,String(n)]:o,l=[];for(let t=0;t<e.length;t+=100)l.push(e.slice(t,t+100));let{collapsed:u,enableClipboard:c,collapseObjectsAfterLength:d,editable:h,onDelete:f,src:p,onAdd:g,CustomOperation:v,onChange:y,forceUpdate:x,displaySize:b}=(0,_.useContext)(pn),[w,j]=(0,_.useState)(fD(e,t,n,u,d,a));(0,_.useEffect)(()=>{j(fD(e,t,n,u,d,a))},[u,d]);let[N,k]=(0,_.useState)(!1),[C,E]=(0,_.useState)(!1),T=()=>{e.push(null),g&&g({indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:o}),y&&y({type:"add",indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:o}),x()},P=N||C,D=(0,S.jsxs)(S.Fragment,{children:[!w&&!P&&(0,S.jsxs)("span",Object.assign({onClick:()=>j(!0),className:"jv-size-chevron"},{children:[fB(b,t,w)&&(0,S.jsxs)("span",Object.assign({className:"jv-size"},{children:[e.length," Items"]})),(0,S.jsx)(fH,{className:"jv-chevron"})]})),P&&(0,S.jsx)(f0,{className:"json-view--edit",style:{display:"inline-block"},onClick:C?T:()=>{k(!1),r&&r(n,o),f&&f({value:e,depth:t,src:p,indexOrName:n,parentType:"array",parentPath:o}),y&&y({type:"delete",depth:t,src:p,indexOrName:n,parentType:"array",parentPath:o})}}),P&&(0,S.jsx)(f2,{className:"json-view--edit",style:{display:"inline-block"},onClick:()=>{k(!1),E(!1)}}),!w&&!P&&c&&fV(a)&&(0,S.jsx)(fU,{node:e,nodeMeta:{depth:t,indexOrName:n,parent:i,parentPath:o,currentPath:s}}),!w&&!P&&fA(h)&&fL(a)&&(0,S.jsx)(fQ,{className:"json-view--edit",onClick:()=>{T()}}),!w&&!P&&fI(h)&&fz(a)&&r&&(0,S.jsx)(fG,{className:"json-view--edit",onClick:()=>k(!0)}),"function"==typeof v?(0,S.jsx)(v,{node:e}):null]});return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("span",{children:"["}),D,w?(0,S.jsx)("button",Object.assign({onClick:()=>j(!1),className:"jv-button"},{children:"..."})):(0,S.jsx)("div",Object.assign({className:"jv-indent"},{children:l.map((i,s)=>(0,S.jsx)(f5,{originNode:e,node:i,depth:t,index:s,startIndex:100*s,deleteHandle:r,customOptions:a,parentPath:o},String(n)+String(s)))})),(0,S.jsx)("span",{children:"]"}),w&&fB(b,t,w)&&(0,S.jsxs)("span",Object.assign({onClick:()=>j(!1),className:"jv-size"},{children:[e.length," Items"]}))]})}function f4({node:e,depth:t,indexOrName:r,deleteHandle:n,customOptions:a,parent:i,parentPath:o}){let{collapsed:s,onCollapse:l,enableClipboard:u,ignoreLargeArray:c,collapseObjectsAfterLength:d,editable:h,onDelete:f,src:p,onAdd:g,onEdit:v,onChange:y,forceUpdate:x,displaySize:b,CustomOperation:w}=(0,_.useContext)(pn),j=void 0!==r?[...o,String(r)]:o;if(!c&&Array.isArray(e)&&e.length>100)return(0,S.jsx)(f3,{node:e,depth:t,indexOrName:r,deleteHandle:n,customOptions:a,parentPath:j});let N=fT(e),[k,C]=(0,_.useState)(f_(e,t,r,s,d,a)),E=n=>{null==l||l({isCollapsing:!n,node:e,depth:t,indexOrName:r}),C(n)};(0,_.useEffect)(()=>{E(f_(e,t,r,s,d,a))},[s,d]);let T=(0,_.useCallback)((r,n,a)=>{Array.isArray(e)?e[+r]=n:e&&(e[r]=n),v&&v({newValue:n,oldValue:a,depth:t,src:p,indexOrName:r,parentType:N?"object":"array",parentPath:j}),y&&y({type:"edit",depth:t,src:p,indexOrName:r,parentType:N?"object":"array",parentPath:j}),x()},[e,v,y,x]),P=t=>{Array.isArray(e)?e.splice(+t,1):e&&delete e[t],x()},[D,B]=(0,_.useState)(!1),[M,A]=(0,_.useState)(!1),R=(0,_.useRef)(null),I=()=>{var r;if(N){let n=null==(r=R.current)?void 0:r.value;n&&(e[n]=null,R.current&&(R.current.value=""),A(!1),g&&g({indexOrName:n,depth:t,src:p,parentType:"object",parentPath:j}),y&&y({type:"add",indexOrName:n,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}),y&&y({type:"add",indexOrName:e.length-1,depth:t,src:p,parentType:"array",parentPath:j}));x()},L=D||M,O=()=>{B(!1),A(!1)},z=(0,S.jsxs)(S.Fragment,{children:[!k&&!L&&(0,S.jsxs)("span",Object.assign({onClick:()=>E(!0),className:"jv-size-chevron"},{children:[fB(b,t,k)&&(0,S.jsxs)("span",Object.assign({className:"jv-size"},{children:[fP(e)," Items"]})),(0,S.jsx)(fH,{className:"jv-chevron"})]})),M&&N&&(0,S.jsx)("input",{className:"json-view--input",placeholder:"property",ref:R,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),I()):"Escape"===e.key&&O()}}),L&&(0,S.jsx)(f0,{className:"json-view--edit",style:{display:"inline-block"},onClick:M?I:()=>{B(!1),n&&n(r,j),f&&f({value:e,depth:t,src:p,indexOrName:r,parentType:N?"object":"array",parentPath:j}),y&&y({type:"delete",depth:t,src:p,indexOrName:r,parentType:N?"object":"array",parentPath:j})}}),L&&(0,S.jsx)(f2,{className:"json-view--edit",style:{display:"inline-block"},onClick:O}),!k&&!L&&u&&fV(a)&&(0,S.jsx)(fU,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:i,parentPath:o,currentPath:j}}),!k&&!L&&fA(h)&&fL(a)&&(0,S.jsx)(fQ,{className:"json-view--edit",onClick:()=>{N?(A(!0),setTimeout(()=>{var e;return null==(e=R.current)?void 0:e.focus()})):I()}}),!k&&!L&&fI(h)&&fz(a)&&n&&(0,S.jsx)(fG,{className:"json-view--edit",onClick:()=>B(!0)}),"function"==typeof w?(0,S.jsx)(w,{node:e}):null]});return Array.isArray(e)?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("span",{children:"["}),z,k?(0,S.jsx)("button",Object.assign({onClick:()=>E(!1),className:"jv-button"},{children:"..."})):(0,S.jsx)("div",Object.assign({className:"jv-indent"},{children:e.map((n,a)=>(0,S.jsx)(f$,{indexOrName:a,value:n,depth:t,parent:e,deleteHandle:P,editHandle:T,parentPath:j},String(r)+String(a)))})),(0,S.jsx)("span",{children:"]"}),k&&fB(b,t,k)&&(0,S.jsxs)("span",Object.assign({onClick:()=>E(!1),className:"jv-size"},{children:[fP(e)," Items"]}))]}):N?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("span",{children:"{"}),z,k?(0,S.jsx)("button",Object.assign({onClick:()=>E(!1),className:"jv-button"},{children:"..."})):(0,S.jsx)("div",Object.assign({className:"jv-indent"},{children:Object.entries(e).map(([n,a])=>(0,S.jsx)(f$,{indexOrName:n,value:a,depth:t,parent:e,deleteHandle:P,editHandle:T,parentPath:j},String(r)+String(n)))})),(0,S.jsx)("span",{children:"}"}),k&&fB(b,t,k)&&(0,S.jsxs)("span",Object.assign({onClick:()=>E(!1),className:"jv-size"},{children:[fP(e)," Items"]}))]}):(0,S.jsx)("span",{children:String(e)})}let f6=_.default.forwardRef(({str:e,className:t,ctrlClick:r},n)=>{let{collapseStringMode:a,collapseStringsAfterLength:i,customizeCollapseStringUI:o}=(0,_.useContext)(pn),[s,l]=(0,_.useState)(!0),u=(0,_.useRef)(null);i=i>0?i:0;let c=e.replace(/\s+/g," "),d="function"==typeof o?o(c,s):"string"==typeof o?o:"...",h=e=>{var t;if((e.ctrlKey||e.metaKey)&&r)r(e);else{let e=window.getSelection();if(e&&e.anchorOffset!==e.focusOffset&&(null==(t=e.anchorNode)?void 0:t.parentElement)===u.current)return;l(!s)}};if(e.length<=i)return(0,S.jsxs)("span",Object.assign({ref:u,className:t,onClick:r},{children:['"',e,'"']}));if("address"===a)return e.length<=10?(0,S.jsxs)("span",Object.assign({ref:u,className:t,onClick:r},{children:['"',e,'"']})):(0,S.jsxs)("span",Object.assign({ref:u,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[c.slice(0,6),d,c.slice(-4)]:e,'"']}));if("directly"===a)return(0,S.jsxs)("span",Object.assign({ref:u,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[c.slice(0,i),d]:e,'"']}));if("word"===a){let r=i,n=i+1,a=c,o=1;for(;;){if(/\W/.test(e[r])){a=e.slice(0,r);break}if(/\W/.test(e[n])){a=e.slice(0,n);break}if(6===o){a=e.slice(0,i);break}o++,r--,n++}return(0,S.jsxs)("span",Object.assign({ref:u,onClick:h,className:t+" cursor-pointer"},{children:['"',s?[a,d]:e,'"']}))}return(0,S.jsxs)("span",Object.assign({ref:u,className:t},{children:['"',e,'"']}))});function f7(){return(f7=Object.assign.bind()).apply(this,arguments)}var f9=function(e){return _.createElement("svg",f7({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),k||(k=_.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 f8(){return(f8=Object.assign.bind()).apply(this,arguments)}var pe=function(e){return _.createElement("svg",f8({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},e),C||(C=_.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"})),E||(E=_.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 pt({node:e,depth:t,deleteHandle:r,indexOrName:n,parent:a,editHandle:i,parentPath:o}){let s,{collapseStringsAfterLength:l,enableClipboard:u,editable:c,src:d,onDelete:h,onChange:f,customizeNode:p,matchesURL:g,urlRegExp:v,EditComponent:y,DoneComponent:x,CancelComponent:b,CustomOperation:w}=(0,_.useContext)(pn);if("function"==typeof p&&(s=fM(p,[{node:e,depth:t,indexOrName:n}])),s){if((0,_.isValidElement)(s))return s;else if("function"==typeof s){let r=s;return(0,S.jsx)(r,{node:e,depth:t,indexOrName:n})}}if(Array.isArray(e)||fT(e))return(0,S.jsx)(f4,{parent:a,node:e,depth:t,indexOrName:n,deleteHandle:r,parentPath:o,customOptions:"object"==typeof s?s:void 0});{var j;let p=typeof e,N=void 0!==n?[...o,String(n)]:o,[k,C]=(0,_.useState)(!1),[E,T]=(0,_.useState)(!1),P=(0,_.useRef)(null),D=()=>{C(!0),setTimeout(()=>{var e,t;null==(e=window.getSelection())||e.selectAllChildren(P.current),null==(t=P.current)||t.focus()})},B=(0,_.useCallback)(()=>{let t=P.current.innerText;try{let r=JSON.parse(t);i&&i(n,r,e,o)}catch(a){let r="string"===p?t.trim().replace(/^\"([\s\S]+?)\"$/,"$1"):t;i&&i(n,r,e,o)}C(!1)},[i,n,e,o,p]),M=()=>{C(!1),T(!1)},A=()=>{T(!1),r&&r(n,o),h&&h({value:e,depth:t,src:d,indexOrName:n,parentType:Array.isArray(a)?"array":"object",parentPath:o}),f&&f({depth:t,src:d,indexOrName:n,parentType:Array.isArray(a)?"array":"object",type:"delete",parentPath:o})},R=(0,_.useCallback)(e=>{"Enter"===e.key?(e.preventDefault(),B()):"Escape"===e.key&&M()},[B]),I=k||E,L=!I&&fR(c)&&fO(s)&&i?e=>{(e.ctrlKey||e.metaKey)&&D()}:void 0,O=(0,S.jsxs)(S.Fragment,{children:[I&&("function"==typeof x?(0,S.jsx)(x,{className:"json-view--edit",style:{display:"inline-block"},onClick:E?A:B}):(0,S.jsx)(f0,{className:"json-view--edit",style:{display:"inline-block"},onClick:E?A:B})),I&&("function"==typeof b?(0,S.jsx)(b,{className:"json-view--edit",style:{display:"inline-block"},onClick:M}):(0,S.jsx)(f2,{className:"json-view--edit",style:{display:"inline-block"},onClick:M})),!I&&u&&fV(s)&&(0,S.jsx)(fU,{node:e,nodeMeta:{depth:t,indexOrName:n,parent:a,parentPath:o,currentPath:N}}),!I&&g&&"string"===p&&v.test(e)&&(!(j=s)||void 0===j.matchesURL||!!j.matchesURL)&&(0,S.jsx)("a",Object.assign({href:e,target:"_blank",className:"json-view--link"},{children:(0,S.jsx)(pe,{})})),!I&&fR(c)&&fO(s)&&i&&("function"==typeof y?(0,S.jsx)(y,{className:"json-view--edit",onClick:D}):(0,S.jsx)(f9,{className:"json-view--edit",onClick:D})),!I&&fI(c)&&fz(s)&&r&&(0,S.jsx)(fG,{className:"json-view--edit",onClick:()=>T(!0)}),"function"==typeof w?(0,S.jsx)(w,{node:e}):null]}),z="json-view--string";switch(p){case"number":case"bigint":z="json-view--number";break;case"boolean":z="json-view--boolean";break;case"object":z="json-view--null"}"string"==typeof(null==s?void 0:s.className)&&(z+=" "+s.className),E&&(z+=" json-view--deleting");let V=String(e);"bigint"===p&&(V+="n");let F=(0,_.useMemo)(()=>(0,S.jsx)("span",{contentEditable:!0,className:z,dangerouslySetInnerHTML:{__html:"string"===p?`"${V}"`:V},ref:P,onKeyDown:R}),[V,p,R]);return"string"===p?(0,S.jsxs)(S.Fragment,{children:[k?F:e.length>l?(0,S.jsx)(f6,{str:e,ref:P,className:z,ctrlClick:L}):(0,S.jsxs)("span",Object.assign({className:z,onClick:L},{children:['"',V,'"']})),O]}):(0,S.jsxs)(S.Fragment,{children:[k?F:(0,S.jsx)("span",Object.assign({className:z,onClick:L},{children:V})),O]})}}let pr=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,pn=(0,_.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:pr,ignoreLargeArray:!1,CopyComponent:void 0,CopiedComponent:void 0,EditComponent:void 0,CancelComponent:void 0,DoneComponent:void 0,CustomOperation:void 0});function pa({src:e,collapseStringsAfterLength:t=99,collapseStringMode:r="directly",customizeCollapseStringUI:n,collapseObjectsAfterLength:a=99,collapsed:i,onCollapse:o,enableClipboard:s=!0,editable:l=!1,onEdit:u,onDelete:c,onAdd:d,onChange:h,dark:f=!1,theme:p="default",customizeNode:g,customizeCopy:v=e=>(function(e,t){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:y,displayArrayIndex:x=!0,style:b,className:w,matchesURL:j=!1,urlRegExp:N=pr,ignoreLargeArray:k=!1,CopyComponent:C,CopiedComponent:E,EditComponent:T,CancelComponent:P,DoneComponent:D,CustomOperation:B}){let[M,A]=(0,_.useState)(0),R=(0,_.useCallback)(()=>A(e=>++e),[]),[I,L]=(0,_.useState)(e);return(0,_.useEffect)(()=>L(e),[e]),(0,S.jsx)(pn.Provider,Object.assign({value:{src:I,collapseStringsAfterLength:t,collapseStringMode:r,customizeCollapseStringUI:n,collapseObjectsAfterLength:a,collapsed:i,onCollapse:o,enableClipboard:s,editable:l,onEdit:u,onDelete:c,onAdd:d,onChange:h,forceUpdate:R,customizeNode:g,customizeCopy:v,displaySize:y,displayArrayIndex:x,matchesURL:j,urlRegExp:N,ignoreLargeArray:k,CopyComponent:C,CopiedComponent:E,EditComponent:T,CancelComponent:P,DoneComponent:D,CustomOperation:B}},{children:(0,S.jsx)("code",Object.assign({className:"json-view"+(f?" dark":"")+(p&&"default"!==p?" json-view_"+p:"")+(w?" "+w:""),style:b},{children:(0,S.jsx)(pt,{node:I,depth:1,editHandle:(e,t,r,n)=>{L(t),u&&u({newValue:t,oldValue:r,depth:1,src:I,indexOrName:e,parentType:null,parentPath:n}),h&&h({type:"edit",depth:1,src:I,indexOrName:e,parentType:null,parentPath:n})},deleteHandle:(e,t)=>{L(void 0),c&&c({value:I,depth:1,src:I,indexOrName:e,parentType:null,parentPath:t}),h&&h({depth:1,src:I,indexOrName:e,parentType:null,type:"delete",parentPath:t})},parentPath:[]})}))}))}function pi(){let e,t,r,{currentBank:n}=(0,D.useBank)(),[a,i]=(0,_.useState)(""),[o,s]=(0,_.useState)(""),[l,u]=(0,_.useState)("mid"),[c,d]=(0,_.useState)(!0),[h,f]=(0,_.useState)(!1),[p,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1),x=async()=>{if(n&&a){y(!0),f(!1);try{let e=await X.client.reflect({bank_id:n,query:a,budget:l,context:o||void 0,include_facts:c});g(e)}catch(e){console.error("Error running reflect:",e),alert("Error running reflect: "+e.message)}finally{y(!1)}}};return(0,S.jsxs)("div",{className:"max-w-6xl",children:[(0,S.jsx)(fx,{children:(0,S.jsxs)(fN,{className:"p-5 space-y-4",children:[(0,S.jsxs)("div",{className:"flex gap-4 items-end flex-wrap",children:[(0,S.jsxs)("div",{className:"flex-1 min-w-[300px]",children:[(0,S.jsx)("label",{className:"font-bold block mb-2 text-card-foreground",children:"Question:"}),(0,S.jsx)(W.Input,{type:"text",value:a,onChange:e=>i(e.target.value),placeholder:"Enter your question...",onKeyDown:e=>"Enter"===e.key&&x()})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("label",{className:"font-bold block mb-2 text-card-foreground",children:"Budget:"}),(0,S.jsxs)(hB,{value:l,onValueChange:e=>u(e),children:[(0,S.jsx)(ff,{className:"w-24",children:(0,S.jsx)(hI,{})}),(0,S.jsxs)(fm,{children:[(0,S.jsx)(fv,{value:"low",children:"Low"}),(0,S.jsx)(fv,{value:"mid",children:"Mid"}),(0,S.jsx)(fv,{value:"high",children:"High"})]})]})]}),(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)(fy.Checkbox,{id:"include-facts",checked:c,onCheckedChange:e=>d(e)}),(0,S.jsx)("label",{htmlFor:"include-facts",className:"text-sm cursor-pointer",children:"Include Facts"})]}),(0,S.jsxs)(Y.Button,{onClick:x,disabled:v||!a,children:[(0,S.jsx)(A,{className:"w-4 h-4 mr-2"}),"Reflect"]})]}),(0,S.jsxs)("div",{children:[(0,S.jsx)("label",{className:"font-bold block mb-2 text-card-foreground",children:"Context (optional):"}),(0,S.jsx)(hi.Textarea,{value:o,onChange:e=>s(e.target.value),placeholder:"Additional context for the LLM (not used in search)...",rows:3})]})]})}),v&&(0,S.jsx)(fx,{className:"mt-6",children:(0,S.jsxs)(fN,{className:"text-center py-10",children:[(0,S.jsx)(A,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"}),(0,S.jsx)("div",{className:"text-lg text-muted-foreground",children:"Reflecting..."})]})}),p&&!v&&(0,S.jsxs)("div",{className:"mt-6 space-y-6",children:[(0,S.jsxs)(fx,{children:[(0,S.jsx)(fb,{children:(0,S.jsx)(fw,{children:"Answer"})}),(0,S.jsx)(fN,{children:(0,S.jsx)("div",{className:"p-4 bg-muted rounded-lg border-l-4 border-primary text-base leading-relaxed whitespace-pre-wrap",children:p.text})})]}),(0,S.jsxs)(fx,{children:[(0,S.jsx)(fb,{children:(0,S.jsxs)("div",{className:"flex items-center justify-between",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)(fw,{children:"Details"}),(0,S.jsx)(fj,{children:"View facts and raw response"})]}),(0,S.jsxs)("div",{className:"flex gap-2",children:[(0,S.jsx)(Y.Button,{variant:h?"outline":"default",size:"sm",onClick:()=>f(!1),children:"Based On"}),(0,S.jsx)(Y.Button,{variant:h?"default":"outline",size:"sm",onClick:()=>f(!0),children:"Raw JSON"})]})]})}),(0,S.jsx)(fN,{children:h?(0,S.jsx)("div",{className:"bg-muted p-4 rounded border border-border overflow-auto max-h-[600px]",children:(0,S.jsx)(pa,{src:p,collapsed:1,theme:"default"})}):c&&p.based_on&&p.based_on.length>0?(e=p.based_on.filter(e=>"world"===e.type),t=p.based_on.filter(e=>"experience"===e.type),r=p.based_on.filter(e=>"opinion"===e.type),(0,S.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,S.jsxs)(fx,{children:[(0,S.jsxs)(fb,{className:"pb-3",children:[(0,S.jsx)(fw,{className:"text-base",children:"World Facts"}),(0,S.jsx)(fj,{className:"text-xs",children:"General Knowledge"})]}),(0,S.jsx)(fN,{children:e.length>0?(0,S.jsx)("ul",{className:"text-sm space-y-2",children:e.map((e,t)=>(0,S.jsxs)("li",{className:"p-2 bg-muted rounded",children:[e.text,e.context&&(0,S.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:e.context})]},t))}):(0,S.jsx)("p",{className:"text-muted-foreground text-sm",children:"None"})})]}),(0,S.jsxs)(fx,{children:[(0,S.jsxs)(fb,{className:"pb-3",children:[(0,S.jsx)(fw,{className:"text-base",children:"Experience"}),(0,S.jsx)(fj,{className:"text-xs",children:"Conversations & Events"})]}),(0,S.jsx)(fN,{children:t.length>0?(0,S.jsx)("ul",{className:"text-sm space-y-2",children:t.map((e,t)=>(0,S.jsxs)("li",{className:"p-2 bg-muted rounded",children:[e.text,e.context&&(0,S.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:e.context})]},t))}):(0,S.jsx)("p",{className:"text-muted-foreground text-sm",children:"None"})})]}),(0,S.jsxs)(fx,{children:[(0,S.jsxs)(fb,{className:"pb-3",children:[(0,S.jsx)(fw,{className:"text-base",children:"Opinions"}),(0,S.jsx)(fj,{className:"text-xs",children:"Beliefs & Preferences"})]}),(0,S.jsx)(fN,{children:r.length>0?(0,S.jsx)("ul",{className:"text-sm space-y-2",children:r.map((e,t)=>(0,S.jsxs)("li",{className:"p-2 bg-muted rounded",children:[e.text,e.context&&(0,S.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:e.context})]},t))}):(0,S.jsx)("p",{className:"text-muted-foreground text-sm",children:"None"})})]})]})):c?(0,S.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-lg",children:[(0,S.jsx)(fk,{className:"w-5 h-5 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"}),(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"font-semibold text-amber-900 dark:text-amber-100",children:"No facts found"}),(0,S.jsx)("p",{className:"text-sm text-amber-700 dark:text-amber-300 mt-1",children:"No memories were found or used to generate this answer."})]})]}):(0,S.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-lg",children:[(0,S.jsx)(fk,{className:"w-5 h-5 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"}),(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"font-semibold text-amber-900 dark:text-amber-100",children:"Facts not included"}),(0,S.jsx)("p",{className:"text-sm text-amber-700 dark:text-amber-300 mt-1",children:'Enable "Include Facts" above to see which memories were used to generate this answer.'})]})]})})]}),p.new_opinions&&p.new_opinions.length>0&&(0,S.jsxs)(fx,{className:"border-green-200 dark:border-green-800",children:[(0,S.jsxs)(fb,{className:"bg-green-50 dark:bg-green-950",children:[(0,S.jsxs)(fw,{className:"flex items-center gap-2",children:[(0,S.jsx)(A,{className:"w-5 h-5"}),"New Opinions Formed"]}),(0,S.jsx)(fj,{children:"New beliefs generated from this interaction"})]}),(0,S.jsx)(fN,{className:"pt-6",children:(0,S.jsx)("div",{className:"space-y-3",children:p.new_opinions.map((e,t)=>(0,S.jsxs)("div",{className:"p-3 bg-muted rounded-lg border border-border",children:[(0,S.jsx)("div",{className:"font-semibold text-foreground",children:e.text}),(0,S.jsxs)("div",{className:"text-sm text-muted-foreground mt-1",children:["Confidence: ",e.confidence?.toFixed(2)]})]},t))})})]})]})]})}let po=(0,M.default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),ps=(0,M.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"}]]),pl=(0,M.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);function pu(){let e,t,r,n,a,i,o,s,l,u,c,d,h,f,{currentBank:p}=(0,D.useBank)(),[g,v]=(0,_.useState)(""),[y,x]=(0,_.useState)(["world"]),[b,w]=(0,_.useState)("mid"),[j,N]=(0,_.useState)(4096),[k,C]=(0,_.useState)(""),[E,T]=(0,_.useState)(!1),[P,M]=(0,_.useState)(!1),[A,O]=(0,_.useState)(null),[V,F]=(0,_.useState)(null),[H,q]=(0,_.useState)(null),[U,$]=(0,_.useState)(null),[K,G]=(0,_.useState)(!1),[Z,Q]=(0,_.useState)("results"),[J,ee]=(0,_.useState)(null),[et,er]=(0,_.useState)(new Set),[en,ea]=(0,_.useState)(new Set),ei=e=>{er(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},eo=e=>{ea(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},es=async()=>{if(!p)return void alert("Please select a memory bank first");if(!g||0===y.length){0===y.length&&alert("Please select at least one fact type");return}G(!0);try{let e={bank_id:p,query:g,types:y,budget:b,max_tokens:j,trace:!0,include:{entities:P?{max_tokens:500}:null,chunks:E?{max_tokens:8192}:null},...k&&{query_timestamp:k}},t=await X.client.recall(e);O(t.results||[]),F(t.entities||null),q(t.chunks||null),$(t.trace||null),Q("results")}catch(e){console.error("Error running search:",e),alert("Error running search: "+e.message)}finally{G(!1)}};return p?(0,S.jsxs)("div",{className:"space-y-6",children:[(0,S.jsx)(fx,{children:(0,S.jsxs)(fN,{className:"pt-6",children:[(0,S.jsxs)("div",{className:"flex gap-3",children:[(0,S.jsxs)("div",{className:"flex-1 relative",children:[(0,S.jsx)(B.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,S.jsx)(W.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&&es()})]}),(0,S.jsx)(Y.Button,{onClick:es,disabled:K||!g,className:"h-12 px-8",children:K?"Searching...":"Recall"})]}),(0,S.jsxs)("div",{className:"flex flex-wrap items-center gap-6 mt-4 pt-4 border-t",children:[(0,S.jsxs)("div",{className:"flex items-center gap-4",children:[(0,S.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Types:"}),(0,S.jsx)("div",{className:"flex gap-3",children:["world","experience","opinion"].map(e=>(0,S.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,S.jsx)(fy.Checkbox,{checked:y.includes(e),onCheckedChange:()=>{x(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}}),(0,S.jsx)("span",{className:"text-sm capitalize",children:e})]},e))})]}),(0,S.jsx)("div",{className:"h-6 w-px bg-border"}),(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)(ps,{className:"h-4 w-4 text-muted-foreground"}),(0,S.jsxs)(hB,{value:b,onValueChange:e=>w(e),children:[(0,S.jsx)(ff,{className:"w-24 h-8",children:(0,S.jsx)(hI,{})}),(0,S.jsxs)(fm,{children:[(0,S.jsx)(fv,{value:"low",children:"Low"}),(0,S.jsx)(fv,{value:"mid",children:"Mid"}),(0,S.jsx)(fv,{value:"high",children:"High"})]})]})]}),(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("span",{className:"text-sm text-muted-foreground",children:"Tokens:"}),(0,S.jsx)(W.Input,{type:"number",value:j,onChange:e=>N(parseInt(e.target.value)),className:"w-24 h-8"})]}),(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)(po,{className:"h-4 w-4 text-muted-foreground"}),(0,S.jsx)(W.Input,{type:"datetime-local",value:k,onChange:e=>C(e.target.value),className:"h-8",placeholder:"Query date"})]}),(0,S.jsx)("div",{className:"h-6 w-px bg-border"}),(0,S.jsxs)("div",{className:"flex items-center gap-4",children:[(0,S.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,S.jsx)(fy.Checkbox,{checked:E,onCheckedChange:e=>T(e)}),(0,S.jsx)(I,{className:"h-4 w-4 text-muted-foreground"}),(0,S.jsx)("span",{className:"text-sm",children:"Chunks"})]}),(0,S.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,S.jsx)(fy.Checkbox,{checked:P,onCheckedChange:e=>M(e)}),(0,S.jsx)(L,{className:"h-4 w-4 text-muted-foreground"}),(0,S.jsx)("span",{className:"text-sm",children:"Entities"})]})]})]})]})}),K&&(0,S.jsx)(fx,{children:(0,S.jsxs)(fN,{className:"flex flex-col items-center justify-center py-16",children:[(0,S.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"}),(0,S.jsx)("p",{className:"text-muted-foreground",children:"Searching memories..."})]})}),!K&&A&&(0,S.jsxs)("div",{className:"space-y-4",children:[U?.summary&&(0,S.jsxs)("div",{className:"flex items-center gap-6 text-sm",children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("span",{className:"text-muted-foreground",children:"Results:"}),(0,S.jsx)("span",{className:"font-semibold",children:A.length})]}),(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("span",{className:"text-muted-foreground",children:"Duration:"}),(0,S.jsxs)("span",{className:"font-semibold",children:[U.summary.total_duration_seconds?.toFixed(2),"s"]})]}),(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("span",{className:"text-muted-foreground",children:"Nodes visited:"}),(0,S.jsx)("span",{className:"font-semibold",children:U.summary.total_nodes_visited})]}),(0,S.jsx)("div",{className:"flex-1"}),(0,S.jsx)("div",{className:"flex gap-1 bg-muted p-1 rounded-lg",children:["results","trace","json"].map(e=>(0,S.jsx)("button",{onClick:()=>Q(e),className:`px-3 py-1.5 text-sm font-medium rounded-md transition-colors ${Z===e?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"results"===e?"Results":"trace"===e?"Trace":"JSON"},e))})]}),"results"===Z&&(0,S.jsx)("div",{className:"space-y-3",children:0===A.length?(0,S.jsx)(fx,{children:(0,S.jsxs)(fN,{className:"flex flex-col items-center justify-center py-12",children:[(0,S.jsx)(B.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,S.jsx)("p",{className:"text-muted-foreground",children:"No memories found for this query."})]})}):A.map((e,t)=>{let r=U?.visits?.find(t=>t.node_id===e.id),n=r?r.weights.final_weight:e.score||0;return(0,S.jsx)(fx,{className:"cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>ee(e),children:(0,S.jsx)(fN,{className:"py-4",children:(0,S.jsxs)("div",{className:"flex items-start gap-4",children:[(0,S.jsx)("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center",children:(0,S.jsx)("span",{className:"text-sm font-semibold text-primary",children:t+1})}),(0,S.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,S.jsx)("p",{className:"text-foreground",children:e.text}),(0,S.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[(0,S.jsx)("span",{className:"px-2 py-0.5 rounded bg-muted capitalize",children:e.type||"world"}),e.context&&(0,S.jsx)("span",{className:"truncate max-w-xs",children:e.context}),e.occurred_start&&(0,S.jsx)("span",{children:new Date(e.occurred_start).toLocaleDateString()})]})]}),(0,S.jsxs)("div",{className:"flex-shrink-0 text-right",children:[(0,S.jsx)("div",{className:"text-sm font-semibold",children:n.toFixed(3)}),(0,S.jsx)("div",{className:"text-xs text-muted-foreground",children:"score"})]}),(0,S.jsx)(z,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"})]})})},t)})}),"trace"===Z&&U&&(0,S.jsxs)("div",{className:"space-y-4",children:[U.retrieval_results&&U.retrieval_results.length>0&&(e={},U.retrieval_results.forEach(t=>{let r=t.fact_type||"all";e[r]||(e[r]=[]),e[r].push(t)}),t=Object.keys(e),(0,S.jsxs)("div",{children:[(0,S.jsxs)("div",{className:"text-xs font-medium text-muted-foreground mb-3 flex items-center gap-2",children:[(0,S.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,S.jsx)("span",{children:"PARALLEL RETRIEVAL"}),(0,S.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,S.jsx)("div",{className:"space-y-2",children:t.map((t,r)=>{let n=e[t],a=`lane-${t}`,i=et.has(a),o=n.reduce((e,t)=>e+(t.results?.length||0),0),s=Math.max(...n.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"}},u=l[t]||l.all;return(0,S.jsx)(fx,{className:`transition-colors ${i?"border-primary":u.border}`,children:(0,S.jsxs)(fN,{className:"py-3 px-4",children:[(0,S.jsxs)("div",{className:"flex items-center gap-3 cursor-pointer",onClick:()=>ei(a),children:[(0,S.jsx)("div",{className:`w-8 h-8 rounded-lg ${u.bg} flex items-center justify-center`,children:(0,S.jsx)("span",{className:`text-sm font-bold ${u.text} capitalize`,children:t.charAt(0).toUpperCase()})}),(0,S.jsxs)("div",{className:"flex-1",children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("span",{className:"font-semibold text-foreground capitalize",children:t}),(0,S.jsxs)("span",{className:"text-xs text-muted-foreground",children:[n.length," methods"]})]}),(0,S.jsx)("div",{className:"flex gap-1.5 mt-1",children:n.map((e,t)=>(0,S.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,S.jsxs)("div",{className:"text-right",children:[(0,S.jsx)("div",{className:"text-2xl font-bold text-foreground",children:o}),(0,S.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[s.toFixed(2),"s"]})]}),i?(0,S.jsx)(fd,{className:"h-5 w-5 text-muted-foreground"}):(0,S.jsx)(z,{className:"h-5 w-5 text-muted-foreground"})]}),i&&(0,S.jsx)("div",{className:"mt-4 pt-4 border-t border-border",children:(0,S.jsx)("div",{className:`grid gap-3 ${1===n.length?"grid-cols-1":2===n.length?"grid-cols-2":3===n.length?"grid-cols-3":"grid-cols-4"}`,children:n.map((e,t)=>{let r,n,i,o,s=`${a}-method-${t}`,l=et.has(s),u=e.results||[];return(0,S.jsxs)("div",{className:"flex flex-col",children:[(0,S.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(),ei(s)},children:[(0,S.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,S.jsx)("span",{className:"font-medium text-sm text-foreground capitalize",children:e.method_name}),l?(0,S.jsx)(fd,{className:"h-3 w-3 text-muted-foreground"}):(0,S.jsx)(z,{className:"h-3 w-3 text-muted-foreground"})]}),(0,S.jsxs)("div",{className:"flex items-end justify-between",children:[(0,S.jsx)("div",{className:"text-2xl font-bold text-foreground",children:u.length}),(0,S.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:[e.duration_seconds?.toFixed(2),"s"]})]})]}),l&&u.length>0&&(r=`results-${s}`,i=(n=en.has(r))?u:u.slice(0,5),o=u.length>5,(0,S.jsxs)("div",{className:"mt-2 space-y-1.5 max-h-[300px] overflow-y-auto",children:[i.map((e,t)=>(0,S.jsx)("div",{className:"p-2 bg-background rounded cursor-pointer hover:bg-muted/50 transition-colors border border-border",onClick:t=>{t.stopPropagation(),ee(e)},children:(0,S.jsxs)("div",{className:"flex items-start gap-2",children:[(0,S.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:t+1}),(0,S.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,S.jsx)("p",{className:"text-xs text-foreground line-clamp-2",children:e.text}),(0,S.jsx)("div",{className:"flex items-center gap-2 mt-1",children:(0,S.jsx)("span",{className:"text-[10px] text-muted-foreground",children:(e.score||e.similarity||0).toFixed(4)})})]})]})},t)),o&&(0,S.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(),eo(r)},children:n?"Show less":`View all ${u.length} results`})]}))]},s)})})})]})},a)})}),(0,S.jsx)("div",{className:"flex justify-center py-2",children:(0,S.jsx)("div",{className:"flex items-center gap-2",children:t.map((e,t)=>{let r={world:"bg-blue-500",experience:"bg-green-500",opinion:"bg-purple-500",all:"bg-gray-500"};return(0,S.jsx)("div",{className:"flex flex-col items-center",children:(0,S.jsx)("div",{className:`w-1 h-4 ${r[e]||r.all} rounded-full opacity-50`})},t)})})}),(0,S.jsx)("div",{className:"flex justify-center",children:(0,S.jsx)(pl,{className:"h-5 w-5 text-muted-foreground/50"})})]})),U.rrf_merged&&(r="rrf-merge",n=et.has(r),(0,S.jsxs)("div",{children:[(0,S.jsx)(fx,{className:`cursor-pointer transition-colors ${n?"border-primary":"hover:border-primary/50"}`,onClick:()=>ei(r),children:(0,S.jsx)(fN,{className:"py-4",children:(0,S.jsxs)("div",{className:"flex items-center gap-4",children:[(0,S.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-purple-500/10 flex items-center justify-center",children:(0,S.jsx)("span",{className:"text-sm font-bold text-purple-500",children:"∪"})}),(0,S.jsxs)("div",{className:"flex-1",children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("span",{className:"font-semibold text-foreground",children:"RRF Fusion"}),(0,S.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:"merge"})]}),(0,S.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:"Reciprocal Rank Fusion of all retrieval results"})]}),(0,S.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.rrf_merged.length}),n?(0,S.jsx)(fd,{className:"h-5 w-5 text-muted-foreground"}):(0,S.jsx)(z,{className:"h-5 w-5 text-muted-foreground"})]})})}),n&&U.rrf_merged.length>0&&(a="results-rrf",o=(i=en.has(a))?U.rrf_merged:U.rrf_merged.slice(0,5),s=U.rrf_merged.length>5,(0,S.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,S.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),ee(e)},children:(0,S.jsxs)("div",{className:"flex items-start gap-3",children:[(0,S.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,S.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,S.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,S.jsxs)("div",{className:"text-xs text-muted-foreground mt-1",children:["RRF Score: ",(e.rrf_score||e.score||0).toFixed(4)]})]})]})},t)),s&&(0,S.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(),eo(a)},children:i?"Show less":`View all ${U.rrf_merged.length} results`})]})),(0,S.jsx)("div",{className:"flex justify-center py-2",children:(0,S.jsx)(pl,{className:"h-4 w-4 text-muted-foreground/50"})})]})),U.reranked&&(l="reranking",u=et.has(l),(0,S.jsxs)("div",{children:[(0,S.jsx)(fx,{className:`cursor-pointer transition-colors ${u?"border-primary":"hover:border-primary/50"}`,onClick:()=>ei(l),children:(0,S.jsx)(fN,{className:"py-4",children:(0,S.jsxs)("div",{className:"flex items-center gap-4",children:[(0,S.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-amber-500/10 flex items-center justify-center",children:(0,S.jsx)("span",{className:"text-sm font-bold text-amber-500",children:"⚡"})}),(0,S.jsxs)("div",{className:"flex-1",children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("span",{className:"font-semibold text-foreground",children:"Combined Scoring"}),(0,S.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:"rerank"})]}),(0,S.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:(0,S.jsx)("span",{className:"font-mono text-xs",children:"0.6×cross_encoder + 0.2×rrf + 0.1×temporal + 0.1×recency"})})]}),(0,S.jsx)("div",{className:"text-2xl font-bold text-foreground",children:U.reranked.length}),u?(0,S.jsx)(fd,{className:"h-5 w-5 text-muted-foreground"}):(0,S.jsx)(z,{className:"h-5 w-5 text-muted-foreground"})]})})}),u&&U.reranked.length>0&&(c="results-rerank",h=(d=en.has(c))?U.reranked:U.reranked.slice(0,5),f=U.reranked.length>5,(0,S.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 r=e.score_components||{};return(0,S.jsx)("div",{className:"p-3 bg-muted/30 rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",onClick:t=>{t.stopPropagation(),ee(e)},children:(0,S.jsxs)("div",{className:"flex items-start gap-3",children:[(0,S.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:t+1}),(0,S.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,S.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:e.text}),(0,S.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-2 text-[10px] text-muted-foreground font-mono",children:[(0,S.jsxs)("span",{className:"font-semibold text-foreground",children:["= ",(e.rerank_score||e.score||0).toFixed(4)]}),void 0!==r.cross_encoder_score_normalized&&(0,S.jsxs)("span",{title:"Cross-encoder (60%)",children:["CE: ",r.cross_encoder_score_normalized.toFixed(3)]}),void 0!==r.rrf_normalized&&(0,S.jsxs)("span",{title:`RRF normalized (20%) - raw: ${r.rrf_score?.toFixed(4)||"N/A"}`,children:["RRF: ",r.rrf_normalized.toFixed(3)]}),void 0!==r.temporal&&(0,S.jsxs)("span",{title:"Temporal proximity (10%)",children:["Tmp: ",r.temporal.toFixed(3)]}),void 0!==r.recency&&(0,S.jsxs)("span",{title:"Recency (10%)",children:["Rec: ",r.recency.toFixed(3)]})]})]})]})},t)}),f&&(0,S.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(),eo(c)},children:d?"Show less":`View all ${U.reranked.length} results`})]})),(0,S.jsx)("div",{className:"flex justify-center py-2",children:(0,S.jsx)(pl,{className:"h-4 w-4 text-muted-foreground/50"})})]})),(0,S.jsx)(fx,{className:"border-primary bg-primary/5",children:(0,S.jsx)(fN,{className:"py-4",children:(0,S.jsxs)("div",{className:"flex items-center gap-4",children:[(0,S.jsx)("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center",children:(0,S.jsx)("span",{className:"text-sm font-bold text-primary",children:"✓"})}),(0,S.jsxs)("div",{className:"flex-1",children:[(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("span",{className:"font-semibold text-foreground",children:"Final Results"}),(0,S.jsx)("span",{className:"text-xs px-2 py-0.5 rounded bg-primary/20 text-primary",children:"output"})]}),(0,S.jsx)("div",{className:"text-sm text-muted-foreground mt-0.5",children:"Top results after all processing steps"})]}),(0,S.jsx)("div",{className:"text-2xl font-bold text-primary",children:A?.length||0})]})})})]}),"json"===Z&&(0,S.jsxs)(fx,{children:[(0,S.jsx)(fb,{children:(0,S.jsx)(fw,{className:"text-lg",children:"Raw Response"})}),(0,S.jsx)(fN,{children:(0,S.jsx)("div",{className:"bg-muted p-4 rounded-lg overflow-auto max-h-[600px]",children:(0,S.jsx)(pa,{src:{results:A,...V&&{entities:V},...H&&{chunks:H},trace:U},collapsed:2,theme:"default"})})})]})]}),!K&&!A&&(0,S.jsx)(fx,{className:"border-dashed",children:(0,S.jsxs)(fN,{className:"flex flex-col items-center justify-center py-16",children:[(0,S.jsx)(B.Search,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,S.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Ready to Recall"}),(0,S.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."})]})}),J&&(0,S.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,S.jsx)(ts,{memory:J,onClose:()=>ee(null),inPanel:!0})})]}):(0,S.jsx)(fx,{className:"border-dashed",children:(0,S.jsxs)(fN,{className:"flex flex-col items-center justify-center py-16",children:[(0,S.jsx)(R,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,S.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"No Bank Selected"}),(0,S.jsx)("p",{className:"text-muted-foreground",children:"Select a memory bank to start recalling."})]})})}let pc=(0,M.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"}]]),pd=(0,M.default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),ph=(0,M.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"}]]),pf=(0,M.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"}]]),pp=(0,M.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"}]]),pg=(0,M.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"}]]),pm=(0,M.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"}]]),pv=(0,M.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"}]]),py={skepticism:{label:"Skepticism",shortLabel:"S",description:"How skeptical vs trusting when forming opinions",lowLabel:"Trusting",highLabel:"Skeptical"},literalism:{label:"Literalism",shortLabel:"L",description:"How literally to interpret information when forming opinions",lowLabel:"Flexible",highLabel:"Literal"},empathy:{label:"Empathy",shortLabel:"E",description:"How much to consider emotional context when forming opinions",lowLabel:"Detached",highLabel:"Empathetic"}};function px({disposition:e,editMode:t,editDisposition:r,onEditChange:n}){let a=t?r:e;return(0,S.jsx)("div",{className:"space-y-4",children:Object.keys(py).map(e=>(0,S.jsxs)("div",{className:"space-y-2",children:[(0,S.jsxs)("div",{className:"flex justify-between items-center",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("label",{className:"text-sm font-medium text-foreground",children:py[e].label}),(0,S.jsx)("p",{className:"text-xs text-muted-foreground",children:py[e].description})]}),(0,S.jsxs)("span",{className:"text-sm font-bold text-primary",children:[a[e],"/5"]})]}),t?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[(0,S.jsx)("span",{children:py[e].lowLabel}),(0,S.jsx)("span",{children:py[e].highLabel})]}),(0,S.jsx)("input",{type:"range",min:"1",max:"5",step:"1",value:r[e],onChange:t=>n(e,parseInt(t.target.value)),className:"w-full h-2 bg-muted rounded-lg appearance-none cursor-pointer accent-primary"})]}):(0,S.jsxs)("div",{className:"flex items-center gap-2",children:[(0,S.jsx)("span",{className:"text-xs text-muted-foreground",children:py[e].lowLabel}),(0,S.jsx)("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:(0,S.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${(a[e]-1)/4*100}%`}})}),(0,S.jsx)("span",{className:"text-xs text-muted-foreground",children:py[e].highLabel})]})]},e))})}function pb(){let{currentBank:e}=(0,D.useBank)(),[t,r]=(0,_.useState)(null),[n,a]=(0,_.useState)(null),[i,o]=(0,_.useState)([]),[s,l]=(0,_.useState)(!1),[u,c]=(0,_.useState)(!1),[d,h]=(0,_.useState)(!1),[f,p]=(0,_.useState)(""),[g,v]=(0,_.useState)({skepticism:3,literalism:3,empathy:3}),y=async()=>{if(e){l(!0);try{let[t,n,i]=await Promise.all([X.client.getBankProfile(e),X.client.getBankStats(e),X.client.listOperations(e)]);r(t),a(n),o(i?.operations||[]),p(t.background),v(t.disposition)}catch(e){console.error("Error loading bank profile:",e),alert("Error loading bank profile: "+e.message)}finally{l(!1)}}},x=async()=>{if(e){c(!0);try{await X.client.updateBankProfile(e,{background:f,disposition:g}),await y(),h(!1)}catch(e){console.error("Error saving bank profile:",e),alert("Error saving bank profile: "+e.message)}finally{c(!1)}}};return((0,_.useEffect)(()=>{if(e){y();let e=setInterval(y,5e3);return()=>clearInterval(e)}},[e]),e)?s&&!t?(0,S.jsx)(fx,{children:(0,S.jsxs)(fN,{className:"text-center py-10",children:[(0,S.jsx)(po,{className:"w-12 h-12 mx-auto mb-3 text-muted-foreground animate-pulse"}),(0,S.jsx)("div",{className:"text-lg text-muted-foreground",children:"Loading profile..."})]})}):(0,S.jsxs)("div",{className:"space-y-6",children:[(0,S.jsxs)("div",{className:"flex justify-between items-center",children:[(0,S.jsxs)("div",{children:[(0,S.jsx)("h2",{className:"text-2xl font-bold text-foreground",children:t?.name||e}),(0,S.jsx)("p",{className:"text-sm text-muted-foreground font-mono",children:e})]}),(0,S.jsx)("div",{className:"flex gap-2",children:d?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Y.Button,{onClick:()=>{t&&(p(t.background),v(t.disposition)),h(!1)},variant:"secondary",disabled:u,children:"Cancel"}),(0,S.jsx)(Y.Button,{onClick:x,disabled:u,children:u?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(pc,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(pd,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(Y.Button,{onClick:y,variant:"secondary",size:"sm",children:[(0,S.jsx)(pc,{className:"w-4 h-4 mr-2"}),"Refresh"]}),(0,S.jsx)(Y.Button,{onClick:()=>h(!0),size:"sm",children:"Edit Profile"})]})})]}),n&&(0,S.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,S.jsx)(fx,{className:"bg-gradient-to-br from-blue-500/10 to-blue-600/5 border-blue-500/20",children:(0,S.jsx)(fN,{className:"p-4",children:(0,S.jsxs)("div",{className:"flex items-center gap-3",children:[(0,S.jsx)("div",{className:"p-2 rounded-lg bg-blue-500/20",children:(0,S.jsx)(R,{className:"w-5 h-5 text-blue-500"})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"Memories"}),(0,S.jsx)("p",{className:"text-2xl font-bold text-foreground",children:n.total_nodes})]})]})})}),(0,S.jsx)(fx,{className:"bg-gradient-to-br from-purple-500/10 to-purple-600/5 border-purple-500/20",children:(0,S.jsx)(fN,{className:"p-4",children:(0,S.jsxs)("div",{className:"flex items-center gap-3",children:[(0,S.jsx)("div",{className:"p-2 rounded-lg bg-purple-500/20",children:(0,S.jsx)(pg,{className:"w-5 h-5 text-purple-500"})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"Links"}),(0,S.jsx)("p",{className:"text-2xl font-bold text-foreground",children:n.total_links})]})]})})}),(0,S.jsx)(fx,{className:"bg-gradient-to-br from-emerald-500/10 to-emerald-600/5 border-emerald-500/20",children:(0,S.jsx)(fN,{className:"p-4",children:(0,S.jsxs)("div",{className:"flex items-center gap-3",children:[(0,S.jsx)("div",{className:"p-2 rounded-lg bg-emerald-500/20",children:(0,S.jsx)(pm,{className:"w-5 h-5 text-emerald-500"})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"Documents"}),(0,S.jsx)("p",{className:"text-2xl font-bold text-foreground",children:n.total_documents})]})]})})}),(0,S.jsx)(fx,{className:`bg-gradient-to-br ${n.pending_operations>0?"from-amber-500/10 to-amber-600/5 border-amber-500/20":"from-slate-500/10 to-slate-600/5 border-slate-500/20"}`,children:(0,S.jsx)(fN,{className:"p-4",children:(0,S.jsxs)("div",{className:"flex items-center gap-3",children:[(0,S.jsx)("div",{className:`p-2 rounded-lg ${n.pending_operations>0?"bg-amber-500/20":"bg-slate-500/20"}`,children:(0,S.jsx)(pv,{className:`w-5 h-5 ${n.pending_operations>0?"text-amber-500 animate-pulse":"text-slate-500"}`})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{className:"text-xs text-muted-foreground font-medium",children:"Pending"}),(0,S.jsx)("p",{className:"text-2xl font-bold text-foreground",children:n.pending_operations})]})]})})})]}),n&&(0,S.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,S.jsxs)("div",{className:"bg-blue-500/10 border border-blue-500/20 rounded-xl p-4 text-center",children:[(0,S.jsx)("p",{className:"text-xs text-blue-600 dark:text-blue-400 font-semibold uppercase tracking-wide",children:"World Facts"}),(0,S.jsx)("p",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400 mt-1",children:n.nodes_by_fact_type?.world||0})]}),(0,S.jsxs)("div",{className:"bg-purple-500/10 border border-purple-500/20 rounded-xl p-4 text-center",children:[(0,S.jsx)("p",{className:"text-xs text-purple-600 dark:text-purple-400 font-semibold uppercase tracking-wide",children:"Experience"}),(0,S.jsx)("p",{className:"text-2xl font-bold text-purple-600 dark:text-purple-400 mt-1",children:n.nodes_by_fact_type?.experience||0})]}),(0,S.jsxs)("div",{className:"bg-amber-500/10 border border-amber-500/20 rounded-xl p-4 text-center",children:[(0,S.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-400 font-semibold uppercase tracking-wide",children:"Opinions"}),(0,S.jsx)("p",{className:"text-2xl font-bold text-amber-600 dark:text-amber-400 mt-1",children:n.nodes_by_fact_type?.opinion||0})]})]}),(0,S.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,S.jsxs)(fx,{children:[(0,S.jsxs)(fb,{className:"pb-2",children:[(0,S.jsxs)(fw,{className:"flex items-center gap-2 text-lg",children:[(0,S.jsx)(ph,{className:"w-5 h-5 text-primary"}),"Disposition Profile"]}),(0,S.jsx)(fj,{children:"Traits that shape how opinions are formed via Reflect"})]}),(0,S.jsx)(fN,{children:t&&(0,S.jsx)(px,{disposition:t.disposition,editMode:d,editDisposition:g,onEditChange:(e,t)=>v(r=>({...r,[e]:t}))})})]}),(0,S.jsx)("div",{className:"space-y-6",children:(0,S.jsxs)(fx,{children:[(0,S.jsxs)(fb,{className:"pb-2",children:[(0,S.jsxs)(fw,{className:"flex items-center gap-2 text-lg",children:[(0,S.jsx)(I,{className:"w-5 h-5 text-primary"}),"Background"]}),(0,S.jsx)(fj,{children:"Context used when forming opinions via Reflect"})]}),(0,S.jsx)(fN,{children:d?(0,S.jsx)(hi.Textarea,{value:f,onChange:e=>p(e.target.value),placeholder:"Enter background information...",rows:5,className:"resize-none"}):(0,S.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap leading-relaxed",children:t?.background||"No background information provided."})})]})})]}),(0,S.jsxs)(fx,{children:[(0,S.jsx)(fb,{className:"pb-2",children:(0,S.jsxs)("div",{className:"flex items-center justify-between",children:[(0,S.jsxs)("div",{children:[(0,S.jsxs)(fw,{className:"flex items-center gap-2 text-lg",children:[(0,S.jsx)(pv,{className:"w-5 h-5 text-primary"}),"Background Operations"]}),(0,S.jsx)(fj,{children:"Async tasks processing memories"})]}),n&&(n.pending_operations>0||n.failed_operations>0)&&(0,S.jsxs)("div",{className:"flex gap-3",children:[n.pending_operations>0&&(0,S.jsxs)("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-amber-500/10 border border-amber-500/20",children:[(0,S.jsx)(po,{className:"w-3.5 h-3.5 text-amber-500"}),(0,S.jsxs)("span",{className:"text-xs font-semibold text-amber-600 dark:text-amber-400",children:[n.pending_operations," pending"]})]}),n.failed_operations>0&&(0,S.jsxs)("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-red-500/10 border border-red-500/20",children:[(0,S.jsx)(pf,{className:"w-3.5 h-3.5 text-red-500"}),(0,S.jsxs)("span",{className:"text-xs font-semibold text-red-600 dark:text-red-400",children:[n.failed_operations," failed"]})]})]})]})}),(0,S.jsx)(fN,{children:i.length>0?(0,S.jsx)("div",{className:"overflow-x-auto",children:(0,S.jsxs)(ee,{children:[(0,S.jsx)(et,{children:(0,S.jsxs)(en,{children:[(0,S.jsx)(ea,{className:"w-[100px]",children:"ID"}),(0,S.jsx)(ea,{children:"Type"}),(0,S.jsx)(ea,{className:"text-center",children:"Items"}),(0,S.jsx)(ea,{children:"Document"}),(0,S.jsx)(ea,{children:"Created"}),(0,S.jsx)(ea,{children:"Status"})]})}),(0,S.jsx)(er,{children:i.slice(0,10).map(e=>(0,S.jsxs)(en,{className:"failed"===e.status?"bg-red-500/5":"",children:[(0,S.jsx)(ei,{className:"font-mono text-xs text-muted-foreground",children:e.id.substring(0,8)}),(0,S.jsx)(ei,{className:"font-medium",children:e.task_type}),(0,S.jsx)(ei,{className:"text-center",children:e.items_count}),(0,S.jsx)(ei,{className:"font-mono text-xs text-muted-foreground",children:e.document_id?e.document_id.substring(0,12)+"...":"—"}),(0,S.jsx)(ei,{className:"text-sm text-muted-foreground",children:new Date(e.created_at).toLocaleString()}),(0,S.jsxs)(ei,{children:["pending"===e.status&&(0,S.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,S.jsx)(po,{className:"w-3 h-3"}),"pending"]}),"failed"===e.status&&(0,S.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,children:[(0,S.jsx)(pf,{className:"w-3 h-3"}),"failed"]}),"completed"===e.status&&(0,S.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,S.jsx)(pp,{className:"w-3 h-3"}),"done"]})]})]},e.id))})]})}):(0,S.jsx)("p",{className:"text-muted-foreground text-center py-8 text-sm",children:"No background operations"})})]})]}):(0,S.jsx)(fx,{children:(0,S.jsxs)(fN,{className:"p-10 text-center",children:[(0,S.jsx)("h3",{className:"text-xl font-semibold mb-2 text-card-foreground",children:"No Bank Selected"}),(0,S.jsx)("p",{className:"text-muted-foreground",children:"Please select a memory bank from the dropdown above to view its profile."})]})})}function pw(){let e=(0,T.useParams)(),t=(0,T.useRouter)(),r=(0,T.useSearchParams)(),n=e.bankId,a=r.get("view")||"profile",i=r.get("subTab")||"world",o=e=>{t.push(`/banks/${n}?view=data&subTab=${e}`)};return(0,S.jsxs)("div",{className:"min-h-screen bg-background flex flex-col",children:[(0,S.jsx)(P.BankSelector,{}),(0,S.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,S.jsx)(q,{currentTab:a,onTabChange:e=>{t.push(`/banks/${n}?view=${e}`)}}),(0,S.jsx)("main",{className:"flex-1 overflow-y-auto",children:(0,S.jsxs)("div",{className:"p-6",children:["profile"===a&&(0,S.jsxs)("div",{children:[(0,S.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Bank Profile"}),(0,S.jsx)("p",{className:"text-muted-foreground mb-6",children:"View and edit the memory bank profile, disposition traits, and background information."}),(0,S.jsx)(pb,{})]}),"recall"===a&&(0,S.jsxs)("div",{children:[(0,S.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Recall Analyzer"}),(0,S.jsx)("p",{className:"text-muted-foreground mb-6",children:"Analyze memory recall with detailed trace information and retrieval methods."}),(0,S.jsx)(pu,{})]}),"reflect"===a&&(0,S.jsxs)("div",{children:[(0,S.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Reflect"}),(0,S.jsx)("p",{className:"text-muted-foreground mb-6",children:"Ask questions and get AI-powered answers based on stored memories."}),(0,S.jsx)(pi,{})]}),"data"===a&&(0,S.jsxs)("div",{children:[(0,S.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Memories"}),(0,S.jsx)("p",{className:"text-muted-foreground mb-6",children:"View and explore different types of memories stored in this memory bank."}),(0,S.jsx)("div",{className:"mb-6 border-b border-border",children:(0,S.jsxs)("div",{className:"flex gap-1",children:[(0,S.jsxs)("button",{onClick:()=>o("world"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"world"===i?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["World Facts","world"===i&&(0,S.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,S.jsxs)("button",{onClick:()=>o("experience"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"experience"===i?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Experience","experience"===i&&(0,S.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]}),(0,S.jsxs)("button",{onClick:()=>o("opinion"),className:`px-6 py-3 font-semibold text-sm transition-all relative ${"opinion"===i?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:["Opinions","opinion"===i&&(0,S.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]})]})}),(0,S.jsxs)("div",{children:["world"===i&&(0,S.jsx)(ht,{factType:"world"},"world"),"experience"===i&&(0,S.jsx)(ht,{factType:"experience"},"experience"),"opinion"===i&&(0,S.jsx)(ht,{factType:"opinion"},"opinion")]})]}),"documents"===a&&(0,S.jsxs)("div",{children:[(0,S.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Documents"}),(0,S.jsx)("p",{className:"text-muted-foreground mb-6",children:"Manage documents and retain new memories."}),(0,S.jsx)(hn,{})]}),"entities"===a&&(0,S.jsxs)("div",{children:[(0,S.jsx)("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Entities"}),(0,S.jsx)("p",{className:"text-muted-foreground mb-6",children:"Explore entities (people, organizations, places) mentioned in memories."}),(0,S.jsx)(ha,{})]})]})})]})]})}e.s(["default",()=>pw],37578)}]);
|