n8n-editor-ui 1.63.2 → 1.64.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/assets/{AnnotationTagsDropdown.ee-BrHzX0gM.js → AnnotationTagsDropdown.ee.vue_vue_type_script_setup_true_lang-DZsUO41i.js} +2 -3
  2. package/dist/assets/{AuthView-DBTpAWBR.js → AuthView-CCyCGmwi.js} +3 -6
  3. package/dist/assets/{AuthView-BnHKMYu_.css → AuthView-Cnr31xHM.css} +6 -5
  4. package/dist/assets/{CanvasControls-DJjSv7Wo.js → CanvasControls-Bh28om35.js} +1 -31
  5. package/dist/assets/{ChangePasswordView-4HfufusV.js → ChangePasswordView-CzOXz1B5.js} +2 -32
  6. package/dist/assets/CollectionParameter--dDx2Uul.js +4 -0
  7. package/dist/assets/{CredentialsView-ChVc0kqb.js → CredentialsView-Uwkj-6Gn.js} +5 -35
  8. package/dist/assets/{ErrorView-C3MNpu-h.js → ErrorView-Du8F4roT.js} +1 -31
  9. package/dist/assets/{ExecutionsFilter-C71cMIbt.js → ExecutionsFilter-X5OsOzg1.js} +2 -5
  10. package/dist/assets/{ExecutionsView-CyfD2AaP.js → ExecutionsView-Cdl2wX8O.js} +18 -54
  11. package/dist/assets/{file-saver-Dbfm4l4I.js → FileSaver.min-BZDLz63C.js} +5 -12
  12. package/dist/assets/{FixedCollectionParameter-DjS7zdm4.js → FixedCollectionParameter-h3uHE3EI.js} +1 -32
  13. package/dist/assets/{ForgotMyPasswordView-BThu5AzW.js → ForgotMyPasswordView-DKha33bM.js} +2 -32
  14. package/dist/assets/{MainHeader-BonioYN5.js → MainHeader-Dp0CMpLa.js} +8 -47
  15. package/dist/assets/{MainSidebar-NOlas3VF.js → MainSidebar-DX7RWqIJ.js} +5 -44
  16. package/dist/assets/{NodeCreation-ByUlHR8c.js → NodeCreation-CH8QZkmg.js} +4 -7
  17. package/dist/assets/{NodeCreator-DE9FRbnS.js → NodeCreator-GlBp8VyB.js} +20 -64
  18. package/dist/assets/{NodeViewSwitcher-BMWd0Gm9.css → NodeViewSwitcher-0LWuIntY.css} +136 -135
  19. package/dist/assets/{NodeViewSwitcher-D7fdLnF1.js → NodeViewSwitcher-B6pXHQpy.js} +17208 -4340
  20. package/dist/assets/{ProjectCardBadge-f4baniz3.js → ProjectCardBadge.vue_vue_type_script_setup_true_lang-R4VvIcND.js} +1 -12
  21. package/dist/assets/{ProjectSettings-CeJUMGSQ.js → ProjectSettings-BRbDO1Gw.js} +6 -38
  22. package/dist/assets/{ProjectTabs-dq7a740r.js → ProjectTabs-DGe3p6nk.js} +1 -3
  23. package/dist/assets/{PushConnectionTracker-Bs_UzKPJ.js → PushConnectionTracker-CYr4h_PG.js} +1 -4
  24. package/dist/assets/{ResourcesListLayout-B1XBsMRy.js → ResourcesListLayout-Cp1vFuQD.js} +2 -7
  25. package/dist/assets/{RunDataAi-DdGO06st.js → RunDataAi-Dr6ypWYk.js} +51 -13
  26. package/dist/assets/{RunDataJson-DTKvzLZz.js → RunDataJson-BR2zl0xs.js} +11 -34
  27. package/dist/assets/{jsonpath--XXuA3UN.js → RunDataJsonActions-hnNDgPdr.js} +272 -73
  28. package/dist/assets/{RunDataSearch-CW0connN.js → RunDataSearch-aEp6SsT6.js} +1 -31
  29. package/dist/assets/{RunDataTable-C-mEq2dD.js → RunDataTable-CNdHnjmM.js} +43 -70
  30. package/dist/assets/{SamlOnboarding-BfsNvcA1.js → SamlOnboarding-BGSor93S.js} +2 -32
  31. package/dist/assets/{SettingsApiView--aIfdlDF.js → SettingsApiView-DnaOHGOU.js} +11 -42
  32. package/dist/assets/{SettingsCommunityNodesView-DdyT-sgu.js → SettingsCommunityNodesView-DG_uJUfX.js} +3 -35
  33. package/dist/assets/{SettingsExternalSecrets-DTMX68vp.js → SettingsExternalSecrets-CC-c2C10.js} +2 -32
  34. package/dist/assets/SettingsFakeDoorView-DJJ9xpvu.js +44 -0
  35. package/dist/assets/{humanize-duration-DdvB4QXM.js → SettingsLdapView-BTxklMe-.js} +827 -12
  36. package/dist/assets/{SettingsLogStreamingView-lQvw760T.js → SettingsLogStreamingView-D32eR0j1.js} +1 -31
  37. package/dist/assets/{SettingsPersonalView-2vlxeSgj.js → SettingsPersonalView-CycnGnFd.js} +1 -31
  38. package/dist/assets/{SettingsSourceControl-1Z-AF1Yv.js → SettingsSourceControl-CpzwZEYt.js} +4 -35
  39. package/dist/assets/{SettingsSso-Bp82V4Mw.js → SettingsSso-HjdnsVOf.js} +1 -31
  40. package/dist/assets/{SettingsUsageAndPlan-CDXY25ax.js → SettingsUsageAndPlan-CYQUE0tK.js} +1 -32
  41. package/dist/assets/{SettingsUsersView-3sIYeb4A.js → SettingsUsersView-DkzKTkeO.js} +1 -31
  42. package/dist/assets/{SettingsView-BNNArsIx.js → SettingsView-DVcUKSKE.js} +25 -34
  43. package/dist/assets/{SetupView-pspJi2at.js → SetupView-RG_ylo8Z.js} +2 -32
  44. package/dist/assets/{SetupWorkflowCredentialsButton-SC5-MI0D.js → SetupWorkflowCredentialsButton-DrA_a2OJ.js} +1 -31
  45. package/dist/assets/{SetupWorkflowFromTemplateView-CU3grpvN.js → SetupWorkflowFromTemplateView-DDIIQT4h.js} +3 -33
  46. package/dist/assets/{SigninView-CZdE2LU3.js → SigninView-SB0OrGE8.js} +2 -32
  47. package/dist/assets/SignoutView-CydN5z6L.js +27 -0
  48. package/dist/assets/{SignupView-BPlt_Lbh.js → SignupView-GfwP9_4w.js} +2 -32
  49. package/dist/assets/{TemplateDetails-CdRKYWL6.js → TemplateDetails-BHYTgWe7.js} +1 -4
  50. package/dist/assets/{TemplateList-BYq50eQG.js → TemplateList-DqeiM-sc.js} +1 -3
  51. package/dist/assets/{TemplatesCollectionView-D-N6pD00.js → TemplatesCollectionView-BmNqs_gk.js} +5 -35
  52. package/dist/assets/{TemplatesSearchView-BYNWZYGm.css → TemplatesSearchView-BiokbeYf.css} +94 -1
  53. package/dist/assets/{TemplatesSearchView-CaRL_LUd.js → TemplatesSearchView-CNF6-vdG.js} +738 -41
  54. package/dist/assets/{TemplatesView-C5HnqMFU.js → TemplatesView-2elduxzA.js} +1 -3
  55. package/dist/assets/{TemplatesWorkflowView-XV_mNcau.js → TemplatesWorkflowView-ZW6hOx7N.js} +5 -35
  56. package/dist/assets/{VariablesView-CDacoelY.js → VariablesView-BX27mddL.js} +2 -33
  57. package/dist/assets/{WorkerView-DciBUDzM.js → WorkerView-Cr7HLqrl.js} +159 -43
  58. package/dist/assets/{WorkflowActivator-GHyUbwAO.js → WorkflowActivator-BdyaV7fz.js} +3 -7
  59. package/dist/assets/{WorkflowExecutionsInfoAccordion-Dez7kHwM.js → WorkflowExecutionsInfoAccordion-GC5Xu1TI.js} +1 -3
  60. package/dist/assets/{WorkflowExecutionsLandingPage-j7sS9stL.js → WorkflowExecutionsLandingPage-DUaKxO-Z.js} +2 -32
  61. package/dist/assets/{WorkflowExecutionsPreview-DLogApYK.js → WorkflowExecutionsPreview-1hB0xaBl.js} +10 -42
  62. package/dist/assets/{WorkflowExecutionsView-CZ0E-5CZ.js → WorkflowExecutionsView-OE3NlCHo.js} +6 -37
  63. package/dist/assets/{WorkflowHistory-D6BLJ_QX.js → WorkflowHistory-q9Izoevv.js} +8 -45
  64. package/dist/assets/{WorkflowOnboardingView-7Z0s7yrd.js → WorkflowOnboardingView-B3UpsBmI.js} +1 -31
  65. package/dist/assets/{WorkflowPreview-C2zFAYYi.js → WorkflowPreview-MCXIiPMR.js} +1 -3
  66. package/dist/assets/{WorkflowsView-CLNYtnzv.js → WorkflowsView-BpzSj9Gu.js} +19 -37
  67. package/dist/assets/cloud-C5pqS4q0.js +37 -0
  68. package/dist/assets/{dateFormatter-B-oph3V5.js → dateFormatter-BgjGibAI.js} +1 -1
  69. package/dist/assets/{index-B5Pl_Rdy.css → index-BGyoJ6bM.css} +3941 -8
  70. package/dist/assets/index-TQ22MZub.js +331746 -0
  71. package/dist/assets/{pushConnection.store-C38m0a4q.js → pushConnection.store-DBI9rig9.js} +3 -3
  72. package/dist/assets/{templateActions-BDzt5tYG.js → templateActions-BlnfhXAQ.js} +1 -1
  73. package/dist/assets/{useBeforeUnload-DAuWtScP.js → useBeforeUnload-Db4Xtdlx.js} +1 -2
  74. package/dist/assets/{useExecutionDebugging-DjezN4ny.js → useExecutionDebugging-rQ2a9vrr.js} +1 -2
  75. package/dist/assets/{usePushConnection-C-AngCFB.js → usePushConnection-Bg_ZQZs0.js} +12 -17
  76. package/dist/assets/{useWorkflowActivate-CgGEceEs.js → useWorkflowActivate-DXNYJQNZ.js} +1 -2
  77. package/dist/index.html +2 -33
  78. package/package.json +1 -1
  79. package/vite.config.mts +0 -41
  80. package/dist/assets/@jsplumb/browser-ui-D3WTv2iL.js +0 -5431
  81. package/dist/assets/@jsplumb/common-Cn2WooAp.js +0 -142
  82. package/dist/assets/@jsplumb/connector-bezier-BsoOTqok.js +0 -1019
  83. package/dist/assets/@jsplumb/core-DLCSr9D4.js +0 -7317
  84. package/dist/assets/@jsplumb/util-DggqnqQo.js +0 -936
  85. package/dist/assets/@lezer/common-Bs5t-XhT.js +0 -1988
  86. package/dist/assets/@n8n/api-types-Clq_Leox.js +0 -1
  87. package/dist/assets/@n8n/codemirror-lang-Bizw8G99.js +0 -20928
  88. package/dist/assets/@n8n/codemirror-lang-sql-C9sfSTUi.js +0 -14443
  89. package/dist/assets/@n8n/permissions-BxSXRD9U.js +0 -52
  90. package/dist/assets/@sentry/vue-By9cUXYj.js +0 -23618
  91. package/dist/assets/@vue-flow/background-B1J8rodd.js +0 -123
  92. package/dist/assets/@vue-flow/controls-B4bXJQnK.js +0 -204
  93. package/dist/assets/@vue-flow/core-tETEFGtP.js +0 -9818
  94. package/dist/assets/@vue-flow/minimap-CGW7BbeH.js +0 -2951
  95. package/dist/assets/@vue-flow/node-resizer-C7hxX6Ea.js +0 -1398
  96. package/dist/assets/@vueuse/core-BTO0AmLR.js +0 -8894
  97. package/dist/assets/RunDataJsonActions-0J53luAF.js +0 -270
  98. package/dist/assets/SettingsFakeDoorView-CpouiCJM.js +0 -74
  99. package/dist/assets/SettingsLdapView-DtUi0T-K.js +0 -746
  100. package/dist/assets/SignoutView-DN2qdM5U.js +0 -57
  101. package/dist/assets/aws-secrets-manager-NwVFybsa.svg +0 -18
  102. package/dist/assets/axios-BW6T4tHC.js +0 -2403
  103. package/dist/assets/azure-key-vault-DTTl_IR7.svg +0 -23
  104. package/dist/assets/bowser-CDCHPFWD.js +0 -1931
  105. package/dist/assets/change-case-Dux1iW35.js +0 -137
  106. package/dist/assets/chart.js-BYpPl_l4.js +0 -14318
  107. package/dist/assets/cloud-DJUTi_f-.js +0 -95
  108. package/dist/assets/codemirror-lang-html-n8n-BElKE4vf.js +0 -2498
  109. package/dist/assets/dateformat-BevCJF2z.js +0 -208
  110. package/dist/assets/email-providers-Brdpqw-Z.js +0 -1
  111. package/dist/assets/esprima-next-DUEu30kB.js +0 -6712
  112. package/dist/assets/fast-json-stable-stringify-D9R5x91P.js +0 -55
  113. package/dist/assets/flatted-BLlNkUR-.js +0 -76
  114. package/dist/assets/gcp-secrets-manager-BcK0Zj6Y.svg +0 -9
  115. package/dist/assets/hashicorp-5zlHdJCj.webp +0 -0
  116. package/dist/assets/highlight.js-Brdpqw-Z.js +0 -1
  117. package/dist/assets/index-DOjaKjUd.js +0 -87778
  118. package/dist/assets/infisical-Db7VXgLp.webp +0 -0
  119. package/dist/assets/lodash-es-DCRmYdQ5.js +0 -6061
  120. package/dist/assets/luxon-N8mghSWH.js +0 -6159
  121. package/dist/assets/n8n-C6KBCWah.css +0 -4973
  122. package/dist/assets/n8n-o-6nV4eX.js +0 -163925
  123. package/dist/assets/pinia-BWzoPyXU.js +0 -1650
  124. package/dist/assets/prettier-eWLVZldr.js +0 -2294
  125. package/dist/assets/qrcode.vue-BavVPFUM.js +0 -1132
  126. package/dist/assets/timeago.js-CgQus8nl.js +0 -116
  127. package/dist/assets/useUserHelpers-nsswfS_i.js +0 -27
  128. package/dist/assets/uuid-DRDfXVM2.js +0 -542
  129. package/dist/assets/v3-infinite-loading-CHlSsXAy.js +0 -114
  130. package/dist/assets/vendor-D8YCjNHu.js +0 -14463
  131. package/dist/assets/vue-agile-B2NGbzqY.css +0 -93
  132. package/dist/assets/vue-agile-Busf3nxn.js +0 -727
  133. package/dist/assets/vue-chartjs-DBNEiLG-.js +0 -203
  134. package/dist/assets/vue-i18n-CeifA_Nk.js +0 -5329
  135. package/dist/assets/vue-json-pretty-DHS8nWi_.js +0 -340
  136. package/dist/assets/vue3-touch-events-DVOgU3fI.js +0 -301
  137. package/dist/assets/xss-Brdpqw-Z.js +0 -1
