@aloudata/ink-flow 1.0.7 → 1.0.8
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/components/A11yDescriptions/index.d.ts +8 -0
- package/dist/components/A11yDescriptions/index.d.ts.map +1 -0
- package/dist/components/BatchProvider/index.d.ts +17 -0
- package/dist/components/BatchProvider/index.d.ts.map +1 -0
- package/dist/components/BatchProvider/types.d.ts +7 -0
- package/dist/components/BatchProvider/types.d.ts.map +1 -0
- package/dist/components/BatchProvider/useQueue.d.ts +11 -0
- package/dist/components/BatchProvider/useQueue.d.ts.map +1 -0
- package/dist/components/EdgeWrapper/EdgeUpdateAnchors.d.ts +17 -0
- package/dist/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -0
- package/dist/components/EdgeWrapper/index.d.ts +3 -0
- package/dist/components/EdgeWrapper/index.d.ts.map +1 -0
- package/dist/components/EdgeWrapper/utils.d.ts +11 -0
- package/dist/components/EdgeWrapper/utils.d.ts.map +1 -0
- package/dist/components/Edges/BaseEdge.d.ts +3 -0
- package/dist/components/Edges/BaseEdge.d.ts.map +1 -0
- package/dist/components/Edges/BezierEdge.d.ts +5 -0
- package/dist/components/Edges/BezierEdge.d.ts.map +1 -0
- package/dist/components/Edges/EdgeAnchor.d.ts +14 -0
- package/dist/components/Edges/EdgeAnchor.d.ts.map +1 -0
- package/dist/components/Edges/EdgeText.d.ts +8 -0
- package/dist/components/Edges/EdgeText.d.ts.map +1 -0
- package/dist/components/Edges/SimpleBezierEdge.d.ts +21 -0
- package/dist/components/Edges/SimpleBezierEdge.d.ts.map +1 -0
- package/dist/components/Edges/SmoothStepEdge.d.ts +5 -0
- package/dist/components/Edges/SmoothStepEdge.d.ts.map +1 -0
- package/dist/components/Edges/StepEdge.d.ts +5 -0
- package/dist/components/Edges/StepEdge.d.ts.map +1 -0
- package/dist/components/Edges/StraightEdge.d.ts +5 -0
- package/dist/components/Edges/StraightEdge.d.ts.map +1 -0
- package/dist/components/Edges/index.d.ts +6 -0
- package/dist/components/Edges/index.d.ts.map +1 -0
- package/dist/components/Handle/index.d.ts +11 -0
- package/dist/components/Handle/index.d.ts.map +1 -0
- package/dist/components/InkFlowProvider/index.d.ts +14 -0
- package/dist/components/InkFlowProvider/index.d.ts.map +1 -0
- package/dist/components/NodeWrapper/index.d.ts +3 -0
- package/dist/components/NodeWrapper/index.d.ts.map +1 -0
- package/dist/components/NodeWrapper/useNodeObserver.d.ts +14 -0
- package/dist/components/NodeWrapper/useNodeObserver.d.ts.map +1 -0
- package/dist/components/NodeWrapper/utils.d.ts +9 -0
- package/dist/components/NodeWrapper/utils.d.ts.map +1 -0
- package/dist/components/Nodes/DefaultNode.d.ts +3 -0
- package/dist/components/Nodes/DefaultNode.d.ts.map +1 -0
- package/dist/components/Nodes/GroupNode.d.ts +2 -0
- package/dist/components/Nodes/GroupNode.d.ts.map +1 -0
- package/dist/components/Nodes/InputNode.d.ts +3 -0
- package/dist/components/Nodes/InputNode.d.ts.map +1 -0
- package/dist/components/Nodes/OutputNode.d.ts +3 -0
- package/dist/components/Nodes/OutputNode.d.ts.map +1 -0
- package/dist/components/Nodes/utils.d.ts +13 -0
- package/dist/components/Nodes/utils.d.ts.map +1 -0
- package/dist/components/Panel/index.d.ts +11 -0
- package/dist/components/Panel/index.d.ts.map +1 -0
- package/dist/components/StoreUpdater/index.d.ts +9 -0
- package/dist/components/StoreUpdater/index.d.ts.map +1 -0
- package/dist/components/UserSelection/index.d.ts +2 -0
- package/dist/components/UserSelection/index.d.ts.map +1 -0
- package/dist/container/EdgeRenderer/MarkerDefinitions.d.ts +10 -0
- package/dist/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -0
- package/dist/container/EdgeRenderer/MarkerSymbols.d.ts +9 -0
- package/dist/container/EdgeRenderer/MarkerSymbols.d.ts.map +1 -0
- package/dist/container/EdgeRenderer/index.d.ts +13 -0
- package/dist/container/EdgeRenderer/index.d.ts.map +1 -0
- package/dist/container/FlowRenderer/index.d.ts +14 -0
- package/dist/container/FlowRenderer/index.d.ts.map +1 -0
- package/dist/container/GraphView/index.d.ts +11 -0
- package/dist/container/GraphView/index.d.ts.map +1 -0
- package/dist/container/InkFlow/Wrapper.d.ts +13 -0
- package/dist/container/InkFlow/Wrapper.d.ts.map +1 -0
- package/dist/container/InkFlow/index.d.ts +4 -0
- package/dist/container/InkFlow/index.d.ts.map +1 -0
- package/dist/container/InkFlow/init-values.d.ts +4 -0
- package/dist/container/InkFlow/init-values.d.ts.map +1 -0
- package/dist/container/NodeRenderer/index.d.ts +10 -0
- package/dist/container/NodeRenderer/index.d.ts.map +1 -0
- package/dist/container/NodeRenderer/useResizeObserver.d.ts +2 -0
- package/dist/container/NodeRenderer/useResizeObserver.d.ts.map +1 -0
- package/dist/container/Pane/index.d.ts +12 -0
- package/dist/container/Pane/index.d.ts.map +1 -0
- package/dist/container/Viewport/index.d.ts +7 -0
- package/dist/container/Viewport/index.d.ts.map +1 -0
- package/dist/container/ZoomPane/index.d.ts +7 -0
- package/dist/container/ZoomPane/index.d.ts.map +1 -0
- package/dist/contexts/NodeIdContext.d.ts +6 -0
- package/dist/contexts/NodeIdContext.d.ts.map +1 -0
- package/dist/contexts/StoreContext.d.ts +4 -0
- package/dist/contexts/StoreContext.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useDrag.d.ts +12 -0
- package/dist/hooks/useDrag.d.ts.map +1 -0
- package/dist/hooks/useEdgesState.d.ts +4 -0
- package/dist/hooks/useEdgesState.d.ts.map +1 -0
- package/dist/hooks/useGlobalKeyHandler.d.ts +11 -0
- package/dist/hooks/useGlobalKeyHandler.d.ts.map +1 -0
- package/dist/hooks/useInkFlow.d.ts +10 -0
- package/dist/hooks/useInkFlow.d.ts.map +1 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/dist/hooks/useKeyPress.d.ts +15 -0
- package/dist/hooks/useKeyPress.d.ts.map +1 -0
- package/dist/hooks/useMoveSelectedNodes.d.ts +12 -0
- package/dist/hooks/useMoveSelectedNodes.d.ts.map +1 -0
- package/dist/hooks/useNodesState.d.ts +4 -0
- package/dist/hooks/useNodesState.d.ts.map +1 -0
- package/dist/hooks/useResizeHandler.d.ts +8 -0
- package/dist/hooks/useResizeHandler.d.ts.map +1 -0
- package/dist/hooks/useStore.d.ts +21 -0
- package/dist/hooks/useStore.d.ts.map +1 -0
- package/dist/hooks/useViewportHelper.d.ts +10 -0
- package/dist/hooks/useViewportHelper.d.ts.map +1 -0
- package/dist/hooks/useVisibleEdgeIds.d.ts +9 -0
- package/dist/hooks/useVisibleEdgeIds.d.ts.map +1 -0
- package/dist/hooks/useVisibleNodeIds.d.ts +9 -0
- package/dist/hooks/useVisibleNodeIds.d.ts.map +1 -0
- package/dist/index.cjs.js +17 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +17 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/plugins/Controls/ControlButton.d.ts +3 -0
- package/dist/plugins/Controls/ControlButton.d.ts.map +1 -0
- package/dist/plugins/Controls/Controls.d.ts +8 -0
- package/dist/plugins/Controls/Controls.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/FitView.d.ts +2 -0
- package/dist/plugins/Controls/Icons/FitView.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/Lock.d.ts +2 -0
- package/dist/plugins/Controls/Icons/Lock.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/Minus.d.ts +2 -0
- package/dist/plugins/Controls/Icons/Minus.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/Plus.d.ts +2 -0
- package/dist/plugins/Controls/Icons/Plus.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/Unlock.d.ts +2 -0
- package/dist/plugins/Controls/Icons/Unlock.d.ts.map +1 -0
- package/dist/plugins/Controls/index.d.ts +4 -0
- package/dist/plugins/Controls/index.d.ts.map +1 -0
- package/dist/plugins/Controls/types.d.ts +35 -0
- package/dist/plugins/Controls/types.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/store/index.d.ts +12 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/initialState.d.ts +12 -0
- package/dist/store/initialState.d.ts.map +1 -0
- package/dist/styles/utils.d.ts +3 -0
- package/dist/styles/utils.d.ts.map +1 -0
- package/dist/types/edges.d.ts +114 -0
- package/dist/types/edges.d.ts.map +1 -0
- package/dist/types/general.d.ts +123 -0
- package/dist/types/general.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/instance.d.ts +149 -0
- package/dist/types/instance.d.ts.map +1 -0
- package/dist/types/nodes.d.ts +40 -0
- package/dist/types/nodes.d.ts.map +1 -0
- package/dist/types/props.d.ts +151 -0
- package/dist/types/props.d.ts.map +1 -0
- package/dist/types/store.d.ts +105 -0
- package/dist/types/store.d.ts.map +1 -0
- package/dist/types/utils/types.d.ts +8 -0
- package/dist/types/utils/types.d.ts.map +1 -0
- package/dist/utils/changes.d.ts +16 -0
- package/dist/utils/changes.d.ts.map +1 -0
- package/dist/utils/dom.d.ts +20 -0
- package/dist/utils/dom.d.ts.map +1 -0
- package/dist/utils/edges/bezier-edge.d.ts +59 -0
- package/dist/utils/edges/bezier-edge.d.ts.map +1 -0
- package/dist/utils/edges/general.d.ts +46 -0
- package/dist/utils/edges/general.d.ts.map +1 -0
- package/dist/utils/edges/index.d.ts +6 -0
- package/dist/utils/edges/index.d.ts.map +1 -0
- package/dist/utils/edges/positions.d.ts +12 -0
- package/dist/utils/edges/positions.d.ts.map +1 -0
- package/dist/utils/edges/smoothstep-edge.d.ts +43 -0
- package/dist/utils/edges/smoothstep-edge.d.ts.map +1 -0
- package/dist/utils/edges/straight-edge.d.ts +28 -0
- package/dist/utils/edges/straight-edge.d.ts.map +1 -0
- package/dist/utils/general.d.ts +61 -0
- package/dist/utils/general.d.ts.map +1 -0
- package/dist/utils/graph.d.ts +113 -0
- package/dist/utils/graph.d.ts.map +1 -0
- package/dist/utils/marker.d.ts +9 -0
- package/dist/utils/marker.d.ts.map +1 -0
- package/dist/utils/positions.d.ts +12 -0
- package/dist/utils/positions.d.ts.map +1 -0
- package/dist/utils/store.d.ts +30 -0
- package/dist/utils/store.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=function(){return n=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},n.apply(this,arguments)};function t(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,u)}c((r=r.apply(e,n||[])).next())}))}function o(e,n){var t,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=n.call(e,a)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function i(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],r=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function u(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}function c(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var s,l={exports:{}},d={};l.exports=function(){if(s)return d;s=1;var n=e,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(e,n,r){var u,c={},s=null,l=null;for(u in void 0!==r&&(s=""+r),void 0!==n.key&&(s=""+n.key),void 0!==n.ref&&(l=n.ref),n)o.call(n,u)&&!a.hasOwnProperty(u)&&(c[u]=n[u]);if(e&&e.defaultProps)for(u in n=e.defaultProps)void 0===c[u]&&(c[u]=n[u]);return{$$typeof:t,type:e,key:s,ref:l,props:c,_owner:i.current}}return d.Fragment=r,d.jsx=u,d.jsxs=u,d}();var f,h=l.exports,v={exports:{}};
|
|
2
|
+
/*!
|
|
3
|
+
Copyright (c) 2018 Jed Watson.
|
|
4
|
+
Licensed under the MIT License (MIT), see
|
|
5
|
+
http://jedwatson.github.io/classnames
|
|
6
|
+
*/
|
|
7
|
+
f=v,function(){var e={}.hasOwnProperty;function n(){for(var t=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)t.push(o);else if(Array.isArray(o)){if(o.length){var a=n.apply(null,o);a&&t.push(a)}}else if("object"===i)if(o.toString===Object.prototype.toString)for(var u in o)e.call(o,u)&&o[u]&&t.push(u);else t.push(o.toString())}}return t.join(" ")}f.exports?(n.default=n,f.exports=n):window.classNames=n}();var p,g,y,m=c(v.exports),x={exports:{}},w={},b={exports:{}},_={};function E(){return g||(g=1,b.exports=function(){if(p)return _;p=1;var n=e,t="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},r=n.useState,o=n.useEffect,i=n.useLayoutEffect,a=n.useDebugValue;function u(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!t(e,r)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,n){return n()}:function(e,n){var t=n(),c=r({inst:{value:t,getSnapshot:n}}),s=c[0].inst,l=c[1];return i((function(){s.value=t,s.getSnapshot=n,u(s)&&l({inst:s})}),[e,t,n]),o((function(){return u(s)&&l({inst:s}),e((function(){u(s)&&l({inst:s})}))}),[e]),a(t),t};return _.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c,_}()),b.exports}
|
|
8
|
+
/**
|
|
9
|
+
* @license React
|
|
10
|
+
* use-sync-external-store-shim/with-selector.production.min.js
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/x.exports=function(){if(y)return w;y=1;var n=e,t=E(),r="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},o=t.useSyncExternalStore,i=n.useRef,a=n.useEffect,u=n.useMemo,c=n.useDebugValue;return w.useSyncExternalStoreWithSelector=function(e,n,t,s,l){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=u((function(){function e(e){if(!a){if(a=!0,o=e,e=s(e),void 0!==l&&f.hasValue){var n=f.value;if(l(n,e))return i=n}return i=e}if(n=i,r(o,e))return n;var t=s(e);return void 0!==l&&l(n,t)?n:(o=e,i=t)}var o,i,a=!1,u=void 0===t?null:t;return[function(){return e(n())},null===u?void 0:function(){return e(u())}]}),[n,t,s,l]);var h=o(e,d[0],d[1]);return a((function(){f.hasValue=!0,f.value=h}),[h]),c(h),h},w}();var S=c(x.exports);const k=e=>{let n;const t=new Set,r=(e,r)=>{const o="function"==typeof e?e(n):e;if(!Object.is(o,n)){const e=n;n=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},n,o),t.forEach((t=>t(n,e)))}},o=()=>n,i={setState:r,getState:o,getInitialState:()=>a,subscribe:e=>(t.add(e),()=>t.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."),t.clear()}},a=n=e(r,o,i);return i},{useDebugValue:C}=e,{useSyncExternalStoreWithSelector:N}=S,O=e=>e;function P(e,n=O,t){const r=N(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,t);return C(r),r}const M=(e,n)=>{const t=(e=>e?k(e):k)(e),r=(e,r=n)=>P(t,e,r);return Object.assign(r,t),r};var j,I,A,z,T,B,L,D,R,V,H,Y,X,F,Z,U,G,W,q,$,K,Q,J,ee,ne,te,re,oe,ie,ae,ue,ce,se,le,de,fe,he,ve,pe,ge,ye,me,xe,we,be,_e,Ee,Se,ke,Ce,Ne,Oe,Pe,Me,je,Ie,Ae,ze,Te,Be,Le,De,Re,Ve,He,Ye,Xe,Fe,Ze,Ue,Ge,We,qe,$e,Ke,Qe,Je,en,nn,tn,rn,on,an,un,cn,sn,ln,dn,fn,hn,vn,pn,gn,yn,mn,xn,wn,bn,_n,En,Sn,kn,Cn,Nn,On,Pn,Mn,jn,In=e.createContext(null),An=In.Provider,zn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Tn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Bn(){return z?A:(z=1,A=function(e,n){return e===n||e!=e&&n!=n})}function Ln(){if(B)return T;B=1;var e=Bn();return T=function(n,t){for(var r=n.length;r--;)if(e(n[r][0],t))return r;return-1},T}function Dn(){if(U)return Z;U=1;var e=I?j:(I=1,j=function(){this.__data__=[],this.size=0}),n=function(){if(D)return L;D=1;var e=Ln(),n=Array.prototype.splice;return L=function(t){var r=this.__data__,o=e(r,t);return!(o<0||(o==r.length-1?r.pop():n.call(r,o,1),--this.size,0))}}(),t=function(){if(V)return R;V=1;var e=Ln();return R=function(n){var t=this.__data__,r=e(t,n);return r<0?void 0:t[r][1]}}(),r=function(){if(Y)return H;Y=1;var e=Ln();return H=function(n){return e(this.__data__,n)>-1}}(),o=function(){if(F)return X;F=1;var e=Ln();return X=function(n,t){var r=this.__data__,o=e(r,n);return o<0?(++this.size,r.push([n,t])):r[o][1]=t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,Z=i}function Rn(){if(te)return ne;te=1;var e="object"==typeof zn&&zn&&zn.Object===Object&&zn;return ne=e}function Vn(){if(oe)return re;oe=1;var e=Rn(),n="object"==typeof self&&self&&self.Object===Object&&self,t=e||n||Function("return this")();return re=t}function Hn(){if(ae)return ie;ae=1;var e=Vn().Symbol;return ie=e}function Yn(){if(fe)return de;fe=1;var e=Hn(),n=function(){if(ce)return ue;ce=1;var e=Hn(),n=Object.prototype,t=n.hasOwnProperty,r=n.toString,o=e?e.toStringTag:void 0;return ue=function(e){var n=t.call(e,o),i=e[o];try{e[o]=void 0;var a=!0}catch(e){}var u=r.call(e);return a&&(n?e[o]=i:delete e[o]),u}}(),t=function(){if(le)return se;le=1;var e=Object.prototype.toString;return se=function(n){return e.call(n)}}(),r=e?e.toStringTag:void 0;return de=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?n(e):t(e)}}function Xn(){return ve?he:(ve=1,he=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)})}function Fn(){if(ge)return pe;ge=1;var e=Yn(),n=Xn();return pe=function(t){if(!n(t))return!1;var r=e(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function Zn(){if(_e)return be;_e=1;var e=Function.prototype.toString;return be=function(n){if(null!=n){try{return e.call(n)}catch(e){}try{return n+""}catch(e){}}return""}}function Un(){if(Oe)return Ne;Oe=1;var e=function(){if(Se)return Ee;Se=1;var e=Fn(),n=function(){if(we)return xe;we=1;var e,n=function(){if(me)return ye;me=1;var e=Vn()["__core-js_shared__"];return ye=e}(),t=(e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return xe=function(e){return!!t&&t in e}}(),t=Xn(),r=Zn(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,u=i.toString,c=a.hasOwnProperty,s=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Ee=function(i){return!(!t(i)||n(i))&&(e(i)?s:o).test(r(i))}}(),n=Ce?ke:(Ce=1,ke=function(e,n){return null==e?void 0:e[n]});return Ne=function(t,r){var o=n(t,r);return e(o)?o:void 0}}function Gn(){if(Me)return Pe;Me=1;var e=Un()(Vn(),"Map");return Pe=e}function Wn(){if(Ie)return je;Ie=1;var e=Un()(Object,"create");return je=e}function qn(){if($e)return qe;$e=1;var e=We?Ge:(We=1,Ge=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e});return qe=function(n,t){var r=n.__data__;return e(t)?r["string"==typeof t?"string":"hash"]:r.map},qe}function $n(){if(un)return an;un=1;var e=function(){if(Ue)return Ze;Ue=1;var e=function(){if(Fe)return Xe;Fe=1;var e=function(){if(ze)return Ae;ze=1;var e=Wn();return Ae=function(){this.__data__=e?e(null):{},this.size=0}}(),n=Be?Te:(Be=1,Te=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}),t=function(){if(De)return Le;De=1;var e=Wn(),n=Object.prototype.hasOwnProperty;return Le=function(t){var r=this.__data__;if(e){var o=r[t];return"__lodash_hash_undefined__"===o?void 0:o}return n.call(r,t)?r[t]:void 0}}(),r=function(){if(Ve)return Re;Ve=1;var e=Wn(),n=Object.prototype.hasOwnProperty;return Re=function(t){var r=this.__data__;return e?void 0!==r[t]:n.call(r,t)}}(),o=function(){if(Ye)return He;Ye=1;var e=Wn();return He=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=e&&void 0===t?"__lodash_hash_undefined__":t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,Xe=i}(),n=Dn(),t=Gn();return Ze=function(){this.size=0,this.__data__={hash:new e,map:new(t||n),string:new e}}}(),n=function(){if(Qe)return Ke;Qe=1;var e=qn();return Ke=function(n){var t=e(this,n).delete(n);return this.size-=t?1:0,t}}(),t=function(){if(en)return Je;en=1;var e=qn();return Je=function(n){return e(this,n).get(n)}}(),r=function(){if(tn)return nn;tn=1;var e=qn();return nn=function(n){return e(this,n).has(n)}}(),o=function(){if(on)return rn;on=1;var e=qn();return rn=function(n,t){var r=e(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this},rn}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,an=i}function Kn(){if(dn)return ln;dn=1;var e=Dn(),n=function(){if(W)return G;W=1;var e=Dn();return G=function(){this.__data__=new e,this.size=0}}(),t=$?q:($=1,q=function(e){var n=this.__data__,t=n.delete(e);return this.size=n.size,t}),r=Q?K:(Q=1,K=function(e){return this.__data__.get(e)}),o=ee?J:(ee=1,J=function(e){return this.__data__.has(e)}),i=function(){if(sn)return cn;sn=1;var e=Dn(),n=Gn(),t=$n();return cn=function(r,o){var i=this.__data__;if(i instanceof e){var a=i.__data__;if(!n||a.length<199)return a.push([r,o]),this.size=++i.size,this;i=this.__data__=new t(a)}return i.set(r,o),this.size=i.size,this}}();function a(n){var t=this.__data__=new e(n);this.size=t.size}return a.prototype.clear=n,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=o,a.prototype.set=i,ln=a}function Qn(){return hn||(hn=1,fn=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r&&!1!==n(e[t],t,e););return e}),fn}function Jn(){if(pn)return vn;pn=1;var e=Un(),n=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch(e){}}();return vn=n}function et(){if(yn)return gn;yn=1;var e=Jn();return gn=function(n,t,r){"__proto__"==t&&e?e(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}}function nt(){if(xn)return mn;xn=1;var e=et(),n=Bn(),t=Object.prototype.hasOwnProperty;return mn=function(r,o,i){var a=r[o];t.call(r,o)&&n(a,i)&&(void 0!==i||o in r)||e(r,o,i)}}function tt(){if(bn)return wn;bn=1;var e=nt(),n=et();return wn=function(t,r,o,i){var a=!o;o||(o={});for(var u=-1,c=r.length;++u<c;){var s=r[u],l=i?i(o[s],t[s],s,o,t):void 0;void 0===l&&(l=t[s]),a?n(o,s,l):e(o,s,l)}return o}}function rt(){return kn?Sn:(kn=1,Sn=function(e){return null!=e&&"object"==typeof e})}function ot(){if(Pn)return On;Pn=1;var e=function(){if(Nn)return Cn;Nn=1;var e=Yn(),n=rt();return Cn=function(t){return n(t)&&"[object Arguments]"==e(t)}}(),n=rt(),t=Object.prototype,r=t.hasOwnProperty,o=t.propertyIsEnumerable,i=e(function(){return arguments}())?e:function(e){return n(e)&&r.call(e,"callee")&&!o.call(e,"callee")};return On=i}function it(){if(jn)return Mn;jn=1;var e=Array.isArray;return Mn=e}var at,ut,ct,st,lt,dt,ft,ht,vt,pt,gt,yt={exports:{}};function mt(){return ct||(ct=1,function(e,n){var t=Vn(),r=ut?at:(ut=1,at=function(){return!1}),o=n&&!n.nodeType&&n,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o?t.Buffer:void 0,u=(a?a.isBuffer:void 0)||r;e.exports=u}(yt,yt.exports)),yt.exports}function xt(){if(lt)return st;lt=1;var e=/^(?:0|[1-9]\d*)$/;return st=function(n,t){var r=typeof n;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&e.test(n))&&n>-1&&n%1==0&&n<t}}function wt(){return ft?dt:(ft=1,dt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991})}function bt(){return gt?pt:(gt=1,pt=function(e){return function(n){return e(n)}})}yt.exports;var _t,Et,St,kt,Ct,Nt,Ot,Pt,Mt,jt,It,At,zt,Tt,Bt,Lt,Dt,Rt,Vt,Ht,Yt,Xt,Ft,Zt,Ut,Gt,Wt,qt={exports:{}};function $t(){return _t||(_t=1,e=qt,n=qt.exports,t=Rn(),r=n&&!n.nodeType&&n,o=r&&e&&!e.nodeType&&e,i=o&&o.exports===r&&t.process,a=function(){try{return o&&o.require&&o.require("util").types||i&&i.binding&&i.binding("util")}catch(e){}}(),e.exports=a),qt.exports;var e,n,t,r,o,i,a}function Kt(){if(St)return Et;St=1;var e=function(){if(vt)return ht;vt=1;var e=Yn(),n=wt(),t=rt(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,ht=function(o){return t(o)&&n(o.length)&&!!r[e(o)]}}(),n=bt(),t=$t(),r=t&&t.isTypedArray,o=r?n(r):e;return Et=o}function Qt(){if(Ct)return kt;Ct=1;var e=En?_n:(En=1,_n=function(e,n){for(var t=-1,r=Array(e);++t<e;)r[t]=n(t);return r}),n=ot(),t=it(),r=mt(),o=xt(),i=Kt(),a=Object.prototype.hasOwnProperty;return kt=function(u,c){var s=t(u),l=!s&&n(u),d=!s&&!l&&r(u),f=!s&&!l&&!d&&i(u),h=s||l||d||f,v=h?e(u.length,String):[],p=v.length;for(var g in u)!c&&!a.call(u,g)||h&&("length"==g||d&&("offset"==g||"parent"==g)||f&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||o(g,p))||v.push(g);return v},kt}function Jt(){if(Ot)return Nt;Ot=1;var e=Object.prototype;return Nt=function(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||e)}}function er(){return Mt||(Mt=1,Pt=function(e,n){return function(t){return e(n(t))}}),Pt}function nr(){if(zt)return At;zt=1;var e=Jt(),n=function(){if(It)return jt;It=1;var e=er()(Object.keys,Object);return jt=e}(),t=Object.prototype.hasOwnProperty;return At=function(r){if(!e(r))return n(r);var o=[];for(var i in Object(r))t.call(r,i)&&"constructor"!=i&&o.push(i);return o}}function tr(){if(Bt)return Tt;Bt=1;var e=Fn(),n=wt();return Tt=function(t){return null!=t&&n(t.length)&&!e(t)}}function rr(){if(Dt)return Lt;Dt=1;var e=Qt(),n=nr(),t=tr();return Lt=function(r){return t(r)?e(r):n(r)}}function or(){if(Ut)return Zt;Ut=1;var e=Qt(),n=function(){if(Ft)return Xt;Ft=1;var e=Xn(),n=Jt(),t=Yt?Ht:(Yt=1,Ht=function(e){var n=[];if(null!=e)for(var t in Object(e))n.push(t);return n}),r=Object.prototype.hasOwnProperty;return Xt=function(o){if(!e(o))return t(o);var i=n(o),a=[];for(var u in o)("constructor"!=u||!i&&r.call(o,u))&&a.push(u);return a}}(),t=tr();return Zt=function(r){return t(r)?e(r,!0):n(r)}}qt.exports;var ir,ar,ur,cr,sr,lr,dr,fr,hr,vr,pr,gr,yr,mr,xr,wr,br,_r,Er,Sr,kr,Cr,Nr,Or,Pr,Mr,jr,Ir,Ar,zr,Tr,Br,Lr,Dr,Rr,Vr,Hr,Yr,Xr,Fr,Zr,Ur,Gr,Wr,qr,$r,Kr,Qr,Jr,eo,no,to,ro,oo,io,ao,uo,co,so,lo,fo,ho,vo,po,go,yo,mo,xo,wo,bo,_o,Eo,So,ko,Co,No,Oo,Po,Mo,jo,Io,Ao,zo,To,Bo,Lo,Do,Ro,Vo,Ho,Yo,Xo,Fo,Zo,Uo,Go,Wo,qo,$o,Ko,Qo,Jo,ei,ni,ti,ri,oi,ii,ai,ui,ci,si,li,di,fi,hi,vi,pi,gi,yi,mi,xi,wi,bi,_i,Ei,Si,ki,Ci,Ni,Oi,Pi,Mi,ji,Ii,Ai,zi,Ti,Bi,Li,Di,Ri,Vi,Hi,Yi,Xi,Fi,Zi,Ui,Gi,Wi,qi,$i,Ki,Qi,Ji,ea,na,ta,ra,oa,ia,aa,ua,ca,sa,la,da,fa,ha,va,pa,ga,ya,ma,xa,wa,ba,_a,Ea,Sa,ka,Ca,Na,Oa,Pa,Ma,ja,Ia,Aa,za,Ta,Ba,La,Da,Ra,Va,Ha,Ya,Xa,Fa,Za,Ua,Ga,Wa,qa,$a,Ka,Qa,Ja,eu,nu,tu,ru,ou,iu,au,uu,cu,su,lu,du,fu,hu,vu,pu,gu,yu,mu,xu,wu,bu,_u,Eu,Su,ku,Cu,Nu,Ou,Pu,Mu,ju,Iu,Au,zu,Tu,Bu,Lu,Du,Ru,Vu,Hu,Yu,Xu,Fu,Zu,Uu,Gu,Wu,qu,$u,Ku,Qu,Ju,ec,nc,tc,rc,oc,ic,ac,uc,cc,sc,lc,dc,fc,hc,vc,pc,gc={exports:{}};function yc(){return ir||(ir=1,function(e,n){var t=Vn(),r=n&&!n.nodeType&&n,o=r&&e&&!e.nodeType&&e,i=o&&o.exports===r?t.Buffer:void 0,a=i?i.allocUnsafe:void 0;e.exports=function(e,n){if(n)return e.slice();var t=e.length,r=a?a(t):new e.constructor(t);return e.copy(r),r}}(gc,gc.exports)),gc.exports}function mc(){return ur||(ur=1,ar=function(e,n){var t=-1,r=e.length;for(n||(n=Array(r));++t<r;)n[t]=e[t];return n}),ar}function xc(){return sr||(sr=1,cr=function(e,n){for(var t=-1,r=null==e?0:e.length,o=0,i=[];++t<r;){var a=e[t];n(a,t,e)&&(i[o++]=a)}return i}),cr}function wc(){return dr?lr:(dr=1,lr=function(){return[]})}function bc(){if(hr)return fr;hr=1;var e=xc(),n=wc(),t=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return fr=r?function(n){return null==n?[]:(n=Object(n),e(r(n),(function(e){return t.call(n,e)})))}:n}function _c(){return yr||(yr=1,gr=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e}),gr}function Ec(){if(xr)return mr;xr=1;var e=er()(Object.getPrototypeOf,Object);return mr=e}function Sc(){if(br)return wr;br=1;var e=_c(),n=Ec(),t=bc(),r=wc(),o=Object.getOwnPropertySymbols;return wr=o?function(r){for(var o=[];r;)e(o,t(r)),r=n(r);return o}:r}function kc(){if(kr)return Sr;kr=1;var e=_c(),n=it();return Sr=function(t,r,o){var i=r(t);return n(t)?i:e(i,o(t))}}function Cc(){if(Nr)return Cr;Nr=1;var e=kc(),n=bc(),t=rr();return Cr=function(r){return e(r,t,n)}}function Nc(){if(Tr)return zr;Tr=1;var e=Un()(Vn(),"Set");return zr=e}function Oc(){if(Rr)return Dr;Rr=1;var e=function(){if(jr)return Mr;jr=1;var e=Un()(Vn(),"DataView");return Mr=e}(),n=Gn(),t=function(){if(Ar)return Ir;Ar=1;var e=Un()(Vn(),"Promise");return Ir=e}(),r=Nc(),o=function(){if(Lr)return Br;Lr=1;var e=Un()(Vn(),"WeakMap");return Br=e}(),i=Yn(),a=Zn(),u="[object Map]",c="[object Promise]",s="[object Set]",l="[object WeakMap]",d="[object DataView]",f=a(e),h=a(n),v=a(t),p=a(r),g=a(o),y=i;return(e&&y(new e(new ArrayBuffer(1)))!=d||n&&y(new n)!=u||t&&y(t.resolve())!=c||r&&y(new r)!=s||o&&y(new o)!=l)&&(y=function(e){var n=i(e),t="[object Object]"==n?e.constructor:void 0,r=t?a(t):"";if(r)switch(r){case f:return d;case h:return u;case v:return c;case p:return s;case g:return l}return n}),Dr=y}function Pc(){if(Xr)return Yr;Xr=1;var e=Vn().Uint8Array;return Yr=e}function Mc(){if(Zr)return Fr;Zr=1;var e=Pc();return Fr=function(n){var t=new n.constructor(n.byteLength);return new e(t).set(new e(n)),t}}function jc(){if(Jr)return Qr;Jr=1;var e=Mc();return Qr=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}}function Ic(){if(ro)return to;ro=1;var e=Xn(),n=Object.create,t=function(){function t(){}return function(r){if(!e(r))return{};if(n)return n(r);t.prototype=r;var o=new t;return t.prototype=void 0,o}}();return to=t}function Ac(){if(io)return oo;io=1;var e=Ic(),n=Ec(),t=Jt();return oo=function(r){return"function"!=typeof r.constructor||t(r)?{}:e(n(r))}}function zc(){if(go)return po;go=1;var e=Kn(),n=Qn(),t=nt(),r=function(){if(Vt)return Rt;Vt=1;var e=tt(),n=rr();return Rt=function(t,r){return t&&e(r,n(r),t)}}(),o=function(){if(Wt)return Gt;Wt=1;var e=tt(),n=or();return Gt=function(t,r){return t&&e(r,n(r),t)}}(),i=yc(),a=mc(),u=function(){if(pr)return vr;pr=1;var e=tt(),n=bc();return vr=function(t,r){return e(t,n(t),r)}}(),c=function(){if(Er)return _r;Er=1;var e=tt(),n=Sc();return _r=function(t,r){return e(t,n(t),r)}}(),s=Cc(),l=function(){if(Pr)return Or;Pr=1;var e=kc(),n=Sc(),t=or();return Or=function(r){return e(r,t,n)}}(),d=Oc(),f=function(){if(Hr)return Vr;Hr=1;var e=Object.prototype.hasOwnProperty;return Vr=function(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&e.call(n,"index")&&(r.index=n.index,r.input=n.input),r},Vr}(),h=function(){if(no)return eo;no=1;var e=Mc(),n=function(){if(Gr)return Ur;Gr=1;var e=Mc();return Ur=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}}(),t=function(){if(qr)return Wr;qr=1;var e=/\w*$/;return Wr=function(n){var t=new n.constructor(n.source,e.exec(n));return t.lastIndex=n.lastIndex,t}}(),r=function(){if(Kr)return $r;Kr=1;var e=Hn(),n=e?e.prototype:void 0,t=n?n.valueOf:void 0;return $r=function(e){return t?Object(t.call(e)):{}}}(),o=jc();return eo=function(i,a,u){var c=i.constructor;switch(a){case"[object ArrayBuffer]":return e(i);case"[object Boolean]":case"[object Date]":return new c(+i);case"[object DataView]":return n(i,u);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return o(i,u);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(i);case"[object RegExp]":return t(i);case"[object Symbol]":return r(i)}}}(),v=Ac(),p=it(),g=mt(),y=function(){if(so)return co;so=1;var e=function(){if(uo)return ao;uo=1;var e=Oc(),n=rt();return ao=function(t){return n(t)&&"[object Map]"==e(t)}}(),n=bt(),t=$t(),r=t&&t.isMap,o=r?n(r):e;return co=o}(),m=Xn(),x=function(){if(vo)return ho;vo=1;var e=function(){if(fo)return lo;fo=1;var e=Oc(),n=rt();return lo=function(t){return n(t)&&"[object Set]"==e(t)}}(),n=bt(),t=$t(),r=t&&t.isSet,o=r?n(r):e;return ho=o}(),w=rr(),b=or(),_="[object Arguments]",E="[object Function]",S="[object Object]",k={};return k[_]=k["[object Array]"]=k["[object ArrayBuffer]"]=k["[object DataView]"]=k["[object Boolean]"]=k["[object Date]"]=k["[object Float32Array]"]=k["[object Float64Array]"]=k["[object Int8Array]"]=k["[object Int16Array]"]=k["[object Int32Array]"]=k["[object Map]"]=k["[object Number]"]=k[S]=k["[object RegExp]"]=k["[object Set]"]=k["[object String]"]=k["[object Symbol]"]=k["[object Uint8Array]"]=k["[object Uint8ClampedArray]"]=k["[object Uint16Array]"]=k["[object Uint32Array]"]=!0,k["[object Error]"]=k[E]=k["[object WeakMap]"]=!1,po=function C(N,O,P,M,j,I){var A,z=1&O,T=2&O,B=4&O;if(P&&(A=j?P(N,M,j,I):P(N)),void 0!==A)return A;if(!m(N))return N;var L=p(N);if(L){if(A=f(N),!z)return a(N,A)}else{var D=d(N),R=D==E||"[object GeneratorFunction]"==D;if(g(N))return i(N,z);if(D==S||D==_||R&&!j){if(A=T||R?{}:v(N),!z)return T?c(N,o(A,N)):u(N,r(A,N))}else{if(!k[D])return j?N:{};A=h(N,D,z)}}I||(I=new e);var V=I.get(N);if(V)return V;I.set(N,A),x(N)?N.forEach((function(e){A.add(C(e,O,P,e,N,I))})):y(N)&&N.forEach((function(e,n){A.set(n,C(e,O,P,n,N,I))}));var H=L?void 0:(B?T?l:s:T?b:w)(N);return n(H||N,(function(e,n){H&&(e=N[n=e]),t(A,n,C(e,O,P,n,N,I))})),A},po}function Tc(){if(mo)return yo;mo=1;var e=zc();return yo=function(n){return e(n,4)}}function Bc(){return wo?xo:(wo=1,xo=function(e){return function(){return e}})}function Lc(){if(So)return Eo;So=1;var e=(_o?bo:(_o=1,bo=function(e){return function(n,t,r){for(var o=-1,i=Object(n),a=r(n),u=a.length;u--;){var c=a[e?u:++o];if(!1===t(i[c],c,i))break}return n}}))();return Eo=e}function Dc(){if(Co)return ko;Co=1;var e=Lc(),n=rr();return ko=function(t,r){return t&&e(t,r,n)}}function Rc(){if(Mo)return Po;Mo=1;var e=Dc(),n=function(){if(Oo)return No;Oo=1;var e=tr();return No=function(n,t){return function(r,o){if(null==r)return r;if(!e(r))return n(r,o);for(var i=r.length,a=t?i:-1,u=Object(r);(t?a--:++a<i)&&!1!==o(u[a],a,u););return r}}}(),t=n(e);return Po=t}function Vc(){return Io?jo:(Io=1,jo=function(e){return e})}function Hc(){if(zo)return Ao;zo=1;var e=Vc();return Ao=function(n){return"function"==typeof n?n:e}}function Yc(){if(Bo)return To;Bo=1;var e=Qn(),n=Rc(),t=Hc(),r=it();return To=function(o,i){return(r(o)?e:n)(o,t(i))}}function Xc(){return Do?Lo:(Do=1,Lo=Yc())}function Fc(){if(Uo)return Zo;Uo=1;var e=$n(),n=Yo?Ho:(Yo=1,Ho=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),t=Fo?Xo:(Fo=1,Xo=function(e){return this.__data__.has(e)});function r(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new e;++t<r;)this.add(n[t])}return r.prototype.add=r.prototype.push=n,r.prototype.has=t,Zo=r}function Zc(){return $o?qo:($o=1,qo=function(e,n){return e.has(n)})}function Uc(){if(Qo)return Ko;Qo=1;var e=Fc(),n=(Wo||(Wo=1,Go=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r;)if(n(e[t],t,e))return!0;return!1}),Go),t=Zc();return Ko=function(r,o,i,a,u,c){var s=1&i,l=r.length,d=o.length;if(l!=d&&!(s&&d>l))return!1;var f=c.get(r),h=c.get(o);if(f&&h)return f==o&&h==r;var v=-1,p=!0,g=2&i?new e:void 0;for(c.set(r,o),c.set(o,r);++v<l;){var y=r[v],m=o[v];if(a)var x=s?a(m,y,v,o,r,c):a(y,m,v,r,o,c);if(void 0!==x){if(x)continue;p=!1;break}if(g){if(!n(o,(function(e,n){if(!t(g,n)&&(y===e||u(y,e,i,a,c)))return g.push(n)}))){p=!1;break}}else if(y!==m&&!u(y,m,i,a,c)){p=!1;break}}return c.delete(r),c.delete(o),p},Ko}function Gc(){return ti||(ti=1,ni=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e){t[++n]=e})),t}),ni}function Wc(){if(ci)return ui;ci=1;var e=Kn(),n=Uc(),t=function(){if(oi)return ri;oi=1;var e=Hn(),n=Pc(),t=Bn(),r=Uc(),o=(ei||(ei=1,Jo=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e,r){t[++n]=[r,e]})),t}),Jo),i=Gc(),a=e?e.prototype:void 0,u=a?a.valueOf:void 0;return ri=function(e,a,c,s,l,d,f){switch(c){case"[object DataView]":if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=a.byteLength||!d(new n(e),new n(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return t(+e,+a);case"[object Error]":return e.name==a.name&&e.message==a.message;case"[object RegExp]":case"[object String]":return e==a+"";case"[object Map]":var h=o;case"[object Set]":var v=1&s;if(h||(h=i),e.size!=a.size&&!v)return!1;var p=f.get(e);if(p)return p==a;s|=2,f.set(e,a);var g=r(h(e),h(a),s,l,d,f);return f.delete(e),g;case"[object Symbol]":if(u)return u.call(e)==u.call(a)}return!1}}(),r=function(){if(ai)return ii;ai=1;var e=Cc(),n=Object.prototype.hasOwnProperty;return ii=function(t,r,o,i,a,u){var c=1&o,s=e(t),l=s.length;if(l!=e(r).length&&!c)return!1;for(var d=l;d--;){var f=s[d];if(!(c?f in r:n.call(r,f)))return!1}var h=u.get(t),v=u.get(r);if(h&&v)return h==r&&v==t;var p=!0;u.set(t,r),u.set(r,t);for(var g=c;++d<l;){var y=t[f=s[d]],m=r[f];if(i)var x=c?i(m,y,f,r,t,u):i(y,m,f,t,r,u);if(!(void 0===x?y===m||a(y,m,o,i,u):x)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var w=t.constructor,b=r.constructor;w==b||!("constructor"in t)||!("constructor"in r)||"function"==typeof w&&w instanceof w&&"function"==typeof b&&b instanceof b||(p=!1)}return u.delete(t),u.delete(r),p}}(),o=Oc(),i=it(),a=mt(),u=Kt(),c="[object Arguments]",s="[object Array]",l="[object Object]",d=Object.prototype.hasOwnProperty;return ui=function(f,h,v,p,g,y){var m=i(f),x=i(h),w=m?s:o(f),b=x?s:o(h),_=(w=w==c?l:w)==l,E=(b=b==c?l:b)==l,S=w==b;if(S&&a(f)){if(!a(h))return!1;m=!0,_=!1}if(S&&!_)return y||(y=new e),m||u(f)?n(f,h,v,p,g,y):t(f,h,w,v,p,g,y);if(!(1&v)){var k=_&&d.call(f,"__wrapped__"),C=E&&d.call(h,"__wrapped__");if(k||C){var N=k?f.value():f,O=C?h.value():h;return y||(y=new e),g(N,O,v,p,y)}}return!!S&&(y||(y=new e),r(f,h,v,p,g,y))}}function qc(){if(li)return si;li=1;var e=Wc(),n=rt();return si=function t(r,o,i,a,u){return r===o||(null==r||null==o||!n(r)&&!n(o)?r!=r&&o!=o:e(r,o,i,a,t,u))},si}function $c(){if(vi)return hi;vi=1;var e=Xn();return hi=function(n){return n==n&&!e(n)}}function Kc(){return mi?yi:(mi=1,yi=function(e,n){return function(t){return null!=t&&t[e]===n&&(void 0!==n||e in Object(t))}})}function Qc(){if(_i)return bi;_i=1;var e=Yn(),n=rt();return bi=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==e(t)}}function Jc(){if(Si)return Ei;Si=1;var e=it(),n=Qc(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return Ei=function(o,i){if(e(o))return!1;var a=typeof o;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=o&&!n(o))||r.test(o)||!t.test(o)||null!=i&&o in Object(i)}}function es(){return Ii||(Ii=1,ji=function(e,n){for(var t=-1,r=null==e?0:e.length,o=Array(r);++t<r;)o[t]=n(e[t],t,e);return o}),ji}function ns(){if(Bi)return Ti;Bi=1;var e=function(){if(zi)return Ai;zi=1;var e=Hn(),n=es(),t=it(),r=Qc(),o=e?e.prototype:void 0,i=o?o.toString:void 0;return Ai=function e(o){if("string"==typeof o)return o;if(t(o))return n(o,e)+"";if(r(o))return i?i.call(o):"";var a=o+"";return"0"==a&&1/o==-1/0?"-0":a},Ai}();return Ti=function(n){return null==n?"":e(n)}}function ts(){if(Di)return Li;Di=1;var e=it(),n=Jc(),t=function(){if(Mi)return Pi;Mi=1;var e=function(){if(Oi)return Ni;Oi=1;var e=function(){if(Ci)return ki;Ci=1;var e=$n();function n(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var o=function(){var e=arguments,n=r?r.apply(this,e):e[0],i=o.cache;if(i.has(n))return i.get(n);var a=t.apply(this,e);return o.cache=i.set(n,a)||i,a};return o.cache=new(n.Cache||e),o}return n.Cache=e,ki=n}();return Ni=function(n){var t=e(n,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}}(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,r=e((function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(n,(function(e,n,o,i){r.push(o?i.replace(t,"$1"):n||e)})),r}));return Pi=r}(),r=ns();return Li=function(o,i){return e(o)?o:n(o,i)?[o]:t(r(o))}}function rs(){if(Vi)return Ri;Vi=1;var e=Qc();return Ri=function(n){if("string"==typeof n||e(n))return n;var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}}function os(){if(Yi)return Hi;Yi=1;var e=ts(),n=rs();return Hi=function(t,r){for(var o=0,i=(r=e(r,t)).length;null!=t&&o<i;)t=t[n(r[o++])];return o&&o==i?t:void 0}}function is(){if(Wi)return Gi;Wi=1;var e=ts(),n=ot(),t=it(),r=xt(),o=wt(),i=rs();return Gi=function(a,u,c){for(var s=-1,l=(u=e(u,a)).length,d=!1;++s<l;){var f=i(u[s]);if(!(d=null!=a&&c(a,f)))break;a=a[f]}return d||++s!=l?d:!!(l=null==a?0:a.length)&&o(l)&&r(f,l)&&(t(a)||n(a))}}function as(){if($i)return qi;$i=1;var e=Ui?Zi:(Ui=1,Zi=function(e,n){return null!=e&&n in Object(e)}),n=is();return qi=function(t,r){return null!=t&&n(t,r,e)}}function us(){return ea?Ji:(ea=1,Ji=function(e){return function(n){return null==n?void 0:n[e]}})}function cs(){if(aa)return ia;aa=1;var e=function(){if(wi)return xi;wi=1;var e=function(){if(fi)return di;fi=1;var e=Kn(),n=qc();return di=function(t,r,o,i){var a=o.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var s=o[a];if(c&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++a<u;){var l=(s=o[a])[0],d=t[l],f=s[1];if(c&&s[2]){if(void 0===d&&!(l in t))return!1}else{var h=new e;if(i)var v=i(d,f,l,t,r,h);if(!(void 0===v?n(f,d,3,i,h):v))return!1}}return!0}}(),n=function(){if(gi)return pi;gi=1;var e=$c(),n=rr();return pi=function(t){for(var r=n(t),o=r.length;o--;){var i=r[o],a=t[i];r[o]=[i,a,e(a)]}return r}}(),t=Kc();return xi=function(r){var o=n(r);return 1==o.length&&o[0][2]?t(o[0][0],o[0][1]):function(n){return n===r||e(n,r,o)}}}(),n=function(){if(Qi)return Ki;Qi=1;var e=qc(),n=function(){if(Fi)return Xi;Fi=1;var e=os();return Xi=function(n,t,r){var o=null==n?void 0:e(n,t);return void 0===o?r:o}}(),t=as(),r=Jc(),o=$c(),i=Kc(),a=rs();return Ki=function(u,c){return r(u)&&o(c)?i(a(u),c):function(r){var o=n(r,u);return void 0===o&&o===c?t(r,u):e(c,o,3)}}}(),t=Vc(),r=it(),o=function(){if(oa)return ra;oa=1;var e=us(),n=function(){if(ta)return na;ta=1;var e=os();return na=function(n){return function(t){return e(t,n)}}}(),t=Jc(),r=rs();return ra=function(o){return t(o)?e(r(o)):n(o)}}();return ia=function(i){return"function"==typeof i?i:null==i?t:"object"==typeof i?r(i)?n(i[0],i[1]):e(i):o(i)}}function ss(){if(ca)return ua;ca=1;var e=xc(),n=function(){if(Vo)return Ro;Vo=1;var e=Rc();return Ro=function(n,t){var r=[];return e(n,(function(e,n,o){t(e,n,o)&&r.push(e)})),r}}(),t=cs(),r=it();return ua=function(o,i){return(r(o)?e:n)(o,t(i,3))}}function ls(){if(fa)return da;fa=1;var e=function(){if(la)return sa;la=1;var e=Object.prototype.hasOwnProperty;return sa=function(n,t){return null!=n&&e.call(n,t)}}(),n=is();return da=function(t,r){return null!=t&&n(t,r,e)}}function ds(){if(va)return ha;va=1;var e=nr(),n=Oc(),t=ot(),r=it(),o=tr(),i=mt(),a=Jt(),u=Kt(),c=Object.prototype.hasOwnProperty;return ha=function(s){if(null==s)return!0;if(o(s)&&(r(s)||"string"==typeof s||"function"==typeof s.splice||i(s)||u(s)||t(s)))return!s.length;var l=n(s);if("[object Map]"==l||"[object Set]"==l)return!s.size;if(a(s))return!e(s).length;for(var d in s)if(c.call(s,d))return!1;return!0}}function fs(){return ga?pa:(ga=1,pa=function(e){return void 0===e})}function hs(){if(ma)return ya;ma=1;var e=Rc(),n=tr();return ya=function(t,r){var o=-1,i=n(t)?Array(t.length):[];return e(t,(function(e,n,t){i[++o]=r(e,n,t)})),i}}function vs(){if(wa)return xa;wa=1;var e=es(),n=cs(),t=hs(),r=it();return xa=function(o,i){return(r(o)?e:t)(o,n(i,3))}}function ps(){if(Ca)return ka;Ca=1;var e=(_a||(_a=1,ba=function(e,n,t,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(t=e[++o]);++o<i;)t=n(t,e[o],o,e);return t}),ba),n=Rc(),t=cs(),r=Sa?Ea:(Sa=1,Ea=function(e,n,t,r,o){return o(e,(function(e,o,i){t=r?(r=!1,e):n(t,e,o,i)})),t}),o=it();return ka=function(i,a,u){var c=o(i)?e:r,s=arguments.length<3;return c(i,t(a,4),u,s,n)},ka}function gs(){if(Da)return La;Da=1;var e=nr(),n=Oc(),t=tr(),r=function(){if(Oa)return Na;Oa=1;var e=Yn(),n=it(),t=rt();return Na=function(r){return"string"==typeof r||!n(r)&&t(r)&&"[object String]"==e(r)}}(),o=function(){if(Ba)return Ta;Ba=1;var e=function(){if(Ma)return Pa;Ma=1;var e=us()("length");return Pa=e}(),n=function(){if(Ia)return ja;Ia=1;var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return ja=function(n){return e.test(n)}}(),t=function(){if(za)return Aa;za=1;var e="\\ud800-\\udfff",n="["+e+"]",t="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",o="[^"+e+"]",i="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+t+"|"+r+")?",c="[\\ufe0e\\ufe0f]?",s=c+u+"(?:\\u200d(?:"+[o,i,a].join("|")+")"+c+u+")*",l="(?:"+[o+t+"?",t,i,a,n].join("|")+")",d=RegExp(r+"(?="+r+")|"+l+s,"g");return Aa=function(e){for(var n=d.lastIndex=0;d.test(e);)++n;return n}}();return Ta=function(r){return n(r)?t(r):e(r)}}();return La=function(i){if(null==i)return 0;if(t(i))return r(i)?o(i):i.length;var a=n(i);return"[object Map]"==a||"[object Set]"==a?i.size:e(i).length}}function ys(){if(Va)return Ra;Va=1;var e=Qn(),n=Ic(),t=Dc(),r=cs(),o=Ec(),i=it(),a=mt(),u=Fn(),c=Xn(),s=Kt();return Ra=function(l,d,f){var h=i(l),v=h||a(l)||s(l);if(d=r(d,4),null==f){var p=l&&l.constructor;f=v?h?new p:[]:c(l)&&u(p)?n(o(l)):{}}return(v?e:t)(l,(function(e,n,t){return d(f,e,n,t)})),f}}function ms(){if(Fa)return Xa;Fa=1;var e=_c(),n=function(){if(Ya)return Ha;Ya=1;var e=Hn(),n=ot(),t=it(),r=e?e.isConcatSpreadable:void 0;return Ha=function(e){return t(e)||n(e)||!!(r&&e&&e[r])}}();return Xa=function t(r,o,i,a,u){var c=-1,s=r.length;for(i||(i=n),u||(u=[]);++c<s;){var l=r[c];o>0&&i(l)?o>1?t(l,o-1,i,a,u):e(u,l):a||(u[u.length]=l)}return u},Xa}function xs(){if(Wa)return Ga;Wa=1;var e=Ua?Za:(Ua=1,Za=function(e,n,t){switch(t.length){case 0:return e.call(n);case 1:return e.call(n,t[0]);case 2:return e.call(n,t[0],t[1]);case 3:return e.call(n,t[0],t[1],t[2])}return e.apply(n,t)}),n=Math.max;return Ga=function(t,r,o){return r=n(void 0===r?t.length-1:r,0),function(){for(var i=arguments,a=-1,u=n(i.length-r,0),c=Array(u);++a<u;)c[a]=i[r+a];a=-1;for(var s=Array(r+1);++a<r;)s[a]=i[a];return s[r]=o(c),e(t,this,s)}},Ga}function ws(){if(eu)return Ja;eu=1;var e=function(){if($a)return qa;$a=1;var e=Bc(),n=Jn(),t=Vc();return qa=n?function(t,r){return n(t,"toString",{configurable:!0,enumerable:!1,value:e(r),writable:!0})}:t}(),n=function(){if(Qa)return Ka;Qa=1;var e=Date.now;return Ka=function(n){var t=0,r=0;return function(){var o=e(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return n.apply(void 0,arguments)}},Ka}(),t=n(e);return Ja=t}function bs(){if(tu)return nu;tu=1;var e=Vc(),n=xs(),t=ws();return nu=function(r,o){return t(n(r,o,e),r+"")},nu}function _s(){return ou||(ou=1,ru=function(e,n,t,r){for(var o=e.length,i=t+(r?1:-1);r?i--:++i<o;)if(n(e[i],i,e))return i;return-1}),ru}function Es(){if(wu)return xu;wu=1;var e=Fc(),n=function(){if(fu)return du;fu=1;var e=function(){if(lu)return su;lu=1;var e=_s(),n=au?iu:(au=1,iu=function(e){return e!=e}),t=(cu||(cu=1,uu=function(e,n,t){for(var r=t-1,o=e.length;++r<o;)if(e[r]===n)return r;return-1}),uu);return su=function(r,o,i){return o==o?t(r,o,i):e(r,n,i)},su}();return du=function(n,t){return!(null==n||!n.length)&&e(n,t,0)>-1},du}(),t=(vu||(vu=1,hu=function(e,n,t){for(var r=-1,o=null==e?0:e.length;++r<o;)if(t(n,e[r]))return!0;return!1}),hu),r=Zc(),o=function(){if(mu)return yu;mu=1;var e=Nc(),n=gu?pu:(gu=1,pu=function(){}),t=Gc(),r=e&&1/t(new e([,-0]))[1]==1/0?function(n){return new e(n)}:n;return yu=r}(),i=Gc();return xu=function(a,u,c){var s=-1,l=n,d=a.length,f=!0,h=[],v=h;if(c)f=!1,l=t;else if(d>=200){var p=u?null:o(a);if(p)return i(p);f=!1,l=r,v=new e}else v=u?[]:h;e:for(;++s<d;){var g=a[s],y=u?u(g):g;if(g=c||0!==g?g:0,f&&y==y){for(var m=v.length;m--;)if(v[m]===y)continue e;u&&v.push(y),h.push(g)}else l(v,y,c)||(v!==h&&v.push(y),h.push(g))}return h},xu}function Ss(){if(_u)return bu;_u=1;var e=tr(),n=rt();return bu=function(t){return n(t)&&e(t)}}function ks(){if(Su)return Eu;Su=1;var e=ms(),n=bs(),t=Es(),r=Ss(),o=n((function(n){return t(e(n,1,r,!0))}));return Eu=o}function Cs(){if(Ou)return Nu;Ou=1;var e=function(){if(Cu)return ku;Cu=1;var e=es();return ku=function(n,t){return e(t,(function(e){return n[e]}))}}(),n=rr();return Nu=function(t){return null==t?[]:e(t,n(t))}}function Ns(){if(Mu)return Pu;var e;Mu=1;try{e={clone:Tc(),constant:Bc(),each:Xc(),filter:ss(),has:ls(),isArray:it(),isEmpty:ds(),isFunction:Fn(),isUndefined:fs(),keys:rr(),map:vs(),reduce:ps(),size:gs(),transform:ys(),union:ks(),values:Cs()}}catch(e){}return e||(e=window._),Pu=e}function Os(){if(Iu)return ju;Iu=1;var e=Ns();ju=o;var n="\0",t="\0",r="";function o(n){this._isDirected=!e.has(n,"directed")||n.directed,this._isMultigraph=!!e.has(n,"multigraph")&&n.multigraph,this._isCompound=!!e.has(n,"compound")&&n.compound,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[t]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function i(e,n){e[n]?e[n]++:e[n]=1}function a(e,n){--e[n]||delete e[n]}function u(t,o,i,a){var u=""+o,c=""+i;if(!t&&u>c){var s=u;u=c,c=s}return u+r+c+r+(e.isUndefined(a)?n:a)}function c(e,n){return u(e,n.v,n.w,n.name)}return o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(e){return this._label=e,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultNodeLabelFn=n,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._in[t])}))},o.prototype.sinks=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._out[t])}))},o.prototype.setNodes=function(n,t){var r=arguments,o=this;return e.each(n,(function(e){r.length>1?o.setNode(e,t):o.setNode(e)})),this},o.prototype.setNode=function(n,r){return e.has(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=r),this):(this._nodes[n]=arguments.length>1?r:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=t,this._children[n]={},this._children[t][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)},o.prototype.node=function(e){return this._nodes[e]},o.prototype.hasNode=function(n){return e.has(this._nodes,n)},o.prototype.removeNode=function(n){var t=this;if(e.has(this._nodes,n)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[n],this._isCompound&&(this._removeFromParentsChildList(n),delete this._parent[n],e.each(this.children(n),(function(e){t.setParent(e)})),delete this._children[n]),e.each(e.keys(this._in[n]),r),delete this._in[n],delete this._preds[n],e.each(e.keys(this._out[n]),r),delete this._out[n],delete this._sucs[n],--this._nodeCount}return this},o.prototype.setParent=function(n,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(r))r=t;else{for(var o=r+="";!e.isUndefined(o);o=this.parent(o))if(o===n)throw new Error("Setting "+r+" as parent of "+n+" would create a cycle");this.setNode(r)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=r,this._children[r][n]=!0,this},o.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},o.prototype.parent=function(e){if(this._isCompound){var n=this._parent[e];if(n!==t)return n}},o.prototype.children=function(n){if(e.isUndefined(n)&&(n=t),this._isCompound){var r=this._children[n];if(r)return e.keys(r)}else{if(n===t)return this.nodes();if(this.hasNode(n))return[]}},o.prototype.predecessors=function(n){var t=this._preds[n];if(t)return e.keys(t)},o.prototype.successors=function(n){var t=this._sucs[n];if(t)return e.keys(t)},o.prototype.neighbors=function(n){var t=this.predecessors(n);if(t)return e.union(t,this.successors(n))},o.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},o.prototype.filterNodes=function(n){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;e.each(this._nodes,(function(e,r){n(r)&&t.setNode(r,e)})),e.each(this._edgeObjs,(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))}));var o={};function i(e){var n=r.parent(e);return void 0===n||t.hasNode(n)?(o[e]=n,n):n in o?o[n]:i(n)}return this._isCompound&&e.each(t.nodes(),(function(e){t.setParent(e,i(e))})),t},o.prototype.setDefaultEdgeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultEdgeLabelFn=n,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(n,t){var r=this,o=arguments;return e.reduce(n,(function(e,n){return o.length>1?r.setEdge(e,n,t):r.setEdge(e,n),n})),this},o.prototype.setEdge=function(){var n,t,r,o,a=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(n=c.v,t=c.w,r=c.name,2===arguments.length&&(o=arguments[1],a=!0)):(n=c,t=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],a=!0)),n=""+n,t=""+t,e.isUndefined(r)||(r=""+r);var s=u(this._isDirected,n,t,r);if(e.has(this._edgeLabels,s))return a&&(this._edgeLabels[s]=o),this;if(!e.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(n),this.setNode(t),this._edgeLabels[s]=a?o:this._defaultEdgeLabelFn(n,t,r);var l=function(e,n,t,r){var o=""+n,i=""+t;if(!e&&o>i){var a=o;o=i,i=a}var u={v:o,w:i};return r&&(u.name=r),u}(this._isDirected,n,t,r);return n=l.v,t=l.w,Object.freeze(l),this._edgeObjs[s]=l,i(this._preds[t],n),i(this._sucs[n],t),this._in[t][s]=l,this._out[n][s]=l,this._edgeCount++,this},o.prototype.edge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t);return this._edgeLabels[r]},o.prototype.hasEdge=function(n,t,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,n,t,r);return e.has(this._edgeLabels,o)},o.prototype.removeEdge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t),o=this._edgeObjs[r];return o&&(e=o.v,n=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[n],e),a(this._sucs[e],n),delete this._in[n][r],delete this._out[e][r],this._edgeCount--),this},o.prototype.inEdges=function(n,t){var r=this._in[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.v===t})):o}},o.prototype.outEdges=function(n,t){var r=this._out[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.w===t})):o}},o.prototype.nodeEdges=function(e,n){var t=this.inEdges(e,n);if(t)return t.concat(this.outEdges(e,n))},ju}function Ps(){if(Du)return Lu;Du=1;var e=Ns(),n=Os();function t(n){return e.map(n.nodes(),(function(t){var r=n.node(t),o=n.parent(t),i={v:t};return e.isUndefined(r)||(i.value=r),e.isUndefined(o)||(i.parent=o),i}))}function r(n){return e.map(n.edges(),(function(t){var r=n.edge(t),o={v:t.v,w:t.w};return e.isUndefined(t.name)||(o.name=t.name),e.isUndefined(r)||(o.value=r),o}))}return Lu={write:function(n){var o={options:{directed:n.isDirected(),multigraph:n.isMultigraph(),compound:n.isCompound()},nodes:t(n),edges:r(n)};return e.isUndefined(n.graph())||(o.value=e.clone(n.graph())),o},read:function(t){var r=new n(t.options).setGraph(t.value);return e.each(t.nodes,(function(e){r.setNode(e.v,e.value),e.parent&&r.setParent(e.v,e.parent)})),e.each(t.edges,(function(e){r.setEdge({v:e.v,w:e.w,name:e.name},e.value)})),r}}}function Ms(){if(Vu)return Ru;Vu=1;var e=Ns();return Ru=function(n){var t,r={},o=[];function i(o){e.has(r,o)||(r[o]=!0,t.push(o),e.each(n.successors(o),i),e.each(n.predecessors(o),i))}return e.each(n.nodes(),(function(e){t=[],i(e),t.length&&o.push(t)})),o},Ru}function js(){if(Yu)return Hu;Yu=1;var e=Ns();function n(){this._arr=[],this._keyIndices={}}return Hu=n,n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map((function(e){return e.key}))},n.prototype.has=function(n){return e.has(this._keyIndices,n)},n.prototype.priority=function(e){var n=this._keyIndices[e];if(void 0!==n)return this._arr[n].priority},n.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(n,t){var r=this._keyIndices;if(n=String(n),!e.has(r,n)){var o=this._arr,i=o.length;return r[n]=i,o.push({key:n,priority:t}),this._decrease(i),!0}return!1},n.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},n.prototype.decrease=function(e,n){var t=this._keyIndices[e];if(n>this._arr[t].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[t].priority+" New: "+n);this._arr[t].priority=n,this._decrease(t)},n.prototype._heapify=function(e){var n=this._arr,t=2*e,r=t+1,o=e;t<n.length&&(o=n[t].priority<n[o].priority?t:o,r<n.length&&(o=n[r].priority<n[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))},n.prototype._decrease=function(e){for(var n,t=this._arr,r=t[e].priority;0!==e&&!(t[n=e>>1].priority<r);)this._swap(e,n),e=n},n.prototype._swap=function(e,n){var t=this._arr,r=this._keyIndices,o=t[e],i=t[n];t[e]=i,t[n]=o,r[i.key]=e,r[o.key]=n},Hu}function Is(){if(Fu)return Xu;Fu=1;var e=Ns(),n=js();Xu=function(e,r,o,i){return function(e,t,r,o){var i,a,u={},c=new n,s=function(e){var n=e.v!==i?e.v:e.w,t=u[n],o=r(e),s=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);s<t.distance&&(t.distance=s,t.predecessor=i,c.decrease(n,s))};for(e.nodes().forEach((function(e){var n=e===t?0:Number.POSITIVE_INFINITY;u[e]={distance:n},c.add(e,n)}));c.size()>0&&(i=c.removeMin(),(a=u[i]).distance!==Number.POSITIVE_INFINITY);)o(i).forEach(s);return u}(e,String(r),o||t,i||function(n){return e.outEdges(n)})};var t=e.constant(1);return Xu}function As(){if(Uu)return Zu;Uu=1;var e=Is(),n=Ns();return Zu=function(t,r,o){return n.transform(t.nodes(),(function(n,i){n[i]=e(t,i,r,o)}),{})}}function zs(){if(Wu)return Gu;Wu=1;var e=Ns();return Gu=function(n){var t=0,r=[],o={},i=[];function a(u){var c=o[u]={onStack:!0,lowlink:t,index:t++};if(r.push(u),n.successors(u).forEach((function(n){e.has(o,n)?o[n].onStack&&(c.lowlink=Math.min(c.lowlink,o[n].index)):(a(n),c.lowlink=Math.min(c.lowlink,o[n].lowlink))})),c.lowlink===c.index){var s,l=[];do{s=r.pop(),o[s].onStack=!1,l.push(s)}while(u!==s);i.push(l)}}return n.nodes().forEach((function(n){e.has(o,n)||a(n)})),i},Gu}function Ts(){if($u)return qu;$u=1;var e=Ns(),n=zs();return qu=function(t){return e.filter(n(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}}function Bs(){if(Qu)return Ku;Qu=1;var e=Ns();Ku=function(e,t,r){return function(e,n,t){var r={},o=e.nodes();return o.forEach((function(e){r[e]={},r[e][e]={distance:0},o.forEach((function(n){e!==n&&(r[e][n]={distance:Number.POSITIVE_INFINITY})})),t(e).forEach((function(t){var o=t.v===e?t.w:t.v,i=n(t);r[e][o]={distance:i,predecessor:e}}))})),o.forEach((function(e){var n=r[e];o.forEach((function(t){var i=r[t];o.forEach((function(t){var r=i[e],o=n[t],a=i[t],u=r.distance+o.distance;u<a.distance&&(a.distance=u,a.predecessor=o.predecessor)}))}))})),r}(e,t||n,r||function(n){return e.outEdges(n)})};var n=e.constant(1);return Ku}function Ls(){if(ec)return Ju;ec=1;var e=Ns();function n(n){var r={},o={},i=[];if(e.each(n.sinks(),(function a(u){if(e.has(o,u))throw new t;e.has(r,u)||(o[u]=!0,r[u]=!0,e.each(n.predecessors(u),a),delete o[u],i.push(u))})),e.size(r)!==n.nodeCount())throw new t;return i}function t(){}return Ju=n,n.CycleException=t,t.prototype=new Error,Ju}function Ds(){if(tc)return nc;tc=1;var e=Ls();return nc=function(n){try{e(n)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}}function Rs(){if(oc)return rc;oc=1;var e=Ns();function n(t,r,o,i,a,u){e.has(i,r)||(i[r]=!0,o||u.push(r),e.each(a(r),(function(e){n(t,e,o,i,a,u)})),o&&u.push(r))}return rc=function(t,r,o){e.isArray(r)||(r=[r]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),a=[],u={};return e.each(r,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);n(t,e,"post"===o,u,i,a)})),a},rc}function Vs(){if(ac)return ic;ac=1;var e=Rs();return ic=function(n,t){return e(n,t,"post")}}function Hs(){if(cc)return uc;cc=1;var e=Rs();return uc=function(n,t){return e(n,t,"pre")}}function Ys(){if(lc)return sc;lc=1;var e=Ns(),n=Os(),t=js();return sc=function(r,o){var i,a=new n,u={},c=new t;function s(e){var n=e.v===i?e.w:e.v,t=c.priority(n);if(void 0!==t){var r=o(e);r<t&&(u[n]=i,c.decrease(n,r))}}if(0===r.nodeCount())return a;e.each(r.nodes(),(function(e){c.add(e,Number.POSITIVE_INFINITY),a.setNode(e)})),c.decrease(r.nodes()[0],0);for(var l=!1;c.size()>0;){if(i=c.removeMin(),e.has(u,i))a.setEdge(i,u[i]);else{if(l)throw new Error("Input graph is not connected: "+r);l=!0}r.nodeEdges(i).forEach(s)}return a},sc}gc.exports;try{pc=function(){if(vc)return hc;vc=1;var e=Bu?Tu:(Bu=1,Tu={Graph:Os(),version:zu?Au:(zu=1,Au="2.1.8")});return hc={Graph:e.Graph,json:Ps(),alg:fc?dc:(fc=1,dc={components:Ms(),dijkstra:Is(),dijkstraAll:As(),findCycles:Ts(),floydWarshall:Bs(),isAcyclic:Ds(),postorder:Vs(),preorder:Hs(),prim:Ys(),tarjan:zs(),topsort:Ls()}),version:e.version}}()}catch(j){}pc||(pc=window.graphlib);var Xs,Fs,Zs,Us,Gs,Ws,qs,$s,Ks,Qs,Js,el,nl,tl,rl,ol,il,al,ul,cl,sl,ll,dl,fl,hl,vl,pl,gl,yl,ml,xl,wl,bl,_l,El,Sl,kl,Cl,Nl,Ol,Pl,Ml,jl,Il,Al,zl,Tl,Bl,Ll,Dl,Rl,Vl,Hl,Yl,Xl,Fl,Zl,Ul,Gl,Wl,ql,$l,Kl,Ql,Jl,ed,nd,td,rd,od,id,ad,ud,cd,sd,ld,dd,fd,hd,vd,pd,gd,yd,md,xd,wd,bd,_d,Ed,Sd,kd,Cd,Nd,Od=pc;function Pd(){if(Us)return Zs;Us=1;var e=Bn(),n=tr(),t=xt(),r=Xn();return Zs=function(o,i,a){if(!r(a))return!1;var u=typeof i;return!!("number"==u?n(a)&&t(i,a.length):"string"==u&&i in a)&&e(a[i],o)}}function Md(){if(ol)return rl;ol=1;var e=function(){if(tl)return nl;tl=1;var e=function(){if(el)return Js;el=1;var e=function(){if(Qs)return Ks;Qs=1;var e=/\s/;return Ks=function(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}}(),n=/^\s+/;return Js=function(t){return t?t.slice(0,e(t)+1).replace(n,""):t}}(),n=Xn(),t=Qc(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;return nl=function(u){if("number"==typeof u)return u;if(t(u))return NaN;if(n(u)){var c="function"==typeof u.valueOf?u.valueOf():u;u=n(c)?c+"":c}if("string"!=typeof u)return 0===u?u:+u;u=e(u);var s=o.test(u);return s||i.test(u)?a(u.slice(2),s?2:8):r.test(u)?NaN:+u}}(),n=1/0;return rl=function(t){return t?(t=e(t))===n||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}}function jd(){if(fl)return dl;fl=1;var e=ms();return dl=function(n){return null!=n&&n.length?e(n,1):[]},dl}function Id(){if(wl)return xl;wl=1;var e=Qc();return xl=function(n,t,r){for(var o=-1,i=n.length;++o<i;){var a=n[o],u=t(a);if(null!=u&&(void 0===c?u==u&&!e(u):r(u,c)))var c=u,s=a}return s},xl}function Ad(){if(Cl)return kl;Cl=1;var e=et(),n=Bn();return kl=function(t,r,o){(void 0!==o&&!n(t[r],o)||void 0===o&&!(r in t))&&e(t,r,o)}}function zd(){return Ml?Pl:(Ml=1,Pl=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]})}function Td(){return Yl?Hl:(Yl=1,Hl=function(e,n){return e<n})}function Bd(){if(md)return yd;md=1;var e=es(),n=os(),t=cs(),r=hs(),o=(fd||(fd=1,dd=function(e,n){var t=e.length;for(e.sort(n);t--;)e[t]=e[t].value;return e}),dd),i=bt(),a=function(){if(gd)return pd;gd=1;var e=function(){if(vd)return hd;vd=1;var e=Qc();return hd=function(n,t){if(n!==t){var r=void 0!==n,o=null===n,i=n==n,a=e(n),u=void 0!==t,c=null===t,s=t==t,l=e(t);if(!c&&!l&&!a&&n>t||a&&u&&s&&!c&&!l||o&&u&&s||!r&&s||!i)return 1;if(!o&&!a&&!l&&n<t||l&&r&&i&&!o&&!a||c&&r&&i||!u&&i||!s)return-1}return 0}}();return pd=function(n,t,r){for(var o=-1,i=n.criteria,a=t.criteria,u=i.length,c=r.length;++o<u;){var s=e(i[o],a[o]);if(s)return o>=c?s:s*("desc"==r[o]?-1:1)}return n.index-t.index}}(),u=Vc(),c=it();return yd=function(s,l,d){l=l.length?e(l,(function(e){return c(e)?function(t){return n(t,1===e.length?e[0]:e)}:e})):[u];var f=-1;l=e(l,i(t));var h=r(s,(function(n,t,r){return{criteria:e(l,(function(e){return e(n)})),index:++f,value:n}}));return o(h,(function(e,n){return a(e,n,d)}))}}try{Nd={cloneDeep:function(){if(Fs)return Xs;Fs=1;var e=zc();return Xs=function(n){return e(n,5)}}(),constant:Bc(),defaults:function(){if(Ws)return Gs;Ws=1;var e=bs(),n=Bn(),t=Pd(),r=or(),o=Object.prototype,i=o.hasOwnProperty,a=e((function(e,a){e=Object(e);var u=-1,c=a.length,s=c>2?a[2]:void 0;for(s&&t(a[0],a[1],s)&&(c=1);++u<c;)for(var l=a[u],d=r(l),f=-1,h=d.length;++f<h;){var v=d[f],p=e[v];(void 0===p||n(p,o[v])&&!i.call(e,v))&&(e[v]=l[v])}return e}));return Gs=a}(),each:Xc(),filter:ss(),find:function(){if(ll)return sl;ll=1;var e=function(){if($s)return qs;$s=1;var e=cs(),n=tr(),t=rr();return qs=function(r){return function(o,i,a){var u=Object(o);if(!n(o)){var c=e(i,3);o=t(o),i=function(e){return c(u[e],e,u)}}var s=r(o,i,a);return s>-1?u[c?o[s]:s]:void 0}}}(),n=e(function(){if(cl)return ul;cl=1;var e=_s(),n=cs(),t=function(){if(al)return il;al=1;var e=Md();return il=function(n){var t=e(n),r=t%1;return t==t?r?t-r:t:0}}(),r=Math.max;return ul=function(o,i,a){var u=null==o?0:o.length;if(!u)return-1;var c=null==a?0:t(a);return c<0&&(c=r(u+c,0)),e(o,n(i,3),c)},ul}());return sl=n}(),flatten:jd(),forEach:Yc(),forIn:function(){if(vl)return hl;vl=1;var e=Lc(),n=Hc(),t=or();return hl=function(r,o){return null==r?r:e(r,n(o),t)}}(),has:ls(),isUndefined:fs(),last:(gl||(gl=1,pl=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}),pl),map:vs(),mapValues:function(){if(ml)return yl;ml=1;var e=et(),n=Dc(),t=cs();return yl=function(r,o){var i={};return o=t(o,3),n(r,(function(n,t,r){e(i,t,o(n,t,r))})),i}}(),max:function(){if(Sl)return El;Sl=1;var e=Id(),n=_l?bl:(_l=1,bl=function(e,n){return e>n}),t=Vc();return El=function(r){return r&&r.length?e(r,t,n):void 0},El}(),merge:function(){if(Vl)return Rl;Vl=1;var e=function(){if(Bl)return Tl;Bl=1;var e=Kn(),n=Ad(),t=Lc(),r=function(){if(zl)return Al;zl=1;var e=Ad(),n=yc(),t=jc(),r=mc(),o=Ac(),i=ot(),a=it(),u=Ss(),c=mt(),s=Fn(),l=Xn(),d=function(){if(Ol)return Nl;Ol=1;var e=Yn(),n=Ec(),t=rt(),r=Function.prototype,o=Object.prototype,i=r.toString,a=o.hasOwnProperty,u=i.call(Object);return Nl=function(r){if(!t(r)||"[object Object]"!=e(r))return!1;var o=n(r);if(null===o)return!0;var c=a.call(o,"constructor")&&o.constructor;return"function"==typeof c&&c instanceof c&&i.call(c)==u}}(),f=Kt(),h=zd(),v=function(){if(Il)return jl;Il=1;var e=tt(),n=or();return jl=function(t){return e(t,n(t))}}();return Al=function(p,g,y,m,x,w,b){var _=h(p,y),E=h(g,y),S=b.get(E);if(S)e(p,y,S);else{var k=w?w(_,E,y+"",p,g,b):void 0,C=void 0===k;if(C){var N=a(E),O=!N&&c(E),P=!N&&!O&&f(E);k=E,N||O||P?a(_)?k=_:u(_)?k=r(_):O?(C=!1,k=n(E,!0)):P?(C=!1,k=t(E,!0)):k=[]:d(E)||i(E)?(k=_,i(_)?k=v(_):l(_)&&!s(_)||(k=o(E))):C=!1}C&&(b.set(E,k),x(k,E,m,w,b),b.delete(E)),e(p,y,k)}}}(),o=Xn(),i=or(),a=zd();return Tl=function u(c,s,l,d,f){c!==s&&t(s,(function(t,i){if(f||(f=new e),o(t))r(c,s,i,l,u,d,f);else{var h=d?d(a(c,i),t,i+"",c,s,f):void 0;void 0===h&&(h=t),n(c,i,h)}}),i)},Tl}(),n=function(){if(Dl)return Ll;Dl=1;var e=bs(),n=Pd();return Ll=function(t){return e((function(e,r){var o=-1,i=r.length,a=i>1?r[i-1]:void 0,u=i>2?r[2]:void 0;for(a=t.length>3&&"function"==typeof a?(i--,a):void 0,u&&n(r[0],r[1],u)&&(a=i<3?void 0:a,i=1),e=Object(e);++o<i;){var c=r[o];c&&t(e,c,o,a)}return e}))}}()((function(n,t,r){e(n,t,r)}));return Rl=n}(),min:function(){if(Fl)return Xl;Fl=1;var e=Id(),n=Td(),t=Vc();return Xl=function(r){return r&&r.length?e(r,t,n):void 0},Xl}(),minBy:function(){if(Ul)return Zl;Ul=1;var e=Id(),n=cs(),t=Td();return Zl=function(r,o){return r&&r.length?e(r,n(o,2),t):void 0},Zl}(),now:function(){if(Wl)return Gl;Wl=1;var e=Vn();return Gl=function(){return e.Date.now()}}(),pick:function(){if(od)return rd;od=1;var e=function(){if(ed)return Jl;ed=1;var e=function(){if(Ql)return Kl;Ql=1;var e=os(),n=function(){if($l)return ql;$l=1;var e=nt(),n=ts(),t=xt(),r=Xn(),o=rs();return ql=function(i,a,u,c){if(!r(i))return i;for(var s=-1,l=(a=n(a,i)).length,d=l-1,f=i;null!=f&&++s<l;){var h=o(a[s]),v=u;if("__proto__"===h||"constructor"===h||"prototype"===h)return i;if(s!=d){var p=f[h];void 0===(v=c?c(p,h,f):void 0)&&(v=r(p)?p:t(a[s+1])?[]:{})}e(f,h,v),f=f[h]}return i}}(),t=ts();return Kl=function(r,o,i){for(var a=-1,u=o.length,c={};++a<u;){var s=o[a],l=e(r,s);i(l,s)&&n(c,t(s,r),l)}return c}}(),n=as();return Jl=function(t,r){return e(t,r,(function(e,r){return n(t,r)}))}}(),n=function(){if(td)return nd;td=1;var e=jd(),n=xs(),t=ws();return nd=function(r){return t(n(r,void 0,e),r+"")}}(),t=n((function(n,t){return null==n?{}:e(n,t)}));return rd=t}(),range:function(){if(ld)return sd;ld=1;var e=function(){if(cd)return ud;cd=1;var e=function(){if(ad)return id;ad=1;var e=Math.ceil,n=Math.max;return id=function(t,r,o,i){for(var a=-1,u=n(e((r-t)/(o||1)),0),c=Array(u);u--;)c[i?u:++a]=t,t+=o;return c},id}(),n=Pd(),t=Md();return ud=function(r){return function(o,i,a){return a&&"number"!=typeof a&&n(o,i,a)&&(i=a=void 0),o=t(o),void 0===i?(i=o,o=0):i=t(i),a=void 0===a?o<i?1:-1:t(a),e(o,i,a,r)}},ud}()();return sd=e}(),reduce:ps(),sortBy:function(){if(wd)return xd;wd=1;var e=ms(),n=Bd(),t=bs(),r=Pd(),o=t((function(t,o){if(null==t)return[];var i=o.length;return i>1&&r(t,o[0],o[1])?o=[]:i>2&&r(o[0],o[1],o[2])&&(o=[o[0]]),n(t,e(o,1),[])}));return xd=o}(),uniqueId:function(){if(_d)return bd;_d=1;var e=ns(),n=0;return bd=function(t){var r=++n;return e(t)+r},bd}(),values:Cs(),zipObject:function(){if(Cd)return kd;Cd=1;var e=nt(),n=(Sd||(Sd=1,Ed=function(e,n,t){for(var r=-1,o=e.length,i=n.length,a={};++r<o;){var u=r<i?n[r]:void 0;t(a,e[r],u)}return a}),Ed);return kd=function(t,r){return n(t||[],r||[],e)},kd}()}}catch(j){}Nd||(Nd=window._);var Ld=Nd,Dd=Rd;function Rd(){var e={};e._next=e._prev=e,this._sentinel=e}function Vd(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Hd(e,n){if("_next"!==e&&"_prev"!==e)return n}Rd.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return Vd(n),n},Rd.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&Vd(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},Rd.prototype.toString=function(){for(var e=[],n=this._sentinel,t=n._prev;t!==n;)e.push(JSON.stringify(t,Hd)),t=t._prev;return"["+e.join(", ")+"]"};var Yd=Ld,Xd=Od.Graph,Fd=Dd,Zd=Yd.constant(1);function Ud(e,n,t,r,o){var i=o?[]:void 0;return Yd.forEach(e.inEdges(r.v),(function(r){var a=e.edge(r),u=e.node(r.v);o&&i.push({v:r.v,w:r.w}),u.out-=a,Gd(n,t,u)})),Yd.forEach(e.outEdges(r.v),(function(r){var o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,Gd(n,t,a)})),e.removeNode(r.v),i}function Gd(e,n,t){t.out?t.in?e[t.out-t.in+n].enqueue(t):e[e.length-1].enqueue(t):e[0].enqueue(t)}var Wd=Ld,qd=function(e,n){if(e.nodeCount()<=1)return[];var t=function(e,n){var t=new Xd,r=0,o=0;Yd.forEach(e.nodes(),(function(e){t.setNode(e,{v:e,in:0,out:0})})),Yd.forEach(e.edges(),(function(e){var i=t.edge(e.v,e.w)||0,a=n(e),u=i+a;t.setEdge(e.v,e.w,u),o=Math.max(o,t.node(e.v).out+=a),r=Math.max(r,t.node(e.w).in+=a)}));var i=Yd.range(o+r+3).map((function(){return new Fd})),a=r+1;return Yd.forEach(t.nodes(),(function(e){Gd(i,a,t.node(e))})),{graph:t,buckets:i,zeroIdx:a}}(e,n||Zd),r=function(e,n,t){for(var r,o=[],i=n[n.length-1],a=n[0];e.nodeCount();){for(;r=a.dequeue();)Ud(e,n,t,r);for(;r=i.dequeue();)Ud(e,n,t,r);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(r=n[u].dequeue()){o=o.concat(Ud(e,n,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return Yd.flatten(Yd.map(r,(function(n){return e.outEdges(n.v,n.w)})),!0)},$d={run:function(e){var n="greedy"===e.graph().acyclicer?qd(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],t={},r={};return Wd.forEach(e.nodes(),(function o(i){Wd.has(r,i)||(r[i]=!0,t[i]=!0,Wd.forEach(e.outEdges(i),(function(e){Wd.has(t,e.w)?n.push(e):o(e.w)})),delete t[i])})),n}(e);Wd.forEach(n,(function(n){var t=e.edge(n);e.removeEdge(n),t.forwardName=n.name,t.reversed=!0,e.setEdge(n.w,n.v,t,Wd.uniqueId("rev"))}))},undo:function(e){Wd.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.reversed){e.removeEdge(n);var r=t.forwardName;delete t.reversed,delete t.forwardName,e.setEdge(n.w,n.v,t,r)}}))}},Kd=Ld,Qd=Od.Graph,Jd={addDummyNode:ef,simplify:function(e){var n=(new Qd).setGraph(e.graph());return Kd.forEach(e.nodes(),(function(t){n.setNode(t,e.node(t))})),Kd.forEach(e.edges(),(function(t){var r=n.edge(t.v,t.w)||{weight:0,minlen:1},o=e.edge(t);n.setEdge(t.v,t.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})})),n},asNonCompoundGraph:function(e){var n=new Qd({multigraph:e.isMultigraph()}).setGraph(e.graph());return Kd.forEach(e.nodes(),(function(t){e.children(t).length||n.setNode(t,e.node(t))})),Kd.forEach(e.edges(),(function(t){n.setEdge(t,e.edge(t))})),n},successorWeights:function(e){var n=Kd.map(e.nodes(),(function(n){var t={};return Kd.forEach(e.outEdges(n),(function(n){t[n.w]=(t[n.w]||0)+e.edge(n).weight})),t}));return Kd.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=Kd.map(e.nodes(),(function(n){var t={};return Kd.forEach(e.inEdges(n),(function(n){t[n.v]=(t[n.v]||0)+e.edge(n).weight})),t}));return Kd.zipObject(e.nodes(),n)},intersectRect:function(e,n){var t,r,o=e.x,i=e.y,a=n.x-o,u=n.y-i,c=e.width/2,s=e.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(u)*c>Math.abs(a)*s?(u<0&&(s=-s),t=s*a/u,r=s):(a<0&&(c=-c),t=c,r=c*u/a),{x:o+t,y:i+r}},buildLayerMatrix:function(e){var n=Kd.map(Kd.range(nf(e)+1),(function(){return[]}));return Kd.forEach(e.nodes(),(function(t){var r=e.node(t),o=r.rank;Kd.isUndefined(o)||(n[o][r.order]=t)})),n},normalizeRanks:function(e){var n=Kd.min(Kd.map(e.nodes(),(function(n){return e.node(n).rank})));Kd.forEach(e.nodes(),(function(t){var r=e.node(t);Kd.has(r,"rank")&&(r.rank-=n)}))},removeEmptyRanks:function(e){var n=Kd.min(Kd.map(e.nodes(),(function(n){return e.node(n).rank}))),t=[];Kd.forEach(e.nodes(),(function(r){var o=e.node(r).rank-n;t[o]||(t[o]=[]),t[o].push(r)}));var r=0,o=e.graph().nodeRankFactor;Kd.forEach(t,(function(n,t){Kd.isUndefined(n)&&t%o!=0?--r:r&&Kd.forEach(n,(function(n){e.node(n).rank+=r}))}))},addBorderNode:function(e,n,t,r){var o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=r),ef(e,"border",o,n)},maxRank:nf,partition:function(e,n){var t={lhs:[],rhs:[]};return Kd.forEach(e,(function(e){n(e)?t.lhs.push(e):t.rhs.push(e)})),t},time:function(e,n){var t=Kd.now();try{return n()}finally{console.log(e+" time: "+(Kd.now()-t)+"ms")}},notime:function(e,n){return n()}};function ef(e,n,t,r){var o;do{o=Kd.uniqueId(r)}while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function nf(e){return Kd.max(Kd.map(e.nodes(),(function(n){var t=e.node(n).rank;if(!Kd.isUndefined(t))return t})))}var tf=Ld,rf=Jd,of={run:function(e){e.graph().dummyChains=[],tf.forEach(e.edges(),(function(n){!function(e,n){var t,r,o,i=n.v,a=e.node(i).rank,u=n.w,c=e.node(u).rank,s=n.name,l=e.edge(n),d=l.labelRank;if(c!==a+1){for(e.removeEdge(n),o=0,++a;a<c;++o,++a)l.points=[],r={width:0,height:0,edgeLabel:l,edgeObj:n,rank:a},t=rf.addDummyNode(e,"edge",r,"_d"),a===d&&(r.width=l.width,r.height=l.height,r.dummy="edge-label",r.labelpos=l.labelpos),e.setEdge(i,t,{weight:l.weight},s),0===o&&e.graph().dummyChains.push(t),i=t;e.setEdge(i,u,{weight:l.weight},s)}}(e,n)}))},undo:function(e){tf.forEach(e.graph().dummyChains,(function(n){var t,r=e.node(n),o=r.edgeLabel;for(e.setEdge(r.edgeObj,o);r.dummy;)t=e.successors(n)[0],e.removeNode(n),o.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(o.x=r.x,o.y=r.y,o.width=r.width,o.height=r.height),n=t,r=e.node(n)}))}},af=Ld,uf=function(e){var n={};af.forEach(e.sources(),(function t(r){var o=e.node(r);if(af.has(n,r))return o.rank;n[r]=!0;var i=af.min(af.map(e.outEdges(r),(function(n){return t(n.w)-e.edge(n).minlen})));return i!==Number.POSITIVE_INFINITY&&null!=i||(i=0),o.rank=i}))},cf=function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen},sf=Ld,lf=Od.Graph,df=cf,ff=function(e){var n,t,r=new lf({directed:!1}),o=e.nodes()[0],i=e.nodeCount();for(r.setNode(o,{});hf(r,e)<i;)n=vf(r,e),t=r.hasNode(n.v)?df(e,n):-df(e,n),pf(r,e,t);return r};function hf(e,n){return sf.forEach(e.nodes(),(function t(r){sf.forEach(n.nodeEdges(r),(function(o){var i=o.v,a=r===i?o.w:i;e.hasNode(a)||df(n,o)||(e.setNode(a,{}),e.setEdge(r,a,{}),t(a))}))})),e.nodeCount()}function vf(e,n){return sf.minBy(n.edges(),(function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return df(n,t)}))}function pf(e,n,t){sf.forEach(e.nodes(),(function(e){n.node(e).rank+=t}))}var gf=Ld,yf=ff,mf=cf,xf=uf,wf=Od.alg.preorder,bf=Od.alg.postorder,_f=Jd.simplify,Ef=Sf;function Sf(e){e=_f(e),xf(e);var n,t=yf(e);for(Nf(t),kf(t,e);n=Pf(t);)jf(t,e,n,Mf(t,e,n))}function kf(e,n){var t=bf(e,e.nodes());t=t.slice(0,t.length-1),gf.forEach(t,(function(t){!function(e,n,t){var r=e.node(t).parent;e.edge(t,r).cutvalue=Cf(e,n,t)}(e,n,t)}))}function Cf(e,n,t){var r=e.node(t).parent,o=!0,i=n.edge(t,r),a=0;return i||(o=!1,i=n.edge(r,t)),a=i.weight,gf.forEach(n.nodeEdges(t),(function(i){var u,c,s=i.v===t,l=s?i.w:i.v;if(l!==r){var d=s===o,f=n.edge(i).weight;if(a+=d?f:-f,u=t,c=l,e.hasEdge(u,c)){var h=e.edge(t,l).cutvalue;a+=d?-h:h}}})),a}function Nf(e,n){arguments.length<2&&(n=e.nodes()[0]),Of(e,{},1,n)}function Of(e,n,t,r,o){var i=t,a=e.node(r);return n[r]=!0,gf.forEach(e.neighbors(r),(function(o){gf.has(n,o)||(t=Of(e,n,t,o,r))})),a.low=i,a.lim=t++,o?a.parent=o:delete a.parent,t}function Pf(e){return gf.find(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function Mf(e,n,t){var r=t.v,o=t.w;n.hasEdge(r,o)||(r=t.w,o=t.v);var i=e.node(r),a=e.node(o),u=i,c=!1;i.lim>a.lim&&(u=a,c=!0);var s=gf.filter(n.edges(),(function(n){return c===If(e,e.node(n.v),u)&&c!==If(e,e.node(n.w),u)}));return gf.minBy(s,(function(e){return mf(n,e)}))}function jf(e,n,t,r){var o=t.v,i=t.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),Nf(e),kf(e,n),function(e,n){var t=gf.find(e.nodes(),(function(e){return!n.node(e).parent})),r=wf(e,t);r=r.slice(1),gf.forEach(r,(function(t){var r=e.node(t).parent,o=n.edge(t,r),i=!1;o||(o=n.edge(r,t),i=!0),n.node(t).rank=n.node(r).rank+(i?o.minlen:-o.minlen)}))}(e,n)}function If(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}Sf.initLowLimValues=Nf,Sf.initCutValues=kf,Sf.calcCutValue=Cf,Sf.leaveEdge=Pf,Sf.enterEdge=Mf,Sf.exchangeEdges=jf;var Af=uf,zf=ff,Tf=Ef,Bf=Af;var Lf=Ld,Df=Ld,Rf=Jd,Vf={run:function(e){var n=Rf.addDummyNode(e,"root",{},"_root"),t=function(e){var n={};function t(r,o){var i=e.children(r);i&&i.length&&Df.forEach(i,(function(e){t(e,o+1)})),n[r]=o}return Df.forEach(e.children(),(function(e){t(e,1)})),n}(e),r=Df.max(Df.values(t))-1,o=2*r+1;e.graph().nestingRoot=n,Df.forEach(e.edges(),(function(n){e.edge(n).minlen*=o}));var i=function(e){return Df.reduce(e.edges(),(function(n,t){return n+e.edge(t).weight}),0)}(e)+1;Df.forEach(e.children(),(function(a){Hf(e,n,o,i,r,t,a)})),e.graph().nodeRankFactor=o},cleanup:function(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,Df.forEach(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}};function Hf(e,n,t,r,o,i,a){var u=e.children(a);if(u.length){var c=Rf.addBorderNode(e,"_bt"),s=Rf.addBorderNode(e,"_bb"),l=e.node(a);e.setParent(c,a),l.borderTop=c,e.setParent(s,a),l.borderBottom=s,Df.forEach(u,(function(u){Hf(e,n,t,r,o,i,u);var l=e.node(u),d=l.borderTop?l.borderTop:u,f=l.borderBottom?l.borderBottom:u,h=l.borderTop?r:2*r,v=d!==f?1:o-i[a]+1;e.setEdge(c,d,{weight:h,minlen:v,nestingEdge:!0}),e.setEdge(f,s,{weight:h,minlen:v,nestingEdge:!0})})),e.parent(a)||e.setEdge(n,c,{weight:0,minlen:o+i[a]})}else a!==n&&e.setEdge(n,a,{weight:0,minlen:t})}var Yf=Ld,Xf=Jd;function Ff(e,n,t,r,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],c=Xf.addDummyNode(e,"border",a,t);o[n][i]=c,e.setParent(c,r),u&&e.setEdge(u,c,{weight:1})}var Zf=Ld,Uf={adjust:function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||Gf(e)},undo:function(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){Zf.forEach(e.nodes(),(function(n){qf(e.node(n))})),Zf.forEach(e.edges(),(function(n){var t=e.edge(n);Zf.forEach(t.points,qf),Zf.has(t,"y")&&qf(t)}))}(e),"lr"!==n&&"rl"!==n||(function(e){Zf.forEach(e.nodes(),(function(n){$f(e.node(n))})),Zf.forEach(e.edges(),(function(n){var t=e.edge(n);Zf.forEach(t.points,$f),Zf.has(t,"x")&&$f(t)}))}(e),Gf(e))}};function Gf(e){Zf.forEach(e.nodes(),(function(n){Wf(e.node(n))})),Zf.forEach(e.edges(),(function(n){Wf(e.edge(n))}))}function Wf(e){var n=e.width;e.width=e.height,e.height=n}function qf(e){e.y=-e.y}function $f(e){var n=e.x;e.x=e.y,e.y=n}var Kf=Ld,Qf=Ld;function Jf(e,n,t){for(var r=Qf.zipObject(t,Qf.map(t,(function(e,n){return n}))),o=Qf.flatten(Qf.map(n,(function(n){return Qf.sortBy(Qf.map(e.outEdges(n),(function(n){return{pos:r[n.w],weight:e.edge(n).weight}})),"pos")})),!0),i=1;i<t.length;)i<<=1;var a=2*i-1;i-=1;var u=Qf.map(new Array(a),(function(){return 0})),c=0;return Qf.forEach(o.forEach((function(e){var n=e.pos+i;u[n]+=e.weight;for(var t=0;n>0;)n%2&&(t+=u[n+1]),u[n=n-1>>1]+=e.weight;c+=e.weight*t}))),c}var eh=Ld,nh=Ld,th=Ld,rh=Jd;function oh(e,n,t){for(var r;n.length&&(r=th.last(n)).i<=t;)n.pop(),e.push(r.vs),t++;return t}var ih=Ld,ah=Ld,uh=Od.Graph,ch=Ld,sh=Ld,lh=function(e){var n={},t=Kf.filter(e.nodes(),(function(n){return!e.children(n).length})),r=Kf.max(Kf.map(t,(function(n){return e.node(n).rank}))),o=Kf.map(Kf.range(r+1),(function(){return[]}));var i=Kf.sortBy(t,(function(n){return e.node(n).rank}));return Kf.forEach(i,(function t(r){if(!Kf.has(n,r)){n[r]=!0;var i=e.node(r);o[i.rank].push(r),Kf.forEach(e.successors(r),t)}})),o},dh=function(e,n){for(var t=0,r=1;r<n.length;++r)t+=Jf(e,n[r-1],n[r]);return t},fh=function e(n,t,r,o){var i=n.children(t),a=n.node(t),u=a?a.borderLeft:void 0,c=a?a.borderRight:void 0,s={};u&&(i=ih.filter(i,(function(e){return e!==u&&e!==c})));var l=function(e,n){return eh.map(n,(function(n){var t=e.inEdges(n);if(t.length){var r=eh.reduce(t,(function(n,t){var r=e.edge(t),o=e.node(t.v);return{sum:n.sum+r.weight*o.order,weight:n.weight+r.weight}}),{sum:0,weight:0});return{v:n,barycenter:r.sum/r.weight,weight:r.weight}}return{v:n}}))}(n,i);ih.forEach(l,(function(t){if(n.children(t.v).length){var i=e(n,t.v,r,o);s[t.v]=i,ih.has(i,"barycenter")&&(a=t,u=i,ih.isUndefined(a.barycenter)?(a.barycenter=u.barycenter,a.weight=u.weight):(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight))}var a,u}));var d=function(e,n){var t={};return nh.forEach(e,(function(e,n){var r=t[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};nh.isUndefined(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)})),nh.forEach(n.edges(),(function(e){var n=t[e.v],r=t[e.w];nh.isUndefined(n)||nh.isUndefined(r)||(r.indegree++,n.out.push(t[e.w]))})),function(e){var n=[];function t(e){return function(n){n.merged||(nh.isUndefined(n.barycenter)||nh.isUndefined(e.barycenter)||n.barycenter>=e.barycenter)&&function(e,n){var t=0,r=0;e.weight&&(t+=e.barycenter*e.weight,r+=e.weight),n.weight&&(t+=n.barycenter*n.weight,r+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=t/r,e.weight=r,e.i=Math.min(n.i,e.i),n.merged=!0}(e,n)}}function r(n){return function(t){t.in.push(n),0==--t.indegree&&e.push(t)}}for(;e.length;){var o=e.pop();n.push(o),nh.forEach(o.in.reverse(),t(o)),nh.forEach(o.out,r(o))}return nh.map(nh.filter(n,(function(e){return!e.merged})),(function(e){return nh.pick(e,["vs","i","barycenter","weight"])}))}(nh.filter(t,(function(e){return!e.indegree})))}(l,r);!function(e,n){ih.forEach(e,(function(e){e.vs=ih.flatten(e.vs.map((function(e){return n[e]?n[e].vs:e})),!0)}))}(d,s);var f=function(e,n){var t,r=rh.partition(e,(function(e){return th.has(e,"barycenter")})),o=r.lhs,i=th.sortBy(r.rhs,(function(e){return-e.i})),a=[],u=0,c=0,s=0;o.sort((t=!!n,function(e,n){return e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i})),s=oh(a,i,s),th.forEach(o,(function(e){s+=e.vs.length,a.push(e.vs),u+=e.barycenter*e.weight,c+=e.weight,s=oh(a,i,s)}));var l={vs:th.flatten(a,!0)};return c&&(l.barycenter=u/c,l.weight=c),l}(d,o);if(u&&(f.vs=ih.flatten([u,f.vs,c],!0),n.predecessors(u).length)){var h=n.node(n.predecessors(u)[0]),v=n.node(n.predecessors(c)[0]);ih.has(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+h.order+v.order)/(f.weight+2),f.weight+=2}return f},hh=function(e,n,t){var r=function(e){for(var n;e.hasNode(n=ah.uniqueId("_root")););return n}(e),o=new uh({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(n){return e.node(n)}));return ah.forEach(e.nodes(),(function(i){var a=e.node(i),u=e.parent(i);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(o.setNode(i),o.setParent(i,u||r),ah.forEach(e[t](i),(function(n){var t=n.v===i?n.w:n.v,r=o.edge(t,i),a=ah.isUndefined(r)?0:r.weight;o.setEdge(t,i,{weight:e.edge(n).weight+a})})),ah.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))})),o},vh=Od.Graph,ph=Jd;function gh(e,n,t){return sh.map(n,(function(n){return hh(e,n,t)}))}function yh(e,n){var t=new vh;sh.forEach(e,(function(e){var r=e.graph().root,o=fh(e,r,t,n);sh.forEach(o.vs,(function(n,t){e.node(n).order=t})),function(e,n,t){var r,o={};ch.forEach(t,(function(t){for(var i,a,u=e.parent(t);u;){if((i=e.parent(u))?(a=o[i],o[i]=u):(a=r,r=u),a&&a!==u)return void n.setEdge(a,u);u=i}}))}(e,t,o.vs)}))}function mh(e,n){sh.forEach(n,(function(n){sh.forEach(n,(function(n,t){e.node(n).order=t}))}))}var xh=Ld,wh=Od.Graph,bh=Jd;function _h(e,n,t){if(n>t){var r=n;n=t,t=r}var o=e[n];o||(e[n]=o={}),o[t]=!0}function Eh(e,n,t){if(n>t){var r=n;n=t,t=r}return xh.has(e[n],t)}var Sh=Ld,kh=Jd,Ch=function(e){var n,t=bh.buildLayerMatrix(e),r=xh.merge(function(e,n){var t={};return xh.reduce(n,(function(n,r){var o=0,i=0,a=n.length,u=xh.last(r);return xh.forEach(r,(function(n,c){var s=function(e,n){if(e.node(n).dummy)return xh.find(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),l=s?e.node(s).order:a;(s||n===u)&&(xh.forEach(r.slice(i,c+1),(function(n){xh.forEach(e.predecessors(n),(function(r){var i=e.node(r),a=i.order;!(a<o||l<a)||i.dummy&&e.node(n).dummy||_h(t,r,n)}))})),i=c+1,o=l)})),r})),t}(e,t),function(e,n){var t={};function r(n,r,o,i,a){var u;xh.forEach(xh.range(r,o),(function(r){u=n[r],e.node(u).dummy&&xh.forEach(e.predecessors(u),(function(n){var r=e.node(n);r.dummy&&(r.order<i||r.order>a)&&_h(t,n,u)}))}))}return xh.reduce(n,(function(n,t){var o,i=-1,a=0;return xh.forEach(t,(function(u,c){if("border"===e.node(u).dummy){var s=e.predecessors(u);s.length&&(o=e.node(s[0]).order,r(t,a,c,i,o),a=c,i=o)}r(t,a,t.length,o,n.length)})),t})),t}(e,t)),o={};xh.forEach(["u","d"],(function(i){n="u"===i?t:xh.values(t).reverse(),xh.forEach(["l","r"],(function(t){"r"===t&&(n=xh.map(n,(function(e){return xh.values(e).reverse()})));var a=("u"===i?e.predecessors:e.successors).bind(e),u=function(e,n,t,r){var o={},i={},a={};return xh.forEach(n,(function(e){xh.forEach(e,(function(e,n){o[e]=e,i[e]=e,a[e]=n}))})),xh.forEach(n,(function(e){var n=-1;xh.forEach(e,(function(e){var u=r(e);if(u.length){u=xh.sortBy(u,(function(e){return a[e]}));for(var c=(u.length-1)/2,s=Math.floor(c),l=Math.ceil(c);s<=l;++s){var d=u[s];i[e]===e&&n<a[d]&&!Eh(t,e,d)&&(i[d]=e,i[e]=o[e]=o[d],n=a[d])}}}))})),{root:o,align:i}}(0,n,r,a),c=function(e,n,t,r,o){var i={},a=function(e,n,t,r){var o=new wh,i=e.graph(),a=function(e,n,t){return function(r,o,i){var a,u=r.node(o),c=r.node(i),s=0;if(s+=u.width/2,xh.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(s+=t?a:-a),a=0,s+=(u.dummy?n:e)/2,s+=(c.dummy?n:e)/2,s+=c.width/2,xh.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(s+=t?a:-a),a=0,s}}(i.nodesep,i.edgesep,r);return xh.forEach(n,(function(n){var r;xh.forEach(n,(function(n){var i=t[n];if(o.setNode(i),r){var u=t[r],c=o.edge(u,i);o.setEdge(u,i,Math.max(a(e,n,r),c||0))}r=n}))})),o}(e,n,t,o),u=o?"borderLeft":"borderRight";function c(e,n){for(var t=a.nodes(),r=t.pop(),o={};r;)o[r]?e(r):(o[r]=!0,t.push(r),t=t.concat(n(r))),r=t.pop()}return c((function(e){i[e]=a.inEdges(e).reduce((function(e,n){return Math.max(e,i[n.v]+a.edge(n))}),0)}),a.predecessors.bind(a)),c((function(n){var t=a.outEdges(n).reduce((function(e,n){return Math.min(e,i[n.w]-a.edge(n))}),Number.POSITIVE_INFINITY),r=e.node(n);t!==Number.POSITIVE_INFINITY&&r.borderType!==u&&(i[n]=Math.max(i[n],t))}),a.successors.bind(a)),xh.forEach(r,(function(e){i[e]=i[t[e]]})),i}(e,n,u.root,u.align,"r"===t);"r"===t&&(c=xh.mapValues(c,(function(e){return-e}))),o[i+t]=c}))}));var i=function(e,n){return xh.minBy(xh.values(n),(function(n){var t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return xh.forIn(n,(function(n,o){var i=function(e,n){return e.node(n).width}(e,o)/2;t=Math.max(n+i,t),r=Math.min(n-i,r)})),t-r}))}(e,o);return function(e,n){var t=xh.values(n),r=xh.min(t),o=xh.max(t);xh.forEach(["u","d"],(function(t){xh.forEach(["l","r"],(function(i){var a,u=t+i,c=e[u];if(c!==n){var s=xh.values(c);(a="l"===i?r-xh.min(s):o-xh.max(s))&&(e[u]=xh.mapValues(c,(function(e){return e+a})))}}))}))}(o,i),function(e,n){return xh.mapValues(e.ul,(function(t,r){if(n)return e[n.toLowerCase()][r];var o=xh.sortBy(xh.map(e,r));return(o[1]+o[2])/2}))}(o,e.graph().align)},Nh=Ld,Oh=$d,Ph=of,Mh=function(e){switch(e.graph().ranker){case"network-simplex":default:!function(e){Tf(e)}(e);break;case"tight-tree":!function(e){Af(e),zf(e)}(e);break;case"longest-path":Bf(e)}},jh=Jd.normalizeRanks,Ih=function(e){var n=function(e){var n={},t=0;return Lf.forEach(e.children(),(function r(o){var i=t;Lf.forEach(e.children(o),r),n[o]={low:i,lim:t++}})),n}(e);Lf.forEach(e.graph().dummyChains,(function(t){for(var r=e.node(t),o=r.edgeObj,i=function(e,n,t,r){var o,i,a=[],u=[],c=Math.min(n[t].low,n[r].low),s=Math.max(n[t].lim,n[r].lim);o=t;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>c||s>n[o].lim));for(i=o,o=r;(o=e.parent(o))!==i;)u.push(o);return{path:a.concat(u.reverse()),lca:i}}(e,n,o.v,o.w),a=i.path,u=i.lca,c=0,s=a[c],l=!0;t!==o.w;){if(r=e.node(t),l){for(;(s=a[c])!==u&&e.node(s).maxRank<r.rank;)c++;s===u&&(l=!1)}if(!l){for(;c<a.length-1&&e.node(s=a[c+1]).minRank<=r.rank;)c++;s=a[c]}e.setParent(t,s),t=e.successors(t)[0]}}))},Ah=Jd.removeEmptyRanks,zh=Vf,Th=function(e){Yf.forEach(e.children(),(function n(t){var r=e.children(t),o=e.node(t);if(r.length&&Yf.forEach(r,n),Yf.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)Ff(e,"borderLeft","_bl",t,o,i),Ff(e,"borderRight","_br",t,o,i)}}))},Bh=Uf,Lh=function(e){var n=ph.maxRank(e),t=gh(e,sh.range(1,n+1),"inEdges"),r=gh(e,sh.range(n-1,-1,-1),"outEdges"),o=lh(e);mh(e,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){yh(u%2?t:r,u%4>=2),o=ph.buildLayerMatrix(e);var s=dh(e,o);s<a&&(c=0,i=sh.cloneDeep(o),a=s)}mh(e,i)},Dh=function(e){(function(e){var n=kh.buildLayerMatrix(e),t=e.graph().ranksep,r=0;Sh.forEach(n,(function(n){var o=Sh.max(Sh.map(n,(function(n){return e.node(n).height})));Sh.forEach(n,(function(n){e.node(n).y=r+o/2})),r+=o+t}))})(e=kh.asNonCompoundGraph(e)),Sh.forEach(Ch(e),(function(n,t){e.node(t).x=n}))},Rh=Jd,Vh=Od.Graph,Hh=["nodesep","edgesep","ranksep","marginx","marginy"],Yh={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Xh=["acyclicer","ranker","rankdir","align"],Fh=["width","height"],Zh={width:0,height:0},Uh=["minlen","weight","width","height","labeloffset"],Gh={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Wh=["labelpos"];function qh(e,n){return Nh.mapValues(Nh.pick(e,n),Number)}function $h(e){var n={};return Nh.forEach(e,(function(e,t){n[t.toLowerCase()]=e})),n}var Kh=Ld,Qh=Jd,Jh=Od.Graph,ev={debugOrdering:function(e){var n=Qh.buildLayerMatrix(e),t=new Jh({compound:!0,multigraph:!0}).setGraph({});return Kh.forEach(e.nodes(),(function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+e.node(n).rank)})),Kh.forEach(e.edges(),(function(e){t.setEdge(e.v,e.w,{},e.name)})),Kh.forEach(n,(function(e,n){var r="layer"+n;t.setNode(r,{rank:"same"}),Kh.reduce(e,(function(e,n){return t.setEdge(e,n,{style:"invis"}),n}))})),t}},nv=Tn({graphlib:Od,layout:function(e,n){var t=n&&n.debugTiming?Rh.time:Rh.notime;t("layout",(function(){var n=t(" buildLayoutGraph",(function(){return function(e){var n=new Vh({multigraph:!0,compound:!0}),t=$h(e.graph());return n.setGraph(Nh.merge({},Yh,qh(t,Hh),Nh.pick(t,Xh))),Nh.forEach(e.nodes(),(function(t){var r=$h(e.node(t));n.setNode(t,Nh.defaults(qh(r,Fh),Zh)),n.setParent(t,e.parent(t))})),Nh.forEach(e.edges(),(function(t){var r=$h(e.edge(t));n.setEdge(t,Nh.merge({},Gh,qh(r,Uh),Nh.pick(r,Wh)))})),n}(e)}));t(" runLayout",(function(){!function(e,n){n(" makeSpaceForEdgeLabels",(function(){!function(e){var n=e.graph();n.ranksep/=2,Nh.forEach(e.edges(),(function(t){var r=e.edge(t);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(e)})),n(" removeSelfEdges",(function(){!function(e){Nh.forEach(e.edges(),(function(n){if(n.v===n.w){var t=e.node(n.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}}))}(e)})),n(" acyclic",(function(){Oh.run(e)})),n(" nestingGraph.run",(function(){zh.run(e)})),n(" rank",(function(){Mh(Rh.asNonCompoundGraph(e))})),n(" injectEdgeLabelProxies",(function(){!function(e){Nh.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.width&&t.height){var r=e.node(n.v),o={rank:(e.node(n.w).rank-r.rank)/2+r.rank,e:n};Rh.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e)})),n(" removeEmptyRanks",(function(){Ah(e)})),n(" nestingGraph.cleanup",(function(){zh.cleanup(e)})),n(" normalizeRanks",(function(){jh(e)})),n(" assignRankMinMax",(function(){!function(e){var n=0;Nh.forEach(e.nodes(),(function(t){var r=e.node(t);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,n=Nh.max(n,r.maxRank))})),e.graph().maxRank=n}(e)})),n(" removeEdgeLabelProxies",(function(){!function(e){Nh.forEach(e.nodes(),(function(n){var t=e.node(n);"edge-proxy"===t.dummy&&(e.edge(t.e).labelRank=t.rank,e.removeNode(n))}))}(e)})),n(" normalize.run",(function(){Ph.run(e)})),n(" parentDummyChains",(function(){Ih(e)})),n(" addBorderSegments",(function(){Th(e)})),n(" order",(function(){Lh(e)})),n(" insertSelfEdges",(function(){!function(e){var n=Rh.buildLayerMatrix(e);Nh.forEach(n,(function(n){var t=0;Nh.forEach(n,(function(n,r){var o=e.node(n);o.order=r+t,Nh.forEach(o.selfEdges,(function(n){Rh.addDummyNode(e,"selfedge",{width:n.label.width,height:n.label.height,rank:o.rank,order:r+ ++t,e:n.e,label:n.label},"_se")})),delete o.selfEdges}))}))}(e)})),n(" adjustCoordinateSystem",(function(){Bh.adjust(e)})),n(" position",(function(){Dh(e)})),n(" positionSelfEdges",(function(){!function(e){Nh.forEach(e.nodes(),(function(n){var t=e.node(n);if("selfedge"===t.dummy){var r=e.node(t.e.v),o=r.x+r.width/2,i=r.y,a=t.x-o,u=r.height/2;e.setEdge(t.e,t.label),e.removeNode(n),t.label.points=[{x:o+2*a/3,y:i-u},{x:o+5*a/6,y:i-u},{x:o+a,y:i},{x:o+5*a/6,y:i+u},{x:o+2*a/3,y:i+u}],t.label.x=t.x,t.label.y=t.y}}))}(e)})),n(" removeBorderNodes",(function(){!function(e){Nh.forEach(e.nodes(),(function(n){if(e.children(n).length){var t=e.node(n),r=e.node(t.borderTop),o=e.node(t.borderBottom),i=e.node(Nh.last(t.borderLeft)),a=e.node(Nh.last(t.borderRight));t.width=Math.abs(a.x-i.x),t.height=Math.abs(o.y-r.y),t.x=i.x+t.width/2,t.y=r.y+t.height/2}})),Nh.forEach(e.nodes(),(function(n){"border"===e.node(n).dummy&&e.removeNode(n)}))}(e)})),n(" normalize.undo",(function(){Ph.undo(e)})),n(" fixupEdgeLabelCoords",(function(){!function(e){Nh.forEach(e.edges(),(function(n){var t=e.edge(n);if(Nh.has(t,"x"))switch("l"!==t.labelpos&&"r"!==t.labelpos||(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset}}))}(e)})),n(" undoCoordinateSystem",(function(){Bh.undo(e)})),n(" translateGraph",(function(){!function(e){var n=Number.POSITIVE_INFINITY,t=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),a=i.marginx||0,u=i.marginy||0;function c(e){var i=e.x,a=e.y,u=e.width,c=e.height;n=Math.min(n,i-u/2),t=Math.max(t,i+u/2),r=Math.min(r,a-c/2),o=Math.max(o,a+c/2)}Nh.forEach(e.nodes(),(function(n){c(e.node(n))})),Nh.forEach(e.edges(),(function(n){var t=e.edge(n);Nh.has(t,"x")&&c(t)})),n-=a,r-=u,Nh.forEach(e.nodes(),(function(t){var o=e.node(t);o.x-=n,o.y-=r})),Nh.forEach(e.edges(),(function(t){var o=e.edge(t);Nh.forEach(o.points,(function(e){e.x-=n,e.y-=r})),Nh.has(o,"x")&&(o.x-=n),Nh.has(o,"y")&&(o.y-=r)})),i.width=t-n+a,i.height=o-r+u}(e)})),n(" assignNodeIntersects",(function(){!function(e){Nh.forEach(e.edges(),(function(n){var t,r,o=e.edge(n),i=e.node(n.v),a=e.node(n.w);o.points?(t=o.points[0],r=o.points[o.points.length-1]):(o.points=[],t=a,r=i),o.points.unshift(Rh.intersectRect(i,t)),o.points.push(Rh.intersectRect(a,r))}))}(e)})),n(" reversePoints",(function(){!function(e){Nh.forEach(e.edges(),(function(n){var t=e.edge(n);t.reversed&&t.points.reverse()}))}(e)})),n(" acyclic.undo",(function(){Oh.undo(e)}))}(n,t)})),t(" updateInputGraph",(function(){!function(e,n){Nh.forEach(e.nodes(),(function(t){var r=e.node(t),o=n.node(t);r&&(r.x=o.x,r.y=o.y,n.children(t).length&&(r.width=o.width,r.height=o.height))})),Nh.forEach(e.edges(),(function(t){var r=e.edge(t),o=n.edge(t);r.points=o.points,Nh.has(o,"x")&&(r.x=o.x,r.y=o.y)})),e.graph().width=n.graph().width,e.graph().height=n.graph().height}(e,n)}))}))},debug:ev,util:{time:Jd.time,notime:Jd.notime},version:"0.8.5"});var tv=function(e){return null!==e&&"function"!=typeof e&&isFinite(e.length)},rv=function(e,n){return!!tv(e)&&e.indexOf(n)>-1},ov=function(e,n){if(!tv(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];n(o,r)&&t.push(o)}return t},iv={}.toString,av=function(e,n){return iv.call(e)==="[object "+n+"]"},uv=function(e){return av(e,"Function")},cv=function(e){return null==e},sv=function(e){return Array.isArray?Array.isArray(e):av(e,"Array")},lv=function(e){var n=typeof e;return null!==e&&"object"===n||"function"===n};function dv(e,n){if(e)if(sv(e))for(var t=0,r=e.length;t<r&&!1!==n(e[t],t);t++);else if(lv(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===n(e[o],o))break}var fv=Object.keys?function(e){return Object.keys(e)}:function(e){var n=[];return dv(e,(function(t,r){uv(e)&&"prototype"===r||n.push(r)})),n};function hv(e,n){var t=fv(n),r=t.length;if(cv(e))return!r;for(var o=0;o<r;o+=1){var i=t[o];if(n[i]!==e[i]||!(i in e))return!1}return!0}var vv=function(e){return"object"==typeof e&&null!==e},pv=function(e){if(!vv(e)||!av(e,"Object"))return!1;if(null===Object.getPrototypeOf(e))return!0;for(var n=e;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n},gv=function(e,n){if(void 0===n&&(n=[]),sv(e))for(var t=0;t<e.length;t+=1)gv(e[t],n);else n.push(e);return n},yv=function(e){if(sv(e))return e.reduce((function(e,n){return Math.max(e,n)}),e[0])},mv=function(e){if(sv(e))return e.reduce((function(e,n){return Math.min(e,n)}),e[0])},xv=Array.prototype,wv=xv.splice,bv=xv.indexOf,_v=Array.prototype.splice,Ev=function(e,n){if(!tv(e))return[];for(var t=e?n.length:0,r=t-1;t--;){var o=void 0,i=n[t];t!==r&&i===o||(o=i,_v.call(e,i,1))}return e},Sv=function(e,n,t){if(!sv(e)&&!pv(e))return e;var r=t;return dv(e,(function(e,t){r=n(r,e,t)})),r},kv=function(e){return av(e,"String")};function Cv(e,n){void 0===n&&(n=new Map);var t=[];if(Array.isArray(e))for(var r=0,o=e.length;r<o;r++){var i=e[r];n.has(i)||(t.push(i),n.set(i,!0))}return t}var Nv=Object.prototype.hasOwnProperty;function Ov(e,n){if(!n||!sv(e))return{};for(var t,r={},o=uv(n)?n:function(e){return e[n]},i=0;i<e.length;i++){var a=e[i];t=o(a),Nv.call(r,t)?r[t].push(a):r[t]=[a]}return r}function Pv(e,n){if(!n)return{0:e};if(!uv(n)){var t=sv(n)?n:n.replace(/\s+/g,"").split("*");n=function(e){for(var n="_",r=0,o=t.length;r<o;r++)n+=e[t[r]]&&e[t[r]].toString();return n}}return Ov(e,n)}var Mv={},jv=function(e){return av(e,"Number")},Iv=Number.isInteger?Number.isInteger:function(e){return jv(e)&&e%1==0},Av=180/Math.PI,zv=parseInt,Tv=Math.PI/180,Bv=function(e,n){return e.hasOwnProperty(n)},Lv=Object.values?function(e){return Object.values(e)}:function(e){var n=[];return dv(e,(function(t,r){uv(e)&&"prototype"===r||n.push(t)})),n},Dv=function(e){return cv(e)?"":e.toString()},Rv={}.toString,Vv=function(e){return Rv.call(e).replace(/^\[object /,"").replace(/]$/,"")},Hv=Object.prototype,Yv=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||Hv)};function Xv(e,n){for(var t in n)n.hasOwnProperty(t)&&"constructor"!==t&&void 0!==n[t]&&(e[t]=n[t])}function Fv(e,n,t,r){return n&&Xv(e,n),t&&Xv(e,t),r&&Xv(e,r),e}var Zv=function(e){if("object"!=typeof e||null===e)return e;var n;if(sv(e)){n=[];for(var t=0,r=e.length;t<r;t++)"object"==typeof e[t]&&null!=e[t]?n[t]=Zv(e[t]):n[t]=e[t]}else for(var o in n={},e)"object"==typeof e[o]&&null!=e[o]?n[o]=Zv(e[o]):n[o]=e[o];return n},Uv=function(e,n){if(!uv(e))throw new TypeError("Expected a function");var t=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=n?n.apply(this,r):r[0],a=t.cache;if(a.has(i))return a.get(i);var u=e.apply(this,r);return a.set(i,u),u};return t.cache=new Map,t};function Gv(e,n,t,r){for(var o in t=t||0,r=r||5,n)if(n.hasOwnProperty(o)){var i=n[o];null!==i&&pv(i)?(pv(e[o])||(e[o]={}),t<r?Gv(e[o],i,t+1,r):e[o]=n[o]):sv(i)?(e[o]=[],e[o]=e[o].concat(i)):void 0!==i&&(e[o]=i)}}var Wv,qv=Object.prototype.hasOwnProperty,$v=function(e,n){if(e===n)return!0;if(!e||!n)return!1;if(kv(e)||kv(n))return!1;if(tv(e)||tv(n)){if(e.length!==n.length)return!1;for(var t=!0,r=0;r<e.length&&(t=$v(e[r],n[r]));r++);return t}if(vv(e)||vv(n)){var o=Object.keys(e),i=Object.keys(n);if(o.length!==i.length)return!1;for(t=!0,r=0;r<o.length&&(t=$v(e[o[r]],n[o[r]]));r++);return t}return!1},Kv=function(e){return e},Qv=Object.prototype.hasOwnProperty,Jv={},ep=function(){return ep=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},ep.apply(this,arguments)};function np(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],r=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function tp(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function rp(e,n,t){if(2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var op=Uv((function(e,n){void 0===n&&(n={});var t=n.fontSize,r=n.fontFamily,o=n.fontWeight,i=n.fontStyle,a=n.fontVariant;return Wv||(Wv=document.createElement("canvas").getContext("2d")),Wv.font=[i,a,o,t+"px",r].join(" "),Wv.measureText(kv(e)?e:"").width}),(function(e,n){return void 0===n&&(n={}),function(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),o=0;for(n=0;n<t;n++)for(var i=arguments[n],a=0,u=i.length;a<u;a++,o++)r[o]=i[a];return r}([e],Lv(n)).join("")})),ip=function(){function e(){this.map={}}return e.prototype.has=function(e){return void 0!==this.map[e]},e.prototype.get=function(e,n){var t=this.map[e];return void 0===t?n:t},e.prototype.set=function(e,n){this.map[e]=n},e.prototype.clear=function(){this.map={}},e.prototype.delete=function(e){delete this.map[e]},e.prototype.size=function(){return Object.keys(this.map).length},e}(),ap=Object.freeze({__proto__:null,Cache:ip,assign:Fv,augment:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t=e[0],r=1;r<e.length;r++){var o=e[r];uv(o)&&(o=o.prototype),Fv(t.prototype,o)}},clamp:function(e,n,t){return e<n?n:e>t?t:e},clearAnimationFrame:function(e){(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout)(e)},clone:Zv,contains:rv,debounce:function(e,n,t){var r;return function(){var o=this,i=arguments,a=t&&!r;clearTimeout(r),r=setTimeout((function(){r=null,t||e.apply(o,i)}),n),a&&e.apply(o,i)}},deepMix:function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];for(var r=0;r<n.length;r+=1)Gv(e,n[r]);return e},difference:function(e,n){return void 0===n&&(n=[]),ov(e,(function(e){return!rv(n,e)}))},each:dv,endsWith:function(e,n){return!(!sv(e)&&!kv(e))&&e[e.length-1]===n},every:function(e,n){for(var t=0;t<e.length;t++)if(!n(e[t],t))return!1;return!0},extend:function(e,n,t,r){uv(n)||(t=n,n=e,e=function(){});var o=Object.create?function(e,n){return Object.create(e,{constructor:{value:n}})}:function(e,n){function t(){}t.prototype=e;var r=new t;return r.constructor=n,r},i=o(n.prototype,e);return e.prototype=Fv(i,e.prototype),e.superclass=o(n.prototype,n),Fv(i,t),Fv(e,r),e},filter:ov,find:function(e,n){if(!sv(e))return null;var t;if(uv(n)&&(t=n),pv(n)&&(t=function(e){return hv(e,n)}),t)for(var r=0;r<e.length;r+=1)if(t(e[r]))return e[r];return null},findIndex:function(e,n,t){void 0===t&&(t=0);for(var r=t;r<e.length;r++)if(n(e[r],r))return r;return-1},firstValue:function(e,n){for(var t=null,r=0;r<e.length;r++){var o=e[r][n];if(!cv(o)){t=sv(o)?o[0]:o;break}}return t},fixedBase:function(e,n){var t=n.toString(),r=t.indexOf(".");if(-1===r)return Math.round(e);var o=t.substr(r+1).length;return o>20&&(o=20),parseFloat(e.toFixed(o))},flatten:function(e){if(!sv(e))return[];for(var n=[],t=0;t<e.length;t++)n=n.concat(e[t]);return n},flattenDeep:gv,forIn:dv,get:function(e,n,t){for(var r=0,o=kv(n)?n.split("."):n;e&&r<o.length;)e=e[o[r++]];return void 0===e||r<o.length?t:e},getEllipsisText:function(e,n,t,r){void 0===r&&(r="...");var o,i,a=op(r,t),u=kv(e)?e:Dv(e),c=n,s=[];if(op(e,t)<=n)return e;for(;o=u.substr(0,16),!((i=op(o,t))+a>c&&i>c);)if(s.push(o),c-=i,!(u=u.substr(16)))return s.join("");for(;o=u.substr(0,1),!((i=op(o,t))+a>c);)if(s.push(o),c-=i,!(u=u.substr(1)))return s.join("");return""+s.join("")+r},getRange:function(e){var n=e.filter((function(e){return!isNaN(e)}));if(!n.length)return{min:0,max:0};if(sv(e[0])){for(var t=[],r=0;r<e.length;r++)t=t.concat(e[r]);n=t}var o=yv(n);return{min:mv(n),max:o}},getType:Vv,getWrapBehavior:function(e,n){return e["_wrap_"+n]},group:function(e,n){if(!n)return[e];var t=Pv(e,n),r=[];for(var o in t)r.push(t[o]);return r},groupBy:Ov,groupToMap:Pv,has:Bv,hasKey:Bv,hasValue:function(e,n){return rv(Lv(e),n)},head:function(e){if(tv(e))return e[0]},identity:function(e){return e},includes:rv,indexOf:function(e,n){if(!tv(e))return-1;var t=Array.prototype.indexOf;if(t)return t.call(e,n);for(var r=-1,o=0;o<e.length;o++)if(e[o]===n){r=o;break}return r},isArguments:function(e){return av(e,"Arguments")},isArray:sv,isArrayLike:tv,isBoolean:function(e){return av(e,"Boolean")},isDate:function(e){return av(e,"Date")},isDecimal:function(e){return jv(e)&&e%1!=0},isElement:function(e){return e instanceof Element||e instanceof HTMLDocument},isEmpty:function(e){if(cv(e))return!0;if(tv(e))return!e.length;var n=Vv(e);if("Map"===n||"Set"===n)return!e.size;if(Yv(e))return!Object.keys(e).length;for(var t in e)if(qv.call(e,t))return!1;return!0},isEqual:$v,isEqualWith:function(e,n,t){return uv(t)?!!t(e,n):$v(e,n)},isError:function(e){return av(e,"Error")},isEven:function(e){return jv(e)&&e%2==0},isFinite:function(e){return jv(e)&&isFinite(e)},isFunction:uv,isInteger:Iv,isMatch:hv,isNegative:function(e){return jv(e)&&e<0},isNil:cv,isNull:function(e){return null===e},isNumber:jv,isNumberEqual:function(e,n,t){return void 0===t&&(t=1e-5),Math.abs(e-n)<t},isObject:lv,isObjectLike:vv,isOdd:function(e){return jv(e)&&e%2!=0},isPlainObject:pv,isPositive:function(e){return jv(e)&&e>0},isPrototype:Yv,isRegExp:function(e){return av(e,"RegExp")},isString:kv,isType:av,isUndefined:function(e){return void 0===e},keys:fv,last:function(e){if(tv(e))return e[e.length-1]},lowerCase:function(e){return Dv(e).toLowerCase()},lowerFirst:function(e){var n=Dv(e);return n.charAt(0).toLowerCase()+n.substring(1)},map:function(e,n){if(!tv(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];t.push(n(o,r))}return t},mapValues:function(e,n){void 0===n&&(n=Kv);var t={};return lv(e)&&!cv(e)&&Object.keys(e).forEach((function(r){t[r]=n(e[r],r)})),t},max:yv,maxBy:function(e,n){if(sv(e)){for(var t,r=-1/0,o=0;o<e.length;o++){var i=e[o],a=uv(n)?n(i):i[n];a>r&&(t=i,r=a)}return t}},measureTextWidth:op,memoize:Uv,min:mv,minBy:function(e,n){if(sv(e)){for(var t,r=1/0,o=0;o<e.length;o++){var i=e[o],a=uv(n)?n(i):i[n];a<r&&(t=i,r=a)}return t}},mix:Fv,mod:function(e,n){return(e%n+n)%n},noop:function(){},number2color:function(e){var n=Mv[e];if(!n){for(var t=e.toString(16),r=t.length;r<6;r++)t="0"+t;n="#"+t,Mv[e]=n}return n},omit:function(e,n){return Sv(e,(function(e,t,r){return n.includes(r)||(e[r]=t),e}),{})},parseRadius:function(e){var n=0,t=0,r=0,o=0;return sv(e)?1===e.length?n=t=r=o=e[0]:2===e.length?(n=r=e[0],t=o=e[1]):3===e.length?(n=e[0],t=o=e[1],r=e[2]):(n=e[0],t=e[1],r=e[2],o=e[3]):n=t=r=o=e,{r1:n,r2:t,r3:r,r4:o}},pick:function(e,n){if(null===e||!pv(e))return{};var t={};return dv(n,(function(n){Qv.call(e,n)&&(t[n]=e[n])})),t},pull:function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];for(var r=0;r<n.length;r++)for(var o=n[r],i=-1;(i=bv.call(e,o))>-1;)wv.call(e,i,1);return e},pullAt:Ev,reduce:Sv,remove:function(e,n){var t=[];if(!tv(e))return t;for(var r=-1,o=[],i=e.length;++r<i;){var a=e[r];n(a,r,e)&&(t.push(a),o.push(r))}return Ev(e,o),t},requestAnimationFrame:function(e){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return setTimeout(e,16)})(e)},set:function(e,n,t){var r=e,o=kv(n)?n.split("."):n;return o.forEach((function(e,n){n<o.length-1?(lv(r[e])||(r[e]=jv(o[n+1])?[]:{}),r=r[e]):r[e]=t})),e},size:function(e){return cv(e)?0:tv(e)?e.length:Object.keys(e).length},some:function(e,n){for(var t=0;t<e.length;t++)if(n(e[t],t))return!0;return!1},sortBy:function(e,n){var t;if(uv(n))t=function(e,t){return n(e)-n(t)};else{var r=[];kv(n)?r.push(n):sv(n)&&(r=n),t=function(e,n){for(var t=0;t<r.length;t+=1){var o=r[t];if(e[o]>n[o])return 1;if(e[o]<n[o])return-1}return 0}}return e.sort(t),e},startsWith:function(e,n){return!(!sv(e)&&!kv(e))&&e[0]===n},substitute:function(e,n){return e&&n?e.replace(/\\?\{([^{}]+)\}/g,(function(e,t){return"\\"===e.charAt(0)?e.slice(1):void 0===n[t]?"":n[t]})):e},throttle:function(e,n,t){var r,o,i,a,u=0;t||(t={});var c=function(){u=!1===t.leading?0:Date.now(),r=null,a=e.apply(o,i),r||(o=i=null)},s=function(){var s=Date.now();u||!1!==t.leading||(u=s);var l=n-(s-u);return o=this,i=arguments,l<=0||l>n?(r&&(clearTimeout(r),r=null),u=s,a=e.apply(o,i),r||(o=i=null)):r||!1===t.trailing||(r=setTimeout(c,l)),a};return s.cancel=function(){clearTimeout(r),u=0,r=o=i=null},s},toArray:function(e){return tv(e)?Array.prototype.slice.call(e):[]},toDegree:function(e){return Av*e},toInteger:zv,toRadian:function(e){return Tv*e},toString:Dv,union:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Cv([].concat.apply([],e))},uniq:Cv,uniqueId:function(e){return Jv[e=e||"g"]?Jv[e]+=1:Jv[e]=1,e+Jv[e]},upperCase:function(e){return Dv(e).toUpperCase()},upperFirst:function(e){var n=Dv(e);return n.charAt(0).toUpperCase()+n.substring(1)},values:Lv,valuesOfKey:function(e,n){for(var t=[],r={},o=0;o<e.length;o++){var i=e[o][n];if(!cv(i)){sv(i)||(i=[i]);for(var a=0;a<i.length;a++){var u=i[a];r[u]||(t.push(u),r[u]=!0)}}}return t},wrapBehavior:function(e,n){if(e["_wrap_"+n])return e["_wrap_"+n];var t=function(t){e[n](t)};return e["_wrap_"+n]=t,t}}),up={assign:function(e){if(e.__esModule)return e;var n=e.default;if("function"==typeof n){var t=function e(){return this instanceof e?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}(ap).mix,getHeight:function(e,n,t,r){return void 0===r&&(r="height"),"center"===t?(e[r]+n[r])/2:e.height}},cp=up,sp={getId:function(e){return e.id||e.name},getPreH:function(e){return e.preH||0},getPreV:function(e){return e.preV||0},getHGap:function(e){return e.hgap||18},getVGap:function(e){return e.vgap||18},getChildren:function(e){return e.children},getHeight:function(e){return e.height||36},getWidth:function(e){var n=e.label||" ";return e.width||18*n.split("").length}};function lp(e,n){var t=this;if(t.vgap=t.hgap=0,e instanceof lp)return e;t.data=e;var r=n.getHGap(e),o=n.getVGap(e);return t.preH=n.getPreH(e),t.preV=n.getPreV(e),t.width=n.getWidth(e),t.height=n.getHeight(e),t.width+=t.preH,t.height+=t.preV,t.id=n.getId(e),t.x=t.y=0,t.depth=0,t.children||(t.children=[]),t.addGap(r,o),t}cp.assign(lp.prototype,{isRoot:function(){return 0===this.depth},isLeaf:function(){return 0===this.children.length},addGap:function(e,n){var t=this;t.hgap+=e,t.vgap+=n,t.width+=2*e,t.height+=2*n},eachNode:function(e){for(var n,t=[this];n=t.shift();)e(n),t=n.children.concat(t)},DFTraverse:function(e){this.eachNode(e)},BFTraverse:function(e){for(var n,t=[this];n=t.shift();)e(n),t=t.concat(n.children)},getBoundingBox:function(){var e={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode((function(n){e.left=Math.min(e.left,n.x),e.top=Math.min(e.top,n.y),e.width=Math.max(e.width,n.x+n.width),e.height=Math.max(e.height,n.y+n.height)})),e},translate:function(e,n){void 0===e&&(e=0),void 0===n&&(n=0),this.eachNode((function(t){t.x+=e,t.y+=n,t.x+=t.preH,t.y+=t.preV}))},right2left:function(){var e=this,n=e.getBoundingBox();e.eachNode((function(e){e.x=e.x-2*(e.x-n.left)-e.width})),e.translate(n.width,0)},bottom2top:function(){var e=this,n=e.getBoundingBox();e.eachNode((function(e){e.y=e.y-2*(e.y-n.top)-e.height})),e.translate(0,n.height)}});var dp=function(e,n,t){void 0===n&&(n={});var r,o=new lp(e,n=cp.assign({},sp,n)),i=[o];if(!t&&!e.collapsed)for(;r=i.shift();)if(!r.data.collapsed){var a=n.getChildren(r.data),u=a?a.length:0;if(r.children=new Array(u),a&&u)for(var c=0;c<u;c++){var s=new lp(a[c],n);r.children[c]=s,i.push(s),s.parent=r,s.depth=r.depth+1}}return o},fp=dp,hp=function(){function e(e,n){void 0===n&&(n={}),this.options=n,this.rootNode=fp(e,n)}return e.prototype.execute=function(){throw new Error("please override this method")},e}(),vp=hp;function pp(e,n,t,r){void 0===r&&(r=[]);var o=this;o.w=e||0,o.h=n||0,o.y=t||0,o.x=0,o.c=r||[],o.cs=r.length,o.prelim=0,o.mod=0,o.shift=0,o.change=0,o.tl=null,o.tr=null,o.el=null,o.er=null,o.msel=0,o.mser=0}function gp(e,n,t){t?e.y+=n:e.x+=n,e.children.forEach((function(e){gp(e,n,t)}))}function yp(e,n){var t=n?e.y:e.x;return e.children.forEach((function(e){t=Math.min(yp(e,n),t)})),t}function mp(e,n){gp(e,-yp(e,n),n)}function xp(e,n,t){t?n.y=e.x:n.x=e.x,e.c.forEach((function(e,r){xp(e,n.children[r],t)}))}function wp(e,n,t){void 0===t&&(t=0),n?(e.x=t,t+=e.width):(e.y=t,t+=e.height),e.children.forEach((function(e){wp(e,n,t)}))}pp.fromNode=function(e,n){if(!e)return null;var t=[];return e.children.forEach((function(e){t.push(pp.fromNode(e,n))})),n?new pp(e.height,e.width,e.x,t):new pp(e.width,e.height,e.y,t)};var bp=dp,_p=function(e,n){for(var t=bp(e.data,n,!0),r=bp(e.data,n,!0),o=e.children.length,i=Math.round(o/2),a=n.getSide||function(e,n){return n<i?"right":"left"},u=0;u<o;u++){var c=e.children[u];"right"===a(c,u)?r.children.push(c):t.children.push(c)}return t.eachNode((function(e){e.isRoot()||(e.side="left")})),r.eachNode((function(e){e.isRoot()||(e.side="right")})),{left:t,right:r}},Ep=_p,Sp=["LR","RL","TB","BT","H","V"],kp=["LR","RL","H"],Cp=Sp[0],Np=function(e,n,t){var r=n.direction||Cp;if(n.isHorizontal=function(e){return kp.indexOf(e)>-1}(r),r&&-1===Sp.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===Sp[0])t(e,n);else if(r===Sp[1])t(e,n),e.right2left();else if(r===Sp[2])t(e,n);else if(r===Sp[3])t(e,n),e.bottom2top();else if(r===Sp[4]||r===Sp[5]){var o=Ep(e,n),i=o.left,a=o.right;t(i,n),t(a,n),n.isHorizontal?i.right2left():i.bottom2top(),a.translate(i.x-a.x,i.y-a.y),e.x=i.x,e.y=a.y;var u=e.getBoundingBox();n.isHorizontal?u.top<0&&e.translate(0,-u.top):u.left<0&&e.translate(-u.left,0)}var c=n.fixedRoot;return void 0===c&&(c=!0),c&&e.translate(-(e.x+e.width/2+e.hgap),-(e.y+e.height/2+e.vgap)),e};function Op(e,n){return Op=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Op(e,n)}var Pp=function(e,n){void 0===n&&(n={});var t=n.isHorizontal;function r(e){0===e.cs?(e.el=e,e.er=e,e.msel=e.mser=0):(e.el=e.c[0].el,e.msel=e.c[0].msel,e.er=e.c[e.cs-1].er,e.mser=e.c[e.cs-1].mser)}function o(e,n,t){for(var r=e.c[n-1],o=r.mod,s=e.c[n],l=s.mod;null!==r&&null!==s;){c(r)>t.low&&(t=t.nxt);var d=o+r.prelim+r.w-(l+s.prelim);d>0&&(l+=d,i(e,n,t.index,d));var f=c(r),h=c(s);f<=h&&null!==(r=u(r))&&(o+=r.mod),f>=h&&null!==(s=a(s))&&(l+=s.mod)}!r&&s?function(e,n,t,r){var o=e.c[0].el;o.tl=t;var i=r-t.mod-e.c[0].msel;o.mod+=i,o.prelim-=i,e.c[0].el=e.c[n].el,e.c[0].msel=e.c[n].msel}(e,n,s,l):r&&!s&&function(e,n,t,r){var o=e.c[n].er;o.tr=t;var i=r-t.mod-e.c[n].mser;o.mod+=i,o.prelim-=i,e.c[n].er=e.c[n-1].er,e.c[n].mser=e.c[n-1].mser}(e,n,r,o)}function i(e,n,t,r){e.c[n].mod+=r,e.c[n].msel+=r,e.c[n].mser+=r,function(e,n,t,r){if(t!==n-1){var o=n-t;e.c[t+1].shift+=r/o,e.c[n].shift-=r/o,e.c[n].change-=r-r/o}}(e,n,t,r)}function a(e){return 0===e.cs?e.tl:e.c[0]}function u(e){return 0===e.cs?e.tr:e.c[e.cs-1]}function c(e){return e.y+e.h}function s(e,n,t){for(;null!==t&&e>=t.low;)t=t.nxt;return{low:e,index:n,nxt:t}}wp(e,t);var l=pp.fromNode(e,t);return function e(n){if(0!==n.cs){e(n.c[0]);for(var t=s(c(n.c[0].el),0,null),i=1;i<n.cs;++i){e(n.c[i]);var a=c(n.c[i].er);o(n,i,t),t=s(a,i,t)}!function(e){e.prelim=(e.c[0].prelim+e.c[0].mod+e.c[e.cs-1].mod+e.c[e.cs-1].prelim+e.c[e.cs-1].w)/2-e.w/2}(n),r(n)}else r(n)}(l),function e(n,t){t+=n.mod,n.x=n.prelim+t,function(e){for(var n=0,t=0,r=0;r<e.cs;r++)t+=(n+=e.c[r].shift)+e.c[r].change,e.c[r].mod+=t}(n);for(var r=0;r<n.cs;r++)e(n.c[r],t)}(l,0),xp(l,e,t),mp(e,t),e},Mp=Np,jp=up,Ip=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,Op(n,t),r.prototype.execute=function(){return Mp(this.rootNode,this.options,Pp)},r}(vp),Ap={},zp=up;function Tp(e,n){void 0===n&&(n=[]);var t=this;t.x=t.y=0,t.leftChild=t.rightChild=null,t.height=0,t.children=n}var Bp={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function Lp(e,n,t){t?(n.x=e.x,n.y=e.y):(n.x=e.y,n.y=e.x),e.children.forEach((function(e,r){Lp(e,n.children[r],t)}))}function Dp(e,n){return Dp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Dp(e,n)}var Rp=function(e,n){void 0===n&&(n={}),n=zp.assign({},Bp,n);var t,r=0,o=function e(n){if(!n)return null;n.width=0,n.depth&&n.depth>r&&(r=n.depth);var t=n.children,o=t.length,i=new Tp(n.height,[]);return t.forEach((function(n,t){var r=e(n);i.children.push(r),0===t&&(i.leftChild=r),t===o-1&&(i.rightChild=r)})),i.originNode=n,i.isLeaf=n.isLeaf(),i}(e);return function e(n){if(n.isLeaf||0===n.children.length)n.drawingDepth=r;else{var t=n.children.map((function(n){return e(n)})),o=Math.min.apply(null,t);n.drawingDepth=o-1}return n.drawingDepth}(o),function e(r){r.x=r.drawingDepth*n.rankSep,r.isLeaf?(r.y=0,t&&(r.y=t.y+t.height+n.nodeSep,r.originNode.parent!==t.originNode.parent&&(r.y+=n.subTreeSep)),t=r):(r.children.forEach((function(n){e(n)})),r.y=(r.leftChild.y+r.rightChild.y)/2)}(o),Lp(o,e,n.isHorizontal),e},Vp=Np,Hp=up,Yp=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,Dp(n,t),r.prototype.execute=function(){var e=this;return e.rootNode.width=0,Vp(e.rootNode,e.options,Rp)},r}(vp),Xp={},Fp=up;function Zp(e,n){return Zp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Zp(e,n)}var Up=vp,Gp=function(e,n,t,r){var o=null;e.eachNode((function(e){!function(e,n,t,r,o){var i="function"==typeof t?t(e):t*e.depth;if(!r)try{if(e.id===e.parent.children[0].id)return e.x+=i,void(e.y=n?n.y:0)}catch(e){}if(e.x+=i,n){if(e.y=n.y+Fp.getHeight(n,e,o),n.parent&&e.parent.id!==n.parent.id){var a=n.parent,u=a.y+Fp.getHeight(a,e,o);e.y=u>e.y?u:e.y}}else e.y=0}(e,o,n,t,r),o=e}))},Wp=_p,qp=up,$p=["LR","RL","H"],Kp=$p[0],Qp=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,Zp(n,t),r.prototype.execute=function(){var e=this.options,n=this.rootNode;e.isHorizontal=!0;var t=e.indent,r=void 0===t?20:t,o=e.dropCap,i=void 0===o||o,a=e.direction,u=void 0===a?Kp:a,c=e.align;if(u&&-1===$p.indexOf(u))throw new TypeError("Invalid direction: "+u);if(u===$p[0])Gp(n,r,i,c);else if(u===$p[1])Gp(n,r,i,c),n.right2left();else if(u===$p[2]){var s=Wp(n,e),l=s.left,d=s.right;Gp(l,r,i,c),l.right2left(),Gp(d,r,i,c);var f=l.getBoundingBox();d.translate(f.width,0),n.x=d.x-n.width/2}return n},r}(Up),Jp={},eg=up;function ng(e,n){var t=0;return e.children.length?e.children.forEach((function(e){t+=ng(e,n)})):t=e.height,e._subTreeSep=n.getSubTreeSep(e.data),e.totalHeight=Math.max(e.height,t)+2*e._subTreeSep,e.totalHeight}function tg(e){var n=e.children,t=n.length;if(t){n.forEach((function(e){tg(e)}));var r=n[0],o=n[t-1],i=o.y-r.y+o.height,a=0;if(n.forEach((function(e){a+=e.totalHeight})),i>e.height)e.y=r.y+i/2-e.height/2;else if(1!==n.length||e.height>a){var u=e.y+(e.height-i)/2-r.y;n.forEach((function(e){e.translate(0,u)}))}else e.y=(r.y+r.height/2+o.y+o.height/2)/2-e.height/2}}var rg={getSubTreeSep:function(){return 0}};function og(e,n){return og=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},og(e,n)}var ig=function(e,n){void 0===n&&(n={}),n=eg.assign({},rg,n),e.parent={x:0,width:0,height:0,y:0},e.BFTraverse((function(e){e.x=e.parent.x+e.parent.width})),e.parent=null,ng(e,n),e.startY=0,e.y=e.totalHeight/2-e.height/2,e.eachNode((function(e){var n=e.children,t=n.length;if(t){var r=n[0];if(r.startY=e.startY+e._subTreeSep,1===t)r.y=e.y+e.height/2-r.height/2;else{r.y=r.startY+r.totalHeight/2-r.height/2;for(var o=1;o<t;o++){var i=n[o];i.startY=n[o-1].startY+n[o-1].totalHeight,i.y=i.startY+i.totalHeight/2-i.height/2}}}})),tg(e)},ag=Np,ug=up,cg=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,og(n,t),r.prototype.execute=function(){return ag(this.rootNode,this.options,ig)},r}(vp),sg={};Tn({compactBox:function(e,n){return n=jp.assign({},Ap,n),new Ip(e,n).execute()},dendrogram:function(e,n){return n=Hp.assign({},Xp,n),new Yp(e,n).execute()},indented:function(e,n){return n=qp.assign({},Jp,n),new Qp(e,n).execute()},mindmap:function(e,n){return n=ug.assign({},sg,n),new cg(e,n).execute()}});var lg={value:()=>{}};function dg(){for(var e,n=0,t=arguments.length,r={};n<t;++n){if(!(e=arguments[n]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new fg(r)}function fg(e){this._=e}function hg(e,n){for(var t,r=0,o=e.length;r<o;++r)if((t=e[r]).name===n)return t.value}function vg(e,n,t){for(var r=0,o=e.length;r<o;++r)if(e[r].name===n){e[r]=lg,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=t&&e.push({name:n,value:t}),e}fg.prototype=dg.prototype={constructor:fg,on:function(e,n){var t,r,o=this._,i=(r=o,(e+"").trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");if(t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(t=(e=i[a]).type)o[t]=vg(o[t],e.name,n);else if(null==n)for(t in o)o[t]=vg(o[t],e.name,null);return this}for(;++a<u;)if((t=(e=i[a]).type)&&(t=hg(o[t],e.name)))return t},copy:function(){var e={},n=this._;for(var t in n)e[t]=n[t].slice();return new fg(e)},call:function(e,n){if((t=arguments.length-2)>0)for(var t,r,o=new Array(t),i=0;i<t;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,t=(r=this._[e]).length;i<t;++i)r[i].value.apply(n,o)},apply:function(e,n,t){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(n,t)}};var pg="http://www.w3.org/1999/xhtml",gg={svg:"http://www.w3.org/2000/svg",xhtml:pg,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function yg(e){var n=e+="",t=n.indexOf(":");return t>=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),gg.hasOwnProperty(n)?{space:gg[n],local:e}:e}function mg(e){return function(){var n=this.ownerDocument,t=this.namespaceURI;return t===pg&&n.documentElement.namespaceURI===pg?n.createElement(e):n.createElementNS(t,e)}}function xg(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function wg(e){var n=yg(e);return(n.local?xg:mg)(n)}function bg(){}function _g(e){return null==e?bg:function(){return this.querySelector(e)}}function Eg(){return[]}function Sg(e){return null==e?Eg:function(){return this.querySelectorAll(e)}}function kg(e){return function(){return this.matches(e)}}function Cg(e){return function(n){return n.matches(e)}}var Ng=Array.prototype.find;function Og(){return this.firstElementChild}var Pg=Array.prototype.filter;function Mg(){return Array.from(this.children)}function jg(e){return new Array(e.length)}function Ig(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}function Ag(e,n,t,r,o,i){for(var a,u=0,c=n.length,s=i.length;u<s;++u)(a=n[u])?(a.__data__=i[u],r[u]=a):t[u]=new Ig(e,i[u]);for(;u<c;++u)(a=n[u])&&(o[u]=a)}function zg(e,n,t,r,o,i,a){var u,c,s,l=new Map,d=n.length,f=i.length,h=new Array(d);for(u=0;u<d;++u)(c=n[u])&&(h[u]=s=a.call(c,c.__data__,u,n)+"",l.has(s)?o[u]=c:l.set(s,c));for(u=0;u<f;++u)s=a.call(e,i[u],u,i)+"",(c=l.get(s))?(r[u]=c,c.__data__=i[u],l.delete(s)):t[u]=new Ig(e,i[u]);for(u=0;u<d;++u)(c=n[u])&&l.get(h[u])===c&&(o[u]=c)}function Tg(e){return e.__data__}function Bg(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Lg(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function Dg(e){return function(){this.removeAttribute(e)}}function Rg(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Vg(e,n){return function(){this.setAttribute(e,n)}}function Hg(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function Yg(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}function Xg(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,t)}}function Fg(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Zg(e){return function(){this.style.removeProperty(e)}}function Ug(e,n,t){return function(){this.style.setProperty(e,n,t)}}function Gg(e,n,t){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,t)}}function Wg(e,n){return e.style.getPropertyValue(n)||Fg(e).getComputedStyle(e,null).getPropertyValue(n)}function qg(e){return function(){delete this[e]}}function $g(e,n){return function(){this[e]=n}}function Kg(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}function Qg(e){return e.trim().split(/^|\s+/)}function Jg(e){return e.classList||new ey(e)}function ey(e){this._node=e,this._names=Qg(e.getAttribute("class")||"")}function ny(e,n){for(var t=Jg(e),r=-1,o=n.length;++r<o;)t.add(n[r])}function ty(e,n){for(var t=Jg(e),r=-1,o=n.length;++r<o;)t.remove(n[r])}function ry(e){return function(){ny(this,e)}}function oy(e){return function(){ty(this,e)}}function iy(e,n){return function(){(n.apply(this,arguments)?ny:ty)(this,e)}}function ay(){this.textContent=""}function uy(e){return function(){this.textContent=e}}function cy(e){return function(){var n=e.apply(this,arguments);this.textContent=null==n?"":n}}function sy(){this.innerHTML=""}function ly(e){return function(){this.innerHTML=e}}function dy(e){return function(){var n=e.apply(this,arguments);this.innerHTML=null==n?"":n}}function fy(){this.nextSibling&&this.parentNode.appendChild(this)}function hy(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function vy(){return null}function py(){var e=this.parentNode;e&&e.removeChild(this)}function gy(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function yy(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function my(e){return function(){var n=this.__on;if(n){for(var t,r=0,o=-1,i=n.length;r<i;++r)t=n[r],e.type&&t.type!==e.type||t.name!==e.name?n[++o]=t:this.removeEventListener(t.type,t.listener,t.options);++o?n.length=o:delete this.__on}}}function xy(e,n,t){return function(){var r,o=this.__on,i=function(e){return function(n){e.call(this,n,this.__data__)}}(n);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=t),void(r.value=n);this.addEventListener(e.type,i,t),r={type:e.type,name:e.name,value:n,listener:i,options:t},o?o.push(r):this.__on=[r]}}function wy(e,n,t){var r=Fg(e),o=r.CustomEvent;"function"==typeof o?o=new o(n,t):(o=r.document.createEvent("Event"),t?(o.initEvent(n,t.bubbles,t.cancelable),o.detail=t.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function by(e,n){return function(){return wy(this,e,n)}}function _y(e,n){return function(){return wy(this,e,n.apply(this,arguments))}}Ig.prototype={constructor:Ig,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},ey.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var Ey=[null];function Sy(e,n){this._groups=e,this._parents=n}function ky(){return new Sy([[document.documentElement]],Ey)}function Cy(e){return"string"==typeof e?new Sy([[document.querySelector(e)]],[document.documentElement]):new Sy([[e]],Ey)}function Ny(e,n){if(e=function(e){let n;for(;n=e.sourceEvent;)e=n;return e}(e),void 0===n&&(n=e.currentTarget),n){var t=n.ownerSVGElement||n;if(t.createSVGPoint){var r=t.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}Sy.prototype=ky.prototype={constructor:Sy,select:function(e){"function"!=typeof e&&(e=_g(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a,u=n[o],c=u.length,s=r[o]=new Array(c),l=0;l<c;++l)(i=u[l])&&(a=e.call(i,i.__data__,l,u))&&("__data__"in i&&(a.__data__=i.__data__),s[l]=a);return new Sy(r,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return null==(n=e.apply(this,arguments))?[]:Array.isArray(n)?n:Array.from(n);var n}}(e):Sg(e);for(var n=this._groups,t=n.length,r=[],o=[],i=0;i<t;++i)for(var a,u=n[i],c=u.length,s=0;s<c;++s)(a=u[s])&&(r.push(e.call(a,a.__data__,s,u)),o.push(a));return new Sy(r,o)},selectChild:function(e){return this.select(null==e?Og:function(e){return function(){return Ng.call(this.children,e)}}("function"==typeof e?e:Cg(e)))},selectChildren:function(e){return this.selectAll(null==e?Mg:function(e){return function(){return Pg.call(this.children,e)}}("function"==typeof e?e:Cg(e)))},filter:function(e){"function"!=typeof e&&(e=kg(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],s=0;s<u;++s)(i=a[s])&&e.call(i,i.__data__,s,a)&&c.push(i);return new Sy(r,this._parents)},data:function(e,n){if(!arguments.length)return Array.from(this,Tg);var t,r=n?zg:Ag,o=this._parents,i=this._groups;"function"!=typeof e&&(t=e,e=function(){return t});for(var a=i.length,u=new Array(a),c=new Array(a),s=new Array(a),l=0;l<a;++l){var d=o[l],f=i[l],h=f.length,v=Bg(e.call(d,d&&d.__data__,l,o)),p=v.length,g=c[l]=new Array(p),y=u[l]=new Array(p);r(d,f,g,y,s[l]=new Array(h),v,n);for(var m,x,w=0,b=0;w<p;++w)if(m=g[w]){for(w>=b&&(b=w+1);!(x=y[b])&&++b<p;);m._next=x||null}}return(u=new Sy(u,o))._enter=c,u._exit=s,u},enter:function(){return new Sy(this._enter||this._groups.map(jg),this._parents)},exit:function(){return new Sy(this._exit||this._groups.map(jg),this._parents)},join:function(e,n,t){var r=this.enter(),o=this,i=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=n&&(o=n(o))&&(o=o.selection()),null==t?i.remove():t(i),r&&o?r.merge(o).order():o},merge:function(e){for(var n=e.selection?e.selection():e,t=this._groups,r=n._groups,o=t.length,i=r.length,a=Math.min(o,i),u=new Array(o),c=0;c<a;++c)for(var s,l=t[c],d=r[c],f=l.length,h=u[c]=new Array(f),v=0;v<f;++v)(s=l[v]||d[v])&&(h[v]=s);for(;c<o;++c)u[c]=t[c];return new Sy(u,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,n=-1,t=e.length;++n<t;)for(var r,o=e[n],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function n(n,t){return n&&t?e(n.__data__,t.__data__):!n-!t}e||(e=Lg);for(var t=this._groups,r=t.length,o=new Array(r),i=0;i<r;++i){for(var a,u=t[i],c=u.length,s=o[i]=new Array(c),l=0;l<c;++l)(a=u[l])&&(s[l]=a);s.sort(n)}return new Sy(o,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,n=0,t=e.length;n<t;++n)for(var r=e[n],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null},size:function(){let e=0;for(const n of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var n=this._groups,t=0,r=n.length;t<r;++t)for(var o,i=n[t],a=0,u=i.length;a<u;++a)(o=i[a])&&e.call(o,o.__data__,a,i);return this},attr:function(e,n){var t=yg(e);if(arguments.length<2){var r=this.node();return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}return this.each((null==n?t.local?Rg:Dg:"function"==typeof n?t.local?Xg:Yg:t.local?Hg:Vg)(t,n))},style:function(e,n,t){return arguments.length>1?this.each((null==n?Zg:"function"==typeof n?Gg:Ug)(e,n,null==t?"":t)):Wg(this.node(),e)},property:function(e,n){return arguments.length>1?this.each((null==n?qg:"function"==typeof n?Kg:$g)(e,n)):this.node()[e]},classed:function(e,n){var t=Qg(e+"");if(arguments.length<2){for(var r=Jg(this.node()),o=-1,i=t.length;++o<i;)if(!r.contains(t[o]))return!1;return!0}return this.each(("function"==typeof n?iy:n?ry:oy)(t,n))},text:function(e){return arguments.length?this.each(null==e?ay:("function"==typeof e?cy:uy)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?sy:("function"==typeof e?dy:ly)(e)):this.node().innerHTML},raise:function(){return this.each(fy)},lower:function(){return this.each(hy)},append:function(e){var n="function"==typeof e?e:wg(e);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(e,n){var t="function"==typeof e?e:wg(e),r=null==n?vy:"function"==typeof n?n:_g(n);return this.select((function(){return this.insertBefore(t.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(py)},clone:function(e){return this.select(e?yy:gy)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,n,t){var r,o,i=function(e){return e.trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");return t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),{type:e,name:n}}))}(e+""),a=i.length;if(!(arguments.length<2)){for(u=n?xy:my,r=0;r<a;++r)this.each(u(i[r],n,t));return this}var u=this.node().__on;if(u)for(var c,s=0,l=u.length;s<l;++s)for(r=0,c=u[s];r<a;++r)if((o=i[r]).type===c.type&&o.name===c.name)return c.value},dispatch:function(e,n){return this.each(("function"==typeof n?_y:by)(e,n))},[Symbol.iterator]:function*(){for(var e=this._groups,n=0,t=e.length;n<t;++n)for(var r,o=e[n],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};const Oy={passive:!1},Py={capture:!0,passive:!1};function My(e){e.stopImmediatePropagation()}function jy(e){e.preventDefault(),e.stopImmediatePropagation()}function Iy(e){var n=e.document.documentElement,t=Cy(e).on("dragstart.drag",jy,Py);"onselectstart"in n?t.on("selectstart.drag",jy,Py):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Ay(e,n){var t=e.document.documentElement,r=Cy(e).on("dragstart.drag",null);n&&(r.on("click.drag",jy,Py),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in t?r.on("selectstart.drag",null):(t.style.MozUserSelect=t.__noselect,delete t.__noselect)}var zy=e=>()=>e;function Ty(e,{sourceEvent:n,subject:t,target:r,identifier:o,active:i,x:a,y:u,dx:c,dy:s,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:s,enumerable:!0,configurable:!0},_:{value:l}})}function By(e){return!e.ctrlKey&&!e.button}function Ly(){return this.parentNode}function Dy(e,n){return null==n?{x:e.x,y:e.y}:n}function Ry(){return navigator.maxTouchPoints||"ontouchstart"in this}Ty.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Vy={error001:function(){return"[Ink Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001"},error002:function(){return"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them."},error003:function(e){return'Node type "'.concat(e,'" not found. Using fallback type "default".')},error004:function(){return"The Ink Flow parent container needs a width and a height to render the graph."},error005:function(){return"Only child nodes can use a parent extent."},error006:function(){return"Can't create edge. An edge needs a source and a target."},error007:function(e){return"The old edge with id=".concat(e," does not exist.")},error009:function(e){return'Marker type "'.concat(e,"\" doesn't exist.")},error008:function(e,n){var t=n.id,r=n.sourceHandle,o=n.targetHandle;return"Couldn't create edge for ".concat(e,' handle id: "').concat(r?o:r,'", edge id: ').concat(t,".")},error010:function(){return"Handle: No node id found. Make sure to only use a Handle inside a custom Node."},error011:function(e){return'Edge type "'.concat(e,'" not found. Using fallback type "default".')},error012:function(e){return'Node with id "'.concat(e,'" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.')},error013:function(e){return void 0===e&&(e="react"),"It seems that you haven't loaded the styles. Please import '@xyflow/".concat(e,"/dist/style.css' or base.css to make sure everything is working properly.")}},Hy=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Yy=["Enter"," ","Escape"],Xy=function(e,n){void 0===n&&(n=[0,0]);var t=function(e){var n,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:e.initialHeight)&&void 0!==c?c:0}}(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},Fy=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.size)return{x:0,y:0,width:0,height:0};var t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach((function(e){if(null==n.filter||n.filter(e)){var r=Jy(e,n.nodeOrigin);t=$y(t,r)}})),Qy(t)};function Zy(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),s=c.parentId?r.get(c.parentId):void 0,l=s?Xy(s,s.origin||i).positionAbsolute:{x:0,y:0},d=l.x,f=l.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)s&&om(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(s){var v=c.measured.width,p=c.measured.height,g=s.measured.width,y=s.measured.height;if(v&&p&&g&&y){var m=c.origin||i,x=d+v*m[0],w=f+p*m[1];h=[[x,w],[x+g-v,w+y-p]]}}else null==u||u("005",Vy.error005());var b=om(h)?Gy(t,h):t;return{position:{x:b.x-d,y:b.y-f},positionAbsolute:b}}var Uy=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},Gy=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:Uy(e.x,n[0][0],n[1][0]),y:Uy(e.y,n[0][1],n[1][1])}},Wy=function(e,n,t){return e<n?Uy(Math.abs(e-n),1,50)/50:e>t?-Uy(Math.abs(e-t),1,50)/50:0},qy=function(e,n){return[20*Wy(e.x,35,n.width-35),20*Wy(e.y,35,n.height-35)]},$y=function(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}},Ky=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},Qy=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},Jy=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=Xy(e,n).positionAbsolute,s=c.x,l=c.y;return{x:s,y:l,x2:s+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:l+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}},em=function(e,n){return void 0===n&&(n=[1,1]),{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}},nm=function(e,n,t,r){var o=e.x,i=e.y,a=tp(n,3),u=a[0],c=a[1],s=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var l={x:(o-u)/s,y:(i-c)/s};return t?em(l,r):l},tm=function(e,n){var t=e.x,r=e.y,o=tp(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}},rm=function(){var e;return"undefined"!=typeof navigator&&(null===(e=null===navigator||void 0===navigator?void 0:navigator.userAgent)||void 0===e?void 0:e.indexOf("Mac"))>=0};function om(e){return void 0!==e&&"parent"!==e}function im(e,n){var t=n.snapGrid,r=void 0===t?[0,0]:t,o=n.snapToGrid,i=void 0!==o&&o,a=n.transform,u=am(e),c=u.x,s=u.y,l=nm({x:c,y:s},a),d=i?em(l,r):l,f=d.x,h=d.y;return ep({xSnapped:f,ySnapped:h},l)}exports.ConnectionMode=void 0,exports.PanOnScrollMode=void 0,exports.SelectionMode=void 0,exports.ConnectionLineType=void 0,exports.MarkerType=void 0,exports.Position=void 0;var am=function(e,n){var t,r,o,i,a=function(e){return"clientX"in e}(e),u=a?e.clientX:null===(t=e.touches)||void 0===t?void 0:t[0].clientX,c=a?e.clientY:null===(r=e.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==n?void 0:n.left)&&void 0!==o?o:0),y:c-(null!==(i=null==n?void 0:n.top)&&void 0!==i?i:0)}};function um(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=e.sourceControlX,a=e.sourceControlY,u=.125*n+.375*i+.375*e.targetControlX+.125*r,c=.125*t+.375*a+.375*e.targetControlY+.125*o;return[u,c,Math.abs(u-n),Math.abs(c-t)]}function cm(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function sm(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case exports.Position.Left:return[t-cm(t-o,a),r];case exports.Position.Right:return[t+cm(o-t,a),r];case exports.Position.Top:return[t,r-cm(r-i,a)];case exports.Position.Bottom:return[t,r+cm(i-r,a)]}}function lm(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Math.abs(r-n)/2,a=r<n?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}!function(e){e.Strict="strict",e.Loose="loose"}(exports.ConnectionMode||(exports.ConnectionMode={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(exports.PanOnScrollMode||(exports.PanOnScrollMode={})),function(e){e.Partial="partial",e.Full="full"}(exports.SelectionMode||(exports.SelectionMode={})),function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(exports.ConnectionLineType||(exports.ConnectionLineType={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(exports.MarkerType||(exports.MarkerType={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(exports.Position||(exports.Position={}));var dm,fm=function(e){var n=e.source,t=e.sourceHandle,r=e.target,o=e.targetHandle;return"xy-edge__".concat(n).concat(t||"","-").concat(r).concat(o||"")};var hm=((dm={})[exports.Position.Left]={x:-1,y:0},dm[exports.Position.Right]={x:1,y:0},dm[exports.Position.Top]={x:0,y:-1},dm[exports.Position.Bottom]={x:0,y:1},dm),vm=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function pm(e,n){if(!e.parentId)return!1;var t=n.get(e.parentId);return!!t&&(!!t.selected||pm(t,n))}function gm(e,n,t){var r=e;do{if(null==r?void 0:r.matches(n))return!0;if(r===t)return!1;r=r.parentElement}while(r);return!1}function ym(e){var n,t,r,o,i=e.nodeId,a=e.dragItems,u=e.nodeLookup,c=[];try{for(var s=np(a),l=s.next();!l.done;l=s.next()){var d=tp(l.value,2),f=d[0],h=d[1],v=null===(r=u.get(f))||void 0===r?void 0:r.internals.userNode;v&&c.push(ep(ep({},v),{position:h.position}))}}catch(e){n={error:e}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(n)throw n.error}}if(!i)return[c[0],c];var p=u.get(i).internals.userNode;return[ep(ep({},p),{position:(null===(o=a.get(i))||void 0===o?void 0:o.position)||p.position}),c]}function mm(e){var n=e.onNodeMouseDown,t=e.getStoreItems,r=e.onDragStart,o=e.onDrag,i=e.onDragStop,a={x:null,y:null},u=0,c=new Map,s=!1,l={x:0,y:0},d=null,f=!1,h=null;return{update:function(e){var v=e.noDragClassName,p=e.handleSelector,g=e.domNode,y=e.isSelectable,m=e.nodeId;function x(e,n){var r,i,u=e.x,s=e.y,l=t(),d=l.nodeLookup,f=l.nodeExtent,h=l.snapGrid,v=l.snapToGrid,p=l.nodeOrigin,g=l.onNodeDrag,y=l.onSelectionDrag,x=l.onError,w=l.updateNodePositions;a={x:u,y:s};var b=!1,_={x:0,y:0,x2:0,y2:0};if(c.size>1&&f){var E=Fy(c,{nodeOrigin:p});_=Ky(E)}try{for(var S=np(c),k=S.next();!k.done;k=S.next()){var C=tp(k.value,2),N=C[0],O=C[1],P={x:u-O.distance.x,y:s-O.distance.y};v&&(P=em(P,h));var M=[[f[0][0],f[0][1]],[f[1][0],f[1][1]]];if(c.size>1&&f&&!O.extent){var j=O.internals.positionAbsolute,I=j.x-_.x+f[0][0],A=j.x+O.measured.width-_.x2+f[1][0];M=[[I,j.y-_.y+f[0][1]],[A,j.y+O.measured.height-_.y2+f[1][1]]]}var z=Zy({nodeId:N,nextPosition:P,nodeLookup:d,nodeExtent:M,nodeOrigin:p,onError:x}),T=z.position,B=z.positionAbsolute;b=b||O.position.x!==T.x||O.position.y!==T.y,O.position=T,O.internals.positionAbsolute=B}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(b&&(w(c,!0),n&&(o||g||!m&&y))){var L=tp(ym({nodeId:m,dragItems:c,nodeLookup:d}),2),D=L[0],R=L[1];null==o||o(n,c,D,R),null==g||g(n,D,R),m||null==y||y(n,R)}}function w(){var e,n;if(d){var r=tp(qy(l,d),2),o=r[0],i=r[1];if(0!==o||0!==i){var c=t(),s=c.transform,f=c.panBy;a.x=(null!==(e=a.x)&&void 0!==e?e:0)-o/s[2],a.y=(null!==(n=a.y)&&void 0!==n?n:0)-i/s[2],f({x:o,y:i})&&x(a,null)}u=requestAnimationFrame(w)}}function b(e){var o,i=t(),u=i.nodeLookup,s=i.multiSelectionActive,l=i.nodesDraggable,d=i.transform,h=i.snapGrid,v=i.snapToGrid,p=i.selectNodesOnDrag,g=i.onNodeDragStart,x=i.onSelectionDragStart,w=i.unselectNodesAndEdges;f=!0,p&&y||s||!m||(null===(o=u.get(m))||void 0===o?void 0:o.selected)||w(),y&&p&&m&&(null==n||n(m));var b=im(e.sourceEvent,{transform:d,snapGrid:h,snapToGrid:v});if(a=b,c=function(e,n,t,r){var o,i,a,u,c=new Map;try{for(var s=np(e),l=s.next();!l.done;l=s.next()){var d=tp(l.value,2),f=d[0],h=d[1];if((h.selected||h.id===r)&&(!h.parentId||!pm(h,e))&&(h.draggable||n&&void 0===h.draggable)){var v=e.get(f);v&&c.set(f,{id:f,position:v.position||{x:0,y:0},distance:{x:t.x-v.internals.positionAbsolute.x,y:t.y-v.internals.positionAbsolute.y},extent:v.extent,parentId:v.parentId,origin:v.origin,expandParent:v.expandParent,internals:{positionAbsolute:v.internals.positionAbsolute||{x:0,y:0}},measured:{width:null!==(a=v.measured.width)&&void 0!==a?a:0,height:null!==(u=v.measured.height)&&void 0!==u?u:0}})}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return c}(u,l,b,m),c.size>0&&(r||g||!m&&x)){var _=tp(ym({nodeId:m,dragItems:c,nodeLookup:u}),2),E=_[0],S=_[1];null==r||r(e.sourceEvent,c,E,S),null==g||g(e.sourceEvent,E,S),m||null==x||x(e.sourceEvent,S)}}h=Cy(g);var _=function(){var e,n,t,r,o=By,i=Ly,a=Dy,u=Ry,c={},s=dg("start","drag","end"),l=0,d=0;function f(e){e.on("mousedown.drag",h).filter(u).on("touchstart.drag",g).on("touchmove.drag",y,Oy).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,u){if(!r&&o.call(this,a,u)){var c=x(this,i.call(this,a,u),a,u,"mouse");c&&(Cy(a.view).on("mousemove.drag",v,Py).on("mouseup.drag",p,Py),Iy(a.view),My(a),t=!1,e=a.clientX,n=a.clientY,c("start",a))}}function v(r){if(jy(r),!t){var o=r.clientX-e,i=r.clientY-n;t=o*o+i*i>d}c.mouse("drag",r)}function p(e){Cy(e.view).on("mousemove.drag mouseup.drag",null),Ay(e.view,t),jy(e),c.mouse("end",e)}function g(e,n){if(o.call(this,e,n)){var t,r,a=e.changedTouches,u=i.call(this,e,n),c=a.length;for(t=0;t<c;++t)(r=x(this,u,e,n,a[t].identifier,a[t]))&&(My(e),r("start",e,a[t]))}}function y(e){var n,t,r=e.changedTouches,o=r.length;for(n=0;n<o;++n)(t=c[r[n].identifier])&&(jy(e),t("drag",e,r[n]))}function m(e){var n,t,o=e.changedTouches,i=o.length;for(r&&clearTimeout(r),r=setTimeout((function(){r=null}),500),n=0;n<i;++n)(t=c[o[n].identifier])&&(My(e),t("end",e,o[n]))}function x(e,n,t,r,o,i){var u,d,h,v=s.copy(),p=Ny(i||t,n);if(null!=(h=a.call(e,new Ty("beforestart",{sourceEvent:t,target:f,identifier:o,active:l,x:p[0],y:p[1],dx:0,dy:0,dispatch:v}),r)))return u=h.x-p[0]||0,d=h.y-p[1]||0,function t(i,a,s){var g,y=p;switch(i){case"start":c[o]=t,g=l++;break;case"end":delete c[o],--l;case"drag":p=Ny(s||a,n),g=l}v.call(i,e,new Ty(i,{sourceEvent:a,subject:h,target:f,identifier:o,active:g,x:p[0]+u,y:p[1]+d,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:v}),r)}}return f.filter=function(e){return arguments.length?(o="function"==typeof e?e:zy(!!e),f):o},f.container=function(e){return arguments.length?(i="function"==typeof e?e:zy(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:zy(e),f):a},f.touchable=function(e){return arguments.length?(u="function"==typeof e?e:zy(!!e),f):u},f.on=function(){var e=s.on.apply(s,arguments);return e===s?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}().on("start",(function(e){var n=t(),r=n.domNode,o=n.nodeDragThreshold,i=n.transform,u=n.snapGrid,c=n.snapToGrid;0===o&&b(e);var s=im(e.sourceEvent,{transform:i,snapGrid:u,snapToGrid:c});a=s,d=(null==r?void 0:r.getBoundingClientRect())||null,l=am(e.sourceEvent,d)})).on("drag",(function(e){var n,r,o=t(),i=o.autoPanOnNodeDrag,u=o.transform,h=o.snapGrid,v=o.snapToGrid,p=o.nodeDragThreshold,g=im(e.sourceEvent,{transform:u,snapGrid:h,snapToGrid:v});if(!s&&i&&f&&(s=!0,w()),!f){var y=g.xSnapped-(null!==(n=a.x)&&void 0!==n?n:0),m=g.ySnapped-(null!==(r=a.y)&&void 0!==r?r:0);Math.sqrt(y*y+m*m)>p&&b(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&c&&f&&(l=am(e.sourceEvent,d),x(g,e.sourceEvent))})).on("end",(function(e){if(f&&(s=!1,f=!1,cancelAnimationFrame(u),c.size>0)){var n=t(),r=n.nodeLookup,o=n.updateNodePositions,a=n.onNodeDragStop,l=n.onSelectionDragStop;if(o(c,!1),i||a||!m&&l){var d=tp(ym({nodeId:m,dragItems:c,nodeLookup:r}),2),h=d[0],v=d[1];null==i||i(e.sourceEvent,c,h,v),null==a||a(e.sourceEvent,h,v),m||null==l||l(e.sourceEvent,v)}}})).filter((function(e){var n=e.target;return!e.button&&(!v||!gm(n,".".concat(v),g))&&(!p||gm(n,p,g))}));h.call(_)},destroy:function(){null==h||h.on(".drag",null)}}}function xm(e,n,t,r){return(n[t]||[]).reduce((function(n,o){return"".concat(e.id,"-").concat(o.id,"-").concat(t)!==r&&n.push({id:o.id||null,type:t,nodeId:e.id,x:e.internals.positionAbsolute.x+o.x+o.width/2,y:e.internals.positionAbsolute.y+o.y+o.height/2}),n}),[])}function wm(e,n){return e||((null==n?void 0:n.classList.contains("target"))?"target":(null==n?void 0:n.classList.contains("source"))?"source":null)}var bm=function(){return!0},_m=null;function Em(e,n){var t=n.handle,r=n.connectionMode,o=n.fromNodeId,i=n.fromHandleId,a=n.fromType,u=n.doc,c=n.lib,s=n.flowId,l=n.isValidConnection,d=void 0===l?bm:l,f="target"===a,h=t?u.querySelector(".".concat(c,'-flow__handle[data-id="').concat(s,"-").concat(null==t?void 0:t.nodeId,"-").concat(null==t?void 0:t.id,"-").concat(null==t?void 0:t.type,'"]')):null,v=am(e),p=v.x,g=v.y,y=u.elementFromPoint(p,g),m=(null==y?void 0:y.classList.contains("".concat(c,"-flow__handle")))?y:h,x={handleDomNode:m,isValid:!1,connection:null,endHandle:null};if(m){var w=wm(void 0,m),b=m.getAttribute("data-nodeid"),_=m.getAttribute("data-handleid"),E=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!b)return x;var k={source:f?b:o,sourceHandle:f?_:i,target:f?o:b,targetHandle:f?i:_};x.connection=k,E&&S&&(r===exports.ConnectionMode.Strict?f&&"source"===w||!f&&"target"===w:b!==o||_!==i)&&(x.endHandle={nodeId:b,handleId:_,type:w},x.isValid=d(k))}return x}var Sm={onPointerDown:function(e,n){var t,r=n.connectionMode,o=n.connectionRadius,i=n.handleId,a=n.nodeId,u=n.edgeUpdaterType,c=n.isTarget,s=n.domNode,l=n.nodeLookup,d=n.lib,f=n.autoPanOnConnect,h=n.flowId,v=n.panBy,p=n.cancelConnection,g=n.onConnectStart,y=n.onConnect,m=n.onConnectEnd,x=n.isValidConnection,w=void 0===x?bm:x,b=n.onEdgeUpdateEnd,_=n.updateConnection,E=n.getTransform,S=n.getConnectionStartHandle,k=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)}(e.target),C=0,N=am(e),O=N.x,P=N.y,M=null==k?void 0:k.elementFromPoint(O,P),j=wm(u,M),I=null==s?void 0:s.getBoundingClientRect();if(I&&j){var A=am(e,I),z=!1,T=null,B=!1,L=null,D=function(e){var n,t,r=e.nodeLookup,o=e.nodeId,i=e.handleId,a=e.handleType,u=[];try{for(var c=np(r),s=c.next();!s.done;s=c.next()){var l=tp(s.value,2)[1];if(l.internals.handleBounds){var d="".concat(o,"-").concat(i,"-").concat(a),f=xm(l,l.internals.handleBounds,"source",d),h=xm(l,l.internals.handleBounds,"target",d);u.push.apply(u,rp(rp([],tp(f),!1),tp(h),!1))}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return u}({nodeLookup:l,nodeId:a,handleId:i,handleType:j});_({connectionPosition:A,connectionStatus:null,connectionStartHandle:_m={nodeId:a,handleId:i,type:j},connectionEndHandle:null}),null==g||g(e,{nodeId:a,handleId:i,handleType:j}),k.addEventListener("mousemove",V),k.addEventListener("mouseup",H),k.addEventListener("touchmove",V),k.addEventListener("touchend",H)}function R(){if(f&&I){var e=tp(qy(A,I),2),n=e[0],t=e[1];v({x:n,y:t}),C=requestAnimationFrame(R)}}function V(e){S()||H(e);var n=E();A=am(e,I),t=function(e,n,t){var r,o,i=[],a=1/0;try{for(var u=np(t),c=u.next();!c.done;c=u.next()){var s=c.value,l=Math.sqrt(Math.pow(s.x-e.x,2)+Math.pow(s.y-e.y,2));l<=n&&(l<a?i=[s]:l===a&&i.push(s),a=l)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}return i.length?1===i.length?i[0]:i.find((function(e){return"target"===e.type}))||i[0]:null}(nm(A,n,!1,[1,1]),o,D),z||(R(),z=!0);var u,s,l,f=Em(e,{handle:t,connectionMode:r,fromNodeId:a,fromHandleId:i,fromType:c?"target":"source",isValidConnection:w,doc:k,lib:d,flowId:h});L=f.handleDomNode,T=f.connection,B=f.isValid,_({connectionStartHandle:_m,connectionPosition:t&&B?tm({x:t.x,y:t.y},n):A,connectionStatus:(u=!!t,s=B,l=null,s?l="valid":u&&!s&&(l="invalid"),l),connectionEndHandle:f.endHandle})}function H(e){(t||L)&&T&&B&&(null==y||y(T)),null==m||m(e),u&&(null==b||b(e)),p(),cancelAnimationFrame(C),z=!1,B=!1,T=null,L=null,_m=null,k.removeEventListener("mousemove",V),k.removeEventListener("mouseup",H),k.removeEventListener("touchmove",V),k.removeEventListener("touchend",H)}},isValid:Em};function km(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function Cm(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function Nm(){}var Om=.7,Pm=1/Om,Mm="\\s*([+-]?\\d+)\\s*",jm="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Im="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Am=/^#([0-9a-f]{3,8})$/,zm=new RegExp(`^rgb\\(${Mm},${Mm},${Mm}\\)$`),Tm=new RegExp(`^rgb\\(${Im},${Im},${Im}\\)$`),Bm=new RegExp(`^rgba\\(${Mm},${Mm},${Mm},${jm}\\)$`),Lm=new RegExp(`^rgba\\(${Im},${Im},${Im},${jm}\\)$`),Dm=new RegExp(`^hsl\\(${jm},${Im},${Im}\\)$`),Rm=new RegExp(`^hsla\\(${jm},${Im},${Im},${jm}\\)$`),Vm={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 Hm(){return this.rgb().formatHex()}function Ym(){return this.rgb().formatRgb()}function Xm(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=Am.exec(e))?(t=n[1].length,n=parseInt(n[1],16),6===t?Fm(n):3===t?new Gm(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===t?Zm(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===t?Zm(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=zm.exec(e))?new Gm(n[1],n[2],n[3],1):(n=Tm.exec(e))?new Gm(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Bm.exec(e))?Zm(n[1],n[2],n[3],n[4]):(n=Lm.exec(e))?Zm(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Dm.exec(e))?Jm(n[1],n[2]/100,n[3]/100,1):(n=Rm.exec(e))?Jm(n[1],n[2]/100,n[3]/100,n[4]):Vm.hasOwnProperty(e)?Fm(Vm[e]):"transparent"===e?new Gm(NaN,NaN,NaN,0):null}function Fm(e){return new Gm(e>>16&255,e>>8&255,255&e,1)}function Zm(e,n,t,r){return r<=0&&(e=n=t=NaN),new Gm(e,n,t,r)}function Um(e,n,t,r){return 1===arguments.length?((o=e)instanceof Nm||(o=Xm(o)),o?new Gm((o=o.rgb()).r,o.g,o.b,o.opacity):new Gm):new Gm(e,n,t,null==r?1:r);var o}function Gm(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}function Wm(){return`#${Qm(this.r)}${Qm(this.g)}${Qm(this.b)}`}function qm(){const e=$m(this.opacity);return`${1===e?"rgb(":"rgba("}${Km(this.r)}, ${Km(this.g)}, ${Km(this.b)}${1===e?")":`, ${e})`}`}function $m(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Km(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Qm(e){return((e=Km(e))<16?"0":"")+e.toString(16)}function Jm(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new nx(e,n,t,r)}function ex(e){if(e instanceof nx)return new nx(e.h,e.s,e.l,e.opacity);if(e instanceof Nm||(e=Xm(e)),!e)return new nx;if(e instanceof nx)return e;var n=(e=e.rgb()).r/255,t=e.g/255,r=e.b/255,o=Math.min(n,t,r),i=Math.max(n,t,r),a=NaN,u=i-o,c=(i+o)/2;return u?(a=n===i?(t-r)/u+6*(t<r):t===i?(r-n)/u+2:(n-t)/u+4,u/=c<.5?i+o:2-i-o,a*=60):u=c>0&&c<1?0:a,new nx(a,u,c,e.opacity)}function nx(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}function tx(e){return(e=(e||0)%360)<0?e+360:e}function rx(e){return Math.max(0,Math.min(1,e||0))}function ox(e,n,t){return 255*(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)}km(Nm,Xm,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Hm,formatHex:Hm,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ex(this).formatHsl()},formatRgb:Ym,toString:Ym}),km(Gm,Um,Cm(Nm,{brighter(e){return e=null==e?Pm:Math.pow(Pm,e),new Gm(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Om:Math.pow(Om,e),new Gm(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Gm(Km(this.r),Km(this.g),Km(this.b),$m(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:Wm,formatHex:Wm,formatHex8:function(){return`#${Qm(this.r)}${Qm(this.g)}${Qm(this.b)}${Qm(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:qm,toString:qm})),km(nx,(function(e,n,t,r){return 1===arguments.length?ex(e):new nx(e,n,t,null==r?1:r)}),Cm(Nm,{brighter(e){return e=null==e?Pm:Math.pow(Pm,e),new nx(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Om:Math.pow(Om,e),new nx(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,o=2*t-r;return new Gm(ox(e>=240?e-240:e+120,o,r),ox(e,o,r),ox(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new nx(tx(this.h),rx(this.s),rx(this.l),$m(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=$m(this.opacity);return`${1===e?"hsl(":"hsla("}${tx(this.h)}, ${100*rx(this.s)}%, ${100*rx(this.l)}%${1===e?")":`, ${e})`}`}}));var ix=e=>()=>e;function ax(e,n){var t=n-e;return t?function(e,n){return function(t){return e+t*n}}(e,t):ix(isNaN(e)?n:e)}var ux=function e(n){var t=function(e){return 1==(e=+e)?ax:function(n,t){return t-n?function(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}(n,t,e):ix(isNaN(n)?t:n)}}(n);function r(e,n){var r=t((e=Um(e)).r,(n=Um(n)).r),o=t(e.g,n.g),i=t(e.b,n.b),a=ax(e.opacity,n.opacity);return function(n){return e.r=r(n),e.g=o(n),e.b=i(n),e.opacity=a(n),e+""}}return r.gamma=e,r}(1);function cx(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}var sx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,lx=new RegExp(sx.source,"g");function dx(e,n){var t,r,o,i=sx.lastIndex=lx.lastIndex=0,a=-1,u=[],c=[];for(e+="",n+="";(t=sx.exec(e))&&(r=lx.exec(n));)(o=r.index)>i&&(o=n.slice(i,o),u[a]?u[a]+=o:u[++a]=o),(t=t[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:cx(t,r)})),i=lx.lastIndex;return i<n.length&&(o=n.slice(i),u[a]?u[a]+=o:u[++a]=o),u.length<2?c[0]?function(e){return function(n){return e(n)+""}}(c[0].x):function(e){return function(){return e}}(n):(n=c.length,function(e){for(var t,r=0;r<n;++r)u[(t=c[r]).i]=t.x(e);return u.join("")})}var fx,hx=180/Math.PI,vx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function px(e,n,t,r,o,i){var a,u,c;return(a=Math.sqrt(e*e+n*n))&&(e/=a,n/=a),(c=e*t+n*r)&&(t-=e*c,r-=n*c),(u=Math.sqrt(t*t+r*r))&&(t/=u,r/=u,c/=u),e*r<n*t&&(e=-e,n=-n,c=-c,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(n,e)*hx,skewX:Math.atan(c)*hx,scaleX:a,scaleY:u}}function gx(e,n,t,r){function o(e){return e.length?e.pop()+" ":""}return function(i,a){var u=[],c=[];return i=e(i),a=e(a),function(e,r,o,i,a,u){if(e!==o||r!==i){var c=a.push("translate(",null,n,null,t);u.push({i:c-4,x:cx(e,o)},{i:c-2,x:cx(r,i)})}else(o||i)&&a.push("translate("+o+n+i+t)}(i.translateX,i.translateY,a.translateX,a.translateY,u,c),function(e,n,t,i){e!==n?(e-n>180?n+=360:n-e>180&&(e+=360),i.push({i:t.push(o(t)+"rotate(",null,r)-2,x:cx(e,n)})):n&&t.push(o(t)+"rotate("+n+r)}(i.rotate,a.rotate,u,c),function(e,n,t,i){e!==n?i.push({i:t.push(o(t)+"skewX(",null,r)-2,x:cx(e,n)}):n&&t.push(o(t)+"skewX("+n+r)}(i.skewX,a.skewX,u,c),function(e,n,t,r,i,a){if(e!==t||n!==r){var u=i.push(o(i)+"scale(",null,",",null,")");a.push({i:u-4,x:cx(e,t)},{i:u-2,x:cx(n,r)})}else 1===t&&1===r||i.push(o(i)+"scale("+t+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,u,c),i=a=null,function(e){for(var n,t=-1,r=c.length;++t<r;)u[(n=c[t]).i]=n.x(e);return u.join("")}}}var yx=gx((function(e){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?vx:px(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),mx=gx((function(e){return null==e?vx:(fx||(fx=document.createElementNS("http://www.w3.org/2000/svg","g")),fx.setAttribute("transform",e),(e=fx.transform.baseVal.consolidate())?px((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):vx)}),", ",")",")");function xx(e){return((e=Math.exp(e))+1/e)/2}var wx,bx,_x=function e(n,t,r){function o(e,o){var i,a,u=e[0],c=e[1],s=e[2],l=o[0],d=o[1],f=o[2],h=l-u,v=d-c,p=h*h+v*v;if(p<1e-12)a=Math.log(f/s)/n,i=function(e){return[u+e*h,c+e*v,s*Math.exp(n*e*a)]};else{var g=Math.sqrt(p),y=(f*f-s*s+r*p)/(2*s*t*g),m=(f*f-s*s-r*p)/(2*f*t*g),x=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(m*m+1)-m);a=(w-x)/n,i=function(e){var r,o=e*a,i=xx(x),l=s/(t*g)*(i*(r=n*o+x,((r=Math.exp(2*r))-1)/(r+1))-function(e){return((e=Math.exp(e))-1/e)/2}(x));return[u+l*h,c+l*v,s*i/xx(n*o+x)]}}return i.duration=1e3*a*n/Math.SQRT2,i}return o.rho=function(n){var t=Math.max(.001,+n),r=t*t;return e(t,r,r*r)},o}(Math.SQRT2,2,4),Ex=0,Sx=0,kx=0,Cx=1e3,Nx=0,Ox=0,Px=0,Mx="object"==typeof performance&&performance.now?performance:Date,jx="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ix(){return Ox||(jx(Ax),Ox=Mx.now()+Px)}function Ax(){Ox=0}function zx(){this._call=this._time=this._next=null}function Tx(e,n,t){var r=new zx;return r.restart(e,n,t),r}function Bx(){Ox=(Nx=Mx.now())+Px,Ex=Sx=0;try{!function(){Ix(),++Ex;for(var e,n=wx;n;)(e=Ox-n._time)>=0&&n._call.call(void 0,e),n=n._next;--Ex}()}finally{Ex=0,function(){for(var e,n,t=wx,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:wx=n);bx=e,Dx(r)}(),Ox=0}}function Lx(){var e=Mx.now(),n=e-Nx;n>Cx&&(Px-=n,Nx=e)}function Dx(e){Ex||(Sx&&(Sx=clearTimeout(Sx)),e-Ox>24?(e<1/0&&(Sx=setTimeout(Bx,e-Mx.now()-Px)),kx&&(kx=clearInterval(kx))):(kx||(Nx=Mx.now(),kx=setInterval(Lx,Cx)),Ex=1,jx(Bx)))}function Rx(e,n,t){var r=new zx;return n=null==n?0:+n,r.restart((t=>{r.stop(),e(t+n)}),n,t),r}zx.prototype=Tx.prototype={constructor:zx,restart:function(e,n,t){if("function"!=typeof e)throw new TypeError("callback is not a function");t=(null==t?Ix():+t)+(null==n?0:+n),this._next||bx===this||(bx?bx._next=this:wx=this,bx=this),this._call=e,this._time=t,Dx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Dx())}};var Vx=dg("start","end","cancel","interrupt"),Hx=[],Yx=0,Xx=2,Fx=3,Zx=5,Ux=6;function Gx(e,n,t,r,o,i){var a=e.__transition;if(a){if(t in a)return}else e.__transition={};!function(e,n,t){var r,o=e.__transition;function i(c){var s,l,d,f;if(1!==t.state)return u();for(s in o)if((f=o[s]).name===t.name){if(f.state===Fx)return Rx(i);4===f.state?(f.state=Ux,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[s]):+s<n&&(f.state=Ux,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[s])}if(Rx((function(){t.state===Fx&&(t.state=4,t.timer.restart(a,t.delay,t.time),a(c))})),t.state=Xx,t.on.call("start",e,e.__data__,t.index,t.group),t.state===Xx){for(t.state=Fx,r=new Array(d=t.tween.length),s=0,l=-1;s<d;++s)(f=t.tween[s].value.call(e,e.__data__,t.index,t.group))&&(r[++l]=f);r.length=l+1}}function a(n){for(var o=n<t.duration?t.ease.call(null,n/t.duration):(t.timer.restart(u),t.state=Zx,1),i=-1,a=r.length;++i<a;)r[i].call(e,o);t.state===Zx&&(t.on.call("end",e,e.__data__,t.index,t.group),u())}function u(){for(var r in t.state=Ux,t.timer.stop(),delete o[n],o)return;delete e.__transition}o[n]=t,t.timer=Tx((function(e){t.state=1,t.timer.restart(i,t.delay,t.time),t.delay<=e&&i(e-t.delay)}),0,t.time)}(e,t,{name:n,index:r,group:o,on:Vx,tween:Hx,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Yx})}function Wx(e,n){var t=$x(e,n);if(t.state>Yx)throw new Error("too late; already scheduled");return t}function qx(e,n){var t=$x(e,n);if(t.state>Fx)throw new Error("too late; already running");return t}function $x(e,n){var t=e.__transition;if(!t||!(t=t[n]))throw new Error("transition not found");return t}function Kx(e,n){var t,r,o,i=e.__transition,a=!0;if(i){for(o in n=null==n?null:n+"",i)(t=i[o]).name===n?(r=t.state>Xx&&t.state<Zx,t.state=Ux,t.timer.stop(),t.on.call(r?"interrupt":"cancel",e,e.__data__,t.index,t.group),delete i[o]):a=!1;a&&delete e.__transition}}function Qx(e,n){var t,r;return function(){var o=qx(this,e),i=o.tween;if(i!==t)for(var a=0,u=(r=t=i).length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}o.tween=r}}function Jx(e,n,t){var r,o;if("function"!=typeof t)throw new Error;return function(){var i=qx(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:n,value:t},c=0,s=o.length;c<s;++c)if(o[c].name===n){o[c]=u;break}c===s&&o.push(u)}i.tween=o}}function ew(e,n,t){var r=e._id;return e.each((function(){var e=qx(this,r);(e.value||(e.value={}))[n]=t.apply(this,arguments)})),function(e){return $x(e,r).value[n]}}function nw(e,n){var t;return("number"==typeof n?cx:n instanceof Xm?ux:(t=Xm(n))?(n=t,ux):dx)(e,n)}function tw(e){return function(){this.removeAttribute(e)}}function rw(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ow(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=n(r=a,t)}}function iw(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=n(r=a,t)}}function aw(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttribute(e))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttribute(e)}}function uw(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttributeNS(e.space,e.local))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttributeNS(e.space,e.local)}}function cw(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttributeNS(e.space,e.local,n.call(this,t))}}(e,o)),t}return o._value=n,o}function sw(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttribute(e,n.call(this,t))}}(e,o)),t}return o._value=n,o}function lw(e,n){return function(){Wx(this,e).delay=+n.apply(this,arguments)}}function dw(e,n){return n=+n,function(){Wx(this,e).delay=n}}function fw(e,n){return function(){qx(this,e).duration=+n.apply(this,arguments)}}function hw(e,n){return n=+n,function(){qx(this,e).duration=n}}var vw=ky.prototype.constructor;function pw(e){return function(){this.style.removeProperty(e)}}var gw=0;function yw(e,n,t,r){this._groups=e,this._parents=n,this._name=t,this._id=r}function mw(){return++gw}var xw=ky.prototype;yw.prototype={constructor:yw,select:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=_g(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,s=r[a],l=s.length,d=i[a]=new Array(l),f=0;f<l;++f)(u=s[f])&&(c=e.call(u,u.__data__,f,s))&&("__data__"in u&&(c.__data__=u.__data__),d[f]=c,Gx(d[f],n,t,f,d,$x(u,t)));return new yw(i,this._parents,n,t)},selectAll:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=Sg(e));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var c,s=r[u],l=s.length,d=0;d<l;++d)if(c=s[d]){for(var f,h=e.call(c,c.__data__,d,s),v=$x(c,t),p=0,g=h.length;p<g;++p)(f=h[p])&&Gx(f,n,t,p,h,v);i.push(h),a.push(c)}return new yw(i,a,n,t)},selectChild:xw.selectChild,selectChildren:xw.selectChildren,filter:function(e){"function"!=typeof e&&(e=kg(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],s=0;s<u;++s)(i=a[s])&&e.call(i,i.__data__,s,a)&&c.push(i);return new yw(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,t=e._groups,r=n.length,o=t.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var c,s=n[u],l=t[u],d=s.length,f=a[u]=new Array(d),h=0;h<d;++h)(c=s[h]||l[h])&&(f[h]=c);for(;u<r;++u)a[u]=n[u];return new yw(a,this._parents,this._name,this._id)},selection:function(){return new vw(this._groups,this._parents)},transition:function(){for(var e=this._name,n=this._id,t=mw(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,s=0;s<c;++s)if(a=u[s]){var l=$x(a,n);Gx(a,e,t,s,u,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new yw(r,this._parents,e,t)},call:xw.call,nodes:xw.nodes,node:xw.node,size:xw.size,empty:xw.empty,each:xw.each,on:function(e,n){var t=this._id;return arguments.length<2?$x(this.node(),t).on.on(e):this.each(function(e,n,t){var r,o,i=function(e){return(e+"").trim().split(/^|\s+/).every((function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||"start"===e}))}(n)?Wx:qx;return function(){var a=i(this,e),u=a.on;u!==r&&(o=(r=u).copy()).on(n,t),a.on=o}}(t,e,n))},attr:function(e,n){var t=yg(e),r="transform"===t?mx:nw;return this.attrTween(e,"function"==typeof n?(t.local?uw:aw)(t,r,ew(this,"attr."+e,n)):null==n?(t.local?rw:tw)(t):(t.local?iw:ow)(t,r,n))},attrTween:function(e,n){var t="attr."+e;if(arguments.length<2)return(t=this.tween(t))&&t._value;if(null==n)return this.tween(t,null);if("function"!=typeof n)throw new Error;var r=yg(e);return this.tween(t,(r.local?cw:sw)(r,n))},style:function(e,n,t){var r="transform"==(e+="")?yx:nw;return null==n?this.styleTween(e,function(e,n){var t,r,o;return function(){var i=Wg(this,e),a=(this.style.removeProperty(e),Wg(this,e));return i===a?null:i===t&&a===r?o:o=n(t=i,r=a)}}(e,r)).on("end.style."+e,pw(e)):"function"==typeof n?this.styleTween(e,function(e,n,t){var r,o,i;return function(){var a=Wg(this,e),u=t(this),c=u+"";return null==u&&(this.style.removeProperty(e),c=u=Wg(this,e)),a===c?null:a===r&&c===o?i:(o=c,i=n(r=a,u))}}(e,r,ew(this,"style."+e,n))).each(function(e,n){var t,r,o,i,a="style."+n,u="end."+a;return function(){var c=qx(this,e),s=c.on,l=null==c.value[a]?i||(i=pw(n)):void 0;s===t&&o===l||(r=(t=s).copy()).on(u,o=l),c.on=r}}(this._id,e)):this.styleTween(e,function(e,n,t){var r,o,i=t+"";return function(){var a=Wg(this,e);return a===i?null:a===r?o:o=n(r=a,t)}}(e,r,n),t).on("end.style."+e,null)},styleTween:function(e,n,t){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(e,n,t){var r,o;function i(){var i=n.apply(this,arguments);return i!==o&&(r=(o=i)&&function(e,n,t){return function(r){this.style.setProperty(e,n.call(this,r),t)}}(e,i,t)),r}return i._value=n,i}(e,n,null==t?"":t))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var n=e(this);this.textContent=null==n?"":n}}(ew(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;return this.tween(n,function(e){var n,t;function r(){var r=e.apply(this,arguments);return r!==t&&(n=(t=r)&&function(e){return function(n){this.textContent=e.call(this,n)}}(r)),n}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var n=this.parentNode;for(var t in this.__transition)if(+t!==e)return;n&&n.removeChild(this)}}(this._id))},tween:function(e,n){var t=this._id;if(e+="",arguments.length<2){for(var r,o=$x(this.node(),t).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===e)return r.value;return null}return this.each((null==n?Qx:Jx)(t,e,n))},delay:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?lw:dw)(n,e)):$x(this.node(),n).delay},duration:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?fw:hw)(n,e)):$x(this.node(),n).duration},ease:function(e){var n=this._id;return arguments.length?this.each(function(e,n){if("function"!=typeof n)throw new Error;return function(){qx(this,e).ease=n}}(n,e)):$x(this.node(),n).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,n){return function(){var t=n.apply(this,arguments);if("function"!=typeof t)throw new Error;qx(this,e).ease=t}}(this._id,e))},end:function(){var e,n,t=this,r=t._id,o=t.size();return new Promise((function(i,a){var u={value:a},c={value:function(){0==--o&&i()}};t.each((function(){var t=qx(this,r),o=t.on;o!==e&&((n=(e=o).copy())._.cancel.push(u),n._.interrupt.push(u),n._.end.push(c)),t.on=n})),0===o&&i()}))},[Symbol.iterator]:xw[Symbol.iterator]};var ww={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function bw(e,n){for(var t;!(t=e.__transition)||!(t=t[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return t}ky.prototype.interrupt=function(e){return this.each((function(){Kx(this,e)}))},ky.prototype.transition=function(e){var n,t;e instanceof yw?(n=e._id,e=e._name):(n=mw(),(t=ww).time=Ix(),e=null==e?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,s=0;s<c;++s)(a=u[s])&&Gx(a,e,n,s,u,t||bw(a,n));return new yw(r,this._parents,e,n)};var _w=e=>()=>e;function Ew(e,{sourceEvent:n,target:t,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Sw(e,n,t){this.k=e,this.x=n,this.y=t}Sw.prototype={constructor:Sw,scale:function(e){return 1===e?this:new Sw(this.k*e,this.x,this.y)},translate:function(e,n){return 0===e&0===n?this:new Sw(this.k,this.x+this.k*e,this.y+this.k*n)},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 kw=new Sw(1,0,0);function Cw(e){for(;!e.__zoom;)if(!(e=e.parentNode))return kw;return e.__zoom}function Nw(e){e.stopImmediatePropagation()}function Ow(e){e.preventDefault(),e.stopImmediatePropagation()}function Pw(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Mw(){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 jw(){return this.__zoom||kw}function Iw(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Aw(){return navigator.maxTouchPoints||"ontouchstart"in this}function zw(e,n,t){var r=e.invertX(n[0][0])-t[0][0],o=e.invertX(n[1][0])-t[1][0],i=e.invertY(n[0][1])-t[0][1],a=e.invertY(n[1][1])-t[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}Cw.prototype=Sw.prototype;var Tw,Bw=function(e,n){return e.x!==n.x||e.y!==n.y||e.zoom!==n.k},Lw=function(e){return{x:e.x,y:e.y,zoom:e.k}},Dw=function(e){var n=e.x,t=e.y,r=e.zoom;return kw.translate(n,t).scale(r)},Rw=function(e,n){return e.target.closest(".".concat(n))},Vw=function(e,n){return 2===n&&Array.isArray(e)&&e.includes(2)},Hw=function(e,n){return void 0===n&&(n=0),"number"==typeof n&&n>0?e.transition().duration(n):e},Yw=function(e){var n=e.ctrlKey&&rm()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*n};function Xw(e){var n=e.domNode,t=e.minZoom,r=e.maxZoom,o=e.translateExtent,i=e.viewport,a=e.onPanZoom,u=e.onPanZoomStart,c=e.onPanZoomEnd,s=e.onTransformChange,l=e.onDraggingChange,d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=n.getBoundingClientRect(),h=function(){var e,n,t,r=Pw,o=Mw,i=zw,a=Iw,u=Aw,c=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,d=_x,f=dg("start","zoom","end"),h=500,v=150,p=0,g=10;function y(e){e.property("__zoom",jw).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",C).filter(u).on("touchstart.zoom",N).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",P).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,n){return(n=Math.max(c[0],Math.min(c[1],n)))===e.k?e:new Sw(n,e.x,e.y)}function x(e,n,t){var r=n[0]-t[0]*e.k,o=n[1]-t[1]*e.k;return r===e.x&&o===e.y?e:new Sw(e.k,r,o)}function w(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function b(e,n,t,r){e.on("start.zoom",(function(){_(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){_(this,arguments).event(r).end()})).tween("zoom",(function(){var e=this,i=arguments,a=_(e,i).event(r),u=o.apply(e,i),c=null==t?w(u):"function"==typeof t?t.apply(e,i):t,s=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),l=e.__zoom,f="function"==typeof n?n.apply(e,i):n,h=d(l.invert(c).concat(s/l.k),f.invert(c).concat(s/f.k));return function(e){if(1===e)e=f;else{var n=h(e),t=s/n[2];e=new Sw(t,c[0]-n[0]*t,c[1]-n[1]*t)}a.zoom(null,e)}}))}function _(e,n,t){return!t&&e.__zooming||new E(e,n)}function E(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=o.apply(e,n),this.taps=0}function S(e,...n){if(r.apply(this,arguments)){var t=_(this,n).event(e),o=this.__zoom,u=Math.max(c[0],Math.min(c[1],o.k*Math.pow(2,a.apply(this,arguments)))),l=Ny(e);if(t.wheel)t.mouse[0][0]===l[0]&&t.mouse[0][1]===l[1]||(t.mouse[1]=o.invert(t.mouse[0]=l)),clearTimeout(t.wheel);else{if(o.k===u)return;t.mouse=[l,o.invert(l)],Kx(this),t.start()}Ow(e),t.wheel=setTimeout((function(){t.wheel=null,t.end()}),v),t.zoom("mouse",i(x(m(o,u),t.mouse[0],t.mouse[1]),t.extent,s))}}function k(e,...n){if(!t&&r.apply(this,arguments)){var o=e.currentTarget,a=_(this,n,!0).event(e),u=Cy(e.view).on("mousemove.zoom",(function(e){if(Ow(e),!a.moved){var n=e.clientX-l,t=e.clientY-d;a.moved=n*n+t*t>p}a.event(e).zoom("mouse",i(x(a.that.__zoom,a.mouse[0]=Ny(e,o),a.mouse[1]),a.extent,s))}),!0).on("mouseup.zoom",(function(e){u.on("mousemove.zoom mouseup.zoom",null),Ay(e.view,a.moved),Ow(e),a.event(e).end()}),!0),c=Ny(e,o),l=e.clientX,d=e.clientY;Iy(e.view),Nw(e),a.mouse=[c,this.__zoom.invert(c)],Kx(this),a.start()}}function C(e,...n){if(r.apply(this,arguments)){var t=this.__zoom,a=Ny(e.changedTouches?e.changedTouches[0]:e,this),u=t.invert(a),c=t.k*(e.shiftKey?.5:2),d=i(x(m(t,c),a,u),o.apply(this,n),s);Ow(e),l>0?Cy(this).transition().duration(l).call(b,d,a,e):Cy(this).call(y.transform,d,a,e)}}function N(t,...o){if(r.apply(this,arguments)){var i,a,u,c,s=t.touches,l=s.length,d=_(this,o,t.changedTouches.length===l).event(t);for(Nw(t),a=0;a<l;++a)c=[c=Ny(u=s[a],this),this.__zoom.invert(c),u.identifier],d.touch0?d.touch1||d.touch0[2]===c[2]||(d.touch1=c,d.taps=0):(d.touch0=c,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(n=c[0],e=setTimeout((function(){e=null}),h)),Kx(this),d.start())}}function O(e,...n){if(this.__zooming){var t,r,o,a,u=_(this,n).event(e),c=e.changedTouches,l=c.length;for(Ow(e),t=0;t<l;++t)o=Ny(r=c[t],this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=o:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=o);if(r=u.that.__zoom,u.touch1){var d=u.touch0[0],f=u.touch0[1],h=u.touch1[0],v=u.touch1[1],p=(p=h[0]-d[0])*p+(p=h[1]-d[1])*p,g=(g=v[0]-f[0])*g+(g=v[1]-f[1])*g;r=m(r,Math.sqrt(p/g)),o=[(d[0]+h[0])/2,(d[1]+h[1])/2],a=[(f[0]+v[0])/2,(f[1]+v[1])/2]}else{if(!u.touch0)return;o=u.touch0[0],a=u.touch0[1]}u.zoom("touch",i(x(r,o,a),u.extent,s))}}function P(e,...r){if(this.__zooming){var o,i,a=_(this,r).event(e),u=e.changedTouches,c=u.length;for(Nw(e),t&&clearTimeout(t),t=setTimeout((function(){t=null}),h),o=0;o<c;++o)i=u[o],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=Ny(i,this),Math.hypot(n[0]-i[0],n[1]-i[1])<g)){var s=Cy(this).on("dblclick.zoom");s&&s.apply(this,arguments)}}}return y.transform=function(e,n,t,r){var o=e.selection?e.selection():e;o.property("__zoom",jw),e!==o?b(e,n,t,r):o.interrupt().each((function(){_(this,arguments).event(r).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()}))},y.scaleBy=function(e,n,t,r){y.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)}),t,r)},y.scaleTo=function(e,n,t,r){y.transform(e,(function(){var e=o.apply(this,arguments),r=this.__zoom,a=null==t?w(e):"function"==typeof t?t.apply(this,arguments):t,u=r.invert(a),c="function"==typeof n?n.apply(this,arguments):n;return i(x(m(r,c),a,u),e,s)}),t,r)},y.translateBy=function(e,n,t,r){y.transform(e,(function(){return i(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof t?t.apply(this,arguments):t),o.apply(this,arguments),s)}),null,r)},y.translateTo=function(e,n,t,r,a){y.transform(e,(function(){var e=o.apply(this,arguments),a=this.__zoom,u=null==r?w(e):"function"==typeof r?r.apply(this,arguments):r;return i(kw.translate(u[0],u[1]).scale(a.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof t?-t.apply(this,arguments):-t),e,s)}),r,a)},E.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,n){return this.mouse&&"mouse"!==e&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var n=Cy(this.that).datum();f.call(e,this.that,new Ew(e,{sourceEvent:this.sourceEvent,target:y,type:e,transform:this.that.__zoom,dispatch:f}),n)}},y.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:_w(+e),y):a},y.filter=function(e){return arguments.length?(r="function"==typeof e?e:_w(!!e),y):r},y.touchable=function(e){return arguments.length?(u="function"==typeof e?e:_w(!!e),y):u},y.extent=function(e){return arguments.length?(o="function"==typeof e?e:_w([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),y):o},y.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],y):[c[0],c[1]]},y.translateExtent=function(e){return arguments.length?(s[0][0]=+e[0][0],s[1][0]=+e[1][0],s[0][1]=+e[0][1],s[1][1]=+e[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(e){return arguments.length?(i=e,y):i},y.duration=function(e){return arguments.length?(l=+e,y):l},y.interpolate=function(e){return arguments.length?(d=e,y):d},y.on=function(){var e=f.on.apply(f,arguments);return e===f?y:e},y.clickDistance=function(e){return arguments.length?(p=(e=+e)*e,y):Math.sqrt(p)},y.tapDistance=function(e){return arguments.length?(g=+e,y):g},y}().scaleExtent([t,r]).translateExtent(o),v=Cy(n).call(h);x({x:i.x,y:i.y,zoom:Uy(i.zoom,t,r)},[[0,0],[f.width,f.height]],o);var p=v.on("wheel.zoom"),g=v.on("dblclick.zoom");function y(e,n){v&&(null==h||h.transform(Hw(v,null==n?void 0:n.duration),e))}function m(){h.on("zoom",null)}function x(e,n,t){var r=Dw(e),o=null==h?void 0:h.constrain()(r,n,t);return o&&y(o),o}return h.wheelDelta(Yw),{update:function(e){var n=e.noWheelClassName,t=e.noPanClassName,r=e.onPaneContextMenu,o=e.userSelectionActive,i=e.panOnScroll,f=e.panOnDrag,y=e.panOnScrollMode,x=e.panOnScrollSpeed,w=e.preventScrolling,b=e.zoomOnPinch,_=e.zoomOnScroll,E=e.zoomOnDoubleClick,S=e.zoomActivationKeyPressed,k=e.lib;o&&!d.isZoomingOrPanning&&m();var C=!i||S||o?function(e){var n=e.noWheelClassName,t=e.preventScrolling,r=e.d3ZoomHandler;return function(e,o){if(!t&&"wheel"===e.type&&!e.ctrlKey||Rw(e,n))return null;e.preventDefault(),r.call(this,e,o)}}({noWheelClassName:n,preventScrolling:w,d3ZoomHandler:p}):function(e){var n=e.zoomPanValues,t=e.noWheelClassName,r=e.d3Selection,o=e.d3Zoom,i=e.panOnScrollMode,a=e.panOnScrollSpeed,u=e.zoomOnPinch,c=e.onPanZoomStart,s=e.onPanZoom,l=e.onPanZoomEnd;return function(e){if(Rw(e,t))return!1;e.preventDefault(),e.stopImmediatePropagation();var d=r.property("__zoom").k||1;if(e.ctrlKey&&u){var f=Ny(e),h=Yw(e),v=d*Math.pow(2,h);o.scaleTo(r,v,f,e)}else{var p=1===e.deltaMode?20:1,g=i===exports.PanOnScrollMode.Vertical?0:e.deltaX*p,y=i===exports.PanOnScrollMode.Horizontal?0:e.deltaY*p;!rm()&&e.shiftKey&&i!==exports.PanOnScrollMode.Vertical&&(g=e.deltaY*p,y=0),o.translateBy(r,-g/d*a,-y/d*a,{internal:!0});var m=Lw(r.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling||(n.isPanScrolling=!0,null==c||c(e,m)),n.isPanScrolling&&(null==s||s(e,m),n.panScrollTimeout=setTimeout((function(){null==l||l(e,m),n.isPanScrolling=!1}),150))}}}({zoomPanValues:d,noWheelClassName:n,d3Selection:v,d3Zoom:h,panOnScrollMode:y,panOnScrollSpeed:x,zoomOnPinch:b,onPanZoomStart:u,onPanZoom:a,onPanZoomEnd:c});if(v.on("wheel.zoom",C,{passive:!1}),!o){var N=function(e){var n=e.zoomPanValues,t=e.onDraggingChange,r=e.onPanZoomStart;return function(e){var o,i,a;if(!(null===(o=e.sourceEvent)||void 0===o?void 0:o.internal)){var u=Lw(e.transform);n.mouseButton=(null===(i=e.sourceEvent)||void 0===i?void 0:i.button)||0,n.isZoomingOrPanning=!0,n.prevViewport=u,"mousedown"===(null===(a=e.sourceEvent)||void 0===a?void 0:a.type)&&t(!0),r&&(null==r||r(e.sourceEvent,u))}}}({zoomPanValues:d,onDraggingChange:l,onPanZoomStart:u});h.on("start",N);var O=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.onPaneContextMenu,o=e.onTransformChange,i=e.onPanZoom;return function(e){var a,u,c;n.usedRightMouseButton=!(!r||!Vw(t,null!==(a=n.mouseButton)&&void 0!==a?a:0)),(null===(u=e.sourceEvent)||void 0===u?void 0:u.sync)||o([e.transform.x,e.transform.y,e.transform.k]),i&&!(null===(c=e.sourceEvent)||void 0===c?void 0:c.internal)&&(null==i||i(e.sourceEvent,Lw(e.transform)))}}({zoomPanValues:d,panOnDrag:f,onPaneContextMenu:!!r,onPanZoom:a,onTransformChange:s});h.on("zoom",O);var P=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.panOnScroll,o=e.onDraggingChange,i=e.onPanZoomEnd,a=e.onPaneContextMenu;return function(e){var u,c;if(!(null===(u=e.sourceEvent)||void 0===u?void 0:u.internal)&&(n.isZoomingOrPanning=!1,a&&Vw(t,null!==(c=n.mouseButton)&&void 0!==c?c:0)&&!n.usedRightMouseButton&&e.sourceEvent&&a(e.sourceEvent),n.usedRightMouseButton=!1,o(!1),i&&Bw(n.prevViewport,e.transform))){var s=Lw(e.transform);n.prevViewport=s,clearTimeout(n.timerId),n.timerId=setTimeout((function(){null==i||i(e.sourceEvent,s)}),r?150:0)}}}({zoomPanValues:d,panOnDrag:f,panOnScroll:i,onPaneContextMenu:r,onPanZoomEnd:c,onDraggingChange:l});h.on("end",P)}var M=function(e){var n=e.zoomActivationKeyPressed,t=e.zoomOnScroll,r=e.zoomOnPinch,o=e.panOnDrag,i=e.panOnScroll,a=e.zoomOnDoubleClick,u=e.userSelectionActive,c=e.noWheelClassName,s=e.noPanClassName,l=e.lib;return function(e){var d=n||t,f=r&&e.ctrlKey;if(1===e.button&&"mousedown"===e.type&&(Rw(e,"".concat(l,"-flow__node"))||Rw(e,"".concat(l,"-flow__edge"))))return!0;if(!(o||d||i||a||r))return!1;if(u)return!1;if(Rw(e,c)&&"wheel"===e.type)return!1;if(Rw(e,s)&&("wheel"!==e.type||i&&"wheel"===e.type&&!n))return!1;if(!r&&e.ctrlKey&&"wheel"===e.type)return!1;if(!d&&!i&&!f&&"wheel"===e.type)return!1;if(!o&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(o)&&!o.includes(e.button)&&"mousedown"===e.type)return!1;var h=Array.isArray(o)&&o.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||"wheel"===e.type)&&h}}({zoomActivationKeyPressed:S,panOnDrag:f,zoomOnScroll:_,panOnScroll:i,zoomOnDoubleClick:E,zoomOnPinch:b,userSelectionActive:o,noPanClassName:t,noWheelClassName:n,lib:k});h.filter(M),E?v.on("dblclick.zoom",g):v.on("dblclick.zoom",null)},destroy:m,setViewport:function(e,n){var t=Dw(e);return y(t,n),t},setViewportConstrained:x,getViewport:function(){var e=v?Cw(v.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,n){v&&(null==h||h.scaleTo(Hw(v,null==n?void 0:n.duration),e))},scaleBy:function(e,n){v&&(null==h||h.scaleBy(Hw(v,null==n?void 0:n.duration),e))},setScaleExtent:function(e){null==h||h.scaleExtent(e)},setTranslateExtent:function(e){null==h||h.translateExtent(e)},syncViewport:function(e){if(v){var n=Dw(e),t=v.property("__zoom");t.k===e.zoom&&t.x===e.x&&t.y===e.y||null==h||h.transform(v,n,null,{sync:!0})}}}}!function(e){e.Line="line",e.Handle="handle"}(Tw||(Tw={}));ep(ep({},{width:0,height:0,x:0,y:0}),{pointerX:0,pointerY:0,aspectRatio:1});var Fw=Vy.error001();function Zw(n,t){var r=e.useContext(In);if(null===r)throw new Error(Fw);return P(r,n,t)}function Uw(){var n=e.useContext(In);if(null===n)throw new Error(Fw);return e.useMemo((function(){return{getState:n.getState,setState:n.setState,subscribe:n.subscribe}}),[n])}function Gw(e,t){var r,o,u;void 0===t&&(t={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{}});var c=(null==t?void 0:t.elevateNodesOnSelect)?1e3:0;try{for(var s=i(e),l=s.next();!l.done;l=s.next()){var d=a(l.value,2)[1],f=d.parentId;if(f){if(!e.has(f))throw new Error("Parent node ".concat(f," not found"));var h=e.get(f),v=Ww(d,e,n(n({},d.position),{z:(tb(d.zIndex)?d.zIndex:0)+(d.selected?c:0)}),null!==(u=null==h?void 0:h.origin)&&void 0!==u?u:t.nodeOrigin),p=v.x,g=v.y,y=v.z,m=d.internals.positionAbsolute,x=p!==m.x||g!==m.y;(x||y!==d.internals.z)&&(d.internals=n(n({},d.internals),{positionAbsolute:x?{x:p,y:g}:m,z:y}))}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}function Ww(e,n,t,r){var o,i,a,u,c,s;if(void 0===r&&(r=[0,0]),!e.parentId)return t;var l=n.get(e.parentId),d=qw(l,r).position;return Ww(l,n,{x:(null!==(o=t.x)&&void 0!==o?o:0)+d.x,y:(null!==(i=t.y)&&void 0!==i?i:0)+d.y,z:(null!==(a=l.internals.z)&&void 0!==a?a:0)>(null!==(u=t.z)&&void 0!==u?u:0)?null!==(c=l.internals.z)&&void 0!==c?c:0:null!==(s=t.z)&&void 0!==s?s:0},l.origin||r)}var qw=function(e,n){void 0===n&&(n=[0,0]);var t=nb(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}};function $w(e,n,t){var r,o;e.clear(),n.clear();try{for(var a=i(t),u=a.next();!u.done;u=a.next()){var c=u.value,s=c.source,l=c.target,d=c.sourceHandle,f=void 0===d?null:d,h=c.targetHandle,v=void 0===h?null:h,p="".concat(s,"-source-").concat(f),g="".concat(l,"-target-").concat(v),y=e.get(p)||new Map,m=e.get(g)||new Map,x={edgeId:c.id,source:s,target:l,sourceHandle:f,targetHandle:v};n.set(c.id,c),e.set(p,y.set("".concat(l,"-").concat(v),x)),e.set(g,m.set("".concat(s,"-").concat(f),x))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}}function Kw(e,t,r,o){void 0===o&&(o={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{},checkEquality:!0});var i=new Map(t);t.clear(),r.clear();var a=(null==o?void 0:o.elevateNodesOnSelect)?1e3:0;e.forEach((function(e){var u,c,s=i.get(e.id);if(o.checkEquality&&e===(null==s?void 0:s.internals.userNode)||(s=n(n(n({},o.defaults),e),{measured:{width:null===(u=e.measured)||void 0===u?void 0:u.width,height:null===(c=e.measured)||void 0===c?void 0:c.height},internals:{positionAbsolute:e.position,handleBounds:null==s?void 0:s.internals.handleBounds,z:(tb(e.zIndex)?e.zIndex:0)+(e.selected?a:0),userNode:e}})),t.set(e.id,s),e.parentId){var l=r.get(e.parentId);l?l.push(s):r.set(e.parentId,[s])}})),r.size>0&&Gw(t,o)}function Qw(e,n,t,r){var o,a,u,c,s,l=[],d=new Map;try{for(var f=i(e),h=f.next();!h.done;h=f.next()){var v=h.value,p=n.get(v.parentId);if(p){var g=null!==(c=null===(u=d.get(v.parentId))||void 0===u?void 0:u.expandedRect)&&void 0!==c?c:ib(p,null!==(s=p.origin)&&void 0!==s?s:r),y=sb(g,v.rect);d.set(v.parentId,{expandedRect:y,parent:p})}}}catch(e){o={error:e}}finally{try{h&&!h.done&&(a=f.return)&&a.call(f)}finally{if(o)throw o.error}}return d.size>0&&d.forEach((function(n,r){var o=n.expandedRect,i=n.parent,a=qw(i,i.origin).position,u=nb(i),c=o.x<a.x?Math.round(Math.abs(a.x-o.x)):0,s=o.y<a.y?Math.round(Math.abs(a.y-o.y)):0;if(c>0||s>0){l.push({id:r,type:"position",position:{x:a.x-c,y:a.y-s}});var d=t.get(r);null==d||d.forEach((function(n){e.some((function(e){return e.id===n.id}))||l.push({id:n.id,type:"position",position:{x:n.position.x+c,y:n.position.y+s}})}))}(u.width<o.width||u.height<o.height)&&l.push({id:r,type:"dimensions",setAttributes:!0,dimensions:{width:Math.max(u.width,Math.round(o.width)),height:Math.max(u.height,Math.round(o.height))}})})),l}var Jw=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},eb=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:Jw(e.x,n[0][0],n[1][0]),y:Jw(e.y,n[0][1],n[1][1])}};function nb(e){var n,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:e.initialHeight)&&void 0!==c?c:0}}var tb=function(e){return!isNaN(e)&&isFinite(e)},rb=function(e,n){return void 0===n&&(n=[1,1]),{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}},ob=function(e,n,t,r){var o=e.x,i=e.y,u=a(n,3),c=u[0],s=u[1],l=u[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var d={x:(o-c)/l,y:(i-s)/l};return t?rb(d,r):d},ib=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=qw(e,n).positionAbsolute;return{x:c.x,y:c.y,width:null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0,height:null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0}},ab=function(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}},ub=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},cb=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},sb=function(e,n){return cb(ab(ub(e),ub(n)))};function lb(n){return e.forwardRef(n)}var db=function(e,n){var t=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),r=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(t*r)},fb=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),s=Jw(c,r,o);return{x:n/2-(e.x+e.width/2)*s,y:t/2-(e.y+e.height/2)*s,zoom:s}};function hb(e){return void 0!==e&&"parent"!==e}var vb=function(e){var n=e.x,t=e.y,r=e.width,o=e.height,i=e.origin,a=void 0===i?[0,0]:i;return!r||!o||a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:n,y:t}:{x:n-r*a[0],y:t-o*a[1]}},pb=function(e){return gb(e)},gb=function(e){return"id"in e&&"position"in e&&!("source"in e)&&!("target"in e)};var yb=function(e){return tb(e.width)&&tb(e.height)&&tb(e.x)&&tb(e.y)},mb=function(e){return{width:e.offsetWidth,height:e.offsetHeight}},xb=["INPUT","SELECT","TEXTAREA"];function wb(e){var n,t,r=(null===(t=null===(n=e.composedPath)||void 0===n?void 0:n.call(e))||void 0===t?void 0:t[0])||e.target;return xb.includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}var bb=function(e){return"clientX"in e},_b=function(e,n){var t,r,o,i,a=bb(e),u=a?e.clientX:null===(t=e.touches)||void 0===t?void 0:t[0].clientX,c=a?e.clientY:null===(r=e.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==n?void 0:n.left)&&void 0!==o?o:0),y:c-(null!==(i=null==n?void 0:n.top)&&void 0!==i?i:0)}},Eb=function(e,t,r,o){void 0===o&&(o=[0,0]);var i=t.querySelectorAll(e);if(!i||!i.length)return null;var a=Array.from(i),u=t.getBoundingClientRect(),c=u.width*o[0],s=u.height*o[1];return a.map((function(e){var t=e.getBoundingClientRect();return n({id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(t.left-u.left-c)/r,y:(t.top-u.top-s)/r},mb(e))}))},Sb="undefined"!=typeof document?document:null;function kb(n,t){void 0===n&&(n=null),void 0===t&&(t={target:Sb,actInsideInputWithModifier:!0});var r=a(e.useState(!1),2),o=r[0],i=r[1],c=e.useRef(!1),s=e.useRef(new Set([])),l=a(e.useMemo((function(){if(null!==n){var e=(Array.isArray(n)?n:[n]).filter((function(e){return"string"==typeof e})).map((function(e){return e.split("+")})),t=e.reduce((function(e,n){return e.concat.apply(e,u([],a(n),!1))}),[]);return[e,t]}return[[],[]]}),[n]),2),d=l[0],f=l[1];return e.useEffect((function(){var e=(null==t?void 0:t.target)||Sb;if(null!==n){var r=function(e){if(c.current=e.ctrlKey||e.metaKey||e.shiftKey,(!c.current||c.current&&!t.actInsideInputWithModifier)&&wb(e))return!1;var n=Nb(e.code,f);s.current.add(e[n]),Cb(d,s.current,!1)&&(e.preventDefault(),i(!0))},o=function(e){if((!c.current||c.current&&!t.actInsideInputWithModifier)&&wb(e))return!1;var n=Nb(e.code,f);Cb(d,s.current,!0)?(i(!1),s.current.clear()):s.current.delete(e[n]),"Meta"===e.key&&s.current.clear(),c.current=!1},a=function(){s.current.clear(),i(!1)};return null==e||e.addEventListener("keydown",r),null==e||e.addEventListener("keyup",o),window.addEventListener("blur",a),window.addEventListener("contextmenu",a),function(){null==e||e.removeEventListener("keydown",r),null==e||e.removeEventListener("keyup",o),window.removeEventListener("blur",a),window.removeEventListener("contextmenu",a)}}}),[n,i]),o}function Cb(e,n,t){return e.filter((function(e){return t||e.length===n.size})).some((function(e){return e.every((function(e){return n.has(e)}))}))}function Nb(e,n){return n.includes(e)?"code":"key"}function Ob(e,n){if(Object.is(e,n))return!0;if("object"!=typeof e||null===e||"object"!=typeof n||null===n)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[t,r]of e)if(!Object.is(r,n.get(t)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const t of e)if(!n.has(t))return!1;return!0}const t=Object.keys(e);if(t.length!==Object.keys(n).length)return!1;for(const r of t)if(!Object.prototype.hasOwnProperty.call(n,r)||!Object.is(e[r],n[r]))return!1;return!0}var Pb={position:"absolute",width:"100%",height:"100%",top:0,left:0};var Mb=function(e){return{userSelectionActive:e.userSelectionActive,lib:e.lib}};function jb(n){var t=n.onPaneContextMenu,r=n.zoomOnScroll,o=void 0===r||r,i=n.zoomOnPinch,a=void 0===i||i,u=n.panOnScroll,c=void 0!==u&&u,s=n.panOnScrollSpeed,l=void 0===s?.5:s,d=n.panOnScrollMode,f=void 0===d?exports.PanOnScrollMode.Free:d,v=n.zoomOnDoubleClick,p=void 0===v||v,g=n.panOnDrag,y=void 0===g||g,m=n.defaultViewport,x=n.translateExtent,w=n.minZoom,b=n.maxZoom,_=n.zoomActivationKeyCode,E=n.preventScrolling,S=void 0===E||E,k=n.children,C=n.noWheelClassName,N=n.noPanClassName,O=n.onViewportChange,P=n.isControlledViewport,M=Uw(),j=e.useRef(null),I=Zw(Mb,Ob),A=I.userSelectionActive,z=I.lib,T=kb(_),B=e.useRef();return function(n){var t=Uw();e.useEffect((function(){var e=function(){var e,r;if(!n.current)return!1;var o=mb(n.current);0!==o.height&&0!==o.width||null===(r=(e=t.getState()).onError)||void 0===r||r.call(e,"004",Vy.error004()),t.setState({width:o.width||500,height:o.height||500})};if(n.current){e(),window.addEventListener("resize",e);var r=new ResizeObserver((function(){return e()}));return r.observe(n.current),function(){window.removeEventListener("resize",e),r&&n.current&&r.unobserve(n.current)}}}),[])}(j),e.useEffect((function(){if(j.current){B.current=Xw({domNode:j.current,minZoom:w,maxZoom:b,translateExtent:x,viewport:m,onTransformChange:function(e){null==O||O({x:e[0],y:e[1],zoom:e[2]}),P||M.setState({transform:e})},onDraggingChange:function(e){return M.setState({paneDragging:e})},onPanZoomStart:function(e,n){var t=M.getState(),r=t.onViewportChangeStart,o=t.onMoveStart;null==o||o(e,n),null==r||r(n)},onPanZoom:function(e,n){var t=M.getState(),r=t.onViewportChange,o=t.onMove;null==o||o(e,n),null==r||r(n)},onPanZoomEnd:function(e,n){var t=M.getState(),r=t.onViewportChangeEnd,o=t.onMoveEnd;null==o||o(e,n),null==r||r(n)}});var e=B.current.getViewport(),n=e.x,t=e.y,r=e.zoom;return M.setState({panZoom:B.current,transform:[n,t,r],domNode:j.current.closest(".ink-flow")}),function(){var e;null===(e=B.current)||void 0===e||e.destroy()}}}),[]),e.useEffect((function(){var e;null===(e=B.current)||void 0===e||e.update({onPaneContextMenu:t,zoomOnScroll:o,zoomOnPinch:a,panOnScroll:c,panOnScrollSpeed:l,panOnScrollMode:f,zoomOnDoubleClick:p,panOnDrag:y,zoomActivationKeyPressed:T,preventScrolling:S,noPanClassName:N,userSelectionActive:A,noWheelClassName:C,lib:z})}),[t,o,a,c,l,f,p,y,T,S,N,A,C,z]),h.jsx("div",{className:"ink-flow__renderer",ref:j,style:Pb,children:k})}var Ib={actInsideInputWithModifier:!1};function Ab(e,n){var t;switch(e.type){case"select":n.selected=e.selected;break;case"position":void 0!==e.position&&(n.position=e.position),void 0!==e.dragging&&(n.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(null!==(t=n.measured)&&void 0!==t||(n.measured={}),n.measured.width=e.dimensions.width,n.measured.height=e.dimensions.height,e.setAttributes&&(n.width=e.dimensions.width,n.height=e.dimensions.height)),"boolean"==typeof e.resizing&&(n.resizing=e.resizing)}}function zb(e,t){var r,o,a,u,c,s,l=[],d=new Map;try{for(var f=i(e),h=f.next();!h.done;h=f.next()){if("add"!==(_=h.value).type)if("remove"===_.type||"replace"===_.type)d.set(_.id,[_]);else{var v=d.get(_.id);v?v.push(_):d.set(_.id,[_])}else l.push(_.item)}}catch(e){r={error:e}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}try{for(var p=i(t),g=p.next();!g.done;g=p.next()){var y=g.value,m=d.get(y.id);if(m){if("remove"!==m[0].type)if("replace"!==m[0].type){var x=n({},y);try{for(var w=(c=void 0,i(m)),b=w.next();!b.done;b=w.next()){var _;Ab(_=b.value,x)}}catch(e){c={error:e}}finally{try{b&&!b.done&&(s=w.return)&&s.call(w)}finally{if(c)throw c.error}}l.push(x)}else l.push(n({},m[0].item))}else l.push(y)}}catch(e){a={error:e}}finally{try{g&&!g.done&&(u=p.return)&&u.call(p)}finally{if(a)throw a.error}}return l}function Tb(e,n){return zb(e,n)}function Bb(e,n){return zb(e,n)}function Lb(e,n){return{id:e,type:"select",selected:n}}function Db(e,n,t){var r,o;void 0===n&&(n=new Set),void 0===t&&(t=!1);var u=[];try{for(var c=i(e),s=c.next();!s.done;s=c.next()){var l=a(s.value,2),d=l[0],f=l[1],h=n.has(d);void 0===f.selected&&!h||f.selected===h||(t&&(f.selected=h),u.push(Lb(f.id,h)))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}return u}function Rb(e){var n,t,r,o,u,c,s=e.items,l=void 0===s?[]:s,d=e.lookup,f=[],h=new Map(l.map((function(e){return[e.id,e]})));try{for(var v=i(l),p=v.next();!p.done;p=v.next()){var g=p.value,y=d.get(g.id),m=null!==(c=null===(u=null==y?void 0:y.internals)||void 0===u?void 0:u.userNode)&&void 0!==c?c:y;void 0!==m&&m!==g&&f.push({id:g.id,item:g,type:"replace"}),void 0===m&&f.push({item:g,type:"add"})}}catch(e){n={error:e}}finally{try{p&&!p.done&&(t=v.return)&&t.call(v)}finally{if(n)throw n.error}}try{for(var x=i(d),w=x.next();!w.done;w=x.next()){var b=a(w.value,1)[0];void 0===h.get(b)&&f.push({id:b,type:"remove"})}}catch(e){r={error:e}}finally{try{w&&!w.done&&(o=x.return)&&o.call(x)}finally{if(r)throw r.error}}return f}function Vb(e){return{id:e.id,type:"remove"}}var Hb=function(e,n){void 0===n&&(n=[0,0]);var t=nb(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},Yb=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.length)return{x:0,y:0,width:0,height:0};var t=e.reduce((function(e,t){var r=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=qw(e,n).positionAbsolute,s=c.x,l=c.y;return{x:s,y:l,x2:s+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:l+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}}(t,n.nodeOrigin);return ab(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return cb(t)},Xb=function(e,t,r,o,u,c){var s,l,d,f,h,v,p,g,y=a(void 0===r?[0,0,1]:r,3),m=y[0],x=y[1],w=y[2];void 0===o&&(o=!1),void 0===u&&(u=!1),void 0===c&&(c=[0,0]);var b=n(n({},ob(t,[m,x,w])),{width:t.width/w,height:t.height/w}),_=[];try{for(var E=i(e),S=E.next();!S.done;S=E.next()){var k=a(S.value,2)[1],C=k.measured,N=k.selectable,O=void 0===N||N,P=k.hidden,M=void 0!==P&&P,j=null!==(h=null!==(f=null!==(d=C.width)&&void 0!==d?d:k.width)&&void 0!==f?f:k.initialWidth)&&void 0!==h?h:null,I=null!==(g=null!==(p=null!==(v=C.height)&&void 0!==v?v:k.height)&&void 0!==p?p:k.initialHeight)&&void 0!==g?g:null;if(!(u&&!O||M)){var A=db(b,ib(k,c));(null===j||null===I||o&&A>0||A>=(null!=j?j:0)*(null!=I?I:0)||k.dragging)&&_.push(k)}}}catch(e){s={error:e}}finally{try{S&&!S.done&&(l=E.return)&&l.call(E)}finally{if(s)throw s.error}}return _},Fb=function(e,n){var t=new Set;return e.forEach((function(e){t.add(e.id)})),n.filter((function(e){return t.has(e.source)||t.has(e.target)}))};function Zb(e,n){var t,r,o,i=e.nodeLookup,a=e.width,u=e.height,c=e.panZoom,s=e.minZoom,l=e.maxZoom,d=e.nodeOrigin,f=void 0===d?[0,0]:d,h=[],v=(null==n?void 0:n.nodes)?new Set(n.nodes.map((function(e){return e.id}))):null;if(i.forEach((function(e){!(e.measured.width&&e.measured.height&&((null==n?void 0:n.includeHiddenNodes)||!e.hidden))||v&&!v.has(e.id)||h.push(e)})),h.length>0){var p=Yb(h,{nodeOrigin:f}),g=fb(p,a,u,null!==(t=null==n?void 0:n.minZoom)&&void 0!==t?t:s,null!==(r=null==n?void 0:n.maxZoom)&&void 0!==r?r:l,null!==(o=null==n?void 0:n.padding)&&void 0!==o?o:.1);return c.setViewport(g,{duration:null==n?void 0:n.duration}),!0}return!1}function Ub(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),s=c.parentId?r.get(c.parentId):void 0,l=s?Hb(s,s.origin||i).positionAbsolute:{x:0,y:0},d=l.x,f=l.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)s&&hb(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(s){var v=c.measured.width,p=c.measured.height,g=s.measured.width,y=s.measured.height;if(v&&p&&g&&y){var m=c.origin||i,x=d+v*m[0],w=f+p*m[1];h=[[x,w],[x+g-v,w+y-p]]}}else null==u||u("005",Vy.error005());var b=hb(h)?eb(t,h):t;return{position:{x:b.x-d,y:b.y-f},positionAbsolute:b}}function Gb(e){return r(this,arguments,void 0,(function(e){var n,t,r,a,u,c,s,l,d,f,h,v,p,g,y,m,x,w,b,_=e.nodesToRemove,E=void 0===_?[]:_,S=e.edgesToRemove,k=void 0===S?[]:S,C=e.nodes,N=e.edges,O=e.onBeforeDelete;return o(this,(function(e){switch(e.label){case 0:n=new Set(E.map((function(e){return e.id}))),t=[],r=function(e){if(!1===e.deletable)return"continue";var r=n.has(e.id),o=!r&&e.parentId&&t.find((function(n){return n.id===e.parentId}));(r||o)&&t.push(e)};try{for(a=i(C),u=a.next();!u.done;u=a.next())c=u.value,r(c)}catch(e){m={error:e}}finally{try{u&&!u.done&&(x=a.return)&&x.call(a)}finally{if(m)throw m.error}}s=new Set(k.map((function(e){return e.id}))),l=N.filter((function(e){return!1!==e.deletable})),d=Fb(t,l),f=d,h=function(e){s.has(e.id)&&!f.find((function(n){return n.id===e.id}))&&f.push(e)};try{for(v=i(l),p=v.next();!p.done;p=v.next())g=p.value,h(g)}catch(e){w={error:e}}finally{try{p&&!p.done&&(b=v.return)&&b.call(v)}finally{if(w)throw w.error}}return O?[4,O({nodes:t,edges:f})]:[2,{edges:f,nodes:t}];case 1:return"boolean"==typeof(y=e.sent())?[2,y?{edges:f,nodes:t}:{edges:[],nodes:[]}]:[2,y]}}))}))}var Wb=function(e){return{userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect}};function qb(){var e=Zw(Wb,Ob),n=e.userSelectionActive,t=e.userSelectionRect;return n&&t?h.jsx("div",{className:"ink-flow__selection ink-flow__container",style:{width:t.width,height:t.height,transform:"translate(".concat(t.x,"px, ").concat(t.y,"px)")}}):null}var $b=function(e,n){return function(t){t.target===n.current&&(null==e||e(t))}},Kb=function(e){return{userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}};function Qb(n){var t=n.isSelecting;n.selectionMode;var r=n.panOnDrag,o=n.onSelectionStart,u=n.onSelectionEnd,c=n.onPaneClick,s=n.onPaneContextMenu,l=n.onPaneScroll,d=n.onPaneMouseEnter,f=n.onPaneMouseMove,v=n.onPaneMouseLeave,p=n.children,g=e.useRef(null),y=Uw(),x=e.useRef(0),w=e.useRef(0),b=e.useRef(),_=e.useRef(new Map),E=Zw(Kb,Ob),S=E.userSelectionActive,k=E.elementsSelectable,C=E.dragging,N=function(){y.setState({userSelectionActive:!1,userSelectionRect:null}),x.current=0,w.current=0},O=function(e){null==c||c(e),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},P=l?function(e){return l(e)}:void 0,M=k&&(t||S);return h.jsxs("div",{className:m(["ink-flow__pane",{draggable:r,dragging:C,selection:t}]),onClick:M?void 0:$b(O,g),onContextMenu:$b((function(e){Array.isArray(r)&&(null==r?void 0:r.includes(2))?e.preventDefault():null==s||s(e)}),g),onWheel:$b(P,g),onMouseEnter:M?void 0:d,onMouseDown:M?function(e){var n,r,u,c,s=y.getState(),l=s.resetSelectedElements,d=s.domNode,f=s.edgeLookup;if(b.current=null==d?void 0:d.getBoundingClientRect(),k&&t&&0===e.button&&e.target===g.current&&b.current){_.current=new Map;try{for(var h=i(f),v=h.next();!v.done;v=h.next()){var p=a(v.value,2),m=p[0],x=p[1];_.current.set(x.source,(null===(u=_.current.get(x.source))||void 0===u?void 0:u.add(m))||new Set([m])),_.current.set(x.target,(null===(c=_.current.get(x.target))||void 0===c?void 0:c.add(m))||new Set([m]))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}var w=_b(e.nativeEvent,b.current),E=w.x,S=w.y;l(),y.setState({userSelectionRect:{width:0,height:0,startX:E,startY:S,x:E,y:S}}),null==o||o(e)}}:void 0,onMouseMove:M?function(e){var n,r,o,a,u=y.getState(),c=u.userSelectionRect,s=u.edgeLookup,l=u.transform,d=u.nodeOrigin,f=u.nodeLookup,h=u.triggerNodeChanges,v=u.triggerEdgeChanges;if(t&&b.current&&c){var p=_b(e.nativeEvent,b.current),g=p.x,m=p.y,E=c.startX,S=c.startY,k={startX:E,startY:S,x:g<E?g:E,y:m<S?m:S,width:Math.abs(g-E),height:Math.abs(m-S)},C=Xb(f,k,l,!1,!0,d),N=new Set,O=new Set;try{for(var P=i(C),M=P.next();!M.done;M=P.next()){var j=M.value;O.add(j.id);var I=_.current.get(j.id);if(I)try{for(var A=(o=void 0,i(I)),z=A.next();!z.done;z=A.next()){var T=z.value;N.add(T)}}catch(e){o={error:e}}finally{try{z&&!z.done&&(a=A.return)&&a.call(A)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{M&&!M.done&&(r=P.return)&&r.call(P)}finally{if(n)throw n.error}}if(x.current!==O.size)x.current=O.size,h(Db(f,O,!0));if(w.current!==N.size)w.current=N.size,v(Db(s,N));y.setState({userSelectionRect:k,userSelectionActive:!0,nodesSelectionActive:!1})}}:f,onMouseUp:M?function(e){if(0===e.button){var n=y.getState().userSelectionRect;!S&&n&&e.target===g.current&&(null==O||O(e)),y.setState({nodesSelectionActive:x.current>0}),N(),null==u||u(e)}}:void 0,onMouseLeave:M?function(e){S&&(y.setState({nodesSelectionActive:x.current>0}),null==u||u(e)),N()}:v,ref:g,style:Pb,children:[p,h.jsx(qb,{})]})}var Jb=function(e){return{nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive}};function e_(n){var t=n.children,r=n.onPaneClick,o=n.onPaneMouseEnter,i=n.onPaneMouseMove,a=n.onPaneMouseLeave,u=n.onPaneContextMenu,c=n.onPaneScroll,s=n.deleteKeyCode,l=n.selectionKeyCode,d=n.selectionOnDrag,f=n.selectionMode,v=n.onSelectionStart,p=n.onSelectionEnd,g=n.multiSelectionKeyCode,y=n.panActivationKeyCode,m=n.zoomActivationKeyCode,x=n.elementsSelectable,w=n.zoomOnScroll,b=n.zoomOnPinch,_=n.panOnScroll,E=n.panOnScrollSpeed,S=n.panOnScrollMode,k=n.zoomOnDoubleClick,C=n.panOnDrag,N=n.defaultViewport,O=n.translateExtent,P=n.minZoom,M=n.maxZoom,j=n.preventScrolling;n.onSelectionContextMenu;var I=n.noWheelClassName,A=n.noPanClassName;n.disableKeyboardA11y;var z=n.onViewportChange,T=n.isControlledViewport,B=Zw(Jb);B.nodesSelectionActive;var L=B.userSelectionActive,D=kb(l),R=kb(y),V=R||C,H=R||_,Y=D||L||d&&!0!==V;return function(n){var t=n.deleteKeyCode,r=n.multiSelectionKeyCode,o=Uw(),i=kb(t,Ib),a=kb(r);e.useEffect((function(){if(i){var e=o.getState();e.edges,e.nodes,o.setState({nodesSelectionActive:!1})}}),[i]),e.useEffect((function(){o.setState({multiSelectionActive:a})}),[a])}({deleteKeyCode:s,multiSelectionKeyCode:g}),h.jsx(jb,{onPaneContextMenu:u,elementsSelectable:x,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:H,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!D&&V,defaultViewport:N,translateExtent:O,minZoom:P,maxZoom:M,zoomActivationKeyCode:m,preventScrolling:j,noWheelClassName:I,noPanClassName:A,onViewportChange:z,isControlledViewport:T,children:h.jsx(Qb,{onSelectionStart:v,onSelectionEnd:p,onPaneClick:r,onPaneMouseEnter:o,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:u,onPaneScroll:c,panOnDrag:V,isSelecting:!!Y,selectionMode:f,children:t})})}e_.displayName="FlowRenderer";var n_=e.memo(e_);var t_="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function r_(n){var t=a(e.useState(!1),2),r=t[0],o=t[1],i=a(e.useState((function(){return function(e){var n=[];return{get:function(){return n},reset:function(){n=[]},push:function(t){n.push(t),e()}}}((function(){return o(!0)}))})),1),u=i[0];return t_((function(){if(r){var e=u.get();e.length&&(n(e),u.reset()),o(!1)}else u.reset()}),[r]),u}var o_=e.createContext(null);function i_(n){var t=n.children,r=Uw(),o=e.useCallback((function(e){var n,t,o=r.getState(),a=o.nodes,u=void 0===a?[]:a,c=o.setNodes,s=o.hasDefaultNodes,l=o.onNodesChange,d=o.nodeLookup,f=u;try{for(var h=i(e),v=h.next();!v.done;v=h.next()){var p=v.value;f="function"==typeof p?p(f):p}}catch(e){n={error:e}}finally{try{v&&!v.done&&(t=h.return)&&t.call(h)}finally{if(n)throw n.error}}s?c(f):l&&l(Rb({items:f,lookup:d}))}),[]),a=r_(o),u=e.useCallback((function(e){var n,t,o=r.getState(),a=o.edges,u=void 0===a?[]:a,c=o.setEdges,s=o.hasDefaultEdges,l=o.onEdgesChange,d=o.edgeLookup,f=u;try{for(var h=i(e),v=h.next();!v.done;v=h.next()){var p=v.value;f="function"==typeof p?p(f):p}}catch(e){n={error:e}}finally{try{v&&!v.done&&(t=h.return)&&t.call(h)}finally{if(n)throw n.error}}s?c(f):l&&l(Rb({items:f,lookup:d}))}),[]),c=r_(u),s=e.useMemo((function(){return{nodeQueue:a,edgeQueue:c}}),[]);return h.jsx(o_.Provider,{value:s,children:t})}var a_=function(){var n=Uw();return e.useMemo((function(){return{zoomIn:function(e){var t;return null===(t=n.getState().panZoom)||void 0===t?void 0:t.scaleBy(1.2,{duration:null==e?void 0:e.duration})},zoomOut:function(e){var t;return null===(t=n.getState().panZoom)||void 0===t?void 0:t.scaleBy(1/1.2,{duration:null==e?void 0:e.duration})},zoomTo:function(e,t){var r;return null===(r=n.getState().panZoom)||void 0===r?void 0:r.scaleTo(e,{duration:null==t?void 0:t.duration})},getZoom:function(){return n.getState().transform[2]},setViewport:function(e,t){var r,o,i,u=n.getState(),c=a(u.transform,3),s=c[0],l=c[1],d=c[2],f=u.panZoom;null==f||f.setViewport({x:null!==(r=e.x)&&void 0!==r?r:s,y:null!==(o=e.y)&&void 0!==o?o:l,zoom:null!==(i=e.zoom)&&void 0!==i?i:d},{duration:null==t?void 0:t.duration})},getViewport:function(){var e=a(n.getState().transform,3);return{x:e[0],y:e[1],zoom:e[2]}},fitView:function(e){var t=n.getState(),r=t.nodeLookup,o=t.width,i=t.height,a=t.nodeOrigin,u=t.minZoom,c=t.maxZoom,s=t.panZoom;return!!s&&Zb({nodeLookup:r,width:o,height:i,nodeOrigin:a,minZoom:u,maxZoom:c,panZoom:s},e)},setCenter:function(e,t,r){var o=n.getState(),i=o.width,a=o.height,u=o.maxZoom,c=o.panZoom,s=void 0!==(null==r?void 0:r.zoom)?r.zoom:u,l=i/2-e*s,d=a/2-t*s;null==c||c.setViewport({x:l,y:d,zoom:s},{duration:null==r?void 0:r.duration})},fitBounds:function(e,t){var r,o=n.getState(),i=o.width,a=o.height,u=o.minZoom,c=o.maxZoom,s=o.panZoom,l=fb(e,i,a,u,c,null!==(r=null==t?void 0:t.padding)&&void 0!==r?r:.1);null==s||s.setViewport(l,{duration:null==t?void 0:t.duration})},screenToFlowPosition:function(e,t){void 0===t&&(t={snapToGrid:!0});var r=n.getState(),o=r.transform,i=r.snapGrid,a=r.domNode;if(!a)return e;var u=a.getBoundingClientRect(),c=u.x,s=u.y,l={x:e.x-c,y:e.y-s};return ob(l,o,t.snapToGrid,i)},flowToScreenPosition:function(e){var t=n.getState(),r=t.transform,o=t.domNode;if(!o)return e;var i=o.getBoundingClientRect(),u=i.x,c=i.y,s=function(e,n){var t=e.x,r=e.y,o=a(n,3),i=o[0],u=o[1],c=o[2];return{x:t*c+i,y:r*c+u}}(e,r);return{x:s.x+u,y:s.y+c}}}}),[])},u_=function(e){return!!e.panZoom};function c_(){var t=this,i=a_(),c=Uw(),s=function(){var n=e.useContext(o_);if(!n)throw new Error("useBatchContext must be used within a BatchProvider");return n}(),l=Zw(u_),d=e.useMemo((function(){var e=function(e){return c.getState().nodeLookup.get(e)},i=function(e){s.nodeQueue.push(e)},l=function(e){var t,r,o,i,a=c.getState(),u=a.nodeLookup,s=a.nodeOrigin,l=pb(e)?e:u.get(e.id),d=l.parentId?function(e,t,r,o){var i,a;void 0===o&&(o=[0,0]);for(var u=t,c=n({},e);u;){var s=r.get(t);if(u=null==s?void 0:s.parentId,s){var l=s.origin||o,d=(null!==(i=s.measured.width)&&void 0!==i?i:0)*l[0],f=(null!==(a=s.measured.height)&&void 0!==a?a:0)*l[1];c.x+=s.position.x-d,c.y+=s.position.y-f}}return c}(l.position,l.parentId,u,s):l.position,f={id:l.id,position:d,width:null!==(r=null===(t=l.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:l.width,height:null!==(i=null===(o=l.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:l.height,data:l.data};return ib(f)},d=function(e,t,r){void 0===r&&(r={replace:!1}),i((function(o){return o.map((function(o){if(o.id===e){var i="function"==typeof t?t(o):t;return r.replace&&pb(i)?i:n(n({},o),i)}return o}))}))};return{getNodes:function(){return c.getState().nodes.map((function(e){return n({},e)}))},getNode:function(n){var t;return null===(t=e(n))||void 0===t?void 0:t.internals.userNode},getInternalNode:e,getEdges:function(){var e=c.getState().edges;return(void 0===e?[]:e).map((function(e){return n({},e)}))},getEdge:function(e){return c.getState().edgeLookup.get(e)},setNodes:i,setEdges:function(e){s.edgeQueue.push(e)},addNodes:function(e){var n=Array.isArray(e)?e:[e];s.nodeQueue.push((function(e){return u(u([],a(e),!1),a(n),!1)}))},addEdges:function(e){var n=Array.isArray(e)?e:[e];s.edgeQueue.push((function(e){return u(u([],a(e),!1),a(n),!1)}))},toObject:function(){var e=c.getState(),t=e.nodes,r=void 0===t?[]:t,o=e.edges,i=void 0===o?[]:o,u=a(e.transform,3),s=u[0],l=u[1],d=u[2];return{nodes:r.map((function(e){return n({},e)})),edges:i.map((function(e){return n({},e)})),viewport:{x:s,y:l,zoom:d}}},deleteElements:function(e){return r(t,[e],void 0,(function(e){var n,t,r,i,a,u,s,l,d,f,h,v,p,g,y,m,x=e.nodes,w=void 0===x?[]:x,b=e.edges,_=void 0===b?[]:b;return o(this,(function(e){switch(e.label){case 0:return n=c.getState(),t=n.nodes,r=n.edges,i=n.onNodesDelete,a=n.onEdgesDelete,u=n.triggerNodeChanges,s=n.triggerEdgeChanges,l=n.onDelete,d=n.onBeforeDelete,[4,Gb({nodesToRemove:w,edgesToRemove:_,nodes:t,edges:r,onBeforeDelete:d})];case 1:return f=e.sent(),h=f.nodes,v=f.edges,p=v.length>0,g=h.length>0,p&&(y=v.map(Vb),null==a||a(v),s(y)),g&&(m=h.map(Vb),null==i||i(h),u(m)),(g||p)&&(null==l||l({nodes:h,edges:v})),[2,{deletedNodes:h,deletedEdges:v}]}}))}))},getIntersectingNodes:function(e,n,t){void 0===n&&(n=!0);var r=yb(e),o=r?e:l(e),i=void 0!==t;return o?(t||c.getState().nodes).filter((function(t){var a=c.getState().nodeLookup.get(t.id);if(a&&!r&&(t.id===e.id||!a.internals.positionAbsolute))return!1;var u=ib(i?t:a),s=db(u,o);return n&&s>0||s>=o.width*o.height})):[]},isNodeIntersecting:function(e,n,t){void 0===t&&(t=!0);var r=yb(e)?e:l(e);if(!r)return!1;var o=db(r,n);return t&&o>0||o>=r.width*r.height},updateNode:d,updateNodeData:function(e,t,r){void 0===r&&(r={replace:!1}),d(e,(function(e){var o="function"==typeof t?t(e):t;return r.replace?n(n({},e),{data:o}):n(n({},e),{data:n(n({},e.data),o)})}),r)}}}),[]);return e.useMemo((function(){return n(n(n({},d),i),{viewportInitialized:l})}),[l])}var s_=function(e){return e.updateNodeInternals};var l_=function(e){return function(n){return e?Xb(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map((function(e){return e.id})):Array.from(n.nodeLookup.keys())}};var d_=e.createContext(null),f_=d_.Provider;d_.Consumer;var h_="ink-flow__node-desc",v_="ink-flow__edge-desc";function p_(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=e.sourceControlX,a=e.sourceControlY,u=.125*n+.375*i+.375*e.targetControlX+.125*r,c=.125*t+.375*a+.375*e.targetControlY+.125*o;return[u,c,Math.abs(u-n),Math.abs(c-t)]}function g_(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function y_(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case exports.Position.Left:return[t-g_(t-o,a),r];case exports.Position.Right:return[t+g_(o-t,a),r];case exports.Position.Top:return[t,r-g_(r-i,a)];case exports.Position.Bottom:return[t,r+g_(i-r,a)]}}function m_(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Math.abs(r-n)/2,a=r<n?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}var x_,w_=function(e){var n=e.source,t=e.sourceHandle,r=e.target,o=e.targetHandle;return"xy-edge__".concat(n).concat(t||"","-").concat(r).concat(o||"")};var b_=((x_={})[exports.Position.Left]={x:-1,y:0},x_[exports.Position.Right]={x:1,y:0},x_[exports.Position.Top]={x:0,y:-1},x_[exports.Position.Bottom]={x:0,y:1},x_),__=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?exports.Position.Bottom:t,o=e.target;return r===exports.Position.Left||r===exports.Position.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}},E_=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function S_(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,c=e.targetY,s=e.targetPosition,l=void 0===s?exports.Position.Top:s,d=e.borderRadius,f=void 0===d?5:d,h=e.centerX,v=e.centerY,p=e.offset,g=a(function(e){var n,t,r,o,i=e.source,c=e.sourcePosition,s=void 0===c?exports.Position.Bottom:c,l=e.target,d=e.targetPosition,f=void 0===d?exports.Position.Top:d,h=e.center,v=e.offset,p=b_[s],g=b_[f],y={x:i.x+p.x*v,y:i.y+p.y*v},m={x:l.x+g.x*v,y:l.y+g.y*v},x=__({source:y,sourcePosition:s,target:m}),w=0!==x.x?"x":"y",b=x[w],_=[],E={x:0,y:0},S={x:0,y:0},k=a(m_({sourceX:i.x,sourceY:i.y,targetX:l.x,targetY:l.y}),4),C=k[0],N=k[1],O=k[2],P=k[3];if(p[w]*g[w]==-1){r=null!==(n=h.x)&&void 0!==n?n:C,o=null!==(t=h.y)&&void 0!==t?t:N;var M=[{x:r,y:y.y},{x:r,y:m.y}],j=[{x:y.x,y:o},{x:m.x,y:o}];_=p[w]===b?"x"===w?M:j:"x"===w?j:M}else{var I=[{x:y.x,y:m.y}],A=[{x:m.x,y:y.y}];if(_="x"===w?p.x===b?A:I:p.y===b?I:A,s===f){var z=Math.abs(i[w]-l[w]);if(z<=v){var T=Math.min(v-1,v-z);p[w]===b?E[w]=(y[w]>i[w]?-1:1)*T:S[w]=(m[w]>l[w]?-1:1)*T}}if(s!==f){var B="x"===w?"y":"x",L=p[w]===g[B],D=y[B]>m[B],R=y[B]<m[B];(1===p[w]&&(!L&&D||L&&R)||1!==p[w]&&(!L&&R||L&&D))&&(_="x"===w?I:A)}var V={x:y.x+E.x,y:y.y+E.y},H={x:m.x+S.x,y:m.y+S.y};Math.max(Math.abs(V.x-_[0].x),Math.abs(H.x-_[0].x))>=Math.max(Math.abs(V.y-_[0].y),Math.abs(H.y-_[0].y))?(r=(V.x+H.x)/2,o=_[0].y):(r=_[0].x,o=(V.y+H.y)/2)}return[u(u([i,{x:y.x+E.x,y:y.y+E.y}],a(_),!1),[{x:m.x+S.x,y:m.y+S.y},l],!1),r,o,O,P]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:c},targetPosition:l,center:{x:h,y:v},offset:void 0===p?20:p}),5),y=g[0],m=g[1],x=g[2],w=g[3],b=g[4],_=y.reduce((function(e,n,t){var r="";return r=t>0&&t<y.length-1?function(e,n,t,r){var o=Math.min(E_(e,n)/2,E_(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var s=e.x<t.x?1:-1,l=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*l,"Q ").concat(i,",").concat(a," ").concat(i+o*s,",").concat(a)}(y[t-1],n,y[t+1],f):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+=r}),"");return[_,m,x,w,b]}var k_=function(e){return{connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}};var C_=e.memo(lb((function(r,o){var i,a,u=r.type,c=void 0===u?"source":u,s=r.position,l=void 0===s?exports.Position.Top:s,d=r.isValidConnection,f=r.isConnectable,v=void 0===f||f,p=r.isConnectableStart,g=void 0===p||p,y=r.isConnectableEnd,x=void 0===y||y,w=r.id,b=r.onConnect,_=r.children,E=r.className,S=r.onMouseDown,k=r.onTouchStart,C=t(r,["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"]),N=w||null,O="target"===c,P=Uw(),M=e.useContext(d_),j=Zw(k_,Ob),I=j.connectOnClick,A=j.noPanClassName,z=j.rfId,T=Zw(function(e,n,t){return function(r){var o=r.connectionStartHandle,i=r.connectionEndHandle,a=r.connectionClickStartHandle,u=r.connectionMode,c=r.connectionStatus,s=(null==i?void 0:i.nodeId)===e&&(null==i?void 0:i.handleId)===n&&(null==i?void 0:i.type)===t;return{connectingFrom:(null==o?void 0:o.nodeId)===e&&(null==o?void 0:o.handleId)===n&&(null==o?void 0:o.type)===t,connectingTo:s,clickConnecting:(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===n&&(null==a?void 0:a.type)===t,isPossibleEndHandle:u===exports.ConnectionMode.Strict?(null==o?void 0:o.type)!==t:e!==(null==o?void 0:o.nodeId)||n!==(null==o?void 0:o.handleId),connectionInProcess:!!o,valid:s&&"valid"===c}}}(M,N,c),Ob),B=T.connectingFrom,L=T.connectingTo,D=T.clickConnecting,R=T.isPossibleEndHandle,V=T.connectionInProcess,H=T.valid;M||null===(a=(i=P.getState()).onError)||void 0===a||a.call(i,"010",Vy.error010());var Y=function(e){var t=P.getState(),r=t.defaultEdgeOptions,o=t.onConnect,i=t.hasDefaultEdges,a=n(n({},r),e);if(i){var u=P.getState(),c=u.edges;(0,u.setEdges)(function(e,t){return e.source&&e.target?function(e,n){return n.some((function(n){return!(n.source!==e.source||n.target!==e.target||n.sourceHandle!==e.sourceHandle&&(n.sourceHandle||e.sourceHandle)||n.targetHandle!==e.targetHandle&&(n.targetHandle||e.targetHandle))}))}(r="id"in(o=e)&&"source"in o&&"target"in o?n({},e):n(n({},e),{id:w_(e)}),t)?t:(null===r.sourceHandle&&delete r.sourceHandle,null===r.targetHandle&&delete r.targetHandle,t.concat(r)):t;var r,o}(a,c))}null==o||o(a),null==b||b(a)},X=function(e){if(M){var n=bb(e.nativeEvent);if(g&&(n&&0===e.button||!n)){var t=P.getState();Sm.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:O,handleId:N,nodeId:M,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:Y,isValidConnection:d||t.isValidConnection,getTransform:function(){return P.getState().transform},getConnectionStartHandle:function(){return P.getState().connectionStartHandle}})}n?null==S||S(e):null==k||k(e)}};return h.jsx("div",n({"data-handleid":N,"data-nodeid":M,"data-handlepos":l,"data-id":"".concat(z,"-").concat(M,"-").concat(N,"-").concat(c),className:m(["ink-flow__handle","ink-flow__handle-".concat(l),"nodrag",A,E,{source:!O,target:O,connectable:v,connectablestart:g,connectableend:x,clickconnecting:D,connectingfrom:B,connectingto:L,valid:H,connectionindicator:v&&(!V||R)&&(V?x:g)}]),onMouseDown:X,onTouchStart:X,onClick:I?function(e){var n=P.getState(),t=n.onClickConnectStart,r=n.onClickConnectEnd,o=n.connectionClickStartHandle,i=n.connectionMode,a=n.isValidConnection,u=n.lib,s=n.rfId;if(M&&(o||g)){if(!o)return null==t||t(e.nativeEvent,{nodeId:M,handleId:N,handleType:c}),void P.setState({connectionClickStartHandle:{nodeId:M,type:c,handleId:N}});var l=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)}(e.target),f=d||a,h=Sm.isValid(e.nativeEvent,{handle:{nodeId:M,id:N,type:c},connectionMode:i,fromNodeId:o.nodeId,fromHandleId:o.handleId||null,fromType:o.type,isValidConnection:f,flowId:s,doc:l,lib:u}),v=h.connection;h.isValid&&v&&Y(v),null==r||r(e),P.setState({connectionClickStartHandle:null})}}:void 0,ref:o},C,{children:_}))})));var N_={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},O_={input:function(e){var n=e.data,t=e.isConnectable,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r;return h.jsxs(h.Fragment,{children:[null==n?void 0:n.label,h.jsx(C_,{type:"source",position:o,isConnectable:t})]})},default:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?exports.Position.Top:r,i=e.sourcePosition,a=void 0===i?exports.Position.Bottom:i;return h.jsxs(h.Fragment,{children:[h.jsx(C_,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label,h.jsx(C_,{type:"source",position:a,isConnectable:t})]})},output:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?exports.Position.Top:r;return h.jsxs(h.Fragment,{children:[h.jsx(C_,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label]})},group:function(){return null}};function P_(e){var n=e.id,t=e.store,r=e.unselect,o=void 0!==r&&r,i=e.nodeRef,a=t.getState(),u=a.addSelectedNodes,c=a.unselectNodesAndEdges,s=a.multiSelectionActive,l=a.nodeLookup,d=a.onError,f=l.get(n);f?(t.setState({nodesSelectionActive:!1}),f.selected?(o||f.selected&&s)&&(c({nodes:[f],edges:[]}),requestAnimationFrame((function(){var e;return null===(e=null==i?void 0:i.current)||void 0===e?void 0:e.blur()}))):u([n])):null==d||d("012",Vy.error012(n))}var M_=function(e){return function(n){return n.selected&&(n.draggable||e&&void 0===n.draggable)}};function j_(t){var r,o=t.id,u=t.onClick,c=t.onMouseEnter,s=t.onMouseMove,l=t.onMouseLeave,d=t.onContextMenu,f=t.onDoubleClick,v=t.nodesDraggable,p=t.elementsSelectable,g=t.nodesConnectable,y=t.nodesFocusable,x=t.resizeObserver,w=t.noDragClassName,b=t.noPanClassName,_=t.disableKeyboardA11y,E=t.rfId,S=t.nodeTypes,k=t.nodeExtent,C=t.nodeOrigin,N=t.onError,O=Zw((function(e){var n=e.nodeLookup.get(o),t=e.parentLookup.has(o);return{node:n,internals:n.internals,isParent:t}}),Ob),P=O.node,M=O.internals,j=O.isParent,I=P.type||"default",A=(null==S?void 0:S[I])||O_[I];void 0===A&&(null==N||N("003",Vy.error003(I)),I="default",A=O_.default);var z=!!(P.draggable||v&&void 0===P.draggable),T=!!(P.selectable||p&&void 0===P.selectable),B=!!(P.connectable||g&&void 0===P.connectable),L=!!(P.focusable||y&&void 0===P.focusable),D=Uw(),R=function(e){var n,t,r,o,i,a;return void 0!==(null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==(null!==(a=null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:e.height)&&void 0!==a?a:e.initialHeight)}(P),V=function(n){var t=n.node,r=n.nodeType,o=n.hasDimensions,i=n.resizeObserver,a=Uw(),u=e.useRef(null),c=e.useRef(null),s=e.useRef(t.sourcePosition),l=e.useRef(t.targetPosition),d=e.useRef(r),f=o&&!!t.internals.handleBounds&&!t.hidden;return e.useEffect((function(){!u.current||f&&c.current===u.current||(c.current&&(null==i||i.unobserve(c.current)),null==i||i.observe(u.current),c.current=u.current)}),[f]),e.useEffect((function(){return function(){c.current&&(null==i||i.unobserve(c.current),c.current=null)}}),[]),e.useEffect((function(){if(u.current){var e=d.current!==r,n=s.current!==t.sourcePosition,o=l.current!==t.targetPosition;(e||n||o)&&(d.current=r,s.current=t.sourcePosition,l.current=t.targetPosition,a.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:u.current,force:!0}]])))}}),[t.id,r,t.sourcePosition,t.targetPosition]),u}({node:P,nodeType:I,hasDimensions:R,resizeObserver:x}),H=function(n){var t=n.nodeRef,r=n.disabled,o=void 0!==r&&r,i=n.noDragClassName,u=n.handleSelector,c=n.nodeId,s=n.isSelectable,l=Uw(),d=a(e.useState(!1),2),f=d[0],h=d[1],v=e.useRef();return e.useEffect((function(){v.current=mm({getStoreItems:function(){return l.getState()},onNodeMouseDown:function(e){P_({id:e,store:l,nodeRef:t})},onDragStart:function(){h(!0)},onDragStop:function(){h(!1)}})}),[]),e.useEffect((function(){var e,n;if(o)null===(e=v.current)||void 0===e||e.destroy();else if(t.current)return null===(n=v.current)||void 0===n||n.update({noDragClassName:i,handleSelector:u,domNode:t.current,isSelectable:s,nodeId:c}),function(){var e;null===(e=v.current)||void 0===e||e.destroy()}}),[i,u,o,s,t,c]),f}({nodeRef:V,disabled:P.hidden||!z,noDragClassName:w,handleSelector:P.dragHandle,nodeId:o,isSelectable:T}),Y=function(){var n=Uw(),t=e.useCallback((function(e){var t,r,o=n.getState(),u=o.nodeExtent,c=o.snapToGrid,s=o.snapGrid,l=o.nodesDraggable,d=o.onError,f=o.updateNodePositions,h=o.nodeLookup,v=o.nodeOrigin,p=new Map,g=M_(l),y=c?s[0]:5,m=c?s[1]:5,x=e.direction.x*y*e.factor,w=e.direction.y*m*e.factor;try{for(var b=i(h),_=b.next();!_.done;_=b.next()){var E=a(_.value,2)[1];if(g(E)){var S={x:E.internals.positionAbsolute.x+x,y:E.internals.positionAbsolute.y+w};c&&(S=rb(S,s));var k=Ub({nodeId:E.id,nextPosition:S,nodeLookup:h,nodeExtent:u,nodeOrigin:v,onError:d}),C=k.position,N=k.positionAbsolute;E.position=C,E.internals.positionAbsolute=N,p.set(E.id,E)}}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=b.return)&&r.call(b)}finally{if(t)throw t.error}}f(p)}),[]);return t}();if(P.hidden)return null;var X=nb(P),F=function(e){var n,t,r,o,i,a,u,c,s,l;return void 0===e.internals.handleBounds?{width:null!==(t=null!==(n=e.width)&&void 0!==n?n:e.initialWidth)&&void 0!==t?t:null===(r=e.style)||void 0===r?void 0:r.width,height:null!==(i=null!==(o=e.height)&&void 0!==o?o:e.initialHeight)&&void 0!==i?i:null===(a=e.style)||void 0===a?void 0:a.height}:{width:null!==(u=e.width)&&void 0!==u?u:null===(c=e.style)||void 0===c?void 0:c.width,height:null!==(s=e.height)&&void 0!==s?s:null===(l=e.style)||void 0===l?void 0:l.height}}(P),Z=k?eb(M.positionAbsolute,k):M.positionAbsolute,U=vb(n(n(n({},Z),X),{origin:P.origin||C})),G=T||z||u||c||s||l,W=c?function(e){return c(e,n({},M.userNode))}:void 0,q=s?function(e){return s(e,n({},M.userNode))}:void 0,$=l?function(e){return l(e,n({},M.userNode))}:void 0,K=d?function(e){return d(e,n({},M.userNode))}:void 0,Q=f?function(e){return f(e,n({},M.userNode))}:void 0;return h.jsx("div",{className:m(["ink-flow__node","ink-flow__node-".concat(I),(r={},r[b]=z,r),P.className,{selected:P.selected,selectable:T,parent:j,draggable:z,dragging:H}]),ref:V,style:n(n({zIndex:M.z,transform:"translate(".concat(U.x,"px,").concat(U.y,"px)"),pointerEvents:G?"all":"none",visibility:R?"visible":"hidden"},P.style),F),"data-id":o,"data-testid":"rf__node-".concat(o),onMouseEnter:W,onMouseMove:q,onMouseLeave:$,onContextMenu:K,onClick:function(e){var t=D.getState(),r=t.selectNodesOnDrag,i=t.nodeDragThreshold;T&&(!r||!z||i>0)&&P_({id:o,store:D,nodeRef:V}),u&&u(e,n({},M.userNode))},onDoubleClick:Q,onKeyDown:L?function(e){if(!wb(e.nativeEvent)&&!_)if(Yy.includes(e.key)&&T){var n="Escape"===e.key;P_({id:o,store:D,unselect:n,nodeRef:V})}else z&&P.selected&&Object.prototype.hasOwnProperty.call(N_,e.key)&&(D.setState({ariaLiveMessage:"Moved selected node ".concat(e.key.replace("Arrow","").toLowerCase(),". New position, x: ").concat(~~Z.x,", y: ").concat(~~Z.y)}),Y({direction:N_[e.key],factor:e.shiftKey?4:1}))}:void 0,tabIndex:L?0:void 0,role:L?"button":void 0,"aria-describedby":_?void 0:"".concat(h_,"-").concat(E),"aria-label":P.ariaLabel,children:h.jsx(f_,{value:o,children:h.jsx(A,n({id:o,data:P.data,type:I,positionAbsoluteX:Z.x,positionAbsoluteY:Z.y,selected:P.selected,isConnectable:B,sourcePosition:P.sourcePosition,targetPosition:P.targetPosition,dragging:H,dragHandle:P.dragHandle,zIndex:M.z},X))})})}var I_=function(e){return{nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError}};function A_(n){var t,r=Zw(I_,Ob),o=r.nodesDraggable,i=r.nodesConnectable,u=r.nodesFocusable,c=r.elementsSelectable,s=r.onError,l=(t=!1,Zw(e.useCallback(l_(t),[t]),Ob)),d=function(){var n=Zw(s_),t=a(e.useState((function(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver((function(e){var t=new Map;e.forEach((function(e){var n=e.target.getAttribute("data-id");t.set(n,{id:n,nodeElement:e.target})})),n(t)}))})),1),r=t[0];return e.useEffect((function(){return function(){null==r||r.disconnect()}}),[r]),r}();return h.jsx("div",{className:"ink-flow__nodes",style:Pb,children:l.map((function(e){return h.jsx(j_,{id:e,nodeTypes:n.nodeTypes,nodeOrigin:n.nodeOrigin,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,resizeObserver:d,nodesDraggable:o,nodesConnectable:i,nodesFocusable:u,elementsSelectable:c,onError:s},e)}))})}A_.displayName="NodeRenderer";var z_,T_=e.memo(A_),B_=((z_={})[exports.MarkerType.Arrow]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return h.jsx("polyline",{style:{stroke:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"})},z_[exports.MarkerType.ArrowClosed]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return h.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},z_);function L_(e,n){if(!e)return"";if("string"==typeof e)return e;var t=n?"".concat(n,"__"):"";return"".concat(t).concat(Object.keys(e).sort().map((function(n){return"".concat(n,"=").concat(e[n])})).join("&"))}var D_=function(n){var t=n.id,r=n.type,o=n.color,i=n.width,a=void 0===i?12.5:i,u=n.height,c=void 0===u?12.5:u,s=n.markerUnits,l=void 0===s?"strokeWidth":s,d=n.strokeWidth,f=n.orient,v=void 0===f?"auto-start-reverse":f,p=function(n){var t=Uw(),r=e.useMemo((function(){var e,r;return Object.prototype.hasOwnProperty.call(B_,n)?B_[n]:(null===(r=(e=t.getState()).onError)||void 0===r||r.call(e,"009",Vy.error009(n)),null)}),[n]);return r}(r);return p?h.jsx("marker",{className:"ink-flow__arrowhead",id:t,markerWidth:"".concat(a),markerHeight:"".concat(c),viewBox:"-10 -10 20 20",markerUnits:l,orient:v,refX:"0",refY:"0",children:h.jsx(p,{color:o,strokeWidth:d})}):null},R_=function(t){var r=t.defaultColor,o=t.rfId,i=Zw((function(e){return e.edges})),a=Zw((function(e){return e.defaultEdgeOptions})),u=e.useMemo((function(){var e=function(e,t){var r=t.id,o=t.defaultColor,i=t.defaultMarkerStart,a=t.defaultMarkerEnd,u=new Set;return e.reduce((function(e,t){return[t.markerStart||i,t.markerEnd||a].forEach((function(t){if(t&&"object"==typeof t){var i=L_(t,r);u.has(i)||(e.push(n({id:i,color:t.color||o},t)),u.add(i))}})),e}),[]).sort((function(e,n){return e.id.localeCompare(n.id)}))}(i,{id:o,defaultColor:r,defaultMarkerStart:null==a?void 0:a.markerStart,defaultMarkerEnd:null==a?void 0:a.markerEnd});return e}),[i,a,o,r]);return u.length?h.jsx("svg",{className:"ink-flow__marker",children:h.jsx("defs",{children:u.map((function(e){return h.jsx(D_,{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};R_.displayName="MarkerDefinitions";var V_=e.memo(R_);function H_(r){var o=r.x,i=r.y,u=r.label,c=r.labelStyle,s=void 0===c?{}:c,l=r.labelShowBg,d=void 0===l||l,f=r.labelBgStyle,v=void 0===f?{}:f,p=r.labelBgPadding,g=void 0===p?[2,4]:p,y=r.labelBgBorderRadius,x=void 0===y?2:y,w=r.children,b=r.className,_=t(r,["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"]),E=a(e.useState({x:1,y:0,width:0,height:0}),2),S=E[0],k=E[1],C=m(["ink-flow__edge-textwrapper",b]),N=e.useCallback((function(e){if(null!==e){var n=e.getBBox();k({x:n.x,y:n.y,width:n.width,height:n.height})}}),[]);return void 0!==u&&u?h.jsxs("g",n({transform:"translate(".concat(o-S.width/2," ").concat(i-S.height/2,")"),className:C,visibility:S.width?"visible":"hidden"},_,{children:[d&&h.jsx("rect",{width:S.width+2*g[0],x:-g[0],y:-g[1],height:S.height+2*g[1],className:"ink-flow__edge-textbg",style:v,rx:x,ry:x}),h.jsx("text",{className:"ink-flow__edge-text",y:S.height/2,dy:"0.3em",ref:N,style:s,children:u}),w]})):null}H_.displayName="EdgeText";var Y_=e.memo(H_);function X_(e){var n=e.id,t=e.path,r=e.labelX,o=e.labelY,i=e.label,a=e.labelStyle,u=e.labelShowBg,c=e.labelBgStyle,s=e.labelBgPadding,l=e.labelBgBorderRadius,d=e.style,f=e.markerEnd,v=e.markerStart,p=e.className,g=e.interactionWidth,y=void 0===g?20:g;return h.jsxs(h.Fragment,{children:[h.jsx("path",{id:n,style:d,d:t,fill:"none",className:m(["ink-flow__edge-path",p]),markerEnd:f,markerStart:v}),y&&h.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:y,className:"ink-flow__edge-interaction"}),i&&tb(r)&&tb(o)?h.jsx(Y_,{x:r,y:o,label:i,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:s,labelBgBorderRadius:l}):null]})}function F_(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2;return n===exports.Position.Left||n===exports.Position.Right?[.5*(t+o),r]:[t,.5*(r+i)]}function Z_(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,u=e.targetY,c=e.sourcePosition,s=void 0===c?exports.Position.Bottom:c,l=e.targetPosition,d=void 0===l?exports.Position.Top:l,f=e.label,v=e.labelStyle,p=e.labelShowBg,g=e.labelBgStyle,y=e.labelBgPadding,m=e.labelBgBorderRadius,x=e.style,w=e.markerEnd,b=e.markerStart,_=e.interactionWidth,E=a(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,u=e.targetY,c=e.targetPosition,s=void 0===c?exports.Position.Top:c,l=a(F_({pos:o,x1:n,y1:t,x2:i,y2:u}),2),d=l[0],f=l[1],h=a(F_({pos:s,x1:i,y1:u,x2:n,y2:t}),2),v=h[0],p=h[1],g=a(p_({sourceX:n,sourceY:t,targetX:i,targetY:u,sourceControlX:d,sourceControlY:f,targetControlX:v,targetControlY:p}),4),y=g[0],m=g[1],x=g[2],w=g[3];return["M".concat(n,",").concat(t," C").concat(d,",").concat(f," ").concat(v,",").concat(p," ").concat(i,",").concat(u),y,m,x,w]}({sourceX:r,sourceY:o,sourcePosition:s,targetX:i,targetY:u,targetPosition:d}),3),S=E[0],k=E[1],C=E[2],N=n.isInternal?void 0:t;return h.jsx(X_,{id:N,path:S,labelX:k,labelY:C,label:f,labelStyle:v,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:m,style:x,markerEnd:w,markerStart:b,interactionWidth:_})}))}var U_=Z_({isInternal:!1}),G_=Z_({isInternal:!0});function W_(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,u=e.targetY,c=e.label,s=e.labelStyle,l=e.labelShowBg,d=e.labelBgStyle,f=e.labelBgPadding,v=e.labelBgBorderRadius,p=e.style,g=e.sourcePosition,y=void 0===g?exports.Position.Bottom:g,m=e.targetPosition,x=void 0===m?exports.Position.Top:m,w=e.markerEnd,b=e.markerStart,_=e.pathOptions,E=e.interactionWidth,S=a(S_({sourceX:r,sourceY:o,sourcePosition:y,targetX:i,targetY:u,targetPosition:x,borderRadius:null==_?void 0:_.borderRadius,offset:null==_?void 0:_.offset}),3),k=S[0],C=S[1],N=S[2],O=n.isInternal?void 0:t;return h.jsx(X_,{id:O,path:k,labelX:C,labelY:N,label:c,labelStyle:s,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:v,style:p,markerEnd:w,markerStart:b,interactionWidth:E})}))}U_.displayName="SimpleBezierEdge",G_.displayName="SimpleBezierEdgeInternal";var q_=W_({isInternal:!1}),$_=W_({isInternal:!0});function K_(r){return e.memo((function(o){var i,a=o.id,u=t(o,["id"]),c=r.isInternal?void 0:a;return h.jsx(q_,n({},u,{id:c,pathOptions:e.useMemo((function(){var e;return{borderRadius:0,offset:null===(e=u.pathOptions)||void 0===e?void 0:e.offset}}),[null===(i=u.pathOptions)||void 0===i?void 0:i.offset])}))}))}q_.displayName="SmoothStepEdge",$_.displayName="SmoothStepEdgeInternal";var Q_=K_({isInternal:!1}),J_=K_({isInternal:!0});function eE(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,u=e.targetY,c=e.label,s=e.labelStyle,l=e.labelShowBg,d=e.labelBgStyle,f=e.labelBgPadding,v=e.labelBgBorderRadius,p=e.style,g=e.markerEnd,y=e.markerStart,m=e.interactionWidth,x=a(function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=a(m_({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),u=i[0],c=i[1],s=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),u,c,s,l]}({sourceX:r,sourceY:o,targetX:i,targetY:u}),3),w=x[0],b=x[1],_=x[2],E=n.isInternal?void 0:t;return h.jsx(X_,{id:E,path:w,labelX:b,labelY:_,label:c,labelStyle:s,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:v,style:p,markerEnd:g,markerStart:y,interactionWidth:m})}))}Q_.displayName="StepEdge",J_.displayName="StepEdgeInternal";var nE=eE({isInternal:!1}),tE=eE({isInternal:!0});function rE(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,u=e.targetY,c=e.sourcePosition,s=void 0===c?exports.Position.Bottom:c,l=e.targetPosition,d=void 0===l?exports.Position.Top:l,f=e.label,v=e.labelStyle,p=e.labelShowBg,g=e.labelBgStyle,y=e.labelBgPadding,m=e.labelBgBorderRadius,x=e.style,w=e.markerEnd,b=e.markerStart,_=e.pathOptions,E=e.interactionWidth,S=a(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,u=e.targetY,c=e.targetPosition,s=void 0===c?exports.Position.Top:c,l=e.curvature,d=void 0===l?.25:l,f=a(y_({pos:o,x1:n,y1:t,x2:i,y2:u,c:d}),2),h=f[0],v=f[1],p=a(y_({pos:s,x1:i,y1:u,x2:n,y2:t,c:d}),2),g=p[0],y=p[1],m=a(p_({sourceX:n,sourceY:t,targetX:i,targetY:u,sourceControlX:h,sourceControlY:v,targetControlX:g,targetControlY:y}),4),x=m[0],w=m[1],b=m[2],_=m[3];return["M".concat(n,",").concat(t," C").concat(h,",").concat(v," ").concat(g,",").concat(y," ").concat(i,",").concat(u),x,w,b,_]}({sourceX:r,sourceY:o,sourcePosition:s,targetX:i,targetY:u,targetPosition:d,curvature:null==_?void 0:_.curvature}),3),k=S[0],C=S[1],N=S[2],O=n.isInternal?void 0:t;return h.jsx(X_,{id:O,path:k,labelX:C,labelY:N,label:f,labelStyle:v,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:m,style:x,markerEnd:w,markerStart:b,interactionWidth:E})}))}nE.displayName="StraightEdge",tE.displayName="StraightEdgeInternal";var oE=rE({isInternal:!1}),iE=rE({isInternal:!0});oE.displayName="BezierEdge",iE.displayName="BezierEdgeInternal";var aE={default:iE,straight:tE,step:J_,smoothstep:$_,simplebezier:G_},uE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},cE=function(e,n,t){return t===exports.Position.Left?e-n:t===exports.Position.Right?e+n:e},sE=function(e,n,t){return t===exports.Position.Top?e-n:t===exports.Position.Bottom?e+n:e},lE="ink-flow__edgeupdater";function dE(e){var n=e.position,t=e.centerX,r=e.centerY,o=e.radius,i=void 0===o?10:o,a=e.onMouseDown,u=e.onMouseEnter,c=e.onMouseOut,s=e.type;return h.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:c,className:m([lE,"".concat(lE,"-").concat(s)]),cx:cE(t,i,n),cy:sE(r,i,n),r:i,stroke:"transparent",fill:"transparent"})}function fE(e){var n=e.isUpdatable,t=e.edgeUpdaterRadius,r=e.edge,o=e.targetHandleId,i=e.sourceHandleId,a=e.sourceX,u=e.sourceY,c=e.targetX,s=e.targetY,l=e.sourcePosition,d=e.targetPosition,f=e.onEdgeUpdate,v=e.onEdgeUpdateStart,p=e.onEdgeUpdateEnd,g=e.setUpdating,y=e.setUpdateHover,m=Uw(),x=function(e,n){if(0===e.button){var t=m.getState(),a=t.autoPanOnConnect,u=t.domNode,c=t.isValidConnection,s=t.connectionMode,l=t.connectionRadius,d=t.lib,h=t.onConnectStart,y=t.onConnectEnd,x=t.cancelConnection,w=t.nodeLookup,b=t.rfId,_=t.panBy,E=t.updateConnection,S=n?r.target:r.source,k=(n?o:i)||null,C=n?"target":"source",N=n;g(!0),null==v||v(e,r,C);Sm.onPointerDown(e.nativeEvent,{autoPanOnConnect:a,connectionMode:s,connectionRadius:l,domNode:u,handleId:k,nodeId:S,nodeLookup:w,isTarget:N,edgeUpdaterType:C,lib:d,flowId:b,cancelConnection:x,panBy:_,isValidConnection:c,onConnect:function(e){return null==f?void 0:f(r,e)},onConnectStart:h,onConnectEnd:y,onEdgeUpdateEnd:function(e){g(!1),null==p||p(e,r,C)},updateConnection:E,getTransform:function(){return m.getState().transform},getConnectionStartHandle:function(){return m.getState().connectionStartHandle}})}},w=function(){return y(!0)},b=function(){return y(!1)};return h.jsxs(h.Fragment,{children:[("source"===n||!0===n)&&h.jsx(dE,{position:l,centerX:a,centerY:u,radius:t,onMouseDown:function(e){return x(e,!0)},onMouseEnter:w,onMouseOut:b,type:"source"}),("target"===n||!0===n)&&h.jsx(dE,{position:d,centerX:c,centerY:s,radius:t,onMouseDown:function(e){return x(e,!1)},onMouseEnter:w,onMouseOut:b,type:"target"})]})}function hE(e){var n;return e&&!(!e.internals.handleBounds&&!(null===(n=e.handles)||void 0===n?void 0:n.length))&&!!(e.measured.width||e.width||e.initialWidth)}function vE(e){var n,t,r,o;if(!e)return null;var a=[],u=[];try{for(var c=i(e),s=c.next();!s.done;s=c.next()){var l=s.value;l.width=null!==(r=l.width)&&void 0!==r?r:1,l.height=null!==(o=l.height)&&void 0!==o?o:1,"source"===l.type?a.push(l):"target"===l.type&&u.push(l)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return{source:a,target:u}}function pE(e,n,t){var r,o;void 0===t&&(t=null);var i=(null!==(r=null==t?void 0:t.x)&&void 0!==r?r:0)+n.internals.positionAbsolute.x,a=(null!==(o=null==t?void 0:t.y)&&void 0!==o?o:0)+n.internals.positionAbsolute.y,u=null!=t?t:nb(n),c=u.width,s=u.height;switch(e){case exports.Position.Top:return[i+c/2,a];case exports.Position.Right:return[i+c,a+s/2];case exports.Position.Bottom:return[i+c/2,a+s];case exports.Position.Left:return[i,a+s/2]}}function gE(e,n){return e&&(n?e.find((function(e){return e.id===n})):e[0])||null}function yE(t){var r=t.id,o=t.edgesFocusable,i=t.edgesUpdatable,u=t.elementsSelectable,c=t.onClick,s=t.onDoubleClick,l=t.onContextMenu,d=t.onMouseEnter,f=t.onMouseMove,v=t.onMouseLeave,p=t.edgeUpdaterRadius,g=t.onEdgeUpdate,y=t.onEdgeUpdateStart,x=t.onEdgeUpdateEnd,w=t.rfId,b=t.edgeTypes,_=t.noPanClassName,E=t.onError,S=t.disableKeyboardA11y,k=Zw((function(e){return e.edgeLookup.get(r)})),C=Zw((function(e){return e.defaultEdgeOptions})),N=(k=C?n(n({},C),k):k).type||"default",O=(null==b?void 0:b[N])||aE[N];void 0===O&&(null==E||E("011",Vy.error011(N)),N="default",O=aE.default);var P=!!(k.focusable||o&&void 0===k.focusable),M=void 0!==g&&(k.updatable||i&&void 0===k.updatable),j=!!(k.selectable||u&&void 0===k.selectable),I=e.useRef(null),A=a(e.useState(!1),2),z=A[0],T=A[1],B=a(e.useState(!1),2),L=B[0],D=B[1],R=Uw(),V=Zw(e.useCallback((function(e){var t=e.nodeLookup.get(k.source),o=e.nodeLookup.get(k.target);if(!t||!o)return n({zIndex:k.zIndex},uE);var i=function(e){var n,t,r,o,i,u=e.sourceNode,c=e.targetNode;if(!hE(u)||!hE(c))return null;var s=u.internals.handleBounds||vE(u.handles),l=c.internals.handleBounds||vE(c.handles),d=gE(null!==(n=null==s?void 0:s.source)&&void 0!==n?n:[],e.sourceHandle),f=gE(e.connectionMode===exports.ConnectionMode.Strict?null!==(t=null==l?void 0:l.target)&&void 0!==t?t:[]:(null!==(r=null==l?void 0:l.target)&&void 0!==r?r:[]).concat(null!==(o=null==l?void 0:l.source)&&void 0!==o?o:[]),e.targetHandle),h=(null==d?void 0:d.position)||exports.Position.Bottom,v=(null==f?void 0:f.position)||exports.Position.Top;if(!d||!f)return null===(i=e.onError)||void 0===i||i.call(e,"008",Vy.error008(d?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;var p=a(pE(h,u,d),2),g=p[0],y=p[1],m=a(pE(v,c,f),2);return{sourceX:g,sourceY:y,targetX:m[0],targetY:m[1],sourcePosition:h,targetPosition:v}}({id:r,sourceNode:t,targetNode:o,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:e.connectionMode,onError:E}),u=function(e){var n=e.sourceNode,t=e.targetNode,r=e.selected,o=void 0!==r&&r,i=e.zIndex,a=void 0===i?0:i,u=e.elevateOnSelect;if(void 0===u||!u)return a;var c=o||t.selected||n.selected,s=Math.max(n.internals.z||0,t.internals.z||0,1e3);return a+(c?s:0)}({selected:k.selected,zIndex:k.zIndex,sourceNode:t,targetNode:o,elevateOnSelect:e.elevateEdgesOnSelect});return n({zIndex:u},i||uE)}),[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),Ob),H=V.zIndex,Y=V.sourceX,X=V.sourceY,F=V.targetX,Z=V.targetY,U=V.sourcePosition,G=V.targetPosition,W=e.useMemo((function(){return k.markerStart?"url('#".concat(L_(k.markerStart,w),"')"):void 0}),[k.markerStart,w]),q=e.useMemo((function(){return k.markerEnd?"url('#".concat(L_(k.markerEnd,w),"')"):void 0}),[k.markerEnd,w]);if(k.hidden||null===Y||null===X||null===F||null===Z)return null;var $=s?function(e){s(e,n({},k))}:void 0,K=l?function(e){l(e,n({},k))}:void 0,Q=d?function(e){d(e,n({},k))}:void 0,J=f?function(e){f(e,n({},k))}:void 0,ee=v?function(e){v(e,n({},k))}:void 0;return h.jsx("svg",{style:{zIndex:H},children:h.jsxs("g",{className:m(["ink-flow__edge","ink-flow__edge-".concat(N),k.className,_,{selected:k.selected,animated:k.animated,inactive:!j&&!c,updating:z,selectable:j}]),onClick:function(e){var n,t=R.getState(),o=t.addSelectedEdges,i=t.unselectNodesAndEdges,a=t.multiSelectionActive;j&&(R.setState({nodesSelectionActive:!1}),k.selected&&a?(i({nodes:[],edges:[k]}),null===(n=I.current)||void 0===n||n.blur()):o([r])),c&&c(e,k)},onDoubleClick:$,onContextMenu:K,onMouseEnter:Q,onMouseMove:J,onMouseLeave:ee,onKeyDown:P?function(e){var n;if(!S&&Yy.includes(e.key)&&j){var t=R.getState(),o=t.unselectNodesAndEdges,i=t.addSelectedEdges;"Escape"===e.key?(null===(n=I.current)||void 0===n||n.blur(),o({edges:[k]})):i([r])}}:void 0,tabIndex:P?0:void 0,role:P?"button":"img","data-id":r,"data-testid":"rf__edge-".concat(r),"aria-label":null===k.ariaLabel?void 0:k.ariaLabel||"Edge from ".concat(k.source," to ").concat(k.target),"aria-describedby":P?"".concat(v_,"-").concat(w):void 0,ref:I,children:[!L&&h.jsx(O,{id:r,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:Y,sourceY:X,targetX:F,targetY:Z,sourcePosition:U,targetPosition:G,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:W,markerEnd:q,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),M&&h.jsx(fE,{edge:k,isUpdatable:M,edgeUpdaterRadius:p,onEdgeUpdate:g,onEdgeUpdateStart:y,onEdgeUpdateEnd:x,sourceX:Y,sourceY:X,targetX:F,targetY:Z,sourcePosition:U,targetPosition:G,setUpdateHover:T,setUpdating:D,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle})]})})}var mE=function(e){return{width:e.width,height:e.height,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError}};function xE(n){var t=n.rfId,r=n.noPanClassName,o=n.onEdgeUpdate,i=Zw(mE,Ob),a=i.edgesFocusable,u=i.edgesUpdatable,c=i.elementsSelectable,s=i.onError,l=function(n){var t=Zw(e.useCallback((function(e){return e.edges.map((function(e){return e.id}))}),[n]),Ob);return t}(!1);return h.jsxs("div",{className:"ink-flow__edges",children:[h.jsx(V_,{defaultColor:"",rfId:t}),l.map((function(e){return h.jsx(yE,{id:e,edgesFocusable:a,edgesUpdatable:u,elementsSelectable:c,noPanClassName:r,onEdgeUpdate:o,rfId:t,onError:s},e)}))]})}xE.displayName="EdgeRenderer";var wE=e.memo(xE),bE=function(e){return"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],")")};function _E(e){var n=e.children,t=Zw(bE);return h.jsx("div",{className:"ink-flow__viewport xyflow__viewport ink-flow__container",style:{transform:t},children:n})}function EE(e){var n=e.rfId,t=e.minZoom,r=e.maxZoom,o=e.noPanClassName,i=e.noDragClassName,a=e.nodeOrigin,u=e.viewport,c=e.disableKeyboardA11y,s=e.translateExtent,l=e.defaultViewport,d=e.nodeTypes,f=e.elementsSelectable,v=e.onPaneClick,p=e.onPaneContextMenu;return h.jsx(n_,{minZoom:t,maxZoom:r,noPanClassName:o,noDragClassName:i,isControlledViewport:!!u,disableKeyboardA11y:c,translateExtent:s,defaultViewport:l,elementsSelectable:f,onPaneClick:v,onPaneContextMenu:p,children:h.jsxs(_E,{children:[h.jsx(wE,{rfId:n,noPanClassName:o}),h.jsx("div",{className:"ink-flow__edgelabel-renderer"}),h.jsx(T_,{rfId:n,nodeTypes:d,nodeOrigin:a,noDragClassName:i,noPanClassName:o,disableKeyboardA11y:!1}),h.jsx("div",{className:"ink-flow__viewport-portal"})]})})}EE.displayName="GraphView";var SE=e.memo(EE),kE=function(e){var n,t,r=void 0===e?{}:e,o=r.nodes,i=r.edges,a=r.defaultNodes,u=r.defaultEdges;r.width,r.height,r.fitView;var c=new Map,s=new Map,l=new Map,d=new Map,f=null!==(n=null!=u?u:i)&&void 0!==n?n:[],h=null!==(t=null!=a?a:o)&&void 0!==t?t:[];$w(l,d,f),Kw(h,c,s,{nodeOrigin:[0,0],elevateNodesOnSelect:!1});return{rfId:"1",width:0,height:0,transform:[0,0,1],nodes:h,nodeLookup:c,parentLookup:s,edges:f,edgeLookup:d,connectionLookup:l,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==a,hasDefaultEdges:void 0!==u,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:Hy,nodeExtent:Hy,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:exports.ConnectionMode.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,fitViewOnInit:!1,fitViewDone:!1,fitViewOnInitOptions:void 0,selectNodesOnDrag:!0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:void 0,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1}},CE=function(e){var t,r,o=e.nodes,c=e.edges,s=e.defaultNodes,l=e.defaultEdges,d=e.width,f=e.height,h=e.fitView;return t=function(e,t){return n(n({},kE({nodes:o,edges:c,width:d,height:f,fitView:h,defaultNodes:s,defaultEdges:l})),{setNodes:function(n){var r=t();Kw(n,r.nodeLookup,r.parentLookup,{nodeOrigin:r.nodeOrigin,elevateNodesOnSelect:r.elevateNodesOnSelect,checkEquality:!0}),e({nodes:n})},setEdges:function(n){var r=t();$w(r.connectionLookup,r.edgeLookup,n),e({edges:n})},setDefaultNodesAndEdges:function(n,r){n&&((0,t().setNodes)(n),e({hasDefaultNodes:!0})),r&&((0,t().setEdges)(r),e({hasDefaultEdges:!0}))},updateNodeInternals:function(r){var o=t(),i=o.triggerNodeChanges,c=o.fitView,s=o.nodeLookup,l=o.parentLookup,d=o.fitViewOnInit,f=o.fitViewDone,h=o.fitViewOnInitOptions,v=o.domNode,p=o.nodeOrigin,g=o.debug,y=function(e,t,r,o,i){var c=null==o?void 0:o.querySelector(".xyflow__viewport"),s=!1;if(!c)return{changes:[],updatedInternals:s};var l=[],d=window.getComputedStyle(c),f=new window.DOMMatrixReadOnly(d.transform).m22,h=[];if(e.forEach((function(e){var r=t.get(e.id);if(null==r?void 0:r.hidden)t.set(r.id,n(n({},r),{internals:n(n({},r.internals),{handleBounds:void 0})})),s=!0;else if(r){var o=mb(e.nodeElement),a=r.measured.width!==o.width||r.measured.height!==o.height;if(o.width&&o.height&&(a||!r.internals.handleBounds||e.force)){var u=n(n({},r),{measured:o,internals:n(n({},r.internals),{handleBounds:{source:Eb(".source",e.nodeElement,f,r.origin||i),target:Eb(".target",e.nodeElement,f,r.origin||i)}})});t.set(r.id,u),s=!0,a&&(l.push({id:u.id,type:"dimensions",dimensions:o}),u.expandParent&&u.parentId&&h.push({id:u.id,parentId:u.parentId,rect:ib(u,u.origin||i)}))}}})),h.length>0){var v=Qw(h,t,r,i);l.push.apply(l,u([],a(v),!1))}return{changes:l,updatedInternals:s}}(r,s,l,v,p),m=y.changes;if(y.updatedInternals){Gw(s,{nodeOrigin:p});var x=f;!f&&d&&(x=c(n(n({},h),{nodes:null==h?void 0:h.nodes}))),e({fitViewDone:x}),(null==m?void 0:m.length)>0&&(g&&console.log("Ink Flow: trigger node changes",m),null==i||i(m))}},updateNodePositions:function(e,r){var o,c;void 0===r&&(r=!1);var s=[],l=[];try{for(var d=i(e),f=d.next();!f.done;f=d.next()){var h=a(f.value,2),v=h[0],p=h[1],g={id:v,type:"position",position:p.position,dragging:r};(null==p?void 0:p.expandParent)&&(null==p?void 0:p.parentId)&&g.position&&(s.push({id:v,parentId:p.parentId,rect:n(n({},p.internals.positionAbsolute),{width:p.measured.width,height:p.measured.height})}),g.position.x=Math.max(0,g.position.x),g.position.y=Math.max(0,g.position.y)),l.push(g)}}catch(e){o={error:e}}finally{try{f&&!f.done&&(c=d.return)&&c.call(d)}finally{if(o)throw o.error}}if(s.length>0){var y=t(),m=Qw(s,y.nodeLookup,y.parentLookup);l.push.apply(l,u([],a(m),!1))}t().triggerNodeChanges(l)},triggerNodeChanges:function(e){var n=t(),r=n.onNodesChange,o=n.setNodes,i=n.nodes,a=n.hasDefaultNodes,u=n.debug;(null==e?void 0:e.length)&&(a&&o(Bb(e,i)),u&&console.log("Ink Flow: trigger node changes",e),null==r||r(e))},triggerEdgeChanges:function(e){var n=t(),r=n.onEdgesChange,o=n.setEdges,i=n.edges,a=n.hasDefaultEdges,u=n.debug;(null==e?void 0:e.length)&&(a&&o(Tb(e,i)),u&&console.log("Ink Flow: trigger edge changes",e),null==r||r(e))},addSelectedNodes:function(e){var n=t(),r=n.multiSelectionActive,o=n.edgeLookup,i=n.nodeLookup,c=n.triggerNodeChanges,s=n.triggerEdgeChanges;r?c(e.map((function(e){return Lb(e,!0)}))):(c(Db(i,new Set(u([],a(e),!1)),!0)),s(Db(o)))},addSelectedEdges:function(e){var n=t(),r=n.multiSelectionActive,o=n.edgeLookup,i=n.nodeLookup,c=n.triggerNodeChanges,s=n.triggerEdgeChanges;r?s(e.map((function(e){return Lb(e,!0)}))):(s(Db(o,new Set(u([],a(e),!1)))),c(Db(i,new Set,!0)))},unselectNodesAndEdges:function(e){var n=void 0===e?{}:e,r=n.nodes,o=n.edges,i=t(),a=i.edges,u=i.nodes,c=i.triggerNodeChanges,s=i.triggerEdgeChanges,l=o||a,d=(r||u).map((function(e){return e.selected=!1,Lb(e.id,!1)})),f=l.map((function(e){return Lb(e.id,!1)}));c(d),s(f)},setMinZoom:function(n){var r=t(),o=r.panZoom,i=r.maxZoom;null==o||o.setScaleExtent([n,i]),e({minZoom:n})},setMaxZoom:function(n){var r=t(),o=r.panZoom,i=r.minZoom;null==o||o.setScaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:function(n){var r;null===(r=t().panZoom)||void 0===r||r.setTranslateExtent(n),e({translateExtent:n})},resetSelectedElements:function(){var e=t(),n=e.edges,r=e.nodes,o=e.triggerNodeChanges,i=e.triggerEdgeChanges,c=r.reduce((function(e,n){return n.selected?u(u([],a(e),!1),[Lb(n.id,!1)],!1):e}),[]),s=n.reduce((function(e,n){return n.selected?u(u([],a(e),!1),[Lb(n.id,!1)],!1):e}),[]);o(c),i(s)},setNodeExtent:function(r){var o,u,c=t().nodeLookup;try{for(var s=i(c),l=s.next();!l.done;l=s.next()){var d=a(l.value,2)[1],f=eb(d.position,r);c.set(d.id,n(n({},d),{internals:n(n({},d.internals),{positionAbsolute:f})}))}}catch(e){o={error:e}}finally{try{l&&!l.done&&(u=s.return)&&u.call(s)}finally{if(o)throw o.error}}e({nodeExtent:r})},panBy:function(e){var n=t(),r=n.transform,o=n.width,i=n.height;return function(e){var n=e.delta,t=e.panZoom,r=e.transform,o=e.translateExtent,i=e.width,a=e.height;if(!t||!n.x&&!n.y)return!1;var u=t.setViewportConstrained({x:r[0]+n.x,y:r[1]+n.y,zoom:r[2]},[[0,0],[i,a]],o);return!!u&&(u.x!==r[0]||u.y!==r[1]||u.k!==r[2])}({delta:e,panZoom:n.panZoom,transform:r,translateExtent:n.translateExtent,width:o,height:i})},fitView:function(e){var n=t(),r=n.panZoom,o=n.width,i=n.height,a=n.minZoom,u=n.maxZoom,c=n.nodeOrigin,s=n.nodeLookup;return!!r&&Zb({nodeLookup:s,width:o,height:i,panZoom:r,minZoom:a,maxZoom:u,nodeOrigin:c},e)},cancelConnection:function(){return e({connectionStatus:null,connectionStartHandle:null,connectionEndHandle:null})},updateConnection:function(r){var o,i=t().connectionPosition,a=n(n({},r),{connectionPosition:null!==(o=r.connectionPosition)&&void 0!==o?o:i});e(a)},reset:function(){return e(n({},kE()))}})},r=Object.is,t?M(t,r):M};function NE(n){var t=n.initialNodes,r=n.initialEdges,o=n.defaultNodes,i=n.defaultEdges,u=n.initialWidth,c=n.initialHeight,s=n.fitView,l=n.children,d=a(e.useState((function(){return CE({nodes:t,edges:r,defaultNodes:o,defaultEdges:i,width:u,height:c,fitView:s})})),1)[0];return h.jsx(An,{value:d,children:h.jsx(i_,{children:l})})}function OE(n){var t=n.children,r=n.nodes,o=n.edges,i=n.defaultNodes,a=n.defaultEdges,u=n.width,c=n.height,s=n.fitView;return e.useContext(In)?h.jsx(h.Fragment,{children:t}):h.jsx(NE,{initialNodes:r,initialEdges:o,defaultNodes:i,defaultEdges:a,initialWidth:u,initialHeight:c,fitView:s,children:t})}var PE={x:0,y:0,zoom:1},ME=u(u([],a(["nodes","edges","defaultNodes","defaultEdges","nodesDraggable","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","translateExtent","defaultEdgeOptions","fitView","fitViewOptions"]),!1),["rfId"],!1),jE=function(e){return{setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}},IE={translateExtent:Hy,nodeOrigin:[0,0],minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function AE(n){var t=Zw(jE,Ob),r=t.setNodes,o=t.setEdges,a=t.setMinZoom,u=t.setMaxZoom,c=t.setTranslateExtent,s=t.setNodeExtent,l=t.reset,d=t.setDefaultNodesAndEdges,f=Uw();e.useEffect((function(){return d(n.defaultNodes,n.defaultEdges),function(){h.current=IE,l()}}),[]);var h=e.useRef(IE);return e.useEffect((function(){var e,t,l;try{for(var d=i(ME),v=d.next();!v.done;v=d.next()){var p=v.value,g=n[p];g!==h.current[p]&&(void 0!==n[p]&&("nodes"===p?r(g):"edges"===p?o(g):"minZoom"===p?a(g):"maxZoom"===p?u(g):"translateExtent"===p?c(g):"nodeExtent"===p?s(g):"fitView"===p?f.setState({fitViewOnInit:g}):"fitViewOptions"===p?f.setState({fitViewOnInitOptions:g}):f.setState(((l={})[p]=g,l))))}}catch(n){e={error:n}}finally{try{v&&!v.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}h.current=n}),ME.map((function(e){return n[e]}))),null}var zE={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var TE=lb((function(e,r){var o=e.nodes,i=e.edges,a=e.translateExtent,u=void 0===a?Hy:a,c=e.defaultViewport,s=void 0===c?PE:c,l=e.minZoom,d=void 0===l?.5:l,f=e.maxZoom,v=void 0===f?2:f,p=e.nodeOrigin,g=e.noDragClassName,y=e.noPanClassName,x=e.disableKeyboardA11y,w=e.nodeTypes,b=e.onNodesChange,_=e.onEdgesChange,E=e.fitView,S=e.fitViewOptions,k=e.nodeExtent,C=e.nodesDraggable,N=e.children,O=e.id,P=e.width,M=e.height,j=e.onPaneClick,I=e.onPaneContextMenu,A=e.elementsSelectable,z=void 0===A||A,T=t(e,["nodes","edges","translateExtent","defaultViewport","minZoom","maxZoom","nodeOrigin","noDragClassName","noPanClassName","disableKeyboardA11y","nodeTypes","onNodesChange","onEdgesChange","fitView","fitViewOptions","nodeExtent","nodesDraggable","children","id","width","height","onPaneClick","onPaneContextMenu","elementsSelectable"]),B=O||"1";return h.jsx("div",n({},T,{ref:r,style:n({},zE),className:m(["ink-flow"]),"data-testid":"rf__wrapper",id:O,children:h.jsxs(OE,{nodes:o,edges:i,width:P,height:M,fitView:E,children:[h.jsx(SE,{rfId:B,nodeTypes:w,minZoom:d,maxZoom:v,nodeOrigin:p,noDragClassName:g,noPanClassName:y,disableKeyboardA11y:x,translateExtent:u,defaultViewport:s,onPaneClick:j,onPaneContextMenu:I}),h.jsx(AE,{nodes:o,edges:i,rfId:B,onNodesChange:b,onEdgesChange:_,fitView:E,fitViewOptions:S,nodeExtent:k,nodesDraggable:C,elementsSelectable:z}),N]})}))}));function BE(){return h.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 4.375C10.3452 4.375 10.625 4.65482 10.625 5V9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H10.625V15C10.625 15.3452 10.3452 15.625 10 15.625C9.65482 15.625 9.375 15.3452 9.375 15V10.625H5C4.65482 10.625 4.375 10.3452 4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H9.375V5C9.375 4.65482 9.65482 4.375 10 4.375Z",fill:"#6B7280"})})}function LE(){return h.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H5C4.65482 10.625 4.375 10.3452 4.375 10Z",fill:"#6B7280"})})}function DE(){return h.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 1.875C10.3452 1.875 10.625 2.15482 10.625 2.5V3.57152C13.6929 3.86613 16.1339 6.30708 16.4285 9.375H17.5C17.8452 9.375 18.125 9.65482 18.125 10C18.125 10.3452 17.8452 10.625 17.5 10.625H16.4285C16.1339 13.6929 13.6929 16.1339 10.625 16.4285V17.5C10.625 17.8452 10.3452 18.125 10 18.125C9.65482 18.125 9.375 17.8452 9.375 17.5V16.4285C6.30708 16.1339 3.86613 13.6929 3.57152 10.625H2.5C2.15482 10.625 1.875 10.3452 1.875 10C1.875 9.65482 2.15482 9.375 2.5 9.375H3.57152C3.86613 6.30708 6.30708 3.86613 9.375 3.57152V2.5C9.375 2.15482 9.65482 1.875 10 1.875ZM4.82878 10.625H5.83333C6.17851 10.625 6.45833 10.3452 6.45833 10C6.45833 9.65482 6.17851 9.375 5.83333 9.375H4.82878C5.11304 6.99811 6.99811 5.11304 9.375 4.82878V5.83333C9.375 6.17851 9.65482 6.45833 10 6.45833C10.3452 6.45833 10.625 6.17851 10.625 5.83333V4.82878C13.0019 5.11304 14.887 6.99811 15.1712 9.375H14.1667C13.8215 9.375 13.5417 9.65482 13.5417 10C13.5417 10.3452 13.8215 10.625 14.1667 10.625H15.1712C14.887 13.0019 13.0019 14.887 10.625 15.1712V14.1667C10.625 13.8215 10.3452 13.5417 10 13.5417C9.65482 13.5417 9.375 13.8215 9.375 14.1667V15.1712C6.99811 14.887 5.11304 13.0019 4.82878 10.625Z",fill:"#6B7280"})})}function RE(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:h.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 VE(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:h.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 HE(e){var r=e.children,o=e.className,i=t(e,["children","className"]);return h.jsx("button",n({type:"button",className:m(["ink-flow__controls-button",o])},i,{children:r}))}var YE=function(e){return e.userSelectionActive?"none":"all"};function XE(e){var r=e.position,o=void 0===r?"top-left":r,i=e.children,c=e.className,s=e.style,l=t(e,["position","children","className","style"]),d=Zw(YE),f="".concat(o).split("-");return h.jsx("div",n({className:m(u(["ink-flow__panel",c],a(f),!1)),style:n(n({},s),{pointerEvents:d})},l,{children:i}))}var FE=function(e){return{isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}};function ZE(e){var n=e.style,t=e.showZoom,r=void 0===t||t,o=e.showFitView,i=void 0===o||o,a=e.showInteractive,u=void 0===a||a,c=e.fitViewOptions,s=e.onZoomIn,l=e.onZoomOut,d=e.onFitView,f=e.onInteractiveChange,v=e.className,p=e.children,g=e.position,y=void 0===g?"bottom-left":g,x=e.orientation,w=void 0===x?"vertical":x,b=e["aria-label"],_=void 0===b?"Ink Flow controls":b,E=Uw(),S=Zw(FE,Ob),k=S.isInteractive,C=S.minZoomReached,N=S.maxZoomReached,O=c_(),P=O.zoomIn,M=O.zoomOut,j=O.fitView,I="horizontal"===w?"horizontal":"vertical";return h.jsxs(XE,{className:m(["ink-flow__controls",I,v]),position:y,style:n,"data-testid":"rf__controls","aria-label":_,children:[i&&h.jsx(HE,{className:"ink-flow__controls-fitview",onClick:function(){j(c),null==d||d()},title:"fit view","aria-label":"fit view",children:h.jsx(DE,{})}),r&&h.jsxs("div",{className:"ink-flow__controls-zoom",children:[h.jsx(HE,{onClick:function(){P(),null==s||s()},className:"ink-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:N,children:h.jsx(BE,{})}),h.jsx(HE,{onClick:function(){M(),null==l||l()},className:"ink-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:C,children:h.jsx(LE,{})})]}),u&&h.jsx(HE,{className:"ink-flow__controls-interactive",onClick:function(){E.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),null==f||f(!k)},title:"toggle interactivity","aria-label":"toggle interactivity",children:k?h.jsx(VE,{}):h.jsx(RE,{})}),p]})}ZE.displayName="Controls";var UE=e.memo(ZE);exports.ControlButton=HE,exports.Controls=UE,exports.Handle=C_,exports.InkFlowProvider=NE,exports.addEdge=function(e,n){return e.source&&e.target?function(e,n){return n.some((function(n){return!(n.source!==e.source||n.target!==e.target||n.sourceHandle!==e.sourceHandle&&(n.sourceHandle||e.sourceHandle)||n.targetHandle!==e.targetHandle&&(n.targetHandle||e.targetHandle))}))}(t=function(e){return"id"in e&&"source"in e&&"target"in e}(e)?ep({},e):ep(ep({},e),{id:fm(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t},exports.dagreLayout=function(e,n,t){void 0===t&&(t={rankdir:"TB"});var r=t.rankdir,o=new nv.graphlib.Graph;return o.setDefaultEdgeLabel((function(){return{}})),o.setGraph({rankdir:r}),e.forEach((function(e){var n,t;if(!e.id)throw new Error('Node "id" does not exist');var r=(null===(n=e.data)||void 0===n?void 0:n.width)||200,i=(null===(t=e.data)||void 0===t?void 0:t.height)||56;o.setNode(e.id,{width:r,height:i})})),n.forEach((function(e){o.setEdge(e.source,e.target)})),nv.layout(o),e.forEach((function(e){var n=o.node(e.id),t="bottom",i="top";switch(r){case"TB":t="bottom",i="top";break;case"BT":t="top",i="bottom";break;case"LR":case"RL":t="right",i="left"}e.targetPosition=i,e.sourcePosition=t,e.position={x:n.x-n.width/2,y:n.y-n.height/2}})),{nodes:e,edges:n}},exports.default=TE,exports.getBezierEdgeCenter=um,exports.getBezierPath=function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?exports.Position.Top:u,s=e.curvature,l=void 0===s?.25:s,d=tp(sm({pos:o,x1:n,y1:t,x2:i,y2:a,c:l}),2),f=d[0],h=d[1],v=tp(sm({pos:c,x1:i,y1:a,x2:n,y2:t,c:l}),2),p=v[0],g=v[1],y=tp(um({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),m=y[0],x=y[1],w=y[2],b=y[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),m,x,w,b]},exports.getConnectedEdges=function(e,n){var t=new Set;return e.forEach((function(e){t.add(e.id)})),n.filter((function(e){return t.has(e.source)||t.has(e.target)}))},exports.getEdgeCenter=lm,exports.getIncomers=function(e,n,t){if(!e.id)return[];var r=new Set;return t.forEach((function(n){n.target===e.id&&r.add(n.source)})),n.filter((function(e){return r.has(e.id)}))},exports.getNodesBounds=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.length)return{x:0,y:0,width:0,height:0};var t=e.reduce((function(e,t){var r=Jy(t,n.nodeOrigin);return $y(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Qy(t)},exports.getOutgoers=function(e,n,t){if(!e.id)return[];var r=new Set;return t.forEach((function(n){n.source===e.id&&r.add(n.target)})),n.filter((function(e){return r.has(e.id)}))},exports.getSmoothStepPath=function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?exports.Position.Top:u,s=e.borderRadius,l=void 0===s?5:s,d=e.centerX,f=e.centerY,h=e.offset,v=tp(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?exports.Position.Bottom:a,c=e.target,s=e.targetPosition,l=void 0===s?exports.Position.Top:s,d=e.center,f=e.offset,h=hm[u],v=hm[l],p={x:i.x+h.x*f,y:i.y+h.y*f},g={x:c.x+v.x*f,y:c.y+v.y*f},y=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?exports.Position.Bottom:t,o=e.target;return r===exports.Position.Left||r===exports.Position.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}}({source:p,sourcePosition:u,target:g}),m=0!==y.x?"x":"y",x=y[m],w=[],b={x:0,y:0},_={x:0,y:0},E=tp(lm({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),S=E[0],k=E[1],C=E[2],N=E[3];if(h[m]*v[m]==-1){r=null!==(n=d.x)&&void 0!==n?n:S,o=null!==(t=d.y)&&void 0!==t?t:k;var O=[{x:r,y:p.y},{x:r,y:g.y}],P=[{x:p.x,y:o},{x:g.x,y:o}];w=h[m]===x?"x"===m?O:P:"x"===m?P:O}else{var M=[{x:p.x,y:g.y}],j=[{x:g.x,y:p.y}];if(w="x"===m?h.x===x?j:M:h.y===x?M:j,u===l){var I=Math.abs(i[m]-c[m]);if(I<=f){var A=Math.min(f-1,f-I);h[m]===x?b[m]=(p[m]>i[m]?-1:1)*A:_[m]=(g[m]>c[m]?-1:1)*A}}if(u!==l){var z="x"===m?"y":"x",T=h[m]===v[z],B=p[z]>g[z],L=p[z]<g[z];(1===h[m]&&(!T&&B||T&&L)||1!==h[m]&&(!T&&L||T&&B))&&(w="x"===m?M:j)}var D={x:p.x+b.x,y:p.y+b.y},R={x:g.x+_.x,y:g.y+_.y};Math.max(Math.abs(D.x-w[0].x),Math.abs(R.x-w[0].x))>=Math.max(Math.abs(D.y-w[0].y),Math.abs(R.y-w[0].y))?(r=(D.x+R.x)/2,o=w[0].y):(r=w[0].x,o=(D.y+R.y)/2)}return[rp(rp([i,{x:p.x+b.x,y:p.y+b.y}],tp(w),!1),[{x:g.x+_.x,y:g.y+_.y},c],!1),r,o,C,N]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:a},targetPosition:c,center:{x:d,y:f},offset:void 0===h?20:h}),5),p=v[0],g=v[1],y=v[2],m=v[3],x=v[4],w=p.reduce((function(e,n,t){var r;return r=t>0&&t<p.length-1?function(e,n,t,r){var o=Math.min(vm(e,n)/2,vm(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var s=e.x<t.x?1:-1,l=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*l,"Q ").concat(i,",").concat(a," ").concat(i+o*s,",").concat(a)}(p[t-1],n,p[t+1],l):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+r}),"");return[w,g,y,m,x]},exports.getStraightPath=function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=tp(lm({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],s=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,s]},exports.getViewportForBounds=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),s=Uy(c,r,o);return{x:n/2-(e.x+e.width/2)*s,y:t/2-(e.y+e.height/2)*s,zoom:s}},exports.updateEdge=function(e,n,t,r){void 0===r&&(r={shouldReplaceId:!0});var o=e.id,i=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(e,["id"]);if(!n.source||!n.target)return t;if(!t.find((function(n){return n.id===e.id})))return t;var a=ep(ep({},i),{id:r.shouldReplaceId?fm(n):o,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle});return t.filter((function(e){return e.id!==o})).concat(a)},exports.useEdgesState=function(n){var t=a(e.useState(n),2),r=t[0],o=t[1],i=e.useCallback((function(e){return o((function(n){return Tb(e,n)}))}),[]);return[r,o,i]},exports.useInkFlow=c_,exports.useNodesState=function(n){var t=a(e.useState(n),2),r=t[0],o=t[1],i=e.useCallback((function(e){return o((function(n){return Bb(e,n)}))}),[]);return[r,o,i]},exports.useStore=Zw,exports.useStoreApi=Uw;
|
|
17
|
+
//# sourceMappingURL=index.cjs.js.map
|