diff --git a/.eslintignore b/.eslintignore index 012f471e24af..d68a243969c0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -23,3 +23,6 @@ public/locales/**/*.js # Auto-generated icon file packages/grafana-ui/src/components/Icon/iconBundle.ts + +# Sankey chart module.js +public/app/plugins/panel/sankey-panel-0.5.0/module.js diff --git a/public/app/features/plugins/built_in_plugins.ts b/public/app/features/plugins/built_in_plugins.ts index 4c28f0d7551c..ac23be169b4e 100644 --- a/public/app/features/plugins/built_in_plugins.ts +++ b/public/app/features/plugins/built_in_plugins.ts @@ -56,11 +56,11 @@ import * as gettingStartedPanel from 'app/plugins/panel/gettingstarted/module'; import * as histogramPanel from 'app/plugins/panel/histogram/module'; import * as livePanel from 'app/plugins/panel/live/module'; import * as logsPanel from 'app/plugins/panel/logs/module'; -//@ts-ignore -import * as sankeyPanel from 'app/plugins/panel/netsage-sankey-panel/module'; import * as newsPanel from 'app/plugins/panel/news/module'; import * as nodeGraph from 'app/plugins/panel/nodeGraph/module'; import * as pieChartPanel from 'app/plugins/panel/piechart/module'; +//@ts-ignore +import * as sankeyPanel from 'app/plugins/panel/sankey-panel-0.5.0/module'; import * as statPanel from 'app/plugins/panel/stat/module'; import * as stateTimelinePanel from 'app/plugins/panel/state-timeline/module'; import * as statusHistoryPanel from 'app/plugins/panel/status-history/module'; @@ -149,7 +149,7 @@ const builtInPlugins: any = { 'app/plugins/panel/nodeGraph/module': nodeGraph, 'app/plugins/panel/histogram/module': histogramPanel, 'app/plugins/panel/alertGroups/module': alertGroupsPanel, - 'app/plugins/panel/netsage-sankey-panel/module': sankeyPanel, + 'app/plugins/panel/sankey-panel-0.5.0/module': sankeyPanel, }; export default builtInPlugins; diff --git a/public/app/plugins/panel/img/logo.svg b/public/app/plugins/panel/img/logo.svg new file mode 100644 index 000000000000..2d41fa5441e6 --- /dev/null +++ b/public/app/plugins/panel/img/logo.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/app/plugins/panel/netsage-sankey-panel/CHANGELOG.md b/public/app/plugins/panel/netsage-sankey-panel/CHANGELOG.md deleted file mode 100644 index 9d63e78d6087..000000000000 --- a/public/app/plugins/panel/netsage-sankey-panel/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# Changelog - -## 1.0.0 (Unreleased) - -Initial release. diff --git a/public/app/plugins/panel/netsage-sankey-panel/LICENSE b/public/app/plugins/panel/netsage-sankey-panel/LICENSE deleted file mode 100644 index 8dada3edaf50..000000000000 --- a/public/app/plugins/panel/netsage-sankey-panel/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/public/app/plugins/panel/netsage-sankey-panel/MANIFEST.txt b/public/app/plugins/panel/netsage-sankey-panel/MANIFEST.txt deleted file mode 100644 index df287d00e404..000000000000 --- a/public/app/plugins/panel/netsage-sankey-panel/MANIFEST.txt +++ /dev/null @@ -1,36 +0,0 @@ - ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA512 - -{ - "manifestVersion": "2.0.0", - "signatureType": "community", - "signedByOrg": "netsage", - "signedByOrgName": "netsage", - "plugin": "netsage-sankey-panel", - "version": "1.0.6", - "time": 1638572412631, - "keyId": "7e4d0c6a708866e7", - "files": { - "img/logo.svg": "e1b79c50e08be2be3382fa42850209dc3a7496d56e60a45c4d8a1375a685e633", - "img/sankey2.png": "99651eceae6c3e99f6b0317f4eec4f7827d3d4c242b4f3a29d166a17f0e71cf8", - "img/sankey3.png": "9ec6c9fd8df713ce384b96e13f300f123672b293034a448c99ac1f739c54e117", - "LICENSE": "b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1", - "CHANGELOG.md": "aaa78be4710ef41d56ddab1edbd180ef9f9adfea2f293109aae925dc33a1b9b3", - "plugin.json": "473cff9ad4c1a2cb048f49db0b8be00784c95cd35f532f983f068f9510e426da", - "module.js.LICENSE.txt": "0d8f66cd4afb566cb5b7e1540c68f43b939d3eba12ace290f18abc4f4cb53ed0", - "module.js": "1f322c0fefd782cd9012cf2924bb6b732fa1231c996de2be1aa46283a9d64ac9", - "README.md": "d7217302fc453ea1d644fb02b22dbaca242317c8f18ab3ed93ebcef065c1127a", - "module.js.map": "59de1d9c597bd2e7c95c658bd305190d942e3d2091b42a12906a7fb00828c48a" - } -} ------BEGIN PGP SIGNATURE----- -Version: OpenPGP.js v4.10.1 -Comment: https://openpgpjs.org - -wqIEARMKAAYFAmGqoXwACgkQfk0ManCIZueqXQIJAS/RG/Hl7fj5xUdX9uDA -6lRMnN3+7eqsZ7FV9EdCcmsgZx0EpdofSZkMvXmLy6QwOtLiuMY1ibJMRgzo -lsYDf2yMAgkBe61G1aW6aqQReVRcSylIvZ/y53ZDX3pCjPQp5OBk6mRVUcQq -95JtwCqYOyvgCAXRoXPHl1Tfr9GbfNSevI0Iqaw= -=pSz1 ------END PGP SIGNATURE----- diff --git a/public/app/plugins/panel/netsage-sankey-panel/README.md b/public/app/plugins/panel/netsage-sankey-panel/README.md deleted file mode 100644 index 8414f4bb4e1e..000000000000 --- a/public/app/plugins/panel/netsage-sankey-panel/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# NetSage Sankey Grafana Plugin - -[![CI](https://github.com/netsage-project/netsage-sankey-panel/actions/workflows/ci.yml/badge.svg)](https://github.com/netsage-project/netsage-sankey-panel/actions/workflows/ci.yml) -[![Release](https://github.com/netsage-project/netsage-sankey-panel/actions/workflows/release.yml/badge.svg)](https://github.com/netsage-project/netsage-sankey-panel/actions/workflows/release.yml) - -This is a panel plugin for generating Sankey diagrams in Grafana 7.0+. Sankey diagrams are good for visualizing flow data and the width of the flows will be proportionate to the selected metric. - -![](https://github.com/netsage-project/netsage-sankey-panel/blob/master/src/img/sankey2.png?raw=true) - -## How it works - -The sankey panel requires at least 2 columns of data, a source and destination for the flows. This means your query should group your data into at least two groups. The screenshot above shows data grouped by source country, then by destination county. -The panel will draw links from the first column of data points, to the last in order of the query. The thickness of the links will be proportionate to the value as assigned by the metric in the query. - -![](https://github.com/netsage-project/netsage-sankey-panel/blob/master/src/img/sankey3.png?raw=true) - -## Customizing - -- **Links:** There are currently two options for link color: multi or single. It is multi-colored by default. To choose a single color for the links, toggle the "Single Link color only" option and choose your color from Grafana's color picker. -- **Nodes:** You can change the color of the rectangular nodes by changing the "Node color" option -- **Node Width** The width of the nodes can be adjusted with the "Node Width" slider or entering a number in the input box. This number must be an integer. -- **Node Padding** The vertical padding between nodes can be adjusted with the "Node Padding" slider or entering a number in the input box. This number must be an integer. If your links are too skinny, try adjusting this number -- **Headers** The column headers can be changed by using a Display Name override in the editor panel. They will be the same color you choose for Text color -- **Sankey Layout** The layout of the sankey links can be adjusted slightly using the "Layout iteration" slider. This number must be an integer and is the number of relaxation iterations used to generate the layout. diff --git a/public/app/plugins/panel/netsage-sankey-panel/img/logo.svg b/public/app/plugins/panel/netsage-sankey-panel/img/logo.svg deleted file mode 100644 index 4e78141cfa00..000000000000 --- a/public/app/plugins/panel/netsage-sankey-panel/img/logo.svg +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/public/app/plugins/panel/netsage-sankey-panel/img/sankey2.png b/public/app/plugins/panel/netsage-sankey-panel/img/sankey2.png deleted file mode 100644 index 5a3a97aba0e0..000000000000 Binary files a/public/app/plugins/panel/netsage-sankey-panel/img/sankey2.png and /dev/null differ diff --git a/public/app/plugins/panel/netsage-sankey-panel/img/sankey3.png b/public/app/plugins/panel/netsage-sankey-panel/img/sankey3.png deleted file mode 100644 index 57a7e98d5d89..000000000000 Binary files a/public/app/plugins/panel/netsage-sankey-panel/img/sankey3.png and /dev/null differ diff --git a/public/app/plugins/panel/netsage-sankey-panel/module.js b/public/app/plugins/panel/netsage-sankey-panel/module.js deleted file mode 100644 index 0629e54bb6bb..000000000000 --- a/public/app/plugins/panel/netsage-sankey-panel/module.js +++ /dev/null @@ -1,1153 +0,0 @@ -/*! For license information please see module.js.LICENSE.txt */ -/* eslint-disable */ -define(['d3', 'react', '@grafana/data', '@grafana/ui'], function (t, e, n, r) { - return (function (t) { - var e = {}; - function n(r) { - if (e[r]) return e[r].exports; - var o = (e[r] = { i: r, l: !1, exports: {} }); - return t[r].call(o.exports, o, o.exports, n), (o.l = !0), o.exports; - } - return ( - (n.m = t), - (n.c = e), - (n.d = function (t, e, r) { - n.o(t, e) || Object.defineProperty(t, e, { enumerable: !0, get: r }); - }), - (n.r = function (t) { - 'undefined' != typeof Symbol && - Symbol.toStringTag && - Object.defineProperty(t, Symbol.toStringTag, { value: 'Module' }), - Object.defineProperty(t, '__esModule', { value: !0 }); - }), - (n.t = function (t, e) { - if ((1 & e && (t = n(t)), 8 & e)) return t; - if (4 & e && 'object' == typeof t && t && t.__esModule) return t; - var r = Object.create(null); - if ((n.r(r), Object.defineProperty(r, 'default', { enumerable: !0, value: t }), 2 & e && 'string' != typeof t)) - for (var o in t) - n.d( - r, - o, - function (e) { - return t[e]; - }.bind(null, o) - ); - return r; - }), - (n.n = function (t) { - var e = - t && t.__esModule - ? function () { - return t.default; - } - : function () { - return t; - }; - return n.d(e, 'a', e), e; - }), - (n.o = function (t, e) { - return Object.prototype.hasOwnProperty.call(t, e); - }), - (n.p = '/'), - n((n.s = 5)) - ); - })([ - function (e, n) { - e.exports = t; - }, - function (t, n) { - t.exports = e; - }, - function (t, e) { - t.exports = n; - }, - function (t, e) { - t.exports = r; - }, - , - function (t, e, n) { - 'use strict'; - n.r(e); - var r = n(2); - var o = function () { - return (o = - Object.assign || - function (t) { - for (var e, n = 1, r = arguments.length; n < r; n++) - for (var o in (e = arguments[n])) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]); - return t; - }).apply(this, arguments); - }; - Object.create; - function i(t, e) { - var n = 'function' == typeof Symbol && t[Symbol.iterator]; - if (!n) return t; - var r, - o, - i = n.call(t), - a = []; - try { - for (; (void 0 === e || e-- > 0) && !(r = i.next()).done; ) a.push(r.value); - } catch (t) { - o = { error: t }; - } finally { - try { - r && !r.done && (n = i.return) && n.call(i); - } finally { - if (o) throw o.error; - } - } - return a; - } - Object.create; - var a = n(1), - s = n.n(a); - function l(t, e) { - let n = 0; - if (void 0 === e) for (let e of t) (e = +e) && (n += e); - else { - let r = -1; - for (let o of t) (o = +e(o, ++r, t)) && (n += o); - } - return n; - } - function u(t, e) { - let n; - if (void 0 === e) for (const e of t) null != e && (n < e || (void 0 === n && e >= e)) && (n = e); - else { - let r = -1; - for (let o of t) null != (o = e(o, ++r, t)) && (n < o || (void 0 === n && o >= o)) && (n = o); - } - return n; - } - function c(t, e) { - let n; - if (void 0 === e) for (const e of t) null != e && (n > e || (void 0 === n && e >= e)) && (n = e); - else { - let r = -1; - for (let o of t) null != (o = e(o, ++r, t)) && (n > o || (void 0 === n && o >= o)) && (n = o); - } - return n; - } - function f(t, e) { - return t.sourceLinks.length ? t.depth : e - 1; - } - function d(t) { - return function () { - return t; - }; - } - function h(t, e) { - return y(t.source, e.source) || t.index - e.index; - } - function p(t, e) { - return y(t.target, e.target) || t.index - e.index; - } - function y(t, e) { - return t.y0 - e.y0; - } - function g(t) { - return t.value; - } - function m(t) { - return t.index; - } - function b(t) { - return t.nodes; - } - function x(t) { - return t.links; - } - function v(t, e) { - const n = t.get(e); - if (!n) throw new Error('missing: ' + e); - return n; - } - function k({ nodes: t }) { - for (const e of t) { - let t = e.y0, - n = t; - for (const n of e.sourceLinks) (n.y0 = t + n.width / 2), (t += n.width); - for (const t of e.targetLinks) (t.y1 = n + t.width / 2), (n += t.width); - } - } - function w() { - let t, - e, - n, - r = 0, - o = 0, - i = 1, - a = 1, - s = 24, - w = 8, - _ = m, - L = f, - M = b, - C = x, - E = 6; - function S() { - const t = { nodes: M.apply(null, arguments), links: C.apply(null, arguments) }; - return A(t), P(t), O(t), j(t), N(t), k(t), t; - } - function A({ nodes: t, links: e }) { - for (const [e, n] of t.entries()) (n.index = e), (n.sourceLinks = []), (n.targetLinks = []); - const r = new Map(t.map((e, n) => [_(e, n, t), e])); - for (const [t, n] of e.entries()) { - n.index = t; - let { source: e, target: o } = n; - 'object' != typeof e && (e = n.source = v(r, e)), - 'object' != typeof o && (o = n.target = v(r, o)), - e.sourceLinks.push(n), - o.targetLinks.push(n); - } - if (null != n) for (const { sourceLinks: e, targetLinks: r } of t) e.sort(n), r.sort(n); - } - function P({ nodes: t }) { - for (const e of t) - e.value = void 0 === e.fixedValue ? Math.max(l(e.sourceLinks, g), l(e.targetLinks, g)) : e.fixedValue; - } - function O({ nodes: t }) { - const e = t.length; - let n = new Set(t), - r = new Set(), - o = 0; - for (; n.size; ) { - for (const t of n) { - t.depth = o; - for (const { target: e } of t.sourceLinks) r.add(e); - } - if (++o > e) throw new Error('circular link'); - (n = r), (r = new Set()); - } - } - function j({ nodes: t }) { - const e = t.length; - let n = new Set(t), - r = new Set(), - o = 0; - for (; n.size; ) { - for (const t of n) { - t.height = o; - for (const { source: e } of t.targetLinks) r.add(e); - } - if (++o > e) throw new Error('circular link'); - (n = r), (r = new Set()); - } - } - function N(n) { - const f = (function ({ nodes: t }) { - const n = u(t, (t) => t.depth) + 1, - o = (i - r - s) / (n - 1), - a = new Array(n); - for (const e of t) { - const t = Math.max(0, Math.min(n - 1, Math.floor(L.call(null, e, n)))); - (e.layer = t), (e.x0 = r + t * o), (e.x1 = e.x0 + s), a[t] ? a[t].push(e) : (a[t] = [e]); - } - if (e) for (const t of a) t.sort(e); - return a; - })(n); - (t = Math.min(w, (a - o) / (u(f, (t) => t.length) - 1))), - (function (e) { - const n = c(e, (e) => (a - o - (e.length - 1) * t) / l(e, g)); - for (const r of e) { - let e = o; - for (const o of r) { - (o.y0 = e), (o.y1 = e + o.value * n), (e = o.y1 + t); - for (const t of o.sourceLinks) t.width = t.value * n; - } - e = (a - e + t) / (r.length + 1); - for (let t = 0; t < r.length; ++t) { - const n = r[t]; - (n.y0 += e * (t + 1)), (n.y1 += e * (t + 1)); - } - B(r); - } - })(f); - for (let t = 0; t < E; ++t) { - const e = Math.pow(0.99, t), - n = Math.max(1 - e, (t + 1) / E); - V(f, e, n), I(f, e, n); - } - } - function I(t, n, r) { - for (let o = 1, i = t.length; o < i; ++o) { - const i = t[o]; - for (const t of i) { - let e = 0, - r = 0; - for (const { source: n, value: o } of t.targetLinks) { - let i = o * (t.layer - n.layer); - (e += W(n, t) * i), (r += i); - } - if (!(r > 0)) continue; - let o = (e / r - t.y0) * n; - (t.y0 += o), (t.y1 += o), z(t); - } - void 0 === e && i.sort(y), T(i, r); - } - } - function V(t, n, r) { - for (let o = t.length - 2; o >= 0; --o) { - const i = t[o]; - for (const t of i) { - let e = 0, - r = 0; - for (const { target: n, value: o } of t.sourceLinks) { - let i = o * (n.layer - t.layer); - (e += X(t, n) * i), (r += i); - } - if (!(r > 0)) continue; - let o = (e / r - t.y0) * n; - (t.y0 += o), (t.y1 += o), z(t); - } - void 0 === e && i.sort(y), T(i, r); - } - } - function T(e, n) { - const r = e.length >> 1, - i = e[r]; - F(e, i.y0 - t, r - 1, n), D(e, i.y1 + t, r + 1, n), F(e, a, e.length - 1, n), D(e, o, 0, n); - } - function D(e, n, r, o) { - for (; r < e.length; ++r) { - const i = e[r], - a = (n - i.y0) * o; - a > 1e-6 && ((i.y0 += a), (i.y1 += a)), (n = i.y1 + t); - } - } - function F(e, n, r, o) { - for (; r >= 0; --r) { - const i = e[r], - a = (i.y1 - n) * o; - a > 1e-6 && ((i.y0 -= a), (i.y1 -= a)), (n = i.y0 - t); - } - } - function z({ sourceLinks: t, targetLinks: e }) { - if (void 0 === n) { - for (const { - source: { sourceLinks: t }, - } of e) - t.sort(p); - for (const { - target: { targetLinks: e }, - } of t) - e.sort(h); - } - } - function B(t) { - if (void 0 === n) for (const { sourceLinks: e, targetLinks: n } of t) e.sort(p), n.sort(h); - } - function W(e, n) { - let r = e.y0 - ((e.sourceLinks.length - 1) * t) / 2; - for (const { target: o, width: i } of e.sourceLinks) { - if (o === n) break; - r += i + t; - } - for (const { source: t, width: o } of n.targetLinks) { - if (t === e) break; - r -= o; - } - return r; - } - function X(e, n) { - let r = n.y0 - ((n.targetLinks.length - 1) * t) / 2; - for (const { source: o, width: i } of n.targetLinks) { - if (o === e) break; - r += i + t; - } - for (const { target: t, width: o } of e.sourceLinks) { - if (t === n) break; - r -= o; - } - return r; - } - return ( - (S.update = function (t) { - return k(t), t; - }), - (S.nodeId = function (t) { - return arguments.length ? ((_ = 'function' == typeof t ? t : d(t)), S) : _; - }), - (S.nodeAlign = function (t) { - return arguments.length ? ((L = 'function' == typeof t ? t : d(t)), S) : L; - }), - (S.nodeSort = function (t) { - return arguments.length ? ((e = t), S) : e; - }), - (S.nodeWidth = function (t) { - return arguments.length ? ((s = +t), S) : s; - }), - (S.nodePadding = function (e) { - return arguments.length ? ((w = t = +e), S) : w; - }), - (S.nodes = function (t) { - return arguments.length ? ((M = 'function' == typeof t ? t : d(t)), S) : M; - }), - (S.links = function (t) { - return arguments.length ? ((C = 'function' == typeof t ? t : d(t)), S) : C; - }), - (S.linkSort = function (t) { - return arguments.length ? ((n = t), S) : n; - }), - (S.size = function (t) { - return arguments.length ? ((r = o = 0), (i = +t[0]), (a = +t[1]), S) : [i - r, a - o]; - }), - (S.extent = function (t) { - return arguments.length - ? ((r = +t[0][0]), (i = +t[1][0]), (o = +t[0][1]), (a = +t[1][1]), S) - : [ - [r, o], - [i, a], - ]; - }), - (S.iterations = function (t) { - return arguments.length ? ((E = +t), S) : E; - }), - S - ); - } - var _ = Math.PI, - L = 2 * _, - M = L - 1e-6; - function C() { - (this._x0 = this._y0 = this._x1 = this._y1 = null), (this._ = ''); - } - function E() { - return new C(); - } - C.prototype = E.prototype = { - constructor: C, - moveTo: function (t, e) { - this._ += 'M' + (this._x0 = this._x1 = +t) + ',' + (this._y0 = this._y1 = +e); - }, - closePath: function () { - null !== this._x1 && ((this._x1 = this._x0), (this._y1 = this._y0), (this._ += 'Z')); - }, - lineTo: function (t, e) { - this._ += 'L' + (this._x1 = +t) + ',' + (this._y1 = +e); - }, - quadraticCurveTo: function (t, e, n, r) { - this._ += 'Q' + +t + ',' + +e + ',' + (this._x1 = +n) + ',' + (this._y1 = +r); - }, - bezierCurveTo: function (t, e, n, r, o, i) { - this._ += 'C' + +t + ',' + +e + ',' + +n + ',' + +r + ',' + (this._x1 = +o) + ',' + (this._y1 = +i); - }, - arcTo: function (t, e, n, r, o) { - (t = +t), (e = +e), (n = +n), (r = +r), (o = +o); - var i = this._x1, - a = this._y1, - s = n - t, - l = r - e, - u = i - t, - c = a - e, - f = u * u + c * c; - if (o < 0) throw new Error('negative radius: ' + o); - if (null === this._x1) this._ += 'M' + (this._x1 = t) + ',' + (this._y1 = e); - else if (f > 1e-6) - if (Math.abs(c * s - l * u) > 1e-6 && o) { - var d = n - i, - h = r - a, - p = s * s + l * l, - y = d * d + h * h, - g = Math.sqrt(p), - m = Math.sqrt(f), - b = o * Math.tan((_ - Math.acos((p + f - y) / (2 * g * m))) / 2), - x = b / m, - v = b / g; - Math.abs(x - 1) > 1e-6 && (this._ += 'L' + (t + x * u) + ',' + (e + x * c)), - (this._ += - 'A' + - o + - ',' + - o + - ',0,0,' + - +(c * d > u * h) + - ',' + - (this._x1 = t + v * s) + - ',' + - (this._y1 = e + v * l)); - } else this._ += 'L' + (this._x1 = t) + ',' + (this._y1 = e); - else; - }, - arc: function (t, e, n, r, o, i) { - (t = +t), (e = +e), (i = !!i); - var a = (n = +n) * Math.cos(r), - s = n * Math.sin(r), - l = t + a, - u = e + s, - c = 1 ^ i, - f = i ? r - o : o - r; - if (n < 0) throw new Error('negative radius: ' + n); - null === this._x1 - ? (this._ += 'M' + l + ',' + u) - : (Math.abs(this._x1 - l) > 1e-6 || Math.abs(this._y1 - u) > 1e-6) && (this._ += 'L' + l + ',' + u), - n && - (f < 0 && (f = (f % L) + L), - f > M - ? (this._ += - 'A' + - n + - ',' + - n + - ',0,1,' + - c + - ',' + - (t - a) + - ',' + - (e - s) + - 'A' + - n + - ',' + - n + - ',0,1,' + - c + - ',' + - (this._x1 = l) + - ',' + - (this._y1 = u)) - : f > 1e-6 && - (this._ += - 'A' + - n + - ',' + - n + - ',0,' + - +(f >= _) + - ',' + - c + - ',' + - (this._x1 = t + n * Math.cos(o)) + - ',' + - (this._y1 = e + n * Math.sin(o)))); - }, - rect: function (t, e, n, r) { - this._ += - 'M' + (this._x0 = this._x1 = +t) + ',' + (this._y0 = this._y1 = +e) + 'h' + +n + 'v' + +r + 'h' + -n + 'Z'; - }, - toString: function () { - return this._; - }, - }; - var S = E, - A = Array.prototype.slice, - P = function (t) { - return function () { - return t; - }; - }; - function O(t) { - return t[0]; - } - function j(t) { - return t[1]; - } - function N(t) { - return t.source; - } - function I(t) { - return t.target; - } - function V(t) { - var e = N, - n = I, - r = O, - o = j, - i = null; - function a() { - var a, - s = A.call(arguments), - l = e.apply(this, s), - u = n.apply(this, s); - if ( - (i || (i = a = S()), - t( - i, - +r.apply(this, ((s[0] = l), s)), - +o.apply(this, s), - +r.apply(this, ((s[0] = u), s)), - +o.apply(this, s) - ), - a) - ) - return (i = null), a + '' || null; - } - return ( - (a.source = function (t) { - return arguments.length ? ((e = t), a) : e; - }), - (a.target = function (t) { - return arguments.length ? ((n = t), a) : n; - }), - (a.x = function (t) { - return arguments.length ? ((r = 'function' == typeof t ? t : P(+t)), a) : r; - }), - (a.y = function (t) { - return arguments.length ? ((o = 'function' == typeof t ? t : P(+t)), a) : o; - }), - (a.context = function (t) { - return arguments.length ? ((i = null == t ? null : t), a) : i; - }), - a - ); - } - function T(t, e, n, r, o) { - t.moveTo(e, n), t.bezierCurveTo((e = (e + r) / 2), n, e, o, r, o); - } - function D(t) { - return [t.source.x1, t.y0]; - } - function F(t) { - return [t.target.x0, t.y1]; - } - var z, - B = function () { - return V(T).source(D).target(F); - }, - W = function (t) { - var e = t.data, - n = t.panelId, - r = B(), - o = e.color, - i = n + '-' + e.id, - a = 'sankey-path' + n; - return s.a.createElement( - s.a.Fragment, - null, - s.a.createElement('path', { - d: r(e), - fill: 'none', - stroke: o, - strokeOpacity: 0.8, - opacity: 0.7, - strokeWidth: e.width, - id: i, - display: e.displayValue, - className: a, - }) - ); - }, - X = n(3), - Y = function (t) { - var e = t.data, - n = t.textColor, - r = t.nodeColor, - o = t.panelId, - i = Object(X.useTheme2)(), - a = e.x0, - l = e.x1, - u = e.y0, - c = e.y1, - f = e.index, - d = e.name, - h = e.value, - p = l - a, - y = i.typography.fontSize, - g = 'sankey-node' + o; - return s.a.createElement( - s.a.Fragment, - null, - s.a.createElement('rect', { - x: a, - y: u, - rx: 5, - ry: 5, - width: p, - height: c - u, - stroke: 'black', - fill: r, - 'data-index': f, - id: o + ',' + e.id, - d: h, - name: d, - className: g, - }), - s.a.createElement( - 'text', - { - x: a < p / 2 ? l + 6 : a - 6, - y: (c + u) / 2, - style: { - fill: n, - alignmentBaseline: 'middle', - fontSize: y, - textAnchor: a < p / 2 ? 'start' : 'end', - pointerEvents: 'none', - userSelect: 'none', - }, - }, - d - ) - ); - }, - q = n(0), - Z = function (t) { - var e = t.rowNames, - n = t.field, - r = t.panelId, - o = i(Object(a.useState)({ mouseX: 100, mouseY: 100 }), 2), - s = o[0], - l = o[1], - u = function (t) { - l({ mouseX: t.clientX, mouseY: t.clientY }); - }; - return ( - Object(a.useEffect)(function () { - window.addEventListener('mousemove', u); - var t = '.sankey-path' + r; - q.selectAll(t) - .on('mouseover', function (n, r) { - var o = this, - i = q.select(this).attr('id'), - a = i.split('-'), - l = e.find(function (t) { - return t.name === a[1]; - }).display; - q.selectAll(t).each(function (t) { - var e = q.select(this).attr('id'), - n = i === e; - q.select(this).attr('opacity', n ? 1 : 0.4); - }); - var u = q.select(this).attr('id'); - q.select('body') - .append('div') - .attr('class', 'tooltip-' + u) - .html(function () { - var t = q.select(o).attr('display'); - return l + '
' + t + ''; - }) - .style('padding', '10px 15px') - .style('background', 'black') - .style('color', 'white') - .style('border', '#A8A8A8 solid 5px') - .style('border-radius', '5px') - .style('left', s.mouseX + 'px') - .style('top', s.mouseY + 'px') - .style('opacity', 0) - .style('position', 'absolute') - .transition() - .duration(200) - .style('opacity', 0.8); - }) - .on('mouseout', function (e) { - var n = q.select(this).attr('id'); - q - .selectAll('.tooltip-' + n) - .transition() - .duration(300) - .remove(), - q.selectAll(t).attr('opacity', 0.7); - }); - var o = '.sankey-node' + r; - return ( - q - .selectAll(o) - .on('mouseover', function (e, r) { - var o = this, - i = q.select(this).attr('id').split(','), - a = i[0], - l = []; - i.forEach(function (t) { - l.push(a + '-' + t); - }), - q.selectAll(t).each(function (t) { - var e = q.select(this).attr('id'), - n = l.find(function (t) { - return t === e; - }); - q.select(this).attr('opacity', n ? 1 : 0.2); - }); - var u = q.select(this).attr('data-index'); - q.select('body') - .append('div') - .attr('class', 'tooltip-node' + u) - .html(function () { - var t = n.display(q.select(o).attr('d')), - e = q.select(o).attr('name'); - return t.suffix - ? e + ': ' + t.text + ' ' + t.suffix + '' - : e + ': ' + t.text + ''; - }) - .style('padding', '10px 15px') - .style('background', 'black') - .style('color', 'white') - .style('border', '#A8A8A8 solid 5px') - .style('border-radius', '5px') - .style('left', s.mouseX + 'px') - .style('top', s.mouseY + 'px') - .style('opacity', 0) - .style('position', 'absolute') - .transition() - .duration(200) - .style('opacity', 0.8); - }) - .on('mouseout', function (e) { - var n = q.select(this).attr('data-index'); - q - .selectAll('.tooltip-node' + n) - .transition() - .duration(300) - .remove(), - q.selectAll(t).attr('opacity', 0.7); - }), - function () { - window.removeEventListener('mousemove', u); - } - ); - }), - null - ); - }, - Q = function (t) { - var e = t.displayNames, - n = t.width, - r = t.id, - o = t.topMargin, - i = t.textColor; - return ( - Object(a.useEffect)(function () { - q.select('#' + r) - .selectAll('.header-text') - .remove(); - var t = q - .select('#' + r) - .append('g') - .attr('id', r + ' header'), - a = 20, - s = o / 2; - if ( - (t - .append('text') - .attr('class', 'header-text') - .attr('transform', 'translate(' + a + ',' + s + ')') - .attr('font-size', '14pt') - .attr('font-weight', '500') - .attr('text-anchor', 'start') - .text(e[0]) - .attr('fill', i), - t - .append('text') - .attr('class', 'header-text') - .attr('transform', 'translate(' + (n + a) + ',' + s + ')') - .attr('font-size', '14pt') - .attr('font-weight', '500') - .attr('text-anchor', 'end') - .text(e[e.length - 2]) - .attr('fill', i), - e.length > 3) - ) - for (var l = n / (e.length - 2), u = 1; u < e.length - 2; u++) { - var c = l * u + a; - t.append('text') - .attr('class', 'header-text') - .attr('transform', 'translate(' + c + ',' + s + ')') - .attr('font-size', '14pt') - .attr('font-weight', '500') - .attr('text-anchor', 'middle') - .text(e[u]) - .attr('fill', i); - } - }), - null - ); - }, - G = function (t) { - var e = t.data, - n = t.width, - r = t.height, - o = t.displayNames, - i = t.rowDisplayNames, - a = t.id, - l = t.textColor, - u = t.nodeColor, - c = t.field, - f = t.nodeWidth, - d = t.nodePadding, - h = t.iteration, - p = 75, - y = 20, - g = n - y - 20, - m = r - p - 50, - b = w() - .iterations(h) - .nodeWidth(f) - .nodePadding(d) - .extent([ - [0, 0], - [g, m], - ]); - if (e) { - var x = b(e), - v = x.links, - k = x.nodes; - return s.a.createElement( - 'svg', - { id: 'Chart_' + a, width: n, height: r }, - s.a.createElement(Q, { displayNames: o, width: g, id: 'Chart_' + a, topMargin: p, textColor: l }), - s.a.createElement(Z, { rowNames: i, field: c, panelId: a }), - s.a.createElement( - 'g', - { transform: 'translate(' + y + ', ' + p + ')' }, - v.map(function (t, e) { - return s.a.createElement(W, { key: e, data: t, panelId: a }); - }) - ), - s.a.createElement( - 'g', - { transform: 'translate(' + y + ', ' + p + ')' }, - k.map(function (t, e) { - return s.a.createElement(Y, { data: t, key: e, textColor: l, nodeColor: u, panelId: a }); - }) - ) - ); - } - return s.a.createElement('div', { id: 'Chart_' + a, style: { height: r, width: n } }); - }; - n.d(e, 'plugin', function () { - return H; - }); - var H = new r.PanelPlugin(function (t) { - var e = t.options, - n = t.data, - i = t.width, - a = t.height, - l = t.id, - u = o({}, e), - c = Object(X.useTheme2)(), - f = []; - try { - f = (function (t, e, n, o) { - var i = e.valueFieldName; - function a(t) { - switch (t) { - case 'dark-green': - t = '#1A7311'; - break; - case 'semi-dark-green': - t = '#36872D'; - break; - case 'light-green': - t = '#73BF68'; - break; - case 'super-light-green': - t = '#96D88C'; - break; - case 'dark-yellow': - t = 'rgb(207, 159, 0)'; - break; - case 'semi-dark-yellow': - t = 'rgb(224, 180, 0)'; - break; - case 'light-yellow': - t = 'rgb(250, 222, 42)'; - break; - case 'super-light-yellow': - t = 'rgb(255, 238, 82)'; - break; - case 'dark-red': - t = 'rgb(173, 3, 23)'; - break; - case 'semi-dark-red': - t = 'rgb(196, 22, 42)'; - break; - case 'light-red': - t = 'rgb(242, 73, 92)'; - break; - case 'super-light-red': - t = 'rgb(255, 115, 131)'; - break; - case 'dark-blue': - t = 'rgb(18, 80, 176)'; - break; - case 'semi-dark-blue': - t = 'rgb(31, 96, 196)'; - break; - case 'light-blue': - t = 'rgb(87, 148, 242)'; - break; - case 'super-light-blue': - t = 'rgb(138, 184, 255)'; - break; - case 'dark-orange': - t = 'rgb(229, 84, 0)'; - break; - case 'semi-dark-orange': - t = 'rgb(250, 100, 0)'; - break; - case 'light-orange': - t = 'rgb(255, 152, 48)'; - break; - case 'super-light-orange': - t = 'rgb(255, 179, 87)'; - break; - case 'dark-purple': - t = 'rgb(124, 46, 163)'; - break; - case 'semi-dark-purple': - t = 'rgb(143, 59, 184)'; - break; - case 'light-purple': - t = 'rgb(184, 119, 217)'; - break; - case 'super-light-purple': - t = 'rgb(202, 149, 229)'; - } - return t; - } - var s = []; - n - ? s.push(a(o)) - : (s.push('#018EDB'), s.push('#DB8500'), s.push('#7C00DB'), s.push('#DB0600'), s.push('#00DB57')); - var l = t.series[0].fields, - u = l.length - 1, - c = []; - l.forEach(function (t) { - c.push(Object(r.getFieldDisplayName)(t)); - }); - var f = i - ? t.series.map(function (t) { - return t.fields.find(function (t) { - return t.name === i; - }); - }) - : t.series.map(function (t) { - return t.fields.find(function (t) { - return 'number' === t.type; - }); - }), - d = []; - f[0].values.buffer.map(function (t) { - d.push([t, f[0].display(t), f[0].name]); - }); - var h, - p = t.series[0], - y = new r.DataFrameView(p), - g = [], - m = [], - b = [], - x = [], - v = 0; - return ( - y.forEach(function (t) { - for ( - var e, - n = [], - r = function (e) { - var r = t[e], - o = m.findIndex(function (t) { - return t.name === r && t.colId === e; - }); - -1 === o - ? ((o = m.push({ name: r, id: ['row' + v], colId: e }) - 1), - 0 === e && ((h = s[b.length % s.length]), b.push({ name: r, index: o, color: h }))) - : m[o].id.push('row' + v), - n.push(o); - }, - o = 0; - o < u; - o++ - ) - r(o); - var i = - null === - (e = b.find(function (t) { - return t.index === n[0]; - })) || void 0 === e - ? void 0 - : e.color, - a = '' + m[n[0]].name; - for (o = 0; o < n.length - 1; o++) { - var l, - c = f[0].display(t[u]); - (l = c.suffix ? c.text + ' ' + c.suffix : '' + c.text), - g.push({ - source: n[o], - target: n[o + 1], - value: t[u], - displayValue: l, - id: 'row' + v, - color: i, - node0: n[0], - }), - (a = a.concat(' -> ' + m[n[o + 1]].name)); - } - x.push({ name: 'row' + v, display: a }), v++; - }), - [{ links: g, nodes: m }, c, x, f[0], a] - ); - })(n, e, u.monochrome, u.color); - } catch (t) {} - var d = f[1], - h = f[0], - p = f[2], - y = f[3], - g = f[4], - m = c.colors.text.primary, - b = g(u.nodeColor); - return s.a.createElement( - 'g', - null, - s.a.createElement(G, { - data: h, - displayNames: d, - rowDisplayNames: p, - width: i, - height: a, - id: l, - textColor: m, - nodeColor: b, - field: y, - nodeWidth: u.nodeWidth, - nodePadding: u.nodePadding, - iteration: u.iteration, - }) - ); - }) - .setPanelOptions(function (t) { - var e; - t.addBooleanSwitch({ path: 'monochrome', name: 'Single Link color only', defaultValue: !1 }) - .addColorPicker({ - path: 'color', - name: 'Link Color', - showIf: - ((e = !0), - function (t) { - return t.monochrome === e; - }), - defaultValue: 'blue', - }) - .addColorPicker({ path: 'nodeColor', name: 'Node color', defaultValue: 'grey' }) - .addSliderInput({ - path: 'nodeWidth', - name: 'Node width', - defaultValue: 30, - settings: { min: 5, max: 100, step: 1 }, - }) - .addSliderInput({ - path: 'nodePadding', - name: 'Node padding', - defaultValue: 30, - settings: { min: 1, max: 100, step: 1 }, - }) - .addSliderInput({ - path: 'iteration', - name: 'Layout iterations', - defaultValue: 7, - settings: { min: 1, max: 30, step: 1 }, - }); - }) - .useFieldConfig({ - disableStandardOptions: [r.FieldConfigProperty.NoValue, r.FieldConfigProperty.Max, r.FieldConfigProperty.Min], - standardOptions: - ((z = {}), - (z[r.FieldConfigProperty.Color] = { - settings: { byValueSupport: !0, bySeriesSupport: !0, preferThresholdsMode: !0 }, - }), - z), - }); - }, - ]); -}); -//# sourceMappingURL=module.js.map -/* eslint-enable */ diff --git a/public/app/plugins/panel/netsage-sankey-panel/module.js.map b/public/app/plugins/panel/netsage-sankey-panel/module.js.map deleted file mode 100644 index 91646d921cb7..000000000000 --- a/public/app/plugins/panel/netsage-sankey-panel/module.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"d3\"","webpack:///external \"react\"","webpack:///external \"@grafana/data\"","webpack:///external \"@grafana/ui\"","webpack:///../node_modules/tslib/tslib.es6.js","webpack:///../node_modules/d3-sankey/node_modules/d3-array/src/sum.js","webpack:///../node_modules/d3-sankey/node_modules/d3-array/src/max.js","webpack:///../node_modules/d3-sankey/node_modules/d3-array/src/min.js","webpack:///../node_modules/d3-sankey/src/align.js","webpack:///../node_modules/d3-sankey/src/constant.js","webpack:///../node_modules/d3-sankey/src/sankey.js","webpack:///../node_modules/d3-path/src/path.js","webpack:///../node_modules/d3-shape/src/array.js","webpack:///../node_modules/d3-shape/src/constant.js","webpack:///../node_modules/d3-shape/src/point.js","webpack:///../node_modules/d3-shape/src/link/index.js","webpack:///../node_modules/d3-sankey/src/sankeyLinkHorizontal.js","webpack:///./components/Link.tsx","webpack:///./components/Node.tsx","webpack:///./components/Tooltip.tsx","webpack:///./components/Headers.tsx","webpack:///./components/Sankey.tsx","webpack:///./module.ts","webpack:///./SankeyPanel.tsx","webpack:///./dataParser.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","__WEBPACK_EXTERNAL_MODULE__0__","__WEBPACK_EXTERNAL_MODULE__1__","__WEBPACK_EXTERNAL_MODULE__2__","__WEBPACK_EXTERNAL_MODULE__3__","__assign","assign","arguments","length","apply","this","__read","iterator","e","ar","next","done","push","error","sum","values","valueof","undefined","index","max","min","justify","node","sourceLinks","depth","constant","x","ascendingSourceBreadth","a","b","ascendingBreadth","source","ascendingTargetBreadth","target","y0","defaultId","defaultNodes","graph","nodes","defaultLinks","links","find","nodeById","id","Error","computeLinkBreadths","y1","link","width","targetLinks","py","sort","linkSort","x0","x1","dx","dy","align","iterations","sankey","computeNodeLinks","computeNodeValues","computeNodeDepths","computeNodeHeights","computeNodeBreadths","entries","Map","map","fixedValue","Math","current","Set","size","add","height","columns","kx","Array","floor","layer","column","computeNodeLayers","ky","y","reorderLinks","initializeNodeBreadths","alpha","pow","beta","relaxRightToLeft","relaxLeftToRight","w","v","targetTop","reorderNodeLinks","resolveCollisions","sourceTop","subject","resolveCollisionsBottomToTop","resolveCollisionsTopToBottom","update","nodeId","_","nodeAlign","nodeSort","nodeWidth","nodePadding","extent","pi","PI","tau","tauEpsilon","Path","_x0","_y0","_x1","_y1","path","constructor","moveTo","closePath","lineTo","quadraticCurveTo","bezierCurveTo","x2","y2","arcTo","x21","y21","x01","y01","l01_2","abs","x20","y20","l21_2","l20_2","l21","sqrt","l01","tan","acos","t01","t21","arc","a0","a1","ccw","cos","sin","cw","da","rect","h","toString","slice","linkSource","linkTarget","curve","context","buffer","argv","curveHorizontal","horizontalSource","horizontalTarget","data","panelId","strokeColor","color","className","fill","stroke","strokeOpacity","opacity","strokeWidth","display","displayValue","textColor","nodeColor","theme","fontSize","typography","rx","ry","style","alignmentBaseline","textAnchor","pointerEvents","userSelect","rowNames","field","mouseX","mouseY","mousePosition","setMousePosition","updateMousePosition","clientX","clientY","window","addEventListener","pathClass","on","event","attr","row","split","each","thisId","dark","append","html","textVal","transition","duration","remove","nodeClass","rowList","forEach","found","thisNode","suffix","text","removeEventListener","displayNames","topMargin","selectAll","head","MARGIN","translateY","colWidth","translateX","rowDisplayNames","iteration","graphWidth","graphHeight","transform","options","graphOptions","parsedData","monochrome","valueFieldName","fixColor","colorArray","allData","series","fields","numFields","valueField","type","currentColor","frame","pluginDataLinks","pluginDataNodes","col0","rowId","currentLink","findIndex","colId","rowColor","rowDisplay","fieldValues","node0","concat","parseData","pluginData","colors","primary","setPanelOptions","builder","addBooleanSwitch","defaultValue","addColorPicker","showIf","config","addSliderInput","settings","step","useFieldConfig","disableStandardOptions","NoValue","Max","Min","standardOptions","Color","byValueSupport","bySeriesSupport","preferThresholdsMode"],"mappings":";0FACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EA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AAM,aACN2S,aAAc,SAEfI,eAAe,CACd7J,KAAM,YACNlJ,KAAM,aACN2S,aAAc,GACdK,SAAU,CACR/P,IAAK,EACLD,IAAK,IACLiQ,KAAM,KAGTF,eAAe,CACd7J,KAAM,cACNlJ,KAAM,eACN2S,aAAc,GACdK,SAAU,CACR/P,IAAK,EACLD,IAAK,IACLiQ,KAAM,KAGTF,eAAe,CACd7J,KAAM,YACNlJ,KAAM,oBACN2S,aAAc,EACdK,SAAU,CACR/P,IAAK,EACLD,IAAK,GACLiQ,KAAM,QAIbC,eAAe,CACdC,uBAAwB,CAAC,sBAAoBC,QAAS,sBAAoBC,IAAK,sBAAoBC,KACnGC,iBAAe,KACb,EAAC,sBAAoBC,OAAQ,CAC3BR,SAAU,CACRS,gBAAgB,EAChBC,iBAAiB,EACjBC,sBAAsB,IAG3B","file":"module.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n","module.exports = __WEBPACK_EXTERNAL_MODULE__0__;","module.exports = __WEBPACK_EXTERNAL_MODULE__1__;","module.exports = __WEBPACK_EXTERNAL_MODULE__2__;","module.exports = __WEBPACK_EXTERNAL_MODULE__3__;","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","export default function sum(values, valueof) {\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value = +value) {\n sum += value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if (value = +valueof(value, ++index, values)) {\n sum += value;\n }\n }\n }\n return sum;\n}\n","export default function max(values, valueof) {\n let max;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n }\n return max;\n}\n","export default function min(values, valueof) {\n let min;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n }\n return min;\n}\n","import {min} from \"d3-array\";\n\nfunction targetDepth(d) {\n return d.target.depth;\n}\n\nexport function left(node) {\n return node.depth;\n}\n\nexport function right(node, n) {\n return n - 1 - node.height;\n}\n\nexport function justify(node, n) {\n return node.sourceLinks.length ? node.depth : n - 1;\n}\n\nexport function center(node) {\n return node.targetLinks.length ? node.depth\n : node.sourceLinks.length ? min(node.sourceLinks, targetDepth) - 1\n : 0;\n}\n","export default function constant(x) {\n return function() {\n return x;\n };\n}\n","import {max, min, sum} from \"d3-array\";\nimport {justify} from \"./align.js\";\nimport constant from \"./constant.js\";\n\nfunction ascendingSourceBreadth(a, b) {\n return ascendingBreadth(a.source, b.source) || a.index - b.index;\n}\n\nfunction ascendingTargetBreadth(a, b) {\n return ascendingBreadth(a.target, b.target) || a.index - b.index;\n}\n\nfunction ascendingBreadth(a, b) {\n return a.y0 - b.y0;\n}\n\nfunction value(d) {\n return d.value;\n}\n\nfunction defaultId(d) {\n return d.index;\n}\n\nfunction defaultNodes(graph) {\n return graph.nodes;\n}\n\nfunction defaultLinks(graph) {\n return graph.links;\n}\n\nfunction find(nodeById, id) {\n const node = nodeById.get(id);\n if (!node) throw new Error(\"missing: \" + id);\n return node;\n}\n\nfunction computeLinkBreadths({nodes}) {\n for (const node of nodes) {\n let y0 = node.y0;\n let y1 = y0;\n for (const link of node.sourceLinks) {\n link.y0 = y0 + link.width / 2;\n y0 += link.width;\n }\n for (const link of node.targetLinks) {\n link.y1 = y1 + link.width / 2;\n y1 += link.width;\n }\n }\n}\n\nexport default function Sankey() {\n let x0 = 0, y0 = 0, x1 = 1, y1 = 1; // extent\n let dx = 24; // nodeWidth\n let dy = 8, py; // nodePadding\n let id = defaultId;\n let align = justify;\n let sort;\n let linkSort;\n let nodes = defaultNodes;\n let links = defaultLinks;\n let iterations = 6;\n\n function sankey() {\n const graph = {nodes: nodes.apply(null, arguments), links: links.apply(null, arguments)};\n computeNodeLinks(graph);\n computeNodeValues(graph);\n computeNodeDepths(graph);\n computeNodeHeights(graph);\n computeNodeBreadths(graph);\n computeLinkBreadths(graph);\n return graph;\n }\n\n sankey.update = function(graph) {\n computeLinkBreadths(graph);\n return graph;\n };\n\n sankey.nodeId = function(_) {\n return arguments.length ? (id = typeof _ === \"function\" ? _ : constant(_), sankey) : id;\n };\n\n sankey.nodeAlign = function(_) {\n return arguments.length ? (align = typeof _ === \"function\" ? _ : constant(_), sankey) : align;\n };\n\n sankey.nodeSort = function(_) {\n return arguments.length ? (sort = _, sankey) : sort;\n };\n\n sankey.nodeWidth = function(_) {\n return arguments.length ? (dx = +_, sankey) : dx;\n };\n\n sankey.nodePadding = function(_) {\n return arguments.length ? (dy = py = +_, sankey) : dy;\n };\n\n sankey.nodes = function(_) {\n return arguments.length ? (nodes = typeof _ === \"function\" ? _ : constant(_), sankey) : nodes;\n };\n\n sankey.links = function(_) {\n return arguments.length ? (links = typeof _ === \"function\" ? _ : constant(_), sankey) : links;\n };\n\n sankey.linkSort = function(_) {\n return arguments.length ? (linkSort = _, sankey) : linkSort;\n };\n\n sankey.size = function(_) {\n return arguments.length ? (x0 = y0 = 0, x1 = +_[0], y1 = +_[1], sankey) : [x1 - x0, y1 - y0];\n };\n\n sankey.extent = function(_) {\n return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], sankey) : [[x0, y0], [x1, y1]];\n };\n\n sankey.iterations = function(_) {\n return arguments.length ? (iterations = +_, sankey) : iterations;\n };\n\n function computeNodeLinks({nodes, links}) {\n for (const [i, node] of nodes.entries()) {\n node.index = i;\n node.sourceLinks = [];\n node.targetLinks = [];\n }\n const nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d]));\n for (const [i, link] of links.entries()) {\n link.index = i;\n let {source, target} = link;\n if (typeof source !== \"object\") source = link.source = find(nodeById, source);\n if (typeof target !== \"object\") target = link.target = find(nodeById, target);\n source.sourceLinks.push(link);\n target.targetLinks.push(link);\n }\n if (linkSort != null) {\n for (const {sourceLinks, targetLinks} of nodes) {\n sourceLinks.sort(linkSort);\n targetLinks.sort(linkSort);\n }\n }\n }\n\n function computeNodeValues({nodes}) {\n for (const node of nodes) {\n node.value = node.fixedValue === undefined\n ? Math.max(sum(node.sourceLinks, value), sum(node.targetLinks, value))\n : node.fixedValue;\n }\n }\n\n function computeNodeDepths({nodes}) {\n const n = nodes.length;\n let current = new Set(nodes);\n let next = new Set;\n let x = 0;\n while (current.size) {\n for (const node of current) {\n node.depth = x;\n for (const {target} of node.sourceLinks) {\n next.add(target);\n }\n }\n if (++x > n) throw new Error(\"circular link\");\n current = next;\n next = new Set;\n }\n }\n\n function computeNodeHeights({nodes}) {\n const n = nodes.length;\n let current = new Set(nodes);\n let next = new Set;\n let x = 0;\n while (current.size) {\n for (const node of current) {\n node.height = x;\n for (const {source} of node.targetLinks) {\n next.add(source);\n }\n }\n if (++x > n) throw new Error(\"circular link\");\n current = next;\n next = new Set;\n }\n }\n\n function computeNodeLayers({nodes}) {\n const x = max(nodes, d => d.depth) + 1;\n const kx = (x1 - x0 - dx) / (x - 1);\n const columns = new Array(x);\n for (const node of nodes) {\n const i = Math.max(0, Math.min(x - 1, Math.floor(align.call(null, node, x))));\n node.layer = i;\n node.x0 = x0 + i * kx;\n node.x1 = node.x0 + dx;\n if (columns[i]) columns[i].push(node);\n else columns[i] = [node];\n }\n if (sort) for (const column of columns) {\n column.sort(sort);\n }\n return columns;\n }\n\n function initializeNodeBreadths(columns) {\n const ky = min(columns, c => (y1 - y0 - (c.length - 1) * py) / sum(c, value));\n for (const nodes of columns) {\n let y = y0;\n for (const node of nodes) {\n node.y0 = y;\n node.y1 = y + node.value * ky;\n y = node.y1 + py;\n for (const link of node.sourceLinks) {\n link.width = link.value * ky;\n }\n }\n y = (y1 - y + py) / (nodes.length + 1);\n for (let i = 0; i < nodes.length; ++i) {\n const node = nodes[i];\n node.y0 += y * (i + 1);\n node.y1 += y * (i + 1);\n }\n reorderLinks(nodes);\n }\n }\n\n function computeNodeBreadths(graph) {\n const columns = computeNodeLayers(graph);\n py = Math.min(dy, (y1 - y0) / (max(columns, c => c.length) - 1));\n initializeNodeBreadths(columns);\n for (let i = 0; i < iterations; ++i) {\n const alpha = Math.pow(0.99, i);\n const beta = Math.max(1 - alpha, (i + 1) / iterations);\n relaxRightToLeft(columns, alpha, beta);\n relaxLeftToRight(columns, alpha, beta);\n }\n }\n\n // Reposition each node based on its incoming (target) links.\n function relaxLeftToRight(columns, alpha, beta) {\n for (let i = 1, n = columns.length; i < n; ++i) {\n const column = columns[i];\n for (const target of column) {\n let y = 0;\n let w = 0;\n for (const {source, value} of target.targetLinks) {\n let v = value * (target.layer - source.layer);\n y += targetTop(source, target) * v;\n w += v;\n }\n if (!(w > 0)) continue;\n let dy = (y / w - target.y0) * alpha;\n target.y0 += dy;\n target.y1 += dy;\n reorderNodeLinks(target);\n }\n if (sort === undefined) column.sort(ascendingBreadth);\n resolveCollisions(column, beta);\n }\n }\n\n // Reposition each node based on its outgoing (source) links.\n function relaxRightToLeft(columns, alpha, beta) {\n for (let n = columns.length, i = n - 2; i >= 0; --i) {\n const column = columns[i];\n for (const source of column) {\n let y = 0;\n let w = 0;\n for (const {target, value} of source.sourceLinks) {\n let v = value * (target.layer - source.layer);\n y += sourceTop(source, target) * v;\n w += v;\n }\n if (!(w > 0)) continue;\n let dy = (y / w - source.y0) * alpha;\n source.y0 += dy;\n source.y1 += dy;\n reorderNodeLinks(source);\n }\n if (sort === undefined) column.sort(ascendingBreadth);\n resolveCollisions(column, beta);\n }\n }\n\n function resolveCollisions(nodes, alpha) {\n const i = nodes.length >> 1;\n const subject = nodes[i];\n resolveCollisionsBottomToTop(nodes, subject.y0 - py, i - 1, alpha);\n resolveCollisionsTopToBottom(nodes, subject.y1 + py, i + 1, alpha);\n resolveCollisionsBottomToTop(nodes, y1, nodes.length - 1, alpha);\n resolveCollisionsTopToBottom(nodes, y0, 0, alpha);\n }\n\n // Push any overlapping nodes down.\n function resolveCollisionsTopToBottom(nodes, y, i, alpha) {\n for (; i < nodes.length; ++i) {\n const node = nodes[i];\n const dy = (y - node.y0) * alpha;\n if (dy > 1e-6) node.y0 += dy, node.y1 += dy;\n y = node.y1 + py;\n }\n }\n\n // Push any overlapping nodes up.\n function resolveCollisionsBottomToTop(nodes, y, i, alpha) {\n for (; i >= 0; --i) {\n const node = nodes[i];\n const dy = (node.y1 - y) * alpha;\n if (dy > 1e-6) node.y0 -= dy, node.y1 -= dy;\n y = node.y0 - py;\n }\n }\n\n function reorderNodeLinks({sourceLinks, targetLinks}) {\n if (linkSort === undefined) {\n for (const {source: {sourceLinks}} of targetLinks) {\n sourceLinks.sort(ascendingTargetBreadth);\n }\n for (const {target: {targetLinks}} of sourceLinks) {\n targetLinks.sort(ascendingSourceBreadth);\n }\n }\n }\n\n function reorderLinks(nodes) {\n if (linkSort === undefined) {\n for (const {sourceLinks, targetLinks} of nodes) {\n sourceLinks.sort(ascendingTargetBreadth);\n targetLinks.sort(ascendingSourceBreadth);\n }\n }\n }\n\n // Returns the target.y0 that would produce an ideal link from source to target.\n function targetTop(source, target) {\n let y = source.y0 - (source.sourceLinks.length - 1) * py / 2;\n for (const {target: node, width} of source.sourceLinks) {\n if (node === target) break;\n y += width + py;\n }\n for (const {source: node, width} of target.targetLinks) {\n if (node === source) break;\n y -= width;\n }\n return y;\n }\n\n // Returns the source.y0 that would produce an ideal link from source to target.\n function sourceTop(source, target) {\n let y = target.y0 - (target.targetLinks.length - 1) * py / 2;\n for (const {source: node, width} of target.targetLinks) {\n if (node === source) break;\n y += width + py;\n }\n for (const {target: node, width} of source.sourceLinks) {\n if (node === target) break;\n y -= width;\n }\n return y;\n }\n\n return sankey;\n}\n","var pi = Math.PI,\n tau = 2 * pi,\n epsilon = 1e-6,\n tauEpsilon = tau - epsilon;\n\nfunction Path() {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n}\n\nfunction path() {\n return new Path;\n}\n\nPath.prototype = path.prototype = {\n constructor: Path,\n moveTo: function(x, y) {\n this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y);\n },\n closePath: function() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._ += \"Z\";\n }\n },\n lineTo: function(x, y) {\n this._ += \"L\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n quadraticCurveTo: function(x1, y1, x, y) {\n this._ += \"Q\" + (+x1) + \",\" + (+y1) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) {\n this._ += \"C\" + (+x1) + \",\" + (+y1) + \",\" + (+x2) + \",\" + (+y2) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n arcTo: function(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n var x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(\"negative radius: \" + r);\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._ += \"M\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon));\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n this._ += \"L\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n }\n\n // Otherwise, draw an arc!\n else {\n var x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon) {\n this._ += \"L\" + (x1 + t01 * x01) + \",\" + (y1 + t01 * y01);\n }\n\n this._ += \"A\" + r + \",\" + r + \",0,0,\" + (+(y01 * x20 > x01 * y20)) + \",\" + (this._x1 = x1 + t21 * x21) + \",\" + (this._y1 = y1 + t21 * y21);\n }\n },\n arc: function(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r, ccw = !!ccw;\n var dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(\"negative radius: \" + r);\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._ += \"M\" + x0 + \",\" + y0;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n this._ += \"L\" + x0 + \",\" + y0;\n }\n\n // Is this arc empty? We’re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau + tau;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._ += \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (x - dx) + \",\" + (y - dy) + \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (this._x1 = x0) + \",\" + (this._y1 = y0);\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon) {\n this._ += \"A\" + r + \",\" + r + \",0,\" + (+(da >= pi)) + \",\" + cw + \",\" + (this._x1 = x + r * Math.cos(a1)) + \",\" + (this._y1 = y + r * Math.sin(a1));\n }\n },\n rect: function(x, y, w, h) {\n this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y) + \"h\" + (+w) + \"v\" + (+h) + \"h\" + (-w) + \"Z\";\n },\n toString: function() {\n return this._;\n }\n};\n\nexport default path;\n","export var slice = Array.prototype.slice;\n","export default function(x) {\n return function constant() {\n return x;\n };\n}\n","export function x(p) {\n return p[0];\n}\n\nexport function y(p) {\n return p[1];\n}\n","import {path} from \"d3-path\";\nimport {slice} from \"../array.js\";\nimport constant from \"../constant.js\";\nimport {x as pointX, y as pointY} from \"../point.js\";\nimport pointRadial from \"../pointRadial.js\";\n\nfunction linkSource(d) {\n return d.source;\n}\n\nfunction linkTarget(d) {\n return d.target;\n}\n\nfunction link(curve) {\n var source = linkSource,\n target = linkTarget,\n x = pointX,\n y = pointY,\n context = null;\n\n function link() {\n var buffer, argv = slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);\n if (!context) context = buffer = path();\n curve(context, +x.apply(this, (argv[0] = s, argv)), +y.apply(this, argv), +x.apply(this, (argv[0] = t, argv)), +y.apply(this, argv));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n link.source = function(_) {\n return arguments.length ? (source = _, link) : source;\n };\n\n link.target = function(_) {\n return arguments.length ? (target = _, link) : target;\n };\n\n link.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), link) : x;\n };\n\n link.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), link) : y;\n };\n\n link.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), link) : context;\n };\n\n return link;\n}\n\nfunction curveHorizontal(context, x0, y0, x1, y1) {\n context.moveTo(x0, y0);\n context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);\n}\n\nfunction curveVertical(context, x0, y0, x1, y1) {\n context.moveTo(x0, y0);\n context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);\n}\n\nfunction curveRadial(context, x0, y0, x1, y1) {\n var p0 = pointRadial(x0, y0),\n p1 = pointRadial(x0, y0 = (y0 + y1) / 2),\n p2 = pointRadial(x1, y0),\n p3 = pointRadial(x1, y1);\n context.moveTo(p0[0], p0[1]);\n context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);\n}\n\nexport function linkHorizontal() {\n return link(curveHorizontal);\n}\n\nexport function linkVertical() {\n return link(curveVertical);\n}\n\nexport function linkRadial() {\n var l = link(curveRadial);\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n return l;\n}\n","import {linkHorizontal} from \"d3-shape\";\n\nfunction horizontalSource(d) {\n return [d.source.x1, d.y0];\n}\n\nfunction horizontalTarget(d) {\n return [d.target.x0, d.y1];\n}\n\nexport default function() {\n return linkHorizontal()\n .source(horizontalSource)\n .target(horizontalTarget);\n}\n","// import * as d3 from 'd3';\nimport React from 'react';\nimport * as d3Sankey from 'd3-sankey';\n\ninterface LinkProps {\n data: any;\n panelId: any;\n}\n\n/**\n * Create Sankey links\n *\n * @param data is the link data produced by calling the d3-sankey function\n * @return {*} the sankey link\n */\nexport const Link: React.FC = ({ data, panelId }) => {\n const link: any = d3Sankey.sankeyLinkHorizontal();\n // const strokeColor = '#4ec1e0';\n const strokeColor = data.color;\n const id = `${panelId}-${data.id}`;\n const className = `sankey-path${panelId}`;\n\n return (\n <>\n \n \n );\n};\n","import React from 'react';\nimport { useTheme2 } from '@grafana/ui';\n\ninterface NodeProps {\n data: any;\n textColor: string;\n nodeColor: string;\n panelId: any;\n}\n\n/**\n * Create Sankey rectangular nodes with labels\n *\n * @param data is the node data produced by calling the d3-sankey function\n * @param textColor is set in the editor panel, the color of the node label text\n * @param nodeColor is set in the editor panel, the fill color of the nodes\n * @return {*} the node and its label\n */\nexport const Node: React.FC = ({ data, textColor, nodeColor, panelId }) => {\n const theme = useTheme2();\n\n let x0 = data.x0;\n let x1 = data.x1;\n let y0 = data.y0;\n let y1 = data.y1;\n let index = data.index;\n let name = data.name;\n let value = data.value;\n\n const width = x1 - x0;\n const strokeColor = 'black';\n const fontSize = theme.typography.fontSize;\n const className = `sankey-node${panelId}`;\n\n return (\n <>\n \n \n {name}\n \n \n );\n};\n","import React, { useEffect, useState } from 'react';\nimport * as d3 from 'd3';\n\ninterface TooltipProps {\n rowNames: any;\n field: any;\n panelId: any;\n}\n\nexport const Tooltip: React.FC = ({ rowNames, field, panelId }) => {\n // get mouse position for tooltip position\n const [mousePosition, setMousePosition] = useState({ mouseX: 100, mouseY: 100 });\n\n const updateMousePosition = (e: any) => {\n setMousePosition({ mouseX: e.clientX, mouseY: e.clientY });\n };\n\n useEffect(() => {\n window.addEventListener('mousemove', updateMousePosition);\n const pathClass = `.sankey-path${panelId}`;\n // Links Tooltip\n d3.selectAll(pathClass)\n .on('mouseover', function (event: any, d: any) {\n let id = d3.select(this).attr('id');\n let row = id.split('-');\n let name = rowNames.find((e: any) => e.name === row[1]).display;\n\n // paths: selected opacity -> 1, all else -> 0.2\n d3.selectAll(pathClass).each(function (d) {\n var thisId = d3.select(this).attr('id');\n var dark = id === thisId;\n d3.select(this).attr('opacity', dark ? 1 : 0.4);\n });\n var thisId = d3.select(this).attr('id');\n var div = d3\n .select('body')\n .append('div')\n .attr('class', `tooltip-${thisId}`)\n .html(() => {\n var textVal = d3.select(this).attr('display');\n var text = `${name}
${textVal}`;\n return text;\n })\n .style('padding', '10px 15px')\n .style('background', 'black')\n .style('color', 'white')\n .style('border', '#A8A8A8 solid 5px')\n .style('border-radius', '5px')\n .style('left', mousePosition.mouseX + 'px')\n .style('top', mousePosition.mouseY + 'px')\n .style('opacity', 0)\n .style('position', 'absolute');\n div.transition().duration(200).style('opacity', 0.8);\n })\n .on('mouseout', function (d) {\n var thisId = d3.select(this).attr('id');\n d3.selectAll(`.tooltip-${thisId}`).transition().duration(300).remove();\n d3.selectAll(pathClass).attr('opacity', 0.7);\n });\n\n // Nodes Tooltip\n const nodeClass = `.sankey-node${panelId}`;\n d3.selectAll(nodeClass)\n .on('mouseover', function (event: any, d: any) {\n let id = d3.select(this).attr('id').split(',');\n let panelId = id[0];\n let rowList: string[] = [];\n id.forEach((e) => {\n rowList.push(`${panelId}-${e}`);\n });\n d3.selectAll(pathClass).each(function (d) {\n var thisId = d3.select(this).attr('id');\n var found = rowList.find((e) => e === thisId);\n d3.select(this).attr('opacity', found ? 1 : 0.2);\n });\n\n var thisNode = d3.select(this).attr('data-index');\n var div = d3\n .select('body')\n .append('div')\n .attr('class', `tooltip-node${thisNode}`)\n .html(() => {\n var textVal = field.display(d3.select(this).attr('d'));\n var name = d3.select(this).attr('name');\n var text;\n if (textVal.suffix) {\n text = `${name}: ${textVal.text} ${textVal.suffix}`;\n } else {\n text = `${name}: ${textVal.text}`;\n }\n return text;\n })\n .style('padding', '10px 15px')\n .style('background', 'black')\n .style('color', 'white')\n .style('border', '#A8A8A8 solid 5px')\n .style('border-radius', '5px')\n .style('left', mousePosition.mouseX + 'px')\n .style('top', mousePosition.mouseY + 'px')\n .style('opacity', 0)\n .style('position', 'absolute');\n div.transition().duration(200).style('opacity', 0.8);\n })\n .on('mouseout', function (d) {\n var thisNode = d3.select(this).attr('data-index');\n d3.selectAll(`.tooltip-node${thisNode}`).transition().duration(300).remove();\n d3.selectAll(pathClass).attr('opacity', 0.7);\n });\n\n return () => {\n window.removeEventListener('mousemove', updateMousePosition);\n };\n });\n return null;\n};\n","import React, { useEffect } from 'react';\nimport * as d3 from 'd3';\n\ninterface HeaderProps {\n displayNames: any;\n width: any;\n id: any;\n topMargin: number;\n textColor: string;\n}\n\nexport const Headers: React.FC = ({ displayNames, width, id, topMargin, textColor }) => {\n useEffect(() => {\n //clear old headers\n d3.select('#' + id)\n .selectAll('.header-text')\n .remove();\n\n var head = d3\n .select('#' + id)\n .append('g')\n .attr('id', `${id} header`);\n var MARGIN = { top: topMargin, right: 20, bottom: 50, left: 20 };\n\n var translateY = MARGIN.top / 2;\n\n // Add left and right axis labels\n head\n .append('text')\n .attr('class', 'header-text')\n .attr('transform', 'translate(' + MARGIN.left + ',' + translateY + ')') // above left axis\n .attr('font-size', '14pt')\n .attr('font-weight', '500')\n .attr('text-anchor', 'start')\n .text(displayNames[0])\n .attr('fill', textColor);\n\n head\n .append('text')\n .attr('class', 'header-text')\n .attr('transform', 'translate(' + (width + MARGIN.left) + ',' + translateY + ')') // above right axis\n .attr('font-size', '14pt')\n .attr('font-weight', '500')\n .attr('text-anchor', 'end')\n .text(displayNames[displayNames.length - 2]) // last one is value label\n .attr('fill', textColor);\n\n if (displayNames.length > 3) {\n const colWidth = width / (displayNames.length - 2);\n for (let i = 1; i < displayNames.length - 2; i++) {\n let translateX = colWidth * i + MARGIN.left;\n head\n .append('text')\n .attr('class', 'header-text')\n .attr('transform', `translate(${translateX},${translateY})`)\n .attr('font-size', '14pt')\n .attr('font-weight', '500')\n .attr('text-anchor', 'middle')\n .text(displayNames[i])\n .attr('fill', textColor);\n }\n }\n });\n\n return null;\n};\n","import React from 'react';\nimport { Link } from './Link';\nimport { Node } from './Node';\nimport * as d3Sankey from 'd3-sankey';\nimport { Tooltip } from './Tooltip';\nimport { Headers } from './Headers';\n// import { GrafanaTheme2 } from '@grafana/data';\n// import { useTheme2 } from '@grafana/ui';\n// import { css } from '@emotion/css';\n\n// import '../css/styles.css';\n\ninterface SankeyProps {\n data: any;\n width: number;\n height: number;\n displayNames: any;\n rowDisplayNames: any;\n id: any;\n textColor: string;\n nodeColor: string;\n field: any;\n nodeWidth: number;\n nodePadding: number;\n iteration: number;\n}\n\n/**\n * The sankey graph\n */\nexport const Sankey: React.FC = ({\n data,\n width,\n height,\n displayNames,\n rowDisplayNames,\n id,\n textColor,\n nodeColor,\n field,\n nodeWidth,\n nodePadding,\n iteration,\n}) => {\n // const theme = useTheme2();\n\n const MARGIN = { top: 75, bottom: 50, right: 20, left: 20 };\n const graphWidth = width - MARGIN.left - MARGIN.right;\n const graphHeight = height - MARGIN.top - MARGIN.bottom;\n const sankey: any = d3Sankey\n .sankey()\n .iterations(iteration)\n .nodeWidth(nodeWidth)\n .nodePadding(nodePadding)\n .extent([\n [0, 0],\n [graphWidth, graphHeight],\n ]);\n\n // Return an SVG group only if data exists\n if (data) {\n const { links, nodes } = sankey(data);\n\n return (\n \n \n \n \n {links.map((d: { width: any }, i: any) => (\n \n ))}\n \n \n {nodes.map((d: { index: any; x0: any; x1: any; y0: any; y1: any; name: any; value: any }, i: any) => (\n \n ))}\n \n \n );\n }\n return
;\n};\n","import { PanelPlugin, FieldConfigProperty } from '@grafana/data';\n// import { standardOptionsCompat } from 'grafana-plugin-support';\nimport { SankeyOptions } from './types';\nimport { SankeyPanel } from './SankeyPanel';\n\n/**\n * Grafana panel plugin main module\n *\n * @param {*} { panel: React.ComponentType> | null }\n * @return {*} { builder: PanelOptionsEditorBuilder }\n */\n\nconst monochromeBool = (monochrome: boolean) => (config: SankeyOptions) => config.monochrome === monochrome;\n\nexport const plugin = new PanelPlugin(SankeyPanel)\n .setPanelOptions((builder) => {\n builder\n .addBooleanSwitch({\n path: 'monochrome',\n name: 'Single Link color only',\n defaultValue: false,\n })\n .addColorPicker({\n path: 'color',\n name: 'Link Color',\n showIf: monochromeBool(true),\n defaultValue: 'blue',\n })\n .addColorPicker({\n path: 'nodeColor',\n name: 'Node color',\n defaultValue: 'grey',\n })\n .addSliderInput({\n path: 'nodeWidth',\n name: 'Node width',\n defaultValue: 30,\n settings: {\n min: 5,\n max: 100,\n step: 1,\n },\n })\n .addSliderInput({\n path: 'nodePadding',\n name: 'Node padding',\n defaultValue: 30,\n settings: {\n min: 1,\n max: 100,\n step: 1,\n },\n })\n .addSliderInput({\n path: 'iteration',\n name: 'Layout iterations',\n defaultValue: 7,\n settings: {\n min: 1,\n max: 30,\n step: 1,\n },\n });\n })\n .useFieldConfig({\n disableStandardOptions: [FieldConfigProperty.NoValue, FieldConfigProperty.Max, FieldConfigProperty.Min],\n standardOptions: {\n [FieldConfigProperty.Color]: {\n settings: {\n byValueSupport: true,\n bySeriesSupport: true,\n preferThresholdsMode: true,\n },\n },\n },\n });\n","import React from 'react';\nimport { PanelProps } from '@grafana/data';\nimport { SankeyOptions } from 'types';\nimport { parseData } from 'dataParser';\nimport { Sankey } from './components/Sankey';\nimport { useTheme2 } from '@grafana/ui';\n\ninterface Props extends PanelProps {}\n/**\n * Grafana Sankey diagram panel\n *\n * @param {*} { options, data, width, height, id }\n * @return {*} { Sankey } the Sankey graph\n */\nexport const SankeyPanel: React.FC = ({ options, data, width, height, id }: any): any => {\n let graphOptions = {\n ...options,\n };\n const theme = useTheme2();\n /**\n * Feed data and options into data parser.\n * @param {*} { data, options }\n * @returns [ parsedData, displayNames ]\n */\n var parsedData: any[] = [];\n try {\n parsedData = parseData(data, options, graphOptions.monochrome, graphOptions.color);\n } catch (error) {\n console.error('parsing error: ', error);\n }\n const displayNames = parsedData[1];\n const pluginData = parsedData[0];\n const rowDisplayNames = parsedData[2];\n const field = parsedData[3];\n const fixColor = parsedData[4];\n // const textColor = fixColor(graphOptions.textColor);\n const textColor = theme.colors.text.primary;\n const nodeColor = fixColor(graphOptions.nodeColor);\n\n return (\n \n \n \n );\n};\n","import { DataFrameView, Field, getFieldDisplayName, Vector } from '@grafana/data';\n// import { color } from 'd3';\n/**\n * Takes data from Grafana query and returns it in the format needed for this panel\n *\n * @param data the data returned by the query\n * @param options the field options from the editor panel\n * @param monochrome the boolean in the editor panel that sets whether the sankey is single or multi colored\n * @param color the color chosen in the editor panel for the sankey links if monochrome bool is true\n * @return {pluginData} the node and link data for the d3-sankey\n * @return {displayNames} the display names for the headers\n * @return {rowDisplayNames}\n * @return {valueField[0]}\n */\nexport function parseData(data: { series: any[] }, options: { valueFieldName: any }, monochrome: boolean, color: any) {\n const { valueFieldName } = options;\n\n /**\n * Colors\n * if monochrome = true, set all colors to value: color\n * else, set to multi color\n */\n\n function fixColor(color: string) {\n switch (color) {\n case 'dark-green':\n color = '#1A7311';\n break;\n case 'semi-dark-green':\n color = '#36872D';\n break;\n case 'light-green':\n color = '#73BF68';\n break;\n case 'super-light-green':\n color = '#96D88C';\n break;\n case 'dark-yellow':\n color = 'rgb(207, 159, 0)';\n break;\n case 'semi-dark-yellow':\n color = 'rgb(224, 180, 0)';\n break;\n case 'light-yellow':\n color = 'rgb(250, 222, 42)';\n break;\n case 'super-light-yellow':\n color = 'rgb(255, 238, 82)';\n break;\n case 'dark-red':\n color = 'rgb(173, 3, 23)';\n break;\n case 'semi-dark-red':\n color = 'rgb(196, 22, 42)';\n break;\n case 'light-red':\n color = 'rgb(242, 73, 92)';\n break;\n case 'super-light-red':\n color = 'rgb(255, 115, 131)';\n break;\n case 'dark-blue':\n color = 'rgb(18, 80, 176)';\n break;\n case 'semi-dark-blue':\n color = 'rgb(31, 96, 196)';\n break;\n case 'light-blue':\n color = 'rgb(87, 148, 242)';\n break;\n case 'super-light-blue':\n color = 'rgb(138, 184, 255)';\n break;\n case 'dark-orange':\n color = 'rgb(229, 84, 0)';\n break;\n case 'semi-dark-orange':\n color = 'rgb(250, 100, 0)';\n break;\n case 'light-orange':\n color = 'rgb(255, 152, 48)';\n break;\n case 'super-light-orange':\n color = 'rgb(255, 179, 87)';\n break;\n case 'dark-purple':\n color = 'rgb(124, 46, 163)';\n break;\n case 'semi-dark-purple':\n color = 'rgb(143, 59, 184)';\n break;\n case 'light-purple':\n color = 'rgb(184, 119, 217)';\n break;\n case 'super-light-purple':\n color = 'rgb(202, 149, 229)';\n break;\n default:\n break;\n }\n return color;\n }\n\n const colorArray: string[] = [];\n\n if (monochrome) {\n colorArray.push(fixColor(color));\n // colorArray.push(color);\n } else {\n colorArray.push('#018EDB');\n colorArray.push('#DB8500');\n colorArray.push('#7C00DB');\n colorArray.push('#DB0600');\n colorArray.push('#00DB57');\n }\n\n var allData = data.series[0].fields;\n var numFields = allData.length - 1;\n\n // add data checker. are there enough fields?\n\n // get display names\n let displayNames: string[] = [];\n allData.forEach((field: Field>) => {\n displayNames.push(getFieldDisplayName(field));\n });\n\n // Find selected value field or default to the first number field and use for values.\n const valueField = valueFieldName\n ? data.series.map((series: { fields: any[] }) =>\n series.fields.find((field: { name: any }) => field.name === valueFieldName)\n )\n : data.series.map((series: { fields: any[] }) =>\n series.fields.find((field: { type: string }) => field.type === 'number')\n );\n\n let values = [];\n valueField[0].values.buffer.map((value: any) => {\n values.push([value, valueField[0].display(value), valueField[0].name]);\n });\n // display converts value to display value with units\n // name = name of field\n\n const series = data.series[0];\n const frame = new DataFrameView(series);\n\n // initialize arrays\n let pluginDataLinks: Array<{\n source: number;\n target: number;\n value: number;\n displayValue: any;\n id: string;\n color: any;\n node0: any;\n }> = [];\n let pluginDataNodes: Array<{ name: any; id: any; colId: number }> = [];\n let col0: Array<{ name: any; index: number; color: any }> = [];\n let rowDisplayNames: Array<{ name: any; display: any }> = [];\n\n var rowId = 0; // update after each row\n var currentColor;\n\n // Retrieve panel data from panel\n frame.forEach((row) => {\n let currentLink: number[] = [];\n // go through columns to find all nodes\n for (let i = 0; i < numFields; i++) {\n let node = row[i];\n let index = pluginDataNodes.findIndex((e) => e.name === node && e.colId === i);\n if (index === -1) {\n index = pluginDataNodes.push({ name: node, id: [`row${rowId}`], colId: i }) - 1;\n if (i === 0) {\n currentColor = colorArray[col0.length % colorArray.length];\n col0.push({ name: node, index: index, color: currentColor });\n }\n } else {\n pluginDataNodes[index].id.push(`row${rowId}`); // might not need?\n }\n currentLink.push(index);\n }\n // create all the individual links, value is always the last column\n // let rowColor = colorArray[currentLink[0] % colorArray.length];\n let rowColor = col0.find((e) => e.index === currentLink[0])?.color;\n let rowDisplay = `${pluginDataNodes[currentLink[0]].name}`;\n for (let i = 0; i < currentLink.length - 1; i++) {\n var fieldValues = valueField[0].display(row[numFields]);\n var displayValue;\n if (fieldValues.suffix) {\n displayValue = `${fieldValues.text} ${fieldValues.suffix}`;\n } else {\n displayValue = `${fieldValues.text}`;\n }\n\n pluginDataLinks.push({\n source: currentLink[i],\n target: currentLink[i + 1],\n value: row[numFields],\n displayValue: displayValue,\n id: `row${rowId}`,\n color: rowColor,\n node0: currentLink[0],\n });\n rowDisplay = rowDisplay.concat(` -> ${pluginDataNodes[currentLink[i + 1]].name}`);\n }\n rowDisplayNames.push({ name: `row${rowId}`, display: rowDisplay });\n rowId++;\n });\n const pluginData = { links: pluginDataLinks, nodes: pluginDataNodes };\n\n return [pluginData, displayNames, rowDisplayNames, valueField[0], fixColor];\n}\n"],"sourceRoot":""} diff --git a/public/app/plugins/panel/netsage-sankey-panel/plugin.json b/public/app/plugins/panel/netsage-sankey-panel/plugin.json deleted file mode 100644 index b18d89e4b106..000000000000 --- a/public/app/plugins/panel/netsage-sankey-panel/plugin.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/grafana/grafana/master/docs/sources/developers/plugins/plugin.schema.json", - "type": "panel", - "name": "Sankey Panel", - "id": "netsage-sankey-panel", - "info": { - "description": "Sankey Panel Plugin for Grafana", - "author": { - "name": "NetSage", - "url": "http://github.com/netsage-project" - }, - "keywords": ["netsage", "sankey"], - "logos": { - "small": "img/logo.svg", - "large": "img/logo.svg" - }, - "links": [ - { - "name": "Website", - "url": "https://github.com/netsage-project/netsage-sankey-panel" - }, - { - "name": "License", - "url": "https://github.com/netsage-project/netsage-sankey-panel/blob/master/LICENSE" - } - ], - "screenshots": [ - { "name": "sankey2", "path": "img/sankey2.png" }, - { "name": "sankey3", "path": "img/sankey3.png" } - ], - "version": "1.0.6", - "updated": "2021-12-03" - }, - "dependencies": { - "grafanaDependency": ">=8.0.0", - "plugins": [] - } -} diff --git a/public/app/plugins/panel/sankey-panel-0.5.0/.gitignore b/public/app/plugins/panel/sankey-panel-0.5.0/.gitignore new file mode 100644 index 000000000000..521bf24711e6 --- /dev/null +++ b/public/app/plugins/panel/sankey-panel-0.5.0/.gitignore @@ -0,0 +1,31 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +node_modules/ + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Compiled binary addons (https://nodejs.org/api/addons.html) +dist/ +artifacts/ +work/ +ci/ +e2e-results/ + +# Editors +.idea + diff --git a/public/app/plugins/panel/sankey-panel-0.5.0/.prettierignore b/public/app/plugins/panel/sankey-panel-0.5.0/.prettierignore new file mode 100644 index 000000000000..16c7d95a61e3 --- /dev/null +++ b/public/app/plugins/panel/sankey-panel-0.5.0/.prettierignore @@ -0,0 +1,3 @@ +src/Error.tsx +src/Sankey.js +src/SankeyPanel.tsx \ No newline at end of file diff --git a/public/app/plugins/panel/sankey-panel-0.5.0/LICENSE b/public/app/plugins/panel/sankey-panel-0.5.0/LICENSE new file mode 100644 index 000000000000..f882365155a8 --- /dev/null +++ b/public/app/plugins/panel/sankey-panel-0.5.0/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Ismael + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/public/app/plugins/panel/sankey-panel-0.5.0/README.md b/public/app/plugins/panel/sankey-panel-0.5.0/README.md new file mode 100644 index 000000000000..746ca624e314 --- /dev/null +++ b/public/app/plugins/panel/sankey-panel-0.5.0/README.md @@ -0,0 +1,82 @@ +# Grafana Sankey Panel + +Sankey diagram implementation for directed flow visualization between nodes in an acyclic network. + +![sankey-panel](img/sankey-panel.png) + +## Installing + +Using the grafana-cli: + +```bash +grafana-cli --pluginUrl https://github.com/IsmaelMasharo/sankey-panel/raw/master/sankey-panel.zip plugins install sankey-panel +``` + +## Grafana Version + +Tested on Grafana 7.3.1 + +## Required Fields + +The diagram gets constructed from a data source **formatted as table** with 3 mandatory fields: **source** (text), **target** (text), **value** (numeric, no nulls). The diagram at the beginning was created with the following table format: + +| source | target | value | +| ------ | ------ | ----- | +| A | D | 2 | +| B | D | 2 | +| B | E | 2 | +| A | F | 2 | +| D | E | 2 | +| D | F | 3 | +| E | F | 4 | +| C | D | 1 | +| C | E | 1 | +| E | G | 1 | + +Being an acyclic implementation of the Sankey diagram **loops are not allowed**: + +| source | target | value | +| ------ | ------- | ----- | +| A | B | 2 | +| B | A (_x_) | 2 | + +To avoid _circular link error_ [a masked prefix](https://github.com/IsmaelMasharo/sankey-panel/issues/1#issuecomment-757972917) could be set on the target values: + +| source | target | value | +| ------ | ------ | ----- | +| A | B | 2 | +| B | P-A | 2 | + +## Display Options + +There are 5 options for displaying the diagram: _Alignment_, _Color_, _Edge Color_, _Display Values_, _Highlight Connections_ + +### Alignment + +Arranges the nodes to one of the following sides: Left, Right, Center, Justify. See d3 [sankey nodeAlign](https://github.com/d3/d3-sankey#alignments) for image reference. + +### Color + +Nodes and links color. Based on d3 [categorical schemes](https://github.com/d3/d3-scale-chromatic#categorical). + +### Edge Color + +Represents the link's color transition from source to the target node. + +- Input: Link takes the color of the source node. +- Output: Link takes the color of the target node. +- Input-Output: The link will be colored as a gradient from source to target node colors. +- None: Gray links. + +### Display Values + +Values are shown next to the node name. + +- Total: Display link weight value. +- Percentage: Display link weight percentage value relative to the source. +- Both: Display both total and percentage. +- None: No values displayed (except for node name). + +### Highlight Connections + +Boolean. Highlights links and nodes with a direct connection to the hovered node. diff --git a/public/app/plugins/panel/sankey-panel-0.5.0/img/logo.svg b/public/app/plugins/panel/sankey-panel-0.5.0/img/logo.svg new file mode 100644 index 000000000000..2d41fa5441e6 --- /dev/null +++ b/public/app/plugins/panel/sankey-panel-0.5.0/img/logo.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/app/plugins/panel/sankey-panel-0.5.0/module.js b/public/app/plugins/panel/sankey-panel-0.5.0/module.js new file mode 100644 index 000000000000..582e66794f89 --- /dev/null +++ b/public/app/plugins/panel/sankey-panel-0.5.0/module.js @@ -0,0 +1,1244 @@ +/*! For license information please see module.js.LICENSE.txt */ +define(['react', 'd3', '@grafana/data', '@grafana/ui'], function (t, e, n, r) { + return (function (t) { + var e = {}; + function n(r) { + if (e[r]) return e[r].exports; + var o = (e[r] = { i: r, l: !1, exports: {} }); + return t[r].call(o.exports, o, o.exports, n), (o.l = !0), o.exports; + } + return ( + (n.m = t), + (n.c = e), + (n.d = function (t, e, r) { + n.o(t, e) || Object.defineProperty(t, e, { enumerable: !0, get: r }); + }), + (n.r = function (t) { + 'undefined' != typeof Symbol && + Symbol.toStringTag && + Object.defineProperty(t, Symbol.toStringTag, { value: 'Module' }), + Object.defineProperty(t, '__esModule', { value: !0 }); + }), + (n.t = function (t, e) { + if ((1 & e && (t = n(t)), 8 & e)) return t; + if (4 & e && 'object' == typeof t && t && t.__esModule) return t; + var r = Object.create(null); + if ((n.r(r), Object.defineProperty(r, 'default', { enumerable: !0, value: t }), 2 & e && 'string' != typeof t)) + for (var o in t) + n.d( + r, + o, + function (e) { + return t[e]; + }.bind(null, o) + ); + return r; + }), + (n.n = function (t) { + var e = + t && t.__esModule + ? function () { + return t.default; + } + : function () { + return t; + }; + return n.d(e, 'a', e), e; + }), + (n.o = function (t, e) { + return Object.prototype.hasOwnProperty.call(t, e); + }), + (n.p = '/'), + n((n.s = 5)) + ); + })([ + function (e, n) { + e.exports = t; + }, + function (t, n) { + t.exports = e; + }, + function (t, e) { + t.exports = n; + }, + function (t, e) { + t.exports = r; + }, + , + function (t, e, n) { + 'use strict'; + n.r(e); + var r = {}; + n.r(r), + n.d(r, 'sankey', function () { + return M; + }), + n.d(r, 'sankeyCenter', function () { + return _; + }), + n.d(r, 'sankeyLeft', function () { + return d; + }), + n.d(r, 'sankeyRight', function () { + return g; + }), + n.d(r, 'sankeyJustify', function () { + return y; + }), + n.d(r, 'sankeyLinkHorizontal', function () { + return D; + }); + var o = n(2); + function i(t, e) { + var n = 'function' == typeof Symbol && t[Symbol.iterator]; + if (!n) return t; + var r, + o, + i = n.call(t), + a = []; + try { + for (; (void 0 === e || e-- > 0) && !(r = i.next()).done; ) a.push(r.value); + } catch (t) { + o = { error: t }; + } finally { + try { + r && !r.done && (n = i.return) && n.call(i); + } finally { + if (o) throw o.error; + } + } + return a; + } + var a = n(0), + s = n.n(a), + u = n(1); + function l(t, e) { + let n = 0; + if (void 0 === e) for (let e of t) (e = +e) && (n += e); + else { + let r = -1; + for (let o of t) (o = +e(o, ++r, t)) && (n += o); + } + return n; + } + function c(t, e) { + let n; + if (void 0 === e) for (const e of t) null != e && (n < e || (void 0 === n && e >= e)) && (n = e); + else { + let r = -1; + for (let o of t) null != (o = e(o, ++r, t)) && (n < o || (void 0 === n && o >= o)) && (n = o); + } + return n; + } + function h(t, e) { + let n; + if (void 0 === e) for (const e of t) null != e && (n > e || (void 0 === n && e >= e)) && (n = e); + else { + let r = -1; + for (let o of t) null != (o = e(o, ++r, t)) && (n > o || (void 0 === n && o >= o)) && (n = o); + } + return n; + } + function f(t) { + return t.target.depth; + } + function d(t) { + return t.depth; + } + function g(t, e) { + return e - 1 - t.height; + } + function y(t, e) { + return t.sourceLinks.length ? t.depth : e - 1; + } + function _(t) { + return t.targetLinks.length ? t.depth : t.sourceLinks.length ? h(t.sourceLinks, f) - 1 : 0; + } + function p(t) { + return function () { + return t; + }; + } + function v(t, e) { + return m(t.source, e.source) || t.index - e.index; + } + function k(t, e) { + return m(t.target, e.target) || t.index - e.index; + } + function m(t, e) { + return t.y0 - e.y0; + } + function b(t) { + return t.value; + } + function x(t) { + return t.index; + } + function w(t) { + return t.nodes; + } + function L(t) { + return t.links; + } + function S(t, e) { + const n = t.get(e); + if (!n) throw new Error('missing: ' + e); + return n; + } + function A({ nodes: t }) { + for (const e of t) { + let t = e.y0, + n = t; + for (const n of e.sourceLinks) (n.y0 = t + n.width / 2), (t += n.width); + for (const t of e.targetLinks) (t.y1 = n + t.width / 2), (n += t.width); + } + } + function M() { + let t, + e, + n, + r = 0, + o = 0, + i = 1, + a = 1, + s = 24, + u = 8, + f = x, + d = y, + g = w, + _ = L, + M = 6; + function O() { + const t = { nodes: g.apply(null, arguments), links: _.apply(null, arguments) }; + return T(t), j(t), C(t), P(t), V(t), A(t), t; + } + function T({ nodes: t, links: e }) { + for (const [e, n] of t.entries()) (n.index = e), (n.sourceLinks = []), (n.targetLinks = []); + const r = new Map(t.map((e, n) => [f(e, n, t), e])); + for (const [t, n] of e.entries()) { + n.index = t; + let { source: e, target: o } = n; + 'object' != typeof e && (e = n.source = S(r, e)), + 'object' != typeof o && (o = n.target = S(r, o)), + e.sourceLinks.push(n), + o.targetLinks.push(n); + } + if (null != n) for (const { sourceLinks: e, targetLinks: r } of t) e.sort(n), r.sort(n); + } + function j({ nodes: t }) { + for (const e of t) + e.value = void 0 === e.fixedValue ? Math.max(l(e.sourceLinks, b), l(e.targetLinks, b)) : e.fixedValue; + } + function C({ nodes: t }) { + const e = t.length; + let n = new Set(t), + r = new Set(), + o = 0; + for (; n.size; ) { + for (const t of n) { + t.depth = o; + for (const { target: e } of t.sourceLinks) r.add(e); + } + if (++o > e) throw new Error('circular link'); + (n = r), (r = new Set()); + } + } + function P({ nodes: t }) { + const e = t.length; + let n = new Set(t), + r = new Set(), + o = 0; + for (; n.size; ) { + for (const t of n) { + t.height = o; + for (const { source: e } of t.targetLinks) r.add(e); + } + if (++o > e) throw new Error('circular link'); + (n = r), (r = new Set()); + } + } + function V(n) { + const f = (function ({ nodes: t }) { + const n = c(t, (t) => t.depth) + 1, + o = (i - r - s) / (n - 1), + a = new Array(n); + for (const e of t) { + const t = Math.max(0, Math.min(n - 1, Math.floor(d.call(null, e, n)))); + (e.layer = t), (e.x0 = r + t * o), (e.x1 = e.x0 + s), a[t] ? a[t].push(e) : (a[t] = [e]); + } + if (e) for (const t of a) t.sort(e); + return a; + })(n); + (t = Math.min(u, (a - o) / (c(f, (t) => t.length) - 1))), + (function (e) { + const n = h(e, (e) => (a - o - (e.length - 1) * t) / l(e, b)); + for (const r of e) { + let e = o; + for (const o of r) { + (o.y0 = e), (o.y1 = e + o.value * n), (e = o.y1 + t); + for (const t of o.sourceLinks) t.width = t.value * n; + } + e = (a - e + t) / (r.length + 1); + for (let t = 0; t < r.length; ++t) { + const n = r[t]; + (n.y0 += e * (t + 1)), (n.y1 += e * (t + 1)); + } + I(r); + } + })(f); + for (let t = 0; t < M; ++t) { + const e = Math.pow(0.99, t), + n = Math.max(1 - e, (t + 1) / M); + B(f, e, n), E(f, e, n); + } + } + function E(t, n, r) { + for (let o = 1, i = t.length; o < i; ++o) { + const i = t[o]; + for (const t of i) { + let e = 0, + r = 0; + for (const { source: n, value: o } of t.targetLinks) { + let i = o * (t.layer - n.layer); + (e += J(n, t) * i), (r += i); + } + if (!(r > 0)) continue; + let o = (e / r - t.y0) * n; + (t.y0 += o), (t.y1 += o), G(t); + } + void 0 === e && i.sort(m), H(i, r); + } + } + function B(t, n, r) { + for (let o = t.length - 2; o >= 0; --o) { + const i = t[o]; + for (const t of i) { + let e = 0, + r = 0; + for (const { target: n, value: o } of t.sourceLinks) { + let i = o * (n.layer - t.layer); + (e += R(t, n) * i), (r += i); + } + if (!(r > 0)) continue; + let o = (e / r - t.y0) * n; + (t.y0 += o), (t.y1 += o), G(t); + } + void 0 === e && i.sort(m), H(i, r); + } + } + function H(e, n) { + const r = e.length >> 1, + i = e[r]; + z(e, i.y0 - t, r - 1, n), N(e, i.y1 + t, r + 1, n), z(e, a, e.length - 1, n), N(e, o, 0, n); + } + function N(e, n, r, o) { + for (; r < e.length; ++r) { + const i = e[r], + a = (n - i.y0) * o; + a > 1e-6 && ((i.y0 += a), (i.y1 += a)), (n = i.y1 + t); + } + } + function z(e, n, r, o) { + for (; r >= 0; --r) { + const i = e[r], + a = (i.y1 - n) * o; + a > 1e-6 && ((i.y0 -= a), (i.y1 -= a)), (n = i.y0 - t); + } + } + function G({ sourceLinks: t, targetLinks: e }) { + if (void 0 === n) { + for (const { + source: { sourceLinks: t }, + } of e) + t.sort(k); + for (const { + target: { targetLinks: e }, + } of t) + e.sort(v); + } + } + function I(t) { + if (void 0 === n) for (const { sourceLinks: e, targetLinks: n } of t) e.sort(k), n.sort(v); + } + function J(e, n) { + let r = e.y0 - ((e.sourceLinks.length - 1) * t) / 2; + for (const { target: o, width: i } of e.sourceLinks) { + if (o === n) break; + r += i + t; + } + for (const { source: t, width: o } of n.targetLinks) { + if (t === e) break; + r -= o; + } + return r; + } + function R(e, n) { + let r = n.y0 - ((n.targetLinks.length - 1) * t) / 2; + for (const { source: o, width: i } of n.targetLinks) { + if (o === e) break; + r += i + t; + } + for (const { target: t, width: o } of e.sourceLinks) { + if (t === n) break; + r -= o; + } + return r; + } + return ( + (O.update = function (t) { + return A(t), t; + }), + (O.nodeId = function (t) { + return arguments.length ? ((f = 'function' == typeof t ? t : p(t)), O) : f; + }), + (O.nodeAlign = function (t) { + return arguments.length ? ((d = 'function' == typeof t ? t : p(t)), O) : d; + }), + (O.nodeSort = function (t) { + return arguments.length ? ((e = t), O) : e; + }), + (O.nodeWidth = function (t) { + return arguments.length ? ((s = +t), O) : s; + }), + (O.nodePadding = function (e) { + return arguments.length ? ((u = t = +e), O) : u; + }), + (O.nodes = function (t) { + return arguments.length ? ((g = 'function' == typeof t ? t : p(t)), O) : g; + }), + (O.links = function (t) { + return arguments.length ? ((_ = 'function' == typeof t ? t : p(t)), O) : _; + }), + (O.linkSort = function (t) { + return arguments.length ? ((n = t), O) : n; + }), + (O.size = function (t) { + return arguments.length ? ((r = o = 0), (i = +t[0]), (a = +t[1]), O) : [i - r, a - o]; + }), + (O.extent = function (t) { + return arguments.length + ? ((r = +t[0][0]), (i = +t[1][0]), (o = +t[0][1]), (a = +t[1][1]), O) + : [ + [r, o], + [i, a], + ]; + }), + (O.iterations = function (t) { + return arguments.length ? ((M = +t), O) : M; + }), + O + ); + } + var O = Math.PI, + T = 2 * O, + j = T - 1e-6; + function C() { + (this._x0 = this._y0 = this._x1 = this._y1 = null), (this._ = ''); + } + function P() { + return new C(); + } + C.prototype = P.prototype = { + constructor: C, + moveTo: function (t, e) { + this._ += 'M' + (this._x0 = this._x1 = +t) + ',' + (this._y0 = this._y1 = +e); + }, + closePath: function () { + null !== this._x1 && ((this._x1 = this._x0), (this._y1 = this._y0), (this._ += 'Z')); + }, + lineTo: function (t, e) { + this._ += 'L' + (this._x1 = +t) + ',' + (this._y1 = +e); + }, + quadraticCurveTo: function (t, e, n, r) { + this._ += 'Q' + +t + ',' + +e + ',' + (this._x1 = +n) + ',' + (this._y1 = +r); + }, + bezierCurveTo: function (t, e, n, r, o, i) { + this._ += 'C' + +t + ',' + +e + ',' + +n + ',' + +r + ',' + (this._x1 = +o) + ',' + (this._y1 = +i); + }, + arcTo: function (t, e, n, r, o) { + (t = +t), (e = +e), (n = +n), (r = +r), (o = +o); + var i = this._x1, + a = this._y1, + s = n - t, + u = r - e, + l = i - t, + c = a - e, + h = l * l + c * c; + if (o < 0) throw new Error('negative radius: ' + o); + if (null === this._x1) this._ += 'M' + (this._x1 = t) + ',' + (this._y1 = e); + else if (h > 1e-6) + if (Math.abs(c * s - u * l) > 1e-6 && o) { + var f = n - i, + d = r - a, + g = s * s + u * u, + y = f * f + d * d, + _ = Math.sqrt(g), + p = Math.sqrt(h), + v = o * Math.tan((O - Math.acos((g + h - y) / (2 * _ * p))) / 2), + k = v / p, + m = v / _; + Math.abs(k - 1) > 1e-6 && (this._ += 'L' + (t + k * l) + ',' + (e + k * c)), + (this._ += + 'A' + + o + + ',' + + o + + ',0,0,' + + +(c * f > l * d) + + ',' + + (this._x1 = t + m * s) + + ',' + + (this._y1 = e + m * u)); + } else this._ += 'L' + (this._x1 = t) + ',' + (this._y1 = e); + else; + }, + arc: function (t, e, n, r, o, i) { + (t = +t), (e = +e), (i = !!i); + var a = (n = +n) * Math.cos(r), + s = n * Math.sin(r), + u = t + a, + l = e + s, + c = 1 ^ i, + h = i ? r - o : o - r; + if (n < 0) throw new Error('negative radius: ' + n); + null === this._x1 + ? (this._ += 'M' + u + ',' + l) + : (Math.abs(this._x1 - u) > 1e-6 || Math.abs(this._y1 - l) > 1e-6) && (this._ += 'L' + u + ',' + l), + n && + (h < 0 && (h = (h % T) + T), + h > j + ? (this._ += + 'A' + + n + + ',' + + n + + ',0,1,' + + c + + ',' + + (t - a) + + ',' + + (e - s) + + 'A' + + n + + ',' + + n + + ',0,1,' + + c + + ',' + + (this._x1 = u) + + ',' + + (this._y1 = l)) + : h > 1e-6 && + (this._ += + 'A' + + n + + ',' + + n + + ',0,' + + +(h >= O) + + ',' + + c + + ',' + + (this._x1 = t + n * Math.cos(o)) + + ',' + + (this._y1 = e + n * Math.sin(o)))); + }, + rect: function (t, e, n, r) { + this._ += + 'M' + (this._x0 = this._x1 = +t) + ',' + (this._y0 = this._y1 = +e) + 'h' + +n + 'v' + +r + 'h' + -n + 'Z'; + }, + toString: function () { + return this._; + }, + }; + var V = P, + E = Array.prototype.slice, + B = function (t) { + return function () { + return t; + }; + }; + function H(t) { + return t[0]; + } + function N(t) { + return t[1]; + } + function z(t) { + return t.source; + } + function G(t) { + return t.target; + } + function I(t) { + var e = z, + n = G, + r = H, + o = N, + i = null; + function a() { + var a, + s = E.call(arguments), + u = e.apply(this, s), + l = n.apply(this, s); + if ( + (i || (i = a = V()), + t( + i, + +r.apply(this, ((s[0] = u), s)), + +o.apply(this, s), + +r.apply(this, ((s[0] = l), s)), + +o.apply(this, s) + ), + a) + ) + return (i = null), a + '' || null; + } + return ( + (a.source = function (t) { + return arguments.length ? ((e = t), a) : e; + }), + (a.target = function (t) { + return arguments.length ? ((n = t), a) : n; + }), + (a.x = function (t) { + return arguments.length ? ((r = 'function' == typeof t ? t : B(+t)), a) : r; + }), + (a.y = function (t) { + return arguments.length ? ((o = 'function' == typeof t ? t : B(+t)), a) : o; + }), + (a.context = function (t) { + return arguments.length ? ((i = null == t ? null : t), a) : i; + }), + a + ); + } + function J(t, e, n, r, o) { + t.moveTo(e, n), t.bezierCurveTo((e = (e + r) / 2), n, e, o, r, o); + } + function R(t) { + return [t.source.x1, t.y0]; + } + function W(t) { + return [t.target.x0, t.y1]; + } + var D = function () { + return I(J).source(R).target(W); + }; + function q(t, e) { + for (var n = 0; n < e.length; n++) { + var r = e[n]; + (r.enumerable = r.enumerable || !1), + (r.configurable = !0), + 'value' in r && (r.writable = !0), + Object.defineProperty(t, r.key, r); + } + } + var F = 'total', + U = 'percentage', + Z = 'both', + Q = 'none', + K = 'path', + X = 'input', + Y = 'output', + $ = (function () { + function t(e, n) { + !(function (t, e) { + if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function'); + })(this, t), + (this._svg = e), + (this._container = n || e), + (this._gBound = null), + (this._data = null), + (this._nodes = null), + (this._links = null), + (this._width = 0), + (this._height = 0), + (this._boundedWidth = 0), + (this._boundedHeight = 0), + (this._marginTop = 20), + (this._marginRight = 20), + (this._marginBottom = 20), + (this._marginLeft = 20), + (this._background = 'rgba(0, 0, 0, 0)'), + (this._edgeColor = 'path'), + (this._colorScheme = 'Tableau10'), + (this._colorScale = null), + (this._colorArray = ''), + (this._sankeyAlignType = 'Justify'), + (this._sankeyAlign = null), + (this._sankeyGenerator = null), + (this._sankeyNodeWith = 85), + (this._sankeyNodePadding = 20), + (this._svgNode = null), + (this._svgLink = null), + (this._displayValues = 'none'), + (this._highlightOnHover = !1); + } + var e, n, o; + return ( + (e = t), + (n = [ + { + key: '_init', + value: function () { + this._setBoundDimensions(), this._setColorScale(), this._configureSankey(), this._calculateSankey(); + }, + }, + { + key: '_setBoundDimensions', + value: function () { + (this._boundedWidth = this._width - this._marginLeft - this._marginRight), + (this._boundedHeight = this._height - this._marginTop - this._marginBottom); + }, + }, + { + key: '_setColorScale', + value: function () { + this._colorScale = u.scaleOrdinal(u['scheme'.concat(this._colorScheme)]); + }, + }, + { + key: '_color', + value: function (t) { + return this._colorScale(t.name); + }, + }, + { + key: '_configureSankey', + value: function () { + (this._sankeyAlign = r['sankey'.concat(this._sankeyAlignType)]), + (this._sankeyGenerator = M() + .nodeId(function (t) { + return t.name; + }) + .nodeAlign(this._sankeyAlign) + .nodeWidth(this._sankeyNodeWith) + .nodePadding(this._sankeyNodePadding) + .extent([ + [0, 0], + [this._boundedWidth, this._boundedHeight], + ])); + }, + }, + { + key: '_calculateSankey', + value: function () { + var t = this._sankeyGenerator({ + nodes: this._data.nodes.map(function (t) { + return Object.assign({}, t); + }), + links: this._data.links.map(function (t) { + return Object.assign({}, t); + }), + }); + (this._nodes = t.nodes), (this._links = t.links); + }, + }, + { + key: '_validate', + value: function () { + return ( + this._data && + this._data.nodes && + this._data.links && + this._data.nodes.length > 0 && + this._data.links.length > 0 + ); + }, + }, + { + key: '_setLinkGradient', + value: function () { + var t = this, + e = this._svgLink + .append('linearGradient') + .attr('id', function (t) { + return (t.uid = 'link-'.concat(t.index, '-').concat(Math.random())); + }) + .attr('gradientUnits', 'userSpaceOnUse') + .attr('x1', function (t) { + return t.source.x1; + }) + .attr('x2', function (t) { + return t.target.x0; + }); + e + .append('stop') + .attr('offset', '0%') + .attr('stop-color', function (e) { + return t._color(e.source); + }), + e + .append('stop') + .attr('offset', '100%') + .attr('stop-color', function (e) { + return t._color(e.target); + }); + }, + }, + { + key: '_setLinkStroke', + value: function (t) { + switch (this._edgeColor) { + case Q: + return '#aaa'; + case K: + return 'url(#'.concat(t.uid, ')'); + case X: + return this._color(t.source); + case Y: + return this._color(t.target); + default: + return; + } + }, + }, + { + key: '_showLinks', + value: function (t) { + var e = []; + [ + { linkType: 'sourceLinks', nodeType: 'target' }, + { linkType: 'targetLinks', nodeType: 'source' }, + ].forEach(function (n) { + t[n.linkType].forEach(function (t) { + e.push(t[n.nodeType]); + }); + }), + this._gBound.selectAll('.sankey-node').style('opacity', function (n) { + return t.name === n.name || + e.find(function (t) { + return t.name === n.name; + }) + ? '1' + : '0.2'; + }), + this._gBound.selectAll('.sankey-link').style('opacity', function (e) { + return !e || (e.source.name !== t.name && e.target.name !== t.name) ? '0.2' : '1'; + }); + }, + }, + { + key: '_showAll', + value: function () { + this._gBound.selectAll('.sankey-node').style('opacity', '1'), + this._gBound.selectAll('.sankey-link').style('opacity', '1'); + }, + }, + { + key: '_formatValue', + value: function (t) { + return u.format('.2~f')(t); + }, + }, + { + key: '_formatPercent', + value: function (t) { + return u.format('.2~%')(t); + }, + }, + { + key: '_formatThousand', + value: function (t) { + return u.format('.3~s')(t); + }, + }, + { + key: '_labelNode', + value: function (t) { + var e = this._nodes.filter(function (e) { + return e.depth === t.depth; + }), + n = u.sum(e, function (t) { + return t.value; + }), + r = this._formatThousand(t.value), + o = this._formatPercent(t.value / n), + i = t.name; + switch (this._displayValues) { + case F: + i = ''.concat(i, '\n ').concat(r); + break; + case U: + i = ''.concat(i, '\n ').concat(o); + break; + case Z: + i = ''.concat(i, '\n ').concat(o, ' - ').concat(r); + } + return i; + }, + }, + { + key: '_renderSVG', + value: function () { + var t = this; + this._container.style('background-color', this._background), + (this._gBound = this._container + .append('g') + .attr('transform', 'translate('.concat(this._marginLeft, ', ').concat(this._marginTop, ')'))), + (this._svgNode = this._gBound + .append('g') + .attr('stroke', '#000') + .selectAll('.sankey-node') + .data(this._nodes, function (t) { + return t.name; + }) + .join('rect') + .attr('class', 'sankey-node') + .attr('id', function (t) { + return t.name; + }) + .attr('x', function (t) { + return t.x0; + }) + .attr('y', function (t) { + return t.y0; + }) + .attr('rx', 2) + .attr('ry', 2) + .attr('height', function (t) { + return t.y1 - t.y0; + }) + .attr('width', function (t) { + return t.x1 - t.x0; + }) + .attr('stroke', function (e) { + var n = JSON.parse(t._colorArray); + return Object.keys(n).includes(e.name) ? n[e.name] : 'rgba(148, 153, 168, 1)'; + }) + .attr('fill', function (e) { + var n = JSON.parse(t._colorArray); + return Object.keys(n).includes(e.name) ? n[e.name] : 'rgba(148, 153, 168, 1)'; + }) + .on('mouseover', function (e) { + return t._highlightOnHover && t._showLinks(e); + }) + .on('mouseout', function (e) { + return t._highlightOnHover && t._showAll(); + })), + (this._svgLink = this._gBound + .append('g') + .attr('fill', 'none') + .attr('stroke-opacity', 0.3) + .selectAll('g') + .data(this._links, function (t) { + return ''.concat(t.source.name, '-').concat(t.target.name); + }) + .join('g') + .style('mix-blend-mode', 'multiply')), + 'path' === this._edgeColor && this._setLinkGradient(), + this._svgLink + .append('path') + .attr('class', 'sankey-link') + .attr('d', D()) + .attr('stroke', 'rgba(182, 185, 196, 1)') + .attr('stroke-width', function (t) { + return Math.max(1, t.width); + }), + this._gBound + .append('g') + .attr('font-family', 'sans-serif') + .attr('font-size', 10) + .selectAll('text') + .data(this._nodes) + .join('text') + .attr('x', function (t) { + return t.x0 + 8; + }) + .attr('y', function (t) { + return (t.y1 + t.y0) / 2; + }) + .attr('dy', '0.35em') + .text(function (e) { + return t._labelNode(e); + }), + this._gBound + .append('g') + .attr('font-family', 'sans-serif') + .attr('font-size', 10) + .selectAll('text') + .data(this._nodes) + .join('text') + .attr('x', function (t) { + return t.x0 + 8; + }) + .attr('font-size', 14) + .attr('font-weight', '700') + .attr('y', function (t) { + return (t.y1 + t.y0) / 2 + 16; + }) + .attr('dy', '0.35em') + .text(function (e) { + return t._formatValue(e.value); + }), + this._svgNode.append('title').text(function (e) { + return ''.concat(e.name, '\n').concat(t._formatValue(e.value)); + }), + this._svgLink.append('title').text(function (e) { + return '' + .concat(e.source.name, ' → ') + .concat(e.target.name, '\n') + .concat(t._formatValue(e.value)); + }); + }, + }, + { + key: 'data', + value: function (t) { + return arguments.length ? ((this._data = t), this) : this._data; + }, + }, + { + key: 'width', + value: function (t) { + return arguments.length ? ((this._width = +t), this) : this._width; + }, + }, + { + key: 'height', + value: function (t) { + return arguments.length ? ((this._height = +t), this) : this._height; + }, + }, + { + key: 'align', + value: function (t) { + return arguments.length ? ((this._sankeyAlignType = t), this) : this._sankeyAlignType; + }, + }, + { + key: 'colorScheme', + value: function (t) { + return arguments.length ? ((this._colorScheme = t), this) : this._colorScheme; + }, + }, + { + key: 'colorArray', + value: function (t) { + return arguments.length ? ((this._colorArray = t), this) : this._colorArray; + }, + }, + { + key: 'edgeColor', + value: function (t) { + return arguments.length ? ((this._edgeColor = t), this) : this._edgeColor; + }, + }, + { + key: 'displayValues', + value: function (t) { + return arguments.length ? ((this._displayValues = t), this) : this._displayValues; + }, + }, + { + key: 'highlightOnHover', + value: function (t) { + return arguments.length ? ((this._highlightOnHover = t), this) : this._highlightOnHover; + }, + }, + { + key: 'render', + value: function () { + return this._validate() && (this._init(), this._renderSVG()), this; + }, + }, + ]) && q(e.prototype, n), + o && q(e, o), + t + ); + })(), + tt = n(3), + et = function (t) { + var e = t.message; + return s.a.createElement( + 'p', + { style: nt }, + s.a.createElement( + 'div', + { style: rt }, + s.a.createElement(tt.Icon, { name: 'exclamation-triangle' }), + s.a.createElement('div', { style: ot }, e) + ) + ); + }, + nt = { height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' }, + rt = { + padding: '15px 20px', + marginBottom: '4px', + position: 'relative', + color: 'rgb(255, 255, 255)', + textShadow: 'rgb(0 0 0 / 20%) 0px 1px 0px', + borderRadius: '3px', + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + background: 'linear-gradient(90deg, rgb(224, 47, 68), rgb(224, 47, 68))', + }, + ot = { marginLeft: 10 }; + n.d(e, 'plugin', function () { + return it; + }); + var it = new o.PanelPlugin(function (t) { + var e = t.options, + n = t.data, + r = t.width, + o = t.height, + l = { source: 'source', target: 'target', value: 'value' }, + c = 'Required fields not present: ' + Object.keys(l).join(', '), + h = i(Object(a.useState)({ isError: !1, message: '' }), 2), + f = h[0], + d = h[1], + g = i(Object(a.useState)({ nodes: [], links: [] }), 2), + y = g[0], + _ = g[1]; + Object(a.useEffect)( + function () { + n.error ? d({ isError: !0, message: n.error.message }) : _(p()); + }, + [n] + ); + var p = function () { + var t = n.series[0], + e = t.fields.find(function (t) { + return t.name === l.source; + }), + r = t.fields.find(function (t) { + return t.name === l.target; + }), + o = t.fields.find(function (t) { + return t.name === l.value; + }), + i = null == e ? void 0 : e.values.toArray(), + a = null == r ? void 0 : r.values.toArray(), + s = null == o ? void 0 : o.values.toArray(); + if ( + (function (t, e, n) { + var r = !0; + if (!(t && e && n)) return d({ isError: !0, message: c }), !1; + var o = t.every(function (t) { + return 'string' == typeof t; + }), + i = e.every(function (t) { + return 'string' == typeof t; + }), + a = n.every(function (t) { + return 'number' == typeof t; + }); + return o && i && a + ? (d({}), r) + : (d({ + isError: !0, + message: + 'Fields should have the following types: source (string), target (string), value (numeric)', + }), + !1); + })(i, a, s) + ) { + var h = u.zip(i, a, s); + return { + nodes: Array.from(new Set(i.concat(a))).map(function (t) { + return { name: t }; + }), + links: h.map(function (t) { + return { source: t[0], target: t[1], value: +t[2].toFixed(2) }; + }), + }; + } + }, + v = function (t) { + var n = new $(t) + .width(r) + .height(o) + .align(e.align) + .edgeColor(e.edgeColor) + .colorScheme(e.colorScheme) + .displayValues(e.displayValues) + .highlightOnHover(e.highlightOnHover) + .colorArray(e.colorArray) + .data(y); + try { + n.render(); + } catch (t) { + d({ isError: !0, message: t.message }); + } + }; + return f.isError + ? s.a.createElement(et, { message: f.message }) + : s.a.createElement('svg', { + viewBox: '0 0 ' + r + ' ' + o, + ref: function (t) { + u.select(t).selectAll('*').remove(), u.select(t).call(v); + }, + }); + }).setPanelOptions(function (t) { + return t + .addSelect({ + path: 'align', + name: 'Align', + defaultValue: 'Justify', + settings: { + options: [ + { value: 'Justify', label: 'Justify' }, + { value: 'Left', label: 'Left' }, + { value: 'Right', label: 'Right' }, + { value: 'Center', label: 'Center' }, + ], + }, + }) + .addTextInput({ path: 'colorArray', name: 'Color Object', defaultValue: '' }) + .addSelect({ + path: 'colorScheme', + name: 'Color', + defaultValue: 'Tableau10', + settings: { + options: [ + { value: 'Tableau10', label: 'Tableau10' }, + { value: 'Category10', label: 'Category10' }, + { value: 'Accent', label: 'Accent' }, + { value: 'Dark2', label: 'Dark2' }, + { value: 'Paired', label: 'Paired' }, + { value: 'Pastel1', label: 'Pastel1' }, + { value: 'Pastel2', label: 'Pastel2' }, + { value: 'Set1', label: 'Set1' }, + { value: 'Set2', label: 'Set2' }, + { value: 'Set3', label: 'Set3' }, + ], + }, + }) + .addSelect({ + path: 'edgeColor', + name: 'Edge Color', + defaultValue: 'path', + settings: { + options: [ + { value: 'path', label: 'input-output' }, + { value: 'input', label: 'input' }, + { value: 'output', label: 'output' }, + { value: 'none', label: 'none' }, + ], + }, + }) + .addSelect({ + path: 'displayValues', + name: 'Display Values', + defaultValue: 'none', + settings: { + options: [ + { value: 'total', label: 'Totals' }, + { value: 'percentage', label: 'Percentages' }, + { value: 'both', label: 'Both' }, + { value: 'none', label: 'None' }, + ], + }, + }) + .addBooleanSwitch({ + path: 'highlightOnHover', + name: 'Highlight connections on node hover', + defaultValue: !1, + }); + }); + }, + ]); +}); +//# sourceMappingURL=module.js.map diff --git a/public/app/plugins/panel/netsage-sankey-panel/module.js.LICENSE.txt b/public/app/plugins/panel/sankey-panel-0.5.0/module.js.LICENSE.txt similarity index 100% rename from public/app/plugins/panel/netsage-sankey-panel/module.js.LICENSE.txt rename to public/app/plugins/panel/sankey-panel-0.5.0/module.js.LICENSE.txt diff --git a/public/app/plugins/panel/sankey-panel-0.5.0/module.js.map b/public/app/plugins/panel/sankey-panel-0.5.0/module.js.map new file mode 100644 index 000000000000..0c44a00ad1a5 --- /dev/null +++ b/public/app/plugins/panel/sankey-panel-0.5.0/module.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"d3\"","webpack:///external \"@grafana/data\"","webpack:///external \"@grafana/ui\"","webpack:///../node_modules/tslib/tslib.es6.js","webpack:///../node_modules/d3-sankey/node_modules/d3-array/src/sum.js","webpack:///../node_modules/d3-sankey/node_modules/d3-array/src/max.js","webpack:///../node_modules/d3-sankey/node_modules/d3-array/src/min.js","webpack:///../node_modules/d3-sankey/src/align.js","webpack:///../node_modules/d3-sankey/src/constant.js","webpack:///../node_modules/d3-sankey/src/sankey.js","webpack:///../node_modules/d3-path/src/path.js","webpack:///../node_modules/d3-shape/src/array.js","webpack:///../node_modules/d3-shape/src/constant.js","webpack:///../node_modules/d3-shape/src/point.js","webpack:///../node_modules/d3-shape/src/link/index.js","webpack:///../node_modules/d3-sankey/src/sankeyLinkHorizontal.js","webpack:///./Sankey.js","webpack:///./Error.tsx","webpack:///./module.ts","webpack:///./SankeyPanel.tsx"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","__WEBPACK_EXTERNAL_MODULE__0__","__WEBPACK_EXTERNAL_MODULE__1__","__WEBPACK_EXTERNAL_MODULE__2__","__WEBPACK_EXTERNAL_MODULE__3__","__read","iterator","e","ar","next","done","push","error","sum","values","valueof","undefined","index","max","min","targetDepth","target","depth","left","node","right","height","justify","sourceLinks","length","center","targetLinks","constant","x","ascendingSourceBreadth","a","b","ascendingBreadth","source","ascendingTargetBreadth","y0","defaultId","defaultNodes","graph","nodes","defaultLinks","links","find","nodeById","id","Error","computeLinkBreadths","y1","link","width","py","sort","linkSort","x0","x1","dx","dy","align","iterations","sankey","apply","arguments","computeNodeLinks","computeNodeValues","computeNodeDepths","computeNodeHeights","computeNodeBreadths","entries","Map","map","fixedValue","Math","current","Set","size","add","columns","kx","Array","floor","layer","column","computeNodeLayers","ky","y","reorderLinks","initializeNodeBreadths","alpha","pow","beta","relaxRightToLeft","relaxLeftToRight","w","v","targetTop","reorderNodeLinks","resolveCollisions","sourceTop","subject","resolveCollisionsBottomToTop","resolveCollisionsTopToBottom","update","nodeId","_","nodeAlign","nodeSort","nodeWidth","nodePadding","extent","pi","PI","tau","tauEpsilon","Path","this","_x0","_y0","_x1","_y1","path","constructor","moveTo","closePath","lineTo","quadraticCurveTo","bezierCurveTo","x2","y2","arcTo","x21","y21","x01","y01","l01_2","abs","x20","y20","l21_2","l20_2","l21","sqrt","l01","tan","acos","t01","t21","arc","a0","a1","ccw","cos","sin","cw","da","rect","h","toString","slice","linkSource","linkTarget","curve","context","buffer","argv","curveHorizontal","horizontalSource","horizontalTarget","DISPLAY_VALUES","EDGE_COLORS","Sankey","svg","container","_svg","_container","_gBound","_data","_nodes","_links","_width","_height","_boundedWidth","_boundedHeight","_marginTop","_marginRight","_marginBottom","_marginLeft","_background","_edgeColor","_colorScheme","_colorScale","_colorArray","_sankeyAlignType","_sankeyAlign","_sankeyGenerator","_sankeyNodeWith","_sankeyNodePadding","_svgNode","_svgLink","_displayValues","_highlightOnHover","_setBoundDimensions","_setColorScale","_configureSankey","_calculateSankey","d3","d3Sankey","sankeyData","assign","gradient","append","attr","uid","random","_color","currentNode","linkedNodes","linkType","nodeType","forEach","step","selectAll","style","linkedNode","percent","nodesAtDepth","filter","totalAtDepth","nodeValue","_formatThousand","nodePercent","_formatPercent","label","data","join","colorArray","JSON","parse","keys","includes","on","_showLinks","_showAll","_setLinkGradient","text","_labelNode","_formatValue","_validate","_init","_renderSVG","message","panelStyles","containerStyles","messageStyles","display","justifyContent","alignItems","padding","marginBottom","position","color","textShadow","borderRadius","flexDirection","background","marginLeft","options","CHART_REQUIRED_FIELDS","requiredFieldsMsg","isError","setError","setGraph","buildGraph","frame","series","sourceAccesor","fields","field","targetAccesor","valueAccesor","sources","toArray","targets","isValid","sourcesString","every","targetsString","valuesNumeric","validate","zip","from","concat","toFixed","chart","edgeColor","colorScheme","displayValues","highlightOnHover","render","renderError","viewBox","ref","remove","setPanelOptions","builder","addSelect","defaultValue","settings","addTextInput","addBooleanSwitch"],"mappings":";0FACE,IAAIA,EAAmB,GAGvB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MAAO,UACP0P,MAAO,WAET,CACE1P,MAAO,OACP0P,MAAO,QAET,CACE1P,MAAO,OACP0P,MAAO,QAET,CACE1P,MAAO,OACP0P,MAAO,YAKdyE,UAAU,CACTzL,KAAM,YACNpJ,KAAM,aACN8U,aAAc,OACdC,SAAU,CACRzC,QAAS,CACP,CACE5R,MAAO,OACP0P,MAAO,gBAET,CACE1P,MAAO,QACP0P,MAAO,SAET,CACE1P,MAAO,SACP0P,MAAO,UAET,CACE1P,MAAO,OACP0P,MAAO,YAKdyE,UAAU,CACTzL,KAAM,gBACNpJ,KAAM,iBACN8U,aAAc,OACdC,SAAU,CACRzC,QAAS,CACP,CACE5R,MAAO,QACP0P,MAAO,UAET,CACE1P,MAAO,aACP0P,MAAO,eAET,CACE1P,MAAO,OACP0P,MAAO,QAET,CACE1P,MAAO,OACP0P,MAAO,YAKd6E,iBAAiB,CAChB7L,KAAM,mBACNpJ,KAAM,sCACN8U,cAAc","file":"module.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n","module.exports = __WEBPACK_EXTERNAL_MODULE__0__;","module.exports = __WEBPACK_EXTERNAL_MODULE__1__;","module.exports = __WEBPACK_EXTERNAL_MODULE__2__;","module.exports = __WEBPACK_EXTERNAL_MODULE__3__;","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","export default function sum(values, valueof) {\n let sum = 0;\n if (valueof === undefined) {\n for (let value of values) {\n if (value = +value) {\n sum += value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if (value = +valueof(value, ++index, values)) {\n sum += value;\n }\n }\n }\n return sum;\n}\n","export default function max(values, valueof) {\n let max;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (max < value || (max === undefined && value >= value))) {\n max = value;\n }\n }\n }\n return max;\n}\n","export default function min(values, valueof) {\n let min;\n if (valueof === undefined) {\n for (const value of values) {\n if (value != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null\n && (min > value || (min === undefined && value >= value))) {\n min = value;\n }\n }\n }\n return min;\n}\n","import {min} from \"d3-array\";\n\nfunction targetDepth(d) {\n return d.target.depth;\n}\n\nexport function left(node) {\n return node.depth;\n}\n\nexport function right(node, n) {\n return n - 1 - node.height;\n}\n\nexport function justify(node, n) {\n return node.sourceLinks.length ? node.depth : n - 1;\n}\n\nexport function center(node) {\n return node.targetLinks.length ? node.depth\n : node.sourceLinks.length ? min(node.sourceLinks, targetDepth) - 1\n : 0;\n}\n","export default function constant(x) {\n return function() {\n return x;\n };\n}\n","import {max, min, sum} from \"d3-array\";\nimport {justify} from \"./align.js\";\nimport constant from \"./constant.js\";\n\nfunction ascendingSourceBreadth(a, b) {\n return ascendingBreadth(a.source, b.source) || a.index - b.index;\n}\n\nfunction ascendingTargetBreadth(a, b) {\n return ascendingBreadth(a.target, b.target) || a.index - b.index;\n}\n\nfunction ascendingBreadth(a, b) {\n return a.y0 - b.y0;\n}\n\nfunction value(d) {\n return d.value;\n}\n\nfunction defaultId(d) {\n return d.index;\n}\n\nfunction defaultNodes(graph) {\n return graph.nodes;\n}\n\nfunction defaultLinks(graph) {\n return graph.links;\n}\n\nfunction find(nodeById, id) {\n const node = nodeById.get(id);\n if (!node) throw new Error(\"missing: \" + id);\n return node;\n}\n\nfunction computeLinkBreadths({nodes}) {\n for (const node of nodes) {\n let y0 = node.y0;\n let y1 = y0;\n for (const link of node.sourceLinks) {\n link.y0 = y0 + link.width / 2;\n y0 += link.width;\n }\n for (const link of node.targetLinks) {\n link.y1 = y1 + link.width / 2;\n y1 += link.width;\n }\n }\n}\n\nexport default function Sankey() {\n let x0 = 0, y0 = 0, x1 = 1, y1 = 1; // extent\n let dx = 24; // nodeWidth\n let dy = 8, py; // nodePadding\n let id = defaultId;\n let align = justify;\n let sort;\n let linkSort;\n let nodes = defaultNodes;\n let links = defaultLinks;\n let iterations = 6;\n\n function sankey() {\n const graph = {nodes: nodes.apply(null, arguments), links: links.apply(null, arguments)};\n computeNodeLinks(graph);\n computeNodeValues(graph);\n computeNodeDepths(graph);\n computeNodeHeights(graph);\n computeNodeBreadths(graph);\n computeLinkBreadths(graph);\n return graph;\n }\n\n sankey.update = function(graph) {\n computeLinkBreadths(graph);\n return graph;\n };\n\n sankey.nodeId = function(_) {\n return arguments.length ? (id = typeof _ === \"function\" ? _ : constant(_), sankey) : id;\n };\n\n sankey.nodeAlign = function(_) {\n return arguments.length ? (align = typeof _ === \"function\" ? _ : constant(_), sankey) : align;\n };\n\n sankey.nodeSort = function(_) {\n return arguments.length ? (sort = _, sankey) : sort;\n };\n\n sankey.nodeWidth = function(_) {\n return arguments.length ? (dx = +_, sankey) : dx;\n };\n\n sankey.nodePadding = function(_) {\n return arguments.length ? (dy = py = +_, sankey) : dy;\n };\n\n sankey.nodes = function(_) {\n return arguments.length ? (nodes = typeof _ === \"function\" ? _ : constant(_), sankey) : nodes;\n };\n\n sankey.links = function(_) {\n return arguments.length ? (links = typeof _ === \"function\" ? _ : constant(_), sankey) : links;\n };\n\n sankey.linkSort = function(_) {\n return arguments.length ? (linkSort = _, sankey) : linkSort;\n };\n\n sankey.size = function(_) {\n return arguments.length ? (x0 = y0 = 0, x1 = +_[0], y1 = +_[1], sankey) : [x1 - x0, y1 - y0];\n };\n\n sankey.extent = function(_) {\n return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], sankey) : [[x0, y0], [x1, y1]];\n };\n\n sankey.iterations = function(_) {\n return arguments.length ? (iterations = +_, sankey) : iterations;\n };\n\n function computeNodeLinks({nodes, links}) {\n for (const [i, node] of nodes.entries()) {\n node.index = i;\n node.sourceLinks = [];\n node.targetLinks = [];\n }\n const nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d]));\n for (const [i, link] of links.entries()) {\n link.index = i;\n let {source, target} = link;\n if (typeof source !== \"object\") source = link.source = find(nodeById, source);\n if (typeof target !== \"object\") target = link.target = find(nodeById, target);\n source.sourceLinks.push(link);\n target.targetLinks.push(link);\n }\n if (linkSort != null) {\n for (const {sourceLinks, targetLinks} of nodes) {\n sourceLinks.sort(linkSort);\n targetLinks.sort(linkSort);\n }\n }\n }\n\n function computeNodeValues({nodes}) {\n for (const node of nodes) {\n node.value = node.fixedValue === undefined\n ? Math.max(sum(node.sourceLinks, value), sum(node.targetLinks, value))\n : node.fixedValue;\n }\n }\n\n function computeNodeDepths({nodes}) {\n const n = nodes.length;\n let current = new Set(nodes);\n let next = new Set;\n let x = 0;\n while (current.size) {\n for (const node of current) {\n node.depth = x;\n for (const {target} of node.sourceLinks) {\n next.add(target);\n }\n }\n if (++x > n) throw new Error(\"circular link\");\n current = next;\n next = new Set;\n }\n }\n\n function computeNodeHeights({nodes}) {\n const n = nodes.length;\n let current = new Set(nodes);\n let next = new Set;\n let x = 0;\n while (current.size) {\n for (const node of current) {\n node.height = x;\n for (const {source} of node.targetLinks) {\n next.add(source);\n }\n }\n if (++x > n) throw new Error(\"circular link\");\n current = next;\n next = new Set;\n }\n }\n\n function computeNodeLayers({nodes}) {\n const x = max(nodes, d => d.depth) + 1;\n const kx = (x1 - x0 - dx) / (x - 1);\n const columns = new Array(x);\n for (const node of nodes) {\n const i = Math.max(0, Math.min(x - 1, Math.floor(align.call(null, node, x))));\n node.layer = i;\n node.x0 = x0 + i * kx;\n node.x1 = node.x0 + dx;\n if (columns[i]) columns[i].push(node);\n else columns[i] = [node];\n }\n if (sort) for (const column of columns) {\n column.sort(sort);\n }\n return columns;\n }\n\n function initializeNodeBreadths(columns) {\n const ky = min(columns, c => (y1 - y0 - (c.length - 1) * py) / sum(c, value));\n for (const nodes of columns) {\n let y = y0;\n for (const node of nodes) {\n node.y0 = y;\n node.y1 = y + node.value * ky;\n y = node.y1 + py;\n for (const link of node.sourceLinks) {\n link.width = link.value * ky;\n }\n }\n y = (y1 - y + py) / (nodes.length + 1);\n for (let i = 0; i < nodes.length; ++i) {\n const node = nodes[i];\n node.y0 += y * (i + 1);\n node.y1 += y * (i + 1);\n }\n reorderLinks(nodes);\n }\n }\n\n function computeNodeBreadths(graph) {\n const columns = computeNodeLayers(graph);\n py = Math.min(dy, (y1 - y0) / (max(columns, c => c.length) - 1));\n initializeNodeBreadths(columns);\n for (let i = 0; i < iterations; ++i) {\n const alpha = Math.pow(0.99, i);\n const beta = Math.max(1 - alpha, (i + 1) / iterations);\n relaxRightToLeft(columns, alpha, beta);\n relaxLeftToRight(columns, alpha, beta);\n }\n }\n\n // Reposition each node based on its incoming (target) links.\n function relaxLeftToRight(columns, alpha, beta) {\n for (let i = 1, n = columns.length; i < n; ++i) {\n const column = columns[i];\n for (const target of column) {\n let y = 0;\n let w = 0;\n for (const {source, value} of target.targetLinks) {\n let v = value * (target.layer - source.layer);\n y += targetTop(source, target) * v;\n w += v;\n }\n if (!(w > 0)) continue;\n let dy = (y / w - target.y0) * alpha;\n target.y0 += dy;\n target.y1 += dy;\n reorderNodeLinks(target);\n }\n if (sort === undefined) column.sort(ascendingBreadth);\n resolveCollisions(column, beta);\n }\n }\n\n // Reposition each node based on its outgoing (source) links.\n function relaxRightToLeft(columns, alpha, beta) {\n for (let n = columns.length, i = n - 2; i >= 0; --i) {\n const column = columns[i];\n for (const source of column) {\n let y = 0;\n let w = 0;\n for (const {target, value} of source.sourceLinks) {\n let v = value * (target.layer - source.layer);\n y += sourceTop(source, target) * v;\n w += v;\n }\n if (!(w > 0)) continue;\n let dy = (y / w - source.y0) * alpha;\n source.y0 += dy;\n source.y1 += dy;\n reorderNodeLinks(source);\n }\n if (sort === undefined) column.sort(ascendingBreadth);\n resolveCollisions(column, beta);\n }\n }\n\n function resolveCollisions(nodes, alpha) {\n const i = nodes.length >> 1;\n const subject = nodes[i];\n resolveCollisionsBottomToTop(nodes, subject.y0 - py, i - 1, alpha);\n resolveCollisionsTopToBottom(nodes, subject.y1 + py, i + 1, alpha);\n resolveCollisionsBottomToTop(nodes, y1, nodes.length - 1, alpha);\n resolveCollisionsTopToBottom(nodes, y0, 0, alpha);\n }\n\n // Push any overlapping nodes down.\n function resolveCollisionsTopToBottom(nodes, y, i, alpha) {\n for (; i < nodes.length; ++i) {\n const node = nodes[i];\n const dy = (y - node.y0) * alpha;\n if (dy > 1e-6) node.y0 += dy, node.y1 += dy;\n y = node.y1 + py;\n }\n }\n\n // Push any overlapping nodes up.\n function resolveCollisionsBottomToTop(nodes, y, i, alpha) {\n for (; i >= 0; --i) {\n const node = nodes[i];\n const dy = (node.y1 - y) * alpha;\n if (dy > 1e-6) node.y0 -= dy, node.y1 -= dy;\n y = node.y0 - py;\n }\n }\n\n function reorderNodeLinks({sourceLinks, targetLinks}) {\n if (linkSort === undefined) {\n for (const {source: {sourceLinks}} of targetLinks) {\n sourceLinks.sort(ascendingTargetBreadth);\n }\n for (const {target: {targetLinks}} of sourceLinks) {\n targetLinks.sort(ascendingSourceBreadth);\n }\n }\n }\n\n function reorderLinks(nodes) {\n if (linkSort === undefined) {\n for (const {sourceLinks, targetLinks} of nodes) {\n sourceLinks.sort(ascendingTargetBreadth);\n targetLinks.sort(ascendingSourceBreadth);\n }\n }\n }\n\n // Returns the target.y0 that would produce an ideal link from source to target.\n function targetTop(source, target) {\n let y = source.y0 - (source.sourceLinks.length - 1) * py / 2;\n for (const {target: node, width} of source.sourceLinks) {\n if (node === target) break;\n y += width + py;\n }\n for (const {source: node, width} of target.targetLinks) {\n if (node === source) break;\n y -= width;\n }\n return y;\n }\n\n // Returns the source.y0 that would produce an ideal link from source to target.\n function sourceTop(source, target) {\n let y = target.y0 - (target.targetLinks.length - 1) * py / 2;\n for (const {source: node, width} of target.targetLinks) {\n if (node === source) break;\n y += width + py;\n }\n for (const {target: node, width} of source.sourceLinks) {\n if (node === target) break;\n y -= width;\n }\n return y;\n }\n\n return sankey;\n}\n","var pi = Math.PI,\n tau = 2 * pi,\n epsilon = 1e-6,\n tauEpsilon = tau - epsilon;\n\nfunction Path() {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n}\n\nfunction path() {\n return new Path;\n}\n\nPath.prototype = path.prototype = {\n constructor: Path,\n moveTo: function(x, y) {\n this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y);\n },\n closePath: function() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._ += \"Z\";\n }\n },\n lineTo: function(x, y) {\n this._ += \"L\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n quadraticCurveTo: function(x1, y1, x, y) {\n this._ += \"Q\" + (+x1) + \",\" + (+y1) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n bezierCurveTo: function(x1, y1, x2, y2, x, y) {\n this._ += \"C\" + (+x1) + \",\" + (+y1) + \",\" + (+x2) + \",\" + (+y2) + \",\" + (this._x1 = +x) + \",\" + (this._y1 = +y);\n },\n arcTo: function(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n var x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(\"negative radius: \" + r);\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._ += \"M\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon));\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n this._ += \"L\" + (this._x1 = x1) + \",\" + (this._y1 = y1);\n }\n\n // Otherwise, draw an arc!\n else {\n var x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon) {\n this._ += \"L\" + (x1 + t01 * x01) + \",\" + (y1 + t01 * y01);\n }\n\n this._ += \"A\" + r + \",\" + r + \",0,0,\" + (+(y01 * x20 > x01 * y20)) + \",\" + (this._x1 = x1 + t21 * x21) + \",\" + (this._y1 = y1 + t21 * y21);\n }\n },\n arc: function(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r, ccw = !!ccw;\n var dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(\"negative radius: \" + r);\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._ += \"M\" + x0 + \",\" + y0;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n this._ += \"L\" + x0 + \",\" + y0;\n }\n\n // Is this arc empty? We’re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau + tau;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._ += \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (x - dx) + \",\" + (y - dy) + \"A\" + r + \",\" + r + \",0,1,\" + cw + \",\" + (this._x1 = x0) + \",\" + (this._y1 = y0);\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon) {\n this._ += \"A\" + r + \",\" + r + \",0,\" + (+(da >= pi)) + \",\" + cw + \",\" + (this._x1 = x + r * Math.cos(a1)) + \",\" + (this._y1 = y + r * Math.sin(a1));\n }\n },\n rect: function(x, y, w, h) {\n this._ += \"M\" + (this._x0 = this._x1 = +x) + \",\" + (this._y0 = this._y1 = +y) + \"h\" + (+w) + \"v\" + (+h) + \"h\" + (-w) + \"Z\";\n },\n toString: function() {\n return this._;\n }\n};\n\nexport default path;\n","export var slice = Array.prototype.slice;\n","export default function(x) {\n return function constant() {\n return x;\n };\n}\n","export function x(p) {\n return p[0];\n}\n\nexport function y(p) {\n return p[1];\n}\n","import {path} from \"d3-path\";\nimport {slice} from \"../array.js\";\nimport constant from \"../constant.js\";\nimport {x as pointX, y as pointY} from \"../point.js\";\nimport pointRadial from \"../pointRadial.js\";\n\nfunction linkSource(d) {\n return d.source;\n}\n\nfunction linkTarget(d) {\n return d.target;\n}\n\nfunction link(curve) {\n var source = linkSource,\n target = linkTarget,\n x = pointX,\n y = pointY,\n context = null;\n\n function link() {\n var buffer, argv = slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);\n if (!context) context = buffer = path();\n curve(context, +x.apply(this, (argv[0] = s, argv)), +y.apply(this, argv), +x.apply(this, (argv[0] = t, argv)), +y.apply(this, argv));\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n link.source = function(_) {\n return arguments.length ? (source = _, link) : source;\n };\n\n link.target = function(_) {\n return arguments.length ? (target = _, link) : target;\n };\n\n link.x = function(_) {\n return arguments.length ? (x = typeof _ === \"function\" ? _ : constant(+_), link) : x;\n };\n\n link.y = function(_) {\n return arguments.length ? (y = typeof _ === \"function\" ? _ : constant(+_), link) : y;\n };\n\n link.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), link) : context;\n };\n\n return link;\n}\n\nfunction curveHorizontal(context, x0, y0, x1, y1) {\n context.moveTo(x0, y0);\n context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);\n}\n\nfunction curveVertical(context, x0, y0, x1, y1) {\n context.moveTo(x0, y0);\n context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);\n}\n\nfunction curveRadial(context, x0, y0, x1, y1) {\n var p0 = pointRadial(x0, y0),\n p1 = pointRadial(x0, y0 = (y0 + y1) / 2),\n p2 = pointRadial(x1, y0),\n p3 = pointRadial(x1, y1);\n context.moveTo(p0[0], p0[1]);\n context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);\n}\n\nexport function linkHorizontal() {\n return link(curveHorizontal);\n}\n\nexport function linkVertical() {\n return link(curveVertical);\n}\n\nexport function linkRadial() {\n var l = link(curveRadial);\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n return l;\n}\n","import {linkHorizontal} from \"d3-shape\";\n\nfunction horizontalSource(d) {\n return [d.source.x1, d.y0];\n}\n\nfunction horizontalTarget(d) {\n return [d.target.x0, d.y1];\n}\n\nexport default function() {\n return linkHorizontal()\n .source(horizontalSource)\n .target(horizontalTarget);\n}\n","import * as d3 from 'd3';\nimport * as d3Sankey from 'd3-sankey';\n\nconst DISPLAY_VALUES = { total: 'total', percentage: 'percentage', both: 'both', none: 'none' };\nconst EDGE_COLORS = { none: 'none', path: 'path', input: 'input', output: 'output'};\n\nexport class Sankey {\n constructor(svg, container) {\n this._svg = svg;\n this._container = container || svg;\n this._gBound = null;\n\n this._data = null;\n this._nodes = null;\n this._links = null;\n\n this._width = 0;\n this._height = 0;\n this._boundedWidth = 0;\n this._boundedHeight = 0;\n\n this._marginTop = 20;\n this._marginRight = 20;\n this._marginBottom = 20;\n this._marginLeft = 20;\n\n this._background = 'rgba(0, 0, 0, 0)';\n this._edgeColor = 'path';\n this._colorScheme = 'Tableau10';\n this._colorScale = null;\n this._colorArray = '';\n\n this._sankeyAlignType = 'Justify';\n this._sankeyAlign = null;\n this._sankeyGenerator = null;\n this._sankeyNodeWith = 85;\n this._sankeyNodePadding = 20;\n\n this._svgNode = null;\n this._svgLink = null;\n\n this._displayValues = 'none';\n this._highlightOnHover = false;\n\n }\n \n _init() {\n this._setBoundDimensions();\n this._setColorScale();\n this._configureSankey();\n this._calculateSankey();\n }\n\n // ---------------------------- DIMENSIONS ----------------------------\n\n _setBoundDimensions() {\n this._boundedWidth = this._width - this._marginLeft - this._marginRight;\n this._boundedHeight = this._height - this._marginTop - this._marginBottom;\n }\n\n // ------------------------------ COLOR -------------------------------\n\n _setColorScale() {\n this._colorScale = d3.scaleOrdinal(d3[`scheme${this._colorScheme}`]);\n }\n\n _color(node) {\n return this._colorScale(node.name);\n }\n\n // ------------------------------ SANKEY -------------------------------\n\n _configureSankey() {\n this._sankeyAlign = d3Sankey[`sankey${this._sankeyAlignType}`];\n\n this._sankeyGenerator = d3Sankey\n .sankey()\n .nodeId(d => d.name)\n .nodeAlign(this._sankeyAlign)\n .nodeWidth(this._sankeyNodeWith)\n .nodePadding(this._sankeyNodePadding)\n .extent([\n [0, 0],\n [this._boundedWidth, this._boundedHeight],\n ]);\n }\n\n _calculateSankey() {\n const sankeyData = this._sankeyGenerator({\n nodes: this._data.nodes.map(d => Object.assign({}, d)),\n links: this._data.links.map(d => Object.assign({}, d))\n });\n\n this._nodes = sankeyData.nodes;\n this._links = sankeyData.links;\n }\n\n // ---------------------------- VALIDATIONS -----------------------------\n\n _validate() {\n return this._data &&\n this._data.nodes &&\n this._data.links &&\n this._data.nodes.length > 0 &&\n this._data.links.length > 0\n }\n\n // ------------------------------ HELPERS -------------------------------\n\n _setLinkGradient() {\n const gradient = this._svgLink\n .append('linearGradient')\n .attr('id', d => (d.uid = `link-${d.index}-${Math.random()}`))\n .attr('gradientUnits', 'userSpaceOnUse')\n .attr('x1', d => d.source.x1)\n .attr('x2', d => d.target.x0);\n\n gradient\n .append('stop')\n .attr('offset', '0%')\n .attr('stop-color', d => this._color(d.source));\n\n gradient\n .append('stop')\n .attr('offset', '100%')\n .attr('stop-color', d => this._color(d.target));\n }\n\n _setLinkStroke(d) {\n switch (this._edgeColor) {\n case EDGE_COLORS.none:\n return '#aaa';\n case EDGE_COLORS.path:\n return `url(#${d.uid})`;\n case EDGE_COLORS.input:\n return this._color(d.source)\n case EDGE_COLORS.output:\n return this._color(d.target)\n default:\n return\n }\n }\n\n // NODE HOVER\n _showLinks(currentNode) {\n const linkedNodes = [];\n\n let traverse = [\n {\n linkType: 'sourceLinks',\n nodeType: 'target',\n },\n {\n linkType: 'targetLinks',\n nodeType: 'source',\n },\n ];\n\n traverse.forEach(step => {\n currentNode[step.linkType].forEach(l => {\n linkedNodes.push(l[step.nodeType]);\n });\n });\n\n // highlight linked nodes\n this._gBound\n .selectAll('.sankey-node')\n .style('opacity', node =>\n currentNode.name === node.name ||\n linkedNodes.find(linkedNode => linkedNode.name === node.name) ? \n '1' : '0.2'\n );\n\n // highlight links\n this._gBound\n .selectAll('.sankey-link')\n .style('opacity', link =>\n link && (\n link.source.name === currentNode.name || \n link.target.name === currentNode.name\n ) ? \n '1' : '0.2'\n );\n };\n\n _showAll() {\n this._gBound.selectAll('.sankey-node').style('opacity', '1');\n this._gBound.selectAll('.sankey-link').style('opacity', '1');\n };\n\n // NODE LABELING\n _formatValue(value) { return d3.format('.2~f')(value); }\n _formatPercent(percent) { return d3.format('.2~%')(percent); }\n _formatThousand(value) { return d3.format('.3~s')(value); }\n\n _labelNode(currentNode) {\n const nodesAtDepth = this._nodes.filter(node => node.depth === currentNode.depth);\n const totalAtDepth = d3.sum(nodesAtDepth, node => node.value);\n const nodeValue = this._formatThousand(currentNode.value);\n const nodePercent = this._formatPercent(currentNode.value / totalAtDepth);\n\n let label = currentNode.name;\n switch (this._displayValues) {\n case DISPLAY_VALUES.total:\n label = `${label}\n ${nodeValue}`;\n break;\n case DISPLAY_VALUES.percentage:\n label = `${label}\n ${nodePercent}`;\n break;\n case DISPLAY_VALUES.both:\n label = `${label}\n ${nodePercent} - ${nodeValue}`;\n break;\n default:\n break;\n }\n return label;\n };\n\n // ------------------------------ DRAWING -------------------------------\n\n _renderSVG() {\n // BACKGROUND\n this._container.style('background-color', this._background)\n\n // BOUNDS\n this._gBound = this._container.append('g')\n .attr('transform', `translate(${this._marginLeft}, ${this._marginTop})`);\n\n // NODES\n this._svgNode = this._gBound\n .append('g')\n .attr('stroke', '#000')\n .selectAll('.sankey-node')\n .data(this._nodes, node => node.name)\n .join('rect')\n .attr('class', 'sankey-node')\n .attr('id', d => d.name)\n .attr('x', d => d.x0)\n .attr('y', d => d.y0)\n .attr('rx', 2)\n .attr('ry', 2)\n .attr('height', d => d.y1 - d.y0)\n .attr('width', d => d.x1 - d.x0)\n .attr('stroke', d => {\n const colorArray = JSON.parse(this._colorArray);\n if (Object.keys(colorArray).includes(d.name)) {\n return colorArray[d.name];\n }\n return \"rgba(148, 153, 168, 1)\";\n })\n .attr('fill', d => {\n const colorArray = JSON.parse(this._colorArray);\n if (Object.keys(colorArray).includes(d.name)) {\n return colorArray[d.name];\n }\n return \"rgba(148, 153, 168, 1)\";\n })\n .on('mouseover', d => this._highlightOnHover && this._showLinks(d))\n .on('mouseout', _ => this._highlightOnHover && this._showAll());\n\n // LINKS\n this._svgLink = this._gBound\n .append('g')\n .attr('fill', 'none')\n .attr('stroke-opacity', 0.3)\n .selectAll('g')\n .data(this._links, link => `${link.source.name}-${link.target.name}`)\n .join('g')\n .style('mix-blend-mode', 'multiply');\n\n if (this._edgeColor === 'path') this._setLinkGradient()\n\n this._svgLink\n .append('path')\n .attr('class', 'sankey-link')\n .attr('d', d3Sankey.sankeyLinkHorizontal())\n .attr('stroke', \"rgba(182, 185, 196, 1)\")\n .attr('stroke-width', d => Math.max(1, d.width)); \n\n // LABELS\n this._gBound\n .append('g')\n .attr('font-family', 'sans-serif')\n .attr('font-size', 10)\n .selectAll('text')\n .data(this._nodes)\n .join('text')\n .attr('x', d => d.x0 + 8)\n .attr('y', d => (d.y1 + d.y0) / 2)\n .attr('dy', '0.35em')\n //.attr('text-anchor', d => (d.x0 < this._width / 2 ? 'start' : 'end'))\n .text(d => this._labelNode(d));\n\n this._gBound\n .append('g')\n .attr('font-family', 'sans-serif')\n .attr('font-size', 10)\n .selectAll('text')\n .data(this._nodes)\n .join('text')\n .attr('x', d => d.x0 + 8)\n .attr('font-size', 14)\n .attr('font-weight', '700')\n .attr('y', d => ((d.y1 + d.y0) / 2) + 16)\n .attr('dy', '0.35em')\n //.attr('text-anchor', d => (d.x0 < this._width / 2 ? 'start' : 'end'))\n .text(d => this._formatValue(d.value));\n\n this._svgNode\n .append('title')\n .text(d => `${d.name}\\n${this._formatValue(d.value)}`);\n\n this._svgLink\n .append('title')\n .text(d => `${d.source.name} → ${d.target.name}\\n${this._formatValue(d.value)}`);\n }\n\n\n // ----------------------------------------------------------------------- \n // ------------------------------ API ------------------------------\n // ----------------------------------------------------------------------- \n\n data(_) {\n return arguments.length ? (this._data = _, this) : this._data;\n };\n\n width(_) {\n return arguments.length ? (this._width = +_, this) : this._width;\n };\n\n height(_) {\n return arguments.length ? (this._height = +_, this) : this._height;\n };\n\n align(_) {\n return arguments.length ? (this._sankeyAlignType = _, this) : this._sankeyAlignType;\n }\n\n colorScheme(_) {\n return arguments.length ? (this._colorScheme = _, this) : this._colorScheme;\n }\n\n colorArray(_) {\n return arguments.length ? (this._colorArray = _, this) : this._colorArray;\n }\n\n edgeColor(_) {\n return arguments.length ? (this._edgeColor = _, this) : this._edgeColor;\n }\n\n displayValues(_) {\n return arguments.length ? (this._displayValues = _, this) : this._displayValues;\n }\n\n highlightOnHover(_) {\n return arguments.length ? (this._highlightOnHover = _, this) : this._highlightOnHover;\n }\n\n render() {\n if (!this._validate()) {\n // no graph data\n }\n else {\n this._init();\n this._renderSVG()\n }\n return this;\n }\n}\n","// @ts-nocheck\nimport React from 'react';\nimport { Icon } from '@grafana/ui';\n\nexport const ErrorMessage = ({ message }) => ( \n