@@ -1,1019 +0,0 @@
1
- import { e as extend, l as log, t as sgn } from "./util-DggqnqQo.js";
2
- import { V as ArcSegment, W as AbstractConnector, X as Connectors } from "./core-DLCSr9D4.js";
3
- import { A as AbstractSegment } from "./common-Cn2WooAp.js";
4
- function _classCallCheck(instance, Constructor) {
5
- if (!(instance instanceof Constructor)) {
6
- throw new TypeError("Cannot call a class as a function");
7
- }
8
- }
9
- function _defineProperties(target, props) {
10
- for (var i = 0; i < props.length; i++) {
11
- var descriptor = props[i];
12
- descriptor.enumerable = descriptor.enumerable || false;
13
- descriptor.configurable = true;
14
- if ("value" in descriptor) descriptor.writable = true;
15
- Object.defineProperty(target, descriptor.key, descriptor);
16
- }
17
- }
18
- function _createClass(Constructor, protoProps, staticProps) {
19
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
20
- if (staticProps) _defineProperties(Constructor, staticProps);
21
- return Constructor;
22
- }
23
- function _defineProperty(obj, key, value) {
24
- if (key in obj) {
25
- Object.defineProperty(obj, key, {
26
- value,
27
- enumerable: true,
28
- configurable: true,
29
- writable: true
30
- });
31
- } else {
32
- obj[key] = value;
33
- }
34
- return obj;
35
- }
36
- function _inherits(subClass, superClass) {
37
- if (typeof superClass !== "function" && superClass !== null) {
38
- throw new TypeError("Super expression must either be null or a function");
39
- }
40
- subClass.prototype = Object.create(superClass && superClass.prototype, {
41
- constructor: {
42
- value: subClass,
43
- writable: true,
44
- configurable: true
45
- }
46
- });
47
- if (superClass) _setPrototypeOf(subClass, superClass);
48
- }
49
- function _getPrototypeOf(o) {
50
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
51
- return o2.__proto__ || Object.getPrototypeOf(o2);
52
- };
53
- return _getPrototypeOf(o);
54
- }
55
- function _setPrototypeOf(o, p) {
56
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
57
- o2.__proto__ = p2;
58
- return o2;
59
- };
60
- return _setPrototypeOf(o, p);
61
- }
62
- function _isNativeReflectConstruct() {
63
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
64
- if (Reflect.construct.sham) return false;
65
- if (typeof Proxy === "function") return true;
66
- try {
67
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
68
- }));
69
- return true;
70
- } catch (e) {
71
- return false;
72
- }
73
- }
74
- function _assertThisInitialized(self) {
75
- if (self === void 0) {
76
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
77
- }
78
- return self;
79
- }
80
- function _possibleConstructorReturn(self, call) {
81
- if (call && (typeof call === "object" || typeof call === "function")) {
82
- return call;
83
- }
84
- return _assertThisInitialized(self);
85
- }
86
- function _createSuper(Derived) {
87
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
88
- return function _createSuperInternal() {
89
- var Super = _getPrototypeOf(Derived), result;
90
- if (hasNativeReflectConstruct) {
91
- var NewTarget = _getPrototypeOf(this).constructor;
92
- result = Reflect.construct(Super, arguments, NewTarget);
93
- } else {
94
- result = Super.apply(this, arguments);
95
- }
96
- return _possibleConstructorReturn(this, result);
97
- };
98
- }
99
- var AbstractBezierConnector = function(_AbstractConnector) {
100
- _inherits(AbstractBezierConnector2, _AbstractConnector);
101
- var _super = _createSuper(AbstractBezierConnector2);
102
- function AbstractBezierConnector2(connection, params) {
103
- var _this;
104
- _classCallCheck(this, AbstractBezierConnector2);
105
- _this = _super.call(this, connection, params);
106
- _this.connection = connection;
107
- _defineProperty(_assertThisInitialized(_this), "showLoopback", void 0);
108
- _defineProperty(_assertThisInitialized(_this), "curviness", void 0);
109
- _defineProperty(_assertThisInitialized(_this), "margin", void 0);
110
- _defineProperty(_assertThisInitialized(_this), "proximityLimit", void 0);
111
- _defineProperty(_assertThisInitialized(_this), "orientation", void 0);
112
- _defineProperty(_assertThisInitialized(_this), "loopbackRadius", void 0);
113
- _defineProperty(_assertThisInitialized(_this), "clockwise", void 0);
114
- _defineProperty(_assertThisInitialized(_this), "isLoopbackCurrently", void 0);
115
- _defineProperty(_assertThisInitialized(_this), "geometry", null);
116
- params = params || {};
117
- _this.showLoopback = params.showLoopback !== false;
118
- _this.curviness = params.curviness || 10;
119
- _this.margin = params.margin || 5;
120
- _this.proximityLimit = params.proximityLimit || 80;
121
- _this.clockwise = params.orientation && params.orientation === "clockwise";
122
- _this.loopbackRadius = params.loopbackRadius || 25;
123
- _this.isLoopbackCurrently = false;
124
- return _this;
125
- }
126
- _createClass(AbstractBezierConnector2, [{
127
- key: "getDefaultStubs",
128
- value: function getDefaultStubs() {
129
- return [0, 0];
130
- }
131
- }, {
132
- key: "_compute",
133
- value: function _compute(paintInfo, p) {
134
- var sp = p.sourcePos, tp = p.targetPos, _w = Math.abs(sp.curX - tp.curX), _h = Math.abs(sp.curY - tp.curY);
135
- if (!this.showLoopback || p.sourceEndpoint.elementId !== p.targetEndpoint.elementId) {
136
- this.isLoopbackCurrently = false;
137
- this._computeBezier(paintInfo, p, sp, tp, _w, _h);
138
- } else {
139
- this.isLoopbackCurrently = true;
140
- var x1 = p.sourcePos.curX, y1 = p.sourcePos.curY - this.margin, cx = x1, cy = y1 - this.loopbackRadius, _x = cx - this.loopbackRadius, _y = cy - this.loopbackRadius;
141
- _w = 2 * this.loopbackRadius;
142
- _h = 2 * this.loopbackRadius;
143
- paintInfo.points[0] = _x;
144
- paintInfo.points[1] = _y;
145
- paintInfo.points[2] = _w;
146
- paintInfo.points[3] = _h;
147
- this._addSegment(ArcSegment, {
148
- loopback: true,
149
- x1: x1 - _x + 4,
150
- y1: y1 - _y,
151
- startAngle: 0,
152
- endAngle: 2 * Math.PI,
153
- r: this.loopbackRadius,
154
- ac: !this.clockwise,
155
- x2: x1 - _x - 4,
156
- y2: y1 - _y,
157
- cx: cx - _x,
158
- cy: cy - _y
159
- });
160
- }
161
- }
162
- }, {
163
- key: "exportGeometry",
164
- value: function exportGeometry() {
165
- if (this.geometry == null) {
166
- return null;
167
- } else {
168
- return {
169
- controlPoints: [extend({}, this.geometry.controlPoints[0]), extend({}, this.geometry.controlPoints[1])],
170
- source: extend({}, this.geometry.source),
171
- target: extend({}, this.geometry.target)
172
- };
173
- }
174
- }
175
- }, {
176
- key: "transformGeometry",
177
- value: function transformGeometry(g, dx, dy) {
178
- return {
179
- controlPoints: [{
180
- x: g.controlPoints[0].x + dx,
181
- y: g.controlPoints[0].y + dy
182
- }, {
183
- x: g.controlPoints[1].x + dx,
184
- y: g.controlPoints[1].y + dy
185
- }],
186
- source: this.transformAnchorPlacement(g.source, dx, dy),
187
- target: this.transformAnchorPlacement(g.target, dx, dy)
188
- };
189
- }
190
- }, {
191
- key: "importGeometry",
192
- value: function importGeometry(geometry) {
193
- if (geometry != null) {
194
- if (geometry.controlPoints == null || geometry.controlPoints.length != 2) {
195
- log("jsPlumb Bezier: cannot import geometry; controlPoints missing or does not have length 2");
196
- this.setGeometry(null, true);
197
- return false;
198
- }
199
- if (geometry.controlPoints[0].x == null || geometry.controlPoints[0].y == null || geometry.controlPoints[1].x == null || geometry.controlPoints[1].y == null) {
200
- log("jsPlumb Bezier: cannot import geometry; controlPoints malformed");
201
- this.setGeometry(null, true);
202
- return false;
203
- }
204
- if (geometry.source == null || geometry.source.curX == null || geometry.source.curY == null) {
205
- log("jsPlumb Bezier: cannot import geometry; source missing or malformed");
206
- this.setGeometry(null, true);
207
- return false;
208
- }
209
- if (geometry.target == null || geometry.target.curX == null || geometry.target.curY == null) {
210
- log("jsPlumb Bezier: cannot import geometry; target missing or malformed");
211
- this.setGeometry(null, true);
212
- return false;
213
- }
214
- this.setGeometry(geometry, false);
215
- return true;
216
- } else {
217
- return false;
218
- }
219
- }
220
- }]);
221
- return AbstractBezierConnector2;
222
- }(AbstractConnector);
223
- var Vectors = {
224
- subtract: function subtract(v1, v2) {
225
- return {
226
- x: v1.x - v2.x,
227
- y: v1.y - v2.y
228
- };
229
- },
230
- dotProduct: function dotProduct(v1, v2) {
231
- return v1.x * v2.x + v1.y * v2.y;
232
- },
233
- square: function square(v) {
234
- return Math.sqrt(v.x * v.x + v.y * v.y);
235
- },
236
- scale: function scale(v, s) {
237
- return {
238
- x: v.x * s,
239
- y: v.y * s
240
- };
241
- }
242
- };
243
- var maxRecursion = 64;
244
- var flatnessTolerance = Math.pow(2, -maxRecursion - 1);
245
- function distanceFromCurve(point, curve) {
246
- var candidates = [], w = _convertToBezier(point, curve), degree = curve.length - 1, higherDegree = 2 * degree - 1, numSolutions = _findRoots(w, higherDegree, candidates, 0), v = Vectors.subtract(point, curve[0]), dist2 = Vectors.square(v), t = 0, newDist;
247
- for (var i = 0; i < numSolutions; i++) {
248
- v = Vectors.subtract(point, _bezier(curve, degree, candidates[i], null, null));
249
- newDist = Vectors.square(v);
250
- if (newDist < dist2) {
251
- dist2 = newDist;
252
- t = candidates[i];
253
- }
254
- }
255
- v = Vectors.subtract(point, curve[degree]);
256
- newDist = Vectors.square(v);
257
- if (newDist < dist2) {
258
- dist2 = newDist;
259
- t = 1;
260
- }
261
- return {
262
- location: t,
263
- distance: dist2
264
- };
265
- }
266
- function nearestPointOnCurve(point, curve) {
267
- var td = distanceFromCurve(point, curve);
268
- return {
269
- point: _bezier(curve, curve.length - 1, td.location, null, null),
270
- location: td.location
271
- };
272
- }
273
- function _convertToBezier(point, curve) {
274
- var degree = curve.length - 1, higherDegree = 2 * degree - 1, c = [], d = [], cdTable = [], w = [], z = [[1, 0.6, 0.3, 0.1], [0.4, 0.6, 0.6, 0.4], [0.1, 0.3, 0.6, 1]];
275
- for (var i = 0; i <= degree; i++) {
276
- c[i] = Vectors.subtract(curve[i], point);
277
- }
278
- for (var _i = 0; _i <= degree - 1; _i++) {
279
- d[_i] = Vectors.subtract(curve[_i + 1], curve[_i]);
280
- d[_i] = Vectors.scale(d[_i], 3);
281
- }
282
- for (var row = 0; row <= degree - 1; row++) {
283
- for (var column = 0; column <= degree; column++) {
284
- if (!cdTable[row]) cdTable[row] = [];
285
- cdTable[row][column] = Vectors.dotProduct(d[row], c[column]);
286
- }
287
- }
288
- for (var _i2 = 0; _i2 <= higherDegree; _i2++) {
289
- if (!w[_i2]) {
290
- w[_i2] = [];
291
- }
292
- w[_i2].y = 0;
293
- w[_i2].x = parseFloat("" + _i2) / higherDegree;
294
- }
295
- var n = degree, m = degree - 1;
296
- for (var k = 0; k <= n + m; k++) {
297
- var lb = Math.max(0, k - m), ub = Math.min(k, n);
298
- for (var _i3 = lb; _i3 <= ub; _i3++) {
299
- var j = k - _i3;
300
- w[_i3 + j].y += cdTable[j][_i3] * z[j][_i3];
301
- }
302
- }
303
- return w;
304
- }
305
- function _findRoots(w, degree, t, depth) {
306
- var left = [], right = [], left_count, right_count, left_t = [], right_t = [];
307
- switch (_getCrossingCount(w, degree)) {
308
- case 0: {
309
- return 0;
310
- }
311
- case 1: {
312
- if (depth >= maxRecursion) {
313
- t[0] = (w[0].x + w[degree].x) / 2;
314
- return 1;
315
- }
316
- if (_isFlatEnough(w, degree)) {
317
- t[0] = _computeXIntercept(w, degree);
318
- return 1;
319
- }
320
- break;
321
- }
322
- }
323
- _bezier(w, degree, 0.5, left, right);
324
- left_count = _findRoots(left, degree, left_t, depth + 1);
325
- right_count = _findRoots(right, degree, right_t, depth + 1);
326
- for (var i = 0; i < left_count; i++) {
327
- t[i] = left_t[i];
328
- }
329
- for (var _i4 = 0; _i4 < right_count; _i4++) {
330
- t[_i4 + left_count] = right_t[_i4];
331
- }
332
- return left_count + right_count;
333
- }
334
- function _getCrossingCount(curve, degree) {
335
- var n_crossings = 0, sign, old_sign;
336
- sign = old_sign = sgn(curve[0].y);
337
- for (var i = 1; i <= degree; i++) {
338
- sign = sgn(curve[i].y);
339
- if (sign != old_sign) n_crossings++;
340
- old_sign = sign;
341
- }
342
- return n_crossings;
343
- }
344
- function _isFlatEnough(curve, degree) {
345
- var error, intercept_1, intercept_2, left_intercept, right_intercept, a, b, c, det, dInv, a1, b1, c1, a2, b2, c2;
346
- a = curve[0].y - curve[degree].y;
347
- b = curve[degree].x - curve[0].x;
348
- c = curve[0].x * curve[degree].y - curve[degree].x * curve[0].y;
349
- var max_distance_above, max_distance_below;
350
- max_distance_above = max_distance_below = 0;
351
- for (var i = 1; i < degree; i++) {
352
- var value = a * curve[i].x + b * curve[i].y + c;
353
- if (value > max_distance_above) {
354
- max_distance_above = value;
355
- } else if (value < max_distance_below) {
356
- max_distance_below = value;
357
- }
358
- }
359
- a1 = 0;
360
- b1 = 1;
361
- c1 = 0;
362
- a2 = a;
363
- b2 = b;
364
- c2 = c - max_distance_above;
365
- det = a1 * b2 - a2 * b1;
366
- dInv = 1 / det;
367
- intercept_1 = (b1 * c2 - b2 * c1) * dInv;
368
- a2 = a;
369
- b2 = b;
370
- c2 = c - max_distance_below;
371
- det = a1 * b2 - a2 * b1;
372
- dInv = 1 / det;
373
- intercept_2 = (b1 * c2 - b2 * c1) * dInv;
374
- left_intercept = Math.min(intercept_1, intercept_2);
375
- right_intercept = Math.max(intercept_1, intercept_2);
376
- error = right_intercept - left_intercept;
377
- return error < flatnessTolerance ? 1 : 0;
378
- }
379
- function _computeXIntercept(curve, degree) {
380
- var XLK = 1, YLK = 0, XNM = curve[degree].x - curve[0].x, YNM = curve[degree].y - curve[0].y, XMK = curve[0].x - 0, YMK = curve[0].y - 0, det = XNM * YLK - YNM * XLK, detInv = 1 / det, S = (XNM * YMK - YNM * XMK) * detInv;
381
- return 0 + XLK * S;
382
- }
383
- function _bezier(curve, degree, t, left, right) {
384
- var temp = [[]];
385
- for (var j = 0; j <= degree; j++) {
386
- temp[0][j] = curve[j];
387
- }
388
- for (var i = 1; i <= degree; i++) {
389
- for (var _j = 0; _j <= degree - i; _j++) {
390
- if (!temp[i]) temp[i] = [];
391
- if (!temp[i][_j]) temp[i][_j] = {};
392
- temp[i][_j].x = (1 - t) * temp[i - 1][_j].x + t * temp[i - 1][_j + 1].x;
393
- temp[i][_j].y = (1 - t) * temp[i - 1][_j].y + t * temp[i - 1][_j + 1].y;
394
- }
395
- }
396
- if (left != null) {
397
- for (var _j2 = 0; _j2 <= degree; _j2++) {
398
- left[_j2] = temp[_j2][0];
399
- }
400
- }
401
- if (right != null) {
402
- for (var _j3 = 0; _j3 <= degree; _j3++) {
403
- right[_j3] = temp[degree - _j3][_j3];
404
- }
405
- }
406
- return temp[degree][0];
407
- }
408
- function _getLUT(steps, curve) {
409
- var out = [];
410
- steps--;
411
- for (var n = 0; n <= steps; n++) {
412
- out.push(_computeLookup(n / steps, curve));
413
- }
414
- return out;
415
- }
416
- function _computeLookup(e, curve) {
417
- var EMPTY_POINT = {
418
- x: 0,
419
- y: 0
420
- };
421
- if (e === 0) {
422
- return curve[0];
423
- }
424
- var degree = curve.length - 1;
425
- if (e === 1) {
426
- return curve[degree];
427
- }
428
- var o = curve;
429
- var s = 1 - e;
430
- if (degree === 0) {
431
- return curve[0];
432
- }
433
- if (degree === 1) {
434
- return {
435
- x: s * o[0].x + e * o[1].x,
436
- y: s * o[0].y + e * o[1].y
437
- };
438
- }
439
- if (4 > degree) {
440
- var l = s * s, h = e * e, u = 0, m, g, f;
441
- if (degree === 2) {
442
- o = [o[0], o[1], o[2], EMPTY_POINT];
443
- m = l;
444
- g = 2 * (s * e);
445
- f = h;
446
- } else if (degree === 3) {
447
- m = l * s;
448
- g = 3 * (l * e);
449
- f = 3 * (s * h);
450
- u = e * h;
451
- }
452
- return {
453
- x: m * o[0].x + g * o[1].x + f * o[2].x + u * o[3].x,
454
- y: m * o[0].y + g * o[1].y + f * o[2].y + u * o[3].y
455
- };
456
- } else {
457
- return EMPTY_POINT;
458
- }
459
- }
460
- function computeBezierLength(curve) {
461
- var length = 0;
462
- if (!isPoint(curve)) {
463
- var steps = 16;
464
- var lut = _getLUT(steps, curve);
465
- for (var i = 0; i < steps - 1; i++) {
466
- var a = lut[i], b = lut[i + 1];
467
- length += dist(a, b);
468
- }
469
- }
470
- return length;
471
- }
472
- var _curveFunctionCache = /* @__PURE__ */ new Map();
473
- function _getCurveFunctions(order) {
474
- var fns = _curveFunctionCache.get(order);
475
- if (!fns) {
476
- fns = [];
477
- var f_term = function f_term2() {
478
- return function(t) {
479
- return Math.pow(t, order);
480
- };
481
- }, l_term = function l_term2() {
482
- return function(t) {
483
- return Math.pow(1 - t, order);
484
- };
485
- }, c_term = function c_term2(c) {
486
- return function(t) {
487
- return c;
488
- };
489
- }, t_term = function t_term2() {
490
- return function(t) {
491
- return t;
492
- };
493
- }, one_minus_t_term = function one_minus_t_term2() {
494
- return function(t) {
495
- return 1 - t;
496
- };
497
- }, _termFunc = function _termFunc2(terms2) {
498
- return function(t) {
499
- var p = 1;
500
- for (var i2 = 0; i2 < terms2.length; i2++) {
501
- p = p * terms2[i2](t);
502
- }
503
- return p;
504
- };
505
- };
506
- fns.push(f_term());
507
- for (var i = 1; i < order; i++) {
508
- var terms = [c_term(order)];
509
- for (var j = 0; j < order - i; j++) {
510
- terms.push(t_term());
511
- }
512
- for (var _j4 = 0; _j4 < i; _j4++) {
513
- terms.push(one_minus_t_term());
514
- }
515
- fns.push(_termFunc(terms));
516
- }
517
- fns.push(l_term());
518
- _curveFunctionCache.set(order, fns);
519
- }
520
- return fns;
521
- }
522
- function pointOnCurve(curve, location) {
523
- var cc = _getCurveFunctions(curve.length - 1), _x = 0, _y = 0;
524
- for (var i = 0; i < curve.length; i++) {
525
- _x = _x + curve[i].x * cc[i](location);
526
- _y = _y + curve[i].y * cc[i](location);
527
- }
528
- return {
529
- x: _x,
530
- y: _y
531
- };
532
- }
533
- function dist(p1, p2) {
534
- return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
535
- }
536
- function isPoint(curve) {
537
- return curve[0].x === curve[1].x && curve[0].y === curve[1].y;
538
- }
539
- function pointAlongPath(curve, location, distance) {
540
- if (isPoint(curve)) {
541
- return {
542
- point: curve[0],
543
- location
544
- };
545
- }
546
- var prev = pointOnCurve(curve, location), tally = 0, curLoc = location, direction = distance > 0 ? 1 : -1, cur = null;
547
- while (tally < Math.abs(distance)) {
548
- curLoc += 5e-3 * direction;
549
- cur = pointOnCurve(curve, curLoc);
550
- tally += dist(cur, prev);
551
- prev = cur;
552
- }
553
- return {
554
- point: cur,
555
- location: curLoc
556
- };
557
- }
558
- function pointAlongCurveFrom(curve, location, distance) {
559
- return pointAlongPath(curve, location, distance).point;
560
- }
561
- function locationAlongCurveFrom(curve, location, distance) {
562
- return pointAlongPath(curve, location, distance).location;
563
- }
564
- function gradientAtPoint(curve, location) {
565
- var p1 = pointOnCurve(curve, location), p2 = pointOnCurve(curve.slice(0, curve.length - 1), location), dy = p2.y - p1.y, dx = p2.x - p1.x;
566
- return dy === 0 ? Infinity : Math.atan(dy / dx);
567
- }
568
- function gradientAtPointAlongPathFrom(curve, location, distance) {
569
- var p = pointAlongPath(curve, location, distance);
570
- if (p.location > 1) p.location = 1;
571
- if (p.location < 0) p.location = 0;
572
- return gradientAtPoint(curve, p.location);
573
- }
574
- function perpendicularToPathAt(curve, location, length, distance) {
575
- distance = distance == null ? 0 : distance;
576
- var p = pointAlongPath(curve, location, distance), m = gradientAtPoint(curve, p.location), _theta2 = Math.atan(-1 / m), y = length / 2 * Math.sin(_theta2), x = length / 2 * Math.cos(_theta2);
577
- return [{
578
- x: p.point.x + x,
579
- y: p.point.y + y
580
- }, {
581
- x: p.point.x - x,
582
- y: p.point.y - y
583
- }];
584
- }
585
- function bezierLineIntersection(x1, y1, x2, y2, curve) {
586
- var a = y2 - y1, b = x1 - x2, c = x1 * (y1 - y2) + y1 * (x2 - x1), coeffs = _computeCoefficients(curve), p = [a * coeffs[0][0] + b * coeffs[1][0], a * coeffs[0][1] + b * coeffs[1][1], a * coeffs[0][2] + b * coeffs[1][2], a * coeffs[0][3] + b * coeffs[1][3] + c], r = _cubicRoots.apply(null, p), intersections = [];
587
- if (r != null) {
588
- for (var i = 0; i < 3; i++) {
589
- var _t = r[i], t2 = Math.pow(_t, 2), t3 = Math.pow(_t, 3), x = {
590
- x: coeffs[0][0] * t3 + coeffs[0][1] * t2 + coeffs[0][2] * _t + coeffs[0][3],
591
- y: coeffs[1][0] * t3 + coeffs[1][1] * t2 + coeffs[1][2] * _t + coeffs[1][3]
592
- };
593
- var s = void 0;
594
- if (x2 - x1 !== 0) {
595
- s = (x[0] - x1) / (x2 - x1);
596
- } else {
597
- s = (x[1] - y1) / (y2 - y1);
598
- }
599
- if (_t >= 0 && _t <= 1 && s >= 0 && s <= 1) {
600
- intersections.push(x);
601
- }
602
- }
603
- }
604
- return intersections;
605
- }
606
- function boxIntersection(x, y, w, h, curve) {
607
- var i = [];
608
- i.push.apply(i, bezierLineIntersection(x, y, x + w, y, curve));
609
- i.push.apply(i, bezierLineIntersection(x + w, y, x + w, y + h, curve));
610
- i.push.apply(i, bezierLineIntersection(x + w, y + h, x, y + h, curve));
611
- i.push.apply(i, bezierLineIntersection(x, y + h, x, y, curve));
612
- return i;
613
- }
614
- function boundingBoxIntersection(boundingBox, curve) {
615
- var i = [];
616
- i.push.apply(i, bezierLineIntersection(boundingBox.x, boundingBox.y, boundingBox.x + boundingBox.w, boundingBox.y, curve));
617
- i.push.apply(i, bezierLineIntersection(boundingBox.x + boundingBox.w, boundingBox.y, boundingBox.x + boundingBox.w, boundingBox.y + boundingBox.h, curve));
618
- i.push.apply(i, bezierLineIntersection(boundingBox.x + boundingBox.w, boundingBox.y + boundingBox.h, boundingBox.x, boundingBox.y + boundingBox.h, curve));
619
- i.push.apply(i, bezierLineIntersection(boundingBox.x, boundingBox.y + boundingBox.h, boundingBox.x, boundingBox.y, curve));
620
- return i;
621
- }
622
- function _computeCoefficientsForAxis(curve, axis) {
623
- return [-curve[0][axis] + 3 * curve[1][axis] + -3 * curve[2][axis] + curve[3][axis], 3 * curve[0][axis] - 6 * curve[1][axis] + 3 * curve[2][axis], -3 * curve[0][axis] + 3 * curve[1][axis], curve[0][axis]];
624
- }
625
- function _computeCoefficients(curve) {
626
- return [_computeCoefficientsForAxis(curve, "x"), _computeCoefficientsForAxis(curve, "y")];
627
- }
628
- function _cubicRoots(a, b, c, d) {
629
- var A = b / a, B = c / a, C = d / a, Q = (3 * B - Math.pow(A, 2)) / 9, R = (9 * A * B - 27 * C - 2 * Math.pow(A, 3)) / 54, D = Math.pow(Q, 3) + Math.pow(R, 2), S, T, t = [0, 0, 0];
630
- if (D >= 0) {
631
- S = sgn(R + Math.sqrt(D)) * Math.pow(Math.abs(R + Math.sqrt(D)), 1 / 3);
632
- T = sgn(R - Math.sqrt(D)) * Math.pow(Math.abs(R - Math.sqrt(D)), 1 / 3);
633
- t[0] = -A / 3 + (S + T);
634
- t[1] = -A / 3 - (S + T) / 2;
635
- t[2] = -A / 3 - (S + T) / 2;
636
- if (Math.abs(Math.sqrt(3) * (S - T) / 2) !== 0) {
637
- t[1] = -1;
638
- t[2] = -1;
639
- }
640
- } else {
641
- var th = Math.acos(R / Math.sqrt(-Math.pow(Q, 3)));
642
- t[0] = 2 * Math.sqrt(-Q) * Math.cos(th / 3) - A / 3;
643
- t[1] = 2 * Math.sqrt(-Q) * Math.cos((th + 2 * Math.PI) / 3) - A / 3;
644
- t[2] = 2 * Math.sqrt(-Q) * Math.cos((th + 4 * Math.PI) / 3) - A / 3;
645
- }
646
- for (var i = 0; i < 3; i++) {
647
- if (t[i] < 0 || t[i] > 1) {
648
- t[i] = -1;
649
- }
650
- }
651
- return t;
652
- }
653
- var BezierSegment = function(_AbstractSegment) {
654
- _inherits(BezierSegment2, _AbstractSegment);
655
- var _super = _createSuper(BezierSegment2);
656
- function BezierSegment2(params) {
657
- var _this;
658
- _classCallCheck(this, BezierSegment2);
659
- _this = _super.call(this, params);
660
- _defineProperty(_assertThisInitialized(_this), "curve", void 0);
661
- _defineProperty(_assertThisInitialized(_this), "cp1x", void 0);
662
- _defineProperty(_assertThisInitialized(_this), "cp1y", void 0);
663
- _defineProperty(_assertThisInitialized(_this), "cp2x", void 0);
664
- _defineProperty(_assertThisInitialized(_this), "cp2y", void 0);
665
- _defineProperty(_assertThisInitialized(_this), "length", 0);
666
- _defineProperty(_assertThisInitialized(_this), "type", BezierSegment2.segmentType);
667
- _this.cp1x = params.cp1x;
668
- _this.cp1y = params.cp1y;
669
- _this.cp2x = params.cp2x;
670
- _this.cp2y = params.cp2y;
671
- _this.x1 = params.x1;
672
- _this.x2 = params.x2;
673
- _this.y1 = params.y1;
674
- _this.y2 = params.y2;
675
- _this.curve = [{
676
- x: _this.x1,
677
- y: _this.y1
678
- }, {
679
- x: _this.cp1x,
680
- y: _this.cp1y
681
- }, {
682
- x: _this.cp2x,
683
- y: _this.cp2y
684
- }, {
685
- x: _this.x2,
686
- y: _this.y2
687
- }];
688
- _this.extents = {
689
- xmin: Math.min(_this.x1, _this.x2, _this.cp1x, _this.cp2x),
690
- ymin: Math.min(_this.y1, _this.y2, _this.cp1y, _this.cp2y),
691
- xmax: Math.max(_this.x1, _this.x2, _this.cp1x, _this.cp2x),
692
- ymax: Math.max(_this.y1, _this.y2, _this.cp1y, _this.cp2y)
693
- };
694
- return _this;
695
- }
696
- _createClass(BezierSegment2, [{
697
- key: "getPath",
698
- value: function getPath(isFirstSegment) {
699
- return (isFirstSegment ? "M " + this.x2 + " " + this.y2 + " " : "") + "C " + this.cp2x + " " + this.cp2y + " " + this.cp1x + " " + this.cp1y + " " + this.x1 + " " + this.y1;
700
- }
701
- }, {
702
- key: "pointOnPath",
703
- value: function pointOnPath(location, absolute) {
704
- location = BezierSegment2._translateLocation(this.curve, location, absolute);
705
- return pointOnCurve(this.curve, location);
706
- }
707
- }, {
708
- key: "gradientAtPoint",
709
- value: function gradientAtPoint$1(location, absolute) {
710
- location = BezierSegment2._translateLocation(this.curve, location, absolute);
711
- return gradientAtPoint(this.curve, location);
712
- }
713
- }, {
714
- key: "pointAlongPathFrom",
715
- value: function pointAlongPathFrom(location, distance, absolute) {
716
- location = BezierSegment2._translateLocation(this.curve, location, absolute);
717
- return pointAlongCurveFrom(this.curve, location, distance);
718
- }
719
- }, {
720
- key: "getLength",
721
- value: function getLength() {
722
- if (this.length == null || this.length === 0) {
723
- this.length = computeBezierLength(this.curve);
724
- }
725
- return this.length;
726
- }
727
- }, {
728
- key: "findClosestPointOnPath",
729
- value: function findClosestPointOnPath(x, y) {
730
- var p = nearestPointOnCurve({
731
- x,
732
- y
733
- }, this.curve);
734
- return {
735
- d: Math.sqrt(Math.pow(p.point.x - x, 2) + Math.pow(p.point.y - y, 2)),
736
- x: p.point.x,
737
- y: p.point.y,
738
- l: 1 - p.location,
739
- s: this,
740
- x1: null,
741
- y1: null,
742
- x2: null,
743
- y2: null
744
- };
745
- }
746
- }, {
747
- key: "lineIntersection",
748
- value: function lineIntersection(x1, y1, x2, y2) {
749
- return bezierLineIntersection(x1, y1, x2, y2, this.curve);
750
- }
751
- }], [{
752
- key: "_translateLocation",
753
- value: function _translateLocation(_curve, location, absolute) {
754
- if (absolute) {
755
- location = locationAlongCurveFrom(_curve, location > 0 ? 0 : 1, location);
756
- }
757
- return location;
758
- }
759
- }]);
760
- return BezierSegment2;
761
- }(AbstractSegment);
762
- _defineProperty(BezierSegment, "segmentType", "Bezier");
763
- var BezierConnector = function(_AbstractBezierConnec) {
764
- _inherits(BezierConnector2, _AbstractBezierConnec);
765
- var _super = _createSuper(BezierConnector2);
766
- function BezierConnector2(connection, params) {
767
- var _this;
768
- _classCallCheck(this, BezierConnector2);
769
- _this = _super.call(this, connection, params);
770
- _this.connection = connection;
771
- _defineProperty(_assertThisInitialized(_this), "type", BezierConnector2.type);
772
- _defineProperty(_assertThisInitialized(_this), "majorAnchor", void 0);
773
- _defineProperty(_assertThisInitialized(_this), "minorAnchor", void 0);
774
- params = params || {};
775
- _this.majorAnchor = params.curviness || 150;
776
- _this.minorAnchor = 10;
777
- return _this;
778
- }
779
- _createClass(BezierConnector2, [{
780
- key: "getCurviness",
781
- value: function getCurviness() {
782
- return this.majorAnchor;
783
- }
784
- }, {
785
- key: "_findControlPoint",
786
- value: function _findControlPoint2(point, sourceAnchorPosition, targetAnchorPosition, soo, too) {
787
- var perpendicular = soo[0] !== too[0] || soo[1] === too[1], p = {
788
- x: 0,
789
- y: 0
790
- };
791
- if (!perpendicular) {
792
- if (soo[0] === 0) {
793
- p.x = sourceAnchorPosition.curX < targetAnchorPosition.curX ? point.x + this.minorAnchor : point.x - this.minorAnchor;
794
- } else {
795
- p.x = point.x - this.majorAnchor * soo[0];
796
- }
797
- if (soo[1] === 0) {
798
- p.y = sourceAnchorPosition.curY < targetAnchorPosition.curY ? point.y + this.minorAnchor : point.y - this.minorAnchor;
799
- } else {
800
- p.y = point.y + this.majorAnchor * too[1];
801
- }
802
- } else {
803
- if (too[0] === 0) {
804
- p.x = targetAnchorPosition.curX < sourceAnchorPosition.curX ? point.x + this.minorAnchor : point.x - this.minorAnchor;
805
- } else {
806
- p.x = point.x + this.majorAnchor * too[0];
807
- }
808
- if (too[1] === 0) {
809
- p.y = targetAnchorPosition.curY < sourceAnchorPosition.curY ? point.y + this.minorAnchor : point.y - this.minorAnchor;
810
- } else {
811
- p.y = point.y + this.majorAnchor * soo[1];
812
- }
813
- }
814
- return p;
815
- }
816
- }, {
817
- key: "_computeBezier",
818
- value: function _computeBezier(paintInfo, p, sp, tp, _w, _h) {
819
- var _CP, _CP2, _sx = sp.curX < tp.curX ? _w : 0, _sy = sp.curY < tp.curY ? _h : 0, _tx = sp.curX < tp.curX ? 0 : _w, _ty = sp.curY < tp.curY ? 0 : _h;
820
- if (this.edited !== true) {
821
- _CP = this._findControlPoint({
822
- x: _sx,
823
- y: _sy
824
- }, sp, tp, paintInfo.so, paintInfo.to);
825
- _CP2 = this._findControlPoint({
826
- x: _tx,
827
- y: _ty
828
- }, tp, sp, paintInfo.to, paintInfo.so);
829
- } else {
830
- _CP = this.geometry.controlPoints[0];
831
- _CP2 = this.geometry.controlPoints[1];
832
- }
833
- this.geometry = {
834
- controlPoints: [_CP, _CP2],
835
- source: p.sourcePos,
836
- target: p.targetPos
837
- };
838
- this._addSegment(BezierSegment, {
839
- x1: _sx,
840
- y1: _sy,
841
- x2: _tx,
842
- y2: _ty,
843
- cp1x: _CP.x,
844
- cp1y: _CP.y,
845
- cp2x: _CP2.x,
846
- cp2y: _CP2.y
847
- });
848
- }
849
- }]);
850
- return BezierConnector2;
851
- }(AbstractBezierConnector);
852
- _defineProperty(BezierConnector, "type", "Bezier");
853
- function _segment(x1, y1, x2, y2) {
854
- if (x1 <= x2 && y2 <= y1) {
855
- return 1;
856
- } else if (x1 <= x2 && y1 <= y2) {
857
- return 2;
858
- } else if (x2 <= x1 && y2 >= y1) {
859
- return 3;
860
- }
861
- return 4;
862
- }
863
- function _findControlPoint(midx, midy, segment, sourceEdge, targetEdge, dx, dy, distance, proximityLimit) {
864
- if (distance <= proximityLimit) {
865
- return {
866
- x: midx,
867
- y: midy
868
- };
869
- }
870
- if (segment === 1) {
871
- if (sourceEdge.curY <= 0 && targetEdge.curY >= 1) {
872
- return {
873
- x: midx + (sourceEdge.x < 0.5 ? -1 * dx : dx),
874
- y: midy
875
- };
876
- } else if (sourceEdge.curX >= 1 && targetEdge.curX <= 0) {
877
- return {
878
- x: midx,
879
- y: midy + (sourceEdge.y < 0.5 ? -1 * dy : dy)
880
- };
881
- } else {
882
- return {
883
- x: midx + -1 * dx,
884
- y: midy + -1 * dy
885
- };
886
- }
887
- } else if (segment === 2) {
888
- if (sourceEdge.curY >= 1 && targetEdge.curY <= 0) {
889
- return {
890
- x: midx + (sourceEdge.x < 0.5 ? -1 * dx : dx),
891
- y: midy
892
- };
893
- } else if (sourceEdge.curX >= 1 && targetEdge.curX <= 0) {
894
- return {
895
- x: midx,
896
- y: midy + (sourceEdge.y < 0.5 ? -1 * dy : dy)
897
- };
898
- } else {
899
- return {
900
- x: midx + dx,
901
- y: midy + -1 * dy
902
- };
903
- }
904
- } else if (segment === 3) {
905
- if (sourceEdge.curY >= 1 && targetEdge.curY <= 0) {
906
- return {
907
- x: midx + (sourceEdge.x < 0.5 ? -1 * dx : dx),
908
- y: midy
909
- };
910
- } else if (sourceEdge.curX <= 0 && targetEdge.curX >= 1) {
911
- return {
912
- x: midx,
913
- y: midy + (sourceEdge.y < 0.5 ? -1 * dy : dy)
914
- };
915
- } else {
916
- return {
917
- x: midx + -1 * dx,
918
- y: midy + -1 * dy
919
- };
920
- }
921
- } else if (segment === 4) {
922
- if (sourceEdge.curY <= 0 && targetEdge.curY >= 1) {
923
- return {
924
- x: midx + (sourceEdge.x < 0.5 ? -1 * dx : dx),
925
- y: midy
926
- };
927
- } else if (sourceEdge.curX <= 0 && targetEdge.curX >= 1) {
928
- return {
929
- x: midx,
930
- y: midy + (sourceEdge.y < 0.5 ? -1 * dy : dy)
931
- };
932
- } else {
933
- return {
934
- x: midx + dx,
935
- y: midy + -1 * dy
936
- };
937
- }
938
- }
939
- }
940
- var StateMachineConnector = function(_AbstractBezierConnec) {
941
- _inherits(StateMachineConnector2, _AbstractBezierConnec);
942
- var _super = _createSuper(StateMachineConnector2);
943
- function StateMachineConnector2(connection, params) {
944
- var _this;
945
- _classCallCheck(this, StateMachineConnector2);
946
- _this = _super.call(this, connection, params);
947
- _this.connection = connection;
948
- _defineProperty(_assertThisInitialized(_this), "type", StateMachineConnector2.type);
949
- _defineProperty(_assertThisInitialized(_this), "_controlPoint", void 0);
950
- _this.curviness = params.curviness || 10;
951
- _this.margin = params.margin || 5;
952
- _this.proximityLimit = params.proximityLimit || 80;
953
- _this.clockwise = params.orientation && params.orientation === "clockwise";
954
- return _this;
955
- }
956
- _createClass(StateMachineConnector2, [{
957
- key: "_computeBezier",
958
- value: function _computeBezier(paintInfo, params, sp, tp, w, h) {
959
- var _sx = sp.curX < tp.curX ? 0 : w, _sy = sp.curY < tp.curY ? 0 : h, _tx = sp.curX < tp.curX ? w : 0, _ty = sp.curY < tp.curY ? h : 0;
960
- if (sp.x === 0) {
961
- _sx -= this.margin;
962
- }
963
- if (sp.x === 1) {
964
- _sx += this.margin;
965
- }
966
- if (sp.y === 0) {
967
- _sy -= this.margin;
968
- }
969
- if (sp.y === 1) {
970
- _sy += this.margin;
971
- }
972
- if (tp.x === 0) {
973
- _tx -= this.margin;
974
- }
975
- if (tp.x === 1) {
976
- _tx += this.margin;
977
- }
978
- if (tp.y === 0) {
979
- _ty -= this.margin;
980
- }
981
- if (tp.y === 1) {
982
- _ty += this.margin;
983
- }
984
- if (this.edited !== true) {
985
- var _midx = (_sx + _tx) / 2, _midy = (_sy + _ty) / 2, segment = _segment(_sx, _sy, _tx, _ty), distance = Math.sqrt(Math.pow(_tx - _sx, 2) + Math.pow(_ty - _sy, 2));
986
- this._controlPoint = _findControlPoint(_midx, _midy, segment, params.sourcePos, params.targetPos, this.curviness, this.curviness, distance, this.proximityLimit);
987
- } else {
988
- this._controlPoint = this.geometry.controlPoints[0];
989
- }
990
- var cp1x, cp2x, cp1y, cp2y;
991
- cp1x = this._controlPoint.x;
992
- cp2x = this._controlPoint.x;
993
- cp1y = this._controlPoint.y;
994
- cp2y = this._controlPoint.y;
995
- this.geometry = {
996
- controlPoints: [this._controlPoint, this._controlPoint],
997
- source: params.sourcePos,
998
- target: params.targetPos
999
- };
1000
- this._addSegment(BezierSegment, {
1001
- x1: _tx,
1002
- y1: _ty,
1003
- x2: _sx,
1004
- y2: _sy,
1005
- cp1x,
1006
- cp1y,
1007
- cp2x,
1008
- cp2y
1009
- });
1010
- }
1011
- }]);
1012
- return StateMachineConnector2;
1013
- }(AbstractBezierConnector);
1014
- _defineProperty(StateMachineConnector, "type", "StateMachine");
1015
- Connectors.register(BezierConnector.type, BezierConnector);
1016
- Connectors.register(StateMachineConnector.type, StateMachineConnector);
1017
- export {
1018
- BezierSegment as B
1019
- };