@reventlessdev/reventless-host-shell 3.0.0-alpha.49 → 3.0.0-alpha.51
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/LICENSE +49 -0
- package/README.md +125 -0
- package/dist/assets/{Geocoder.res-p3AUOmOW.js → Geocoder.res-Dm3-2yhE.js} +1 -1
- package/dist/assets/{GraphMode.res-C5hfkBfg.js → GraphMode.res-DEnv8B0Y.js} +1 -1
- package/dist/assets/{MapMode.res-DwpJCYUp.js → MapMode.res-BWRtOfiH.js} +2 -2
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__reventless_host_shell-Cku7ny5H.js → _virtual_mf-localSharedImportMap___mfe_internal__reventless_host_shell-B7ZtbgoZ.js} +1 -1
- package/dist/assets/{_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react__loadShare__.mjs-CuHP-S1B.js → _virtual_mf___mfe_internal__reventless_host_shell__loadShare__react__loadShare__.mjs-CuPed97e.js} +1 -1
- package/dist/assets/{hostInit-pu7ux4YL.js → hostInit-CfvTZuUO.js} +1 -1
- package/dist/assets/{index-BLVhdQNl.js → index-BegL3iwB.js} +1 -1
- package/dist/assets/index-C8Huy8vm.js +117 -0
- package/dist/assets/{remoteEntry-n7UDZlm9.js → remoteEntry-hIn3mRcI.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__reventless_host_shell__remoteEntry-_hash_-dsc9aHJC.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__reventless_host_shell__remoteEntry-_hash_-TJtk2Lkb.js} +1 -1
- package/dist/mf-entry-bootstrap-0.js +2 -2
- package/package.json +16 -16
- package/dist/assets/index-ttdQLNPH.js +0 -117
package/LICENSE
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Reventless Host Shell — Proprietary Software License
|
|
2
|
+
|
|
3
|
+
Copyright 2018-2026 Martin Lorenz. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This package is proprietary software. It is published to a public registry so
|
|
6
|
+
that it can be obtained and run, and for no other purpose. Publication does not
|
|
7
|
+
place it in the public domain and grants no right beyond the ones stated below.
|
|
8
|
+
|
|
9
|
+
GRANT
|
|
10
|
+
|
|
11
|
+
Subject to these terms, you are granted a non-exclusive, non-transferable,
|
|
12
|
+
revocable license to:
|
|
13
|
+
|
|
14
|
+
1. download, install and store this package; and
|
|
15
|
+
2. execute it, unmodified, to operate a Reventless-based application.
|
|
16
|
+
|
|
17
|
+
RESTRICTIONS
|
|
18
|
+
|
|
19
|
+
Except as permitted above or by mandatory applicable law, you may not:
|
|
20
|
+
|
|
21
|
+
1. redistribute, publish, sublicense, sell, rent, lease or otherwise transfer
|
|
22
|
+
this package or any part of it, modified or unmodified;
|
|
23
|
+
2. modify, adapt, translate or create derivative works of it; or
|
|
24
|
+
3. remove, obscure or alter this notice or any proprietary marking.
|
|
25
|
+
|
|
26
|
+
Nothing here restricts any right you hold under mandatory applicable law,
|
|
27
|
+
including any right to observe, study, test or decompile the software to the
|
|
28
|
+
extent that law permits, such as to achieve interoperability.
|
|
29
|
+
|
|
30
|
+
THIRD-PARTY COMPONENTS
|
|
31
|
+
|
|
32
|
+
This package bundles third-party open-source components, which remain governed
|
|
33
|
+
by their own licenses. Those licenses continue to apply to those components
|
|
34
|
+
notwithstanding the terms above.
|
|
35
|
+
|
|
36
|
+
NO WARRANTY
|
|
37
|
+
|
|
38
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
39
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
40
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
41
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
42
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
43
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
44
|
+
|
|
45
|
+
OTHER USES
|
|
46
|
+
|
|
47
|
+
For any use not granted above — including redistribution, modification, or
|
|
48
|
+
embedding this package in a product you distribute — contact the copyright
|
|
49
|
+
holder.
|
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
[](https://www.npmjs.com/package/@reventlessdev/reventless-host-shell)
|
|
2
|
+

|
|
3
|
+
[](https://docs.reventless.dev)
|
|
4
|
+
|
|
5
|
+
# @reventlessdev/reventless-host-shell
|
|
6
|
+
|
|
7
|
+
The **web front end of a Reventless platform**, shipped as a prebuilt bundle.
|
|
8
|
+
|
|
9
|
+
This is how a Reventless application gets a user interface. You do not write
|
|
10
|
+
one: your plugins already describe their read models and commands, and those
|
|
11
|
+
descriptions become lists, detail pages, filters, forms and routes. There is
|
|
12
|
+
nothing here to compile and no component code to author — you add the shell to
|
|
13
|
+
your platform stack and your domain shows up in a browser.
|
|
14
|
+
|
|
15
|
+
## Adding a UI to your platform
|
|
16
|
+
|
|
17
|
+
### 1. Serve the shell from your platform stack
|
|
18
|
+
|
|
19
|
+
Pass `~hostUiBundle` to `deployPlatform`. The deploy resolves this package's
|
|
20
|
+
built bundle, hosts it as your platform's static site, and writes a
|
|
21
|
+
`config.json` beside `index.html` naming the endpoints, auth mode and services
|
|
22
|
+
it just provisioned:
|
|
23
|
+
|
|
24
|
+
```rescript
|
|
25
|
+
let default = Platform.deployPlatform(
|
|
26
|
+
~version=Reventless.PackageVersion.fromCaller(),
|
|
27
|
+
~hostUiBundle={},
|
|
28
|
+
)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
That generated config is what lets one prebuilt bundle serve every
|
|
32
|
+
environment — you never rebuild the shell per stage.
|
|
33
|
+
|
|
34
|
+
### 2. Let each plugin contribute its screens
|
|
35
|
+
|
|
36
|
+
A plugin declares which of its components should appear, and where, by passing
|
|
37
|
+
a UI fragment manifest. `makeAutoUIManifest` derives that manifest from the
|
|
38
|
+
plugin structure you already have, so a read model becomes a list page and an
|
|
39
|
+
aggregate becomes a detail panel without naming them twice:
|
|
40
|
+
|
|
41
|
+
```rescript
|
|
42
|
+
Platform.Plugin.make(
|
|
43
|
+
~name="Catalog",
|
|
44
|
+
~pluginStructure,
|
|
45
|
+
~uiFragments=Platform.Plugin.makeAutoUIManifest(
|
|
46
|
+
~remoteEntryUrl=uiBundleUrl,
|
|
47
|
+
~name="Catalog",
|
|
48
|
+
~pluginStructure,
|
|
49
|
+
~readModelPositions=["platform-summary"],
|
|
50
|
+
~aggregatePositions=["resource-detail"],
|
|
51
|
+
),
|
|
52
|
+
// …aggregates, slices, extension points
|
|
53
|
+
)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Components marked internal are left out of the manifest, so hiding a read model
|
|
57
|
+
from the UI does not mean unwiring it.
|
|
58
|
+
|
|
59
|
+
### 3. Run it against a local platform
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx reventless-host-shell
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
This serves the built bundle and proxies `/graphql` to `localhost:4000` and
|
|
66
|
+
`/platform-graphql` to `localhost:4001`, where an in-memory Reventless platform
|
|
67
|
+
serves its domain and admin APIs. Use it while developing; production is served
|
|
68
|
+
by the platform stack from step 1.
|
|
69
|
+
|
|
70
|
+
### 4. Correct what was inferred
|
|
71
|
+
|
|
72
|
+
AutoUI guesses labels, column order, which view a list opens in, and which
|
|
73
|
+
fields belong on a form. Where a guess is wrong, a `ui-hints.json` overrides it
|
|
74
|
+
without touching code — point `hostUiBundle.uiHintsFile` at the file and the
|
|
75
|
+
deploy publishes it beside `config.json`. Absent, the shell treats the 404 as
|
|
76
|
+
"no hints" and uses its own defaults.
|
|
77
|
+
|
|
78
|
+
### 5. Turn on the capabilities that need infrastructure
|
|
79
|
+
|
|
80
|
+
Some features need something provisioned before they appear. Uploads are the
|
|
81
|
+
example: `hostUiBundle.uploadBucket` provisions a presigned-upload service
|
|
82
|
+
against an object store and threads its URL into the config, which is what makes
|
|
83
|
+
file and image fields accept a real upload.
|
|
84
|
+
|
|
85
|
+
Leave it unset and the service is not provisioned, the endpoint is omitted from
|
|
86
|
+
the config, and the shell notices — the upload input is never registered, so a
|
|
87
|
+
file field renders plainly rather than failing.
|
|
88
|
+
|
|
89
|
+
## What you get
|
|
90
|
+
|
|
91
|
+
- **Screens without UI code.** The generated pages are the product, not a
|
|
92
|
+
scaffold to replace later.
|
|
93
|
+
- **New plugins without redeploying the shell.** Plugins that bring their own
|
|
94
|
+
screens are loaded at runtime as Module Federation remotes: the shell has no
|
|
95
|
+
remotes compiled into it and discovers them from the platform as it boots.
|
|
96
|
+
- **Alternative views where the data supports them.** A read model is a table by
|
|
97
|
+
default, and is offered other views when its schema fits them — a status enum
|
|
98
|
+
earns a board, a latitude/longitude pair earns a map. An offered view is a
|
|
99
|
+
toggle the user can take or leave, never a forced default.
|
|
100
|
+
- **Live updates, presence and uploads** when the platform advertises the
|
|
101
|
+
matching endpoints, and nothing when it does not.
|
|
102
|
+
|
|
103
|
+
## What is in config.json
|
|
104
|
+
|
|
105
|
+
The deploy writes this for you; write it by hand only when self-hosting the
|
|
106
|
+
bundle. The keys the shell reads include:
|
|
107
|
+
|
|
108
|
+
| Key | Purpose |
|
|
109
|
+
|---|---|
|
|
110
|
+
| `apiEndpoint` | the domain GraphQL API |
|
|
111
|
+
| `platformApiEndpoint` | the platform (admin) GraphQL API |
|
|
112
|
+
| `authMode` | `local` or `cognito`, with the matching `cognito*` keys |
|
|
113
|
+
| `domainApiEventsEndpoint` | live updates transport; absent ⇒ no live updates |
|
|
114
|
+
| `clientEventsNamespace` | channel namespace browsers may publish to; absent ⇒ presence and chat surfaces stay dark |
|
|
115
|
+
| `uploadEndpoint` | presigned-upload service backing the file and image inputs |
|
|
116
|
+
| `viewModes` | which optional view modes to register |
|
|
117
|
+
|
|
118
|
+
To host the bundle yourself, serve this package's `dist/` as static files with a
|
|
119
|
+
`config.json` next to `index.html`.
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
Proprietary — see `LICENSE`. This package is published so that it can be
|
|
124
|
+
obtained and run to operate a Reventless application; it grants no
|
|
125
|
+
redistribution or modification rights.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as o,g as n,d as l,z as d,A as m,f as c,e as s,j as p,$ as u}from"./index-
|
|
1
|
+
import{i as o,g as n,d as l,z as d,A as m,f as c,e as s,j as p,$ as u}from"./index-C8Huy8vm.js";import"./virtualExposes-DN39MDG_.js";import"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__reventless_host_shell__remoteEntry-_hash_-TJtk2Lkb.js";import"./preload-helper-BlTxHScW.js";import"./_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-BzAfciYp.js";import"./__virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-BUE6rcGI.js";import"./__virtual_mf___mfe_internal__reventless_host_shell__loadShare__react__loadShare__.mjs_commonjs-proxy-CfkhEoF5.js";import"./_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-hre-5-8f.js";import"./_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react__loadShare__.mjs-CuPed97e.js";import"./_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_2_dom__loadShare__.mjs-Df1FMNLk.js";function f(t){return o(m(t),r=>{let e=o(n(r,"label"),l),a=o(n(r,"lat"),d),i=o(n(r,"lng"),d);if(e!==void 0&&a!==void 0&&i!==void 0)return{label:e,lat:a,lng:i}})}function h(t){return c(s(p(t),[]),f)}function k(t){return{search:r=>u(fetch(t+"?q="+global.encodeURIComponent(r)).then(e=>e.ok?e.json().then(h):Promise.resolve([])),e=>Promise.resolve([]))}}export{f as decodeResult,h as decodeResults,k as fromEndpoint};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as xh,t as bu,g as Th,h as wu,r as Ch,f as Sh,a as td,c as rd,b as ad,d as nd,e as Dh,i as id,j as od,m as sd,s as ud,k as ld,u as fd,l as Ah,n as Eu,v as xu,o as hd,C as Vr,R as cd,S as vd,T as dd,q as gd,w as pd,x as yd}from"./index-
|
|
1
|
+
import{p as xh,t as bu,g as Th,h as wu,r as Ch,f as Sh,a as td,c as rd,b as ad,d as nd,e as Dh,i as id,j as od,m as sd,s as ud,k as ld,u as fd,l as Ah,n as Eu,v as xu,o as hd,C as Vr,R as cd,S as vd,T as dd,q as gd,w as pd,x as yd}from"./index-C8Huy8vm.js";import{a as da,_ as md}from"./_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-hre-5-8f.js";import{h as Oa,b as Oi}from"./_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react__loadShare__.mjs-CuPed97e.js";function bd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}import"./virtualExposes-DN39MDG_.js";import"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__reventless_host_shell__remoteEntry-_hash_-TJtk2Lkb.js";import"./preload-helper-BlTxHScW.js";import"./_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-BzAfciYp.js";import"./__virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-BUE6rcGI.js";import"./_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_2_dom__loadShare__.mjs-Df1FMNLk.js";function Lh(t){return Sh(ad(t),e=>{let r=e[1],a=e[0],n=td(r),i=rd(a,r,n);if(typeof i=="object")switch(i.TAG){case"KEntityId":return[a,i._0,!1];case"KArrayOfEntityIds":return[a,i._0,!0];default:return}})}function wd(t){return Lh(t).length!==0}function Tu(t,e,r){return r?Sh(Dh(id(Th(t.dict,e),od),[]),nd):sd(ud(t.dict,e),[],a=>[a])}function Ed(t){let e=Lh(t.schema),r=xh(t),a={};r.forEach(l=>{a[l.key]=bu(t,l)});let n=l=>l.length>8?l.slice(0,8)+"…":l,i=r.map(l=>({id:l.key,label:bu(t,l),group:t.readModelName})),o=r.flatMap(l=>e.flatMap(f=>{let h=f[1];return Tu(l,f[0],f[2]).map(v=>{let c=Th(a,v);return c!==void 0?{id:v,label:c,group:t.readModelName}:{id:v,label:n(v),group:wu(h)}})})),s=Ch(i.concat(o),[],(l,f)=>l.some(h=>h.id===f.id)?l:l.concat([f])),u=r.flatMap(l=>e.flatMap(f=>{let h=f[0];return Tu(l,h,f[2]).map(v=>({from:l.key,to_:v,label:wu(h)}))}));return{nodes:s,edges:u}}function Pi(t){return Ch(t,[],(e,r)=>{let a=r.group;return a!==void 0&&!e.includes(a)?e.concat([a]):e})}function ws(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=Array(e);r<e;r++)a[r]=t[r];return a}function xd(t){if(Array.isArray(t))return t}function Td(t){if(Array.isArray(t))return ws(t)}function Dr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Cd(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,Mh(a.key),a)}}function Ar(t,e,r){return e&&Cd(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function kt(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Hs(t))||e){r&&(t=r);var a=0,n=function(){};return{s:n,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(u){throw u},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,i=u},f:function(){try{o||r.return==null||r.return()}finally{if(s)throw i}}}}function Nh(t,e,r){return(e=Mh(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Sd(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Dd(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a,n,i,o,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(a=i.call(r)).done)&&(s.push(a.value),s.length!==e);u=!0);}catch(f){l=!0,n=f}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw n}}return s}}function Ad(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ld(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ft(t,e){return xd(t)||Dd(t,e)||Hs(t,e)||Ad()}function $n(t){return Td(t)||Sd(t)||Hs(t)||Ld()}function Nd(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Mh(t){var e=Nd(t,"string");return typeof e=="symbol"?e:e+""}function dt(t){"@babel/helpers - typeof";return dt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dt(t)}function Hs(t,e){if(t){if(typeof t=="string")return ws(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ws(t,e):void 0}}var ct=typeof window>"u"?null:window,Cu=ct?ct.navigator:null;ct&&ct.document;var Md=dt(""),Rh=dt({}),Rd=dt(function(){}),Od=typeof HTMLElement>"u"?"undefined":dt(HTMLElement),nn=function(e){return e&&e.instanceString&&it(e.instanceString)?e.instanceString():null},Me=function(e){return e!=null&&dt(e)==Md},it=function(e){return e!=null&&dt(e)===Rd},Je=function(e){return!Bt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},_e=function(e){return e!=null&&dt(e)===Rh&&!Je(e)&&e.constructor===Object},Pd=function(e){return e!=null&&dt(e)===Rh},be=function(e){return e!=null&&dt(e)===dt(1)&&!isNaN(e)},Id=function(e){return be(e)&&Math.floor(e)===e},Kn=function(e){if(Od!=="undefined")return e!=null&&e instanceof HTMLElement},Bt=function(e){return on(e)||Oh(e)},on=function(e){return nn(e)==="collection"&&e._private.single},Oh=function(e){return nn(e)==="collection"&&!e._private.single},Ys=function(e){return nn(e)==="core"},Ph=function(e){return nn(e)==="stylesheet"},kd=function(e){return nn(e)==="event"},br=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Bd=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},Fd=function(e){return _e(e)&&be(e.x1)&&be(e.x2)&&be(e.y1)&&be(e.y2)},zd=function(e){return Pd(e)&&it(e.then)},Vd=function(){return Cu&&Cu.userAgent.match(/msie|trident|edge/i)},ga=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);return i.join("$")});var a=function(){var i=this,o=arguments,s,u=r.apply(i,o),l=a.cache;return(s=l[u])||(s=l[u]=e.apply(i,o)),s};return a.cache={},a},qs=ga(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),hi=ga(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),Ih=ga(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),Su=function(e){return br(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},dr=function(e,r){return e.slice(-1*r.length)===r},vt="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",Gd="rgb[a]?\\(("+vt+"[%]?)\\s*,\\s*("+vt+"[%]?)\\s*,\\s*("+vt+"[%]?)(?:\\s*,\\s*("+vt+"))?\\)",Ud="rgb[a]?\\((?:"+vt+"[%]?)\\s*,\\s*(?:"+vt+"[%]?)\\s*,\\s*(?:"+vt+"[%]?)(?:\\s*,\\s*(?:"+vt+"))?\\)",Hd="hsl[a]?\\(("+vt+")\\s*,\\s*("+vt+"[%])\\s*,\\s*("+vt+"[%])(?:\\s*,\\s*("+vt+"))?\\)",Yd="hsl[a]?\\((?:"+vt+")\\s*,\\s*(?:"+vt+"[%])\\s*,\\s*(?:"+vt+"[%])(?:\\s*,\\s*(?:"+vt+"))?\\)",qd="\\#[0-9a-fA-F]{3}",_d="\\#[0-9a-fA-F]{6}",kh=function(e,r){return e<r?-1:e>r?1:0},Wd=function(e,r){return-1*kh(e,r)},Ie=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var a=e[r];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var o=n[i];t[o]=a[o]}}return t},Xd=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,n,i,o=16;return r?(a=parseInt(e[1]+e[1],o),n=parseInt(e[2]+e[2],o),i=parseInt(e[3]+e[3],o)):(a=parseInt(e[1]+e[2],o),n=parseInt(e[3]+e[4],o),i=parseInt(e[5]+e[6],o)),[a,n,i]}},$d=function(e){var r,a,n,i,o,s,u,l;function f(d,p,y){return y<0&&(y+=1),y>1&&(y-=1),y<1/6?d+(p-d)*6*y:y<1/2?p:y<2/3?d+(p-d)*(2/3-y)*6:d}var h=new RegExp("^"+Hd+"$").exec(e);if(h){if(a=parseInt(h[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(h[2]),n<0||n>100||(n=n/100,i=parseFloat(h[3]),i<0||i>100)||(i=i/100,o=h[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(n===0)s=u=l=Math.round(i*255);else{var v=i<.5?i*(1+n):i+n-i*n,c=2*i-v;s=Math.round(255*f(c,v,a+1/3)),u=Math.round(255*f(c,v,a)),l=Math.round(255*f(c,v,a-1/3))}r=[s,u,l,o]}return r},Kd=function(e){var r,a=new RegExp("^"+Gd+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var o=a[i];if(o[o.length-1]==="%"&&(n[i]=!0),o=parseFloat(o),n[i]&&(o=o/100*255),o<0||o>255)return;r.push(Math.floor(o))}var s=n[1]||n[2]||n[3],u=n[1]&&n[2]&&n[3];if(s&&!u)return;var l=a[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;r.push(l)}}return r},Zd=function(e){return Qd[e.toLowerCase()]},Bh=function(e){return(Je(e)?e:null)||Zd(e)||Xd(e)||Kd(e)||$d(e)},Qd={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]},Fh=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(_e(o))throw Error("Tried to set map with object key");i<a.length-1?(r[o]==null&&(r[o]={}),r=r[o]):r[o]=e.value}},zh=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(_e(o))throw Error("Tried to get map with object key");if(r=r[o],r==null)return r}return r},wn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ii,Du;function un(){if(Du)return Ii;Du=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return Ii=t,Ii}var ki,Au;function Jd(){if(Au)return ki;Au=1;var t=typeof wn=="object"&&wn&&wn.Object===Object&&wn;return ki=t,ki}var Bi,Lu;function ci(){if(Lu)return Bi;Lu=1;var t=Jd(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return Bi=r,Bi}var Fi,Nu;function jd(){if(Nu)return Fi;Nu=1;var t=ci(),e=function(){return t.Date.now()};return Fi=e,Fi}var zi,Mu;function eg(){if(Mu)return zi;Mu=1;var t=/\s/;function e(r){for(var a=r.length;a--&&t.test(r.charAt(a)););return a}return zi=e,zi}var Vi,Ru;function tg(){if(Ru)return Vi;Ru=1;var t=eg(),e=/^\s+/;function r(a){return a&&a.slice(0,t(a)+1).replace(e,"")}return Vi=r,Vi}var Gi,Ou;function _s(){if(Ou)return Gi;Ou=1;var t=ci(),e=t.Symbol;return Gi=e,Gi}var Ui,Pu;function rg(){if(Pu)return Ui;Pu=1;var t=_s(),e=Object.prototype,r=e.hasOwnProperty,a=e.toString,n=t?t.toStringTag:void 0;function i(o){var s=r.call(o,n),u=o[n];try{o[n]=void 0;var l=!0}catch{}var f=a.call(o);return l&&(s?o[n]=u:delete o[n]),f}return Ui=i,Ui}var Hi,Iu;function ag(){if(Iu)return Hi;Iu=1;var t=Object.prototype,e=t.toString;function r(a){return e.call(a)}return Hi=r,Hi}var Yi,ku;function Vh(){if(ku)return Yi;ku=1;var t=_s(),e=rg(),r=ag(),a="[object Null]",n="[object Undefined]",i=t?t.toStringTag:void 0;function o(s){return s==null?s===void 0?n:a:i&&i in Object(s)?e(s):r(s)}return Yi=o,Yi}var qi,Bu;function ng(){if(Bu)return qi;Bu=1;function t(e){return e!=null&&typeof e=="object"}return qi=t,qi}var _i,Fu;function ln(){if(Fu)return _i;Fu=1;var t=Vh(),e=ng(),r="[object Symbol]";function a(n){return typeof n=="symbol"||e(n)&&t(n)==r}return _i=a,_i}var Wi,zu;function ig(){if(zu)return Wi;zu=1;var t=tg(),e=un(),r=ln(),a=NaN,n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(r(l))return a;if(e(l)){var f=typeof l.valueOf=="function"?l.valueOf():l;l=e(f)?f+"":f}if(typeof l!="string")return l===0?l:+l;l=t(l);var h=i.test(l);return h||o.test(l)?s(l.slice(2),h?2:8):n.test(l)?a:+l}return Wi=u,Wi}var Xi,Vu;function og(){if(Vu)return Xi;Vu=1;var t=un(),e=jd(),r=ig(),a="Expected a function",n=Math.max,i=Math.min;function o(s,u,l){var f,h,v,c,d,p,y=0,g=!1,b=!1,m=!0;if(typeof s!="function")throw new TypeError(a);u=r(u)||0,t(l)&&(g=!!l.leading,b="maxWait"in l,v=b?n(r(l.maxWait)||0,u):v,m="trailing"in l?!!l.trailing:m);function w(I){var E=f,A=h;return f=h=void 0,y=I,c=s.apply(A,E),c}function T(I){return y=I,d=setTimeout(N,u),g?w(I):c}function D(I){var E=I-p,A=I-y,C=u-E;return b?i(C,v-A):C}function x(I){var E=I-p,A=I-y;return p===void 0||E>=u||E<0||b&&A>=v}function N(){var I=e();if(x(I))return O(I);d=setTimeout(N,D(I))}function O(I){return d=void 0,m&&f?w(I):(f=h=void 0,c)}function R(){d!==void 0&&clearTimeout(d),y=0,f=p=h=d=void 0}function P(){return d===void 0?c:O(e())}function M(){var I=e(),E=x(I);if(f=arguments,h=this,p=I,E){if(d===void 0)return T(p);if(b)return clearTimeout(d),d=setTimeout(N,u),w(p)}return d===void 0&&(d=setTimeout(N,u)),c}return M.cancel=R,M.flush=P,M}return Xi=o,Xi}var sg=og(),fn=sn(sg),$i=ct?ct.performance:null,Gh=$i&&$i.now?function(){return $i.now()}:function(){return Date.now()},ug=(function(){if(ct){if(ct.requestAnimationFrame)return function(t){ct.requestAnimationFrame(t)};if(ct.mozRequestAnimationFrame)return function(t){ct.mozRequestAnimationFrame(t)};if(ct.webkitRequestAnimationFrame)return function(t){ct.webkitRequestAnimationFrame(t)};if(ct.msRequestAnimationFrame)return function(t){ct.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(Gh())},1e3/60)}})(),Zn=function(e){return ug(e)},ir=Gh,Fr=9261,Uh=65599,ia=5381,Hh=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Fr,a=r,n;n=e.next(),!n.done;)a=a*Uh+n.value|0;return a},Xa=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Fr;return r*Uh+e|0},$a=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ia;return(r<<5)+r+e|0},lg=function(e,r){return e*2097152+r},hr=function(e){return e[0]*2097152+e[1]},En=function(e,r){return[Xa(e[0],r[0]),$a(e[1],r[1])]},Gu=function(e,r){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e[n++]:a.done=!0,a}};return Hh(o,r)},Ur=function(e,r){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}};return Hh(o,r)},Yh=function(){return fg(arguments)},fg=function(e){for(var r,a=0;a<e.length;a++){var n=e[a];a===0?r=Ur(n):r=Ur(n,r)}return r};function hg(t,e,r,a,n){var i=n*Math.PI/180,o=Math.cos(i)*(t-r)-Math.sin(i)*(e-a)+r,s=Math.sin(i)*(t-r)+Math.cos(i)*(e-a)+a;return{x:o,y:s}}var cg=function(e,r,a,n,i,o){return{x:(e-a)*i+a,y:(r-n)*o+n}};function vg(t,e,r){if(r===0)return t;var a=(e.x1+e.x2)/2,n=(e.y1+e.y2)/2,i=e.w/e.h,o=1/i,s=hg(t.x,t.y,a,n,r),u=cg(s.x,s.y,a,n,i,o);return{x:u.x,y:u.y}}var Uu=!0,dg=console.warn!=null,gg=console.trace!=null,Ws=Number.MAX_SAFE_INTEGER||9007199254740991,qh=function(){return!0},Qn=function(){return!1},Hu=function(){return 0},Xs=function(){},nt=function(e){throw new Error(e)},_h=function(e){if(e!==void 0)Uu=!!e;else return Uu},Ke=function(e){_h()&&(dg?console.warn(e):(console.log(e),gg&&console.trace()))},pg=function(e){return Ie({},e)},Qt=function(e){return e==null?e:Je(e)?e.slice():_e(e)?pg(e):e},yg=function(e){return e.slice()},Wh=function(e,r){for(r=e="";e++<36;r+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return r},mg={},Xh=function(){return mg},Tt=function(e){var r=Object.keys(e);return function(a){for(var n={},i=0;i<r.length;i++){var o=r[i],s=a?.[o];n[o]=s===void 0?e[o]:s}return n}},wr=function(e,r,a){for(var n=e.length-1;n>=0;n--)e[n]===r&&e.splice(n,1)},$s=function(e){e.splice(0,e.length)},bg=function(e,r){for(var a=0;a<r.length;a++){var n=r[a];e.push(n)}},Mt=function(e,r,a){return a&&(r=Ih(a,r)),e[r]},Zt=function(e,r,a,n){a&&(r=Ih(a,r)),e[r]=n},wg=(function(){function t(){Dr(this,t),this._obj={}}return Ar(t,[{key:"set",value:function(r,a){return this._obj[r]=a,this}},{key:"delete",value:function(r){return this._obj[r]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(r){return this._obj[r]!==void 0}},{key:"get",value:function(r){return this._obj[r]}}])})(),nr=typeof Map<"u"?Map:wg,Eg="undefined",xg=(function(){function t(e){if(Dr(this,t),this._obj=Object.create(null),this.size=0,e!=null){var r;e.instanceString!=null&&e.instanceString()===this.instanceString()?r=e.toArray():r=e;for(var a=0;a<r.length;a++)this.add(r[a])}}return Ar(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var a=this._obj;a[r]!==1&&(a[r]=1,this.size++)}},{key:"delete",value:function(r){var a=this._obj;a[r]===1&&(a[r]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(r){return this._obj[r]===1}},{key:"toArray",value:function(){var r=this;return Object.keys(this._obj).filter(function(a){return r.has(a)})}},{key:"forEach",value:function(r,a){return this.toArray().forEach(r,a)}}])})(),xa=(typeof Set>"u"?"undefined":dt(Set))!==Eg?Set:xg,vi=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!Ys(e)){nt("An element must have a core reference and parameters set");return}var n=r.group;if(n==null&&(r.data&&r.data.source!=null&&r.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){nt("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new xa,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.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(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),r.renderedPosition){var o=r.renderedPosition,s=e.pan(),u=e.zoom();i.position={x:(o.x-s.x)/u,y:(o.y-s.y)/u}}var l=[];Je(r.classes)?l=r.classes:Me(r.classes)&&(l=r.classes.split(/\s+/));for(var f=0,h=l.length;f<h;f++){var v=l[f];!v||v===""||i.classes.add(v)}this.createEmitter(),(a===void 0||a)&&this.restore();var c=r.style||r.css;c&&(Ke("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(c))},Yu=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var o;_e(a)&&!Bt(a)&&(o=a,a=o.roots||o.root,n=o.visit,i=o.directed),i=arguments.length===2&&!it(n)?n:i,n=it(n)?n:function(){};for(var s=this._private.cy,u=a=Me(a)?this.filter(a):a,l=[],f=[],h={},v={},c={},d=0,p,y=this.byGroup(),g=y.nodes,b=y.edges,m=0;m<u.length;m++){var w=u[m],T=w.id();w.isNode()&&(l.unshift(w),e.bfs&&(c[T]=!0,f.push(w)),v[T]=0)}for(var D=function(){var I=e.bfs?l.shift():l.pop(),E=I.id();if(e.dfs){if(c[E])return 0;c[E]=!0,f.push(I)}var A=v[E],C=h[E],S=C!=null?C.source():null,L=C!=null?C.target():null,V=C==null?void 0:I.same(S)?L[0]:S[0],F;if(F=n(I,C,V,d++,A),F===!0)return p=I,1;if(F===!1)return 1;for(var B=I.connectedEdges().filter(function(K){return(!i||K.source().same(I))&&b.has(K)}),Y=0;Y<B.length;Y++){var q=B[Y],Q=q.connectedNodes().filter(function(K){return!K.same(I)&&g.has(K)}),$=Q.id();Q.length!==0&&!c[$]&&(Q=Q[0],l.push(Q),e.bfs&&(c[$]=!0,f.push(Q)),h[$]=q,v[$]=v[E]+1)}},x;l.length!==0&&(x=D(),!(x!==0&&x===1)););for(var N=s.collection(),O=0;O<f.length;O++){var R=f[O],P=h[R.id()];P!=null&&N.push(P),N.push(R)}return{path:s.collection(N),found:s.collection(p)}}},Ka={breadthFirstSearch:Yu({bfs:!0}),depthFirstSearch:Yu({dfs:!0})};Ka.bfs=Ka.breadthFirstSearch;Ka.dfs=Ka.depthFirstSearch;var kn={exports:{}},Tg=kn.exports,qu;function Cg(){return qu||(qu=1,(function(t,e){(function(){var r,a,n,i,o,s,u,l,f,h,v,c,d,p,y;n=Math.floor,h=Math.min,a=function(g,b){return g<b?-1:g>b?1:0},f=function(g,b,m,w,T){var D;if(m==null&&(m=0),T==null&&(T=a),m<0)throw new Error("lo must be non-negative");for(w==null&&(w=g.length);m<w;)D=n((m+w)/2),T(b,g[D])<0?w=D:m=D+1;return[].splice.apply(g,[m,m-m].concat(b)),b},s=function(g,b,m){return m==null&&(m=a),g.push(b),p(g,0,g.length-1,m)},o=function(g,b){var m,w;return b==null&&(b=a),m=g.pop(),g.length?(w=g[0],g[0]=m,y(g,0,b)):w=m,w},l=function(g,b,m){var w;return m==null&&(m=a),w=g[0],g[0]=b,y(g,0,m),w},u=function(g,b,m){var w;return m==null&&(m=a),g.length&&m(g[0],b)<0&&(w=[g[0],b],b=w[0],g[0]=w[1],y(g,0,m)),b},i=function(g,b){var m,w,T,D,x,N;for(b==null&&(b=a),D=(function(){N=[];for(var O=0,R=n(g.length/2);0<=R?O<R:O>R;0<=R?O++:O--)N.push(O);return N}).apply(this).reverse(),x=[],w=0,T=D.length;w<T;w++)m=D[w],x.push(y(g,m,b));return x},d=function(g,b,m){var w;if(m==null&&(m=a),w=g.indexOf(b),w!==-1)return p(g,0,w,m),y(g,w,m)},v=function(g,b,m){var w,T,D,x,N;if(m==null&&(m=a),T=g.slice(0,b),!T.length)return T;for(i(T,m),N=g.slice(b),D=0,x=N.length;D<x;D++)w=N[D],u(T,w,m);return T.sort(m).reverse()},c=function(g,b,m){var w,T,D,x,N,O,R,P,M;if(m==null&&(m=a),b*10<=g.length){if(D=g.slice(0,b).sort(m),!D.length)return D;for(T=D[D.length-1],R=g.slice(b),x=0,O=R.length;x<O;x++)w=R[x],m(w,T)<0&&(f(D,w,0,null,m),D.pop(),T=D[D.length-1]);return D}for(i(g,m),M=[],N=0,P=h(b,g.length);0<=P?N<P:N>P;0<=P?++N:--N)M.push(o(g,m));return M},p=function(g,b,m,w){var T,D,x;for(w==null&&(w=a),T=g[m];m>b;){if(x=m-1>>1,D=g[x],w(T,D)<0){g[m]=D,m=x;continue}break}return g[m]=T},y=function(g,b,m){var w,T,D,x,N;for(m==null&&(m=a),T=g.length,N=b,D=g[b],w=2*b+1;w<T;)x=w+1,x<T&&!(m(g[w],g[x])<0)&&(w=x),g[b]=g[w],b=w,w=2*b+1;return g[b]=D,p(g,N,b,m)},r=(function(){g.push=s,g.pop=o,g.replace=l,g.pushpop=u,g.heapify=i,g.updateItem=d,g.nlargest=v,g.nsmallest=c;function g(b){this.cmp=b??a,this.nodes=[]}return g.prototype.push=function(b){return s(this.nodes,b,this.cmp)},g.prototype.pop=function(){return o(this.nodes,this.cmp)},g.prototype.peek=function(){return this.nodes[0]},g.prototype.contains=function(b){return this.nodes.indexOf(b)!==-1},g.prototype.replace=function(b){return l(this.nodes,b,this.cmp)},g.prototype.pushpop=function(b){return u(this.nodes,b,this.cmp)},g.prototype.heapify=function(){return i(this.nodes,this.cmp)},g.prototype.updateItem=function(b){return d(this.nodes,b,this.cmp)},g.prototype.clear=function(){return this.nodes=[]},g.prototype.empty=function(){return this.nodes.length===0},g.prototype.size=function(){return this.nodes.length},g.prototype.clone=function(){var b;return b=new g,b.nodes=this.nodes.slice(0),b},g.prototype.toArray=function(){return this.nodes.slice(0)},g.prototype.insert=g.prototype.push,g.prototype.top=g.prototype.peek,g.prototype.front=g.prototype.peek,g.prototype.has=g.prototype.contains,g.prototype.copy=g.prototype.clone,g})(),(function(g,b){return t.exports=b()})(this,function(){return r})}).call(Tg)})(kn)),kn.exports}var Ki,_u;function Sg(){return _u||(_u=1,Ki=Cg()),Ki}var Dg=Sg(),hn=sn(Dg),Ag=Tt({root:null,weight:function(e){return 1},directed:!1}),Lg={dijkstra:function(e){if(!_e(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=Ag(e),n=a.root,i=a.weight,o=a.directed,s=this,u=i,l=Me(n)?this.filter(n)[0]:n[0],f={},h={},v={},c=this.byGroup(),d=c.nodes,p=c.edges;p.unmergeBy(function(A){return A.isLoop()});for(var y=function(C){return f[C.id()]},g=function(C,S){f[C.id()]=S,b.updateItem(C)},b=new hn(function(A,C){return y(A)-y(C)}),m=0;m<d.length;m++){var w=d[m];f[w.id()]=w.same(l)?0:1/0,b.push(w)}for(var T=function(C,S){for(var L=(o?C.edgesTo(S):C.edgesWith(S)).intersect(p),V=1/0,F,B=0;B<L.length;B++){var Y=L[B],q=u(Y);(q<V||!F)&&(V=q,F=Y)}return{edge:F,dist:V}};b.size()>0;){var D=b.pop(),x=y(D),N=D.id();if(v[N]=x,x!==1/0)for(var O=D.neighborhood().intersect(d),R=0;R<O.length;R++){var P=O[R],M=P.id(),I=T(D,P),E=x+I.dist;E<y(P)&&(g(P,E),h[M]={node:D,edge:I.edge})}}return{distanceTo:function(C){var S=Me(C)?d.filter(C)[0]:C[0];return v[S.id()]},pathTo:function(C){var S=Me(C)?d.filter(C)[0]:C[0],L=[],V=S,F=V.id();if(S.length>0)for(L.unshift(S);h[F];){var B=h[F];L.unshift(B.edge),L.unshift(B.node),V=B.node,F=V.id()}return s.spawn(L)}}}},Ng={kruskal:function(e){e=e||function(m){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,o=new Array(i),s=a,u=function(w){for(var T=0;T<o.length;T++){var D=o[T];if(D.has(w))return T}},l=0;l<i;l++)o[l]=this.spawn(a[l]);for(var f=n.sort(function(m,w){return e(m)-e(w)}),h=0;h<f.length;h++){var v=f[h],c=v.source()[0],d=v.target()[0],p=u(c),y=u(d),g=o[p],b=o[y];p!==y&&(s.merge(v),g.merge(b),o.splice(y,1))}return s}},Mg=Tt({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Rg={aStar:function(e){var r=this.cy(),a=Mg(e),n=a.root,i=a.goal,o=a.heuristic,s=a.directed,u=a.weight;n=r.collection(n)[0],i=r.collection(i)[0];var l=n.id(),f=i.id(),h={},v={},c={},d=new hn(function(F,B){return v[F.id()]-v[B.id()]}),p=new xa,y={},g={},b=function(B,Y){d.push(B),p.add(Y)},m,w,T=function(){m=d.pop(),w=m.id(),p.delete(w)},D=function(B){return p.has(B)};b(n,l),h[l]=0,v[l]=o(n);for(var x=0;d.size()>0;){if(T(),x++,w===f){for(var N=[],O=i,R=f,P=g[R];N.unshift(O),P!=null&&N.unshift(P),O=y[R],O!=null;)R=O.id(),P=g[R];return{found:!0,distance:h[w],path:this.spawn(N),steps:x}}c[w]=!0;for(var M=m._private.edges,I=0;I<M.length;I++){var E=M[I];if(this.hasElementWithId(E.id())&&!(s&&E.data("source")!==w)){var A=E.source(),C=E.target(),S=A.id()!==w?A:C,L=S.id();if(this.hasElementWithId(L)&&!c[L]){var V=h[w]+u(E);if(!D(L)){h[L]=V,v[L]=V+o(S),b(S,L),y[L]=m,g[L]=E;continue}V<h[L]&&(h[L]=V,v[L]=V+o(S),y[L]=m,g[L]=E)}}}}return{found:!1,distance:void 0,path:void 0,steps:x}}},Og=Tt({weight:function(e){return 1},directed:!1}),Pg={floydWarshall:function(e){for(var r=this.cy(),a=Og(e),n=a.weight,i=a.directed,o=n,s=this.byGroup(),u=s.nodes,l=s.edges,f=u.length,h=f*f,v=function(q){return u.indexOf(q)},c=function(q){return u[q]},d=new Array(h),p=0;p<h;p++){var y=p%f,g=(p-y)/f;g===y?d[p]=0:d[p]=1/0}for(var b=new Array(h),m=new Array(h),w=0;w<l.length;w++){var T=l[w],D=T.source()[0],x=T.target()[0];if(D!==x){var N=v(D),O=v(x),R=N*f+O,P=o(T);if(d[R]>P&&(d[R]=P,b[R]=O,m[R]=T),!i){var M=O*f+N;!i&&d[M]>P&&(d[M]=P,b[M]=N,m[M]=T)}}}for(var I=0;I<f;I++)for(var E=0;E<f;E++)for(var A=E*f+I,C=0;C<f;C++){var S=E*f+C,L=I*f+C;d[A]+d[L]<d[S]&&(d[S]=d[A]+d[L],b[S]=b[A])}var V=function(q){return(Me(q)?r.filter(q):q)[0]},F=function(q){return v(V(q))},B={distance:function(q,Q){var $=F(q),K=F(Q);return d[$*f+K]},path:function(q,Q){var $=F(q),K=F(Q),j=c($);if($===K)return j.collection();if(b[$*f+K]==null)return r.collection();var re=r.collection(),U=$,H;for(re.merge(j);$!==K;)U=$,$=b[$*f+K],H=m[U*f+$],re.merge(H),re.merge(c($));return re}};return B}},Ig=Tt({weight:function(e){return 1},directed:!1,root:null}),kg={bellmanFord:function(e){var r=this,a=Ig(e),n=a.weight,i=a.directed,o=a.root,s=n,u=this,l=this.cy(),f=this.byGroup(),h=f.edges,v=f.nodes,c=v.length,d=new nr,p=!1,y=[];o=l.collection(o)[0],h.unmergeBy(function(ge){return ge.isLoop()});for(var g=h.length,b=function(le){var he=d.get(le.id());return he||(he={},d.set(le.id(),he)),he},m=function(le){return(Me(le)?l.$(le):le)[0]},w=function(le){return b(m(le)).dist},T=function(le){for(var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,fe=m(le),ve=[],ye=fe;;){if(ye==null)return r.spawn();var me=b(ye),xe=me.edge,Le=me.pred;if(ve.unshift(ye[0]),ye.same(he)&&ve.length>0)break;xe!=null&&ve.unshift(xe),ye=Le}return u.spawn(ve)},D=0;D<c;D++){var x=v[D],N=b(x);x.same(o)?N.dist=0:N.dist=1/0,N.pred=null,N.edge=null}for(var O=!1,R=function(le,he,fe,ve,ye,me){var xe=ve.dist+me;xe<ye.dist&&!fe.same(ve.edge)&&(ye.dist=xe,ye.pred=le,ye.edge=fe,O=!0)},P=1;P<c;P++){O=!1;for(var M=0;M<g;M++){var I=h[M],E=I.source(),A=I.target(),C=s(I),S=b(E),L=b(A);R(E,A,I,S,L,C),i||R(A,E,I,L,S,C)}if(!O)break}if(O)for(var V=[],F=0;F<g;F++){var B=h[F],Y=B.source(),q=B.target(),Q=s(B),$=b(Y).dist,K=b(q).dist;if($+Q<K||!i&&K+Q<$)if(p||(Ke("Graph contains a negative weight cycle for Bellman-Ford"),p=!0),e.findNegativeWeightCycles!==!1){var j=[];$+Q<K&&j.push(Y),!i&&K+Q<$&&j.push(q);for(var re=j.length,U=0;U<re;U++){var H=j[U],_=[H];_.push(b(H).edge);for(var W=b(H).pred;_.indexOf(W)===-1;)_.push(W),_.push(b(W).edge),W=b(W).pred;_=_.slice(_.indexOf(W));for(var J=_[0].id(),te=0,de=2;de<_.length;de+=2)_[de].id()<J&&(J=_[de].id(),te=de);_=_.slice(te).concat(_.slice(0,te)),_.push(_[0]);var Te=_.map(function(ge){return ge.id()}).join(",");V.indexOf(Te)===-1&&(y.push(u.spawn(_)),V.push(Te))}}else break}return{distanceTo:w,pathTo:T,hasNegativeWeightCycle:p,negativeWeightCycles:y}}},Bg=Math.sqrt(2),Fg=function(e,r,a){a.length===0&&nt("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],o=n[2],s=r[i],u=r[o],l=a,f=l.length-1;f>=0;f--){var h=l[f],v=h[1],c=h[2];(r[v]===s&&r[c]===u||r[v]===u&&r[c]===s)&&l.splice(f,1)}for(var d=0;d<l.length;d++){var p=l[d];p[1]===u?(l[d]=p.slice(),l[d][1]=s):p[2]===u&&(l[d]=p.slice(),l[d][2]=s)}for(var y=0;y<r.length;y++)r[y]===u&&(r[y]=s);return l},Zi=function(e,r,a,n){for(;a>n;){var i=Math.floor(Math.random()*r.length);r=Fg(i,e,r),a--}return r},zg={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(L){return L.isLoop()});var i=a.length,o=n.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/Bg);if(i<2){nt("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],f=0;f<o;f++){var h=n[f];l.push([f,a.indexOf(h.source()),a.indexOf(h.target())])}for(var v=1/0,c=[],d=new Array(i),p=new Array(i),y=new Array(i),g=function(V,F){for(var B=0;B<i;B++)F[B]=V[B]},b=0;b<=s;b++){for(var m=0;m<i;m++)p[m]=m;var w=Zi(p,l.slice(),i,u),T=w.slice();g(p,y);var D=Zi(p,w,u,2),x=Zi(y,T,u,2);D.length<=x.length&&D.length<v?(v=D.length,c=D,g(p,d)):x.length<=D.length&&x.length<v&&(v=x.length,c=x,g(y,d))}for(var N=this.spawn(c.map(function(L){return n[L[0]]})),O=this.spawn(),R=this.spawn(),P=d[0],M=0;M<d.length;M++){var I=d[M],E=a[M];I===P?O.merge(E):R.merge(E)}var A=function(V){var F=e.spawn();return V.forEach(function(B){F.merge(B),B.connectedEdges().forEach(function(Y){e.contains(Y)&&!N.contains(Y)&&F.merge(Y)})}),F},C=[A(O),A(R)],S={cut:N,components:C,partition1:O,partition2:R};return S}},Qi,Vg=function(e){return{x:e.x,y:e.y}},di=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},$h=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},oa=function(e){return{x:e[0],y:e[1]}},Gg=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=r;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.min(o,n))}return n},Ug=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=r;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.max(o,n))}return n},Hg=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,o=r;o<a;o++){var s=e[o];isFinite(s)&&(n+=s,i++)}return n/i},Yg=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a<e.length&&e.splice(a,e.length-a),r>0&&e.splice(0,r));for(var s=0,u=e.length-1;u>=0;u--){var l=e[u];o?isFinite(l)||(e[u]=-1/0,s++):e.splice(u,1)}i&&e.sort(function(v,c){return v-c});var f=e.length,h=Math.floor(f/2);return f%2!==0?e[h+1+s]:(e[h-1+s]+e[h+s])/2},qg=function(e){return Math.PI*e/180},xn=function(e,r){return Math.atan2(r,e)-Math.PI/2},Ks=Math.log2||function(t){return Math.log(t)/Math.log(2)},Zs=function(e){return e>0?1:e<0?-1:0},Hr=function(e,r){return Math.sqrt(kr(e,r))},kr=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},_g=function(e){for(var r=e.length,a=0,n=0;n<r;n++)a+=e[n];for(var i=0;i<r;i++)e[i]=e[i]/a;return e},mt=function(e,r,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*r+n*n*a},la=function(e,r,a,n){return{x:mt(e.x,r.x,a.x,n),y:mt(e.y,r.y,a.y,n)}},Wg=function(e,r,a,n){var i={x:r.x-e.x,y:r.y-e.y},o=Hr(e,r),s={x:i.x/o,y:i.y/o};return a=a??0,n=n??a*o,{x:e.x+s.x*n,y:e.y+s.y*n}},Za=function(e,r,a){return Math.max(e,Math.min(a,r))},Rt=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&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(e.w!=null&&e.h!=null&&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}}},Xg=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},$g=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Kg=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},Kh=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},Bn=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Fn=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,o;if(r.length===1)a=n=i=o=r[0];else if(r.length===2)a=i=r[0],o=n=r[1];else if(r.length===4){var s=ft(r,4);a=s[0],n=s[1],i=s[2],o=s[3]}return e.x1-=o,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Wu=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},Qs=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2<r.x1||r.x2<e.x1||e.y2<r.y1||r.y2<e.y1||e.y1>r.y2||r.y1>e.y2)},gr=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},Xu=function(e,r){return gr(e,r.x,r.y)},Zh=function(e,r){return gr(e,r.x1,r.y1)&&gr(e,r.x2,r.y2)},Zg=(Qi=Math.hypot)!==null&&Qi!==void 0?Qi:function(t,e){return Math.sqrt(t*t+e*e)};function Qg(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(N,O){return{x:N.x+O.x,y:N.y+O.y}},a=function(N,O){return{x:N.x-O.x,y:N.y-O.y}},n=function(N,O){return{x:N.x*O,y:N.y*O}},i=function(N,O){return N.x*O.y-N.y*O.x},o=function(N){var O=Zg(N.x,N.y);return O===0?{x:0,y:0}:{x:N.x/O,y:N.y/O}},s=function(N){for(var O=0,R=0;R<N.length;R++){var P=N[R],M=N[(R+1)%N.length];O+=P.x*M.y-M.x*P.y}return O/2},u=function(N,O,R,P){var M=a(O,N),I=a(P,R),E=i(M,I);if(Math.abs(E)<1e-9)return r(N,n(M,.5));var A=i(a(R,N),I)/E;return r(N,n(M,A))},l=t.map(function(x){return{x:x.x,y:x.y}});s(l)<0&&l.reverse();for(var f=l.length,h=[],v=0;v<f;v++){var c=l[v],d=l[(v+1)%f],p=a(d,c),y=o({x:p.y,y:-p.x});h.push(y)}for(var g=h.map(function(x,N){var O=r(l[N],n(x,e)),R=r(l[(N+1)%f],n(x,e));return{p1:O,p2:R}}),b=[],m=0;m<f;m++){var w=g[(m-1+f)%f],T=g[m],D=u(w.p1,w.p2,T.p1,T.p2);b.push(D)}return b}function Jg(t,e,r,a,n,i){var o=sp(t,e,r,a,n),s=Qg(o,i),u=Rt();return s.forEach(function(l){return Kh(u,l.x,l.y)}),u}var Qh=function(e,r,a,n,i,o,s){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?Er(i,o):u,f=i/2,h=o/2;l=Math.min(l,f,h);var v=l!==f,c=l!==h,d;if(v){var p=a-f+l-s,y=n-h-s,g=a+f-l+s,b=y;if(d=pr(e,r,a,n,p,y,g,b,!1),d.length>0)return d}if(c){var m=a+f+s,w=n-h+l-s,T=m,D=n+h-l+s;if(d=pr(e,r,a,n,m,w,T,D,!1),d.length>0)return d}if(v){var x=a-f+l-s,N=n+h+s,O=a+f-l+s,R=N;if(d=pr(e,r,a,n,x,N,O,R,!1),d.length>0)return d}if(c){var P=a-f-s,M=n-h+l-s,I=P,E=n+h-l+s;if(d=pr(e,r,a,n,P,M,I,E,!1),d.length>0)return d}var A;{var C=a-f+l,S=n-h+l;if(A=Ga(e,r,a,n,C,S,l+s),A.length>0&&A[0]<=C&&A[1]<=S)return[A[0],A[1]]}{var L=a+f-l,V=n-h+l;if(A=Ga(e,r,a,n,L,V,l+s),A.length>0&&A[0]>=L&&A[1]<=V)return[A[0],A[1]]}{var F=a+f-l,B=n+h-l;if(A=Ga(e,r,a,n,F,B,l+s),A.length>0&&A[0]>=F&&A[1]>=B)return[A[0],A[1]]}{var Y=a-f+l,q=n+h-l;if(A=Ga(e,r,a,n,Y,q,l+s),A.length>0&&A[0]<=Y&&A[1]>=q)return[A[0],A[1]]}return[]},jg=function(e,r,a,n,i,o,s){var u=s,l=Math.min(a,i),f=Math.max(a,i),h=Math.min(n,o),v=Math.max(n,o);return l-u<=e&&e<=f+u&&h-u<=r&&r<=v+u},ep=function(e,r,a,n,i,o,s,u,l){var f={x1:Math.min(a,s,i)-l,x2:Math.max(a,s,i)+l,y1:Math.min(n,u,o)-l,y2:Math.max(n,u,o)+l};return!(e<f.x1||e>f.x2||r<f.y1||r>f.y2)},tp=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var o=Math.sqrt(i),s=2*e,u=(-r+o)/s,l=(-r-o)/s;return[u,l]},rp=function(e,r,a,n,i){var o=1e-5;e===0&&(e=o),r/=e,a/=e,n/=e;var s,u,l,f,h,v,c,d;if(u=(3*a-r*r)/9,l=-(27*n)+r*(9*a-2*(r*r)),l/=54,s=u*u*u+l*l,i[1]=0,c=r/3,s>0){h=l+Math.sqrt(s),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),v=l-Math.sqrt(s),v=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3),i[0]=-c+h+v,c+=(h+v)/2,i[4]=i[2]=-c,c=Math.sqrt(3)*(-v+h)/2,i[3]=c,i[5]=-c;return}if(i[5]=i[3]=0,s===0){d=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-c+2*d,i[4]=i[2]=-(d+c);return}u=-u,f=u*u*u,f=Math.acos(l/Math.sqrt(f)),d=2*Math.sqrt(u),i[0]=-c+d*Math.cos(f/3),i[2]=-c+d*Math.cos((f+2*Math.PI)/3),i[4]=-c+d*Math.cos((f+4*Math.PI)/3)},ap=function(e,r,a,n,i,o,s,u){var l=1*a*a-4*a*i+2*a*s+4*i*i-4*i*s+s*s+n*n-4*n*o+2*n*u+4*o*o-4*o*u+u*u,f=9*a*i-3*a*a-3*a*s-6*i*i+3*i*s+9*n*o-3*n*n-3*n*u-6*o*o+3*o*u,h=3*a*a-6*a*i+a*s-a*e+2*i*i+2*i*e-s*e+3*n*n-6*n*o+n*u-n*r+2*o*o+2*o*r-u*r,v=1*a*i-a*a+a*e-i*e+n*o-n*n+n*r-o*r,c=[];rp(l,f,h,v,c);for(var d=1e-7,p=[],y=0;y<6;y+=2)Math.abs(c[y+1])<d&&c[y]>=0&&c[y]<=1&&p.push(c[y]);p.push(1),p.push(0);for(var g=-1,b,m,w,T=0;T<p.length;T++)b=Math.pow(1-p[T],2)*a+2*(1-p[T])*p[T]*i+p[T]*p[T]*s,m=Math.pow(1-p[T],2)*n+2*(1-p[T])*p[T]*o+p[T]*p[T]*u,w=Math.pow(b-e,2)+Math.pow(m-r,2),g>=0?w<g&&(g=w):g=w;return g},np=function(e,r,a,n,i,o){var s=[e-a,r-n],u=[i-a,o-n],l=u[0]*u[0]+u[1]*u[1],f=s[0]*s[0]+s[1]*s[1],h=s[0]*u[0]+s[1]*u[1],v=h*h/l;return h<0?f:v>l?(e-i)*(e-i)+(r-o)*(r-o):f-v},It=function(e,r,a){for(var n,i,o,s,u,l=0,f=0;f<a.length/2;f++)if(n=a[f*2],i=a[f*2+1],f+1<a.length/2?(o=a[(f+1)*2],s=a[(f+1)*2+1]):(o=a[(f+1-a.length/2)*2],s=a[(f+1-a.length/2)*2+1]),!(n==e&&o==e))if(n>=e&&e>=o||n<=e&&e<=o)u=(e-n)/(o-n)*(s-i)+i,u>r&&l++;else continue;return l%2!==0},or=function(e,r,a,n,i,o,s,u,l){var f=new Array(a.length),h;u[0]!=null?(h=Math.atan(u[1]/u[0]),u[0]<0?h=h+Math.PI/2:h=-h-Math.PI/2):h=u;for(var v=Math.cos(-h),c=Math.sin(-h),d=0;d<f.length/2;d++)f[d*2]=o/2*(a[d*2]*v-a[d*2+1]*c),f[d*2+1]=s/2*(a[d*2+1]*v+a[d*2]*c),f[d*2]+=n,f[d*2+1]+=i;var p;if(l>0){var y=jn(f,-l);p=Jn(y)}else p=f;return It(e,r,p)},ip=function(e,r,a,n,i,o,s,u){for(var l=new Array(a.length*2),f=0;f<u.length;f++){var h=u[f];l[f*4+0]=h.startX,l[f*4+1]=h.startY,l[f*4+2]=h.stopX,l[f*4+3]=h.stopY;var v=Math.pow(h.cx-e,2)+Math.pow(h.cy-r,2);if(v<=Math.pow(h.radius,2))return!0}return It(e,r,l)},Jn=function(e){for(var r=new Array(e.length/2),a,n,i,o,s,u,l,f,h=0;h<e.length/4;h++){a=e[h*4],n=e[h*4+1],i=e[h*4+2],o=e[h*4+3],h<e.length/4-1?(s=e[(h+1)*4],u=e[(h+1)*4+1],l=e[(h+1)*4+2],f=e[(h+1)*4+3]):(s=e[0],u=e[1],l=e[2],f=e[3]);var v=pr(a,n,i,o,s,u,l,f,!0);r[h*2]=v[0],r[h*2+1]=v[1]}return r},jn=function(e,r){for(var a=new Array(e.length*2),n,i,o,s,u=0;u<e.length/2;u++){n=e[u*2],i=e[u*2+1],u<e.length/2-1?(o=e[(u+1)*2],s=e[(u+1)*2+1]):(o=e[0],s=e[1]);var l=s-i,f=-(o-n),h=Math.sqrt(l*l+f*f),v=l/h,c=f/h;a[u*4]=n+v*r,a[u*4+1]=i+c*r,a[u*4+2]=o+v*r,a[u*4+3]=s+c*r}return a},op=function(e,r,a,n,i,o){var s=a-e,u=n-r;s/=i,u/=o;var l=Math.sqrt(s*s+u*u),f=l-1;if(f<0)return[];var h=f/l;return[(a-e)*h+e,(n-r)*h+r]},Gr=function(e,r,a,n,i,o,s){return e-=i,r-=o,e/=a/2+s,r/=n/2+s,e*e+r*r<=1},Ga=function(e,r,a,n,i,o,s){var u=[a-e,n-r],l=[e-i,r-o],f=u[0]*u[0]+u[1]*u[1],h=2*(l[0]*u[0]+l[1]*u[1]),v=l[0]*l[0]+l[1]*l[1]-s*s,c=h*h-4*f*v;if(c<0)return[];var d=(-h+Math.sqrt(c))/(2*f),p=(-h-Math.sqrt(c))/(2*f),y=Math.min(d,p),g=Math.max(d,p),b=[];if(y>=0&&y<=1&&b.push(y),g>=0&&g<=1&&b.push(g),b.length===0)return[];var m=b[0]*u[0]+e,w=b[0]*u[1]+r;if(b.length>1){if(b[0]==b[1])return[m,w];var T=b[1]*u[0]+e,D=b[1]*u[1]+r;return[m,w,T,D]}else return[m,w]},Ji=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},pr=function(e,r,a,n,i,o,s,u,l){var f=e-i,h=a-e,v=s-i,c=r-o,d=n-r,p=u-o,y=v*c-p*f,g=h*c-d*f,b=p*h-v*d;if(b!==0){var m=y/b,w=g/b,T=.001,D=0-T,x=1+T;return D<=m&&m<=x&&D<=w&&w<=x?[e+m*h,r+m*d]:l?[e+m*h,r+m*d]:[]}else return y===0||g===0?Ji(e,a,s)===s?[s,u]:Ji(e,a,i)===i?[i,o]:Ji(i,s,a)===a?[a,n]:[]:[]},sp=function(e,r,a,n,i){var o=[],s=n/2,u=i/2,l=r,f=a;o.push({x:l+s*e[0],y:f+u*e[1]});for(var h=1;h<e.length/2;h++)o.push({x:l+s*e[h*2],y:f+u*e[h*2+1]});return o},Qa=function(e,r,a,n,i,o,s,u){var l=[],f,h=new Array(a.length),v=!0;o==null&&(v=!1);var c;if(v){for(var d=0;d<h.length/2;d++)h[d*2]=a[d*2]*o+n,h[d*2+1]=a[d*2+1]*s+i;if(u>0){var p=jn(h,-u);c=Jn(p)}else c=h}else c=a;for(var y,g,b,m,w=0;w<c.length/2;w++)y=c[w*2],g=c[w*2+1],w<c.length/2-1?(b=c[(w+1)*2],m=c[(w+1)*2+1]):(b=c[0],m=c[1]),f=pr(e,r,n,i,y,g,b,m),f.length!==0&&l.push(f[0],f[1]);return l},up=function(e,r,a,n,i,o,s,u,l){var f=[],h,v=new Array(a.length*2);l.forEach(function(b,m){m===0?(v[v.length-2]=b.startX,v[v.length-1]=b.startY):(v[m*4-2]=b.startX,v[m*4-1]=b.startY),v[m*4]=b.stopX,v[m*4+1]=b.stopY,h=Ga(e,r,n,i,b.cx,b.cy,b.radius),h.length!==0&&f.push(h[0],h[1])});for(var c=0;c<v.length/4;c++)h=pr(e,r,n,i,v[c*4],v[c*4+1],v[c*4+2],v[c*4+3],!1),h.length!==0&&f.push(h[0],h[1]);if(f.length>2){for(var d=[f[0],f[1]],p=Math.pow(d[0]-e,2)+Math.pow(d[1]-r,2),y=1;y<f.length/2;y++){var g=Math.pow(f[y*2]-e,2)+Math.pow(f[y*2+1]-r,2);g<=p&&(d[0]=f[y*2],d[1]=f[y*2+1],p=g)}return d}return f},Tn=function(e,r,a){var n=[e[0]-r[0],e[1]-r[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),o=(i-a)/i;return o<0&&(o=1e-5),[r[0]+o*n[0],r[1]+o*n[1]]},Nt=function(e,r){var a=Es(e,r);return a=Jh(a),a},Jh=function(e){for(var r,a,n=e.length/2,i=1/0,o=1/0,s=-1/0,u=-1/0,l=0;l<n;l++)r=e[2*l],a=e[2*l+1],i=Math.min(i,r),s=Math.max(s,r),o=Math.min(o,a),u=Math.max(u,a);for(var f=2/(s-i),h=2/(u-o),v=0;v<n;v++)r=e[2*v]=e[2*v]*f,a=e[2*v+1]=e[2*v+1]*h,i=Math.min(i,r),s=Math.max(s,r),o=Math.min(o,a),u=Math.max(u,a);if(o<-1)for(var c=0;c<n;c++)a=e[2*c+1]=e[2*c+1]+(-1-o);return e},Es=function(e,r){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=r;for(var i=new Array(e*2),o,s=0;s<e;s++)o=s*a+n,i[2*s]=Math.cos(o),i[2*s+1]=Math.sin(-o);return i},Er=function(e,r){return Math.min(e/4,r/4,8)},jh=function(e,r){return Math.min(e/10,r/10,8)},Js=function(){return 8},lp=function(e,r,a){return[e-2*r+a,2*(r-e),e]},xs=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function ji(t,e){function r(h){for(var v=[],c=0;c<h.length;c++){var d=h[c],p=h[(c+1)%h.length],y={x:p.x-d.x,y:p.y-d.y},g={x:-y.y,y:y.x},b=Math.sqrt(g.x*g.x+g.y*g.y);v.push({x:g.x/b,y:g.y/b})}return v}function a(h,v){var c=1/0,d=-1/0,p=kt(h),y;try{for(p.s();!(y=p.n()).done;){var g=y.value,b=g.x*v.x+g.y*v.y;c=Math.min(c,b),d=Math.max(d,b)}}catch(m){p.e(m)}finally{p.f()}return{min:c,max:d}}function n(h,v){return!(h.max<v.min||v.max<h.min)}var i=[].concat($n(r(t)),$n(r(e))),o=kt(i),s;try{for(o.s();!(s=o.n()).done;){var u=s.value,l=a(t,u),f=a(e,u);if(!n(l,f))return!1}}catch(h){o.e(h)}finally{o.f()}return!0}var fp=Tt({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),hp={pageRank:function(e){for(var r=fp(e),a=r.dampingFactor,n=r.precision,i=r.iterations,o=r.weight,s=this._private.cy,u=this.byGroup(),l=u.nodes,f=u.edges,h=l.length,v=h*h,c=f.length,d=new Array(v),p=new Array(h),y=(1-a)/h,g=0;g<h;g++){for(var b=0;b<h;b++){var m=g*h+b;d[m]=0}p[g]=0}for(var w=0;w<c;w++){var T=f[w],D=T.data("source"),x=T.data("target");if(D!==x){var N=l.indexOfId(D),O=l.indexOfId(x),R=o(T),P=O*h+N;d[P]+=R,p[N]+=R}}for(var M=1/h+y,I=0;I<h;I++)if(p[I]===0)for(var E=0;E<h;E++){var A=E*h+I;d[A]=M}else for(var C=0;C<h;C++){var S=C*h+I;d[S]=d[S]/p[I]+y}for(var L=new Array(h),V=new Array(h),F,B=0;B<h;B++)L[B]=1;for(var Y=0;Y<i;Y++){for(var q=0;q<h;q++)V[q]=0;for(var Q=0;Q<h;Q++)for(var $=0;$<h;$++){var K=Q*h+$;V[Q]+=d[K]*L[$]}_g(V),F=L,L=V,V=F;for(var j=0,re=0;re<h;re++){var U=F[re]-L[re];j+=U*U}if(j<n)break}var H={rank:function(W){return W=s.collection(W)[0],L[l.indexOf(W)]}};return H}},$u=Tt({root:null,weight:function(e){return 1},directed:!1,alpha:0}),fa={degreeCentralityNormalized:function(e){e=$u(e);var r=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var f={},h={},v=0,c=0,d=0;d<n;d++){var p=a[d],y=p.id();e.root=p;var g=this.degreeCentrality(e);v<g.indegree&&(v=g.indegree),c<g.outdegree&&(c=g.outdegree),f[y]=g.indegree,h[y]=g.outdegree}return{indegree:function(m){return v==0?0:(Me(m)&&(m=r.filter(m)),f[m.id()]/v)},outdegree:function(m){return c===0?0:(Me(m)&&(m=r.filter(m)),h[m.id()]/c)}}}else{for(var i={},o=0,s=0;s<n;s++){var u=a[s];e.root=u;var l=this.degreeCentrality(e);o<l.degree&&(o=l.degree),i[u.id()]=l.degree}return{degree:function(m){return o===0?0:(Me(m)&&(m=r.filter(m)),i[m.id()]/o)}}}},degreeCentrality:function(e){e=$u(e);var r=this.cy(),a=this,n=e,i=n.root,o=n.weight,s=n.directed,u=n.alpha;if(i=r.collection(i)[0],s){for(var c=i.connectedEdges(),d=c.filter(function(D){return D.target().same(i)&&a.has(D)}),p=c.filter(function(D){return D.source().same(i)&&a.has(D)}),y=d.length,g=p.length,b=0,m=0,w=0;w<d.length;w++)b+=o(d[w]);for(var T=0;T<p.length;T++)m+=o(p[T]);return{indegree:Math.pow(y,1-u)*Math.pow(b,u),outdegree:Math.pow(g,1-u)*Math.pow(m,u)}}else{for(var l=i.connectedEdges().intersection(a),f=l.length,h=0,v=0;v<l.length;v++)h+=o(l[v]);return{degree:Math.pow(f,1-u)*Math.pow(h,u)}}}};fa.dc=fa.degreeCentrality;fa.dcn=fa.degreeCentralityNormalised=fa.degreeCentralityNormalized;var Ku=Tt({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),ha={closenessCentralityNormalized:function(e){for(var r=Ku(e),a=r.harmonic,n=r.weight,i=r.directed,o=this.cy(),s={},u=0,l=this.nodes(),f=this.floydWarshall({weight:n,directed:i}),h=0;h<l.length;h++){for(var v=0,c=l[h],d=0;d<l.length;d++)if(h!==d){var p=f.distance(c,l[d]);a?v+=1/p:v+=p}a||(v=1/v),u<v&&(u=v),s[c.id()]=v}return{closeness:function(g){return u==0?0:(Me(g)?g=o.filter(g)[0].id():g=g.id(),s[g]/u)}}},closenessCentrality:function(e){var r=Ku(e),a=r.root,n=r.weight,i=r.directed,o=r.harmonic;a=this.filter(a)[0];for(var s=this.dijkstra({root:a,weight:n,directed:i}),u=0,l=this.nodes(),f=0;f<l.length;f++){var h=l[f];if(!h.same(a)){var v=s.distanceTo(h);o?u+=1/v:u+=v}}return o?u:1/u}};ha.cc=ha.closenessCentrality;ha.ccn=ha.closenessCentralityNormalised=ha.closenessCentralityNormalized;var cp=Tt({weight:null,directed:!1}),Ts={betweennessCentrality:function(e){for(var r=cp(e),a=r.directed,n=r.weight,i=n!=null,o=this.cy(),s=this.nodes(),u={},l={},f=0,h={set:function(m,w){l[m]=w,w>f&&(f=w)},get:function(m){return l[m]}},v=0;v<s.length;v++){var c=s[v],d=c.id();a?u[d]=c.outgoers().nodes():u[d]=c.openNeighborhood().nodes(),h.set(d,0)}for(var p=function(){for(var m=s[y].id(),w=[],T={},D={},x={},N=new hn(function(Q,$){return x[Q]-x[$]}),O=0;O<s.length;O++){var R=s[O].id();T[R]=[],D[R]=0,x[R]=1/0}for(D[m]=1,x[m]=0,N.push(m);!N.empty();){var P=N.pop();if(w.push(P),i)for(var M=0;M<u[P].length;M++){var I=u[P][M],E=o.getElementById(P),A=void 0;E.edgesTo(I).length>0?A=E.edgesTo(I)[0]:A=I.edgesTo(E)[0];var C=n(A);I=I.id(),x[I]>x[P]+C&&(x[I]=x[P]+C,N.nodes.indexOf(I)<0?N.push(I):N.updateItem(I),D[I]=0,T[I]=[]),x[I]==x[P]+C&&(D[I]=D[I]+D[P],T[I].push(P))}else for(var S=0;S<u[P].length;S++){var L=u[P][S].id();x[L]==1/0&&(N.push(L),x[L]=x[P]+1),x[L]==x[P]+1&&(D[L]=D[L]+D[P],T[L].push(P))}}for(var V={},F=0;F<s.length;F++)V[s[F].id()]=0;for(;w.length>0;){for(var B=w.pop(),Y=0;Y<T[B].length;Y++){var q=T[B][Y];V[q]=V[q]+D[q]/D[B]*(1+V[B])}B!=s[y].id()&&h.set(B,h.get(B)+V[B])}},y=0;y<s.length;y++)p();var g={betweenness:function(m){var w=o.collection(m).id();return h.get(w)},betweennessNormalized:function(m){if(f==0)return 0;var w=o.collection(m).id();return h.get(w)/f}};return g.betweennessNormalised=g.betweennessNormalized,g}};Ts.bc=Ts.betweennessCentrality;var vp=Tt({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),dp=function(e){return vp(e)},gp=function(e,r){for(var a=0,n=0;n<r.length;n++)a+=r[n](e);return a},pp=function(e,r,a){for(var n=0;n<r;n++)e[n*r+n]=a},ec=function(e,r){for(var a,n=0;n<r;n++){a=0;for(var i=0;i<r;i++)a+=e[i*r+n];for(var o=0;o<r;o++)e[o*r+n]=e[o*r+n]/a}},yp=function(e,r,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var o=0;o<a;o++)n[i*a+o]=0;for(var s=0;s<a;s++)for(var u=0;u<a;u++)n[i*a+u]+=e[i*a+s]*r[s*a+u]}return n},mp=function(e,r,a){for(var n=e.slice(0),i=1;i<a;i++)e=yp(e,n,r);return e},bp=function(e,r,a){for(var n=new Array(r*r),i=0;i<r*r;i++)n[i]=Math.pow(e[i],a);return ec(n,r),n},wp=function(e,r,a,n){for(var i=0;i<a;i++){var o=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),s=Math.round(r[i]*Math.pow(10,n))/Math.pow(10,n);if(o!==s)return!1}return!0},Ep=function(e,r,a,n){for(var i=[],o=0;o<r;o++){for(var s=[],u=0;u<r;u++)Math.round(e[o*r+u]*1e3)/1e3>0&&s.push(a[u]);s.length!==0&&i.push(n.collection(s))}return i},xp=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},Tp=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&xp(e[r],e[a])&&e.splice(a,1);return e},Zu=function(e){for(var r=this.nodes(),a=this.edges(),n=this.cy(),i=dp(e),o={},s=0;s<r.length;s++)o[r[s].id()]=s;for(var u=r.length,l=u*u,f=new Array(l),h,v=0;v<l;v++)f[v]=0;for(var c=0;c<a.length;c++){var d=a[c],p=o[d.source().id()],y=o[d.target().id()],g=gp(d,i.attributes);f[p*u+y]+=g,f[y*u+p]+=g}pp(f,u,i.multFactor),ec(f,u);for(var b=!0,m=0;b&&m<i.maxIterations;)b=!1,h=mp(f,u,i.expandFactor),f=bp(h,u,i.inflateFactor),wp(f,h,l,4)||(b=!0),m++;var w=Ep(f,u,r,n);return w=Tp(w),w},Cp={markovClustering:Zu,mcl:Zu},Sp=function(e){return e},tc=function(e,r){return Math.abs(r-e)},Qu=function(e,r,a){return e+tc(r,a)},Ju=function(e,r,a){return e+Math.pow(a-r,2)},Dp=function(e){return Math.sqrt(e)},Ap=function(e,r,a){return Math.max(e,tc(r,a))},Pa=function(e,r,a,n,i){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Sp,s=n,u,l,f=0;f<e;f++)u=r(f),l=a(f),s=i(s,u,l);return o(s)},pa={euclidean:function(e,r,a){return e>=2?Pa(e,r,a,0,Ju,Dp):Pa(e,r,a,0,Qu)},squaredEuclidean:function(e,r,a){return Pa(e,r,a,0,Ju)},manhattan:function(e,r,a){return Pa(e,r,a,0,Qu)},max:function(e,r,a){return Pa(e,r,a,-1/0,Ap)}};pa["squared-euclidean"]=pa.squaredEuclidean;pa.squaredeuclidean=pa.squaredEuclidean;function gi(t,e,r,a,n,i){var o;return it(t)?o=t:o=pa[t]||pa.euclidean,e===0&&it(t)?o(n,i):o(e,r,a,n,i)}var Lp=Tt({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),js=function(e){return Lp(e)},ei=function(e,r,a,n,i){var o=i!=="kMedoids",s=o?function(h){return a[h]}:function(h){return n[h](a)},u=function(v){return n[v](r)},l=a,f=r;return gi(e,n.length,s,u,l,f)},eo=function(e,r,a){for(var n=a.length,i=new Array(n),o=new Array(n),s=new Array(r),u=null,l=0;l<n;l++)i[l]=e.min(a[l]).value,o[l]=e.max(a[l]).value;for(var f=0;f<r;f++){u=[];for(var h=0;h<n;h++)u[h]=Math.random()*(o[h]-i[h])+i[h];s[f]=u}return s},rc=function(e,r,a,n,i){for(var o=1/0,s=0,u=0;u<r.length;u++){var l=ei(a,e,r[u],n,i);l<o&&(o=l,s=u)}return s},ac=function(e,r,a){for(var n=[],i=null,o=0;o<r.length;o++)i=r[o],a[i.id()]===e&&n.push(i);return n},Np=function(e,r,a){return Math.abs(r-e)<=a},Mp=function(e,r,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var o=Math.abs(e[n][i]-r[n][i]);if(o>a)return!1}return!0},Rp=function(e,r,a){for(var n=0;n<a;n++)if(e===r[n])return!0;return!1},ju=function(e,r){var a=new Array(r);if(e.length<50)for(var n=0;n<r;n++){for(var i=e[Math.floor(Math.random()*e.length)];Rp(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var o=0;o<r;o++)a[o]=e[Math.floor(Math.random()*e.length)];return a},el=function(e,r,a){for(var n=0,i=0;i<r.length;i++)n+=ei("manhattan",r[i],e,a,"kMedoids");return n},Op=function(e){var r=this.cy(),a=this.nodes(),n=null,i=js(e),o=new Array(i.k),s={},u;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,u=eo(a,i.k,i.attributes)):dt(i.testCentroids)==="object"?u=i.testCentroids:u=eo(a,i.k,i.attributes):u=eo(a,i.k,i.attributes);for(var l=!0,f=0;l&&f<i.maxIterations;){for(var h=0;h<a.length;h++)n=a[h],s[n.id()]=rc(n,u,i.distance,i.attributes,"kMeans");l=!1;for(var v=0;v<i.k;v++){var c=ac(v,a,s);if(c.length!==0){for(var d=i.attributes.length,p=u[v],y=new Array(d),g=new Array(d),b=0;b<d;b++){g[b]=0;for(var m=0;m<c.length;m++)n=c[m],g[b]+=i.attributes[b](n);y[b]=g[b]/c.length,Np(y[b],p[b],i.sensitivityThreshold)||(l=!0)}u[v]=y,o[v]=r.collection(c)}}f++}return o},Pp=function(e){var r=this.cy(),a=this.nodes(),n=null,i=js(e),o=new Array(i.k),s,u={},l,f=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(dt(i.testCentroids)==="object"?s=i.testCentroids:s=ju(a,i.k)):s=ju(a,i.k);for(var h=!0,v=0;h&&v<i.maxIterations;){for(var c=0;c<a.length;c++)n=a[c],u[n.id()]=rc(n,s,i.distance,i.attributes,"kMedoids");h=!1;for(var d=0;d<s.length;d++){var p=ac(d,a,u);if(p.length!==0){f[d]=el(s[d],p,i.attributes);for(var y=0;y<p.length;y++)l=el(p[y],p,i.attributes),l<f[d]&&(f[d]=l,s[d]=p[y],h=!0);o[d]=r.collection(p)}}v++}return o},Ip=function(e,r,a,n,i){for(var o,s,u=0;u<r.length;u++)for(var l=0;l<e.length;l++)n[u][l]=Math.pow(a[u][l],i.m);for(var f=0;f<e.length;f++)for(var h=0;h<i.attributes.length;h++){o=0,s=0;for(var v=0;v<r.length;v++)o+=n[v][f]*i.attributes[h](r[v]),s+=n[v][f];e[f][h]=o/s}},kp=function(e,r,a,n,i){for(var o=0;o<e.length;o++)r[o]=e[o].slice();for(var s,u,l,f=2/(i.m-1),h=0;h<a.length;h++)for(var v=0;v<n.length;v++){s=0;for(var c=0;c<a.length;c++)u=ei(i.distance,n[v],a[h],i.attributes,"cmeans"),l=ei(i.distance,n[v],a[c],i.attributes,"cmeans"),s+=Math.pow(u/l,f);e[v][h]=1/s}},Bp=function(e,r,a,n){for(var i=new Array(a.k),o=0;o<i.length;o++)i[o]=[];for(var s,u,l=0;l<r.length;l++){s=-1/0,u=-1;for(var f=0;f<r[0].length;f++)r[l][f]>s&&(s=r[l][f],u=f);i[u].push(e[l])}for(var h=0;h<i.length;h++)i[h]=n.collection(i[h]);return i},tl=function(e){var r=this.cy(),a=this.nodes(),n=js(e),i,o,s,u,l;u=new Array(a.length);for(var f=0;f<a.length;f++)u[f]=new Array(n.k);s=new Array(a.length);for(var h=0;h<a.length;h++)s[h]=new Array(n.k);for(var v=0;v<a.length;v++){for(var c=0,d=0;d<n.k;d++)s[v][d]=Math.random(),c+=s[v][d];for(var p=0;p<n.k;p++)s[v][p]=s[v][p]/c}o=new Array(n.k);for(var y=0;y<n.k;y++)o[y]=new Array(n.attributes.length);l=new Array(a.length);for(var g=0;g<a.length;g++)l[g]=new Array(n.k);for(var b=!0,m=0;b&&m<n.maxIterations;)b=!1,Ip(o,a,s,l,n),kp(s,u,o,a,n),Mp(s,u,n.sensitivityThreshold)||(b=!0),m++;return i=Bp(a,s,n,r),{clusters:i,degreeOfMembership:s}},Fp={kMeans:Op,kMedoids:Pp,fuzzyCMeans:tl,fcm:tl},zp=Tt({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Vp={single:"min",complete:"max"},Gp=function(e){var r=zp(e),a=Vp[r.linkage];return a!=null&&(r.linkage=a),r},rl=function(e,r,a,n,i){for(var o=0,s=1/0,u,l=i.attributes,f=function(O,R){return gi(i.distance,l.length,function(P){return l[P](O)},function(P){return l[P](R)},O,R)},h=0;h<e.length;h++){var v=e[h].key,c=a[v][n[v]];c<s&&(o=v,s=c)}if(i.mode==="threshold"&&s>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=r[o],p=r[n[o]],y;i.mode==="dendrogram"?y={left:d,right:p,key:d.key}:y={value:d.value.concat(p.value),key:d.key},e[d.index]=y,e.splice(p.index,1),r[d.key]=y;for(var g=0;g<e.length;g++){var b=e[g];d.key===b.key?u=1/0:i.linkage==="min"?(u=a[d.key][b.key],a[d.key][b.key]>a[p.key][b.key]&&(u=a[p.key][b.key])):i.linkage==="max"?(u=a[d.key][b.key],a[d.key][b.key]<a[p.key][b.key]&&(u=a[p.key][b.key])):i.linkage==="mean"?u=(a[d.key][b.key]*d.size+a[p.key][b.key]*p.size)/(d.size+p.size):i.mode==="dendrogram"?u=f(b.value,d.value):u=f(b.value[0],d.value[0]),a[d.key][b.key]=a[b.key][d.key]=u}for(var m=0;m<e.length;m++){var w=e[m].key;if(n[w]===d.key||n[w]===p.key){for(var T=w,D=0;D<e.length;D++){var x=e[D].key;a[w][x]<a[w][T]&&(T=x)}n[w]=T}e[m].index=m}return d.key=p.key=d.index=p.index=null,!0},sa=function(e,r,a){e&&(e.value?r.push(e.value):(e.left&&sa(e.left,r),e.right&&sa(e.right,r)))},Cs=function(e,r){if(!e)return"";if(e.left&&e.right){var a=Cs(e.left,r),n=Cs(e.right,r),i=r.add({group:"nodes",data:{id:a+","+n}});return r.add({group:"edges",data:{source:a,target:i.id()}}),r.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},Ss=function(e,r,a){if(!e)return[];var n=[],i=[],o=[];return r===0?(e.left&&sa(e.left,n),e.right&&sa(e.right,i),o=n.concat(i),[a.collection(o)]):r===1?e.value?[a.collection(e.value)]:(e.left&&sa(e.left,n),e.right&&sa(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=Ss(e.left,r-1,a)),e.right&&(i=Ss(e.right,r-1,a)),n.concat(i))},al=function(e){for(var r=this.cy(),a=this.nodes(),n=Gp(e),i=n.attributes,o=function(m,w){return gi(n.distance,i.length,function(T){return i[T](m)},function(T){return i[T](w)},m,w)},s=[],u=[],l=[],f=[],h=0;h<a.length;h++){var v={value:n.mode==="dendrogram"?a[h]:[a[h]],key:h,index:h};s[h]=v,f[h]=v,u[h]=[],l[h]=0}for(var c=0;c<s.length;c++)for(var d=0;d<=c;d++){var p=void 0;n.mode==="dendrogram"?p=c===d?1/0:o(s[c].value,s[d].value):p=c===d?1/0:o(s[c].value[0],s[d].value[0]),u[c][d]=p,u[d][c]=p,p<u[c][l[c]]&&(l[c]=d)}for(var y=rl(s,f,u,l,n);y;)y=rl(s,f,u,l,n);var g;return n.mode==="dendrogram"?(g=Ss(s[0],n.dendrogramDepth,r),n.addDendrogram&&Cs(s[0],r)):(g=new Array(s.length),s.forEach(function(b,m){b.key=b.index=null,g[m]=r.collection(b.value)})),g},Up={hierarchicalClustering:al,hca:al},Hp=Tt({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Yp=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||nt("Damping must range on [0.5, 1). Got: ".concat(r));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||be(a)||nt("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),Hp(e)},qp=function(e,r,a,n){var i=function(s,u){return n[u](s)};return-gi(e,n.length,function(o){return i(r,o)},function(o){return i(a,o)},r,a)},_p=function(e,r){var a=null;return r==="median"?a=Yg(e):r==="mean"?a=Hg(e):r==="min"?a=Gg(e):r==="max"?a=Ug(e):a=r,a},Wp=function(e,r,a){for(var n=[],i=0;i<e;i++)r[i*e+i]+a[i*e+i]>0&&n.push(i);return n},nl=function(e,r,a){for(var n=[],i=0;i<e;i++){for(var o=-1,s=-1/0,u=0;u<a.length;u++){var l=a[u];r[i*e+l]>s&&(o=l,s=r[i*e+l])}o>0&&n.push(o)}for(var f=0;f<a.length;f++)n[a[f]]=a[f];return n},Xp=function(e,r,a){for(var n=nl(e,r,a),i=0;i<a.length;i++){for(var o=[],s=0;s<n.length;s++)n[s]===a[i]&&o.push(s);for(var u=-1,l=-1/0,f=0;f<o.length;f++){for(var h=0,v=0;v<o.length;v++)h+=r[o[v]*e+o[f]];h>l&&(u=f,l=h)}a[i]=o[u]}return n=nl(e,r,a),n},il=function(e){for(var r=this.cy(),a=this.nodes(),n=Yp(e),i={},o=0;o<a.length;o++)i[a[o].id()]=o;var s,u,l,f,h,v;s=a.length,u=s*s,l=new Array(u);for(var c=0;c<u;c++)l[c]=-1/0;for(var d=0;d<s;d++)for(var p=0;p<s;p++)d!==p&&(l[d*s+p]=qp(n.distance,a[d],a[p],n.attributes));f=_p(l,n.preference);for(var y=0;y<s;y++)l[y*s+y]=f;h=new Array(u);for(var g=0;g<u;g++)h[g]=0;v=new Array(u);for(var b=0;b<u;b++)v[b]=0;for(var m=new Array(s),w=new Array(s),T=new Array(s),D=0;D<s;D++)m[D]=0,w[D]=0,T[D]=0;for(var x=new Array(s*n.minIterations),N=0;N<x.length;N++)x[N]=0;var O;for(O=0;O<n.maxIterations;O++){for(var R=0;R<s;R++){for(var P=-1/0,M=-1/0,I=-1,E=0,A=0;A<s;A++)m[A]=h[R*s+A],E=v[R*s+A]+l[R*s+A],E>=P?(M=P,P=E,I=A):E>M&&(M=E);for(var C=0;C<s;C++)h[R*s+C]=(1-n.damping)*(l[R*s+C]-P)+n.damping*m[C];h[R*s+I]=(1-n.damping)*(l[R*s+I]-M)+n.damping*m[I]}for(var S=0;S<s;S++){for(var L=0,V=0;V<s;V++)m[V]=v[V*s+S],w[V]=Math.max(0,h[V*s+S]),L+=w[V];L-=w[S],w[S]=h[S*s+S],L+=w[S];for(var F=0;F<s;F++)v[F*s+S]=(1-n.damping)*Math.min(0,L-w[F])+n.damping*m[F];v[S*s+S]=(1-n.damping)*(L-w[S])+n.damping*m[S]}for(var B=0,Y=0;Y<s;Y++){var q=v[Y*s+Y]+h[Y*s+Y]>0?1:0;x[O%n.minIterations*s+Y]=q,B+=q}if(B>0&&(O>=n.minIterations-1||O==n.maxIterations-1)){for(var Q=0,$=0;$<s;$++){T[$]=0;for(var K=0;K<n.minIterations;K++)T[$]+=x[K*s+$];(T[$]===0||T[$]===n.minIterations)&&Q++}if(Q===s)break}}for(var j=Wp(s,h,v),re=Xp(s,l,j),U={},H=0;H<j.length;H++)U[j[H]]=[];for(var _=0;_<a.length;_++){var W=i[a[_].id()],J=re[W];J!=null&&U[J].push(a[_])}for(var te=new Array(j.length),de=0;de<j.length;de++)te[de]=r.collection(U[j[de]]);return te},$p={affinityPropagation:il,ap:il},Kp=Tt({root:void 0,directed:!1}),Zp={hierholzer:function(e){if(!_e(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=Kp(e),n=a.root,i=a.directed,o=this,s=!1,u,l,f;n&&(f=Me(n)?this.filter(n)[0].id():n[0].id());var h={},v={};i?o.forEach(function(b){var m=b.id();if(b.isNode()){var w=b.indegree(!0),T=b.outdegree(!0),D=w-T,x=T-w;D==1?u?s=!0:u=m:x==1?l?s=!0:l=m:(x>1||D>1)&&(s=!0),h[m]=[],b.outgoers().forEach(function(N){N.isEdge()&&h[m].push(N.id())})}else v[m]=[void 0,b.target().id()]}):o.forEach(function(b){var m=b.id();if(b.isNode()){var w=b.degree(!0);w%2&&(u?l?s=!0:l=m:u=m),h[m]=[],b.connectedEdges().forEach(function(T){return h[m].push(T.id())})}else v[m]=[b.source().id(),b.target().id()]});var c={found:!1,trail:void 0};if(s)return c;if(l&&u)if(i){if(f&&l!=f)return c;f=l}else{if(f&&l!=f&&u!=f)return c;f||(f=l)}else f||(f=o[0].id());var d=function(m){for(var w=m,T=[m],D,x,N;h[w].length;)D=h[w].shift(),x=v[D][0],N=v[D][1],w!=N?(h[N]=h[N].filter(function(O){return O!=D}),w=N):!i&&w!=x&&(h[x]=h[x].filter(function(O){return O!=D}),w=x),T.unshift(D),T.unshift(w);return T},p=[],y=[];for(y=d(f);y.length!=1;)h[y[0]].length==0?(p.unshift(o.getElementById(y.shift())),p.unshift(o.getElementById(y.shift()))):y=d(y.shift()).concat(y);p.unshift(o.getElementById(y.shift()));for(var g in h)if(h[g].length)return c;return c.found=!0,c.trail=this.spawn(p,!0),c}},Cn=function(){var e=this,r={},a=0,n=0,i=[],o=[],s={},u=function(v,c){for(var d=o.length-1,p=[],y=e.spawn();o[d].x!=v||o[d].y!=c;)p.push(o.pop().edge),d--;p.push(o.pop().edge),p.forEach(function(g){var b=g.connectedNodes().intersection(e);y.merge(g),b.forEach(function(m){var w=m.id(),T=m.connectedEdges().intersection(e);y.merge(m),r[w].cutVertex?y.merge(T.filter(function(D){return D.isLoop()})):y.merge(T)})}),i.push(y)},l=function(v,c,d){v===d&&(n+=1),r[c]={id:a,low:a++,cutVertex:!1};var p=e.getElementById(c).connectedEdges().intersection(e);if(p.size()===0)i.push(e.spawn(e.getElementById(c)));else{var y,g,b,m;p.forEach(function(w){y=w.source().id(),g=w.target().id(),b=y===c?g:y,b!==d&&(m=w.id(),s[m]||(s[m]=!0,o.push({x:c,y:b,edge:w})),b in r?r[c].low=Math.min(r[c].low,r[b].id):(l(v,b,c),r[c].low=Math.min(r[c].low,r[b].low),r[c].id<=r[b].low&&(r[c].cutVertex=!0,u(c,b))))})}};e.forEach(function(h){if(h.isNode()){var v=h.id();v in r||(n=0,l(v,v),r[v].cutVertex=n>1)}});var f=Object.keys(r).filter(function(h){return r[h].cutVertex}).map(function(h){return e.getElementById(h)});return{cut:e.spawn(f),components:i}},Qp={hopcroftTarjanBiconnected:Cn,htbc:Cn,htb:Cn,hopcroftTarjanBiconnectedComponents:Cn},Sn=function(){var e=this,r={},a=0,n=[],i=[],o=e.spawn(e),s=function(l){i.push(l),r[l]={index:a,low:a++,explored:!1};var f=e.getElementById(l).connectedEdges().intersection(e);if(f.forEach(function(p){var y=p.target().id();y!==l&&(y in r||s(y),r[y].explored||(r[l].low=Math.min(r[l].low,r[y].low)))}),r[l].index===r[l].low){for(var h=e.spawn();;){var v=i.pop();if(h.merge(e.getElementById(v)),r[v].low=r[l].index,r[v].explored=!0,v===l)break}var c=h.edgesWith(h),d=h.merge(c);n.push(d),o=o.difference(d)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in r||s(l)}}),{cut:o,components:n}},Jp={tarjanStronglyConnected:Sn,tsc:Sn,tscc:Sn,tarjanStronglyConnectedComponents:Sn},nc={};[Ka,Lg,Ng,Rg,Pg,kg,zg,hp,fa,ha,Ts,Cp,Fp,Up,$p,Zp,Qp,Jp].forEach(function(t){Ie(nc,t)});/*!
|