@gemx-dev/heatmap-react 3.5.27 → 3.5.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +17 -14
- package/dist/esm/index.mjs +17 -14
- package/dist/esm/stores/data.d.ts +2 -1
- package/dist/esm/stores/data.d.ts.map +1 -1
- package/dist/esm/types/heatmap.d.ts +2 -2
- package/dist/esm/types/heatmap.d.ts.map +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/stores/data.d.ts +2 -1
- package/dist/umd/stores/data.d.ts.map +1 -1
- package/dist/umd/types/heatmap.d.ts +2 -2
- package/dist/umd/types/heatmap.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/esm/index.js
CHANGED
|
@@ -36,20 +36,23 @@ const GraphView = ({ children, width, height }) => {
|
|
|
36
36
|
return (jsxs(ReactFlow, { nodes: nodes, nodeTypes: nodeTypes, onNodesChange: onNodesChange, debug: true, minZoom: 0.5, maxZoom: 2, fitView: true, children: [jsx(Controls, {}), jsx(Background, {})] }));
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
const useHeatmapDataStore = create()((set, get) =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
})
|
|
39
|
+
const useHeatmapDataStore = create()((set, get) => {
|
|
40
|
+
return {
|
|
41
|
+
data: undefined,
|
|
42
|
+
clickmap: undefined,
|
|
43
|
+
config: undefined,
|
|
44
|
+
iframeHeight: 0,
|
|
45
|
+
state: {
|
|
46
|
+
hideSidebar: false,
|
|
47
|
+
},
|
|
48
|
+
setData: (data) => set({ data }),
|
|
49
|
+
setClickmap: (clickmap) => set({ clickmap }),
|
|
50
|
+
setState: (state) => set({ state: { ...get().state, ...state } }),
|
|
51
|
+
setConfig: (value) => set({ config: { ...get().config, ...value } }),
|
|
52
|
+
setConfigBy: (key, value) => set({ config: { ...get().config, [key]: value } }),
|
|
53
|
+
setIframeHeight: (iframeHeight) => set({ iframeHeight }),
|
|
54
|
+
};
|
|
55
|
+
});
|
|
53
56
|
|
|
54
57
|
const BoxStack = ({ children, ...props }) => {
|
|
55
58
|
const id = props.id;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -36,20 +36,23 @@ const GraphView = ({ children, width, height }) => {
|
|
|
36
36
|
return (jsxs(ReactFlow, { nodes: nodes, nodeTypes: nodeTypes, onNodesChange: onNodesChange, debug: true, minZoom: 0.5, maxZoom: 2, fitView: true, children: [jsx(Controls, {}), jsx(Background, {})] }));
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
const useHeatmapDataStore = create()((set, get) =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
})
|
|
39
|
+
const useHeatmapDataStore = create()((set, get) => {
|
|
40
|
+
return {
|
|
41
|
+
data: undefined,
|
|
42
|
+
clickmap: undefined,
|
|
43
|
+
config: undefined,
|
|
44
|
+
iframeHeight: 0,
|
|
45
|
+
state: {
|
|
46
|
+
hideSidebar: false,
|
|
47
|
+
},
|
|
48
|
+
setData: (data) => set({ data }),
|
|
49
|
+
setClickmap: (clickmap) => set({ clickmap }),
|
|
50
|
+
setState: (state) => set({ state: { ...get().state, ...state } }),
|
|
51
|
+
setConfig: (value) => set({ config: { ...get().config, ...value } }),
|
|
52
|
+
setConfigBy: (key, value) => set({ config: { ...get().config, [key]: value } }),
|
|
53
|
+
setIframeHeight: (iframeHeight) => set({ iframeHeight }),
|
|
54
|
+
};
|
|
55
|
+
});
|
|
53
56
|
|
|
54
57
|
const BoxStack = ({ children, ...props }) => {
|
|
55
58
|
const id = props.id;
|
|
@@ -11,7 +11,8 @@ export interface IHeatmapDataStore {
|
|
|
11
11
|
setState: (state: IHeatmapState) => void;
|
|
12
12
|
setData: (data: DecodedPayload[]) => void;
|
|
13
13
|
setClickmap: (clickmap: ClickMapPoint[]) => void;
|
|
14
|
-
setConfig: (
|
|
14
|
+
setConfig: (value: IHeatmapConfig) => void;
|
|
15
|
+
setConfigBy: (key: keyof IHeatmapConfig, value: IHeatmapConfig[keyof IHeatmapConfig]) => void;
|
|
15
16
|
setIframeHeight: (iframeHeight: number) => void;
|
|
16
17
|
}
|
|
17
18
|
export declare const useHeatmapDataStore: import("zustand").UseBoundStore<import("zustand").StoreApi<IHeatmapDataStore>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/stores/data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEzE,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,cAAc,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IACjD,SAAS,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/stores/data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEzE,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,cAAc,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IACjD,SAAS,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC3C,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,cAAc,EAAE,KAAK,EAAE,cAAc,CAAC,MAAM,cAAc,CAAC,KAAK,IAAI,CAAC;IAC9F,eAAe,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED,eAAO,MAAM,mBAAmB,gFAgB9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heatmap.d.ts","sourceRoot":"","sources":["../../src/types/heatmap.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"heatmap.d.ts","sourceRoot":"","sources":["../../src/types/heatmap.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAClC"}
|
package/dist/umd/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactFlow={},e.jsxRuntime,e.React)}(this,function(e,t,n){"use strict";function o(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,r=0;r<e.length;r++)""!==(n=o(e[r]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var r={value:()=>{}};function i(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new a(o)}function a(e){this._=e}function s(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function l(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=r,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}a.prototype=i.prototype={constructor:a,on:function(e,t){var n,o,r=this._,i=(o=r,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),a=-1,c=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a<c;)if(n=(e=i[a]).type)r[n]=l(r[n],e.name,t);else if(null==t)for(n in r)r[n]=l(r[n],e.name,null);return this}for(;++a<c;)if((n=(e=i[a]).type)&&(n=s(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new a(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(o=this._[e]).length;i<n;++i)o[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};var c="http://www.w3.org/1999/xhtml",u={svg:"http://www.w3.org/2000/svg",xhtml:c,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function d(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),u.hasOwnProperty(t)?{space:u[t],local:e}:e}function h(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===c&&t.documentElement.namespaceURI===c?t.createElement(e):t.createElementNS(n,e)}}function f(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function g(e){var t=d(e);return(t.local?f:h)(t)}function p(){}function m(e){return null==e?p:function(){return this.querySelector(e)}}function y(){return[]}function v(e){return null==e?y:function(){return this.querySelectorAll(e)}}function x(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}function w(e){return function(){return this.matches(e)}}function b(e){return function(t){return t.matches(e)}}var S=Array.prototype.find;function C(){return this.firstElementChild}var E=Array.prototype.filter;function k(){return Array.from(this.children)}function N(e){return new Array(e.length)}function _(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function M(e,t,n,o,r,i){for(var a,s=0,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new _(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function P(e,t,n,o,r,i,a){var s,l,c,u=new Map,d=t.length,h=i.length,f=new Array(d);for(s=0;s<d;++s)(l=t[s])&&(f[s]=c=a.call(l,l.__data__,s,t)+"",u.has(c)?r[s]=l:u.set(c,l));for(s=0;s<h;++s)c=a.call(e,i[s],s,i)+"",(l=u.get(c))?(o[s]=l,l.__data__=i[s],u.delete(c)):n[s]=new _(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&u.get(f[s])===l&&(r[s]=l)}function D(e){return e.__data__}function O(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function z(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function I(e){return function(){this.removeAttribute(e)}}function A(e){return function(){this.removeAttributeNS(e.space,e.local)}}function R(e,t){return function(){this.setAttribute(e,t)}}function L(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function $(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function T(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function B(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function j(e){return function(){this.style.removeProperty(e)}}function V(e,t,n){return function(){this.style.setProperty(e,t,n)}}function H(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Z(e,t){return e.style.getPropertyValue(t)||B(e).getComputedStyle(e,null).getPropertyValue(t)}function X(e){return function(){delete this[e]}}function Y(e,t){return function(){this[e]=t}}function F(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function W(e){return e.trim().split(/^|\s+/)}function K(e){return e.classList||new G(e)}function G(e){this._node=e,this._names=W(e.getAttribute("class")||"")}function q(e,t){for(var n=K(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function U(e,t){for(var n=K(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Q(e){return function(){q(this,e)}}function J(e){return function(){U(this,e)}}function ee(e,t){return function(){(t.apply(this,arguments)?q:U)(this,e)}}function te(){this.textContent=""}function ne(e){return function(){this.textContent=e}}function oe(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function re(){this.innerHTML=""}function ie(e){return function(){this.innerHTML=e}}function ae(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function se(){this.nextSibling&&this.parentNode.appendChild(this)}function le(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ce(){return null}function ue(){var e=this.parentNode;e&&e.removeChild(this)}function de(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function he(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function fe(e){return function(){var t=this.__on;if(t){for(var n,o=0,r=-1,i=t.length;o<i;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?t.length=r:delete this.__on}}}function ge(e,t,n){return function(){var o,r=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(r)for(var a=0,s=r.length;a<s;++a)if((o=r[a]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=t);this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function pe(e,t,n){var o=B(e),r=o.CustomEvent;"function"==typeof r?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function me(e,t){return function(){return pe(this,e,t)}}function ye(e,t){return function(){return pe(this,e,t.apply(this,arguments))}}_.prototype={constructor:_,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},G.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var ve=[null];function xe(e,t){this._groups=e,this._parents=t}function we(){return new xe([[document.documentElement]],ve)}function be(e){return"string"==typeof e?new xe([[document.querySelector(e)]],[document.documentElement]):new xe([[e]],ve)}function Se(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}xe.prototype=we.prototype={constructor:xe,select:function(e){"function"!=typeof e&&(e=m(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a,s=t[r],l=s.length,c=o[r]=new Array(l),u=0;u<l;++u)(i=s[u])&&(a=e.call(i,i.__data__,u,s))&&("__data__"in i&&(a.__data__=i.__data__),c[u]=a);return new xe(o,this._parents)},selectAll:function(e){e="function"==typeof e?x(e):v(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var a,s=t[i],l=s.length,c=0;c<l;++c)(a=s[c])&&(o.push(e.call(a,a.__data__,c,s)),r.push(a));return new xe(o,r)},selectChild:function(e){return this.select(null==e?C:function(e){return function(){return S.call(this.children,e)}}("function"==typeof e?e:b(e)))},selectChildren:function(e){return this.selectAll(null==e?k:function(e){return function(){return E.call(this.children,e)}}("function"==typeof e?e:b(e)))},filter:function(e){"function"!=typeof e&&(e=w(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a=t[r],s=a.length,l=o[r]=[],c=0;c<s;++c)(i=a[c])&&e.call(i,i.__data__,c,a)&&l.push(i);return new xe(o,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,D);var n,o=t?P:M,r=this._parents,i=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var a=i.length,s=new Array(a),l=new Array(a),c=new Array(a),u=0;u<a;++u){var d=r[u],h=i[u],f=h.length,g=O(e.call(d,d&&d.__data__,u,r)),p=g.length,m=l[u]=new Array(p),y=s[u]=new Array(p);o(d,h,m,y,c[u]=new Array(f),g,t);for(var v,x,w=0,b=0;w<p;++w)if(v=m[w]){for(w>=b&&(b=w+1);!(x=y[b])&&++b<p;);v._next=x||null}}return(s=new xe(s,r))._enter=l,s._exit=c,s},enter:function(){return new xe(this._enter||this._groups.map(N),this._parents)},exit:function(){return new xe(this._exit||this._groups.map(N),this._parents)},join:function(e,t,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(r=t(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,a=Math.min(r,i),s=new Array(r),l=0;l<a;++l)for(var c,u=n[l],d=o[l],h=u.length,f=s[l]=new Array(h),g=0;g<h;++g)(c=u[g]||d[g])&&(f[g]=c);for(;l<r;++l)s[l]=n[l];return new xe(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,r=e[t],i=r.length-1,a=r[i];--i>=0;)(o=r[i])&&(a&&4^o.compareDocumentPosition(a)&&a.parentNode.insertBefore(o,a),a=o);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=z);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var a,s=n[i],l=s.length,c=r[i]=new Array(l),u=0;u<l;++u)(a=s[u])&&(c[u]=a);c.sort(t)}return new xe(r,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var a=o[r];if(a)return a}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r,i=t[n],a=0,s=i.length;a<s;++a)(r=i[a])&&e.call(r,r.__data__,a,i);return this},attr:function(e,t){var n=d(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?A:I:"function"==typeof t?n.local?T:$:n.local?L:R)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?j:"function"==typeof t?H:V)(e,t,null==n?"":n)):Z(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?X:"function"==typeof t?F:Y)(e,t)):this.node()[e]},classed:function(e,t){var n=W(e+"");if(arguments.length<2){for(var o=K(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?ee:t?Q:J)(n,t))},text:function(e){return arguments.length?this.each(null==e?te:("function"==typeof e?oe:ne)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?re:("function"==typeof e?ae:ie)(e)):this.node().innerHTML},raise:function(){return this.each(se)},lower:function(){return this.each(le)},append:function(e){var t="function"==typeof e?e:g(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:g(e),o=null==t?ce:"function"==typeof t?t:m(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})},remove:function(){return this.each(ue)},clone:function(e){return this.select(e?he:de)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var o,r,i=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),a=i.length;if(!(arguments.length<2)){for(s=t?ge:fe,o=0;o<a;++o)this.each(s(i[o],t,n));return this}var s=this.node().__on;if(s)for(var l,c=0,u=s.length;c<u;++c)for(o=0,l=s[c];o<a;++o)if((r=i[o]).type===l.type&&r.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?ye:me)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,r=e[t],i=0,a=r.length;i<a;++i)(o=r[i])&&(yield o)}};const Ce={passive:!1},Ee={capture:!0,passive:!1};function ke(e){e.stopImmediatePropagation()}function Ne(e){e.preventDefault(),e.stopImmediatePropagation()}function _e(e){var t=e.document.documentElement,n=be(e).on("dragstart.drag",Ne,Ee);"onselectstart"in t?n.on("selectstart.drag",Ne,Ee):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Me(e,t){var n=e.document.documentElement,o=be(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ne,Ee),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Pe=e=>()=>e;function De(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:a,y:s,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function Oe(e){return!e.ctrlKey&&!e.button}function ze(){return this.parentNode}function Ie(e,t){return null==t?{x:e.x,y:e.y}:t}function Ae(){return navigator.maxTouchPoints||"ontouchstart"in this}function Re(){var e,t,n,o,r=Oe,a=ze,s=Ie,l=Ae,c={},u=i("start","drag","end"),d=0,h=0;function f(e){e.on("mousedown.drag",g).filter(l).on("touchstart.drag",y).on("touchmove.drag",v,Ce).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(i,s){if(!o&&r.call(this,i,s)){var l=w(this,a.call(this,i,s),i,s,"mouse");l&&(be(i.view).on("mousemove.drag",p,Ee).on("mouseup.drag",m,Ee),_e(i.view),ke(i),n=!1,e=i.clientX,t=i.clientY,l("start",i))}}function p(o){if(Ne(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>h}c.mouse("drag",o)}function m(e){be(e.view).on("mousemove.drag mouseup.drag",null),Me(e.view,n),Ne(e),c.mouse("end",e)}function y(e,t){if(r.call(this,e,t)){var n,o,i=e.changedTouches,s=a.call(this,e,t),l=i.length;for(n=0;n<l;++n)(o=w(this,s,e,t,i[n].identifier,i[n]))&&(ke(e),o("start",e,i[n]))}}function v(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=c[o[t].identifier])&&(Ne(e),n("drag",e,o[t]))}function x(e){var t,n,r=e.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout(function(){o=null},500),t=0;t<i;++t)(n=c[r[t].identifier])&&(ke(e),n("end",e,r[t]))}function w(e,t,n,o,r,i){var a,l,h,g=u.copy(),p=Se(i||n,t);if(null!=(h=s.call(e,new De("beforestart",{sourceEvent:n,target:f,identifier:r,active:d,x:p[0],y:p[1],dx:0,dy:0,dispatch:g}),o)))return a=h.x-p[0]||0,l=h.y-p[1]||0,function n(i,s,u){var m,y=p;switch(i){case"start":c[r]=n,m=d++;break;case"end":delete c[r],--d;case"drag":p=Se(u||s,t),m=d}g.call(i,e,new De(i,{sourceEvent:s,subject:h,target:f,identifier:r,active:m,x:p[0]+a,y:p[1]+l,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:g}),o)}}return f.filter=function(e){return arguments.length?(r="function"==typeof e?e:Pe(!!e),f):r},f.container=function(e){return arguments.length?(a="function"==typeof e?e:Pe(e),f):a},f.subject=function(e){return arguments.length?(s="function"==typeof e?e:Pe(e),f):s},f.touchable=function(e){return arguments.length?(l="function"==typeof e?e:Pe(!!e),f):l},f.on=function(){var e=u.on.apply(u,arguments);return e===u?f:e},f.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,f):Math.sqrt(h)},f}function Le(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function $e(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Te(){}De.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Be=.7,je=1/Be,Ve="\\s*([+-]?\\d+)\\s*",He="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ze="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Xe=/^#([0-9a-f]{3,8})$/,Ye=new RegExp(`^rgb\\(${Ve},${Ve},${Ve}\\)$`),Fe=new RegExp(`^rgb\\(${Ze},${Ze},${Ze}\\)$`),We=new RegExp(`^rgba\\(${Ve},${Ve},${Ve},${He}\\)$`),Ke=new RegExp(`^rgba\\(${Ze},${Ze},${Ze},${He}\\)$`),Ge=new RegExp(`^hsl\\(${He},${Ze},${Ze}\\)$`),qe=new RegExp(`^hsla\\(${He},${Ze},${Ze},${He}\\)$`),Ue={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Qe(){return this.rgb().formatHex()}function Je(){return this.rgb().formatRgb()}function et(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Xe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?tt(t):3===n?new rt(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?nt(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?nt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Ye.exec(e))?new rt(t[1],t[2],t[3],1):(t=Fe.exec(e))?new rt(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=We.exec(e))?nt(t[1],t[2],t[3],t[4]):(t=Ke.exec(e))?nt(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Ge.exec(e))?ut(t[1],t[2]/100,t[3]/100,1):(t=qe.exec(e))?ut(t[1],t[2]/100,t[3]/100,t[4]):Ue.hasOwnProperty(e)?tt(Ue[e]):"transparent"===e?new rt(NaN,NaN,NaN,0):null}function tt(e){return new rt(e>>16&255,e>>8&255,255&e,1)}function nt(e,t,n,o){return o<=0&&(e=t=n=NaN),new rt(e,t,n,o)}function ot(e,t,n,o){return 1===arguments.length?((r=e)instanceof Te||(r=et(r)),r?new rt((r=r.rgb()).r,r.g,r.b,r.opacity):new rt):new rt(e,t,n,null==o?1:o);var r}function rt(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function it(){return`#${ct(this.r)}${ct(this.g)}${ct(this.b)}`}function at(){const e=st(this.opacity);return`${1===e?"rgb(":"rgba("}${lt(this.r)}, ${lt(this.g)}, ${lt(this.b)}${1===e?")":`, ${e})`}`}function st(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function lt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ct(e){return((e=lt(e))<16?"0":"")+e.toString(16)}function ut(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ht(e,t,n,o)}function dt(e){if(e instanceof ht)return new ht(e.h,e.s,e.l,e.opacity);if(e instanceof Te||(e=et(e)),!e)return new ht;if(e instanceof ht)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),a=NaN,s=i-r,l=(i+r)/2;return s?(a=t===i?(n-o)/s+6*(n<o):n===i?(o-t)/s+2:(t-n)/s+4,s/=l<.5?i+r:2-i-r,a*=60):s=l>0&&l<1?0:a,new ht(a,s,l,e.opacity)}function ht(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function ft(e){return(e=(e||0)%360)<0?e+360:e}function gt(e){return Math.max(0,Math.min(1,e||0))}function pt(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Le(Te,et,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Qe,formatHex:Qe,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return dt(this).formatHsl()},formatRgb:Je,toString:Je}),Le(rt,ot,$e(Te,{brighter(e){return e=null==e?je:Math.pow(je,e),new rt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Be:Math.pow(Be,e),new rt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new rt(lt(this.r),lt(this.g),lt(this.b),st(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:it,formatHex:it,formatHex8:function(){return`#${ct(this.r)}${ct(this.g)}${ct(this.b)}${ct(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:at,toString:at})),Le(ht,function(e,t,n,o){return 1===arguments.length?dt(e):new ht(e,t,n,null==o?1:o)},$e(Te,{brighter(e){return e=null==e?je:Math.pow(je,e),new ht(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Be:Math.pow(Be,e),new ht(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new rt(pt(e>=240?e-240:e+120,r,o),pt(e,r,o),pt(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new ht(ft(this.h),gt(this.s),gt(this.l),st(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=st(this.opacity);return`${1===e?"hsl(":"hsla("}${ft(this.h)}, ${100*gt(this.s)}%, ${100*gt(this.l)}%${1===e?")":`, ${e})`}`}}));var mt=e=>()=>e;function yt(e){return 1===(e=+e)?vt:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}(t,n,e):mt(isNaN(t)?n:t)}}function vt(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):mt(isNaN(e)?t:e)}var xt=function e(t){var n=yt(t);function o(e,t){var o=n((e=ot(e)).r,(t=ot(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),a=vt(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=r(t),e.b=i(t),e.opacity=a(t),e+""}}return o.gamma=e,o}(1);function wt(e,t){t||(t=[]);var n,o=e?Math.min(t.length,e.length):0,r=t.slice();return function(i){for(n=0;n<o;++n)r[n]=e[n]*(1-i)+t[n]*i;return r}}function bt(e,t){var n,o=t?t.length:0,r=e?Math.min(o,e.length):0,i=new Array(r),a=new Array(o);for(n=0;n<r;++n)i[n]=Mt(e[n],t[n]);for(;n<o;++n)a[n]=t[n];return function(e){for(n=0;n<r;++n)a[n]=i[n](e);return a}}function St(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Ct(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Et(e,t){var n,o={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?o[n]=Mt(e[n],t[n]):r[n]=t[n];return function(e){for(n in o)r[n]=o[n](e);return r}}var kt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Nt=new RegExp(kt.source,"g");function _t(e,t){var n,o,r,i=kt.lastIndex=Nt.lastIndex=0,a=-1,s=[],l=[];for(e+="",t+="";(n=kt.exec(e))&&(o=Nt.exec(t));)(r=o.index)>i&&(r=t.slice(i,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(o=o[0])?s[a]?s[a]+=o:s[++a]=o:(s[++a]=null,l.push({i:a,x:Ct(n,o)})),i=Nt.lastIndex;return i<t.length&&(r=t.slice(i),s[a]?s[a]+=r:s[++a]=r),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,o=0;o<t;++o)s[(n=l[o]).i]=n.x(e);return s.join("")})}function Mt(e,t){var n,o,r=typeof t;return null==t||"boolean"===r?mt(t):("number"===r?Ct:"string"===r?(n=et(t))?(t=n,xt):_t:t instanceof et?xt:t instanceof Date?St:(o=t,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(t)?bt:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?Et:Ct:wt))(e,t)}var Pt,Dt=180/Math.PI,Ot={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function zt(e,t,n,o,r,i){var a,s,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,l/=s),e*o<t*n&&(e=-e,t=-t,l=-l,a=-a),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Dt,skewX:Math.atan(l)*Dt,scaleX:a,scaleY:s}}function It(e,t,n,o){function r(e){return e.length?e.pop()+" ":""}return function(i,a){var s=[],l=[];return i=e(i),a=e(a),function(e,o,r,i,a,s){if(e!==r||o!==i){var l=a.push("translate(",null,t,null,n);s.push({i:l-4,x:Ct(e,r)},{i:l-2,x:Ct(o,i)})}else(r||i)&&a.push("translate("+r+t+i+n)}(i.translateX,i.translateY,a.translateX,a.translateY,s,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:Ct(e,t)})):t&&n.push(r(n)+"rotate("+t+o)}(i.rotate,a.rotate,s,l),function(e,t,n,i){e!==t?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:Ct(e,t)}):t&&n.push(r(n)+"skewX("+t+o)}(i.skewX,a.skewX,s,l),function(e,t,n,o,i,a){if(e!==n||t!==o){var s=i.push(r(i)+"scale(",null,",",null,")");a.push({i:s-4,x:Ct(e,n)},{i:s-2,x:Ct(t,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,s,l),i=a=null,function(e){for(var t,n=-1,o=l.length;++n<o;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var At=It(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ot:zt(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Rt=It(function(e){return null==e?Ot:(Pt||(Pt=document.createElementNS("http://www.w3.org/2000/svg","g")),Pt.setAttribute("transform",e),(e=Pt.transform.baseVal.consolidate())?zt((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Ot)},", ",")",")");function Lt(e){return((e=Math.exp(e))+1/e)/2}var $t,Tt,Bt=function e(t,n,o){function r(e,r){var i,a,s=e[0],l=e[1],c=e[2],u=r[0],d=r[1],h=r[2],f=u-s,g=d-l,p=f*f+g*g;if(p<1e-12)a=Math.log(h/c)/t,i=function(e){return[s+e*f,l+e*g,c*Math.exp(t*e*a)]};else{var m=Math.sqrt(p),y=(h*h-c*c+o*p)/(2*c*n*m),v=(h*h-c*c-o*p)/(2*h*n*m),x=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(v*v+1)-v);a=(w-x)/t,i=function(e){var o,r=e*a,i=Lt(x),u=c/(n*m)*(i*(o=t*r+x,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(x));return[s+u*f,l+u*g,c*i/Lt(t*r+x)]}}return i.duration=1e3*a*t/Math.SQRT2,i}return r.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},r}(Math.SQRT2,2,4),jt=0,Vt=0,Ht=0,Zt=0,Xt=0,Yt=0,Ft="object"==typeof performance&&performance.now?performance:Date,Wt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Kt(){return Xt||(Wt(Gt),Xt=Ft.now()+Yt)}function Gt(){Xt=0}function qt(){this._call=this._time=this._next=null}function Ut(e,t,n){var o=new qt;return o.restart(e,t,n),o}function Qt(){Xt=(Zt=Ft.now())+Yt,jt=Vt=0;try{!function(){Kt(),++jt;for(var e,t=$t;t;)(e=Xt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--jt}()}finally{jt=0,function(){var e,t,n=$t,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:$t=t);Tt=e,en(o)}(),Xt=0}}function Jt(){var e=Ft.now(),t=e-Zt;t>1e3&&(Yt-=t,Zt=e)}function en(e){jt||(Vt&&(Vt=clearTimeout(Vt)),e-Xt>24?(e<1/0&&(Vt=setTimeout(Qt,e-Ft.now()-Yt)),Ht&&(Ht=clearInterval(Ht))):(Ht||(Zt=Ft.now(),Ht=setInterval(Jt,1e3)),jt=1,Wt(Qt)))}function tn(e,t,n){var o=new qt;return t=null==t?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,n),o}qt.prototype=Ut.prototype={constructor:qt,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Kt():+n)+(null==t?0:+t),this._next||Tt===this||(Tt?Tt._next=this:$t=this,Tt=this),this._call=e,this._time=n,en()},stop:function(){this._call&&(this._call=null,this._time=1/0,en())}};var nn=i("start","end","cancel","interrupt"),on=[];function rn(e,t,n,o,r,i){var a=e.__transition;if(a){if(n in a)return}else e.__transition={};!function(e,t,n){var o,r=e.__transition;function i(e){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=e&&a(e-n.delay)}function a(i){var c,u,d,h;if(1!==n.state)return l();for(c in r)if((h=r[c]).name===n.name){if(3===h.state)return tn(a);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+c<t&&(h.state=6,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[c])}if(tn(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(i))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,o=new Array(d=n.tween.length),c=0,u=-1;c<d;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=h);o.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=5,1),i=-1,a=o.length;++i<a;)o[i].call(e,r);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var o in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}r[t]=n,n.timer=Ut(i,0,n.time)}(e,n,{name:t,index:o,group:r,on:nn,tween:on,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function an(e,t){var n=ln(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function sn(e,t){var n=ln(e,t);if(n.state>3)throw new Error("too late; already running");return n}function ln(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function cn(e,t){var n,o,r,i=e.__transition,a=!0;if(i){for(r in t=null==t?null:t+"",i)(n=i[r]).name===t?(o=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[r]):a=!1;a&&delete e.__transition}}function un(e,t){var n,o;return function(){var r=sn(this,e),i=r.tween;if(i!==n)for(var a=0,s=(o=n=i).length;a<s;++a)if(o[a].name===t){(o=o.slice()).splice(a,1);break}r.tween=o}}function dn(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=sn(this,e),a=i.tween;if(a!==o){r=(o=a).slice();for(var s={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=s;break}l===c&&r.push(s)}i.tween=r}}function hn(e,t,n){var o=e._id;return e.each(function(){var e=sn(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return ln(e,o).value[t]}}function fn(e,t){var n;return("number"==typeof t?Ct:t instanceof et?xt:(n=et(t))?(t=n,xt):_t)(e,t)}function gn(e){return function(){this.removeAttribute(e)}}function pn(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mn(e,t,n){var o,r,i=n+"";return function(){var a=this.getAttribute(e);return a===i?null:a===o?r:r=t(o=a,n)}}function yn(e,t,n){var o,r,i=n+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===o?r:r=t(o=a,n)}}function vn(e,t,n){var o,r,i;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(e))===(s=l+"")?null:a===o&&s===r?i:(r=s,i=t(o=a,l));this.removeAttribute(e)}}function xn(e,t,n){var o,r,i;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:a===o&&s===r?i:(r=s,i=t(o=a,l));this.removeAttributeNS(e.space,e.local)}}function wn(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,r)),n}return r._value=t,r}function bn(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,r)),n}return r._value=t,r}function Sn(e,t){return function(){an(this,e).delay=+t.apply(this,arguments)}}function Cn(e,t){return t=+t,function(){an(this,e).delay=t}}function En(e,t){return function(){sn(this,e).duration=+t.apply(this,arguments)}}function kn(e,t){return t=+t,function(){sn(this,e).duration=t}}var Nn=we.prototype.constructor;function _n(e){return function(){this.style.removeProperty(e)}}var Mn=0;function Pn(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Dn(){return++Mn}var On=we.prototype;Pn.prototype={constructor:Pn,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=m(e));for(var o=this._groups,r=o.length,i=new Array(r),a=0;a<r;++a)for(var s,l,c=o[a],u=c.length,d=i[a]=new Array(u),h=0;h<u;++h)(s=c[h])&&(l=e.call(s,s.__data__,h,c))&&("__data__"in s&&(l.__data__=s.__data__),d[h]=l,rn(d[h],t,n,h,d,ln(s,n)));return new Pn(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=v(e));for(var o=this._groups,r=o.length,i=[],a=[],s=0;s<r;++s)for(var l,c=o[s],u=c.length,d=0;d<u;++d)if(l=c[d]){for(var h,f=e.call(l,l.__data__,d,c),g=ln(l,n),p=0,m=f.length;p<m;++p)(h=f[p])&&rn(h,t,n,p,f,g);i.push(f),a.push(l)}return new Pn(i,a,t,n)},selectChild:On.selectChild,selectChildren:On.selectChildren,filter:function(e){"function"!=typeof e&&(e=w(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a=t[r],s=a.length,l=o[r]=[],c=0;c<s;++c)(i=a[c])&&e.call(i,i.__data__,c,a)&&l.push(i);return new Pn(o,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),a=new Array(o),s=0;s<i;++s)for(var l,c=t[s],u=n[s],d=c.length,h=a[s]=new Array(d),f=0;f<d;++f)(l=c[f]||u[f])&&(h[f]=l);for(;s<o;++s)a[s]=t[s];return new Pn(a,this._parents,this._name,this._id)},selection:function(){return new Nn(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=Dn(),o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],l=s.length,c=0;c<l;++c)if(a=s[c]){var u=ln(a,t);rn(a,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Pn(o,this._parents,e,n)},call:On.call,nodes:On.nodes,node:On.node,size:On.size,empty:On.empty,each:On.each,on:function(e,t){var n=this._id;return arguments.length<2?ln(this.node(),n).on.on(e):this.each(function(e,t,n){var o,r,i=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?an:sn;return function(){var a=i(this,e),s=a.on;s!==o&&(r=(o=s).copy()).on(t,n),a.on=r}}(n,e,t))},attr:function(e,t){var n=d(e),o="transform"===n?Rt:fn;return this.attrTween(e,"function"==typeof t?(n.local?xn:vn)(n,o,hn(this,"attr."+e,t)):null==t?(n.local?pn:gn)(n):(n.local?yn:mn)(n,o,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=d(e);return this.tween(n,(o.local?wn:bn)(o,t))},style:function(e,t,n){var o="transform"==(e+="")?At:fn;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=Z(this,e),a=(this.style.removeProperty(e),Z(this,e));return i===a?null:i===n&&a===o?r:r=t(n=i,o=a)}}(e,o)).on("end.style."+e,_n(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var a=Z(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=Z(this,e)),a===l?null:a===o&&l===r?i:(r=l,i=t(o=a,s))}}(e,o,hn(this,"style."+e,t))).each(function(e,t){var n,o,r,i,a="style."+t,s="end."+a;return function(){var l=sn(this,e),c=l.on,u=null==l.value[a]?i||(i=_n(t)):void 0;c===n&&r===u||(o=(n=c).copy()).on(s,r=u),l.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,r,i=n+"";return function(){var a=Z(this,e);return a===i?null:a===o?r:r=t(o=a,n)}}(e,o,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,r;function i(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,i,n)),o}return i._value=t,i}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(hn(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,r=ln(this.node(),n).tween,i=0,a=r.length;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((null==t?un:dn)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Sn:Cn)(t,e)):ln(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?En:kn)(t,e)):ln(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){sn(this,e).ease=t}}(t,e)):ln(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;sn(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,a){var s={value:a},l={value:function(){0===--r&&i()}};n.each(function(){var n=sn(this,o),r=n.on;r!==e&&((t=(e=r).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t}),0===r&&i()})},[Symbol.iterator]:On[Symbol.iterator]};var zn={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function In(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}we.prototype.interrupt=function(e){return this.each(function(){cn(this,e)})},we.prototype.transition=function(e){var t,n;e instanceof Pn?(t=e._id,e=e._name):(t=Dn(),(n=zn).time=Kt(),e=null==e?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],l=s.length,c=0;c<l;++c)(a=s[c])&&rn(a,e,t,c,s,n||In(a,t));return new Pn(o,this._parents,e,t)};var An=e=>()=>e;function Rn(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ln(e,t,n){this.k=e,this.x=t,this.y=n}Ln.prototype={constructor:Ln,scale:function(e){return 1===e?this:new Ln(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Ln(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var $n=new Ln(1,0,0);function Tn(e){for(;!e.__zoom;)if(!(e=e.parentNode))return $n;return e.__zoom}function Bn(e){e.stopImmediatePropagation()}function jn(e){e.preventDefault(),e.stopImmediatePropagation()}function Vn(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Hn(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function Zn(){return this.__zoom||$n}function Xn(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Yn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fn(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function Wn(){var e,t,n,o=Vn,r=Hn,a=Fn,s=Xn,l=Yn,c=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],d=250,h=Bt,f=i("start","zoom","end"),g=0,p=10;function m(e){e.property("__zoom",Zn).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",k).filter(l).on("touchstart.zoom",N).on("touchmove.zoom",_).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(e,t){return(t=Math.max(c[0],Math.min(c[1],t)))===e.k?e:new Ln(t,e.x,e.y)}function v(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new Ln(e.k,o,r)}function x(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,t,n,o){e.on("start.zoom",function(){b(this,arguments).event(o).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(o).end()}).tween("zoom",function(){var e=this,i=arguments,a=b(e,i).event(o),s=r.apply(e,i),l=null==n?x(s):"function"==typeof n?n.apply(e,i):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),u=e.__zoom,d="function"==typeof t?t.apply(e,i):t,f=h(u.invert(l).concat(c/u.k),d.invert(l).concat(c/d.k));return function(e){if(1===e)e=d;else{var t=f(e),n=c/t[2];e=new Ln(n,l[0]-t[0]*n,l[1]-t[1]*n)}a.zoom(null,e)}})}function b(e,t,n){return!n&&e.__zooming||new S(e,t)}function S(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function C(e,...t){if(o.apply(this,arguments)){var n=b(this,t).event(e),r=this.__zoom,i=Math.max(c[0],Math.min(c[1],r.k*Math.pow(2,s.apply(this,arguments)))),l=Se(e);if(n.wheel)n.mouse[0][0]===l[0]&&n.mouse[0][1]===l[1]||(n.mouse[1]=r.invert(n.mouse[0]=l)),clearTimeout(n.wheel);else{if(r.k===i)return;n.mouse=[l,r.invert(l)],cn(this),n.start()}jn(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",a(v(y(r,i),n.mouse[0],n.mouse[1]),n.extent,u))}}function E(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,i=b(this,t,!0).event(e),s=be(e.view).on("mousemove.zoom",function(e){if(jn(e),!i.moved){var t=e.clientX-c,n=e.clientY-d;i.moved=t*t+n*n>g}i.event(e).zoom("mouse",a(v(i.that.__zoom,i.mouse[0]=Se(e,r),i.mouse[1]),i.extent,u))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),Me(e.view,i.moved),jn(e),i.event(e).end()},!0),l=Se(e,r),c=e.clientX,d=e.clientY;_e(e.view),Bn(e),i.mouse=[l,this.__zoom.invert(l)],cn(this),i.start()}}function k(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,i=Se(e.changedTouches?e.changedTouches[0]:e,this),s=n.invert(i),l=n.k*(e.shiftKey?.5:2),c=a(v(y(n,l),i,s),r.apply(this,t),u);jn(e),d>0?be(this).transition().duration(d).call(w,c,i,e):be(this).call(m.transform,c,i,e)}}function N(n,...r){if(o.apply(this,arguments)){var i,a,s,l,c=n.touches,u=c.length,d=b(this,r,n.changedTouches.length===u).event(n);for(Bn(n),a=0;a<u;++a)l=[l=Se(s=c[a],this),this.__zoom.invert(l),s.identifier],d.touch0?d.touch1||d.touch0[2]===l[2]||(d.touch1=l,d.taps=0):(d.touch0=l,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(t=l[0],e=setTimeout(function(){e=null},500)),cn(this),d.start())}}function _(e,...t){if(this.__zooming){var n,o,r,i,s=b(this,t).event(e),l=e.changedTouches,c=l.length;for(jn(e),n=0;n<c;++n)r=Se(o=l[n],this),s.touch0&&s.touch0[2]===o.identifier?s.touch0[0]=r:s.touch1&&s.touch1[2]===o.identifier&&(s.touch1[0]=r);if(o=s.that.__zoom,s.touch1){var d=s.touch0[0],h=s.touch0[1],f=s.touch1[0],g=s.touch1[1],p=(p=f[0]-d[0])*p+(p=f[1]-d[1])*p,m=(m=g[0]-h[0])*m+(m=g[1]-h[1])*m;o=y(o,Math.sqrt(p/m)),r=[(d[0]+f[0])/2,(d[1]+f[1])/2],i=[(h[0]+g[0])/2,(h[1]+g[1])/2]}else{if(!s.touch0)return;r=s.touch0[0],i=s.touch0[1]}s.zoom("touch",a(v(o,r,i),s.extent,u))}}function M(e,...o){if(this.__zooming){var r,i,a=b(this,o).event(e),s=e.changedTouches,l=s.length;for(Bn(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),r=0;r<l;++r)i=s[r],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=Se(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<p)){var c=be(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return m.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",Zn),e!==r?w(e,t,n,o):r.interrupt().each(function(){b(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},m.scaleBy=function(e,t,n,o){m.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,o)},m.scaleTo=function(e,t,n,o){m.transform(e,function(){var e=r.apply(this,arguments),o=this.__zoom,i=null==n?x(e):"function"==typeof n?n.apply(this,arguments):n,s=o.invert(i),l="function"==typeof t?t.apply(this,arguments):t;return a(v(y(o,l),i,s),e,u)},n,o)},m.translateBy=function(e,t,n,o){m.transform(e,function(){return a(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),u)},null,o)},m.translateTo=function(e,t,n,o,i){m.transform(e,function(){var e=r.apply(this,arguments),i=this.__zoom,s=null==o?x(e):"function"==typeof o?o.apply(this,arguments):o;return a($n.translate(s[0],s[1]).scale(i.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,u)},o,i)},S.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=be(this.that).datum();f.call(e,this.that,new Rn(e,{sourceEvent:this.sourceEvent,target:m,type:e,transform:this.that.__zoom,dispatch:f}),t)}},m.wheelDelta=function(e){return arguments.length?(s="function"==typeof e?e:An(+e),m):s},m.filter=function(e){return arguments.length?(o="function"==typeof e?e:An(!!e),m):o},m.touchable=function(e){return arguments.length?(l="function"==typeof e?e:An(!!e),m):l},m.extent=function(e){return arguments.length?(r="function"==typeof e?e:An([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),m):r},m.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],m):[c[0],c[1]]},m.translateExtent=function(e){return arguments.length?(u[0][0]=+e[0][0],u[1][0]=+e[1][0],u[0][1]=+e[0][1],u[1][1]=+e[1][1],m):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},m.constrain=function(e){return arguments.length?(a=e,m):a},m.duration=function(e){return arguments.length?(d=+e,m):d},m.interpolate=function(e){return arguments.length?(h=e,m):h},m.on=function(){var e=f.on.apply(f,arguments);return e===f?m:e},m.clickDistance=function(e){return arguments.length?(g=(e=+e)*e,m):Math.sqrt(g)},m.tapDistance=function(e){return arguments.length?(p=+e,m):p},m}Tn.prototype=Ln.prototype;const Kn=()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",Gn=e=>`Node type "${e}" not found. Using fallback type "default".`,qn=()=>"The React Flow parent container needs a width and a height to render the graph.",Un=()=>"Only child nodes can use a parent extent.",Qn=e=>`Marker type "${e}" doesn't exist.`,Jn=(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:o}", edge id: ${t}.`,eo=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",to=e=>`Edge type "${e}" not found. Using fallback type "default".`,no=e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,oo=()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",ro=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],io=["Enter"," ","Escape"],ao={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var so,lo,co;!function(e){e.Strict="strict",e.Loose="loose"}(so||(so={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(lo||(lo={})),function(e){e.Partial="partial",e.Full="full"}(co||(co={}));const uo={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var ho,fo,go;!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(ho||(ho={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(fo||(fo={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(go||(go={}));const po={[go.Left]:go.Right,[go.Right]:go.Left,[go.Top]:go.Bottom,[go.Bottom]:go.Top};function mo(e){return null===e?null:e?"valid":"invalid"}const yo=e=>"id"in e&&"source"in e&&"target"in e,vo=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),xo=(e,t=[0,0])=>{const{width:n,height:o}=Wo(e),r=e.origin??t,i=n*r[0],a=o*r[1];return{x:e.position.x-i,y:e.position.y-a}},wo=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(e=>{(void 0===t.filter||t.filter(e))&&(n=Do(n,Ao(e)),o=!0)}),o?zo(n):{x:0,y:0,width:0,height:0}},bo=(e,t,[n,o,r]=[0,0,1],i=!1,a=!1)=>{const s={...Vo(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const t of e.values()){const{measured:e,selectable:n=!0,hidden:o=!1}=t;if(a&&!n||o)continue;const r=e.width??t.width??t.initialWidth??null,c=e.height??t.height??t.initialHeight??null,u=Lo(s,Io(t)),d=(r??0)*(c??0),h=i&&u>0;(!t.internals.handleBounds||h||u>=d||t.dragging)&&l.push(t)}return l};async function So({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},a){if(0===e.size)return Promise.resolve(!0);const s=function(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{!e.measured.width||!e.measured.height||!t?.includeHiddenNodes&&e.hidden||o&&!o.has(e.id)||n.set(e.id,e)}),n}(e,a),l=wo(s),c=Xo(l,t,n,a?.minZoom??r,a?.maxZoom??i,a?.padding??.1);return await o.setViewport(c,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)}function Co({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const a=n.get(e),s=a.parentId?n.get(a.parentId):void 0,{x:l,y:c}=s?s.internals.positionAbsolute:{x:0,y:0},u=a.origin??o;let d=a.extent||r;if("parent"!==a.extent||a.expandParent)s&&Fo(a.extent)&&(d=[[a.extent[0][0]+l,a.extent[0][1]+c],[a.extent[1][0]+l,a.extent[1][1]+c]]);else if(s){const e=s.measured.width,t=s.measured.height;e&&t&&(d=[[l,c],[l+e,c+t]])}else i?.("005",Un());const h=Fo(d)?No(t,d,a.measured):t;return void 0!==a.measured.width&&void 0!==a.measured.height||i?.("015",oo()),{position:{x:h.x-l+(a.measured.width??0)*u[0],y:h.y-c+(a.measured.height??0)*u[1]},positionAbsolute:h}}async function Eo({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(e=>e.id)),a=[];for(const e of n){if(!1===e.deletable)continue;const t=i.has(e.id),n=!t&&e.parentId&&a.find(t=>t.id===e.parentId);(t||n)&&a.push(e)}const s=new Set(t.map(e=>e.id)),l=o.filter(e=>!1!==e.deletable),c=((e,t)=>{const n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))})(a,l),u=c;for(const e of l){s.has(e.id)&&!u.find(t=>t.id===e.id)&&u.push(e)}if(!r)return{edges:u,nodes:a};const d=await r({nodes:a,edges:u});return"boolean"==typeof d?d?{edges:u,nodes:a}:{edges:[],nodes:[]}:d}const ko=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),No=(e={x:0,y:0},t,n)=>({x:ko(e.x,t[0][0],t[1][0]-(n?.width??0)),y:ko(e.y,t[0][1],t[1][1]-(n?.height??0))});function _o(e,t,n){const{width:o,height:r}=Wo(n),{x:i,y:a}=n.internals.positionAbsolute;return No(e,[[i,a],[i+o,a+r]],t)}const Mo=(e,t,n)=>e<t?ko(Math.abs(e-t),1,t)/t:e>n?-ko(Math.abs(e-n),1,t)/t:0,Po=(e,t,n=15,o=40)=>[Mo(e.x,o,t.width-o)*n,Mo(e.y,o,t.height-o)*n],Do=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Oo=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),zo=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Io=(e,t=[0,0])=>{const{x:n,y:o}=vo(e)?e.internals.positionAbsolute:xo(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ao=(e,t=[0,0])=>{const{x:n,y:o}=vo(e)?e.internals.positionAbsolute:xo(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Ro=(e,t)=>zo(Do(Oo(e),Oo(t))),Lo=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},$o=e=>To(e.width)&&To(e.height)&&To(e.x)&&To(e.y),To=e=>!isNaN(e)&&isFinite(e),Bo=(e,t)=>{},jo=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Vo=({x:e,y:t},[n,o,r],i=!1,a=[1,1])=>{const s={x:(e-n)/r,y:(t-o)/r};return i?jo(s,a):s},Ho=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Zo(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}const Xo=(e,t,n,o,r,i)=>{const a=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Zo(e,n),r=Zo(e,t);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof e){const o=Zo(e.top??e.y??0,n),r=Zo(e.bottom??e.y??0,n),i=Zo(e.left??e.x??0,t),a=Zo(e.right??e.x??0,t);return{top:o,right:a,bottom:r,left:i,x:i+a,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),s=(t-a.x)/e.width,l=(n-a.y)/e.height,c=Math.min(s,l),u=ko(c,o,r),d=t/2-(e.x+e.width/2)*u,h=n/2-(e.y+e.height/2)*u,f=function(e,t,n,o,r,i){const{x:a,y:s}=Ho(e,[t,n,o]),{x:l,y:c}=Ho({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-c;return{left:Math.floor(a),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}(e,d,h,u,t,n),g=Math.min(f.left-a.left,0),p=Math.min(f.top-a.top,0);return{x:d-g+Math.min(f.right-a.right,0),y:h-p+Math.min(f.bottom-a.bottom,0),zoom:u}},Yo=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function Fo(e){return null!=e&&"parent"!==e}function Wo(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Ko(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function Go(e,t={width:0,height:0},n,o,r){const i={...e},a=o.get(n);if(a){const e=a.origin||r;i.x+=a.internals.positionAbsolute.x-(t.width??0)*e[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*e[1]}return i}function qo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Uo(e){return{...ao,...e||{}}}function Qo(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:a}=rr(e),s=Vo({x:i-(r?.left??0),y:a-(r?.top??0)},o),{x:l,y:c}=n?jo(s,t):s;return{xSnapped:l,ySnapped:c,...s}}const Jo=e=>({width:e.offsetWidth,height:e.offsetHeight}),er=e=>e?.getRootNode?.()||window?.document,tr=["INPUT","SELECT","TEXTAREA"];function nr(e){const t=e.composedPath?.()?.[0]||e.target;if(1!==t?.nodeType)return!1;return tr.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const or=e=>"clientX"in e,rr=(e,t)=>{const n=or(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},ir=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return i&&i.length?Array.from(i).map(t=>{const i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:r,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...Jo(t)}}):null};function ar({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:a,targetControlY:s}){const l=.125*e+.375*r+.375*a+.125*n,c=.125*t+.375*i+.375*s+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}function sr(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function lr({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case go.Left:return[t-sr(t-o,i),n];case go.Right:return[t+sr(o-t,i),n];case go.Top:return[t,n-sr(n-r,i)];case go.Bottom:return[t,n+sr(r-n,i)]}}function cr({sourceX:e,sourceY:t,sourcePosition:n=go.Bottom,targetX:o,targetY:r,targetPosition:i=go.Top,curvature:a=.25}){const[s,l]=lr({pos:n,x1:e,y1:t,x2:o,y2:r,c:a}),[c,u]=lr({pos:i,x1:o,y1:r,x2:e,y2:t,c:a}),[d,h,f,g]=ar({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${s},${l} ${c},${u} ${o},${r}`,d,h,f,g]}function ur({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,a=Math.abs(o-t)/2;return[i,o<t?o+a:o-a,r,a]}function dr({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Do(Ao(e),Ao(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const a={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Lo(a,zo(i))>0}const hr=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`;function fr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,a,s]=ur({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,a,s]}const gr={[go.Left]:{x:-1,y:0},[go.Right]:{x:1,y:0},[go.Top]:{x:0,y:-1},[go.Bottom]:{x:0,y:1}},pr=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function mr({source:e,sourcePosition:t=go.Bottom,target:n,targetPosition:o=go.Top,center:r,offset:i,stepPosition:a}){const s=gr[t],l=gr[o],c={x:e.x+s.x*i,y:e.y+s.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},d=(({source:e,sourcePosition:t=go.Bottom,target:n})=>t===go.Left||t===go.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:c,sourcePosition:t,target:u}),h=0!==d.x?"x":"y",f=d[h];let g,p,m=[];const y={x:0,y:0},v={x:0,y:0},[,,x,w]=ur({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[h]*l[h]===-1){"x"===h?(g=r.x??c.x+(u.x-c.x)*a,p=r.y??(c.y+u.y)/2):(g=r.x??(c.x+u.x)/2,p=r.y??c.y+(u.y-c.y)*a);const e=[{x:g,y:c.y},{x:g,y:u.y}],t=[{x:c.x,y:p},{x:u.x,y:p}];m=s[h]===f?"x"===h?e:t:"x"===h?t:e}else{const r=[{x:c.x,y:u.y}],a=[{x:u.x,y:c.y}];if(m="x"===h?s.x===f?a:r:s.y===f?r:a,t===o){const t=Math.abs(e[h]-n[h]);if(t<=i){const o=Math.min(i-1,i-t);s[h]===f?y[h]=(c[h]>e[h]?-1:1)*o:v[h]=(u[h]>n[h]?-1:1)*o}}if(t!==o){const e="x"===h?"y":"x",t=s[h]===l[e],n=c[e]>u[e],o=c[e]<u[e];(1===s[h]&&(!t&&n||t&&o)||1!==s[h]&&(!t&&o||t&&n))&&(m="x"===h?r:a)}const d={x:c.x+y.x,y:c.y+y.y},x={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(x.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(x.y-m[0].y))?(g=(d.x+x.x)/2,p=m[0].y):(g=m[0].x,p=(d.y+x.y)/2)}return[[e,{x:c.x+y.x,y:c.y+y.y},...m,{x:u.x+v.x,y:u.y+v.y},n],g,p,x,w]}function yr({sourceX:e,sourceY:t,sourcePosition:n=go.Bottom,targetX:o,targetY:r,targetPosition:i=go.Top,borderRadius:a=5,centerX:s,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,h,f,g,p]=mr({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:s,y:l},offset:c,stepPosition:u});return[d.reduce((e,t,n)=>{let o="";return o=n>0&&n<d.length-1?function(e,t,n,o){const r=Math.min(pr(e,t)/2,pr(t,n)/2,o),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a)return`L ${i+r*(e.x<n.x?-1:1)},${a}Q ${i},${a} ${i},${a+r*(e.y<n.y?1:-1)}`;const s=e.x<n.x?1:-1;return`L ${i},${a+r*(e.y<n.y?-1:1)}Q ${i},${a} ${i+r*s},${a}`}(d[n-1],t,d[n+1],a):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=o},""),h,f,g,p]}function vr(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function xr(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,"source"===o.type?t.push(o):"target"===o.type&&n.push(o);return{source:t,target:n}}function wr(e,t,n=go.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:s}=t??Wo(e);if(o)return{x:r+a/2,y:i+s/2};switch(t?.position??n){case go.Top:return{x:r+a/2,y:i};case go.Right:return{x:r+a,y:i+s/2};case go.Bottom:return{x:r+a/2,y:i+s};case go.Left:return{x:r,y:i+s/2}}}function br(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Sr(e,t){if(!e)return"";if("string"==typeof e)return e;return`${t?`${t}__`:""}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`}const Cr={nodeOrigin:[0,0],nodeExtent:ro,elevateNodesOnSelect:!0,defaults:{}},Er={...Cr,checkEquality:!0};function kr(e,t){const n={...e};for(const e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function Nr(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const t of e.handles){const r={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};"source"===t.type?n.push(r):"target"===t.type&&o.push(r)}return{source:n,target:o}}function _r(e,t,n,o){const r=kr(Er,o);let i={i:-1},a=e.length>0;const s=new Map(t),l=r?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const c of e){let e=s.get(c.id);if(r.checkEquality&&c===e?.internals.userNode)t.set(c.id,e);else{const n=xo(c,r.nodeOrigin),o=Fo(c.extent)?c.extent:r.nodeExtent,i=No(n,o,Wo(c));e={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:i,handleBounds:Nr(c,e),z:Pr(c,l),userNode:c}},t.set(c.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(a=!1),c.parentId&&Mr(e,t,n,o,i)}return a}function Mr(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:s}=kr(Cr,o),l=e.parentId,c=t.get(l);if(!c)return void console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}(e,n),r&&!c.parentId&&void 0===c.internals.rootParentIndex&&(c.internals.rootParentIndex=++r.i,c.internals.z=c.internals.z+10*r.i),r&&void 0!==c.internals.rootParentIndex&&(r.i=c.internals.rootParentIndex);const u=i?1e3:0,{x:d,y:h,z:f}=function(e,t,n,o,r){const{x:i,y:a}=t.internals.positionAbsolute,s=Wo(e),l=xo(e,n),c=Fo(e.extent)?No(l,e.extent,s):l;let u=No({x:i+c.x,y:a+c.y},o,s);"parent"===e.extent&&(u=_o(u,s,t));const d=Pr(e,r),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=d?h+1:d}}(e,c,a,s,u),{positionAbsolute:g}=e.internals,p=d!==g.x||h!==g.y;(p||f!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:p?{x:d,y:h}:g,z:f}})}function Pr(e,t){return(To(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Dr(e,t,n,o=[0,0]){const r=[],i=new Map;for(const n of e){const e=t.get(n.parentId);if(!e)continue;const o=i.get(n.parentId)?.expandedRect??Io(e),r=Ro(o,n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach(({expandedRect:t,parent:i},a)=>{const s=i.internals.positionAbsolute,l=Wo(i),c=i.origin??o,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,h=Math.max(l.width,Math.round(t.width)),f=Math.max(l.height,Math.round(t.height)),g=(h-l.width)*c[0],p=(f-l.height)*c[1];(u>0||d>0||g||p)&&(r.push({id:a,type:"position",position:{x:i.position.x-u+g,y:i.position.y-d+p}}),n.get(a)?.forEach(t=>{e.some(e=>e.id===t.id)||r.push({id:t.id,type:"position",position:{x:t.position.x+u,y:t.position.y+d}})})),(l.width<t.width||l.height<t.height||u||d)&&r.push({id:a,type:"dimensions",setAttributes:!0,dimensions:{width:h+(u?c[0]*u-g:0),height:f+(d?c[1]*d-p:0)}})}),r}function Or(e,t,n,o,r,i){let a=r;const s=o.get(a)||new Map;o.set(a,s.set(n,t)),a=`${r}-${e}`;const l=o.get(a)||new Map;if(o.set(a,l.set(n,t)),i){a=`${r}-${e}-${i}`;const s=o.get(a)||new Map;o.set(a,s.set(n,t))}}function zr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=o,s={edgeId:o.id,source:n,target:r,sourceHandle:i,targetHandle:a},l=`${n}-${i}--${r}-${a}`;Or("source",s,`${r}-${a}--${n}-${i}`,e,n,i),Or("target",s,l,e,r,a),t.set(o.id,o)}}function Ir(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Ir(n,t))}function Ar(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Rr({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[e,i]of t){const t=n.get(e)?.internals.userNode;t&&r.push({...t,position:i.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Lr({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},a=0,s=new Map,l=!1,c={x:0,y:0},u=null,d=!1,h=null,f=!1,g=!1,p=null;return{update:function({noDragClassName:m,handleSelector:y,domNode:v,isSelectable:x,nodeId:w,nodeClickDistance:b=0}){function S({x:e,y:n}){const{nodeLookup:r,nodeExtent:a,snapGrid:l,snapToGrid:c,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:h,onError:f,updateNodePositions:m}=t();i={x:e,y:n};let y=!1;const v=s.size>1,x=v&&a?Oo(wo(s)):null,b=v&&c?function({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},a=jo(i,t);return{x:a.x-i.x,y:a.y-i.y}}({dragItems:s,snapGrid:l,x:e,y:n}):null;for(const[t,o]of s){if(!r.has(t))continue;let i={x:e-o.distance.x,y:n-o.distance.y};c&&(i=b?{x:Math.round(i.x+b.x),y:Math.round(i.y+b.y)}:jo(i,l));let s=null;if(v&&a&&!o.extent&&x){const{positionAbsolute:e}=o.internals,t=e.x-x.x+a[0][0],n=e.x+o.measured.width-x.x2+a[1][0];s=[[t,e.y-x.y+a[0][1]],[n,e.y+o.measured.height-x.y2+a[1][1]]]}const{position:d,positionAbsolute:h}=Co({nodeId:t,nextPosition:i,nodeLookup:r,nodeExtent:s||a,nodeOrigin:u,onError:f});y=y||o.position.x!==d.x||o.position.y!==d.y,o.position=d,o.internals.positionAbsolute=h}if(g=g||y,y&&(m(s,!0),p&&(o||d||!w&&h))){const[e,t]=Rr({nodeId:w,dragItems:s,nodeLookup:r});o?.(p,s,e,t),d?.(p,e,t),w||h?.(p,t)}}async function C(){if(!u)return;const{transform:e,panBy:n,autoPanSpeed:o,autoPanOnNodeDrag:r}=t();if(!r)return l=!1,void cancelAnimationFrame(a);const[s,d]=Po(c,u,o);0===s&&0===d||(i.x=(i.x??0)-s/e[2],i.y=(i.y??0)-d/e[2],await n({x:s,y:d})&&S(i)),a=requestAnimationFrame(C)}function E(o){const{nodeLookup:r,multiSelectionActive:a,nodesDraggable:l,transform:c,snapGrid:h,snapToGrid:f,selectNodesOnDrag:g,onNodeDragStart:p,onSelectionDragStart:m,unselectNodesAndEdges:y}=t();d=!0,g&&x||a||!w||r.get(w)?.selected||y(),x&&g&&w&&e?.(w);const v=Qo(o.sourceEvent,{transform:c,snapGrid:h,snapToGrid:f,containerBounds:u});if(i=v,s=function(e,t,n,o){const r=new Map;for(const[i,a]of e)if((a.selected||a.id===o)&&(!a.parentId||!Ir(a,e))&&(a.draggable||t&&void 0===a.draggable)){const t=e.get(i);t&&r.set(i,{id:i,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return r}(r,l,v,w),s.size>0&&(n||p||!w&&m)){const[e,t]=Rr({nodeId:w,dragItems:s,nodeLookup:r});n?.(o.sourceEvent,s,e,t),p?.(o.sourceEvent,e,t),w||m?.(o.sourceEvent,t)}}h=be(v);const k=Re().clickDistance(b).on("start",e=>{const{domNode:n,nodeDragThreshold:o,transform:r,snapGrid:a,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,f=!1,g=!1,p=e.sourceEvent,0===o&&E(e);const l=Qo(e.sourceEvent,{transform:r,snapGrid:a,snapToGrid:s,containerBounds:u});i=l,c=rr(e.sourceEvent,u)}).on("drag",e=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:a,nodeDragThreshold:h,nodeLookup:g}=t(),m=Qo(e.sourceEvent,{transform:o,snapGrid:r,snapToGrid:a,containerBounds:u});if(p=e.sourceEvent,("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||w&&!g.has(w))&&(f=!0),!f){if(!l&&n&&d&&(l=!0,C()),!d){const t=rr(e.sourceEvent,u),n=t.x-c.x,o=t.y-c.y;Math.sqrt(n*n+o*o)>h&&E(e)}(i.x!==m.xSnapped||i.y!==m.ySnapped)&&s&&d&&(c=rr(e.sourceEvent,u),S(m))}}).on("end",e=>{if(d&&!f&&(l=!1,d=!1,cancelAnimationFrame(a),s.size>0)){const{nodeLookup:n,updateNodePositions:o,onNodeDragStop:i,onSelectionDragStop:a}=t();if(g&&(o(s,!1),g=!1),r||i||!w&&a){const[t,o]=Rr({nodeId:w,dragItems:s,nodeLookup:n,dragging:!1});r?.(e.sourceEvent,s,t,o),i?.(e.sourceEvent,t,o),w||a?.(e.sourceEvent,o)}}}).filter(e=>{const t=e.target;return!e.button&&(!m||!Ar(t,`.${m}`,v))&&(!y||Ar(t,y,v))});h.call(k)},destroy:function(){h?.on(".drag",null)}}}function $r(e,t,n,o){let r=[],i=1/0;const a=function(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const e of t.values())Lo(r,Io(e))>0&&o.push(e);return o}(e,n,t+250);for(const n of a){const a=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(const s of a){if(o.nodeId===s.nodeId&&o.type===s.type&&o.id===s.id)continue;const{x:a,y:l}=wr(n,s,s.position,!0),c=Math.sqrt(Math.pow(a-e.x,2)+Math.pow(l-e.y,2));c>t||(c<i?(r=[{...s,x:a,y:l}],i=c):c===i&&r.push({...s,x:a,y:l}))}}if(!r.length)return null;if(r.length>1){const e="source"===o.type?"target":"source";return r.find(t=>t.type===e)??r[0]}return r[0]}function Tr(e,t,n,o,r,i=!1){const a=o.get(e);if(!a)return null;const s="strict"===r?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],l=(n?s?.find(e=>e.id===n):s?.[0])??null;return l&&i?{...l,...wr(a,l,l.position,!0)}:l}function Br(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}const jr=()=>!0;function Vr(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:a,lib:s,flowId:l,isValidConnection:c=jr,nodeLookup:u}){const d="target"===i,h=t?a.querySelector(`.${s}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:f,y:g}=rr(e),p=a.elementFromPoint(f,g),m=p?.classList.contains(`${s}-flow__handle`)?p:h,y={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const e=Br(void 0,m),t=m.getAttribute("data-nodeid"),i=m.getAttribute("data-handleid"),a=m.classList.contains("connectable"),s=m.classList.contains("connectableend");if(!t||!e)return y;const l={source:d?t:o,sourceHandle:d?i:r,target:d?o:t,targetHandle:d?r:i};y.connection=l;const h=a&&s&&(n===so.Strict?d&&"source"===e||!d&&"target"===e:t!==o||i!==r);y.isValid=h&&c(l),y.toHandle=Tr(t,e,i,u,n,!0)}return y}const Hr={onPointerDown:function(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:a,domNode:s,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:h,cancelConnection:f,onConnectStart:g,onConnect:p,onConnectEnd:m,isValidConnection:y=jr,onReconnectEnd:v,updateConnection:x,getTransform:w,getFromHandle:b,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:E}){const k=er(e.target);let N,_=0;const{x:M,y:P}=rr(e),D=Br(i,E),O=s?.getBoundingClientRect();let z=!1;if(!O||!D)return;const I=Tr(r,D,o,l,t);if(!I)return;let A=rr(e,O),R=!1,L=null,$=!1,T=null;function B(){if(!u||!O)return;const[e,t]=Po(A,O,S);h({x:e,y:t}),_=requestAnimationFrame(B)}const j={...I,nodeId:r,type:D,position:I.position},V=l.get(r);let H={inProgress:!0,isValid:null,from:wr(V,j,go.Left,!0),fromHandle:j,fromPosition:j.position,fromNode:V,to:A,toHandle:null,toPosition:po[j.position],toNode:null};function Z(){z=!0,x(H),g?.(e,{nodeId:r,handleId:o,handleType:D})}function X(e){if(!z){const{x:t,y:n}=rr(e),o=t-M,r=n-P;if(!(o*o+r*r>C*C))return;Z()}if(!b()||!j)return void Y(e);const i=w();A=rr(e,O),N=$r(Vo(A,i,!1,[1,1]),n,l,j),R||(B(),R=!0);const s=Vr(e,{handle:N,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:a?"target":"source",isValidConnection:y,doc:k,lib:c,flowId:d,nodeLookup:l});T=s.handleDomNode,L=s.connection,$=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!N,s.isValid);const u={...H,isValid:$,to:s.toHandle&&$?Ho({x:s.toHandle.x,y:s.toHandle.y},i):A,toHandle:s.toHandle,toPosition:$&&s.toHandle?s.toHandle.position:po[j.position],toNode:s.toHandle?l.get(s.toHandle.nodeId):null};$&&N&&H.toHandle&&u.toHandle&&H.toHandle.type===u.toHandle.type&&H.toHandle.nodeId===u.toHandle.nodeId&&H.toHandle.id===u.toHandle.id&&H.to.x===u.to.x&&H.to.y===u.to.y||(x(u),H=u)}function Y(e){if(!("touches"in e&&e.touches.length>0)){if(z){(N||T)&&L&&$&&p?.(L);const{inProgress:t,...n}=H,o={...n,toPosition:H.toHandle?H.toPosition:null};m?.(e,o),i&&v?.(e,o)}f(),cancelAnimationFrame(_),R=!1,$=!1,L=null,T=null,k.removeEventListener("mousemove",X),k.removeEventListener("mouseup",Y),k.removeEventListener("touchmove",X),k.removeEventListener("touchend",Y)}}0===C&&Z(),k.addEventListener("mousemove",X),k.addEventListener("mouseup",Y),k.addEventListener("touchmove",X),k.addEventListener("touchend",Y)},isValid:Vr};const Zr=e=>({x:e.x,y:e.y,zoom:e.k}),Xr=({x:e,y:t,zoom:n})=>$n.translate(e,t).scale(n),Yr=(e,t)=>e.target.closest(`.${t}`),Fr=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),Wr=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Kr=(e,t=0,n=Wr,o=()=>{})=>{const r="number"==typeof t&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Gr=e=>{const t=e.ctrlKey&&Yo()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function qr({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:s,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=Wn().scaleExtent([t,n]).translateExtent(o),h=be(e).call(d);y({x:r.x,y:r.y,zoom:ko(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const f=h.on("wheel.zoom"),g=h.on("dblclick.zoom");function p(e,t){return h?new Promise(n=>{d?.interpolate("linear"===t?.interpolate?Mt:Bt).transform(Kr(h,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function m(){d.on("zoom",null)}async function y(e,t,n){const o=Xr(e),r=d?.constrain()(o,t,n);return r&&await p(r),new Promise(e=>e(r))}return d.wheelDelta(Gr),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:o,panOnScroll:r,panOnDrag:u,panOnScrollMode:p,panOnScrollSpeed:y,preventScrolling:v,zoomOnPinch:x,zoomOnScroll:w,zoomOnDoubleClick:b,zoomActivationKeyPressed:S,lib:C,onTransformChange:E,connectionInProgress:k,paneClickDistance:N,selectionOnDrag:_}){o&&!c.isZoomingOrPanning&&m();const M=r&&!S&&!o;d.clickDistance(_?1/0:!To(N)||N<0?0:N);const P=M?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:s,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Yr(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&a){const e=Se(u),t=Gr(u),r=d*Math.pow(2,t);return void o.scaleTo(n,r,e,u)}const h=1===u.deltaMode?20:1;let f=r===lo.Vertical?0:u.deltaX*h,g=r===lo.Horizontal?0:u.deltaY*h;!Yo()&&u.shiftKey&&r!==lo.Vertical&&(f=u.deltaY*h,g=0),o.translateBy(n,-f/d*i,-g/d*i,{internal:!0});const p=Zr(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,p),e.panScrollTimeout=setTimeout(()=>{c?.(u,p),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,p))}}({zoomPanValues:c,noWheelClassName:e,d3Selection:h,d3Zoom:d,panOnScrollMode:p,panOnScrollSpeed:y,zoomOnPinch:x,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:s}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i="wheel"===o.type,a=!t&&i&&!o.ctrlKey,s=Yr(o,e);if(o.ctrlKey&&i&&s&&o.preventDefault(),a||s)return null;o.preventDefault(),n.call(this,o,r)}}({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:f});if(h.on("wheel.zoom",P,{passive:!1}),!o){const e=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Zr(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,"mousedown"===o.sourceEvent?.type&&t(!0),n&&n?.(o.sourceEvent,r)}}({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:a});d.on("start",e);const t=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!(!n||!Fr(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Zr(i.transform))}}({zoomPanValues:c,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:i,onTransformChange:E});d.on("zoom",t);const o=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Fr(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const t=Zr(a.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(a.sourceEvent,t)},n?150:0)}}}({zoomPanValues:c,panOnDrag:u,panOnScroll:r,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:l});d.on("end",o)}const D=function({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:s,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const h=e||t,f=n&&d.ctrlKey,g="wheel"===d.type;if(1===d.button&&"mousedown"===d.type&&(Yr(d,`${c}-flow__node`)||Yr(d,`${c}-flow__edge`)))return!0;if(!(o||h||r||i||n))return!1;if(a)return!1;if(u&&!g)return!1;if(Yr(d,s)&&g)return!1;if(Yr(d,l)&&(!g||r&&g&&!e))return!1;if(!n&&d.ctrlKey&&g)return!1;if(!n&&"touchstart"===d.type&&d.touches?.length>1)return d.preventDefault(),!1;if(!h&&!r&&!f&&g)return!1;if(!o&&("mousedown"===d.type||"touchstart"===d.type))return!1;if(Array.isArray(o)&&!o.includes(d.button)&&"mousedown"===d.type)return!1;const p=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||g)&&p}}({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:w,panOnScroll:r,zoomOnDoubleClick:b,zoomOnPinch:x,userSelectionActive:o,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:k});d.filter(D),b?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)},destroy:m,setViewport:async function(e,t){const n=Xr(e);return await p(n,t),new Promise(e=>e(n))},setViewportConstrained:y,getViewport:function(){const e=h?Tn(h.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,t){return h?new Promise(n=>{d?.interpolate("linear"===t?.interpolate?Mt:Bt).scaleTo(Kr(h,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)},scaleBy:function(e,t){return h?new Promise(n=>{d?.interpolate("linear"===t?.interpolate?Mt:Bt).scaleBy(Kr(h,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)},setScaleExtent:function(e){d?.scaleExtent(e)},setTranslateExtent:function(e){d?.translateExtent(e)},syncViewport:function(e){if(h){const t=Xr(e),n=h.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||d?.transform(h,t,null,{sync:!0})}},setClickDistance:function(e){const t=!To(e)||e<0?0:e;d?.clickDistance(t)}}}var Ur;function Qr(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}function Jr(e,t){return Math.max(0,t-e)}function ei(e,t){return Math.max(0,e-t)}function ti(e,t,n){return Math.max(0,t-e,e-n)}function ni(e,t){return e?!t:t}!function(e){e.Line="line",e.Handle="handle"}(Ur||(Ur={}));const oi={width:0,height:0,x:0,y:0},ri={...oi,pointerX:0,pointerY:0,aspectRatio:1};function ii(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,s=n[0]*i,l=n[1]*a;return[[o-s,r-l],[o+i-s,r+a-l]]}function ai({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=be(e);let a={controlDirection:Qr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function({controlPosition:e,boundaries:s,keepAspectRatio:l,resizeDirection:c,onResizeStart:u,onResize:d,onResizeEnd:h,shouldResize:f}){let g,p={...oi},m={...ri};a={boundaries:s,resizeDirection:c,keepAspectRatio:l,controlDirection:Qr(e)};let y,v,x,w=null,b=[],S=!1;const C=Re().on("start",e=>{const{nodeLookup:o,transform:r,snapGrid:i,snapToGrid:a,nodeOrigin:s,paneDomNode:l}=n();if(g=o.get(t),!g)return;w=l?.getBoundingClientRect()??null;const{xSnapped:c,ySnapped:d}=Qo(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:a,containerBounds:w});p={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},m={...p,pointerX:c,pointerY:d,aspectRatio:p.width/p.height},y=void 0,g.parentId&&("parent"===g.extent||g.expandParent)&&(y=o.get(g.parentId),v=y&&"parent"===g.extent?function(e){return[[0,0],[e.measured.width,e.measured.height]]}(y):void 0),b=[],x=void 0;for(const[e,n]of o)if(n.parentId===t&&(b.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){const e=ii(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...p})}).on("drag",e=>{const{transform:t,snapGrid:r,snapToGrid:i,nodeOrigin:s}=n(),l=Qo(e.sourceEvent,{transform:t,snapGrid:r,snapToGrid:i,containerBounds:w}),c=[];if(!g)return;const{x:u,y:h,width:C,height:E}=p,k={},N=g.origin??s,{width:_,height:M,x:P,y:D}=function(e,t,n,o,r,i,a,s){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,h=u&&d,{xSnapped:f,ySnapped:g}=n,{minWidth:p,maxWidth:m,minHeight:y,maxHeight:v}=o,{x:x,y:w,width:b,height:S,aspectRatio:C}=e;let E=Math.floor(u?f-e.pointerX:0),k=Math.floor(d?g-e.pointerY:0);const N=b+(l?-E:E),_=S+(c?-k:k),M=-i[0]*b,P=-i[1]*S;let D=ti(N,p,m),O=ti(_,y,v);if(a){let e=0,t=0;l&&E<0?e=Jr(x+E+M,a[0][0]):!l&&E>0&&(e=ei(x+N+M,a[1][0])),c&&k<0?t=Jr(w+k+P,a[0][1]):!c&&k>0&&(t=ei(w+_+P,a[1][1])),D=Math.max(D,e),O=Math.max(O,t)}if(s){let e=0,t=0;l&&E>0?e=ei(x+E,s[0][0]):!l&&E<0&&(e=Jr(x+N,s[1][0])),c&&k>0?t=ei(w+k,s[0][1]):!c&&k<0&&(t=Jr(w+_,s[1][1])),D=Math.max(D,e),O=Math.max(O,t)}if(r){if(u){const e=ti(N/C,y,v)*C;if(D=Math.max(D,e),a){let e=0;e=!l&&!c||l&&!c&&h?ei(w+P+N/C,a[1][1])*C:Jr(w+P+(l?E:-E)/C,a[0][1])*C,D=Math.max(D,e)}if(s){let e=0;e=!l&&!c||l&&!c&&h?Jr(w+N/C,s[1][1])*C:ei(w+(l?E:-E)/C,s[0][1])*C,D=Math.max(D,e)}}if(d){const e=ti(_*C,p,m)/C;if(O=Math.max(O,e),a){let e=0;e=!l&&!c||c&&!l&&h?ei(x+_*C+M,a[1][0])/C:Jr(x+(c?k:-k)*C+M,a[0][0])/C,O=Math.max(O,e)}if(s){let e=0;e=!l&&!c||c&&!l&&h?Jr(x+_*C,s[1][0])/C:ei(x+(c?k:-k)*C,s[0][0])/C,O=Math.max(O,e)}}}k+=k<0?O:-O,E+=E<0?D:-D,r&&(h?N>_*C?k=(ni(l,c)?-E:E)/C:E=(ni(l,c)?-k:k)*C:u?(k=E/C,c=l):(E=k*C,l=c));const z=l?x+E:x,I=c?w+k:w;return{width:b+(l?-E:E),height:S+(c?-k:k),x:i[0]*E*(l?-1:1)+z,y:i[1]*k*(c?-1:1)+I}}(m,a.controlDirection,l,a.boundaries,a.keepAspectRatio,N,v,x),O=_!==C,z=M!==E,I=P!==u&&O,A=D!==h&&z;if(!(I||A||O||z))return;if((I||A||1===N[0]||1===N[1])&&(k.x=I?P:p.x,k.y=A?D:p.y,p.x=k.x,p.y=k.y,b.length>0)){const e=P-u,t=D-h;for(const n of b)n.position={x:n.position.x-e+N[0]*(_-C),y:n.position.y-t+N[1]*(M-E)},c.push(n)}if((O||z)&&(k.width=!O||a.resizeDirection&&"horizontal"!==a.resizeDirection?p.width:_,k.height=!z||a.resizeDirection&&"vertical"!==a.resizeDirection?p.height:M,p.width=k.width,p.height=k.height),y&&g.expandParent){const e=N[0]*(k.width??0);k.x&&k.x<e&&(p.x=e,m.x=m.x-(k.x-e));const t=N[1]*(k.height??0);k.y&&k.y<t&&(p.y=t,m.y=m.y-(k.y-t))}const R=function({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const a=e-t,s=n-o,l=[a>0?1:a<0?-1:0,s>0?1:s<0?-1:0];return a&&r&&(l[0]=-1*l[0]),s&&i&&(l[1]=-1*l[1]),l}({width:p.width,prevWidth:C,height:p.height,prevHeight:E,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),L={...p,direction:R},$=f?.(e,L);!1!==$&&(S=!0,d?.(e,L),o(k,c))}).on("end",e=>{S&&(h?.(e,{...p}),r?.({...p}),S=!1)});i.call(C)},destroy:function(){i.on(".drag",null)}}}function si(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var li,ci,ui,di={exports:{}},hi={},fi={exports:{}},gi={};function pi(){return ci||(ci=1,fi.exports=function(){if(li)return gi;li=1;var e=n,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=e.useState,r=e.useEffect,i=e.useLayoutEffect,a=e.useDebugValue;function s(e){var n=e.getSnapshot;e=e.value;try{var o=n();return!t(e,o)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),l=o({inst:{value:n,getSnapshot:t}}),c=l[0].inst,u=l[1];return i(function(){c.value=n,c.getSnapshot=t,s(c)&&u({inst:c})},[e,n,t]),r(function(){return s(c)&&u({inst:c}),e(function(){s(c)&&u({inst:c})})},[e]),a(n),n};return gi.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,gi}()),fi.exports}
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).HeatmapReact={},e.jsxRuntime,e.React)}(this,function(e,t,n){"use strict";function o(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,r=0;r<e.length;r++)""!==(n=o(e[r]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var r={value:()=>{}};function i(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new a(o)}function a(e){this._=e}function s(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function l(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=r,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}a.prototype=i.prototype={constructor:a,on:function(e,t){var n,o,r=this._,i=(o=r,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),a=-1,c=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a<c;)if(n=(e=i[a]).type)r[n]=l(r[n],e.name,t);else if(null==t)for(n in r)r[n]=l(r[n],e.name,null);return this}for(;++a<c;)if((n=(e=i[a]).type)&&(n=s(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new a(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(o=this._[e]).length;i<n;++i)o[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};var c="http://www.w3.org/1999/xhtml",u={svg:"http://www.w3.org/2000/svg",xhtml:c,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function d(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),u.hasOwnProperty(t)?{space:u[t],local:e}:e}function h(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===c&&t.documentElement.namespaceURI===c?t.createElement(e):t.createElementNS(n,e)}}function f(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function g(e){var t=d(e);return(t.local?f:h)(t)}function p(){}function m(e){return null==e?p:function(){return this.querySelector(e)}}function y(){return[]}function v(e){return null==e?y:function(){return this.querySelectorAll(e)}}function x(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}function w(e){return function(){return this.matches(e)}}function b(e){return function(t){return t.matches(e)}}var S=Array.prototype.find;function C(){return this.firstElementChild}var E=Array.prototype.filter;function k(){return Array.from(this.children)}function N(e){return new Array(e.length)}function _(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function M(e,t,n,o,r,i){for(var a,s=0,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new _(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function P(e,t,n,o,r,i,a){var s,l,c,u=new Map,d=t.length,h=i.length,f=new Array(d);for(s=0;s<d;++s)(l=t[s])&&(f[s]=c=a.call(l,l.__data__,s,t)+"",u.has(c)?r[s]=l:u.set(c,l));for(s=0;s<h;++s)c=a.call(e,i[s],s,i)+"",(l=u.get(c))?(o[s]=l,l.__data__=i[s],u.delete(c)):n[s]=new _(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&u.get(f[s])===l&&(r[s]=l)}function D(e){return e.__data__}function O(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function z(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function I(e){return function(){this.removeAttribute(e)}}function A(e){return function(){this.removeAttributeNS(e.space,e.local)}}function R(e,t){return function(){this.setAttribute(e,t)}}function L(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function $(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function T(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function B(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function j(e){return function(){this.style.removeProperty(e)}}function V(e,t,n){return function(){this.style.setProperty(e,t,n)}}function H(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Z(e,t){return e.style.getPropertyValue(t)||B(e).getComputedStyle(e,null).getPropertyValue(t)}function X(e){return function(){delete this[e]}}function Y(e,t){return function(){this[e]=t}}function F(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function W(e){return e.trim().split(/^|\s+/)}function K(e){return e.classList||new G(e)}function G(e){this._node=e,this._names=W(e.getAttribute("class")||"")}function q(e,t){for(var n=K(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function U(e,t){for(var n=K(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Q(e){return function(){q(this,e)}}function J(e){return function(){U(this,e)}}function ee(e,t){return function(){(t.apply(this,arguments)?q:U)(this,e)}}function te(){this.textContent=""}function ne(e){return function(){this.textContent=e}}function oe(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function re(){this.innerHTML=""}function ie(e){return function(){this.innerHTML=e}}function ae(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function se(){this.nextSibling&&this.parentNode.appendChild(this)}function le(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ce(){return null}function ue(){var e=this.parentNode;e&&e.removeChild(this)}function de(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function he(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function fe(e){return function(){var t=this.__on;if(t){for(var n,o=0,r=-1,i=t.length;o<i;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?t.length=r:delete this.__on}}}function ge(e,t,n){return function(){var o,r=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(r)for(var a=0,s=r.length;a<s;++a)if((o=r[a]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=t);this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function pe(e,t,n){var o=B(e),r=o.CustomEvent;"function"==typeof r?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function me(e,t){return function(){return pe(this,e,t)}}function ye(e,t){return function(){return pe(this,e,t.apply(this,arguments))}}_.prototype={constructor:_,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},G.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var ve=[null];function xe(e,t){this._groups=e,this._parents=t}function we(){return new xe([[document.documentElement]],ve)}function be(e){return"string"==typeof e?new xe([[document.querySelector(e)]],[document.documentElement]):new xe([[e]],ve)}function Se(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}xe.prototype=we.prototype={constructor:xe,select:function(e){"function"!=typeof e&&(e=m(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a,s=t[r],l=s.length,c=o[r]=new Array(l),u=0;u<l;++u)(i=s[u])&&(a=e.call(i,i.__data__,u,s))&&("__data__"in i&&(a.__data__=i.__data__),c[u]=a);return new xe(o,this._parents)},selectAll:function(e){e="function"==typeof e?x(e):v(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var a,s=t[i],l=s.length,c=0;c<l;++c)(a=s[c])&&(o.push(e.call(a,a.__data__,c,s)),r.push(a));return new xe(o,r)},selectChild:function(e){return this.select(null==e?C:function(e){return function(){return S.call(this.children,e)}}("function"==typeof e?e:b(e)))},selectChildren:function(e){return this.selectAll(null==e?k:function(e){return function(){return E.call(this.children,e)}}("function"==typeof e?e:b(e)))},filter:function(e){"function"!=typeof e&&(e=w(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a=t[r],s=a.length,l=o[r]=[],c=0;c<s;++c)(i=a[c])&&e.call(i,i.__data__,c,a)&&l.push(i);return new xe(o,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,D);var n,o=t?P:M,r=this._parents,i=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var a=i.length,s=new Array(a),l=new Array(a),c=new Array(a),u=0;u<a;++u){var d=r[u],h=i[u],f=h.length,g=O(e.call(d,d&&d.__data__,u,r)),p=g.length,m=l[u]=new Array(p),y=s[u]=new Array(p);o(d,h,m,y,c[u]=new Array(f),g,t);for(var v,x,w=0,b=0;w<p;++w)if(v=m[w]){for(w>=b&&(b=w+1);!(x=y[b])&&++b<p;);v._next=x||null}}return(s=new xe(s,r))._enter=l,s._exit=c,s},enter:function(){return new xe(this._enter||this._groups.map(N),this._parents)},exit:function(){return new xe(this._exit||this._groups.map(N),this._parents)},join:function(e,t,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(r=t(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,a=Math.min(r,i),s=new Array(r),l=0;l<a;++l)for(var c,u=n[l],d=o[l],h=u.length,f=s[l]=new Array(h),g=0;g<h;++g)(c=u[g]||d[g])&&(f[g]=c);for(;l<r;++l)s[l]=n[l];return new xe(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,r=e[t],i=r.length-1,a=r[i];--i>=0;)(o=r[i])&&(a&&4^o.compareDocumentPosition(a)&&a.parentNode.insertBefore(o,a),a=o);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=z);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var a,s=n[i],l=s.length,c=r[i]=new Array(l),u=0;u<l;++u)(a=s[u])&&(c[u]=a);c.sort(t)}return new xe(r,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var a=o[r];if(a)return a}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r,i=t[n],a=0,s=i.length;a<s;++a)(r=i[a])&&e.call(r,r.__data__,a,i);return this},attr:function(e,t){var n=d(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?A:I:"function"==typeof t?n.local?T:$:n.local?L:R)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?j:"function"==typeof t?H:V)(e,t,null==n?"":n)):Z(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?X:"function"==typeof t?F:Y)(e,t)):this.node()[e]},classed:function(e,t){var n=W(e+"");if(arguments.length<2){for(var o=K(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?ee:t?Q:J)(n,t))},text:function(e){return arguments.length?this.each(null==e?te:("function"==typeof e?oe:ne)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?re:("function"==typeof e?ae:ie)(e)):this.node().innerHTML},raise:function(){return this.each(se)},lower:function(){return this.each(le)},append:function(e){var t="function"==typeof e?e:g(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:g(e),o=null==t?ce:"function"==typeof t?t:m(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})},remove:function(){return this.each(ue)},clone:function(e){return this.select(e?he:de)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var o,r,i=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),a=i.length;if(!(arguments.length<2)){for(s=t?ge:fe,o=0;o<a;++o)this.each(s(i[o],t,n));return this}var s=this.node().__on;if(s)for(var l,c=0,u=s.length;c<u;++c)for(o=0,l=s[c];o<a;++o)if((r=i[o]).type===l.type&&r.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?ye:me)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,r=e[t],i=0,a=r.length;i<a;++i)(o=r[i])&&(yield o)}};const Ce={passive:!1},Ee={capture:!0,passive:!1};function ke(e){e.stopImmediatePropagation()}function Ne(e){e.preventDefault(),e.stopImmediatePropagation()}function _e(e){var t=e.document.documentElement,n=be(e).on("dragstart.drag",Ne,Ee);"onselectstart"in t?n.on("selectstart.drag",Ne,Ee):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Me(e,t){var n=e.document.documentElement,o=be(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ne,Ee),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Pe=e=>()=>e;function De(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:a,y:s,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function Oe(e){return!e.ctrlKey&&!e.button}function ze(){return this.parentNode}function Ie(e,t){return null==t?{x:e.x,y:e.y}:t}function Ae(){return navigator.maxTouchPoints||"ontouchstart"in this}function Re(){var e,t,n,o,r=Oe,a=ze,s=Ie,l=Ae,c={},u=i("start","drag","end"),d=0,h=0;function f(e){e.on("mousedown.drag",g).filter(l).on("touchstart.drag",y).on("touchmove.drag",v,Ce).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(i,s){if(!o&&r.call(this,i,s)){var l=w(this,a.call(this,i,s),i,s,"mouse");l&&(be(i.view).on("mousemove.drag",p,Ee).on("mouseup.drag",m,Ee),_e(i.view),ke(i),n=!1,e=i.clientX,t=i.clientY,l("start",i))}}function p(o){if(Ne(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>h}c.mouse("drag",o)}function m(e){be(e.view).on("mousemove.drag mouseup.drag",null),Me(e.view,n),Ne(e),c.mouse("end",e)}function y(e,t){if(r.call(this,e,t)){var n,o,i=e.changedTouches,s=a.call(this,e,t),l=i.length;for(n=0;n<l;++n)(o=w(this,s,e,t,i[n].identifier,i[n]))&&(ke(e),o("start",e,i[n]))}}function v(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=c[o[t].identifier])&&(Ne(e),n("drag",e,o[t]))}function x(e){var t,n,r=e.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout(function(){o=null},500),t=0;t<i;++t)(n=c[r[t].identifier])&&(ke(e),n("end",e,r[t]))}function w(e,t,n,o,r,i){var a,l,h,g=u.copy(),p=Se(i||n,t);if(null!=(h=s.call(e,new De("beforestart",{sourceEvent:n,target:f,identifier:r,active:d,x:p[0],y:p[1],dx:0,dy:0,dispatch:g}),o)))return a=h.x-p[0]||0,l=h.y-p[1]||0,function n(i,s,u){var m,y=p;switch(i){case"start":c[r]=n,m=d++;break;case"end":delete c[r],--d;case"drag":p=Se(u||s,t),m=d}g.call(i,e,new De(i,{sourceEvent:s,subject:h,target:f,identifier:r,active:m,x:p[0]+a,y:p[1]+l,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:g}),o)}}return f.filter=function(e){return arguments.length?(r="function"==typeof e?e:Pe(!!e),f):r},f.container=function(e){return arguments.length?(a="function"==typeof e?e:Pe(e),f):a},f.subject=function(e){return arguments.length?(s="function"==typeof e?e:Pe(e),f):s},f.touchable=function(e){return arguments.length?(l="function"==typeof e?e:Pe(!!e),f):l},f.on=function(){var e=u.on.apply(u,arguments);return e===u?f:e},f.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,f):Math.sqrt(h)},f}function Le(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function $e(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Te(){}De.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Be=.7,je=1/Be,Ve="\\s*([+-]?\\d+)\\s*",He="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ze="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Xe=/^#([0-9a-f]{3,8})$/,Ye=new RegExp(`^rgb\\(${Ve},${Ve},${Ve}\\)$`),Fe=new RegExp(`^rgb\\(${Ze},${Ze},${Ze}\\)$`),We=new RegExp(`^rgba\\(${Ve},${Ve},${Ve},${He}\\)$`),Ke=new RegExp(`^rgba\\(${Ze},${Ze},${Ze},${He}\\)$`),Ge=new RegExp(`^hsl\\(${He},${Ze},${Ze}\\)$`),qe=new RegExp(`^hsla\\(${He},${Ze},${Ze},${He}\\)$`),Ue={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Qe(){return this.rgb().formatHex()}function Je(){return this.rgb().formatRgb()}function et(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Xe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?tt(t):3===n?new rt(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?nt(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?nt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Ye.exec(e))?new rt(t[1],t[2],t[3],1):(t=Fe.exec(e))?new rt(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=We.exec(e))?nt(t[1],t[2],t[3],t[4]):(t=Ke.exec(e))?nt(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Ge.exec(e))?ut(t[1],t[2]/100,t[3]/100,1):(t=qe.exec(e))?ut(t[1],t[2]/100,t[3]/100,t[4]):Ue.hasOwnProperty(e)?tt(Ue[e]):"transparent"===e?new rt(NaN,NaN,NaN,0):null}function tt(e){return new rt(e>>16&255,e>>8&255,255&e,1)}function nt(e,t,n,o){return o<=0&&(e=t=n=NaN),new rt(e,t,n,o)}function ot(e,t,n,o){return 1===arguments.length?((r=e)instanceof Te||(r=et(r)),r?new rt((r=r.rgb()).r,r.g,r.b,r.opacity):new rt):new rt(e,t,n,null==o?1:o);var r}function rt(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function it(){return`#${ct(this.r)}${ct(this.g)}${ct(this.b)}`}function at(){const e=st(this.opacity);return`${1===e?"rgb(":"rgba("}${lt(this.r)}, ${lt(this.g)}, ${lt(this.b)}${1===e?")":`, ${e})`}`}function st(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function lt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ct(e){return((e=lt(e))<16?"0":"")+e.toString(16)}function ut(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ht(e,t,n,o)}function dt(e){if(e instanceof ht)return new ht(e.h,e.s,e.l,e.opacity);if(e instanceof Te||(e=et(e)),!e)return new ht;if(e instanceof ht)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),a=NaN,s=i-r,l=(i+r)/2;return s?(a=t===i?(n-o)/s+6*(n<o):n===i?(o-t)/s+2:(t-n)/s+4,s/=l<.5?i+r:2-i-r,a*=60):s=l>0&&l<1?0:a,new ht(a,s,l,e.opacity)}function ht(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function ft(e){return(e=(e||0)%360)<0?e+360:e}function gt(e){return Math.max(0,Math.min(1,e||0))}function pt(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Le(Te,et,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Qe,formatHex:Qe,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return dt(this).formatHsl()},formatRgb:Je,toString:Je}),Le(rt,ot,$e(Te,{brighter(e){return e=null==e?je:Math.pow(je,e),new rt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Be:Math.pow(Be,e),new rt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new rt(lt(this.r),lt(this.g),lt(this.b),st(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:it,formatHex:it,formatHex8:function(){return`#${ct(this.r)}${ct(this.g)}${ct(this.b)}${ct(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:at,toString:at})),Le(ht,function(e,t,n,o){return 1===arguments.length?dt(e):new ht(e,t,n,null==o?1:o)},$e(Te,{brighter(e){return e=null==e?je:Math.pow(je,e),new ht(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Be:Math.pow(Be,e),new ht(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new rt(pt(e>=240?e-240:e+120,r,o),pt(e,r,o),pt(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new ht(ft(this.h),gt(this.s),gt(this.l),st(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=st(this.opacity);return`${1===e?"hsl(":"hsla("}${ft(this.h)}, ${100*gt(this.s)}%, ${100*gt(this.l)}%${1===e?")":`, ${e})`}`}}));var mt=e=>()=>e;function yt(e){return 1===(e=+e)?vt:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}(t,n,e):mt(isNaN(t)?n:t)}}function vt(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):mt(isNaN(e)?t:e)}var xt=function e(t){var n=yt(t);function o(e,t){var o=n((e=ot(e)).r,(t=ot(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),a=vt(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=r(t),e.b=i(t),e.opacity=a(t),e+""}}return o.gamma=e,o}(1);function wt(e,t){t||(t=[]);var n,o=e?Math.min(t.length,e.length):0,r=t.slice();return function(i){for(n=0;n<o;++n)r[n]=e[n]*(1-i)+t[n]*i;return r}}function bt(e,t){var n,o=t?t.length:0,r=e?Math.min(o,e.length):0,i=new Array(r),a=new Array(o);for(n=0;n<r;++n)i[n]=Mt(e[n],t[n]);for(;n<o;++n)a[n]=t[n];return function(e){for(n=0;n<r;++n)a[n]=i[n](e);return a}}function St(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Ct(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Et(e,t){var n,o={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?o[n]=Mt(e[n],t[n]):r[n]=t[n];return function(e){for(n in o)r[n]=o[n](e);return r}}var kt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Nt=new RegExp(kt.source,"g");function _t(e,t){var n,o,r,i=kt.lastIndex=Nt.lastIndex=0,a=-1,s=[],l=[];for(e+="",t+="";(n=kt.exec(e))&&(o=Nt.exec(t));)(r=o.index)>i&&(r=t.slice(i,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(o=o[0])?s[a]?s[a]+=o:s[++a]=o:(s[++a]=null,l.push({i:a,x:Ct(n,o)})),i=Nt.lastIndex;return i<t.length&&(r=t.slice(i),s[a]?s[a]+=r:s[++a]=r),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,o=0;o<t;++o)s[(n=l[o]).i]=n.x(e);return s.join("")})}function Mt(e,t){var n,o,r=typeof t;return null==t||"boolean"===r?mt(t):("number"===r?Ct:"string"===r?(n=et(t))?(t=n,xt):_t:t instanceof et?xt:t instanceof Date?St:(o=t,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(t)?bt:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?Et:Ct:wt))(e,t)}var Pt,Dt=180/Math.PI,Ot={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function zt(e,t,n,o,r,i){var a,s,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,l/=s),e*o<t*n&&(e=-e,t=-t,l=-l,a=-a),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Dt,skewX:Math.atan(l)*Dt,scaleX:a,scaleY:s}}function It(e,t,n,o){function r(e){return e.length?e.pop()+" ":""}return function(i,a){var s=[],l=[];return i=e(i),a=e(a),function(e,o,r,i,a,s){if(e!==r||o!==i){var l=a.push("translate(",null,t,null,n);s.push({i:l-4,x:Ct(e,r)},{i:l-2,x:Ct(o,i)})}else(r||i)&&a.push("translate("+r+t+i+n)}(i.translateX,i.translateY,a.translateX,a.translateY,s,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:Ct(e,t)})):t&&n.push(r(n)+"rotate("+t+o)}(i.rotate,a.rotate,s,l),function(e,t,n,i){e!==t?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:Ct(e,t)}):t&&n.push(r(n)+"skewX("+t+o)}(i.skewX,a.skewX,s,l),function(e,t,n,o,i,a){if(e!==n||t!==o){var s=i.push(r(i)+"scale(",null,",",null,")");a.push({i:s-4,x:Ct(e,n)},{i:s-2,x:Ct(t,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,s,l),i=a=null,function(e){for(var t,n=-1,o=l.length;++n<o;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var At=It(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ot:zt(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Rt=It(function(e){return null==e?Ot:(Pt||(Pt=document.createElementNS("http://www.w3.org/2000/svg","g")),Pt.setAttribute("transform",e),(e=Pt.transform.baseVal.consolidate())?zt((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Ot)},", ",")",")");function Lt(e){return((e=Math.exp(e))+1/e)/2}var $t,Tt,Bt=function e(t,n,o){function r(e,r){var i,a,s=e[0],l=e[1],c=e[2],u=r[0],d=r[1],h=r[2],f=u-s,g=d-l,p=f*f+g*g;if(p<1e-12)a=Math.log(h/c)/t,i=function(e){return[s+e*f,l+e*g,c*Math.exp(t*e*a)]};else{var m=Math.sqrt(p),y=(h*h-c*c+o*p)/(2*c*n*m),v=(h*h-c*c-o*p)/(2*h*n*m),x=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(v*v+1)-v);a=(w-x)/t,i=function(e){var o,r=e*a,i=Lt(x),u=c/(n*m)*(i*(o=t*r+x,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(x));return[s+u*f,l+u*g,c*i/Lt(t*r+x)]}}return i.duration=1e3*a*t/Math.SQRT2,i}return r.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},r}(Math.SQRT2,2,4),jt=0,Vt=0,Ht=0,Zt=0,Xt=0,Yt=0,Ft="object"==typeof performance&&performance.now?performance:Date,Wt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Kt(){return Xt||(Wt(Gt),Xt=Ft.now()+Yt)}function Gt(){Xt=0}function qt(){this._call=this._time=this._next=null}function Ut(e,t,n){var o=new qt;return o.restart(e,t,n),o}function Qt(){Xt=(Zt=Ft.now())+Yt,jt=Vt=0;try{!function(){Kt(),++jt;for(var e,t=$t;t;)(e=Xt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--jt}()}finally{jt=0,function(){var e,t,n=$t,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:$t=t);Tt=e,en(o)}(),Xt=0}}function Jt(){var e=Ft.now(),t=e-Zt;t>1e3&&(Yt-=t,Zt=e)}function en(e){jt||(Vt&&(Vt=clearTimeout(Vt)),e-Xt>24?(e<1/0&&(Vt=setTimeout(Qt,e-Ft.now()-Yt)),Ht&&(Ht=clearInterval(Ht))):(Ht||(Zt=Ft.now(),Ht=setInterval(Jt,1e3)),jt=1,Wt(Qt)))}function tn(e,t,n){var o=new qt;return t=null==t?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,n),o}qt.prototype=Ut.prototype={constructor:qt,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Kt():+n)+(null==t?0:+t),this._next||Tt===this||(Tt?Tt._next=this:$t=this,Tt=this),this._call=e,this._time=n,en()},stop:function(){this._call&&(this._call=null,this._time=1/0,en())}};var nn=i("start","end","cancel","interrupt"),on=[];function rn(e,t,n,o,r,i){var a=e.__transition;if(a){if(n in a)return}else e.__transition={};!function(e,t,n){var o,r=e.__transition;function i(e){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=e&&a(e-n.delay)}function a(i){var c,u,d,h;if(1!==n.state)return l();for(c in r)if((h=r[c]).name===n.name){if(3===h.state)return tn(a);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+c<t&&(h.state=6,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[c])}if(tn(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(i))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,o=new Array(d=n.tween.length),c=0,u=-1;c<d;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=h);o.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=5,1),i=-1,a=o.length;++i<a;)o[i].call(e,r);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var o in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}r[t]=n,n.timer=Ut(i,0,n.time)}(e,n,{name:t,index:o,group:r,on:nn,tween:on,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function an(e,t){var n=ln(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function sn(e,t){var n=ln(e,t);if(n.state>3)throw new Error("too late; already running");return n}function ln(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function cn(e,t){var n,o,r,i=e.__transition,a=!0;if(i){for(r in t=null==t?null:t+"",i)(n=i[r]).name===t?(o=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[r]):a=!1;a&&delete e.__transition}}function un(e,t){var n,o;return function(){var r=sn(this,e),i=r.tween;if(i!==n)for(var a=0,s=(o=n=i).length;a<s;++a)if(o[a].name===t){(o=o.slice()).splice(a,1);break}r.tween=o}}function dn(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=sn(this,e),a=i.tween;if(a!==o){r=(o=a).slice();for(var s={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=s;break}l===c&&r.push(s)}i.tween=r}}function hn(e,t,n){var o=e._id;return e.each(function(){var e=sn(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return ln(e,o).value[t]}}function fn(e,t){var n;return("number"==typeof t?Ct:t instanceof et?xt:(n=et(t))?(t=n,xt):_t)(e,t)}function gn(e){return function(){this.removeAttribute(e)}}function pn(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mn(e,t,n){var o,r,i=n+"";return function(){var a=this.getAttribute(e);return a===i?null:a===o?r:r=t(o=a,n)}}function yn(e,t,n){var o,r,i=n+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===o?r:r=t(o=a,n)}}function vn(e,t,n){var o,r,i;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(e))===(s=l+"")?null:a===o&&s===r?i:(r=s,i=t(o=a,l));this.removeAttribute(e)}}function xn(e,t,n){var o,r,i;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:a===o&&s===r?i:(r=s,i=t(o=a,l));this.removeAttributeNS(e.space,e.local)}}function wn(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,r)),n}return r._value=t,r}function bn(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,r)),n}return r._value=t,r}function Sn(e,t){return function(){an(this,e).delay=+t.apply(this,arguments)}}function Cn(e,t){return t=+t,function(){an(this,e).delay=t}}function En(e,t){return function(){sn(this,e).duration=+t.apply(this,arguments)}}function kn(e,t){return t=+t,function(){sn(this,e).duration=t}}var Nn=we.prototype.constructor;function _n(e){return function(){this.style.removeProperty(e)}}var Mn=0;function Pn(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Dn(){return++Mn}var On=we.prototype;Pn.prototype={constructor:Pn,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=m(e));for(var o=this._groups,r=o.length,i=new Array(r),a=0;a<r;++a)for(var s,l,c=o[a],u=c.length,d=i[a]=new Array(u),h=0;h<u;++h)(s=c[h])&&(l=e.call(s,s.__data__,h,c))&&("__data__"in s&&(l.__data__=s.__data__),d[h]=l,rn(d[h],t,n,h,d,ln(s,n)));return new Pn(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=v(e));for(var o=this._groups,r=o.length,i=[],a=[],s=0;s<r;++s)for(var l,c=o[s],u=c.length,d=0;d<u;++d)if(l=c[d]){for(var h,f=e.call(l,l.__data__,d,c),g=ln(l,n),p=0,m=f.length;p<m;++p)(h=f[p])&&rn(h,t,n,p,f,g);i.push(f),a.push(l)}return new Pn(i,a,t,n)},selectChild:On.selectChild,selectChildren:On.selectChildren,filter:function(e){"function"!=typeof e&&(e=w(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a=t[r],s=a.length,l=o[r]=[],c=0;c<s;++c)(i=a[c])&&e.call(i,i.__data__,c,a)&&l.push(i);return new Pn(o,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),a=new Array(o),s=0;s<i;++s)for(var l,c=t[s],u=n[s],d=c.length,h=a[s]=new Array(d),f=0;f<d;++f)(l=c[f]||u[f])&&(h[f]=l);for(;s<o;++s)a[s]=t[s];return new Pn(a,this._parents,this._name,this._id)},selection:function(){return new Nn(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=Dn(),o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],l=s.length,c=0;c<l;++c)if(a=s[c]){var u=ln(a,t);rn(a,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Pn(o,this._parents,e,n)},call:On.call,nodes:On.nodes,node:On.node,size:On.size,empty:On.empty,each:On.each,on:function(e,t){var n=this._id;return arguments.length<2?ln(this.node(),n).on.on(e):this.each(function(e,t,n){var o,r,i=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?an:sn;return function(){var a=i(this,e),s=a.on;s!==o&&(r=(o=s).copy()).on(t,n),a.on=r}}(n,e,t))},attr:function(e,t){var n=d(e),o="transform"===n?Rt:fn;return this.attrTween(e,"function"==typeof t?(n.local?xn:vn)(n,o,hn(this,"attr."+e,t)):null==t?(n.local?pn:gn)(n):(n.local?yn:mn)(n,o,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=d(e);return this.tween(n,(o.local?wn:bn)(o,t))},style:function(e,t,n){var o="transform"==(e+="")?At:fn;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=Z(this,e),a=(this.style.removeProperty(e),Z(this,e));return i===a?null:i===n&&a===o?r:r=t(n=i,o=a)}}(e,o)).on("end.style."+e,_n(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var a=Z(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=Z(this,e)),a===l?null:a===o&&l===r?i:(r=l,i=t(o=a,s))}}(e,o,hn(this,"style."+e,t))).each(function(e,t){var n,o,r,i,a="style."+t,s="end."+a;return function(){var l=sn(this,e),c=l.on,u=null==l.value[a]?i||(i=_n(t)):void 0;c===n&&r===u||(o=(n=c).copy()).on(s,r=u),l.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,r,i=n+"";return function(){var a=Z(this,e);return a===i?null:a===o?r:r=t(o=a,n)}}(e,o,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,r;function i(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,i,n)),o}return i._value=t,i}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(hn(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,r=ln(this.node(),n).tween,i=0,a=r.length;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((null==t?un:dn)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Sn:Cn)(t,e)):ln(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?En:kn)(t,e)):ln(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){sn(this,e).ease=t}}(t,e)):ln(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;sn(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,a){var s={value:a},l={value:function(){0===--r&&i()}};n.each(function(){var n=sn(this,o),r=n.on;r!==e&&((t=(e=r).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t}),0===r&&i()})},[Symbol.iterator]:On[Symbol.iterator]};var zn={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function In(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}we.prototype.interrupt=function(e){return this.each(function(){cn(this,e)})},we.prototype.transition=function(e){var t,n;e instanceof Pn?(t=e._id,e=e._name):(t=Dn(),(n=zn).time=Kt(),e=null==e?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],l=s.length,c=0;c<l;++c)(a=s[c])&&rn(a,e,t,c,s,n||In(a,t));return new Pn(o,this._parents,e,t)};var An=e=>()=>e;function Rn(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ln(e,t,n){this.k=e,this.x=t,this.y=n}Ln.prototype={constructor:Ln,scale:function(e){return 1===e?this:new Ln(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Ln(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var $n=new Ln(1,0,0);function Tn(e){for(;!e.__zoom;)if(!(e=e.parentNode))return $n;return e.__zoom}function Bn(e){e.stopImmediatePropagation()}function jn(e){e.preventDefault(),e.stopImmediatePropagation()}function Vn(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Hn(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function Zn(){return this.__zoom||$n}function Xn(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Yn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fn(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function Wn(){var e,t,n,o=Vn,r=Hn,a=Fn,s=Xn,l=Yn,c=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],d=250,h=Bt,f=i("start","zoom","end"),g=0,p=10;function m(e){e.property("__zoom",Zn).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",k).filter(l).on("touchstart.zoom",N).on("touchmove.zoom",_).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(e,t){return(t=Math.max(c[0],Math.min(c[1],t)))===e.k?e:new Ln(t,e.x,e.y)}function v(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new Ln(e.k,o,r)}function x(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,t,n,o){e.on("start.zoom",function(){b(this,arguments).event(o).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(o).end()}).tween("zoom",function(){var e=this,i=arguments,a=b(e,i).event(o),s=r.apply(e,i),l=null==n?x(s):"function"==typeof n?n.apply(e,i):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),u=e.__zoom,d="function"==typeof t?t.apply(e,i):t,f=h(u.invert(l).concat(c/u.k),d.invert(l).concat(c/d.k));return function(e){if(1===e)e=d;else{var t=f(e),n=c/t[2];e=new Ln(n,l[0]-t[0]*n,l[1]-t[1]*n)}a.zoom(null,e)}})}function b(e,t,n){return!n&&e.__zooming||new S(e,t)}function S(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function C(e,...t){if(o.apply(this,arguments)){var n=b(this,t).event(e),r=this.__zoom,i=Math.max(c[0],Math.min(c[1],r.k*Math.pow(2,s.apply(this,arguments)))),l=Se(e);if(n.wheel)n.mouse[0][0]===l[0]&&n.mouse[0][1]===l[1]||(n.mouse[1]=r.invert(n.mouse[0]=l)),clearTimeout(n.wheel);else{if(r.k===i)return;n.mouse=[l,r.invert(l)],cn(this),n.start()}jn(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",a(v(y(r,i),n.mouse[0],n.mouse[1]),n.extent,u))}}function E(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,i=b(this,t,!0).event(e),s=be(e.view).on("mousemove.zoom",function(e){if(jn(e),!i.moved){var t=e.clientX-c,n=e.clientY-d;i.moved=t*t+n*n>g}i.event(e).zoom("mouse",a(v(i.that.__zoom,i.mouse[0]=Se(e,r),i.mouse[1]),i.extent,u))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),Me(e.view,i.moved),jn(e),i.event(e).end()},!0),l=Se(e,r),c=e.clientX,d=e.clientY;_e(e.view),Bn(e),i.mouse=[l,this.__zoom.invert(l)],cn(this),i.start()}}function k(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,i=Se(e.changedTouches?e.changedTouches[0]:e,this),s=n.invert(i),l=n.k*(e.shiftKey?.5:2),c=a(v(y(n,l),i,s),r.apply(this,t),u);jn(e),d>0?be(this).transition().duration(d).call(w,c,i,e):be(this).call(m.transform,c,i,e)}}function N(n,...r){if(o.apply(this,arguments)){var i,a,s,l,c=n.touches,u=c.length,d=b(this,r,n.changedTouches.length===u).event(n);for(Bn(n),a=0;a<u;++a)l=[l=Se(s=c[a],this),this.__zoom.invert(l),s.identifier],d.touch0?d.touch1||d.touch0[2]===l[2]||(d.touch1=l,d.taps=0):(d.touch0=l,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(t=l[0],e=setTimeout(function(){e=null},500)),cn(this),d.start())}}function _(e,...t){if(this.__zooming){var n,o,r,i,s=b(this,t).event(e),l=e.changedTouches,c=l.length;for(jn(e),n=0;n<c;++n)r=Se(o=l[n],this),s.touch0&&s.touch0[2]===o.identifier?s.touch0[0]=r:s.touch1&&s.touch1[2]===o.identifier&&(s.touch1[0]=r);if(o=s.that.__zoom,s.touch1){var d=s.touch0[0],h=s.touch0[1],f=s.touch1[0],g=s.touch1[1],p=(p=f[0]-d[0])*p+(p=f[1]-d[1])*p,m=(m=g[0]-h[0])*m+(m=g[1]-h[1])*m;o=y(o,Math.sqrt(p/m)),r=[(d[0]+f[0])/2,(d[1]+f[1])/2],i=[(h[0]+g[0])/2,(h[1]+g[1])/2]}else{if(!s.touch0)return;r=s.touch0[0],i=s.touch0[1]}s.zoom("touch",a(v(o,r,i),s.extent,u))}}function M(e,...o){if(this.__zooming){var r,i,a=b(this,o).event(e),s=e.changedTouches,l=s.length;for(Bn(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),r=0;r<l;++r)i=s[r],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=Se(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<p)){var c=be(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return m.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",Zn),e!==r?w(e,t,n,o):r.interrupt().each(function(){b(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},m.scaleBy=function(e,t,n,o){m.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,o)},m.scaleTo=function(e,t,n,o){m.transform(e,function(){var e=r.apply(this,arguments),o=this.__zoom,i=null==n?x(e):"function"==typeof n?n.apply(this,arguments):n,s=o.invert(i),l="function"==typeof t?t.apply(this,arguments):t;return a(v(y(o,l),i,s),e,u)},n,o)},m.translateBy=function(e,t,n,o){m.transform(e,function(){return a(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),u)},null,o)},m.translateTo=function(e,t,n,o,i){m.transform(e,function(){var e=r.apply(this,arguments),i=this.__zoom,s=null==o?x(e):"function"==typeof o?o.apply(this,arguments):o;return a($n.translate(s[0],s[1]).scale(i.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,u)},o,i)},S.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=be(this.that).datum();f.call(e,this.that,new Rn(e,{sourceEvent:this.sourceEvent,target:m,type:e,transform:this.that.__zoom,dispatch:f}),t)}},m.wheelDelta=function(e){return arguments.length?(s="function"==typeof e?e:An(+e),m):s},m.filter=function(e){return arguments.length?(o="function"==typeof e?e:An(!!e),m):o},m.touchable=function(e){return arguments.length?(l="function"==typeof e?e:An(!!e),m):l},m.extent=function(e){return arguments.length?(r="function"==typeof e?e:An([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),m):r},m.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],m):[c[0],c[1]]},m.translateExtent=function(e){return arguments.length?(u[0][0]=+e[0][0],u[1][0]=+e[1][0],u[0][1]=+e[0][1],u[1][1]=+e[1][1],m):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},m.constrain=function(e){return arguments.length?(a=e,m):a},m.duration=function(e){return arguments.length?(d=+e,m):d},m.interpolate=function(e){return arguments.length?(h=e,m):h},m.on=function(){var e=f.on.apply(f,arguments);return e===f?m:e},m.clickDistance=function(e){return arguments.length?(g=(e=+e)*e,m):Math.sqrt(g)},m.tapDistance=function(e){return arguments.length?(p=+e,m):p},m}Tn.prototype=Ln.prototype;const Kn=()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",Gn=e=>`Node type "${e}" not found. Using fallback type "default".`,qn=()=>"The React Flow parent container needs a width and a height to render the graph.",Un=()=>"Only child nodes can use a parent extent.",Qn=e=>`Marker type "${e}" doesn't exist.`,Jn=(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:o}", edge id: ${t}.`,eo=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",to=e=>`Edge type "${e}" not found. Using fallback type "default".`,no=e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,oo=()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",ro=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],io=["Enter"," ","Escape"],ao={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var so,lo,co;!function(e){e.Strict="strict",e.Loose="loose"}(so||(so={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(lo||(lo={})),function(e){e.Partial="partial",e.Full="full"}(co||(co={}));const uo={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var ho,fo,go;!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(ho||(ho={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(fo||(fo={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(go||(go={}));const po={[go.Left]:go.Right,[go.Right]:go.Left,[go.Top]:go.Bottom,[go.Bottom]:go.Top};function mo(e){return null===e?null:e?"valid":"invalid"}const yo=e=>"id"in e&&"source"in e&&"target"in e,vo=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),xo=(e,t=[0,0])=>{const{width:n,height:o}=Wo(e),r=e.origin??t,i=n*r[0],a=o*r[1];return{x:e.position.x-i,y:e.position.y-a}},wo=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(e=>{(void 0===t.filter||t.filter(e))&&(n=Do(n,Ao(e)),o=!0)}),o?zo(n):{x:0,y:0,width:0,height:0}},bo=(e,t,[n,o,r]=[0,0,1],i=!1,a=!1)=>{const s={...Vo(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const t of e.values()){const{measured:e,selectable:n=!0,hidden:o=!1}=t;if(a&&!n||o)continue;const r=e.width??t.width??t.initialWidth??null,c=e.height??t.height??t.initialHeight??null,u=Lo(s,Io(t)),d=(r??0)*(c??0),h=i&&u>0;(!t.internals.handleBounds||h||u>=d||t.dragging)&&l.push(t)}return l};async function So({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},a){if(0===e.size)return Promise.resolve(!0);const s=function(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{!e.measured.width||!e.measured.height||!t?.includeHiddenNodes&&e.hidden||o&&!o.has(e.id)||n.set(e.id,e)}),n}(e,a),l=wo(s),c=Xo(l,t,n,a?.minZoom??r,a?.maxZoom??i,a?.padding??.1);return await o.setViewport(c,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)}function Co({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const a=n.get(e),s=a.parentId?n.get(a.parentId):void 0,{x:l,y:c}=s?s.internals.positionAbsolute:{x:0,y:0},u=a.origin??o;let d=a.extent||r;if("parent"!==a.extent||a.expandParent)s&&Fo(a.extent)&&(d=[[a.extent[0][0]+l,a.extent[0][1]+c],[a.extent[1][0]+l,a.extent[1][1]+c]]);else if(s){const e=s.measured.width,t=s.measured.height;e&&t&&(d=[[l,c],[l+e,c+t]])}else i?.("005",Un());const h=Fo(d)?No(t,d,a.measured):t;return void 0!==a.measured.width&&void 0!==a.measured.height||i?.("015",oo()),{position:{x:h.x-l+(a.measured.width??0)*u[0],y:h.y-c+(a.measured.height??0)*u[1]},positionAbsolute:h}}async function Eo({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(e=>e.id)),a=[];for(const e of n){if(!1===e.deletable)continue;const t=i.has(e.id),n=!t&&e.parentId&&a.find(t=>t.id===e.parentId);(t||n)&&a.push(e)}const s=new Set(t.map(e=>e.id)),l=o.filter(e=>!1!==e.deletable),c=((e,t)=>{const n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))})(a,l),u=c;for(const e of l){s.has(e.id)&&!u.find(t=>t.id===e.id)&&u.push(e)}if(!r)return{edges:u,nodes:a};const d=await r({nodes:a,edges:u});return"boolean"==typeof d?d?{edges:u,nodes:a}:{edges:[],nodes:[]}:d}const ko=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),No=(e={x:0,y:0},t,n)=>({x:ko(e.x,t[0][0],t[1][0]-(n?.width??0)),y:ko(e.y,t[0][1],t[1][1]-(n?.height??0))});function _o(e,t,n){const{width:o,height:r}=Wo(n),{x:i,y:a}=n.internals.positionAbsolute;return No(e,[[i,a],[i+o,a+r]],t)}const Mo=(e,t,n)=>e<t?ko(Math.abs(e-t),1,t)/t:e>n?-ko(Math.abs(e-n),1,t)/t:0,Po=(e,t,n=15,o=40)=>[Mo(e.x,o,t.width-o)*n,Mo(e.y,o,t.height-o)*n],Do=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Oo=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),zo=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Io=(e,t=[0,0])=>{const{x:n,y:o}=vo(e)?e.internals.positionAbsolute:xo(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ao=(e,t=[0,0])=>{const{x:n,y:o}=vo(e)?e.internals.positionAbsolute:xo(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Ro=(e,t)=>zo(Do(Oo(e),Oo(t))),Lo=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},$o=e=>To(e.width)&&To(e.height)&&To(e.x)&&To(e.y),To=e=>!isNaN(e)&&isFinite(e),Bo=(e,t)=>{},jo=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Vo=({x:e,y:t},[n,o,r],i=!1,a=[1,1])=>{const s={x:(e-n)/r,y:(t-o)/r};return i?jo(s,a):s},Ho=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Zo(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}const Xo=(e,t,n,o,r,i)=>{const a=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Zo(e,n),r=Zo(e,t);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof e){const o=Zo(e.top??e.y??0,n),r=Zo(e.bottom??e.y??0,n),i=Zo(e.left??e.x??0,t),a=Zo(e.right??e.x??0,t);return{top:o,right:a,bottom:r,left:i,x:i+a,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),s=(t-a.x)/e.width,l=(n-a.y)/e.height,c=Math.min(s,l),u=ko(c,o,r),d=t/2-(e.x+e.width/2)*u,h=n/2-(e.y+e.height/2)*u,f=function(e,t,n,o,r,i){const{x:a,y:s}=Ho(e,[t,n,o]),{x:l,y:c}=Ho({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-c;return{left:Math.floor(a),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}(e,d,h,u,t,n),g=Math.min(f.left-a.left,0),p=Math.min(f.top-a.top,0);return{x:d-g+Math.min(f.right-a.right,0),y:h-p+Math.min(f.bottom-a.bottom,0),zoom:u}},Yo=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function Fo(e){return null!=e&&"parent"!==e}function Wo(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Ko(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function Go(e,t={width:0,height:0},n,o,r){const i={...e},a=o.get(n);if(a){const e=a.origin||r;i.x+=a.internals.positionAbsolute.x-(t.width??0)*e[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*e[1]}return i}function qo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Uo(e){return{...ao,...e||{}}}function Qo(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:a}=rr(e),s=Vo({x:i-(r?.left??0),y:a-(r?.top??0)},o),{x:l,y:c}=n?jo(s,t):s;return{xSnapped:l,ySnapped:c,...s}}const Jo=e=>({width:e.offsetWidth,height:e.offsetHeight}),er=e=>e?.getRootNode?.()||window?.document,tr=["INPUT","SELECT","TEXTAREA"];function nr(e){const t=e.composedPath?.()?.[0]||e.target;if(1!==t?.nodeType)return!1;return tr.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const or=e=>"clientX"in e,rr=(e,t)=>{const n=or(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},ir=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return i&&i.length?Array.from(i).map(t=>{const i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:r,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...Jo(t)}}):null};function ar({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:a,targetControlY:s}){const l=.125*e+.375*r+.375*a+.125*n,c=.125*t+.375*i+.375*s+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}function sr(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function lr({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case go.Left:return[t-sr(t-o,i),n];case go.Right:return[t+sr(o-t,i),n];case go.Top:return[t,n-sr(n-r,i)];case go.Bottom:return[t,n+sr(r-n,i)]}}function cr({sourceX:e,sourceY:t,sourcePosition:n=go.Bottom,targetX:o,targetY:r,targetPosition:i=go.Top,curvature:a=.25}){const[s,l]=lr({pos:n,x1:e,y1:t,x2:o,y2:r,c:a}),[c,u]=lr({pos:i,x1:o,y1:r,x2:e,y2:t,c:a}),[d,h,f,g]=ar({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${s},${l} ${c},${u} ${o},${r}`,d,h,f,g]}function ur({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,a=Math.abs(o-t)/2;return[i,o<t?o+a:o-a,r,a]}function dr({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Do(Ao(e),Ao(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const a={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Lo(a,zo(i))>0}const hr=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`;function fr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,a,s]=ur({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,a,s]}const gr={[go.Left]:{x:-1,y:0},[go.Right]:{x:1,y:0},[go.Top]:{x:0,y:-1},[go.Bottom]:{x:0,y:1}},pr=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function mr({source:e,sourcePosition:t=go.Bottom,target:n,targetPosition:o=go.Top,center:r,offset:i,stepPosition:a}){const s=gr[t],l=gr[o],c={x:e.x+s.x*i,y:e.y+s.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},d=(({source:e,sourcePosition:t=go.Bottom,target:n})=>t===go.Left||t===go.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:c,sourcePosition:t,target:u}),h=0!==d.x?"x":"y",f=d[h];let g,p,m=[];const y={x:0,y:0},v={x:0,y:0},[,,x,w]=ur({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[h]*l[h]===-1){"x"===h?(g=r.x??c.x+(u.x-c.x)*a,p=r.y??(c.y+u.y)/2):(g=r.x??(c.x+u.x)/2,p=r.y??c.y+(u.y-c.y)*a);const e=[{x:g,y:c.y},{x:g,y:u.y}],t=[{x:c.x,y:p},{x:u.x,y:p}];m=s[h]===f?"x"===h?e:t:"x"===h?t:e}else{const r=[{x:c.x,y:u.y}],a=[{x:u.x,y:c.y}];if(m="x"===h?s.x===f?a:r:s.y===f?r:a,t===o){const t=Math.abs(e[h]-n[h]);if(t<=i){const o=Math.min(i-1,i-t);s[h]===f?y[h]=(c[h]>e[h]?-1:1)*o:v[h]=(u[h]>n[h]?-1:1)*o}}if(t!==o){const e="x"===h?"y":"x",t=s[h]===l[e],n=c[e]>u[e],o=c[e]<u[e];(1===s[h]&&(!t&&n||t&&o)||1!==s[h]&&(!t&&o||t&&n))&&(m="x"===h?r:a)}const d={x:c.x+y.x,y:c.y+y.y},x={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(x.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(x.y-m[0].y))?(g=(d.x+x.x)/2,p=m[0].y):(g=m[0].x,p=(d.y+x.y)/2)}return[[e,{x:c.x+y.x,y:c.y+y.y},...m,{x:u.x+v.x,y:u.y+v.y},n],g,p,x,w]}function yr({sourceX:e,sourceY:t,sourcePosition:n=go.Bottom,targetX:o,targetY:r,targetPosition:i=go.Top,borderRadius:a=5,centerX:s,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,h,f,g,p]=mr({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:s,y:l},offset:c,stepPosition:u});return[d.reduce((e,t,n)=>{let o="";return o=n>0&&n<d.length-1?function(e,t,n,o){const r=Math.min(pr(e,t)/2,pr(t,n)/2,o),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a)return`L ${i+r*(e.x<n.x?-1:1)},${a}Q ${i},${a} ${i},${a+r*(e.y<n.y?1:-1)}`;const s=e.x<n.x?1:-1;return`L ${i},${a+r*(e.y<n.y?-1:1)}Q ${i},${a} ${i+r*s},${a}`}(d[n-1],t,d[n+1],a):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=o},""),h,f,g,p]}function vr(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function xr(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,"source"===o.type?t.push(o):"target"===o.type&&n.push(o);return{source:t,target:n}}function wr(e,t,n=go.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:s}=t??Wo(e);if(o)return{x:r+a/2,y:i+s/2};switch(t?.position??n){case go.Top:return{x:r+a/2,y:i};case go.Right:return{x:r+a,y:i+s/2};case go.Bottom:return{x:r+a/2,y:i+s};case go.Left:return{x:r,y:i+s/2}}}function br(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Sr(e,t){if(!e)return"";if("string"==typeof e)return e;return`${t?`${t}__`:""}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`}const Cr={nodeOrigin:[0,0],nodeExtent:ro,elevateNodesOnSelect:!0,defaults:{}},Er={...Cr,checkEquality:!0};function kr(e,t){const n={...e};for(const e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function Nr(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const t of e.handles){const r={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};"source"===t.type?n.push(r):"target"===t.type&&o.push(r)}return{source:n,target:o}}function _r(e,t,n,o){const r=kr(Er,o);let i={i:-1},a=e.length>0;const s=new Map(t),l=r?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const c of e){let e=s.get(c.id);if(r.checkEquality&&c===e?.internals.userNode)t.set(c.id,e);else{const n=xo(c,r.nodeOrigin),o=Fo(c.extent)?c.extent:r.nodeExtent,i=No(n,o,Wo(c));e={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:i,handleBounds:Nr(c,e),z:Pr(c,l),userNode:c}},t.set(c.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(a=!1),c.parentId&&Mr(e,t,n,o,i)}return a}function Mr(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:s}=kr(Cr,o),l=e.parentId,c=t.get(l);if(!c)return void console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}(e,n),r&&!c.parentId&&void 0===c.internals.rootParentIndex&&(c.internals.rootParentIndex=++r.i,c.internals.z=c.internals.z+10*r.i),r&&void 0!==c.internals.rootParentIndex&&(r.i=c.internals.rootParentIndex);const u=i?1e3:0,{x:d,y:h,z:f}=function(e,t,n,o,r){const{x:i,y:a}=t.internals.positionAbsolute,s=Wo(e),l=xo(e,n),c=Fo(e.extent)?No(l,e.extent,s):l;let u=No({x:i+c.x,y:a+c.y},o,s);"parent"===e.extent&&(u=_o(u,s,t));const d=Pr(e,r),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=d?h+1:d}}(e,c,a,s,u),{positionAbsolute:g}=e.internals,p=d!==g.x||h!==g.y;(p||f!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:p?{x:d,y:h}:g,z:f}})}function Pr(e,t){return(To(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Dr(e,t,n,o=[0,0]){const r=[],i=new Map;for(const n of e){const e=t.get(n.parentId);if(!e)continue;const o=i.get(n.parentId)?.expandedRect??Io(e),r=Ro(o,n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach(({expandedRect:t,parent:i},a)=>{const s=i.internals.positionAbsolute,l=Wo(i),c=i.origin??o,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,h=Math.max(l.width,Math.round(t.width)),f=Math.max(l.height,Math.round(t.height)),g=(h-l.width)*c[0],p=(f-l.height)*c[1];(u>0||d>0||g||p)&&(r.push({id:a,type:"position",position:{x:i.position.x-u+g,y:i.position.y-d+p}}),n.get(a)?.forEach(t=>{e.some(e=>e.id===t.id)||r.push({id:t.id,type:"position",position:{x:t.position.x+u,y:t.position.y+d}})})),(l.width<t.width||l.height<t.height||u||d)&&r.push({id:a,type:"dimensions",setAttributes:!0,dimensions:{width:h+(u?c[0]*u-g:0),height:f+(d?c[1]*d-p:0)}})}),r}function Or(e,t,n,o,r,i){let a=r;const s=o.get(a)||new Map;o.set(a,s.set(n,t)),a=`${r}-${e}`;const l=o.get(a)||new Map;if(o.set(a,l.set(n,t)),i){a=`${r}-${e}-${i}`;const s=o.get(a)||new Map;o.set(a,s.set(n,t))}}function zr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=o,s={edgeId:o.id,source:n,target:r,sourceHandle:i,targetHandle:a},l=`${n}-${i}--${r}-${a}`;Or("source",s,`${r}-${a}--${n}-${i}`,e,n,i),Or("target",s,l,e,r,a),t.set(o.id,o)}}function Ir(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Ir(n,t))}function Ar(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Rr({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[e,i]of t){const t=n.get(e)?.internals.userNode;t&&r.push({...t,position:i.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Lr({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},a=0,s=new Map,l=!1,c={x:0,y:0},u=null,d=!1,h=null,f=!1,g=!1,p=null;return{update:function({noDragClassName:m,handleSelector:y,domNode:v,isSelectable:x,nodeId:w,nodeClickDistance:b=0}){function S({x:e,y:n}){const{nodeLookup:r,nodeExtent:a,snapGrid:l,snapToGrid:c,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:h,onError:f,updateNodePositions:m}=t();i={x:e,y:n};let y=!1;const v=s.size>1,x=v&&a?Oo(wo(s)):null,b=v&&c?function({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},a=jo(i,t);return{x:a.x-i.x,y:a.y-i.y}}({dragItems:s,snapGrid:l,x:e,y:n}):null;for(const[t,o]of s){if(!r.has(t))continue;let i={x:e-o.distance.x,y:n-o.distance.y};c&&(i=b?{x:Math.round(i.x+b.x),y:Math.round(i.y+b.y)}:jo(i,l));let s=null;if(v&&a&&!o.extent&&x){const{positionAbsolute:e}=o.internals,t=e.x-x.x+a[0][0],n=e.x+o.measured.width-x.x2+a[1][0];s=[[t,e.y-x.y+a[0][1]],[n,e.y+o.measured.height-x.y2+a[1][1]]]}const{position:d,positionAbsolute:h}=Co({nodeId:t,nextPosition:i,nodeLookup:r,nodeExtent:s||a,nodeOrigin:u,onError:f});y=y||o.position.x!==d.x||o.position.y!==d.y,o.position=d,o.internals.positionAbsolute=h}if(g=g||y,y&&(m(s,!0),p&&(o||d||!w&&h))){const[e,t]=Rr({nodeId:w,dragItems:s,nodeLookup:r});o?.(p,s,e,t),d?.(p,e,t),w||h?.(p,t)}}async function C(){if(!u)return;const{transform:e,panBy:n,autoPanSpeed:o,autoPanOnNodeDrag:r}=t();if(!r)return l=!1,void cancelAnimationFrame(a);const[s,d]=Po(c,u,o);0===s&&0===d||(i.x=(i.x??0)-s/e[2],i.y=(i.y??0)-d/e[2],await n({x:s,y:d})&&S(i)),a=requestAnimationFrame(C)}function E(o){const{nodeLookup:r,multiSelectionActive:a,nodesDraggable:l,transform:c,snapGrid:h,snapToGrid:f,selectNodesOnDrag:g,onNodeDragStart:p,onSelectionDragStart:m,unselectNodesAndEdges:y}=t();d=!0,g&&x||a||!w||r.get(w)?.selected||y(),x&&g&&w&&e?.(w);const v=Qo(o.sourceEvent,{transform:c,snapGrid:h,snapToGrid:f,containerBounds:u});if(i=v,s=function(e,t,n,o){const r=new Map;for(const[i,a]of e)if((a.selected||a.id===o)&&(!a.parentId||!Ir(a,e))&&(a.draggable||t&&void 0===a.draggable)){const t=e.get(i);t&&r.set(i,{id:i,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return r}(r,l,v,w),s.size>0&&(n||p||!w&&m)){const[e,t]=Rr({nodeId:w,dragItems:s,nodeLookup:r});n?.(o.sourceEvent,s,e,t),p?.(o.sourceEvent,e,t),w||m?.(o.sourceEvent,t)}}h=be(v);const k=Re().clickDistance(b).on("start",e=>{const{domNode:n,nodeDragThreshold:o,transform:r,snapGrid:a,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,f=!1,g=!1,p=e.sourceEvent,0===o&&E(e);const l=Qo(e.sourceEvent,{transform:r,snapGrid:a,snapToGrid:s,containerBounds:u});i=l,c=rr(e.sourceEvent,u)}).on("drag",e=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:a,nodeDragThreshold:h,nodeLookup:g}=t(),m=Qo(e.sourceEvent,{transform:o,snapGrid:r,snapToGrid:a,containerBounds:u});if(p=e.sourceEvent,("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||w&&!g.has(w))&&(f=!0),!f){if(!l&&n&&d&&(l=!0,C()),!d){const t=rr(e.sourceEvent,u),n=t.x-c.x,o=t.y-c.y;Math.sqrt(n*n+o*o)>h&&E(e)}(i.x!==m.xSnapped||i.y!==m.ySnapped)&&s&&d&&(c=rr(e.sourceEvent,u),S(m))}}).on("end",e=>{if(d&&!f&&(l=!1,d=!1,cancelAnimationFrame(a),s.size>0)){const{nodeLookup:n,updateNodePositions:o,onNodeDragStop:i,onSelectionDragStop:a}=t();if(g&&(o(s,!1),g=!1),r||i||!w&&a){const[t,o]=Rr({nodeId:w,dragItems:s,nodeLookup:n,dragging:!1});r?.(e.sourceEvent,s,t,o),i?.(e.sourceEvent,t,o),w||a?.(e.sourceEvent,o)}}}).filter(e=>{const t=e.target;return!e.button&&(!m||!Ar(t,`.${m}`,v))&&(!y||Ar(t,y,v))});h.call(k)},destroy:function(){h?.on(".drag",null)}}}function $r(e,t,n,o){let r=[],i=1/0;const a=function(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const e of t.values())Lo(r,Io(e))>0&&o.push(e);return o}(e,n,t+250);for(const n of a){const a=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(const s of a){if(o.nodeId===s.nodeId&&o.type===s.type&&o.id===s.id)continue;const{x:a,y:l}=wr(n,s,s.position,!0),c=Math.sqrt(Math.pow(a-e.x,2)+Math.pow(l-e.y,2));c>t||(c<i?(r=[{...s,x:a,y:l}],i=c):c===i&&r.push({...s,x:a,y:l}))}}if(!r.length)return null;if(r.length>1){const e="source"===o.type?"target":"source";return r.find(t=>t.type===e)??r[0]}return r[0]}function Tr(e,t,n,o,r,i=!1){const a=o.get(e);if(!a)return null;const s="strict"===r?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],l=(n?s?.find(e=>e.id===n):s?.[0])??null;return l&&i?{...l,...wr(a,l,l.position,!0)}:l}function Br(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}const jr=()=>!0;function Vr(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:a,lib:s,flowId:l,isValidConnection:c=jr,nodeLookup:u}){const d="target"===i,h=t?a.querySelector(`.${s}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:f,y:g}=rr(e),p=a.elementFromPoint(f,g),m=p?.classList.contains(`${s}-flow__handle`)?p:h,y={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const e=Br(void 0,m),t=m.getAttribute("data-nodeid"),i=m.getAttribute("data-handleid"),a=m.classList.contains("connectable"),s=m.classList.contains("connectableend");if(!t||!e)return y;const l={source:d?t:o,sourceHandle:d?i:r,target:d?o:t,targetHandle:d?r:i};y.connection=l;const h=a&&s&&(n===so.Strict?d&&"source"===e||!d&&"target"===e:t!==o||i!==r);y.isValid=h&&c(l),y.toHandle=Tr(t,e,i,u,n,!0)}return y}const Hr={onPointerDown:function(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:a,domNode:s,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:h,cancelConnection:f,onConnectStart:g,onConnect:p,onConnectEnd:m,isValidConnection:y=jr,onReconnectEnd:v,updateConnection:x,getTransform:w,getFromHandle:b,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:E}){const k=er(e.target);let N,_=0;const{x:M,y:P}=rr(e),D=Br(i,E),O=s?.getBoundingClientRect();let z=!1;if(!O||!D)return;const I=Tr(r,D,o,l,t);if(!I)return;let A=rr(e,O),R=!1,L=null,$=!1,T=null;function B(){if(!u||!O)return;const[e,t]=Po(A,O,S);h({x:e,y:t}),_=requestAnimationFrame(B)}const j={...I,nodeId:r,type:D,position:I.position},V=l.get(r);let H={inProgress:!0,isValid:null,from:wr(V,j,go.Left,!0),fromHandle:j,fromPosition:j.position,fromNode:V,to:A,toHandle:null,toPosition:po[j.position],toNode:null};function Z(){z=!0,x(H),g?.(e,{nodeId:r,handleId:o,handleType:D})}function X(e){if(!z){const{x:t,y:n}=rr(e),o=t-M,r=n-P;if(!(o*o+r*r>C*C))return;Z()}if(!b()||!j)return void Y(e);const i=w();A=rr(e,O),N=$r(Vo(A,i,!1,[1,1]),n,l,j),R||(B(),R=!0);const s=Vr(e,{handle:N,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:a?"target":"source",isValidConnection:y,doc:k,lib:c,flowId:d,nodeLookup:l});T=s.handleDomNode,L=s.connection,$=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!N,s.isValid);const u={...H,isValid:$,to:s.toHandle&&$?Ho({x:s.toHandle.x,y:s.toHandle.y},i):A,toHandle:s.toHandle,toPosition:$&&s.toHandle?s.toHandle.position:po[j.position],toNode:s.toHandle?l.get(s.toHandle.nodeId):null};$&&N&&H.toHandle&&u.toHandle&&H.toHandle.type===u.toHandle.type&&H.toHandle.nodeId===u.toHandle.nodeId&&H.toHandle.id===u.toHandle.id&&H.to.x===u.to.x&&H.to.y===u.to.y||(x(u),H=u)}function Y(e){if(!("touches"in e&&e.touches.length>0)){if(z){(N||T)&&L&&$&&p?.(L);const{inProgress:t,...n}=H,o={...n,toPosition:H.toHandle?H.toPosition:null};m?.(e,o),i&&v?.(e,o)}f(),cancelAnimationFrame(_),R=!1,$=!1,L=null,T=null,k.removeEventListener("mousemove",X),k.removeEventListener("mouseup",Y),k.removeEventListener("touchmove",X),k.removeEventListener("touchend",Y)}}0===C&&Z(),k.addEventListener("mousemove",X),k.addEventListener("mouseup",Y),k.addEventListener("touchmove",X),k.addEventListener("touchend",Y)},isValid:Vr};const Zr=e=>({x:e.x,y:e.y,zoom:e.k}),Xr=({x:e,y:t,zoom:n})=>$n.translate(e,t).scale(n),Yr=(e,t)=>e.target.closest(`.${t}`),Fr=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),Wr=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Kr=(e,t=0,n=Wr,o=()=>{})=>{const r="number"==typeof t&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Gr=e=>{const t=e.ctrlKey&&Yo()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function qr({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:s,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=Wn().scaleExtent([t,n]).translateExtent(o),h=be(e).call(d);y({x:r.x,y:r.y,zoom:ko(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const f=h.on("wheel.zoom"),g=h.on("dblclick.zoom");function p(e,t){return h?new Promise(n=>{d?.interpolate("linear"===t?.interpolate?Mt:Bt).transform(Kr(h,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function m(){d.on("zoom",null)}async function y(e,t,n){const o=Xr(e),r=d?.constrain()(o,t,n);return r&&await p(r),new Promise(e=>e(r))}return d.wheelDelta(Gr),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:o,panOnScroll:r,panOnDrag:u,panOnScrollMode:p,panOnScrollSpeed:y,preventScrolling:v,zoomOnPinch:x,zoomOnScroll:w,zoomOnDoubleClick:b,zoomActivationKeyPressed:S,lib:C,onTransformChange:E,connectionInProgress:k,paneClickDistance:N,selectionOnDrag:_}){o&&!c.isZoomingOrPanning&&m();const M=r&&!S&&!o;d.clickDistance(_?1/0:!To(N)||N<0?0:N);const P=M?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:s,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Yr(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&a){const e=Se(u),t=Gr(u),r=d*Math.pow(2,t);return void o.scaleTo(n,r,e,u)}const h=1===u.deltaMode?20:1;let f=r===lo.Vertical?0:u.deltaX*h,g=r===lo.Horizontal?0:u.deltaY*h;!Yo()&&u.shiftKey&&r!==lo.Vertical&&(f=u.deltaY*h,g=0),o.translateBy(n,-f/d*i,-g/d*i,{internal:!0});const p=Zr(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,p),e.panScrollTimeout=setTimeout(()=>{c?.(u,p),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,p))}}({zoomPanValues:c,noWheelClassName:e,d3Selection:h,d3Zoom:d,panOnScrollMode:p,panOnScrollSpeed:y,zoomOnPinch:x,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:s}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i="wheel"===o.type,a=!t&&i&&!o.ctrlKey,s=Yr(o,e);if(o.ctrlKey&&i&&s&&o.preventDefault(),a||s)return null;o.preventDefault(),n.call(this,o,r)}}({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:f});if(h.on("wheel.zoom",P,{passive:!1}),!o){const e=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Zr(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,"mousedown"===o.sourceEvent?.type&&t(!0),n&&n?.(o.sourceEvent,r)}}({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:a});d.on("start",e);const t=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!(!n||!Fr(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Zr(i.transform))}}({zoomPanValues:c,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:i,onTransformChange:E});d.on("zoom",t);const o=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Fr(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const t=Zr(a.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(a.sourceEvent,t)},n?150:0)}}}({zoomPanValues:c,panOnDrag:u,panOnScroll:r,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:l});d.on("end",o)}const D=function({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:s,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const h=e||t,f=n&&d.ctrlKey,g="wheel"===d.type;if(1===d.button&&"mousedown"===d.type&&(Yr(d,`${c}-flow__node`)||Yr(d,`${c}-flow__edge`)))return!0;if(!(o||h||r||i||n))return!1;if(a)return!1;if(u&&!g)return!1;if(Yr(d,s)&&g)return!1;if(Yr(d,l)&&(!g||r&&g&&!e))return!1;if(!n&&d.ctrlKey&&g)return!1;if(!n&&"touchstart"===d.type&&d.touches?.length>1)return d.preventDefault(),!1;if(!h&&!r&&!f&&g)return!1;if(!o&&("mousedown"===d.type||"touchstart"===d.type))return!1;if(Array.isArray(o)&&!o.includes(d.button)&&"mousedown"===d.type)return!1;const p=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||g)&&p}}({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:w,panOnScroll:r,zoomOnDoubleClick:b,zoomOnPinch:x,userSelectionActive:o,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:k});d.filter(D),b?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)},destroy:m,setViewport:async function(e,t){const n=Xr(e);return await p(n,t),new Promise(e=>e(n))},setViewportConstrained:y,getViewport:function(){const e=h?Tn(h.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,t){return h?new Promise(n=>{d?.interpolate("linear"===t?.interpolate?Mt:Bt).scaleTo(Kr(h,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)},scaleBy:function(e,t){return h?new Promise(n=>{d?.interpolate("linear"===t?.interpolate?Mt:Bt).scaleBy(Kr(h,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)},setScaleExtent:function(e){d?.scaleExtent(e)},setTranslateExtent:function(e){d?.translateExtent(e)},syncViewport:function(e){if(h){const t=Xr(e),n=h.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||d?.transform(h,t,null,{sync:!0})}},setClickDistance:function(e){const t=!To(e)||e<0?0:e;d?.clickDistance(t)}}}var Ur;function Qr(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}function Jr(e,t){return Math.max(0,t-e)}function ei(e,t){return Math.max(0,e-t)}function ti(e,t,n){return Math.max(0,t-e,e-n)}function ni(e,t){return e?!t:t}!function(e){e.Line="line",e.Handle="handle"}(Ur||(Ur={}));const oi={width:0,height:0,x:0,y:0},ri={...oi,pointerX:0,pointerY:0,aspectRatio:1};function ii(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,s=n[0]*i,l=n[1]*a;return[[o-s,r-l],[o+i-s,r+a-l]]}function ai({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=be(e);let a={controlDirection:Qr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function({controlPosition:e,boundaries:s,keepAspectRatio:l,resizeDirection:c,onResizeStart:u,onResize:d,onResizeEnd:h,shouldResize:f}){let g,p={...oi},m={...ri};a={boundaries:s,resizeDirection:c,keepAspectRatio:l,controlDirection:Qr(e)};let y,v,x,w=null,b=[],S=!1;const C=Re().on("start",e=>{const{nodeLookup:o,transform:r,snapGrid:i,snapToGrid:a,nodeOrigin:s,paneDomNode:l}=n();if(g=o.get(t),!g)return;w=l?.getBoundingClientRect()??null;const{xSnapped:c,ySnapped:d}=Qo(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:a,containerBounds:w});p={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},m={...p,pointerX:c,pointerY:d,aspectRatio:p.width/p.height},y=void 0,g.parentId&&("parent"===g.extent||g.expandParent)&&(y=o.get(g.parentId),v=y&&"parent"===g.extent?function(e){return[[0,0],[e.measured.width,e.measured.height]]}(y):void 0),b=[],x=void 0;for(const[e,n]of o)if(n.parentId===t&&(b.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){const e=ii(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...p})}).on("drag",e=>{const{transform:t,snapGrid:r,snapToGrid:i,nodeOrigin:s}=n(),l=Qo(e.sourceEvent,{transform:t,snapGrid:r,snapToGrid:i,containerBounds:w}),c=[];if(!g)return;const{x:u,y:h,width:C,height:E}=p,k={},N=g.origin??s,{width:_,height:M,x:P,y:D}=function(e,t,n,o,r,i,a,s){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,h=u&&d,{xSnapped:f,ySnapped:g}=n,{minWidth:p,maxWidth:m,minHeight:y,maxHeight:v}=o,{x:x,y:w,width:b,height:S,aspectRatio:C}=e;let E=Math.floor(u?f-e.pointerX:0),k=Math.floor(d?g-e.pointerY:0);const N=b+(l?-E:E),_=S+(c?-k:k),M=-i[0]*b,P=-i[1]*S;let D=ti(N,p,m),O=ti(_,y,v);if(a){let e=0,t=0;l&&E<0?e=Jr(x+E+M,a[0][0]):!l&&E>0&&(e=ei(x+N+M,a[1][0])),c&&k<0?t=Jr(w+k+P,a[0][1]):!c&&k>0&&(t=ei(w+_+P,a[1][1])),D=Math.max(D,e),O=Math.max(O,t)}if(s){let e=0,t=0;l&&E>0?e=ei(x+E,s[0][0]):!l&&E<0&&(e=Jr(x+N,s[1][0])),c&&k>0?t=ei(w+k,s[0][1]):!c&&k<0&&(t=Jr(w+_,s[1][1])),D=Math.max(D,e),O=Math.max(O,t)}if(r){if(u){const e=ti(N/C,y,v)*C;if(D=Math.max(D,e),a){let e=0;e=!l&&!c||l&&!c&&h?ei(w+P+N/C,a[1][1])*C:Jr(w+P+(l?E:-E)/C,a[0][1])*C,D=Math.max(D,e)}if(s){let e=0;e=!l&&!c||l&&!c&&h?Jr(w+N/C,s[1][1])*C:ei(w+(l?E:-E)/C,s[0][1])*C,D=Math.max(D,e)}}if(d){const e=ti(_*C,p,m)/C;if(O=Math.max(O,e),a){let e=0;e=!l&&!c||c&&!l&&h?ei(x+_*C+M,a[1][0])/C:Jr(x+(c?k:-k)*C+M,a[0][0])/C,O=Math.max(O,e)}if(s){let e=0;e=!l&&!c||c&&!l&&h?Jr(x+_*C,s[1][0])/C:ei(x+(c?k:-k)*C,s[0][0])/C,O=Math.max(O,e)}}}k+=k<0?O:-O,E+=E<0?D:-D,r&&(h?N>_*C?k=(ni(l,c)?-E:E)/C:E=(ni(l,c)?-k:k)*C:u?(k=E/C,c=l):(E=k*C,l=c));const z=l?x+E:x,I=c?w+k:w;return{width:b+(l?-E:E),height:S+(c?-k:k),x:i[0]*E*(l?-1:1)+z,y:i[1]*k*(c?-1:1)+I}}(m,a.controlDirection,l,a.boundaries,a.keepAspectRatio,N,v,x),O=_!==C,z=M!==E,I=P!==u&&O,A=D!==h&&z;if(!(I||A||O||z))return;if((I||A||1===N[0]||1===N[1])&&(k.x=I?P:p.x,k.y=A?D:p.y,p.x=k.x,p.y=k.y,b.length>0)){const e=P-u,t=D-h;for(const n of b)n.position={x:n.position.x-e+N[0]*(_-C),y:n.position.y-t+N[1]*(M-E)},c.push(n)}if((O||z)&&(k.width=!O||a.resizeDirection&&"horizontal"!==a.resizeDirection?p.width:_,k.height=!z||a.resizeDirection&&"vertical"!==a.resizeDirection?p.height:M,p.width=k.width,p.height=k.height),y&&g.expandParent){const e=N[0]*(k.width??0);k.x&&k.x<e&&(p.x=e,m.x=m.x-(k.x-e));const t=N[1]*(k.height??0);k.y&&k.y<t&&(p.y=t,m.y=m.y-(k.y-t))}const R=function({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const a=e-t,s=n-o,l=[a>0?1:a<0?-1:0,s>0?1:s<0?-1:0];return a&&r&&(l[0]=-1*l[0]),s&&i&&(l[1]=-1*l[1]),l}({width:p.width,prevWidth:C,height:p.height,prevHeight:E,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),L={...p,direction:R},$=f?.(e,L);!1!==$&&(S=!0,d?.(e,L),o(k,c))}).on("end",e=>{S&&(h?.(e,{...p}),r?.({...p}),S=!1)});i.call(C)},destroy:function(){i.on(".drag",null)}}}function si(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var li,ci,ui,di={exports:{}},hi={},fi={exports:{}},gi={};function pi(){return ci||(ci=1,fi.exports=function(){if(li)return gi;li=1;var e=n,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=e.useState,r=e.useEffect,i=e.useLayoutEffect,a=e.useDebugValue;function s(e){var n=e.getSnapshot;e=e.value;try{var o=n();return!t(e,o)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),l=o({inst:{value:n,getSnapshot:t}}),c=l[0].inst,u=l[1];return i(function(){c.value=n,c.getSnapshot=t,s(c)&&u({inst:c})},[e,n,t]),r(function(){return s(c)&&u({inst:c}),e(function(){s(c)&&u({inst:c})})},[e]),a(n),n};return gi.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,gi}()),fi.exports}
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* use-sync-external-store-shim/with-selector.production.js
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/di.exports=function(){if(ui)return hi;ui=1;var e=n,t=pi(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,s=e.useMemo,l=e.useDebugValue;return hi.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=s(function(){function e(e){if(!a){if(a=!0,r=e,e=c(e),void 0!==u&&h.hasValue){var t=h.value;if(u(t,e))return i=t}return i=e}if(t=i,o(r,e))return t;var n=c(e);return void 0!==u&&u(t,n)?(r=e,t):(r=e,i=n)}var r,i,a=!1,s=void 0===n?null:n;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,n,c,u]);var f=r(e,d[0],d[1]);return a(function(){h.hasValue=!0,h.value=f},[f]),l(f),f},hi}();var mi=si(di.exports);const yi=e=>{let t;const n=new Set,o=(e,o)=>{const r="function"==typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=o?o:"object"!=typeof r||null===r)?r:Object.assign({},t,r),n.forEach(n=>n(t,e))}},r=()=>t,i={setState:o,getState:r,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(o,r,i);return i},vi=e=>e?yi(e):yi,{useDebugValue:xi}=n,{useSyncExternalStoreWithSelector:wi}=mi,bi=e=>e;function Si(e,t=bi,n){const o=wi(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return xi(o),o}const Ci=(e,t)=>{const n=vi(e),o=(e,o=t)=>Si(n,e,o);return Object.assign(o,n),o};function Ei(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const ki=n.createContext(null),Ni=ki.Provider,_i=Kn();function Mi(e,t){const o=n.useContext(ki);if(null===o)throw new Error(_i);return Si(o,e,t)}function Pi(){const e=n.useContext(ki);if(null===e)throw new Error(_i);return n.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Di={display:"none"},Oi={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},zi="react-flow__node-desc",Ii="react-flow__edge-desc",Ai=e=>e.ariaLiveMessage,Ri=e=>e.ariaLabelConfig;function Li({rfId:e}){const n=Mi(Ai);return t.jsx("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Oi,children:n})}function $i({rfId:e,disableKeyboardA11y:n}){const o=Mi(Ri);return t.jsxs(t.Fragment,{children:[t.jsx("div",{id:`${zi}-${e}`,style:Di,children:n?o["node.a11yDescription.default"]:o["node.a11yDescription.keyboardDisabled"]}),t.jsx("div",{id:`${Ii}-${e}`,style:Di,children:o["edge.a11yDescription.default"]}),!n&&t.jsx(Li,{rfId:e})]})}const Ti=n.forwardRef(({position:e="top-left",children:n,className:r,style:i,...a},s)=>{const l=`${e}`.split("-");return t.jsx("div",{className:o(["react-flow__panel",r,...l]),style:i,ref:s,...a,children:n})});function Bi({proOptions:e,position:n="bottom-right"}){return e?.hideAttribution?null:t.jsx(Ti,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:t.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}Ti.displayName="Panel";const ji=e=>{const t=[],n=[];for(const[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(const[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Vi=e=>e.id;function Hi(e,t){return Ei(e.selectedNodes.map(Vi),t.selectedNodes.map(Vi))&&Ei(e.selectedEdges.map(Vi),t.selectedEdges.map(Vi))}function Zi({onSelectionChange:e}){const t=Pi(),{selectedNodes:o,selectedEdges:r}=Mi(ji,Hi);return n.useEffect(()=>{const n={nodes:o,edges:r};e?.(n),t.getState().onSelectionChangeHandlers.forEach(e=>e(n))},[o,r,e]),null}const Xi=e=>!!e.onSelectionChangeHandlers;function Yi({onSelectionChange:e}){const n=Mi(Xi);return e||n?t.jsx(Zi,{onSelectionChange:e}):null}const Fi=[0,0],Wi={x:0,y:0,zoom:1},Ki=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","rfId"],Gi=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),qi={translateExtent:ro,nodeOrigin:Fi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ui(e){const{setNodes:t,setEdges:o,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:s,reset:l,setDefaultNodesAndEdges:c}=Mi(Gi,Ei),u=Pi();n.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=qi,l()}),[]);const d=n.useRef(qi);return n.useEffect(()=>{for(const n of Ki){const l=e[n];l!==d.current[n]&&(void 0!==e[n]&&("nodes"===n?t(l):"edges"===n?o(l):"minZoom"===n?r(l):"maxZoom"===n?i(l):"translateExtent"===n?a(l):"nodeExtent"===n?s(l):"ariaLabelConfig"===n?u.setState({ariaLabelConfig:Uo(l)}):"fitView"===n?u.setState({fitViewQueued:l}):"fitViewOptions"===n?u.setState({fitViewOptions:l}):u.setState({[n]:l})))}d.current=e},Ki.map(t=>e[t])),null}function Qi(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const Ji="undefined"!=typeof document?document:null;function ea(e=null,t={target:Ji,actInsideInputWithModifier:!0}){const[o,r]=n.useState(!1),i=n.useRef(!1),a=n.useRef(new Set([])),[s,l]=n.useMemo(()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter(e=>"string"==typeof e).map(e=>e.replace("+","\n").replace("\n\n","\n+").split("\n")),n=t.reduce((e,t)=>e.concat(...t),[]);return[t,n]}return[[],[]]},[e]);return n.useEffect(()=>{const n=t?.target??Ji,o=t?.actInsideInputWithModifier??!0;if(null!==e){const e=e=>{i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey;if((!i.current||i.current&&!o)&&nr(e))return!1;const n=na(e.code,l);if(a.current.add(e[n]),ta(s,a.current,!1)){const n=e.composedPath?.()?.[0]||e.target,o="BUTTON"===n?.nodeName||"A"===n?.nodeName;!1===t.preventDefault||!i.current&&o||e.preventDefault(),r(!0)}},c=e=>{const t=na(e.code,l);ta(s,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),"Meta"===e.key&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",c),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",c),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}},[e,r]),o}function ta(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function na(e,t){return t.includes(e)?"code":"key"}function oa(e,t){const n=[],o=new Map,r=[];for(const t of e)if("add"!==t.type)if("remove"===t.type||"replace"===t.type)o.set(t.id,[t]);else{const e=o.get(t.id);e?e.push(t):o.set(t.id,[t])}else r.push(t);for(const e of t){const t=o.get(e.id);if(!t){n.push(e);continue}if("remove"===t[0].type)continue;if("replace"===t[0].type){n.push({...t[0].item});continue}const r={...e};for(const e of t)ra(e,r);n.push(r)}return r.length&&r.forEach(e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})}),n}function ra(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":void 0!==e.position&&(t.position=e.position),void 0!==e.dragging&&(t.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(t.measured??={},t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&(!0!==e.setAttributes&&"width"!==e.setAttributes||(t.width=e.dimensions.width),!0!==e.setAttributes&&"height"!==e.setAttributes||(t.height=e.dimensions.height))),"boolean"==typeof e.resizing&&(t.resizing=e.resizing)}}function ia(e,t){return oa(e,t)}function aa(e,t){return{id:e,type:"select",selected:t}}function sa(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const e=t.has(r);void 0===i.selected&&!e||i.selected===e||(n&&(i.selected=e),o.push(aa(i.id,e)))}return o}function la({items:e=[],lookup:t}){const n=[],o=new Map(e.map(e=>[e.id,e]));for(const[o,r]of e.entries()){const e=t.get(r.id),i=e?.internals?.userNode??e;void 0!==i&&i!==r&&n.push({id:r.id,item:r,type:"replace"}),void 0===i&&n.push({item:r,type:"add",index:o})}for(const[e]of t){void 0===o.get(e)&&n.push({id:e,type:"remove"})}return n}function ca(e){return{id:e.id,type:"remove"}}const ua=e=>(e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function da(e){return n.forwardRef(e)}const ha="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function fa(e){const[t,o]=n.useState(BigInt(0)),[r]=n.useState(()=>function(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}(()=>o(e=>e+BigInt(1))));return ha(()=>{const t=r.get();t.length&&(e(t),r.reset())},[t]),r}const ga=n.createContext(null);function pa({children:e}){const o=Pi(),r=fa(n.useCallback(e=>{const{nodes:t=[],setNodes:n,hasDefaultNodes:r,onNodesChange:i,nodeLookup:a,fitViewQueued:s}=o.getState();let l=t;for(const t of e)l="function"==typeof t?t(l):t;const c=la({items:l,lookup:a});r&&n(l),c.length>0?i?.(c):s&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:t,setNodes:n}=o.getState();e&&n(t)})},[])),i=fa(n.useCallback(e=>{const{edges:t=[],setEdges:n,hasDefaultEdges:r,onEdgesChange:i,edgeLookup:a}=o.getState();let s=t;for(const t of e)s="function"==typeof t?t(s):t;r?n(s):i&&i(la({items:s,lookup:a}))},[])),a=n.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return t.jsx(ga.Provider,{value:a,children:e})}const ma=e=>!!e.panZoom;function ya(){const e=(()=>{const e=Pi();return n.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:a,panZoom:s}=e.getState(),l=Xo(t,o,r,i,a,n?.padding??.1);return s?(await s.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:s,y:l}=a.getBoundingClientRect(),c={x:t.x-s,y:t.y-l},u=n.snapGrid??r,d=n.snapToGrid??i;return Vo(c,o,d,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),a=Ho(t,n);return{x:a.x+r,y:a.y+i}}}),[])})(),t=Pi(),o=function(){const e=n.useContext(ga);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),r=Mi(ma),i=n.useMemo(()=>{const e=e=>t.getState().nodeLookup.get(e),n=e=>{o.nodeQueue.push(e)},r=e=>{o.edgeQueue.push(e)},i=e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState(),r=ua(e)?e:n.get(e.id),i=r.parentId?Go(r.position,r.measured,r.parentId,n,o):r.position,a={...r,position:i,width:r.measured?.width??r.width,height:r.measured?.height??r.height};return Io(a)},a=(e,t,o={replace:!1})=>{n(n=>n.map(n=>{if(n.id===e){const e="function"==typeof t?t(n):t;return o.replace&&ua(e)?e:{...n,...e}}return n}))},s=(e,t,n={replace:!1})=>{r(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&yo(e)?e:{...o,...e}}return o}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:n,setEdges:r,addNodes:e=>{const t=Array.isArray(e)?e:[e];o.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];o.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:n=[],transform:o}=t.getState(),[r,i,a]=o;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:r,y:i,zoom:a}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{const{nodes:o,edges:r,onNodesDelete:i,onEdgesDelete:a,triggerNodeChanges:s,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:u}=t.getState(),{nodes:d,edges:h}=await Eo({nodesToRemove:e,edgesToRemove:n,nodes:o,edges:r,onBeforeDelete:u}),f=h.length>0,g=d.length>0;if(f){const e=h.map(ca);a?.(h),l(e)}if(g){const e=d.map(ca);i?.(d),s(e)}return(g||f)&&c?.({nodes:d,edges:h}),{deletedNodes:d,deletedEdges:h}},getIntersectingNodes:(e,n=!0,o)=>{const r=$o(e),a=r?e:i(e),s=void 0!==o;return a?(o||t.getState().nodes).filter(o=>{const i=t.getState().nodeLookup.get(o.id);if(i&&!r&&(o.id===e.id||!i.internals.positionAbsolute))return!1;const l=Io(s?o:i),c=Lo(l,a);return n&&c>0||c>=l.width*l.height||c>=a.width*a.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{const o=$o(e)?e:i(e);if(!o)return!1;const r=Lo(o,t);return n&&r>0||r>=t.width*t.height||r>=o.width*o.height},updateNode:a,updateNodeData:(e,t,n={replace:!1})=>{a(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},getNodesBounds:e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState();return((e,t={nodeOrigin:[0,0]})=>{if(0===e.length)return{x:0,y:0,width:0,height:0};const n=e.reduce((e,n)=>{const o="string"==typeof n;let r=t.nodeLookup||o?void 0:n;t.nodeLookup&&(r=o?t.nodeLookup.get(n):vo(n)?n:t.nodeLookup.get(n.id));const i=r?Ao(r,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Do(e,i)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return zo(n)})(e,{nodeLookup:n,nodeOrigin:o})},getHandleConnections:({type:e,id:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}-${e}${n?`-${n}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}${e?n?`-${e}-${n}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const n=t.getState().fitViewResolver??function(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:n}),o.nodeQueue.push(e=>[...e]),n.promise}}},[]);return n.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const va=e=>e.selected,xa="undefined"!=typeof window?window:void 0;const wa={position:"absolute",width:"100%",height:"100%",top:0,left:0},ba=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Sa({onPaneContextMenu:e,zoomOnScroll:o=!0,zoomOnPinch:r=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:s=lo.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:u,translateExtent:d,minZoom:h,maxZoom:f,zoomActivationKeyCode:g,preventScrolling:p=!0,children:m,noWheelClassName:y,noPanClassName:v,onViewportChange:x,isControlledViewport:w,paneClickDistance:b,selectionOnDrag:S}){const C=Pi(),E=n.useRef(null),{userSelectionActive:k,lib:N,connectionInProgress:_}=Mi(ba,Ei),M=ea(g),P=n.useRef();!function(e){const t=Pi();n.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??1))return!1;const n=Jo(e.current);0!==n.height&&0!==n.width||t.getState().onError?.("004",qn()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener("resize",n);const t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener("resize",n),t&&e.current&&t.unobserve(e.current)}}},[])}(E);const D=n.useCallback(e=>{x?.({x:e[0],y:e[1],zoom:e[2]}),w||C.setState({transform:e})},[x,w]);return n.useEffect(()=>{if(E.current){P.current=qr({domNode:E.current,minZoom:h,maxZoom:f,translateExtent:d,viewport:u,onDraggingChange:e=>C.setState({paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:o}=C.getState();o?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:o}=C.getState();o?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:o}=C.getState();o?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=P.current.getViewport();return C.setState({panZoom:P.current,transform:[e,t,n],domNode:E.current.closest(".react-flow")}),()=>{P.current?.destroy()}}},[]),n.useEffect(()=>{P.current?.update({onPaneContextMenu:e,zoomOnScroll:o,zoomOnPinch:r,panOnScroll:i,panOnScrollSpeed:a,panOnScrollMode:s,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:M,preventScrolling:p,noPanClassName:v,userSelectionActive:k,noWheelClassName:y,lib:N,onTransformChange:D,connectionInProgress:_,selectionOnDrag:S,paneClickDistance:b})},[e,o,r,i,a,s,l,c,M,p,v,k,y,N,D,_,S,b]),t.jsx("div",{className:"react-flow__renderer",ref:E,style:wa,children:m})}const Ca=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ea(){const{userSelectionActive:e,userSelectionRect:n}=Mi(Ca,Ei);return e&&n?t.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const ka=(e,t)=>n=>{n.target===t.current&&e?.(n)},Na=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function _a({isSelecting:e,selectionKeyPressed:r,selectionMode:i=co.Full,panOnDrag:a,paneClickDistance:s,selectionOnDrag:l,onSelectionStart:c,onSelectionEnd:u,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:f,onPaneMouseEnter:g,onPaneMouseMove:p,onPaneMouseLeave:m,children:y}){const v=Pi(),{userSelectionActive:x,elementsSelectable:w,dragging:b,connectionInProgress:S}=Mi(Na,Ei),C=w&&(e||x),E=n.useRef(null),k=n.useRef(),N=n.useRef(new Set),_=n.useRef(new Set),M=n.useRef(!1),P=e=>{M.current||S?M.current=!1:(d?.(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1}))},D=f?e=>f(e):void 0,O=!0===a||Array.isArray(a)&&a.includes(0);return t.jsxs("div",{className:o(["react-flow__pane",{draggable:O,dragging:b,selection:e}]),onClick:C?void 0:ka(P,E),onContextMenu:ka(e=>{Array.isArray(a)&&a?.includes(2)?e.preventDefault():h?.(e)},E),onWheel:ka(D,E),onPointerEnter:C?void 0:g,onPointerMove:C?e=>{const{userSelectionRect:t,transform:n,nodeLookup:o,edgeLookup:a,connectionLookup:l,triggerNodeChanges:u,triggerEdgeChanges:d,defaultEdgeOptions:h,resetSelectedElements:f}=v.getState();if(!k.current||!t)return;const{x:g,y:p}=rr(e.nativeEvent,k.current),{startX:m,startY:y}=t;if(!M.current){const t=r?0:s;if(Math.hypot(g-m,p-y)<=t)return;f(),c?.(e)}M.current=!0;const x={startX:m,startY:y,x:g<m?g:m,y:p<y?p:y,width:Math.abs(g-m),height:Math.abs(p-y)},w=N.current,b=_.current;N.current=new Set(bo(o,x,n,i===co.Partial,!0).map(e=>e.id)),_.current=new Set;const S=h?.selectable??!0;for(const e of N.current){const t=l.get(e);if(t)for(const{edgeId:e}of t.values()){const t=a.get(e);t&&(t.selectable??S)&&_.current.add(e)}}if(!qo(w,N.current)){u(sa(o,N.current,!0))}if(!qo(b,_.current)){d(sa(a,_.current))}v.setState({userSelectionRect:x,userSelectionActive:!0,nodesSelectionActive:!1})}:p,onPointerUp:C?e=>{0===e.button&&(e.target?.releasePointerCapture?.(e.pointerId),!x&&e.target===E.current&&v.getState().userSelectionRect&&P?.(e),v.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(u?.(e),v.setState({nodesSelectionActive:N.current.size>0})))}:void 0,onPointerDownCapture:C?t=>{const{domNode:n}=v.getState();if(k.current=n?.getBoundingClientRect(),!k.current)return;const o=t.target===E.current;if(!o&&!!t.target.closest(".nokey")||!e||!(l&&o||r)||0!==t.button||!t.isPrimary)return;t.target?.setPointerCapture?.(t.pointerId),M.current=!1;const{x:i,y:a}=rr(t.nativeEvent,k.current);v.setState({userSelectionRect:{width:0,height:0,startX:i,startY:a,x:i,y:a}}),o||(t.stopPropagation(),t.preventDefault())}:void 0,onClickCapture:C?e=>{M.current&&(e.stopPropagation(),M.current=!1)}:void 0,onPointerLeave:m,ref:E,style:wa,children:[y,t.jsx(Ea,{})]})}function Ma({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:s,onError:l}=t.getState(),c=s.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&a)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])):l?.("012",no(e))}function Pa({nodeRef:e,disabled:t=!1,noDragClassName:o,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:s}){const l=Pi(),[c,u]=n.useState(!1),d=n.useRef();return n.useEffect(()=>{d.current=Lr({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{Ma({id:t,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),n.useEffect(()=>{if(t)d.current?.destroy();else if(e.current)return d.current?.update({noDragClassName:o,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:s}),()=>{d.current?.destroy()}},[o,r,t,a,e,i]),c}function Da(){const e=Pi();return n.useCallback(t=>{const{nodeExtent:n,snapToGrid:o,snapGrid:r,nodesDraggable:i,onError:a,updateNodePositions:s,nodeLookup:l,nodeOrigin:c}=e.getState(),u=new Map,d=(e=>t=>t.selected&&(t.draggable||e&&void 0===t.draggable))(i),h=o?r[0]:5,f=o?r[1]:5,g=t.direction.x*h*t.factor,p=t.direction.y*f*t.factor;for(const[,e]of l){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+g,y:e.internals.positionAbsolute.y+p};o&&(t=jo(t,r));const{position:i,positionAbsolute:s}=Co({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:a});e.position=i,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}const Oa=n.createContext(null),za=Oa.Provider;Oa.Consumer;const Ia=()=>n.useContext(Oa),Aa=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId});const Ra=n.memo(da(function({type:e="source",position:n=go.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:a=!0,isConnectableEnd:s=!0,id:l,onConnect:c,children:u,className:d,onMouseDown:h,onTouchStart:f,...g},p){const m=l||null,y="target"===e,v=Pi(),x=Ia(),{connectOnClick:w,noPanClassName:b,rfId:S}=Mi(Aa,Ei),{connectingFrom:C,connectingTo:E,clickConnecting:k,isPossibleEndHandle:N,connectionInProcess:_,clickConnectionInProcess:M,valid:P}=Mi(((e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:a}=o,{fromHandle:s,toHandle:l,isValid:c}=a,u=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===so.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!r,valid:u&&c}})(x,m,e),Ei);x||v.getState().onError?.("010",eo());const D=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=v.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t}=v.getState();t(((e,t)=>{if(!e.source||!e.target)return t;let n;return n=yo(e)?{...e}:{...e,id:hr(e)},((e,t)=>t.some(t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle))))(n,t)?t:(null===n.sourceHandle&&delete n.sourceHandle,null===n.targetHandle&&delete n.targetHandle,t.concat(n))})(r,e))}n?.(r),c?.(r)},O=e=>{if(!x)return;const t=or(e.nativeEvent);if(a&&(t&&0===e.button||!t)){const t=v.getState();Hr.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:y,handleId:m,nodeId:x,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:D,isValidConnection:r||t.isValidConnection,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?h?.(e):f?.(e)};return t.jsx("div",{"data-handleid":m,"data-nodeid":x,"data-handlepos":n,"data-id":`${S}-${x}-${m}-${e}`,className:o(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",b,d,{source:!y,target:y,connectable:i,connectablestart:a,connectableend:s,clickconnecting:k,connectingfrom:C,connectingto:E,valid:P,connectionindicator:i&&(!_||N)&&(_||M?s:a)}]),onMouseDown:O,onTouchStart:O,onClick:w?t=>{const{onClickConnectStart:n,onClickConnectEnd:o,connectionClickStartHandle:i,connectionMode:s,isValidConnection:l,lib:c,rfId:u,nodeLookup:d,connection:h}=v.getState();if(!x||!i&&!a)return;if(!i)return n?.(t.nativeEvent,{nodeId:x,handleId:m,handleType:e}),void v.setState({connectionClickStartHandle:{nodeId:x,type:e,id:m}});const f=er(t.target),g=r||l,{connection:p,isValid:y}=Hr.isValid(t.nativeEvent,{handle:{nodeId:x,id:m,type:e},connectionMode:s,fromNodeId:i.nodeId,fromHandleId:i.id||null,fromType:i.type,isValidConnection:g,flowId:u,doc:f,lib:c,nodeLookup:d});y&&p&&D(p);const w=structuredClone(h);delete w.inProgress,w.toPosition=w.toHandle?w.toHandle.position:null,o?.(t,w),v.setState({connectionClickStartHandle:null})}:void 0,ref:p,...g,children:u})}));const La={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},$a={input:function({data:e,isConnectable:n,sourcePosition:o=go.Bottom}){return t.jsxs(t.Fragment,{children:[e?.label,t.jsx(Ra,{type:"source",position:o,isConnectable:n})]})},default:function({data:e,isConnectable:n,targetPosition:o=go.Top,sourcePosition:r=go.Bottom}){return t.jsxs(t.Fragment,{children:[t.jsx(Ra,{type:"target",position:o,isConnectable:n}),e?.label,t.jsx(Ra,{type:"source",position:r,isConnectable:n})]})},output:function({data:e,isConnectable:n,targetPosition:o=go.Top}){return t.jsxs(t.Fragment,{children:[t.jsx(Ra,{type:"target",position:o,isConnectable:n}),e?.label]})},group:function(){return null}};const Ta=e=>{const{width:t,height:n,x:o,y:r}=wo(e.nodeLookup,{filter:e=>!!e.selected});return{width:To(t)?t:null,height:To(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function Ba({onSelectionContextMenu:e,noPanClassName:r,disableKeyboardA11y:i}){const a=Pi(),{width:s,height:l,transformString:c,userSelectionActive:u}=Mi(Ta,Ei),d=Da(),h=n.useRef(null);if(n.useEffect(()=>{i||h.current?.focus({preventScroll:!0})},[i]),Pa({nodeRef:h}),u||!s||!l)return null;const f=e?t=>{const n=a.getState().nodes.filter(e=>e.selected);e(t,n)}:void 0;return t.jsx("div",{className:o(["react-flow__nodesselection","react-flow__container",r]),style:{transform:c},children:t.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:i?void 0:-1,onKeyDown:i?void 0:e=>{Object.prototype.hasOwnProperty.call(La,e.key)&&(e.preventDefault(),d({direction:La[e.key],factor:e.shiftKey?4:1}))},style:{width:s,height:l}})})}const ja="undefined"!=typeof window?window:void 0,Va=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Ha({children:e,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:h,selectionMode:f,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:v,elementsSelectable:x,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:S,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:N,defaultViewport:_,translateExtent:M,minZoom:P,maxZoom:D,preventScrolling:O,onSelectionContextMenu:z,noWheelClassName:I,noPanClassName:A,disableKeyboardA11y:R,onViewportChange:L,isControlledViewport:$}){const{nodesSelectionActive:T,userSelectionActive:B}=Mi(Va),j=ea(d,{target:ja}),V=ea(y,{target:ja}),H=V||N,Z=V||S,X=h&&!0!==H,Y=j||B||X;return function({deleteKeyCode:e,multiSelectionKeyCode:t}){const o=Pi(),{deleteElements:r}=ya(),i=ea(e,{actInsideInputWithModifier:!1}),a=ea(t,{target:xa});n.useEffect(()=>{if(i){const{edges:e,nodes:t}=o.getState();r({nodes:t.filter(va),edges:e.filter(va)}),o.setState({nodesSelectionActive:!1})}},[i]),n.useEffect(()=>{o.setState({multiSelectionActive:a})},[a])}({deleteKeyCode:u,multiSelectionKeyCode:m}),t.jsx(Sa,{onPaneContextMenu:s,elementsSelectable:x,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:Z,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:!j&&H,defaultViewport:_,translateExtent:M,minZoom:P,maxZoom:D,zoomActivationKeyCode:v,preventScrolling:O,noWheelClassName:I,noPanClassName:A,onViewportChange:L,isControlledViewport:$,paneClickDistance:c,selectionOnDrag:X,children:t.jsxs(_a,{onSelectionStart:g,onSelectionEnd:p,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,panOnDrag:H,isSelecting:!!Y,selectionMode:f,selectionKeyPressed:j,paneClickDistance:c,selectionOnDrag:X,children:[e,T&&t.jsx(Ba,{onSelectionContextMenu:z,noPanClassName:A,disableKeyboardA11y:R})]})})}Ha.displayName="FlowRenderer";const Za=n.memo(Ha);function Xa(e){return Mi(n.useCallback((e=>t=>e?bo(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys()))(e),[e]),Ei)}const Ya=e=>e.updateNodeInternals;var Fa=n.memo(function({id:e,onClick:r,onMouseEnter:i,onMouseMove:a,onMouseLeave:s,onContextMenu:l,onDoubleClick:c,nodesDraggable:u,elementsSelectable:d,nodesConnectable:h,nodesFocusable:f,resizeObserver:g,noDragClassName:p,noPanClassName:m,disableKeyboardA11y:y,rfId:v,nodeTypes:x,nodeClickDistance:w,onError:b}){const{node:S,internals:C,isParent:E}=Mi(t=>{const n=t.nodeLookup.get(e),o=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:o}},Ei);let k=S.type||"default",N=x?.[k]||$a[k];void 0===N&&(b?.("003",Gn(k)),k="default",N=x?.default||$a.default);const _=!!(S.draggable||u&&void 0===S.draggable),M=!!(S.selectable||d&&void 0===S.selectable),P=!!(S.connectable||h&&void 0===S.connectable),D=!!(S.focusable||f&&void 0===S.focusable),O=Pi(),z=Ko(S),I=function({node:e,nodeType:t,hasDimensions:o,resizeObserver:r}){const i=Pi(),a=n.useRef(null),s=n.useRef(null),l=n.useRef(e.sourcePosition),c=n.useRef(e.targetPosition),u=n.useRef(t),d=o&&!!e.internals.handleBounds;return n.useEffect(()=>{!a.current||e.hidden||d&&s.current===a.current||(s.current&&r?.unobserve(s.current),r?.observe(a.current),s.current=a.current)},[d,e.hidden]),n.useEffect(()=>()=>{s.current&&(r?.unobserve(s.current),s.current=null)},[]),n.useEffect(()=>{if(a.current){const n=u.current!==t,o=l.current!==e.sourcePosition,r=c.current!==e.targetPosition;(n||o||r)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}({node:S,nodeType:k,hasDimensions:z,resizeObserver:g}),A=Pa({nodeRef:I,disabled:S.hidden||!_,noDragClassName:p,handleSelector:S.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:w}),R=Da();if(S.hidden)return null;const L=Wo(S),$=function(e){return void 0===e.internals.handleBounds?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}(S),T=M||_||r||i||a||s,B=i?e=>i(e,{...C.userNode}):void 0,j=a?e=>a(e,{...C.userNode}):void 0,V=s?e=>s(e,{...C.userNode}):void 0,H=l?e=>l(e,{...C.userNode}):void 0,Z=c?e=>c(e,{...C.userNode}):void 0;return t.jsx("div",{className:o(["react-flow__node",`react-flow__node-${k}`,{[m]:_},S.className,{selected:S.selected,selectable:M,parent:E,draggable:_,dragging:A}]),ref:I,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:z?"visible":"hidden",...S.style,...$},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:j,onMouseLeave:V,onContextMenu:H,onClick:t=>{const{selectNodesOnDrag:n,nodeDragThreshold:o}=O.getState();M&&(!n||!_||o>0)&&Ma({id:e,store:O,nodeRef:I}),r&&r(t,{...C.userNode})},onDoubleClick:Z,onKeyDown:D?t=>{if(!nr(t.nativeEvent)&&!y)if(io.includes(t.key)&&M){const n="Escape"===t.key;Ma({id:e,store:O,unselect:n,nodeRef:I})}else if(_&&S.selected&&Object.prototype.hasOwnProperty.call(La,t.key)){t.preventDefault();const{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:t.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),R({direction:La[t.key],factor:t.shiftKey?4:1})}}:void 0,tabIndex:D?0:void 0,onFocus:D?()=>{if(y||!I.current?.matches(":focus-visible"))return;const{transform:t,width:n,height:o,autoPanOnNodeFocus:r,setCenter:i}=O.getState();if(!r)return;bo(new Map([[e,S]]),{x:0,y:0,width:n,height:o},t,!0).length>0||i(S.position.x+L.width/2,S.position.y+L.height/2,{zoom:t[2]})}:void 0,role:S.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${zi}-${v}`,"aria-label":S.ariaLabel,...S.domAttributes,children:t.jsx(za,{value:e,children:t.jsx(N,{id:e,data:S.data,type:k,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:S.selected??!1,selectable:M,draggable:_,deletable:S.deletable??!0,isConnectable:P,sourcePosition:S.sourcePosition,targetPosition:S.targetPosition,dragging:A,dragHandle:S.dragHandle,zIndex:C.z,parentId:S.parentId,...L})})})});const Wa=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Ka(e){const{nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:a,onError:s}=Mi(Wa,Ei),l=Xa(e.onlyRenderVisibleElements),c=function(){const e=Mi(Ya),[t]=n.useState(()=>"undefined"==typeof ResizeObserver?null:new ResizeObserver(t=>{const n=new Map;t.forEach(e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return n.useEffect(()=>()=>{t?.disconnect()},[t]),t}();return t.jsx("div",{className:"react-flow__nodes",style:wa,children:l.map(n=>t.jsx(Fa,{id:n,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:c,nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:a,nodeClickDistance:e.nodeClickDistance,onError:s},n))})}Ka.displayName="NodeRenderer";const Ga=n.memo(Ka);const qa={[fo.Arrow]:({color:e="none",strokeWidth:n=1})=>{const o={strokeWidth:n,...e&&{stroke:e}};return t.jsx("polyline",{className:"arrow",style:o,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[fo.ArrowClosed]:({color:e="none",strokeWidth:n=1})=>{const o={strokeWidth:n,...e&&{stroke:e,fill:e}};return t.jsx("polyline",{className:"arrowclosed",style:o,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}};const Ua=({id:e,type:o,color:r,width:i=12.5,height:a=12.5,markerUnits:s="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const u=function(e){const t=Pi();return n.useMemo(()=>Object.prototype.hasOwnProperty.call(qa,e)?qa[e]:(t.getState().onError?.("009",Qn(e)),null),[e])}(o);return u?t.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0",children:t.jsx(u,{color:r,strokeWidth:l})}):null},Qa=({defaultColor:e,rfId:o})=>{const r=Mi(e=>e.edges),i=Mi(e=>e.defaultEdgeOptions),a=n.useMemo(()=>{const t=function(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((e,a)=>([a.markerStart||o,a.markerEnd||r].forEach(o=>{if(o&&"object"==typeof o){const r=Sr(o,t);i.has(r)||(e.push({id:r,color:o.color||n,...o}),i.add(r))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}(r,{id:o,defaultColor:e,defaultMarkerStart:i?.markerStart,defaultMarkerEnd:i?.markerEnd});return t},[r,i,o,e]);return a.length?t.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:t.jsx("defs",{children:a.map(e=>t.jsx(Ua,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Qa.displayName="MarkerDefinitions";var Ja=n.memo(Qa);function es({x:e,y:r,label:i,labelStyle:a,labelShowBg:s=!0,labelBgStyle:l,labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:d,className:h,...f}){const[g,p]=n.useState({x:1,y:0,width:0,height:0}),m=o(["react-flow__edge-textwrapper",h]),y=n.useRef(null);return n.useEffect(()=>{if(y.current){const e=y.current.getBBox();p({x:e.x,y:e.y,width:e.width,height:e.height})}},[i]),i?t.jsxs("g",{transform:`translate(${e-g.width/2} ${r-g.height/2})`,className:m,visibility:g.width?"visible":"hidden",...f,children:[s&&t.jsx("rect",{width:g.width+2*c[0],x:-c[0],y:-c[1],height:g.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:u,ry:u}),t.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:y,style:a,children:i}),d]}):null}es.displayName="EdgeText";const ts=n.memo(es);function ns({path:e,labelX:n,labelY:r,label:i,labelStyle:a,labelShowBg:s,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u,interactionWidth:d=20,...h}){return t.jsxs(t.Fragment,{children:[t.jsx("path",{...h,d:e,fill:"none",className:o(["react-flow__edge-path",h.className])}),d?t.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,i&&To(n)&&To(r)?t.jsx(ts,{x:n,y:r,label:i,labelStyle:a,labelShowBg:s,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u}):null]})}function os({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===go.Left||e===go.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function rs({sourceX:e,sourceY:t,sourcePosition:n=go.Bottom,targetX:o,targetY:r,targetPosition:i=go.Top}){const[a,s]=os({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=os({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,d,h,f]=ar({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:s,targetControlX:l,targetControlY:c});return[`M${e},${t} C${a},${s} ${l},${c} ${o},${r}`,u,d,h,f]}function is(e){return n.memo(({id:n,sourceX:o,sourceY:r,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:y,interactionWidth:v})=>{const[x,w,b]=rs({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),S=e.isInternal?void 0:n;return t.jsx(ns,{id:S,path:x,labelX:w,labelY:b,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:y,interactionWidth:v})})}const as=is({isInternal:!1}),ss=is({isInternal:!0});function ls(e){return n.memo(({id:n,sourceX:o,sourceY:r,targetX:i,targetY:a,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,sourcePosition:g=go.Bottom,targetPosition:p=go.Top,markerEnd:m,markerStart:y,pathOptions:v,interactionWidth:x})=>{const[w,b,S]=yr({sourceX:o,sourceY:r,sourcePosition:g,targetX:i,targetY:a,targetPosition:p,borderRadius:v?.borderRadius,offset:v?.offset,stepPosition:v?.stepPosition}),C=e.isInternal?void 0:n;return t.jsx(ns,{id:C,path:w,labelX:b,labelY:S,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:y,interactionWidth:x})})}as.displayName="SimpleBezierEdge",ss.displayName="SimpleBezierEdgeInternal";const cs=ls({isInternal:!1}),us=ls({isInternal:!0});function ds(e){return n.memo(({id:o,...r})=>{const i=e.isInternal?void 0:o;return t.jsx(cs,{...r,id:i,pathOptions:n.useMemo(()=>({borderRadius:0,offset:r.pathOptions?.offset}),[r.pathOptions?.offset])})})}cs.displayName="SmoothStepEdge",us.displayName="SmoothStepEdgeInternal";const hs=ds({isInternal:!1}),fs=ds({isInternal:!0});function gs(e){return n.memo(({id:n,sourceX:o,sourceY:r,targetX:i,targetY:a,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:g,markerStart:p,interactionWidth:m})=>{const[y,v,x]=fr({sourceX:o,sourceY:r,targetX:i,targetY:a}),w=e.isInternal?void 0:n;return t.jsx(ns,{id:w,path:y,labelX:v,labelY:x,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:g,markerStart:p,interactionWidth:m})})}hs.displayName="StepEdge",fs.displayName="StepEdgeInternal";const ps=gs({isInternal:!1}),ms=gs({isInternal:!0});function ys(e){return n.memo(({id:n,sourceX:o,sourceY:r,targetX:i,targetY:a,sourcePosition:s=go.Bottom,targetPosition:l=go.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:y,pathOptions:v,interactionWidth:x})=>{const[w,b,S]=cr({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l,curvature:v?.curvature}),C=e.isInternal?void 0:n;return t.jsx(ns,{id:C,path:w,labelX:b,labelY:S,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:y,interactionWidth:x})})}ps.displayName="StraightEdge",ms.displayName="StraightEdgeInternal";const vs=ys({isInternal:!1}),xs=ys({isInternal:!0});vs.displayName="BezierEdge",xs.displayName="BezierEdgeInternal";const ws={default:xs,straight:ms,step:fs,smoothstep:us,simplebezier:ss},bs={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Ss=(e,t,n)=>n===go.Left?e-t:n===go.Right?e+t:e,Cs=(e,t,n)=>n===go.Top?e-t:n===go.Bottom?e+t:e,Es="react-flow__edgeupdater";function ks({position:e,centerX:n,centerY:r,radius:i=10,onMouseDown:a,onMouseEnter:s,onMouseOut:l,type:c}){return t.jsx("circle",{onMouseDown:a,onMouseEnter:s,onMouseOut:l,className:o([Es,`${Es}-${c}`]),cx:Ss(n,i,e),cy:Cs(r,i,e),r:i,stroke:"transparent",fill:"transparent"})}function Ns({isReconnectable:e,reconnectRadius:n,edge:o,sourceX:r,sourceY:i,targetX:a,targetY:s,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:h,setReconnecting:f,setUpdateHover:g}){const p=Pi(),m=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:n,domNode:r,isValidConnection:i,connectionMode:a,connectionRadius:s,lib:l,onConnectStart:c,onConnectEnd:g,cancelConnection:m,nodeLookup:y,rfId:v,panBy:x,updateConnection:w}=p.getState(),b="target"===t.type;Hr.onPointerDown(e.nativeEvent,{autoPanOnConnect:n,connectionMode:a,connectionRadius:s,domNode:r,handleId:t.id,nodeId:t.nodeId,nodeLookup:y,isTarget:b,edgeUpdaterType:t.type,lib:l,flowId:v,cancelConnection:m,panBy:x,isValidConnection:i,onConnect:e=>u?.(o,e),onConnectStart:(n,r)=>{f(!0),d?.(e,o,t.type),c?.(n,r)},onConnectEnd:g,onReconnectEnd:(e,n)=>{f(!1),h?.(e,o,t.type,n)},updateConnection:w,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},y=()=>g(!0),v=()=>g(!1);return t.jsxs(t.Fragment,{children:[(!0===e||"source"===e)&&t.jsx(ks,{position:l,centerX:r,centerY:i,radius:n,onMouseDown:e=>m(e,{nodeId:o.target,id:o.targetHandle??null,type:"target"}),onMouseEnter:y,onMouseOut:v,type:"source"}),(!0===e||"target"===e)&&t.jsx(ks,{position:c,centerX:a,centerY:s,radius:n,onMouseDown:e=>m(e,{nodeId:o.source,id:o.sourceHandle??null,type:"source"}),onMouseEnter:y,onMouseOut:v,type:"target"})]})}var _s=n.memo(function({id:e,edgesFocusable:r,edgesReconnectable:i,elementsSelectable:a,onClick:s,onDoubleClick:l,onContextMenu:c,onMouseEnter:u,onMouseMove:d,onMouseLeave:h,reconnectRadius:f,onReconnect:g,onReconnectStart:p,onReconnectEnd:m,rfId:y,edgeTypes:v,noPanClassName:x,onError:w,disableKeyboardA11y:b}){let S=Mi(t=>t.edgeLookup.get(e));const C=Mi(e=>e.defaultEdgeOptions);S=C?{...C,...S}:S;let E=S.type||"default",k=v?.[E]||ws[E];void 0===k&&(w?.("011",to(E)),E="default",k=v?.default||ws.default);const N=!!(S.focusable||r&&void 0===S.focusable),_=void 0!==g&&(S.reconnectable||i&&void 0===S.reconnectable),M=!!(S.selectable||a&&void 0===S.selectable),P=n.useRef(null),[D,O]=n.useState(!1),[z,I]=n.useState(!1),A=Pi(),{zIndex:R,sourceX:L,sourceY:$,targetX:T,targetY:B,sourcePosition:j,targetPosition:V}=Mi(n.useCallback(t=>{const n=t.nodeLookup.get(S.source),o=t.nodeLookup.get(S.target);if(!n||!o)return{zIndex:S.zIndex,...bs};const r=function(e){const{sourceNode:t,targetNode:n}=e;if(!vr(t)||!vr(n))return null;const o=t.internals.handleBounds||xr(t.handles),r=n.internals.handleBounds||xr(n.handles),i=br(o?.source??[],e.sourceHandle),a=br(e.connectionMode===so.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!a)return e.onError?.("008",Jn(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=i?.position||go.Bottom,l=a?.position||go.Top,c=wr(t,i,s),u=wr(n,a,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:l}}({id:e,sourceNode:n,targetNode:o,sourceHandle:S.sourceHandle||null,targetHandle:S.targetHandle||null,connectionMode:t.connectionMode,onError:w}),i=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o,elevateOnSelect:r=!1}){return void 0!==o?o:(r&&n?1e3:0)+Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0)}({selected:S.selected,zIndex:S.zIndex,sourceNode:n,targetNode:o,elevateOnSelect:t.elevateEdgesOnSelect});return{zIndex:i,...r||bs}},[S.source,S.target,S.sourceHandle,S.targetHandle,S.selected,S.zIndex]),Ei),H=n.useMemo(()=>S.markerStart?`url('#${Sr(S.markerStart,y)}')`:void 0,[S.markerStart,y]),Z=n.useMemo(()=>S.markerEnd?`url('#${Sr(S.markerEnd,y)}')`:void 0,[S.markerEnd,y]);if(S.hidden||null===L||null===$||null===T||null===B)return null;const X=l?e=>{l(e,{...S})}:void 0,Y=c?e=>{c(e,{...S})}:void 0,F=u?e=>{u(e,{...S})}:void 0,W=d?e=>{d(e,{...S})}:void 0,K=h?e=>{h(e,{...S})}:void 0;return t.jsx("svg",{style:{zIndex:R},children:t.jsxs("g",{className:o(["react-flow__edge",`react-flow__edge-${E}`,S.className,x,{selected:S.selected,animated:S.animated,inactive:!M&&!s,updating:D,selectable:M}]),onClick:t=>{const{addSelectedEdges:n,unselectNodesAndEdges:o,multiSelectionActive:r}=A.getState();M&&(A.setState({nodesSelectionActive:!1}),S.selected&&r?(o({nodes:[],edges:[S]}),P.current?.blur()):n([e])),s&&s(t,S)},onDoubleClick:X,onContextMenu:Y,onMouseEnter:F,onMouseMove:W,onMouseLeave:K,onKeyDown:N?t=>{if(!b&&io.includes(t.key)&&M){const{unselectNodesAndEdges:n,addSelectedEdges:o}=A.getState();"Escape"===t.key?(P.current?.blur(),n({edges:[S]})):o([e])}}:void 0,tabIndex:N?0:void 0,role:S.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":null===S.ariaLabel?void 0:S.ariaLabel||`Edge from ${S.source} to ${S.target}`,"aria-describedby":N?`${Ii}-${y}`:void 0,ref:P,...S.domAttributes,children:[!z&&t.jsx(k,{id:e,source:S.source,target:S.target,type:S.type,selected:S.selected,animated:S.animated,selectable:M,deletable:S.deletable??!0,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,sourceX:L,sourceY:$,targetX:T,targetY:B,sourcePosition:j,targetPosition:V,data:S.data,style:S.style,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerStart:H,markerEnd:Z,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth}),_&&t.jsx(Ns,{edge:S,isReconnectable:_,reconnectRadius:f,onReconnect:g,onReconnectStart:p,onReconnectEnd:m,sourceX:L,sourceY:$,targetX:T,targetY:B,sourcePosition:j,targetPosition:V,setUpdateHover:O,setReconnecting:I})]})})});const Ms=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ps({defaultMarkerColor:e,onlyRenderVisibleElements:o,rfId:r,edgeTypes:i,noPanClassName:a,onReconnect:s,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:h,reconnectRadius:f,onEdgeDoubleClick:g,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:v,edgesReconnectable:x,elementsSelectable:w,onError:b}=Mi(Ms,Ei),S=(C=o,Mi(n.useCallback(e=>{if(!C)return e.edges.map(e=>e.id);const t=[];if(e.width&&e.height)for(const n of e.edges){const o=e.nodeLookup.get(n.source),r=e.nodeLookup.get(n.target);o&&r&&dr({sourceNode:o,targetNode:r,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t},[C]),Ei));var C;return t.jsxs("div",{className:"react-flow__edges",children:[t.jsx(Ja,{defaultColor:e,rfId:r}),S.map(e=>t.jsx(_s,{id:e,edgesFocusable:v,edgesReconnectable:x,elementsSelectable:w,noPanClassName:a,onReconnect:s,onContextMenu:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:d,onClick:h,reconnectRadius:f,onDoubleClick:g,onReconnectStart:p,onReconnectEnd:m,rfId:r,onError:b,edgeTypes:i,disableKeyboardA11y:y},e))]})}Ps.displayName="EdgeRenderer";const Ds=n.memo(Ps),Os=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function zs({children:e}){const n=Mi(Os);return t.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}const Is=e=>e.panZoom?.syncViewport;function As(e){return e.connection.inProgress?{...e.connection,to:Vo(e.connection.to,e.transform)}:{...e.connection}}function Rs(e){const t=function(e){if(e)return t=>{const n=As(t);return e(n)};return As}(e);return Mi(t,Ei)}const Ls=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function $s({containerStyle:e,style:n,type:r,component:i}){const{nodesConnectable:a,width:s,height:l,isValid:c,inProgress:u}=Mi(Ls,Ei);return!!(s&&a&&u)?t.jsx("svg",{style:e,width:s,height:l,className:"react-flow__connectionline react-flow__container",children:t.jsx("g",{className:o(["react-flow__connection",mo(c)]),children:t.jsx(Ts,{style:n,type:r,CustomComponent:i,isValid:c})})}):null}const Ts=({style:e,type:n=ho.Bezier,CustomComponent:o,isValid:r})=>{const{inProgress:i,from:a,fromNode:s,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:h,toPosition:f}=Rs();if(!i)return;if(o)return t.jsx(o,{connectionLineType:n,connectionLineStyle:e,fromNode:s,fromHandle:l,fromX:a.x,fromY:a.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:f,connectionStatus:mo(r),toNode:d,toHandle:h});let g="";const p={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:f};switch(n){case ho.Bezier:[g]=cr(p);break;case ho.SimpleBezier:[g]=rs(p);break;case ho.Step:[g]=yr({...p,borderRadius:0});break;case ho.SmoothStep:[g]=yr(p);break;default:[g]=fr(p)}return t.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};Ts.displayName="ConnectionLine";const Bs={};function js(e=Bs){n.useRef(e),Pi(),n.useEffect(()=>{},[e])}function Vs({nodeTypes:e,edgeTypes:o,onInit:r,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:s,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:h,onSelectionContextMenu:f,onSelectionStart:g,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:x,selectionKeyCode:w,selectionOnDrag:b,selectionMode:S,multiSelectionKeyCode:C,panActivationKeyCode:E,zoomActivationKeyCode:k,deleteKeyCode:N,onlyRenderVisibleElements:_,elementsSelectable:M,defaultViewport:P,translateExtent:D,minZoom:O,maxZoom:z,preventScrolling:I,defaultMarkerColor:A,zoomOnScroll:R,zoomOnPinch:L,panOnScroll:$,panOnScrollSpeed:T,panOnScrollMode:B,zoomOnDoubleClick:j,panOnDrag:V,onPaneClick:H,onPaneMouseEnter:Z,onPaneMouseMove:X,onPaneMouseLeave:Y,onPaneScroll:F,onPaneContextMenu:W,paneClickDistance:K,nodeClickDistance:G,onEdgeContextMenu:q,onEdgeMouseEnter:U,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,noDragClassName:re,noWheelClassName:ie,noPanClassName:ae,disableKeyboardA11y:se,nodeExtent:le,rfId:ce,viewport:ue,onViewportChange:de}){return js(e),js(o),Pi(),n.useRef(!1),n.useEffect(()=>{},[]),function(e){const t=ya(),o=n.useRef(!1);n.useEffect(()=>{!o.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),o.current=!0)},[e,t.viewportInitialized])}(r),function(e){const t=Mi(Is),o=Pi();n.useEffect(()=>{e&&(t?.(e),o.setState({transform:[e.x,e.y,e.zoom]}))},[e,t])}(ue),t.jsx(Za,{onPaneClick:H,onPaneMouseEnter:Z,onPaneMouseMove:X,onPaneMouseLeave:Y,onPaneContextMenu:W,onPaneScroll:F,paneClickDistance:K,deleteKeyCode:N,selectionKeyCode:w,selectionOnDrag:b,selectionMode:S,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:C,panActivationKeyCode:E,zoomActivationKeyCode:k,elementsSelectable:M,zoomOnScroll:R,zoomOnPinch:L,zoomOnDoubleClick:j,panOnScroll:$,panOnScrollSpeed:T,panOnScrollMode:B,panOnDrag:V,defaultViewport:P,translateExtent:D,minZoom:O,maxZoom:z,onSelectionContextMenu:f,preventScrolling:I,noDragClassName:re,noWheelClassName:ie,noPanClassName:ae,disableKeyboardA11y:se,onViewportChange:de,isControlledViewport:!!ue,children:t.jsxs(zs,{children:[t.jsx(Ds,{edgeTypes:o,onEdgeClick:a,onEdgeDoubleClick:l,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,onlyRenderVisibleElements:_,onEdgeContextMenu:q,onEdgeMouseEnter:U,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,defaultMarkerColor:A,noPanClassName:ae,disableKeyboardA11y:se,rfId:ce}),t.jsx($s,{style:y,type:m,component:v,containerStyle:x}),t.jsx("div",{className:"react-flow__edgelabel-renderer"}),t.jsx(Ga,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:h,nodeClickDistance:G,onlyRenderVisibleElements:_,noPanClassName:ae,noDragClassName:re,disableKeyboardA11y:se,nodeExtent:le,rfId:ce}),t.jsx("div",{className:"react-flow__viewport-portal"})]})})}Vs.displayName="GraphView";const Hs=n.memo(Vs),Zs=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:d}={})=>{const h=new Map,f=new Map,g=new Map,p=new Map,m=o??t??[],y=n??e??[],v=u??[0,0],x=d??ro;zr(g,p,m);const w=_r(y,h,f,{nodeOrigin:v,nodeExtent:x,elevateNodesOnSelect:!1});let b=[0,0,1];if(a&&r&&i){const e=wo(h,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:o}=Xo(e,r,i,l,c,s?.padding??.1);b=[t,n,o]}return{rfId:"1",width:r??0,height:i??0,transform:b,nodes:y,nodesInitialized:w,nodeLookup:h,parentLookup:f,edges:m,edgeLookup:p,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==o,panZoom:null,minZoom:l,maxZoom:c,translateExtent:ro,nodeExtent:x,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:so.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:s,fitViewResolver:null,connection:{...uo},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Bo,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:ao}},Xs=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d})=>{return h=(h,f)=>{async function g(){const{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:o,width:r,height:i,minZoom:a,maxZoom:s}=f();t&&(await So({nodes:e,width:r,height:i,panZoom:t,minZoom:a,maxZoom:s},n),o?.resolve(!0),h({fitViewResolver:null}))}return{...Zs({nodes:e,edges:t,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:o}),setNodes:e=>{const{nodeLookup:t,parentLookup:n,nodeOrigin:o,elevateNodesOnSelect:r,fitViewQueued:i}=f(),a=_r(e,t,n,{nodeOrigin:o,nodeExtent:d,elevateNodesOnSelect:r,checkEquality:!0});i&&a?(g(),h({nodes:e,nodesInitialized:a,fitViewQueued:!1,fitViewOptions:void 0})):h({nodes:e,nodesInitialized:a})},setEdges:e=>{const{connectionLookup:t,edgeLookup:n}=f();zr(t,n,e),h({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){const{setNodes:t}=f();t(e),h({hasDefaultNodes:!0})}if(t){const{setEdges:e}=f();e(t),h({hasDefaultEdges:!0})}},updateNodeInternals:e=>{const{triggerNodeChanges:t,nodeLookup:n,parentLookup:o,domNode:r,nodeOrigin:i,nodeExtent:a,debug:s,fitViewQueued:l}=f(),{changes:c,updatedInternals:u}=function(e,t,n,o,r,i){const a=o?.querySelector(".xyflow__viewport");let s=!1;if(!a)return{changes:[],updatedInternals:s};const l=[],c=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(c.transform),d=[];for(const o of e.values()){const e=t.get(o.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),s=!0;continue}const a=Jo(o.nodeElement),c=e.measured.width!==a.width||e.measured.height!==a.height;if(a.width&&a.height&&(c||!e.internals.handleBounds||o.force)){const h=o.nodeElement.getBoundingClientRect(),f=Fo(e.extent)?e.extent:i;let{positionAbsolute:g}=e.internals;e.parentId&&"parent"===e.extent?g=_o(g,a,t.get(e.parentId)):f&&(g=No(g,f,a));const p={...e,measured:a,internals:{...e.internals,positionAbsolute:g,handleBounds:{source:ir("source",o.nodeElement,h,u,e.id),target:ir("target",o.nodeElement,h,u,e.id)}}};t.set(e.id,p),e.parentId&&Mr(p,t,n,{nodeOrigin:r}),s=!0,c&&(l.push({id:e.id,type:"dimensions",dimensions:a}),e.expandParent&&e.parentId&&d.push({id:e.id,parentId:e.parentId,rect:Io(p,r)}))}}if(d.length>0){const e=Dr(d,t,n,r);l.push(...e)}return{changes:l,updatedInternals:s}}(e,n,o,r,i,a);u&&(function(e,t,n){const o=kr(Cr,n);for(const n of e.values())if(n.parentId)Mr(n,e,t,o);else{const e=xo(n,o.nodeOrigin),t=Fo(n.extent)?n.extent:o.nodeExtent,r=No(e,t,Wo(n));n.internals.positionAbsolute=r}}(n,o,{nodeOrigin:i,nodeExtent:a}),l?(g(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),c?.length>0&&(s&&console.log("React Flow: trigger node changes",c),t?.(c)))},updateNodePositions:(e,t=!1)=>{const n=[],o=[],{nodeLookup:r,triggerNodeChanges:i}=f();for(const[i,a]of e){const e=r.get(i),s=!!(e?.expandParent&&e?.parentId&&a?.position),l={id:i,type:"position",position:s?{x:Math.max(0,a.position.x),y:Math.max(0,a.position.y)}:a.position,dragging:t};s&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...a.internals.positionAbsolute,width:a.measured.width??0,height:a.measured.height??0}}),o.push(l)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=f(),i=Dr(n,r,e,t);o.push(...i)}i(o)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:o,hasDefaultNodes:r,debug:i}=f();e?.length&&(r&&n(ia(e,o)),i&&console.log("React Flow: trigger node changes",e),t?.(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:o,hasDefaultEdges:r,debug:i}=f();if(e?.length){if(r){const t=function(e,t){return oa(e,t)}(e,o);n(t)}i&&console.log("React Flow: trigger edge changes",e),t?.(e)}},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=f();t?r(e.map(e=>aa(e,!0))):(r(sa(o,new Set([...e]),!0)),i(sa(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=f();t?i(e.map(e=>aa(e,!0))):(i(sa(n,new Set([...e]))),r(sa(o,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{const{edges:n,nodes:o,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=f(),s=t||n,l=(e||o).map(e=>{const t=r.get(e.id);return t&&(t.selected=!1),aa(e.id,!1)}),c=s.map(e=>aa(e.id,!1));i(l),a(c)},setMinZoom:e=>{const{panZoom:t,maxZoom:n}=f();t?.setScaleExtent([e,n]),h({minZoom:e})},setMaxZoom:e=>{const{panZoom:t,minZoom:n}=f();t?.setScaleExtent([n,e]),h({maxZoom:e})},setTranslateExtent:e=>{f().panZoom?.setTranslateExtent(e),h({translateExtent:e})},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:o,elementsSelectable:r}=f();if(!r)return;const i=t.reduce((e,t)=>t.selected?[...e,aa(t.id,!1)]:e,[]),a=e.reduce((e,t)=>t.selected?[...e,aa(t.id,!1)]:e,[]);n(i),o(a)},setNodeExtent:e=>{const{nodes:t,nodeLookup:n,parentLookup:o,nodeOrigin:r,elevateNodesOnSelect:i,nodeExtent:a}=f();e[0][0]===a[0][0]&&e[0][1]===a[0][1]&&e[1][0]===a[1][0]&&e[1][1]===a[1][1]||(_r(t,n,o,{nodeOrigin:r,nodeExtent:e,elevateNodesOnSelect:i,checkEquality:!1}),h({nodeExtent:e}))},panBy:e=>{const{transform:t,width:n,height:o,panZoom:r,translateExtent:i}=f();return async function({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),s=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(s)}({delta:e,panZoom:r,transform:t,translateExtent:i,width:n,height:o})},setCenter:async(e,t,n)=>{const{width:o,height:r,maxZoom:i,panZoom:a}=f();if(!a)return Promise.resolve(!1);const s=void 0!==n?.zoom?n.zoom:i;return await a.setViewport({x:o/2-e*s,y:r/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...uo}})},updateConnection:e=>{h({connection:e})},reset:()=>h({...Zs()})}},f=Object.is,h?Ci(h,f):Ci;var h,f};function Ys({initialNodes:e,initialEdges:o,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:s,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:u,fitView:d,nodeOrigin:h,nodeExtent:f,children:g}){const[p]=n.useState(()=>Xs({nodes:e,edges:o,defaultNodes:r,defaultEdges:i,width:a,height:s,fitView:d,minZoom:l,maxZoom:c,fitViewOptions:u,nodeOrigin:h,nodeExtent:f}));return t.jsx(Ni,{value:p,children:t.jsx(pa,{children:g})})}function Fs({children:e,nodes:o,edges:r,defaultNodes:i,defaultEdges:a,width:s,height:l,fitView:c,fitViewOptions:u,minZoom:d,maxZoom:h,nodeOrigin:f,nodeExtent:g}){return n.useContext(ki)?t.jsx(t.Fragment,{children:e}):t.jsx(Ys,{initialNodes:o,initialEdges:r,defaultNodes:i,defaultEdges:a,initialWidth:s,initialHeight:l,fitView:c,initialFitViewOptions:u,initialMinZoom:d,initialMaxZoom:h,nodeOrigin:f,nodeExtent:g,children:e})}const Ws={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var Ks,Gs=da(function({nodes:e,edges:r,defaultNodes:i,defaultEdges:a,className:s,nodeTypes:l,edgeTypes:c,onNodeClick:u,onEdgeClick:d,onInit:h,onMove:f,onMoveStart:g,onMoveEnd:p,onConnect:m,onConnectStart:y,onConnectEnd:v,onClickConnectStart:x,onClickConnectEnd:w,onNodeMouseEnter:b,onNodeMouseMove:S,onNodeMouseLeave:C,onNodeContextMenu:E,onNodeDoubleClick:k,onNodeDragStart:N,onNodeDrag:_,onNodeDragStop:M,onNodesDelete:P,onEdgesDelete:D,onDelete:O,onSelectionChange:z,onSelectionDragStart:I,onSelectionDrag:A,onSelectionDragStop:R,onSelectionContextMenu:L,onSelectionStart:$,onSelectionEnd:T,onBeforeDelete:B,connectionMode:j,connectionLineType:V=ho.Bezier,connectionLineStyle:H,connectionLineComponent:Z,connectionLineContainerStyle:X,deleteKeyCode:Y="Backspace",selectionKeyCode:F="Shift",selectionOnDrag:W=!1,selectionMode:K=co.Full,panActivationKeyCode:G="Space",multiSelectionKeyCode:q=(Yo()?"Meta":"Control"),zoomActivationKeyCode:U=(Yo()?"Meta":"Control"),snapToGrid:Q,snapGrid:J,onlyRenderVisibleElements:ee=!1,selectNodesOnDrag:te,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,nodeOrigin:ae=Fi,edgesFocusable:se,edgesReconnectable:le,elementsSelectable:ce=!0,defaultViewport:ue=Wi,minZoom:de=.5,maxZoom:he=2,translateExtent:fe=ro,preventScrolling:ge=!0,nodeExtent:pe,defaultMarkerColor:me="#b1b1b7",zoomOnScroll:ye=!0,zoomOnPinch:ve=!0,panOnScroll:xe=!1,panOnScrollSpeed:we=.5,panOnScrollMode:be=lo.Free,zoomOnDoubleClick:Se=!0,panOnDrag:Ce=!0,onPaneClick:Ee,onPaneMouseEnter:ke,onPaneMouseMove:Ne,onPaneMouseLeave:_e,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:De=0,nodeClickDistance:Oe=0,children:ze,onReconnect:Ie,onReconnectStart:Ae,onReconnectEnd:Re,onEdgeContextMenu:Le,onEdgeDoubleClick:$e,onEdgeMouseEnter:Te,onEdgeMouseMove:Be,onEdgeMouseLeave:je,reconnectRadius:Ve=10,onNodesChange:He,onEdgesChange:Ze,noDragClassName:Xe="nodrag",noWheelClassName:Ye="nowheel",noPanClassName:Fe="nopan",fitView:We,fitViewOptions:Ke,connectOnClick:Ge,attributionPosition:qe,proOptions:Ue,defaultEdgeOptions:Qe,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,disableKeyboardA11y:tt=!1,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,connectionRadius:it,isValidConnection:at,onError:st,style:lt,id:ct,nodeDragThreshold:ut,connectionDragThreshold:dt,viewport:ht,onViewportChange:ft,width:gt,height:pt,colorMode:mt="light",debug:yt,onScroll:vt,ariaLabelConfig:xt,...wt},bt){const St=ct||"1",Ct=function(e){const[t,o]=n.useState("system"===e?null:e);return n.useEffect(()=>{if("system"!==e)return void o(e);const t=Qi(),n=()=>o(t?.matches?"dark":"light");return n(),t?.addEventListener("change",n),()=>{t?.removeEventListener("change",n)}},[e]),null!==t?t:Qi()?.matches?"dark":"light"}(mt),Et=n.useCallback(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),vt?.(e)},[vt]);return t.jsx("div",{"data-testid":"rf__wrapper",...wt,onScroll:Et,style:{...lt,...Ws},ref:bt,className:o(["react-flow",s,Ct]),id:ct,role:"application",children:t.jsxs(Fs,{nodes:e,edges:r,width:gt,height:pt,fitView:We,fitViewOptions:Ke,minZoom:de,maxZoom:he,nodeOrigin:ae,nodeExtent:pe,children:[t.jsx(Hs,{onInit:h,onNodeClick:u,onEdgeClick:d,onNodeMouseEnter:b,onNodeMouseMove:S,onNodeMouseLeave:C,onNodeContextMenu:E,onNodeDoubleClick:k,nodeTypes:l,edgeTypes:c,connectionLineType:V,connectionLineStyle:H,connectionLineComponent:Z,connectionLineContainerStyle:X,selectionKeyCode:F,selectionOnDrag:W,selectionMode:K,deleteKeyCode:Y,multiSelectionKeyCode:q,panActivationKeyCode:G,zoomActivationKeyCode:U,onlyRenderVisibleElements:ee,defaultViewport:ue,translateExtent:fe,minZoom:de,maxZoom:he,preventScrolling:ge,zoomOnScroll:ye,zoomOnPinch:ve,zoomOnDoubleClick:Se,panOnScroll:xe,panOnScrollSpeed:we,panOnScrollMode:be,panOnDrag:Ce,onPaneClick:Ee,onPaneMouseEnter:ke,onPaneMouseMove:Ne,onPaneMouseLeave:_e,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:De,nodeClickDistance:Oe,onSelectionContextMenu:L,onSelectionStart:$,onSelectionEnd:T,onReconnect:Ie,onReconnectStart:Ae,onReconnectEnd:Re,onEdgeContextMenu:Le,onEdgeDoubleClick:$e,onEdgeMouseEnter:Te,onEdgeMouseMove:Be,onEdgeMouseLeave:je,reconnectRadius:Ve,defaultMarkerColor:me,noDragClassName:Xe,noWheelClassName:Ye,noPanClassName:Fe,rfId:St,disableKeyboardA11y:tt,nodeExtent:pe,viewport:ht,onViewportChange:ft}),t.jsx(Ui,{nodes:e,edges:r,defaultNodes:i,defaultEdges:a,onConnect:m,onConnectStart:y,onConnectEnd:v,onClickConnectStart:x,onClickConnectEnd:w,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,edgesFocusable:se,edgesReconnectable:le,elementsSelectable:ce,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,minZoom:de,maxZoom:he,nodeExtent:pe,onNodesChange:He,onEdgesChange:Ze,snapToGrid:Q,snapGrid:J,connectionMode:j,translateExtent:fe,connectOnClick:Ge,defaultEdgeOptions:Qe,fitView:We,fitViewOptions:Ke,onNodesDelete:P,onEdgesDelete:D,onDelete:O,onNodeDragStart:N,onNodeDrag:_,onNodeDragStop:M,onSelectionDrag:A,onSelectionDragStart:I,onSelectionDragStop:R,onMove:f,onMoveStart:g,onMoveEnd:p,noPanClassName:Fe,nodeOrigin:ae,rfId:St,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,onError:st,connectionRadius:it,isValidConnection:at,selectNodesOnDrag:te,nodeDragThreshold:ut,connectionDragThreshold:dt,onBeforeDelete:B,debug:yt,ariaLabelConfig:xt}),t.jsx(Yi,{onSelectionChange:z}),ze,t.jsx(Bi,{proOptions:Ue,position:qe}),t.jsx($i,{rfId:St,disableKeyboardA11y:tt})]})})});function qs({dimensions:e,lineWidth:n,variant:r,className:i}){return t.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:o(["react-flow__background-pattern",r,i])})}function Us({radius:e,className:n}){return t.jsx("circle",{cx:e,cy:e,r:e,className:o(["react-flow__background-pattern","dots",n])})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(Ks||(Ks={}));const Qs={[Ks.Dots]:1,[Ks.Lines]:1,[Ks.Cross]:6},Js=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function el({id:e,variant:r=Ks.Dots,gap:i=20,size:a,lineWidth:s=1,offset:l=0,color:c,bgColor:u,style:d,className:h,patternClassName:f}){const g=n.useRef(null),{transform:p,patternId:m}=Mi(Js,Ei),y=a||Qs[r],v=r===Ks.Dots,x=r===Ks.Cross,w=Array.isArray(i)?i:[i,i],b=[w[0]*p[2]||1,w[1]*p[2]||1],S=y*p[2],C=Array.isArray(l)?l:[l,l],E=x?[S,S]:b,k=[C[0]*p[2]||1+E[0]/2,C[1]*p[2]||1+E[1]/2],N=`${m}${e||""}`;return t.jsxs("svg",{className:o(["react-flow__background",h]),style:{...d,...wa,"--xy-background-color-props":u,"--xy-background-pattern-color-props":c},ref:g,"data-testid":"rf__background",children:[t.jsx("pattern",{id:N,x:p[0]%b[0],y:p[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:v?t.jsx(Us,{radius:S/2,className:f}):t.jsx(qs,{dimensions:E,lineWidth:s,variant:r,className:f})}),t.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}el.displayName="Background";const tl=n.memo(el);function nl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:t.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function ol(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:t.jsx("path",{d:"M0 0h32v4.2H0z"})})}function rl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:t.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function il(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:t.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function al(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:t.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function sl({children:e,className:n,...r}){return t.jsx("button",{type:"button",className:o(["react-flow__controls-button",n]),...r,children:e})}const ll=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function cl({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:a,onZoomIn:s,onZoomOut:l,onFitView:c,onInteractiveChange:u,className:d,children:h,position:f="bottom-left",orientation:g="vertical","aria-label":p}){const m=Pi(),{isInteractive:y,minZoomReached:v,maxZoomReached:x,ariaLabelConfig:w}=Mi(ll,Ei),{zoomIn:b,zoomOut:S,fitView:C}=ya(),E="horizontal"===g?"horizontal":"vertical";return t.jsxs(Ti,{className:o(["react-flow__controls",E,d]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??w["controls.ariaLabel"],children:[n&&t.jsxs(t.Fragment,{children:[t.jsx(sl,{onClick:()=>{b(),s?.()},className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:x,children:t.jsx(nl,{})}),t.jsx(sl,{onClick:()=>{S(),l?.()},className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:v,children:t.jsx(ol,{})})]}),r&&t.jsx(sl,{className:"react-flow__controls-fitview",onClick:()=>{C(a),c?.()},title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:t.jsx(rl,{})}),i&&t.jsx(sl,{className:"react-flow__controls-interactive",onClick:()=>{m.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),u?.(!y)},title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:y?t.jsx(al,{}):t.jsx(il,{})}),h]})}cl.displayName="Controls";const ul=n.memo(cl);const dl=n.memo(function({id:e,x:n,y:r,width:i,height:a,style:s,color:l,strokeColor:c,strokeWidth:u,className:d,borderRadius:h,shapeRendering:f,selected:g,onClick:p}){const{background:m,backgroundColor:y}=s||{},v=l||m||y;return t.jsx("rect",{className:o(["react-flow__minimap-node",{selected:g},d]),x:n,y:r,rx:h,ry:h,width:i,height:a,style:{fill:v,stroke:c,strokeWidth:u},shapeRendering:f,onClick:p?t=>p(t,e):void 0})}),hl=e=>e.nodes.map(e=>e.id),fl=e=>e instanceof Function?e:()=>e;const gl=n.memo(function({id:e,nodeColorFunc:n,nodeStrokeColorFunc:o,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:s,NodeComponent:l,onClick:c}){const{node:u,x:d,y:h,width:f,height:g}=Mi(t=>{const{internals:n}=t.nodeLookup.get(e),o=n.userNode,{x:r,y:i}=n.positionAbsolute,{width:a,height:s}=Wo(o);return{node:o,x:r,y:i,width:a,height:s}},Ei);return u&&!u.hidden&&Ko(u)?t.jsx(l,{x:d,y:h,width:f,height:g,style:u.style,selected:!!u.selected,className:r(u),color:n(u),borderRadius:i,strokeColor:o(u),strokeWidth:a,shapeRendering:s,onClick:c,id:u.id}):null});var pl=n.memo(function({nodeStrokeColor:e,nodeColor:n,nodeClassName:o="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=dl,onClick:s}){const l=Mi(hl,Ei),c=fl(n),u=fl(e),d=fl(o),h="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return t.jsx(t.Fragment,{children:l.map(e=>t.jsx(gl,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:s,shapeRendering:h},e))})});const ml=e=>!e.hidden,yl=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Ro(wo(e.nodeLookup,{filter:ml}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}};function vl({style:e,className:r,nodeStrokeColor:i,nodeColor:a,nodeClassName:s="",nodeBorderRadius:l=5,nodeStrokeWidth:c,nodeComponent:u,bgColor:d,maskColor:h,maskStrokeColor:f,maskStrokeWidth:g,position:p="bottom-right",onClick:m,onNodeClick:y,pannable:v=!1,zoomable:x=!1,ariaLabel:w,inversePan:b,zoomStep:S=1,offsetScale:C=5}){const E=Pi(),k=n.useRef(null),{boundingRect:N,viewBB:_,rfId:M,panZoom:P,translateExtent:D,flowWidth:O,flowHeight:z,ariaLabelConfig:I}=Mi(yl,Ei),A=e?.width??200,R=e?.height??150,L=N.width/A,$=N.height/R,T=Math.max(L,$),B=T*A,j=T*R,V=C*T,H=N.x-(B-N.width)/2-V,Z=N.y-(j-N.height)/2-V,X=B+2*V,Y=j+2*V,F=`react-flow__minimap-desc-${M}`,W=n.useRef(0),K=n.useRef();W.current=T,n.useEffect(()=>{if(k.current&&P)return K.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=be(e);return{update:function({translateExtent:e,width:i,height:a,zoomStep:s=1,pannable:l=!0,zoomable:c=!0,inversePan:u=!1}){let d=[0,0];const h=Wn().on("start",e=>{"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(d=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on("zoom",l?r=>{const s=n();if("mousemove"!==r.sourceEvent.type&&"touchmove"!==r.sourceEvent.type||!t)return;const l=[r.sourceEvent.clientX??r.sourceEvent.touches[0].clientX,r.sourceEvent.clientY??r.sourceEvent.touches[0].clientY],c=[l[0]-d[0],l[1]-d[1]];d=l;const h=o()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),f={x:s[0]-c[0]*h,y:s[1]-c[1]*h},g=[[0,0],[i,a]];t.setViewportConstrained({x:f.x,y:f.y,zoom:s[2]},g,e)}:null).on("zoom.wheel",c?e=>{if("wheel"!==e.sourceEvent.type||!t)return;const o=n(),r=e.sourceEvent.ctrlKey&&Yo()?10:1,i=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*s,a=o[2]*Math.pow(2,i*r);t.scaleTo(a)}:null);r.call(h,{})},destroy:function(){r.on("zoom",null)},pointer:Se}}({domNode:k.current,panZoom:P,getTransform:()=>E.getState().transform,getViewScale:()=>W.current}),()=>{K.current?.destroy()}},[P]),n.useEffect(()=>{K.current?.update({translateExtent:D,width:O,height:z,inversePan:b,pannable:v,zoomStep:S,zoomable:x})},[v,x,b,S,D,O,z]);const G=m?e=>{const[t,n]=K.current?.pointer(e)||[0,0];m(e,{x:t,y:n})}:void 0,q=y?n.useCallback((e,t)=>{const n=E.getState().nodeLookup.get(t).internals.userNode;y(e,n)},[]):void 0,U=w??I["minimap.ariaLabel"];return t.jsx(Ti,{position:p,style:{...e,"--xy-minimap-background-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof h?h:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof f?f:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof g?g*T:void 0,"--xy-minimap-node-background-color-props":"string"==typeof a?a:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof i?i:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof c?c:void 0},className:o(["react-flow__minimap",r]),"data-testid":"rf__minimap",children:t.jsxs("svg",{width:A,height:R,viewBox:`${H} ${Z} ${X} ${Y}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":F,ref:k,onClick:G,children:[U&&t.jsx("title",{id:F,children:U}),t.jsx(pl,{onClick:q,nodeColor:a,nodeStrokeColor:i,nodeBorderRadius:l,nodeClassName:s,nodeStrokeWidth:c,nodeComponent:u}),t.jsx("path",{className:"react-flow__minimap-mask",d:`M${H-V},${Z-V}h${X+2*V}v${Y+2*V}h${-X-2*V}z\n M${_.x},${_.y}h${_.width}v${_.height}h${-_.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}vl.displayName="MiniMap",n.memo(vl);const xl={[Ur.Line]:"right",[Ur.Handle]:"bottom-right"};n.memo(function({nodeId:e,position:r,variant:i=Ur.Handle,className:a,style:s,children:l,color:c,minWidth:u=10,minHeight:d=10,maxWidth:h=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:p,autoScale:m=!0,shouldResize:y,onResizeStart:v,onResize:x,onResizeEnd:w}){const b=Ia(),S="string"==typeof e?e:b,C=Pi(),E=n.useRef(null),k=i===Ur.Handle,N=Mi(n.useCallback((_=k&&m,e=>_?`${Math.max(1/e.transform[2],1)}`:void 0),[k,m]),Ei);var _;const M=n.useRef(null),P=r??xl[i];n.useEffect(()=>{if(E.current&&S)return M.current||(M.current=ai({domNode:E.current,nodeId:S,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,domNode:i}=C.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,paneDomNode:i}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:o,parentLookup:r,nodeOrigin:i}=C.getState(),a=[],s={x:e.x,y:e.y},l=o.get(S);if(l&&l.expandParent&&l.parentId){const t=l.origin??i,n=e.width??l.measured.width??0,c=e.height??l.measured.height??0,u=Dr([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...Go({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:c},l.parentId,o,t)}}],o,r,i);a.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*c,e.y):void 0}if(void 0!==s.x&&void 0!==s.y){const e={id:S,type:"position",position:{...s}};a.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:S,type:"dimensions",resizing:!0,setAttributes:!p||("horizontal"===p?"width":"height"),dimensions:{width:e.width,height:e.height}};a.push(t)}for(const e of t){const t={...e,type:"position"};a.push(t)}n(a)},onEnd:({width:e,height:t})=>{const n={id:S,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};C.getState().triggerNodeChanges([n])}})),M.current.update({controlPosition:P,boundaries:{minWidth:u,minHeight:d,maxWidth:h,maxHeight:f},keepAspectRatio:g,resizeDirection:p,onResizeStart:v,onResize:x,onResizeEnd:w,shouldResize:y}),()=>{M.current?.destroy()}},[P,u,d,h,f,g,v,x,w,y]);const D=P.split("-");return t.jsx("div",{className:o(["react-flow__resize-control","nodrag",...D,i,a]),ref:E,style:{...s,scale:N,...c&&{[k?"backgroundColor":"borderColor"]:c}},children:l})});const wl={id:"1",position:{x:0,y:0},data:{label:"1"}},{useDebugValue:bl}=n,{useSyncExternalStoreWithSelector:Sl}=mi;let Cl=!1;const El=e=>e;const kl=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t="function"==typeof e?vi(e):e,n=(e,n)=>function(e,t=El,n){n&&!Cl&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Cl=!0);const o=Sl(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return bl(o),o}(t,e,n);return Object.assign(n,t),n},Nl=(_l?kl(_l):kl)((e,t)=>({data:void 0,clickmap:void 0,config:void 0,iframeHeight:0,state:{hideSidebar:!1},setData:t=>e({data:t}),setClickmap:t=>e({clickmap:t}),setState:n=>e({state:{...t().state,...n}}),setConfig:n=>e({config:{...t().config,...n}}),setIframeHeight:t=>e({iframeHeight:t})}));var _l;const Ml=({children:e,...o})=>{const r=o.id,i=o.flexDirection,a=o.overflow||"hidden",s=o.position||"relative",l=o.flex||"none",c=o.justifyContent,u=o.alignItems,d=o.style||{},h=o.gap||0,f=o.height||"auto",g=n.useMemo(()=>{switch(i){case"row":return{columnGap:h};case"column":return{rowGap:h}}},[h,i]),p={display:"flex",flexDirection:i,overflow:a,position:s,flex:l,justifyContent:c,alignItems:u,height:f,...g,...d};return t.jsx("div",{id:r,style:p,children:e})};var Pl,Dl;!function(e){e.Sessions="Sessions",e.Timeline="Timeline",e.Area="Area",e.Click="Click",e.Scroll="Scroll",e.Attention="Attention"}(Pl||(Pl={})),function(e){e.NoResults="NoResults",e.NoClicks="NoClicks",e.NoScroll="NoScroll",e.ServerError="ServerError",e.DataError="DataError"}(Dl||(Dl={})),e.GraphView=({children:e,width:o,height:r})=>{const[i,a,s]=function(e){const[t,o]=n.useState(e),r=n.useCallback(e=>o(t=>ia(e,t)),[]);return[t,o,r]}([{...wl,width:o,height:r}]),l={default:()=>t.jsx(t.Fragment,{children:e})};return n.useEffect(()=>{o&&a(e=>[{...e.find(e=>"1"===e.id),measured:{height:r,width:o},height:r,width:o}])},[o,r,a]),t.jsxs(Gs,{nodes:i,nodeTypes:l,onNodesChange:s,debug:!0,minZoom:.5,maxZoom:2,fitView:!0,children:[t.jsx(ul,{}),t.jsx(tl,{})]})},e.HeatmapLayout=({data:e,clickmap:o,header:r,toolbar:i,sidebar:a})=>{const s=Nl(e=>e.setData),l=Nl(e=>e.setClickmap),c=n.useCallback(e=>{e&&l(e)},[o]),u=n.useCallback(e=>{e&&s(e)},[e]);return n.useEffect(()=>{u(e)},[e]),n.useEffect(()=>{c(o)},[o]),t.jsx(Ml,{id:"gx-hm-project",flexDirection:"column",flex:"1",height:"100%",children:t.jsx(Ml,{id:"gx-hm-project-content",flexDirection:"column",flex:"1",children:t.jsx("div",{style:{minHeight:"100%",display:"flex"}})})})},e.useHeatmapDataStore=Nl});
|
|
10
|
+
*/di.exports=function(){if(ui)return hi;ui=1;var e=n,t=pi(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,s=e.useMemo,l=e.useDebugValue;return hi.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=s(function(){function e(e){if(!a){if(a=!0,r=e,e=c(e),void 0!==u&&h.hasValue){var t=h.value;if(u(t,e))return i=t}return i=e}if(t=i,o(r,e))return t;var n=c(e);return void 0!==u&&u(t,n)?(r=e,t):(r=e,i=n)}var r,i,a=!1,s=void 0===n?null:n;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,n,c,u]);var f=r(e,d[0],d[1]);return a(function(){h.hasValue=!0,h.value=f},[f]),l(f),f},hi}();var mi=si(di.exports);const yi=e=>{let t;const n=new Set,o=(e,o)=>{const r="function"==typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=o?o:"object"!=typeof r||null===r)?r:Object.assign({},t,r),n.forEach(n=>n(t,e))}},r=()=>t,i={setState:o,getState:r,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(o,r,i);return i},vi=e=>e?yi(e):yi,{useDebugValue:xi}=n,{useSyncExternalStoreWithSelector:wi}=mi,bi=e=>e;function Si(e,t=bi,n){const o=wi(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return xi(o),o}const Ci=(e,t)=>{const n=vi(e),o=(e,o=t)=>Si(n,e,o);return Object.assign(o,n),o};function Ei(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const ki=n.createContext(null),Ni=ki.Provider,_i=Kn();function Mi(e,t){const o=n.useContext(ki);if(null===o)throw new Error(_i);return Si(o,e,t)}function Pi(){const e=n.useContext(ki);if(null===e)throw new Error(_i);return n.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Di={display:"none"},Oi={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},zi="react-flow__node-desc",Ii="react-flow__edge-desc",Ai=e=>e.ariaLiveMessage,Ri=e=>e.ariaLabelConfig;function Li({rfId:e}){const n=Mi(Ai);return t.jsx("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Oi,children:n})}function $i({rfId:e,disableKeyboardA11y:n}){const o=Mi(Ri);return t.jsxs(t.Fragment,{children:[t.jsx("div",{id:`${zi}-${e}`,style:Di,children:n?o["node.a11yDescription.default"]:o["node.a11yDescription.keyboardDisabled"]}),t.jsx("div",{id:`${Ii}-${e}`,style:Di,children:o["edge.a11yDescription.default"]}),!n&&t.jsx(Li,{rfId:e})]})}const Ti=n.forwardRef(({position:e="top-left",children:n,className:r,style:i,...a},s)=>{const l=`${e}`.split("-");return t.jsx("div",{className:o(["react-flow__panel",r,...l]),style:i,ref:s,...a,children:n})});function Bi({proOptions:e,position:n="bottom-right"}){return e?.hideAttribution?null:t.jsx(Ti,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:t.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}Ti.displayName="Panel";const ji=e=>{const t=[],n=[];for(const[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(const[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Vi=e=>e.id;function Hi(e,t){return Ei(e.selectedNodes.map(Vi),t.selectedNodes.map(Vi))&&Ei(e.selectedEdges.map(Vi),t.selectedEdges.map(Vi))}function Zi({onSelectionChange:e}){const t=Pi(),{selectedNodes:o,selectedEdges:r}=Mi(ji,Hi);return n.useEffect(()=>{const n={nodes:o,edges:r};e?.(n),t.getState().onSelectionChangeHandlers.forEach(e=>e(n))},[o,r,e]),null}const Xi=e=>!!e.onSelectionChangeHandlers;function Yi({onSelectionChange:e}){const n=Mi(Xi);return e||n?t.jsx(Zi,{onSelectionChange:e}):null}const Fi=[0,0],Wi={x:0,y:0,zoom:1},Ki=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","rfId"],Gi=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),qi={translateExtent:ro,nodeOrigin:Fi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ui(e){const{setNodes:t,setEdges:o,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:s,reset:l,setDefaultNodesAndEdges:c}=Mi(Gi,Ei),u=Pi();n.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=qi,l()}),[]);const d=n.useRef(qi);return n.useEffect(()=>{for(const n of Ki){const l=e[n];l!==d.current[n]&&(void 0!==e[n]&&("nodes"===n?t(l):"edges"===n?o(l):"minZoom"===n?r(l):"maxZoom"===n?i(l):"translateExtent"===n?a(l):"nodeExtent"===n?s(l):"ariaLabelConfig"===n?u.setState({ariaLabelConfig:Uo(l)}):"fitView"===n?u.setState({fitViewQueued:l}):"fitViewOptions"===n?u.setState({fitViewOptions:l}):u.setState({[n]:l})))}d.current=e},Ki.map(t=>e[t])),null}function Qi(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const Ji="undefined"!=typeof document?document:null;function ea(e=null,t={target:Ji,actInsideInputWithModifier:!0}){const[o,r]=n.useState(!1),i=n.useRef(!1),a=n.useRef(new Set([])),[s,l]=n.useMemo(()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter(e=>"string"==typeof e).map(e=>e.replace("+","\n").replace("\n\n","\n+").split("\n")),n=t.reduce((e,t)=>e.concat(...t),[]);return[t,n]}return[[],[]]},[e]);return n.useEffect(()=>{const n=t?.target??Ji,o=t?.actInsideInputWithModifier??!0;if(null!==e){const e=e=>{i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey;if((!i.current||i.current&&!o)&&nr(e))return!1;const n=na(e.code,l);if(a.current.add(e[n]),ta(s,a.current,!1)){const n=e.composedPath?.()?.[0]||e.target,o="BUTTON"===n?.nodeName||"A"===n?.nodeName;!1===t.preventDefault||!i.current&&o||e.preventDefault(),r(!0)}},c=e=>{const t=na(e.code,l);ta(s,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),"Meta"===e.key&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",c),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",c),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}},[e,r]),o}function ta(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function na(e,t){return t.includes(e)?"code":"key"}function oa(e,t){const n=[],o=new Map,r=[];for(const t of e)if("add"!==t.type)if("remove"===t.type||"replace"===t.type)o.set(t.id,[t]);else{const e=o.get(t.id);e?e.push(t):o.set(t.id,[t])}else r.push(t);for(const e of t){const t=o.get(e.id);if(!t){n.push(e);continue}if("remove"===t[0].type)continue;if("replace"===t[0].type){n.push({...t[0].item});continue}const r={...e};for(const e of t)ra(e,r);n.push(r)}return r.length&&r.forEach(e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})}),n}function ra(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":void 0!==e.position&&(t.position=e.position),void 0!==e.dragging&&(t.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(t.measured??={},t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&(!0!==e.setAttributes&&"width"!==e.setAttributes||(t.width=e.dimensions.width),!0!==e.setAttributes&&"height"!==e.setAttributes||(t.height=e.dimensions.height))),"boolean"==typeof e.resizing&&(t.resizing=e.resizing)}}function ia(e,t){return oa(e,t)}function aa(e,t){return{id:e,type:"select",selected:t}}function sa(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const e=t.has(r);void 0===i.selected&&!e||i.selected===e||(n&&(i.selected=e),o.push(aa(i.id,e)))}return o}function la({items:e=[],lookup:t}){const n=[],o=new Map(e.map(e=>[e.id,e]));for(const[o,r]of e.entries()){const e=t.get(r.id),i=e?.internals?.userNode??e;void 0!==i&&i!==r&&n.push({id:r.id,item:r,type:"replace"}),void 0===i&&n.push({item:r,type:"add",index:o})}for(const[e]of t){void 0===o.get(e)&&n.push({id:e,type:"remove"})}return n}function ca(e){return{id:e.id,type:"remove"}}const ua=e=>(e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function da(e){return n.forwardRef(e)}const ha="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function fa(e){const[t,o]=n.useState(BigInt(0)),[r]=n.useState(()=>function(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}(()=>o(e=>e+BigInt(1))));return ha(()=>{const t=r.get();t.length&&(e(t),r.reset())},[t]),r}const ga=n.createContext(null);function pa({children:e}){const o=Pi(),r=fa(n.useCallback(e=>{const{nodes:t=[],setNodes:n,hasDefaultNodes:r,onNodesChange:i,nodeLookup:a,fitViewQueued:s}=o.getState();let l=t;for(const t of e)l="function"==typeof t?t(l):t;const c=la({items:l,lookup:a});r&&n(l),c.length>0?i?.(c):s&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:t,setNodes:n}=o.getState();e&&n(t)})},[])),i=fa(n.useCallback(e=>{const{edges:t=[],setEdges:n,hasDefaultEdges:r,onEdgesChange:i,edgeLookup:a}=o.getState();let s=t;for(const t of e)s="function"==typeof t?t(s):t;r?n(s):i&&i(la({items:s,lookup:a}))},[])),a=n.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return t.jsx(ga.Provider,{value:a,children:e})}const ma=e=>!!e.panZoom;function ya(){const e=(()=>{const e=Pi();return n.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:a,panZoom:s}=e.getState(),l=Xo(t,o,r,i,a,n?.padding??.1);return s?(await s.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:s,y:l}=a.getBoundingClientRect(),c={x:t.x-s,y:t.y-l},u=n.snapGrid??r,d=n.snapToGrid??i;return Vo(c,o,d,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),a=Ho(t,n);return{x:a.x+r,y:a.y+i}}}),[])})(),t=Pi(),o=function(){const e=n.useContext(ga);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),r=Mi(ma),i=n.useMemo(()=>{const e=e=>t.getState().nodeLookup.get(e),n=e=>{o.nodeQueue.push(e)},r=e=>{o.edgeQueue.push(e)},i=e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState(),r=ua(e)?e:n.get(e.id),i=r.parentId?Go(r.position,r.measured,r.parentId,n,o):r.position,a={...r,position:i,width:r.measured?.width??r.width,height:r.measured?.height??r.height};return Io(a)},a=(e,t,o={replace:!1})=>{n(n=>n.map(n=>{if(n.id===e){const e="function"==typeof t?t(n):t;return o.replace&&ua(e)?e:{...n,...e}}return n}))},s=(e,t,n={replace:!1})=>{r(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&yo(e)?e:{...o,...e}}return o}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:n,setEdges:r,addNodes:e=>{const t=Array.isArray(e)?e:[e];o.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];o.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:n=[],transform:o}=t.getState(),[r,i,a]=o;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:r,y:i,zoom:a}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{const{nodes:o,edges:r,onNodesDelete:i,onEdgesDelete:a,triggerNodeChanges:s,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:u}=t.getState(),{nodes:d,edges:h}=await Eo({nodesToRemove:e,edgesToRemove:n,nodes:o,edges:r,onBeforeDelete:u}),f=h.length>0,g=d.length>0;if(f){const e=h.map(ca);a?.(h),l(e)}if(g){const e=d.map(ca);i?.(d),s(e)}return(g||f)&&c?.({nodes:d,edges:h}),{deletedNodes:d,deletedEdges:h}},getIntersectingNodes:(e,n=!0,o)=>{const r=$o(e),a=r?e:i(e),s=void 0!==o;return a?(o||t.getState().nodes).filter(o=>{const i=t.getState().nodeLookup.get(o.id);if(i&&!r&&(o.id===e.id||!i.internals.positionAbsolute))return!1;const l=Io(s?o:i),c=Lo(l,a);return n&&c>0||c>=l.width*l.height||c>=a.width*a.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{const o=$o(e)?e:i(e);if(!o)return!1;const r=Lo(o,t);return n&&r>0||r>=t.width*t.height||r>=o.width*o.height},updateNode:a,updateNodeData:(e,t,n={replace:!1})=>{a(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},getNodesBounds:e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState();return((e,t={nodeOrigin:[0,0]})=>{if(0===e.length)return{x:0,y:0,width:0,height:0};const n=e.reduce((e,n)=>{const o="string"==typeof n;let r=t.nodeLookup||o?void 0:n;t.nodeLookup&&(r=o?t.nodeLookup.get(n):vo(n)?n:t.nodeLookup.get(n.id));const i=r?Ao(r,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Do(e,i)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return zo(n)})(e,{nodeLookup:n,nodeOrigin:o})},getHandleConnections:({type:e,id:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}-${e}${n?`-${n}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}${e?n?`-${e}-${n}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const n=t.getState().fitViewResolver??function(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:n}),o.nodeQueue.push(e=>[...e]),n.promise}}},[]);return n.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const va=e=>e.selected,xa="undefined"!=typeof window?window:void 0;const wa={position:"absolute",width:"100%",height:"100%",top:0,left:0},ba=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Sa({onPaneContextMenu:e,zoomOnScroll:o=!0,zoomOnPinch:r=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:s=lo.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:u,translateExtent:d,minZoom:h,maxZoom:f,zoomActivationKeyCode:g,preventScrolling:p=!0,children:m,noWheelClassName:y,noPanClassName:v,onViewportChange:x,isControlledViewport:w,paneClickDistance:b,selectionOnDrag:S}){const C=Pi(),E=n.useRef(null),{userSelectionActive:k,lib:N,connectionInProgress:_}=Mi(ba,Ei),M=ea(g),P=n.useRef();!function(e){const t=Pi();n.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??1))return!1;const n=Jo(e.current);0!==n.height&&0!==n.width||t.getState().onError?.("004",qn()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener("resize",n);const t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener("resize",n),t&&e.current&&t.unobserve(e.current)}}},[])}(E);const D=n.useCallback(e=>{x?.({x:e[0],y:e[1],zoom:e[2]}),w||C.setState({transform:e})},[x,w]);return n.useEffect(()=>{if(E.current){P.current=qr({domNode:E.current,minZoom:h,maxZoom:f,translateExtent:d,viewport:u,onDraggingChange:e=>C.setState({paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:o}=C.getState();o?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:o}=C.getState();o?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:o}=C.getState();o?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=P.current.getViewport();return C.setState({panZoom:P.current,transform:[e,t,n],domNode:E.current.closest(".react-flow")}),()=>{P.current?.destroy()}}},[]),n.useEffect(()=>{P.current?.update({onPaneContextMenu:e,zoomOnScroll:o,zoomOnPinch:r,panOnScroll:i,panOnScrollSpeed:a,panOnScrollMode:s,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:M,preventScrolling:p,noPanClassName:v,userSelectionActive:k,noWheelClassName:y,lib:N,onTransformChange:D,connectionInProgress:_,selectionOnDrag:S,paneClickDistance:b})},[e,o,r,i,a,s,l,c,M,p,v,k,y,N,D,_,S,b]),t.jsx("div",{className:"react-flow__renderer",ref:E,style:wa,children:m})}const Ca=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ea(){const{userSelectionActive:e,userSelectionRect:n}=Mi(Ca,Ei);return e&&n?t.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const ka=(e,t)=>n=>{n.target===t.current&&e?.(n)},Na=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function _a({isSelecting:e,selectionKeyPressed:r,selectionMode:i=co.Full,panOnDrag:a,paneClickDistance:s,selectionOnDrag:l,onSelectionStart:c,onSelectionEnd:u,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:f,onPaneMouseEnter:g,onPaneMouseMove:p,onPaneMouseLeave:m,children:y}){const v=Pi(),{userSelectionActive:x,elementsSelectable:w,dragging:b,connectionInProgress:S}=Mi(Na,Ei),C=w&&(e||x),E=n.useRef(null),k=n.useRef(),N=n.useRef(new Set),_=n.useRef(new Set),M=n.useRef(!1),P=e=>{M.current||S?M.current=!1:(d?.(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1}))},D=f?e=>f(e):void 0,O=!0===a||Array.isArray(a)&&a.includes(0);return t.jsxs("div",{className:o(["react-flow__pane",{draggable:O,dragging:b,selection:e}]),onClick:C?void 0:ka(P,E),onContextMenu:ka(e=>{Array.isArray(a)&&a?.includes(2)?e.preventDefault():h?.(e)},E),onWheel:ka(D,E),onPointerEnter:C?void 0:g,onPointerMove:C?e=>{const{userSelectionRect:t,transform:n,nodeLookup:o,edgeLookup:a,connectionLookup:l,triggerNodeChanges:u,triggerEdgeChanges:d,defaultEdgeOptions:h,resetSelectedElements:f}=v.getState();if(!k.current||!t)return;const{x:g,y:p}=rr(e.nativeEvent,k.current),{startX:m,startY:y}=t;if(!M.current){const t=r?0:s;if(Math.hypot(g-m,p-y)<=t)return;f(),c?.(e)}M.current=!0;const x={startX:m,startY:y,x:g<m?g:m,y:p<y?p:y,width:Math.abs(g-m),height:Math.abs(p-y)},w=N.current,b=_.current;N.current=new Set(bo(o,x,n,i===co.Partial,!0).map(e=>e.id)),_.current=new Set;const S=h?.selectable??!0;for(const e of N.current){const t=l.get(e);if(t)for(const{edgeId:e}of t.values()){const t=a.get(e);t&&(t.selectable??S)&&_.current.add(e)}}if(!qo(w,N.current)){u(sa(o,N.current,!0))}if(!qo(b,_.current)){d(sa(a,_.current))}v.setState({userSelectionRect:x,userSelectionActive:!0,nodesSelectionActive:!1})}:p,onPointerUp:C?e=>{0===e.button&&(e.target?.releasePointerCapture?.(e.pointerId),!x&&e.target===E.current&&v.getState().userSelectionRect&&P?.(e),v.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(u?.(e),v.setState({nodesSelectionActive:N.current.size>0})))}:void 0,onPointerDownCapture:C?t=>{const{domNode:n}=v.getState();if(k.current=n?.getBoundingClientRect(),!k.current)return;const o=t.target===E.current;if(!o&&!!t.target.closest(".nokey")||!e||!(l&&o||r)||0!==t.button||!t.isPrimary)return;t.target?.setPointerCapture?.(t.pointerId),M.current=!1;const{x:i,y:a}=rr(t.nativeEvent,k.current);v.setState({userSelectionRect:{width:0,height:0,startX:i,startY:a,x:i,y:a}}),o||(t.stopPropagation(),t.preventDefault())}:void 0,onClickCapture:C?e=>{M.current&&(e.stopPropagation(),M.current=!1)}:void 0,onPointerLeave:m,ref:E,style:wa,children:[y,t.jsx(Ea,{})]})}function Ma({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:s,onError:l}=t.getState(),c=s.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&a)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])):l?.("012",no(e))}function Pa({nodeRef:e,disabled:t=!1,noDragClassName:o,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:s}){const l=Pi(),[c,u]=n.useState(!1),d=n.useRef();return n.useEffect(()=>{d.current=Lr({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{Ma({id:t,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),n.useEffect(()=>{if(t)d.current?.destroy();else if(e.current)return d.current?.update({noDragClassName:o,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:s}),()=>{d.current?.destroy()}},[o,r,t,a,e,i]),c}function Da(){const e=Pi();return n.useCallback(t=>{const{nodeExtent:n,snapToGrid:o,snapGrid:r,nodesDraggable:i,onError:a,updateNodePositions:s,nodeLookup:l,nodeOrigin:c}=e.getState(),u=new Map,d=(e=>t=>t.selected&&(t.draggable||e&&void 0===t.draggable))(i),h=o?r[0]:5,f=o?r[1]:5,g=t.direction.x*h*t.factor,p=t.direction.y*f*t.factor;for(const[,e]of l){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+g,y:e.internals.positionAbsolute.y+p};o&&(t=jo(t,r));const{position:i,positionAbsolute:s}=Co({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:a});e.position=i,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}const Oa=n.createContext(null),za=Oa.Provider;Oa.Consumer;const Ia=()=>n.useContext(Oa),Aa=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId});const Ra=n.memo(da(function({type:e="source",position:n=go.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:a=!0,isConnectableEnd:s=!0,id:l,onConnect:c,children:u,className:d,onMouseDown:h,onTouchStart:f,...g},p){const m=l||null,y="target"===e,v=Pi(),x=Ia(),{connectOnClick:w,noPanClassName:b,rfId:S}=Mi(Aa,Ei),{connectingFrom:C,connectingTo:E,clickConnecting:k,isPossibleEndHandle:N,connectionInProcess:_,clickConnectionInProcess:M,valid:P}=Mi(((e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:a}=o,{fromHandle:s,toHandle:l,isValid:c}=a,u=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===so.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!r,valid:u&&c}})(x,m,e),Ei);x||v.getState().onError?.("010",eo());const D=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=v.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t}=v.getState();t(((e,t)=>{if(!e.source||!e.target)return t;let n;return n=yo(e)?{...e}:{...e,id:hr(e)},((e,t)=>t.some(t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle))))(n,t)?t:(null===n.sourceHandle&&delete n.sourceHandle,null===n.targetHandle&&delete n.targetHandle,t.concat(n))})(r,e))}n?.(r),c?.(r)},O=e=>{if(!x)return;const t=or(e.nativeEvent);if(a&&(t&&0===e.button||!t)){const t=v.getState();Hr.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:y,handleId:m,nodeId:x,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:D,isValidConnection:r||t.isValidConnection,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?h?.(e):f?.(e)};return t.jsx("div",{"data-handleid":m,"data-nodeid":x,"data-handlepos":n,"data-id":`${S}-${x}-${m}-${e}`,className:o(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",b,d,{source:!y,target:y,connectable:i,connectablestart:a,connectableend:s,clickconnecting:k,connectingfrom:C,connectingto:E,valid:P,connectionindicator:i&&(!_||N)&&(_||M?s:a)}]),onMouseDown:O,onTouchStart:O,onClick:w?t=>{const{onClickConnectStart:n,onClickConnectEnd:o,connectionClickStartHandle:i,connectionMode:s,isValidConnection:l,lib:c,rfId:u,nodeLookup:d,connection:h}=v.getState();if(!x||!i&&!a)return;if(!i)return n?.(t.nativeEvent,{nodeId:x,handleId:m,handleType:e}),void v.setState({connectionClickStartHandle:{nodeId:x,type:e,id:m}});const f=er(t.target),g=r||l,{connection:p,isValid:y}=Hr.isValid(t.nativeEvent,{handle:{nodeId:x,id:m,type:e},connectionMode:s,fromNodeId:i.nodeId,fromHandleId:i.id||null,fromType:i.type,isValidConnection:g,flowId:u,doc:f,lib:c,nodeLookup:d});y&&p&&D(p);const w=structuredClone(h);delete w.inProgress,w.toPosition=w.toHandle?w.toHandle.position:null,o?.(t,w),v.setState({connectionClickStartHandle:null})}:void 0,ref:p,...g,children:u})}));const La={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},$a={input:function({data:e,isConnectable:n,sourcePosition:o=go.Bottom}){return t.jsxs(t.Fragment,{children:[e?.label,t.jsx(Ra,{type:"source",position:o,isConnectable:n})]})},default:function({data:e,isConnectable:n,targetPosition:o=go.Top,sourcePosition:r=go.Bottom}){return t.jsxs(t.Fragment,{children:[t.jsx(Ra,{type:"target",position:o,isConnectable:n}),e?.label,t.jsx(Ra,{type:"source",position:r,isConnectable:n})]})},output:function({data:e,isConnectable:n,targetPosition:o=go.Top}){return t.jsxs(t.Fragment,{children:[t.jsx(Ra,{type:"target",position:o,isConnectable:n}),e?.label]})},group:function(){return null}};const Ta=e=>{const{width:t,height:n,x:o,y:r}=wo(e.nodeLookup,{filter:e=>!!e.selected});return{width:To(t)?t:null,height:To(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function Ba({onSelectionContextMenu:e,noPanClassName:r,disableKeyboardA11y:i}){const a=Pi(),{width:s,height:l,transformString:c,userSelectionActive:u}=Mi(Ta,Ei),d=Da(),h=n.useRef(null);if(n.useEffect(()=>{i||h.current?.focus({preventScroll:!0})},[i]),Pa({nodeRef:h}),u||!s||!l)return null;const f=e?t=>{const n=a.getState().nodes.filter(e=>e.selected);e(t,n)}:void 0;return t.jsx("div",{className:o(["react-flow__nodesselection","react-flow__container",r]),style:{transform:c},children:t.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:i?void 0:-1,onKeyDown:i?void 0:e=>{Object.prototype.hasOwnProperty.call(La,e.key)&&(e.preventDefault(),d({direction:La[e.key],factor:e.shiftKey?4:1}))},style:{width:s,height:l}})})}const ja="undefined"!=typeof window?window:void 0,Va=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Ha({children:e,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:h,selectionMode:f,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:v,elementsSelectable:x,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:S,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:N,defaultViewport:_,translateExtent:M,minZoom:P,maxZoom:D,preventScrolling:O,onSelectionContextMenu:z,noWheelClassName:I,noPanClassName:A,disableKeyboardA11y:R,onViewportChange:L,isControlledViewport:$}){const{nodesSelectionActive:T,userSelectionActive:B}=Mi(Va),j=ea(d,{target:ja}),V=ea(y,{target:ja}),H=V||N,Z=V||S,X=h&&!0!==H,Y=j||B||X;return function({deleteKeyCode:e,multiSelectionKeyCode:t}){const o=Pi(),{deleteElements:r}=ya(),i=ea(e,{actInsideInputWithModifier:!1}),a=ea(t,{target:xa});n.useEffect(()=>{if(i){const{edges:e,nodes:t}=o.getState();r({nodes:t.filter(va),edges:e.filter(va)}),o.setState({nodesSelectionActive:!1})}},[i]),n.useEffect(()=>{o.setState({multiSelectionActive:a})},[a])}({deleteKeyCode:u,multiSelectionKeyCode:m}),t.jsx(Sa,{onPaneContextMenu:s,elementsSelectable:x,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:Z,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:!j&&H,defaultViewport:_,translateExtent:M,minZoom:P,maxZoom:D,zoomActivationKeyCode:v,preventScrolling:O,noWheelClassName:I,noPanClassName:A,onViewportChange:L,isControlledViewport:$,paneClickDistance:c,selectionOnDrag:X,children:t.jsxs(_a,{onSelectionStart:g,onSelectionEnd:p,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,panOnDrag:H,isSelecting:!!Y,selectionMode:f,selectionKeyPressed:j,paneClickDistance:c,selectionOnDrag:X,children:[e,T&&t.jsx(Ba,{onSelectionContextMenu:z,noPanClassName:A,disableKeyboardA11y:R})]})})}Ha.displayName="FlowRenderer";const Za=n.memo(Ha);function Xa(e){return Mi(n.useCallback((e=>t=>e?bo(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys()))(e),[e]),Ei)}const Ya=e=>e.updateNodeInternals;var Fa=n.memo(function({id:e,onClick:r,onMouseEnter:i,onMouseMove:a,onMouseLeave:s,onContextMenu:l,onDoubleClick:c,nodesDraggable:u,elementsSelectable:d,nodesConnectable:h,nodesFocusable:f,resizeObserver:g,noDragClassName:p,noPanClassName:m,disableKeyboardA11y:y,rfId:v,nodeTypes:x,nodeClickDistance:w,onError:b}){const{node:S,internals:C,isParent:E}=Mi(t=>{const n=t.nodeLookup.get(e),o=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:o}},Ei);let k=S.type||"default",N=x?.[k]||$a[k];void 0===N&&(b?.("003",Gn(k)),k="default",N=x?.default||$a.default);const _=!!(S.draggable||u&&void 0===S.draggable),M=!!(S.selectable||d&&void 0===S.selectable),P=!!(S.connectable||h&&void 0===S.connectable),D=!!(S.focusable||f&&void 0===S.focusable),O=Pi(),z=Ko(S),I=function({node:e,nodeType:t,hasDimensions:o,resizeObserver:r}){const i=Pi(),a=n.useRef(null),s=n.useRef(null),l=n.useRef(e.sourcePosition),c=n.useRef(e.targetPosition),u=n.useRef(t),d=o&&!!e.internals.handleBounds;return n.useEffect(()=>{!a.current||e.hidden||d&&s.current===a.current||(s.current&&r?.unobserve(s.current),r?.observe(a.current),s.current=a.current)},[d,e.hidden]),n.useEffect(()=>()=>{s.current&&(r?.unobserve(s.current),s.current=null)},[]),n.useEffect(()=>{if(a.current){const n=u.current!==t,o=l.current!==e.sourcePosition,r=c.current!==e.targetPosition;(n||o||r)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}({node:S,nodeType:k,hasDimensions:z,resizeObserver:g}),A=Pa({nodeRef:I,disabled:S.hidden||!_,noDragClassName:p,handleSelector:S.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:w}),R=Da();if(S.hidden)return null;const L=Wo(S),$=function(e){return void 0===e.internals.handleBounds?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}(S),T=M||_||r||i||a||s,B=i?e=>i(e,{...C.userNode}):void 0,j=a?e=>a(e,{...C.userNode}):void 0,V=s?e=>s(e,{...C.userNode}):void 0,H=l?e=>l(e,{...C.userNode}):void 0,Z=c?e=>c(e,{...C.userNode}):void 0;return t.jsx("div",{className:o(["react-flow__node",`react-flow__node-${k}`,{[m]:_},S.className,{selected:S.selected,selectable:M,parent:E,draggable:_,dragging:A}]),ref:I,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:z?"visible":"hidden",...S.style,...$},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:j,onMouseLeave:V,onContextMenu:H,onClick:t=>{const{selectNodesOnDrag:n,nodeDragThreshold:o}=O.getState();M&&(!n||!_||o>0)&&Ma({id:e,store:O,nodeRef:I}),r&&r(t,{...C.userNode})},onDoubleClick:Z,onKeyDown:D?t=>{if(!nr(t.nativeEvent)&&!y)if(io.includes(t.key)&&M){const n="Escape"===t.key;Ma({id:e,store:O,unselect:n,nodeRef:I})}else if(_&&S.selected&&Object.prototype.hasOwnProperty.call(La,t.key)){t.preventDefault();const{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:t.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),R({direction:La[t.key],factor:t.shiftKey?4:1})}}:void 0,tabIndex:D?0:void 0,onFocus:D?()=>{if(y||!I.current?.matches(":focus-visible"))return;const{transform:t,width:n,height:o,autoPanOnNodeFocus:r,setCenter:i}=O.getState();if(!r)return;bo(new Map([[e,S]]),{x:0,y:0,width:n,height:o},t,!0).length>0||i(S.position.x+L.width/2,S.position.y+L.height/2,{zoom:t[2]})}:void 0,role:S.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${zi}-${v}`,"aria-label":S.ariaLabel,...S.domAttributes,children:t.jsx(za,{value:e,children:t.jsx(N,{id:e,data:S.data,type:k,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:S.selected??!1,selectable:M,draggable:_,deletable:S.deletable??!0,isConnectable:P,sourcePosition:S.sourcePosition,targetPosition:S.targetPosition,dragging:A,dragHandle:S.dragHandle,zIndex:C.z,parentId:S.parentId,...L})})})});const Wa=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Ka(e){const{nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:a,onError:s}=Mi(Wa,Ei),l=Xa(e.onlyRenderVisibleElements),c=function(){const e=Mi(Ya),[t]=n.useState(()=>"undefined"==typeof ResizeObserver?null:new ResizeObserver(t=>{const n=new Map;t.forEach(e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return n.useEffect(()=>()=>{t?.disconnect()},[t]),t}();return t.jsx("div",{className:"react-flow__nodes",style:wa,children:l.map(n=>t.jsx(Fa,{id:n,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:c,nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:a,nodeClickDistance:e.nodeClickDistance,onError:s},n))})}Ka.displayName="NodeRenderer";const Ga=n.memo(Ka);const qa={[fo.Arrow]:({color:e="none",strokeWidth:n=1})=>{const o={strokeWidth:n,...e&&{stroke:e}};return t.jsx("polyline",{className:"arrow",style:o,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[fo.ArrowClosed]:({color:e="none",strokeWidth:n=1})=>{const o={strokeWidth:n,...e&&{stroke:e,fill:e}};return t.jsx("polyline",{className:"arrowclosed",style:o,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}};const Ua=({id:e,type:o,color:r,width:i=12.5,height:a=12.5,markerUnits:s="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const u=function(e){const t=Pi();return n.useMemo(()=>Object.prototype.hasOwnProperty.call(qa,e)?qa[e]:(t.getState().onError?.("009",Qn(e)),null),[e])}(o);return u?t.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0",children:t.jsx(u,{color:r,strokeWidth:l})}):null},Qa=({defaultColor:e,rfId:o})=>{const r=Mi(e=>e.edges),i=Mi(e=>e.defaultEdgeOptions),a=n.useMemo(()=>{const t=function(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((e,a)=>([a.markerStart||o,a.markerEnd||r].forEach(o=>{if(o&&"object"==typeof o){const r=Sr(o,t);i.has(r)||(e.push({id:r,color:o.color||n,...o}),i.add(r))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}(r,{id:o,defaultColor:e,defaultMarkerStart:i?.markerStart,defaultMarkerEnd:i?.markerEnd});return t},[r,i,o,e]);return a.length?t.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:t.jsx("defs",{children:a.map(e=>t.jsx(Ua,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Qa.displayName="MarkerDefinitions";var Ja=n.memo(Qa);function es({x:e,y:r,label:i,labelStyle:a,labelShowBg:s=!0,labelBgStyle:l,labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:d,className:h,...f}){const[g,p]=n.useState({x:1,y:0,width:0,height:0}),m=o(["react-flow__edge-textwrapper",h]),y=n.useRef(null);return n.useEffect(()=>{if(y.current){const e=y.current.getBBox();p({x:e.x,y:e.y,width:e.width,height:e.height})}},[i]),i?t.jsxs("g",{transform:`translate(${e-g.width/2} ${r-g.height/2})`,className:m,visibility:g.width?"visible":"hidden",...f,children:[s&&t.jsx("rect",{width:g.width+2*c[0],x:-c[0],y:-c[1],height:g.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:u,ry:u}),t.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:y,style:a,children:i}),d]}):null}es.displayName="EdgeText";const ts=n.memo(es);function ns({path:e,labelX:n,labelY:r,label:i,labelStyle:a,labelShowBg:s,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u,interactionWidth:d=20,...h}){return t.jsxs(t.Fragment,{children:[t.jsx("path",{...h,d:e,fill:"none",className:o(["react-flow__edge-path",h.className])}),d?t.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,i&&To(n)&&To(r)?t.jsx(ts,{x:n,y:r,label:i,labelStyle:a,labelShowBg:s,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u}):null]})}function os({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===go.Left||e===go.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function rs({sourceX:e,sourceY:t,sourcePosition:n=go.Bottom,targetX:o,targetY:r,targetPosition:i=go.Top}){const[a,s]=os({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=os({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,d,h,f]=ar({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:s,targetControlX:l,targetControlY:c});return[`M${e},${t} C${a},${s} ${l},${c} ${o},${r}`,u,d,h,f]}function is(e){return n.memo(({id:n,sourceX:o,sourceY:r,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:y,interactionWidth:v})=>{const[x,w,b]=rs({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),S=e.isInternal?void 0:n;return t.jsx(ns,{id:S,path:x,labelX:w,labelY:b,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:y,interactionWidth:v})})}const as=is({isInternal:!1}),ss=is({isInternal:!0});function ls(e){return n.memo(({id:n,sourceX:o,sourceY:r,targetX:i,targetY:a,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,sourcePosition:g=go.Bottom,targetPosition:p=go.Top,markerEnd:m,markerStart:y,pathOptions:v,interactionWidth:x})=>{const[w,b,S]=yr({sourceX:o,sourceY:r,sourcePosition:g,targetX:i,targetY:a,targetPosition:p,borderRadius:v?.borderRadius,offset:v?.offset,stepPosition:v?.stepPosition}),C=e.isInternal?void 0:n;return t.jsx(ns,{id:C,path:w,labelX:b,labelY:S,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:y,interactionWidth:x})})}as.displayName="SimpleBezierEdge",ss.displayName="SimpleBezierEdgeInternal";const cs=ls({isInternal:!1}),us=ls({isInternal:!0});function ds(e){return n.memo(({id:o,...r})=>{const i=e.isInternal?void 0:o;return t.jsx(cs,{...r,id:i,pathOptions:n.useMemo(()=>({borderRadius:0,offset:r.pathOptions?.offset}),[r.pathOptions?.offset])})})}cs.displayName="SmoothStepEdge",us.displayName="SmoothStepEdgeInternal";const hs=ds({isInternal:!1}),fs=ds({isInternal:!0});function gs(e){return n.memo(({id:n,sourceX:o,sourceY:r,targetX:i,targetY:a,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:g,markerStart:p,interactionWidth:m})=>{const[y,v,x]=fr({sourceX:o,sourceY:r,targetX:i,targetY:a}),w=e.isInternal?void 0:n;return t.jsx(ns,{id:w,path:y,labelX:v,labelY:x,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:g,markerStart:p,interactionWidth:m})})}hs.displayName="StepEdge",fs.displayName="StepEdgeInternal";const ps=gs({isInternal:!1}),ms=gs({isInternal:!0});function ys(e){return n.memo(({id:n,sourceX:o,sourceY:r,targetX:i,targetY:a,sourcePosition:s=go.Bottom,targetPosition:l=go.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:y,pathOptions:v,interactionWidth:x})=>{const[w,b,S]=cr({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l,curvature:v?.curvature}),C=e.isInternal?void 0:n;return t.jsx(ns,{id:C,path:w,labelX:b,labelY:S,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:y,interactionWidth:x})})}ps.displayName="StraightEdge",ms.displayName="StraightEdgeInternal";const vs=ys({isInternal:!1}),xs=ys({isInternal:!0});vs.displayName="BezierEdge",xs.displayName="BezierEdgeInternal";const ws={default:xs,straight:ms,step:fs,smoothstep:us,simplebezier:ss},bs={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Ss=(e,t,n)=>n===go.Left?e-t:n===go.Right?e+t:e,Cs=(e,t,n)=>n===go.Top?e-t:n===go.Bottom?e+t:e,Es="react-flow__edgeupdater";function ks({position:e,centerX:n,centerY:r,radius:i=10,onMouseDown:a,onMouseEnter:s,onMouseOut:l,type:c}){return t.jsx("circle",{onMouseDown:a,onMouseEnter:s,onMouseOut:l,className:o([Es,`${Es}-${c}`]),cx:Ss(n,i,e),cy:Cs(r,i,e),r:i,stroke:"transparent",fill:"transparent"})}function Ns({isReconnectable:e,reconnectRadius:n,edge:o,sourceX:r,sourceY:i,targetX:a,targetY:s,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:h,setReconnecting:f,setUpdateHover:g}){const p=Pi(),m=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:n,domNode:r,isValidConnection:i,connectionMode:a,connectionRadius:s,lib:l,onConnectStart:c,onConnectEnd:g,cancelConnection:m,nodeLookup:y,rfId:v,panBy:x,updateConnection:w}=p.getState(),b="target"===t.type;Hr.onPointerDown(e.nativeEvent,{autoPanOnConnect:n,connectionMode:a,connectionRadius:s,domNode:r,handleId:t.id,nodeId:t.nodeId,nodeLookup:y,isTarget:b,edgeUpdaterType:t.type,lib:l,flowId:v,cancelConnection:m,panBy:x,isValidConnection:i,onConnect:e=>u?.(o,e),onConnectStart:(n,r)=>{f(!0),d?.(e,o,t.type),c?.(n,r)},onConnectEnd:g,onReconnectEnd:(e,n)=>{f(!1),h?.(e,o,t.type,n)},updateConnection:w,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},y=()=>g(!0),v=()=>g(!1);return t.jsxs(t.Fragment,{children:[(!0===e||"source"===e)&&t.jsx(ks,{position:l,centerX:r,centerY:i,radius:n,onMouseDown:e=>m(e,{nodeId:o.target,id:o.targetHandle??null,type:"target"}),onMouseEnter:y,onMouseOut:v,type:"source"}),(!0===e||"target"===e)&&t.jsx(ks,{position:c,centerX:a,centerY:s,radius:n,onMouseDown:e=>m(e,{nodeId:o.source,id:o.sourceHandle??null,type:"source"}),onMouseEnter:y,onMouseOut:v,type:"target"})]})}var _s=n.memo(function({id:e,edgesFocusable:r,edgesReconnectable:i,elementsSelectable:a,onClick:s,onDoubleClick:l,onContextMenu:c,onMouseEnter:u,onMouseMove:d,onMouseLeave:h,reconnectRadius:f,onReconnect:g,onReconnectStart:p,onReconnectEnd:m,rfId:y,edgeTypes:v,noPanClassName:x,onError:w,disableKeyboardA11y:b}){let S=Mi(t=>t.edgeLookup.get(e));const C=Mi(e=>e.defaultEdgeOptions);S=C?{...C,...S}:S;let E=S.type||"default",k=v?.[E]||ws[E];void 0===k&&(w?.("011",to(E)),E="default",k=v?.default||ws.default);const N=!!(S.focusable||r&&void 0===S.focusable),_=void 0!==g&&(S.reconnectable||i&&void 0===S.reconnectable),M=!!(S.selectable||a&&void 0===S.selectable),P=n.useRef(null),[D,O]=n.useState(!1),[z,I]=n.useState(!1),A=Pi(),{zIndex:R,sourceX:L,sourceY:$,targetX:T,targetY:B,sourcePosition:j,targetPosition:V}=Mi(n.useCallback(t=>{const n=t.nodeLookup.get(S.source),o=t.nodeLookup.get(S.target);if(!n||!o)return{zIndex:S.zIndex,...bs};const r=function(e){const{sourceNode:t,targetNode:n}=e;if(!vr(t)||!vr(n))return null;const o=t.internals.handleBounds||xr(t.handles),r=n.internals.handleBounds||xr(n.handles),i=br(o?.source??[],e.sourceHandle),a=br(e.connectionMode===so.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!a)return e.onError?.("008",Jn(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=i?.position||go.Bottom,l=a?.position||go.Top,c=wr(t,i,s),u=wr(n,a,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:l}}({id:e,sourceNode:n,targetNode:o,sourceHandle:S.sourceHandle||null,targetHandle:S.targetHandle||null,connectionMode:t.connectionMode,onError:w}),i=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o,elevateOnSelect:r=!1}){return void 0!==o?o:(r&&n?1e3:0)+Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0)}({selected:S.selected,zIndex:S.zIndex,sourceNode:n,targetNode:o,elevateOnSelect:t.elevateEdgesOnSelect});return{zIndex:i,...r||bs}},[S.source,S.target,S.sourceHandle,S.targetHandle,S.selected,S.zIndex]),Ei),H=n.useMemo(()=>S.markerStart?`url('#${Sr(S.markerStart,y)}')`:void 0,[S.markerStart,y]),Z=n.useMemo(()=>S.markerEnd?`url('#${Sr(S.markerEnd,y)}')`:void 0,[S.markerEnd,y]);if(S.hidden||null===L||null===$||null===T||null===B)return null;const X=l?e=>{l(e,{...S})}:void 0,Y=c?e=>{c(e,{...S})}:void 0,F=u?e=>{u(e,{...S})}:void 0,W=d?e=>{d(e,{...S})}:void 0,K=h?e=>{h(e,{...S})}:void 0;return t.jsx("svg",{style:{zIndex:R},children:t.jsxs("g",{className:o(["react-flow__edge",`react-flow__edge-${E}`,S.className,x,{selected:S.selected,animated:S.animated,inactive:!M&&!s,updating:D,selectable:M}]),onClick:t=>{const{addSelectedEdges:n,unselectNodesAndEdges:o,multiSelectionActive:r}=A.getState();M&&(A.setState({nodesSelectionActive:!1}),S.selected&&r?(o({nodes:[],edges:[S]}),P.current?.blur()):n([e])),s&&s(t,S)},onDoubleClick:X,onContextMenu:Y,onMouseEnter:F,onMouseMove:W,onMouseLeave:K,onKeyDown:N?t=>{if(!b&&io.includes(t.key)&&M){const{unselectNodesAndEdges:n,addSelectedEdges:o}=A.getState();"Escape"===t.key?(P.current?.blur(),n({edges:[S]})):o([e])}}:void 0,tabIndex:N?0:void 0,role:S.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":null===S.ariaLabel?void 0:S.ariaLabel||`Edge from ${S.source} to ${S.target}`,"aria-describedby":N?`${Ii}-${y}`:void 0,ref:P,...S.domAttributes,children:[!z&&t.jsx(k,{id:e,source:S.source,target:S.target,type:S.type,selected:S.selected,animated:S.animated,selectable:M,deletable:S.deletable??!0,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,sourceX:L,sourceY:$,targetX:T,targetY:B,sourcePosition:j,targetPosition:V,data:S.data,style:S.style,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerStart:H,markerEnd:Z,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth}),_&&t.jsx(Ns,{edge:S,isReconnectable:_,reconnectRadius:f,onReconnect:g,onReconnectStart:p,onReconnectEnd:m,sourceX:L,sourceY:$,targetX:T,targetY:B,sourcePosition:j,targetPosition:V,setUpdateHover:O,setReconnecting:I})]})})});const Ms=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ps({defaultMarkerColor:e,onlyRenderVisibleElements:o,rfId:r,edgeTypes:i,noPanClassName:a,onReconnect:s,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:h,reconnectRadius:f,onEdgeDoubleClick:g,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:v,edgesReconnectable:x,elementsSelectable:w,onError:b}=Mi(Ms,Ei),S=(C=o,Mi(n.useCallback(e=>{if(!C)return e.edges.map(e=>e.id);const t=[];if(e.width&&e.height)for(const n of e.edges){const o=e.nodeLookup.get(n.source),r=e.nodeLookup.get(n.target);o&&r&&dr({sourceNode:o,targetNode:r,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t},[C]),Ei));var C;return t.jsxs("div",{className:"react-flow__edges",children:[t.jsx(Ja,{defaultColor:e,rfId:r}),S.map(e=>t.jsx(_s,{id:e,edgesFocusable:v,edgesReconnectable:x,elementsSelectable:w,noPanClassName:a,onReconnect:s,onContextMenu:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:d,onClick:h,reconnectRadius:f,onDoubleClick:g,onReconnectStart:p,onReconnectEnd:m,rfId:r,onError:b,edgeTypes:i,disableKeyboardA11y:y},e))]})}Ps.displayName="EdgeRenderer";const Ds=n.memo(Ps),Os=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function zs({children:e}){const n=Mi(Os);return t.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}const Is=e=>e.panZoom?.syncViewport;function As(e){return e.connection.inProgress?{...e.connection,to:Vo(e.connection.to,e.transform)}:{...e.connection}}function Rs(e){const t=function(e){if(e)return t=>{const n=As(t);return e(n)};return As}(e);return Mi(t,Ei)}const Ls=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function $s({containerStyle:e,style:n,type:r,component:i}){const{nodesConnectable:a,width:s,height:l,isValid:c,inProgress:u}=Mi(Ls,Ei);return!!(s&&a&&u)?t.jsx("svg",{style:e,width:s,height:l,className:"react-flow__connectionline react-flow__container",children:t.jsx("g",{className:o(["react-flow__connection",mo(c)]),children:t.jsx(Ts,{style:n,type:r,CustomComponent:i,isValid:c})})}):null}const Ts=({style:e,type:n=ho.Bezier,CustomComponent:o,isValid:r})=>{const{inProgress:i,from:a,fromNode:s,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:h,toPosition:f}=Rs();if(!i)return;if(o)return t.jsx(o,{connectionLineType:n,connectionLineStyle:e,fromNode:s,fromHandle:l,fromX:a.x,fromY:a.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:f,connectionStatus:mo(r),toNode:d,toHandle:h});let g="";const p={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:f};switch(n){case ho.Bezier:[g]=cr(p);break;case ho.SimpleBezier:[g]=rs(p);break;case ho.Step:[g]=yr({...p,borderRadius:0});break;case ho.SmoothStep:[g]=yr(p);break;default:[g]=fr(p)}return t.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};Ts.displayName="ConnectionLine";const Bs={};function js(e=Bs){n.useRef(e),Pi(),n.useEffect(()=>{},[e])}function Vs({nodeTypes:e,edgeTypes:o,onInit:r,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:s,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:h,onSelectionContextMenu:f,onSelectionStart:g,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:x,selectionKeyCode:w,selectionOnDrag:b,selectionMode:S,multiSelectionKeyCode:C,panActivationKeyCode:E,zoomActivationKeyCode:k,deleteKeyCode:N,onlyRenderVisibleElements:_,elementsSelectable:M,defaultViewport:P,translateExtent:D,minZoom:O,maxZoom:z,preventScrolling:I,defaultMarkerColor:A,zoomOnScroll:R,zoomOnPinch:L,panOnScroll:$,panOnScrollSpeed:T,panOnScrollMode:B,zoomOnDoubleClick:j,panOnDrag:V,onPaneClick:H,onPaneMouseEnter:Z,onPaneMouseMove:X,onPaneMouseLeave:Y,onPaneScroll:F,onPaneContextMenu:W,paneClickDistance:K,nodeClickDistance:G,onEdgeContextMenu:q,onEdgeMouseEnter:U,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,noDragClassName:re,noWheelClassName:ie,noPanClassName:ae,disableKeyboardA11y:se,nodeExtent:le,rfId:ce,viewport:ue,onViewportChange:de}){return js(e),js(o),Pi(),n.useRef(!1),n.useEffect(()=>{},[]),function(e){const t=ya(),o=n.useRef(!1);n.useEffect(()=>{!o.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),o.current=!0)},[e,t.viewportInitialized])}(r),function(e){const t=Mi(Is),o=Pi();n.useEffect(()=>{e&&(t?.(e),o.setState({transform:[e.x,e.y,e.zoom]}))},[e,t])}(ue),t.jsx(Za,{onPaneClick:H,onPaneMouseEnter:Z,onPaneMouseMove:X,onPaneMouseLeave:Y,onPaneContextMenu:W,onPaneScroll:F,paneClickDistance:K,deleteKeyCode:N,selectionKeyCode:w,selectionOnDrag:b,selectionMode:S,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:C,panActivationKeyCode:E,zoomActivationKeyCode:k,elementsSelectable:M,zoomOnScroll:R,zoomOnPinch:L,zoomOnDoubleClick:j,panOnScroll:$,panOnScrollSpeed:T,panOnScrollMode:B,panOnDrag:V,defaultViewport:P,translateExtent:D,minZoom:O,maxZoom:z,onSelectionContextMenu:f,preventScrolling:I,noDragClassName:re,noWheelClassName:ie,noPanClassName:ae,disableKeyboardA11y:se,onViewportChange:de,isControlledViewport:!!ue,children:t.jsxs(zs,{children:[t.jsx(Ds,{edgeTypes:o,onEdgeClick:a,onEdgeDoubleClick:l,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,onlyRenderVisibleElements:_,onEdgeContextMenu:q,onEdgeMouseEnter:U,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,defaultMarkerColor:A,noPanClassName:ae,disableKeyboardA11y:se,rfId:ce}),t.jsx($s,{style:y,type:m,component:v,containerStyle:x}),t.jsx("div",{className:"react-flow__edgelabel-renderer"}),t.jsx(Ga,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:h,nodeClickDistance:G,onlyRenderVisibleElements:_,noPanClassName:ae,noDragClassName:re,disableKeyboardA11y:se,nodeExtent:le,rfId:ce}),t.jsx("div",{className:"react-flow__viewport-portal"})]})})}Vs.displayName="GraphView";const Hs=n.memo(Vs),Zs=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:d}={})=>{const h=new Map,f=new Map,g=new Map,p=new Map,m=o??t??[],y=n??e??[],v=u??[0,0],x=d??ro;zr(g,p,m);const w=_r(y,h,f,{nodeOrigin:v,nodeExtent:x,elevateNodesOnSelect:!1});let b=[0,0,1];if(a&&r&&i){const e=wo(h,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:o}=Xo(e,r,i,l,c,s?.padding??.1);b=[t,n,o]}return{rfId:"1",width:r??0,height:i??0,transform:b,nodes:y,nodesInitialized:w,nodeLookup:h,parentLookup:f,edges:m,edgeLookup:p,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==o,panZoom:null,minZoom:l,maxZoom:c,translateExtent:ro,nodeExtent:x,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:so.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:s,fitViewResolver:null,connection:{...uo},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Bo,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:ao}},Xs=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d})=>{return h=(h,f)=>{async function g(){const{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:o,width:r,height:i,minZoom:a,maxZoom:s}=f();t&&(await So({nodes:e,width:r,height:i,panZoom:t,minZoom:a,maxZoom:s},n),o?.resolve(!0),h({fitViewResolver:null}))}return{...Zs({nodes:e,edges:t,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:o}),setNodes:e=>{const{nodeLookup:t,parentLookup:n,nodeOrigin:o,elevateNodesOnSelect:r,fitViewQueued:i}=f(),a=_r(e,t,n,{nodeOrigin:o,nodeExtent:d,elevateNodesOnSelect:r,checkEquality:!0});i&&a?(g(),h({nodes:e,nodesInitialized:a,fitViewQueued:!1,fitViewOptions:void 0})):h({nodes:e,nodesInitialized:a})},setEdges:e=>{const{connectionLookup:t,edgeLookup:n}=f();zr(t,n,e),h({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){const{setNodes:t}=f();t(e),h({hasDefaultNodes:!0})}if(t){const{setEdges:e}=f();e(t),h({hasDefaultEdges:!0})}},updateNodeInternals:e=>{const{triggerNodeChanges:t,nodeLookup:n,parentLookup:o,domNode:r,nodeOrigin:i,nodeExtent:a,debug:s,fitViewQueued:l}=f(),{changes:c,updatedInternals:u}=function(e,t,n,o,r,i){const a=o?.querySelector(".xyflow__viewport");let s=!1;if(!a)return{changes:[],updatedInternals:s};const l=[],c=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(c.transform),d=[];for(const o of e.values()){const e=t.get(o.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),s=!0;continue}const a=Jo(o.nodeElement),c=e.measured.width!==a.width||e.measured.height!==a.height;if(a.width&&a.height&&(c||!e.internals.handleBounds||o.force)){const h=o.nodeElement.getBoundingClientRect(),f=Fo(e.extent)?e.extent:i;let{positionAbsolute:g}=e.internals;e.parentId&&"parent"===e.extent?g=_o(g,a,t.get(e.parentId)):f&&(g=No(g,f,a));const p={...e,measured:a,internals:{...e.internals,positionAbsolute:g,handleBounds:{source:ir("source",o.nodeElement,h,u,e.id),target:ir("target",o.nodeElement,h,u,e.id)}}};t.set(e.id,p),e.parentId&&Mr(p,t,n,{nodeOrigin:r}),s=!0,c&&(l.push({id:e.id,type:"dimensions",dimensions:a}),e.expandParent&&e.parentId&&d.push({id:e.id,parentId:e.parentId,rect:Io(p,r)}))}}if(d.length>0){const e=Dr(d,t,n,r);l.push(...e)}return{changes:l,updatedInternals:s}}(e,n,o,r,i,a);u&&(function(e,t,n){const o=kr(Cr,n);for(const n of e.values())if(n.parentId)Mr(n,e,t,o);else{const e=xo(n,o.nodeOrigin),t=Fo(n.extent)?n.extent:o.nodeExtent,r=No(e,t,Wo(n));n.internals.positionAbsolute=r}}(n,o,{nodeOrigin:i,nodeExtent:a}),l?(g(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),c?.length>0&&(s&&console.log("React Flow: trigger node changes",c),t?.(c)))},updateNodePositions:(e,t=!1)=>{const n=[],o=[],{nodeLookup:r,triggerNodeChanges:i}=f();for(const[i,a]of e){const e=r.get(i),s=!!(e?.expandParent&&e?.parentId&&a?.position),l={id:i,type:"position",position:s?{x:Math.max(0,a.position.x),y:Math.max(0,a.position.y)}:a.position,dragging:t};s&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...a.internals.positionAbsolute,width:a.measured.width??0,height:a.measured.height??0}}),o.push(l)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=f(),i=Dr(n,r,e,t);o.push(...i)}i(o)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:o,hasDefaultNodes:r,debug:i}=f();e?.length&&(r&&n(ia(e,o)),i&&console.log("React Flow: trigger node changes",e),t?.(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:o,hasDefaultEdges:r,debug:i}=f();if(e?.length){if(r){const t=function(e,t){return oa(e,t)}(e,o);n(t)}i&&console.log("React Flow: trigger edge changes",e),t?.(e)}},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=f();t?r(e.map(e=>aa(e,!0))):(r(sa(o,new Set([...e]),!0)),i(sa(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=f();t?i(e.map(e=>aa(e,!0))):(i(sa(n,new Set([...e]))),r(sa(o,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{const{edges:n,nodes:o,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=f(),s=t||n,l=(e||o).map(e=>{const t=r.get(e.id);return t&&(t.selected=!1),aa(e.id,!1)}),c=s.map(e=>aa(e.id,!1));i(l),a(c)},setMinZoom:e=>{const{panZoom:t,maxZoom:n}=f();t?.setScaleExtent([e,n]),h({minZoom:e})},setMaxZoom:e=>{const{panZoom:t,minZoom:n}=f();t?.setScaleExtent([n,e]),h({maxZoom:e})},setTranslateExtent:e=>{f().panZoom?.setTranslateExtent(e),h({translateExtent:e})},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:o,elementsSelectable:r}=f();if(!r)return;const i=t.reduce((e,t)=>t.selected?[...e,aa(t.id,!1)]:e,[]),a=e.reduce((e,t)=>t.selected?[...e,aa(t.id,!1)]:e,[]);n(i),o(a)},setNodeExtent:e=>{const{nodes:t,nodeLookup:n,parentLookup:o,nodeOrigin:r,elevateNodesOnSelect:i,nodeExtent:a}=f();e[0][0]===a[0][0]&&e[0][1]===a[0][1]&&e[1][0]===a[1][0]&&e[1][1]===a[1][1]||(_r(t,n,o,{nodeOrigin:r,nodeExtent:e,elevateNodesOnSelect:i,checkEquality:!1}),h({nodeExtent:e}))},panBy:e=>{const{transform:t,width:n,height:o,panZoom:r,translateExtent:i}=f();return async function({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),s=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(s)}({delta:e,panZoom:r,transform:t,translateExtent:i,width:n,height:o})},setCenter:async(e,t,n)=>{const{width:o,height:r,maxZoom:i,panZoom:a}=f();if(!a)return Promise.resolve(!1);const s=void 0!==n?.zoom?n.zoom:i;return await a.setViewport({x:o/2-e*s,y:r/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...uo}})},updateConnection:e=>{h({connection:e})},reset:()=>h({...Zs()})}},f=Object.is,h?Ci(h,f):Ci;var h,f};function Ys({initialNodes:e,initialEdges:o,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:s,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:u,fitView:d,nodeOrigin:h,nodeExtent:f,children:g}){const[p]=n.useState(()=>Xs({nodes:e,edges:o,defaultNodes:r,defaultEdges:i,width:a,height:s,fitView:d,minZoom:l,maxZoom:c,fitViewOptions:u,nodeOrigin:h,nodeExtent:f}));return t.jsx(Ni,{value:p,children:t.jsx(pa,{children:g})})}function Fs({children:e,nodes:o,edges:r,defaultNodes:i,defaultEdges:a,width:s,height:l,fitView:c,fitViewOptions:u,minZoom:d,maxZoom:h,nodeOrigin:f,nodeExtent:g}){return n.useContext(ki)?t.jsx(t.Fragment,{children:e}):t.jsx(Ys,{initialNodes:o,initialEdges:r,defaultNodes:i,defaultEdges:a,initialWidth:s,initialHeight:l,fitView:c,initialFitViewOptions:u,initialMinZoom:d,initialMaxZoom:h,nodeOrigin:f,nodeExtent:g,children:e})}const Ws={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var Ks,Gs=da(function({nodes:e,edges:r,defaultNodes:i,defaultEdges:a,className:s,nodeTypes:l,edgeTypes:c,onNodeClick:u,onEdgeClick:d,onInit:h,onMove:f,onMoveStart:g,onMoveEnd:p,onConnect:m,onConnectStart:y,onConnectEnd:v,onClickConnectStart:x,onClickConnectEnd:w,onNodeMouseEnter:b,onNodeMouseMove:S,onNodeMouseLeave:C,onNodeContextMenu:E,onNodeDoubleClick:k,onNodeDragStart:N,onNodeDrag:_,onNodeDragStop:M,onNodesDelete:P,onEdgesDelete:D,onDelete:O,onSelectionChange:z,onSelectionDragStart:I,onSelectionDrag:A,onSelectionDragStop:R,onSelectionContextMenu:L,onSelectionStart:$,onSelectionEnd:T,onBeforeDelete:B,connectionMode:j,connectionLineType:V=ho.Bezier,connectionLineStyle:H,connectionLineComponent:Z,connectionLineContainerStyle:X,deleteKeyCode:Y="Backspace",selectionKeyCode:F="Shift",selectionOnDrag:W=!1,selectionMode:K=co.Full,panActivationKeyCode:G="Space",multiSelectionKeyCode:q=(Yo()?"Meta":"Control"),zoomActivationKeyCode:U=(Yo()?"Meta":"Control"),snapToGrid:Q,snapGrid:J,onlyRenderVisibleElements:ee=!1,selectNodesOnDrag:te,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,nodeOrigin:ae=Fi,edgesFocusable:se,edgesReconnectable:le,elementsSelectable:ce=!0,defaultViewport:ue=Wi,minZoom:de=.5,maxZoom:he=2,translateExtent:fe=ro,preventScrolling:ge=!0,nodeExtent:pe,defaultMarkerColor:me="#b1b1b7",zoomOnScroll:ye=!0,zoomOnPinch:ve=!0,panOnScroll:xe=!1,panOnScrollSpeed:we=.5,panOnScrollMode:be=lo.Free,zoomOnDoubleClick:Se=!0,panOnDrag:Ce=!0,onPaneClick:Ee,onPaneMouseEnter:ke,onPaneMouseMove:Ne,onPaneMouseLeave:_e,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:De=0,nodeClickDistance:Oe=0,children:ze,onReconnect:Ie,onReconnectStart:Ae,onReconnectEnd:Re,onEdgeContextMenu:Le,onEdgeDoubleClick:$e,onEdgeMouseEnter:Te,onEdgeMouseMove:Be,onEdgeMouseLeave:je,reconnectRadius:Ve=10,onNodesChange:He,onEdgesChange:Ze,noDragClassName:Xe="nodrag",noWheelClassName:Ye="nowheel",noPanClassName:Fe="nopan",fitView:We,fitViewOptions:Ke,connectOnClick:Ge,attributionPosition:qe,proOptions:Ue,defaultEdgeOptions:Qe,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,disableKeyboardA11y:tt=!1,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,connectionRadius:it,isValidConnection:at,onError:st,style:lt,id:ct,nodeDragThreshold:ut,connectionDragThreshold:dt,viewport:ht,onViewportChange:ft,width:gt,height:pt,colorMode:mt="light",debug:yt,onScroll:vt,ariaLabelConfig:xt,...wt},bt){const St=ct||"1",Ct=function(e){const[t,o]=n.useState("system"===e?null:e);return n.useEffect(()=>{if("system"!==e)return void o(e);const t=Qi(),n=()=>o(t?.matches?"dark":"light");return n(),t?.addEventListener("change",n),()=>{t?.removeEventListener("change",n)}},[e]),null!==t?t:Qi()?.matches?"dark":"light"}(mt),Et=n.useCallback(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),vt?.(e)},[vt]);return t.jsx("div",{"data-testid":"rf__wrapper",...wt,onScroll:Et,style:{...lt,...Ws},ref:bt,className:o(["react-flow",s,Ct]),id:ct,role:"application",children:t.jsxs(Fs,{nodes:e,edges:r,width:gt,height:pt,fitView:We,fitViewOptions:Ke,minZoom:de,maxZoom:he,nodeOrigin:ae,nodeExtent:pe,children:[t.jsx(Hs,{onInit:h,onNodeClick:u,onEdgeClick:d,onNodeMouseEnter:b,onNodeMouseMove:S,onNodeMouseLeave:C,onNodeContextMenu:E,onNodeDoubleClick:k,nodeTypes:l,edgeTypes:c,connectionLineType:V,connectionLineStyle:H,connectionLineComponent:Z,connectionLineContainerStyle:X,selectionKeyCode:F,selectionOnDrag:W,selectionMode:K,deleteKeyCode:Y,multiSelectionKeyCode:q,panActivationKeyCode:G,zoomActivationKeyCode:U,onlyRenderVisibleElements:ee,defaultViewport:ue,translateExtent:fe,minZoom:de,maxZoom:he,preventScrolling:ge,zoomOnScroll:ye,zoomOnPinch:ve,zoomOnDoubleClick:Se,panOnScroll:xe,panOnScrollSpeed:we,panOnScrollMode:be,panOnDrag:Ce,onPaneClick:Ee,onPaneMouseEnter:ke,onPaneMouseMove:Ne,onPaneMouseLeave:_e,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:De,nodeClickDistance:Oe,onSelectionContextMenu:L,onSelectionStart:$,onSelectionEnd:T,onReconnect:Ie,onReconnectStart:Ae,onReconnectEnd:Re,onEdgeContextMenu:Le,onEdgeDoubleClick:$e,onEdgeMouseEnter:Te,onEdgeMouseMove:Be,onEdgeMouseLeave:je,reconnectRadius:Ve,defaultMarkerColor:me,noDragClassName:Xe,noWheelClassName:Ye,noPanClassName:Fe,rfId:St,disableKeyboardA11y:tt,nodeExtent:pe,viewport:ht,onViewportChange:ft}),t.jsx(Ui,{nodes:e,edges:r,defaultNodes:i,defaultEdges:a,onConnect:m,onConnectStart:y,onConnectEnd:v,onClickConnectStart:x,onClickConnectEnd:w,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,edgesFocusable:se,edgesReconnectable:le,elementsSelectable:ce,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,minZoom:de,maxZoom:he,nodeExtent:pe,onNodesChange:He,onEdgesChange:Ze,snapToGrid:Q,snapGrid:J,connectionMode:j,translateExtent:fe,connectOnClick:Ge,defaultEdgeOptions:Qe,fitView:We,fitViewOptions:Ke,onNodesDelete:P,onEdgesDelete:D,onDelete:O,onNodeDragStart:N,onNodeDrag:_,onNodeDragStop:M,onSelectionDrag:A,onSelectionDragStart:I,onSelectionDragStop:R,onMove:f,onMoveStart:g,onMoveEnd:p,noPanClassName:Fe,nodeOrigin:ae,rfId:St,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,onError:st,connectionRadius:it,isValidConnection:at,selectNodesOnDrag:te,nodeDragThreshold:ut,connectionDragThreshold:dt,onBeforeDelete:B,debug:yt,ariaLabelConfig:xt}),t.jsx(Yi,{onSelectionChange:z}),ze,t.jsx(Bi,{proOptions:Ue,position:qe}),t.jsx($i,{rfId:St,disableKeyboardA11y:tt})]})})});function qs({dimensions:e,lineWidth:n,variant:r,className:i}){return t.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:o(["react-flow__background-pattern",r,i])})}function Us({radius:e,className:n}){return t.jsx("circle",{cx:e,cy:e,r:e,className:o(["react-flow__background-pattern","dots",n])})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(Ks||(Ks={}));const Qs={[Ks.Dots]:1,[Ks.Lines]:1,[Ks.Cross]:6},Js=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function el({id:e,variant:r=Ks.Dots,gap:i=20,size:a,lineWidth:s=1,offset:l=0,color:c,bgColor:u,style:d,className:h,patternClassName:f}){const g=n.useRef(null),{transform:p,patternId:m}=Mi(Js,Ei),y=a||Qs[r],v=r===Ks.Dots,x=r===Ks.Cross,w=Array.isArray(i)?i:[i,i],b=[w[0]*p[2]||1,w[1]*p[2]||1],S=y*p[2],C=Array.isArray(l)?l:[l,l],E=x?[S,S]:b,k=[C[0]*p[2]||1+E[0]/2,C[1]*p[2]||1+E[1]/2],N=`${m}${e||""}`;return t.jsxs("svg",{className:o(["react-flow__background",h]),style:{...d,...wa,"--xy-background-color-props":u,"--xy-background-pattern-color-props":c},ref:g,"data-testid":"rf__background",children:[t.jsx("pattern",{id:N,x:p[0]%b[0],y:p[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:v?t.jsx(Us,{radius:S/2,className:f}):t.jsx(qs,{dimensions:E,lineWidth:s,variant:r,className:f})}),t.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}el.displayName="Background";const tl=n.memo(el);function nl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:t.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function ol(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:t.jsx("path",{d:"M0 0h32v4.2H0z"})})}function rl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:t.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function il(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:t.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function al(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:t.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function sl({children:e,className:n,...r}){return t.jsx("button",{type:"button",className:o(["react-flow__controls-button",n]),...r,children:e})}const ll=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function cl({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:a,onZoomIn:s,onZoomOut:l,onFitView:c,onInteractiveChange:u,className:d,children:h,position:f="bottom-left",orientation:g="vertical","aria-label":p}){const m=Pi(),{isInteractive:y,minZoomReached:v,maxZoomReached:x,ariaLabelConfig:w}=Mi(ll,Ei),{zoomIn:b,zoomOut:S,fitView:C}=ya(),E="horizontal"===g?"horizontal":"vertical";return t.jsxs(Ti,{className:o(["react-flow__controls",E,d]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??w["controls.ariaLabel"],children:[n&&t.jsxs(t.Fragment,{children:[t.jsx(sl,{onClick:()=>{b(),s?.()},className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:x,children:t.jsx(nl,{})}),t.jsx(sl,{onClick:()=>{S(),l?.()},className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:v,children:t.jsx(ol,{})})]}),r&&t.jsx(sl,{className:"react-flow__controls-fitview",onClick:()=>{C(a),c?.()},title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:t.jsx(rl,{})}),i&&t.jsx(sl,{className:"react-flow__controls-interactive",onClick:()=>{m.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),u?.(!y)},title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:y?t.jsx(al,{}):t.jsx(il,{})}),h]})}cl.displayName="Controls";const ul=n.memo(cl);const dl=n.memo(function({id:e,x:n,y:r,width:i,height:a,style:s,color:l,strokeColor:c,strokeWidth:u,className:d,borderRadius:h,shapeRendering:f,selected:g,onClick:p}){const{background:m,backgroundColor:y}=s||{},v=l||m||y;return t.jsx("rect",{className:o(["react-flow__minimap-node",{selected:g},d]),x:n,y:r,rx:h,ry:h,width:i,height:a,style:{fill:v,stroke:c,strokeWidth:u},shapeRendering:f,onClick:p?t=>p(t,e):void 0})}),hl=e=>e.nodes.map(e=>e.id),fl=e=>e instanceof Function?e:()=>e;const gl=n.memo(function({id:e,nodeColorFunc:n,nodeStrokeColorFunc:o,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:s,NodeComponent:l,onClick:c}){const{node:u,x:d,y:h,width:f,height:g}=Mi(t=>{const{internals:n}=t.nodeLookup.get(e),o=n.userNode,{x:r,y:i}=n.positionAbsolute,{width:a,height:s}=Wo(o);return{node:o,x:r,y:i,width:a,height:s}},Ei);return u&&!u.hidden&&Ko(u)?t.jsx(l,{x:d,y:h,width:f,height:g,style:u.style,selected:!!u.selected,className:r(u),color:n(u),borderRadius:i,strokeColor:o(u),strokeWidth:a,shapeRendering:s,onClick:c,id:u.id}):null});var pl=n.memo(function({nodeStrokeColor:e,nodeColor:n,nodeClassName:o="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=dl,onClick:s}){const l=Mi(hl,Ei),c=fl(n),u=fl(e),d=fl(o),h="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return t.jsx(t.Fragment,{children:l.map(e=>t.jsx(gl,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:s,shapeRendering:h},e))})});const ml=e=>!e.hidden,yl=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Ro(wo(e.nodeLookup,{filter:ml}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}};function vl({style:e,className:r,nodeStrokeColor:i,nodeColor:a,nodeClassName:s="",nodeBorderRadius:l=5,nodeStrokeWidth:c,nodeComponent:u,bgColor:d,maskColor:h,maskStrokeColor:f,maskStrokeWidth:g,position:p="bottom-right",onClick:m,onNodeClick:y,pannable:v=!1,zoomable:x=!1,ariaLabel:w,inversePan:b,zoomStep:S=1,offsetScale:C=5}){const E=Pi(),k=n.useRef(null),{boundingRect:N,viewBB:_,rfId:M,panZoom:P,translateExtent:D,flowWidth:O,flowHeight:z,ariaLabelConfig:I}=Mi(yl,Ei),A=e?.width??200,R=e?.height??150,L=N.width/A,$=N.height/R,T=Math.max(L,$),B=T*A,j=T*R,V=C*T,H=N.x-(B-N.width)/2-V,Z=N.y-(j-N.height)/2-V,X=B+2*V,Y=j+2*V,F=`react-flow__minimap-desc-${M}`,W=n.useRef(0),K=n.useRef();W.current=T,n.useEffect(()=>{if(k.current&&P)return K.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=be(e);return{update:function({translateExtent:e,width:i,height:a,zoomStep:s=1,pannable:l=!0,zoomable:c=!0,inversePan:u=!1}){let d=[0,0];const h=Wn().on("start",e=>{"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(d=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on("zoom",l?r=>{const s=n();if("mousemove"!==r.sourceEvent.type&&"touchmove"!==r.sourceEvent.type||!t)return;const l=[r.sourceEvent.clientX??r.sourceEvent.touches[0].clientX,r.sourceEvent.clientY??r.sourceEvent.touches[0].clientY],c=[l[0]-d[0],l[1]-d[1]];d=l;const h=o()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),f={x:s[0]-c[0]*h,y:s[1]-c[1]*h},g=[[0,0],[i,a]];t.setViewportConstrained({x:f.x,y:f.y,zoom:s[2]},g,e)}:null).on("zoom.wheel",c?e=>{if("wheel"!==e.sourceEvent.type||!t)return;const o=n(),r=e.sourceEvent.ctrlKey&&Yo()?10:1,i=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*s,a=o[2]*Math.pow(2,i*r);t.scaleTo(a)}:null);r.call(h,{})},destroy:function(){r.on("zoom",null)},pointer:Se}}({domNode:k.current,panZoom:P,getTransform:()=>E.getState().transform,getViewScale:()=>W.current}),()=>{K.current?.destroy()}},[P]),n.useEffect(()=>{K.current?.update({translateExtent:D,width:O,height:z,inversePan:b,pannable:v,zoomStep:S,zoomable:x})},[v,x,b,S,D,O,z]);const G=m?e=>{const[t,n]=K.current?.pointer(e)||[0,0];m(e,{x:t,y:n})}:void 0,q=y?n.useCallback((e,t)=>{const n=E.getState().nodeLookup.get(t).internals.userNode;y(e,n)},[]):void 0,U=w??I["minimap.ariaLabel"];return t.jsx(Ti,{position:p,style:{...e,"--xy-minimap-background-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof h?h:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof f?f:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof g?g*T:void 0,"--xy-minimap-node-background-color-props":"string"==typeof a?a:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof i?i:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof c?c:void 0},className:o(["react-flow__minimap",r]),"data-testid":"rf__minimap",children:t.jsxs("svg",{width:A,height:R,viewBox:`${H} ${Z} ${X} ${Y}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":F,ref:k,onClick:G,children:[U&&t.jsx("title",{id:F,children:U}),t.jsx(pl,{onClick:q,nodeColor:a,nodeStrokeColor:i,nodeBorderRadius:l,nodeClassName:s,nodeStrokeWidth:c,nodeComponent:u}),t.jsx("path",{className:"react-flow__minimap-mask",d:`M${H-V},${Z-V}h${X+2*V}v${Y+2*V}h${-X-2*V}z\n M${_.x},${_.y}h${_.width}v${_.height}h${-_.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}vl.displayName="MiniMap",n.memo(vl);const xl={[Ur.Line]:"right",[Ur.Handle]:"bottom-right"};n.memo(function({nodeId:e,position:r,variant:i=Ur.Handle,className:a,style:s,children:l,color:c,minWidth:u=10,minHeight:d=10,maxWidth:h=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:p,autoScale:m=!0,shouldResize:y,onResizeStart:v,onResize:x,onResizeEnd:w}){const b=Ia(),S="string"==typeof e?e:b,C=Pi(),E=n.useRef(null),k=i===Ur.Handle,N=Mi(n.useCallback((_=k&&m,e=>_?`${Math.max(1/e.transform[2],1)}`:void 0),[k,m]),Ei);var _;const M=n.useRef(null),P=r??xl[i];n.useEffect(()=>{if(E.current&&S)return M.current||(M.current=ai({domNode:E.current,nodeId:S,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,domNode:i}=C.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,paneDomNode:i}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:o,parentLookup:r,nodeOrigin:i}=C.getState(),a=[],s={x:e.x,y:e.y},l=o.get(S);if(l&&l.expandParent&&l.parentId){const t=l.origin??i,n=e.width??l.measured.width??0,c=e.height??l.measured.height??0,u=Dr([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...Go({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:c},l.parentId,o,t)}}],o,r,i);a.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*c,e.y):void 0}if(void 0!==s.x&&void 0!==s.y){const e={id:S,type:"position",position:{...s}};a.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:S,type:"dimensions",resizing:!0,setAttributes:!p||("horizontal"===p?"width":"height"),dimensions:{width:e.width,height:e.height}};a.push(t)}for(const e of t){const t={...e,type:"position"};a.push(t)}n(a)},onEnd:({width:e,height:t})=>{const n={id:S,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};C.getState().triggerNodeChanges([n])}})),M.current.update({controlPosition:P,boundaries:{minWidth:u,minHeight:d,maxWidth:h,maxHeight:f},keepAspectRatio:g,resizeDirection:p,onResizeStart:v,onResize:x,onResizeEnd:w,shouldResize:y}),()=>{M.current?.destroy()}},[P,u,d,h,f,g,v,x,w,y]);const D=P.split("-");return t.jsx("div",{className:o(["react-flow__resize-control","nodrag",...D,i,a]),ref:E,style:{...s,scale:N,...c&&{[k?"backgroundColor":"borderColor"]:c}},children:l})});const wl={id:"1",position:{x:0,y:0},data:{label:"1"}},{useDebugValue:bl}=n,{useSyncExternalStoreWithSelector:Sl}=mi;let Cl=!1;const El=e=>e;const kl=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t="function"==typeof e?vi(e):e,n=(e,n)=>function(e,t=El,n){n&&!Cl&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Cl=!0);const o=Sl(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return bl(o),o}(t,e,n);return Object.assign(n,t),n},Nl=(_l?kl(_l):kl)((e,t)=>({data:void 0,clickmap:void 0,config:void 0,iframeHeight:0,state:{hideSidebar:!1},setData:t=>e({data:t}),setClickmap:t=>e({clickmap:t}),setState:n=>e({state:{...t().state,...n}}),setConfig:n=>e({config:{...t().config,...n}}),setConfigBy:(n,o)=>e({config:{...t().config,[n]:o}}),setIframeHeight:t=>e({iframeHeight:t})}));var _l;const Ml=({children:e,...o})=>{const r=o.id,i=o.flexDirection,a=o.overflow||"hidden",s=o.position||"relative",l=o.flex||"none",c=o.justifyContent,u=o.alignItems,d=o.style||{},h=o.gap||0,f=o.height||"auto",g=n.useMemo(()=>{switch(i){case"row":return{columnGap:h};case"column":return{rowGap:h}}},[h,i]),p={display:"flex",flexDirection:i,overflow:a,position:s,flex:l,justifyContent:c,alignItems:u,height:f,...g,...d};return t.jsx("div",{id:r,style:p,children:e})};var Pl,Dl;!function(e){e.Sessions="Sessions",e.Timeline="Timeline",e.Area="Area",e.Click="Click",e.Scroll="Scroll",e.Attention="Attention"}(Pl||(Pl={})),function(e){e.NoResults="NoResults",e.NoClicks="NoClicks",e.NoScroll="NoScroll",e.ServerError="ServerError",e.DataError="DataError"}(Dl||(Dl={})),e.GraphView=({children:e,width:o,height:r})=>{const[i,a,s]=function(e){const[t,o]=n.useState(e),r=n.useCallback(e=>o(t=>ia(e,t)),[]);return[t,o,r]}([{...wl,width:o,height:r}]),l={default:()=>t.jsx(t.Fragment,{children:e})};return n.useEffect(()=>{o&&a(e=>[{...e.find(e=>"1"===e.id),measured:{height:r,width:o},height:r,width:o}])},[o,r,a]),t.jsxs(Gs,{nodes:i,nodeTypes:l,onNodesChange:s,debug:!0,minZoom:.5,maxZoom:2,fitView:!0,children:[t.jsx(ul,{}),t.jsx(tl,{})]})},e.HeatmapLayout=({data:e,clickmap:o,header:r,toolbar:i,sidebar:a})=>{const s=Nl(e=>e.setData),l=Nl(e=>e.setClickmap),c=n.useCallback(e=>{e&&l(e)},[o]),u=n.useCallback(e=>{e&&s(e)},[e]);return n.useEffect(()=>{u(e)},[e]),n.useEffect(()=>{c(o)},[o]),t.jsx(Ml,{id:"gx-hm-project",flexDirection:"column",flex:"1",height:"100%",children:t.jsx(Ml,{id:"gx-hm-project-content",flexDirection:"column",flex:"1",children:t.jsx("div",{style:{minHeight:"100%",display:"flex"}})})})},e.useHeatmapDataStore=Nl});
|
|
@@ -11,7 +11,8 @@ export interface IHeatmapDataStore {
|
|
|
11
11
|
setState: (state: IHeatmapState) => void;
|
|
12
12
|
setData: (data: DecodedPayload[]) => void;
|
|
13
13
|
setClickmap: (clickmap: ClickMapPoint[]) => void;
|
|
14
|
-
setConfig: (
|
|
14
|
+
setConfig: (value: IHeatmapConfig) => void;
|
|
15
|
+
setConfigBy: (key: keyof IHeatmapConfig, value: IHeatmapConfig[keyof IHeatmapConfig]) => void;
|
|
15
16
|
setIframeHeight: (iframeHeight: number) => void;
|
|
16
17
|
}
|
|
17
18
|
export declare const useHeatmapDataStore: import("zustand").UseBoundStore<import("zustand").StoreApi<IHeatmapDataStore>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/stores/data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEzE,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,cAAc,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IACjD,SAAS,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/stores/data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEzE,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,cAAc,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;IAC1C,WAAW,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IACjD,SAAS,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC3C,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,cAAc,EAAE,KAAK,EAAE,cAAc,CAAC,MAAM,cAAc,CAAC,KAAK,IAAI,CAAC;IAC9F,eAAe,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED,eAAO,MAAM,mBAAmB,gFAgB9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heatmap.d.ts","sourceRoot":"","sources":["../../src/types/heatmap.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"heatmap.d.ts","sourceRoot":"","sources":["../../src/types/heatmap.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAClC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gemx-dev/heatmap-react",
|
|
3
3
|
"author": "gemx-dev",
|
|
4
|
-
"version": "3.5.
|
|
4
|
+
"version": "3.5.28",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.css"
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"zustand": "^4.4.3"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"react": "
|
|
32
|
-
"react-dom": "
|
|
31
|
+
"react": ">=17",
|
|
32
|
+
"react-dom": ">=17"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@gemx-dev/eslint-config": "workspace:*",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"postcss-import": "^15.1.0",
|
|
48
48
|
"postcss-nested": "^6.0.0",
|
|
49
49
|
"postcss-rename": "^0.6.1",
|
|
50
|
+
"react": "^18.2.0",
|
|
50
51
|
"rollup": "3.29.5",
|
|
51
52
|
"typescript": "5.9.2"
|
|
52
53
|
},
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
"zustand": "zustand",
|
|
57
58
|
"zustand/shallow": "zustandShallow"
|
|
58
59
|
},
|
|
59
|
-
"name": "
|
|
60
|
+
"name": "HeatmapReact"
|
|
60
61
|
},
|
|
61
62
|
"publishConfig": {
|
|
62
63
|
"access": "public"
|