@eventcatalog/core 1.2.6 → 2.0.0
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/.changeset/config.json +11 -0
- package/.github/CODEOWNERS +3 -0
- package/.github/ISSUE_TEMPLATE.md +1 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +18 -0
- package/.github/funding.yml +1 -0
- package/.github/workflows/lint.yml +22 -0
- package/.github/workflows/release.yml +34 -0
- package/.github/workflows/verify-build.yml +27 -0
- package/.prettierignore +7 -0
- package/.prettierrc +10 -0
- package/CHANGELOG.md +10 -571
- package/LICENSE.md +21 -0
- package/README.md +192 -5
- package/astro.config.mjs +57 -0
- package/bin/dist/eventcatalog.cjs +3139 -0
- package/bin/dist/eventcatalog.d.cts +1 -0
- package/bin/dist/eventcatalog.d.ts +1 -0
- package/bin/dist/eventcatalog.js +3141 -0
- package/images/example.png +0 -0
- package/package.json +59 -52
- package/public/icons/github.svg +1 -0
- package/public/icons/x-twitter.svg +1 -0
- package/public/logo.png +0 -0
- package/public/slack-icon.svg +1 -0
- package/scripts/build-ci.js +22 -0
- package/scripts/catalog-to-astro-content-directory.js +188 -0
- package/scripts/default-files-for-collections/commands.md +8 -0
- package/scripts/default-files-for-collections/domains.md +8 -0
- package/scripts/default-files-for-collections/events.md +8 -0
- package/scripts/default-files-for-collections/services.md +8 -0
- package/scripts/default-files-for-collections/teams.md +11 -0
- package/scripts/default-files-for-collections/users.md +11 -0
- package/scripts/start-catalog-locally.js +23 -0
- package/scripts/watcher.js +53 -0
- package/src/components/DocsNavigation.astro +110 -0
- package/src/components/Header.astro +65 -0
- package/src/components/Lists/BasicList.tsx +59 -0
- package/src/components/Lists/OwnersList.tsx +101 -0
- package/src/components/Lists/PillList.tsx +67 -0
- package/src/components/Lists/VersionList.astro +29 -0
- package/src/components/MDX/Accordion/Accordion.astro +10 -0
- package/src/components/MDX/Accordion/Accordion.tsx +29 -0
- package/src/components/MDX/Accordion/AccordionGroup.astro +16 -0
- package/{components/Mdx → src/components/MDX}/Admonition.tsx +6 -5
- package/src/components/MDX/File.tsx +43 -0
- package/src/components/MDX/NodeGraph/DownloadButton.tsx +58 -0
- package/src/components/MDX/NodeGraph/NodeGraph.astro +82 -0
- package/src/components/MDX/NodeGraph/NodeGraph.tsx +135 -0
- package/src/components/MDX/NodeGraph/NodeGraphPortal.tsx +15 -0
- package/src/components/MDX/NodeGraph/Nodes/Command.tsx +74 -0
- package/src/components/MDX/NodeGraph/Nodes/Event.tsx +74 -0
- package/src/components/MDX/NodeGraph/Nodes/Service.tsx +83 -0
- package/src/components/MDX/OpenAPI/OpenAPI.tsx +35 -0
- package/src/components/MDX/Schema.tsx +45 -0
- package/src/components/MDX/components.tsx +24 -0
- package/src/components/Search.astro +108 -0
- package/src/components/Seo.astro +79 -0
- package/src/components/SideBars/DomainSideBar.astro +42 -0
- package/src/components/SideBars/MessageSideBar.astro +81 -0
- package/src/components/SideBars/ServiceSideBar.astro +93 -0
- package/src/components/Tables/DebouncedInput.tsx +32 -0
- package/src/components/Tables/Table.tsx +228 -0
- package/src/components/Tables/columns/DomainTableColumns.tsx +118 -0
- package/src/components/Tables/columns/MessageTableColumns.tsx +159 -0
- package/src/components/Tables/columns/ServiceTableColumns.tsx +162 -0
- package/src/components/Tables/columns/index.tsx +17 -0
- package/src/components/Tables/filters/custom-filters.ts +14 -0
- package/src/content/config.ts +119 -0
- package/src/env.d.ts +2 -0
- package/src/layouts/CustomDocsPageLayout.astro +100 -0
- package/src/layouts/DiscoverLayout.astro +120 -0
- package/src/layouts/DocsLayout.astro +59 -0
- package/src/layouts/PlainPage.astro +29 -0
- package/src/layouts/VisualiserLayout.astro +73 -0
- package/src/pages/discover/[type]/index.astro +36 -0
- package/src/pages/docs/[type]/[id]/[version]/index.astro +215 -0
- package/src/pages/docs/[type]/[id]/[version]/spec/index.astro +93 -0
- package/src/pages/docs/index.md +4 -0
- package/src/pages/docs/teams/[id]/index.astro +127 -0
- package/src/pages/docs/users/[id]/index.astro +132 -0
- package/src/pages/visualiser/[type]/[id]/[version]/index.astro +46 -0
- package/src/pages/visualiser/index.astro +25 -0
- package/src/remark-plugins/mermaid.ts +27 -0
- package/src/remark-plugins/remark-modified-time.mjs +9 -0
- package/src/types/index.ts +2 -0
- package/src/utils/collections/util.ts +22 -0
- package/src/utils/colors.ts +14 -0
- package/src/utils/commands/node-graph.ts +107 -0
- package/src/utils/commands.ts +60 -0
- package/src/utils/config/catalog.ts +2 -0
- package/src/utils/domains/domains.ts +50 -0
- package/src/utils/domains/node-graph.ts +60 -0
- package/src/utils/events/node-graph.ts +108 -0
- package/src/utils/events.ts +62 -0
- package/src/utils/example-remark-plugin.mjs +6 -0
- package/src/utils/messages.ts +7 -0
- package/src/utils/node-graph-utils/utils.ts +31 -0
- package/src/utils/services/node-graph.ts +133 -0
- package/src/utils/services/services.ts +88 -0
- package/src/utils/teams.ts +47 -0
- package/src/utils/users.ts +59 -0
- package/tailwind.config.mjs +24 -0
- package/tsconfig.json +11 -26
- package/.next/BUILD_ID +0 -1
- package/.next/build-manifest.json +0 -246
- package/.next/cache/.tsbuildinfo +0 -1
- package/.next/cache/config.json +0 -7
- package/.next/cache/eslint/.cache_1bay4w0 +0 -1
- package/.next/cache/next-server.js.nft.json +0 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/export-detail.json +0 -1
- package/.next/export-marker.json +0 -1
- package/.next/images-manifest.json +0 -1
- package/.next/next-server.js.nft.json +0 -1
- package/.next/package.json +0 -1
- package/.next/prerender-manifest.json +0 -1
- package/.next/react-loadable-manifest.json +0 -2082
- package/.next/required-server-files.json +0 -1
- package/.next/routes-manifest.json +0 -1
- package/.next/server/chunks/109.js +0 -608
- package/.next/server/chunks/237.js +0 -109
- package/.next/server/chunks/267.js +0 -257
- package/.next/server/chunks/274.js +0 -32
- package/.next/server/chunks/29.js +0 -675
- package/.next/server/chunks/331.js +0 -750
- package/.next/server/chunks/362.js +0 -570
- package/.next/server/chunks/428.js +0 -84
- package/.next/server/chunks/50.js +0 -466
- package/.next/server/chunks/526.js +0 -159
- package/.next/server/chunks/537.js +0 -136
- package/.next/server/chunks/788.js +0 -162
- package/.next/server/chunks/797.js +0 -92
- package/.next/server/chunks/8.js +0 -173
- package/.next/server/chunks/854.js +0 -107
- package/.next/server/chunks/938.js +0 -140
- package/.next/server/chunks/944.js +0 -721
- package/.next/server/chunks/962.js +0 -13
- package/.next/server/chunks/97.js +0 -2829
- package/.next/server/chunks/992.js +0 -50
- package/.next/server/chunks/font-manifest.json +0 -1
- package/.next/server/font-manifest.json +0 -1
- package/.next/server/middleware-manifest.json +0 -6
- package/.next/server/pages/404.html +0 -12
- package/.next/server/pages/500.html +0 -12
- package/.next/server/pages/_app.js +0 -623
- package/.next/server/pages/_app.js.nft.json +0 -1
- package/.next/server/pages/_document.js +0 -120
- package/.next/server/pages/_document.js.nft.json +0 -1
- package/.next/server/pages/_error.js +0 -148
- package/.next/server/pages/_error.js.nft.json +0 -1
- package/.next/server/pages/domains/Orders/events/OrderComplete/logs.html +0 -1
- package/.next/server/pages/domains/Orders/events/OrderComplete/logs.json +0 -1
- package/.next/server/pages/domains/Orders/events/OrderComplete.html +0 -40
- package/.next/server/pages/domains/Orders/events/OrderComplete.json +0 -1
- package/.next/server/pages/domains/Orders/events/OrderConfirmed/logs.html +0 -1
- package/.next/server/pages/domains/Orders/events/OrderConfirmed/logs.json +0 -1
- package/.next/server/pages/domains/Orders/events/OrderConfirmed.html +0 -40
- package/.next/server/pages/domains/Orders/events/OrderConfirmed.json +0 -1
- package/.next/server/pages/domains/Orders/events/OrderCreated/logs.html +0 -1
- package/.next/server/pages/domains/Orders/events/OrderCreated/logs.json +0 -1
- package/.next/server/pages/domains/Orders/events/OrderCreated.html +0 -2
- package/.next/server/pages/domains/Orders/events/OrderCreated.json +0 -1
- package/.next/server/pages/domains/Orders/events/OrderRequested/logs.html +0 -1
- package/.next/server/pages/domains/Orders/events/OrderRequested/logs.json +0 -1
- package/.next/server/pages/domains/Orders/events/OrderRequested.html +0 -40
- package/.next/server/pages/domains/Orders/events/OrderRequested.json +0 -1
- package/.next/server/pages/domains/Orders/services/Orders Service.html +0 -2
- package/.next/server/pages/domains/Orders/services/Orders Service.json +0 -1
- package/.next/server/pages/domains/Orders.html +0 -2
- package/.next/server/pages/domains/Orders.json +0 -1
- package/.next/server/pages/domains/Shopping/events/AddedItemToCart/logs.html +0 -1
- package/.next/server/pages/domains/Shopping/events/AddedItemToCart/logs.json +0 -1
- package/.next/server/pages/domains/Shopping/events/AddedItemToCart/v/0.0.1.html +0 -59
- package/.next/server/pages/domains/Shopping/events/AddedItemToCart/v/0.0.1.json +0 -1
- package/.next/server/pages/domains/Shopping/events/AddedItemToCart/v/0.0.2.html +0 -66
- package/.next/server/pages/domains/Shopping/events/AddedItemToCart/v/0.0.2.json +0 -1
- package/.next/server/pages/domains/Shopping/events/AddedItemToCart.html +0 -65
- package/.next/server/pages/domains/Shopping/events/AddedItemToCart.json +0 -1
- package/.next/server/pages/domains/Shopping/events/RemovedItemFromCart/logs.html +0 -1
- package/.next/server/pages/domains/Shopping/events/RemovedItemFromCart/logs.json +0 -1
- package/.next/server/pages/domains/Shopping/events/RemovedItemFromCart.html +0 -48
- package/.next/server/pages/domains/Shopping/events/RemovedItemFromCart.json +0 -1
- package/.next/server/pages/domains/Shopping.html +0 -2
- package/.next/server/pages/domains/Shopping.json +0 -1
- package/.next/server/pages/domains/[domain]/events/[name]/logs.js +0 -345
- package/.next/server/pages/domains/[domain]/events/[name]/logs.js.nft.json +0 -1
- package/.next/server/pages/domains/[domain]/events/[name]/v/[version].js +0 -435
- package/.next/server/pages/domains/[domain]/events/[name]/v/[version].js.nft.json +0 -1
- package/.next/server/pages/domains/[domain]/events/[name].js +0 -354
- package/.next/server/pages/domains/[domain]/events/[name].js.nft.json +0 -1
- package/.next/server/pages/domains/[domain]/services/[name].js +0 -402
- package/.next/server/pages/domains/[domain]/services/[name].js.nft.json +0 -1
- package/.next/server/pages/domains/[domain].js +0 -549
- package/.next/server/pages/domains/[domain].js.nft.json +0 -1
- package/.next/server/pages/domains.html +0 -3
- package/.next/server/pages/domains.js +0 -576
- package/.next/server/pages/domains.js.nft.json +0 -1
- package/.next/server/pages/domains.json +0 -1
- package/.next/server/pages/events/PaymentProcessed/logs.html +0 -1
- package/.next/server/pages/events/PaymentProcessed/logs.json +0 -1
- package/.next/server/pages/events/PaymentProcessed.html +0 -44
- package/.next/server/pages/events/PaymentProcessed.json +0 -1
- package/.next/server/pages/events/ShipmentDelivered/logs.html +0 -1
- package/.next/server/pages/events/ShipmentDelivered/logs.json +0 -1
- package/.next/server/pages/events/ShipmentDelivered.html +0 -44
- package/.next/server/pages/events/ShipmentDelivered.json +0 -1
- package/.next/server/pages/events/ShipmentDispatched/logs.html +0 -1
- package/.next/server/pages/events/ShipmentDispatched/logs.json +0 -1
- package/.next/server/pages/events/ShipmentDispatched.html +0 -44
- package/.next/server/pages/events/ShipmentDispatched.json +0 -1
- package/.next/server/pages/events/ShipmentPrepared/logs.html +0 -1
- package/.next/server/pages/events/ShipmentPrepared/logs.json +0 -1
- package/.next/server/pages/events/ShipmentPrepared.html +0 -2
- package/.next/server/pages/events/ShipmentPrepared.json +0 -1
- package/.next/server/pages/events/[name]/logs.js +0 -263
- package/.next/server/pages/events/[name]/logs.js.nft.json +0 -1
- package/.next/server/pages/events/[name]/v/[version].js +0 -431
- package/.next/server/pages/events/[name]/v/[version].js.nft.json +0 -1
- package/.next/server/pages/events/[name].js +0 -354
- package/.next/server/pages/events/[name].js.nft.json +0 -1
- package/.next/server/pages/events.html +0 -11
- package/.next/server/pages/events.js +0 -789
- package/.next/server/pages/events.js.nft.json +0 -1
- package/.next/server/pages/events.json +0 -1
- package/.next/server/pages/index.html +0 -1
- package/.next/server/pages/index.js.nft.json +0 -1
- package/.next/server/pages/overview.html +0 -1
- package/.next/server/pages/overview.js +0 -240
- package/.next/server/pages/overview.js.nft.json +0 -1
- package/.next/server/pages/overview.json +0 -1
- package/.next/server/pages/services/Orders Service.html +0 -1
- package/.next/server/pages/services/Orders Service.json +0 -1
- package/.next/server/pages/services/Payment Service.html +0 -2
- package/.next/server/pages/services/Payment Service.json +0 -1
- package/.next/server/pages/services/Shipping Service.html +0 -2
- package/.next/server/pages/services/Shipping Service.json +0 -1
- package/.next/server/pages/services/[name].js +0 -319
- package/.next/server/pages/services/[name].js.nft.json +0 -1
- package/.next/server/pages/services.html +0 -4
- package/.next/server/pages/services.js +0 -741
- package/.next/server/pages/services.js.nft.json +0 -1
- package/.next/server/pages/services.json +0 -1
- package/.next/server/pages/users/[id].js +0 -475
- package/.next/server/pages/users/[id].js.nft.json +0 -1
- package/.next/server/pages/users/dboyne.html +0 -16
- package/.next/server/pages/users/dboyne.json +0 -1
- package/.next/server/pages/users/mSmith.html +0 -13
- package/.next/server/pages/users/mSmith.json +0 -1
- package/.next/server/pages/users.html +0 -1
- package/.next/server/pages/users.js.nft.json +0 -1
- package/.next/server/pages/visualiser.html +0 -16
- package/.next/server/pages/visualiser.js +0 -739
- package/.next/server/pages/visualiser.js.nft.json +0 -1
- package/.next/server/pages/visualiser.json +0 -1
- package/.next/server/pages-manifest.json +0 -23
- package/.next/server/webpack-runtime.js +0 -259
- package/.next/static/chunks/020d8314.2bae2f29ef0060e4.js +0 -1
- package/.next/static/chunks/1178-011609b6f3b123b3.js +0 -1
- package/.next/static/chunks/1476.eb11ab1feb4c5940.js +0 -1
- package/.next/static/chunks/1484.274df63eb11d9d68.js +0 -1
- package/.next/static/chunks/172-940ad0353b57ff98.js +0 -1
- package/.next/static/chunks/1750.a25eb3336a8c3a36.js +0 -1
- package/.next/static/chunks/2017.1b67898bd26fe157.js +0 -1
- package/.next/static/chunks/2027.80b01f1a7005a770.js +0 -1
- package/.next/static/chunks/2076.21cb0bf760a8055d.js +0 -1
- package/.next/static/chunks/2583.56889bb376087220.js +0 -1
- package/.next/static/chunks/2620-21775e17d8a6a407.js +0 -1
- package/.next/static/chunks/2765.dda8bae3343b6d41.js +0 -1
- package/.next/static/chunks/2edb282b-45c56c19221816df.js +0 -1
- package/.next/static/chunks/3082.62ff47793d562412.js +0 -1
- package/.next/static/chunks/3116-e9a578a270d9e013.js +0 -1
- package/.next/static/chunks/3260.00ac1405e82b8dd9.js +0 -1
- package/.next/static/chunks/3706.64742528652de3dd.js +0 -1
- package/.next/static/chunks/3ede58a6.ff6c02b372da8155.js +0 -1
- package/.next/static/chunks/4042.98f113bfbf744466.js +0 -1
- package/.next/static/chunks/4079.75a5db02e1a11105.js +0 -1
- package/.next/static/chunks/438.dea6dada9bd4b683.js +0 -1
- package/.next/static/chunks/4384-8a28a71e7e3b8d8a.js +0 -1
- package/.next/static/chunks/4637.6819aa53bf80d6ff.js +0 -1
- package/.next/static/chunks/4816.03f53c476d2a5924.js +0 -1
- package/.next/static/chunks/5048.73fa7a6d734ba5ef.js +0 -1
- package/.next/static/chunks/5202.6f686702cbb58a65.js +0 -1
- package/.next/static/chunks/5464.4c916df2382b5ba9.js +0 -1
- package/.next/static/chunks/5493-b00dc3d50ab46716.js +0 -1
- package/.next/static/chunks/5644.b4ffa0632405fc9f.js +0 -1
- package/.next/static/chunks/5a7b57ef.d0702578743545b0.js +0 -1
- package/.next/static/chunks/60.40ff539d26f28401.js +0 -1
- package/.next/static/chunks/6101.a35579324b3356df.js +0 -1
- package/.next/static/chunks/6194.045435de6d19fc72.js +0 -1
- package/.next/static/chunks/6772-fba69ba8e4fa1ef4.js +0 -1
- package/.next/static/chunks/6778.7885dc0a314c5a9c.js +0 -1
- package/.next/static/chunks/6790-f4527d80153a3e25.js +0 -1
- package/.next/static/chunks/7005-09e42f99859b8d03.js +0 -1
- package/.next/static/chunks/7109-c8d3fde4c3b6798e.js +0 -1
- package/.next/static/chunks/7195.2768b2bb31a65f2f.js +0 -1
- package/.next/static/chunks/7458.1de01a44cd67f6f0.js +0 -1
- package/.next/static/chunks/7f5d3f51-659399fe6f04b9eb.js +0 -1
- package/.next/static/chunks/8264-a1b0376ff4b3d4da.js +0 -1
- package/.next/static/chunks/828-ef0e36f29db31dde.js +0 -1
- package/.next/static/chunks/8341-b8d844d6f606aed5.js +0 -1
- package/.next/static/chunks/8720.e06d4cca843573db.js +0 -1
- package/.next/static/chunks/8785.1331b2a6d4be82c3.js +0 -1
- package/.next/static/chunks/8829-386c887227aab68c.js +0 -1
- package/.next/static/chunks/9054.ae9ffec47aacae76.js +0 -1
- package/.next/static/chunks/9097.1efc23284d82765c.js +0 -1
- package/.next/static/chunks/9231.af30fa4fedab9f01.js +0 -1
- package/.next/static/chunks/9497.49670ee9a8bd76f7.js +0 -1
- package/.next/static/chunks/9600.f70c0583d23764a8.js +0 -1
- package/.next/static/chunks/9822.0ad553e5c697208c.js +0 -1
- package/.next/static/chunks/9930.28415573db2b7806.js +0 -7
- package/.next/static/chunks/b9e0c7b4-52b02c0d4f161186.js +0 -1
- package/.next/static/chunks/d57e5a30-463f9ed8df724792.js +0 -1
- package/.next/static/chunks/eb6e03f4.2276f931f02e235c.js +0 -1
- package/.next/static/chunks/f4df0e03.56d1c15b5532ab26.js +0 -1
- package/.next/static/chunks/framework-6cc1bceeaaf75e91.js +0 -1
- package/.next/static/chunks/main-da37322a396d572a.js +0 -1
- package/.next/static/chunks/pages/_app-d40841fd52b70886.js +0 -1
- package/.next/static/chunks/pages/_error-c36fa6f7fd569cf6.js +0 -1
- package/.next/static/chunks/pages/domains/[domain]/events/[name]/logs-350f383eed1cf3f8.js +0 -1
- package/.next/static/chunks/pages/domains/[domain]/events/[name]/v/[version]-175a58a05deb2eda.js +0 -1
- package/.next/static/chunks/pages/domains/[domain]/events/[name]-7c7c2526e7d63883.js +0 -1
- package/.next/static/chunks/pages/domains/[domain]/services/[name]-f447208842a47b40.js +0 -1
- package/.next/static/chunks/pages/domains/[domain]-ea20e2daae1794fc.js +0 -1
- package/.next/static/chunks/pages/domains-71179cbdb719a0f8.js +0 -1
- package/.next/static/chunks/pages/events/[name]/logs-695c5b2cfd996539.js +0 -1
- package/.next/static/chunks/pages/events/[name]/v/[version]-af687afaafd7fd45.js +0 -1
- package/.next/static/chunks/pages/events/[name]-24bc568718357116.js +0 -1
- package/.next/static/chunks/pages/events-05ca59359ab07aa2.js +0 -1
- package/.next/static/chunks/pages/index-68062a10328e7d10.js +0 -1
- package/.next/static/chunks/pages/overview-68b31b232c5ef1ff.js +0 -1
- package/.next/static/chunks/pages/services/[name]-b59b95836832898e.js +0 -1
- package/.next/static/chunks/pages/services-2c63507ae596def3.js +0 -1
- package/.next/static/chunks/pages/users/[id]-7306f8a1d8a7012a.js +0 -1
- package/.next/static/chunks/pages/users-412f257b1de51363.js +0 -1
- package/.next/static/chunks/pages/visualiser-8474d03175cf9d12.js +0 -1
- package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
- package/.next/static/chunks/webpack-7e93d0cba2ccf996.js +0 -1
- package/.next/static/css/7e14b4dede1671ad.css +0 -1
- package/.next/static/css/94b9a747218712b2.css +0 -3
- package/.next/static/css/ae8abf3666c55019.css +0 -5
- package/.next/static/css/cc3c8fcadcf7a58b.css +0 -1
- package/.next/static/css/deb57cf90a65a90f.css +0 -1
- package/.next/static/css/ed97de5465a152bb.css +0 -1
- package/.next/static/rP51t_ISuRqZMVs4QvwfY/_buildManifest.js +0 -1
- package/.next/static/rP51t_ISuRqZMVs4QvwfY/_ssgManifest.js +0 -1
- package/.next/trace +0 -141
- package/bin/eventcatalog.js +0 -141
- package/components/BreadCrumbs.tsx +0 -50
- package/components/ContentView.tsx +0 -123
- package/components/Footer.tsx +0 -31
- package/components/Grids/DomainGrid.tsx +0 -61
- package/components/Grids/EventGrid.tsx +0 -102
- package/components/Grids/ServiceGrid.tsx +0 -84
- package/components/Grids/UserGrid.tsx +0 -55
- package/components/Header.tsx +0 -74
- package/components/Mdx/AsyncApiSpec.tsx +0 -25
- package/components/Mdx/Examples.tsx +0 -70
- package/components/Mdx/NodeGraph/GraphElements.tsx +0 -294
- package/components/Mdx/NodeGraph/GraphLayout.ts +0 -110
- package/components/Mdx/NodeGraph/Node.tsx +0 -15
- package/components/Mdx/NodeGraph/NodeGraph.tsx +0 -168
- package/components/Mdx/NodeGraph/__tests__/GraphElements.spec.ts +0 -102
- package/components/Mdx/NodeGraph/__tests__/GraphLayout.spec.ts +0 -115
- package/components/Mdx/NodeGraph/__tests__/__snapshots__/GraphElements.spec.ts.snap +0 -559
- package/components/Mdx/NodeGraph/__tests__/__snapshots__/GraphLayout.spec.ts.snap +0 -81
- package/components/Mdx/OpenApiSpec.tsx +0 -21
- package/components/Mdx/SchemaViewer/SchemaViewer.module.css +0 -5
- package/components/Mdx/SchemaViewer/SchemaViewer.tsx +0 -34
- package/components/Mermaid/index.tsx +0 -58
- package/components/NotFound/index.tsx +0 -40
- package/components/Sidebars/DomainSidebar.tsx +0 -55
- package/components/Sidebars/EventSidebar.tsx +0 -172
- package/components/Sidebars/ServiceSidebar.tsx +0 -128
- package/components/Sidebars/components/ExternalLinks.tsx +0 -28
- package/components/Sidebars/components/ItemList.tsx +0 -32
- package/components/Sidebars/components/Owners.tsx +0 -38
- package/components/Sidebars/components/Tags.tsx +0 -45
- package/components/SyntaxHighlighter.tsx +0 -42
- package/eventcatalog.config.js +0 -58
- package/eventcatalog.styles.css +0 -15
- package/hooks/EventCatalog.tsx +0 -54
- package/lib/__tests__/assets/domains/User/events/UserCreated/index.md +0 -20
- package/lib/__tests__/assets/domains/User/events/UserRemoved/examples/Basic.cs +0 -31
- package/lib/__tests__/assets/domains/User/events/UserRemoved/examples/Basic.js +0 -1
- package/lib/__tests__/assets/domains/User/events/UserRemoved/index.md +0 -16
- package/lib/__tests__/assets/domains/User/events/UserRemoved/schema.json +0 -4
- package/lib/__tests__/assets/domains/User/index.md +0 -16
- package/lib/__tests__/assets/domains/User/services/User Service/index.md +0 -19
- package/lib/__tests__/assets/events/AddedItemToCart/index.md +0 -25
- package/lib/__tests__/assets/events/EmailSent/index.md +0 -15
- package/lib/__tests__/assets/events/EventWithSchemaAndExamples/examples/Basic.cs +0 -31
- package/lib/__tests__/assets/events/EventWithSchemaAndExamples/examples/Basic.js +0 -1
- package/lib/__tests__/assets/events/EventWithSchemaAndExamples/index.md +0 -8
- package/lib/__tests__/assets/events/EventWithSchemaAndExamples/schema.json +0 -4
- package/lib/__tests__/assets/events/EventWithVersions/index.md +0 -10
- package/lib/__tests__/assets/events/EventWithVersions/versioned/0.0.1/index.md +0 -10
- package/lib/__tests__/assets/services/Basket Service/index.md +0 -26
- package/lib/__tests__/assets/services/Email Platform/index.md +0 -17
- package/lib/__tests__/assets/services/Payment Service/index.md +0 -7
- package/lib/__tests__/domains.spec.ts +0 -416
- package/lib/__tests__/events.spec.ts +0 -514
- package/lib/__tests__/file-reader.spec.ts +0 -69
- package/lib/__tests__/graphs.spec.ts +0 -88
- package/lib/__tests__/services.spec.ts +0 -268
- package/lib/analytics.ts +0 -30
- package/lib/domains.ts +0 -160
- package/lib/events.ts +0 -313
- package/lib/file-reader.ts +0 -76
- package/lib/graphs.ts +0 -92
- package/lib/services.ts +0 -126
- package/next-env.d.ts +0 -5
- package/next.config.js +0 -11
- package/out/404/index.html +0 -12
- package/out/404.html +0 -12
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Orders/events/OrderComplete/logs.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Orders/events/OrderComplete.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Orders/events/OrderConfirmed/logs.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Orders/events/OrderConfirmed.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Orders/events/OrderCreated/logs.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Orders/events/OrderCreated.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Orders/events/OrderRequested/logs.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Orders/events/OrderRequested.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Orders/services/Orders Service.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Orders.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Shopping/events/AddedItemToCart/logs.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Shopping/events/AddedItemToCart/v/0.0.1.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Shopping/events/AddedItemToCart/v/0.0.2.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Shopping/events/AddedItemToCart.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Shopping/events/RemovedItemFromCart/logs.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Shopping/events/RemovedItemFromCart.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains/Shopping.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/domains.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/events/PaymentProcessed/logs.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/events/PaymentProcessed.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/events/ShipmentDelivered/logs.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/events/ShipmentDelivered.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/events/ShipmentDispatched/logs.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/events/ShipmentDispatched.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/events/ShipmentPrepared/logs.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/events/ShipmentPrepared.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/events.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/overview.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/services/Orders Service.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/services/Payment Service.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/services/Shipping Service.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/services.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/users/dboyne.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/users/mSmith.json +0 -1
- package/out/_next/data/rP51t_ISuRqZMVs4QvwfY/visualiser.json +0 -1
- package/out/_next/static/chunks/020d8314.2bae2f29ef0060e4.js +0 -1
- package/out/_next/static/chunks/1178-011609b6f3b123b3.js +0 -1
- package/out/_next/static/chunks/1476.eb11ab1feb4c5940.js +0 -1
- package/out/_next/static/chunks/1484.274df63eb11d9d68.js +0 -1
- package/out/_next/static/chunks/172-940ad0353b57ff98.js +0 -1
- package/out/_next/static/chunks/1750.a25eb3336a8c3a36.js +0 -1
- package/out/_next/static/chunks/2017.1b67898bd26fe157.js +0 -1
- package/out/_next/static/chunks/2027.80b01f1a7005a770.js +0 -1
- package/out/_next/static/chunks/2076.21cb0bf760a8055d.js +0 -1
- package/out/_next/static/chunks/2583.56889bb376087220.js +0 -1
- package/out/_next/static/chunks/2620-21775e17d8a6a407.js +0 -1
- package/out/_next/static/chunks/2765.dda8bae3343b6d41.js +0 -1
- package/out/_next/static/chunks/2edb282b-45c56c19221816df.js +0 -1
- package/out/_next/static/chunks/3082.62ff47793d562412.js +0 -1
- package/out/_next/static/chunks/3116-e9a578a270d9e013.js +0 -1
- package/out/_next/static/chunks/3260.00ac1405e82b8dd9.js +0 -1
- package/out/_next/static/chunks/3706.64742528652de3dd.js +0 -1
- package/out/_next/static/chunks/3ede58a6.ff6c02b372da8155.js +0 -1
- package/out/_next/static/chunks/4042.98f113bfbf744466.js +0 -1
- package/out/_next/static/chunks/4079.75a5db02e1a11105.js +0 -1
- package/out/_next/static/chunks/438.dea6dada9bd4b683.js +0 -1
- package/out/_next/static/chunks/4384-8a28a71e7e3b8d8a.js +0 -1
- package/out/_next/static/chunks/4637.6819aa53bf80d6ff.js +0 -1
- package/out/_next/static/chunks/4816.03f53c476d2a5924.js +0 -1
- package/out/_next/static/chunks/5048.73fa7a6d734ba5ef.js +0 -1
- package/out/_next/static/chunks/5202.6f686702cbb58a65.js +0 -1
- package/out/_next/static/chunks/5464.4c916df2382b5ba9.js +0 -1
- package/out/_next/static/chunks/5493-b00dc3d50ab46716.js +0 -1
- package/out/_next/static/chunks/5644.b4ffa0632405fc9f.js +0 -1
- package/out/_next/static/chunks/5a7b57ef.d0702578743545b0.js +0 -1
- package/out/_next/static/chunks/60.40ff539d26f28401.js +0 -1
- package/out/_next/static/chunks/6101.a35579324b3356df.js +0 -1
- package/out/_next/static/chunks/6194.045435de6d19fc72.js +0 -1
- package/out/_next/static/chunks/6772-fba69ba8e4fa1ef4.js +0 -1
- package/out/_next/static/chunks/6778.7885dc0a314c5a9c.js +0 -1
- package/out/_next/static/chunks/6790-f4527d80153a3e25.js +0 -1
- package/out/_next/static/chunks/7005-09e42f99859b8d03.js +0 -1
- package/out/_next/static/chunks/7109-c8d3fde4c3b6798e.js +0 -1
- package/out/_next/static/chunks/7195.2768b2bb31a65f2f.js +0 -1
- package/out/_next/static/chunks/7458.1de01a44cd67f6f0.js +0 -1
- package/out/_next/static/chunks/7f5d3f51-659399fe6f04b9eb.js +0 -1
- package/out/_next/static/chunks/8264-a1b0376ff4b3d4da.js +0 -1
- package/out/_next/static/chunks/828-ef0e36f29db31dde.js +0 -1
- package/out/_next/static/chunks/8341-b8d844d6f606aed5.js +0 -1
- package/out/_next/static/chunks/8720.e06d4cca843573db.js +0 -1
- package/out/_next/static/chunks/8785.1331b2a6d4be82c3.js +0 -1
- package/out/_next/static/chunks/8829-386c887227aab68c.js +0 -1
- package/out/_next/static/chunks/9054.ae9ffec47aacae76.js +0 -1
- package/out/_next/static/chunks/9097.1efc23284d82765c.js +0 -1
- package/out/_next/static/chunks/9231.af30fa4fedab9f01.js +0 -1
- package/out/_next/static/chunks/9497.49670ee9a8bd76f7.js +0 -1
- package/out/_next/static/chunks/9600.f70c0583d23764a8.js +0 -1
- package/out/_next/static/chunks/9822.0ad553e5c697208c.js +0 -1
- package/out/_next/static/chunks/9930.28415573db2b7806.js +0 -7
- package/out/_next/static/chunks/b9e0c7b4-52b02c0d4f161186.js +0 -1
- package/out/_next/static/chunks/d57e5a30-463f9ed8df724792.js +0 -1
- package/out/_next/static/chunks/eb6e03f4.2276f931f02e235c.js +0 -1
- package/out/_next/static/chunks/f4df0e03.56d1c15b5532ab26.js +0 -1
- package/out/_next/static/chunks/framework-6cc1bceeaaf75e91.js +0 -1
- package/out/_next/static/chunks/main-da37322a396d572a.js +0 -1
- package/out/_next/static/chunks/pages/_app-d40841fd52b70886.js +0 -1
- package/out/_next/static/chunks/pages/_error-c36fa6f7fd569cf6.js +0 -1
- package/out/_next/static/chunks/pages/domains/[domain]/events/[name]/logs-350f383eed1cf3f8.js +0 -1
- package/out/_next/static/chunks/pages/domains/[domain]/events/[name]/v/[version]-175a58a05deb2eda.js +0 -1
- package/out/_next/static/chunks/pages/domains/[domain]/events/[name]-7c7c2526e7d63883.js +0 -1
- package/out/_next/static/chunks/pages/domains/[domain]/services/[name]-f447208842a47b40.js +0 -1
- package/out/_next/static/chunks/pages/domains/[domain]-ea20e2daae1794fc.js +0 -1
- package/out/_next/static/chunks/pages/domains-71179cbdb719a0f8.js +0 -1
- package/out/_next/static/chunks/pages/events/[name]/logs-695c5b2cfd996539.js +0 -1
- package/out/_next/static/chunks/pages/events/[name]/v/[version]-af687afaafd7fd45.js +0 -1
- package/out/_next/static/chunks/pages/events/[name]-24bc568718357116.js +0 -1
- package/out/_next/static/chunks/pages/events-05ca59359ab07aa2.js +0 -1
- package/out/_next/static/chunks/pages/index-68062a10328e7d10.js +0 -1
- package/out/_next/static/chunks/pages/overview-68b31b232c5ef1ff.js +0 -1
- package/out/_next/static/chunks/pages/services/[name]-b59b95836832898e.js +0 -1
- package/out/_next/static/chunks/pages/services-2c63507ae596def3.js +0 -1
- package/out/_next/static/chunks/pages/users/[id]-7306f8a1d8a7012a.js +0 -1
- package/out/_next/static/chunks/pages/users-412f257b1de51363.js +0 -1
- package/out/_next/static/chunks/pages/visualiser-8474d03175cf9d12.js +0 -1
- package/out/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
- package/out/_next/static/chunks/webpack-7e93d0cba2ccf996.js +0 -1
- package/out/_next/static/css/7e14b4dede1671ad.css +0 -1
- package/out/_next/static/css/94b9a747218712b2.css +0 -3
- package/out/_next/static/css/ae8abf3666c55019.css +0 -5
- package/out/_next/static/css/cc3c8fcadcf7a58b.css +0 -1
- package/out/_next/static/css/deb57cf90a65a90f.css +0 -1
- package/out/_next/static/css/ed97de5465a152bb.css +0 -1
- package/out/_next/static/rP51t_ISuRqZMVs4QvwfY/_buildManifest.js +0 -1
- package/out/_next/static/rP51t_ISuRqZMVs4QvwfY/_ssgManifest.js +0 -1
- package/out/domains/Orders/events/OrderComplete/index.html +0 -40
- package/out/domains/Orders/events/OrderComplete/logs/index.html +0 -1
- package/out/domains/Orders/events/OrderConfirmed/index.html +0 -40
- package/out/domains/Orders/events/OrderConfirmed/logs/index.html +0 -1
- package/out/domains/Orders/events/OrderCreated/index.html +0 -2
- package/out/domains/Orders/events/OrderCreated/logs/index.html +0 -1
- package/out/domains/Orders/events/OrderRequested/index.html +0 -40
- package/out/domains/Orders/events/OrderRequested/logs/index.html +0 -1
- package/out/domains/Orders/index.html +0 -2
- package/out/domains/Orders/services/Orders Service/index.html +0 -2
- package/out/domains/Shopping/events/AddedItemToCart/index.html +0 -65
- package/out/domains/Shopping/events/AddedItemToCart/logs/index.html +0 -1
- package/out/domains/Shopping/events/AddedItemToCart/v/0.0.1/index.html +0 -59
- package/out/domains/Shopping/events/AddedItemToCart/v/0.0.2/index.html +0 -66
- package/out/domains/Shopping/events/RemovedItemFromCart/index.html +0 -48
- package/out/domains/Shopping/events/RemovedItemFromCart/logs/index.html +0 -1
- package/out/domains/Shopping/index.html +0 -2
- package/out/domains/index.html +0 -3
- package/out/events/PaymentProcessed/index.html +0 -44
- package/out/events/PaymentProcessed/logs/index.html +0 -1
- package/out/events/ShipmentDelivered/index.html +0 -44
- package/out/events/ShipmentDelivered/logs/index.html +0 -1
- package/out/events/ShipmentDispatched/index.html +0 -44
- package/out/events/ShipmentDispatched/logs/index.html +0 -1
- package/out/events/ShipmentPrepared/index.html +0 -2
- package/out/events/ShipmentPrepared/logs/index.html +0 -1
- package/out/events/index.html +0 -11
- package/out/favicon.ico +0 -0
- package/out/index.html +0 -1
- package/out/logo-random.svg +0 -114
- package/out/logo.svg +0 -44
- package/out/opengraph.png +0 -0
- package/out/overview/index.html +0 -1
- package/out/services/Orders Service/index.html +0 -1
- package/out/services/Payment Service/index.html +0 -2
- package/out/services/Shipping Service/index.html +0 -2
- package/out/services/index.html +0 -4
- package/out/users/dboyne/index.html +0 -16
- package/out/users/index.html +0 -1
- package/out/users/mSmith/index.html +0 -13
- package/out/visualiser/index.html +0 -16
- package/pages/_app.tsx +0 -111
- package/pages/_document.tsx +0 -18
- package/pages/domains/[domain]/events/[name]/logs.tsx +0 -35
- package/pages/domains/[domain]/events/[name]/v/[version].tsx +0 -39
- package/pages/domains/[domain]/events/[name].tsx +0 -46
- package/pages/domains/[domain]/index.tsx +0 -137
- package/pages/domains/[domain]/services/[name].tsx +0 -42
- package/pages/domains.tsx +0 -210
- package/pages/events/[name]/logs.tsx +0 -177
- package/pages/events/[name]/v/[version].tsx +0 -38
- package/pages/events/[name].tsx +0 -223
- package/pages/events.tsx +0 -357
- package/pages/index.tsx +0 -56
- package/pages/overview.tsx +0 -89
- package/pages/services/[name].tsx +0 -164
- package/pages/services.tsx +0 -311
- package/pages/users/[id].tsx +0 -101
- package/pages/users.tsx +0 -43
- package/pages/visualiser.tsx +0 -322
- package/postcss.config.js +0 -6
- package/public/logo-random.svg +0 -114
- package/public/logo.svg +0 -44
- package/scripts/__tests__/assets/eventcatalog.config.js +0 -32
- package/scripts/__tests__/generate.spec.ts +0 -36
- package/scripts/generate.js +0 -28
- package/scripts/move-schemas-for-download.js +0 -80
- package/styles/Home.module.css +0 -116
- package/styles/globals.css +0 -85
- package/tailwind.config.js +0 -36
- package/types/index.ts +0 -7
- package/utils/random-bg.ts +0 -13
- /package/{lib/__tests__/assets/services/Payment Service/openapi.yaml → public/openapi.yml} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7174],{7743:function(e,t,n){e.exports=function(){"use strict";function e(t){return e="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(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){return s(e)||l(e,t)||u(e,t)||d()}function s(e){if(Array.isArray(e))return e}function l(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);o=!0);}catch(l){s=!0,a=l}finally{try{o||null==n.return||n.return()}finally{if(s)throw a}}return i}}function u(e,t){if(e){if("string"===typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function d(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var h="undefined"===typeof window?null:window,p=h?h.navigator:null;h&&h.document;var f=e(""),g=e({}),v=e((function(){})),y="undefined"===typeof HTMLElement?"undefined":e(HTMLElement),m=function(e){return e&&e.instanceString&&x(e.instanceString)?e.instanceString():null},b=function(t){return null!=t&&e(t)==f},x=function(t){return null!=t&&e(t)===v},w=function(e){return!T(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},E=function(t){return null!=t&&e(t)===g&&!w(t)&&t.constructor===Object},k=function(t){return null!=t&&e(t)===g},C=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},S=function(e){return C(e)&&Math.floor(e)===e},D=function(e){return"undefined"===y?void 0:null!=e&&e instanceof HTMLElement},T=function(e){return P(e)||_(e)},P=function(e){return"collection"===m(e)&&e._private.single},_=function(e){return"collection"===m(e)&&!e._private.single},M=function(e){return"core"===m(e)},B=function(e){return"stylesheet"===m(e)},N=function(e){return"event"===m(e)},A=function(e){return void 0===e||null===e||!(""!==e&&!e.match(/^\s+$/))},I=function(e){return"undefined"!==typeof HTMLElement&&e instanceof HTMLElement},O=function(e){return E(e)&&C(e.x1)&&C(e.x2)&&C(e.y1)&&C(e.y2)},z=function(e){return k(e)&&x(e.then)},L=function(){return p&&p.userAgent.match(/msie|trident|edge/i)},R=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var n=function n(){var r,a=this,i=arguments,o=t.apply(a,i),s=n.cache;return(r=s[o])||(r=s[o]=e.apply(a,i)),r};return n.cache={},n},V=R((function(e){return e.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()}))})),F=R((function(e){return e.replace(/(-\w)/g,(function(e){return e[1].toUpperCase()}))})),j=R((function(e,t){return e+t[0].toUpperCase()+t.substring(1)}),(function(e,t){return e+"$"+t})),q=function(e){return A(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},X="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",Y="rgb[a]?\\(("+X+"[%]?)\\s*,\\s*("+X+"[%]?)\\s*,\\s*("+X+"[%]?)(?:\\s*,\\s*("+X+"))?\\)",W="rgb[a]?\\((?:"+X+"[%]?)\\s*,\\s*(?:"+X+"[%]?)\\s*,\\s*(?:"+X+"[%]?)(?:\\s*,\\s*(?:"+X+"))?\\)",H="hsl[a]?\\(("+X+")\\s*,\\s*("+X+"[%])\\s*,\\s*("+X+"[%])(?:\\s*,\\s*("+X+"))?\\)",G="hsl[a]?\\((?:"+X+")\\s*,\\s*(?:"+X+"[%])\\s*,\\s*(?:"+X+"[%])(?:\\s*,\\s*(?:"+X+"))?\\)",K="\\#[0-9a-fA-F]{3}",U="\\#[0-9a-fA-F]{6}",Z=function(e,t){return e<t?-1:e>t?1:0},$=function(e,t){return-1*Z(e,t)},Q=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(null!=r)for(var a=Object.keys(r),i=0;i<a.length;i++){var o=a[i];e[o]=r[o]}}return e},J=function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,n,r,a=16;return 4===e.length?(t=parseInt(e[1]+e[1],a),n=parseInt(e[2]+e[2],a),r=parseInt(e[3]+e[3],a)):(t=parseInt(e[1]+e[2],a),n=parseInt(e[3]+e[4],a),r=parseInt(e[5]+e[6],a)),[t,n,r]}},ee=function(e){var t,n,r,a,i,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^"+H+"$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(a=parseFloat(c[3]))<0||a>100)return;if(a/=100,void 0!==(i=c[4])&&((i=parseFloat(i))<0||i>1))return;if(0===r)o=s=l=Math.round(255*a);else{var d=a<.5?a*(1+r):a+r-a*r,h=2*a-d;o=Math.round(255*u(h,d,n+1/3)),s=Math.round(255*u(h,d,n)),l=Math.round(255*u(h,d,n-1/3))}t=[o,s,l,i]}return t},te=function(e){var t,n=new RegExp("^"+Y+"$").exec(e);if(n){t=[];for(var r=[],a=1;a<=3;a++){var i=n[a];if("%"===i[i.length-1]&&(r[a]=!0),i=parseFloat(i),r[a]&&(i=i/100*255),i<0||i>255)return;t.push(Math.floor(i))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t},ne=function(e){return ae[e.toLowerCase()]},re=function(e){return(w(e)?e:null)||ne(e)||J(e)||te(e)||ee(e)},ae={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]},ie=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a<r;a++){var i=n[a];if(E(i))throw Error("Tried to set map with object key");a<n.length-1?(null==t[i]&&(t[i]={}),t=t[i]):t[i]=e.value}},oe=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a<r;a++){var i=n[a];if(E(i))throw Error("Tried to get map with object key");if(null==(t=t[i]))return t}return t};function se(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var le=se,ue="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof n.g?n.g:"undefined"!==typeof self?self:{};function ce(e,t){return e(t={exports:{}},t.exports),t.exports}var de="object"==typeof ue&&ue&&ue.Object===Object&&ue,he="object"==typeof self&&self&&self.Object===Object&&self,pe=de||he||Function("return this")(),fe=function(){return pe.Date.now()},ge=/\s/;function ve(e){for(var t=e.length;t--&&ge.test(e.charAt(t)););return t}var ye=ve,me=/^\s+/;function be(e){return e?e.slice(0,ye(e)+1).replace(me,""):e}var xe=be,we=pe.Symbol,Ee=Object.prototype,ke=Ee.hasOwnProperty,Ce=Ee.toString,Se=we?we.toStringTag:void 0;function De(e){var t=ke.call(e,Se),n=e[Se];try{e[Se]=void 0;var r=!0}catch(i){}var a=Ce.call(e);return r&&(t?e[Se]=n:delete e[Se]),a}var Te=De,Pe=Object.prototype.toString;function _e(e){return Pe.call(e)}var Me=_e,Be="[object Null]",Ne="[object Undefined]",Ae=we?we.toStringTag:void 0;function Ie(e){return null==e?void 0===e?Ne:Be:Ae&&Ae in Object(e)?Te(e):Me(e)}var Oe=Ie;function ze(e){return null!=e&&"object"==typeof e}var Le=ze,Re="[object Symbol]";function Ve(e){return"symbol"==typeof e||Le(e)&&Oe(e)==Re}var Fe=Ve,je=NaN,qe=/^[-+]0x[0-9a-f]+$/i,Xe=/^0b[01]+$/i,Ye=/^0o[0-7]+$/i,We=parseInt;function He(e){if("number"==typeof e)return e;if(Fe(e))return je;if(le(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=le(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=xe(e);var n=Xe.test(e);return n||Ye.test(e)?We(e.slice(2),n?2:8):qe.test(e)?je:+e}var Ge=He,Ke="Expected a function",Ue=Math.max,Ze=Math.min;function $e(e,t,n){var r,a,i,o,s,l,u=0,c=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError(Ke);function p(t){var n=r,i=a;return r=a=void 0,u=t,o=e.apply(i,n)}function f(e){return u=e,s=setTimeout(y,t),c?p(e):o}function g(e){var n=t-(e-l);return d?Ze(n,i-(e-u)):n}function v(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-u>=i}function y(){var e=fe();if(v(e))return m(e);s=setTimeout(y,g(e))}function m(e){return s=void 0,h&&r?p(e):(r=a=void 0,o)}function b(){void 0!==s&&clearTimeout(s),u=0,r=l=a=s=void 0}function x(){return void 0===s?o:m(fe())}function w(){var e=fe(),n=v(e);if(r=arguments,a=this,l=e,n){if(void 0===s)return f(l);if(d)return clearTimeout(s),s=setTimeout(y,t),p(l)}return void 0===s&&(s=setTimeout(y,t)),o}return t=Ge(t)||0,le(n)&&(c=!!n.leading,i=(d="maxWait"in n)?Ue(Ge(n.maxWait)||0,t):i,h="trailing"in n?!!n.trailing:h),w.cancel=b,w.flush=x,w}var Qe=$e,Je=h?h.performance:null,et=Je&&Je.now?function(){return Je.now()}:function(){return Date.now()},tt=function(){if(h){if(h.requestAnimationFrame)return function(e){h.requestAnimationFrame(e)};if(h.mozRequestAnimationFrame)return function(e){h.mozRequestAnimationFrame(e)};if(h.webkitRequestAnimationFrame)return function(e){h.webkitRequestAnimationFrame(e)};if(h.msRequestAnimationFrame)return function(e){h.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(et())}),1e3/60)}}(),nt=function(e){return tt(e)},rt=et,at=9261,it=65599,ot=5381,st=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:at;!(t=e.next()).done;)n=n*it+t.value|0;return n},lt=function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:at)*it+e|0},ut=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ot;return(t<<5)+t+e|0},ct=function(e,t){return 2097152*e+t},dt=function(e){return 2097152*e[0]+e[1]},ht=function(e,t){return[lt(e[0],t[0]),ut(e[1],t[1])]},pt=function(e,t){var n={value:0,done:!1},r=0,a=e.length;return st({next:function(){return r<a?n.value=e[r++]:n.done=!0,n}},t)},ft=function(e,t){var n={value:0,done:!1},r=0,a=e.length;return st({next:function(){return r<a?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},gt=function(){return vt(arguments)},vt=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=0===n?ft(r):ft(r,t)}return t},yt=!0,mt=null!=console.warn,bt=null!=console.trace,xt=Number.MAX_SAFE_INTEGER||9007199254740991,wt=function(){return!0},Et=function(){return!1},kt=function(){return 0},Ct=function(){},St=function(e){throw new Error(e)},Dt=function(e){if(void 0===e)return yt;yt=!!e},Tt=function(e){Dt()&&(mt?console.warn(e):(console.log(e),bt&&console.trace()))},Pt=function(e){return Q({},e)},_t=function(e){return null==e?e:w(e)?e.slice():E(e)?Pt(e):e},Mt=function(e){return e.slice()},Bt=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},Nt={},At=function(){return Nt},It=function(e){var t=Object.keys(e);return function(n){for(var r={},a=0;a<t.length;a++){var i=t[a],o=null==n?void 0:n[i];r[i]=void 0===o?e[i]:o}return r}},Ot=function(e,t,n){for(var r=e.length-1;r>=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},zt=function(e){e.splice(0,e.length)},Lt=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},Rt=function(e,t,n){return n&&(t=j(n,t)),e[t]},Vt=function(e,t,n,r){n&&(t=j(n,t)),e[t]=r},Ft=function(){function e(){t(this,e),this._obj={}}return a(e,[{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]}}]),e}(),jt="undefined"!==typeof Map?Map:Ft,qt="undefined",Xt=function(){function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n){var r;r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n;for(var a=0;a<r.length;a++)this.add(r[a])}}return a(e,[{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)}}]),e}(),Yt=("undefined"===typeof Set?"undefined":e(Set))!==qt?Set:Xt,Wt=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&M(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){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:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new Yt,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=[];w(t.classes)?l=t.classes:b(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();var h=t.style||t.css;h&&(Tt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h)),(void 0===n||n)&&this.restore()}else St("An element must be of type `nodes` or `edges`; you specified `"+r+"`")}else St("An element must have a core reference and parameters set")},Ht=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var a;E(t)&&!T(t)&&(t=(a=t).roots||a.root,n=a.visit,r=a.directed),r=2!==arguments.length||x(n)?r:n,n=x(n)?n:function(){};for(var i,o=this._private.cy,s=t=b(t)?this.filter(t):t,l=[],u=[],c={},d={},h={},p=0,f=this.byGroup(),g=f.nodes,v=f.edges,y=0;y<s.length;y++){var m=s[y],w=m.id();m.isNode()&&(l.unshift(m),e.bfs&&(h[w]=!0,u.push(m)),d[w]=0)}for(var k=function(){var t=e.bfs?l.shift():l.pop(),a=t.id();if(e.dfs){if(h[a])return"continue";h[a]=!0,u.push(t)}var o=d[a],s=c[a],f=null!=s?s.source():null,y=null!=s?s.target():null,m=null==s?void 0:t.same(f)?y[0]:f[0],b=void 0;if(!0===(b=n(t,s,m,p++,o)))return i=t,"break";if(!1===b)return"break";for(var x=t.connectedEdges().filter((function(e){return(!r||e.source().same(t))&&v.has(e)})),w=0;w<x.length;w++){var E=x[w],k=E.connectedNodes().filter((function(e){return!e.same(t)&&g.has(e)})),C=k.id();0===k.length||h[C]||(k=k[0],l.push(k),e.bfs&&(h[C]=!0,u.push(k)),c[C]=E,d[C]=d[a]+1)}};0!==l.length;){var C=k();if("continue"!==C&&"break"===C)break}for(var S=o.collection(),D=0;D<u.length;D++){var P=u[D],_=c[P.id()];null!=_&&S.push(_),S.push(P)}return{path:o.collection(S),found:o.collection(i)}}},Gt={breadthFirstSearch:Ht({bfs:!0}),depthFirstSearch:Ht({dfs:!0})};Gt.bfs=Gt.breadthFirstSearch,Gt.dfs=Gt.depthFirstSearch;var Kt=ce((function(e,t){(function(){var t,n,r,a,i,o,s,l,u,c,d,h,p,f,g;r=Math.floor,c=Math.min,n=function(e,t){return e<t?-1:e>t?1:0},u=function(e,t,a,i,o){var s;if(null==a&&(a=0),null==o&&(o=n),a<0)throw new Error("lo must be non-negative");for(null==i&&(i=e.length);a<i;)o(t,e[s=r((a+i)/2)])<0?i=s:a=s+1;return[].splice.apply(e,[a,a-a].concat(t)),t},o=function(e,t,r){return null==r&&(r=n),e.push(t),f(e,0,e.length-1,r)},i=function(e,t){var r,a;return null==t&&(t=n),r=e.pop(),e.length?(a=e[0],e[0]=r,g(e,0,t)):a=r,a},l=function(e,t,r){var a;return null==r&&(r=n),a=e[0],e[0]=t,g(e,0,r),a},s=function(e,t,r){var a;return null==r&&(r=n),e.length&&r(e[0],t)<0&&(t=(a=[e[0],t])[0],e[0]=a[1],g(e,0,r)),t},a=function(e,t){var a,i,o,s,l,u;for(null==t&&(t=n),l=[],i=0,o=(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()).length;i<o;i++)a=s[i],l.push(g(e,a,t));return l},p=function(e,t,r){var a;if(null==r&&(r=n),-1!==(a=e.indexOf(t)))return f(e,0,a,r),g(e,a,r)},d=function(e,t,r){var i,o,l,u,c;if(null==r&&(r=n),!(o=e.slice(0,t)).length)return o;for(a(o,r),l=0,u=(c=e.slice(t)).length;l<u;l++)i=c[l],s(o,i,r);return o.sort(r).reverse()},h=function(e,t,r){var o,s,l,d,h,p,f,g,v;if(null==r&&(r=n),10*t<=e.length){if(!(l=e.slice(0,t).sort(r)).length)return l;for(s=l[l.length-1],d=0,p=(f=e.slice(t)).length;d<p;d++)r(o=f[d],s)<0&&(u(l,o,0,null,r),l.pop(),s=l[l.length-1]);return l}for(a(e,r),v=[],h=0,g=c(t,e.length);0<=g?h<g:h>g;0<=g?++h:--h)v.push(i(e,r));return v},f=function(e,t,r,a){var i,o,s;for(null==a&&(a=n),i=e[r];r>t&&a(i,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=i},g=function(e,t,r){var a,i,o,s,l;for(null==r&&(r=n),i=e.length,l=t,o=e[t],a=2*t+1;a<i;)(s=a+1)<i&&!(r(e[a],e[s])<0)&&(a=s),e[t]=e[a],a=2*(t=a)+1;return e[t]=o,f(e,l,t,r)},t=function(){function e(e){this.cmp=null!=e?e:n,this.nodes=[]}return e.push=o,e.pop=i,e.replace=l,e.pushpop=s,e.heapify=a,e.updateItem=p,e.nlargest=d,e.nsmallest=h,e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return i(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 l(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return a(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(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}(),function(t,n){e.exports=n()}(0,(function(){return t}))}).call(ue)})),Ut=Kt,Zt=It({root:null,weight:function(e){return 1},directed:!1}),$t={dijkstra:function(e){if(!E(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=Zt(e),r=n.root,a=n.weight,i=n.directed,o=this,s=a,l=b(r)?this.filter(r)[0]:r[0],u={},c={},d={},h=this.byGroup(),p=h.nodes,f=h.edges;f.unmergeBy((function(e){return e.isLoop()}));for(var g=function(e){return u[e.id()]},v=function(e,t){u[e.id()]=t,y.updateItem(e)},y=new Ut((function(e,t){return g(e)-g(t)})),m=0;m<p.length;m++){var x=p[m];u[x.id()]=x.same(l)?0:1/0,y.push(x)}for(var w=function(e,t){for(var n,r=(i?e.edgesTo(t):e.edgesWith(t)).intersect(f),a=1/0,o=0;o<r.length;o++){var l=r[o],u=s(l);(u<a||!n)&&(a=u,n=l)}return{edge:n,dist:a}};y.size()>0;){var k=y.pop(),C=g(k),S=k.id();if(d[S]=C,C!==1/0)for(var D=k.neighborhood().intersect(p),T=0;T<D.length;T++){var P=D[T],_=P.id(),M=w(k,P),B=C+M.dist;B<g(P)&&(v(P,B),c[_]={node:k,edge:M.edge})}}return{distanceTo:function(e){var t=b(e)?p.filter(e)[0]:e[0];return d[t.id()]},pathTo:function(e){var t=b(e)?p.filter(e)[0]:e[0],n=[],r=t,a=r.id();if(t.length>0)for(n.unshift(t);c[a];){var i=c[a];n.unshift(i.edge),n.unshift(i.node),a=(r=i.node).id()}return o.spawn(n)}}}},Qt={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,a=n.length,i=new Array(a),o=n,s=function(e){for(var t=0;t<i.length;t++)if(i[t].has(e))return t},l=0;l<a;l++)i[l]=this.spawn(n[l]);for(var u=r.sort((function(t,n){return e(t)-e(n)})),c=0;c<u.length;c++){var d=u[c],h=d.source()[0],p=d.target()[0],f=s(h),g=s(p),v=i[f],y=i[g];f!==g&&(o.merge(d),v.merge(y),i.splice(g,1))}return o}},Jt=It({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),en={aStar:function(e){var t=this.cy(),n=Jt(e),r=n.root,a=n.goal,i=n.heuristic,o=n.directed,s=n.weight;r=t.collection(r)[0],a=t.collection(a)[0];var l,u,c=r.id(),d=a.id(),h={},p={},f={},g=new Ut((function(e,t){return p[e.id()]-p[t.id()]})),v=new Yt,y={},m={},b=function(e,t){g.push(e),v.add(t)},x=function(){l=g.pop(),u=l.id(),v.delete(u)},w=function(e){return v.has(e)};b(r,c),h[c]=0,p[c]=i(r);for(var E=0;g.size()>0;){if(x(),E++,u===d){for(var k=[],C=a,S=d,D=m[S];k.unshift(C),null!=D&&k.unshift(D),null!=(C=y[S]);)D=m[S=C.id()];return{found:!0,distance:h[u],path:this.spawn(k),steps:E}}f[u]=!0;for(var T=l._private.edges,P=0;P<T.length;P++){var _=T[P];if(this.hasElementWithId(_.id())&&(!o||_.data("source")===u)){var M=_.source(),B=_.target(),N=M.id()!==u?M:B,A=N.id();if(this.hasElementWithId(A)&&!f[A]){var I=h[u]+s(_);w(A)?I<h[A]&&(h[A]=I,p[A]=I+i(N),y[A]=l,m[A]=_):(h[A]=I,p[A]=I+i(N),b(N,A),y[A]=l,m[A]=_)}}}}return{found:!1,distance:void 0,path:void 0,steps:E}}},tn=It({weight:function(e){return 1},directed:!1}),nn={floydWarshall:function(e){for(var t=this.cy(),n=tn(e),r=n.weight,a=n.directed,i=r,o=this.byGroup(),s=o.nodes,l=o.edges,u=s.length,c=u*u,d=function(e){return s.indexOf(e)},h=function(e){return s[e]},p=new Array(c),f=0;f<c;f++){var g=f%u,v=(f-g)/u;p[f]=v===g?0:1/0}for(var y=new Array(c),m=new Array(c),x=0;x<l.length;x++){var w=l[x],E=w.source()[0],k=w.target()[0];if(E!==k){var C=d(E),S=d(k),D=C*u+S,T=i(w);if(p[D]>T&&(p[D]=T,y[D]=S,m[D]=w),!a){var P=S*u+C;!a&&p[P]>T&&(p[P]=T,y[P]=C,m[P]=w)}}}for(var _=0;_<u;_++)for(var M=0;M<u;M++)for(var B=M*u+_,N=0;N<u;N++){var A=M*u+N,I=_*u+N;p[B]+p[I]<p[A]&&(p[A]=p[B]+p[I],y[A]=y[B])}var O=function(e){return(b(e)?t.filter(e):e)[0]},z=function(e){return d(O(e))},L={distance:function(e,t){var n=z(e),r=z(t);return p[n*u+r]},path:function(e,n){var r=z(e),a=z(n),i=h(r);if(r===a)return i.collection();if(null==y[r*u+a])return t.collection();var o,s=t.collection(),l=r;for(s.merge(i);r!==a;)l=r,r=y[r*u+a],o=m[l*u+r],s.merge(o),s.merge(h(r));return s}};return L}},rn=It({weight:function(e){return 1},directed:!1,root:null}),an={bellmanFord:function(e){var t=this,n=rn(e),r=n.weight,a=n.directed,i=n.root,o=r,s=this,l=this.cy(),u=this.byGroup(),c=u.edges,d=u.nodes,h=d.length,p=new jt,f=!1,g=[];i=l.collection(i)[0],c.unmergeBy((function(e){return e.isLoop()}));for(var v=c.length,y=function(e){var t=p.get(e.id());return t||(t={},p.set(e.id(),t)),t},m=function(e){return(b(e)?l.$(e):e)[0]},x=function(e){return y(m(e)).dist},w=function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i,r=[],a=m(e);;){if(null==a)return t.spawn();var o=y(a),l=o.edge,u=o.pred;if(r.unshift(a[0]),a.same(n)&&r.length>0)break;null!=l&&r.unshift(l),a=u}return s.spawn(r)},E=0;E<h;E++){var k=d[E],C=y(k);k.same(i)?C.dist=0:C.dist=1/0,C.pred=null,C.edge=null}for(var S=!1,D=function(e,t,n,r,a,i){var o=r.dist+i;o<a.dist&&!n.same(r.edge)&&(a.dist=o,a.pred=e,a.edge=n,S=!0)},T=1;T<h;T++){S=!1;for(var P=0;P<v;P++){var _=c[P],M=_.source(),B=_.target(),N=o(_),A=y(M),I=y(B);D(M,B,_,A,I,N),a||D(B,M,_,I,A,N)}if(!S)break}if(S)for(var O=[],z=0;z<v;z++){var L=c[z],R=L.source(),V=L.target(),F=o(L),j=y(R).dist,q=y(V).dist;if(j+F<q||!a&&q+F<j){if(f||(Tt("Graph contains a negative weight cycle for Bellman-Ford"),f=!0),!1===e.findNegativeWeightCycles)break;var X=[];j+F<q&&X.push(R),!a&&q+F<j&&X.push(V);for(var Y=X.length,W=0;W<Y;W++){var H=X[W],G=[H];G.push(y(H).edge);for(var K=y(H).pred;-1===G.indexOf(K);)G.push(K),G.push(y(K).edge),K=y(K).pred;for(var U=(G=G.slice(G.indexOf(K)))[0].id(),Z=0,$=2;$<G.length;$+=2)G[$].id()<U&&(U=G[$].id(),Z=$);(G=G.slice(Z).concat(G.slice(0,Z))).push(G[0]);var Q=G.map((function(e){return e.id()})).join(",");-1===O.indexOf(Q)&&(g.push(s.spawn(G)),O.push(Q))}}}return{distanceTo:x,pathTo:w,hasNegativeWeightCycle:f,negativeWeightCycles:g}}},on=Math.sqrt(2),sn=function(e,t,n){0===n.length&&St("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],a=r[1],i=r[2],o=t[a],s=t[i],l=n,u=l.length-1;u>=0;u--){var c=l[u],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&l.splice(u,1)}for(var p=0;p<l.length;p++){var f=l[p];f[1]===s?(l[p]=f.slice(),l[p][1]=o):f[2]===s&&(l[p]=f.slice(),l[p][2]=o)}for(var g=0;g<t.length;g++)t[g]===s&&(t[g]=o);return l},ln=function(e,t,n,r){for(;n>r;){var a=Math.floor(Math.random()*t.length);t=sn(a,e,t),n--}return t},un={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var a=n.length,i=r.length,o=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),s=Math.floor(a/on);if(!(a<2)){for(var l=[],u=0;u<i;u++){var c=r[u];l.push([u,n.indexOf(c.source()),n.indexOf(c.target())])}for(var d=1/0,h=[],p=new Array(a),f=new Array(a),g=new Array(a),v=function(e,t){for(var n=0;n<a;n++)t[n]=e[n]},y=0;y<=o;y++){for(var m=0;m<a;m++)f[m]=m;var b=ln(f,l.slice(),a,s),x=b.slice();v(f,g);var w=ln(f,b,s,2),E=ln(g,x,s,2);w.length<=E.length&&w.length<d?(d=w.length,h=w,v(f,p)):E.length<=w.length&&E.length<d&&(d=E.length,h=E,v(g,p))}for(var k=this.spawn(h.map((function(e){return r[e[0]]}))),C=this.spawn(),S=this.spawn(),D=p[0],T=0;T<p.length;T++){var P=p[T],_=n[T];P===D?C.merge(_):S.merge(_)}var M=function(t){var n=e.spawn();return t.forEach((function(t){n.merge(t),t.connectedEdges().forEach((function(t){e.contains(t)&&!k.contains(t)&&n.merge(t)}))})),n},B=[M(C),M(S)];return{cut:k,components:B,partition1:C,partition2:S}}St("At least 2 nodes are required for Karger-Stein algorithm")}},cn=function(e){return{x:e.x,y:e.y}},dn=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},hn=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},pn=function(e){return{x:e[0],y:e[1]}},fn=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,a=t;a<n;a++){var i=e[a];isFinite(i)&&(r=Math.min(i,r))}return r},gn=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,a=t;a<n;a++){var i=e[a];isFinite(i)&&(r=Math.max(i,r))}return r},vn=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,a=0,i=t;i<n;i++){var o=e[i];isFinite(o)&&(r+=o,a++)}return r/a},yn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t)):e=e.slice(t,n);for(var i=0,o=e.length-1;o>=0;o--){var s=e[o];a?isFinite(s)||(e[o]=-1/0,i++):e.splice(o,1)}r&&e.sort((function(e,t){return e-t}));var l=e.length,u=Math.floor(l/2);return l%2!==0?e[u+1+i]:(e[u-1+i]+e[u+i])/2},mn=function(e){return Math.PI*e/180},bn=function(e,t){return Math.atan2(t,e)-Math.PI/2},xn=Math.log2||function(e){return Math.log(e)/Math.log(2)},wn=function(e){return e>0?1:e<0?-1:0},En=function(e,t){return Math.sqrt(kn(e,t))},kn=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Cn=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var a=0;a<t;a++)e[a]=e[a]/n;return e},Sn=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},Dn=function(e,t,n,r){return{x:Sn(e.x,t.x,n.x,r),y:Sn(e.y,t.y,n.y,r)}},Tn=function(e,t,n,r){var a={x:t.x-e.x,y:t.y-e.y},i=En(e,t),o={x:a.x/i,y:a.y/i};return n=null==n?0:n,r=null!=r?r:n*i,{x:e.x+o.x*r,y:e.y+o.y*r}},Pn=function(e,t,n){return Math.max(e,Math.min(n,t))},_n=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};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}}},Mn=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Bn=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Nn=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},An=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},In=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},On=function(e){var t,n,r,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===i.length)t=n=r=a=i[0];else if(2===i.length)t=r=i[0],a=n=i[1];else if(4===i.length){var s=o(i,4);t=s[0],n=s[1],r=s[2],a=s[3]}return e.x1-=a,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},zn=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},Ln=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)},Rn=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Vn=function(e,t){return Rn(e,t.x,t.y)},Fn=function(e,t){return Rn(e,t.x1,t.y1)&&Rn(e,t.x2,t.y2)},jn=function(e,t,n,r,a,i,o){var s,l=cr(a,i),u=a/2,c=i/2,d=r-c-o;if((s=rr(e,t,n,r,n-u+l-o,d,n+u-l+o,d,!1)).length>0)return s;var h=n+u+o;if((s=rr(e,t,n,r,h,r-c+l-o,h,r+c-l+o,!1)).length>0)return s;var p=r+c+o;if((s=rr(e,t,n,r,n-u+l-o,p,n+u-l+o,p,!1)).length>0)return s;var f,g=n-u-o;if((s=rr(e,t,n,r,g,r-c+l-o,g,r+c-l+o,!1)).length>0)return s;var v=n-u+l,y=r-c+l;if((f=tr(e,t,n,r,v,y,l+o)).length>0&&f[0]<=v&&f[1]<=y)return[f[0],f[1]];var m=n+u-l,b=r-c+l;if((f=tr(e,t,n,r,m,b,l+o)).length>0&&f[0]>=m&&f[1]<=b)return[f[0],f[1]];var x=n+u-l,w=r+c-l;if((f=tr(e,t,n,r,x,w,l+o)).length>0&&f[0]>=x&&f[1]>=w)return[f[0],f[1]];var E=n-u+l,k=r+c-l;return(f=tr(e,t,n,r,E,k,l+o)).length>0&&f[0]<=E&&f[1]>=k?[f[0],f[1]]:[]},qn=function(e,t,n,r,a,i,o){var s=o,l=Math.min(n,a),u=Math.max(n,a),c=Math.min(r,i),d=Math.max(r,i);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},Xn=function(e,t,n,r,a,i,o,s,l){var u={x1:Math.min(n,o,a)-l,x2:Math.max(n,o,a)+l,y1:Math.min(r,s,i)-l,y2:Math.max(r,s,i)+l};return!(e<u.x1||e>u.x2||t<u.y1||t>u.y2)},Yn=function(e,t,n,r){var a=t*t-4*e*(n-=r);if(a<0)return[];var i=Math.sqrt(a),o=2*e;return[(-t+i)/o,(-t-i)/o]},Wn=function(e,t,n,r,a){var i,o,s,l,u,c,d,h;return 0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),i=(o=(3*n-t*t)/9)*o*o+(s/=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,void(a[5]=-d)):(a[5]=a[3]=0,0===i?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),a[0]=2*h-d,void(a[4]=a[2]=-(h+d))):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),h=2*Math.sqrt(o),a[0]=-d+h*Math.cos(l/3),a[2]=-d+h*Math.cos((l+2*Math.PI)/3),void(a[4]=-d+h*Math.cos((l+4*Math.PI)/3))))},Hn=function(e,t,n,r,a,i,o,s){var l=[];Wn(1*n*n-4*n*a+2*n*o+4*a*a-4*a*o+o*o+r*r-4*r*i+2*r*s+4*i*i-4*i*s+s*s,9*n*a-3*n*n-3*n*o-6*a*a+3*a*o+9*r*i-3*r*r-3*r*s-6*i*i+3*i*s,3*n*n-6*n*a+n*o-n*e+2*a*a+2*a*e-o*e+3*r*r-6*r*i+r*s-r*t+2*i*i+2*i*t-s*t,1*n*a-n*n+n*e-a*e+r*i-r*r+r*t-i*t,l);for(var u=1e-7,c=[],d=0;d<6;d+=2)Math.abs(l[d+1])<u&&l[d]>=0&&l[d]<=1&&c.push(l[d]);c.push(1),c.push(0);for(var h,p,f,g=-1,v=0;v<c.length;v++)h=Math.pow(1-c[v],2)*n+2*(1-c[v])*c[v]*a+c[v]*c[v]*o,p=Math.pow(1-c[v],2)*r+2*(1-c[v])*c[v]*i+c[v]*c[v]*s,f=Math.pow(h-e,2)+Math.pow(p-t,2),g>=0?f<g&&(g=f):g=f;return g},Gn=function(e,t,n,r,a,i){var o=[e-n,t-r],s=[a-n,i-r],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},Kn=function(e,t,n){for(var r,a,i,o,s=0,l=0;l<n.length/2;l++)if(r=n[2*l],a=n[2*l+1],l+1<n.length/2?(i=n[2*(l+1)],o=n[2*(l+1)+1]):(i=n[2*(l+1-n.length/2)],o=n[2*(l+1-n.length/2)+1]),r==e&&i==e);else{if(!(r>=e&&e>=i||r<=e&&e<=i))continue;(e-r)/(i-r)*(o-a)+a>t&&s++}return s%2!==0},Un=function(e,t,n,r,a,i,o,s,l){var u,c=new Array(n.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,h=Math.cos(-u),p=Math.sin(-u),f=0;f<c.length/2;f++)c[2*f]=i/2*(n[2*f]*h-n[2*f+1]*p),c[2*f+1]=o/2*(n[2*f+1]*h+n[2*f]*p),c[2*f]+=r,c[2*f+1]+=a;if(l>0){var g=Qn(c,-l);d=$n(g)}else d=c;return Kn(e,t,d)},Zn=function(e,t,n,r,a,i,o){for(var s=new Array(n.length),l=i/2,u=o/2,c=dr(i,o),d=c*c,h=0;h<n.length/4;h++){var p=void 0,f=void 0;p=0===h?n.length-2:4*h-2,f=4*h+2;var g=r+l*n[4*h],v=a+u*n[4*h+1],y=-n[p]*n[f]-n[p+1]*n[f+1],m=c/Math.tan(Math.acos(y)/2),b=g-m*n[p],x=v-m*n[p+1],w=g+m*n[f],E=v+m*n[f+1];s[4*h]=b,s[4*h+1]=x,s[4*h+2]=w,s[4*h+3]=E;var k=n[p+1],C=-n[p];k*n[f]+C*n[f+1]<0&&(k*=-1,C*=-1);var S=b+k*c,D=x+C*c;if(Math.pow(S-e,2)+Math.pow(D-t,2)<=d)return!0}return Kn(e,t,s)},$n=function(e){for(var t,n,r,a,i,o,s,l,u=new Array(e.length/2),c=0;c<e.length/4;c++){t=e[4*c],n=e[4*c+1],r=e[4*c+2],a=e[4*c+3],c<e.length/4-1?(i=e[4*(c+1)],o=e[4*(c+1)+1],s=e[4*(c+1)+2],l=e[4*(c+1)+3]):(i=e[0],o=e[1],s=e[2],l=e[3]);var d=rr(t,n,r,a,i,o,s,l,!0);u[2*c]=d[0],u[2*c+1]=d[1]}return u},Qn=function(e,t){for(var n,r,a,i,o=new Array(2*e.length),s=0;s<e.length/2;s++){n=e[2*s],r=e[2*s+1],s<e.length/2-1?(a=e[2*(s+1)],i=e[2*(s+1)+1]):(a=e[0],i=e[1]);var l=i-r,u=-(a-n),c=Math.sqrt(l*l+u*u),d=l/c,h=u/c;o[4*s]=n+d*t,o[4*s+1]=r+h*t,o[4*s+2]=a+d*t,o[4*s+3]=i+h*t}return o},Jn=function(e,t,n,r,a,i){var o=n-e,s=r-t;o/=a,s/=i;var l=Math.sqrt(o*o+s*s),u=l-1;if(u<0)return[];var c=u/l;return[(n-e)*c+e,(r-t)*c+t]},er=function(e,t,n,r,a,i,o){return e-=a,t-=i,(e/=n/2+o)*e+(t/=r/2+o)*t<=1},tr=function(e,t,n,r,a,i,o){var s=[n-e,r-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),p=(-c-Math.sqrt(d))/(2*u),f=Math.min(h,p),g=Math.max(h,p),v=[];if(f>=0&&f<=1&&v.push(f),g>=0&&g<=1&&v.push(g),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},nr=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},rr=function(e,t,n,r,a,i,o,s,l){var u=e-a,c=n-e,d=o-a,h=t-i,p=r-t,f=s-i,g=d*h-f*u,v=c*h-p*u,y=f*c-d*p;if(0!==y){var m=g/y,b=v/y,x=.001,w=0-x,E=1+x;return w<=m&&m<=E&&w<=b&&b<=E||l?[e+m*c,t+m*p]:[]}return 0===g||0===v?nr(e,n,o)===o?[o,s]:nr(e,n,a)===a?[a,i]:nr(a,o,n)===n?[n,r]:[]:[]},ar=function(e,t,n,r,a,i,o,s){var l,u,c,d,h,p,f=[],g=new Array(n.length),v=!0;if(null==i&&(v=!1),v){for(var y=0;y<g.length/2;y++)g[2*y]=n[2*y]*i+r,g[2*y+1]=n[2*y+1]*o+a;if(s>0){var m=Qn(g,-s);u=$n(m)}else u=g}else u=n;for(var b=0;b<u.length/2;b++)c=u[2*b],d=u[2*b+1],b<u.length/2-1?(h=u[2*(b+1)],p=u[2*(b+1)+1]):(h=u[0],p=u[1]),0!==(l=rr(e,t,r,a,c,d,h,p)).length&&f.push(l[0],l[1]);return f},ir=function(e,t,n,r,a,i,o,s){for(var l,u=[],c=new Array(n.length),d=i/2,h=o/2,p=dr(i,o),f=0;f<n.length/4;f++){var g=void 0,v=void 0;g=0===f?n.length-2:4*f-2,v=4*f+2;var y=r+d*n[4*f],m=a+h*n[4*f+1],b=-n[g]*n[v]-n[g+1]*n[v+1],x=p/Math.tan(Math.acos(b)/2),w=y-x*n[g],E=m-x*n[g+1],k=y+x*n[v],C=m+x*n[v+1];0===f?(c[n.length-2]=w,c[n.length-1]=E):(c[4*f-2]=w,c[4*f-1]=E),c[4*f]=k,c[4*f+1]=C;var S=n[g+1],D=-n[g];S*n[v]+D*n[v+1]<0&&(S*=-1,D*=-1),0!==(l=tr(e,t,r,a,w+S*p,E+D*p,p)).length&&u.push(l[0],l[1])}for(var T=0;T<c.length/4;T++)0!==(l=rr(e,t,r,a,c[4*T],c[4*T+1],c[4*T+2],c[4*T+3],!1)).length&&u.push(l[0],l[1]);if(u.length>2){for(var P=[u[0],u[1]],_=Math.pow(P[0]-e,2)+Math.pow(P[1]-t,2),M=1;M<u.length/2;M++){var B=Math.pow(u[2*M]-e,2)+Math.pow(u[2*M+1]-t,2);B<=_&&(P[0]=u[2*M],P[1]=u[2*M+1],_=B)}return P}return u},or=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],a=Math.sqrt(r[0]*r[0]+r[1]*r[1]),i=(a-n)/a;return i<0&&(i=1e-5),[t[0]+i*r[0],t[1]+i*r[1]]},sr=function(e,t){var n=ur(e,t);return n=lr(n)},lr=function(e){for(var t,n,r=e.length/2,a=1/0,i=1/0,o=-1/0,s=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],a=Math.min(a,t),o=Math.max(o,t),i=Math.min(i,n),s=Math.max(s,n);for(var u=2/(o-a),c=2/(s-i),d=0;d<r;d++)t=e[2*d]=e[2*d]*u,n=e[2*d+1]=e[2*d+1]*c,a=Math.min(a,t),o=Math.max(o,t),i=Math.min(i,n),s=Math.max(s,n);if(i<-1)for(var h=0;h<r;h++)n=e[2*h+1]=e[2*h+1]+(-1-i);return e},ur=function(e,t){var n=1/e*2*Math.PI,r=e%2===0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var a,i=new Array(2*e),o=0;o<e;o++)a=o*n+r,i[2*o]=Math.cos(a),i[2*o+1]=Math.sin(-a);return i},cr=function(e,t){return Math.min(e/4,t/4,8)},dr=function(e,t){return Math.min(e/10,t/10,8)},hr=function(){return 8},pr=function(e,t,n){return[e-2*t+n,2*(t-e),e]},fr=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},gr=It({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),vr={pageRank:function(e){for(var t=gr(e),n=t.dampingFactor,r=t.precision,a=t.iterations,i=t.weight,o=this._private.cy,s=this.byGroup(),l=s.nodes,u=s.edges,c=l.length,d=c*c,h=u.length,p=new Array(d),f=new Array(c),g=(1-n)/c,v=0;v<c;v++){for(var y=0;y<c;y++)p[v*c+y]=0;f[v]=0}for(var m=0;m<h;m++){var b=u[m],x=b.data("source"),w=b.data("target");if(x!==w){var E=l.indexOfId(x),k=l.indexOfId(w),C=i(b);p[k*c+E]+=C,f[E]+=C}}for(var S=1/c+g,D=0;D<c;D++)if(0===f[D])for(var T=0;T<c;T++)p[T*c+D]=S;else for(var P=0;P<c;P++){var _=P*c+D;p[_]=p[_]/f[D]+g}for(var M,B=new Array(c),N=new Array(c),A=0;A<c;A++)B[A]=1;for(var I=0;I<a;I++){for(var O=0;O<c;O++)N[O]=0;for(var z=0;z<c;z++)for(var L=0;L<c;L++){var R=z*c+L;N[z]+=p[R]*B[L]}Cn(N),M=B,B=N,N=M;for(var V=0,F=0;F<c;F++){var j=M[F]-B[F];V+=j*j}if(V<r)break}return{rank:function(e){return e=o.collection(e)[0],B[l.indexOf(e)]}}}},yr=It({root:null,weight:function(e){return 1},directed:!1,alpha:0}),mr={degreeCentralityNormalized:function(e){e=yr(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var a={},i={},o=0,s=0,l=0;l<r;l++){var u=n[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:(b(e)&&(e=t.filter(e)),a[e.id()]/o)},outdegree:function(e){return 0===s?0:(b(e)&&(e=t.filter(e)),i[e.id()]/s)}}}for(var h={},p=0,f=0;f<r;f++){var g=n[f];e.root=g;var v=this.degreeCentrality(e);p<v.degree&&(p=v.degree),h[g.id()]=v.degree}return{degree:function(e){return 0===p?0:(b(e)&&(e=t.filter(e)),h[e.id()]/p)}}},degreeCentrality:function(e){e=yr(e);var t=this.cy(),n=this,r=e,a=r.root,i=r.weight,o=r.directed,s=r.alpha;if(a=t.collection(a)[0],o){for(var l=a.connectedEdges(),u=l.filter((function(e){return e.target().same(a)&&n.has(e)})),c=l.filter((function(e){return e.source().same(a)&&n.has(e)})),d=u.length,h=c.length,p=0,f=0,g=0;g<u.length;g++)p+=i(u[g]);for(var v=0;v<c.length;v++)f+=i(c[v]);return{indegree:Math.pow(d,1-s)*Math.pow(p,s),outdegree:Math.pow(h,1-s)*Math.pow(f,s)}}for(var y=a.connectedEdges().intersection(n),m=y.length,b=0,x=0;x<y.length;x++)b+=i(y[x]);return{degree:Math.pow(m,1-s)*Math.pow(b,s)}}};mr.dc=mr.degreeCentrality,mr.dcn=mr.degreeCentralityNormalised=mr.degreeCentralityNormalized;var br=It({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),xr={closenessCentralityNormalized:function(e){for(var t=br(e),n=t.harmonic,r=t.weight,a=t.directed,i=this.cy(),o={},s=0,l=this.nodes(),u=this.floydWarshall({weight:r,directed:a}),c=0;c<l.length;c++){for(var d=0,h=l[c],p=0;p<l.length;p++)if(c!==p){var f=u.distance(h,l[p]);d+=n?1/f:f}n||(d=1/d),s<d&&(s=d),o[h.id()]=d}return{closeness:function(e){return 0==s?0:(e=b(e)?i.filter(e)[0].id():e.id(),o[e]/s)}}},closenessCentrality:function(e){var t=br(e),n=t.root,r=t.weight,a=t.directed,i=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:a}),s=0,l=this.nodes(),u=0;u<l.length;u++){var c=l[u];if(!c.same(n)){var d=o.distanceTo(c);s+=i?1/d:d}}return i?s:1/s}};xr.cc=xr.closenessCentrality,xr.ccn=xr.closenessCentralityNormalised=xr.closenessCentralityNormalized;var wr=It({weight:null,directed:!1}),Er={betweennessCentrality:function(e){for(var t=wr(e),n=t.directed,r=t.weight,a=null!=r,i=this.cy(),o=this.nodes(),s={},l={},u=0,c={set:function(e,t){l[e]=t,t>u&&(u=t)},get:function(e){return l[e]}},d=0;d<o.length;d++){var h=o[d],p=h.id();s[p]=n?h.outgoers().nodes():h.openNeighborhood().nodes(),c.set(p,0)}for(var f=function(e){for(var t=o[e].id(),n=[],l={},u={},d={},h=new Ut((function(e,t){return d[e]-d[t]})),p=0;p<o.length;p++){var f=o[p].id();l[f]=[],u[f]=0,d[f]=1/0}for(u[t]=1,d[t]=0,h.push(t);!h.empty();){var g=h.pop();if(n.push(g),a)for(var v=0;v<s[g].length;v++){var y=s[g][v],m=i.getElementById(g),b=void 0;b=m.edgesTo(y).length>0?m.edgesTo(y)[0]:y.edgesTo(m)[0];var x=r(b);y=y.id(),d[y]>d[g]+x&&(d[y]=d[g]+x,h.nodes.indexOf(y)<0?h.push(y):h.updateItem(y),u[y]=0,l[y]=[]),d[y]==d[g]+x&&(u[y]=u[y]+u[g],l[y].push(g))}else for(var w=0;w<s[g].length;w++){var E=s[g][w].id();d[E]==1/0&&(h.push(E),d[E]=d[g]+1),d[E]==d[g]+1&&(u[E]=u[E]+u[g],l[E].push(g))}}for(var k={},C=0;C<o.length;C++)k[o[C].id()]=0;for(;n.length>0;){for(var S=n.pop(),D=0;D<l[S].length;D++){var T=l[S][D];k[T]=k[T]+u[T]/u[S]*(1+k[S])}S!=o[e].id()&&c.set(S,c.get(S)+k[S])}},g=0;g<o.length;g++)f(g);var v={betweenness:function(e){var t=i.collection(e).id();return c.get(t)},betweennessNormalized:function(e){if(0==u)return 0;var t=i.collection(e).id();return c.get(t)/u}};return v.betweennessNormalised=v.betweennessNormalized,v}};Er.bc=Er.betweennessCentrality;var kr=It({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),Cr=function(e){return kr(e)},Sr=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},Dr=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},Tr=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var a=0;a<t;a++)n+=e[a*t+r];for(var i=0;i<t;i++)e[i*t+r]=e[i*t+r]/n}},Pr=function(e,t,n){for(var r=new Array(n*n),a=0;a<n;a++){for(var i=0;i<n;i++)r[a*n+i]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[a*n+s]+=e[a*n+o]*t[o*n+s]}return r},_r=function(e,t,n){for(var r=e.slice(0),a=1;a<n;a++)e=Pr(e,r,t);return e},Mr=function(e,t,n){for(var r=new Array(t*t),a=0;a<t*t;a++)r[a]=Math.pow(e[a],n);return Tr(r,t),r},Br=function(e,t,n,r){for(var a=0;a<n;a++)if(Math.round(e[a]*Math.pow(10,r))/Math.pow(10,r)!==Math.round(t[a]*Math.pow(10,r))/Math.pow(10,r))return!1;return!0},Nr=function(e,t,n,r){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(n[s]);0!==o.length&&a.push(r.collection(o))}return a},Ar=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},Ir=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&Ar(e[t],e[n])&&e.splice(n,1);return e},Or=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),a=Cr(e),i={},o=0;o<t.length;o++)i[t[o].id()]=o;for(var s,l=t.length,u=l*l,c=new Array(u),d=0;d<u;d++)c[d]=0;for(var h=0;h<n.length;h++){var p=n[h],f=i[p.source().id()],g=i[p.target().id()],v=Sr(p,a.attributes);c[f*l+g]+=v,c[g*l+f]+=v}Dr(c,l,a.multFactor),Tr(c,l);for(var y=!0,m=0;y&&m<a.maxIterations;)y=!1,s=_r(c,l,a.expandFactor),c=Mr(s,l,a.inflateFactor),Br(c,s,u,4)||(y=!0),m++;var b=Nr(c,l,t,r);return b=Ir(b)},zr={markovClustering:Or,mcl:Or},Lr=function(e){return e},Rr=function(e,t){return Math.abs(t-e)},Vr=function(e,t,n){return e+Rr(t,n)},Fr=function(e,t,n){return e+Math.pow(n-t,2)},jr=function(e){return Math.sqrt(e)},qr=function(e,t,n){return Math.max(e,Rr(t,n))},Xr=function(e,t,n,r,a){for(var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Lr,o=r,s=0;s<e;s++)o=a(o,t(s),n(s));return i(o)},Yr={euclidean:function(e,t,n){return e>=2?Xr(e,t,n,0,Fr,jr):Xr(e,t,n,0,Vr)},squaredEuclidean:function(e,t,n){return Xr(e,t,n,0,Fr)},manhattan:function(e,t,n){return Xr(e,t,n,0,Vr)},max:function(e,t,n){return Xr(e,t,n,-1/0,qr)}};function Wr(e,t,n,r,a,i){var o;return o=x(e)?e:Yr[e]||Yr.euclidean,0===t&&x(e)?o(a,i):o(t,n,r,a,i)}Yr["squared-euclidean"]=Yr.squaredEuclidean,Yr.squaredeuclidean=Yr.squaredEuclidean;var Hr=It({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Gr=function(e){return Hr(e)},Kr=function(e,t,n,r,a){var i="kMedoids"!==a?function(e){return n[e]}:function(e){return r[e](n)},o=function(e){return r[e](t)},s=n,l=t;return Wr(e,r.length,i,o,s,l)},Ur=function(e,t,n){for(var r=n.length,a=new Array(r),i=new Array(r),o=new Array(t),s=null,l=0;l<r;l++)a[l]=e.min(n[l]).value,i[l]=e.max(n[l]).value;for(var u=0;u<t;u++){s=[];for(var c=0;c<r;c++)s[c]=Math.random()*(i[c]-a[c])+a[c];o[u]=s}return o},Zr=function(e,t,n,r,a){for(var i=1/0,o=0,s=0;s<t.length;s++){var l=Kr(n,e,t[s],r,a);l<i&&(i=l,o=s)}return o},$r=function(e,t,n){for(var r=[],a=null,i=0;i<t.length;i++)n[(a=t[i]).id()]===e&&r.push(a);return r},Qr=function(e,t,n){return Math.abs(t-e)<=n},Jr=function(e,t,n){for(var r=0;r<e.length;r++)for(var a=0;a<e[r].length;a++)if(Math.abs(e[r][a]-t[r][a])>n)return!1;return!0},ea=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},ta=function(e,t){var n=new Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var a=e[Math.floor(Math.random()*e.length)];ea(a,n,r);)a=e[Math.floor(Math.random()*e.length)];n[r]=a}else for(var i=0;i<t;i++)n[i]=e[Math.floor(Math.random()*e.length)];return n},na=function(e,t,n){for(var r=0,a=0;a<t.length;a++)r+=Kr("manhattan",t[a],e,n,"kMedoids");return r},ra=function(t){var n,r=this.cy(),a=this.nodes(),i=null,o=Gr(t),s=new Array(o.k),l={};o.testMode?"number"===typeof o.testCentroids?(o.testCentroids,n=Ur(a,o.k,o.attributes)):n="object"===e(o.testCentroids)?o.testCentroids:Ur(a,o.k,o.attributes):n=Ur(a,o.k,o.attributes);for(var u=!0,c=0;u&&c<o.maxIterations;){for(var d=0;d<a.length;d++)l[(i=a[d]).id()]=Zr(i,n,o.distance,o.attributes,"kMeans");u=!1;for(var h=0;h<o.k;h++){var p=$r(h,a,l);if(0!==p.length){for(var f=o.attributes.length,g=n[h],v=new Array(f),y=new Array(f),m=0;m<f;m++){y[m]=0;for(var b=0;b<p.length;b++)i=p[b],y[m]+=o.attributes[m](i);v[m]=y[m]/p.length,Qr(v[m],g[m],o.sensitivityThreshold)||(u=!0)}n[h]=v,s[h]=r.collection(p)}}c++}return s},aa=function(e,t,n,r,a){for(var i,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)r[s][l]=Math.pow(n[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+=r[d][u]*a.attributes[c](t[d]),o+=r[d][u];e[u][c]=i/o}},ia=function(e,t,n,r,a){for(var i=0;i<e.length;i++)t[i]=e[i].slice();for(var o,s,l,u=2/(a.m-1),c=0;c<n.length;c++)for(var d=0;d<r.length;d++){o=0;for(var h=0;h<n.length;h++)s=Kr(a.distance,r[d],n[c],a.attributes,"cmeans"),l=Kr(a.distance,r[d],n[h],a.attributes,"cmeans"),o+=Math.pow(s/l,u);e[d][c]=1/o}},oa=function(e,t,n,r){for(var a,i,o=new Array(n.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]=r.collection(o[c]);return o},sa=function(e){var t,n,r,a,i=this.cy(),o=this.nodes(),s=Gr(e);r=new Array(o.length);for(var l=0;l<o.length;l++)r[l]=new Array(s.k);n=new Array(o.length);for(var u=0;u<o.length;u++)n[u]=new Array(s.k);for(var c=0;c<o.length;c++){for(var d=0,h=0;h<s.k;h++)n[c][h]=Math.random(),d+=n[c][h];for(var p=0;p<s.k;p++)n[c][p]=n[c][p]/d}t=new Array(s.k);for(var f=0;f<s.k;f++)t[f]=new Array(s.attributes.length);a=new Array(o.length);for(var g=0;g<o.length;g++)a[g]=new Array(s.k);for(var v=!0,y=0;v&&y<s.maxIterations;)v=!1,aa(t,o,n,a,s),ia(n,r,t,o,s),Jr(n,r,s.sensitivityThreshold)||(v=!0),y++;return{clusters:oa(o,n,s,i),degreeOfMembership:n}},la={kMeans:ra,kMedoids:function(t){var n,r,a=this.cy(),i=this.nodes(),o=null,s=Gr(t),l=new Array(s.k),u={},c=new Array(s.k);s.testMode?"number"===typeof s.testCentroids||(n="object"===e(s.testCentroids)?s.testCentroids:ta(i,s.k)):n=ta(i,s.k);for(var d=!0,h=0;d&&h<s.maxIterations;){for(var p=0;p<i.length;p++)u[(o=i[p]).id()]=Zr(o,n,s.distance,s.attributes,"kMedoids");d=!1;for(var f=0;f<n.length;f++){var g=$r(f,i,u);if(0!==g.length){c[f]=na(n[f],g,s.attributes);for(var v=0;v<g.length;v++)(r=na(g[v],g,s.attributes))<c[f]&&(c[f]=r,n[f]=g[v],d=!0);l[f]=a.collection(g)}}h++}return l},fuzzyCMeans:sa,fcm:sa},ua=It({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),ca={single:"min",complete:"max"},da=function(e){var t=ua(e),n=ca[t.linkage];return null!=n&&(t.linkage=n),t},ha=function(e,t,n,r,a){for(var i,o=0,s=1/0,l=a.attributes,u=function(e,t){return Wr(a.distance,l.length,(function(t){return l[t](e)}),(function(e){return l[e](t)}),e,t)},c=0;c<e.length;c++){var d=e[c].key,h=n[d][r[d]];h<s&&(o=d,s=h)}if("threshold"===a.mode&&s>=a.threshold||"dendrogram"===a.mode&&1===e.length)return!1;var p,f=t[o],g=t[r[o]];p="dendrogram"===a.mode?{left:f,right:g,key:f.key}:{value:f.value.concat(g.value),key:f.key},e[f.index]=p,e.splice(g.index,1),t[f.key]=p;for(var v=0;v<e.length;v++){var y=e[v];f.key===y.key?i=1/0:"min"===a.linkage?(i=n[f.key][y.key],n[f.key][y.key]>n[g.key][y.key]&&(i=n[g.key][y.key])):"max"===a.linkage?(i=n[f.key][y.key],n[f.key][y.key]<n[g.key][y.key]&&(i=n[g.key][y.key])):i="mean"===a.linkage?(n[f.key][y.key]*f.size+n[g.key][y.key]*g.size)/(f.size+g.size):"dendrogram"===a.mode?u(y.value,f.value):u(y.value[0],f.value[0]),n[f.key][y.key]=n[y.key][f.key]=i}for(var m=0;m<e.length;m++){var b=e[m].key;if(r[b]===f.key||r[b]===g.key){for(var x=b,w=0;w<e.length;w++){var E=e[w].key;n[b][E]<n[b][x]&&(x=E)}r[b]=x}e[m].index=m}return f.key=g.key=f.index=g.index=null,!0},pa=function e(t,n,r){t&&(t.value?n.push(t.value):(t.left&&e(t.left,n),t.right&&e(t.right,n)))},fa=function e(t,n){if(!t)return"";if(t.left&&t.right){var r=e(t.left,n),a=e(t.right,n),i=n.add({group:"nodes",data:{id:r+","+a}});return n.add({group:"edges",data:{source:r,target:i.id()}}),n.add({group:"edges",data:{source:a,target:i.id()}}),i.id()}return t.value?t.value.id():void 0},ga=function e(t,n,r){if(!t)return[];var a=[],i=[],o=[];return 0===n?(t.left&&pa(t.left,a),t.right&&pa(t.right,i),o=a.concat(i),[r.collection(o)]):1===n?t.value?[r.collection(t.value)]:(t.left&&pa(t.left,a),t.right&&pa(t.right,i),[r.collection(a),r.collection(i)]):t.value?[r.collection(t.value)]:(t.left&&(a=e(t.left,n-1,r)),t.right&&(i=e(t.right,n-1,r)),a.concat(i))},va=function(e){for(var t=this.cy(),n=this.nodes(),r=da(e),a=r.attributes,i=function(e,t){return Wr(r.distance,a.length,(function(t){return a[t](e)}),(function(e){return a[e](t)}),e,t)},o=[],s=[],l=[],u=[],c=0;c<n.length;c++){var d={value:"dendrogram"===r.mode?n[c]:[n[c]],key:c,index:c};o[c]=d,u[c]=d,s[c]=[],l[c]=0}for(var h=0;h<o.length;h++)for(var p=0;p<=h;p++){var f=void 0;f="dendrogram"===r.mode?h===p?1/0:i(o[h].value,o[p].value):h===p?1/0:i(o[h].value[0],o[p].value[0]),s[h][p]=f,s[p][h]=f,f<s[h][l[h]]&&(l[h]=p)}for(var g,v=ha(o,u,s,l,r);v;)v=ha(o,u,s,l,r);return"dendrogram"===r.mode?(g=ga(o[0],r.dendrogramDepth,t),r.addDendrogram&&fa(o[0],t)):(g=new Array(o.length),o.forEach((function(e,n){e.key=e.index=null,g[n]=t.collection(e.value)}))),g},ya={hierarchicalClustering:va,hca:va},ma=It({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),ba=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||St("Damping must range on [0.5, 1). Got: ".concat(t));var r=["median","mean","min","max"];return r.some((function(e){return e===n}))||C(n)||St("Preference must be one of [".concat(r.map((function(e){return"'".concat(e,"'")})).join(", "),"] or a number. Got: ").concat(n)),ma(e)},xa=function(e,t,n,r){var a=function(e,t){return r[t](e)};return-Wr(e,r.length,(function(e){return a(t,e)}),(function(e){return a(n,e)}),t,n)},wa=function(e,t){return"median"===t?yn(e):"mean"===t?vn(e):"min"===t?fn(e):"max"===t?gn(e):t},Ea=function(e,t,n){for(var r=[],a=0;a<e;a++)t[a*e+a]+n[a*e+a]>0&&r.push(a);return r},ka=function(e,t,n){for(var r=[],a=0;a<e;a++){for(var i=-1,o=-1/0,s=0;s<n.length;s++){var l=n[s];t[a*e+l]>o&&(i=l,o=t[a*e+l])}i>0&&r.push(i)}for(var u=0;u<n.length;u++)r[n[u]]=n[u];return r},Ca=function(e,t,n){for(var r=ka(e,t,n),a=0;a<n.length;a++){for(var i=[],o=0;o<r.length;o++)r[o]===n[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)}n[a]=i[s]}return r=ka(e,t,n)},Sa=function(e){for(var t,n,r,a,i,o,s=this.cy(),l=this.nodes(),u=ba(e),c={},d=0;d<l.length;d++)c[l[d].id()]=d;n=(t=l.length)*t,r=new Array(n);for(var h=0;h<n;h++)r[h]=-1/0;for(var p=0;p<t;p++)for(var f=0;f<t;f++)p!==f&&(r[p*t+f]=xa(u.distance,l[p],l[f],u.attributes));a=wa(r,u.preference);for(var g=0;g<t;g++)r[g*t+g]=a;i=new Array(n);for(var v=0;v<n;v++)i[v]=0;o=new Array(n);for(var y=0;y<n;y++)o[y]=0;for(var m=new Array(t),b=new Array(t),x=new Array(t),w=0;w<t;w++)m[w]=0,b[w]=0,x[w]=0;for(var E,k=new Array(t*u.minIterations),C=0;C<k.length;C++)k[C]=0;for(E=0;E<u.maxIterations;E++){for(var S=0;S<t;S++){for(var D=-1/0,T=-1/0,P=-1,_=0,M=0;M<t;M++)m[M]=i[S*t+M],(_=o[S*t+M]+r[S*t+M])>=D?(T=D,D=_,P=M):_>T&&(T=_);for(var B=0;B<t;B++)i[S*t+B]=(1-u.damping)*(r[S*t+B]-D)+u.damping*m[B];i[S*t+P]=(1-u.damping)*(r[S*t+P]-T)+u.damping*m[P]}for(var N=0;N<t;N++){for(var A=0,I=0;I<t;I++)m[I]=o[I*t+N],b[I]=Math.max(0,i[I*t+N]),A+=b[I];A-=b[N],b[N]=i[N*t+N],A+=b[N];for(var O=0;O<t;O++)o[O*t+N]=(1-u.damping)*Math.min(0,A-b[O])+u.damping*m[O];o[N*t+N]=(1-u.damping)*(A-b[N])+u.damping*m[N]}for(var z=0,L=0;L<t;L++){var R=o[L*t+L]+i[L*t+L]>0?1:0;k[E%u.minIterations*t+L]=R,z+=R}if(z>0&&(E>=u.minIterations-1||E==u.maxIterations-1)){for(var V=0,F=0;F<t;F++){x[F]=0;for(var j=0;j<u.minIterations;j++)x[F]+=k[j*t+F];0!==x[F]&&x[F]!==u.minIterations||V++}if(V===t)break}}for(var q=Ea(t,i,o),X=Ca(t,r,q),Y={},W=0;W<q.length;W++)Y[q[W]]=[];for(var H=0;H<l.length;H++){var G=X[c[l[H].id()]];null!=G&&Y[G].push(l[H])}for(var K=new Array(q.length),U=0;U<q.length;U++)K[U]=s.collection(Y[q[U]]);return K},Da={affinityPropagation:Sa,ap:Sa},Ta=It({root:void 0,directed:!1}),Pa={hierholzer:function(e){if(!E(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,a,i=Ta(e),o=i.root,s=i.directed,l=this,u=!1;o&&(a=b(o)?this.filter(o)[0].id():o[0].id());var c={},d={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var a=e.indegree(!0),i=e.outdegree(!0),o=a-i,s=i-a;1==o?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else d[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):d[t]=[e.source().id(),e.target().id()]}));var h={found:!1,trail:void 0};if(u)return h;if(r&&n)if(s){if(a&&r!=a)return h;a=r}else{if(a&&r!=a&&n!=a)return h;a||(a=r)}else a||(a=l[0].id());var p=function(e){for(var t,n,r,a=e,i=[e];c[a].length;)t=c[a].shift(),n=d[t][0],a!=(r=d[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),a=r):s||a==n||(c[n]=c[n].filter((function(e){return e!=t})),a=n),i.unshift(t),i.unshift(a);return i},f=[],g=[];for(g=p(a);1!=g.length;)0==c[g[0]].length?(f.unshift(l.getElementById(g.shift())),f.unshift(l.getElementById(g.shift()))):g=p(g.shift()).concat(g);for(var v in f.unshift(l.getElementById(g.shift())),c)if(c[v].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},_a=function(){var e=this,t={},n=0,r=0,a=[],i=[],o={},s=function(n,r){for(var o=i.length-1,s=[],l=e.spawn();i[o].x!=n||i[o].y!=r;)s.push(i.pop().edge),o--;s.push(i.pop().edge),s.forEach((function(n){var r=n.connectedNodes().intersection(e);l.merge(n),r.forEach((function(n){var r=n.id(),a=n.connectedEdges().intersection(e);l.merge(n),t[r].cutVertex?l.merge(a.filter((function(e){return e.isLoop()}))):l.merge(a)}))})),a.push(l)},l=function l(u,c,d){u===d&&(r+=1),t[c]={id:n,low:n++,cutVertex:!1};var h,p,f,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(),p=e.target().id(),(f=h===c?p:h)!==d&&(g=e.id(),o[g]||(o[g]=!0,i.push({x:c,y:f,edge:e})),f in t?t[c].low=Math.min(t[c].low,t[f].id):(l(u,f,c),t[c].low=Math.min(t[c].low,t[f].low),t[c].id<=t[f].low&&(t[c].cutVertex=!0,s(c,f))))}))};e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||(r=0,l(n,n),t[n].cutVertex=r>1)}}));var 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}},Ma=function(){var e=this,t={},n=0,r=[],a=[],i=e.spawn(e),o=function o(s){if(a.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var 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);r.push(d),i=i.difference(d)}};return e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||o(n)}})),{cut:i,components:r}},Ba={};[Gt,$t,Qt,en,nn,an,un,vr,mr,xr,Er,zr,la,ya,Da,Pa,{hopcroftTarjanBiconnected:_a,htbc:_a,htb:_a,hopcroftTarjanBiconnectedComponents:_a},{tarjanStronglyConnected:Ma,tsc:Ma,tscc:Ma,tarjanStronglyConnectedComponents:Ma}].forEach((function(e){Q(Ba,e)}));var Na=0,Aa=1,Ia=2,Oa=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=Na,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"===typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};Oa.prototype={fulfill:function(e){return za(this,Aa,"fulfillValue",e)},reject:function(e){return za(this,Ia,"rejectReason",e)},then:function(e,t){var n=this,r=new Oa;return n.onFulfilled.push(Va(e,r,"fulfill")),n.onRejected.push(Va(t,r,"reject")),La(n),r.proxy}};var za=function(e,t,n,r){return e.state===Na&&(e.state=t,e[n]=r,La(e)),e},La=function(e){e.state===Aa?Ra(e,"onFulfilled",e.fulfillValue):e.state===Ia&&Ra(e,"onRejected",e.rejectReason)},Ra=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var a=function(){for(var e=0;e<r.length;e++)r[e](n)};"function"===typeof setImmediate?setImmediate(a):setTimeout(a,0)}},Va=function(e,t,n){return function(r){if("function"!==typeof e)t[n].call(t,r);else{var a;try{a=e(r)}catch(i){return void t.reject(i)}Fa(t,a)}}},Fa=function t(n,r){if(n!==r&&n.proxy!==r){var a;if("object"===e(r)&&null!==r||"function"===typeof r)try{a=r.then}catch(o){return void n.reject(o)}if("function"!==typeof a)n.fulfill(r);else{var i=!1;try{a.call(r,(function(e){i||(i=!0,e===r?n.reject(new TypeError("circular thenable chain")):t(n,e))}),(function(e){i||(i=!0,n.reject(e))}))}catch(o){i||n.reject(o)}}}else n.reject(new TypeError("cannot resolve promise with itself"))};Oa.all=function(e){return new Oa((function(t,n){for(var r=new Array(e.length),a=0,i=function(n,i){r[n]=i,++a===e.length&&t(r)},o=0;o<e.length;o++)!function(t){var r=e[t];null!=r&&null!=r.then?r.then((function(e){i(t,e)}),(function(e){n(e)})):i(t,r)}(o)}))},Oa.resolve=function(e){return new Oa((function(t,n){t(e)}))},Oa.reject=function(e){return new Oa((function(t,n){n(e)}))};var ja="undefined"!==typeof Promise?Promise:Oa,qa=function(e,t,n){var r=M(e),a=!r,i=this._private=Q({duration:1e3},t,n);if(i.target=e,i.style=i.style||i.css,i.started=!1,i.playing=!1,i.hooked=!1,i.applying=!1,i.progress=0,i.completes=[],i.frames=[],i.complete&&x(i.complete)&&i.completes.push(i.complete),a){var o=e.position();i.startPosition=i.startPosition||{x:o.x,y:o.y},i.startStyle=i.startStyle||e.cy().style().getAnimationStartStyle(e,i.style)}if(r){var s=e.pan();i.startPan={x:s.x,y:s.y},i.startZoom=e.zoom()}this.length=1,this[0]=this},Xa=qa.prototype;Q(Xa,{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),T(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];null!=r&&(e[t]=e[n],e[n]=r)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var a=e.style[r],i=a.name,o=e.startStyle[i];e.startStyle[i]=a,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;return t="frame"===e?n.frames:n.completes,new ja((function(e,n){t.push((function(){e()}))}))}}),Xa.complete=Xa.completed,Xa.run=Xa.play,Xa.running=Xa.playing;var Ya={animated:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return!1;var n=t[0];return n?n._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n<t.length;n++)t[n]._private.animation.queue=[];return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=this,r=void 0!==n.length,a=r?n:[n],i=this._private.cy||this,o=!r,s=!o;if(!i.styleEnabled())return this;var l=i.style();if(e=Q({},e,t),0===Object.keys(e).length)return new qa(a[0],e);switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}if(s&&(e.style=l.getPropsList(e.style||e.css),e.css=void 0),s&&null!=e.renderedPosition){var u=e.renderedPosition,c=i.pan(),d=i.zoom();e.position=hn(u,d,c)}if(o&&null!=e.panBy){var h=e.panBy,p=i.pan();e.pan={x:p.x+h.x,y:p.y+h.y}}var f=e.center||e.centre;if(o&&null!=f){var g=i.getCenterPan(f.eles,e.zoom);null!=g&&(e.pan=g)}if(o&&null!=e.fit){var v=e.fit,y=i.getFitViewport(v.eles||v.boundingBox,v.padding);null!=y&&(e.pan=y.pan,e.zoom=y.zoom)}if(o&&E(e.zoom)){var m=i.getZoomedViewport(e.zoom);null!=m?(m.zoomed&&(e.zoom=m.zoom),m.panned&&(e.pan=m.pan)):e.zoom=null}return new qa(a[0],e)}},animate:function(){return function(e,t){var n=this,r=void 0!==n.length?n:[n];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=Q({},e,t));for(var a=0;a<r.length;a++){var i=r[a],o=i.animated()&&(void 0===e.queue||e.queue);i.animation(e,o?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=this,r=void 0!==n.length?n:[n],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var i=0;i<r.length;i++){for(var o=r[i]._private,s=o.animation.current,l=0;l<s.length;l++){var u=s[l]._private;t&&(u.duration=0)}e&&(o.animation.queue=[]),t||(o.animation.current=[])}return a.notify("draw"),this}}},Wa=Array.isArray,Ha=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ga=/^\w*$/;function Ka(e,t){if(Wa(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Fe(e))||Ga.test(e)||!Ha.test(e)||null!=t&&e in Object(t)}var Ua=Ka,Za="[object AsyncFunction]",$a="[object Function]",Qa="[object GeneratorFunction]",Ja="[object Proxy]";function ei(e){if(!le(e))return!1;var t=Oe(e);return t==$a||t==Qa||t==Za||t==Ja}var ti=ei,ni=pe["__core-js_shared__"],ri=function(){var e=/[^.]+$/.exec(ni&&ni.keys&&ni.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function ai(e){return!!ri&&ri in e}var ii=ai,oi=Function.prototype.toString;function si(e){if(null!=e){try{return oi.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var li=si,ui=/[\\^$.*+?()[\]{}|]/g,ci=/^\[object .+?Constructor\]$/,di=Function.prototype,hi=Object.prototype,pi=di.toString,fi=hi.hasOwnProperty,gi=RegExp("^"+pi.call(fi).replace(ui,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function vi(e){return!(!le(e)||ii(e))&&(ti(e)?gi:ci).test(li(e))}var yi=vi;function mi(e,t){return null==e?void 0:e[t]}var bi=mi;function xi(e,t){var n=bi(e,t);return yi(n)?n:void 0}var wi=xi,Ei=wi(Object,"create");function ki(){this.__data__=Ei?Ei(null):{},this.size=0}var Ci=ki;function Si(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Di=Si,Ti="__lodash_hash_undefined__",Pi=Object.prototype.hasOwnProperty;function _i(e){var t=this.__data__;if(Ei){var n=t[e];return n===Ti?void 0:n}return Pi.call(t,e)?t[e]:void 0}var Mi=_i,Bi=Object.prototype.hasOwnProperty;function Ni(e){var t=this.__data__;return Ei?void 0!==t[e]:Bi.call(t,e)}var Ai=Ni,Ii="__lodash_hash_undefined__";function Oi(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ei&&void 0===t?Ii:t,this}var zi=Oi;function Li(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Li.prototype.clear=Ci,Li.prototype.delete=Di,Li.prototype.get=Mi,Li.prototype.has=Ai,Li.prototype.set=zi;var Ri=Li;function Vi(){this.__data__=[],this.size=0}var Fi=Vi;function ji(e,t){return e===t||e!==e&&t!==t}var qi=ji;function Xi(e,t){for(var n=e.length;n--;)if(qi(e[n][0],t))return n;return-1}var Yi=Xi,Wi=Array.prototype.splice;function Hi(e){var t=this.__data__,n=Yi(t,e);return!(n<0)&&(n==t.length-1?t.pop():Wi.call(t,n,1),--this.size,!0)}var Gi=Hi;function Ki(e){var t=this.__data__,n=Yi(t,e);return n<0?void 0:t[n][1]}var Ui=Ki;function Zi(e){return Yi(this.__data__,e)>-1}var $i=Zi;function Qi(e,t){var n=this.__data__,r=Yi(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var Ji=Qi;function eo(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}eo.prototype.clear=Fi,eo.prototype.delete=Gi,eo.prototype.get=Ui,eo.prototype.has=$i,eo.prototype.set=Ji;var to=eo,no=wi(pe,"Map");function ro(){this.size=0,this.__data__={hash:new Ri,map:new(no||to),string:new Ri}}var ao=ro;function io(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var oo=io;function so(e,t){var n=e.__data__;return oo(t)?n["string"==typeof t?"string":"hash"]:n.map}var lo=so;function uo(e){var t=lo(this,e).delete(e);return this.size-=t?1:0,t}var co=uo;function ho(e){return lo(this,e).get(e)}var po=ho;function fo(e){return lo(this,e).has(e)}var go=fo;function vo(e,t){var n=lo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var yo=vo;function mo(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}mo.prototype.clear=ao,mo.prototype.delete=co,mo.prototype.get=po,mo.prototype.has=go,mo.prototype.set=yo;var bo=mo,xo="Expected a function";function wo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(xo);var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],i=n.cache;if(i.has(a))return i.get(a);var o=e.apply(this,r);return n.cache=i.set(a,o)||i,o};return n.cache=new(wo.Cache||bo),n}wo.Cache=bo;var Eo=wo,ko=500;function Co(e){var t=Eo(e,(function(e){return n.size===ko&&n.clear(),e})),n=t.cache;return t}var So=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Do=/\\(\\)?/g,To=Co((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(So,(function(e,n,r,a){t.push(r?a.replace(Do,"$1"):n||e)})),t})),Po=To;function _o(e,t){for(var n=-1,r=null==e?0:e.length,a=Array(r);++n<r;)a[n]=t(e[n],n,e);return a}var Mo=_o,Bo=1/0,No=we?we.prototype:void 0,Ao=No?No.toString:void 0;function Io(e){if("string"==typeof e)return e;if(Wa(e))return Mo(e,Io)+"";if(Fe(e))return Ao?Ao.call(e):"";var t=e+"";return"0"==t&&1/e==-Bo?"-0":t}var Oo=Io;function zo(e){return null==e?"":Oo(e)}var Lo=zo;function Ro(e,t){return Wa(e)?e:Ua(e,t)?[e]:Po(Lo(e))}var Vo=Ro,Fo=1/0;function jo(e){if("string"==typeof e||Fe(e))return e;var t=e+"";return"0"==t&&1/e==-Fo?"-0":t}var qo=jo;function Xo(e,t){for(var n=0,r=(t=Vo(t,e)).length;null!=e&&n<r;)e=e[qo(t[n++])];return n&&n==r?e:void 0}var Yo=Xo;function Wo(e,t,n){var r=null==e?void 0:Yo(e,t);return void 0===r?n:r}var Ho=Wo,Go=function(){try{var e=wi(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();function Ko(e,t,n){"__proto__"==t&&Go?Go(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Uo=Ko,Zo=Object.prototype.hasOwnProperty;function $o(e,t,n){var r=e[t];Zo.call(e,t)&&qi(r,n)&&(void 0!==n||t in e)||Uo(e,t,n)}var Qo=$o,Jo=9007199254740991,es=/^(?:0|[1-9]\d*)$/;function ts(e,t){var n=typeof e;return!!(t=null==t?Jo:t)&&("number"==n||"symbol"!=n&&es.test(e))&&e>-1&&e%1==0&&e<t}var ns=ts;function rs(e,t,n,r){if(!le(e))return e;for(var a=-1,i=(t=Vo(t,e)).length,o=i-1,s=e;null!=s&&++a<i;){var l=qo(t[a]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(a!=o){var c=s[l];void 0===(u=r?r(c,l,s):void 0)&&(u=le(c)?c:ns(t[a+1])?[]:{})}Qo(s,l,u),s=s[l]}return e}var as=rs;function is(e,t,n){return null==e?e:as(e,t,n)}var os=is;function ss(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var ls=ss;function us(e){return Wa(e)?Mo(e,qo):Fe(e)?[e]:ls(Po(Lo(e)))}var cs=us,ds={data:function(e){return e=Q({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r=e,a=this,o=void 0!==a.length,s=o?a:[a],l=o?a[0]:a;if(b(t)){var u,c=-1!==t.indexOf(".")&&cs(t);if(r.allowGetting&&void 0===n)return l&&(r.beforeGet(l),u=c&&void 0===l._private[r.field][t]?Ho(l._private[r.field],c):l._private[r.field][t]),u;if(r.allowSetting&&void 0!==n&&!r.immutableKeys[t]){var d=i({},t,n);r.beforeSet(a,d);for(var h=0,p=s.length;h<p;h++){var f=s[h];r.canSet(f)&&(c&&void 0===l._private[r.field][t]?os(f._private[r.field],c,n):f._private[r.field][t]=n)}r.updateStyle&&a.updateStyle(),r.onSet(a),r.settingTriggersEvent&&a[r.triggerFnName](r.settingEvent)}}else if(r.allowSetting&&E(t)){var g,v,y=t,m=Object.keys(y);r.beforeSet(a,y);for(var w=0;w<m.length;w++)if(v=y[g=m[w]],!r.immutableKeys[g])for(var k=0;k<s.length;k++){var C=s[k];r.canSet(C)&&(C._private[r.field][g]=v)}r.updateStyle&&a.updateStyle(),r.onSet(a),r.settingTriggersEvent&&a[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&x(t)){var S=t;a.on(r.bindingEvent,S)}else if(r.allowGetting&&void 0===t){var D;return l&&(r.beforeGet(l),D=l._private[r.field]),D}return a}},removeData:function(e){return e=Q({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=this,a=void 0!==r.length?r:[r];if(b(t)){for(var i=t.split(/\s+/),o=i.length,s=0;s<o;s++){var l=i[s];if(!A(l)&&!n.immutableKeys[l])for(var u=0,c=a.length;u<c;u++)a[u]._private[n.field][l]=void 0}n.triggerEvent&&r[n.triggerFnName](n.event)}else if(void 0===t){for(var d=0,h=a.length;d<h;d++)for(var p=a[d]._private[n.field],f=Object.keys(p),g=0;g<f.length;g++){var v=f[g];!n.immutableKeys[v]&&(p[v]=void 0)}n.triggerEvent&&r[n.triggerFnName](n.event)}return r}}},hs={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new ja((function(e,t){var a=function(t){n.off.apply(n,o),e(t)},i=r.concat([a]),o=i.concat([]);n.on.apply(n,i)}))}}},ps={};[Ya,ds,hs].forEach((function(e){Q(ps,e)}));var fs={animate:ps.animate(),animation:ps.animation(),animated:ps.animated(),clearQueue:ps.clearQueue(),delay:ps.delay(),delayAnimation:ps.delayAnimation(),stop:ps.stop()},gs={classes:function(e){var t=this;if(void 0===e){var n=[];return t[0]._private.classes.forEach((function(e){return n.push(e)})),n}w(e)||(e=(e||"").match(/\S+/g)||[]);for(var r=[],a=new Yt(e),i=0;i<t.length;i++){for(var o=t[i],s=o._private,l=s.classes,u=!1,c=0;c<e.length;c++){var d=e[c];if(!l.has(d)){u=!0;break}}u||(u=l.size!==e.length),u&&(s.classes=a,r.push(o))}return r.length>0&&this.spawn(r).updateStyle().emit("class"),t},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){w(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,a=[],i=0,o=n.length;i<o;i++)for(var s=n[i],l=s._private.classes,u=!1,c=0;c<e.length;c++){var d=e[c],h=l.has(d),p=!1;t||r&&!h?(l.add(d),p=!0):(!t||r&&h)&&(l.delete(d),p=!0),!u&&p&&(a.push(s),u=!0)}return a.length>0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};gs.className=gs.classNames=gs.classes;var vs={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:X,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};vs.variable="(?:[\\w-.]|(?:\\\\"+vs.metaChar+"))+",vs.className="(?:[\\w-]|(?:\\\\"+vs.metaChar+"))+",vs.value=vs.string+"|"+vs.number,vs.id=vs.variable,function(){var e,t,n;for(e=vs.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],vs.comparatorOp+="|@"+t;for(e=vs.comparatorOp.split("|"),n=0;n<e.length;n++)(t=e[n]).indexOf("!")>=0||"="!==t&&(vs.comparatorOp+="|\\!"+t)}();var ys=function(){return{checks:[]}},ms={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},bs=[{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 $(e.selector,t.selector)})),xs=function(){for(var e,t={},n=0;n<bs.length;n++)t[(e=bs[n]).selector]=e.matches;return t}(),ws=function(e,t){return xs[e](t)},Es="("+bs.map((function(e){return e.selector})).join("|")+")",ks=function(e){return e.replace(new RegExp("\\\\("+vs.metaChar+")","g"),(function(e,t){return t}))},Cs=function(e,t,n){e[e.length-1]=n},Ss=[{name:"group",query:!0,regex:"("+vs.group+")",populate:function(e,t,n){var r=o(n,1)[0];t.checks.push({type:ms.GROUP,value:"*"===r?r:r+"s"})}},{name:"state",query:!0,regex:Es,populate:function(e,t,n){var r=o(n,1)[0];t.checks.push({type:ms.STATE,value:r})}},{name:"id",query:!0,regex:"\\#("+vs.id+")",populate:function(e,t,n){var r=o(n,1)[0];t.checks.push({type:ms.ID,value:ks(r)})}},{name:"className",query:!0,regex:"\\.("+vs.className+")",populate:function(e,t,n){var r=o(n,1)[0];t.checks.push({type:ms.CLASS,value:ks(r)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+vs.variable+")\\s*\\]",populate:function(e,t,n){var r=o(n,1)[0];t.checks.push({type:ms.DATA_EXIST,field:ks(r)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+vs.variable+")\\s*("+vs.comparatorOp+")\\s*("+vs.value+")\\s*\\]",populate:function(e,t,n){var r=o(n,3),a=r[0],i=r[1],s=r[2];s=null!=new RegExp("^"+vs.string+"$").exec(s)?s.substring(1,s.length-1):parseFloat(s),t.checks.push({type:ms.DATA_COMPARE,field:ks(a),operator:i,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+vs.boolOp+")\\s*("+vs.variable+")\\s*\\]",populate:function(e,t,n){var r=o(n,2),a=r[0],i=r[1];t.checks.push({type:ms.DATA_BOOL,field:ks(i),operator:a})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+vs.meta+")\\s*("+vs.comparatorOp+")\\s*("+vs.number+")\\s*\\]\\]",populate:function(e,t,n){var r=o(n,3),a=r[0],i=r[1],s=r[2];t.checks.push({type:ms.META_COMPARE,field:ks(a),operator:i,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:vs.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,a=e.compoundCount,i=e[e.length-1];return null!=n&&(i.subject=n,e.currentSubject=null),i.edgeCount=r,i.compoundCount=a,e.edgeCount=0,e.compoundCount=0,e[e.length++]=ys()}},{name:"directedEdge",separator:!0,regex:vs.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n=ys(),r=t,a=ys();return n.checks.push({type:ms.DIRECTED_EDGE,source:r,target:a}),Cs(e,t,n),e.edgeCount++,a}var i=ys(),o=t,s=ys();return i.checks.push({type:ms.NODE_SOURCE,source:o,target:s}),Cs(e,t,i),e.edgeCount++,s}},{name:"undirectedEdge",separator:!0,regex:vs.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n=ys(),r=t,a=ys();return n.checks.push({type:ms.UNDIRECTED_EDGE,nodes:[r,a]}),Cs(e,t,n),e.edgeCount++,a}var i=ys(),o=t,s=ys();return i.checks.push({type:ms.NODE_NEIGHBOR,node:o,neighbor:s}),Cs(e,t,i),s}},{name:"child",separator:!0,regex:vs.child,populate:function(e,t){if(null==e.currentSubject){var n=ys(),r=ys(),a=e[e.length-1];return n.checks.push({type:ms.CHILD,parent:a,child:r}),Cs(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var i=ys(),o=e[e.length-1],s=ys(),l=ys(),u=ys(),c=ys();return i.checks.push({type:ms.COMPOUND_SPLIT,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:ms.TRUE}],c.checks.push({type:ms.TRUE}),s.checks.push({type:ms.PARENT,parent:c,child:u}),Cs(e,o,i),e.currentSubject=l,e.compoundCount++,u}var d=ys(),h=ys(),p=[{type:ms.PARENT,parent:d,child:h}];return d.checks=t.checks,t.checks=p,e.compoundCount++,h}},{name:"descendant",separator:!0,regex:vs.descendant,populate:function(e,t){if(null==e.currentSubject){var n=ys(),r=ys(),a=e[e.length-1];return n.checks.push({type:ms.DESCENDANT,ancestor:a,descendant:r}),Cs(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var i=ys(),o=e[e.length-1],s=ys(),l=ys(),u=ys(),c=ys();return i.checks.push({type:ms.COMPOUND_SPLIT,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:ms.TRUE}],c.checks.push({type:ms.TRUE}),s.checks.push({type:ms.ANCESTOR,ancestor:c,descendant:u}),Cs(e,o,i),e.currentSubject=l,e.compoundCount++,u}var d=ys(),h=ys(),p=[{type:ms.ANCESTOR,ancestor:d,descendant:h}];return d.checks=t.checks,t.checks=p,e.compoundCount++,h}},{name:"subject",modifier:!0,regex:vs.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return Tt("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=null==n?null:n.type;r===ms.DIRECTED_EDGE?n.type=ms.NODE_TARGET:r===ms.UNDIRECTED_EDGE&&(n.type=ms.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];Ss.forEach((function(e){return e.regexObj=new RegExp("^"+e.regex)}));var Ds=function(e){for(var t,n,r,a=0;a<Ss.length;a++){var i=Ss[a],o=i.name,s=e.match(i.regexObj);if(null!=s){n=s,t=i,r=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},Ts=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},Ps=function(e){var t=this,n=t.inputText=e,r=t[0]=ys();for(t.length=1,n=Ts(n);;){var a=Ds(n);if(null==a.expr)return Tt("The selector `"+e+"`is invalid"),!1;var i=a.match.slice(1),o=a.expr.populate(t,r,i);if(!1===o)return!1;if(null!=o&&(r=o),(n=a.remaining).match(/^\s*$/))break}var s=t[t.length-1];null!=t.currentSubject&&(s.subject=t.currentSubject),s.edgeCount=t.edgeCount,s.compoundCount=t.compoundCount;for(var l=0;l<t.length;l++){var u=t[l];if(u.compoundCount>0&&u.edgeCount>0)return Tt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return Tt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&Tt("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},_s=function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return b(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,i){var o=r.type,s=r.value;switch(o){case ms.GROUP:var l=e(s);return l.substring(0,l.length-1);case ms.DATA_COMPARE:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case ms.DATA_BOOL:var d=r.operator,h=r.field;return"["+e(d)+h+"]";case ms.DATA_EXIST:return"["+r.field+"]";case ms.META_COMPARE:var p=r.operator;return"[["+r.field+n(e(p))+t(s)+"]]";case ms.STATE:return s;case ms.ID:return"#"+s;case ms.CLASS:return"."+s;case ms.PARENT:case ms.CHILD:return a(r.parent,i)+n(">")+a(r.child,i);case ms.ANCESTOR:case ms.DESCENDANT:return a(r.ancestor,i)+" "+a(r.descendant,i);case ms.COMPOUND_SPLIT:var f=a(r.left,i),g=a(r.subject,i),v=a(r.right,i);return f+(f.length>0?" ":"")+g+v;case ms.TRUE:return""}},a=function(e,t){return e.checks.reduce((function(n,a,i){return n+(t===e&&0===i?"$":"")+r(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},Ms={parse:Ps,toString:_s},Bs=function(e,t,n){var r,a,i,o=b(e),s=C(e),l=b(n),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=""+n),u&&(e=a=a.toLowerCase(),n=i=i.toLowerCase()),t){case"*=":r=a.indexOf(i)>=0;break;case"$=":r=a.indexOf(i,a.length-i.length)>=0;break;case"^=":r=0===a.indexOf(i);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e<n;break;case"<=":d=!0,r=e<=n;break;default:r=!1}return!c||null==e&&d||(r=!r),r},Ns=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}},As=function(e){return void 0!==e},Is=function(e,t){return e.data(t)},Os=function(e,t){return e[t]()},zs=[],Ls=function(e,t){return e.checks.every((function(e){return zs[e.type](e,t)}))};zs[ms.GROUP]=function(e,t){var n=e.value;return"*"===n||n===t.group()},zs[ms.STATE]=function(e,t){var n=e.value;return ws(n,t)},zs[ms.ID]=function(e,t){var n=e.value;return t.id()===n},zs[ms.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)},zs[ms.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,a=e.value;return Bs(Os(t,n),r,a)},zs[ms.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,a=e.value;return Bs(Is(t,n),r,a)},zs[ms.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return Ns(Is(t,n),r)},zs[ms.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,As(Is(t,n))},zs[ms.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],a=t.source(),i=t.target();return Ls(n,a)&&Ls(r,i)||Ls(r,a)&&Ls(n,i)},zs[ms.NODE_NEIGHBOR]=function(e,t){return Ls(e.node,t)&&t.neighborhood().some((function(t){return t.isNode()&&Ls(e.neighbor,t)}))},zs[ms.DIRECTED_EDGE]=function(e,t){return Ls(e.source,t.source())&&Ls(e.target,t.target())},zs[ms.NODE_SOURCE]=function(e,t){return Ls(e.source,t)&&t.outgoers().some((function(t){return t.isNode()&&Ls(e.target,t)}))},zs[ms.NODE_TARGET]=function(e,t){return Ls(e.target,t)&&t.incomers().some((function(t){return t.isNode()&&Ls(e.source,t)}))},zs[ms.CHILD]=function(e,t){return Ls(e.child,t)&&Ls(e.parent,t.parent())},zs[ms.PARENT]=function(e,t){return Ls(e.parent,t)&&t.children().some((function(t){return Ls(e.child,t)}))},zs[ms.DESCENDANT]=function(e,t){return Ls(e.descendant,t)&&t.ancestors().some((function(t){return Ls(e.ancestor,t)}))},zs[ms.ANCESTOR]=function(e,t){return Ls(e.ancestor,t)&&t.descendants().some((function(t){return Ls(e.descendant,t)}))},zs[ms.COMPOUND_SPLIT]=function(e,t){return Ls(e.subject,t)&&Ls(e.left,t)&&Ls(e.right,t)},zs[ms.TRUE]=function(){return!0},zs[ms.COLLECTION]=function(e,t){return e.value.has(t)},zs[ms.FILTER]=function(e,t){return(0,e.value)(t)};var Rs=function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&t[0].checks[0].type===ms.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++){var r=t[n];if(Ls(r,e))return!0}return!1};return null==t.text()&&(n=function(){return!0}),e.filter(n)},Vs={matches:function(e){for(var t=this,n=0;n<t.length;n++){var r=t[n];if(Ls(r,e))return!0}return!1},filter:Rs},Fs=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||b(e)&&e.match(/^\s*$/)||(T(e)?this.addQuery({checks:[{type:ms.COLLECTION,value:e.collection()}]}):x(e)?this.addQuery({checks:[{type:ms.FILTER,value:e}]}):b(e)?this.parse(e)||(this.invalid=!0):St("A selector must be created from a string; found "))},js=Fs.prototype;[Ms,Vs].forEach((function(e){return Q(js,e)})),js.text=function(){return this.inputText},js.size=function(){return this.length},js.eq=function(e){return this[e]},js.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},js.addQuery=function(e){this[this.length++]=e},js.selector=js.toString;var qs={allAre:function(e){var t=new Fs(e);return this.every((function(e){return t.matches(e)}))},is:function(e){var t=new Fs(e);return this.some((function(e){return t.matches(e)}))},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every((function(t){return e.hasElementWithId(t.id())})))},anySame:function(e){return e=this.cy().collection(e),this.some((function(t){return e.hasElementWithId(t.id())}))},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every((function(e){return t.hasElementWithId(e.id())}))},contains:function(e){e=this.cy().collection(e);var t=this;return e.every((function(e){return t.hasElementWithId(e.id())}))}};qs.allAreNeighbours=qs.allAreNeighbors,qs.has=qs.contains,qs.equal=qs.equals=qs.same;var Xs,Ys,Ws=function(e,t){return function(n,r,a,i){var o,s=n,l=this;if(null==s?o="":T(s)&&1===s.length&&(o=s.id()),1===l.length&&o){var u=l[0]._private,c=u.traversalCache=u.traversalCache||{},d=c[t]=c[t]||[],h=ft(o),p=d[h];return p||(d[h]=e.call(l,n,r,a,i))}return e.call(l,n,r,a,i)}},Hs={parent:function(e){var t=[];if(1===this.length){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var a=this[r]._private.parent;a&&t.push(a)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var a=n[r];t.push(a)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t=(t=t||r).intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter((function(e){return e.isOrphan()})).filter(e)},nonorphans:function(e){return this.stdFilter((function(e){return e.isChild()})).filter(e)},children:Ws((function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,a=0;a<r.length;a++)t.push(r[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=[];function n(e){for(var r=0;r<e.length;r++){var a=e[r];t.push(a),a.children().nonempty()&&n(a.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function Gs(e,t,n,r){for(var a=[],i=new Yt,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];n?a.push(l):o&&r(a,i,l)}for(;a.length>0;){var u=a.shift();t(u),i.add(u.id()),o&&r(a,i,u)}return e}function Ks(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a<r.length;a++){var i=r[a];t.has(i.id())||e.push(i)}}function Us(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}function Zs(e,t,n){Us(e,t,n),Ks(e,t,n)}Hs.forEachDown=function(e){return Gs(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Ks)},Hs.forEachUp=function(e){return Gs(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Us)},Hs.forEachUpAndDown=function(e){return Gs(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Zs)},Hs.ancestors=Hs.parents,(Xs=Ys={data:ps.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:ps.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ps.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ps.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ps.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ps.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Xs.data,Xs.removeAttr=Xs.removeData;var $s,Qs,Js=Ys,el={};function tl(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,a=n[0],i=a._private.edges,o=0;o<i.length;o++){var s=i[o];!t&&s.isLoop()||(r+=e(a,s))}return r}}}function nl(e,t){return function(n){for(var r,a=this.nodes(),i=0;i<a.length;i++){var o=a[i][e](n);void 0===o||void 0!==r&&!t(o,r)||(r=o)}return r}}Q(el,{degree:tl((function(e,t){return t.source().same(t.target())?2:1})),indegree:tl((function(e,t){return t.target().same(e)?1:0})),outdegree:tl((function(e,t){return t.source().same(e)?1:0}))}),Q(el,{minDegree:nl("degree",(function(e,t){return e<t})),maxDegree:nl("degree",(function(e,t){return e>t})),minIndegree:nl("indegree",(function(e,t){return e<t})),maxIndegree:nl("indegree",(function(e,t){return e>t})),minOutdegree:nl("outdegree",(function(e,t){return e<t})),maxOutdegree:nl("outdegree",(function(e,t){return e>t}))}),Q(el,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var rl=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];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,n),a.dirtyBoundingBoxCache()}}},al={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){rl(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};$s=Qs={position:ps.data(al),silentPosition:ps.data(Q({},al,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){rl(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(E(e))t?this.silentPosition(e):this.position(e);else if(x(e)){var n=e,r=this.cy();r.startBatch();for(var a=0;a<this.length;a++){var i=this[a],o=void 0;(o=n(i,a))&&(t?i.silentPosition(o):i.position(o))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(E(e)?(r={x:C(e.x)?e.x:0,y:C(e.y)?e.y:0},n=t):b(e)&&C(t)&&((r={x:0,y:0})[e]=t),null!=r){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+r.x,y:s.y+r.y};n?o.silentPosition(l):o.position(l)}}a.endBatch()}return this},silentShift:function(e,t){return E(e)?this.shift(e,!0):b(e)&&C(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),a=r.zoom(),i=r.pan(),o=E(e)?e:void 0,s=void 0!==o||void 0!==t&&b(e);if(n&&n.isNode()){if(!s){var l=n.position();return o=dn(l,a,i),void 0===e?o:o[e]}for(var u=0;u<this.length;u++){var c=this[u];void 0!==t?c.position(e,(t-i[e])/a):void 0!==o&&c.position(hn(o,a,i))}}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),a=E(e)?e:void 0,i=void 0!==a||void 0!==t&&b(e),o=r.hasCompoundNodes();if(n&&n.isNode()){if(!i){var s=n.position(),l=o?n.parent():null,u=l&&l.length>0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return a={x:s.x-d.x,y:s.y-d.y},void 0===e?a:a[e]}for(var h=0;h<this.length;h++){var p=this[h],f=o?p.parent():null,g=f&&f.length>0,v=g;g&&(f=f[0]);var y=v?f.position():{x:0,y:0};void 0!==t?p.position(e,t+y[e]):void 0!==a&&p.position({x:a.x+y.x,y:a.y+y.y})}}else if(!i)return;return this}},$s.modelPosition=$s.point=$s.position,$s.modelPositions=$s.points=$s.positions,$s.renderedPoint=$s.renderedPosition,$s.relativePoint=$s.relativePosition;var il,ol,sl=Qs;il=ol={},ol.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),i=t.x1*r+a.x,o=t.x2*r+a.x,s=t.y1*r+a.y,l=t.y2*r+a.y;return{x1:i,x2:o,y1:s,y2:l,w:o-i,h:l-s}},ol.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},ol.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="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=n.boundingBox({includeLabels:r,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,p=d.biasComplementDiff,f=y(a.height.val-i.h,u,c),g=f.biasDiff,v=f.biasComplementDiff;t.autoPadding=m(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+p)/2,t.autoHeight=Math.max(i.h,a.height.val),o.y=(-g+i.y1+i.y2+v)/2}function y(e,t,n){var r=0,a=0,i=t+n;return e>0&&i>0&&(r=t/i*e,a=n/i*e),{biasDiff:r,biasComplementDiff:a}}function m(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}}for(var r=0;r<this.length;r++){var a=this[r],i=a._private;i.compoundBoundsClean&&!e||(n(a),t.batching()||(i.compoundBoundsClean=!0))}return this};var ll=function(e){return e===1/0||e===-1/0?0:e},ul=function(e,t,n,r,a){r-t!==0&&a-n!==0&&null!=t&&null!=n&&null!=r&&null!=a&&(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=a>e.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},cl=function(e,t){return null==t?e:ul(e,t.x1,t.y1,t.x2,t.y2)},dl=function(e,t,n){return Rt(e,t,n)},hl=function(e,t,n){if(!t.cy().headless()){var r,a,i=t._private,o=i.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,a=o.srcY):"target"===n?(r=o.tgtX,a=o.tgtY):(r=o.midX,a=o.midY);var l=i.arrowBounds=i.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=a-s,u.x2=r+s,u.y2=a+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,In(u,1),ul(e,u.x1,u.y1,u.x2,u.y2)}}},pl=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var a=t._private,i=a.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=dl(i,"labelWidth",n),p=dl(i,"labelHeight",n),f=dl(i,"labelX",n),g=dl(i,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=2,C=p,S=h,D=S/2,T=C/2;if(m)o=f-D,s=f+D,l=g-T,u=g+T;else{switch(c.value){case"left":o=f-S,s=f;break;case"center":o=f-D,s=f+D;break;case"right":o=f,s=f+S}switch(d.value){case"top":l=g-C,u=g;break;case"center":l=g-T,u=g+T;break;case"bottom":l=g,u=g+C}}o+=v-Math.max(x,w)-E-k,s+=v+Math.max(x,w)+E+k,l+=y-Math.max(x,w)-E-k,u+=y+Math.max(x,w)+E+k;var P=n||"main",_=a.labelBounds,M=_[P]=_[P]||{};M.x1=o,M.y1=l,M.x2=s,M.y2=u,M.w=s-o,M.h=u-l;var B=m&&"autorotate"===b.strValue,N=null!=b.pfValue&&0!==b.pfValue;if(B||N){var A=B?dl(a.rstyle,"labelAngle",n):b.pfValue,I=Math.cos(A),O=Math.sin(A),z=(o+s)/2,L=(l+u)/2;if(!m){switch(c.value){case"left":z=s;break;case"right":z=o}switch(d.value){case"top":L=u;break;case"bottom":L=l}}var R=function(e,t){return{x:(e-=z)*I-(t-=L)*O+z,y:e*O+t*I+L}},V=R(o,l),F=R(o,u),j=R(s,l),q=R(s,u);o=Math.min(V.x,F.x,j.x,q.x),s=Math.max(V.x,F.x,j.x,q.x),l=Math.min(V.y,F.y,j.y,q.y),u=Math.max(V.y,F.y,j.y,q.y)}var X=P+"Rot",Y=_[X]=_[X]||{};Y.x1=o,Y.y1=l,Y.x2=s,Y.y2=u,Y.w=s-o,Y.h=u-l,ul(e,o,l,s,u),ul(a.labelBounds.all,o,l,s,u)}return e}},fl=function(e,t){var n,r,a,i,o,s,l=e._private.cy,u=l.styleEnabled(),c=l.headless(),d=_n(),h=e._private,p=e.isNode(),f=e.isEdge(),g=h.rstyle,v=p&&u?e.pstyle("bounds-expansion").pfValue:[0],y=function(e){return"none"!==e.pstyle("display").value},m=!u||y(e)&&(!f||y(e.source())&&y(e.target()));if(m){var b=0;u&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(b=e.pstyle("overlay-padding").value);var x=0;u&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(x=e.pstyle("underlay-padding").value);var w=Math.max(b,x),E=0;if(u&&(E=e.pstyle("width").pfValue/2),p&&t.includeNodes){var k=e.position();o=k.x,s=k.y;var C=e.outerWidth()/2,S=e.outerHeight()/2;ul(d,n=o-C,a=s-S,r=o+C,i=s+S)}else if(f&&t.includeEdges)if(u&&!c){var D=e.pstyle("curve-style").strValue;if(n=Math.min(g.srcX,g.midX,g.tgtX),r=Math.max(g.srcX,g.midX,g.tgtX),a=Math.min(g.srcY,g.midY,g.tgtY),i=Math.max(g.srcY,g.midY,g.tgtY),ul(d,n-=E,a-=E,r+=E,i+=E),"haystack"===D){var T=g.haystackPts;if(T&&2===T.length){if(n=T[0].x,a=T[0].y,n>(r=T[1].x)){var P=n;n=r,r=P}if(a>(i=T[1].y)){var _=a;a=i,i=_}ul(d,n-E,a-E,r+E,i+E)}}else if("bezier"===D||"unbundled-bezier"===D||"segments"===D||"taxi"===D){var M;switch(D){case"bezier":case"unbundled-bezier":M=g.bezierPts;break;case"segments":case"taxi":M=g.linePts}if(null!=M)for(var B=0;B<M.length;B++){var N=M[B];n=N.x-E,r=N.x+E,a=N.y-E,i=N.y+E,ul(d,n,a,r,i)}}}else{var A=e.source().position(),I=e.target().position();if((n=A.x)>(r=I.x)){var O=n;n=r,r=O}if((a=A.y)>(i=I.y)){var z=a;a=i,i=z}ul(d,n-=E,a-=E,r+=E,i+=E)}if(u&&t.includeEdges&&f&&(hl(d,e,"mid-source"),hl(d,e,"mid-target"),hl(d,e,"source"),hl(d,e,"target")),u&&"yes"===e.pstyle("ghost").value){var L=e.pstyle("ghost-offset-x").pfValue,R=e.pstyle("ghost-offset-y").pfValue;ul(d,d.x1+L,d.y1+R,d.x2+L,d.y2+R)}var V=h.bodyBounds=h.bodyBounds||{};zn(V,d),On(V,v),In(V,1),u&&(n=d.x1,r=d.x2,a=d.y1,i=d.y2,ul(d,n-w,a-w,r+w,i+w));var F=h.overlayBounds=h.overlayBounds||{};zn(F,d),On(F,v),In(F,1);var j=h.labelBounds=h.labelBounds||{};null!=j.all?Bn(j.all):j.all=_n(),u&&t.includeLabels&&(t.includeMainLabels&&pl(d,e,null),f&&(t.includeSourceLabels&&pl(d,e,"source"),t.includeTargetLabels&&pl(d,e,"target")))}return d.x1=ll(d.x1),d.y1=ll(d.y1),d.x2=ll(d.x2),d.y2=ll(d.y2),d.w=ll(d.x2-d.x1),d.h=ll(d.y2-d.y1),d.w>0&&d.h>0&&m&&(On(d,v),In(d,1)),d},gl=function(e){var t=0,n=function(e){return(e?1:0)<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays)},vl=function(e){if(e.isEdge()){var t=e.source().position(),n=e.target().position(),r=function(e){return Math.round(e)};return pt([r(t.x),r(t.y),r(n.x),r(n.y)])}return 0},yl=function(e,t){var n,r=e._private,a=e.isEdge(),i=(null==t?bl:gl(t))===bl,o=vl(e),s=r.bbCachePosKey===o,l=t.useCache&&s,u=function(e){return null==e._private.bbCache||e._private.styleDirty};if(!l||u(e)||a&&u(e.source())||u(e.target())?(s||e.recalculateRenderedStyle(l),n=fl(e,ml),r.bbCache=n,r.bbCachePosKey=o):n=r.bbCache,!i){var c=e.isNode();n=_n(),(t.includeNodes&&c||t.includeEdges&&!c)&&(t.includeOverlays?cl(n,r.overlayBounds):cl(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!a||t.includeSourceLabels&&t.includeTargetLabels)?cl(n,r.labelBounds.all):(t.includeMainLabels&&cl(n,r.labelBounds.mainRot),t.includeSourceLabels&&cl(n,r.labelBounds.sourceRot),t.includeTargetLabels&&cl(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},ml={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,useCache:!0},bl=gl(ml),xl=It(ml);ol.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||this[0]._private.styleDirty||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=_n();var n=xl(e=e||ml),r=this;if(r.cy().styleEnabled())for(var a=0;a<r.length;a++){var i=r[a],o=i._private,s=vl(i),l=o.bbCachePosKey===s,u=n.useCache&&l&&!o.styleDirty;i.recalculateRenderedStyle(u)}this.updateCompoundBounds(!e.useCache);for(var c=0;c<r.length;c++){var d=r[c];cl(t,yl(d,n))}}else e=void 0===e?ml:xl(e),t=yl(this[0],e);return t.x1=ll(t.x1),t.y1=ll(t.y1),t.x2=ll(t.x2),t.y2=ll(t.y2),t.w=ll(t.x2-t.x1),t.h=ll(t.y2-t.y1),t},ol.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},ol.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),a=n.collection();if(r&&(a=t.filter((function(e){return e.isParent()})),t=t.not(a)),E(e)){var i=e;e=function(){return i}}var o=function(t,n){return t._private.bbAtOldPos=e(t,n)},s=function(e){return e._private.bbAtOldPos};n.startBatch(),t.forEach(o).silentPositions(e),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var l=Mn(this.boundingBox({useCache:!1}));return t.silentPositions(s),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),n.endBatch(),l},il.boundingbox=il.bb=il.boundingBox,il.renderedBoundingbox=il.renderedBoundingBox;var wl,El,kl=ol;wl=El={};var Cl=function(e){e.uppercaseName=q(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=q(e.outerName),wl[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t){if(r){if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var a=t.pstyle(e.name);return"label"===a.strValue?(t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):a.pfValue}return 1}},wl["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)return n?t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding():1},wl["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},wl["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};Cl({name:"width"}),Cl({name:"height"}),El.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),void 0!==t.autoPadding?t.autoPadding:e.pstyle("padding").pfValue):e.pstyle("padding").pfValue},El.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},El.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var Sl=El,Dl=function(e,t){if(e.isEdge())return t(e)},Tl=function(e,t){if(e.isEdge()){var n=e.cy();return dn(t(e),n.zoom(),n.pan())}},Pl=function(e,t){if(e.isEdge()){var n=e.cy(),r=n.pan(),a=n.zoom();return t(e).map((function(e){return dn(e,a,r)}))}},_l={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)}}},Ml=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},Bl=Object.keys(_l).reduce((function(e,t){var n=_l[t],r=Ml(t);return e[t]=function(){return Dl(this,n.get)},n.mult?e[r]=function(){return Pl(this,n.get)}:e[r]=function(){return Tl(this,n.get)},e}),{}),Nl=Q({},sl,kl,Sl,Bl),Al=function(e,t){this.recycle(e,t)};function Il(){return!1}function Ol(){return!0}Al.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Il,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Ol:Il):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var n=this.position,r=this.cy.zoom(),a=this.cy.pan();this.renderedPosition={x:n.x*r+a.x,y:n.y*r+a.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Ol;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Ol;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Ol,this.stopPropagation()},isDefaultPrevented:Il,isPropagationStopped:Il,isImmediatePropagationStopped:Il};var zl=/^([^.]+)(\.(?:[^.]+))?$/,Ll=".*",Rl={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},Vl=Object.keys(Rl),Fl={};function jl(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Fl,t=arguments.length>1?arguments[1]:void 0,n=0;n<Vl.length;n++){var r=Vl[n];this[r]=e[r]||Rl[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var ql=jl.prototype,Xl=function(e,t,n,r,a,i,o){x(r)&&(a=r,r=null),o&&(i=null==i?o:Q({},i,o));for(var s=w(n)?n:n.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!A(u)){var c=u.match(zl);if(c&&!1===t(e,u,c[1],c[2]?c[2]:null,r,a,i))break}}},Yl=function(e,t){return e.addEventFields(e.context,t),new Al(t.type,t)},Wl=function(e,t,n){if(N(n))t(e,n);else if(E(n))t(e,Yl(e,n));else for(var r=w(n)?n:n.split(/\s+/),a=0;a<r.length;a++){var i=r[a];if(!A(i)){var o=i.match(zl);if(o){var s=o[1],l=o[2]?o[2]:null;t(e,Yl(e,{type:s,namespace:l,target:e.context}))}}}};ql.on=ql.addListener=function(e,t,n,r,a){return Xl(this,(function(e,t,n,r,a,i,o){x(i)&&e.listeners.push({event:t,callback:i,type:n,namespace:r,qualifier:a,conf:o})}),e,t,n,r,a),this},ql.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},ql.removeListener=ql.off=function(e,t,n,r){var a=this;0!==this.emitting&&(this.listeners=Mt(this.listeners));for(var i=this.listeners,o=function(o){var s=i[o];Xl(a,(function(t,n,r,a,l,u){if((s.type===r||"*"===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,n,r)},s=i.length-1;s>=0;s--)o(s);return this},ql.removeAllListeners=function(){return this.removeListener("*")},ql.emit=ql.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,w(t)||(t=[t]),Wl(this,(function(e,i){null!=n&&(r=[{event:i.event,type:i.type,namespace:i.namespace,callback:n}],a=r.length);for(var o=function(n){var a=r[n];if(a.type===i.type&&(!a.namespace||a.namespace===i.namespace||a.namespace===Ll)&&e.eventMatches(e.context,a,i)){var o=[i];null!=t&&Lt(o,t),e.beforeEmit(e.context,a,i),a.conf&&a.conf.one&&(e.listeners=e.listeners.filter((function(e){return e!==a})));var s=e.callbackContext(e.context,a,i),l=a.callback.apply(s,o);e.afterEmit(e.context,a,i),!1===l&&(i.stopPropagation(),i.preventDefault())}},s=0;s<a;s++)o(s);e.bubble(e.context)&&!i.isPropagationStopped()&&e.parent(e.context).emit(i,t)}),e),this.emitting--,this};var Hl={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&P(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Gl=function(e){return b(e)?new Fs(e):e},Kl={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new jl(Hl,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=Gl(t),a=0;a<this.length;a++)this[a].emitter().on(e,r,n);return this},removeListener:function(e,t,n){for(var r=Gl(t),a=0;a<this.length;a++)this[a].emitter().removeListener(e,r,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var r=Gl(t),a=0;a<this.length;a++)this[a].emitter().one(e,r,n);return this},once:function(e,t,n){for(var r=Gl(t),a=0;a<this.length;a++)this[a].emitter().on(e,r,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};ps.eventAliasesOn(Kl);var Ul={nodes:function(e){return this.filter((function(e){return e.isNode()})).filter(e)},edges:function(e){return this.filter((function(e){return e.isEdge()})).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(b(e)||T(e))return new Fs(e).filter(this);if(x(e)){for(var n=this.spawn(),r=this,a=0;a<r.length;a++){var i=r[a];(t?e.apply(t,[i,a,r]):e(i,a,r))&&n.push(i)}return n}return this.spawn()},not:function(e){if(e){b(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n];e.has(r)||t.push(r)}return t}return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(b(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=this,a=e,i=this.length<e.length,o=i?r:a,s=i?a:r,l=0;l<o.length;l++){var u=o[l];s.has(u)&&n.push(u)}return n},xor:function(e){var t=this._private.cy;b(e)&&(e=t.$(e));var n=this.spawn(),r=this,a=e,i=function(e,t){for(var r=0;r<e.length;r++){var a=e[r],i=a._private.data.id;t.hasElementWithId(i)||n.push(a)}};return i(r,a),i(a,r),n},diff:function(e){var t=this._private.cy;b(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),a=this.spawn(),i=this,o=e,s=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r],o=i._private.data.id;t.hasElementWithId(o)?a.merge(i):n.push(i)}};return s(i,o,n),s(o,i,r),{left:n,right:r,both:a}},add:function(e){var t=this._private.cy;if(!e)return this;if(b(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),a=0;a<e.length;a++){var i=e[a],o=!this.has(i);o&&r.push(i)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&b(e)){var r=e;e=n.mutableElements().filter(r)}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(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var a=this.length-1,i=this[a],o=i._private.data.id;this[a]=void 0,this[e]=i,n.set(o,{ele:i,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var a=r.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&b(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=this,a=0;a<r.length;a++){var i=r[a],o=t?e.apply(t,[i,a,r]):e(i,a,r);n.push(o)}return n},reduce:function(e,t){for(var n=t,r=this,a=0;a<r.length;a++)n=e(n,r[a],a,r);return n},max:function(e,t){for(var n,r=-1/0,a=this,i=0;i<a.length;i++){var o=a[i],s=t?e.apply(t,[o,i,a]):e(o,i,a);s>r&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,a=this,i=0;i<a.length;i++){var o=a[i],s=t?e.apply(t,[o,i,a]):e(o,i,a);s<r&&(r=s,n=o)}return{value:r,ele:n}}},Zl=Ul;Zl.u=Zl["|"]=Zl["+"]=Zl.union=Zl.or=Zl.add,Zl["\\"]=Zl["!"]=Zl["-"]=Zl.difference=Zl.relativeComplement=Zl.subtract=Zl.not,Zl.n=Zl["&"]=Zl["."]=Zl.and=Zl.intersection=Zl.intersect,Zl["^"]=Zl["(+)"]=Zl["(-)"]=Zl.symmetricDifference=Zl.symdiff=Zl.xor,Zl.fnFilter=Zl.filterFn=Zl.stdFilter=Zl.filter,Zl.complement=Zl.abscomp=Zl.absoluteComplement;var $l={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}},Ql=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?n?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?xt:0}var a=r(e)-r(t);if(0!==a)return a;function i(e){return"auto"===e.pstyle("z-index-compare").value&&e.isNode()?1: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()},Jl={forEach:function(e,t){if(x(e))for(var n=this.length,r=0;r<n;r++){var a=this[r];if(!1===(t?e.apply(t,[a,r,this]):e(a,r,this)))break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;null==t&&(t=r),null==e&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var a=e;a>=0&&a<t&&a<r;a++)n.push(this[a]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!x(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(Ql)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:xt-1}var r=t.source,a=t.target,i=r.zDepth(),o=a.zDepth();return Math.max(i,o,0)}}};Jl.each=Jl.forEach;var eu=function(){var t="undefined";("undefined"===typeof Symbol?"undefined":e(Symbol))!=t&&e(Symbol.iterator)!=t&&(Jl[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return i({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,(function(){return this}))})};eu();var tu=It({nodeDimensionsIncludeLabels:!1}),nu={layoutDimensions:function(e){var t;if(e=tu(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};else t={w:0,h:0};return 0!==t.w&&0!==t.h||(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter((function(e){return!e.isParent()})),a=this.cy(),i=t.eles,o=function(e){return e.id()},s=R(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(e,t,n){var r={x:t.x1+t.w/2,y:t.y1+t.h/2},a={x:(n.x-r.x)*e,y:(n.y-r.y)*e};return{x:r.x+a.x,y:r.y+a.y}},u=t.spacingFactor&&1!==t.spacingFactor,c=function(){if(!u)return null;for(var e=_n(),t=0;t<r.length;t++){var n=r[t],a=s(n,t);An(e,a.x,a.y)}return e},d=c(),h=R((function(e,n){var r=s(e,n);if(u){var a=Math.abs(t.spacingFactor);r=l(a,d,r)}return null!=t.transform&&(r=t.transform(e,r)),r}),o);if(t.animate){for(var p=0;p<r.length;p++){var f=r[p],g=h(f,p);if(null==t.animateFilter||t.animateFilter(f,p)){var v=f.animation({position:g,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(v)}else f.position(g)}if(t.fit){var y=a.animation({fit:{boundingBox:i.boundingBoxAt(h),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(y)}else if(void 0!==t.zoom&&void 0!==t.pan){var m=a.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(m)}e.animations.forEach((function(e){return e.play()})),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),ja.all(e.animations.map((function(e){return e.promise()}))).then((function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})}))}else r.positions(h),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(Q({},e,{eles:this}))}};function ru(e,t,n){var r,a=n._private,i=a.styleCache=a.styleCache||[];return null!=(r=i[e])?r:r=i[e]=t(n)}function au(e,t){return e=ft(e),function(n){return ru(e,t,n)}}function iu(e,t){e=ft(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return ru(e,n,t)}}nu.createLayout=nu.makeLayout=nu.layout;var ou={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),n=function(e){return e._private.styleCache=null};return t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(n)):this.forEach((function(e){n(e),e.connectedEdges().forEach(n)})),this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=this;e=!(!e&&void 0!==e),t.hasCompoundNodes()&&(n=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var r=n;return e?r.emitAndNotify("style"):r.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 n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var a=n._private.style[e];return null!=a?a:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style();if(E(e)){var i=e;a.applyBypass(this,i,r),this.emitAndNotify("style")}else if(b(e)){if(void 0===t){var o=this[0];return o?a.getStylePropertyValue(o,e):void 0}a.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(void 0===e){var s=this[0];return s?a.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),a=this;if(void 0===e)for(var i=0;i<a.length;i++){var o=a[i];r.removeAllBypasses(o,n)}else{e=e.split(/\s+/);for(var s=0;s<a.length;s++){var l=a[s];r.removeBypasses(l,e,n)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,a=n.pstyle("opacity").value;if(!t)return a;var i=r.data.parent?n.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();return e?t?0===e.effectiveOpacity():0===e.pstyle("opacity").value:void 0},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function su(e,t){var n=e._private.data.parent?e.parents():null;if(n)for(var r=0;r<n.length;r++)if(!t(n[r]))return!1;return!0}function lu(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var a=this[0],i=e.hasCompoundNodes();if(a){var o=a._private;if(!t(a))return!1;if(a.isNode())return!i||su(a,r);var s=o.source,l=o.target;return n(s)&&(!i||su(s,n))&&(s===l||n(l)&&(!i||su(l,n)))}}}var uu=au("eleTakesUpSpace",(function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())}));ou.takesUpSpace=iu("takesUpSpace",lu({ok:uu}));var cu=au("eleInteractive",(function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&uu(e)})),du=au("parentInteractive",(function(e){return"visible"===e.pstyle("visibility").value&&uu(e)}));ou.interactive=iu("interactive",lu({ok:cu,parentOk:du,edgeOkViaNode:uu})),ou.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var hu=au("eleVisible",(function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&uu(e)})),pu=uu;ou.visible=iu("visible",lu({ok:hu,edgeOkViaNode:pu})),ou.hidden=function(){var e=this[0];if(e)return!e.visible()},ou.isBundledBezier=iu("isBundledBezier",(function(){return!!this.cy().styleEnabled()&&!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace()})),ou.bypass=ou.css=ou.style,ou.renderedCss=ou.renderedStyle,ou.removeBypass=ou.removeCss=ou.removeStyle,ou.pstyle=ou.parsedStyle;var fu={};function gu(e){return function(){var t=arguments,n=[];if(2===t.length){var r=t[0],a=t[1];this.on(e.event,r,a)}else if(1===t.length&&x(t[0])){var i=t[0];this.on(e.event,i)}else if(0===t.length||1===t.length&&w(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&&n.push(l))}var h=this.spawn(n);h.updateStyle(),h.emit(e.event),o&&h.emit(o)}return this}}function vu(e){fu[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(void 0!==n)return n}return t._private[e.field]}},fu[e.on]=gu({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),fu[e.off]=gu({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}vu({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),vu({field:"grabbable",overrideField:function(e){return!e.cy().autoungrabify()&&!e.pannable()&&void 0},on:"grabify",off:"ungrabify"}),vu({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),vu({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),fu.deselect=fu.unselect,fu.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},vu({field:"active",on:"activate",off:"unactivate"}),vu({field:"pannable",on:"panify",off:"unpanify"}),fu.inactive=function(){var e=this[0];if(e)return!e._private.active};var yu={},mu=function(e){return function(t){for(var n=this,r=[],a=0;a<n.length;a++){var i=n[a];if(i.isNode()){for(var o=!1,s=i.connectedEdges(),l=0;l<s.length;l++){var u=s[l],c=u.source(),d=u.target();if(e.noIncomingEdges&&d===i&&c!==i||e.noOutgoingEdges&&c===i&&d!==i){o=!0;break}}o||r.push(i)}}return this.spawn(r,!0).filter(t)}},bu=function(e){return function(t){for(var n=this,r=[],a=0;a<n.length;a++){var i=n[a];if(i.isNode())for(var o=i.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target();e.outgoing&&u===i?(r.push(l),r.push(c)):e.incoming&&c===i&&(r.push(l),r.push(u))}}return this.spawn(r,!0).filter(t)}},xu=function(e){return function(t){for(var n=this,r=[],a={};;){var i=e.outgoing?n.outgoers():n.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,r.push(l),o=!0)}if(!o)break;n=i}return this.spawn(r,!0).filter(t)}};function wu(e){return function(t){for(var n=[],r=0;r<this.length;r++){var a=this[r]._private[e.attr];a&&n.push(a)}return this.spawn(n,!0).filter(t)}}function Eu(e){return function(t){var n=[],r=this._private.cy,a=e||{};b(t)&&(t=r.$(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){if(a.thisIsSrc&&!c)continue;if(a.thisIsTgt&&!d)continue}n.push(l)}}return this.spawn(n,!0)}}function ku(e){return e=Q({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),a=e,i=0;i<r.length;i++)for(var o=r[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],p=h._private.data,f=p.target,g=p.source,v=f===u&&g===l,y=l===f&&u===g;(a.codirected&&v||!a.codirected&&(v||y))&&n.push(h)}return this.spawn(n,!0).filter(t)}}yu.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},Q(yu,{roots:mu({noIncomingEdges:!0}),leaves:mu({noOutgoingEdges:!0}),outgoers:Ws(bu({outgoing:!0}),"outgoers"),successors:xu({outgoing:!0}),incomers:Ws(bu({incoming:!0}),"incomers"),predecessors:xu({incoming:!0})}),Q(yu,{neighborhood:Ws((function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var a=n[r],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)}}),yu.neighbourhood=yu.neighborhood,yu.closedNeighbourhood=yu.closedNeighborhood,yu.openNeighbourhood=yu.openNeighborhood,Q(yu,{source:Ws((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Ws((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:wu({attr:"source"}),targets:wu({attr:"target"})}),Q(yu,{edgesWith:Ws(Eu(),"edgesWith"),edgesTo:Ws(Eu({thisIsSrc:!0}),"edgesTo")}),Q(yu,{connectedEdges:Ws((function(e){for(var t=[],n=this,r=0;r<n.length;r++){var a=n[r];if(a.isNode())for(var i=a._private.edges,o=0;o<i.length;o++){var s=i[o];t.push(s)}}return this.spawn(t,!0).filter(e)}),"connectedEdges"),connectedNodes:Ws((function(e){for(var t=[],n=this,r=0;r<n.length;r++){var a=n[r];a.isEdge()&&(t.push(a.source()[0]),t.push(a.target()[0]))}return this.spawn(t,!0).filter(e)}),"connectedNodes"),parallelEdges:Ws(ku(),"parallelEdges"),codirectedEdges:Ws(ku({codirected:!0}),"codirectedEdges")}),Q(yu,{components:function(e){var t=this,n=t.cy(),r=n.collection(),a=null==e?t.nodes():e.nodes(),i=[];null!=e&&a.empty()&&(a=e.sources());var o=function(e,t){r.merge(e),a.unmerge(e),t.merge(e)};if(a.empty())return t.spawn();var s=function(){var e=n.collection();i.push(e);var r=a[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach((function(n){n.connectedEdges().forEach((function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)}))}))};do{s()}while(a.length>0);return i},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),yu.componentsOf=yu.components;var Cu=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var a=new jt,i=!1;if(t){if(t.length>0&&E(t[0])&&!P(t[0])){i=!0;for(var o=[],s=new Yt,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=Bt();else if(e.hasElementWithId(d.id)||s.has(d.id))continue;var h=new Wt(e,c,!1);o.push(h),s.add(d.id)}t=o}}else t=[];this.length=0;for(var p=0,f=t.length;p<f;p++){var g=t[p][0];if(null!=g){var v=g._private.data.id;n&&a.has(v)||(n&&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(e){this.lazyMap=e},rebuildMap:function(){for(var e=this.lazyMap=new jt,t=this.eles,n=0;n<t.length;n++){var r=t[n];e.set(r.id(),{index:n,ele:r})}}},n&&(this._private.map=a),i&&!r&&this.restore()}else St("A collection must have a reference to the core")},Su=Wt.prototype=Cu.prototype=Object.create(Array.prototype);Su.instanceString=function(){return"collection"},Su.spawn=function(e,t){return new Cu(this.cy(),e,t)},Su.spawnSelf=function(){return this.spawn(this)},Su.cy=function(){return this._private.cy},Su.renderer=function(){return this._private.cy.renderer()},Su.element=function(){return this[0]},Su.collection=function(){return _(this)?this:new Cu(this._private.cy,[this])},Su.unique=function(){return new Cu(this._private.cy,this,!0)},Su.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},Su.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new Cu(t)},Su.$id=Su.getElementById,Su.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},Su.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},Su.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},Su.json=function(e){var t=this.element(),n=this.cy();if(null==t&&e)return this;if(null!=t){var r=t._private;if(E(e)){if(n.startBatch(),e.data){t.data(e.data);var a=r.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(n,a,i){var o=e[n];null!=o&&o!==r[n]&&(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),n.endBatch(),this}if(void 0===e){var h={data:_t(r.data),position:_t(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};h.classes="";var p=0;return r.classes.forEach((function(e){return h.classes+=0===p++?e:" "+e})),h}}},Su.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},Su.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n].json(),a=new Wt(e,r,!1);t.push(a)}return new Cu(e,t)},Su.copy=Su.clone,Su.restore=function(){for(var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=this,i=a.cy(),o=i._private,s=[],l=[],u=0,c=a.length;u<c;u++){var d=a[u];r&&!d.removed()||(d.isNode()?s.push(d):l.push(d))}e=s.concat(l);var h=function(){e.splice(t,1),t--};for(t=0;t<e.length;t++){var p=e[t],f=p._private,g=f.data;if(p.clearTraversalCache(),r||f.removed)if(void 0===g.id)g.id=Bt();else if(C(g.id))g.id=""+g.id;else{if(A(g.id)||!b(g.id)){St("Can not create element with invalid string ID `"+g.id+"`"),h();continue}if(i.hasElementWithId(g.id)){St("Can not create second element with ID `"+g.id+"`"),h();continue}}var v=g.id;if(p.isNode()){var y=f.position;null==y.x&&(y.x=0),null==y.y&&(y.y=0)}if(p.isEdge()){for(var m=p,x=["source","target"],w=x.length,E=!1,k=0;k<w;k++){var S=x[k],D=g[S];C(D)&&(D=g[S]=""+g[S]),null==D||""===D?(St("Can not create edge `"+v+"` with unspecified "+S),E=!0):i.hasElementWithId(D)||(St("Can not create edge `"+v+"` with nonexistant "+S+" `"+D+"`"),E=!0)}if(E){h();continue}var T=i.getElementById(g.source),P=i.getElementById(g.target);T.same(P)?T._private.edges.push(m):(T._private.edges.push(m),P._private.edges.push(m)),m._private.source=T,m._private.target=P}f.map=new jt,f.map.set(v,{ele:p,index:0}),f.removed=!1,r&&i.addToPool(p)}for(var _=0;_<s.length;_++){var M=s[_],B=M._private.data;C(B.parent)&&(B.parent=""+B.parent);var N=B.parent;if(null!=N||M._private.parent){var I=M._private.parent?i.collection().merge(M._private.parent):i.getElementById(N);if(I.empty())B.parent=void 0;else if(I[0].removed())Tt("Node added with missing parent, reference to parent removed"),B.parent=void 0,M._private.parent=null;else{for(var O=!1,z=I;!z.empty();){if(M.same(z)){O=!0,B.parent=void 0;break}z=z.parent()}O||(I[0]._private.children.push(M),M._private.parent=I[0],o.hasCompoundNodes=!0)}}}if(e.length>0){for(var L=e.length===a.length?a:new Cu(i,e),R=0;R<L.length;R++){var V=L[R];V.isNode()||(V.parallelEdges().clearTraversalCache(),V.source().clearTraversalCache(),V.target().clearTraversalCache())}(o.hasCompoundNodes?i.collection().merge(L).merge(L.connectedNodes()).merge(L.parent()):L).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(n),n?L.emitAndNotify("add"):r&&L.emit("add")}return a},Su.removed=function(){var e=this[0];return e&&e._private.removed},Su.inside=function(){var e=this[0];return e&&!e._private.removed},Su.remove=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],a={},i=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n<t.length;n++)l(t[n])}function s(e){for(var t=e._private.children,n=0;n<t.length;n++)l(t[n])}function l(e){var n=a[e.id()];t&&e.removed()||n||(a[e.id()]=!0,e.isNode()?(r.push(e),o(e),s(e)):r.unshift(e))}for(var u=0,c=n.length;u<c;u++)l(n[u]);function d(e,t){var n=e._private.edges;Ot(n,t),e.clearTraversalCache()}function h(e){e.clearTraversalCache()}var p=[];function f(e,t){t=t[0];var n=(e=e[0])._private.children,r=e.id();Ot(n,t),t._private.parent=null,p.ids[r]||(p.ids[r]=!0,p.push(e))}p.ids={},n.dirtyCompoundBoundsCache(),t&&i.removeFromPool(r);for(var g=0;g<r.length;g++){var v=r[g];if(v.isEdge()){var y=v.source()[0],m=v.target()[0];d(y,v),d(m,v);for(var b=v.parallelEdges(),x=0;x<b.length;x++){var w=b[x];h(w),w.isBundledBezier()&&w.dirtyBoundingBoxCache()}}else{var E=v.parent();0!==E.length&&f(E,v)}t&&(v._private.removed=!0)}var k=i._private.elements;i._private.hasCompoundNodes=!1;for(var C=0;C<k.length;C++)if(k[C].isParent()){i._private.hasCompoundNodes=!0;break}var S=new Cu(this.cy(),r);S.size()>0&&(e?S.emitAndNotify("remove"):t&&S.emit("remove"));for(var D=0;D<p.length;D++){var T=p[D];t&&T.removed()||T.updateStyle()}return S},Su.move=function(e){var t=this._private.cy,n=this,r=!1,a=!1,i=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var o=i(e.source),s=i(e.target),l=null!=o&&t.hasElementWithId(o),u=null!=s&&t.hasElementWithId(s);(l||u)&&(t.batch((function(){n.remove(r,a),n.emitAndNotify("moveout");for(var e=0;e<n.length;e++){var t=n[e],i=t._private.data;t.isEdge()&&(l&&(i.source=o),u&&(i.target=s))}n.restore(r,a)})),n.emitAndNotify("move"))}else if(void 0!==e.parent){var c=i(e.parent);if(null===c||t.hasElementWithId(c)){var d=null===c?void 0:c;t.batch((function(){var e=n.remove(r,a);e.emitAndNotify("moveout");for(var t=0;t<n.length;t++){var i=n[t],o=i._private.data;i.isNode()&&(o.parent=d)}e.restore(r,a)})),n.emitAndNotify("move")}}return this},[Ba,fs,gs,qs,Hs,Js,el,Nl,Kl,Ul,$l,Jl,nu,ou,fu,yu].forEach((function(e){Q(Su,e)}));var Du={add:function(e){var t,n=this;if(T(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var a=[],i=0;i<r.length;i++){var o=r[i];a.push(o.json())}t=new Cu(n,a)}}else if(w(e))t=new Cu(n,e);else if(E(e)&&(w(e.nodes)||w(e.edges))){for(var s=e,l=[],u=["nodes","edges"],c=0,d=u.length;c<d;c++){var h=u[c],p=s[h];if(w(p))for(var f=0,g=p.length;f<g;f++){var v=Q({group:h},p[f]);l.push(v)}}t=new Cu(n,l)}else t=new Wt(n,e).collection();return t},remove:function(e){if(T(e));else if(b(e)){var t=e;e=this.$(t)}return e.remove()}};function Tu(e,t,n,r){var a=4,i=.001,o=1e-7,s=10,l=11,u=1/(l-1),c="undefined"!==typeof Float32Array;if(4!==arguments.length)return!1;for(var d=0;d<4;++d)if("number"!==typeof arguments[d]||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var h=c?new Float32Array(l):new Array(l);function p(e,t){return 1-3*t+3*e}function f(e,t){return 3*t-6*e}function g(e){return 3*e}function v(e,t,n){return((p(t,n)*e+f(t,n))*e+g(t))*e}function y(e,t,n){return 3*p(t,n)*e*e+2*f(t,n)*e+g(t)}function m(t,r){for(var i=0;i<a;++i){var o=y(r,e,n);if(0===o)return r;r-=(v(r,e,n)-t)/o}return r}function b(){for(var t=0;t<l;++t)h[t]=v(t*u,e,n)}function x(t,r,a){var i,l,u=0;do{(i=v(l=r+(a-r)/2,e,n)-t)>0?a=l:r=l}while(Math.abs(i)>o&&++u<s);return l}function w(t){for(var r=0,a=1,o=l-1;a!==o&&h[a]<=t;++a)r+=u;--a;var s=r+(t-h[a])/(h[a+1]-h[a])*u,c=y(s,e,n);return c>=i?m(t,s):0===c?s:x(t,r,r+u)}var E=!1;function k(){E=!0,e===t&&n===r||b()}var C=function(a){return E||k(),e===t&&n===r?a:0===a?0:1===a?1:v(w(a),t,r)};C.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var S="generateBezier("+[e,t,n,r]+")";return C.toString=function(){return S},C}var Pu=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var a={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:a.v,dv:e(a)}}function n(n,r){var a={dx:n.v,dv:e(n)},i=t(n,.5*r,a),o=t(n,.5*r,i),s=t(n,r,o),l=1/6*(a.dx+2*(i.dx+o.dx)+s.dx),u=1/6*(a.dv+2*(i.dv+o.dv)+s.dv);return n.x=n.x+l*r,n.v=n.v+u*r,n}return function e(t,r,a){var i,o,s,l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,d=1e-4,h=.016;for(t=parseFloat(t)||500,r=parseFloat(r)||20,a=a||null,l.tension=t,l.friction=r,o=(i=null!==a)?(c=e(t,r))/a*h:h;s=n(s||l,o),u.push(1+s.x),c+=16,Math.abs(s.x)>d&&Math.abs(s.v)>d;);return i?function(e){return u[e*(u.length-1)|0]}:c}}(),_u=function(e,t,n,r){var a=Tu(e,t,n,r);return function(e,t,n){return e+(t-e)*a(n)}},Mu={linear:function(e,t,n){return e+(t-e)*n},ease:_u(.25,.1,.25,1),"ease-in":_u(.42,0,1,1),"ease-out":_u(0,0,.58,1),"ease-in-out":_u(.42,0,.58,1),"ease-in-sine":_u(.47,0,.745,.715),"ease-out-sine":_u(.39,.575,.565,1),"ease-in-out-sine":_u(.445,.05,.55,.95),"ease-in-quad":_u(.55,.085,.68,.53),"ease-out-quad":_u(.25,.46,.45,.94),"ease-in-out-quad":_u(.455,.03,.515,.955),"ease-in-cubic":_u(.55,.055,.675,.19),"ease-out-cubic":_u(.215,.61,.355,1),"ease-in-out-cubic":_u(.645,.045,.355,1),"ease-in-quart":_u(.895,.03,.685,.22),"ease-out-quart":_u(.165,.84,.44,1),"ease-in-out-quart":_u(.77,0,.175,1),"ease-in-quint":_u(.755,.05,.855,.06),"ease-out-quint":_u(.23,1,.32,1),"ease-in-out-quint":_u(.86,0,.07,1),"ease-in-expo":_u(.95,.05,.795,.035),"ease-out-expo":_u(.19,1,.22,1),"ease-in-out-expo":_u(1,0,0,1),"ease-in-circ":_u(.6,.04,.98,.335),"ease-out-circ":_u(.075,.82,.165,1),"ease-in-out-circ":_u(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return Mu.linear;var r=Pu(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":_u};function Bu(e,t,n,r,a){if(1===r)return n;if(t===n)return n;var i=a(t,n,r);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 Nu(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function Au(e,t,n,r,a){var i=null!=a?a.type:null;n<0?n=0:n>1&&(n=1);var o=Nu(e,a),s=Nu(t,a);if(C(o)&&C(s))return Bu(i,o,s,n,r);if(w(o)&&w(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],d=s[u];if(null!=c&&null!=d){var h=Bu(i,c,d,n,r);l.push(h)}else l.push(d)}return l}}function Iu(e,t,n,r){var a=!r,i=e._private,o=t._private,s=o.easing,l=o.startTime,u=(r?e:e.cy()).style();if(!o.easingImpl)if(null==s)o.easingImpl=Mu.linear;else{var c,d,h;c=b(s)?u.parse("transition-timing-function",s).value:s,b(c)?(d=c,h=[]):(d=c[1],h=c.slice(2).map((function(e){return+e}))),h.length>0?("spring"===d&&h.push(o.duration),o.easingImpl=Mu[d].apply(null,h)):o.easingImpl=Mu[d]}var p,f=o.easingImpl;if(p=0===o.duration?1:(n-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),null==o.delay){var g=o.startPosition,v=o.position;if(v&&a&&!e.locked()){var y={};Ou(g.x,v.x)&&(y.x=Au(g.x,v.x,p,f)),Ou(g.y,v.y)&&(y.y=Au(g.y,v.y,p,f)),e.position(y)}var m=o.startPan,x=o.pan,w=i.pan,E=null!=x&&r;E&&(Ou(m.x,x.x)&&(w.x=Au(m.x,x.x,p,f)),Ou(m.y,x.y)&&(w.y=Au(m.y,x.y,p,f)),e.emit("pan"));var k=o.startZoom,C=o.zoom,S=null!=C&&r;S&&(Ou(k,C)&&(i.zoom=Pn(i.minZoom,Au(k,C,p,f),i.maxZoom)),e.emit("zoom")),(E||S)&&e.emit("viewport");var D=o.style;if(D&&D.length>0&&a){for(var T=0;T<D.length;T++){var P=D[T],_=P.name,M=P,B=o.startStyle[_],N=Au(B,M,p,f,u.properties[B.name]);u.overrideBypass(e,_,N)}e.emit("style")}}return o.progress=p,p}function Ou(e,t){return null!=e&&null!=t&&(!(!C(e)||!C(t))||!(!e||!t))}function zu(e,t,n,r){var a=t._private;a.started=!0,a.startTime=n-a.progress*a.duration}function Lu(e,t){var n=t._private.aniEles,r=[];function a(t,n){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;h.stopped?(i.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||zu(t,d,e),Iu(t,d,e,n),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 n||0!==i.length||0!==o.length||r.push(t),s}for(var i=!1,o=0;o<n.length;o++){var s=a(n[o]);i=i||s}var l=a(t,!0);(i||l)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var Ru={animate:ps.animate(),animation:ps.animation(),animated:ps.animated(),clearQueue:ps.clearQueue(),delay:ps.delay(),delayAnimation:ps.delayAnimation(),stop:ps.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){Lu(n,e)}),t.beforeRenderPriorities.animations):n()}function n(){e._private.animationsRunning&&nt((function(t){Lu(t,e),n()}))}}},Vu={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&P(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},Fu=function(e){return b(e)?new Fs(e):e},ju={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new jl(Vu,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Fu(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Fu(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Fu(t),n),this},once:function(e,t,n){return this.emitter().one(e,Fu(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};ps.eventAliasesOn(ju);var qu={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)}};qu.jpeg=qu.jpg;var Xu={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n=e.name,r=t.extension("layout",n);if(null!=r){var a;a=b(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$();var i=new r(Q({},e,{cy:t,eles:a}));return i}St("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else St("A `name` must be specified to make a layout");else St("Layout options must be specified to make a layout")}};Xu.createLayout=Xu.makeLayout=Xu.layout;var Yu={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.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(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var a=n[r],i=e[a];t.getElementById(a).data(i)}}))}},Wu=It({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),Hu={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this,n=t.extension("renderer",e.name);if(null!=n){void 0!==e.wheelSensitivity&&Tt("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=Wu(e);r.cy=t,t._private.renderer=new n(r),this.notify("init")}else St("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"))},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.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)}};Hu.invalidateDimensions=Hu.resize;var Gu={collection:function(e,t){return b(e)?this.$(e):T(e)?e.collection():w(e)?(t||(t={}),new Cu(this,e,t.unique,t.removed)):new Cu(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}};Gu.elements=Gu.filter=Gu.$;var Ku={},Uu="t",Zu="f";Ku.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r<e.length;r++){var a=e[r],i=t.getContextMeta(a);if(!i.empty){var o=t.getContextStyle(i),s=t.applyContextStyle(i,o,a);a._private.appliedInitStyle?t.updateTransitions(a,s.diffProps):a._private.appliedInitStyle=!0,t.updateStyleHints(a)&&n.push(a)}}return n},Ku.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},a=e+"-"+t,i=r[a];if(i)return i;for(var o=[],s={},l=0;l<n.length;l++){var u=n[l],c=e[l]===Uu,d=t[l]===Uu,h=c!==d,p=u.mappedProperties.length>0;if(h||d&&p){var f=void 0;h&&p||h?f=u.properties:p&&(f=u.mappedProperties);for(var g=0;g<f.length;g++){for(var v=f[g],y=v.name,m=!1,b=l+1;b<n.length;b++){var x=n[b];if(t[b]===Uu&&(m=null!=x.properties[v.name]))break}s[y]||m||(s[y]=!0,o.push(y))}}}return r[a]=o,o},Ku.getContextMeta=function(e){for(var t,n=this,r="",a=e._private.styleCxtKey||"",i=0;i<n.length;i++){var o=n[i];r+=o.selector&&o.selector.matches(e)?Uu:Zu}return t=n.getPropertiesDiff(a,r),e._private.styleCxtKey=r,{key:r,diffPropNames:t,empty:0===t.length}},Ku.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var a={_private:{key:t}},i=0;i<n.length;i++){var o=n[i];if(t[i]===Uu)for(var s=0;s<o.properties.length;s++){var l=o.properties[s];a[l.name]=l}}return r[t]=a,a},Ku.applyContextStyle=function(e,t,n){for(var r=this,a=e.diffPropNames,i={},o=r.types,s=0;s<a.length;s++){var l=a[s],u=t[l],c=n.pstyle(l);if(!u){if(!c)continue;u=c.bypass?{name:l,deleteBypassed:!0}:{name:l,delete:!0}}if(c!==u){if(u.mapped===o.fn&&null!=c&&null!=c.mapping&&c.mapping.value===u.value){var d=c.mapping;if((d.fnValue=u.value(n))===d.prevFnValue)continue}var h=i[l]={prev:c};r.applyParsedProperty(n,u),h.next=n.pstyle(l),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}},Ku.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,a=n.propertyGroupKeys,i=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,l=e._private.style;r=Object.keys(l);for(var u=0;u<a.length;u++){var c=a[u];t.styleKeys[c]=[at,ot]}for(var d=function(e,n){return t.styleKeys[n][0]=lt(e,t.styleKeys[n][0])},h=function(e,n){return t.styleKeys[n][1]=ut(e,t.styleKeys[n][1])},p=function(e,t){d(e,t),h(e,t)},f=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);d(r,t),h(r,t)}},g=2e9,v=function(e){return-128<e&&e<128&&Math.floor(e)!==e?g-(1024*e|0):e},y=0;y<r.length;y++){var m=r[y],b=l[m];if(null!=b){var x=this.properties[m],w=x.type,E=x.groupKey,k=void 0;null!=x.hashOverride?k=x.hashOverride(e,b):null!=b.pfValue&&(k=b.pfValue);var C=null==x.enums?b.value:null,S=null!=k,D=S||null!=C,T=b.units;w.number&&D&&!w.multiple?(p(v(S?k:C),E),S||null==T||f(T,E)):f(b.strValue,E)}}for(var P=[at,ot],_=0;_<a.length;_++){var M=a[_],B=t.styleKeys[M];P[0]=lt(B[0],P[0]),P[1]=ut(B[1],P[1])}t.styleKey=ct(P[0],P[1]);var N=t.styleKeys;t.labelDimsKey=dt(N.labelDimensions);var A=i(e,["label"],N.labelDimensions);if(t.labelKey=dt(A),t.labelStyleKey=dt(ht(N.commonLabel,A)),!s){var I=i(e,["source-label"],N.labelDimensions);t.sourceLabelKey=dt(I),t.sourceLabelStyleKey=dt(ht(N.commonLabel,I));var O=i(e,["target-label"],N.labelDimensions);t.targetLabelKey=dt(O),t.targetLabelStyleKey=dt(ht(N.commonLabel,O))}if(s){var z=t.styleKeys,L=z.nodeBody,R=z.nodeBorder,V=z.backgroundImage,F=z.compound,j=z.pie,q=[L,R,V,F,j].filter((function(e){return null!=e})).reduce(ht,[at,ot]);t.nodeKey=dt(q),t.hasPie=null!=j&&j[0]!==at&&j[1]!==ot}return o!==t.styleKey},Ku.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},Ku.applyParsedProperty=function(e,t){var n,r=this,a=t,i=e._private.style,o=r.types,s=r.properties[a.name].type,l=a.bypass,u=i[a.name],c=u&&u.bypass,d=e._private,h="mapping",p=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},f=function(){var t=p(u),n=p(a);r.checkTriggers(e,a.name,t,n)};if(a&&"pie"===a.name.substr(0,3)&&Tt("The pie style properties are deprecated. Create charts using background images instead."),"curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(a=t=this.parse(t.name,"bezier",l)),a.delete)return i[a.name]=void 0,f(),!0;if(a.deleteBypassed)return u?!!u.bypass&&(u.bypassed=void 0,f(),!0):(f(),!0);if(a.deleteBypass)return u?!!u.bypass&&(i[a.name]=u.bypassed,f(),!0):(f(),!0);var g=function(){Tt("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case o.mapData:for(var v,y=a.field.split("."),m=d.data,b=0;b<y.length&&m;b++)m=m[y[b]];if(null==m)return g(),!1;if(!C(m))return Tt("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+m+"` for `"+e.id()+"` is non-numeric)"),!1;var x=a.fieldMax-a.fieldMin;if((v=0===x?0:(m-a.fieldMin)/x)<0?v=0:v>1&&(v=1),s.color){var w=a.valueMin[0],E=a.valueMax[0],k=a.valueMin[1],S=a.valueMax[1],D=a.valueMin[2],T=a.valueMax[2],P=null==a.valueMin[3]?1:a.valueMin[3],_=null==a.valueMax[3]?1:a.valueMax[3],M=[Math.round(w+(E-w)*v),Math.round(k+(S-k)*v),Math.round(D+(T-D)*v),Math.round(P+(_-P)*v)];n={bypass:a.bypass,name:a.name,value:M,strValue:"rgb("+M[0]+", "+M[1]+", "+M[2]+")"}}else{if(!s.number)return!1;var B=a.valueMin+(a.valueMax-a.valueMin)*v;n=this.parse(a.name,B,a.bypass,h)}if(!n)return g(),!1;n.mapping=a,a=n;break;case o.data:for(var N=a.field.split("."),A=d.data,I=0;I<N.length&&A;I++)A=A[N[I]];if(null!=A&&(n=this.parse(a.name,A,a.bypass,h)),!n)return g(),!1;n.mapping=a,a=n;break;case o.fn:var O=a.value,z=null!=a.fnValue?a.fnValue:O(e);if(a.prevFnValue=z,null==z)return Tt("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(n=this.parse(a.name,z,a.bypass,h)))return Tt("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+e.id()+"` is invalid)"),!1;n.mapping=_t(a),a=n;break;case void 0:break;default:return!1}return l?(a.bypassed=c?u.bypassed:u,i[a.name]=a):c?u.bypassed=a:i[a.name]=a,f(),!0},Ku.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),t)for(var a=r._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 r._private.style={}}},Ku.update=function(){this._private.cy.mutableElements().updateStyle()},Ku.updateTransitions=function(e,t){var n=this,r=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 p=h.prev,f=null!=h.next?h.next:d,g=!1,v=void 0,y=1e-6;p&&(C(p.pfValue)&&C(f.pfValue)?(g=f.pfValue-p.pfValue,v=p.pfValue+y*g):C(p.value)&&C(f.value)?(g=f.value-p.value,v=p.value+y*g):w(p.value)&&w(f.value)&&(g=p.value[0]!==f.value[0]||p.value[1]!==f.value[1]||p.value[2]!==f.value[2],v=p.strValue),g&&(s[c]=f.strValue,this.applyBypass(e,c,v),l=!0))}}if(!l)return;r.transitioning=!0,new ja((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(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)},Ku.checkTrigger=function(e,t,n,r,a,i){var o=this.properties[t],s=a(o);null!=s&&s(n,r)&&i(o)},Ku.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){a._private.cy.notify("zorder",e)}))},Ku.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(a){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!a.triggersBoundsOfParallelBeziers||("curve-style"!==t||"bezier"!==n&&"bezier"!==r)&&("display"!==t||"none"!==n&&"none"!==r)||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}))}))},Ku.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var $u={applyBypass:function(e,t,n,r){var a=this,i=[],o=!0;if("*"===t||"**"===t){if(void 0!==n)for(var s=0;s<a.properties.length;s++){var l=a.properties[s].name,u=this.parse(l,n,!0);u&&i.push(u)}}else if(b(t)){var c=this.parse(t,n,!0);c&&i.push(c)}else{if(!E(t))return!1;var d=t;r=n;for(var h=Object.keys(d),p=0;p<h.length;p++){var f=h[p],g=d[f];if(void 0===g&&(g=d[F(f)]),void 0!==g){var v=this.parse(f,g,!0);v&&i.push(v)}}}if(0===i.length)return!1;for(var y=!1,m=0;m<e.length;m++){for(var x=e[m],w={},k=void 0,C=0;C<i.length;C++){var S=i[C];if(r){var D=x.pstyle(S.name);k=w[S.name]={prev:D}}y=this.applyParsedProperty(x,_t(S))||y,r&&(k.next=x.pstyle(S.name))}y&&this.updateStyleHints(x),r&&this.updateTransitions(x,w,o)}return y},overrideBypass:function(e,t,n){t=V(t);for(var r=0;r<e.length;r++){var a=e[r],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=n,null!=i.pfValue&&(i.pfValue=n),i.strValue=s?"rgb("+n.join(",")+")":l?n.join(" "):""+n,this.updateStyleHints(a)):this.applyBypass(a,t,n),this.checkTriggers(a,t,u,n)}},removeAllBypasses:function(e,t){return this.removeBypasses(e,this.propertyNames,t)},removeBypasses:function(e,t,n){for(var r=!0,a=0;a<e.length;a++){for(var i=e[a],o={},s=0;s<t.length;s++){var l=t[s],u=this.properties[l],c=i.pstyle(u.name);if(c&&c.bypass){var d="",h=this.parse(l,d,!0),p=o[u.name]={prev:c};this.applyParsedProperty(i,h),p.next=i.pstyle(u.name)}}this.updateStyleHints(i),n&&this.updateTransitions(i,o,r)}}},Qu={getEmSizeInPixels:function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},containerCss:function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)}},Ju={getRenderedStyle:function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},getRawStyle:function(e,t){var n=this;if(e=e[0]){for(var r={},a=0;a<n.properties.length;a++){var i=n.properties[a],o=n.getStylePropertyValue(e,i.name,t);null!=o&&(r[i.name]=o,r[F(i.name)]=o)}return r}},getIndexedStyle:function(e,t,n,r){var a=e.pstyle(t)[n][r];return null!=a?a:e.cy().style().getDefaultProperty(t)[n][0]},getStylePropertyValue:function(e,t,n){var r=this;if(e=e[0]){var a=r.properties[t];a.alias&&(a=a.pointsTo);var i=a.type,o=e.pstyle(a.name);if(o){var s=o.value,l=o.units,u=o.strValue;if(n&&i.number&&null!=s&&C(s)){var c=e.cy().zoom(),d=function(e){return e*c},h=function(e,t){return d(e)+t},p=w(s);return(p?l.every((function(e){return null!=e})):null!=l)?p?s.map((function(e,t){return h(e,l[t])})).join(" "):h(s,l):p?s.map((function(e){return b(e)?e:""+d(e)})).join(" "):""+d(s)}if(null!=u)return u}return null}},getAnimationStartStyle:function(e,t){for(var n={},r=0;r<t.length;r++){var a=t[r].name,i=e.pstyle(a);void 0!==i&&(i=E(i)?this.parse(a,i.strValue):this.parse(a,i)),i&&(n[a]=i)}return n},getPropsList:function(e){var t=[],n=e,r=this.properties;if(n)for(var a=Object.keys(n),i=0;i<a.length;i++){var o=a[i],s=n[o],l=r[o]||r[V(o)],u=this.parse(l.name,s);u&&t.push(u)}return t},getNonDefaultPropertiesHash:function(e,t,n){var r,a,i,o,s,l,u=n.slice();for(s=0;s<t.length;s++)if(r=t[s],null!=(a=e.pstyle(r,!1)))if(null!=a.pfValue)u[0]=lt(o,u[0]),u[1]=ut(o,u[1]);else for(i=a.strValue,l=0;l<i.length;l++)o=i.charCodeAt(l),u[0]=lt(o,u[0]),u[1]=ut(o,u[1]);return u}};Ju.getPropertiesHash=Ju.getNonDefaultPropertiesHash;var ec={appendFromJson:function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],a=r.selector,i=r.style||r.css,o=Object.keys(i);t.selector(a);for(var s=0;s<o.length;s++){var l=o[s],u=i[l];t.css(l,u)}}return t},fromJson:function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},json:function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,a=n.properties,i={},o=0;o<a.length;o++){var s=a[o];i[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:i})}return e}},tc={appendFromString:function(e){var t,n,r,a=this,i=this,o=""+e;function s(){o=o.length>t.length?o.substr(t.length):""}function l(){n=n.length>r.length?n.substr(r.length):""}for(o=o.replace(/[/][*](\s|.)+?[*][/]/g,"");!o.match(/^\s*$/);){var u=o.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!u){Tt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+o);break}t=u[0];var c=u[1];if("core"!==c&&new Fs(c).invalid)Tt("Skipping parsing of block: Invalid selector found in string stylesheet: "+c),s();else{var d=u[2],h=!1;n=d;for(var p=[];!n.match(/^\s*$/);){var f=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!f){Tt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+d),h=!0;break}r=f[0];var g=f[1],v=f[2];a.properties[g]?i.parse(g,v)?(p.push({name:g,val:v}),l()):(Tt("Skipping property: Invalid property definition in: "+r),l()):(Tt("Skipping property: Invalid property name in: "+r),l())}if(h){s();break}i.selector(c);for(var y=0;y<p.length;y++){var m=p[y];i.css(m.name,m.val)}s()}}return i},fromString:function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t}},nc={};(function(){var e=X,t=W,n=G,r=K,a=U,i=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(i){var o=e+"|\\w+|"+t+"|"+n+"|"+r+"|"+a;return"^"+i+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+o+")\\s*\\,\\s*("+o+")\\)$"},s=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];nc.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},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"]},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},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"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi"]},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"]},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"]},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"]},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:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,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"]},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 b(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\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 l={zeroNonZero:function(e,t){return(null==e||null==t)&&e!==t||0==e&&0!=t||0!=e&&0==t},any:function(e,t){return e!=t},emptyNonEmpty:function(e,t){var n=A(e),r=A(t);return n&&!r||!n&&r}},u=nc.types,c=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],d=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],h=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],p=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],f=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification}],g=[{name:"events",type:u.bool},{name:"text-events",type:u.bool}],v=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfParallelBeziers:!0},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.nonNegativeInt,triggersZOrder:l.any}],y=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any}],m=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any}],x=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],w=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},E=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],k=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle}],C=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],S=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],D=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],T=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],P=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],_=[];nc.pieBackgroundN=16,_.push({name:"pie-size",type:u.sizeMaybePercent});for(var M=1;M<=nc.pieBackgroundN;M++)_.push({name:"pie-"+M+"-background-color",type:u.color}),_.push({name:"pie-"+M+"-background-size",type:u.percent}),_.push({name:"pie-"+M+"-background-opacity",type:u.zeroOneNumber});var B=[],N=nc.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill}].forEach((function(e){N.forEach((function(t){var n=t+"-"+e.name,r=e.type,a=e.triggersBounds;B.push({name:n,type:r,triggersBounds:a})}))}),{});var I=nc.properties=[].concat(g,x,v,y,m,T,f,p,c,d,h,E,k,C,_,S,D,B,P),O=nc.propertyGroups={behavior:g,transition:x,visibility:v,overlay:y,underlay:m,ghost:T,commonLabel:f,labelDimensions:p,mainLabel:c,sourceLabel:d,targetLabel:h,nodeBody:E,nodeBorder:k,backgroundImage:C,pie:_,compound:S,edgeLine:D,edgeArrow:B,core:P},z=nc.propertyGroupNames={};(nc.propertyGroupKeys=Object.keys(O)).forEach((function(e){z[e]=O[e].map((function(e){return e.name})),O[e].forEach((function(t){return t.groupKey=e}))}));var L=nc.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{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"}];nc.propertyNames=I.map((function(e){return e.name}));for(var R=0;R<I.length;R++){var V=I[R];I[V.name]=V}for(var F=0;F<L.length;F++){var j=L[F],q=I[j.pointsTo],Y={name:j.name,alias:!0,pointsTo:q};I.push(Y),I[j.name]=Y}})(),nc.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},nc.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=Q({"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","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","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","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",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","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%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce((function(e,t){for(var n=1;n<=nc.pieBackgroundN;n++){var r=t.name.replace("{{i}}",n),a=t.value;e[r]=a}return e}),{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"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,"taxi-turn":"50%","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"}].reduce((function(e,t){return nc.arrowPrefixes.forEach((function(n){var r=n+"-"+t.name,a=t.value;e[r]=a})),e}),{})),n={},r=0;r<this.properties.length;r++){var a=this.properties[r];if(!a.pointsTo){var i=a.name,o=t[i],s=this.parse(i,o);n[i]=s}}return e.defaultProperties=n,e.defaultProperties},nc.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 rc={parse:function(e,t,n,r){var a=this;if(x(t))return a.parseImplWarn(e,t,n,r);var i,o=gt(e,""+t,n?"t":"f","mapping"===r||!0===r||!1===r||null==r?"dontcare":r),s=a.propCache=a.propCache||[];return(i=s[o])||(i=s[o]=a.parseImplWarn(e,t,n,r)),(n||"mapping"===r)&&(i=_t(i))&&(i.value=_t(i.value)),i},parseImplWarn:function(e,t,n,r){var a=this.parseImpl(e,t,n,r);return a||null==t||Tt("The style property `".concat(e,": ").concat(t,"` is invalid")),!a||"width"!==a.name&&"height"!==a.name||"label"!==t||Tt("The style value of `label` is deprecated for `"+a.name+"`"),a},parseImpl:function(e,t,n,r){var a=this;e=V(e);var i=a.properties[e],o=t,s=a.types;if(!i)return null;if(void 0===t)return null;i.alias&&(i=i.pointsTo,e=i.name);var l=b(t);l&&(t=t.trim());var u,c,d=i.type;if(!d)return null;if(n&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(x(t))return{name:e,value:t,strValue:"fn",mapped:s.fn,bypass:n};if(!l||r||t.length<7||"a"!==t[1]);else{if(t.length>=7&&"d"===t[0]&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var h=s.data;return{name:e,value:u,strValue:""+t,mapped:h,field:u[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(d.multiple)return!1;var p=s.mapData;if(!d.color&&!d.number)return!1;var f=this.parse(e,c[4]);if(!f||f.mapped)return!1;var g=this.parse(e,c[5]);if(!g||g.mapped)return!1;if(f.pfValue===g.pfValue||f.strValue===g.strValue)return Tt("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+f.strValue+"`"),this.parse(e,f.strValue);if(d.color){var v=f.value,y=g.value;if(v[0]===y[0]&&v[1]===y[1]&&v[2]===y[2]&&(v[3]===y[3]||(null==v[3]||1===v[3])&&(null==y[3]||1===y[3])))return!1}return{name:e,value:c,strValue:""+t,mapped:p,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:f.value,valueMax:g.value,bypass:n}}}if(d.multiple&&"multiple"!==r){var m;if(m=l?t.split(/\s+/):w(t)?t:[t],d.evenMultiple&&m.length%2!==0)return null;for(var E=[],k=[],C=[],D="",T=!1,P=0;P<m.length;P++){var _=a.parse(e,m[P],n,"multiple");T=T||b(_.value),E.push(_.value),C.push(null!=_.pfValue?_.pfValue:_.value),k.push(_.units),D+=(P>0?" ":"")+_.strValue}return d.validate&&!d.validate(E,k)?null:d.singleEnum&&T?1===E.length&&b(E[0])?{name:e,value:E[0],strValue:E[0],bypass:n}:null:{name:e,value:E,pfValue:C,strValue:D,bypass:n,units:k}}var M=function(){for(var r=0;r<d.enums.length;r++)if(d.enums[r]===t)return{name:e,value:t,strValue:""+t,bypass:n};return null};if(d.number){var B,N="px";if(d.units&&(B=d.units),d.implicitUnits&&(N=d.implicitUnits),!d.unitless)if(l){var A="px|em"+(d.allowPercent?"|\\%":"");B&&(A=B);var I=t.match("^("+X+")("+A+")?$");I&&(t=I[1],B=I[2]||N)}else B&&!d.implicitUnits||(B=N);if(t=parseFloat(t),isNaN(t)&&void 0===d.enums)return null;if(isNaN(t)&&void 0!==d.enums)return t=o,M();if(d.integer&&!S(t))return null;if(void 0!==d.min&&(t<d.min||d.strictMin&&t===d.min)||void 0!==d.max&&(t>d.max||d.strictMax&&t===d.max))return null;var O={name:e,value:t,strValue:""+t+(B||""),units:B,bypass:n};return d.unitless||"px"!==B&&"em"!==B?O.pfValue=t:O.pfValue="px"!==B&&B?this.getEmSizeInPixels()*t:t,"ms"!==B&&"s"!==B||(O.pfValue="ms"===B?t:1e3*t),"deg"!==B&&"rad"!==B||(O.pfValue="rad"===B?t:mn(t)),"%"===B&&(O.pfValue=t/100),O}if(d.propList){var z=[],L=""+t;if("none"===L);else{for(var R=L.split(/\s*,\s*|\s+/),F=0;F<R.length;F++){var j=R[F].trim();a.properties[j]?z.push(j):Tt("`"+j+"` is not a valid property name")}if(0===z.length)return null}return{name:e,value:z,strValue:0===z.length?"none":z.join(" "),bypass:n}}if(d.color){var q=re(t);return q?{name:e,value:q,pfValue:q,strValue:"rgb("+q[0]+","+q[1]+","+q[2]+")",bypass:n}:null}if(d.regex||d.regexes){if(d.enums){var Y=M();if(Y)return Y}for(var W=d.regexes?d.regexes:[d.regex],H=0;H<W.length;H++){var G=new RegExp(W[H]).exec(t);if(G)return{name:e,value:d.singleRegexMatchValue?G[1]:G,strValue:""+t,bypass:n}}return null}return d.string?{name:e,value:""+t,strValue:""+t,bypass:n}:d.enums?M():null}},ac=function e(t){if(!(this instanceof e))return new e(t);M(t)?(this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()):St("A style must have a core reference")},ic=ac.prototype;ic.instanceString=function(){return"style"},ic.clear=function(){for(var e=this._private,t=e.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach((function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1})),this},ic.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},ic.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},ic.selector=function(e){var t="core"===e?null:new Fs(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},ic.css=function(){var e=this,t=arguments;if(1===t.length)for(var n=t[0],r=0;r<e.properties.length;r++){var a=e.properties[r],i=n[a.name];void 0===i&&(i=n[F(a.name)]),void 0!==i&&this.cssRule(a.name,i)}else 2===t.length&&this.cssRule(t[0],t[1]);return this},ic.style=ic.css,ic.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.mapped&&this[r].mappedProperties.push(n),!this[r].selector&&(this._private.coreStyle[n.name]=n)}return this},ic.append=function(e){return B(e)?e.appendToStyle(this):w(e)?this.appendFromJson(e):b(e)&&this.appendFromString(e),this},ac.fromJson=function(e,t){var n=new ac(e);return n.fromJson(t),n},ac.fromString=function(e,t){return new ac(e).fromString(t)},[Ku,$u,Qu,Ju,ec,tc,nc,rc].forEach((function(e){Q(ic,e)})),ac.types=ic.types,ac.properties=ic.properties,ac.propertyGroups=ic.propertyGroups,ac.propertyGroupNames=ic.propertyGroupNames,ac.propertyGroupKeys=ic.propertyGroupKeys;var oc={style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return B(e)?t.style=e.generateStyle(this):w(e)?t.style=ac.fromJson(this,e):b(e)?t.style=ac.fromString(this,e):t.style=ac(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},sc="single",lc={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=sc),void 0===e?t.selectionType:("additive"!==e&&"single"!==e||(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,n,r,a,i=arguments,o=this._private.pan;switch(i.length){case 0:return o;case 1:if(b(i[0]))return o[e=i[0]];if(E(i[0])){if(!this._private.panningEnabled)return this;r=(n=i[0]).x,a=n.y,C(r)&&(o.x=r),C(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||!C(t)||(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,r,a,i,o,s=arguments,l=this._private.pan;if(!this._private.panningEnabled)return this;switch(s.length){case 1:E(e)&&(i=(a=s[0]).x,o=a.y,C(i)&&(l.x+=i),C(o)&&(l.y+=o),this.emit("pan viewport"));break;case 2:r=t,"x"!==(n=e)&&"y"!==n||!C(r)||(l[n]+=r),this.emit("pan viewport")}return this.notify("viewport"),this},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(C(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n;if(b(e)){var r=e;e=this.$(r)}else if(O(e)){var a=e;(n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1}else T(e)||(e=this.mutableElements());if(!T(e)||!e.empty()){n=n||e.boundingBox();var i,o=this.width(),s=this.height();if(t=C(t)?t:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:i=(i=(i=Math.min((o-2*t)/n.w,(s-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:i)<this._private.minZoom?this._private.minZoom:i,pan:{x:(o-i*(n.x1+n.x2))/2,y:(s-i*(n.y1+n.y2))/2}}}}},zoomRange:function(e,t){var n=this._private;if(null==t){var r=e;e=r.min,t=r.max}return C(e)&&C(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):C(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:C(t)&&void 0===e&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,a=r.pan,i=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),C(e)?n=e:E(e)&&(n=e.level,null!=e.position?t=dn(e.position,i,a):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)<r.minZoom?r.minZoom:n,o||!C(n)||n===i||null!=t&&(!C(t.x)||!C(t.y)))return null;if(null!=t){var s=a,l=i,u=n;return{zoomed:!0,panned:!0,zoom:u,pan:{x:-u/l*(t.x-s.x)+t.x,y:-u/l*(t.y-s.y)+t.y}}}return{zoomed:!0,panned:!1,zoom:n,pan:a}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return null!=t&&t.zoomed?(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this):this},viewport:function(e){var t=this._private,n=!0,r=!0,a=[],i=!1,o=!1;if(!e)return this;if(C(e.zoom)||(n=!1),E(e.pan)||(r=!1),!n&&!r)return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?i=!0:(t.zoom=s,a.push("zoom"))}if(r&&(!i||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;C(l.x)&&(t.pan.x=l.x,o=!1),C(l.y)&&(t.pan.y=l.y,o=!1),o||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(b(e)){var n=e;e=this.mutableElements().filter(n)}else T(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),a=this.width(),i=this.height();return{x:(a-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(i-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?function(){var e=n.window().getComputedStyle(t),r=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-r("padding-left")-r("padding-right"),height:t.clientHeight-r("padding-top")-r("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};lc.centre=lc.center,lc.autolockNodes=lc.autolock,lc.autoungrabifyNodes=lc.autoungrabify;var uc={data:ps.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ps.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ps.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ps.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};uc.attr=uc.data,uc.removeAttr=uc.removeData;var cc=function(e){var t=this,n=(e=Q({},e)).container;n&&!D(n)&&D(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var a=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var i=void 0!==h&&void 0!==n&&!e.headless,o=e;o.layout=Q({name:i?"grid":"null"},o.layout),o.renderer=Q({name:i?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new Cu(this),listeners:[],aniEles:new Cu(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:C(o.zoom)?o.zoom:1,pan:{x:E(o.pan)&&C(o.pan.x)?o.pan.x:0,y:E(o.pan)&&C(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});var u=function(e,t){if(e.some(z))return ja.all(e).then(t);t(e)};l.styleEnabled&&t.setStyle([]);var c=Q({},o,o.renderer);t.initRenderer(c);var d=function(e,n,r){t.notifications(!1);var a=t.mutableElements();a.length>0&&a.remove(),null!=e&&(E(e)||w(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var i=Q({},t._private.options.layout);i.eles=t.elements(),t.layout(i).run()};u([o.style,o.elements],(function(e){var n=e[0],i=e[1];l.styleEnabled&&t.style().append(n),d(i,(function(){t.startAnimationLoop(),l.ready=!0,x(o.ready)&&t.on("ready",o.ready);for(var e=0;e<a.length;e++){var n=a[e];t.on("ready",n)}r&&(r.readies=[]),t.emit("ready")}),o.done)}))},dc=cc.prototype;Q(dc,{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(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},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 h;var e=this._private.container.ownerDocument;return void 0===e||null==e?h:e.defaultView||h},mount:function(e){if(null!=e){var t=this,n=t._private,r=n.options;return!D(e)&&D(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(Q({},r,r.renderer,{name:"null"===r.renderer.name?"canvas":r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return _t(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements(),a=function(e){return t.getElementById(e.id())};if(E(e)){if(t.startBatch(),e.elements){var i={},o=function(e,n){for(var r=[],a=[],o=0;o<e.length;o++){var s=e[o];if(s.data.id){var l=""+s.data.id,u=t.getElementById(l);i[l]=!0,0!==u.length?a.push({ele:u,json:s}):n?(s.group=n,r.push(s)):r.push(s)}else Tt("cy.json() cannot handle elements without an ID attribute")}t.add(r);for(var c=0;c<a.length;c++){var d=a[c],h=d.ele,p=d.json;h.json(p)}};if(w(e.elements))o(e.elements);else for(var s=["nodes","edges"],l=0;l<s.length;l++){var u=s[l],c=e.elements[u];w(c)&&o(c,u)}var d=t.collection();r.filter((function(e){return!i[e.id()]})).forEach((function(e){e.isParent()?d.merge(e):e.remove()})),d.forEach((function(e){return e.children().move({parent:null})})),d.forEach((function(e){return a(e).remove()}))}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x===n.pan.x&&e.pan.y===n.pan.y||t.pan(e.pan)),e.data&&t.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],p=0;p<h.length;p++){var f=h[p];null!=e[f]&&t[f](e[f])}return t.endBatch(),this}var g={};e?g.elements=this.elements().map((function(e){return e.json()})):(g.elements={},r.forEach((function(e){var t=e.group();g.elements[t]||(g.elements[t]=[]),g.elements[t].push(e.json())}))),this._private.styleEnabled&&(g.style=t.style().json()),g.data=_t(t.data());var v=n.options;return g.zoomingEnabled=n.zoomingEnabled,g.userZoomingEnabled=n.userZoomingEnabled,g.zoom=n.zoom,g.minZoom=n.minZoom,g.maxZoom=n.maxZoom,g.panningEnabled=n.panningEnabled,g.userPanningEnabled=n.userPanningEnabled,g.pan=_t(n.pan),g.boxSelectionEnabled=n.boxSelectionEnabled,g.renderer=_t(v.renderer),g.hideEdgesOnViewport=v.hideEdgesOnViewport,g.textureOnViewport=v.textureOnViewport,g.wheelSensitivity=v.wheelSensitivity,g.motionBlur=v.motionBlur,g.multiClickDebounceTime=v.multiClickDebounceTime,g}}),dc.$id=dc.getElementById,[Du,Ru,ju,qu,Xu,Yu,Hu,Gu,oc,lc,uc].forEach((function(e){Q(dc,e)}));var hc={fit:!0,directed:!1,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}},pc={maximal:!1,acyclic:!1},fc=function(e){return e.scratch("breadthfirst")},gc=function(e,t){return e.scratch("breadthfirst",t)};function vc(e){this.options=Q({},hc,pc,e)}vc.prototype.run=function(){var e,t=this.options,n=t,r=t.cy,a=n.eles,i=a.nodes().filter((function(e){return!e.isParent()})),o=a,s=n.directed,l=n.acyclic||n.maximal||n.maximalAdjustments>0,u=_n(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(T(n.roots))e=n.roots;else if(w(n.roots)){for(var c=[],d=0;d<n.roots.length;d++){var h=n.roots[d],p=r.getElementById(h);c.push(p)}e=r.collection(c)}else if(b(n.roots))e=r.$(n.roots);else if(s)e=i.roots();else{var f=a.components();e=r.collection();for(var g=function(t){var n=f[t],r=n.maxDegree(!1),a=n.filter((function(e){return e.degree(!1)===r}));e=e.add(a)},v=0;v<f.length;v++)g(v)}var y=[],m={},x=function(e,t){null==y[t]&&(y[t]=[]);var n=y[t].length;y[t].push(e),gc(e,{index:n,depth:t})},E=function(e,t){var n=fc(e),r=n.depth,a=n.index;y[r][a]=null,x(e,t)};o.bfs({roots:e,directed:n.directed,visit:function(e,t,n,r,a){var i=e[0],o=i.id();x(i,a),m[o]=!0}});for(var k=[],C=0;C<i.length;C++){var S=i[C];m[S.id()]||k.push(S)}var D=function(e){for(var t=y[e],n=0;n<t.length;n++){var r=t[n];null!=r?gc(r,{depth:e,index:n}):(t.splice(n,1),n--)}},P=function(){for(var e=0;e<y.length;e++)D(e)},_=function(e,t){for(var r=fc(e),i=e.incomers().filter((function(e){return e.isNode()&&a.has(e)})),o=-1,s=e.id(),l=0;l<i.length;l++){var u=i[l],c=fc(u);o=Math.max(o,c.depth)}if(r.depth<=o){if(!n.acyclic&&t[s])return null;var d=o+1;return E(e,d),t[s]=d,!0}return!1};if(s&&l){var M=[],B={},N=function(e){return M.push(e)},A=function(){return M.shift()};for(i.forEach((function(e){return M.push(e)}));M.length>0;){var I=A(),O=_(I,B);if(O)I.outgoers().filter((function(e){return e.isNode()&&a.has(e)})).forEach(N);else if(null===O){Tt("Detected double maximal shift for node `"+I.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}P();var z=0;if(n.avoidOverlap)for(var L=0;L<i.length;L++){var R=i[L].layoutDimensions(n),V=R.w,F=R.h;z=Math.max(z,V,F)}var j={},q=function(e){if(j[e.id()])return j[e.id()];for(var t=fc(e).depth,n=e.neighborhood(),r=0,a=0,o=0;o<n.length;o++){var s=n[o];if(!s.isEdge()&&!s.isParent()&&i.has(s)){var l=fc(s);if(null!=l){var u=l.index,c=l.depth;if(null!=u&&null!=c){var d=y[c].length;c<t&&(r+=u/d,a++)}}}}return r/=a=Math.max(1,a),0===a&&(r=0),j[e.id()]=r,r},X=function(e,t){var n=q(e)-q(t);return 0===n?Z(e.id(),t.id()):n};void 0!==n.depthSort&&(X=n.depthSort);for(var Y=0;Y<y.length;Y++)y[Y].sort(X),D(Y);for(var W=[],H=0;H<k.length;H++)W.push(k[H]);y.unshift(W),P();for(var G=0,K=0;K<y.length;K++)G=Math.max(y[K].length,G);var U={x:u.x1+u.w/2,y:u.x1+u.h/2},$=y.reduce((function(e,t){return Math.max(e,t.length)}),0),Q=function(e){var t=fc(e),r=t.depth,a=t.index,i=y[r].length,o=Math.max(u.w/((n.grid?$:i)+1),z),s=Math.max(u.h/(y.length+1),z),l=Math.min(u.w/2/y.length,u.h/2/y.length);if(l=Math.max(l,z),n.circle){var c=l*r+l-(y.length>0&&y[0].length<=3?l/2:0),d=2*Math.PI/y[r].length*a;return 0===r&&1===y[0].length&&(c=1),{x:U.x+c*Math.cos(d),y:U.y+c*Math.sin(d)}}return{x:U.x+(a+1-(i+1)/2)*o,y:(r+1)*s}};return a.nodes().layoutPositions(this,n,Q),this};var yc={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 mc(e){this.options=Q({},yc,e)}mc.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));for(var o,s=_n(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},u=(void 0===t.sweep?2*Math.PI-2*Math.PI/i.length:t.sweep)/Math.max(1,i.length-1),c=0,d=0;d<i.length;d++){var h=i[d].layoutDimensions(t),p=h.w,f=h.h;c=Math.max(c,p,f)}if(o=C(t.radius)?t.radius:i.length<=1?0:Math.min(s.h,s.w)/2-c,i.length>1&&t.avoidOverlap){c*=1.75;var g=Math.cos(u)-Math.cos(0),v=Math.sin(u)-Math.sin(0),y=Math.sqrt(c*c/(g*g+v*v));o=Math.max(y,o)}var m=function(e,n){var r=t.startAngle+n*u*(a?1:-1),i=o*Math.cos(r),s=o*Math.sin(r);return{x:l.x+i,y:l.y+s}};return r.nodes().layoutPositions(this,t,m),this};var bc,xc={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 wc(e){this.options=Q({},xc,e)}wc.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,i=a.nodes().not(":parent"),o=_n(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=[],u=0,c=0;c<i.length;c++){var d=i[c],h=void 0;h=t.concentric(d),l.push({value:h,node:d}),d._private.scratch.concentric=h}i.updateStyle();for(var p=0;p<i.length;p++){var f=i[p].layoutDimensions(t);u=Math.max(u,f.w,f.h)}l.sort((function(e,t){return t.value-e.value}));for(var g=t.levelWidth(i),v=[[]],y=v[0],m=0;m<l.length;m++){var b=l[m];y.length>0&&Math.abs(y[0].value-b.value)>=g&&(y=[],v.push(y)),y.push(b)}var x=u+t.minNodeSpacing;if(!t.avoidOverlap){var w=v.length>0&&v[0].length>1,E=(Math.min(o.w,o.h)/2-x)/(v.length+w?1:0);x=Math.min(x,E)}for(var k=0,C=0;C<v.length;C++){var S=v[C],D=void 0===t.sweep?2*Math.PI-2*Math.PI/S.length:t.sweep,T=S.dTheta=D/Math.max(1,S.length-1);if(S.length>1&&t.avoidOverlap){var P=Math.cos(T)-Math.cos(0),_=Math.sin(T)-Math.sin(0),M=Math.sqrt(x*x/(P*P+_*_));k=Math.max(M,k)}S.r=k,k+=x}if(t.equidistant){for(var B=0,N=0,A=0;A<v.length;A++){var I=v[A].r-N;B=Math.max(B,I)}N=0;for(var O=0;O<v.length;O++){var z=v[O];0===O&&(N=z.r),z.r=N,N+=B}}for(var L={},R=0;R<v.length;R++)for(var V=v[R],F=V.dTheta,j=V.r,q=0;q<V.length;q++){var X=V[q],Y=t.startAngle+(n?1:-1)*F*q,W={x:s.x+j*Math.cos(Y),y:s.y+j*Math.sin(Y)};L[X.node.id()]=W}return a.nodes().layoutPositions(this,t,(function(e){var t=e.id();return L[t]})),this};var Ec={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 kc(e){this.options=Q({},Ec,e),this.options.layout=this}kc.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,!0!==e.animate&&!1!==e.animate||n.emit({type:"layoutstart",layout:n}),bc=!0===e.debug;var r=Sc(t,n,e);bc&&Cc(r),e.randomize&&Pc(r);var a=rt(),i=function(){Mc(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter)&&(Bc(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)i(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var t=e.eles.nodes(),a=_c(r,e,t);t.layoutPositions(n,e,a)}},l=0,u=!0;if(!0===e.animate)!function t(){for(var n=0;u&&n<e.refresh;)u=o(l),l++,n++;u?(rt()-a>=e.animationThreshold&&i(),nt(t)):(Xc(r,e),s())}();else{for(;u;)u=o(l),l++;Xc(r,e),s()}return this},kc.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},kc.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Cc,Sc=function(e,t,n){for(var r=n.eles.edges(),a=n.eles.nodes(),i=_n(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:i.w,clientHeight:i.h,boundingBox:i},s=n.eles.components(),l={},u=0;u<s.length;u++)for(var c=s[u],d=0;d<c.length;d++)l[c[d].id()]=u;for(u=0;u<o.nodeSize;u++){var h=(y=a[u]).layoutDimensions(n);(I={}).isLocked=y.locked(),I.id=y.data("id"),I.parentId=y.data("parent"),I.cmptId=l[y.id()],I.children=[],I.positionX=y.position("x"),I.positionY=y.position("y"),I.offsetX=0,I.offsetY=0,I.height=h.w,I.width=h.h,I.maxX=I.positionX+I.width/2,I.minX=I.positionX-I.width/2,I.maxY=I.positionY+I.height/2,I.minY=I.positionY-I.height/2,I.padLeft=parseFloat(y.style("padding")),I.padRight=parseFloat(y.style("padding")),I.padTop=parseFloat(y.style("padding")),I.padBottom=parseFloat(y.style("padding")),I.nodeRepulsion=x(n.nodeRepulsion)?n.nodeRepulsion(y):n.nodeRepulsion,o.layoutNodes.push(I),o.idToIndex[I.id]=u}var p=[],f=0,g=-1,v=[];for(u=0;u<o.nodeSize;u++){var y,m=(y=o.layoutNodes[u]).parentId;null!=m?o.layoutNodes[o.idToIndex[m]].children.push(y.id):(p[++g]=y.id,v.push(y.id))}for(o.graphSet.push(v);f<=g;){var b=p[f++],w=o.idToIndex[b],E=o.layoutNodes[w].children;if(E.length>0)for(o.graphSet.push(E),u=0;u<E.length;u++)p[++g]=E[u]}for(u=0;u<o.graphSet.length;u++){var k=o.graphSet[u];for(d=0;d<k.length;d++){var C=o.idToIndex[k[d]];o.indexToGraph[C]=u}}for(u=0;u<o.edgeSize;u++){var S=r[u],D={};D.id=S.data("id"),D.sourceId=S.data("source"),D.targetId=S.data("target");var T=x(n.idealEdgeLength)?n.idealEdgeLength(S):n.idealEdgeLength,P=x(n.edgeElasticity)?n.edgeElasticity(S):n.edgeElasticity,_=o.idToIndex[D.sourceId],M=o.idToIndex[D.targetId];if(o.indexToGraph[_]!=o.indexToGraph[M]){for(var B=Dc(D.sourceId,D.targetId,o),N=o.graphSet[B],A=0,I=o.layoutNodes[_];-1===N.indexOf(I.id);)I=o.layoutNodes[o.idToIndex[I.parentId]],A++;for(I=o.layoutNodes[M];-1===N.indexOf(I.id);)I=o.layoutNodes[o.idToIndex[I.parentId]],A++;T*=A*n.nestingFactor}D.idealLength=T,D.elasticity=P,o.layoutEdges.push(D)}return o},Dc=function(e,t,n){var r=Tc(e,t,0,n);return 2>r.count?0:r.graph},Tc=function e(t,n,r,a){var i=a.graphSet[r];if(-1<i.indexOf(t)&&-1<i.indexOf(n))return{count:2,graph:r};for(var o=0,s=0;s<i.length;s++){var l=i[s],u=a.idToIndex[l],c=a.layoutNodes[u].children;if(0!==c.length){var d=e(t,n,a.indexToGraph[a.idToIndex[c[0]]],a);if(0!==d.count){if(1!==d.count)return d;if(2===++o)break}}}return{count:o,graph:r}},Pc=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];0!==i.children.length||i.isLocked||(i.positionX=Math.random()*n,i.positionY=Math.random()*r)}},_c=function(e,t,n){var r=e.boundingBox,a={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach((function(t){var n=e.layoutNodes[e.idToIndex[t.data("id")]];a.x1=Math.min(a.x1,n.positionX),a.x2=Math.max(a.x2,n.positionX),a.y1=Math.min(a.y1,n.positionY),a.y2=Math.max(a.y2,n.positionY)})),a.w=a.x2-a.x1,a.h=a.y2-a.y1),function(n,i){var o=e.layoutNodes[e.idToIndex[n.data("id")]];if(t.boundingBox){var s=(o.positionX-a.x1)/a.w,l=(o.positionY-a.y1)/a.h;return{x:r.x1+s*r.w,y:r.y1+l*r.h}}return{x:o.positionX,y:o.positionY}}},Mc=function(e,t,n){var r=n.layout,a=n.eles.nodes(),i=_c(e,n,a);a.positions(i),!0!==e.ready&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},Bc=function(e,t,n){Nc(e,t),Lc(e),Rc(e,t),Vc(e),Fc(e)},Nc=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],a=r.length,i=0;i<a;i++)for(var o=e.layoutNodes[e.idToIndex[r[i]]],s=i+1;s<a;s++){var l=e.layoutNodes[e.idToIndex[r[s]]];Ic(o,l,e,t)}},Ac=function(e){return-e+2*e*Math.random()},Ic=function(e,t,n,r){if(e.cmptId===t.cmptId||n.isCompound){var a=t.positionX-e.positionX,i=t.positionY-e.positionY,o=1;0===a&&0===i&&(a=Ac(o),i=Ac(o));var s=Oc(e,t,a,i);if(s>0)var l=(c=r.nodeOverlap*s)*a/(v=Math.sqrt(a*a+i*i)),u=c*i/v;else{var c,d=zc(e,a,i),h=zc(t,-1*a,-1*i),p=h.x-d.x,f=h.y-d.y,g=p*p+f*f,v=Math.sqrt(g);l=(c=(e.nodeRepulsion+t.nodeRepulsion)/g)*p/v,u=c*f/v}e.isLocked||(e.offsetX-=l,e.offsetY-=u),t.isLocked||(t.offsetX+=l,t.offsetY+=u)}},Oc=function(e,t,n,r){if(n>0)var a=e.maxX-t.minX;else a=t.maxX-e.minX;if(r>0)var i=e.maxY-t.minY;else i=t.maxY-e.minY;return a>=0&&i>=0?Math.sqrt(a*a+i*i):0},zc=function(e,t,n){var r=e.positionX,a=e.positionY,i=e.height||1,o=e.width||1,s=n/t,l=i/o,u={};return 0===t&&0<n||0===t&&0>n?(u.x=r,u.y=a+i/2,u):0<t&&-1*l<=s&&s<=l?(u.x=r+o/2,u.y=a+o*n/2/t,u):0>t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=a-o*n/2/t,u):0<n&&(s<=-1*l||s>=l)?(u.x=r+i*t/2/n,u.y=a+i/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-i*t/2/n,u.y=a-i/2,u):u},Lc=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],a=e.idToIndex[r.sourceId],i=e.layoutNodes[a],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],l=s.positionX-i.positionX,u=s.positionY-i.positionY;if(0!==l||0!==u){var c=zc(i,l,u),d=zc(s,-1*l,-1*u),h=d.x-c.x,p=d.y-c.y,f=Math.sqrt(h*h+p*p),g=Math.pow(r.idealLength-f,2)/r.elasticity;if(0!==f)var v=g*h/f,y=g*p/f;else v=0,y=0;i.isLocked||(i.offsetX+=v,i.offsetY+=y),s.isLocked||(s.offsetX-=v,s.offsetY-=y)}}},Rc=function(e,t){if(0!==t.gravity)for(var n=1,r=0;r<e.graphSet.length;r++){var a=e.graphSet[r],i=a.length;if(0===r)var o=e.clientHeight/2,s=e.clientWidth/2;else{var l=e.layoutNodes[e.idToIndex[a[0]]],u=e.layoutNodes[e.idToIndex[l.parentId]];o=u.positionX,s=u.positionY}for(var c=0;c<i;c++){var d=e.layoutNodes[e.idToIndex[a[c]]];if(!d.isLocked){var h=o-d.positionX,p=s-d.positionY,f=Math.sqrt(h*h+p*p);if(f>n){var g=t.gravity*h/f,v=t.gravity*p/f;d.offsetX+=g,d.offsetY+=v}}}}},Vc=function(e,t){var n=[],r=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;r<=a;){var i=n[r++],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,n[++a]=l[d]}s.offsetX=0,s.offsetY=0}}},Fc=function(e,t){for(var n=0;n<e.nodeSize;n++)0<(a=e.layoutNodes[n]).children.length&&(a.maxX=void 0,a.minX=void 0,a.maxY=void 0,a.minY=void 0);for(n=0;n<e.nodeSize;n++)if(!(0<(a=e.layoutNodes[n]).children.length||a.isLocked)){var r=jc(a.offsetX,a.offsetY,e.temperature);a.positionX+=r.x,a.positionY+=r.y,a.offsetX=0,a.offsetY=0,a.minX=a.positionX-a.width,a.maxX=a.positionX+a.width,a.minY=a.positionY-a.height,a.maxY=a.positionY+a.height,qc(a,e)}for(n=0;n<e.nodeSize;n++){var a;0<(a=e.layoutNodes[n]).children.length&&!a.isLocked&&(a.positionX=(a.maxX+a.minX)/2,a.positionY=(a.maxY+a.minY)/2,a.width=a.maxX-a.minX,a.height=a.maxY-a.minY)}},jc=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var a={x:n*e/r,y:n*t/r};else a={x:e,y:t};return a},qc=function e(t,n){var r=t.parentId;if(null!=r){var a=n.layoutNodes[n.idToIndex[r]],i=!1;return(null==a.maxX||t.maxX+a.padRight>a.maxX)&&(a.maxX=t.maxX+a.padRight,i=!0),(null==a.minX||t.minX-a.padLeft<a.minX)&&(a.minX=t.minX-a.padLeft,i=!0),(null==a.maxY||t.maxY+a.padBottom>a.maxY)&&(a.maxY=t.maxY+a.padBottom,i=!0),(null==a.minY||t.minY-a.padTop<a.minY)&&(a.minY=t.minY-a.padTop,i=!0),i?e(a,n):void 0}},Xc=function(e,t){for(var n=e.layoutNodes,r=[],a=0;a<n.length;a++){var i=n[a],o=i.cmptId;(r[o]=r[o]||[]).push(i)}var s=0;for(a=0;a<r.length;a++)if(g=r[a]){g.x1=1/0,g.x2=-1/0,g.y1=1/0,g.y2=-1/0;for(var l=0;l<g.length;l++){var u=g[l];g.x1=Math.min(g.x1,u.positionX-u.width/2),g.x2=Math.max(g.x2,u.positionX+u.width/2),g.y1=Math.min(g.y1,u.positionY-u.height/2),g.y2=Math.max(g.y2,u.positionY+u.height/2)}g.w=g.x2-g.x1,g.h=g.y2-g.y1,s+=g.w*g.h}r.sort((function(e,t){return t.w*t.h-e.w*e.h}));var c=0,d=0,h=0,p=0,f=Math.sqrt(s)*e.clientWidth/e.clientHeight;for(a=0;a<r.length;a++){var g;if(g=r[a]){for(l=0;l<g.length;l++)(u=g[l]).isLocked||(u.positionX+=c-g.x1,u.positionY+=d-g.y1);c+=g.w+t.componentSpacing,h+=g.w+t.componentSpacing,p=Math.max(p,g.h),h>f&&(d+=p+t.componentSpacing,c=0,h=0,p=0)}}},Yc={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 Wc(e){this.options=Q({},Yc,e)}Wc.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var i=_n(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===i.h||0===i.w)r.nodes().layoutPositions(this,t,(function(e){return{x:i.x1,y:i.y1}}));else{var o=a.size(),s=Math.sqrt(o*i.h/i.w),l=Math.round(s),u=Math.round(i.w/i.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},d=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},h=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=p)l=h,u=p;else if(null!=h&&null==p)l=h,u=Math.ceil(o/l);else if(null==h&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var f=c(),g=d();(f-1)*g>=o?c(f-1):(g-1)*f>=o&&d(g-1)}else for(;u*l<o;){var v=c(),y=d();(y+1)*v>=o?d(y+1):c(v+1)}var m=i.w/u,b=i.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x<a.length;x++){var w=a[x],E=w._private.position;null!=E.x&&null!=E.y||(E.x=0,E.y=0);var k=w.layoutDimensions(t),C=t.avoidOverlapPadding,S=k.w+C,D=k.h+C;m=Math.max(m,S),b=Math.max(b,D)}for(var T={},P=function(e,t){return!!T["c-"+e+"-"+t]},_=function(e,t){T["c-"+e+"-"+t]=!0},M=0,B=0,N=function(){++B>=u&&(B=0,M++)},A={},I=0;I<a.length;I++){var O=a[I],z=t.position(O);if(z&&(void 0!==z.row||void 0!==z.col)){var L={row:z.row,col:z.col};if(void 0===L.col)for(L.col=0;P(L.row,L.col);)L.col++;else if(void 0===L.row)for(L.row=0;P(L.row,L.col);)L.row++;A[O.id()]=L,_(L.row,L.col)}}var R=function(e,t){var n,r;if(e.locked()||e.isParent())return!1;var a=A[e.id()];if(a)n=a.col*m+m/2+i.x1,r=a.row*b+b/2+i.y1;else{for(;P(M,B);)N();n=B*m+m/2+i.x1,r=M*b+b/2+i.y1,_(M,B),N()}return{x:n,y:r}};a.layoutPositions(this,t,R)}return this};var Hc={ready:function(){},stop:function(){}};function Gc(e){this.options=Q({},Hc,e)}Gc.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit("layoutstart"),t.nodes().positions((function(){return{x:0,y:0}})),n.one("layoutready",e.ready),n.emit("layoutready"),n.one("layoutstop",e.stop),n.emit("layoutstop"),this},Gc.prototype.stop=function(){return this};var Kc={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,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 Uc(e){this.options=Q({},Kc,e)}Uc.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=x(e.positions);function r(t){if(null==e.positions)return cn(t.position());if(n)return e.positions(t);var r=e.positions[t._private.data.id];return null==r?null:r}return t.layoutPositions(this,e,(function(e,t){var n=r(e);return!e.locked()&&null!=n&&n})),this};var Zc={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 $c(e){this.options=Q({},Zc,e)}$c.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=_n(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),a=function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}};return n.nodes().layoutPositions(this,e,a),this};var Qc=[{name:"breadthfirst",impl:vc},{name:"circle",impl:mc},{name:"concentric",impl:wc},{name:"cose",impl:kc},{name:"grid",impl:Wc},{name:"null",impl:Gc},{name:"preset",impl:Uc},{name:"random",impl:$c}];function Jc(e){this.options=e,this.notifications=0}var ed=function(){},td=function(){throw new Error("A headless instance can not render images")};Jc.prototype={recalculateRenderedStyle:ed,notify:function(){this.notifications++},init:ed,isHeadless:function(){return!0},png:td,jpg:td};var nd={arrowShapeWidth:.3,registerArrowShapes:function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,a,i,o){var s=a.x-n/2-o,l=a.x+n/2+o,u=a.y-n/2-o,c=a.y+n/2+o;return s<=e&&e<=l&&u<=t&&t<=c},r=function(e,t,n,r,a){var i=e*Math.cos(r)-t*Math.sin(r),o=(e*Math.sin(r)+t*Math.cos(r))*n;return{x:i*n+a.x,y:o+a.y}},a=function(e,t,n,a){for(var i=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];i.push(r(s,l,t,n,a))}return i},i=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},s=function(r,s){b(s)&&(s=e[s]),e[r]=Q({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){var l=i(a(this.points,n+2*s,r,o));return Kn(e,t,l)},roughCollide:n,draw:function(e,n,r,i){var o=a(this.points,n,r,i);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:Et,roughCollide:Et,draw:Ct,spacing:kt,gap:kt}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,i,o,s){var l=a(this.points,n,i,o),u=this.controlPoint,c=r(u[0],u[1],n,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,n,r,o,s,l){var u=i(a(this.points,n+2*l,r,o)),c=i(a(this.pointsTee,n+2*l,r,o));return Kn(e,t,u)||Kn(e,t,c)},draw:function(e,n,r,i,o){var s=a(this.points,n,r,i),l=a(this.pointsTee,n,r,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,n,r,o,s,l){var u=o,c=Math.pow(u.x-e,2)+Math.pow(u.y-t,2)<=Math.pow((n+2*l)*this.radius,2),d=i(a(this.points,n+2*l,r,o));return Kn(e,t,d)||c},draw:function(e,n,r,i,o){var s=a(this.pointsTr,n,r,i);t.arrowShapeImpl(this.name)(e,s,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),r=t/e,a=3,i=5;return n[a]=n[a]-r,n[i]=n[i]-r,n},collide:function(e,t,n,r,o,s,l){var u=i(a(this.points,n+2*l,r,o)),c=i(a(this.crossLinePts(n,s),n+2*l,r,o));return Kn(e,t,u)||Kn(e,t,c)},draw:function(e,n,r,i,o){var s=a(this.points,n,r,i),l=a(this.crossLinePts(n,o),n,r,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,n,r,a,i,o){var s=a;return Math.pow(s.x-e,2)+Math.pow(s.y-t,2)<=Math.pow((n+2*o)*this.radius,2)},draw:function(e,n,r,a,i){t.arrowShapeImpl(this.name)(e,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("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}})}},rd={projectIntoViewport:function(e,t){var n=this.cy,r=this.findContainerClientCoords(),a=r[0],i=r[1],o=r[4],s=n.pan(),l=n.zoom();return[((e-a)/o-s.x)/l,((t-i)/o-s.y)/l]},findContainerClientCoords:function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},a={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},i={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},o=e.clientWidth,s=e.clientHeight,l=a.left+a.right,u=a.top+a.bottom,c=i.left+i.right,d=t.width/(o+c),h=o-l,p=s-u,f=t.left+a.left+i.left,g=t.top+a.top+i.top;return this.containerBB=[f,g,h,p,d]},invalidateContainerClientCoordsCache:function(){this.containerBB=null},findNearestElement:function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},findNearestElements:function(e,t,n,r){var a,i,o=this,s=this,l=s.getCachedZSortedEles(),u=[],c=s.cy.zoom(),d=s.cy.hasCompoundNodes(),h=(r?24:8)/c,p=(r?8:2)/c,f=(r?8:2)/c,g=1/0;function v(e,t){if(e.isNode()){if(i)return;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 n=0;n<u.length;n++)if(u[n].isEdge()){u[n]=e,a=e,g=null!=t?t:g;break}}else u.push(e),a=e,g=null!=t?t:g}function y(n){var r=n.outerWidth()+2*p,a=n.outerHeight()+2*p,i=r/2,l=a/2,u=n.position();if(u.x-i<=e&&e<=u.x+i&&u.y-l<=t&&t<=u.y+l&&s.nodeShapes[o.getNodeShape(n)].checkPoint(e,t,0,r,a,u.x,u.y))return v(n,0),!0}function m(n){var r,a=n._private,i=a.rscratch,l=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,p=l/2+h,f=p*p,g=2*p,m=a.source,b=a.target;if("segments"===i.edgeType||"straight"===i.edgeType||"haystack"===i.edgeType){for(var x=i.allpts,w=0;w+3<x.length;w+=2)if(qn(e,t,x[w],x[w+1],x[w+2],x[w+3],g)&&f>(r=Gn(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===i.edgeType||"multibezier"===i.edgeType||"self"===i.edgeType||"compound"===i.edgeType)for(x=i.allpts,w=0;w+5<i.allpts.length;w+=4)if(Xn(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5],g)&&f>(r=Hn(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||a.source,b=b||a.target;var E=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}];for(w=0;w<k.length;w++){var C=k[w],S=s.arrowShapes[n.pstyle(C.name+"-arrow-shape").value],D=n.pstyle("width").pfValue;if(S.roughCollide(e,t,E,C.angle,{x:C.x,y:C.y},D,h)&&S.collide(e,t,E,C.angle,{x:C.x,y:C.y},D,h))return v(n),!0}d&&u.length>0&&(y(m),y(b))}function b(e,t,n){return Rt(e,t,n)}function x(n,r){var a,i=n._private,o=f;a=r?r+"-":"",n.boundingBox();var s=i.labelBounds[r||"main"],l=n.pstyle(a+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(i.rscratch,"labelX",r),c=b(i.rscratch,"labelY",r),d=b(i.rscratch,"labelAngle",r),h=n.pstyle(a+"text-margin-x").pfValue,p=n.pstyle(a+"text-margin-y").pfValue,g=s.x1-o-h,y=s.x2+o-h,m=s.y1-o-p,x=s.y2+o-p;if(d){var w=Math.cos(d),E=Math.sin(d),k=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},C=k(g,m),S=k(g,x),D=k(y,m),T=k(y,x),P=[C.x+h,C.y+p,D.x+h,D.y+p,T.x+h,T.y+p,S.x+h,S.y+p];if(Kn(e,t,P))return v(n),!0}else if(Rn(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var a=this.getCachedZSortedEles().interactive,i=[],o=Math.min(e,n),s=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r),c=_n({x1:e=o,y1:t=l,x2:n=s,y2:r=u}),d=0;d<a.length;d++){var h=a[d];if(h.isNode()){var p=h,f=p.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});Ln(c,f)&&!Fn(f,c)&&i.push(p)}else{var g=h,v=g._private,y=v.rscratch;if(null!=y.startX&&null!=y.startY&&!Rn(c,y.startX,y.startY))continue;if(null!=y.endX&&null!=y.endY&&!Rn(c,y.endX,y.endY))continue;if("bezier"===y.edgeType||"multibezier"===y.edgeType||"self"===y.edgeType||"compound"===y.edgeType||"segments"===y.edgeType||"haystack"===y.edgeType){for(var m=v.rstyle.bezierPts||v.rstyle.linePts||v.rstyle.haystackPts,b=!0,x=0;x<m.length;x++)if(!Vn(c,m[x])){b=!1;break}b&&i.push(g)}else"haystack"!==y.edgeType&&"straight"!==y.edgeType||i.push(g)}}return i}},ad={calculateArrowAngles:function(e){var t,n,r,a,i,o,s=e._private.rscratch,l="haystack"===s.edgeType,u="bezier"===s.edgeType,c="multibezier"===s.edgeType,d="segments"===s.edgeType,h="compound"===s.edgeType,p="self"===s.edgeType;if(l?(r=s.haystackPts[0],a=s.haystackPts[1],i=s.haystackPts[2],o=s.haystackPts[3]):(r=s.arrowStartX,a=s.arrowStartY,i=s.arrowEndX,o=s.arrowEndY),g=s.midX,v=s.midY,d)t=r-s.segpts[0],n=a-s.segpts[1];else if(c||h||p||u){var f=s.allpts;t=r-Sn(f[0],f[2],f[4],.1),n=a-Sn(f[1],f[3],f[5],.1)}else t=r-g,n=a-v;s.srcArrowAngle=bn(t,n);var g=s.midX,v=s.midY;if(l&&(g=(r+i)/2,v=(a+o)/2),t=i-r,n=o-a,d)if((f=s.allpts).length/2%2===0){var y=(m=f.length/2)-2;t=f[m]-f[y],n=f[m+1]-f[y+1]}else{y=(m=f.length/2-1)-2;var m,b=m+2;t=f[m]-f[y],n=f[m+1]-f[y+1]}else if(c||h||p){var x,w,E,k,f=s.allpts;if(s.ctrlpts.length/2%2===0){var C=2+(S=2+(D=f.length/2-1));x=Sn(f[D],f[S],f[C],0),w=Sn(f[D+1],f[S+1],f[C+1],0),E=Sn(f[D],f[S],f[C],1e-4),k=Sn(f[D+1],f[S+1],f[C+1],1e-4)}else{var S,D;C=2+(S=f.length/2-1),x=Sn(f[D=S-2],f[S],f[C],.4999),w=Sn(f[D+1],f[S+1],f[C+1],.4999),E=Sn(f[D],f[S],f[C],.5),k=Sn(f[D+1],f[S+1],f[C+1],.5)}t=E-x,n=k-w}if(s.midtgtArrowAngle=bn(t,n),s.midDispX=t,s.midDispY=n,t*=-1,n*=-1,d&&((f=s.allpts).length/2%2===0||(t=-(f[b=2+(m=f.length/2-1)]-f[m]),n=-(f[b+1]-f[m+1]))),s.midsrcArrowAngle=bn(t,n),d)t=i-s.segpts[s.segpts.length-2],n=o-s.segpts[s.segpts.length-1];else if(c||h||p||u){var T=(f=s.allpts).length;t=i-Sn(f[T-6],f[T-4],f[T-2],.9),n=o-Sn(f[T-5],f[T-3],f[T-1],.9)}else t=i-g,n=o-v;s.tgtArrowAngle=bn(t,n)}};ad.getArrowWidth=ad.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(13.37*e,.9),29)*t,n[e+", "+t]=r,r)};var id={};function od(e){var t=[];if(null!=e){for(var n=0;n<e.length;n+=2){var r=e[n],a=e[n+1];t.push({x:r,y:a})}return t}}id.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,a=r.rscratch;if(!a.haystack){var i=2*Math.random()*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=2*Math.random()*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var o=r.source,s=r.target,l=o.position(),u=s.position(),c=o.width(),d=s.width(),h=o.height(),p=s.height(),f=n.pstyle("haystack-radius").value/2;a.haystackPts=a.allpts=[a.source.x*c*f+l.x,a.source.y*h*f+l.y,a.target.x*d*f+u.x,a.target.y*p*f+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(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},id.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=t.posPts,a=t.intersectionPts,i=t.vectorNormInverse,o=e.pstyle("edge-distances").value,s=e.pstyle("segment-weights"),l=e.pstyle("segment-distances"),u=Math.min(s.pfValue.length,l.pfValue.length);n.edgeType="segments",n.segpts=[];for(var c=0;c<u;c++){var d=s.pfValue[c],h=l.pfValue[c],p=1-d,f=d,g="node-position"===o?r:a,v={x:g.x1*p+g.x2*f,y:g.y1*p+g.y2*f};n.segpts.push(v.x+i.x*h,v.y+i.y*h)}},id.findLoopPoints=function(e,t,n,r){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=n,p=d;r&&(h=0,p=l);var f=u-Math.PI/2,g=f-c/2,v=f+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)*p*(h/3+1),o.y+1.4*Math.sin(g)*p*(h/3+1),o.x+1.4*Math.cos(v)*p*(h/3+1),o.y+1.4*Math.sin(v)*p*(h/3+1)]},id.findCompoundLoopPoints=function(e,t,n,r){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"),p=h?h.pfValue[0]:void 0,f=n,g=d;r&&(f=0,g=p);var v=50,y={x:i.x-s/2,y:i.y-l/2},m={x:o.x-u/2,y:o.y-c/2},b={x:Math.min(y.x,m.x),y:Math.min(y.y,m.y)},x=.5,w=Math.max(x,Math.log(.01*s)),E=Math.max(x,Math.log(.01*u));a.ctrlpts=[b.x,b.y-(1+Math.pow(v,1.12)/100)*g*(f/3+1)*w,b.x-(1+Math.pow(v,1.12)/100)*g*(f/3+1)*E,b.y]},id.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},id.findBezierPoints=function(e,t,n,r,a){var i=e._private.rscratch,o=t.vectorNormInverse,s=t.posPts,l=t.intersectionPts,u=e.pstyle("edge-distances").value,c=e.pstyle("control-point-step-size").pfValue,d=e.pstyle("control-point-distances"),h=e.pstyle("control-point-weights"),p=d&&h?Math.min(d.value.length,h.value.length):1,f=d?d.pfValue[0]:void 0,g=h.value[0],v=r;i.edgeType=v?"multibezier":"bezier",i.ctrlpts=[];for(var y=0;y<p;y++){var m=(.5-t.eles.length/2+n)*c*(a?-1:1),b=void 0,x=wn(m);v&&(f=d?d.pfValue[y]:c,g=h.value[y]);var w=void 0!==(b=r?f:void 0!==f?x*f:void 0)?b:m,E=1-g,k=g,C="node-position"===u?s:l,S={x:C.x1*E+C.x2*k,y:C.y1*E+C.y2*k};i.ctrlpts.push(S.x+o.x*w,S.y+o.y*w)}},id.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r="vertical",a="horizontal",i="leftward",o="rightward",s="downward",l="upward",u="auto",c=t.posPts,d=t.srcW,h=t.srcH,p=t.tgtW,f=t.tgtH,g="node-position"!==e.pstyle("edge-distances").value,v=e.pstyle("taxi-direction").value,y=v,m=e.pstyle("taxi-turn"),b="%"===m.units,x=m.pfValue,w=x<0,E=e.pstyle("taxi-turn-min-distance").pfValue,k=g?(d+p)/2:0,C=g?(h+f)/2:0,S=c.x2-c.x1,D=c.y2-c.y1,T=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},P=T(S,k),_=T(D,C),M=!1;y===u?v=Math.abs(P)>Math.abs(_)?a:r:y===l||y===s?(v=r,M=!0):y!==i&&y!==o||(v=a,M=!0);var B,N=v===r,A=N?_:P,I=N?D:S,O=wn(I),z=!1;M&&(b||w)||!(y===s&&I<0||y===l&&I>0||y===i&&I>0||y===o&&I<0)||(A=(O*=-1)*Math.abs(A),z=!0);var L=function(e){return Math.abs(e)<E||Math.abs(e)>=Math.abs(A)},R=L(B=b?(x<0?1+x:x)*A:(x<0?A:0)+x*O),V=L(Math.abs(A)-Math.abs(B));if(!R&&!V||z)if(N){var F=c.y1+B+(g?h/2*O:0),j=c.x1,q=c.x2;n.segpts=[j,F,q,F]}else{var X=c.x1+B+(g?d/2*O:0),Y=c.y1,W=c.y2;n.segpts=[X,Y,X,W]}else if(N){var H=Math.abs(I)<=h/2,G=Math.abs(S)<=p/2;if(H){var K=(c.x1+c.x2)/2,U=c.y1,Z=c.y2;n.segpts=[K,U,K,Z]}else if(G){var $=(c.y1+c.y2)/2,Q=c.x1,J=c.x2;n.segpts=[Q,$,J,$]}else n.segpts=[c.x1,c.y2]}else{var ee=Math.abs(I)<=d/2,te=Math.abs(D)<=f/2;if(ee){var ne=(c.y1+c.y2)/2,re=c.x1,ae=c.x2;n.segpts=[re,ne,ae,ne]}else if(te){var ie=(c.x1+c.x2)/2,oe=c.y1,se=c.y2;n.segpts=[ie,oe,ie,se]}else n.segpts=[c.x2,c.y1]}},id.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,a=t.tgtPos,i=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=!C(n.startX)||!C(n.startY),h=!C(n.arrowStartX)||!C(n.arrowStartY),p=!C(n.endX)||!C(n.endY),f=!C(n.arrowEndX)||!C(n.arrowEndY),g=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth*3,v=En({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),y=v<g,m=En({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),b=m<g,x=!1;if(d||h||y){x=!0;var w={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},E=Math.sqrt(w.x*w.x+w.y*w.y),k={x:w.x/E,y:w.y/E},S=Math.max(i,o),D={x:n.ctrlpts[0]+2*k.x*S,y:n.ctrlpts[1]+2*k.y*S},T=u.intersectLine(r.x,r.y,i,o,D.x,D.y,0);y?(n.ctrlpts[0]=n.ctrlpts[0]+k.x*(g-v),n.ctrlpts[1]=n.ctrlpts[1]+k.y*(g-v)):(n.ctrlpts[0]=T[0]+k.x*g,n.ctrlpts[1]=T[1]+k.y*g)}if(p||f||b){x=!0;var P={x:n.ctrlpts[0]-a.x,y:n.ctrlpts[1]-a.y},_=Math.sqrt(P.x*P.x+P.y*P.y),M={x:P.x/_,y:P.y/_},B=Math.max(i,o),N={x:n.ctrlpts[0]+2*M.x*B,y:n.ctrlpts[1]+2*M.y*B},A=c.intersectLine(a.x,a.y,s,l,N.x,N.y,0);b?(n.ctrlpts[0]=n.ctrlpts[0]+M.x*(g-m),n.ctrlpts[1]=n.ctrlpts[1]+M.y*(g-m)):(n.ctrlpts[0]=A[0]+M.x*g,n.ctrlpts[1]=A[1]+M.y*g)}x&&this.findEndpoints(e)}},id.storeAllpts=function(e){var t=e._private.rscratch;if("multibezier"===t.edgeType||"bezier"===t.edgeType||"self"===t.edgeType||"compound"===t.edgeType){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=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);var r,a;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,a=.5,t.midX=Sn(t.allpts[r],t.allpts[r+2],t.allpts[r+4],a),t.midY=Sn(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],a))}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.segpts.length%4===0){var i=t.segpts.length/2,o=i-2;t.midX=(t.segpts[o]+t.segpts[i])/2,t.midY=(t.segpts[o+1]+t.segpts[i+1])/2}else{var s=t.segpts.length/2-1;t.midX=t.segpts[s],t.midY=t.segpts[s+1]}},id.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||C(t.startX)&&C(t.startY)&&C(t.endX)&&C(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,Tt("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."))},id.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var n=this,r=n.cy.hasCompoundNodes(),a={map:new jt,get:function(e){var t=this.map.get(e[0]);return null!=t?t.get(e[1]):null},set:function(e,t){var n=this.map.get(e[0]);null==n&&(n=new jt,this.map.set(e[0],n)),n.set(e[1],t)}},i=[],o=[],s=0;s<e.length;s++){var l=e[s],u=l._private,c=l.pstyle("curve-style").value;if(!l.removed()&&l.takesUpSpace())if("haystack"!==c){var d="unbundled-bezier"===c||"segments"===c||"straight"===c||"straight-triangle"===c||"taxi"===c,h="unbundled-bezier"===c||"bezier"===c,p=u.source,f=u.target,g=[p.poolIndex(),f.poolIndex()].sort(),v=a.get(g);null==v&&(v={eles:[]},a.set(g,v),i.push(g)),v.eles.push(l),d&&(v.hasUnbundled=!0),h&&(v.hasBezier=!0)}else o.push(l)}for(var y=function(e){var o=i[e],s=a.get(o),l=void 0;if(!s.hasUnbundled){var u=s.eles[0].parallelEdges().filter((function(e){return e.isBundledBezier()}));zt(s.eles),u.forEach((function(e){return s.eles.push(e)})),s.eles.sort((function(e,t){return e.poolIndex()-t.poolIndex()}))}var c=s.eles[0],d=c.source(),h=c.target();if(d.poolIndex()>h.poolIndex()){var p=d;d=h,h=p}var f=s.srcPos=d.position(),g=s.tgtPos=h.position(),v=s.srcW=d.outerWidth(),y=s.srcH=d.outerHeight(),m=s.tgtW=h.outerWidth(),b=s.tgtH=h.outerHeight(),x=s.srcShape=n.nodeShapes[t.getNodeShape(d)],w=s.tgtShape=n.nodeShapes[t.getNodeShape(h)];s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var E=0;E<s.eles.length;E++){var k=s.eles[E],S=k[0]._private.rscratch,D=k.pstyle("curve-style").value,T="unbundled-bezier"===D||"segments"===D||"taxi"===D,P=!d.same(k.source());if(!s.calculatedIntersection&&d!==h&&(s.hasBezier||s.hasUnbundled)){s.calculatedIntersection=!0;var _=x.intersectLine(f.x,f.y,v,y,g.x,g.y,0),M=s.srcIntn=_,B=w.intersectLine(g.x,g.y,m,b,f.x,f.y,0),N=s.tgtIntn=B,A=s.intersectionPts={x1:_[0],x2:B[0],y1:_[1],y2:B[1]},I=s.posPts={x1:f.x,x2:g.x,y1:f.y,y2:g.y},O=B[1]-_[1],z=B[0]-_[0],L=Math.sqrt(z*z+O*O),R=s.vector={x:z,y:O},V=s.vectorNorm={x:R.x/L,y:R.y/L},F={x:-V.y,y:V.x};s.nodesOverlap=!C(L)||w.checkPoint(_[0],_[1],0,m,b,g.x,g.y)||x.checkPoint(B[0],B[1],0,v,y,f.x,f.y),s.vectorNormInverse=F,l={nodesOverlap:s.nodesOverlap,dirCounts:s.dirCounts,calculatedIntersection:!0,hasBezier:s.hasBezier,hasUnbundled:s.hasUnbundled,eles:s.eles,srcPos:g,tgtPos:f,srcW:m,srcH:b,tgtW:v,tgtH:y,srcIntn:N,tgtIntn:M,srcShape:w,tgtShape:x,posPts:{x1:I.x2,y1:I.y2,x2:I.x1,y2:I.y1},intersectionPts:{x1:A.x2,y1:A.y2,x2:A.x1,y2:A.y1},vector:{x:-R.x,y:-R.y},vectorNorm:{x:-V.x,y:-V.y},vectorNormInverse:{x:-F.x,y:-F.y}}}var j=P?l:s;S.nodesOverlap=j.nodesOverlap,S.srcIntn=j.srcIntn,S.tgtIntn=j.tgtIntn,r&&(d.isParent()||d.isChild()||h.isParent()||h.isChild())&&(d.parents().anySame(h)||h.parents().anySame(d)||d.same(h)&&d.isParent())?t.findCompoundLoopPoints(k,j,E,T):d===h?t.findLoopPoints(k,j,E,T):"segments"===D?t.findSegmentsPoints(k,j):"taxi"===D?t.findTaxiPoints(k,j):"straight"===D||!T&&s.eles.length%2===1&&E===Math.floor(s.eles.length/2)?t.findStraightEdgePoints(k):t.findBezierPoints(k,j,E,T,P),t.findEndpoints(k),t.tryToCorrectInvalidPoints(k,j),t.checkForInvalidEdgeWarning(k),t.storeAllpts(k),t.storeEdgeProjections(k),t.calculateArrowAngles(k),t.recalculateEdgeLabelProjections(k),t.calculateLabelAngles(k)}},m=0;m<i.length;m++)y(m);this.findHaystackPoints(o)}},id.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if("segments"===t.edgeType)return this.recalculateRenderedStyle(e),od(t.segpts)},id.getControlPoints=function(e){var t=e[0]._private.rscratch,n=t.edgeType;if("bezier"===n||"multibezier"===n||"self"===n||"compound"===n)return this.recalculateRenderedStyle(e),od(t.ctrlpts)},id.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var sd={manualEndptToPx:function(e,t){var n=this,r=e.position(),a=e.outerWidth(),i=e.outerHeight();if(2===t.value.length){var o=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(o[0]=o[0]*a),"%"===t.units[1]&&(o[1]=o[1]*i),o[0]+=r.x,o[1]+=r.y,o}var s=t.pfValue[0];s=-Math.PI/2+s;var l=2*Math.max(a,i),u=[r.x+Math.cos(s)*l,r.y+Math.sin(s)*l];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,a,i,u[0],u[1],0)},findEndpoints:function(e){var t,n,r,a,i,o=this,s=e.source()[0],l=e.target()[0],u=s.position(),c=l.position(),d=e.pstyle("target-arrow-shape").value,h=e.pstyle("source-arrow-shape").value,p=e.pstyle("target-distance-from-node").pfValue,f=e.pstyle("source-distance-from-node").pfValue,g=e.pstyle("curve-style").value,v=e._private.rscratch,y=v.edgeType,m="self"===y||"compound"===y,b="bezier"===y||"multibezier"===y||m,x="bezier"!==y,w="straight"===y||"segments"===y,E="segments"===y,k=b||x||w,S=m||"taxi"===g,D=e.pstyle("source-endpoint"),T=S?"outside-to-node":D.value,P=e.pstyle("target-endpoint"),_=S?"outside-to-node":P.value;if(v.srcManEndpt=D,v.tgtManEndpt=P,b){var M=[v.ctrlpts[0],v.ctrlpts[1]];n=x?[v.ctrlpts[v.ctrlpts.length-2],v.ctrlpts[v.ctrlpts.length-1]]:M,r=M}else if(w){var B=E?v.segpts.slice(0,2):[c.x,c.y];n=E?v.segpts.slice(v.segpts.length-2):[u.x,u.y],r=B}if("inside-to-node"===_)t=[c.x,c.y];else if(P.units)t=this.manualEndptToPx(l,P);else if("outside-to-line"===_)t=v.tgtIntn;else if("outside-to-node"===_||"outside-to-node-or-label"===_?a=n:"outside-to-line"!==_&&"outside-to-line-or-label"!==_||(a=[u.x,u.y]),t=o.nodeShapes[this.getNodeShape(l)].intersectLine(c.x,c.y,l.outerWidth(),l.outerHeight(),a[0],a[1],0),"outside-to-node-or-label"===_||"outside-to-line-or-label"===_){var N=l._private.rscratch,A=N.labelWidth,I=N.labelHeight,O=N.labelX,z=N.labelY,L=A/2,R=I/2,V=l.pstyle("text-valign").value;"top"===V?z-=R:"bottom"===V&&(z+=R);var F=l.pstyle("text-halign").value;"left"===F?O-=L:"right"===F&&(O+=L);var j=ar(a[0],a[1],[O-L,z-R,O+L,z-R,O+L,z+R,O-L,z+R],c.x,c.y);if(j.length>0){var q=u,X=kn(q,pn(t)),Y=kn(q,pn(j)),W=X;Y<X&&(t=j,W=Y),j.length>2&&kn(q,{x:j[2],y:j[3]})<W&&(t=[j[2],j[3]])}}var H=or(t,n,o.arrowShapes[d].spacing(e)+p),G=or(t,n,o.arrowShapes[d].gap(e)+p);if(v.endX=G[0],v.endY=G[1],v.arrowEndX=H[0],v.arrowEndY=H[1],"inside-to-node"===T)t=[u.x,u.y];else if(D.units)t=this.manualEndptToPx(s,D);else if("outside-to-line"===T)t=v.srcIntn;else if("outside-to-node"===T||"outside-to-node-or-label"===T?i=r:"outside-to-line"!==T&&"outside-to-line-or-label"!==T||(i=[c.x,c.y]),t=o.nodeShapes[this.getNodeShape(s)].intersectLine(u.x,u.y,s.outerWidth(),s.outerHeight(),i[0],i[1],0),"outside-to-node-or-label"===T||"outside-to-line-or-label"===T){var K=s._private.rscratch,U=K.labelWidth,Z=K.labelHeight,$=K.labelX,Q=K.labelY,J=U/2,ee=Z/2,te=s.pstyle("text-valign").value;"top"===te?Q-=ee:"bottom"===te&&(Q+=ee);var ne=s.pstyle("text-halign").value;"left"===ne?$-=J:"right"===ne&&($+=J);var re=ar(i[0],i[1],[$-J,Q-ee,$+J,Q-ee,$+J,Q+ee,$-J,Q+ee],u.x,u.y);if(re.length>0){var ae=c,ie=kn(ae,pn(t)),oe=kn(ae,pn(re)),se=ie;oe<ie&&(t=[re[0],re[1]],se=oe),re.length>2&&kn(ae,{x:re[2],y:re[3]})<se&&(t=[re[2],re[3]])}}var le=or(t,r,o.arrowShapes[h].spacing(e)+f),ue=or(t,r,o.arrowShapes[h].gap(e)+f);v.startX=ue[0],v.startY=ue[1],v.arrowStartX=le[0],v.arrowStartY=le[1],k&&(C(v.startX)&&C(v.startY)&&C(v.endX)&&C(v.endY)?v.badLine=!1:v.badLine=!0)},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}},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}}},ld={};function ud(e,t,n){for(var r=function(e,t,n,r){return Sn(e,t,n,r)},a=t._private.rstyle.bezierPts,i=0;i<e.bezierProjPcts.length;i++){var o=e.bezierProjPcts[i];a.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}ld.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,"multibezier"===r||"bezier"===r||"self"===r||"compound"===r){t.rstyle.bezierPts=[];for(var a=0;a+5<n.allpts.length;a+=4)ud(this,e,n.allpts.slice(a,a+6))}else if("segments"===r){var i=t.rstyle.linePts=[];for(a=0;a+1<n.allpts.length;a+=2)i.push({x:n.allpts[a],y:n.allpts[a+1]})}else if("haystack"===r){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},ld.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var cd={recalculateNodeLabelProjection:function(e){var t=e.pstyle("label").strValue;if(!A(t)){var n,r,a=e._private,i=e.width(),o=e.height(),s=e.padding(),l=e.position(),u=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,d=a.rscratch,h=a.rstyle;switch(u){case"left":n=l.x-i/2-s;break;case"right":n=l.x+i/2+s;break;default:n=l.x}switch(c){case"top":r=l.y-o/2-s;break;case"bottom":r=l.y+o/2+s;break;default:r=l.y}d.labelX=n,d.labelY=r,h.labelX=n,h.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}}},dd=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},hd=function(e,t){var n=t.x-e.x,r=t.y-e.y;return dd(n,r)},pd=function(e,t,n,r){var a=Pn(0,r-.001,1),i=Pn(0,r+.001,1),o=Dn(e,t,n,a),s=Dn(e,t,n,i);return hd(o,s)};cd.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.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:r.midX,y:r.midY};var o=function(e,t,r){Vt(n.rscratch,e,t,r),Vt(n.rstyle,e,t,r)};o("labelX",null,t.x),o("labelY",null,t.y);var s=dd(r.midDispX,r.midDispY);o("labelAutoAngle",null,s);var l=function e(){if(e.cache)return e.cache;for(var t=[],i=0;i+5<r.allpts.length;i+=4){var o={x:r.allpts[i],y:r.allpts[i+1]},s={x:r.allpts[i+2],y:r.allpts[i+3]},l={x:r.allpts[i+4],y:r.allpts[i+5]};t.push({p0:o,p1:s,p2:l,startDist:0,length:0,segments:[]})}var u=n.rstyle.bezierPts,c=a.bezierProjPcts.length;function d(e,t,n,r,a){var i=En(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:a,startDist:o?o.startDist+o.length:0,length:i};e.segments.push(s),e.length+=i}for(var h=0;h<t.length;h++){var p=t[h],f=t[h-1];f&&(p.startDist=f.startDist+f.length),d(p,p.p0,u[h*c],0,a.bezierProjPcts[0]);for(var g=0;g<c-1;g++)d(p,u[h*c+g],u[h*c+g+1],a.bezierProjPcts[g],a.bezierProjPcts[g+1]);d(p,u[h*c+c-1],p.p2,a.bezierProjPcts[c-1],1)}return e.cache=t},u=function(n){var a,s="source"===n;if(i[n]){var u=e.pstyle(n+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var c,d=l(),h=0,p=0,f=0;f<d.length;f++){for(var g=d[s?f:d.length-1-f],v=0;v<g.segments.length;v++){var y=g.segments[s?v:g.segments.length-1-v],m=f===d.length-1&&v===g.segments.length-1;if(h=p,(p+=y.length)>=u||m){c={cp:g,segment:y};break}}if(c)break}var b=c.cp,x=c.segment,w=(u-h)/x.length,E=x.t1-x.t0,k=s?x.t0+E*w:x.t1-E*w;k=Pn(0,k,1),t=Dn(b.p0,b.p1,b.p2,k),a=pd(b.p0,b.p1,b.p2,k);break;case"straight":case"segments":case"haystack":for(var C,S,D,T,P=0,_=r.allpts.length,M=0;M+3<_&&(s?(D={x:r.allpts[M],y:r.allpts[M+1]},T={x:r.allpts[M+2],y:r.allpts[M+3]}):(D={x:r.allpts[_-2-M],y:r.allpts[_-1-M]},T={x:r.allpts[_-4-M],y:r.allpts[_-3-M]}),S=P,!((P+=C=En(D,T))>=u));M+=2);var B=(u-S)/C;B=Pn(0,B,1),t=Tn(D,T,B),a=hd(D,T)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,a)}};u("source"),u("target"),this.applyLabelDimensions(e)}},cd.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},cd.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=this.calculateLabelDimensions(e,r),i=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Rt(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=a.height/l,c=u*i,d=a.width,h=a.height+(l-1)*(i-1)*u;Vt(n.rstyle,"labelWidth",t,d),Vt(n.rscratch,"labelWidth",t,d),Vt(n.rstyle,"labelHeight",t,h),Vt(n.rscratch,"labelHeight",t,h),Vt(n.rscratch,"labelLineHeight",t,c)},cd.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",a=e.pstyle(r+"label").strValue,i=e.pstyle("text-transform").value,o=function(e,r){return r?(Vt(n.rscratch,e,t,r),r):Rt(n.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="\u200b",c=a.split("\n"),d=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,p=[],f=/[\s\u200b]+/,g=h?"":" ",v=0;v<c.length;v++){var y=c[v],m=this.calculateLabelDimensions(e,y).width;if(h){var b=y.split("").join(u);y=b}if(m>d){for(var x=y.split(f),w="",E=0;E<x.length;E++){var k=x[E],C=0===w.length?k:w+g+k;this.calculateLabelDimensions(e,C).width<=d?w+=k+g:(w&&p.push(w),w=k+g)}w.match(/^[\s\u200b]+$/)||p.push(w)}else p.push(y)}o("labelWrapCachedLines",p),a=o("labelWrapCachedText",p.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){var S=e.pstyle("text-max-width").pfValue,D="",T="\u2026",P=!1;if(this.calculateLabelDimensions(e,a).width<S)return a;for(var _=0;_<a.length&&!(this.calculateLabelDimensions(e,D+a[_]+T).width>S);_++)D+=a[_],_===a.length-1&&(P=!0);return P||(D+=T),D}return a},cd.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},cd.calculateLabelDimensions=function(e,t){var n=this,r=ft(t,e._private.labelDimsKey),a=n.labelDimCache||(n.labelDimCache=[]),i=a[r];if(null!=i)return i;var o=0,s=e.pstyle("font-style").strValue,l=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,d=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=document.createElement("canvas"),h=this.labelCalcCanvasContext=d.getContext("2d");var p=d.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}h.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(u);for(var f=0,g=0,v=t.split("\n"),y=0;y<v.length;y++){var m=v[y],b=h.measureText(m),x=Math.ceil(b.width),w=l;f=Math.max(x,f),g+=w}return f+=o,g+=o,a[r]={width:f,height:g}},cd.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),a=t?t+"-":"",i=e.pstyle(a+"text-rotation"),o=i.strValue;return"none"===o?0:r&&"autorotate"===o?n.labelAutoAngle:"autorotate"===o?0:i.pfValue},cd.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private.rscratch;r.labelAngle=t.calculateLabelAngle(e),n&&(r.sourceLabelAngle=t.calculateLabelAngle(e,"source"),r.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var fd={},gd=28,vd=!1;fd.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if("cutrectangle"===n&&(e.width()<gd||e.height()<gd))return vd||(Tt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),vd=!0),"rectangle";if(e.isParent())return"rectangle"===n||"roundrectangle"===n||"round-rectangle"===n||"cutrectangle"===n||"cut-rectangle"===n||"barrel"===n?n:"rectangle";if("polygon"===n){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n};var yd={registerCalculationListeners:function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r<e.length;r++){var a=e[r]._private.rstyle;a.clean=!1,a.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",(function(e){var t=e.target;r(t)})).on("style.* background.*",(function(e){var t=e.target;r(t,!1)}));var a=function(a){if(a){var i=n.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],l=s._private.rstyle;s.isNode()&&!l.cleanConnected&&(r(s.connectedEdges()),l.cleanConnected=!0)}if(i)for(var u=0;u<i.length;u++)(0,i[u])(a,t);n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){a(!0)},n.beforeRender(a,n.beforeRenderPriorities.eleCalcs)},onUpdateEleCalcs:function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},recalculateRenderedStyle:function(e,t){var n=function(e){return e._private.rstyle.cleanConnected},r=[],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()||n(o.source())&&n(o.target())||(l.clean=!1),t&&l.clean||o.removed()||"none"!==o.pstyle("display").value&&("nodes"===s.group?a.push(o):r.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(r);for(var p=0;p<r.length;p++){var f=r[p]._private,g=f.rstyle,v=f.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}}}},md={updateCachedGrabbedEles:function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=(a=e[n])._private.rscratch;a.grabbed()&&!a.isParent()?t.push(a):r.inDragLayer?e.drag.push(a):e.nondrag.push(a)}for(n=0;n<t.length;n++){var a=t[n];e.drag.push(a)}}},invalidateCachedZSortedEles:function(){this.cachedZSortedEles=null},getCachedZSortedEles:function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(Ql),t.interactive=t.filter((function(e){return e.interactive()})),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t}},bd={};[rd,ad,id,sd,ld,cd,fd,yd,md].forEach((function(e){Q(bd,e)}));var xd={getCachedImage:function(e,t,n){var r=this,a=r.imageCache=r.imageCache||{},i=a[e];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;var o=(i=a[e]=a[e]||{}).image=new Image;o.addEventListener("load",n),o.addEventListener("error",(function(){o.error=!0}));var s="data:";return e.substring(0,s.length).toLowerCase()===s||(t="null"===t?null:t,o.crossOrigin=t),o.src=e,o}},wd={registerBinding:function(e,t,n,r){var a=Array.prototype.slice.apply(arguments,[1]),i=this.binder(e);return i.on.apply(i,a)},binder:function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||I(e);if(null==t.supportsPassiveEvents){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});n.addEventListener("test",null,i)}catch(s){}t.supportsPassiveEvents=a}var o=function(n,a,i){var o=Array.prototype.slice.call(arguments);return r&&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}},nodeIsDraggable:function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},nodeIsGrabbable:function(e){return this.nodeIsDraggable(e)&&e.interactive()},load:function(){var e=this,t=e.cy.window(),n=function(e){return e.selected()},r=function(t,n,r,a){null==t&&(t=e.cy);for(var i=0;i<n.length;i++){var o=n[i];t.emit({originalEvent:r,type:o,position:a})}},a=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},i=function(t,n){var r=!0;if(e.cy.hasCompoundNodes()&&t&&t.pannable()){for(var a=0;n&&a<n.length;a++)if((t=n[a]).isNode()&&t.isParent()&&!t.pannable()){r=!1;break}}else r=!0;return r},o=function(e){e[0]._private.grabbed=!0},s=function(e){e[0]._private.grabbed=!1},l=function(e){e[0]._private.rscratch.inDragLayer=!0},u=function(e){e[0]._private.rscratch.inDragLayer=!1},c=function(e){e[0]._private.rscratch.isGrabTarget=!0},d=function(e){e[0]._private.rscratch.isGrabTarget=!1},h=function(e,t){var n=t.addToList;n.has(e)||!e.grabbable()||e.locked()||(n.merge(e),o(e))},p=function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var n=e.descendants();t.inDragLayer&&(n.forEach(l),n.connectedEdges().forEach(l)),t.addToList&&h(n,t)}},f=function(t,n){n=n||{};var r=t.cy().hasCompoundNodes();n.inDragLayer&&(t.forEach(l),t.neighborhood().stdFilter((function(e){return!r||e.isEdge()})).forEach(l)),n.addToList&&t.forEach((function(e){h(e,n)})),p(t,n),y(t,{inDragLayer:n.inDragLayer}),e.updateCachedGrabbedEles()},g=f,v=function(t){t&&(e.getCachedZSortedEles().forEach((function(e){s(e),u(e),d(e)})),e.updateCachedGrabbedEles())},y=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),a=r.connectedEdges();t.inDragLayer&&(a.forEach(l),r.forEach(l)),t.addToList&&r.forEach((function(e){h(e,t)}))}}},m=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},b="undefined"!==typeof MutationObserver,x="undefined"!==typeof ResizeObserver;b?(e.removeObserver=new MutationObserver((function(t){for(var n=0;n<t.length;n++){var r=t[n].removedNodes;if(r)for(var a=0;a<r.length;a++)if(r[a]===e.container){e.destroy();break}}})),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",(function(t){e.destroy()}));var w=Qe((function(){e.cy.resize()}),100);b&&(e.styleObserver=new MutationObserver(w),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",w),x&&(e.resizeObserver=new ResizeObserver(w),e.resizeObserver.observe(e.container));var E=function(e,t){for(;null!=e;)t(e),e=e.parentNode},k=function(){e.invalidateContainerClientCoordsCache()};E(e.container,(function(t){e.registerBinding(t,"transitionend",k),e.registerBinding(t,"animationend",k),e.registerBinding(t,"scroll",k)})),e.registerBinding(e.container,"contextmenu",(function(e){e.preventDefault()}));var S,D,T,P=function(){return 0!==e.selection[4]},_=function(t){for(var n=e.findContainerClientCoords(),r=n[0],a=n[1],i=n[2],o=n[3],s=t.touches?t.touches:[t],l=!1,u=0;u<s.length;u++){var c=s[u];if(r<=c.clientX&&c.clientX<=r+i&&a<=c.clientY&&c.clientY<=a+o){l=!0;break}}if(!l)return!1;for(var d=e.container,h=t.target.parentNode,p=!1;h;){if(h===d){p=!0;break}h=h.parentNode}return!!p};e.registerBinding(e.container,"mousedown",(function(t){if(_(t)){t.preventDefault(),m(),e.hoverData.capture=!0,e.hoverData.which=t.which;var n=e.cy,a=[t.clientX,t.clientY],i=e.projectIntoViewport(a[0],a[1]),o=e.selection,s=e.findNearestElements(i[0],i[1],!0,!1),l=s[0],u=e.dragData.possibleDragElements;e.hoverData.mdownPos=i,e.hoverData.mdownGPos=a;var d=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout((function(){if(!e.hoverData.tapholdCancelled){var r=e.hoverData.down;r?r.emit({originalEvent:t,type:"taphold",position:{x:i[0],y:i[1]}}):n.emit({originalEvent:t,type:"taphold",position:{x:i[0],y:i[1]}})}}),e.tapholdDuration)};if(3==t.which){e.hoverData.cxtStarted=!0;var h={originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}};l?(l.activate(),l.emit(h),e.hoverData.down=l):n.emit(h),e.hoverData.downTime=(new Date).getTime(),e.hoverData.cxtDragged=!1}else if(1==t.which){if(l&&l.activate(),null!=l&&e.nodeIsGrabbable(l)){var p=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}},v=function(e){e.emit(p("grab"))};if(c(l),l.selected()){u=e.dragData.possibleDragElements=n.collection();var y=n.$((function(t){return t.isNode()&&t.selected()&&e.nodeIsGrabbable(t)}));f(y,{addToList:u}),l.emit(p("grabon")),y.forEach(v)}else u=e.dragData.possibleDragElements=n.collection(),g(l,{addToList:u}),l.emit(p("grabon")).emit(p("grab"));e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=l,e.hoverData.downs=s,e.hoverData.downTime=(new Date).getTime(),r(l,["mousedown","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==l?(o[4]=1,e.data.bgActivePosistion={x:i[0],y:i[1]},e.redrawHint("select",!0),e.redraw()):l.pannable()&&(o[4]=1),d()}o[0]=o[2]=i[0],o[1]=o[3]=i[1]}}),!1),e.registerBinding(t,"mousemove",(function(t){if(e.hoverData.capture||_(t)){var n=!1,o=e.cy,s=o.zoom(),l=[t.clientX,t.clientY],u=e.projectIntoViewport(l[0],l[1]),c=e.hoverData.mdownPos,d=e.hoverData.mdownGPos,h=e.selection,p=null;e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.selecting||(p=e.findNearestElement(u[0],u[1],!0,!1));var g,y=e.hoverData.last,m=e.hoverData.down,b=[u[0]-h[2],u[1]-h[3]],x=e.dragData.possibleDragElements;if(d){var w=l[0]-d[0],E=w*w,k=l[1]-d[1],S=E+k*k;e.hoverData.isOverThresholdDrag=g=S>=e.desktopTapThreshold2}var D=a(t);g&&(e.hoverData.tapholdCancelled=!0);var T=function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(b[0]),t.push(b[1])):(t[0]+=b[0],t[1]+=b[1])};n=!0,r(p,["mousemove","vmousemove","tapdrag"],t,{x:u[0],y:u[1]});var P=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:u[0],y:u[1]}}),h[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(g){var M={originalEvent:t,type:"cxtdrag",position:{x:u[0],y:u[1]}};m?m.emit(M):o.emit(M),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&p===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:u[0],y:u[1]}}),e.hoverData.cxtOver=p,p&&p.emit({originalEvent:t,type:"cxtdragover",position:{x:u[0],y:u[1]}}))}}else if(e.hoverData.dragging){if(n=!0,o.panningEnabled()&&o.userPanningEnabled()){var B;if(e.hoverData.justStartedPan){var N=e.hoverData.mdownPos;B={x:(u[0]-N[0])*s,y:(u[1]-N[1])*s},e.hoverData.justStartedPan=!1}else B={x:b[0]*s,y:b[1]*s};o.panBy(B),o.emit("dragpan"),e.hoverData.dragged=!0}u=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=h[4]||null!=m&&!m.pannable()){if(m&&m.pannable()&&m.active()&&m.unactivate(),m&&m.grabbed()||p==y||(y&&r(y,["mouseout","tapdragout"],t,{x:u[0],y:u[1]}),p&&r(p,["mouseover","tapdragover"],t,{x:u[0],y:u[1]}),e.hoverData.last=p),m)if(g){if(o.boxSelectionEnabled()&&D)m&&m.grabbed()&&(v(x),m.emit("freeon"),x.emit("free"),e.dragData.didDrag&&(m.emit("dragfreeon"),x.emit("dragfree"))),P();else if(m&&m.grabbed()&&e.nodeIsDraggable(m)){var A=!e.dragData.didDrag;A&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||f(x,{inDragLayer:!0});var I={x:0,y:0};if(C(b[0])&&C(b[1])&&(I.x+=b[0],I.y+=b[1],A)){var O=e.hoverData.dragDelta;O&&C(O[0])&&C(O[1])&&(I.x+=O[0],I.y+=O[1])}e.hoverData.draggingEles=!0,x.silentShift(I).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else T();n=!0}else g&&(e.hoverData.dragging||!o.boxSelectionEnabled()||!D&&o.panningEnabled()&&o.userPanningEnabled()?!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()&&i(m,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,h[4]=0,e.data.bgActivePosistion=pn(c),e.redrawHint("select",!0),e.redraw()):P(),m&&m.pannable()&&m.active()&&m.unactivate());return h[2]=u[0],h[3]=u[1],n?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(t,"mouseup",(function(t){if(e.hoverData.capture){e.hoverData.capture=!1;var i=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,d=a(t);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var h={originalEvent:t,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(h):i.emit(h),!e.hoverData.cxtDragged){var p={originalEvent:t,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(p):i.emit(p)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(r(l,["mouseup","tapend","vmouseup"],t,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(c,["click","tap","vclick"],t,{x:o[0],y:o[1]}),D=!1,t.timeStamp-T<=i.multiClickDebounceTime()?(S&&clearTimeout(S),D=!0,T=null,r(c,["dblclick","dbltap","vdblclick"],t,{x:o[0],y:o[1]})):(S=setTimeout((function(){D||r(c,["oneclick","onetap","voneclick"],t,{x:o[0],y:o[1]})}),i.multiClickDebounceTime()),T=t.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||a(t)||(i.$(n).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=i.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===i.selectionType()||d?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):d||(i.$(n).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var f=i.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),f.length>0&&e.redrawHint("eles",!0),i.emit({type:"boxend",originalEvent:t,position:{x:o[0],y:o[1]}});var g=function(e){return e.selectable()&&!e.selected()};"additive"===i.selectionType()||d||i.$(n).unmerge(f).unselect(),f.emit("box").stdFilter(g).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=c&&c.grabbed();v(u),y&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[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}}),!1);var M,B,N,A,I,O,z,L,R,V,F,j,q,X=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),a=n.pan(),i=e.projectIntoViewport(t.clientX,t.clientY),o=[i[0]*r+a.x,i[1]*r+a.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||P())t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.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),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",X,!0),e.registerBinding(t,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||X(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var Y,W,H,G,K,U,Z,$=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},Q=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",Y=function(t){if(e.hasTouchStarted=!0,_(t)){m(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,a=e.touchData.now,i=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);a[0]=o[0],a[1]=o[1]}if(t.touches[1]&&(o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),a[2]=o[0],a[3]=o[1]),t.touches[2]&&(o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),a[4]=o[0],a[5]=o[1]),t.touches[1]){e.touchData.singleTouchMoved=!0,v(e.dragData.touchDragEles);var s=e.findContainerClientCoords();R=s[0],V=s[1],F=s[2],j=s[3],M=t.touches[0].clientX-R,B=t.touches[0].clientY-V,N=t.touches[1].clientX-R,A=t.touches[1].clientY-V,q=0<=M&&M<=F&&0<=N&&N<=F&&0<=B&&B<=j&&0<=A&&A<=j;var l=n.pan(),u=n.zoom();I=$(M,B,N,A),O=Q(M,B,N,A),L=[((z=[(M+N)/2,(B+A)/2])[0]-l.x)/u,(z[1]-l.y)/u];var d=200;if(O<d*d&&!t.touches[2]){var h=e.findNearestElement(a[0],a[1],!0,!0),p=e.findNearestElement(a[2],a[3],!0,!0);return h&&h.isNode()?(h.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}}),e.touchData.start=h):p&&p.isNode()?(p.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}}),e.touchData.start=p):n.emit({originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var y=e.findNearestElements(a[0],a[1],!0,!0),b=y[0];if(null!=b&&(b.activate(),e.touchData.start=b,e.touchData.starts=y,e.nodeIsGrabbable(b))){var x=e.dragData.touchDragEles=n.collection(),w=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),b.selected()?(w=n.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),f(w,{addToList:x})):g(b,{addToList:x}),c(b);var E=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}};b.emit(E("grabon")),w?w.forEach((function(e){e.emit(E("grab"))})):b.emit(E("grab"))}r(b,["touchstart","tapstart","vmousedown"],t,{x:a[0],y:a[1]}),null==b&&(e.data.bgActivePosistion={x:o[0],y:o[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||r(e.touchData.start,["taphold"],t,{x:a[0],y:a[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var k=e.touchData.startPosition=[null,null,null,null,null,null],C=0;C<a.length;C++)k[C]=i[C]=a[C];var S=t.touches[0];e.touchData.startGPosition=[S.clientX,S.clientY]}}},!1),e.registerBinding(window,"touchmove",W=function(t){var n=e.touchData.capture;if(n||_(t)){var a=e.selection,o=e.cy,s=e.touchData.now,l=e.touchData.earlier,u=o.zoom();if(t.touches[0]){var c=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=c[0],s[1]=c[1]}t.touches[1]&&(c=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),s[2]=c[0],s[3]=c[1]),t.touches[2]&&(c=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),s[4]=c[0],s[5]=c[1]);var d,h=e.touchData.startGPosition;if(n&&t.touches[0]&&h){for(var p=[],g=0;g<s.length;g++)p[g]=s[g]-l[g];var y=t.touches[0].clientX-h[0],m=y*y,b=t.touches[0].clientY-h[1];d=m+b*b>=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var x=t.touches[0].clientX-R,w=t.touches[0].clientY-V,E=t.touches[1].clientX-R,k=t.touches[1].clientY-V,S=Q(x,w,E,k),D=150,T=1.5;if(S/O>=T*T||S>=D*D){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var P={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(P),e.touchData.start=null):o.emit(P)}}if(n&&e.touchData.cxt){P={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}},e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(P):o.emit(P),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var z=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&z===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=z,z&&z.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(n&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,a[4]=1,a&&0!==a.length&&void 0!==a[0]?(a[2]=(s[0]+s[2]+s[4])/3,a[3]=(s[1]+s[3]+s[5])/3):(a[0]=(s[0]+s[2]+s[4])/3,a[1]=(s[1]+s[3]+s[5])/3,a[2]=(s[0]+s[2]+s[4])/3+1,a[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ne=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var F=0;F<ne.length;F++){var j=ne[F]._private;j.grabbed=!1,j.rscratch.inDragLayer=!1}}var X=e.touchData.start,Y=(x=t.touches[0].clientX-R,w=t.touches[0].clientY-V,E=t.touches[1].clientX-R,k=t.touches[1].clientY-V,$(x,w,E,k)),W=Y/I;if(q){var H=(x-M+(E-N))/2,G=(w-B+(k-A))/2,K=o.zoom(),U=K*W,Z=o.pan(),J=L[0]*K+Z.x,ee=L[1]*K+Z.y,te={x:-U/K*(J-Z.x-H)+J,y:-U/K*(ee-Z.y-G)+ee};if(X&&X.active()){var ne=e.dragData.touchDragEles;v(ne),e.redrawHint("drag",!0),e.redrawHint("eles",!0),X.unactivate().emit("freeon"),ne.emit("free"),e.dragData.didDrag&&(X.emit("dragfreeon"),ne.emit("dragfree"))}o.viewport({zoom:U,pan:te,cancelOnFailedZoom:!0}),o.emit("pinchzoom"),I=Y,M=x,B=w,N=E,A=k,e.pinching=!0}t.touches[0]&&(c=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY),s[0]=c[0],s[1]=c[1]),t.touches[1]&&(c=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),s[2]=c[0],s[3]=c[1]),t.touches[2]&&(c=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),s[4]=c[0],s[5]=c[1])}else if(t.touches[0]&&!e.touchData.didSelect){var re=e.touchData.start,ae=e.touchData.last;if(e.hoverData.draggingEles||e.swipePanning||(z=e.findNearestElement(s[0],s[1],!0,!0)),n&&null!=re&&t.preventDefault(),n&&null!=re&&e.nodeIsDraggable(re))if(d){ne=e.dragData.touchDragEles;var ie=!e.dragData.didDrag;ie&&f(ne,{inDragLayer:!0}),e.dragData.didDrag=!0;var oe={x:0,y:0};C(p[0])&&C(p[1])&&(oe.x+=p[0],oe.y+=p[1],ie&&(e.redrawHint("eles",!0),(se=e.touchData.dragDelta)&&C(se[0])&&C(se[1])&&(oe.x+=se[0],oe.y+=se[1]))),e.hoverData.draggingEles=!0,ne.silentShift(oe).emit("position drag"),e.redrawHint("drag",!0),e.touchData.startPosition[0]==l[0]&&e.touchData.startPosition[1]==l[1]&&e.redrawHint("eles",!0),e.redraw()}else{var se;0===(se=e.touchData.dragDelta=e.touchData.dragDelta||[]).length?(se.push(p[0]),se.push(p[1])):(se[0]+=p[0],se[1]+=p[1])}if(r(re||z,["touchmove","tapdrag","vmousemove"],t,{x:s[0],y:s[1]}),re&&re.grabbed()||z==ae||(ae&&ae.emit({originalEvent:t,type:"tapdragout",position:{x:s[0],y:s[1]}}),z&&z.emit({originalEvent:t,type:"tapdragover",position:{x:s[0],y:s[1]}})),e.touchData.last=z,n)for(F=0;F<s.length;F++)s[F]&&e.touchData.startPosition[F]&&d&&(e.touchData.singleTouchMoved=!0);n&&(null==re||re.pannable())&&o.panningEnabled()&&o.userPanningEnabled()&&(i(re,e.touchData.starts)&&(t.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=pn(e.touchData.startPosition)),e.swipePanning?(o.panBy({x:p[0]*u,y:p[1]*u}),o.emit("dragpan")):d&&(e.swipePanning=!0,o.panBy({x:y*u,y:b*u}),o.emit("dragpan"),re&&(re.unactivate(),e.redrawHint("select",!0),e.touchData.start=null))),c=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY),s[0]=c[0],s[1]=c[1])}for(g=0;g<s.length;g++)l[g]=s[g];n&&t.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(t,"touchcancel",H=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",G=function(t){var a=e.touchData.start;if(e.touchData.capture){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var i=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(t.touches[0]){var d=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);u[0]=d[0],u[1]=d[1]}if(t.touches[1]&&(d=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),u[2]=d[0],u[3]=d[1]),t.touches[2]&&(d=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),u[4]=d[0],u[5]=d[1]),a&&a.unactivate(),e.touchData.cxt){if(o={originalEvent:t,type:"cxttapend",position:{x:u[0],y:u[1]}},a?a.emit(o):s.emit(o),!e.touchData.cxtDragged){var h={originalEvent:t,type:"cxttap",position:{x:u[0],y:u[1]}};a?a.emit(h):s.emit(h)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var p=s.collection(e.getAllInBox(i[0],i[1],i[2],i[3]));i[0]=void 0,i[1]=void 0,i[2]=void 0,i[3]=void 0,i[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:t,position:{x:u[0],y:u[1]}});var f=function(e){return e.selectable()&&!e.selected()};p.emit("box").stdFilter(f).select().emit("boxselect"),p.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=a&&a.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=a){var y=a._private.grabbed;v(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),y&&(a.emit("freeon"),g.emit("free"),e.dragData.didDrag&&(a.emit("dragfreeon"),g.emit("dragfree"))),r(a,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]}),a.unactivate(),e.touchData.start=null}else{var m=e.findNearestElement(u[0],u[1],!0,!0);r(m,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]})}var b=e.touchData.startPosition[0]-u[0],x=b*b,w=e.touchData.startPosition[1]-u[1],E=(x+w*w)*l*l;e.touchData.singleTouchMoved||(a||s.$(":selected").unselect(["tapunselect"]),r(a,["tap","vclick"],t,{x:u[0],y:u[1]}),K=!1,t.timeStamp-Z<=s.multiClickDebounceTime()?(U&&clearTimeout(U),K=!0,Z=null,r(a,["dbltap","vdblclick"],t,{x:u[0],y:u[1]})):(U=setTimeout((function(){K||r(a,["onetap","voneclick"],t,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),Z=t.timeStamp)),null!=a&&!e.dragData.didDrag&&a._private.selectable&&E<e.touchTapThreshold2&&!e.pinching&&("single"===s.selectionType()?(s.$(n).unmerge(a).unselect(["tapunselect"]),a.select(["tapselect"])):a.selected()?a.unselect(["tapunselect"]):a.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}for(var k=0;k<u.length;k++)c[k]=u[k];e.dragData.didDrag=!1,0===t.touches.length&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),t.touches.length<2&&(1===t.touches.length&&(e.touchData.startGPosition=[t.touches[0].clientX,t.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())}},!1),"undefined"===typeof TouchEvent){var J=[],ee=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}},te=function(e){return{event:e,touch:ee(e)}},ne=function(e){J.push(te(e))},re=function(e){for(var t=0;t<J.length;t++)if(J[t].event.pointerId===e.pointerId)return void J.splice(t,1)},ae=function(e){var t=J.filter((function(t){return t.event.pointerId===e.pointerId}))[0];t.event=e,t.touch=ee(e)},ie=function(e){e.touches=J.map((function(e){return e.touch}))},oe=function(e){return"mouse"===e.pointerType||4===e.pointerType};e.registerBinding(e.container,"pointerdown",(function(e){oe(e)||(e.preventDefault(),ne(e),ie(e),Y(e))})),e.registerBinding(e.container,"pointerup",(function(e){oe(e)||(re(e),ie(e),G(e))})),e.registerBinding(e.container,"pointercancel",(function(e){oe(e)||(re(e),ie(e),H(e))})),e.registerBinding(e.container,"pointermove",(function(e){oe(e)||(e.preventDefault(),ae(e),ie(e),W(e))}))}}},Ed={generatePolygon:function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,a){this.renderer.nodeShapeImpl("polygon",e,t,n,r,a,this.points)},intersectLine:function(e,t,n,r,a,i,o){return ar(a,i,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,a,i,o){return Un(e,t,this.points,i,o,r,a,[0,-1],n)}}},generateEllipse:function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,o){return Jn(a,i,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,a,i,o){return er(e,t,r,a,i,o,n)}}},generateRoundPolygon:function(e,t){for(var n=new Array(2*t.length),r=0;r<t.length/2;r++){var a=2*r,i=void 0;i=r<t.length/2-1?2*(r+1):0,n[4*r]=t[a],n[4*r+1]=t[a+1];var o=t[i]-t[a],s=t[i+1]-t[a+1],l=Math.sqrt(o*o+s*s);n[4*r+2]=o/l,n[4*r+3]=s/l}return this.nodeShapes[e]={renderer:this,name:e,points:n,draw:function(e,t,n,r,a){this.renderer.nodeShapeImpl("round-polygon",e,t,n,r,a,this.points)},intersectLine:function(e,t,n,r,a,i,o){return ir(a,i,this.points,e,t,n,r)},checkPoint:function(e,t,n,r,a,i,o){return Zn(e,t,this.points,i,o,r,a)}}},generateRoundRectangle:function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:sr(4,0),draw:function(e,t,n,r,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,o){return jn(a,i,e,t,n,r,o)},checkPoint:function(e,t,n,r,a,i,o){var s=cr(r,a),l=2*s;return!!Un(e,t,this.points,i,o,r,a-l,[0,-1],n)||!!Un(e,t,this.points,i,o,r-l,a,[0,-1],n)||!!er(e,t,l,l,i-r/2+s,o-a/2+s,n)||!!er(e,t,l,l,i+r/2-s,o-a/2+s,n)||!!er(e,t,l,l,i+r/2-s,o+a/2-s,n)||!!er(e,t,l,l,i-r/2+s,o+a/2-s,n)}}},generateCutRectangle:function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:hr(),points:sr(4,0),draw:function(e,t,n,r,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},generateCutTrianglePts:function(e,t,n,r){var a=this.cornerLength,i=t/2,o=e/2,s=n-o,l=n+o,u=r-i,c=r+i;return{topLeft:[s,u+a,s+a,u,s+a,u+a],topRight:[l-a,u,l,u+a,l-a,u+a],bottomRight:[l,c-a,l-a,c,l-a,c-a],bottomLeft:[s+a,c,s,c-a,s+a,c-a]}},intersectLine:function(e,t,n,r,a,i,o){var s=this.generateCutTrianglePts(n+2*o,r+2*o,e,t),l=[].concat.apply([],[s.topLeft.splice(0,4),s.topRight.splice(0,4),s.bottomRight.splice(0,4),s.bottomLeft.splice(0,4)]);return ar(a,i,l,e,t)},checkPoint:function(e,t,n,r,a,i,o){if(Un(e,t,this.points,i,o,r,a-2*this.cornerLength,[0,-1],n))return!0;if(Un(e,t,this.points,i,o,r-2*this.cornerLength,a,[0,-1],n))return!0;var s=this.generateCutTrianglePts(r,a,i,o);return Kn(e,t,s.topLeft)||Kn(e,t,s.topRight)||Kn(e,t,s.bottomRight)||Kn(e,t,s.bottomLeft)}}},generateBarrel:function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:sr(4,0),draw:function(e,t,n,r,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,o){var s=.15,l=.5,u=.85,c=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),d=function(e){var t=Dn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},s),n=Dn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},l),r=Dn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},u);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]},h=[].concat(d(c.topLeft),d(c.topRight),d(c.bottomRight),d(c.bottomLeft));return ar(a,i,h,e,t)},generateBarrelBezierPts:function(e,t,n,r){var a=t/2,i=e/2,o=n-i,s=n+i,l=r-a,u=r+a,c=fr(e,t),d=c.heightOffset,h=c.widthOffset,p=c.ctrlPtOffsetPct*e,f={topLeft:[o,l+d,o+p,l,o+h,l],topRight:[s-h,l,s-p,l,s,l+d],bottomRight:[s,u-d,s-p,u,s-h,u],bottomLeft:[o+h,u,o+p,u,o,u-d]};return f.topLeft.isTop=!0,f.topRight.isTop=!0,f.bottomLeft.isBottom=!0,f.bottomRight.isBottom=!0,f},checkPoint:function(e,t,n,r,a,i,o){var s=fr(r,a),l=s.heightOffset,u=s.widthOffset;if(Un(e,t,this.points,i,o,r,a-2*l,[0,-1],n))return!0;if(Un(e,t,this.points,i,o,r-2*u,a,[0,-1],n))return!0;for(var c=this.generateBarrelBezierPts(r,a,i,o),d=function(e,t,n){var r=n[4],a=n[2],i=n[0],o=n[5],s=n[1],l=Math.min(r,i),u=Math.max(r,i),c=Math.min(o,s),d=Math.max(o,s);if(l<=e&&e<=u&&c<=t&&t<=d){var h=pr(r,a,i),p=Yn(h[0],h[1],h[2],e).filter((function(e){return 0<=e&&e<=1}));if(p.length>0)return p[0]}return null},h=Object.keys(c),p=0;p<h.length;p++){var f=c[h[p]],g=d(e,t,f);if(null!=g){var v=f[5],y=f[3],m=f[1],b=Sn(v,y,m,g);if(f.isTop&&b<=t)return!0;if(f.isBottom&&t<=b)return!0}}return!1}}},generateBottomRoundrectangle:function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:sr(4,0),draw:function(e,t,n,r,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,o){var s=t-(r/2+o),l=rr(a,i,e,t,e-(n/2+o),s,e+(n/2+o),s,!1);return l.length>0?l:jn(a,i,e,t,n,r,o)},checkPoint:function(e,t,n,r,a,i,o){var s=cr(r,a),l=2*s;if(Un(e,t,this.points,i,o,r,a-l,[0,-1],n))return!0;if(Un(e,t,this.points,i,o,r-l,a,[0,-1],n))return!0;var u=r/2+2*n,c=a/2+2*n;return!!Kn(e,t,[i-u,o-c,i-u,o,i+u,o,i+u,o-c])||!!er(e,t,l,l,i+r/2-s,o+a/2-s,n)||!!er(e,t,l,l,i-r/2+s,o+a/2-s,n)}}},registerNodeShapes:function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",sr(3,0)),this.generateRoundPolygon("round-triangle",sr(3,0)),this.generatePolygon("rectangle",sr(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",sr(5,0)),this.generateRoundPolygon("round-pentagon",sr(5,0)),this.generatePolygon("hexagon",sr(6,0)),this.generateRoundPolygon("round-hexagon",sr(6,0)),this.generatePolygon("heptagon",sr(7,0)),this.generateRoundPolygon("round-heptagon",sr(7,0)),this.generatePolygon("octagon",sr(8,0)),this.generateRoundPolygon("round-octagon",sr(8,0));var r=new Array(20),a=ur(5,0),i=ur(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(s=0;s<5;s++)r[4*s]=a[2*s],r[4*s+1]=a[2*s+1],r[4*s+2]=i[2*s],r[4*s+3]=i[2*s+1];r=lr(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l),e.makePolygon=function(e){var n,r="polygon-"+e.join("$");return(n=this[r])?n:t.generatePolygon(r,e)}}},kd={timeToRender:function(){return this.redrawTotalTime/this.redrawCount},redraw:function(e){e=e||At();var t=this;void 0===t.averageRedrawTime&&(t.averageRedrawTime=0),void 0===t.lastRedrawTime&&(t.lastRedrawTime=0),void 0===t.lastDrawTime&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},beforeRender:function(e,t){if(!this.destroyed){null==t&&St("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort((function(e,t){return t.priority-e.priority}))}}},Cd=function(e,t,n){for(var r=e.beforeRenderCallbacks,a=0;a<r.length;a++)r[a].fn(t,n)};kd.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function n(r){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){Cd(e,!0,r);var a=rt();e.render(e.renderOptions);var i=e.lastDrawTime=rt();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 Cd(e,!1,r);e.skipFrame=!1,nt(n)}};nt(n)}};var Sd=function(e){this.init(e)},Dd=Sd.prototype;Dd.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],Dd.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var a=r.document,i=a.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",l=null!=a.getElementById(o);if(n.className.indexOf(s)<0&&(n.className=(n.className||"")+" "+s),!l){var u=a.createElement("style");u.id=o,u.textContent="."+s+" { position: relative; }",i.insertBefore(u,i.children[0])}"static"===r.getComputedStyle(n).getPropertyValue("position")&&Tt("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.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]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=C(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},Dd.notify=function(e,t){var n=this,r=n.cy;this.destroyed||("init"!==e?"destroy"!==e?(("add"===e||"remove"===e||"move"===e&&r.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&n.invalidateCachedZSortedEles(),"viewport"===e&&n.redrawHint("select",!0),"load"!==e&&"resize"!==e&&"mount"!==e||(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()):n.destroy():n.load())},Dd.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n.target;(r.off||r.removeEventListener).apply(r,n.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch(a){}},Dd.isHeadless=function(){return!1},[nd,bd,xd,wd,Ed,kd].forEach((function(e){Q(Dd,e)}));var Td=1e3/60,Pd={setupDequeueing:function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=Qe((function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()}),e.deqRedrawThreshold),a=function(a,i){var o=rt(),s=n.averageRedrawTime,l=n.lastRedrawTime,u=[],c=n.cy.extent(),d=n.getPixelRatio();for(a||n.flushRenderedStyleQueue();;){var h=rt(),p=h-o,f=h-i;if(l<Td){var g=Td-(a?s:0);if(f>=e.deqFastCost*g)break}else if(a){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(f>=e.deqNoDrawCost*Td)break;var v=e.deq(t,d,c);if(!(v.length>0))break;for(var y=0;y<v.length;y++)u.push(v[y])}u.length>0&&(e.onDeqd(t,u),!a&&e.shouldRedraw(t,u,d,c)&&r())},i=e.priority||Ct;n.beforeRender(a,i(t))}}}},_d=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Et;t(this,e),this.idsByKey=new jt,this.keyForId=new jt,this.cachesByLvl=new jt,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r}return a(e,[{key:"getIdsFor",value:function(e){null==e&&St("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Yt,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new jt,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),Md=25,Bd=50,Nd=-4,Ad=3,Id=7.99,Od=8,zd=1024,Ld=1024,Rd=1024,Vd=.2,Fd=.8,jd=10,qd=.15,Xd=.1,Yd=.9,Wd=.9,Hd=100,Gd=1,Kd={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Ud=It({getKey:null,doesEleInvalidateKey:Et,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:wt,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Zd=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=Ud(t);Q(n,r),n.lookup=new _d(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},$d=Zd.prototype;$d.reasons=Kd,$d.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},$d.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{};return n[e]=n[e]||[]},$d.getElementQueue=function(){var e=this;return e.eleCacheQueue=e.eleCacheQueue||new Ut((function(e,t){return t.reqs-e.reqs}))},$d.getElementKeyToQueue=function(){var e=this;return e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{}},$d.getElement=function(e,t,n,r,a){var i=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!i.allowEdgeTxrCaching&&e.isEdge()||!i.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(xn(s*n))),r<Nd)r=Nd;else if(s>=Id||r>Ad)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,h=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,h))return null;var p,f=l.get(e,r);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;if(p=c<=Md?Md:c<=Bd?Bd:Math.ceil(c/Bd)*Bd,c>Rd||d>Ld)return null;var g=i.getTextureQueue(p),v=g[g.length-2],y=function(){return i.recycleTexture(p,d)||i.addTexture(p,d)};v||(v=g[g.length-1]),v||(v=y()),v.width-v.usedWidth<d&&(v=y());for(var m,b=function(e){return e&&e.scaledLabelShown===h},x=a&&a===Kd.dequeue,w=a&&a===Kd.highQuality,E=a&&a===Kd.downscale,k=r+1;k<=Ad;k++){var C=l.get(e,k);if(C){m=C;break}}var S=m&&m.level===r+1?m:null,D=function(){v.context.drawImage(S.texture.canvas,S.x,0,S.width,S.height,v.usedWidth,0,d,c)};if(v.context.setTransform(1,0,0,1,0,0),v.context.clearRect(v.usedWidth,0,d,p),b(S))D();else if(b(m)){if(!w)return i.queueElement(e,m.level-1),m;for(var T=m.level;T>r;T--)S=i.getElement(e,t,n,T,Kd.downscale);D()}else{var P;if(!x&&!w&&!E)for(var _=r-1;_>=Nd;_--){var M=l.get(e,_);if(M){P=M;break}}if(b(P))return i.queueElement(e,r),P;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,h,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return f={x:v.usedWidth,texture:v,level:r,scale:u,width:d,height:c,scaledLabelShown:h},v.usedWidth+=Math.ceil(d+Od),v.eleCaches.push(f),l.set(e,r,f),i.checkTextureFullness(v),f},$d.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},$d.invalidateElement=function(e){var t=this,n=t.lookup,r=[];if(n.isInvalid(e)){for(var a=Nd;a<=Ad;a++){var i=n.getForCachedKey(e,a);i&&r.push(i)}if(n.invalidate(e))for(var o=0;o<r.length;o++){var s=r[o],l=s.texture;l.invalidatedWidth+=s.width,s.invalidated=!0,t.checkTextureUtility(l)}t.removeFromQueue(e)}},$d.checkTextureUtility=function(e){e.invalidatedWidth>=Vd*e.width&&this.retireTexture(e)},$d.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>Fd&&e.fullnessChecks>=jd?Ot(t,e):e.fullnessChecks++},$d.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),a=this.lookup;Ot(r,e),e.retired=!0;for(var i=e.eleCaches,o=0;o<i.length;o++){var s=i[o];a.deleteCache(s.key,s.level)}zt(i),t.getRetiredTextureQueue(n).push(e)},$d.addTexture=function(e,t){var n=this,r={};return n.getTextureQueue(e).push(r),r.eleCaches=[],r.height=e,r.width=Math.max(zd,t),r.usedWidth=0,r.invalidatedWidth=0,r.fullnessChecks=0,r.canvas=n.renderer.makeOffscreenCanvas(r.width,r.height),r.context=r.canvas.getContext("2d"),r},$d.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),a=n.getRetiredTextureQueue(e),i=0;i<a.length;i++){var o=a[i];if(o.width>=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,zt(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Ot(a,o),r.push(o),o}},$d.queueElement=function(e,t){var n=this,r=n.getElementQueue(),a=n.getElementKeyToQueue(),i=this.getKey(e),o=a[i];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,r.updateItem(o);else{var s={eles:e.spawn().merge(e),level:t,reqs:1,key:i};r.push(s),a[i]=s}},$d.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],i=t.lookup,o=0;o<Gd&&n.size()>0;o++){var s=n.pop(),l=s.key,u=s.eles[0],c=i.hasCache(u,s.level);if(r[l]=null,!c){a.push(s);var d=t.getBoundingBox(u);t.getElement(u,d,e,s.level,Kd.dequeue)}}return a},$d.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=this.getKey(e),i=r[a];null!=i&&(1===i.eles.length?(i.reqs=xt,n.updateItem(i),n.pop(),r[a]=null):i.eles.unmerge(e))},$d.onDequeue=function(e){this.onDequeues.push(e)},$d.offDequeue=function(e){Ot(this.onDequeues,e)},$d.setupDequeueing=Pd.setupDequeueing({deqRedrawThreshold:Hd,deqCost:qd,deqAvgCost:Xd,deqNoDrawCost:Yd,deqFastCost:Wd,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++)(0,e.onDequeues[n])(t)},shouldRedraw:function(e,t,n,r){for(var a=0;a<t.length;a++)for(var i=t[a].eles,o=0;o<i.length;o++){var s=i[o].boundingBox();if(Ln(s,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Qd=1,Jd=-4,eh=2,th=3.99,nh=50,rh=50,ah=.15,ih=.1,oh=.9,sh=.9,lh=1,uh=250,ch=16e6,dh=!0,hh=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=rt()-2*uh,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=Qe((function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)}),rh),n.beforeRender((function(e,n){n-t.lastInvalidationTime<=uh?t.skipping=!0:t.skipping=!1}),n.beforeRenderPriorities.lyrTxrSkip);var a=function(e,t){return t.reqs-e.reqs};t.layersQueue=new Ut(a),t.setupDequeueing()},ph=hh.prototype,fh=0,gh=Math.pow(2,53)-1;ph.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),a=Math.ceil(e.h*n),i=this.renderer.makeOffscreenCanvas(r,a),o={id:fh=++fh%gh,bb:e,level:t,width:r,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(n,n),s.translate(l,u),o},ph.getLayers=function(e,t,n){var r=this,a=r.renderer.cy.zoom(),i=r.firstGet;if(r.firstGet=!1,null==n)if((n=Math.ceil(xn(a*t)))<Jd)n=Jd;else if(a>=th||n>eh)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[],d=function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},a=function(e){if(!s)for(var r=n+e;Jd<=r&&r<=eh&&!t(r);r+=e);};a(1),a(-1);for(var i=c.length-1;i>=0;i--){var o=c[i];o.invalid&&Ot(c,o)}};if(r.levelIsComplete(n,e))return c;d();var h=function(){if(!o){o=_n();for(var t=0;t<e.length;t++)Nn(o,e[t].boundingBox())}return o},p=function(e){var t=(e=e||{}).after;if(h(),o.w*u*(o.h*u)>ch)return null;var a=r.makeLayer(o,n);if(null!=t){var i=c.indexOf(t)+1;c.splice(i,0,a)}else(void 0===e.insert||e.insert)&&c.unshift(a);return a};if(r.skipping&&!i)return null;for(var f=null,g=e.length/Qd,v=!i,y=0;y<e.length;y++){var m=e[y],b=m._private.rscratch,x=b.imgLayerCaches=b.imgLayerCaches||{},w=x[n];if(w)f=w;else{if((!f||f.eles.length>=g||!Fn(f.bb,m.boundingBox()))&&!(f=p({insert:!0,after:f})))return null;s||v?r.queueLayer(f,m):r.drawEleInLayer(f,m,n,t),f.eles.push(m),x[n]=f}}return s||(v?null:c)},ph.getEleLevelForLayerLevel=function(e,t){return e},ph.drawEleInLayer=function(e,t,n,r){var a=this,i=this.renderer,o=e.context,s=t.boundingBox();0!==s.w&&0!==s.h&&t.visible()&&(n=a.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(o,!1),i.drawCachedElement(o,t,null,null,n,dh),i.setImgSmoothing(o,!0))},ph.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,a=0;a<n.length;a++){var i=n[a];if(i.reqs>0)return!1;if(i.invalid)return!1;r+=i.eles.length}return r===t.length},ph.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var a=n[r],i=-1,o=0;o<t.length;o++)if(a.eles[0]===t[o]){i=o;break}if(i<0)this.invalidateLayer(a);else{var s=i;for(o=0;o<a.eles.length;o++)if(a.eles[o]!==t[s+o]){this.invalidateLayer(a);break}}}},ph.updateElementsInLayers=function(e,t){for(var n=this,r=P(e[0]),a=0;a<e.length;a++)for(var i=r?null:e[a],o=r?e[a]:e[a].ele,s=o._private.rscratch,l=s.imgLayerCaches=s.imgLayerCaches||{},u=Jd;u<=eh;u++){var c=l[u];c&&(i&&n.getEleLevelForLayerLevel(c.level)!==i.level||t(c,o,i))}},ph.haveLayers=function(){for(var e=this,t=!1,n=Jd;n<=eh;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t},ph.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=rt(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},ph.invalidateLayer=function(e){if(this.lastInvalidationTime=rt(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Ot(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a<n.length;a++){var i=n[a]._private.rscratch.imgLayerCaches;i&&(i[t]=null)}}},ph.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,(function(e,n,r){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])}))},ph.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},ph.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,a=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(a[t.id()])return;r.push(t),a[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},ph.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],a=0;a<lh&&0!==n.size();){var i=n.peek();if(i.replacement)n.pop();else if(i.replaces&&i!==i.replaces.replacement)n.pop();else if(i.invalid)n.pop();else{var o=i.elesQueue.shift();o&&(t.drawEleInLayer(i,o,i.level,e),a++),0===r.length&&r.push(!0),0===i.elesQueue.length&&(n.pop(),i.reqs=0,i.replaces&&t.applyLayerReplacement(i),t.requestRedraw())}}return r},ph.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,a=n.indexOf(r);if(!(a<0||r.invalid)){n[a]=e;for(var i=0;i<e.eles.length;i++){var o=e.eles[i]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[e.level]=e)}t.requestRedraw()}},ph.requestRedraw=Qe((function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()}),100),ph.setupDequeueing=Pd.setupDequeueing({deqRedrawThreshold:nh,deqCost:ah,deqAvgCost:ih,deqNoDrawCost:oh,deqFastCost:sh,deq:function(e,t){return e.dequeue(t)},onDeqd:Ct,shouldRedraw:wt,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var vh,yh={};function mh(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function bh(e,t,n){for(var r,a=0;a<t.length;a++){var i=t[a];0===a&&(r=i),e.lineTo(i.x,i.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function xh(e,t,n){e.beginPath&&e.beginPath();for(var r=t,a=0;a<r.length;a++){var i=r[a];e.lineTo(i.x,i.y)}var o=n,s=n[0];for(e.moveTo(s.x,s.y),a=1;a<o.length;a++)i=o[a],e.lineTo(i.x,i.y);e.closePath&&e.closePath()}function wh(e,t,n,r,a){e.beginPath&&e.beginPath(),e.arc(n,r,a,0,2*Math.PI,!1);var i=t,o=i[0];e.moveTo(o.x,o.y);for(var s=0;s<i.length;s++){var l=i[s];e.lineTo(l.x,l.y)}e.closePath&&e.closePath()}function Eh(e,t,n,r){e.arc(t,n,r,0,2*Math.PI,!1)}yh.arrowShapeImpl=function(e){return(vh||(vh={polygon:mh,"triangle-backcurve":bh,"triangle-tee":xh,"circle-triangle":wh,"triangle-cross":xh,circle:Eh}))[e]};var kh={drawElement:function(e,t,n,r,a,i){var o=this;t.isNode()?o.drawNode(e,t,n,r,a,i):o.drawEdge(e,t,n,r,a,i)},drawElementOverlay:function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)},drawElementUnderlay:function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)},drawCachedElementPortion:function(e,t,n,r,a,i,o,s){var l=this,u=n.getBoundingBox(t);if(0!==u.w&&0!==u.h){var c=n.getElement(t,u,r,a,i);if(null!=c){var d=s(l,t);if(0===d)return;var h,p,f,g,v,y,m=o(l,t),b=u.x1,x=u.y1,w=u.w,E=u.h;if(0!==m){var k=n.getRotationPoint(t);f=k.x,g=k.y,e.translate(f,g),e.rotate(m),(v=l.getImgSmoothing(e))||l.setImgSmoothing(e,!0);var C=n.getRotationOffset(t);h=C.x,p=C.y}else h=b,p=x;1!==d&&(y=e.globalAlpha,e.globalAlpha=y*d),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,h,p,w,E),1!==d&&(e.globalAlpha=y),0!==m&&(e.rotate(-m),e.translate(-f,-g),v||l.setImgSmoothing(e,!1))}else n.drawElement(e,t)}}},Ch=function(){return 0},Sh=function(e,t){return e.getTextAngle(t,null)},Dh=function(e,t){return e.getTextAngle(t,"source")},Th=function(e,t){return e.getTextAngle(t,"target")},Ph=function(e,t){return t.effectiveOpacity()},_h=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};kh.drawCachedElement=function(e,t,n,r,a,i){var o=this,s=o.data,l=s.eleTxrCache,u=s.lblTxrCache,c=s.slbTxrCache,d=s.tlbTxrCache,h=t.boundingBox(),p=!0===i?l.reasons.highQuality:null;if(0!==h.w&&0!==h.h&&t.visible()&&(!r||Ln(h,r))){var f=t.isEdge(),g=t.element()._private.rscratch.badLine;o.drawElementUnderlay(e,t),o.drawCachedElementPortion(e,t,l,n,a,p,Ch,Ph),f&&g||o.drawCachedElementPortion(e,t,u,n,a,p,Sh,_h),f&&!g&&(o.drawCachedElementPortion(e,t,c,n,a,p,Dh,_h),o.drawCachedElementPortion(e,t,d,n,a,p,Th,_h)),o.drawElementOverlay(e,t)}},kh.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var a=t[r];n.drawElement(e,a)}},kh.drawCachedElements=function(e,t,n,r){for(var a=this,i=0;i<t.length;i++){var o=t[i];a.drawCachedElement(e,o,n,r)}},kh.drawCachedNodes=function(e,t,n,r){for(var a=this,i=0;i<t.length;i++){var o=t[i];o.isNode()&&a.drawCachedElement(e,o,n,r)}},kh.drawLayeredElements=function(e,t,n,r){var a=this,i=a.data.lyrTxrCache.getLayers(t,n);if(i)for(var o=0;o<i.length;o++){var s=i[o],l=s.bb;0!==l.w&&0!==l.h&&e.drawImage(s.canvas,l.x1,l.y1,l.w,l.h)}else a.drawCachedElements(e,t,n,r)};var Mh={drawEdge:function(e,t,n){var r=!(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],o=this,s=t._private.rscratch;if((!i||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=i?t.pstyle("opacity").value:1,c=i?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,f=t.pstyle("line-cap").value,g=u*c,v=u*c,y=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g;"straight-triangle"===d?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=f,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},m=function(){a&&o.drawEdgeOverlay(e,t)},b=function(){a&&o.drawEdgeUnderlay(e,t)},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v;o.drawArrowheads(e,t,n)},w=function(){o.drawElementText(e,t,null,r)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var E=t.pstyle("ghost-offset-x").pfValue,k=t.pstyle("ghost-offset-y").pfValue,C=t.pstyle("ghost-opacity").value,S=g*C;e.translate(E,k),y(S),x(S),e.translate(-E,-k)}b(),y(),x(),m(),w(),n&&e.translate(l.x1,l.y1)}}},Bh=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var a=this,i=a.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||i?t.lineCap="round":t.lineCap="butt",a.colorStrokeStyle(t,l[0],l[1],l[2],r),a.drawEdgePath(n,t,o.allpts,"solid")}}}};Mh.drawEdgeOverlay=Bh("overlay"),Mh.drawEdgeUnderlay=Bh("underlay"),Mh.drawEdgePath=function(e,t,n,r){var a,i=e._private.rscratch,o=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var d=n.join("$");i.pathCacheKey&&i.pathCacheKey===d?(a=t=i.pathCache,s=!0):(a=t=new Path2D,i.pathCacheKey=d,i.pathCache=a)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=c;break;case"solid":o.setLineDash([])}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+3<n.length;h+=4)t.quadraticCurveTo(n[h],n[h+1],n[h+2],n[h+3]);break;case"straight":case"segments":case"haystack":for(var p=2;p+1<n.length;p+=2)t.lineTo(n[p],n[p+1])}t=o,l?t.stroke(a):t.stroke(),t.setLineDash&&t.setLineDash([])},Mh.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,a=0;a+1<n.length;a+=2){var i=[n[a+2]-n[a],n[a+3]-n[a+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],l=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[a]-l[0],n[a+1]-l[1]),t.lineTo(n[a]+l[0],n[a+1]+l[1]),t.lineTo(n[a+2],n[a+3]),t.closePath(),t.fill()}},Mh.drawArrowheads=function(e,t,n){var r=t._private.rscratch,a="haystack"===r.edgeType;a||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),a||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},Mh.drawArrowhead=function(e,t,n,r,a,i,o){if(!(isNaN(r)||null==r||isNaN(a)||null==a||isNaN(i)||null==i)){var s=this,l=t.pstyle(n+"-arrow-shape").value;if("none"!==l){var u="hollow"===t.pstyle(n+"-arrow-fill").value?"both":"filled",c=t.pstyle(n+"-arrow-fill").value,d=t.pstyle("width").pfValue,h=t.pstyle("opacity").value;void 0===o&&(o=h);var p=e.globalCompositeOperation;1===o&&"hollow"!==c||(e.globalCompositeOperation="destination-out",s.colorFillStyle(e,255,255,255,1),s.colorStrokeStyle(e,255,255,255,1),s.drawArrowShape(t,e,u,d,l,r,a,i),e.globalCompositeOperation=p);var f=t.pstyle(n+"-arrow-color").value;s.colorFillStyle(e,f[0],f[1],f[2],o),s.colorStrokeStyle(e,f[0],f[1],f[2],o),s.drawArrowShape(t,e,c,d,l,r,a,i)}}},Mh.drawArrowShape=function(e,t,n,r,a,i,o,s){var l,u=this,c=this.usePaths()&&"triangle-cross"!==a,d=!1,h=t,p={x:i,y:o},f=e.pstyle("arrow-scale").value,g=this.getArrowWidth(r,f),v=u.arrowShapes[a];if(c){var y=u.arrowPathCache=u.arrowPathCache||[],m=ft(a),b=y[m];null!=b?(l=t=b,d=!0):(l=t=new Path2D,y[m]=l)}d||(t.beginPath&&t.beginPath(),c?v.draw(t,1,0,{x:0,y:0},1):v.draw(t,g,s,p,r),t.closePath&&t.closePath()),t=h,c&&(t.translate(i,o),t.rotate(s),t.scale(g,g)),"filled"!==n&&"both"!==n||(c?t.fill(l):t.fill()),"hollow"!==n&&"both"!==n||(t.lineWidth=(v.matchEdgeWidth?r:1)/(c?g:1),t.lineJoin="miter",c?t.stroke(l):t.stroke()),c&&(t.scale(1/g,1/g),t.rotate(-s),t.translate(-i,-o))};var Nh={safeDrawImage:function(e,t,n,r,a,i,o,s,l,u){if(!(a<=0||i<=0||l<=0||u<=0))try{e.drawImage(t,n,r,a,i,o,s,l,u)}catch(c){Tt(c)}},drawInscribedImage:function(e,t,n,r,a){var i=this,o=n.position(),s=o.x,l=o.y,u=n.cy().style(),c=u.getIndexedStyle.bind(u),d=c(n,"background-fit","value",r),h=c(n,"background-repeat","value",r),p=n.width(),f=n.height(),g=2*n.padding(),v=p+("inner"===c(n,"background-width-relative-to","value",r)?0:g),y=f+("inner"===c(n,"background-height-relative-to","value",r)?0:g),m=n._private.rscratch,b="node"===c(n,"background-clip","value",r),x=c(n,"background-image-opacity","value",r)*a,w=c(n,"background-image-smoothing","value",r),E=t.width||t.cachedW,k=t.height||t.cachedH;null!=E&&null!=k||(document.body.appendChild(t),E=t.cachedW=t.width||t.offsetWidth,k=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var C=E,S=k;if("auto"!==c(n,"background-width","value",r)&&(C="%"===c(n,"background-width","units",r)?c(n,"background-width","pfValue",r)*v:c(n,"background-width","pfValue",r)),"auto"!==c(n,"background-height","value",r)&&(S="%"===c(n,"background-height","units",r)?c(n,"background-height","pfValue",r)*y:c(n,"background-height","pfValue",r)),0!==C&&0!==S){if("contain"===d)C*=D=Math.min(v/C,y/S),S*=D;else if("cover"===d){var D;C*=D=Math.max(v/C,y/S),S*=D}var T=s-v/2,P=c(n,"background-position-x","units",r),_=c(n,"background-position-x","pfValue",r);T+="%"===P?(v-C)*_:_;var M=c(n,"background-offset-x","units",r),B=c(n,"background-offset-x","pfValue",r);T+="%"===M?(v-C)*B:B;var N=l-y/2,A=c(n,"background-position-y","units",r),I=c(n,"background-position-y","pfValue",r);N+="%"===A?(y-S)*I:I;var O=c(n,"background-offset-y","units",r),z=c(n,"background-offset-y","pfValue",r);N+="%"===O?(y-S)*z:z,m.pathCache&&(T-=s,N-=l,s=0,l=0);var L=e.globalAlpha;e.globalAlpha=x;var R=i.getImgSmoothing(e),V=!1;if("no"===w&&R?(i.setImgSmoothing(e,!1),V=!0):"yes"!==w||R||(i.setImgSmoothing(e,!0),V=!0),"no-repeat"===h)b&&(e.save(),m.pathCache?e.clip(m.pathCache):(i.nodeShapes[i.getNodeShape(n)].draw(e,s,l,v,y),e.clip())),i.safeDrawImage(e,t,0,0,E,k,T,N,C,S),b&&e.restore();else{var F=e.createPattern(t,h);e.fillStyle=F,i.nodeShapes[i.getNodeShape(n)].draw(e,s,l,v,y),e.translate(T,N),e.fill(),e.translate(-T,-N)}e.globalAlpha=L,V&&i.setImgSmoothing(e,R)}}},Ah={};function Ih(e,t,n,r,a){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5;e.beginPath(),e.moveTo(t+i,n),e.lineTo(t+r-i,n),e.quadraticCurveTo(t+r,n,t+r,n+i),e.lineTo(t+r,n+a-i),e.quadraticCurveTo(t+r,n+a,t+r-i,n+a),e.lineTo(t+i,n+a),e.quadraticCurveTo(t,n+a,t,n+a-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath(),e.fill()}Ah.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(xn(n*r));t=Math.pow(2,a)}return!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},Ah.drawElementText=function(e,t,n,r,a){var i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(i&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,f=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==a?(o.drawText(e,t,null,f,i),t.isEdge()&&(o.drawText(e,t,"source",f,i),o.drawText(e,t,"target",f,i))):o.drawText(e,t,a,f,i),n&&e.translate(p.x1,p.y1)},Ah.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if((t=this.fontCaches[n]).context===e)return t;return t={context:e},this.fontCaches.push(t),t},Ah.setupTextStyle=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=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=n?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=r+" "+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)},Ah.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",a=e.pstyle(r+"text-rotation"),i=Rt(n,"labelAngle",t);return"autorotate"===a.strValue?e.isEdge()?i:0:"none"===a.strValue?0:a.pfValue},Ah.drawText=function(e,t,n){var r=!(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"===n&&(n=null);var s,l,u=Rt(i,"labelX",n),c=Rt(i,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,a);var h,p=n?n+"-":"",f=Rt(i,"labelWidth",n),g=Rt(i,"labelHeight",n),v=t.pstyle(p+"text-margin-x").pfValue,y=t.pstyle(p+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle("text-halign").value,x=t.pstyle("text-valign").value;switch(m&&(b="center",x="center"),u+=v,c+=y,0!==(h=r?this.getTextAngle(t,n):0)&&(s=u,l=c,e.translate(s,l),e.rotate(h),u=0,c=0),x){case"top":break;case"center":c+=g/2;break;case"bottom":c+=g}var w=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,k=t.pstyle("text-border-width").pfValue,C=t.pstyle("text-background-padding").pfValue;if(w>0||k>0&&E>0){var S=u-C;switch(b){case"left":S-=f;break;case"center":S-=f/2}var D=c-g-C,T=f+2*C,P=g+2*C;if(w>0){var _=e.fillStyle,M=t.pstyle("text-background-color").value;e.fillStyle="rgba("+M[0]+","+M[1]+","+M[2]+","+w*o+")",0===t.pstyle("text-background-shape").strValue.indexOf("round")?Ih(e,S,D,T,P,2):e.fillRect(S,D,T,P),e.fillStyle=_}if(k>0&&E>0){var B=e.strokeStyle,N=e.lineWidth,A=t.pstyle("text-border-color").value,I=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+A[0]+","+A[1]+","+A[2]+","+E*o+")",e.lineWidth=k,e.setLineDash)switch(I){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=k/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(S,D,T,P),"double"===I){var O=k/2;e.strokeRect(S+O,D+O,T-2*O,P-2*O)}e.setLineDash&&e.setLineDash([]),e.lineWidth=N,e.strokeStyle=B}}var z=2*t.pstyle("text-outline-width").pfValue;if(z>0&&(e.lineWidth=z),"wrap"===t.pstyle("text-wrap").value){var L=Rt(i,"labelWrapCachedLines",n),R=Rt(i,"labelLineHeight",n),V=f/2,F=this.getLabelJustification(t);switch("auto"===F||("left"===b?"left"===F?u+=-f:"center"===F&&(u+=-V):"center"===b?"left"===F?u+=-V:"right"===F&&(u+=V):"right"===b&&("center"===F?u+=V:"right"===F&&(u+=f))),x){case"top":case"center":case"bottom":c-=(L.length-1)*R}for(var j=0;j<L.length;j++)z>0&&e.strokeText(L[j],u,c),e.fillText(L[j],u,c),c+=R}else z>0&&e.strokeText(d,u,c),e.fillText(d,u,c);0!==h&&(e.rotate(-h),e.translate(-s,-l))}}};var Oh={drawNode:function(e,t,n){var r,a,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(C(d.x)&&C(d.y)&&(!s||t.visible())){var h,p,f=s?t.effectiveOpacity():1,g=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,a=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image").value,b=new Array(m.length),x=new Array(m.length),w=0,E=0;E<m.length;E++){var k=m[E];if(b[E]=null!=k&&"none"!==k){var S=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",E);w++,x[E]=l.getCachedImage(k,S,(function(){u.backgroundTimestamp=Date.now(),t.emitAndNotify("background")}))}}var D=t.pstyle("background-blacken").value,T=t.pstyle("border-width").pfValue,P=t.pstyle("background-opacity").value*f,_=t.pstyle("border-color").value,M=t.pstyle("border-style").value,B=t.pstyle("border-opacity").value*f;e.lineJoin="miter";var N=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:P;l.eleFillStyle(e,t,n)},A=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:B;l.colorStrokeStyle(e,_[0],_[1],_[2],t)},I=t.pstyle("shape").strValue,O=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(d.x,d.y);var z=l.nodePathCache=l.nodePathCache||[],L=gt("polygon"===I?I+","+O.join(","):I,""+a,""+r),R=z[L];null!=R?(h=R,v=!0,c.pathCache=h):(h=new Path2D,z[L]=c.pathCache=h)}var V=function(){if(!v){var n=d;g&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(h||e,n.x,n.y,r,a)}g?e.fill(h):e.fill()},F=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=u.backgrounding,i=0,o=0;o<x.length;o++){var s=t.cy().style().getIndexedStyle(t,"background-image-containment","value",o);r&&"over"===s||!r&&"inside"===s?i++:b[o]&&x[o].complete&&!x[o].error&&(i++,l.drawInscribedImage(e,x[o],t,o,n))}u.backgrounding=!(i===w),a!==u.backgrounding&&t.updateStyle(!1)},j=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;l.hasPie(t)&&(l.drawPie(e,t,i),n&&(g||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,a)))},q=function(){var t=(D>0?D:-D)*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:f),n=D>0?0:255;0!==D&&(l.colorFillStyle(e,n,n,n,t),g?e.fill(h):e.fill())},X=function(){if(T>0){if(e.lineWidth=T,e.lineCap="butt",e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(g?e.stroke(h):e.stroke(),"double"===M){e.lineWidth=T/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(h):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}},Y=function(){o&&l.drawNodeOverlay(e,t,d,r,a)},W=function(){o&&l.drawNodeUnderlay(e,t,d,r,a)},H=function(){l.drawElementText(e,t,null,i)};if("yes"===t.pstyle("ghost").value){var G=t.pstyle("ghost-offset-x").pfValue,K=t.pstyle("ghost-offset-y").pfValue,U=t.pstyle("ghost-opacity").value,Z=U*f;e.translate(G,K),N(U*P),V(),F(Z,!0),A(U*B),X(),j(0!==D||0!==T),F(Z,!1),q(Z),e.translate(-G,-K)}g&&e.translate(-d.x,-d.y),W(),g&&e.translate(d.x,d.y),N(),V(),F(f,!0),A(),X(),j(0!==D||0!==T),F(f,!1),q(),g&&e.translate(-d.x,-d.y),H(),Y(),n&&e.translate(p.x1,p.y1)}}},zh=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,a,i){var o=this;if(n.visible()){var s=n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-opacity")).value,u=n.pstyle("".concat(e,"-color")).value,c=n.pstyle("".concat(e,"-shape")).value;if(l>0){if(r=r||n.position(),null==a||null==i){var d=n.padding();a=n.width()+2*d,i=n.height()+2*d}o.colorFillStyle(t,u[0],u[1],u[2],l),o.nodeShapes[c].draw(t,r.x,r.y,a+2*s,i+2*s),t.fill()}}}};Oh.drawNodeOverlay=zh("overlay"),Oh.drawNodeUnderlay=zh("underlay"),Oh.hasPie=function(e){return(e=e[0])._private.hasPie},Oh.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,d=0;this.usePaths()&&(o=0,s=0),"%"===i.units?c*=i.pfValue:void 0!==i.pfValue&&(c=i.pfValue/2);for(var h=1;h<=a.pieBackgroundN;h++){var p=t.pstyle("pie-"+h+"-background-size").value,f=t.pstyle("pie-"+h+"-background-color").value,g=t.pstyle("pie-"+h+"-background-opacity").value*n,v=p/100;v+d>1&&(v=1-d);var y=1.5*Math.PI+2*Math.PI*d,m=y+2*Math.PI*v;0===p||d>=1||d+v>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,f[0],f[1],f[2],g),e.fill(),d+=v)}};var Lh={},Rh=100;Lh.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},Lh.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,a=0;a<n.length;a++)if((t=n[a]).context===e){r=!1;break}return r&&(t={context:e},n.push(t)),t},Lh.createGradientStyleFor=function(e,t,n,r,a){var i,o=this.usePaths(),s=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===r)if(n.isEdge()){var u=n.sourceEndpoint(),c=n.targetEndpoint(),d=n.midpoint(),h=En(u,d),p=En(c,d);i=e.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(h,p))}else{var f=o?{x:0,y:0}:n.position(),g=n.paddedWidth(),v=n.paddedHeight();i=e.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(g,v))}else if(n.isEdge()){var y=n.sourceEndpoint(),m=n.targetEndpoint();i=e.createLinearGradient(y.x,y.y,m.x,m.y)}else{var b=o?{x:0,y:0}:n.position(),x=n.paddedWidth()/2,w=n.paddedHeight()/2;switch(n.pstyle("background-gradient-direction").value){case"to-bottom":i=e.createLinearGradient(b.x,b.y-w,b.x,b.y+w);break;case"to-top":i=e.createLinearGradient(b.x,b.y+w,b.x,b.y-w);break;case"to-left":i=e.createLinearGradient(b.x+x,b.y,b.x-x,b.y);break;case"to-right":i=e.createLinearGradient(b.x-x,b.y,b.x+x,b.y);break;case"to-bottom-right":case"to-right-bottom":i=e.createLinearGradient(b.x-x,b.y-w,b.x+x,b.y+w);break;case"to-top-right":case"to-right-top":i=e.createLinearGradient(b.x-x,b.y+w,b.x+x,b.y-w);break;case"to-bottom-left":case"to-left-bottom":i=e.createLinearGradient(b.x+x,b.y-w,b.x-x,b.y+w);break;case"to-top-left":case"to-left-top":i=e.createLinearGradient(b.x+x,b.y+w,b.x-x,b.y-w)}}if(!i)return null;for(var E=l.length===s.length,k=s.length,C=0;C<k;C++)i.addColorStop(E?l[C]:C/(k-1),"rgba("+s[C][0]+","+s[C][1]+","+s[C][2]+","+a+")");return i},Lh.gradientFillStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"background",t,n,r);if(!a)return null;e.fillStyle=a},Lh.colorFillStyle=function(e,t,n,r,a){e.fillStyle="rgba("+t+","+n+","+r+","+a+")"},Lh.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientFillStyle(e,t,r,n);else{var a=t.pstyle("background-color").value;this.colorFillStyle(e,a[0],a[1],a[2],n)}},Lh.gradientStrokeStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"line",t,n,r);if(!a)return null;e.strokeStyle=a},Lh.colorStrokeStyle=function(e,t,n,r,a){e.strokeStyle="rgba("+t+","+n+","+r+","+a+")"},Lh.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientStrokeStyle(e,t,r,n);else{var a=t.pstyle("line-color").value;this.colorStrokeStyle(e,a[0],a[1],a[2],n)}},Lh.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),a=r[2],i=r[3],o=t.getPixelRatio(),s=t.motionBlurPxRatio;e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]&&e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG]||(o=s);var l,u=a*o,c=i*o;if(u!==t.canvasWidth||c!==t.canvasHeight){t.fontCaches=null;var d=n.canvasContainer;d.style.width=a+"px",d.style.height=i+"px";for(var h=0;h<t.CANVAS_LAYERS;h++)(l=n.canvases[h]).width=u,l.height=c,l.style.width=a+"px",l.style.height=i+"px";for(h=0;h<t.BUFFER_COUNT;h++)(l=n.bufferCanvases[h]).width=u,l.height=c,l.style.width=a+"px",l.style.height=i+"px";t.textureMult=1,o<=1&&(l=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,l.width=u*t.textureMult,l.height=c*t.textureMult),t.canvasWidth=u,t.canvasHeight=c}},Lh.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},Lh.render=function(e){var t=(e=e||At()).forcedContext,n=e.drawAllLayers,r=e.drawOnlyNodeLayer,a=e.forcedZoom,i=e.forcedPan,o=this,s=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,l=o.cy,u=o.data,c=u.canvasNeedsRedraw,d=o.textureOnViewport&&!t&&(o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming),h=void 0!==e.motionBlur?e.motionBlur:o.motionBlur,p=o.motionBlurPxRatio,f=l.hasCompoundNodes(),g=o.hoverData.draggingEles,v=!(!o.hoverData.selecting&&!o.touchData.selecting),y=h=h&&!t&&o.motionBlurEnabled&&!v;t||(o.prevPxRatio!==s&&(o.invalidateContainerClientCoordsCache(),o.matchCanvasSize(o.container),o.redrawHint("eles",!0),o.redrawHint("drag",!0)),o.prevPxRatio=s),!t&&o.motionBlurTimeout&&clearTimeout(o.motionBlurTimeout),h&&(null==o.mbFrames&&(o.mbFrames=0),o.mbFrames++,o.mbFrames<3&&(y=!1),o.mbFrames>o.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!d&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=void 0!==a?a:b,w=l.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},C=o.prevViewport;void 0===C||k.zoom!==C.zoom||k.pan.x!==C.pan.x||k.pan.y!==C.pan.y||g&&!f||(o.motionBlurPxRatio=1),i&&(E=i),x*=s,E.x*=s,E.y*=s;var S=o.getCachedZSortedEles();function D(e,t,n,r,a){var i=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,a),e.globalCompositeOperation=i}function T(e,r){var s,l,c,d;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=E,l=x,c=o.canvasWidth,d=o.canvasHeight):(s={x:w.x*p,y:w.y*p},l=b*p,c=o.canvasWidth*p,d=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?D(e,0,0,c,d):t||void 0!==r&&!r||e.clearRect(0,0,c,d),n||(e.translate(s.x,s.y),e.scale(l,l)),i&&e.translate(i.x,i.y),a&&e.scale(a,a)}if(d||(o.textureDrawLastFrame=!1),d){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var P=o.data.bufferContexts[o.TEXTURE_BUFFER];P.setTransform(1,0,0,1,0,0),P.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:P,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(k=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var _=u.contexts[o.NODE],M=o.textureCache.texture;k=o.textureCache.viewport,_.setTransform(1,0,0,1,0,0),h?D(_,0,0,k.width,k.height):_.clearRect(0,0,k.width,k.height);var B=m.core("outside-texture-bg-color").value,N=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(_,B[0],B[1],B[2],N),_.fillRect(0,0,k.width,k.height),b=l.zoom(),T(_,!1),_.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s),_.drawImage(M,k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var A=l.extent(),I=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),O=o.hideEdgesOnViewport&&I,z=[];if(z[o.NODE]=!c[o.NODE]&&h&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,z[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),z[o.DRAG]=!c[o.DRAG]&&h&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,z[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||z[o.NODE]){var L=h&&!z[o.NODE]&&1!==p;T(_=t||(L?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),h&&!L?"motionBlur":void 0),O?o.drawCachedNodes(_,S.nondrag,s,A):o.drawLayeredElements(_,S.nondrag,s,A),o.debug&&o.drawDebugPoints(_,S.nondrag),n||h||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||z[o.DRAG])&&(L=h&&!z[o.DRAG]&&1!==p,T(_=t||(L?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]),h&&!L?"motionBlur":void 0),O?o.drawCachedNodes(_,S.drag,s,A):o.drawCachedElements(_,S.drag,s,A),o.debug&&o.drawDebugPoints(_,S.drag),n||h||(c[o.DRAG]=!1)),o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(T(_=t||u.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var R=m.core("selection-box-border-width").value/b;_.lineWidth=R,_.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",_.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),R>0&&(_.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",_.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var V=u.bgActivePosistion;_.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",_.beginPath(),_.arc(V.x,V.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),_.fill()}var F=o.lastRedrawTime;if(o.showFps&&F){F=Math.round(F);var j=Math.round(1e3/F);_.setTransform(1,0,0,1,0,0),_.fillStyle="rgba(255, 0, 0, 0.75)",_.strokeStyle="rgba(255, 0, 0, 0.75)",_.lineWidth=1,_.fillText("1 frame = "+F+" ms = "+j+" fps",0,20);var q=60;_.strokeRect(0,30,250,20),_.fillRect(0,30,250*Math.min(j/q,1),20)}n||(c[o.SELECT_BOX]=!1)}if(h&&1!==p){var X=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],W=u.contexts[o.DRAG],H=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],G=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):D(e,0,0,o.canvasWidth,o.canvasHeight);var r=p;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||z[o.NODE])&&(G(X,Y,z[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||z[o.DRAG])&&(G(W,H,z[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=k,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),h&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!d,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()}),Rh)),t||l.emit("render")};for(var Vh={drawPolygonPath:function(e,t,n,r,a,i){var o=r/2,s=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*i[0],n+s*i[1]);for(var l=1;l<i.length/2;l++)e.lineTo(t+o*i[2*l],n+s*i[2*l+1]);e.closePath()},drawRoundPolygonPath:function(e,t,n,r,a,i){var o=r/2,s=a/2,l=dr(r,a);e.beginPath&&e.beginPath();for(var u=0;u<i.length/4;u++){var c=void 0,d=void 0;c=0===u?i.length-2:4*u-2,d=4*u+2;var h=t+o*i[4*u],p=n+s*i[4*u+1],f=-i[c]*i[d]-i[c+1]*i[d+1],g=l/Math.tan(Math.acos(f)/2),v=h-g*i[c],y=p-g*i[c+1],m=h+g*i[d],b=p+g*i[d+1];0===u?e.moveTo(v,y):e.lineTo(v,y),e.arcTo(h,p,m,b,l)}e.closePath()},drawRoundRectanglePath:function(e,t,n,r,a){var i=r/2,o=a/2,s=cr(r,a);e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.arcTo(t+i,n-o,t+i,n,s),e.arcTo(t+i,n+o,t,n+o,s),e.arcTo(t-i,n+o,t-i,n,s),e.arcTo(t-i,n-o,t,n-o,s),e.lineTo(t,n-o),e.closePath()},drawBottomRoundRectanglePath:function(e,t,n,r,a){var i=r/2,o=a/2,s=cr(r,a);e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.lineTo(t+i,n-o),e.lineTo(t+i,n),e.arcTo(t+i,n+o,t,n+o,s),e.arcTo(t-i,n+o,t-i,n,s),e.lineTo(t-i,n-o),e.lineTo(t,n-o),e.closePath()},drawCutRectanglePath:function(e,t,n,r,a){var i=r/2,o=a/2,s=hr();e.beginPath&&e.beginPath(),e.moveTo(t-i+s,n-o),e.lineTo(t+i-s,n-o),e.lineTo(t+i,n-o+s),e.lineTo(t+i,n+o-s),e.lineTo(t+i-s,n+o),e.lineTo(t-i+s,n+o),e.lineTo(t-i,n+o-s),e.lineTo(t-i,n-o+s),e.closePath()},drawBarrelPath:function(e,t,n,r,a){var i=r/2,o=a/2,s=t-i,l=t+i,u=n-o,c=n+o,d=fr(r,a),h=d.widthOffset,p=d.heightOffset,f=d.ctrlPtOffsetPct*h;e.beginPath&&e.beginPath(),e.moveTo(s,u+p),e.lineTo(s,c-p),e.quadraticCurveTo(s+f,c,s+h,c),e.lineTo(l-h,c),e.quadraticCurveTo(l-f,c,l,c-p),e.lineTo(l,u+p),e.quadraticCurveTo(l-f,u,l-h,u),e.lineTo(s+h,u),e.quadraticCurveTo(s+f,u,s,u+p),e.closePath()}},Fh=Math.sin(0),jh=Math.cos(0),qh={},Xh={},Yh=Math.PI/40,Wh=0*Math.PI;Wh<2*Math.PI;Wh+=Yh)qh[Wh]=Math.sin(Wh),Xh[Wh]=Math.cos(Wh);Vh.drawEllipsePath=function(e,t,n,r,a){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,a/2,0,0,2*Math.PI);else for(var i,o,s=r/2,l=a/2,u=0*Math.PI;u<2*Math.PI;u+=Yh)i=t-s*qh[u]*Fh+s*Xh[u]*jh,o=n+l*Xh[u]*Fh+l*qh[u]*jh,0===u?e.moveTo(i,o):e.lineTo(i,o);e.closePath()};var Hh={};function Gh(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return new Blob([r],{type:t})}function Kh(e){var t=e.indexOf(",");return e.substr(t+1)}function Uh(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new ja((function(r,a){try{t.toBlob((function(e){null!=e?r(e):a(new Error("`canvas.toBlob()` sent a null value in its callback"))}),n,e.quality)}catch(i){a(i)}}));case"blob":return Gh(Kh(r()),n);case"base64":return Kh(r());default:return r()}}Hh.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},Hh.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),a=e.full?Math.ceil(n.w):r[2],i=e.full?Math.ceil(n.h):r[3],o=C(e.maxWidth)||C(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;C(e.maxWidth)&&(u=l*e.maxWidth/a),C(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 p=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var f=t.pan(),g={x:f.x*l,y:f.y*l};l*=t.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,p),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},Hh.png=function(e){return Uh(e,this.bufferCanvasImage(e),"image/png")},Hh.jpg=function(e){return Uh(e,this.bufferCanvasImage(e),"image/jpeg")};var Zh={nodeShapeImpl:function(e,t,n,r,a,i,o){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,a,i);case"polygon":return this.drawPolygonPath(t,n,r,a,i,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,a,i,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,a,i);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,a,i);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,a,i);case"barrel":return this.drawBarrelPath(t,n,r,a,i)}}},$h=Jh,Qh=Jh.prototype;function Jh(e){var t=this;t.data={canvases:new Array(Qh.CANVAS_LAYERS),contexts:new Array(Qh.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Qh.CANVAS_LAYERS),bufferCanvases:new Array(Qh.BUFFER_COUNT),bufferContexts:new Array(Qh.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",r="rgba(0,0,0,0)";t.data.canvasContainer=document.createElement("div");var a=t.data.canvasContainer.style;t.data.canvasContainer.style[n]=r,a.position="relative",a.zIndex="0",a.overflow="hidden";var i=e.cy.container();i.appendChild(t.data.canvasContainer),i.style[n]=r;var o={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};L()&&(o["-ms-touch-action"]="none",o["touch-action"]="none");for(var s=0;s<Qh.CANVAS_LAYERS;s++){var l=t.data.canvases[s]=document.createElement("canvas");t.data.contexts[s]=l.getContext("2d"),Object.keys(o).forEach((function(e){l.style[e]=o[e]})),l.style.position="absolute",l.setAttribute("data-id","layer"+s),l.style.zIndex=String(Qh.CANVAS_LAYERS-s),t.data.canvasContainer.appendChild(l),t.data.canvasNeedsRedraw[s]=!1}for(t.data.topCanvas=t.data.canvases[0],t.data.canvases[Qh.NODE].setAttribute("data-id","layer"+Qh.NODE+"-node"),t.data.canvases[Qh.SELECT_BOX].setAttribute("data-id","layer"+Qh.SELECT_BOX+"-selectbox"),t.data.canvases[Qh.DRAG].setAttribute("data-id","layer"+Qh.DRAG+"-drag"),s=0;s<Qh.BUFFER_COUNT;s++)t.data.bufferCanvases[s]=document.createElement("canvas"),t.data.bufferContexts[s]=t.data.bufferCanvases[s].getContext("2d"),t.data.bufferCanvases[s].style.position="absolute",t.data.bufferCanvases[s].setAttribute("data-id","buffer"+s),t.data.bufferCanvases[s].style.zIndex=String(-s-1),t.data.bufferCanvases[s].style.visibility="hidden";t.pathsEnabled=!0;var u=_n(),c=function(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}},d=function(e){return{x:-e.w/2,y:-e.h/2}},h=function(e){var t=e[0]._private;return!(t.oldBackgroundTimestamp===t.backgroundTimestamp)},p=function(e){return e[0]._private.nodeKey},f=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,n,r,a,i){return t.drawElement(e,n,r,!1,!1,i)},m=function(e,n,r,a,i){return t.drawElementText(e,n,r,a,"main",i)},b=function(e,n,r,a,i){return t.drawElementText(e,n,r,a,"source",i)},x=function(e,n,r,a,i){return t.drawElementText(e,n,r,a,"target",i)},w=function(e){return e.boundingBox(),e[0]._private.bodyBounds},E=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||u},k=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||u},C=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||u},S=function(e,t){return t},D=function(e){return c(w(e))},T=function(e,t,n){var r=e?e+"-":"";return{x:t.x+n.pstyle(r+"text-margin-x").pfValue,y:t.y+n.pstyle(r+"text-margin-y").pfValue}},P=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},_=function(e){return T("",P(e,"labelX","labelY"),e)},M=function(e){return T("source",P(e,"sourceLabelX","sourceLabelY"),e)},B=function(e){return T("target",P(e,"targetLabelX","targetLabelY"),e)},N=function(e){return d(w(e))},A=function(e){return d(k(e))},I=function(e){return d(C(e))},O=function(e){var t=E(e),n=d(E(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":n.x=-t.w;break;case"right":n.x=0}switch(e.pstyle("text-valign").value){case"top":n.y=-t.h;break;case"bottom":n.y=0}}return n},z=t.data.eleTxrCache=new Zd(t,{getKey:p,doesEleInvalidateKey:h,drawElement:y,getBoundingBox:w,getRotationPoint:D,getRotationOffset:N,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),R=t.data.lblTxrCache=new Zd(t,{getKey:f,drawElement:m,getBoundingBox:E,getRotationPoint:_,getRotationOffset:O,isVisible:S}),V=t.data.slbTxrCache=new Zd(t,{getKey:g,drawElement:b,getBoundingBox:k,getRotationPoint:M,getRotationOffset:A,isVisible:S}),F=t.data.tlbTxrCache=new Zd(t,{getKey:v,drawElement:x,getBoundingBox:C,getRotationPoint:B,getRotationOffset:I,isVisible:S}),j=t.data.lyrTxrCache=new hh(t);t.onUpdateEleCalcs((function(e,t){z.invalidateElements(t),R.invalidateElements(t),V.invalidateElements(t),F.invalidateElements(t),j.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}}));var q=function(e){for(var t=0;t<e.length;t++)j.enqueueElementRefinement(e[t].ele)};z.onDequeue(q),R.onDequeue(q),V.onDequeue(q),F.onDequeue(q)}Qh.CANVAS_LAYERS=3,Qh.SELECT_BOX=0,Qh.DRAG=1,Qh.NODE=2,Qh.BUFFER_COUNT=3,Qh.TEXTURE_BUFFER=0,Qh.MOTIONBLUR_BUFFER_NODE=1,Qh.MOTIONBLUR_BUFFER_DRAG=2,Qh.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[Qh.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[Qh.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[Qh.SELECT_BOX]=t}};var ep="undefined"!==typeof Path2D;Qh.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},Qh.usePaths=function(){return ep&&this.pathsEnabled},Qh.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},Qh.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},Qh.makeOffscreenCanvas=function(t,n){var r;return"undefined"!==("undefined"===typeof OffscreenCanvas?"undefined":e(OffscreenCanvas))?r=new OffscreenCanvas(t,n):((r=document.createElement("canvas")).width=t,r.height=n),r},[yh,kh,Mh,Nh,Ah,Oh,Lh,Vh,Hh,Zh].forEach((function(e){Q(Qh,e)}));var tp=[{type:"layout",extensions:Qc},{type:"renderer",extensions:[{name:"null",impl:Jc},{name:"base",impl:Sd},{name:"canvas",impl:$h}]}],np={},rp={};function ap(e,t,n){var r=n,a=function(n){Tt("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if("core"===e){if(cc.prototype[t])return a(t);cc.prototype[t]=n}else if("collection"===e){if(Cu.prototype[t])return a(t);Cu.prototype[t]=n}else if("layout"===e){for(var i=function(e){this.options=e,n.call(this,e),E(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(n.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=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return 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)}};Q(o,{createEmitter:function(){return this._private.emitter=new jl(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}}),ps.eventAliasesOn(o),r=i}else if("renderer"===e&&"null"!==t&&"base"!==t){var p=ip("renderer","base"),f=p.prototype,g=n,v=n.prototype,y=function(){p.apply(this,arguments),g.apply(this,arguments)},m=y.prototype;for(var b in f){var x=f[b];if(null!=v[b])return a(b);m[b]=x}for(var w in v)m[w]=v[w];f.clientFunctions.forEach((function(e){m[e]=m[e]||function(){St("Renderer does not implement `renderer."+e+"()` on its prototype")}})),r=y}else if("__proto__"===e||"constructor"===e||"prototype"===e)return St(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return ie({map:np,keys:[e,t],value:r})}function ip(e,t){return oe({map:np,keys:[e,t]})}function op(e,t,n,r,a){return ie({map:rp,keys:[e,t,n,r],value:a})}function sp(e,t,n,r){return oe({map:rp,keys:[e,t,n,r]})}var lp=function(){return 2===arguments.length?ip.apply(null,arguments):3===arguments.length?ap.apply(null,arguments):4===arguments.length?sp.apply(null,arguments):5===arguments.length?op.apply(null,arguments):void St("Invalid extension access syntax")};cc.prototype.extension=lp,tp.forEach((function(e){e.extensions.forEach((function(t){ap(e.type,t.name,t.impl)}))}));var up=function e(){if(!(this instanceof e))return new e;this.length=0},cp=up.prototype;cp.instanceString=function(){return"stylesheet"},cp.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},cp.css=function(e,t){var n=this.length-1;if(b(e))this[n].properties.push({name:e,value:t});else if(E(e))for(var r=e,a=Object.keys(r),i=0;i<a.length;i++){var o=a[i],s=r[o];if(null!=s){var l=ac.properties[o]||ac.properties[F(o)];if(null!=l){var u=l.name,c=s;this[n].properties.push({name:u,value:c})}}}return this},cp.style=cp.css,cp.generateStyle=function(e){var t=new ac(e);return this.appendToStyle(t)},cp.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,a=n.properties;e.selector(r);for(var i=0;i<a.length;i++){var o=a[i];e.css(o.name,o.value)}}return e};var dp="3.26.0",hp=function(e){return void 0===e&&(e={}),E(e)?new cc(e):b(e)?lp.apply(lp,arguments):void 0};return hp.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(hp),e.apply(null,t),this},hp.warnings=function(e){return Dt(e)},hp.version=dp,hp.stylesheet=hp.Stylesheet=up,hp}()}}]);
|