3 lines
122 KiB
JavaScript
3 lines
122 KiB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","react-dom"],e):e((t=t||self).ReactFlow={},t.React,t.PropTypes,t.ReactDOM)}(this,function(t,O,e,n){"use strict";var r,N="default"in O?O.default:O;e=e&&e.hasOwnProperty("default")?e.default:e,n=n&&n.hasOwnProperty("default")?n.default:n;var l="undefined"!=typeof Symbol?Symbol("immer-nothing"):((r={})["immer-nothing"]=!0,r),o="undefined"!=typeof Symbol&&Symbol.for?Symbol.for("immer-draftable"):"__$immer_draftable",d="undefined"!=typeof Symbol&&Symbol.for?Symbol.for("immer-state"):"__$immer_state";function h(t){return!!t&&!!t[d]}function p(t){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t))return!0;var e=Object.getPrototypeOf(t);return!e||e===Object.prototype||(!!t[o]||!!t.constructor[o])}var i=Object.assign||function(t,e){for(var n in e)c(e,n)&&(t[n]=e[n]);return t},a="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames;function y(r,o){if(void 0===o&&(o=!1),Array.isArray(r))return r.slice();var i=Object.create(Object.getPrototypeOf(r));return a(r).forEach(function(t){if(t!==d){var e=Object.getOwnPropertyDescriptor(r,t),n=e.value;e.get&&o&&(n=e.get.call(r)),e.enumerable?i[t]=n:o&&Object.defineProperty(i,t,{value:n,writable:!0,configurable:!0})}}),i}function m(e,n){if(Array.isArray(e))for(var t=0;t<e.length;t++)n(t,e[t],e);else a(e).forEach(function(t){return n(t,e[t],e)})}function g(t,e){var n=Object.getOwnPropertyDescriptor(t,e);return!!n&&n.enumerable}function c(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function v(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}var f=function(t){this.drafts=[],this.parent=t,this.canAutoFreeze=!0,this.patches=null};function u(t){t[d].revoke()}f.prototype.usePatches=function(t){t&&(this.patches=[],this.inversePatches=[],this.patchListener=t)},f.prototype.revoke=function(){this.leave(),this.drafts.forEach(u),this.drafts=null},f.prototype.leave=function(){this===f.current&&(f.current=this.parent)},f.current=null,f.enter=function(){return this.current=new f(this.current)};var s={};function w(e,t){var n=Array.isArray(e),r=k(e);m(r,function(t){!function(t,e,n){var r=s[e];r?r.enumerable=n:s[e]=r={configurable:!0,enumerable:n,get:function(){return function(t,e){P(t);var n=x(_(t),e);if(t.finalizing)return n;if(n===x(t.base,e)&&p(n))return S(t),t.copy[e]=w(n,t);return n}(this[d],e)},set:function(t){!function(t,e,n){if(P(t),t.assigned[e]=!0,!t.modified){if(v(n,x(_(t),e)))return;E(t),S(t)}t.copy[e]=n}(this[d],e,t)}};Object.defineProperty(t,e,r)}(r,t,n||g(e,t))});var o=t?t.scope:f.current;return function(t,e,n){Object.defineProperty(t,e,{value:n,enumerable:!1,writable:!0})}(r,d,{scope:o,modified:!1,finalizing:!1,finalized:!1,assigned:{},parent:t,base:e,draft:r,copy:null,revoke:b,revoked:!1}),o.drafts.push(r),r}function b(){this.revoked=!0}function _(t){return t.copy||t.base}function x(t,e){var n=t[d];if(!n||n.finalizing)return t[e];n.finalizing=!0;var r=t[e];return n.finalizing=!1,r}function E(t){t.modified||(t.modified=!0,t.parent&&E(t.parent))}function S(t){t.copy||(t.copy=k(t.base))}function k(t){var e=t&&t[d];if(e){e.finalizing=!0;var n=y(e.draft,!0);return e.finalizing=!1,n}return y(t)}function P(t){if(!0===t.revoked)throw new Error("Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+JSON.stringify(_(t)))}function A(t){for(var e=t.length-1;0<=e;e--){var n=t[e][d];n.modified||(Array.isArray(n.base)?j(n)&&E(n):T(n)&&E(n))}}function T(t){for(var e=t.base,n=t.draft,r=Object.keys(n),o=r.length-1;0<=o;o--){var i=r[o],a=e[i];if(void 0===a&&!c(e,i))return!0;var u=n[i],s=u&&u[d];if(s?s.base!==a:!v(u,a))return!0}return r.length!==Object.keys(e).length}function j(t){var e=t.draft;if(e.length!==t.base.length)return!0;var n=Object.getOwnPropertyDescriptor(e,e.length-1);return!(!n||n.get)}var C=Object.freeze({willFinalize:function(t,e,n){t.drafts.forEach(function(t){t[d].finalizing=!0}),n?h(e)&&e[d].scope===t&&A(t.drafts):(t.patches&&function e(t){if(!t||"object"!=typeof t)return;var n=t[d];if(!n)return;var r=n.base;var o=n.draft;var i=n.assigned;if(Array.isArray(t)){if(j(n)){if(E(n),i.length=!0,o.length<r.length)for(var a=o.length;a<r.length;a++)i[a]=!1;else for(var u=r.length;u<o.length;u++)i[u]=!0;for(var s=0;s<o.length;s++)void 0===i[s]&&e(o[s])}}else Object.keys(o).forEach(function(t){void 0!==r[t]||c(r,t)?i[t]||e(o[t]):(i[t]=!0,E(n))}),Object.keys(r).forEach(function(t){void 0!==o[t]||c(o,t)||(i[t]=!1,E(n))})}(t.drafts[0]),A(t.drafts))},createProxy:w});function D(t,e){var n=e?e.scope:f.current,r={scope:n,modified:!1,finalized:!1,assigned:{},parent:e,base:t,draft:null,drafts:{},copy:null,revoke:null},o=Array.isArray(t)?Proxy.revocable([r],I):Proxy.revocable(r,M),i=o.revoke,a=o.proxy;return r.draft=a,r.revoke=i,n.drafts.push(a),a}var M={get:function(t,e){if(e===d)return t;var n=t.drafts;if(!t.modified&&c(n,e))return n[e];var r=z(t)[e];if(t.finalized||!p(r))return r;if(t.modified){if(r!==R(t.base,e))return r;n=t.copy}return n[e]=D(r,t)},has:function(t,e){return e in z(t)},ownKeys:function(t){return Reflect.ownKeys(z(t))},set:function(t,e,n){if(!t.modified){var r=R(t.base,e);if(n?v(r,n)||n===t.drafts[e]:v(r,n)&&e in t.base)return!0;L(t)}return t.assigned[e]=!0,t.copy[e]=n,!0},deleteProperty:function(t,e){(void 0!==R(t.base,e)||e in t.base)&&(t.assigned[e]=!1,L(t));t.copy&&delete t.copy[e];return!0},getOwnPropertyDescriptor:function(t,e){var n=z(t),r=Reflect.getOwnPropertyDescriptor(n,e);r&&(r.writable=!0,r.configurable=!Array.isArray(n)||"length"!==e);return r},defineProperty:function(){throw new Error("Object.defineProperty() cannot be used on an Immer draft")},getPrototypeOf:function(t){return Object.getPrototypeOf(t.base)},setPrototypeOf:function(){throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft")}},I={};function z(t){return t.copy||t.base}function R(t,e){var n=t[d],r=Reflect.getOwnPropertyDescriptor(n?z(n):t,e);return r&&r.value}function L(t){t.modified||(t.modified=!0,t.copy=i(y(t.base),t.drafts),t.drafts=null,t.parent&&L(t.parent))}m(M,function(t,e){I[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),I.deleteProperty=function(t,e){if(isNaN(parseInt(e)))throw new Error("Immer only supports deleting array indices");return M.deleteProperty.call(this,t[0],e)},I.set=function(t,e,n){if("length"!==e&&isNaN(parseInt(e)))throw new Error("Immer only supports setting array indices and the 'length' property");return M.set.call(this,t[0],e,n)};var X=Object.freeze({willFinalize:function(){},createProxy:D});function Y(t,e,n,r){Array.isArray(t.base)?function(t,e,n,r){var o,i,a=t.base,u=t.copy,s=t.assigned;u.length<a.length&&(a=(o=[u,a])[0],u=o[1],n=(i=[r,n])[0],r=i[1]);var c=u.length-a.length,l=0;for(;a[l]===u[l]&&l<a.length;)++l;var f=a.length;for(;l<f&&a[f-1]===u[f+c-1];)--f;for(var d=l;d<f;++d)if(s[d]&&u[d]!==a[d]){var h=e.concat([d]);n.push({op:"replace",path:h,value:u[d]}),r.push({op:"replace",path:h,value:a[d]})}for(var p=f!=a.length,y=n.length,m=f+c-1;f<=m;--m){var g=e.concat([m]);n[y+m-f]={op:"add",path:g,value:u[m]},p&&r.push({op:"remove",path:g})}p||r.push({op:"replace",path:e.concat(["length"]),value:a.length})}(t,e,n,r):function(t,a,u,s){var c=t.base,l=t.copy;m(t.assigned,function(t,e){var n=c[t],r=l[t],o=e?t in c?"replace":"add":"remove";if(n!==r||"replace"!=o){var i=a.concat(t);u.push("remove"==o?{op:o,path:i}:{op:o,path:i,value:r}),s.push("add"==o?{op:"remove",path:i}:"remove"==o?{op:"add",path:i,value:n}:{op:"replace",path:i,value:n})}})}(t,e,n,r)}function V(t,e){for(var n=0;n<e.length;n++){var r=e[n],o=r.path;if(0===o.length&&"replace"===r.op)t=r.value;else{for(var i=t,a=0;a<o.length-1;a++)if(!(i=i[o[a]])||"object"!=typeof i)throw new Error("Cannot apply patch, path doesn't resolve: "+o.join("/"));var u=o[o.length-1];switch(r.op){case"replace":i[u]=r.value;break;case"add":Array.isArray(i)?i.splice(u,0,r.value):i[u]=r.value;break;case"remove":Array.isArray(i)?i.splice(u,1):delete i[u];break;default:throw new Error("Unsupported patch operation: "+r.op)}}}return t}function B(t){i(this,q,t),this.setUseProxies(this.useProxies),this.produce=this.produce.bind(this)}var q={useProxies:"undefined"!=typeof Proxy&&"undefined"!=typeof Reflect,autoFreeze:"undefined"!=typeof process?"production"!==process.env.NODE_ENV:"verifyMinified"===function(){}.name,onAssign:null,onDelete:null,onCopy:null};B.prototype.produce=function(t,o,e){var n,r=this;if("function"==typeof t&&"function"!=typeof o){var i=o;o=t;var a=this;return function(t){var e=this;void 0===t&&(t=i);for(var n=[],r=arguments.length-1;0<r--;)n[r]=arguments[r+1];return a.produce(t,function(t){return o.call.apply(o,[e,t].concat(n))})}}if("function"!=typeof o)throw new Error("The first or second argument to `produce` must be a function");if(void 0!==e&&"function"!=typeof e)throw new Error("The third argument to `produce` must be a function or undefined");if(p(t)){var u=f.enter(),s=this.createProxy(t),c=!0;try{n=o(s),c=!1}finally{c?u.revoke():u.leave()}return n instanceof Promise?n.then(function(t){return u.usePatches(e),r.processResult(t,u)},function(t){throw u.revoke(),t}):(u.usePatches(e),this.processResult(n,u))}return void 0===(n=o(t))?t:n!==l?n:void 0},B.prototype.createDraft=function(t){if(!p(t))throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object");var e=f.enter(),n=this.createProxy(t);return n[d].isManual=!0,e.leave(),n},B.prototype.finishDraft=function(t,e){var n=t&&t[d];if(!n||!n.isManual)throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`");if(n.finalized)throw new Error("The given draft is already finalized");var r=n.scope;return r.usePatches(e),this.processResult(void 0,r)},B.prototype.setAutoFreeze=function(t){this.autoFreeze=t},B.prototype.setUseProxies=function(t){this.useProxies=t,i(this,t?X:C)},B.prototype.applyPatches=function(t,e){return h(t)?V(t,e):this.produce(t,function(t){return V(t,e)})},B.prototype.processResult=function(t,e){var n=e.drafts[0],r=void 0!==t&&t!==n;if(this.willFinalize(e,t,r),r){if(n[d].modified)throw e.revoke(),new Error("An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.");p(t)&&(t=this.finalize(t,null,e)),e.patches&&(e.patches.push({op:"replace",path:[],value:t}),e.inversePatches.push({op:"replace",path:[],value:n[d].base}))}else t=this.finalize(n,[],e);return e.revoke(),e.patches&&e.patchListener(e.patches,e.inversePatches),t!==l?t:void 0},B.prototype.finalize=function(t,e,n){var r=this,o=t[d];if(!o)return Object.isFrozen(t)?t:this.finalizeTree(t,null,n);if(o.scope!==n)return t;if(!o.modified)return o.base;if(!o.finalized){if(o.finalized=!0,this.finalizeTree(o.draft,e,n),this.onDelete)if(this.useProxies){var i=o.assigned;for(var a in i)i[a]||this.onDelete(o,a)}else{var u=o.base,s=o.copy;m(u,function(t){c(s,t)||r.onDelete(o,t)})}this.onCopy&&this.onCopy(o),this.autoFreeze&&n.canAutoFreeze&&Object.freeze(o.copy),e&&n.patches&&Y(o,e,n.patches,n.inversePatches)}return o.copy},B.prototype.finalizeTree=function(i,a,u){var s=this,c=i[d];c&&(this.useProxies||(c.copy=y(c.draft,!0)),i=c.copy);var l=!!a&&!!u.patches,f=function(t,e,n){if(e===n)throw Error("Immer forbids circular references");var r=!!c&&n===i;if(h(e)){var o=r&&l&&!c.assigned[t]?a.concat(t):null;if(h(e=s.finalize(e,o,u))&&(u.canAutoFreeze=!1),Array.isArray(n)||g(n,t)?n[t]=e:Object.defineProperty(n,t,{value:e}),r&&e===c.base[t])return}else{if(r&&v(e,c.base[t]))return;p(e)&&!Object.isFrozen(e)&&m(e,f)}r&&s.onAssign&&s.onAssign(c,t,e)};return m(i,f),i};var H,U=new B,F=U.setAutoFreeze.bind(U),G=(U.setUseProxies.bind(U),U.applyPatches.bind(U),U.createDraft.bind(U)),W=U.finishDraft.bind(U);H="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")();function K(){return Math.random().toString(36).substring(7).split("").join(".")}var $,Z,J=("function"==typeof(Z=H.Symbol)?Z.observable?$=Z.observable:($=Z("observable"),Z.observable=$):$="@@observable",$),Q={INIT:"@@redux/INIT"+K(),REPLACE:"@@redux/REPLACE"+K(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+K()}};function tt(t,e,n){var r;if("function"==typeof e&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if("function"==typeof e&&void 0===n&&(n=e,e=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(tt)(t,e)}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var o=t,i=e,a=[],u=a,s=!1;function c(){u===a&&(u=a.slice())}function l(){if(s)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function f(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(s)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var n=!0;return c(),u.push(e),function(){if(n){if(s)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");n=!1,c();var t=u.indexOf(e);u.splice(t,1)}}}function d(t){if(!function(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(s)throw new Error("Reducers may not dispatch actions.");try{s=!0,i=o(i,t)}finally{s=!1}for(var e=a=u,n=0;n<e.length;n++){(0,e[n])()}return t}return d({type:Q.INIT}),(r={dispatch:d,subscribe:f,getState:l,replaceReducer:function(t){if("function"!=typeof t)throw new Error("Expected the nextReducer to be a function.");o=t,d({type:Q.REPLACE})}})[J]=function(){var t,n=f;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new TypeError("Expected the observer to be an object.");function e(){t.next&&t.next(l())}return e(),{unsubscribe:n(e)}}})[J]=function(){return this},t},r}function et(e,t){var n=Object.keys(e);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(e)),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n}function nt(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return 0===e.length?function(t){return t}:1===e.length?e[0]:e.reduce(function(t,e){return function(){return t(e.apply(void 0,arguments))}})}function rt(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];return function(o){return function(){var t=o.apply(void 0,arguments),e=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},n={getState:t.getState,dispatch:function(){return e.apply(void 0,arguments)}},r=i.map(function(t){return t(n)});return function(o){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?et(i,!0).forEach(function(t){var e,n,r;e=o,r=i[n=t],n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):et(i).forEach(function(t){Object.defineProperty(o,t,Object.getOwnPropertyDescriptor(i,t))})}return o}({},t,{dispatch:e=nt.apply(void 0,r)(t.dispatch)})}}}function ot(){}function it(o){return function(t){var n=t.dispatch,r=t.getState;return function(e){return function(t){return"function"==typeof t?t(n,r,o):e(t)}}}}"production"!==process.env.NODE_ENV&&"string"==typeof ot.name&&"isCrushed"!==ot.name&&function(t){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t);try{throw new Error(t)}catch(t){}}('You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) to ensure you have the correct code for your production build.');var at=it();function ut(){return this.list=[],this.lastItem=void 0,this.size=0,this}at.withExtraArgument=it,ut.prototype.get=function(t){var e;return this.lastItem&&this.isEqual(this.lastItem.key,t)?this.lastItem.val:0<=(e=this.indexOf(t))?(this.lastItem=this.list[e],this.list[e].val):void 0},ut.prototype.set=function(t,e){var n;return this.lastItem&&this.isEqual(this.lastItem.key,t)?this.lastItem.val=e:0<=(n=this.indexOf(t))?(this.lastItem=this.list[n],this.list[n].val=e):(this.lastItem={key:t,val:e},this.list.push(this.lastItem),this.size++),this},ut.prototype.delete=function(t){var e;if(this.lastItem&&this.isEqual(this.lastItem.key,t)&&(this.lastItem=void 0),0<=(e=this.indexOf(t)))return this.size--,this.list.splice(e,1)[0]},ut.prototype.has=function(t){var e;return!(!this.lastItem||!this.isEqual(this.lastItem.key,t))||0<=(e=this.indexOf(t))&&(this.lastItem=this.list[e],!0)},ut.prototype.forEach=function(t,e){var n;for(n=0;n<this.size;n++)t.call(e||this,this.list[n].val,this.list[n].key,this)},ut.prototype.indexOf=function(t){var e;for(e=0;e<this.size;e++)if(this.isEqual(this.list[e].key,t))return e;return-1},ut.prototype.isEqual=function(t,e){return t===e||t!=t&&e!=e};function st(t){return"function"!=typeof Map||t?new ct:new Map}var ct=ut,lt=function(c){var l=new st("true"===process.env.FORCE_SIMILAR_INSTEAD_OF_MAP),f=[];return function(u){var s=function(){var t,e,n,r=l,o=arguments.length-1,i=Array(1+o),a=!0;if((s.numArgs||0===s.numArgs)&&s.numArgs!==1+o)throw new Error("Memoizerific functions should always be called with the same number of arguments");for(n=0;n<o;n++)i[n]={cacheItem:r,arg:arguments[n]},r=r.has(arguments[n])?r.get(arguments[n]):(a=!1,t=new st("true"===process.env.FORCE_SIMILAR_INSTEAD_OF_MAP),r.set(arguments[n],t),t);return a&&(r.has(arguments[o])?e=r.get(arguments[o]):a=!1),a||(e=u.apply(null,arguments),r.set(arguments[o],e)),0<c&&(i[o]={cacheItem:r,arg:arguments[o]},a?function(t,e){var n,r,o,i=t.length,a=e.length;for(r=0;r<i;r++){for(n=!0,o=0;o<a;o++)if(u=t[r][o].arg,s=e[o].arg,u!==s&&(u==u||s==s)){n=!1;break}if(n)break}var u,s;t.push(t.splice(r,1)[0])}(f,i):f.push(i),f.length>c&&function(t){var e,n,r=t.length,o=t[r-1];for(o.cacheItem.delete(o.arg),n=r-2;0<=n&&(o=t[n],!(e=o.cacheItem.get(o.arg))||!e.size);n--)o.cacheItem.delete(o.arg)}(f.shift())),s.wasMemoized=a,s.numArgs=1+o,e};return s.limit=c,s.wasMemoized=!1,s.cache=l,s.lru=f,s}};var ft=O.createContext(),dt="undefined"!=typeof window?O.useLayoutEffect:O.useEffect;var ht,pt=(ht=ft,function(t){var n=O.useContext(ht),r=O.useRef(t),o=O.useRef(),i=O.useRef(!0),a=O.useRef(),u=O.useReducer(function(t){return t+1},0)[1];if(a.current||r.current!==t||void 0===o.current)try{o.current=t(n.getState())}catch(t){var e="An error occurred trying to map state in a useStoreState hook: "+t.message+".";throw a.current&&(e+="\nThis error may be related to the following error:\n"+a.current.stack+"\n\nOriginal stack trace:"),new Error(e)}return dt(function(){r.current=t,a.current=void 0}),dt(function(){function t(){try{var t=r.current(n.getState());if(t===o.current)return;o.current=t}catch(t){a.current=t}i.current&&u({})}var e=n.subscribe(t);return t(),function(){i.current=!1,e()}},[]),o.current});var yt,mt=(yt=ft,function(t){return t(O.useContext(yt).getActions())});function gt(){return(gt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function vt(t){return t[wt]={},t}var wt="🙈action🙈",bt="🙈actionOn🙈",_t="🙈computedSymbol🙈",xt="🙈reducer🙈",Et="🙈thunkOn🙈",St="🙈thunk🙈",Ot=function(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object},Nt=function(t,e){return t.reduce(function(t,e){return Ot(t)?t[e]:void 0},e)},kt=function(r,t,o){r.reduce(function(t,e,n){return n+1===r.length?t[e]=o:t[e]=t[e]||{},t[e]},t)},Pt=function t(e,n,r){if(0===e.length)return r;var o=gt({},n),i=e[0];return 1===e.length?o[i]=r:o[i]=t(e.slice(1),o[i],r),o};function At(t){var a=t.disableImmer,x=t.initialState,E=t.injections,e=t.model,n=t.reducerEnhancer,S=t.references;function u(t,e,n){if(a){var r=Nt(t,e),o=n(r);return r!==o?Pt(t,e,o):e}var i=G(e);return n(Nt(t,i)),W(i)}var O=x,N={},k={},P={},A={},T=[],j=[],C={},o={},D=[],M={isInReducer:!1,currentState:O};!function w(b,_){return Object.keys(b).forEach(function(e){function t(){var t=Nt(_,x);kt(r,O,t&&e in t?t[e]:n)}var n=b[e],r=[].concat(_,[e]),o={parent:_,path:r};if("function"==typeof n)if(n[wt]||n[bt]){var i=(n[wt]?"@action":"@actionOn")+"."+r.join("."),a=n[wt]||n[bt];a.actionName=e,a.type=i,a.parent=o.parent,a.path=o.path,P[i]=n;var u=function(t){var e={type:i,payload:t};return n[bt]&&a.resolvedTargets&&(t.resolvedTargets=[].concat(a.resolvedTargets)),S.dispatch(e)};N[u.type=i]=u,"easyPeasyReplaceState"!==e&&(n[bt]?(D.push(n),kt(r,C,u)):kt(r,k,u))}else if(n[St]||n[Et]){var s=(n[St]?"@thunk":"@thunkOn")+"."+r.join("."),c=n[St]||n[Et];c.actionName=e,c.type=s,c.parent=o.parent,c.path=o.path;var l=function(t){var e={dispatch:S.dispatch,getState:function(){return Nt(_,S.getState())},getStoreActions:function(){return k},getStoreState:S.getState,injections:E,meta:o};return n[Et]&&c.resolvedTargets&&(t.resolvedTargets=[].concat(c.resolvedTargets)),n(Nt(_,k),t,e)};kt(r,A,l);var f=s+"(start)",d=s+"(success)",h=s+"(fail)",p=function(e){function n(t){S.dispatch({type:h,payload:e,error:t}),S.dispatch({type:s,payload:e,error:t})}function r(t){S.dispatch({type:d,payload:e,result:t}),S.dispatch({type:s,payload:e,result:t})}S.dispatch({type:f,payload:e});try{var t=S.dispatch(function(){return l(e)});return"object"==typeof t&&"function"==typeof t.then?t.then(function(t){return r(t),t}).catch(function(t){throw n(t),t}):(r(t),t)}catch(t){throw n(t),t}};p.type=s,p.startType=f,p.successType=d,p.failType=h,N[s]=p,n[Et]?(D.push(n),kt(r,C,p)):kt(r,k,p)}else if(n[_t]){var y=Nt(_,O),m=n[_t],g=lt(1)(n),v=function(t){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){var e;if(M.isInReducer)e=M.currentState;else{if(null==S.getState)return;try{e=S.getState()}catch(t){return void("production"!==process.env.NODE_ENV&&console.warn("Invalid access attempt to a computed property"))}}var n=Nt(_,e),t=m.stateResolvers.map(function(t){return t(n,e)});return g.apply(void 0,t)}})};v(y),T.push({key:e,parentPath:_,createComputedProperty:v})}else n[xt]?j.push({key:e,parentPath:_,reducer:n}):t();else if(Ot(n)){null==Nt(r,O)&&kt(r,O,{}),w(n,r)}else t()})}(e,[]),D.forEach(function(t){var n=t[bt]||t[Et],e=n.targetResolver(Nt(n.parent,k),k),r=(Array.isArray(e)?e:[e]).reduce(function(t,e){return"function"==typeof e&&e.type&&N[e.type]?t.push(e.type):"string"==typeof e&&t.push(e),t},[]);(n.resolvedTargets=r).forEach(function(t){var e=o[t]||[];e.push(N[n.type]),o[t]=e})});return{actionCreatorDict:N,actionCreators:k,computedProperties:T,computedState:M,defaultState:O,listenerActionCreators:C,listenerActionMap:o,reducer:n(function(t,e){var n=i(t,e),r=0<j.length?function(t,i){return j.reduce(function(t,e){var n=e.parentPath,r=e.key,o=e.reducer;return u(n,t,function(t){return t[r]=o(t[r],i),t})},t)}(n,e):n;return t!==r&&T.forEach(function(t){var e=t.parentPath;(0,t.createComputedProperty)(Nt(e,r))}),r})};function i(t,e){var n=P[e.type];return n?function(t,e,n,r){return u(r,t,function(t){return n(t,e.payload)})}(t,e,n,(n[wt]||n[bt]).parent):t}}function Tt(t){var e=t.children,n=t.store;return N.createElement(ft.Provider,{value:n},e)}function jt(){return(jt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function Ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Dt(o){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Ct(i,!0).forEach(function(t){var e,n,r;e=o,r=i[n=t],n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):Ct(i).forEach(function(t){Object.defineProperty(o,t,Object.getOwnPropertyDescriptor(i,t))})}return o}function Mt(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],0<=e.indexOf(n)||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],0<=e.indexOf(n)||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function It(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function zt(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}F(!1);var Rt={value:function(){}};function Lt(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new Xt(r)}function Xt(t){this._=t}function Yt(t,e){for(var n,r=0,o=t.length;r<o;++r)if((n=t[r]).name===e)return n.value}function Vt(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=Rt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}Xt.prototype=Lt.prototype={constructor:Xt,on:function(t,e){var n,r=this._,o=function(t,r){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(0<=n&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})}(t+"",r),i=-1,a=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++i<a;)if(n=(t=o[i]).type)r[n]=Vt(r[n],t.name,e);else if(null==e)for(n in r)r[n]=Vt(r[n],t.name,null);return this}for(;++i<a;)if((n=(t=o[i]).type)&&(n=Yt(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Xt(t)},call:function(t,e){if(0<(n=arguments.length-2))for(var n,r,o=new Array(n),i=0;i<n;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,n=(r=this._[t]).length;i<n;++i)r[i].value.apply(e,o)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],o=0,i=r.length;o<i;++o)r[o].value.apply(e,n)}};var Bt="http://www.w3.org/1999/xhtml",qt={svg:"http://www.w3.org/2000/svg",xhtml:Bt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ht(t){var e=t+="",n=e.indexOf(":");return 0<=n&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),qt.hasOwnProperty(e)?{space:qt[e],local:t}:t}function Ut(t){var e=Ht(t);return(e.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(n){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===Bt&&t.documentElement.namespaceURI===Bt?t.createElement(n):t.createElementNS(e,n)}})(e)}function Ft(){}function Gt(t){return null==t?Ft:function(){return this.querySelector(t)}}function Wt(){return[]}function Kt(t){return null==t?Wt:function(){return this.querySelectorAll(t)}}function $t(t){return function(){return this.matches(t)}}function Zt(t){return new Array(t.length)}function Jt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Jt.prototype={constructor:Jt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var Qt="$";function te(t,e,n,r,o,i){for(var a,u=0,s=e.length,c=i.length;u<c;++u)(a=e[u])?(a.__data__=i[u],r[u]=a):n[u]=new Jt(t,i[u]);for(;u<s;++u)(a=e[u])&&(o[u]=a)}function ee(t,e,n,r,o,i,a){var u,s,c,l={},f=e.length,d=i.length,h=new Array(f);for(u=0;u<f;++u)(s=e[u])&&(h[u]=c=Qt+a.call(s,s.__data__,u,e),c in l?o[u]=s:l[c]=s);for(u=0;u<d;++u)(s=l[c=Qt+a.call(t,i[u],u,i)])?((r[u]=s).__data__=i[u],l[c]=null):n[u]=new Jt(t,i[u]);for(u=0;u<f;++u)(s=e[u])&&l[h[u]]===s&&(o[u]=s)}function ne(t,e){return t<e?-1:e<t?1:e<=t?0:NaN}function re(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function oe(t,e){return t.style.getPropertyValue(e)||re(t).getComputedStyle(t,null).getPropertyValue(e)}function ie(t){return t.trim().split(/^|\s+/)}function ae(t){return t.classList||new ue(t)}function ue(t){this._node=t,this._names=ie(t.getAttribute("class")||"")}function se(t,e){for(var n=ae(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function ce(t,e){for(var n=ae(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function le(){this.textContent=""}function fe(){this.innerHTML=""}function de(){this.nextSibling&&this.parentNode.appendChild(this)}function he(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function pe(){return null}function ye(){var t=this.parentNode;t&&t.removeChild(this)}function me(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function ge(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}ue.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);0<=e&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return 0<=this._names.indexOf(t)}};var ve={},we=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(ve={mouseenter:"mouseover",mouseleave:"mouseout"}));function be(n,t,e){return n=_e(n,t,e),function(t){var e=t.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||n.call(this,t)}}function _e(n,r,o){return function(t){var e=we;we=t;try{n.call(this,this.__data__,r,o)}finally{we=e}}}function xe(i){return function(){var t=this.__on;if(t){for(var e,n=0,r=-1,o=t.length;n<o;++n)e=t[n],i.type&&e.type!==i.type||e.name!==i.name?t[++r]=e:this.removeEventListener(e.type,e.listener,e.capture);++r?t.length=r:delete this.__on}}}function Ee(s,c,l){var f=ve.hasOwnProperty(s.type)?be:_e;return function(t,e,n){var r,o=this.__on,i=f(c,e,n);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===s.type&&r.name===s.name)return this.removeEventListener(r.type,r.listener,r.capture),this.addEventListener(r.type,r.listener=i,r.capture=l),void(r.value=c);this.addEventListener(s.type,i,l),r={type:s.type,name:s.name,value:c,listener:i,capture:l},o?o.push(r):this.__on=[r]}}function Se(t,e,n){var r=re(t),o=r.CustomEvent;"function"==typeof o?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}var Oe=[null];function Ne(t,e){this._groups=t,this._parents=e}function ke(){return new Ne([[document.documentElement]],Oe)}function Pe(t){return"string"==typeof t?new Ne([[document.querySelector(t)]],[document.documentElement]):new Ne([[t]],Oe)}function Ae(){for(var t,e=we;t=e.sourceEvent;)e=t;return e}function Te(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}function je(t){var e=Ae();return e.changedTouches&&(e=e.changedTouches[0]),Te(t,e)}function Ce(t,e,n){arguments.length<3&&(n=e,e=Ae().changedTouches);for(var r,o=0,i=e?e.length:0;o<i;++o)if((r=e[o]).identifier===n)return Te(t,r);return null}function De(){we.preventDefault(),we.stopImmediatePropagation()}function Me(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ie(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ze(){}Ne.prototype=ke.prototype={constructor:Ne,select:function(t){"function"!=typeof t&&(t=Gt(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,a,u=e[o],s=u.length,c=r[o]=new Array(s),l=0;l<s;++l)(i=u[l])&&(a=t.call(i,i.__data__,l,u))&&("__data__"in i&&(a.__data__=i.__data__),c[l]=a);return new Ne(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=Kt(t));for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var a,u=e[i],s=u.length,c=0;c<s;++c)(a=u[c])&&(r.push(t.call(a,a.__data__,c,u)),o.push(a));return new Ne(r,o)},filter:function(t){"function"!=typeof t&&(t=$t(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,a=e[o],u=a.length,s=r[o]=[],c=0;c<u;++c)(i=a[c])&&t.call(i,i.__data__,c,a)&&s.push(i);return new Ne(r,this._parents)},data:function(t,e){if(!t)return h=new Array(this.size()),c=-1,this.each(function(t){h[++c]=t}),h;var n=e?ee:te,r=this._parents,o=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var i=o.length,a=new Array(i),u=new Array(i),s=new Array(i),c=0;c<i;++c){var l=r[c],f=o[c],d=f.length,h=t.call(l,l&&l.__data__,c,r),p=h.length,y=u[c]=new Array(p),m=a[c]=new Array(p);n(l,f,y,m,s[c]=new Array(d),h,e);for(var g,v,w=0,b=0;w<p;++w)if(g=y[w]){for(b<=w&&(b=w+1);!(v=m[b])&&++b<p;);g._next=v||null}}return(a=new Ne(a,r))._enter=u,a._exit=s,a},enter:function(){return new Ne(this._enter||this._groups.map(Zt),this._parents)},exit:function(){return new Ne(this._exit||this._groups.map(Zt),this._parents)},join:function(t,e,n){var r=this.enter(),o=this,i=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=e&&(o=e(o)),null==n?i.remove():n(i),r&&o?r.merge(o).order():o},merge:function(t){for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var s,c=e[u],l=n[u],f=c.length,d=a[u]=new Array(f),h=0;h<f;++h)(s=c[h]||l[h])&&(d[h]=s);for(;u<r;++u)a[u]=e[u];return new Ne(a,this._parents)},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,o=t[e],i=o.length-1,a=o[i];0<=--i;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(n){function t(t,e){return t&&e?n(t.__data__,e.__data__):!t-!e}n=n||ne;for(var e=this._groups,r=e.length,o=new Array(r),i=0;i<r;++i){for(var a,u=e[i],s=u.length,c=o[i]=new Array(s),l=0;l<s;++l)(a=u[l])&&(c[l]=a);c.sort(t)}return new Ne(o,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),e=-1;return this.each(function(){t[++e]=this}),t},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o,i=e[n],a=0,u=i.length;a<u;++a)(o=i[a])&&t.call(o,o.__data__,a,i);return this},attr:function(t,e){var n=Ht(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof e?n.local?function(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(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}:n.local?function(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}:function(t,e){return function(){this.setAttribute(t,e)}})(n,e))},style:function(t,e,n){return 1<arguments.length?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function(e,n,r){return function(){var t=n.apply(this,arguments);null==t?this.style.removeProperty(e):this.style.setProperty(e,t,r)}}:function(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?"":n)):oe(this.node(),t)},property:function(t,e){return 1<arguments.length?this.each((null==e?function(t){return function(){delete this[t]}}:"function"==typeof e?function(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var n=ie(t+"");if(arguments.length<2){for(var r=ae(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof e?function(t,e){return function(){(e.apply(this,arguments)?se:ce)(this,t)}}:e?function(t){return function(){se(this,t)}}:function(t){return function(){ce(this,t)}})(n,e))},text:function(t){return arguments.length?this.each(null==t?le:("function"==typeof t?function(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?fe:("function"==typeof t?function(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(de)},lower:function(){return this.each(he)},append:function(t){var e="function"==typeof t?t:Ut(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:Ut(t),r=null==e?pe:"function"==typeof e?e:Gt(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(ye)},clone:function(t){return this.select(t?ge:me)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,o,i=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return 0<=n&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),a=i.length;if(!(arguments.length<2)){for(u=e?Ee:xe,null==n&&(n=!1),r=0;r<a;++r)this.each(u(i[r],e,n));return this}var u=this.node().__on;if(u)for(var s,c=0,l=u.length;c<l;++c)for(r=0,s=u[c];r<a;++r)if((o=i[r]).type===s.type&&o.name===s.name)return s.value},dispatch:function(t,e){return this.each(("function"==typeof e?function(t,e){return function(){return Se(this,t,e.apply(this,arguments))}}:function(t,e){return function(){return Se(this,t,e)}})(t,e))}};var Re="\\s*([+-]?\\d+)\\s*",Le="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Xe="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ye=/^#([0-9a-f]{3,8})$/,Ve=new RegExp("^rgb\\("+[Re,Re,Re]+"\\)$"),Be=new RegExp("^rgb\\("+[Xe,Xe,Xe]+"\\)$"),qe=new RegExp("^rgba\\("+[Re,Re,Re,Le]+"\\)$"),He=new RegExp("^rgba\\("+[Xe,Xe,Xe,Le]+"\\)$"),Ue=new RegExp("^hsl\\("+[Le,Xe,Xe]+"\\)$"),Fe=new RegExp("^hsla\\("+[Le,Xe,Xe,Le]+"\\)$"),Ge={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 We(){return this.rgb().formatHex()}function Ke(){return this.rgb().formatRgb()}function $e(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Ye.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Ze(e):3===n?new tn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?new tn(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?new tn(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=Ve.exec(t))?new tn(e[1],e[2],e[3],1):(e=Be.exec(t))?new tn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=qe.exec(t))?Je(e[1],e[2],e[3],e[4]):(e=He.exec(t))?Je(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ue.exec(t))?on(e[1],e[2]/100,e[3]/100,1):(e=Fe.exec(t))?on(e[1],e[2]/100,e[3]/100,e[4]):Ge.hasOwnProperty(t)?Ze(Ge[t]):"transparent"===t?new tn(NaN,NaN,NaN,0):null}function Ze(t){return new tn(t>>16&255,t>>8&255,255&t,1)}function Je(t,e,n,r){return r<=0&&(t=e=n=NaN),new tn(t,e,n,r)}function Qe(t,e,n,r){return 1===arguments.length?function(t){return t instanceof ze||(t=$e(t)),t?new tn((t=t.rgb()).r,t.g,t.b,t.opacity):new tn}(t):new tn(t,e,n,null==r?1:r)}function tn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function en(){return"#"+rn(this.r)+rn(this.g)+rn(this.b)}function nn(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function rn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function on(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||1<=n?t=e=NaN:e<=0&&(t=NaN),new un(t,e,n,r)}function an(t){if(t instanceof un)return new un(t.h,t.s,t.l,t.opacity);if(t instanceof ze||(t=$e(t)),!t)return new un;if(t instanceof un)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),a=NaN,u=i-o,s=(i+o)/2;return u?(a=e===i?(n-r)/u+6*(n<r):n===i?(r-e)/u+2:(e-n)/u+4,u/=s<.5?i+o:2-i-o,a*=60):u=0<s&&s<1?0:a,new un(a,u,s,t.opacity)}function un(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function sn(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function cn(t){return function(){return t}}function ln(n){return 1==(n=+n)?fn:function(t,e){return e-t?function(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(t){return Math.pow(e+t*n,r)}}(t,e,n):cn(isNaN(t)?e:t)}}function fn(t,e){var n=e-t;return n?function(e,n){return function(t){return e+t*n}}(t,n):cn(isNaN(t)?e:t)}Me(ze,$e,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:We,formatHex:We,formatHsl:function(){return an(this).formatHsl()},formatRgb:Ke,toString:Ke}),Me(tn,Qe,Ie(ze,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new tn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new tn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:en,formatHex:en,formatRgb:nn,toString:nn})),Me(un,function(t,e,n,r){return 1===arguments.length?an(t):new un(t,e,n,null==r?1:r)},Ie(ze,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new un(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new un(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new tn(sn(240<=t?t-240:120+t,o,r),sn(t,o,r),sn(t<120?240+t:t-120,o,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var dn=function t(e){var a=ln(e);function n(e,t){var n=a((e=Qe(e)).r,(t=Qe(t)).r),r=a(e.g,t.g),o=a(e.b,t.b),i=fn(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=r(t),e.b=o(t),e.opacity=i(t),e+""}}return n.gamma=t,n}(1);function hn(e,n){return n-=e=+e,function(t){return e+n*t}}var pn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yn=new RegExp(pn.source,"g");var mn,gn,vn,wn,bn=180/Math.PI,_n={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function xn(t,e,n,r,o,i){var a,u,s;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(s=t*n+e*r)&&(n-=t*s,r-=e*s),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,s/=u),t*r<e*n&&(t=-t,e=-e,s=-s,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*bn,skewX:Math.atan(s)*bn,scaleX:a,scaleY:u}}function En(n,u,s,a){function c(t){return t.length?t.pop()+" ":""}return function(t,e){var o=[],i=[];return t=n(t),e=n(e),function(t,e,n,r,o,i){if(t!==n||e!==r){var a=o.push("translate(",null,u,null,s);i.push({i:a-4,x:hn(t,n)},{i:a-2,x:hn(e,r)})}else(n||r)&&o.push("translate("+n+u+r+s)}(t.translateX,t.translateY,e.translateX,e.translateY,o,i),function(t,e,n,r){t!==e?(180<t-e?e+=360:180<e-t&&(t+=360),r.push({i:n.push(c(n)+"rotate(",null,a)-2,x:hn(t,e)})):e&&n.push(c(n)+"rotate("+e+a)}(t.rotate,e.rotate,o,i),function(t,e,n,r){t!==e?r.push({i:n.push(c(n)+"skewX(",null,a)-2,x:hn(t,e)}):e&&n.push(c(n)+"skewX("+e+a)}(t.skewX,e.skewX,o,i),function(t,e,n,r,o,i){if(t!==n||e!==r){var a=o.push(c(o)+"scale(",null,",",null,")");i.push({i:a-4,x:hn(t,n)},{i:a-2,x:hn(e,r)})}else 1===n&&1===r||o.push(c(o)+"scale("+n+","+r+")")}(t.scaleX,t.scaleY,e.scaleX,e.scaleY,o,i),t=e=null,function(t){for(var e,n=-1,r=i.length;++n<r;)o[(e=i[n]).i]=e.x(t);return o.join("")}}}var Sn=En(function(t){return"none"===t?_n:(mn||(mn=document.createElement("DIV"),gn=document.documentElement,vn=document.defaultView),mn.style.transform=t,t=vn.getComputedStyle(gn.appendChild(mn),null).getPropertyValue("transform"),gn.removeChild(mn),xn(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),On=En(function(t){return null==t?_n:((wn=wn||document.createElementNS("http://www.w3.org/2000/svg","g")).setAttribute("transform",t),(t=wn.transform.baseVal.consolidate())?xn((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):_n)},", ",")",")"),Nn=Math.SQRT2,kn=2,Pn=4,An=1e-12;function Tn(t){return((t=Math.exp(t))+1/t)/2}function jn(t,e){var n,o,i=t[0],a=t[1],u=t[2],r=e[0],s=e[1],c=e[2],l=r-i,f=s-a,d=l*l+f*f;if(d<An)o=Math.log(c/u)/Nn,n=function(t){return[i+t*l,a+t*f,u*Math.exp(Nn*t*o)]};else{var h=Math.sqrt(d),p=(c*c-u*u+Pn*d)/(2*u*kn*h),y=(c*c-u*u-Pn*d)/(2*c*kn*h),m=Math.log(Math.sqrt(p*p+1)-p),g=Math.log(Math.sqrt(y*y+1)-y);o=(g-m)/Nn,n=function(t){var e=t*o,n=Tn(m),r=u/(kn*h)*(n*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(Nn*e+m)-function(t){return((t=Math.exp(t))-1/t)/2}(m));return[i+r*l,a+r*f,u*n/Tn(Nn*e+m)]}}return n.duration=1e3*o,n}var Cn,Dn,Mn=0,In=0,zn=0,Rn=1e3,Ln=0,Xn=0,Yn=0,Vn="object"==typeof performance&&performance.now?performance:Date,Bn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function qn(){return Xn||(Bn(Hn),Xn=Vn.now()+Yn)}function Hn(){Xn=0}function Un(){this._call=this._time=this._next=null}function Fn(t,e,n){var r=new Un;return r.restart(t,e,n),r}function Gn(){Xn=(Ln=Vn.now())+Yn,Mn=In=0;try{!function(){qn(),++Mn;for(var t,e=Cn;e;)0<=(t=Xn-e._time)&&e._call.call(null,t),e=e._next;--Mn}()}finally{Mn=0,function(){var t,e,n=Cn,r=1/0;for(;n;)n=n._call?(r>n._time&&(r=n._time),(t=n)._next):(e=n._next,n._next=null,t?t._next=e:Cn=e);Dn=t,Kn(r)}(),Xn=0}}function Wn(){var t=Vn.now(),e=t-Ln;Rn<e&&(Yn-=e,Ln=t)}function Kn(t){Mn||(In=In&&clearTimeout(In),24<t-Xn?(t<1/0&&(In=setTimeout(Gn,t-Vn.now()-Yn)),zn=zn&&clearInterval(zn)):(zn||(Ln=Vn.now(),zn=setInterval(Wn,Rn)),Mn=1,Bn(Gn)))}function $n(e,n,t){var r=new Un;return n=null==n?0:+n,r.restart(function(t){r.stop(),e(t+n)},n,t),r}Un.prototype=Fn.prototype={constructor:Un,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?qn():+n)+(null==e?0:+e),this._next||Dn===this||(Dn?Dn._next=this:Cn=this,Dn=this),this._call=t,this._time=n,Kn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Kn())}};var Zn=Lt("start","end","cancel","interrupt"),Jn=[],Qn=0,tr=1,er=2,nr=3,rr=4,or=5,ir=6;function ar(t,e,n,r,o,i){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(i,a,u){var s,c=i.__transition;function l(t){var e,n,r,o;if(u.state!==tr)return d();for(e in c)if((o=c[e]).name===u.name){if(o.state===nr)return $n(l);o.state===rr?(o.state=ir,o.timer.stop(),o.on.call("interrupt",i,i.__data__,o.index,o.group),delete c[e]):+e<a&&(o.state=ir,o.timer.stop(),o.on.call("cancel",i,i.__data__,o.index,o.group),delete c[e])}if($n(function(){u.state===nr&&(u.state=rr,u.timer.restart(f,u.delay,u.time),f(t))}),u.state=er,u.on.call("start",i,i.__data__,u.index,u.group),u.state===er){for(u.state=nr,s=new Array(r=u.tween.length),e=0,n=-1;e<r;++e)(o=u.tween[e].value.call(i,i.__data__,u.index,u.group))&&(s[++n]=o);s.length=n+1}}function f(t){for(var e=t<u.duration?u.ease.call(null,t/u.duration):(u.timer.restart(d),u.state=or,1),n=-1,r=s.length;++n<r;)s[n].call(i,e);u.state===or&&(u.on.call("end",i,i.__data__,u.index,u.group),d())}function d(){for(var t in u.state=ir,u.timer.stop(),delete c[a],c)return;delete i.__transition}(c[a]=u).timer=Fn(function(t){u.state=tr,u.timer.restart(l,u.delay,u.time),u.delay<=t&&l(t-u.delay)},0,u.time)}(t,n,{name:e,index:r,group:o,on:Zn,tween:Jn,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Qn})}function ur(t,e){var n=cr(t,e);if(n.state>Qn)throw new Error("too late; already scheduled");return n}function sr(t,e){var n=cr(t,e);if(n.state>nr)throw new Error("too late; already running");return n}function cr(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function lr(t,e){var n,r,o,i=t.__transition,a=!0;if(i){for(o in e=null==e?null:e+"",i)(n=i[o]).name===e?(r=n.state>er&&n.state<or,n.state=ir,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete i[o]):a=!1;a&&delete t.__transition}}function fr(t,e,n){var r=t._id;return t.each(function(){var t=sr(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return cr(t,r).value[e]}}function dr(t,e){var n;return("number"==typeof e?hn:e instanceof $e?dn:(n=$e(e))?(e=n,dn):function(t,r){var e,n,o,i=pn.lastIndex=yn.lastIndex=0,a=-1,u=[],s=[];for(t+="",r+="";(e=pn.exec(t))&&(n=yn.exec(r));)(o=n.index)>i&&(o=r.slice(i,o),u[a]?u[a]+=o:u[++a]=o),(e=e[0])===(n=n[0])?u[a]?u[a]+=n:u[++a]=n:(u[++a]=null,s.push({i:a,x:hn(e,n)})),i=yn.lastIndex;return i<r.length&&(o=r.slice(i),u[a]?u[a]+=o:u[++a]=o),u.length<2?s[0]?function(e){return function(t){return e(t)+""}}(s[0].x):function(t){return function(){return t}}(r):(r=s.length,function(t){for(var e,n=0;n<r;++n)u[(e=s[n]).i]=e.x(t);return u.join("")})})(t,e)}var hr=ke.prototype.constructor;function pr(t){return function(){this.style.removeProperty(t)}}var yr=0;function mr(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function gr(){return++yr}var vr=ke.prototype;mr.prototype=function(t){return ke().transition(t)}.prototype={constructor:mr,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Gt(t));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,s,c=r[a],l=c.length,f=i[a]=new Array(l),d=0;d<l;++d)(u=c[d])&&(s=t.call(u,u.__data__,d,c))&&("__data__"in u&&(s.__data__=u.__data__),f[d]=s,ar(f[d],e,n,d,f,cr(u,n)));return new mr(i,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Kt(t));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var s,c=r[u],l=c.length,f=0;f<l;++f)if(s=c[f]){for(var d,h=t.call(s,s.__data__,f,c),p=cr(s,n),y=0,m=h.length;y<m;++y)(d=h[y])&&ar(d,e,n,y,h,p);i.push(h),a.push(s)}return new mr(i,a,e,n)},filter:function(t){"function"!=typeof t&&(t=$t(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,a=e[o],u=a.length,s=r[o]=[],c=0;c<u;++c)(i=a[c])&&t.call(i,i.__data__,c,a)&&s.push(i);return new mr(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var s,c=e[u],l=n[u],f=c.length,d=a[u]=new Array(f),h=0;h<f;++h)(s=c[h]||l[h])&&(d[h]=s);for(;u<r;++u)a[u]=e[u];return new mr(a,this._parents,this._name,this._id)},selection:function(){return new hr(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=gr(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],s=u.length,c=0;c<s;++c)if(a=u[c]){var l=cr(a,e);ar(a,t,n,c,u,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new mr(r,this._parents,t,n)},call:vr.call,nodes:vr.nodes,node:vr.node,size:vr.size,empty:vr.empty,each:vr.each,on:function(t,e){var n=this._id;return arguments.length<2?cr(this.node(),n).on.on(t):this.each(function(n,r,o){var i,a,u=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return 0<=e&&(t=t.slice(0,e)),!t||"start"===t})}(r)?ur:sr;return function(){var t=u(this,n),e=t.on;e!==i&&(a=(i=e).copy()).on(r,o),t.on=a}}(n,t,e))},attr:function(t,e){var n=Ht(t),r="transform"===n?On:dr;return this.attrTween(t,"function"==typeof e?(n.local?function(r,o,i){var a,u,s;return function(){var t,e,n=i(this);if(null!=n)return(t=this.getAttributeNS(r.space,r.local))===(e=n+"")?null:t===a&&e===u?s:(u=e,s=o(a=t,n));this.removeAttributeNS(r.space,r.local)}}:function(r,o,i){var a,u,s;return function(){var t,e,n=i(this);if(null!=n)return(t=this.getAttribute(r))===(e=n+"")?null:t===a&&e===u?s:(u=e,s=o(a=t,n));this.removeAttribute(r)}})(n,r,fr(this,"attr."+t,e)):null==e?(n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(n):(n.local?function(e,n,r){var o,i,a=r+"";return function(){var t=this.getAttributeNS(e.space,e.local);return t===a?null:t===o?i:i=n(o=t,r)}}:function(e,n,r){var o,i,a=r+"";return function(){var t=this.getAttribute(e);return t===a?null:t===o?i:i=n(o=t,r)}})(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=Ht(t);return this.tween(n,(r.local?function(e,n){var r,o;function t(){var t=n.apply(this,arguments);return t!==o&&(r=(o=t)&&function(e,n){return function(t){this.setAttributeNS(e.space,e.local,n(t))}}(e,t)),r}return t._value=n,t}:function(e,n){var r,o;function t(){var t=n.apply(this,arguments);return t!==o&&(r=(o=t)&&function(e,n){return function(t){this.setAttribute(e,n(t))}}(e,t)),r}return t._value=n,t})(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Sn:dr;return null==e?this.styleTween(t,function(n,r){var o,i,a;return function(){var t=oe(this,n),e=(this.style.removeProperty(n),oe(this,n));return t===e?null:t===o&&e===i?a:a=r(o=t,i=e)}}(t,r)).on("end.style."+t,pr(t)):"function"==typeof e?this.styleTween(t,function(r,o,i){var a,u,s;return function(){var t=oe(this,r),e=i(this),n=e+"";return null==e&&(this.style.removeProperty(r),n=e=oe(this,r)),t===n?null:t===a&&n===u?s:(u=n,s=o(a=t,e))}}(t,r,fr(this,"style."+t,e))).each(function(r,o){var i,a,u,s,c="style."+o,l="end."+c;return function(){var t=sr(this,r),e=t.on,n=null==t.value[c]?s=s||pr(o):void 0;e===i&&u===n||(a=(i=e).copy()).on(l,u=n),t.on=a}}(this._id,t)):this.styleTween(t,function(e,n,r){var o,i,a=r+"";return function(){var t=oe(this,e);return t===a?null:t===o?i:i=n(o=t,r)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");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(e,n,r){var o,i;function t(){var t=n.apply(this,arguments);return t!==i&&(o=(i=t)&&function(e,n,r){return function(t){this.style.setProperty(e,n(t),r)}}(e,t,r)),o}return t._value=n,t}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(fr(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",function(n){return function(){var t=this.parentNode;for(var e in this.__transition)if(+e!==n)return;t&&t.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,o=cr(this.node(),n).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===t)return r.value;return null}return this.each((null==e?function(o,i){var a,u;return function(){var t=sr(this,o),e=t.tween;if(e!==a)for(var n=0,r=(u=a=e).length;n<r;++n)if(u[n].name===i){(u=u.slice()).splice(n,1);break}t.tween=u}}:function(i,a,u){var s,c;if("function"!=typeof u)throw new Error;return function(){var t=sr(this,i),e=t.tween;if(e!==s){c=(s=e).slice();for(var n={name:a,value:u},r=0,o=c.length;r<o;++r)if(c[r].name===a){c[r]=n;break}r===o&&c.push(n)}t.tween=c}})(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function(t,e){return function(){ur(this,t).delay=+e.apply(this,arguments)}}:function(t,e){return e=+e,function(){ur(this,t).delay=e}})(e,t)):cr(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function(t,e){return function(){sr(this,t).duration=+e.apply(this,arguments)}}:function(t,e){return e=+e,function(){sr(this,t).duration=e}})(e,t)):cr(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){sr(this,t).ease=e}}(e,t)):cr(this.node(),e).ease},end:function(){var o,i,a=this,u=a._id,s=a.size();return new Promise(function(t,e){var n={value:e},r={value:function(){0==--s&&t()}};a.each(function(){var t=sr(this,u),e=t.on;e!==o&&((i=(o=e).copy())._.cancel.push(n),i._.interrupt.push(n),i._.end.push(r)),t.on=i})})}};var wr={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function br(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))return wr.time=qn(),wr;return n}function _r(t){return function(){return t}}function xr(t,e,n){this.target=t,this.type=e,this.transform=n}function Er(t,e,n){this.k=t,this.x=e,this.y=n}ke.prototype.interrupt=function(t){return this.each(function(){lr(this,t)})},ke.prototype.transition=function(t){var e,n;t=t instanceof mr?(e=t._id,t._name):(e=gr(),(n=wr).time=qn(),null==t?null:t+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],s=u.length,c=0;c<s;++c)(a=u[c])&&ar(a,t,e,c,u,n||br(a,e));return new mr(r,this._parents,t,e)},Er.prototype={constructor:Er,scale:function(t){return 1===t?this:new Er(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Er(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Sr=new Er(1,0,0);function Or(){we.stopImmediatePropagation()}function Nr(){we.preventDefault(),we.stopImmediatePropagation()}function kr(){return!we.ctrlKey&&!we.button}function Pr(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function Ar(){return this.__zoom||Sr}function Tr(){return-we.deltaY*(1===we.deltaMode?.05:we.deltaMode?1:.002)}function jr(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cr(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(r<o?(r+o)/2:Math.min(0,r)||Math.max(0,o),i<a?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function Dr(t,e){if(t===e)return!0;if(t&&e&&"object"==typeof t&&"object"==typeof e){if(t.constructor!==e.constructor)return!1;var n,r,o;if(Array.isArray(t)){if((n=t.length)!=e.length)return!1;for(r=n;0!=r--;)if(!Dr(t[r],e[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if((n=(o=Object.keys(t)).length)!==Object.keys(e).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(e,o[r]))return!1;for(r=n;0!=r--;){var i=o[r];if(!Dr(t[i],e[i]))return!1}return!0}return t!=t&&e!=e}function Mr(t){return t.source&&t.target}function Ir(t){return!t.source&&!t.target}function zr(t,e){return Mr(t)?Dt({},t,{type:t.type||"default",id:t.id?t.id.toString():function(t){return"react-flow__edge-".concat(t.source,"-").concat(t.target)}(t)}):Dt({},t,{id:t.id.toString(),type:t.type||"default",__rg:{position:function(t,e){var n=t.x,r=t.y;return{x:(n-e[0])*(1/[e[2]]),y:(r-e[1])*(1/[e[2]])}}(t.position,e),width:null,height:null,handleBounds:{}}})}function Rr(t){var e=(0<arguments.length&&void 0!==t?t:{}).padding,n=void 0===e?0:e,r=Yr.getState(),o=Vr(r.nodes),i=Math.max(o.width,o.height),a=Math.min(r.width,r.height)/(i+i*n),u=o.x+o.width/2,s=o.y+o.height/2,c=[r.width/2-u*a,r.height/2-s*a],l=Sr.translate(c[0],c[1]).scale(a);r.d3Selection.call(r.d3Zoom.transform,l)}function Lr(){var t=Yr.getState();t.d3Zoom.scaleTo(t.d3Selection,t.transform[2]+.2)}function Xr(){var t=Yr.getState();t.d3Zoom.scaleTo(t.d3Selection,t.transform[2]-.2)}var Yr=function(t,e){function n(t){return gt({},t,{easyPeasyReplaceState:vt(function(t,e){return e})})}function r(t){void 0===t&&(t={}),O.internals=At({disableImmer:c,initialState:t,injections:p,model:E,reducerEnhancer:x,references:O})}void 0===e&&(e={});var o=e,i=o.compose,a=o.devTools,u=void 0===a||a,s=o.disableImmer,c=void 0!==s&&s,l=o.enhancers,f=void 0===l?[]:l,d=o.initialState,h=void 0===d?{}:d,p=o.injections,y=o.middleware,m=void 0===y?[]:y,g=o.mockActions,v=void 0!==g&&g,w=o.name,b=void 0===w?"EasyPeasyStore":w,_=o.reducerEnhancer,x=void 0===_?function(t){return t}:_,E=n(t),S=[],O={};r(h);var N=[function(n){return function(e){return function(t){return O.internals.computedState.currentState=n.getState(),O.internals.computedState.isInReducer=!0,e(t)}}},at].concat(m,[function(){return function(r){return function(e){var t=r(e);if(e&&O.internals.listenerActionMap[e.type]&&0<O.internals.listenerActionMap[e.type].length){var n=O.internals.actionCreatorDict[e.type];O.internals.listenerActionMap[e.type].forEach(function(t){t({type:n?n.type:e.type,payload:e.payload,error:e.error,result:e.result})})}return t}}}]);v&&N.push(function(){return function(){return function(t){null!=t&&S.push(t)}}});var k=i||(u&&"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:b}):nt),P=tt(O.internals.reducer,O.internals.defaultState,k.apply(void 0,[rt.apply(void 0,N)].concat(f)));function A(){Object.keys(P.dispatch).forEach(function(t){delete P.dispatch[t]}),Object.keys(O.internals.actionCreators).forEach(function(t){P.dispatch[t]=O.internals.actionCreators[t]})}function T(t){var e=P.getState();t&&delete e[t],r(P.getState()),P.replaceReducer(O.internals.reducer),O.internals.actionCreatorDict["@action.easyPeasyReplaceState"](O.internals.defaultState),A()}return P.subscribe(function(){O.internals.computedState.isInReducer=!1}),O.dispatch=P.dispatch,O.getState=P.getState,A(),Object.assign(P,{addModel:function(t,e){E[t]&&"production"!==process.env.NODE_ENV&&(console.warn('easy-peasy: The store model already contains a model definition for "'+t+'"'),P.removeModel(t)),E[t]=e,T()},clearMockedActions:function(){S=[]},getActions:function(){return O.internals.actionCreators},getListeners:function(){return O.internals.listenerActionCreators},getMockedActions:function(){return[].concat(S)},reconfigure:function(t){E=n(t),T()},removeModel:function(t){E[t]?(delete E[t],T(t)):"production"!==process.env.NODE_ENV&&console.warn('easy-peasy: The store model does not contain a model definition for "'+t+'"')}})}(Dt({width:0,height:0,transform:[0,0,1],nodes:[],edges:[],selectedElements:[],selectedNodesBbox:{x:0,y:0,width:0,height:0},d3Zoom:null,d3Selection:null,d3Initialised:!1,nodesSelectionActive:!1,selectionActive:!1,selection:{},connectionSourceId:null,connectionPosition:{x:0,y:0},onConnect:function(){}},{setOnConnect:vt(function(t,e){t.onConnect=e}),setNodes:vt(function(t,e){t.nodes=e}),setEdges:vt(function(t,e){t.edges=e}),updateNodeData:vt(function(t,e){var n=e.id,r=Mt(e,["id"]);t.nodes.forEach(function(t){t.id===n&&(t.__rg=Dt({},t.__rg,{},r))})}),updateNodePos:vt(function(t,e){var n=e.id,r=e.pos;t.nodes.forEach(function(t){t.id===n&&(t.__rg=Dt({},t.__rg,{position:r}))})}),setSelection:vt(function(t,e){t.selectionActive=e}),setNodesSelection:vt(function(t,e){var n=e.isActive,r=e.selection;if(!n)return t.nodesSelectionActive=!1,void(t.selectedElements=[]);var o=Br(t.nodes,r,t.transform),i=Vr(o);t.selection=r,t.nodesSelectionActive=!0,t.selectedNodesBbox=i,t.nodesSelectionActive=!0}),setSelectedElements:vt(function(t,e){var n=Array.isArray(e)?e:[e],r=!Dr(n,t.selectedElements)?n:t.selectedElements;t.selectedElements=r}),updateSelection:vt(function(t,e){var n=Br(t.nodes,e,t.transform),r=qr(n,t.edges),o=[].concat(zt(n),zt(r)),i=!Dr(o,t.selectedElements);t.selection=e,t.selectedElements=i?o:t.selectedElements}),updateTransform:vt(function(t,e){t.transform=[e.x,e.y,e.k]}),updateSize:vt(function(t,e){t.width=e.width,t.height=e.height}),initD3:vt(function(t,e){var n=e.zoom,r=e.selection;t.d3Zoom=n,t.d3Selection=r,t.d3Initialised=!0}),setConnectionPosition:vt(function(t,e){t.connectionPosition=e}),setConnectionSourceId:vt(function(t,e){t.connectionSourceId=e})})),Vr=function(t){var e=t.reduce(function(t,e){var n=e.__rg.position,r=n.x+e.__rg.width,o=n.y+e.__rg.height;return n.x<t.minX&&(t.minX=n.x),r>t.maxX&&(t.maxX=r),n.y<t.minY&&(t.minY=n.y),o>t.maxY&&(t.maxY=o),t},{minX:Number.MAX_VALUE,minY:Number.MAX_VALUE,maxX:0,maxY:0});return{x:e.minX,y:e.minY,width:e.maxX-e.minX,height:e.maxY-e.minY}},Br=function(t,h,e,n){var p=2<arguments.length&&void 0!==e?e:[0,0,1],y=3<arguments.length&&void 0!==n&&n;return t.filter(function(t){var e=(h.x-p[0])*(1/p[2]),n=(h.y-p[1])*(1/p[2]),r=h.width*(1/p[2]),o=h.height*(1/p[2]),i=t.__rg,a=i.position,u=i.width,s=i.height,c=y?-u:u,l=y?0:s,f=y?u:0,d=y?s:0;return a.x+f>e&&a.x+c<e+r&&a.y+d>n&&a.y+l<n+o})},qr=function(t,e){var i=t.map(function(t){return t.id});return e.filter(function(t){var e=t.source.includes("__"),n=t.target.includes("__"),r=e?t.source.split("__")[0]:t.source,o=n?t.target.split("__")[0]:t.target;return i.includes(r)||i.includes(o)})};var Hr=O.memo(function(e){var n=pt(function(t){return{nodes:t.nodes,transform:t.transform,selectedElements:t.selectedElements}}),t=n.transform,r=n.nodes,o={transform:"translate(".concat(t[0],"px,").concat(t[1],"px) scale(").concat(t[2],")")};return N.createElement("div",{className:"react-flow__nodes",style:o},r.map(function(t){return function(t,e,n){var r=t.type||"default";e.nodeTypes[r]||console.warn('No node type found for type "'.concat(r,'". Using fallback type "default".'));var o=e.nodeTypes[r]||e.nodeTypes.default,i=n.selectedElements.filter(Ir).map(function(t){return t.id}).includes(t.id);return N.createElement(o,{key:t.id,id:t.id,type:t.type,data:t.data,xPos:t.__rg.position.x,yPos:t.__rg.position.y,onClick:e.onElementClick,onNodeDragStop:e.onNodeDragStop,transform:n.transform,selected:i,style:t.style})}(t,e,n)}))});Hr.displayName="NodeRenderer",Hr.whyDidYouRender=!1;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Ur(t,e){return t(e={exports:{}},e.exports),e.exports}function Fr(t){var e=It(O.useState(null),2),n=e[0],r=e[1],o=t.connectionSourceId.includes("__"),i=t.connectionSourceId.split("__"),a=i[0],u=o?i[1]:null;if(O.useEffect(function(){r(t.nodes.find(function(t){return t.id===a}))},[]),!n)return null;var s=t.connectionLineStyle||{},c=Gr("react-flow__edge","connection",t.className),l=u?n.__rg.handleBounds.source.find(function(t){return t.id===u}):n.__rg.handleBounds.source[0],f=l?l.x+l.width/2:n.__rg.width/2,d=l?l.y+l.height/2:n.__rg.height,h=n.__rg.position.x+f,p=n.__rg.position.y+d,y=(t.connectionPositionX-t.transform[0])*(1/t.transform[2]),m=(t.connectionPositionY-t.transform[1])*(1/t.transform[2]),g="";if("bezier"===t.connectionLineType){var v=Math.abs(m-p)/2,w=m<p?m+v:m-v;g="M".concat(h,",").concat(p," C").concat(h,",").concat(w," ").concat(y,",").concat(w," ").concat(y,",").concat(m)}else g="M".concat(h,",").concat(p," ").concat(y,",").concat(m);return N.createElement("g",{className:c},N.createElement("path",jt({d:g},s)))}var Gr=Ur(function(t){function a(){for(var t=[],e=0;e<arguments.length;e++){var n=arguments[e];if(n){var r=typeof n;if("string"==r||"number"==r)t.push(n);else if(Array.isArray(n)&&n.length){var o=a.apply(null,n);o&&t.push(o)}else if("object"==r)for(var i in n)u.call(n,i)&&n[i]&&t.push(i)}}return t.join(" ")}var u;u={}.hasOwnProperty,t.exports?(a.default=a,t.exports=a):window.classNames=a});function Wr(t,e,n){var r=2<arguments.length&&void 0!==n?n:null;if(!r)switch(t){case"top":return{x:e.__rg.width/2,y:0};case"right":return{x:e.__rg.width,y:e.__rg.height/2};case"bottom":return{x:e.__rg.width/2,y:e.__rg.height};case"left":return{x:0,y:e.__rg.height/2}}switch(t){case"top":return{x:r.x+r.width/2,y:r.y};case"right":return{x:r.x+r.width,y:r.y+r.height/2};case"bottom":return{x:r.x+r.width/2,y:r.y+r.height};case"left":return{x:r.x,y:r.y+r.height/2}}}function Kr(t,e){var n=null;return t?(1!==t.length&&e?e&&(n=t.find(function(t){return t.id===e})):n=t[0],n):null}function $r(t,e,n){var r=t.type||"default",o=t.source.includes("__"),i=t.target.includes("__"),a=o?t.source.split("__")[0]:t.source,u=i?t.target.split("__")[0]:t.target,s=o?t.source.split("__")[1]:null,c=i?t.target.split("__")[1]:null,l=n.nodes.find(function(t){return t.id===a}),f=n.nodes.find(function(t){return t.id===u});if(!l)throw new Error("couldn't create edge for source id: ".concat(a));if(!f)throw new Error("couldn't create edge for target id: ".concat(u));var d=e.edgeTypes[r]||e.edgeTypes.default,h=Kr(l.__rg.handleBounds.source,s),p=Kr(f.__rg.handleBounds.target,c),y=h?h.position:"bottom",m=p?p.position:"top",g=function(t){var e=t.sourceNode,n=t.sourceHandle,r=t.sourcePosition,o=t.targetNode,i=t.targetHandle,a=t.targetPosition,u=Wr(r,e,n),s=e.__rg.position.x+u.x,c=e.__rg.position.y+u.y,l=Wr(a,o,i);return{sourceX:s,sourceY:c,targetX:o.__rg.position.x+l.x,targetY:o.__rg.position.y+l.y}}({sourceNode:l,sourceHandle:h,sourcePosition:y,targetNode:f,targetHandle:p,targetPosition:m}),v=g.sourceX,w=g.sourceY,b=g.targetX,_=g.targetY,x=n.selectedElements.filter(Mr).find(function(t){return t.source===a&&t.target===u});return N.createElement(d,{key:t.id,id:t.id,type:t.type,onClick:e.onElementClick,selected:x,animated:t.animated,style:t.style,source:a,target:u,sourceHandleId:s,targetHandleId:c,sourceX:v,sourceY:w,targetX:b,targetY:_,sourcePosition:y,targetPosition:m})}var Zr=O.memo(function(e){var n=pt(function(t){return{nodes:t.nodes,edges:t.edges,transform:t.transform,selectedElements:t.selectedElements,connectionSourceId:t.connectionSourceId,position:t.connectionPosition}}),t=e.width,r=e.height,o=e.connectionLineStyle,i=e.connectionLineType;if(!t)return null;var a=n.transform,u=n.edges,s=n.nodes,c=n.connectionSourceId,l=n.position,f="translate(".concat(a[0],",").concat(a[1],") scale(").concat(a[2],")");return N.createElement("svg",{width:t,height:r,className:"react-flow__edges"},N.createElement("g",{transform:f},u.map(function(t){return $r(t,e,n)}),c&&N.createElement(Fr,{nodes:s,connectionSourceId:c,connectionPositionX:l.x,connectionPositionY:l.y,transform:a,connectionLineStyle:o,connectionLineType:i})))});Zr.displayName="EdgeRenderer";var Jr={position:"absolute",top:0,left:0},Qr=O.memo(function(t){var e=t.gap,n=void 0===e?24:e,r=t.strokeColor,o=void 0===r?"#999":r,i=t.strokeWidth,a=void 0===i?.1:i,u=t.style,s=t.className,c=pt(function(t){return t}),l=c.width,f=c.height,d=It(c.transform,3),h=d[0],p=d[1],y=d[2],m=Gr("react-flow__grid",s),g=n*y,v=h%g,w=p%g,b=Math.ceil(l/g)+1,_=Math.ceil(f/g)+1,x=Array.from({length:b},function(t,e){return"M".concat(e*g+v," 0 V").concat(f)}),E=Array.from({length:_},function(t,e){return"M0 ".concat(e*g+w," H").concat(l)}),S=[].concat(zt(x),zt(E)).join(" ");return N.createElement("svg",{width:l,height:f,style:Dt({},Jr,{},u),className:m},N.createElement("path",{fill:"none",stroke:o,strokeWidth:a,d:S}))}),to={startX:0,startY:0,x:0,y:0,width:0,height:0,draw:!(Qr.displayName="GridRenderer")};function eo(t){var e=document.querySelector(".react-flow").getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top}}var no=O.memo(function(){var r=O.useRef(null),t=It(O.useState(to),2),e=t[0],o=t[1],i=mt(function(t){return t.setSelection}),a=mt(function(t){return t.updateSelection}),u=mt(function(t){return t.setNodesSelection});return O.useEffect(function(){function t(t){var e=eo(t);o(function(t){return Dt({},t,{startX:e.x,startY:e.y,x:e.x,y:e.y,draw:!0})}),i(!0)}function e(i){o(function(t){if(!t.draw)return t;var e=eo(i),n=e.x<t.startX,r=e.y<t.startY,o=Dt({},t,{x:n?e.x:t.x,y:r?e.y:t.y,width:n?t.startX-e.x:e.x-t.startX,height:r?t.startY-e.y:e.y-t.startY});return a(o),o})}function n(){o(function(t){return u({isActive:!0,selection:t}),i(!1),Dt({},t,{draw:!1})})}return r.current.addEventListener("mousedown",t),r.current.addEventListener("mousemove",e),r.current.addEventListener("mouseup",n),function(){r.current.removeEventListener("mousedown",t),r.current.removeEventListener("mousemove",e),r.current.removeEventListener("mouseup",n)}},[]),N.createElement("div",{className:"react-flow__selectionpane",ref:r},(e.draw||e.fixed)&&N.createElement("div",{className:"react-flow__selection",style:{width:e.width,height:e.height,transform:"translate(".concat(e.x,"px, ").concat(e.y,"px)")}}))}),ro=Ur(function(t,e){t.exports=function(c,h){function t(t,e){return t(e={exports:{}},e.exports),e.exports}function e(t){return function(){return t}}c=c&&c.hasOwnProperty("default")?c.default:c,h=h&&h.hasOwnProperty("default")?h.default:h;var n=function(){};n.thatReturns=e,n.thatReturnsFalse=e(!1),n.thatReturnsTrue=e(!0),n.thatReturnsNull=e(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(t){return t};var o=n,f=function(t){};f=function(t){if(void 0===t)throw new Error("invariant requires an error message argument")};var y=function(t,e,n,r,o,i,a,u){if(f(e),!t){var s;if(void 0===e)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,i,a,u],l=0;(s=new Error(e.replace(/%s/g,function(){return c[l++]}))).name="Invariant Violation"}throw s.framesToPop=1,s}},m=function(t,e){if(void 0===e)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==e.indexOf("Failed Composite propType: ")&&!t){for(var n=arguments.length,r=Array(2<n?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];(function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++){n[r-1]=arguments[r]}var o=0,i="Warning: "+t.replace(/%s/g,function(){return n[o++]});if(typeof console!=="undefined"){console.error(i)}try{throw new Error(i)}catch(t){}}).apply(void 0,[e].concat(r))}},s=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable;var g=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,r,o=function(t){if(null!=t)return Object(t);throw new TypeError("Object.assign cannot be called with null or undefined")}(t),i=1;i<arguments.length;i++){for(var a in n=Object(arguments[i]))l.call(n,a)&&(o[a]=n[a]);if(s){r=s(n);for(var u=0;u<r.length;u++)d.call(n,r[u])&&(o[r[u]]=n[r[u]])}}return o},v="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",p=y,w=m,b={};var _=function(t,e,n,r,o){for(var i in t)if(t.hasOwnProperty(i)){var a;try{p("function"==typeof t[i],"%s: %s type `%s` is invalid; it must be a function, usually from the `prop-types` package, but received `%s`.",r||"React class",n,i,typeof t[i]),a=t[i](e,i,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(t){a=t}if(w(!a||a instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",n,i,typeof a),a instanceof Error&&!(a.message in b)){b[a.message]=!0;var u=o?o():"";w(!1,"Failed %s type: %s%s",n,a.message,null!=u?u:"")}}},r=function(a,f){var i="function"==typeof Symbol&&Symbol.iterator,u="@@iterator";var d="<<anonymous>>",t={array:e("array"),bool:e("boolean"),func:e("function"),number:e("number"),object:e("object"),string:e("string"),symbol:e("symbol"),any:n(o.thatReturnsNull),arrayOf:function(s){return n(function(t,e,n,r,o){if("function"!=typeof s)return new h("Property `"+o+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var i=t[e];if(!Array.isArray(i))return new h("Invalid "+r+" `"+o+"` of type `"+p(i)+"` supplied to `"+n+"`, expected an array.");for(var a=0;a<i.length;a++){var u=s(i,a,n,r,o+"["+a+"]",v);if(u instanceof Error)return u}return null})},element:n(function(t,e,n,r,o){var i=t[e];return a(i)?null:new h("Invalid "+r+" `"+o+"` of type `"+p(i)+"` supplied to `"+n+"`, expected a single ReactElement.")}),instanceOf:function(a){return n(function(t,e,n,r,o){if(t[e]instanceof a)return null;var i=a.name||d;return new h("Invalid "+r+" `"+o+"` of type `"+function(t){return t.constructor&&t.constructor.name?t.constructor.name:d}(t[e])+"` supplied to `"+n+"`, expected instance of `"+i+"`.")})},node:n(function(t,e,n,r,o){return c(t[e])?null:new h("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(c){return n(function(t,e,n,r,o){if("function"!=typeof c)return new h("Property `"+o+"` of component `"+n+"` has invalid PropType notation inside objectOf.");var i=t[e],a=p(i);if("object"!==a)return new h("Invalid "+r+" `"+o+"` of type `"+a+"` supplied to `"+n+"`, expected an object.");for(var u in i)if(i.hasOwnProperty(u)){var s=c(i,u,n,r,o+"."+u,v);if(s instanceof Error)return s}return null})},oneOf:function(u){if(!Array.isArray(u))return m(!1,"Invalid argument supplied to oneOf, expected an instance of array."),o.thatReturnsNull;return n(function(t,e,n,r,o){for(var i=t[e],a=0;a<u.length;a++)if(s(i,u[a]))return null;return new h("Invalid "+r+" `"+o+"` of value `"+i+"` supplied to `"+n+"`, expected one of "+JSON.stringify(u)+".")})},oneOfType:function(a){if(!Array.isArray(a))return m(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),o.thatReturnsNull;for(var t=0;t<a.length;t++){var e=a[t];if("function"!=typeof e)return m(!1,"Invalid argument supplied to oneOfType. Expected an array of check functions, but received %s at index %s.",r(e),t),o.thatReturnsNull}return n(function(t,e,n,r,o){for(var i=0;i<a.length;i++){if(null==(0,a[i])(t,e,n,r,o,v))return null}return new h("Invalid "+r+" `"+o+"` supplied to `"+n+"`.")})},shape:function(l){return n(function(t,e,n,r,o){var i=t[e],a=p(i);if("object"!==a)return new h("Invalid "+r+" `"+o+"` of type `"+a+"` supplied to `"+n+"`, expected `object`.");for(var u in l){var s=l[u];if(s){var c=s(i,u,n,r,o+"."+u,v);if(c)return c}}return null})},exact:function(f){return n(function(t,e,n,r,o){var i=t[e],a=p(i);if("object"!==a)return new h("Invalid "+r+" `"+o+"` of type `"+a+"` supplied to `"+n+"`, expected `object`.");var u=g({},t[e],f);for(var s in u){var c=f[s];if(!c)return new h("Invalid "+r+" `"+o+"` key `"+s+"` supplied to `"+n+"`.\nBad object: "+JSON.stringify(t[e],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(f),null," "));var l=c(i,s,n,r,o+"."+s,v);if(l)return l}return null})}};function s(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function h(t){this.message=t,this.stack=""}function n(s){var c={},l=0;function t(t,e,n,r,o,i,a){if(r=r||d,i=i||n,a!==v)if(f)y(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("undefined"!=typeof console){var u=r+":"+n;!c[u]&&l<3&&(m(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",i,r),c[u]=!0,l++)}return null==e[n]?t?null===e[n]?new h("The "+o+" `"+i+"` is marked as required in `"+r+"`, but its value is `null`."):new h("The "+o+" `"+i+"` is marked as required in `"+r+"`, but its value is `undefined`."):null:s(e,n,r,o,i)}var e=t.bind(null,!1);return e.isRequired=t.bind(null,!0),e}function e(s){return n(function(t,e,n,r,o,i){var a=t[e];if(p(a)===s)return null;var u=l(a);return new h("Invalid "+r+" `"+o+"` of type `"+u+"` supplied to `"+n+"`, expected `"+s+"`.")})}function c(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(c);if(null===t||a(t))return!0;var e=function(t){var e=t&&(i&&t[i]||t[u]);if("function"==typeof e)return e}(t);if(!e)return!1;var n,r=e.call(t);if(e!==t.entries){for(;!(n=r.next()).done;)if(!c(n.value))return!1}else for(;!(n=r.next()).done;){var o=n.value;if(o&&!c(o[1]))return!1}return!0;default:return!1}}function p(t){var e=typeof t;return Array.isArray(t)?"array":t instanceof RegExp?"object":function(t,e){if("symbol"===t)return!0;if("Symbol"===e["@@toStringTag"])return!0;if("function"==typeof Symbol&&e instanceof Symbol)return!0;return!1}(e,t)?"symbol":e}function l(t){if(null==t)return""+t;var e=p(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function r(t){var e=l(t);switch(e){case"array":case"object":return"an "+e;case"boolean":case"date":case"regexp":return"a "+e;default:return e}}return h.prototype=Error.prototype,t.checkPropTypes=_,t.PropTypes=t},i=t(function(t){var e="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;t.exports=r(function(t){return typeof t==="object"&&t!==null&&t.$$typeof===e},!0)}),x=t(function(t){!function(){var i={}.hasOwnProperty;function a(){for(var t=[],e=0;e<arguments.length;e++){var n=arguments[e];if(n){var r=typeof n;if("string"==r||"number"==r)t.push(n);else if(Array.isArray(n))t.push(a.apply(null,n));else if("object"==r)for(var o in n)i.call(n,o)&&n[o]&&t.push(o)}}return t.join(" ")}t.exports?t.exports=a:window.classNames=a}()});function a(t,e){for(var n=0,r=t.length;n<r;n++)if(e.apply(e,[t[n],n,t]))return t[n]}function u(t){return"function"==typeof t||"[object Function]"===Object.prototype.toString.call(t)}function E(t){return"number"==typeof t&&!isNaN(t)}function S(t){return parseInt(t,10)}function O(t,e,n){if(t[e])return new Error("Invalid prop "+e+" passed to "+n+" - do not set this, set it on the child.")}var N=["Moz","Webkit","O","ms"];function k(t,e){return e?""+e+function(t){for(var e="",n=!0,r=0;r<t.length;r++)n?(e+=t[r].toUpperCase(),n=!1):"-"===t[r]?n=!0:e+=t[r];return e}(t):t}var P=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window||void 0===window.document)return"";var e=window.document.documentElement.style;if(t in e)return"";for(var n=0;n<N.length;n++)if(k(t,N[n])in e)return N[n];return""}(),A=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},T=function(){function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}(),j=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},C=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},D=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},M=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},I=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},z="";function R(e,t){return z=z||a(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(t){return u(e[t])}),!!u(e[z])&&e[z](t)}function L(t,e,n){var r=t;do{if(R(r,e))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1}function X(t,e,n){t&&(t.attachEvent?t.attachEvent("on"+e,n):t.addEventListener?t.addEventListener(e,n,!0):t["on"+e]=n)}function Y(t,e,n){t&&(t.detachEvent?t.detachEvent("on"+e,n):t.removeEventListener?t.removeEventListener(e,n,!0):t["on"+e]=null)}function V(t,e,n){var r=t.x,o=t.y,i="translate("+r+n+","+o+n+")";if(e){var a=""+("string"==typeof e.x?e.x:e.x+n),u=""+("string"==typeof e.y?e.y:e.y+n);i="translate("+a+", "+u+")"+i}return i}function B(t){if(t){var e=t.getElementById("react-draggable-style-el");e||((e=t.createElement("style")).type="text/css",e.id="react-draggable-style-el",e.innerHTML=".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n",e.innerHTML+=".react-draggable-transparent-selection *::selection {all: inherit;}\n",t.getElementsByTagName("head")[0].appendChild(e)),t.body&&function(t,e){t.classList?t.classList.add(e):t.className.match(new RegExp("(?:^|\\s)"+e+"(?!\\S)"))||(t.className+=" "+e)}(t.body,"react-draggable-transparent-selection")}}function q(t){try{t&&t.body&&function(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(?:^|\\s)"+e+"(?!\\S)","g"),"")}(t.body,"react-draggable-transparent-selection"),t.selection?t.selection.empty():window.getSelection().removeAllRanges()}catch(t){}}function H(t,e,n){if(!t.props.bounds)return[e,n];var r=t.props.bounds;r="string"==typeof r?r:function(t){return{left:t.left,top:t.top,right:t.right,bottom:t.bottom}}(r);var o=W(t);if("string"==typeof r){var i=o.ownerDocument,a=i.defaultView,u=void 0;if(!((u="parent"===r?o.parentNode:i.querySelector(r))instanceof a.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');var s=a.getComputedStyle(o),c=a.getComputedStyle(u);r={left:-o.offsetLeft+S(c.paddingLeft)+S(s.marginLeft),top:-o.offsetTop+S(c.paddingTop)+S(s.marginTop),right:function(t){var e=t.clientWidth,n=t.ownerDocument.defaultView.getComputedStyle(t);return e-=S(n.paddingLeft),e-=S(n.paddingRight)}(u)-function(t){var e=t.clientWidth,n=t.ownerDocument.defaultView.getComputedStyle(t);return e+=S(n.borderLeftWidth),e+=S(n.borderRightWidth)}(o)-o.offsetLeft+S(c.paddingRight)-S(s.marginRight),bottom:function(t){var e=t.clientHeight,n=t.ownerDocument.defaultView.getComputedStyle(t);return e-=S(n.paddingTop),e-=S(n.paddingBottom)}(u)-function(t){var e=t.clientHeight,n=t.ownerDocument.defaultView.getComputedStyle(t);return e+=S(n.borderTopWidth),e+=S(n.borderBottomWidth)}(o)-o.offsetTop+S(c.paddingBottom)-S(s.marginBottom)}}return E(r.right)&&(e=Math.min(e,r.right)),E(r.bottom)&&(n=Math.min(n,r.bottom)),E(r.left)&&(e=Math.max(e,r.left)),E(r.top)&&(n=Math.max(n,r.top)),[e,n]}function U(t,e,n){var r="number"==typeof e?function(t,e){return t.targetTouches&&a(t.targetTouches,function(t){return e===t.identifier})||t.changedTouches&&a(t.changedTouches,function(t){return e===t.identifier})}(t,e):null;if("number"==typeof e&&!r)return null;var o=W(n),i=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return function(t,e){var n=e===e.ownerDocument.body?{left:0,top:0}:e.getBoundingClientRect(),r=t.clientX+e.scrollLeft-n.left,o=t.clientY+e.scrollTop-n.top;return{x:r,y:o}}(r||t,i)}function F(t,e,n){var r=t.state,o=!E(r.lastX),i=W(t);return o?{node:i,deltaX:0,deltaY:0,lastX:e,lastY:n,x:e,y:n}:{node:i,deltaX:e-r.lastX,deltaY:n-r.lastY,lastX:r.lastX,lastY:r.lastY,x:e,y:n}}function G(t,e){var n=t.props.scale;return{node:e.node,x:t.state.x+e.deltaX/n,y:t.state.y+e.deltaY/n,deltaX:e.deltaX/n,deltaY:e.deltaY/n,lastX:t.state.x,lastY:t.state.y}}function W(t){var e=c.findDOMNode(t);if(!e)throw new Error("<DraggableCore>: Unmounted during event!");return e}var K={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},$=K.mouse,Z=function(t){function i(){var t,e,f;A(this,i);for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return f=M(this,(t=i.__proto__||Object.getPrototypeOf(i)).call.apply(t,[this].concat(r))),(e=f).state={dragging:!1,lastX:NaN,lastY:NaN,touchIdentifier:null},f.handleDragStart=function(t){if(f.props.onMouseDown(t),!f.props.allowAnyClick&&"number"==typeof t.button&&0!==t.button)return!1;var e=c.findDOMNode(f);if(!e||!e.ownerDocument||!e.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");var n=e.ownerDocument;if(!(f.props.disabled||!(t.target instanceof n.defaultView.Node)||f.props.handle&&!L(t.target,f.props.handle,e)||f.props.cancel&&L(t.target,f.props.cancel,e))){var r=function(t){if(t.targetTouches&&t.targetTouches[0])return t.targetTouches[0].identifier;if(t.changedTouches&&t.changedTouches[0])return t.changedTouches[0].identifier}(t);f.setState({touchIdentifier:r});var o=U(t,r,f);if(null!=o){var i=o.x,a=o.y,u=F(f,i,a);f.props.onStart;var s=f.props.onStart(t,u);!1!==s&&(f.props.enableUserSelectHack&&B(n),f.setState({dragging:!0,lastX:i,lastY:a}),X(n,$.move,f.handleDrag),X(n,$.stop,f.handleDragStop))}}},f.handleDrag=function(t){"touchmove"===t.type&&t.preventDefault();var e=U(t,f.state.touchIdentifier,f);if(null!=e){var n=e.x,r=e.y;if(Array.isArray(f.props.grid)){var o=n-f.state.lastX,i=r-f.state.lastY,a=function(t,e,n){var r=Math.round(e/t[0])*t[0],o=Math.round(n/t[1])*t[1];return[r,o]}(f.props.grid,o,i),u=I(a,2);if(o=u[0],i=u[1],!o&&!i)return;n=f.state.lastX+o,r=f.state.lastY+i}var s=F(f,n,r),c=f.props.onDrag(t,s);if(!1!==c)f.setState({lastX:n,lastY:r});else try{f.handleDragStop(new MouseEvent("mouseup"))}catch(t){var l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),f.handleDragStop(l)}}},f.handleDragStop=function(t){if(f.state.dragging){var e=U(t,f.state.touchIdentifier,f);if(null!=e){var n=e.x,r=e.y,o=F(f,n,r),i=c.findDOMNode(f);i&&f.props.enableUserSelectHack&&q(i.ownerDocument),f.setState({dragging:!1,lastX:NaN,lastY:NaN}),f.props.onStop(t,o),i&&(Y(i.ownerDocument,$.move,f.handleDrag),Y(i.ownerDocument,$.stop,f.handleDragStop))}}},f.onMouseDown=function(t){return $=K.mouse,f.handleDragStart(t)},f.onMouseUp=function(t){return $=K.mouse,f.handleDragStop(t)},f.onTouchStart=function(t){return $=K.touch,f.handleDragStart(t)},f.onTouchEnd=function(t){return $=K.touch,f.handleDragStop(t)},M(f,e)}return D(i,t),T(i,[{key:"componentWillUnmount",value:function(){var t=c.findDOMNode(this);if(t){var e=t.ownerDocument;Y(e,K.mouse.move,this.handleDrag),Y(e,K.touch.move,this.handleDrag),Y(e,K.mouse.stop,this.handleDragStop),Y(e,K.touch.stop,this.handleDragStop),this.props.enableUserSelectHack&&q(e)}}},{key:"render",value:function(){return h.cloneElement(h.Children.only(this.props.children),{style:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return C({touchAction:"none"},t)}(this.props.children.props.style),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}]),i}(h.Component);Z.displayName="DraggableCore",Z.propTypes={allowAnyClick:i.bool,disabled:i.bool,enableUserSelectHack:i.bool,offsetParent:function(t,e){if(t[e]&&1!==t[e].nodeType)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:i.arrayOf(i.number),scale:i.number,handle:i.string,cancel:i.string,onStart:i.func,onDrag:i.func,onStop:i.func,onMouseDown:i.func,className:O,style:O,transform:O},Z.defaultProps={allowAnyClick:!1,cancel:null,disabled:!1,enableUserSelectHack:!0,offsetParent:null,handle:null,grid:null,transform:null,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){}};var J=function(t){function e(t){A(this,e);var f=M(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return f.onDragStart=function(t,e){var n=f.props.onStart(t,G(f,e));if(!1===n)return!1;f.setState({dragging:!0,dragged:!0})},f.onDrag=function(t,e){if(!f.state.dragging)return!1;var n=G(f,e),r={x:n.x,y:n.y};if(f.props.bounds){var o=r.x,i=r.y;r.x+=f.state.slackX,r.y+=f.state.slackY;var a=H(f,r.x,r.y),u=I(a,2),s=u[0],c=u[1];r.x=s,r.y=c,r.slackX=f.state.slackX+(o-r.x),r.slackY=f.state.slackY+(i-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-f.state.x,n.deltaY=r.y-f.state.y}var l=f.props.onDrag(t,n);if(!1===l)return!1;f.setState(r)},f.onDragStop=function(t,e){if(!f.state.dragging)return!1;var n=f.props.onStop(t,G(f,e));if(!1===n)return!1;var r={dragging:!1,slackX:0,slackY:0},o=Boolean(f.props.position);if(o){var i=f.props.position,a=i.x,u=i.y;r.x=a,r.y=u}f.setState(r)},f.state={dragging:!1,dragged:!1,x:t.position?t.position.x:t.defaultPosition.x,y:t.position?t.position.y:t.defaultPosition.y,slackX:0,slackY:0,isElementSVG:!1},!t.position||t.onDrag||t.onStop||console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element."),f}return D(e,t),T(e,[{key:"componentDidMount",value:function(){void 0!==window.SVGElement&&c.findDOMNode(this)instanceof window.SVGElement&&this.setState({isElementSVG:!0})}},{key:"componentWillReceiveProps",value:function(t){!t.position||this.props.position&&t.position.x===this.props.position.x&&t.position.y===this.props.position.y||this.setState({x:t.position.x,y:t.position.y})}},{key:"componentWillUnmount",value:function(){this.setState({dragging:!1})}},{key:"render",value:function(){var t,e={},n=null,r=Boolean(this.props.position),o=!r||this.state.dragging,i=this.props.position||this.props.defaultPosition,a={x:function(t){return"both"===t.props.axis||"x"===t.props.axis}(this)&&o?this.state.x:i.x,y:function(t){return"both"===t.props.axis||"y"===t.props.axis}(this)&&o?this.state.y:i.y};this.state.isElementSVG?n=function(t,e){return V(t,e,"")}(a,this.props.positionOffset):e=function(t,e){var n=V(t,e,"px");return j({},k("transform",P),n)}(a,this.props.positionOffset);var u=this.props,s=u.defaultClassName,c=u.defaultClassNameDragging,l=u.defaultClassNameDragged,f=h.Children.only(this.props.children),d=x(f.props.className||"",s,(j(t={},c,this.state.dragging),j(t,l,this.state.dragged),t));return h.createElement(Z,C({},this.props,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),h.cloneElement(f,{className:d,style:C({},f.props.style,e),transform:n}))}}]),e}(h.Component);return J.displayName="Draggable",J.propTypes=C({},Z.propTypes,{axis:i.oneOf(["both","x","y","none"]),bounds:i.oneOfType([i.shape({left:i.number,right:i.number,top:i.number,bottom:i.number}),i.string,i.oneOf([!1])]),defaultClassName:i.string,defaultClassNameDragging:i.string,defaultClassNameDragged:i.string,defaultPosition:i.shape({x:i.number,y:i.number}),positionOffset:i.shape({x:i.oneOfType([i.number,i.string]),y:i.oneOfType([i.number,i.string])}),position:i.shape({x:i.number,y:i.number}),className:O,style:O,transform:O}),J.defaultProps=C({},Z.defaultProps,{axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},position:null,scale:1}),(J.default=J).DraggableCore=Z,J}(n,N)});function oo(t){return t&&t.target&&["INPUT","SELECT","TEXTAREA"].includes(t.target.nodeName)}function io(t){var e=0<arguments.length&&void 0!==t?t:{};return{width:e.offsetWidth,height:e.offsetHeight}}var ao=O.memo(function(){var t=It(O.useState({x:0,y:0}),2),r=t[0],a=t[1],e=It(O.useState({}),2),o=e[0],u=e[1],s=pt(function(t){return{transform:t.transform,selectedNodesBbox:t.selectedNodesBbox,selectedElements:t.selectedElements}}),i=mt(function(t){return t.updateNodePos}),n=It(s.transform,3),c=n[0],l=n[1],f=n[2],d=s.selectedNodesBbox;return N.createElement("div",{className:"react-flow__nodesselection",style:{transform:"translate(".concat(c,"px,").concat(l,"px) scale(").concat(f,")")}},N.createElement(ro,{scale:f,onStart:function(t){var e=t.clientX*(1/f),n=t.clientY*(1/f),r=e-d.x-c,o=n-d.y-l,i=function(t){return t.filter(Ir).reduce(function(t,e){var n={x:e.__rg.position.x||e.position.x,y:e.__rg.position.y||e.position.x};return t[e.id]=n,t},{})}(s.selectedElements);a({x:r,y:o}),u(i)},onDrag:function(t){var e=t.clientX*(1/f),n=t.clientY*(1/f);s.selectedElements.filter(Ir).forEach(function(t){i({id:t.id,pos:{x:o[t.id].x+e-d.x-r.x-c,y:o[t.id].y+n-d.y-r.y-l}})})}},N.createElement("div",{className:"react-flow__nodesselection-rect",style:{width:s.selectedNodesBbox.width,height:s.selectedNodesBbox.height,top:s.selectedNodesBbox.y,left:s.selectedNodesBbox.x}})))});function uo(e){var t=It(O.useState(!1),2),n=t[0],r=t[1];function o(t){t.keyCode!==e||oo(t.target)||r(!0)}function i(t){t.keyCode!==e||oo(t.target)||r(!1)}return O.useEffect(function(){return window.addEventListener("keydown",o),window.addEventListener("keyup",i),function(){window.removeEventListener("keydown",o),window.removeEventListener("keyup",i)}},[]),n}var so,co,lo,fo,ho,po,yo,mo,go,vo,wo,bo,_o,xo,Eo,So=(lo=kr,fo=Pr,ho=Cr,po=Tr,yo=jr,mo=[0,1/0],go=[[-1/0,-1/0],[1/0,1/0]],vo=250,wo=jn,bo=Lt("start","zoom","end"),_o=500,xo=150,Eo=0,Oo.transform=function(t,e,n){var r=t.selection?t.selection():t;r.property("__zoom",Ar),t!==r?Ao(t,e,n):r.interrupt().each(function(){To(this,arguments).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()})},Oo.scaleBy=function(t,e,n){Oo.scaleTo(t,function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)},n)},Oo.scaleTo=function(t,i,a){Oo.transform(t,function(){var t=fo.apply(this,arguments),e=this.__zoom,n=null==a?Po(t):"function"==typeof a?a.apply(this,arguments):a,r=e.invert(n),o="function"==typeof i?i.apply(this,arguments):i;return ho(ko(No(e,o),n,r),t,go)},a)},Oo.translateBy=function(t,e,n){Oo.transform(t,function(){return ho(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),fo.apply(this,arguments),go)})},Oo.translateTo=function(t,r,o,i){Oo.transform(t,function(){var t=fo.apply(this,arguments),e=this.__zoom,n=null==i?Po(t):"function"==typeof i?i.apply(this,arguments):i;return ho(Sr.translate(n[0],n[1]).scale(e.k).translate("function"==typeof r?-r.apply(this,arguments):-r,"function"==typeof o?-o.apply(this,arguments):-o),t,go)},i)},jo.prototype={start:function(){return 1==++this.active&&(this.that.__zooming=this).emit("start"),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(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(t){!function(t,e,n,r){var o=we;t.sourceEvent=we,we=t;try{e.apply(n,r)}finally{we=o}}(new xr(Oo,t,this.that.__zoom),bo.apply,bo,[t,this.that,this.args])}},Oo.wheelDelta=function(t){return arguments.length?(po="function"==typeof t?t:_r(+t),Oo):po},Oo.filter=function(t){return arguments.length?(lo="function"==typeof t?t:_r(!!t),Oo):lo},Oo.touchable=function(t){return arguments.length?(yo="function"==typeof t?t:_r(!!t),Oo):yo},Oo.extent=function(t){return arguments.length?(fo="function"==typeof t?t:_r([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),Oo):fo},Oo.scaleExtent=function(t){return arguments.length?(mo[0]=+t[0],mo[1]=+t[1],Oo):[mo[0],mo[1]]},Oo.translateExtent=function(t){return arguments.length?(go[0][0]=+t[0][0],go[1][0]=+t[1][0],go[0][1]=+t[0][1],go[1][1]=+t[1][1],Oo):[[go[0][0],go[0][1]],[go[1][0],go[1][1]]]},Oo.constrain=function(t){return arguments.length?(ho=t,Oo):ho},Oo.duration=function(t){return arguments.length?(vo=+t,Oo):vo},Oo.interpolate=function(t){return arguments.length?(wo=t,Oo):wo},Oo.on=function(){var t=bo.on.apply(bo,arguments);return t===bo?Oo:t},Oo.clickDistance=function(t){return arguments.length?(Eo=(t=+t)*t,Oo):Math.sqrt(Eo)},Oo).scaleExtent([.5,2]);function Oo(t){t.property("__zoom",Ar).on("wheel.zoom",Co).on("mousedown.zoom",Do).on("dblclick.zoom",Mo).filter(yo).on("touchstart.zoom",Io).on("touchmove.zoom",zo).on("touchend.zoom touchcancel.zoom",Ro).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function No(t,e){return(e=Math.max(mo[0],Math.min(mo[1],e)))===t.k?t:new Er(e,t.x,t.y)}function ko(t,e,n){var r=e[0]-n[0]*t.k,o=e[1]-n[1]*t.k;return r===t.x&&o===t.y?t:new Er(t.k,r,o)}function Po(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function Ao(t,c,l){t.on("start.zoom",function(){To(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){To(this,arguments).end()}).tween("zoom",function(){var t=this,e=arguments,r=To(t,e),n=fo.apply(t,e),o=null==l?Po(n):"function"==typeof l?l.apply(t,e):l,i=Math.max(n[1][0]-n[0][0],n[1][1]-n[0][1]),a=t.__zoom,u="function"==typeof c?c.apply(t,e):c,s=wo(a.invert(o).concat(i/a.k),u.invert(o).concat(i/u.k));return function(t){if(1===t)t=u;else{var e=s(t),n=i/e[2];t=new Er(n,o[0]-e[0]*n,o[1]-e[1]*n)}r.zoom(null,t)}})}function To(t,e,n){return!n&&t.__zooming||new jo(t,e)}function jo(t,e){this.that=t,this.args=e,this.active=0,this.extent=fo.apply(t,e),this.taps=0}function Co(){if(lo.apply(this,arguments)){var t=To(this,arguments),e=this.__zoom,n=Math.max(mo[0],Math.min(mo[1],e.k*Math.pow(2,po.apply(this,arguments)))),r=je(this);if(t.wheel)t.mouse[0][0]===r[0]&&t.mouse[0][1]===r[1]||(t.mouse[1]=e.invert(t.mouse[0]=r)),clearTimeout(t.wheel);else{if(e.k===n)return;t.mouse=[r,e.invert(r)],lr(this),t.start()}Nr(),t.wheel=setTimeout(function(){t.wheel=null,t.end()},xo),t.zoom("mouse",ho(ko(No(e,n),t.mouse[0],t.mouse[1]),t.extent,go))}}function Do(){if(!co&&lo.apply(this,arguments)){var n=To(this,arguments,!0),t=Pe(we.view).on("mousemove.zoom",function(){if(Nr(),!n.moved){var t=we.clientX-r,e=we.clientY-o;n.moved=Eo<t*t+e*e}n.zoom("mouse",ho(ko(n.that.__zoom,n.mouse[0]=je(n.that),n.mouse[1]),n.extent,go))},!0).on("mouseup.zoom",function(){t.on("mousemove.zoom mouseup.zoom",null),function(t,e){var n=t.document.documentElement,r=Pe(t).on("dragstart.drag",null);e&&(r.on("click.drag",De,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(we.view,n.moved),Nr(),n.end()},!0),e=je(this),r=we.clientX,o=we.clientY;!function(t){var e=t.document.documentElement,n=Pe(t).on("dragstart.drag",De,!0);"onselectstart"in e?n.on("selectstart.drag",De,!0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(we.view),Or(),n.mouse=[e,this.__zoom.invert(e)],lr(this),n.start()}}function Mo(){if(lo.apply(this,arguments)){var t=this.__zoom,e=je(this),n=t.invert(e),r=t.k*(we.shiftKey?.5:2),o=ho(ko(No(t,r),e,n),fo.apply(this,arguments),go);Nr(),0<vo?Pe(this).transition().duration(vo).call(Ao,o,e):Pe(this).call(Oo.transform,o)}}function Io(){if(lo.apply(this,arguments)){var t,e,n,r,o=we.touches,i=o.length,a=To(this,arguments,we.changedTouches.length===i);for(Or(),e=0;e<i;++e)r=[r=Ce(this,o,(n=o[e]).identifier),this.__zoom.invert(r),n.identifier],a.touch0?a.touch1||a.touch0[2]===r[2]||(a.touch1=r,a.taps=0):(a.touch0=r,t=!0,a.taps=1+!!so);so=so&&clearTimeout(so),t&&(a.taps<2&&(so=setTimeout(function(){so=null},_o)),lr(this),a.start())}}function zo(){if(this.__zooming){var t,e,n,r,o=To(this,arguments),i=we.changedTouches,a=i.length;for(Nr(),so=so&&clearTimeout(so),t=o.taps=0;t<a;++t)n=Ce(this,i,(e=i[t]).identifier),o.touch0&&o.touch0[2]===e.identifier?o.touch0[0]=n:o.touch1&&o.touch1[2]===e.identifier&&(o.touch1[0]=n);if(e=o.that.__zoom,o.touch1){var u=o.touch0[0],s=o.touch0[1],c=o.touch1[0],l=o.touch1[1],f=(f=c[0]-u[0])*f+(f=c[1]-u[1])*f,d=(d=l[0]-s[0])*d+(d=l[1]-s[1])*d;e=No(e,Math.sqrt(f/d)),n=[(u[0]+c[0])/2,(u[1]+c[1])/2],r=[(s[0]+l[0])/2,(s[1]+l[1])/2]}else{if(!o.touch0)return;n=o.touch0[0],r=o.touch0[1]}o.zoom("touch",ho(ko(e,n,r),o.extent,go))}}function Ro(){if(this.__zooming){var t,e,n=To(this,arguments),r=we.changedTouches,o=r.length;for(Or(),co&&clearTimeout(co),co=setTimeout(function(){co=null},_o),t=0;t<o;++t)e=r[t],n.touch0&&n.touch0[2]===e.identifier?delete n.touch0:n.touch1&&n.touch1[2]===e.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),2===n.taps){var i=Pe(this).on("dblclick.zoom");i&&i.apply(this,arguments)}}}var Lo=O.memo(function(t){function e(){var t=io(w.current);_(t)}var n=t.nodeTypes,r=t.edgeTypes,o=t.onMove,i=t.onLoad,a=t.onElementClick,u=t.onNodeDragStop,s=t.connectionLineType,c=t.connectionLineStyle,l=t.selectionKeyCode,f=t.onElementsRemove,d=t.deleteKeyCode,h=t.elements,p=t.onConnect,y=t.gridColor,m=t.showGrid,g=t.gridGap,v=O.useRef(),w=O.useRef(),b=pt(function(t){return{width:t.width,height:t.height,nodes:t.nodes,edges:t.edges,d3Initialised:t.d3Initialised,nodesSelectionActive:t.nodesSelectionActive}}),_=mt(function(t){return t.updateSize}),x=mt(function(t){return t.setNodesSelection}),E=mt(function(t){return t.setOnConnect}),S=uo(l);return O.useEffect(function(){return e(),E(p),window.onresize=e,function(){window.onresize=null}},[]),function(e,n,r){var o=pt(function(t){return{transform:t.transform,d3Selection:t.d3Selection,d3Zoom:t.d3Zoom,edges:t.edged,d3Initialised:t.d3Initialised,nodesSelectionActive:t.nodesSelectionActive}}),i=mt(function(t){return t.initD3}),a=mt(function(t){return t.updateTransform});O.useEffect(function(){var t=Pe(e.current).call(So);i({zoom:So,selection:t})},[]),O.useEffect(function(){if(r)So.on("zoom",null);else if(So.on("zoom",function(){if(we.sourceEvent&&we.sourceEvent.target!==e.current)return!1;a(we.transform),n()}),o.d3Selection){var t=Sr.translate(o.transform[0],o.transform[1]).scale(o.transform[2]);o.d3Selection.call(o.d3Zoom.transform,t)}return function(){So.on("zoom",null)}},[r])}(v,o,S),O.useEffect(function(){b.d3Initialised&&i({fitView:Rr,zoomIn:Lr,zoomOut:Xr})},[b.d3Initialised]),function(t){var e=t.deleteKeyCode,n=t.onElementsRemove,r=pt(function(t){return{selectedElements:t.selectedElements,edges:t.edges}}),o=mt(function(t){return t.setNodesSelection}),i=uo(e);O.useEffect(function(){if(i&&r.selectedElements.length){var t=r.selectedElements;if(1===r.selectedElements.length&&!Mr(r.selectedElements[0])){var e=qr(r.selectedElements,r.edges);t=[].concat(zt(r.selectedElements),zt(e))}n(t),o({isActive:!1})}},[i])}({onElementsRemove:f,deleteKeyCode:d}),function(t){var i=t.elements,a=pt(function(t){return{nodes:t.nodes,edges:t.edges,transform:t.transform}}),u=mt(function(t){return t.setNodes}),s=mt(function(t){return t.setEdges});O.useEffect(function(){var t=i.filter(Ir),e=i.filter(Mr).map(zr),n=t.map(function(e){var t=a.nodes.find(function(t){return t.id===e.id});return t?Dt({},t,{data:Dr(t.data,e.data)?t.data:Dt({},t.data,{},e.data)}):zr(e,a.transform)}),r=!Dr(a.nodes,n),o=!Dr(a.edges,e);r&&u(n),o&&s(e)})}({elements:h}),N.createElement("div",{className:"react-flow__renderer",ref:w},m&&N.createElement(Qr,{gap:g,strokeColor:y}),N.createElement(Hr,{nodeTypes:n,onElementClick:a,onNodeDragStop:u}),N.createElement(Zr,{width:b.width,height:b.height,edgeTypes:r,onElementClick:a,connectionLineType:s,connectionLineStyle:c}),S&&N.createElement(no,null),b.nodesSelectionActive&&N.createElement(ao,null),N.createElement("div",{className:"react-flow__zoompane",onClick:function(){return x({isActive:!1})},ref:v}))});Lo.displayName="GraphView";var Xo=O.memo(function(t){var e=t.type,n=t.nodeId,r=t.onConnect,o=t.position,i=t.setSourceId,a=t.setPosition,u=t.className,s=t.id,c=void 0!==s&&s,l=t.isValidConnection,f=Mt(t,["type","nodeId","onConnect","position","setSourceId","setPosition","className","id","isValidConnection"]),d="target"===e,h=Gr("react-flow__handle",u,o,{source:!d,target:d}),p=c?"".concat(n,"__").concat(c):n;return N.createElement("div",jt({"data-nodeid":p,"data-handlepos":o,className:h,onMouseDown:function(t){return function(t,e){var a=e.nodeId,o=e.setSourceId,i=e.setPosition,u=e.onConnect,s=e.isTarget,c=e.isValidConnection,l=document.querySelector(".react-flow").getBoundingClientRect(),f=null;function d(){f&&(f.classList.remove("valid"),f.classList.remove("connecting"))}function h(t){var e=document.elementFromPoint(t.clientX,t.clientY),n={elementBelow:e,isValid:!1,connection:null,isHoveringHandle:!1};if(e&&(e.classList.contains("target")||e.classList.contains("source"))){var r=null;if(s){r={source:e.getAttribute("data-nodeid"),target:a}}else{var o=e.getAttribute("data-nodeid");r={source:a,target:o}}var i=c(r);n.connection=r,n.isValid=i,n.isHoveringHandle=!0}return n}function p(t){i({x:t.clientX-l.x,y:t.clientY-l.y});var e=h(t),n=e.connection,r=e.elementBelow,o=e.isValid;if(!e.isHoveringHandle)return d();n.source===n.target||((f=r).classList.add("connecting"),r.classList.toggle("valid",o))}i({x:t.clientX-l.x,y:t.clientY-l.y}),o(a),document.addEventListener("mousemove",p),document.addEventListener("mouseup",function t(e){var n=h(e),r=n.connection;n.isValid&&u(r),d(),o(null),document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",t)})}(t,{nodeId:p,setSourceId:i,setPosition:a,onConnect:r,isTarget:d,isValidConnection:l})}},f))});Xo.displayName="BaseHandle",Xo.whyDidYouRender=!1;var Yo=O.createContext(null),Vo=Yo.Provider;Yo.Consumer;Vo.displayName="NodeIdProvider";var Bo=O.memo(function(t){var e=t.onConnect,n=Mt(t,["onConnect"]),r=O.useContext(Yo),o=mt(function(t){return{setPosition:t.setConnectionPosition,setSourceId:t.setConnectionSourceId}}),i=o.setPosition,a=o.setSourceId,u=pt(function(t){return t.onConnect});return N.createElement(Xo,jt({nodeId:r,setPosition:i,setSourceId:a,onConnect:function(t){u(t),e(t)}},n))});Bo.displayName="Handle",Bo.propTypes={type:e.oneOf(["source","target"]),position:e.oneOf(["top","right","bottom","left"]),onConnect:e.func,isValidConnection:e.func},Bo.defaultProps={type:"source",position:"top",onConnect:function(){},isValidConnection:function(){return!0}};function qo(t){var e=t.data,n=t.style;return N.createElement("div",{style:Dt({},Wo,{},n)},N.createElement(Bo,{type:"target",position:"top"}),e.label,N.createElement(Bo,{type:"source",position:"bottom"}))}function Ho(t){var e=t.data,n=t.style;return N.createElement("div",{style:Dt({},Ko,{},n)},e.label,N.createElement(Bo,{type:"source",position:"bottom"}))}function Uo(t){var e=t.data,n=t.style;return N.createElement("div",{style:Dt({},$o,{},n)},N.createElement(Bo,{type:"target",position:"top"}),e.label)}function Fo(t,e,u,s){var n=e.querySelectorAll(t);return n&&n.length?[].map.call(n,function(t){var e=t.getBoundingClientRect(),n=io(t),r=t.getAttribute("data-nodeid"),o=t.getAttribute("data-handlepos"),i=r.split("__"),a=null;return i&&(a=i.length?i[1]:i),Dt({id:a,position:o,x:(e.x-u.x)*(1/s),y:(e.y-u.y)*(1/s)},n)}):null}function Go(x){var t=O.memo(function(t){function a(){var t=Yr.getState(),e=o.current.getBoundingClientRect(),n=io(o.current),r={source:Fo(".source",o.current,e,t.transform[2]),target:Fo(".target",o.current,e,t.transform[2])};Yr.dispatch.updateNodeData(Dt({id:c},n,{handleBounds:r}))}var o=O.useRef(null),e=It(O.useState({x:0,y:0}),2),n=e[0],r=e[1],i=It(O.useState(!1),2),u=i[0],s=i[1],c=t.id,l=t.type,f=t.data,d=t.transform,h=t.xPos,p=t.yPos,y=t.selected,m=t.onClick,g=t.onNodeDragStop,v=t.style,w={x:h,y:p},b=Gr("react-flow__node",{selected:y}),_={zIndex:y?10:3,transform:"translate(".concat(h,"px,").concat(p,"px)")};return O.useEffect(function(){a();var t=null;return Zo&&(t=new ResizeObserver(function(t){var e=!0,n=!1,r=void 0;try{for(var o,i=t[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){o.value;a()}}catch(t){n=!0,r=t}finally{try{e||null==i.return||i.return()}finally{if(n)throw r}}})).observe(o.current),function(){Zo&&t&&t.unobserve(o.current)}},[]),N.createElement(ro.DraggableCore,{onStart:function(t){return function(t,e){var n=e.setOffset,r=e.onClick,o=e.id,i=e.type,a=e.data,u=e.position,s=e.transform;if(oo(t)||function(t){return t.target.className&&t.target.className.includes&&(t.target.className.includes("source")||t.target.className.includes("target"))}(t))return!1;var c=t.clientX*(1/[s[2]]),l=t.clientY*(1/[s[2]]),f=c-u.x-s[0],d=l-u.y-s[1],h={id:o,type:i,position:u,data:a};Yr.dispatch.setSelectedElements({id:o,type:i}),n({x:f,y:d}),r(h)}(t,{onClick:m,id:c,type:l,data:f,setOffset:r,transform:d,position:w})},onDrag:function(t){return function(t,e){var n=e.setDragging,r=e.id,o=e.offset,i=e.transform,a=t.clientX*(1/i[2]),u=t.clientY*(1/i[2]);n(!0),Yr.dispatch.updateNodePos({id:r,pos:{x:a-i[0]-o.x,y:u-i[1]-o.y}})}(t,{setDragging:s,id:c,offset:n,transform:d})},onStop:function(){return function(t){var e=t.onNodeDragStop,n=t.setDragging,r=t.isDragging,o=t.id,i=t.type,a=t.position,u=t.data;if(!r)return!1;n(!1),e({id:o,type:i,position:a,data:u})}({onNodeDragStop:g,isDragging:u,setDragging:s,id:c,type:l,position:w,data:f})},scale:d[2]},N.createElement("div",{className:b,ref:o,style:_},N.createElement(Vo,{value:c},N.createElement(x,{id:c,data:f,type:l,style:v,selected:y}))))});return t.displayName="NodeWrapper",t.whyDidYouRender=!1,t}var Wo={background:"#ff6060",padding:10,borderRadius:5,width:150},Ko={background:"#9999ff",padding:10,borderRadius:5,width:150},$o={background:"#55dd99",padding:10,borderRadius:5,width:150},Zo=!!window.ResizeObserver;function Jo(c){var t=O.memo(function(t){var e=t.id,n=t.source,r=t.target,o=t.type,i=t.animated,a=t.selected,u=t.onClick,s=Gr("react-flow__edge",{selected:a,animated:i});return N.createElement("g",{className:s,onClick:function(t){if(oo(t))return!1;Yr.dispatch.setSelectedElements({id:e,source:n,target:r}),u({id:e,source:n,target:r,type:o})}},N.createElement(c,t))});return t.displayName="EdgeWrapper",t.whyDidYouRender=!1,t}var Qo=O.memo(function(t){var e=t.sourceX,n=t.sourceY,r=t.targetX,o=t.targetY,i=t.sourcePosition,a=t.targetPosition,u=t.style,s=void 0===u?{}:u,c=Math.abs(o-n)/2,l=o<n?o+c:o-c,f="M".concat(e,",").concat(n," C").concat(e,",").concat(l," ").concat(r,",").concat(l," ").concat(r,",").concat(o);if(["left","right"].includes(i)&&["left","right"].includes(a)){var d=Math.abs(r-e)/2,h=r<e?r+d:r-d;f="M".concat(e,",").concat(n," C").concat(h,",").concat(n," ").concat(h,",").concat(o," ").concat(r,",").concat(o)}else(["left","right"].includes(i)||["left","right"].includes(a))&&(f="M".concat(e,",").concat(n," C").concat(e,",").concat(o," ").concat(e,",").concat(o," ").concat(r,",").concat(o));return N.createElement("path",jt({},s,{d:f}))}),ti=O.memo(function(t){var e=t.sourceX,n=t.sourceY,r=t.targetX,o=t.targetY,i=t.style,a=void 0===i?{}:i;return N.createElement("path",jt({},a,{d:"M ".concat(e,",").concat(n,"L ").concat(r,",").concat(o)}))}),ei=O.memo(function(t){var e=t.sourceX,n=t.sourceY,r=t.targetX,o=t.targetY,i=t.style,a=void 0===i?{}:i,u=Math.abs(o-n)/2,s=o<n?o+u:o-u;return N.createElement("path",jt({},a,{d:"M ".concat(e,",").concat(n,"L ").concat(e,",").concat(s,"L ").concat(r,",").concat(s,"L ").concat(r,",").concat(o)}))});"production"!==process.env.NODE_ENV&&require("@welldone-software/why-did-you-render")(N);function ni(t){var e=t.style,n=t.onElementClick,r=t.elements,o=t.children,i=t.nodeTypes,a=t.edgeTypes,u=t.onLoad,s=t.onMove,c=t.onElementsRemove,l=t.onConnect,f=t.onNodeDragStop,d=t.connectionLineType,h=t.connectionLineStyle,p=t.deleteKeyCode,y=t.selectionKeyCode,m=t.gridColor,g=t.showGrid,v=t.gridGap,w=O.useMemo(function(){return function(n){return Dt({},{input:Go(n.input||Ho),default:Go(n.default||qo),output:Go(n.output||Uo)},{},Object.keys(n).filter(function(t){return!["input","default","output"].includes(t)}).reduce(function(t,e){return t[e]=Go(n[e]||qo),t},{}))}(i)},[]),b=O.useMemo(function(){return function(n){return Dt({},{default:Jo(n.default||Qo),straight:Jo(n.bezier||ti)},{},Object.keys(n).filter(function(t){return!["default","bezier"].includes(t)}).reduce(function(t,e){return t[e]=Jo(n[e]||Qo),t},{}))}(a)},[]);return N.createElement("div",{style:e,className:"react-flow"},N.createElement(Tt,{store:Yr},N.createElement(Lo,{onLoad:u,onMove:s,onElementClick:n,onNodeDragStop:f,nodeTypes:w,edgeTypes:b,connectionLineType:d,connectionLineStyle:h,selectionKeyCode:y,onElementsRemove:c,deleteKeyCode:p,elements:r,onConnect:l,gridColor:m,gridGap:v,showGrid:g}),o))}ni.displayName="ReactFlow",ni.propTypes={onElementClick:e.func,onElementsRemove:e.func,onNodeDragStop:e.func,onConnect:e.func,onLoad:e.func,onMove:e.func,nodeTypes:e.object,edgeTypes:e.object,connectionLineType:e.string,connectionLineStyle:e.object,deleteKeyCode:e.number,selectionKeyCode:e.number,gridColor:e.string,gridGap:e.number,showGrid:e.bool},ni.defaultProps={onElementClick:function(){},onElementsRemove:function(){},onNodeDragStop:function(){},onConnect:function(){},onLoad:function(){},onMove:function(){},nodeTypes:{input:Ho,default:qo,output:Uo},edgeTypes:{default:Qo,straight:ti,step:ei},connectionLineType:"bezier",connectionLineStyle:{},deleteKeyCode:8,selectionKeyCode:16,gridColor:"#999",gridGap:24,showGrid:!0};var ri={position:"absolute",zIndex:5,bottom:10,right:10,width:200},oi={position:"absolute",zIndex:5,bottom:10,left:10};t.Controls=function(t){var e=t.style,n=t.className,r=Gr("react-flow__controls",n);return N.createElement("div",{className:r,style:Dt({},oi,{},e)},N.createElement("div",{className:"react-flow__controls-button react-flow__controls-zoomin",onClick:Lr},"+"),N.createElement("div",{className:"react-flow__controls-button react-flow__controls-zoomout",onClick:Xr},"-"),N.createElement("div",{className:"react-flow__controls-button react-flow__controls-fitview",onClick:Rr},"@"))},t.Handle=Bo,t.MiniMap=function(t){var e=t.style,n=void 0===e?{}:e,r=t.className,o=t.bgColor,i=void 0===o?"#f8f8f8":o,a=t.nodeColor,u=void 0===a?"#ddd":a,s=O.useRef(null),c=pt(function(t){return{width:t.width,height:t.height,nodes:t.nodes,transform:t.transform}}),l=Gr("react-flow__minimap",r),f=c.nodes.map(function(t){return t.__rg.position}),d=n.width||ri.width,h=c.height/(c.width||1)*d,p={x:0,y:0,width:c.width,height:c.height},y=d/c.width,m=function(t){return!!(t&&t.constructor&&t.call&&t.apply)}(u)?u:function(){return u};return O.useEffect(function(){if(s){var a=s.current.getContext("2d"),t=Br(c.nodes,p,c.transform,!0);a.fillStyle=i,a.fillRect(0,0,d,h),t.forEach(function(t){var e=t.__rg.position,n=c.transform[0],r=c.transform[1],o=e.x*c.transform[2]+n,i=e.y*c.transform[2]+r;a.fillStyle=m(t),a.fillRect(o*y,i*y,t.__rg.width*y*c.transform[2],t.__rg.height*y*c.transform[2])})}},[f,c.transform,h]),N.createElement("canvas",{style:Dt({},ri,{},n,{height:h}),width:d,height:h,className:l,ref:s})},t.default=ni,t.getOutgoers=function(e,t){if(!Ir(e))return[];var n=t.filter(function(t){return t.source===e.id}).map(function(t){return t.target});return t.filter(function(t){return n.includes(t.id)})},t.isEdge=Mr,t.isNode=Ir,t.removeElements=function(t,e){var n=e.map(function(t){return t.id});return t.filter(function(t){return!n.includes(t.id)&&!n.includes(t.target)&&!n.includes(t.source)})},Object.defineProperty(t,"__esModule",{value:!0})});
|
|
//# sourceMappingURL=ReactFlow.js.map
|