@aloudata/ink-flow 1.0.8 → 1.0.10
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/ConnectionLine/index.d.ts +12 -0
- package/dist/components/ConnectionLine/index.d.ts.map +1 -0
- package/dist/container/EdgeRenderer/index.d.ts +2 -2
- package/dist/container/EdgeRenderer/index.d.ts.map +1 -1
- package/dist/container/GraphView/index.d.ts +2 -2
- package/dist/container/GraphView/index.d.ts.map +1 -1
- package/dist/container/InkFlow/index.d.ts.map +1 -1
- package/dist/container/NodeRenderer/index.d.ts +1 -1
- package/dist/container/NodeRenderer/index.d.ts.map +1 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/types/edges.d.ts +17 -3
- package/dist/types/edges.d.ts.map +1 -1
- package/dist/types/props.d.ts +45 -3
- package/dist/types/props.d.ts.map +1 -1
- package/dist/utils/general.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e,{createContext as n,useContext as t,useMemo as r,forwardRef as o,useState as i,useRef as a,useEffect as u,memo as c,useCallback as l,useLayoutEffect as s}from"react";var d=function(){return d=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},d.apply(this,arguments)};function f(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 h(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 v(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 p(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 g(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 y(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 m(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var b,w={exports:{}},x={};w.exports=function(){if(b)return x;b=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={},l=null,s=null;for(u in void 0!==r&&(l=""+r),void 0!==n.key&&(l=""+n.key),void 0!==n.ref&&(s=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:l,ref:s,props:c,_owner:i.current}}return x.Fragment=r,x.jsx=u,x.jsxs=u,x}();var _,E=w.exports,S={exports:{}};
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
|
4
4
|
Licensed under the MIT License (MIT), see
|
|
5
5
|
http://jedwatson.github.io/classnames
|
|
6
6
|
*/
|
|
7
|
-
_=S,function(){var
|
|
7
|
+
_=S,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(" ")}_.exports?(n.default=n,_.exports=n):window.classNames=n}();var k,N,C,M=m(S.exports),O={exports:{}},j={},P={exports:{}},I={};function A(){return N||(N=1,P.exports=function(){if(k)return I;k=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}}),l=c[0].inst,s=c[1];return i((function(){l.value=t,l.getSnapshot=n,u(l)&&s({inst:l})}),[e,t,n]),o((function(){return u(l)&&s({inst:l}),e((function(){u(l)&&s({inst:l})}))}),[e]),a(t),t};return I.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c,I}()),P.exports}
|
|
8
8
|
/**
|
|
9
9
|
* @license React
|
|
10
10
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
@@ -13,5 +13,5 @@ _=S,function(){var n={}.hasOwnProperty;function e(){for(var t=[],r=0;r<arguments
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the MIT license found in the
|
|
15
15
|
* LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/M.exports=function(){if(C)return j;C=1;var e=n,t=A(),r="function"==typeof Object.is?Object.is:function(n,e){return n===e&&(0!==n||1/n==1/e)||n!=n&&e!=e},o=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,u=e.useMemo,c=e.useDebugValue;return j.useSyncExternalStoreWithSelector=function(n,e,t,l,s){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 n(n){if(!a){if(a=!0,o=n,n=l(n),void 0!==s&&f.hasValue){var e=f.value;if(s(e,n))return i=e}return i=n}if(e=i,r(o,n))return e;var t=l(n);return void 0!==s&&s(e,t)?e:(o=n,i=t)}var o,i,a=!1,u=void 0===t?null:t;return[function(){return n(e())},null===u?void 0:function(){return n(u())}]}),[e,t,l,s]);var h=o(n,d[0],d[1]);return a((function(){f.hasValue=!0,f.value=h}),[h]),c(h),h},j}();var z=m(M.exports);const T=n=>{let e;const t=new Set,r=(n,r)=>{const o="function"==typeof n?n(e):n;if(!Object.is(o,e)){const n=e;e=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},e,o),t.forEach((t=>t(e,n)))}},o=()=>e,i={setState:r,getState:o,getInitialState:()=>a,subscribe:n=>(t.add(n),()=>t.delete(n)),destroy:()=>{"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&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=e=n(r,o,i);return i},{useDebugValue:B}=n,{useSyncExternalStoreWithSelector:L}=z,D=n=>n;function R(n,e=D,t){const r=L(n.subscribe,n.getState,n.getServerState||n.getInitialState,e,t);return B(r),r}const V=(n,e)=>{const t=(n=>n?T(n):T)(n),r=(n,r=e)=>R(t,n,r);return Object.assign(r,t),r};var H,Y,X,F,Z,U,G,W,q,$,K,Q,J,nn,en,tn,rn,on,an,un,cn,ln,sn,dn,fn,hn,vn,pn,gn,yn,mn,wn,bn,xn,_n,En,Sn,kn,Nn,Cn,On,Mn,jn,Pn,In,An,zn,Tn,Bn,Ln,Dn,Rn,Vn,Hn,Yn,Xn,Fn,Zn,Un,Gn,Wn,qn,$n,Kn,Qn,Jn,ne,ee,te,re,oe,ie,ae,ue,ce,le,se,de,fe,he,ve,pe,ge,ye,me,we,be,xe,_e,Ee,Se,ke,Ne,Ce,Oe,Me,je,Pe,Ie,Ae,ze,Te,Be,Le,De,Re,Ve,He,Ye=e(null),Xe=Ye.Provider,Fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ze(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Ue(){return F?X:(F=1,X=function(n,e){return n===e||n!=n&&e!=e})}function Ge(){if(U)return Z;U=1;var n=Ue();return Z=function(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1},Z}function We(){if(tn)return en;tn=1;var n=Y?H:(Y=1,H=function(){this.__data__=[],this.size=0}),e=function(){if(W)return G;W=1;var n=Ge(),e=Array.prototype.splice;return G=function(t){var r=this.__data__,o=n(r,t);return!(o<0||(o==r.length-1?r.pop():e.call(r,o,1),--this.size,0))}}(),t=function(){if($)return q;$=1;var n=Ge();return q=function(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}}(),r=function(){if(Q)return K;Q=1;var n=Ge();return K=function(e){return n(this.__data__,e)>-1}}(),o=function(){if(nn)return J;nn=1;var n=Ge();return J=function(e,t){var r=this.__data__,o=n(r,e);return o<0?(++this.size,r.push([e,t])):r[o][1]=t,this}}();function i(n){var e=-1,t=null==n?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}return i.prototype.clear=n,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,en=i}function qe(){if(hn)return fn;hn=1;var n="object"==typeof Fe&&Fe&&Fe.Object===Object&&Fe;return fn=n}function $e(){if(pn)return vn;pn=1;var n=qe(),e="object"==typeof self&&self&&self.Object===Object&&self,t=n||e||Function("return this")();return vn=t}function Ke(){if(yn)return gn;yn=1;var n=$e().Symbol;return gn=n}function Qe(){if(En)return _n;En=1;var n=Ke(),e=function(){if(wn)return mn;wn=1;var n=Ke(),e=Object.prototype,t=e.hasOwnProperty,r=e.toString,o=n?n.toStringTag:void 0;return mn=function(n){var e=t.call(n,o),i=n[o];try{n[o]=void 0;var a=!0}catch(n){}var u=r.call(n);return a&&(e?n[o]=i:delete n[o]),u}}(),t=function(){if(xn)return bn;xn=1;var n=Object.prototype.toString;return bn=function(e){return n.call(e)}}(),r=n?n.toStringTag:void 0;return _n=function(n){return null==n?void 0===n?"[object Undefined]":"[object Null]":r&&r in Object(n)?e(n):t(n)}}function Je(){return kn?Sn:(kn=1,Sn=function(n){var e=typeof n;return null!=n&&("object"==e||"function"==e)})}function nt(){if(Cn)return Nn;Cn=1;var n=Qe(),e=Je();return Nn=function(t){if(!e(t))return!1;var r=n(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function et(){if(An)return In;An=1;var n=Function.prototype.toString;return In=function(e){if(null!=e){try{return n.call(e)}catch(n){}try{return e+""}catch(n){}}return""}}function tt(){if(Rn)return Dn;Rn=1;var n=function(){if(Tn)return zn;Tn=1;var n=nt(),e=function(){if(Pn)return jn;Pn=1;var n,e=function(){if(Mn)return On;Mn=1;var n=$e()["__core-js_shared__"];return On=n}(),t=(n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";return jn=function(n){return!!t&&t in n}}(),t=Je(),r=et(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,u=i.toString,c=a.hasOwnProperty,l=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return zn=function(i){return!(!t(i)||e(i))&&(n(i)?l:o).test(r(i))}}(),e=Ln?Bn:(Ln=1,Bn=function(n,e){return null==n?void 0:n[e]});return Dn=function(t,r){var o=e(t,r);return n(o)?o:void 0}}function rt(){if(Hn)return Vn;Hn=1;var n=tt()($e(),"Map");return Vn=n}function ot(){if(Xn)return Yn;Xn=1;var n=tt()(Object,"create");return Yn=n}function it(){if(ue)return ae;ue=1;var n=ie?oe:(ie=1,oe=function(n){var e=typeof n;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==n:null===n});return ae=function(e,t){var r=e.__data__;return n(t)?r["string"==typeof t?"string":"hash"]:r.map},ae}function at(){if(ye)return ge;ye=1;var n=function(){if(re)return te;re=1;var n=function(){if(ee)return ne;ee=1;var n=function(){if(Zn)return Fn;Zn=1;var n=ot();return Fn=function(){this.__data__=n?n(null):{},this.size=0}}(),e=Gn?Un:(Gn=1,Un=function(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}),t=function(){if(qn)return Wn;qn=1;var n=ot(),e=Object.prototype.hasOwnProperty;return Wn=function(t){var r=this.__data__;if(n){var o=r[t];return"__lodash_hash_undefined__"===o?void 0:o}return e.call(r,t)?r[t]:void 0}}(),r=function(){if(Kn)return $n;Kn=1;var n=ot(),e=Object.prototype.hasOwnProperty;return $n=function(t){var r=this.__data__;return n?void 0!==r[t]:e.call(r,t)}}(),o=function(){if(Jn)return Qn;Jn=1;var n=ot();return Qn=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=n&&void 0===t?"__lodash_hash_undefined__":t,this}}();function i(n){var e=-1,t=null==n?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}return i.prototype.clear=n,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,ne=i}(),e=We(),t=rt();return te=function(){this.size=0,this.__data__={hash:new n,map:new(t||e),string:new n}}}(),e=function(){if(le)return ce;le=1;var n=it();return ce=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}}(),t=function(){if(de)return se;de=1;var n=it();return se=function(e){return n(this,e).get(e)}}(),r=function(){if(he)return fe;he=1;var n=it();return fe=function(e){return n(this,e).has(e)}}(),o=function(){if(pe)return ve;pe=1;var n=it();return ve=function(e,t){var r=n(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,this},ve}();function i(n){var e=-1,t=null==n?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}return i.prototype.clear=n,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,ge=i}function ut(){if(xe)return be;xe=1;var n=We(),e=function(){if(on)return rn;on=1;var n=We();return rn=function(){this.__data__=new n,this.size=0}}(),t=un?an:(un=1,an=function(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}),r=ln?cn:(ln=1,cn=function(n){return this.__data__.get(n)}),o=dn?sn:(dn=1,sn=function(n){return this.__data__.has(n)}),i=function(){if(we)return me;we=1;var n=We(),e=rt(),t=at();return me=function(r,o){var i=this.__data__;if(i instanceof n){var a=i.__data__;if(!e||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(e){var t=this.__data__=new n(e);this.size=t.size}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=o,a.prototype.set=i,be=a}function ct(){return Ee||(Ee=1,_e=function(n,e){for(var t=-1,r=null==n?0:n.length;++t<r&&!1!==e(n[t],t,n););return n}),_e}function lt(){if(ke)return Se;ke=1;var n=tt(),e=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(n){}}();return Se=e}function st(){if(Ce)return Ne;Ce=1;var n=lt();return Ne=function(e,t,r){"__proto__"==t&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}}function dt(){if(Me)return Oe;Me=1;var n=st(),e=Ue(),t=Object.prototype.hasOwnProperty;return Oe=function(r,o,i){var a=r[o];t.call(r,o)&&e(a,i)&&(void 0!==i||o in r)||n(r,o,i)}}function ft(){if(Pe)return je;Pe=1;var n=dt(),e=st();return je=function(t,r,o,i){var a=!o;o||(o={});for(var u=-1,c=r.length;++u<c;){var l=r[u],s=i?i(o[l],t[l],l,o,t):void 0;void 0===s&&(s=t[l]),a?e(o,l,s):n(o,l,s)}return o}}function ht(){return Te?ze:(Te=1,ze=function(n){return null!=n&&"object"==typeof n})}function vt(){if(Re)return De;Re=1;var n=function(){if(Le)return Be;Le=1;var n=Qe(),e=ht();return Be=function(t){return e(t)&&"[object Arguments]"==n(t)}}(),e=ht(),t=Object.prototype,r=t.hasOwnProperty,o=t.propertyIsEnumerable,i=n(function(){return arguments}())?n:function(n){return e(n)&&r.call(n,"callee")&&!o.call(n,"callee")};return De=i}function pt(){if(He)return Ve;He=1;var n=Array.isArray;return Ve=n}var gt,yt,mt,wt,bt,xt,_t,Et,St,kt,Nt,Ct={exports:{}};function Ot(){return mt||(mt=1,function(n,e){var t=$e(),r=yt?gt:(yt=1,gt=function(){return!1}),o=e&&!e.nodeType&&e,i=o&&n&&!n.nodeType&&n,a=i&&i.exports===o?t.Buffer:void 0,u=(a?a.isBuffer:void 0)||r;n.exports=u}(Ct,Ct.exports)),Ct.exports}function Mt(){if(bt)return wt;bt=1;var n=/^(?:0|[1-9]\d*)$/;return wt=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&n.test(e))&&e>-1&&e%1==0&&e<t}}function jt(){return _t?xt:(_t=1,xt=function(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=9007199254740991})}function Pt(){return Nt?kt:(Nt=1,kt=function(n){return function(e){return n(e)}})}Ct.exports;var It,At,zt,Tt,Bt,Lt,Dt,Rt,Vt,Ht,Yt,Xt,Ft,Zt,Ut,Gt,Wt,qt,$t,Kt,Qt,Jt,nr,er,tr,rr,or,ir={exports:{}};function ar(){return It||(It=1,n=ir,e=ir.exports,t=qe(),r=e&&!e.nodeType&&e,o=r&&n&&!n.nodeType&&n,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(n){}}(),n.exports=a),ir.exports;var n,e,t,r,o,i,a}function ur(){if(zt)return At;zt=1;var n=function(){if(St)return Et;St=1;var n=Qe(),e=jt(),t=ht(),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,Et=function(o){return t(o)&&e(o.length)&&!!r[n(o)]}}(),e=Pt(),t=ar(),r=t&&t.isTypedArray,o=r?e(r):n;return At=o}function cr(){if(Bt)return Tt;Bt=1;var n=Ae?Ie:(Ae=1,Ie=function(n,e){for(var t=-1,r=Array(n);++t<n;)r[t]=e(t);return r}),e=vt(),t=pt(),r=Ot(),o=Mt(),i=ur(),a=Object.prototype.hasOwnProperty;return Tt=function(u,c){var l=t(u),s=!l&&e(u),d=!l&&!s&&r(u),f=!l&&!s&&!d&&i(u),h=l||s||d||f,v=h?n(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},Tt}function lr(){if(Dt)return Lt;Dt=1;var n=Object.prototype;return Lt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}}function sr(){return Vt||(Vt=1,Rt=function(n,e){return function(t){return n(e(t))}}),Rt}function dr(){if(Ft)return Xt;Ft=1;var n=lr(),e=function(){if(Yt)return Ht;Yt=1;var n=sr()(Object.keys,Object);return Ht=n}(),t=Object.prototype.hasOwnProperty;return Xt=function(r){if(!n(r))return e(r);var o=[];for(var i in Object(r))t.call(r,i)&&"constructor"!=i&&o.push(i);return o}}function fr(){if(Ut)return Zt;Ut=1;var n=nt(),e=jt();return Zt=function(t){return null!=t&&e(t.length)&&!n(t)}}function hr(){if(Wt)return Gt;Wt=1;var n=cr(),e=dr(),t=fr();return Gt=function(r){return t(r)?n(r):e(r)}}function vr(){if(tr)return er;tr=1;var n=cr(),e=function(){if(nr)return Jt;nr=1;var n=Je(),e=lr(),t=Qt?Kt:(Qt=1,Kt=function(n){var e=[];if(null!=n)for(var t in Object(n))e.push(t);return e}),r=Object.prototype.hasOwnProperty;return Jt=function(o){if(!n(o))return t(o);var i=e(o),a=[];for(var u in o)("constructor"!=u||!i&&r.call(o,u))&&a.push(u);return a}}(),t=fr();return er=function(r){return t(r)?n(r,!0):e(r)}}ir.exports;var pr,gr,yr,mr,wr,br,xr,_r,Er,Sr,kr,Nr,Cr,Or,Mr,jr,Pr,Ir,Ar,zr,Tr,Br,Lr,Dr,Rr,Vr,Hr,Yr,Xr,Fr,Zr,Ur,Gr,Wr,qr,$r,Kr,Qr,Jr,no,eo,to,ro,oo,io,ao,uo,co,lo,so,fo,ho,vo,po,go,yo,mo,wo,bo,xo,_o,Eo,So,ko,No,Co,Oo,Mo,jo,Po,Io,Ao,zo,To,Bo,Lo,Do,Ro,Vo,Ho,Yo,Xo,Fo,Zo,Uo,Go,Wo,qo,$o,Ko,Qo,Jo,ni,ei,ti,ri,oi,ii,ai,ui,ci,li,si,di,fi,hi,vi,pi,gi,yi,mi,wi,bi,xi,_i,Ei,Si,ki,Ni,Ci,Oi,Mi,ji,Pi,Ii,Ai,zi,Ti,Bi,Li,Di,Ri,Vi,Hi,Yi,Xi,Fi,Zi,Ui,Gi,Wi,qi,$i,Ki,Qi,Ji,na,ea,ta,ra,oa,ia,aa,ua,ca,la,sa,da,fa,ha,va,pa,ga,ya,ma,wa,ba,xa,_a,Ea,Sa,ka,Na,Ca,Oa,Ma,ja,Pa,Ia,Aa,za,Ta,Ba,La,Da,Ra,Va,Ha,Ya,Xa,Fa,Za,Ua,Ga,Wa,qa,$a,Ka,Qa,Ja,nu,eu,tu,ru,ou,iu,au,uu,cu,lu,su,du,fu,hu,vu,pu,gu,yu,mu,wu,bu,xu,_u,Eu,Su,ku,Nu,Cu,Ou,Mu,ju,Pu,Iu,Au,zu,Tu,Bu,Lu,Du,Ru,Vu,Hu,Yu,Xu,Fu,Zu,Uu,Gu,Wu,qu,$u,Ku,Qu,Ju,nc,ec,tc,rc,oc,ic,ac,uc,cc,lc,sc,dc,fc,hc,vc,pc,gc,yc,mc,wc,bc,xc,_c,Ec,Sc,kc,Nc={exports:{}};function Cc(){return pr||(pr=1,function(n,e){var t=$e(),r=e&&!e.nodeType&&e,o=r&&n&&!n.nodeType&&n,i=o&&o.exports===r?t.Buffer:void 0,a=i?i.allocUnsafe:void 0;n.exports=function(n,e){if(e)return n.slice();var t=n.length,r=a?a(t):new n.constructor(t);return n.copy(r),r}}(Nc,Nc.exports)),Nc.exports}function Oc(){return yr||(yr=1,gr=function(n,e){var t=-1,r=n.length;for(e||(e=Array(r));++t<r;)e[t]=n[t];return e}),gr}function Mc(){return wr||(wr=1,mr=function(n,e){for(var t=-1,r=null==n?0:n.length,o=0,i=[];++t<r;){var a=n[t];e(a,t,n)&&(i[o++]=a)}return i}),mr}function jc(){return xr?br:(xr=1,br=function(){return[]})}function Pc(){if(Er)return _r;Er=1;var n=Mc(),e=jc(),t=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return _r=r?function(e){return null==e?[]:(e=Object(e),n(r(e),(function(n){return t.call(e,n)})))}:e}function Ic(){return Cr||(Cr=1,Nr=function(n,e){for(var t=-1,r=e.length,o=n.length;++t<r;)n[o+t]=e[t];return n}),Nr}function Ac(){if(Mr)return Or;Mr=1;var n=sr()(Object.getPrototypeOf,Object);return Or=n}function zc(){if(Pr)return jr;Pr=1;var n=Ic(),e=Ac(),t=Pc(),r=jc(),o=Object.getOwnPropertySymbols;return jr=o?function(r){for(var o=[];r;)n(o,t(r)),r=e(r);return o}:r}function Tc(){if(Tr)return zr;Tr=1;var n=Ic(),e=pt();return zr=function(t,r,o){var i=r(t);return e(t)?i:n(i,o(t))}}function Bc(){if(Lr)return Br;Lr=1;var n=Tc(),e=Pc(),t=hr();return Br=function(r){return n(r,t,e)}}function Lc(){if(Zr)return Fr;Zr=1;var n=tt()($e(),"Set");return Fr=n}function Dc(){if(qr)return Wr;qr=1;var n=function(){if(Hr)return Vr;Hr=1;var n=tt()($e(),"DataView");return Vr=n}(),e=rt(),t=function(){if(Xr)return Yr;Xr=1;var n=tt()($e(),"Promise");return Yr=n}(),r=Lc(),o=function(){if(Gr)return Ur;Gr=1;var n=tt()($e(),"WeakMap");return Ur=n}(),i=Qe(),a=et(),u="[object Map]",c="[object Promise]",l="[object Set]",s="[object WeakMap]",d="[object DataView]",f=a(n),h=a(e),v=a(t),p=a(r),g=a(o),y=i;return(n&&y(new n(new ArrayBuffer(1)))!=d||e&&y(new e)!=u||t&&y(t.resolve())!=c||r&&y(new r)!=l||o&&y(new o)!=s)&&(y=function(n){var e=i(n),t="[object Object]"==e?n.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 l;case g:return s}return e}),Wr=y}function Rc(){if(Jr)return Qr;Jr=1;var n=$e().Uint8Array;return Qr=n}function Vc(){if(eo)return no;eo=1;var n=Rc();return no=function(e){var t=new e.constructor(e.byteLength);return new n(t).set(new n(e)),t}}function Hc(){if(lo)return co;lo=1;var n=Vc();return co=function(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}}function Yc(){if(vo)return ho;vo=1;var n=Je(),e=Object.create,t=function(){function t(){}return function(r){if(!n(r))return{};if(e)return e(r);t.prototype=r;var o=new t;return t.prototype=void 0,o}}();return ho=t}function Xc(){if(go)return po;go=1;var n=Yc(),e=Ac(),t=lr();return po=function(r){return"function"!=typeof r.constructor||t(r)?{}:n(e(r))}}function Fc(){if(No)return ko;No=1;var n=ut(),e=ct(),t=dt(),r=function(){if($t)return qt;$t=1;var n=ft(),e=hr();return qt=function(t,r){return t&&n(r,e(r),t)}}(),o=function(){if(or)return rr;or=1;var n=ft(),e=vr();return rr=function(t,r){return t&&n(r,e(r),t)}}(),i=Cc(),a=Oc(),u=function(){if(kr)return Sr;kr=1;var n=ft(),e=Pc();return Sr=function(t,r){return n(t,e(t),r)}}(),c=function(){if(Ar)return Ir;Ar=1;var n=ft(),e=zc();return Ir=function(t,r){return n(t,e(t),r)}}(),l=Bc(),s=function(){if(Rr)return Dr;Rr=1;var n=Tc(),e=zc(),t=vr();return Dr=function(r){return n(r,t,e)}}(),d=Dc(),f=function(){if(Kr)return $r;Kr=1;var n=Object.prototype.hasOwnProperty;return $r=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&n.call(e,"index")&&(r.index=e.index,r.input=e.input),r},$r}(),h=function(){if(fo)return so;fo=1;var n=Vc(),e=function(){if(ro)return to;ro=1;var n=Vc();return to=function(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}}(),t=function(){if(io)return oo;io=1;var n=/\w*$/;return oo=function(e){var t=new e.constructor(e.source,n.exec(e));return t.lastIndex=e.lastIndex,t}}(),r=function(){if(uo)return ao;uo=1;var n=Ke(),e=n?n.prototype:void 0,t=e?e.valueOf:void 0;return ao=function(n){return t?Object(t.call(n)):{}}}(),o=Hc();return so=function(i,a,u){var c=i.constructor;switch(a){case"[object ArrayBuffer]":return n(i);case"[object Boolean]":case"[object Date]":return new c(+i);case"[object DataView]":return e(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=Xc(),p=pt(),g=Ot(),y=function(){if(bo)return wo;bo=1;var n=function(){if(mo)return yo;mo=1;var n=Dc(),e=ht();return yo=function(t){return e(t)&&"[object Map]"==n(t)}}(),e=Pt(),t=ar(),r=t&&t.isMap,o=r?e(r):n;return wo=o}(),m=Je(),w=function(){if(So)return Eo;So=1;var n=function(){if(_o)return xo;_o=1;var n=Dc(),e=ht();return xo=function(t){return e(t)&&"[object Set]"==n(t)}}(),e=Pt(),t=ar(),r=t&&t.isSet,o=r?e(r):n;return Eo=o}(),b=hr(),x=vr(),_="[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,ko=function N(C,O,M,j,P,I){var A,z=1&O,T=2&O,B=4&O;if(M&&(A=P?M(C,j,P,I):M(C)),void 0!==A)return A;if(!m(C))return C;var L=p(C);if(L){if(A=f(C),!z)return a(C,A)}else{var D=d(C),R=D==E||"[object GeneratorFunction]"==D;if(g(C))return i(C,z);if(D==S||D==_||R&&!P){if(A=T||R?{}:v(C),!z)return T?c(C,o(A,C)):u(C,r(A,C))}else{if(!k[D])return P?C:{};A=h(C,D,z)}}I||(I=new n);var V=I.get(C);if(V)return V;I.set(C,A),w(C)?C.forEach((function(n){A.add(N(n,O,M,n,C,I))})):y(C)&&C.forEach((function(n,e){A.set(e,N(n,O,M,e,C,I))}));var H=L?void 0:(B?T?s:l:T?x:b)(C);return e(H||C,(function(n,e){H&&(n=C[e=n]),t(A,e,N(n,O,M,e,C,I))})),A},ko}function Zc(){if(Oo)return Co;Oo=1;var n=Fc();return Co=function(e){return n(e,4)}}function Uc(){return jo?Mo:(jo=1,Mo=function(n){return function(){return n}})}function Gc(){if(zo)return Ao;zo=1;var n=(Io?Po:(Io=1,Po=function(n){return function(e,t,r){for(var o=-1,i=Object(e),a=r(e),u=a.length;u--;){var c=a[n?u:++o];if(!1===t(i[c],c,i))break}return e}}))();return Ao=n}function Wc(){if(Bo)return To;Bo=1;var n=Gc(),e=hr();return To=function(t,r){return t&&n(t,r,e)}}function qc(){if(Vo)return Ro;Vo=1;var n=Wc(),e=function(){if(Do)return Lo;Do=1;var n=fr();return Lo=function(e,t){return function(r,o){if(null==r)return r;if(!n(r))return e(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=e(n);return Ro=t}function $c(){return Yo?Ho:(Yo=1,Ho=function(n){return n})}function Kc(){if(Fo)return Xo;Fo=1;var n=$c();return Xo=function(e){return"function"==typeof e?e:n}}function Qc(){if(Uo)return Zo;Uo=1;var n=ct(),e=qc(),t=Kc(),r=pt();return Zo=function(o,i){return(r(o)?n:e)(o,t(i))}}function Jc(){return Wo?Go:(Wo=1,Go=Qc())}function nl(){if(ti)return ei;ti=1;var n=at(),e=Qo?Ko:(Qo=1,Ko=function(n){return this.__data__.set(n,"__lodash_hash_undefined__"),this}),t=ni?Jo:(ni=1,Jo=function(n){return this.__data__.has(n)});function r(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new n;++t<r;)this.add(e[t])}return r.prototype.add=r.prototype.push=e,r.prototype.has=t,ei=r}function el(){return ai?ii:(ai=1,ii=function(n,e){return n.has(e)})}function tl(){if(ci)return ui;ci=1;var n=nl(),e=(oi||(oi=1,ri=function(n,e){for(var t=-1,r=null==n?0:n.length;++t<r;)if(e(n[t],t,n))return!0;return!1}),ri),t=el();return ui=function(r,o,i,a,u,c){var l=1&i,s=r.length,d=o.length;if(s!=d&&!(l&&d>s))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 n:void 0;for(c.set(r,o),c.set(o,r);++v<s;){var y=r[v],m=o[v];if(a)var w=l?a(m,y,v,o,r,c):a(y,m,v,r,o,c);if(void 0!==w){if(w)continue;p=!1;break}if(g){if(!e(o,(function(n,e){if(!t(g,e)&&(y===n||u(y,n,i,a,c)))return g.push(e)}))){p=!1;break}}else if(y!==m&&!u(y,m,i,a,c)){p=!1;break}}return c.delete(r),c.delete(o),p},ui}function rl(){return fi||(fi=1,di=function(n){var e=-1,t=Array(n.size);return n.forEach((function(n){t[++e]=n})),t}),di}function ol(){if(mi)return yi;mi=1;var n=ut(),e=tl(),t=function(){if(vi)return hi;vi=1;var n=Ke(),e=Rc(),t=Ue(),r=tl(),o=(si||(si=1,li=function(n){var e=-1,t=Array(n.size);return n.forEach((function(n,r){t[++e]=[r,n]})),t}),li),i=rl(),a=n?n.prototype:void 0,u=a?a.valueOf:void 0;return hi=function(n,a,c,l,s,d,f){switch(c){case"[object DataView]":if(n.byteLength!=a.byteLength||n.byteOffset!=a.byteOffset)return!1;n=n.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(n.byteLength!=a.byteLength||!d(new e(n),new e(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return t(+n,+a);case"[object Error]":return n.name==a.name&&n.message==a.message;case"[object RegExp]":case"[object String]":return n==a+"";case"[object Map]":var h=o;case"[object Set]":var v=1&l;if(h||(h=i),n.size!=a.size&&!v)return!1;var p=f.get(n);if(p)return p==a;l|=2,f.set(n,a);var g=r(h(n),h(a),l,s,d,f);return f.delete(n),g;case"[object Symbol]":if(u)return u.call(n)==u.call(a)}return!1}}(),r=function(){if(gi)return pi;gi=1;var n=Bc(),e=Object.prototype.hasOwnProperty;return pi=function(t,r,o,i,a,u){var c=1&o,l=n(t),s=l.length;if(s!=n(r).length&&!c)return!1;for(var d=s;d--;){var f=l[d];if(!(c?f in r:e.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<s;){var y=t[f=l[d]],m=r[f];if(i)var w=c?i(m,y,f,r,t,u):i(y,m,f,t,r,u);if(!(void 0===w?y===m||a(y,m,o,i,u):w)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var b=t.constructor,x=r.constructor;b==x||!("constructor"in t)||!("constructor"in r)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(p=!1)}return u.delete(t),u.delete(r),p}}(),o=Dc(),i=pt(),a=Ot(),u=ur(),c="[object Arguments]",l="[object Array]",s="[object Object]",d=Object.prototype.hasOwnProperty;return yi=function(f,h,v,p,g,y){var m=i(f),w=i(h),b=m?l:o(f),x=w?l:o(h),_=(b=b==c?s:b)==s,E=(x=x==c?s:x)==s,S=b==x;if(S&&a(f)){if(!a(h))return!1;m=!0,_=!1}if(S&&!_)return y||(y=new n),m||u(f)?e(f,h,v,p,g,y):t(f,h,b,v,p,g,y);if(!(1&v)){var k=_&&d.call(f,"__wrapped__"),N=E&&d.call(h,"__wrapped__");if(k||N){var C=k?f.value():f,O=N?h.value():h;return y||(y=new n),g(C,O,v,p,y)}}return!!S&&(y||(y=new n),r(f,h,v,p,g,y))}}function il(){if(bi)return wi;bi=1;var n=ol(),e=ht();return wi=function t(r,o,i,a,u){return r===o||(null==r||null==o||!e(r)&&!e(o)?r!=r&&o!=o:n(r,o,i,a,t,u))},wi}function al(){if(Si)return Ei;Si=1;var n=Je();return Ei=function(e){return e==e&&!n(e)}}function ul(){return Oi?Ci:(Oi=1,Ci=function(n,e){return function(t){return null!=t&&t[n]===e&&(void 0!==e||n in Object(t))}})}function cl(){if(Ii)return Pi;Ii=1;var n=Qe(),e=ht();return Pi=function(t){return"symbol"==typeof t||e(t)&&"[object Symbol]"==n(t)}}function ll(){if(zi)return Ai;zi=1;var n=pt(),e=cl(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return Ai=function(o,i){if(n(o))return!1;var a=typeof o;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=o&&!e(o))||r.test(o)||!t.test(o)||null!=i&&o in Object(i)}}function sl(){return Yi||(Yi=1,Hi=function(n,e){for(var t=-1,r=null==n?0:n.length,o=Array(r);++t<r;)o[t]=e(n[t],t,n);return o}),Hi}function dl(){if(Ui)return Zi;Ui=1;var n=function(){if(Fi)return Xi;Fi=1;var n=Ke(),e=sl(),t=pt(),r=cl(),o=n?n.prototype:void 0,i=o?o.toString:void 0;return Xi=function n(o){if("string"==typeof o)return o;if(t(o))return e(o,n)+"";if(r(o))return i?i.call(o):"";var a=o+"";return"0"==a&&1/o==-1/0?"-0":a},Xi}();return Zi=function(e){return null==e?"":n(e)}}function fl(){if(Wi)return Gi;Wi=1;var n=pt(),e=ll(),t=function(){if(Vi)return Ri;Vi=1;var n=function(){if(Di)return Li;Di=1;var n=function(){if(Bi)return Ti;Bi=1;var n=at();function e(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var o=function(){var n=arguments,e=r?r.apply(this,n):n[0],i=o.cache;if(i.has(e))return i.get(e);var a=t.apply(this,n);return o.cache=i.set(e,a)||i,a};return o.cache=new(e.Cache||n),o}return e.Cache=n,Ti=e}();return Li=function(e){var t=n(e,(function(n){return 500===r.size&&r.clear(),n})),r=t.cache;return t}}(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,r=n((function(n){var r=[];return 46===n.charCodeAt(0)&&r.push(""),n.replace(e,(function(n,e,o,i){r.push(o?i.replace(t,"$1"):e||n)})),r}));return Ri=r}(),r=dl();return Gi=function(o,i){return n(o)?o:e(o,i)?[o]:t(r(o))}}function hl(){if($i)return qi;$i=1;var n=cl();return qi=function(e){if("string"==typeof e||n(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}}function vl(){if(Qi)return Ki;Qi=1;var n=fl(),e=hl();return Ki=function(t,r){for(var o=0,i=(r=n(r,t)).length;null!=t&&o<i;)t=t[e(r[o++])];return o&&o==i?t:void 0}}function pl(){if(oa)return ra;oa=1;var n=fl(),e=vt(),t=pt(),r=Mt(),o=jt(),i=hl();return ra=function(a,u,c){for(var l=-1,s=(u=n(u,a)).length,d=!1;++l<s;){var f=i(u[l]);if(!(d=null!=a&&c(a,f)))break;a=a[f]}return d||++l!=s?d:!!(s=null==a?0:a.length)&&o(s)&&r(f,s)&&(t(a)||e(a))}}function gl(){if(aa)return ia;aa=1;var n=ta?ea:(ta=1,ea=function(n,e){return null!=n&&e in Object(n)}),e=pl();return ia=function(t,r){return null!=t&&e(t,r,n)}}function yl(){return sa?la:(sa=1,la=function(n){return function(e){return null==e?void 0:e[n]}})}function ml(){if(ga)return pa;ga=1;var n=function(){if(ji)return Mi;ji=1;var n=function(){if(_i)return xi;_i=1;var n=ut(),e=il();return xi=function(t,r,o,i){var a=o.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var l=o[a];if(c&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++a<u;){var s=(l=o[a])[0],d=t[s],f=l[1];if(c&&l[2]){if(void 0===d&&!(s in t))return!1}else{var h=new n;if(i)var v=i(d,f,s,t,r,h);if(!(void 0===v?e(f,d,3,i,h):v))return!1}}return!0}}(),e=function(){if(Ni)return ki;Ni=1;var n=al(),e=hr();return ki=function(t){for(var r=e(t),o=r.length;o--;){var i=r[o],a=t[i];r[o]=[i,a,n(a)]}return r}}(),t=ul();return Mi=function(r){var o=e(r);return 1==o.length&&o[0][2]?t(o[0][0],o[0][1]):function(e){return e===r||n(e,r,o)}}}(),e=function(){if(ca)return ua;ca=1;var n=il(),e=function(){if(na)return Ji;na=1;var n=vl();return Ji=function(e,t,r){var o=null==e?void 0:n(e,t);return void 0===o?r:o}}(),t=gl(),r=ll(),o=al(),i=ul(),a=hl();return ua=function(u,c){return r(u)&&o(c)?i(a(u),c):function(r){var o=e(r,u);return void 0===o&&o===c?t(r,u):n(c,o,3)}}}(),t=$c(),r=pt(),o=function(){if(va)return ha;va=1;var n=yl(),e=function(){if(fa)return da;fa=1;var n=vl();return da=function(e){return function(t){return n(t,e)}}}(),t=ll(),r=hl();return ha=function(o){return t(o)?n(r(o)):e(o)}}();return pa=function(i){return"function"==typeof i?i:null==i?t:"object"==typeof i?r(i)?e(i[0],i[1]):n(i):o(i)}}function wl(){if(ma)return ya;ma=1;var n=Mc(),e=function(){if($o)return qo;$o=1;var n=qc();return qo=function(e,t){var r=[];return n(e,(function(n,e,o){t(n,e,o)&&r.push(n)})),r}}(),t=ml(),r=pt();return ya=function(o,i){return(r(o)?n:e)(o,t(i,3))}}function bl(){if(_a)return xa;_a=1;var n=function(){if(ba)return wa;ba=1;var n=Object.prototype.hasOwnProperty;return wa=function(e,t){return null!=e&&n.call(e,t)}}(),e=pl();return xa=function(t,r){return null!=t&&e(t,r,n)}}function xl(){if(Sa)return Ea;Sa=1;var n=dr(),e=Dc(),t=vt(),r=pt(),o=fr(),i=Ot(),a=lr(),u=ur(),c=Object.prototype.hasOwnProperty;return Ea=function(l){if(null==l)return!0;if(o(l)&&(r(l)||"string"==typeof l||"function"==typeof l.splice||i(l)||u(l)||t(l)))return!l.length;var s=e(l);if("[object Map]"==s||"[object Set]"==s)return!l.size;if(a(l))return!n(l).length;for(var d in l)if(c.call(l,d))return!1;return!0}}function _l(){return Na?ka:(Na=1,ka=function(n){return void 0===n})}function El(){if(Oa)return Ca;Oa=1;var n=qc(),e=fr();return Ca=function(t,r){var o=-1,i=e(t)?Array(t.length):[];return n(t,(function(n,e,t){i[++o]=r(n,e,t)})),i}}function Sl(){if(ja)return Ma;ja=1;var n=sl(),e=ml(),t=El(),r=pt();return Ma=function(o,i){return(r(o)?n:t)(o,e(i,3))}}function kl(){if(Ba)return Ta;Ba=1;var n=(Ia||(Ia=1,Pa=function(n,e,t,r){var o=-1,i=null==n?0:n.length;for(r&&i&&(t=n[++o]);++o<i;)t=e(t,n[o],o,n);return t}),Pa),e=qc(),t=ml(),r=za?Aa:(za=1,Aa=function(n,e,t,r,o){return o(n,(function(n,o,i){t=r?(r=!1,n):e(t,n,o,i)})),t}),o=pt();return Ta=function(i,a,u){var c=o(i)?n:r,l=arguments.length<3;return c(i,t(a,4),u,l,e)},Ta}function Nl(){if(Wa)return Ga;Wa=1;var n=dr(),e=Dc(),t=fr(),r=function(){if(Da)return La;Da=1;var n=Qe(),e=pt(),t=ht();return La=function(r){return"string"==typeof r||!e(r)&&t(r)&&"[object String]"==n(r)}}(),o=function(){if(Ua)return Za;Ua=1;var n=function(){if(Va)return Ra;Va=1;var n=yl()("length");return Ra=n}(),e=function(){if(Ya)return Ha;Ya=1;var n=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return Ha=function(e){return n.test(e)}}(),t=function(){if(Fa)return Xa;Fa=1;var n="\\ud800-\\udfff",e="["+n+"]",t="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",o="[^"+n+"]",i="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+t+"|"+r+")?",c="[\\ufe0e\\ufe0f]?",l=c+u+"(?:\\u200d(?:"+[o,i,a].join("|")+")"+c+u+")*",s="(?:"+[o+t+"?",t,i,a,e].join("|")+")",d=RegExp(r+"(?="+r+")|"+s+l,"g");return Xa=function(n){for(var e=d.lastIndex=0;d.test(n);)++e;return e}}();return Za=function(r){return e(r)?t(r):n(r)}}();return Ga=function(i){if(null==i)return 0;if(t(i))return r(i)?o(i):i.length;var a=e(i);return"[object Map]"==a||"[object Set]"==a?i.size:n(i).length}}function Cl(){if($a)return qa;$a=1;var n=ct(),e=Yc(),t=Wc(),r=ml(),o=Ac(),i=pt(),a=Ot(),u=nt(),c=Je(),l=ur();return qa=function(s,d,f){var h=i(s),v=h||a(s)||l(s);if(d=r(d,4),null==f){var p=s&&s.constructor;f=v?h?new p:[]:c(s)&&u(p)?e(o(s)):{}}return(v?n:t)(s,(function(n,e,t){return d(f,n,e,t)})),f}}function Ol(){if(nu)return Ja;nu=1;var n=Ic(),e=function(){if(Qa)return Ka;Qa=1;var n=Ke(),e=vt(),t=pt(),r=n?n.isConcatSpreadable:void 0;return Ka=function(n){return t(n)||e(n)||!!(r&&n&&n[r])}}();return Ja=function t(r,o,i,a,u){var c=-1,l=r.length;for(i||(i=e),u||(u=[]);++c<l;){var s=r[c];o>0&&i(s)?o>1?t(s,o-1,i,a,u):n(u,s):a||(u[u.length]=s)}return u},Ja}function Ml(){if(ou)return ru;ou=1;var n=tu?eu:(tu=1,eu=function(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}),e=Math.max;return ru=function(t,r,o){return r=e(void 0===r?t.length-1:r,0),function(){for(var i=arguments,a=-1,u=e(i.length-r,0),c=Array(u);++a<u;)c[a]=i[r+a];a=-1;for(var l=Array(r+1);++a<r;)l[a]=i[a];return l[r]=o(c),n(t,this,l)}},ru}function jl(){if(su)return lu;su=1;var n=function(){if(au)return iu;au=1;var n=Uc(),e=lt(),t=$c();return iu=e?function(t,r){return e(t,"toString",{configurable:!0,enumerable:!1,value:n(r),writable:!0})}:t}(),e=function(){if(cu)return uu;cu=1;var n=Date.now;return uu=function(e){var t=0,r=0;return function(){var o=n(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}},uu}(),t=e(n);return lu=t}function Pl(){if(fu)return du;fu=1;var n=$c(),e=Ml(),t=jl();return du=function(r,o){return t(e(r,o,n),r+"")},du}function Il(){return vu||(vu=1,hu=function(n,e,t,r){for(var o=n.length,i=t+(r?1:-1);r?i--:++i<o;)if(e(n[i],i,n))return i;return-1}),hu}function Al(){if(ju)return Mu;ju=1;var n=nl(),e=function(){if(_u)return xu;_u=1;var n=function(){if(bu)return wu;bu=1;var n=Il(),e=gu?pu:(gu=1,pu=function(n){return n!=n}),t=(mu||(mu=1,yu=function(n,e,t){for(var r=t-1,o=n.length;++r<o;)if(n[r]===e)return r;return-1}),yu);return wu=function(r,o,i){return o==o?t(r,o,i):n(r,e,i)},wu}();return xu=function(e,t){return!(null==e||!e.length)&&n(e,t,0)>-1},xu}(),t=(Su||(Su=1,Eu=function(n,e,t){for(var r=-1,o=null==n?0:n.length;++r<o;)if(t(e,n[r]))return!0;return!1}),Eu),r=el(),o=function(){if(Ou)return Cu;Ou=1;var n=Lc(),e=Nu?ku:(Nu=1,ku=function(){}),t=rl(),r=n&&1/t(new n([,-0]))[1]==1/0?function(e){return new n(e)}:e;return Cu=r}(),i=rl();return Mu=function(a,u,c){var l=-1,s=e,d=a.length,f=!0,h=[],v=h;if(c)f=!1,s=t;else if(d>=200){var p=u?null:o(a);if(p)return i(p);f=!1,s=r,v=new n}else v=u?[]:h;n:for(;++l<d;){var g=a[l],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 n;u&&v.push(y),h.push(g)}else s(v,y,c)||(v!==h&&v.push(y),h.push(g))}return h},Mu}function zl(){if(Iu)return Pu;Iu=1;var n=fr(),e=ht();return Pu=function(t){return e(t)&&n(t)}}function Tl(){if(zu)return Au;zu=1;var n=Ol(),e=Pl(),t=Al(),r=zl(),o=e((function(e){return t(n(e,1,r,!0))}));return Au=o}function Bl(){if(Du)return Lu;Du=1;var n=function(){if(Bu)return Tu;Bu=1;var n=sl();return Tu=function(e,t){return n(t,(function(n){return e[n]}))}}(),e=hr();return Lu=function(t){return null==t?[]:n(t,e(t))}}function Ll(){if(Vu)return Ru;var n;Vu=1;try{n={clone:Zc(),constant:Uc(),each:Jc(),filter:wl(),has:bl(),isArray:pt(),isEmpty:xl(),isFunction:nt(),isUndefined:_l(),keys:hr(),map:Sl(),reduce:kl(),size:Nl(),transform:Cl(),union:Tl(),values:Bl()}}catch(n){}return n||(n=window._),Ru=n}function Dl(){if(Yu)return Hu;Yu=1;var n=Ll();Hu=o;var e="\0",t="\0",r="";function o(e){this._isDirected=!n.has(e,"directed")||e.directed,this._isMultigraph=!!n.has(e,"multigraph")&&e.multigraph,this._isCompound=!!n.has(e,"compound")&&e.compound,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.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(n,e){n[e]?n[e]++:n[e]=1}function a(n,e){--n[e]||delete n[e]}function u(t,o,i,a){var u=""+o,c=""+i;if(!t&&u>c){var l=u;u=c,c=l}return u+r+c+r+(n.isUndefined(a)?e:a)}function c(n,e){return u(n,e.v,e.w,e.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(n){return this._label=n,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(e){return n.isFunction(e)||(e=n.constant(e)),this._defaultNodeLabelFn=e,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return n.keys(this._nodes)},o.prototype.sources=function(){var e=this;return n.filter(this.nodes(),(function(t){return n.isEmpty(e._in[t])}))},o.prototype.sinks=function(){var e=this;return n.filter(this.nodes(),(function(t){return n.isEmpty(e._out[t])}))},o.prototype.setNodes=function(e,t){var r=arguments,o=this;return n.each(e,(function(n){r.length>1?o.setNode(n,t):o.setNode(n)})),this},o.prototype.setNode=function(e,r){return n.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=r),this):(this._nodes[e]=arguments.length>1?r:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=t,this._children[e]={},this._children[t][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},o.prototype.node=function(n){return this._nodes[n]},o.prototype.hasNode=function(e){return n.has(this._nodes,e)},o.prototype.removeNode=function(e){var t=this;if(n.has(this._nodes,e)){var r=function(n){t.removeEdge(t._edgeObjs[n])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],n.each(this.children(e),(function(n){t.setParent(n)})),delete this._children[e]),n.each(n.keys(this._in[e]),r),delete this._in[e],delete this._preds[e],n.each(n.keys(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},o.prototype.setParent=function(e,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(r))r=t;else{for(var o=r+="";!n.isUndefined(o);o=this.parent(o))if(o===e)throw new Error("Setting "+r+" as parent of "+e+" would create a cycle");this.setNode(r)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=r,this._children[r][e]=!0,this},o.prototype._removeFromParentsChildList=function(n){delete this._children[this._parent[n]][n]},o.prototype.parent=function(n){if(this._isCompound){var e=this._parent[n];if(e!==t)return e}},o.prototype.children=function(e){if(n.isUndefined(e)&&(e=t),this._isCompound){var r=this._children[e];if(r)return n.keys(r)}else{if(e===t)return this.nodes();if(this.hasNode(e))return[]}},o.prototype.predecessors=function(e){var t=this._preds[e];if(t)return n.keys(t)},o.prototype.successors=function(e){var t=this._sucs[e];if(t)return n.keys(t)},o.prototype.neighbors=function(e){var t=this.predecessors(e);if(t)return n.union(t,this.successors(e))},o.prototype.isLeaf=function(n){return 0===(this.isDirected()?this.successors(n):this.neighbors(n)).length},o.prototype.filterNodes=function(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;n.each(this._nodes,(function(n,r){e(r)&&t.setNode(r,n)})),n.each(this._edgeObjs,(function(n){t.hasNode(n.v)&&t.hasNode(n.w)&&t.setEdge(n,r.edge(n))}));var o={};function i(n){var e=r.parent(n);return void 0===e||t.hasNode(e)?(o[n]=e,e):e in o?o[e]:i(e)}return this._isCompound&&n.each(t.nodes(),(function(n){t.setParent(n,i(n))})),t},o.prototype.setDefaultEdgeLabel=function(e){return n.isFunction(e)||(e=n.constant(e)),this._defaultEdgeLabelFn=e,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return n.values(this._edgeObjs)},o.prototype.setPath=function(e,t){var r=this,o=arguments;return n.reduce(e,(function(n,e){return o.length>1?r.setEdge(n,e,t):r.setEdge(n,e),e})),this},o.prototype.setEdge=function(){var e,t,r,o,a=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(e=c.v,t=c.w,r=c.name,2===arguments.length&&(o=arguments[1],a=!0)):(e=c,t=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],a=!0)),e=""+e,t=""+t,n.isUndefined(r)||(r=""+r);var l=u(this._isDirected,e,t,r);if(n.has(this._edgeLabels,l))return a&&(this._edgeLabels[l]=o),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[l]=a?o:this._defaultEdgeLabelFn(e,t,r);var s=function(n,e,t,r){var o=""+e,i=""+t;if(!n&&o>i){var a=o;o=i,i=a}var u={v:o,w:i};return r&&(u.name=r),u}(this._isDirected,e,t,r);return e=s.v,t=s.w,Object.freeze(s),this._edgeObjs[l]=s,i(this._preds[t],e),i(this._sucs[e],t),this._in[t][l]=s,this._out[e][l]=s,this._edgeCount++,this},o.prototype.edge=function(n,e,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,n,e,t);return this._edgeLabels[r]},o.prototype.hasEdge=function(e,t,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,t,r);return n.has(this._edgeLabels,o)},o.prototype.removeEdge=function(n,e,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,n,e,t),o=this._edgeObjs[r];return o&&(n=o.v,e=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[e],n),a(this._sucs[n],e),delete this._in[e][r],delete this._out[n][r],this._edgeCount--),this},o.prototype.inEdges=function(e,t){var r=this._in[e];if(r){var o=n.values(r);return t?n.filter(o,(function(n){return n.v===t})):o}},o.prototype.outEdges=function(e,t){var r=this._out[e];if(r){var o=n.values(r);return t?n.filter(o,(function(n){return n.w===t})):o}},o.prototype.nodeEdges=function(n,e){var t=this.inEdges(n,e);if(t)return t.concat(this.outEdges(n,e))},Hu}function Rl(){if(Wu)return Gu;Wu=1;var n=Ll(),e=Dl();function t(e){return n.map(e.nodes(),(function(t){var r=e.node(t),o=e.parent(t),i={v:t};return n.isUndefined(r)||(i.value=r),n.isUndefined(o)||(i.parent=o),i}))}function r(e){return n.map(e.edges(),(function(t){var r=e.edge(t),o={v:t.v,w:t.w};return n.isUndefined(t.name)||(o.name=t.name),n.isUndefined(r)||(o.value=r),o}))}return Gu={write:function(e){var o={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:t(e),edges:r(e)};return n.isUndefined(e.graph())||(o.value=n.clone(e.graph())),o},read:function(t){var r=new e(t.options).setGraph(t.value);return n.each(t.nodes,(function(n){r.setNode(n.v,n.value),n.parent&&r.setParent(n.v,n.parent)})),n.each(t.edges,(function(n){r.setEdge({v:n.v,w:n.w,name:n.name},n.value)})),r}}}function Vl(){if($u)return qu;$u=1;var n=Ll();return qu=function(e){var t,r={},o=[];function i(o){n.has(r,o)||(r[o]=!0,t.push(o),n.each(e.successors(o),i),n.each(e.predecessors(o),i))}return n.each(e.nodes(),(function(n){t=[],i(n),t.length&&o.push(t)})),o},qu}function Hl(){if(Qu)return Ku;Qu=1;var n=Ll();function e(){this._arr=[],this._keyIndices={}}return Ku=e,e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map((function(n){return n.key}))},e.prototype.has=function(e){return n.has(this._keyIndices,e)},e.prototype.priority=function(n){var e=this._keyIndices[n];if(void 0!==e)return this._arr[e].priority},e.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(e,t){var r=this._keyIndices;if(e=String(e),!n.has(r,e)){var o=this._arr,i=o.length;return r[e]=i,o.push({key:e,priority:t}),this._decrease(i),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},e.prototype.decrease=function(n,e){var t=this._keyIndices[n];if(e>this._arr[t].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[t].priority+" New: "+e);this._arr[t].priority=e,this._decrease(t)},e.prototype._heapify=function(n){var e=this._arr,t=2*n,r=t+1,o=n;t<e.length&&(o=e[t].priority<e[o].priority?t:o,r<e.length&&(o=e[r].priority<e[o].priority?r:o),o!==n&&(this._swap(n,o),this._heapify(o)))},e.prototype._decrease=function(n){for(var e,t=this._arr,r=t[n].priority;0!==n&&!(t[e=n>>1].priority<r);)this._swap(n,e),n=e},e.prototype._swap=function(n,e){var t=this._arr,r=this._keyIndices,o=t[n],i=t[e];t[n]=i,t[e]=o,r[i.key]=n,r[o.key]=e},Ku}function Yl(){if(nc)return Ju;nc=1;var n=Ll(),e=Hl();Ju=function(n,r,o,i){return function(n,t,r,o){var i,a,u={},c=new e,l=function(n){var e=n.v!==i?n.v:n.w,t=u[e],o=r(n),l=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+n+" Weight: "+o);l<t.distance&&(t.distance=l,t.predecessor=i,c.decrease(e,l))};for(n.nodes().forEach((function(n){var e=n===t?0:Number.POSITIVE_INFINITY;u[n]={distance:e},c.add(n,e)}));c.size()>0&&(i=c.removeMin(),(a=u[i]).distance!==Number.POSITIVE_INFINITY);)o(i).forEach(l);return u}(n,String(r),o||t,i||function(e){return n.outEdges(e)})};var t=n.constant(1);return Ju}function Xl(){if(tc)return ec;tc=1;var n=Yl(),e=Ll();return ec=function(t,r,o){return e.transform(t.nodes(),(function(e,i){e[i]=n(t,i,r,o)}),{})}}function Fl(){if(oc)return rc;oc=1;var n=Ll();return rc=function(e){var t=0,r=[],o={},i=[];function a(u){var c=o[u]={onStack:!0,lowlink:t,index:t++};if(r.push(u),e.successors(u).forEach((function(e){n.has(o,e)?o[e].onStack&&(c.lowlink=Math.min(c.lowlink,o[e].index)):(a(e),c.lowlink=Math.min(c.lowlink,o[e].lowlink))})),c.lowlink===c.index){var l,s=[];do{l=r.pop(),o[l].onStack=!1,s.push(l)}while(u!==l);i.push(s)}}return e.nodes().forEach((function(e){n.has(o,e)||a(e)})),i},rc}function Zl(){if(ac)return ic;ac=1;var n=Ll(),e=Fl();return ic=function(t){return n.filter(e(t),(function(n){return n.length>1||1===n.length&&t.hasEdge(n[0],n[0])}))}}function Ul(){if(cc)return uc;cc=1;var n=Ll();uc=function(n,t,r){return function(n,e,t){var r={},o=n.nodes();return o.forEach((function(n){r[n]={},r[n][n]={distance:0},o.forEach((function(e){n!==e&&(r[n][e]={distance:Number.POSITIVE_INFINITY})})),t(n).forEach((function(t){var o=t.v===n?t.w:t.v,i=e(t);r[n][o]={distance:i,predecessor:n}}))})),o.forEach((function(n){var e=r[n];o.forEach((function(t){var i=r[t];o.forEach((function(t){var r=i[n],o=e[t],a=i[t],u=r.distance+o.distance;u<a.distance&&(a.distance=u,a.predecessor=o.predecessor)}))}))})),r}(n,t||e,r||function(e){return n.outEdges(e)})};var e=n.constant(1);return uc}function Gl(){if(sc)return lc;sc=1;var n=Ll();function e(e){var r={},o={},i=[];if(n.each(e.sinks(),(function a(u){if(n.has(o,u))throw new t;n.has(r,u)||(o[u]=!0,r[u]=!0,n.each(e.predecessors(u),a),delete o[u],i.push(u))})),n.size(r)!==e.nodeCount())throw new t;return i}function t(){}return lc=e,e.CycleException=t,t.prototype=new Error,lc}function Wl(){if(fc)return dc;fc=1;var n=Gl();return dc=function(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}}function ql(){if(vc)return hc;vc=1;var n=Ll();function e(t,r,o,i,a,u){n.has(i,r)||(i[r]=!0,o||u.push(r),n.each(a(r),(function(n){e(t,n,o,i,a,u)})),o&&u.push(r))}return hc=function(t,r,o){n.isArray(r)||(r=[r]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),a=[],u={};return n.each(r,(function(n){if(!t.hasNode(n))throw new Error("Graph does not have node: "+n);e(t,n,"post"===o,u,i,a)})),a},hc}function $l(){if(gc)return pc;gc=1;var n=ql();return pc=function(e,t){return n(e,t,"post")}}function Kl(){if(mc)return yc;mc=1;var n=ql();return yc=function(e,t){return n(e,t,"pre")}}function Ql(){if(bc)return wc;bc=1;var n=Ll(),e=Dl(),t=Hl();return wc=function(r,o){var i,a=new e,u={},c=new t;function l(n){var e=n.v===i?n.w:n.v,t=c.priority(e);if(void 0!==t){var r=o(n);r<t&&(u[e]=i,c.decrease(e,r))}}if(0===r.nodeCount())return a;n.each(r.nodes(),(function(n){c.add(n,Number.POSITIVE_INFINITY),a.setNode(n)})),c.decrease(r.nodes()[0],0);for(var s=!1;c.size()>0;){if(i=c.removeMin(),n.has(u,i))a.setEdge(i,u[i]);else{if(s)throw new Error("Input graph is not connected: "+r);s=!0}r.nodeEdges(i).forEach(l)}return a},wc}Nc.exports;try{kc=function(){if(Sc)return Ec;Sc=1;var n=Uu?Zu:(Uu=1,Zu={Graph:Dl(),version:Fu?Xu:(Fu=1,Xu="2.1.8")});return Ec={Graph:n.Graph,json:Rl(),alg:_c?xc:(_c=1,xc={components:Vl(),dijkstra:Yl(),dijkstraAll:Xl(),findCycles:Zl(),floydWarshall:Ul(),isAcyclic:Wl(),postorder:$l(),preorder:Kl(),prim:Ql(),tarjan:Fl(),topsort:Gl()}),version:n.version}}()}catch(H){}kc||(kc=window.graphlib);var Jl,ns,es,ts,rs,os,is,as,us,cs,ls,ss,ds,fs,hs,vs,ps,gs,ys,ms,ws,bs,xs,_s,Es,Ss,ks,Ns,Cs,Os,Ms,js,Ps,Is,As,zs,Ts,Bs,Ls,Ds,Rs,Vs,Hs,Ys,Xs,Fs,Zs,Us,Gs,Ws,qs,$s,Ks,Qs,Js,nd,ed,td,rd,od,id,ad,ud,cd,ld,sd,dd,fd,hd,vd,pd,gd,yd,md,wd,bd,xd,_d,Ed,Sd,kd,Nd,Cd,Od,Md,jd,Pd,Id,Ad,zd,Td,Bd,Ld,Dd=kc;function Rd(){if(ts)return es;ts=1;var n=Ue(),e=fr(),t=Mt(),r=Je();return es=function(o,i,a){if(!r(a))return!1;var u=typeof i;return!!("number"==u?e(a)&&t(i,a.length):"string"==u&&i in a)&&n(a[i],o)}}function Vd(){if(vs)return hs;vs=1;var n=function(){if(fs)return ds;fs=1;var n=function(){if(ss)return ls;ss=1;var n=function(){if(cs)return us;cs=1;var n=/\s/;return us=function(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}}(),e=/^\s+/;return ls=function(t){return t?t.slice(0,n(t)+1).replace(e,""):t}}(),e=Je(),t=cl(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;return ds=function(u){if("number"==typeof u)return u;if(t(u))return NaN;if(e(u)){var c="function"==typeof u.valueOf?u.valueOf():u;u=e(c)?c+"":c}if("string"!=typeof u)return 0===u?u:+u;u=n(u);var l=o.test(u);return l||i.test(u)?a(u.slice(2),l?2:8):r.test(u)?NaN:+u}}(),e=1/0;return hs=function(t){return t?(t=n(t))===e||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}}function Hd(){if(_s)return xs;_s=1;var n=Ol();return xs=function(e){return null!=e&&e.length?n(e,1):[]},xs}function Yd(){if(js)return Ms;js=1;var n=cl();return Ms=function(e,t,r){for(var o=-1,i=e.length;++o<i;){var a=e[o],u=t(a);if(null!=u&&(void 0===c?u==u&&!n(u):r(u,c)))var c=u,l=a}return l},Ms}function Xd(){if(Bs)return Ts;Bs=1;var n=st(),e=Ue();return Ts=function(t,r,o){(void 0!==o&&!e(t[r],o)||void 0===o&&!(r in t))&&n(t,r,o)}}function Fd(){return Vs?Rs:(Vs=1,Rs=function(n,e){if(("constructor"!==e||"function"!=typeof n[e])&&"__proto__"!=e)return n[e]})}function Zd(){return Qs?Ks:(Qs=1,Ks=function(n,e){return n<e})}function Ud(){if(Od)return Cd;Od=1;var n=sl(),e=vl(),t=ml(),r=El(),o=(_d||(_d=1,xd=function(n,e){var t=n.length;for(n.sort(e);t--;)n[t]=n[t].value;return n}),xd),i=Pt(),a=function(){if(Nd)return kd;Nd=1;var n=function(){if(Sd)return Ed;Sd=1;var n=cl();return Ed=function(e,t){if(e!==t){var r=void 0!==e,o=null===e,i=e==e,a=n(e),u=void 0!==t,c=null===t,l=t==t,s=n(t);if(!c&&!s&&!a&&e>t||a&&u&&l&&!c&&!s||o&&u&&l||!r&&l||!i)return 1;if(!o&&!a&&!s&&e<t||s&&r&&i&&!o&&!a||c&&r&&i||!u&&i||!l)return-1}return 0}}();return kd=function(e,t,r){for(var o=-1,i=e.criteria,a=t.criteria,u=i.length,c=r.length;++o<u;){var l=n(i[o],a[o]);if(l)return o>=c?l:l*("desc"==r[o]?-1:1)}return e.index-t.index}}(),u=$c(),c=pt();return Cd=function(l,s,d){s=s.length?n(s,(function(n){return c(n)?function(t){return e(t,1===n.length?n[0]:n)}:n})):[u];var f=-1;s=n(s,i(t));var h=r(l,(function(e,t,r){return{criteria:n(s,(function(n){return n(e)})),index:++f,value:e}}));return o(h,(function(n,e){return a(n,e,d)}))}}try{Ld={cloneDeep:function(){if(ns)return Jl;ns=1;var n=Fc();return Jl=function(e){return n(e,5)}}(),constant:Uc(),defaults:function(){if(os)return rs;os=1;var n=Pl(),e=Ue(),t=Rd(),r=vr(),o=Object.prototype,i=o.hasOwnProperty,a=n((function(n,a){n=Object(n);var u=-1,c=a.length,l=c>2?a[2]:void 0;for(l&&t(a[0],a[1],l)&&(c=1);++u<c;)for(var s=a[u],d=r(s),f=-1,h=d.length;++f<h;){var v=d[f],p=n[v];(void 0===p||e(p,o[v])&&!i.call(n,v))&&(n[v]=s[v])}return n}));return rs=a}(),each:Jc(),filter:wl(),find:function(){if(bs)return ws;bs=1;var n=function(){if(as)return is;as=1;var n=ml(),e=fr(),t=hr();return is=function(r){return function(o,i,a){var u=Object(o);if(!e(o)){var c=n(i,3);o=t(o),i=function(n){return c(u[n],n,u)}}var l=r(o,i,a);return l>-1?u[c?o[l]:l]:void 0}}}(),e=n(function(){if(ms)return ys;ms=1;var n=Il(),e=ml(),t=function(){if(gs)return ps;gs=1;var n=Vd();return ps=function(e){var t=n(e),r=t%1;return t==t?r?t-r:t:0}}(),r=Math.max;return ys=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)),n(o,e(i,3),c)},ys}());return ws=e}(),flatten:Hd(),forEach:Qc(),forIn:function(){if(Ss)return Es;Ss=1;var n=Gc(),e=Kc(),t=vr();return Es=function(r,o){return null==r?r:n(r,e(o),t)}}(),has:bl(),isUndefined:_l(),last:(Ns||(Ns=1,ks=function(n){var e=null==n?0:n.length;return e?n[e-1]:void 0}),ks),map:Sl(),mapValues:function(){if(Os)return Cs;Os=1;var n=st(),e=Wc(),t=ml();return Cs=function(r,o){var i={};return o=t(o,3),e(r,(function(e,t,r){n(i,t,o(e,t,r))})),i}}(),max:function(){if(zs)return As;zs=1;var n=Yd(),e=Is?Ps:(Is=1,Ps=function(n,e){return n>e}),t=$c();return As=function(r){return r&&r.length?n(r,t,e):void 0},As}(),merge:function(){if($s)return qs;$s=1;var n=function(){if(Us)return Zs;Us=1;var n=ut(),e=Xd(),t=Gc(),r=function(){if(Fs)return Xs;Fs=1;var n=Xd(),e=Cc(),t=Hc(),r=Oc(),o=Xc(),i=vt(),a=pt(),u=zl(),c=Ot(),l=nt(),s=Je(),d=function(){if(Ds)return Ls;Ds=1;var n=Qe(),e=Ac(),t=ht(),r=Function.prototype,o=Object.prototype,i=r.toString,a=o.hasOwnProperty,u=i.call(Object);return Ls=function(r){if(!t(r)||"[object Object]"!=n(r))return!1;var o=e(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=ur(),h=Fd(),v=function(){if(Ys)return Hs;Ys=1;var n=ft(),e=vr();return Hs=function(t){return n(t,e(t))}}();return Xs=function(p,g,y,m,w,b,x){var _=h(p,y),E=h(g,y),S=x.get(E);if(S)n(p,y,S);else{var k=b?b(_,E,y+"",p,g,x):void 0,N=void 0===k;if(N){var C=a(E),O=!C&&c(E),M=!C&&!O&&f(E);k=E,C||O||M?a(_)?k=_:u(_)?k=r(_):O?(N=!1,k=e(E,!0)):M?(N=!1,k=t(E,!0)):k=[]:d(E)||i(E)?(k=_,i(_)?k=v(_):s(_)&&!l(_)||(k=o(E))):N=!1}N&&(x.set(E,k),w(k,E,m,b,x),x.delete(E)),n(p,y,k)}}}(),o=Je(),i=vr(),a=Fd();return Zs=function u(c,l,s,d,f){c!==l&&t(l,(function(t,i){if(f||(f=new n),o(t))r(c,l,i,s,u,d,f);else{var h=d?d(a(c,i),t,i+"",c,l,f):void 0;void 0===h&&(h=t),e(c,i,h)}}),i)},Zs}(),e=function(){if(Ws)return Gs;Ws=1;var n=Pl(),e=Rd();return Gs=function(t){return n((function(n,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&&e(r[0],r[1],u)&&(a=i<3?void 0:a,i=1),n=Object(n);++o<i;){var c=r[o];c&&t(n,c,o,a)}return n}))}}()((function(e,t,r){n(e,t,r)}));return qs=e}(),min:function(){if(nd)return Js;nd=1;var n=Yd(),e=Zd(),t=$c();return Js=function(r){return r&&r.length?n(r,t,e):void 0},Js}(),minBy:function(){if(td)return ed;td=1;var n=Yd(),e=ml(),t=Zd();return ed=function(r,o){return r&&r.length?n(r,e(o,2),t):void 0},ed}(),now:function(){if(od)return rd;od=1;var n=$e();return rd=function(){return n.Date.now()}}(),pick:function(){if(vd)return hd;vd=1;var n=function(){if(sd)return ld;sd=1;var n=function(){if(cd)return ud;cd=1;var n=vl(),e=function(){if(ad)return id;ad=1;var n=dt(),e=fl(),t=Mt(),r=Je(),o=hl();return id=function(i,a,u,c){if(!r(i))return i;for(var l=-1,s=(a=e(a,i)).length,d=s-1,f=i;null!=f&&++l<s;){var h=o(a[l]),v=u;if("__proto__"===h||"constructor"===h||"prototype"===h)return i;if(l!=d){var p=f[h];void 0===(v=c?c(p,h,f):void 0)&&(v=r(p)?p:t(a[l+1])?[]:{})}n(f,h,v),f=f[h]}return i}}(),t=fl();return ud=function(r,o,i){for(var a=-1,u=o.length,c={};++a<u;){var l=o[a],s=n(r,l);i(s,l)&&e(c,t(l,r),s)}return c}}(),e=gl();return ld=function(t,r){return n(t,r,(function(n,r){return e(t,r)}))}}(),e=function(){if(fd)return dd;fd=1;var n=Hd(),e=Ml(),t=jl();return dd=function(r){return t(e(r,void 0,n),r+"")}}(),t=e((function(e,t){return null==e?{}:n(e,t)}));return hd=t}(),range:function(){if(bd)return wd;bd=1;var n=function(){if(md)return yd;md=1;var n=function(){if(gd)return pd;gd=1;var n=Math.ceil,e=Math.max;return pd=function(t,r,o,i){for(var a=-1,u=e(n((r-t)/(o||1)),0),c=Array(u);u--;)c[i?u:++a]=t,t+=o;return c},pd}(),e=Rd(),t=Vd();return yd=function(r){return function(o,i,a){return a&&"number"!=typeof a&&e(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),n(o,i,a,r)}},yd}()();return wd=n}(),reduce:kl(),sortBy:function(){if(jd)return Md;jd=1;var n=Ol(),e=Ud(),t=Pl(),r=Rd(),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]]),e(t,n(o,1),[])}));return Md=o}(),uniqueId:function(){if(Id)return Pd;Id=1;var n=dl(),e=0;return Pd=function(t){var r=++e;return n(t)+r},Pd}(),values:Bl(),zipObject:function(){if(Bd)return Td;Bd=1;var n=dt(),e=(zd||(zd=1,Ad=function(n,e,t){for(var r=-1,o=n.length,i=e.length,a={};++r<o;){var u=r<i?e[r]:void 0;t(a,n[r],u)}return a}),Ad);return Td=function(t,r){return e(t||[],r||[],n)},Td}()}}catch(H){}Ld||(Ld=window._);var Gd=Ld,Wd=qd;function qd(){var n={};n._next=n._prev=n,this._sentinel=n}function $d(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function Kd(n,e){if("_next"!==n&&"_prev"!==n)return e}qd.prototype.dequeue=function(){var n=this._sentinel,e=n._prev;if(e!==n)return $d(e),e},qd.prototype.enqueue=function(n){var e=this._sentinel;n._prev&&n._next&&$d(n),n._next=e._next,e._next._prev=n,e._next=n,n._prev=e},qd.prototype.toString=function(){for(var n=[],e=this._sentinel,t=e._prev;t!==e;)n.push(JSON.stringify(t,Kd)),t=t._prev;return"["+n.join(", ")+"]"};var Qd=Gd,Jd=Dd.Graph,nf=Wd,ef=Qd.constant(1);function tf(n,e,t,r,o){var i=o?[]:void 0;return Qd.forEach(n.inEdges(r.v),(function(r){var a=n.edge(r),u=n.node(r.v);o&&i.push({v:r.v,w:r.w}),u.out-=a,rf(e,t,u)})),Qd.forEach(n.outEdges(r.v),(function(r){var o=n.edge(r),i=r.w,a=n.node(i);a.in-=o,rf(e,t,a)})),n.removeNode(r.v),i}function rf(n,e,t){t.out?t.in?n[t.out-t.in+e].enqueue(t):n[n.length-1].enqueue(t):n[0].enqueue(t)}var of=Gd,af=function(n,e){if(n.nodeCount()<=1)return[];var t=function(n,e){var t=new Jd,r=0,o=0;Qd.forEach(n.nodes(),(function(n){t.setNode(n,{v:n,in:0,out:0})})),Qd.forEach(n.edges(),(function(n){var i=t.edge(n.v,n.w)||0,a=e(n),u=i+a;t.setEdge(n.v,n.w,u),o=Math.max(o,t.node(n.v).out+=a),r=Math.max(r,t.node(n.w).in+=a)}));var i=Qd.range(o+r+3).map((function(){return new nf})),a=r+1;return Qd.forEach(t.nodes(),(function(n){rf(i,a,t.node(n))})),{graph:t,buckets:i,zeroIdx:a}}(n,e||ef),r=function(n,e,t){for(var r,o=[],i=e[e.length-1],a=e[0];n.nodeCount();){for(;r=a.dequeue();)tf(n,e,t,r);for(;r=i.dequeue();)tf(n,e,t,r);if(n.nodeCount())for(var u=e.length-2;u>0;--u)if(r=e[u].dequeue()){o=o.concat(tf(n,e,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return Qd.flatten(Qd.map(r,(function(e){return n.outEdges(e.v,e.w)})),!0)},uf={run:function(n){var e="greedy"===n.graph().acyclicer?af(n,function(n){return function(e){return n.edge(e).weight}}(n)):function(n){var e=[],t={},r={};return of.forEach(n.nodes(),(function o(i){of.has(r,i)||(r[i]=!0,t[i]=!0,of.forEach(n.outEdges(i),(function(n){of.has(t,n.w)?e.push(n):o(n.w)})),delete t[i])})),e}(n);of.forEach(e,(function(e){var t=n.edge(e);n.removeEdge(e),t.forwardName=e.name,t.reversed=!0,n.setEdge(e.w,e.v,t,of.uniqueId("rev"))}))},undo:function(n){of.forEach(n.edges(),(function(e){var t=n.edge(e);if(t.reversed){n.removeEdge(e);var r=t.forwardName;delete t.reversed,delete t.forwardName,n.setEdge(e.w,e.v,t,r)}}))}},cf=Gd,lf=Dd.Graph,sf={addDummyNode:df,simplify:function(n){var e=(new lf).setGraph(n.graph());return cf.forEach(n.nodes(),(function(t){e.setNode(t,n.node(t))})),cf.forEach(n.edges(),(function(t){var r=e.edge(t.v,t.w)||{weight:0,minlen:1},o=n.edge(t);e.setEdge(t.v,t.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})})),e},asNonCompoundGraph:function(n){var e=new lf({multigraph:n.isMultigraph()}).setGraph(n.graph());return cf.forEach(n.nodes(),(function(t){n.children(t).length||e.setNode(t,n.node(t))})),cf.forEach(n.edges(),(function(t){e.setEdge(t,n.edge(t))})),e},successorWeights:function(n){var e=cf.map(n.nodes(),(function(e){var t={};return cf.forEach(n.outEdges(e),(function(e){t[e.w]=(t[e.w]||0)+n.edge(e).weight})),t}));return cf.zipObject(n.nodes(),e)},predecessorWeights:function(n){var e=cf.map(n.nodes(),(function(e){var t={};return cf.forEach(n.inEdges(e),(function(e){t[e.v]=(t[e.v]||0)+n.edge(e).weight})),t}));return cf.zipObject(n.nodes(),e)},intersectRect:function(n,e){var t,r,o=n.x,i=n.y,a=e.x-o,u=e.y-i,c=n.width/2,l=n.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)*l?(u<0&&(l=-l),t=l*a/u,r=l):(a<0&&(c=-c),t=c,r=c*u/a),{x:o+t,y:i+r}},buildLayerMatrix:function(n){var e=cf.map(cf.range(ff(n)+1),(function(){return[]}));return cf.forEach(n.nodes(),(function(t){var r=n.node(t),o=r.rank;cf.isUndefined(o)||(e[o][r.order]=t)})),e},normalizeRanks:function(n){var e=cf.min(cf.map(n.nodes(),(function(e){return n.node(e).rank})));cf.forEach(n.nodes(),(function(t){var r=n.node(t);cf.has(r,"rank")&&(r.rank-=e)}))},removeEmptyRanks:function(n){var e=cf.min(cf.map(n.nodes(),(function(e){return n.node(e).rank}))),t=[];cf.forEach(n.nodes(),(function(r){var o=n.node(r).rank-e;t[o]||(t[o]=[]),t[o].push(r)}));var r=0,o=n.graph().nodeRankFactor;cf.forEach(t,(function(e,t){cf.isUndefined(e)&&t%o!=0?--r:r&&cf.forEach(e,(function(e){n.node(e).rank+=r}))}))},addBorderNode:function(n,e,t,r){var o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=r),df(n,"border",o,e)},maxRank:ff,partition:function(n,e){var t={lhs:[],rhs:[]};return cf.forEach(n,(function(n){e(n)?t.lhs.push(n):t.rhs.push(n)})),t},time:function(n,e){var t=cf.now();try{return e()}finally{console.log(n+" time: "+(cf.now()-t)+"ms")}},notime:function(n,e){return e()}};function df(n,e,t,r){var o;do{o=cf.uniqueId(r)}while(n.hasNode(o));return t.dummy=e,n.setNode(o,t),o}function ff(n){return cf.max(cf.map(n.nodes(),(function(e){var t=n.node(e).rank;if(!cf.isUndefined(t))return t})))}var hf=Gd,vf=sf,pf={run:function(n){n.graph().dummyChains=[],hf.forEach(n.edges(),(function(e){!function(n,e){var t,r,o,i=e.v,a=n.node(i).rank,u=e.w,c=n.node(u).rank,l=e.name,s=n.edge(e),d=s.labelRank;if(c!==a+1){for(n.removeEdge(e),o=0,++a;a<c;++o,++a)s.points=[],r={width:0,height:0,edgeLabel:s,edgeObj:e,rank:a},t=vf.addDummyNode(n,"edge",r,"_d"),a===d&&(r.width=s.width,r.height=s.height,r.dummy="edge-label",r.labelpos=s.labelpos),n.setEdge(i,t,{weight:s.weight},l),0===o&&n.graph().dummyChains.push(t),i=t;n.setEdge(i,u,{weight:s.weight},l)}}(n,e)}))},undo:function(n){hf.forEach(n.graph().dummyChains,(function(e){var t,r=n.node(e),o=r.edgeLabel;for(n.setEdge(r.edgeObj,o);r.dummy;)t=n.successors(e)[0],n.removeNode(e),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),e=t,r=n.node(e)}))}},gf=Gd,yf=function(n){var e={};gf.forEach(n.sources(),(function t(r){var o=n.node(r);if(gf.has(e,r))return o.rank;e[r]=!0;var i=gf.min(gf.map(n.outEdges(r),(function(e){return t(e.w)-n.edge(e).minlen})));return i!==Number.POSITIVE_INFINITY&&null!=i||(i=0),o.rank=i}))},mf=function(n,e){return n.node(e.w).rank-n.node(e.v).rank-n.edge(e).minlen},wf=Gd,bf=Dd.Graph,xf=mf,_f=function(n){var e,t,r=new bf({directed:!1}),o=n.nodes()[0],i=n.nodeCount();for(r.setNode(o,{});Ef(r,n)<i;)e=Sf(r,n),t=r.hasNode(e.v)?xf(n,e):-xf(n,e),kf(r,n,t);return r};function Ef(n,e){return wf.forEach(n.nodes(),(function t(r){wf.forEach(e.nodeEdges(r),(function(o){var i=o.v,a=r===i?o.w:i;n.hasNode(a)||xf(e,o)||(n.setNode(a,{}),n.setEdge(r,a,{}),t(a))}))})),n.nodeCount()}function Sf(n,e){return wf.minBy(e.edges(),(function(t){if(n.hasNode(t.v)!==n.hasNode(t.w))return xf(e,t)}))}function kf(n,e,t){wf.forEach(n.nodes(),(function(n){e.node(n).rank+=t}))}var Nf=Gd,Cf=_f,Of=mf,Mf=yf,jf=Dd.alg.preorder,Pf=Dd.alg.postorder,If=sf.simplify,Af=zf;function zf(n){n=If(n),Mf(n);var e,t=Cf(n);for(Lf(t),Tf(t,n);e=Rf(t);)Hf(t,n,e,Vf(t,n,e))}function Tf(n,e){var t=Pf(n,n.nodes());t=t.slice(0,t.length-1),Nf.forEach(t,(function(t){!function(n,e,t){var r=n.node(t).parent;n.edge(t,r).cutvalue=Bf(n,e,t)}(n,e,t)}))}function Bf(n,e,t){var r=n.node(t).parent,o=!0,i=e.edge(t,r),a=0;return i||(o=!1,i=e.edge(r,t)),a=i.weight,Nf.forEach(e.nodeEdges(t),(function(i){var u,c,l=i.v===t,s=l?i.w:i.v;if(s!==r){var d=l===o,f=e.edge(i).weight;if(a+=d?f:-f,u=t,c=s,n.hasEdge(u,c)){var h=n.edge(t,s).cutvalue;a+=d?-h:h}}})),a}function Lf(n,e){arguments.length<2&&(e=n.nodes()[0]),Df(n,{},1,e)}function Df(n,e,t,r,o){var i=t,a=n.node(r);return e[r]=!0,Nf.forEach(n.neighbors(r),(function(o){Nf.has(e,o)||(t=Df(n,e,t,o,r))})),a.low=i,a.lim=t++,o?a.parent=o:delete a.parent,t}function Rf(n){return Nf.find(n.edges(),(function(e){return n.edge(e).cutvalue<0}))}function Vf(n,e,t){var r=t.v,o=t.w;e.hasEdge(r,o)||(r=t.w,o=t.v);var i=n.node(r),a=n.node(o),u=i,c=!1;i.lim>a.lim&&(u=a,c=!0);var l=Nf.filter(e.edges(),(function(e){return c===Yf(n,n.node(e.v),u)&&c!==Yf(n,n.node(e.w),u)}));return Nf.minBy(l,(function(n){return Of(e,n)}))}function Hf(n,e,t,r){var o=t.v,i=t.w;n.removeEdge(o,i),n.setEdge(r.v,r.w,{}),Lf(n),Tf(n,e),function(n,e){var t=Nf.find(n.nodes(),(function(n){return!e.node(n).parent})),r=jf(n,t);r=r.slice(1),Nf.forEach(r,(function(t){var r=n.node(t).parent,o=e.edge(t,r),i=!1;o||(o=e.edge(r,t),i=!0),e.node(t).rank=e.node(r).rank+(i?o.minlen:-o.minlen)}))}(n,e)}function Yf(n,e,t){return t.low<=e.lim&&e.lim<=t.lim}zf.initLowLimValues=Lf,zf.initCutValues=Tf,zf.calcCutValue=Bf,zf.leaveEdge=Rf,zf.enterEdge=Vf,zf.exchangeEdges=Hf;var Xf=yf,Ff=_f,Zf=Af,Uf=Xf;var Gf=Gd,Wf=Gd,qf=sf,$f={run:function(n){var e=qf.addDummyNode(n,"root",{},"_root"),t=function(n){var e={};function t(r,o){var i=n.children(r);i&&i.length&&Wf.forEach(i,(function(n){t(n,o+1)})),e[r]=o}return Wf.forEach(n.children(),(function(n){t(n,1)})),e}(n),r=Wf.max(Wf.values(t))-1,o=2*r+1;n.graph().nestingRoot=e,Wf.forEach(n.edges(),(function(e){n.edge(e).minlen*=o}));var i=function(n){return Wf.reduce(n.edges(),(function(e,t){return e+n.edge(t).weight}),0)}(n)+1;Wf.forEach(n.children(),(function(a){Kf(n,e,o,i,r,t,a)})),n.graph().nodeRankFactor=o},cleanup:function(n){var e=n.graph();n.removeNode(e.nestingRoot),delete e.nestingRoot,Wf.forEach(n.edges(),(function(e){n.edge(e).nestingEdge&&n.removeEdge(e)}))}};function Kf(n,e,t,r,o,i,a){var u=n.children(a);if(u.length){var c=qf.addBorderNode(n,"_bt"),l=qf.addBorderNode(n,"_bb"),s=n.node(a);n.setParent(c,a),s.borderTop=c,n.setParent(l,a),s.borderBottom=l,Wf.forEach(u,(function(u){Kf(n,e,t,r,o,i,u);var s=n.node(u),d=s.borderTop?s.borderTop:u,f=s.borderBottom?s.borderBottom:u,h=s.borderTop?r:2*r,v=d!==f?1:o-i[a]+1;n.setEdge(c,d,{weight:h,minlen:v,nestingEdge:!0}),n.setEdge(f,l,{weight:h,minlen:v,nestingEdge:!0})})),n.parent(a)||n.setEdge(e,c,{weight:0,minlen:o+i[a]})}else a!==e&&n.setEdge(e,a,{weight:0,minlen:t})}var Qf=Gd,Jf=sf;function nh(n,e,t,r,o,i){var a={width:0,height:0,rank:i,borderType:e},u=o[e][i-1],c=Jf.addDummyNode(n,"border",a,t);o[e][i]=c,n.setParent(c,r),u&&n.setEdge(u,c,{weight:1})}var eh=Gd,th={adjust:function(n){var e=n.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||rh(n)},undo:function(n){var e=n.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(n){eh.forEach(n.nodes(),(function(e){ih(n.node(e))})),eh.forEach(n.edges(),(function(e){var t=n.edge(e);eh.forEach(t.points,ih),eh.has(t,"y")&&ih(t)}))}(n),"lr"!==e&&"rl"!==e||(function(n){eh.forEach(n.nodes(),(function(e){ah(n.node(e))})),eh.forEach(n.edges(),(function(e){var t=n.edge(e);eh.forEach(t.points,ah),eh.has(t,"x")&&ah(t)}))}(n),rh(n))}};function rh(n){eh.forEach(n.nodes(),(function(e){oh(n.node(e))})),eh.forEach(n.edges(),(function(e){oh(n.edge(e))}))}function oh(n){var e=n.width;n.width=n.height,n.height=e}function ih(n){n.y=-n.y}function ah(n){var e=n.x;n.x=n.y,n.y=e}var uh=Gd,ch=Gd;function lh(n,e,t){for(var r=ch.zipObject(t,ch.map(t,(function(n,e){return e}))),o=ch.flatten(ch.map(e,(function(e){return ch.sortBy(ch.map(n.outEdges(e),(function(e){return{pos:r[e.w],weight:n.edge(e).weight}})),"pos")})),!0),i=1;i<t.length;)i<<=1;var a=2*i-1;i-=1;var u=ch.map(new Array(a),(function(){return 0})),c=0;return ch.forEach(o.forEach((function(n){var e=n.pos+i;u[e]+=n.weight;for(var t=0;e>0;)e%2&&(t+=u[e+1]),u[e=e-1>>1]+=n.weight;c+=n.weight*t}))),c}var sh=Gd,dh=Gd,fh=Gd,hh=sf;function vh(n,e,t){for(var r;e.length&&(r=fh.last(e)).i<=t;)e.pop(),n.push(r.vs),t++;return t}var ph=Gd,gh=Gd,yh=Dd.Graph,mh=Gd,wh=Gd,bh=function(n){var e={},t=uh.filter(n.nodes(),(function(e){return!n.children(e).length})),r=uh.max(uh.map(t,(function(e){return n.node(e).rank}))),o=uh.map(uh.range(r+1),(function(){return[]}));var i=uh.sortBy(t,(function(e){return n.node(e).rank}));return uh.forEach(i,(function t(r){if(!uh.has(e,r)){e[r]=!0;var i=n.node(r);o[i.rank].push(r),uh.forEach(n.successors(r),t)}})),o},xh=function(n,e){for(var t=0,r=1;r<e.length;++r)t+=lh(n,e[r-1],e[r]);return t},_h=function n(e,t,r,o){var i=e.children(t),a=e.node(t),u=a?a.borderLeft:void 0,c=a?a.borderRight:void 0,l={};u&&(i=ph.filter(i,(function(n){return n!==u&&n!==c})));var s=function(n,e){return sh.map(e,(function(e){var t=n.inEdges(e);if(t.length){var r=sh.reduce(t,(function(e,t){var r=n.edge(t),o=n.node(t.v);return{sum:e.sum+r.weight*o.order,weight:e.weight+r.weight}}),{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}}return{v:e}}))}(e,i);ph.forEach(s,(function(t){if(e.children(t.v).length){var i=n(e,t.v,r,o);l[t.v]=i,ph.has(i,"barycenter")&&(a=t,u=i,ph.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(n,e){var t={};return dh.forEach(n,(function(n,e){var r=t[n.v]={indegree:0,in:[],out:[],vs:[n.v],i:e};dh.isUndefined(n.barycenter)||(r.barycenter=n.barycenter,r.weight=n.weight)})),dh.forEach(e.edges(),(function(n){var e=t[n.v],r=t[n.w];dh.isUndefined(e)||dh.isUndefined(r)||(r.indegree++,e.out.push(t[n.w]))})),function(n){var e=[];function t(n){return function(e){e.merged||(dh.isUndefined(e.barycenter)||dh.isUndefined(n.barycenter)||e.barycenter>=n.barycenter)&&function(n,e){var t=0,r=0;n.weight&&(t+=n.barycenter*n.weight,r+=n.weight),e.weight&&(t+=e.barycenter*e.weight,r+=e.weight),n.vs=e.vs.concat(n.vs),n.barycenter=t/r,n.weight=r,n.i=Math.min(e.i,n.i),e.merged=!0}(n,e)}}function r(e){return function(t){t.in.push(e),0==--t.indegree&&n.push(t)}}for(;n.length;){var o=n.pop();e.push(o),dh.forEach(o.in.reverse(),t(o)),dh.forEach(o.out,r(o))}return dh.map(dh.filter(e,(function(n){return!n.merged})),(function(n){return dh.pick(n,["vs","i","barycenter","weight"])}))}(dh.filter(t,(function(n){return!n.indegree})))}(s,r);!function(n,e){ph.forEach(n,(function(n){n.vs=ph.flatten(n.vs.map((function(n){return e[n]?e[n].vs:n})),!0)}))}(d,l);var f=function(n,e){var t,r=hh.partition(n,(function(n){return fh.has(n,"barycenter")})),o=r.lhs,i=fh.sortBy(r.rhs,(function(n){return-n.i})),a=[],u=0,c=0,l=0;o.sort((t=!!e,function(n,e){return n.barycenter<e.barycenter?-1:n.barycenter>e.barycenter?1:t?e.i-n.i:n.i-e.i})),l=vh(a,i,l),fh.forEach(o,(function(n){l+=n.vs.length,a.push(n.vs),u+=n.barycenter*n.weight,c+=n.weight,l=vh(a,i,l)}));var s={vs:fh.flatten(a,!0)};return c&&(s.barycenter=u/c,s.weight=c),s}(d,o);if(u&&(f.vs=ph.flatten([u,f.vs,c],!0),e.predecessors(u).length)){var h=e.node(e.predecessors(u)[0]),v=e.node(e.predecessors(c)[0]);ph.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},Eh=function(n,e,t){var r=function(n){for(var e;n.hasNode(e=gh.uniqueId("_root")););return e}(n),o=new yh({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(e){return n.node(e)}));return gh.forEach(n.nodes(),(function(i){var a=n.node(i),u=n.parent(i);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(o.setNode(i),o.setParent(i,u||r),gh.forEach(n[t](i),(function(e){var t=e.v===i?e.w:e.v,r=o.edge(t,i),a=gh.isUndefined(r)?0:r.weight;o.setEdge(t,i,{weight:n.edge(e).weight+a})})),gh.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),o},Sh=Dd.Graph,kh=sf;function Nh(n,e,t){return wh.map(e,(function(e){return Eh(n,e,t)}))}function Ch(n,e){var t=new Sh;wh.forEach(n,(function(n){var r=n.graph().root,o=_h(n,r,t,e);wh.forEach(o.vs,(function(e,t){n.node(e).order=t})),function(n,e,t){var r,o={};mh.forEach(t,(function(t){for(var i,a,u=n.parent(t);u;){if((i=n.parent(u))?(a=o[i],o[i]=u):(a=r,r=u),a&&a!==u)return void e.setEdge(a,u);u=i}}))}(n,t,o.vs)}))}function Oh(n,e){wh.forEach(e,(function(e){wh.forEach(e,(function(e,t){n.node(e).order=t}))}))}var Mh=Gd,jh=Dd.Graph,Ph=sf;function Ih(n,e,t){if(e>t){var r=e;e=t,t=r}var o=n[e];o||(n[e]=o={}),o[t]=!0}function Ah(n,e,t){if(e>t){var r=e;e=t,t=r}return Mh.has(n[e],t)}var zh=Gd,Th=sf,Bh=function(n){var e,t=Ph.buildLayerMatrix(n),r=Mh.merge(function(n,e){var t={};return Mh.reduce(e,(function(e,r){var o=0,i=0,a=e.length,u=Mh.last(r);return Mh.forEach(r,(function(e,c){var l=function(n,e){if(n.node(e).dummy)return Mh.find(n.predecessors(e),(function(e){return n.node(e).dummy}))}(n,e),s=l?n.node(l).order:a;(l||e===u)&&(Mh.forEach(r.slice(i,c+1),(function(e){Mh.forEach(n.predecessors(e),(function(r){var i=n.node(r),a=i.order;!(a<o||s<a)||i.dummy&&n.node(e).dummy||Ih(t,r,e)}))})),i=c+1,o=s)})),r})),t}(n,t),function(n,e){var t={};function r(e,r,o,i,a){var u;Mh.forEach(Mh.range(r,o),(function(r){u=e[r],n.node(u).dummy&&Mh.forEach(n.predecessors(u),(function(e){var r=n.node(e);r.dummy&&(r.order<i||r.order>a)&&Ih(t,e,u)}))}))}return Mh.reduce(e,(function(e,t){var o,i=-1,a=0;return Mh.forEach(t,(function(u,c){if("border"===n.node(u).dummy){var l=n.predecessors(u);l.length&&(o=n.node(l[0]).order,r(t,a,c,i,o),a=c,i=o)}r(t,a,t.length,o,e.length)})),t})),t}(n,t)),o={};Mh.forEach(["u","d"],(function(i){e="u"===i?t:Mh.values(t).reverse(),Mh.forEach(["l","r"],(function(t){"r"===t&&(e=Mh.map(e,(function(n){return Mh.values(n).reverse()})));var a=("u"===i?n.predecessors:n.successors).bind(n),u=function(n,e,t,r){var o={},i={},a={};return Mh.forEach(e,(function(n){Mh.forEach(n,(function(n,e){o[n]=n,i[n]=n,a[n]=e}))})),Mh.forEach(e,(function(n){var e=-1;Mh.forEach(n,(function(n){var u=r(n);if(u.length){u=Mh.sortBy(u,(function(n){return a[n]}));for(var c=(u.length-1)/2,l=Math.floor(c),s=Math.ceil(c);l<=s;++l){var d=u[l];i[n]===n&&e<a[d]&&!Ah(t,n,d)&&(i[d]=n,i[n]=o[n]=o[d],e=a[d])}}}))})),{root:o,align:i}}(0,e,r,a),c=function(n,e,t,r,o){var i={},a=function(n,e,t,r){var o=new jh,i=n.graph(),a=function(n,e,t){return function(r,o,i){var a,u=r.node(o),c=r.node(i),l=0;if(l+=u.width/2,Mh.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(l+=t?a:-a),a=0,l+=(u.dummy?e:n)/2,l+=(c.dummy?e:n)/2,l+=c.width/2,Mh.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(l+=t?a:-a),a=0,l}}(i.nodesep,i.edgesep,r);return Mh.forEach(e,(function(e){var r;Mh.forEach(e,(function(e){var i=t[e];if(o.setNode(i),r){var u=t[r],c=o.edge(u,i);o.setEdge(u,i,Math.max(a(n,e,r),c||0))}r=e}))})),o}(n,e,t,o),u=o?"borderLeft":"borderRight";function c(n,e){for(var t=a.nodes(),r=t.pop(),o={};r;)o[r]?n(r):(o[r]=!0,t.push(r),t=t.concat(e(r))),r=t.pop()}return c((function(n){i[n]=a.inEdges(n).reduce((function(n,e){return Math.max(n,i[e.v]+a.edge(e))}),0)}),a.predecessors.bind(a)),c((function(e){var t=a.outEdges(e).reduce((function(n,e){return Math.min(n,i[e.w]-a.edge(e))}),Number.POSITIVE_INFINITY),r=n.node(e);t!==Number.POSITIVE_INFINITY&&r.borderType!==u&&(i[e]=Math.max(i[e],t))}),a.successors.bind(a)),Mh.forEach(r,(function(n){i[n]=i[t[n]]})),i}(n,e,u.root,u.align,"r"===t);"r"===t&&(c=Mh.mapValues(c,(function(n){return-n}))),o[i+t]=c}))}));var i=function(n,e){return Mh.minBy(Mh.values(e),(function(e){var t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return Mh.forIn(e,(function(e,o){var i=function(n,e){return n.node(e).width}(n,o)/2;t=Math.max(e+i,t),r=Math.min(e-i,r)})),t-r}))}(n,o);return function(n,e){var t=Mh.values(e),r=Mh.min(t),o=Mh.max(t);Mh.forEach(["u","d"],(function(t){Mh.forEach(["l","r"],(function(i){var a,u=t+i,c=n[u];if(c!==e){var l=Mh.values(c);(a="l"===i?r-Mh.min(l):o-Mh.max(l))&&(n[u]=Mh.mapValues(c,(function(n){return n+a})))}}))}))}(o,i),function(n,e){return Mh.mapValues(n.ul,(function(t,r){if(e)return n[e.toLowerCase()][r];var o=Mh.sortBy(Mh.map(n,r));return(o[1]+o[2])/2}))}(o,n.graph().align)},Lh=Gd,Dh=uf,Rh=pf,Vh=function(n){switch(n.graph().ranker){case"network-simplex":default:!function(n){Zf(n)}(n);break;case"tight-tree":!function(n){Xf(n),Ff(n)}(n);break;case"longest-path":Uf(n)}},Hh=sf.normalizeRanks,Yh=function(n){var e=function(n){var e={},t=0;return Gf.forEach(n.children(),(function r(o){var i=t;Gf.forEach(n.children(o),r),e[o]={low:i,lim:t++}})),e}(n);Gf.forEach(n.graph().dummyChains,(function(t){for(var r=n.node(t),o=r.edgeObj,i=function(n,e,t,r){var o,i,a=[],u=[],c=Math.min(e[t].low,e[r].low),l=Math.max(e[t].lim,e[r].lim);o=t;do{o=n.parent(o),a.push(o)}while(o&&(e[o].low>c||l>e[o].lim));for(i=o,o=r;(o=n.parent(o))!==i;)u.push(o);return{path:a.concat(u.reverse()),lca:i}}(n,e,o.v,o.w),a=i.path,u=i.lca,c=0,l=a[c],s=!0;t!==o.w;){if(r=n.node(t),s){for(;(l=a[c])!==u&&n.node(l).maxRank<r.rank;)c++;l===u&&(s=!1)}if(!s){for(;c<a.length-1&&n.node(l=a[c+1]).minRank<=r.rank;)c++;l=a[c]}n.setParent(t,l),t=n.successors(t)[0]}}))},Xh=sf.removeEmptyRanks,Fh=$f,Zh=function(n){Qf.forEach(n.children(),(function e(t){var r=n.children(t),o=n.node(t);if(r.length&&Qf.forEach(r,e),Qf.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)nh(n,"borderLeft","_bl",t,o,i),nh(n,"borderRight","_br",t,o,i)}}))},Uh=th,Gh=function(n){var e=kh.maxRank(n),t=Nh(n,wh.range(1,e+1),"inEdges"),r=Nh(n,wh.range(e-1,-1,-1),"outEdges"),o=bh(n);Oh(n,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){Ch(u%2?t:r,u%4>=2),o=kh.buildLayerMatrix(n);var l=xh(n,o);l<a&&(c=0,i=wh.cloneDeep(o),a=l)}Oh(n,i)},Wh=function(n){(function(n){var e=Th.buildLayerMatrix(n),t=n.graph().ranksep,r=0;zh.forEach(e,(function(e){var o=zh.max(zh.map(e,(function(e){return n.node(e).height})));zh.forEach(e,(function(e){n.node(e).y=r+o/2})),r+=o+t}))})(n=Th.asNonCompoundGraph(n)),zh.forEach(Bh(n),(function(e,t){n.node(t).x=e}))},qh=sf,$h=Dd.Graph,Kh=["nodesep","edgesep","ranksep","marginx","marginy"],Qh={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Jh=["acyclicer","ranker","rankdir","align"],nv=["width","height"],ev={width:0,height:0},tv=["minlen","weight","width","height","labeloffset"],rv={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},ov=["labelpos"];function iv(n,e){return Lh.mapValues(Lh.pick(n,e),Number)}function av(n){var e={};return Lh.forEach(n,(function(n,t){e[t.toLowerCase()]=n})),e}var uv=Gd,cv=sf,lv=Dd.Graph,sv={debugOrdering:function(n){var e=cv.buildLayerMatrix(n),t=new lv({compound:!0,multigraph:!0}).setGraph({});return uv.forEach(n.nodes(),(function(e){t.setNode(e,{label:e}),t.setParent(e,"layer"+n.node(e).rank)})),uv.forEach(n.edges(),(function(n){t.setEdge(n.v,n.w,{},n.name)})),uv.forEach(e,(function(n,e){var r="layer"+e;t.setNode(r,{rank:"same"}),uv.reduce(n,(function(n,e){return t.setEdge(n,e,{style:"invis"}),e}))})),t}},dv=Ze({graphlib:Dd,layout:function(n,e){var t=e&&e.debugTiming?qh.time:qh.notime;t("layout",(function(){var e=t(" buildLayoutGraph",(function(){return function(n){var e=new $h({multigraph:!0,compound:!0}),t=av(n.graph());return e.setGraph(Lh.merge({},Qh,iv(t,Kh),Lh.pick(t,Jh))),Lh.forEach(n.nodes(),(function(t){var r=av(n.node(t));e.setNode(t,Lh.defaults(iv(r,nv),ev)),e.setParent(t,n.parent(t))})),Lh.forEach(n.edges(),(function(t){var r=av(n.edge(t));e.setEdge(t,Lh.merge({},rv,iv(r,tv),Lh.pick(r,ov)))})),e}(n)}));t(" runLayout",(function(){!function(n,e){e(" makeSpaceForEdgeLabels",(function(){!function(n){var e=n.graph();e.ranksep/=2,Lh.forEach(n.edges(),(function(t){var r=n.edge(t);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(n)})),e(" removeSelfEdges",(function(){!function(n){Lh.forEach(n.edges(),(function(e){if(e.v===e.w){var t=n.node(e.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:e,label:n.edge(e)}),n.removeEdge(e)}}))}(n)})),e(" acyclic",(function(){Dh.run(n)})),e(" nestingGraph.run",(function(){Fh.run(n)})),e(" rank",(function(){Vh(qh.asNonCompoundGraph(n))})),e(" injectEdgeLabelProxies",(function(){!function(n){Lh.forEach(n.edges(),(function(e){var t=n.edge(e);if(t.width&&t.height){var r=n.node(e.v),o={rank:(n.node(e.w).rank-r.rank)/2+r.rank,e:e};qh.addDummyNode(n,"edge-proxy",o,"_ep")}}))}(n)})),e(" removeEmptyRanks",(function(){Xh(n)})),e(" nestingGraph.cleanup",(function(){Fh.cleanup(n)})),e(" normalizeRanks",(function(){Hh(n)})),e(" assignRankMinMax",(function(){!function(n){var e=0;Lh.forEach(n.nodes(),(function(t){var r=n.node(t);r.borderTop&&(r.minRank=n.node(r.borderTop).rank,r.maxRank=n.node(r.borderBottom).rank,e=Lh.max(e,r.maxRank))})),n.graph().maxRank=e}(n)})),e(" removeEdgeLabelProxies",(function(){!function(n){Lh.forEach(n.nodes(),(function(e){var t=n.node(e);"edge-proxy"===t.dummy&&(n.edge(t.e).labelRank=t.rank,n.removeNode(e))}))}(n)})),e(" normalize.run",(function(){Rh.run(n)})),e(" parentDummyChains",(function(){Yh(n)})),e(" addBorderSegments",(function(){Zh(n)})),e(" order",(function(){Gh(n)})),e(" insertSelfEdges",(function(){!function(n){var e=qh.buildLayerMatrix(n);Lh.forEach(e,(function(e){var t=0;Lh.forEach(e,(function(e,r){var o=n.node(e);o.order=r+t,Lh.forEach(o.selfEdges,(function(e){qh.addDummyNode(n,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:r+ ++t,e:e.e,label:e.label},"_se")})),delete o.selfEdges}))}))}(n)})),e(" adjustCoordinateSystem",(function(){Uh.adjust(n)})),e(" position",(function(){Wh(n)})),e(" positionSelfEdges",(function(){!function(n){Lh.forEach(n.nodes(),(function(e){var t=n.node(e);if("selfedge"===t.dummy){var r=n.node(t.e.v),o=r.x+r.width/2,i=r.y,a=t.x-o,u=r.height/2;n.setEdge(t.e,t.label),n.removeNode(e),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}}))}(n)})),e(" removeBorderNodes",(function(){!function(n){Lh.forEach(n.nodes(),(function(e){if(n.children(e).length){var t=n.node(e),r=n.node(t.borderTop),o=n.node(t.borderBottom),i=n.node(Lh.last(t.borderLeft)),a=n.node(Lh.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}})),Lh.forEach(n.nodes(),(function(e){"border"===n.node(e).dummy&&n.removeNode(e)}))}(n)})),e(" normalize.undo",(function(){Rh.undo(n)})),e(" fixupEdgeLabelCoords",(function(){!function(n){Lh.forEach(n.edges(),(function(e){var t=n.edge(e);if(Lh.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}}))}(n)})),e(" undoCoordinateSystem",(function(){Uh.undo(n)})),e(" translateGraph",(function(){!function(n){var e=Number.POSITIVE_INFINITY,t=0,r=Number.POSITIVE_INFINITY,o=0,i=n.graph(),a=i.marginx||0,u=i.marginy||0;function c(n){var i=n.x,a=n.y,u=n.width,c=n.height;e=Math.min(e,i-u/2),t=Math.max(t,i+u/2),r=Math.min(r,a-c/2),o=Math.max(o,a+c/2)}Lh.forEach(n.nodes(),(function(e){c(n.node(e))})),Lh.forEach(n.edges(),(function(e){var t=n.edge(e);Lh.has(t,"x")&&c(t)})),e-=a,r-=u,Lh.forEach(n.nodes(),(function(t){var o=n.node(t);o.x-=e,o.y-=r})),Lh.forEach(n.edges(),(function(t){var o=n.edge(t);Lh.forEach(o.points,(function(n){n.x-=e,n.y-=r})),Lh.has(o,"x")&&(o.x-=e),Lh.has(o,"y")&&(o.y-=r)})),i.width=t-e+a,i.height=o-r+u}(n)})),e(" assignNodeIntersects",(function(){!function(n){Lh.forEach(n.edges(),(function(e){var t,r,o=n.edge(e),i=n.node(e.v),a=n.node(e.w);o.points?(t=o.points[0],r=o.points[o.points.length-1]):(o.points=[],t=a,r=i),o.points.unshift(qh.intersectRect(i,t)),o.points.push(qh.intersectRect(a,r))}))}(n)})),e(" reversePoints",(function(){!function(n){Lh.forEach(n.edges(),(function(e){var t=n.edge(e);t.reversed&&t.points.reverse()}))}(n)})),e(" acyclic.undo",(function(){Dh.undo(n)}))}(e,t)})),t(" updateInputGraph",(function(){!function(n,e){Lh.forEach(n.nodes(),(function(t){var r=n.node(t),o=e.node(t);r&&(r.x=o.x,r.y=o.y,e.children(t).length&&(r.width=o.width,r.height=o.height))})),Lh.forEach(n.edges(),(function(t){var r=n.edge(t),o=e.edge(t);r.points=o.points,Lh.has(o,"x")&&(r.x=o.x,r.y=o.y)})),n.graph().width=e.graph().width,n.graph().height=e.graph().height}(n,e)}))}))},debug:sv,util:{time:sf.time,notime:sf.notime},version:"0.8.5"});function fv(n,e,t){void 0===t&&(t={rankdir:"TB"});var r=t.rankdir,o=new dv.graphlib.Graph;return o.setDefaultEdgeLabel((function(){return{}})),o.setGraph({rankdir:r}),n.forEach((function(n){var e,t;if(!n.id)throw new Error('Node "id" does not exist');var r=(null===(e=n.data)||void 0===e?void 0:e.width)||200,i=(null===(t=n.data)||void 0===t?void 0:t.height)||56;o.setNode(n.id,{width:r,height:i})})),e.forEach((function(n){o.setEdge(n.source,n.target)})),dv.layout(o),n.forEach((function(n){var e=o.node(n.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"}n.targetPosition=i,n.sourcePosition=t,n.position={x:e.x-e.width/2,y:e.y-e.height/2}})),{nodes:n,edges:e}}var hv=function(n){return null!==n&&"function"!=typeof n&&isFinite(n.length)},vv=function(n,e){return!!hv(n)&&n.indexOf(e)>-1},pv=function(n,e){if(!hv(n))return n;for(var t=[],r=0;r<n.length;r++){var o=n[r];e(o,r)&&t.push(o)}return t},gv={}.toString,yv=function(n,e){return gv.call(n)==="[object "+e+"]"},mv=function(n){return yv(n,"Function")},wv=function(n){return null==n},bv=function(n){return Array.isArray?Array.isArray(n):yv(n,"Array")},xv=function(n){var e=typeof n;return null!==n&&"object"===e||"function"===e};function _v(n,e){if(n)if(bv(n))for(var t=0,r=n.length;t<r&&!1!==e(n[t],t);t++);else if(xv(n))for(var o in n)if(n.hasOwnProperty(o)&&!1===e(n[o],o))break}var Ev=Object.keys?function(n){return Object.keys(n)}:function(n){var e=[];return _v(n,(function(t,r){mv(n)&&"prototype"===r||e.push(r)})),e};function Sv(n,e){var t=Ev(e),r=t.length;if(wv(n))return!r;for(var o=0;o<r;o+=1){var i=t[o];if(e[i]!==n[i]||!(i in n))return!1}return!0}var kv=function(n){return"object"==typeof n&&null!==n},Nv=function(n){if(!kv(n)||!yv(n,"Object"))return!1;if(null===Object.getPrototypeOf(n))return!0;for(var e=n;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(n)===e},Cv=function(n,e){if(void 0===e&&(e=[]),bv(n))for(var t=0;t<n.length;t+=1)Cv(n[t],e);else e.push(n);return e},Ov=function(n){if(bv(n))return n.reduce((function(n,e){return Math.max(n,e)}),n[0])},Mv=function(n){if(bv(n))return n.reduce((function(n,e){return Math.min(n,e)}),n[0])},jv=Array.prototype,Pv=jv.splice,Iv=jv.indexOf,Av=Array.prototype.splice,zv=function(n,e){if(!hv(n))return[];for(var t=n?e.length:0,r=t-1;t--;){var o=void 0,i=e[t];t!==r&&i===o||(o=i,Av.call(n,i,1))}return n},Tv=function(n,e,t){if(!bv(n)&&!Nv(n))return n;var r=t;return _v(n,(function(n,t){r=e(r,n,t)})),r},Bv=function(n){return yv(n,"String")};function Lv(n,e){void 0===e&&(e=new Map);var t=[];if(Array.isArray(n))for(var r=0,o=n.length;r<o;r++){var i=n[r];e.has(i)||(t.push(i),e.set(i,!0))}return t}var Dv=Object.prototype.hasOwnProperty;function Rv(n,e){if(!e||!bv(n))return{};for(var t,r={},o=mv(e)?e:function(n){return n[e]},i=0;i<n.length;i++){var a=n[i];t=o(a),Dv.call(r,t)?r[t].push(a):r[t]=[a]}return r}function Vv(n,e){if(!e)return{0:n};if(!mv(e)){var t=bv(e)?e:e.replace(/\s+/g,"").split("*");e=function(n){for(var e="_",r=0,o=t.length;r<o;r++)e+=n[t[r]]&&n[t[r]].toString();return e}}return Rv(n,e)}var Hv={},Yv=function(n){return yv(n,"Number")},Xv=Number.isInteger?Number.isInteger:function(n){return Yv(n)&&n%1==0},Fv=180/Math.PI,Zv=parseInt,Uv=Math.PI/180,Gv=function(n,e){return n.hasOwnProperty(e)},Wv=Object.values?function(n){return Object.values(n)}:function(n){var e=[];return _v(n,(function(t,r){mv(n)&&"prototype"===r||e.push(t)})),e},qv=function(n){return wv(n)?"":n.toString()},$v={}.toString,Kv=function(n){return $v.call(n).replace(/^\[object /,"").replace(/]$/,"")},Qv=Object.prototype,Jv=function(n){var e=n&&n.constructor;return n===("function"==typeof e&&e.prototype||Qv)};function np(n,e){for(var t in e)e.hasOwnProperty(t)&&"constructor"!==t&&void 0!==e[t]&&(n[t]=e[t])}function ep(n,e,t,r){return e&&np(n,e),t&&np(n,t),r&&np(n,r),n}var tp=function(n){if("object"!=typeof n||null===n)return n;var e;if(bv(n)){e=[];for(var t=0,r=n.length;t<r;t++)"object"==typeof n[t]&&null!=n[t]?e[t]=tp(n[t]):e[t]=n[t]}else for(var o in e={},n)"object"==typeof n[o]&&null!=n[o]?e[o]=tp(n[o]):e[o]=n[o];return e},rp=function(n,e){if(!mv(n))throw new TypeError("Expected a function");var t=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=e?e.apply(this,r):r[0],a=t.cache;if(a.has(i))return a.get(i);var u=n.apply(this,r);return a.set(i,u),u};return t.cache=new Map,t};function op(n,e,t,r){for(var o in t=t||0,r=r||5,e)if(e.hasOwnProperty(o)){var i=e[o];null!==i&&Nv(i)?(Nv(n[o])||(n[o]={}),t<r?op(n[o],i,t+1,r):n[o]=e[o]):bv(i)?(n[o]=[],n[o]=n[o].concat(i)):void 0!==i&&(n[o]=i)}}var ip,ap=Object.prototype.hasOwnProperty,up=function(n,e){if(n===e)return!0;if(!n||!e)return!1;if(Bv(n)||Bv(e))return!1;if(hv(n)||hv(e)){if(n.length!==e.length)return!1;for(var t=!0,r=0;r<n.length&&(t=up(n[r],e[r]));r++);return t}if(kv(n)||kv(e)){var o=Object.keys(n),i=Object.keys(e);if(o.length!==i.length)return!1;for(t=!0,r=0;r<o.length&&(t=up(n[o[r]],e[o[r]]));r++);return t}return!1},cp=function(n){return n},lp=Object.prototype.hasOwnProperty,sp={},dp=function(){return dp=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},dp.apply(this,arguments)};function fp(n){var e="function"==typeof Symbol&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&"number"==typeof n.length)return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function hp(n,e){var t="function"==typeof Symbol&&n[Symbol.iterator];if(!t)return n;var r,o,i=t.call(n),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(n){o={error:n}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function vp(n,e,t){if(2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return n.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var pp=rp((function(n,e){void 0===e&&(e={});var t=e.fontSize,r=e.fontFamily,o=e.fontWeight,i=e.fontStyle,a=e.fontVariant;return ip||(ip=document.createElement("canvas").getContext("2d")),ip.font=[i,a,o,t+"px",r].join(" "),ip.measureText(Bv(n)?n:"").width}),(function(n,e){return void 0===e&&(e={}),function(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;var r=Array(n),o=0;for(e=0;e<t;e++)for(var i=arguments[e],a=0,u=i.length;a<u;a++,o++)r[o]=i[a];return r}([n],Wv(e)).join("")})),gp=function(){function n(){this.map={}}return n.prototype.has=function(n){return void 0!==this.map[n]},n.prototype.get=function(n,e){var t=this.map[n];return void 0===t?e:t},n.prototype.set=function(n,e){this.map[n]=e},n.prototype.clear=function(){this.map={}},n.prototype.delete=function(n){delete this.map[n]},n.prototype.size=function(){return Object.keys(this.map).length},n}(),yp=Object.freeze({__proto__:null,Cache:gp,assign:ep,augment:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t=n[0],r=1;r<n.length;r++){var o=n[r];mv(o)&&(o=o.prototype),ep(t.prototype,o)}},clamp:function(n,e,t){return n<e?e:n>t?t:n},clearAnimationFrame:function(n){(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout)(n)},clone:tp,contains:vv,debounce:function(n,e,t){var r;return function(){var o=this,i=arguments,a=t&&!r;clearTimeout(r),r=setTimeout((function(){r=null,t||n.apply(o,i)}),e),a&&n.apply(o,i)}},deepMix:function(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var r=0;r<e.length;r+=1)op(n,e[r]);return n},difference:function(n,e){return void 0===e&&(e=[]),pv(n,(function(n){return!vv(e,n)}))},each:_v,endsWith:function(n,e){return!(!bv(n)&&!Bv(n))&&n[n.length-1]===e},every:function(n,e){for(var t=0;t<n.length;t++)if(!e(n[t],t))return!1;return!0},extend:function(n,e,t,r){mv(e)||(t=e,e=n,n=function(){});var o=Object.create?function(n,e){return Object.create(n,{constructor:{value:e}})}:function(n,e){function t(){}t.prototype=n;var r=new t;return r.constructor=e,r},i=o(e.prototype,n);return n.prototype=ep(i,n.prototype),n.superclass=o(e.prototype,e),ep(i,t),ep(n,r),n},filter:pv,find:function(n,e){if(!bv(n))return null;var t;if(mv(e)&&(t=e),Nv(e)&&(t=function(n){return Sv(n,e)}),t)for(var r=0;r<n.length;r+=1)if(t(n[r]))return n[r];return null},findIndex:function(n,e,t){void 0===t&&(t=0);for(var r=t;r<n.length;r++)if(e(n[r],r))return r;return-1},firstValue:function(n,e){for(var t=null,r=0;r<n.length;r++){var o=n[r][e];if(!wv(o)){t=bv(o)?o[0]:o;break}}return t},fixedBase:function(n,e){var t=e.toString(),r=t.indexOf(".");if(-1===r)return Math.round(n);var o=t.substr(r+1).length;return o>20&&(o=20),parseFloat(n.toFixed(o))},flatten:function(n){if(!bv(n))return[];for(var e=[],t=0;t<n.length;t++)e=e.concat(n[t]);return e},flattenDeep:Cv,forIn:_v,get:function(n,e,t){for(var r=0,o=Bv(e)?e.split("."):e;n&&r<o.length;)n=n[o[r++]];return void 0===n||r<o.length?t:n},getEllipsisText:function(n,e,t,r){void 0===r&&(r="...");var o,i,a=pp(r,t),u=Bv(n)?n:qv(n),c=e,l=[];if(pp(n,t)<=e)return n;for(;o=u.substr(0,16),!((i=pp(o,t))+a>c&&i>c);)if(l.push(o),c-=i,!(u=u.substr(16)))return l.join("");for(;o=u.substr(0,1),!((i=pp(o,t))+a>c);)if(l.push(o),c-=i,!(u=u.substr(1)))return l.join("");return""+l.join("")+r},getRange:function(n){var e=n.filter((function(n){return!isNaN(n)}));if(!e.length)return{min:0,max:0};if(bv(n[0])){for(var t=[],r=0;r<n.length;r++)t=t.concat(n[r]);e=t}var o=Ov(e);return{min:Mv(e),max:o}},getType:Kv,getWrapBehavior:function(n,e){return n["_wrap_"+e]},group:function(n,e){if(!e)return[n];var t=Vv(n,e),r=[];for(var o in t)r.push(t[o]);return r},groupBy:Rv,groupToMap:Vv,has:Gv,hasKey:Gv,hasValue:function(n,e){return vv(Wv(n),e)},head:function(n){if(hv(n))return n[0]},identity:function(n){return n},includes:vv,indexOf:function(n,e){if(!hv(n))return-1;var t=Array.prototype.indexOf;if(t)return t.call(n,e);for(var r=-1,o=0;o<n.length;o++)if(n[o]===e){r=o;break}return r},isArguments:function(n){return yv(n,"Arguments")},isArray:bv,isArrayLike:hv,isBoolean:function(n){return yv(n,"Boolean")},isDate:function(n){return yv(n,"Date")},isDecimal:function(n){return Yv(n)&&n%1!=0},isElement:function(n){return n instanceof Element||n instanceof HTMLDocument},isEmpty:function(n){if(wv(n))return!0;if(hv(n))return!n.length;var e=Kv(n);if("Map"===e||"Set"===e)return!n.size;if(Jv(n))return!Object.keys(n).length;for(var t in n)if(ap.call(n,t))return!1;return!0},isEqual:up,isEqualWith:function(n,e,t){return mv(t)?!!t(n,e):up(n,e)},isError:function(n){return yv(n,"Error")},isEven:function(n){return Yv(n)&&n%2==0},isFinite:function(n){return Yv(n)&&isFinite(n)},isFunction:mv,isInteger:Xv,isMatch:Sv,isNegative:function(n){return Yv(n)&&n<0},isNil:wv,isNull:function(n){return null===n},isNumber:Yv,isNumberEqual:function(n,e,t){return void 0===t&&(t=1e-5),Math.abs(n-e)<t},isObject:xv,isObjectLike:kv,isOdd:function(n){return Yv(n)&&n%2!=0},isPlainObject:Nv,isPositive:function(n){return Yv(n)&&n>0},isPrototype:Jv,isRegExp:function(n){return yv(n,"RegExp")},isString:Bv,isType:yv,isUndefined:function(n){return void 0===n},keys:Ev,last:function(n){if(hv(n))return n[n.length-1]},lowerCase:function(n){return qv(n).toLowerCase()},lowerFirst:function(n){var e=qv(n);return e.charAt(0).toLowerCase()+e.substring(1)},map:function(n,e){if(!hv(n))return n;for(var t=[],r=0;r<n.length;r++){var o=n[r];t.push(e(o,r))}return t},mapValues:function(n,e){void 0===e&&(e=cp);var t={};return xv(n)&&!wv(n)&&Object.keys(n).forEach((function(r){t[r]=e(n[r],r)})),t},max:Ov,maxBy:function(n,e){if(bv(n)){for(var t,r=-1/0,o=0;o<n.length;o++){var i=n[o],a=mv(e)?e(i):i[e];a>r&&(t=i,r=a)}return t}},measureTextWidth:pp,memoize:rp,min:Mv,minBy:function(n,e){if(bv(n)){for(var t,r=1/0,o=0;o<n.length;o++){var i=n[o],a=mv(e)?e(i):i[e];a<r&&(t=i,r=a)}return t}},mix:ep,mod:function(n,e){return(n%e+e)%e},noop:function(){},number2color:function(n){var e=Hv[n];if(!e){for(var t=n.toString(16),r=t.length;r<6;r++)t="0"+t;e="#"+t,Hv[n]=e}return e},omit:function(n,e){return Tv(n,(function(n,t,r){return e.includes(r)||(n[r]=t),n}),{})},parseRadius:function(n){var e=0,t=0,r=0,o=0;return bv(n)?1===n.length?e=t=r=o=n[0]:2===n.length?(e=r=n[0],t=o=n[1]):3===n.length?(e=n[0],t=o=n[1],r=n[2]):(e=n[0],t=n[1],r=n[2],o=n[3]):e=t=r=o=n,{r1:e,r2:t,r3:r,r4:o}},pick:function(n,e){if(null===n||!Nv(n))return{};var t={};return _v(e,(function(e){lp.call(n,e)&&(t[e]=n[e])})),t},pull:function(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var r=0;r<e.length;r++)for(var o=e[r],i=-1;(i=Iv.call(n,o))>-1;)Pv.call(n,i,1);return n},pullAt:zv,reduce:Tv,remove:function(n,e){var t=[];if(!hv(n))return t;for(var r=-1,o=[],i=n.length;++r<i;){var a=n[r];e(a,r,n)&&(t.push(a),o.push(r))}return zv(n,o),t},requestAnimationFrame:function(n){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(n){return setTimeout(n,16)})(n)},set:function(n,e,t){var r=n,o=Bv(e)?e.split("."):e;return o.forEach((function(n,e){e<o.length-1?(xv(r[n])||(r[n]=Yv(o[e+1])?[]:{}),r=r[n]):r[n]=t})),n},size:function(n){return wv(n)?0:hv(n)?n.length:Object.keys(n).length},some:function(n,e){for(var t=0;t<n.length;t++)if(e(n[t],t))return!0;return!1},sortBy:function(n,e){var t;if(mv(e))t=function(n,t){return e(n)-e(t)};else{var r=[];Bv(e)?r.push(e):bv(e)&&(r=e),t=function(n,e){for(var t=0;t<r.length;t+=1){var o=r[t];if(n[o]>e[o])return 1;if(n[o]<e[o])return-1}return 0}}return n.sort(t),n},startsWith:function(n,e){return!(!bv(n)&&!Bv(n))&&n[0]===e},substitute:function(n,e){return n&&e?n.replace(/\\?\{([^{}]+)\}/g,(function(n,t){return"\\"===n.charAt(0)?n.slice(1):void 0===e[t]?"":e[t]})):n},throttle:function(n,e,t){var r,o,i,a,u=0;t||(t={});var c=function(){u=!1===t.leading?0:Date.now(),r=null,a=n.apply(o,i),r||(o=i=null)},l=function(){var l=Date.now();u||!1!==t.leading||(u=l);var s=e-(l-u);return o=this,i=arguments,s<=0||s>e?(r&&(clearTimeout(r),r=null),u=l,a=n.apply(o,i),r||(o=i=null)):r||!1===t.trailing||(r=setTimeout(c,s)),a};return l.cancel=function(){clearTimeout(r),u=0,r=o=i=null},l},toArray:function(n){return hv(n)?Array.prototype.slice.call(n):[]},toDegree:function(n){return Fv*n},toInteger:Zv,toRadian:function(n){return Uv*n},toString:qv,union:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return Lv([].concat.apply([],n))},uniq:Lv,uniqueId:function(n){return sp[n=n||"g"]?sp[n]+=1:sp[n]=1,n+sp[n]},upperCase:function(n){return qv(n).toUpperCase()},upperFirst:function(n){var e=qv(n);return e.charAt(0).toUpperCase()+e.substring(1)},values:Wv,valuesOfKey:function(n,e){for(var t=[],r={},o=0;o<n.length;o++){var i=n[o][e];if(!wv(i)){bv(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(n,e){if(n["_wrap_"+e])return n["_wrap_"+e];var t=function(t){n[e](t)};return n["_wrap_"+e]=t,t}}),mp={assign:function(n){if(n.__esModule)return n;var e=n.default;if("function"==typeof e){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach((function(e){var r=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:function(){return n[e]}})})),t}(yp).mix,getHeight:function(n,e,t,r){return void 0===r&&(r="height"),"center"===t?(n[r]+e[r])/2:n.height}},wp=mp,bp={getId:function(n){return n.id||n.name},getPreH:function(n){return n.preH||0},getPreV:function(n){return n.preV||0},getHGap:function(n){return n.hgap||18},getVGap:function(n){return n.vgap||18},getChildren:function(n){return n.children},getHeight:function(n){return n.height||36},getWidth:function(n){var e=n.label||" ";return n.width||18*e.split("").length}};function xp(n,e){var t=this;if(t.vgap=t.hgap=0,n instanceof xp)return n;t.data=n;var r=e.getHGap(n),o=e.getVGap(n);return t.preH=e.getPreH(n),t.preV=e.getPreV(n),t.width=e.getWidth(n),t.height=e.getHeight(n),t.width+=t.preH,t.height+=t.preV,t.id=e.getId(n),t.x=t.y=0,t.depth=0,t.children||(t.children=[]),t.addGap(r,o),t}wp.assign(xp.prototype,{isRoot:function(){return 0===this.depth},isLeaf:function(){return 0===this.children.length},addGap:function(n,e){var t=this;t.hgap+=n,t.vgap+=e,t.width+=2*n,t.height+=2*e},eachNode:function(n){for(var e,t=[this];e=t.shift();)n(e),t=e.children.concat(t)},DFTraverse:function(n){this.eachNode(n)},BFTraverse:function(n){for(var e,t=[this];e=t.shift();)n(e),t=t.concat(e.children)},getBoundingBox:function(){var n={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode((function(e){n.left=Math.min(n.left,e.x),n.top=Math.min(n.top,e.y),n.width=Math.max(n.width,e.x+e.width),n.height=Math.max(n.height,e.y+e.height)})),n},translate:function(n,e){void 0===n&&(n=0),void 0===e&&(e=0),this.eachNode((function(t){t.x+=n,t.y+=e,t.x+=t.preH,t.y+=t.preV}))},right2left:function(){var n=this,e=n.getBoundingBox();n.eachNode((function(n){n.x=n.x-2*(n.x-e.left)-n.width})),n.translate(e.width,0)},bottom2top:function(){var n=this,e=n.getBoundingBox();n.eachNode((function(n){n.y=n.y-2*(n.y-e.top)-n.height})),n.translate(0,e.height)}});var _p=function(n,e,t){void 0===e&&(e={});var r,o=new xp(n,e=wp.assign({},bp,e)),i=[o];if(!t&&!n.collapsed)for(;r=i.shift();)if(!r.data.collapsed){var a=e.getChildren(r.data),u=a?a.length:0;if(r.children=new Array(u),a&&u)for(var c=0;c<u;c++){var l=new xp(a[c],e);r.children[c]=l,i.push(l),l.parent=r,l.depth=r.depth+1}}return o},Ep=_p,Sp=function(){function n(n,e){void 0===e&&(e={}),this.options=e,this.rootNode=Ep(n,e)}return n.prototype.execute=function(){throw new Error("please override this method")},n}(),kp=Sp;function Np(n,e,t,r){void 0===r&&(r=[]);var o=this;o.w=n||0,o.h=e||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 Cp(n,e,t){t?n.y+=e:n.x+=e,n.children.forEach((function(n){Cp(n,e,t)}))}function Op(n,e){var t=e?n.y:n.x;return n.children.forEach((function(n){t=Math.min(Op(n,e),t)})),t}function Mp(n,e){Cp(n,-Op(n,e),e)}function jp(n,e,t){t?e.y=n.x:e.x=n.x,n.c.forEach((function(n,r){jp(n,e.children[r],t)}))}function Pp(n,e,t){void 0===t&&(t=0),e?(n.x=t,t+=n.width):(n.y=t,t+=n.height),n.children.forEach((function(n){Pp(n,e,t)}))}Np.fromNode=function(n,e){if(!n)return null;var t=[];return n.children.forEach((function(n){t.push(Np.fromNode(n,e))})),e?new Np(n.height,n.width,n.x,t):new Np(n.width,n.height,n.y,t)};var Ip=_p,Ap=function(n,e){for(var t=Ip(n.data,e,!0),r=Ip(n.data,e,!0),o=n.children.length,i=Math.round(o/2),a=e.getSide||function(n,e){return e<i?"right":"left"},u=0;u<o;u++){var c=n.children[u];"right"===a(c,u)?r.children.push(c):t.children.push(c)}return t.eachNode((function(n){n.isRoot()||(n.side="left")})),r.eachNode((function(n){n.isRoot()||(n.side="right")})),{left:t,right:r}},zp=Ap,Tp=["LR","RL","TB","BT","H","V"],Bp=["LR","RL","H"],Lp=Tp[0],Dp=function(n,e,t){var r=e.direction||Lp;if(e.isHorizontal=function(n){return Bp.indexOf(n)>-1}(r),r&&-1===Tp.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===Tp[0])t(n,e);else if(r===Tp[1])t(n,e),n.right2left();else if(r===Tp[2])t(n,e);else if(r===Tp[3])t(n,e),n.bottom2top();else if(r===Tp[4]||r===Tp[5]){var o=zp(n,e),i=o.left,a=o.right;t(i,e),t(a,e),e.isHorizontal?i.right2left():i.bottom2top(),a.translate(i.x-a.x,i.y-a.y),n.x=i.x,n.y=a.y;var u=n.getBoundingBox();e.isHorizontal?u.top<0&&n.translate(0,-u.top):u.left<0&&n.translate(-u.left,0)}var c=e.fixedRoot;return void 0===c&&(c=!0),c&&n.translate(-(n.x+n.width/2+n.hgap),-(n.y+n.height/2+n.vgap)),n};function Rp(n,e){return Rp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,e){return n.__proto__=e,n},Rp(n,e)}var Vp=function(n,e){void 0===e&&(e={});var t=e.isHorizontal;function r(n){0===n.cs?(n.el=n,n.er=n,n.msel=n.mser=0):(n.el=n.c[0].el,n.msel=n.c[0].msel,n.er=n.c[n.cs-1].er,n.mser=n.c[n.cs-1].mser)}function o(n,e,t){for(var r=n.c[e-1],o=r.mod,l=n.c[e],s=l.mod;null!==r&&null!==l;){c(r)>t.low&&(t=t.nxt);var d=o+r.prelim+r.w-(s+l.prelim);d>0&&(s+=d,i(n,e,t.index,d));var f=c(r),h=c(l);f<=h&&null!==(r=u(r))&&(o+=r.mod),f>=h&&null!==(l=a(l))&&(s+=l.mod)}!r&&l?function(n,e,t,r){var o=n.c[0].el;o.tl=t;var i=r-t.mod-n.c[0].msel;o.mod+=i,o.prelim-=i,n.c[0].el=n.c[e].el,n.c[0].msel=n.c[e].msel}(n,e,l,s):r&&!l&&function(n,e,t,r){var o=n.c[e].er;o.tr=t;var i=r-t.mod-n.c[e].mser;o.mod+=i,o.prelim-=i,n.c[e].er=n.c[e-1].er,n.c[e].mser=n.c[e-1].mser}(n,e,r,o)}function i(n,e,t,r){n.c[e].mod+=r,n.c[e].msel+=r,n.c[e].mser+=r,function(n,e,t,r){if(t!==e-1){var o=e-t;n.c[t+1].shift+=r/o,n.c[e].shift-=r/o,n.c[e].change-=r-r/o}}(n,e,t,r)}function a(n){return 0===n.cs?n.tl:n.c[0]}function u(n){return 0===n.cs?n.tr:n.c[n.cs-1]}function c(n){return n.y+n.h}function l(n,e,t){for(;null!==t&&n>=t.low;)t=t.nxt;return{low:n,index:e,nxt:t}}Pp(n,t);var s=Np.fromNode(n,t);return function n(e){if(0!==e.cs){n(e.c[0]);for(var t=l(c(e.c[0].el),0,null),i=1;i<e.cs;++i){n(e.c[i]);var a=c(e.c[i].er);o(e,i,t),t=l(a,i,t)}!function(n){n.prelim=(n.c[0].prelim+n.c[0].mod+n.c[n.cs-1].mod+n.c[n.cs-1].prelim+n.c[n.cs-1].w)/2-n.w/2}(e),r(e)}else r(e)}(s),function n(e,t){t+=e.mod,e.x=e.prelim+t,function(n){for(var e=0,t=0,r=0;r<n.cs;r++)t+=(e+=n.c[r].shift)+n.c[r].change,n.c[r].mod+=t}(e);for(var r=0;r<e.cs;r++)n(e.c[r],t)}(s,0),jp(s,n,t),Mp(n,t),n},Hp=Dp,Yp=mp,Xp=function(n){var e,t;function r(){return n.apply(this,arguments)||this}return t=n,(e=r).prototype=Object.create(t.prototype),e.prototype.constructor=e,Rp(e,t),r.prototype.execute=function(){return Hp(this.rootNode,this.options,Vp)},r}(kp),Fp={},Zp=mp;function Up(n,e){void 0===e&&(e=[]);var t=this;t.x=t.y=0,t.leftChild=t.rightChild=null,t.height=0,t.children=e}var Gp={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function Wp(n,e,t){t?(e.x=n.x,e.y=n.y):(e.x=n.y,e.y=n.x),n.children.forEach((function(n,r){Wp(n,e.children[r],t)}))}function qp(n,e){return qp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,e){return n.__proto__=e,n},qp(n,e)}var $p=function(n,e){void 0===e&&(e={}),e=Zp.assign({},Gp,e);var t,r=0,o=function n(e){if(!e)return null;e.width=0,e.depth&&e.depth>r&&(r=e.depth);var t=e.children,o=t.length,i=new Up(e.height,[]);return t.forEach((function(e,t){var r=n(e);i.children.push(r),0===t&&(i.leftChild=r),t===o-1&&(i.rightChild=r)})),i.originNode=e,i.isLeaf=e.isLeaf(),i}(n);return function n(e){if(e.isLeaf||0===e.children.length)e.drawingDepth=r;else{var t=e.children.map((function(e){return n(e)})),o=Math.min.apply(null,t);e.drawingDepth=o-1}return e.drawingDepth}(o),function n(r){r.x=r.drawingDepth*e.rankSep,r.isLeaf?(r.y=0,t&&(r.y=t.y+t.height+e.nodeSep,r.originNode.parent!==t.originNode.parent&&(r.y+=e.subTreeSep)),t=r):(r.children.forEach((function(e){n(e)})),r.y=(r.leftChild.y+r.rightChild.y)/2)}(o),Wp(o,n,e.isHorizontal),n},Kp=Dp,Qp=mp,Jp=function(n){var e,t;function r(){return n.apply(this,arguments)||this}return t=n,(e=r).prototype=Object.create(t.prototype),e.prototype.constructor=e,qp(e,t),r.prototype.execute=function(){var n=this;return n.rootNode.width=0,Kp(n.rootNode,n.options,$p)},r}(kp),ng={},eg=mp;function tg(n,e){return tg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,e){return n.__proto__=e,n},tg(n,e)}var rg=kp,og=function(n,e,t,r){var o=null;n.eachNode((function(n){!function(n,e,t,r,o){var i="function"==typeof t?t(n):t*n.depth;if(!r)try{if(n.id===n.parent.children[0].id)return n.x+=i,void(n.y=e?e.y:0)}catch(n){}if(n.x+=i,e){if(n.y=e.y+eg.getHeight(e,n,o),e.parent&&n.parent.id!==e.parent.id){var a=e.parent,u=a.y+eg.getHeight(a,n,o);n.y=u>n.y?u:n.y}}else n.y=0}(n,o,e,t,r),o=n}))},ig=Ap,ag=mp,ug=["LR","RL","H"],cg=ug[0],lg=function(n){var e,t;function r(){return n.apply(this,arguments)||this}return t=n,(e=r).prototype=Object.create(t.prototype),e.prototype.constructor=e,tg(e,t),r.prototype.execute=function(){var n=this.options,e=this.rootNode;n.isHorizontal=!0;var t=n.indent,r=void 0===t?20:t,o=n.dropCap,i=void 0===o||o,a=n.direction,u=void 0===a?cg:a,c=n.align;if(u&&-1===ug.indexOf(u))throw new TypeError("Invalid direction: "+u);if(u===ug[0])og(e,r,i,c);else if(u===ug[1])og(e,r,i,c),e.right2left();else if(u===ug[2]){var l=ig(e,n),s=l.left,d=l.right;og(s,r,i,c),s.right2left(),og(d,r,i,c);var f=s.getBoundingBox();d.translate(f.width,0),e.x=d.x-e.width/2}return e},r}(rg),sg={},dg=mp;function fg(n,e){var t=0;return n.children.length?n.children.forEach((function(n){t+=fg(n,e)})):t=n.height,n._subTreeSep=e.getSubTreeSep(n.data),n.totalHeight=Math.max(n.height,t)+2*n._subTreeSep,n.totalHeight}function hg(n){var e=n.children,t=e.length;if(t){e.forEach((function(n){hg(n)}));var r=e[0],o=e[t-1],i=o.y-r.y+o.height,a=0;if(e.forEach((function(n){a+=n.totalHeight})),i>n.height)n.y=r.y+i/2-n.height/2;else if(1!==e.length||n.height>a){var u=n.y+(n.height-i)/2-r.y;e.forEach((function(n){n.translate(0,u)}))}else n.y=(r.y+r.height/2+o.y+o.height/2)/2-n.height/2}}var vg={getSubTreeSep:function(){return 0}};function pg(n,e){return pg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,e){return n.__proto__=e,n},pg(n,e)}var gg=function(n,e){void 0===e&&(e={}),e=dg.assign({},vg,e),n.parent={x:0,width:0,height:0,y:0},n.BFTraverse((function(n){n.x=n.parent.x+n.parent.width})),n.parent=null,fg(n,e),n.startY=0,n.y=n.totalHeight/2-n.height/2,n.eachNode((function(n){var e=n.children,t=e.length;if(t){var r=e[0];if(r.startY=n.startY+n._subTreeSep,1===t)r.y=n.y+n.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=e[o];i.startY=e[o-1].startY+e[o-1].totalHeight,i.y=i.startY+i.totalHeight/2-i.height/2}}}})),hg(n)},yg=Dp,mg=mp,wg=function(n){var e,t;function r(){return n.apply(this,arguments)||this}return t=n,(e=r).prototype=Object.create(t.prototype),e.prototype.constructor=e,pg(e,t),r.prototype.execute=function(){return yg(this.rootNode,this.options,gg)},r}(kp),bg={};Ze({compactBox:function(n,e){return e=Yp.assign({},Fp,e),new Xp(n,e).execute()},dendrogram:function(n,e){return e=Qp.assign({},ng,e),new Jp(n,e).execute()},indented:function(n,e){return e=ag.assign({},sg,e),new lg(n,e).execute()},mindmap:function(n,e){return e=mg.assign({},bg,e),new wg(n,e).execute()}});var xg={value:()=>{}};function _g(){for(var n,e=0,t=arguments.length,r={};e<t;++e){if(!(n=arguments[e]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new Eg(r)}function Eg(n){this._=n}function Sg(n,e){for(var t,r=0,o=n.length;r<o;++r)if((t=n[r]).name===e)return t.value}function kg(n,e,t){for(var r=0,o=n.length;r<o;++r)if(n[r].name===e){n[r]=xg,n=n.slice(0,r).concat(n.slice(r+1));break}return null!=t&&n.push({name:e,value:t}),n}Eg.prototype=_g.prototype={constructor:Eg,on:function(n,e){var t,r,o=this._,i=(r=o,(n+"").trim().split(/^|\s+/).map((function(n){var e="",t=n.indexOf(".");if(t>=0&&(e=n.slice(t+1),n=n.slice(0,t)),n&&!r.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:e}}))),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<u;)if(t=(n=i[a]).type)o[t]=kg(o[t],n.name,e);else if(null==e)for(t in o)o[t]=kg(o[t],n.name,null);return this}for(;++a<u;)if((t=(n=i[a]).type)&&(t=Sg(o[t],n.name)))return t},copy:function(){var n={},e=this._;for(var t in e)n[t]=e[t].slice();return new Eg(n)},call:function(n,e){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(n))throw new Error("unknown type: "+n);for(i=0,t=(r=this._[n]).length;i<t;++i)r[i].value.apply(e,o)},apply:function(n,e,t){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var r=this._[n],o=0,i=r.length;o<i;++o)r[o].value.apply(e,t)}};var Ng="http://www.w3.org/1999/xhtml",Cg={svg:"http://www.w3.org/2000/svg",xhtml:Ng,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Og(n){var e=n+="",t=e.indexOf(":");return t>=0&&"xmlns"!==(e=n.slice(0,t))&&(n=n.slice(t+1)),Cg.hasOwnProperty(e)?{space:Cg[e],local:n}:n}function Mg(n){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===Ng&&e.documentElement.namespaceURI===Ng?e.createElement(n):e.createElementNS(t,n)}}function jg(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function Pg(n){var e=Og(n);return(e.local?jg:Mg)(e)}function Ig(){}function Ag(n){return null==n?Ig:function(){return this.querySelector(n)}}function zg(){return[]}function Tg(n){return null==n?zg:function(){return this.querySelectorAll(n)}}function Bg(n){return function(){return this.matches(n)}}function Lg(n){return function(e){return e.matches(n)}}var Dg=Array.prototype.find;function Rg(){return this.firstElementChild}var Vg=Array.prototype.filter;function Hg(){return Array.from(this.children)}function Yg(n){return new Array(n.length)}function Xg(n,e){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=e}function Fg(n,e,t,r,o,i){for(var a,u=0,c=e.length,l=i.length;u<l;++u)(a=e[u])?(a.__data__=i[u],r[u]=a):t[u]=new Xg(n,i[u]);for(;u<c;++u)(a=e[u])&&(o[u]=a)}function Zg(n,e,t,r,o,i,a){var u,c,l,s=new Map,d=e.length,f=i.length,h=new Array(d);for(u=0;u<d;++u)(c=e[u])&&(h[u]=l=a.call(c,c.__data__,u,e)+"",s.has(l)?o[u]=c:s.set(l,c));for(u=0;u<f;++u)l=a.call(n,i[u],u,i)+"",(c=s.get(l))?(r[u]=c,c.__data__=i[u],s.delete(l)):t[u]=new Xg(n,i[u]);for(u=0;u<d;++u)(c=e[u])&&s.get(h[u])===c&&(o[u]=c)}function Ug(n){return n.__data__}function Gg(n){return"object"==typeof n&&"length"in n?n:Array.from(n)}function Wg(n,e){return n<e?-1:n>e?1:n>=e?0:NaN}function qg(n){return function(){this.removeAttribute(n)}}function $g(n){return function(){this.removeAttributeNS(n.space,n.local)}}function Kg(n,e){return function(){this.setAttribute(n,e)}}function Qg(n,e){return function(){this.setAttributeNS(n.space,n.local,e)}}function Jg(n,e){return function(){var t=e.apply(this,arguments);null==t?this.removeAttribute(n):this.setAttribute(n,t)}}function ny(n,e){return function(){var t=e.apply(this,arguments);null==t?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,t)}}function ey(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function ty(n){return function(){this.style.removeProperty(n)}}function ry(n,e,t){return function(){this.style.setProperty(n,e,t)}}function oy(n,e,t){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,t)}}function iy(n,e){return n.style.getPropertyValue(e)||ey(n).getComputedStyle(n,null).getPropertyValue(e)}function ay(n){return function(){delete this[n]}}function uy(n,e){return function(){this[n]=e}}function cy(n,e){return function(){var t=e.apply(this,arguments);null==t?delete this[n]:this[n]=t}}function ly(n){return n.trim().split(/^|\s+/)}function sy(n){return n.classList||new dy(n)}function dy(n){this._node=n,this._names=ly(n.getAttribute("class")||"")}function fy(n,e){for(var t=sy(n),r=-1,o=e.length;++r<o;)t.add(e[r])}function hy(n,e){for(var t=sy(n),r=-1,o=e.length;++r<o;)t.remove(e[r])}function vy(n){return function(){fy(this,n)}}function py(n){return function(){hy(this,n)}}function gy(n,e){return function(){(e.apply(this,arguments)?fy:hy)(this,n)}}function yy(){this.textContent=""}function my(n){return function(){this.textContent=n}}function wy(n){return function(){var e=n.apply(this,arguments);this.textContent=null==e?"":e}}function by(){this.innerHTML=""}function xy(n){return function(){this.innerHTML=n}}function _y(n){return function(){var e=n.apply(this,arguments);this.innerHTML=null==e?"":e}}function Ey(){this.nextSibling&&this.parentNode.appendChild(this)}function Sy(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ky(){return null}function Ny(){var n=this.parentNode;n&&n.removeChild(this)}function Cy(){var n=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(n,this.nextSibling):n}function Oy(){var n=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(n,this.nextSibling):n}function My(n){return function(){var e=this.__on;if(e){for(var t,r=0,o=-1,i=e.length;r<i;++r)t=e[r],n.type&&t.type!==n.type||t.name!==n.name?e[++o]=t:this.removeEventListener(t.type,t.listener,t.options);++o?e.length=o:delete this.__on}}}function jy(n,e,t){return function(){var r,o=this.__on,i=function(n){return function(e){n.call(this,e,this.__data__)}}(e);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===n.type&&r.name===n.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=t),void(r.value=e);this.addEventListener(n.type,i,t),r={type:n.type,name:n.name,value:e,listener:i,options:t},o?o.push(r):this.__on=[r]}}function Py(n,e,t){var r=ey(n),o=r.CustomEvent;"function"==typeof o?o=new o(e,t):(o=r.document.createEvent("Event"),t?(o.initEvent(e,t.bubbles,t.cancelable),o.detail=t.detail):o.initEvent(e,!1,!1)),n.dispatchEvent(o)}function Iy(n,e){return function(){return Py(this,n,e)}}function Ay(n,e){return function(){return Py(this,n,e.apply(this,arguments))}}Xg.prototype={constructor:Xg,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,e){return this._parent.insertBefore(n,e)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}},dy.prototype={add:function(n){this._names.indexOf(n)<0&&(this._names.push(n),this._node.setAttribute("class",this._names.join(" ")))},remove:function(n){var e=this._names.indexOf(n);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};var zy=[null];function Ty(n,e){this._groups=n,this._parents=e}function By(){return new Ty([[document.documentElement]],zy)}function Ly(n){return"string"==typeof n?new Ty([[document.querySelector(n)]],[document.documentElement]):new Ty([[n]],zy)}function Dy(n,e){if(n=function(n){let e;for(;e=n.sourceEvent;)n=e;return n}(n),void 0===e&&(e=n.currentTarget),e){var t=e.ownerSVGElement||e;if(t.createSVGPoint){var r=t.createSVGPoint();return r.x=n.clientX,r.y=n.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}if(e.getBoundingClientRect){var o=e.getBoundingClientRect();return[n.clientX-o.left-e.clientLeft,n.clientY-o.top-e.clientTop]}}return[n.pageX,n.pageY]}Ty.prototype=By.prototype={constructor:Ty,select:function(n){"function"!=typeof n&&(n=Ag(n));for(var e=this._groups,t=e.length,r=new Array(t),o=0;o<t;++o)for(var i,a,u=e[o],c=u.length,l=r[o]=new Array(c),s=0;s<c;++s)(i=u[s])&&(a=n.call(i,i.__data__,s,u))&&("__data__"in i&&(a.__data__=i.__data__),l[s]=a);return new Ty(r,this._parents)},selectAll:function(n){n="function"==typeof n?function(n){return function(){return null==(e=n.apply(this,arguments))?[]:Array.isArray(e)?e:Array.from(e);var e}}(n):Tg(n);for(var e=this._groups,t=e.length,r=[],o=[],i=0;i<t;++i)for(var a,u=e[i],c=u.length,l=0;l<c;++l)(a=u[l])&&(r.push(n.call(a,a.__data__,l,u)),o.push(a));return new Ty(r,o)},selectChild:function(n){return this.select(null==n?Rg:function(n){return function(){return Dg.call(this.children,n)}}("function"==typeof n?n:Lg(n)))},selectChildren:function(n){return this.selectAll(null==n?Hg:function(n){return function(){return Vg.call(this.children,n)}}("function"==typeof n?n:Lg(n)))},filter:function(n){"function"!=typeof n&&(n=Bg(n));for(var e=this._groups,t=e.length,r=new Array(t),o=0;o<t;++o)for(var i,a=e[o],u=a.length,c=r[o]=[],l=0;l<u;++l)(i=a[l])&&n.call(i,i.__data__,l,a)&&c.push(i);return new Ty(r,this._parents)},data:function(n,e){if(!arguments.length)return Array.from(this,Ug);var t,r=e?Zg:Fg,o=this._parents,i=this._groups;"function"!=typeof n&&(t=n,n=function(){return t});for(var a=i.length,u=new Array(a),c=new Array(a),l=new Array(a),s=0;s<a;++s){var d=o[s],f=i[s],h=f.length,v=Gg(n.call(d,d&&d.__data__,s,o)),p=v.length,g=c[s]=new Array(p),y=u[s]=new Array(p);r(d,f,g,y,l[s]=new Array(h),v,e);for(var m,w,b=0,x=0;b<p;++b)if(m=g[b]){for(b>=x&&(x=b+1);!(w=y[x])&&++x<p;);m._next=w||null}}return(u=new Ty(u,o))._enter=c,u._exit=l,u},enter:function(){return new Ty(this._enter||this._groups.map(Yg),this._parents)},exit:function(){return new Ty(this._exit||this._groups.map(Yg),this._parents)},join:function(n,e,t){var r=this.enter(),o=this,i=this.exit();return"function"==typeof n?(r=n(r))&&(r=r.selection()):r=r.append(n+""),null!=e&&(o=e(o))&&(o=o.selection()),null==t?i.remove():t(i),r&&o?r.merge(o).order():o},merge:function(n){for(var e=n.selection?n.selection():n,t=this._groups,r=e._groups,o=t.length,i=r.length,a=Math.min(o,i),u=new Array(o),c=0;c<a;++c)for(var l,s=t[c],d=r[c],f=s.length,h=u[c]=new Array(f),v=0;v<f;++v)(l=s[v]||d[v])&&(h[v]=l);for(;c<o;++c)u[c]=t[c];return new Ty(u,this._parents)},selection:function(){return this},order:function(){for(var n=this._groups,e=-1,t=n.length;++e<t;)for(var r,o=n[e],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(n){function e(e,t){return e&&t?n(e.__data__,t.__data__):!e-!t}n||(n=Wg);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,l=o[i]=new Array(c),s=0;s<c;++s)(a=u[s])&&(l[s]=a);l.sort(e)}return new Ty(o,this._parents).order()},call:function(){var n=arguments[0];return arguments[0]=this,n.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var n=this._groups,e=0,t=n.length;e<t;++e)for(var r=n[e],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null},size:function(){let n=0;for(const e of this)++n;return n},empty:function(){return!this.node()},each:function(n){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var o,i=e[t],a=0,u=i.length;a<u;++a)(o=i[a])&&n.call(o,o.__data__,a,i);return this},attr:function(n,e){var t=Og(n);if(arguments.length<2){var r=this.node();return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}return this.each((null==e?t.local?$g:qg:"function"==typeof e?t.local?ny:Jg:t.local?Qg:Kg)(t,e))},style:function(n,e,t){return arguments.length>1?this.each((null==e?ty:"function"==typeof e?oy:ry)(n,e,null==t?"":t)):iy(this.node(),n)},property:function(n,e){return arguments.length>1?this.each((null==e?ay:"function"==typeof e?cy:uy)(n,e)):this.node()[n]},classed:function(n,e){var t=ly(n+"");if(arguments.length<2){for(var r=sy(this.node()),o=-1,i=t.length;++o<i;)if(!r.contains(t[o]))return!1;return!0}return this.each(("function"==typeof e?gy:e?vy:py)(t,e))},text:function(n){return arguments.length?this.each(null==n?yy:("function"==typeof n?wy:my)(n)):this.node().textContent},html:function(n){return arguments.length?this.each(null==n?by:("function"==typeof n?_y:xy)(n)):this.node().innerHTML},raise:function(){return this.each(Ey)},lower:function(){return this.each(Sy)},append:function(n){var e="function"==typeof n?n:Pg(n);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(n,e){var t="function"==typeof n?n:Pg(n),r=null==e?ky:"function"==typeof e?e:Ag(e);return this.select((function(){return this.insertBefore(t.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(Ny)},clone:function(n){return this.select(n?Oy:Cy)},datum:function(n){return arguments.length?this.property("__data__",n):this.node().__data__},on:function(n,e,t){var r,o,i=function(n){return n.trim().split(/^|\s+/).map((function(n){var e="",t=n.indexOf(".");return t>=0&&(e=n.slice(t+1),n=n.slice(0,t)),{type:n,name:e}}))}(n+""),a=i.length;if(!(arguments.length<2)){for(u=e?jy:My,r=0;r<a;++r)this.each(u(i[r],e,t));return this}var u=this.node().__on;if(u)for(var c,l=0,s=u.length;l<s;++l)for(r=0,c=u[l];r<a;++r)if((o=i[r]).type===c.type&&o.name===c.name)return c.value},dispatch:function(n,e){return this.each(("function"==typeof e?Ay:Iy)(n,e))},[Symbol.iterator]:function*(){for(var n=this._groups,e=0,t=n.length;e<t;++e)for(var r,o=n[e],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};const Ry={passive:!1},Vy={capture:!0,passive:!1};function Hy(n){n.stopImmediatePropagation()}function Yy(n){n.preventDefault(),n.stopImmediatePropagation()}function Xy(n){var e=n.document.documentElement,t=Ly(n).on("dragstart.drag",Yy,Vy);"onselectstart"in e?t.on("selectstart.drag",Yy,Vy):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Fy(n,e){var t=n.document.documentElement,r=Ly(n).on("dragstart.drag",null);e&&(r.on("click.drag",Yy,Vy),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=n=>()=>n;function Uy(n,{sourceEvent:e,subject:t,target:r,identifier:o,active:i,x:a,y:u,dx:c,dy:l,dispatch:s}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:e,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:l,enumerable:!0,configurable:!0},_:{value:s}})}function Gy(n){return!n.ctrlKey&&!n.button}function Wy(){return this.parentNode}function qy(n,e){return null==e?{x:n.x,y:n.y}:e}function $y(){return navigator.maxTouchPoints||"ontouchstart"in this}Uy.prototype.on=function(){var n=this._.on.apply(this._,arguments);return n===this._?this:n};var Ky={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(n){return'Node type "'.concat(n,'" 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(n){return"The old edge with id=".concat(n," does not exist.")},error009:function(n){return'Marker type "'.concat(n,"\" doesn't exist.")},error008:function(n,e){var t=e.id,r=e.sourceHandle,o=e.targetHandle;return"Couldn't create edge for ".concat(n,' 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(n){return'Edge type "'.concat(n,'" not found. Using fallback type "default".')},error012:function(n){return'Node with id "'.concat(n,'" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.')},error013:function(n){return void 0===n&&(n="react"),"It seems that you haven't loaded the styles. Please import '@xyflow/".concat(n,"/dist/style.css' or base.css to make sure everything is working properly.")}},Qy=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Jy=["Enter"," ","Escape"],nm=function(n,e,t){if(!n.id)return[];var r=new Set;return t.forEach((function(e){e.source===n.id&&r.add(e.target)})),e.filter((function(n){return r.has(n.id)}))},em=function(n,e,t){if(!n.id)return[];var r=new Set;return t.forEach((function(e){e.target===n.id&&r.add(e.source)})),e.filter((function(n){return r.has(n.id)}))},tm=function(n,e){void 0===e&&(e=[0,0]);var t=function(n){var e,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(e=n.measured)||void 0===e?void 0:e.width)&&void 0!==t?t:n.width)&&void 0!==r?r:n.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=n.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:n.height)&&void 0!==u?u:n.initialHeight)&&void 0!==c?c:0}}(n),r=t.width,o=t.height,i="internals"in n?n.internals.positionAbsolute:n.position,a=n.origin||e,u=r*a[0],c=o*a[1];return{position:{x:n.position.x-u,y:n.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},rm=function(n,e){if(void 0===e&&(e={nodeOrigin:[0,0]}),0===n.length)return{x:0,y:0,width:0,height:0};var t=n.reduce((function(n,t){var r=vm(t,e.nodeOrigin);return dm(n,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return hm(t)},om=function(n,e){if(void 0===e&&(e={nodeOrigin:[0,0]}),0===n.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 n.forEach((function(n){if(null==e.filter||e.filter(n)){var r=vm(n,e.nodeOrigin);t=dm(t,r)}})),hm(t)},im=function(n,e){var t=new Set;return n.forEach((function(n){t.add(n.id)})),e.filter((function(n){return t.has(n.source)||t.has(n.target)}))};function am(n){var e=n.nodeId,t=n.nextPosition,r=n.nodeLookup,o=n.nodeOrigin,i=void 0===o?[0,0]:o,a=n.nodeExtent,u=n.onError,c=r.get(e),l=c.parentId?r.get(c.parentId):void 0,s=l?tm(l,l.origin||i).positionAbsolute:{x:0,y:0},d=s.x,f=s.y,h=function(n,e){var t,r,o,i;return e&&"parent"!==e?[e[0],[e[1][0]-(null!==(r=null===(t=n.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),e[1][1]-(null!==(i=null===(o=n.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:e}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)l&&bm(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(l){var v=c.measured.width,p=c.measured.height,g=l.measured.width,y=l.measured.height;if(v&&p&&g&&y){var m=c.origin||i,w=d+v*m[0],b=f+p*m[1];h=[[w,b],[w+g-v,b+y-p]]}}else null==u||u("005",Ky.error005());var x=bm(h)?cm(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}var um=function(n,e,t){return void 0===e&&(e=0),void 0===t&&(t=1),Math.min(Math.max(n,e),t)},cm=function(n,e){return void 0===n&&(n={x:0,y:0}),{x:um(n.x,e[0][0],e[1][0]),y:um(n.y,e[0][1],e[1][1])}},lm=function(n,e,t){return n<e?um(Math.abs(n-e),1,50)/50:n>t?-um(Math.abs(n-t),1,50)/50:0},sm=function(n,e){return[20*lm(n.x,35,e.width-35),20*lm(n.y,35,e.height-35)]},dm=function(n,e){return{x:Math.min(n.x,e.x),y:Math.min(n.y,e.y),x2:Math.max(n.x2,e.x2),y2:Math.max(n.y2,e.y2)}},fm=function(n){var e=n.x,t=n.y;return{x:e,y:t,x2:e+n.width,y2:t+n.height}},hm=function(n){var e=n.x,t=n.y;return{x:e,y:t,width:n.x2-e,height:n.y2-t}},vm=function(n,e){var t,r,o,i,a,u;void 0===e&&(e=[0,0]);var c=tm(n,e).positionAbsolute,l=c.x,s=c.y;return{x:l,y:s,x2:l+(null!==(o=null!==(r=null===(t=n.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:n.width)&&void 0!==o?o:0),y2:s+(null!==(u=null!==(a=null===(i=n.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:n.height)&&void 0!==u?u:0)}},pm=function(n,e){return void 0===e&&(e=[1,1]),{x:e[0]*Math.round(n.x/e[0]),y:e[1]*Math.round(n.y/e[1])}},gm=function(n,e,t,r){var o=n.x,i=n.y,a=hp(e,3),u=a[0],c=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-u)/l,y:(i-c)/l};return t?pm(s,r):s},ym=function(n,e){var t=n.x,r=n.y,o=hp(e,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}},mm=function(n,e,t,r,o,i){var a=e/(n.width*(1+i)),u=t/(n.height*(1+i)),c=Math.min(a,u),l=um(c,r,o);return{x:e/2-(n.x+n.width/2)*l,y:t/2-(n.y+n.height/2)*l,zoom:l}},wm=function(){var n;return"undefined"!=typeof navigator&&(null===(n=null===navigator||void 0===navigator?void 0:navigator.userAgent)||void 0===n?void 0:n.indexOf("Mac"))>=0};function bm(n){return void 0!==n&&"parent"!==n}function xm(n,e){var t=e.snapGrid,r=void 0===t?[0,0]:t,o=e.snapToGrid,i=void 0!==o&&o,a=e.transform,u=Om(n),c=u.x,l=u.y,s=gm({x:c,y:l},a),d=i?pm(s,r):s,f=d.x,h=d.y;return dp({xSnapped:f,ySnapped:h},s)}var _m,Em,Sm,km,Nm,Cm,Om=function(n,e){var t,r,o,i,a=function(n){return"clientX"in n}(n),u=a?n.clientX:null===(t=n.touches)||void 0===t?void 0:t[0].clientX,c=a?n.clientY:null===(r=n.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==e?void 0:e.left)&&void 0!==o?o:0),y:c-(null!==(i=null==e?void 0:e.top)&&void 0!==i?i:0)}};function Mm(n){var e=n.sourceX,t=n.sourceY,r=n.targetX,o=n.targetY,i=n.sourceControlX,a=n.sourceControlY,u=.125*e+.375*i+.375*n.targetControlX+.125*r,c=.125*t+.375*a+.375*n.targetControlY+.125*o;return[u,c,Math.abs(u-e),Math.abs(c-t)]}function jm(n,e){return n>=0?.5*n:25*e*Math.sqrt(-n)}function Pm(n){var e=n.pos,t=n.x1,r=n.y1,o=n.x2,i=n.y2,a=n.c;switch(e){case Cm.Left:return[t-jm(t-o,a),r];case Cm.Right:return[t+jm(o-t,a),r];case Cm.Top:return[t,r-jm(r-i,a)];case Cm.Bottom:return[t,r+jm(i-r,a)]}}function Im(n){var e=n.sourceX,t=n.sourceY,r=n.sourcePosition,o=void 0===r?Cm.Bottom:r,i=n.targetX,a=n.targetY,u=n.targetPosition,c=void 0===u?Cm.Top:u,l=n.curvature,s=void 0===l?.25:l,d=hp(Pm({pos:o,x1:e,y1:t,x2:i,y2:a,c:s}),2),f=d[0],h=d[1],v=hp(Pm({pos:c,x1:i,y1:a,x2:e,y2:t,c:s}),2),p=v[0],g=v[1],y=hp(Mm({sourceX:e,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),m=y[0],w=y[1],b=y[2],x=y[3];return["M".concat(e,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),m,w,b,x]}function Am(n){var e=n.sourceX,t=n.sourceY,r=n.targetX,o=n.targetY,i=Math.abs(r-e)/2,a=r<e?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}!function(n){n.Strict="strict",n.Loose="loose"}(_m||(_m={})),function(n){n.Free="free",n.Vertical="vertical",n.Horizontal="horizontal"}(Em||(Em={})),function(n){n.Partial="partial",n.Full="full"}(Sm||(Sm={})),function(n){n.Bezier="default",n.Straight="straight",n.Step="step",n.SmoothStep="smoothstep",n.SimpleBezier="simplebezier"}(km||(km={})),function(n){n.Arrow="arrow",n.ArrowClosed="arrowclosed"}(Nm||(Nm={})),function(n){n.Left="left",n.Top="top",n.Right="right",n.Bottom="bottom"}(Cm||(Cm={}));var zm,Tm=function(n){var e=n.source,t=n.sourceHandle,r=n.target,o=n.targetHandle;return"xy-edge__".concat(e).concat(t||"","-").concat(r).concat(o||"")},Bm=function(n,e){return n.source&&n.target?function(n,e){return e.some((function(e){return!(e.source!==n.source||e.target!==n.target||e.sourceHandle!==n.sourceHandle&&(e.sourceHandle||n.sourceHandle)||e.targetHandle!==n.targetHandle&&(e.targetHandle||n.targetHandle))}))}(t=function(n){return"id"in n&&"source"in n&&"target"in n}(n)?dp({},n):dp(dp({},n),{id:Tm(n)}),e)?e:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,e.concat(t)):e;var t},Lm=function(n,e,t,r){void 0===r&&(r={shouldReplaceId:!0});var o=n.id,i=function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(n);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(n,r[o])&&(t[r[o]]=n[r[o]])}return t}(n,["id"]);if(!e.source||!e.target)return t;if(!t.find((function(e){return e.id===n.id})))return t;var a=dp(dp({},i),{id:r.shouldReplaceId?Tm(e):o,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle});return t.filter((function(n){return n.id!==o})).concat(a)};function Dm(n){var e=n.sourceX,t=n.sourceY,r=n.targetX,o=n.targetY,i=hp(Am({sourceX:e,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],l=i[3];return["M ".concat(e,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,l]}var Rm=((zm={})[Cm.Left]={x:-1,y:0},zm[Cm.Right]={x:1,y:0},zm[Cm.Top]={x:0,y:-1},zm[Cm.Bottom]={x:0,y:1},zm),Vm=function(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))};function Hm(n){var e=n.sourceX,t=n.sourceY,r=n.sourcePosition,o=void 0===r?Cm.Bottom:r,i=n.targetX,a=n.targetY,u=n.targetPosition,c=void 0===u?Cm.Top:u,l=n.borderRadius,s=void 0===l?5:l,d=n.centerX,f=n.centerY,h=n.offset,v=hp(function(n){var e,t,r,o,i=n.source,a=n.sourcePosition,u=void 0===a?Cm.Bottom:a,c=n.target,l=n.targetPosition,s=void 0===l?Cm.Top:l,d=n.center,f=n.offset,h=Rm[u],v=Rm[s],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(n){var e=n.source,t=n.sourcePosition,r=void 0===t?Cm.Bottom:t,o=n.target;return r===Cm.Left||r===Cm.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}}({source:p,sourcePosition:u,target:g}),m=0!==y.x?"x":"y",w=y[m],b=[],x={x:0,y:0},_={x:0,y:0},E=hp(Am({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),S=E[0],k=E[1],N=E[2],C=E[3];if(h[m]*v[m]==-1){r=null!==(e=d.x)&&void 0!==e?e:S,o=null!==(t=d.y)&&void 0!==t?t:k;var O=[{x:r,y:p.y},{x:r,y:g.y}],M=[{x:p.x,y:o},{x:g.x,y:o}];b=h[m]===w?"x"===m?O:M:"x"===m?M:O}else{var j=[{x:p.x,y:g.y}],P=[{x:g.x,y:p.y}];if(b="x"===m?h.x===w?P:j:h.y===w?j:P,u===s){var I=Math.abs(i[m]-c[m]);if(I<=f){var A=Math.min(f-1,f-I);h[m]===w?x[m]=(p[m]>i[m]?-1:1)*A:_[m]=(g[m]>c[m]?-1:1)*A}}if(u!==s){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))&&(b="x"===m?j:P)}var D={x:p.x+x.x,y:p.y+x.y},R={x:g.x+_.x,y:g.y+_.y};Math.max(Math.abs(D.x-b[0].x),Math.abs(R.x-b[0].x))>=Math.max(Math.abs(D.y-b[0].y),Math.abs(R.y-b[0].y))?(r=(D.x+R.x)/2,o=b[0].y):(r=b[0].x,o=(D.y+R.y)/2)}return[vp(vp([i,{x:p.x+x.x,y:p.y+x.y}],hp(b),!1),[{x:g.x+_.x,y:g.y+_.y},c],!1),r,o,N,C]}({source:{x:e,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],w=v[4],b=p.reduce((function(n,e,t){var r;return r=t>0&&t<p.length-1?function(n,e,t,r){var o=Math.min(Vm(n,e)/2,Vm(e,t)/2,r),i=e.x,a=e.y;if(n.x===i&&i===t.x||n.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(n.y===a){var u=n.x<t.x?-1:1,c=n.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 l=n.x<t.x?1:-1,s=n.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*s,"Q ").concat(i,",").concat(a," ").concat(i+o*l,",").concat(a)}(p[t-1],e,p[t+1],s):"".concat(0===t?"M":"L").concat(e.x," ").concat(e.y),n+r}),"");return[b,g,y,m,w]}function Ym(n,e){if(!n.parentId)return!1;var t=e.get(n.parentId);return!!t&&(!!t.selected||Ym(t,e))}function Xm(n,e,t){var r=n;do{if(null==r?void 0:r.matches(e))return!0;if(r===t)return!1;r=r.parentElement}while(r);return!1}function Fm(n){var e,t,r,o,i=n.nodeId,a=n.dragItems,u=n.nodeLookup,c=[];try{for(var l=fp(a),s=l.next();!s.done;s=l.next()){var d=hp(s.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(dp(dp({},v),{position:h.position}))}}catch(n){e={error:n}}finally{try{s&&!s.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}if(!i)return[c[0],c];var p=u.get(i).internals.userNode;return[dp(dp({},p),{position:(null===(o=a.get(i))||void 0===o?void 0:o.position)||p.position}),c]}function Zm(n){var e=n.onNodeMouseDown,t=n.getStoreItems,r=n.onDragStart,o=n.onDrag,i=n.onDragStop,a={x:null,y:null},u=0,c=new Map,l=!1,s={x:0,y:0},d=null,f=!1,h=null;return{update:function(n){var v=n.noDragClassName,p=n.handleSelector,g=n.domNode,y=n.isSelectable,m=n.nodeId;function w(n,e){var r,i,u=n.x,l=n.y,s=t(),d=s.nodeLookup,f=s.nodeExtent,h=s.snapGrid,v=s.snapToGrid,p=s.nodeOrigin,g=s.onNodeDrag,y=s.onSelectionDrag,w=s.onError,b=s.updateNodePositions;a={x:u,y:l};var x=!1,_={x:0,y:0,x2:0,y2:0};if(c.size>1&&f){var E=om(c,{nodeOrigin:p});_=fm(E)}try{for(var S=fp(c),k=S.next();!k.done;k=S.next()){var N=hp(k.value,2),C=N[0],O=N[1],M={x:u-O.distance.x,y:l-O.distance.y};v&&(M=pm(M,h));var j=[[f[0][0],f[0][1]],[f[1][0],f[1][1]]];if(c.size>1&&f&&!O.extent){var P=O.internals.positionAbsolute,I=P.x-_.x+f[0][0],A=P.x+O.measured.width-_.x2+f[1][0];j=[[I,P.y-_.y+f[0][1]],[A,P.y+O.measured.height-_.y2+f[1][1]]]}var z=am({nodeId:C,nextPosition:M,nodeLookup:d,nodeExtent:j,nodeOrigin:p,onError:w}),T=z.position,B=z.positionAbsolute;x=x||O.position.x!==T.x||O.position.y!==T.y,O.position=T,O.internals.positionAbsolute=B}}catch(n){r={error:n}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(x&&(b(c,!0),e&&(o||g||!m&&y))){var L=hp(Fm({nodeId:m,dragItems:c,nodeLookup:d}),2),D=L[0],R=L[1];null==o||o(e,c,D,R),null==g||g(e,D,R),m||null==y||y(e,R)}}function b(){var n,e;if(d){var r=hp(sm(s,d),2),o=r[0],i=r[1];if(0!==o||0!==i){var c=t(),l=c.transform,f=c.panBy;a.x=(null!==(n=a.x)&&void 0!==n?n:0)-o/l[2],a.y=(null!==(e=a.y)&&void 0!==e?e:0)-i/l[2],f({x:o,y:i})&&w(a,null)}u=requestAnimationFrame(b)}}function x(n){var o,i=t(),u=i.nodeLookup,l=i.multiSelectionActive,s=i.nodesDraggable,d=i.transform,h=i.snapGrid,v=i.snapToGrid,p=i.selectNodesOnDrag,g=i.onNodeDragStart,w=i.onSelectionDragStart,b=i.unselectNodesAndEdges;f=!0,p&&y||l||!m||(null===(o=u.get(m))||void 0===o?void 0:o.selected)||b(),y&&p&&m&&(null==e||e(m));var x=xm(n.sourceEvent,{transform:d,snapGrid:h,snapToGrid:v});if(a=x,c=function(n,e,t,r){var o,i,a,u,c=new Map;try{for(var l=fp(n),s=l.next();!s.done;s=l.next()){var d=hp(s.value,2),f=d[0],h=d[1];if((h.selected||h.id===r)&&(!h.parentId||!Ym(h,n))&&(h.draggable||e&&void 0===h.draggable)){var v=n.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(n){o={error:n}}finally{try{s&&!s.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}return c}(u,s,x,m),c.size>0&&(r||g||!m&&w)){var _=hp(Fm({nodeId:m,dragItems:c,nodeLookup:u}),2),E=_[0],S=_[1];null==r||r(n.sourceEvent,c,E,S),null==g||g(n.sourceEvent,E,S),m||null==w||w(n.sourceEvent,S)}}h=Ly(g);var _=function(){var n,e,t,r,o=Gy,i=Wy,a=qy,u=$y,c={},l=_g("start","drag","end"),s=0,d=0;function f(n){n.on("mousedown.drag",h).filter(u).on("touchstart.drag",g).on("touchmove.drag",y,Ry).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=w(this,i.call(this,a,u),a,u,"mouse");c&&(Ly(a.view).on("mousemove.drag",v,Vy).on("mouseup.drag",p,Vy),Xy(a.view),Hy(a),t=!1,n=a.clientX,e=a.clientY,c("start",a))}}function v(r){if(Yy(r),!t){var o=r.clientX-n,i=r.clientY-e;t=o*o+i*i>d}c.mouse("drag",r)}function p(n){Ly(n.view).on("mousemove.drag mouseup.drag",null),Fy(n.view,t),Yy(n),c.mouse("end",n)}function g(n,e){if(o.call(this,n,e)){var t,r,a=n.changedTouches,u=i.call(this,n,e),c=a.length;for(t=0;t<c;++t)(r=w(this,u,n,e,a[t].identifier,a[t]))&&(Hy(n),r("start",n,a[t]))}}function y(n){var e,t,r=n.changedTouches,o=r.length;for(e=0;e<o;++e)(t=c[r[e].identifier])&&(Yy(n),t("drag",n,r[e]))}function m(n){var e,t,o=n.changedTouches,i=o.length;for(r&&clearTimeout(r),r=setTimeout((function(){r=null}),500),e=0;e<i;++e)(t=c[o[e].identifier])&&(Hy(n),t("end",n,o[e]))}function w(n,e,t,r,o,i){var u,d,h,v=l.copy(),p=Dy(i||t,e);if(null!=(h=a.call(n,new Uy("beforestart",{sourceEvent:t,target:f,identifier:o,active:s,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,l){var g,y=p;switch(i){case"start":c[o]=t,g=s++;break;case"end":delete c[o],--s;case"drag":p=Dy(l||a,e),g=s}v.call(i,n,new Uy(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(n){return arguments.length?(o="function"==typeof n?n:Zy(!!n),f):o},f.container=function(n){return arguments.length?(i="function"==typeof n?n:Zy(n),f):i},f.subject=function(n){return arguments.length?(a="function"==typeof n?n:Zy(n),f):a},f.touchable=function(n){return arguments.length?(u="function"==typeof n?n:Zy(!!n),f):u},f.on=function(){var n=l.on.apply(l,arguments);return n===l?f:n},f.clickDistance=function(n){return arguments.length?(d=(n=+n)*n,f):Math.sqrt(d)},f}().on("start",(function(n){var e=t(),r=e.domNode,o=e.nodeDragThreshold,i=e.transform,u=e.snapGrid,c=e.snapToGrid;0===o&&x(n);var l=xm(n.sourceEvent,{transform:i,snapGrid:u,snapToGrid:c});a=l,d=(null==r?void 0:r.getBoundingClientRect())||null,s=Om(n.sourceEvent,d)})).on("drag",(function(n){var e,r,o=t(),i=o.autoPanOnNodeDrag,u=o.transform,h=o.snapGrid,v=o.snapToGrid,p=o.nodeDragThreshold,g=xm(n.sourceEvent,{transform:u,snapGrid:h,snapToGrid:v});if(!l&&i&&f&&(l=!0,b()),!f){var y=g.xSnapped-(null!==(e=a.x)&&void 0!==e?e:0),m=g.ySnapped-(null!==(r=a.y)&&void 0!==r?r:0);Math.sqrt(y*y+m*m)>p&&x(n)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&c&&f&&(s=Om(n.sourceEvent,d),w(g,n.sourceEvent))})).on("end",(function(n){if(f&&(l=!1,f=!1,cancelAnimationFrame(u),c.size>0)){var e=t(),r=e.nodeLookup,o=e.updateNodePositions,a=e.onNodeDragStop,s=e.onSelectionDragStop;if(o(c,!1),i||a||!m&&s){var d=hp(Fm({nodeId:m,dragItems:c,nodeLookup:r}),2),h=d[0],v=d[1];null==i||i(n.sourceEvent,c,h,v),null==a||a(n.sourceEvent,h,v),m||null==s||s(n.sourceEvent,v)}}})).filter((function(n){var e=n.target;return!n.button&&(!v||!Xm(e,".".concat(v),g))&&(!p||Xm(e,p,g))}));h.call(_)},destroy:function(){null==h||h.on(".drag",null)}}}function Um(n,e,t,r){return(e[t]||[]).reduce((function(e,o){return"".concat(n.id,"-").concat(o.id,"-").concat(t)!==r&&e.push({id:o.id||null,type:t,nodeId:n.id,x:n.internals.positionAbsolute.x+o.x+o.width/2,y:n.internals.positionAbsolute.y+o.y+o.height/2}),e}),[])}function Gm(n,e){return n||((null==e?void 0:e.classList.contains("target"))?"target":(null==e?void 0:e.classList.contains("source"))?"source":null)}var Wm=function(){return!0},qm=null;function $m(n,e){var t=e.handle,r=e.connectionMode,o=e.fromNodeId,i=e.fromHandleId,a=e.fromType,u=e.doc,c=e.lib,l=e.flowId,s=e.isValidConnection,d=void 0===s?Wm:s,f="target"===a,h=t?u.querySelector(".".concat(c,'-flow__handle[data-id="').concat(l,"-").concat(null==t?void 0:t.nodeId,"-").concat(null==t?void 0:t.id,"-").concat(null==t?void 0:t.type,'"]')):null,v=Om(n),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,w={handleDomNode:m,isValid:!1,connection:null,endHandle:null};if(m){var b=Gm(void 0,m),x=m.getAttribute("data-nodeid"),_=m.getAttribute("data-handleid"),E=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!x)return w;var k={source:f?x:o,sourceHandle:f?_:i,target:f?o:x,targetHandle:f?i:_};w.connection=k,E&&S&&(r===_m.Strict?f&&"source"===b||!f&&"target"===b:x!==o||_!==i)&&(w.endHandle={nodeId:x,handleId:_,type:b},w.isValid=d(k))}return w}var Km={onPointerDown:function(n,e){var t,r=e.connectionMode,o=e.connectionRadius,i=e.handleId,a=e.nodeId,u=e.edgeUpdaterType,c=e.isTarget,l=e.domNode,s=e.nodeLookup,d=e.lib,f=e.autoPanOnConnect,h=e.flowId,v=e.panBy,p=e.cancelConnection,g=e.onConnectStart,y=e.onConnect,m=e.onConnectEnd,w=e.isValidConnection,b=void 0===w?Wm:w,x=e.onEdgeUpdateEnd,_=e.updateConnection,E=e.getTransform,S=e.getConnectionStartHandle,k=function(n){var e;return(null===(e=n.getRootNode)||void 0===e?void 0:e.call(n))||(null===window||void 0===window?void 0:window.document)}(n.target),N=0,C=Om(n),O=C.x,M=C.y,j=null==k?void 0:k.elementFromPoint(O,M),P=Gm(u,j),I=null==l?void 0:l.getBoundingClientRect();if(I&&P){var A=Om(n,I),z=!1,T=null,B=!1,L=null,D=function(n){var e,t,r=n.nodeLookup,o=n.nodeId,i=n.handleId,a=n.handleType,u=[];try{for(var c=fp(r),l=c.next();!l.done;l=c.next()){var s=hp(l.value,2)[1];if(s.internals.handleBounds){var d="".concat(o,"-").concat(i,"-").concat(a),f=Um(s,s.internals.handleBounds,"source",d),h=Um(s,s.internals.handleBounds,"target",d);u.push.apply(u,vp(vp([],hp(f),!1),hp(h),!1))}}}catch(n){e={error:n}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}return u}({nodeLookup:s,nodeId:a,handleId:i,handleType:P});_({connectionPosition:A,connectionStatus:null,connectionStartHandle:qm={nodeId:a,handleId:i,type:P},connectionEndHandle:null}),null==g||g(n,{nodeId:a,handleId:i,handleType:P}),k.addEventListener("mousemove",V),k.addEventListener("mouseup",H),k.addEventListener("touchmove",V),k.addEventListener("touchend",H)}function R(){if(f&&I){var n=hp(sm(A,I),2),e=n[0],t=n[1];v({x:e,y:t}),N=requestAnimationFrame(R)}}function V(n){S()||H(n);var e=E();A=Om(n,I),t=function(n,e,t){var r,o,i=[],a=1/0;try{for(var u=fp(t),c=u.next();!c.done;c=u.next()){var l=c.value,s=Math.sqrt(Math.pow(l.x-n.x,2)+Math.pow(l.y-n.y,2));s<=e&&(s<a?i=[l]:s===a&&i.push(l),a=s)}}catch(n){r={error:n}}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(n){return"target"===n.type}))||i[0]:null}(gm(A,e,!1,[1,1]),o,D),z||(R(),z=!0);var u,l,s,f=$m(n,{handle:t,connectionMode:r,fromNodeId:a,fromHandleId:i,fromType:c?"target":"source",isValidConnection:b,doc:k,lib:d,flowId:h});L=f.handleDomNode,T=f.connection,B=f.isValid,_({connectionStartHandle:qm,connectionPosition:t&&B?ym({x:t.x,y:t.y},e):A,connectionStatus:(u=!!t,l=B,s=null,l?s="valid":u&&!l&&(s="invalid"),s),connectionEndHandle:f.endHandle})}function H(n){(t||L)&&T&&B&&(null==y||y(T)),null==m||m(n),u&&(null==x||x(n)),p(),cancelAnimationFrame(N),z=!1,B=!1,T=null,L=null,qm=null,k.removeEventListener("mousemove",V),k.removeEventListener("mouseup",H),k.removeEventListener("touchmove",V),k.removeEventListener("touchend",H)}},isValid:$m};function Qm(n,e,t){n.prototype=e.prototype=t,t.constructor=n}function Jm(n,e){var t=Object.create(n.prototype);for(var r in e)t[r]=e[r];return t}function nw(){}var ew=.7,tw=1/ew,rw="\\s*([+-]?\\d+)\\s*",ow="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",iw="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",aw=/^#([0-9a-f]{3,8})$/,uw=new RegExp(`^rgb\\(${rw},${rw},${rw}\\)$`),cw=new RegExp(`^rgb\\(${iw},${iw},${iw}\\)$`),lw=new RegExp(`^rgba\\(${rw},${rw},${rw},${ow}\\)$`),sw=new RegExp(`^rgba\\(${iw},${iw},${iw},${ow}\\)$`),dw=new RegExp(`^hsl\\(${ow},${iw},${iw}\\)$`),fw=new RegExp(`^hsla\\(${ow},${iw},${iw},${ow}\\)$`),hw={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 vw(){return this.rgb().formatHex()}function pw(){return this.rgb().formatRgb()}function gw(n){var e,t;return n=(n+"").trim().toLowerCase(),(e=aw.exec(n))?(t=e[1].length,e=parseInt(e[1],16),6===t?yw(e):3===t?new bw(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===t?mw(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===t?mw(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=uw.exec(n))?new bw(e[1],e[2],e[3],1):(e=cw.exec(n))?new bw(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=lw.exec(n))?mw(e[1],e[2],e[3],e[4]):(e=sw.exec(n))?mw(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=dw.exec(n))?Nw(e[1],e[2]/100,e[3]/100,1):(e=fw.exec(n))?Nw(e[1],e[2]/100,e[3]/100,e[4]):hw.hasOwnProperty(n)?yw(hw[n]):"transparent"===n?new bw(NaN,NaN,NaN,0):null}function yw(n){return new bw(n>>16&255,n>>8&255,255&n,1)}function mw(n,e,t,r){return r<=0&&(n=e=t=NaN),new bw(n,e,t,r)}function ww(n,e,t,r){return 1===arguments.length?((o=n)instanceof nw||(o=gw(o)),o?new bw((o=o.rgb()).r,o.g,o.b,o.opacity):new bw):new bw(n,e,t,null==r?1:r);var o}function bw(n,e,t,r){this.r=+n,this.g=+e,this.b=+t,this.opacity=+r}function xw(){return`#${kw(this.r)}${kw(this.g)}${kw(this.b)}`}function _w(){const n=Ew(this.opacity);return`${1===n?"rgb(":"rgba("}${Sw(this.r)}, ${Sw(this.g)}, ${Sw(this.b)}${1===n?")":`, ${n})`}`}function Ew(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function Sw(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function kw(n){return((n=Sw(n))<16?"0":"")+n.toString(16)}function Nw(n,e,t,r){return r<=0?n=e=t=NaN:t<=0||t>=1?n=e=NaN:e<=0&&(n=NaN),new Ow(n,e,t,r)}function Cw(n){if(n instanceof Ow)return new Ow(n.h,n.s,n.l,n.opacity);if(n instanceof nw||(n=gw(n)),!n)return new Ow;if(n instanceof Ow)return n;var e=(n=n.rgb()).r/255,t=n.g/255,r=n.b/255,o=Math.min(e,t,r),i=Math.max(e,t,r),a=NaN,u=i-o,c=(i+o)/2;return u?(a=e===i?(t-r)/u+6*(t<r):t===i?(r-e)/u+2:(e-t)/u+4,u/=c<.5?i+o:2-i-o,a*=60):u=c>0&&c<1?0:a,new Ow(a,u,c,n.opacity)}function Ow(n,e,t,r){this.h=+n,this.s=+e,this.l=+t,this.opacity=+r}function Mw(n){return(n=(n||0)%360)<0?n+360:n}function jw(n){return Math.max(0,Math.min(1,n||0))}function Pw(n,e,t){return 255*(n<60?e+(t-e)*n/60:n<180?t:n<240?e+(t-e)*(240-n)/60:e)}Qm(nw,gw,{copy(n){return Object.assign(new this.constructor,this,n)},displayable(){return this.rgb().displayable()},hex:vw,formatHex:vw,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Cw(this).formatHsl()},formatRgb:pw,toString:pw}),Qm(bw,ww,Jm(nw,{brighter(n){return n=null==n?tw:Math.pow(tw,n),new bw(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=null==n?ew:Math.pow(ew,n),new bw(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new bw(Sw(this.r),Sw(this.g),Sw(this.b),Ew(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:xw,formatHex:xw,formatHex8:function(){return`#${kw(this.r)}${kw(this.g)}${kw(this.b)}${kw(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:_w,toString:_w})),Qm(Ow,(function(n,e,t,r){return 1===arguments.length?Cw(n):new Ow(n,e,t,null==r?1:r)}),Jm(nw,{brighter(n){return n=null==n?tw:Math.pow(tw,n),new Ow(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=null==n?ew:Math.pow(ew,n),new Ow(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+360*(this.h<0),e=isNaN(n)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*e,o=2*t-r;return new bw(Pw(n>=240?n-240:n+120,o,r),Pw(n,o,r),Pw(n<120?n+240:n-120,o,r),this.opacity)},clamp(){return new Ow(Mw(this.h),jw(this.s),jw(this.l),Ew(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 n=Ew(this.opacity);return`${1===n?"hsl(":"hsla("}${Mw(this.h)}, ${100*jw(this.s)}%, ${100*jw(this.l)}%${1===n?")":`, ${n})`}`}}));var Iw=n=>()=>n;function Aw(n,e){var t=e-n;return t?function(n,e){return function(t){return n+t*e}}(n,t):Iw(isNaN(n)?e:n)}var zw=function n(e){var t=function(n){return 1==(n=+n)?Aw:function(e,t){return t-e?function(n,e,t){return n=Math.pow(n,t),e=Math.pow(e,t)-n,t=1/t,function(r){return Math.pow(n+r*e,t)}}(e,t,n):Iw(isNaN(e)?t:e)}}(e);function r(n,e){var r=t((n=ww(n)).r,(e=ww(e)).r),o=t(n.g,e.g),i=t(n.b,e.b),a=Aw(n.opacity,e.opacity);return function(e){return n.r=r(e),n.g=o(e),n.b=i(e),n.opacity=a(e),n+""}}return r.gamma=n,r}(1);function Tw(n,e){return n=+n,e=+e,function(t){return n*(1-t)+e*t}}var Bw=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Lw=new RegExp(Bw.source,"g");function Dw(n,e){var t,r,o,i=Bw.lastIndex=Lw.lastIndex=0,a=-1,u=[],c=[];for(n+="",e+="";(t=Bw.exec(n))&&(r=Lw.exec(e));)(o=r.index)>i&&(o=e.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:Tw(t,r)})),i=Lw.lastIndex;return i<e.length&&(o=e.slice(i),u[a]?u[a]+=o:u[++a]=o),u.length<2?c[0]?function(n){return function(e){return n(e)+""}}(c[0].x):function(n){return function(){return n}}(e):(e=c.length,function(n){for(var t,r=0;r<e;++r)u[(t=c[r]).i]=t.x(n);return u.join("")})}var Rw,Vw=180/Math.PI,Hw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Yw(n,e,t,r,o,i){var a,u,c;return(a=Math.sqrt(n*n+e*e))&&(n/=a,e/=a),(c=n*t+e*r)&&(t-=n*c,r-=e*c),(u=Math.sqrt(t*t+r*r))&&(t/=u,r/=u,c/=u),n*r<e*t&&(n=-n,e=-e,c=-c,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(e,n)*Vw,skewX:Math.atan(c)*Vw,scaleX:a,scaleY:u}}function Xw(n,e,t,r){function o(n){return n.length?n.pop()+" ":""}return function(i,a){var u=[],c=[];return i=n(i),a=n(a),function(n,r,o,i,a,u){if(n!==o||r!==i){var c=a.push("translate(",null,e,null,t);u.push({i:c-4,x:Tw(n,o)},{i:c-2,x:Tw(r,i)})}else(o||i)&&a.push("translate("+o+e+i+t)}(i.translateX,i.translateY,a.translateX,a.translateY,u,c),function(n,e,t,i){n!==e?(n-e>180?e+=360:e-n>180&&(n+=360),i.push({i:t.push(o(t)+"rotate(",null,r)-2,x:Tw(n,e)})):e&&t.push(o(t)+"rotate("+e+r)}(i.rotate,a.rotate,u,c),function(n,e,t,i){n!==e?i.push({i:t.push(o(t)+"skewX(",null,r)-2,x:Tw(n,e)}):e&&t.push(o(t)+"skewX("+e+r)}(i.skewX,a.skewX,u,c),function(n,e,t,r,i,a){if(n!==t||e!==r){var u=i.push(o(i)+"scale(",null,",",null,")");a.push({i:u-4,x:Tw(n,t)},{i:u-2,x:Tw(e,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(n){for(var e,t=-1,r=c.length;++t<r;)u[(e=c[t]).i]=e.x(n);return u.join("")}}}var Fw=Xw((function(n){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(n+"");return e.isIdentity?Hw:Yw(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),Zw=Xw((function(n){return null==n?Hw:(Rw||(Rw=document.createElementNS("http://www.w3.org/2000/svg","g")),Rw.setAttribute("transform",n),(n=Rw.transform.baseVal.consolidate())?Yw((n=n.matrix).a,n.b,n.c,n.d,n.e,n.f):Hw)}),", ",")",")");function Uw(n){return((n=Math.exp(n))+1/n)/2}var Gw,Ww,qw=function n(e,t,r){function o(n,o){var i,a,u=n[0],c=n[1],l=n[2],s=o[0],d=o[1],f=o[2],h=s-u,v=d-c,p=h*h+v*v;if(p<1e-12)a=Math.log(f/l)/e,i=function(n){return[u+n*h,c+n*v,l*Math.exp(e*n*a)]};else{var g=Math.sqrt(p),y=(f*f-l*l+r*p)/(2*l*t*g),m=(f*f-l*l-r*p)/(2*f*t*g),w=Math.log(Math.sqrt(y*y+1)-y),b=Math.log(Math.sqrt(m*m+1)-m);a=(b-w)/e,i=function(n){var r,o=n*a,i=Uw(w),s=l/(t*g)*(i*(r=e*o+w,((r=Math.exp(2*r))-1)/(r+1))-function(n){return((n=Math.exp(n))-1/n)/2}(w));return[u+s*h,c+s*v,l*i/Uw(e*o+w)]}}return i.duration=1e3*a*e/Math.SQRT2,i}return o.rho=function(e){var t=Math.max(.001,+e),r=t*t;return n(t,r,r*r)},o}(Math.SQRT2,2,4),$w=0,Kw=0,Qw=0,Jw=1e3,nb=0,eb=0,tb=0,rb="object"==typeof performance&&performance.now?performance:Date,ob="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function ib(){return eb||(ob(ab),eb=rb.now()+tb)}function ab(){eb=0}function ub(){this._call=this._time=this._next=null}function cb(n,e,t){var r=new ub;return r.restart(n,e,t),r}function lb(){eb=(nb=rb.now())+tb,$w=Kw=0;try{!function(){ib(),++$w;for(var n,e=Gw;e;)(n=eb-e._time)>=0&&e._call.call(void 0,n),e=e._next;--$w}()}finally{$w=0,function(){for(var n,e,t=Gw,r=1/0;t;)t._call?(r>t._time&&(r=t._time),n=t,t=t._next):(e=t._next,t._next=null,t=n?n._next=e:Gw=e);Ww=n,db(r)}(),eb=0}}function sb(){var n=rb.now(),e=n-nb;e>Jw&&(tb-=e,nb=n)}function db(n){$w||(Kw&&(Kw=clearTimeout(Kw)),n-eb>24?(n<1/0&&(Kw=setTimeout(lb,n-rb.now()-tb)),Qw&&(Qw=clearInterval(Qw))):(Qw||(nb=rb.now(),Qw=setInterval(sb,Jw)),$w=1,ob(lb)))}function fb(n,e,t){var r=new ub;return e=null==e?0:+e,r.restart((t=>{r.stop(),n(t+e)}),e,t),r}ub.prototype=cb.prototype={constructor:ub,restart:function(n,e,t){if("function"!=typeof n)throw new TypeError("callback is not a function");t=(null==t?ib():+t)+(null==e?0:+e),this._next||Ww===this||(Ww?Ww._next=this:Gw=this,Ww=this),this._call=n,this._time=t,db()},stop:function(){this._call&&(this._call=null,this._time=1/0,db())}};var hb=_g("start","end","cancel","interrupt"),vb=[],pb=0,gb=2,yb=3,mb=5,wb=6;function bb(n,e,t,r,o,i){var a=n.__transition;if(a){if(t in a)return}else n.__transition={};!function(n,e,t){var r,o=n.__transition;function i(c){var l,s,d,f;if(1!==t.state)return u();for(l in o)if((f=o[l]).name===t.name){if(f.state===yb)return fb(i);4===f.state?(f.state=wb,f.timer.stop(),f.on.call("interrupt",n,n.__data__,f.index,f.group),delete o[l]):+l<e&&(f.state=wb,f.timer.stop(),f.on.call("cancel",n,n.__data__,f.index,f.group),delete o[l])}if(fb((function(){t.state===yb&&(t.state=4,t.timer.restart(a,t.delay,t.time),a(c))})),t.state=gb,t.on.call("start",n,n.__data__,t.index,t.group),t.state===gb){for(t.state=yb,r=new Array(d=t.tween.length),l=0,s=-1;l<d;++l)(f=t.tween[l].value.call(n,n.__data__,t.index,t.group))&&(r[++s]=f);r.length=s+1}}function a(e){for(var o=e<t.duration?t.ease.call(null,e/t.duration):(t.timer.restart(u),t.state=mb,1),i=-1,a=r.length;++i<a;)r[i].call(n,o);t.state===mb&&(t.on.call("end",n,n.__data__,t.index,t.group),u())}function u(){for(var r in t.state=wb,t.timer.stop(),delete o[e],o)return;delete n.__transition}o[e]=t,t.timer=cb((function(n){t.state=1,t.timer.restart(i,t.delay,t.time),t.delay<=n&&i(n-t.delay)}),0,t.time)}(n,t,{name:e,index:r,group:o,on:hb,tween:vb,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:pb})}function xb(n,e){var t=Eb(n,e);if(t.state>pb)throw new Error("too late; already scheduled");return t}function _b(n,e){var t=Eb(n,e);if(t.state>yb)throw new Error("too late; already running");return t}function Eb(n,e){var t=n.__transition;if(!t||!(t=t[e]))throw new Error("transition not found");return t}function Sb(n,e){var t,r,o,i=n.__transition,a=!0;if(i){for(o in e=null==e?null:e+"",i)(t=i[o]).name===e?(r=t.state>gb&&t.state<mb,t.state=wb,t.timer.stop(),t.on.call(r?"interrupt":"cancel",n,n.__data__,t.index,t.group),delete i[o]):a=!1;a&&delete n.__transition}}function kb(n,e){var t,r;return function(){var o=_b(this,n),i=o.tween;if(i!==t)for(var a=0,u=(r=t=i).length;a<u;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}o.tween=r}}function Nb(n,e,t){var r,o;if("function"!=typeof t)throw new Error;return function(){var i=_b(this,n),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:e,value:t},c=0,l=o.length;c<l;++c)if(o[c].name===e){o[c]=u;break}c===l&&o.push(u)}i.tween=o}}function Cb(n,e,t){var r=n._id;return n.each((function(){var n=_b(this,r);(n.value||(n.value={}))[e]=t.apply(this,arguments)})),function(n){return Eb(n,r).value[e]}}function Ob(n,e){var t;return("number"==typeof e?Tw:e instanceof gw?zw:(t=gw(e))?(e=t,zw):Dw)(n,e)}function Mb(n){return function(){this.removeAttribute(n)}}function jb(n){return function(){this.removeAttributeNS(n.space,n.local)}}function Pb(n,e,t){var r,o,i=t+"";return function(){var a=this.getAttribute(n);return a===i?null:a===r?o:o=e(r=a,t)}}function Ib(n,e,t){var r,o,i=t+"";return function(){var a=this.getAttributeNS(n.space,n.local);return a===i?null:a===r?o:o=e(r=a,t)}}function Ab(n,e,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttribute(n))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=e(r=a,c));this.removeAttribute(n)}}function zb(n,e,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttributeNS(n.space,n.local))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=e(r=a,c));this.removeAttributeNS(n.space,n.local)}}function Tb(n,e){var t,r;function o(){var o=e.apply(this,arguments);return o!==r&&(t=(r=o)&&function(n,e){return function(t){this.setAttributeNS(n.space,n.local,e.call(this,t))}}(n,o)),t}return o._value=e,o}function Bb(n,e){var t,r;function o(){var o=e.apply(this,arguments);return o!==r&&(t=(r=o)&&function(n,e){return function(t){this.setAttribute(n,e.call(this,t))}}(n,o)),t}return o._value=e,o}function Lb(n,e){return function(){xb(this,n).delay=+e.apply(this,arguments)}}function Db(n,e){return e=+e,function(){xb(this,n).delay=e}}function Rb(n,e){return function(){_b(this,n).duration=+e.apply(this,arguments)}}function Vb(n,e){return e=+e,function(){_b(this,n).duration=e}}var Hb=By.prototype.constructor;function Yb(n){return function(){this.style.removeProperty(n)}}var Xb=0;function Fb(n,e,t,r){this._groups=n,this._parents=e,this._name=t,this._id=r}function Zb(){return++Xb}var Ub=By.prototype;Fb.prototype={constructor:Fb,select:function(n){var e=this._name,t=this._id;"function"!=typeof n&&(n=Ag(n));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,l=r[a],s=l.length,d=i[a]=new Array(s),f=0;f<s;++f)(u=l[f])&&(c=n.call(u,u.__data__,f,l))&&("__data__"in u&&(c.__data__=u.__data__),d[f]=c,bb(d[f],e,t,f,d,Eb(u,t)));return new Fb(i,this._parents,e,t)},selectAll:function(n){var e=this._name,t=this._id;"function"!=typeof n&&(n=Tg(n));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var c,l=r[u],s=l.length,d=0;d<s;++d)if(c=l[d]){for(var f,h=n.call(c,c.__data__,d,l),v=Eb(c,t),p=0,g=h.length;p<g;++p)(f=h[p])&&bb(f,e,t,p,h,v);i.push(h),a.push(c)}return new Fb(i,a,e,t)},selectChild:Ub.selectChild,selectChildren:Ub.selectChildren,filter:function(n){"function"!=typeof n&&(n=Bg(n));for(var e=this._groups,t=e.length,r=new Array(t),o=0;o<t;++o)for(var i,a=e[o],u=a.length,c=r[o]=[],l=0;l<u;++l)(i=a[l])&&n.call(i,i.__data__,l,a)&&c.push(i);return new Fb(r,this._parents,this._name,this._id)},merge:function(n){if(n._id!==this._id)throw new Error;for(var e=this._groups,t=n._groups,r=e.length,o=t.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var c,l=e[u],s=t[u],d=l.length,f=a[u]=new Array(d),h=0;h<d;++h)(c=l[h]||s[h])&&(f[h]=c);for(;u<r;++u)a[u]=e[u];return new Fb(a,this._parents,this._name,this._id)},selection:function(){return new Hb(this._groups,this._parents)},transition:function(){for(var n=this._name,e=this._id,t=Zb(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,l=0;l<c;++l)if(a=u[l]){var s=Eb(a,e);bb(a,n,t,l,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new Fb(r,this._parents,n,t)},call:Ub.call,nodes:Ub.nodes,node:Ub.node,size:Ub.size,empty:Ub.empty,each:Ub.each,on:function(n,e){var t=this._id;return arguments.length<2?Eb(this.node(),t).on.on(n):this.each(function(n,e,t){var r,o,i=function(n){return(n+"").trim().split(/^|\s+/).every((function(n){var e=n.indexOf(".");return e>=0&&(n=n.slice(0,e)),!n||"start"===n}))}(e)?xb:_b;return function(){var a=i(this,n),u=a.on;u!==r&&(o=(r=u).copy()).on(e,t),a.on=o}}(t,n,e))},attr:function(n,e){var t=Og(n),r="transform"===t?Zw:Ob;return this.attrTween(n,"function"==typeof e?(t.local?zb:Ab)(t,r,Cb(this,"attr."+n,e)):null==e?(t.local?jb:Mb)(t):(t.local?Ib:Pb)(t,r,e))},attrTween:function(n,e){var t="attr."+n;if(arguments.length<2)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;var r=Og(n);return this.tween(t,(r.local?Tb:Bb)(r,e))},style:function(n,e,t){var r="transform"==(n+="")?Fw:Ob;return null==e?this.styleTween(n,function(n,e){var t,r,o;return function(){var i=iy(this,n),a=(this.style.removeProperty(n),iy(this,n));return i===a?null:i===t&&a===r?o:o=e(t=i,r=a)}}(n,r)).on("end.style."+n,Yb(n)):"function"==typeof e?this.styleTween(n,function(n,e,t){var r,o,i;return function(){var a=iy(this,n),u=t(this),c=u+"";return null==u&&(this.style.removeProperty(n),c=u=iy(this,n)),a===c?null:a===r&&c===o?i:(o=c,i=e(r=a,u))}}(n,r,Cb(this,"style."+n,e))).each(function(n,e){var t,r,o,i,a="style."+e,u="end."+a;return function(){var c=_b(this,n),l=c.on,s=null==c.value[a]?i||(i=Yb(e)):void 0;l===t&&o===s||(r=(t=l).copy()).on(u,o=s),c.on=r}}(this._id,n)):this.styleTween(n,function(n,e,t){var r,o,i=t+"";return function(){var a=iy(this,n);return a===i?null:a===r?o:o=e(r=a,t)}}(n,r,e),t).on("end.style."+n,null)},styleTween:function(n,e,t){var r="style."+(n+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(n,e,t){var r,o;function i(){var i=e.apply(this,arguments);return i!==o&&(r=(o=i)&&function(n,e,t){return function(r){this.style.setProperty(n,e.call(this,r),t)}}(n,i,t)),r}return i._value=e,i}(n,e,null==t?"":t))},text:function(n){return this.tween("text","function"==typeof n?function(n){return function(){var e=n(this);this.textContent=null==e?"":e}}(Cb(this,"text",n)):function(n){return function(){this.textContent=n}}(null==n?"":n+""))},textTween:function(n){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;return this.tween(e,function(n){var e,t;function r(){var r=n.apply(this,arguments);return r!==t&&(e=(t=r)&&function(n){return function(e){this.textContent=n.call(this,e)}}(r)),e}return r._value=n,r}(n))},remove:function(){return this.on("end.remove",function(n){return function(){var e=this.parentNode;for(var t in this.__transition)if(+t!==n)return;e&&e.removeChild(this)}}(this._id))},tween:function(n,e){var t=this._id;if(n+="",arguments.length<2){for(var r,o=Eb(this.node(),t).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===n)return r.value;return null}return this.each((null==e?kb:Nb)(t,n,e))},delay:function(n){var e=this._id;return arguments.length?this.each(("function"==typeof n?Lb:Db)(e,n)):Eb(this.node(),e).delay},duration:function(n){var e=this._id;return arguments.length?this.each(("function"==typeof n?Rb:Vb)(e,n)):Eb(this.node(),e).duration},ease:function(n){var e=this._id;return arguments.length?this.each(function(n,e){if("function"!=typeof e)throw new Error;return function(){_b(this,n).ease=e}}(e,n)):Eb(this.node(),e).ease},easeVarying:function(n){if("function"!=typeof n)throw new Error;return this.each(function(n,e){return function(){var t=e.apply(this,arguments);if("function"!=typeof t)throw new Error;_b(this,n).ease=t}}(this._id,n))},end:function(){var n,e,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=_b(this,r),o=t.on;o!==n&&((e=(n=o).copy())._.cancel.push(u),e._.interrupt.push(u),e._.end.push(c)),t.on=e})),0===o&&i()}))},[Symbol.iterator]:Ub[Symbol.iterator]};var Gb={time:null,delay:0,duration:250,ease:function(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}};function Wb(n,e){for(var t;!(t=n.__transition)||!(t=t[e]);)if(!(n=n.parentNode))throw new Error(`transition ${e} not found`);return t}By.prototype.interrupt=function(n){return this.each((function(){Sb(this,n)}))},By.prototype.transition=function(n){var e,t;n instanceof Fb?(e=n._id,n=n._name):(e=Zb(),(t=Gb).time=ib(),n=null==n?null:n+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,l=0;l<c;++l)(a=u[l])&&bb(a,n,e,l,u,t||Wb(a,e));return new Fb(r,this._parents,n,e)};var qb=n=>()=>n;function $b(n,{sourceEvent:e,target:t,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Kb(n,e,t){this.k=n,this.x=e,this.y=t}Kb.prototype={constructor:Kb,scale:function(n){return 1===n?this:new Kb(this.k*n,this.x,this.y)},translate:function(n,e){return 0===n&0===e?this:new Kb(this.k,this.x+this.k*n,this.y+this.k*e)},apply:function(n){return[n[0]*this.k+this.x,n[1]*this.k+this.y]},applyX:function(n){return n*this.k+this.x},applyY:function(n){return n*this.k+this.y},invert:function(n){return[(n[0]-this.x)/this.k,(n[1]-this.y)/this.k]},invertX:function(n){return(n-this.x)/this.k},invertY:function(n){return(n-this.y)/this.k},rescaleX:function(n){return n.copy().domain(n.range().map(this.invertX,this).map(n.invert,n))},rescaleY:function(n){return n.copy().domain(n.range().map(this.invertY,this).map(n.invert,n))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Qb=new Kb(1,0,0);function Jb(n){for(;!n.__zoom;)if(!(n=n.parentNode))return Qb;return n.__zoom}function nx(n){n.stopImmediatePropagation()}function ex(n){n.preventDefault(),n.stopImmediatePropagation()}function tx(n){return!(n.ctrlKey&&"wheel"!==n.type||n.button)}function rx(){var n=this;return n instanceof SVGElement?(n=n.ownerSVGElement||n).hasAttribute("viewBox")?[[(n=n.viewBox.baseVal).x,n.y],[n.x+n.width,n.y+n.height]]:[[0,0],[n.width.baseVal.value,n.height.baseVal.value]]:[[0,0],[n.clientWidth,n.clientHeight]]}function ox(){return this.__zoom||Qb}function ix(n){return-n.deltaY*(1===n.deltaMode?.05:n.deltaMode?1:.002)*(n.ctrlKey?10:1)}function ax(){return navigator.maxTouchPoints||"ontouchstart"in this}function ux(n,e,t){var r=n.invertX(e[0][0])-t[0][0],o=n.invertX(e[1][0])-t[1][0],i=n.invertY(e[0][1])-t[0][1],a=n.invertY(e[1][1])-t[1][1];return n.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))}Jb.prototype=Kb.prototype;var cx,lx=function(n,e){return n.x!==e.x||n.y!==e.y||n.zoom!==e.k},sx=function(n){return{x:n.x,y:n.y,zoom:n.k}},dx=function(n){var e=n.x,t=n.y,r=n.zoom;return Qb.translate(e,t).scale(r)},fx=function(n,e){return n.target.closest(".".concat(e))},hx=function(n,e){return 2===e&&Array.isArray(n)&&n.includes(2)},vx=function(n,e){return void 0===e&&(e=0),"number"==typeof e&&e>0?n.transition().duration(e):n},px=function(n){var e=n.ctrlKey&&wm()?10:1;return-n.deltaY*(1===n.deltaMode?.05:n.deltaMode?1:.002)*e};function gx(n){var e=n.domNode,t=n.minZoom,r=n.maxZoom,o=n.translateExtent,i=n.viewport,a=n.onPanZoom,u=n.onPanZoomStart,c=n.onPanZoomEnd,l=n.onTransformChange,s=n.onDraggingChange,d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),h=function(){var n,e,t,r=tx,o=rx,i=ux,a=ix,u=ax,c=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,d=qw,f=_g("start","zoom","end"),h=500,v=150,p=0,g=10;function y(n){n.property("__zoom",ox).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",N).filter(u).on("touchstart.zoom",C).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(n,e){return(e=Math.max(c[0],Math.min(c[1],e)))===n.k?n:new Kb(e,n.x,n.y)}function w(n,e,t){var r=e[0]-t[0]*n.k,o=e[1]-t[1]*n.k;return r===n.x&&o===n.y?n:new Kb(n.k,r,o)}function b(n){return[(+n[0][0]+ +n[1][0])/2,(+n[0][1]+ +n[1][1])/2]}function x(n,e,t,r){n.on("start.zoom",(function(){_(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){_(this,arguments).event(r).end()})).tween("zoom",(function(){var n=this,i=arguments,a=_(n,i).event(r),u=o.apply(n,i),c=null==t?b(u):"function"==typeof t?t.apply(n,i):t,l=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),s=n.__zoom,f="function"==typeof e?e.apply(n,i):e,h=d(s.invert(c).concat(l/s.k),f.invert(c).concat(l/f.k));return function(n){if(1===n)n=f;else{var e=h(n),t=l/e[2];n=new Kb(t,c[0]-e[0]*t,c[1]-e[1]*t)}a.zoom(null,n)}}))}function _(n,e,t){return!t&&n.__zooming||new E(n,e)}function E(n,e){this.that=n,this.args=e,this.active=0,this.sourceEvent=null,this.extent=o.apply(n,e),this.taps=0}function S(n,...e){if(r.apply(this,arguments)){var t=_(this,e).event(n),o=this.__zoom,u=Math.max(c[0],Math.min(c[1],o.k*Math.pow(2,a.apply(this,arguments)))),s=Dy(n);if(t.wheel)t.mouse[0][0]===s[0]&&t.mouse[0][1]===s[1]||(t.mouse[1]=o.invert(t.mouse[0]=s)),clearTimeout(t.wheel);else{if(o.k===u)return;t.mouse=[s,o.invert(s)],Sb(this),t.start()}ex(n),t.wheel=setTimeout((function(){t.wheel=null,t.end()}),v),t.zoom("mouse",i(w(m(o,u),t.mouse[0],t.mouse[1]),t.extent,l))}}function k(n,...e){if(!t&&r.apply(this,arguments)){var o=n.currentTarget,a=_(this,e,!0).event(n),u=Ly(n.view).on("mousemove.zoom",(function(n){if(ex(n),!a.moved){var e=n.clientX-s,t=n.clientY-d;a.moved=e*e+t*t>p}a.event(n).zoom("mouse",i(w(a.that.__zoom,a.mouse[0]=Dy(n,o),a.mouse[1]),a.extent,l))}),!0).on("mouseup.zoom",(function(n){u.on("mousemove.zoom mouseup.zoom",null),Fy(n.view,a.moved),ex(n),a.event(n).end()}),!0),c=Dy(n,o),s=n.clientX,d=n.clientY;Xy(n.view),nx(n),a.mouse=[c,this.__zoom.invert(c)],Sb(this),a.start()}}function N(n,...e){if(r.apply(this,arguments)){var t=this.__zoom,a=Dy(n.changedTouches?n.changedTouches[0]:n,this),u=t.invert(a),c=t.k*(n.shiftKey?.5:2),d=i(w(m(t,c),a,u),o.apply(this,e),l);ex(n),s>0?Ly(this).transition().duration(s).call(x,d,a,n):Ly(this).call(y.transform,d,a,n)}}function C(t,...o){if(r.apply(this,arguments)){var i,a,u,c,l=t.touches,s=l.length,d=_(this,o,t.changedTouches.length===s).event(t);for(nx(t),a=0;a<s;++a)c=[c=Dy(u=l[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+!!n);n&&(n=clearTimeout(n)),i&&(d.taps<2&&(e=c[0],n=setTimeout((function(){n=null}),h)),Sb(this),d.start())}}function O(n,...e){if(this.__zooming){var t,r,o,a,u=_(this,e).event(n),c=n.changedTouches,s=c.length;for(ex(n),t=0;t<s;++t)o=Dy(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(w(r,o,a),u.extent,l))}}function M(n,...r){if(this.__zooming){var o,i,a=_(this,r).event(n),u=n.changedTouches,c=u.length;for(nx(n),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=Dy(i,this),Math.hypot(e[0]-i[0],e[1]-i[1])<g)){var l=Ly(this).on("dblclick.zoom");l&&l.apply(this,arguments)}}}return y.transform=function(n,e,t,r){var o=n.selection?n.selection():n;o.property("__zoom",ox),n!==o?x(n,e,t,r):o.interrupt().each((function(){_(this,arguments).event(r).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()}))},y.scaleBy=function(n,e,t,r){y.scaleTo(n,(function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)}),t,r)},y.scaleTo=function(n,e,t,r){y.transform(n,(function(){var n=o.apply(this,arguments),r=this.__zoom,a=null==t?b(n):"function"==typeof t?t.apply(this,arguments):t,u=r.invert(a),c="function"==typeof e?e.apply(this,arguments):e;return i(w(m(r,c),a,u),n,l)}),t,r)},y.translateBy=function(n,e,t,r){y.transform(n,(function(){return i(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof t?t.apply(this,arguments):t),o.apply(this,arguments),l)}),null,r)},y.translateTo=function(n,e,t,r,a){y.transform(n,(function(){var n=o.apply(this,arguments),a=this.__zoom,u=null==r?b(n):"function"==typeof r?r.apply(this,arguments):r;return i(Qb.translate(u[0],u[1]).scale(a.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof t?-t.apply(this,arguments):-t),n,l)}),r,a)},E.prototype={event:function(n){return n&&(this.sourceEvent=n),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(n,e){return this.mouse&&"mouse"!==n&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==n&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==n&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(n){var e=Ly(this.that).datum();f.call(n,this.that,new $b(n,{sourceEvent:this.sourceEvent,target:y,type:n,transform:this.that.__zoom,dispatch:f}),e)}},y.wheelDelta=function(n){return arguments.length?(a="function"==typeof n?n:qb(+n),y):a},y.filter=function(n){return arguments.length?(r="function"==typeof n?n:qb(!!n),y):r},y.touchable=function(n){return arguments.length?(u="function"==typeof n?n:qb(!!n),y):u},y.extent=function(n){return arguments.length?(o="function"==typeof n?n:qb([[+n[0][0],+n[0][1]],[+n[1][0],+n[1][1]]]),y):o},y.scaleExtent=function(n){return arguments.length?(c[0]=+n[0],c[1]=+n[1],y):[c[0],c[1]]},y.translateExtent=function(n){return arguments.length?(l[0][0]=+n[0][0],l[1][0]=+n[1][0],l[0][1]=+n[0][1],l[1][1]=+n[1][1],y):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},y.constrain=function(n){return arguments.length?(i=n,y):i},y.duration=function(n){return arguments.length?(s=+n,y):s},y.interpolate=function(n){return arguments.length?(d=n,y):d},y.on=function(){var n=f.on.apply(f,arguments);return n===f?y:n},y.clickDistance=function(n){return arguments.length?(p=(n=+n)*n,y):Math.sqrt(p)},y.tapDistance=function(n){return arguments.length?(g=+n,y):g},y}().scaleExtent([t,r]).translateExtent(o),v=Ly(e).call(h);w({x:i.x,y:i.y,zoom:um(i.zoom,t,r)},[[0,0],[f.width,f.height]],o);var p=v.on("wheel.zoom"),g=v.on("dblclick.zoom");function y(n,e){v&&(null==h||h.transform(vx(v,null==e?void 0:e.duration),n))}function m(){h.on("zoom",null)}function w(n,e,t){var r=dx(n),o=null==h?void 0:h.constrain()(r,e,t);return o&&y(o),o}return h.wheelDelta(px),{update:function(n){var e=n.noWheelClassName,t=n.noPanClassName,r=n.onPaneContextMenu,o=n.userSelectionActive,i=n.panOnScroll,f=n.panOnDrag,y=n.panOnScrollMode,w=n.panOnScrollSpeed,b=n.preventScrolling,x=n.zoomOnPinch,_=n.zoomOnScroll,E=n.zoomOnDoubleClick,S=n.zoomActivationKeyPressed,k=n.lib;o&&!d.isZoomingOrPanning&&m();var N=!i||S||o?function(n){var e=n.noWheelClassName,t=n.preventScrolling,r=n.d3ZoomHandler;return function(n,o){if(!t&&"wheel"===n.type&&!n.ctrlKey||fx(n,e))return null;n.preventDefault(),r.call(this,n,o)}}({noWheelClassName:e,preventScrolling:b,d3ZoomHandler:p}):function(n){var e=n.zoomPanValues,t=n.noWheelClassName,r=n.d3Selection,o=n.d3Zoom,i=n.panOnScrollMode,a=n.panOnScrollSpeed,u=n.zoomOnPinch,c=n.onPanZoomStart,l=n.onPanZoom,s=n.onPanZoomEnd;return function(n){if(fx(n,t))return!1;n.preventDefault(),n.stopImmediatePropagation();var d=r.property("__zoom").k||1;if(n.ctrlKey&&u){var f=Dy(n),h=px(n),v=d*Math.pow(2,h);o.scaleTo(r,v,f,n)}else{var p=1===n.deltaMode?20:1,g=i===Em.Vertical?0:n.deltaX*p,y=i===Em.Horizontal?0:n.deltaY*p;!wm()&&n.shiftKey&&i!==Em.Vertical&&(g=n.deltaY*p,y=0),o.translateBy(r,-g/d*a,-y/d*a,{internal:!0});var m=sx(r.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,null==c||c(n,m)),e.isPanScrolling&&(null==l||l(n,m),e.panScrollTimeout=setTimeout((function(){null==s||s(n,m),e.isPanScrolling=!1}),150))}}}({zoomPanValues:d,noWheelClassName:e,d3Selection:v,d3Zoom:h,panOnScrollMode:y,panOnScrollSpeed:w,zoomOnPinch:x,onPanZoomStart:u,onPanZoom:a,onPanZoomEnd:c});if(v.on("wheel.zoom",N,{passive:!1}),!o){var C=function(n){var e=n.zoomPanValues,t=n.onDraggingChange,r=n.onPanZoomStart;return function(n){var o,i,a;if(!(null===(o=n.sourceEvent)||void 0===o?void 0:o.internal)){var u=sx(n.transform);e.mouseButton=(null===(i=n.sourceEvent)||void 0===i?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=u,"mousedown"===(null===(a=n.sourceEvent)||void 0===a?void 0:a.type)&&t(!0),r&&(null==r||r(n.sourceEvent,u))}}}({zoomPanValues:d,onDraggingChange:s,onPanZoomStart:u});h.on("start",C);var O=function(n){var e=n.zoomPanValues,t=n.panOnDrag,r=n.onPaneContextMenu,o=n.onTransformChange,i=n.onPanZoom;return function(n){var a,u,c;e.usedRightMouseButton=!(!r||!hx(t,null!==(a=e.mouseButton)&&void 0!==a?a:0)),(null===(u=n.sourceEvent)||void 0===u?void 0:u.sync)||o([n.transform.x,n.transform.y,n.transform.k]),i&&!(null===(c=n.sourceEvent)||void 0===c?void 0:c.internal)&&(null==i||i(n.sourceEvent,sx(n.transform)))}}({zoomPanValues:d,panOnDrag:f,onPaneContextMenu:!!r,onPanZoom:a,onTransformChange:l});h.on("zoom",O);var M=function(n){var e=n.zoomPanValues,t=n.panOnDrag,r=n.panOnScroll,o=n.onDraggingChange,i=n.onPanZoomEnd,a=n.onPaneContextMenu;return function(n){var u,c;if(!(null===(u=n.sourceEvent)||void 0===u?void 0:u.internal)&&(e.isZoomingOrPanning=!1,a&&hx(t,null!==(c=e.mouseButton)&&void 0!==c?c:0)&&!e.usedRightMouseButton&&n.sourceEvent&&a(n.sourceEvent),e.usedRightMouseButton=!1,o(!1),i&&lx(e.prevViewport,n.transform))){var l=sx(n.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout((function(){null==i||i(n.sourceEvent,l)}),r?150:0)}}}({zoomPanValues:d,panOnDrag:f,panOnScroll:i,onPaneContextMenu:r,onPanZoomEnd:c,onDraggingChange:s});h.on("end",M)}var j=function(n){var e=n.zoomActivationKeyPressed,t=n.zoomOnScroll,r=n.zoomOnPinch,o=n.panOnDrag,i=n.panOnScroll,a=n.zoomOnDoubleClick,u=n.userSelectionActive,c=n.noWheelClassName,l=n.noPanClassName,s=n.lib;return function(n){var d=e||t,f=r&&n.ctrlKey;if(1===n.button&&"mousedown"===n.type&&(fx(n,"".concat(s,"-flow__node"))||fx(n,"".concat(s,"-flow__edge"))))return!0;if(!(o||d||i||a||r))return!1;if(u)return!1;if(fx(n,c)&&"wheel"===n.type)return!1;if(fx(n,l)&&("wheel"!==n.type||i&&"wheel"===n.type&&!e))return!1;if(!r&&n.ctrlKey&&"wheel"===n.type)return!1;if(!d&&!i&&!f&&"wheel"===n.type)return!1;if(!o&&("mousedown"===n.type||"touchstart"===n.type))return!1;if(Array.isArray(o)&&!o.includes(n.button)&&"mousedown"===n.type)return!1;var h=Array.isArray(o)&&o.includes(n.button)||!n.button||n.button<=1;return(!n.ctrlKey||"wheel"===n.type)&&h}}({zoomActivationKeyPressed:S,panOnDrag:f,zoomOnScroll:_,panOnScroll:i,zoomOnDoubleClick:E,zoomOnPinch:x,userSelectionActive:o,noPanClassName:t,noWheelClassName:e,lib:k});h.filter(j),E?v.on("dblclick.zoom",g):v.on("dblclick.zoom",null)},destroy:m,setViewport:function(n,e){var t=dx(n);return y(t,e),t},setViewportConstrained:w,getViewport:function(){var n=v?Jb(v.node()):{x:0,y:0,k:1};return{x:n.x,y:n.y,zoom:n.k}},scaleTo:function(n,e){v&&(null==h||h.scaleTo(vx(v,null==e?void 0:e.duration),n))},scaleBy:function(n,e){v&&(null==h||h.scaleBy(vx(v,null==e?void 0:e.duration),n))},setScaleExtent:function(n){null==h||h.scaleExtent(n)},setTranslateExtent:function(n){null==h||h.translateExtent(n)},syncViewport:function(n){if(v){var e=dx(n),t=v.property("__zoom");t.k===n.zoom&&t.x===n.x&&t.y===n.y||null==h||h.transform(v,e,null,{sync:!0})}}}}!function(n){n.Line="line",n.Handle="handle"}(cx||(cx={}));dp(dp({},{width:0,height:0,x:0,y:0}),{pointerX:0,pointerY:0,aspectRatio:1});var yx=Ky.error001();function mx(n,e){var r=t(Ye);if(null===r)throw new Error(yx);return R(r,n,e)}function wx(){var n=t(Ye);if(null===n)throw new Error(yx);return r((function(){return{getState:n.getState,setState:n.setState,subscribe:n.subscribe}}),[n])}function bx(n,e){var t,r,o;void 0===e&&(e={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{}});var i=(null==e?void 0:e.elevateNodesOnSelect)?1e3:0;try{for(var a=p(n),u=a.next();!u.done;u=a.next()){var c=g(u.value,2)[1],l=c.parentId;if(l){if(!n.has(l))throw new Error("Parent node ".concat(l," not found"));var s=n.get(l),f=xx(c,n,d(d({},c.position),{z:(Mx(c.zIndex)?c.zIndex:0)+(c.selected?i:0)}),null!==(o=null==s?void 0:s.origin)&&void 0!==o?o:e.nodeOrigin),h=f.x,v=f.y,y=f.z,m=c.internals.positionAbsolute,w=h!==m.x||v!==m.y;(w||y!==c.internals.z)&&(c.internals=d(d({},c.internals),{positionAbsolute:w?{x:h,y:v}:m,z:y}))}}}catch(n){t={error:n}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}function xx(n,e,t,r){var o,i,a,u,c,l;if(void 0===r&&(r=[0,0]),!n.parentId)return t;var s=e.get(n.parentId),d=_x(s,r).position;return xx(s,e,{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=s.internals.z)&&void 0!==a?a:0)>(null!==(u=t.z)&&void 0!==u?u:0)?null!==(c=s.internals.z)&&void 0!==c?c:0:null!==(l=t.z)&&void 0!==l?l:0},s.origin||r)}var _x=function(n,e){void 0===e&&(e=[0,0]);var t=Ox(n),r=t.width,o=t.height,i="internals"in n?n.internals.positionAbsolute:n.position,a=n.origin||e,u=r*a[0],c=o*a[1];return{position:{x:n.position.x-u,y:n.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}};function Ex(n,e,t){var r,o;n.clear(),e.clear();try{for(var i=p(t),a=i.next();!a.done;a=i.next()){var u=a.value,c=u.source,l=u.target,s=u.sourceHandle,d=void 0===s?null:s,f=u.targetHandle,h=void 0===f?null:f,v="".concat(c,"-source-").concat(d),g="".concat(l,"-target-").concat(h),y=n.get(v)||new Map,m=n.get(g)||new Map,w={edgeId:u.id,source:c,target:l,sourceHandle:d,targetHandle:h};e.set(u.id,u),n.set(v,y.set("".concat(l,"-").concat(h),w)),n.set(g,m.set("".concat(c,"-").concat(d),w))}}catch(n){r={error:n}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}function Sx(n,e,t,r){void 0===r&&(r={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{},checkEquality:!0});var o=new Map(e);e.clear(),t.clear();var i=(null==r?void 0:r.elevateNodesOnSelect)?1e3:0;n.forEach((function(n){var a,u,c=o.get(n.id);if(r.checkEquality&&n===(null==c?void 0:c.internals.userNode)||(c=d(d(d({},r.defaults),n),{measured:{width:null===(a=n.measured)||void 0===a?void 0:a.width,height:null===(u=n.measured)||void 0===u?void 0:u.height},internals:{positionAbsolute:n.position,handleBounds:null==c?void 0:c.internals.handleBounds,z:(Mx(n.zIndex)?n.zIndex:0)+(n.selected?i:0),userNode:n}})),e.set(n.id,c),n.parentId){var l=t.get(n.parentId);l?l.push(c):t.set(n.parentId,[c])}})),t.size>0&&bx(e,r)}function kx(n,e,t,r){var o,i,a,u,c,l=[],s=new Map;try{for(var d=p(n),f=d.next();!f.done;f=d.next()){var h=f.value,v=e.get(h.parentId);if(v){var g=null!==(u=null===(a=s.get(h.parentId))||void 0===a?void 0:a.expandedRect)&&void 0!==u?u:Ix(v,null!==(c=v.origin)&&void 0!==c?c:r),y=Bx(g,h.rect);s.set(h.parentId,{expandedRect:y,parent:v})}}}catch(n){o={error:n}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}return s.size>0&&s.forEach((function(e,r){var o=e.expandedRect,i=e.parent,a=_x(i,i.origin).position,u=Ox(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(e){n.some((function(n){return n.id===e.id}))||l.push({id:e.id,type:"position",position:{x:e.position.x+c,y:e.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 Nx=function(n,e,t){return void 0===e&&(e=0),void 0===t&&(t=1),Math.min(Math.max(n,e),t)},Cx=function(n,e){return void 0===n&&(n={x:0,y:0}),{x:Nx(n.x,e[0][0],e[1][0]),y:Nx(n.y,e[0][1],e[1][1])}};function Ox(n){var e,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(e=n.measured)||void 0===e?void 0:e.width)&&void 0!==t?t:n.width)&&void 0!==r?r:n.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=n.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:n.height)&&void 0!==u?u:n.initialHeight)&&void 0!==c?c:0}}var Mx=function(n){return!isNaN(n)&&isFinite(n)},jx=function(n,e){return void 0===e&&(e=[1,1]),{x:e[0]*Math.round(n.x/e[0]),y:e[1]*Math.round(n.y/e[1])}},Px=function(n,e,t,r){var o=n.x,i=n.y,a=g(e,3),u=a[0],c=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-u)/l,y:(i-c)/l};return t?jx(s,r):s},Ix=function(n,e){var t,r,o,i,a,u;void 0===e&&(e=[0,0]);var c=_x(n,e).positionAbsolute;return{x:c.x,y:c.y,width:null!==(o=null!==(r=null===(t=n.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:n.width)&&void 0!==o?o:0,height:null!==(u=null!==(a=null===(i=n.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:n.height)&&void 0!==u?u:0}},Ax=function(n,e){return{x:Math.min(n.x,e.x),y:Math.min(n.y,e.y),x2:Math.max(n.x2,e.x2),y2:Math.max(n.y2,e.y2)}},zx=function(n){var e=n.x,t=n.y;return{x:e,y:t,x2:e+n.width,y2:t+n.height}},Tx=function(n){var e=n.x,t=n.y;return{x:e,y:t,width:n.x2-e,height:n.y2-t}},Bx=function(n,e){return Tx(Ax(zx(n),zx(e)))};function Lx(n){return o(n)}var Dx=function(n,e){var t=Math.max(0,Math.min(n.x+n.width,e.x+e.width)-Math.max(n.x,e.x)),r=Math.max(0,Math.min(n.y+n.height,e.y+e.height)-Math.max(n.y,e.y));return Math.ceil(t*r)},Rx=function(n,e,t,r,o,i){var a=e/(n.width*(1+i)),u=t/(n.height*(1+i)),c=Math.min(a,u),l=Nx(c,r,o);return{x:e/2-(n.x+n.width/2)*l,y:t/2-(n.y+n.height/2)*l,zoom:l}};function Vx(n){return void 0!==n&&"parent"!==n}var Hx=function(n){var e=n.x,t=n.y,r=n.width,o=n.height,i=n.origin,a=void 0===i?[0,0]:i;return!r||!o||a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:e,y:t}:{x:e-r*a[0],y:t-o*a[1]}},Yx=function(n){return Xx(n)},Xx=function(n){return"id"in n&&"position"in n&&!("source"in n)&&!("target"in n)};var Fx=function(n){return Mx(n.width)&&Mx(n.height)&&Mx(n.x)&&Mx(n.y)},Zx=function(n){return{width:n.offsetWidth,height:n.offsetHeight}},Ux=["INPUT","SELECT","TEXTAREA"];function Gx(n){var e,t,r=(null===(t=null===(e=n.composedPath)||void 0===e?void 0:e.call(n))||void 0===t?void 0:t[0])||n.target;return Ux.includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}var Wx=function(n){return"clientX"in n},qx=function(n,e){var t,r,o,i,a=Wx(n),u=a?n.clientX:null===(t=n.touches)||void 0===t?void 0:t[0].clientX,c=a?n.clientY:null===(r=n.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==e?void 0:e.left)&&void 0!==o?o:0),y:c-(null!==(i=null==e?void 0:e.top)&&void 0!==i?i:0)}},$x=function(n,e,t,r){void 0===r&&(r=[0,0]);var o=e.querySelectorAll(n);if(!o||!o.length)return null;var i=Array.from(o),a=e.getBoundingClientRect(),u=a.width*r[0],c=a.height*r[1];return i.map((function(n){var e=n.getBoundingClientRect();return d({id:n.getAttribute("data-handleid"),position:n.getAttribute("data-handlepos"),x:(e.left-a.left-u)/t,y:(e.top-a.top-c)/t},Zx(n))}))},Kx="undefined"!=typeof document?document:null;function Qx(n,e){void 0===n&&(n=null),void 0===e&&(e={target:Kx,actInsideInputWithModifier:!0});var t=g(i(!1),2),o=t[0],c=t[1],l=a(!1),s=a(new Set([])),d=g(r((function(){if(null!==n){var e=(Array.isArray(n)?n:[n]).filter((function(n){return"string"==typeof n})).map((function(n){return n.split("+")})),t=e.reduce((function(n,e){return n.concat.apply(n,y([],g(e),!1))}),[]);return[e,t]}return[[],[]]}),[n]),2),f=d[0],h=d[1];return u((function(){var t=(null==e?void 0:e.target)||Kx;if(null!==n){var r=function(n){if(l.current=n.ctrlKey||n.metaKey||n.shiftKey,(!l.current||l.current&&!e.actInsideInputWithModifier)&&Gx(n))return!1;var t=n_(n.code,h);s.current.add(n[t]),Jx(f,s.current,!1)&&(n.preventDefault(),c(!0))},o=function(n){if((!l.current||l.current&&!e.actInsideInputWithModifier)&&Gx(n))return!1;var t=n_(n.code,h);Jx(f,s.current,!0)?(c(!1),s.current.clear()):s.current.delete(n[t]),"Meta"===n.key&&s.current.clear(),l.current=!1},i=function(){s.current.clear(),c(!1)};return null==t||t.addEventListener("keydown",r),null==t||t.addEventListener("keyup",o),window.addEventListener("blur",i),window.addEventListener("contextmenu",i),function(){null==t||t.removeEventListener("keydown",r),null==t||t.removeEventListener("keyup",o),window.removeEventListener("blur",i),window.removeEventListener("contextmenu",i)}}}),[n,c]),o}function Jx(n,e,t){return n.filter((function(n){return t||n.length===e.size})).some((function(n){return n.every((function(n){return e.has(n)}))}))}function n_(n,e){return e.includes(n)?"code":"key"}function e_(n,e){if(Object.is(n,e))return!0;if("object"!=typeof n||null===n||"object"!=typeof e||null===e)return!1;if(n instanceof Map&&e instanceof Map){if(n.size!==e.size)return!1;for(const[t,r]of n)if(!Object.is(r,e.get(t)))return!1;return!0}if(n instanceof Set&&e instanceof Set){if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0}const t=Object.keys(n);if(t.length!==Object.keys(e).length)return!1;for(const r of t)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(n[r],e[r]))return!1;return!0}var t_={position:"absolute",width:"100%",height:"100%",top:0,left:0};var r_=function(n){return{userSelectionActive:n.userSelectionActive,lib:n.lib}};function o_(n){var e=n.onPaneContextMenu,t=n.zoomOnScroll,r=void 0===t||t,o=n.zoomOnPinch,i=void 0===o||o,c=n.panOnScroll,l=void 0!==c&&c,s=n.panOnScrollSpeed,d=void 0===s?.5:s,f=n.panOnScrollMode,h=void 0===f?Em.Free:f,v=n.zoomOnDoubleClick,p=void 0===v||v,g=n.panOnDrag,y=void 0===g||g,m=n.defaultViewport,w=n.translateExtent,b=n.minZoom,x=n.maxZoom,_=n.zoomActivationKeyCode,S=n.preventScrolling,k=void 0===S||S,N=n.children,C=n.noWheelClassName,O=n.noPanClassName,M=n.onViewportChange,j=n.isControlledViewport,P=wx(),I=a(null),A=mx(r_,e_),z=A.userSelectionActive,T=A.lib,B=Qx(_),L=a();return function(n){var e=wx();u((function(){var t=function(){var t,r;if(!n.current)return!1;var o=Zx(n.current);0!==o.height&&0!==o.width||null===(r=(t=e.getState()).onError)||void 0===r||r.call(t,"004",Ky.error004()),e.setState({width:o.width||500,height:o.height||500})};if(n.current){t(),window.addEventListener("resize",t);var r=new ResizeObserver((function(){return t()}));return r.observe(n.current),function(){window.removeEventListener("resize",t),r&&n.current&&r.unobserve(n.current)}}}),[])}(I),u((function(){if(I.current){L.current=gx({domNode:I.current,minZoom:b,maxZoom:x,translateExtent:w,viewport:m,onTransformChange:function(n){null==M||M({x:n[0],y:n[1],zoom:n[2]}),j||P.setState({transform:n})},onDraggingChange:function(n){return P.setState({paneDragging:n})},onPanZoomStart:function(n,e){var t=P.getState(),r=t.onViewportChangeStart,o=t.onMoveStart;null==o||o(n,e),null==r||r(e)},onPanZoom:function(n,e){var t=P.getState(),r=t.onViewportChange,o=t.onMove;null==o||o(n,e),null==r||r(e)},onPanZoomEnd:function(n,e){var t=P.getState(),r=t.onViewportChangeEnd,o=t.onMoveEnd;null==o||o(n,e),null==r||r(e)}});var n=L.current.getViewport(),e=n.x,t=n.y,r=n.zoom;return P.setState({panZoom:L.current,transform:[e,t,r],domNode:I.current.closest(".ink-flow")}),function(){var n;null===(n=L.current)||void 0===n||n.destroy()}}}),[]),u((function(){var n;null===(n=L.current)||void 0===n||n.update({onPaneContextMenu:e,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:l,panOnScrollSpeed:d,panOnScrollMode:h,zoomOnDoubleClick:p,panOnDrag:y,zoomActivationKeyPressed:B,preventScrolling:k,noPanClassName:O,userSelectionActive:z,noWheelClassName:C,lib:T})}),[e,r,i,l,d,h,p,y,B,k,O,z,C,T]),E.jsx("div",{className:"ink-flow__renderer",ref:I,style:t_,children:N})}var i_={actInsideInputWithModifier:!1};function a_(n,e){var t;switch(n.type){case"select":e.selected=n.selected;break;case"position":void 0!==n.position&&(e.position=n.position),void 0!==n.dragging&&(e.dragging=n.dragging);break;case"dimensions":void 0!==n.dimensions&&(null!==(t=e.measured)&&void 0!==t||(e.measured={}),e.measured.width=n.dimensions.width,e.measured.height=n.dimensions.height,n.setAttributes&&(e.width=n.dimensions.width,e.height=n.dimensions.height)),"boolean"==typeof n.resizing&&(e.resizing=n.resizing)}}function u_(n,e){var t,r,o,i,a,u,c=[],l=new Map;try{for(var s=p(n),f=s.next();!f.done;f=s.next()){if("add"!==(_=f.value).type)if("remove"===_.type||"replace"===_.type)l.set(_.id,[_]);else{var h=l.get(_.id);h?h.push(_):l.set(_.id,[_])}else c.push(_.item)}}catch(n){t={error:n}}finally{try{f&&!f.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}try{for(var v=p(e),g=v.next();!g.done;g=v.next()){var y=g.value,m=l.get(y.id);if(m){if("remove"!==m[0].type)if("replace"!==m[0].type){var w=d({},y);try{for(var b=(a=void 0,p(m)),x=b.next();!x.done;x=b.next()){var _;a_(_=x.value,w)}}catch(n){a={error:n}}finally{try{x&&!x.done&&(u=b.return)&&u.call(b)}finally{if(a)throw a.error}}c.push(w)}else c.push(d({},m[0].item))}else c.push(y)}}catch(n){o={error:n}}finally{try{g&&!g.done&&(i=v.return)&&i.call(v)}finally{if(o)throw o.error}}return c}function c_(n,e){return u_(n,e)}function l_(n,e){return u_(n,e)}function s_(n,e){return{id:n,type:"select",selected:e}}function d_(n,e,t){var r,o;void 0===e&&(e=new Set),void 0===t&&(t=!1);var i=[];try{for(var a=p(n),u=a.next();!u.done;u=a.next()){var c=g(u.value,2),l=c[0],s=c[1],d=e.has(l);void 0===s.selected&&!d||s.selected===d||(t&&(s.selected=d),i.push(s_(s.id,d)))}}catch(n){r={error:n}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i}function f_(n){var e,t,r,o,i,a,u=n.items,c=void 0===u?[]:u,l=n.lookup,s=[],d=new Map(c.map((function(n){return[n.id,n]})));try{for(var f=p(c),h=f.next();!h.done;h=f.next()){var v=h.value,y=l.get(v.id),m=null!==(a=null===(i=null==y?void 0:y.internals)||void 0===i?void 0:i.userNode)&&void 0!==a?a:y;void 0!==m&&m!==v&&s.push({id:v.id,item:v,type:"replace"}),void 0===m&&s.push({item:v,type:"add"})}}catch(n){e={error:n}}finally{try{h&&!h.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}try{for(var w=p(l),b=w.next();!b.done;b=w.next()){var x=g(b.value,1)[0];void 0===d.get(x)&&s.push({id:x,type:"remove"})}}catch(n){r={error:n}}finally{try{b&&!b.done&&(o=w.return)&&o.call(w)}finally{if(r)throw r.error}}return s}function h_(n){return{id:n.id,type:"remove"}}var v_=function(n,e){void 0===e&&(e=[0,0]);var t=Ox(n),r=t.width,o=t.height,i="internals"in n?n.internals.positionAbsolute:n.position,a=n.origin||e,u=r*a[0],c=o*a[1];return{position:{x:n.position.x-u,y:n.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},p_=function(n,e){if(void 0===e&&(e={nodeOrigin:[0,0]}),0===n.length)return{x:0,y:0,width:0,height:0};var t=n.reduce((function(n,t){var r=function(n,e){var t,r,o,i,a,u;void 0===e&&(e=[0,0]);var c=_x(n,e).positionAbsolute,l=c.x,s=c.y;return{x:l,y:s,x2:l+(null!==(o=null!==(r=null===(t=n.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:n.width)&&void 0!==o?o:0),y2:s+(null!==(u=null!==(a=null===(i=n.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:n.height)&&void 0!==u?u:0)}}(t,e.nodeOrigin);return Ax(n,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Tx(t)},g_=function(n,e,t,r,o,i){var a,u,c,l,s,f,h,v,y=g(void 0===t?[0,0,1]:t,3),m=y[0],w=y[1],b=y[2];void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===i&&(i=[0,0]);var x=d(d({},Px(e,[m,w,b])),{width:e.width/b,height:e.height/b}),_=[];try{for(var E=p(n),S=E.next();!S.done;S=E.next()){var k=g(S.value,2)[1],N=k.measured,C=k.selectable,O=void 0===C||C,M=k.hidden,j=void 0!==M&&M,P=null!==(s=null!==(l=null!==(c=N.width)&&void 0!==c?c:k.width)&&void 0!==l?l:k.initialWidth)&&void 0!==s?s:null,I=null!==(v=null!==(h=null!==(f=N.height)&&void 0!==f?f:k.height)&&void 0!==h?h:k.initialHeight)&&void 0!==v?v:null;if(!(o&&!O||j)){var A=Dx(x,Ix(k,i));(null===P||null===I||r&&A>0||A>=(null!=P?P:0)*(null!=I?I:0)||k.dragging)&&_.push(k)}}}catch(n){a={error:n}}finally{try{S&&!S.done&&(u=E.return)&&u.call(E)}finally{if(a)throw a.error}}return _},y_=function(n,e){var t=new Set;return n.forEach((function(n){t.add(n.id)})),e.filter((function(n){return t.has(n.source)||t.has(n.target)}))};function m_(n,e){var t,r,o,i=n.nodeLookup,a=n.width,u=n.height,c=n.panZoom,l=n.minZoom,s=n.maxZoom,d=n.nodeOrigin,f=void 0===d?[0,0]:d,h=[],v=(null==e?void 0:e.nodes)?new Set(e.nodes.map((function(n){return n.id}))):null;if(i.forEach((function(n){!(n.measured.width&&n.measured.height&&((null==e?void 0:e.includeHiddenNodes)||!n.hidden))||v&&!v.has(n.id)||h.push(n)})),h.length>0){var p=p_(h,{nodeOrigin:f}),g=Rx(p,a,u,null!==(t=null==e?void 0:e.minZoom)&&void 0!==t?t:l,null!==(r=null==e?void 0:e.maxZoom)&&void 0!==r?r:s,null!==(o=null==e?void 0:e.padding)&&void 0!==o?o:.1);return c.setViewport(g,{duration:null==e?void 0:e.duration}),!0}return!1}function w_(n){var e=n.nodeId,t=n.nextPosition,r=n.nodeLookup,o=n.nodeOrigin,i=void 0===o?[0,0]:o,a=n.nodeExtent,u=n.onError,c=r.get(e),l=c.parentId?r.get(c.parentId):void 0,s=l?v_(l,l.origin||i).positionAbsolute:{x:0,y:0},d=s.x,f=s.y,h=function(n,e){var t,r,o,i;return e&&"parent"!==e?[e[0],[e[1][0]-(null!==(r=null===(t=n.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),e[1][1]-(null!==(i=null===(o=n.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:e}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)l&&Vx(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(l){var v=c.measured.width,p=c.measured.height,g=l.measured.width,y=l.measured.height;if(v&&p&&g&&y){var m=c.origin||i,w=d+v*m[0],b=f+p*m[1];h=[[w,b],[w+g-v,b+y-p]]}}else null==u||u("005",Ky.error005());var x=Vx(h)?Cx(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}function b_(n){return h(this,arguments,void 0,(function(n){var e,t,r,o,i,a,u,c,l,s,d,f,h,g,y,m,w,b,x,_=n.nodesToRemove,E=void 0===_?[]:_,S=n.edgesToRemove,k=void 0===S?[]:S,N=n.nodes,C=n.edges,O=n.onBeforeDelete;return v(this,(function(n){switch(n.label){case 0:e=new Set(E.map((function(n){return n.id}))),t=[],r=function(n){if(!1===n.deletable)return"continue";var r=e.has(n.id),o=!r&&n.parentId&&t.find((function(e){return e.id===n.parentId}));(r||o)&&t.push(n)};try{for(o=p(N),i=o.next();!i.done;i=o.next())a=i.value,r(a)}catch(n){m={error:n}}finally{try{i&&!i.done&&(w=o.return)&&w.call(o)}finally{if(m)throw m.error}}u=new Set(k.map((function(n){return n.id}))),c=C.filter((function(n){return!1!==n.deletable})),l=y_(t,c),s=l,d=function(n){u.has(n.id)&&!s.find((function(e){return e.id===n.id}))&&s.push(n)};try{for(f=p(c),h=f.next();!h.done;h=f.next())g=h.value,d(g)}catch(n){b={error:n}}finally{try{h&&!h.done&&(x=f.return)&&x.call(f)}finally{if(b)throw b.error}}return O?[4,O({nodes:t,edges:s})]:[2,{edges:s,nodes:t}];case 1:return"boolean"==typeof(y=n.sent())?[2,y?{edges:s,nodes:t}:{edges:[],nodes:[]}]:[2,y]}}))}))}var x_=function(n){return{userSelectionActive:n.userSelectionActive,userSelectionRect:n.userSelectionRect}};function __(){var n=mx(x_,e_),e=n.userSelectionActive,t=n.userSelectionRect;return e&&t?E.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 E_=function(n,e){return function(t){t.target===e.current&&(null==n||n(t))}},S_=function(n){return{userSelectionActive:n.userSelectionActive,elementsSelectable:n.elementsSelectable,dragging:n.paneDragging}};function k_(n){var e=n.isSelecting;n.selectionMode;var t=n.panOnDrag,r=n.onSelectionStart,o=n.onSelectionEnd,i=n.onPaneClick,u=n.onPaneContextMenu,c=n.onPaneScroll,l=n.onPaneMouseEnter,s=n.onPaneMouseMove,d=n.onPaneMouseLeave,f=n.children,h=a(null),v=wx(),y=a(0),m=a(0),w=a(),b=a(new Map),x=mx(S_,e_),_=x.userSelectionActive,S=x.elementsSelectable,k=x.dragging,N=function(){v.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,m.current=0},C=function(n){null==i||i(n),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},M=c?function(n){return c(n)}:void 0,j=S&&(e||_);return E.jsxs("div",{className:O(["ink-flow__pane",{draggable:t,dragging:k,selection:e}]),onClick:j?void 0:E_(C,h),onContextMenu:E_((function(n){Array.isArray(t)&&(null==t?void 0:t.includes(2))?n.preventDefault():null==u||u(n)}),h),onWheel:E_(M,h),onMouseEnter:j?void 0:l,onMouseDown:j?function(n){var t,o,i,a,u=v.getState(),c=u.resetSelectedElements,l=u.domNode,s=u.edgeLookup;if(w.current=null==l?void 0:l.getBoundingClientRect(),S&&e&&0===n.button&&n.target===h.current&&w.current){b.current=new Map;try{for(var d=p(s),f=d.next();!f.done;f=d.next()){var y=g(f.value,2),m=y[0],x=y[1];b.current.set(x.source,(null===(i=b.current.get(x.source))||void 0===i?void 0:i.add(m))||new Set([m])),b.current.set(x.target,(null===(a=b.current.get(x.target))||void 0===a?void 0:a.add(m))||new Set([m]))}}catch(n){t={error:n}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(t)throw t.error}}var _=qx(n.nativeEvent,w.current),E=_.x,k=_.y;c(),v.setState({userSelectionRect:{width:0,height:0,startX:E,startY:k,x:E,y:k}}),null==r||r(n)}}:void 0,onMouseMove:j?function(n){var t,r,o,i,a=v.getState(),u=a.userSelectionRect,c=a.edgeLookup,l=a.transform,s=a.nodeOrigin,d=a.nodeLookup,f=a.triggerNodeChanges,h=a.triggerEdgeChanges;if(e&&w.current&&u){var g=qx(n.nativeEvent,w.current),x=g.x,_=g.y,E=u.startX,S=u.startY,k={startX:E,startY:S,x:x<E?x:E,y:_<S?_:S,width:Math.abs(x-E),height:Math.abs(_-S)},N=g_(d,k,l,!1,!0,s),C=new Set,O=new Set;try{for(var M=p(N),j=M.next();!j.done;j=M.next()){var P=j.value;O.add(P.id);var I=b.current.get(P.id);if(I)try{for(var A=(o=void 0,p(I)),z=A.next();!z.done;z=A.next()){var T=z.value;C.add(T)}}catch(n){o={error:n}}finally{try{z&&!z.done&&(i=A.return)&&i.call(A)}finally{if(o)throw o.error}}}}catch(n){t={error:n}}finally{try{j&&!j.done&&(r=M.return)&&r.call(M)}finally{if(t)throw t.error}}if(y.current!==O.size)y.current=O.size,f(d_(d,O,!0));if(m.current!==C.size)m.current=C.size,h(d_(c,C));v.setState({userSelectionRect:k,userSelectionActive:!0,nodesSelectionActive:!1})}}:s,onMouseUp:j?function(n){if(0===n.button){var e=v.getState().userSelectionRect;!_&&e&&n.target===h.current&&(null==C||C(n)),v.setState({nodesSelectionActive:y.current>0}),N(),null==o||o(n)}}:void 0,onMouseLeave:j?function(n){_&&(v.setState({nodesSelectionActive:y.current>0}),null==o||o(n)),N()}:d,ref:h,style:t_,children:[f,E.jsx(__,{})]})}var N_=function(n){return{nodesSelectionActive:n.nodesSelectionActive,userSelectionActive:n.userSelectionActive}};function C_(n){var e=n.children,t=n.onPaneClick,r=n.onPaneMouseEnter,o=n.onPaneMouseMove,i=n.onPaneMouseLeave,a=n.onPaneContextMenu,c=n.onPaneScroll,l=n.deleteKeyCode,s=n.selectionKeyCode,d=n.selectionOnDrag,f=n.selectionMode,h=n.onSelectionStart,v=n.onSelectionEnd,p=n.multiSelectionKeyCode,g=n.panActivationKeyCode,y=n.zoomActivationKeyCode,m=n.elementsSelectable,w=n.zoomOnScroll,b=n.zoomOnPinch,x=n.panOnScroll,_=n.panOnScrollSpeed,S=n.panOnScrollMode,k=n.zoomOnDoubleClick,N=n.panOnDrag,C=n.defaultViewport,O=n.translateExtent,M=n.minZoom,j=n.maxZoom,P=n.preventScrolling;n.onSelectionContextMenu;var I=n.noWheelClassName,A=n.noPanClassName;n.disableKeyboardA11y;var z=n.onViewportChange,T=n.isControlledViewport,B=mx(N_);B.nodesSelectionActive;var L=B.userSelectionActive,D=Qx(s),R=Qx(g),V=R||N,H=R||x,Y=D||L||d&&!0!==V;return function(n){var e=n.deleteKeyCode,t=n.multiSelectionKeyCode,r=wx(),o=Qx(e,i_),i=Qx(t);u((function(){if(o){var n=r.getState();n.edges,n.nodes,r.setState({nodesSelectionActive:!1})}}),[o]),u((function(){r.setState({multiSelectionActive:i})}),[i])}({deleteKeyCode:l,multiSelectionKeyCode:p}),E.jsx(o_,{onPaneContextMenu:a,elementsSelectable:m,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:H,panOnScrollSpeed:_,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!D&&V,defaultViewport:C,translateExtent:O,minZoom:M,maxZoom:j,zoomActivationKeyCode:y,preventScrolling:P,noWheelClassName:I,noPanClassName:A,onViewportChange:z,isControlledViewport:T,children:E.jsx(k_,{onSelectionStart:h,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:V,isSelecting:!!Y,selectionMode:f,children:e})})}C_.displayName="FlowRenderer";var O_=c(C_);function M_(n){var e=g(i(n),2),t=e[0],r=e[1],o=l((function(n){return r((function(e){return c_(n,e)}))}),[]);return[t,r,o]}function j_(n){var e=g(i(n),2),t=e[0],r=e[1],o=l((function(n){return r((function(e){return l_(n,e)}))}),[]);return[t,r,o]}var P_="undefined"!=typeof window?s:u;function I_(n){var e=g(i(!1),2),t=e[0],r=e[1],o=g(i((function(){return function(n){var e=[];return{get:function(){return e},reset:function(){e=[]},push:function(t){e.push(t),n()}}}((function(){return r(!0)}))})),1),a=o[0];return P_((function(){if(t){var e=a.get();e.length&&(n(e),a.reset()),r(!1)}else a.reset()}),[t]),a}var A_=e(null);function z_(n){var e=n.children,t=wx(),o=l((function(n){var e,r,o=t.getState(),i=o.nodes,a=void 0===i?[]:i,u=o.setNodes,c=o.hasDefaultNodes,l=o.onNodesChange,s=o.nodeLookup,d=a;try{for(var f=p(n),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(n){e={error:n}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(e)throw e.error}}c?u(d):l&&l(f_({items:d,lookup:s}))}),[]),i=I_(o),a=l((function(n){var e,r,o=t.getState(),i=o.edges,a=void 0===i?[]:i,u=o.setEdges,c=o.hasDefaultEdges,l=o.onEdgesChange,s=o.edgeLookup,d=a;try{for(var f=p(n),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(n){e={error:n}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(e)throw e.error}}c?u(d):l&&l(f_({items:d,lookup:s}))}),[]),u=I_(a),c=r((function(){return{nodeQueue:i,edgeQueue:u}}),[]);return E.jsx(A_.Provider,{value:c,children:e})}var T_=function(){var n=wx();return r((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,a=n.getState(),u=g(a.transform,3),c=u[0],l=u[1],s=u[2],d=a.panZoom;null==d||d.setViewport({x:null!==(r=e.x)&&void 0!==r?r:c,y:null!==(o=e.y)&&void 0!==o?o:l,zoom:null!==(i=e.zoom)&&void 0!==i?i:s},{duration:null==t?void 0:t.duration})},getViewport:function(){var e=g(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,l=t.panZoom;return!!l&&m_({nodeLookup:r,width:o,height:i,nodeOrigin:a,minZoom:u,maxZoom:c,panZoom:l},e)},setCenter:function(e,t,r){var o=n.getState(),i=o.width,a=o.height,u=o.maxZoom,c=o.panZoom,l=void 0!==(null==r?void 0:r.zoom)?r.zoom:u,s=i/2-e*l,d=a/2-t*l;null==c||c.setViewport({x:s,y:d,zoom:l},{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,l=o.panZoom,s=Rx(e,i,a,u,c,null!==(r=null==t?void 0:t.padding)&&void 0!==r?r:.1);null==l||l.setViewport(s,{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,l=u.y,s={x:e.x-c,y:e.y-l};return Px(s,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(),a=i.x,u=i.y,c=function(n,e){var t=n.x,r=n.y,o=g(e,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}}(e,r);return{x:c.x+a,y:c.y+u}}}}),[])},B_=function(n){return!!n.panZoom};function L_(){var n=this,e=T_(),o=wx(),i=function(){var n=t(A_);if(!n)throw new Error("useBatchContext must be used within a BatchProvider");return n}(),a=mx(B_),u=r((function(){var e=function(n){return o.getState().nodeLookup.get(n)},t=function(n){i.nodeQueue.push(n)},r=function(n){var e,t,r,i,a=o.getState(),u=a.nodeLookup,c=a.nodeOrigin,l=Yx(n)?n:u.get(n.id),s=l.parentId?function(n,e,t,r){var o,i;void 0===r&&(r=[0,0]);for(var a=e,u=d({},n);a;){var c=t.get(e);if(a=null==c?void 0:c.parentId,c){var l=c.origin||r,s=(null!==(o=c.measured.width)&&void 0!==o?o:0)*l[0],f=(null!==(i=c.measured.height)&&void 0!==i?i:0)*l[1];u.x+=c.position.x-s,u.y+=c.position.y-f}}return u}(l.position,l.parentId,u,c):l.position,f={id:l.id,position:s,width:null!==(t=null===(e=l.measured)||void 0===e?void 0:e.width)&&void 0!==t?t:l.width,height:null!==(i=null===(r=l.measured)||void 0===r?void 0:r.height)&&void 0!==i?i:l.height,data:l.data};return Ix(f)},a=function(n,e,r){void 0===r&&(r={replace:!1}),t((function(t){return t.map((function(t){if(t.id===n){var o="function"==typeof e?e(t):e;return r.replace&&Yx(o)?o:d(d({},t),o)}return t}))}))};return{getNodes:function(){return o.getState().nodes.map((function(n){return d({},n)}))},getNode:function(n){var t;return null===(t=e(n))||void 0===t?void 0:t.internals.userNode},getInternalNode:e,getEdges:function(){var n=o.getState().edges;return(void 0===n?[]:n).map((function(n){return d({},n)}))},getEdge:function(n){return o.getState().edgeLookup.get(n)},setNodes:t,setEdges:function(n){i.edgeQueue.push(n)},addNodes:function(n){var e=Array.isArray(n)?n:[n];i.nodeQueue.push((function(n){return y(y([],g(n),!1),g(e),!1)}))},addEdges:function(n){var e=Array.isArray(n)?n:[n];i.edgeQueue.push((function(n){return y(y([],g(n),!1),g(e),!1)}))},toObject:function(){var n=o.getState(),e=n.nodes,t=void 0===e?[]:e,r=n.edges,i=void 0===r?[]:r,a=g(n.transform,3),u=a[0],c=a[1],l=a[2];return{nodes:t.map((function(n){return d({},n)})),edges:i.map((function(n){return d({},n)})),viewport:{x:u,y:c,zoom:l}}},deleteElements:function(e){return h(n,[e],void 0,(function(n){var e,t,r,i,a,u,c,l,s,d,f,h,p,g,y,m,w=n.nodes,b=void 0===w?[]:w,x=n.edges,_=void 0===x?[]:x;return v(this,(function(n){switch(n.label){case 0:return e=o.getState(),t=e.nodes,r=e.edges,i=e.onNodesDelete,a=e.onEdgesDelete,u=e.triggerNodeChanges,c=e.triggerEdgeChanges,l=e.onDelete,s=e.onBeforeDelete,[4,b_({nodesToRemove:b,edgesToRemove:_,nodes:t,edges:r,onBeforeDelete:s})];case 1:return d=n.sent(),f=d.nodes,h=d.edges,p=h.length>0,g=f.length>0,p&&(y=h.map(h_),null==a||a(h),c(y)),g&&(m=f.map(h_),null==i||i(f),u(m)),(g||p)&&(null==l||l({nodes:f,edges:h})),[2,{deletedNodes:f,deletedEdges:h}]}}))}))},getIntersectingNodes:function(n,e,t){void 0===e&&(e=!0);var i=Fx(n),a=i?n:r(n),u=void 0!==t;return a?(t||o.getState().nodes).filter((function(t){var r=o.getState().nodeLookup.get(t.id);if(r&&!i&&(t.id===n.id||!r.internals.positionAbsolute))return!1;var c=Ix(u?t:r),l=Dx(c,a);return e&&l>0||l>=a.width*a.height})):[]},isNodeIntersecting:function(n,e,t){void 0===t&&(t=!0);var o=Fx(n)?n:r(n);if(!o)return!1;var i=Dx(o,e);return t&&i>0||i>=o.width*o.height},updateNode:a,updateNodeData:function(n,e,t){void 0===t&&(t={replace:!1}),a(n,(function(n){var r="function"==typeof e?e(n):e;return t.replace?d(d({},n),{data:r}):d(d({},n),{data:d(d({},n.data),r)})}),t)}}}),[]);return r((function(){return d(d(d({},u),e),{viewportInitialized:a})}),[a])}var D_=function(n){return n.updateNodeInternals};var R_=function(n){return function(e){return n?g_(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map((function(n){return n.id})):Array.from(e.nodeLookup.keys())}};var V_=e(null),H_=V_.Provider;V_.Consumer;var Y_="ink-flow__node-desc",X_="ink-flow__edge-desc";function F_(n){var e=n.sourceX,t=n.sourceY,r=n.targetX,o=n.targetY,i=n.sourceControlX,a=n.sourceControlY,u=.125*e+.375*i+.375*n.targetControlX+.125*r,c=.125*t+.375*a+.375*n.targetControlY+.125*o;return[u,c,Math.abs(u-e),Math.abs(c-t)]}function Z_(n,e){return n>=0?.5*n:25*e*Math.sqrt(-n)}function U_(n){var e=n.pos,t=n.x1,r=n.y1,o=n.x2,i=n.y2,a=n.c;switch(e){case Cm.Left:return[t-Z_(t-o,a),r];case Cm.Right:return[t+Z_(o-t,a),r];case Cm.Top:return[t,r-Z_(r-i,a)];case Cm.Bottom:return[t,r+Z_(i-r,a)]}}function G_(n){var e=n.sourceX,t=n.sourceY,r=n.targetX,o=n.targetY,i=Math.abs(r-e)/2,a=r<e?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}var W_,q_=function(n){var e=n.source,t=n.sourceHandle,r=n.target,o=n.targetHandle;return"xy-edge__".concat(e).concat(t||"","-").concat(r).concat(o||"")};var $_=((W_={})[Cm.Left]={x:-1,y:0},W_[Cm.Right]={x:1,y:0},W_[Cm.Top]={x:0,y:-1},W_[Cm.Bottom]={x:0,y:1},W_),K_=function(n){var e=n.source,t=n.sourcePosition,r=void 0===t?Cm.Bottom:t,o=n.target;return r===Cm.Left||r===Cm.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1}},Q_=function(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))};function J_(n){var e=n.sourceX,t=n.sourceY,r=n.sourcePosition,o=void 0===r?Cm.Bottom:r,i=n.targetX,a=n.targetY,u=n.targetPosition,c=void 0===u?Cm.Top:u,l=n.borderRadius,s=void 0===l?5:l,d=n.centerX,f=n.centerY,h=n.offset,v=g(function(n){var e,t,r,o,i=n.source,a=n.sourcePosition,u=void 0===a?Cm.Bottom:a,c=n.target,l=n.targetPosition,s=void 0===l?Cm.Top:l,d=n.center,f=n.offset,h=$_[u],v=$_[s],p={x:i.x+h.x*f,y:i.y+h.y*f},m={x:c.x+v.x*f,y:c.y+v.y*f},w=K_({source:p,sourcePosition:u,target:m}),b=0!==w.x?"x":"y",x=w[b],_=[],E={x:0,y:0},S={x:0,y:0},k=g(G_({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),N=k[0],C=k[1],O=k[2],M=k[3];if(h[b]*v[b]==-1){r=null!==(e=d.x)&&void 0!==e?e:N,o=null!==(t=d.y)&&void 0!==t?t:C;var j=[{x:r,y:p.y},{x:r,y:m.y}],P=[{x:p.x,y:o},{x:m.x,y:o}];_=h[b]===x?"x"===b?j:P:"x"===b?P:j}else{var I=[{x:p.x,y:m.y}],A=[{x:m.x,y:p.y}];if(_="x"===b?h.x===x?A:I:h.y===x?I:A,u===s){var z=Math.abs(i[b]-c[b]);if(z<=f){var T=Math.min(f-1,f-z);h[b]===x?E[b]=(p[b]>i[b]?-1:1)*T:S[b]=(m[b]>c[b]?-1:1)*T}}if(u!==s){var B="x"===b?"y":"x",L=h[b]===v[B],D=p[B]>m[B],R=p[B]<m[B];(1===h[b]&&(!L&&D||L&&R)||1!==h[b]&&(!L&&R||L&&D))&&(_="x"===b?I:A)}var V={x:p.x+E.x,y:p.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[y(y([i,{x:p.x+E.x,y:p.y+E.y}],g(_),!1),[{x:m.x+S.x,y:m.y+S.y},c],!1),r,o,O,M]}({source:{x:e,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],m=v[1],w=v[2],b=v[3],x=v[4],_=p.reduce((function(n,e,t){var r="";return r=t>0&&t<p.length-1?function(n,e,t,r){var o=Math.min(Q_(n,e)/2,Q_(e,t)/2,r),i=e.x,a=e.y;if(n.x===i&&i===t.x||n.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(n.y===a){var u=n.x<t.x?-1:1,c=n.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 l=n.x<t.x?1:-1,s=n.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*s,"Q ").concat(i,",").concat(a," ").concat(i+o*l,",").concat(a)}(p[t-1],e,p[t+1],s):"".concat(0===t?"M":"L").concat(e.x," ").concat(e.y),n+=r}),"");return[_,m,w,b,x]}var nE=function(n){return{connectOnClick:n.connectOnClick,noPanClassName:n.noPanClassName,rfId:n.rfId}};var eE=c(Lx((function(n,e){var r,o,i=n.type,a=void 0===i?"source":i,u=n.position,c=void 0===u?Cm.Top:u,l=n.isValidConnection,s=n.isConnectable,h=void 0===s||s,v=n.isConnectableStart,p=void 0===v||v,g=n.isConnectableEnd,y=void 0===g||g,m=n.id,w=n.onConnect,b=n.children,x=n.className,_=n.onMouseDown,S=n.onTouchStart,k=f(n,["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"]),N=m||null,C="target"===a,M=wx(),j=t(V_),P=mx(nE,e_),I=P.connectOnClick,A=P.noPanClassName,z=P.rfId,T=mx(function(n,e,t){return function(r){var o=r.connectionStartHandle,i=r.connectionEndHandle,a=r.connectionClickStartHandle,u=r.connectionMode,c=r.connectionStatus,l=(null==i?void 0:i.nodeId)===n&&(null==i?void 0:i.handleId)===e&&(null==i?void 0:i.type)===t;return{connectingFrom:(null==o?void 0:o.nodeId)===n&&(null==o?void 0:o.handleId)===e&&(null==o?void 0:o.type)===t,connectingTo:l,clickConnecting:(null==a?void 0:a.nodeId)===n&&(null==a?void 0:a.handleId)===e&&(null==a?void 0:a.type)===t,isPossibleEndHandle:u===_m.Strict?(null==o?void 0:o.type)!==t:n!==(null==o?void 0:o.nodeId)||e!==(null==o?void 0:o.handleId),connectionInProcess:!!o,valid:l&&"valid"===c}}}(j,N,a),e_),B=T.connectingFrom,L=T.connectingTo,D=T.clickConnecting,R=T.isPossibleEndHandle,V=T.connectionInProcess,H=T.valid;j||null===(o=(r=M.getState()).onError)||void 0===o||o.call(r,"010",Ky.error010());var Y=function(n){var e=M.getState(),t=e.defaultEdgeOptions,r=e.onConnect,o=e.hasDefaultEdges,i=d(d({},t),n);if(o){var a=M.getState(),u=a.edges;(0,a.setEdges)(function(n,e){return n.source&&n.target?function(n,e){return e.some((function(e){return!(e.source!==n.source||e.target!==n.target||e.sourceHandle!==n.sourceHandle&&(e.sourceHandle||n.sourceHandle)||e.targetHandle!==n.targetHandle&&(e.targetHandle||n.targetHandle))}))}(t="id"in(r=n)&&"source"in r&&"target"in r?d({},n):d(d({},n),{id:q_(n)}),e)?e:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,e.concat(t)):e;var t,r}(i,u))}null==r||r(i),null==w||w(i)},X=function(n){if(j){var e=Wx(n.nativeEvent);if(p&&(e&&0===n.button||!e)){var t=M.getState();Km.onPointerDown(n.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:C,handleId:N,nodeId:j,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:Y,isValidConnection:l||t.isValidConnection,getTransform:function(){return M.getState().transform},getConnectionStartHandle:function(){return M.getState().connectionStartHandle}})}e?null==_||_(n):null==S||S(n)}};return E.jsx("div",d({"data-handleid":N,"data-nodeid":j,"data-handlepos":c,"data-id":"".concat(z,"-").concat(j,"-").concat(N,"-").concat(a),className:O(["ink-flow__handle","ink-flow__handle-".concat(c),"nodrag",A,x,{source:!C,target:C,connectable:h,connectablestart:p,connectableend:y,clickconnecting:D,connectingfrom:B,connectingto:L,valid:H,connectionindicator:h&&(!V||R)&&(V?y:p)}]),onMouseDown:X,onTouchStart:X,onClick:I?function(n){var e=M.getState(),t=e.onClickConnectStart,r=e.onClickConnectEnd,o=e.connectionClickStartHandle,i=e.connectionMode,u=e.isValidConnection,c=e.lib,s=e.rfId;if(j&&(o||p)){if(!o)return null==t||t(n.nativeEvent,{nodeId:j,handleId:N,handleType:a}),void M.setState({connectionClickStartHandle:{nodeId:j,type:a,handleId:N}});var d=function(n){var e;return(null===(e=n.getRootNode)||void 0===e?void 0:e.call(n))||(null===window||void 0===window?void 0:window.document)}(n.target),f=l||u,h=Km.isValid(n.nativeEvent,{handle:{nodeId:j,id:N,type:a},connectionMode:i,fromNodeId:o.nodeId,fromHandleId:o.handleId||null,fromType:o.type,isValidConnection:f,flowId:s,doc:d,lib:c}),v=h.connection;h.isValid&&v&&Y(v),null==r||r(n),M.setState({connectionClickStartHandle:null})}}:void 0,ref:e},k,{children:b}))})));var tE={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},rE={input:function(n){var e=n.data,t=n.isConnectable,r=n.sourcePosition,o=void 0===r?Cm.Bottom:r;return E.jsxs(E.Fragment,{children:[null==e?void 0:e.label,E.jsx(eE,{type:"source",position:o,isConnectable:t})]})},default:function(n){var e=n.data,t=n.isConnectable,r=n.targetPosition,o=void 0===r?Cm.Top:r,i=n.sourcePosition,a=void 0===i?Cm.Bottom:i;return E.jsxs(E.Fragment,{children:[E.jsx(eE,{type:"target",position:o,isConnectable:t}),null==e?void 0:e.label,E.jsx(eE,{type:"source",position:a,isConnectable:t})]})},output:function(n){var e=n.data,t=n.isConnectable,r=n.targetPosition,o=void 0===r?Cm.Top:r;return E.jsxs(E.Fragment,{children:[E.jsx(eE,{type:"target",position:o,isConnectable:t}),null==e?void 0:e.label]})},group:function(){return null}};function oE(n){var e=n.id,t=n.store,r=n.unselect,o=void 0!==r&&r,i=n.nodeRef,a=t.getState(),u=a.addSelectedNodes,c=a.unselectNodesAndEdges,l=a.multiSelectionActive,s=a.nodeLookup,d=a.onError,f=s.get(e);f?(t.setState({nodesSelectionActive:!1}),f.selected?(o||f.selected&&l)&&(c({nodes:[f],edges:[]}),requestAnimationFrame((function(){var n;return null===(n=null==i?void 0:i.current)||void 0===n?void 0:n.blur()}))):u([e])):null==d||d("012",Ky.error012(e))}var iE=function(n){return function(e){return e.selected&&(e.draggable||n&&void 0===e.draggable)}};function aE(n){var e,t=n.id,r=n.onClick,o=n.onMouseEnter,c=n.onMouseMove,s=n.onMouseLeave,f=n.onContextMenu,h=n.onDoubleClick,v=n.nodesDraggable,y=n.elementsSelectable,m=n.nodesConnectable,w=n.nodesFocusable,b=n.resizeObserver,x=n.noDragClassName,_=n.noPanClassName,S=n.disableKeyboardA11y,k=n.rfId,N=n.nodeTypes,C=n.nodeExtent,M=n.nodeOrigin,j=n.onError,P=mx((function(n){var e=n.nodeLookup.get(t),r=n.parentLookup.has(t);return{node:e,internals:e.internals,isParent:r}}),e_),I=P.node,A=P.internals,z=P.isParent,T=I.type||"default",B=(null==N?void 0:N[T])||rE[T];void 0===B&&(null==j||j("003",Ky.error003(T)),T="default",B=rE.default);var L=!!(I.draggable||v&&void 0===I.draggable),D=!!(I.selectable||y&&void 0===I.selectable),R=!!(I.connectable||m&&void 0===I.connectable),V=!!(I.focusable||w&&void 0===I.focusable),H=wx(),Y=function(n){var e,t,r,o,i,a;return void 0!==(null!==(r=null!==(t=null===(e=n.measured)||void 0===e?void 0:e.width)&&void 0!==t?t:n.width)&&void 0!==r?r:n.initialWidth)&&void 0!==(null!==(a=null!==(i=null===(o=n.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:n.height)&&void 0!==a?a:n.initialHeight)}(I),X=function(n){var e=n.node,t=n.nodeType,r=n.hasDimensions,o=n.resizeObserver,i=wx(),c=a(null),l=a(null),s=a(e.sourcePosition),d=a(e.targetPosition),f=a(t),h=r&&!!e.internals.handleBounds&&!e.hidden;return u((function(){!c.current||h&&l.current===c.current||(l.current&&(null==o||o.unobserve(l.current)),null==o||o.observe(c.current),l.current=c.current)}),[h]),u((function(){return function(){l.current&&(null==o||o.unobserve(l.current),l.current=null)}}),[]),u((function(){if(c.current){var n=f.current!==t,r=s.current!==e.sourcePosition,o=d.current!==e.targetPosition;(n||r||o)&&(f.current=t,s.current=e.sourcePosition,d.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:c.current,force:!0}]])))}}),[e.id,t,e.sourcePosition,e.targetPosition]),c}({node:I,nodeType:T,hasDimensions:Y,resizeObserver:b}),F=function(n){var e=n.nodeRef,t=n.disabled,r=void 0!==t&&t,o=n.noDragClassName,c=n.handleSelector,l=n.nodeId,s=n.isSelectable,d=wx(),f=g(i(!1),2),h=f[0],v=f[1],p=a();return u((function(){p.current=Zm({getStoreItems:function(){return d.getState()},onNodeMouseDown:function(n){oE({id:n,store:d,nodeRef:e})},onDragStart:function(){v(!0)},onDragStop:function(){v(!1)}})}),[]),u((function(){var n,t;if(r)null===(n=p.current)||void 0===n||n.destroy();else if(e.current)return null===(t=p.current)||void 0===t||t.update({noDragClassName:o,handleSelector:c,domNode:e.current,isSelectable:s,nodeId:l}),function(){var n;null===(n=p.current)||void 0===n||n.destroy()}}),[o,c,r,s,e,l]),h}({nodeRef:X,disabled:I.hidden||!L,noDragClassName:x,handleSelector:I.dragHandle,nodeId:t,isSelectable:D}),Z=function(){var n=wx(),e=l((function(e){var t,r,o=n.getState(),i=o.nodeExtent,a=o.snapToGrid,u=o.snapGrid,c=o.nodesDraggable,l=o.onError,s=o.updateNodePositions,d=o.nodeLookup,f=o.nodeOrigin,h=new Map,v=iE(c),y=a?u[0]:5,m=a?u[1]:5,w=e.direction.x*y*e.factor,b=e.direction.y*m*e.factor;try{for(var x=p(d),_=x.next();!_.done;_=x.next()){var E=g(_.value,2)[1];if(v(E)){var S={x:E.internals.positionAbsolute.x+w,y:E.internals.positionAbsolute.y+b};a&&(S=jx(S,u));var k=w_({nodeId:E.id,nextPosition:S,nodeLookup:d,nodeExtent:i,nodeOrigin:f,onError:l}),N=k.position,C=k.positionAbsolute;E.position=N,E.internals.positionAbsolute=C,h.set(E.id,E)}}}catch(n){t={error:n}}finally{try{_&&!_.done&&(r=x.return)&&r.call(x)}finally{if(t)throw t.error}}s(h)}),[]);return e}();if(I.hidden)return null;var U=Ox(I),G=function(n){var e,t,r,o,i,a,u,c,l,s;return void 0===n.internals.handleBounds?{width:null!==(t=null!==(e=n.width)&&void 0!==e?e:n.initialWidth)&&void 0!==t?t:null===(r=n.style)||void 0===r?void 0:r.width,height:null!==(i=null!==(o=n.height)&&void 0!==o?o:n.initialHeight)&&void 0!==i?i:null===(a=n.style)||void 0===a?void 0:a.height}:{width:null!==(u=n.width)&&void 0!==u?u:null===(c=n.style)||void 0===c?void 0:c.width,height:null!==(l=n.height)&&void 0!==l?l:null===(s=n.style)||void 0===s?void 0:s.height}}(I),W=C?Cx(A.positionAbsolute,C):A.positionAbsolute,q=Hx(d(d(d({},W),U),{origin:I.origin||M})),$=D||L||r||o||c||s,K=o?function(n){return o(n,d({},A.userNode))}:void 0,Q=c?function(n){return c(n,d({},A.userNode))}:void 0,J=s?function(n){return s(n,d({},A.userNode))}:void 0,nn=f?function(n){return f(n,d({},A.userNode))}:void 0,en=h?function(n){return h(n,d({},A.userNode))}:void 0;return E.jsx("div",{className:O(["ink-flow__node","ink-flow__node-".concat(T),(e={},e[_]=L,e),I.className,{selected:I.selected,selectable:D,parent:z,draggable:L,dragging:F}]),ref:X,style:d(d({zIndex:A.z,transform:"translate(".concat(q.x,"px,").concat(q.y,"px)"),pointerEvents:$?"all":"none",visibility:Y?"visible":"hidden"},I.style),G),"data-id":t,"data-testid":"rf__node-".concat(t),onMouseEnter:K,onMouseMove:Q,onMouseLeave:J,onContextMenu:nn,onClick:function(n){var e=H.getState(),o=e.selectNodesOnDrag,i=e.nodeDragThreshold;D&&(!o||!L||i>0)&&oE({id:t,store:H,nodeRef:X}),r&&r(n,d({},A.userNode))},onDoubleClick:en,onKeyDown:V?function(n){if(!Gx(n.nativeEvent)&&!S)if(Jy.includes(n.key)&&D){var e="Escape"===n.key;oE({id:t,store:H,unselect:e,nodeRef:X})}else L&&I.selected&&Object.prototype.hasOwnProperty.call(tE,n.key)&&(H.setState({ariaLiveMessage:"Moved selected node ".concat(n.key.replace("Arrow","").toLowerCase(),". New position, x: ").concat(~~W.x,", y: ").concat(~~W.y)}),Z({direction:tE[n.key],factor:n.shiftKey?4:1}))}:void 0,tabIndex:V?0:void 0,role:V?"button":void 0,"aria-describedby":S?void 0:"".concat(Y_,"-").concat(k),"aria-label":I.ariaLabel,children:E.jsx(H_,{value:t,children:E.jsx(B,d({id:t,data:I.data,type:T,positionAbsoluteX:W.x,positionAbsoluteY:W.y,selected:I.selected,isConnectable:R,sourcePosition:I.sourcePosition,targetPosition:I.targetPosition,dragging:F,dragHandle:I.dragHandle,zIndex:A.z},U))})})}var uE=function(n){return{nodesDraggable:n.nodesDraggable,nodesConnectable:n.nodesConnectable,nodesFocusable:n.nodesFocusable,elementsSelectable:n.elementsSelectable,onError:n.onError}};function cE(n){var e,t=mx(uE,e_),r=t.nodesDraggable,o=t.nodesConnectable,a=t.nodesFocusable,c=t.elementsSelectable,s=t.onError,d=mx(l(R_(e=!1),[e]),e_),f=function(){var n=mx(D_),e=g(i((function(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver((function(e){var t=new Map;e.forEach((function(n){var e=n.target.getAttribute("data-id");t.set(e,{id:e,nodeElement:n.target})})),n(t)}))})),1),t=e[0];return u((function(){return function(){null==t||t.disconnect()}}),[t]),t}();return E.jsx("div",{className:"ink-flow__nodes",style:t_,children:d.map((function(e){return E.jsx(aE,{id:e,nodeTypes:n.nodeTypes,nodeOrigin:n.nodeOrigin,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,resizeObserver:f,nodesDraggable:r,nodesConnectable:o,nodesFocusable:a,elementsSelectable:c,onError:s},e)}))})}cE.displayName="NodeRenderer";var lE,sE=c(cE),dE=((lE={})[Nm.Arrow]=function(n){var e=n.color,t=void 0===e?"none":e,r=n.strokeWidth,o=void 0===r?1:r;return E.jsx("polyline",{style:{stroke:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"})},lE[Nm.ArrowClosed]=function(n){var e=n.color,t=void 0===e?"none":e,r=n.strokeWidth,o=void 0===r?1:r;return E.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},lE);function fE(n,e){if(!n)return"";if("string"==typeof n)return n;var t=e?"".concat(e,"__"):"";return"".concat(t).concat(Object.keys(n).sort().map((function(e){return"".concat(e,"=").concat(n[e])})).join("&"))}var hE=function(n){var e=n.id,t=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,l=n.markerUnits,s=void 0===l?"strokeWidth":l,d=n.strokeWidth,f=n.orient,h=void 0===f?"auto-start-reverse":f,v=function(n){var e=wx(),t=r((function(){var t,r;return Object.prototype.hasOwnProperty.call(dE,n)?dE[n]:(null===(r=(t=e.getState()).onError)||void 0===r||r.call(t,"009",Ky.error009(n)),null)}),[n]);return t}(t);return v?E.jsx("marker",{className:"ink-flow__arrowhead",id:e,markerWidth:"".concat(a),markerHeight:"".concat(c),viewBox:"-10 -10 20 20",markerUnits:s,orient:h,refX:"0",refY:"0",children:E.jsx(v,{color:o,strokeWidth:d})}):null},vE=function(n){var e=n.defaultColor,t=n.rfId,o=mx((function(n){return n.edges})),i=mx((function(n){return n.defaultEdgeOptions})),a=r((function(){var n=function(n,e){var t=e.id,r=e.defaultColor,o=e.defaultMarkerStart,i=e.defaultMarkerEnd,a=new Set;return n.reduce((function(n,e){return[e.markerStart||o,e.markerEnd||i].forEach((function(e){if(e&&"object"==typeof e){var o=fE(e,t);a.has(o)||(n.push(d({id:o,color:e.color||r},e)),a.add(o))}})),n}),[]).sort((function(n,e){return n.id.localeCompare(e.id)}))}(o,{id:t,defaultColor:e,defaultMarkerStart:null==i?void 0:i.markerStart,defaultMarkerEnd:null==i?void 0:i.markerEnd});return n}),[o,i,t,e]);return a.length?E.jsx("svg",{className:"ink-flow__marker",children:E.jsx("defs",{children:a.map((function(n){return E.jsx(hE,{id:n.id,type:n.type,color:n.color,width:n.width,height:n.height,markerUnits:n.markerUnits,strokeWidth:n.strokeWidth,orient:n.orient},n.id)}))})}):null};vE.displayName="MarkerDefinitions";var pE=c(vE);function gE(n){var e=n.x,t=n.y,r=n.label,o=n.labelStyle,a=void 0===o?{}:o,u=n.labelShowBg,c=void 0===u||u,s=n.labelBgStyle,h=void 0===s?{}:s,v=n.labelBgPadding,p=void 0===v?[2,4]:v,y=n.labelBgBorderRadius,m=void 0===y?2:y,w=n.children,b=n.className,x=f(n,["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"]),_=g(i({x:1,y:0,width:0,height:0}),2),S=_[0],k=_[1],N=O(["ink-flow__edge-textwrapper",b]),C=l((function(n){if(null!==n){var e=n.getBBox();k({x:e.x,y:e.y,width:e.width,height:e.height})}}),[]);return void 0!==r&&r?E.jsxs("g",d({transform:"translate(".concat(e-S.width/2," ").concat(t-S.height/2,")"),className:N,visibility:S.width?"visible":"hidden"},x,{children:[c&&E.jsx("rect",{width:S.width+2*p[0],x:-p[0],y:-p[1],height:S.height+2*p[1],className:"ink-flow__edge-textbg",style:h,rx:m,ry:m}),E.jsx("text",{className:"ink-flow__edge-text",y:S.height/2,dy:"0.3em",ref:C,style:a,children:r}),w]})):null}gE.displayName="EdgeText";var yE=c(gE);function mE(n){var e=n.id,t=n.path,r=n.labelX,o=n.labelY,i=n.label,a=n.labelStyle,u=n.labelShowBg,c=n.labelBgStyle,l=n.labelBgPadding,s=n.labelBgBorderRadius,d=n.style,f=n.markerEnd,h=n.markerStart,v=n.className,p=n.interactionWidth,g=void 0===p?20:p;return E.jsxs(E.Fragment,{children:[E.jsx("path",{id:e,style:d,d:t,fill:"none",className:O(["ink-flow__edge-path",v]),markerEnd:f,markerStart:h}),g&&E.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:g,className:"ink-flow__edge-interaction"}),i&&Mx(r)&&Mx(o)?E.jsx(yE,{x:r,y:o,label:i,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:s}):null]})}function wE(n){var e=n.pos,t=n.x1,r=n.y1,o=n.x2,i=n.y2;return e===Cm.Left||e===Cm.Right?[.5*(t+o),r]:[t,.5*(r+i)]}function bE(n){return c((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,u=e.sourcePosition,c=void 0===u?Cm.Bottom:u,l=e.targetPosition,s=void 0===l?Cm.Top:l,d=e.label,f=e.labelStyle,h=e.labelShowBg,v=e.labelBgStyle,p=e.labelBgPadding,y=e.labelBgBorderRadius,m=e.style,w=e.markerEnd,b=e.markerStart,x=e.interactionWidth,_=g(function(n){var e=n.sourceX,t=n.sourceY,r=n.sourcePosition,o=void 0===r?Cm.Bottom:r,i=n.targetX,a=n.targetY,u=n.targetPosition,c=void 0===u?Cm.Top:u,l=g(wE({pos:o,x1:e,y1:t,x2:i,y2:a}),2),s=l[0],d=l[1],f=g(wE({pos:c,x1:i,y1:a,x2:e,y2:t}),2),h=f[0],v=f[1],p=g(F_({sourceX:e,sourceY:t,targetX:i,targetY:a,sourceControlX:s,sourceControlY:d,targetControlX:h,targetControlY:v}),4),y=p[0],m=p[1],w=p[2],b=p[3];return["M".concat(e,",").concat(t," C").concat(s,",").concat(d," ").concat(h,",").concat(v," ").concat(i,",").concat(a),y,m,w,b]}({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s}),3),S=_[0],k=_[1],N=_[2],C=n.isInternal?void 0:t;return E.jsx(mE,{id:C,path:S,labelX:k,labelY:N,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:y,style:m,markerEnd:w,markerStart:b,interactionWidth:x})}))}var xE=bE({isInternal:!1}),_E=bE({isInternal:!0});function EE(n){return c((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,u=e.label,c=e.labelStyle,l=e.labelShowBg,s=e.labelBgStyle,d=e.labelBgPadding,f=e.labelBgBorderRadius,h=e.style,v=e.sourcePosition,p=void 0===v?Cm.Bottom:v,y=e.targetPosition,m=void 0===y?Cm.Top:y,w=e.markerEnd,b=e.markerStart,x=e.pathOptions,_=e.interactionWidth,S=g(J_({sourceX:r,sourceY:o,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:null==x?void 0:x.borderRadius,offset:null==x?void 0:x.offset}),3),k=S[0],N=S[1],C=S[2],O=n.isInternal?void 0:t;return E.jsx(mE,{id:O,path:k,labelX:N,labelY:C,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:w,markerStart:b,interactionWidth:_})}))}xE.displayName="SimpleBezierEdge",_E.displayName="SimpleBezierEdgeInternal";var SE=EE({isInternal:!1}),kE=EE({isInternal:!0});function NE(n){return c((function(e){var t,o=e.id,i=f(e,["id"]),a=n.isInternal?void 0:o;return E.jsx(SE,d({},i,{id:a,pathOptions:r((function(){var n;return{borderRadius:0,offset:null===(n=i.pathOptions)||void 0===n?void 0:n.offset}}),[null===(t=i.pathOptions)||void 0===t?void 0:t.offset])}))}))}SE.displayName="SmoothStepEdge",kE.displayName="SmoothStepEdgeInternal";var CE=NE({isInternal:!1}),OE=NE({isInternal:!0});function ME(n){return c((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,u=e.label,c=e.labelStyle,l=e.labelShowBg,s=e.labelBgStyle,d=e.labelBgPadding,f=e.labelBgBorderRadius,h=e.style,v=e.markerEnd,p=e.markerStart,y=e.interactionWidth,m=g(function(n){var e=n.sourceX,t=n.sourceY,r=n.targetX,o=n.targetY,i=g(G_({sourceX:e,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],l=i[3];return["M ".concat(e,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,l]}({sourceX:r,sourceY:o,targetX:i,targetY:a}),3),w=m[0],b=m[1],x=m[2],_=n.isInternal?void 0:t;return E.jsx(mE,{id:_,path:w,labelX:b,labelY:x,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:v,markerStart:p,interactionWidth:y})}))}CE.displayName="StepEdge",OE.displayName="StepEdgeInternal";var jE=ME({isInternal:!1}),PE=ME({isInternal:!0});function IE(n){return c((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,u=e.sourcePosition,c=void 0===u?Cm.Bottom:u,l=e.targetPosition,s=void 0===l?Cm.Top:l,d=e.label,f=e.labelStyle,h=e.labelShowBg,v=e.labelBgStyle,p=e.labelBgPadding,y=e.labelBgBorderRadius,m=e.style,w=e.markerEnd,b=e.markerStart,x=e.pathOptions,_=e.interactionWidth,S=g(function(n){var e=n.sourceX,t=n.sourceY,r=n.sourcePosition,o=void 0===r?Cm.Bottom:r,i=n.targetX,a=n.targetY,u=n.targetPosition,c=void 0===u?Cm.Top:u,l=n.curvature,s=void 0===l?.25:l,d=g(U_({pos:o,x1:e,y1:t,x2:i,y2:a,c:s}),2),f=d[0],h=d[1],v=g(U_({pos:c,x1:i,y1:a,x2:e,y2:t,c:s}),2),p=v[0],y=v[1],m=g(F_({sourceX:e,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:y}),4),w=m[0],b=m[1],x=m[2],_=m[3];return["M".concat(e,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(y," ").concat(i,",").concat(a),w,b,x,_]}({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s,curvature:null==x?void 0:x.curvature}),3),k=S[0],N=S[1],C=S[2],O=n.isInternal?void 0:t;return E.jsx(mE,{id:O,path:k,labelX:N,labelY:C,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:y,style:m,markerEnd:w,markerStart:b,interactionWidth:_})}))}jE.displayName="StraightEdge",PE.displayName="StraightEdgeInternal";var AE=IE({isInternal:!1}),zE=IE({isInternal:!0});AE.displayName="BezierEdge",zE.displayName="BezierEdgeInternal";var TE={default:zE,straight:PE,step:OE,smoothstep:kE,simplebezier:_E},BE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},LE=function(n,e,t){return t===Cm.Left?n-e:t===Cm.Right?n+e:n},DE=function(n,e,t){return t===Cm.Top?n-e:t===Cm.Bottom?n+e:n},RE="ink-flow__edgeupdater";function VE(n){var e=n.position,t=n.centerX,r=n.centerY,o=n.radius,i=void 0===o?10:o,a=n.onMouseDown,u=n.onMouseEnter,c=n.onMouseOut,l=n.type;return E.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:c,className:O([RE,"".concat(RE,"-").concat(l)]),cx:LE(t,i,e),cy:DE(r,i,e),r:i,stroke:"transparent",fill:"transparent"})}function HE(n){var e=n.isUpdatable,t=n.edgeUpdaterRadius,r=n.edge,o=n.targetHandleId,i=n.sourceHandleId,a=n.sourceX,u=n.sourceY,c=n.targetX,l=n.targetY,s=n.sourcePosition,d=n.targetPosition,f=n.onEdgeUpdate,h=n.onEdgeUpdateStart,v=n.onEdgeUpdateEnd,p=n.setUpdating,g=n.setUpdateHover,y=wx(),m=function(n,e){if(0===n.button){var t=y.getState(),a=t.autoPanOnConnect,u=t.domNode,c=t.isValidConnection,l=t.connectionMode,s=t.connectionRadius,d=t.lib,g=t.onConnectStart,m=t.onConnectEnd,w=t.cancelConnection,b=t.nodeLookup,x=t.rfId,_=t.panBy,E=t.updateConnection,S=e?r.target:r.source,k=(e?o:i)||null,N=e?"target":"source",C=e;p(!0),null==h||h(n,r,N);Km.onPointerDown(n.nativeEvent,{autoPanOnConnect:a,connectionMode:l,connectionRadius:s,domNode:u,handleId:k,nodeId:S,nodeLookup:b,isTarget:C,edgeUpdaterType:N,lib:d,flowId:x,cancelConnection:w,panBy:_,isValidConnection:c,onConnect:function(n){return null==f?void 0:f(r,n)},onConnectStart:g,onConnectEnd:m,onEdgeUpdateEnd:function(n){p(!1),null==v||v(n,r,N)},updateConnection:E,getTransform:function(){return y.getState().transform},getConnectionStartHandle:function(){return y.getState().connectionStartHandle}})}},w=function(){return g(!0)},b=function(){return g(!1)};return E.jsxs(E.Fragment,{children:[("source"===e||!0===e)&&E.jsx(VE,{position:s,centerX:a,centerY:u,radius:t,onMouseDown:function(n){return m(n,!0)},onMouseEnter:w,onMouseOut:b,type:"source"}),("target"===e||!0===e)&&E.jsx(VE,{position:d,centerX:c,centerY:l,radius:t,onMouseDown:function(n){return m(n,!1)},onMouseEnter:w,onMouseOut:b,type:"target"})]})}function YE(n){var e;return n&&!(!n.internals.handleBounds&&!(null===(e=n.handles)||void 0===e?void 0:e.length))&&!!(n.measured.width||n.width||n.initialWidth)}function XE(n){var e,t,r,o;if(!n)return null;var i=[],a=[];try{for(var u=p(n),c=u.next();!c.done;c=u.next()){var l=c.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?i.push(l):"target"===l.type&&a.push(l)}}catch(n){e={error:n}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}return{source:i,target:a}}function FE(n,e,t){var r,o;void 0===t&&(t=null);var i=(null!==(r=null==t?void 0:t.x)&&void 0!==r?r:0)+e.internals.positionAbsolute.x,a=(null!==(o=null==t?void 0:t.y)&&void 0!==o?o:0)+e.internals.positionAbsolute.y,u=null!=t?t:Ox(e),c=u.width,l=u.height;switch(n){case Cm.Top:return[i+c/2,a];case Cm.Right:return[i+c,a+l/2];case Cm.Bottom:return[i+c/2,a+l];case Cm.Left:return[i,a+l/2]}}function ZE(n,e){return n&&(e?n.find((function(n){return n.id===e})):n[0])||null}function UE(n){var e=n.id,t=n.edgesFocusable,o=n.edgesUpdatable,u=n.elementsSelectable,c=n.onClick,s=n.onDoubleClick,f=n.onContextMenu,h=n.onMouseEnter,v=n.onMouseMove,p=n.onMouseLeave,y=n.edgeUpdaterRadius,m=n.onEdgeUpdate,w=n.onEdgeUpdateStart,b=n.onEdgeUpdateEnd,x=n.rfId,_=n.edgeTypes,S=n.noPanClassName,k=n.onError,N=n.disableKeyboardA11y,C=mx((function(n){return n.edgeLookup.get(e)})),M=mx((function(n){return n.defaultEdgeOptions})),j=(C=M?d(d({},M),C):C).type||"default",P=(null==_?void 0:_[j])||TE[j];void 0===P&&(null==k||k("011",Ky.error011(j)),j="default",P=TE.default);var I=!!(C.focusable||t&&void 0===C.focusable),A=void 0!==m&&(C.updatable||o&&void 0===C.updatable),z=!!(C.selectable||u&&void 0===C.selectable),T=a(null),B=g(i(!1),2),L=B[0],D=B[1],R=g(i(!1),2),V=R[0],H=R[1],Y=wx(),X=mx(l((function(n){var t=n.nodeLookup.get(C.source),r=n.nodeLookup.get(C.target);if(!t||!r)return d({zIndex:C.zIndex},BE);var o=function(n){var e,t,r,o,i,a=n.sourceNode,u=n.targetNode;if(!YE(a)||!YE(u))return null;var c=a.internals.handleBounds||XE(a.handles),l=u.internals.handleBounds||XE(u.handles),s=ZE(null!==(e=null==c?void 0:c.source)&&void 0!==e?e:[],n.sourceHandle),d=ZE(n.connectionMode===_m.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:[]),n.targetHandle),f=(null==s?void 0:s.position)||Cm.Bottom,h=(null==d?void 0:d.position)||Cm.Top;if(!s||!d)return null===(i=n.onError)||void 0===i||i.call(n,"008",Ky.error008(s?"target":"source",{id:n.id,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle})),null;var v=g(FE(f,a,s),2),p=v[0],y=v[1],m=g(FE(h,u,d),2);return{sourceX:p,sourceY:y,targetX:m[0],targetY:m[1],sourcePosition:f,targetPosition:h}}({id:e,sourceNode:t,targetNode:r,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:n.connectionMode,onError:k}),i=function(n){var e=n.sourceNode,t=n.targetNode,r=n.selected,o=void 0!==r&&r,i=n.zIndex,a=void 0===i?0:i,u=n.elevateOnSelect;if(void 0===u||!u)return a;var c=o||t.selected||e.selected,l=Math.max(e.internals.z||0,t.internals.z||0,1e3);return a+(c?l:0)}({selected:C.selected,zIndex:C.zIndex,sourceNode:t,targetNode:r,elevateOnSelect:n.elevateEdgesOnSelect});return d({zIndex:i},o||BE)}),[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),e_),F=X.zIndex,Z=X.sourceX,U=X.sourceY,G=X.targetX,W=X.targetY,q=X.sourcePosition,$=X.targetPosition,K=r((function(){return C.markerStart?"url('#".concat(fE(C.markerStart,x),"')"):void 0}),[C.markerStart,x]),Q=r((function(){return C.markerEnd?"url('#".concat(fE(C.markerEnd,x),"')"):void 0}),[C.markerEnd,x]);if(C.hidden||null===Z||null===U||null===G||null===W)return null;var J=s?function(n){s(n,d({},C))}:void 0,nn=f?function(n){f(n,d({},C))}:void 0,en=h?function(n){h(n,d({},C))}:void 0,tn=v?function(n){v(n,d({},C))}:void 0,rn=p?function(n){p(n,d({},C))}:void 0;return E.jsx("svg",{style:{zIndex:F},children:E.jsxs("g",{className:O(["ink-flow__edge","ink-flow__edge-".concat(j),C.className,S,{selected:C.selected,animated:C.animated,inactive:!z&&!c,updating:L,selectable:z}]),onClick:function(n){var t,r=Y.getState(),o=r.addSelectedEdges,i=r.unselectNodesAndEdges,a=r.multiSelectionActive;z&&(Y.setState({nodesSelectionActive:!1}),C.selected&&a?(i({nodes:[],edges:[C]}),null===(t=T.current)||void 0===t||t.blur()):o([e])),c&&c(n,C)},onDoubleClick:J,onContextMenu:nn,onMouseEnter:en,onMouseMove:tn,onMouseLeave:rn,onKeyDown:I?function(n){var t;if(!N&&Jy.includes(n.key)&&z){var r=Y.getState(),o=r.unselectNodesAndEdges,i=r.addSelectedEdges;"Escape"===n.key?(null===(t=T.current)||void 0===t||t.blur(),o({edges:[C]})):i([e])}}:void 0,tabIndex:I?0:void 0,role:I?"button":"img","data-id":e,"data-testid":"rf__edge-".concat(e),"aria-label":null===C.ariaLabel?void 0:C.ariaLabel||"Edge from ".concat(C.source," to ").concat(C.target),"aria-describedby":I?"".concat(X_,"-").concat(x):void 0,ref:T,children:[!V&&E.jsx(P,{id:e,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:Z,sourceY:U,targetX:G,targetY:W,sourcePosition:q,targetPosition:$,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:K,markerEnd:Q,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),A&&E.jsx(HE,{edge:C,isUpdatable:A,edgeUpdaterRadius:y,onEdgeUpdate:m,onEdgeUpdateStart:w,onEdgeUpdateEnd:b,sourceX:Z,sourceY:U,targetX:G,targetY:W,sourcePosition:q,targetPosition:$,setUpdateHover:D,setUpdating:H,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle})]})})}var GE=function(n){return{width:n.width,height:n.height,edgesFocusable:n.edgesFocusable,edgesUpdatable:n.edgesUpdatable,elementsSelectable:n.elementsSelectable,connectionMode:n.connectionMode,onError:n.onError}};function WE(n){var e=n.rfId,t=n.noPanClassName,r=n.onEdgeUpdate,o=mx(GE,e_),i=o.edgesFocusable,a=o.edgesUpdatable,u=o.elementsSelectable,c=o.onError,s=function(n){var e=mx(l((function(n){return n.edges.map((function(n){return n.id}))}),[n]),e_);return e}(!1);return E.jsxs("div",{className:"ink-flow__edges",children:[E.jsx(pE,{defaultColor:"",rfId:e}),s.map((function(n){return E.jsx(UE,{id:n,edgesFocusable:i,edgesUpdatable:a,elementsSelectable:u,noPanClassName:t,onEdgeUpdate:r,rfId:e,onError:c},n)}))]})}WE.displayName="EdgeRenderer";var qE=c(WE),$E=function(n){return"translate(".concat(n.transform[0],"px,").concat(n.transform[1],"px) scale(").concat(n.transform[2],")")};function KE(n){var e=n.children,t=mx($E);return E.jsx("div",{className:"ink-flow__viewport xyflow__viewport ink-flow__container",style:{transform:t},children:e})}function QE(n){var e=n.rfId,t=n.minZoom,r=n.maxZoom,o=n.noPanClassName,i=n.noDragClassName,a=n.nodeOrigin,u=n.viewport,c=n.disableKeyboardA11y,l=n.translateExtent,s=n.defaultViewport,d=n.nodeTypes,f=n.elementsSelectable,h=n.onPaneClick,v=n.onPaneContextMenu;return E.jsx(O_,{minZoom:t,maxZoom:r,noPanClassName:o,noDragClassName:i,isControlledViewport:!!u,disableKeyboardA11y:c,translateExtent:l,defaultViewport:s,elementsSelectable:f,onPaneClick:h,onPaneContextMenu:v,children:E.jsxs(KE,{children:[E.jsx(qE,{rfId:e,noPanClassName:o}),E.jsx("div",{className:"ink-flow__edgelabel-renderer"}),E.jsx(sE,{rfId:e,nodeTypes:d,nodeOrigin:a,noDragClassName:i,noPanClassName:o,disableKeyboardA11y:!1}),E.jsx("div",{className:"ink-flow__viewport-portal"})]})})}QE.displayName="GraphView";var JE=c(QE),nS=function(n){var e,t,r=void 0===n?{}:n,o=r.nodes,i=r.edges,a=r.defaultNodes,u=r.defaultEdges;r.width,r.height,r.fitView;var c=new Map,l=new Map,s=new Map,d=new Map,f=null!==(e=null!=u?u:i)&&void 0!==e?e:[],h=null!==(t=null!=a?a:o)&&void 0!==t?t:[];Ex(s,d,f),Sx(h,c,l,{nodeOrigin:[0,0],elevateNodesOnSelect:!1});return{rfId:"1",width:0,height:0,transform:[0,0,1],nodes:h,nodeLookup:c,parentLookup:l,edges:f,edgeLookup:d,connectionLookup:s,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==a,hasDefaultEdges:void 0!==u,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:Qy,nodeExtent:Qy,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:_m.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}},eS=function(n){var e,t,r=n.nodes,o=n.edges,i=n.defaultNodes,a=n.defaultEdges,u=n.width,c=n.height,l=n.fitView;return e=function(n,e){return d(d({},nS({nodes:r,edges:o,width:u,height:c,fitView:l,defaultNodes:i,defaultEdges:a})),{setNodes:function(t){var r=e();Sx(t,r.nodeLookup,r.parentLookup,{nodeOrigin:r.nodeOrigin,elevateNodesOnSelect:r.elevateNodesOnSelect,checkEquality:!0}),n({nodes:t})},setEdges:function(t){var r=e();Ex(r.connectionLookup,r.edgeLookup,t),n({edges:t})},setDefaultNodesAndEdges:function(t,r){t&&((0,e().setNodes)(t),n({hasDefaultNodes:!0})),r&&((0,e().setEdges)(r),n({hasDefaultEdges:!0}))},updateNodeInternals:function(t){var r=e(),o=r.triggerNodeChanges,i=r.fitView,a=r.nodeLookup,u=r.parentLookup,c=r.fitViewOnInit,l=r.fitViewDone,s=r.fitViewOnInitOptions,f=r.domNode,h=r.nodeOrigin,v=r.debug,p=function(n,e,t,r,o){var i=null==r?void 0:r.querySelector(".xyflow__viewport"),a=!1;if(!i)return{changes:[],updatedInternals:a};var u=[],c=window.getComputedStyle(i),l=new window.DOMMatrixReadOnly(c.transform).m22,s=[];if(n.forEach((function(n){var t=e.get(n.id);if(null==t?void 0:t.hidden)e.set(t.id,d(d({},t),{internals:d(d({},t.internals),{handleBounds:void 0})})),a=!0;else if(t){var r=Zx(n.nodeElement),i=t.measured.width!==r.width||t.measured.height!==r.height;if(r.width&&r.height&&(i||!t.internals.handleBounds||n.force)){var c=d(d({},t),{measured:r,internals:d(d({},t.internals),{handleBounds:{source:$x(".source",n.nodeElement,l,t.origin||o),target:$x(".target",n.nodeElement,l,t.origin||o)}})});e.set(t.id,c),a=!0,i&&(u.push({id:c.id,type:"dimensions",dimensions:r}),c.expandParent&&c.parentId&&s.push({id:c.id,parentId:c.parentId,rect:Ix(c,c.origin||o)}))}}})),s.length>0){var f=kx(s,e,t,o);u.push.apply(u,y([],g(f),!1))}return{changes:u,updatedInternals:a}}(t,a,u,f,h),m=p.changes;if(p.updatedInternals){bx(a,{nodeOrigin:h});var w=l;!l&&c&&(w=i(d(d({},s),{nodes:null==s?void 0:s.nodes}))),n({fitViewDone:w}),(null==m?void 0:m.length)>0&&(v&&console.log("Ink Flow: trigger node changes",m),null==o||o(m))}},updateNodePositions:function(n,t){var r,o;void 0===t&&(t=!1);var i=[],a=[];try{for(var u=p(n),c=u.next();!c.done;c=u.next()){var l=g(c.value,2),s=l[0],f=l[1],h={id:s,type:"position",position:f.position,dragging:t};(null==f?void 0:f.expandParent)&&(null==f?void 0:f.parentId)&&h.position&&(i.push({id:s,parentId:f.parentId,rect:d(d({},f.internals.positionAbsolute),{width:f.measured.width,height:f.measured.height})}),h.position.x=Math.max(0,h.position.x),h.position.y=Math.max(0,h.position.y)),a.push(h)}}catch(n){r={error:n}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}if(i.length>0){var v=e(),m=kx(i,v.nodeLookup,v.parentLookup);a.push.apply(a,y([],g(m),!1))}e().triggerNodeChanges(a)},triggerNodeChanges:function(n){var t=e(),r=t.onNodesChange,o=t.setNodes,i=t.nodes,a=t.hasDefaultNodes,u=t.debug;(null==n?void 0:n.length)&&(a&&o(l_(n,i)),u&&console.log("Ink Flow: trigger node changes",n),null==r||r(n))},triggerEdgeChanges:function(n){var t=e(),r=t.onEdgesChange,o=t.setEdges,i=t.edges,a=t.hasDefaultEdges,u=t.debug;(null==n?void 0:n.length)&&(a&&o(c_(n,i)),u&&console.log("Ink Flow: trigger edge changes",n),null==r||r(n))},addSelectedNodes:function(n){var t=e(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,u=t.triggerEdgeChanges;r?a(n.map((function(n){return s_(n,!0)}))):(a(d_(i,new Set(y([],g(n),!1)),!0)),u(d_(o)))},addSelectedEdges:function(n){var t=e(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,u=t.triggerEdgeChanges;r?u(n.map((function(n){return s_(n,!0)}))):(u(d_(o,new Set(y([],g(n),!1)))),a(d_(i,new Set,!0)))},unselectNodesAndEdges:function(n){var t=void 0===n?{}:n,r=t.nodes,o=t.edges,i=e(),a=i.edges,u=i.nodes,c=i.triggerNodeChanges,l=i.triggerEdgeChanges,s=o||a,d=(r||u).map((function(n){return n.selected=!1,s_(n.id,!1)})),f=s.map((function(n){return s_(n.id,!1)}));c(d),l(f)},setMinZoom:function(t){var r=e(),o=r.panZoom,i=r.maxZoom;null==o||o.setScaleExtent([t,i]),n({minZoom:t})},setMaxZoom:function(t){var r=e(),o=r.panZoom,i=r.minZoom;null==o||o.setScaleExtent([i,t]),n({maxZoom:t})},setTranslateExtent:function(t){var r;null===(r=e().panZoom)||void 0===r||r.setTranslateExtent(t),n({translateExtent:t})},resetSelectedElements:function(){var n=e(),t=n.edges,r=n.nodes,o=n.triggerNodeChanges,i=n.triggerEdgeChanges,a=r.reduce((function(n,e){return e.selected?y(y([],g(n),!1),[s_(e.id,!1)],!1):n}),[]),u=t.reduce((function(n,e){return e.selected?y(y([],g(n),!1),[s_(e.id,!1)],!1):n}),[]);o(a),i(u)},setNodeExtent:function(t){var r,o,i=e().nodeLookup;try{for(var a=p(i),u=a.next();!u.done;u=a.next()){var c=g(u.value,2)[1],l=Cx(c.position,t);i.set(c.id,d(d({},c),{internals:d(d({},c.internals),{positionAbsolute:l})}))}}catch(n){r={error:n}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}n({nodeExtent:t})},panBy:function(n){var t=e(),r=t.transform,o=t.width,i=t.height;return function(n){var e=n.delta,t=n.panZoom,r=n.transform,o=n.translateExtent,i=n.width,a=n.height;if(!t||!e.x&&!e.y)return!1;var u=t.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[i,a]],o);return!!u&&(u.x!==r[0]||u.y!==r[1]||u.k!==r[2])}({delta:n,panZoom:t.panZoom,transform:r,translateExtent:t.translateExtent,width:o,height:i})},fitView:function(n){var t=e(),r=t.panZoom,o=t.width,i=t.height,a=t.minZoom,u=t.maxZoom,c=t.nodeOrigin,l=t.nodeLookup;return!!r&&m_({nodeLookup:l,width:o,height:i,panZoom:r,minZoom:a,maxZoom:u,nodeOrigin:c},n)},cancelConnection:function(){return n({connectionStatus:null,connectionStartHandle:null,connectionEndHandle:null})},updateConnection:function(t){var r,o=e().connectionPosition,i=d(d({},t),{connectionPosition:null!==(r=t.connectionPosition)&&void 0!==r?r:o});n(i)},reset:function(){return n(d({},nS()))}})},t=Object.is,e?V(e,t):V};function tS(n){var e=n.initialNodes,t=n.initialEdges,r=n.defaultNodes,o=n.defaultEdges,a=n.initialWidth,u=n.initialHeight,c=n.fitView,l=n.children,s=g(i((function(){return eS({nodes:e,edges:t,defaultNodes:r,defaultEdges:o,width:a,height:u,fitView:c})})),1)[0];return E.jsx(Xe,{value:s,children:E.jsx(z_,{children:l})})}function rS(n){var e=n.children,r=n.nodes,o=n.edges,i=n.defaultNodes,a=n.defaultEdges,u=n.width,c=n.height,l=n.fitView;return t(Ye)?E.jsx(E.Fragment,{children:e}):E.jsx(tS,{initialNodes:r,initialEdges:o,defaultNodes:i,defaultEdges:a,initialWidth:u,initialHeight:c,fitView:l,children:e})}var oS={x:0,y:0,zoom:1},iS=y(y([],g(["nodes","edges","defaultNodes","defaultEdges","nodesDraggable","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","translateExtent","defaultEdgeOptions","fitView","fitViewOptions"]),!1),["rfId"],!1),aS=function(n){return{setNodes:n.setNodes,setEdges:n.setEdges,setMinZoom:n.setMinZoom,setMaxZoom:n.setMaxZoom,setTranslateExtent:n.setTranslateExtent,setNodeExtent:n.setNodeExtent,reset:n.reset,setDefaultNodesAndEdges:n.setDefaultNodesAndEdges}},uS={translateExtent:Qy,nodeOrigin:[0,0],minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function cS(n){var e=mx(aS,e_),t=e.setNodes,r=e.setEdges,o=e.setMinZoom,i=e.setMaxZoom,c=e.setTranslateExtent,l=e.setNodeExtent,s=e.reset,d=e.setDefaultNodesAndEdges,f=wx();u((function(){return d(n.defaultNodes,n.defaultEdges),function(){h.current=uS,s()}}),[]);var h=a(uS);return u((function(){var e,a,u;try{for(var s=p(iS),d=s.next();!d.done;d=s.next()){var v=d.value,g=n[v];g!==h.current[v]&&(void 0!==n[v]&&("nodes"===v?t(g):"edges"===v?r(g):"minZoom"===v?o(g):"maxZoom"===v?i(g):"translateExtent"===v?c(g):"nodeExtent"===v?l(g):"fitView"===v?f.setState({fitViewOnInit:g}):"fitViewOptions"===v?f.setState({fitViewOnInitOptions:g}):f.setState(((u={})[v]=g,u))))}}catch(n){e={error:n}}finally{try{d&&!d.done&&(a=s.return)&&a.call(s)}finally{if(e)throw e.error}}h.current=n}),iS.map((function(e){return n[e]}))),null}var lS={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var sS=Lx((function(n,e){var t=n.nodes,r=n.edges,o=n.translateExtent,i=void 0===o?Qy:o,a=n.defaultViewport,u=void 0===a?oS:a,c=n.minZoom,l=void 0===c?.5:c,s=n.maxZoom,h=void 0===s?2:s,v=n.nodeOrigin,p=n.noDragClassName,g=n.noPanClassName,y=n.disableKeyboardA11y,m=n.nodeTypes,w=n.onNodesChange,b=n.onEdgesChange,x=n.fitView,_=n.fitViewOptions,S=n.nodeExtent,k=n.nodesDraggable,N=n.children,C=n.id,M=n.width,j=n.height,P=n.onPaneClick,I=n.onPaneContextMenu,A=n.elementsSelectable,z=void 0===A||A,T=f(n,["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=C||"1";return E.jsx("div",d({},T,{ref:e,style:d({},lS),className:O(["ink-flow"]),"data-testid":"rf__wrapper",id:C,children:E.jsxs(rS,{nodes:t,edges:r,width:M,height:j,fitView:x,children:[E.jsx(JE,{rfId:B,nodeTypes:m,minZoom:l,maxZoom:h,nodeOrigin:v,noDragClassName:p,noPanClassName:g,disableKeyboardA11y:y,translateExtent:i,defaultViewport:u,onPaneClick:P,onPaneContextMenu:I}),E.jsx(cS,{nodes:t,edges:r,rfId:B,onNodesChange:w,onEdgesChange:b,fitView:x,fitViewOptions:_,nodeExtent:S,nodesDraggable:k,elementsSelectable:z}),N]})}))}));function dS(){return E.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E.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 fS(){return E.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E.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 hS(){return E.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E.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 vS(){return E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:E.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 pS(){return E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:E.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 gS(n){var e=n.children,t=n.className,r=f(n,["children","className"]);return E.jsx("button",d({type:"button",className:O(["ink-flow__controls-button",t])},r,{children:e}))}var yS=function(n){return n.userSelectionActive?"none":"all"};function mS(n){var e=n.position,t=void 0===e?"top-left":e,r=n.children,o=n.className,i=n.style,a=f(n,["position","children","className","style"]),u=mx(yS),c="".concat(t).split("-");return E.jsx("div",d({className:O(y(["ink-flow__panel",o],g(c),!1)),style:d(d({},i),{pointerEvents:u})},a,{children:r}))}var wS=function(n){return{isInteractive:n.nodesDraggable||n.nodesConnectable||n.elementsSelectable,minZoomReached:n.transform[2]<=n.minZoom,maxZoomReached:n.transform[2]>=n.maxZoom}};function bS(n){var e=n.style,t=n.showZoom,r=void 0===t||t,o=n.showFitView,i=void 0===o||o,a=n.showInteractive,u=void 0===a||a,c=n.fitViewOptions,l=n.onZoomIn,s=n.onZoomOut,d=n.onFitView,f=n.onInteractiveChange,h=n.className,v=n.children,p=n.position,g=void 0===p?"bottom-left":p,y=n.orientation,m=void 0===y?"vertical":y,w=n["aria-label"],b=void 0===w?"Ink Flow controls":w,x=wx(),_=mx(wS,e_),S=_.isInteractive,k=_.minZoomReached,N=_.maxZoomReached,C=L_(),M=C.zoomIn,j=C.zoomOut,P=C.fitView,I="horizontal"===m?"horizontal":"vertical";return E.jsxs(mS,{className:O(["ink-flow__controls",I,h]),position:g,style:e,"data-testid":"rf__controls","aria-label":b,children:[i&&E.jsx(gS,{className:"ink-flow__controls-fitview",onClick:function(){P(c),null==d||d()},title:"fit view","aria-label":"fit view",children:E.jsx(hS,{})}),r&&E.jsxs("div",{className:"ink-flow__controls-zoom",children:[E.jsx(gS,{onClick:function(){M(),null==l||l()},className:"ink-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:N,children:E.jsx(dS,{})}),E.jsx(gS,{onClick:function(){j(),null==s||s()},className:"ink-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:k,children:E.jsx(fS,{})})]}),u&&E.jsx(gS,{className:"ink-flow__controls-interactive",onClick:function(){x.setState({nodesDraggable:!S,nodesConnectable:!S,elementsSelectable:!S}),null==f||f(!S)},title:"toggle interactivity","aria-label":"toggle interactivity",children:S?E.jsx(pS,{}):E.jsx(vS,{})}),v]})}bS.displayName="Controls";var xS=c(bS);export{km as ConnectionLineType,_m as ConnectionMode,gS as ControlButton,xS as Controls,eE as Handle,tS as InkFlowProvider,Nm as MarkerType,Em as PanOnScrollMode,Cm as Position,Sm as SelectionMode,Bm as addEdge,fv as dagreLayout,sS as default,Mm as getBezierEdgeCenter,Im as getBezierPath,im as getConnectedEdges,Am as getEdgeCenter,em as getIncomers,rm as getNodesBounds,nm as getOutgoers,Hm as getSmoothStepPath,Dm as getStraightPath,mm as getViewportForBounds,Lm as updateEdge,M_ as useEdgesState,L_ as useInkFlow,j_ as useNodesState,mx as useStore,wx as useStoreApi};
|
|
16
|
+
*/O.exports=function(){if(C)return j;C=1;var n=e,t=A(),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 j.useSyncExternalStoreWithSelector=function(e,n,t,l,s){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=l(e),void 0!==s&&f.hasValue){var n=f.value;if(s(n,e))return i=n}return i=e}if(n=i,r(o,e))return n;var t=l(e);return void 0!==s&&s(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,l,s]);var h=o(e,d[0],d[1]);return a((function(){f.hasValue=!0,f.value=h}),[h]),c(h),h},j}();var z=m(O.exports);const T=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:()=>{"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&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:L}=e,{useSyncExternalStoreWithSelector:B}=z,D=e=>e;function R(e,n=D,t){const r=B(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,t);return L(r),r}const H=(e,n)=>{const t=(e=>e?T(e):T)(e),r=(e,r=n)=>R(t,e,r);return Object.assign(r,t),r};var V=n(null),Y=V.Provider,X=function(){return X=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},X.apply(this,arguments)};function F(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 Z(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(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 G,W,q,$,K,Q,J,ee,ne,te,re,oe,ie,ae,ue,ce,le,se,de,fe,he,ve,pe,ge,ye,me,be,we,xe,_e,Ee,Se,ke,Ne,Ce,Me,Oe,je,Pe,Ie,Ae,ze,Te,Le,Be,De,Re,He,Ve,Ye,Xe,Fe,Ze,Ue,Ge,We,qe,$e,Ke,Qe,Je,en,nn,tn,rn,on,an,un,cn,ln,sn,dn,fn,hn,vn,pn,gn,yn,mn,bn,wn,xn,_n,En,Sn,kn,Nn,Cn,Mn,On,jn,Pn,In,An,zn,Tn,Ln,Bn,Dn,Rn,Hn,Vn,Yn,Xn,Fn,Zn,Un,Gn,Wn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function qn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function $n(){return $?q:($=1,q=function(e,n){return e===n||e!=e&&n!=n})}function Kn(){if(Q)return K;Q=1;var e=$n();return K=function(n,t){for(var r=n.length;r--;)if(e(n[r][0],t))return r;return-1},K}function Qn(){if(ce)return ue;ce=1;var e=W?G:(W=1,G=function(){this.__data__=[],this.size=0}),n=function(){if(ee)return J;ee=1;var e=Kn(),n=Array.prototype.splice;return J=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(te)return ne;te=1;var e=Kn();return ne=function(n){var t=this.__data__,r=e(t,n);return r<0?void 0:t[r][1]}}(),r=function(){if(oe)return re;oe=1;var e=Kn();return re=function(n){return e(this.__data__,n)>-1}}(),o=function(){if(ae)return ie;ae=1;var e=Kn();return ie=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,ue=i}function Jn(){if(me)return ye;me=1;var e="object"==typeof Wn&&Wn&&Wn.Object===Object&&Wn;return ye=e}function et(){if(we)return be;we=1;var e=Jn(),n="object"==typeof self&&self&&self.Object===Object&&self,t=e||n||Function("return this")();return be=t}function nt(){if(_e)return xe;_e=1;var e=et().Symbol;return xe=e}function tt(){if(Me)return Ce;Me=1;var e=nt(),n=function(){if(Se)return Ee;Se=1;var e=nt(),n=Object.prototype,t=n.hasOwnProperty,r=n.toString,o=e?e.toStringTag:void 0;return Ee=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(Ne)return ke;Ne=1;var e=Object.prototype.toString;return ke=function(n){return e.call(n)}}(),r=e?e.toStringTag:void 0;return Ce=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?n(e):t(e)}}function rt(){return je?Oe:(je=1,Oe=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)})}function ot(){if(Ie)return Pe;Ie=1;var e=tt(),n=rt();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 it(){if(De)return Be;De=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 at(){if(Fe)return Xe;Fe=1;var e=function(){if(He)return Re;He=1;var e=ot(),n=function(){if(Le)return Te;Le=1;var e,n=function(){if(ze)return Ae;ze=1;var e=et()["__core-js_shared__"];return Ae=e}(),t=(e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return Te=function(e){return!!t&&t in e}}(),t=rt(),r=it(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,u=i.toString,c=a.hasOwnProperty,l=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Re=function(i){return!(!t(i)||n(i))&&(e(i)?l:o).test(r(i))}}(),n=Ye?Ve:(Ye=1,Ve=function(e,n){return null==e?void 0:e[n]});return Xe=function(t,r){var o=n(t,r);return e(o)?o:void 0}}function ut(){if(Ue)return Ze;Ue=1;var e=at()(et(),"Map");return Ze=e}function ct(){if(We)return Ge;We=1;var e=at()(Object,"create");return Ge=e}function lt(){if(hn)return fn;hn=1;var e=dn?sn:(dn=1,sn=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e});return fn=function(n,t){var r=n.__data__;return e(t)?r["string"==typeof t?"string":"hash"]:r.map},fn}function st(){if(En)return _n;En=1;var e=function(){if(ln)return cn;ln=1;var e=function(){if(un)return an;un=1;var e=function(){if($e)return qe;$e=1;var e=ct();return qe=function(){this.__data__=e?e(null):{},this.size=0}}(),n=Qe?Ke:(Qe=1,Ke=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}),t=function(){if(en)return Je;en=1;var e=ct(),n=Object.prototype.hasOwnProperty;return Je=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(tn)return nn;tn=1;var e=ct(),n=Object.prototype.hasOwnProperty;return nn=function(t){var r=this.__data__;return e?void 0!==r[t]:n.call(r,t)}}(),o=function(){if(on)return rn;on=1;var e=ct();return rn=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,an=i}(),n=Qn(),t=ut();return cn=function(){this.size=0,this.__data__={hash:new e,map:new(t||n),string:new e}}}(),n=function(){if(pn)return vn;pn=1;var e=lt();return vn=function(n){var t=e(this,n).delete(n);return this.size-=t?1:0,t}}(),t=function(){if(yn)return gn;yn=1;var e=lt();return gn=function(n){return e(this,n).get(n)}}(),r=function(){if(bn)return mn;bn=1;var e=lt();return mn=function(n){return e(this,n).has(n)}}(),o=function(){if(xn)return wn;xn=1;var e=lt();return wn=function(n,t){var r=e(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this},wn}();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,_n=i}function dt(){if(Cn)return Nn;Cn=1;var e=Qn(),n=function(){if(se)return le;se=1;var e=Qn();return le=function(){this.__data__=new e,this.size=0}}(),t=fe?de:(fe=1,de=function(e){var n=this.__data__,t=n.delete(e);return this.size=n.size,t}),r=ve?he:(ve=1,he=function(e){return this.__data__.get(e)}),o=ge?pe:(ge=1,pe=function(e){return this.__data__.has(e)}),i=function(){if(kn)return Sn;kn=1;var e=Qn(),n=ut(),t=st();return Sn=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,Nn=a}function ft(){return On||(On=1,Mn=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r&&!1!==n(e[t],t,e););return e}),Mn}function ht(){if(Pn)return jn;Pn=1;var e=at(),n=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch(e){}}();return jn=n}function vt(){if(An)return In;An=1;var e=ht();return In=function(n,t,r){"__proto__"==t&&e?e(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}}function pt(){if(Tn)return zn;Tn=1;var e=vt(),n=$n(),t=Object.prototype.hasOwnProperty;return zn=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 gt(){if(Bn)return Ln;Bn=1;var e=pt(),n=vt();return Ln=function(t,r,o,i){var a=!o;o||(o={});for(var u=-1,c=r.length;++u<c;){var l=r[u],s=i?i(o[l],t[l],l,o,t):void 0;void 0===s&&(s=t[l]),a?n(o,l,s):e(o,l,s)}return o}}function yt(){return Vn?Hn:(Vn=1,Hn=function(e){return null!=e&&"object"==typeof e})}function mt(){if(Zn)return Fn;Zn=1;var e=function(){if(Xn)return Yn;Xn=1;var e=tt(),n=yt();return Yn=function(t){return n(t)&&"[object Arguments]"==e(t)}}(),n=yt(),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 Fn=i}function bt(){if(Gn)return Un;Gn=1;var e=Array.isArray;return Un=e}var wt,xt,_t,Et,St,kt,Nt,Ct,Mt,Ot,jt,Pt={exports:{}};function It(){return _t||(_t=1,function(e,n){var t=et(),r=xt?wt:(xt=1,wt=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}(Pt,Pt.exports)),Pt.exports}function At(){if(St)return Et;St=1;var e=/^(?:0|[1-9]\d*)$/;return Et=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 zt(){return Nt?kt:(Nt=1,kt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991})}function Tt(){return jt?Ot:(jt=1,Ot=function(e){return function(n){return e(n)}})}Pt.exports;var Lt,Bt,Dt,Rt,Ht,Vt,Yt,Xt,Ft,Zt,Ut,Gt,Wt,qt,$t,Kt,Qt,Jt,er,nr,tr,rr,or,ir,ar,ur,cr,lr={exports:{}};function sr(){return Lt||(Lt=1,e=lr,n=lr.exports,t=Jn(),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),lr.exports;var e,n,t,r,o,i,a}function dr(){if(Dt)return Bt;Dt=1;var e=function(){if(Mt)return Ct;Mt=1;var e=tt(),n=zt(),t=yt(),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,Ct=function(o){return t(o)&&n(o.length)&&!!r[e(o)]}}(),n=Tt(),t=sr(),r=t&&t.isTypedArray,o=r?n(r):e;return Bt=o}function fr(){if(Ht)return Rt;Ht=1;var e=Rn?Dn:(Rn=1,Dn=function(e,n){for(var t=-1,r=Array(e);++t<e;)r[t]=n(t);return r}),n=mt(),t=bt(),r=It(),o=At(),i=dr(),a=Object.prototype.hasOwnProperty;return Rt=function(u,c){var l=t(u),s=!l&&n(u),d=!l&&!s&&r(u),f=!l&&!s&&!d&&i(u),h=l||s||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},Rt}function hr(){if(Yt)return Vt;Yt=1;var e=Object.prototype;return Vt=function(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||e)}}function vr(){return Ft||(Ft=1,Xt=function(e,n){return function(t){return e(n(t))}}),Xt}function pr(){if(Wt)return Gt;Wt=1;var e=hr(),n=function(){if(Ut)return Zt;Ut=1;var e=vr()(Object.keys,Object);return Zt=e}(),t=Object.prototype.hasOwnProperty;return Gt=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 gr(){if($t)return qt;$t=1;var e=ot(),n=zt();return qt=function(t){return null!=t&&n(t.length)&&!e(t)}}function yr(){if(Qt)return Kt;Qt=1;var e=fr(),n=pr(),t=gr();return Kt=function(r){return t(r)?e(r):n(r)}}function mr(){if(ar)return ir;ar=1;var e=fr(),n=function(){if(or)return rr;or=1;var e=rt(),n=hr(),t=tr?nr:(tr=1,nr=function(e){var n=[];if(null!=e)for(var t in Object(e))n.push(t);return n}),r=Object.prototype.hasOwnProperty;return rr=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=gr();return ir=function(r){return t(r)?e(r,!0):n(r)}}lr.exports;var br,wr,xr,_r,Er,Sr,kr,Nr,Cr,Mr,Or,jr,Pr,Ir,Ar,zr,Tr,Lr,Br,Dr,Rr,Hr,Vr,Yr,Xr,Fr,Zr,Ur,Gr,Wr,qr,$r,Kr,Qr,Jr,eo,no,to,ro,oo,io,ao,uo,co,lo,so,fo,ho,vo,po,go,yo,mo,bo,wo,xo,_o,Eo,So,ko,No,Co,Mo,Oo,jo,Po,Io,Ao,zo,To,Lo,Bo,Do,Ro,Ho,Vo,Yo,Xo,Fo,Zo,Uo,Go,Wo,qo,$o,Ko,Qo,Jo,ei,ni,ti,ri,oi,ii,ai,ui,ci,li,si,di,fi,hi,vi,pi,gi,yi,mi,bi,wi,xi,_i,Ei,Si,ki,Ni,Ci,Mi,Oi,ji,Pi,Ii,Ai,zi,Ti,Li,Bi,Di,Ri,Hi,Vi,Yi,Xi,Fi,Zi,Ui,Gi,Wi,qi,$i,Ki,Qi,Ji,ea,na,ta,ra,oa,ia,aa,ua,ca,la,sa,da,fa,ha,va,pa,ga,ya,ma,ba,wa,xa,_a,Ea,Sa,ka,Na,Ca,Ma,Oa,ja,Pa,Ia,Aa,za,Ta,La,Ba,Da,Ra,Ha,Va,Ya,Xa,Fa,Za,Ua,Ga,Wa,qa,$a,Ka,Qa,Ja,eu,nu,tu,ru,ou,iu,au,uu,cu,lu,su,du,fu,hu,vu,pu,gu,yu,mu,bu,wu,xu,_u,Eu,Su,ku,Nu,Cu,Mu,Ou,ju,Pu,Iu,Au,zu,Tu,Lu,Bu,Du,Ru,Hu,Vu,Yu,Xu,Fu,Zu,Uu,Gu,Wu,qu,$u,Ku,Qu,Ju,ec,nc,tc,rc,oc,ic,ac,uc,cc,lc,sc,dc,fc,hc,vc,pc,gc,yc,mc,bc,wc,xc,_c,Ec,Sc,kc,Nc,Cc,Mc,Oc,jc={exports:{}};function Pc(){return br||(br=1,function(e,n){var t=et(),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}}(jc,jc.exports)),jc.exports}function Ic(){return xr||(xr=1,wr=function(e,n){var t=-1,r=e.length;for(n||(n=Array(r));++t<r;)n[t]=e[t];return n}),wr}function Ac(){return Er||(Er=1,_r=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}),_r}function zc(){return kr?Sr:(kr=1,Sr=function(){return[]})}function Tc(){if(Cr)return Nr;Cr=1;var e=Ac(),n=zc(),t=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return Nr=r?function(n){return null==n?[]:(n=Object(n),e(r(n),(function(e){return t.call(n,e)})))}:n}function Lc(){return Pr||(Pr=1,jr=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e}),jr}function Bc(){if(Ar)return Ir;Ar=1;var e=vr()(Object.getPrototypeOf,Object);return Ir=e}function Dc(){if(Tr)return zr;Tr=1;var e=Lc(),n=Bc(),t=Tc(),r=zc(),o=Object.getOwnPropertySymbols;return zr=o?function(r){for(var o=[];r;)e(o,t(r)),r=n(r);return o}:r}function Rc(){if(Rr)return Dr;Rr=1;var e=Lc(),n=bt();return Dr=function(t,r,o){var i=r(t);return n(t)?i:e(i,o(t))}}function Hc(){if(Vr)return Hr;Vr=1;var e=Rc(),n=Tc(),t=yr();return Hr=function(r){return e(r,t,n)}}function Vc(){if(qr)return Wr;qr=1;var e=at()(et(),"Set");return Wr=e}function Yc(){if(Jr)return Qr;Jr=1;var e=function(){if(Zr)return Fr;Zr=1;var e=at()(et(),"DataView");return Fr=e}(),n=ut(),t=function(){if(Gr)return Ur;Gr=1;var e=at()(et(),"Promise");return Ur=e}(),r=Vc(),o=function(){if(Kr)return $r;Kr=1;var e=at()(et(),"WeakMap");return $r=e}(),i=tt(),a=it(),u="[object Map]",c="[object Promise]",l="[object Set]",s="[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)!=l||o&&y(new o)!=s)&&(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 l;case g:return s}return n}),Qr=y}function Xc(){if(ro)return to;ro=1;var e=et().Uint8Array;return to=e}function Fc(){if(io)return oo;io=1;var e=Xc();return oo=function(n){var t=new n.constructor(n.byteLength);return new e(t).set(new e(n)),t}}function Zc(){if(vo)return ho;vo=1;var e=Fc();return ho=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}}function Uc(){if(mo)return yo;mo=1;var e=rt(),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 yo=t}function Gc(){if(wo)return bo;wo=1;var e=Uc(),n=Bc(),t=hr();return bo=function(r){return"function"!=typeof r.constructor||t(r)?{}:e(n(r))}}function Wc(){if(jo)return Oo;jo=1;var e=dt(),n=ft(),t=pt(),r=function(){if(er)return Jt;er=1;var e=gt(),n=yr();return Jt=function(t,r){return t&&e(r,n(r),t)}}(),o=function(){if(cr)return ur;cr=1;var e=gt(),n=mr();return ur=function(t,r){return t&&e(r,n(r),t)}}(),i=Pc(),a=Ic(),u=function(){if(Or)return Mr;Or=1;var e=gt(),n=Tc();return Mr=function(t,r){return e(t,n(t),r)}}(),c=function(){if(Br)return Lr;Br=1;var e=gt(),n=Dc();return Lr=function(t,r){return e(t,n(t),r)}}(),l=Hc(),s=function(){if(Xr)return Yr;Xr=1;var e=Rc(),n=Dc(),t=mr();return Yr=function(r){return e(r,t,n)}}(),d=Yc(),f=function(){if(no)return eo;no=1;var e=Object.prototype.hasOwnProperty;return eo=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},eo}(),h=function(){if(go)return po;go=1;var e=Fc(),n=function(){if(uo)return ao;uo=1;var e=Fc();return ao=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}}(),t=function(){if(lo)return co;lo=1;var e=/\w*$/;return co=function(n){var t=new n.constructor(n.source,e.exec(n));return t.lastIndex=n.lastIndex,t}}(),r=function(){if(fo)return so;fo=1;var e=nt(),n=e?e.prototype:void 0,t=n?n.valueOf:void 0;return so=function(e){return t?Object(t.call(e)):{}}}(),o=Zc();return po=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=Gc(),p=bt(),g=It(),y=function(){if(So)return Eo;So=1;var e=function(){if(_o)return xo;_o=1;var e=Yc(),n=yt();return xo=function(t){return n(t)&&"[object Map]"==e(t)}}(),n=Tt(),t=sr(),r=t&&t.isMap,o=r?n(r):e;return Eo=o}(),m=rt(),b=function(){if(Mo)return Co;Mo=1;var e=function(){if(No)return ko;No=1;var e=Yc(),n=yt();return ko=function(t){return n(t)&&"[object Set]"==e(t)}}(),n=Tt(),t=sr(),r=t&&t.isSet,o=r?n(r):e;return Co=o}(),w=yr(),x=mr(),_="[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,Oo=function N(C,M,O,j,P,I){var A,z=1&M,T=2&M,L=4&M;if(O&&(A=P?O(C,j,P,I):O(C)),void 0!==A)return A;if(!m(C))return C;var B=p(C);if(B){if(A=f(C),!z)return a(C,A)}else{var D=d(C),R=D==E||"[object GeneratorFunction]"==D;if(g(C))return i(C,z);if(D==S||D==_||R&&!P){if(A=T||R?{}:v(C),!z)return T?c(C,o(A,C)):u(C,r(A,C))}else{if(!k[D])return P?C:{};A=h(C,D,z)}}I||(I=new e);var H=I.get(C);if(H)return H;I.set(C,A),b(C)?C.forEach((function(e){A.add(N(e,M,O,e,C,I))})):y(C)&&C.forEach((function(e,n){A.set(n,N(e,M,O,n,C,I))}));var V=B?void 0:(L?T?s:l:T?x:w)(C);return n(V||C,(function(e,n){V&&(e=C[n=e]),t(A,n,N(e,M,O,n,C,I))})),A},Oo}function qc(){if(Io)return Po;Io=1;var e=Wc();return Po=function(n){return e(n,4)}}function $c(){return zo?Ao:(zo=1,Ao=function(e){return function(){return e}})}function Kc(){if(Do)return Bo;Do=1;var e=(Lo?To:(Lo=1,To=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 Bo=e}function Qc(){if(Ho)return Ro;Ho=1;var e=Kc(),n=yr();return Ro=function(t,r){return t&&e(t,r,n)}}function Jc(){if(Fo)return Xo;Fo=1;var e=Qc(),n=function(){if(Yo)return Vo;Yo=1;var e=gr();return Vo=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 Xo=t}function el(){return Uo?Zo:(Uo=1,Zo=function(e){return e})}function nl(){if(Wo)return Go;Wo=1;var e=el();return Go=function(n){return"function"==typeof n?n:e}}function tl(){if($o)return qo;$o=1;var e=ft(),n=Jc(),t=nl(),r=bt();return qo=function(o,i){return(r(o)?e:n)(o,t(i))}}function rl(){return Qo?Ko:(Qo=1,Ko=tl())}function ol(){if(ai)return ii;ai=1;var e=st(),n=ti?ni:(ti=1,ni=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),t=oi?ri:(oi=1,ri=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,ii=r}function il(){return si?li:(si=1,li=function(e,n){return e.has(n)})}function al(){if(fi)return di;fi=1;var e=ol(),n=(ci||(ci=1,ui=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}),ui),t=il();return di=function(r,o,i,a,u,c){var l=1&i,s=r.length,d=o.length;if(s!=d&&!(l&&d>s))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<s;){var y=r[v],m=o[v];if(a)var b=l?a(m,y,v,o,r,c):a(y,m,v,r,o,c);if(void 0!==b){if(b)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},di}function ul(){return gi||(gi=1,pi=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e){t[++n]=e})),t}),pi}function cl(){if(_i)return xi;_i=1;var e=dt(),n=al(),t=function(){if(mi)return yi;mi=1;var e=nt(),n=Xc(),t=$n(),r=al(),o=(vi||(vi=1,hi=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e,r){t[++n]=[r,e]})),t}),hi),i=ul(),a=e?e.prototype:void 0,u=a?a.valueOf:void 0;return yi=function(e,a,c,l,s,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&l;if(h||(h=i),e.size!=a.size&&!v)return!1;var p=f.get(e);if(p)return p==a;l|=2,f.set(e,a);var g=r(h(e),h(a),l,s,d,f);return f.delete(e),g;case"[object Symbol]":if(u)return u.call(e)==u.call(a)}return!1}}(),r=function(){if(wi)return bi;wi=1;var e=Hc(),n=Object.prototype.hasOwnProperty;return bi=function(t,r,o,i,a,u){var c=1&o,l=e(t),s=l.length;if(s!=e(r).length&&!c)return!1;for(var d=s;d--;){var f=l[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<s;){var y=t[f=l[d]],m=r[f];if(i)var b=c?i(m,y,f,r,t,u):i(y,m,f,t,r,u);if(!(void 0===b?y===m||a(y,m,o,i,u):b)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var w=t.constructor,x=r.constructor;w==x||!("constructor"in t)||!("constructor"in r)||"function"==typeof w&&w instanceof w&&"function"==typeof x&&x instanceof x||(p=!1)}return u.delete(t),u.delete(r),p}}(),o=Yc(),i=bt(),a=It(),u=dr(),c="[object Arguments]",l="[object Array]",s="[object Object]",d=Object.prototype.hasOwnProperty;return xi=function(f,h,v,p,g,y){var m=i(f),b=i(h),w=m?l:o(f),x=b?l:o(h),_=(w=w==c?s:w)==s,E=(x=x==c?s:x)==s,S=w==x;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__"),N=E&&d.call(h,"__wrapped__");if(k||N){var C=k?f.value():f,M=N?h.value():h;return y||(y=new e),g(C,M,v,p,y)}}return!!S&&(y||(y=new e),r(f,h,v,p,g,y))}}function ll(){if(Si)return Ei;Si=1;var e=cl(),n=yt();return Ei=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))},Ei}function sl(){if(Mi)return Ci;Mi=1;var e=rt();return Ci=function(n){return n==n&&!e(n)}}function dl(){return Ii?Pi:(Ii=1,Pi=function(e,n){return function(t){return null!=t&&t[e]===n&&(void 0!==n||e in Object(t))}})}function fl(){if(Li)return Ti;Li=1;var e=tt(),n=yt();return Ti=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==e(t)}}function hl(){if(Di)return Bi;Di=1;var e=bt(),n=fl(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return Bi=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 vl(){return Ui||(Ui=1,Zi=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}),Zi}function pl(){if($i)return qi;$i=1;var e=function(){if(Wi)return Gi;Wi=1;var e=nt(),n=vl(),t=bt(),r=fl(),o=e?e.prototype:void 0,i=o?o.toString:void 0;return Gi=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},Gi}();return qi=function(n){return null==n?"":e(n)}}function gl(){if(Qi)return Ki;Qi=1;var e=bt(),n=hl(),t=function(){if(Fi)return Xi;Fi=1;var e=function(){if(Yi)return Vi;Yi=1;var e=function(){if(Hi)return Ri;Hi=1;var e=st();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,Ri=n}();return Vi=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 Xi=r}(),r=pl();return Ki=function(o,i){return e(o)?o:n(o,i)?[o]:t(r(o))}}function yl(){if(ea)return Ji;ea=1;var e=fl();return Ji=function(n){if("string"==typeof n||e(n))return n;var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}}function ml(){if(ta)return na;ta=1;var e=gl(),n=yl();return na=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 bl(){if(ca)return ua;ca=1;var e=gl(),n=mt(),t=bt(),r=At(),o=zt(),i=yl();return ua=function(a,u,c){for(var l=-1,s=(u=e(u,a)).length,d=!1;++l<s;){var f=i(u[l]);if(!(d=null!=a&&c(a,f)))break;a=a[f]}return d||++l!=s?d:!!(s=null==a?0:a.length)&&o(s)&&r(f,s)&&(t(a)||n(a))}}function wl(){if(sa)return la;sa=1;var e=aa?ia:(aa=1,ia=function(e,n){return null!=e&&n in Object(e)}),n=bl();return la=function(t,r){return null!=t&&n(t,r,e)}}function xl(){return va?ha:(va=1,ha=function(e){return function(n){return null==n?void 0:n[e]}})}function _l(){if(wa)return ba;wa=1;var e=function(){if(zi)return Ai;zi=1;var e=function(){if(Ni)return ki;Ni=1;var e=dt(),n=ll();return ki=function(t,r,o,i){var a=o.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var l=o[a];if(c&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++a<u;){var s=(l=o[a])[0],d=t[s],f=l[1];if(c&&l[2]){if(void 0===d&&!(s in t))return!1}else{var h=new e;if(i)var v=i(d,f,s,t,r,h);if(!(void 0===v?n(f,d,3,i,h):v))return!1}}return!0}}(),n=function(){if(ji)return Oi;ji=1;var e=sl(),n=yr();return Oi=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=dl();return Ai=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(fa)return da;fa=1;var e=ll(),n=function(){if(oa)return ra;oa=1;var e=ml();return ra=function(n,t,r){var o=null==n?void 0:e(n,t);return void 0===o?r:o}}(),t=wl(),r=hl(),o=sl(),i=dl(),a=yl();return da=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=el(),r=bt(),o=function(){if(ma)return ya;ma=1;var e=xl(),n=function(){if(ga)return pa;ga=1;var e=ml();return pa=function(n){return function(t){return e(t,n)}}}(),t=hl(),r=yl();return ya=function(o){return t(o)?e(r(o)):n(o)}}();return ba=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 El(){if(_a)return xa;_a=1;var e=Ac(),n=function(){if(ei)return Jo;ei=1;var e=Jc();return Jo=function(n,t){var r=[];return e(n,(function(e,n,o){t(e,n,o)&&r.push(e)})),r}}(),t=_l(),r=bt();return xa=function(o,i){return(r(o)?e:n)(o,t(i,3))}}function Sl(){if(Na)return ka;Na=1;var e=function(){if(Sa)return Ea;Sa=1;var e=Object.prototype.hasOwnProperty;return Ea=function(n,t){return null!=n&&e.call(n,t)}}(),n=bl();return ka=function(t,r){return null!=t&&n(t,r,e)}}function kl(){if(Ma)return Ca;Ma=1;var e=pr(),n=Yc(),t=mt(),r=bt(),o=gr(),i=It(),a=hr(),u=dr(),c=Object.prototype.hasOwnProperty;return Ca=function(l){if(null==l)return!0;if(o(l)&&(r(l)||"string"==typeof l||"function"==typeof l.splice||i(l)||u(l)||t(l)))return!l.length;var s=n(l);if("[object Map]"==s||"[object Set]"==s)return!l.size;if(a(l))return!e(l).length;for(var d in l)if(c.call(l,d))return!1;return!0}}function Nl(){return ja?Oa:(ja=1,Oa=function(e){return void 0===e})}function Cl(){if(Ia)return Pa;Ia=1;var e=Jc(),n=gr();return Pa=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 Ml(){if(za)return Aa;za=1;var e=vl(),n=_l(),t=Cl(),r=bt();return Aa=function(o,i){return(r(o)?e:t)(o,n(i,3))}}function Ol(){if(Ha)return Ra;Ha=1;var e=(La||(La=1,Ta=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}),Ta),n=Jc(),t=_l(),r=Da?Ba:(Da=1,Ba=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=bt();return Ra=function(i,a,u){var c=o(i)?e:r,l=arguments.length<3;return c(i,t(a,4),u,l,n)},Ra}function jl(){if(Qa)return Ka;Qa=1;var e=pr(),n=Yc(),t=gr(),r=function(){if(Ya)return Va;Ya=1;var e=tt(),n=bt(),t=yt();return Va=function(r){return"string"==typeof r||!n(r)&&t(r)&&"[object String]"==e(r)}}(),o=function(){if($a)return qa;$a=1;var e=function(){if(Fa)return Xa;Fa=1;var e=xl()("length");return Xa=e}(),n=function(){if(Ua)return Za;Ua=1;var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return Za=function(n){return e.test(n)}}(),t=function(){if(Wa)return Ga;Wa=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]?",l=c+u+"(?:\\u200d(?:"+[o,i,a].join("|")+")"+c+u+")*",s="(?:"+[o+t+"?",t,i,a,n].join("|")+")",d=RegExp(r+"(?="+r+")|"+s+l,"g");return Ga=function(e){for(var n=d.lastIndex=0;d.test(e);)++n;return n}}();return qa=function(r){return n(r)?t(r):e(r)}}();return Ka=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 Pl(){if(eu)return Ja;eu=1;var e=ft(),n=Uc(),t=Qc(),r=_l(),o=Bc(),i=bt(),a=It(),u=ot(),c=rt(),l=dr();return Ja=function(s,d,f){var h=i(s),v=h||a(s)||l(s);if(d=r(d,4),null==f){var p=s&&s.constructor;f=v?h?new p:[]:c(s)&&u(p)?n(o(s)):{}}return(v?e:t)(s,(function(e,n,t){return d(f,e,n,t)})),f}}function Il(){if(ou)return ru;ou=1;var e=Lc(),n=function(){if(tu)return nu;tu=1;var e=nt(),n=mt(),t=bt(),r=e?e.isConcatSpreadable:void 0;return nu=function(e){return t(e)||n(e)||!!(r&&e&&e[r])}}();return ru=function t(r,o,i,a,u){var c=-1,l=r.length;for(i||(i=n),u||(u=[]);++c<l;){var s=r[c];o>0&&i(s)?o>1?t(s,o-1,i,a,u):e(u,s):a||(u[u.length]=s)}return u},ru}function Al(){if(cu)return uu;cu=1;var e=au?iu:(au=1,iu=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 uu=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 l=Array(r+1);++a<r;)l[a]=i[a];return l[r]=o(c),e(t,this,l)}},uu}function zl(){if(vu)return hu;vu=1;var e=function(){if(su)return lu;su=1;var e=$c(),n=ht(),t=el();return lu=n?function(t,r){return n(t,"toString",{configurable:!0,enumerable:!1,value:e(r),writable:!0})}:t}(),n=function(){if(fu)return du;fu=1;var e=Date.now;return du=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)}},du}(),t=n(e);return hu=t}function Tl(){if(gu)return pu;gu=1;var e=el(),n=Al(),t=zl();return pu=function(r,o){return t(n(r,o,e),r+"")},pu}function Ll(){return mu||(mu=1,yu=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}),yu}function Bl(){if(zu)return Au;zu=1;var e=ol(),n=function(){if(Nu)return ku;Nu=1;var e=function(){if(Su)return Eu;Su=1;var e=Ll(),n=wu?bu:(wu=1,bu=function(e){return e!=e}),t=(_u||(_u=1,xu=function(e,n,t){for(var r=t-1,o=e.length;++r<o;)if(e[r]===n)return r;return-1}),xu);return Eu=function(r,o,i){return o==o?t(r,o,i):e(r,n,i)},Eu}();return ku=function(n,t){return!(null==n||!n.length)&&e(n,t,0)>-1},ku}(),t=(Mu||(Mu=1,Cu=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}),Cu),r=il(),o=function(){if(Iu)return Pu;Iu=1;var e=Vc(),n=ju?Ou:(ju=1,Ou=function(){}),t=ul(),r=e&&1/t(new e([,-0]))[1]==1/0?function(n){return new e(n)}:n;return Pu=r}(),i=ul();return Au=function(a,u,c){var l=-1,s=n,d=a.length,f=!0,h=[],v=h;if(c)f=!1,s=t;else if(d>=200){var p=u?null:o(a);if(p)return i(p);f=!1,s=r,v=new e}else v=u?[]:h;e:for(;++l<d;){var g=a[l],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 s(v,y,c)||(v!==h&&v.push(y),h.push(g))}return h},Au}function Dl(){if(Lu)return Tu;Lu=1;var e=gr(),n=yt();return Tu=function(t){return n(t)&&e(t)}}function Rl(){if(Du)return Bu;Du=1;var e=Il(),n=Tl(),t=Bl(),r=Dl(),o=n((function(n){return t(e(n,1,r,!0))}));return Bu=o}function Hl(){if(Yu)return Vu;Yu=1;var e=function(){if(Hu)return Ru;Hu=1;var e=vl();return Ru=function(n,t){return e(t,(function(e){return n[e]}))}}(),n=yr();return Vu=function(t){return null==t?[]:e(t,n(t))}}function Vl(){if(Fu)return Xu;var e;Fu=1;try{e={clone:qc(),constant:$c(),each:rl(),filter:El(),has:Sl(),isArray:bt(),isEmpty:kl(),isFunction:ot(),isUndefined:Nl(),keys:yr(),map:Ml(),reduce:Ol(),size:jl(),transform:Pl(),union:Rl(),values:Hl()}}catch(e){}return e||(e=window._),Xu=e}function Yl(){if(Uu)return Zu;Uu=1;var e=Vl();Zu=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 l=u;u=c,c=l}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 l=u(this._isDirected,n,t,r);if(e.has(this._edgeLabels,l))return a&&(this._edgeLabels[l]=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[l]=a?o:this._defaultEdgeLabelFn(n,t,r);var s=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=s.v,t=s.w,Object.freeze(s),this._edgeObjs[l]=s,i(this._preds[t],n),i(this._sucs[n],t),this._in[t][l]=s,this._out[n][l]=s,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))},Zu}function Xl(){if(Qu)return Ku;Qu=1;var e=Vl(),n=Yl();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 Ku={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 Fl(){if(ec)return Ju;ec=1;var e=Vl();return Ju=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},Ju}function Zl(){if(tc)return nc;tc=1;var e=Vl();function n(){this._arr=[],this._keyIndices={}}return nc=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},nc}function Ul(){if(oc)return rc;oc=1;var e=Vl(),n=Zl();rc=function(e,r,o,i){return function(e,t,r,o){var i,a,u={},c=new n,l=function(e){var n=e.v!==i?e.v:e.w,t=u[n],o=r(e),l=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);l<t.distance&&(t.distance=l,t.predecessor=i,c.decrease(n,l))};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(l);return u}(e,String(r),o||t,i||function(n){return e.outEdges(n)})};var t=e.constant(1);return rc}function Gl(){if(ac)return ic;ac=1;var e=Ul(),n=Vl();return ic=function(t,r,o){return n.transform(t.nodes(),(function(n,i){n[i]=e(t,i,r,o)}),{})}}function Wl(){if(cc)return uc;cc=1;var e=Vl();return uc=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 l,s=[];do{l=r.pop(),o[l].onStack=!1,s.push(l)}while(u!==l);i.push(s)}}return n.nodes().forEach((function(n){e.has(o,n)||a(n)})),i},uc}function ql(){if(sc)return lc;sc=1;var e=Vl(),n=Wl();return lc=function(t){return e.filter(n(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}}function $l(){if(fc)return dc;fc=1;var e=Vl();dc=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 dc}function Kl(){if(vc)return hc;vc=1;var e=Vl();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 hc=n,n.CycleException=t,t.prototype=new Error,hc}function Ql(){if(gc)return pc;gc=1;var e=Kl();return pc=function(n){try{e(n)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}}function Jl(){if(mc)return yc;mc=1;var e=Vl();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 yc=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},yc}function es(){if(wc)return bc;wc=1;var e=Jl();return bc=function(n,t){return e(n,t,"post")}}function ns(){if(_c)return xc;_c=1;var e=Jl();return xc=function(n,t){return e(n,t,"pre")}}function ts(){if(Sc)return Ec;Sc=1;var e=Vl(),n=Yl(),t=Zl();return Ec=function(r,o){var i,a=new n,u={},c=new t;function l(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 s=!1;c.size()>0;){if(i=c.removeMin(),e.has(u,i))a.setEdge(i,u[i]);else{if(s)throw new Error("Input graph is not connected: "+r);s=!0}r.nodeEdges(i).forEach(l)}return a},Ec}jc.exports;try{Oc=function(){if(Mc)return Cc;Mc=1;var e=$u?qu:($u=1,qu={Graph:Yl(),version:Wu?Gu:(Wu=1,Gu="2.1.8")});return Cc={Graph:e.Graph,json:Xl(),alg:Nc?kc:(Nc=1,kc={components:Fl(),dijkstra:Ul(),dijkstraAll:Gl(),findCycles:ql(),floydWarshall:$l(),isAcyclic:Ql(),postorder:es(),preorder:ns(),prim:ts(),tarjan:Wl(),topsort:Kl()}),version:e.version}}()}catch(X){}Oc||(Oc=window.graphlib);var rs,os,is,as,us,cs,ls,ss,ds,fs,hs,vs,ps,gs,ys,ms,bs,ws,xs,_s,Es,Ss,ks,Ns,Cs,Ms,Os,js,Ps,Is,As,zs,Ts,Ls,Bs,Ds,Rs,Hs,Vs,Ys,Xs,Fs,Zs,Us,Gs,Ws,qs,$s,Ks,Qs,Js,ed,nd,td,rd,od,id,ad,ud,cd,ld,sd,dd,fd,hd,vd,pd,gd,yd,md,bd,wd,xd,_d,Ed,Sd,kd,Nd,Cd,Md,Od,jd,Pd,Id,Ad,zd,Td,Ld,Bd,Dd,Rd,Hd,Vd,Yd=Oc;function Xd(){if(as)return is;as=1;var e=$n(),n=gr(),t=At(),r=rt();return is=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 Fd(){if(ms)return ys;ms=1;var e=function(){if(gs)return ps;gs=1;var e=function(){if(vs)return hs;vs=1;var e=function(){if(fs)return ds;fs=1;var e=/\s/;return ds=function(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}}(),n=/^\s+/;return hs=function(t){return t?t.slice(0,e(t)+1).replace(n,""):t}}(),n=rt(),t=fl(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;return ps=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 l=o.test(u);return l||i.test(u)?a(u.slice(2),l?2:8):r.test(u)?NaN:+u}}(),n=1/0;return ys=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 Zd(){if(Ns)return ks;Ns=1;var e=Il();return ks=function(n){return null!=n&&n.length?e(n,1):[]}}function Ud(){if(zs)return As;zs=1;var e=fl();return As=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,l=a}return l},As}function Gd(){if(Hs)return Rs;Hs=1;var e=vt(),n=$n();return Rs=function(t,r,o){(void 0!==o&&!n(t[r],o)||void 0===o&&!(r in t))&&e(t,r,o)}}function Wd(){return Fs?Xs:(Fs=1,Xs=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]})}function qd(){return td?nd:(td=1,nd=function(e,n){return e<n})}function $d(){if(Id)return Pd;Id=1;var e=vl(),n=ml(),t=_l(),r=Cl(),o=(Nd||(Nd=1,kd=function(e,n){var t=e.length;for(e.sort(n);t--;)e[t]=e[t].value;return e}),kd),i=Tt(),a=function(){if(jd)return Od;jd=1;var e=function(){if(Md)return Cd;Md=1;var e=fl();return Cd=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,l=t==t,s=e(t);if(!c&&!s&&!a&&n>t||a&&u&&l&&!c&&!s||o&&u&&l||!r&&l||!i)return 1;if(!o&&!a&&!s&&n<t||s&&r&&i&&!o&&!a||c&&r&&i||!u&&i||!l)return-1}return 0}}();return Od=function(n,t,r){for(var o=-1,i=n.criteria,a=t.criteria,u=i.length,c=r.length;++o<u;){var l=e(i[o],a[o]);if(l)return o>=c?l:l*("desc"==r[o]?-1:1)}return n.index-t.index}}(),u=el(),c=bt();return Pd=function(l,s,d){s=s.length?e(s,(function(e){return c(e)?function(t){return n(t,1===e.length?e[0]:e)}:e})):[u];var f=-1;s=e(s,i(t));var h=r(l,(function(n,t,r){return{criteria:e(s,(function(e){return e(n)})),index:++f,value:n}}));return o(h,(function(e,n){return a(e,n,d)}))}}try{Vd={cloneDeep:function(){if(os)return rs;os=1;var e=Wc();return rs=function(n){return e(n,5)}}(),constant:$c(),defaults:function(){if(cs)return us;cs=1;var e=Tl(),n=$n(),t=Xd(),r=mr(),o=Object.prototype,i=o.hasOwnProperty,a=e((function(e,a){e=Object(e);var u=-1,c=a.length,l=c>2?a[2]:void 0;for(l&&t(a[0],a[1],l)&&(c=1);++u<c;)for(var s=a[u],d=r(s),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]=s[v])}return e}));return us=a}(),each:rl(),filter:El(),find:function(){if(Ss)return Es;Ss=1;var e=function(){if(ss)return ls;ss=1;var e=_l(),n=gr(),t=yr();return ls=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 l=r(o,i,a);return l>-1?u[c?o[l]:l]:void 0}}}(),n=e(function(){if(_s)return xs;_s=1;var e=Ll(),n=_l(),t=function(){if(ws)return bs;ws=1;var e=Fd();return bs=function(n){var t=e(n),r=t%1;return t==t?r?t-r:t:0}}(),r=Math.max;return xs=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)},xs}());return Es=n}(),flatten:Zd(),forEach:tl(),forIn:function(){if(Ms)return Cs;Ms=1;var e=Kc(),n=nl(),t=mr();return Cs=function(r,o){return null==r?r:e(r,n(o),t)}}(),has:Sl(),isUndefined:Nl(),last:(js||(js=1,Os=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}),Os),map:Ml(),mapValues:function(){if(Is)return Ps;Is=1;var e=vt(),n=Qc(),t=_l();return Ps=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(Ds)return Bs;Ds=1;var e=Ud(),n=Ls?Ts:(Ls=1,Ts=function(e,n){return e>n}),t=el();return Bs=function(r){return r&&r.length?e(r,t,n):void 0},Bs}(),merge:function(){if(ed)return Js;ed=1;var e=function(){if($s)return qs;$s=1;var e=dt(),n=Gd(),t=Kc(),r=function(){if(Ws)return Gs;Ws=1;var e=Gd(),n=Pc(),t=Zc(),r=Ic(),o=Gc(),i=mt(),a=bt(),u=Dl(),c=It(),l=ot(),s=rt(),d=function(){if(Ys)return Vs;Ys=1;var e=tt(),n=Bc(),t=yt(),r=Function.prototype,o=Object.prototype,i=r.toString,a=o.hasOwnProperty,u=i.call(Object);return Vs=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=dr(),h=Wd(),v=function(){if(Us)return Zs;Us=1;var e=gt(),n=mr();return Zs=function(t){return e(t,n(t))}}();return Gs=function(p,g,y,m,b,w,x){var _=h(p,y),E=h(g,y),S=x.get(E);if(S)e(p,y,S);else{var k=w?w(_,E,y+"",p,g,x):void 0,N=void 0===k;if(N){var C=a(E),M=!C&&c(E),O=!C&&!M&&f(E);k=E,C||M||O?a(_)?k=_:u(_)?k=r(_):M?(N=!1,k=n(E,!0)):O?(N=!1,k=t(E,!0)):k=[]:d(E)||i(E)?(k=_,i(_)?k=v(_):s(_)&&!l(_)||(k=o(E))):N=!1}N&&(x.set(E,k),b(k,E,m,w,x),x.delete(E)),e(p,y,k)}}}(),o=rt(),i=mr(),a=Wd();return qs=function u(c,l,s,d,f){c!==l&&t(l,(function(t,i){if(f||(f=new e),o(t))r(c,l,i,s,u,d,f);else{var h=d?d(a(c,i),t,i+"",c,l,f):void 0;void 0===h&&(h=t),n(c,i,h)}}),i)},qs}(),n=function(){if(Qs)return Ks;Qs=1;var e=Tl(),n=Xd();return Ks=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 Js=n}(),min:function(){if(od)return rd;od=1;var e=Ud(),n=qd(),t=el();return rd=function(r){return r&&r.length?e(r,t,n):void 0},rd}(),minBy:function(){if(ad)return id;ad=1;var e=Ud(),n=_l(),t=qd();return id=function(r,o){return r&&r.length?e(r,n(o,2),t):void 0},id}(),now:function(){if(cd)return ud;cd=1;var e=et();return ud=function(){return e.Date.now()}}(),pick:function(){if(md)return yd;md=1;var e=function(){if(vd)return hd;vd=1;var e=function(){if(fd)return dd;fd=1;var e=ml(),n=function(){if(sd)return ld;sd=1;var e=pt(),n=gl(),t=At(),r=rt(),o=yl();return ld=function(i,a,u,c){if(!r(i))return i;for(var l=-1,s=(a=n(a,i)).length,d=s-1,f=i;null!=f&&++l<s;){var h=o(a[l]),v=u;if("__proto__"===h||"constructor"===h||"prototype"===h)return i;if(l!=d){var p=f[h];void 0===(v=c?c(p,h,f):void 0)&&(v=r(p)?p:t(a[l+1])?[]:{})}e(f,h,v),f=f[h]}return i}}(),t=gl();return dd=function(r,o,i){for(var a=-1,u=o.length,c={};++a<u;){var l=o[a],s=e(r,l);i(s,l)&&n(c,t(l,r),s)}return c}}(),n=wl();return hd=function(t,r){return e(t,r,(function(e,r){return n(t,r)}))}}(),n=function(){if(gd)return pd;gd=1;var e=Zd(),n=Al(),t=zl();return pd=function(r){return t(n(r,void 0,e),r+"")}}(),t=n((function(n,t){return null==n?{}:e(n,t)}));return yd=t}(),range:function(){if(Sd)return Ed;Sd=1;var e=function(){if(_d)return xd;_d=1;var e=function(){if(wd)return bd;wd=1;var e=Math.ceil,n=Math.max;return bd=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},bd}(),n=Xd(),t=Fd();return xd=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)}},xd}()();return Ed=e}(),reduce:Ol(),sortBy:function(){if(zd)return Ad;zd=1;var e=Il(),n=$d(),t=Tl(),r=Xd(),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 Ad=o}(),uniqueId:function(){if(Ld)return Td;Ld=1;var e=pl(),n=0;return Td=function(t){var r=++n;return e(t)+r},Td}(),values:Hl(),zipObject:function(){if(Hd)return Rd;Hd=1;var e=pt(),n=(Dd||(Dd=1,Bd=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}),Bd);return Rd=function(t,r){return n(t||[],r||[],e)},Rd}()}}catch(X){}Vd||(Vd=window._);var Kd=Vd,Qd=Jd;function Jd(){var e={};e._next=e._prev=e,this._sentinel=e}function ef(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function nf(e,n){if("_next"!==e&&"_prev"!==e)return n}Jd.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return ef(n),n},Jd.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&ef(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},Jd.prototype.toString=function(){for(var e=[],n=this._sentinel,t=n._prev;t!==n;)e.push(JSON.stringify(t,nf)),t=t._prev;return"["+e.join(", ")+"]"};var tf=Kd,rf=Yd.Graph,of=Qd,af=tf.constant(1);function uf(e,n,t,r,o){var i=o?[]:void 0;return tf.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,cf(n,t,u)})),tf.forEach(e.outEdges(r.v),(function(r){var o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,cf(n,t,a)})),e.removeNode(r.v),i}function cf(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 lf=Kd,sf=function(e,n){if(e.nodeCount()<=1)return[];var t=function(e,n){var t=new rf,r=0,o=0;tf.forEach(e.nodes(),(function(e){t.setNode(e,{v:e,in:0,out:0})})),tf.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=tf.range(o+r+3).map((function(){return new of})),a=r+1;return tf.forEach(t.nodes(),(function(e){cf(i,a,t.node(e))})),{graph:t,buckets:i,zeroIdx:a}}(e,n||af),r=function(e,n,t){for(var r,o=[],i=n[n.length-1],a=n[0];e.nodeCount();){for(;r=a.dequeue();)uf(e,n,t,r);for(;r=i.dequeue();)uf(e,n,t,r);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(r=n[u].dequeue()){o=o.concat(uf(e,n,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return tf.flatten(tf.map(r,(function(n){return e.outEdges(n.v,n.w)})),!0)},df={run:function(e){var n="greedy"===e.graph().acyclicer?sf(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],t={},r={};return lf.forEach(e.nodes(),(function o(i){lf.has(r,i)||(r[i]=!0,t[i]=!0,lf.forEach(e.outEdges(i),(function(e){lf.has(t,e.w)?n.push(e):o(e.w)})),delete t[i])})),n}(e);lf.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,lf.uniqueId("rev"))}))},undo:function(e){lf.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)}}))}},ff=Kd,hf=Yd.Graph,vf={addDummyNode:pf,simplify:function(e){var n=(new hf).setGraph(e.graph());return ff.forEach(e.nodes(),(function(t){n.setNode(t,e.node(t))})),ff.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 hf({multigraph:e.isMultigraph()}).setGraph(e.graph());return ff.forEach(e.nodes(),(function(t){e.children(t).length||n.setNode(t,e.node(t))})),ff.forEach(e.edges(),(function(t){n.setEdge(t,e.edge(t))})),n},successorWeights:function(e){var n=ff.map(e.nodes(),(function(n){var t={};return ff.forEach(e.outEdges(n),(function(n){t[n.w]=(t[n.w]||0)+e.edge(n).weight})),t}));return ff.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=ff.map(e.nodes(),(function(n){var t={};return ff.forEach(e.inEdges(n),(function(n){t[n.v]=(t[n.v]||0)+e.edge(n).weight})),t}));return ff.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,l=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)*l?(u<0&&(l=-l),t=l*a/u,r=l):(a<0&&(c=-c),t=c,r=c*u/a),{x:o+t,y:i+r}},buildLayerMatrix:function(e){var n=ff.map(ff.range(gf(e)+1),(function(){return[]}));return ff.forEach(e.nodes(),(function(t){var r=e.node(t),o=r.rank;ff.isUndefined(o)||(n[o][r.order]=t)})),n},normalizeRanks:function(e){var n=ff.min(ff.map(e.nodes(),(function(n){return e.node(n).rank})));ff.forEach(e.nodes(),(function(t){var r=e.node(t);ff.has(r,"rank")&&(r.rank-=n)}))},removeEmptyRanks:function(e){var n=ff.min(ff.map(e.nodes(),(function(n){return e.node(n).rank}))),t=[];ff.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;ff.forEach(t,(function(n,t){ff.isUndefined(n)&&t%o!=0?--r:r&&ff.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),pf(e,"border",o,n)},maxRank:gf,partition:function(e,n){var t={lhs:[],rhs:[]};return ff.forEach(e,(function(e){n(e)?t.lhs.push(e):t.rhs.push(e)})),t},time:function(e,n){var t=ff.now();try{return n()}finally{console.log(e+" time: "+(ff.now()-t)+"ms")}},notime:function(e,n){return n()}};function pf(e,n,t,r){var o;do{o=ff.uniqueId(r)}while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function gf(e){return ff.max(ff.map(e.nodes(),(function(n){var t=e.node(n).rank;if(!ff.isUndefined(t))return t})))}var yf=Kd,mf=vf,bf={run:function(e){e.graph().dummyChains=[],yf.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,l=n.name,s=e.edge(n),d=s.labelRank;if(c!==a+1){for(e.removeEdge(n),o=0,++a;a<c;++o,++a)s.points=[],r={width:0,height:0,edgeLabel:s,edgeObj:n,rank:a},t=mf.addDummyNode(e,"edge",r,"_d"),a===d&&(r.width=s.width,r.height=s.height,r.dummy="edge-label",r.labelpos=s.labelpos),e.setEdge(i,t,{weight:s.weight},l),0===o&&e.graph().dummyChains.push(t),i=t;e.setEdge(i,u,{weight:s.weight},l)}}(e,n)}))},undo:function(e){yf.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)}))}},wf=Kd,xf=function(e){var n={};wf.forEach(e.sources(),(function t(r){var o=e.node(r);if(wf.has(n,r))return o.rank;n[r]=!0;var i=wf.min(wf.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}))},_f=function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen},Ef=Kd,Sf=Yd.Graph,kf=_f,Nf=function(e){var n,t,r=new Sf({directed:!1}),o=e.nodes()[0],i=e.nodeCount();for(r.setNode(o,{});Cf(r,e)<i;)n=Mf(r,e),t=r.hasNode(n.v)?kf(e,n):-kf(e,n),Of(r,e,t);return r};function Cf(e,n){return Ef.forEach(e.nodes(),(function t(r){Ef.forEach(n.nodeEdges(r),(function(o){var i=o.v,a=r===i?o.w:i;e.hasNode(a)||kf(n,o)||(e.setNode(a,{}),e.setEdge(r,a,{}),t(a))}))})),e.nodeCount()}function Mf(e,n){return Ef.minBy(n.edges(),(function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return kf(n,t)}))}function Of(e,n,t){Ef.forEach(e.nodes(),(function(e){n.node(e).rank+=t}))}var jf=Kd,Pf=Nf,If=_f,Af=xf,zf=Yd.alg.preorder,Tf=Yd.alg.postorder,Lf=vf.simplify,Bf=Df;function Df(e){e=Lf(e),Af(e);var n,t=Pf(e);for(Vf(t),Rf(t,e);n=Xf(t);)Zf(t,e,n,Ff(t,e,n))}function Rf(e,n){var t=Tf(e,e.nodes());t=t.slice(0,t.length-1),jf.forEach(t,(function(t){!function(e,n,t){var r=e.node(t).parent;e.edge(t,r).cutvalue=Hf(e,n,t)}(e,n,t)}))}function Hf(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,jf.forEach(n.nodeEdges(t),(function(i){var u,c,l=i.v===t,s=l?i.w:i.v;if(s!==r){var d=l===o,f=n.edge(i).weight;if(a+=d?f:-f,u=t,c=s,e.hasEdge(u,c)){var h=e.edge(t,s).cutvalue;a+=d?-h:h}}})),a}function Vf(e,n){arguments.length<2&&(n=e.nodes()[0]),Yf(e,{},1,n)}function Yf(e,n,t,r,o){var i=t,a=e.node(r);return n[r]=!0,jf.forEach(e.neighbors(r),(function(o){jf.has(n,o)||(t=Yf(e,n,t,o,r))})),a.low=i,a.lim=t++,o?a.parent=o:delete a.parent,t}function Xf(e){return jf.find(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function Ff(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 l=jf.filter(n.edges(),(function(n){return c===Uf(e,e.node(n.v),u)&&c!==Uf(e,e.node(n.w),u)}));return jf.minBy(l,(function(e){return If(n,e)}))}function Zf(e,n,t,r){var o=t.v,i=t.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),Vf(e),Rf(e,n),function(e,n){var t=jf.find(e.nodes(),(function(e){return!n.node(e).parent})),r=zf(e,t);r=r.slice(1),jf.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 Uf(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}Df.initLowLimValues=Vf,Df.initCutValues=Rf,Df.calcCutValue=Hf,Df.leaveEdge=Xf,Df.enterEdge=Ff,Df.exchangeEdges=Zf;var Gf=xf,Wf=Nf,qf=Bf,$f=Gf;var Kf=Kd,Qf=Kd,Jf=vf,eh={run:function(e){var n=Jf.addDummyNode(e,"root",{},"_root"),t=function(e){var n={};function t(r,o){var i=e.children(r);i&&i.length&&Qf.forEach(i,(function(e){t(e,o+1)})),n[r]=o}return Qf.forEach(e.children(),(function(e){t(e,1)})),n}(e),r=Qf.max(Qf.values(t))-1,o=2*r+1;e.graph().nestingRoot=n,Qf.forEach(e.edges(),(function(n){e.edge(n).minlen*=o}));var i=function(e){return Qf.reduce(e.edges(),(function(n,t){return n+e.edge(t).weight}),0)}(e)+1;Qf.forEach(e.children(),(function(a){nh(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,Qf.forEach(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}};function nh(e,n,t,r,o,i,a){var u=e.children(a);if(u.length){var c=Jf.addBorderNode(e,"_bt"),l=Jf.addBorderNode(e,"_bb"),s=e.node(a);e.setParent(c,a),s.borderTop=c,e.setParent(l,a),s.borderBottom=l,Qf.forEach(u,(function(u){nh(e,n,t,r,o,i,u);var s=e.node(u),d=s.borderTop?s.borderTop:u,f=s.borderBottom?s.borderBottom:u,h=s.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,l,{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 th=Kd,rh=vf;function oh(e,n,t,r,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],c=rh.addDummyNode(e,"border",a,t);o[n][i]=c,e.setParent(c,r),u&&e.setEdge(u,c,{weight:1})}var ih=Kd,ah={adjust:function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||uh(e)},undo:function(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){ih.forEach(e.nodes(),(function(n){lh(e.node(n))})),ih.forEach(e.edges(),(function(n){var t=e.edge(n);ih.forEach(t.points,lh),ih.has(t,"y")&&lh(t)}))}(e),"lr"!==n&&"rl"!==n||(function(e){ih.forEach(e.nodes(),(function(n){sh(e.node(n))})),ih.forEach(e.edges(),(function(n){var t=e.edge(n);ih.forEach(t.points,sh),ih.has(t,"x")&&sh(t)}))}(e),uh(e))}};function uh(e){ih.forEach(e.nodes(),(function(n){ch(e.node(n))})),ih.forEach(e.edges(),(function(n){ch(e.edge(n))}))}function ch(e){var n=e.width;e.width=e.height,e.height=n}function lh(e){e.y=-e.y}function sh(e){var n=e.x;e.x=e.y,e.y=n}var dh=Kd,fh=Kd;function hh(e,n,t){for(var r=fh.zipObject(t,fh.map(t,(function(e,n){return n}))),o=fh.flatten(fh.map(n,(function(n){return fh.sortBy(fh.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=fh.map(new Array(a),(function(){return 0})),c=0;return fh.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 vh=Kd,ph=Kd,gh=Kd,yh=vf;function mh(e,n,t){for(var r;n.length&&(r=gh.last(n)).i<=t;)n.pop(),e.push(r.vs),t++;return t}var bh=Kd,wh=Kd,xh=Yd.Graph,_h=Kd,Eh=Kd,Sh=function(e){var n={},t=dh.filter(e.nodes(),(function(n){return!e.children(n).length})),r=dh.max(dh.map(t,(function(n){return e.node(n).rank}))),o=dh.map(dh.range(r+1),(function(){return[]}));var i=dh.sortBy(t,(function(n){return e.node(n).rank}));return dh.forEach(i,(function t(r){if(!dh.has(n,r)){n[r]=!0;var i=e.node(r);o[i.rank].push(r),dh.forEach(e.successors(r),t)}})),o},kh=function(e,n){for(var t=0,r=1;r<n.length;++r)t+=hh(e,n[r-1],n[r]);return t},Nh=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,l={};u&&(i=bh.filter(i,(function(e){return e!==u&&e!==c})));var s=function(e,n){return vh.map(n,(function(n){var t=e.inEdges(n);if(t.length){var r=vh.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);bh.forEach(s,(function(t){if(n.children(t.v).length){var i=e(n,t.v,r,o);l[t.v]=i,bh.has(i,"barycenter")&&(a=t,u=i,bh.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 ph.forEach(e,(function(e,n){var r=t[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};ph.isUndefined(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)})),ph.forEach(n.edges(),(function(e){var n=t[e.v],r=t[e.w];ph.isUndefined(n)||ph.isUndefined(r)||(r.indegree++,n.out.push(t[e.w]))})),function(e){var n=[];function t(e){return function(n){n.merged||(ph.isUndefined(n.barycenter)||ph.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),ph.forEach(o.in.reverse(),t(o)),ph.forEach(o.out,r(o))}return ph.map(ph.filter(n,(function(e){return!e.merged})),(function(e){return ph.pick(e,["vs","i","barycenter","weight"])}))}(ph.filter(t,(function(e){return!e.indegree})))}(s,r);!function(e,n){bh.forEach(e,(function(e){e.vs=bh.flatten(e.vs.map((function(e){return n[e]?n[e].vs:e})),!0)}))}(d,l);var f=function(e,n){var t,r=yh.partition(e,(function(e){return gh.has(e,"barycenter")})),o=r.lhs,i=gh.sortBy(r.rhs,(function(e){return-e.i})),a=[],u=0,c=0,l=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})),l=mh(a,i,l),gh.forEach(o,(function(e){l+=e.vs.length,a.push(e.vs),u+=e.barycenter*e.weight,c+=e.weight,l=mh(a,i,l)}));var s={vs:gh.flatten(a,!0)};return c&&(s.barycenter=u/c,s.weight=c),s}(d,o);if(u&&(f.vs=bh.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]);bh.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},Ch=function(e,n,t){var r=function(e){for(var n;e.hasNode(n=wh.uniqueId("_root")););return n}(e),o=new xh({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(n){return e.node(n)}));return wh.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),wh.forEach(e[t](i),(function(n){var t=n.v===i?n.w:n.v,r=o.edge(t,i),a=wh.isUndefined(r)?0:r.weight;o.setEdge(t,i,{weight:e.edge(n).weight+a})})),wh.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))})),o},Mh=Yd.Graph,Oh=vf;function jh(e,n,t){return Eh.map(n,(function(n){return Ch(e,n,t)}))}function Ph(e,n){var t=new Mh;Eh.forEach(e,(function(e){var r=e.graph().root,o=Nh(e,r,t,n);Eh.forEach(o.vs,(function(n,t){e.node(n).order=t})),function(e,n,t){var r,o={};_h.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 Ih(e,n){Eh.forEach(n,(function(n){Eh.forEach(n,(function(n,t){e.node(n).order=t}))}))}var Ah=Kd,zh=Yd.Graph,Th=vf;function Lh(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 Bh(e,n,t){if(n>t){var r=n;n=t,t=r}return Ah.has(e[n],t)}var Dh=Kd,Rh=vf,Hh=function(e){var n,t=Th.buildLayerMatrix(e),r=Ah.merge(function(e,n){var t={};return Ah.reduce(n,(function(n,r){var o=0,i=0,a=n.length,u=Ah.last(r);return Ah.forEach(r,(function(n,c){var l=function(e,n){if(e.node(n).dummy)return Ah.find(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),s=l?e.node(l).order:a;(l||n===u)&&(Ah.forEach(r.slice(i,c+1),(function(n){Ah.forEach(e.predecessors(n),(function(r){var i=e.node(r),a=i.order;!(a<o||s<a)||i.dummy&&e.node(n).dummy||Lh(t,r,n)}))})),i=c+1,o=s)})),r})),t}(e,t),function(e,n){var t={};function r(n,r,o,i,a){var u;Ah.forEach(Ah.range(r,o),(function(r){u=n[r],e.node(u).dummy&&Ah.forEach(e.predecessors(u),(function(n){var r=e.node(n);r.dummy&&(r.order<i||r.order>a)&&Lh(t,n,u)}))}))}return Ah.reduce(n,(function(n,t){var o,i=-1,a=0;return Ah.forEach(t,(function(u,c){if("border"===e.node(u).dummy){var l=e.predecessors(u);l.length&&(o=e.node(l[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={};Ah.forEach(["u","d"],(function(i){n="u"===i?t:Ah.values(t).reverse(),Ah.forEach(["l","r"],(function(t){"r"===t&&(n=Ah.map(n,(function(e){return Ah.values(e).reverse()})));var a=("u"===i?e.predecessors:e.successors).bind(e),u=function(e,n,t,r){var o={},i={},a={};return Ah.forEach(n,(function(e){Ah.forEach(e,(function(e,n){o[e]=e,i[e]=e,a[e]=n}))})),Ah.forEach(n,(function(e){var n=-1;Ah.forEach(e,(function(e){var u=r(e);if(u.length){u=Ah.sortBy(u,(function(e){return a[e]}));for(var c=(u.length-1)/2,l=Math.floor(c),s=Math.ceil(c);l<=s;++l){var d=u[l];i[e]===e&&n<a[d]&&!Bh(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 zh,i=e.graph(),a=function(e,n,t){return function(r,o,i){var a,u=r.node(o),c=r.node(i),l=0;if(l+=u.width/2,Ah.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(l+=t?a:-a),a=0,l+=(u.dummy?n:e)/2,l+=(c.dummy?n:e)/2,l+=c.width/2,Ah.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(l+=t?a:-a),a=0,l}}(i.nodesep,i.edgesep,r);return Ah.forEach(n,(function(n){var r;Ah.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)),Ah.forEach(r,(function(e){i[e]=i[t[e]]})),i}(e,n,u.root,u.align,"r"===t);"r"===t&&(c=Ah.mapValues(c,(function(e){return-e}))),o[i+t]=c}))}));var i=function(e,n){return Ah.minBy(Ah.values(n),(function(n){var t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return Ah.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=Ah.values(n),r=Ah.min(t),o=Ah.max(t);Ah.forEach(["u","d"],(function(t){Ah.forEach(["l","r"],(function(i){var a,u=t+i,c=e[u];if(c!==n){var l=Ah.values(c);(a="l"===i?r-Ah.min(l):o-Ah.max(l))&&(e[u]=Ah.mapValues(c,(function(e){return e+a})))}}))}))}(o,i),function(e,n){return Ah.mapValues(e.ul,(function(t,r){if(n)return e[n.toLowerCase()][r];var o=Ah.sortBy(Ah.map(e,r));return(o[1]+o[2])/2}))}(o,e.graph().align)},Vh=Kd,Yh=df,Xh=bf,Fh=function(e){switch(e.graph().ranker){case"network-simplex":default:!function(e){qf(e)}(e);break;case"tight-tree":!function(e){Gf(e),Wf(e)}(e);break;case"longest-path":$f(e)}},Zh=vf.normalizeRanks,Uh=function(e){var n=function(e){var n={},t=0;return Kf.forEach(e.children(),(function r(o){var i=t;Kf.forEach(e.children(o),r),n[o]={low:i,lim:t++}})),n}(e);Kf.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),l=Math.max(n[t].lim,n[r].lim);o=t;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>c||l>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,l=a[c],s=!0;t!==o.w;){if(r=e.node(t),s){for(;(l=a[c])!==u&&e.node(l).maxRank<r.rank;)c++;l===u&&(s=!1)}if(!s){for(;c<a.length-1&&e.node(l=a[c+1]).minRank<=r.rank;)c++;l=a[c]}e.setParent(t,l),t=e.successors(t)[0]}}))},Gh=vf.removeEmptyRanks,Wh=eh,qh=function(e){th.forEach(e.children(),(function n(t){var r=e.children(t),o=e.node(t);if(r.length&&th.forEach(r,n),th.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)oh(e,"borderLeft","_bl",t,o,i),oh(e,"borderRight","_br",t,o,i)}}))},$h=ah,Kh=function(e){var n=Oh.maxRank(e),t=jh(e,Eh.range(1,n+1),"inEdges"),r=jh(e,Eh.range(n-1,-1,-1),"outEdges"),o=Sh(e);Ih(e,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){Ph(u%2?t:r,u%4>=2),o=Oh.buildLayerMatrix(e);var l=kh(e,o);l<a&&(c=0,i=Eh.cloneDeep(o),a=l)}Ih(e,i)},Qh=function(e){(function(e){var n=Rh.buildLayerMatrix(e),t=e.graph().ranksep,r=0;Dh.forEach(n,(function(n){var o=Dh.max(Dh.map(n,(function(n){return e.node(n).height})));Dh.forEach(n,(function(n){e.node(n).y=r+o/2})),r+=o+t}))})(e=Rh.asNonCompoundGraph(e)),Dh.forEach(Hh(e),(function(n,t){e.node(t).x=n}))},Jh=vf,ev=Yd.Graph,nv=["nodesep","edgesep","ranksep","marginx","marginy"],tv={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},rv=["acyclicer","ranker","rankdir","align"],ov=["width","height"],iv={width:0,height:0},av=["minlen","weight","width","height","labeloffset"],uv={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},cv=["labelpos"];function lv(e,n){return Vh.mapValues(Vh.pick(e,n),Number)}function sv(e){var n={};return Vh.forEach(e,(function(e,t){n[t.toLowerCase()]=e})),n}var dv=Kd,fv=vf,hv=Yd.Graph,vv={debugOrdering:function(e){var n=fv.buildLayerMatrix(e),t=new hv({compound:!0,multigraph:!0}).setGraph({});return dv.forEach(e.nodes(),(function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+e.node(n).rank)})),dv.forEach(e.edges(),(function(e){t.setEdge(e.v,e.w,{},e.name)})),dv.forEach(n,(function(e,n){var r="layer"+n;t.setNode(r,{rank:"same"}),dv.reduce(e,(function(e,n){return t.setEdge(e,n,{style:"invis"}),n}))})),t}},pv=qn({graphlib:Yd,layout:function(e,n){var t=n&&n.debugTiming?Jh.time:Jh.notime;t("layout",(function(){var n=t(" buildLayoutGraph",(function(){return function(e){var n=new ev({multigraph:!0,compound:!0}),t=sv(e.graph());return n.setGraph(Vh.merge({},tv,lv(t,nv),Vh.pick(t,rv))),Vh.forEach(e.nodes(),(function(t){var r=sv(e.node(t));n.setNode(t,Vh.defaults(lv(r,ov),iv)),n.setParent(t,e.parent(t))})),Vh.forEach(e.edges(),(function(t){var r=sv(e.edge(t));n.setEdge(t,Vh.merge({},uv,lv(r,av),Vh.pick(r,cv)))})),n}(e)}));t(" runLayout",(function(){!function(e,n){n(" makeSpaceForEdgeLabels",(function(){!function(e){var n=e.graph();n.ranksep/=2,Vh.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){Vh.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(){Yh.run(e)})),n(" nestingGraph.run",(function(){Wh.run(e)})),n(" rank",(function(){Fh(Jh.asNonCompoundGraph(e))})),n(" injectEdgeLabelProxies",(function(){!function(e){Vh.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};Jh.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e)})),n(" removeEmptyRanks",(function(){Gh(e)})),n(" nestingGraph.cleanup",(function(){Wh.cleanup(e)})),n(" normalizeRanks",(function(){Zh(e)})),n(" assignRankMinMax",(function(){!function(e){var n=0;Vh.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=Vh.max(n,r.maxRank))})),e.graph().maxRank=n}(e)})),n(" removeEdgeLabelProxies",(function(){!function(e){Vh.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(){Xh.run(e)})),n(" parentDummyChains",(function(){Uh(e)})),n(" addBorderSegments",(function(){qh(e)})),n(" order",(function(){Kh(e)})),n(" insertSelfEdges",(function(){!function(e){var n=Jh.buildLayerMatrix(e);Vh.forEach(n,(function(n){var t=0;Vh.forEach(n,(function(n,r){var o=e.node(n);o.order=r+t,Vh.forEach(o.selfEdges,(function(n){Jh.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(){$h.adjust(e)})),n(" position",(function(){Qh(e)})),n(" positionSelfEdges",(function(){!function(e){Vh.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){Vh.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(Vh.last(t.borderLeft)),a=e.node(Vh.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}})),Vh.forEach(e.nodes(),(function(n){"border"===e.node(n).dummy&&e.removeNode(n)}))}(e)})),n(" normalize.undo",(function(){Xh.undo(e)})),n(" fixupEdgeLabelCoords",(function(){!function(e){Vh.forEach(e.edges(),(function(n){var t=e.edge(n);if(Vh.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(){$h.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)}Vh.forEach(e.nodes(),(function(n){c(e.node(n))})),Vh.forEach(e.edges(),(function(n){var t=e.edge(n);Vh.has(t,"x")&&c(t)})),n-=a,r-=u,Vh.forEach(e.nodes(),(function(t){var o=e.node(t);o.x-=n,o.y-=r})),Vh.forEach(e.edges(),(function(t){var o=e.edge(t);Vh.forEach(o.points,(function(e){e.x-=n,e.y-=r})),Vh.has(o,"x")&&(o.x-=n),Vh.has(o,"y")&&(o.y-=r)})),i.width=t-n+a,i.height=o-r+u}(e)})),n(" assignNodeIntersects",(function(){!function(e){Vh.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(Jh.intersectRect(i,t)),o.points.push(Jh.intersectRect(a,r))}))}(e)})),n(" reversePoints",(function(){!function(e){Vh.forEach(e.edges(),(function(n){var t=e.edge(n);t.reversed&&t.points.reverse()}))}(e)})),n(" acyclic.undo",(function(){Yh.undo(e)}))}(n,t)})),t(" updateInputGraph",(function(){!function(e,n){Vh.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))})),Vh.forEach(e.edges(),(function(t){var r=e.edge(t),o=n.edge(t);r.points=o.points,Vh.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:vv,util:{time:vf.time,notime:vf.notime},version:"0.8.5"});function gv(e,n,t){var r=(null==t?void 0:t.rankdir)||"TB";console.log("yk rankdir",r);var o=new pv.graphlib.Graph;return o.setDefaultEdgeLabel((function(){return{}})),o.setGraph(X({rankdir:r},t)),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)})),pv.layout(o),e.forEach((function(e){var n=o.node(e.id),t="bottom",i="top";switch(r){case"TB":default: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}}var yv=function(e){return null!==e&&"function"!=typeof e&&isFinite(e.length)},mv=function(e,n){return!!yv(e)&&e.indexOf(n)>-1},bv=function(e,n){if(!yv(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];n(o,r)&&t.push(o)}return t},wv={}.toString,xv=function(e,n){return wv.call(e)==="[object "+n+"]"},_v=function(e){return xv(e,"Function")},Ev=function(e){return null==e},Sv=function(e){return Array.isArray?Array.isArray(e):xv(e,"Array")},kv=function(e){var n=typeof e;return null!==e&&"object"===n||"function"===n};function Nv(e,n){if(e)if(Sv(e))for(var t=0,r=e.length;t<r&&!1!==n(e[t],t);t++);else if(kv(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===n(e[o],o))break}var Cv=Object.keys?function(e){return Object.keys(e)}:function(e){var n=[];return Nv(e,(function(t,r){_v(e)&&"prototype"===r||n.push(r)})),n};function Mv(e,n){var t=Cv(n),r=t.length;if(Ev(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 Ov=function(e){return"object"==typeof e&&null!==e},jv=function(e){if(!Ov(e)||!xv(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},Pv=function(e,n){if(void 0===n&&(n=[]),Sv(e))for(var t=0;t<e.length;t+=1)Pv(e[t],n);else n.push(e);return n},Iv=function(e){if(Sv(e))return e.reduce((function(e,n){return Math.max(e,n)}),e[0])},Av=function(e){if(Sv(e))return e.reduce((function(e,n){return Math.min(e,n)}),e[0])},zv=Array.prototype,Tv=zv.splice,Lv=zv.indexOf,Bv=Array.prototype.splice,Dv=function(e,n){if(!yv(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,Bv.call(e,i,1))}return e},Rv=function(e,n,t){if(!Sv(e)&&!jv(e))return e;var r=t;return Nv(e,(function(e,t){r=n(r,e,t)})),r},Hv=function(e){return xv(e,"String")};function Vv(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 Yv=Object.prototype.hasOwnProperty;function Xv(e,n){if(!n||!Sv(e))return{};for(var t,r={},o=_v(n)?n:function(e){return e[n]},i=0;i<e.length;i++){var a=e[i];t=o(a),Yv.call(r,t)?r[t].push(a):r[t]=[a]}return r}function Fv(e,n){if(!n)return{0:e};if(!_v(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 Xv(e,n)}var Zv={},Uv=function(e){return xv(e,"Number")},Gv=Number.isInteger?Number.isInteger:function(e){return Uv(e)&&e%1==0},Wv=180/Math.PI,qv=parseInt,$v=Math.PI/180,Kv=function(e,n){return e.hasOwnProperty(n)},Qv=Object.values?function(e){return Object.values(e)}:function(e){var n=[];return Nv(e,(function(t,r){_v(e)&&"prototype"===r||n.push(t)})),n},Jv=function(e){return Ev(e)?"":e.toString()},ep={}.toString,np=function(e){return ep.call(e).replace(/^\[object /,"").replace(/]$/,"")},tp=Object.prototype,rp=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||tp)};function op(e,n){for(var t in n)n.hasOwnProperty(t)&&"constructor"!==t&&void 0!==n[t]&&(e[t]=n[t])}function ip(e,n,t,r){return n&&op(e,n),t&&op(e,t),r&&op(e,r),e}var ap=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]=ap(e[t]):n[t]=e[t]}else for(var o in n={},e)"object"==typeof e[o]&&null!=e[o]?n[o]=ap(e[o]):n[o]=e[o];return n},up=function(e,n){if(!_v(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 cp(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&&jv(i)?(jv(e[o])||(e[o]={}),t<r?cp(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 lp,sp=Object.prototype.hasOwnProperty,dp=function(e,n){if(e===n)return!0;if(!e||!n)return!1;if(Hv(e)||Hv(n))return!1;if(yv(e)||yv(n)){if(e.length!==n.length)return!1;for(var t=!0,r=0;r<e.length&&(t=dp(e[r],n[r]));r++);return t}if(Ov(e)||Ov(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=dp(e[o[r]],n[o[r]]));r++);return t}return!1},fp=function(e){return e},hp=Object.prototype.hasOwnProperty,vp={},pp=up((function(e,n){void 0===n&&(n={});var t=n.fontSize,r=n.fontFamily,o=n.fontWeight,i=n.fontStyle,a=n.fontVariant;return lp||(lp=document.createElement("canvas").getContext("2d")),lp.font=[i,a,o,t+"px",r].join(" "),lp.measureText(Hv(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],Qv(n)).join("")})),gp=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}(),yp=Object.freeze({__proto__:null,Cache:gp,assign:ip,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];_v(o)&&(o=o.prototype),ip(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:ap,contains:mv,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)cp(e,n[r]);return e},difference:function(e,n){return void 0===n&&(n=[]),bv(e,(function(e){return!mv(n,e)}))},each:Nv,endsWith:function(e,n){return!(!Sv(e)&&!Hv(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){_v(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=ip(i,e.prototype),e.superclass=o(n.prototype,n),ip(i,t),ip(e,r),e},filter:bv,find:function(e,n){if(!Sv(e))return null;var t;if(_v(n)&&(t=n),jv(n)&&(t=function(e){return Mv(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(!Ev(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:Pv,forIn:Nv,get:function(e,n,t){for(var r=0,o=Hv(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=pp(r,t),u=Hv(e)?e:Jv(e),c=n,l=[];if(pp(e,t)<=n)return e;for(;o=u.substr(0,16),!((i=pp(o,t))+a>c&&i>c);)if(l.push(o),c-=i,!(u=u.substr(16)))return l.join("");for(;o=u.substr(0,1),!((i=pp(o,t))+a>c);)if(l.push(o),c-=i,!(u=u.substr(1)))return l.join("");return""+l.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=Iv(n);return{min:Av(n),max:o}},getType:np,getWrapBehavior:function(e,n){return e["_wrap_"+n]},group:function(e,n){if(!n)return[e];var t=Fv(e,n),r=[];for(var o in t)r.push(t[o]);return r},groupBy:Xv,groupToMap:Fv,has:Kv,hasKey:Kv,hasValue:function(e,n){return mv(Qv(e),n)},head:function(e){if(yv(e))return e[0]},identity:function(e){return e},includes:mv,indexOf:function(e,n){if(!yv(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 xv(e,"Arguments")},isArray:Sv,isArrayLike:yv,isBoolean:function(e){return xv(e,"Boolean")},isDate:function(e){return xv(e,"Date")},isDecimal:function(e){return Uv(e)&&e%1!=0},isElement:function(e){return e instanceof Element||e instanceof HTMLDocument},isEmpty:function(e){if(Ev(e))return!0;if(yv(e))return!e.length;var n=np(e);if("Map"===n||"Set"===n)return!e.size;if(rp(e))return!Object.keys(e).length;for(var t in e)if(sp.call(e,t))return!1;return!0},isEqual:dp,isEqualWith:function(e,n,t){return _v(t)?!!t(e,n):dp(e,n)},isError:function(e){return xv(e,"Error")},isEven:function(e){return Uv(e)&&e%2==0},isFinite:function(e){return Uv(e)&&isFinite(e)},isFunction:_v,isInteger:Gv,isMatch:Mv,isNegative:function(e){return Uv(e)&&e<0},isNil:Ev,isNull:function(e){return null===e},isNumber:Uv,isNumberEqual:function(e,n,t){return void 0===t&&(t=1e-5),Math.abs(e-n)<t},isObject:kv,isObjectLike:Ov,isOdd:function(e){return Uv(e)&&e%2!=0},isPlainObject:jv,isPositive:function(e){return Uv(e)&&e>0},isPrototype:rp,isRegExp:function(e){return xv(e,"RegExp")},isString:Hv,isType:xv,isUndefined:function(e){return void 0===e},keys:Cv,last:function(e){if(yv(e))return e[e.length-1]},lowerCase:function(e){return Jv(e).toLowerCase()},lowerFirst:function(e){var n=Jv(e);return n.charAt(0).toLowerCase()+n.substring(1)},map:function(e,n){if(!yv(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=fp);var t={};return kv(e)&&!Ev(e)&&Object.keys(e).forEach((function(r){t[r]=n(e[r],r)})),t},max:Iv,maxBy:function(e,n){if(Sv(e)){for(var t,r=-1/0,o=0;o<e.length;o++){var i=e[o],a=_v(n)?n(i):i[n];a>r&&(t=i,r=a)}return t}},measureTextWidth:pp,memoize:up,min:Av,minBy:function(e,n){if(Sv(e)){for(var t,r=1/0,o=0;o<e.length;o++){var i=e[o],a=_v(n)?n(i):i[n];a<r&&(t=i,r=a)}return t}},mix:ip,mod:function(e,n){return(e%n+n)%n},noop:function(){},number2color:function(e){var n=Zv[e];if(!n){for(var t=e.toString(16),r=t.length;r<6;r++)t="0"+t;n="#"+t,Zv[e]=n}return n},omit:function(e,n){return Rv(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||!jv(e))return{};var t={};return Nv(n,(function(n){hp.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=Lv.call(e,o))>-1;)Tv.call(e,i,1);return e},pullAt:Dv,reduce:Rv,remove:function(e,n){var t=[];if(!yv(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 Dv(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=Hv(n)?n.split("."):n;return o.forEach((function(e,n){n<o.length-1?(kv(r[e])||(r[e]=Uv(o[n+1])?[]:{}),r=r[e]):r[e]=t})),e},size:function(e){return Ev(e)?0:yv(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(_v(n))t=function(e,t){return n(e)-n(t)};else{var r=[];Hv(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)&&!Hv(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)},l=function(){var l=Date.now();u||!1!==t.leading||(u=l);var s=n-(l-u);return o=this,i=arguments,s<=0||s>n?(r&&(clearTimeout(r),r=null),u=l,a=e.apply(o,i),r||(o=i=null)):r||!1===t.trailing||(r=setTimeout(c,s)),a};return l.cancel=function(){clearTimeout(r),u=0,r=o=i=null},l},toArray:function(e){return yv(e)?Array.prototype.slice.call(e):[]},toDegree:function(e){return Wv*e},toInteger:qv,toRadian:function(e){return $v*e},toString:Jv,union:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Vv([].concat.apply([],e))},uniq:Vv,uniqueId:function(e){return vp[e=e||"g"]?vp[e]+=1:vp[e]=1,e+vp[e]},upperCase:function(e){return Jv(e).toUpperCase()},upperFirst:function(e){var n=Jv(e);return n.charAt(0).toUpperCase()+n.substring(1)},values:Qv,valuesOfKey:function(e,n){for(var t=[],r={},o=0;o<e.length;o++){var i=e[o][n];if(!Ev(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}}),mp={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}(yp).mix,getHeight:function(e,n,t,r){return void 0===r&&(r="height"),"center"===t?(e[r]+n[r])/2:e.height}},bp=mp,wp={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 xp(e,n){var t=this;if(t.vgap=t.hgap=0,e instanceof xp)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}bp.assign(xp.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 _p=function(e,n,t){void 0===n&&(n={});var r,o=new xp(e,n=bp.assign({},wp,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 l=new xp(a[c],n);r.children[c]=l,i.push(l),l.parent=r,l.depth=r.depth+1}}return o},Ep=_p,Sp=function(){function e(e,n){void 0===n&&(n={}),this.options=n,this.rootNode=Ep(e,n)}return e.prototype.execute=function(){throw new Error("please override this method")},e}(),kp=Sp;function Np(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 Cp(e,n,t){t?e.y+=n:e.x+=n,e.children.forEach((function(e){Cp(e,n,t)}))}function Mp(e,n){var t=n?e.y:e.x;return e.children.forEach((function(e){t=Math.min(Mp(e,n),t)})),t}function Op(e,n){Cp(e,-Mp(e,n),n)}function jp(e,n,t){t?n.y=e.x:n.x=e.x,e.c.forEach((function(e,r){jp(e,n.children[r],t)}))}function Pp(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){Pp(e,n,t)}))}Np.fromNode=function(e,n){if(!e)return null;var t=[];return e.children.forEach((function(e){t.push(Np.fromNode(e,n))})),n?new Np(e.height,e.width,e.x,t):new Np(e.width,e.height,e.y,t)};var Ip=_p,Ap=function(e,n){for(var t=Ip(e.data,n,!0),r=Ip(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}},zp=Ap,Tp=["LR","RL","TB","BT","H","V"],Lp=["LR","RL","H"],Bp=Tp[0],Dp=function(e,n,t){var r=n.direction||Bp;if(n.isHorizontal=function(e){return Lp.indexOf(e)>-1}(r),r&&-1===Tp.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===Tp[0])t(e,n);else if(r===Tp[1])t(e,n),e.right2left();else if(r===Tp[2])t(e,n);else if(r===Tp[3])t(e,n),e.bottom2top();else if(r===Tp[4]||r===Tp[5]){var o=zp(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 Rp(e,n){return Rp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Rp(e,n)}var Hp=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,l=e.c[n],s=l.mod;null!==r&&null!==l;){c(r)>t.low&&(t=t.nxt);var d=o+r.prelim+r.w-(s+l.prelim);d>0&&(s+=d,i(e,n,t.index,d));var f=c(r),h=c(l);f<=h&&null!==(r=u(r))&&(o+=r.mod),f>=h&&null!==(l=a(l))&&(s+=l.mod)}!r&&l?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,l,s):r&&!l&&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 l(e,n,t){for(;null!==t&&e>=t.low;)t=t.nxt;return{low:e,index:n,nxt:t}}Pp(e,t);var s=Np.fromNode(e,t);return function e(n){if(0!==n.cs){e(n.c[0]);for(var t=l(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=l(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)}(s),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)}(s,0),jp(s,e,t),Op(e,t),e},Vp=Dp,Yp=mp,Xp=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,Rp(n,t),r.prototype.execute=function(){return Vp(this.rootNode,this.options,Hp)},r}(kp),Fp={},Zp=mp;function Up(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 Gp={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function Wp(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){Wp(e,n.children[r],t)}))}function qp(e,n){return qp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},qp(e,n)}var $p=function(e,n){void 0===n&&(n={}),n=Zp.assign({},Gp,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 Up(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),Wp(o,e,n.isHorizontal),e},Kp=Dp,Qp=mp,Jp=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,qp(n,t),r.prototype.execute=function(){var e=this;return e.rootNode.width=0,Kp(e.rootNode,e.options,$p)},r}(kp),eg={},ng=mp;function tg(e,n){return tg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},tg(e,n)}var rg=kp,og=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+ng.getHeight(n,e,o),n.parent&&e.parent.id!==n.parent.id){var a=n.parent,u=a.y+ng.getHeight(a,e,o);e.y=u>e.y?u:e.y}}else e.y=0}(e,o,n,t,r),o=e}))},ig=Ap,ag=mp,ug=["LR","RL","H"],cg=ug[0],lg=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,tg(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?cg:a,c=e.align;if(u&&-1===ug.indexOf(u))throw new TypeError("Invalid direction: "+u);if(u===ug[0])og(n,r,i,c);else if(u===ug[1])og(n,r,i,c),n.right2left();else if(u===ug[2]){var l=ig(n,e),s=l.left,d=l.right;og(s,r,i,c),s.right2left(),og(d,r,i,c);var f=s.getBoundingBox();d.translate(f.width,0),n.x=d.x-n.width/2}return n},r}(rg),sg={},dg=mp;function fg(e,n){var t=0;return e.children.length?e.children.forEach((function(e){t+=fg(e,n)})):t=e.height,e._subTreeSep=n.getSubTreeSep(e.data),e.totalHeight=Math.max(e.height,t)+2*e._subTreeSep,e.totalHeight}function hg(e){var n=e.children,t=n.length;if(t){n.forEach((function(e){hg(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 vg={getSubTreeSep:function(){return 0}};function pg(e,n){return pg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},pg(e,n)}var gg=function(e,n){void 0===n&&(n={}),n=dg.assign({},vg,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,fg(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}}}})),hg(e)},yg=Dp,mg=mp,bg=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,pg(n,t),r.prototype.execute=function(){return yg(this.rootNode,this.options,gg)},r}(kp),wg={};qn({compactBox:function(e,n){return n=Yp.assign({},Fp,n),new Xp(e,n).execute()},dendrogram:function(e,n){return n=Qp.assign({},eg,n),new Jp(e,n).execute()},indented:function(e,n){return n=ag.assign({},sg,n),new lg(e,n).execute()},mindmap:function(e,n){return n=mg.assign({},wg,n),new bg(e,n).execute()}});var xg={value:()=>{}};function _g(){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 Eg(r)}function Eg(e){this._=e}function Sg(e,n){for(var t,r=0,o=e.length;r<o;++r)if((t=e[r]).name===n)return t.value}function kg(e,n,t){for(var r=0,o=e.length;r<o;++r)if(e[r].name===n){e[r]=xg,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=t&&e.push({name:n,value:t}),e}Eg.prototype=_g.prototype={constructor:Eg,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]=kg(o[t],e.name,n);else if(null==n)for(t in o)o[t]=kg(o[t],e.name,null);return this}for(;++a<u;)if((t=(e=i[a]).type)&&(t=Sg(o[t],e.name)))return t},copy:function(){var e={},n=this._;for(var t in n)e[t]=n[t].slice();return new Eg(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 Ng="http://www.w3.org/1999/xhtml",Cg={svg:"http://www.w3.org/2000/svg",xhtml:Ng,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Mg(e){var n=e+="",t=n.indexOf(":");return t>=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),Cg.hasOwnProperty(n)?{space:Cg[n],local:e}:e}function Og(e){return function(){var n=this.ownerDocument,t=this.namespaceURI;return t===Ng&&n.documentElement.namespaceURI===Ng?n.createElement(e):n.createElementNS(t,e)}}function jg(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Pg(e){var n=Mg(e);return(n.local?jg:Og)(n)}function Ig(){}function Ag(e){return null==e?Ig:function(){return this.querySelector(e)}}function zg(){return[]}function Tg(e){return null==e?zg:function(){return this.querySelectorAll(e)}}function Lg(e){return function(){return this.matches(e)}}function Bg(e){return function(n){return n.matches(e)}}var Dg=Array.prototype.find;function Rg(){return this.firstElementChild}var Hg=Array.prototype.filter;function Vg(){return Array.from(this.children)}function Yg(e){return new Array(e.length)}function Xg(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}function Fg(e,n,t,r,o,i){for(var a,u=0,c=n.length,l=i.length;u<l;++u)(a=n[u])?(a.__data__=i[u],r[u]=a):t[u]=new Xg(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,l,s=new Map,d=n.length,f=i.length,h=new Array(d);for(u=0;u<d;++u)(c=n[u])&&(h[u]=l=a.call(c,c.__data__,u,n)+"",s.has(l)?o[u]=c:s.set(l,c));for(u=0;u<f;++u)l=a.call(e,i[u],u,i)+"",(c=s.get(l))?(r[u]=c,c.__data__=i[u],s.delete(l)):t[u]=new Xg(e,i[u]);for(u=0;u<d;++u)(c=n[u])&&s.get(h[u])===c&&(o[u]=c)}function Ug(e){return e.__data__}function Gg(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Wg(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function qg(e){return function(){this.removeAttribute(e)}}function $g(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Kg(e,n){return function(){this.setAttribute(e,n)}}function Qg(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function Jg(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}function ey(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 ny(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ty(e){return function(){this.style.removeProperty(e)}}function ry(e,n,t){return function(){this.style.setProperty(e,n,t)}}function oy(e,n,t){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,t)}}function iy(e,n){return e.style.getPropertyValue(n)||ny(e).getComputedStyle(e,null).getPropertyValue(n)}function ay(e){return function(){delete this[e]}}function uy(e,n){return function(){this[e]=n}}function cy(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}function ly(e){return e.trim().split(/^|\s+/)}function sy(e){return e.classList||new dy(e)}function dy(e){this._node=e,this._names=ly(e.getAttribute("class")||"")}function fy(e,n){for(var t=sy(e),r=-1,o=n.length;++r<o;)t.add(n[r])}function hy(e,n){for(var t=sy(e),r=-1,o=n.length;++r<o;)t.remove(n[r])}function vy(e){return function(){fy(this,e)}}function py(e){return function(){hy(this,e)}}function gy(e,n){return function(){(n.apply(this,arguments)?fy:hy)(this,e)}}function yy(){this.textContent=""}function my(e){return function(){this.textContent=e}}function by(e){return function(){var n=e.apply(this,arguments);this.textContent=null==n?"":n}}function wy(){this.innerHTML=""}function xy(e){return function(){this.innerHTML=e}}function _y(e){return function(){var n=e.apply(this,arguments);this.innerHTML=null==n?"":n}}function Ey(){this.nextSibling&&this.parentNode.appendChild(this)}function Sy(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ky(){return null}function Ny(){var e=this.parentNode;e&&e.removeChild(this)}function Cy(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function My(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Oy(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 jy(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 Py(e,n,t){var r=ny(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 Iy(e,n){return function(){return Py(this,e,n)}}function Ay(e,n){return function(){return Py(this,e,n.apply(this,arguments))}}Xg.prototype={constructor:Xg,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)}},dy.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 zy=[null];function Ty(e,n){this._groups=e,this._parents=n}function Ly(){return new Ty([[document.documentElement]],zy)}function By(e){return"string"==typeof e?new Ty([[document.querySelector(e)]],[document.documentElement]):new Ty([[e]],zy)}function Dy(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]}Ty.prototype=Ly.prototype={constructor:Ty,select:function(e){"function"!=typeof e&&(e=Ag(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,l=r[o]=new Array(c),s=0;s<c;++s)(i=u[s])&&(a=e.call(i,i.__data__,s,u))&&("__data__"in i&&(a.__data__=i.__data__),l[s]=a);return new Ty(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):Tg(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,l=0;l<c;++l)(a=u[l])&&(r.push(e.call(a,a.__data__,l,u)),o.push(a));return new Ty(r,o)},selectChild:function(e){return this.select(null==e?Rg:function(e){return function(){return Dg.call(this.children,e)}}("function"==typeof e?e:Bg(e)))},selectChildren:function(e){return this.selectAll(null==e?Vg:function(e){return function(){return Hg.call(this.children,e)}}("function"==typeof e?e:Bg(e)))},filter:function(e){"function"!=typeof e&&(e=Lg(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]=[],l=0;l<u;++l)(i=a[l])&&e.call(i,i.__data__,l,a)&&c.push(i);return new Ty(r,this._parents)},data:function(e,n){if(!arguments.length)return Array.from(this,Ug);var t,r=n?Zg:Fg,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),l=new Array(a),s=0;s<a;++s){var d=o[s],f=i[s],h=f.length,v=Gg(e.call(d,d&&d.__data__,s,o)),p=v.length,g=c[s]=new Array(p),y=u[s]=new Array(p);r(d,f,g,y,l[s]=new Array(h),v,n);for(var m,b,w=0,x=0;w<p;++w)if(m=g[w]){for(w>=x&&(x=w+1);!(b=y[x])&&++x<p;);m._next=b||null}}return(u=new Ty(u,o))._enter=c,u._exit=l,u},enter:function(){return new Ty(this._enter||this._groups.map(Yg),this._parents)},exit:function(){return new Ty(this._exit||this._groups.map(Yg),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 l,s=t[c],d=r[c],f=s.length,h=u[c]=new Array(f),v=0;v<f;++v)(l=s[v]||d[v])&&(h[v]=l);for(;c<o;++c)u[c]=t[c];return new Ty(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=Wg);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,l=o[i]=new Array(c),s=0;s<c;++s)(a=u[s])&&(l[s]=a);l.sort(n)}return new Ty(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=Mg(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?$g:qg:"function"==typeof n?t.local?ey:Jg:t.local?Qg:Kg)(t,n))},style:function(e,n,t){return arguments.length>1?this.each((null==n?ty:"function"==typeof n?oy:ry)(e,n,null==t?"":t)):iy(this.node(),e)},property:function(e,n){return arguments.length>1?this.each((null==n?ay:"function"==typeof n?cy:uy)(e,n)):this.node()[e]},classed:function(e,n){var t=ly(e+"");if(arguments.length<2){for(var r=sy(this.node()),o=-1,i=t.length;++o<i;)if(!r.contains(t[o]))return!1;return!0}return this.each(("function"==typeof n?gy:n?vy:py)(t,n))},text:function(e){return arguments.length?this.each(null==e?yy:("function"==typeof e?by:my)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?wy:("function"==typeof e?_y:xy)(e)):this.node().innerHTML},raise:function(){return this.each(Ey)},lower:function(){return this.each(Sy)},append:function(e){var n="function"==typeof e?e:Pg(e);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(e,n){var t="function"==typeof e?e:Pg(e),r=null==n?ky:"function"==typeof n?n:Ag(n);return this.select((function(){return this.insertBefore(t.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(Ny)},clone:function(e){return this.select(e?My:Cy)},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?jy:Oy,r=0;r<a;++r)this.each(u(i[r],n,t));return this}var u=this.node().__on;if(u)for(var c,l=0,s=u.length;l<s;++l)for(r=0,c=u[l];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?Ay:Iy)(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 Ry={passive:!1},Hy={capture:!0,passive:!1};function Vy(e){e.stopImmediatePropagation()}function Yy(e){e.preventDefault(),e.stopImmediatePropagation()}function Xy(e){var n=e.document.documentElement,t=By(e).on("dragstart.drag",Yy,Hy);"onselectstart"in n?t.on("selectstart.drag",Yy,Hy):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Fy(e,n){var t=e.document.documentElement,r=By(e).on("dragstart.drag",null);n&&(r.on("click.drag",Yy,Hy),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 Uy(e,{sourceEvent:n,subject:t,target:r,identifier:o,active:i,x:a,y:u,dx:c,dy:l,dispatch:s}){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:l,enumerable:!0,configurable:!0},_:{value:s}})}function Gy(e){return!e.ctrlKey&&!e.button}function Wy(){return this.parentNode}function qy(e,n){return null==n?{x:e.x,y:e.y}:n}function $y(){return navigator.maxTouchPoints||"ontouchstart"in this}Uy.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Ky={error001:function(){return"[Ink Flow]: Seems like you have not used zustand provider as an ancestor."},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 '@aloudata/".concat(e,"/dist/style.css' or base.css to make sure everything is working properly.")}},Qy=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Jy=["Enter"," ","Escape"],em=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)}))},nm=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)}))},tm=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}}},rm=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=vm(t,n.nodeOrigin);return dm(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return hm(t)},om=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=vm(e,n.nodeOrigin);t=dm(t,r)}})),hm(t)},im=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 am(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),l=c.parentId?r.get(c.parentId):void 0,s=l?tm(l,l.origin||i).positionAbsolute:{x:0,y:0},d=s.x,f=s.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)l&&wm(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(l){var v=c.measured.width,p=c.measured.height,g=l.measured.width,y=l.measured.height;if(v&&p&&g&&y){var m=c.origin||i,b=d+v*m[0],w=f+p*m[1];h=[[b,w],[b+g-v,w+y-p]]}}else null==u||u("005",Ky.error005());var x=wm(h)?cm(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}var um=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},cm=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:um(e.x,n[0][0],n[1][0]),y:um(e.y,n[0][1],n[1][1])}},lm=function(e,n,t){return e<n?um(Math.abs(e-n),1,50)/50:e>t?-um(Math.abs(e-t),1,50)/50:0},sm=function(e,n){return[20*lm(e.x,35,n.width-35),20*lm(e.y,35,n.height-35)]},dm=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)}},fm=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},hm=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},vm=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=tm(e,n).positionAbsolute,l=c.x,s=c.y;return{x:l,y:s,x2:l+(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:s+(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)}},pm=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])}},gm=function(e,n,t,r){var o=e.x,i=e.y,a=Z(n,3),u=a[0],c=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-u)/l,y:(i-c)/l};return t?pm(s,r):s},ym=function(e,n){var t=e.x,r=e.y,o=Z(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}},mm=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),l=um(c,r,o);return{x:n/2-(e.x+e.width/2)*l,y:t/2-(e.y+e.height/2)*l,zoom:l}},bm=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 wm(e){return void 0!==e&&"parent"!==e}function xm(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=Mm(e),c=u.x,l=u.y,s=gm({x:c,y:l},a),d=i?pm(s,r):s,f=d.x,h=d.y;return X({xSnapped:f,ySnapped:h},s)}var _m,Em,Sm,km,Nm,Cm,Mm=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 Om(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 jm(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function Pm(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case Cm.Left:return[t-jm(t-o,a),r];case Cm.Right:return[t+jm(o-t,a),r];case Cm.Top:return[t,r-jm(r-i,a)];case Cm.Bottom:return[t,r+jm(i-r,a)]}}function Im(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Cm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Cm.Top:u,l=e.curvature,s=void 0===l?.25:l,d=Z(Pm({pos:o,x1:n,y1:t,x2:i,y2:a,c:s}),2),f=d[0],h=d[1],v=Z(Pm({pos:c,x1:i,y1:a,x2:n,y2:t,c:s}),2),p=v[0],g=v[1],y=Z(Om({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),m=y[0],b=y[1],w=y[2],x=y[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),m,b,w,x]}function Am(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"}(_m||(_m={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(Em||(Em={})),function(e){e.Partial="partial",e.Full="full"}(Sm||(Sm={})),function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(km||(km={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(Nm||(Nm={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(Cm||(Cm={}));var zm,Tm=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||"")},Lm=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)?X({},e):X(X({},e),{id:Tm(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t},Bm=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=X(X({},i),{id:r.shouldReplaceId?Tm(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)};function Dm(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Z(Am({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,l]}var Rm=((zm={})[Cm.Left]={x:-1,y:0},zm[Cm.Right]={x:1,y:0},zm[Cm.Top]={x:0,y:-1},zm[Cm.Bottom]={x:0,y:1},zm),Hm=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function Vm(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Cm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Cm.Top:u,l=e.borderRadius,s=void 0===l?5:l,d=e.centerX,f=e.centerY,h=e.offset,v=Z(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?Cm.Bottom:a,c=e.target,l=e.targetPosition,s=void 0===l?Cm.Top:l,d=e.center,f=e.offset,h=Rm[u],v=Rm[s],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?Cm.Bottom:t,o=e.target;return r===Cm.Left||r===Cm.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",b=y[m],w=[],x={x:0,y:0},_={x:0,y:0},E=Z(Am({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),S=E[0],k=E[1],N=E[2],C=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 M=[{x:r,y:p.y},{x:r,y:g.y}],O=[{x:p.x,y:o},{x:g.x,y:o}];w=h[m]===b?"x"===m?M:O:"x"===m?O:M}else{var j=[{x:p.x,y:g.y}],P=[{x:g.x,y:p.y}];if(w="x"===m?h.x===b?P:j:h.y===b?j:P,u===s){var I=Math.abs(i[m]-c[m]);if(I<=f){var A=Math.min(f-1,f-I);h[m]===b?x[m]=(p[m]>i[m]?-1:1)*A:_[m]=(g[m]>c[m]?-1:1)*A}}if(u!==s){var z="x"===m?"y":"x",T=h[m]===v[z],L=p[z]>g[z],B=p[z]<g[z];(1===h[m]&&(!T&&L||T&&B)||1!==h[m]&&(!T&&B||T&&L))&&(w="x"===m?j:P)}var D={x:p.x+x.x,y:p.y+x.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[U(U([i,{x:p.x+x.x,y:p.y+x.y}],Z(w),!1),[{x:g.x+_.x,y:g.y+_.y},c],!1),r,o,N,C]}({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],b=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(Hm(e,n)/2,Hm(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 l=e.x<t.x?1:-1,s=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*s,"Q ").concat(i,",").concat(a," ").concat(i+o*l,",").concat(a)}(p[t-1],n,p[t+1],s):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+r}),"");return[w,g,y,m,b]}function Ym(e,n){if(!e.parentId)return!1;var t=n.get(e.parentId);return!!t&&(!!t.selected||Ym(t,n))}function Xm(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 Fm(e){var n,t,r,o,i=e.nodeId,a=e.dragItems,u=e.nodeLookup,c=[];try{for(var l=F(a),s=l.next();!s.done;s=l.next()){var d=Z(s.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(X(X({},v),{position:h.position}))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=l.return)&&t.call(l)}finally{if(n)throw n.error}}if(!i)return[c[0],c];var p=u.get(i).internals.userNode;return[X(X({},p),{position:(null===(o=a.get(i))||void 0===o?void 0:o.position)||p.position}),c]}function Zm(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,l=!1,s={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 b(e,n){var r,i,u=e.x,l=e.y,s=t(),d=s.nodeLookup,f=s.nodeExtent,h=s.snapGrid,v=s.snapToGrid,p=s.nodeOrigin,g=s.onNodeDrag,y=s.onSelectionDrag,b=s.onError,w=s.updateNodePositions;a={x:u,y:l};var x=!1,_={x:0,y:0,x2:0,y2:0};if(c.size>1&&f){var E=om(c,{nodeOrigin:p});_=fm(E)}try{for(var S=F(c),k=S.next();!k.done;k=S.next()){var N=Z(k.value,2),C=N[0],M=N[1],O={x:u-M.distance.x,y:l-M.distance.y};v&&(O=pm(O,h));var j=[[f[0][0],f[0][1]],[f[1][0],f[1][1]]];if(c.size>1&&f&&!M.extent){var P=M.internals.positionAbsolute,I=P.x-_.x+f[0][0],A=P.x+M.measured.width-_.x2+f[1][0];j=[[I,P.y-_.y+f[0][1]],[A,P.y+M.measured.height-_.y2+f[1][1]]]}var z=am({nodeId:C,nextPosition:O,nodeLookup:d,nodeExtent:j,nodeOrigin:p,onError:b}),T=z.position,L=z.positionAbsolute;x=x||M.position.x!==T.x||M.position.y!==T.y,M.position=T,M.internals.positionAbsolute=L}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(x&&(w(c,!0),n&&(o||g||!m&&y))){var B=Z(Fm({nodeId:m,dragItems:c,nodeLookup:d}),2),D=B[0],R=B[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=Z(sm(s,d),2),o=r[0],i=r[1];if(0!==o||0!==i){var c=t(),l=c.transform,f=c.panBy;a.x=(null!==(e=a.x)&&void 0!==e?e:0)-o/l[2],a.y=(null!==(n=a.y)&&void 0!==n?n:0)-i/l[2],f({x:o,y:i})&&b(a,null)}u=requestAnimationFrame(w)}}function x(e){var o,i=t(),u=i.nodeLookup,l=i.multiSelectionActive,s=i.nodesDraggable,d=i.transform,h=i.snapGrid,v=i.snapToGrid,p=i.selectNodesOnDrag,g=i.onNodeDragStart,b=i.onSelectionDragStart,w=i.unselectNodesAndEdges;f=!0,p&&y||l||!m||(null===(o=u.get(m))||void 0===o?void 0:o.selected)||w(),y&&p&&m&&(null==n||n(m));var x=xm(e.sourceEvent,{transform:d,snapGrid:h,snapToGrid:v});if(a=x,c=function(e,n,t,r){var o,i,a,u,c=new Map;try{for(var l=F(e),s=l.next();!s.done;s=l.next()){var d=Z(s.value,2),f=d[0],h=d[1];if((h.selected||h.id===r)&&(!h.parentId||!Ym(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{s&&!s.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}return c}(u,s,x,m),c.size>0&&(r||g||!m&&b)){var _=Z(Fm({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==b||b(e.sourceEvent,S)}}h=By(g);var _=function(){var e,n,t,r,o=Gy,i=Wy,a=qy,u=$y,c={},l=_g("start","drag","end"),s=0,d=0;function f(e){e.on("mousedown.drag",h).filter(u).on("touchstart.drag",g).on("touchmove.drag",y,Ry).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=b(this,i.call(this,a,u),a,u,"mouse");c&&(By(a.view).on("mousemove.drag",v,Hy).on("mouseup.drag",p,Hy),Xy(a.view),Vy(a),t=!1,e=a.clientX,n=a.clientY,c("start",a))}}function v(r){if(Yy(r),!t){var o=r.clientX-e,i=r.clientY-n;t=o*o+i*i>d}c.mouse("drag",r)}function p(e){By(e.view).on("mousemove.drag mouseup.drag",null),Fy(e.view,t),Yy(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=b(this,u,e,n,a[t].identifier,a[t]))&&(Vy(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])&&(Yy(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])&&(Vy(e),t("end",e,o[n]))}function b(e,n,t,r,o,i){var u,d,h,v=l.copy(),p=Dy(i||t,n);if(null!=(h=a.call(e,new Uy("beforestart",{sourceEvent:t,target:f,identifier:o,active:s,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,l){var g,y=p;switch(i){case"start":c[o]=t,g=s++;break;case"end":delete c[o],--s;case"drag":p=Dy(l||a,n),g=s}v.call(i,e,new Uy(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=l.on.apply(l,arguments);return e===l?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&&x(e);var l=xm(e.sourceEvent,{transform:i,snapGrid:u,snapToGrid:c});a=l,d=(null==r?void 0:r.getBoundingClientRect())||null,s=Mm(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=xm(e.sourceEvent,{transform:u,snapGrid:h,snapToGrid:v});if(!l&&i&&f&&(l=!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&&x(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&c&&f&&(s=Mm(e.sourceEvent,d),b(g,e.sourceEvent))})).on("end",(function(e){if(f&&(l=!1,f=!1,cancelAnimationFrame(u),c.size>0)){var n=t(),r=n.nodeLookup,o=n.updateNodePositions,a=n.onNodeDragStop,s=n.onSelectionDragStop;if(o(c,!1),i||a||!m&&s){var d=Z(Fm({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==s||s(e.sourceEvent,v)}}})).filter((function(e){var n=e.target;return!e.button&&(!v||!Xm(n,".".concat(v),g))&&(!p||Xm(n,p,g))}));h.call(_)},destroy:function(){null==h||h.on(".drag",null)}}}function Um(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 Gm(e,n){return e||((null==n?void 0:n.classList.contains("target"))?"target":(null==n?void 0:n.classList.contains("source"))?"source":null)}var Wm=function(){return!0},qm=null;function $m(e,n){var t=n.handle,r=n.connectionMode,o=n.fromNodeId,i=n.fromHandleId,a=n.fromType,u=n.doc,c=n.lib,l=n.flowId,s=n.isValidConnection,d=void 0===s?Wm:s,f="target"===a,h=t?u.querySelector(".".concat(c,'-flow__handle[data-id="').concat(l,"-").concat(null==t?void 0:t.nodeId,"-").concat(null==t?void 0:t.id,"-").concat(null==t?void 0:t.type,'"]')):null,v=Mm(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,b={handleDomNode:m,isValid:!1,connection:null,endHandle:null};if(m){var w=Gm(void 0,m),x=m.getAttribute("data-nodeid"),_=m.getAttribute("data-handleid"),E=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!x)return b;var k={source:f?x:o,sourceHandle:f?_:i,target:f?o:x,targetHandle:f?i:_};b.connection=k,E&&S&&(r===_m.Strict?f&&"source"===w||!f&&"target"===w:x!==o||_!==i)&&(b.endHandle={nodeId:x,handleId:_,type:w},b.isValid=d(k))}return b}var Km={onPointerDown:function(e,n){var t,r=n.connectionMode,o=n.connectionRadius,i=n.handleId,a=n.nodeId,u=n.edgeUpdaterType,c=n.isTarget,l=n.domNode,s=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,b=n.isValidConnection,w=void 0===b?Wm:b,x=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),N=0,C=Mm(e),M=C.x,O=C.y,j=null==k?void 0:k.elementFromPoint(M,O),P=Gm(u,j),I=null==l?void 0:l.getBoundingClientRect();if(I&&P){var A=Mm(e,I),z=!1,T=null,L=!1,B=null,D=function(e){var n,t,r=e.nodeLookup,o=e.nodeId,i=e.handleId,a=e.handleType,u=[];try{for(var c=F(r),l=c.next();!l.done;l=c.next()){var s=Z(l.value,2)[1];if(s.internals.handleBounds){var d="".concat(o,"-").concat(i,"-").concat(a),f=Um(s,s.internals.handleBounds,"source",d),h=Um(s,s.internals.handleBounds,"target",d);u.push.apply(u,U(U([],Z(f),!1),Z(h),!1))}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return u}({nodeLookup:s,nodeId:a,handleId:i,handleType:P});_({connectionPosition:A,connectionStatus:null,connectionStartHandle:qm={nodeId:a,handleId:i,type:P},connectionEndHandle:null}),null==g||g(e,{nodeId:a,handleId:i,handleType:P}),k.addEventListener("mousemove",H),k.addEventListener("mouseup",V),k.addEventListener("touchmove",H),k.addEventListener("touchend",V)}function R(){if(f&&I){var e=Z(sm(A,I),2),n=e[0],t=e[1];v({x:n,y:t}),N=requestAnimationFrame(R)}}function H(e){S()||V(e);var n=E();A=Mm(e,I),t=function(e,n,t){var r,o,i=[],a=1/0;try{for(var u=F(t),c=u.next();!c.done;c=u.next()){var l=c.value,s=Math.sqrt(Math.pow(l.x-e.x,2)+Math.pow(l.y-e.y,2));s<=n&&(s<a?i=[l]:s===a&&i.push(l),a=s)}}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}(gm(A,n,!1,[1,1]),o,D),z||(R(),z=!0);var u,l,s,f=$m(e,{handle:t,connectionMode:r,fromNodeId:a,fromHandleId:i,fromType:c?"target":"source",isValidConnection:w,doc:k,lib:d,flowId:h});B=f.handleDomNode,T=f.connection,L=f.isValid,_({connectionStartHandle:qm,connectionPosition:t&&L?ym({x:t.x,y:t.y},n):A,connectionStatus:(u=!!t,l=L,s=null,l?s="valid":u&&!l&&(s="invalid"),s),connectionEndHandle:f.endHandle})}function V(e){(t||B)&&T&&L&&(null==y||y(T)),null==m||m(e),u&&(null==x||x(e)),p(),cancelAnimationFrame(N),z=!1,L=!1,T=null,B=null,qm=null,k.removeEventListener("mousemove",H),k.removeEventListener("mouseup",V),k.removeEventListener("touchmove",H),k.removeEventListener("touchend",V)}},isValid:$m};function Qm(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function Jm(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function eb(){}var nb=.7,tb=1/nb,rb="\\s*([+-]?\\d+)\\s*",ob="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ib="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ab=/^#([0-9a-f]{3,8})$/,ub=new RegExp(`^rgb\\(${rb},${rb},${rb}\\)$`),cb=new RegExp(`^rgb\\(${ib},${ib},${ib}\\)$`),lb=new RegExp(`^rgba\\(${rb},${rb},${rb},${ob}\\)$`),sb=new RegExp(`^rgba\\(${ib},${ib},${ib},${ob}\\)$`),db=new RegExp(`^hsl\\(${ob},${ib},${ib}\\)$`),fb=new RegExp(`^hsla\\(${ob},${ib},${ib},${ob}\\)$`),hb={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 vb(){return this.rgb().formatHex()}function pb(){return this.rgb().formatRgb()}function gb(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=ab.exec(e))?(t=n[1].length,n=parseInt(n[1],16),6===t?yb(n):3===t?new wb(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===t?mb(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===t?mb(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=ub.exec(e))?new wb(n[1],n[2],n[3],1):(n=cb.exec(e))?new wb(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=lb.exec(e))?mb(n[1],n[2],n[3],n[4]):(n=sb.exec(e))?mb(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=db.exec(e))?Nb(n[1],n[2]/100,n[3]/100,1):(n=fb.exec(e))?Nb(n[1],n[2]/100,n[3]/100,n[4]):hb.hasOwnProperty(e)?yb(hb[e]):"transparent"===e?new wb(NaN,NaN,NaN,0):null}function yb(e){return new wb(e>>16&255,e>>8&255,255&e,1)}function mb(e,n,t,r){return r<=0&&(e=n=t=NaN),new wb(e,n,t,r)}function bb(e,n,t,r){return 1===arguments.length?((o=e)instanceof eb||(o=gb(o)),o?new wb((o=o.rgb()).r,o.g,o.b,o.opacity):new wb):new wb(e,n,t,null==r?1:r);var o}function wb(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}function xb(){return`#${kb(this.r)}${kb(this.g)}${kb(this.b)}`}function _b(){const e=Eb(this.opacity);return`${1===e?"rgb(":"rgba("}${Sb(this.r)}, ${Sb(this.g)}, ${Sb(this.b)}${1===e?")":`, ${e})`}`}function Eb(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Sb(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function kb(e){return((e=Sb(e))<16?"0":"")+e.toString(16)}function Nb(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new Mb(e,n,t,r)}function Cb(e){if(e instanceof Mb)return new Mb(e.h,e.s,e.l,e.opacity);if(e instanceof eb||(e=gb(e)),!e)return new Mb;if(e instanceof Mb)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 Mb(a,u,c,e.opacity)}function Mb(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}function Ob(e){return(e=(e||0)%360)<0?e+360:e}function jb(e){return Math.max(0,Math.min(1,e||0))}function Pb(e,n,t){return 255*(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)}Qm(eb,gb,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:vb,formatHex:vb,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Cb(this).formatHsl()},formatRgb:pb,toString:pb}),Qm(wb,bb,Jm(eb,{brighter(e){return e=null==e?tb:Math.pow(tb,e),new wb(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?nb:Math.pow(nb,e),new wb(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wb(Sb(this.r),Sb(this.g),Sb(this.b),Eb(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:xb,formatHex:xb,formatHex8:function(){return`#${kb(this.r)}${kb(this.g)}${kb(this.b)}${kb(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:_b,toString:_b})),Qm(Mb,(function(e,n,t,r){return 1===arguments.length?Cb(e):new Mb(e,n,t,null==r?1:r)}),Jm(eb,{brighter(e){return e=null==e?tb:Math.pow(tb,e),new Mb(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?nb:Math.pow(nb,e),new Mb(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 wb(Pb(e>=240?e-240:e+120,o,r),Pb(e,o,r),Pb(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Mb(Ob(this.h),jb(this.s),jb(this.l),Eb(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=Eb(this.opacity);return`${1===e?"hsl(":"hsla("}${Ob(this.h)}, ${100*jb(this.s)}%, ${100*jb(this.l)}%${1===e?")":`, ${e})`}`}}));var Ib=e=>()=>e;function Ab(e,n){var t=n-e;return t?function(e,n){return function(t){return e+t*n}}(e,t):Ib(isNaN(e)?n:e)}var zb=function e(n){var t=function(e){return 1==(e=+e)?Ab: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):Ib(isNaN(n)?t:n)}}(n);function r(e,n){var r=t((e=bb(e)).r,(n=bb(n)).r),o=t(e.g,n.g),i=t(e.b,n.b),a=Ab(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 Tb(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}var Lb=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Bb=new RegExp(Lb.source,"g");function Db(e,n){var t,r,o,i=Lb.lastIndex=Bb.lastIndex=0,a=-1,u=[],c=[];for(e+="",n+="";(t=Lb.exec(e))&&(r=Bb.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:Tb(t,r)})),i=Bb.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 Rb,Hb=180/Math.PI,Vb={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Yb(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)*Hb,skewX:Math.atan(c)*Hb,scaleX:a,scaleY:u}}function Xb(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:Tb(e,o)},{i:c-2,x:Tb(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:Tb(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:Tb(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:Tb(e,t)},{i:u-2,x:Tb(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 Fb=Xb((function(e){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Vb:Yb(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),Zb=Xb((function(e){return null==e?Vb:(Rb||(Rb=document.createElementNS("http://www.w3.org/2000/svg","g")),Rb.setAttribute("transform",e),(e=Rb.transform.baseVal.consolidate())?Yb((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Vb)}),", ",")",")");function Ub(e){return((e=Math.exp(e))+1/e)/2}var Gb,Wb,qb=function e(n,t,r){function o(e,o){var i,a,u=e[0],c=e[1],l=e[2],s=o[0],d=o[1],f=o[2],h=s-u,v=d-c,p=h*h+v*v;if(p<1e-12)a=Math.log(f/l)/n,i=function(e){return[u+e*h,c+e*v,l*Math.exp(n*e*a)]};else{var g=Math.sqrt(p),y=(f*f-l*l+r*p)/(2*l*t*g),m=(f*f-l*l-r*p)/(2*f*t*g),b=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(m*m+1)-m);a=(w-b)/n,i=function(e){var r,o=e*a,i=Ub(b),s=l/(t*g)*(i*(r=n*o+b,((r=Math.exp(2*r))-1)/(r+1))-function(e){return((e=Math.exp(e))-1/e)/2}(b));return[u+s*h,c+s*v,l*i/Ub(n*o+b)]}}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),$b=0,Kb=0,Qb=0,Jb=1e3,ew=0,nw=0,tw=0,rw="object"==typeof performance&&performance.now?performance:Date,ow="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function iw(){return nw||(ow(aw),nw=rw.now()+tw)}function aw(){nw=0}function uw(){this._call=this._time=this._next=null}function cw(e,n,t){var r=new uw;return r.restart(e,n,t),r}function lw(){nw=(ew=rw.now())+tw,$b=Kb=0;try{!function(){iw(),++$b;for(var e,n=Gb;n;)(e=nw-n._time)>=0&&n._call.call(void 0,e),n=n._next;--$b}()}finally{$b=0,function(){for(var e,n,t=Gb,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:Gb=n);Wb=e,dw(r)}(),nw=0}}function sw(){var e=rw.now(),n=e-ew;n>Jb&&(tw-=n,ew=e)}function dw(e){$b||(Kb&&(Kb=clearTimeout(Kb)),e-nw>24?(e<1/0&&(Kb=setTimeout(lw,e-rw.now()-tw)),Qb&&(Qb=clearInterval(Qb))):(Qb||(ew=rw.now(),Qb=setInterval(sw,Jb)),$b=1,ow(lw)))}function fw(e,n,t){var r=new uw;return n=null==n?0:+n,r.restart((t=>{r.stop(),e(t+n)}),n,t),r}uw.prototype=cw.prototype={constructor:uw,restart:function(e,n,t){if("function"!=typeof e)throw new TypeError("callback is not a function");t=(null==t?iw():+t)+(null==n?0:+n),this._next||Wb===this||(Wb?Wb._next=this:Gb=this,Wb=this),this._call=e,this._time=t,dw()},stop:function(){this._call&&(this._call=null,this._time=1/0,dw())}};var hw=_g("start","end","cancel","interrupt"),vw=[],pw=0,gw=2,yw=3,mw=5,bw=6;function ww(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 l,s,d,f;if(1!==t.state)return u();for(l in o)if((f=o[l]).name===t.name){if(f.state===yw)return fw(i);4===f.state?(f.state=bw,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[l]):+l<n&&(f.state=bw,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[l])}if(fw((function(){t.state===yw&&(t.state=4,t.timer.restart(a,t.delay,t.time),a(c))})),t.state=gw,t.on.call("start",e,e.__data__,t.index,t.group),t.state===gw){for(t.state=yw,r=new Array(d=t.tween.length),l=0,s=-1;l<d;++l)(f=t.tween[l].value.call(e,e.__data__,t.index,t.group))&&(r[++s]=f);r.length=s+1}}function a(n){for(var o=n<t.duration?t.ease.call(null,n/t.duration):(t.timer.restart(u),t.state=mw,1),i=-1,a=r.length;++i<a;)r[i].call(e,o);t.state===mw&&(t.on.call("end",e,e.__data__,t.index,t.group),u())}function u(){for(var r in t.state=bw,t.timer.stop(),delete o[n],o)return;delete e.__transition}o[n]=t,t.timer=cw((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:hw,tween:vw,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:pw})}function xw(e,n){var t=Ew(e,n);if(t.state>pw)throw new Error("too late; already scheduled");return t}function _w(e,n){var t=Ew(e,n);if(t.state>yw)throw new Error("too late; already running");return t}function Ew(e,n){var t=e.__transition;if(!t||!(t=t[n]))throw new Error("transition not found");return t}function Sw(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>gw&&t.state<mw,t.state=bw,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 kw(e,n){var t,r;return function(){var o=_w(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 Nw(e,n,t){var r,o;if("function"!=typeof t)throw new Error;return function(){var i=_w(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:n,value:t},c=0,l=o.length;c<l;++c)if(o[c].name===n){o[c]=u;break}c===l&&o.push(u)}i.tween=o}}function Cw(e,n,t){var r=e._id;return e.each((function(){var e=_w(this,r);(e.value||(e.value={}))[n]=t.apply(this,arguments)})),function(e){return Ew(e,r).value[n]}}function Mw(e,n){var t;return("number"==typeof n?Tb:n instanceof gb?zb:(t=gb(n))?(n=t,zb):Db)(e,n)}function Ow(e){return function(){this.removeAttribute(e)}}function jw(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Pw(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 zw(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 Tw(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 Lw(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 Bw(e,n){return function(){xw(this,e).delay=+n.apply(this,arguments)}}function Dw(e,n){return n=+n,function(){xw(this,e).delay=n}}function Rw(e,n){return function(){_w(this,e).duration=+n.apply(this,arguments)}}function Hw(e,n){return n=+n,function(){_w(this,e).duration=n}}var Vw=Ly.prototype.constructor;function Yw(e){return function(){this.style.removeProperty(e)}}var Xw=0;function Fw(e,n,t,r){this._groups=e,this._parents=n,this._name=t,this._id=r}function Zw(){return++Xw}var Uw=Ly.prototype;Fw.prototype={constructor:Fw,select:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=Ag(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,l=r[a],s=l.length,d=i[a]=new Array(s),f=0;f<s;++f)(u=l[f])&&(c=e.call(u,u.__data__,f,l))&&("__data__"in u&&(c.__data__=u.__data__),d[f]=c,ww(d[f],n,t,f,d,Ew(u,t)));return new Fw(i,this._parents,n,t)},selectAll:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=Tg(e));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var c,l=r[u],s=l.length,d=0;d<s;++d)if(c=l[d]){for(var f,h=e.call(c,c.__data__,d,l),v=Ew(c,t),p=0,g=h.length;p<g;++p)(f=h[p])&&ww(f,n,t,p,h,v);i.push(h),a.push(c)}return new Fw(i,a,n,t)},selectChild:Uw.selectChild,selectChildren:Uw.selectChildren,filter:function(e){"function"!=typeof e&&(e=Lg(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]=[],l=0;l<u;++l)(i=a[l])&&e.call(i,i.__data__,l,a)&&c.push(i);return new Fw(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,l=n[u],s=t[u],d=l.length,f=a[u]=new Array(d),h=0;h<d;++h)(c=l[h]||s[h])&&(f[h]=c);for(;u<r;++u)a[u]=n[u];return new Fw(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=Zw(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,l=0;l<c;++l)if(a=u[l]){var s=Ew(a,n);ww(a,e,t,l,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new Fw(r,this._parents,e,t)},call:Uw.call,nodes:Uw.nodes,node:Uw.node,size:Uw.size,empty:Uw.empty,each:Uw.each,on:function(e,n){var t=this._id;return arguments.length<2?Ew(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)?xw:_w;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=Mg(e),r="transform"===t?Zb:Mw;return this.attrTween(e,"function"==typeof n?(t.local?zw:Aw)(t,r,Cw(this,"attr."+e,n)):null==n?(t.local?jw:Ow)(t):(t.local?Iw:Pw)(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=Mg(e);return this.tween(t,(r.local?Tw:Lw)(r,n))},style:function(e,n,t){var r="transform"==(e+="")?Fb:Mw;return null==n?this.styleTween(e,function(e,n){var t,r,o;return function(){var i=iy(this,e),a=(this.style.removeProperty(e),iy(this,e));return i===a?null:i===t&&a===r?o:o=n(t=i,r=a)}}(e,r)).on("end.style."+e,Yw(e)):"function"==typeof n?this.styleTween(e,function(e,n,t){var r,o,i;return function(){var a=iy(this,e),u=t(this),c=u+"";return null==u&&(this.style.removeProperty(e),c=u=iy(this,e)),a===c?null:a===r&&c===o?i:(o=c,i=n(r=a,u))}}(e,r,Cw(this,"style."+e,n))).each(function(e,n){var t,r,o,i,a="style."+n,u="end."+a;return function(){var c=_w(this,e),l=c.on,s=null==c.value[a]?i||(i=Yw(n)):void 0;l===t&&o===s||(r=(t=l).copy()).on(u,o=s),c.on=r}}(this._id,e)):this.styleTween(e,function(e,n,t){var r,o,i=t+"";return function(){var a=iy(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}}(Cw(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=Ew(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?kw:Nw)(t,e,n))},delay:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?Bw:Dw)(n,e)):Ew(this.node(),n).delay},duration:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?Rw:Hw)(n,e)):Ew(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(){_w(this,e).ease=n}}(n,e)):Ew(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;_w(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=_w(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]:Uw[Symbol.iterator]};var Gw={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Ww(e,n){for(var t;!(t=e.__transition)||!(t=t[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return t}Ly.prototype.interrupt=function(e){return this.each((function(){Sw(this,e)}))},Ly.prototype.transition=function(e){var n,t;e instanceof Fw?(n=e._id,e=e._name):(n=Zw(),(t=Gw).time=iw(),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,l=0;l<c;++l)(a=u[l])&&ww(a,e,n,l,u,t||Ww(a,n));return new Fw(r,this._parents,e,n)};var qw=e=>()=>e;function $w(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 Kw(e,n,t){this.k=e,this.x=n,this.y=t}Kw.prototype={constructor:Kw,scale:function(e){return 1===e?this:new Kw(this.k*e,this.x,this.y)},translate:function(e,n){return 0===e&0===n?this:new Kw(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 Qw=new Kw(1,0,0);function Jw(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Qw;return e.__zoom}function ex(e){e.stopImmediatePropagation()}function nx(e){e.preventDefault(),e.stopImmediatePropagation()}function tx(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function rx(){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 ox(){return this.__zoom||Qw}function ix(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ax(){return navigator.maxTouchPoints||"ontouchstart"in this}function ux(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))}Jw.prototype=Kw.prototype;var cx,lx=function(e,n){return e.x!==n.x||e.y!==n.y||e.zoom!==n.k},sx=function(e){return{x:e.x,y:e.y,zoom:e.k}},dx=function(e){var n=e.x,t=e.y,r=e.zoom;return Qw.translate(n,t).scale(r)},fx=function(e,n){return e.target.closest(".".concat(n))},hx=function(e,n){return 2===n&&Array.isArray(e)&&e.includes(2)},vx=function(e,n){return void 0===n&&(n=0),"number"==typeof n&&n>0?e.transition().duration(n):e},px=function(e){var n=e.ctrlKey&&bm()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*n};function gx(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,l=e.onTransformChange,s=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=tx,o=rx,i=ux,a=ix,u=ax,c=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,d=qb,f=_g("start","zoom","end"),h=500,v=150,p=0,g=10;function y(e){e.property("__zoom",ox).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",N).filter(u).on("touchstart.zoom",C).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",O).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 Kw(n,e.x,e.y)}function b(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 Kw(e.k,r,o)}function w(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(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,l=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),s=e.__zoom,f="function"==typeof n?n.apply(e,i):n,h=d(s.invert(c).concat(l/s.k),f.invert(c).concat(l/f.k));return function(e){if(1===e)e=f;else{var n=h(e),t=l/n[2];e=new Kw(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)))),s=Dy(e);if(t.wheel)t.mouse[0][0]===s[0]&&t.mouse[0][1]===s[1]||(t.mouse[1]=o.invert(t.mouse[0]=s)),clearTimeout(t.wheel);else{if(o.k===u)return;t.mouse=[s,o.invert(s)],Sw(this),t.start()}nx(e),t.wheel=setTimeout((function(){t.wheel=null,t.end()}),v),t.zoom("mouse",i(b(m(o,u),t.mouse[0],t.mouse[1]),t.extent,l))}}function k(e,...n){if(!t&&r.apply(this,arguments)){var o=e.currentTarget,a=_(this,n,!0).event(e),u=By(e.view).on("mousemove.zoom",(function(e){if(nx(e),!a.moved){var n=e.clientX-s,t=e.clientY-d;a.moved=n*n+t*t>p}a.event(e).zoom("mouse",i(b(a.that.__zoom,a.mouse[0]=Dy(e,o),a.mouse[1]),a.extent,l))}),!0).on("mouseup.zoom",(function(e){u.on("mousemove.zoom mouseup.zoom",null),Fy(e.view,a.moved),nx(e),a.event(e).end()}),!0),c=Dy(e,o),s=e.clientX,d=e.clientY;Xy(e.view),ex(e),a.mouse=[c,this.__zoom.invert(c)],Sw(this),a.start()}}function N(e,...n){if(r.apply(this,arguments)){var t=this.__zoom,a=Dy(e.changedTouches?e.changedTouches[0]:e,this),u=t.invert(a),c=t.k*(e.shiftKey?.5:2),d=i(b(m(t,c),a,u),o.apply(this,n),l);nx(e),s>0?By(this).transition().duration(s).call(x,d,a,e):By(this).call(y.transform,d,a,e)}}function C(t,...o){if(r.apply(this,arguments)){var i,a,u,c,l=t.touches,s=l.length,d=_(this,o,t.changedTouches.length===s).event(t);for(ex(t),a=0;a<s;++a)c=[c=Dy(u=l[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)),Sw(this),d.start())}}function M(e,...n){if(this.__zooming){var t,r,o,a,u=_(this,n).event(e),c=e.changedTouches,s=c.length;for(nx(e),t=0;t<s;++t)o=Dy(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(b(r,o,a),u.extent,l))}}function O(e,...r){if(this.__zooming){var o,i,a=_(this,r).event(e),u=e.changedTouches,c=u.length;for(ex(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=Dy(i,this),Math.hypot(n[0]-i[0],n[1]-i[1])<g)){var l=By(this).on("dblclick.zoom");l&&l.apply(this,arguments)}}}return y.transform=function(e,n,t,r){var o=e.selection?e.selection():e;o.property("__zoom",ox),e!==o?x(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(b(m(r,c),a,u),e,l)}),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),l)}),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(Qw.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,l)}),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=By(this.that).datum();f.call(e,this.that,new $w(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:qw(+e),y):a},y.filter=function(e){return arguments.length?(r="function"==typeof e?e:qw(!!e),y):r},y.touchable=function(e){return arguments.length?(u="function"==typeof e?e:qw(!!e),y):u},y.extent=function(e){return arguments.length?(o="function"==typeof e?e:qw([[+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?(l[0][0]=+e[0][0],l[1][0]=+e[1][0],l[0][1]=+e[0][1],l[1][1]=+e[1][1],y):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},y.constrain=function(e){return arguments.length?(i=e,y):i},y.duration=function(e){return arguments.length?(s=+e,y):s},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=By(n).call(h);b({x:i.x,y:i.y,zoom:um(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(vx(v,null==n?void 0:n.duration),e))}function m(){h.on("zoom",null)}function b(e,n,t){var r=dx(e),o=null==h?void 0:h.constrain()(r,n,t);return o&&y(o),o}return h.wheelDelta(px),{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,b=e.panOnScrollSpeed,w=e.preventScrolling,x=e.zoomOnPinch,_=e.zoomOnScroll,E=e.zoomOnDoubleClick,S=e.zoomActivationKeyPressed,k=e.lib;o&&!d.isZoomingOrPanning&&m();var N=!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||fx(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,l=e.onPanZoom,s=e.onPanZoomEnd;return function(e){if(fx(e,t))return!1;e.preventDefault(),e.stopImmediatePropagation();var d=r.property("__zoom").k||1;if(e.ctrlKey&&u){var f=Dy(e),h=px(e),v=d*Math.pow(2,h);o.scaleTo(r,v,f,e)}else{var p=1===e.deltaMode?20:1,g=i===Em.Vertical?0:e.deltaX*p,y=i===Em.Horizontal?0:e.deltaY*p;!bm()&&e.shiftKey&&i!==Em.Vertical&&(g=e.deltaY*p,y=0),o.translateBy(r,-g/d*a,-y/d*a,{internal:!0});var m=sx(r.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling||(n.isPanScrolling=!0,null==c||c(e,m)),n.isPanScrolling&&(null==l||l(e,m),n.panScrollTimeout=setTimeout((function(){null==s||s(e,m),n.isPanScrolling=!1}),150))}}}({zoomPanValues:d,noWheelClassName:n,d3Selection:v,d3Zoom:h,panOnScrollMode:y,panOnScrollSpeed:b,zoomOnPinch:x,onPanZoomStart:u,onPanZoom:a,onPanZoomEnd:c});if(v.on("wheel.zoom",N,{passive:!1}),!o){var C=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=sx(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:s,onPanZoomStart:u});h.on("start",C);var M=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||!hx(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,sx(e.transform)))}}({zoomPanValues:d,panOnDrag:f,onPaneContextMenu:!!r,onPanZoom:a,onTransformChange:l});h.on("zoom",M);var O=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&&hx(t,null!==(c=n.mouseButton)&&void 0!==c?c:0)&&!n.usedRightMouseButton&&e.sourceEvent&&a(e.sourceEvent),n.usedRightMouseButton=!1,o(!1),i&&lx(n.prevViewport,e.transform))){var l=sx(e.transform);n.prevViewport=l,clearTimeout(n.timerId),n.timerId=setTimeout((function(){null==i||i(e.sourceEvent,l)}),r?150:0)}}}({zoomPanValues:d,panOnDrag:f,panOnScroll:i,onPaneContextMenu:r,onPanZoomEnd:c,onDraggingChange:s});h.on("end",O)}var j=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,l=e.noPanClassName,s=e.lib;return function(e){var d=n||t,f=r&&e.ctrlKey;if(1===e.button&&"mousedown"===e.type&&(fx(e,"".concat(s,"-flow__node"))||fx(e,"".concat(s,"-flow__edge"))))return!0;if(!(o||d||i||a||r))return!1;if(u)return!1;if(fx(e,c)&&"wheel"===e.type)return!1;if(fx(e,l)&&("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:x,userSelectionActive:o,noPanClassName:t,noWheelClassName:n,lib:k});h.filter(j),E?v.on("dblclick.zoom",g):v.on("dblclick.zoom",null)},destroy:m,setViewport:function(e,n){var t=dx(e);return y(t,n),t},setViewportConstrained:b,getViewport:function(){var e=v?Jw(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(vx(v,null==n?void 0:n.duration),e))},scaleBy:function(e,n){v&&(null==h||h.scaleBy(vx(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=dx(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"}(cx||(cx={}));X(X({},{width:0,height:0,x:0,y:0}),{pointerX:0,pointerY:0,aspectRatio:1});var yx=Ky.error001();function mx(e,n){var r=t(V);if(null===r)throw new Error(yx);return R(r,e,n)}function bx(){var e=t(V);if(null===e)throw new Error(yx);return r((function(){return{getState:e.getState,setState:e.setState,subscribe:e.subscribe}}),[e])}function wx(e,n){var t,r,o;void 0===n&&(n={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{}});var i=(null==n?void 0:n.elevateNodesOnSelect)?1e3:0;try{for(var a=p(e),u=a.next();!u.done;u=a.next()){var c=g(u.value,2)[1],l=c.parentId;if(l){if(!e.has(l))throw new Error("Parent node ".concat(l," not found"));var s=e.get(l),f=xx(c,e,d(d({},c.position),{z:(Ox(c.zIndex)?c.zIndex:0)+(c.selected?i:0)}),null!==(o=null==s?void 0:s.origin)&&void 0!==o?o:n.nodeOrigin),h=f.x,v=f.y,y=f.z,m=c.internals.positionAbsolute,b=h!==m.x||v!==m.y;(b||y!==c.internals.z)&&(c.internals=d(d({},c.internals),{positionAbsolute:b?{x:h,y:v}:m,z:y}))}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}function xx(e,n,t,r){var o,i,a,u,c,l;if(void 0===r&&(r=[0,0]),!e.parentId)return t;var s=n.get(e.parentId),d=_x(s,r).position;return xx(s,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=s.internals.z)&&void 0!==a?a:0)>(null!==(u=t.z)&&void 0!==u?u:0)?null!==(c=s.internals.z)&&void 0!==c?c:0:null!==(l=t.z)&&void 0!==l?l:0},s.origin||r)}var _x=function(e,n){void 0===n&&(n=[0,0]);var t=Mx(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 Ex(e,n,t){var r,o;e.clear(),n.clear();try{for(var i=p(t),a=i.next();!a.done;a=i.next()){var u=a.value,c=u.source,l=u.target,s=u.sourceHandle,d=void 0===s?null:s,f=u.targetHandle,h=void 0===f?null:f,v="".concat(c,"-source-").concat(d),g="".concat(l,"-target-").concat(h),y=e.get(v)||new Map,m=e.get(g)||new Map,b={edgeId:u.id,source:c,target:l,sourceHandle:d,targetHandle:h};n.set(u.id,u),e.set(v,y.set("".concat(l,"-").concat(h),b)),e.set(g,m.set("".concat(c,"-").concat(d),b))}}catch(e){r={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}function Sx(e,n,t,r){void 0===r&&(r={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{},checkEquality:!0});var o=new Map(n);n.clear(),t.clear();var i=(null==r?void 0:r.elevateNodesOnSelect)?1e3:0;e.forEach((function(e){var a,u,c=o.get(e.id);if(r.checkEquality&&e===(null==c?void 0:c.internals.userNode)||(c=d(d(d({},r.defaults),e),{measured:{width:null===(a=e.measured)||void 0===a?void 0:a.width,height:null===(u=e.measured)||void 0===u?void 0:u.height},internals:{positionAbsolute:e.position,handleBounds:null==c?void 0:c.internals.handleBounds,z:(Ox(e.zIndex)?e.zIndex:0)+(e.selected?i:0),userNode:e}})),n.set(e.id,c),e.parentId){var l=t.get(e.parentId);l?l.push(c):t.set(e.parentId,[c])}})),t.size>0&&wx(n,r)}function kx(e,n,t,r){var o,i,a,u,c,l=[],s=new Map;try{for(var d=p(e),f=d.next();!f.done;f=d.next()){var h=f.value,v=n.get(h.parentId);if(v){var g=null!==(u=null===(a=s.get(h.parentId))||void 0===a?void 0:a.expandedRect)&&void 0!==u?u:Ix(v,null!==(c=v.origin)&&void 0!==c?c:r),y=Lx(g,h.rect);s.set(h.parentId,{expandedRect:y,parent:v})}}}catch(e){o={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}return s.size>0&&s.forEach((function(n,r){var o=n.expandedRect,i=n.parent,a=_x(i,i.origin).position,u=Mx(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 Nx=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},Cx=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:Nx(e.x,n[0][0],n[1][0]),y:Nx(e.y,n[0][1],n[1][1])}};function Mx(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 Ox=function(e){return!isNaN(e)&&isFinite(e)},jx=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])}},Px=function(e,n,t,r){var o=e.x,i=e.y,a=g(n,3),u=a[0],c=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-u)/l,y:(i-c)/l};return t?jx(s,r):s},Ix=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=_x(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}},Ax=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)}},zx=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},Tx=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},Lx=function(e,n){return Tx(Ax(zx(e),zx(n)))};function Bx(e){return o(e)}var Dx=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)},Rx=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),l=Nx(c,r,o);return{x:n/2-(e.x+e.width/2)*l,y:t/2-(e.y+e.height/2)*l,zoom:l}};function Hx(e){return void 0!==e&&"parent"!==e}var Vx=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]}},Yx=function(e){return Xx(e)},Xx=function(e){return"id"in e&&"position"in e&&!("source"in e)&&!("target"in e)};var Fx=function(e){return Ox(e.width)&&Ox(e.height)&&Ox(e.x)&&Ox(e.y)},Zx=function(e){return{width:e.offsetWidth,height:e.offsetHeight}},Ux=["INPUT","SELECT","TEXTAREA"];function Gx(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 Ux.includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}var Wx=function(e){return"clientX"in e},qx=function(e,n){var t,r,o,i,a=Wx(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)}},$x=function(e,n,t,r){void 0===r&&(r=[0,0]);var o=n.querySelectorAll(e);if(!o||!o.length)return null;var i=Array.from(o),a=n.getBoundingClientRect(),u=a.width*r[0],c=a.height*r[1];return i.map((function(e){var n=e.getBoundingClientRect();return d({id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(n.left-a.left-u)/t,y:(n.top-a.top-c)/t},Zx(e))}))},Kx="undefined"!=typeof document?document:null;function Qx(e,n){void 0===e&&(e=null),void 0===n&&(n={target:Kx,actInsideInputWithModifier:!0});var t=g(i(!1),2),o=t[0],c=t[1],l=a(!1),s=a(new Set([])),d=g(r((function(){if(null!==e){var n=(Array.isArray(e)?e:[e]).filter((function(e){return"string"==typeof e})).map((function(e){return e.split("+")})),t=n.reduce((function(e,n){return e.concat.apply(e,y([],g(n),!1))}),[]);return[n,t]}return[[],[]]}),[e]),2),f=d[0],h=d[1];return u((function(){var t=(null==n?void 0:n.target)||Kx;if(null!==e){var r=function(e){if(l.current=e.ctrlKey||e.metaKey||e.shiftKey,(!l.current||l.current&&!n.actInsideInputWithModifier)&&Gx(e))return!1;var t=e_(e.code,h);s.current.add(e[t]),Jx(f,s.current,!1)&&(e.preventDefault(),c(!0))},o=function(e){if((!l.current||l.current&&!n.actInsideInputWithModifier)&&Gx(e))return!1;var t=e_(e.code,h);Jx(f,s.current,!0)?(c(!1),s.current.clear()):s.current.delete(e[t]),"Meta"===e.key&&s.current.clear(),l.current=!1},i=function(){s.current.clear(),c(!1)};return null==t||t.addEventListener("keydown",r),null==t||t.addEventListener("keyup",o),window.addEventListener("blur",i),window.addEventListener("contextmenu",i),function(){null==t||t.removeEventListener("keydown",r),null==t||t.removeEventListener("keyup",o),window.removeEventListener("blur",i),window.removeEventListener("contextmenu",i)}}}),[e,c]),o}function Jx(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 e_(e,n){return n.includes(e)?"code":"key"}function n_(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 t_={position:"absolute",width:"100%",height:"100%",top:0,left:0};var r_=function(e){return{userSelectionActive:e.userSelectionActive,lib:e.lib}};function o_(e){var n=e.onPaneContextMenu,t=e.zoomOnScroll,r=void 0===t||t,o=e.zoomOnPinch,i=void 0===o||o,c=e.panOnScroll,l=void 0!==c&&c,s=e.panOnScrollSpeed,d=void 0===s?.5:s,f=e.panOnScrollMode,h=void 0===f?Em.Free:f,v=e.zoomOnDoubleClick,p=void 0===v||v,g=e.panOnDrag,y=void 0===g||g,m=e.defaultViewport,b=e.translateExtent,w=e.minZoom,x=e.maxZoom,_=e.zoomActivationKeyCode,S=e.preventScrolling,k=void 0===S||S,N=e.children,C=e.noWheelClassName,M=e.noPanClassName,O=e.onViewportChange,j=e.isControlledViewport,P=bx(),I=a(null),A=mx(r_,n_),z=A.userSelectionActive,T=A.lib,L=Qx(_),B=a();return function(e){var n=bx();u((function(){var t=function(){var t,r;if(!e.current)return!1;var o=Zx(e.current);0!==o.height&&0!==o.width||null===(r=(t=n.getState()).onError)||void 0===r||r.call(t,"004",Ky.error004()),n.setState({width:o.width||500,height:o.height||500})};if(e.current){t(),window.addEventListener("resize",t);var r=new ResizeObserver((function(){return t()}));return r.observe(e.current),function(){window.removeEventListener("resize",t),r&&e.current&&r.unobserve(e.current)}}}),[])}(I),u((function(){if(I.current){B.current=gx({domNode:I.current,minZoom:w,maxZoom:x,translateExtent:b,viewport:m,onTransformChange:function(e){null==O||O({x:e[0],y:e[1],zoom:e[2]}),j||P.setState({transform:e})},onDraggingChange:function(e){return P.setState({paneDragging:e})},onPanZoomStart:function(e,n){var t=P.getState(),r=t.onViewportChangeStart,o=t.onMoveStart;null==o||o(e,n),null==r||r(n)},onPanZoom:function(e,n){var t=P.getState(),r=t.onViewportChange,o=t.onMove;null==o||o(e,n),null==r||r(n)},onPanZoomEnd:function(e,n){var t=P.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 P.setState({panZoom:B.current,transform:[n,t,r],domNode:I.current.closest(".ink-flow")}),function(){var e;null===(e=B.current)||void 0===e||e.destroy()}}}),[]),u((function(){var e;null===(e=B.current)||void 0===e||e.update({onPaneContextMenu:n,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:l,panOnScrollSpeed:d,panOnScrollMode:h,zoomOnDoubleClick:p,panOnDrag:y,zoomActivationKeyPressed:L,preventScrolling:k,noPanClassName:M,userSelectionActive:z,noWheelClassName:C,lib:T})}),[n,r,i,l,d,h,p,y,L,k,M,z,C,T]),E.jsx("div",{className:"ink-flow__renderer",ref:I,style:t_,children:N})}var i_={actInsideInputWithModifier:!1};function a_(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 u_(e,n){var t,r,o,i,a,u,c=[],l=new Map;try{for(var s=p(e),f=s.next();!f.done;f=s.next()){if("add"!==(_=f.value).type)if("remove"===_.type||"replace"===_.type)l.set(_.id,[_]);else{var h=l.get(_.id);h?h.push(_):l.set(_.id,[_])}else c.push(_.item)}}catch(e){t={error:e}}finally{try{f&&!f.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}try{for(var v=p(n),g=v.next();!g.done;g=v.next()){var y=g.value,m=l.get(y.id);if(m){if("remove"!==m[0].type)if("replace"!==m[0].type){var b=d({},y);try{for(var w=(a=void 0,p(m)),x=w.next();!x.done;x=w.next()){var _;a_(_=x.value,b)}}catch(e){a={error:e}}finally{try{x&&!x.done&&(u=w.return)&&u.call(w)}finally{if(a)throw a.error}}c.push(b)}else c.push(d({},m[0].item))}else c.push(y)}}catch(e){o={error:e}}finally{try{g&&!g.done&&(i=v.return)&&i.call(v)}finally{if(o)throw o.error}}return c}function c_(e,n){return u_(e,n)}function l_(e,n){return u_(e,n)}function s_(e,n){return{id:e,type:"select",selected:n}}function d_(e,n,t){var r,o;void 0===n&&(n=new Set),void 0===t&&(t=!1);var i=[];try{for(var a=p(e),u=a.next();!u.done;u=a.next()){var c=g(u.value,2),l=c[0],s=c[1],d=n.has(l);void 0===s.selected&&!d||s.selected===d||(t&&(s.selected=d),i.push(s_(s.id,d)))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i}function f_(e){var n,t,r,o,i,a,u=e.items,c=void 0===u?[]:u,l=e.lookup,s=[],d=new Map(c.map((function(e){return[e.id,e]})));try{for(var f=p(c),h=f.next();!h.done;h=f.next()){var v=h.value,y=l.get(v.id),m=null!==(a=null===(i=null==y?void 0:y.internals)||void 0===i?void 0:i.userNode)&&void 0!==a?a:y;void 0!==m&&m!==v&&s.push({id:v.id,item:v,type:"replace"}),void 0===m&&s.push({item:v,type:"add"})}}catch(e){n={error:e}}finally{try{h&&!h.done&&(t=f.return)&&t.call(f)}finally{if(n)throw n.error}}try{for(var b=p(l),w=b.next();!w.done;w=b.next()){var x=g(w.value,1)[0];void 0===d.get(x)&&s.push({id:x,type:"remove"})}}catch(e){r={error:e}}finally{try{w&&!w.done&&(o=b.return)&&o.call(b)}finally{if(r)throw r.error}}return s}function h_(e){return{id:e.id,type:"remove"}}var v_=function(e,n){void 0===n&&(n=[0,0]);var t=Mx(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}}},p_=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=_x(e,n).positionAbsolute,l=c.x,s=c.y;return{x:l,y:s,x2:l+(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:s+(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 Ax(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Tx(t)},g_=function(e,n,t,r,o,i){var a,u,c,l,s,f,h,v,y=g(void 0===t?[0,0,1]:t,3),m=y[0],b=y[1],w=y[2];void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===i&&(i=[0,0]);var x=d(d({},Px(n,[m,b,w])),{width:n.width/w,height:n.height/w}),_=[];try{for(var E=p(e),S=E.next();!S.done;S=E.next()){var k=g(S.value,2)[1],N=k.measured,C=k.selectable,M=void 0===C||C,O=k.hidden,j=void 0!==O&&O,P=null!==(s=null!==(l=null!==(c=N.width)&&void 0!==c?c:k.width)&&void 0!==l?l:k.initialWidth)&&void 0!==s?s:null,I=null!==(v=null!==(h=null!==(f=N.height)&&void 0!==f?f:k.height)&&void 0!==h?h:k.initialHeight)&&void 0!==v?v:null;if(!(o&&!M||j)){var A=Dx(x,Ix(k,i));(null===P||null===I||r&&A>0||A>=(null!=P?P:0)*(null!=I?I:0)||k.dragging)&&_.push(k)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=E.return)&&u.call(E)}finally{if(a)throw a.error}}return _},y_=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 m_(e,n){var t,r,o,i=e.nodeLookup,a=e.width,u=e.height,c=e.panZoom,l=e.minZoom,s=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=p_(h,{nodeOrigin:f}),g=Rx(p,a,u,null!==(t=null==n?void 0:n.minZoom)&&void 0!==t?t:l,null!==(r=null==n?void 0:n.maxZoom)&&void 0!==r?r:s,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 b_(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),l=c.parentId?r.get(c.parentId):void 0,s=l?v_(l,l.origin||i).positionAbsolute:{x:0,y:0},d=s.x,f=s.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)l&&Hx(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(l){var v=c.measured.width,p=c.measured.height,g=l.measured.width,y=l.measured.height;if(v&&p&&g&&y){var m=c.origin||i,b=d+v*m[0],w=f+p*m[1];h=[[b,w],[b+g-v,w+y-p]]}}else null==u||u("005",Ky.error005());var x=Hx(h)?Cx(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}function w_(e){return h(this,arguments,void 0,(function(e){var n,t,r,o,i,a,u,c,l,s,d,f,h,g,y,m,b,w,x,_=e.nodesToRemove,E=void 0===_?[]:_,S=e.edgesToRemove,k=void 0===S?[]:S,N=e.nodes,C=e.edges,M=e.onBeforeDelete;return v(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(o=p(N),i=o.next();!i.done;i=o.next())a=i.value,r(a)}catch(e){m={error:e}}finally{try{i&&!i.done&&(b=o.return)&&b.call(o)}finally{if(m)throw m.error}}u=new Set(k.map((function(e){return e.id}))),c=C.filter((function(e){return!1!==e.deletable})),l=y_(t,c),s=l,d=function(e){u.has(e.id)&&!s.find((function(n){return n.id===e.id}))&&s.push(e)};try{for(f=p(c),h=f.next();!h.done;h=f.next())g=h.value,d(g)}catch(e){w={error:e}}finally{try{h&&!h.done&&(x=f.return)&&x.call(f)}finally{if(w)throw w.error}}return M?[4,M({nodes:t,edges:s})]:[2,{edges:s,nodes:t}];case 1:return"boolean"==typeof(y=e.sent())?[2,y?{edges:s,nodes:t}:{edges:[],nodes:[]}]:[2,y]}}))}))}var x_=function(e){return{userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect}};function __(){var e=mx(x_,n_),n=e.userSelectionActive,t=e.userSelectionRect;return n&&t?E.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 E_=function(e,n){return function(t){t.target===n.current&&(null==e||e(t))}},S_=function(e){return{userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}};function k_(e){var n=e.isSelecting;e.selectionMode;var t=e.panOnDrag,r=e.onSelectionStart,o=e.onSelectionEnd,i=e.onPaneClick,u=e.onPaneContextMenu,c=e.onPaneScroll,l=e.onPaneMouseEnter,s=e.onPaneMouseMove,d=e.onPaneMouseLeave,f=e.children,h=a(null),v=bx(),y=a(0),m=a(0),b=a(),w=a(new Map),x=mx(S_,n_),_=x.userSelectionActive,S=x.elementsSelectable,k=x.dragging,N=function(){v.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,m.current=0},C=function(e){null==i||i(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},O=c?function(e){return c(e)}:void 0,j=S&&(n||_);return E.jsxs("div",{className:M(["ink-flow__pane",{draggable:t,dragging:k,selection:n}]),onClick:j?void 0:E_(C,h),onContextMenu:E_((function(e){Array.isArray(t)&&(null==t?void 0:t.includes(2))?e.preventDefault():null==u||u(e)}),h),onWheel:E_(O,h),onMouseEnter:j?void 0:l,onMouseDown:j?function(e){var t,o,i,a,u=v.getState(),c=u.resetSelectedElements,l=u.domNode,s=u.edgeLookup;if(b.current=null==l?void 0:l.getBoundingClientRect(),S&&n&&0===e.button&&e.target===h.current&&b.current){w.current=new Map;try{for(var d=p(s),f=d.next();!f.done;f=d.next()){var y=g(f.value,2),m=y[0],x=y[1];w.current.set(x.source,(null===(i=w.current.get(x.source))||void 0===i?void 0:i.add(m))||new Set([m])),w.current.set(x.target,(null===(a=w.current.get(x.target))||void 0===a?void 0:a.add(m))||new Set([m]))}}catch(e){t={error:e}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(t)throw t.error}}var _=qx(e.nativeEvent,b.current),E=_.x,k=_.y;c(),v.setState({userSelectionRect:{width:0,height:0,startX:E,startY:k,x:E,y:k}}),null==r||r(e)}}:void 0,onMouseMove:j?function(e){var t,r,o,i,a=v.getState(),u=a.userSelectionRect,c=a.edgeLookup,l=a.transform,s=a.nodeOrigin,d=a.nodeLookup,f=a.triggerNodeChanges,h=a.triggerEdgeChanges;if(n&&b.current&&u){var g=qx(e.nativeEvent,b.current),x=g.x,_=g.y,E=u.startX,S=u.startY,k={startX:E,startY:S,x:x<E?x:E,y:_<S?_:S,width:Math.abs(x-E),height:Math.abs(_-S)},N=g_(d,k,l,!1,!0,s),C=new Set,M=new Set;try{for(var O=p(N),j=O.next();!j.done;j=O.next()){var P=j.value;M.add(P.id);var I=w.current.get(P.id);if(I)try{for(var A=(o=void 0,p(I)),z=A.next();!z.done;z=A.next()){var T=z.value;C.add(T)}}catch(e){o={error:e}}finally{try{z&&!z.done&&(i=A.return)&&i.call(A)}finally{if(o)throw o.error}}}}catch(e){t={error:e}}finally{try{j&&!j.done&&(r=O.return)&&r.call(O)}finally{if(t)throw t.error}}if(y.current!==M.size)y.current=M.size,f(d_(d,M,!0));if(m.current!==C.size)m.current=C.size,h(d_(c,C));v.setState({userSelectionRect:k,userSelectionActive:!0,nodesSelectionActive:!1})}}:s,onMouseUp:j?function(e){if(0===e.button){var n=v.getState().userSelectionRect;!_&&n&&e.target===h.current&&(null==C||C(e)),v.setState({nodesSelectionActive:y.current>0}),N(),null==o||o(e)}}:void 0,onMouseLeave:j?function(e){_&&(v.setState({nodesSelectionActive:y.current>0}),null==o||o(e)),N()}:d,ref:h,style:t_,children:[f,E.jsx(__,{})]})}var N_=function(e){return{nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive}};function C_(e){var n=e.children,t=e.onPaneClick,r=e.onPaneMouseEnter,o=e.onPaneMouseMove,i=e.onPaneMouseLeave,a=e.onPaneContextMenu,c=e.onPaneScroll,l=e.deleteKeyCode,s=e.selectionKeyCode,d=e.selectionOnDrag,f=e.selectionMode,h=e.onSelectionStart,v=e.onSelectionEnd,p=e.multiSelectionKeyCode,g=e.panActivationKeyCode,y=e.zoomActivationKeyCode,m=e.elementsSelectable,b=e.zoomOnScroll,w=e.zoomOnPinch,x=e.panOnScroll,_=e.panOnScrollSpeed,S=e.panOnScrollMode,k=e.zoomOnDoubleClick,N=e.panOnDrag,C=e.defaultViewport,M=e.translateExtent,O=e.minZoom,j=e.maxZoom,P=e.preventScrolling;e.onSelectionContextMenu;var I=e.noWheelClassName,A=e.noPanClassName;e.disableKeyboardA11y;var z=e.onViewportChange,T=e.isControlledViewport,L=mx(N_);L.nodesSelectionActive;var B=L.userSelectionActive,D=Qx(s),R=Qx(g),H=R||N,V=R||x,Y=D||B||d&&!0!==H;return function(e){var n=e.deleteKeyCode,t=e.multiSelectionKeyCode,r=bx(),o=Qx(n,i_),i=Qx(t);u((function(){if(o){var e=r.getState();e.edges,e.nodes,r.setState({nodesSelectionActive:!1})}}),[o]),u((function(){r.setState({multiSelectionActive:i})}),[i])}({deleteKeyCode:l,multiSelectionKeyCode:p}),E.jsx(o_,{onPaneContextMenu:a,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:V,panOnScrollSpeed:_,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!D&&H,defaultViewport:C,translateExtent:M,minZoom:O,maxZoom:j,zoomActivationKeyCode:y,preventScrolling:P,noWheelClassName:I,noPanClassName:A,onViewportChange:z,isControlledViewport:T,children:E.jsx(k_,{onSelectionStart:h,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:H,isSelecting:!!Y,selectionMode:f,children:n})})}C_.displayName="FlowRenderer";var M_=c(C_);function O_(e){var n=g(i(e),2),t=n[0],r=n[1],o=l((function(e){return r((function(n){return c_(e,n)}))}),[]);return[t,r,o]}function j_(e){var n=g(i(e),2),t=n[0],r=n[1],o=l((function(e){return r((function(n){return l_(e,n)}))}),[]);return[t,r,o]}var P_="undefined"!=typeof window?s:u;function I_(e){var n=g(i(!1),2),t=n[0],r=n[1],o=g(i((function(){return function(e){var n=[];return{get:function(){return n},reset:function(){n=[]},push:function(t){n.push(t),e()}}}((function(){return r(!0)}))})),1),a=o[0];return P_((function(){if(t){var n=a.get();n.length&&(e(n),a.reset()),r(!1)}else a.reset()}),[t]),a}var A_=n(null);function z_(e){var n=e.children,t=bx(),o=l((function(e){var n,r,o=t.getState(),i=o.nodes,a=void 0===i?[]:i,u=o.setNodes,c=o.hasDefaultNodes,l=o.onNodesChange,s=o.nodeLookup,d=a;try{for(var f=p(e),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}c?u(d):l&&l(f_({items:d,lookup:s}))}),[]),i=I_(o),a=l((function(e){var n,r,o=t.getState(),i=o.edges,a=void 0===i?[]:i,u=o.setEdges,c=o.hasDefaultEdges,l=o.onEdgesChange,s=o.edgeLookup,d=a;try{for(var f=p(e),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}c?u(d):l&&l(f_({items:d,lookup:s}))}),[]),u=I_(a),c=r((function(){return{nodeQueue:i,edgeQueue:u}}),[]);return E.jsx(A_.Provider,{value:c,children:n})}var T_=function(){var e=bx();return r((function(){return{zoomIn:function(n){var t;return null===(t=e.getState().panZoom)||void 0===t?void 0:t.scaleBy(1.2,{duration:null==n?void 0:n.duration})},zoomOut:function(n){var t;return null===(t=e.getState().panZoom)||void 0===t?void 0:t.scaleBy(1/1.2,{duration:null==n?void 0:n.duration})},zoomTo:function(n,t){var r;return null===(r=e.getState().panZoom)||void 0===r?void 0:r.scaleTo(n,{duration:null==t?void 0:t.duration})},getZoom:function(){return e.getState().transform[2]},setViewport:function(n,t){var r,o,i,a=e.getState(),u=g(a.transform,3),c=u[0],l=u[1],s=u[2],d=a.panZoom;null==d||d.setViewport({x:null!==(r=n.x)&&void 0!==r?r:c,y:null!==(o=n.y)&&void 0!==o?o:l,zoom:null!==(i=n.zoom)&&void 0!==i?i:s},{duration:null==t?void 0:t.duration})},getViewport:function(){var n=g(e.getState().transform,3);return{x:n[0],y:n[1],zoom:n[2]}},fitView:function(n){var t=e.getState(),r=t.nodeLookup,o=t.width,i=t.height,a=t.nodeOrigin,u=t.minZoom,c=t.maxZoom,l=t.panZoom;return!!l&&m_({nodeLookup:r,width:o,height:i,nodeOrigin:a,minZoom:u,maxZoom:c,panZoom:l},n)},setCenter:function(n,t,r){var o=e.getState(),i=o.width,a=o.height,u=o.maxZoom,c=o.panZoom,l=void 0!==(null==r?void 0:r.zoom)?r.zoom:u,s=i/2-n*l,d=a/2-t*l;null==c||c.setViewport({x:s,y:d,zoom:l},{duration:null==r?void 0:r.duration})},fitBounds:function(n,t){var r,o=e.getState(),i=o.width,a=o.height,u=o.minZoom,c=o.maxZoom,l=o.panZoom,s=Rx(n,i,a,u,c,null!==(r=null==t?void 0:t.padding)&&void 0!==r?r:.1);null==l||l.setViewport(s,{duration:null==t?void 0:t.duration})},screenToFlowPosition:function(n,t){void 0===t&&(t={snapToGrid:!0});var r=e.getState(),o=r.transform,i=r.snapGrid,a=r.domNode;if(!a)return n;var u=a.getBoundingClientRect(),c=u.x,l=u.y,s={x:n.x-c,y:n.y-l};return Px(s,o,t.snapToGrid,i)},flowToScreenPosition:function(n){var t=e.getState(),r=t.transform,o=t.domNode;if(!o)return n;var i=o.getBoundingClientRect(),a=i.x,u=i.y,c=function(e,n){var t=e.x,r=e.y,o=g(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}}(n,r);return{x:c.x+a,y:c.y+u}}}}),[])},L_=function(e){return!!e.panZoom};function B_(){var e=this,n=T_(),o=bx(),i=function(){var e=t(A_);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),a=mx(L_),u=r((function(){var n=function(e){return o.getState().nodeLookup.get(e)},t=function(e){i.nodeQueue.push(e)},r=function(e){var n,t,r,i,a=o.getState(),u=a.nodeLookup,c=a.nodeOrigin,l=Yx(e)?e:u.get(e.id),s=l.parentId?function(e,n,t,r){var o,i;void 0===r&&(r=[0,0]);for(var a=n,u=d({},e);a;){var c=t.get(n);if(a=null==c?void 0:c.parentId,c){var l=c.origin||r,s=(null!==(o=c.measured.width)&&void 0!==o?o:0)*l[0],f=(null!==(i=c.measured.height)&&void 0!==i?i:0)*l[1];u.x+=c.position.x-s,u.y+=c.position.y-f}}return u}(l.position,l.parentId,u,c):l.position,f={id:l.id,position:s,width:null!==(t=null===(n=l.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:l.width,height:null!==(i=null===(r=l.measured)||void 0===r?void 0:r.height)&&void 0!==i?i:l.height,data:l.data};return Ix(f)},a=function(e,n,r){void 0===r&&(r={replace:!1}),t((function(t){return t.map((function(t){if(t.id===e){var o="function"==typeof n?n(t):n;return r.replace&&Yx(o)?o:d(d({},t),o)}return t}))}))};return{getNodes:function(){return o.getState().nodes.map((function(e){return d({},e)}))},getNode:function(e){var t;return null===(t=n(e))||void 0===t?void 0:t.internals.userNode},getInternalNode:n,getEdges:function(){var e=o.getState().edges;return(void 0===e?[]:e).map((function(e){return d({},e)}))},getEdge:function(e){return o.getState().edgeLookup.get(e)},setNodes:t,setEdges:function(e){i.edgeQueue.push(e)},addNodes:function(e){var n=Array.isArray(e)?e:[e];i.nodeQueue.push((function(e){return y(y([],g(e),!1),g(n),!1)}))},addEdges:function(e){var n=Array.isArray(e)?e:[e];i.edgeQueue.push((function(e){return y(y([],g(e),!1),g(n),!1)}))},toObject:function(){var e=o.getState(),n=e.nodes,t=void 0===n?[]:n,r=e.edges,i=void 0===r?[]:r,a=g(e.transform,3),u=a[0],c=a[1],l=a[2];return{nodes:t.map((function(e){return d({},e)})),edges:i.map((function(e){return d({},e)})),viewport:{x:u,y:c,zoom:l}}},deleteElements:function(n){return h(e,[n],void 0,(function(e){var n,t,r,i,a,u,c,l,s,d,f,h,p,g,y,m,b=e.nodes,w=void 0===b?[]:b,x=e.edges,_=void 0===x?[]:x;return v(this,(function(e){switch(e.label){case 0:return n=o.getState(),t=n.nodes,r=n.edges,i=n.onNodesDelete,a=n.onEdgesDelete,u=n.triggerNodeChanges,c=n.triggerEdgeChanges,l=n.onDelete,s=n.onBeforeDelete,[4,w_({nodesToRemove:w,edgesToRemove:_,nodes:t,edges:r,onBeforeDelete:s})];case 1:return d=e.sent(),f=d.nodes,h=d.edges,p=h.length>0,g=f.length>0,p&&(y=h.map(h_),null==a||a(h),c(y)),g&&(m=f.map(h_),null==i||i(f),u(m)),(g||p)&&(null==l||l({nodes:f,edges:h})),[2,{deletedNodes:f,deletedEdges:h}]}}))}))},getIntersectingNodes:function(e,n,t){void 0===n&&(n=!0);var i=Fx(e),a=i?e:r(e),u=void 0!==t;return a?(t||o.getState().nodes).filter((function(t){var r=o.getState().nodeLookup.get(t.id);if(r&&!i&&(t.id===e.id||!r.internals.positionAbsolute))return!1;var c=Ix(u?t:r),l=Dx(c,a);return n&&l>0||l>=a.width*a.height})):[]},isNodeIntersecting:function(e,n,t){void 0===t&&(t=!0);var o=Fx(e)?e:r(e);if(!o)return!1;var i=Dx(o,n);return t&&i>0||i>=o.width*o.height},updateNode:a,updateNodeData:function(e,n,t){void 0===t&&(t={replace:!1}),a(e,(function(e){var r="function"==typeof n?n(e):n;return t.replace?d(d({},e),{data:r}):d(d({},e),{data:d(d({},e.data),r)})}),t)}}}),[]);return r((function(){return d(d(d({},u),n),{viewportInitialized:a})}),[a])}var D_=function(e){return e.updateNodeInternals};var R_=function(e){return function(n){return e?g_(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 H_=n(null),V_=H_.Provider;H_.Consumer;var Y_="ink-flow__node-desc",X_="ink-flow__edge-desc";function F_(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 Z_(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function U_(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case Cm.Left:return[t-Z_(t-o,a),r];case Cm.Right:return[t+Z_(o-t,a),r];case Cm.Top:return[t,r-Z_(r-i,a)];case Cm.Bottom:return[t,r+Z_(i-r,a)]}}function G_(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 W_,q_=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 $_=((W_={})[Cm.Left]={x:-1,y:0},W_[Cm.Right]={x:1,y:0},W_[Cm.Top]={x:0,y:-1},W_[Cm.Bottom]={x:0,y:1},W_),K_=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?Cm.Bottom:t,o=e.target;return r===Cm.Left||r===Cm.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}},Q_=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function J_(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Cm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Cm.Top:u,l=e.borderRadius,s=void 0===l?5:l,d=e.centerX,f=e.centerY,h=e.offset,v=g(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?Cm.Bottom:a,c=e.target,l=e.targetPosition,s=void 0===l?Cm.Top:l,d=e.center,f=e.offset,h=$_[u],v=$_[s],p={x:i.x+h.x*f,y:i.y+h.y*f},m={x:c.x+v.x*f,y:c.y+v.y*f},b=K_({source:p,sourcePosition:u,target:m}),w=0!==b.x?"x":"y",x=b[w],_=[],E={x:0,y:0},S={x:0,y:0},k=g(G_({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),N=k[0],C=k[1],M=k[2],O=k[3];if(h[w]*v[w]==-1){r=null!==(n=d.x)&&void 0!==n?n:N,o=null!==(t=d.y)&&void 0!==t?t:C;var j=[{x:r,y:p.y},{x:r,y:m.y}],P=[{x:p.x,y:o},{x:m.x,y:o}];_=h[w]===x?"x"===w?j:P:"x"===w?P:j}else{var I=[{x:p.x,y:m.y}],A=[{x:m.x,y:p.y}];if(_="x"===w?h.x===x?A:I:h.y===x?I:A,u===s){var z=Math.abs(i[w]-c[w]);if(z<=f){var T=Math.min(f-1,f-z);h[w]===x?E[w]=(p[w]>i[w]?-1:1)*T:S[w]=(m[w]>c[w]?-1:1)*T}}if(u!==s){var L="x"===w?"y":"x",B=h[w]===v[L],D=p[L]>m[L],R=p[L]<m[L];(1===h[w]&&(!B&&D||B&&R)||1!==h[w]&&(!B&&R||B&&D))&&(_="x"===w?I:A)}var H={x:p.x+E.x,y:p.y+E.y},V={x:m.x+S.x,y:m.y+S.y};Math.max(Math.abs(H.x-_[0].x),Math.abs(V.x-_[0].x))>=Math.max(Math.abs(H.y-_[0].y),Math.abs(V.y-_[0].y))?(r=(H.x+V.x)/2,o=_[0].y):(r=_[0].x,o=(H.y+V.y)/2)}return[y(y([i,{x:p.x+E.x,y:p.y+E.y}],g(_),!1),[{x:m.x+S.x,y:m.y+S.y},c],!1),r,o,M,O]}({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],m=v[1],b=v[2],w=v[3],x=v[4],_=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(Q_(e,n)/2,Q_(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 l=e.x<t.x?1:-1,s=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*s,"Q ").concat(i,",").concat(a," ").concat(i+o*l,",").concat(a)}(p[t-1],n,p[t+1],s):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+=r}),"");return[_,m,b,w,x]}var eE=function(e){return{connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}};var nE=c(Bx((function(e,n){var r,o,i=e.type,a=void 0===i?"source":i,u=e.position,c=void 0===u?Cm.Top:u,l=e.isValidConnection,s=e.isConnectable,h=void 0===s||s,v=e.isConnectableStart,p=void 0===v||v,g=e.isConnectableEnd,y=void 0===g||g,m=e.id,b=e.onConnect,w=e.children,x=e.className,_=e.onMouseDown,S=e.onTouchStart,k=f(e,["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"]),N=m||null,C="target"===a,O=bx(),j=t(H_),P=mx(eE,n_),I=P.connectOnClick,A=P.noPanClassName,z=P.rfId,T=mx(function(e,n,t){return function(r){var o=r.connectionStartHandle,i=r.connectionEndHandle,a=r.connectionClickStartHandle,u=r.connectionMode,c=r.connectionStatus,l=(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:l,clickConnecting:(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===n&&(null==a?void 0:a.type)===t,isPossibleEndHandle:u===_m.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:l&&"valid"===c}}}(j,N,a),n_),L=T.connectingFrom,B=T.connectingTo,D=T.clickConnecting,R=T.isPossibleEndHandle,H=T.connectionInProcess,V=T.valid;j||null===(o=(r=O.getState()).onError)||void 0===o||o.call(r,"010",Ky.error010());var Y=function(e){var n=O.getState(),t=n.defaultEdgeOptions,r=n.onConnect,o=n.hasDefaultEdges,i=d(d({},t),e);if(o){var a=O.getState(),u=a.edges;(0,a.setEdges)(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="id"in(r=e)&&"source"in r&&"target"in r?d({},e):d(d({},e),{id:q_(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t,r}(i,u))}null==r||r(i),null==b||b(i)},X=function(e){if(j){var n=Wx(e.nativeEvent);if(p&&(n&&0===e.button||!n)){var t=O.getState();Km.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:C,handleId:N,nodeId:j,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:Y,isValidConnection:l||t.isValidConnection,getTransform:function(){return O.getState().transform},getConnectionStartHandle:function(){return O.getState().connectionStartHandle}})}n?null==_||_(e):null==S||S(e)}};return E.jsx("div",d({"data-handleid":N,"data-nodeid":j,"data-handlepos":c,"data-id":"".concat(z,"-").concat(j,"-").concat(N,"-").concat(a),className:M(["ink-flow__handle","ink-flow__handle-".concat(c),"nodrag",A,x,{source:!C,target:C,connectable:h,connectablestart:p,connectableend:y,clickconnecting:D,connectingfrom:L,connectingto:B,valid:V,connectionindicator:h&&(!H||R)&&(H?y:p)}]),onMouseDown:X,onTouchStart:X,onClick:I?function(e){var n=O.getState(),t=n.onClickConnectStart,r=n.onClickConnectEnd,o=n.connectionClickStartHandle,i=n.connectionMode,u=n.isValidConnection,c=n.lib,s=n.rfId;if(j&&(o||p)){if(!o)return null==t||t(e.nativeEvent,{nodeId:j,handleId:N,handleType:a}),void O.setState({connectionClickStartHandle:{nodeId:j,type:a,handleId:N}});var d=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=l||u,h=Km.isValid(e.nativeEvent,{handle:{nodeId:j,id:N,type:a},connectionMode:i,fromNodeId:o.nodeId,fromHandleId:o.handleId||null,fromType:o.type,isValidConnection:f,flowId:s,doc:d,lib:c}),v=h.connection;h.isValid&&v&&Y(v),null==r||r(e),O.setState({connectionClickStartHandle:null})}}:void 0,ref:n},k,{children:w}))})));var tE={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},rE={input:function(e){var n=e.data,t=e.isConnectable,r=e.sourcePosition,o=void 0===r?Cm.Bottom:r;return E.jsxs(E.Fragment,{children:[null==n?void 0:n.label,E.jsx(nE,{type:"source",position:o,isConnectable:t})]})},default:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?Cm.Top:r,i=e.sourcePosition,a=void 0===i?Cm.Bottom:i;return E.jsxs(E.Fragment,{children:[E.jsx(nE,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label,E.jsx(nE,{type:"source",position:a,isConnectable:t})]})},output:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?Cm.Top:r;return E.jsxs(E.Fragment,{children:[E.jsx(nE,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label]})},group:function(){return null}};function oE(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,l=a.multiSelectionActive,s=a.nodeLookup,d=a.onError,f=s.get(n);f?(t.setState({nodesSelectionActive:!1}),f.selected?(o||f.selected&&l)&&(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",Ky.error012(n))}var iE=function(e){return function(n){return n.selected&&(n.draggable||e&&void 0===n.draggable)}};function aE(e){var n,t=e.id,r=e.onClick,o=e.onMouseEnter,c=e.onMouseMove,s=e.onMouseLeave,f=e.onContextMenu,h=e.onDoubleClick,v=e.nodesDraggable,y=e.elementsSelectable,m=e.nodesConnectable,b=e.nodesFocusable,w=e.resizeObserver,x=e.noDragClassName,_=e.noPanClassName,S=e.disableKeyboardA11y,k=e.rfId,N=e.nodeTypes,C=e.nodeExtent,O=e.nodeOrigin,j=e.onError,P=mx((function(e){var n=e.nodeLookup.get(t),r=e.parentLookup.has(t);return{node:n,internals:n.internals,isParent:r}}),n_),I=P.node,A=P.internals,z=P.isParent,T=I.type||"default",L=(null==N?void 0:N[T])||rE[T];void 0===L&&(null==j||j("003",Ky.error003(T)),T="default",L=rE.default);var B=!!(I.draggable||v&&void 0===I.draggable),D=!!(I.selectable||y&&void 0===I.selectable),R=!!(I.connectable||m&&void 0===I.connectable),H=!!(I.focusable||b&&void 0===I.focusable),V=bx(),Y=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)}(I),X=function(e){var n=e.node,t=e.nodeType,r=e.hasDimensions,o=e.resizeObserver,i=bx(),c=a(null),l=a(null),s=a(n.sourcePosition),d=a(n.targetPosition),f=a(t),h=r&&!!n.internals.handleBounds&&!n.hidden;return u((function(){!c.current||h&&l.current===c.current||(l.current&&(null==o||o.unobserve(l.current)),null==o||o.observe(c.current),l.current=c.current)}),[h]),u((function(){return function(){l.current&&(null==o||o.unobserve(l.current),l.current=null)}}),[]),u((function(){if(c.current){var e=f.current!==t,r=s.current!==n.sourcePosition,o=d.current!==n.targetPosition;(e||r||o)&&(f.current=t,s.current=n.sourcePosition,d.current=n.targetPosition,i.getState().updateNodeInternals(new Map([[n.id,{id:n.id,nodeElement:c.current,force:!0}]])))}}),[n.id,t,n.sourcePosition,n.targetPosition]),c}({node:I,nodeType:T,hasDimensions:Y,resizeObserver:w}),F=function(e){var n=e.nodeRef,t=e.disabled,r=void 0!==t&&t,o=e.noDragClassName,c=e.handleSelector,l=e.nodeId,s=e.isSelectable,d=bx(),f=g(i(!1),2),h=f[0],v=f[1],p=a();return u((function(){p.current=Zm({getStoreItems:function(){return d.getState()},onNodeMouseDown:function(e){oE({id:e,store:d,nodeRef:n})},onDragStart:function(){v(!0)},onDragStop:function(){v(!1)}})}),[]),u((function(){var e,t;if(r)null===(e=p.current)||void 0===e||e.destroy();else if(n.current)return null===(t=p.current)||void 0===t||t.update({noDragClassName:o,handleSelector:c,domNode:n.current,isSelectable:s,nodeId:l}),function(){var e;null===(e=p.current)||void 0===e||e.destroy()}}),[o,c,r,s,n,l]),h}({nodeRef:X,disabled:I.hidden||!B,noDragClassName:x,handleSelector:I.dragHandle,nodeId:t,isSelectable:D}),Z=function(){var e=bx(),n=l((function(n){var t,r,o=e.getState(),i=o.nodeExtent,a=o.snapToGrid,u=o.snapGrid,c=o.nodesDraggable,l=o.onError,s=o.updateNodePositions,d=o.nodeLookup,f=o.nodeOrigin,h=new Map,v=iE(c),y=a?u[0]:5,m=a?u[1]:5,b=n.direction.x*y*n.factor,w=n.direction.y*m*n.factor;try{for(var x=p(d),_=x.next();!_.done;_=x.next()){var E=g(_.value,2)[1];if(v(E)){var S={x:E.internals.positionAbsolute.x+b,y:E.internals.positionAbsolute.y+w};a&&(S=jx(S,u));var k=b_({nodeId:E.id,nextPosition:S,nodeLookup:d,nodeExtent:i,nodeOrigin:f,onError:l}),N=k.position,C=k.positionAbsolute;E.position=N,E.internals.positionAbsolute=C,h.set(E.id,E)}}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=x.return)&&r.call(x)}finally{if(t)throw t.error}}s(h)}),[]);return n}();if(I.hidden)return null;var U=Mx(I),G=function(e){var n,t,r,o,i,a,u,c,l,s;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!==(l=e.height)&&void 0!==l?l:null===(s=e.style)||void 0===s?void 0:s.height}}(I),W=C?Cx(A.positionAbsolute,C):A.positionAbsolute,q=Vx(d(d(d({},W),U),{origin:I.origin||O})),$=D||B||r||o||c||s,K=o?function(e){return o(e,d({},A.userNode))}:void 0,Q=c?function(e){return c(e,d({},A.userNode))}:void 0,J=s?function(e){return s(e,d({},A.userNode))}:void 0,ee=f?function(e){return f(e,d({},A.userNode))}:void 0,ne=h?function(e){return h(e,d({},A.userNode))}:void 0;return E.jsx("div",{className:M(["ink-flow__node","ink-flow__node-".concat(T),(n={},n[_]=B,n),I.className,{selected:I.selected,selectable:D,parent:z,draggable:B,dragging:F}]),ref:X,style:d(d({zIndex:A.z,transform:"translate(".concat(q.x,"px,").concat(q.y,"px)"),pointerEvents:$?"all":"none",visibility:Y?"visible":"hidden"},I.style),G),"data-id":t,"data-testid":"rf__node-".concat(t),onMouseEnter:K,onMouseMove:Q,onMouseLeave:J,onContextMenu:ee,onClick:function(e){var n=V.getState(),o=n.selectNodesOnDrag,i=n.nodeDragThreshold;D&&(!o||!B||i>0)&&oE({id:t,store:V,nodeRef:X}),r&&r(e,d({},A.userNode))},onDoubleClick:ne,onKeyDown:H?function(e){if(!Gx(e.nativeEvent)&&!S)if(Jy.includes(e.key)&&D){var n="Escape"===e.key;oE({id:t,store:V,unselect:n,nodeRef:X})}else B&&I.selected&&Object.prototype.hasOwnProperty.call(tE,e.key)&&(V.setState({ariaLiveMessage:"Moved selected node ".concat(e.key.replace("Arrow","").toLowerCase(),". New position, x: ").concat(~~W.x,", y: ").concat(~~W.y)}),Z({direction:tE[e.key],factor:e.shiftKey?4:1}))}:void 0,tabIndex:H?0:void 0,role:H?"button":void 0,"aria-describedby":S?void 0:"".concat(Y_,"-").concat(k),"aria-label":I.ariaLabel,children:E.jsx(V_,{value:t,children:E.jsx(L,d({id:t,data:I.data,type:T,positionAbsoluteX:W.x,positionAbsoluteY:W.y,selected:I.selected,isConnectable:R,sourcePosition:I.sourcePosition,targetPosition:I.targetPosition,dragging:F,dragHandle:I.dragHandle,zIndex:A.z},U))})})}var uE=function(e){return{nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError}};function cE(e){var n,t=mx(uE,n_),r=t.nodesDraggable,o=t.nodesConnectable,a=t.nodesFocusable,c=t.elementsSelectable,s=t.onError,d=mx(l(R_(n=!1),[n]),n_),f=function(){var e=mx(D_),n=g(i((function(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver((function(n){var t=new Map;n.forEach((function(e){var n=e.target.getAttribute("data-id");t.set(n,{id:n,nodeElement:e.target})})),e(t)}))})),1),t=n[0];return u((function(){return function(){null==t||t.disconnect()}}),[t]),t}();return E.jsx("div",{className:"ink-flow__nodes",style:t_,children:d.map((function(n){return E.jsx(aE,{id:n,nodeTypes:e.nodeTypes,nodeOrigin:e.nodeOrigin,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:f,nodesDraggable:r,nodesConnectable:o,nodesFocusable:a,elementsSelectable:c,onError:s},n)}))})}cE.displayName="NodeRenderer";var lE,sE=c(cE),dE=((lE={})[Nm.Arrow]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return E.jsx("polyline",{style:{stroke:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"})},lE[Nm.ArrowClosed]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return E.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},lE);function fE(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 hE=function(e){var n=e.id,t=e.type,o=e.color,i=e.width,a=void 0===i?12.5:i,u=e.height,c=void 0===u?12.5:u,l=e.markerUnits,s=void 0===l?"strokeWidth":l,d=e.strokeWidth,f=e.orient,h=void 0===f?"auto-start-reverse":f,v=function(e){var n=bx(),t=r((function(){var t,r;return Object.prototype.hasOwnProperty.call(dE,e)?dE[e]:(null===(r=(t=n.getState()).onError)||void 0===r||r.call(t,"009",Ky.error009(e)),null)}),[e]);return t}(t);return v?E.jsx("marker",{className:"ink-flow__arrowhead",id:n,markerWidth:"".concat(a),markerHeight:"".concat(c),viewBox:"-10 -10 20 20",markerUnits:s,orient:h,refX:"0",refY:"0",children:E.jsx(v,{color:o,strokeWidth:d})}):null},vE=function(e){var n=e.defaultColor,t=e.rfId,o=mx((function(e){return e.edges})),i=mx((function(e){return e.defaultEdgeOptions})),a=r((function(){var e=function(e,n){var t=n.id,r=n.defaultColor,o=n.defaultMarkerStart,i=n.defaultMarkerEnd,a=new Set;return e.reduce((function(e,n){return[n.markerStart||o,n.markerEnd||i].forEach((function(n){if(n&&"object"==typeof n){var o=fE(n,t);a.has(o)||(e.push(d({id:o,color:n.color||r},n)),a.add(o))}})),e}),[]).sort((function(e,n){return e.id.localeCompare(n.id)}))}(o,{id:t,defaultColor:n,defaultMarkerStart:null==i?void 0:i.markerStart,defaultMarkerEnd:null==i?void 0:i.markerEnd});return e}),[o,i,t,n]);return a.length?E.jsx("svg",{className:"ink-flow__marker",children:E.jsx("defs",{children:a.map((function(e){return E.jsx(hE,{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};vE.displayName="MarkerDefinitions";var pE=c(vE);function gE(e){var n=e.x,t=e.y,r=e.label,o=e.labelStyle,a=void 0===o?{}:o,u=e.labelShowBg,c=void 0===u||u,s=e.labelBgStyle,h=void 0===s?{}:s,v=e.labelBgPadding,p=void 0===v?[2,4]:v,y=e.labelBgBorderRadius,m=void 0===y?2:y,b=e.children,w=e.className,x=f(e,["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"]),_=g(i({x:1,y:0,width:0,height:0}),2),S=_[0],k=_[1],N=M(["ink-flow__edge-textwrapper",w]),C=l((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!==r&&r?E.jsxs("g",d({transform:"translate(".concat(n-S.width/2," ").concat(t-S.height/2,")"),className:N,visibility:S.width?"visible":"hidden"},x,{children:[c&&E.jsx("rect",{width:S.width+2*p[0],x:-p[0],y:-p[1],height:S.height+2*p[1],className:"ink-flow__edge-textbg",style:h,rx:m,ry:m}),E.jsx("text",{className:"ink-flow__edge-text",y:S.height/2,dy:"0.3em",ref:C,style:a,children:r}),b]})):null}gE.displayName="EdgeText";var yE=c(gE);function mE(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,l=e.labelBgPadding,s=e.labelBgBorderRadius,d=e.style,f=e.markerEnd,h=e.markerStart,v=e.className,p=e.interactionWidth,g=void 0===p?20:p;return E.jsxs(E.Fragment,{children:[E.jsx("path",{id:n,style:d,d:t,fill:"none",className:M(["ink-flow__edge-path",v]),markerEnd:f,markerStart:h}),g&&E.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:g,className:"ink-flow__edge-interaction"}),i&&Ox(r)&&Ox(o)?E.jsx(yE,{x:r,y:o,label:i,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:s}):null]})}function bE(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2;return n===Cm.Left||n===Cm.Right?[.5*(t+o),r]:[t,.5*(r+i)]}function wE(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Cm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Cm.Top:u,l=g(bE({pos:o,x1:n,y1:t,x2:i,y2:a}),2),s=l[0],d=l[1],f=g(bE({pos:c,x1:i,y1:a,x2:n,y2:t}),2),h=f[0],v=f[1],p=g(F_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:s,sourceControlY:d,targetControlX:h,targetControlY:v}),4),y=p[0],m=p[1],b=p[2],w=p[3];return["M".concat(n,",").concat(t," C").concat(s,",").concat(d," ").concat(h,",").concat(v," ").concat(i,",").concat(a),y,m,b,w]}function xE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.sourcePosition,c=void 0===u?Cm.Bottom:u,l=n.targetPosition,s=void 0===l?Cm.Top:l,d=n.label,f=n.labelStyle,h=n.labelShowBg,v=n.labelBgStyle,p=n.labelBgPadding,y=n.labelBgBorderRadius,m=n.style,b=n.markerEnd,w=n.markerStart,x=n.interactionWidth,_=g(wE({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s}),3),S=_[0],k=_[1],N=_[2],C=e.isInternal?void 0:t;return E.jsx(mE,{id:C,path:S,labelX:k,labelY:N,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:y,style:m,markerEnd:b,markerStart:w,interactionWidth:x})}))}var _E=xE({isInternal:!1}),EE=xE({isInternal:!0});function SE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.label,c=n.labelStyle,l=n.labelShowBg,s=n.labelBgStyle,d=n.labelBgPadding,f=n.labelBgBorderRadius,h=n.style,v=n.sourcePosition,p=void 0===v?Cm.Bottom:v,y=n.targetPosition,m=void 0===y?Cm.Top:y,b=n.markerEnd,w=n.markerStart,x=n.pathOptions,_=n.interactionWidth,S=g(J_({sourceX:r,sourceY:o,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:null==x?void 0:x.borderRadius,offset:null==x?void 0:x.offset}),3),k=S[0],N=S[1],C=S[2],M=e.isInternal?void 0:t;return E.jsx(mE,{id:M,path:k,labelX:N,labelY:C,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:w,interactionWidth:_})}))}_E.displayName="SimpleBezierEdge",EE.displayName="SimpleBezierEdgeInternal";var kE=SE({isInternal:!1}),NE=SE({isInternal:!0});function CE(e){return c((function(n){var t,o=n.id,i=f(n,["id"]),a=e.isInternal?void 0:o;return E.jsx(kE,d({},i,{id:a,pathOptions:r((function(){var e;return{borderRadius:0,offset:null===(e=i.pathOptions)||void 0===e?void 0:e.offset}}),[null===(t=i.pathOptions)||void 0===t?void 0:t.offset])}))}))}kE.displayName="SmoothStepEdge",NE.displayName="SmoothStepEdgeInternal";var ME=CE({isInternal:!1}),OE=CE({isInternal:!0});function jE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.label,c=n.labelStyle,l=n.labelShowBg,s=n.labelBgStyle,d=n.labelBgPadding,f=n.labelBgBorderRadius,h=n.style,v=n.markerEnd,p=n.markerStart,y=n.interactionWidth,m=g(function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=g(G_({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,l]}({sourceX:r,sourceY:o,targetX:i,targetY:a}),3),b=m[0],w=m[1],x=m[2],_=e.isInternal?void 0:t;return E.jsx(mE,{id:_,path:b,labelX:w,labelY:x,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:v,markerStart:p,interactionWidth:y})}))}ME.displayName="StepEdge",OE.displayName="StepEdgeInternal";var PE=jE({isInternal:!1}),IE=jE({isInternal:!0});function AE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.sourcePosition,c=void 0===u?Cm.Bottom:u,l=n.targetPosition,s=void 0===l?Cm.Top:l,d=n.label,f=n.labelStyle,h=n.labelShowBg,v=n.labelBgStyle,p=n.labelBgPadding,y=n.labelBgBorderRadius,m=n.style,b=n.markerEnd,w=n.markerStart,x=n.pathOptions,_=n.interactionWidth,S=g(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?Cm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?Cm.Top:u,l=e.curvature,s=void 0===l?.25:l,d=g(U_({pos:o,x1:n,y1:t,x2:i,y2:a,c:s}),2),f=d[0],h=d[1],v=g(U_({pos:c,x1:i,y1:a,x2:n,y2:t,c:s}),2),p=v[0],y=v[1],m=g(F_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:y}),4),b=m[0],w=m[1],x=m[2],_=m[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(y," ").concat(i,",").concat(a),b,w,x,_]}({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s,curvature:null==x?void 0:x.curvature}),3),k=S[0],N=S[1],C=S[2],M=e.isInternal?void 0:t;return E.jsx(mE,{id:M,path:k,labelX:N,labelY:C,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:y,style:m,markerEnd:b,markerStart:w,interactionWidth:_})}))}PE.displayName="StraightEdge",IE.displayName="StraightEdgeInternal";var zE=AE({isInternal:!1}),TE=AE({isInternal:!0});zE.displayName="BezierEdge",TE.displayName="BezierEdgeInternal";var LE={default:TE,straight:IE,step:OE,smoothstep:NE,simplebezier:EE},BE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},DE=function(e,n,t){return t===Cm.Left?e-n:t===Cm.Right?e+n:e},RE=function(e,n,t){return t===Cm.Top?e-n:t===Cm.Bottom?e+n:e},HE="ink-flow__edgeupdater";function VE(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,l=e.type;return E.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:c,className:M([HE,"".concat(HE,"-").concat(l)]),cx:DE(t,i,n),cy:RE(r,i,n),r:i,stroke:"transparent",fill:"transparent"})}function YE(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,l=e.targetY,s=e.sourcePosition,d=e.targetPosition,f=e.onEdgeUpdate,h=e.onEdgeUpdateStart,v=e.onEdgeUpdateEnd,p=e.setUpdating,g=e.setUpdateHover,y=bx(),m=function(e,n){if(0===e.button){var t=y.getState(),a=t.autoPanOnConnect,u=t.domNode,c=t.isValidConnection,l=t.connectionMode,s=t.connectionRadius,d=t.lib,g=t.onConnectStart,m=t.onConnectEnd,b=t.cancelConnection,w=t.nodeLookup,x=t.rfId,_=t.panBy,E=t.updateConnection,S=n?r.target:r.source,k=(n?o:i)||null,N=n?"target":"source",C=n;p(!0),null==h||h(e,r,N);Km.onPointerDown(e.nativeEvent,{autoPanOnConnect:a,connectionMode:l,connectionRadius:s,domNode:u,handleId:k,nodeId:S,nodeLookup:w,isTarget:C,edgeUpdaterType:N,lib:d,flowId:x,cancelConnection:b,panBy:_,isValidConnection:c,onConnect:function(e){return null==f?void 0:f(r,e)},onConnectStart:g,onConnectEnd:m,onEdgeUpdateEnd:function(e){p(!1),null==v||v(e,r,N)},updateConnection:E,getTransform:function(){return y.getState().transform},getConnectionStartHandle:function(){return y.getState().connectionStartHandle}})}},b=function(){return g(!0)},w=function(){return g(!1)};return E.jsxs(E.Fragment,{children:[("source"===n||!0===n)&&E.jsx(VE,{position:s,centerX:a,centerY:u,radius:t,onMouseDown:function(e){return m(e,!0)},onMouseEnter:b,onMouseOut:w,type:"source"}),("target"===n||!0===n)&&E.jsx(VE,{position:d,centerX:c,centerY:l,radius:t,onMouseDown:function(e){return m(e,!1)},onMouseEnter:b,onMouseOut:w,type:"target"})]})}function XE(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 FE(e){var n,t,r,o;if(!e)return null;var i=[],a=[];try{for(var u=p(e),c=u.next();!c.done;c=u.next()){var l=c.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?i.push(l):"target"===l.type&&a.push(l)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(n)throw n.error}}return{source:i,target:a}}function ZE(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:Mx(n),c=u.width,l=u.height;switch(e){case Cm.Top:return[i+c/2,a];case Cm.Right:return[i+c,a+l/2];case Cm.Bottom:return[i+c/2,a+l];case Cm.Left:return[i,a+l/2]}}function UE(e,n){return e&&(n?e.find((function(e){return e.id===n})):e[0])||null}function GE(e){var n=e.id,t=e.edgesFocusable,o=e.edgesUpdatable,u=e.elementsSelectable,c=e.onClick,s=e.onDoubleClick,f=e.onContextMenu,h=e.onMouseEnter,v=e.onMouseMove,p=e.onMouseLeave,y=e.edgeUpdaterRadius,m=e.onEdgeUpdate,b=e.onEdgeUpdateStart,w=e.onEdgeUpdateEnd,x=e.rfId,_=e.edgeTypes,S=e.noPanClassName,k=e.onError,N=e.disableKeyboardA11y,C=mx((function(e){return e.edgeLookup.get(n)})),O=mx((function(e){return e.defaultEdgeOptions})),j=(C=O?d(d({},O),C):C).type||"default",P=(null==_?void 0:_[j])||LE[j];void 0===P&&(null==k||k("011",Ky.error011(j)),j="default",P=LE.default);var I=!!(C.focusable||t&&void 0===C.focusable),A=void 0!==m&&(C.updatable||o&&void 0===C.updatable),z=!!(C.selectable||u&&void 0===C.selectable),T=a(null),L=g(i(!1),2),B=L[0],D=L[1],R=g(i(!1),2),H=R[0],V=R[1],Y=bx(),X=mx(l((function(e){var t=e.nodeLookup.get(C.source),r=e.nodeLookup.get(C.target);if(!t||!r)return d({zIndex:C.zIndex},BE);var o=function(e){var n,t,r,o,i,a=e.sourceNode,u=e.targetNode;if(!XE(a)||!XE(u))return null;var c=a.internals.handleBounds||FE(a.handles),l=u.internals.handleBounds||FE(u.handles),s=UE(null!==(n=null==c?void 0:c.source)&&void 0!==n?n:[],e.sourceHandle),d=UE(e.connectionMode===_m.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),f=(null==s?void 0:s.position)||Cm.Bottom,h=(null==d?void 0:d.position)||Cm.Top;if(!s||!d)return null===(i=e.onError)||void 0===i||i.call(e,"008",Ky.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;var v=g(ZE(f,a,s),2),p=v[0],y=v[1],m=g(ZE(h,u,d),2);return{sourceX:p,sourceY:y,targetX:m[0],targetY:m[1],sourcePosition:f,targetPosition:h}}({id:n,sourceNode:t,targetNode:r,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:e.connectionMode,onError:k}),i=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,l=Math.max(n.internals.z||0,t.internals.z||0,1e3);return a+(c?l:0)}({selected:C.selected,zIndex:C.zIndex,sourceNode:t,targetNode:r,elevateOnSelect:e.elevateEdgesOnSelect});return d({zIndex:i},o||BE)}),[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),n_),F=X.zIndex,Z=X.sourceX,U=X.sourceY,G=X.targetX,W=X.targetY,q=X.sourcePosition,$=X.targetPosition,K=r((function(){return C.markerStart?"url('#".concat(fE(C.markerStart,x),"')"):void 0}),[C.markerStart,x]),Q=r((function(){return C.markerEnd?"url('#".concat(fE(C.markerEnd,x),"')"):void 0}),[C.markerEnd,x]);if(C.hidden||null===Z||null===U||null===G||null===W)return null;var J=s?function(e){s(e,d({},C))}:void 0,ee=f?function(e){f(e,d({},C))}:void 0,ne=h?function(e){h(e,d({},C))}:void 0,te=v?function(e){v(e,d({},C))}:void 0,re=p?function(e){p(e,d({},C))}:void 0;return E.jsx("svg",{style:{zIndex:F},children:E.jsxs("g",{className:M(["ink-flow__edge","ink-flow__edge-".concat(j),C.className,S,{selected:C.selected,animated:C.animated,inactive:!z&&!c,updating:B,selectable:z}]),onClick:function(e){var t,r=Y.getState(),o=r.addSelectedEdges,i=r.unselectNodesAndEdges,a=r.multiSelectionActive;z&&(Y.setState({nodesSelectionActive:!1}),C.selected&&a?(i({nodes:[],edges:[C]}),null===(t=T.current)||void 0===t||t.blur()):o([n])),c&&c(e,C)},onDoubleClick:J,onContextMenu:ee,onMouseEnter:ne,onMouseMove:te,onMouseLeave:re,onKeyDown:I?function(e){var t;if(!N&&Jy.includes(e.key)&&z){var r=Y.getState(),o=r.unselectNodesAndEdges,i=r.addSelectedEdges;"Escape"===e.key?(null===(t=T.current)||void 0===t||t.blur(),o({edges:[C]})):i([n])}}:void 0,tabIndex:I?0:void 0,role:I?"button":"img","data-id":n,"data-testid":"rf__edge-".concat(n),"aria-label":null===C.ariaLabel?void 0:C.ariaLabel||"Edge from ".concat(C.source," to ").concat(C.target),"aria-describedby":I?"".concat(X_,"-").concat(x):void 0,ref:T,children:[!H&&E.jsx(P,{id:n,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:Z,sourceY:U,targetX:G,targetY:W,sourcePosition:q,targetPosition:$,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:K,markerEnd:Q,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),A&&E.jsx(YE,{edge:C,isUpdatable:A,edgeUpdaterRadius:y,onEdgeUpdate:m,onEdgeUpdateStart:b,onEdgeUpdateEnd:w,sourceX:Z,sourceY:U,targetX:G,targetY:W,sourcePosition:q,targetPosition:$,setUpdateHover:D,setUpdating:V,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle})]})})}var WE=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 qE(e){var n=e.defaultMarkerColor,t=e.rfId,r=e.noPanClassName,o=e.onEdgeUpdate;e.onEdgeContextMenu,e.onEdgeMouseEnter,e.onEdgeMouseMove,e.onEdgeMouseLeave,e.onEdgeClick;var i=mx(WE,n_),a=i.edgesFocusable,u=i.edgesUpdatable,c=i.elementsSelectable,s=i.onError,d=function(e){var n=mx(l((function(e){return e.edges.map((function(e){return e.id}))}),[e]),n_);return n}(!1);return E.jsxs("div",{className:"ink-flow__edges",children:[E.jsx(pE,{defaultColor:n,rfId:t}),d.map((function(e){return E.jsx(GE,{id:e,edgesFocusable:a,edgesUpdatable:u,elementsSelectable:c,noPanClassName:r,onEdgeUpdate:o,rfId:t,onError:s},e)}))]})}qE.displayName="EdgeRenderer";var $E,KE=c(qE),QE=function(e){return"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],")")};function JE(e){var n=e.children,t=mx(QE);return E.jsx("div",{className:"ink-flow__viewport xyflow__viewport ink-flow__container",style:{transform:t},children:n})}var eS=(($E={})[Cm.Left]=Cm.Right,$E[Cm.Right]=Cm.Left,$E[Cm.Top]=Cm.Bottom,$E[Cm.Bottom]=Cm.Top,$E),nS=function(e){var n,t,r=e.nodeId,o=e.handleType,i=e.style,a=e.type,u=void 0===a?km.Bezier:a,c=e.CustomComponent,s=e.connectionStatus,f=mx(l((function(e){var n;return{fromNode:e.nodeLookup.get(r),handleId:null===(n=e.connectionStartHandle)||void 0===n?void 0:n.handleId,toX:(e.connectionPosition.x-e.transform[0])/e.transform[2],toY:(e.connectionPosition.y-e.transform[1])/e.transform[2],connectionMode:e.connectionMode}}),[r]),n_),h=f.fromNode,v=f.handleId,p=f.toX,y=f.toY,m=f.connectionMode,b=null==h?void 0:h.internals.handleBounds,w=null==b?void 0:b[o];if(m===_m.Loose&&(w=w||(null==b?void 0:b["source"===o?"target":"source"])),!h||!w)return null;var x=v?w.find((function(e){return e.id===v})):w[0],_=x?x.x+x.width/2:(null!==(n=h.measured.width)&&void 0!==n?n:0)/2,S=x?x.y+x.height/2:null!==(t=h.measured.height)&&void 0!==t?t:0,k=h.internals.positionAbsolute.x+_,N=h.internals.positionAbsolute.y+S,C=null==x?void 0:x.position,M=C?eS[C]:null;if(!C||!M)return null;if(c)return E.jsx(c,{connectionLineType:u,connectionLineStyle:i,fromNode:h,fromHandle:x,fromX:k,fromY:N,toX:p,toY:y,fromPosition:C,toPosition:M,connectionStatus:s});var O="",j={sourceX:k,sourceY:N,sourcePosition:C,targetX:p,targetY:y,targetPosition:M};return O=u===km.Bezier?g(Im(j),1)[0]:u===km.Step?g(Vm(d(d({},j),{borderRadius:0})),1)[0]:u===km.SmoothStep?g(Vm(j),1)[0]:u===km.SimpleBezier?g(wE(j),1)[0]:"M".concat(k,",").concat(N," ").concat(p,",").concat(y),E.jsx("path",{d:O,fill:"none",className:"react-flow__connection-path",style:i})};nS.displayName="ConnectionLine";var tS=function(e){var n,t;return{nodeId:null===(n=e.connectionStartHandle)||void 0===n?void 0:n.nodeId,handleType:null===(t=e.connectionStartHandle)||void 0===t?void 0:t.type,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height}};function rS(e){var n=e.containerStyle,t=e.style,r=e.type,o=e.component,i=mx(tS,n_),a=i.nodeId,u=i.handleType,c=i.nodesConnectable,l=i.width,s=i.height,d=i.connectionStatus;return!!(a&&u&&l&&c)?E.jsx("svg",{style:n,width:l,height:s,className:"react-flow__connectionline react-flow__container",children:E.jsx("g",{className:M(["react-flow__connection",d]),children:E.jsx(nS,{nodeId:a,handleType:u,style:t,type:r,CustomComponent:o,connectionStatus:d})})}):null}function oS(e){var n=e.onNodeClick,t=e.onNodeDoubleClick,r=e.onNodeMouseEnter,o=e.onNodeMouseMove,i=e.onNodeMouseLeave,a=e.onNodeContextMenu,u=e.onEdgeClick,c=e.onEdgeDoubleClick,l=e.onEdgeMouseEnter,s=e.onEdgeMouseMove,d=e.onEdgeMouseLeave,f=e.onEdgeContextMenu,h=e.rfId,v=e.minZoom,p=e.maxZoom,g=e.noPanClassName,y=e.noDragClassName,m=e.nodeOrigin,b=e.viewport,w=e.disableKeyboardA11y,x=e.translateExtent,_=e.defaultViewport,S=e.nodeTypes,k=e.elementsSelectable,N=e.defaultMarkerColor,C=e.connectionLineType,M=e.connectionLineStyle,O=e.connectionLineComponent,j=e.connectionLineContainerStyle,P=e.onPaneClick,I=e.onPaneContextMenu,A=e.onPaneMouseEnter,z=e.onPaneMouseMove,T=e.onPaneMouseLeave,L=e.onPaneScroll;return E.jsx(M_,{minZoom:v,maxZoom:p,noPanClassName:g,noDragClassName:y,isControlledViewport:!!b,disableKeyboardA11y:w,translateExtent:x,defaultViewport:_,elementsSelectable:k,onPaneClick:P,onPaneContextMenu:I,onPaneMouseEnter:A,onPaneMouseMove:z,onPaneMouseLeave:T,onPaneScroll:L,children:E.jsxs(JE,{children:[E.jsx(KE,{rfId:h,noPanClassName:g,onEdgeClick:u,onEdgeDoubleClick:c,onEdgeMouseEnter:l,onEdgeMouseMove:s,onEdgeMouseLeave:d,onEdgeContextMenu:f,defaultMarkerColor:N}),E.jsx(rS,{style:M,type:C,component:O,containerStyle:j}),E.jsx("div",{className:"ink-flow__edgelabel-renderer"}),E.jsx(sE,{rfId:h,nodeTypes:S,nodeOrigin:m,noDragClassName:y,noPanClassName:g,disableKeyboardA11y:!1,onNodeClick:n,onNodeDoubleClick:t,onNodeMouseEnter:r,onNodeMouseMove:o,onNodeMouseLeave:i,onNodeContextMenu:a}),E.jsx("div",{className:"ink-flow__viewport-portal"})]})})}oS.displayName="GraphView";var iS=c(oS),aS=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,l=new Map,s=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:[];Ex(s,d,f),Sx(h,c,l,{nodeOrigin:[0,0],elevateNodesOnSelect:!1});return{rfId:"1",width:0,height:0,transform:[0,0,1],nodes:h,nodeLookup:c,parentLookup:l,edges:f,edgeLookup:d,connectionLookup:s,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==a,hasDefaultEdges:void 0!==u,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:Qy,nodeExtent:Qy,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:_m.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}},uS=function(e){var n,t,r=e.nodes,o=e.edges,i=e.defaultNodes,a=e.defaultEdges,u=e.width,c=e.height,l=e.fitView;return n=function(e,n){return d(d({},aS({nodes:r,edges:o,width:u,height:c,fitView:l,defaultNodes:i,defaultEdges:a})),{setNodes:function(t){var r=n();Sx(t,r.nodeLookup,r.parentLookup,{nodeOrigin:r.nodeOrigin,elevateNodesOnSelect:r.elevateNodesOnSelect,checkEquality:!0}),e({nodes:t})},setEdges:function(t){var r=n();Ex(r.connectionLookup,r.edgeLookup,t),e({edges:t})},setDefaultNodesAndEdges:function(t,r){t&&((0,n().setNodes)(t),e({hasDefaultNodes:!0})),r&&((0,n().setEdges)(r),e({hasDefaultEdges:!0}))},updateNodeInternals:function(t){var r=n(),o=r.triggerNodeChanges,i=r.fitView,a=r.nodeLookup,u=r.parentLookup,c=r.fitViewOnInit,l=r.fitViewDone,s=r.fitViewOnInitOptions,f=r.domNode,h=r.nodeOrigin,v=r.debug,p=function(e,n,t,r,o){var i=null==r?void 0:r.querySelector(".xyflow__viewport"),a=!1;if(!i)return{changes:[],updatedInternals:a};var u=[],c=window.getComputedStyle(i),l=new window.DOMMatrixReadOnly(c.transform).m22,s=[];if(e.forEach((function(e){var t=n.get(e.id);if(null==t?void 0:t.hidden)n.set(t.id,d(d({},t),{internals:d(d({},t.internals),{handleBounds:void 0})})),a=!0;else if(t){var r=Zx(e.nodeElement),i=t.measured.width!==r.width||t.measured.height!==r.height;if(r.width&&r.height&&(i||!t.internals.handleBounds||e.force)){var c=d(d({},t),{measured:r,internals:d(d({},t.internals),{handleBounds:{source:$x(".source",e.nodeElement,l,t.origin||o),target:$x(".target",e.nodeElement,l,t.origin||o)}})});n.set(t.id,c),a=!0,i&&(u.push({id:c.id,type:"dimensions",dimensions:r}),c.expandParent&&c.parentId&&s.push({id:c.id,parentId:c.parentId,rect:Ix(c,c.origin||o)}))}}})),s.length>0){var f=kx(s,n,t,o);u.push.apply(u,y([],g(f),!1))}return{changes:u,updatedInternals:a}}(t,a,u,f,h),m=p.changes;if(p.updatedInternals){wx(a,{nodeOrigin:h});var b=l;!l&&c&&(b=i(d(d({},s),{nodes:null==s?void 0:s.nodes}))),e({fitViewDone:b}),(null==m?void 0:m.length)>0&&(v&&console.log("Ink Flow: trigger node changes",m),null==o||o(m))}},updateNodePositions:function(e,t){var r,o;void 0===t&&(t=!1);var i=[],a=[];try{for(var u=p(e),c=u.next();!c.done;c=u.next()){var l=g(c.value,2),s=l[0],f=l[1],h={id:s,type:"position",position:f.position,dragging:t};(null==f?void 0:f.expandParent)&&(null==f?void 0:f.parentId)&&h.position&&(i.push({id:s,parentId:f.parentId,rect:d(d({},f.internals.positionAbsolute),{width:f.measured.width,height:f.measured.height})}),h.position.x=Math.max(0,h.position.x),h.position.y=Math.max(0,h.position.y)),a.push(h)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}if(i.length>0){var v=n(),m=kx(i,v.nodeLookup,v.parentLookup);a.push.apply(a,y([],g(m),!1))}n().triggerNodeChanges(a)},triggerNodeChanges:function(e){var t=n(),r=t.onNodesChange,o=t.setNodes,i=t.nodes,a=t.hasDefaultNodes,u=t.debug;(null==e?void 0:e.length)&&(a&&o(l_(e,i)),u&&console.log("Ink Flow: trigger node changes",e),null==r||r(e))},triggerEdgeChanges:function(e){var t=n(),r=t.onEdgesChange,o=t.setEdges,i=t.edges,a=t.hasDefaultEdges,u=t.debug;(null==e?void 0:e.length)&&(a&&o(c_(e,i)),u&&console.log("Ink Flow: trigger edge changes",e),null==r||r(e))},addSelectedNodes:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,u=t.triggerEdgeChanges;r?a(e.map((function(e){return s_(e,!0)}))):(a(d_(i,new Set(y([],g(e),!1)),!0)),u(d_(o)))},addSelectedEdges:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,u=t.triggerEdgeChanges;r?u(e.map((function(e){return s_(e,!0)}))):(u(d_(o,new Set(y([],g(e),!1)))),a(d_(i,new Set,!0)))},unselectNodesAndEdges:function(e){var t=void 0===e?{}:e,r=t.nodes,o=t.edges,i=n(),a=i.edges,u=i.nodes,c=i.triggerNodeChanges,l=i.triggerEdgeChanges,s=o||a,d=(r||u).map((function(e){return e.selected=!1,s_(e.id,!1)})),f=s.map((function(e){return s_(e.id,!1)}));c(d),l(f)},setMinZoom:function(t){var r=n(),o=r.panZoom,i=r.maxZoom;null==o||o.setScaleExtent([t,i]),e({minZoom:t})},setMaxZoom:function(t){var r=n(),o=r.panZoom,i=r.minZoom;null==o||o.setScaleExtent([i,t]),e({maxZoom:t})},setTranslateExtent:function(t){var r;null===(r=n().panZoom)||void 0===r||r.setTranslateExtent(t),e({translateExtent:t})},resetSelectedElements:function(){var e=n(),t=e.edges,r=e.nodes,o=e.triggerNodeChanges,i=e.triggerEdgeChanges,a=r.reduce((function(e,n){return n.selected?y(y([],g(e),!1),[s_(n.id,!1)],!1):e}),[]),u=t.reduce((function(e,n){return n.selected?y(y([],g(e),!1),[s_(n.id,!1)],!1):e}),[]);o(a),i(u)},setNodeExtent:function(t){var r,o,i=n().nodeLookup;try{for(var a=p(i),u=a.next();!u.done;u=a.next()){var c=g(u.value,2)[1],l=Cx(c.position,t);i.set(c.id,d(d({},c),{internals:d(d({},c.internals),{positionAbsolute:l})}))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}e({nodeExtent:t})},panBy:function(e){var t=n(),r=t.transform,o=t.width,i=t.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:t.panZoom,transform:r,translateExtent:t.translateExtent,width:o,height:i})},fitView:function(e){var t=n(),r=t.panZoom,o=t.width,i=t.height,a=t.minZoom,u=t.maxZoom,c=t.nodeOrigin,l=t.nodeLookup;return!!r&&m_({nodeLookup:l,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(t){var r,o=n().connectionPosition,i=d(d({},t),{connectionPosition:null!==(r=t.connectionPosition)&&void 0!==r?r:o});e(i)},reset:function(){return e(d({},aS()))}})},t=Object.is,n?H(n,t):H};function cS(e){var n=e.initialNodes,t=e.initialEdges,r=e.defaultNodes,o=e.defaultEdges,a=e.initialWidth,u=e.initialHeight,c=e.fitView,l=e.children,s=g(i((function(){return uS({nodes:n,edges:t,defaultNodes:r,defaultEdges:o,width:a,height:u,fitView:c})})),1)[0];return E.jsx(Y,{value:s,children:E.jsx(z_,{children:l})})}function lS(e){var n=e.children,r=e.nodes,o=e.edges,i=e.defaultNodes,a=e.defaultEdges,u=e.width,c=e.height,l=e.fitView;return t(V)?E.jsx(E.Fragment,{children:n}):E.jsx(cS,{initialNodes:r,initialEdges:o,defaultNodes:i,defaultEdges:a,initialWidth:u,initialHeight:c,fitView:l,children:n})}var sS={x:0,y:0,zoom:1},dS=y(y([],g(["nodes","edges","defaultNodes","defaultEdges","nodesDraggable","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","translateExtent","defaultEdgeOptions","fitView","fitViewOptions"]),!1),["rfId"],!1),fS=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}},hS={translateExtent:Qy,nodeOrigin:[0,0],minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function vS(e){var n=mx(fS,n_),t=n.setNodes,r=n.setEdges,o=n.setMinZoom,i=n.setMaxZoom,c=n.setTranslateExtent,l=n.setNodeExtent,s=n.reset,d=n.setDefaultNodesAndEdges,f=bx();u((function(){return d(e.defaultNodes,e.defaultEdges),function(){h.current=hS,s()}}),[]);var h=a(hS);return u((function(){var n,a,u;try{for(var s=p(dS),d=s.next();!d.done;d=s.next()){var v=d.value,g=e[v];g!==h.current[v]&&(void 0!==e[v]&&("nodes"===v?t(g):"edges"===v?r(g):"minZoom"===v?o(g):"maxZoom"===v?i(g):"translateExtent"===v?c(g):"nodeExtent"===v?l(g):"fitView"===v?f.setState({fitViewOnInit:g}):"fitViewOptions"===v?f.setState({fitViewOnInitOptions:g}):f.setState(((u={})[v]=g,u))))}}catch(e){n={error:e}}finally{try{d&&!d.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}h.current=e}),dS.map((function(n){return e[n]}))),null}var pS={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var gS=Bx((function(e,n){var t=e.nodes,r=e.edges,o=e.translateExtent,i=void 0===o?Qy:o,a=e.defaultViewport,u=void 0===a?sS:a,c=e.minZoom,l=void 0===c?.5:c,s=e.maxZoom,h=void 0===s?2:s,v=e.defaultMarkerColor,p=void 0===v?"#b1b1b7":v,g=e.nodeOrigin,y=e.noDragClassName,m=e.noPanClassName,b=e.disableKeyboardA11y,w=e.nodeTypes;e.connectionMode;var x=e.connectionLineType,_=void 0===x?km.Bezier:x,S=e.connectionLineStyle,k=e.connectionLineComponent,N=e.connectionLineContainerStyle,C=e.onNodeClick,O=e.onNodeDoubleClick,j=e.onNodeMouseEnter,P=e.onNodeMouseMove,I=e.onNodeMouseLeave,A=e.onNodeContextMenu,z=e.onEdgeClick,T=e.onEdgeMouseEnter,L=e.onEdgeMouseMove,B=e.onEdgeMouseLeave,D=e.onEdgeContextMenu,R=e.onEdgeDoubleClick,H=e.onNodesChange,V=e.onEdgesChange,Y=e.fitView,X=e.fitViewOptions,F=e.nodeExtent,Z=e.nodesDraggable,U=e.children,G=e.id,W=e.width,q=e.height,$=e.onPaneClick,K=e.onPaneContextMenu,Q=e.onPaneMouseEnter,J=e.onPaneMouseMove,ee=e.onPaneMouseLeave,ne=e.onPaneScroll,te=e.elementsSelectable,re=void 0===te||te,oe=f(e,["nodes","edges","translateExtent","defaultViewport","minZoom","maxZoom","defaultMarkerColor","nodeOrigin","noDragClassName","noPanClassName","disableKeyboardA11y","nodeTypes","connectionMode","connectionLineType","connectionLineStyle","connectionLineComponent","connectionLineContainerStyle","onNodeClick","onNodeDoubleClick","onNodeMouseEnter","onNodeMouseMove","onNodeMouseLeave","onNodeContextMenu","onEdgeClick","onEdgeMouseEnter","onEdgeMouseMove","onEdgeMouseLeave","onEdgeContextMenu","onEdgeDoubleClick","onNodesChange","onEdgesChange","fitView","fitViewOptions","nodeExtent","nodesDraggable","children","id","width","height","onPaneClick","onPaneContextMenu","onPaneMouseEnter","onPaneMouseMove","onPaneMouseLeave","onPaneScroll","elementsSelectable"]),ie=G||"1";return E.jsx("div",d({},oe,{ref:n,style:d({},pS),className:M(["ink-flow"]),"data-testid":"rf__wrapper",id:G,children:E.jsxs(lS,{nodes:t,edges:r,width:W,height:q,fitView:Y,children:[E.jsx(iS,{onNodeClick:C,onNodeMouseEnter:j,onNodeMouseMove:P,onNodeMouseLeave:I,onNodeContextMenu:A,onNodeDoubleClick:O,onEdgeClick:z,onEdgeMouseEnter:T,onEdgeMouseMove:L,onEdgeMouseLeave:B,onEdgeContextMenu:D,onEdgeDoubleClick:R,rfId:ie,nodeTypes:w,minZoom:l,maxZoom:h,nodeOrigin:g,noDragClassName:y,noPanClassName:m,disableKeyboardA11y:b,translateExtent:i,defaultMarkerColor:p,connectionLineType:_,connectionLineStyle:S,connectionLineComponent:k,connectionLineContainerStyle:N,defaultViewport:u,onPaneClick:$,onPaneContextMenu:K,onPaneMouseEnter:Q,onPaneMouseMove:J,onPaneMouseLeave:ee,onPaneScroll:ne}),E.jsx(vS,{nodes:t,edges:r,rfId:ie,onNodesChange:H,onEdgesChange:V,fitView:Y,fitViewOptions:X,nodeExtent:F,nodesDraggable:Z,elementsSelectable:re}),U]})}))}));function yS(){return E.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E.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 mS(){return E.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E.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 bS(){return E.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:E.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 wS(){return E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:E.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 xS(){return E.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:E.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 _S(e){var n=e.children,t=e.className,r=f(e,["children","className"]);return E.jsx("button",d({type:"button",className:M(["ink-flow__controls-button",t])},r,{children:n}))}var ES=function(e){return e.userSelectionActive?"none":"all"};function SS(e){var n=e.position,t=void 0===n?"top-left":n,r=e.children,o=e.className,i=e.style,a=f(e,["position","children","className","style"]),u=mx(ES),c="".concat(t).split("-");return E.jsx("div",d({className:M(y(["ink-flow__panel",o],g(c),!1)),style:d(d({},i),{pointerEvents:u})},a,{children:r}))}var kS=function(e){return{isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}};function NS(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,l=e.onZoomIn,s=e.onZoomOut,d=e.onFitView,f=e.onInteractiveChange,h=e.className,v=e.children,p=e.position,g=void 0===p?"bottom-left":p,y=e.orientation,m=void 0===y?"vertical":y,b=e["aria-label"],w=void 0===b?"Ink Flow controls":b,x=bx(),_=mx(kS,n_),S=_.isInteractive,k=_.minZoomReached,N=_.maxZoomReached,C=B_(),O=C.zoomIn,j=C.zoomOut,P=C.fitView,I="horizontal"===m?"horizontal":"vertical";return E.jsxs(SS,{className:M(["ink-flow__controls",I,h]),position:g,style:n,"data-testid":"rf__controls","aria-label":w,children:[i&&E.jsx(_S,{className:"ink-flow__controls-fitview",onClick:function(){P(c),null==d||d()},"aria-label":"fit view",children:E.jsx(bS,{})}),r&&E.jsxs("div",{className:"ink-flow__controls-zoom",children:[E.jsx(_S,{onClick:function(){O(),null==l||l()},className:"ink-flow__controls-zoomin","aria-label":"zoom in",disabled:N,children:E.jsx(yS,{})}),E.jsx(_S,{onClick:function(){j(),null==s||s()},className:"ink-flow__controls-zoomout","aria-label":"zoom out",disabled:k,children:E.jsx(mS,{})})]}),u&&E.jsx(_S,{className:"ink-flow__controls-interactive",onClick:function(){x.setState({nodesDraggable:!S,nodesConnectable:!S,elementsSelectable:!S}),null==f||f(!S)},title:"toggle interactivity","aria-label":"toggle interactivity",children:S?E.jsx(xS,{}):E.jsx(wS,{})}),v]})}NS.displayName="Controls";var CS=c(NS);export{km as ConnectionLineType,_m as ConnectionMode,_S as ControlButton,CS as Controls,nE as Handle,cS as InkFlowProvider,Nm as MarkerType,Em as PanOnScrollMode,Cm as Position,Sm as SelectionMode,Lm as addEdge,gv as dagreLayout,gS as default,Om as getBezierEdgeCenter,Im as getBezierPath,im as getConnectedEdges,Am as getEdgeCenter,nm as getIncomers,rm as getNodesBounds,em as getOutgoers,Vm as getSmoothStepPath,Dm as getStraightPath,mm as getViewportForBounds,Bm as updateEdge,O_ as useEdgesState,B_ as useInkFlow,j_ as useNodesState,mx as useStore,bx as useStoreApi};
|
|
17
17
|
//# sourceMappingURL=index.esm.js.map
|