\n

\n \n
{message}
\n
\n

\n)\n\nconst panelStyles = {\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center'\n}\n\nconst containerStyles = {\n padding: '15px 20px',\n marginBottom: '4px',\n position: 'relative',\n color: 'rgb(255, 255, 255)',\n textShadow: 'rgb(0 0 0 / 20%) 0px 1px 0px',\n borderRadius: '3px',\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n background: 'linear-gradient(90deg, rgb(224, 47, 68), rgb(224, 47, 68))'\n}\n\nconst messageStyles = {\n marginLeft: 10\n}\n","import { PanelPlugin } from '@grafana/data';\nimport { SankeyOptions } from './types';\nimport { SankeyPanel } from './SankeyPanel';\n\nexport const plugin = new PanelPlugin(SankeyPanel).setPanelOptions((builder) => {\n return builder\n .addSelect({\n path: 'align',\n name: 'Align',\n defaultValue: 'Justify',\n settings: {\n options: [\n {\n value: 'Justify',\n label: 'Justify',\n },\n {\n value: 'Left',\n label: 'Left',\n },\n {\n value: 'Right',\n label: 'Right',\n },\n {\n value: 'Center',\n label: 'Center',\n },\n ],\n },\n })\n .addTextInput({\n path: 'colorArray',\n name: 'Color Object',\n defaultValue: '',\n })\n .addSelect({\n path: 'colorScheme',\n name: 'Color',\n defaultValue: 'Tableau10',\n settings: {\n options: [\n {\n value: 'Tableau10',\n label: 'Tableau10',\n },\n {\n value: 'Category10',\n label: 'Category10',\n },\n {\n value: 'Accent',\n label: 'Accent',\n },\n {\n value: 'Dark2',\n label: 'Dark2',\n },\n {\n value: 'Paired',\n label: 'Paired',\n },\n {\n value: 'Pastel1',\n label: 'Pastel1',\n },\n {\n value: 'Pastel2',\n label: 'Pastel2',\n },\n {\n value: 'Set1',\n label: 'Set1',\n },\n {\n value: 'Set2',\n label: 'Set2',\n },\n {\n value: 'Set3',\n label: 'Set3',\n },\n ],\n },\n })\n .addSelect({\n path: 'edgeColor',\n name: 'Edge Color',\n defaultValue: 'path',\n settings: {\n options: [\n {\n value: 'path',\n label: 'input-output',\n },\n {\n value: 'input',\n label: 'input',\n },\n {\n value: 'output',\n label: 'output',\n },\n {\n value: 'none',\n label: 'none',\n },\n ],\n },\n })\n .addSelect({\n path: 'displayValues',\n name: 'Display Values',\n defaultValue: 'none',\n settings: {\n options: [\n {\n value: 'total',\n label: 'Totals',\n },\n {\n value: 'percentage',\n label: 'Percentages',\n },\n {\n value: 'both',\n label: 'Both',\n },\n {\n value: 'none',\n label: 'None',\n },\n ],\n },\n })\n .addBooleanSwitch({\n path: 'highlightOnHover',\n name: 'Highlight connections on node hover',\n defaultValue: false,\n });\n});\n","// @ts-nocheck\nimport React, { useState, useEffect } from 'react';\nimport * as d3 from 'd3';\nimport { PanelProps } from '@grafana/data';\nimport { SankeyOptions } from 'types';\nimport { Sankey } from 'Sankey'\nimport { ErrorMessage } from 'Error'\n\ninterface Props extends PanelProps {}\n\nexport const SankeyPanel: React.FC = ({ options, data, width, height }) => {\n // ------------------------ CHART CONSTANTS -----------------------\n const CHART_REQUIRED_FIELDS = { source: 'source', target: 'target', value: 'value' };\n\n // ------------------------ ERROR MESSAGES ------------------------\n const requiredFieldsMsg = `Required fields not present: ${Object.keys(CHART_REQUIRED_FIELDS).join(', ')}`;\n const fieldTypeMsg = `Fields should have the following types: source (string), target (string), value (numeric)`;\n\n // ------------------------- REACT HOOKS --------------------------\n const [ error, setError ] = useState({ isError: false, message: '' })\n const [ graph, setGraph ] = useState({ nodes: [], links: [] })\n\n useEffect(() => {\n data.error\n ?\n setError({isError: true, message: data.error.message})\n :\n setGraph(buildGraph())\n }, [data])\n\n // ------------------------- DATA ACQUISITION -------------------------\n const validate = (sources, targets, values) => {\n let isValid = true;\n\n // REQUIRED FIELDS\n if (!(sources && targets && values)) {\n setError({ isError: true, message: requiredFieldsMsg })\n return isValid = false;\n }\n\n // FIELD TYPES\n const sourcesString = sources.every(d => typeof d === 'string')\n const targetsString = targets.every(d => typeof d === 'string')\n const valuesNumeric = values.every(d => typeof d === 'number')\n\n if (!(sourcesString && targetsString && valuesNumeric)) {\n setError({ isError: true, message: fieldTypeMsg })\n return isValid = false;\n }\n\n setError({});\n\n return isValid;\n }\n\n const buildGraph = () => {\n const frame = data.series[0];\n\n const sourceAccesor = frame.fields.find(field => field.name === CHART_REQUIRED_FIELDS.source);\n const targetAccesor = frame.fields.find(field => field.name === CHART_REQUIRED_FIELDS.target);\n const valueAccesor = frame.fields.find(field => field.name === CHART_REQUIRED_FIELDS.value);\n\n const sources = sourceAccesor?.values.toArray();\n const targets = targetAccesor?.values.toArray();\n const values = valueAccesor?.values.toArray();\n\n const isValid = validate(sources, targets, values);\n if (!isValid) {return}\n \n const zip = d3.zip(sources, targets, values);\n \n const nodes = Array.from(new Set(sources.concat(targets))).map(node => ({ name: node }));\n const links = zip.map(d => ({ source: d[0], target: d[1], value: +d[2].toFixed(2) }));\n const graph = { nodes, links };\n\n return graph\n }\n\n // ------------------------------- CHART ------------------------------\n const chart = svg => {\n const sankey = new Sankey(svg)\n .width(width)\n .height(height)\n .align(options.align)\n .edgeColor(options.edgeColor)\n .colorScheme(options.colorScheme)\n .displayValues(options.displayValues)\n .highlightOnHover(options.highlightOnHover)\n .colorArray(options.colorArray)\n .data(graph)\n\n try {\n sankey.render();\n } catch (renderError) {\n setError({isError: true, message: renderError.message})\n }\n };\n\n return (error.isError ?\n \n :\n {\n d3.select(node)\n .selectAll('*')\n .remove();\n d3.select(node).call(chart);\n }}\n />\n );\n};\n"],"sourceRoot":""} \ No newline at end of file diff --git a/public/app/plugins/panel/sankey-panel-0.5.0/plugin.json b/public/app/plugins/panel/sankey-panel-0.5.0/plugin.json new file mode 100644 index 000000000000..7b7b120500b3 --- /dev/null +++ b/public/app/plugins/panel/sankey-panel-0.5.0/plugin.json @@ -0,0 +1,34 @@ +{ + "type": "panel", + "name": "sankey-panel", + "id": "ismael-sankey-panel", + "info": { + "description": "Sankey chart panel for grafana using d3", + "author": { + "name": "Ismael", + "url": "" + }, + "keywords": ["sankey", "d3", "grafana", "panel"], + "logos": { + "small": "img/logo.svg", + "large": "img/logo.svg" + }, + "links": [ + { + "name": "Website", + "url": "https://github.com/grafana/simple-react-panel" + }, + { + "name": "License", + "url": "https://github.com/grafana/simple-react-panel/blob/master/LICENSE" + } + ], + "screenshots": [], + "version": "1.0.0", + "updated": "2022-12-16" + }, + "dependencies": { + "grafanaVersion": "7.0.x", + "plugins": [] + } +}