@aloudata/ink-flow 1.0.20 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/components/BatchProvider/index.d.ts.map +1 -1
  2. package/dist/components/Handle/index.d.ts.map +1 -1
  3. package/dist/components/StoreUpdater/index.d.ts +1 -1
  4. package/dist/components/StoreUpdater/index.d.ts.map +1 -1
  5. package/dist/container/InkFlow/index.d.ts.map +1 -1
  6. package/dist/container/InkFlow/init-values.d.ts +1 -1
  7. package/dist/container/InkFlow/init-values.d.ts.map +1 -1
  8. package/dist/hooks/useEdgesState.d.ts +2 -2
  9. package/dist/hooks/useEdgesState.d.ts.map +1 -1
  10. package/dist/hooks/useInkFlow.d.ts.map +1 -1
  11. package/dist/hooks/useNodesState.d.ts +2 -2
  12. package/dist/hooks/useNodesState.d.ts.map +1 -1
  13. package/dist/index.cjs.js +11 -3
  14. package/dist/index.cjs.js.map +1 -1
  15. package/dist/index.esm.js +11 -3
  16. package/dist/index.esm.js.map +1 -1
  17. package/dist/store/index.d.ts.map +1 -1
  18. package/dist/store/initialState.d.ts.map +1 -1
  19. package/dist/types/general.d.ts +13 -2
  20. package/dist/types/general.d.ts.map +1 -1
  21. package/dist/types/instance.d.ts +0 -4
  22. package/dist/types/instance.d.ts.map +1 -1
  23. package/dist/types/layout.d.ts +37 -0
  24. package/dist/types/layout.d.ts.map +1 -0
  25. package/dist/types/props.d.ts +1 -3
  26. package/dist/types/props.d.ts.map +1 -1
  27. package/dist/types/store.d.ts +10 -2
  28. package/dist/types/store.d.ts.map +1 -1
  29. package/dist/utils/general.d.ts.map +1 -1
  30. package/dist/utils/layout.d.ts +23 -0
  31. package/dist/utils/layout.d.ts.map +1 -0
  32. package/dist/utils/node.d.ts +2 -5
  33. package/dist/utils/node.d.ts.map +1 -1
  34. package/dist/utils/positions.d.ts.map +1 -1
  35. package/dist/utils/store.d.ts.map +1 -1
  36. package/package.json +3 -2
package/dist/index.cjs.js CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=require("react-dom"),t=function(){return t=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},t.apply(this,arguments)};function r(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 o(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 i(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 a(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 u(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 c(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 s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var l,d={exports:{}},f={};d.exports=function(){if(l)return f;l=1;var n=e,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(e,n,r){var u,c={},s=null,l=null;for(u in void 0!==r&&(s=""+r),void 0!==n.key&&(s=""+n.key),void 0!==n.ref&&(l=n.ref),n)o.call(n,u)&&!a.hasOwnProperty(u)&&(c[u]=n[u]);if(e&&e.defaultProps)for(u in n=e.defaultProps)void 0===c[u]&&(c[u]=n[u]);return{$$typeof:t,type:e,key:s,ref:l,props:c,_owner:i.current}}return f.Fragment=r,f.jsx=u,f.jsxs=u,f}();var h,v=d.exports,p={exports:{}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react"),e=require("react-dom"),t=function(){return t=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},t.apply(this,arguments)};function r(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}function o(n,e,t,r){return new(t||(t=Promise))((function(o,i){function u(n){try{c(r.next(n))}catch(n){i(n)}}function a(n){try{c(r.throw(n))}catch(n){i(n)}}function c(n){var e;n.done?o(n.value):(e=n.value,e instanceof t?e:new t((function(n){n(e)}))).then(u,a)}c((r=r.apply(n,e||[])).next())}))}function i(n,e){var t,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=a(0),u.throw=a(1),u.return=a(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(a){return function(c){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;u&&(u=0,a[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(n,i)}catch(n){a=[6,n],r=0}finally{t=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function u(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 a(n,e){var t="function"==typeof Symbol&&n[Symbol.iterator];if(!t)return n;var r,o,i=t.call(n),u=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)u.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 u}function c(n,e,t){if(t||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 l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var f,d={exports:{}},h={};d.exports=function(){if(f)return h;f=1;var e=n,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function a(n,e,r){var a,c={},l=null,s=null;for(a in void 0!==r&&(l=""+r),void 0!==e.key&&(l=""+e.key),void 0!==e.ref&&(s=e.ref),e)o.call(e,a)&&!u.hasOwnProperty(a)&&(c[a]=e[a]);if(n&&n.defaultProps)for(a in e=n.defaultProps)void 0===c[a]&&(c[a]=e[a]);return{$$typeof:t,type:n,key:l,ref:s,props:c,_owner:i.current}}return h.Fragment=r,h.jsx=a,h.jsxs=a,h}();var v,p=d.exports,g={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
- h=p,function(){var e={}.hasOwnProperty;function n(){for(var e="",n=0;n<arguments.length;n++){var o=arguments[n];o&&(e=r(e,t(o)))}return e}function t(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var o="";for(var i in t)e.call(t,i)&&t[i]&&(o=r(o,i));return o}function r(e,n){return n?e?e+" "+n:e+n:e}h.exports?(n.default=n,h.exports=n):window.classNames=n}();var g,y,m,x=s(p.exports),w={exports:{}},b={},_={exports:{}},E={};function S(){return y||(y=1,_.exports=function(){if(g)return E;g=1;var n=e,t="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},r=n.useState,o=n.useEffect,i=n.useLayoutEffect,a=n.useDebugValue;function u(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!t(e,r)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,n){return n()}:function(e,n){var t=n(),c=r({inst:{value:t,getSnapshot:n}}),s=c[0].inst,l=c[1];return i((function(){s.value=t,s.getSnapshot=n,u(s)&&l({inst:s})}),[e,t,n]),o((function(){return u(s)&&l({inst:s}),e((function(){u(s)&&l({inst:s})}))}),[e]),a(t),t};return E.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c,E}()),_.exports}
7
+ v=g,function(){var n={}.hasOwnProperty;function e(){for(var n="",e=0;e<arguments.length;e++){var o=arguments[e];o&&(n=r(n,t(o)))}return n}function t(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return e.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var o="";for(var i in t)n.call(t,i)&&t[i]&&(o=r(o,i));return o}function r(n,e){return e?n?n+" "+e:n+e:n}v.exports?(e.default=e,v.exports=e):window.classNames=e}();var y,m,x,w=s(g.exports),b={exports:{}},_={},E={exports:{}},S={};function k(){return m||(m=1,E.exports=function(){if(y)return S;y=1;var e=n,t="function"==typeof Object.is?Object.is:function(n,e){return n===e&&(0!==n||1/n==1/e)||n!=n&&e!=e},r=e.useState,o=e.useEffect,i=e.useLayoutEffect,u=e.useDebugValue;function a(n){var e=n.getSnapshot;n=n.value;try{var r=e();return!t(n,r)}catch(n){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(n,e){return e()}:function(n,e){var t=e(),c=r({inst:{value:t,getSnapshot:e}}),l=c[0].inst,s=c[1];return i((function(){l.value=t,l.getSnapshot=e,a(l)&&s({inst:l})}),[n,t,e]),o((function(){return a(l)&&s({inst:l}),n((function(){a(l)&&s({inst:l})}))}),[n]),u(t),t};return S.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,S}()),E.exports}
8
8
  /**
9
9
  * @license React
10
10
  * use-sync-external-store-shim/with-selector.production.min.js
@@ -13,5 +13,13 @@ h=p,function(){var e={}.hasOwnProperty;function n(){for(var e="",n=0;n<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
- */w.exports=function(){if(m)return b;m=1;var n=e,t=S(),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 b.useSyncExternalStoreWithSelector=function(e,n,t,s,l){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=u((function(){function e(e){if(!a){if(a=!0,o=e,e=s(e),void 0!==l&&f.hasValue){var n=f.value;if(l(n,e))return i=n}return i=e}if(n=i,r(o,e))return n;var t=s(e);return void 0!==l&&l(n,t)?n:(o=e,i=t)}var o,i,a=!1,u=void 0===t?null:t;return[function(){return e(n())},null===u?void 0:function(){return e(u())}]}),[n,t,s,l]);var h=o(e,d[0],d[1]);return a((function(){f.hasValue=!0,f.value=h}),[h]),c(h),h},b}();var k=s(w.exports);const C=e=>{let n;const t=new Set,r=(e,r)=>{const o="function"==typeof e?e(n):e;if(!Object.is(o,n)){const e=n;n=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},n,o),t.forEach((t=>t(n,e)))}},o=()=>n,i={setState:r,getState:o,getInitialState:()=>a,subscribe:e=>(t.add(e),()=>t.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},a=n=e(r,o,i);return i},{useDebugValue:M}=e,{useSyncExternalStoreWithSelector:N}=k,P=e=>e;function O(e,n=P,t){const r=N(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,t);return M(r),r}const j=(e,n)=>{const t=(e=>e?C(e):C)(e),r=(e,r=n)=>O(t,e,r);return Object.assign(r,t),r};var I=e.createContext(null),A=I.Provider,z=function(){return z=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},z.apply(this,arguments)};function T(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 L(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 B(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 D,R,V,H,Y,X,Z,F,U,W,G,q,$,K,Q,J,ee,ne,te,re,oe,ie,ae,ue,ce,se,le,de,fe,he,ve,pe,ge,ye,me,xe,we,be,_e,Ee,Se,ke,Ce,Me,Ne,Pe,Oe,je,Ie,Ae,ze,Te,Le,Be,De,Re,Ve,He,Ye,Xe,Ze,Fe,Ue,We,Ge,qe,$e,Ke,Qe,Je,en,nn,tn,rn,on,an,un,cn,sn,ln,dn,fn,hn,vn,pn,gn,yn,mn,xn,wn,bn,_n,En,Sn,kn,Cn,Mn,Nn,Pn,On,jn,In,An,zn,Tn,Ln,Bn,Dn,Rn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Vn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Hn(){return H?V:(H=1,V=function(e,n){return e===n||e!=e&&n!=n})}function Yn(){if(X)return Y;X=1;var e=Hn();return Y=function(n,t){for(var r=n.length;r--;)if(e(n[r][0],t))return r;return-1},Y}function Xn(){if(J)return Q;J=1;var e=R?D:(R=1,D=function(){this.__data__=[],this.size=0}),n=function(){if(F)return Z;F=1;var e=Yn(),n=Array.prototype.splice;return Z=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(W)return U;W=1;var e=Yn();return U=function(n){var t=this.__data__,r=e(t,n);return r<0?void 0:t[r][1]}}(),r=function(){if(q)return G;q=1;var e=Yn();return G=function(n){return e(this.__data__,n)>-1}}(),o=function(){if(K)return $;K=1;var e=Yn();return $=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,Q=i}function Zn(){if(se)return ce;se=1;var e="object"==typeof Rn&&Rn&&Rn.Object===Object&&Rn;return ce=e}function Fn(){if(de)return le;de=1;var e=Zn(),n="object"==typeof self&&self&&self.Object===Object&&self,t=e||n||Function("return this")();return le=t}function Un(){if(he)return fe;he=1;var e=Fn().Symbol;return fe=e}function Wn(){if(xe)return me;xe=1;var e=Un(),n=function(){if(pe)return ve;pe=1;var e=Un(),n=Object.prototype,t=n.hasOwnProperty,r=n.toString,o=e?e.toStringTag:void 0;return ve=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(ye)return ge;ye=1;var e=Object.prototype.toString;return ge=function(n){return e.call(n)}}(),r=e?e.toStringTag:void 0;return me=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?n(e):t(e)}}function Gn(){return be?we:(be=1,we=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)})}function qn(){if(Ee)return _e;Ee=1;var e=Wn(),n=Gn();return _e=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 $n(){if(Pe)return Ne;Pe=1;var e=Function.prototype.toString;return Ne=function(n){if(null!=n){try{return e.call(n)}catch(e){}try{return n+""}catch(e){}}return""}}function Kn(){if(Te)return ze;Te=1;var e=function(){if(je)return Oe;je=1;var e=qn(),n=function(){if(Me)return Ce;Me=1;var e,n=function(){if(ke)return Se;ke=1;var e=Fn()["__core-js_shared__"];return Se=e}(),t=(e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return Ce=function(e){return!!t&&t in e}}(),t=Gn(),r=$n(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,u=i.toString,c=a.hasOwnProperty,s=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Oe=function(i){return!(!t(i)||n(i))&&(e(i)?s:o).test(r(i))}}(),n=Ae?Ie:(Ae=1,Ie=function(e,n){return null==e?void 0:e[n]});return ze=function(t,r){var o=n(t,r);return e(o)?o:void 0}}function Qn(){if(Be)return Le;Be=1;var e=Kn()(Fn(),"Map");return Le=e}function Jn(){if(Re)return De;Re=1;var e=Kn()(Object,"create");return De=e}function et(){if(rn)return tn;rn=1;var e=nn?en:(nn=1,en=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e});return tn=function(n,t){var r=n.__data__;return e(t)?r["string"==typeof t?"string":"hash"]:r.map},tn}function nt(){if(vn)return hn;vn=1;var e=function(){if(Je)return Qe;Je=1;var e=function(){if(Ke)return $e;Ke=1;var e=function(){if(He)return Ve;He=1;var e=Jn();return Ve=function(){this.__data__=e?e(null):{},this.size=0}}(),n=Xe?Ye:(Xe=1,Ye=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}),t=function(){if(Fe)return Ze;Fe=1;var e=Jn(),n=Object.prototype.hasOwnProperty;return Ze=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(We)return Ue;We=1;var e=Jn(),n=Object.prototype.hasOwnProperty;return Ue=function(t){var r=this.__data__;return e?void 0!==r[t]:n.call(r,t)}}(),o=function(){if(qe)return Ge;qe=1;var e=Jn();return Ge=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,$e=i}(),n=Xn(),t=Qn();return Qe=function(){this.size=0,this.__data__={hash:new e,map:new(t||n),string:new e}}}(),n=function(){if(an)return on;an=1;var e=et();return on=function(n){var t=e(this,n).delete(n);return this.size-=t?1:0,t}}(),t=function(){if(cn)return un;cn=1;var e=et();return un=function(n){return e(this,n).get(n)}}(),r=function(){if(ln)return sn;ln=1;var e=et();return sn=function(n){return e(this,n).has(n)}}(),o=function(){if(fn)return dn;fn=1;var e=et();return dn=function(n,t){var r=e(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this},dn}();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,hn=i}function tt(){if(mn)return yn;mn=1;var e=Xn(),n=function(){if(ne)return ee;ne=1;var e=Xn();return ee=function(){this.__data__=new e,this.size=0}}(),t=re?te:(re=1,te=function(e){var n=this.__data__,t=n.delete(e);return this.size=n.size,t}),r=ie?oe:(ie=1,oe=function(e){return this.__data__.get(e)}),o=ue?ae:(ue=1,ae=function(e){return this.__data__.has(e)}),i=function(){if(gn)return pn;gn=1;var e=Xn(),n=Qn(),t=nt();return pn=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,yn=a}function rt(){return wn||(wn=1,xn=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r&&!1!==n(e[t],t,e););return e}),xn}function ot(){if(_n)return bn;_n=1;var e=Kn(),n=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch(e){}}();return bn=n}function it(){if(Sn)return En;Sn=1;var e=ot();return En=function(n,t,r){"__proto__"==t&&e?e(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}}function at(){if(Cn)return kn;Cn=1;var e=it(),n=Hn(),t=Object.prototype.hasOwnProperty;return kn=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 ut(){if(Nn)return Mn;Nn=1;var e=at(),n=it();return Mn=function(t,r,o,i){var a=!o;o||(o={});for(var u=-1,c=r.length;++u<c;){var s=r[u],l=i?i(o[s],t[s],s,o,t):void 0;void 0===l&&(l=t[s]),a?n(o,s,l):e(o,s,l)}return o}}function ct(){return In?jn:(In=1,jn=function(e){return null!=e&&"object"==typeof e})}function st(){if(Ln)return Tn;Ln=1;var e=function(){if(zn)return An;zn=1;var e=Wn(),n=ct();return An=function(t){return n(t)&&"[object Arguments]"==e(t)}}(),n=ct(),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 Tn=i}function lt(){if(Dn)return Bn;Dn=1;var e=Array.isArray;return Bn=e}var dt,ft,ht,vt,pt,gt,yt,mt,xt,wt,bt,_t={exports:{}};function Et(){return ht||(ht=1,function(e,n){var t=Fn(),r=ft?dt:(ft=1,dt=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}(_t,_t.exports)),_t.exports}function St(){if(pt)return vt;pt=1;var e=/^(?:0|[1-9]\d*)$/;return vt=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 kt(){return yt?gt:(yt=1,gt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991})}function Ct(){return bt?wt:(bt=1,wt=function(e){return function(n){return e(n)}})}_t.exports;var Mt,Nt,Pt,Ot,jt,It,At,zt,Tt,Lt,Bt,Dt,Rt,Vt,Ht,Yt,Xt,Zt,Ft,Ut,Wt,Gt,qt,$t,Kt,Qt,Jt,er={exports:{}};function nr(){return Mt||(Mt=1,e=er,n=er.exports,t=Zn(),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),er.exports;var e,n,t,r,o,i,a}function tr(){if(Pt)return Nt;Pt=1;var e=function(){if(xt)return mt;xt=1;var e=Wn(),n=kt(),t=ct(),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,mt=function(o){return t(o)&&n(o.length)&&!!r[e(o)]}}(),n=Ct(),t=nr(),r=t&&t.isTypedArray,o=r?n(r):e;return Nt=o}function rr(){if(jt)return Ot;jt=1;var e=On?Pn:(On=1,Pn=function(e,n){for(var t=-1,r=Array(e);++t<e;)r[t]=n(t);return r}),n=st(),t=lt(),r=Et(),o=St(),i=tr(),a=Object.prototype.hasOwnProperty;return Ot=function(u,c){var s=t(u),l=!s&&n(u),d=!s&&!l&&r(u),f=!s&&!l&&!d&&i(u),h=s||l||d||f,v=h?e(u.length,String):[],p=v.length;for(var g in u)!c&&!a.call(u,g)||h&&("length"==g||d&&("offset"==g||"parent"==g)||f&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||o(g,p))||v.push(g);return v},Ot}function or(){if(At)return It;At=1;var e=Object.prototype;return It=function(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||e)}}function ir(){return Tt||(Tt=1,zt=function(e,n){return function(t){return e(n(t))}}),zt}function ar(){if(Rt)return Dt;Rt=1;var e=or(),n=function(){if(Bt)return Lt;Bt=1;var e=ir()(Object.keys,Object);return Lt=e}(),t=Object.prototype.hasOwnProperty;return Dt=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 ur(){if(Ht)return Vt;Ht=1;var e=qn(),n=kt();return Vt=function(t){return null!=t&&n(t.length)&&!e(t)}}function cr(){if(Xt)return Yt;Xt=1;var e=rr(),n=ar(),t=ur();return Yt=function(r){return t(r)?e(r):n(r)}}function sr(){if(Kt)return $t;Kt=1;var e=rr(),n=function(){if(qt)return Gt;qt=1;var e=Gn(),n=or(),t=Wt?Ut:(Wt=1,Ut=function(e){var n=[];if(null!=e)for(var t in Object(e))n.push(t);return n}),r=Object.prototype.hasOwnProperty;return Gt=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=ur();return $t=function(r){return t(r)?e(r,!0):n(r)}}er.exports;var lr,dr,fr,hr,vr,pr,gr,yr,mr,xr,wr,br,_r,Er,Sr,kr,Cr,Mr,Nr,Pr,Or,jr,Ir,Ar,zr,Tr,Lr,Br,Dr,Rr,Vr,Hr,Yr,Xr,Zr,Fr,Ur,Wr,Gr,qr,$r,Kr,Qr,Jr,eo,no,to,ro,oo,io,ao,uo,co,so,lo,fo,ho,vo,po,go,yo,mo,xo,wo,bo,_o,Eo,So,ko,Co,Mo,No,Po,Oo,jo,Io,Ao,zo,To,Lo,Bo,Do,Ro,Vo,Ho,Yo,Xo,Zo,Fo,Uo,Wo,Go,qo,$o,Ko,Qo,Jo,ei,ni,ti,ri,oi,ii,ai,ui,ci,si,li,di,fi,hi,vi,pi,gi,yi,mi,xi,wi,bi,_i,Ei,Si,ki,Ci,Mi,Ni,Pi,Oi,ji,Ii,Ai,zi,Ti,Li,Bi,Di,Ri,Vi,Hi,Yi,Xi,Zi,Fi,Ui,Wi,Gi,qi,$i,Ki,Qi,Ji,ea,na,ta,ra,oa,ia,aa,ua,ca,sa,la,da,fa,ha,va,pa,ga,ya,ma,xa,wa,ba,_a,Ea,Sa,ka,Ca,Ma,Na,Pa,Oa,ja,Ia,Aa,za,Ta,La,Ba,Da,Ra,Va,Ha,Ya,Xa,Za,Fa,Ua,Wa,Ga,qa,$a,Ka,Qa,Ja,eu,nu,tu,ru,ou,iu,au,uu,cu,su,lu,du,fu,hu,vu,pu,gu,yu,mu,xu,wu,bu,_u,Eu,Su,ku,Cu,Mu,Nu,Pu,Ou,ju,Iu,Au,zu,Tu,Lu,Bu,Du,Ru,Vu,Hu,Yu,Xu,Zu,Fu,Uu,Wu,Gu,qu,$u,Ku,Qu,Ju,ec,nc,tc,rc,oc,ic,ac,uc,cc,sc,lc,dc,fc,hc,vc,pc,gc,yc,mc,xc,wc,bc={exports:{}};function _c(){return lr||(lr=1,function(e,n){var t=Fn(),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}}(bc,bc.exports)),bc.exports}function Ec(){return fr||(fr=1,dr=function(e,n){var t=-1,r=e.length;for(n||(n=Array(r));++t<r;)n[t]=e[t];return n}),dr}function Sc(){return vr||(vr=1,hr=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}),hr}function kc(){return gr?pr:(gr=1,pr=function(){return[]})}function Cc(){if(mr)return yr;mr=1;var e=Sc(),n=kc(),t=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return yr=r?function(n){return null==n?[]:(n=Object(n),e(r(n),(function(e){return t.call(n,e)})))}:n}function Mc(){return _r||(_r=1,br=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e}),br}function Nc(){if(Sr)return Er;Sr=1;var e=ir()(Object.getPrototypeOf,Object);return Er=e}function Pc(){if(Cr)return kr;Cr=1;var e=Mc(),n=Nc(),t=Cc(),r=kc(),o=Object.getOwnPropertySymbols;return kr=o?function(r){for(var o=[];r;)e(o,t(r)),r=n(r);return o}:r}function Oc(){if(Or)return Pr;Or=1;var e=Mc(),n=lt();return Pr=function(t,r,o){var i=r(t);return n(t)?i:e(i,o(t))}}function jc(){if(Ir)return jr;Ir=1;var e=Oc(),n=Cc(),t=cr();return jr=function(r){return e(r,t,n)}}function Ic(){if(Vr)return Rr;Vr=1;var e=Kn()(Fn(),"Set");return Rr=e}function Ac(){if(Zr)return Xr;Zr=1;var e=function(){if(Lr)return Tr;Lr=1;var e=Kn()(Fn(),"DataView");return Tr=e}(),n=Qn(),t=function(){if(Dr)return Br;Dr=1;var e=Kn()(Fn(),"Promise");return Br=e}(),r=Ic(),o=function(){if(Yr)return Hr;Yr=1;var e=Kn()(Fn(),"WeakMap");return Hr=e}(),i=Wn(),a=$n(),u="[object Map]",c="[object Promise]",s="[object Set]",l="[object WeakMap]",d="[object DataView]",f=a(e),h=a(n),v=a(t),p=a(r),g=a(o),y=i;return(e&&y(new e(new ArrayBuffer(1)))!=d||n&&y(new n)!=u||t&&y(t.resolve())!=c||r&&y(new r)!=s||o&&y(new o)!=l)&&(y=function(e){var n=i(e),t="[object Object]"==n?e.constructor:void 0,r=t?a(t):"";if(r)switch(r){case f:return d;case h:return u;case v:return c;case p:return s;case g:return l}return n}),Xr=y}function zc(){if(Gr)return Wr;Gr=1;var e=Fn().Uint8Array;return Wr=e}function Tc(){if($r)return qr;$r=1;var e=zc();return qr=function(n){var t=new n.constructor(n.byteLength);return new e(t).set(new e(n)),t}}function Lc(){if(oo)return ro;oo=1;var e=Tc();return ro=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}}function Bc(){if(co)return uo;co=1;var e=Gn(),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 uo=t}function Dc(){if(lo)return so;lo=1;var e=Bc(),n=Nc(),t=or();return so=function(r){return"function"!=typeof r.constructor||t(r)?{}:e(n(r))}}function Rc(){if(bo)return wo;bo=1;var e=tt(),n=rt(),t=at(),r=function(){if(Ft)return Zt;Ft=1;var e=ut(),n=cr();return Zt=function(t,r){return t&&e(r,n(r),t)}}(),o=function(){if(Jt)return Qt;Jt=1;var e=ut(),n=sr();return Qt=function(t,r){return t&&e(r,n(r),t)}}(),i=_c(),a=Ec(),u=function(){if(wr)return xr;wr=1;var e=ut(),n=Cc();return xr=function(t,r){return e(t,n(t),r)}}(),c=function(){if(Nr)return Mr;Nr=1;var e=ut(),n=Pc();return Mr=function(t,r){return e(t,n(t),r)}}(),s=jc(),l=function(){if(zr)return Ar;zr=1;var e=Oc(),n=Pc(),t=sr();return Ar=function(r){return e(r,t,n)}}(),d=Ac(),f=function(){if(Ur)return Fr;Ur=1;var e=Object.prototype.hasOwnProperty;return Fr=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},Fr}(),h=function(){if(ao)return io;ao=1;var e=Tc(),n=function(){if(Qr)return Kr;Qr=1;var e=Tc();return Kr=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}}(),t=function(){if(eo)return Jr;eo=1;var e=/\w*$/;return Jr=function(n){var t=new n.constructor(n.source,e.exec(n));return t.lastIndex=n.lastIndex,t}}(),r=function(){if(to)return no;to=1;var e=Un(),n=e?e.prototype:void 0,t=n?n.valueOf:void 0;return no=function(e){return t?Object(t.call(e)):{}}}(),o=Lc();return io=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=Dc(),p=lt(),g=Et(),y=function(){if(po)return vo;po=1;var e=function(){if(ho)return fo;ho=1;var e=Ac(),n=ct();return fo=function(t){return n(t)&&"[object Map]"==e(t)}}(),n=Ct(),t=nr(),r=t&&t.isMap,o=r?n(r):e;return vo=o}(),m=Gn(),x=function(){if(xo)return mo;xo=1;var e=function(){if(yo)return go;yo=1;var e=Ac(),n=ct();return go=function(t){return n(t)&&"[object Set]"==e(t)}}(),n=Ct(),t=nr(),r=t&&t.isSet,o=r?n(r):e;return mo=o}(),w=cr(),b=sr(),_="[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,wo=function C(M,N,P,O,j,I){var A,z=1&N,T=2&N,L=4&N;if(P&&(A=j?P(M,O,j,I):P(M)),void 0!==A)return A;if(!m(M))return M;var B=p(M);if(B){if(A=f(M),!z)return a(M,A)}else{var D=d(M),R=D==E||"[object GeneratorFunction]"==D;if(g(M))return i(M,z);if(D==S||D==_||R&&!j){if(A=T||R?{}:v(M),!z)return T?c(M,o(A,M)):u(M,r(A,M))}else{if(!k[D])return j?M:{};A=h(M,D,z)}}I||(I=new e);var V=I.get(M);if(V)return V;I.set(M,A),x(M)?M.forEach((function(e){A.add(C(e,N,P,e,M,I))})):y(M)&&M.forEach((function(e,n){A.set(n,C(e,N,P,n,M,I))}));var H=B?void 0:(L?T?l:s:T?b:w)(M);return n(H||M,(function(e,n){H&&(e=M[n=e]),t(A,n,C(e,N,P,n,M,I))})),A},wo}function Vc(){if(Eo)return _o;Eo=1;var e=Rc();return _o=function(n){return e(n,4)}}function Hc(){return ko?So:(ko=1,So=function(e){return function(){return e}})}function Yc(){if(Po)return No;Po=1;var e=(Mo?Co:(Mo=1,Co=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 No=e}function Xc(){if(jo)return Oo;jo=1;var e=Yc(),n=cr();return Oo=function(t,r){return t&&e(t,r,n)}}function Zc(){if(To)return zo;To=1;var e=Xc(),n=function(){if(Ao)return Io;Ao=1;var e=ur();return Io=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 zo=t}function Fc(){return Bo?Lo:(Bo=1,Lo=function(e){return e})}function Uc(){if(Ro)return Do;Ro=1;var e=Fc();return Do=function(n){return"function"==typeof n?n:e}}function Wc(){if(Ho)return Vo;Ho=1;var e=rt(),n=Zc(),t=Uc(),r=lt();return Vo=function(o,i){return(r(o)?e:n)(o,t(i))}}function Gc(){return Xo?Yo:(Xo=1,Yo=Wc())}function qc(){if(Ko)return $o;Ko=1;var e=nt(),n=Wo?Uo:(Wo=1,Uo=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),t=qo?Go:(qo=1,Go=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,$o=r}function $c(){return ni?ei:(ni=1,ei=function(e,n){return e.has(n)})}function Kc(){if(ri)return ti;ri=1;var e=qc(),n=(Jo||(Jo=1,Qo=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}),Qo),t=$c();return ti=function(r,o,i,a,u,c){var s=1&i,l=r.length,d=o.length;if(l!=d&&!(s&&d>l))return!1;var f=c.get(r),h=c.get(o);if(f&&h)return f==o&&h==r;var v=-1,p=!0,g=2&i?new e:void 0;for(c.set(r,o),c.set(o,r);++v<l;){var y=r[v],m=o[v];if(a)var x=s?a(m,y,v,o,r,c):a(y,m,v,r,o,c);if(void 0!==x){if(x)continue;p=!1;break}if(g){if(!n(o,(function(e,n){if(!t(g,n)&&(y===e||u(y,e,i,a,c)))return g.push(n)}))){p=!1;break}}else if(y!==m&&!u(y,m,i,a,c)){p=!1;break}}return c.delete(r),c.delete(o),p},ti}function Qc(){return ui||(ui=1,ai=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e){t[++n]=e})),t}),ai}function Jc(){if(hi)return fi;hi=1;var e=tt(),n=Kc(),t=function(){if(si)return ci;si=1;var e=Un(),n=zc(),t=Hn(),r=Kc(),o=(ii||(ii=1,oi=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e,r){t[++n]=[r,e]})),t}),oi),i=Qc(),a=e?e.prototype:void 0,u=a?a.valueOf:void 0;return ci=function(e,a,c,s,l,d,f){switch(c){case"[object DataView]":if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=a.byteLength||!d(new n(e),new n(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return t(+e,+a);case"[object Error]":return e.name==a.name&&e.message==a.message;case"[object RegExp]":case"[object String]":return e==a+"";case"[object Map]":var h=o;case"[object Set]":var v=1&s;if(h||(h=i),e.size!=a.size&&!v)return!1;var p=f.get(e);if(p)return p==a;s|=2,f.set(e,a);var g=r(h(e),h(a),s,l,d,f);return f.delete(e),g;case"[object Symbol]":if(u)return u.call(e)==u.call(a)}return!1}}(),r=function(){if(di)return li;di=1;var e=jc(),n=Object.prototype.hasOwnProperty;return li=function(t,r,o,i,a,u){var c=1&o,s=e(t),l=s.length;if(l!=e(r).length&&!c)return!1;for(var d=l;d--;){var f=s[d];if(!(c?f in r:n.call(r,f)))return!1}var h=u.get(t),v=u.get(r);if(h&&v)return h==r&&v==t;var p=!0;u.set(t,r),u.set(r,t);for(var g=c;++d<l;){var y=t[f=s[d]],m=r[f];if(i)var x=c?i(m,y,f,r,t,u):i(y,m,f,t,r,u);if(!(void 0===x?y===m||a(y,m,o,i,u):x)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var w=t.constructor,b=r.constructor;w==b||!("constructor"in t)||!("constructor"in r)||"function"==typeof w&&w instanceof w&&"function"==typeof b&&b instanceof b||(p=!1)}return u.delete(t),u.delete(r),p}}(),o=Ac(),i=lt(),a=Et(),u=tr(),c="[object Arguments]",s="[object Array]",l="[object Object]",d=Object.prototype.hasOwnProperty;return fi=function(f,h,v,p,g,y){var m=i(f),x=i(h),w=m?s:o(f),b=x?s:o(h),_=(w=w==c?l:w)==l,E=(b=b==c?l:b)==l,S=w==b;if(S&&a(f)){if(!a(h))return!1;m=!0,_=!1}if(S&&!_)return y||(y=new e),m||u(f)?n(f,h,v,p,g,y):t(f,h,w,v,p,g,y);if(!(1&v)){var k=_&&d.call(f,"__wrapped__"),C=E&&d.call(h,"__wrapped__");if(k||C){var M=k?f.value():f,N=C?h.value():h;return y||(y=new e),g(M,N,v,p,y)}}return!!S&&(y||(y=new e),r(f,h,v,p,g,y))}}function es(){if(pi)return vi;pi=1;var e=Jc(),n=ct();return vi=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))},vi}function ns(){if(xi)return mi;xi=1;var e=Gn();return mi=function(n){return n==n&&!e(n)}}function ts(){return Ei?_i:(Ei=1,_i=function(e,n){return function(t){return null!=t&&t[e]===n&&(void 0!==n||e in Object(t))}})}function rs(){if(Mi)return Ci;Mi=1;var e=Wn(),n=ct();return Ci=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==e(t)}}function os(){if(Pi)return Ni;Pi=1;var e=lt(),n=rs(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return Ni=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 is(){return Bi||(Bi=1,Li=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}),Li}function as(){if(Hi)return Vi;Hi=1;var e=function(){if(Ri)return Di;Ri=1;var e=Un(),n=is(),t=lt(),r=rs(),o=e?e.prototype:void 0,i=o?o.toString:void 0;return Di=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},Di}();return Vi=function(n){return null==n?"":e(n)}}function us(){if(Xi)return Yi;Xi=1;var e=lt(),n=os(),t=function(){if(Ti)return zi;Ti=1;var e=function(){if(Ai)return Ii;Ai=1;var e=function(){if(ji)return Oi;ji=1;var e=nt();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,Oi=n}();return Ii=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 zi=r}(),r=as();return Yi=function(o,i){return e(o)?o:n(o,i)?[o]:t(r(o))}}function cs(){if(Fi)return Zi;Fi=1;var e=rs();return Zi=function(n){if("string"==typeof n||e(n))return n;var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}}function ss(){if(Wi)return Ui;Wi=1;var e=us(),n=cs();return Ui=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 ls(){if(Ji)return Qi;Ji=1;var e=us(),n=st(),t=lt(),r=St(),o=kt(),i=cs();return Qi=function(a,u,c){for(var s=-1,l=(u=e(u,a)).length,d=!1;++s<l;){var f=i(u[s]);if(!(d=null!=a&&c(a,f)))break;a=a[f]}return d||++s!=l?d:!!(l=null==a?0:a.length)&&o(l)&&r(f,l)&&(t(a)||n(a))}}function ds(){if(na)return ea;na=1;var e=Ki?$i:(Ki=1,$i=function(e,n){return null!=e&&n in Object(e)}),n=ls();return ea=function(t,r){return null!=t&&n(t,r,e)}}function fs(){return ia?oa:(ia=1,oa=function(e){return function(n){return null==n?void 0:n[e]}})}function hs(){if(da)return la;da=1;var e=function(){if(ki)return Si;ki=1;var e=function(){if(yi)return gi;yi=1;var e=tt(),n=es();return gi=function(t,r,o,i){var a=o.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var s=o[a];if(c&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++a<u;){var l=(s=o[a])[0],d=t[l],f=s[1];if(c&&s[2]){if(void 0===d&&!(l in t))return!1}else{var h=new e;if(i)var v=i(d,f,l,t,r,h);if(!(void 0===v?n(f,d,3,i,h):v))return!1}}return!0}}(),n=function(){if(bi)return wi;bi=1;var e=ns(),n=cr();return wi=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=ts();return Si=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(ra)return ta;ra=1;var e=es(),n=function(){if(qi)return Gi;qi=1;var e=ss();return Gi=function(n,t,r){var o=null==n?void 0:e(n,t);return void 0===o?r:o}}(),t=ds(),r=os(),o=ns(),i=ts(),a=cs();return ta=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=Fc(),r=lt(),o=function(){if(sa)return ca;sa=1;var e=fs(),n=function(){if(ua)return aa;ua=1;var e=ss();return aa=function(n){return function(t){return e(t,n)}}}(),t=os(),r=cs();return ca=function(o){return t(o)?e(r(o)):n(o)}}();return la=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 vs(){if(ha)return fa;ha=1;var e=Sc(),n=function(){if(Fo)return Zo;Fo=1;var e=Zc();return Zo=function(n,t){var r=[];return e(n,(function(e,n,o){t(e,n,o)&&r.push(e)})),r}}(),t=hs(),r=lt();return fa=function(o,i){return(r(o)?e:n)(o,t(i,3))}}function ps(){if(ya)return ga;ya=1;var e=function(){if(pa)return va;pa=1;var e=Object.prototype.hasOwnProperty;return va=function(n,t){return null!=n&&e.call(n,t)}}(),n=ls();return ga=function(t,r){return null!=t&&n(t,r,e)}}function gs(){if(xa)return ma;xa=1;var e=ar(),n=Ac(),t=st(),r=lt(),o=ur(),i=Et(),a=or(),u=tr(),c=Object.prototype.hasOwnProperty;return ma=function(s){if(null==s)return!0;if(o(s)&&(r(s)||"string"==typeof s||"function"==typeof s.splice||i(s)||u(s)||t(s)))return!s.length;var l=n(s);if("[object Map]"==l||"[object Set]"==l)return!s.size;if(a(s))return!e(s).length;for(var d in s)if(c.call(s,d))return!1;return!0}}function ys(){return ba?wa:(ba=1,wa=function(e){return void 0===e})}function ms(){if(Ea)return _a;Ea=1;var e=Zc(),n=ur();return _a=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 xs(){if(ka)return Sa;ka=1;var e=is(),n=hs(),t=ms(),r=lt();return Sa=function(o,i){return(r(o)?e:t)(o,n(i,3))}}function ws(){if(ja)return Oa;ja=1;var e=(Ma||(Ma=1,Ca=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}),Ca),n=Zc(),t=hs(),r=Pa?Na:(Pa=1,Na=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=lt();return Oa=function(i,a,u){var c=o(i)?e:r,s=arguments.length<3;return c(i,t(a,4),u,s,n)},Oa}function bs(){if(Xa)return Ya;Xa=1;var e=ar(),n=Ac(),t=ur(),r=function(){if(Aa)return Ia;Aa=1;var e=Wn(),n=lt(),t=ct();return Ia=function(r){return"string"==typeof r||!n(r)&&t(r)&&"[object String]"==e(r)}}(),o=function(){if(Ha)return Va;Ha=1;var e=function(){if(Ta)return za;Ta=1;var e=fs()("length");return za=e}(),n=function(){if(Ba)return La;Ba=1;var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return La=function(n){return e.test(n)}}(),t=function(){if(Ra)return Da;Ra=1;var e="\\ud800-\\udfff",n="["+e+"]",t="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",o="[^"+e+"]",i="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+t+"|"+r+")?",c="[\\ufe0e\\ufe0f]?",s=c+u+"(?:\\u200d(?:"+[o,i,a].join("|")+")"+c+u+")*",l="(?:"+[o+t+"?",t,i,a,n].join("|")+")",d=RegExp(r+"(?="+r+")|"+l+s,"g");return Da=function(e){for(var n=d.lastIndex=0;d.test(e);)++n;return n}}();return Va=function(r){return n(r)?t(r):e(r)}}();return Ya=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 _s(){if(Fa)return Za;Fa=1;var e=rt(),n=Bc(),t=Xc(),r=hs(),o=Nc(),i=lt(),a=Et(),u=qn(),c=Gn(),s=tr();return Za=function(l,d,f){var h=i(l),v=h||a(l)||s(l);if(d=r(d,4),null==f){var p=l&&l.constructor;f=v?h?new p:[]:c(l)&&u(p)?n(o(l)):{}}return(v?e:t)(l,(function(e,n,t){return d(f,e,n,t)})),f}}function Es(){if(qa)return Ga;qa=1;var e=Mc(),n=function(){if(Wa)return Ua;Wa=1;var e=Un(),n=st(),t=lt(),r=e?e.isConcatSpreadable:void 0;return Ua=function(e){return t(e)||n(e)||!!(r&&e&&e[r])}}();return Ga=function t(r,o,i,a,u){var c=-1,s=r.length;for(i||(i=n),u||(u=[]);++c<s;){var l=r[c];o>0&&i(l)?o>1?t(l,o-1,i,a,u):e(u,l):a||(u[u.length]=l)}return u},Ga}function Ss(){if(Ja)return Qa;Ja=1;var e=Ka?$a:(Ka=1,$a=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 Qa=function(t,r,o){return r=n(void 0===r?t.length-1:r,0),function(){for(var i=arguments,a=-1,u=n(i.length-r,0),c=Array(u);++a<u;)c[a]=i[r+a];a=-1;for(var s=Array(r+1);++a<r;)s[a]=i[a];return s[r]=o(c),e(t,this,s)}},Qa}function ks(){if(iu)return ou;iu=1;var e=function(){if(nu)return eu;nu=1;var e=Hc(),n=ot(),t=Fc();return eu=n?function(t,r){return n(t,"toString",{configurable:!0,enumerable:!1,value:e(r),writable:!0})}:t}(),n=function(){if(ru)return tu;ru=1;var e=Date.now;return tu=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)}},tu}(),t=n(e);return ou=t}function Cs(){if(uu)return au;uu=1;var e=Fc(),n=Ss(),t=ks();return au=function(r,o){return t(n(r,o,e),r+"")},au}function Ms(){return su||(su=1,cu=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}),cu}function Ns(){if(ku)return Su;ku=1;var e=qc(),n=function(){if(yu)return gu;yu=1;var e=function(){if(pu)return vu;pu=1;var e=Ms(),n=du?lu:(du=1,lu=function(e){return e!=e}),t=(hu||(hu=1,fu=function(e,n,t){for(var r=t-1,o=e.length;++r<o;)if(e[r]===n)return r;return-1}),fu);return vu=function(r,o,i){return o==o?t(r,o,i):e(r,n,i)},vu}();return gu=function(n,t){return!(null==n||!n.length)&&e(n,t,0)>-1},gu}(),t=(xu||(xu=1,mu=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}),mu),r=$c(),o=function(){if(Eu)return _u;Eu=1;var e=Ic(),n=bu?wu:(bu=1,wu=function(){}),t=Qc(),r=e&&1/t(new e([,-0]))[1]==1/0?function(n){return new e(n)}:n;return _u=r}(),i=Qc();return Su=function(a,u,c){var s=-1,l=n,d=a.length,f=!0,h=[],v=h;if(c)f=!1,l=t;else if(d>=200){var p=u?null:o(a);if(p)return i(p);f=!1,l=r,v=new e}else v=u?[]:h;e:for(;++s<d;){var g=a[s],y=u?u(g):g;if(g=c||0!==g?g:0,f&&y==y){for(var m=v.length;m--;)if(v[m]===y)continue e;u&&v.push(y),h.push(g)}else l(v,y,c)||(v!==h&&v.push(y),h.push(g))}return h},Su}function Ps(){if(Mu)return Cu;Mu=1;var e=ur(),n=ct();return Cu=function(t){return n(t)&&e(t)}}function Os(){if(Pu)return Nu;Pu=1;var e=Es(),n=Cs(),t=Ns(),r=Ps(),o=n((function(n){return t(e(n,1,r,!0))}));return Nu=o}function js(){if(Au)return Iu;Au=1;var e=function(){if(ju)return Ou;ju=1;var e=is();return Ou=function(n,t){return e(t,(function(e){return n[e]}))}}(),n=cr();return Iu=function(t){return null==t?[]:e(t,n(t))}}function Is(){if(Tu)return zu;var e;Tu=1;try{e={clone:Vc(),constant:Hc(),each:Gc(),filter:vs(),has:ps(),isArray:lt(),isEmpty:gs(),isFunction:qn(),isUndefined:ys(),keys:cr(),map:xs(),reduce:ws(),size:bs(),transform:_s(),union:Os(),values:js()}}catch(e){}return e||(e=window._),zu=e}function As(){if(Bu)return Lu;Bu=1;var e=Is();Lu=o;var n="\0",t="\0",r="";function o(n){this._isDirected=!e.has(n,"directed")||n.directed,this._isMultigraph=!!e.has(n,"multigraph")&&n.multigraph,this._isCompound=!!e.has(n,"compound")&&n.compound,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[t]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function i(e,n){e[n]?e[n]++:e[n]=1}function a(e,n){--e[n]||delete e[n]}function u(t,o,i,a){var u=""+o,c=""+i;if(!t&&u>c){var s=u;u=c,c=s}return u+r+c+r+(e.isUndefined(a)?n:a)}function c(e,n){return u(e,n.v,n.w,n.name)}return o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(e){return this._label=e,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultNodeLabelFn=n,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._in[t])}))},o.prototype.sinks=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._out[t])}))},o.prototype.setNodes=function(n,t){var r=arguments,o=this;return e.each(n,(function(e){r.length>1?o.setNode(e,t):o.setNode(e)})),this},o.prototype.setNode=function(n,r){return e.has(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=r),this):(this._nodes[n]=arguments.length>1?r:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=t,this._children[n]={},this._children[t][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)},o.prototype.node=function(e){return this._nodes[e]},o.prototype.hasNode=function(n){return e.has(this._nodes,n)},o.prototype.removeNode=function(n){var t=this;if(e.has(this._nodes,n)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[n],this._isCompound&&(this._removeFromParentsChildList(n),delete this._parent[n],e.each(this.children(n),(function(e){t.setParent(e)})),delete this._children[n]),e.each(e.keys(this._in[n]),r),delete this._in[n],delete this._preds[n],e.each(e.keys(this._out[n]),r),delete this._out[n],delete this._sucs[n],--this._nodeCount}return this},o.prototype.setParent=function(n,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(r))r=t;else{for(var o=r+="";!e.isUndefined(o);o=this.parent(o))if(o===n)throw new Error("Setting "+r+" as parent of "+n+" would create a cycle");this.setNode(r)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=r,this._children[r][n]=!0,this},o.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},o.prototype.parent=function(e){if(this._isCompound){var n=this._parent[e];if(n!==t)return n}},o.prototype.children=function(n){if(e.isUndefined(n)&&(n=t),this._isCompound){var r=this._children[n];if(r)return e.keys(r)}else{if(n===t)return this.nodes();if(this.hasNode(n))return[]}},o.prototype.predecessors=function(n){var t=this._preds[n];if(t)return e.keys(t)},o.prototype.successors=function(n){var t=this._sucs[n];if(t)return e.keys(t)},o.prototype.neighbors=function(n){var t=this.predecessors(n);if(t)return e.union(t,this.successors(n))},o.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},o.prototype.filterNodes=function(n){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;e.each(this._nodes,(function(e,r){n(r)&&t.setNode(r,e)})),e.each(this._edgeObjs,(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))}));var o={};function i(e){var n=r.parent(e);return void 0===n||t.hasNode(n)?(o[e]=n,n):n in o?o[n]:i(n)}return this._isCompound&&e.each(t.nodes(),(function(e){t.setParent(e,i(e))})),t},o.prototype.setDefaultEdgeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultEdgeLabelFn=n,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(n,t){var r=this,o=arguments;return e.reduce(n,(function(e,n){return o.length>1?r.setEdge(e,n,t):r.setEdge(e,n),n})),this},o.prototype.setEdge=function(){var n,t,r,o,a=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(n=c.v,t=c.w,r=c.name,2===arguments.length&&(o=arguments[1],a=!0)):(n=c,t=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],a=!0)),n=""+n,t=""+t,e.isUndefined(r)||(r=""+r);var s=u(this._isDirected,n,t,r);if(e.has(this._edgeLabels,s))return a&&(this._edgeLabels[s]=o),this;if(!e.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(n),this.setNode(t),this._edgeLabels[s]=a?o:this._defaultEdgeLabelFn(n,t,r);var l=function(e,n,t,r){var o=""+n,i=""+t;if(!e&&o>i){var a=o;o=i,i=a}var u={v:o,w:i};return r&&(u.name=r),u}(this._isDirected,n,t,r);return n=l.v,t=l.w,Object.freeze(l),this._edgeObjs[s]=l,i(this._preds[t],n),i(this._sucs[n],t),this._in[t][s]=l,this._out[n][s]=l,this._edgeCount++,this},o.prototype.edge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t);return this._edgeLabels[r]},o.prototype.hasEdge=function(n,t,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,n,t,r);return e.has(this._edgeLabels,o)},o.prototype.removeEdge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t),o=this._edgeObjs[r];return o&&(e=o.v,n=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[n],e),a(this._sucs[e],n),delete this._in[n][r],delete this._out[e][r],this._edgeCount--),this},o.prototype.inEdges=function(n,t){var r=this._in[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.v===t})):o}},o.prototype.outEdges=function(n,t){var r=this._out[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.w===t})):o}},o.prototype.nodeEdges=function(e,n){var t=this.inEdges(e,n);if(t)return t.concat(this.outEdges(e,n))},Lu}function zs(){if(Xu)return Yu;Xu=1;var e=Is(),n=As();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 Yu={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 Ts(){if(Fu)return Zu;Fu=1;var e=Is();return Zu=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},Zu}function Ls(){if(Wu)return Uu;Wu=1;var e=Is();function n(){this._arr=[],this._keyIndices={}}return Uu=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},Uu}function Bs(){if(qu)return Gu;qu=1;var e=Is(),n=Ls();Gu=function(e,r,o,i){return function(e,t,r,o){var i,a,u={},c=new n,s=function(e){var n=e.v!==i?e.v:e.w,t=u[n],o=r(e),s=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);s<t.distance&&(t.distance=s,t.predecessor=i,c.decrease(n,s))};for(e.nodes().forEach((function(e){var n=e===t?0:Number.POSITIVE_INFINITY;u[e]={distance:n},c.add(e,n)}));c.size()>0&&(i=c.removeMin(),(a=u[i]).distance!==Number.POSITIVE_INFINITY);)o(i).forEach(s);return u}(e,String(r),o||t,i||function(n){return e.outEdges(n)})};var t=e.constant(1);return Gu}function Ds(){if(Ku)return $u;Ku=1;var e=Bs(),n=Is();return $u=function(t,r,o){return n.transform(t.nodes(),(function(n,i){n[i]=e(t,i,r,o)}),{})}}function Rs(){if(Ju)return Qu;Ju=1;var e=Is();return Qu=function(n){var t=0,r=[],o={},i=[];function a(u){var c=o[u]={onStack:!0,lowlink:t,index:t++};if(r.push(u),n.successors(u).forEach((function(n){e.has(o,n)?o[n].onStack&&(c.lowlink=Math.min(c.lowlink,o[n].index)):(a(n),c.lowlink=Math.min(c.lowlink,o[n].lowlink))})),c.lowlink===c.index){var s,l=[];do{s=r.pop(),o[s].onStack=!1,l.push(s)}while(u!==s);i.push(l)}}return n.nodes().forEach((function(n){e.has(o,n)||a(n)})),i},Qu}function Vs(){if(nc)return ec;nc=1;var e=Is(),n=Rs();return ec=function(t){return e.filter(n(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}}function Hs(){if(rc)return tc;rc=1;var e=Is();tc=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 tc}function Ys(){if(ic)return oc;ic=1;var e=Is();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 oc=n,n.CycleException=t,t.prototype=new Error,oc}function Xs(){if(uc)return ac;uc=1;var e=Ys();return ac=function(n){try{e(n)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}}function Zs(){if(sc)return cc;sc=1;var e=Is();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 cc=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},cc}function Fs(){if(dc)return lc;dc=1;var e=Zs();return lc=function(n,t){return e(n,t,"post")}}function Us(){if(hc)return fc;hc=1;var e=Zs();return fc=function(n,t){return e(n,t,"pre")}}function Ws(){if(pc)return vc;pc=1;var e=Is(),n=As(),t=Ls();return vc=function(r,o){var i,a=new n,u={},c=new t;function s(e){var n=e.v===i?e.w:e.v,t=c.priority(n);if(void 0!==t){var r=o(e);r<t&&(u[n]=i,c.decrease(n,r))}}if(0===r.nodeCount())return a;e.each(r.nodes(),(function(e){c.add(e,Number.POSITIVE_INFINITY),a.setNode(e)})),c.decrease(r.nodes()[0],0);for(var l=!1;c.size()>0;){if(i=c.removeMin(),e.has(u,i))a.setEdge(i,u[i]);else{if(l)throw new Error("Input graph is not connected: "+r);l=!0}r.nodeEdges(i).forEach(s)}return a},vc}bc.exports;try{wc=function(){if(xc)return mc;xc=1;var e=Hu?Vu:(Hu=1,Vu={Graph:As(),version:Ru?Du:(Ru=1,Du="2.1.8")});return mc={Graph:e.Graph,json:zs(),alg:yc?gc:(yc=1,gc={components:Ts(),dijkstra:Bs(),dijkstraAll:Ds(),findCycles:Vs(),floydWarshall:Hs(),isAcyclic:Xs(),postorder:Fs(),preorder:Us(),prim:Ws(),tarjan:Rs(),topsort:Ys()}),version:e.version}}()}catch(z){}wc||(wc=window.graphlib);var Gs,qs,$s,Ks,Qs,Js,el,nl,tl,rl,ol,il,al,ul,cl,sl,ll,dl,fl,hl,vl,pl,gl,yl,ml,xl,wl,bl,_l,El,Sl,kl,Cl,Ml,Nl,Pl,Ol,jl,Il,Al,zl,Tl,Ll,Bl,Dl,Rl,Vl,Hl,Yl,Xl,Zl,Fl,Ul,Wl,Gl,ql,$l,Kl,Ql,Jl,ed,nd,td,rd,od,id,ad,ud,cd,sd,ld,dd,fd,hd,vd,pd,gd,yd,md,xd,wd,bd,_d,Ed,Sd,kd,Cd,Md,Nd,Pd,Od,jd,Id,Ad=wc;function zd(){if(Ks)return $s;Ks=1;var e=Hn(),n=ur(),t=St(),r=Gn();return $s=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 Td(){if(sl)return cl;sl=1;var e=function(){if(ul)return al;ul=1;var e=function(){if(il)return ol;il=1;var e=function(){if(rl)return tl;rl=1;var e=/\s/;return tl=function(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}}(),n=/^\s+/;return ol=function(t){return t?t.slice(0,e(t)+1).replace(n,""):t}}(),n=Gn(),t=rs(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;return al=function(u){if("number"==typeof u)return u;if(t(u))return NaN;if(n(u)){var c="function"==typeof u.valueOf?u.valueOf():u;u=n(c)?c+"":c}if("string"!=typeof u)return 0===u?u:+u;u=e(u);var s=o.test(u);return s||i.test(u)?a(u.slice(2),s?2:8):r.test(u)?NaN:+u}}(),n=1/0;return cl=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 Ld(){if(yl)return gl;yl=1;var e=Es();return gl=function(n){return null!=n&&n.length?e(n,1):[]}}function Bd(){if(kl)return Sl;kl=1;var e=rs();return Sl=function(n,t,r){for(var o=-1,i=n.length;++o<i;){var a=n[o],u=t(a);if(null!=u&&(void 0===c?u==u&&!e(u):r(u,c)))var c=u,s=a}return s},Sl}function Dd(){if(jl)return Ol;jl=1;var e=it(),n=Hn();return Ol=function(t,r,o){(void 0!==o&&!n(t[r],o)||void 0===o&&!(r in t))&&e(t,r,o)}}function Rd(){return Tl?zl:(Tl=1,zl=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]})}function Vd(){return Wl?Ul:(Wl=1,Ul=function(e,n){return e<n})}function Hd(){if(Ed)return _d;Ed=1;var e=is(),n=ss(),t=hs(),r=ms(),o=(yd||(yd=1,gd=function(e,n){var t=e.length;for(e.sort(n);t--;)e[t]=e[t].value;return e}),gd),i=Ct(),a=function(){if(bd)return wd;bd=1;var e=function(){if(xd)return md;xd=1;var e=rs();return md=function(n,t){if(n!==t){var r=void 0!==n,o=null===n,i=n==n,a=e(n),u=void 0!==t,c=null===t,s=t==t,l=e(t);if(!c&&!l&&!a&&n>t||a&&u&&s&&!c&&!l||o&&u&&s||!r&&s||!i)return 1;if(!o&&!a&&!l&&n<t||l&&r&&i&&!o&&!a||c&&r&&i||!u&&i||!s)return-1}return 0}}();return wd=function(n,t,r){for(var o=-1,i=n.criteria,a=t.criteria,u=i.length,c=r.length;++o<u;){var s=e(i[o],a[o]);if(s)return o>=c?s:s*("desc"==r[o]?-1:1)}return n.index-t.index}}(),u=Fc(),c=lt();return _d=function(s,l,d){l=l.length?e(l,(function(e){return c(e)?function(t){return n(t,1===e.length?e[0]:e)}:e})):[u];var f=-1;l=e(l,i(t));var h=r(s,(function(n,t,r){return{criteria:e(l,(function(e){return e(n)})),index:++f,value:n}}));return o(h,(function(e,n){return a(e,n,d)}))}}try{Id={cloneDeep:function(){if(qs)return Gs;qs=1;var e=Rc();return Gs=function(n){return e(n,5)}}(),constant:Hc(),defaults:function(){if(Js)return Qs;Js=1;var e=Cs(),n=Hn(),t=zd(),r=sr(),o=Object.prototype,i=o.hasOwnProperty,a=e((function(e,a){e=Object(e);var u=-1,c=a.length,s=c>2?a[2]:void 0;for(s&&t(a[0],a[1],s)&&(c=1);++u<c;)for(var l=a[u],d=r(l),f=-1,h=d.length;++f<h;){var v=d[f],p=e[v];(void 0===p||n(p,o[v])&&!i.call(e,v))&&(e[v]=l[v])}return e}));return Qs=a}(),each:Gc(),filter:vs(),find:function(){if(pl)return vl;pl=1;var e=function(){if(nl)return el;nl=1;var e=hs(),n=ur(),t=cr();return el=function(r){return function(o,i,a){var u=Object(o);if(!n(o)){var c=e(i,3);o=t(o),i=function(e){return c(u[e],e,u)}}var s=r(o,i,a);return s>-1?u[c?o[s]:s]:void 0}}}(),n=e(function(){if(hl)return fl;hl=1;var e=Ms(),n=hs(),t=function(){if(dl)return ll;dl=1;var e=Td();return ll=function(n){var t=e(n),r=t%1;return t==t?r?t-r:t:0}}(),r=Math.max;return fl=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)},fl}());return vl=n}(),flatten:Ld(),forEach:Wc(),forIn:function(){if(xl)return ml;xl=1;var e=Yc(),n=Uc(),t=sr();return ml=function(r,o){return null==r?r:e(r,n(o),t)}}(),has:ps(),isUndefined:ys(),last:(bl||(bl=1,wl=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}),wl),map:xs(),mapValues:function(){if(El)return _l;El=1;var e=it(),n=Xc(),t=hs();return _l=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(Pl)return Nl;Pl=1;var e=Bd(),n=Ml?Cl:(Ml=1,Cl=function(e,n){return e>n}),t=Fc();return Nl=function(r){return r&&r.length?e(r,t,n):void 0},Nl}(),merge:function(){if(Fl)return Zl;Fl=1;var e=function(){if(Hl)return Vl;Hl=1;var e=tt(),n=Dd(),t=Yc(),r=function(){if(Rl)return Dl;Rl=1;var e=Dd(),n=_c(),t=Lc(),r=Ec(),o=Dc(),i=st(),a=lt(),u=Ps(),c=Et(),s=qn(),l=Gn(),d=function(){if(Al)return Il;Al=1;var e=Wn(),n=Nc(),t=ct(),r=Function.prototype,o=Object.prototype,i=r.toString,a=o.hasOwnProperty,u=i.call(Object);return Il=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=tr(),h=Rd(),v=function(){if(Bl)return Ll;Bl=1;var e=ut(),n=sr();return Ll=function(t){return e(t,n(t))}}();return Dl=function(p,g,y,m,x,w,b){var _=h(p,y),E=h(g,y),S=b.get(E);if(S)e(p,y,S);else{var k=w?w(_,E,y+"",p,g,b):void 0,C=void 0===k;if(C){var M=a(E),N=!M&&c(E),P=!M&&!N&&f(E);k=E,M||N||P?a(_)?k=_:u(_)?k=r(_):N?(C=!1,k=n(E,!0)):P?(C=!1,k=t(E,!0)):k=[]:d(E)||i(E)?(k=_,i(_)?k=v(_):l(_)&&!s(_)||(k=o(E))):C=!1}C&&(b.set(E,k),x(k,E,m,w,b),b.delete(E)),e(p,y,k)}}}(),o=Gn(),i=sr(),a=Rd();return Vl=function u(c,s,l,d,f){c!==s&&t(s,(function(t,i){if(f||(f=new e),o(t))r(c,s,i,l,u,d,f);else{var h=d?d(a(c,i),t,i+"",c,s,f):void 0;void 0===h&&(h=t),n(c,i,h)}}),i)},Vl}(),n=function(){if(Xl)return Yl;Xl=1;var e=Cs(),n=zd();return Yl=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 Zl=n}(),min:function(){if(ql)return Gl;ql=1;var e=Bd(),n=Vd(),t=Fc();return Gl=function(r){return r&&r.length?e(r,t,n):void 0},Gl}(),minBy:function(){if(Kl)return $l;Kl=1;var e=Bd(),n=hs(),t=Vd();return $l=function(r,o){return r&&r.length?e(r,n(o,2),t):void 0},$l}(),now:function(){if(Jl)return Ql;Jl=1;var e=Fn();return Ql=function(){return e.Date.now()}}(),pick:function(){if(sd)return cd;sd=1;var e=function(){if(id)return od;id=1;var e=function(){if(rd)return td;rd=1;var e=ss(),n=function(){if(nd)return ed;nd=1;var e=at(),n=us(),t=St(),r=Gn(),o=cs();return ed=function(i,a,u,c){if(!r(i))return i;for(var s=-1,l=(a=n(a,i)).length,d=l-1,f=i;null!=f&&++s<l;){var h=o(a[s]),v=u;if("__proto__"===h||"constructor"===h||"prototype"===h)return i;if(s!=d){var p=f[h];void 0===(v=c?c(p,h,f):void 0)&&(v=r(p)?p:t(a[s+1])?[]:{})}e(f,h,v),f=f[h]}return i}}(),t=us();return td=function(r,o,i){for(var a=-1,u=o.length,c={};++a<u;){var s=o[a],l=e(r,s);i(l,s)&&n(c,t(s,r),l)}return c}}(),n=ds();return od=function(t,r){return e(t,r,(function(e,r){return n(t,r)}))}}(),n=function(){if(ud)return ad;ud=1;var e=Ld(),n=Ss(),t=ks();return ad=function(r){return t(n(r,void 0,e),r+"")}}(),t=n((function(n,t){return null==n?{}:e(n,t)}));return cd=t}(),range:function(){if(pd)return vd;pd=1;var e=function(){if(hd)return fd;hd=1;var e=function(){if(dd)return ld;dd=1;var e=Math.ceil,n=Math.max;return ld=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},ld}(),n=zd(),t=Td();return fd=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)}},fd}()();return vd=e}(),reduce:ws(),sortBy:function(){if(kd)return Sd;kd=1;var e=Es(),n=Hd(),t=Cs(),r=zd(),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 Sd=o}(),uniqueId:function(){if(Md)return Cd;Md=1;var e=as(),n=0;return Cd=function(t){var r=++n;return e(t)+r},Cd}(),values:js(),zipObject:function(){if(jd)return Od;jd=1;var e=at(),n=(Pd||(Pd=1,Nd=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}),Nd);return Od=function(t,r){return n(t||[],r||[],e)},Od}()}}catch(z){}Id||(Id=window._);var Yd=Id,Xd=Zd;function Zd(){var e={};e._next=e._prev=e,this._sentinel=e}function Fd(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Ud(e,n){if("_next"!==e&&"_prev"!==e)return n}Zd.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return Fd(n),n},Zd.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&Fd(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},Zd.prototype.toString=function(){for(var e=[],n=this._sentinel,t=n._prev;t!==n;)e.push(JSON.stringify(t,Ud)),t=t._prev;return"["+e.join(", ")+"]"};var Wd=Yd,Gd=Ad.Graph,qd=Xd,$d=Wd.constant(1);function Kd(e,n,t,r,o){var i=o?[]:void 0;return Wd.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,Qd(n,t,u)})),Wd.forEach(e.outEdges(r.v),(function(r){var o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,Qd(n,t,a)})),e.removeNode(r.v),i}function Qd(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 Jd=Yd,ef=function(e,n){if(e.nodeCount()<=1)return[];var t=function(e,n){var t=new Gd,r=0,o=0;Wd.forEach(e.nodes(),(function(e){t.setNode(e,{v:e,in:0,out:0})})),Wd.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=Wd.range(o+r+3).map((function(){return new qd})),a=r+1;return Wd.forEach(t.nodes(),(function(e){Qd(i,a,t.node(e))})),{graph:t,buckets:i,zeroIdx:a}}(e,n||$d),r=function(e,n,t){for(var r,o=[],i=n[n.length-1],a=n[0];e.nodeCount();){for(;r=a.dequeue();)Kd(e,n,t,r);for(;r=i.dequeue();)Kd(e,n,t,r);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(r=n[u].dequeue()){o=o.concat(Kd(e,n,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return Wd.flatten(Wd.map(r,(function(n){return e.outEdges(n.v,n.w)})),!0)},nf={run:function(e){var n="greedy"===e.graph().acyclicer?ef(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],t={},r={};return Jd.forEach(e.nodes(),(function o(i){Jd.has(r,i)||(r[i]=!0,t[i]=!0,Jd.forEach(e.outEdges(i),(function(e){Jd.has(t,e.w)?n.push(e):o(e.w)})),delete t[i])})),n}(e);Jd.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,Jd.uniqueId("rev"))}))},undo:function(e){Jd.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)}}))}},tf=Yd,rf=Ad.Graph,of={addDummyNode:af,simplify:function(e){var n=(new rf).setGraph(e.graph());return tf.forEach(e.nodes(),(function(t){n.setNode(t,e.node(t))})),tf.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 rf({multigraph:e.isMultigraph()}).setGraph(e.graph());return tf.forEach(e.nodes(),(function(t){e.children(t).length||n.setNode(t,e.node(t))})),tf.forEach(e.edges(),(function(t){n.setEdge(t,e.edge(t))})),n},successorWeights:function(e){var n=tf.map(e.nodes(),(function(n){var t={};return tf.forEach(e.outEdges(n),(function(n){t[n.w]=(t[n.w]||0)+e.edge(n).weight})),t}));return tf.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=tf.map(e.nodes(),(function(n){var t={};return tf.forEach(e.inEdges(n),(function(n){t[n.v]=(t[n.v]||0)+e.edge(n).weight})),t}));return tf.zipObject(e.nodes(),n)},intersectRect:function(e,n){var t,r,o=e.x,i=e.y,a=n.x-o,u=n.y-i,c=e.width/2,s=e.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(u)*c>Math.abs(a)*s?(u<0&&(s=-s),t=s*a/u,r=s):(a<0&&(c=-c),t=c,r=c*u/a),{x:o+t,y:i+r}},buildLayerMatrix:function(e){var n=tf.map(tf.range(uf(e)+1),(function(){return[]}));return tf.forEach(e.nodes(),(function(t){var r=e.node(t),o=r.rank;tf.isUndefined(o)||(n[o][r.order]=t)})),n},normalizeRanks:function(e){var n=tf.min(tf.map(e.nodes(),(function(n){return e.node(n).rank})));tf.forEach(e.nodes(),(function(t){var r=e.node(t);tf.has(r,"rank")&&(r.rank-=n)}))},removeEmptyRanks:function(e){var n=tf.min(tf.map(e.nodes(),(function(n){return e.node(n).rank}))),t=[];tf.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;tf.forEach(t,(function(n,t){tf.isUndefined(n)&&t%o!=0?--r:r&&tf.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),af(e,"border",o,n)},maxRank:uf,partition:function(e,n){var t={lhs:[],rhs:[]};return tf.forEach(e,(function(e){n(e)?t.lhs.push(e):t.rhs.push(e)})),t},time:function(e,n){var t=tf.now();try{return n()}finally{console.log(e+" time: "+(tf.now()-t)+"ms")}},notime:function(e,n){return n()}};function af(e,n,t,r){var o;do{o=tf.uniqueId(r)}while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function uf(e){return tf.max(tf.map(e.nodes(),(function(n){var t=e.node(n).rank;if(!tf.isUndefined(t))return t})))}var cf=Yd,sf=of,lf={run:function(e){e.graph().dummyChains=[],cf.forEach(e.edges(),(function(n){!function(e,n){var t,r,o,i=n.v,a=e.node(i).rank,u=n.w,c=e.node(u).rank,s=n.name,l=e.edge(n),d=l.labelRank;if(c!==a+1){for(e.removeEdge(n),o=0,++a;a<c;++o,++a)l.points=[],r={width:0,height:0,edgeLabel:l,edgeObj:n,rank:a},t=sf.addDummyNode(e,"edge",r,"_d"),a===d&&(r.width=l.width,r.height=l.height,r.dummy="edge-label",r.labelpos=l.labelpos),e.setEdge(i,t,{weight:l.weight},s),0===o&&e.graph().dummyChains.push(t),i=t;e.setEdge(i,u,{weight:l.weight},s)}}(e,n)}))},undo:function(e){cf.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)}))}},df=Yd,ff=function(e){var n={};df.forEach(e.sources(),(function t(r){var o=e.node(r);if(df.has(n,r))return o.rank;n[r]=!0;var i=df.min(df.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}))},hf=function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen},vf=Yd,pf=Ad.Graph,gf=hf,yf=function(e){var n,t,r=new pf({directed:!1}),o=e.nodes()[0],i=e.nodeCount();for(r.setNode(o,{});mf(r,e)<i;)n=xf(r,e),t=r.hasNode(n.v)?gf(e,n):-gf(e,n),wf(r,e,t);return r};function mf(e,n){return vf.forEach(e.nodes(),(function t(r){vf.forEach(n.nodeEdges(r),(function(o){var i=o.v,a=r===i?o.w:i;e.hasNode(a)||gf(n,o)||(e.setNode(a,{}),e.setEdge(r,a,{}),t(a))}))})),e.nodeCount()}function xf(e,n){return vf.minBy(n.edges(),(function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return gf(n,t)}))}function wf(e,n,t){vf.forEach(e.nodes(),(function(e){n.node(e).rank+=t}))}var bf=Yd,_f=yf,Ef=hf,Sf=ff,kf=Ad.alg.preorder,Cf=Ad.alg.postorder,Mf=of.simplify,Nf=Pf;function Pf(e){e=Mf(e),Sf(e);var n,t=_f(e);for(If(t),Of(t,e);n=zf(t);)Lf(t,e,n,Tf(t,e,n))}function Of(e,n){var t=Cf(e,e.nodes());t=t.slice(0,t.length-1),bf.forEach(t,(function(t){!function(e,n,t){var r=e.node(t).parent;e.edge(t,r).cutvalue=jf(e,n,t)}(e,n,t)}))}function jf(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,bf.forEach(n.nodeEdges(t),(function(i){var u,c,s=i.v===t,l=s?i.w:i.v;if(l!==r){var d=s===o,f=n.edge(i).weight;if(a+=d?f:-f,u=t,c=l,e.hasEdge(u,c)){var h=e.edge(t,l).cutvalue;a+=d?-h:h}}})),a}function If(e,n){arguments.length<2&&(n=e.nodes()[0]),Af(e,{},1,n)}function Af(e,n,t,r,o){var i=t,a=e.node(r);return n[r]=!0,bf.forEach(e.neighbors(r),(function(o){bf.has(n,o)||(t=Af(e,n,t,o,r))})),a.low=i,a.lim=t++,o?a.parent=o:delete a.parent,t}function zf(e){return bf.find(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function Tf(e,n,t){var r=t.v,o=t.w;n.hasEdge(r,o)||(r=t.w,o=t.v);var i=e.node(r),a=e.node(o),u=i,c=!1;i.lim>a.lim&&(u=a,c=!0);var s=bf.filter(n.edges(),(function(n){return c===Bf(e,e.node(n.v),u)&&c!==Bf(e,e.node(n.w),u)}));return bf.minBy(s,(function(e){return Ef(n,e)}))}function Lf(e,n,t,r){var o=t.v,i=t.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),If(e),Of(e,n),function(e,n){var t=bf.find(e.nodes(),(function(e){return!n.node(e).parent})),r=kf(e,t);r=r.slice(1),bf.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 Bf(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}Pf.initLowLimValues=If,Pf.initCutValues=Of,Pf.calcCutValue=jf,Pf.leaveEdge=zf,Pf.enterEdge=Tf,Pf.exchangeEdges=Lf;var Df=ff,Rf=yf,Vf=Nf,Hf=Df;var Yf=Yd,Xf=Yd,Zf=of,Ff={run:function(e){var n=Zf.addDummyNode(e,"root",{},"_root"),t=function(e){var n={};function t(r,o){var i=e.children(r);i&&i.length&&Xf.forEach(i,(function(e){t(e,o+1)})),n[r]=o}return Xf.forEach(e.children(),(function(e){t(e,1)})),n}(e),r=Xf.max(Xf.values(t))-1,o=2*r+1;e.graph().nestingRoot=n,Xf.forEach(e.edges(),(function(n){e.edge(n).minlen*=o}));var i=function(e){return Xf.reduce(e.edges(),(function(n,t){return n+e.edge(t).weight}),0)}(e)+1;Xf.forEach(e.children(),(function(a){Uf(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,Xf.forEach(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}};function Uf(e,n,t,r,o,i,a){var u=e.children(a);if(u.length){var c=Zf.addBorderNode(e,"_bt"),s=Zf.addBorderNode(e,"_bb"),l=e.node(a);e.setParent(c,a),l.borderTop=c,e.setParent(s,a),l.borderBottom=s,Xf.forEach(u,(function(u){Uf(e,n,t,r,o,i,u);var l=e.node(u),d=l.borderTop?l.borderTop:u,f=l.borderBottom?l.borderBottom:u,h=l.borderTop?r:2*r,v=d!==f?1:o-i[a]+1;e.setEdge(c,d,{weight:h,minlen:v,nestingEdge:!0}),e.setEdge(f,s,{weight:h,minlen:v,nestingEdge:!0})})),e.parent(a)||e.setEdge(n,c,{weight:0,minlen:o+i[a]})}else a!==n&&e.setEdge(n,a,{weight:0,minlen:t})}var Wf=Yd,Gf=of;function qf(e,n,t,r,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],c=Gf.addDummyNode(e,"border",a,t);o[n][i]=c,e.setParent(c,r),u&&e.setEdge(u,c,{weight:1})}var $f=Yd,Kf={adjust:function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||Qf(e)},undo:function(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){$f.forEach(e.nodes(),(function(n){eh(e.node(n))})),$f.forEach(e.edges(),(function(n){var t=e.edge(n);$f.forEach(t.points,eh),$f.has(t,"y")&&eh(t)}))}(e),"lr"!==n&&"rl"!==n||(function(e){$f.forEach(e.nodes(),(function(n){nh(e.node(n))})),$f.forEach(e.edges(),(function(n){var t=e.edge(n);$f.forEach(t.points,nh),$f.has(t,"x")&&nh(t)}))}(e),Qf(e))}};function Qf(e){$f.forEach(e.nodes(),(function(n){Jf(e.node(n))})),$f.forEach(e.edges(),(function(n){Jf(e.edge(n))}))}function Jf(e){var n=e.width;e.width=e.height,e.height=n}function eh(e){e.y=-e.y}function nh(e){var n=e.x;e.x=e.y,e.y=n}var th=Yd,rh=Yd;function oh(e,n,t){for(var r=rh.zipObject(t,rh.map(t,(function(e,n){return n}))),o=rh.flatten(rh.map(n,(function(n){return rh.sortBy(rh.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=rh.map(new Array(a),(function(){return 0})),c=0;return rh.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 ih=Yd,ah=Yd,uh=Yd,ch=of;function sh(e,n,t){for(var r;n.length&&(r=uh.last(n)).i<=t;)n.pop(),e.push(r.vs),t++;return t}var lh=Yd,dh=Yd,fh=Ad.Graph,hh=Yd,vh=Yd,ph=function(e){var n={},t=th.filter(e.nodes(),(function(n){return!e.children(n).length})),r=th.max(th.map(t,(function(n){return e.node(n).rank}))),o=th.map(th.range(r+1),(function(){return[]}));var i=th.sortBy(t,(function(n){return e.node(n).rank}));return th.forEach(i,(function t(r){if(!th.has(n,r)){n[r]=!0;var i=e.node(r);o[i.rank].push(r),th.forEach(e.successors(r),t)}})),o},gh=function(e,n){for(var t=0,r=1;r<n.length;++r)t+=oh(e,n[r-1],n[r]);return t},yh=function e(n,t,r,o){var i=n.children(t),a=n.node(t),u=a?a.borderLeft:void 0,c=a?a.borderRight:void 0,s={};u&&(i=lh.filter(i,(function(e){return e!==u&&e!==c})));var l=function(e,n){return ih.map(n,(function(n){var t=e.inEdges(n);if(t.length){var r=ih.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);lh.forEach(l,(function(t){if(n.children(t.v).length){var i=e(n,t.v,r,o);s[t.v]=i,lh.has(i,"barycenter")&&(a=t,u=i,lh.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 ah.forEach(e,(function(e,n){var r=t[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};ah.isUndefined(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)})),ah.forEach(n.edges(),(function(e){var n=t[e.v],r=t[e.w];ah.isUndefined(n)||ah.isUndefined(r)||(r.indegree++,n.out.push(t[e.w]))})),function(e){var n=[];function t(e){return function(n){n.merged||(ah.isUndefined(n.barycenter)||ah.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),ah.forEach(o.in.reverse(),t(o)),ah.forEach(o.out,r(o))}return ah.map(ah.filter(n,(function(e){return!e.merged})),(function(e){return ah.pick(e,["vs","i","barycenter","weight"])}))}(ah.filter(t,(function(e){return!e.indegree})))}(l,r);!function(e,n){lh.forEach(e,(function(e){e.vs=lh.flatten(e.vs.map((function(e){return n[e]?n[e].vs:e})),!0)}))}(d,s);var f=function(e,n){var t,r=ch.partition(e,(function(e){return uh.has(e,"barycenter")})),o=r.lhs,i=uh.sortBy(r.rhs,(function(e){return-e.i})),a=[],u=0,c=0,s=0;o.sort((t=!!n,function(e,n){return e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i})),s=sh(a,i,s),uh.forEach(o,(function(e){s+=e.vs.length,a.push(e.vs),u+=e.barycenter*e.weight,c+=e.weight,s=sh(a,i,s)}));var l={vs:uh.flatten(a,!0)};return c&&(l.barycenter=u/c,l.weight=c),l}(d,o);if(u&&(f.vs=lh.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]);lh.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},mh=function(e,n,t){var r=function(e){for(var n;e.hasNode(n=dh.uniqueId("_root")););return n}(e),o=new fh({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(n){return e.node(n)}));return dh.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),dh.forEach(e[t](i),(function(n){var t=n.v===i?n.w:n.v,r=o.edge(t,i),a=dh.isUndefined(r)?0:r.weight;o.setEdge(t,i,{weight:e.edge(n).weight+a})})),dh.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))})),o},xh=Ad.Graph,wh=of;function bh(e,n,t){return vh.map(n,(function(n){return mh(e,n,t)}))}function _h(e,n){var t=new xh;vh.forEach(e,(function(e){var r=e.graph().root,o=yh(e,r,t,n);vh.forEach(o.vs,(function(n,t){e.node(n).order=t})),function(e,n,t){var r,o={};hh.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 Eh(e,n){vh.forEach(n,(function(n){vh.forEach(n,(function(n,t){e.node(n).order=t}))}))}var Sh=Yd,kh=Ad.Graph,Ch=of;function Mh(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 Nh(e,n,t){if(n>t){var r=n;n=t,t=r}return Sh.has(e[n],t)}var Ph=Yd,Oh=of,jh=function(e){var n,t=Ch.buildLayerMatrix(e),r=Sh.merge(function(e,n){var t={};return Sh.reduce(n,(function(n,r){var o=0,i=0,a=n.length,u=Sh.last(r);return Sh.forEach(r,(function(n,c){var s=function(e,n){if(e.node(n).dummy)return Sh.find(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),l=s?e.node(s).order:a;(s||n===u)&&(Sh.forEach(r.slice(i,c+1),(function(n){Sh.forEach(e.predecessors(n),(function(r){var i=e.node(r),a=i.order;!(a<o||l<a)||i.dummy&&e.node(n).dummy||Mh(t,r,n)}))})),i=c+1,o=l)})),r})),t}(e,t),function(e,n){var t={};function r(n,r,o,i,a){var u;Sh.forEach(Sh.range(r,o),(function(r){u=n[r],e.node(u).dummy&&Sh.forEach(e.predecessors(u),(function(n){var r=e.node(n);r.dummy&&(r.order<i||r.order>a)&&Mh(t,n,u)}))}))}return Sh.reduce(n,(function(n,t){var o,i=-1,a=0;return Sh.forEach(t,(function(u,c){if("border"===e.node(u).dummy){var s=e.predecessors(u);s.length&&(o=e.node(s[0]).order,r(t,a,c,i,o),a=c,i=o)}r(t,a,t.length,o,n.length)})),t})),t}(e,t)),o={};Sh.forEach(["u","d"],(function(i){n="u"===i?t:Sh.values(t).reverse(),Sh.forEach(["l","r"],(function(t){"r"===t&&(n=Sh.map(n,(function(e){return Sh.values(e).reverse()})));var a=("u"===i?e.predecessors:e.successors).bind(e),u=function(e,n,t,r){var o={},i={},a={};return Sh.forEach(n,(function(e){Sh.forEach(e,(function(e,n){o[e]=e,i[e]=e,a[e]=n}))})),Sh.forEach(n,(function(e){var n=-1;Sh.forEach(e,(function(e){var u=r(e);if(u.length){u=Sh.sortBy(u,(function(e){return a[e]}));for(var c=(u.length-1)/2,s=Math.floor(c),l=Math.ceil(c);s<=l;++s){var d=u[s];i[e]===e&&n<a[d]&&!Nh(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 kh,i=e.graph(),a=function(e,n,t){return function(r,o,i){var a,u=r.node(o),c=r.node(i),s=0;if(s+=u.width/2,Sh.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(s+=t?a:-a),a=0,s+=(u.dummy?n:e)/2,s+=(c.dummy?n:e)/2,s+=c.width/2,Sh.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(s+=t?a:-a),a=0,s}}(i.nodesep,i.edgesep,r);return Sh.forEach(n,(function(n){var r;Sh.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)),Sh.forEach(r,(function(e){i[e]=i[t[e]]})),i}(e,n,u.root,u.align,"r"===t);"r"===t&&(c=Sh.mapValues(c,(function(e){return-e}))),o[i+t]=c}))}));var i=function(e,n){return Sh.minBy(Sh.values(n),(function(n){var t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return Sh.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=Sh.values(n),r=Sh.min(t),o=Sh.max(t);Sh.forEach(["u","d"],(function(t){Sh.forEach(["l","r"],(function(i){var a,u=t+i,c=e[u];if(c!==n){var s=Sh.values(c);(a="l"===i?r-Sh.min(s):o-Sh.max(s))&&(e[u]=Sh.mapValues(c,(function(e){return e+a})))}}))}))}(o,i),function(e,n){return Sh.mapValues(e.ul,(function(t,r){if(n)return e[n.toLowerCase()][r];var o=Sh.sortBy(Sh.map(e,r));return(o[1]+o[2])/2}))}(o,e.graph().align)},Ih=Yd,Ah=nf,zh=lf,Th=function(e){switch(e.graph().ranker){case"network-simplex":default:!function(e){Vf(e)}(e);break;case"tight-tree":!function(e){Df(e),Rf(e)}(e);break;case"longest-path":Hf(e)}},Lh=of.normalizeRanks,Bh=function(e){var n=function(e){var n={},t=0;return Yf.forEach(e.children(),(function r(o){var i=t;Yf.forEach(e.children(o),r),n[o]={low:i,lim:t++}})),n}(e);Yf.forEach(e.graph().dummyChains,(function(t){for(var r=e.node(t),o=r.edgeObj,i=function(e,n,t,r){var o,i,a=[],u=[],c=Math.min(n[t].low,n[r].low),s=Math.max(n[t].lim,n[r].lim);o=t;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>c||s>n[o].lim));for(i=o,o=r;(o=e.parent(o))!==i;)u.push(o);return{path:a.concat(u.reverse()),lca:i}}(e,n,o.v,o.w),a=i.path,u=i.lca,c=0,s=a[c],l=!0;t!==o.w;){if(r=e.node(t),l){for(;(s=a[c])!==u&&e.node(s).maxRank<r.rank;)c++;s===u&&(l=!1)}if(!l){for(;c<a.length-1&&e.node(s=a[c+1]).minRank<=r.rank;)c++;s=a[c]}e.setParent(t,s),t=e.successors(t)[0]}}))},Dh=of.removeEmptyRanks,Rh=Ff,Vh=function(e){Wf.forEach(e.children(),(function n(t){var r=e.children(t),o=e.node(t);if(r.length&&Wf.forEach(r,n),Wf.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)qf(e,"borderLeft","_bl",t,o,i),qf(e,"borderRight","_br",t,o,i)}}))},Hh=Kf,Yh=function(e){var n=wh.maxRank(e),t=bh(e,vh.range(1,n+1),"inEdges"),r=bh(e,vh.range(n-1,-1,-1),"outEdges"),o=ph(e);Eh(e,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){_h(u%2?t:r,u%4>=2),o=wh.buildLayerMatrix(e);var s=gh(e,o);s<a&&(c=0,i=vh.cloneDeep(o),a=s)}Eh(e,i)},Xh=function(e){(function(e){var n=Oh.buildLayerMatrix(e),t=e.graph().ranksep,r=0;Ph.forEach(n,(function(n){var o=Ph.max(Ph.map(n,(function(n){return e.node(n).height})));Ph.forEach(n,(function(n){e.node(n).y=r+o/2})),r+=o+t}))})(e=Oh.asNonCompoundGraph(e)),Ph.forEach(jh(e),(function(n,t){e.node(t).x=n}))},Zh=of,Fh=Ad.Graph,Uh=["nodesep","edgesep","ranksep","marginx","marginy"],Wh={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Gh=["acyclicer","ranker","rankdir","align"],qh=["width","height"],$h={width:0,height:0},Kh=["minlen","weight","width","height","labeloffset"],Qh={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Jh=["labelpos"];function ev(e,n){return Ih.mapValues(Ih.pick(e,n),Number)}function nv(e){var n={};return Ih.forEach(e,(function(e,t){n[t.toLowerCase()]=e})),n}var tv=Yd,rv=of,ov=Ad.Graph,iv={debugOrdering:function(e){var n=rv.buildLayerMatrix(e),t=new ov({compound:!0,multigraph:!0}).setGraph({});return tv.forEach(e.nodes(),(function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+e.node(n).rank)})),tv.forEach(e.edges(),(function(e){t.setEdge(e.v,e.w,{},e.name)})),tv.forEach(n,(function(e,n){var r="layer"+n;t.setNode(r,{rank:"same"}),tv.reduce(e,(function(e,n){return t.setEdge(e,n,{style:"invis"}),n}))})),t}},av=Vn({graphlib:Ad,layout:function(e,n){var t=n&&n.debugTiming?Zh.time:Zh.notime;t("layout",(function(){var n=t(" buildLayoutGraph",(function(){return function(e){var n=new Fh({multigraph:!0,compound:!0}),t=nv(e.graph());return n.setGraph(Ih.merge({},Wh,ev(t,Uh),Ih.pick(t,Gh))),Ih.forEach(e.nodes(),(function(t){var r=nv(e.node(t));n.setNode(t,Ih.defaults(ev(r,qh),$h)),n.setParent(t,e.parent(t))})),Ih.forEach(e.edges(),(function(t){var r=nv(e.edge(t));n.setEdge(t,Ih.merge({},Qh,ev(r,Kh),Ih.pick(r,Jh)))})),n}(e)}));t(" runLayout",(function(){!function(e,n){n(" makeSpaceForEdgeLabels",(function(){!function(e){var n=e.graph();n.ranksep/=2,Ih.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){Ih.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(){Ah.run(e)})),n(" nestingGraph.run",(function(){Rh.run(e)})),n(" rank",(function(){Th(Zh.asNonCompoundGraph(e))})),n(" injectEdgeLabelProxies",(function(){!function(e){Ih.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};Zh.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e)})),n(" removeEmptyRanks",(function(){Dh(e)})),n(" nestingGraph.cleanup",(function(){Rh.cleanup(e)})),n(" normalizeRanks",(function(){Lh(e)})),n(" assignRankMinMax",(function(){!function(e){var n=0;Ih.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=Ih.max(n,r.maxRank))})),e.graph().maxRank=n}(e)})),n(" removeEdgeLabelProxies",(function(){!function(e){Ih.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(){zh.run(e)})),n(" parentDummyChains",(function(){Bh(e)})),n(" addBorderSegments",(function(){Vh(e)})),n(" order",(function(){Yh(e)})),n(" insertSelfEdges",(function(){!function(e){var n=Zh.buildLayerMatrix(e);Ih.forEach(n,(function(n){var t=0;Ih.forEach(n,(function(n,r){var o=e.node(n);o.order=r+t,Ih.forEach(o.selfEdges,(function(n){Zh.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(){Hh.adjust(e)})),n(" position",(function(){Xh(e)})),n(" positionSelfEdges",(function(){!function(e){Ih.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){Ih.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(Ih.last(t.borderLeft)),a=e.node(Ih.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}})),Ih.forEach(e.nodes(),(function(n){"border"===e.node(n).dummy&&e.removeNode(n)}))}(e)})),n(" normalize.undo",(function(){zh.undo(e)})),n(" fixupEdgeLabelCoords",(function(){!function(e){Ih.forEach(e.edges(),(function(n){var t=e.edge(n);if(Ih.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(){Hh.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)}Ih.forEach(e.nodes(),(function(n){c(e.node(n))})),Ih.forEach(e.edges(),(function(n){var t=e.edge(n);Ih.has(t,"x")&&c(t)})),n-=a,r-=u,Ih.forEach(e.nodes(),(function(t){var o=e.node(t);o.x-=n,o.y-=r})),Ih.forEach(e.edges(),(function(t){var o=e.edge(t);Ih.forEach(o.points,(function(e){e.x-=n,e.y-=r})),Ih.has(o,"x")&&(o.x-=n),Ih.has(o,"y")&&(o.y-=r)})),i.width=t-n+a,i.height=o-r+u}(e)})),n(" assignNodeIntersects",(function(){!function(e){Ih.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(Zh.intersectRect(i,t)),o.points.push(Zh.intersectRect(a,r))}))}(e)})),n(" reversePoints",(function(){!function(e){Ih.forEach(e.edges(),(function(n){var t=e.edge(n);t.reversed&&t.points.reverse()}))}(e)})),n(" acyclic.undo",(function(){Ah.undo(e)}))}(n,t)})),t(" updateInputGraph",(function(){!function(e,n){Ih.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))})),Ih.forEach(e.edges(),(function(t){var r=e.edge(t),o=n.edge(t);r.points=o.points,Ih.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:iv,util:{time:of.time,notime:of.notime},version:"0.8.5"}),uv={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.")}},cv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],sv=["Enter"," ","Escape"],lv={min:.5,max:2},dv=[0,0],fv=function(e,n){void 0===n&&(n=[0,0]);var t=Ov(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}}},hv=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=Ev(t,n.nodeOrigin);return wv(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return _v(t)},vv=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=Ev(e,n.nodeOrigin);t=wv(t,r)}})),_v(t)};function pv(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),s=c.parentId?r.get(c.parentId):void 0,l=s?fv(s,s.origin||i).positionAbsolute:{x:0,y:0},d=l.x,f=l.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)s&&Pv(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(s){var v=c.measured.width,p=c.measured.height,g=s.measured.width,y=s.measured.height;if(v&&p&&g&&y){var m=c.origin||i,x=d+v*m[0],w=f+p*m[1];h=[[x,w],[x+g-v,w+y-p]]}}else null==u||u("005",uv.error005());var b=Pv(h)?yv(t,h):t;return{position:{x:b.x-d,y:b.y-f},positionAbsolute:b}}var gv=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},yv=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:gv(e.x,n[0][0],n[1][0]),y:gv(e.y,n[0][1],n[1][1])}},mv=function(e,n,t){return e<n?gv(Math.abs(e-n),1,50)/50:e>t?-gv(Math.abs(e-t),1,50)/50:0},xv=function(e,n){return[20*mv(e.x,35,n.width-35),20*mv(e.y,35,n.height-35)]},wv=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)}},bv=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},_v=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},Ev=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=fv(e,n).positionAbsolute,s=c.x,l=c.y;return{x:s,y:l,x2:s+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:l+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}},Sv=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])}},kv=function(e,n,t,r){var o=e.x,i=e.y,a=L(n,3),u=a[0],c=a[1],s=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var l={x:(o-u)/s,y:(i-c)/s};return t?Sv(l,r):l},Cv=function(e,n){var t=e.x,r=e.y,o=L(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}},Mv=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),s=gv(c,r,o);return{x:n/2-(e.x+e.width/2)*s,y:t/2-(e.y+e.height/2)*s,zoom:s}},Nv=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 Pv(e){return void 0!==e&&"parent"!==e}function Ov(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 jv={x:0,y:0};function Iv(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=Av(e),c=u.x,s=u.y,l=kv({x:c,y:s},a),d=i?Sv(l,r):l,f=d.x,h=d.y;return z({xSnapped:f,ySnapped:h},l)}exports.ConnectionMode=void 0,exports.PanOnScrollMode=void 0,exports.SelectionMode=void 0,exports.ConnectionLineType=void 0,exports.MarkerType=void 0,exports.Position=void 0;var Av=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 zv(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 Tv(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function Lv(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case exports.Position.Left:return[t-Tv(t-o,a),r];case exports.Position.Right:return[t+Tv(o-t,a),r];case exports.Position.Top:return[t,r-Tv(r-i,a)];case exports.Position.Bottom:return[t,r+Tv(i-r,a)]}}function Bv(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?exports.Position.Top:u,s=e.curvature,l=void 0===s?.25:s,d=L(Lv({pos:o,x1:n,y1:t,x2:i,y2:a,c:l}),2),f=d[0],h=d[1],v=L(Lv({pos:c,x1:i,y1:a,x2:n,y2:t,c:l}),2),p=v[0],g=v[1],y=L(zv({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),m=y[0],x=y[1],w=y[2],b=y[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),m,x,w,b]}function Dv(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Math.abs(r-n)/2,a=r<n?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}!function(e){e.Strict="strict",e.Loose="loose"}(exports.ConnectionMode||(exports.ConnectionMode={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(exports.PanOnScrollMode||(exports.PanOnScrollMode={})),function(e){e.Partial="partial",e.Full="full"}(exports.SelectionMode||(exports.SelectionMode={})),function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(exports.ConnectionLineType||(exports.ConnectionLineType={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(exports.MarkerType||(exports.MarkerType={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(exports.Position||(exports.Position={}));var Rv,Vv=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 Hv=((Rv={})[exports.Position.Left]={x:-1,y:0},Rv[exports.Position.Right]={x:1,y:0},Rv[exports.Position.Top]={x:0,y:-1},Rv[exports.Position.Bottom]={x:0,y:1},Rv),Yv=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function Xv(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?exports.Position.Top:u,s=e.borderRadius,l=void 0===s?5:s,d=e.centerX,f=e.centerY,h=e.offset,v=L(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?exports.Position.Bottom:a,c=e.target,s=e.targetPosition,l=void 0===s?exports.Position.Top:s,d=e.center,f=e.offset,h=Hv[u],v=Hv[l],p={x:i.x+h.x*f,y:i.y+h.y*f},g={x:c.x+v.x*f,y:c.y+v.y*f},y=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?exports.Position.Bottom:t,o=e.target;return r===exports.Position.Left||r===exports.Position.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}}({source:p,sourcePosition:u,target:g}),m=0!==y.x?"x":"y",x=y[m],w=[],b={x:0,y:0},_={x:0,y:0},E=L(Dv({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),S=E[0],k=E[1],C=E[2],M=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 N=[{x:r,y:p.y},{x:r,y:g.y}],P=[{x:p.x,y:o},{x:g.x,y:o}];w=h[m]===x?"x"===m?N:P:"x"===m?P:N}else{var O=[{x:p.x,y:g.y}],j=[{x:g.x,y:p.y}];if(w="x"===m?h.x===x?j:O:h.y===x?O:j,u===l){var I=Math.abs(i[m]-c[m]);if(I<=f){var A=Math.min(f-1,f-I);h[m]===x?b[m]=(p[m]>i[m]?-1:1)*A:_[m]=(g[m]>c[m]?-1:1)*A}}if(u!==l){var z="x"===m?"y":"x",T=h[m]===v[z],D=p[z]>g[z],R=p[z]<g[z];(1===h[m]&&(!T&&D||T&&R)||1!==h[m]&&(!T&&R||T&&D))&&(w="x"===m?O:j)}var V={x:p.x+b.x,y:p.y+b.y},H={x:g.x+_.x,y:g.y+_.y};Math.max(Math.abs(V.x-w[0].x),Math.abs(H.x-w[0].x))>=Math.max(Math.abs(V.y-w[0].y),Math.abs(H.y-w[0].y))?(r=(V.x+H.x)/2,o=w[0].y):(r=w[0].x,o=(V.y+H.y)/2)}return[B(B([i,{x:p.x+b.x,y:p.y+b.y}],L(w),!1),[{x:g.x+_.x,y:g.y+_.y},c],!1),r,o,C,M]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:a},targetPosition:c,center:{x:d,y:f},offset:void 0===h?20:h}),5),p=v[0],g=v[1],y=v[2],m=v[3],x=v[4],w=p.reduce((function(e,n,t){var r;return r=t>0&&t<p.length-1?function(e,n,t,r){var o=Math.min(Yv(e,n)/2,Yv(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var s=e.x<t.x?1:-1,l=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*l,"Q ").concat(i,",").concat(a," ").concat(i+o*s,",").concat(a)}(p[t-1],n,p[t+1],l):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+r}),"");return[w,g,y,m,x]}function Zv(e,n,t){var r=(null==t?void 0:t.rankdir)||"TB",o=new av.graphlib.Graph;o.setDefaultEdgeLabel((function(){return{}})),o.setGraph(z({rankdir:r},t));var i=e.map((function(e){return z({},e)}));i.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)})),av.layout(o),i.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}}));var a=function(e){var n=e.centerNodeId,t=e.containerHeight,r=void 0===t?0:t,o=e.containerWidth,i=void 0===o?0:o,a=e.centerByBBox,u=e.nodes,c=e.nodeOrigin,s=void 0===c?dv:c;if(!n&&!a||!r||!i)return jv;if(null==n?void 0:n.trim()){var l=null==u?void 0:u.find((function(e){return e.id===(null==n?void 0:n.trim())}));if(l){var d=function(e,n){if(!e)return jv;var t=Ov(e),r=t.width,o=t.height,i=r*n[0],a=o*n[1];return{x:e.position.x+r/2-i,y:e.position.y+o/2-a}}(l,s);return{x:i/2-d.x,y:r/2-d.y}}}return a?(d=function(e,n){if(!(null==e?void 0:e.length))return jv;var t=hv(e,{nodeOrigin:n}),r=t.x,o=t.y;return{x:r+t.width/2,y:o+t.height/2}}(u,s),{x:i/2-d.x,y:r/2-d.y}):jv}({centerByBBox:null==t?void 0:t.centerByBBox,centerNodeId:null==t?void 0:t.centerNodeId,nodes:i,containerWidth:null==t?void 0:t.width,containerHeight:null==t?void 0:t.height,nodeOrigin:null==t?void 0:t.nodeOrigin}),u=a.x,c=void 0===u?0:u,s=a.y,l=void 0===s?0:s;i.forEach((function(e){e.position={x:e.position.x+c,y:e.position.y+l}}));var d={overflowBoundary:!1,transform:{x:0,y:0,zoom:1}};return(null==t?void 0:t.width)&&(null==t?void 0:t.height)&&t.fitViewOptions&&(d=function(e,n){var t=n||{},r=t.minZoom,o=void 0===r?lv.min:r,i=t.maxZoom,a=void 0===i?lv.max:i,u=t.padding,c=void 0===u?.1:u,s=t.nodeOrigin,l=void 0===s?dv:s,d=t.width,f=t.height,h=hv(e||[],{nodeOrigin:l}),v=h.width>=d||h.height>=f;return{transform:Mv(h,d,f,o,a,c),overflowBoundary:v}}(i,z({width:t.width,height:t.height,nodeOrigin:t.nodeOrigin},t.fitViewOptions))),{nodes:i,edges:n,transform:d.transform,overflowBoundary:d.overflowBoundary}}var Fv=function(e){return null!==e&&"function"!=typeof e&&isFinite(e.length)},Uv=function(e,n){return!!Fv(e)&&e.indexOf(n)>-1},Wv=function(e,n){if(!Fv(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];n(o,r)&&t.push(o)}return t},Gv={}.toString,qv=function(e,n){return Gv.call(e)==="[object "+n+"]"},$v=function(e){return qv(e,"Function")},Kv=function(e){return null==e},Qv=function(e){return Array.isArray?Array.isArray(e):qv(e,"Array")},Jv=function(e){var n=typeof e;return null!==e&&"object"===n||"function"===n};function ep(e,n){if(e)if(Qv(e))for(var t=0,r=e.length;t<r&&!1!==n(e[t],t);t++);else if(Jv(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===n(e[o],o))break}var np=Object.keys?function(e){return Object.keys(e)}:function(e){var n=[];return ep(e,(function(t,r){$v(e)&&"prototype"===r||n.push(r)})),n};function tp(e,n){var t=np(n),r=t.length;if(Kv(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 rp=function(e){return"object"==typeof e&&null!==e},op=function(e){if(!rp(e)||!qv(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},ip=function(e,n){if(void 0===n&&(n=[]),Qv(e))for(var t=0;t<e.length;t+=1)ip(e[t],n);else n.push(e);return n},ap=function(e){if(Qv(e))return e.reduce((function(e,n){return Math.max(e,n)}),e[0])},up=function(e){if(Qv(e))return e.reduce((function(e,n){return Math.min(e,n)}),e[0])},cp=Array.prototype,sp=cp.splice,lp=cp.indexOf,dp=Array.prototype.splice,fp=function(e,n){if(!Fv(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,dp.call(e,i,1))}return e},hp=function(e,n,t){if(!Qv(e)&&!op(e))return e;var r=t;return ep(e,(function(e,t){r=n(r,e,t)})),r},vp=function(e){return qv(e,"String")};function pp(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 gp=Object.prototype.hasOwnProperty;function yp(e,n){if(!n||!Qv(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),gp.call(r,t)?r[t].push(a):r[t]=[a]}return r}function mp(e,n){if(!n)return{0:e};if(!$v(n)){var t=Qv(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 yp(e,n)}var xp={},wp=function(e){return qv(e,"Number")},bp=Number.isInteger?Number.isInteger:function(e){return wp(e)&&e%1==0},_p=180/Math.PI,Ep=parseInt,Sp=Math.PI/180,kp=function(e,n){return e.hasOwnProperty(n)},Cp=Object.values?function(e){return Object.values(e)}:function(e){var n=[];return ep(e,(function(t,r){$v(e)&&"prototype"===r||n.push(t)})),n},Mp=function(e){return Kv(e)?"":e.toString()},Np={}.toString,Pp=function(e){return Np.call(e).replace(/^\[object /,"").replace(/]$/,"")},Op=Object.prototype,jp=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||Op)};function Ip(e,n){for(var t in n)n.hasOwnProperty(t)&&"constructor"!==t&&void 0!==n[t]&&(e[t]=n[t])}function Ap(e,n,t,r){return n&&Ip(e,n),t&&Ip(e,t),r&&Ip(e,r),e}var zp=function(e){if("object"!=typeof e||null===e)return e;var n;if(Qv(e)){n=[];for(var t=0,r=e.length;t<r;t++)"object"==typeof e[t]&&null!=e[t]?n[t]=zp(e[t]):n[t]=e[t]}else for(var o in n={},e)"object"==typeof e[o]&&null!=e[o]?n[o]=zp(e[o]):n[o]=e[o];return n},Tp=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 Lp(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&&op(i)?(op(e[o])||(e[o]={}),t<r?Lp(e[o],i,t+1,r):e[o]=n[o]):Qv(i)?(e[o]=[],e[o]=e[o].concat(i)):void 0!==i&&(e[o]=i)}}var Bp,Dp=Object.prototype.hasOwnProperty,Rp=function(e,n){if(e===n)return!0;if(!e||!n)return!1;if(vp(e)||vp(n))return!1;if(Fv(e)||Fv(n)){if(e.length!==n.length)return!1;for(var t=!0,r=0;r<e.length&&(t=Rp(e[r],n[r]));r++);return t}if(rp(e)||rp(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=Rp(e[o[r]],n[o[r]]));r++);return t}return!1},Vp=function(e){return e},Hp=Object.prototype.hasOwnProperty,Yp={},Xp=Tp((function(e,n){void 0===n&&(n={});var t=n.fontSize,r=n.fontFamily,o=n.fontWeight,i=n.fontStyle,a=n.fontVariant;return Bp||(Bp=document.createElement("canvas").getContext("2d")),Bp.font=[i,a,o,t+"px",r].join(" "),Bp.measureText(vp(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],Cp(n)).join("")})),Zp=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}(),Fp=Object.freeze({__proto__:null,Cache:Zp,assign:Ap,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),Ap(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:zp,contains:Uv,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)Lp(e,n[r]);return e},difference:function(e,n){return void 0===n&&(n=[]),Wv(e,(function(e){return!Uv(n,e)}))},each:ep,endsWith:function(e,n){return!(!Qv(e)&&!vp(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=Ap(i,e.prototype),e.superclass=o(n.prototype,n),Ap(i,t),Ap(e,r),e},filter:Wv,find:function(e,n){if(!Qv(e))return null;var t;if($v(n)&&(t=n),op(n)&&(t=function(e){return tp(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(!Kv(o)){t=Qv(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(!Qv(e))return[];for(var n=[],t=0;t<e.length;t++)n=n.concat(e[t]);return n},flattenDeep:ip,forIn:ep,get:function(e,n,t){for(var r=0,o=vp(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=Xp(r,t),u=vp(e)?e:Mp(e),c=n,s=[];if(Xp(e,t)<=n)return e;for(;o=u.substr(0,16),!((i=Xp(o,t))+a>c&&i>c);)if(s.push(o),c-=i,!(u=u.substr(16)))return s.join("");for(;o=u.substr(0,1),!((i=Xp(o,t))+a>c);)if(s.push(o),c-=i,!(u=u.substr(1)))return s.join("");return""+s.join("")+r},getRange:function(e){var n=e.filter((function(e){return!isNaN(e)}));if(!n.length)return{min:0,max:0};if(Qv(e[0])){for(var t=[],r=0;r<e.length;r++)t=t.concat(e[r]);n=t}var o=ap(n);return{min:up(n),max:o}},getType:Pp,getWrapBehavior:function(e,n){return e["_wrap_"+n]},group:function(e,n){if(!n)return[e];var t=mp(e,n),r=[];for(var o in t)r.push(t[o]);return r},groupBy:yp,groupToMap:mp,has:kp,hasKey:kp,hasValue:function(e,n){return Uv(Cp(e),n)},head:function(e){if(Fv(e))return e[0]},identity:function(e){return e},includes:Uv,indexOf:function(e,n){if(!Fv(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 qv(e,"Arguments")},isArray:Qv,isArrayLike:Fv,isBoolean:function(e){return qv(e,"Boolean")},isDate:function(e){return qv(e,"Date")},isDecimal:function(e){return wp(e)&&e%1!=0},isElement:function(e){return e instanceof Element||e instanceof HTMLDocument},isEmpty:function(e){if(Kv(e))return!0;if(Fv(e))return!e.length;var n=Pp(e);if("Map"===n||"Set"===n)return!e.size;if(jp(e))return!Object.keys(e).length;for(var t in e)if(Dp.call(e,t))return!1;return!0},isEqual:Rp,isEqualWith:function(e,n,t){return $v(t)?!!t(e,n):Rp(e,n)},isError:function(e){return qv(e,"Error")},isEven:function(e){return wp(e)&&e%2==0},isFinite:function(e){return wp(e)&&isFinite(e)},isFunction:$v,isInteger:bp,isMatch:tp,isNegative:function(e){return wp(e)&&e<0},isNil:Kv,isNull:function(e){return null===e},isNumber:wp,isNumberEqual:function(e,n,t){return void 0===t&&(t=1e-5),Math.abs(e-n)<t},isObject:Jv,isObjectLike:rp,isOdd:function(e){return wp(e)&&e%2!=0},isPlainObject:op,isPositive:function(e){return wp(e)&&e>0},isPrototype:jp,isRegExp:function(e){return qv(e,"RegExp")},isString:vp,isType:qv,isUndefined:function(e){return void 0===e},keys:np,last:function(e){if(Fv(e))return e[e.length-1]},lowerCase:function(e){return Mp(e).toLowerCase()},lowerFirst:function(e){var n=Mp(e);return n.charAt(0).toLowerCase()+n.substring(1)},map:function(e,n){if(!Fv(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=Vp);var t={};return Jv(e)&&!Kv(e)&&Object.keys(e).forEach((function(r){t[r]=n(e[r],r)})),t},max:ap,maxBy:function(e,n){if(Qv(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:Xp,memoize:Tp,min:up,minBy:function(e,n){if(Qv(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:Ap,mod:function(e,n){return(e%n+n)%n},noop:function(){},number2color:function(e){var n=xp[e];if(!n){for(var t=e.toString(16),r=t.length;r<6;r++)t="0"+t;n="#"+t,xp[e]=n}return n},omit:function(e,n){return hp(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 Qv(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||!op(e))return{};var t={};return ep(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=lp.call(e,o))>-1;)sp.call(e,i,1);return e},pullAt:fp,reduce:hp,remove:function(e,n){var t=[];if(!Fv(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 fp(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=vp(n)?n.split("."):n;return o.forEach((function(e,n){n<o.length-1?(Jv(r[e])||(r[e]=wp(o[n+1])?[]:{}),r=r[e]):r[e]=t})),e},size:function(e){return Kv(e)?0:Fv(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=[];vp(n)?r.push(n):Qv(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!(!Qv(e)&&!vp(e))&&e[0]===n},substitute:function(e,n){return e&&n?e.replace(/\\?\{([^{}]+)\}/g,(function(e,t){return"\\"===e.charAt(0)?e.slice(1):void 0===n[t]?"":n[t]})):e},throttle:function(e,n,t){var r,o,i,a,u=0;t||(t={});var c=function(){u=!1===t.leading?0:Date.now(),r=null,a=e.apply(o,i),r||(o=i=null)},s=function(){var s=Date.now();u||!1!==t.leading||(u=s);var l=n-(s-u);return o=this,i=arguments,l<=0||l>n?(r&&(clearTimeout(r),r=null),u=s,a=e.apply(o,i),r||(o=i=null)):r||!1===t.trailing||(r=setTimeout(c,l)),a};return s.cancel=function(){clearTimeout(r),u=0,r=o=i=null},s},toArray:function(e){return Fv(e)?Array.prototype.slice.call(e):[]},toDegree:function(e){return _p*e},toInteger:Ep,toRadian:function(e){return Sp*e},toString:Mp,union:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return pp([].concat.apply([],e))},uniq:pp,uniqueId:function(e){return Yp[e=e||"g"]?Yp[e]+=1:Yp[e]=1,e+Yp[e]},upperCase:function(e){return Mp(e).toUpperCase()},upperFirst:function(e){var n=Mp(e);return n.charAt(0).toUpperCase()+n.substring(1)},values:Cp,valuesOfKey:function(e,n){for(var t=[],r={},o=0;o<e.length;o++){var i=e[o][n];if(!Kv(i)){Qv(i)||(i=[i]);for(var a=0;a<i.length;a++){var u=i[a];r[u]||(t.push(u),r[u]=!0)}}}return t},wrapBehavior:function(e,n){if(e["_wrap_"+n])return e["_wrap_"+n];var t=function(t){e[n](t)};return e["_wrap_"+n]=t,t}}),Up={assign:function(e){if(e.__esModule)return e;var n=e.default;if("function"==typeof n){var t=function e(){return this instanceof e?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}(Fp).mix,getHeight:function(e,n,t,r){return void 0===r&&(r="height"),"center"===t?(e[r]+n[r])/2:e.height}},Wp=Up,Gp={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 qp(e,n){var t=this;if(t.vgap=t.hgap=0,e instanceof qp)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}Wp.assign(qp.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 qp(e,n=Wp.assign({},Gp,n)),i=[o];if(!t&&!e.collapsed)for(;r=i.shift();)if(!r.data.collapsed){var a=n.getChildren(r.data),u=a?a.length:0;if(r.children=new Array(u),a&&u)for(var c=0;c<u;c++){var s=new qp(a[c],n);r.children[c]=s,i.push(s),s.parent=r,s.depth=r.depth+1}}return o},Kp=$p,Qp=function(){function e(e,n){void 0===n&&(n={}),this.options=n,this.rootNode=Kp(e,n)}return e.prototype.execute=function(){throw new Error("please override this method")},e}(),Jp=Qp;function eg(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 ng(e,n,t){t?e.y+=n:e.x+=n,e.children.forEach((function(e){ng(e,n,t)}))}function tg(e,n){var t=n?e.y:e.x;return e.children.forEach((function(e){t=Math.min(tg(e,n),t)})),t}function rg(e,n){ng(e,-tg(e,n),n)}function og(e,n,t){t?n.y=e.x:n.x=e.x,e.c.forEach((function(e,r){og(e,n.children[r],t)}))}function ig(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){ig(e,n,t)}))}eg.fromNode=function(e,n){if(!e)return null;var t=[];return e.children.forEach((function(e){t.push(eg.fromNode(e,n))})),n?new eg(e.height,e.width,e.x,t):new eg(e.width,e.height,e.y,t)};var ag=$p,ug=function(e,n){for(var t=ag(e.data,n,!0),r=ag(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}},cg=ug,sg=["LR","RL","TB","BT","H","V"],lg=["LR","RL","H"],dg=sg[0],fg=function(e,n,t){var r=n.direction||dg;if(n.isHorizontal=function(e){return lg.indexOf(e)>-1}(r),r&&-1===sg.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===sg[0])t(e,n);else if(r===sg[1])t(e,n),e.right2left();else if(r===sg[2])t(e,n);else if(r===sg[3])t(e,n),e.bottom2top();else if(r===sg[4]||r===sg[5]){var o=cg(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 hg(e,n){return hg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},hg(e,n)}var vg=function(e,n){void 0===n&&(n={});var t=n.isHorizontal;function r(e){0===e.cs?(e.el=e,e.er=e,e.msel=e.mser=0):(e.el=e.c[0].el,e.msel=e.c[0].msel,e.er=e.c[e.cs-1].er,e.mser=e.c[e.cs-1].mser)}function o(e,n,t){for(var r=e.c[n-1],o=r.mod,s=e.c[n],l=s.mod;null!==r&&null!==s;){c(r)>t.low&&(t=t.nxt);var d=o+r.prelim+r.w-(l+s.prelim);d>0&&(l+=d,i(e,n,t.index,d));var f=c(r),h=c(s);f<=h&&null!==(r=u(r))&&(o+=r.mod),f>=h&&null!==(s=a(s))&&(l+=s.mod)}!r&&s?function(e,n,t,r){var o=e.c[0].el;o.tl=t;var i=r-t.mod-e.c[0].msel;o.mod+=i,o.prelim-=i,e.c[0].el=e.c[n].el,e.c[0].msel=e.c[n].msel}(e,n,s,l):r&&!s&&function(e,n,t,r){var o=e.c[n].er;o.tr=t;var i=r-t.mod-e.c[n].mser;o.mod+=i,o.prelim-=i,e.c[n].er=e.c[n-1].er,e.c[n].mser=e.c[n-1].mser}(e,n,r,o)}function i(e,n,t,r){e.c[n].mod+=r,e.c[n].msel+=r,e.c[n].mser+=r,function(e,n,t,r){if(t!==n-1){var o=n-t;e.c[t+1].shift+=r/o,e.c[n].shift-=r/o,e.c[n].change-=r-r/o}}(e,n,t,r)}function a(e){return 0===e.cs?e.tl:e.c[0]}function u(e){return 0===e.cs?e.tr:e.c[e.cs-1]}function c(e){return e.y+e.h}function s(e,n,t){for(;null!==t&&e>=t.low;)t=t.nxt;return{low:e,index:n,nxt:t}}ig(e,t);var l=eg.fromNode(e,t);return function e(n){if(0!==n.cs){e(n.c[0]);for(var t=s(c(n.c[0].el),0,null),i=1;i<n.cs;++i){e(n.c[i]);var a=c(n.c[i].er);o(n,i,t),t=s(a,i,t)}!function(e){e.prelim=(e.c[0].prelim+e.c[0].mod+e.c[e.cs-1].mod+e.c[e.cs-1].prelim+e.c[e.cs-1].w)/2-e.w/2}(n),r(n)}else r(n)}(l),function e(n,t){t+=n.mod,n.x=n.prelim+t,function(e){for(var n=0,t=0,r=0;r<e.cs;r++)t+=(n+=e.c[r].shift)+e.c[r].change,e.c[r].mod+=t}(n);for(var r=0;r<n.cs;r++)e(n.c[r],t)}(l,0),og(l,e,t),rg(e,t),e},pg=fg,gg=Up,yg=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,hg(n,t),r.prototype.execute=function(){return pg(this.rootNode,this.options,vg)},r}(Jp),mg={},xg=Up;function wg(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 bg={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function _g(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){_g(e,n.children[r],t)}))}function Eg(e,n){return Eg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Eg(e,n)}var Sg=function(e,n){void 0===n&&(n={}),n=xg.assign({},bg,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 wg(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),_g(o,e,n.isHorizontal),e},kg=fg,Cg=Up,Mg=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,Eg(n,t),r.prototype.execute=function(){var e=this;return e.rootNode.width=0,kg(e.rootNode,e.options,Sg)},r}(Jp),Ng={},Pg=Up;function Og(e,n){return Og=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Og(e,n)}var jg=Jp,Ig=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+Pg.getHeight(n,e,o),n.parent&&e.parent.id!==n.parent.id){var a=n.parent,u=a.y+Pg.getHeight(a,e,o);e.y=u>e.y?u:e.y}}else e.y=0}(e,o,n,t,r),o=e}))},Ag=ug,zg=Up,Tg=["LR","RL","H"],Lg=Tg[0],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,Og(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?Lg:a,c=e.align;if(u&&-1===Tg.indexOf(u))throw new TypeError("Invalid direction: "+u);if(u===Tg[0])Ig(n,r,i,c);else if(u===Tg[1])Ig(n,r,i,c),n.right2left();else if(u===Tg[2]){var s=Ag(n,e),l=s.left,d=s.right;Ig(l,r,i,c),l.right2left(),Ig(d,r,i,c);var f=l.getBoundingBox();d.translate(f.width,0),n.x=d.x-n.width/2}return n},r}(jg),Dg={},Rg=Up;function Vg(e,n){var t=0;return e.children.length?e.children.forEach((function(e){t+=Vg(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 Yg={getSubTreeSep:function(){return 0}};function Xg(e,n){return Xg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Xg(e,n)}var Zg=function(e,n){void 0===n&&(n={}),n=Rg.assign({},Yg,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,Vg(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)},Fg=fg,Ug=Up,Wg=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,Xg(n,t),r.prototype.execute=function(){return Fg(this.rootNode,this.options,Zg)},r}(Jp),Gg={};Vn({compactBox:function(e,n){return n=gg.assign({},mg,n),new yg(e,n).execute()},dendrogram:function(e,n){return n=Cg.assign({},Ng,n),new Mg(e,n).execute()},indented:function(e,n){return n=zg.assign({},Dg,n),new Bg(e,n).execute()},mindmap:function(e,n){return n=Ug.assign({},Gg,n),new Wg(e,n).execute()}});var qg={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 Kg(r)}function Kg(e){this._=e}function Qg(e,n){for(var t,r=0,o=e.length;r<o;++r)if((t=e[r]).name===n)return t.value}function Jg(e,n,t){for(var r=0,o=e.length;r<o;++r)if(e[r].name===n){e[r]=qg,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=t&&e.push({name:n,value:t}),e}Kg.prototype=$g.prototype={constructor:Kg,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]=Jg(o[t],e.name,n);else if(null==n)for(t in o)o[t]=Jg(o[t],e.name,null);return this}for(;++a<u;)if((t=(e=i[a]).type)&&(t=Qg(o[t],e.name)))return t},copy:function(){var e={},n=this._;for(var t in n)e[t]=n[t].slice();return new Kg(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 ey="http://www.w3.org/1999/xhtml",ny={svg:"http://www.w3.org/2000/svg",xhtml:ey,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ty(e){var n=e+="",t=n.indexOf(":");return t>=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),ny.hasOwnProperty(n)?{space:ny[n],local:e}:e}function ry(e){return function(){var n=this.ownerDocument,t=this.namespaceURI;return t===ey&&n.documentElement.namespaceURI===ey?n.createElement(e):n.createElementNS(t,e)}}function oy(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function iy(e){var n=ty(e);return(n.local?oy:ry)(n)}function ay(){}function uy(e){return null==e?ay:function(){return this.querySelector(e)}}function cy(){return[]}function sy(e){return null==e?cy:function(){return this.querySelectorAll(e)}}function ly(e){return function(){return this.matches(e)}}function dy(e){return function(n){return n.matches(e)}}var fy=Array.prototype.find;function hy(){return this.firstElementChild}var vy=Array.prototype.filter;function py(){return Array.from(this.children)}function gy(e){return new Array(e.length)}function yy(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}function my(e,n,t,r,o,i){for(var a,u=0,c=n.length,s=i.length;u<s;++u)(a=n[u])?(a.__data__=i[u],r[u]=a):t[u]=new yy(e,i[u]);for(;u<c;++u)(a=n[u])&&(o[u]=a)}function xy(e,n,t,r,o,i,a){var u,c,s,l=new Map,d=n.length,f=i.length,h=new Array(d);for(u=0;u<d;++u)(c=n[u])&&(h[u]=s=a.call(c,c.__data__,u,n)+"",l.has(s)?o[u]=c:l.set(s,c));for(u=0;u<f;++u)s=a.call(e,i[u],u,i)+"",(c=l.get(s))?(r[u]=c,c.__data__=i[u],l.delete(s)):t[u]=new yy(e,i[u]);for(u=0;u<d;++u)(c=n[u])&&l.get(h[u])===c&&(o[u]=c)}function wy(e){return e.__data__}function by(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function _y(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function Ey(e){return function(){this.removeAttribute(e)}}function Sy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ky(e,n){return function(){this.setAttribute(e,n)}}function Cy(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function My(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}function Ny(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 Py(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Oy(e){return function(){this.style.removeProperty(e)}}function jy(e,n,t){return function(){this.style.setProperty(e,n,t)}}function Iy(e,n,t){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,t)}}function Ay(e,n){return e.style.getPropertyValue(n)||Py(e).getComputedStyle(e,null).getPropertyValue(n)}function zy(e){return function(){delete this[e]}}function Ty(e,n){return function(){this[e]=n}}function Ly(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}function By(e){return e.trim().split(/^|\s+/)}function Dy(e){return e.classList||new Ry(e)}function Ry(e){this._node=e,this._names=By(e.getAttribute("class")||"")}function Vy(e,n){for(var t=Dy(e),r=-1,o=n.length;++r<o;)t.add(n[r])}function Hy(e,n){for(var t=Dy(e),r=-1,o=n.length;++r<o;)t.remove(n[r])}function Yy(e){return function(){Vy(this,e)}}function Xy(e){return function(){Hy(this,e)}}function Zy(e,n){return function(){(n.apply(this,arguments)?Vy:Hy)(this,e)}}function Fy(){this.textContent=""}function Uy(e){return function(){this.textContent=e}}function Wy(e){return function(){var n=e.apply(this,arguments);this.textContent=null==n?"":n}}function Gy(){this.innerHTML=""}function qy(e){return function(){this.innerHTML=e}}function $y(e){return function(){var n=e.apply(this,arguments);this.innerHTML=null==n?"":n}}function Ky(){this.nextSibling&&this.parentNode.appendChild(this)}function Qy(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Jy(){return null}function em(){var e=this.parentNode;e&&e.removeChild(this)}function nm(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function tm(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function rm(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 om(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 im(e,n,t){var r=Py(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 am(e,n){return function(){return im(this,e,n)}}function um(e,n){return function(){return im(this,e,n.apply(this,arguments))}}yy.prototype={constructor:yy,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)}},Ry.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 cm=[null];function sm(e,n){this._groups=e,this._parents=n}function lm(){return new sm([[document.documentElement]],cm)}function dm(e){return"string"==typeof e?new sm([[document.querySelector(e)]],[document.documentElement]):new sm([[e]],cm)}function fm(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]}sm.prototype=lm.prototype={constructor:sm,select:function(e){"function"!=typeof e&&(e=uy(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a,u=n[o],c=u.length,s=r[o]=new Array(c),l=0;l<c;++l)(i=u[l])&&(a=e.call(i,i.__data__,l,u))&&("__data__"in i&&(a.__data__=i.__data__),s[l]=a);return new sm(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):sy(e);for(var n=this._groups,t=n.length,r=[],o=[],i=0;i<t;++i)for(var a,u=n[i],c=u.length,s=0;s<c;++s)(a=u[s])&&(r.push(e.call(a,a.__data__,s,u)),o.push(a));return new sm(r,o)},selectChild:function(e){return this.select(null==e?hy:function(e){return function(){return fy.call(this.children,e)}}("function"==typeof e?e:dy(e)))},selectChildren:function(e){return this.selectAll(null==e?py:function(e){return function(){return vy.call(this.children,e)}}("function"==typeof e?e:dy(e)))},filter:function(e){"function"!=typeof e&&(e=ly(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],s=0;s<u;++s)(i=a[s])&&e.call(i,i.__data__,s,a)&&c.push(i);return new sm(r,this._parents)},data:function(e,n){if(!arguments.length)return Array.from(this,wy);var t,r=n?xy:my,o=this._parents,i=this._groups;"function"!=typeof e&&(t=e,e=function(){return t});for(var a=i.length,u=new Array(a),c=new Array(a),s=new Array(a),l=0;l<a;++l){var d=o[l],f=i[l],h=f.length,v=by(e.call(d,d&&d.__data__,l,o)),p=v.length,g=c[l]=new Array(p),y=u[l]=new Array(p);r(d,f,g,y,s[l]=new Array(h),v,n);for(var m,x,w=0,b=0;w<p;++w)if(m=g[w]){for(w>=b&&(b=w+1);!(x=y[b])&&++b<p;);m._next=x||null}}return(u=new sm(u,o))._enter=c,u._exit=s,u},enter:function(){return new sm(this._enter||this._groups.map(gy),this._parents)},exit:function(){return new sm(this._exit||this._groups.map(gy),this._parents)},join:function(e,n,t){var r=this.enter(),o=this,i=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=n&&(o=n(o))&&(o=o.selection()),null==t?i.remove():t(i),r&&o?r.merge(o).order():o},merge:function(e){for(var n=e.selection?e.selection():e,t=this._groups,r=n._groups,o=t.length,i=r.length,a=Math.min(o,i),u=new Array(o),c=0;c<a;++c)for(var s,l=t[c],d=r[c],f=l.length,h=u[c]=new Array(f),v=0;v<f;++v)(s=l[v]||d[v])&&(h[v]=s);for(;c<o;++c)u[c]=t[c];return new sm(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=_y);for(var t=this._groups,r=t.length,o=new Array(r),i=0;i<r;++i){for(var a,u=t[i],c=u.length,s=o[i]=new Array(c),l=0;l<c;++l)(a=u[l])&&(s[l]=a);s.sort(n)}return new sm(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=ty(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?Sy:Ey:"function"==typeof n?t.local?Ny:My:t.local?Cy:ky)(t,n))},style:function(e,n,t){return arguments.length>1?this.each((null==n?Oy:"function"==typeof n?Iy:jy)(e,n,null==t?"":t)):Ay(this.node(),e)},property:function(e,n){return arguments.length>1?this.each((null==n?zy:"function"==typeof n?Ly:Ty)(e,n)):this.node()[e]},classed:function(e,n){var t=By(e+"");if(arguments.length<2){for(var r=Dy(this.node()),o=-1,i=t.length;++o<i;)if(!r.contains(t[o]))return!1;return!0}return this.each(("function"==typeof n?Zy:n?Yy:Xy)(t,n))},text:function(e){return arguments.length?this.each(null==e?Fy:("function"==typeof e?Wy:Uy)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Gy:("function"==typeof e?$y:qy)(e)):this.node().innerHTML},raise:function(){return this.each(Ky)},lower:function(){return this.each(Qy)},append:function(e){var n="function"==typeof e?e:iy(e);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(e,n){var t="function"==typeof e?e:iy(e),r=null==n?Jy:"function"==typeof n?n:uy(n);return this.select((function(){return this.insertBefore(t.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(em)},clone:function(e){return this.select(e?tm:nm)},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?om:rm,r=0;r<a;++r)this.each(u(i[r],n,t));return this}var u=this.node().__on;if(u)for(var c,s=0,l=u.length;s<l;++s)for(r=0,c=u[s];r<a;++r)if((o=i[r]).type===c.type&&o.name===c.name)return c.value},dispatch:function(e,n){return this.each(("function"==typeof n?um:am)(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 hm={passive:!1},vm={capture:!0,passive:!1};function pm(e){e.stopImmediatePropagation()}function gm(e){e.preventDefault(),e.stopImmediatePropagation()}function ym(e){var n=e.document.documentElement,t=dm(e).on("dragstart.drag",gm,vm);"onselectstart"in n?t.on("selectstart.drag",gm,vm):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function mm(e,n){var t=e.document.documentElement,r=dm(e).on("dragstart.drag",null);n&&(r.on("click.drag",gm,vm),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 xm=e=>()=>e;function wm(e,{sourceEvent:n,subject:t,target:r,identifier:o,active:i,x:a,y:u,dx:c,dy:s,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:s,enumerable:!0,configurable:!0},_:{value:l}})}function bm(e){return!e.ctrlKey&&!e.button}function _m(){return this.parentNode}function Em(e,n){return null==n?{x:e.x,y:e.y}:n}function Sm(){return navigator.maxTouchPoints||"ontouchstart"in this}function km(e,n){if(!e.parentId)return!1;var t=n.get(e.parentId);return!!t&&(!!t.selected||km(t,n))}function Cm(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 Mm(e){var n,t,r,o,i=e.nodeId,a=e.dragItems,u=e.nodeLookup,c=[];try{for(var s=T(a),l=s.next();!l.done;l=s.next()){var d=L(l.value,2),f=d[0],h=d[1],v=null===(r=u.get(f))||void 0===r?void 0:r.internals.userNode;v&&c.push(z(z({},v),{position:h.position}))}}catch(e){n={error:e}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(n)throw n.error}}if(!i)return[c[0],c];var p=u.get(i).internals.userNode;return[z(z({},p),{position:(null===(o=a.get(i))||void 0===o?void 0:o.position)||p.position}),c]}function Nm(e){var n=e.onNodeMouseDown,t=e.getStoreItems,r=e.onDragStart,o=e.onDrag,i=e.onDragStop,a={x:null,y:null},u=0,c=new Map,s=!1,l={x:0,y:0},d=null,f=!1,h=null;return{update:function(e){var v=e.noDragClassName,p=e.handleSelector,g=e.domNode,y=e.isSelectable,m=e.nodeId;function x(e,n){var r,i,u=e.x,s=e.y,l=t(),d=l.nodeLookup,f=l.nodeExtent,h=l.snapGrid,v=l.snapToGrid,p=l.nodeOrigin,g=l.onNodeDrag,y=l.onSelectionDrag,x=l.onError,w=l.updateNodePositions;a={x:u,y:s};var b=!1,_={x:0,y:0,x2:0,y2:0};if(c.size>1&&f){var E=vv(c,{nodeOrigin:p});_=bv(E)}try{for(var S=T(c),k=S.next();!k.done;k=S.next()){var C=L(k.value,2),M=C[0],N=C[1],P={x:u-N.distance.x,y:s-N.distance.y};v&&(P=Sv(P,h));var O=[[f[0][0],f[0][1]],[f[1][0],f[1][1]]];if(c.size>1&&f&&!N.extent){var j=N.internals.positionAbsolute,I=j.x-_.x+f[0][0],A=j.x+N.measured.width-_.x2+f[1][0];O=[[I,j.y-_.y+f[0][1]],[A,j.y+N.measured.height-_.y2+f[1][1]]]}var z=pv({nodeId:M,nextPosition:P,nodeLookup:d,nodeExtent:O,nodeOrigin:p,onError:x}),B=z.position,D=z.positionAbsolute;b=b||N.position.x!==B.x||N.position.y!==B.y,N.position=B,N.internals.positionAbsolute=D}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(b&&(w(c,!0),n&&(o||g||!m&&y))){var R=L(Mm({nodeId:m,dragItems:c,nodeLookup:d}),2),V=R[0],H=R[1];null==o||o(n,c,V,H),null==g||g(n,V,H),m||null==y||y(n,H)}}function w(){var e,n;if(d){var r=L(xv(l,d),2),o=r[0],i=r[1];if(0!==o||0!==i){var c=t(),s=c.transform,f=c.panBy;a.x=(null!==(e=a.x)&&void 0!==e?e:0)-o/s[2],a.y=(null!==(n=a.y)&&void 0!==n?n:0)-i/s[2],f({x:o,y:i})&&x(a,null)}u=requestAnimationFrame(w)}}function b(e){var o,i=t(),u=i.nodeLookup,s=i.multiSelectionActive,l=i.nodesDraggable,d=i.transform,h=i.snapGrid,v=i.snapToGrid,p=i.selectNodesOnDrag,g=i.onNodeDragStart,x=i.onSelectionDragStart,w=i.unselectNodesAndEdges;f=!0,p&&y||s||!m||(null===(o=u.get(m))||void 0===o?void 0:o.selected)||w(),y&&p&&m&&(null==n||n(m));var b=Iv(e.sourceEvent,{transform:d,snapGrid:h,snapToGrid:v});if(a=b,c=function(e,n,t,r){var o,i,a,u,c=new Map;try{for(var s=T(e),l=s.next();!l.done;l=s.next()){var d=L(l.value,2),f=d[0],h=d[1];if((h.selected||h.id===r)&&(!h.parentId||!km(h,e))&&(h.draggable||n&&void 0===h.draggable)){var v=e.get(f);v&&c.set(f,{id:f,position:v.position||{x:0,y:0},distance:{x:t.x-v.internals.positionAbsolute.x,y:t.y-v.internals.positionAbsolute.y},extent:v.extent,parentId:v.parentId,origin:v.origin,expandParent:v.expandParent,internals:{positionAbsolute:v.internals.positionAbsolute||{x:0,y:0}},measured:{width:null!==(a=v.measured.width)&&void 0!==a?a:0,height:null!==(u=v.measured.height)&&void 0!==u?u:0}})}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return c}(u,l,b,m),c.size>0&&(r||g||!m&&x)){var _=L(Mm({nodeId:m,dragItems:c,nodeLookup:u}),2),E=_[0],S=_[1];null==r||r(e.sourceEvent,c,E,S),null==g||g(e.sourceEvent,E,S),m||null==x||x(e.sourceEvent,S)}}h=dm(g);var _=function(){var e,n,t,r,o=bm,i=_m,a=Em,u=Sm,c={},s=$g("start","drag","end"),l=0,d=0;function f(e){e.on("mousedown.drag",h).filter(u).on("touchstart.drag",g).on("touchmove.drag",y,hm).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,u){if(!r&&o.call(this,a,u)){var c=x(this,i.call(this,a,u),a,u,"mouse");c&&(dm(a.view).on("mousemove.drag",v,vm).on("mouseup.drag",p,vm),ym(a.view),pm(a),t=!1,e=a.clientX,n=a.clientY,c("start",a))}}function v(r){if(gm(r),!t){var o=r.clientX-e,i=r.clientY-n;t=o*o+i*i>d}c.mouse("drag",r)}function p(e){dm(e.view).on("mousemove.drag mouseup.drag",null),mm(e.view,t),gm(e),c.mouse("end",e)}function g(e,n){if(o.call(this,e,n)){var t,r,a=e.changedTouches,u=i.call(this,e,n),c=a.length;for(t=0;t<c;++t)(r=x(this,u,e,n,a[t].identifier,a[t]))&&(pm(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])&&(gm(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])&&(pm(e),t("end",e,o[n]))}function x(e,n,t,r,o,i){var u,d,h,v=s.copy(),p=fm(i||t,n);if(null!=(h=a.call(e,new wm("beforestart",{sourceEvent:t,target:f,identifier:o,active:l,x:p[0],y:p[1],dx:0,dy:0,dispatch:v}),r)))return u=h.x-p[0]||0,d=h.y-p[1]||0,function t(i,a,s){var g,y=p;switch(i){case"start":c[o]=t,g=l++;break;case"end":delete c[o],--l;case"drag":p=fm(s||a,n),g=l}v.call(i,e,new wm(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:xm(!!e),f):o},f.container=function(e){return arguments.length?(i="function"==typeof e?e:xm(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:xm(e),f):a},f.touchable=function(e){return arguments.length?(u="function"==typeof e?e:xm(!!e),f):u},f.on=function(){var e=s.on.apply(s,arguments);return e===s?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}().on("start",(function(e){var n=t(),r=n.domNode,o=n.nodeDragThreshold,i=n.transform,u=n.snapGrid,c=n.snapToGrid;0===o&&b(e);var s=Iv(e.sourceEvent,{transform:i,snapGrid:u,snapToGrid:c});a=s,d=(null==r?void 0:r.getBoundingClientRect())||null,l=Av(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=Iv(e.sourceEvent,{transform:u,snapGrid:h,snapToGrid:v});if(!s&&i&&f&&(s=!0,w()),!f){var y=g.xSnapped-(null!==(n=a.x)&&void 0!==n?n:0),m=g.ySnapped-(null!==(r=a.y)&&void 0!==r?r:0);Math.sqrt(y*y+m*m)>p&&b(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&c&&f&&(l=Av(e.sourceEvent,d),x(g,e.sourceEvent))})).on("end",(function(e){if(f&&(s=!1,f=!1,cancelAnimationFrame(u),c.size>0)){var n=t(),r=n.nodeLookup,o=n.updateNodePositions,a=n.onNodeDragStop,l=n.onSelectionDragStop;if(o(c,!1),i||a||!m&&l){var d=L(Mm({nodeId:m,dragItems:c,nodeLookup:r}),2),h=d[0],v=d[1];null==i||i(e.sourceEvent,c,h,v),null==a||a(e.sourceEvent,h,v),m||null==l||l(e.sourceEvent,v)}}})).filter((function(e){var n=e.target;return!e.button&&(!v||!Cm(n,".".concat(v),g))&&(!p||Cm(n,p,g))}));h.call(_)},destroy:function(){null==h||h.on(".drag",null)}}}function Pm(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 Om(e,n){return e||((null==n?void 0:n.classList.contains("target"))?"target":(null==n?void 0:n.classList.contains("source"))?"source":null)}wm.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var jm=function(){return!0},Im=null;function Am(e,n){var t=n.handle,r=n.connectionMode,o=n.fromNodeId,i=n.fromHandleId,a=n.fromType,u=n.doc,c=n.lib,s=n.flowId,l=n.isValidConnection,d=void 0===l?jm:l,f="target"===a,h=t?u.querySelector(".".concat(c,'-flow__handle[data-id="').concat(s,"-").concat(null==t?void 0:t.nodeId,"-").concat(null==t?void 0:t.id,"-").concat(null==t?void 0:t.type,'"]')):null,v=Av(e),p=v.x,g=v.y,y=u.elementFromPoint(p,g),m=(null==y?void 0:y.classList.contains("".concat(c,"-flow__handle")))?y:h,x={handleDomNode:m,isValid:!1,connection:null,endHandle:null};if(m){var w=Om(void 0,m),b=m.getAttribute("data-nodeid"),_=m.getAttribute("data-handleid"),E=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!b)return x;var k={source:f?b:o,sourceHandle:f?_:i,target:f?o:b,targetHandle:f?i:_};x.connection=k,E&&S&&(r===exports.ConnectionMode.Strict?f&&"source"===w||!f&&"target"===w:b!==o||_!==i)&&(x.endHandle={nodeId:b,handleId:_,type:w},x.isValid=d(k))}return x}var zm={onPointerDown:function(e,n){var t,r=n.connectionMode,o=n.connectionRadius,i=n.handleId,a=n.nodeId,u=n.edgeUpdaterType,c=n.isTarget,s=n.domNode,l=n.nodeLookup,d=n.lib,f=n.autoPanOnConnect,h=n.flowId,v=n.panBy,p=n.cancelConnection,g=n.onConnectStart,y=n.onConnect,m=n.onConnectEnd,x=n.isValidConnection,w=void 0===x?jm:x,b=n.onEdgeUpdateEnd,_=n.updateConnection,E=n.getTransform,S=n.getConnectionStartHandle,k=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)}(e.target),C=0,M=Av(e),N=M.x,P=M.y,O=null==k?void 0:k.elementFromPoint(N,P),j=Om(u,O),I=null==s?void 0:s.getBoundingClientRect();if(I&&j){var A=Av(e,I),z=!1,D=null,R=!1,V=null,H=function(e){var n,t,r=e.nodeLookup,o=e.nodeId,i=e.handleId,a=e.handleType,u=[];try{for(var c=T(r),s=c.next();!s.done;s=c.next()){var l=L(s.value,2)[1];if(l.internals.handleBounds){var d="".concat(o,"-").concat(i,"-").concat(a),f=Pm(l,l.internals.handleBounds,"source",d),h=Pm(l,l.internals.handleBounds,"target",d);u.push.apply(u,B(B([],L(f),!1),L(h),!1))}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return u}({nodeLookup:l,nodeId:a,handleId:i,handleType:j});_({connectionPosition:A,connectionStatus:null,connectionStartHandle:Im={nodeId:a,handleId:i,type:j},connectionEndHandle:null}),null==g||g(e,{nodeId:a,handleId:i,handleType:j}),k.addEventListener("mousemove",X),k.addEventListener("mouseup",Z),k.addEventListener("touchmove",X),k.addEventListener("touchend",Z)}function Y(){if(f&&I){var e=L(xv(A,I),2),n=e[0],t=e[1];v({x:n,y:t}),C=requestAnimationFrame(Y)}}function X(e){S()||Z(e);var n=E();A=Av(e,I),t=function(e,n,t){var r,o,i=[],a=1/0;try{for(var u=T(t),c=u.next();!c.done;c=u.next()){var s=c.value,l=Math.sqrt(Math.pow(s.x-e.x,2)+Math.pow(s.y-e.y,2));l<=n&&(l<a?i=[s]:l===a&&i.push(s),a=l)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}return i.length?1===i.length?i[0]:i.find((function(e){return"target"===e.type}))||i[0]:null}(kv(A,n,!1,[1,1]),o,H),z||(Y(),z=!0);var u,s,l,f=Am(e,{handle:t,connectionMode:r,fromNodeId:a,fromHandleId:i,fromType:c?"target":"source",isValidConnection:w,doc:k,lib:d,flowId:h});V=f.handleDomNode,D=f.connection,R=f.isValid,_({connectionStartHandle:Im,connectionPosition:t&&R?Cv({x:t.x,y:t.y},n):A,connectionStatus:(u=!!t,s=R,l=null,s?l="valid":u&&!s&&(l="invalid"),l),connectionEndHandle:f.endHandle})}function Z(e){(t||V)&&D&&R&&(null==y||y(D)),null==m||m(e),u&&(null==b||b(e)),p(),cancelAnimationFrame(C),z=!1,R=!1,D=null,V=null,Im=null,k.removeEventListener("mousemove",X),k.removeEventListener("mouseup",Z),k.removeEventListener("touchmove",X),k.removeEventListener("touchend",Z)}},isValid:Am};function Tm(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function Lm(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function Bm(){}var Dm=.7,Rm=1/Dm,Vm="\\s*([+-]?\\d+)\\s*",Hm="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ym="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Xm=/^#([0-9a-f]{3,8})$/,Zm=new RegExp(`^rgb\\(${Vm},${Vm},${Vm}\\)$`),Fm=new RegExp(`^rgb\\(${Ym},${Ym},${Ym}\\)$`),Um=new RegExp(`^rgba\\(${Vm},${Vm},${Vm},${Hm}\\)$`),Wm=new RegExp(`^rgba\\(${Ym},${Ym},${Ym},${Hm}\\)$`),Gm=new RegExp(`^hsl\\(${Hm},${Ym},${Ym}\\)$`),qm=new RegExp(`^hsla\\(${Hm},${Ym},${Ym},${Hm}\\)$`),$m={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 Km(){return this.rgb().formatHex()}function Qm(){return this.rgb().formatRgb()}function Jm(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=Xm.exec(e))?(t=n[1].length,n=parseInt(n[1],16),6===t?ex(n):3===t?new rx(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===t?nx(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===t?nx(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Zm.exec(e))?new rx(n[1],n[2],n[3],1):(n=Fm.exec(e))?new rx(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Um.exec(e))?nx(n[1],n[2],n[3],n[4]):(n=Wm.exec(e))?nx(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Gm.exec(e))?sx(n[1],n[2]/100,n[3]/100,1):(n=qm.exec(e))?sx(n[1],n[2]/100,n[3]/100,n[4]):$m.hasOwnProperty(e)?ex($m[e]):"transparent"===e?new rx(NaN,NaN,NaN,0):null}function ex(e){return new rx(e>>16&255,e>>8&255,255&e,1)}function nx(e,n,t,r){return r<=0&&(e=n=t=NaN),new rx(e,n,t,r)}function tx(e,n,t,r){return 1===arguments.length?((o=e)instanceof Bm||(o=Jm(o)),o?new rx((o=o.rgb()).r,o.g,o.b,o.opacity):new rx):new rx(e,n,t,null==r?1:r);var o}function rx(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}function ox(){return`#${cx(this.r)}${cx(this.g)}${cx(this.b)}`}function ix(){const e=ax(this.opacity);return`${1===e?"rgb(":"rgba("}${ux(this.r)}, ${ux(this.g)}, ${ux(this.b)}${1===e?")":`, ${e})`}`}function ax(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ux(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function cx(e){return((e=ux(e))<16?"0":"")+e.toString(16)}function sx(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new dx(e,n,t,r)}function lx(e){if(e instanceof dx)return new dx(e.h,e.s,e.l,e.opacity);if(e instanceof Bm||(e=Jm(e)),!e)return new dx;if(e instanceof dx)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 dx(a,u,c,e.opacity)}function dx(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}function fx(e){return(e=(e||0)%360)<0?e+360:e}function hx(e){return Math.max(0,Math.min(1,e||0))}function vx(e,n,t){return 255*(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)}Tm(Bm,Jm,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Km,formatHex:Km,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return lx(this).formatHsl()},formatRgb:Qm,toString:Qm}),Tm(rx,tx,Lm(Bm,{brighter(e){return e=null==e?Rm:Math.pow(Rm,e),new rx(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Dm:Math.pow(Dm,e),new rx(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new rx(ux(this.r),ux(this.g),ux(this.b),ax(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:ox,formatHex:ox,formatHex8:function(){return`#${cx(this.r)}${cx(this.g)}${cx(this.b)}${cx(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ix,toString:ix})),Tm(dx,(function(e,n,t,r){return 1===arguments.length?lx(e):new dx(e,n,t,null==r?1:r)}),Lm(Bm,{brighter(e){return e=null==e?Rm:Math.pow(Rm,e),new dx(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Dm:Math.pow(Dm,e),new dx(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 rx(vx(e>=240?e-240:e+120,o,r),vx(e,o,r),vx(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new dx(fx(this.h),hx(this.s),hx(this.l),ax(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=ax(this.opacity);return`${1===e?"hsl(":"hsla("}${fx(this.h)}, ${100*hx(this.s)}%, ${100*hx(this.l)}%${1===e?")":`, ${e})`}`}}));var px=e=>()=>e;function gx(e,n){var t=n-e;return t?function(e,n){return function(t){return e+t*n}}(e,t):px(isNaN(e)?n:e)}var yx=function e(n){var t=function(e){return 1==(e=+e)?gx: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):px(isNaN(n)?t:n)}}(n);function r(e,n){var r=t((e=tx(e)).r,(n=tx(n)).r),o=t(e.g,n.g),i=t(e.b,n.b),a=gx(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 mx(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}var xx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wx=new RegExp(xx.source,"g");function bx(e,n){var t,r,o,i=xx.lastIndex=wx.lastIndex=0,a=-1,u=[],c=[];for(e+="",n+="";(t=xx.exec(e))&&(r=wx.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:mx(t,r)})),i=wx.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 _x,Ex=180/Math.PI,Sx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function kx(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)*Ex,skewX:Math.atan(c)*Ex,scaleX:a,scaleY:u}}function Cx(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:mx(e,o)},{i:c-2,x:mx(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:mx(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:mx(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:mx(e,t)},{i:u-2,x:mx(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 Mx=Cx((function(e){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Sx:kx(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),Nx=Cx((function(e){return null==e?Sx:(_x||(_x=document.createElementNS("http://www.w3.org/2000/svg","g")),_x.setAttribute("transform",e),(e=_x.transform.baseVal.consolidate())?kx((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Sx)}),", ",")",")");function Px(e){return((e=Math.exp(e))+1/e)/2}var Ox,jx,Ix=function e(n,t,r){function o(e,o){var i,a,u=e[0],c=e[1],s=e[2],l=o[0],d=o[1],f=o[2],h=l-u,v=d-c,p=h*h+v*v;if(p<1e-12)a=Math.log(f/s)/n,i=function(e){return[u+e*h,c+e*v,s*Math.exp(n*e*a)]};else{var g=Math.sqrt(p),y=(f*f-s*s+r*p)/(2*s*t*g),m=(f*f-s*s-r*p)/(2*f*t*g),x=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(m*m+1)-m);a=(w-x)/n,i=function(e){var r,o=e*a,i=Px(x),l=s/(t*g)*(i*(r=n*o+x,((r=Math.exp(2*r))-1)/(r+1))-function(e){return((e=Math.exp(e))-1/e)/2}(x));return[u+l*h,c+l*v,s*i/Px(n*o+x)]}}return i.duration=1e3*a*n/Math.SQRT2,i}return o.rho=function(n){var t=Math.max(.001,+n),r=t*t;return e(t,r,r*r)},o}(Math.SQRT2,2,4),Ax=0,zx=0,Tx=0,Lx=1e3,Bx=0,Dx=0,Rx=0,Vx="object"==typeof performance&&performance.now?performance:Date,Hx="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Yx(){return Dx||(Hx(Xx),Dx=Vx.now()+Rx)}function Xx(){Dx=0}function Zx(){this._call=this._time=this._next=null}function Fx(e,n,t){var r=new Zx;return r.restart(e,n,t),r}function Ux(){Dx=(Bx=Vx.now())+Rx,Ax=zx=0;try{!function(){Yx(),++Ax;for(var e,n=Ox;n;)(e=Dx-n._time)>=0&&n._call.call(void 0,e),n=n._next;--Ax}()}finally{Ax=0,function(){for(var e,n,t=Ox,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:Ox=n);jx=e,Gx(r)}(),Dx=0}}function Wx(){var e=Vx.now(),n=e-Bx;n>Lx&&(Rx-=n,Bx=e)}function Gx(e){Ax||(zx&&(zx=clearTimeout(zx)),e-Dx>24?(e<1/0&&(zx=setTimeout(Ux,e-Vx.now()-Rx)),Tx&&(Tx=clearInterval(Tx))):(Tx||(Bx=Vx.now(),Tx=setInterval(Wx,Lx)),Ax=1,Hx(Ux)))}function qx(e,n,t){var r=new Zx;return n=null==n?0:+n,r.restart((t=>{r.stop(),e(t+n)}),n,t),r}Zx.prototype=Fx.prototype={constructor:Zx,restart:function(e,n,t){if("function"!=typeof e)throw new TypeError("callback is not a function");t=(null==t?Yx():+t)+(null==n?0:+n),this._next||jx===this||(jx?jx._next=this:Ox=this,jx=this),this._call=e,this._time=t,Gx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gx())}};var $x=$g("start","end","cancel","interrupt"),Kx=[],Qx=0,Jx=2,ew=3,nw=5,tw=6;function rw(e,n,t,r,o,i){var a=e.__transition;if(a){if(t in a)return}else e.__transition={};!function(e,n,t){var r,o=e.__transition;function i(c){var s,l,d,f;if(1!==t.state)return u();for(s in o)if((f=o[s]).name===t.name){if(f.state===ew)return qx(i);4===f.state?(f.state=tw,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[s]):+s<n&&(f.state=tw,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[s])}if(qx((function(){t.state===ew&&(t.state=4,t.timer.restart(a,t.delay,t.time),a(c))})),t.state=Jx,t.on.call("start",e,e.__data__,t.index,t.group),t.state===Jx){for(t.state=ew,r=new Array(d=t.tween.length),s=0,l=-1;s<d;++s)(f=t.tween[s].value.call(e,e.__data__,t.index,t.group))&&(r[++l]=f);r.length=l+1}}function a(n){for(var o=n<t.duration?t.ease.call(null,n/t.duration):(t.timer.restart(u),t.state=nw,1),i=-1,a=r.length;++i<a;)r[i].call(e,o);t.state===nw&&(t.on.call("end",e,e.__data__,t.index,t.group),u())}function u(){for(var r in t.state=tw,t.timer.stop(),delete o[n],o)return;delete e.__transition}o[n]=t,t.timer=Fx((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:$x,tween:Kx,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Qx})}function ow(e,n){var t=aw(e,n);if(t.state>Qx)throw new Error("too late; already scheduled");return t}function iw(e,n){var t=aw(e,n);if(t.state>ew)throw new Error("too late; already running");return t}function aw(e,n){var t=e.__transition;if(!t||!(t=t[n]))throw new Error("transition not found");return t}function uw(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>Jx&&t.state<nw,t.state=tw,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 cw(e,n){var t,r;return function(){var o=iw(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 sw(e,n,t){var r,o;if("function"!=typeof t)throw new Error;return function(){var i=iw(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:n,value:t},c=0,s=o.length;c<s;++c)if(o[c].name===n){o[c]=u;break}c===s&&o.push(u)}i.tween=o}}function lw(e,n,t){var r=e._id;return e.each((function(){var e=iw(this,r);(e.value||(e.value={}))[n]=t.apply(this,arguments)})),function(e){return aw(e,r).value[n]}}function dw(e,n){var t;return("number"==typeof n?mx:n instanceof Jm?yx:(t=Jm(n))?(n=t,yx):bx)(e,n)}function fw(e){return function(){this.removeAttribute(e)}}function hw(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vw(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 pw(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 gw(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 yw(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 mw(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 xw(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 ww(e,n){return function(){ow(this,e).delay=+n.apply(this,arguments)}}function bw(e,n){return n=+n,function(){ow(this,e).delay=n}}function _w(e,n){return function(){iw(this,e).duration=+n.apply(this,arguments)}}function Ew(e,n){return n=+n,function(){iw(this,e).duration=n}}var Sw=lm.prototype.constructor;function kw(e){return function(){this.style.removeProperty(e)}}var Cw=0;function Mw(e,n,t,r){this._groups=e,this._parents=n,this._name=t,this._id=r}function Nw(){return++Cw}var Pw=lm.prototype;Mw.prototype={constructor:Mw,select:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=uy(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,s=r[a],l=s.length,d=i[a]=new Array(l),f=0;f<l;++f)(u=s[f])&&(c=e.call(u,u.__data__,f,s))&&("__data__"in u&&(c.__data__=u.__data__),d[f]=c,rw(d[f],n,t,f,d,aw(u,t)));return new Mw(i,this._parents,n,t)},selectAll:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=sy(e));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var c,s=r[u],l=s.length,d=0;d<l;++d)if(c=s[d]){for(var f,h=e.call(c,c.__data__,d,s),v=aw(c,t),p=0,g=h.length;p<g;++p)(f=h[p])&&rw(f,n,t,p,h,v);i.push(h),a.push(c)}return new Mw(i,a,n,t)},selectChild:Pw.selectChild,selectChildren:Pw.selectChildren,filter:function(e){"function"!=typeof e&&(e=ly(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],s=0;s<u;++s)(i=a[s])&&e.call(i,i.__data__,s,a)&&c.push(i);return new Mw(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,t=e._groups,r=n.length,o=t.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var c,s=n[u],l=t[u],d=s.length,f=a[u]=new Array(d),h=0;h<d;++h)(c=s[h]||l[h])&&(f[h]=c);for(;u<r;++u)a[u]=n[u];return new Mw(a,this._parents,this._name,this._id)},selection:function(){return new Sw(this._groups,this._parents)},transition:function(){for(var e=this._name,n=this._id,t=Nw(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,s=0;s<c;++s)if(a=u[s]){var l=aw(a,n);rw(a,e,t,s,u,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new Mw(r,this._parents,e,t)},call:Pw.call,nodes:Pw.nodes,node:Pw.node,size:Pw.size,empty:Pw.empty,each:Pw.each,on:function(e,n){var t=this._id;return arguments.length<2?aw(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)?ow:iw;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=ty(e),r="transform"===t?Nx:dw;return this.attrTween(e,"function"==typeof n?(t.local?yw:gw)(t,r,lw(this,"attr."+e,n)):null==n?(t.local?hw:fw)(t):(t.local?pw:vw)(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=ty(e);return this.tween(t,(r.local?mw:xw)(r,n))},style:function(e,n,t){var r="transform"==(e+="")?Mx:dw;return null==n?this.styleTween(e,function(e,n){var t,r,o;return function(){var i=Ay(this,e),a=(this.style.removeProperty(e),Ay(this,e));return i===a?null:i===t&&a===r?o:o=n(t=i,r=a)}}(e,r)).on("end.style."+e,kw(e)):"function"==typeof n?this.styleTween(e,function(e,n,t){var r,o,i;return function(){var a=Ay(this,e),u=t(this),c=u+"";return null==u&&(this.style.removeProperty(e),c=u=Ay(this,e)),a===c?null:a===r&&c===o?i:(o=c,i=n(r=a,u))}}(e,r,lw(this,"style."+e,n))).each(function(e,n){var t,r,o,i,a="style."+n,u="end."+a;return function(){var c=iw(this,e),s=c.on,l=null==c.value[a]?i||(i=kw(n)):void 0;s===t&&o===l||(r=(t=s).copy()).on(u,o=l),c.on=r}}(this._id,e)):this.styleTween(e,function(e,n,t){var r,o,i=t+"";return function(){var a=Ay(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}}(lw(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=aw(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?cw:sw)(t,e,n))},delay:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?ww:bw)(n,e)):aw(this.node(),n).delay},duration:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?_w:Ew)(n,e)):aw(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(){iw(this,e).ease=n}}(n,e)):aw(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;iw(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=iw(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]:Pw[Symbol.iterator]};var Ow={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function jw(e,n){for(var t;!(t=e.__transition)||!(t=t[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return t}lm.prototype.interrupt=function(e){return this.each((function(){uw(this,e)}))},lm.prototype.transition=function(e){var n,t;e instanceof Mw?(n=e._id,e=e._name):(n=Nw(),(t=Ow).time=Yx(),e=null==e?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,s=0;s<c;++s)(a=u[s])&&rw(a,e,n,s,u,t||jw(a,n));return new Mw(r,this._parents,e,n)};var Iw=e=>()=>e;function Aw(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 zw(e,n,t){this.k=e,this.x=n,this.y=t}zw.prototype={constructor:zw,scale:function(e){return 1===e?this:new zw(this.k*e,this.x,this.y)},translate:function(e,n){return 0===e&0===n?this:new zw(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 Tw=new zw(1,0,0);function Lw(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Tw;return e.__zoom}function Bw(e){e.stopImmediatePropagation()}function Dw(e){e.preventDefault(),e.stopImmediatePropagation()}function Rw(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Vw(){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 Hw(){return this.__zoom||Tw}function Yw(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Xw(){return navigator.maxTouchPoints||"ontouchstart"in this}function Zw(e,n,t){var r=e.invertX(n[0][0])-t[0][0],o=e.invertX(n[1][0])-t[1][0],i=e.invertY(n[0][1])-t[0][1],a=e.invertY(n[1][1])-t[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}Lw.prototype=zw.prototype;var Fw,Uw=function(e,n){return e.x!==n.x||e.y!==n.y||e.zoom!==n.k},Ww=function(e){return{x:e.x,y:e.y,zoom:e.k}},Gw=function(e){var n=e.x,t=e.y,r=e.zoom;return Tw.translate(n,t).scale(r)},qw=function(e,n){return e.target.closest(".".concat(n))},$w=function(e,n){return 2===n&&Array.isArray(e)&&e.includes(2)},Kw=function(e,n){return void 0===n&&(n=0),"number"==typeof n&&n>0?e.transition().duration(n):e},Qw=function(e){var n=e.ctrlKey&&Nv()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*n};function Jw(e){var n=e.domNode,t=e.minZoom,r=e.maxZoom,o=e.translateExtent,i=e.viewport,a=e.onPanZoom,u=e.onPanZoomStart,c=e.onPanZoomEnd,s=e.onTransformChange,l=e.onDraggingChange,d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=n.getBoundingClientRect(),h=function(){var e,n,t,r=Rw,o=Vw,i=Zw,a=Yw,u=Xw,c=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,d=Ix,f=$g("start","zoom","end"),h=500,v=150,p=0,g=10;function y(e){e.property("__zoom",Hw).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",C).filter(u).on("touchstart.zoom",M).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",P).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,n){return(n=Math.max(c[0],Math.min(c[1],n)))===e.k?e:new zw(n,e.x,e.y)}function x(e,n,t){var r=n[0]-t[0]*e.k,o=n[1]-t[1]*e.k;return r===e.x&&o===e.y?e:new zw(e.k,r,o)}function w(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function b(e,n,t,r){e.on("start.zoom",(function(){_(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){_(this,arguments).event(r).end()})).tween("zoom",(function(){var e=this,i=arguments,a=_(e,i).event(r),u=o.apply(e,i),c=null==t?w(u):"function"==typeof t?t.apply(e,i):t,s=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),l=e.__zoom,f="function"==typeof n?n.apply(e,i):n,h=d(l.invert(c).concat(s/l.k),f.invert(c).concat(s/f.k));return function(e){if(1===e)e=f;else{var n=h(e),t=s/n[2];e=new zw(t,c[0]-n[0]*t,c[1]-n[1]*t)}a.zoom(null,e)}}))}function _(e,n,t){return!t&&e.__zooming||new E(e,n)}function E(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=o.apply(e,n),this.taps=0}function S(e,...n){if(r.apply(this,arguments)){var t=_(this,n).event(e),o=this.__zoom,u=Math.max(c[0],Math.min(c[1],o.k*Math.pow(2,a.apply(this,arguments)))),l=fm(e);if(t.wheel)t.mouse[0][0]===l[0]&&t.mouse[0][1]===l[1]||(t.mouse[1]=o.invert(t.mouse[0]=l)),clearTimeout(t.wheel);else{if(o.k===u)return;t.mouse=[l,o.invert(l)],uw(this),t.start()}Dw(e),t.wheel=setTimeout((function(){t.wheel=null,t.end()}),v),t.zoom("mouse",i(x(m(o,u),t.mouse[0],t.mouse[1]),t.extent,s))}}function k(e,...n){if(!t&&r.apply(this,arguments)){var o=e.currentTarget,a=_(this,n,!0).event(e),u=dm(e.view).on("mousemove.zoom",(function(e){if(Dw(e),!a.moved){var n=e.clientX-l,t=e.clientY-d;a.moved=n*n+t*t>p}a.event(e).zoom("mouse",i(x(a.that.__zoom,a.mouse[0]=fm(e,o),a.mouse[1]),a.extent,s))}),!0).on("mouseup.zoom",(function(e){u.on("mousemove.zoom mouseup.zoom",null),mm(e.view,a.moved),Dw(e),a.event(e).end()}),!0),c=fm(e,o),l=e.clientX,d=e.clientY;ym(e.view),Bw(e),a.mouse=[c,this.__zoom.invert(c)],uw(this),a.start()}}function C(e,...n){if(r.apply(this,arguments)){var t=this.__zoom,a=fm(e.changedTouches?e.changedTouches[0]:e,this),u=t.invert(a),c=t.k*(e.shiftKey?.5:2),d=i(x(m(t,c),a,u),o.apply(this,n),s);Dw(e),l>0?dm(this).transition().duration(l).call(b,d,a,e):dm(this).call(y.transform,d,a,e)}}function M(t,...o){if(r.apply(this,arguments)){var i,a,u,c,s=t.touches,l=s.length,d=_(this,o,t.changedTouches.length===l).event(t);for(Bw(t),a=0;a<l;++a)c=[c=fm(u=s[a],this),this.__zoom.invert(c),u.identifier],d.touch0?d.touch1||d.touch0[2]===c[2]||(d.touch1=c,d.taps=0):(d.touch0=c,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(n=c[0],e=setTimeout((function(){e=null}),h)),uw(this),d.start())}}function N(e,...n){if(this.__zooming){var t,r,o,a,u=_(this,n).event(e),c=e.changedTouches,l=c.length;for(Dw(e),t=0;t<l;++t)o=fm(r=c[t],this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=o:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=o);if(r=u.that.__zoom,u.touch1){var d=u.touch0[0],f=u.touch0[1],h=u.touch1[0],v=u.touch1[1],p=(p=h[0]-d[0])*p+(p=h[1]-d[1])*p,g=(g=v[0]-f[0])*g+(g=v[1]-f[1])*g;r=m(r,Math.sqrt(p/g)),o=[(d[0]+h[0])/2,(d[1]+h[1])/2],a=[(f[0]+v[0])/2,(f[1]+v[1])/2]}else{if(!u.touch0)return;o=u.touch0[0],a=u.touch0[1]}u.zoom("touch",i(x(r,o,a),u.extent,s))}}function P(e,...r){if(this.__zooming){var o,i,a=_(this,r).event(e),u=e.changedTouches,c=u.length;for(Bw(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=fm(i,this),Math.hypot(n[0]-i[0],n[1]-i[1])<g)){var s=dm(this).on("dblclick.zoom");s&&s.apply(this,arguments)}}}return y.transform=function(e,n,t,r){var o=e.selection?e.selection():e;o.property("__zoom",Hw),e!==o?b(e,n,t,r):o.interrupt().each((function(){_(this,arguments).event(r).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()}))},y.scaleBy=function(e,n,t,r){y.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)}),t,r)},y.scaleTo=function(e,n,t,r){y.transform(e,(function(){var e=o.apply(this,arguments),r=this.__zoom,a=null==t?w(e):"function"==typeof t?t.apply(this,arguments):t,u=r.invert(a),c="function"==typeof n?n.apply(this,arguments):n;return i(x(m(r,c),a,u),e,s)}),t,r)},y.translateBy=function(e,n,t,r){y.transform(e,(function(){return i(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof t?t.apply(this,arguments):t),o.apply(this,arguments),s)}),null,r)},y.translateTo=function(e,n,t,r,a){y.transform(e,(function(){var e=o.apply(this,arguments),a=this.__zoom,u=null==r?w(e):"function"==typeof r?r.apply(this,arguments):r;return i(Tw.translate(u[0],u[1]).scale(a.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof t?-t.apply(this,arguments):-t),e,s)}),r,a)},E.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,n){return this.mouse&&"mouse"!==e&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var n=dm(this.that).datum();f.call(e,this.that,new Aw(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:Iw(+e),y):a},y.filter=function(e){return arguments.length?(r="function"==typeof e?e:Iw(!!e),y):r},y.touchable=function(e){return arguments.length?(u="function"==typeof e?e:Iw(!!e),y):u},y.extent=function(e){return arguments.length?(o="function"==typeof e?e:Iw([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),y):o},y.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],y):[c[0],c[1]]},y.translateExtent=function(e){return arguments.length?(s[0][0]=+e[0][0],s[1][0]=+e[1][0],s[0][1]=+e[0][1],s[1][1]=+e[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(e){return arguments.length?(i=e,y):i},y.duration=function(e){return arguments.length?(l=+e,y):l},y.interpolate=function(e){return arguments.length?(d=e,y):d},y.on=function(){var e=f.on.apply(f,arguments);return e===f?y:e},y.clickDistance=function(e){return arguments.length?(p=(e=+e)*e,y):Math.sqrt(p)},y.tapDistance=function(e){return arguments.length?(g=+e,y):g},y}().scaleExtent([t,r]).translateExtent(o),v=dm(n).call(h);x({x:i.x,y:i.y,zoom:gv(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(Kw(v,null==n?void 0:n.duration),e))}function m(){h.on("zoom",null)}function x(e,n,t){var r=Gw(e),o=null==h?void 0:h.constrain()(r,n,t);return o&&y(o),o}return h.wheelDelta(Qw),{update:function(e){var n=e.noWheelClassName,t=e.noPanClassName,r=e.onPaneContextMenu,o=e.userSelectionActive,i=e.panOnScroll,f=e.panOnDrag,y=e.panOnScrollMode,x=e.panOnScrollSpeed,w=e.preventScrolling,b=e.zoomOnPinch,_=e.zoomOnScroll,E=e.zoomOnDoubleClick,S=e.zoomActivationKeyPressed,k=e.lib;o&&!d.isZoomingOrPanning&&m();var C=!i||S||o?function(e){var n=e.noWheelClassName,t=e.preventScrolling,r=e.d3ZoomHandler;return function(e,o){if(!t&&"wheel"===e.type&&!e.ctrlKey||qw(e,n))return null;e.preventDefault(),r.call(this,e,o)}}({noWheelClassName:n,preventScrolling:w,d3ZoomHandler:p}):function(e){var n=e.zoomPanValues,t=e.noWheelClassName,r=e.d3Selection,o=e.d3Zoom,i=e.panOnScrollMode,a=e.panOnScrollSpeed,u=e.zoomOnPinch,c=e.onPanZoomStart,s=e.onPanZoom,l=e.onPanZoomEnd;return function(e){if(qw(e,t))return!1;e.preventDefault(),e.stopImmediatePropagation();var d=r.property("__zoom").k||1;if(e.ctrlKey&&u){var f=fm(e),h=Qw(e),v=d*Math.pow(2,h);o.scaleTo(r,v,f,e)}else{var p=1===e.deltaMode?20:1,g=i===exports.PanOnScrollMode.Vertical?0:e.deltaX*p,y=i===exports.PanOnScrollMode.Horizontal?0:e.deltaY*p;!Nv()&&e.shiftKey&&i!==exports.PanOnScrollMode.Vertical&&(g=e.deltaY*p,y=0),o.translateBy(r,-g/d*a,-y/d*a,{internal:!0});var m=Ww(r.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling||(n.isPanScrolling=!0,null==c||c(e,m)),n.isPanScrolling&&(null==s||s(e,m),n.panScrollTimeout=setTimeout((function(){null==l||l(e,m),n.isPanScrolling=!1}),150))}}}({zoomPanValues:d,noWheelClassName:n,d3Selection:v,d3Zoom:h,panOnScrollMode:y,panOnScrollSpeed:x,zoomOnPinch:b,onPanZoomStart:u,onPanZoom:a,onPanZoomEnd:c});if(v.on("wheel.zoom",C,{passive:!1}),!o){var M=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=Ww(e.transform);n.mouseButton=(null===(i=e.sourceEvent)||void 0===i?void 0:i.button)||0,n.isZoomingOrPanning=!0,n.prevViewport=u,"mousedown"===(null===(a=e.sourceEvent)||void 0===a?void 0:a.type)&&t(!0),r&&(null==r||r(e.sourceEvent,u))}}}({zoomPanValues:d,onDraggingChange:l,onPanZoomStart:u});h.on("start",M);var N=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||!$w(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,Ww(e.transform)))}}({zoomPanValues:d,panOnDrag:f,onPaneContextMenu:!!r,onPanZoom:a,onTransformChange:s});h.on("zoom",N);var P=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.panOnScroll,o=e.onDraggingChange,i=e.onPanZoomEnd,a=e.onPaneContextMenu;return function(e){var u,c;if(!(null===(u=e.sourceEvent)||void 0===u?void 0:u.internal)&&(n.isZoomingOrPanning=!1,a&&$w(t,null!==(c=n.mouseButton)&&void 0!==c?c:0)&&!n.usedRightMouseButton&&e.sourceEvent&&a(e.sourceEvent),n.usedRightMouseButton=!1,o(!1),i&&Uw(n.prevViewport,e.transform))){var s=Ww(e.transform);n.prevViewport=s,clearTimeout(n.timerId),n.timerId=setTimeout((function(){null==i||i(e.sourceEvent,s)}),r?150:0)}}}({zoomPanValues:d,panOnDrag:f,panOnScroll:i,onPaneContextMenu:r,onPanZoomEnd:c,onDraggingChange:l});h.on("end",P)}var O=function(e){var n=e.zoomActivationKeyPressed,t=e.zoomOnScroll,r=e.zoomOnPinch,o=e.panOnDrag,i=e.panOnScroll,a=e.zoomOnDoubleClick,u=e.userSelectionActive,c=e.noWheelClassName,s=e.noPanClassName,l=e.lib;return function(e){var d=n||t,f=r&&e.ctrlKey;if(1===e.button&&"mousedown"===e.type&&(qw(e,"".concat(l,"-flow__node"))||qw(e,"".concat(l,"-flow__edge"))))return!0;if(!(o||d||i||a||r))return!1;if(u)return!1;if(qw(e,c)&&"wheel"===e.type)return!1;if(qw(e,s)&&("wheel"!==e.type||i&&"wheel"===e.type&&!n))return!1;if(!r&&e.ctrlKey&&"wheel"===e.type)return!1;if(!d&&!i&&!f&&"wheel"===e.type)return!1;if(!o&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(o)&&!o.includes(e.button)&&"mousedown"===e.type)return!1;var h=Array.isArray(o)&&o.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||"wheel"===e.type)&&h}}({zoomActivationKeyPressed:S,panOnDrag:f,zoomOnScroll:_,panOnScroll:i,zoomOnDoubleClick:E,zoomOnPinch:b,userSelectionActive:o,noPanClassName:t,noWheelClassName:n,lib:k});h.filter(O),E?v.on("dblclick.zoom",g):v.on("dblclick.zoom",null)},destroy:m,setViewport:function(e,n){var t=Gw(e);return y(t,n),t},setViewportConstrained:x,getViewport:function(){var e=v?Lw(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(Kw(v,null==n?void 0:n.duration),e))},scaleBy:function(e,n){v&&(null==h||h.scaleBy(Kw(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=Gw(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"}(Fw||(Fw={}));z(z({},{width:0,height:0,x:0,y:0}),{pointerX:0,pointerY:0,aspectRatio:1});var eb=uv.error001();function nb(n,t){var r=e.useContext(I);if(null===r)throw new Error(eb);return O(r,n,t)}function tb(){var n=e.useContext(I);if(null===n)throw new Error(eb);return e.useMemo((function(){return{getState:n.getState,setState:n.setState,subscribe:n.subscribe}}),[n])}function rb(e,n){var r,o,i;void 0===n&&(n={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{}});var c=(null==n?void 0:n.elevateNodesOnSelect)?1e3:0;try{for(var s=a(e),l=s.next();!l.done;l=s.next()){var d=u(l.value,2)[1],f=d.parentId;if(f){if(!e.has(f))throw new Error("Parent node ".concat(f," not found"));var h=e.get(f),v=ob(d,e,t(t({},d.position),{z:(fb(d.zIndex)?d.zIndex:0)+(d.selected?c:0)}),null!==(i=null==h?void 0:h.origin)&&void 0!==i?i:n.nodeOrigin),p=v.x,g=v.y,y=v.z,m=d.internals.positionAbsolute,x=p!==m.x||g!==m.y;(x||y!==d.internals.z)&&(d.internals=t(t({},d.internals),{positionAbsolute:x?{x:p,y:g}:m,z:y}))}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}function ob(e,n,t,r){var o,i,a,u,c,s;if(void 0===r&&(r=[0,0]),!e.parentId)return t;var l=n.get(e.parentId),d=ib(l,r).position;return ob(l,n,{x:(null!==(o=t.x)&&void 0!==o?o:0)+d.x,y:(null!==(i=t.y)&&void 0!==i?i:0)+d.y,z:(null!==(a=l.internals.z)&&void 0!==a?a:0)>(null!==(u=t.z)&&void 0!==u?u:0)?null!==(c=l.internals.z)&&void 0!==c?c:0:null!==(s=t.z)&&void 0!==s?s:0},l.origin||r)}var ib=function(e,n){void 0===n&&(n=[0,0]);var t=db(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 ab(e,n,t){var r,o;e.clear(),n.clear();try{for(var i=a(t),u=i.next();!u.done;u=i.next()){var c=u.value,s=c.source,l=c.target,d=c.sourceHandle,f=void 0===d?null:d,h=c.targetHandle,v=void 0===h?null:h,p="".concat(s,"-source-").concat(f),g="".concat(l,"-target-").concat(v),y=e.get(p)||new Map,m=e.get(g)||new Map,x={edgeId:c.id,source:s,target:l,sourceHandle:f,targetHandle:v};n.set(c.id,c),e.set(p,y.set("".concat(l,"-").concat(v),x)),e.set(g,m.set("".concat(s,"-").concat(f),x))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}function ub(e,n,r,o){void 0===o&&(o={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{},checkEquality:!0});var i=new Map(n);n.clear(),r.clear();var a=(null==o?void 0:o.elevateNodesOnSelect)?1e3:0;e.forEach((function(e){var u,c,s=i.get(e.id);if(o.checkEquality&&e===(null==s?void 0:s.internals.userNode)||(s=t(t(t({},o.defaults),e),{measured:{width:null===(u=e.measured)||void 0===u?void 0:u.width,height:null===(c=e.measured)||void 0===c?void 0:c.height},internals:{positionAbsolute:e.position,handleBounds:null==s?void 0:s.internals.handleBounds,z:(fb(e.zIndex)?e.zIndex:0)+(e.selected?a:0),userNode:e}})),n.set(e.id,s),e.parentId){var l=r.get(e.parentId);l?l.push(s):r.set(e.parentId,[s])}})),r.size>0&&rb(n,o)}function cb(e,n,t,r){var o,i,u,c,s,l=[],d=new Map;try{for(var f=a(e),h=f.next();!h.done;h=f.next()){var v=h.value,p=n.get(v.parentId);if(p){var g=null!==(c=null===(u=d.get(v.parentId))||void 0===u?void 0:u.expandedRect)&&void 0!==c?c:pb(p,null!==(s=p.origin)&&void 0!==s?s:r),y=xb(g,v.rect);d.set(v.parentId,{expandedRect:y,parent:p})}}}catch(e){o={error:e}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(o)throw o.error}}return d.size>0&&d.forEach((function(n,r){var o=n.expandedRect,i=n.parent,a=ib(i,i.origin).position,u=db(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 sb=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},lb=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:sb(e.x,n[0][0],n[1][0]),y:sb(e.y,n[0][1],n[1][1])}};function db(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 fb=function(e){return!isNaN(e)&&isFinite(e)},hb=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])}},vb=function(e,n,t,r){var o=e.x,i=e.y,a=u(n,3),c=a[0],s=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var d={x:(o-c)/l,y:(i-s)/l};return t?hb(d,r):d},pb=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=ib(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}},gb=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)}},yb=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},mb=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},xb=function(e,n){return mb(gb(yb(e),yb(n)))};function wb(n){return e.forwardRef(n)}var bb=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)},_b=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),s=sb(c,r,o);return{x:n/2-(e.x+e.width/2)*s,y:t/2-(e.y+e.height/2)*s,zoom:s}};function Eb(e){return void 0!==e&&"parent"!==e}var Sb=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]}},kb=function(e){return Cb(e)},Cb=function(e){return"id"in e&&"position"in e&&!("source"in e)&&!("target"in e)};var Mb=function(e){return fb(e.width)&&fb(e.height)&&fb(e.x)&&fb(e.y)},Nb=function(e){return{width:e.offsetWidth,height:e.offsetHeight}},Pb=["INPUT","SELECT","TEXTAREA"];function Ob(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 Pb.includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}var jb=function(e){return"clientX"in e},Ib=function(e,n){var t,r,o,i,a=jb(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)}},Ab=function(e,n,r,o){void 0===o&&(o=[0,0]);var i=n.querySelectorAll(e);if(!i||!i.length)return null;var a=Array.from(i),u=n.getBoundingClientRect(),c=u.width*o[0],s=u.height*o[1];return a.map((function(e){var n=e.getBoundingClientRect();return t({id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(n.left-u.left-c)/r,y:(n.top-u.top-s)/r},Nb(e))}))},zb="undefined"!=typeof document?document:null;function Tb(n,t){void 0===n&&(n=null),void 0===t&&(t={target:zb,actInsideInputWithModifier:!0});var r=u(e.useState(!1),2),o=r[0],i=r[1],a=e.useRef(!1),s=e.useRef(new Set([])),l=u(e.useMemo((function(){if(null!==n){var e=(Array.isArray(n)?n:[n]).filter((function(e){return"string"==typeof e})).map((function(e){return e.split("+")})),t=e.reduce((function(e,n){return e.concat.apply(e,c([],u(n),!1))}),[]);return[e,t]}return[[],[]]}),[n]),2),d=l[0],f=l[1];return e.useEffect((function(){var e=(null==t?void 0:t.target)||zb;if(null!==n){var r=function(e){if(a.current=e.ctrlKey||e.metaKey||e.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&Ob(e))return!1;var n=Bb(e.code,f);s.current.add(e[n]),Lb(d,s.current,!1)&&(e.preventDefault(),i(!0))},o=function(e){if((!a.current||a.current&&!t.actInsideInputWithModifier)&&Ob(e))return!1;var n=Bb(e.code,f);Lb(d,s.current,!0)?(i(!1),s.current.clear()):s.current.delete(e[n]),"Meta"===e.key&&s.current.clear(),a.current=!1},u=function(){s.current.clear(),i(!1)};return null==e||e.addEventListener("keydown",r),null==e||e.addEventListener("keyup",o),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),function(){null==e||e.removeEventListener("keydown",r),null==e||e.removeEventListener("keyup",o),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}}),[n,i]),o}function Lb(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 Bb(e,n){return n.includes(e)?"code":"key"}function Db(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 Rb={position:"absolute",width:"100%",height:"100%",top:0,left:0};var Vb=function(e){return{userSelectionActive:e.userSelectionActive,lib:e.lib}};function Hb(n){var t=n.onPaneContextMenu,r=n.zoomOnScroll,o=void 0===r||r,i=n.zoomOnPinch,a=void 0===i||i,u=n.panOnScroll,c=void 0!==u&&u,s=n.panOnScrollSpeed,l=void 0===s?.5:s,d=n.panOnScrollMode,f=void 0===d?exports.PanOnScrollMode.Free:d,h=n.zoomOnDoubleClick,p=void 0===h||h,g=n.panOnDrag,y=void 0===g||g,m=n.defaultViewport,x=n.translateExtent,w=n.zoomActivationKeyCode,b=n.preventScrolling,_=void 0===b||b,E=n.children,S=n.noWheelClassName,k=n.noPanClassName,C=n.onViewportChange,M=n.isControlledViewport,N=tb(),P=e.useRef(null),O=nb(Vb,Db),j=O.userSelectionActive,I=O.lib,A=Tb(w),z=e.useRef();return function(n){var t=tb();e.useEffect((function(){var e=function(){var e,r;if(!n.current)return!1;var o=Nb(n.current);0!==o.height&&0!==o.width||null===(r=(e=t.getState()).onError)||void 0===r||r.call(e,"004",uv.error004()),t.setState({width:o.width||500,height:o.height||500})};if(n.current){e(),window.addEventListener("resize",e);var r=new ResizeObserver((function(){return e()}));return r.observe(n.current),function(){window.removeEventListener("resize",e),r&&n.current&&r.unobserve(n.current)}}}),[])}(P),e.useEffect((function(){if(P.current){var e=N.getState();z.current=Jw({domNode:P.current,minZoom:e.minZoom,maxZoom:e.maxZoom,translateExtent:x,viewport:m,onTransformChange:function(e){null==C||C({x:e[0],y:e[1],zoom:e[2]}),M||N.setState({transform:e})},onDraggingChange:function(e){return N.setState({paneDragging:e})},onPanZoomStart:function(e,n){var t=N.getState(),r=t.onViewportChangeStart,o=t.onMoveStart;null==o||o(e,n),null==r||r(n)},onPanZoom:function(e,n){var t=N.getState(),r=t.onViewportChange,o=t.onMove;null==o||o(e,n),null==r||r(n)},onPanZoomEnd:function(e,n){var t=N.getState(),r=t.onViewportChangeEnd,o=t.onMoveEnd;null==o||o(e,n),null==r||r(n)}});var n=z.current.getViewport(),t=n.x,r=n.y,o=n.zoom;return N.setState({panZoom:z.current,transform:[t,r,o],domNode:P.current.closest(".ink-flow")}),function(){var e;null===(e=z.current)||void 0===e||e.destroy()}}}),[]),e.useEffect((function(){var e;null===(e=z.current)||void 0===e||e.update({onPaneContextMenu:t,zoomOnScroll:o,zoomOnPinch:a,panOnScroll:c,panOnScrollSpeed:l,panOnScrollMode:f,zoomOnDoubleClick:p,panOnDrag:y,zoomActivationKeyPressed:A,preventScrolling:_,noPanClassName:k,userSelectionActive:j,noWheelClassName:S,lib:I})}),[t,o,a,c,l,f,p,y,A,_,k,j,S,I]),v.jsx("div",{className:"ink-flow__renderer",ref:P,style:Rb,children:E})}var Yb={actInsideInputWithModifier:!1};function Xb(e,n){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&&(n.measured={width:e.dimensions.width,height:e.dimensions.height},e.setAttributes&&(n.width=e.dimensions.width,n.height=e.dimensions.height)),"boolean"==typeof e.resizing&&(n.resizing=e.resizing)}}function Zb(e,n){var r,o,i,u,c,s,l=[],d=new Map;try{for(var f=a(e),h=f.next();!h.done;h=f.next()){if("add"!==(_=h.value).type)if("remove"===_.type||"replace"===_.type)d.set(_.id,[_]);else{var v=d.get(_.id);v?v.push(_):d.set(_.id,[_])}else l.push(_.item)}}catch(e){r={error:e}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}try{for(var p=a(n),g=p.next();!g.done;g=p.next()){var y=g.value,m=d.get(y.id);if(m){if("remove"!==m[0].type)if("replace"!==m[0].type){var x=t({},y);try{for(var w=(c=void 0,a(m)),b=w.next();!b.done;b=w.next()){var _;Xb(_=b.value,x)}}catch(e){c={error:e}}finally{try{b&&!b.done&&(s=w.return)&&s.call(w)}finally{if(c)throw c.error}}l.push(x)}else l.push(t({},m[0].item))}else l.push(y)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(u=p.return)&&u.call(p)}finally{if(i)throw i.error}}return l}function Fb(e,n){return Zb(e,n)}function Ub(e,n){return Zb(e,n)}function Wb(e,n){return{id:e,type:"select",selected:n}}function Gb(e,n,t){var r,o;void 0===n&&(n=new Set),void 0===t&&(t=!1);var i=[];try{for(var c=a(e),s=c.next();!s.done;s=c.next()){var l=u(s.value,2),d=l[0],f=l[1],h=n.has(d);void 0===f.selected&&!h||f.selected===h||(t&&(f.selected=h),i.push(Wb(f.id,h)))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}return i}function qb(e){var n,t,r,o,i,c,s=e.items,l=void 0===s?[]:s,d=e.lookup,f=[],h=new Map(l.map((function(e){return[e.id,e]})));try{for(var v=a(l),p=v.next();!p.done;p=v.next()){var g=p.value,y=d.get(g.id),m=null!==(c=null===(i=null==y?void 0:y.internals)||void 0===i?void 0:i.userNode)&&void 0!==c?c:y;void 0!==m&&m!==g&&f.push({id:g.id,item:g,type:"replace"}),void 0===m&&f.push({item:g,type:"add"})}}catch(e){n={error:e}}finally{try{p&&!p.done&&(t=v.return)&&t.call(v)}finally{if(n)throw n.error}}try{for(var x=a(d),w=x.next();!w.done;w=x.next()){var b=u(w.value,1)[0];void 0===h.get(b)&&f.push({id:b,type:"remove"})}}catch(e){r={error:e}}finally{try{w&&!w.done&&(o=x.return)&&o.call(x)}finally{if(r)throw r.error}}return f}function $b(e){return{id:e.id,type:"remove"}}var Kb=function(e,n){void 0===n&&(n=[0,0]);var t=db(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}}},Qb=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=ib(e,n).positionAbsolute,s=c.x,l=c.y;return{x:s,y:l,x2:s+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:l+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}}(t,n.nodeOrigin);return gb(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return mb(t)},Jb=function(e,n,r,o,i,c){var s,l,d,f,h,v,p,g,y=u(void 0===r?[0,0,1]:r,3),m=y[0],x=y[1],w=y[2];void 0===o&&(o=!1),void 0===i&&(i=!1),void 0===c&&(c=[0,0]);var b=t(t({},vb(n,[m,x,w])),{width:n.width/w,height:n.height/w}),_=[];try{for(var E=a(e),S=E.next();!S.done;S=E.next()){var k=u(S.value,2)[1],C=k.measured,M=k.selectable,N=void 0===M||M,P=k.hidden,O=void 0!==P&&P,j=null!==(h=null!==(f=null!==(d=C.width)&&void 0!==d?d:k.width)&&void 0!==f?f:k.initialWidth)&&void 0!==h?h:null,I=null!==(g=null!==(p=null!==(v=C.height)&&void 0!==v?v:k.height)&&void 0!==p?p:k.initialHeight)&&void 0!==g?g:null;if(!(i&&!N||O)){var A=bb(b,pb(k,c));(null===j||null===I||o&&A>0||A>=(null!=j?j:0)*(null!=I?I:0)||k.dragging)&&_.push(k)}}}catch(e){s={error:e}}finally{try{S&&!S.done&&(l=E.return)&&l.call(E)}finally{if(s)throw s.error}}return _},e_=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 n_(e,n){var t,r,o,i=e.nodeLookup,a=e.width,u=e.height,c=e.panZoom,s=e.minZoom,l=e.maxZoom,d=e.nodeOrigin,f=void 0===d?[0,0]:d,h=[],v=(null==n?void 0:n.nodes)?new Set(n.nodes.map((function(e){return e.id}))):null;if(i.forEach((function(e){!(e.measured.width&&e.measured.height&&((null==n?void 0:n.includeHiddenNodes)||!e.hidden))||v&&!v.has(e.id)||h.push(e)})),h.length>0){var p=Qb(h,{nodeOrigin:f}),g=p.width>=a||p.height>=u;if("overflow"===(null==n?void 0:n.when)&&!g)return!0;var y=_b(p,a,u,null!==(t=null==n?void 0:n.minZoom)&&void 0!==t?t:s,null!==(r=null==n?void 0:n.maxZoom)&&void 0!==r?r:l,null!==(o=null==n?void 0:n.padding)&&void 0!==o?o:.1);return c.setViewport(y,{duration:null==n?void 0:n.duration}),!0}return!1}function t_(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),s=c.parentId?r.get(c.parentId):void 0,l=s?Kb(s,s.origin||i).positionAbsolute:{x:0,y:0},d=l.x,f=l.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)s&&Eb(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(s){var v=c.measured.width,p=c.measured.height,g=s.measured.width,y=s.measured.height;if(v&&p&&g&&y){var m=c.origin||i,x=d+v*m[0],w=f+p*m[1];h=[[x,w],[x+g-v,w+y-p]]}}else null==u||u("005",uv.error005());var b=Eb(h)?lb(t,h):t;return{position:{x:b.x-d,y:b.y-f},positionAbsolute:b}}function r_(e){return o(this,arguments,void 0,(function(e){var n,t,r,o,u,c,s,l,d,f,h,v,p,g,y,m,x,w,b,_=e.nodesToRemove,E=void 0===_?[]:_,S=e.edgesToRemove,k=void 0===S?[]:S,C=e.nodes,M=e.edges,N=e.onBeforeDelete;return i(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=a(C),u=o.next();!u.done;u=o.next())c=u.value,r(c)}catch(e){m={error:e}}finally{try{u&&!u.done&&(x=o.return)&&x.call(o)}finally{if(m)throw m.error}}s=new Set(k.map((function(e){return e.id}))),l=M.filter((function(e){return!1!==e.deletable})),d=e_(t,l),f=d,h=function(e){s.has(e.id)&&!f.find((function(n){return n.id===e.id}))&&f.push(e)};try{for(v=a(l),p=v.next();!p.done;p=v.next())g=p.value,h(g)}catch(e){w={error:e}}finally{try{p&&!p.done&&(b=v.return)&&b.call(v)}finally{if(w)throw w.error}}return N?[4,N({nodes:t,edges:f})]:[2,{edges:f,nodes:t}];case 1:return"boolean"==typeof(y=e.sent())?[2,y?{edges:f,nodes:t}:{edges:[],nodes:[]}]:[2,y]}}))}))}var o_=function(e){return{userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect}};function i_(){var e=nb(o_,Db),n=e.userSelectionActive,t=e.userSelectionRect;return n&&t?v.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 a_=function(e,n){return function(t){t.target===n.current&&(null==e||e(t))}},u_=function(e){return{userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}};function c_(n){var t=n.isSelecting;n.selectionMode;var r=n.panOnDrag,o=n.onSelectionStart,i=n.onSelectionEnd,c=n.onPaneClick,s=n.onPaneContextMenu,l=n.onPaneScroll,d=n.onPaneMouseEnter,f=n.onPaneMouseMove,h=n.onPaneMouseLeave,p=n.children,g=e.useRef(null),y=tb(),m=e.useRef(0),w=e.useRef(0),b=e.useRef(),_=e.useRef(new Map),E=nb(u_,Db),S=E.userSelectionActive,k=E.elementsSelectable,C=E.dragging,M=function(){y.setState({userSelectionActive:!1,userSelectionRect:null}),m.current=0,w.current=0},N=function(e){null==c||c(e),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},P=l?function(e){return l(e)}:void 0,O=k&&(t||S);return v.jsxs("div",{className:x(["ink-flow__pane",{draggable:r,dragging:C,selection:t}]),onClick:O?void 0:a_(N,g),onContextMenu:a_((function(e){Array.isArray(r)&&(null==r?void 0:r.includes(2))?e.preventDefault():null==s||s(e)}),g),onWheel:a_(P,g),onMouseEnter:O?void 0:d,onMouseDown:O?function(e){var n,r,i,c,s=y.getState(),l=s.resetSelectedElements,d=s.domNode,f=s.edgeLookup;if(b.current=null==d?void 0:d.getBoundingClientRect(),k&&t&&0===e.button&&e.target===g.current&&b.current){_.current=new Map;try{for(var h=a(f),v=h.next();!v.done;v=h.next()){var p=u(v.value,2),m=p[0],x=p[1];_.current.set(x.source,(null===(i=_.current.get(x.source))||void 0===i?void 0:i.add(m))||new Set([m])),_.current.set(x.target,(null===(c=_.current.get(x.target))||void 0===c?void 0:c.add(m))||new Set([m]))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}var w=Ib(e.nativeEvent,b.current),E=w.x,S=w.y;l(),y.setState({userSelectionRect:{width:0,height:0,startX:E,startY:S,x:E,y:S}}),null==o||o(e)}}:void 0,onMouseMove:O?function(e){var n,r,o,i,u=y.getState(),c=u.userSelectionRect,s=u.edgeLookup,l=u.transform,d=u.nodeOrigin,f=u.nodeLookup,h=u.triggerNodeChanges,v=u.triggerEdgeChanges;if(t&&b.current&&c){var p=Ib(e.nativeEvent,b.current),g=p.x,x=p.y,E=c.startX,S=c.startY,k={startX:E,startY:S,x:g<E?g:E,y:x<S?x:S,width:Math.abs(g-E),height:Math.abs(x-S)},C=Jb(f,k,l,!1,!0,d),M=new Set,N=new Set;try{for(var P=a(C),O=P.next();!O.done;O=P.next()){var j=O.value;N.add(j.id);var I=_.current.get(j.id);if(I)try{for(var A=(o=void 0,a(I)),z=A.next();!z.done;z=A.next()){var T=z.value;M.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){n={error:e}}finally{try{O&&!O.done&&(r=P.return)&&r.call(P)}finally{if(n)throw n.error}}if(m.current!==N.size)m.current=N.size,h(Gb(f,N,!0));if(w.current!==M.size)w.current=M.size,v(Gb(s,M));y.setState({userSelectionRect:k,userSelectionActive:!0,nodesSelectionActive:!1})}}:f,onMouseUp:O?function(e){if(0===e.button){var n=y.getState().userSelectionRect;!S&&n&&e.target===g.current&&(null==N||N(e)),y.setState({nodesSelectionActive:m.current>0}),M(),null==i||i(e)}}:void 0,onMouseLeave:O?function(e){S&&(y.setState({nodesSelectionActive:m.current>0}),null==i||i(e)),M()}:h,ref:g,style:Rb,children:[p,v.jsx(i_,{})]})}var s_=function(e){return{nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive}};function l_(n){var t=n.children,r=n.onPaneClick,o=n.onPaneMouseEnter,i=n.onPaneMouseMove,a=n.onPaneMouseLeave,u=n.onPaneContextMenu,c=n.onPaneScroll,s=n.deleteKeyCode,l=n.selectionKeyCode,d=n.selectionOnDrag,f=n.selectionMode,h=n.onSelectionStart,p=n.onSelectionEnd,g=n.multiSelectionKeyCode,y=n.panActivationKeyCode,m=n.zoomActivationKeyCode,x=n.elementsSelectable,w=n.zoomOnScroll,b=n.zoomOnPinch,_=n.panOnScroll,E=n.panOnScrollSpeed,S=n.panOnScrollMode,k=n.zoomOnDoubleClick,C=n.panOnDrag,M=n.defaultViewport,N=n.translateExtent,P=n.minZoom,O=n.maxZoom,j=n.preventScrolling;n.onSelectionContextMenu;var I=n.noWheelClassName,A=n.noPanClassName;n.disableKeyboardA11y;var z=n.onViewportChange,T=n.isControlledViewport,L=nb(s_);L.nodesSelectionActive;var B=L.userSelectionActive,D=Tb(l),R=Tb(y),V=R||C,H=R||_,Y=D||B||d&&!0!==V;return function(n){var t=n.deleteKeyCode,r=n.multiSelectionKeyCode,o=tb(),i=Tb(t,Yb),a=Tb(r);e.useEffect((function(){if(i){var e=o.getState();e.edges,e.nodes,o.setState({nodesSelectionActive:!1})}}),[i]),e.useEffect((function(){o.setState({multiSelectionActive:a})}),[a])}({deleteKeyCode:s,multiSelectionKeyCode:g}),v.jsx(Hb,{onPaneContextMenu:u,elementsSelectable:x,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:H,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!D&&V,defaultViewport:M,translateExtent:N,minZoom:P,maxZoom:O,zoomActivationKeyCode:m,preventScrolling:j,noWheelClassName:I,noPanClassName:A,onViewportChange:z,isControlledViewport:T,children:v.jsx(c_,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:r,onPaneMouseEnter:o,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:u,onPaneScroll:c,panOnDrag:V,isSelecting:!!Y,selectionMode:f,children:t})})}l_.displayName="FlowRenderer";var d_=e.memo(l_);var f_={x:0,y:0,zoom:1},h_={type:"dagre",options:{rankdir:"TB",ranksep:100,nodesep:50}},v_={dagre:Zv};var p_="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function g_(n){var t=u(e.useState(!1),2),r=t[0],o=t[1],i=u(e.useState((function(){return function(e){var n=[];return{get:function(){return n},reset:function(){n=[]},push:function(t){n.push(t),e()}}}((function(){return o(!0)}))})),1),a=i[0];return p_((function(){if(r){var e=a.get();e.length&&(n(e),a.reset()),o(!1)}else a.reset()}),[r]),a}var y_=e.createContext(null);function m_(n){var t=n.children,r=tb(),o=e.useCallback((function(e){var n,t,o=r.getState(),i=o.nodes,u=void 0===i?[]:i,c=o.setNodes,s=o.hasDefaultNodes,l=o.onNodesChange,d=o.nodeLookup,f=u;try{for(var h=a(e),v=h.next();!v.done;v=h.next()){var p=v.value;f="function"==typeof p?p(f):p}}catch(e){n={error:e}}finally{try{v&&!v.done&&(t=h.return)&&t.call(h)}finally{if(n)throw n.error}}s?c(f):l&&l(qb({items:f,lookup:d}))}),[]),i=g_(o),u=e.useCallback((function(e){var n,t,o=r.getState(),i=o.edges,u=void 0===i?[]:i,c=o.setEdges,s=o.hasDefaultEdges,l=o.onEdgesChange,d=o.edgeLookup,f=u;try{for(var h=a(e),v=h.next();!v.done;v=h.next()){var p=v.value;f="function"==typeof p?p(f):p}}catch(e){n={error:e}}finally{try{v&&!v.done&&(t=h.return)&&t.call(h)}finally{if(n)throw n.error}}s?c(f):l&&l(qb({items:f,lookup:d}))}),[]),c=g_(u),s=e.useMemo((function(){return{nodeQueue:i,edgeQueue:c}}),[]);return v.jsx(y_.Provider,{value:s,children:t})}var x_=function(){var n=tb();return e.useMemo((function(){return{zoomIn:function(e){var t;return null===(t=n.getState().panZoom)||void 0===t?void 0:t.scaleBy(1.2,{duration:null==e?void 0:e.duration})},zoomOut:function(e){var t;return null===(t=n.getState().panZoom)||void 0===t?void 0:t.scaleBy(1/1.2,{duration:null==e?void 0:e.duration})},zoomTo:function(e,t){var r;return null===(r=n.getState().panZoom)||void 0===r?void 0:r.scaleTo(e,{duration:null==t?void 0:t.duration})},getZoom:function(){return n.getState().transform[2]},setViewport:function(e,t){var r,o,i,a=n.getState(),c=u(a.transform,3),s=c[0],l=c[1],d=c[2],f=a.panZoom;null==f||f.setViewport({x:null!==(r=e.x)&&void 0!==r?r:s,y:null!==(o=e.y)&&void 0!==o?o:l,zoom:null!==(i=e.zoom)&&void 0!==i?i:d},{duration:null==t?void 0:t.duration})},getViewport:function(){var e=u(n.getState().transform,3);return{x:e[0],y:e[1],zoom:e[2]}},fitView:function(e){var t=n.getState(),r=t.nodeLookup,o=t.width,i=t.height,a=t.nodeOrigin,u=t.minZoom,c=t.maxZoom,s=t.panZoom;return!!s&&n_({nodeLookup:r,width:o,height:i,nodeOrigin:a,minZoom:u,maxZoom:c,panZoom:s},e)},setCenter:function(e,t,r){var o=n.getState(),i=o.width,a=o.height,u=o.panZoom,c=o.transform,s=void 0!==(null==r?void 0:r.zoom)?r.zoom:c[2],l=i/2-e*s,d=a/2-t*s;null==u||u.setViewport({x:l,y:d,zoom:s},{duration:null==r?void 0:r.duration})},fitBounds:function(e,t){var r,o=n.getState(),i=o.width,a=o.height,u=o.minZoom,c=o.maxZoom,s=o.panZoom,l=_b(e,i,a,u,c,null!==(r=null==t?void 0:t.padding)&&void 0!==r?r:.1);null==s||s.setViewport(l,{duration:null==t?void 0:t.duration})},screenToFlowPosition:function(e,t){void 0===t&&(t={snapToGrid:!0});var r=n.getState(),o=r.transform,i=r.snapGrid,a=r.domNode;if(!a)return e;var u=a.getBoundingClientRect(),c=u.x,s=u.y,l={x:e.x-c,y:e.y-s};return vb(l,o,t.snapToGrid,i)},flowToScreenPosition:function(e){var t=n.getState(),r=t.transform,o=t.domNode;if(!o)return e;var i=o.getBoundingClientRect(),a=i.x,c=i.y,s=function(e,n){var t=e.x,r=e.y,o=u(n,3),i=o[0],a=o[1],c=o[2];return{x:t*c+i,y:r*c+a}}(e,r);return{x:s.x+a,y:s.y+c}}}}),[])},w_=function(e){return!!e.panZoom};function b_(){var n=this,r=x_(),a=tb(),s=function(){var n=e.useContext(y_);if(!n)throw new Error("useBatchContext must be used within a BatchProvider");return n}(),l=nb(w_);console.log("yk store",a.getState());var d=e.useMemo((function(){var e=function(e){return a.getState().nodeLookup.get(e)},r=function(e){s.nodeQueue.push(e)},l=function(e){var n,r,o,i,u=a.getState(),c=u.nodeLookup,s=u.nodeOrigin,l=kb(e)?e:c.get(e.id),d=l.parentId?function(e,n,r,o){var i,a;void 0===o&&(o=[0,0]);for(var u=n,c=t({},e);u;){var s=r.get(n);if(u=null==s?void 0:s.parentId,s){var l=s.origin||o,d=(null!==(i=s.measured.width)&&void 0!==i?i:0)*l[0],f=(null!==(a=s.measured.height)&&void 0!==a?a:0)*l[1];c.x+=s.position.x-d,c.y+=s.position.y-f}}return c}(l.position,l.parentId,c,s):l.position,f={id:l.id,position:d,width:null!==(r=null===(n=l.measured)||void 0===n?void 0:n.width)&&void 0!==r?r:l.width,height:null!==(i=null===(o=l.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:l.height,data:l.data};return pb(f)},d=function(e,n,o){void 0===o&&(o={replace:!1}),r((function(r){return r.map((function(r){if(r.id===e){var i="function"==typeof n?n(r):n;return o.replace&&kb(i)?i:t(t({},r),i)}return r}))}))};return{getNodes:function(){return a.getState().nodes.map((function(e){return t({},e)}))},getNode:function(n){var t;return null===(t=e(n))||void 0===t?void 0:t.internals.userNode},getInternalNode:e,getEdges:function(){var e=a.getState().edges;return(void 0===e?[]:e).map((function(e){return t({},e)}))},getEdge:function(e){return a.getState().edgeLookup.get(e)},setNodes:r,setEdges:function(e){s.edgeQueue.push(e)},addNodes:function(e){var n=Array.isArray(e)?e:[e];s.nodeQueue.push((function(e){return c(c([],u(e),!1),u(n),!1)}))},addEdges:function(e){var n=Array.isArray(e)?e:[e];s.edgeQueue.push((function(e){return c(c([],u(e),!1),u(n),!1)}))},toObject:function(){var e=a.getState(),n=e.nodes,r=void 0===n?[]:n,o=e.edges,i=void 0===o?[]:o,c=u(e.transform,3),s=c[0],l=c[1],d=c[2];return{nodes:r.map((function(e){return t({},e)})),edges:i.map((function(e){return t({},e)})),viewport:{x:s,y:l,zoom:d}}},deleteElements:function(e){return o(n,[e],void 0,(function(e){var n,t,r,o,u,c,s,l,d,f,h,v,p,g,y,m,x=e.nodes,w=void 0===x?[]:x,b=e.edges,_=void 0===b?[]:b;return i(this,(function(e){switch(e.label){case 0:return n=a.getState(),t=n.nodes,r=n.edges,o=n.onNodesDelete,u=n.onEdgesDelete,c=n.triggerNodeChanges,s=n.triggerEdgeChanges,l=n.onDelete,d=n.onBeforeDelete,[4,r_({nodesToRemove:w,edgesToRemove:_,nodes:t,edges:r,onBeforeDelete:d})];case 1:return f=e.sent(),h=f.nodes,v=f.edges,p=v.length>0,g=h.length>0,p&&(y=v.map($b),null==u||u(v),s(y)),g&&(m=h.map($b),null==o||o(h),c(m)),(g||p)&&(null==l||l({nodes:h,edges:v})),[2,{deletedNodes:h,deletedEdges:v}]}}))}))},getIntersectingNodes:function(e,n,t){void 0===n&&(n=!0);var r=Mb(e),o=r?e:l(e),i=void 0!==t;return o?(t||a.getState().nodes).filter((function(t){var u=a.getState().nodeLookup.get(t.id);if(u&&!r&&(t.id===e.id||!u.internals.positionAbsolute))return!1;var c=pb(i?t:u),s=bb(c,o);return n&&s>0||s>=o.width*o.height})):[]},isNodeIntersecting:function(e,n,t){void 0===t&&(t=!0);var r=Mb(e)?e:l(e);if(!r)return!1;var o=bb(r,n);return t&&o>0||o>=r.width*r.height},updateNode:d,updateNodeData:function(e,n,r){void 0===r&&(r={replace:!1}),d(e,(function(e){var o="function"==typeof n?n(e):n;return r.replace?t(t({},e),{data:o}):t(t({},e),{data:t(t({},e.data),o)})}),r)},checkAllNodeBeMeasured:function(){return a.getState().nodes.every((function(e){return e.measured}))}}}),[]);return e.useMemo((function(){return t(t(t({},d),r),{viewportInitialized:l})}),[l])}var __=function(e){return e.updateNodeInternals};var E_=function(e){return function(n){return e?Jb(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 S_=e.createContext(null),k_=S_.Provider;S_.Consumer;var C_="ink-flow__node-desc",M_="ink-flow__edge-desc";function N_(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 P_(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function O_(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case exports.Position.Left:return[t-P_(t-o,a),r];case exports.Position.Right:return[t+P_(o-t,a),r];case exports.Position.Top:return[t,r-P_(r-i,a)];case exports.Position.Bottom:return[t,r+P_(i-r,a)]}}function j_(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 I_,A_=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 z_=((I_={})[exports.Position.Left]={x:-1,y:0},I_[exports.Position.Right]={x:1,y:0},I_[exports.Position.Top]={x:0,y:-1},I_[exports.Position.Bottom]={x:0,y:1},I_),T_=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?exports.Position.Bottom:t,o=e.target;return r===exports.Position.Left||r===exports.Position.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}},L_=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function B_(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,s=e.targetPosition,l=void 0===s?exports.Position.Top:s,d=e.borderRadius,f=void 0===d?5:d,h=e.centerX,v=e.centerY,p=e.offset,g=u(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,s=void 0===a?exports.Position.Bottom:a,l=e.target,d=e.targetPosition,f=void 0===d?exports.Position.Top:d,h=e.center,v=e.offset,p=z_[s],g=z_[f],y={x:i.x+p.x*v,y:i.y+p.y*v},m={x:l.x+g.x*v,y:l.y+g.y*v},x=T_({source:y,sourcePosition:s,target:m}),w=0!==x.x?"x":"y",b=x[w],_=[],E={x:0,y:0},S={x:0,y:0},k=u(j_({sourceX:i.x,sourceY:i.y,targetX:l.x,targetY:l.y}),4),C=k[0],M=k[1],N=k[2],P=k[3];if(p[w]*g[w]==-1){r=null!==(n=h.x)&&void 0!==n?n:C,o=null!==(t=h.y)&&void 0!==t?t:M;var O=[{x:r,y:y.y},{x:r,y:m.y}],j=[{x:y.x,y:o},{x:m.x,y:o}];_=p[w]===b?"x"===w?O:j:"x"===w?j:O}else{var I=[{x:y.x,y:m.y}],A=[{x:m.x,y:y.y}];if(_="x"===w?p.x===b?A:I:p.y===b?I:A,s===f){var z=Math.abs(i[w]-l[w]);if(z<=v){var T=Math.min(v-1,v-z);p[w]===b?E[w]=(y[w]>i[w]?-1:1)*T:S[w]=(m[w]>l[w]?-1:1)*T}}if(s!==f){var L="x"===w?"y":"x",B=p[w]===g[L],D=y[L]>m[L],R=y[L]<m[L];(1===p[w]&&(!B&&D||B&&R)||1!==p[w]&&(!B&&R||B&&D))&&(_="x"===w?I:A)}var V={x:y.x+E.x,y:y.y+E.y},H={x:m.x+S.x,y:m.y+S.y};Math.max(Math.abs(V.x-_[0].x),Math.abs(H.x-_[0].x))>=Math.max(Math.abs(V.y-_[0].y),Math.abs(H.y-_[0].y))?(r=(V.x+H.x)/2,o=_[0].y):(r=_[0].x,o=(V.y+H.y)/2)}return[c(c([i,{x:y.x+E.x,y:y.y+E.y}],u(_),!1),[{x:m.x+S.x,y:m.y+S.y},l],!1),r,o,N,P]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:a},targetPosition:l,center:{x:h,y:v},offset:void 0===p?20:p}),5),y=g[0],m=g[1],x=g[2],w=g[3],b=g[4],_=y.reduce((function(e,n,t){var r="";return r=t>0&&t<y.length-1?function(e,n,t,r){var o=Math.min(L_(e,n)/2,L_(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var s=e.x<t.x?1:-1,l=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*l,"Q ").concat(i,",").concat(a," ").concat(i+o*s,",").concat(a)}(y[t-1],n,y[t+1],f):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+=r}),"");return[_,m,x,w,b]}var D_=function(e){return{connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}};var R_=e.memo(wb((function(n,o){var i,a,u=n.type,c=void 0===u?"source":u,s=n.position,l=void 0===s?exports.Position.Top:s,d=n.isValidConnection,f=n.isConnectable,h=void 0===f||f,p=n.isConnectableStart,g=void 0===p||p,y=n.isConnectableEnd,m=void 0===y||y,w=n.id,b=n.onConnect,_=n.children,E=n.className,S=n.onMouseDown,k=n.onTouchStart,C=r(n,["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"]),M=w||null,N="target"===c,P=tb(),O=e.useContext(S_),j=nb(D_,Db),I=j.connectOnClick,A=j.noPanClassName,z=j.rfId,T=nb(function(e,n,t){return function(r){var o=r.connectionStartHandle,i=r.connectionEndHandle,a=r.connectionClickStartHandle,u=r.connectionMode,c=r.connectionStatus,s=(null==i?void 0:i.nodeId)===e&&(null==i?void 0:i.handleId)===n&&(null==i?void 0:i.type)===t;return{connectingFrom:(null==o?void 0:o.nodeId)===e&&(null==o?void 0:o.handleId)===n&&(null==o?void 0:o.type)===t,connectingTo:s,clickConnecting:(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===n&&(null==a?void 0:a.type)===t,isPossibleEndHandle:u===exports.ConnectionMode.Strict?(null==o?void 0:o.type)!==t:e!==(null==o?void 0:o.nodeId)||n!==(null==o?void 0:o.handleId),connectionInProcess:!!o,valid:s&&"valid"===c}}}(O,M,c),Db),L=T.connectingFrom,B=T.connectingTo,D=T.clickConnecting,R=T.isPossibleEndHandle,V=T.connectionInProcess,H=T.valid;O||null===(a=(i=P.getState()).onError)||void 0===a||a.call(i,"010",uv.error010());var Y=function(e){var n=P.getState(),r=n.defaultEdgeOptions,o=n.onConnect,i=n.hasDefaultEdges,a=t(t({},r),e);if(i){var u=P.getState(),c=u.edges;(0,u.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))}))}(r="id"in(o=e)&&"source"in o&&"target"in o?t({},e):t(t({},e),{id:A_(e)}),n)?n:(null===r.sourceHandle&&delete r.sourceHandle,null===r.targetHandle&&delete r.targetHandle,n.concat(r)):n;var r,o}(a,c))}null==o||o(a),null==b||b(a)},X=function(e){if(O){var n=jb(e.nativeEvent);if(g&&(n&&0===e.button||!n)){var t=P.getState();zm.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:N,handleId:M,nodeId:O,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:Y,isValidConnection:d||t.isValidConnection,getTransform:function(){return P.getState().transform},getConnectionStartHandle:function(){return P.getState().connectionStartHandle}})}n?null==S||S(e):null==k||k(e)}};return v.jsx("div",t({"data-handleid":M,"data-nodeid":O,"data-handlepos":l,"data-id":"".concat(z,"-").concat(O,"-").concat(M,"-").concat(c),className:x(["ink-flow__handle","ink-flow__handle-".concat(l),"nodrag",A,E,{source:!N,target:N,connectable:h,connectablestart:g,connectableend:m,clickconnecting:D,connectingfrom:L,connectingto:B,valid:H,connectionindicator:h&&(!V||R)&&(V?m:g)}]),onMouseDown:X,onTouchStart:X,onClick:I?function(e){var n=P.getState(),t=n.onClickConnectStart,r=n.onClickConnectEnd,o=n.connectionClickStartHandle,i=n.connectionMode,a=n.isValidConnection,u=n.lib,s=n.rfId;if(O&&(o||g)){if(!o)return null==t||t(e.nativeEvent,{nodeId:O,handleId:M,handleType:c}),void P.setState({connectionClickStartHandle:{nodeId:O,type:c,handleId:M}});var l=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)}(e.target),f=d||a,h=zm.isValid(e.nativeEvent,{handle:{nodeId:O,id:M,type:c},connectionMode:i,fromNodeId:o.nodeId,fromHandleId:o.handleId||null,fromType:o.type,isValidConnection:f,flowId:s,doc:l,lib:u}),v=h.connection;h.isValid&&v&&Y(v),null==r||r(e),P.setState({connectionClickStartHandle:null})}}:void 0,ref:o},C,{children:_}))})));var V_={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},H_={input:function(e){var n=e.data,t=e.isConnectable,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r;return v.jsxs(v.Fragment,{children:[null==n?void 0:n.label,v.jsx(R_,{type:"source",position:o,isConnectable:t})]})},default:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?exports.Position.Top:r,i=e.sourcePosition,a=void 0===i?exports.Position.Bottom:i;return v.jsxs(v.Fragment,{children:[v.jsx(R_,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label,v.jsx(R_,{type:"source",position:a,isConnectable:t})]})},output:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?exports.Position.Top:r;return v.jsxs(v.Fragment,{children:[v.jsx(R_,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label]})},group:function(){return null}};function Y_(e){var n=e.id,t=e.store,r=e.unselect,o=void 0!==r&&r,i=e.nodeRef,a=t.getState(),u=a.addSelectedNodes,c=a.unselectNodesAndEdges,s=a.multiSelectionActive,l=a.nodeLookup,d=a.onError,f=l.get(n);f?(t.setState({nodesSelectionActive:!1}),f.selected?(o||f.selected&&s)&&(c({nodes:[f],edges:[]}),requestAnimationFrame((function(){var e;return null===(e=null==i?void 0:i.current)||void 0===e?void 0:e.blur()}))):u([n])):null==d||d("012",uv.error012(n))}var X_=function(e){return function(n){return n.selected&&(n.draggable||e&&void 0===n.draggable)}};function Z_(n){var r,o=n.id,i=n.onClick,c=n.onMouseEnter,s=n.onMouseMove,l=n.onMouseLeave,d=n.onContextMenu,f=n.onDoubleClick,h=n.nodesDraggable,p=n.elementsSelectable,g=n.nodesConnectable,y=n.nodesFocusable,m=n.resizeObserver,w=n.noDragClassName,b=n.noPanClassName,_=n.disableKeyboardA11y,E=n.rfId,S=n.nodeTypes,k=n.nodeExtent,C=n.nodeOrigin,M=n.onError,N=nb((function(e){var n=e.nodeLookup.get(o),t=e.parentLookup.has(o);return{node:n,internals:n.internals,isParent:t}}),Db),P=N.node,O=N.internals,j=N.isParent,I=P.type||"default",A=(null==S?void 0:S[I])||H_[I];void 0===A&&(null==M||M("003",uv.error003(I)),I="default",A=H_.default);var z=!!(P.draggable||h&&void 0===P.draggable),T=!!(P.selectable||p&&void 0===P.selectable),L=!!(P.connectable||g&&void 0===P.connectable),B=!!(P.focusable||y&&void 0===P.focusable),D=tb(),R=function(e){var n,t,r,o,i,a;return void 0!==(null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==(null!==(a=null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:e.height)&&void 0!==a?a:e.initialHeight)}(P),V=function(n){var t=n.node,r=n.nodeType,o=n.hasDimensions,i=n.resizeObserver,a=tb(),u=e.useRef(null),c=e.useRef(null),s=e.useRef(t.sourcePosition),l=e.useRef(t.targetPosition),d=e.useRef(r),f=o&&!!t.internals.handleBounds&&!t.hidden;return e.useEffect((function(){!u.current||f&&c.current===u.current||(c.current&&(null==i||i.unobserve(c.current)),null==i||i.observe(u.current),c.current=u.current)}),[f]),e.useEffect((function(){return function(){c.current&&(null==i||i.unobserve(c.current),c.current=null)}}),[]),e.useEffect((function(){if(u.current){var e=d.current!==r,n=s.current!==t.sourcePosition,o=l.current!==t.targetPosition;(e||n||o)&&(d.current=r,s.current=t.sourcePosition,l.current=t.targetPosition,a.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:u.current,force:!0}]])))}}),[t.id,r,t.sourcePosition,t.targetPosition]),u}({node:P,nodeType:I,hasDimensions:R,resizeObserver:m}),H=function(n){var t=n.nodeRef,r=n.disabled,o=void 0!==r&&r,i=n.noDragClassName,a=n.handleSelector,c=n.nodeId,s=n.isSelectable,l=tb(),d=u(e.useState(!1),2),f=d[0],h=d[1],v=e.useRef();return e.useEffect((function(){v.current=Nm({getStoreItems:function(){return l.getState()},onNodeMouseDown:function(e){Y_({id:e,store:l,nodeRef:t})},onDragStart:function(){h(!0)},onDragStop:function(){h(!1)}})}),[]),e.useEffect((function(){var e,n;if(o)null===(e=v.current)||void 0===e||e.destroy();else if(t.current)return null===(n=v.current)||void 0===n||n.update({noDragClassName:i,handleSelector:a,domNode:t.current,isSelectable:s,nodeId:c}),function(){var e;null===(e=v.current)||void 0===e||e.destroy()}}),[i,a,o,s,t,c]),f}({nodeRef:V,disabled:P.hidden||!z,noDragClassName:w,handleSelector:P.dragHandle,nodeId:o,isSelectable:T}),Y=function(){var n=tb(),t=e.useCallback((function(e){var t,r,o=n.getState(),i=o.nodeExtent,c=o.snapToGrid,s=o.snapGrid,l=o.nodesDraggable,d=o.onError,f=o.updateNodePositions,h=o.nodeLookup,v=o.nodeOrigin,p=new Map,g=X_(l),y=c?s[0]:5,m=c?s[1]:5,x=e.direction.x*y*e.factor,w=e.direction.y*m*e.factor;try{for(var b=a(h),_=b.next();!_.done;_=b.next()){var E=u(_.value,2)[1];if(g(E)){var S={x:E.internals.positionAbsolute.x+x,y:E.internals.positionAbsolute.y+w};c&&(S=hb(S,s));var k=t_({nodeId:E.id,nextPosition:S,nodeLookup:h,nodeExtent:i,nodeOrigin:v,onError:d}),C=k.position,M=k.positionAbsolute;E.position=C,E.internals.positionAbsolute=M,p.set(E.id,E)}}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=b.return)&&r.call(b)}finally{if(t)throw t.error}}f(p)}),[]);return t}();if(P.hidden)return null;var X=db(P),Z=function(e){var n,t,r,o,i,a,u,c,s,l;return void 0===e.internals.handleBounds?{width:null!==(t=null!==(n=e.width)&&void 0!==n?n:e.initialWidth)&&void 0!==t?t:null===(r=e.style)||void 0===r?void 0:r.width,height:null!==(i=null!==(o=e.height)&&void 0!==o?o:e.initialHeight)&&void 0!==i?i:null===(a=e.style)||void 0===a?void 0:a.height}:{width:null!==(u=e.width)&&void 0!==u?u:null===(c=e.style)||void 0===c?void 0:c.width,height:null!==(s=e.height)&&void 0!==s?s:null===(l=e.style)||void 0===l?void 0:l.height}}(P),F=k?lb(O.positionAbsolute,k):O.positionAbsolute,U=Sb(t(t(t({},F),X),{origin:P.origin||C})),W=T||z||i||c||s||l,G=c?function(e){return c(e,t({},O.userNode))}:void 0,q=s?function(e){return s(e,t({},O.userNode))}:void 0,$=l?function(e){return l(e,t({},O.userNode))}:void 0,K=d?function(e){return d(e,t({},O.userNode))}:void 0,Q=f?function(e){return f(e,t({},O.userNode))}:void 0;return v.jsx("div",{className:x(["ink-flow__node","ink-flow__node-".concat(I),(r={},r[b]=z,r),P.className,{selected:P.selected,selectable:T,parent:j,draggable:z,dragging:H}]),ref:V,style:t(t({zIndex:O.z,transform:"translate(".concat(U.x,"px,").concat(U.y,"px)"),pointerEvents:W?"all":"none",visibility:R?"visible":"hidden"},P.style),Z),"data-id":o,"data-testid":"rf__node-".concat(o),onMouseEnter:G,onMouseMove:q,onMouseLeave:$,onContextMenu:K,onClick:function(e){var n=D.getState(),r=n.selectNodesOnDrag,a=n.nodeDragThreshold;T&&(!r||!z||a>0)&&Y_({id:o,store:D,nodeRef:V}),i&&i(e,t({},O.userNode))},onDoubleClick:Q,onKeyDown:B?function(e){if(!Ob(e.nativeEvent)&&!_)if(sv.includes(e.key)&&T){var n="Escape"===e.key;Y_({id:o,store:D,unselect:n,nodeRef:V})}else z&&P.selected&&Object.prototype.hasOwnProperty.call(V_,e.key)&&(D.setState({ariaLiveMessage:"Moved selected node ".concat(e.key.replace("Arrow","").toLowerCase(),". New position, x: ").concat(~~F.x,", y: ").concat(~~F.y)}),Y({direction:V_[e.key],factor:e.shiftKey?4:1}))}:void 0,tabIndex:B?0:void 0,role:B?"button":void 0,"aria-describedby":_?void 0:"".concat(C_,"-").concat(E),"aria-label":P.ariaLabel,children:v.jsx(k_,{value:o,children:v.jsx(A,t({id:o,data:P.data,type:I,positionAbsoluteX:F.x,positionAbsoluteY:F.y,selected:P.selected,isConnectable:L,sourcePosition:P.sourcePosition,targetPosition:P.targetPosition,dragging:H,dragHandle:P.dragHandle,zIndex:O.z},X))})})}var F_=function(e){return{nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError}};function U_(n){var t,r=nb(F_,Db),o=r.nodesDraggable,i=r.nodesConnectable,a=r.nodesFocusable,c=r.elementsSelectable,s=r.onError,l=(t=!1,nb(e.useCallback(E_(t),[t]),Db)),d=function(){var n=nb(__),t=u(e.useState((function(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver((function(e){var t=new Map;e.forEach((function(e){var n=e.target.getAttribute("data-id");t.set(n,{id:n,nodeElement:e.target})})),n(t)}))})),1),r=t[0];return e.useEffect((function(){return function(){null==r||r.disconnect()}}),[r]),r}();return v.jsx("div",{className:"ink-flow__nodes",style:Rb,children:l.map((function(e){return v.jsx(Z_,{id:e,nodeTypes:n.nodeTypes,nodeOrigin:n.nodeOrigin,onClick:n.onNodeClick,onMouseEnter:n.onNodeMouseEnter,onMouseMove:n.onNodeMouseMove,onMouseLeave:n.onNodeMouseLeave,onContextMenu:n.onNodeContextMenu,onDoubleClick:n.onNodeDoubleClick,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,resizeObserver:d,nodesDraggable:o,nodesConnectable:i,nodesFocusable:a,elementsSelectable:c,onError:s},e)}))})}U_.displayName="NodeRenderer";var W_,G_=e.memo(U_),q_=((W_={})[exports.MarkerType.Arrow]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return v.jsx("polyline",{style:{stroke:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"})},W_[exports.MarkerType.ArrowClosed]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return v.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},W_);function $_(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 K_=function(n){var t=n.id,r=n.type,o=n.color,i=n.width,a=void 0===i?12.5:i,u=n.height,c=void 0===u?12.5:u,s=n.markerUnits,l=void 0===s?"strokeWidth":s,d=n.strokeWidth,f=n.orient,h=void 0===f?"auto-start-reverse":f,p=function(n){var t=tb(),r=e.useMemo((function(){var e,r;return Object.prototype.hasOwnProperty.call(q_,n)?q_[n]:(null===(r=(e=t.getState()).onError)||void 0===r||r.call(e,"009",uv.error009(n)),null)}),[n]);return r}(r);return p?v.jsx("marker",{className:"ink-flow__arrowhead",id:t,markerWidth:"".concat(a),markerHeight:"".concat(c),viewBox:"-10 -10 20 20",markerUnits:l,orient:h,refX:"0",refY:"0",children:v.jsx(p,{color:o,strokeWidth:d})}):null},Q_=function(n){var r=n.defaultColor,o=n.rfId,i=nb((function(e){return e.edges})),a=nb((function(e){return e.defaultEdgeOptions})),u=e.useMemo((function(){var e=function(e,n){var r=n.id,o=n.defaultColor,i=n.defaultMarkerStart,a=n.defaultMarkerEnd,u=new Set;return e.reduce((function(e,n){return[n.markerStart||i,n.markerEnd||a].forEach((function(n){if(n&&"object"==typeof n){var i=$_(n,r);u.has(i)||(e.push(t({id:i,color:n.color||o},n)),u.add(i))}})),e}),[]).sort((function(e,n){return e.id.localeCompare(n.id)}))}(i,{id:o,defaultColor:r,defaultMarkerStart:null==a?void 0:a.markerStart,defaultMarkerEnd:null==a?void 0:a.markerEnd});return e}),[i,a,o,r]);return u.length?v.jsx("svg",{className:"ink-flow__marker",children:v.jsx("defs",{children:u.map((function(e){return v.jsx(K_,{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};Q_.displayName="MarkerDefinitions";var J_=e.memo(Q_);function eE(n){var o=n.x,i=n.y,a=n.label,c=n.labelStyle,s=void 0===c?{}:c,l=n.labelShowBg,d=void 0===l||l,f=n.labelBgStyle,h=void 0===f?{}:f,p=n.labelBgPadding,g=void 0===p?[2,4]:p,y=n.labelBgBorderRadius,m=void 0===y?2:y,w=n.children,b=n.className,_=r(n,["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"]),E=u(e.useState({x:1,y:0,width:0,height:0}),2),S=E[0],k=E[1],C=x(["ink-flow__edge-textwrapper",b]),M=e.useCallback((function(e){if(null!==e){var n=e.getBBox();k({x:n.x,y:n.y,width:n.width,height:n.height})}}),[]);return void 0!==a&&a?v.jsxs("g",t({transform:"translate(".concat(o-S.width/2," ").concat(i-S.height/2,")"),className:C,visibility:S.width?"visible":"hidden"},_,{children:[d&&v.jsx("rect",{width:S.width+2*g[0],x:-g[0],y:-g[1],height:S.height+2*g[1],className:"ink-flow__edge-textbg",style:h,rx:m,ry:m}),v.jsx("text",{className:"ink-flow__edge-text",y:S.height/2,dy:"0.3em",ref:M,style:s,children:a}),w]})):null}eE.displayName="EdgeText";var nE=e.memo(eE);function tE(e){var n=e.id,t=e.path,r=e.labelX,o=e.labelY,i=e.label,a=e.labelStyle,u=e.labelShowBg,c=e.labelBgStyle,s=e.labelBgPadding,l=e.labelBgBorderRadius,d=e.style,f=e.markerEnd,h=e.markerStart,p=e.className,g=e.interactionWidth,y=void 0===g?20:g;return v.jsxs(v.Fragment,{children:[v.jsx("path",{id:n,style:d,d:t,fill:"none",className:x(["ink-flow__edge-path",p]),markerEnd:f,markerStart:h}),y&&v.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:y,className:"ink-flow__edge-interaction"}),i&&fb(r)&&fb(o)?v.jsx(nE,{x:r,y:o,label:i,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:s,labelBgBorderRadius:l}):null]})}function rE(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2;return n===exports.Position.Left||n===exports.Position.Right?[.5*(t+o),r]:[t,.5*(r+i)]}function oE(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,c=e.targetPosition,s=void 0===c?exports.Position.Top:c,l=u(rE({pos:o,x1:n,y1:t,x2:i,y2:a}),2),d=l[0],f=l[1],h=u(rE({pos:s,x1:i,y1:a,x2:n,y2:t}),2),v=h[0],p=h[1],g=u(N_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:d,sourceControlY:f,targetControlX:v,targetControlY:p}),4),y=g[0],m=g[1],x=g[2],w=g[3];return["M".concat(n,",").concat(t," C").concat(d,",").concat(f," ").concat(v,",").concat(p," ").concat(i,",").concat(a),y,m,x,w]}function iE(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,c=e.sourcePosition,s=void 0===c?exports.Position.Bottom:c,l=e.targetPosition,d=void 0===l?exports.Position.Top:l,f=e.label,h=e.labelStyle,p=e.labelShowBg,g=e.labelBgStyle,y=e.labelBgPadding,m=e.labelBgBorderRadius,x=e.style,w=e.markerEnd,b=e.markerStart,_=e.interactionWidth,E=u(oE({sourceX:r,sourceY:o,sourcePosition:s,targetX:i,targetY:a,targetPosition:d}),3),S=E[0],k=E[1],C=E[2],M=n.isInternal?void 0:t;return v.jsx(tE,{id:M,path:S,labelX:k,labelY:C,label:f,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:m,style:x,markerEnd:w,markerStart:b,interactionWidth:_})}))}var aE=iE({isInternal:!1}),uE=iE({isInternal:!0});function cE(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,c=e.label,s=e.labelStyle,l=e.labelShowBg,d=e.labelBgStyle,f=e.labelBgPadding,h=e.labelBgBorderRadius,p=e.style,g=e.sourcePosition,y=void 0===g?exports.Position.Bottom:g,m=e.targetPosition,x=void 0===m?exports.Position.Top:m,w=e.markerEnd,b=e.markerStart,_=e.pathOptions,E=e.interactionWidth,S=u(B_({sourceX:r,sourceY:o,sourcePosition:y,targetX:i,targetY:a,targetPosition:x,borderRadius:null==_?void 0:_.borderRadius,offset:null==_?void 0:_.offset}),3),k=S[0],C=S[1],M=S[2],N=n.isInternal?void 0:t;return v.jsx(tE,{id:N,path:k,labelX:C,labelY:M,label:c,labelStyle:s,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:p,markerEnd:w,markerStart:b,interactionWidth:E})}))}aE.displayName="SimpleBezierEdge",uE.displayName="SimpleBezierEdgeInternal";var sE=cE({isInternal:!1}),lE=cE({isInternal:!0});function dE(n){return e.memo((function(o){var i,a=o.id,u=r(o,["id"]),c=n.isInternal?void 0:a;return v.jsx(sE,t({},u,{id:c,pathOptions:e.useMemo((function(){var e;return{borderRadius:0,offset:null===(e=u.pathOptions)||void 0===e?void 0:e.offset}}),[null===(i=u.pathOptions)||void 0===i?void 0:i.offset])}))}))}sE.displayName="SmoothStepEdge",lE.displayName="SmoothStepEdgeInternal";var fE=dE({isInternal:!1}),hE=dE({isInternal:!0});function vE(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,c=e.label,s=e.labelStyle,l=e.labelShowBg,d=e.labelBgStyle,f=e.labelBgPadding,h=e.labelBgBorderRadius,p=e.style,g=e.markerEnd,y=e.markerStart,m=e.interactionWidth,x=u(function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=u(j_({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],c=i[1],s=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,c,s,l]}({sourceX:r,sourceY:o,targetX:i,targetY:a}),3),w=x[0],b=x[1],_=x[2],E=n.isInternal?void 0:t;return v.jsx(tE,{id:E,path:w,labelX:b,labelY:_,label:c,labelStyle:s,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:p,markerEnd:g,markerStart:y,interactionWidth:m})}))}fE.displayName="StepEdge",hE.displayName="StepEdgeInternal";var pE=vE({isInternal:!1}),gE=vE({isInternal:!0});function yE(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,c=e.sourcePosition,s=void 0===c?exports.Position.Bottom:c,l=e.targetPosition,d=void 0===l?exports.Position.Top:l,f=e.label,h=e.labelStyle,p=e.labelShowBg,g=e.labelBgStyle,y=e.labelBgPadding,m=e.labelBgBorderRadius,x=e.style,w=e.markerEnd,b=e.markerStart,_=e.pathOptions,E=e.interactionWidth,S=u(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,c=e.targetPosition,s=void 0===c?exports.Position.Top:c,l=e.curvature,d=void 0===l?.25:l,f=u(O_({pos:o,x1:n,y1:t,x2:i,y2:a,c:d}),2),h=f[0],v=f[1],p=u(O_({pos:s,x1:i,y1:a,x2:n,y2:t,c:d}),2),g=p[0],y=p[1],m=u(N_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:h,sourceControlY:v,targetControlX:g,targetControlY:y}),4),x=m[0],w=m[1],b=m[2],_=m[3];return["M".concat(n,",").concat(t," C").concat(h,",").concat(v," ").concat(g,",").concat(y," ").concat(i,",").concat(a),x,w,b,_]}({sourceX:r,sourceY:o,sourcePosition:s,targetX:i,targetY:a,targetPosition:d,curvature:null==_?void 0:_.curvature}),3),k=S[0],C=S[1],M=S[2],N=n.isInternal?void 0:t;return v.jsx(tE,{id:N,path:k,labelX:C,labelY:M,label:f,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:m,style:x,markerEnd:w,markerStart:b,interactionWidth:E})}))}pE.displayName="StraightEdge",gE.displayName="StraightEdgeInternal";var mE=yE({isInternal:!1}),xE=yE({isInternal:!0});mE.displayName="BezierEdge",xE.displayName="BezierEdgeInternal";var wE={default:xE,straight:gE,step:hE,smoothstep:lE,simplebezier:uE},bE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},_E=function(e,n,t){return t===exports.Position.Left?e-n:t===exports.Position.Right?e+n:e},EE=function(e,n,t){return t===exports.Position.Top?e-n:t===exports.Position.Bottom?e+n:e},SE="ink-flow__edgeupdater";function kE(e){var n=e.position,t=e.centerX,r=e.centerY,o=e.radius,i=void 0===o?10:o,a=e.onMouseDown,u=e.onMouseEnter,c=e.onMouseOut,s=e.type;return v.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:c,className:x([SE,"".concat(SE,"-").concat(s)]),cx:_E(t,i,n),cy:EE(r,i,n),r:i,stroke:"transparent",fill:"transparent"})}function CE(e){var n=e.isUpdatable,t=e.edgeUpdaterRadius,r=e.edge,o=e.targetHandleId,i=e.sourceHandleId,a=e.sourceX,u=e.sourceY,c=e.targetX,s=e.targetY,l=e.sourcePosition,d=e.targetPosition,f=e.onEdgeUpdate,h=e.onEdgeUpdateStart,p=e.onEdgeUpdateEnd,g=e.setUpdating,y=e.setUpdateHover,m=tb(),x=function(e,n){if(0===e.button){var t=m.getState(),a=t.autoPanOnConnect,u=t.domNode,c=t.isValidConnection,s=t.connectionMode,l=t.connectionRadius,d=t.lib,v=t.onConnectStart,y=t.onConnectEnd,x=t.cancelConnection,w=t.nodeLookup,b=t.rfId,_=t.panBy,E=t.updateConnection,S=n?r.target:r.source,k=(n?o:i)||null,C=n?"target":"source",M=n;g(!0),null==h||h(e,r,C);zm.onPointerDown(e.nativeEvent,{autoPanOnConnect:a,connectionMode:s,connectionRadius:l,domNode:u,handleId:k,nodeId:S,nodeLookup:w,isTarget:M,edgeUpdaterType:C,lib:d,flowId:b,cancelConnection:x,panBy:_,isValidConnection:c,onConnect:function(e){return null==f?void 0:f(r,e)},onConnectStart:v,onConnectEnd:y,onEdgeUpdateEnd:function(e){g(!1),null==p||p(e,r,C)},updateConnection:E,getTransform:function(){return m.getState().transform},getConnectionStartHandle:function(){return m.getState().connectionStartHandle}})}},w=function(){return y(!0)},b=function(){return y(!1)};return v.jsxs(v.Fragment,{children:[("source"===n||!0===n)&&v.jsx(kE,{position:l,centerX:a,centerY:u,radius:t,onMouseDown:function(e){return x(e,!0)},onMouseEnter:w,onMouseOut:b,type:"source"}),("target"===n||!0===n)&&v.jsx(kE,{position:d,centerX:c,centerY:s,radius:t,onMouseDown:function(e){return x(e,!1)},onMouseEnter:w,onMouseOut:b,type:"target"})]})}function ME(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 NE(e){var n,t,r,o;if(!e)return null;var i=[],u=[];try{for(var c=a(e),s=c.next();!s.done;s=c.next()){var l=s.value;l.width=null!==(r=l.width)&&void 0!==r?r:1,l.height=null!==(o=l.height)&&void 0!==o?o:1,"source"===l.type?i.push(l):"target"===l.type&&u.push(l)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return{source:i,target:u}}function PE(e,n,t){var r,o;void 0===t&&(t=null);var i=(null!==(r=null==t?void 0:t.x)&&void 0!==r?r:0)+n.internals.positionAbsolute.x,a=(null!==(o=null==t?void 0:t.y)&&void 0!==o?o:0)+n.internals.positionAbsolute.y,u=null!=t?t:db(n),c=u.width,s=u.height;switch(e){case exports.Position.Top:return[i+c/2,a];case exports.Position.Right:return[i+c,a+s/2];case exports.Position.Bottom:return[i+c/2,a+s];case exports.Position.Left:return[i,a+s/2]}}function OE(e,n){return e&&(n?e.find((function(e){return e.id===n})):e[0])||null}function jE(n){var r=n.id,o=n.edgesFocusable,i=n.edgesUpdatable,a=n.elementsSelectable,c=n.onClick,s=n.onDoubleClick,l=n.onContextMenu,d=n.onMouseEnter,f=n.onMouseMove,h=n.onMouseLeave,p=n.edgeUpdaterRadius,g=n.onEdgeUpdate,y=n.onEdgeUpdateStart,m=n.onEdgeUpdateEnd,w=n.rfId,b=n.edgeTypes,_=n.noPanClassName,E=n.onError,S=n.disableKeyboardA11y,k=nb((function(e){return e.edgeLookup.get(r)})),C=nb((function(e){return e.defaultEdgeOptions})),M=(k=C?t(t({},C),k):k).type||"default",N=(null==b?void 0:b[M])||wE[M];void 0===N&&(null==E||E("011",uv.error011(M)),M="default",N=wE.default);var P=!!(k.focusable||o&&void 0===k.focusable),O=void 0!==g&&(k.updatable||i&&void 0===k.updatable),j=!!(k.selectable||a&&void 0===k.selectable),I=e.useRef(null),A=u(e.useState(!1),2),z=A[0],T=A[1],L=u(e.useState(!1),2),B=L[0],D=L[1],R=tb(),V=nb(e.useCallback((function(e){var n=e.nodeLookup.get(k.source),o=e.nodeLookup.get(k.target);if(!n||!o)return t({zIndex:k.zIndex},bE);var i=function(e){var n,t,r,o,i,a=e.sourceNode,c=e.targetNode;if(!ME(a)||!ME(c))return null;var s=a.internals.handleBounds||NE(a.handles),l=c.internals.handleBounds||NE(c.handles),d=OE(null!==(n=null==s?void 0:s.source)&&void 0!==n?n:[],e.sourceHandle),f=OE(e.connectionMode===exports.ConnectionMode.Strict?null!==(t=null==l?void 0:l.target)&&void 0!==t?t:[]:(null!==(r=null==l?void 0:l.target)&&void 0!==r?r:[]).concat(null!==(o=null==l?void 0:l.source)&&void 0!==o?o:[]),e.targetHandle),h=(null==d?void 0:d.position)||exports.Position.Bottom,v=(null==f?void 0:f.position)||exports.Position.Top;if(!d||!f)return null===(i=e.onError)||void 0===i||i.call(e,"008",uv.error008(d?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;var p=u(PE(h,a,d),2),g=p[0],y=p[1],m=u(PE(v,c,f),2);return{sourceX:g,sourceY:y,targetX:m[0],targetY:m[1],sourcePosition:h,targetPosition:v}}({id:r,sourceNode:n,targetNode:o,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:e.connectionMode,onError:E}),a=function(e){var n=e.sourceNode,t=e.targetNode,r=e.selected,o=void 0!==r&&r,i=e.zIndex,a=void 0===i?0:i,u=e.elevateOnSelect;if(void 0===u||!u)return a;var c=o||t.selected||n.selected,s=Math.max(n.internals.z||0,t.internals.z||0,1e3);return a+(c?s:0)}({selected:k.selected,zIndex:k.zIndex,sourceNode:n,targetNode:o,elevateOnSelect:e.elevateEdgesOnSelect});return t({zIndex:a},i||bE)}),[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),Db),H=V.zIndex,Y=V.sourceX,X=V.sourceY,Z=V.targetX,F=V.targetY,U=V.sourcePosition,W=V.targetPosition,G=e.useMemo((function(){return k.markerStart?"url('#".concat($_(k.markerStart,w),"')"):void 0}),[k.markerStart,w]),q=e.useMemo((function(){return k.markerEnd?"url('#".concat($_(k.markerEnd,w),"')"):void 0}),[k.markerEnd,w]);if(k.hidden||null===Y||null===X||null===Z||null===F)return null;var $=s?function(e){s(e,t({},k))}:void 0,K=l?function(e){l(e,t({},k))}:void 0,Q=d?function(e){d(e,t({},k))}:void 0,J=f?function(e){f(e,t({},k))}:void 0,ee=h?function(e){h(e,t({},k))}:void 0;return v.jsx("svg",{style:{zIndex:H},children:v.jsxs("g",{className:x(["ink-flow__edge","ink-flow__edge-".concat(M),k.className,_,{selected:k.selected,animated:k.animated,inactive:!j&&!c,updating:z,selectable:j}]),onClick:function(e){var n,t=R.getState(),o=t.addSelectedEdges,i=t.unselectNodesAndEdges,a=t.multiSelectionActive;j&&(R.setState({nodesSelectionActive:!1}),k.selected&&a?(i({nodes:[],edges:[k]}),null===(n=I.current)||void 0===n||n.blur()):o([r])),c&&c(e,k)},onDoubleClick:$,onContextMenu:K,onMouseEnter:Q,onMouseMove:J,onMouseLeave:ee,onKeyDown:P?function(e){var n;if(!S&&sv.includes(e.key)&&j){var t=R.getState(),o=t.unselectNodesAndEdges,i=t.addSelectedEdges;"Escape"===e.key?(null===(n=I.current)||void 0===n||n.blur(),o({edges:[k]})):i([r])}}:void 0,tabIndex:P?0:void 0,role:P?"button":"img","data-id":r,"data-testid":"rf__edge-".concat(r),"aria-label":null===k.ariaLabel?void 0:k.ariaLabel||"Edge from ".concat(k.source," to ").concat(k.target),"aria-describedby":P?"".concat(M_,"-").concat(w):void 0,ref:I,children:[!B&&v.jsx(N,{id:r,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:Y,sourceY:X,targetX:Z,targetY:F,sourcePosition:U,targetPosition:W,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:G,markerEnd:q,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),O&&v.jsx(CE,{edge:k,isUpdatable:O,edgeUpdaterRadius:p,onEdgeUpdate:g,onEdgeUpdateStart:y,onEdgeUpdateEnd:m,sourceX:Y,sourceY:X,targetX:Z,targetY:F,sourcePosition:U,targetPosition:W,setUpdateHover:T,setUpdating:D,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle})]})})}var IE=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 AE(n){var t=n.defaultMarkerColor,r=n.rfId,o=n.noPanClassName,i=n.onEdgeUpdate,a=n.onEdgeContextMenu,u=n.onEdgeMouseEnter,c=n.onEdgeMouseMove,s=n.onEdgeMouseLeave,l=n.onEdgeClick,d=n.edgeTypes,f=nb(IE,Db),h=f.edgesFocusable,p=f.edgesUpdatable,g=f.elementsSelectable,y=f.onError,m=function(n){var t=nb(e.useCallback((function(e){return e.edges.map((function(e){return e.id}))}),[n]),Db);return t}(!1);return v.jsxs("div",{className:"ink-flow__edges",children:[v.jsx(J_,{defaultColor:t,rfId:r}),m.map((function(e){return v.jsx(jE,{id:e,edgesFocusable:h,edgesUpdatable:p,elementsSelectable:g,noPanClassName:o,onEdgeUpdate:i,onContextMenu:a,onMouseEnter:u,onMouseMove:c,onMouseLeave:s,onClick:l,rfId:r,onError:y,edgeTypes:d},e)}))]})}AE.displayName="EdgeRenderer";var zE,TE=e.memo(AE),LE=function(e){return"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],")")};function BE(e){var n=e.children,t=nb(LE);return v.jsx("div",{className:"ink-flow__viewport xyflow__viewport ink-flow__container",style:{transform:t},children:n})}var DE=((zE={})[exports.Position.Left]=exports.Position.Right,zE[exports.Position.Right]=exports.Position.Left,zE[exports.Position.Top]=exports.Position.Bottom,zE[exports.Position.Bottom]=exports.Position.Top,zE),RE=function(n){var r,o,i=n.nodeId,a=n.handleType,c=n.style,s=n.type,l=void 0===s?exports.ConnectionLineType.Bezier:s,d=n.CustomComponent,f=n.connectionStatus,h=nb(e.useCallback((function(e){var n;return{fromNode:e.nodeLookup.get(i),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}}),[i]),Db),p=h.fromNode,g=h.handleId,y=h.toX,m=h.toY,x=h.connectionMode,w=null==p?void 0:p.internals.handleBounds,b=null==w?void 0:w[a];if(x===exports.ConnectionMode.Loose&&(b=b||(null==w?void 0:w["source"===a?"target":"source"])),!p||!b)return null;var _=g?b.find((function(e){return e.id===g})):b[0],E=_?_.x+_.width/2:(null!==(r=p.measured.width)&&void 0!==r?r:0)/2,S=_?_.y+_.height/2:null!==(o=p.measured.height)&&void 0!==o?o:0,k=p.internals.positionAbsolute.x+E,C=p.internals.positionAbsolute.y+S,M=null==_?void 0:_.position,N=M?DE[M]:null;if(!M||!N)return null;if(d)return v.jsx(d,{connectionLineType:l,connectionLineStyle:c,fromNode:p,fromHandle:_,fromX:k,fromY:C,toX:y,toY:m,fromPosition:M,toPosition:N,connectionStatus:f});var P="",O={sourceX:k,sourceY:C,sourcePosition:M,targetX:y,targetY:m,targetPosition:N};return P=l===exports.ConnectionLineType.Bezier?u(Bv(O),1)[0]:l===exports.ConnectionLineType.Step?u(Xv(t(t({},O),{borderRadius:0})),1)[0]:l===exports.ConnectionLineType.SmoothStep?u(Xv(O),1)[0]:l===exports.ConnectionLineType.SimpleBezier?u(oE(O),1)[0]:"M".concat(k,",").concat(C," ").concat(y,",").concat(m),v.jsx("path",{d:P,fill:"none",className:"react-flow__connection-path",style:c})};RE.displayName="ConnectionLine";var VE=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 HE(e){var n=e.containerStyle,t=e.style,r=e.type,o=e.component,i=nb(VE,Db),a=i.nodeId,u=i.handleType,c=i.nodesConnectable,s=i.width,l=i.height,d=i.connectionStatus;return!!(a&&u&&s&&c)?v.jsx("svg",{style:n,width:s,height:l,className:"react-flow__connectionline react-flow__container",children:v.jsx("g",{className:x(["react-flow__connection",d]),children:v.jsx(RE,{nodeId:a,handleType:u,style:t,type:r,CustomComponent:o,connectionStatus:d})})}):null}function YE(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,s=e.onEdgeMouseEnter,l=e.onEdgeMouseMove,d=e.onEdgeMouseLeave,f=e.onEdgeContextMenu,h=e.rfId,p=e.minZoom,g=e.maxZoom,y=e.noPanClassName,m=e.noDragClassName,x=e.nodeOrigin,w=e.viewport,b=e.disableKeyboardA11y,_=e.translateExtent,E=e.defaultViewport,S=e.nodeTypes,k=e.edgeTypes,C=e.elementsSelectable,M=e.defaultMarkerColor,N=e.connectionLineType,P=e.connectionLineStyle,O=e.connectionLineComponent,j=e.connectionLineContainerStyle,I=e.onPaneClick,A=e.onPaneContextMenu,z=e.onPaneMouseEnter,T=e.onPaneMouseMove,L=e.onPaneMouseLeave,B=e.onPaneScroll;return v.jsx(d_,{minZoom:p,maxZoom:g,noPanClassName:y,noDragClassName:m,isControlledViewport:!!w,disableKeyboardA11y:b,translateExtent:_,defaultViewport:E,elementsSelectable:C,onPaneClick:I,onPaneContextMenu:A,onPaneMouseEnter:z,onPaneMouseMove:T,onPaneMouseLeave:L,onPaneScroll:B,children:v.jsxs(BE,{children:[v.jsx(TE,{rfId:h,edgeTypes:k,noPanClassName:y,onEdgeClick:u,onEdgeDoubleClick:c,onEdgeMouseEnter:s,onEdgeMouseMove:l,onEdgeMouseLeave:d,onEdgeContextMenu:f,defaultMarkerColor:M}),v.jsx(HE,{style:P,type:N,component:O,containerStyle:j}),v.jsx("div",{className:"ink-flow__edgelabel-renderer"}),v.jsx(G_,{rfId:h,nodeTypes:S,nodeOrigin:x,noDragClassName:m,noPanClassName:y,disableKeyboardA11y:!1,onNodeClick:n,onNodeDoubleClick:t,onNodeMouseEnter:r,onNodeMouseMove:o,onNodeMouseLeave:i,onNodeContextMenu:a}),v.jsx("div",{className:"ink-flow__viewport-portal"})]})})}YE.displayName="GraphView";var XE=e.memo(YE),ZE=function(e){var n,t,r=void 0===e?{}:e,o=r.nodes,i=r.edges,a=r.defaultNodes,u=r.defaultEdges;r.width,r.height,r.fitView;var c=new Map,s=new Map,l=new Map,d=new Map,f=null!==(n=null!=u?u:i)&&void 0!==n?n:[],h=null!==(t=null!=a?a:o)&&void 0!==t?t:[];ab(l,d,f),ub(h,c,s,{nodeOrigin:[0,0],elevateNodesOnSelect:!1});return{rfId:"1",width:0,height:0,transform:[0,0,1],nodes:h,nodeLookup:c,parentLookup:s,edges:f,edgeLookup:d,connectionLookup:l,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==a,hasDefaultEdges:void 0!==u,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:cv,nodeExtent:cv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:exports.ConnectionMode.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,fitViewOnInit:!1,fitViewDone:!1,fitViewOnInitOptions:void 0,selectNodesOnDrag:!0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:void 0,isValidConnection:void 0,onSelectionChangeHandlers:[],autoLayout:!1,layoutConfig:h_,layoutTypes:{},centerConfig:{},centered:!1,lib:"react",debug:!1}},FE=function(e){var n,r,o=e.nodes,i=e.edges,s=e.defaultNodes,l=e.defaultEdges,d=e.width,f=e.height,h=e.fitView;return n=function(e,n){return t(t({},ZE({nodes:o,edges:i,width:d,height:f,fitView:h,defaultNodes:s,defaultEdges:l})),{setNodes:function(t){var r=n();ub(t,r.nodeLookup,r.parentLookup,{nodeOrigin:r.nodeOrigin,elevateNodesOnSelect:r.elevateNodesOnSelect,checkEquality:!0}),e({nodes:t})},setEdges:function(t){var r=n();ab(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(e){var r=n(),o=r.triggerNodeChanges,i=r.nodeLookup,a=r.parentLookup,s=r.domNode,l=r.nodeOrigin,d=r.debug,f=function(e,n,r,o,i){var a=null==o?void 0:o.querySelector(".xyflow__viewport"),s=!1;if(!a)return{changes:[],updatedInternals:s};var l=[],d=window.getComputedStyle(a),f=new window.DOMMatrixReadOnly(d.transform).m22,h=[];if(e.forEach((function(e){var r=n.get(e.id);if(null==r?void 0:r.hidden)n.set(r.id,t(t({},r),{internals:t(t({},r.internals),{handleBounds:void 0})})),s=!0;else if(r){var o=Nb(e.nodeElement),a=r.measured.width!==o.width||r.measured.height!==o.height;if(o.width&&o.height&&(a||!r.internals.handleBounds||e.force)){var u=t(t({},r),{measured:o,internals:t(t({},r.internals),{handleBounds:{source:Ab(".source",e.nodeElement,f,r.origin||i),target:Ab(".target",e.nodeElement,f,r.origin||i)}})});n.set(r.id,u),s=!0,a&&(l.push({id:u.id,type:"dimensions",dimensions:o}),u.expandParent&&u.parentId&&h.push({id:u.id,parentId:u.parentId,rect:pb(u,u.origin||i)}))}}})),h.length>0){var v=cb(h,n,r,i);l.push.apply(l,c([],u(v),!1))}return{changes:l,updatedInternals:s}}(e,i,a,s,l),h=f.changes;f.updatedInternals&&(rb(i,{nodeOrigin:l}),(null==h?void 0:h.length)>0&&(d&&console.log("Ink Flow: trigger node changes",h),null==o||o(h)))},updateNodePositions:function(e,r){var o,i;void 0===r&&(r=!1);var s=[],l=[];try{for(var d=a(e),f=d.next();!f.done;f=d.next()){var h=u(f.value,2),v=h[0],p=h[1],g={id:v,type:"position",position:p.position,dragging:r};(null==p?void 0:p.expandParent)&&(null==p?void 0:p.parentId)&&g.position&&(s.push({id:v,parentId:p.parentId,rect:t(t({},p.internals.positionAbsolute),{width:p.measured.width,height:p.measured.height})}),g.position.x=Math.max(0,g.position.x),g.position.y=Math.max(0,g.position.y)),l.push(g)}}catch(e){o={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}if(s.length>0){var y=n(),m=cb(s,y.nodeLookup,y.parentLookup);l.push.apply(l,c([],u(m),!1))}n().triggerNodeChanges(l)},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(Ub(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(Fb(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,s=t.triggerEdgeChanges;r?a(e.map((function(e){return Wb(e,!0)}))):(a(Gb(i,new Set(c([],u(e),!1)),!0)),s(Gb(o)))},addSelectedEdges:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,s=t.triggerEdgeChanges;r?s(e.map((function(e){return Wb(e,!0)}))):(s(Gb(o,new Set(c([],u(e),!1)))),a(Gb(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,s=i.triggerEdgeChanges,l=o||a,d=(r||u).map((function(e){return e.selected=!1,Wb(e.id,!1)})),f=l.map((function(e){return Wb(e.id,!1)}));c(d),s(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?c(c([],u(e),!1),[Wb(n.id,!1)],!1):e}),[]),s=t.reduce((function(e,n){return n.selected?c(c([],u(e),!1),[Wb(n.id,!1)],!1):e}),[]);o(a),i(s)},setNodeExtent:function(r){var o,i,c=n().nodeLookup;try{for(var s=a(c),l=s.next();!l.done;l=s.next()){var d=u(l.value,2)[1],f=lb(d.position,r);c.set(d.id,t(t({},d),{internals:t(t({},d.internals),{positionAbsolute:f})}))}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}e({nodeExtent:r})},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})},cancelConnection:function(){return e({connectionStatus:null,connectionStartHandle:null,connectionEndHandle:null})},updateConnection:function(r){var o,i=n().connectionPosition,a=t(t({},r),{connectionPosition:null!==(o=r.connectionPosition)&&void 0!==o?o:i});e(a)},reset:function(){return e(t({},ZE()))}})},r=Object.is,n?j(n,r):j};function UE(n){var t=n.initialNodes,r=n.initialEdges,o=n.defaultNodes,i=n.defaultEdges,a=n.initialWidth,c=n.initialHeight,s=n.fitView,l=n.children,d=u(e.useState((function(){return FE({nodes:t,edges:r,defaultNodes:o,defaultEdges:i,width:a,height:c,fitView:s})})),1)[0];return v.jsx(A,{value:d,children:v.jsx(m_,{children:l})})}function WE(n){var t=n.children,r=n.nodes,o=n.edges,i=n.defaultNodes,a=n.defaultEdges,u=n.width,c=n.height,s=n.fitView;return e.useContext(I)?v.jsx(v.Fragment,{children:t}):v.jsx(UE,{initialNodes:r,initialEdges:o,defaultNodes:i,defaultEdges:a,initialWidth:u,initialHeight:c,fitView:s,children:t})}var GE=c(c([],u(["nodes","edges","defaultNodes","defaultEdges","nodesDraggable","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","translateExtent","defaultEdgeOptions","fitView","fitViewOptions","nodeOrigin","autoLayout","layoutConfig","centerConfig","layoutTypes"]),!1),["rfId"],!1),qE=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}},$E={translateExtent:cv,nodeOrigin:[0,0],minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function KE(n){var t=nb(qE,Db),r=t.setNodes,o=t.setEdges,i=t.setMinZoom,u=t.setMaxZoom,c=t.setTranslateExtent,s=t.setNodeExtent,l=t.reset,d=t.setDefaultNodesAndEdges,f=tb();e.useEffect((function(){return d(n.defaultNodes,n.defaultEdges),function(){h.current=$E,l()}}),[]);var h=e.useRef($E);return e.useEffect((function(){var e,t,l;try{for(var d=a(GE),v=d.next();!v.done;v=d.next()){var p=v.value,g=n[p];g!==h.current[p]&&(void 0!==n[p]&&("nodes"===p?r(g):"edges"===p?o(g):"minZoom"===p?i(g):"maxZoom"===p?u(g):"translateExtent"===p?c(g):"nodeExtent"===p?s(g):"fitView"===p?f.setState({fitViewOnInit:g}):"fitViewOptions"===p?f.setState({fitViewOnInitOptions:g}):f.setState(((l={})[p]=g,l))))}}catch(n){e={error:n}}finally{try{v&&!v.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}h.current=n}),GE.map((function(e){return n[e]}))),null}var QE={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var JE=wb((function(e,n){var o=e.nodes,i=e.edges,a=e.translateExtent,u=void 0===a?cv:a,c=e.defaultViewport,s=void 0===c?f_:c,l=e.minZoom,d=void 0===l?.5:l,f=e.maxZoom,h=void 0===f?2:f,p=e.defaultMarkerColor,g=void 0===p?"#b1b1b7":p,y=e.nodeOrigin,m=e.noDragClassName,w=e.noPanClassName,b=e.disableKeyboardA11y,_=e.nodeTypes,E=e.edgeTypes;e.connectionMode;var S=e.connectionLineType,k=void 0===S?exports.ConnectionLineType.Bezier:S,C=e.connectionLineStyle,M=e.connectionLineComponent,N=e.connectionLineContainerStyle,P=e.onNodeClick,O=e.onNodeDoubleClick,j=e.onNodeMouseEnter,I=e.onNodeMouseMove,A=e.onNodeMouseLeave,z=e.onNodeContextMenu,T=e.onEdgeClick,L=e.onEdgeMouseEnter,B=e.onEdgeMouseMove,D=e.onEdgeMouseLeave,R=e.onEdgeContextMenu,V=e.onEdgeDoubleClick,H=e.onNodesChange,Y=e.onEdgesChange,X=e.fitView,Z=e.fitViewOptions,F=e.nodeExtent,U=e.nodesDraggable,W=e.children,G=e.id,q=e.width,$=e.height,K=e.onPaneClick,Q=e.onPaneContextMenu,J=e.onPaneMouseEnter,ee=e.onPaneMouseMove,ne=e.onPaneMouseLeave,te=e.onPaneScroll,re=e.elementsSelectable,oe=void 0===re||re,ie=e.autoLayout,ae=void 0!==ie&&ie,ue=e.layoutConfig,ce=void 0===ue?h_:ue,se=e.centerConfig,le=void 0===se?{}:se,de=e.layoutTypes,fe=void 0===de?{}:de,he=r(e,["nodes","edges","translateExtent","defaultViewport","minZoom","maxZoom","defaultMarkerColor","nodeOrigin","noDragClassName","noPanClassName","disableKeyboardA11y","nodeTypes","edgeTypes","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","autoLayout","layoutConfig","centerConfig","layoutTypes"]),ve=G||"1";return v.jsx("div",t({},he,{ref:n,style:t({},QE),className:x(["ink-flow"]),"data-testid":"rf__wrapper",id:G,children:v.jsxs(WE,{nodes:o,edges:i,width:q,height:$,fitView:X,children:[v.jsx(XE,{onNodeClick:P,onNodeMouseEnter:j,onNodeMouseMove:I,onNodeMouseLeave:A,onNodeContextMenu:z,onNodeDoubleClick:O,onEdgeClick:T,onEdgeMouseEnter:L,onEdgeMouseMove:B,onEdgeMouseLeave:D,onEdgeContextMenu:R,onEdgeDoubleClick:V,rfId:ve,nodeTypes:_,edgeTypes:E,minZoom:d,maxZoom:h,nodeOrigin:y,noDragClassName:m,noPanClassName:w,disableKeyboardA11y:b,translateExtent:u,defaultMarkerColor:g,connectionLineType:k,connectionLineStyle:C,connectionLineComponent:M,connectionLineContainerStyle:N,defaultViewport:s,onPaneClick:K,onPaneContextMenu:Q,onPaneMouseEnter:J,onPaneMouseMove:ee,onPaneMouseLeave:ne,onPaneScroll:te}),v.jsx(KE,{nodes:o,edges:i,rfId:ve,onNodesChange:H,onEdgesChange:Y,fitView:X,fitViewOptions:Z,nodeExtent:F,nodesDraggable:U,elementsSelectable:oe,minZoom:d,maxZoom:h,nodeOrigin:y,autoLayout:ae,layoutConfig:ce,layoutTypes:fe,centerConfig:le}),W]})}))}));function eS(){return v.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:v.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 nS(){return v.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:v.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 tS(){return v.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:v.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 rS(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.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 oS(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.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 iS(e){var n=e.children,o=e.className,i=r(e,["children","className"]);return v.jsx("button",t({type:"button",className:x(["ink-flow__controls-button",o])},i,{children:n}))}var aS=function(e){return e.userSelectionActive?"none":"all"};function uS(e){var n=e.position,o=void 0===n?"top-left":n,i=e.children,a=e.className,s=e.style,l=r(e,["position","children","className","style"]),d=nb(aS),f="".concat(o).split("-");return v.jsx("div",t({className:x(c(["ink-flow__panel",a],u(f),!1)),style:t(t({},s),{pointerEvents:d})},l,{children:i}))}var cS=function(e){return{isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}};function sS(e){var n=e.style,t=e.showZoom,r=void 0===t||t,o=e.showFitView,i=void 0===o||o,a=e.showInteractive,u=void 0===a||a,c=e.fitViewOptions,s=e.onZoomIn,l=e.onZoomOut,d=e.onFitView,f=e.onInteractiveChange,h=e.className,p=e.children,g=e.position,y=void 0===g?"bottom-left":g,m=e.orientation,w=void 0===m?"vertical":m,b=e["aria-label"],_=void 0===b?"Ink Flow controls":b,E=tb(),S=nb(cS,Db),k=S.isInteractive,C=S.minZoomReached,M=S.maxZoomReached,N=b_(),P=N.zoomIn,O=N.zoomOut,j=N.fitView,I="horizontal"===w?"horizontal":"vertical";return v.jsxs(uS,{className:x(["ink-flow__controls",I,h]),position:y,style:n,"data-testid":"rf__controls","aria-label":_,children:[i&&v.jsx(iS,{className:"ink-flow__controls-fitview",onClick:function(){j(c),null==d||d()},"aria-label":"fit view",children:v.jsx(tS,{})}),r&&v.jsxs("div",{className:"ink-flow__controls-zoom",children:[v.jsx(iS,{onClick:function(){P(),null==s||s()},className:"ink-flow__controls-zoomin","aria-label":"zoom in",disabled:M,children:v.jsx(eS,{})}),v.jsx(iS,{onClick:function(){O(),null==l||l()},className:"ink-flow__controls-zoomout","aria-label":"zoom out",disabled:C,children:v.jsx(nS,{})})]}),u&&v.jsx(iS,{className:"ink-flow__controls-interactive",onClick:function(){E.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),null==f||f(!k)},title:"toggle interactivity","aria-label":"toggle interactivity",children:k?v.jsx(oS,{}):v.jsx(rS,{})}),p]})}sS.displayName="Controls";var lS,dS,fS=e.memo(sS);function hS(e){var n=e.dimensions,t=e.lineWidth,r=e.variant,o=e.className;return v.jsx("path",{strokeWidth:t,d:"M".concat(n[0]/2," 0 V").concat(n[1]," M0 ").concat(n[1]/2," H").concat(n[0]),className:x(["react-flow__background-pattern",r,o])})}function vS(e){var n=e.radius,t=e.className;return v.jsx("circle",{cx:n,cy:n,r:n,className:x(["react-flow__background-pattern","dots",t])})}exports.BackgroundVariant=void 0,(lS=exports.BackgroundVariant||(exports.BackgroundVariant={})).Lines="lines",lS.Dots="dots",lS.Cross="cross";var pS=((dS={})[exports.BackgroundVariant.Dots]=1,dS[exports.BackgroundVariant.Lines]=1,dS[exports.BackgroundVariant.Cross]=6,dS),gS=function(e){return{transform:e.transform,patternId:"pattern-".concat(e.rfId)}};function yS(n){var r=n.id,o=n.variant,i=void 0===o?exports.BackgroundVariant.Dots:o,a=n.gap,u=void 0===a?20:a,c=n.size,s=n.lineWidth,l=void 0===s?1:s,d=n.offset,f=void 0===d?2:d,h=n.color,p=n.bgColor,g=n.style,y=n.className,m=n.patternClassName,w=e.useRef(null),b=nb(gS,Db),_=b.transform,E=b.patternId,S=c||pS[i],k=i===exports.BackgroundVariant.Dots,C=i===exports.BackgroundVariant.Cross,M=Array.isArray(u)?u:[u,u],N=[M[0]*_[2]||1,M[1]*_[2]||1],P=S*_[2],O=C?[P,P]:N,j=k?[P/f,P/f]:[O[0]/f,O[1]/f],I="".concat(E).concat(r||"");return v.jsxs("svg",{className:x(["ink-flow__background",y]),style:t(t(t({},g),Rb),{"--xy-background-color-props":p,"--xy-background-pattern-color-props":h}),ref:w,"data-testid":"rf__background",children:[v.jsx("pattern",{id:I,x:_[0]%N[0],y:_[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:"translate(-".concat(j[0],",-").concat(j[1],")"),children:k?v.jsx(vS,{radius:P/f,className:m}):v.jsx(hS,{dimensions:O,lineWidth:l,variant:i,className:m})}),v.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"url(#".concat(I,")")})]})}yS.displayName="Background";var mS=e.memo(yS),xS=function(e){var n;return null===(n=e.domNode)||void 0===n?void 0:n.querySelector(".ink-flow__edgelabel-renderer")};exports.Background=mS,exports.BaseEdge=tE,exports.ControlButton=iS,exports.Controls=fS,exports.EdgeLabelRenderer=function(e){var t=e.children,r=nb(xS);return r?n.createPortal(t,r):null},exports.Handle=R_,exports.InkFlowProvider=UE,exports.SmoothStepEdge=sE,exports.StepEdge=fE,exports.addEdge=function(e,n){return e.source&&e.target?function(e,n){return n.some((function(n){return!(n.source!==e.source||n.target!==e.target||n.sourceHandle!==e.sourceHandle&&(n.sourceHandle||e.sourceHandle)||n.targetHandle!==e.targetHandle&&(n.targetHandle||e.targetHandle))}))}(t=function(e){return"id"in e&&"source"in e&&"target"in e}(e)?z({},e):z(z({},e),{id:Vv(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t},exports.dagreLayout=Zv,exports.default=JE,exports.getBezierEdgeCenter=zv,exports.getBezierPath=Bv,exports.getConnectedEdges=function(e,n){var t=new Set;return e.forEach((function(e){t.add(e.id)})),n.filter((function(e){return t.has(e.source)||t.has(e.target)}))},exports.getEdgeCenter=Dv,exports.getIncomers=function(e,n,t){if(!e.id)return[];var r=new Set;return t.forEach((function(n){n.target===e.id&&r.add(n.source)})),n.filter((function(e){return r.has(e.id)}))},exports.getNodesBounds=hv,exports.getOutgoers=function(e,n,t){if(!e.id)return[];var r=new Set;return t.forEach((function(n){n.source===e.id&&r.add(n.target)})),n.filter((function(e){return r.has(e.id)}))},exports.getSmoothStepPath=Xv,exports.getStraightPath=function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=L(Dv({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],s=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,s]},exports.getViewportForBounds=Mv,exports.updateEdge=function(e,n,t,r){void 0===r&&(r={shouldReplaceId:!0});var o=e.id,i=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(e,["id"]);if(!n.source||!n.target)return t;if(!t.find((function(n){return n.id===e.id})))return t;var a=z(z({},i),{id:r.shouldReplaceId?Vv(n):o,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle});return t.filter((function(e){return e.id!==o})).concat(a)},exports.useEdgesState=function(n){var t=u(e.useState(n),2),r=t[0],o=t[1],i=e.useCallback((function(e){return o((function(n){return Fb(e,n)}))}),[]);return[r,o,i]},exports.useInkFlow=b_,exports.useNodesState=function(n){var r=u(e.useState(n),2),o=r[0],i=r[1],a=tb(),c=e.useCallback((function(e){var n=a.getState(),t=n.nodeOrigin,r=n.width,o=n.height,i=n.fitViewDone,u=n.panZoom,c=n.fitViewOnInit,s=n.minZoom,l=n.maxZoom,d=n.fitViewOnInitOptions;if(c&&!i&&u){var f=new Map;e.forEach((function(e){f.set(e.id,e)}));var h=n_({nodeLookup:f,width:r,height:o,panZoom:u,nodeOrigin:t,minZoom:s,maxZoom:l},d);a.setState({fitViewDone:h})}}),[a]),s=e.useCallback((function(e){var n=a.getState(),t=n.fitViewDone,r=n.centered,o=n.centerConfig,i=n.width,u=n.height,c=n.transform,s=n.panZoom,l=n.nodeOrigin;if(!r&&!t&&o&&s){var d=o.centerByBBox,f=o.centerNodeId;if(f){var h=e.find((function(e){return e.id===f}));if(h)return void function(e){var n=e.node,t=e.height,r=e.width,o=e.zoom,i=void 0===o?1:o,a=e.panZoom,u=db(n),c={x:r/2-(n.position.x+u.width/2)*i,y:t/2-(n.position.y+u.height/2)*i};a.setViewport({x:c.x,y:c.y,zoom:i})}({node:h,width:i,height:u,panZoom:s,nodeOrigin:l,zoom:c[2]})}d&&function(e){var n=e.nodes,t=e.nodeOrigin,r=e.height,o=e.width,i=e.zoom,a=void 0===i?1:i,u=e.panZoom,c=Qb(n,{nodeOrigin:t}),s={x:o/2-(c.x+c.width/2)*a,y:r/2-(c.y+c.height/2)*a};u.setViewport({x:s.x,y:s.y,zoom:a})}({nodes:e,width:i,height:u,panZoom:s,nodeOrigin:l,zoom:c[2]}),a.setState({centered:!0})}}),[a]),l=e.useCallback((function(e){var n=a.getState(),r=n.layoutTypes,o=n.layoutConfig,u=void 0===o?h_:o,l=n.edges,d=n.setEdges,f=n.nodeOrigin,h=n.width,v=n.height,p=r[null==u?void 0:u.type]||v_[null==u?void 0:u.type];if(!p)return i(e),void console.error("layout function is not existed");var g=[];e.forEach((function(e){e.data&&(e.data.width=e.measured.width,e.data.height=e.measured.height),g.push(e)}));var y=p(g,l,t({nodeOrigin:f,width:h,height:v},null==u?void 0:u.options)),m=y.nodes,x=y.edges;c(m),s(m),i(m),d(x)}),[a,c,s]),d=e.useCallback((function(e){var n=Ub(e,o),r=function(e,n){if(!e.every((function(e){return e.measured})))return!1;var r=n.reduce((function(e,n){var r;return t(t({},e),((r={})[n.id]=n,r))}),{});return e.some((function(e){var n=db(e),t=r[e.id],o=t?db(t):{width:0,height:0};return n.width!==o.width||n.height!==o.height}))}(n,o),u=a.getState().autoLayout;r&&u?l(n):i(n)}),[o,l]);return[o,i,d]},exports.useStore=nb,exports.useStoreApi=tb;
16
+ */b.exports=function(){if(x)return _;x=1;var e=n,t=k(),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,u=e.useEffect,a=e.useMemo,c=e.useDebugValue;return _.useSyncExternalStoreWithSelector=function(n,e,t,l,s){var f=i(null);if(null===f.current){var d={hasValue:!1,value:null};f.current=d}else d=f.current;f=a((function(){function n(n){if(!u){if(u=!0,o=n,n=l(n),void 0!==s&&d.hasValue){var e=d.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,u=!1,a=void 0===t?null:t;return[function(){return n(e())},null===a?void 0:function(){return n(a())}]}),[e,t,l,s]);var h=o(n,f[0],f[1]);return u((function(){d.hasValue=!0,d.value=h}),[h]),c(h),h},_}();var C=s(b.exports);const M=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:()=>u,subscribe:n=>(t.add(n),()=>t.delete(n)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},u=e=n(r,o,i);return i},{useDebugValue:N}=n,{useSyncExternalStoreWithSelector:O}=C,P=n=>n;function j(n,e=P,t){const r=O(n.subscribe,n.getState,n.getServerState||n.getInitialState,e,t);return N(r),r}const I=(n,e)=>{const t=(n=>n?M(n):M)(n),r=(n,r=e)=>j(t,n,r);return Object.assign(r,t),r};var A=n.createContext(null),z=A.Provider,L=function(){return L=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},L.apply(this,arguments)};function T(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 B(n,e){var t="function"==typeof Symbol&&n[Symbol.iterator];if(!t)return n;var r,o,i=t.call(n),u=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)u.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 u}function R(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 D,V,H,Y,Z,X,U,F,W,$,G,q,K,Q,J,nn,en,tn,rn,on,un,an,cn,ln,sn,fn,dn,hn,vn,pn,gn,yn,mn,xn,wn,bn,_n,En,Sn,kn,Cn,Mn,Nn,On,Pn,jn,In,An,zn,Ln,Tn,Bn,Rn,Dn,Vn,Hn,Yn,Zn,Xn,Un,Fn,Wn,$n,Gn,qn,Kn,Qn,Jn,ne,ee,te,re,oe,ie,ue,ae,ce,le,se,fe,de,he,ve,pe,ge,ye,me,xe,we,be,_e,Ee,Se,ke,Ce,Me,Ne,Oe,Pe,je,Ie,Ae,ze,Le,Te,Be,Re,De,Ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function He(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Ye(){return Y?H:(Y=1,H=function(n,e){return n===e||n!=n&&e!=e})}function Ze(){if(X)return Z;X=1;var n=Ye();return Z=function(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1},Z}function Xe(){if(nn)return J;nn=1;var n=V?D:(V=1,D=function(){this.__data__=[],this.size=0}),e=function(){if(F)return U;F=1;var n=Ze(),e=Array.prototype.splice;return U=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 W;$=1;var n=Ze();return W=function(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}}(),r=function(){if(q)return G;q=1;var n=Ze();return G=function(e){return n(this.__data__,e)>-1}}(),o=function(){if(Q)return K;Q=1;var n=Ze();return K=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,J=i}function Ue(){if(fn)return sn;fn=1;var n="object"==typeof Ve&&Ve&&Ve.Object===Object&&Ve;return sn=n}function Fe(){if(hn)return dn;hn=1;var n=Ue(),e="object"==typeof self&&self&&self.Object===Object&&self,t=n||e||Function("return this")();return dn=t}function We(){if(pn)return vn;pn=1;var n=Fe().Symbol;return vn=n}function $e(){if(bn)return wn;bn=1;var n=We(),e=function(){if(yn)return gn;yn=1;var n=We(),e=Object.prototype,t=e.hasOwnProperty,r=e.toString,o=n?n.toStringTag:void 0;return gn=function(n){var e=t.call(n,o),i=n[o];try{n[o]=void 0;var u=!0}catch(n){}var a=r.call(n);return u&&(e?n[o]=i:delete n[o]),a}}(),t=function(){if(xn)return mn;xn=1;var n=Object.prototype.toString;return mn=function(e){return n.call(e)}}(),r=n?n.toStringTag:void 0;return wn=function(n){return null==n?void 0===n?"[object Undefined]":"[object Null]":r&&r in Object(n)?e(n):t(n)}}function Ge(){return En?_n:(En=1,_n=function(n){var e=typeof n;return null!=n&&("object"==e||"function"==e)})}function qe(){if(kn)return Sn;kn=1;var n=$e(),e=Ge();return Sn=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 Ke(){if(jn)return Pn;jn=1;var n=Function.prototype.toString;return Pn=function(e){if(null!=e){try{return n.call(e)}catch(n){}try{return e+""}catch(n){}}return""}}function Qe(){if(Bn)return Tn;Bn=1;var n=function(){if(An)return In;An=1;var n=qe(),e=function(){if(On)return Nn;On=1;var n,e=function(){if(Mn)return Cn;Mn=1;var n=Fe()["__core-js_shared__"];return Cn=n}(),t=(n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";return Nn=function(n){return!!t&&t in n}}(),t=Ge(),r=Ke(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,u=Object.prototype,a=i.toString,c=u.hasOwnProperty,l=RegExp("^"+a.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return In=function(i){return!(!t(i)||e(i))&&(n(i)?l:o).test(r(i))}}(),e=Ln?zn:(Ln=1,zn=function(n,e){return null==n?void 0:n[e]});return Tn=function(t,r){var o=e(t,r);return n(o)?o:void 0}}function Je(){if(Dn)return Rn;Dn=1;var n=Qe()(Fe(),"Map");return Rn=n}function nt(){if(Hn)return Vn;Hn=1;var n=Qe()(Object,"create");return Vn=n}function et(){if(ie)return oe;ie=1;var n=re?te:(re=1,te=function(n){var e=typeof n;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==n:null===n});return oe=function(e,t){var r=e.__data__;return n(t)?r["string"==typeof t?"string":"hash"]:r.map}}function tt(){if(pe)return ve;pe=1;var n=function(){if(ee)return ne;ee=1;var n=function(){if(Jn)return Qn;Jn=1;var n=function(){if(Zn)return Yn;Zn=1;var n=nt();return Yn=function(){this.__data__=n?n(null):{},this.size=0}}(),e=Un?Xn:(Un=1,Xn=function(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}),t=function(){if(Wn)return Fn;Wn=1;var n=nt(),e=Object.prototype.hasOwnProperty;return Fn=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(Gn)return $n;Gn=1;var n=nt(),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(Kn)return qn;Kn=1;var n=nt();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,Qn=i}(),e=Xe(),t=Je();return ne=function(){this.size=0,this.__data__={hash:new n,map:new(t||e),string:new n}}}(),e=function(){if(ae)return ue;ae=1;var n=et();return ue=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}}(),t=function(){if(le)return ce;le=1;var n=et();return ce=function(e){return n(this,e).get(e)}}(),r=function(){if(fe)return se;fe=1;var n=et();return se=function(e){return n(this,e).has(e)}}(),o=function(){if(he)return de;he=1;var n=et();return de=function(e,t){var r=n(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,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,ve=i}function rt(){if(xe)return me;xe=1;var n=Xe(),e=function(){if(tn)return en;tn=1;var n=Xe();return en=function(){this.__data__=new n,this.size=0}}(),t=on?rn:(on=1,rn=function(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}),r=an?un:(an=1,un=function(n){return this.__data__.get(n)}),o=ln?cn:(ln=1,cn=function(n){return this.__data__.has(n)}),i=function(){if(ye)return ge;ye=1;var n=Xe(),e=Je(),t=tt();return ge=function(r,o){var i=this.__data__;if(i instanceof n){var u=i.__data__;if(!e||u.length<199)return u.push([r,o]),this.size=++i.size,this;i=this.__data__=new t(u)}return i.set(r,o),this.size=i.size,this}}();function u(e){var t=this.__data__=new n(e);this.size=t.size}return u.prototype.clear=e,u.prototype.delete=t,u.prototype.get=r,u.prototype.has=o,u.prototype.set=i,me=u}function ot(){return be||(be=1,we=function(n,e){for(var t=-1,r=null==n?0:n.length;++t<r&&!1!==e(n[t],t,n););return n}),we}function it(){if(Ee)return _e;Ee=1;var n=Qe(),e=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch(n){}}();return _e=e}function ut(){if(ke)return Se;ke=1;var n=it();return Se=function(e,t,r){"__proto__"==t&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}}function at(){if(Me)return Ce;Me=1;var n=ut(),e=Ye(),t=Object.prototype.hasOwnProperty;return Ce=function(r,o,i){var u=r[o];t.call(r,o)&&e(u,i)&&(void 0!==i||o in r)||n(r,o,i)}}function ct(){if(Oe)return Ne;Oe=1;var n=at(),e=ut();return Ne=function(t,r,o,i){var u=!o;o||(o={});for(var a=-1,c=r.length;++a<c;){var l=r[a],s=i?i(o[l],t[l],l,o,t):void 0;void 0===s&&(s=t[l]),u?e(o,l,s):n(o,l,s)}return o}}function lt(){return Ae?Ie:(Ae=1,Ie=function(n){return null!=n&&"object"==typeof n})}function st(){if(Be)return Te;Be=1;var n=function(){if(Le)return ze;Le=1;var n=$e(),e=lt();return ze=function(t){return e(t)&&"[object Arguments]"==n(t)}}(),e=lt(),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 Te=i}function ft(){if(De)return Re;De=1;var n=Array.isArray;return Re=n}var dt,ht,vt,pt,gt,yt,mt,xt,wt,bt,_t,Et={exports:{}};function St(){return vt||(vt=1,function(n,e){var t=Fe(),r=ht?dt:(ht=1,dt=function(){return!1}),o=e&&!e.nodeType&&e,i=o&&n&&!n.nodeType&&n,u=i&&i.exports===o?t.Buffer:void 0,a=(u?u.isBuffer:void 0)||r;n.exports=a}(Et,Et.exports)),Et.exports}function kt(){if(gt)return pt;gt=1;var n=/^(?:0|[1-9]\d*)$/;return pt=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 Ct(){return mt?yt:(mt=1,yt=function(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=9007199254740991})}function Mt(){return _t?bt:(_t=1,bt=function(n){return function(e){return n(e)}})}var Nt,Ot,Pt,jt,It,At,zt,Lt,Tt,Bt,Rt,Dt,Vt,Ht,Yt,Zt,Xt,Ut,Ft,Wt,$t,Gt,qt,Kt,Qt,Jt,nr,er={exports:{}};function tr(){return Nt||(Nt=1,n=er,e=er.exports,t=Ue(),r=e&&!e.nodeType&&e,o=r&&n&&!n.nodeType&&n,i=o&&o.exports===r&&t.process,u=function(){try{return o&&o.require&&o.require("util").types||i&&i.binding&&i.binding("util")}catch(n){}}(),n.exports=u),er.exports;var n,e,t,r,o,i,u}function rr(){if(Pt)return Ot;Pt=1;var n=function(){if(wt)return xt;wt=1;var n=$e(),e=Ct(),t=lt(),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,xt=function(o){return t(o)&&e(o.length)&&!!r[n(o)]}}(),e=Mt(),t=tr(),r=t&&t.isTypedArray,o=r?e(r):n;return Ot=o}function or(){if(It)return jt;It=1;var n=je?Pe:(je=1,Pe=function(n,e){for(var t=-1,r=Array(n);++t<n;)r[t]=e(t);return r}),e=st(),t=ft(),r=St(),o=kt(),i=rr(),u=Object.prototype.hasOwnProperty;return jt=function(a,c){var l=t(a),s=!l&&e(a),f=!l&&!s&&r(a),d=!l&&!s&&!f&&i(a),h=l||s||f||d,v=h?n(a.length,String):[],p=v.length;for(var g in a)!c&&!u.call(a,g)||h&&("length"==g||f&&("offset"==g||"parent"==g)||d&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||o(g,p))||v.push(g);return v}}function ir(){if(zt)return At;zt=1;var n=Object.prototype;return At=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}}function ur(){return Tt||(Tt=1,Lt=function(n,e){return function(t){return n(e(t))}}),Lt}function ar(){if(Vt)return Dt;Vt=1;var n=ir(),e=function(){if(Rt)return Bt;Rt=1;var n=ur()(Object.keys,Object);return Bt=n}(),t=Object.prototype.hasOwnProperty;return Dt=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 cr(){if(Yt)return Ht;Yt=1;var n=qe(),e=Ct();return Ht=function(t){return null!=t&&e(t.length)&&!n(t)}}function lr(){if(Xt)return Zt;Xt=1;var n=or(),e=ar(),t=cr();return Zt=function(r){return t(r)?n(r):e(r)}}function sr(){if(Qt)return Kt;Qt=1;var n=or(),e=function(){if(qt)return Gt;qt=1;var n=Ge(),e=ir(),t=$t?Wt:($t=1,Wt=function(n){var e=[];if(null!=n)for(var t in Object(n))e.push(t);return e}),r=Object.prototype.hasOwnProperty;return Gt=function(o){if(!n(o))return t(o);var i=e(o),u=[];for(var a in o)("constructor"!=a||!i&&r.call(o,a))&&u.push(a);return u}}(),t=cr();return Kt=function(r){return t(r)?n(r,!0):e(r)}}var fr,dr,hr,vr,pr,gr,yr,mr,xr,wr,br,_r,Er,Sr,kr,Cr,Mr,Nr,Or,Pr,jr,Ir,Ar,zr,Lr,Tr,Br,Rr,Dr,Vr,Hr,Yr,Zr,Xr,Ur,Fr,Wr,$r,Gr,qr,Kr,Qr,Jr,no,eo,to,ro,oo,io,uo,ao,co,lo,so,fo,ho,vo,po,go,yo,mo,xo,wo,bo,_o,Eo,So,ko,Co,Mo,No,Oo,Po,jo,Io,Ao,zo,Lo,To,Bo,Ro,Do,Vo,Ho,Yo,Zo,Xo,Uo,Fo,Wo,$o,Go,qo,Ko,Qo,Jo,ni,ei,ti,ri,oi,ii,ui,ai,ci,li,si,fi,di,hi,vi,pi,gi,yi,mi,xi,wi,bi,_i,Ei,Si,ki,Ci,Mi,Ni,Oi,Pi,ji,Ii,Ai,zi,Li,Ti,Bi,Ri,Di,Vi,Hi,Yi,Zi,Xi,Ui,Fi,Wi,$i,Gi,qi,Ki,Qi,Ji,nu,eu,tu,ru,ou,iu,uu,au,cu,lu,su,fu,du,hu,vu,pu,gu,yu,mu,xu,wu,bu,_u,Eu,Su,ku,Cu,Mu,Nu,Ou,Pu,ju,Iu,Au,zu,Lu,Tu,Bu,Ru,Du,Vu,Hu,Yu,Zu,Xu,Uu,Fu,Wu,$u,Gu,qu,Ku,Qu,Ju,na,ea,ta,ra,oa,ia,ua,aa,ca,la,sa,fa,da,ha,va,pa,ga,ya,ma,xa,wa,ba,_a,Ea,Sa,ka,Ca,Ma,Na,Oa,Pa,ja,Ia,Aa,za,La,Ta,Ba,Ra,Da,Va,Ha,Ya,Za,Xa,Ua,Fa,Wa,$a,Ga,qa,Ka,Qa,Ja,nc,ec,tc,rc,oc,ic,uc,ac,cc,lc,sc,fc,dc,hc,vc,pc,gc,yc,mc,xc,wc,bc,_c={exports:{}};function Ec(){return fr||(fr=1,function(n,e){var t=Fe(),r=e&&!e.nodeType&&e,o=r&&n&&!n.nodeType&&n,i=o&&o.exports===r?t.Buffer:void 0,u=i?i.allocUnsafe:void 0;n.exports=function(n,e){if(e)return n.slice();var t=n.length,r=u?u(t):new n.constructor(t);return n.copy(r),r}}(_c,_c.exports)),_c.exports}function Sc(){return hr||(hr=1,dr=function(n,e){var t=-1,r=n.length;for(e||(e=Array(r));++t<r;)e[t]=n[t];return e}),dr}function kc(){return pr||(pr=1,vr=function(n,e){for(var t=-1,r=null==n?0:n.length,o=0,i=[];++t<r;){var u=n[t];e(u,t,n)&&(i[o++]=u)}return i}),vr}function Cc(){return yr?gr:(yr=1,gr=function(){return[]})}function Mc(){if(xr)return mr;xr=1;var n=kc(),e=Cc(),t=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return mr=r?function(e){return null==e?[]:(e=Object(e),n(r(e),(function(n){return t.call(e,n)})))}:e}function Nc(){return Er||(Er=1,_r=function(n,e){for(var t=-1,r=e.length,o=n.length;++t<r;)n[o+t]=e[t];return n}),_r}function Oc(){if(kr)return Sr;kr=1;var n=ur()(Object.getPrototypeOf,Object);return Sr=n}function Pc(){if(Mr)return Cr;Mr=1;var n=Nc(),e=Oc(),t=Mc(),r=Cc(),o=Object.getOwnPropertySymbols;return Cr=o?function(r){for(var o=[];r;)n(o,t(r)),r=e(r);return o}:r}function jc(){if(jr)return Pr;jr=1;var n=Nc(),e=ft();return Pr=function(t,r,o){var i=r(t);return e(t)?i:n(i,o(t))}}function Ic(){if(Ar)return Ir;Ar=1;var n=jc(),e=Mc(),t=lr();return Ir=function(r){return n(r,t,e)}}function Ac(){if(Hr)return Vr;Hr=1;var n=Qe()(Fe(),"Set");return Vr=n}function zc(){if(Ur)return Xr;Ur=1;var n=function(){if(Br)return Tr;Br=1;var n=Qe()(Fe(),"DataView");return Tr=n}(),e=Je(),t=function(){if(Dr)return Rr;Dr=1;var n=Qe()(Fe(),"Promise");return Rr=n}(),r=Ac(),o=function(){if(Zr)return Yr;Zr=1;var n=Qe()(Fe(),"WeakMap");return Yr=n}(),i=$e(),u=Ke(),a="[object Map]",c="[object Promise]",l="[object Set]",s="[object WeakMap]",f="[object DataView]",d=u(n),h=u(e),v=u(t),p=u(r),g=u(o),y=i;return(n&&y(new n(new ArrayBuffer(1)))!=f||e&&y(new e)!=a||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?u(t):"";if(r)switch(r){case d:return f;case h:return a;case v:return c;case p:return l;case g:return s}return e}),Xr=y}function Lc(){if(Gr)return $r;Gr=1;var n=Fe().Uint8Array;return $r=n}function Tc(){if(Kr)return qr;Kr=1;var n=Lc();return qr=function(e){var t=new e.constructor(e.byteLength);return new n(t).set(new n(e)),t}}function Bc(){if(io)return oo;io=1;var n=Tc();return oo=function(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}}function Rc(){if(lo)return co;lo=1;var n=Ge(),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 co=t}function Dc(){if(fo)return so;fo=1;var n=Rc(),e=Oc(),t=ir();return so=function(r){return"function"!=typeof r.constructor||t(r)?{}:n(e(r))}}function Vc(){if(_o)return bo;_o=1;var n=rt(),e=ot(),t=at(),r=function(){if(Ft)return Ut;Ft=1;var n=ct(),e=lr();return Ut=function(t,r){return t&&n(r,e(r),t)}}(),o=function(){if(nr)return Jt;nr=1;var n=ct(),e=sr();return Jt=function(t,r){return t&&n(r,e(r),t)}}(),i=Ec(),u=Sc(),a=function(){if(br)return wr;br=1;var n=ct(),e=Mc();return wr=function(t,r){return n(t,e(t),r)}}(),c=function(){if(Or)return Nr;Or=1;var n=ct(),e=Pc();return Nr=function(t,r){return n(t,e(t),r)}}(),l=Ic(),s=function(){if(Lr)return zr;Lr=1;var n=jc(),e=Pc(),t=sr();return zr=function(r){return n(r,t,e)}}(),f=zc(),d=function(){if(Wr)return Fr;Wr=1;var n=Object.prototype.hasOwnProperty;return Fr=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},Fr}(),h=function(){if(ao)return uo;ao=1;var n=Tc(),e=function(){if(Jr)return Qr;Jr=1;var n=Tc();return Qr=function(e,t){var r=t?n(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}}(),t=function(){if(eo)return no;eo=1;var n=/\w*$/;return no=function(e){var t=new e.constructor(e.source,n.exec(e));return t.lastIndex=e.lastIndex,t}}(),r=function(){if(ro)return to;ro=1;var n=We(),e=n?n.prototype:void 0,t=e?e.valueOf:void 0;return to=function(n){return t?Object(t.call(n)):{}}}(),o=Bc();return uo=function(i,u,a){var c=i.constructor;switch(u){case"[object ArrayBuffer]":return n(i);case"[object Boolean]":case"[object Date]":return new c(+i);case"[object DataView]":return e(i,a);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,a);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=Dc(),p=ft(),g=St(),y=function(){if(go)return po;go=1;var n=function(){if(vo)return ho;vo=1;var n=zc(),e=lt();return ho=function(t){return e(t)&&"[object Map]"==n(t)}}(),e=Mt(),t=tr(),r=t&&t.isMap,o=r?e(r):n;return po=o}(),m=Ge(),x=function(){if(wo)return xo;wo=1;var n=function(){if(mo)return yo;mo=1;var n=zc(),e=lt();return yo=function(t){return e(t)&&"[object Set]"==n(t)}}(),e=Mt(),t=tr(),r=t&&t.isSet,o=r?e(r):n;return xo=o}(),w=lr(),b=sr(),_="[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,bo=function C(M,N,O,P,j,I){var A,z=1&N,L=2&N,T=4&N;if(O&&(A=j?O(M,P,j,I):O(M)),void 0!==A)return A;if(!m(M))return M;var B=p(M);if(B){if(A=d(M),!z)return u(M,A)}else{var R=f(M),D=R==E||"[object GeneratorFunction]"==R;if(g(M))return i(M,z);if(R==S||R==_||D&&!j){if(A=L||D?{}:v(M),!z)return L?c(M,o(A,M)):a(M,r(A,M))}else{if(!k[R])return j?M:{};A=h(M,R,z)}}I||(I=new n);var V=I.get(M);if(V)return V;I.set(M,A),x(M)?M.forEach((function(n){A.add(C(n,N,O,n,M,I))})):y(M)&&M.forEach((function(n,e){A.set(e,C(n,N,O,e,M,I))}));var H=B?void 0:(T?L?s:l:L?b:w)(M);return e(H||M,(function(n,e){H&&(n=M[e=n]),t(A,e,C(n,N,O,e,M,I))})),A},bo}function Hc(){if(So)return Eo;So=1;var n=Vc();return Eo=function(e){return n(e,4)}}function Yc(){return Co?ko:(Co=1,ko=function(n){return function(){return n}})}function Zc(){if(Po)return Oo;Po=1;var n=(No?Mo:(No=1,Mo=function(n){return function(e,t,r){for(var o=-1,i=Object(e),u=r(e),a=u.length;a--;){var c=u[n?a:++o];if(!1===t(i[c],c,i))break}return e}}))();return Oo=n}function Xc(){if(Io)return jo;Io=1;var n=Zc(),e=lr();return jo=function(t,r){return t&&n(t,r,e)}}function Uc(){if(To)return Lo;To=1;var n=Xc(),e=function(){if(zo)return Ao;zo=1;var n=cr();return Ao=function(e,t){return function(r,o){if(null==r)return r;if(!n(r))return e(r,o);for(var i=r.length,u=t?i:-1,a=Object(r);(t?u--:++u<i)&&!1!==o(a[u],u,a););return r}}}()(n);return Lo=e}function Fc(){return Ro?Bo:(Ro=1,Bo=function(n){return n})}function Wc(){if(Vo)return Do;Vo=1;var n=Fc();return Do=function(e){return"function"==typeof e?e:n}}function $c(){if(Yo)return Ho;Yo=1;var n=ot(),e=Uc(),t=Wc(),r=ft();return Ho=function(o,i){return(r(o)?n:e)(o,t(i))}}function Gc(){return Xo?Zo:(Xo=1,Zo=$c())}function qc(){if(Qo)return Ko;Qo=1;var n=tt(),e=$o?Wo:($o=1,Wo=function(n){return this.__data__.set(n,"__lodash_hash_undefined__"),this}),t=qo?Go:(qo=1,Go=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,Ko=r}function Kc(){return ti?ei:(ti=1,ei=function(n,e){return n.has(e)})}function Qc(){if(oi)return ri;oi=1;var n=qc(),e=(ni||(ni=1,Jo=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}),Jo),t=Kc();return ri=function(r,o,i,u,a,c){var l=1&i,s=r.length,f=o.length;if(s!=f&&!(l&&f>s))return!1;var d=c.get(r),h=c.get(o);if(d&&h)return d==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(u)var x=l?u(m,y,v,o,r,c):u(y,m,v,r,o,c);if(void 0!==x){if(x)continue;p=!1;break}if(g){if(!e(o,(function(n,e){if(!t(g,e)&&(y===n||a(y,n,i,u,c)))return g.push(e)}))){p=!1;break}}else if(y!==m&&!a(y,m,i,u,c)){p=!1;break}}return c.delete(r),c.delete(o),p},ri}function Jc(){return ci||(ci=1,ai=function(n){var e=-1,t=Array(n.size);return n.forEach((function(n){t[++e]=n})),t}),ai}function nl(){if(vi)return hi;vi=1;var n=rt(),e=Qc(),t=function(){if(si)return li;si=1;var n=We(),e=Lc(),t=Ye(),r=Qc(),o=ui?ii:(ui=1,ii=function(n){var e=-1,t=Array(n.size);return n.forEach((function(n,r){t[++e]=[r,n]})),t}),i=Jc(),u=n?n.prototype:void 0,a=u?u.valueOf:void 0;return li=function(n,u,c,l,s,f,d){switch(c){case"[object DataView]":if(n.byteLength!=u.byteLength||n.byteOffset!=u.byteOffset)return!1;n=n.buffer,u=u.buffer;case"[object ArrayBuffer]":return!(n.byteLength!=u.byteLength||!f(new e(n),new e(u)));case"[object Boolean]":case"[object Date]":case"[object Number]":return t(+n,+u);case"[object Error]":return n.name==u.name&&n.message==u.message;case"[object RegExp]":case"[object String]":return n==u+"";case"[object Map]":var h=o;case"[object Set]":var v=1&l;if(h||(h=i),n.size!=u.size&&!v)return!1;var p=d.get(n);if(p)return p==u;l|=2,d.set(n,u);var g=r(h(n),h(u),l,s,f,d);return d.delete(n),g;case"[object Symbol]":if(a)return a.call(n)==a.call(u)}return!1}}(),r=function(){if(di)return fi;di=1;var n=Ic(),e=Object.prototype.hasOwnProperty;return fi=function(t,r,o,i,u,a){var c=1&o,l=n(t),s=l.length;if(s!=n(r).length&&!c)return!1;for(var f=s;f--;){var d=l[f];if(!(c?d in r:e.call(r,d)))return!1}var h=a.get(t),v=a.get(r);if(h&&v)return h==r&&v==t;var p=!0;a.set(t,r),a.set(r,t);for(var g=c;++f<s;){var y=t[d=l[f]],m=r[d];if(i)var x=c?i(m,y,d,r,t,a):i(y,m,d,t,r,a);if(!(void 0===x?y===m||u(y,m,o,i,a):x)){p=!1;break}g||(g="constructor"==d)}if(p&&!g){var w=t.constructor,b=r.constructor;w==b||!("constructor"in t)||!("constructor"in r)||"function"==typeof w&&w instanceof w&&"function"==typeof b&&b instanceof b||(p=!1)}return a.delete(t),a.delete(r),p}}(),o=zc(),i=ft(),u=St(),a=rr(),c="[object Arguments]",l="[object Array]",s="[object Object]",f=Object.prototype.hasOwnProperty;return hi=function(d,h,v,p,g,y){var m=i(d),x=i(h),w=m?l:o(d),b=x?l:o(h),_=(w=w==c?s:w)==s,E=(b=b==c?s:b)==s,S=w==b;if(S&&u(d)){if(!u(h))return!1;m=!0,_=!1}if(S&&!_)return y||(y=new n),m||a(d)?e(d,h,v,p,g,y):t(d,h,w,v,p,g,y);if(!(1&v)){var k=_&&f.call(d,"__wrapped__"),C=E&&f.call(h,"__wrapped__");if(k||C){var M=k?d.value():d,N=C?h.value():h;return y||(y=new n),g(M,N,v,p,y)}}return!!S&&(y||(y=new n),r(d,h,v,p,g,y))}}function el(){if(gi)return pi;gi=1;var n=nl(),e=lt();return pi=function t(r,o,i,u,a){return r===o||(null==r||null==o||!e(r)&&!e(o)?r!=r&&o!=o:n(r,o,i,u,t,a))},pi}function tl(){if(wi)return xi;wi=1;var n=Ge();return xi=function(e){return e==e&&!n(e)}}function rl(){return Si?Ei:(Si=1,Ei=function(n,e){return function(t){return null!=t&&t[n]===e&&(void 0!==e||n in Object(t))}})}function ol(){if(Ni)return Mi;Ni=1;var n=$e(),e=lt();return Mi=function(t){return"symbol"==typeof t||e(t)&&"[object Symbol]"==n(t)}}function il(){if(Pi)return Oi;Pi=1;var n=ft(),e=ol(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return Oi=function(o,i){if(n(o))return!1;var u=typeof o;return!("number"!=u&&"symbol"!=u&&"boolean"!=u&&null!=o&&!e(o))||r.test(o)||!t.test(o)||null!=i&&o in Object(i)}}function ul(){return Ri||(Ri=1,Bi=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}),Bi}function al(){if(Yi)return Hi;Yi=1;var n=function(){if(Vi)return Di;Vi=1;var n=We(),e=ul(),t=ft(),r=ol(),o=n?n.prototype:void 0,i=o?o.toString:void 0;return Di=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 u=o+"";return"0"==u&&1/o==-1/0?"-0":u},Di}();return Hi=function(e){return null==e?"":n(e)}}function cl(){if(Xi)return Zi;Xi=1;var n=ft(),e=il(),t=function(){if(Ti)return Li;Ti=1;var n=function(){if(zi)return Ai;zi=1;var n=function(){if(Ii)return ji;Ii=1;var n=tt();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 u=t.apply(this,n);return o.cache=i.set(e,u)||i,u};return o.cache=new(e.Cache||n),o}return e.Cache=n,ji=e}();return Ai=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 Li=r}(),r=al();return Zi=function(o,i){return n(o)?o:e(o,i)?[o]:t(r(o))}}function ll(){if(Fi)return Ui;Fi=1;var n=ol();return Ui=function(e){if("string"==typeof e||n(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}}function sl(){if($i)return Wi;$i=1;var n=cl(),e=ll();return Wi=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 fl(){if(nu)return Ji;nu=1;var n=cl(),e=st(),t=ft(),r=kt(),o=Ct(),i=ll();return Ji=function(u,a,c){for(var l=-1,s=(a=n(a,u)).length,f=!1;++l<s;){var d=i(a[l]);if(!(f=null!=u&&c(u,d)))break;u=u[d]}return f||++l!=s?f:!!(s=null==u?0:u.length)&&o(s)&&r(d,s)&&(t(u)||e(u))}}function dl(){if(tu)return eu;tu=1;var n=Qi?Ki:(Qi=1,Ki=function(n,e){return null!=n&&e in Object(n)}),e=fl();return eu=function(t,r){return null!=t&&e(t,r,n)}}function hl(){return uu?iu:(uu=1,iu=function(n){return function(e){return null==e?void 0:e[n]}})}function vl(){if(du)return fu;du=1;var n=function(){if(Ci)return ki;Ci=1;var n=function(){if(mi)return yi;mi=1;var n=rt(),e=el();return yi=function(t,r,o,i){var u=o.length,a=u,c=!i;if(null==t)return!a;for(t=Object(t);u--;){var l=o[u];if(c&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++u<a;){var s=(l=o[u])[0],f=t[s],d=l[1];if(c&&l[2]){if(void 0===f&&!(s in t))return!1}else{var h=new n;if(i)var v=i(f,d,s,t,r,h);if(!(void 0===v?e(d,f,3,i,h):v))return!1}}return!0}}(),e=function(){if(_i)return bi;_i=1;var n=tl(),e=lr();return bi=function(t){for(var r=e(t),o=r.length;o--;){var i=r[o],u=t[i];r[o]=[i,u,n(u)]}return r}}(),t=rl();return ki=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(ou)return ru;ou=1;var n=el(),e=function(){if(qi)return Gi;qi=1;var n=sl();return Gi=function(e,t,r){var o=null==e?void 0:n(e,t);return void 0===o?r:o}}(),t=dl(),r=il(),o=tl(),i=rl(),u=ll();return ru=function(a,c){return r(a)&&o(c)?i(u(a),c):function(r){var o=e(r,a);return void 0===o&&o===c?t(r,a):n(c,o,3)}}}(),t=Fc(),r=ft(),o=function(){if(su)return lu;su=1;var n=hl(),e=function(){if(cu)return au;cu=1;var n=sl();return au=function(e){return function(t){return n(t,e)}}}(),t=il(),r=ll();return lu=function(o){return t(o)?n(r(o)):e(o)}}();return fu=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 pl(){if(vu)return hu;vu=1;var n=kc(),e=function(){if(Fo)return Uo;Fo=1;var n=Uc();return Uo=function(e,t){var r=[];return n(e,(function(n,e,o){t(n,e,o)&&r.push(n)})),r}}(),t=vl(),r=ft();return hu=function(o,i){return(r(o)?n:e)(o,t(i,3))}}function gl(){if(mu)return yu;mu=1;var n=function(){if(gu)return pu;gu=1;var n=Object.prototype.hasOwnProperty;return pu=function(e,t){return null!=e&&n.call(e,t)}}(),e=fl();return yu=function(t,r){return null!=t&&e(t,r,n)}}function yl(){if(wu)return xu;wu=1;var n=ar(),e=zc(),t=st(),r=ft(),o=cr(),i=St(),u=ir(),a=rr(),c=Object.prototype.hasOwnProperty;return xu=function(l){if(null==l)return!0;if(o(l)&&(r(l)||"string"==typeof l||"function"==typeof l.splice||i(l)||a(l)||t(l)))return!l.length;var s=e(l);if("[object Map]"==s||"[object Set]"==s)return!l.size;if(u(l))return!n(l).length;for(var f in l)if(c.call(l,f))return!1;return!0}}function ml(){return _u?bu:(_u=1,bu=function(n){return void 0===n})}function xl(){if(Su)return Eu;Su=1;var n=Uc(),e=cr();return Eu=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 wl(){if(Cu)return ku;Cu=1;var n=ul(),e=vl(),t=xl(),r=ft();return ku=function(o,i){return(r(o)?n:t)(o,e(i,3))}}function bl(){if(Iu)return ju;Iu=1;var n=(Nu||(Nu=1,Mu=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}),Mu),e=Uc(),t=vl(),r=Pu?Ou:(Pu=1,Ou=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=ft();return ju=function(i,u,a){var c=o(i)?n:r,l=arguments.length<3;return c(i,t(u,4),a,l,e)},ju}function _l(){if(Xu)return Zu;Xu=1;var n=ar(),e=zc(),t=cr(),r=function(){if(zu)return Au;zu=1;var n=$e(),e=ft(),t=lt();return Au=function(r){return"string"==typeof r||!e(r)&&t(r)&&"[object String]"==n(r)}}(),o=function(){if(Yu)return Hu;Yu=1;var n=function(){if(Tu)return Lu;Tu=1;var n=hl()("length");return Lu=n}(),e=function(){if(Ru)return Bu;Ru=1;var n=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return Bu=function(e){return n.test(e)}}(),t=function(){if(Vu)return Du;Vu=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}",u="[\\ud800-\\udbff][\\udc00-\\udfff]",a="(?:"+t+"|"+r+")?",c="[\\ufe0e\\ufe0f]?",l=c+a+"(?:\\u200d(?:"+[o,i,u].join("|")+")"+c+a+")*",s="(?:"+[o+t+"?",t,i,u,e].join("|")+")",f=RegExp(r+"(?="+r+")|"+s+l,"g");return Du=function(n){for(var e=f.lastIndex=0;f.test(n);)++e;return e}}();return Hu=function(r){return e(r)?t(r):n(r)}}();return Zu=function(i){if(null==i)return 0;if(t(i))return r(i)?o(i):i.length;var u=e(i);return"[object Map]"==u||"[object Set]"==u?i.size:n(i).length}}function El(){if(Fu)return Uu;Fu=1;var n=ot(),e=Rc(),t=Xc(),r=vl(),o=Oc(),i=ft(),u=St(),a=qe(),c=Ge(),l=rr();return Uu=function(s,f,d){var h=i(s),v=h||u(s)||l(s);if(f=r(f,4),null==d){var p=s&&s.constructor;d=v?h?new p:[]:c(s)&&a(p)?e(o(s)):{}}return(v?n:t)(s,(function(n,e,t){return f(d,n,e,t)})),d}}function Sl(){if(qu)return Gu;qu=1;var n=Nc(),e=function(){if($u)return Wu;$u=1;var n=We(),e=st(),t=ft(),r=n?n.isConcatSpreadable:void 0;return Wu=function(n){return t(n)||e(n)||!!(r&&n&&n[r])}}();return Gu=function t(r,o,i,u,a){var c=-1,l=r.length;for(i||(i=e),a||(a=[]);++c<l;){var s=r[c];o>0&&i(s)?o>1?t(s,o-1,i,u,a):n(a,s):u||(a[a.length]=s)}return a},Gu}function kl(){if(na)return Ju;na=1;var n=Qu?Ku:(Qu=1,Ku=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 Ju=function(t,r,o){return r=e(void 0===r?t.length-1:r,0),function(){for(var i=arguments,u=-1,a=e(i.length-r,0),c=Array(a);++u<a;)c[u]=i[r+u];u=-1;for(var l=Array(r+1);++u<r;)l[u]=i[u];return l[r]=o(c),n(t,this,l)}},Ju}function Cl(){if(ua)return ia;ua=1;var n=function(){if(ta)return ea;ta=1;var n=Yc(),e=it(),t=Fc();return ea=e?function(t,r){return e(t,"toString",{configurable:!0,enumerable:!1,value:n(r),writable:!0})}:t}(),e=function(){if(oa)return ra;oa=1;var n=Date.now;return ra=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)}},ra}(),t=e(n);return ia=t}function Ml(){if(ca)return aa;ca=1;var n=Fc(),e=kl(),t=Cl();return aa=function(r,o){return t(e(r,o,n),r+"")},aa}function Nl(){return sa||(sa=1,la=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}),la}function Ol(){if(Ca)return ka;Ca=1;var n=qc(),e=function(){if(ma)return ya;ma=1;var n=function(){if(ga)return pa;ga=1;var n=Nl(),e=da?fa:(da=1,fa=function(n){return n!=n}),t=(va||(va=1,ha=function(n,e,t){for(var r=t-1,o=n.length;++r<o;)if(n[r]===e)return r;return-1}),ha);return pa=function(r,o,i){return o==o?t(r,o,i):n(r,e,i)},pa}();return ya=function(e,t){return!(null==e||!e.length)&&n(e,t,0)>-1},ya}(),t=(wa||(wa=1,xa=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}),xa),r=Kc(),o=function(){if(Sa)return Ea;Sa=1;var n=Ac(),e=_a?ba:(_a=1,ba=function(){}),t=Jc(),r=n&&1/t(new n([,-0]))[1]==1/0?function(e){return new n(e)}:e;return Ea=r}(),i=Jc();return ka=function(u,a,c){var l=-1,s=e,f=u.length,d=!0,h=[],v=h;if(c)d=!1,s=t;else if(f>=200){var p=a?null:o(u);if(p)return i(p);d=!1,s=r,v=new n}else v=a?[]:h;n:for(;++l<f;){var g=u[l],y=a?a(g):g;if(g=c||0!==g?g:0,d&&y==y){for(var m=v.length;m--;)if(v[m]===y)continue n;a&&v.push(y),h.push(g)}else s(v,y,c)||(v!==h&&v.push(y),h.push(g))}return h},ka}function Pl(){if(Na)return Ma;Na=1;var n=cr(),e=lt();return Ma=function(t){return e(t)&&n(t)}}function jl(){if(Pa)return Oa;Pa=1;var n=Sl(),e=Ml(),t=Ol(),r=Pl(),o=e((function(e){return t(n(e,1,r,!0))}));return Oa=o}function Il(){if(za)return Aa;za=1;var n=function(){if(Ia)return ja;Ia=1;var n=ul();return ja=function(e,t){return n(t,(function(n){return e[n]}))}}(),e=lr();return Aa=function(t){return null==t?[]:n(t,e(t))}}function Al(){if(Ta)return La;var n;Ta=1;try{n={clone:Hc(),constant:Yc(),each:Gc(),filter:pl(),has:gl(),isArray:ft(),isEmpty:yl(),isFunction:qe(),isUndefined:ml(),keys:lr(),map:wl(),reduce:bl(),size:_l(),transform:El(),union:jl(),values:Il()}}catch(n){}return n||(n=window._),La=n}function zl(){if(Ra)return Ba;Ra=1;var n=Al();Ba=t;var e="\0";function t(t){this._isDirected=!n.has(t,"directed")||t.directed,this._isMultigraph=!!n.has(t,"multigraph")&&t.multigraph,this._isCompound=!!n.has(t,"compound")&&t.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[e]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function r(n,e){n[e]?n[e]++:n[e]=1}function o(n,e){--n[e]||delete n[e]}function i(e,t,r,o){var i=""+t,u=""+r;if(!e&&i>u){var a=i;i=u,u=a}return i+""+u+""+(n.isUndefined(o)?"\0":o)}function u(n,e){return i(n,e.v,e.w,e.name)}return t.prototype._nodeCount=0,t.prototype._edgeCount=0,t.prototype.isDirected=function(){return this._isDirected},t.prototype.isMultigraph=function(){return this._isMultigraph},t.prototype.isCompound=function(){return this._isCompound},t.prototype.setGraph=function(n){return this._label=n,this},t.prototype.graph=function(){return this._label},t.prototype.setDefaultNodeLabel=function(e){return n.isFunction(e)||(e=n.constant(e)),this._defaultNodeLabelFn=e,this},t.prototype.nodeCount=function(){return this._nodeCount},t.prototype.nodes=function(){return n.keys(this._nodes)},t.prototype.sources=function(){var e=this;return n.filter(this.nodes(),(function(t){return n.isEmpty(e._in[t])}))},t.prototype.sinks=function(){var e=this;return n.filter(this.nodes(),(function(t){return n.isEmpty(e._out[t])}))},t.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},t.prototype.setNode=function(t,r){return n.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=e,this._children[t]={},this._children[e][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},t.prototype.node=function(n){return this._nodes[n]},t.prototype.hasNode=function(e){return n.has(this._nodes,e)},t.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},t.prototype.setParent=function(t,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(r))r=e;else{for(var o=r+="";!n.isUndefined(o);o=this.parent(o))if(o===t)throw new Error("Setting "+r+" as parent of "+t+" would create a cycle");this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this},t.prototype._removeFromParentsChildList=function(n){delete this._children[this._parent[n]][n]},t.prototype.parent=function(n){if(this._isCompound){var t=this._parent[n];if(t!==e)return t}},t.prototype.children=function(t){if(n.isUndefined(t)&&(t=e),this._isCompound){var r=this._children[t];if(r)return n.keys(r)}else{if(t===e)return this.nodes();if(this.hasNode(t))return[]}},t.prototype.predecessors=function(e){var t=this._preds[e];if(t)return n.keys(t)},t.prototype.successors=function(e){var t=this._sucs[e];if(t)return n.keys(t)},t.prototype.neighbors=function(e){var t=this.predecessors(e);if(t)return n.union(t,this.successors(e))},t.prototype.isLeaf=function(n){return 0===(this.isDirected()?this.successors(n):this.neighbors(n)).length},t.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},t.prototype.setDefaultEdgeLabel=function(e){return n.isFunction(e)||(e=n.constant(e)),this._defaultEdgeLabelFn=e,this},t.prototype.edgeCount=function(){return this._edgeCount},t.prototype.edges=function(){return n.values(this._edgeObjs)},t.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},t.prototype.setEdge=function(){var e,t,o,u,a=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(e=c.v,t=c.w,o=c.name,2===arguments.length&&(u=arguments[1],a=!0)):(e=c,t=arguments[1],o=arguments[3],arguments.length>2&&(u=arguments[2],a=!0)),e=""+e,t=""+t,n.isUndefined(o)||(o=""+o);var l=i(this._isDirected,e,t,o);if(n.has(this._edgeLabels,l))return a&&(this._edgeLabels[l]=u),this;if(!n.isUndefined(o)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[l]=a?u:this._defaultEdgeLabelFn(e,t,o);var s=function(n,e,t,r){var o=""+e,i=""+t;if(!n&&o>i){var u=o;o=i,i=u}var a={v:o,w:i};return r&&(a.name=r),a}(this._isDirected,e,t,o);return e=s.v,t=s.w,Object.freeze(s),this._edgeObjs[l]=s,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][l]=s,this._out[e][l]=s,this._edgeCount++,this},t.prototype.edge=function(n,e,t){var r=1===arguments.length?u(this._isDirected,arguments[0]):i(this._isDirected,n,e,t);return this._edgeLabels[r]},t.prototype.hasEdge=function(e,t,r){var o=1===arguments.length?u(this._isDirected,arguments[0]):i(this._isDirected,e,t,r);return n.has(this._edgeLabels,o)},t.prototype.removeEdge=function(n,e,t){var r=1===arguments.length?u(this._isDirected,arguments[0]):i(this._isDirected,n,e,t),a=this._edgeObjs[r];return a&&(n=a.v,e=a.w,delete this._edgeLabels[r],delete this._edgeObjs[r],o(this._preds[e],n),o(this._sucs[n],e),delete this._in[e][r],delete this._out[n][r],this._edgeCount--),this},t.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}},t.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}},t.prototype.nodeEdges=function(n,e){var t=this.inEdges(n,e);if(t)return t.concat(this.outEdges(n,e))},Ba}function Ll(){if(Xa)return Za;Xa=1;var n=Al(),e=zl();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 Za={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 Tl(){if(Fa)return Ua;Fa=1;var n=Al();return Ua=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},Ua}function Bl(){if($a)return Wa;$a=1;var n=Al();function e(){this._arr=[],this._keyIndices={}}return Wa=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},Wa}function Rl(){if(qa)return Ga;qa=1;var n=Al(),e=Bl();Ga=function(n,r,o,i){return function(n,t,r,o){var i,u,a={},c=new e,l=function(n){var e=n.v!==i?n.v:n.w,t=a[e],o=r(n),l=u.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;a[n]={distance:e},c.add(n,e)}));c.size()>0&&(i=c.removeMin(),(u=a[i]).distance!==Number.POSITIVE_INFINITY);)o(i).forEach(l);return a}(n,String(r),o||t,i||function(e){return n.outEdges(e)})};var t=n.constant(1);return Ga}function Dl(){if(Qa)return Ka;Qa=1;var n=Rl(),e=Al();return Ka=function(t,r,o){return e.transform(t.nodes(),(function(e,i){e[i]=n(t,i,r,o)}),{})}}function Vl(){if(nc)return Ja;nc=1;var n=Al();return Ja=function(e){var t=0,r=[],o={},i=[];function u(a){var c=o[a]={onStack:!0,lowlink:t,index:t++};if(r.push(a),e.successors(a).forEach((function(e){n.has(o,e)?o[e].onStack&&(c.lowlink=Math.min(c.lowlink,o[e].index)):(u(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(a!==l);i.push(s)}}return e.nodes().forEach((function(e){n.has(o,e)||u(e)})),i},Ja}function Hl(){if(tc)return ec;tc=1;var n=Al(),e=Vl();return ec=function(t){return n.filter(e(t),(function(n){return n.length>1||1===n.length&&t.hasEdge(n[0],n[0])}))}}function Yl(){if(oc)return rc;oc=1;var n=Al();rc=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],u=i[t],a=r.distance+o.distance;a<u.distance&&(u.distance=a,u.predecessor=o.predecessor)}))}))})),r}(n,t||e,r||function(e){return n.outEdges(e)})};var e=n.constant(1);return rc}function Zl(){if(uc)return ic;uc=1;var n=Al();function e(e){var r={},o={},i=[];if(n.each(e.sinks(),(function u(a){if(n.has(o,a))throw new t;n.has(r,a)||(o[a]=!0,r[a]=!0,n.each(e.predecessors(a),u),delete o[a],i.push(a))})),n.size(r)!==e.nodeCount())throw new t;return i}function t(){}return ic=e,e.CycleException=t,t.prototype=new Error,ic}function Xl(){if(cc)return ac;cc=1;var n=Zl();return ac=function(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}}function Ul(){if(sc)return lc;sc=1;var n=Al();function e(t,r,o,i,u,a){n.has(i,r)||(i[r]=!0,o||a.push(r),n.each(u(r),(function(n){e(t,n,o,i,u,a)})),o&&a.push(r))}return lc=function(t,r,o){n.isArray(r)||(r=[r]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),u=[],a={};return n.each(r,(function(n){if(!t.hasNode(n))throw new Error("Graph does not have node: "+n);e(t,n,"post"===o,a,i,u)})),u},lc}function Fl(){if(dc)return fc;dc=1;var n=Ul();return fc=function(e,t){return n(e,t,"post")}}function Wl(){if(vc)return hc;vc=1;var n=Ul();return hc=function(e,t){return n(e,t,"pre")}}function $l(){if(gc)return pc;gc=1;var n=Al(),e=zl(),t=Bl();return pc=function(r,o){var i,u=new e,a={},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&&(a[e]=i,c.decrease(e,r))}}if(0===r.nodeCount())return u;n.each(r.nodes(),(function(n){c.add(n,Number.POSITIVE_INFINITY),u.setNode(n)})),c.decrease(r.nodes()[0],0);for(var s=!1;c.size()>0;){if(i=c.removeMin(),n.has(a,i))u.setEdge(i,a[i]);else{if(s)throw new Error("Input graph is not connected: "+r);s=!0}r.nodeEdges(i).forEach(l)}return u},pc}try{bc=function(){if(wc)return xc;wc=1;var n=Ya?Ha:(Ya=1,Ha={Graph:zl(),version:Va?Da:(Va=1,Da="2.1.8")});return xc={Graph:n.Graph,json:Ll(),alg:mc?yc:(mc=1,yc={components:Tl(),dijkstra:Rl(),dijkstraAll:Dl(),findCycles:Hl(),floydWarshall:Yl(),isAcyclic:Xl(),postorder:Fl(),preorder:Wl(),prim:$l(),tarjan:Vl(),topsort:Zl()}),version:n.version}}()}catch(L){}bc||(bc=window.graphlib);var Gl,ql,Kl,Ql,Jl,ns,es,ts,rs,os,is,us,as,cs,ls,ss,fs,ds,hs,vs,ps,gs,ys,ms,xs,ws,bs,_s,Es,Ss,ks,Cs,Ms,Ns,Os,Ps,js,Is,As,zs,Ls,Ts,Bs,Rs,Ds,Vs,Hs,Ys,Zs,Xs,Us,Fs,Ws,$s,Gs,qs,Ks,Qs,Js,nf,ef,tf,rf,of,uf,af,cf,lf,sf,ff,df,hf,vf,pf,gf,yf,mf,xf,wf,bf,_f,Ef,Sf,kf,Cf,Mf,Nf,Of,Pf,jf,If,Af,zf,Lf=bc;function Tf(){if(Ql)return Kl;Ql=1;var n=Ye(),e=cr(),t=kt(),r=Ge();return Kl=function(o,i,u){if(!r(u))return!1;var a=typeof i;return!!("number"==a?e(u)&&t(i,u.length):"string"==a&&i in u)&&n(u[i],o)}}function Bf(){if(ss)return ls;ss=1;var n=function(){if(cs)return as;cs=1;var n=function(){if(us)return is;us=1;var n=function(){if(os)return rs;os=1;var n=/\s/;return rs=function(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}}(),e=/^\s+/;return is=function(t){return t?t.slice(0,n(t)+1).replace(e,""):t}}(),e=Ge(),t=ol(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,u=parseInt;return as=function(a){if("number"==typeof a)return a;if(t(a))return NaN;if(e(a)){var c="function"==typeof a.valueOf?a.valueOf():a;a=e(c)?c+"":c}if("string"!=typeof a)return 0===a?a:+a;a=n(a);var l=o.test(a);return l||i.test(a)?u(a.slice(2),l?2:8):r.test(a)?NaN:+a}}(),e=1/0;return ls=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 Rf(){if(ms)return ys;ms=1;var n=Sl();return ys=function(e){return null!=e&&e.length?n(e,1):[]}}function Df(){if(Cs)return ks;Cs=1;var n=ol();return ks=function(e,t,r){for(var o=-1,i=e.length;++o<i;){var u=e[o],a=t(u);if(null!=a&&(void 0===c?a==a&&!n(a):r(a,c)))var c=a,l=u}return l},ks}function Vf(){if(Is)return js;Is=1;var n=ut(),e=Ye();return js=function(t,r,o){(void 0!==o&&!e(t[r],o)||void 0===o&&!(r in t))&&n(t,r,o)}}function Hf(){return Ts?Ls:(Ts=1,Ls=function(n,e){if(("constructor"!==e||"function"!=typeof n[e])&&"__proto__"!=e)return n[e]})}function Yf(){return $s?Ws:($s=1,Ws=function(n,e){return n<e})}function Zf(){if(kf)return Sf;kf=1;var n=ul(),e=sl(),t=vl(),r=xl(),o=(xf||(xf=1,mf=function(n,e){var t=n.length;for(n.sort(e);t--;)n[t]=n[t].value;return n}),mf),i=Mt(),u=function(){if(Ef)return _f;Ef=1;var n=function(){if(bf)return wf;bf=1;var n=ol();return wf=function(e,t){if(e!==t){var r=void 0!==e,o=null===e,i=e==e,u=n(e),a=void 0!==t,c=null===t,l=t==t,s=n(t);if(!c&&!s&&!u&&e>t||u&&a&&l&&!c&&!s||o&&a&&l||!r&&l||!i)return 1;if(!o&&!u&&!s&&e<t||s&&r&&i&&!o&&!u||c&&r&&i||!a&&i||!l)return-1}return 0}}();return _f=function(e,t,r){for(var o=-1,i=e.criteria,u=t.criteria,a=i.length,c=r.length;++o<a;){var l=n(i[o],u[o]);if(l)return o>=c?l:l*("desc"==r[o]?-1:1)}return e.index-t.index}}(),a=Fc(),c=ft();return Sf=function(l,s,f){s=s.length?n(s,(function(n){return c(n)?function(t){return e(t,1===n.length?n[0]:n)}:n})):[a];var d=-1;s=n(s,i(t));var h=r(l,(function(e,t,r){return{criteria:n(s,(function(n){return n(e)})),index:++d,value:e}}));return o(h,(function(n,e){return u(n,e,f)}))}}try{zf={cloneDeep:function(){if(ql)return Gl;ql=1;var n=Vc();return Gl=function(e){return n(e,5)}}(),constant:Yc(),defaults:function(){if(ns)return Jl;ns=1;var n=Ml(),e=Ye(),t=Tf(),r=sr(),o=Object.prototype,i=o.hasOwnProperty,u=n((function(n,u){n=Object(n);var a=-1,c=u.length,l=c>2?u[2]:void 0;for(l&&t(u[0],u[1],l)&&(c=1);++a<c;)for(var s=u[a],f=r(s),d=-1,h=f.length;++d<h;){var v=f[d],p=n[v];(void 0===p||e(p,o[v])&&!i.call(n,v))&&(n[v]=s[v])}return n}));return Jl=u}(),each:Gc(),filter:pl(),find:function(){if(gs)return ps;gs=1;var n=function(){if(ts)return es;ts=1;var n=vl(),e=cr(),t=lr();return es=function(r){return function(o,i,u){var a=Object(o);if(!e(o)){var c=n(i,3);o=t(o),i=function(n){return c(a[n],n,a)}}var l=r(o,i,u);return l>-1?a[c?o[l]:l]:void 0}}}()(function(){if(vs)return hs;vs=1;var n=Nl(),e=vl(),t=function(){if(ds)return fs;ds=1;var n=Bf();return fs=function(e){var t=n(e),r=t%1;return t==t?r?t-r:t:0}}(),r=Math.max;return hs=function(o,i,u){var a=null==o?0:o.length;if(!a)return-1;var c=null==u?0:t(u);return c<0&&(c=r(a+c,0)),n(o,e(i,3),c)},hs}());return ps=n}(),flatten:Rf(),forEach:$c(),forIn:function(){if(ws)return xs;ws=1;var n=Zc(),e=Wc(),t=sr();return xs=function(r,o){return null==r?r:n(r,e(o),t)}}(),has:gl(),isUndefined:ml(),last:(_s||(_s=1,bs=function(n){var e=null==n?0:n.length;return e?n[e-1]:void 0}),bs),map:wl(),mapValues:function(){if(Ss)return Es;Ss=1;var n=ut(),e=Xc(),t=vl();return Es=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(Ps)return Os;Ps=1;var n=Df(),e=Ns?Ms:(Ns=1,Ms=function(n,e){return n>e}),t=Fc();return Os=function(r){return r&&r.length?n(r,t,e):void 0},Os}(),merge:function(){if(Fs)return Us;Fs=1;var n=function(){if(Ys)return Hs;Ys=1;var n=rt(),e=Vf(),t=Zc(),r=function(){if(Vs)return Ds;Vs=1;var n=Vf(),e=Ec(),t=Bc(),r=Sc(),o=Dc(),i=st(),u=ft(),a=Pl(),c=St(),l=qe(),s=Ge(),f=function(){if(zs)return As;zs=1;var n=$e(),e=Oc(),t=lt(),r=Function.prototype,o=Object.prototype,i=r.toString,u=o.hasOwnProperty,a=i.call(Object);return As=function(r){if(!t(r)||"[object Object]"!=n(r))return!1;var o=e(r);if(null===o)return!0;var c=u.call(o,"constructor")&&o.constructor;return"function"==typeof c&&c instanceof c&&i.call(c)==a}}(),d=rr(),h=Hf(),v=function(){if(Rs)return Bs;Rs=1;var n=ct(),e=sr();return Bs=function(t){return n(t,e(t))}}();return Ds=function(p,g,y,m,x,w,b){var _=h(p,y),E=h(g,y),S=b.get(E);if(S)n(p,y,S);else{var k=w?w(_,E,y+"",p,g,b):void 0,C=void 0===k;if(C){var M=u(E),N=!M&&c(E),O=!M&&!N&&d(E);k=E,M||N||O?u(_)?k=_:a(_)?k=r(_):N?(C=!1,k=e(E,!0)):O?(C=!1,k=t(E,!0)):k=[]:f(E)||i(E)?(k=_,i(_)?k=v(_):s(_)&&!l(_)||(k=o(E))):C=!1}C&&(b.set(E,k),x(k,E,m,w,b),b.delete(E)),n(p,y,k)}}}(),o=Ge(),i=sr(),u=Hf();return Hs=function a(c,l,s,f,d){c!==l&&t(l,(function(t,i){if(d||(d=new n),o(t))r(c,l,i,s,a,f,d);else{var h=f?f(u(c,i),t,i+"",c,l,d):void 0;void 0===h&&(h=t),e(c,i,h)}}),i)},Hs}(),e=function(){if(Xs)return Zs;Xs=1;var n=Ml(),e=Tf();return Zs=function(t){return n((function(n,r){var o=-1,i=r.length,u=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(u=t.length>3&&"function"==typeof u?(i--,u):void 0,a&&e(r[0],r[1],a)&&(u=i<3?void 0:u,i=1),n=Object(n);++o<i;){var c=r[o];c&&t(n,c,o,u)}return n}))}}()((function(e,t,r){n(e,t,r)}));return Us=e}(),min:function(){if(qs)return Gs;qs=1;var n=Df(),e=Yf(),t=Fc();return Gs=function(r){return r&&r.length?n(r,t,e):void 0},Gs}(),minBy:function(){if(Qs)return Ks;Qs=1;var n=Df(),e=vl(),t=Yf();return Ks=function(r,o){return r&&r.length?n(r,e(o,2),t):void 0},Ks}(),now:function(){if(nf)return Js;nf=1;var n=Fe();return Js=function(){return n.Date.now()}}(),pick:function(){if(ff)return sf;ff=1;var n=function(){if(af)return uf;af=1;var n=function(){if(of)return rf;of=1;var n=sl(),e=function(){if(tf)return ef;tf=1;var n=at(),e=cl(),t=kt(),r=Ge(),o=ll();return ef=function(i,u,a,c){if(!r(i))return i;for(var l=-1,s=(u=e(u,i)).length,f=s-1,d=i;null!=d&&++l<s;){var h=o(u[l]),v=a;if("__proto__"===h||"constructor"===h||"prototype"===h)return i;if(l!=f){var p=d[h];void 0===(v=c?c(p,h,d):void 0)&&(v=r(p)?p:t(u[l+1])?[]:{})}n(d,h,v),d=d[h]}return i}}(),t=cl();return rf=function(r,o,i){for(var u=-1,a=o.length,c={};++u<a;){var l=o[u],s=n(r,l);i(s,l)&&e(c,t(l,r),s)}return c}}(),e=dl();return uf=function(t,r){return n(t,r,(function(n,r){return e(t,r)}))}}(),e=function(){if(lf)return cf;lf=1;var n=Rf(),e=kl(),t=Cl();return cf=function(r){return t(e(r,void 0,n),r+"")}}()((function(e,t){return null==e?{}:n(e,t)}));return sf=e}(),range:function(){if(yf)return gf;yf=1;var n=function(){if(pf)return vf;pf=1;var n=function(){if(hf)return df;hf=1;var n=Math.ceil,e=Math.max;return df=function(t,r,o,i){for(var u=-1,a=e(n((r-t)/(o||1)),0),c=Array(a);a--;)c[i?a:++u]=t,t+=o;return c},df}(),e=Tf(),t=Bf();return vf=function(r){return function(o,i,u){return u&&"number"!=typeof u&&e(o,i,u)&&(i=u=void 0),o=t(o),void 0===i?(i=o,o=0):i=t(i),u=void 0===u?o<i?1:-1:t(u),n(o,i,u,r)}},vf}()();return gf=n}(),reduce:bl(),sortBy:function(){if(Mf)return Cf;Mf=1;var n=Sl(),e=Zf(),t=Ml(),r=Tf(),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 Cf=o}(),uniqueId:function(){if(Of)return Nf;Of=1;var n=al(),e=0;return Nf=function(t){var r=++e;return n(t)+r},Nf}(),values:Il(),zipObject:function(){if(Af)return If;Af=1;var n=at(),e=jf?Pf:(jf=1,Pf=function(n,e,t){for(var r=-1,o=n.length,i=e.length,u={};++r<o;){var a=r<i?e[r]:void 0;t(u,n[r],a)}return u});return If=function(t,r){return e(t||[],r||[],n)}}()}}catch(L){}zf||(zf=window._);var Xf=zf,Uf=Ff;function Ff(){var n={};n._next=n._prev=n,this._sentinel=n}function Wf(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function $f(n,e){if("_next"!==n&&"_prev"!==n)return e}Ff.prototype.dequeue=function(){var n=this._sentinel,e=n._prev;if(e!==n)return Wf(e),e},Ff.prototype.enqueue=function(n){var e=this._sentinel;n._prev&&n._next&&Wf(n),n._next=e._next,e._next._prev=n,e._next=n,n._prev=e},Ff.prototype.toString=function(){for(var n=[],e=this._sentinel,t=e._prev;t!==e;)n.push(JSON.stringify(t,$f)),t=t._prev;return"["+n.join(", ")+"]"};var Gf=Xf,qf=Lf.Graph,Kf=Uf,Qf=Gf.constant(1);function Jf(n,e,t,r,o){var i=o?[]:void 0;return Gf.forEach(n.inEdges(r.v),(function(r){var u=n.edge(r),a=n.node(r.v);o&&i.push({v:r.v,w:r.w}),a.out-=u,nd(e,t,a)})),Gf.forEach(n.outEdges(r.v),(function(r){var o=n.edge(r),i=r.w,u=n.node(i);u.in-=o,nd(e,t,u)})),n.removeNode(r.v),i}function nd(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 ed=Xf,td=function(n,e){if(n.nodeCount()<=1)return[];var t=function(n,e){var t=new qf,r=0,o=0;Gf.forEach(n.nodes(),(function(n){t.setNode(n,{v:n,in:0,out:0})})),Gf.forEach(n.edges(),(function(n){var i=t.edge(n.v,n.w)||0,u=e(n),a=i+u;t.setEdge(n.v,n.w,a),o=Math.max(o,t.node(n.v).out+=u),r=Math.max(r,t.node(n.w).in+=u)}));var i=Gf.range(o+r+3).map((function(){return new Kf})),u=r+1;return Gf.forEach(t.nodes(),(function(n){nd(i,u,t.node(n))})),{graph:t,buckets:i,zeroIdx:u}}(n,e||Qf),r=function(n,e,t){for(var r,o=[],i=e[e.length-1],u=e[0];n.nodeCount();){for(;r=u.dequeue();)Jf(n,e,t,r);for(;r=i.dequeue();)Jf(n,e,t,r);if(n.nodeCount())for(var a=e.length-2;a>0;--a)if(r=e[a].dequeue()){o=o.concat(Jf(n,e,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return Gf.flatten(Gf.map(r,(function(e){return n.outEdges(e.v,e.w)})),!0)},rd={run:function(n){var e="greedy"===n.graph().acyclicer?td(n,function(n){return function(e){return n.edge(e).weight}}(n)):function(n){var e=[],t={},r={};return ed.forEach(n.nodes(),(function o(i){ed.has(r,i)||(r[i]=!0,t[i]=!0,ed.forEach(n.outEdges(i),(function(n){ed.has(t,n.w)?e.push(n):o(n.w)})),delete t[i])})),e}(n);ed.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,ed.uniqueId("rev"))}))},undo:function(n){ed.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)}}))}},od=Xf,id=Lf.Graph,ud={addDummyNode:ad,simplify:function(n){var e=(new id).setGraph(n.graph());return od.forEach(n.nodes(),(function(t){e.setNode(t,n.node(t))})),od.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 id({multigraph:n.isMultigraph()}).setGraph(n.graph());return od.forEach(n.nodes(),(function(t){n.children(t).length||e.setNode(t,n.node(t))})),od.forEach(n.edges(),(function(t){e.setEdge(t,n.edge(t))})),e},successorWeights:function(n){var e=od.map(n.nodes(),(function(e){var t={};return od.forEach(n.outEdges(e),(function(e){t[e.w]=(t[e.w]||0)+n.edge(e).weight})),t}));return od.zipObject(n.nodes(),e)},predecessorWeights:function(n){var e=od.map(n.nodes(),(function(e){var t={};return od.forEach(n.inEdges(e),(function(e){t[e.v]=(t[e.v]||0)+n.edge(e).weight})),t}));return od.zipObject(n.nodes(),e)},intersectRect:function(n,e){var t,r,o=n.x,i=n.y,u=e.x-o,a=e.y-i,c=n.width/2,l=n.height/2;if(!u&&!a)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(a)*c>Math.abs(u)*l?(a<0&&(l=-l),t=l*u/a,r=l):(u<0&&(c=-c),t=c,r=c*a/u),{x:o+t,y:i+r}},buildLayerMatrix:function(n){var e=od.map(od.range(cd(n)+1),(function(){return[]}));return od.forEach(n.nodes(),(function(t){var r=n.node(t),o=r.rank;od.isUndefined(o)||(e[o][r.order]=t)})),e},normalizeRanks:function(n){var e=od.min(od.map(n.nodes(),(function(e){return n.node(e).rank})));od.forEach(n.nodes(),(function(t){var r=n.node(t);od.has(r,"rank")&&(r.rank-=e)}))},removeEmptyRanks:function(n){var e=od.min(od.map(n.nodes(),(function(e){return n.node(e).rank}))),t=[];od.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;od.forEach(t,(function(e,t){od.isUndefined(e)&&t%o!=0?--r:r&&od.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),ad(n,"border",o,e)},maxRank:cd,partition:function(n,e){var t={lhs:[],rhs:[]};return od.forEach(n,(function(n){e(n)?t.lhs.push(n):t.rhs.push(n)})),t},time:function(n,e){var t=od.now();try{return e()}finally{console.log(n+" time: "+(od.now()-t)+"ms")}},notime:function(n,e){return e()}};function ad(n,e,t,r){var o;do{o=od.uniqueId(r)}while(n.hasNode(o));return t.dummy=e,n.setNode(o,t),o}function cd(n){return od.max(od.map(n.nodes(),(function(e){var t=n.node(e).rank;if(!od.isUndefined(t))return t})))}var ld=Xf,sd=ud,fd={run:function(n){n.graph().dummyChains=[],ld.forEach(n.edges(),(function(e){!function(n,e){var t,r,o,i=e.v,u=n.node(i).rank,a=e.w,c=n.node(a).rank,l=e.name,s=n.edge(e),f=s.labelRank;if(c!==u+1){for(n.removeEdge(e),o=0,++u;u<c;++o,++u)s.points=[],r={width:0,height:0,edgeLabel:s,edgeObj:e,rank:u},t=sd.addDummyNode(n,"edge",r,"_d"),u===f&&(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,a,{weight:s.weight},l)}}(n,e)}))},undo:function(n){ld.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)}))}},dd=Xf,hd=function(n){var e={};dd.forEach(n.sources(),(function t(r){var o=n.node(r);if(dd.has(e,r))return o.rank;e[r]=!0;var i=dd.min(dd.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}))},vd=function(n,e){return n.node(e.w).rank-n.node(e.v).rank-n.edge(e).minlen},pd=Xf,gd=Lf.Graph,yd=vd,md=function(n){var e,t,r=new gd({directed:!1}),o=n.nodes()[0],i=n.nodeCount();for(r.setNode(o,{});xd(r,n)<i;)e=wd(r,n),t=r.hasNode(e.v)?yd(n,e):-yd(n,e),bd(r,n,t);return r};function xd(n,e){return pd.forEach(n.nodes(),(function t(r){pd.forEach(e.nodeEdges(r),(function(o){var i=o.v,u=r===i?o.w:i;n.hasNode(u)||yd(e,o)||(n.setNode(u,{}),n.setEdge(r,u,{}),t(u))}))})),n.nodeCount()}function wd(n,e){return pd.minBy(e.edges(),(function(t){if(n.hasNode(t.v)!==n.hasNode(t.w))return yd(e,t)}))}function bd(n,e,t){pd.forEach(n.nodes(),(function(n){e.node(n).rank+=t}))}var _d=Xf,Ed=md,Sd=vd,kd=hd,Cd=Lf.alg.preorder,Md=Lf.alg.postorder,Nd=ud.simplify,Od=Pd;function Pd(n){n=Nd(n),kd(n);var e,t=Ed(n);for(Ad(t),jd(t,n);e=Ld(t);)Bd(t,n,e,Td(t,n,e))}function jd(n,e){var t=Md(n,n.nodes());t=t.slice(0,t.length-1),_d.forEach(t,(function(t){!function(n,e,t){var r=n.node(t).parent;n.edge(t,r).cutvalue=Id(n,e,t)}(n,e,t)}))}function Id(n,e,t){var r=n.node(t).parent,o=!0,i=e.edge(t,r),u=0;return i||(o=!1,i=e.edge(r,t)),u=i.weight,_d.forEach(e.nodeEdges(t),(function(i){var a,c,l=i.v===t,s=l?i.w:i.v;if(s!==r){var f=l===o,d=e.edge(i).weight;if(u+=f?d:-d,a=t,c=s,n.hasEdge(a,c)){var h=n.edge(t,s).cutvalue;u+=f?-h:h}}})),u}function Ad(n,e){arguments.length<2&&(e=n.nodes()[0]),zd(n,{},1,e)}function zd(n,e,t,r,o){var i=t,u=n.node(r);return e[r]=!0,_d.forEach(n.neighbors(r),(function(o){_d.has(e,o)||(t=zd(n,e,t,o,r))})),u.low=i,u.lim=t++,o?u.parent=o:delete u.parent,t}function Ld(n){return _d.find(n.edges(),(function(e){return n.edge(e).cutvalue<0}))}function Td(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),u=n.node(o),a=i,c=!1;i.lim>u.lim&&(a=u,c=!0);var l=_d.filter(e.edges(),(function(e){return c===Rd(n,n.node(e.v),a)&&c!==Rd(n,n.node(e.w),a)}));return _d.minBy(l,(function(n){return Sd(e,n)}))}function Bd(n,e,t,r){var o=t.v,i=t.w;n.removeEdge(o,i),n.setEdge(r.v,r.w,{}),Ad(n),jd(n,e),function(n,e){var t=_d.find(n.nodes(),(function(n){return!e.node(n).parent})),r=Cd(n,t);r=r.slice(1),_d.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 Rd(n,e,t){return t.low<=e.lim&&e.lim<=t.lim}Pd.initLowLimValues=Ad,Pd.initCutValues=jd,Pd.calcCutValue=Id,Pd.leaveEdge=Ld,Pd.enterEdge=Td,Pd.exchangeEdges=Bd;var Dd=hd,Vd=md,Hd=Od,Yd=Dd;var Zd=Xf,Xd=Xf,Ud=ud,Fd={run:function(n){var e=Ud.addDummyNode(n,"root",{},"_root"),t=function(n){var e={};function t(r,o){var i=n.children(r);i&&i.length&&Xd.forEach(i,(function(n){t(n,o+1)})),e[r]=o}return Xd.forEach(n.children(),(function(n){t(n,1)})),e}(n),r=Xd.max(Xd.values(t))-1,o=2*r+1;n.graph().nestingRoot=e,Xd.forEach(n.edges(),(function(e){n.edge(e).minlen*=o}));var i=function(n){return Xd.reduce(n.edges(),(function(e,t){return e+n.edge(t).weight}),0)}(n)+1;Xd.forEach(n.children(),(function(u){Wd(n,e,o,i,r,t,u)})),n.graph().nodeRankFactor=o},cleanup:function(n){var e=n.graph();n.removeNode(e.nestingRoot),delete e.nestingRoot,Xd.forEach(n.edges(),(function(e){n.edge(e).nestingEdge&&n.removeEdge(e)}))}};function Wd(n,e,t,r,o,i,u){var a=n.children(u);if(a.length){var c=Ud.addBorderNode(n,"_bt"),l=Ud.addBorderNode(n,"_bb"),s=n.node(u);n.setParent(c,u),s.borderTop=c,n.setParent(l,u),s.borderBottom=l,Xd.forEach(a,(function(a){Wd(n,e,t,r,o,i,a);var s=n.node(a),f=s.borderTop?s.borderTop:a,d=s.borderBottom?s.borderBottom:a,h=s.borderTop?r:2*r,v=f!==d?1:o-i[u]+1;n.setEdge(c,f,{weight:h,minlen:v,nestingEdge:!0}),n.setEdge(d,l,{weight:h,minlen:v,nestingEdge:!0})})),n.parent(u)||n.setEdge(e,c,{weight:0,minlen:o+i[u]})}else u!==e&&n.setEdge(e,u,{weight:0,minlen:t})}var $d=Xf,Gd=ud;function qd(n,e,t,r,o,i){var u={width:0,height:0,rank:i,borderType:e},a=o[e][i-1],c=Gd.addDummyNode(n,"border",u,t);o[e][i]=c,n.setParent(c,r),a&&n.setEdge(a,c,{weight:1})}var Kd=Xf,Qd={adjust:function(n){var e=n.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||Jd(n)},undo:function(n){var e=n.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(n){Kd.forEach(n.nodes(),(function(e){eh(n.node(e))})),Kd.forEach(n.edges(),(function(e){var t=n.edge(e);Kd.forEach(t.points,eh),Kd.has(t,"y")&&eh(t)}))}(n),"lr"!==e&&"rl"!==e||(function(n){Kd.forEach(n.nodes(),(function(e){th(n.node(e))})),Kd.forEach(n.edges(),(function(e){var t=n.edge(e);Kd.forEach(t.points,th),Kd.has(t,"x")&&th(t)}))}(n),Jd(n))}};function Jd(n){Kd.forEach(n.nodes(),(function(e){nh(n.node(e))})),Kd.forEach(n.edges(),(function(e){nh(n.edge(e))}))}function nh(n){var e=n.width;n.width=n.height,n.height=e}function eh(n){n.y=-n.y}function th(n){var e=n.x;n.x=n.y,n.y=e}var rh=Xf,oh=Xf;function ih(n,e,t){for(var r=oh.zipObject(t,oh.map(t,(function(n,e){return e}))),o=oh.flatten(oh.map(e,(function(e){return oh.sortBy(oh.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 u=2*i-1;i-=1;var a=oh.map(new Array(u),(function(){return 0})),c=0;return oh.forEach(o.forEach((function(n){var e=n.pos+i;a[e]+=n.weight;for(var t=0;e>0;)e%2&&(t+=a[e+1]),a[e=e-1>>1]+=n.weight;c+=n.weight*t}))),c}var uh=Xf,ah=Xf,ch=Xf,lh=ud;function sh(n,e,t){for(var r;e.length&&(r=ch.last(e)).i<=t;)e.pop(),n.push(r.vs),t++;return t}var fh=Xf,dh=Xf,hh=Lf.Graph,vh=Xf,ph=Xf,gh=function(n){var e={},t=rh.filter(n.nodes(),(function(e){return!n.children(e).length})),r=rh.max(rh.map(t,(function(e){return n.node(e).rank}))),o=rh.map(rh.range(r+1),(function(){return[]}));var i=rh.sortBy(t,(function(e){return n.node(e).rank}));return rh.forEach(i,(function t(r){if(!rh.has(e,r)){e[r]=!0;var i=n.node(r);o[i.rank].push(r),rh.forEach(n.successors(r),t)}})),o},yh=function(n,e){for(var t=0,r=1;r<e.length;++r)t+=ih(n,e[r-1],e[r]);return t},mh=function n(e,t,r,o){var i=e.children(t),u=e.node(t),a=u?u.borderLeft:void 0,c=u?u.borderRight:void 0,l={};a&&(i=fh.filter(i,(function(n){return n!==a&&n!==c})));var s=function(n,e){return uh.map(e,(function(e){var t=n.inEdges(e);if(t.length){var r=uh.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);fh.forEach(s,(function(t){if(e.children(t.v).length){var i=n(e,t.v,r,o);l[t.v]=i,fh.has(i,"barycenter")&&(u=t,a=i,fh.isUndefined(u.barycenter)?(u.barycenter=a.barycenter,u.weight=a.weight):(u.barycenter=(u.barycenter*u.weight+a.barycenter*a.weight)/(u.weight+a.weight),u.weight+=a.weight))}var u,a}));var f=function(n,e){var t={};return ah.forEach(n,(function(n,e){var r=t[n.v]={indegree:0,in:[],out:[],vs:[n.v],i:e};ah.isUndefined(n.barycenter)||(r.barycenter=n.barycenter,r.weight=n.weight)})),ah.forEach(e.edges(),(function(n){var e=t[n.v],r=t[n.w];ah.isUndefined(e)||ah.isUndefined(r)||(r.indegree++,e.out.push(t[n.w]))})),function(n){var e=[];function t(n){return function(e){e.merged||(ah.isUndefined(e.barycenter)||ah.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),ah.forEach(o.in.reverse(),t(o)),ah.forEach(o.out,r(o))}return ah.map(ah.filter(e,(function(n){return!n.merged})),(function(n){return ah.pick(n,["vs","i","barycenter","weight"])}))}(ah.filter(t,(function(n){return!n.indegree})))}(s,r);!function(n,e){fh.forEach(n,(function(n){n.vs=fh.flatten(n.vs.map((function(n){return e[n]?e[n].vs:n})),!0)}))}(f,l);var d=function(n,e){var t,r=lh.partition(n,(function(n){return ch.has(n,"barycenter")})),o=r.lhs,i=ch.sortBy(r.rhs,(function(n){return-n.i})),u=[],a=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=sh(u,i,l),ch.forEach(o,(function(n){l+=n.vs.length,u.push(n.vs),a+=n.barycenter*n.weight,c+=n.weight,l=sh(u,i,l)}));var s={vs:ch.flatten(u,!0)};return c&&(s.barycenter=a/c,s.weight=c),s}(f,o);if(a&&(d.vs=fh.flatten([a,d.vs,c],!0),e.predecessors(a).length)){var h=e.node(e.predecessors(a)[0]),v=e.node(e.predecessors(c)[0]);fh.has(d,"barycenter")||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+h.order+v.order)/(d.weight+2),d.weight+=2}return d},xh=function(n,e,t){var r=function(n){for(var e;n.hasNode(e=dh.uniqueId("_root")););return e}(n),o=new hh({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(e){return n.node(e)}));return dh.forEach(n.nodes(),(function(i){var u=n.node(i),a=n.parent(i);(u.rank===e||u.minRank<=e&&e<=u.maxRank)&&(o.setNode(i),o.setParent(i,a||r),dh.forEach(n[t](i),(function(e){var t=e.v===i?e.w:e.v,r=o.edge(t,i),u=dh.isUndefined(r)?0:r.weight;o.setEdge(t,i,{weight:n.edge(e).weight+u})})),dh.has(u,"minRank")&&o.setNode(i,{borderLeft:u.borderLeft[e],borderRight:u.borderRight[e]}))})),o},wh=Lf.Graph,bh=ud;function _h(n,e,t){return ph.map(e,(function(e){return xh(n,e,t)}))}function Eh(n,e){var t=new wh;ph.forEach(n,(function(n){var r=n.graph().root,o=mh(n,r,t,e);ph.forEach(o.vs,(function(e,t){n.node(e).order=t})),function(n,e,t){var r,o={};vh.forEach(t,(function(t){for(var i,u,a=n.parent(t);a;){if((i=n.parent(a))?(u=o[i],o[i]=a):(u=r,r=a),u&&u!==a)return void e.setEdge(u,a);a=i}}))}(n,t,o.vs)}))}function Sh(n,e){ph.forEach(e,(function(e){ph.forEach(e,(function(e,t){n.node(e).order=t}))}))}var kh=Xf,Ch=Lf.Graph,Mh=ud;function Nh(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 Oh(n,e,t){if(e>t){var r=e;e=t,t=r}return kh.has(n[e],t)}var Ph=Xf,jh=ud,Ih=function(n){var e,t=Mh.buildLayerMatrix(n),r=kh.merge(function(n,e){var t={};return kh.reduce(e,(function(e,r){var o=0,i=0,u=e.length,a=kh.last(r);return kh.forEach(r,(function(e,c){var l=function(n,e){if(n.node(e).dummy)return kh.find(n.predecessors(e),(function(e){return n.node(e).dummy}))}(n,e),s=l?n.node(l).order:u;(l||e===a)&&(kh.forEach(r.slice(i,c+1),(function(e){kh.forEach(n.predecessors(e),(function(r){var i=n.node(r),u=i.order;!(u<o||s<u)||i.dummy&&n.node(e).dummy||Nh(t,r,e)}))})),i=c+1,o=s)})),r})),t}(n,t),function(n,e){var t={};function r(e,r,o,i,u){var a;kh.forEach(kh.range(r,o),(function(r){a=e[r],n.node(a).dummy&&kh.forEach(n.predecessors(a),(function(e){var r=n.node(e);r.dummy&&(r.order<i||r.order>u)&&Nh(t,e,a)}))}))}return kh.reduce(e,(function(e,t){var o,i=-1,u=0;return kh.forEach(t,(function(a,c){if("border"===n.node(a).dummy){var l=n.predecessors(a);l.length&&(o=n.node(l[0]).order,r(t,u,c,i,o),u=c,i=o)}r(t,u,t.length,o,e.length)})),t})),t}(n,t)),o={};kh.forEach(["u","d"],(function(i){e="u"===i?t:kh.values(t).reverse(),kh.forEach(["l","r"],(function(t){"r"===t&&(e=kh.map(e,(function(n){return kh.values(n).reverse()})));var u=("u"===i?n.predecessors:n.successors).bind(n),a=function(n,e,t,r){var o={},i={},u={};return kh.forEach(e,(function(n){kh.forEach(n,(function(n,e){o[n]=n,i[n]=n,u[n]=e}))})),kh.forEach(e,(function(n){var e=-1;kh.forEach(n,(function(n){var a=r(n);if(a.length){a=kh.sortBy(a,(function(n){return u[n]}));for(var c=(a.length-1)/2,l=Math.floor(c),s=Math.ceil(c);l<=s;++l){var f=a[l];i[n]===n&&e<u[f]&&!Oh(t,n,f)&&(i[f]=n,i[n]=o[n]=o[f],e=u[f])}}}))})),{root:o,align:i}}(0,e,r,u),c=function(n,e,t,r,o){var i={},u=function(n,e,t,r){var o=new Ch,i=n.graph(),u=function(n,e,t){return function(r,o,i){var u,a=r.node(o),c=r.node(i),l=0;if(l+=a.width/2,kh.has(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=-a.width/2;break;case"r":u=a.width/2}if(u&&(l+=t?u:-u),u=0,l+=(a.dummy?e:n)/2,l+=(c.dummy?e:n)/2,l+=c.width/2,kh.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":u=c.width/2;break;case"r":u=-c.width/2}return u&&(l+=t?u:-u),u=0,l}}(i.nodesep,i.edgesep,r);return kh.forEach(e,(function(e){var r;kh.forEach(e,(function(e){var i=t[e];if(o.setNode(i),r){var a=t[r],c=o.edge(a,i);o.setEdge(a,i,Math.max(u(n,e,r),c||0))}r=e}))})),o}(n,e,t,o),a=o?"borderLeft":"borderRight";function c(n,e){for(var t=u.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]=u.inEdges(n).reduce((function(n,e){return Math.max(n,i[e.v]+u.edge(e))}),0)}),u.predecessors.bind(u)),c((function(e){var t=u.outEdges(e).reduce((function(n,e){return Math.min(n,i[e.w]-u.edge(e))}),Number.POSITIVE_INFINITY),r=n.node(e);t!==Number.POSITIVE_INFINITY&&r.borderType!==a&&(i[e]=Math.max(i[e],t))}),u.successors.bind(u)),kh.forEach(r,(function(n){i[n]=i[t[n]]})),i}(n,e,a.root,a.align,"r"===t);"r"===t&&(c=kh.mapValues(c,(function(n){return-n}))),o[i+t]=c}))}));var i=function(n,e){return kh.minBy(kh.values(e),(function(e){var t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return kh.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=kh.values(e),r=kh.min(t),o=kh.max(t);kh.forEach(["u","d"],(function(t){kh.forEach(["l","r"],(function(i){var u,a=t+i,c=n[a];if(c!==e){var l=kh.values(c);(u="l"===i?r-kh.min(l):o-kh.max(l))&&(n[a]=kh.mapValues(c,(function(n){return n+u})))}}))}))}(o,i),function(n,e){return kh.mapValues(n.ul,(function(t,r){if(e)return n[e.toLowerCase()][r];var o=kh.sortBy(kh.map(n,r));return(o[1]+o[2])/2}))}(o,n.graph().align)},Ah=Xf,zh=rd,Lh=fd,Th=function(n){switch(n.graph().ranker){case"network-simplex":default:!function(n){Hd(n)}(n);break;case"tight-tree":!function(n){Dd(n),Vd(n)}(n);break;case"longest-path":Yd(n)}},Bh=ud.normalizeRanks,Rh=function(n){var e=function(n){var e={},t=0;return Zd.forEach(n.children(),(function r(o){var i=t;Zd.forEach(n.children(o),r),e[o]={low:i,lim:t++}})),e}(n);Zd.forEach(n.graph().dummyChains,(function(t){for(var r=n.node(t),o=r.edgeObj,i=function(n,e,t,r){var o,i,u=[],a=[],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),u.push(o)}while(o&&(e[o].low>c||l>e[o].lim));for(i=o,o=r;(o=n.parent(o))!==i;)a.push(o);return{path:u.concat(a.reverse()),lca:i}}(n,e,o.v,o.w),u=i.path,a=i.lca,c=0,l=u[c],s=!0;t!==o.w;){if(r=n.node(t),s){for(;(l=u[c])!==a&&n.node(l).maxRank<r.rank;)c++;l===a&&(s=!1)}if(!s){for(;c<u.length-1&&n.node(l=u[c+1]).minRank<=r.rank;)c++;l=u[c]}n.setParent(t,l),t=n.successors(t)[0]}}))},Dh=ud.removeEmptyRanks,Vh=Fd,Hh=function(n){$d.forEach(n.children(),(function e(t){var r=n.children(t),o=n.node(t);if(r.length&&$d.forEach(r,e),$d.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,u=o.maxRank+1;i<u;++i)qd(n,"borderLeft","_bl",t,o,i),qd(n,"borderRight","_br",t,o,i)}}))},Yh=Qd,Zh=function(n){var e=bh.maxRank(n),t=_h(n,ph.range(1,e+1),"inEdges"),r=_h(n,ph.range(e-1,-1,-1),"outEdges"),o=gh(n);Sh(n,o);for(var i,u=Number.POSITIVE_INFINITY,a=0,c=0;c<4;++a,++c){Eh(a%2?t:r,a%4>=2),o=bh.buildLayerMatrix(n);var l=yh(n,o);l<u&&(c=0,i=ph.cloneDeep(o),u=l)}Sh(n,i)},Xh=function(n){(function(n){var e=jh.buildLayerMatrix(n),t=n.graph().ranksep,r=0;Ph.forEach(e,(function(e){var o=Ph.max(Ph.map(e,(function(e){return n.node(e).height})));Ph.forEach(e,(function(e){n.node(e).y=r+o/2})),r+=o+t}))})(n=jh.asNonCompoundGraph(n)),Ph.forEach(Ih(n),(function(e,t){n.node(t).x=e}))},Uh=ud,Fh=Lf.Graph,Wh=["nodesep","edgesep","ranksep","marginx","marginy"],$h={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Gh=["acyclicer","ranker","rankdir","align"],qh=["width","height"],Kh={width:0,height:0},Qh=["minlen","weight","width","height","labeloffset"],Jh={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},nv=["labelpos"];function ev(n,e){return Ah.mapValues(Ah.pick(n,e),Number)}function tv(n){var e={};return Ah.forEach(n,(function(n,t){e[t.toLowerCase()]=n})),e}var rv=Xf,ov=ud,iv=Lf.Graph,uv={debugOrdering:function(n){var e=ov.buildLayerMatrix(n),t=new iv({compound:!0,multigraph:!0}).setGraph({});return rv.forEach(n.nodes(),(function(e){t.setNode(e,{label:e}),t.setParent(e,"layer"+n.node(e).rank)})),rv.forEach(n.edges(),(function(n){t.setEdge(n.v,n.w,{},n.name)})),rv.forEach(e,(function(n,e){var r="layer"+e;t.setNode(r,{rank:"same"}),rv.reduce(n,(function(n,e){return t.setEdge(n,e,{style:"invis"}),e}))})),t}},av=He({graphlib:Lf,layout:function(n,e){var t=e&&e.debugTiming?Uh.time:Uh.notime;t("layout",(function(){var e=t(" buildLayoutGraph",(function(){return function(n){var e=new Fh({multigraph:!0,compound:!0}),t=tv(n.graph());return e.setGraph(Ah.merge({},$h,ev(t,Wh),Ah.pick(t,Gh))),Ah.forEach(n.nodes(),(function(t){var r=tv(n.node(t));e.setNode(t,Ah.defaults(ev(r,qh),Kh)),e.setParent(t,n.parent(t))})),Ah.forEach(n.edges(),(function(t){var r=tv(n.edge(t));e.setEdge(t,Ah.merge({},Jh,ev(r,Qh),Ah.pick(r,nv)))})),e}(n)}));t(" runLayout",(function(){!function(n,e){e(" makeSpaceForEdgeLabels",(function(){!function(n){var e=n.graph();e.ranksep/=2,Ah.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){Ah.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(){zh.run(n)})),e(" nestingGraph.run",(function(){Vh.run(n)})),e(" rank",(function(){Th(Uh.asNonCompoundGraph(n))})),e(" injectEdgeLabelProxies",(function(){!function(n){Ah.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};Uh.addDummyNode(n,"edge-proxy",o,"_ep")}}))}(n)})),e(" removeEmptyRanks",(function(){Dh(n)})),e(" nestingGraph.cleanup",(function(){Vh.cleanup(n)})),e(" normalizeRanks",(function(){Bh(n)})),e(" assignRankMinMax",(function(){!function(n){var e=0;Ah.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=Ah.max(e,r.maxRank))})),n.graph().maxRank=e}(n)})),e(" removeEdgeLabelProxies",(function(){!function(n){Ah.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(){Lh.run(n)})),e(" parentDummyChains",(function(){Rh(n)})),e(" addBorderSegments",(function(){Hh(n)})),e(" order",(function(){Zh(n)})),e(" insertSelfEdges",(function(){!function(n){var e=Uh.buildLayerMatrix(n);Ah.forEach(e,(function(e){var t=0;Ah.forEach(e,(function(e,r){var o=n.node(e);o.order=r+t,Ah.forEach(o.selfEdges,(function(e){Uh.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(){Yh.adjust(n)})),e(" position",(function(){Xh(n)})),e(" positionSelfEdges",(function(){!function(n){Ah.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,u=t.x-o,a=r.height/2;n.setEdge(t.e,t.label),n.removeNode(e),t.label.points=[{x:o+2*u/3,y:i-a},{x:o+5*u/6,y:i-a},{x:o+u,y:i},{x:o+5*u/6,y:i+a},{x:o+2*u/3,y:i+a}],t.label.x=t.x,t.label.y=t.y}}))}(n)})),e(" removeBorderNodes",(function(){!function(n){Ah.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(Ah.last(t.borderLeft)),u=n.node(Ah.last(t.borderRight));t.width=Math.abs(u.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}})),Ah.forEach(n.nodes(),(function(e){"border"===n.node(e).dummy&&n.removeNode(e)}))}(n)})),e(" normalize.undo",(function(){Lh.undo(n)})),e(" fixupEdgeLabelCoords",(function(){!function(n){Ah.forEach(n.edges(),(function(e){var t=n.edge(e);if(Ah.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(){Yh.undo(n)})),e(" translateGraph",(function(){!function(n){var e=Number.POSITIVE_INFINITY,t=0,r=Number.POSITIVE_INFINITY,o=0,i=n.graph(),u=i.marginx||0,a=i.marginy||0;function c(n){var i=n.x,u=n.y,a=n.width,c=n.height;e=Math.min(e,i-a/2),t=Math.max(t,i+a/2),r=Math.min(r,u-c/2),o=Math.max(o,u+c/2)}Ah.forEach(n.nodes(),(function(e){c(n.node(e))})),Ah.forEach(n.edges(),(function(e){var t=n.edge(e);Ah.has(t,"x")&&c(t)})),e-=u,r-=a,Ah.forEach(n.nodes(),(function(t){var o=n.node(t);o.x-=e,o.y-=r})),Ah.forEach(n.edges(),(function(t){var o=n.edge(t);Ah.forEach(o.points,(function(n){n.x-=e,n.y-=r})),Ah.has(o,"x")&&(o.x-=e),Ah.has(o,"y")&&(o.y-=r)})),i.width=t-e+u,i.height=o-r+a}(n)})),e(" assignNodeIntersects",(function(){!function(n){Ah.forEach(n.edges(),(function(e){var t,r,o=n.edge(e),i=n.node(e.v),u=n.node(e.w);o.points?(t=o.points[0],r=o.points[o.points.length-1]):(o.points=[],t=u,r=i),o.points.unshift(Uh.intersectRect(i,t)),o.points.push(Uh.intersectRect(u,r))}))}(n)})),e(" reversePoints",(function(){!function(n){Ah.forEach(n.edges(),(function(e){var t=n.edge(e);t.reversed&&t.points.reverse()}))}(n)})),e(" acyclic.undo",(function(){zh.undo(n)}))}(e,t)})),t(" updateInputGraph",(function(){!function(n,e){Ah.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))})),Ah.forEach(n.edges(),(function(t){var r=n.edge(t),o=e.edge(t);r.points=o.points,Ah.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:uv,util:{time:ud.time,notime:ud.notime},version:"0.8.5"}),cv=function(){return"[Ink Flow]: Seems like you have not used zustand provider as an ancestor."},lv=function(n){return'Node type "'.concat(n,'" not found. Using fallback type "default".')},sv=function(){return"The Ink Flow parent container needs a width and a height to render the graph."},fv=function(){return"Only child nodes can use a parent extent."},dv=function(n){return'Marker type "'.concat(n,"\" doesn't exist.")},hv=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,".")},vv=function(){return"Handle: No node id found. Make sure to only use a Handle inside a custom Node."},pv=function(n){return'Edge type "'.concat(n,'" not found. Using fallback type "default".')},gv=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.')},yv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],mv=["Enter"," ","Escape"],xv=.5,wv=2,bv=[0,0],_v=function(n,e){void 0===e&&(e=[0,0]);var t=Rv(n),r=t.width,o=t.height,i="internals"in n?n.internals.positionAbsolute:n.position,u=n.origin||e,a=r*u[0],c=o*u[1];return{position:{x:n.position.x-a,y:n.position.y-c},positionAbsolute:{x:i.x-a,y:i.y-c}}},Ev=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=jv(t,e.nodeOrigin);return Ov(n,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Pv(t)};function Sv(n){var e=n.nodeId,t=n.nextPosition,r=n.nodeLookup,o=n.nodeOrigin,i=void 0===o?[0,0]:o,u=n.nodeExtent,a=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},f=s.x,d=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||u);if("parent"!==c.extent||c.expandParent)l&&Bv(c.extent)&&(h=[[c.extent[0][0]+f,c.extent[0][1]+d],[c.extent[1][0]+f,c.extent[1][1]+d]]);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,x=f+v*m[0],w=d+p*m[1];h=[[x,w],[x+g-v,w+y-p]]}}else null==a||a("005",fv());var b=Bv(h)?Cv(t,h):t;return{position:{x:b.x-f,y:b.y-d},positionAbsolute:b}}var kv=function(n,e,t){return void 0===e&&(e=0),void 0===t&&(t=1),Math.min(Math.max(n,e),t)},Cv=function(n,e){return void 0===n&&(n={x:0,y:0}),{x:kv(n.x,e[0][0],e[1][0]),y:kv(n.y,e[0][1],e[1][1])}},Mv=function(n,e,t){return n<e?kv(Math.abs(n-e),1,50)/50:n>t?-kv(Math.abs(n-t),1,50)/50:0},Nv=function(n,e){return[20*Mv(n.x,35,e.width-35),20*Mv(n.y,35,e.height-35)]},Ov=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)}},Pv=function(n){var e=n.x,t=n.y;return{x:e,y:t,width:n.x2-e,height:n.y2-t}},jv=function(n,e){var t,r,o,i,u,a;void 0===e&&(e=[0,0]);var c=_v(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!==(a=null!==(u=null===(i=n.measured)||void 0===i?void 0:i.height)&&void 0!==u?u:n.height)&&void 0!==a?a:0)}},Iv=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])}},Av=function(n,e,t,r){var o=n.x,i=n.y,u=B(e,3),a=u[0],c=u[1],l=u[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-a)/l,y:(i-c)/l};return t?Iv(s,r):s},zv=function(n,e){var t=n.x,r=n.y,o=B(e,3),i=o[0],u=o[1],a=o[2];return{x:t*a+i,y:r*a+u}},Lv=function(n,e,t,r,o,i){var u=e/(n.width*(1+i)),a=t/(n.height*(1+i)),c=Math.min(u,a),l=kv(c,r,o);return{x:e/2-(n.x+n.width/2)*l,y:t/2-(n.y+n.height/2)*l,zoom:l}},Tv=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 Bv(n){return void 0!==n&&"parent"!==n}function Rv(n){var e,t,r,o,i,u,a,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!==(a=null!==(u=null===(i=n.measured)||void 0===i?void 0:i.height)&&void 0!==u?u:n.height)&&void 0!==a?a:n.initialHeight)&&void 0!==c?c:0}}var Dv={x:0,y:0};function Vv(n,e){var t=e.snapGrid,r=void 0===t?[0,0]:t,o=e.snapToGrid,i=void 0!==o&&o,u=e.transform,a=Hv(n),c=a.x,l=a.y,s=Av({x:c,y:l},u),f=i?Iv(s,r):s,d=f.x,h=f.y;return L({xSnapped:d,ySnapped:h},s)}exports.ConnectionMode=void 0,exports.PanOnScrollMode=void 0,exports.SelectionMode=void 0,exports.ConnectionLineType=void 0,exports.MarkerType=void 0,exports.Position=void 0;var Hv=function(n,e){var t,r,o,i,u=function(n){return"clientX"in n}(n),a=u?n.clientX:null===(t=n.touches)||void 0===t?void 0:t[0].clientX,c=u?n.clientY:null===(r=n.touches)||void 0===r?void 0:r[0].clientY;return{x:a-(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 Yv(n){var e=n.sourceX,t=n.sourceY,r=n.targetX,o=n.targetY,i=n.sourceControlX,u=n.sourceControlY,a=.125*e+.375*i+.375*n.targetControlX+.125*r,c=.125*t+.375*u+.375*n.targetControlY+.125*o;return[a,c,Math.abs(a-e),Math.abs(c-t)]}function Zv(n,e){return n>=0?.5*n:25*e*Math.sqrt(-n)}function Xv(n){var e=n.pos,t=n.x1,r=n.y1,o=n.x2,i=n.y2,u=n.c;switch(e){case exports.Position.Left:return[t-Zv(t-o,u),r];case exports.Position.Right:return[t+Zv(o-t,u),r];case exports.Position.Top:return[t,r-Zv(r-i,u)];case exports.Position.Bottom:return[t,r+Zv(i-r,u)]}}function Uv(n){var e=n.sourceX,t=n.sourceY,r=n.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=n.targetX,u=n.targetY,a=n.targetPosition,c=void 0===a?exports.Position.Top:a,l=n.curvature,s=void 0===l?.25:l,f=B(Xv({pos:o,x1:e,y1:t,x2:i,y2:u,c:s}),2),d=f[0],h=f[1],v=B(Xv({pos:c,x1:i,y1:u,x2:e,y2:t,c:s}),2),p=v[0],g=v[1],y=B(Yv({sourceX:e,sourceY:t,targetX:i,targetY:u,sourceControlX:d,sourceControlY:h,targetControlX:p,targetControlY:g}),4),m=y[0],x=y[1],w=y[2],b=y[3];return["M".concat(e,",").concat(t," C").concat(d,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(u),m,x,w,b]}function Fv(n){var e=n.sourceX,t=n.sourceY,r=n.targetX,o=n.targetY,i=Math.abs(r-e)/2,u=r<e?r+i:r-i,a=Math.abs(o-t)/2;return[u,o<t?o+a:o-a,i,a]}!function(n){n.Strict="strict",n.Loose="loose"}(exports.ConnectionMode||(exports.ConnectionMode={})),function(n){n.Free="free",n.Vertical="vertical",n.Horizontal="horizontal"}(exports.PanOnScrollMode||(exports.PanOnScrollMode={})),function(n){n.Partial="partial",n.Full="full"}(exports.SelectionMode||(exports.SelectionMode={})),function(n){n.Bezier="default",n.Straight="straight",n.Step="step",n.SmoothStep="smoothstep",n.SimpleBezier="simplebezier"}(exports.ConnectionLineType||(exports.ConnectionLineType={})),function(n){n.Arrow="arrow",n.ArrowClosed="arrowclosed"}(exports.MarkerType||(exports.MarkerType={})),function(n){n.Left="left",n.Top="top",n.Right="right",n.Bottom="bottom"}(exports.Position||(exports.Position={}));var Wv,$v=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 Gv=((Wv={})[exports.Position.Left]={x:-1,y:0},Wv[exports.Position.Right]={x:1,y:0},Wv[exports.Position.Top]={x:0,y:-1},Wv[exports.Position.Bottom]={x:0,y:1},Wv),qv=function(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))};function Kv(n){var e,t,r,o,i=n.source,u=n.sourcePosition,a=void 0===u?exports.Position.Bottom:u,c=n.target,l=n.targetPosition,s=void 0===l?exports.Position.Top:l,f=n.center,d=n.offset,h=Gv[a],v=Gv[s],p={x:i.x+h.x*d,y:i.y+h.y*d},g={x:c.x+v.x*d,y:c.y+v.y*d},y=function(n){var e=n.source,t=n.sourcePosition,r=void 0===t?exports.Position.Bottom:t,o=n.target;return r===exports.Position.Left||r===exports.Position.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:a,target:g}),m=0!==y.x?"x":"y",x=y[m],w=[],b={x:0,y:0},_={x:0,y:0},E=B(Fv({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),S=E[0],k=E[1],C=E[2],M=E[3];if(h[m]*v[m]==-1){r=null!==(e=f.x)&&void 0!==e?e:S,o=null!==(t=f.y)&&void 0!==t?t:k;var N=[{x:r,y:p.y},{x:r,y:g.y}],O=[{x:p.x,y:o},{x:g.x,y:o}];w=h[m]===x?"x"===m?N:O:"x"===m?O:N}else{var P=[{x:p.x,y:g.y}],j=[{x:g.x,y:p.y}];if(w="x"===m?h.x===x?j:P:h.y===x?P:j,a===s){var I=Math.abs(i[m]-c[m]);if(I<=d){var A=Math.min(d-1,d-I);h[m]===x?b[m]=(p[m]>i[m]?-1:1)*A:_[m]=(g[m]>c[m]?-1:1)*A}}if(a!==s){var z="x"===m?"y":"x",L=h[m]===v[z],T=p[z]>g[z],D=p[z]<g[z];(1===h[m]&&(!L&&T||L&&D)||1!==h[m]&&(!L&&D||L&&T))&&(w="x"===m?P:j)}var V={x:p.x+b.x,y:p.y+b.y},H={x:g.x+_.x,y:g.y+_.y};Math.max(Math.abs(V.x-w[0].x),Math.abs(H.x-w[0].x))>=Math.max(Math.abs(V.y-w[0].y),Math.abs(H.y-w[0].y))?(r=(V.x+H.x)/2,o=w[0].y):(r=w[0].x,o=(V.y+H.y)/2)}return[R(R([i,{x:p.x+b.x,y:p.y+b.y}],B(w),!1),[{x:g.x+_.x,y:g.y+_.y},c],!1),r,o,C,M]}function Qv(n){var e=n.sourceX,t=n.sourceY,r=n.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=n.targetX,u=n.targetY,a=n.targetPosition,c=void 0===a?exports.Position.Top:a,l=n.borderRadius,s=void 0===l?5:l,f=n.centerX,d=n.centerY,h=n.offset,v=B(Kv({source:{x:e,y:t},sourcePosition:o,target:{x:i,y:u},targetPosition:c,center:{x:f,y:d},offset:void 0===h?20:h}),5),p=v[0],g=v[1],y=v[2],m=v[3],x=v[4];return[p.reduce((function(n,e,t){return n+(t>0&&t<p.length-1?function(n,e,t,r){var o=Math.min(qv(n,e)/2,qv(e,t)/2,r),i=e.x,u=e.y;if(n.x===i&&i===t.x||n.y===u&&u===t.y)return"L".concat(i," ").concat(u);if(n.y===u){var a=n.x<t.x?-1:1,c=n.y<t.y?1:-1;return"L ".concat(i+o*a,",").concat(u,"Q ").concat(i,",").concat(u," ").concat(i,",").concat(u+o*c)}var l=n.x<t.x?1:-1,s=n.y<t.y?-1:1;return"L ".concat(i,",").concat(u+o*s,"Q ").concat(i,",").concat(u," ").concat(i+o*l,",").concat(u)}(p[t-1],e,p[t+1],s):"".concat(0===t?"M":"L").concat(e.x," ").concat(e.y))}),""),g,y,m,x]}function Jv(n,e,t){var r=(null==t?void 0:t.rankdir)||"TB",o=new av.graphlib.Graph;o.setDefaultEdgeLabel((function(){return{}})),o.setGraph(L({rankdir:r},t));var i=n.map((function(n){return L({},n)}));i.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)})),av.layout(o),i.forEach((function(n){var e=o.node(n.id),t="bottom",i="top";switch(r){case"TB":default:t="bottom",i="top";break;case"BT":t="top",i="bottom";break;case"LR":t="right",i="left";break;case"RL":t="left",i="right"}n.targetPosition=i,n.sourcePosition=t,n.position={x:e.x-e.width/2,y:e.y-e.height/2}}));var u=function(n){var e=n.centerNodeId,t=n.containerHeight,r=void 0===t?0:t,o=n.containerWidth,i=void 0===o?0:o,u=n.centerByBBox,a=n.nodes,c=n.nodeOrigin,l=void 0===c?bv:c;if(!e&&!u||!r||!i)return Dv;if(null==e?void 0:e.trim()){var s=null==a?void 0:a.find((function(n){return n.id===(null==e?void 0:e.trim())}));if(s){var f=function(n,e){if(!n)return Dv;var t=Rv(n),r=t.width,o=t.height,i=r*e[0],u=o*e[1];return{x:n.position.x+r/2-i,y:n.position.y+o/2-u}}(s,l);return{x:i/2-f.x,y:r/2-f.y}}}return u?(f=function(n,e){if(!(null==n?void 0:n.length))return Dv;var t=Ev(n,{nodeOrigin:e}),r=t.x,o=t.y;return{x:r+t.width/2,y:o+t.height/2}}(a,l),{x:i/2-f.x,y:r/2-f.y}):Dv}({centerByBBox:null==t?void 0:t.centerByBBox,centerNodeId:null==t?void 0:t.centerNodeId,nodes:i,containerWidth:null==t?void 0:t.width,containerHeight:null==t?void 0:t.height,nodeOrigin:null==t?void 0:t.nodeOrigin}),a=u.x,c=void 0===a?0:a,l=u.y,s=void 0===l?0:l;i.forEach((function(n){n.position={x:n.position.x+c,y:n.position.y+s}}));var f={overflowBoundary:!1,transform:{x:0,y:0,zoom:1}};return(null==t?void 0:t.width)&&(null==t?void 0:t.height)&&t.fitViewOptions&&(f=function(n,e){var t=e||{},r=t.minZoom,o=void 0===r?xv:r,i=t.maxZoom,u=void 0===i?wv:i,a=t.padding,c=void 0===a?.1:a,l=t.nodeOrigin,s=void 0===l?bv:l,f=t.width,d=t.height,h=Ev(n||[],{nodeOrigin:s}),v=h.width>=f||h.height>=d;return{transform:Lv(h,f,d,o,u,c),overflowBoundary:v}}(i,L({width:t.width,height:t.height,nodeOrigin:t.nodeOrigin},t.fitViewOptions))),{nodes:i,edges:e,transform:f.transform,overflowBoundary:f.overflowBoundary}}var np={assign:Object.assign,getHeight:function(n,e,t,r){return void 0===r&&(r="height"),"center"===t?(n[r]+e[r])/2:n.height}},ep=np,tp={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 rp(n,e){var t=this;if(t.vgap=t.hgap=0,n instanceof rp)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}ep.assign(rp.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 op=function(n,e,t){void 0===e&&(e={});var r,o=new rp(n,e=ep.assign({},tp,e)),i=[o];if(!t&&!n.collapsed)for(;r=i.shift();)if(!r.data.collapsed){var u=e.getChildren(r.data),a=u?u.length:0;if(r.children=new Array(a),u&&a)for(var c=0;c<a;c++){var l=new rp(u[c],e);r.children[c]=l,i.push(l),l.parent=r,l.depth=r.depth+1}}return o},ip=op,up=function(){function n(n,e){void 0===e&&(e={}),this.options=e,this.rootNode=ip(n,e)}return n.prototype.execute=function(){throw new Error("please override this method")},n}(),ap=up;function cp(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 lp(n,e,t){t?n.y+=e:n.x+=e,n.children.forEach((function(n){lp(n,e,t)}))}function sp(n,e){var t=e?n.y:n.x;return n.children.forEach((function(n){t=Math.min(sp(n,e),t)})),t}function fp(n,e){lp(n,-sp(n,e),e)}function dp(n,e,t){t?e.y=n.x:e.x=n.x,n.c.forEach((function(n,r){dp(n,e.children[r],t)}))}function hp(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){hp(n,e,t)}))}cp.fromNode=function(n,e){if(!n)return null;var t=[];return n.children.forEach((function(n){t.push(cp.fromNode(n,e))})),e?new cp(n.height,n.width,n.x,t):new cp(n.width,n.height,n.y,t)};var vp=op,pp=function(n,e){for(var t=vp(n.data,e,!0),r=vp(n.data,e,!0),o=n.children.length,i=Math.round(o/2),u=e.getSide||function(n,e){return e<i?"right":"left"},a=0;a<o;a++){var c=n.children[a];"right"===u(c,a)?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}},gp=pp,yp=["LR","RL","TB","BT","H","V"],mp=["LR","RL","H"],xp=yp[0],wp=function(n,e,t){var r=e.direction||xp;if(e.isHorizontal=function(n){return mp.indexOf(n)>-1}(r),r&&-1===yp.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===yp[0])t(n,e);else if(r===yp[1])t(n,e),n.right2left();else if(r===yp[2])t(n,e);else if(r===yp[3])t(n,e),n.bottom2top();else if(r===yp[4]||r===yp[5]){var o=gp(n,e),i=o.left,u=o.right;t(i,e),t(u,e),e.isHorizontal?i.right2left():i.bottom2top(),u.translate(i.x-u.x,i.y-u.y),n.x=i.x,n.y=u.y;var a=n.getBoundingBox();e.isHorizontal?a.top<0&&n.translate(0,-a.top):a.left<0&&n.translate(-a.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)),function(n,e){if(e.radial){var t=e.isHorizontal?["x","y"]:["y","x"],r=t[0],o=t[1],i={x:1/0,y:1/0},u={x:-1/0,y:-1/0},a=0;n.DFTraverse((function(n){a++;var e=n.x,t=n.y;i.x=Math.min(i.x,e),i.y=Math.min(i.y,t),u.x=Math.max(u.x,e),u.y=Math.max(u.y,t)}));var c=u[o]-i[o];if(0===c)return;var l=2*Math.PI/a;n.DFTraverse((function(e){var t=(e[o]-i[o])/c*(2*Math.PI-l)+l,u=e[r]-n[r];e.x=Math.cos(t)*u,e.y=Math.sin(t)*u}))}}(n,e),n};function bp(n,e){return bp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,e){return n.__proto__=e,n},bp(n,e)}var _p=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 f=o+r.prelim+r.w-(s+l.prelim);f>0&&(s+=f,i(n,e,t.index,f));var d=c(r),h=c(l);d<=h&&null!==(r=a(r))&&(o+=r.mod),d>=h&&null!==(l=u(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 u(n){return 0===n.cs?n.tl:n.c[0]}function a(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}}hp(n,t);var s=cp.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 u=c(e.c[i].er);o(e,i,t),t=l(u,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),dp(s,n,t),fp(n,t),n},Ep=wp,Sp=np,kp=function(n){function e(){return n.apply(this,arguments)||this}var t,r;return r=n,(t=e).prototype=Object.create(r.prototype),t.prototype.constructor=t,bp(t,r),e.prototype.execute=function(){return Ep(this.rootNode,this.options,_p)},e}(ap),Cp={},Mp=np;function Np(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 Op={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function Pp(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){Pp(n,e.children[r],t)}))}function jp(n,e){return jp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,e){return n.__proto__=e,n},jp(n,e)}var Ip=function(n,e){void 0===e&&(e={}),e=Mp.assign({},Op,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 Np(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),Pp(o,n,e.isHorizontal),n},Ap=wp,zp=np,Lp=function(n){function e(){return n.apply(this,arguments)||this}var t,r;return r=n,(t=e).prototype=Object.create(r.prototype),t.prototype.constructor=t,jp(t,r),e.prototype.execute=function(){var n=this;return n.rootNode.width=0,Ap(n.rootNode,n.options,Ip)},e}(ap),Tp={},Bp=np;function Rp(n,e){return Rp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,e){return n.__proto__=e,n},Rp(n,e)}var Dp=ap,Vp=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+Bp.getHeight(e,n,o),e.parent&&n.parent.id!==e.parent.id){var u=e.parent,a=u.y+Bp.getHeight(u,n,o);n.y=a>n.y?a:n.y}}else n.y=0}(n,o,e,t,r),o=n}))},Hp=pp,Yp=np,Zp=["LR","RL","H"],Xp=Zp[0],Up=function(n){function e(){return n.apply(this,arguments)||this}var t,r;return r=n,(t=e).prototype=Object.create(r.prototype),t.prototype.constructor=t,Rp(t,r),e.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,u=n.direction,a=void 0===u?Xp:u,c=n.align;if(a&&-1===Zp.indexOf(a))throw new TypeError("Invalid direction: "+a);if(a===Zp[0])Vp(e,r,i,c);else if(a===Zp[1])Vp(e,r,i,c),e.right2left();else if(a===Zp[2]){var l=Hp(e,n),s=l.left,f=l.right;Vp(s,r,i,c),s.right2left(),Vp(f,r,i,c);var d=s.getBoundingBox();f.translate(d.width,0),e.x=f.x-e.width/2}return e},e}(Dp),Fp={},Wp=np;function $p(n,e){var t=0;return n.children.length?n.children.forEach((function(n){t+=$p(n,e)})):t=n.height,n._subTreeSep=e.getSubTreeSep(n.data),n.totalHeight=Math.max(n.height,t)+2*n._subTreeSep,n.totalHeight}function Gp(n){var e=n.children,t=e.length;if(t){e.forEach((function(n){Gp(n)}));var r=e[0],o=e[t-1],i=o.y-r.y+o.height,u=0;if(e.forEach((function(n){u+=n.totalHeight})),i>n.height)n.y=r.y+i/2-n.height/2;else if(1!==e.length||n.height>u){var a=n.y+(n.height-i)/2-r.y;e.forEach((function(n){n.translate(0,a)}))}else n.y=(r.y+r.height/2+o.y+o.height/2)/2-n.height/2}}var qp={getSubTreeSep:function(){return 0}};function Kp(n,e){return Kp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,e){return n.__proto__=e,n},Kp(n,e)}var Qp=function(n,e){void 0===e&&(e={}),e=Wp.assign({},qp,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,$p(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}}}})),Gp(n)},Jp=wp,ng=np,eg=function(n){function e(){return n.apply(this,arguments)||this}var t,r;return r=n,(t=e).prototype=Object.create(r.prototype),t.prototype.constructor=t,Kp(t,r),e.prototype.execute=function(){return Jp(this.rootNode,this.options,Qp)},e}(ap),tg={};He({compactBox:function(n,e){return e=Sp.assign({},Cp,e),new kp(n,e).execute()},dendrogram:function(n,e){return e=zp.assign({},Tp,e),new Lp(n,e).execute()},indented:function(n,e){return e=Yp.assign({},Fp,e),new Up(n,e).execute()},mindmap:function(n,e){return e=ng.assign({},tg,e),new eg(n,e).execute()}});var rg={value:()=>{}};function og(){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 ig(r)}function ig(n){this._=n}function ug(n,e){for(var t,r=0,o=n.length;r<o;++r)if((t=n[r]).name===e)return t.value}function ag(n,e,t){for(var r=0,o=n.length;r<o;++r)if(n[r].name===e){n[r]=rg,n=n.slice(0,r).concat(n.slice(r+1));break}return null!=t&&n.push({name:e,value:t}),n}ig.prototype=og.prototype={constructor:ig,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}}))),u=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++u<a;)if(t=(n=i[u]).type)o[t]=ag(o[t],n.name,e);else if(null==e)for(t in o)o[t]=ag(o[t],n.name,null);return this}for(;++u<a;)if((t=(n=i[u]).type)&&(t=ug(o[t],n.name)))return t},copy:function(){var n={},e=this._;for(var t in e)n[t]=e[t].slice();return new ig(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 cg="http://www.w3.org/1999/xhtml",lg={svg:"http://www.w3.org/2000/svg",xhtml:cg,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function sg(n){var e=n+="",t=e.indexOf(":");return t>=0&&"xmlns"!==(e=n.slice(0,t))&&(n=n.slice(t+1)),lg.hasOwnProperty(e)?{space:lg[e],local:n}:n}function fg(n){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===cg&&e.documentElement.namespaceURI===cg?e.createElement(n):e.createElementNS(t,n)}}function dg(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function hg(n){var e=sg(n);return(e.local?dg:fg)(e)}function vg(){}function pg(n){return null==n?vg:function(){return this.querySelector(n)}}function gg(){return[]}function yg(n){return null==n?gg:function(){return this.querySelectorAll(n)}}function mg(n){return function(){return this.matches(n)}}function xg(n){return function(e){return e.matches(n)}}var wg=Array.prototype.find;function bg(){return this.firstElementChild}var _g=Array.prototype.filter;function Eg(){return Array.from(this.children)}function Sg(n){return new Array(n.length)}function kg(n,e){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=e}function Cg(n,e,t,r,o,i){for(var u,a=0,c=e.length,l=i.length;a<l;++a)(u=e[a])?(u.__data__=i[a],r[a]=u):t[a]=new kg(n,i[a]);for(;a<c;++a)(u=e[a])&&(o[a]=u)}function Mg(n,e,t,r,o,i,u){var a,c,l,s=new Map,f=e.length,d=i.length,h=new Array(f);for(a=0;a<f;++a)(c=e[a])&&(h[a]=l=u.call(c,c.__data__,a,e)+"",s.has(l)?o[a]=c:s.set(l,c));for(a=0;a<d;++a)l=u.call(n,i[a],a,i)+"",(c=s.get(l))?(r[a]=c,c.__data__=i[a],s.delete(l)):t[a]=new kg(n,i[a]);for(a=0;a<f;++a)(c=e[a])&&s.get(h[a])===c&&(o[a]=c)}function Ng(n){return n.__data__}function Og(n){return"object"==typeof n&&"length"in n?n:Array.from(n)}function Pg(n,e){return n<e?-1:n>e?1:n>=e?0:NaN}function jg(n){return function(){this.removeAttribute(n)}}function Ig(n){return function(){this.removeAttributeNS(n.space,n.local)}}function Ag(n,e){return function(){this.setAttribute(n,e)}}function zg(n,e){return function(){this.setAttributeNS(n.space,n.local,e)}}function Lg(n,e){return function(){var t=e.apply(this,arguments);null==t?this.removeAttribute(n):this.setAttribute(n,t)}}function Tg(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 Bg(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function Rg(n){return function(){this.style.removeProperty(n)}}function Dg(n,e,t){return function(){this.style.setProperty(n,e,t)}}function Vg(n,e,t){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,t)}}function Hg(n,e){return n.style.getPropertyValue(e)||Bg(n).getComputedStyle(n,null).getPropertyValue(e)}function Yg(n){return function(){delete this[n]}}function Zg(n,e){return function(){this[n]=e}}function Xg(n,e){return function(){var t=e.apply(this,arguments);null==t?delete this[n]:this[n]=t}}function Ug(n){return n.trim().split(/^|\s+/)}function Fg(n){return n.classList||new Wg(n)}function Wg(n){this._node=n,this._names=Ug(n.getAttribute("class")||"")}function $g(n,e){for(var t=Fg(n),r=-1,o=e.length;++r<o;)t.add(e[r])}function Gg(n,e){for(var t=Fg(n),r=-1,o=e.length;++r<o;)t.remove(e[r])}function qg(n){return function(){$g(this,n)}}function Kg(n){return function(){Gg(this,n)}}function Qg(n,e){return function(){(e.apply(this,arguments)?$g:Gg)(this,n)}}function Jg(){this.textContent=""}function ny(n){return function(){this.textContent=n}}function ey(n){return function(){var e=n.apply(this,arguments);this.textContent=null==e?"":e}}function ty(){this.innerHTML=""}function ry(n){return function(){this.innerHTML=n}}function oy(n){return function(){var e=n.apply(this,arguments);this.innerHTML=null==e?"":e}}function iy(){this.nextSibling&&this.parentNode.appendChild(this)}function uy(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ay(){return null}function cy(){var n=this.parentNode;n&&n.removeChild(this)}function ly(){var n=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(n,this.nextSibling):n}function sy(){var n=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(n,this.nextSibling):n}function fy(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 dy(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 u=0,a=o.length;u<a;++u)if((r=o[u]).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 hy(n,e,t){var r=Bg(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 vy(n,e){return function(){return hy(this,n,e)}}function py(n,e){return function(){return hy(this,n,e.apply(this,arguments))}}kg.prototype={constructor:kg,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)}},Wg.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 gy=[null];function yy(n,e){this._groups=n,this._parents=e}function my(){return new yy([[document.documentElement]],gy)}function xy(n){return"string"==typeof n?new yy([[document.querySelector(n)]],[document.documentElement]):new yy([[n]],gy)}function wy(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]}yy.prototype=my.prototype={constructor:yy,select:function(n){"function"!=typeof n&&(n=pg(n));for(var e=this._groups,t=e.length,r=new Array(t),o=0;o<t;++o)for(var i,u,a=e[o],c=a.length,l=r[o]=new Array(c),s=0;s<c;++s)(i=a[s])&&(u=n.call(i,i.__data__,s,a))&&("__data__"in i&&(u.__data__=i.__data__),l[s]=u);return new yy(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):yg(n);for(var e=this._groups,t=e.length,r=[],o=[],i=0;i<t;++i)for(var u,a=e[i],c=a.length,l=0;l<c;++l)(u=a[l])&&(r.push(n.call(u,u.__data__,l,a)),o.push(u));return new yy(r,o)},selectChild:function(n){return this.select(null==n?bg:function(n){return function(){return wg.call(this.children,n)}}("function"==typeof n?n:xg(n)))},selectChildren:function(n){return this.selectAll(null==n?Eg:function(n){return function(){return _g.call(this.children,n)}}("function"==typeof n?n:xg(n)))},filter:function(n){"function"!=typeof n&&(n=mg(n));for(var e=this._groups,t=e.length,r=new Array(t),o=0;o<t;++o)for(var i,u=e[o],a=u.length,c=r[o]=[],l=0;l<a;++l)(i=u[l])&&n.call(i,i.__data__,l,u)&&c.push(i);return new yy(r,this._parents)},data:function(n,e){if(!arguments.length)return Array.from(this,Ng);var t,r=e?Mg:Cg,o=this._parents,i=this._groups;"function"!=typeof n&&(t=n,n=function(){return t});for(var u=i.length,a=new Array(u),c=new Array(u),l=new Array(u),s=0;s<u;++s){var f=o[s],d=i[s],h=d.length,v=Og(n.call(f,f&&f.__data__,s,o)),p=v.length,g=c[s]=new Array(p),y=a[s]=new Array(p);r(f,d,g,y,l[s]=new Array(h),v,e);for(var m,x,w=0,b=0;w<p;++w)if(m=g[w]){for(w>=b&&(b=w+1);!(x=y[b])&&++b<p;);m._next=x||null}}return(a=new yy(a,o))._enter=c,a._exit=l,a},enter:function(){return new yy(this._enter||this._groups.map(Sg),this._parents)},exit:function(){return new yy(this._exit||this._groups.map(Sg),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,u=Math.min(o,i),a=new Array(o),c=0;c<u;++c)for(var l,s=t[c],f=r[c],d=s.length,h=a[c]=new Array(d),v=0;v<d;++v)(l=s[v]||f[v])&&(h[v]=l);for(;c<o;++c)a[c]=t[c];return new yy(a,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,u=o[i];--i>=0;)(r=o[i])&&(u&&4^r.compareDocumentPosition(u)&&u.parentNode.insertBefore(r,u),u=r);return this},sort:function(n){function e(e,t){return e&&t?n(e.__data__,t.__data__):!e-!t}n||(n=Pg);for(var t=this._groups,r=t.length,o=new Array(r),i=0;i<r;++i){for(var u,a=t[i],c=a.length,l=o[i]=new Array(c),s=0;s<c;++s)(u=a[s])&&(l[s]=u);l.sort(e)}return new yy(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 u=r[o];if(u)return u}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],u=0,a=i.length;u<a;++u)(o=i[u])&&n.call(o,o.__data__,u,i);return this},attr:function(n,e){var t=sg(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?Ig:jg:"function"==typeof e?t.local?Tg:Lg:t.local?zg:Ag)(t,e))},style:function(n,e,t){return arguments.length>1?this.each((null==e?Rg:"function"==typeof e?Vg:Dg)(n,e,null==t?"":t)):Hg(this.node(),n)},property:function(n,e){return arguments.length>1?this.each((null==e?Yg:"function"==typeof e?Xg:Zg)(n,e)):this.node()[n]},classed:function(n,e){var t=Ug(n+"");if(arguments.length<2){for(var r=Fg(this.node()),o=-1,i=t.length;++o<i;)if(!r.contains(t[o]))return!1;return!0}return this.each(("function"==typeof e?Qg:e?qg:Kg)(t,e))},text:function(n){return arguments.length?this.each(null==n?Jg:("function"==typeof n?ey:ny)(n)):this.node().textContent},html:function(n){return arguments.length?this.each(null==n?ty:("function"==typeof n?oy:ry)(n)):this.node().innerHTML},raise:function(){return this.each(iy)},lower:function(){return this.each(uy)},append:function(n){var e="function"==typeof n?n:hg(n);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(n,e){var t="function"==typeof n?n:hg(n),r=null==e?ay:"function"==typeof e?e:pg(e);return this.select((function(){return this.insertBefore(t.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(cy)},clone:function(n){return this.select(n?sy:ly)},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+""),u=i.length;if(!(arguments.length<2)){for(a=e?dy:fy,r=0;r<u;++r)this.each(a(i[r],e,t));return this}var a=this.node().__on;if(a)for(var c,l=0,s=a.length;l<s;++l)for(r=0,c=a[l];r<u;++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?py:vy)(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,u=o.length;i<u;++i)(r=o[i])&&(yield r)}};const by={passive:!1},_y={capture:!0,passive:!1};function Ey(n){n.stopImmediatePropagation()}function Sy(n){n.preventDefault(),n.stopImmediatePropagation()}function ky(n){var e=n.document.documentElement,t=xy(n).on("dragstart.drag",Sy,_y);"onselectstart"in e?t.on("selectstart.drag",Sy,_y):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Cy(n,e){var t=n.document.documentElement,r=xy(n).on("dragstart.drag",null);e&&(r.on("click.drag",Sy,_y),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 My=n=>()=>n;function Ny(n,{sourceEvent:e,subject:t,target:r,identifier:o,active:i,x:u,y:a,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:u,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:s}})}function Oy(n){return!n.ctrlKey&&!n.button}function Py(){return this.parentNode}function jy(n,e){return null==e?{x:n.x,y:n.y}:e}function Iy(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ay(n,e){if(!n.parentId)return!1;var t=e.get(n.parentId);return!!t&&(!!t.selected||Ay(t,e))}function zy(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 Ly(n){var e,t,r,o,i=n.nodeId,u=n.dragItems,a=n.nodeLookup,c=[];try{for(var l=T(u),s=l.next();!s.done;s=l.next()){var f=B(s.value,2),d=f[0],h=f[1],v=null===(r=a.get(d))||void 0===r?void 0:r.internals.userNode;v&&c.push(L(L({},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=a.get(i).internals.userNode;return[L(L({},p),{position:(null===(o=u.get(i))||void 0===o?void 0:o.position)||p.position}),c]}function Ty(n){var e=n.onNodeMouseDown,t=n.getStoreItems,r=n.onDragStart,o=n.onDrag,i=n.onDragStop,u={x:null,y:null},a=0,c=new Map,l=!1,s={x:0,y:0},f=null,d=!1,h=null;return{update:function(n){var v=n.noDragClassName,p=n.handleSelector,g=n.domNode,y=n.isSelectable,m=n.nodeId;function x(n,e){var r,i,a=n.x,l=n.y,s=t(),f=s.nodeLookup,d=s.nodeExtent,h=s.snapGrid,v=s.snapToGrid,p=s.nodeOrigin,g=s.onNodeDrag,y=s.onSelectionDrag,x=s.onError,w=s.updateNodePositions;u={x:a,y:l};var b=!1,_={x:0,y:0,x2:0,y2:0};if(c.size>1&&d){var E=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=jv(n,e.nodeOrigin);t=Ov(t,r)}})),Pv(t)}(c,{nodeOrigin:p});_=function(n){var e=n.x,t=n.y;return{x:e,y:t,x2:e+n.width,y2:t+n.height}}(E)}try{for(var S=T(c),k=S.next();!k.done;k=S.next()){var C=B(k.value,2),M=C[0],N=C[1],O={x:a-N.distance.x,y:l-N.distance.y};v&&(O=Iv(O,h));var P=[[d[0][0],d[0][1]],[d[1][0],d[1][1]]];if(c.size>1&&d&&!N.extent){var j=N.internals.positionAbsolute,I=j.x-_.x+d[0][0],A=j.x+N.measured.width-_.x2+d[1][0];P=[[I,j.y-_.y+d[0][1]],[A,j.y+N.measured.height-_.y2+d[1][1]]]}var z=Sv({nodeId:M,nextPosition:O,nodeLookup:f,nodeExtent:P,nodeOrigin:p,onError:x}),L=z.position,R=z.positionAbsolute;b=b||N.position.x!==L.x||N.position.y!==L.y,N.position=L,N.internals.positionAbsolute=R}}catch(n){r={error:n}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(b&&(w(c,!0),e&&(o||g||!m&&y))){var D=B(Ly({nodeId:m,dragItems:c,nodeLookup:f}),2),V=D[0],H=D[1];null==o||o(e,c,V,H),null==g||g(e,V,H),m||null==y||y(e,H)}}function w(){var n,e;if(f){var r=B(Nv(s,f),2),o=r[0],i=r[1];if(0!==o||0!==i){var c=t(),l=c.transform,d=c.panBy;u.x=(null!==(n=u.x)&&void 0!==n?n:0)-o/l[2],u.y=(null!==(e=u.y)&&void 0!==e?e:0)-i/l[2],d({x:o,y:i})&&x(u,null)}a=requestAnimationFrame(w)}}function b(n){var o,i=t(),a=i.nodeLookup,l=i.multiSelectionActive,s=i.nodesDraggable,f=i.transform,h=i.snapGrid,v=i.snapToGrid,p=i.selectNodesOnDrag,g=i.onNodeDragStart,x=i.onSelectionDragStart,w=i.unselectNodesAndEdges;d=!0,p&&y||l||!m||(null===(o=a.get(m))||void 0===o?void 0:o.selected)||w(),y&&p&&m&&(null==e||e(m));var b=Vv(n.sourceEvent,{transform:f,snapGrid:h,snapToGrid:v});if(u=b,c=function(n,e,t,r){var o,i,u,a,c=new Map;try{for(var l=T(n),s=l.next();!s.done;s=l.next()){var f=B(s.value,2),d=f[0],h=f[1];if((h.selected||h.id===r)&&(!h.parentId||!Ay(h,n))&&(h.draggable||e&&void 0===h.draggable)){var v=n.get(d);v&&c.set(d,{id:d,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!==(u=v.measured.width)&&void 0!==u?u:0,height:null!==(a=v.measured.height)&&void 0!==a?a: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}(a,s,b,m),c.size>0&&(r||g||!m&&x)){var _=B(Ly({nodeId:m,dragItems:c,nodeLookup:a}),2),E=_[0],S=_[1];null==r||r(n.sourceEvent,c,E,S),null==g||g(n.sourceEvent,E,S),m||null==x||x(n.sourceEvent,S)}}h=xy(g);var _=function(){var n,e,t,r,o=Oy,i=Py,u=jy,a=Iy,c={},l=og("start","drag","end"),s=0,f=0;function d(n){n.on("mousedown.drag",h).filter(a).on("touchstart.drag",g).on("touchmove.drag",y,by).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(u,a){if(!r&&o.call(this,u,a)){var c=x(this,i.call(this,u,a),u,a,"mouse");c&&(xy(u.view).on("mousemove.drag",v,_y).on("mouseup.drag",p,_y),ky(u.view),Ey(u),t=!1,n=u.clientX,e=u.clientY,c("start",u))}}function v(r){if(Sy(r),!t){var o=r.clientX-n,i=r.clientY-e;t=o*o+i*i>f}c.mouse("drag",r)}function p(n){xy(n.view).on("mousemove.drag mouseup.drag",null),Cy(n.view,t),Sy(n),c.mouse("end",n)}function g(n,e){if(o.call(this,n,e)){var t,r,u=n.changedTouches,a=i.call(this,n,e),c=u.length;for(t=0;t<c;++t)(r=x(this,a,n,e,u[t].identifier,u[t]))&&(Ey(n),r("start",n,u[t]))}}function y(n){var e,t,r=n.changedTouches,o=r.length;for(e=0;e<o;++e)(t=c[r[e].identifier])&&(Sy(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])&&(Ey(n),t("end",n,o[e]))}function x(n,e,t,r,o,i){var a,f,h,v=l.copy(),p=wy(i||t,e);if(null!=(h=u.call(n,new Ny("beforestart",{sourceEvent:t,target:d,identifier:o,active:s,x:p[0],y:p[1],dx:0,dy:0,dispatch:v}),r)))return a=h.x-p[0]||0,f=h.y-p[1]||0,function t(i,u,l){var g,y=p;switch(i){case"start":c[o]=t,g=s++;break;case"end":delete c[o],--s;case"drag":p=wy(l||u,e),g=s}v.call(i,n,new Ny(i,{sourceEvent:u,subject:h,target:d,identifier:o,active:g,x:p[0]+a,y:p[1]+f,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:v}),r)}}return d.filter=function(n){return arguments.length?(o="function"==typeof n?n:My(!!n),d):o},d.container=function(n){return arguments.length?(i="function"==typeof n?n:My(n),d):i},d.subject=function(n){return arguments.length?(u="function"==typeof n?n:My(n),d):u},d.touchable=function(n){return arguments.length?(a="function"==typeof n?n:My(!!n),d):a},d.on=function(){var n=l.on.apply(l,arguments);return n===l?d:n},d.clickDistance=function(n){return arguments.length?(f=(n=+n)*n,d):Math.sqrt(f)},d}().on("start",(function(n){var e=t(),r=e.domNode,o=e.nodeDragThreshold,i=e.transform,a=e.snapGrid,c=e.snapToGrid;0===o&&b(n);var l=Vv(n.sourceEvent,{transform:i,snapGrid:a,snapToGrid:c});u=l,f=(null==r?void 0:r.getBoundingClientRect())||null,s=Hv(n.sourceEvent,f)})).on("drag",(function(n){var e,r,o=t(),i=o.autoPanOnNodeDrag,a=o.transform,h=o.snapGrid,v=o.snapToGrid,p=o.nodeDragThreshold,g=Vv(n.sourceEvent,{transform:a,snapGrid:h,snapToGrid:v});if(!l&&i&&d&&(l=!0,w()),!d){var y=g.xSnapped-(null!==(e=u.x)&&void 0!==e?e:0),m=g.ySnapped-(null!==(r=u.y)&&void 0!==r?r:0);Math.sqrt(y*y+m*m)>p&&b(n)}(u.x!==g.xSnapped||u.y!==g.ySnapped)&&c&&d&&(s=Hv(n.sourceEvent,f),x(g,n.sourceEvent))})).on("end",(function(n){if(d&&(l=!1,d=!1,cancelAnimationFrame(a),c.size>0)){var e=t(),r=e.nodeLookup,o=e.updateNodePositions,u=e.onNodeDragStop,s=e.onSelectionDragStop;if(o(c,!1),i||u||!m&&s){var f=B(Ly({nodeId:m,dragItems:c,nodeLookup:r}),2),h=f[0],v=f[1];null==i||i(n.sourceEvent,c,h,v),null==u||u(n.sourceEvent,h,v),m||null==s||s(n.sourceEvent,v)}}})).filter((function(n){var e=n.target;return!n.button&&(!v||!zy(e,".".concat(v),g))&&(!p||zy(e,p,g))}));h.call(_)},destroy:function(){null==h||h.on(".drag",null)}}}function By(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 Ry(n,e){return n||((null==e?void 0:e.classList.contains("target"))?"target":(null==e?void 0:e.classList.contains("source"))?"source":null)}Ny.prototype.on=function(){var n=this._.on.apply(this._,arguments);return n===this._?this:n};var Dy=function(){return!0},Vy=null;function Hy(n,e){var t=e.handle,r=e.connectionMode,o=e.fromNodeId,i=e.fromHandleId,u=e.fromType,a=e.doc,c=e.lib,l=e.flowId,s=e.isValidConnection,f=void 0===s?Dy:s,d="target"===u,h=t?a.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=Hv(n),p=v.x,g=v.y,y=a.elementFromPoint(p,g),m=(null==y?void 0:y.classList.contains("".concat(c,"-flow__handle")))?y:h,x={handleDomNode:m,isValid:!1,connection:null,endHandle:null};if(m){var w=Ry(void 0,m),b=m.getAttribute("data-nodeid"),_=m.getAttribute("data-handleid"),E=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!b)return x;var k={source:d?b:o,sourceHandle:d?_:i,target:d?o:b,targetHandle:d?i:_};x.connection=k,E&&S&&(r===exports.ConnectionMode.Strict?d&&"source"===w||!d&&"target"===w:b!==o||_!==i)&&(x.endHandle={nodeId:b,handleId:_,type:w},x.isValid=f(k))}return x}var Yy={onPointerDown:function(n,e){var t,r=e.connectionMode,o=e.connectionRadius,i=e.handleId,u=e.nodeId,a=e.edgeUpdaterType,c=e.isTarget,l=e.domNode,s=e.nodeLookup,f=e.lib,d=e.autoPanOnConnect,h=e.flowId,v=e.panBy,p=e.cancelConnection,g=e.onConnectStart,y=e.onConnect,m=e.onConnectEnd,x=e.isValidConnection,w=void 0===x?Dy:x,b=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),C=0,M=Hv(n),N=M.x,O=M.y,P=null==k?void 0:k.elementFromPoint(N,O),j=Ry(a,P),I=null==l?void 0:l.getBoundingClientRect();if(I&&j){var A=Hv(n,I),z=!1,L=null,D=!1,V=null,H=function(n){var e,t,r=n.nodeLookup,o=n.nodeId,i=n.handleId,u=n.handleType,a=[];try{for(var c=T(r),l=c.next();!l.done;l=c.next()){var s=B(l.value,2)[1];if(s.internals.handleBounds){var f="".concat(o,"-").concat(i,"-").concat(u),d=By(s,s.internals.handleBounds,"source",f),h=By(s,s.internals.handleBounds,"target",f);a.push.apply(a,R(R([],B(d),!1),B(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 a}({nodeLookup:s,nodeId:u,handleId:i,handleType:j});_({connectionPosition:A,connectionStatus:null,connectionStartHandle:Vy={nodeId:u,handleId:i,type:j},connectionEndHandle:null}),null==g||g(n,{nodeId:u,handleId:i,handleType:j}),k.addEventListener("mousemove",Z),k.addEventListener("mouseup",X),k.addEventListener("touchmove",Z),k.addEventListener("touchend",X)}function Y(){if(d&&I){var n=B(Nv(A,I),2),e=n[0],t=n[1];v({x:e,y:t}),C=requestAnimationFrame(Y)}}function Z(n){S()||X(n);var e=E();A=Hv(n,I),t=function(n,e,t){var r,o,i=[],u=1/0;try{for(var a=T(t),c=a.next();!c.done;c=a.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<u?i=[l]:s===u&&i.push(l),u=s)}}catch(n){r={error:n}}finally{try{c&&!c.done&&(o=a.return)&&o.call(a)}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}(Av(A,e,!1,[1,1]),o,H),z||(Y(),z=!0);var a,l,s,d=Hy(n,{handle:t,connectionMode:r,fromNodeId:u,fromHandleId:i,fromType:c?"target":"source",isValidConnection:w,doc:k,lib:f,flowId:h});V=d.handleDomNode,L=d.connection,D=d.isValid,_({connectionStartHandle:Vy,connectionPosition:t&&D?zv({x:t.x,y:t.y},e):A,connectionStatus:(a=!!t,l=D,s=null,l?s="valid":a&&!l&&(s="invalid"),s),connectionEndHandle:d.endHandle})}function X(n){(t||V)&&L&&D&&(null==y||y(L)),null==m||m(n),a&&(null==b||b(n)),p(),cancelAnimationFrame(C),z=!1,D=!1,L=null,V=null,Vy=null,k.removeEventListener("mousemove",Z),k.removeEventListener("mouseup",X),k.removeEventListener("touchmove",Z),k.removeEventListener("touchend",X)}},isValid:Hy};function Zy(n,e,t){n.prototype=e.prototype=t,t.constructor=n}function Xy(n,e){var t=Object.create(n.prototype);for(var r in e)t[r]=e[r];return t}function Uy(){}var Fy=.7,Wy=1/Fy,$y="\\s*([+-]?\\d+)\\s*",Gy="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",qy="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ky=/^#([0-9a-f]{3,8})$/,Qy=new RegExp(`^rgb\\(${$y},${$y},${$y}\\)$`),Jy=new RegExp(`^rgb\\(${qy},${qy},${qy}\\)$`),nm=new RegExp(`^rgba\\(${$y},${$y},${$y},${Gy}\\)$`),em=new RegExp(`^rgba\\(${qy},${qy},${qy},${Gy}\\)$`),tm=new RegExp(`^hsl\\(${Gy},${qy},${qy}\\)$`),rm=new RegExp(`^hsla\\(${Gy},${qy},${qy},${Gy}\\)$`),om={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 im(){return this.rgb().formatHex()}function um(){return this.rgb().formatRgb()}function am(n){var e,t;return n=(n+"").trim().toLowerCase(),(e=Ky.exec(n))?(t=e[1].length,e=parseInt(e[1],16),6===t?cm(e):3===t?new fm(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===t?lm(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===t?lm(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=Qy.exec(n))?new fm(e[1],e[2],e[3],1):(e=Jy.exec(n))?new fm(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=nm.exec(n))?lm(e[1],e[2],e[3],e[4]):(e=em.exec(n))?lm(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=tm.exec(n))?ym(e[1],e[2]/100,e[3]/100,1):(e=rm.exec(n))?ym(e[1],e[2]/100,e[3]/100,e[4]):om.hasOwnProperty(n)?cm(om[n]):"transparent"===n?new fm(NaN,NaN,NaN,0):null}function cm(n){return new fm(n>>16&255,n>>8&255,255&n,1)}function lm(n,e,t,r){return r<=0&&(n=e=t=NaN),new fm(n,e,t,r)}function sm(n,e,t,r){return 1===arguments.length?((o=n)instanceof Uy||(o=am(o)),o?new fm((o=o.rgb()).r,o.g,o.b,o.opacity):new fm):new fm(n,e,t,null==r?1:r);var o}function fm(n,e,t,r){this.r=+n,this.g=+e,this.b=+t,this.opacity=+r}function dm(){return`#${gm(this.r)}${gm(this.g)}${gm(this.b)}`}function hm(){const n=vm(this.opacity);return`${1===n?"rgb(":"rgba("}${pm(this.r)}, ${pm(this.g)}, ${pm(this.b)}${1===n?")":`, ${n})`}`}function vm(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function pm(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function gm(n){return((n=pm(n))<16?"0":"")+n.toString(16)}function ym(n,e,t,r){return r<=0?n=e=t=NaN:t<=0||t>=1?n=e=NaN:e<=0&&(n=NaN),new xm(n,e,t,r)}function mm(n){if(n instanceof xm)return new xm(n.h,n.s,n.l,n.opacity);if(n instanceof Uy||(n=am(n)),!n)return new xm;if(n instanceof xm)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),u=NaN,a=i-o,c=(i+o)/2;return a?(u=e===i?(t-r)/a+6*(t<r):t===i?(r-e)/a+2:(e-t)/a+4,a/=c<.5?i+o:2-i-o,u*=60):a=c>0&&c<1?0:u,new xm(u,a,c,n.opacity)}function xm(n,e,t,r){this.h=+n,this.s=+e,this.l=+t,this.opacity=+r}function wm(n){return(n=(n||0)%360)<0?n+360:n}function bm(n){return Math.max(0,Math.min(1,n||0))}function _m(n,e,t){return 255*(n<60?e+(t-e)*n/60:n<180?t:n<240?e+(t-e)*(240-n)/60:e)}Zy(Uy,am,{copy(n){return Object.assign(new this.constructor,this,n)},displayable(){return this.rgb().displayable()},hex:im,formatHex:im,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return mm(this).formatHsl()},formatRgb:um,toString:um}),Zy(fm,sm,Xy(Uy,{brighter(n){return n=null==n?Wy:Math.pow(Wy,n),new fm(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=null==n?Fy:Math.pow(Fy,n),new fm(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new fm(pm(this.r),pm(this.g),pm(this.b),vm(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:dm,formatHex:dm,formatHex8:function(){return`#${gm(this.r)}${gm(this.g)}${gm(this.b)}${gm(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:hm,toString:hm})),Zy(xm,(function(n,e,t,r){return 1===arguments.length?mm(n):new xm(n,e,t,null==r?1:r)}),Xy(Uy,{brighter(n){return n=null==n?Wy:Math.pow(Wy,n),new xm(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=null==n?Fy:Math.pow(Fy,n),new xm(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 fm(_m(n>=240?n-240:n+120,o,r),_m(n,o,r),_m(n<120?n+240:n-120,o,r),this.opacity)},clamp(){return new xm(wm(this.h),bm(this.s),bm(this.l),vm(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=vm(this.opacity);return`${1===n?"hsl(":"hsla("}${wm(this.h)}, ${100*bm(this.s)}%, ${100*bm(this.l)}%${1===n?")":`, ${n})`}`}}));var Em=n=>()=>n;function Sm(n,e){var t=e-n;return t?function(n,e){return function(t){return n+t*e}}(n,t):Em(isNaN(n)?e:n)}var km=function n(e){var t=function(n){return 1==(n=+n)?Sm: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):Em(isNaN(e)?t:e)}}(e);function r(n,e){var r=t((n=sm(n)).r,(e=sm(e)).r),o=t(n.g,e.g),i=t(n.b,e.b),u=Sm(n.opacity,e.opacity);return function(e){return n.r=r(e),n.g=o(e),n.b=i(e),n.opacity=u(e),n+""}}return r.gamma=n,r}(1);function Cm(n,e){return n=+n,e=+e,function(t){return n*(1-t)+e*t}}var Mm=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Nm=new RegExp(Mm.source,"g");function Om(n,e){var t,r,o,i=Mm.lastIndex=Nm.lastIndex=0,u=-1,a=[],c=[];for(n+="",e+="";(t=Mm.exec(n))&&(r=Nm.exec(e));)(o=r.index)>i&&(o=e.slice(i,o),a[u]?a[u]+=o:a[++u]=o),(t=t[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,c.push({i:u,x:Cm(t,r)})),i=Nm.lastIndex;return i<e.length&&(o=e.slice(i),a[u]?a[u]+=o:a[++u]=o),a.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)a[(t=c[r]).i]=t.x(n);return a.join("")})}var Pm,jm=180/Math.PI,Im={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Am(n,e,t,r,o,i){var u,a,c;return(u=Math.sqrt(n*n+e*e))&&(n/=u,e/=u),(c=n*t+e*r)&&(t-=n*c,r-=e*c),(a=Math.sqrt(t*t+r*r))&&(t/=a,r/=a,c/=a),n*r<e*t&&(n=-n,e=-e,c=-c,u=-u),{translateX:o,translateY:i,rotate:Math.atan2(e,n)*jm,skewX:Math.atan(c)*jm,scaleX:u,scaleY:a}}function zm(n,e,t,r){function o(n){return n.length?n.pop()+" ":""}return function(i,u){var a=[],c=[];return i=n(i),u=n(u),function(n,r,o,i,u,a){if(n!==o||r!==i){var c=u.push("translate(",null,e,null,t);a.push({i:c-4,x:Cm(n,o)},{i:c-2,x:Cm(r,i)})}else(o||i)&&u.push("translate("+o+e+i+t)}(i.translateX,i.translateY,u.translateX,u.translateY,a,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:Cm(n,e)})):e&&t.push(o(t)+"rotate("+e+r)}(i.rotate,u.rotate,a,c),function(n,e,t,i){n!==e?i.push({i:t.push(o(t)+"skewX(",null,r)-2,x:Cm(n,e)}):e&&t.push(o(t)+"skewX("+e+r)}(i.skewX,u.skewX,a,c),function(n,e,t,r,i,u){if(n!==t||e!==r){var a=i.push(o(i)+"scale(",null,",",null,")");u.push({i:a-4,x:Cm(n,t)},{i:a-2,x:Cm(e,r)})}else 1===t&&1===r||i.push(o(i)+"scale("+t+","+r+")")}(i.scaleX,i.scaleY,u.scaleX,u.scaleY,a,c),i=u=null,function(n){for(var e,t=-1,r=c.length;++t<r;)a[(e=c[t]).i]=e.x(n);return a.join("")}}}var Lm=zm((function(n){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(n+"");return e.isIdentity?Im:Am(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),Tm=zm((function(n){return null==n?Im:(Pm||(Pm=document.createElementNS("http://www.w3.org/2000/svg","g")),Pm.setAttribute("transform",n),(n=Pm.transform.baseVal.consolidate())?Am((n=n.matrix).a,n.b,n.c,n.d,n.e,n.f):Im)}),", ",")",")");function Bm(n){return((n=Math.exp(n))+1/n)/2}var Rm,Dm,Vm=function n(e,t,r){function o(n,o){var i,u,a=n[0],c=n[1],l=n[2],s=o[0],f=o[1],d=o[2],h=s-a,v=f-c,p=h*h+v*v;if(p<1e-12)u=Math.log(d/l)/e,i=function(n){return[a+n*h,c+n*v,l*Math.exp(e*n*u)]};else{var g=Math.sqrt(p),y=(d*d-l*l+r*p)/(2*l*t*g),m=(d*d-l*l-r*p)/(2*d*t*g),x=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(m*m+1)-m);u=(w-x)/e,i=function(n){var r,o=n*u,i=Bm(x),s=l/(t*g)*(i*(r=e*o+x,((r=Math.exp(2*r))-1)/(r+1))-function(n){return((n=Math.exp(n))-1/n)/2}(x));return[a+s*h,c+s*v,l*i/Bm(e*o+x)]}}return i.duration=1e3*u*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),Hm=0,Ym=0,Zm=0,Xm=0,Um=0,Fm=0,Wm="object"==typeof performance&&performance.now?performance:Date,$m="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function Gm(){return Um||($m(qm),Um=Wm.now()+Fm)}function qm(){Um=0}function Km(){this._call=this._time=this._next=null}function Qm(n,e,t){var r=new Km;return r.restart(n,e,t),r}function Jm(){Um=(Xm=Wm.now())+Fm,Hm=Ym=0;try{!function(){Gm(),++Hm;for(var n,e=Rm;e;)(n=Um-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Hm}()}finally{Hm=0,function(){for(var n,e,t=Rm,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:Rm=e);Dm=n,ex(r)}(),Um=0}}function nx(){var n=Wm.now(),e=n-Xm;e>1e3&&(Fm-=e,Xm=n)}function ex(n){Hm||(Ym&&(Ym=clearTimeout(Ym)),n-Um>24?(n<1/0&&(Ym=setTimeout(Jm,n-Wm.now()-Fm)),Zm&&(Zm=clearInterval(Zm))):(Zm||(Xm=Wm.now(),Zm=setInterval(nx,1e3)),Hm=1,$m(Jm)))}function tx(n,e,t){var r=new Km;return e=null==e?0:+e,r.restart((t=>{r.stop(),n(t+e)}),e,t),r}Km.prototype=Qm.prototype={constructor:Km,restart:function(n,e,t){if("function"!=typeof n)throw new TypeError("callback is not a function");t=(null==t?Gm():+t)+(null==e?0:+e),this._next||Dm===this||(Dm?Dm._next=this:Rm=this,Dm=this),this._call=n,this._time=t,ex()},stop:function(){this._call&&(this._call=null,this._time=1/0,ex())}};var rx=og("start","end","cancel","interrupt"),ox=[];function ix(n,e,t,r,o,i){var u=n.__transition;if(u){if(t in u)return}else n.__transition={};!function(n,e,t){var r,o=n.__transition;function i(c){var l,s,f,d;if(1!==t.state)return a();for(l in o)if((d=o[l]).name===t.name){if(3===d.state)return tx(i);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",n,n.__data__,d.index,d.group),delete o[l]):+l<e&&(d.state=6,d.timer.stop(),d.on.call("cancel",n,n.__data__,d.index,d.group),delete o[l])}if(tx((function(){3===t.state&&(t.state=4,t.timer.restart(u,t.delay,t.time),u(c))})),t.state=2,t.on.call("start",n,n.__data__,t.index,t.group),2===t.state){for(t.state=3,r=new Array(f=t.tween.length),l=0,s=-1;l<f;++l)(d=t.tween[l].value.call(n,n.__data__,t.index,t.group))&&(r[++s]=d);r.length=s+1}}function u(e){for(var o=e<t.duration?t.ease.call(null,e/t.duration):(t.timer.restart(a),t.state=5,1),i=-1,u=r.length;++i<u;)r[i].call(n,o);5===t.state&&(t.on.call("end",n,n.__data__,t.index,t.group),a())}function a(){for(var r in t.state=6,t.timer.stop(),delete o[e],o)return;delete n.__transition}o[e]=t,t.timer=Qm((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:rx,tween:ox,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function ux(n,e){var t=cx(n,e);if(t.state>0)throw new Error("too late; already scheduled");return t}function ax(n,e){var t=cx(n,e);if(t.state>3)throw new Error("too late; already running");return t}function cx(n,e){var t=n.__transition;if(!t||!(t=t[e]))throw new Error("transition not found");return t}function lx(n,e){var t,r,o,i=n.__transition,u=!0;if(i){for(o in e=null==e?null:e+"",i)(t=i[o]).name===e?(r=t.state>2&&t.state<5,t.state=6,t.timer.stop(),t.on.call(r?"interrupt":"cancel",n,n.__data__,t.index,t.group),delete i[o]):u=!1;u&&delete n.__transition}}function sx(n,e){var t,r;return function(){var o=ax(this,n),i=o.tween;if(i!==t)for(var u=0,a=(r=t=i).length;u<a;++u)if(r[u].name===e){(r=r.slice()).splice(u,1);break}o.tween=r}}function fx(n,e,t){var r,o;if("function"!=typeof t)throw new Error;return function(){var i=ax(this,n),u=i.tween;if(u!==r){o=(r=u).slice();for(var a={name:e,value:t},c=0,l=o.length;c<l;++c)if(o[c].name===e){o[c]=a;break}c===l&&o.push(a)}i.tween=o}}function dx(n,e,t){var r=n._id;return n.each((function(){var n=ax(this,r);(n.value||(n.value={}))[e]=t.apply(this,arguments)})),function(n){return cx(n,r).value[e]}}function hx(n,e){var t;return("number"==typeof e?Cm:e instanceof am?km:(t=am(e))?(e=t,km):Om)(n,e)}function vx(n){return function(){this.removeAttribute(n)}}function px(n){return function(){this.removeAttributeNS(n.space,n.local)}}function gx(n,e,t){var r,o,i=t+"";return function(){var u=this.getAttribute(n);return u===i?null:u===r?o:o=e(r=u,t)}}function yx(n,e,t){var r,o,i=t+"";return function(){var u=this.getAttributeNS(n.space,n.local);return u===i?null:u===r?o:o=e(r=u,t)}}function mx(n,e,t){var r,o,i;return function(){var u,a,c=t(this);if(null!=c)return(u=this.getAttribute(n))===(a=c+"")?null:u===r&&a===o?i:(o=a,i=e(r=u,c));this.removeAttribute(n)}}function xx(n,e,t){var r,o,i;return function(){var u,a,c=t(this);if(null!=c)return(u=this.getAttributeNS(n.space,n.local))===(a=c+"")?null:u===r&&a===o?i:(o=a,i=e(r=u,c));this.removeAttributeNS(n.space,n.local)}}function wx(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 bx(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 _x(n,e){return function(){ux(this,n).delay=+e.apply(this,arguments)}}function Ex(n,e){return e=+e,function(){ux(this,n).delay=e}}function Sx(n,e){return function(){ax(this,n).duration=+e.apply(this,arguments)}}function kx(n,e){return e=+e,function(){ax(this,n).duration=e}}var Cx=my.prototype.constructor;function Mx(n){return function(){this.style.removeProperty(n)}}var Nx=0;function Ox(n,e,t,r){this._groups=n,this._parents=e,this._name=t,this._id=r}function Px(){return++Nx}var jx=my.prototype;Ox.prototype={constructor:Ox,select:function(n){var e=this._name,t=this._id;"function"!=typeof n&&(n=pg(n));for(var r=this._groups,o=r.length,i=new Array(o),u=0;u<o;++u)for(var a,c,l=r[u],s=l.length,f=i[u]=new Array(s),d=0;d<s;++d)(a=l[d])&&(c=n.call(a,a.__data__,d,l))&&("__data__"in a&&(c.__data__=a.__data__),f[d]=c,ix(f[d],e,t,d,f,cx(a,t)));return new Ox(i,this._parents,e,t)},selectAll:function(n){var e=this._name,t=this._id;"function"!=typeof n&&(n=yg(n));for(var r=this._groups,o=r.length,i=[],u=[],a=0;a<o;++a)for(var c,l=r[a],s=l.length,f=0;f<s;++f)if(c=l[f]){for(var d,h=n.call(c,c.__data__,f,l),v=cx(c,t),p=0,g=h.length;p<g;++p)(d=h[p])&&ix(d,e,t,p,h,v);i.push(h),u.push(c)}return new Ox(i,u,e,t)},selectChild:jx.selectChild,selectChildren:jx.selectChildren,filter:function(n){"function"!=typeof n&&(n=mg(n));for(var e=this._groups,t=e.length,r=new Array(t),o=0;o<t;++o)for(var i,u=e[o],a=u.length,c=r[o]=[],l=0;l<a;++l)(i=u[l])&&n.call(i,i.__data__,l,u)&&c.push(i);return new Ox(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),u=new Array(r),a=0;a<i;++a)for(var c,l=e[a],s=t[a],f=l.length,d=u[a]=new Array(f),h=0;h<f;++h)(c=l[h]||s[h])&&(d[h]=c);for(;a<r;++a)u[a]=e[a];return new Ox(u,this._parents,this._name,this._id)},selection:function(){return new Cx(this._groups,this._parents)},transition:function(){for(var n=this._name,e=this._id,t=Px(),r=this._groups,o=r.length,i=0;i<o;++i)for(var u,a=r[i],c=a.length,l=0;l<c;++l)if(u=a[l]){var s=cx(u,e);ix(u,n,t,l,a,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new Ox(r,this._parents,n,t)},call:jx.call,nodes:jx.nodes,node:jx.node,size:jx.size,empty:jx.empty,each:jx.each,on:function(n,e){var t=this._id;return arguments.length<2?cx(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)?ux:ax;return function(){var u=i(this,n),a=u.on;a!==r&&(o=(r=a).copy()).on(e,t),u.on=o}}(t,n,e))},attr:function(n,e){var t=sg(n),r="transform"===t?Tm:hx;return this.attrTween(n,"function"==typeof e?(t.local?xx:mx)(t,r,dx(this,"attr."+n,e)):null==e?(t.local?px:vx)(t):(t.local?yx:gx)(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=sg(n);return this.tween(t,(r.local?wx:bx)(r,e))},style:function(n,e,t){var r="transform"==(n+="")?Lm:hx;return null==e?this.styleTween(n,function(n,e){var t,r,o;return function(){var i=Hg(this,n),u=(this.style.removeProperty(n),Hg(this,n));return i===u?null:i===t&&u===r?o:o=e(t=i,r=u)}}(n,r)).on("end.style."+n,Mx(n)):"function"==typeof e?this.styleTween(n,function(n,e,t){var r,o,i;return function(){var u=Hg(this,n),a=t(this),c=a+"";return null==a&&(this.style.removeProperty(n),c=a=Hg(this,n)),u===c?null:u===r&&c===o?i:(o=c,i=e(r=u,a))}}(n,r,dx(this,"style."+n,e))).each(function(n,e){var t,r,o,i,u="style."+e,a="end."+u;return function(){var c=ax(this,n),l=c.on,s=null==c.value[u]?i||(i=Mx(e)):void 0;l===t&&o===s||(r=(t=l).copy()).on(a,o=s),c.on=r}}(this._id,n)):this.styleTween(n,function(n,e,t){var r,o,i=t+"";return function(){var u=Hg(this,n);return u===i?null:u===r?o:o=e(r=u,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}}(dx(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=cx(this.node(),t).tween,i=0,u=o.length;i<u;++i)if((r=o[i]).name===n)return r.value;return null}return this.each((null==e?sx:fx)(t,n,e))},delay:function(n){var e=this._id;return arguments.length?this.each(("function"==typeof n?_x:Ex)(e,n)):cx(this.node(),e).delay},duration:function(n){var e=this._id;return arguments.length?this.each(("function"==typeof n?Sx:kx)(e,n)):cx(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(){ax(this,n).ease=e}}(e,n)):cx(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;ax(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,u){var a={value:u},c={value:function(){0==--o&&i()}};t.each((function(){var t=ax(this,r),o=t.on;o!==n&&((e=(n=o).copy())._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),t.on=e})),0===o&&i()}))},[Symbol.iterator]:jx[Symbol.iterator]};var Ix={time:null,delay:0,duration:250,ease:function(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}};function Ax(n,e){for(var t;!(t=n.__transition)||!(t=t[e]);)if(!(n=n.parentNode))throw new Error(`transition ${e} not found`);return t}my.prototype.interrupt=function(n){return this.each((function(){lx(this,n)}))},my.prototype.transition=function(n){var e,t;n instanceof Ox?(e=n._id,n=n._name):(e=Px(),(t=Ix).time=Gm(),n=null==n?null:n+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var u,a=r[i],c=a.length,l=0;l<c;++l)(u=a[l])&&ix(u,n,e,l,a,t||Ax(u,e));return new Ox(r,this._parents,n,e)};var zx=n=>()=>n;function Lx(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 Tx(n,e,t){this.k=n,this.x=e,this.y=t}Tx.prototype={constructor:Tx,scale:function(n){return 1===n?this:new Tx(this.k*n,this.x,this.y)},translate:function(n,e){return 0===n&0===e?this:new Tx(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 Bx=new Tx(1,0,0);function Rx(n){for(;!n.__zoom;)if(!(n=n.parentNode))return Bx;return n.__zoom}function Dx(n){n.stopImmediatePropagation()}function Vx(n){n.preventDefault(),n.stopImmediatePropagation()}function Hx(n){return!(n.ctrlKey&&"wheel"!==n.type||n.button)}function Yx(){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 Zx(){return this.__zoom||Bx}function Xx(n){return-n.deltaY*(1===n.deltaMode?.05:n.deltaMode?1:.002)*(n.ctrlKey?10:1)}function Ux(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fx(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],u=n.invertY(e[1][1])-t[1][1];return n.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),u>i?(i+u)/2:Math.min(0,i)||Math.max(0,u))}Rx.prototype=Tx.prototype;var Wx,$x=function(n){return{x:n.x,y:n.y,zoom:n.k}},Gx=function(n){var e=n.x,t=n.y,r=n.zoom;return Bx.translate(e,t).scale(r)},qx=function(n,e){return n.target.closest(".".concat(e))},Kx=function(n,e){return 2===e&&Array.isArray(n)&&n.includes(2)},Qx=function(n,e){return void 0===e&&(e=0),"number"==typeof e&&e>0?n.transition().duration(e):n},Jx=function(n){var e=n.ctrlKey&&Tv()?10:1;return-n.deltaY*(1===n.deltaMode?.05:n.deltaMode?1:.002)*e};function nw(n){var e=n.domNode,t=n.minZoom,r=n.maxZoom,o=n.translateExtent,i=n.viewport,u=n.onPanZoom,a=n.onPanZoomStart,c=n.onPanZoomEnd,l=n.onTransformChange,s=n.onDraggingChange,f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),h=function(){var n,e,t,r=Hx,o=Yx,i=Fx,u=Xx,a=Ux,c=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,f=Vm,d=og("start","zoom","end"),h=0,v=10;function p(n){n.property("__zoom",Zx).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",S).filter(a).on("touchstart.zoom",k).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(n,e){return(e=Math.max(c[0],Math.min(c[1],e)))===n.k?n:new Tx(e,n.x,n.y)}function y(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 Tx(n.k,r,o)}function m(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(){w(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){w(this,arguments).event(r).end()})).tween("zoom",(function(){var n=this,i=arguments,u=w(n,i).event(r),a=o.apply(n,i),c=null==t?m(a):"function"==typeof t?t.apply(n,i):t,l=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),s=n.__zoom,d="function"==typeof e?e.apply(n,i):e,h=f(s.invert(c).concat(l/s.k),d.invert(c).concat(l/d.k));return function(n){if(1===n)n=d;else{var e=h(n),t=l/e[2];n=new Tx(t,c[0]-e[0]*t,c[1]-e[1]*t)}u.zoom(null,n)}}))}function w(n,e,t){return!t&&n.__zooming||new b(n,e)}function b(n,e){this.that=n,this.args=e,this.active=0,this.sourceEvent=null,this.extent=o.apply(n,e),this.taps=0}function _(n,...e){if(r.apply(this,arguments)){var t=w(this,e).event(n),o=this.__zoom,a=Math.max(c[0],Math.min(c[1],o.k*Math.pow(2,u.apply(this,arguments)))),s=wy(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===a)return;t.mouse=[s,o.invert(s)],lx(this),t.start()}Vx(n),t.wheel=setTimeout((function(){t.wheel=null,t.end()}),150),t.zoom("mouse",i(y(g(o,a),t.mouse[0],t.mouse[1]),t.extent,l))}}function E(n,...e){if(!t&&r.apply(this,arguments)){var o=n.currentTarget,u=w(this,e,!0).event(n),a=xy(n.view).on("mousemove.zoom",(function(n){if(Vx(n),!u.moved){var e=n.clientX-s,t=n.clientY-f;u.moved=e*e+t*t>h}u.event(n).zoom("mouse",i(y(u.that.__zoom,u.mouse[0]=wy(n,o),u.mouse[1]),u.extent,l))}),!0).on("mouseup.zoom",(function(n){a.on("mousemove.zoom mouseup.zoom",null),Cy(n.view,u.moved),Vx(n),u.event(n).end()}),!0),c=wy(n,o),s=n.clientX,f=n.clientY;ky(n.view),Dx(n),u.mouse=[c,this.__zoom.invert(c)],lx(this),u.start()}}function S(n,...e){if(r.apply(this,arguments)){var t=this.__zoom,u=wy(n.changedTouches?n.changedTouches[0]:n,this),a=t.invert(u),c=t.k*(n.shiftKey?.5:2),f=i(y(g(t,c),u,a),o.apply(this,e),l);Vx(n),s>0?xy(this).transition().duration(s).call(x,f,u,n):xy(this).call(p.transform,f,u,n)}}function k(t,...o){if(r.apply(this,arguments)){var i,u,a,c,l=t.touches,s=l.length,f=w(this,o,t.changedTouches.length===s).event(t);for(Dx(t),u=0;u<s;++u)c=[c=wy(a=l[u],this),this.__zoom.invert(c),a.identifier],f.touch0?f.touch1||f.touch0[2]===c[2]||(f.touch1=c,f.taps=0):(f.touch0=c,i=!0,f.taps=1+!!n);n&&(n=clearTimeout(n)),i&&(f.taps<2&&(e=c[0],n=setTimeout((function(){n=null}),500)),lx(this),f.start())}}function C(n,...e){if(this.__zooming){var t,r,o,u,a=w(this,e).event(n),c=n.changedTouches,s=c.length;for(Vx(n),t=0;t<s;++t)o=wy(r=c[t],this),a.touch0&&a.touch0[2]===r.identifier?a.touch0[0]=o:a.touch1&&a.touch1[2]===r.identifier&&(a.touch1[0]=o);if(r=a.that.__zoom,a.touch1){var f=a.touch0[0],d=a.touch0[1],h=a.touch1[0],v=a.touch1[1],p=(p=h[0]-f[0])*p+(p=h[1]-f[1])*p,m=(m=v[0]-d[0])*m+(m=v[1]-d[1])*m;r=g(r,Math.sqrt(p/m)),o=[(f[0]+h[0])/2,(f[1]+h[1])/2],u=[(d[0]+v[0])/2,(d[1]+v[1])/2]}else{if(!a.touch0)return;o=a.touch0[0],u=a.touch0[1]}a.zoom("touch",i(y(r,o,u),a.extent,l))}}function M(n,...r){if(this.__zooming){var o,i,u=w(this,r).event(n),a=n.changedTouches,c=a.length;for(Dx(n),t&&clearTimeout(t),t=setTimeout((function(){t=null}),500),o=0;o<c;++o)i=a[o],u.touch0&&u.touch0[2]===i.identifier?delete u.touch0:u.touch1&&u.touch1[2]===i.identifier&&delete u.touch1;if(u.touch1&&!u.touch0&&(u.touch0=u.touch1,delete u.touch1),u.touch0)u.touch0[1]=this.__zoom.invert(u.touch0[0]);else if(u.end(),2===u.taps&&(i=wy(i,this),Math.hypot(e[0]-i[0],e[1]-i[1])<v)){var l=xy(this).on("dblclick.zoom");l&&l.apply(this,arguments)}}}return p.transform=function(n,e,t,r){var o=n.selection?n.selection():n;o.property("__zoom",Zx),n!==o?x(n,e,t,r):o.interrupt().each((function(){w(this,arguments).event(r).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()}))},p.scaleBy=function(n,e,t,r){p.scaleTo(n,(function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)}),t,r)},p.scaleTo=function(n,e,t,r){p.transform(n,(function(){var n=o.apply(this,arguments),r=this.__zoom,u=null==t?m(n):"function"==typeof t?t.apply(this,arguments):t,a=r.invert(u),c="function"==typeof e?e.apply(this,arguments):e;return i(y(g(r,c),u,a),n,l)}),t,r)},p.translateBy=function(n,e,t,r){p.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)},p.translateTo=function(n,e,t,r,u){p.transform(n,(function(){var n=o.apply(this,arguments),u=this.__zoom,a=null==r?m(n):"function"==typeof r?r.apply(this,arguments):r;return i(Bx.translate(a[0],a[1]).scale(u.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof t?-t.apply(this,arguments):-t),n,l)}),r,u)},b.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=xy(this.that).datum();d.call(n,this.that,new Lx(n,{sourceEvent:this.sourceEvent,target:p,type:n,transform:this.that.__zoom,dispatch:d}),e)}},p.wheelDelta=function(n){return arguments.length?(u="function"==typeof n?n:zx(+n),p):u},p.filter=function(n){return arguments.length?(r="function"==typeof n?n:zx(!!n),p):r},p.touchable=function(n){return arguments.length?(a="function"==typeof n?n:zx(!!n),p):a},p.extent=function(n){return arguments.length?(o="function"==typeof n?n:zx([[+n[0][0],+n[0][1]],[+n[1][0],+n[1][1]]]),p):o},p.scaleExtent=function(n){return arguments.length?(c[0]=+n[0],c[1]=+n[1],p):[c[0],c[1]]},p.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],p):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},p.constrain=function(n){return arguments.length?(i=n,p):i},p.duration=function(n){return arguments.length?(s=+n,p):s},p.interpolate=function(n){return arguments.length?(f=n,p):f},p.on=function(){var n=d.on.apply(d,arguments);return n===d?p:n},p.clickDistance=function(n){return arguments.length?(h=(n=+n)*n,p):Math.sqrt(h)},p.tapDistance=function(n){return arguments.length?(v=+n,p):v},p}().scaleExtent([t,r]).translateExtent(o),v=xy(e).call(h);x({x:i.x,y:i.y,zoom:kv(i.zoom,t,r)},[[0,0],[d.width,d.height]],o);var p=v.on("wheel.zoom"),g=v.on("dblclick.zoom");function y(n,e){v&&(null==h||h.transform(Qx(v,null==e?void 0:e.duration),n))}function m(){h.on("zoom",null)}function x(n,e,t){var r=Gx(n),o=null==h?void 0:h.constrain()(r,e,t);return o&&y(o),o}return h.wheelDelta(Jx),{update:function(n){var e=n.noWheelClassName,t=n.noPanClassName,r=n.onPaneContextMenu,o=n.userSelectionActive,i=n.panOnScroll,d=n.panOnDrag,y=n.panOnScrollMode,x=n.panOnScrollSpeed,w=n.preventScrolling,b=n.zoomOnPinch,_=n.zoomOnScroll,E=n.zoomOnDoubleClick,S=n.zoomActivationKeyPressed,k=n.lib;o&&!f.isZoomingOrPanning&&m();var C=!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||qx(n,e))return null;n.preventDefault(),r.call(this,n,o)}}({noWheelClassName:e,preventScrolling:w,d3ZoomHandler:p}):function(n){var e=n.zoomPanValues,t=n.noWheelClassName,r=n.d3Selection,o=n.d3Zoom,i=n.panOnScrollMode,u=n.panOnScrollSpeed,a=n.zoomOnPinch,c=n.onPanZoomStart,l=n.onPanZoom,s=n.onPanZoomEnd;return function(n){if(qx(n,t))return!1;n.preventDefault(),n.stopImmediatePropagation();var f=r.property("__zoom").k||1;if(n.ctrlKey&&a){var d=wy(n),h=Jx(n),v=f*Math.pow(2,h);o.scaleTo(r,v,d,n)}else{var p=1===n.deltaMode?20:1,g=i===exports.PanOnScrollMode.Vertical?0:n.deltaX*p,y=i===exports.PanOnScrollMode.Horizontal?0:n.deltaY*p;!Tv()&&n.shiftKey&&i!==exports.PanOnScrollMode.Vertical&&(g=n.deltaY*p,y=0),o.translateBy(r,-g/f*u,-y/f*u,{internal:!0});var m=$x(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:f,noWheelClassName:e,d3Selection:v,d3Zoom:h,panOnScrollMode:y,panOnScrollSpeed:x,zoomOnPinch:b,onPanZoomStart:a,onPanZoom:u,onPanZoomEnd:c});if(v.on("wheel.zoom",C,{passive:!1}),!o){var M=function(n){var e=n.zoomPanValues,t=n.onDraggingChange,r=n.onPanZoomStart;return function(n){var o,i,u;if(!(null===(o=n.sourceEvent)||void 0===o?void 0:o.internal)){var a=$x(n.transform);e.mouseButton=(null===(i=n.sourceEvent)||void 0===i?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=a,"mousedown"===(null===(u=n.sourceEvent)||void 0===u?void 0:u.type)&&t(!0),r&&(null==r||r(n.sourceEvent,a))}}}({zoomPanValues:f,onDraggingChange:s,onPanZoomStart:a});h.on("start",M);var N=function(n){var e=n.zoomPanValues,t=n.panOnDrag,r=n.onPaneContextMenu,o=n.onTransformChange,i=n.onPanZoom;return function(n){var u,a,c;e.usedRightMouseButton=!(!r||!Kx(t,null!==(u=e.mouseButton)&&void 0!==u?u:0)),(null===(a=n.sourceEvent)||void 0===a?void 0:a.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,$x(n.transform)))}}({zoomPanValues:f,panOnDrag:d,onPaneContextMenu:!!r,onPanZoom:u,onTransformChange:l});h.on("zoom",N);var O=function(n){var e=n.zoomPanValues,t=n.panOnDrag,r=n.panOnScroll,o=n.onDraggingChange,i=n.onPanZoomEnd,u=n.onPaneContextMenu;return function(n){var a,c,l,s;if(!(null===(a=n.sourceEvent)||void 0===a?void 0:a.internal)&&(e.isZoomingOrPanning=!1,u&&Kx(t,null!==(c=e.mouseButton)&&void 0!==c?c:0)&&!e.usedRightMouseButton&&n.sourceEvent&&u(n.sourceEvent),e.usedRightMouseButton=!1,o(!1),i&&(l=e.prevViewport,s=n.transform,l.x!==s.x||l.y!==s.y||l.zoom!==s.k))){var f=$x(n.transform);e.prevViewport=f,clearTimeout(e.timerId),e.timerId=setTimeout((function(){null==i||i(n.sourceEvent,f)}),r?150:0)}}}({zoomPanValues:f,panOnDrag:d,panOnScroll:i,onPaneContextMenu:r,onPanZoomEnd:c,onDraggingChange:s});h.on("end",O)}var P=function(n){var e=n.zoomActivationKeyPressed,t=n.zoomOnScroll,r=n.zoomOnPinch,o=n.panOnDrag,i=n.panOnScroll,u=n.zoomOnDoubleClick,a=n.userSelectionActive,c=n.noWheelClassName,l=n.noPanClassName,s=n.lib;return function(n){var f=e||t,d=r&&n.ctrlKey;if(1===n.button&&"mousedown"===n.type&&(qx(n,"".concat(s,"-flow__node"))||qx(n,"".concat(s,"-flow__edge"))))return!0;if(!(o||f||i||u||r))return!1;if(a)return!1;if(qx(n,c)&&"wheel"===n.type)return!1;if(qx(n,l)&&("wheel"!==n.type||i&&"wheel"===n.type&&!e))return!1;if(!r&&n.ctrlKey&&"wheel"===n.type)return!1;if(!f&&!i&&!d&&"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:d,zoomOnScroll:_,panOnScroll:i,zoomOnDoubleClick:E,zoomOnPinch:b,userSelectionActive:o,noPanClassName:t,noWheelClassName:e,lib:k});h.filter(P),E?v.on("dblclick.zoom",g):v.on("dblclick.zoom",null)},destroy:m,setViewport:function(n,e){var t=Gx(n);return y(t,e),t},setViewportConstrained:x,getViewport:function(){var n=v?Rx(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(Qx(v,null==e?void 0:e.duration),n))},scaleBy:function(n,e){v&&(null==h||h.scaleBy(Qx(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=Gx(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"}(Wx||(Wx={}));L(L({},{width:0,height:0,x:0,y:0}),{pointerX:0,pointerY:0,aspectRatio:1});var ew=cv();function tw(e,t){var r=n.useContext(A);if(null===r)throw new Error(ew);return j(r,e,t)}function rw(){var e=n.useContext(A);if(null===e)throw new Error(ew);return n.useMemo((function(){return{getState:e.getState,setState:e.setState,subscribe:e.subscribe}}),[e])}function ow(n,e){var r,o,i;void 0===e&&(e={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{}});var c=(null==e?void 0:e.elevateNodesOnSelect)?1e3:0;try{for(var l=u(n),s=l.next();!s.done;s=l.next()){var f=a(s.value,2)[1],d=f.parentId;if(d){if(!n.has(d))throw new Error("Parent node ".concat(d," not found"));var h=n.get(d),v=iw(f,n,t(t({},f.position),{z:(hw(f.zIndex)?f.zIndex:0)+(f.selected?c:0)}),null!==(i=null==h?void 0:h.origin)&&void 0!==i?i:e.nodeOrigin),p=v.x,g=v.y,y=v.z,m=f.internals.positionAbsolute,x=p!==m.x||g!==m.y;(x||y!==f.internals.z)&&(f.internals=t(t({},f.internals),{positionAbsolute:x?{x:p,y:g}:m,z:y}))}}}catch(n){r={error:n}}finally{try{s&&!s.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}}function iw(n,e,t,r){var o,i,u,a,c,l;if(void 0===r&&(r=[0,0]),!n.parentId)return t;var s=e.get(n.parentId),f=uw(s,r).position;return iw(s,e,{x:(null!==(o=t.x)&&void 0!==o?o:0)+f.x,y:(null!==(i=t.y)&&void 0!==i?i:0)+f.y,z:(null!==(u=s.internals.z)&&void 0!==u?u:0)>(null!==(a=t.z)&&void 0!==a?a:0)?null!==(c=s.internals.z)&&void 0!==c?c:0:null!==(l=t.z)&&void 0!==l?l:0},s.origin||r)}var uw=function(n,e){void 0===e&&(e=[0,0]);var t=dw(n),r=t.width,o=t.height,i=("internals"in n?n.internals.positionAbsolute:n.position)||{x:0,y:0},u=n.origin||e,a=r*u[0],c=o*u[1];return{position:{x:n.position.x-a,y:n.position.y-c},positionAbsolute:{x:i.x-a,y:i.y-c}}};function aw(n,e,t){var r,o;n.clear(),e.clear();try{for(var i=u(t),a=i.next();!a.done;a=i.next()){var c=a.value,l=c.source,s=c.target,f=c.sourceHandle,d=void 0===f?null:f,h=c.targetHandle,v=void 0===h?null:h,p="".concat(l,"-source-").concat(d),g="".concat(s,"-target-").concat(v),y=n.get(p)||new Map,m=n.get(g)||new Map,x={edgeId:c.id,source:l,target:s,sourceHandle:d,targetHandle:v};e.set(c.id,c),n.set(p,y.set("".concat(s,"-").concat(v),x)),n.set(g,m.set("".concat(l,"-").concat(d),x))}}catch(n){r={error:n}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}function cw(n,e,r,o){void 0===o&&(o={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{},checkEquality:!0});var i=new Map(e);e.clear(),r.clear();var u=(null==o?void 0:o.elevateNodesOnSelect)?1e3:0;n.forEach((function(n){var a,c,l,s,f=i.get(n.id);if(o.checkEquality&&n===(null==f?void 0:f.internals.userNode)||(f=t(t(t({},o.defaults),n),{measured:{width:null!==(c=null===(a=n.measured)||void 0===a?void 0:a.width)&&void 0!==c?c:0,height:null!==(s=null===(l=n.measured)||void 0===l?void 0:l.height)&&void 0!==s?s:0},internals:{positionAbsolute:n.position||{x:0,y:0},handleBounds:null==f?void 0:f.internals.handleBounds,z:(hw(n.zIndex)?n.zIndex:0)+(n.selected?u:0),userNode:n}})),e.set(n.id,f),n.parentId){var d=r.get(n.parentId);d?d.push(f):r.set(n.parentId,[f])}})),r.size>0&&ow(e,o)}function lw(n,e,t,r){var o,i,a,c,l,s=[],f=new Map;try{for(var d=u(n),h=d.next();!h.done;h=d.next()){var v=h.value,p=e.get(v.parentId);if(p){var g=null!==(c=null===(a=f.get(v.parentId))||void 0===a?void 0:a.expandedRect)&&void 0!==c?c:gw(p,null!==(l=p.origin)&&void 0!==l?l:r),y=ww(g,v.rect);f.set(v.parentId,{expandedRect:y,parent:p})}}}catch(n){o={error:n}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}return f.size>0&&f.forEach((function(e,r){var o=e.expandedRect,i=e.parent,u=uw(i,i.origin).position,a=dw(i),c=o.x<u.x?Math.round(Math.abs(u.x-o.x)):0,l=o.y<u.y?Math.round(Math.abs(u.y-o.y)):0;if(c>0||l>0){s.push({id:r,type:"position",position:{x:u.x-c,y:u.y-l}});var f=t.get(r);null==f||f.forEach((function(e){n.some((function(n){return n.id===e.id}))||s.push({id:e.id,type:"position",position:{x:e.position.x+c,y:e.position.y+l}})}))}(a.width<o.width||a.height<o.height)&&s.push({id:r,type:"dimensions",setAttributes:!0,dimensions:{width:Math.max(a.width,Math.round(o.width)),height:Math.max(a.height,Math.round(o.height))}})})),s}var sw=function(n,e,t){return void 0===e&&(e=0),void 0===t&&(t=1),Math.min(Math.max(n,e),t)},fw=function(n,e){return void 0===n&&(n={x:0,y:0}),{x:sw(n.x,e[0][0],e[1][0]),y:sw(n.y,e[0][1],e[1][1])}};function dw(n){var e,t,r,o,i,u,a,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!==(a=null!==(u=null===(i=n.measured)||void 0===i?void 0:i.height)&&void 0!==u?u:n.height)&&void 0!==a?a:n.initialHeight)&&void 0!==c?c:0}}var hw=function(n){return!isNaN(n)&&isFinite(n)},vw=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])}},pw=function(n,e,t,r){var o=n.x,i=n.y,u=a(e,3),c=u[0],l=u[1],s=u[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var f={x:(o-c)/s,y:(i-l)/s};return t?vw(f,r):f},gw=function(n,e){var t,r,o,i,u,a;void 0===e&&(e=[0,0]);var c=uw(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!==(a=null!==(u=null===(i=n.measured)||void 0===i?void 0:i.height)&&void 0!==u?u:n.height)&&void 0!==a?a:0}},yw=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)}},mw=function(n){var e=n.x,t=n.y;return{x:e,y:t,x2:e+n.width,y2:t+n.height}},xw=function(n){var e=n.x,t=n.y;return{x:e,y:t,width:n.x2-e,height:n.y2-t}},ww=function(n,e){return xw(yw(mw(n),mw(e)))};function bw(e){return n.forwardRef(e)}var _w=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)},Ew=function(n,e,t,r,o,i){var u=e/(n.width*(1+i)),a=t/(n.height*(1+i)),c=Math.min(u,a),l=sw(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 Sw(n){return void 0!==n&&"parent"!==n}var kw=function(n){return Cw(n)},Cw=function(n){return"id"in n&&"position"in n&&!("source"in n)&&!("target"in n)};var Mw=function(n){return hw(n.width)&&hw(n.height)&&hw(n.x)&&hw(n.y)},Nw=function(n){return{width:n.offsetWidth,height:n.offsetHeight}},Ow=["INPUT","SELECT","TEXTAREA"];function Pw(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 Ow.includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}var jw=function(n){return"clientX"in n},Iw=function(n,e){var t,r,o,i,u=jw(n),a=u?n.clientX:null===(t=n.touches)||void 0===t?void 0:t[0].clientX,c=u?n.clientY:null===(r=n.touches)||void 0===r?void 0:r[0].clientY;return{x:a-(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)}},Aw=function(n,e,r,o){void 0===o&&(o=[0,0]);var i=e.querySelectorAll(n);if(!i||!i.length)return null;var u=Array.from(i),a=e.getBoundingClientRect(),c=a.width*o[0],l=a.height*o[1];return u.map((function(n){var e=n.getBoundingClientRect();return t({id:n.getAttribute("data-handleid"),position:n.getAttribute("data-handlepos"),x:(e.left-a.left-c)/r,y:(e.top-a.top-l)/r},Nw(n))}))},zw="undefined"!=typeof document?document:null;function Lw(e,t){void 0===e&&(e=null),void 0===t&&(t={target:zw,actInsideInputWithModifier:!0});var r=a(n.useState(!1),2),o=r[0],i=r[1],u=n.useRef(!1),l=n.useRef(new Set([])),s=a(n.useMemo((function(){if(null!==e){var n=(Array.isArray(e)?e:[e]).filter((function(n){return"string"==typeof n})).map((function(n){return n.split("+")})),t=n.reduce((function(n,e){return n.concat.apply(n,c([],a(e),!1))}),[]);return[n,t]}return[[],[]]}),[e]),2),f=s[0],d=s[1];return n.useEffect((function(){var n=(null==t?void 0:t.target)||zw;if(null!==e){var r=function(n){if(u.current=n.ctrlKey||n.metaKey||n.shiftKey,(!u.current||u.current&&!t.actInsideInputWithModifier)&&Pw(n))return!1;var e=Bw(n.code,d);l.current.add(n[e]),Tw(f,l.current,!1)&&(n.preventDefault(),i(!0))},o=function(n){if((!u.current||u.current&&!t.actInsideInputWithModifier)&&Pw(n))return!1;var e=Bw(n.code,d);Tw(f,l.current,!0)?(i(!1),l.current.clear()):l.current.delete(n[e]),"Meta"===n.key&&l.current.clear(),u.current=!1},a=function(){l.current.clear(),i(!1)};return null==n||n.addEventListener("keydown",r),null==n||n.addEventListener("keyup",o),window.addEventListener("blur",a),window.addEventListener("contextmenu",a),function(){null==n||n.removeEventListener("keydown",r),null==n||n.removeEventListener("keyup",o),window.removeEventListener("blur",a),window.removeEventListener("contextmenu",a)}}}),[e,i]),o}function Tw(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 Bw(n,e){return e.includes(n)?"code":"key"}function Rw(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 Dw={position:"absolute",width:"100%",height:"100%",top:0,left:0};var Vw=function(n){return{userSelectionActive:n.userSelectionActive,lib:n.lib}};function Hw(e){var t=e.onPaneContextMenu,r=e.zoomOnScroll,o=void 0===r||r,i=e.zoomOnPinch,u=void 0===i||i,a=e.panOnScroll,c=void 0!==a&&a,l=e.panOnScrollSpeed,s=void 0===l?.5:l,f=e.panOnScrollMode,d=void 0===f?exports.PanOnScrollMode.Free:f,h=e.zoomOnDoubleClick,v=void 0===h||h,g=e.panOnDrag,y=void 0===g||g,m=e.defaultViewport,x=e.translateExtent,w=e.zoomActivationKeyCode,b=e.preventScrolling,_=void 0===b||b,E=e.children,S=e.noWheelClassName,k=e.noPanClassName,C=e.onViewportChange,M=e.isControlledViewport,N=rw(),O=n.useRef(null),P=tw(Vw,Rw),j=P.userSelectionActive,I=P.lib,A=Lw(w),z=n.useRef();return function(e){var t=rw();n.useEffect((function(){var n=function(){var n,r;if(!e.current)return!1;var o=Nw(e.current);0!==o.height&&0!==o.width||null===(r=(n=t.getState()).onError)||void 0===r||r.call(n,"004",sv()),t.setState({width:o.width||500,height:o.height||500})};if(e.current){n(),window.addEventListener("resize",n);var r=new ResizeObserver((function(){return n()}));return r.observe(e.current),function(){window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}}),[])}(O),n.useEffect((function(){if(O.current){var n=N.getState();z.current=nw({domNode:O.current,minZoom:n.minZoom,maxZoom:n.maxZoom,translateExtent:x,viewport:m,onTransformChange:function(n){null==C||C({x:n[0],y:n[1],zoom:n[2]}),M||N.setState({transform:n})},onDraggingChange:function(n){return N.setState({paneDragging:n})},onPanZoomStart:function(n,e){var t=N.getState(),r=t.onViewportChangeStart,o=t.onMoveStart;null==o||o(n,e),null==r||r(e)},onPanZoom:function(n,e){var t=N.getState(),r=t.onViewportChange,o=t.onMove;null==o||o(n,e),null==r||r(e)},onPanZoomEnd:function(n,e){var t=N.getState(),r=t.onViewportChangeEnd,o=t.onMoveEnd;null==o||o(n,e),null==r||r(e)}});var e=z.current.getViewport(),t=e.x,r=e.y,o=e.zoom;return N.setState({panZoom:z.current,transform:[t,r,o],domNode:O.current.closest(".ink-flow")}),function(){var n;null===(n=z.current)||void 0===n||n.destroy()}}}),[]),n.useEffect((function(){var n;null===(n=z.current)||void 0===n||n.update({onPaneContextMenu:t,zoomOnScroll:o,zoomOnPinch:u,panOnScroll:c,panOnScrollSpeed:s,panOnScrollMode:d,zoomOnDoubleClick:v,panOnDrag:y,zoomActivationKeyPressed:A,preventScrolling:_,noPanClassName:k,userSelectionActive:j,noWheelClassName:S,lib:I})}),[t,o,u,c,s,d,v,y,A,_,k,j,S,I]),p.jsx("div",{className:"ink-flow__renderer",ref:O,style:Dw,children:E})}var Yw={actInsideInputWithModifier:!1};function Zw(n,e){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&&(e.measured={width:n.dimensions.width,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 Xw(n,e){var r,o,i,a,c,l,s=[],f=new Map;try{for(var d=u(n),h=d.next();!h.done;h=d.next()){if("add"!==(_=h.value).type)if("remove"===_.type||"replace"===_.type)f.set(_.id,[_]);else{var v=f.get(_.id);v?v.push(_):f.set(_.id,[_])}else s.push(_.item)}}catch(n){r={error:n}}finally{try{h&&!h.done&&(o=d.return)&&o.call(d)}finally{if(r)throw r.error}}try{for(var p=u(e),g=p.next();!g.done;g=p.next()){var y=g.value,m=f.get(y.id);if(m){if("remove"!==m[0].type)if("replace"!==m[0].type){var x=t({},y);try{for(var w=(c=void 0,u(m)),b=w.next();!b.done;b=w.next()){var _;Zw(_=b.value,x)}}catch(n){c={error:n}}finally{try{b&&!b.done&&(l=w.return)&&l.call(w)}finally{if(c)throw c.error}}s.push(x)}else s.push(t({},m[0].item))}else s.push(y)}}catch(n){i={error:n}}finally{try{g&&!g.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}return s}function Uw(n,e){return{id:n,type:"select",selected:e}}function Fw(n,e,t){var r,o;void 0===e&&(e=new Set),void 0===t&&(t=!1);var i=[];try{for(var c=u(n),l=c.next();!l.done;l=c.next()){var s=a(l.value,2),f=s[0],d=s[1],h=e.has(f);void 0===d.selected&&!h||d.selected===h||(t&&(d.selected=h),i.push(Uw(d.id,h)))}}catch(n){r={error:n}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}return i}function Ww(n){var e,t,r,o,i,c,l=n.items,s=void 0===l?[]:l,f=n.lookup,d=[],h=new Map(s.map((function(n){return[n.id,n]})));try{for(var v=u(s),p=v.next();!p.done;p=v.next()){var g=p.value,y=f.get(g.id),m=null!==(c=null===(i=null==y?void 0:y.internals)||void 0===i?void 0:i.userNode)&&void 0!==c?c:y;void 0!==m&&m!==g&&d.push({id:g.id,item:g,type:"replace"}),void 0===m&&d.push({item:g,type:"add"})}}catch(n){e={error:n}}finally{try{p&&!p.done&&(t=v.return)&&t.call(v)}finally{if(e)throw e.error}}try{for(var x=u(f),w=x.next();!w.done;w=x.next()){var b=a(w.value,1)[0];void 0===h.get(b)&&d.push({id:b,type:"remove"})}}catch(n){r={error:n}}finally{try{w&&!w.done&&(o=x.return)&&o.call(x)}finally{if(r)throw r.error}}return d}function $w(n){return{id:n.id,type:"remove"}}var Gw=function(n,e){void 0===e&&(e=[0,0]);var t=dw(n),r=t.width,o=t.height,i="internals"in n?n.internals.positionAbsolute:n.position,u=n.origin||e,a=r*u[0],c=o*u[1];return{position:{x:n.position.x-a,y:n.position.y-c},positionAbsolute:{x:i.x-a,y:i.y-c}}},qw=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,u,a;void 0===e&&(e=[0,0]);var c=uw(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!==(a=null!==(u=null===(i=n.measured)||void 0===i?void 0:i.height)&&void 0!==u?u:n.height)&&void 0!==a?a:0)}}(t,e.nodeOrigin);return yw(n,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return xw(t)},Kw=function(n,e,r,o,i,c){var l,s,f,d,h,v,p,g,y=a(void 0===r?[0,0,1]:r,3),m=y[0],x=y[1],w=y[2];void 0===o&&(o=!1),void 0===i&&(i=!1),void 0===c&&(c=[0,0]);var b=t(t({},pw(e,[m,x,w])),{width:e.width/w,height:e.height/w}),_=[];try{for(var E=u(n),S=E.next();!S.done;S=E.next()){var k=a(S.value,2)[1],C=k.measured,M=k.selectable,N=void 0===M||M,O=k.hidden,P=void 0!==O&&O,j=null!==(h=null!==(d=null!==(f=C.width)&&void 0!==f?f:k.width)&&void 0!==d?d:k.initialWidth)&&void 0!==h?h:null,I=null!==(g=null!==(p=null!==(v=C.height)&&void 0!==v?v:k.height)&&void 0!==p?p:k.initialHeight)&&void 0!==g?g:null;if(!(i&&!N||P)){var A=_w(b,gw(k,c));(null===j||null===I||o&&A>0||A>=(null!=j?j:0)*(null!=I?I:0)||k.dragging)&&_.push(k)}}}catch(n){l={error:n}}finally{try{S&&!S.done&&(s=E.return)&&s.call(E)}finally{if(l)throw l.error}}return _};function Qw(n,e){var t,r,o,i=n.nodeLookup,u=n.width,a=n.height,c=n.panZoom,l=n.minZoom,s=n.maxZoom,f=n.nodeOrigin,d=void 0===f?[0,0]:f,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=qw(h,{nodeOrigin:d}),g=p.width>=u||p.height>=a;if("overflow"===(null==e?void 0:e.when)&&!g)return!0;var y=Ew(p,u,a,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(y,{duration:null==e?void 0:e.duration}),!0}return!1}function Jw(n){var e=n.nodeId,t=n.nextPosition,r=n.nodeLookup,o=n.nodeOrigin,i=void 0===o?[0,0]:o,u=n.nodeExtent,a=n.onError,c=r.get(e),l=c.parentId?r.get(c.parentId):void 0,s=l?Gw(l,l.origin||i).positionAbsolute:{x:0,y:0},f=s.x,d=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||u);if("parent"!==c.extent||c.expandParent)l&&Sw(c.extent)&&(h=[[c.extent[0][0]+f,c.extent[0][1]+d],[c.extent[1][0]+f,c.extent[1][1]+d]]);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,x=f+v*m[0],w=d+p*m[1];h=[[x,w],[x+g-v,w+y-p]]}}else null==a||a("005",fv());var b=Sw(h)?fw(t,h):t;return{position:{x:b.x-f,y:b.y-d},positionAbsolute:b}}function nb(n){return o(this,arguments,void 0,(function(n){var e,t,r,o,a,c,l,s,f,d,h,v,p,g,y,m,x,w,b,_=n.nodesToRemove,E=void 0===_?[]:_,S=n.edgesToRemove,k=void 0===S?[]:S,C=n.nodes,M=n.edges,N=n.onBeforeDelete;return i(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=u(C),a=o.next();!a.done;a=o.next())c=a.value,r(c)}catch(n){m={error:n}}finally{try{a&&!a.done&&(x=o.return)&&x.call(o)}finally{if(m)throw m.error}}l=new Set(k.map((function(n){return n.id}))),s=M.filter((function(n){return!1!==n.deletable})),f=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)}))}(t,s),d=f,h=function(n){l.has(n.id)&&!d.find((function(e){return e.id===n.id}))&&d.push(n)};try{for(v=u(s),p=v.next();!p.done;p=v.next())g=p.value,h(g)}catch(n){w={error:n}}finally{try{p&&!p.done&&(b=v.return)&&b.call(v)}finally{if(w)throw w.error}}return N?[4,N({nodes:t,edges:d})]:[2,{edges:d,nodes:t}];case 1:return"boolean"==typeof(y=n.sent())?[2,y?{edges:d,nodes:t}:{edges:[],nodes:[]}]:[2,y]}}))}))}var eb=function(n){return{userSelectionActive:n.userSelectionActive,userSelectionRect:n.userSelectionRect}};function tb(){var n=tw(eb,Rw),e=n.userSelectionActive,t=n.userSelectionRect;return e&&t?p.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 rb=function(n,e){return function(t){t.target===e.current&&(null==n||n(t))}},ob=function(n){return{userSelectionActive:n.userSelectionActive,elementsSelectable:n.elementsSelectable,dragging:n.paneDragging}};function ib(e){var t=e.isSelecting;e.selectionMode;var r=e.panOnDrag,o=e.onSelectionStart,i=e.onSelectionEnd,c=e.onPaneClick,l=e.onPaneContextMenu,s=e.onPaneScroll,f=e.onPaneMouseEnter,d=e.onPaneMouseMove,h=e.onPaneMouseLeave,v=e.children,g=n.useRef(null),y=rw(),m=n.useRef(0),x=n.useRef(0),b=n.useRef(),_=n.useRef(new Map),E=tw(ob,Rw),S=E.userSelectionActive,k=E.elementsSelectable,C=E.dragging,M=function(){y.setState({userSelectionActive:!1,userSelectionRect:null}),m.current=0,x.current=0},N=function(n){null==c||c(n),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},O=s?function(n){return s(n)}:void 0,P=k&&(t||S);return p.jsxs("div",{className:w(["ink-flow__pane",{draggable:r,dragging:C,selection:t}]),onClick:P?void 0:rb(N,g),onContextMenu:rb((function(n){Array.isArray(r)&&(null==r?void 0:r.includes(2))?n.preventDefault():null==l||l(n)}),g),onWheel:rb(O,g),onMouseEnter:P?void 0:f,onMouseDown:P?function(n){var e,r,i,c,l=y.getState(),s=l.resetSelectedElements,f=l.domNode,d=l.edgeLookup;if(b.current=null==f?void 0:f.getBoundingClientRect(),k&&t&&0===n.button&&n.target===g.current&&b.current){_.current=new Map;try{for(var h=u(d),v=h.next();!v.done;v=h.next()){var p=a(v.value,2),m=p[0],x=p[1];_.current.set(x.source,(null===(i=_.current.get(x.source))||void 0===i?void 0:i.add(m))||new Set([m])),_.current.set(x.target,(null===(c=_.current.get(x.target))||void 0===c?void 0:c.add(m))||new Set([m]))}}catch(n){e={error:n}}finally{try{v&&!v.done&&(r=h.return)&&r.call(h)}finally{if(e)throw e.error}}var w=Iw(n.nativeEvent,b.current),E=w.x,S=w.y;s(),y.setState({userSelectionRect:{width:0,height:0,startX:E,startY:S,x:E,y:S}}),null==o||o(n)}}:void 0,onMouseMove:P?function(n){var e,r,o,i,a=y.getState(),c=a.userSelectionRect,l=a.edgeLookup,s=a.transform,f=a.nodeOrigin,d=a.nodeLookup,h=a.triggerNodeChanges,v=a.triggerEdgeChanges;if(t&&b.current&&c){var p=Iw(n.nativeEvent,b.current),g=p.x,w=p.y,E=c.startX,S=c.startY,k={startX:E,startY:S,x:g<E?g:E,y:w<S?w:S,width:Math.abs(g-E),height:Math.abs(w-S)},C=Kw(d,k,s,!1,!0,f),M=new Set,N=new Set;try{for(var O=u(C),P=O.next();!P.done;P=O.next()){var j=P.value;N.add(j.id);var I=_.current.get(j.id);if(I)try{for(var A=(o=void 0,u(I)),z=A.next();!z.done;z=A.next()){var L=z.value;M.add(L)}}catch(n){o={error:n}}finally{try{z&&!z.done&&(i=A.return)&&i.call(A)}finally{if(o)throw o.error}}}}catch(n){e={error:n}}finally{try{P&&!P.done&&(r=O.return)&&r.call(O)}finally{if(e)throw e.error}}if(m.current!==N.size)m.current=N.size,h(Fw(d,N,!0));if(x.current!==M.size)x.current=M.size,v(Fw(l,M));y.setState({userSelectionRect:k,userSelectionActive:!0,nodesSelectionActive:!1})}}:d,onMouseUp:P?function(n){if(0===n.button){var e=y.getState().userSelectionRect;!S&&e&&n.target===g.current&&(null==N||N(n)),y.setState({nodesSelectionActive:m.current>0}),M(),null==i||i(n)}}:void 0,onMouseLeave:P?function(n){S&&(y.setState({nodesSelectionActive:m.current>0}),null==i||i(n)),M()}:h,ref:g,style:Dw,children:[v,p.jsx(tb,{})]})}var ub=function(n){return{nodesSelectionActive:n.nodesSelectionActive,userSelectionActive:n.userSelectionActive}};function ab(e){var t=e.children,r=e.onPaneClick,o=e.onPaneMouseEnter,i=e.onPaneMouseMove,u=e.onPaneMouseLeave,a=e.onPaneContextMenu,c=e.onPaneScroll,l=e.deleteKeyCode,s=e.selectionKeyCode,f=e.selectionOnDrag,d=e.selectionMode,h=e.onSelectionStart,v=e.onSelectionEnd,g=e.multiSelectionKeyCode,y=e.panActivationKeyCode,m=e.zoomActivationKeyCode,x=e.elementsSelectable,w=e.zoomOnScroll,b=e.zoomOnPinch,_=e.panOnScroll,E=e.panOnScrollSpeed,S=e.panOnScrollMode,k=e.zoomOnDoubleClick,C=e.panOnDrag,M=e.defaultViewport,N=e.translateExtent,O=e.minZoom,P=e.maxZoom,j=e.preventScrolling;e.onSelectionContextMenu;var I=e.noWheelClassName,A=e.noPanClassName;e.disableKeyboardA11y;var z=e.onViewportChange,L=e.isControlledViewport,T=tw(ub);T.nodesSelectionActive;var B=T.userSelectionActive,R=Lw(s),D=Lw(y),V=D||C,H=D||_,Y=R||B||f&&!0!==V;return function(e){var t=e.deleteKeyCode,r=e.multiSelectionKeyCode,o=rw(),i=Lw(t,Yw),u=Lw(r);n.useEffect((function(){if(i){var n=o.getState();n.edges,n.nodes,o.setState({nodesSelectionActive:!1})}}),[i]),n.useEffect((function(){o.setState({multiSelectionActive:u})}),[u])}({deleteKeyCode:l,multiSelectionKeyCode:g}),p.jsx(Hw,{onPaneContextMenu:a,elementsSelectable:x,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:H,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!R&&V,defaultViewport:M,translateExtent:N,minZoom:O,maxZoom:P,zoomActivationKeyCode:m,preventScrolling:j,noWheelClassName:I,noPanClassName:A,onViewportChange:z,isControlledViewport:L,children:p.jsx(ib,{onSelectionStart:h,onSelectionEnd:v,onPaneClick:r,onPaneMouseEnter:o,onPaneMouseMove:i,onPaneMouseLeave:u,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:V,isSelecting:!!Y,selectionMode:d,children:t})})}ab.displayName="FlowRenderer";var cb=n.memo(ab);var lb="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function sb(e){var t=a(n.useState(!1),2),r=t[0],o=t[1],i=a(n.useState((function(){return function(n){var e=[];return{get:function(){return e},reset:function(){e=[]},push:function(t){e.push(t),n()}}}((function(){return o(!0)}))})),1),u=i[0];return lb((function(){if(r){var n=u.get();n.length&&(e(n),u.reset()),o(!1)}else u.reset()}),[r]),u}var fb=n.createContext(null);function db(e){var t=e.children,r=rw(),o=n.useCallback((function(n){var e,t,o=r.getState(),i=o.nodes,a=void 0===i?[]:i,c=o.onNodesChange,l=o.nodeLookup,s=a;try{for(var f=u(n),d=f.next();!d.done;d=f.next()){var h=d.value;s="function"==typeof h?h(s):h}}catch(n){e={error:n}}finally{try{d&&!d.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}c&&c({changes:Ww({items:s,lookup:l}),userNodes:s})}),[]),i=sb(o),a=n.useCallback((function(n){var e,t,o=r.getState(),i=o.edges,a=void 0===i?[]:i,c=o.onEdgesChange,l=o.edgeLookup,s=a;try{for(var f=u(n),d=f.next();!d.done;d=f.next()){var h=d.value;s="function"==typeof h?h(s):h}}catch(n){e={error:n}}finally{try{d&&!d.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}c&&c({changes:Ww({items:s,lookup:l}),userEdges:s})}),[]),c=sb(a),l=n.useMemo((function(){return{nodeQueue:i,edgeQueue:c}}),[]);return p.jsx(fb.Provider,{value:l,children:t})}var hb=function(){var e=rw();return n.useMemo((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,u=e.getState(),c=a(u.transform,3),l=c[0],s=c[1],f=c[2],d=u.panZoom;null==d||d.setViewport({x:null!==(r=n.x)&&void 0!==r?r:l,y:null!==(o=n.y)&&void 0!==o?o:s,zoom:null!==(i=n.zoom)&&void 0!==i?i:f},{duration:null==t?void 0:t.duration})},getViewport:function(){var n=a(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,u=t.nodeOrigin,a=t.minZoom,c=t.maxZoom,l=t.panZoom;return!!l&&Qw({nodeLookup:r,width:o,height:i,nodeOrigin:u,minZoom:a,maxZoom:c,panZoom:l},n)},setCenter:function(n,t,r){var o=e.getState(),i=o.width,u=o.height,a=o.panZoom,c=o.transform,l=void 0!==(null==r?void 0:r.zoom)?r.zoom:c[2],s=i/2-n*l,f=u/2-t*l;null==a||a.setViewport({x:s,y:f,zoom:l},{duration:null==r?void 0:r.duration})},fitBounds:function(n,t){var r,o=e.getState(),i=o.width,u=o.height,a=o.minZoom,c=o.maxZoom,l=o.panZoom,s=Ew(n,i,u,a,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,u=r.domNode;if(!u)return n;var a=u.getBoundingClientRect(),c=a.x,l=a.y,s={x:n.x-c,y:n.y-l};return pw(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(),u=i.x,c=i.y,l=function(n,e){var t=n.x,r=n.y,o=a(e,3),i=o[0],u=o[1],c=o[2];return{x:t*c+i,y:r*c+u}}(n,r);return{x:l.x+u,y:l.y+c}}}}),[])},vb=function(n){return!!n.panZoom};function pb(){var e=this,r=hb(),u=rw(),l=function(){var e=n.useContext(fb);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),s=tw(vb);console.log("yk store",u.getState());var f=n.useMemo((function(){var n=function(n){return u.getState().nodeLookup.get(n)},r=function(n){l.nodeQueue.push(n)},s=function(n){var e,r,o,i,a=u.getState(),c=a.nodeLookup,l=a.nodeOrigin,s=kw(n)?n:c.get(n.id),f=s.parentId?function(n,e,r,o){var i,u;void 0===o&&(o=[0,0]);for(var a=e,c=t({},n);a;){var l=r.get(e);if(a=null==l?void 0:l.parentId,l){var s=l.origin||o,f=(null!==(i=l.measured.width)&&void 0!==i?i:0)*s[0],d=(null!==(u=l.measured.height)&&void 0!==u?u:0)*s[1];c.x+=l.position.x-f,c.y+=l.position.y-d}}return c}(s.position,s.parentId,c,l):s.position,d={id:s.id,position:f,width:null!==(r=null===(e=s.measured)||void 0===e?void 0:e.width)&&void 0!==r?r:s.width,height:null!==(i=null===(o=s.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:s.height,data:s.data};return gw(d)},f=function(n,e,o){void 0===o&&(o={replace:!1}),r((function(r){return r.map((function(r){if(r.id===n){var i="function"==typeof e?e(r):e;return o.replace&&kw(i)?i:t(t({},r),i)}return r}))}))};return{getNodes:function(){return u.getState().nodes.map((function(n){return t({},n)}))},getNode:function(e){var t;return null===(t=n(e))||void 0===t?void 0:t.internals.userNode},getInternalNode:n,getEdges:function(){var n=u.getState().edges;return(void 0===n?[]:n).map((function(n){return t({},n)}))},getEdge:function(n){return u.getState().edgeLookup.get(n)},setNodes:r,setEdges:function(n){l.edgeQueue.push(n)},addNodes:function(n){var e=Array.isArray(n)?n:[n];l.nodeQueue.push((function(n){return c(c([],a(n),!1),a(e),!1)}))},addEdges:function(n){var e=Array.isArray(n)?n:[n];l.edgeQueue.push((function(n){return c(c([],a(n),!1),a(e),!1)}))},toObject:function(){var n=u.getState(),e=n.nodes,r=void 0===e?[]:e,o=n.edges,i=void 0===o?[]:o,c=a(n.transform,3),l=c[0],s=c[1],f=c[2];return{nodes:r.map((function(n){return t({},n)})),edges:i.map((function(n){return t({},n)})),viewport:{x:l,y:s,zoom:f}}},deleteElements:function(n){return o(e,[n],void 0,(function(n){var e,t,r,o,a,c,l,s,f,d,h,v,p,g,y,m,x=n.nodes,w=void 0===x?[]:x,b=n.edges,_=void 0===b?[]:b;return i(this,(function(n){switch(n.label){case 0:return e=u.getState(),t=e.nodes,r=e.edges,o=e.onNodesDelete,a=e.onEdgesDelete,c=e.triggerNodeChanges,l=e.triggerEdgeChanges,s=e.onDelete,f=e.onBeforeDelete,[4,nb({nodesToRemove:w,edgesToRemove:_,nodes:t,edges:r,onBeforeDelete:f})];case 1:return d=n.sent(),h=d.nodes,v=d.edges,p=v.length>0,g=h.length>0,p&&(y=v.map($w),null==a||a(v),l(y)),g&&(m=h.map($w),null==o||o(h),c(m)),(g||p)&&(null==s||s({nodes:h,edges:v})),[2,{deletedNodes:h,deletedEdges:v}]}}))}))},getIntersectingNodes:function(n,e,t){void 0===e&&(e=!0);var r=Mw(n),o=r?n:s(n),i=void 0!==t;return o?(t||u.getState().nodes).filter((function(t){var a=u.getState().nodeLookup.get(t.id);if(a&&!r&&(t.id===n.id||!a.internals.positionAbsolute))return!1;var c=gw(i?t:a),l=_w(c,o);return e&&l>0||l>=o.width*o.height})):[]},isNodeIntersecting:function(n,e,t){void 0===t&&(t=!0);var r=Mw(n)?n:s(n);if(!r)return!1;var o=_w(r,e);return t&&o>0||o>=r.width*r.height},updateNode:f,updateNodeData:function(n,e,r){void 0===r&&(r={replace:!1}),f(n,(function(n){var o="function"==typeof e?e(n):e;return r.replace?t(t({},n),{data:o}):t(t({},n),{data:t(t({},n.data),o)})}),r)}}}),[]);return n.useMemo((function(){return t(t(t({},f),r),{viewportInitialized:s})}),[s])}var gb=function(n){return n.updateNodeInternals};function yb(e){var t=tw(n.useCallback(function(n){return function(e){return n?Kw(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())}}(e),[e]),Rw);return t}var mb=n.createContext(null),xb=mb.Provider;mb.Consumer;function wb(n){var e=n.sourceX,t=n.sourceY,r=n.targetX,o=n.targetY,i=n.sourceControlX,u=n.sourceControlY,a=.125*e+.375*i+.375*n.targetControlX+.125*r,c=.125*t+.375*u+.375*n.targetControlY+.125*o;return[a,c,Math.abs(a-e),Math.abs(c-t)]}function bb(n,e){return n>=0?.5*n:25*e*Math.sqrt(-n)}function _b(n){var e=n.pos,t=n.x1,r=n.y1,o=n.x2,i=n.y2,u=n.c;switch(e){case exports.Position.Left:return[t-bb(t-o,u),r];case exports.Position.Right:return[t+bb(o-t,u),r];case exports.Position.Top:return[t,r-bb(r-i,u)];case exports.Position.Bottom:return[t,r+bb(i-r,u)]}}function Eb(n){var e=n.sourceX,t=n.sourceY,r=n.targetX,o=n.targetY,i=Math.abs(r-e)/2,u=r<e?r+i:r-i,a=Math.abs(o-t)/2;return[u,o<t?o+a:o-a,i,a]}var Sb,kb=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 Cb=((Sb={})[exports.Position.Left]={x:-1,y:0},Sb[exports.Position.Right]={x:1,y:0},Sb[exports.Position.Top]={x:0,y:-1},Sb[exports.Position.Bottom]={x:0,y:1},Sb),Mb=function(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))};function Nb(n){var e,t,r,o,i=n.source,u=n.sourcePosition,l=void 0===u?exports.Position.Bottom:u,s=n.target,f=n.targetPosition,d=void 0===f?exports.Position.Top:f,h=n.center,v=n.offset,p=Cb[l],g=Cb[d],y={x:i.x+p.x*v,y:i.y+p.y*v},m={x:s.x+g.x*v,y:s.y+g.y*v},x=function(n){var e=n.source,t=n.sourcePosition,r=void 0===t?exports.Position.Bottom:t,o=n.target;return r===exports.Position.Left||r===exports.Position.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:y,sourcePosition:l,target:m}),w=0!==x.x?"x":"y",b=x[w],_=[],E={x:0,y:0},S={x:0,y:0},k=a(Eb({sourceX:i.x,sourceY:i.y,targetX:s.x,targetY:s.y}),4),C=k[0],M=k[1],N=k[2],O=k[3];if(p[w]*g[w]==-1){r=null!==(e=h.x)&&void 0!==e?e:C,o=null!==(t=h.y)&&void 0!==t?t:M;var P=[{x:r,y:y.y},{x:r,y:m.y}],j=[{x:y.x,y:o},{x:m.x,y:o}];_=p[w]===b?"x"===w?P:j:"x"===w?j:P}else{var I=[{x:y.x,y:m.y}],A=[{x:m.x,y:y.y}];if(_="x"===w?p.x===b?A:I:p.y===b?I:A,l===d){var z=Math.abs(i[w]-s[w]);if(z<=v){var L=Math.min(v-1,v-z);p[w]===b?E[w]=(y[w]>i[w]?-1:1)*L:S[w]=(m[w]>s[w]?-1:1)*L}}if(l!==d){var T="x"===w?"y":"x",B=p[w]===g[T],R=y[T]>m[T],D=y[T]<m[T];(1===p[w]&&(!B&&R||B&&D)||1!==p[w]&&(!B&&D||B&&R))&&(_="x"===w?I:A)}var V={x:y.x+E.x,y:y.y+E.y},H={x:m.x+S.x,y:m.y+S.y};Math.max(Math.abs(V.x-_[0].x),Math.abs(H.x-_[0].x))>=Math.max(Math.abs(V.y-_[0].y),Math.abs(H.y-_[0].y))?(r=(V.x+H.x)/2,o=_[0].y):(r=_[0].x,o=(V.y+H.y)/2)}return[c(c([i,{x:y.x+E.x,y:y.y+E.y}],a(_),!1),[{x:m.x+S.x,y:m.y+S.y},s],!1),r,o,N,O]}function Ob(n){var e=n.sourceX,t=n.sourceY,r=n.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=n.targetX,u=n.targetY,c=n.targetPosition,l=void 0===c?exports.Position.Top:c,s=n.borderRadius,f=void 0===s?5:s,d=n.centerX,h=n.centerY,v=n.offset,p=a(Nb({source:{x:e,y:t},sourcePosition:o,target:{x:i,y:u},targetPosition:l,center:{x:d,y:h},offset:void 0===v?20:v}),5),g=p[0],y=p[1],m=p[2],x=p[3],w=p[4],b=g.reduce((function(n,e,t){var r="";return r=t>0&&t<g.length-1?function(n,e,t,r){var o=Math.min(Mb(n,e)/2,Mb(e,t)/2,r),i=e.x,u=e.y;if(n.x===i&&i===t.x||n.y===u&&u===t.y)return"L".concat(i," ").concat(u);if(n.y===u){var a=n.x<t.x?-1:1,c=n.y<t.y?1:-1;return"L ".concat(i+o*a,",").concat(u,"Q ").concat(i,",").concat(u," ").concat(i,",").concat(u+o*c)}var l=n.x<t.x?1:-1,s=n.y<t.y?-1:1;return"L ".concat(i,",").concat(u+o*s,"Q ").concat(i,",").concat(u," ").concat(i+o*l,",").concat(u)}(g[t-1],e,g[t+1],f):"".concat(0===t?"M":"L").concat(e.x," ").concat(e.y),n+=r}),"");return[b,y,m,x,w]}var Pb=function(n){return{connectOnClick:n.connectOnClick,noPanClassName:n.noPanClassName,rfId:n.rfId}};var jb=n.memo(bw((function(e,o){var i,u,a=e.type,c=void 0===a?"source":a,l=e.position,s=void 0===l?exports.Position.Top:l,f=e.isValidConnection,d=e.isConnectable,h=void 0===d||d,v=e.isConnectableStart,g=void 0===v||v,y=e.isConnectableEnd,m=void 0===y||y,x=e.id,b=e.onConnect,_=e.children,E=e.className,S=e.onMouseDown,k=e.onTouchStart,C=r(e,["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"]),M=x||null,N="target"===c,O=rw(),P=n.useContext(mb),j=tw(Pb,Rw),I=j.connectOnClick,A=j.noPanClassName,z=j.rfId,L=tw(function(n,e,t){return function(r){var o=r.connectionStartHandle,i=r.connectionEndHandle,u=r.connectionClickStartHandle,a=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==u?void 0:u.nodeId)===n&&(null==u?void 0:u.handleId)===e&&(null==u?void 0:u.type)===t,isPossibleEndHandle:a===exports.ConnectionMode.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}}}(P,M,c),Rw),T=L.connectingFrom,B=L.connectingTo,R=L.clickConnecting,D=L.isPossibleEndHandle,V=L.connectionInProcess,H=L.valid;P||null===(u=(i=O.getState()).onError)||void 0===u||u.call(i,"010",vv());var Y=function(n){var e=O.getState(),r=e.defaultEdgeOptions,o=e.onConnect,i=e.hasDefaultEdges,u=t(t({},r),n);if(i){var a=O.getState(),c=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))}))}(r="id"in(o=n)&&"source"in o&&"target"in o?t({},n):t(t({},n),{id:kb(n)}),e)?e:(null===r.sourceHandle&&delete r.sourceHandle,null===r.targetHandle&&delete r.targetHandle,e.concat(r)):e;var r,o}(u,c))}null==o||o(u),null==b||b(u)},Z=function(n){if(P){var e=jw(n.nativeEvent);if(g&&(e&&0===n.button||!e)){var t=O.getState();Yy.onPointerDown(n.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:N,handleId:M,nodeId:P,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:Y,isValidConnection:f||t.isValidConnection,getTransform:function(){return O.getState().transform},getConnectionStartHandle:function(){return O.getState().connectionStartHandle}})}e?null==S||S(n):null==k||k(n)}};return p.jsx("div",t({"data-handleid":M,"data-nodeid":P,"data-handlepos":s,"data-id":"".concat(z,"-").concat(P,"-").concat(M,"-").concat(c),className:w(["ink-flow__handle","ink-flow__handle-".concat(s),"nodrag",A,E,{source:!N,target:N,connectable:h,connectablestart:g,connectableend:m,clickconnecting:R,connectingfrom:T,connectingto:B,valid:H,connectionindicator:h&&(!V||D)&&(V?m:g)}]),onMouseDown:Z,onTouchStart:Z,onClick:I?function(n){var e=O.getState(),t=e.onClickConnectStart,r=e.onClickConnectEnd,o=e.connectionClickStartHandle,i=e.connectionMode,u=e.isValidConnection,a=e.lib,l=e.rfId;if(P&&(o||g)){if(!o)return null==t||t(n.nativeEvent,{nodeId:P,handleId:M,handleType:c}),void O.setState({connectionClickStartHandle:{nodeId:P,type:c,handleId:M}});var s=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),d=f||u,h=Yy.isValid(n.nativeEvent,{handle:{nodeId:P,id:M,type:c},connectionMode:i,fromNodeId:o.nodeId,fromHandleId:o.handleId||null,fromType:o.type,isValidConnection:d,flowId:l,doc:s,lib:a}),v=h.connection;h.isValid&&v&&Y(v),null==r||r(n),O.setState({connectionClickStartHandle:null})}}:void 0,ref:o},C,{children:_}))})));var Ib={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ab={input:function(n){var e=n.data,t=n.isConnectable,r=n.sourcePosition,o=void 0===r?exports.Position.Bottom:r;return p.jsxs(p.Fragment,{children:[null==e?void 0:e.label,p.jsx(jb,{type:"source",position:o,isConnectable:t})]})},default:function(n){var e=n.data,t=n.isConnectable,r=n.targetPosition,o=void 0===r?exports.Position.Top:r,i=n.sourcePosition,u=void 0===i?exports.Position.Bottom:i;return p.jsxs(p.Fragment,{children:[p.jsx(jb,{type:"target",position:o,isConnectable:t}),null==e?void 0:e.label,p.jsx(jb,{type:"source",position:u,isConnectable:t})]})},output:function(n){var e=n.data,t=n.isConnectable,r=n.targetPosition,o=void 0===r?exports.Position.Top:r;return p.jsxs(p.Fragment,{children:[p.jsx(jb,{type:"target",position:o,isConnectable:t}),null==e?void 0:e.label]})},group:function(){return null}};function zb(n){var e=n.id,t=n.store,r=n.unselect,o=void 0!==r&&r,i=n.nodeRef,u=t.getState(),a=u.addSelectedNodes,c=u.unselectNodesAndEdges,l=u.multiSelectionActive,s=u.nodeLookup,f=u.onError,d=s.get(e);d?(t.setState({nodesSelectionActive:!1}),d.selected?(o||d.selected&&l)&&(c({nodes:[d],edges:[]}),requestAnimationFrame((function(){var n;return null===(n=null==i?void 0:i.current)||void 0===n?void 0:n.blur()}))):a([e])):null==f||f("012",gv(e))}function Lb(e){var r,o=e.id,i=e.onClick,c=e.onMouseEnter,l=e.onMouseMove,s=e.onMouseLeave,f=e.onContextMenu,d=e.onDoubleClick,h=e.nodesDraggable,v=e.elementsSelectable,g=e.nodesConnectable,y=e.nodesFocusable,m=e.resizeObserver,x=e.noDragClassName,b=e.noPanClassName,_=e.disableKeyboardA11y,E=e.rfId,S=e.nodeTypes,k=e.nodeExtent,C=e.nodeOrigin,M=e.onError,N=tw((function(n){var e=n.nodeLookup.get(o),t=n.parentLookup.has(o);return{node:e,internals:e.internals,isParent:t}}),Rw),O=N.node,P=N.internals,j=N.isParent,I=O.type||"default",A=(null==S?void 0:S[I])||Ab[I];void 0===A&&(null==M||M("003",lv(I)),I="default",A=Ab.default);var z=!!(O.draggable||h&&void 0===O.draggable),L=!!(O.selectable||v&&void 0===O.selectable),T=!!(O.connectable||g&&void 0===O.connectable),B=!!(O.focusable||y&&void 0===O.focusable),R=rw(),D=function(n){var e,t,r,o,i,u;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!==(u=null!==(i=null===(o=n.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:n.height)&&void 0!==u?u:n.initialHeight)}(O),V=function(e){var t=e.node,r=e.nodeType,o=e.hasDimensions,i=e.resizeObserver,u=rw(),a=n.useRef(null),c=n.useRef(null),l=n.useRef(t.sourcePosition),s=n.useRef(t.targetPosition),f=n.useRef(r),d=o&&!!t.internals.handleBounds&&!t.hidden;return n.useEffect((function(){!a.current||d&&c.current===a.current||(c.current&&(null==i||i.unobserve(c.current)),null==i||i.observe(a.current),c.current=a.current)}),[d]),n.useEffect((function(){return function(){c.current&&(null==i||i.unobserve(c.current),c.current=null)}}),[]),n.useEffect((function(){if(a.current){var n=f.current!==r,e=l.current!==t.sourcePosition,o=s.current!==t.targetPosition;(n||e||o)&&(f.current=r,l.current=t.sourcePosition,s.current=t.targetPosition,u.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:a.current,force:!0}]])))}}),[t.id,r,t.sourcePosition,t.targetPosition]),a}({node:O,nodeType:I,hasDimensions:D,resizeObserver:m}),H=function(e){var t=e.nodeRef,r=e.disabled,o=void 0!==r&&r,i=e.noDragClassName,u=e.handleSelector,c=e.nodeId,l=e.isSelectable,s=rw(),f=a(n.useState(!1),2),d=f[0],h=f[1],v=n.useRef();return n.useEffect((function(){v.current=Ty({getStoreItems:function(){return s.getState()},onNodeMouseDown:function(n){zb({id:n,store:s,nodeRef:t})},onDragStart:function(){h(!0)},onDragStop:function(){h(!1)}})}),[]),n.useEffect((function(){var n,e;if(o)null===(n=v.current)||void 0===n||n.destroy();else if(t.current)return null===(e=v.current)||void 0===e||e.update({noDragClassName:i,handleSelector:u,domNode:t.current,isSelectable:l,nodeId:c}),function(){var n;null===(n=v.current)||void 0===n||n.destroy()}}),[i,u,o,l,t,c]),d}({nodeRef:V,disabled:O.hidden||!z,noDragClassName:x,handleSelector:O.dragHandle,nodeId:o,isSelectable:L}),Y=function(){var e=rw(),t=n.useCallback((function(n){var t,r,o=e.getState(),i=o.nodeExtent,c=o.snapToGrid,l=o.snapGrid,s=o.nodesDraggable,f=o.onError,d=o.updateNodePositions,h=o.nodeLookup,v=o.nodeOrigin,p=new Map,g=function(n){return function(e){return e.selected&&(e.draggable||n&&void 0===e.draggable)}}(s),y=c?l[0]:5,m=c?l[1]:5,x=n.direction.x*y*n.factor,w=n.direction.y*m*n.factor;try{for(var b=u(h),_=b.next();!_.done;_=b.next()){var E=a(_.value,2)[1];if(g(E)){var S={x:E.internals.positionAbsolute.x+x,y:E.internals.positionAbsolute.y+w};c&&(S=vw(S,l));var k=Jw({nodeId:E.id,nextPosition:S,nodeLookup:h,nodeExtent:i,nodeOrigin:v,onError:f}),C=k.position,M=k.positionAbsolute;E.position=C,E.internals.positionAbsolute=M,p.set(E.id,E)}}}catch(n){t={error:n}}finally{try{_&&!_.done&&(r=b.return)&&r.call(b)}finally{if(t)throw t.error}}d(p)}),[]);return t}();if(O.hidden)return null;var Z=dw(O),X=function(n){var e,t,r,o,i,u,a,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===(u=n.style)||void 0===u?void 0:u.height}:{width:null!==(a=n.width)&&void 0!==a?a: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}}(O),U=(k?fw(P.positionAbsolute,k):P.positionAbsolute)||{x:0,y:0},F=function(n){var e=n.x,t=n.y,r=n.width,o=n.height,i=n.origin,u=void 0===i?[0,0]:i;return!r||!o||u[0]<0||u[1]<0||u[0]>1||u[1]>1?{x:e,y:t}:{x:e-r*u[0],y:t-o*u[1]}}(t(t(t({},U),Z),{origin:O.origin||C})),W=L||z||i||c||l||s,$=c?function(n){return c(n,t({},P.userNode))}:void 0,G=l?function(n){return l(n,t({},P.userNode))}:void 0,q=s?function(n){return s(n,t({},P.userNode))}:void 0,K=f?function(n){return f(n,t({},P.userNode))}:void 0,Q=d?function(n){return d(n,t({},P.userNode))}:void 0;return p.jsx("div",{className:w(["ink-flow__node","ink-flow__node-".concat(I),(r={},r[b]=z,r),O.className,{selected:O.selected,selectable:L,parent:j,draggable:z,dragging:H}]),ref:V,style:t(t({zIndex:P.z,transform:"translate(".concat(F.x,"px,").concat(F.y,"px)"),pointerEvents:W?"all":"none",visibility:D?"visible":"hidden"},O.style),X),"data-id":o,"data-testid":"rf__node-".concat(o),onMouseEnter:$,onMouseMove:G,onMouseLeave:q,onContextMenu:K,onClick:function(n){var e=R.getState(),r=e.selectNodesOnDrag,u=e.nodeDragThreshold;L&&(!r||!z||u>0)&&zb({id:o,store:R,nodeRef:V}),i&&i(n,t({},P.userNode))},onDoubleClick:Q,onKeyDown:B?function(n){if(!Pw(n.nativeEvent)&&!_)if(mv.includes(n.key)&&L){var e="Escape"===n.key;zb({id:o,store:R,unselect:e,nodeRef:V})}else z&&O.selected&&Object.prototype.hasOwnProperty.call(Ib,n.key)&&(R.setState({ariaLiveMessage:"Moved selected node ".concat(n.key.replace("Arrow","").toLowerCase(),". New position, x: ").concat(~~U.x,", y: ").concat(~~U.y)}),Y({direction:Ib[n.key],factor:n.shiftKey?4:1}))}:void 0,tabIndex:B?0:void 0,role:B?"button":void 0,"aria-describedby":_?void 0:"".concat("ink-flow__node-desc","-").concat(E),"aria-label":O.ariaLabel,children:p.jsx(xb,{value:o,children:p.jsx(A,t({id:o,data:O.data,type:I,positionAbsoluteX:U.x,positionAbsoluteY:U.y,selected:O.selected,isConnectable:T,sourcePosition:O.sourcePosition,targetPosition:O.targetPosition,dragging:H,dragHandle:O.dragHandle,zIndex:P.z},Z))})})}var Tb=function(n){return{nodesDraggable:n.nodesDraggable,nodesConnectable:n.nodesConnectable,nodesFocusable:n.nodesFocusable,elementsSelectable:n.elementsSelectable,onError:n.onError}};function Bb(e){var t=tw(Tb,Rw),r=t.nodesDraggable,o=t.nodesConnectable,i=t.nodesFocusable,u=t.elementsSelectable,c=t.onError,l=yb(!1),s=function(){var e=tw(gb),t=a(n.useState((function(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver((function(n){var t=new Map;n.forEach((function(n){var e=n.target.getAttribute("data-id");t.set(e,{id:e,nodeElement:n.target})})),e(t)}))})),1),r=t[0];return n.useEffect((function(){return function(){null==r||r.disconnect()}}),[r]),r}();return p.jsx("div",{className:"ink-flow__nodes",style:Dw,children:l.map((function(n){return p.jsx(Lb,{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:s,nodesDraggable:r,nodesConnectable:o,nodesFocusable:i,elementsSelectable:u,onError:c},n)}))})}Bb.displayName="NodeRenderer";var Rb,Db=n.memo(Bb),Vb=((Rb={})[exports.MarkerType.Arrow]=function(n){var e=n.color,t=void 0===e?"none":e,r=n.strokeWidth,o=void 0===r?1:r;return p.jsx("polyline",{style:{stroke:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"})},Rb[exports.MarkerType.ArrowClosed]=function(n){var e=n.color,t=void 0===e?"none":e,r=n.strokeWidth,o=void 0===r?1:r;return p.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Rb);function Hb(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 Yb=function(e){var t=e.id,r=e.type,o=e.color,i=e.width,u=void 0===i?12.5:i,a=e.height,c=void 0===a?12.5:a,l=e.markerUnits,s=void 0===l?"strokeWidth":l,f=e.strokeWidth,d=e.orient,h=void 0===d?"auto-start-reverse":d,v=function(e){var t=rw(),r=n.useMemo((function(){var n,r;return Object.prototype.hasOwnProperty.call(Vb,e)?Vb[e]:(null===(r=(n=t.getState()).onError)||void 0===r||r.call(n,"009",dv(e)),null)}),[e]);return r}(r);return v?p.jsx("marker",{className:"ink-flow__arrowhead",id:t,markerWidth:"".concat(u),markerHeight:"".concat(c),viewBox:"-10 -10 20 20",markerUnits:s,orient:h,refX:"0",refY:"0",children:p.jsx(v,{color:o,strokeWidth:f})}):null},Zb=function(e){var r=e.defaultColor,o=e.rfId,i=tw((function(n){return n.edges})),u=tw((function(n){return n.defaultEdgeOptions})),a=n.useMemo((function(){var n=function(n,e){var r=e.id,o=e.defaultColor,i=e.defaultMarkerStart,u=e.defaultMarkerEnd,a=new Set;return n.reduce((function(n,e){return[e.markerStart||i,e.markerEnd||u].forEach((function(e){if(e&&"object"==typeof e){var i=Hb(e,r);a.has(i)||(n.push(t({id:i,color:e.color||o},e)),a.add(i))}})),n}),[]).sort((function(n,e){return n.id.localeCompare(e.id)}))}(i,{id:o,defaultColor:r,defaultMarkerStart:null==u?void 0:u.markerStart,defaultMarkerEnd:null==u?void 0:u.markerEnd});return n}),[i,u,o,r]);return a.length?p.jsx("svg",{className:"ink-flow__marker",children:p.jsx("defs",{children:a.map((function(n){return p.jsx(Yb,{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};Zb.displayName="MarkerDefinitions";var Xb=n.memo(Zb);function Ub(e){var o=e.x,i=e.y,u=e.label,c=e.labelStyle,l=void 0===c?{}:c,s=e.labelShowBg,f=void 0===s||s,d=e.labelBgStyle,h=void 0===d?{}:d,v=e.labelBgPadding,g=void 0===v?[2,4]:v,y=e.labelBgBorderRadius,m=void 0===y?2:y,x=e.children,b=e.className,_=r(e,["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"]),E=a(n.useState({x:1,y:0,width:0,height:0}),2),S=E[0],k=E[1],C=w(["ink-flow__edge-textwrapper",b]),M=n.useCallback((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!==u&&u?p.jsxs("g",t({transform:"translate(".concat(o-S.width/2," ").concat(i-S.height/2,")"),className:C,visibility:S.width?"visible":"hidden"},_,{children:[f&&p.jsx("rect",{width:S.width+2*g[0],x:-g[0],y:-g[1],height:S.height+2*g[1],className:"ink-flow__edge-textbg",style:h,rx:m,ry:m}),p.jsx("text",{className:"ink-flow__edge-text",y:S.height/2,dy:"0.3em",ref:M,style:l,children:u}),x]})):null}Ub.displayName="EdgeText";var Fb=n.memo(Ub);function Wb(n){var e=n.id,t=n.path,r=n.labelX,o=n.labelY,i=n.label,u=n.labelStyle,a=n.labelShowBg,c=n.labelBgStyle,l=n.labelBgPadding,s=n.labelBgBorderRadius,f=n.style,d=n.markerEnd,h=n.markerStart,v=n.className,g=n.interactionWidth,y=void 0===g?20:g;return p.jsxs(p.Fragment,{children:[p.jsx("path",{id:e,style:f,d:t,fill:"none",className:w(["ink-flow__edge-path",v]),markerEnd:d,markerStart:h}),y&&p.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:y,className:"ink-flow__edge-interaction"}),i&&hw(r)&&hw(o)?p.jsx(Fb,{x:r,y:o,label:i,labelStyle:u,labelShowBg:a,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:s}):null]})}function $b(n){var e=n.pos,t=n.x1,r=n.y1,o=n.x2,i=n.y2;return e===exports.Position.Left||e===exports.Position.Right?[.5*(t+o),r]:[t,.5*(r+i)]}function Gb(n){var e=n.sourceX,t=n.sourceY,r=n.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=n.targetX,u=n.targetY,c=n.targetPosition,l=void 0===c?exports.Position.Top:c,s=a($b({pos:o,x1:e,y1:t,x2:i,y2:u}),2),f=s[0],d=s[1],h=a($b({pos:l,x1:i,y1:u,x2:e,y2:t}),2),v=h[0],p=h[1],g=a(wb({sourceX:e,sourceY:t,targetX:i,targetY:u,sourceControlX:f,sourceControlY:d,targetControlX:v,targetControlY:p}),4),y=g[0],m=g[1],x=g[2],w=g[3];return["M".concat(e,",").concat(t," C").concat(f,",").concat(d," ").concat(v,",").concat(p," ").concat(i,",").concat(u),y,m,x,w]}function qb(e){return n.memo((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,u=n.targetY,c=n.sourcePosition,l=void 0===c?exports.Position.Bottom:c,s=n.targetPosition,f=void 0===s?exports.Position.Top:s,d=n.label,h=n.labelStyle,v=n.labelShowBg,g=n.labelBgStyle,y=n.labelBgPadding,m=n.labelBgBorderRadius,x=n.style,w=n.markerEnd,b=n.markerStart,_=n.interactionWidth,E=a(Gb({sourceX:r,sourceY:o,sourcePosition:l,targetX:i,targetY:u,targetPosition:f}),3),S=E[0],k=E[1],C=E[2],M=e.isInternal?void 0:t;return p.jsx(Wb,{id:M,path:S,labelX:k,labelY:C,label:d,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:m,style:x,markerEnd:w,markerStart:b,interactionWidth:_})}))}var Kb=qb({isInternal:!1}),Qb=qb({isInternal:!0});function Jb(e){return n.memo((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,u=n.targetY,c=n.label,l=n.labelStyle,s=n.labelShowBg,f=n.labelBgStyle,d=n.labelBgPadding,h=n.labelBgBorderRadius,v=n.style,g=n.sourcePosition,y=void 0===g?exports.Position.Bottom:g,m=n.targetPosition,x=void 0===m?exports.Position.Top:m,w=n.markerEnd,b=n.markerStart,_=n.pathOptions,E=n.interactionWidth,S=a(Ob({sourceX:r,sourceY:o,sourcePosition:y,targetX:i,targetY:u,targetPosition:x,borderRadius:null==_?void 0:_.borderRadius,offset:null==_?void 0:_.offset}),3),k=S[0],C=S[1],M=S[2],N=e.isInternal?void 0:t;return p.jsx(Wb,{id:N,path:k,labelX:C,labelY:M,label:c,labelStyle:l,labelShowBg:s,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:v,markerEnd:w,markerStart:b,interactionWidth:E})}))}Kb.displayName="SimpleBezierEdge",Qb.displayName="SimpleBezierEdgeInternal";var n_=Jb({isInternal:!1}),e_=Jb({isInternal:!0});function t_(e){return n.memo((function(o){var i,u=o.id,a=r(o,["id"]),c=e.isInternal?void 0:u;return p.jsx(n_,t({},a,{id:c,pathOptions:n.useMemo((function(){var n;return{borderRadius:0,offset:null===(n=a.pathOptions)||void 0===n?void 0:n.offset}}),[null===(i=a.pathOptions)||void 0===i?void 0:i.offset])}))}))}n_.displayName="SmoothStepEdge",e_.displayName="SmoothStepEdgeInternal";var r_=t_({isInternal:!1}),o_=t_({isInternal:!0});function i_(e){return n.memo((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,u=n.targetY,c=n.label,l=n.labelStyle,s=n.labelShowBg,f=n.labelBgStyle,d=n.labelBgPadding,h=n.labelBgBorderRadius,v=n.style,g=n.markerEnd,y=n.markerStart,m=n.interactionWidth,x=a(function(n){var e=n.sourceX,t=n.sourceY,r=n.targetX,o=n.targetY,i=a(Eb({sourceX:e,sourceY:t,targetX:r,targetY:o}),4),u=i[0],c=i[1],l=i[2],s=i[3];return["M ".concat(e,",").concat(t,"L ").concat(r,",").concat(o),u,c,l,s]}({sourceX:r,sourceY:o,targetX:i,targetY:u}),3),w=x[0],b=x[1],_=x[2],E=e.isInternal?void 0:t;return p.jsx(Wb,{id:E,path:w,labelX:b,labelY:_,label:c,labelStyle:l,labelShowBg:s,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:v,markerEnd:g,markerStart:y,interactionWidth:m})}))}r_.displayName="StepEdge",o_.displayName="StepEdgeInternal";var u_=i_({isInternal:!1}),a_=i_({isInternal:!0});function c_(e){return n.memo((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,u=n.targetY,c=n.sourcePosition,l=void 0===c?exports.Position.Bottom:c,s=n.targetPosition,f=void 0===s?exports.Position.Top:s,d=n.label,h=n.labelStyle,v=n.labelShowBg,g=n.labelBgStyle,y=n.labelBgPadding,m=n.labelBgBorderRadius,x=n.style,w=n.markerEnd,b=n.markerStart,_=n.pathOptions,E=n.interactionWidth,S=a(function(n){var e=n.sourceX,t=n.sourceY,r=n.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=n.targetX,u=n.targetY,c=n.targetPosition,l=void 0===c?exports.Position.Top:c,s=n.curvature,f=void 0===s?.25:s,d=a(_b({pos:o,x1:e,y1:t,x2:i,y2:u,c:f}),2),h=d[0],v=d[1],p=a(_b({pos:l,x1:i,y1:u,x2:e,y2:t,c:f}),2),g=p[0],y=p[1],m=a(wb({sourceX:e,sourceY:t,targetX:i,targetY:u,sourceControlX:h,sourceControlY:v,targetControlX:g,targetControlY:y}),4),x=m[0],w=m[1],b=m[2],_=m[3];return["M".concat(e,",").concat(t," C").concat(h,",").concat(v," ").concat(g,",").concat(y," ").concat(i,",").concat(u),x,w,b,_]}({sourceX:r,sourceY:o,sourcePosition:l,targetX:i,targetY:u,targetPosition:f,curvature:null==_?void 0:_.curvature}),3),k=S[0],C=S[1],M=S[2],N=e.isInternal?void 0:t;return p.jsx(Wb,{id:N,path:k,labelX:C,labelY:M,label:d,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:m,style:x,markerEnd:w,markerStart:b,interactionWidth:E})}))}u_.displayName="StraightEdge",a_.displayName="StraightEdgeInternal";var l_=c_({isInternal:!1}),s_=c_({isInternal:!0});l_.displayName="BezierEdge",s_.displayName="BezierEdgeInternal";var f_={default:s_,straight:a_,step:o_,smoothstep:e_,simplebezier:Qb},d_={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},h_=function(n,e,t){return t===exports.Position.Left?n-e:t===exports.Position.Right?n+e:n},v_=function(n,e,t){return t===exports.Position.Top?n-e:t===exports.Position.Bottom?n+e:n},p_="ink-flow__edgeupdater";function g_(n){var e=n.position,t=n.centerX,r=n.centerY,o=n.radius,i=void 0===o?10:o,u=n.onMouseDown,a=n.onMouseEnter,c=n.onMouseOut,l=n.type;return p.jsx("circle",{onMouseDown:u,onMouseEnter:a,onMouseOut:c,className:w([p_,"".concat(p_,"-").concat(l)]),cx:h_(t,i,e),cy:v_(r,i,e),r:i,stroke:"transparent",fill:"transparent"})}function y_(n){var e=n.isUpdatable,t=n.edgeUpdaterRadius,r=n.edge,o=n.targetHandleId,i=n.sourceHandleId,u=n.sourceX,a=n.sourceY,c=n.targetX,l=n.targetY,s=n.sourcePosition,f=n.targetPosition,d=n.onEdgeUpdate,h=n.onEdgeUpdateStart,v=n.onEdgeUpdateEnd,g=n.setUpdating,y=n.setUpdateHover,m=rw(),x=function(n,e){if(0===n.button){var t=m.getState(),u=t.autoPanOnConnect,a=t.domNode,c=t.isValidConnection,l=t.connectionMode,s=t.connectionRadius,f=t.lib,p=t.onConnectStart,y=t.onConnectEnd,x=t.cancelConnection,w=t.nodeLookup,b=t.rfId,_=t.panBy,E=t.updateConnection,S=e?r.target:r.source,k=(e?o:i)||null,C=e?"target":"source",M=e;g(!0),null==h||h(n,r,C);Yy.onPointerDown(n.nativeEvent,{autoPanOnConnect:u,connectionMode:l,connectionRadius:s,domNode:a,handleId:k,nodeId:S,nodeLookup:w,isTarget:M,edgeUpdaterType:C,lib:f,flowId:b,cancelConnection:x,panBy:_,isValidConnection:c,onConnect:function(n){return null==d?void 0:d(r,n)},onConnectStart:p,onConnectEnd:y,onEdgeUpdateEnd:function(n){g(!1),null==v||v(n,r,C)},updateConnection:E,getTransform:function(){return m.getState().transform},getConnectionStartHandle:function(){return m.getState().connectionStartHandle}})}},w=function(){return y(!0)},b=function(){return y(!1)};return p.jsxs(p.Fragment,{children:[("source"===e||!0===e)&&p.jsx(g_,{position:s,centerX:u,centerY:a,radius:t,onMouseDown:function(n){return x(n,!0)},onMouseEnter:w,onMouseOut:b,type:"source"}),("target"===e||!0===e)&&p.jsx(g_,{position:f,centerX:c,centerY:l,radius:t,onMouseDown:function(n){return x(n,!1)},onMouseEnter:w,onMouseOut:b,type:"target"})]})}function m_(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 x_(n){var e,t,r,o;if(!n)return null;var i=[],a=[];try{for(var c=u(n),l=c.next();!l.done;l=c.next()){var s=l.value;s.width=null!==(r=s.width)&&void 0!==r?r:1,s.height=null!==(o=s.height)&&void 0!==o?o:1,"source"===s.type?i.push(s):"target"===s.type&&a.push(s)}}catch(n){e={error:n}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}return{source:i,target:a}}function w_(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,u=(null!==(o=null==t?void 0:t.y)&&void 0!==o?o:0)+e.internals.positionAbsolute.y,a=null!=t?t:dw(e),c=a.width,l=a.height;switch(n){case exports.Position.Top:return[i+c/2,u];case exports.Position.Right:return[i+c,u+l/2];case exports.Position.Bottom:return[i+c/2,u+l];case exports.Position.Left:return[i,u+l/2]}}function b_(n,e){return n&&(e?n.find((function(n){return n.id===e})):n[0])||null}function __(e){var r=e.id,o=e.edgesFocusable,i=e.edgesUpdatable,u=e.elementsSelectable,c=e.onClick,l=e.onDoubleClick,s=e.onContextMenu,f=e.onMouseEnter,d=e.onMouseMove,h=e.onMouseLeave,v=e.edgeUpdaterRadius,g=e.onEdgeUpdate,y=e.onEdgeUpdateStart,m=e.onEdgeUpdateEnd,x=e.rfId,b=e.edgeTypes,_=e.noPanClassName,E=e.onError,S=e.disableKeyboardA11y,k=tw((function(n){return n.edgeLookup.get(r)})),C=tw((function(n){return n.defaultEdgeOptions})),M=(k=C?t(t({},C),k):k).type||"default",N=(null==b?void 0:b[M])||f_[M];void 0===N&&(null==E||E("011",pv(M)),M="default",N=f_.default);var O=!!(k.focusable||o&&void 0===k.focusable),P=void 0!==g&&(k.updatable||i&&void 0===k.updatable),j=!!(k.selectable||u&&void 0===k.selectable),I=n.useRef(null),A=a(n.useState(!1),2),z=A[0],L=A[1],T=a(n.useState(!1),2),B=T[0],R=T[1],D=rw(),V=tw(n.useCallback((function(n){var e=n.nodeLookup.get(k.source),o=n.nodeLookup.get(k.target);if(!e||!o)return t({zIndex:k.zIndex},d_);var i=function(n){var e,t,r,o,i,u=n.sourceNode,c=n.targetNode;if(!m_(u)||!m_(c))return null;var l=u.internals.handleBounds||x_(u.handles),s=c.internals.handleBounds||x_(c.handles),f=b_(null!==(e=null==l?void 0:l.source)&&void 0!==e?e:[],n.sourceHandle),d=b_(n.connectionMode===exports.ConnectionMode.Strict?null!==(t=null==s?void 0:s.target)&&void 0!==t?t:[]:(null!==(r=null==s?void 0:s.target)&&void 0!==r?r:[]).concat(null!==(o=null==s?void 0:s.source)&&void 0!==o?o:[]),n.targetHandle),h=(null==f?void 0:f.position)||exports.Position.Bottom,v=(null==d?void 0:d.position)||exports.Position.Top;if(!f||!d)return null===(i=n.onError)||void 0===i||i.call(n,"008",hv(f?"target":"source",{id:n.id,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle})),null;var p=a(w_(h,u,f),2),g=p[0],y=p[1],m=a(w_(v,c,d),2);return{sourceX:g,sourceY:y,targetX:m[0],targetY:m[1],sourcePosition:h,targetPosition:v}}({id:r,sourceNode:e,targetNode:o,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:n.connectionMode,onError:E}),u=function(n){var e=n.sourceNode,t=n.targetNode,r=n.selected,o=void 0!==r&&r,i=n.zIndex,u=void 0===i?0:i,a=n.elevateOnSelect;if(void 0===a||!a)return u;var c=o||t.selected||e.selected,l=Math.max(e.internals.z||0,t.internals.z||0,1e3);return u+(c?l:0)}({selected:k.selected,zIndex:k.zIndex,sourceNode:e,targetNode:o,elevateOnSelect:n.elevateEdgesOnSelect});return t({zIndex:u},i||d_)}),[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),Rw),H=V.zIndex,Y=V.sourceX,Z=V.sourceY,X=V.targetX,U=V.targetY,F=V.sourcePosition,W=V.targetPosition,$=n.useMemo((function(){return k.markerStart?"url('#".concat(Hb(k.markerStart,x),"')"):void 0}),[k.markerStart,x]),G=n.useMemo((function(){return k.markerEnd?"url('#".concat(Hb(k.markerEnd,x),"')"):void 0}),[k.markerEnd,x]);if(k.hidden||null===Y||null===Z||null===X||null===U)return null;var q=l?function(n){l(n,t({},k))}:void 0,K=s?function(n){s(n,t({},k))}:void 0,Q=f?function(n){f(n,t({},k))}:void 0,J=d?function(n){d(n,t({},k))}:void 0,nn=h?function(n){h(n,t({},k))}:void 0;return p.jsx("svg",{style:{zIndex:H},children:p.jsxs("g",{className:w(["ink-flow__edge","ink-flow__edge-".concat(M),k.className,_,{selected:k.selected,animated:k.animated,inactive:!j&&!c,updating:z,selectable:j}]),onClick:function(n){var e,t=D.getState(),o=t.addSelectedEdges,i=t.unselectNodesAndEdges,u=t.multiSelectionActive;j&&(D.setState({nodesSelectionActive:!1}),k.selected&&u?(i({nodes:[],edges:[k]}),null===(e=I.current)||void 0===e||e.blur()):o([r])),c&&c(n,k)},onDoubleClick:q,onContextMenu:K,onMouseEnter:Q,onMouseMove:J,onMouseLeave:nn,onKeyDown:O?function(n){var e;if(!S&&mv.includes(n.key)&&j){var t=D.getState(),o=t.unselectNodesAndEdges,i=t.addSelectedEdges;"Escape"===n.key?(null===(e=I.current)||void 0===e||e.blur(),o({edges:[k]})):i([r])}}:void 0,tabIndex:O?0:void 0,role:O?"button":"img","data-id":r,"data-testid":"rf__edge-".concat(r),"aria-label":null===k.ariaLabel?void 0:k.ariaLabel||"Edge from ".concat(k.source," to ").concat(k.target),"aria-describedby":O?"".concat("ink-flow__edge-desc","-").concat(x):void 0,ref:I,children:[!B&&p.jsx(N,{id:r,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:Y,sourceY:Z,targetX:X,targetY:U,sourcePosition:F,targetPosition:W,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:$,markerEnd:G,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),P&&p.jsx(y_,{edge:k,isUpdatable:P,edgeUpdaterRadius:v,onEdgeUpdate:g,onEdgeUpdateStart:y,onEdgeUpdateEnd:m,sourceX:Y,sourceY:Z,targetX:X,targetY:U,sourcePosition:F,targetPosition:W,setUpdateHover:L,setUpdating:R,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle})]})})}var E_=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 S_(e){var t=e.defaultMarkerColor,r=e.rfId,o=e.noPanClassName,i=e.onEdgeUpdate,u=e.onEdgeContextMenu,a=e.onEdgeMouseEnter,c=e.onEdgeMouseMove,l=e.onEdgeMouseLeave,s=e.onEdgeClick,f=e.edgeTypes,d=tw(E_,Rw),h=d.edgesFocusable,v=d.edgesUpdatable,g=d.elementsSelectable,y=d.onError,m=function(e){var t=tw(n.useCallback((function(n){return n.edges.map((function(n){return n.id}))}),[e]),Rw);return t}(!1);return p.jsxs("div",{className:"ink-flow__edges",children:[p.jsx(Xb,{defaultColor:t,rfId:r}),m.map((function(n){return p.jsx(__,{id:n,edgesFocusable:h,edgesUpdatable:v,elementsSelectable:g,noPanClassName:o,onEdgeUpdate:i,onContextMenu:u,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,onClick:s,rfId:r,onError:y,edgeTypes:f},n)}))]})}S_.displayName="EdgeRenderer";var k_,C_=n.memo(S_),M_=function(n){return"translate(".concat(n.transform[0],"px,").concat(n.transform[1],"px) scale(").concat(n.transform[2],")")};function N_(n){var e=n.children,t=tw(M_);return p.jsx("div",{className:"ink-flow__viewport xyflow__viewport ink-flow__container",style:{transform:t},children:e})}var O_=((k_={})[exports.Position.Left]=exports.Position.Right,k_[exports.Position.Right]=exports.Position.Left,k_[exports.Position.Top]=exports.Position.Bottom,k_[exports.Position.Bottom]=exports.Position.Top,k_),P_=function(e){var r,o,i=e.nodeId,u=e.handleType,c=e.style,l=e.type,s=void 0===l?exports.ConnectionLineType.Bezier:l,f=e.CustomComponent,d=e.connectionStatus,h=tw(n.useCallback((function(n){var e;return{fromNode:n.nodeLookup.get(i),handleId:null===(e=n.connectionStartHandle)||void 0===e?void 0:e.handleId,toX:(n.connectionPosition.x-n.transform[0])/n.transform[2],toY:(n.connectionPosition.y-n.transform[1])/n.transform[2],connectionMode:n.connectionMode}}),[i]),Rw),v=h.fromNode,g=h.handleId,y=h.toX,m=h.toY,x=h.connectionMode,w=null==v?void 0:v.internals.handleBounds,b=null==w?void 0:w[u];if(x===exports.ConnectionMode.Loose&&(b=b||(null==w?void 0:w["source"===u?"target":"source"])),!v||!b)return null;var _=g?b.find((function(n){return n.id===g})):b[0],E=_?_.x+_.width/2:(null!==(r=v.measured.width)&&void 0!==r?r:0)/2,S=_?_.y+_.height/2:null!==(o=v.measured.height)&&void 0!==o?o:0,k=v.internals.positionAbsolute.x+E,C=v.internals.positionAbsolute.y+S,M=null==_?void 0:_.position,N=M?O_[M]:null;if(!M||!N)return null;if(f)return p.jsx(f,{connectionLineType:s,connectionLineStyle:c,fromNode:v,fromHandle:_,fromX:k,fromY:C,toX:y,toY:m,fromPosition:M,toPosition:N,connectionStatus:d});var O="",P={sourceX:k,sourceY:C,sourcePosition:M,targetX:y,targetY:m,targetPosition:N};return O=s===exports.ConnectionLineType.Bezier?a(Uv(P),1)[0]:s===exports.ConnectionLineType.Step?a(Qv(t(t({},P),{borderRadius:0})),1)[0]:s===exports.ConnectionLineType.SmoothStep?a(Qv(P),1)[0]:s===exports.ConnectionLineType.SimpleBezier?a(Gb(P),1)[0]:"M".concat(k,",").concat(C," ").concat(y,",").concat(m),p.jsx("path",{d:O,fill:"none",className:"react-flow__connection-path",style:c})};P_.displayName="ConnectionLine";var j_=function(n){var e,t;return{nodeId:null===(e=n.connectionStartHandle)||void 0===e?void 0:e.nodeId,handleType:null===(t=n.connectionStartHandle)||void 0===t?void 0:t.type,nodesConnectable:n.nodesConnectable,connectionStatus:n.connectionStatus,width:n.width,height:n.height}};function I_(n){var e=n.containerStyle,t=n.style,r=n.type,o=n.component,i=tw(j_,Rw),u=i.nodeId,a=i.handleType,c=i.nodesConnectable,l=i.width,s=i.height,f=i.connectionStatus;return!!(u&&a&&l&&c)?p.jsx("svg",{style:e,width:l,height:s,className:"react-flow__connectionline react-flow__container",children:p.jsx("g",{className:w(["react-flow__connection",f]),children:p.jsx(P_,{nodeId:u,handleType:a,style:t,type:r,CustomComponent:o,connectionStatus:f})})}):null}function A_(n){var e=n.onNodeClick,t=n.onNodeDoubleClick,r=n.onNodeMouseEnter,o=n.onNodeMouseMove,i=n.onNodeMouseLeave,u=n.onNodeContextMenu,a=n.onEdgeClick,c=n.onEdgeDoubleClick,l=n.onEdgeMouseEnter,s=n.onEdgeMouseMove,f=n.onEdgeMouseLeave,d=n.onEdgeContextMenu,h=n.rfId,v=n.minZoom,g=n.maxZoom,y=n.noPanClassName,m=n.noDragClassName,x=n.nodeOrigin,w=n.viewport,b=n.disableKeyboardA11y,_=n.translateExtent,E=n.defaultViewport,S=n.nodeTypes,k=n.edgeTypes,C=n.elementsSelectable,M=n.defaultMarkerColor,N=n.connectionLineType,O=n.connectionLineStyle,P=n.connectionLineComponent,j=n.connectionLineContainerStyle,I=n.onPaneClick,A=n.onPaneContextMenu,z=n.onPaneMouseEnter,L=n.onPaneMouseMove,T=n.onPaneMouseLeave,B=n.onPaneScroll;return p.jsx(cb,{minZoom:v,maxZoom:g,noPanClassName:y,noDragClassName:m,isControlledViewport:!!w,disableKeyboardA11y:b,translateExtent:_,defaultViewport:E,elementsSelectable:C,onPaneClick:I,onPaneContextMenu:A,onPaneMouseEnter:z,onPaneMouseMove:L,onPaneMouseLeave:T,onPaneScroll:B,children:p.jsxs(N_,{children:[p.jsx(C_,{rfId:h,edgeTypes:k,noPanClassName:y,onEdgeClick:a,onEdgeDoubleClick:c,onEdgeMouseEnter:l,onEdgeMouseMove:s,onEdgeMouseLeave:f,onEdgeContextMenu:d,defaultMarkerColor:M}),p.jsx(I_,{style:O,type:N,component:P,containerStyle:j}),p.jsx("div",{className:"ink-flow__edgelabel-renderer"}),p.jsx(Db,{rfId:h,nodeTypes:S,nodeOrigin:x,noDragClassName:m,noPanClassName:y,disableKeyboardA11y:!1,onNodeClick:e,onNodeDoubleClick:t,onNodeMouseEnter:r,onNodeMouseMove:o,onNodeMouseLeave:i,onNodeContextMenu:u}),p.jsx("div",{className:"ink-flow__viewport-portal"})]})})}A_.displayName="GraphView";var z_=n.memo(A_),L_={x:0,y:0,zoom:1},T_={type:"dagre",options:{rankdir:"TB",ranksep:100,nodesep:50}},B_=function(n){var e,t,r=void 0===n?{}:n,o=r.nodes,i=r.edges,u=r.defaultNodes,a=r.defaultEdges;r.width,r.height,r.fitView;var c=new Map,l=new Map,s=new Map,f=new Map,d=null!==(e=null!=a?a:i)&&void 0!==e?e:[],h=null!==(t=null!=u?u:o)&&void 0!==t?t:[];aw(s,f,d),cw(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:d,edgeLookup:f,connectionLookup:s,hasDefaultNodes:void 0!==u,hasDefaultEdges:void 0!==a,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:yv,nodeExtent:yv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:exports.ConnectionMode.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,fitViewOnInit:!1,fitViewDone:!1,fitViewOnInitOptions:void 0,selectNodesOnDrag:!0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:void 0,isValidConnection:void 0,onSelectionChangeHandlers:[],autoLayout:!1,layoutConfig:T_,layoutTypes:{},layoutComplete:!1,centerConfig:{},centered:!1,lib:"react",debug:!1}},R_={dagre:Jv};var D_={exports:{}};
17
+ /**
18
+ * @license
19
+ * Lodash <https://lodash.com/>
20
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
21
+ * Released under MIT license <https://lodash.com/license>
22
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
23
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
24
+ */!function(n,e){(function(){var t,r="Expected a function",o="__lodash_hash_undefined__",i="__lodash_placeholder__",u=16,a=32,c=64,s=128,f=256,d=1/0,h=9007199254740991,v=NaN,p=4294967295,g=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",u],["flip",512],["partial",a],["partialRight",c],["rearg",f]],y="[object Arguments]",m="[object Array]",x="[object Boolean]",w="[object Date]",b="[object Error]",_="[object Function]",E="[object GeneratorFunction]",S="[object Map]",k="[object Number]",C="[object Object]",M="[object Promise]",N="[object RegExp]",O="[object Set]",P="[object String]",j="[object Symbol]",I="[object WeakMap]",A="[object ArrayBuffer]",z="[object DataView]",L="[object Float32Array]",T="[object Float64Array]",B="[object Int8Array]",R="[object Int16Array]",D="[object Int32Array]",V="[object Uint8Array]",H="[object Uint8ClampedArray]",Y="[object Uint16Array]",Z="[object Uint32Array]",X=/\b__p \+= '';/g,U=/\b(__p \+=) '' \+/g,F=/(__e\(.*?\)|\b__t\)) \+\n'';/g,W=/&(?:amp|lt|gt|quot|#39);/g,$=/[&<>"']/g,G=RegExp(W.source),q=RegExp($.source),K=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,nn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,en=/^\w*$/,tn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,rn=/[\\^$.*+?()[\]{}|]/g,on=RegExp(rn.source),un=/^\s+/,an=/\s/,cn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ln=/\{\n\/\* \[wrapped with (.+)\] \*/,sn=/,? & /,fn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,dn=/[()=,{}\[\]\/\s]/,hn=/\\(\\)?/g,vn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pn=/\w*$/,gn=/^[-+]0x[0-9a-f]+$/i,yn=/^0b[01]+$/i,mn=/^\[object .+?Constructor\]$/,xn=/^0o[0-7]+$/i,wn=/^(?:0|[1-9]\d*)$/,bn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_n=/($^)/,En=/['\n\r\u2028\u2029\\]/g,Sn="\\ud800-\\udfff",kn="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Cn="\\u2700-\\u27bf",Mn="a-z\\xdf-\\xf6\\xf8-\\xff",Nn="A-Z\\xc0-\\xd6\\xd8-\\xde",On="\\ufe0e\\ufe0f",Pn="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",jn="['’]",In="["+Sn+"]",An="["+Pn+"]",zn="["+kn+"]",Ln="\\d+",Tn="["+Cn+"]",Bn="["+Mn+"]",Rn="[^"+Sn+Pn+Ln+Cn+Mn+Nn+"]",Dn="\\ud83c[\\udffb-\\udfff]",Vn="[^"+Sn+"]",Hn="(?:\\ud83c[\\udde6-\\uddff]){2}",Yn="[\\ud800-\\udbff][\\udc00-\\udfff]",Zn="["+Nn+"]",Xn="\\u200d",Un="(?:"+Bn+"|"+Rn+")",Fn="(?:"+Zn+"|"+Rn+")",Wn="(?:['’](?:d|ll|m|re|s|t|ve))?",$n="(?:['’](?:D|LL|M|RE|S|T|VE))?",Gn="(?:"+zn+"|"+Dn+")"+"?",qn="["+On+"]?",Kn=qn+Gn+("(?:"+Xn+"(?:"+[Vn,Hn,Yn].join("|")+")"+qn+Gn+")*"),Qn="(?:"+[Tn,Hn,Yn].join("|")+")"+Kn,Jn="(?:"+[Vn+zn+"?",zn,Hn,Yn,In].join("|")+")",ne=RegExp(jn,"g"),ee=RegExp(zn,"g"),te=RegExp(Dn+"(?="+Dn+")|"+Jn+Kn,"g"),re=RegExp([Zn+"?"+Bn+"+"+Wn+"(?="+[An,Zn,"$"].join("|")+")",Fn+"+"+$n+"(?="+[An,Zn+Un,"$"].join("|")+")",Zn+"?"+Un+"+"+Wn,Zn+"+"+$n,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ln,Qn].join("|"),"g"),oe=RegExp("["+Xn+Sn+kn+On+"]"),ie=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ue=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ae=-1,ce={};ce[L]=ce[T]=ce[B]=ce[R]=ce[D]=ce[V]=ce[H]=ce[Y]=ce[Z]=!0,ce[y]=ce[m]=ce[A]=ce[x]=ce[z]=ce[w]=ce[b]=ce[_]=ce[S]=ce[k]=ce[C]=ce[N]=ce[O]=ce[P]=ce[I]=!1;var le={};le[y]=le[m]=le[A]=le[z]=le[x]=le[w]=le[L]=le[T]=le[B]=le[R]=le[D]=le[S]=le[k]=le[C]=le[N]=le[O]=le[P]=le[j]=le[V]=le[H]=le[Y]=le[Z]=!0,le[b]=le[_]=le[I]=!1;var se={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},fe=parseFloat,de=parseInt,he="object"==typeof l&&l&&l.Object===Object&&l,ve="object"==typeof self&&self&&self.Object===Object&&self,pe=he||ve||Function("return this")(),ge=e&&!e.nodeType&&e,ye=ge&&n&&!n.nodeType&&n,me=ye&&ye.exports===ge,xe=me&&he.process,we=function(){try{var n=ye&&ye.require&&ye.require("util").types;return n||xe&&xe.binding&&xe.binding("util")}catch(n){}}(),be=we&&we.isArrayBuffer,_e=we&&we.isDate,Ee=we&&we.isMap,Se=we&&we.isRegExp,ke=we&&we.isSet,Ce=we&&we.isTypedArray;function Me(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)}function Ne(n,e,t,r){for(var o=-1,i=null==n?0:n.length;++o<i;){var u=n[o];e(r,u,t(u),n)}return r}function Oe(n,e){for(var t=-1,r=null==n?0:n.length;++t<r&&!1!==e(n[t],t,n););return n}function Pe(n,e){for(var t=null==n?0:n.length;t--&&!1!==e(n[t],t,n););return n}function je(n,e){for(var t=-1,r=null==n?0:n.length;++t<r;)if(!e(n[t],t,n))return!1;return!0}function Ie(n,e){for(var t=-1,r=null==n?0:n.length,o=0,i=[];++t<r;){var u=n[t];e(u,t,n)&&(i[o++]=u)}return i}function Ae(n,e){return!!(null==n?0:n.length)&&Ze(n,e,0)>-1}function ze(n,e,t){for(var r=-1,o=null==n?0:n.length;++r<o;)if(t(e,n[r]))return!0;return!1}function Le(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}function Te(n,e){for(var t=-1,r=e.length,o=n.length;++t<r;)n[o+t]=e[t];return n}function Be(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}function Re(n,e,t,r){var o=null==n?0:n.length;for(r&&o&&(t=n[--o]);o--;)t=e(t,n[o],o,n);return t}function De(n,e){for(var t=-1,r=null==n?0:n.length;++t<r;)if(e(n[t],t,n))return!0;return!1}var Ve=We("length");function He(n,e,t){var r;return t(n,(function(n,t,o){if(e(n,t,o))return r=t,!1})),r}function Ye(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}function Ze(n,e,t){return e==e?function(n,e,t){var r=t-1,o=n.length;for(;++r<o;)if(n[r]===e)return r;return-1}(n,e,t):Ye(n,Ue,t)}function Xe(n,e,t,r){for(var o=t-1,i=n.length;++o<i;)if(r(n[o],e))return o;return-1}function Ue(n){return n!=n}function Fe(n,e){var t=null==n?0:n.length;return t?qe(n,e)/t:v}function We(n){return function(e){return null==e?t:e[n]}}function $e(n){return function(e){return null==n?t:n[e]}}function Ge(n,e,t,r,o){return o(n,(function(n,o,i){t=r?(r=!1,n):e(t,n,o,i)})),t}function qe(n,e){for(var r,o=-1,i=n.length;++o<i;){var u=e(n[o]);u!==t&&(r=r===t?u:r+u)}return r}function Ke(n,e){for(var t=-1,r=Array(n);++t<n;)r[t]=e(t);return r}function Qe(n){return n?n.slice(0,pt(n)+1).replace(un,""):n}function Je(n){return function(e){return n(e)}}function nt(n,e){return Le(e,(function(e){return n[e]}))}function et(n,e){return n.has(e)}function tt(n,e){for(var t=-1,r=n.length;++t<r&&Ze(e,n[t],0)>-1;);return t}function rt(n,e){for(var t=n.length;t--&&Ze(e,n[t],0)>-1;);return t}var ot=$e({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),it=$e({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function ut(n){return"\\"+se[n]}function at(n){return oe.test(n)}function ct(n){var e=-1,t=Array(n.size);return n.forEach((function(n,r){t[++e]=[r,n]})),t}function lt(n,e){return function(t){return n(e(t))}}function st(n,e){for(var t=-1,r=n.length,o=0,u=[];++t<r;){var a=n[t];a!==e&&a!==i||(n[t]=i,u[o++]=t)}return u}function ft(n){var e=-1,t=Array(n.size);return n.forEach((function(n){t[++e]=n})),t}function dt(n){var e=-1,t=Array(n.size);return n.forEach((function(n){t[++e]=[n,n]})),t}function ht(n){return at(n)?function(n){var e=te.lastIndex=0;for(;te.test(n);)++e;return e}(n):Ve(n)}function vt(n){return at(n)?function(n){return n.match(te)||[]}(n):function(n){return n.split("")}(n)}function pt(n){for(var e=n.length;e--&&an.test(n.charAt(e)););return e}var gt=$e({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var yt=function n(e){var l,an=(e=null==e?pe:yt.defaults(pe.Object(),e,yt.pick(pe,ue))).Array,Sn=e.Date,kn=e.Error,Cn=e.Function,Mn=e.Math,Nn=e.Object,On=e.RegExp,Pn=e.String,jn=e.TypeError,In=an.prototype,An=Cn.prototype,zn=Nn.prototype,Ln=e["__core-js_shared__"],Tn=An.toString,Bn=zn.hasOwnProperty,Rn=0,Dn=(l=/[^.]+$/.exec(Ln&&Ln.keys&&Ln.keys.IE_PROTO||""))?"Symbol(src)_1."+l:"",Vn=zn.toString,Hn=Tn.call(Nn),Yn=pe._,Zn=On("^"+Tn.call(Bn).replace(rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xn=me?e.Buffer:t,Un=e.Symbol,Fn=e.Uint8Array,Wn=Xn?Xn.allocUnsafe:t,$n=lt(Nn.getPrototypeOf,Nn),Gn=Nn.create,qn=zn.propertyIsEnumerable,Kn=In.splice,Qn=Un?Un.isConcatSpreadable:t,Jn=Un?Un.iterator:t,te=Un?Un.toStringTag:t,oe=function(){try{var n=hi(Nn,"defineProperty");return n({},"",{}),n}catch(n){}}(),se=e.clearTimeout!==pe.clearTimeout&&e.clearTimeout,he=Sn&&Sn.now!==pe.Date.now&&Sn.now,ve=e.setTimeout!==pe.setTimeout&&e.setTimeout,ge=Mn.ceil,ye=Mn.floor,xe=Nn.getOwnPropertySymbols,we=Xn?Xn.isBuffer:t,Ve=e.isFinite,$e=In.join,mt=lt(Nn.keys,Nn),xt=Mn.max,wt=Mn.min,bt=Sn.now,_t=e.parseInt,Et=Mn.random,St=In.reverse,kt=hi(e,"DataView"),Ct=hi(e,"Map"),Mt=hi(e,"Promise"),Nt=hi(e,"Set"),Ot=hi(e,"WeakMap"),Pt=hi(Nn,"create"),jt=Ot&&new Ot,It={},At=Di(kt),zt=Di(Ct),Lt=Di(Mt),Tt=Di(Nt),Bt=Di(Ot),Rt=Un?Un.prototype:t,Dt=Rt?Rt.valueOf:t,Vt=Rt?Rt.toString:t;function Ht(n){if(ta(n)&&!Uu(n)&&!(n instanceof Ut)){if(n instanceof Xt)return n;if(Bn.call(n,"__wrapped__"))return Vi(n)}return new Xt(n)}var Yt=function(){function n(){}return function(e){if(!ea(e))return{};if(Gn)return Gn(e);n.prototype=e;var r=new n;return n.prototype=t,r}}();function Zt(){}function Xt(n,e){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=t}function Ut(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function Ft(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])}}function Wt(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])}}function $t(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])}}function Gt(n){var e=-1,t=null==n?0:n.length;for(this.__data__=new $t;++e<t;)this.add(n[e])}function qt(n){var e=this.__data__=new Wt(n);this.size=e.size}function Kt(n,e){var t=Uu(n),r=!t&&Xu(n),o=!t&&!r&&Gu(n),i=!t&&!r&&!o&&sa(n),u=t||r||o||i,a=u?Ke(n.length,Pn):[],c=a.length;for(var l in n)!e&&!Bn.call(n,l)||u&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||wi(l,c))||a.push(l);return a}function Qt(n){var e=n.length;return e?n[Gr(0,e-1)]:t}function Jt(n,e){return Ti(jo(n),cr(e,0,n.length))}function nr(n){return Ti(jo(n))}function er(n,e,r){(r!==t&&!Hu(n[e],r)||r===t&&!(e in n))&&ur(n,e,r)}function tr(n,e,r){var o=n[e];Bn.call(n,e)&&Hu(o,r)&&(r!==t||e in n)||ur(n,e,r)}function rr(n,e){for(var t=n.length;t--;)if(Hu(n[t][0],e))return t;return-1}function or(n,e,t,r){return hr(n,(function(n,o,i){e(r,n,t(n),i)})),r}function ir(n,e){return n&&Io(e,Ia(e),n)}function ur(n,e,t){"__proto__"==e&&oe?oe(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}function ar(n,e){for(var r=-1,o=e.length,i=an(o),u=null==n;++r<o;)i[r]=u?t:Ma(n,e[r]);return i}function cr(n,e,r){return n==n&&(r!==t&&(n=n<=r?n:r),e!==t&&(n=n>=e?n:e)),n}function lr(n,e,r,o,i,u){var a,c=1&e,l=2&e,s=4&e;if(r&&(a=i?r(n,o,i,u):r(n)),a!==t)return a;if(!ea(n))return n;var f=Uu(n);if(f){if(a=function(n){var e=n.length,t=new n.constructor(e);e&&"string"==typeof n[0]&&Bn.call(n,"index")&&(t.index=n.index,t.input=n.input);return t}(n),!c)return jo(n,a)}else{var d=gi(n),h=d==_||d==E;if(Gu(n))return ko(n,c);if(d==C||d==y||h&&!i){if(a=l||h?{}:mi(n),!c)return l?function(n,e){return Io(n,pi(n),e)}(n,function(n,e){return n&&Io(e,Aa(e),n)}(a,n)):function(n,e){return Io(n,vi(n),e)}(n,ir(a,n))}else{if(!le[d])return i?n:{};a=function(n,e,t){var r=n.constructor;switch(e){case A:return Co(n);case x:case w:return new r(+n);case z:return function(n,e){var t=e?Co(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.byteLength)}(n,t);case L:case T:case B:case R:case D:case V:case H:case Y:case Z:return Mo(n,t);case S:return new r;case k:case P:return new r(n);case N:return function(n){var e=new n.constructor(n.source,pn.exec(n));return e.lastIndex=n.lastIndex,e}(n);case O:return new r;case j:return o=n,Dt?Nn(Dt.call(o)):{}}var o}(n,d,c)}}u||(u=new qt);var v=u.get(n);if(v)return v;u.set(n,a),aa(n)?n.forEach((function(t){a.add(lr(t,e,r,t,n,u))})):ra(n)&&n.forEach((function(t,o){a.set(o,lr(t,e,r,o,n,u))}));var p=f?t:(s?l?ui:ii:l?Aa:Ia)(n);return Oe(p||n,(function(t,o){p&&(t=n[o=t]),tr(a,o,lr(t,e,r,o,n,u))})),a}function sr(n,e,r){var o=r.length;if(null==n)return!o;for(n=Nn(n);o--;){var i=r[o],u=e[i],a=n[i];if(a===t&&!(i in n)||!u(a))return!1}return!0}function fr(n,e,o){if("function"!=typeof n)throw new jn(r);return Ii((function(){n.apply(t,o)}),e)}function dr(n,e,t,r){var o=-1,i=Ae,u=!0,a=n.length,c=[],l=e.length;if(!a)return c;t&&(e=Le(e,Je(t))),r?(i=ze,u=!1):e.length>=200&&(i=et,u=!1,e=new Gt(e));n:for(;++o<a;){var s=n[o],f=null==t?s:t(s);if(s=r||0!==s?s:0,u&&f==f){for(var d=l;d--;)if(e[d]===f)continue n;c.push(s)}else i(e,f,r)||c.push(s)}return c}Ht.templateSettings={escape:K,evaluate:Q,interpolate:J,variable:"",imports:{_:Ht}},Ht.prototype=Zt.prototype,Ht.prototype.constructor=Ht,Xt.prototype=Yt(Zt.prototype),Xt.prototype.constructor=Xt,Ut.prototype=Yt(Zt.prototype),Ut.prototype.constructor=Ut,Ft.prototype.clear=function(){this.__data__=Pt?Pt(null):{},this.size=0},Ft.prototype.delete=function(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e},Ft.prototype.get=function(n){var e=this.__data__;if(Pt){var r=e[n];return r===o?t:r}return Bn.call(e,n)?e[n]:t},Ft.prototype.has=function(n){var e=this.__data__;return Pt?e[n]!==t:Bn.call(e,n)},Ft.prototype.set=function(n,e){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=Pt&&e===t?o:e,this},Wt.prototype.clear=function(){this.__data__=[],this.size=0},Wt.prototype.delete=function(n){var e=this.__data__,t=rr(e,n);return!(t<0)&&(t==e.length-1?e.pop():Kn.call(e,t,1),--this.size,!0)},Wt.prototype.get=function(n){var e=this.__data__,r=rr(e,n);return r<0?t:e[r][1]},Wt.prototype.has=function(n){return rr(this.__data__,n)>-1},Wt.prototype.set=function(n,e){var t=this.__data__,r=rr(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this},$t.prototype.clear=function(){this.size=0,this.__data__={hash:new Ft,map:new(Ct||Wt),string:new Ft}},$t.prototype.delete=function(n){var e=fi(this,n).delete(n);return this.size-=e?1:0,e},$t.prototype.get=function(n){return fi(this,n).get(n)},$t.prototype.has=function(n){return fi(this,n).has(n)},$t.prototype.set=function(n,e){var t=fi(this,n),r=t.size;return t.set(n,e),this.size+=t.size==r?0:1,this},Gt.prototype.add=Gt.prototype.push=function(n){return this.__data__.set(n,o),this},Gt.prototype.has=function(n){return this.__data__.has(n)},qt.prototype.clear=function(){this.__data__=new Wt,this.size=0},qt.prototype.delete=function(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t},qt.prototype.get=function(n){return this.__data__.get(n)},qt.prototype.has=function(n){return this.__data__.has(n)},qt.prototype.set=function(n,e){var t=this.__data__;if(t instanceof Wt){var r=t.__data__;if(!Ct||r.length<199)return r.push([n,e]),this.size=++t.size,this;t=this.__data__=new $t(r)}return t.set(n,e),this.size=t.size,this};var hr=Lo(br),vr=Lo(_r,!0);function pr(n,e){var t=!0;return hr(n,(function(n,r,o){return t=!!e(n,r,o)})),t}function gr(n,e,r){for(var o=-1,i=n.length;++o<i;){var u=n[o],a=e(u);if(null!=a&&(c===t?a==a&&!la(a):r(a,c)))var c=a,l=u}return l}function yr(n,e){var t=[];return hr(n,(function(n,r,o){e(n,r,o)&&t.push(n)})),t}function mr(n,e,t,r,o){var i=-1,u=n.length;for(t||(t=xi),o||(o=[]);++i<u;){var a=n[i];e>0&&t(a)?e>1?mr(a,e-1,t,r,o):Te(o,a):r||(o[o.length]=a)}return o}var xr=To(),wr=To(!0);function br(n,e){return n&&xr(n,e,Ia)}function _r(n,e){return n&&wr(n,e,Ia)}function Er(n,e){return Ie(e,(function(e){return Qu(n[e])}))}function Sr(n,e){for(var r=0,o=(e=bo(e,n)).length;null!=n&&r<o;)n=n[Ri(e[r++])];return r&&r==o?n:t}function kr(n,e,t){var r=e(n);return Uu(n)?r:Te(r,t(n))}function Cr(n){return null==n?n===t?"[object Undefined]":"[object Null]":te&&te in Nn(n)?function(n){var e=Bn.call(n,te),r=n[te];try{n[te]=t;var o=!0}catch(n){}var i=Vn.call(n);o&&(e?n[te]=r:delete n[te]);return i}(n):function(n){return Vn.call(n)}(n)}function Mr(n,e){return n>e}function Nr(n,e){return null!=n&&Bn.call(n,e)}function Or(n,e){return null!=n&&e in Nn(n)}function Pr(n,e,r){for(var o=r?ze:Ae,i=n[0].length,u=n.length,a=u,c=an(u),l=1/0,s=[];a--;){var f=n[a];a&&e&&(f=Le(f,Je(e))),l=wt(f.length,l),c[a]=!r&&(e||i>=120&&f.length>=120)?new Gt(a&&f):t}f=n[0];var d=-1,h=c[0];n:for(;++d<i&&s.length<l;){var v=f[d],p=e?e(v):v;if(v=r||0!==v?v:0,!(h?et(h,p):o(s,p,r))){for(a=u;--a;){var g=c[a];if(!(g?et(g,p):o(n[a],p,r)))continue n}h&&h.push(p),s.push(v)}}return s}function jr(n,e,r){var o=null==(n=Oi(n,e=bo(e,n)))?n:n[Ri(Ki(e))];return null==o?t:Me(o,n,r)}function Ir(n){return ta(n)&&Cr(n)==y}function Ar(n,e,r,o,i){return n===e||(null==n||null==e||!ta(n)&&!ta(e)?n!=n&&e!=e:function(n,e,r,o,i,u){var a=Uu(n),c=Uu(e),l=a?m:gi(n),s=c?m:gi(e),f=(l=l==y?C:l)==C,d=(s=s==y?C:s)==C,h=l==s;if(h&&Gu(n)){if(!Gu(e))return!1;a=!0,f=!1}if(h&&!f)return u||(u=new qt),a||sa(n)?ri(n,e,r,o,i,u):function(n,e,t,r,o,i,u){switch(t){case z:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case A:return!(n.byteLength!=e.byteLength||!i(new Fn(n),new Fn(e)));case x:case w:case k:return Hu(+n,+e);case b:return n.name==e.name&&n.message==e.message;case N:case P:return n==e+"";case S:var a=ct;case O:var c=1&r;if(a||(a=ft),n.size!=e.size&&!c)return!1;var l=u.get(n);if(l)return l==e;r|=2,u.set(n,e);var s=ri(a(n),a(e),r,o,i,u);return u.delete(n),s;case j:if(Dt)return Dt.call(n)==Dt.call(e)}return!1}(n,e,l,r,o,i,u);if(!(1&r)){var v=f&&Bn.call(n,"__wrapped__"),p=d&&Bn.call(e,"__wrapped__");if(v||p){var g=v?n.value():n,_=p?e.value():e;return u||(u=new qt),i(g,_,r,o,u)}}if(!h)return!1;return u||(u=new qt),function(n,e,r,o,i,u){var a=1&r,c=ii(n),l=c.length,s=ii(e),f=s.length;if(l!=f&&!a)return!1;var d=l;for(;d--;){var h=c[d];if(!(a?h in e:Bn.call(e,h)))return!1}var v=u.get(n),p=u.get(e);if(v&&p)return v==e&&p==n;var g=!0;u.set(n,e),u.set(e,n);var y=a;for(;++d<l;){var m=n[h=c[d]],x=e[h];if(o)var w=a?o(x,m,h,e,n,u):o(m,x,h,n,e,u);if(!(w===t?m===x||i(m,x,r,o,u):w)){g=!1;break}y||(y="constructor"==h)}if(g&&!y){var b=n.constructor,_=e.constructor;b==_||!("constructor"in n)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(g=!1)}return u.delete(n),u.delete(e),g}(n,e,r,o,i,u)}(n,e,r,o,Ar,i))}function zr(n,e,r,o){var i=r.length,u=i,a=!o;if(null==n)return!u;for(n=Nn(n);i--;){var c=r[i];if(a&&c[2]?c[1]!==n[c[0]]:!(c[0]in n))return!1}for(;++i<u;){var l=(c=r[i])[0],s=n[l],f=c[1];if(a&&c[2]){if(s===t&&!(l in n))return!1}else{var d=new qt;if(o)var h=o(s,f,l,n,e,d);if(!(h===t?Ar(f,s,3,o,d):h))return!1}}return!0}function Lr(n){return!(!ea(n)||(e=n,Dn&&Dn in e))&&(Qu(n)?Zn:mn).test(Di(n));var e}function Tr(n){return"function"==typeof n?n:null==n?oc:"object"==typeof n?Uu(n)?Yr(n[0],n[1]):Hr(n):hc(n)}function Br(n){if(!ki(n))return mt(n);var e=[];for(var t in Nn(n))Bn.call(n,t)&&"constructor"!=t&&e.push(t);return e}function Rr(n){if(!ea(n))return function(n){var e=[];if(null!=n)for(var t in Nn(n))e.push(t);return e}(n);var e=ki(n),t=[];for(var r in n)("constructor"!=r||!e&&Bn.call(n,r))&&t.push(r);return t}function Dr(n,e){return n<e}function Vr(n,e){var t=-1,r=Wu(n)?an(n.length):[];return hr(n,(function(n,o,i){r[++t]=e(n,o,i)})),r}function Hr(n){var e=di(n);return 1==e.length&&e[0][2]?Mi(e[0][0],e[0][1]):function(t){return t===n||zr(t,n,e)}}function Yr(n,e){return _i(n)&&Ci(e)?Mi(Ri(n),e):function(r){var o=Ma(r,n);return o===t&&o===e?Na(r,n):Ar(e,o,3)}}function Zr(n,e,r,o,i){n!==e&&xr(e,(function(u,a){if(i||(i=new qt),ea(u))!function(n,e,r,o,i,u,a){var c=Pi(n,r),l=Pi(e,r),s=a.get(l);if(s)return void er(n,r,s);var f=u?u(c,l,r+"",n,e,a):t,d=f===t;if(d){var h=Uu(l),v=!h&&Gu(l),p=!h&&!v&&sa(l);f=l,h||v||p?Uu(c)?f=c:$u(c)?f=jo(c):v?(d=!1,f=ko(l,!0)):p?(d=!1,f=Mo(l,!0)):f=[]:ia(l)||Xu(l)?(f=c,Xu(c)?f=ma(c):ea(c)&&!Qu(c)||(f=mi(l))):d=!1}d&&(a.set(l,f),i(f,l,o,u,a),a.delete(l));er(n,r,f)}(n,e,a,r,Zr,o,i);else{var c=o?o(Pi(n,a),u,a+"",n,e,i):t;c===t&&(c=u),er(n,a,c)}}),Aa)}function Xr(n,e){var r=n.length;if(r)return wi(e+=e<0?r:0,r)?n[e]:t}function Ur(n,e,t){e=e.length?Le(e,(function(n){return Uu(n)?function(e){return Sr(e,1===n.length?n[0]:n)}:n})):[oc];var r=-1;e=Le(e,Je(si()));var o=Vr(n,(function(n,t,o){var i=Le(e,(function(e){return e(n)}));return{criteria:i,index:++r,value:n}}));return function(n,e){var t=n.length;for(n.sort(e);t--;)n[t]=n[t].value;return n}(o,(function(n,e){return function(n,e,t){var r=-1,o=n.criteria,i=e.criteria,u=o.length,a=t.length;for(;++r<u;){var c=No(o[r],i[r]);if(c)return r>=a?c:c*("desc"==t[r]?-1:1)}return n.index-e.index}(n,e,t)}))}function Fr(n,e,t){for(var r=-1,o=e.length,i={};++r<o;){var u=e[r],a=Sr(n,u);t(a,u)&&no(i,bo(u,n),a)}return i}function Wr(n,e,t,r){var o=r?Xe:Ze,i=-1,u=e.length,a=n;for(n===e&&(e=jo(e)),t&&(a=Le(n,Je(t)));++i<u;)for(var c=0,l=e[i],s=t?t(l):l;(c=o(a,s,c,r))>-1;)a!==n&&Kn.call(a,c,1),Kn.call(n,c,1);return n}function $r(n,e){for(var t=n?e.length:0,r=t-1;t--;){var o=e[t];if(t==r||o!==i){var i=o;wi(o)?Kn.call(n,o,1):ho(n,o)}}return n}function Gr(n,e){return n+ye(Et()*(e-n+1))}function qr(n,e){var t="";if(!n||e<1||e>h)return t;do{e%2&&(t+=n),(e=ye(e/2))&&(n+=n)}while(e);return t}function Kr(n,e){return Ai(Ni(n,e,oc),n+"")}function Qr(n){return Qt(Ha(n))}function Jr(n,e){var t=Ha(n);return Ti(t,cr(e,0,t.length))}function no(n,e,r,o){if(!ea(n))return n;for(var i=-1,u=(e=bo(e,n)).length,a=u-1,c=n;null!=c&&++i<u;){var l=Ri(e[i]),s=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return n;if(i!=a){var f=c[l];(s=o?o(f,l,c):t)===t&&(s=ea(f)?f:wi(e[i+1])?[]:{})}tr(c,l,s),c=c[l]}return n}var eo=jt?function(n,e){return jt.set(n,e),n}:oc,to=oe?function(n,e){return oe(n,"toString",{configurable:!0,enumerable:!1,value:ec(e),writable:!0})}:oc;function ro(n){return Ti(Ha(n))}function oo(n,e,t){var r=-1,o=n.length;e<0&&(e=-e>o?0:o+e),(t=t>o?o:t)<0&&(t+=o),o=e>t?0:t-e>>>0,e>>>=0;for(var i=an(o);++r<o;)i[r]=n[r+e];return i}function io(n,e){var t;return hr(n,(function(n,r,o){return!(t=e(n,r,o))})),!!t}function uo(n,e,t){var r=0,o=null==n?r:n.length;if("number"==typeof e&&e==e&&o<=2147483647){for(;r<o;){var i=r+o>>>1,u=n[i];null!==u&&!la(u)&&(t?u<=e:u<e)?r=i+1:o=i}return o}return ao(n,e,oc,t)}function ao(n,e,r,o){var i=0,u=null==n?0:n.length;if(0===u)return 0;for(var a=(e=r(e))!=e,c=null===e,l=la(e),s=e===t;i<u;){var f=ye((i+u)/2),d=r(n[f]),h=d!==t,v=null===d,p=d==d,g=la(d);if(a)var y=o||p;else y=s?p&&(o||h):c?p&&h&&(o||!v):l?p&&h&&!v&&(o||!g):!v&&!g&&(o?d<=e:d<e);y?i=f+1:u=f}return wt(u,4294967294)}function co(n,e){for(var t=-1,r=n.length,o=0,i=[];++t<r;){var u=n[t],a=e?e(u):u;if(!t||!Hu(a,c)){var c=a;i[o++]=0===u?0:u}}return i}function lo(n){return"number"==typeof n?n:la(n)?v:+n}function so(n){if("string"==typeof n)return n;if(Uu(n))return Le(n,so)+"";if(la(n))return Vt?Vt.call(n):"";var e=n+"";return"0"==e&&1/n==-1/0?"-0":e}function fo(n,e,t){var r=-1,o=Ae,i=n.length,u=!0,a=[],c=a;if(t)u=!1,o=ze;else if(i>=200){var l=e?null:Ko(n);if(l)return ft(l);u=!1,o=et,c=new Gt}else c=e?[]:a;n:for(;++r<i;){var s=n[r],f=e?e(s):s;if(s=t||0!==s?s:0,u&&f==f){for(var d=c.length;d--;)if(c[d]===f)continue n;e&&c.push(f),a.push(s)}else o(c,f,t)||(c!==a&&c.push(f),a.push(s))}return a}function ho(n,e){return null==(n=Oi(n,e=bo(e,n)))||delete n[Ri(Ki(e))]}function vo(n,e,t,r){return no(n,e,t(Sr(n,e)),r)}function po(n,e,t,r){for(var o=n.length,i=r?o:-1;(r?i--:++i<o)&&e(n[i],i,n););return t?oo(n,r?0:i,r?i+1:o):oo(n,r?i+1:0,r?o:i)}function go(n,e){var t=n;return t instanceof Ut&&(t=t.value()),Be(e,(function(n,e){return e.func.apply(e.thisArg,Te([n],e.args))}),t)}function yo(n,e,t){var r=n.length;if(r<2)return r?fo(n[0]):[];for(var o=-1,i=an(r);++o<r;)for(var u=n[o],a=-1;++a<r;)a!=o&&(i[o]=dr(i[o]||u,n[a],e,t));return fo(mr(i,1),e,t)}function mo(n,e,r){for(var o=-1,i=n.length,u=e.length,a={};++o<i;){var c=o<u?e[o]:t;r(a,n[o],c)}return a}function xo(n){return $u(n)?n:[]}function wo(n){return"function"==typeof n?n:oc}function bo(n,e){return Uu(n)?n:_i(n,e)?[n]:Bi(xa(n))}var _o=Kr;function Eo(n,e,r){var o=n.length;return r=r===t?o:r,!e&&r>=o?n:oo(n,e,r)}var So=se||function(n){return pe.clearTimeout(n)};function ko(n,e){if(e)return n.slice();var t=n.length,r=Wn?Wn(t):new n.constructor(t);return n.copy(r),r}function Co(n){var e=new n.constructor(n.byteLength);return new Fn(e).set(new Fn(n)),e}function Mo(n,e){var t=e?Co(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.length)}function No(n,e){if(n!==e){var r=n!==t,o=null===n,i=n==n,u=la(n),a=e!==t,c=null===e,l=e==e,s=la(e);if(!c&&!s&&!u&&n>e||u&&a&&l&&!c&&!s||o&&a&&l||!r&&l||!i)return 1;if(!o&&!u&&!s&&n<e||s&&r&&i&&!o&&!u||c&&r&&i||!a&&i||!l)return-1}return 0}function Oo(n,e,t,r){for(var o=-1,i=n.length,u=t.length,a=-1,c=e.length,l=xt(i-u,0),s=an(c+l),f=!r;++a<c;)s[a]=e[a];for(;++o<u;)(f||o<i)&&(s[t[o]]=n[o]);for(;l--;)s[a++]=n[o++];return s}function Po(n,e,t,r){for(var o=-1,i=n.length,u=-1,a=t.length,c=-1,l=e.length,s=xt(i-a,0),f=an(s+l),d=!r;++o<s;)f[o]=n[o];for(var h=o;++c<l;)f[h+c]=e[c];for(;++u<a;)(d||o<i)&&(f[h+t[u]]=n[o++]);return f}function jo(n,e){var t=-1,r=n.length;for(e||(e=an(r));++t<r;)e[t]=n[t];return e}function Io(n,e,r,o){var i=!r;r||(r={});for(var u=-1,a=e.length;++u<a;){var c=e[u],l=o?o(r[c],n[c],c,r,n):t;l===t&&(l=n[c]),i?ur(r,c,l):tr(r,c,l)}return r}function Ao(n,e){return function(t,r){var o=Uu(t)?Ne:or,i=e?e():{};return o(t,n,si(r,2),i)}}function zo(n){return Kr((function(e,r){var o=-1,i=r.length,u=i>1?r[i-1]:t,a=i>2?r[2]:t;for(u=n.length>3&&"function"==typeof u?(i--,u):t,a&&bi(r[0],r[1],a)&&(u=i<3?t:u,i=1),e=Nn(e);++o<i;){var c=r[o];c&&n(e,c,o,u)}return e}))}function Lo(n,e){return function(t,r){if(null==t)return t;if(!Wu(t))return n(t,r);for(var o=t.length,i=e?o:-1,u=Nn(t);(e?i--:++i<o)&&!1!==r(u[i],i,u););return t}}function To(n){return function(e,t,r){for(var o=-1,i=Nn(e),u=r(e),a=u.length;a--;){var c=u[n?a:++o];if(!1===t(i[c],c,i))break}return e}}function Bo(n){return function(e){var r=at(e=xa(e))?vt(e):t,o=r?r[0]:e.charAt(0),i=r?Eo(r,1).join(""):e.slice(1);return o[n]()+i}}function Ro(n){return function(e){return Be(Qa(Xa(e).replace(ne,"")),n,"")}}function Do(n){return function(){var e=arguments;switch(e.length){case 0:return new n;case 1:return new n(e[0]);case 2:return new n(e[0],e[1]);case 3:return new n(e[0],e[1],e[2]);case 4:return new n(e[0],e[1],e[2],e[3]);case 5:return new n(e[0],e[1],e[2],e[3],e[4]);case 6:return new n(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new n(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var t=Yt(n.prototype),r=n.apply(t,e);return ea(r)?r:t}}function Vo(n){return function(e,r,o){var i=Nn(e);if(!Wu(e)){var u=si(r,3);e=Ia(e),r=function(n){return u(i[n],n,i)}}var a=n(e,r,o);return a>-1?i[u?e[a]:a]:t}}function Ho(n){return oi((function(e){var o=e.length,i=o,u=Xt.prototype.thru;for(n&&e.reverse();i--;){var a=e[i];if("function"!=typeof a)throw new jn(r);if(u&&!c&&"wrapper"==ci(a))var c=new Xt([],!0)}for(i=c?i:o;++i<o;){var l=ci(a=e[i]),s="wrapper"==l?ai(a):t;c=s&&Ei(s[0])&&424==s[1]&&!s[4].length&&1==s[9]?c[ci(s[0])].apply(c,s[3]):1==a.length&&Ei(a)?c[l]():c.thru(a)}return function(){var n=arguments,t=n[0];if(c&&1==n.length&&Uu(t))return c.plant(t).value();for(var r=0,i=o?e[r].apply(this,n):t;++r<o;)i=e[r].call(this,i);return i}}))}function Yo(n,e,r,o,i,u,a,c,l,f){var d=e&s,h=1&e,v=2&e,p=24&e,g=512&e,y=v?t:Do(n);return function s(){for(var m=arguments.length,x=an(m),w=m;w--;)x[w]=arguments[w];if(p)var b=li(s),_=function(n,e){for(var t=n.length,r=0;t--;)n[t]===e&&++r;return r}(x,b);if(o&&(x=Oo(x,o,i,p)),u&&(x=Po(x,u,a,p)),m-=_,p&&m<f){var E=st(x,b);return Go(n,e,Yo,s.placeholder,r,x,E,c,l,f-m)}var S=h?r:this,k=v?S[n]:n;return m=x.length,c?x=function(n,e){var r=n.length,o=wt(e.length,r),i=jo(n);for(;o--;){var u=e[o];n[o]=wi(u,r)?i[u]:t}return n}(x,c):g&&m>1&&x.reverse(),d&&l<m&&(x.length=l),this&&this!==pe&&this instanceof s&&(k=y||Do(k)),k.apply(S,x)}}function Zo(n,e){return function(t,r){return function(n,e,t,r){return br(n,(function(n,o,i){e(r,t(n),o,i)})),r}(t,n,e(r),{})}}function Xo(n,e){return function(r,o){var i;if(r===t&&o===t)return e;if(r!==t&&(i=r),o!==t){if(i===t)return o;"string"==typeof r||"string"==typeof o?(r=so(r),o=so(o)):(r=lo(r),o=lo(o)),i=n(r,o)}return i}}function Uo(n){return oi((function(e){return e=Le(e,Je(si())),Kr((function(t){var r=this;return n(e,(function(n){return Me(n,r,t)}))}))}))}function Fo(n,e){var r=(e=e===t?" ":so(e)).length;if(r<2)return r?qr(e,n):e;var o=qr(e,ge(n/ht(e)));return at(e)?Eo(vt(o),0,n).join(""):o.slice(0,n)}function Wo(n){return function(e,r,o){return o&&"number"!=typeof o&&bi(e,r,o)&&(r=o=t),e=va(e),r===t?(r=e,e=0):r=va(r),function(n,e,t,r){for(var o=-1,i=xt(ge((e-n)/(t||1)),0),u=an(i);i--;)u[r?i:++o]=n,n+=t;return u}(e,r,o=o===t?e<r?1:-1:va(o),n)}}function $o(n){return function(e,t){return"string"==typeof e&&"string"==typeof t||(e=ya(e),t=ya(t)),n(e,t)}}function Go(n,e,r,o,i,u,l,s,f,d){var h=8&e;e|=h?a:c,4&(e&=~(h?c:a))||(e&=-4);var v=[n,e,i,h?u:t,h?l:t,h?t:u,h?t:l,s,f,d],p=r.apply(t,v);return Ei(n)&&ji(p,v),p.placeholder=o,zi(p,n,e)}function qo(n){var e=Mn[n];return function(n,t){if(n=ya(n),(t=null==t?0:wt(pa(t),292))&&Ve(n)){var r=(xa(n)+"e").split("e");return+((r=(xa(e(r[0]+"e"+(+r[1]+t)))+"e").split("e"))[0]+"e"+(+r[1]-t))}return e(n)}}var Ko=Nt&&1/ft(new Nt([,-0]))[1]==d?function(n){return new Nt(n)}:lc;function Qo(n){return function(e){var t=gi(e);return t==S?ct(e):t==O?dt(e):function(n,e){return Le(e,(function(e){return[e,n[e]]}))}(e,n(e))}}function Jo(n,e,o,l,d,h,v,p){var g=2&e;if(!g&&"function"!=typeof n)throw new jn(r);var y=l?l.length:0;if(y||(e&=-97,l=d=t),v=v===t?v:xt(pa(v),0),p=p===t?p:pa(p),y-=d?d.length:0,e&c){var m=l,x=d;l=d=t}var w=g?t:ai(n),b=[n,e,o,l,d,m,x,h,v,p];if(w&&function(n,e){var t=n[1],r=e[1],o=t|r,u=o<131,a=r==s&&8==t||r==s&&t==f&&n[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==t;if(!u&&!a)return n;1&r&&(n[2]=e[2],o|=1&t?0:4);var c=e[3];if(c){var l=n[3];n[3]=l?Oo(l,c,e[4]):c,n[4]=l?st(n[3],i):e[4]}(c=e[5])&&(l=n[5],n[5]=l?Po(l,c,e[6]):c,n[6]=l?st(n[5],i):e[6]);(c=e[7])&&(n[7]=c);r&s&&(n[8]=null==n[8]?e[8]:wt(n[8],e[8]));null==n[9]&&(n[9]=e[9]);n[0]=e[0],n[1]=o}(b,w),n=b[0],e=b[1],o=b[2],l=b[3],d=b[4],!(p=b[9]=b[9]===t?g?0:n.length:xt(b[9]-y,0))&&24&e&&(e&=-25),e&&1!=e)_=8==e||e==u?function(n,e,r){var o=Do(n);return function i(){for(var u=arguments.length,a=an(u),c=u,l=li(i);c--;)a[c]=arguments[c];var s=u<3&&a[0]!==l&&a[u-1]!==l?[]:st(a,l);return(u-=s.length)<r?Go(n,e,Yo,i.placeholder,t,a,s,t,t,r-u):Me(this&&this!==pe&&this instanceof i?o:n,this,a)}}(n,e,p):e!=a&&33!=e||d.length?Yo.apply(t,b):function(n,e,t,r){var o=1&e,i=Do(n);return function e(){for(var u=-1,a=arguments.length,c=-1,l=r.length,s=an(l+a),f=this&&this!==pe&&this instanceof e?i:n;++c<l;)s[c]=r[c];for(;a--;)s[c++]=arguments[++u];return Me(f,o?t:this,s)}}(n,e,o,l);else var _=function(n,e,t){var r=1&e,o=Do(n);return function e(){return(this&&this!==pe&&this instanceof e?o:n).apply(r?t:this,arguments)}}(n,e,o);return zi((w?eo:ji)(_,b),n,e)}function ni(n,e,r,o){return n===t||Hu(n,zn[r])&&!Bn.call(o,r)?e:n}function ei(n,e,r,o,i,u){return ea(n)&&ea(e)&&(u.set(e,n),Zr(n,e,t,ei,u),u.delete(e)),n}function ti(n){return ia(n)?t:n}function ri(n,e,r,o,i,u){var a=1&r,c=n.length,l=e.length;if(c!=l&&!(a&&l>c))return!1;var s=u.get(n),f=u.get(e);if(s&&f)return s==e&&f==n;var d=-1,h=!0,v=2&r?new Gt:t;for(u.set(n,e),u.set(e,n);++d<c;){var p=n[d],g=e[d];if(o)var y=a?o(g,p,d,e,n,u):o(p,g,d,n,e,u);if(y!==t){if(y)continue;h=!1;break}if(v){if(!De(e,(function(n,e){if(!et(v,e)&&(p===n||i(p,n,r,o,u)))return v.push(e)}))){h=!1;break}}else if(p!==g&&!i(p,g,r,o,u)){h=!1;break}}return u.delete(n),u.delete(e),h}function oi(n){return Ai(Ni(n,t,Fi),n+"")}function ii(n){return kr(n,Ia,vi)}function ui(n){return kr(n,Aa,pi)}var ai=jt?function(n){return jt.get(n)}:lc;function ci(n){for(var e=n.name+"",t=It[e],r=Bn.call(It,e)?t.length:0;r--;){var o=t[r],i=o.func;if(null==i||i==n)return o.name}return e}function li(n){return(Bn.call(Ht,"placeholder")?Ht:n).placeholder}function si(){var n=Ht.iteratee||ic;return n=n===ic?Tr:n,arguments.length?n(arguments[0],arguments[1]):n}function fi(n,e){var t,r,o=n.__data__;return("string"==(r=typeof(t=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t)?o["string"==typeof e?"string":"hash"]:o.map}function di(n){for(var e=Ia(n),t=e.length;t--;){var r=e[t],o=n[r];e[t]=[r,o,Ci(o)]}return e}function hi(n,e){var r=function(n,e){return null==n?t:n[e]}(n,e);return Lr(r)?r:t}var vi=xe?function(n){return null==n?[]:(n=Nn(n),Ie(xe(n),(function(e){return qn.call(n,e)})))}:gc,pi=xe?function(n){for(var e=[];n;)Te(e,vi(n)),n=$n(n);return e}:gc,gi=Cr;function yi(n,e,t){for(var r=-1,o=(e=bo(e,n)).length,i=!1;++r<o;){var u=Ri(e[r]);if(!(i=null!=n&&t(n,u)))break;n=n[u]}return i||++r!=o?i:!!(o=null==n?0:n.length)&&na(o)&&wi(u,o)&&(Uu(n)||Xu(n))}function mi(n){return"function"!=typeof n.constructor||ki(n)?{}:Yt($n(n))}function xi(n){return Uu(n)||Xu(n)||!!(Qn&&n&&n[Qn])}function wi(n,e){var t=typeof n;return!!(e=null==e?h:e)&&("number"==t||"symbol"!=t&&wn.test(n))&&n>-1&&n%1==0&&n<e}function bi(n,e,t){if(!ea(t))return!1;var r=typeof e;return!!("number"==r?Wu(t)&&wi(e,t.length):"string"==r&&e in t)&&Hu(t[e],n)}function _i(n,e){if(Uu(n))return!1;var t=typeof n;return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=n&&!la(n))||(en.test(n)||!nn.test(n)||null!=e&&n in Nn(e))}function Ei(n){var e=ci(n),t=Ht[e];if("function"!=typeof t||!(e in Ut.prototype))return!1;if(n===t)return!0;var r=ai(t);return!!r&&n===r[0]}(kt&&gi(new kt(new ArrayBuffer(1)))!=z||Ct&&gi(new Ct)!=S||Mt&&gi(Mt.resolve())!=M||Nt&&gi(new Nt)!=O||Ot&&gi(new Ot)!=I)&&(gi=function(n){var e=Cr(n),r=e==C?n.constructor:t,o=r?Di(r):"";if(o)switch(o){case At:return z;case zt:return S;case Lt:return M;case Tt:return O;case Bt:return I}return e});var Si=Ln?Qu:yc;function ki(n){var e=n&&n.constructor;return n===("function"==typeof e&&e.prototype||zn)}function Ci(n){return n==n&&!ea(n)}function Mi(n,e){return function(r){return null!=r&&(r[n]===e&&(e!==t||n in Nn(r)))}}function Ni(n,e,r){return e=xt(e===t?n.length-1:e,0),function(){for(var t=arguments,o=-1,i=xt(t.length-e,0),u=an(i);++o<i;)u[o]=t[e+o];o=-1;for(var a=an(e+1);++o<e;)a[o]=t[o];return a[e]=r(u),Me(n,this,a)}}function Oi(n,e){return e.length<2?n:Sr(n,oo(e,0,-1))}function Pi(n,e){if(("constructor"!==e||"function"!=typeof n[e])&&"__proto__"!=e)return n[e]}var ji=Li(eo),Ii=ve||function(n,e){return pe.setTimeout(n,e)},Ai=Li(to);function zi(n,e,t){var r=e+"";return Ai(n,function(n,e){var t=e.length;if(!t)return n;var r=t-1;return e[r]=(t>1?"& ":"")+e[r],e=e.join(t>2?", ":" "),n.replace(cn,"{\n/* [wrapped with "+e+"] */\n")}(r,function(n,e){return Oe(g,(function(t){var r="_."+t[0];e&t[1]&&!Ae(n,r)&&n.push(r)})),n.sort()}(function(n){var e=n.match(ln);return e?e[1].split(sn):[]}(r),t)))}function Li(n){var e=0,r=0;return function(){var o=bt(),i=16-(o-r);if(r=o,i>0){if(++e>=800)return arguments[0]}else e=0;return n.apply(t,arguments)}}function Ti(n,e){var r=-1,o=n.length,i=o-1;for(e=e===t?o:e;++r<e;){var u=Gr(r,i),a=n[u];n[u]=n[r],n[r]=a}return n.length=e,n}var Bi=function(n){var e=Lu(n,(function(n){return 500===t.size&&t.clear(),n})),t=e.cache;return e}((function(n){var e=[];return 46===n.charCodeAt(0)&&e.push(""),n.replace(tn,(function(n,t,r,o){e.push(r?o.replace(hn,"$1"):t||n)})),e}));function Ri(n){if("string"==typeof n||la(n))return n;var e=n+"";return"0"==e&&1/n==-1/0?"-0":e}function Di(n){if(null!=n){try{return Tn.call(n)}catch(n){}try{return n+""}catch(n){}}return""}function Vi(n){if(n instanceof Ut)return n.clone();var e=new Xt(n.__wrapped__,n.__chain__);return e.__actions__=jo(n.__actions__),e.__index__=n.__index__,e.__values__=n.__values__,e}var Hi=Kr((function(n,e){return $u(n)?dr(n,mr(e,1,$u,!0)):[]})),Yi=Kr((function(n,e){var r=Ki(e);return $u(r)&&(r=t),$u(n)?dr(n,mr(e,1,$u,!0),si(r,2)):[]})),Zi=Kr((function(n,e){var r=Ki(e);return $u(r)&&(r=t),$u(n)?dr(n,mr(e,1,$u,!0),t,r):[]}));function Xi(n,e,t){var r=null==n?0:n.length;if(!r)return-1;var o=null==t?0:pa(t);return o<0&&(o=xt(r+o,0)),Ye(n,si(e,3),o)}function Ui(n,e,r){var o=null==n?0:n.length;if(!o)return-1;var i=o-1;return r!==t&&(i=pa(r),i=r<0?xt(o+i,0):wt(i,o-1)),Ye(n,si(e,3),i,!0)}function Fi(n){return(null==n?0:n.length)?mr(n,1):[]}function Wi(n){return n&&n.length?n[0]:t}var $i=Kr((function(n){var e=Le(n,xo);return e.length&&e[0]===n[0]?Pr(e):[]})),Gi=Kr((function(n){var e=Ki(n),r=Le(n,xo);return e===Ki(r)?e=t:r.pop(),r.length&&r[0]===n[0]?Pr(r,si(e,2)):[]})),qi=Kr((function(n){var e=Ki(n),r=Le(n,xo);return(e="function"==typeof e?e:t)&&r.pop(),r.length&&r[0]===n[0]?Pr(r,t,e):[]}));function Ki(n){var e=null==n?0:n.length;return e?n[e-1]:t}var Qi=Kr(Ji);function Ji(n,e){return n&&n.length&&e&&e.length?Wr(n,e):n}var nu=oi((function(n,e){var t=null==n?0:n.length,r=ar(n,e);return $r(n,Le(e,(function(n){return wi(n,t)?+n:n})).sort(No)),r}));function eu(n){return null==n?n:St.call(n)}var tu=Kr((function(n){return fo(mr(n,1,$u,!0))})),ru=Kr((function(n){var e=Ki(n);return $u(e)&&(e=t),fo(mr(n,1,$u,!0),si(e,2))})),ou=Kr((function(n){var e=Ki(n);return e="function"==typeof e?e:t,fo(mr(n,1,$u,!0),t,e)}));function iu(n){if(!n||!n.length)return[];var e=0;return n=Ie(n,(function(n){if($u(n))return e=xt(n.length,e),!0})),Ke(e,(function(e){return Le(n,We(e))}))}function uu(n,e){if(!n||!n.length)return[];var r=iu(n);return null==e?r:Le(r,(function(n){return Me(e,t,n)}))}var au=Kr((function(n,e){return $u(n)?dr(n,e):[]})),cu=Kr((function(n){return yo(Ie(n,$u))})),lu=Kr((function(n){var e=Ki(n);return $u(e)&&(e=t),yo(Ie(n,$u),si(e,2))})),su=Kr((function(n){var e=Ki(n);return e="function"==typeof e?e:t,yo(Ie(n,$u),t,e)})),fu=Kr(iu);var du=Kr((function(n){var e=n.length,r=e>1?n[e-1]:t;return r="function"==typeof r?(n.pop(),r):t,uu(n,r)}));function hu(n){var e=Ht(n);return e.__chain__=!0,e}function vu(n,e){return e(n)}var pu=oi((function(n){var e=n.length,r=e?n[0]:0,o=this.__wrapped__,i=function(e){return ar(e,n)};return!(e>1||this.__actions__.length)&&o instanceof Ut&&wi(r)?((o=o.slice(r,+r+(e?1:0))).__actions__.push({func:vu,args:[i],thisArg:t}),new Xt(o,this.__chain__).thru((function(n){return e&&!n.length&&n.push(t),n}))):this.thru(i)}));var gu=Ao((function(n,e,t){Bn.call(n,t)?++n[t]:ur(n,t,1)}));var yu=Vo(Xi),mu=Vo(Ui);function xu(n,e){return(Uu(n)?Oe:hr)(n,si(e,3))}function wu(n,e){return(Uu(n)?Pe:vr)(n,si(e,3))}var bu=Ao((function(n,e,t){Bn.call(n,t)?n[t].push(e):ur(n,t,[e])}));var _u=Kr((function(n,e,t){var r=-1,o="function"==typeof e,i=Wu(n)?an(n.length):[];return hr(n,(function(n){i[++r]=o?Me(e,n,t):jr(n,e,t)})),i})),Eu=Ao((function(n,e,t){ur(n,t,e)}));function Su(n,e){return(Uu(n)?Le:Vr)(n,si(e,3))}var ku=Ao((function(n,e,t){n[t?0:1].push(e)}),(function(){return[[],[]]}));var Cu=Kr((function(n,e){if(null==n)return[];var t=e.length;return t>1&&bi(n,e[0],e[1])?e=[]:t>2&&bi(e[0],e[1],e[2])&&(e=[e[0]]),Ur(n,mr(e,1),[])})),Mu=he||function(){return pe.Date.now()};function Nu(n,e,r){return e=r?t:e,e=n&&null==e?n.length:e,Jo(n,s,t,t,t,t,e)}function Ou(n,e){var o;if("function"!=typeof e)throw new jn(r);return n=pa(n),function(){return--n>0&&(o=e.apply(this,arguments)),n<=1&&(e=t),o}}var Pu=Kr((function(n,e,t){var r=1;if(t.length){var o=st(t,li(Pu));r|=a}return Jo(n,r,e,t,o)})),ju=Kr((function(n,e,t){var r=3;if(t.length){var o=st(t,li(ju));r|=a}return Jo(e,r,n,t,o)}));function Iu(n,e,o){var i,u,a,c,l,s,f=0,d=!1,h=!1,v=!0;if("function"!=typeof n)throw new jn(r);function p(e){var r=i,o=u;return i=u=t,f=e,c=n.apply(o,r)}function g(n){var r=n-s;return s===t||r>=e||r<0||h&&n-f>=a}function y(){var n=Mu();if(g(n))return m(n);l=Ii(y,function(n){var t=e-(n-s);return h?wt(t,a-(n-f)):t}(n))}function m(n){return l=t,v&&i?p(n):(i=u=t,c)}function x(){var n=Mu(),r=g(n);if(i=arguments,u=this,s=n,r){if(l===t)return function(n){return f=n,l=Ii(y,e),d?p(n):c}(s);if(h)return So(l),l=Ii(y,e),p(s)}return l===t&&(l=Ii(y,e)),c}return e=ya(e)||0,ea(o)&&(d=!!o.leading,a=(h="maxWait"in o)?xt(ya(o.maxWait)||0,e):a,v="trailing"in o?!!o.trailing:v),x.cancel=function(){l!==t&&So(l),f=0,i=s=u=l=t},x.flush=function(){return l===t?c:m(Mu())},x}var Au=Kr((function(n,e){return fr(n,1,e)})),zu=Kr((function(n,e,t){return fr(n,ya(e)||0,t)}));function Lu(n,e){if("function"!=typeof n||null!=e&&"function"!=typeof e)throw new jn(r);var t=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=t.cache;if(i.has(o))return i.get(o);var u=n.apply(this,r);return t.cache=i.set(o,u)||i,u};return t.cache=new(Lu.Cache||$t),t}function Tu(n){if("function"!=typeof n)throw new jn(r);return function(){var e=arguments;switch(e.length){case 0:return!n.call(this);case 1:return!n.call(this,e[0]);case 2:return!n.call(this,e[0],e[1]);case 3:return!n.call(this,e[0],e[1],e[2])}return!n.apply(this,e)}}Lu.Cache=$t;var Bu=_o((function(n,e){var t=(e=1==e.length&&Uu(e[0])?Le(e[0],Je(si())):Le(mr(e,1),Je(si()))).length;return Kr((function(r){for(var o=-1,i=wt(r.length,t);++o<i;)r[o]=e[o].call(this,r[o]);return Me(n,this,r)}))})),Ru=Kr((function(n,e){var r=st(e,li(Ru));return Jo(n,a,t,e,r)})),Du=Kr((function(n,e){var r=st(e,li(Du));return Jo(n,c,t,e,r)})),Vu=oi((function(n,e){return Jo(n,f,t,t,t,e)}));function Hu(n,e){return n===e||n!=n&&e!=e}var Yu=$o(Mr),Zu=$o((function(n,e){return n>=e})),Xu=Ir(function(){return arguments}())?Ir:function(n){return ta(n)&&Bn.call(n,"callee")&&!qn.call(n,"callee")},Uu=an.isArray,Fu=be?Je(be):function(n){return ta(n)&&Cr(n)==A};function Wu(n){return null!=n&&na(n.length)&&!Qu(n)}function $u(n){return ta(n)&&Wu(n)}var Gu=we||yc,qu=_e?Je(_e):function(n){return ta(n)&&Cr(n)==w};function Ku(n){if(!ta(n))return!1;var e=Cr(n);return e==b||"[object DOMException]"==e||"string"==typeof n.message&&"string"==typeof n.name&&!ia(n)}function Qu(n){if(!ea(n))return!1;var e=Cr(n);return e==_||e==E||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Ju(n){return"number"==typeof n&&n==pa(n)}function na(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=h}function ea(n){var e=typeof n;return null!=n&&("object"==e||"function"==e)}function ta(n){return null!=n&&"object"==typeof n}var ra=Ee?Je(Ee):function(n){return ta(n)&&gi(n)==S};function oa(n){return"number"==typeof n||ta(n)&&Cr(n)==k}function ia(n){if(!ta(n)||Cr(n)!=C)return!1;var e=$n(n);if(null===e)return!0;var t=Bn.call(e,"constructor")&&e.constructor;return"function"==typeof t&&t instanceof t&&Tn.call(t)==Hn}var ua=Se?Je(Se):function(n){return ta(n)&&Cr(n)==N};var aa=ke?Je(ke):function(n){return ta(n)&&gi(n)==O};function ca(n){return"string"==typeof n||!Uu(n)&&ta(n)&&Cr(n)==P}function la(n){return"symbol"==typeof n||ta(n)&&Cr(n)==j}var sa=Ce?Je(Ce):function(n){return ta(n)&&na(n.length)&&!!ce[Cr(n)]};var fa=$o(Dr),da=$o((function(n,e){return n<=e}));function ha(n){if(!n)return[];if(Wu(n))return ca(n)?vt(n):jo(n);if(Jn&&n[Jn])return function(n){for(var e,t=[];!(e=n.next()).done;)t.push(e.value);return t}(n[Jn]());var e=gi(n);return(e==S?ct:e==O?ft:Ha)(n)}function va(n){return n?(n=ya(n))===d||n===-1/0?17976931348623157e292*(n<0?-1:1):n==n?n:0:0===n?n:0}function pa(n){var e=va(n),t=e%1;return e==e?t?e-t:e:0}function ga(n){return n?cr(pa(n),0,p):0}function ya(n){if("number"==typeof n)return n;if(la(n))return v;if(ea(n)){var e="function"==typeof n.valueOf?n.valueOf():n;n=ea(e)?e+"":e}if("string"!=typeof n)return 0===n?n:+n;n=Qe(n);var t=yn.test(n);return t||xn.test(n)?de(n.slice(2),t?2:8):gn.test(n)?v:+n}function ma(n){return Io(n,Aa(n))}function xa(n){return null==n?"":so(n)}var wa=zo((function(n,e){if(ki(e)||Wu(e))Io(e,Ia(e),n);else for(var t in e)Bn.call(e,t)&&tr(n,t,e[t])})),ba=zo((function(n,e){Io(e,Aa(e),n)})),_a=zo((function(n,e,t,r){Io(e,Aa(e),n,r)})),Ea=zo((function(n,e,t,r){Io(e,Ia(e),n,r)})),Sa=oi(ar);var ka=Kr((function(n,e){n=Nn(n);var r=-1,o=e.length,i=o>2?e[2]:t;for(i&&bi(e[0],e[1],i)&&(o=1);++r<o;)for(var u=e[r],a=Aa(u),c=-1,l=a.length;++c<l;){var s=a[c],f=n[s];(f===t||Hu(f,zn[s])&&!Bn.call(n,s))&&(n[s]=u[s])}return n})),Ca=Kr((function(n){return n.push(t,ei),Me(La,t,n)}));function Ma(n,e,r){var o=null==n?t:Sr(n,e);return o===t?r:o}function Na(n,e){return null!=n&&yi(n,e,Or)}var Oa=Zo((function(n,e,t){null!=e&&"function"!=typeof e.toString&&(e=Vn.call(e)),n[e]=t}),ec(oc)),Pa=Zo((function(n,e,t){null!=e&&"function"!=typeof e.toString&&(e=Vn.call(e)),Bn.call(n,e)?n[e].push(t):n[e]=[t]}),si),ja=Kr(jr);function Ia(n){return Wu(n)?Kt(n):Br(n)}function Aa(n){return Wu(n)?Kt(n,!0):Rr(n)}var za=zo((function(n,e,t){Zr(n,e,t)})),La=zo((function(n,e,t,r){Zr(n,e,t,r)})),Ta=oi((function(n,e){var t={};if(null==n)return t;var r=!1;e=Le(e,(function(e){return e=bo(e,n),r||(r=e.length>1),e})),Io(n,ui(n),t),r&&(t=lr(t,7,ti));for(var o=e.length;o--;)ho(t,e[o]);return t}));var Ba=oi((function(n,e){return null==n?{}:function(n,e){return Fr(n,e,(function(e,t){return Na(n,t)}))}(n,e)}));function Ra(n,e){if(null==n)return{};var t=Le(ui(n),(function(n){return[n]}));return e=si(e),Fr(n,t,(function(n,t){return e(n,t[0])}))}var Da=Qo(Ia),Va=Qo(Aa);function Ha(n){return null==n?[]:nt(n,Ia(n))}var Ya=Ro((function(n,e,t){return e=e.toLowerCase(),n+(t?Za(e):e)}));function Za(n){return Ka(xa(n).toLowerCase())}function Xa(n){return(n=xa(n))&&n.replace(bn,ot).replace(ee,"")}var Ua=Ro((function(n,e,t){return n+(t?"-":"")+e.toLowerCase()})),Fa=Ro((function(n,e,t){return n+(t?" ":"")+e.toLowerCase()})),Wa=Bo("toLowerCase");var $a=Ro((function(n,e,t){return n+(t?"_":"")+e.toLowerCase()}));var Ga=Ro((function(n,e,t){return n+(t?" ":"")+Ka(e)}));var qa=Ro((function(n,e,t){return n+(t?" ":"")+e.toUpperCase()})),Ka=Bo("toUpperCase");function Qa(n,e,r){return n=xa(n),(e=r?t:e)===t?function(n){return ie.test(n)}(n)?function(n){return n.match(re)||[]}(n):function(n){return n.match(fn)||[]}(n):n.match(e)||[]}var Ja=Kr((function(n,e){try{return Me(n,t,e)}catch(n){return Ku(n)?n:new kn(n)}})),nc=oi((function(n,e){return Oe(e,(function(e){e=Ri(e),ur(n,e,Pu(n[e],n))})),n}));function ec(n){return function(){return n}}var tc=Ho(),rc=Ho(!0);function oc(n){return n}function ic(n){return Tr("function"==typeof n?n:lr(n,1))}var uc=Kr((function(n,e){return function(t){return jr(t,n,e)}})),ac=Kr((function(n,e){return function(t){return jr(n,t,e)}}));function cc(n,e,t){var r=Ia(e),o=Er(e,r);null!=t||ea(e)&&(o.length||!r.length)||(t=e,e=n,n=this,o=Er(e,Ia(e)));var i=!(ea(t)&&"chain"in t&&!t.chain),u=Qu(n);return Oe(o,(function(t){var r=e[t];n[t]=r,u&&(n.prototype[t]=function(){var e=this.__chain__;if(i||e){var t=n(this.__wrapped__);return(t.__actions__=jo(this.__actions__)).push({func:r,args:arguments,thisArg:n}),t.__chain__=e,t}return r.apply(n,Te([this.value()],arguments))})})),n}function lc(){}var sc=Uo(Le),fc=Uo(je),dc=Uo(De);function hc(n){return _i(n)?We(Ri(n)):function(n){return function(e){return Sr(e,n)}}(n)}var vc=Wo(),pc=Wo(!0);function gc(){return[]}function yc(){return!1}var mc=Xo((function(n,e){return n+e}),0),xc=qo("ceil"),wc=Xo((function(n,e){return n/e}),1),bc=qo("floor");var _c,Ec=Xo((function(n,e){return n*e}),1),Sc=qo("round"),kc=Xo((function(n,e){return n-e}),0);return Ht.after=function(n,e){if("function"!=typeof e)throw new jn(r);return n=pa(n),function(){if(--n<1)return e.apply(this,arguments)}},Ht.ary=Nu,Ht.assign=wa,Ht.assignIn=ba,Ht.assignInWith=_a,Ht.assignWith=Ea,Ht.at=Sa,Ht.before=Ou,Ht.bind=Pu,Ht.bindAll=nc,Ht.bindKey=ju,Ht.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return Uu(n)?n:[n]},Ht.chain=hu,Ht.chunk=function(n,e,r){e=(r?bi(n,e,r):e===t)?1:xt(pa(e),0);var o=null==n?0:n.length;if(!o||e<1)return[];for(var i=0,u=0,a=an(ge(o/e));i<o;)a[u++]=oo(n,i,i+=e);return a},Ht.compact=function(n){for(var e=-1,t=null==n?0:n.length,r=0,o=[];++e<t;){var i=n[e];i&&(o[r++]=i)}return o},Ht.concat=function(){var n=arguments.length;if(!n)return[];for(var e=an(n-1),t=arguments[0],r=n;r--;)e[r-1]=arguments[r];return Te(Uu(t)?jo(t):[t],mr(e,1))},Ht.cond=function(n){var e=null==n?0:n.length,t=si();return n=e?Le(n,(function(n){if("function"!=typeof n[1])throw new jn(r);return[t(n[0]),n[1]]})):[],Kr((function(t){for(var r=-1;++r<e;){var o=n[r];if(Me(o[0],this,t))return Me(o[1],this,t)}}))},Ht.conforms=function(n){return function(n){var e=Ia(n);return function(t){return sr(t,n,e)}}(lr(n,1))},Ht.constant=ec,Ht.countBy=gu,Ht.create=function(n,e){var t=Yt(n);return null==e?t:ir(t,e)},Ht.curry=function n(e,r,o){var i=Jo(e,8,t,t,t,t,t,r=o?t:r);return i.placeholder=n.placeholder,i},Ht.curryRight=function n(e,r,o){var i=Jo(e,u,t,t,t,t,t,r=o?t:r);return i.placeholder=n.placeholder,i},Ht.debounce=Iu,Ht.defaults=ka,Ht.defaultsDeep=Ca,Ht.defer=Au,Ht.delay=zu,Ht.difference=Hi,Ht.differenceBy=Yi,Ht.differenceWith=Zi,Ht.drop=function(n,e,r){var o=null==n?0:n.length;return o?oo(n,(e=r||e===t?1:pa(e))<0?0:e,o):[]},Ht.dropRight=function(n,e,r){var o=null==n?0:n.length;return o?oo(n,0,(e=o-(e=r||e===t?1:pa(e)))<0?0:e):[]},Ht.dropRightWhile=function(n,e){return n&&n.length?po(n,si(e,3),!0,!0):[]},Ht.dropWhile=function(n,e){return n&&n.length?po(n,si(e,3),!0):[]},Ht.fill=function(n,e,r,o){var i=null==n?0:n.length;return i?(r&&"number"!=typeof r&&bi(n,e,r)&&(r=0,o=i),function(n,e,r,o){var i=n.length;for((r=pa(r))<0&&(r=-r>i?0:i+r),(o=o===t||o>i?i:pa(o))<0&&(o+=i),o=r>o?0:ga(o);r<o;)n[r++]=e;return n}(n,e,r,o)):[]},Ht.filter=function(n,e){return(Uu(n)?Ie:yr)(n,si(e,3))},Ht.flatMap=function(n,e){return mr(Su(n,e),1)},Ht.flatMapDeep=function(n,e){return mr(Su(n,e),d)},Ht.flatMapDepth=function(n,e,r){return r=r===t?1:pa(r),mr(Su(n,e),r)},Ht.flatten=Fi,Ht.flattenDeep=function(n){return(null==n?0:n.length)?mr(n,d):[]},Ht.flattenDepth=function(n,e){return(null==n?0:n.length)?mr(n,e=e===t?1:pa(e)):[]},Ht.flip=function(n){return Jo(n,512)},Ht.flow=tc,Ht.flowRight=rc,Ht.fromPairs=function(n){for(var e=-1,t=null==n?0:n.length,r={};++e<t;){var o=n[e];r[o[0]]=o[1]}return r},Ht.functions=function(n){return null==n?[]:Er(n,Ia(n))},Ht.functionsIn=function(n){return null==n?[]:Er(n,Aa(n))},Ht.groupBy=bu,Ht.initial=function(n){return(null==n?0:n.length)?oo(n,0,-1):[]},Ht.intersection=$i,Ht.intersectionBy=Gi,Ht.intersectionWith=qi,Ht.invert=Oa,Ht.invertBy=Pa,Ht.invokeMap=_u,Ht.iteratee=ic,Ht.keyBy=Eu,Ht.keys=Ia,Ht.keysIn=Aa,Ht.map=Su,Ht.mapKeys=function(n,e){var t={};return e=si(e,3),br(n,(function(n,r,o){ur(t,e(n,r,o),n)})),t},Ht.mapValues=function(n,e){var t={};return e=si(e,3),br(n,(function(n,r,o){ur(t,r,e(n,r,o))})),t},Ht.matches=function(n){return Hr(lr(n,1))},Ht.matchesProperty=function(n,e){return Yr(n,lr(e,1))},Ht.memoize=Lu,Ht.merge=za,Ht.mergeWith=La,Ht.method=uc,Ht.methodOf=ac,Ht.mixin=cc,Ht.negate=Tu,Ht.nthArg=function(n){return n=pa(n),Kr((function(e){return Xr(e,n)}))},Ht.omit=Ta,Ht.omitBy=function(n,e){return Ra(n,Tu(si(e)))},Ht.once=function(n){return Ou(2,n)},Ht.orderBy=function(n,e,r,o){return null==n?[]:(Uu(e)||(e=null==e?[]:[e]),Uu(r=o?t:r)||(r=null==r?[]:[r]),Ur(n,e,r))},Ht.over=sc,Ht.overArgs=Bu,Ht.overEvery=fc,Ht.overSome=dc,Ht.partial=Ru,Ht.partialRight=Du,Ht.partition=ku,Ht.pick=Ba,Ht.pickBy=Ra,Ht.property=hc,Ht.propertyOf=function(n){return function(e){return null==n?t:Sr(n,e)}},Ht.pull=Qi,Ht.pullAll=Ji,Ht.pullAllBy=function(n,e,t){return n&&n.length&&e&&e.length?Wr(n,e,si(t,2)):n},Ht.pullAllWith=function(n,e,r){return n&&n.length&&e&&e.length?Wr(n,e,t,r):n},Ht.pullAt=nu,Ht.range=vc,Ht.rangeRight=pc,Ht.rearg=Vu,Ht.reject=function(n,e){return(Uu(n)?Ie:yr)(n,Tu(si(e,3)))},Ht.remove=function(n,e){var t=[];if(!n||!n.length)return t;var r=-1,o=[],i=n.length;for(e=si(e,3);++r<i;){var u=n[r];e(u,r,n)&&(t.push(u),o.push(r))}return $r(n,o),t},Ht.rest=function(n,e){if("function"!=typeof n)throw new jn(r);return Kr(n,e=e===t?e:pa(e))},Ht.reverse=eu,Ht.sampleSize=function(n,e,r){return e=(r?bi(n,e,r):e===t)?1:pa(e),(Uu(n)?Jt:Jr)(n,e)},Ht.set=function(n,e,t){return null==n?n:no(n,e,t)},Ht.setWith=function(n,e,r,o){return o="function"==typeof o?o:t,null==n?n:no(n,e,r,o)},Ht.shuffle=function(n){return(Uu(n)?nr:ro)(n)},Ht.slice=function(n,e,r){var o=null==n?0:n.length;return o?(r&&"number"!=typeof r&&bi(n,e,r)?(e=0,r=o):(e=null==e?0:pa(e),r=r===t?o:pa(r)),oo(n,e,r)):[]},Ht.sortBy=Cu,Ht.sortedUniq=function(n){return n&&n.length?co(n):[]},Ht.sortedUniqBy=function(n,e){return n&&n.length?co(n,si(e,2)):[]},Ht.split=function(n,e,r){return r&&"number"!=typeof r&&bi(n,e,r)&&(e=r=t),(r=r===t?p:r>>>0)?(n=xa(n))&&("string"==typeof e||null!=e&&!ua(e))&&!(e=so(e))&&at(n)?Eo(vt(n),0,r):n.split(e,r):[]},Ht.spread=function(n,e){if("function"!=typeof n)throw new jn(r);return e=null==e?0:xt(pa(e),0),Kr((function(t){var r=t[e],o=Eo(t,0,e);return r&&Te(o,r),Me(n,this,o)}))},Ht.tail=function(n){var e=null==n?0:n.length;return e?oo(n,1,e):[]},Ht.take=function(n,e,r){return n&&n.length?oo(n,0,(e=r||e===t?1:pa(e))<0?0:e):[]},Ht.takeRight=function(n,e,r){var o=null==n?0:n.length;return o?oo(n,(e=o-(e=r||e===t?1:pa(e)))<0?0:e,o):[]},Ht.takeRightWhile=function(n,e){return n&&n.length?po(n,si(e,3),!1,!0):[]},Ht.takeWhile=function(n,e){return n&&n.length?po(n,si(e,3)):[]},Ht.tap=function(n,e){return e(n),n},Ht.throttle=function(n,e,t){var o=!0,i=!0;if("function"!=typeof n)throw new jn(r);return ea(t)&&(o="leading"in t?!!t.leading:o,i="trailing"in t?!!t.trailing:i),Iu(n,e,{leading:o,maxWait:e,trailing:i})},Ht.thru=vu,Ht.toArray=ha,Ht.toPairs=Da,Ht.toPairsIn=Va,Ht.toPath=function(n){return Uu(n)?Le(n,Ri):la(n)?[n]:jo(Bi(xa(n)))},Ht.toPlainObject=ma,Ht.transform=function(n,e,t){var r=Uu(n),o=r||Gu(n)||sa(n);if(e=si(e,4),null==t){var i=n&&n.constructor;t=o?r?new i:[]:ea(n)&&Qu(i)?Yt($n(n)):{}}return(o?Oe:br)(n,(function(n,r,o){return e(t,n,r,o)})),t},Ht.unary=function(n){return Nu(n,1)},Ht.union=tu,Ht.unionBy=ru,Ht.unionWith=ou,Ht.uniq=function(n){return n&&n.length?fo(n):[]},Ht.uniqBy=function(n,e){return n&&n.length?fo(n,si(e,2)):[]},Ht.uniqWith=function(n,e){return e="function"==typeof e?e:t,n&&n.length?fo(n,t,e):[]},Ht.unset=function(n,e){return null==n||ho(n,e)},Ht.unzip=iu,Ht.unzipWith=uu,Ht.update=function(n,e,t){return null==n?n:vo(n,e,wo(t))},Ht.updateWith=function(n,e,r,o){return o="function"==typeof o?o:t,null==n?n:vo(n,e,wo(r),o)},Ht.values=Ha,Ht.valuesIn=function(n){return null==n?[]:nt(n,Aa(n))},Ht.without=au,Ht.words=Qa,Ht.wrap=function(n,e){return Ru(wo(e),n)},Ht.xor=cu,Ht.xorBy=lu,Ht.xorWith=su,Ht.zip=fu,Ht.zipObject=function(n,e){return mo(n||[],e||[],tr)},Ht.zipObjectDeep=function(n,e){return mo(n||[],e||[],no)},Ht.zipWith=du,Ht.entries=Da,Ht.entriesIn=Va,Ht.extend=ba,Ht.extendWith=_a,cc(Ht,Ht),Ht.add=mc,Ht.attempt=Ja,Ht.camelCase=Ya,Ht.capitalize=Za,Ht.ceil=xc,Ht.clamp=function(n,e,r){return r===t&&(r=e,e=t),r!==t&&(r=(r=ya(r))==r?r:0),e!==t&&(e=(e=ya(e))==e?e:0),cr(ya(n),e,r)},Ht.clone=function(n){return lr(n,4)},Ht.cloneDeep=function(n){return lr(n,5)},Ht.cloneDeepWith=function(n,e){return lr(n,5,e="function"==typeof e?e:t)},Ht.cloneWith=function(n,e){return lr(n,4,e="function"==typeof e?e:t)},Ht.conformsTo=function(n,e){return null==e||sr(n,e,Ia(e))},Ht.deburr=Xa,Ht.defaultTo=function(n,e){return null==n||n!=n?e:n},Ht.divide=wc,Ht.endsWith=function(n,e,r){n=xa(n),e=so(e);var o=n.length,i=r=r===t?o:cr(pa(r),0,o);return(r-=e.length)>=0&&n.slice(r,i)==e},Ht.eq=Hu,Ht.escape=function(n){return(n=xa(n))&&q.test(n)?n.replace($,it):n},Ht.escapeRegExp=function(n){return(n=xa(n))&&on.test(n)?n.replace(rn,"\\$&"):n},Ht.every=function(n,e,r){var o=Uu(n)?je:pr;return r&&bi(n,e,r)&&(e=t),o(n,si(e,3))},Ht.find=yu,Ht.findIndex=Xi,Ht.findKey=function(n,e){return He(n,si(e,3),br)},Ht.findLast=mu,Ht.findLastIndex=Ui,Ht.findLastKey=function(n,e){return He(n,si(e,3),_r)},Ht.floor=bc,Ht.forEach=xu,Ht.forEachRight=wu,Ht.forIn=function(n,e){return null==n?n:xr(n,si(e,3),Aa)},Ht.forInRight=function(n,e){return null==n?n:wr(n,si(e,3),Aa)},Ht.forOwn=function(n,e){return n&&br(n,si(e,3))},Ht.forOwnRight=function(n,e){return n&&_r(n,si(e,3))},Ht.get=Ma,Ht.gt=Yu,Ht.gte=Zu,Ht.has=function(n,e){return null!=n&&yi(n,e,Nr)},Ht.hasIn=Na,Ht.head=Wi,Ht.identity=oc,Ht.includes=function(n,e,t,r){n=Wu(n)?n:Ha(n),t=t&&!r?pa(t):0;var o=n.length;return t<0&&(t=xt(o+t,0)),ca(n)?t<=o&&n.indexOf(e,t)>-1:!!o&&Ze(n,e,t)>-1},Ht.indexOf=function(n,e,t){var r=null==n?0:n.length;if(!r)return-1;var o=null==t?0:pa(t);return o<0&&(o=xt(r+o,0)),Ze(n,e,o)},Ht.inRange=function(n,e,r){return e=va(e),r===t?(r=e,e=0):r=va(r),function(n,e,t){return n>=wt(e,t)&&n<xt(e,t)}(n=ya(n),e,r)},Ht.invoke=ja,Ht.isArguments=Xu,Ht.isArray=Uu,Ht.isArrayBuffer=Fu,Ht.isArrayLike=Wu,Ht.isArrayLikeObject=$u,Ht.isBoolean=function(n){return!0===n||!1===n||ta(n)&&Cr(n)==x},Ht.isBuffer=Gu,Ht.isDate=qu,Ht.isElement=function(n){return ta(n)&&1===n.nodeType&&!ia(n)},Ht.isEmpty=function(n){if(null==n)return!0;if(Wu(n)&&(Uu(n)||"string"==typeof n||"function"==typeof n.splice||Gu(n)||sa(n)||Xu(n)))return!n.length;var e=gi(n);if(e==S||e==O)return!n.size;if(ki(n))return!Br(n).length;for(var t in n)if(Bn.call(n,t))return!1;return!0},Ht.isEqual=function(n,e){return Ar(n,e)},Ht.isEqualWith=function(n,e,r){var o=(r="function"==typeof r?r:t)?r(n,e):t;return o===t?Ar(n,e,t,r):!!o},Ht.isError=Ku,Ht.isFinite=function(n){return"number"==typeof n&&Ve(n)},Ht.isFunction=Qu,Ht.isInteger=Ju,Ht.isLength=na,Ht.isMap=ra,Ht.isMatch=function(n,e){return n===e||zr(n,e,di(e))},Ht.isMatchWith=function(n,e,r){return r="function"==typeof r?r:t,zr(n,e,di(e),r)},Ht.isNaN=function(n){return oa(n)&&n!=+n},Ht.isNative=function(n){if(Si(n))throw new kn("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Lr(n)},Ht.isNil=function(n){return null==n},Ht.isNull=function(n){return null===n},Ht.isNumber=oa,Ht.isObject=ea,Ht.isObjectLike=ta,Ht.isPlainObject=ia,Ht.isRegExp=ua,Ht.isSafeInteger=function(n){return Ju(n)&&n>=-9007199254740991&&n<=h},Ht.isSet=aa,Ht.isString=ca,Ht.isSymbol=la,Ht.isTypedArray=sa,Ht.isUndefined=function(n){return n===t},Ht.isWeakMap=function(n){return ta(n)&&gi(n)==I},Ht.isWeakSet=function(n){return ta(n)&&"[object WeakSet]"==Cr(n)},Ht.join=function(n,e){return null==n?"":$e.call(n,e)},Ht.kebabCase=Ua,Ht.last=Ki,Ht.lastIndexOf=function(n,e,r){var o=null==n?0:n.length;if(!o)return-1;var i=o;return r!==t&&(i=(i=pa(r))<0?xt(o+i,0):wt(i,o-1)),e==e?function(n,e,t){for(var r=t+1;r--;)if(n[r]===e)return r;return r}(n,e,i):Ye(n,Ue,i,!0)},Ht.lowerCase=Fa,Ht.lowerFirst=Wa,Ht.lt=fa,Ht.lte=da,Ht.max=function(n){return n&&n.length?gr(n,oc,Mr):t},Ht.maxBy=function(n,e){return n&&n.length?gr(n,si(e,2),Mr):t},Ht.mean=function(n){return Fe(n,oc)},Ht.meanBy=function(n,e){return Fe(n,si(e,2))},Ht.min=function(n){return n&&n.length?gr(n,oc,Dr):t},Ht.minBy=function(n,e){return n&&n.length?gr(n,si(e,2),Dr):t},Ht.stubArray=gc,Ht.stubFalse=yc,Ht.stubObject=function(){return{}},Ht.stubString=function(){return""},Ht.stubTrue=function(){return!0},Ht.multiply=Ec,Ht.nth=function(n,e){return n&&n.length?Xr(n,pa(e)):t},Ht.noConflict=function(){return pe._===this&&(pe._=Yn),this},Ht.noop=lc,Ht.now=Mu,Ht.pad=function(n,e,t){n=xa(n);var r=(e=pa(e))?ht(n):0;if(!e||r>=e)return n;var o=(e-r)/2;return Fo(ye(o),t)+n+Fo(ge(o),t)},Ht.padEnd=function(n,e,t){n=xa(n);var r=(e=pa(e))?ht(n):0;return e&&r<e?n+Fo(e-r,t):n},Ht.padStart=function(n,e,t){n=xa(n);var r=(e=pa(e))?ht(n):0;return e&&r<e?Fo(e-r,t)+n:n},Ht.parseInt=function(n,e,t){return t||null==e?e=0:e&&(e=+e),_t(xa(n).replace(un,""),e||0)},Ht.random=function(n,e,r){if(r&&"boolean"!=typeof r&&bi(n,e,r)&&(e=r=t),r===t&&("boolean"==typeof e?(r=e,e=t):"boolean"==typeof n&&(r=n,n=t)),n===t&&e===t?(n=0,e=1):(n=va(n),e===t?(e=n,n=0):e=va(e)),n>e){var o=n;n=e,e=o}if(r||n%1||e%1){var i=Et();return wt(n+i*(e-n+fe("1e-"+((i+"").length-1))),e)}return Gr(n,e)},Ht.reduce=function(n,e,t){var r=Uu(n)?Be:Ge,o=arguments.length<3;return r(n,si(e,4),t,o,hr)},Ht.reduceRight=function(n,e,t){var r=Uu(n)?Re:Ge,o=arguments.length<3;return r(n,si(e,4),t,o,vr)},Ht.repeat=function(n,e,r){return e=(r?bi(n,e,r):e===t)?1:pa(e),qr(xa(n),e)},Ht.replace=function(){var n=arguments,e=xa(n[0]);return n.length<3?e:e.replace(n[1],n[2])},Ht.result=function(n,e,r){var o=-1,i=(e=bo(e,n)).length;for(i||(i=1,n=t);++o<i;){var u=null==n?t:n[Ri(e[o])];u===t&&(o=i,u=r),n=Qu(u)?u.call(n):u}return n},Ht.round=Sc,Ht.runInContext=n,Ht.sample=function(n){return(Uu(n)?Qt:Qr)(n)},Ht.size=function(n){if(null==n)return 0;if(Wu(n))return ca(n)?ht(n):n.length;var e=gi(n);return e==S||e==O?n.size:Br(n).length},Ht.snakeCase=$a,Ht.some=function(n,e,r){var o=Uu(n)?De:io;return r&&bi(n,e,r)&&(e=t),o(n,si(e,3))},Ht.sortedIndex=function(n,e){return uo(n,e)},Ht.sortedIndexBy=function(n,e,t){return ao(n,e,si(t,2))},Ht.sortedIndexOf=function(n,e){var t=null==n?0:n.length;if(t){var r=uo(n,e);if(r<t&&Hu(n[r],e))return r}return-1},Ht.sortedLastIndex=function(n,e){return uo(n,e,!0)},Ht.sortedLastIndexBy=function(n,e,t){return ao(n,e,si(t,2),!0)},Ht.sortedLastIndexOf=function(n,e){if(null==n?0:n.length){var t=uo(n,e,!0)-1;if(Hu(n[t],e))return t}return-1},Ht.startCase=Ga,Ht.startsWith=function(n,e,t){return n=xa(n),t=null==t?0:cr(pa(t),0,n.length),e=so(e),n.slice(t,t+e.length)==e},Ht.subtract=kc,Ht.sum=function(n){return n&&n.length?qe(n,oc):0},Ht.sumBy=function(n,e){return n&&n.length?qe(n,si(e,2)):0},Ht.template=function(n,e,r){var o=Ht.templateSettings;r&&bi(n,e,r)&&(e=t),n=xa(n),e=_a({},e,o,ni);var i,u,a=_a({},e.imports,o.imports,ni),c=Ia(a),l=nt(a,c),s=0,f=e.interpolate||_n,d="__p += '",h=On((e.escape||_n).source+"|"+f.source+"|"+(f===J?vn:_n).source+"|"+(e.evaluate||_n).source+"|$","g"),v="//# sourceURL="+(Bn.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ae+"]")+"\n";n.replace(h,(function(e,t,r,o,a,c){return r||(r=o),d+=n.slice(s,c).replace(En,ut),t&&(i=!0,d+="' +\n__e("+t+") +\n'"),a&&(u=!0,d+="';\n"+a+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),s=c+e.length,e})),d+="';\n";var p=Bn.call(e,"variable")&&e.variable;if(p){if(dn.test(p))throw new kn("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(u?d.replace(X,""):d).replace(U,"$1").replace(F,"$1;"),d="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(u?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var g=Ja((function(){return Cn(c,v+"return "+d).apply(t,l)}));if(g.source=d,Ku(g))throw g;return g},Ht.times=function(n,e){if((n=pa(n))<1||n>h)return[];var t=p,r=wt(n,p);e=si(e),n-=p;for(var o=Ke(r,e);++t<n;)e(t);return o},Ht.toFinite=va,Ht.toInteger=pa,Ht.toLength=ga,Ht.toLower=function(n){return xa(n).toLowerCase()},Ht.toNumber=ya,Ht.toSafeInteger=function(n){return n?cr(pa(n),-9007199254740991,h):0===n?n:0},Ht.toString=xa,Ht.toUpper=function(n){return xa(n).toUpperCase()},Ht.trim=function(n,e,r){if((n=xa(n))&&(r||e===t))return Qe(n);if(!n||!(e=so(e)))return n;var o=vt(n),i=vt(e);return Eo(o,tt(o,i),rt(o,i)+1).join("")},Ht.trimEnd=function(n,e,r){if((n=xa(n))&&(r||e===t))return n.slice(0,pt(n)+1);if(!n||!(e=so(e)))return n;var o=vt(n);return Eo(o,0,rt(o,vt(e))+1).join("")},Ht.trimStart=function(n,e,r){if((n=xa(n))&&(r||e===t))return n.replace(un,"");if(!n||!(e=so(e)))return n;var o=vt(n);return Eo(o,tt(o,vt(e))).join("")},Ht.truncate=function(n,e){var r=30,o="...";if(ea(e)){var i="separator"in e?e.separator:i;r="length"in e?pa(e.length):r,o="omission"in e?so(e.omission):o}var u=(n=xa(n)).length;if(at(n)){var a=vt(n);u=a.length}if(r>=u)return n;var c=r-ht(o);if(c<1)return o;var l=a?Eo(a,0,c).join(""):n.slice(0,c);if(i===t)return l+o;if(a&&(c+=l.length-c),ua(i)){if(n.slice(c).search(i)){var s,f=l;for(i.global||(i=On(i.source,xa(pn.exec(i))+"g")),i.lastIndex=0;s=i.exec(f);)var d=s.index;l=l.slice(0,d===t?c:d)}}else if(n.indexOf(so(i),c)!=c){var h=l.lastIndexOf(i);h>-1&&(l=l.slice(0,h))}return l+o},Ht.unescape=function(n){return(n=xa(n))&&G.test(n)?n.replace(W,gt):n},Ht.uniqueId=function(n){var e=++Rn;return xa(n)+e},Ht.upperCase=qa,Ht.upperFirst=Ka,Ht.each=xu,Ht.eachRight=wu,Ht.first=Wi,cc(Ht,(_c={},br(Ht,(function(n,e){Bn.call(Ht.prototype,e)||(_c[e]=n)})),_c),{chain:!1}),Ht.VERSION="4.17.21",Oe(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(n){Ht[n].placeholder=Ht})),Oe(["drop","take"],(function(n,e){Ut.prototype[n]=function(r){r=r===t?1:xt(pa(r),0);var o=this.__filtered__&&!e?new Ut(this):this.clone();return o.__filtered__?o.__takeCount__=wt(r,o.__takeCount__):o.__views__.push({size:wt(r,p),type:n+(o.__dir__<0?"Right":"")}),o},Ut.prototype[n+"Right"]=function(e){return this.reverse()[n](e).reverse()}})),Oe(["filter","map","takeWhile"],(function(n,e){var t=e+1,r=1==t||3==t;Ut.prototype[n]=function(n){var e=this.clone();return e.__iteratees__.push({iteratee:si(n,3),type:t}),e.__filtered__=e.__filtered__||r,e}})),Oe(["head","last"],(function(n,e){var t="take"+(e?"Right":"");Ut.prototype[n]=function(){return this[t](1).value()[0]}})),Oe(["initial","tail"],(function(n,e){var t="drop"+(e?"":"Right");Ut.prototype[n]=function(){return this.__filtered__?new Ut(this):this[t](1)}})),Ut.prototype.compact=function(){return this.filter(oc)},Ut.prototype.find=function(n){return this.filter(n).head()},Ut.prototype.findLast=function(n){return this.reverse().find(n)},Ut.prototype.invokeMap=Kr((function(n,e){return"function"==typeof n?new Ut(this):this.map((function(t){return jr(t,n,e)}))})),Ut.prototype.reject=function(n){return this.filter(Tu(si(n)))},Ut.prototype.slice=function(n,e){n=pa(n);var r=this;return r.__filtered__&&(n>0||e<0)?new Ut(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),e!==t&&(r=(e=pa(e))<0?r.dropRight(-e):r.take(e-n)),r)},Ut.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Ut.prototype.toArray=function(){return this.take(p)},br(Ut.prototype,(function(n,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),o=/^(?:head|last)$/.test(e),i=Ht[o?"take"+("last"==e?"Right":""):e],u=o||/^find/.test(e);i&&(Ht.prototype[e]=function(){var e=this.__wrapped__,a=o?[1]:arguments,c=e instanceof Ut,l=a[0],s=c||Uu(e),f=function(n){var e=i.apply(Ht,Te([n],a));return o&&d?e[0]:e};s&&r&&"function"==typeof l&&1!=l.length&&(c=s=!1);var d=this.__chain__,h=!!this.__actions__.length,v=u&&!d,p=c&&!h;if(!u&&s){e=p?e:new Ut(this);var g=n.apply(e,a);return g.__actions__.push({func:vu,args:[f],thisArg:t}),new Xt(g,d)}return v&&p?n.apply(this,a):(g=this.thru(f),v?o?g.value()[0]:g.value():g)})})),Oe(["pop","push","shift","sort","splice","unshift"],(function(n){var e=In[n],t=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",r=/^(?:pop|shift)$/.test(n);Ht.prototype[n]=function(){var n=arguments;if(r&&!this.__chain__){var o=this.value();return e.apply(Uu(o)?o:[],n)}return this[t]((function(t){return e.apply(Uu(t)?t:[],n)}))}})),br(Ut.prototype,(function(n,e){var t=Ht[e];if(t){var r=t.name+"";Bn.call(It,r)||(It[r]=[]),It[r].push({name:e,func:t})}})),It[Yo(t,2).name]=[{name:"wrapper",func:t}],Ut.prototype.clone=function(){var n=new Ut(this.__wrapped__);return n.__actions__=jo(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=jo(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=jo(this.__views__),n},Ut.prototype.reverse=function(){if(this.__filtered__){var n=new Ut(this);n.__dir__=-1,n.__filtered__=!0}else(n=this.clone()).__dir__*=-1;return n},Ut.prototype.value=function(){var n=this.__wrapped__.value(),e=this.__dir__,t=Uu(n),r=e<0,o=t?n.length:0,i=function(n,e,t){var r=-1,o=t.length;for(;++r<o;){var i=t[r],u=i.size;switch(i.type){case"drop":n+=u;break;case"dropRight":e-=u;break;case"take":e=wt(e,n+u);break;case"takeRight":n=xt(n,e-u)}}return{start:n,end:e}}(0,o,this.__views__),u=i.start,a=i.end,c=a-u,l=r?a:u-1,s=this.__iteratees__,f=s.length,d=0,h=wt(c,this.__takeCount__);if(!t||!r&&o==c&&h==c)return go(n,this.__actions__);var v=[];n:for(;c--&&d<h;){for(var p=-1,g=n[l+=e];++p<f;){var y=s[p],m=y.iteratee,x=y.type,w=m(g);if(2==x)g=w;else if(!w){if(1==x)continue n;break n}}v[d++]=g}return v},Ht.prototype.at=pu,Ht.prototype.chain=function(){return hu(this)},Ht.prototype.commit=function(){return new Xt(this.value(),this.__chain__)},Ht.prototype.next=function(){this.__values__===t&&(this.__values__=ha(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?t:this.__values__[this.__index__++]}},Ht.prototype.plant=function(n){for(var e,r=this;r instanceof Zt;){var o=Vi(r);o.__index__=0,o.__values__=t,e?i.__wrapped__=o:e=o;var i=o;r=r.__wrapped__}return i.__wrapped__=n,e},Ht.prototype.reverse=function(){var n=this.__wrapped__;if(n instanceof Ut){var e=n;return this.__actions__.length&&(e=new Ut(this)),(e=e.reverse()).__actions__.push({func:vu,args:[eu],thisArg:t}),new Xt(e,this.__chain__)}return this.thru(eu)},Ht.prototype.toJSON=Ht.prototype.valueOf=Ht.prototype.value=function(){return go(this.__wrapped__,this.__actions__)},Ht.prototype.first=Ht.prototype.head,Jn&&(Ht.prototype[Jn]=function(){return this}),Ht}();ye?((ye.exports=yt)._=yt,ge._=yt):pe._=yt}).call(l)}(D_,D_.exports);var V_=s(D_.exports);function H_(n){var e=n.layoutTypes,r=n.layoutConfig,o=void 0===r?T_:r,i=n.edges,u=n.nodeOrigin,a=n.nodes,c=n.container,l=e[null==o?void 0:o.type]||R_[null==o?void 0:o.type];return function(n){return n.every((function(n){var e,t;return(null===(e=n.measured)||void 0===e?void 0:e.width)&&(null===(t=n.measured)||void 0===t?void 0:t.height)}))}(a)&&l?function(n){var e=n.layoutConfig,r=void 0===e?T_:e,o=n.edges,i=n.nodeOrigin,u=n.nodes,a=n.container,c=n.layoutFn,l=V_.cloneDeep(u);l.forEach((function(n){n.data&&(n.data.width=n.measured.width,n.data.height=n.measured.height)}));var s=c(l,o,t({nodeOrigin:i,width:a.width,height:a.height},null==r?void 0:r.options)),f=s.nodes,d=s.edges;return{nodes:f,edges:d,layoutComplete:!0}}({layoutConfig:o,container:c,nodeOrigin:u,nodes:a,layoutFn:l,edges:i}):{nodes:a,edges:i,layoutComplete:!1}}function Y_(n){var e=n.centerConfig,t=n.width,r=n.height,o=n.transform,i=n.panZoom,u=n.nodeOrigin,a=n.nodes;if(e&&i){var c=a.find((function(n){return n.id===e.centerNodeId}));return c?(function(n){var e=n.node,t=n.height,r=n.width,o=n.zoom,i=void 0===o?1:o,u=n.panZoom,a=n.nodeOrigin,c=dw(e),l=uw(e,a).positionAbsolute,s={x:r/2-(l.x+c.width/2)*i,y:t/2-(l.y+c.height/2)*i};u.setViewport({x:s.x,y:s.y,zoom:i})}({node:c,width:t,height:r,panZoom:i,nodeOrigin:u,zoom:o[2]}),!0):(e.centerByBBox&&function(n){var e=n.nodes,t=n.nodeOrigin,r=n.height,o=n.width,i=n.zoom,u=void 0===i?1:i,a=n.panZoom,c=qw(e,{nodeOrigin:t}),l={x:o/2-(c.x+c.width/2)*u,y:r/2-(c.y+c.height/2)*u};a.setViewport({x:l.x,y:l.y,zoom:u})}({nodes:a,width:t,height:r,panZoom:i,nodeOrigin:u,zoom:o[2]}),!0)}}var Z_=function(n){var e,r,o=n.nodes,i=n.edges,l=n.defaultNodes,s=n.defaultEdges,f=n.width,d=n.height,h=n.fitView;return e=function(n,e){return t(t({},B_({nodes:o,edges:i,width:f,height:d,fitView:h,defaultNodes:l,defaultEdges:s})),{setNodes:function(e){n({nodes:e})},setEdges:function(e){n({edges:e})},setDefaultNodesAndEdges:function(t,r){t&&((0,e().onNodesChange)({changes:[],userNodes:t}),n({hasDefaultNodes:!0})),r&&((0,e().onEdgesChange)({userEdges:r}),n({hasDefaultEdges:!0}))},updateNodeInternals:function(r){var o=e(),i=o.triggerNodeChanges,u=o.nodeLookup,l=o.parentLookup,s=o.domNode,f=o.nodeOrigin,d=o.debug,h=function(n,e,r,o,i){var u=null==o?void 0:o.querySelector(".xyflow__viewport"),l=!1;if(!u)return{changes:[],updatedInternals:l};var s=[],f=window.getComputedStyle(u),d=new window.DOMMatrixReadOnly(f.transform).m22,h=[];if(n.forEach((function(n){var r=e.get(n.id);if(null==r?void 0:r.hidden)e.set(r.id,t(t({},r),{internals:t(t({},r.internals),{handleBounds:void 0})})),l=!0;else if(r){var o=Nw(n.nodeElement),u=r.measured.width!==o.width||r.measured.height!==o.height;if(o.width&&o.height&&(u||!r.internals.handleBounds||n.force)){var a=t(t({},r),{measured:o,internals:t(t({},r.internals),{handleBounds:{source:Aw(".source",n.nodeElement,d,r.origin||i),target:Aw(".target",n.nodeElement,d,r.origin||i)}})});e.set(r.id,a),l=!0,u&&(s.push({id:a.id,type:"dimensions",dimensions:o}),a.expandParent&&a.parentId&&h.push({id:a.id,parentId:a.parentId,rect:gw(a,a.origin||i)}))}}})),h.length>0){var v=lw(h,e,r,i);s.push.apply(s,c([],a(v),!1))}return{changes:s,updatedInternals:l}}(r,u,l,s,f),v=h.changes;if(h.updatedInternals){var p=V_.cloneDeep(u);n({nodeLookup:p}),ow(u,{nodeOrigin:f}),(null==v?void 0:v.length)>0&&(d&&console.log("Ink Flow: trigger node changes",v),null==i||i(v))}},updateNodePositions:function(n,r){var o,i;void 0===r&&(r=!1);var l=[],s=[];try{for(var f=u(n),d=f.next();!d.done;d=f.next()){var h=a(d.value,2),v=h[0],p=h[1],g={id:v,type:"position",position:p.position,dragging:r};(null==p?void 0:p.expandParent)&&(null==p?void 0:p.parentId)&&g.position&&(l.push({id:v,parentId:p.parentId,rect:t(t({},p.internals.positionAbsolute),{width:p.measured.width,height:p.measured.height})}),g.position.x=Math.max(0,g.position.x),g.position.y=Math.max(0,g.position.y)),s.push(g)}}catch(n){o={error:n}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(o)throw o.error}}if(l.length>0){var y=e(),m=lw(l,y.nodeLookup,y.parentLookup);s.push.apply(s,c([],a(m),!1))}e().triggerNodeChanges(s)},triggerNodeChanges:function(n){var t=e(),r=t.onNodesChange,o=t.debug;(null==n?void 0:n.length)&&(o&&console.log("Ink Flow: trigger node changes",n),r({changes:n}))},triggerEdgeChanges:function(n){var t=e(),r=t.onEdgesChange,o=t.debug;(null==n?void 0:n.length)&&(o&&console.log("Ink Flow: trigger edge changes",n),null==r||r({changes:n}))},addSelectedNodes:function(n){var t=e(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,u=t.triggerNodeChanges,l=t.triggerEdgeChanges;r?u(n.map((function(n){return Uw(n,!0)}))):(u(Fw(i,new Set(c([],a(n),!1)),!0)),l(Fw(o)))},addSelectedEdges:function(n){var t=e(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,u=t.triggerNodeChanges,l=t.triggerEdgeChanges;r?l(n.map((function(n){return Uw(n,!0)}))):(l(Fw(o,new Set(c([],a(n),!1)))),u(Fw(i,new Set,!0)))},unselectNodesAndEdges:function(n){var t=void 0===n?{}:n,r=t.nodes,o=t.edges,i=e(),u=i.edges,a=i.nodes,c=i.triggerNodeChanges,l=i.triggerEdgeChanges,s=o||u,f=(r||a).map((function(n){return n.selected=!1,Uw(n.id,!1)})),d=s.map((function(n){return Uw(n.id,!1)}));c(f),l(d)},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,u=r.reduce((function(n,e){return e.selected?c(c([],a(n),!1),[Uw(e.id,!1)],!1):n}),[]),l=t.reduce((function(n,e){return e.selected?c(c([],a(n),!1),[Uw(e.id,!1)],!1):n}),[]);o(u),i(l)},setNodeExtent:function(r){var o,i,c=e().nodeLookup;try{for(var l=u(c),s=l.next();!s.done;s=l.next()){var f=a(s.value,2)[1],d=fw(f.position,r);c.set(f.id,t(t({},f),{internals:t(t({},f.internals),{positionAbsolute:d})}))}}catch(n){o={error:n}}finally{try{s&&!s.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}n({nodeExtent:r})},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,u=n.height;if(!t||!e.x&&!e.y)return!1;var a=t.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[i,u]],o);return!!a&&(a.x!==r[0]||a.y!==r[1]||a.k!==r[2])}({delta:n,panZoom:t.panZoom,transform:r,translateExtent:t.translateExtent,width:o,height:i})},cancelConnection:function(){return n({connectionStatus:null,connectionStartHandle:null,connectionEndHandle:null})},updateConnection:function(r){var o,i=e().connectionPosition,u=t(t({},r),{connectionPosition:null!==(o=r.connectionPosition)&&void 0!==o?o:i});n(u)},reset:function(){return n(t({},B_()))},updateLayout:function(t){var r,o=t.config,i=t.nodes,u=t.force,a=e(),c=a.width,l=a.height,s=a.edges,f=a.layoutTypes,d=a.layoutConfig,h=a.panZoom,v=a.nodeOrigin,p=a.nodeLookup,g=a.parentLookup,y=a.elevateNodesOnSelect,m=a.nodes,x=a.fitViewOnInit,w=a.minZoom,b=a.maxZoom,_=a.fitViewOnInitOptions,E=a.transform,S=a.centerConfig,k=a.offsetDone,C=a.fitViewDone,M=a.centered,N=H_({container:{width:c,height:l},edges:s,nodes:i||Array.from(p.values()),nodeOrigin:v,layoutTypes:f,layoutConfig:o||d||T_});if(N.layoutComplete&&(cw(N.nodes,p,g,{nodeOrigin:v,elevateNodesOnSelect:y,checkEquality:!0}),n({nodes:m,layoutComplete:N.layoutComplete}),h&&N.layoutComplete&&function(n){return n.every((function(n){return!!n.position}))}(Array.from(p.values()))&&(u||!(k||M||C))))if(d.offsetConfig){var O=function(n){var e=n.offsetConfig,t=n.width,r=n.height,o=n.panZoom,i=n.nodeOrigin,u=n.nodes,a=n.layoutDirection,c=u.find((function(n){return n.id===(null==e?void 0:e.nodeId)}));if(!a||!c)return!1;var l=Gw(c,i).positionAbsolute,s=dw(c),f=t/2,d=r/2,h={x:0,y:0};switch(a){case"BT":h={x:f-l.x-s.width/2,y:r-l.y-e.offset-s.height};break;case"LR":h={x:e.offset-l.x,y:d-l.y-s.height/2};break;case"RL":h={x:t-l.x-e.offset-s.width,y:d-l.y-s.height/2};break;default:h={x:f-l.x-s.width/2,y:e.offset-l.y}}return o.setViewport({x:h.x,y:h.y,zoom:1}),!0}({offsetConfig:d.offsetConfig,width:c,height:l,nodes:Array.from(p.values()),nodeOrigin:v,transform:E,panZoom:h,layoutDirection:null===(r=d.options)||void 0===r?void 0:r.rankdir});n({offsetDone:O})}else{if(x)return Qw({nodeOrigin:v,width:c,height:l,panZoom:h,fitViewOnInit:x,minZoom:w,maxZoom:b,fitViewOnInitOptions:_,nodeLookup:p}),void n({fitViewDone:!0});S&&(Y_({width:c,height:l,nodeOrigin:v,transform:E,panZoom:h,centerConfig:S,nodes:Array.from(p.values())}),n({centered:!0}))}},onNodesChange:function(n){var r=n.changes,o=n.userNodes;if(r||o){var i=e(),u=i.setNodes,a=i.nodeLookup,c=i.parentLookup,l=i.elevateNodesOnSelect,s=i.nodeOrigin,f=i.nodes,d=i.autoLayout,h=i.updateLayout,v=!(null==r?void 0:r.length),p=[];if(p=v?(o||[]).map((function(n){var e=a.get(n.id),r=t(t({},e||{}),n);return(null==e?void 0:e.position)&&(r.position=e.position),r})):function(n,e){return Xw(n,e)}(r,Array.from(a.values())),v||!function(n){return n.some((function(n){return["dimensions","remove","add","replace"].includes(n.type)}))}(r)||!d)return cw(p,a,c,{nodeOrigin:s,elevateNodesOnSelect:l,checkEquality:!0}),void u(v?o||[]:null!=o?o:f);h({nodes:p})}},onEdgesChange:function(n){var r=n.changes,o=void 0===r?[]:r,i=n.userEdges,u=e(),a=u.connectionLookup,c=u.edgeLookup,l=u.setEdges,s=u.edges,f=!(null==o?void 0:o.length),d=[];d=f?i.map((function(n){var e=c.get(n.id)||{};return t(t({},e),n)})):function(n,e){return Xw(n,e)}(o,Array.from(c.values())),aw(a,c,d),i&&l(f?i||[]:s)},updateLayoutConfig:function(t){var r=e(),o=r.layoutComplete,i=r.updateLayout,u=r.layoutConfig;V_.isEqual(t,u)||(n({layoutConfig:t}),o&&i({config:t,force:!0}))}})},r=Object.is,e?I(e,r):I};function X_(e){var t=e.initialNodes,r=e.initialEdges,o=e.defaultNodes,i=e.defaultEdges,u=e.initialWidth,c=e.initialHeight,l=e.fitView,s=e.children,f=a(n.useState((function(){return Z_({nodes:t,edges:r,defaultNodes:o,defaultEdges:i,width:u,height:c,fitView:l})})),1)[0];return p.jsx(z,{value:f,children:p.jsx(db,{children:s})})}function U_(e){var t=e.children,r=e.nodes,o=e.edges,i=e.defaultNodes,u=e.defaultEdges,a=e.width,c=e.height,l=e.fitView;return n.useContext(A)?p.jsx(p.Fragment,{children:t}):p.jsx(X_,{initialNodes:r,initialEdges:o,defaultNodes:i,defaultEdges:u,initialWidth:a,initialHeight:c,fitView:l,children:t})}var F_=c(c([],a(["layoutConfig","nodes","edges","defaultNodes","defaultEdges","nodesDraggable","minZoom","maxZoom","nodeExtent","elementsSelectable","translateExtent","defaultEdgeOptions","fitView","fitViewOptions","nodeOrigin","autoLayout","centerConfig","layoutTypes"]),!1),["rfId"],!1),W_=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,onNodesChange:n.onNodesChange,onEdgesChange:n.onEdgesChange,updateLayoutConfig:n.updateLayoutConfig}},$_={translateExtent:yv,nodeOrigin:[0,0],minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function G_(e){var r=tw(W_,Rw),o=r.setMinZoom,i=r.setMaxZoom,a=r.setTranslateExtent,c=r.setNodeExtent,l=r.reset,s=r.setDefaultNodesAndEdges,f=r.onNodesChange,d=r.onEdgesChange,h=r.updateLayoutConfig,v=rw();n.useEffect((function(){return s(e.defaultNodes,e.defaultEdges),function(){p.current=$_,l()}}),[]);var p=n.useRef($_);return n.useEffect((function(){var n,r,l,s;try{for(var g=u(F_),y=g.next();!y.done;y=g.next()){var m=y.value,x=e[m];if(x!==p.current[m]&&void 0!==e[m])if("nodes"===m)f({userNodes:x});else if("edges"===m)d({userEdges:x});else if("minZoom"===m)o(x);else if("maxZoom"===m)i(x);else if("translateExtent"===m)a(x);else if("nodeExtent"===m)c(x);else if("fitView"===m)v.setState({fitViewOnInit:x});else if("fitViewOptions"===m)v.setState({fitViewOnInitOptions:x});else if("layoutConfig"===m){var w=x||{},b=t(t({},w),{options:t(t({},w.options||{}),{rankdir:(null===(s=w.options)||void 0===s?void 0:s.rankdir)||"TB"})});h(b)}else v.setState(((l={})[m]=x,l))}}catch(e){n={error:e}}finally{try{y&&!y.done&&(r=g.return)&&r.call(g)}finally{if(n)throw n.error}}p.current=e}),F_.map((function(n){return e[n]}))),null}var q_={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var K_=bw((function(n,e){var o=n.nodes,i=n.edges,u=n.translateExtent,a=void 0===u?yv:u,c=n.defaultViewport,l=void 0===c?L_:c,s=n.minZoom,f=void 0===s?.5:s,d=n.maxZoom,h=void 0===d?2:d,v=n.defaultMarkerColor,g=void 0===v?"#b1b1b7":v,y=n.nodeOrigin,m=n.noDragClassName,x=n.noPanClassName,b=n.disableKeyboardA11y,_=n.nodeTypes,E=n.edgeTypes;n.connectionMode;var S=n.connectionLineType,k=void 0===S?exports.ConnectionLineType.Bezier:S,C=n.connectionLineStyle,M=n.connectionLineComponent,N=n.connectionLineContainerStyle,O=n.onNodeClick,P=n.onNodeDoubleClick,j=n.onNodeMouseEnter,I=n.onNodeMouseMove,A=n.onNodeMouseLeave,z=n.onNodeContextMenu,L=n.onEdgeClick,T=n.onEdgeMouseEnter,B=n.onEdgeMouseMove,R=n.onEdgeMouseLeave,D=n.onEdgeContextMenu,V=n.onEdgeDoubleClick,H=n.fitView,Y=n.fitViewOptions,Z=n.nodeExtent,X=n.nodesDraggable,U=n.children,F=n.id,W=n.width,$=n.height,G=n.onPaneClick,q=n.onPaneContextMenu,K=n.onPaneMouseEnter,Q=n.onPaneMouseMove,J=n.onPaneMouseLeave,nn=n.onPaneScroll,en=n.elementsSelectable,tn=void 0===en||en,rn=n.autoLayout,on=void 0===rn||rn,un=n.layoutConfig,an=void 0===un?T_:un,cn=n.centerConfig,ln=void 0===cn?{}:cn,sn=n.layoutTypes,fn=void 0===sn?{}:sn,dn=r(n,["nodes","edges","translateExtent","defaultViewport","minZoom","maxZoom","defaultMarkerColor","nodeOrigin","noDragClassName","noPanClassName","disableKeyboardA11y","nodeTypes","edgeTypes","connectionMode","connectionLineType","connectionLineStyle","connectionLineComponent","connectionLineContainerStyle","onNodeClick","onNodeDoubleClick","onNodeMouseEnter","onNodeMouseMove","onNodeMouseLeave","onNodeContextMenu","onEdgeClick","onEdgeMouseEnter","onEdgeMouseMove","onEdgeMouseLeave","onEdgeContextMenu","onEdgeDoubleClick","fitView","fitViewOptions","nodeExtent","nodesDraggable","children","id","width","height","onPaneClick","onPaneContextMenu","onPaneMouseEnter","onPaneMouseMove","onPaneMouseLeave","onPaneScroll","elementsSelectable","autoLayout","layoutConfig","centerConfig","layoutTypes"]),hn=F||"1";return p.jsx("div",t({},dn,{ref:e,style:t({},q_),className:w(["ink-flow"]),"data-testid":"rf__wrapper",id:F,children:p.jsxs(U_,{nodes:o,edges:i,width:W,height:$,fitView:H,children:[p.jsx(z_,{onNodeClick:O,onNodeMouseEnter:j,onNodeMouseMove:I,onNodeMouseLeave:A,onNodeContextMenu:z,onNodeDoubleClick:P,onEdgeClick:L,onEdgeMouseEnter:T,onEdgeMouseMove:B,onEdgeMouseLeave:R,onEdgeContextMenu:D,onEdgeDoubleClick:V,rfId:hn,nodeTypes:_,edgeTypes:E,minZoom:f,maxZoom:h,nodeOrigin:y,noDragClassName:m,noPanClassName:x,disableKeyboardA11y:b,translateExtent:a,defaultMarkerColor:g,connectionLineType:k,connectionLineStyle:C,connectionLineComponent:M,connectionLineContainerStyle:N,defaultViewport:l,onPaneClick:G,onPaneContextMenu:q,onPaneMouseEnter:K,onPaneMouseMove:Q,onPaneMouseLeave:J,onPaneScroll:nn}),p.jsx(G_,{nodes:o,edges:i,rfId:hn,fitView:H,fitViewOptions:Y,nodeExtent:Z,nodesDraggable:X,elementsSelectable:tn,minZoom:f,maxZoom:h,nodeOrigin:y,autoLayout:on,layoutConfig:an,layoutTypes:fn,centerConfig:ln}),U]})}))}));function Q_(){return p.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:p.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 J_(){return p.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:p.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 nE(){return p.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:p.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 eE(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:p.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 tE(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:p.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 rE(n){var e=n.children,o=n.className,i=r(n,["children","className"]);return p.jsx("button",t({type:"button",className:w(["ink-flow__controls-button",o])},i,{children:e}))}var oE=function(n){return n.userSelectionActive?"none":"all"};function iE(n){var e=n.position,o=void 0===e?"top-left":e,i=n.children,u=n.className,l=n.style,s=r(n,["position","children","className","style"]),f=tw(oE),d="".concat(o).split("-");return p.jsx("div",t({className:w(c(["ink-flow__panel",u],a(d),!1)),style:t(t({},l),{pointerEvents:f})},s,{children:i}))}var uE=function(n){return{isInteractive:n.nodesDraggable||n.nodesConnectable||n.elementsSelectable,minZoomReached:n.transform[2]<=n.minZoom,maxZoomReached:n.transform[2]>=n.maxZoom}};function aE(n){var e=n.style,t=n.showZoom,r=void 0===t||t,o=n.showFitView,i=void 0===o||o,u=n.showInteractive,a=void 0===u||u,c=n.fitViewOptions,l=n.onZoomIn,s=n.onZoomOut,f=n.onFitView,d=n.onInteractiveChange,h=n.className,v=n.children,g=n.position,y=void 0===g?"bottom-left":g,m=n.orientation,x=void 0===m?"vertical":m,b=n["aria-label"],_=void 0===b?"Ink Flow controls":b,E=rw(),S=tw(uE,Rw),k=S.isInteractive,C=S.minZoomReached,M=S.maxZoomReached,N=pb(),O=N.zoomIn,P=N.zoomOut,j=N.fitView,I="horizontal"===x?"horizontal":"vertical";return p.jsxs(iE,{className:w(["ink-flow__controls",I,h]),position:y,style:e,"data-testid":"rf__controls","aria-label":_,children:[i&&p.jsx(rE,{className:"ink-flow__controls-fitview",onClick:function(){j(c),null==f||f()},"aria-label":"fit view",children:p.jsx(nE,{})}),r&&p.jsxs("div",{className:"ink-flow__controls-zoom",children:[p.jsx(rE,{onClick:function(){O(),null==l||l()},className:"ink-flow__controls-zoomin","aria-label":"zoom in",disabled:M,children:p.jsx(Q_,{})}),p.jsx(rE,{onClick:function(){P(),null==s||s()},className:"ink-flow__controls-zoomout","aria-label":"zoom out",disabled:C,children:p.jsx(J_,{})})]}),a&&p.jsx(rE,{className:"ink-flow__controls-interactive",onClick:function(){E.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),null==d||d(!k)},title:"toggle interactivity","aria-label":"toggle interactivity",children:k?p.jsx(tE,{}):p.jsx(eE,{})}),v]})}aE.displayName="Controls";var cE,lE,sE=n.memo(aE);function fE(n){var e=n.dimensions,t=n.lineWidth,r=n.variant,o=n.className;return p.jsx("path",{strokeWidth:t,d:"M".concat(e[0]/2," 0 V").concat(e[1]," M0 ").concat(e[1]/2," H").concat(e[0]),className:w(["react-flow__background-pattern",r,o])})}function dE(n){var e=n.radius,t=n.className;return p.jsx("circle",{cx:e,cy:e,r:e,className:w(["react-flow__background-pattern","dots",t])})}exports.BackgroundVariant=void 0,(cE=exports.BackgroundVariant||(exports.BackgroundVariant={})).Lines="lines",cE.Dots="dots",cE.Cross="cross";var hE=((lE={})[exports.BackgroundVariant.Dots]=1,lE[exports.BackgroundVariant.Lines]=1,lE[exports.BackgroundVariant.Cross]=6,lE),vE=function(n){return{transform:n.transform,patternId:"pattern-".concat(n.rfId)}};function pE(e){var r=e.id,o=e.variant,i=void 0===o?exports.BackgroundVariant.Dots:o,u=e.gap,a=void 0===u?20:u,c=e.size,l=e.lineWidth,s=void 0===l?1:l,f=e.offset,d=void 0===f?2:f,h=e.color,v=e.bgColor,g=e.style,y=e.className,m=e.patternClassName,x=n.useRef(null),b=tw(vE,Rw),_=b.transform,E=b.patternId,S=c||hE[i],k=i===exports.BackgroundVariant.Dots,C=i===exports.BackgroundVariant.Cross,M=Array.isArray(a)?a:[a,a],N=[M[0]*_[2]||1,M[1]*_[2]||1],O=S*_[2],P=C?[O,O]:N,j=k?[O/d,O/d]:[P[0]/d,P[1]/d],I="".concat(E).concat(r||"");return p.jsxs("svg",{className:w(["ink-flow__background",y]),style:t(t(t({},g),Dw),{"--xy-background-color-props":v,"--xy-background-pattern-color-props":h}),ref:x,"data-testid":"rf__background",children:[p.jsx("pattern",{id:I,x:_[0]%N[0],y:_[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:"translate(-".concat(j[0],",-").concat(j[1],")"),children:k?p.jsx(dE,{radius:O/d,className:m}):p.jsx(fE,{dimensions:P,lineWidth:s,variant:i,className:m})}),p.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"url(#".concat(I,")")})]})}pE.displayName="Background";var gE=n.memo(pE),yE=function(n){var e;return null===(e=n.domNode)||void 0===e?void 0:e.querySelector(".ink-flow__edgelabel-renderer")};exports.Background=gE,exports.BaseEdge=Wb,exports.ControlButton=rE,exports.Controls=sE,exports.EdgeLabelRenderer=function(n){var t=n.children,r=tw(yE);return r?e.createPortal(t,r):null},exports.Handle=jb,exports.InkFlowProvider=X_,exports.SmoothStepEdge=n_,exports.StepEdge=r_,exports.addEdge=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)?L({},n):L(L({},n),{id:$v(n)}),e)?e:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,e.concat(t)):e;var t},exports.dagreLayout=Jv,exports.default=K_,exports.getBezierEdgeCenter=Yv,exports.getBezierPath=Uv,exports.getConnectedEdges=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)}))},exports.getEdgeCenter=Fv,exports.getIncomers=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)}))},exports.getNodesBounds=Ev,exports.getOutgoers=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)}))},exports.getSmoothStepPath=Qv,exports.getStraightPath=function(n){var e=n.sourceX,t=n.sourceY,r=n.targetX,o=n.targetY,i=B(Fv({sourceX:e,sourceY:t,targetX:r,targetY:o}),4),u=i[0],a=i[1],c=i[2],l=i[3];return["M ".concat(e,",").concat(t,"L ").concat(r,",").concat(o),u,a,c,l]},exports.getViewportForBounds=Lv,exports.updateEdge=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 u=L(L({},i),{id:r.shouldReplaceId?$v(e):o,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle});return t.filter((function(n){return n.id!==o})).concat(u)},exports.useEdgesState=function(e){var t=a(n.useState(e),2);return[t[0],t[1]]},exports.useInkFlow=pb,exports.useNodesState=function(e){var t=a(n.useState(e),2);return[t[0],t[1]]},exports.useStore=tw,exports.useStoreApi=rw;
17
25
  //# sourceMappingURL=index.cjs.js.map