g(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","import arrayWithoutHoles from \"./arrayWithoutHoles.js\";\nimport iterableToArray from \"./iterableToArray.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableSpread from \"./nonIterableSpread.js\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithHoles from \"./arrayWithHoles.js\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableRest from \"./nonIterableRest.js\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"];\n if (null != _i) {\n var _s,\n _e,\n _x,\n _r,\n _arr = [],\n _n = !0,\n _d = !1;\n try {\n if (_x = (_i = _i.call(arr)).next, 0 === i) {\n if (Object(_i) !== _i) return;\n _n = !1;\n } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);\n } catch (err) {\n _d = !0, _e = err;\n } finally {\n try {\n if (!_n && null != _i[\"return\"] && (_r = _i[\"return\"](), Object(_r) !== _r)) return;\n } finally {\n if (_d) throw _e;\n }\n }\n return _arr;\n }\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","import defineProperty from \"./defineProperty.js\";\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n return keys;\n}\nexport default function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n return target;\n}","import unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nexport default function _createForOfIteratorHelper(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (!it) {\n if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n var F = function F() {};\n return {\n s: F,\n n: function n() {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n },\n e: function e(_e) {\n throw _e;\n },\n f: F\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var normalCompletion = true,\n didErr = false,\n err;\n return {\n s: function s() {\n it = it.call(o);\n },\n n: function n() {\n var step = it.next();\n normalCompletion = step.done;\n return step;\n },\n e: function e(_e2) {\n didErr = true;\n err = _e2;\n },\n f: function f() {\n try {\n if (!normalCompletion && it[\"return\"] != null) it[\"return\"]();\n } finally {\n if (didErr) throw err;\n }\n }\n };\n}","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose.js\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n return target;\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}","export default function isSame(v1, v2) {\n return String(v1) === String(v2);\n}\n","import isSame from './isSame';\n\nexport default function getOption(value, options) {\n if (Array.isArray(value)) {\n return value\n .map((v) => options.find((o) => isSame(o.value, v)))\n .filter((o) => o);\n }\n\n return options.find((o) => isSame(o.value, value)) || null;\n}\n","export default function toArray(value) {\n return Array.isArray(value) ? value : [value];\n}\n","import isSame from './isSame';\nimport toArray from './toArray';\n\nexport default function updateOption(newOption, oldOption, multiple) {\n if (!newOption) {\n return oldOption;\n }\n\n if (!multiple) {\n return newOption;\n }\n\n if (!oldOption) {\n return toArray(newOption);\n }\n\n const nextOption = toArray(oldOption);\n const newOptionIndex = nextOption.findIndex((o) =>\n isSame(o.value, newOption.value),\n );\n\n if (newOptionIndex >= 0) {\n nextOption.splice(newOptionIndex, 1);\n } else {\n nextOption.push(newOption);\n }\n\n return nextOption;\n}\n","export default function getDisplayValue(option, options, placeholder) {\n if (!option && !placeholder) {\n return options && options.length ? options[0].name || '' : '';\n }\n\n const isMultiple = Array.isArray(option);\n\n if (!option && !isMultiple) {\n return '';\n }\n\n return isMultiple\n ? option\n .map((o) => o.name)\n .filter(Boolean)\n .join(', ')\n : option.name || '';\n}\n","export default function getValue(option) {\n if (!option) return null;\n\n if (Array.isArray(option)) {\n return option.filter(Boolean).map((o) => o.value);\n }\n\n return option.value || null;\n}\n","export default function groupOptions(options) {\n const nextOptions = [];\n\n options.forEach((option) => {\n if (option.group) {\n const group = nextOptions.findIndex((o) => o.type === 'group' && o.name === option.group);\n\n if (group >= 0) {\n nextOptions[group].items.push(option);\n } else {\n nextOptions.push({\n items: [option],\n type: 'group',\n name: option.group,\n });\n }\n } else {\n nextOptions.push(option);\n }\n });\n\n return nextOptions;\n}\n","function search(q, text) {\n const searchLength = q.length;\n const textLength = text.length;\n\n if (searchLength > textLength) {\n return false;\n }\n\n if (text.indexOf(q) >= 0) {\n return true;\n }\n\n mainLoop: for (let i = 0, j = 0; i < searchLength; i += 1) {\n const ch = q.charCodeAt(i);\n\n while (j < textLength) {\n if (text.charCodeAt(j++) === ch) {\n continue mainLoop;\n }\n }\n\n return false;\n }\n\n return true;\n}\n\nexport default function fuzzySearch(options, query) {\n return !query.length\n ? options\n : options.filter((o) =>\n search(\n query.toLowerCase(),\n `${o.name} ${o.group || ''}`.trim().toLowerCase(),\n ),\n );\n}\n","export default function reduce(middleware, items, query) {\n return middleware.filter(Boolean)\n .reduce((data, cb) => cb(data, query), items)\n .map((item, i) => ({ ...item, index: i }));\n}\n","export default function flattenOptions(options) {\n let index = 0;\n\n return options.map((option) => {\n if (option.type === 'group') {\n return option.items.map((o) => ({\n ...o,\n group: option.name,\n index: index++,\n }));\n }\n\n return { ...option, index: index++ };\n }).flat();\n}\n","import { useEffect, useState } from 'react';\nimport flattenOptions from './lib/flattenOptions';\n\nexport default function useOptions(\n defaultOptions,\n getOptions,\n debounceTime,\n search,\n) {\n const [options, setOptions] = useState(() => flattenOptions(defaultOptions));\n const [fetching, setFetching] = useState(false);\n\n useEffect(() => {\n let timeout;\n\n if (!getOptions) {\n return;\n }\n\n timeout = setTimeout(() => {\n const optionsReq = getOptions(search, options);\n\n setFetching(true);\n\n Promise.resolve(optionsReq)\n .then((newOptions) => setOptions(flattenOptions(newOptions)))\n .finally(() => setFetching(false));\n }, debounceTime);\n\n return () => {\n clearTimeout(timeout);\n };\n }, [search]);\n\n useEffect(() => {\n setOptions(flattenOptions(defaultOptions));\n }, [defaultOptions]);\n\n return [options, fetching];\n}\n","export default function highlight(current, dir, options) {\n const max = options.length - 1;\n let option = null;\n let i = -1;\n let newHighlighted = current;\n\n while (i++ <= max && (!option || option.disabled)) {\n newHighlighted =\n dir === 'down' ? newHighlighted + 1 : newHighlighted - 1;\n\n if (newHighlighted < 0) {\n newHighlighted = max;\n } else if (newHighlighted > max) {\n newHighlighted = 0;\n }\n\n option = options[newHighlighted];\n }\n\n return newHighlighted;\n}\n","import { useState } from 'react';\nimport highlight from './lib/highlight';\n\nexport default function useHighlight(options, onSelect, ref) {\n const [highlighted, setHighlighted] = useState(-1);\n\n return [\n {\n onKeyDown: (e) => {\n const key = e.key.replace('Arrow', '').toLowerCase();\n\n if (key === 'down' || key === 'up') {\n e.preventDefault();\n setHighlighted(highlight(highlighted, key, options));\n }\n },\n onKeyUp: (e) => {\n if (e.key === 'Escape') {\n e.preventDefault();\n ref.current.blur();\n } else if (e.key === 'Enter') {\n e.preventDefault();\n\n if (options[highlighted]) {\n onSelect(options[highlighted].value);\n }\n }\n },\n },\n highlighted,\n setHighlighted,\n ];\n}\n","import { useEffect, useRef, useState } from 'react';\nimport getOption from './lib/getOption';\nimport updateOption from './lib/updateOption';\nimport getDisplayValue from './lib/getDisplayValue';\nimport getValue from './lib/getValue';\nimport groupOptions from './lib/groupOptions';\nimport fuzzySearch from './lib/fuzzySearch';\nimport reduce from './lib/reduce';\nimport useOptions from './useOptions';\nimport useHighlight from './useHighlight';\n\nconst nullCb = () => {};\n\nexport default function useSelect({\n options: defaultOptions,\n defaultValue,\n value,\n multiple,\n search,\n onChange = nullCb,\n onFocus = nullCb,\n onBlur = nullCb,\n closeOnSelect = true,\n placeholder,\n getOptions,\n filterOptions,\n useFuzzySearch = true,\n debounce,\n}) {\n const ref = useRef();\n const [option, setOption] = useState(null);\n const [q, setSearch] = useState('');\n const [focus, setFocus] = useState(false);\n const [options, fetching] = useOptions(\n defaultOptions,\n getOptions,\n debounce,\n q,\n );\n\n const onSelect = (v) => {\n const newOption = updateOption(\n getOption(decodeURIComponent(v), options),\n option,\n multiple,\n );\n\n if (value === undefined) {\n setOption(newOption);\n }\n\n onChange(getValue(newOption), newOption);\n\n setTimeout(() => {\n if (ref.current && closeOnSelect) {\n ref.current.blur();\n }\n }, 0);\n };\n\n const [keyHandlers, highlighted, setHighlighted] = useHighlight(\n options,\n onSelect,\n ref,\n );\n const middleware = [\n useFuzzySearch ? fuzzySearch : null,\n ...(filterOptions ? filterOptions : []),\n ];\n\n const snapshot = {\n search: q,\n focus,\n option,\n value: getValue(option),\n fetching,\n highlighted,\n options: groupOptions(reduce(middleware, options, q)),\n displayValue: getDisplayValue(option, options, placeholder),\n };\n\n const valueProps = {\n tabIndex: '0',\n readOnly: !search,\n placeholder,\n value: focus && search ? q : snapshot.displayValue,\n ref,\n ...keyHandlers,\n onFocus: (e) => {\n setFocus(true);\n onFocus(e);\n },\n onBlur: (e) => {\n setFocus(false);\n setSearch('');\n setHighlighted(-1);\n onBlur(e);\n },\n onMouseDown: (e) => {\n if (focus) {\n e.preventDefault();\n ref.current.blur();\n }\n },\n onChange: search\n ? ({ target }) => setSearch(target.value)\n : null,\n };\n\n const optionProps = {\n tabIndex: '-1',\n onMouseDown(e) {\n e.preventDefault();\n onSelect(e.currentTarget.value);\n },\n };\n\n useEffect(() => {\n setOption(getOption(\n value === undefined ? defaultValue : value,\n options,\n ));\n }, [value, options]);\n\n return [snapshot, valueProps, optionProps];\n}\n","const isString = (str) => typeof str === 'string';\nconst getClassName = (str, className) =>\n isString(className) ? `${className}-${str}` : className[str];\n\nexport default function classes(classNames, className) {\n if (isString(classNames)) return getClassName(classNames, className);\n\n return Object.entries(classNames)\n .filter(([cls, display]) => cls && display)\n .map(([cls]) => getClassName(cls, className))\n .join(' ');\n}\n","/* eslint-disable react/prop-types */\nimport { memo } from 'react';\n\nfunction Option({\n optionProps,\n highlighted,\n selected,\n option,\n cls,\n renderOption,\n disabled,\n}) {\n const props = {\n ...optionProps,\n value: encodeURIComponent(option.value),\n disabled,\n };\n const className = cls({\n option: true,\n 'is-selected': selected,\n 'is-highlighted': highlighted,\n });\n\n return (\n \n {renderOption &&\n renderOption(\n props,\n option,\n { selected, highlighted },\n className,\n )}\n {!renderOption && (\n \n {option.name}\n \n )}\n \n );\n}\n\nexport default memo(Option);\n","/* eslint-disable react/prop-types */\nimport { memo } from 'react';\nimport Option from './Option';\nimport isSelected from '../lib/isSelected';\n\nfunction Options(props) {\n const {\n options,\n cls,\n renderOption,\n renderGroupHeader,\n optionProps,\n snapshot,\n disabled,\n } = props;\n\n return (\n \n {options.map((o) => {\n if (o.type === 'group') {\n return (\n \n \n
\n {renderGroupHeader\n ? renderGroupHeader(o.name)\n : o.name}\n
\n
\n
\n \n );\n }\n\n return (\n \n );\n })}\n \n );\n}\n\nexport default memo(Options);\n","export default function isSelected(option, selectedOption) {\n if (!selectedOption) return false;\n\n return Array.isArray(selectedOption)\n ? selectedOption.findIndex((o) => o.value === option.value) >= 0\n : selectedOption.value === option.value;\n}\n","import { memo, forwardRef, useEffect, useRef, useState } from \"react\";\nimport PropTypes from 'prop-types';\nimport useSelect from './useSelect';\nimport classes from './lib/classes';\nimport Options from './components/Options';\n\nconst SelectSearch = forwardRef(\n (\n {\n disabled,\n placeholder,\n multiple,\n search,\n autoFocus,\n autoComplete,\n id,\n closeOnSelect,\n className,\n renderValue,\n renderOption,\n renderGroupHeader,\n fuzzySearch,\n emptyMessage,\n value,\n ...hookProps\n },\n ref,\n ) => {\n const selectRef = useRef(null);\n const cls = (classNames) => classes(classNames, className);\n const [controlledValue, setControlledValue] = useState(value);\n const [snapshot, valueProps, optionProps] = useSelect({\n value: controlledValue,\n placeholder,\n multiple,\n search,\n closeOnSelect: closeOnSelect && !multiple,\n useFuzzySearch: fuzzySearch,\n ...hookProps,\n });\n const { highlighted, value: snapValue, fetching, focus } = snapshot;\n\n const props = {\n ...valueProps,\n autoFocus,\n autoComplete,\n disabled,\n };\n\n useEffect(() => {\n const { current } = selectRef;\n\n if (current) {\n const val = Array.isArray(snapValue) ? snapValue[0] : snapValue;\n const selected = current.querySelector(\n highlighted > -1\n ? `[data-index=\"${highlighted}\"]`\n : `[value=\"${encodeURIComponent(val)}\"]`,\n );\n\n if (selected) {\n const rect = current.getBoundingClientRect();\n const selectedRect = selected.getBoundingClientRect();\n\n current.scrollTop =\n selected.offsetTop -\n rect.height / 2 +\n selectedRect.height / 2;\n }\n }\n }, [snapValue, highlighted, selectRef.current]);\n\n useEffect(() => setControlledValue(value), [value]);\n\n return (\n \n {(!multiple || placeholder || search) && (\n
\n {renderValue &&\n renderValue(props, snapshot, cls('input'))}\n {!renderValue && (\n \n )}\n
\n )}\n
e.preventDefault()}\n >\n {snapshot.options.length > 0 && (\n
\n )}\n {!snapshot.options.length && (\n
\n {!snapshot.options.length && emptyMessage && (\n \n {emptyMessage}\n \n )}\n \n )}\n
\n
\n );\n },\n);\n\nSelectSearch.defaultProps = {\n // Data\n options: [],\n fuzzySearch: true,\n\n // Interaction´\n printOptions: 'auto',\n closeOnSelect: true,\n debounce: 250,\n\n // Attributes\n autoComplete: 'on',\n\n // Design\n className: 'select-search',\n};\n\nSelectSearch.propTypes = {\n // Data\n options: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])\n .isRequired,\n }),\n ),\n getOptions: PropTypes.func,\n filterOptions: PropTypes.arrayOf(PropTypes.func),\n fuzzySearch: PropTypes.bool,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n\n // Interaction\n multiple: PropTypes.bool,\n search: PropTypes.bool,\n disabled: PropTypes.bool,\n closeOnSelect: PropTypes.bool,\n debounce: PropTypes.number,\n\n // Attributes\n placeholder: PropTypes.string,\n id: PropTypes.string,\n autoComplete: PropTypes.string,\n autoFocus: PropTypes.bool,\n\n // Design\n className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n\n // Renderers\n renderOption: PropTypes.func,\n renderGroupHeader: PropTypes.func,\n renderValue: PropTypes.func,\n emptyMessage: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),\n\n // Events\n onChange: PropTypes.func,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n};\n\nSelectSearch.displayName = 'SelectSearch';\n\nexport default memo(SelectSearch);\n","import SelectSearch from './SelectSearch';\nexport { default as useSelect } from './useSelect';\n\nexport default SelectSearch;\n","export function rescale(value, minValue, maxValue, scale) {\n return Math.round(Math.min((scale * (value - minValue)) / (maxValue - minValue), scale) * 10) / 10\n}\n\nexport function deduplicate(a, key) {\n const seen = {}\n return a.filter(function (item) {\n const k = item[key]\n return seen.hasOwnProperty(k) ? false : (seen[k] = true)\n })\n}\n\nexport function calculateScore(dataset, range) {\n const nonzerodataset = dataset.filter(m => m.value !== undefined && m.value != null)\n const min = Math.min(...nonzerodataset.map(o => o.value))\n const max = Math.max(...nonzerodataset.map(o => o.value))\n\n for (let entry of dataset) {\n if (entry.value) {\n entry.score = Math.round(rescale(entry.value, min, max, range))\n } else {\n entry.score = 0\n }\n }\n\n return dataset\n}\n\nfunction filterOneOrMore(s, v) {\n if (typeof v === 'string') {\n return v.includes(s)\n }\n\n return v.some(m => m.includes(s))\n}\n\nexport function filter(search, v) {\n let posMatched = true\n let negMatched = true\n\n for (let s of search) {\n if (s.neg) {\n negMatched = negMatched && !filterOneOrMore(s.value, v)\n } else {\n posMatched = posMatched && filterOneOrMore(s.value, v)\n }\n }\n\n return posMatched && negMatched\n}\n\nexport function ratingColor(rating, scale = 1) {\n let color = 'danger'\n\n if (rating == null) {\n color = 'secondary'\n } else {\n if (rating >= 7 * scale) {\n color = 'success'\n } else if (rating >= 5 * scale) {\n color = 'info'\n } else if (rating >= 3 * scale) {\n color = 'warning'\n }\n }\n\n return color\n}\n\nexport function tierColor(tiers, unique, voidstones = 0) {\n const tier = tiers[voidstones]\n let color = 'light'\n\n if (unique) {\n color = 'unique'\n } else if (tier >= 11) {\n color = 'danger'\n } else if (tier >= 6) {\n color = 'warning'\n }\n\n return color\n}\n\nexport function scrollToElement(id) {\n document.getElementById(id).scrollIntoView({ behavior: 'smooth', block: 'start' })\n}\n\nexport function copyToClipboard(ref) {\n ref.current.select()\n document.execCommand('copy')\n}\n\nexport function mapTierToLevel(tier) {\n return tier - 1 + 68\n}\n\nexport function mapLevelToTier(level) {\n return level + 1 - 68\n}\n\nexport function parseValue(val, ref) {\n if (typeof ref === 'number') {\n return parseFloat(val)\n }\n\n if (typeof ref === 'boolean') {\n if (val === 1) {\n return true\n }\n\n if (val === 0) {\n return false\n }\n\n if (val === 'true') {\n return true\n }\n\n if (val === 'false') {\n return false\n }\n }\n\n return val\n}\n","import cards from './cards.json'\nimport maps from './maps.json'\nimport globals from './globals.json'\nimport { mapLevelToTier } from '../common'\n\nconst wikiBase = 'https://www.poewiki.net/wiki/'\nconst mapIconBase = 'https://web.poecdn.com/image/'\nconst cardArtBase = 'https://web.poecdn.com/image/divination-card/'\nexport const defaultCardBaseline = 'The Chains that Bind'\nexport const githubRepo = 'https://github.com/deathbeam/maps-of-exile'\nexport const issueTemplate = `${githubRepo}/issues/new?labels=map-data&template=map_data.yml&title=Enter+map+name+here`\nexport const mfAcademyInvite = 'https://discord.gg/mfacademy'\nexport const possibleVoidstones = [0, 1, 2, 3, 4]\n\nexport const preparedGlobals = globals\n\nexport const preparedCards = cards.map(card => {\n return {\n ...card,\n art: cardArtBase + card.art + '.png'\n }\n})\n\nfunction pushTag(info, destination, source, key, name = null) {\n const tag = source[key]\n\n if (tag) {\n const val = typeof tag == 'boolean' ? name || key.replaceAll('_', ' ') : tag.toLowerCase()\n const out = {\n name: val\n }\n if (info && info[key]) {\n out.info = info[key]\n }\n destination.push(out)\n }\n}\n\nexport const preparedMaps = maps.map(map => {\n const mapTags = []\n pushTag(map.info, mapTags, map.layout, 'few_obstacles', 'few obstacles')\n pushTag(map.info, mapTags, map.layout, 'outdoors')\n pushTag(map.info, mapTags, map.layout, 'linear')\n pushTag(map.info, mapTags, map.layout, 'league_mechanics', 'league mechanics')\n pushTag(map.info, mapTags, map.layout, 'delirium_mirror', 'delirium mirror')\n\n pushTag(map.info, mapTags, map.boss, 'separated', 'boss separated')\n pushTag(map.info, mapTags, map.boss, 'not_spawned', 'boss not spawned')\n pushTag(map.info, mapTags, map.boss, 'rushable', 'boss rushable')\n pushTag(map.info, mapTags, map.boss, 'phases', 'boss with phases')\n pushTag(map.info, mapTags, map.boss, 'soft_phases', 'boss with soft phases')\n pushTag(map.info, mapTags, map.boss, 'not_twinnable', 'boss not twinnable')\n\n pushTag(map.info, mapTags, map, 'unique')\n pushTag(map.info, mapTags, map, 'pantheon')\n\n const cards = []\n for (let card of preparedCards) {\n if (card.drop.all_areas) {\n cards.push({ ...card })\n }\n\n if (card.drop.areas.includes(map.id)) {\n cards.push({ ...card })\n }\n\n if (map.boss.ids && map.boss.ids.some(id => card.drop.monsters.includes(id))) {\n cards.push({ ...card, boss: true })\n }\n }\n\n const mapWeight = cards\n .filter(c => !c.boss)\n .map(c => c.weight)\n .reduce((a, b) => a + b, 0)\n const bossWeight = cards.map(c => c.weight).reduce((a, b) => a + b, 0)\n\n for (let card of cards) {\n card.poolWeight = preparedGlobals['droppool_weight'] + (card.boss ? bossWeight : mapWeight)\n }\n\n if (map.boss.names) {\n const names = map.boss.names.filter(n => !n.includes('Merveil'))\n if (names.length > 1) {\n mapTags.push({ name: `${names.length} bosses` })\n }\n }\n\n const tier = mapLevelToTier(map.level)\n\n const out = {\n ...map,\n image: map.image\n ? '/img/layout/' +\n map.name\n .replace(' Map', '')\n .toLowerCase()\n .replace(/[^a-zA-Z0-9 ]/g, '')\n .replaceAll(' ', '_') +\n '.png'\n : null,\n name: map.name.replace(' Map', ''),\n connected: (map.connected || []).map(c => c.replace(' Map', '')),\n cards: cards,\n tags: mapTags.sort((a, b) => a.name.localeCompare(b.name)),\n icon: mapIconBase + map.icon + '.png',\n wiki: wikiBase + map.name.replace(' ', '_'),\n tiers: [tier, Math.min(tier + 3, 16), Math.min(tier + 7, 16), Math.min(tier + 11, 16), Math.min(tier + 15, 16)]\n }\n\n // Build search index\n out.search = [\n ...new Set([\n out.name,\n ...out.connected,\n ...out.cards.map(c => c.name),\n ...out.cards.map(c => c.reward).filter(c => !!c),\n ...out.tags.map(t => t.name)\n ])\n ].map(v => v.trim().toLowerCase())\n return out\n})\n\nexport const preparedTags = []\nconst preparedTagsMap = new Map()\nfor (const item of preparedMaps\n .flatMap(m => m.tags)\n .map(t => ({\n name: t.name.replace(/\\d+ bosses/, 'bosses').replace(/soul of .+/, 'soul of')\n }))\n .sort((a, b) => a.name.localeCompare(b.name))) {\n if (!preparedTagsMap.has(item.name)) {\n preparedTagsMap.set(item.name, true)\n preparedTags.push({\n name: item.name\n })\n }\n}\n","import './Loader.css'\n\nconst Loader = ({ loading }) => (\n
\n)\n\nexport default Loader\n","export default function cc(names) {\n if (typeof names === \"string\" || typeof names === \"number\") return \"\" + names\n\n let out = \"\"\n\n if (Array.isArray(names)) {\n for (let i = 0, tmp; i < names.length; i++) {\n if ((tmp = cc(names[i])) !== \"\") {\n out += (out && \" \") + tmp\n }\n }\n } else {\n for (let k in names) {\n if (names[k]) out += (out && \" \") + k\n }\n }\n\n return out\n}\n","import { createStore } from 'zustand/vanilla';\nexport * from 'zustand/vanilla';\nimport { useDebugValue } from 'react';\nimport useSyncExternalStoreExports from 'use-sync-external-store/shim/with-selector.js';\n\nconst { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;\nfunction useStore(api, selector = api.getState, equalityFn) {\n const slice = useSyncExternalStoreWithSelector(\n api.subscribe,\n api.getState,\n api.getServerState || api.getState,\n selector,\n equalityFn\n );\n useDebugValue(slice);\n return slice;\n}\nconst createImpl = (createState) => {\n if ((import.meta.env && import.meta.env.MODE) !== \"production\" && typeof createState !== \"function\") {\n console.warn(\n \"[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.\"\n );\n }\n const api = typeof createState === \"function\" ? createStore(createState) : createState;\n const useBoundStore = (selector, equalityFn) => useStore(api, selector, equalityFn);\n Object.assign(useBoundStore, api);\n return useBoundStore;\n};\nconst create = (createState) => createState ? createImpl(createState) : createImpl;\nvar react = (createState) => {\n if ((import.meta.env && import.meta.env.MODE) !== \"production\") {\n console.warn(\n \"[DEPRECATED] Default export is deprecated. Instead use `import { create } from 'zustand'`.\"\n );\n }\n return create(createState);\n};\n\nexport { create, react as default, useStore };\n","const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\") ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const destroy = () => {\n if ((import.meta.env && import.meta.env.MODE) !== \"production\") {\n console.warn(\n \"[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.\"\n );\n }\n listeners.clear();\n };\n const api = { setState, getState, subscribe, destroy };\n state = createState(setState, getState, api);\n return api;\n};\nconst createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;\nvar vanilla = (createState) => {\n if ((import.meta.env && import.meta.env.MODE) !== \"production\") {\n console.warn(\n \"[DEPRECATED] Default export is deprecated. Instead use import { createStore } from 'zustand/vanilla'.\"\n );\n }\n return createStore(createState);\n};\n\nexport { createStore, vanilla as default };\n","function shallow(objA, objB) {\n if (Object.is(objA, objB)) {\n return true;\n }\n if (typeof objA !== \"object\" || objA === null || typeof objB !== \"object\" || objB === null) {\n return false;\n }\n if (objA instanceof Map && objB instanceof Map) {\n if (objA.size !== objB.size)\n return false;\n for (const [key, value] of objA) {\n if (!Object.is(value, objB.get(key))) {\n return false;\n }\n }\n return true;\n }\n if (objA instanceof Set && objB instanceof Set) {\n if (objA.size !== objB.size)\n return false;\n for (const value of objA) {\n if (!objB.has(value)) {\n return false;\n }\n }\n return true;\n }\n const keysA = Object.keys(objA);\n if (keysA.length !== Object.keys(objB).length) {\n return false;\n }\n for (let i = 0; i < keysA.length; i++) {\n if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !Object.is(objA[keysA[i]], objB[keysA[i]])) {\n return false;\n }\n }\n return true;\n}\nvar shallow$1 = (objA, objB) => {\n if ((import.meta.env && import.meta.env.MODE) !== \"production\") {\n console.warn(\n \"[DEPRECATED] Default export is deprecated. Instead use `import { shallow } from 'zustand/shallow'`.\"\n );\n }\n return shallow(objA, objB);\n};\n\nexport { shallow$1 as default, shallow };\n","var noop = {value: () => {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _) || /[\\s.]/.test(t)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n}\n\nfunction Dispatch(_) {\n this._ = _;\n}\n\nfunction parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return {type: t, name: name};\n });\n}\n\nDispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._,\n T = parseTypenames(typename + \"\", _),\n t,\n i = -1,\n n = T.length;\n\n // If no callback was specified, return the callback of the given type and name.\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n\n // If a type was specified, set the callback for the given type and name.\n // Otherwise, if a null callback was specified, remove callbacks of the given name.\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n};\n\nfunction get(type, name) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name) {\n return c.value;\n }\n }\n}\n\nfunction set(type, name, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({name: name, value: callback});\n return type;\n}\n\nexport default dispatch;\n","function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n","function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n","import {Selection} from \"./index.js\";\nimport array from \"../array.js\";\nimport selectorAll from \"../selectorAll.js\";\n\nfunction arrayAll(select) {\n return function() {\n return array(select.apply(this, arguments));\n };\n}\n\nexport default function(select) {\n if (typeof select === \"function\") select = arrayAll(select);\n else select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n","// Given something array like (or null), returns something that is strictly an\n// array. This is used to ensure that array-like objects passed to d3.selectAll\n// or selection.selectAll are converted into proper arrays when creating a\n// selection; we don’t ever want to create a selection backed by a live\n// HTMLCollection or NodeList. However, note that selection.selectAll will use a\n// static NodeList as a group, since it safely derived from querySelectorAll.\nexport default function array(x) {\n return x == null ? [] : Array.isArray(x) ? x : Array.from(x);\n}\n","export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n\nexport function childMatcher(selector) {\n return function(node) {\n return node.matches(selector);\n };\n}\n\n","import {childMatcher} from \"../matcher.js\";\n\nvar find = Array.prototype.find;\n\nfunction childFind(match) {\n return function() {\n return find.call(this.children, match);\n };\n}\n\nfunction childFirst() {\n return this.firstElementChild;\n}\n\nexport default function(match) {\n return this.select(match == null ? childFirst\n : childFind(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","import {childMatcher} from \"../matcher.js\";\n\nvar filter = Array.prototype.filter;\n\nfunction children() {\n return Array.from(this.children);\n}\n\nfunction childrenFilter(match) {\n return function() {\n return filter.call(this.children, match);\n };\n}\n\nexport default function(match) {\n return this.selectAll(match == null ? children\n : childrenFilter(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","export default function(update) {\n return new Array(update.length);\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n","import {Selection} from \"./index.js\";\nimport {EnterNode} from \"./enter.js\";\nimport constant from \"../constant.js\";\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don’t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = new Map,\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + \"\";\n if (nodeByKeyValue.has(keyValue)) {\n exit[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = key.call(parent, data[i], i, data) + \"\";\n if (node = nodeByKeyValue.get(keyValue)) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue.delete(keyValue);\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {\n exit[i] = node;\n }\n }\n}\n\nfunction datum(node) {\n return node.__data__;\n}\n\nexport default function(value, key) {\n if (!arguments.length) return Array.from(this, datum);\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = arraylike(value.call(parent, parent && parent.__data__, j, parents)),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n\n// Given some data, this returns an array-like view of it: an object that\n// exposes a length property and allows numeric indexing. Note that unlike\n// selectAll, this isn’t worried about “live” collections because the resulting\n// array will only be used briefly while data is being bound. (It is possible to\n// cause the data to change while iterating by using a key function, but please\n// don’t; we’d rather avoid a gratuitous copy.)\nfunction arraylike(data) {\n return typeof data === \"object\" && \"length\" in data\n ? data // Array, TypedArray, NodeList, array-like\n : Array.from(data); // Map, Set, iterable, string, or anything else\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n","import namespaces from \"./namespaces.js\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins\n}\n","import namespace from \"../namespace.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n","export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n","import defaultView from \"../window.js\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n","function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n","function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n","function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n","function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n","function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n","function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n","import namespace from \"./namespace.js\";\nimport {xhtml} from \"./namespaces.js\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n","import creator from \"../creator.js\";\nimport selector from \"../selector.js\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n","function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n","function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n","function contextListener(listener) {\n return function(event) {\n listener.call(this, event, this.__data__);\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, options) {\n return function() {\n var on = this.__on, o, listener = contextListener(value);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n this.addEventListener(o.type, o.listener = listener, o.options = options);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, options);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, options) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));\n return this;\n}\n","import defaultView from \"../window.js\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n","import _typeof from \"./typeof.js\";\nexport default function _regeneratorRuntime() {\n \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */\n _regeneratorRuntime = function _regeneratorRuntime() {\n return exports;\n };\n var exports = {},\n Op = Object.prototype,\n hasOwn = Op.hasOwnProperty,\n defineProperty = Object.defineProperty || function (obj, key, desc) {\n obj[key] = desc.value;\n },\n $Symbol = \"function\" == typeof Symbol ? Symbol : {},\n iteratorSymbol = $Symbol.iterator || \"@@iterator\",\n asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\",\n toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n function define(obj, key, value) {\n return Object.defineProperty(obj, key, {\n value: value,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }), obj[key];\n }\n try {\n define({}, \"\");\n } catch (err) {\n define = function define(obj, key, value) {\n return obj[key] = value;\n };\n }\n function wrap(innerFn, outerFn, self, tryLocsList) {\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,\n generator = Object.create(protoGenerator.prototype),\n context = new Context(tryLocsList || []);\n return defineProperty(generator, \"_invoke\", {\n value: makeInvokeMethod(innerFn, self, context)\n }), generator;\n }\n function tryCatch(fn, obj, arg) {\n try {\n return {\n type: \"normal\",\n arg: fn.call(obj, arg)\n };\n } catch (err) {\n return {\n type: \"throw\",\n arg: err\n };\n }\n }\n exports.wrap = wrap;\n var ContinueSentinel = {};\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n var getProto = Object.getPrototypeOf,\n NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);\n var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function (method) {\n define(prototype, method, function (arg) {\n return this._invoke(method, arg);\n });\n });\n }\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (\"throw\" !== record.type) {\n var result = record.arg,\n value = result.value;\n return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) {\n invoke(\"next\", value, resolve, reject);\n }, function (err) {\n invoke(\"throw\", err, resolve, reject);\n }) : PromiseImpl.resolve(value).then(function (unwrapped) {\n result.value = unwrapped, resolve(result);\n }, function (error) {\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n reject(record.arg);\n }\n var previousPromise;\n defineProperty(this, \"_invoke\", {\n value: function value(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function (resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();\n }\n });\n }\n function makeInvokeMethod(innerFn, self, context) {\n var state = \"suspendedStart\";\n return function (method, arg) {\n if (\"executing\" === state) throw new Error(\"Generator is already running\");\n if (\"completed\" === state) {\n if (\"throw\" === method) throw arg;\n return doneResult();\n }\n for (context.method = method, context.arg = arg;;) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) {\n if (\"suspendedStart\" === state) throw state = \"completed\", context.arg;\n context.dispatchException(context.arg);\n } else \"return\" === context.method && context.abrupt(\"return\", context.arg);\n state = \"executing\";\n var record = tryCatch(innerFn, self, context);\n if (\"normal\" === record.type) {\n if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue;\n return {\n value: record.arg,\n done: context.done\n };\n }\n \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg);\n }\n };\n }\n function maybeInvokeDelegate(delegate, context) {\n var methodName = context.method,\n method = delegate.iterator[methodName];\n if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel;\n var record = tryCatch(method, delegate.iterator, context.arg);\n if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel;\n var info = record.arg;\n return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel);\n }\n function pushTryEntry(locs) {\n var entry = {\n tryLoc: locs[0]\n };\n 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);\n }\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\", delete record.arg, entry.completion = record;\n }\n function Context(tryLocsList) {\n this.tryEntries = [{\n tryLoc: \"root\"\n }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);\n }\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) return iteratorMethod.call(iterable);\n if (\"function\" == typeof iterable.next) return iterable;\n if (!isNaN(iterable.length)) {\n var i = -1,\n next = function next() {\n for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;\n return next.value = undefined, next.done = !0, next;\n };\n return next.next = next;\n }\n }\n return {\n next: doneResult\n };\n }\n function doneResult() {\n return {\n value: undefined,\n done: !0\n };\n }\n return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", {\n value: GeneratorFunctionPrototype,\n configurable: !0\n }), defineProperty(GeneratorFunctionPrototype, \"constructor\", {\n value: GeneratorFunction,\n configurable: !0\n }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) {\n var ctor = \"function\" == typeof genFun && genFun.constructor;\n return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name));\n }, exports.mark = function (genFun) {\n return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun;\n }, exports.awrap = function (arg) {\n return {\n __await: arg\n };\n }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n void 0 === PromiseImpl && (PromiseImpl = Promise);\n var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);\n return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {\n return result.done ? result.value : iter.next();\n });\n }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () {\n return this;\n }), define(Gp, \"toString\", function () {\n return \"[object Generator]\";\n }), exports.keys = function (val) {\n var object = Object(val),\n keys = [];\n for (var key in object) keys.push(key);\n return keys.reverse(), function next() {\n for (; keys.length;) {\n var key = keys.pop();\n if (key in object) return next.value = key, next.done = !1, next;\n }\n return next.done = !0, next;\n };\n }, exports.values = values, Context.prototype = {\n constructor: Context,\n reset: function reset(skipTempReset) {\n if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);\n },\n stop: function stop() {\n this.done = !0;\n var rootRecord = this.tryEntries[0].completion;\n if (\"throw\" === rootRecord.type) throw rootRecord.arg;\n return this.rval;\n },\n dispatchException: function dispatchException(exception) {\n if (this.done) throw exception;\n var context = this;\n function handle(loc, caught) {\n return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught;\n }\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i],\n record = entry.completion;\n if (\"root\" === entry.tryLoc) return handle(\"end\");\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\"),\n hasFinally = hasOwn.call(entry, \"finallyLoc\");\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);\n if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);\n } else {\n if (!hasFinally) throw new Error(\"try statement without catch or finally\");\n if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);\n }\n }\n }\n },\n abrupt: function abrupt(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);\n var record = finallyEntry ? finallyEntry.completion : {};\n return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);\n },\n complete: function complete(record, afterLoc) {\n if (\"throw\" === record.type) throw record.arg;\n return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;\n },\n finish: function finish(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;\n }\n },\n \"catch\": function _catch(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (\"throw\" === record.type) {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n throw new Error(\"illegal catch attempt\");\n },\n delegateYield: function delegateYield(iterable, resultName, nextLoc) {\n return this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel;\n }\n }, exports;\n}","export default function*() {\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) yield node;\n }\n }\n}\n","import selection_select from \"./select.js\";\nimport selection_selectAll from \"./selectAll.js\";\nimport selection_selectChild from \"./selectChild.js\";\nimport selection_selectChildren from \"./selectChildren.js\";\nimport selection_filter from \"./filter.js\";\nimport selection_data from \"./data.js\";\nimport selection_enter from \"./enter.js\";\nimport selection_exit from \"./exit.js\";\nimport selection_join from \"./join.js\";\nimport selection_merge from \"./merge.js\";\nimport selection_order from \"./order.js\";\nimport selection_sort from \"./sort.js\";\nimport selection_call from \"./call.js\";\nimport selection_nodes from \"./nodes.js\";\nimport selection_node from \"./node.js\";\nimport selection_size from \"./size.js\";\nimport selection_empty from \"./empty.js\";\nimport selection_each from \"./each.js\";\nimport selection_attr from \"./attr.js\";\nimport selection_style from \"./style.js\";\nimport selection_property from \"./property.js\";\nimport selection_classed from \"./classed.js\";\nimport selection_text from \"./text.js\";\nimport selection_html from \"./html.js\";\nimport selection_raise from \"./raise.js\";\nimport selection_lower from \"./lower.js\";\nimport selection_append from \"./append.js\";\nimport selection_insert from \"./insert.js\";\nimport selection_remove from \"./remove.js\";\nimport selection_clone from \"./clone.js\";\nimport selection_datum from \"./datum.js\";\nimport selection_on from \"./on.js\";\nimport selection_dispatch from \"./dispatch.js\";\nimport selection_iterator from \"./iterator.js\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nfunction selection_selection() {\n return this;\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n selectChild: selection_selectChild,\n selectChildren: selection_selectChildren,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n selection: selection_selection,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch,\n [Symbol.iterator]: selection_iterator\n};\n\nexport default selection;\n","import {Selection} from \"./index.js\";\nimport selector from \"../selector.js\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","import {Selection} from \"./index.js\";\nimport matcher from \"../matcher.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n","export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n if (typeof onenter === \"function\") {\n enter = onenter(enter);\n if (enter) enter = enter.selection();\n } else {\n enter = enter.append(onenter + \"\");\n }\n if (onupdate != null) {\n update = onupdate(update);\n if (update) update = update.selection();\n }\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(context) {\n var selection = context.selection ? context.selection() : context;\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n","export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n","export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n","export default function() {\n let size = 0;\n for (const node of this) ++size; // eslint-disable-line no-unused-vars\n return size;\n}\n","export default function() {\n return !this.node();\n}\n","export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n","import creator from \"../creator.js\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n","export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n","import {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n","import sourceEvent from \"./sourceEvent.js\";\n\nexport default function(event, node) {\n event = sourceEvent(event);\n if (node === undefined) node = event.currentTarget;\n if (node) {\n var svg = node.ownerSVGElement || node;\n if (svg.createSVGPoint) {\n var point = svg.createSVGPoint();\n point.x = event.clientX, point.y = event.clientY;\n point = point.matrixTransform(node.getScreenCTM().inverse());\n return [point.x, point.y];\n }\n if (node.getBoundingClientRect) {\n var rect = node.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n }\n }\n return [event.pageX, event.pageY];\n}\n","export default function(event) {\n let sourceEvent;\n while (sourceEvent = event.sourceEvent) event = sourceEvent;\n return event;\n}\n","// These are typically used in conjunction with noevent to ensure that we can\n// preventDefault on the event.\nexport const nonpassive = {passive: false};\nexport const nonpassivecapture = {capture: true, passive: false};\n\nexport function nopropagation(event) {\n event.stopImmediatePropagation();\n}\n\nexport default function(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n","import {select} from \"d3-selection\";\nimport noevent, {nonpassivecapture} from \"./noevent.js\";\n\nexport default function(view) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", noevent, nonpassivecapture);\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", noevent, nonpassivecapture);\n } else {\n root.__noselect = root.style.MozUserSelect;\n root.style.MozUserSelect = \"none\";\n }\n}\n\nexport function yesdrag(view, noclick) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", null);\n if (noclick) {\n selection.on(\"click.drag\", noevent, nonpassivecapture);\n setTimeout(function() { selection.on(\"click.drag\", null); }, 0);\n }\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", null);\n } else {\n root.style.MozUserSelect = root.__noselect;\n delete root.__noselect;\n }\n}\n","export default x => () => x;\n","export default function DragEvent(type, {\n sourceEvent,\n subject,\n target,\n identifier,\n active,\n x, y, dx, dy,\n dispatch\n}) {\n Object.defineProperties(this, {\n type: {value: type, enumerable: true, configurable: true},\n sourceEvent: {value: sourceEvent, enumerable: true, configurable: true},\n subject: {value: subject, enumerable: true, configurable: true},\n target: {value: target, enumerable: true, configurable: true},\n identifier: {value: identifier, enumerable: true, configurable: true},\n active: {value: active, enumerable: true, configurable: true},\n x: {value: x, enumerable: true, configurable: true},\n y: {value: y, enumerable: true, configurable: true},\n dx: {value: dx, enumerable: true, configurable: true},\n dy: {value: dy, enumerable: true, configurable: true},\n _: {value: dispatch}\n });\n}\n\nDragEvent.prototype.on = function() {\n var value = this._.on.apply(this._, arguments);\n return value === this._ ? this : value;\n};\n","import {dispatch} from \"d3-dispatch\";\nimport {select, pointer} from \"d3-selection\";\nimport nodrag, {yesdrag} from \"./nodrag.js\";\nimport noevent, {nonpassive, nonpassivecapture, nopropagation} from \"./noevent.js\";\nimport constant from \"./constant.js\";\nimport DragEvent from \"./event.js\";\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter(event) {\n return !event.ctrlKey && !event.button;\n}\n\nfunction defaultContainer() {\n return this.parentNode;\n}\n\nfunction defaultSubject(event, d) {\n return d == null ? {x: event.x, y: event.y} : d;\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\nexport default function() {\n var filter = defaultFilter,\n container = defaultContainer,\n subject = defaultSubject,\n touchable = defaultTouchable,\n gestures = {},\n listeners = dispatch(\"start\", \"drag\", \"end\"),\n active = 0,\n mousedownx,\n mousedowny,\n mousemoving,\n touchending,\n clickDistance2 = 0;\n\n function drag(selection) {\n selection\n .on(\"mousedown.drag\", mousedowned)\n .filter(touchable)\n .on(\"touchstart.drag\", touchstarted)\n .on(\"touchmove.drag\", touchmoved, nonpassive)\n .on(\"touchend.drag touchcancel.drag\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n function mousedowned(event, d) {\n if (touchending || !filter.call(this, event, d)) return;\n var gesture = beforestart(this, container.call(this, event, d), event, d, \"mouse\");\n if (!gesture) return;\n select(event.view)\n .on(\"mousemove.drag\", mousemoved, nonpassivecapture)\n .on(\"mouseup.drag\", mouseupped, nonpassivecapture);\n nodrag(event.view);\n nopropagation(event);\n mousemoving = false;\n mousedownx = event.clientX;\n mousedowny = event.clientY;\n gesture(\"start\", event);\n }\n\n function mousemoved(event) {\n noevent(event);\n if (!mousemoving) {\n var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;\n mousemoving = dx * dx + dy * dy > clickDistance2;\n }\n gestures.mouse(\"drag\", event);\n }\n\n function mouseupped(event) {\n select(event.view).on(\"mousemove.drag mouseup.drag\", null);\n yesdrag(event.view, mousemoving);\n noevent(event);\n gestures.mouse(\"end\", event);\n }\n\n function touchstarted(event, d) {\n if (!filter.call(this, event, d)) return;\n var touches = event.changedTouches,\n c = container.call(this, event, d),\n n = touches.length, i, gesture;\n\n for (i = 0; i < n; ++i) {\n if (gesture = beforestart(this, c, event, d, touches[i].identifier, touches[i])) {\n nopropagation(event);\n gesture(\"start\", event, touches[i]);\n }\n }\n }\n\n function touchmoved(event) {\n var touches = event.changedTouches,\n n = touches.length, i, gesture;\n\n for (i = 0; i < n; ++i) {\n if (gesture = gestures[touches[i].identifier]) {\n noevent(event);\n gesture(\"drag\", event, touches[i]);\n }\n }\n }\n\n function touchended(event) {\n var touches = event.changedTouches,\n n = touches.length, i, gesture;\n\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n for (i = 0; i < n; ++i) {\n if (gesture = gestures[touches[i].identifier]) {\n nopropagation(event);\n gesture(\"end\", event, touches[i]);\n }\n }\n }\n\n function beforestart(that, container, event, d, identifier, touch) {\n var dispatch = listeners.copy(),\n p = pointer(touch || event, container), dx, dy,\n s;\n\n if ((s = subject.call(that, new DragEvent(\"beforestart\", {\n sourceEvent: event,\n target: drag,\n identifier,\n active,\n x: p[0],\n y: p[1],\n dx: 0,\n dy: 0,\n dispatch\n }), d)) == null) return;\n\n dx = s.x - p[0] || 0;\n dy = s.y - p[1] || 0;\n\n return function gesture(type, event, touch) {\n var p0 = p, n;\n switch (type) {\n case \"start\": gestures[identifier] = gesture, n = active++; break;\n case \"end\": delete gestures[identifier], --active; // falls through\n case \"drag\": p = pointer(touch || event, container), n = active; break;\n }\n dispatch.call(\n type,\n that,\n new DragEvent(type, {\n sourceEvent: event,\n subject: s,\n target: drag,\n identifier,\n active: n,\n x: p[0] + dx,\n y: p[1] + dy,\n dx: p[0] - p0[0],\n dy: p[1] - p0[1],\n dispatch\n }),\n d\n );\n };\n }\n\n drag.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), drag) : filter;\n };\n\n drag.container = function(_) {\n return arguments.length ? (container = typeof _ === \"function\" ? _ : constant(_), drag) : container;\n };\n\n drag.subject = function(_) {\n return arguments.length ? (subject = typeof _ === \"function\" ? _ : constant(_), drag) : subject;\n };\n\n drag.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), drag) : touchable;\n };\n\n drag.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? drag : value;\n };\n\n drag.clickDistance = function(_) {\n return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);\n };\n\n return drag;\n}\n","var epsilon2 = 1e-12;\n\nfunction cosh(x) {\n return ((x = Math.exp(x)) + 1 / x) / 2;\n}\n\nfunction sinh(x) {\n return ((x = Math.exp(x)) - 1 / x) / 2;\n}\n\nfunction tanh(x) {\n return ((x = Math.exp(2 * x)) - 1) / (x + 1);\n}\n\nexport default (function zoomRho(rho, rho2, rho4) {\n\n // p0 = [ux0, uy0, w0]\n // p1 = [ux1, uy1, w1]\n function zoom(p0, p1) {\n var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],\n ux1 = p1[0], uy1 = p1[1], w1 = p1[2],\n dx = ux1 - ux0,\n dy = uy1 - uy0,\n d2 = dx * dx + dy * dy,\n i,\n S;\n\n // Special case for u0 ≅ u1.\n if (d2 < epsilon2) {\n S = Math.log(w1 / w0) / rho;\n i = function(t) {\n return [\n ux0 + t * dx,\n uy0 + t * dy,\n w0 * Math.exp(rho * t * S)\n ];\n }\n }\n\n // General case.\n else {\n var d1 = Math.sqrt(d2),\n b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),\n b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),\n r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),\n r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);\n S = (r1 - r0) / rho;\n i = function(t) {\n var s = t * S,\n coshr0 = cosh(r0),\n u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));\n return [\n ux0 + u * dx,\n uy0 + u * dy,\n w0 * coshr0 / cosh(rho * s + r0)\n ];\n }\n }\n\n i.duration = S * 1000 * rho / Math.SQRT2;\n\n return i;\n }\n\n zoom.rho = function(_) {\n var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;\n return zoomRho(_1, _2, _4);\n };\n\n return zoom;\n})(Math.SQRT2, 2, 4);\n","var frame = 0, // is an animation frame pending?\n timeout = 0, // is a timeout pending?\n interval = 0, // are any timers active?\n pokeDelay = 1000, // how frequently we check for clock skew\n taskHead,\n taskTail,\n clockLast = 0,\n clockNow = 0,\n clockSkew = 0,\n clock = typeof performance === \"object\" && performance.now ? performance : Date,\n setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };\n\nexport function now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n}\n\nfunction clearNow() {\n clockNow = 0;\n}\n\nexport function Timer() {\n this._call =\n this._time =\n this._next = null;\n}\n\nTimer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n};\n\nexport function timer(callback, delay, time) {\n var t = new Timer;\n t.restart(callback, delay, time);\n return t;\n}\n\nexport function timerFlush() {\n now(); // Get the current time, if not already set.\n ++frame; // Pretend we’ve set an alarm, if we haven’t already.\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);\n t = t._next;\n }\n --frame;\n}\n\nfunction wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n}\n\nfunction poke() {\n var now = clock.now(), delay = now - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now;\n}\n\nfunction nap() {\n var t0, t1 = taskHead, t2, time = Infinity;\n while (t1) {\n if (t1._call) {\n if (time > t1._time) time = t1._time;\n t0 = t1, t1 = t1._next;\n } else {\n t2 = t1._next, t1._next = null;\n t1 = t0 ? t0._next = t2 : taskHead = t2;\n }\n }\n taskTail = t0;\n sleep(time);\n}\n\nfunction sleep(time) {\n if (frame) return; // Soonest alarm already set, or will be.\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow; // Strictly less than if we recomputed clockNow.\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n}\n","import {Timer} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(elapsed => {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {timer, timeout} from \"d3-timer\";\n\nvar emptyOn = dispatch(\"start\", \"end\", \"cancel\", \"interrupt\");\nvar emptyTween = [];\n\nexport var CREATED = 0;\nexport var SCHEDULED = 1;\nexport var STARTING = 2;\nexport var STARTED = 3;\nexport var RUNNING = 4;\nexport var ENDING = 5;\nexport var ENDED = 6;\n\nexport default function(node, name, id, index, group, timing) {\n var schedules = node.__transition;\n if (!schedules) node.__transition = {};\n else if (id in schedules) return;\n create(node, id, {\n name: name,\n index: index, // For context during callback.\n group: group, // For context during callback.\n on: emptyOn,\n tween: emptyTween,\n time: timing.time,\n delay: timing.delay,\n duration: timing.duration,\n ease: timing.ease,\n timer: null,\n state: CREATED\n });\n}\n\nexport function init(node, id) {\n var schedule = get(node, id);\n if (schedule.state > CREATED) throw new Error(\"too late; already scheduled\");\n return schedule;\n}\n\nexport function set(node, id) {\n var schedule = get(node, id);\n if (schedule.state > STARTED) throw new Error(\"too late; already running\");\n return schedule;\n}\n\nexport function get(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id])) throw new Error(\"transition not found\");\n return schedule;\n}\n\nfunction create(node, id, self) {\n var schedules = node.__transition,\n tween;\n\n // Initialize the self timer when the transition is created.\n // Note the actual delay is not known until the first callback!\n schedules[id] = self;\n self.timer = timer(schedule, 0, self.time);\n\n function schedule(elapsed) {\n self.state = SCHEDULED;\n self.timer.restart(start, self.delay, self.time);\n\n // If the elapsed delay is less than our first sleep, start immediately.\n if (self.delay <= elapsed) start(elapsed - self.delay);\n }\n\n function start(elapsed) {\n var i, j, n, o;\n\n // If the state is not SCHEDULED, then we previously errored on start.\n if (self.state !== SCHEDULED) return stop();\n\n for (i in schedules) {\n o = schedules[i];\n if (o.name !== self.name) continue;\n\n // While this element already has a starting transition during this frame,\n // defer starting an interrupting transition until that transition has a\n // chance to tick (and possibly end); see d3/d3-transition#54!\n if (o.state === STARTED) return timeout(start);\n\n // Interrupt the active transition, if any.\n if (o.state === RUNNING) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"interrupt\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n\n // Cancel any pre-empted transitions.\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"cancel\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n }\n\n // Defer the first tick to end of the current frame; see d3/d3#1576.\n // Note the transition may be canceled after start and before the first tick!\n // Note this must be scheduled before the start event; see d3/d3-transition#16!\n // Assuming this is successful, subsequent callbacks go straight to tick.\n timeout(function() {\n if (self.state === STARTED) {\n self.state = RUNNING;\n self.timer.restart(tick, self.delay, self.time);\n tick(elapsed);\n }\n });\n\n // Dispatch the start event.\n // Note this must be done before the tween are initialized.\n self.state = STARTING;\n self.on.call(\"start\", node, node.__data__, self.index, self.group);\n if (self.state !== STARTING) return; // interrupted\n self.state = STARTED;\n\n // Initialize the tween, deleting null tween.\n tween = new Array(n = self.tween.length);\n for (i = 0, j = -1; i < n; ++i) {\n if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {\n tween[++j] = o;\n }\n }\n tween.length = j + 1;\n }\n\n function tick(elapsed) {\n var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),\n i = -1,\n n = tween.length;\n\n while (++i < n) {\n tween[i].call(node, t);\n }\n\n // Dispatch the end event.\n if (self.state === ENDING) {\n self.on.call(\"end\", node, node.__data__, self.index, self.group);\n stop();\n }\n }\n\n function stop() {\n self.state = ENDED;\n self.timer.stop();\n delete schedules[id];\n for (var i in schedules) return; // eslint-disable-line no-unused-vars\n delete node.__transition;\n }\n}\n","import {STARTING, ENDING, ENDED} from \"./transition/schedule.js\";\n\nexport default function(node, name) {\n var schedules = node.__transition,\n schedule,\n active,\n empty = true,\n i;\n\n if (!schedules) return;\n\n name = name == null ? null : name + \"\";\n\n for (i in schedules) {\n if ((schedule = schedules[i]).name !== name) { empty = false; continue; }\n active = schedule.state > STARTING && schedule.state < ENDING;\n schedule.state = ENDED;\n schedule.timer.stop();\n schedule.on.call(active ? \"interrupt\" : \"cancel\", node, node.__data__, schedule.index, schedule.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n","var degrees = 180 / Math.PI;\n\nexport var identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nexport default function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\n","import decompose, {identity} from \"./decompose.js\";\n\nvar svgNode;\n\n/* eslint-disable no-undef */\nexport function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);\n}\n\nexport function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n","import number from \"../number.js\";\nimport {parseCss, parseSvg} from \"./parse.js\";\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nexport var interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nexport var interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n","import {get, set} from \"./schedule.js\";\n\nfunction tweenRemove(id, name) {\n var tween0, tween1;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = tween0 = tween;\n for (var i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1 = tween1.slice();\n tween1.splice(i, 1);\n break;\n }\n }\n }\n\n schedule.tween = tween1;\n };\n}\n\nfunction tweenFunction(id, name, value) {\n var tween0, tween1;\n if (typeof value !== \"function\") throw new Error;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = (tween0 = tween).slice();\n for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1[i] = t;\n break;\n }\n }\n if (i === n) tween1.push(t);\n }\n\n schedule.tween = tween1;\n };\n}\n\nexport default function(name, value) {\n var id = this._id;\n\n name += \"\";\n\n if (arguments.length < 2) {\n var tween = get(this.node(), id).tween;\n for (var i = 0, n = tween.length, t; i < n; ++i) {\n if ((t = tween[i]).name === name) {\n return t.value;\n }\n }\n return null;\n }\n\n return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));\n}\n\nexport function tweenValue(transition, name, value) {\n var id = transition._id;\n\n transition.each(function() {\n var schedule = set(this, id);\n (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);\n });\n\n return function(node) {\n return get(node, id).value[name];\n };\n}\n","export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n","import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(`^rgb\\\\(${reI},${reI},${reI}\\\\)$`),\n reRgbPercent = new RegExp(`^rgb\\\\(${reP},${reP},${reP}\\\\)$`),\n reRgbaInteger = new RegExp(`^rgba\\\\(${reI},${reI},${reI},${reN}\\\\)$`),\n reRgbaPercent = new RegExp(`^rgba\\\\(${reP},${reP},${reP},${reN}\\\\)$`),\n reHslPercent = new RegExp(`^hsl\\\\(${reN},${reP},${reP}\\\\)$`),\n reHslaPercent = new RegExp(`^hsla\\\\(${reN},${reP},${reP},${reN}\\\\)$`);\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHex8: color_formatHex8,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHex8() {\n return this.rgb().formatHex8();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb() {\n return this;\n },\n clamp() {\n return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));\n },\n displayable() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatHex8: rgb_formatHex8,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;\n}\n\nfunction rgb_formatHex8() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;\n}\n\nfunction rgb_formatRgb() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"rgb(\" : \"rgba(\"}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? \")\" : `, ${a})`}`;\n}\n\nfunction clampa(opacity) {\n return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));\n}\n\nfunction clampi(value) {\n return Math.max(0, Math.min(255, Math.round(value) || 0));\n}\n\nfunction hex(value) {\n value = clampi(value);\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n clamp() {\n return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));\n },\n displayable() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"hsl(\" : \"hsla(\"}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? \")\" : `, ${a})`}`;\n }\n}));\n\nfunction clamph(value) {\n value = (value || 0) % 360;\n return value < 0 ? value + 360 : value;\n}\n\nfunction clampt(value) {\n return Math.max(0, Math.min(1, value || 0));\n}\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n","export function basis(t1, v0, v1, v2, v3) {\n var t2 = t1 * t1, t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n}\n\nexport default function(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),\n v1 = values[i],\n v2 = values[i + 1],\n v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,\n v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","export default x => () => x;\n","import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n","import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n","import {basis} from \"./basis.js\";\n\nexport default function(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),\n v0 = values[(i + n - 1) % n],\n v1 = values[i % n],\n v2 = values[(i + 1) % n],\n v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n","import {color} from \"d3-color\";\nimport {interpolateNumber, interpolateRgb, interpolateString} from \"d3-interpolate\";\n\nexport default function(a, b) {\n var c;\n return (typeof b === \"number\" ? interpolateNumber\n : b instanceof color ? interpolateRgb\n : (c = color(b)) ? (b = c, interpolateRgb)\n : interpolateString)(a, b);\n}\n","import {interpolateTransformSvg as interpolateTransform} from \"d3-interpolate\";\nimport {namespace} from \"d3-selection\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttribute(name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrConstantNS(fullname, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttributeNS(fullname.space, fullname.local);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttribute(name);\n string0 = this.getAttribute(name);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction attrFunctionNS(fullname, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n string0 = this.getAttributeNS(fullname.space, fullname.local);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name), i = fullname === \"transform\" ? interpolateTransform : interpolate;\n return this.attrTween(name, typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, \"attr.\" + name, value))\n : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)\n : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));\n}\n","import {namespace} from \"d3-selection\";\n\nfunction attrInterpolate(name, i) {\n return function(t) {\n this.setAttribute(name, i.call(this, t));\n };\n}\n\nfunction attrInterpolateNS(fullname, i) {\n return function(t) {\n this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));\n };\n}\n\nfunction attrTweenNS(fullname, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value) {\n var key = \"attr.\" + name;\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n var fullname = namespace(name);\n return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));\n}\n","import {get, init} from \"./schedule.js\";\n\nfunction delayFunction(id, value) {\n return function() {\n init(this, id).delay = +value.apply(this, arguments);\n };\n}\n\nfunction delayConstant(id, value) {\n return value = +value, function() {\n init(this, id).delay = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? delayFunction\n : delayConstant)(id, value))\n : get(this.node(), id).delay;\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction durationFunction(id, value) {\n return function() {\n set(this, id).duration = +value.apply(this, arguments);\n };\n}\n\nfunction durationConstant(id, value) {\n return value = +value, function() {\n set(this, id).duration = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? durationFunction\n : durationConstant)(id, value))\n : get(this.node(), id).duration;\n}\n","import {selection} from \"d3-selection\";\n\nvar Selection = selection.prototype.constructor;\n\nexport default function() {\n return new Selection(this._groups, this._parents);\n}\n","import {interpolateTransformCss as interpolateTransform} from \"d3-interpolate\";\nimport {style} from \"d3-selection\";\nimport {set} from \"./schedule.js\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction styleNull(name, interpolate) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n string1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, string10 = string1);\n };\n}\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = style(this, name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction styleFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n value1 = value(this),\n string1 = value1 + \"\";\n if (value1 == null) string1 = value1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction styleMaybeRemove(id, name) {\n var on0, on1, listener0, key = \"style.\" + name, event = \"end.\" + key, remove;\n return function() {\n var schedule = set(this, id),\n on = schedule.on,\n listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransform : interpolate;\n return value == null ? this\n .styleTween(name, styleNull(name, i))\n .on(\"end.style.\" + name, styleRemove(name))\n : typeof value === \"function\" ? this\n .styleTween(name, styleFunction(name, i, tweenValue(this, \"style.\" + name, value)))\n .each(styleMaybeRemove(this._id, name))\n : this\n .styleTween(name, styleConstant(name, i, value), priority)\n .on(\"end.style.\" + name, null);\n}\n","import {selection} from \"d3-selection\";\nimport transition_attr from \"./attr.js\";\nimport transition_attrTween from \"./attrTween.js\";\nimport transition_delay from \"./delay.js\";\nimport transition_duration from \"./duration.js\";\nimport transition_ease from \"./ease.js\";\nimport transition_easeVarying from \"./easeVarying.js\";\nimport transition_filter from \"./filter.js\";\nimport transition_merge from \"./merge.js\";\nimport transition_on from \"./on.js\";\nimport transition_remove from \"./remove.js\";\nimport transition_select from \"./select.js\";\nimport transition_selectAll from \"./selectAll.js\";\nimport transition_selection from \"./selection.js\";\nimport transition_style from \"./style.js\";\nimport transition_styleTween from \"./styleTween.js\";\nimport transition_text from \"./text.js\";\nimport transition_textTween from \"./textTween.js\";\nimport transition_transition from \"./transition.js\";\nimport transition_tween from \"./tween.js\";\nimport transition_end from \"./end.js\";\n\nvar id = 0;\n\nexport function Transition(groups, parents, name, id) {\n this._groups = groups;\n this._parents = parents;\n this._name = name;\n this._id = id;\n}\n\nexport default function transition(name) {\n return selection().transition(name);\n}\n\nexport function newId() {\n return ++id;\n}\n\nvar selection_prototype = selection.prototype;\n\nTransition.prototype = transition.prototype = {\n constructor: Transition,\n select: transition_select,\n selectAll: transition_selectAll,\n selectChild: selection_prototype.selectChild,\n selectChildren: selection_prototype.selectChildren,\n filter: transition_filter,\n merge: transition_merge,\n selection: transition_selection,\n transition: transition_transition,\n call: selection_prototype.call,\n nodes: selection_prototype.nodes,\n node: selection_prototype.node,\n size: selection_prototype.size,\n empty: selection_prototype.empty,\n each: selection_prototype.each,\n on: transition_on,\n attr: transition_attr,\n attrTween: transition_attrTween,\n style: transition_style,\n styleTween: transition_styleTween,\n text: transition_text,\n textTween: transition_textTween,\n remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease,\n easeVarying: transition_easeVarying,\n end: transition_end,\n [Symbol.iterator]: selection_prototype[Symbol.iterator]\n};\n","import {selector} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n schedule(subgroup[i], name, id, i, subgroup, get(node, id));\n }\n }\n }\n\n return new Transition(subgroups, this._parents, name, id);\n}\n","import {selectorAll} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {\n if (child = children[k]) {\n schedule(child, name, id, k, children, inherit);\n }\n }\n subgroups.push(children);\n parents.push(node);\n }\n }\n }\n\n return new Transition(subgroups, parents, name, id);\n}\n","import {matcher} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Transition(subgroups, this._parents, this._name, this._id);\n}\n","import {Transition} from \"./index.js\";\n\nexport default function(transition) {\n if (transition._id !== this._id) throw new Error;\n\n for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Transition(merges, this._parents, this._name, this._id);\n}\n","import {Transition, newId} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function() {\n var name = this._name,\n id0 = this._id,\n id1 = newId();\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n var inherit = get(node, id0);\n schedule(node, name, id1, i, group, {\n time: inherit.time + inherit.delay + inherit.duration,\n delay: 0,\n duration: inherit.duration,\n ease: inherit.ease\n });\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id1);\n}\n","import {get, set, init} from \"./schedule.js\";\n\nfunction start(name) {\n return (name + \"\").trim().split(/^|\\s+/).every(function(t) {\n var i = t.indexOf(\".\");\n if (i >= 0) t = t.slice(0, i);\n return !t || t === \"start\";\n });\n}\n\nfunction onFunction(id, name, listener) {\n var on0, on1, sit = start(name) ? init : set;\n return function() {\n var schedule = sit(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, listener) {\n var id = this._id;\n\n return arguments.length < 2\n ? get(this.node(), id).on.on(name)\n : this.each(onFunction(id, name, listener));\n}\n","function styleInterpolate(name, i, priority) {\n return function(t) {\n this.style.setProperty(name, i.call(this, t), priority);\n };\n}\n\nfunction styleTween(name, value, priority) {\n var t, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);\n return t;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value, priority) {\n var key = \"style.\" + (name += \"\");\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, styleTween(name, value, priority == null ? \"\" : priority));\n}\n","import {tweenValue} from \"./tween.js\";\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var value1 = value(this);\n this.textContent = value1 == null ? \"\" : value1;\n };\n}\n\nexport default function(value) {\n return this.tween(\"text\", typeof value === \"function\"\n ? textFunction(tweenValue(this, \"text\", value))\n : textConstant(value == null ? \"\" : value + \"\"));\n}\n","function textInterpolate(i) {\n return function(t) {\n this.textContent = i.call(this, t);\n };\n}\n\nfunction textTween(value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && textInterpolate(i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(value) {\n var key = \"text\";\n if (arguments.length < 1) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, textTween(value));\n}\n","function removeFunction(id) {\n return function() {\n var parent = this.parentNode;\n for (var i in this.__transition) if (+i !== id) return;\n if (parent) parent.removeChild(this);\n };\n}\n\nexport default function() {\n return this.on(\"end.remove\", removeFunction(this._id));\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction easeConstant(id, value) {\n if (typeof value !== \"function\") throw new Error;\n return function() {\n set(this, id).ease = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each(easeConstant(id, value))\n : get(this.node(), id).ease;\n}\n","import {set} from \"./schedule.js\";\n\nfunction easeVarying(id, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (typeof v !== \"function\") throw new Error;\n set(this, id).ease = v;\n };\n}\n\nexport default function(value) {\n if (typeof value !== \"function\") throw new Error;\n return this.each(easeVarying(this._id, value));\n}\n","import {set} from \"./schedule.js\";\n\nexport default function() {\n var on0, on1, that = this, id = that._id, size = that.size();\n return new Promise(function(resolve, reject) {\n var cancel = {value: reject},\n end = {value: function() { if (--size === 0) resolve(); }};\n\n that.each(function() {\n var schedule = set(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) {\n on1 = (on0 = on).copy();\n on1._.cancel.push(cancel);\n on1._.interrupt.push(cancel);\n on1._.end.push(end);\n }\n\n schedule.on = on1;\n });\n\n // The selection was empty, resolve end immediately\n if (size === 0) resolve();\n });\n}\n","import {Transition, newId} from \"../transition/index.js\";\nimport schedule from \"../transition/schedule.js\";\nimport {easeCubicInOut} from \"d3-ease\";\nimport {now} from \"d3-timer\";\n\nvar defaultTiming = {\n time: null, // Set on use.\n delay: 0,\n duration: 250,\n ease: easeCubicInOut\n};\n\nfunction inherit(node, id) {\n var timing;\n while (!(timing = node.__transition) || !(timing = timing[id])) {\n if (!(node = node.parentNode)) {\n throw new Error(`transition ${id} not found`);\n }\n }\n return timing;\n}\n\nexport default function(name) {\n var id,\n timing;\n\n if (name instanceof Transition) {\n id = name._id, name = name._name;\n } else {\n id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + \"\";\n }\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n schedule(node, name, id, i, group, timing || inherit(node, id));\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id);\n}\n","export function cubicIn(t) {\n return t * t * t;\n}\n\nexport function cubicOut(t) {\n return --t * t * t + 1;\n}\n\nexport function cubicInOut(t) {\n return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\n}\n","import {selection} from \"d3-selection\";\nimport selection_interrupt from \"./interrupt.js\";\nimport selection_transition from \"./transition.js\";\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n","import interrupt from \"../interrupt.js\";\n\nexport default function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n}\n","export default x => () => x;\n","export default function ZoomEvent(type, {\n sourceEvent,\n target,\n transform,\n dispatch\n}) {\n Object.defineProperties(this, {\n type: {value: type, enumerable: true, configurable: true},\n sourceEvent: {value: sourceEvent, enumerable: true, configurable: true},\n target: {value: target, enumerable: true, configurable: true},\n transform: {value: transform, enumerable: true, configurable: true},\n _: {value: dispatch}\n });\n}\n","export function Transform(k, x, y) {\n this.k = k;\n this.x = x;\n this.y = y;\n}\n\nTransform.prototype = {\n constructor: Transform,\n scale: function(k) {\n return k === 1 ? this : new Transform(this.k * k, this.x, this.y);\n },\n translate: function(x, y) {\n return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);\n },\n apply: function(point) {\n return [point[0] * this.k + this.x, point[1] * this.k + this.y];\n },\n applyX: function(x) {\n return x * this.k + this.x;\n },\n applyY: function(y) {\n return y * this.k + this.y;\n },\n invert: function(location) {\n return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];\n },\n invertX: function(x) {\n return (x - this.x) / this.k;\n },\n invertY: function(y) {\n return (y - this.y) / this.k;\n },\n rescaleX: function(x) {\n return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));\n },\n rescaleY: function(y) {\n return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));\n },\n toString: function() {\n return \"translate(\" + this.x + \",\" + this.y + \") scale(\" + this.k + \")\";\n }\n};\n\nexport var identity = new Transform(1, 0, 0);\n\ntransform.prototype = Transform.prototype;\n\nexport default function transform(node) {\n while (!node.__zoom) if (!(node = node.parentNode)) return identity;\n return node.__zoom;\n}\n","export function nopropagation(event) {\n event.stopImmediatePropagation();\n}\n\nexport default function(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {dragDisable, dragEnable} from \"d3-drag\";\nimport {interpolateZoom} from \"d3-interpolate\";\nimport {select, pointer} from \"d3-selection\";\nimport {interrupt} from \"d3-transition\";\nimport constant from \"./constant.js\";\nimport ZoomEvent from \"./event.js\";\nimport {Transform, identity} from \"./transform.js\";\nimport noevent, {nopropagation} from \"./noevent.js\";\n\n// Ignore right-click, since that should open the context menu.\n// except for pinch-to-zoom, which is sent as a wheel+ctrlKey event\nfunction defaultFilter(event) {\n return (!event.ctrlKey || event.type === 'wheel') && !event.button;\n}\n\nfunction defaultExtent() {\n var e = this;\n if (e instanceof SVGElement) {\n e = e.ownerSVGElement || e;\n if (e.hasAttribute(\"viewBox\")) {\n e = e.viewBox.baseVal;\n return [[e.x, e.y], [e.x + e.width, e.y + e.height]];\n }\n return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];\n }\n return [[0, 0], [e.clientWidth, e.clientHeight]];\n}\n\nfunction defaultTransform() {\n return this.__zoom || identity;\n}\n\nfunction defaultWheelDelta(event) {\n return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002) * (event.ctrlKey ? 10 : 1);\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\nfunction defaultConstrain(transform, extent, translateExtent) {\n var dx0 = transform.invertX(extent[0][0]) - translateExtent[0][0],\n dx1 = transform.invertX(extent[1][0]) - translateExtent[1][0],\n dy0 = transform.invertY(extent[0][1]) - translateExtent[0][1],\n dy1 = transform.invertY(extent[1][1]) - translateExtent[1][1];\n return transform.translate(\n dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),\n dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)\n );\n}\n\nexport default function() {\n var filter = defaultFilter,\n extent = defaultExtent,\n constrain = defaultConstrain,\n wheelDelta = defaultWheelDelta,\n touchable = defaultTouchable,\n scaleExtent = [0, Infinity],\n translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]],\n duration = 250,\n interpolate = interpolateZoom,\n listeners = dispatch(\"start\", \"zoom\", \"end\"),\n touchstarting,\n touchfirst,\n touchending,\n touchDelay = 500,\n wheelDelay = 150,\n clickDistance2 = 0,\n tapDistance = 10;\n\n function zoom(selection) {\n selection\n .property(\"__zoom\", defaultTransform)\n .on(\"wheel.zoom\", wheeled, {passive: false})\n .on(\"mousedown.zoom\", mousedowned)\n .on(\"dblclick.zoom\", dblclicked)\n .filter(touchable)\n .on(\"touchstart.zoom\", touchstarted)\n .on(\"touchmove.zoom\", touchmoved)\n .on(\"touchend.zoom touchcancel.zoom\", touchended)\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n zoom.transform = function(collection, transform, point, event) {\n var selection = collection.selection ? collection.selection() : collection;\n selection.property(\"__zoom\", defaultTransform);\n if (collection !== selection) {\n schedule(collection, transform, point, event);\n } else {\n selection.interrupt().each(function() {\n gesture(this, arguments)\n .event(event)\n .start()\n .zoom(null, typeof transform === \"function\" ? transform.apply(this, arguments) : transform)\n .end();\n });\n }\n };\n\n zoom.scaleBy = function(selection, k, p, event) {\n zoom.scaleTo(selection, function() {\n var k0 = this.__zoom.k,\n k1 = typeof k === \"function\" ? k.apply(this, arguments) : k;\n return k0 * k1;\n }, p, event);\n };\n\n zoom.scaleTo = function(selection, k, p, event) {\n zoom.transform(selection, function() {\n var e = extent.apply(this, arguments),\n t0 = this.__zoom,\n p0 = p == null ? centroid(e) : typeof p === \"function\" ? p.apply(this, arguments) : p,\n p1 = t0.invert(p0),\n k1 = typeof k === \"function\" ? k.apply(this, arguments) : k;\n return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);\n }, p, event);\n };\n\n zoom.translateBy = function(selection, x, y, event) {\n zoom.transform(selection, function() {\n return constrain(this.__zoom.translate(\n typeof x === \"function\" ? x.apply(this, arguments) : x,\n typeof y === \"function\" ? y.apply(this, arguments) : y\n ), extent.apply(this, arguments), translateExtent);\n }, null, event);\n };\n\n zoom.translateTo = function(selection, x, y, p, event) {\n zoom.transform(selection, function() {\n var e = extent.apply(this, arguments),\n t = this.__zoom,\n p0 = p == null ? centroid(e) : typeof p === \"function\" ? p.apply(this, arguments) : p;\n return constrain(identity.translate(p0[0], p0[1]).scale(t.k).translate(\n typeof x === \"function\" ? -x.apply(this, arguments) : -x,\n typeof y === \"function\" ? -y.apply(this, arguments) : -y\n ), e, translateExtent);\n }, p, event);\n };\n\n function scale(transform, k) {\n k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));\n return k === transform.k ? transform : new Transform(k, transform.x, transform.y);\n }\n\n function translate(transform, p0, p1) {\n var x = p0[0] - p1[0] * transform.k, y = p0[1] - p1[1] * transform.k;\n return x === transform.x && y === transform.y ? transform : new Transform(transform.k, x, y);\n }\n\n function centroid(extent) {\n return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];\n }\n\n function schedule(transition, transform, point, event) {\n transition\n .on(\"start.zoom\", function() { gesture(this, arguments).event(event).start(); })\n .on(\"interrupt.zoom end.zoom\", function() { gesture(this, arguments).event(event).end(); })\n .tween(\"zoom\", function() {\n var that = this,\n args = arguments,\n g = gesture(that, args).event(event),\n e = extent.apply(that, args),\n p = point == null ? centroid(e) : typeof point === \"function\" ? point.apply(that, args) : point,\n w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]),\n a = that.__zoom,\n b = typeof transform === \"function\" ? transform.apply(that, args) : transform,\n i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));\n return function(t) {\n if (t === 1) t = b; // Avoid rounding error on end.\n else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); }\n g.zoom(null, t);\n };\n });\n }\n\n function gesture(that, args, clean) {\n return (!clean && that.__zooming) || new Gesture(that, args);\n }\n\n function Gesture(that, args) {\n this.that = that;\n this.args = args;\n this.active = 0;\n this.sourceEvent = null;\n this.extent = extent.apply(that, args);\n this.taps = 0;\n }\n\n Gesture.prototype = {\n event: function(event) {\n if (event) this.sourceEvent = event;\n return this;\n },\n start: function() {\n if (++this.active === 1) {\n this.that.__zooming = this;\n this.emit(\"start\");\n }\n return this;\n },\n zoom: function(key, transform) {\n if (this.mouse && key !== \"mouse\") this.mouse[1] = transform.invert(this.mouse[0]);\n if (this.touch0 && key !== \"touch\") this.touch0[1] = transform.invert(this.touch0[0]);\n if (this.touch1 && key !== \"touch\") this.touch1[1] = transform.invert(this.touch1[0]);\n this.that.__zoom = transform;\n this.emit(\"zoom\");\n return this;\n },\n end: function() {\n if (--this.active === 0) {\n delete this.that.__zooming;\n this.emit(\"end\");\n }\n return this;\n },\n emit: function(type) {\n var d = select(this.that).datum();\n listeners.call(\n type,\n this.that,\n new ZoomEvent(type, {\n sourceEvent: this.sourceEvent,\n target: zoom,\n type,\n transform: this.that.__zoom,\n dispatch: listeners\n }),\n d\n );\n }\n };\n\n function wheeled(event, ...args) {\n if (!filter.apply(this, arguments)) return;\n var g = gesture(this, args).event(event),\n t = this.__zoom,\n k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),\n p = pointer(event);\n\n // If the mouse is in the same location as before, reuse it.\n // If there were recent wheel events, reset the wheel idle timeout.\n if (g.wheel) {\n if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {\n g.mouse[1] = t.invert(g.mouse[0] = p);\n }\n clearTimeout(g.wheel);\n }\n\n // If this wheel event won’t trigger a transform change, ignore it.\n else if (t.k === k) return;\n\n // Otherwise, capture the mouse point and location at the start.\n else {\n g.mouse = [p, t.invert(p)];\n interrupt(this);\n g.start();\n }\n\n noevent(event);\n g.wheel = setTimeout(wheelidled, wheelDelay);\n g.zoom(\"mouse\", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));\n\n function wheelidled() {\n g.wheel = null;\n g.end();\n }\n }\n\n function mousedowned(event, ...args) {\n if (touchending || !filter.apply(this, arguments)) return;\n var currentTarget = event.currentTarget,\n g = gesture(this, args, true).event(event),\n v = select(event.view).on(\"mousemove.zoom\", mousemoved, true).on(\"mouseup.zoom\", mouseupped, true),\n p = pointer(event, currentTarget),\n x0 = event.clientX,\n y0 = event.clientY;\n\n dragDisable(event.view);\n nopropagation(event);\n g.mouse = [p, this.__zoom.invert(p)];\n interrupt(this);\n g.start();\n\n function mousemoved(event) {\n noevent(event);\n if (!g.moved) {\n var dx = event.clientX - x0, dy = event.clientY - y0;\n g.moved = dx * dx + dy * dy > clickDistance2;\n }\n g.event(event)\n .zoom(\"mouse\", constrain(translate(g.that.__zoom, g.mouse[0] = pointer(event, currentTarget), g.mouse[1]), g.extent, translateExtent));\n }\n\n function mouseupped(event) {\n v.on(\"mousemove.zoom mouseup.zoom\", null);\n dragEnable(event.view, g.moved);\n noevent(event);\n g.event(event).end();\n }\n }\n\n function dblclicked(event, ...args) {\n if (!filter.apply(this, arguments)) return;\n var t0 = this.__zoom,\n p0 = pointer(event.changedTouches ? event.changedTouches[0] : event, this),\n p1 = t0.invert(p0),\n k1 = t0.k * (event.shiftKey ? 0.5 : 2),\n t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, args), translateExtent);\n\n noevent(event);\n if (duration > 0) select(this).transition().duration(duration).call(schedule, t1, p0, event);\n else select(this).call(zoom.transform, t1, p0, event);\n }\n\n function touchstarted(event, ...args) {\n if (!filter.apply(this, arguments)) return;\n var touches = event.touches,\n n = touches.length,\n g = gesture(this, args, event.changedTouches.length === n).event(event),\n started, i, t, p;\n\n nopropagation(event);\n for (i = 0; i < n; ++i) {\n t = touches[i], p = pointer(t, this);\n p = [p, this.__zoom.invert(p), t.identifier];\n if (!g.touch0) g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;\n else if (!g.touch1 && g.touch0[2] !== p[2]) g.touch1 = p, g.taps = 0;\n }\n\n if (touchstarting) touchstarting = clearTimeout(touchstarting);\n\n if (started) {\n if (g.taps < 2) touchfirst = p[0], touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay);\n interrupt(this);\n g.start();\n }\n }\n\n function touchmoved(event, ...args) {\n if (!this.__zooming) return;\n var g = gesture(this, args).event(event),\n touches = event.changedTouches,\n n = touches.length, i, t, p, l;\n\n noevent(event);\n for (i = 0; i < n; ++i) {\n t = touches[i], p = pointer(t, this);\n if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p;\n else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p;\n }\n t = g.that.__zoom;\n if (g.touch1) {\n var p0 = g.touch0[0], l0 = g.touch0[1],\n p1 = g.touch1[0], l1 = g.touch1[1],\n dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp,\n dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;\n t = scale(t, Math.sqrt(dp / dl));\n p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];\n l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];\n }\n else if (g.touch0) p = g.touch0[0], l = g.touch0[1];\n else return;\n\n g.zoom(\"touch\", constrain(translate(t, p, l), g.extent, translateExtent));\n }\n\n function touchended(event, ...args) {\n if (!this.__zooming) return;\n var g = gesture(this, args).event(event),\n touches = event.changedTouches,\n n = touches.length, i, t;\n\n nopropagation(event);\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, touchDelay);\n for (i = 0; i < n; ++i) {\n t = touches[i];\n if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0;\n else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1;\n }\n if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1;\n if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]);\n else {\n g.end();\n // If this was a dbltap, reroute to the (optional) dblclick.zoom handler.\n if (g.taps === 2) {\n t = pointer(t, this);\n if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) {\n var p = select(this).on(\"dblclick.zoom\");\n if (p) p.apply(this, arguments);\n }\n }\n }\n }\n\n zoom.wheelDelta = function(_) {\n return arguments.length ? (wheelDelta = typeof _ === \"function\" ? _ : constant(+_), zoom) : wheelDelta;\n };\n\n zoom.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), zoom) : filter;\n };\n\n zoom.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), zoom) : touchable;\n };\n\n zoom.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;\n };\n\n zoom.scaleExtent = function(_) {\n return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];\n };\n\n zoom.translateExtent = function(_) {\n return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];\n };\n\n zoom.constrain = function(_) {\n return arguments.length ? (constrain = _, zoom) : constrain;\n };\n\n zoom.duration = function(_) {\n return arguments.length ? (duration = +_, zoom) : duration;\n };\n\n zoom.interpolate = function(_) {\n return arguments.length ? (interpolate = _, zoom) : interpolate;\n };\n\n zoom.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? zoom : value;\n };\n\n zoom.clickDistance = function(_) {\n return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);\n };\n\n zoom.tapDistance = function(_) {\n return arguments.length ? (tapDistance = +_, zoom) : tapDistance;\n };\n\n return zoom;\n}\n","import { jsx, jsxs, Fragment } from 'react/jsx-runtime';\nimport { createContext, useContext, useMemo, memo, useRef, useState, useEffect, forwardRef, useCallback } from 'react';\nimport cc from 'classcat';\nimport { useStore as useStore$1, createStore } from 'zustand';\nimport { shallow } from 'zustand/shallow';\nimport { drag } from 'd3-drag';\nimport { select, pointer } from 'd3-selection';\nimport { zoomIdentity, zoom } from 'd3-zoom';\nimport { createPortal } from 'react-dom';\n\nconst StoreContext = createContext(null);\nconst Provider$1 = StoreContext.Provider;\n\nconst errorMessages = {\n error001: () => '[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001',\n error002: () => \"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.\",\n error003: (nodeType) => `Node type \"${nodeType}\" not found. Using fallback type \"default\".`,\n error004: () => 'The React Flow parent container needs a width and a height to render the graph.',\n error005: () => 'Only child nodes can use a parent extent.',\n error006: () => \"Can't create edge. An edge needs a source and a target.\",\n error007: (id) => `The old edge with id=${id} does not exist.`,\n error009: (type) => `Marker type \"${type}\" doesn't exist.`,\n error008: (sourceHandle, edge) => `Couldn't create edge for ${!sourceHandle ? 'source' : 'target'} handle id: \"${!sourceHandle ? edge.sourceHandle : edge.targetHandle}\", edge id: ${edge.id}.`,\n error010: () => 'Handle: No node id found. Make sure to only use a Handle inside a custom Node.',\n error011: (edgeType) => `Edge type \"${edgeType}\" not found. Using fallback type \"default\".`,\n};\n\nconst zustandErrorMessage = errorMessages['error001']();\nfunction useStore(selector, equalityFn) {\n const store = useContext(StoreContext);\n if (store === null) {\n throw new Error(zustandErrorMessage);\n }\n return useStore$1(store, selector, equalityFn);\n}\nconst useStoreApi = () => {\n const store = useContext(StoreContext);\n if (store === null) {\n throw new Error(zustandErrorMessage);\n }\n return useMemo(() => ({\n getState: store.getState,\n setState: store.setState,\n subscribe: store.subscribe,\n destroy: store.destroy,\n }), [store]);\n};\n\nconst selector$g = (s) => (s.userSelectionActive ? 'none' : 'all');\nfunction Panel({ position, children, className, style, ...rest }) {\n const pointerEvents = useStore(selector$g);\n const positionClasses = `${position}`.split('-');\n return (jsx(\"div\", { className: cc(['react-flow__panel', className, ...positionClasses]), style: { ...style, pointerEvents }, ...rest, children: children }));\n}\n\nfunction Attribution({ proOptions, position = 'bottom-right' }) {\n if (proOptions?.hideAttribution) {\n return null;\n }\n return (jsx(Panel, { position: position, className: \"react-flow__attribution\", \"data-message\": \"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev\", children: jsx(\"a\", { href: \"https://reactflow.dev\", target: \"_blank\", rel: \"noopener noreferrer\", \"aria-label\": \"React Flow attribution\", children: \"React Flow\" }) }));\n}\n\nconst EdgeText = ({ x, y, label, labelStyle = {}, labelShowBg = true, labelBgStyle = {}, labelBgPadding = [2, 4], labelBgBorderRadius = 2, children, className, ...rest }) => {\n const edgeRef = useRef(null);\n const [edgeTextBbox, setEdgeTextBbox] = useState({ x: 0, y: 0, width: 0, height: 0 });\n const edgeTextClasses = cc(['react-flow__edge-textwrapper', className]);\n useEffect(() => {\n if (edgeRef.current) {\n const textBbox = edgeRef.current.getBBox();\n setEdgeTextBbox({\n x: textBbox.x,\n y: textBbox.y,\n width: textBbox.width,\n height: textBbox.height,\n });\n }\n }, [label]);\n if (typeof label === 'undefined' || !label) {\n return null;\n }\n return (jsxs(\"g\", { transform: `translate(${x - edgeTextBbox.width / 2} ${y - edgeTextBbox.height / 2})`, className: edgeTextClasses, visibility: edgeTextBbox.width ? 'visible' : 'hidden', ...rest, children: [labelShowBg && (jsx(\"rect\", { width: edgeTextBbox.width + 2 * labelBgPadding[0], x: -labelBgPadding[0], y: -labelBgPadding[1], height: edgeTextBbox.height + 2 * labelBgPadding[1], className: \"react-flow__edge-textbg\", style: labelBgStyle, rx: labelBgBorderRadius, ry: labelBgBorderRadius })), jsx(\"text\", { className: \"react-flow__edge-text\", y: edgeTextBbox.height / 2, dy: \"0.3em\", ref: edgeRef, style: labelStyle, children: label }), children] }));\n};\nvar EdgeText$1 = memo(EdgeText);\n\nconst getDimensions = (node) => ({\n width: node.offsetWidth,\n height: node.offsetHeight,\n});\nconst clamp = (val, min = 0, max = 1) => Math.min(Math.max(val, min), max);\nconst clampPosition = (position = { x: 0, y: 0 }, extent) => ({\n x: clamp(position.x, extent[0][0], extent[1][0]),\n y: clamp(position.y, extent[0][1], extent[1][1]),\n});\n// returns a number between 0 and 1 that represents the velocity of the movement\n// when the mouse is close to the edge of the canvas\nconst calcAutoPanVelocity = (value, min, max) => {\n if (value < min) {\n return clamp(Math.abs(value - min), 1, 50) / 50;\n }\n else if (value > max) {\n return -clamp(Math.abs(value - max), 1, 50) / 50;\n }\n return 0;\n};\nconst calcAutoPan = (pos, bounds) => {\n const xMovement = calcAutoPanVelocity(pos.x, 35, bounds.width - 35) * 20;\n const yMovement = calcAutoPanVelocity(pos.y, 35, bounds.height - 35) * 20;\n return [xMovement, yMovement];\n};\nconst getHostForElement = (element) => element.getRootNode?.() || window?.document;\nconst getBoundsOfBoxes = (box1, box2) => ({\n x: Math.min(box1.x, box2.x),\n y: Math.min(box1.y, box2.y),\n x2: Math.max(box1.x2, box2.x2),\n y2: Math.max(box1.y2, box2.y2),\n});\nconst rectToBox = ({ x, y, width, height }) => ({\n x,\n y,\n x2: x + width,\n y2: y + height,\n});\nconst boxToRect = ({ x, y, x2, y2 }) => ({\n x,\n y,\n width: x2 - x,\n height: y2 - y,\n});\nconst nodeToRect = (node) => ({\n ...(node.positionAbsolute || { x: 0, y: 0 }),\n width: node.width || 0,\n height: node.height || 0,\n});\nconst getBoundsOfRects = (rect1, rect2) => boxToRect(getBoundsOfBoxes(rectToBox(rect1), rectToBox(rect2)));\nconst getOverlappingArea = (rectA, rectB) => {\n const xOverlap = Math.max(0, Math.min(rectA.x + rectA.width, rectB.x + rectB.width) - Math.max(rectA.x, rectB.x));\n const yOverlap = Math.max(0, Math.min(rectA.y + rectA.height, rectB.y + rectB.height) - Math.max(rectA.y, rectB.y));\n return Math.ceil(xOverlap * yOverlap);\n};\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isRectObject = (obj) => isNumeric(obj.width) && isNumeric(obj.height) && isNumeric(obj.x) && isNumeric(obj.y);\n/* eslint-disable-next-line @typescript-eslint/no-explicit-any */\nconst isNumeric = (n) => !isNaN(n) && isFinite(n);\nconst internalsSymbol = Symbol.for('internals');\n// used for a11y key board controls for nodes and edges\nconst elementSelectionKeys = ['Enter', ' ', 'Escape'];\nconst devWarn = (id, message) => {\n if (process.env.NODE_ENV === 'development') {\n console.warn(`[React Flow]: ${message} Help: https://reactflow.dev/error#${id}`);\n }\n};\nconst isReactKeyboardEvent = (event) => 'nativeEvent' in event;\nfunction isInputDOMNode(event) {\n const kbEvent = isReactKeyboardEvent(event) ? event.nativeEvent : event;\n // using composed path for handling shadow dom\n const target = (kbEvent.composedPath?.()?.[0] || event.target);\n const isInput = ['INPUT', 'SELECT', 'TEXTAREA'].includes(target?.nodeName) || target?.hasAttribute('contenteditable');\n // when an input field is focused we don't want to trigger deletion or movement of nodes\n return isInput || !!target?.closest('.nokey');\n}\nconst isMouseEvent = (event) => 'clientX' in event;\nconst getEventPosition = (event, bounds) => {\n const isMouseTriggered = isMouseEvent(event);\n const evtX = isMouseTriggered ? event.clientX : event.touches?.[0].clientX;\n const evtY = isMouseTriggered ? event.clientY : event.touches?.[0].clientY;\n return {\n x: evtX - (bounds?.left ?? 0),\n y: evtY - (bounds?.top ?? 0),\n };\n};\n\nconst BaseEdge = ({ id, path, labelX, labelY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, markerEnd, markerStart, interactionWidth = 20, }) => {\n return (jsxs(Fragment, { children: [jsx(\"path\", { id: id, style: style, d: path, fill: \"none\", className: \"react-flow__edge-path\", markerEnd: markerEnd, markerStart: markerStart }), interactionWidth && (jsx(\"path\", { d: path, fill: \"none\", strokeOpacity: 0, strokeWidth: interactionWidth, className: \"react-flow__edge-interaction\" })), label && isNumeric(labelX) && isNumeric(labelY) ? (jsx(EdgeText$1, { x: labelX, y: labelY, label: label, labelStyle: labelStyle, labelShowBg: labelShowBg, labelBgStyle: labelBgStyle, labelBgPadding: labelBgPadding, labelBgBorderRadius: labelBgBorderRadius })) : null] }));\n};\nBaseEdge.displayName = 'BaseEdge';\n\nconst getMarkerEnd = (markerType, markerEndId) => {\n if (typeof markerEndId !== 'undefined' && markerEndId) {\n return `url(#${markerEndId})`;\n }\n return typeof markerType !== 'undefined' ? `url(#react-flow__${markerType})` : 'none';\n};\nfunction getMouseHandler$1(id, getState, handler) {\n return handler === undefined\n ? handler\n : (event) => {\n const edge = getState().edges.find((e) => e.id === id);\n if (edge) {\n handler(event, { ...edge });\n }\n };\n}\n// this is used for straight edges and simple smoothstep edges (LTR, RTL, BTT, TTB)\nfunction getEdgeCenter({ sourceX, sourceY, targetX, targetY, }) {\n const xOffset = Math.abs(targetX - sourceX) / 2;\n const centerX = targetX < sourceX ? targetX + xOffset : targetX - xOffset;\n const yOffset = Math.abs(targetY - sourceY) / 2;\n const centerY = targetY < sourceY ? targetY + yOffset : targetY - yOffset;\n return [centerX, centerY, xOffset, yOffset];\n}\nfunction getBezierEdgeCenter({ sourceX, sourceY, targetX, targetY, sourceControlX, sourceControlY, targetControlX, targetControlY, }) {\n // cubic bezier t=0.5 mid point, not the actual mid point, but easy to calculate\n // https://stackoverflow.com/questions/67516101/how-to-find-distance-mid-point-of-bezier-curve\n const centerX = sourceX * 0.125 + sourceControlX * 0.375 + targetControlX * 0.375 + targetX * 0.125;\n const centerY = sourceY * 0.125 + sourceControlY * 0.375 + targetControlY * 0.375 + targetY * 0.125;\n const offsetX = Math.abs(centerX - sourceX);\n const offsetY = Math.abs(centerY - sourceY);\n return [centerX, centerY, offsetX, offsetY];\n}\n\nvar ConnectionMode;\n(function (ConnectionMode) {\n ConnectionMode[\"Strict\"] = \"strict\";\n ConnectionMode[\"Loose\"] = \"loose\";\n})(ConnectionMode || (ConnectionMode = {}));\nvar PanOnScrollMode;\n(function (PanOnScrollMode) {\n PanOnScrollMode[\"Free\"] = \"free\";\n PanOnScrollMode[\"Vertical\"] = \"vertical\";\n PanOnScrollMode[\"Horizontal\"] = \"horizontal\";\n})(PanOnScrollMode || (PanOnScrollMode = {}));\nvar SelectionMode;\n(function (SelectionMode) {\n SelectionMode[\"Partial\"] = \"partial\";\n SelectionMode[\"Full\"] = \"full\";\n})(SelectionMode || (SelectionMode = {}));\n\nvar ConnectionLineType;\n(function (ConnectionLineType) {\n ConnectionLineType[\"Bezier\"] = \"default\";\n ConnectionLineType[\"Straight\"] = \"straight\";\n ConnectionLineType[\"Step\"] = \"step\";\n ConnectionLineType[\"SmoothStep\"] = \"smoothstep\";\n ConnectionLineType[\"SimpleBezier\"] = \"simplebezier\";\n})(ConnectionLineType || (ConnectionLineType = {}));\nvar MarkerType;\n(function (MarkerType) {\n MarkerType[\"Arrow\"] = \"arrow\";\n MarkerType[\"ArrowClosed\"] = \"arrowclosed\";\n})(MarkerType || (MarkerType = {}));\n\nvar Position;\n(function (Position) {\n Position[\"Left\"] = \"left\";\n Position[\"Top\"] = \"top\";\n Position[\"Right\"] = \"right\";\n Position[\"Bottom\"] = \"bottom\";\n})(Position || (Position = {}));\n\nfunction getControl({ pos, x1, y1, x2, y2 }) {\n if (pos === Position.Left || pos === Position.Right) {\n return [0.5 * (x1 + x2), y1];\n }\n return [x1, 0.5 * (y1 + y2)];\n}\nfunction getSimpleBezierPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, }) {\n const [sourceControlX, sourceControlY] = getControl({\n pos: sourcePosition,\n x1: sourceX,\n y1: sourceY,\n x2: targetX,\n y2: targetY,\n });\n const [targetControlX, targetControlY] = getControl({\n pos: targetPosition,\n x1: targetX,\n y1: targetY,\n x2: sourceX,\n y2: sourceY,\n });\n const [labelX, labelY, offsetX, offsetY] = getBezierEdgeCenter({\n sourceX,\n sourceY,\n targetX,\n targetY,\n sourceControlX,\n sourceControlY,\n targetControlX,\n targetControlY,\n });\n return [\n `M${sourceX},${sourceY} C${sourceControlX},${sourceControlY} ${targetControlX},${targetControlY} ${targetX},${targetY}`,\n labelX,\n labelY,\n offsetX,\n offsetY,\n ];\n}\nconst SimpleBezierEdge = memo(({ sourceX, sourceY, targetX, targetY, sourcePosition = Position.Bottom, targetPosition = Position.Top, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, markerEnd, markerStart, interactionWidth, }) => {\n const [path, labelX, labelY] = getSimpleBezierPath({\n sourceX,\n sourceY,\n sourcePosition,\n targetX,\n targetY,\n targetPosition,\n });\n return (jsx(BaseEdge, { path: path, labelX: labelX, labelY: labelY, label: label, labelStyle: labelStyle, labelShowBg: labelShowBg, labelBgStyle: labelBgStyle, labelBgPadding: labelBgPadding, labelBgBorderRadius: labelBgBorderRadius, style: style, markerEnd: markerEnd, markerStart: markerStart, interactionWidth: interactionWidth }));\n});\nSimpleBezierEdge.displayName = 'SimpleBezierEdge';\n\nconst handleDirections = {\n [Position.Left]: { x: -1, y: 0 },\n [Position.Right]: { x: 1, y: 0 },\n [Position.Top]: { x: 0, y: -1 },\n [Position.Bottom]: { x: 0, y: 1 },\n};\nconst getDirection = ({ source, sourcePosition = Position.Bottom, target, }) => {\n if (sourcePosition === Position.Left || sourcePosition === Position.Right) {\n return source.x < target.x ? { x: 1, y: 0 } : { x: -1, y: 0 };\n }\n return source.y < target.y ? { x: 0, y: 1 } : { x: 0, y: -1 };\n};\nconst distance = (a, b) => Math.sqrt(Math.pow(b.x - a.x, 2) + Math.pow(b.y - a.y, 2));\n// ith this function we try to mimic a orthogonal edge routing behaviour\n// It's not as good as a real orthogonal edge routing but it's faster and good enough as a default for step and smooth step edges\nfunction getPoints({ source, sourcePosition = Position.Bottom, target, targetPosition = Position.Top, center, offset, }) {\n const sourceDir = handleDirections[sourcePosition];\n const targetDir = handleDirections[targetPosition];\n const sourceGapped = { x: source.x + sourceDir.x * offset, y: source.y + sourceDir.y * offset };\n const targetGapped = { x: target.x + targetDir.x * offset, y: target.y + targetDir.y * offset };\n const dir = getDirection({\n source: sourceGapped,\n sourcePosition,\n target: targetGapped,\n });\n const dirAccessor = dir.x !== 0 ? 'x' : 'y';\n const currDir = dir[dirAccessor];\n let points = [];\n let centerX, centerY;\n const [defaultCenterX, defaultCenterY, defaultOffsetX, defaultOffsetY] = getEdgeCenter({\n sourceX: source.x,\n sourceY: source.y,\n targetX: target.x,\n targetY: target.y,\n });\n // opposite handle positions, default case\n if (sourceDir[dirAccessor] * targetDir[dirAccessor] === -1) {\n centerX = center.x || defaultCenterX;\n centerY = center.y || defaultCenterY;\n // --->\n // |\n // >---\n const verticalSplit = [\n { x: centerX, y: sourceGapped.y },\n { x: centerX, y: targetGapped.y },\n ];\n // |\n // ---\n // |\n const horizontalSplit = [\n { x: sourceGapped.x, y: centerY },\n { x: targetGapped.x, y: centerY },\n ];\n if (sourceDir[dirAccessor] === currDir) {\n points = dirAccessor === 'x' ? verticalSplit : horizontalSplit;\n }\n else {\n points = dirAccessor === 'x' ? horizontalSplit : verticalSplit;\n }\n }\n else {\n // sourceTarget means we take x from source and y from target, targetSource is the opposite\n const sourceTarget = [{ x: sourceGapped.x, y: targetGapped.y }];\n const targetSource = [{ x: targetGapped.x, y: sourceGapped.y }];\n // this handles edges with same handle positions\n if (dirAccessor === 'x') {\n points = sourceDir.x === currDir ? targetSource : sourceTarget;\n }\n else {\n points = sourceDir.y === currDir ? sourceTarget : targetSource;\n }\n // these are conditions for handling mixed handle positions like Right -> Bottom for example\n if (sourcePosition !== targetPosition) {\n const dirAccessorOpposite = dirAccessor === 'x' ? 'y' : 'x';\n const isSameDir = sourceDir[dirAccessor] === targetDir[dirAccessorOpposite];\n const sourceGtTargetOppo = sourceGapped[dirAccessorOpposite] > targetGapped[dirAccessorOpposite];\n const sourceLtTargetOppo = sourceGapped[dirAccessorOpposite] < targetGapped[dirAccessorOpposite];\n const flipSourceTarget = (sourceDir[dirAccessor] === 1 && ((!isSameDir && sourceGtTargetOppo) || (isSameDir && sourceLtTargetOppo))) ||\n (sourceDir[dirAccessor] !== 1 && ((!isSameDir && sourceLtTargetOppo) || (isSameDir && sourceGtTargetOppo)));\n if (flipSourceTarget) {\n points = dirAccessor === 'x' ? sourceTarget : targetSource;\n }\n }\n centerX = points[0].x;\n centerY = points[0].y;\n }\n const pathPoints = [source, sourceGapped, ...points, targetGapped, target];\n return [pathPoints, centerX, centerY, defaultOffsetX, defaultOffsetY];\n}\nfunction getBend(a, b, c, size) {\n const bendSize = Math.min(distance(a, b) / 2, distance(b, c) / 2, size);\n const { x, y } = b;\n // no bend\n if ((a.x === x && x === c.x) || (a.y === y && y === c.y)) {\n return `L${x} ${y}`;\n }\n // first segment is horizontal\n if (a.y === y) {\n const xDir = a.x < c.x ? -1 : 1;\n const yDir = a.y < c.y ? 1 : -1;\n return `L ${x + bendSize * xDir},${y}Q ${x},${y} ${x},${y + bendSize * yDir}`;\n }\n const xDir = a.x < c.x ? 1 : -1;\n const yDir = a.y < c.y ? -1 : 1;\n return `L ${x},${y + bendSize * yDir}Q ${x},${y} ${x + bendSize * xDir},${y}`;\n}\nfunction getSmoothStepPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, borderRadius = 5, centerX, centerY, offset = 20, }) {\n const [points, labelX, labelY, offsetX, offsetY] = getPoints({\n source: { x: sourceX, y: sourceY },\n sourcePosition,\n target: { x: targetX, y: targetY },\n targetPosition,\n center: { x: centerX, y: centerY },\n offset,\n });\n const path = points.reduce((res, p, i) => {\n let segment = '';\n if (i > 0 && i < points.length - 1) {\n segment = getBend(points[i - 1], p, points[i + 1], borderRadius);\n }\n else {\n segment = `${i === 0 ? 'M' : 'L'}${p.x} ${p.y}`;\n }\n res += segment;\n return res;\n }, '');\n return [path, labelX, labelY, offsetX, offsetY];\n}\nconst SmoothStepEdge = memo(({ sourceX, sourceY, targetX, targetY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, sourcePosition = Position.Bottom, targetPosition = Position.Top, markerEnd, markerStart, pathOptions, interactionWidth, }) => {\n const [path, labelX, labelY] = getSmoothStepPath({\n sourceX,\n sourceY,\n sourcePosition,\n targetX,\n targetY,\n targetPosition,\n borderRadius: pathOptions?.borderRadius,\n offset: pathOptions?.offset,\n });\n return (jsx(BaseEdge, { path: path, labelX: labelX, labelY: labelY, label: label, labelStyle: labelStyle, labelShowBg: labelShowBg, labelBgStyle: labelBgStyle, labelBgPadding: labelBgPadding, labelBgBorderRadius: labelBgBorderRadius, style: style, markerEnd: markerEnd, markerStart: markerStart, interactionWidth: interactionWidth }));\n});\nSmoothStepEdge.displayName = 'SmoothStepEdge';\n\nconst StepEdge = memo((props) => (jsx(SmoothStepEdge, { ...props, pathOptions: useMemo(() => ({ borderRadius: 0, offset: props.pathOptions?.offset }), [props.pathOptions?.offset]) })));\nStepEdge.displayName = 'StepEdge';\n\nfunction getStraightPath({ sourceX, sourceY, targetX, targetY, }) {\n const [labelX, labelY, offsetX, offsetY] = getEdgeCenter({\n sourceX,\n sourceY,\n targetX,\n targetY,\n });\n return [`M ${sourceX},${sourceY}L ${targetX},${targetY}`, labelX, labelY, offsetX, offsetY];\n}\nconst StraightEdge = memo(({ sourceX, sourceY, targetX, targetY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, markerEnd, markerStart, interactionWidth, }) => {\n const [path, labelX, labelY] = getStraightPath({ sourceX, sourceY, targetX, targetY });\n return (jsx(BaseEdge, { path: path, labelX: labelX, labelY: labelY, label: label, labelStyle: labelStyle, labelShowBg: labelShowBg, labelBgStyle: labelBgStyle, labelBgPadding: labelBgPadding, labelBgBorderRadius: labelBgBorderRadius, style: style, markerEnd: markerEnd, markerStart: markerStart, interactionWidth: interactionWidth }));\n});\nStraightEdge.displayName = 'StraightEdge';\n\nfunction calculateControlOffset(distance, curvature) {\n if (distance >= 0) {\n return 0.5 * distance;\n }\n return curvature * 25 * Math.sqrt(-distance);\n}\nfunction getControlWithCurvature({ pos, x1, y1, x2, y2, c }) {\n switch (pos) {\n case Position.Left:\n return [x1 - calculateControlOffset(x1 - x2, c), y1];\n case Position.Right:\n return [x1 + calculateControlOffset(x2 - x1, c), y1];\n case Position.Top:\n return [x1, y1 - calculateControlOffset(y1 - y2, c)];\n case Position.Bottom:\n return [x1, y1 + calculateControlOffset(y2 - y1, c)];\n }\n}\nfunction getBezierPath({ sourceX, sourceY, sourcePosition = Position.Bottom, targetX, targetY, targetPosition = Position.Top, curvature = 0.25, }) {\n const [sourceControlX, sourceControlY] = getControlWithCurvature({\n pos: sourcePosition,\n x1: sourceX,\n y1: sourceY,\n x2: targetX,\n y2: targetY,\n c: curvature,\n });\n const [targetControlX, targetControlY] = getControlWithCurvature({\n pos: targetPosition,\n x1: targetX,\n y1: targetY,\n x2: sourceX,\n y2: sourceY,\n c: curvature,\n });\n const [labelX, labelY, offsetX, offsetY] = getBezierEdgeCenter({\n sourceX,\n sourceY,\n targetX,\n targetY,\n sourceControlX,\n sourceControlY,\n targetControlX,\n targetControlY,\n });\n return [\n `M${sourceX},${sourceY} C${sourceControlX},${sourceControlY} ${targetControlX},${targetControlY} ${targetX},${targetY}`,\n labelX,\n labelY,\n offsetX,\n offsetY,\n ];\n}\nconst BezierEdge = memo(({ sourceX, sourceY, targetX, targetY, sourcePosition = Position.Bottom, targetPosition = Position.Top, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, markerEnd, markerStart, pathOptions, interactionWidth, }) => {\n const [path, labelX, labelY] = getBezierPath({\n sourceX,\n sourceY,\n sourcePosition,\n targetX,\n targetY,\n targetPosition,\n curvature: pathOptions?.curvature,\n });\n return (jsx(BaseEdge, { path: path, labelX: labelX, labelY: labelY, label: label, labelStyle: labelStyle, labelShowBg: labelShowBg, labelBgStyle: labelBgStyle, labelBgPadding: labelBgPadding, labelBgBorderRadius: labelBgBorderRadius, style: style, markerEnd: markerEnd, markerStart: markerStart, interactionWidth: interactionWidth }));\n});\nBezierEdge.displayName = 'BezierEdge';\n\nconst NodeIdContext = createContext(null);\nconst Provider = NodeIdContext.Provider;\nNodeIdContext.Consumer;\nconst useNodeId = () => {\n const nodeId = useContext(NodeIdContext);\n return nodeId;\n};\n\nconst isEdge = (element) => 'id' in element && 'source' in element && 'target' in element;\nconst isNode = (element) => 'id' in element && !('source' in element) && !('target' in element);\nconst getOutgoers = (node, nodes, edges) => {\n if (!isNode(node)) {\n return [];\n }\n const outgoerIds = edges.filter((e) => e.source === node.id).map((e) => e.target);\n return nodes.filter((n) => outgoerIds.includes(n.id));\n};\nconst getIncomers = (node, nodes, edges) => {\n if (!isNode(node)) {\n return [];\n }\n const incomersIds = edges.filter((e) => e.target === node.id).map((e) => e.source);\n return nodes.filter((n) => incomersIds.includes(n.id));\n};\nconst getEdgeId = ({ source, sourceHandle, target, targetHandle }) => `reactflow__edge-${source}${sourceHandle || ''}-${target}${targetHandle || ''}`;\nconst getMarkerId = (marker, rfId) => {\n if (typeof marker === 'undefined') {\n return '';\n }\n if (typeof marker === 'string') {\n return marker;\n }\n const idPrefix = rfId ? `${rfId}__` : '';\n return `${idPrefix}${Object.keys(marker)\n .sort()\n .map((key) => `${key}=${marker[key]}`)\n .join('&')}`;\n};\nconst connectionExists = (edge, edges) => {\n return edges.some((el) => el.source === edge.source &&\n el.target === edge.target &&\n (el.sourceHandle === edge.sourceHandle || (!el.sourceHandle && !edge.sourceHandle)) &&\n (el.targetHandle === edge.targetHandle || (!el.targetHandle && !edge.targetHandle)));\n};\nconst addEdge = (edgeParams, edges) => {\n if (!edgeParams.source || !edgeParams.target) {\n devWarn('006', errorMessages['error006']());\n return edges;\n }\n let edge;\n if (isEdge(edgeParams)) {\n edge = { ...edgeParams };\n }\n else {\n edge = {\n ...edgeParams,\n id: getEdgeId(edgeParams),\n };\n }\n if (connectionExists(edge, edges)) {\n return edges;\n }\n return edges.concat(edge);\n};\nconst updateEdge = (oldEdge, newConnection, edges, options = { shouldReplaceId: true }) => {\n const { id: oldEdgeId, ...rest } = oldEdge;\n if (!newConnection.source || !newConnection.target) {\n devWarn('006', errorMessages['error006']());\n return edges;\n }\n const foundEdge = edges.find((e) => e.id === oldEdgeId);\n if (!foundEdge) {\n devWarn('007', errorMessages['error007'](oldEdgeId));\n return edges;\n }\n // Remove old edge and create the new edge with parameters of old edge.\n const edge = {\n ...rest,\n id: options.shouldReplaceId ? getEdgeId(newConnection) : oldEdgeId,\n source: newConnection.source,\n target: newConnection.target,\n sourceHandle: newConnection.sourceHandle,\n targetHandle: newConnection.targetHandle,\n };\n return edges.filter((e) => e.id !== oldEdgeId).concat(edge);\n};\nconst pointToRendererPoint = ({ x, y }, [tx, ty, tScale], snapToGrid, [snapX, snapY]) => {\n const position = {\n x: (x - tx) / tScale,\n y: (y - ty) / tScale,\n };\n if (snapToGrid) {\n return {\n x: snapX * Math.round(position.x / snapX),\n y: snapY * Math.round(position.y / snapY),\n };\n }\n return position;\n};\nconst rendererPointToPoint = ({ x, y }, [tx, ty, tScale]) => {\n return {\n x: x * tScale + tx,\n y: y * tScale + ty,\n };\n};\nconst getNodePositionWithOrigin = (node, nodeOrigin = [0, 0]) => {\n if (!node) {\n return {\n x: 0,\n y: 0,\n positionAbsolute: {\n x: 0,\n y: 0,\n },\n };\n }\n const offsetX = (node.width ?? 0) * nodeOrigin[0];\n const offsetY = (node.height ?? 0) * nodeOrigin[1];\n const position = {\n x: node.position.x - offsetX,\n y: node.position.y - offsetY,\n };\n return {\n ...position,\n positionAbsolute: node.positionAbsolute\n ? {\n x: node.positionAbsolute.x - offsetX,\n y: node.positionAbsolute.y - offsetY,\n }\n : position,\n };\n};\nconst getRectOfNodes = (nodes, nodeOrigin = [0, 0]) => {\n if (nodes.length === 0) {\n return { x: 0, y: 0, width: 0, height: 0 };\n }\n const box = nodes.reduce((currBox, node) => {\n const { x, y } = getNodePositionWithOrigin(node, nodeOrigin).positionAbsolute;\n return getBoundsOfBoxes(currBox, rectToBox({\n x,\n y,\n width: node.width || 0,\n height: node.height || 0,\n }));\n }, { x: Infinity, y: Infinity, x2: -Infinity, y2: -Infinity });\n return boxToRect(box);\n};\nconst getNodesInside = (nodeInternals, rect, [tx, ty, tScale] = [0, 0, 1], partially = false, \n// set excludeNonSelectableNodes if you want to pay attention to the nodes \"selectable\" attribute\nexcludeNonSelectableNodes = false, nodeOrigin = [0, 0]) => {\n const paneRect = {\n x: (rect.x - tx) / tScale,\n y: (rect.y - ty) / tScale,\n width: rect.width / tScale,\n height: rect.height / tScale,\n };\n const visibleNodes = [];\n nodeInternals.forEach((node) => {\n const { width, height, selectable = true, hidden = false } = node;\n if ((excludeNonSelectableNodes && !selectable) || hidden) {\n return false;\n }\n const { positionAbsolute } = getNodePositionWithOrigin(node, nodeOrigin);\n const nodeRect = {\n x: positionAbsolute.x,\n y: positionAbsolute.y,\n width: width || 0,\n height: height || 0,\n };\n const overlappingArea = getOverlappingArea(paneRect, nodeRect);\n const notInitialized = typeof width === 'undefined' || typeof height === 'undefined' || width === null || height === null;\n const partiallyVisible = partially && overlappingArea > 0;\n const area = (width || 0) * (height || 0);\n const isVisible = notInitialized || partiallyVisible || overlappingArea >= area;\n if (isVisible || node.dragging) {\n visibleNodes.push(node);\n }\n });\n return visibleNodes;\n};\nconst getConnectedEdges = (nodes, edges) => {\n const nodeIds = nodes.map((node) => node.id);\n return edges.filter((edge) => nodeIds.includes(edge.source) || nodeIds.includes(edge.target));\n};\nconst getTransformForBounds = (bounds, width, height, minZoom, maxZoom, padding = 0.1) => {\n const xZoom = width / (bounds.width * (1 + padding));\n const yZoom = height / (bounds.height * (1 + padding));\n const zoom = Math.min(xZoom, yZoom);\n const clampedZoom = clamp(zoom, minZoom, maxZoom);\n const boundsCenterX = bounds.x + bounds.width / 2;\n const boundsCenterY = bounds.y + bounds.height / 2;\n const x = width / 2 - boundsCenterX * clampedZoom;\n const y = height / 2 - boundsCenterY * clampedZoom;\n return [x, y, clampedZoom];\n};\nconst getD3Transition = (selection, duration = 0) => {\n return selection.transition().duration(duration);\n};\n\n// this functions collects all handles and adds an absolute position\n// so that we can later find the closest handle to the mouse position\nfunction getHandles(node, handleBounds, type, currentHandle) {\n return (handleBounds[type] || []).reduce((res, h) => {\n if (`${node.id}-${h.id}-${type}` !== currentHandle) {\n res.push({\n id: h.id || null,\n type,\n nodeId: node.id,\n x: (node.positionAbsolute?.x ?? 0) + h.x + h.width / 2,\n y: (node.positionAbsolute?.y ?? 0) + h.y + h.height / 2,\n });\n }\n return res;\n }, []);\n}\nfunction getClosestHandle(pos, connectionRadius, handles) {\n let closestHandles = [];\n let minDistance = Infinity;\n handles.forEach((handle) => {\n const distance = Math.sqrt(Math.pow(handle.x - pos.x, 2) + Math.pow(handle.y - pos.y, 2));\n if (distance <= connectionRadius) {\n if (distance < minDistance) {\n closestHandles = [handle];\n }\n else if (distance === minDistance) {\n // when multiple handles are on the same distance we collect all of them\n closestHandles.push(handle);\n }\n minDistance = distance;\n }\n });\n if (!closestHandles.length) {\n return null;\n }\n return closestHandles.length === 1\n ? closestHandles[0]\n : // if multiple handles are layouted on top of each other we take the one with type = target because it's more likely that the user wants to connect to this one\n closestHandles.find((handle) => handle.type === 'target') || closestHandles[0];\n}\nconst nullConnection = { source: null, target: null, sourceHandle: null, targetHandle: null };\n// checks if and returns connection in fom of an object { source: 123, target: 312 }\nfunction isValidHandle(event, handle, connectionMode, fromNodeId, fromHandleId, fromType, isValidConnection, doc) {\n const isTarget = fromType === 'target';\n const handleDomNode = doc.querySelector(`.react-flow__handle[data-id=\"${handle?.nodeId}-${handle?.id}-${handle?.type}\"]`);\n const { x, y } = getEventPosition(event);\n const handleBelow = doc.elementFromPoint(x, y);\n // we always want to prioritize the handle below the mouse cursor over the closest distance handle,\n // because it could be that the center of another handle is closer to the mouse pointer than the handle below the cursor\n const handleToCheck = handleBelow?.classList.contains('react-flow__handle') ? handleBelow : handleDomNode;\n const result = {\n handleDomNode: handleToCheck,\n isValid: false,\n connection: nullConnection,\n endHandle: null,\n };\n if (handleToCheck) {\n const handleType = getHandleType(undefined, handleToCheck);\n const handleNodeId = handleToCheck.getAttribute('data-nodeid');\n const handleId = handleToCheck.getAttribute('data-handleid');\n const connectable = handleToCheck.classList.contains('connectable');\n const connectableEnd = handleToCheck.classList.contains('connectableend');\n const connection = {\n source: isTarget ? handleNodeId : fromNodeId,\n sourceHandle: isTarget ? handleId : fromHandleId,\n target: isTarget ? fromNodeId : handleNodeId,\n targetHandle: isTarget ? fromHandleId : handleId,\n };\n result.connection = connection;\n const isConnectable = connectable && connectableEnd;\n // in strict mode we don't allow target to target or source to source connections\n const isValid = isConnectable &&\n (connectionMode === ConnectionMode.Strict\n ? (isTarget && handleType === 'source') || (!isTarget && handleType === 'target')\n : handleNodeId !== fromNodeId || handleId !== fromHandleId);\n if (isValid) {\n result.endHandle = {\n nodeId: handleNodeId,\n handleId,\n type: handleType,\n };\n result.isValid = isValidConnection(connection);\n }\n }\n return result;\n}\nfunction getHandleLookup({ nodes, nodeId, handleId, handleType }) {\n return nodes.reduce((res, node) => {\n if (node[internalsSymbol]) {\n const { handleBounds } = node[internalsSymbol];\n let sourceHandles = [];\n let targetHandles = [];\n if (handleBounds) {\n sourceHandles = getHandles(node, handleBounds, 'source', `${nodeId}-${handleId}-${handleType}`);\n targetHandles = getHandles(node, handleBounds, 'target', `${nodeId}-${handleId}-${handleType}`);\n }\n res.push(...sourceHandles, ...targetHandles);\n }\n return res;\n }, []);\n}\nfunction getHandleType(edgeUpdaterType, handleDomNode) {\n if (edgeUpdaterType) {\n return edgeUpdaterType;\n }\n else if (handleDomNode?.classList.contains('target')) {\n return 'target';\n }\n else if (handleDomNode?.classList.contains('source')) {\n return 'source';\n }\n return null;\n}\nfunction resetRecentHandle(handleDomNode) {\n handleDomNode?.classList.remove('valid', 'connecting', 'react-flow__handle-valid', 'react-flow__handle-connecting');\n}\nfunction getConnectionStatus(isInsideConnectionRadius, isHandleValid) {\n let connectionStatus = null;\n if (isHandleValid) {\n connectionStatus = 'valid';\n }\n else if (isInsideConnectionRadius && !isHandleValid) {\n connectionStatus = 'invalid';\n }\n return connectionStatus;\n}\n\nfunction handlePointerDown({ event, handleId, nodeId, onConnect, isTarget, getState, setState, isValidConnection, edgeUpdaterType, onEdgeUpdateEnd, }) {\n // when react-flow is used inside a shadow root we can't use document\n const doc = getHostForElement(event.target);\n const { connectionMode, domNode, autoPanOnConnect, connectionRadius, onConnectStart, panBy, getNodes, cancelConnection, } = getState();\n let autoPanId = 0;\n let closestHandle;\n const { x, y } = getEventPosition(event);\n const clickedHandle = doc?.elementFromPoint(x, y);\n const handleType = getHandleType(edgeUpdaterType, clickedHandle);\n const containerBounds = domNode?.getBoundingClientRect();\n if (!containerBounds || !handleType) {\n return;\n }\n let prevActiveHandle;\n let connectionPosition = getEventPosition(event, containerBounds);\n let autoPanStarted = false;\n let connection = null;\n let isValid = false;\n let handleDomNode = null;\n const handleLookup = getHandleLookup({\n nodes: getNodes(),\n nodeId,\n handleId,\n handleType,\n });\n // when the user is moving the mouse close to the edge of the canvas while connecting we move the canvas\n const autoPan = () => {\n if (!autoPanOnConnect) {\n return;\n }\n const [xMovement, yMovement] = calcAutoPan(connectionPosition, containerBounds);\n panBy({ x: xMovement, y: yMovement });\n autoPanId = requestAnimationFrame(autoPan);\n };\n setState({\n connectionPosition,\n connectionStatus: null,\n // connectionNodeId etc will be removed in the next major in favor of connectionStartHandle\n connectionNodeId: nodeId,\n connectionHandleId: handleId,\n connectionHandleType: handleType,\n connectionStartHandle: {\n nodeId,\n handleId,\n type: handleType,\n },\n connectionEndHandle: null,\n });\n onConnectStart?.(event, { nodeId, handleId, handleType });\n function onPointerMove(event) {\n const { transform } = getState();\n connectionPosition = getEventPosition(event, containerBounds);\n closestHandle = getClosestHandle(pointToRendererPoint(connectionPosition, transform, false, [1, 1]), connectionRadius, handleLookup);\n if (!autoPanStarted) {\n autoPan();\n autoPanStarted = true;\n }\n const result = isValidHandle(event, closestHandle, connectionMode, nodeId, handleId, isTarget ? 'target' : 'source', isValidConnection, doc);\n handleDomNode = result.handleDomNode;\n connection = result.connection;\n isValid = result.isValid;\n setState({\n connectionPosition: closestHandle && isValid\n ? rendererPointToPoint({\n x: closestHandle.x,\n y: closestHandle.y,\n }, transform)\n : connectionPosition,\n connectionStatus: getConnectionStatus(!!closestHandle, isValid),\n connectionEndHandle: result.endHandle,\n });\n if (!closestHandle && !isValid && !handleDomNode) {\n return resetRecentHandle(prevActiveHandle);\n }\n if (connection.source !== connection.target && handleDomNode) {\n resetRecentHandle(prevActiveHandle);\n prevActiveHandle = handleDomNode;\n // @todo: remove the old class names \"react-flow__handle-\" in the next major version\n handleDomNode.classList.add('connecting', 'react-flow__handle-connecting');\n handleDomNode.classList.toggle('valid', isValid);\n handleDomNode.classList.toggle('react-flow__handle-valid', isValid);\n }\n }\n function onPointerUp(event) {\n if ((closestHandle || handleDomNode) && connection && isValid) {\n onConnect?.(connection);\n }\n // it's important to get a fresh reference from the store here\n // in order to get the latest state of onConnectEnd\n getState().onConnectEnd?.(event);\n if (edgeUpdaterType) {\n onEdgeUpdateEnd?.(event);\n }\n resetRecentHandle(prevActiveHandle);\n cancelConnection();\n cancelAnimationFrame(autoPanId);\n autoPanStarted = false;\n isValid = false;\n connection = null;\n handleDomNode = null;\n doc.removeEventListener('mousemove', onPointerMove);\n doc.removeEventListener('mouseup', onPointerUp);\n doc.removeEventListener('touchmove', onPointerMove);\n doc.removeEventListener('touchend', onPointerUp);\n }\n doc.addEventListener('mousemove', onPointerMove);\n doc.addEventListener('mouseup', onPointerUp);\n doc.addEventListener('touchmove', onPointerMove);\n doc.addEventListener('touchend', onPointerUp);\n}\n\nconst alwaysValid = () => true;\nconst selector$f = (s) => ({\n connectionStartHandle: s.connectionStartHandle,\n connectOnClick: s.connectOnClick,\n noPanClassName: s.noPanClassName,\n});\nconst connectingSelector = (nodeId, handleId, type) => (state) => {\n const { connectionStartHandle: startHandle, connectionEndHandle: endHandle, connectionClickStartHandle: clickHandle, } = state;\n return {\n connecting: (startHandle?.nodeId === nodeId && startHandle?.handleId === handleId && startHandle?.type === type) ||\n (endHandle?.nodeId === nodeId && endHandle?.handleId === handleId && endHandle?.type === type),\n clickConnecting: clickHandle?.nodeId === nodeId && clickHandle?.handleId === handleId && clickHandle?.type === type,\n };\n};\nconst Handle = forwardRef(({ type = 'source', position = Position.Top, isValidConnection, isConnectable = true, isConnectableStart = true, isConnectableEnd = true, id, onConnect, children, className, onMouseDown, onTouchStart, ...rest }, ref) => {\n const handleId = id || null;\n const isTarget = type === 'target';\n const store = useStoreApi();\n const nodeId = useNodeId();\n const { connectOnClick, noPanClassName } = useStore(selector$f, shallow);\n const { connecting, clickConnecting } = useStore(connectingSelector(nodeId, handleId, type), shallow);\n if (!nodeId) {\n store.getState().onError?.('010', errorMessages['error010']());\n }\n const onConnectExtended = (params) => {\n const { defaultEdgeOptions, onConnect: onConnectAction, hasDefaultEdges } = store.getState();\n const edgeParams = {\n ...defaultEdgeOptions,\n ...params,\n };\n if (hasDefaultEdges) {\n const { edges, setEdges } = store.getState();\n setEdges(addEdge(edgeParams, edges));\n }\n onConnectAction?.(edgeParams);\n onConnect?.(edgeParams);\n };\n const onPointerDown = (event) => {\n if (!nodeId) {\n return;\n }\n const isMouseTriggered = isMouseEvent(event);\n if (isConnectableStart && ((isMouseTriggered && event.button === 0) || !isMouseTriggered)) {\n handlePointerDown({\n event,\n handleId,\n nodeId,\n onConnect: onConnectExtended,\n isTarget,\n getState: store.getState,\n setState: store.setState,\n isValidConnection: isValidConnection || store.getState().isValidConnection || alwaysValid,\n });\n }\n if (isMouseTriggered) {\n onMouseDown?.(event);\n }\n else {\n onTouchStart?.(event);\n }\n };\n const onClick = (event) => {\n const { onClickConnectStart, onClickConnectEnd, connectionClickStartHandle, connectionMode, isValidConnection: isValidConnectionStore, } = store.getState();\n if (!nodeId || (!connectionClickStartHandle && !isConnectableStart)) {\n return;\n }\n if (!connectionClickStartHandle) {\n onClickConnectStart?.(event, { nodeId, handleId, handleType: type });\n store.setState({ connectionClickStartHandle: { nodeId, type, handleId } });\n return;\n }\n const doc = getHostForElement(event.target);\n const isValidConnectionHandler = isValidConnection || isValidConnectionStore || alwaysValid;\n const { connection, isValid } = isValidHandle(event, {\n nodeId,\n id: handleId,\n type,\n }, connectionMode, connectionClickStartHandle.nodeId, connectionClickStartHandle.handleId || null, connectionClickStartHandle.type, isValidConnectionHandler, doc);\n if (isValid) {\n onConnectExtended(connection);\n }\n onClickConnectEnd?.(event);\n store.setState({ connectionClickStartHandle: null });\n };\n return (jsx(\"div\", { \"data-handleid\": handleId, \"data-nodeid\": nodeId, \"data-handlepos\": position, \"data-id\": `${nodeId}-${handleId}-${type}`, className: cc([\n 'react-flow__handle',\n `react-flow__handle-${position}`,\n 'nodrag',\n noPanClassName,\n className,\n {\n source: !isTarget,\n target: isTarget,\n connectable: isConnectable,\n connectablestart: isConnectableStart,\n connectableend: isConnectableEnd,\n connecting: clickConnecting,\n // this class is used to style the handle when the user is connecting\n connectionindicator: isConnectable && ((isConnectableStart && !connecting) || (isConnectableEnd && connecting)),\n },\n ]), onMouseDown: onPointerDown, onTouchStart: onPointerDown, onClick: connectOnClick ? onClick : undefined, ref: ref, ...rest, children: children }));\n});\nHandle.displayName = 'Handle';\nvar Handle$1 = memo(Handle);\n\nconst DefaultNode = ({ data, isConnectable, targetPosition = Position.Top, sourcePosition = Position.Bottom, }) => {\n return (jsxs(Fragment, { children: [jsx(Handle$1, { type: \"target\", position: targetPosition, isConnectable: isConnectable }), data?.label, jsx(Handle$1, { type: \"source\", position: sourcePosition, isConnectable: isConnectable })] }));\n};\nDefaultNode.displayName = 'DefaultNode';\nvar DefaultNode$1 = memo(DefaultNode);\n\nconst InputNode = ({ data, isConnectable, sourcePosition = Position.Bottom }) => (jsxs(Fragment, { children: [data?.label, jsx(Handle$1, { type: \"source\", position: sourcePosition, isConnectable: isConnectable })] }));\nInputNode.displayName = 'InputNode';\nvar InputNode$1 = memo(InputNode);\n\nconst OutputNode = ({ data, isConnectable, targetPosition = Position.Top }) => (jsxs(Fragment, { children: [jsx(Handle$1, { type: \"target\", position: targetPosition, isConnectable: isConnectable }), data?.label] }));\nOutputNode.displayName = 'OutputNode';\nvar OutputNode$1 = memo(OutputNode);\n\nconst GroupNode = () => null;\nGroupNode.displayName = 'GroupNode';\n\nconst selector$e = (s) => ({\n selectedNodes: s.getNodes().filter((n) => n.selected),\n selectedEdges: s.edges.filter((e) => e.selected),\n});\nconst selectId = (obj) => obj.id;\nfunction areEqual(a, b) {\n return (shallow(a.selectedNodes.map(selectId), b.selectedNodes.map(selectId)) &&\n shallow(a.selectedEdges.map(selectId), b.selectedEdges.map(selectId)));\n}\n// This is just a helper component for calling the onSelectionChange listener.\n// @TODO: Now that we have the onNodesChange and on EdgesChange listeners, do we still need this component?\nconst SelectionListener = memo(({ onSelectionChange }) => {\n const store = useStoreApi();\n const { selectedNodes, selectedEdges } = useStore(selector$e, areEqual);\n useEffect(() => {\n const params = { nodes: selectedNodes, edges: selectedEdges };\n onSelectionChange?.(params);\n store.getState().onSelectionChange?.(params);\n }, [selectedNodes, selectedEdges, onSelectionChange]);\n return null;\n});\nSelectionListener.displayName = 'SelectionListener';\nconst changeSelector = (s) => !!s.onSelectionChange;\nfunction Wrapper$1({ onSelectionChange }) {\n const storeHasSelectionChange = useStore(changeSelector);\n if (onSelectionChange || storeHasSelectionChange) {\n return jsx(SelectionListener, { onSelectionChange: onSelectionChange });\n }\n return null;\n}\n\nconst selector$d = (s) => ({\n setNodes: s.setNodes,\n setEdges: s.setEdges,\n setDefaultNodesAndEdges: s.setDefaultNodesAndEdges,\n setMinZoom: s.setMinZoom,\n setMaxZoom: s.setMaxZoom,\n setTranslateExtent: s.setTranslateExtent,\n setNodeExtent: s.setNodeExtent,\n reset: s.reset,\n});\nfunction useStoreUpdater(value, setStoreState) {\n useEffect(() => {\n if (typeof value !== 'undefined') {\n setStoreState(value);\n }\n }, [value]);\n}\n// updates with values in store that don't have a dedicated setter function\nfunction useDirectStoreUpdater(key, value, setState) {\n useEffect(() => {\n if (typeof value !== 'undefined') {\n setState({ [key]: value });\n }\n }, [value]);\n}\nconst StoreUpdater = ({ nodes, edges, defaultNodes, defaultEdges, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, nodesDraggable, nodesConnectable, nodesFocusable, edgesFocusable, edgesUpdatable, elevateNodesOnSelect, minZoom, maxZoom, nodeExtent, onNodesChange, onEdgesChange, elementsSelectable, connectionMode, snapGrid, snapToGrid, translateExtent, connectOnClick, defaultEdgeOptions, fitView, fitViewOptions, onNodesDelete, onEdgesDelete, onNodeDrag, onNodeDragStart, onNodeDragStop, onSelectionDrag, onSelectionDragStart, onSelectionDragStop, noPanClassName, nodeOrigin, rfId, autoPanOnConnect, autoPanOnNodeDrag, onError, connectionRadius, isValidConnection, }) => {\n const { setNodes, setEdges, setDefaultNodesAndEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, } = useStore(selector$d, shallow);\n const store = useStoreApi();\n useEffect(() => {\n const edgesWithDefaults = defaultEdges?.map((e) => ({ ...e, ...defaultEdgeOptions }));\n setDefaultNodesAndEdges(defaultNodes, edgesWithDefaults);\n return () => {\n reset();\n };\n }, []);\n useDirectStoreUpdater('defaultEdgeOptions', defaultEdgeOptions, store.setState);\n useDirectStoreUpdater('connectionMode', connectionMode, store.setState);\n useDirectStoreUpdater('onConnect', onConnect, store.setState);\n useDirectStoreUpdater('onConnectStart', onConnectStart, store.setState);\n useDirectStoreUpdater('onConnectEnd', onConnectEnd, store.setState);\n useDirectStoreUpdater('onClickConnectStart', onClickConnectStart, store.setState);\n useDirectStoreUpdater('onClickConnectEnd', onClickConnectEnd, store.setState);\n useDirectStoreUpdater('nodesDraggable', nodesDraggable, store.setState);\n useDirectStoreUpdater('nodesConnectable', nodesConnectable, store.setState);\n useDirectStoreUpdater('nodesFocusable', nodesFocusable, store.setState);\n useDirectStoreUpdater('edgesFocusable', edgesFocusable, store.setState);\n useDirectStoreUpdater('edgesUpdatable', edgesUpdatable, store.setState);\n useDirectStoreUpdater('elementsSelectable', elementsSelectable, store.setState);\n useDirectStoreUpdater('elevateNodesOnSelect', elevateNodesOnSelect, store.setState);\n useDirectStoreUpdater('snapToGrid', snapToGrid, store.setState);\n useDirectStoreUpdater('snapGrid', snapGrid, store.setState);\n useDirectStoreUpdater('onNodesChange', onNodesChange, store.setState);\n useDirectStoreUpdater('onEdgesChange', onEdgesChange, store.setState);\n useDirectStoreUpdater('connectOnClick', connectOnClick, store.setState);\n useDirectStoreUpdater('fitViewOnInit', fitView, store.setState);\n useDirectStoreUpdater('fitViewOnInitOptions', fitViewOptions, store.setState);\n useDirectStoreUpdater('onNodesDelete', onNodesDelete, store.setState);\n useDirectStoreUpdater('onEdgesDelete', onEdgesDelete, store.setState);\n useDirectStoreUpdater('onNodeDrag', onNodeDrag, store.setState);\n useDirectStoreUpdater('onNodeDragStart', onNodeDragStart, store.setState);\n useDirectStoreUpdater('onNodeDragStop', onNodeDragStop, store.setState);\n useDirectStoreUpdater('onSelectionDrag', onSelectionDrag, store.setState);\n useDirectStoreUpdater('onSelectionDragStart', onSelectionDragStart, store.setState);\n useDirectStoreUpdater('onSelectionDragStop', onSelectionDragStop, store.setState);\n useDirectStoreUpdater('noPanClassName', noPanClassName, store.setState);\n useDirectStoreUpdater('nodeOrigin', nodeOrigin, store.setState);\n useDirectStoreUpdater('rfId', rfId, store.setState);\n useDirectStoreUpdater('autoPanOnConnect', autoPanOnConnect, store.setState);\n useDirectStoreUpdater('autoPanOnNodeDrag', autoPanOnNodeDrag, store.setState);\n useDirectStoreUpdater('onError', onError, store.setState);\n useDirectStoreUpdater('connectionRadius', connectionRadius, store.setState);\n useDirectStoreUpdater('isValidConnection', isValidConnection, store.setState);\n useStoreUpdater(nodes, setNodes);\n useStoreUpdater(edges, setEdges);\n useStoreUpdater(minZoom, setMinZoom);\n useStoreUpdater(maxZoom, setMaxZoom);\n useStoreUpdater(translateExtent, setTranslateExtent);\n useStoreUpdater(nodeExtent, setNodeExtent);\n return null;\n};\n\nconst style = { display: 'none' };\nconst ariaLiveStyle = {\n position: 'absolute',\n width: 1,\n height: 1,\n margin: -1,\n border: 0,\n padding: 0,\n overflow: 'hidden',\n clip: 'rect(0px, 0px, 0px, 0px)',\n clipPath: 'inset(100%)',\n};\nconst ARIA_NODE_DESC_KEY = 'react-flow__node-desc';\nconst ARIA_EDGE_DESC_KEY = 'react-flow__edge-desc';\nconst ARIA_LIVE_MESSAGE = 'react-flow__aria-live';\nconst selector$c = (s) => s.ariaLiveMessage;\nfunction AriaLiveMessage({ rfId }) {\n const ariaLiveMessage = useStore(selector$c);\n return (jsx(\"div\", { id: `${ARIA_LIVE_MESSAGE}-${rfId}`, \"aria-live\": \"assertive\", \"aria-atomic\": \"true\", style: ariaLiveStyle, children: ariaLiveMessage }));\n}\nfunction A11yDescriptions({ rfId, disableKeyboardA11y }) {\n return (jsxs(Fragment, { children: [jsxs(\"div\", { id: `${ARIA_NODE_DESC_KEY}-${rfId}`, style: style, children: [\"Press enter or space to select a node.\", !disableKeyboardA11y && 'You can then use the arrow keys to move the node around.', \" Press delete to remove it and escape to cancel.\", ' '] }), jsx(\"div\", { id: `${ARIA_EDGE_DESC_KEY}-${rfId}`, style: style, children: \"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.\" }), !disableKeyboardA11y && jsx(AriaLiveMessage, { rfId: rfId })] }));\n}\n\nconst shiftX = (x, shift, position) => {\n if (position === Position.Left)\n return x - shift;\n if (position === Position.Right)\n return x + shift;\n return x;\n};\nconst shiftY = (y, shift, position) => {\n if (position === Position.Top)\n return y - shift;\n if (position === Position.Bottom)\n return y + shift;\n return y;\n};\nconst EdgeUpdaterClassName = 'react-flow__edgeupdater';\nconst EdgeAnchor = ({ position, centerX, centerY, radius = 10, onMouseDown, onMouseEnter, onMouseOut, type, }) => (jsx(\"circle\", { onMouseDown: onMouseDown, onMouseEnter: onMouseEnter, onMouseOut: onMouseOut, className: cc([EdgeUpdaterClassName, `${EdgeUpdaterClassName}-${type}`]), cx: shiftX(centerX, radius, position), cy: shiftY(centerY, radius, position), r: radius, stroke: \"transparent\", fill: \"transparent\" }));\n\nconst alwaysValidConnection = () => true;\nvar wrapEdge = (EdgeComponent) => {\n const EdgeWrapper = ({ id, className, type, data, onClick, onEdgeDoubleClick, selected, animated, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, source, target, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, elementsSelectable, hidden, sourceHandleId, targetHandleId, onContextMenu, onMouseEnter, onMouseMove, onMouseLeave, edgeUpdaterRadius, onEdgeUpdate, onEdgeUpdateStart, onEdgeUpdateEnd, markerEnd, markerStart, rfId, ariaLabel, isFocusable, isUpdatable, pathOptions, interactionWidth, }) => {\n const edgeRef = useRef(null);\n const [updateHover, setUpdateHover] = useState(false);\n const [updating, setUpdating] = useState(false);\n const store = useStoreApi();\n const markerStartUrl = useMemo(() => `url(#${getMarkerId(markerStart, rfId)})`, [markerStart, rfId]);\n const markerEndUrl = useMemo(() => `url(#${getMarkerId(markerEnd, rfId)})`, [markerEnd, rfId]);\n if (hidden) {\n return null;\n }\n const onEdgeClick = (event) => {\n const { edges, addSelectedEdges } = store.getState();\n if (elementsSelectable) {\n store.setState({ nodesSelectionActive: false });\n addSelectedEdges([id]);\n }\n if (onClick) {\n const edge = edges.find((e) => e.id === id);\n onClick(event, edge);\n }\n };\n const onEdgeDoubleClickHandler = getMouseHandler$1(id, store.getState, onEdgeDoubleClick);\n const onEdgeContextMenu = getMouseHandler$1(id, store.getState, onContextMenu);\n const onEdgeMouseEnter = getMouseHandler$1(id, store.getState, onMouseEnter);\n const onEdgeMouseMove = getMouseHandler$1(id, store.getState, onMouseMove);\n const onEdgeMouseLeave = getMouseHandler$1(id, store.getState, onMouseLeave);\n const handleEdgeUpdater = (event, isSourceHandle) => {\n // avoid triggering edge updater if mouse btn is not left\n if (event.button !== 0) {\n return;\n }\n const { edges, isValidConnection: isValidConnectionStore } = store.getState();\n const nodeId = isSourceHandle ? target : source;\n const handleId = (isSourceHandle ? targetHandleId : sourceHandleId) || null;\n const handleType = isSourceHandle ? 'target' : 'source';\n const isValidConnection = isValidConnectionStore || alwaysValidConnection;\n const isTarget = isSourceHandle;\n const edge = edges.find((e) => e.id === id);\n setUpdating(true);\n onEdgeUpdateStart?.(event, edge, handleType);\n const _onEdgeUpdateEnd = (evt) => {\n setUpdating(false);\n onEdgeUpdateEnd?.(evt, edge, handleType);\n };\n const onConnectEdge = (connection) => onEdgeUpdate?.(edge, connection);\n handlePointerDown({\n event,\n handleId,\n nodeId,\n onConnect: onConnectEdge,\n isTarget,\n getState: store.getState,\n setState: store.setState,\n isValidConnection,\n edgeUpdaterType: handleType,\n onEdgeUpdateEnd: _onEdgeUpdateEnd,\n });\n };\n const onEdgeUpdaterSourceMouseDown = (event) => handleEdgeUpdater(event, true);\n const onEdgeUpdaterTargetMouseDown = (event) => handleEdgeUpdater(event, false);\n const onEdgeUpdaterMouseEnter = () => setUpdateHover(true);\n const onEdgeUpdaterMouseOut = () => setUpdateHover(false);\n const inactive = !elementsSelectable && !onClick;\n const onKeyDown = (event) => {\n if (elementSelectionKeys.includes(event.key) && elementsSelectable) {\n const { unselectNodesAndEdges, addSelectedEdges, edges } = store.getState();\n const unselect = event.key === 'Escape';\n if (unselect) {\n edgeRef.current?.blur();\n unselectNodesAndEdges({ edges: [edges.find((e) => e.id === id)] });\n }\n else {\n addSelectedEdges([id]);\n }\n }\n };\n return (jsxs(\"g\", { className: cc([\n 'react-flow__edge',\n `react-flow__edge-${type}`,\n className,\n { selected, animated, inactive, updating: updateHover },\n ]), onClick: onEdgeClick, onDoubleClick: onEdgeDoubleClickHandler, onContextMenu: onEdgeContextMenu, onMouseEnter: onEdgeMouseEnter, onMouseMove: onEdgeMouseMove, onMouseLeave: onEdgeMouseLeave, onKeyDown: isFocusable ? onKeyDown : undefined, tabIndex: isFocusable ? 0 : undefined, role: isFocusable ? 'button' : undefined, \"data-testid\": `rf__edge-${id}`, \"aria-label\": ariaLabel === null ? undefined : ariaLabel ? ariaLabel : `Edge from ${source} to ${target}`, \"aria-describedby\": isFocusable ? `${ARIA_EDGE_DESC_KEY}-${rfId}` : undefined, ref: edgeRef, children: [!updating && (jsx(EdgeComponent, { id: id, source: source, target: target, selected: selected, animated: animated, label: label, labelStyle: labelStyle, labelShowBg: labelShowBg, labelBgStyle: labelBgStyle, labelBgPadding: labelBgPadding, labelBgBorderRadius: labelBgBorderRadius, data: data, style: style, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, sourceHandleId: sourceHandleId, targetHandleId: targetHandleId, markerStart: markerStartUrl, markerEnd: markerEndUrl, pathOptions: pathOptions, interactionWidth: interactionWidth })), isUpdatable && (jsxs(Fragment, { children: [(isUpdatable === 'source' || isUpdatable === true) && (jsx(EdgeAnchor, { position: sourcePosition, centerX: sourceX, centerY: sourceY, radius: edgeUpdaterRadius, onMouseDown: onEdgeUpdaterSourceMouseDown, onMouseEnter: onEdgeUpdaterMouseEnter, onMouseOut: onEdgeUpdaterMouseOut, type: \"source\" })), (isUpdatable === 'target' || isUpdatable === true) && (jsx(EdgeAnchor, { position: targetPosition, centerX: targetX, centerY: targetY, radius: edgeUpdaterRadius, onMouseDown: onEdgeUpdaterTargetMouseDown, onMouseEnter: onEdgeUpdaterMouseEnter, onMouseOut: onEdgeUpdaterMouseOut, type: \"target\" }))] }))] }));\n };\n EdgeWrapper.displayName = 'EdgeWrapper';\n return memo(EdgeWrapper);\n};\n\nfunction createEdgeTypes(edgeTypes) {\n const standardTypes = {\n default: wrapEdge((edgeTypes.default || BezierEdge)),\n straight: wrapEdge((edgeTypes.bezier || StraightEdge)),\n step: wrapEdge((edgeTypes.step || StepEdge)),\n smoothstep: wrapEdge((edgeTypes.step || SmoothStepEdge)),\n simplebezier: wrapEdge((edgeTypes.simplebezier || SimpleBezierEdge)),\n };\n const wrappedTypes = {};\n const specialTypes = Object.keys(edgeTypes)\n .filter((k) => !['default', 'bezier'].includes(k))\n .reduce((res, key) => {\n res[key] = wrapEdge((edgeTypes[key] || BezierEdge));\n return res;\n }, wrappedTypes);\n return {\n ...standardTypes,\n ...specialTypes,\n };\n}\nfunction getHandlePosition(position, nodeRect, handle = null) {\n const x = (handle?.x || 0) + nodeRect.x;\n const y = (handle?.y || 0) + nodeRect.y;\n const width = handle?.width || nodeRect.width;\n const height = handle?.height || nodeRect.height;\n switch (position) {\n case Position.Top:\n return {\n x: x + width / 2,\n y,\n };\n case Position.Right:\n return {\n x: x + width,\n y: y + height / 2,\n };\n case Position.Bottom:\n return {\n x: x + width / 2,\n y: y + height,\n };\n case Position.Left:\n return {\n x,\n y: y + height / 2,\n };\n }\n}\nfunction getHandle(bounds, handleId) {\n if (!bounds) {\n return null;\n }\n if (bounds.length === 1 || !handleId) {\n return bounds[0];\n }\n else if (handleId) {\n return bounds.find((d) => d.id === handleId) || null;\n }\n return null;\n}\nconst getEdgePositions = (sourceNodeRect, sourceHandle, sourcePosition, targetNodeRect, targetHandle, targetPosition) => {\n const sourceHandlePos = getHandlePosition(sourcePosition, sourceNodeRect, sourceHandle);\n const targetHandlePos = getHandlePosition(targetPosition, targetNodeRect, targetHandle);\n return {\n sourceX: sourceHandlePos.x,\n sourceY: sourceHandlePos.y,\n targetX: targetHandlePos.x,\n targetY: targetHandlePos.y,\n };\n};\nfunction isEdgeVisible({ sourcePos, targetPos, sourceWidth, sourceHeight, targetWidth, targetHeight, width, height, transform, }) {\n const edgeBox = {\n x: Math.min(sourcePos.x, targetPos.x),\n y: Math.min(sourcePos.y, targetPos.y),\n x2: Math.max(sourcePos.x + sourceWidth, targetPos.x + targetWidth),\n y2: Math.max(sourcePos.y + sourceHeight, targetPos.y + targetHeight),\n };\n if (edgeBox.x === edgeBox.x2) {\n edgeBox.x2 += 1;\n }\n if (edgeBox.y === edgeBox.y2) {\n edgeBox.y2 += 1;\n }\n const viewBox = rectToBox({\n x: (0 - transform[0]) / transform[2],\n y: (0 - transform[1]) / transform[2],\n width: width / transform[2],\n height: height / transform[2],\n });\n const xOverlap = Math.max(0, Math.min(viewBox.x2, edgeBox.x2) - Math.max(viewBox.x, edgeBox.x));\n const yOverlap = Math.max(0, Math.min(viewBox.y2, edgeBox.y2) - Math.max(viewBox.y, edgeBox.y));\n const overlappingArea = Math.ceil(xOverlap * yOverlap);\n return overlappingArea > 0;\n}\nfunction getNodeData(node) {\n const handleBounds = node?.[internalsSymbol]?.handleBounds || null;\n const isValid = handleBounds &&\n node?.width &&\n node?.height &&\n typeof node?.positionAbsolute?.x !== 'undefined' &&\n typeof node?.positionAbsolute?.y !== 'undefined';\n return [\n {\n x: node?.positionAbsolute?.x || 0,\n y: node?.positionAbsolute?.y || 0,\n width: node?.width || 0,\n height: node?.height || 0,\n },\n handleBounds,\n !!isValid,\n ];\n}\n\nfunction isParentSelected(node, nodeInternals) {\n if (!node.parentNode) {\n return false;\n }\n const parentNode = nodeInternals.get(node.parentNode);\n if (!parentNode) {\n return false;\n }\n if (parentNode.selected) {\n return true;\n }\n return isParentSelected(parentNode, nodeInternals);\n}\nfunction hasSelector(target, selector, nodeRef) {\n let current = target;\n do {\n if (current?.matches(selector))\n return true;\n if (current === nodeRef.current)\n return false;\n current = current.parentElement;\n } while (current);\n return false;\n}\n// looks for all selected nodes and created a NodeDragItem for each of them\nfunction getDragItems(nodeInternals, nodesDraggable, mousePos, nodeId) {\n return Array.from(nodeInternals.values())\n .filter((n) => (n.selected || n.id === nodeId) &&\n (!n.parentNode || !isParentSelected(n, nodeInternals)) &&\n (n.draggable || (nodesDraggable && typeof n.draggable === 'undefined')))\n .map((n) => ({\n id: n.id,\n position: n.position || { x: 0, y: 0 },\n positionAbsolute: n.positionAbsolute || { x: 0, y: 0 },\n distance: {\n x: mousePos.x - (n.positionAbsolute?.x ?? 0),\n y: mousePos.y - (n.positionAbsolute?.y ?? 0),\n },\n delta: {\n x: 0,\n y: 0,\n },\n extent: n.extent,\n parentNode: n.parentNode,\n width: n.width,\n height: n.height,\n }));\n}\nfunction calcNextPosition(node, nextPosition, nodeInternals, nodeExtent, nodeOrigin = [0, 0], onError) {\n let currentExtent = node.extent || nodeExtent;\n if (node.extent === 'parent') {\n if (node.parentNode && node.width && node.height) {\n const parent = nodeInternals.get(node.parentNode);\n const { x: parentX, y: parentY } = getNodePositionWithOrigin(parent, nodeOrigin).positionAbsolute;\n currentExtent =\n parent && isNumeric(parentX) && isNumeric(parentY) && isNumeric(parent.width) && isNumeric(parent.height)\n ? [\n [parentX + node.width * nodeOrigin[0], parentY + node.height * nodeOrigin[1]],\n [\n parentX + parent.width - node.width + node.width * nodeOrigin[0],\n parentY + parent.height - node.height + node.height * nodeOrigin[1],\n ],\n ]\n : currentExtent;\n }\n else {\n onError?.('005', errorMessages['error005']());\n currentExtent = nodeExtent;\n }\n }\n else if (node.extent && node.parentNode) {\n const parent = nodeInternals.get(node.parentNode);\n const { x: parentX, y: parentY } = getNodePositionWithOrigin(parent, nodeOrigin).positionAbsolute;\n currentExtent = [\n [node.extent[0][0] + parentX, node.extent[0][1] + parentY],\n [node.extent[1][0] + parentX, node.extent[1][1] + parentY],\n ];\n }\n let parentPosition = { x: 0, y: 0 };\n if (node.parentNode) {\n const parentNode = nodeInternals.get(node.parentNode);\n parentPosition = getNodePositionWithOrigin(parentNode, nodeOrigin).positionAbsolute;\n }\n const positionAbsolute = currentExtent\n ? clampPosition(nextPosition, currentExtent)\n : nextPosition;\n return {\n position: {\n x: positionAbsolute.x - parentPosition.x,\n y: positionAbsolute.y - parentPosition.y,\n },\n positionAbsolute,\n };\n}\n// returns two params:\n// 1. the dragged node (or the first of the list, if we are dragging a node selection)\n// 2. array of selected nodes (for multi selections)\nfunction getEventHandlerParams({ nodeId, dragItems, nodeInternals, }) {\n const extentedDragItems = dragItems.map((n) => {\n const node = nodeInternals.get(n.id);\n return {\n ...node,\n position: n.position,\n positionAbsolute: n.positionAbsolute,\n };\n });\n return [nodeId ? extentedDragItems.find((n) => n.id === nodeId) : extentedDragItems[0], extentedDragItems];\n}\n\nconst getHandleBounds = (selector, nodeElement, zoom, nodeOrigin) => {\n const handles = nodeElement.querySelectorAll(selector);\n if (!handles || !handles.length) {\n return null;\n }\n const handlesArray = Array.from(handles);\n const nodeBounds = nodeElement.getBoundingClientRect();\n const nodeOffset = {\n x: nodeBounds.width * nodeOrigin[0],\n y: nodeBounds.height * nodeOrigin[1],\n };\n return handlesArray.map((handle) => {\n const handleBounds = handle.getBoundingClientRect();\n return {\n id: handle.getAttribute('data-handleid'),\n position: handle.getAttribute('data-handlepos'),\n x: (handleBounds.left - nodeBounds.left - nodeOffset.x) / zoom,\n y: (handleBounds.top - nodeBounds.top - nodeOffset.y) / zoom,\n ...getDimensions(handle),\n };\n });\n};\nfunction getMouseHandler(id, getState, handler) {\n return handler === undefined\n ? handler\n : (event) => {\n const node = getState().nodeInternals.get(id);\n handler(event, { ...node });\n };\n}\n// this handler is called by\n// 1. the click handler when node is not draggable or selectNodesOnDrag = false\n// or\n// 2. the on drag start handler when node is draggable and selectNodesOnDrag = true\nfunction handleNodeClick({ id, store, unselect = false, nodeRef, }) {\n const { addSelectedNodes, unselectNodesAndEdges, multiSelectionActive, nodeInternals } = store.getState();\n const node = nodeInternals.get(id);\n store.setState({ nodesSelectionActive: false });\n if (!node.selected) {\n addSelectedNodes([id]);\n }\n else if (unselect || (node.selected && multiSelectionActive)) {\n unselectNodesAndEdges({ nodes: [node] });\n requestAnimationFrame(() => nodeRef?.current?.blur());\n }\n}\n\nfunction useGetPointerPosition() {\n const store = useStoreApi();\n // returns the pointer position projected to the RF coordinate system\n const getPointerPosition = useCallback(({ sourceEvent }) => {\n const { transform, snapGrid, snapToGrid } = store.getState();\n const x = sourceEvent.touches ? sourceEvent.touches[0].clientX : sourceEvent.clientX;\n const y = sourceEvent.touches ? sourceEvent.touches[0].clientY : sourceEvent.clientY;\n const pointerPos = {\n x: (x - transform[0]) / transform[2],\n y: (y - transform[1]) / transform[2],\n };\n // we need the snapped position in order to be able to skip unnecessary drag events\n return {\n xSnapped: snapToGrid ? snapGrid[0] * Math.round(pointerPos.x / snapGrid[0]) : pointerPos.x,\n ySnapped: snapToGrid ? snapGrid[1] * Math.round(pointerPos.y / snapGrid[1]) : pointerPos.y,\n ...pointerPos,\n };\n }, []);\n return getPointerPosition;\n}\n\nfunction wrapSelectionDragFunc(selectionFunc) {\n return (event, _, nodes) => selectionFunc?.(event, nodes);\n}\nfunction useDrag({ nodeRef, disabled = false, noDragClassName, handleSelector, nodeId, isSelectable, selectNodesOnDrag, }) {\n const store = useStoreApi();\n const [dragging, setDragging] = useState(false);\n const dragItems = useRef([]);\n const lastPos = useRef({ x: null, y: null });\n const autoPanId = useRef(0);\n const containerBounds = useRef(null);\n const mousePosition = useRef({ x: 0, y: 0 });\n const dragEvent = useRef(null);\n const autoPanStarted = useRef(false);\n const getPointerPosition = useGetPointerPosition();\n useEffect(() => {\n if (nodeRef?.current) {\n const selection = select(nodeRef.current);\n const updateNodes = ({ x, y }) => {\n const { nodeInternals, onNodeDrag, onSelectionDrag, updateNodePositions, nodeExtent, snapGrid, snapToGrid, nodeOrigin, onError, } = store.getState();\n lastPos.current = { x, y };\n let hasChange = false;\n dragItems.current = dragItems.current.map((n) => {\n const nextPosition = { x: x - n.distance.x, y: y - n.distance.y };\n if (snapToGrid) {\n nextPosition.x = snapGrid[0] * Math.round(nextPosition.x / snapGrid[0]);\n nextPosition.y = snapGrid[1] * Math.round(nextPosition.y / snapGrid[1]);\n }\n const updatedPos = calcNextPosition(n, nextPosition, nodeInternals, nodeExtent, nodeOrigin, onError);\n // we want to make sure that we only fire a change event when there is a changes\n hasChange = hasChange || n.position.x !== updatedPos.position.x || n.position.y !== updatedPos.position.y;\n n.position = updatedPos.position;\n n.positionAbsolute = updatedPos.positionAbsolute;\n return n;\n });\n if (!hasChange) {\n return;\n }\n updateNodePositions(dragItems.current, true, true);\n setDragging(true);\n const onDrag = nodeId ? onNodeDrag : wrapSelectionDragFunc(onSelectionDrag);\n if (onDrag && dragEvent.current) {\n const [currentNode, nodes] = getEventHandlerParams({\n nodeId,\n dragItems: dragItems.current,\n nodeInternals,\n });\n onDrag(dragEvent.current, currentNode, nodes);\n }\n };\n const autoPan = () => {\n if (!containerBounds.current) {\n return;\n }\n const [xMovement, yMovement] = calcAutoPan(mousePosition.current, containerBounds.current);\n if (xMovement !== 0 || yMovement !== 0) {\n const { transform, panBy } = store.getState();\n lastPos.current.x = (lastPos.current.x ?? 0) - xMovement / transform[2];\n lastPos.current.y = (lastPos.current.y ?? 0) - yMovement / transform[2];\n if (panBy({ x: xMovement, y: yMovement })) {\n updateNodes(lastPos.current);\n }\n }\n autoPanId.current = requestAnimationFrame(autoPan);\n };\n if (disabled) {\n selection.on('.drag', null);\n }\n else {\n const dragHandler = drag()\n .on('start', (event) => {\n const { nodeInternals, multiSelectionActive, domNode, nodesDraggable, unselectNodesAndEdges, onNodeDragStart, onSelectionDragStart, } = store.getState();\n const onStart = nodeId ? onNodeDragStart : wrapSelectionDragFunc(onSelectionDragStart);\n if (!selectNodesOnDrag && !multiSelectionActive && nodeId) {\n if (!nodeInternals.get(nodeId)?.selected) {\n // we need to reset selected nodes when selectNodesOnDrag=false\n unselectNodesAndEdges();\n }\n }\n if (nodeId && isSelectable && selectNodesOnDrag) {\n handleNodeClick({\n id: nodeId,\n store,\n nodeRef: nodeRef,\n });\n }\n const pointerPos = getPointerPosition(event);\n lastPos.current = pointerPos;\n dragItems.current = getDragItems(nodeInternals, nodesDraggable, pointerPos, nodeId);\n if (onStart && dragItems.current) {\n const [currentNode, nodes] = getEventHandlerParams({\n nodeId,\n dragItems: dragItems.current,\n nodeInternals,\n });\n onStart(event.sourceEvent, currentNode, nodes);\n }\n containerBounds.current = domNode?.getBoundingClientRect() || null;\n mousePosition.current = getEventPosition(event.sourceEvent, containerBounds.current);\n })\n .on('drag', (event) => {\n const pointerPos = getPointerPosition(event);\n const { autoPanOnNodeDrag } = store.getState();\n if (!autoPanStarted.current && autoPanOnNodeDrag) {\n autoPanStarted.current = true;\n autoPan();\n }\n // skip events without movement\n if ((lastPos.current.x !== pointerPos.xSnapped || lastPos.current.y !== pointerPos.ySnapped) &&\n dragItems.current) {\n dragEvent.current = event.sourceEvent;\n mousePosition.current = getEventPosition(event.sourceEvent, containerBounds.current);\n updateNodes(pointerPos);\n }\n })\n .on('end', (event) => {\n setDragging(false);\n autoPanStarted.current = false;\n cancelAnimationFrame(autoPanId.current);\n if (dragItems.current) {\n const { updateNodePositions, nodeInternals, onNodeDragStop, onSelectionDragStop } = store.getState();\n const onStop = nodeId ? onNodeDragStop : wrapSelectionDragFunc(onSelectionDragStop);\n updateNodePositions(dragItems.current, false, false);\n if (onStop) {\n const [currentNode, nodes] = getEventHandlerParams({\n nodeId,\n dragItems: dragItems.current,\n nodeInternals,\n });\n onStop(event.sourceEvent, currentNode, nodes);\n }\n }\n })\n .filter((event) => {\n const target = event.target;\n const isDraggable = !event.button &&\n (!noDragClassName || !hasSelector(target, `.${noDragClassName}`, nodeRef)) &&\n (!handleSelector || hasSelector(target, handleSelector, nodeRef));\n return isDraggable;\n });\n selection.call(dragHandler);\n return () => {\n selection.on('.drag', null);\n };\n }\n }\n }, [\n nodeRef,\n disabled,\n noDragClassName,\n handleSelector,\n isSelectable,\n store,\n nodeId,\n selectNodesOnDrag,\n getPointerPosition,\n ]);\n return dragging;\n}\n\nfunction useUpdateNodePositions() {\n const store = useStoreApi();\n const updatePositions = useCallback((params) => {\n const { nodeInternals, nodeExtent, updateNodePositions, getNodes, snapToGrid, snapGrid, onError, nodesDraggable } = store.getState();\n const selectedNodes = getNodes().filter((n) => n.selected && (n.draggable || (nodesDraggable && typeof n.draggable === 'undefined')));\n // by default a node moves 5px on each key press, or 20px if shift is pressed\n // if snap grid is enabled, we use that for the velocity.\n const xVelo = snapToGrid ? snapGrid[0] : 5;\n const yVelo = snapToGrid ? snapGrid[1] : 5;\n const factor = params.isShiftPressed ? 4 : 1;\n const positionDiffX = params.x * xVelo * factor;\n const positionDiffY = params.y * yVelo * factor;\n const nodeUpdates = selectedNodes.map((n) => {\n if (n.positionAbsolute) {\n const nextPosition = { x: n.positionAbsolute.x + positionDiffX, y: n.positionAbsolute.y + positionDiffY };\n if (snapToGrid) {\n nextPosition.x = snapGrid[0] * Math.round(nextPosition.x / snapGrid[0]);\n nextPosition.y = snapGrid[1] * Math.round(nextPosition.y / snapGrid[1]);\n }\n const { positionAbsolute, position } = calcNextPosition(n, nextPosition, nodeInternals, nodeExtent, undefined, onError);\n n.position = position;\n n.positionAbsolute = positionAbsolute;\n }\n return n;\n });\n updateNodePositions(nodeUpdates, true, false);\n }, []);\n return updatePositions;\n}\n\nconst arrowKeyDiffs = {\n ArrowUp: { x: 0, y: -1 },\n ArrowDown: { x: 0, y: 1 },\n ArrowLeft: { x: -1, y: 0 },\n ArrowRight: { x: 1, y: 0 },\n};\nvar wrapNode = (NodeComponent) => {\n const NodeWrapper = ({ id, type, data, xPos, yPos, xPosOrigin, yPosOrigin, selected, onClick, onMouseEnter, onMouseMove, onMouseLeave, onContextMenu, onDoubleClick, style, className, isDraggable, isSelectable, isConnectable, isFocusable, selectNodesOnDrag, sourcePosition, targetPosition, hidden, resizeObserver, dragHandle, zIndex, isParent, noDragClassName, noPanClassName, initialized, disableKeyboardA11y, ariaLabel, rfId, }) => {\n const store = useStoreApi();\n const nodeRef = useRef(null);\n const prevSourcePosition = useRef(sourcePosition);\n const prevTargetPosition = useRef(targetPosition);\n const prevType = useRef(type);\n const hasPointerEvents = isSelectable || isDraggable || onClick || onMouseEnter || onMouseMove || onMouseLeave;\n const updatePositions = useUpdateNodePositions();\n const onMouseEnterHandler = getMouseHandler(id, store.getState, onMouseEnter);\n const onMouseMoveHandler = getMouseHandler(id, store.getState, onMouseMove);\n const onMouseLeaveHandler = getMouseHandler(id, store.getState, onMouseLeave);\n const onContextMenuHandler = getMouseHandler(id, store.getState, onContextMenu);\n const onDoubleClickHandler = getMouseHandler(id, store.getState, onDoubleClick);\n const onSelectNodeHandler = (event) => {\n if (isSelectable && (!selectNodesOnDrag || !isDraggable)) {\n // this handler gets called within the drag start event when selectNodesOnDrag=true\n handleNodeClick({\n id,\n store,\n nodeRef,\n });\n }\n if (onClick) {\n const node = store.getState().nodeInternals.get(id);\n onClick(event, { ...node });\n }\n };\n const onKeyDown = (event) => {\n if (isInputDOMNode(event)) {\n return;\n }\n if (elementSelectionKeys.includes(event.key) && isSelectable) {\n const unselect = event.key === 'Escape';\n handleNodeClick({\n id,\n store,\n unselect,\n nodeRef,\n });\n }\n else if (!disableKeyboardA11y &&\n isDraggable &&\n selected &&\n Object.prototype.hasOwnProperty.call(arrowKeyDiffs, event.key)) {\n store.setState({\n ariaLiveMessage: `Moved selected node ${event.key\n .replace('Arrow', '')\n .toLowerCase()}. New position, x: ${~~xPos}, y: ${~~yPos}`,\n });\n updatePositions({\n x: arrowKeyDiffs[event.key].x,\n y: arrowKeyDiffs[event.key].y,\n isShiftPressed: event.shiftKey,\n });\n }\n };\n useEffect(() => {\n if (nodeRef.current && !hidden) {\n const currNode = nodeRef.current;\n resizeObserver?.observe(currNode);\n return () => resizeObserver?.unobserve(currNode);\n }\n }, [hidden]);\n useEffect(() => {\n // when the user programmatically changes the source or handle position, we re-initialize the node\n const typeChanged = prevType.current !== type;\n const sourcePosChanged = prevSourcePosition.current !== sourcePosition;\n const targetPosChanged = prevTargetPosition.current !== targetPosition;\n if (nodeRef.current && (typeChanged || sourcePosChanged || targetPosChanged)) {\n if (typeChanged) {\n prevType.current = type;\n }\n if (sourcePosChanged) {\n prevSourcePosition.current = sourcePosition;\n }\n if (targetPosChanged) {\n prevTargetPosition.current = targetPosition;\n }\n store.getState().updateNodeDimensions([{ id, nodeElement: nodeRef.current, forceUpdate: true }]);\n }\n }, [id, type, sourcePosition, targetPosition]);\n const dragging = useDrag({\n nodeRef,\n disabled: hidden || !isDraggable,\n noDragClassName,\n handleSelector: dragHandle,\n nodeId: id,\n isSelectable,\n selectNodesOnDrag,\n });\n if (hidden) {\n return null;\n }\n return (jsx(\"div\", { className: cc([\n 'react-flow__node',\n `react-flow__node-${type}`,\n {\n // this is overwritable by passing `nopan` as a class name\n [noPanClassName]: isDraggable,\n },\n className,\n {\n selected,\n selectable: isSelectable,\n parent: isParent,\n dragging,\n },\n ]), ref: nodeRef, style: {\n zIndex,\n transform: `translate(${xPosOrigin}px,${yPosOrigin}px)`,\n pointerEvents: hasPointerEvents ? 'all' : 'none',\n visibility: initialized ? 'visible' : 'hidden',\n ...style,\n }, \"data-id\": id, \"data-testid\": `rf__node-${id}`, onMouseEnter: onMouseEnterHandler, onMouseMove: onMouseMoveHandler, onMouseLeave: onMouseLeaveHandler, onContextMenu: onContextMenuHandler, onClick: onSelectNodeHandler, onDoubleClick: onDoubleClickHandler, onKeyDown: isFocusable ? onKeyDown : undefined, tabIndex: isFocusable ? 0 : undefined, role: isFocusable ? 'button' : undefined, \"aria-describedby\": disableKeyboardA11y ? undefined : `${ARIA_NODE_DESC_KEY}-${rfId}`, \"aria-label\": ariaLabel, children: jsx(Provider, { value: id, children: jsx(NodeComponent, { id: id, data: data, type: type, xPos: xPos, yPos: yPos, selected: selected, isConnectable: isConnectable, sourcePosition: sourcePosition, targetPosition: targetPosition, dragging: dragging, dragHandle: dragHandle, zIndex: zIndex }) }) }));\n };\n NodeWrapper.displayName = 'NodeWrapper';\n return memo(NodeWrapper);\n};\n\nfunction createNodeTypes(nodeTypes) {\n const standardTypes = {\n input: wrapNode((nodeTypes.input || InputNode$1)),\n default: wrapNode((nodeTypes.default || DefaultNode$1)),\n output: wrapNode((nodeTypes.output || OutputNode$1)),\n group: wrapNode((nodeTypes.group || GroupNode)),\n };\n const wrappedTypes = {};\n const specialTypes = Object.keys(nodeTypes)\n .filter((k) => !['input', 'default', 'output', 'group'].includes(k))\n .reduce((res, key) => {\n res[key] = wrapNode((nodeTypes[key] || DefaultNode$1));\n return res;\n }, wrappedTypes);\n return {\n ...standardTypes,\n ...specialTypes,\n };\n}\nconst getPositionWithOrigin = ({ x, y, width, height, origin, }) => {\n if (!width || !height) {\n return { x, y };\n }\n if (origin[0] < 0 || origin[1] < 0 || origin[0] > 1 || origin[1] > 1) {\n return { x, y };\n }\n return {\n x: x - width * origin[0],\n y: y - height * origin[1],\n };\n};\n\nconst doc = typeof document !== 'undefined' ? document : null;\n// the keycode can be a string 'a' or an array of strings ['a', 'a+d']\n// a string means a single key 'a' or a combination when '+' is used 'a+d'\n// an array means different possibilites. Explainer: ['a', 'd+s'] here the\n// user can use the single key 'a' or the combination 'd' + 's'\nvar useKeyPress = (keyCode = null, options = { target: doc }) => {\n const [keyPressed, setKeyPressed] = useState(false);\n // we need to remember if a modifier key is pressed in order to track it\n const modifierPressed = useRef(false);\n // we need to remember the pressed keys in order to support combinations\n const pressedKeys = useRef(new Set([]));\n // keyCodes = array with single keys [['a']] or key combinations [['a', 's']]\n // keysToWatch = array with all keys flattened ['a', 'd', 'ShiftLeft']\n // used to check if we store event.code or event.key. When the code is in the list of keysToWatch\n // we use the code otherwise the key. Explainer: When you press the left \"command\" key, the code is \"MetaLeft\"\n // and the key is \"Meta\". We want users to be able to pass keys and codes so we assume that the key is meant when\n // we can't find it in the list of keysToWatch.\n const [keyCodes, keysToWatch] = useMemo(() => {\n if (keyCode !== null) {\n const keyCodeArr = Array.isArray(keyCode) ? keyCode : [keyCode];\n const keys = keyCodeArr.filter((kc) => typeof kc === 'string').map((kc) => kc.split('+'));\n const keysFlat = keys.reduce((res, item) => res.concat(...item), []);\n return [keys, keysFlat];\n }\n return [[], []];\n }, [keyCode]);\n useEffect(() => {\n if (keyCode !== null) {\n const downHandler = (event) => {\n modifierPressed.current = event.ctrlKey || event.metaKey || event.shiftKey;\n if (!modifierPressed.current && isInputDOMNode(event)) {\n return false;\n }\n const keyOrCode = useKeyOrCode(event.code, keysToWatch);\n pressedKeys.current.add(event[keyOrCode]);\n if (isMatchingKey(keyCodes, pressedKeys.current, false)) {\n event.preventDefault();\n setKeyPressed(true);\n }\n };\n const upHandler = (event) => {\n if (!modifierPressed.current && isInputDOMNode(event)) {\n return false;\n }\n const keyOrCode = useKeyOrCode(event.code, keysToWatch);\n if (isMatchingKey(keyCodes, pressedKeys.current, true)) {\n setKeyPressed(false);\n pressedKeys.current.clear();\n }\n else {\n pressedKeys.current.delete(event[keyOrCode]);\n }\n modifierPressed.current = false;\n };\n const resetHandler = () => {\n pressedKeys.current.clear();\n setKeyPressed(false);\n };\n options?.target?.addEventListener('keydown', downHandler);\n options?.target?.addEventListener('keyup', upHandler);\n window.addEventListener('blur', resetHandler);\n return () => {\n options?.target?.removeEventListener('keydown', downHandler);\n options?.target?.removeEventListener('keyup', upHandler);\n window.removeEventListener('blur', resetHandler);\n };\n }\n }, [keyCode, setKeyPressed]);\n return keyPressed;\n};\n// utils\nfunction isMatchingKey(keyCodes, pressedKeys, isUp) {\n return (keyCodes\n // we only want to compare same sizes of keyCode definitions\n // and pressed keys. When the user specified 'Meta' as a key somewhere\n // this would also be truthy without this filter when user presses 'Meta' + 'r'\n .filter((keys) => isUp || keys.length === pressedKeys.size)\n // since we want to support multiple possibilities only one of the\n // combinations need to be part of the pressed keys\n .some((keys) => keys.every((k) => pressedKeys.has(k))));\n}\nfunction useKeyOrCode(eventCode, keysToWatch) {\n return keysToWatch.includes(eventCode) ? 'code' : 'key';\n}\n\nfunction calculateXYZPosition(node, nodeInternals, result, nodeOrigin) {\n if (!node.parentNode) {\n return result;\n }\n const parentNode = nodeInternals.get(node.parentNode);\n const parentNodePosition = getNodePositionWithOrigin(parentNode, nodeOrigin);\n return calculateXYZPosition(parentNode, nodeInternals, {\n x: (result.x ?? 0) + parentNodePosition.x,\n y: (result.y ?? 0) + parentNodePosition.y,\n z: (parentNode[internalsSymbol]?.z ?? 0) > (result.z ?? 0) ? parentNode[internalsSymbol]?.z ?? 0 : result.z ?? 0,\n }, nodeOrigin);\n}\nfunction updateAbsoluteNodePositions(nodeInternals, nodeOrigin, parentNodes) {\n nodeInternals.forEach((node) => {\n if (node.parentNode && !nodeInternals.has(node.parentNode)) {\n throw new Error(`Parent node ${node.parentNode} not found`);\n }\n if (node.parentNode || parentNodes?.[node.id]) {\n const { x, y, z } = calculateXYZPosition(node, nodeInternals, {\n ...node.position,\n z: node[internalsSymbol]?.z ?? 0,\n }, nodeOrigin);\n node.positionAbsolute = {\n x,\n y,\n };\n node[internalsSymbol].z = z;\n if (parentNodes?.[node.id]) {\n node[internalsSymbol].isParent = true;\n }\n }\n });\n}\nfunction createNodeInternals(nodes, nodeInternals, nodeOrigin, elevateNodesOnSelect) {\n const nextNodeInternals = new Map();\n const parentNodes = {};\n const selectedNodeZ = elevateNodesOnSelect ? 1000 : 0;\n nodes.forEach((node) => {\n const z = (isNumeric(node.zIndex) ? node.zIndex : 0) + (node.selected ? selectedNodeZ : 0);\n const currInternals = nodeInternals.get(node.id);\n const internals = {\n width: currInternals?.width,\n height: currInternals?.height,\n ...node,\n positionAbsolute: {\n x: node.position.x,\n y: node.position.y,\n },\n };\n if (node.parentNode) {\n internals.parentNode = node.parentNode;\n parentNodes[node.parentNode] = true;\n }\n Object.defineProperty(internals, internalsSymbol, {\n enumerable: false,\n value: {\n handleBounds: currInternals?.[internalsSymbol]?.handleBounds,\n z,\n },\n });\n nextNodeInternals.set(node.id, internals);\n });\n updateAbsoluteNodePositions(nextNodeInternals, nodeOrigin, parentNodes);\n return nextNodeInternals;\n}\nfunction fitView(get, options = {}) {\n const { getNodes, width, height, minZoom, maxZoom, d3Zoom, d3Selection, fitViewOnInitDone, fitViewOnInit, nodeOrigin, } = get();\n const isInitialFitView = options.initial && !fitViewOnInitDone && fitViewOnInit;\n const d3initialized = d3Zoom && d3Selection;\n if (d3initialized && (isInitialFitView || !options.initial)) {\n const nodes = getNodes().filter((n) => {\n const isVisible = options.includeHiddenNodes ? n.width && n.height : !n.hidden;\n if (options.nodes?.length) {\n return isVisible && options.nodes.some((optionNode) => optionNode.id === n.id);\n }\n return isVisible;\n });\n const nodesInitialized = nodes.every((n) => n.width && n.height);\n if (nodes.length > 0 && nodesInitialized) {\n const bounds = getRectOfNodes(nodes, nodeOrigin);\n const [x, y, zoom] = getTransformForBounds(bounds, width, height, options.minZoom ?? minZoom, options.maxZoom ?? maxZoom, options.padding ?? 0.1);\n const nextTransform = zoomIdentity.translate(x, y).scale(zoom);\n if (typeof options.duration === 'number' && options.duration > 0) {\n d3Zoom.transform(getD3Transition(d3Selection, options.duration), nextTransform);\n }\n else {\n d3Zoom.transform(d3Selection, nextTransform);\n }\n return true;\n }\n }\n return false;\n}\nfunction handleControlledNodeSelectionChange(nodeChanges, nodeInternals) {\n nodeChanges.forEach((change) => {\n const node = nodeInternals.get(change.id);\n if (node) {\n nodeInternals.set(node.id, {\n ...node,\n [internalsSymbol]: node[internalsSymbol],\n selected: change.selected,\n });\n }\n });\n return new Map(nodeInternals);\n}\nfunction handleControlledEdgeSelectionChange(edgeChanges, edges) {\n return edges.map((e) => {\n const change = edgeChanges.find((change) => change.id === e.id);\n if (change) {\n e.selected = change.selected;\n }\n return e;\n });\n}\nfunction updateNodesAndEdgesSelections({ changedNodes, changedEdges, get, set }) {\n const { nodeInternals, edges, onNodesChange, onEdgesChange, hasDefaultNodes, hasDefaultEdges } = get();\n if (changedNodes?.length) {\n if (hasDefaultNodes) {\n set({ nodeInternals: handleControlledNodeSelectionChange(changedNodes, nodeInternals) });\n }\n onNodesChange?.(changedNodes);\n }\n if (changedEdges?.length) {\n if (hasDefaultEdges) {\n set({ edges: handleControlledEdgeSelectionChange(changedEdges, edges) });\n }\n onEdgesChange?.(changedEdges);\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = () => { };\nconst initialViewportHelper = {\n zoomIn: noop,\n zoomOut: noop,\n zoomTo: noop,\n getZoom: () => 1,\n setViewport: noop,\n getViewport: () => ({ x: 0, y: 0, zoom: 1 }),\n fitView: () => false,\n setCenter: noop,\n fitBounds: noop,\n project: (position) => position,\n viewportInitialized: false,\n};\nconst selector$b = (s) => ({\n d3Zoom: s.d3Zoom,\n d3Selection: s.d3Selection,\n});\nconst useViewportHelper = () => {\n const store = useStoreApi();\n const { d3Zoom, d3Selection } = useStore(selector$b, shallow);\n const viewportHelperFunctions = useMemo(() => {\n if (d3Selection && d3Zoom) {\n return {\n zoomIn: (options) => d3Zoom.scaleBy(getD3Transition(d3Selection, options?.duration), 1.2),\n zoomOut: (options) => d3Zoom.scaleBy(getD3Transition(d3Selection, options?.duration), 1 / 1.2),\n zoomTo: (zoomLevel, options) => d3Zoom.scaleTo(getD3Transition(d3Selection, options?.duration), zoomLevel),\n getZoom: () => store.getState().transform[2],\n setViewport: (transform, options) => {\n const [x, y, zoom] = store.getState().transform;\n const nextTransform = zoomIdentity\n .translate(transform.x ?? x, transform.y ?? y)\n .scale(transform.zoom ?? zoom);\n d3Zoom.transform(getD3Transition(d3Selection, options?.duration), nextTransform);\n },\n getViewport: () => {\n const [x, y, zoom] = store.getState().transform;\n return { x, y, zoom };\n },\n fitView: (options) => fitView(store.getState, options),\n setCenter: (x, y, options) => {\n const { width, height, maxZoom } = store.getState();\n const nextZoom = typeof options?.zoom !== 'undefined' ? options.zoom : maxZoom;\n const centerX = width / 2 - x * nextZoom;\n const centerY = height / 2 - y * nextZoom;\n const transform = zoomIdentity.translate(centerX, centerY).scale(nextZoom);\n d3Zoom.transform(getD3Transition(d3Selection, options?.duration), transform);\n },\n fitBounds: (bounds, options) => {\n const { width, height, minZoom, maxZoom } = store.getState();\n const [x, y, zoom] = getTransformForBounds(bounds, width, height, minZoom, maxZoom, options?.padding ?? 0.1);\n const transform = zoomIdentity.translate(x, y).scale(zoom);\n d3Zoom.transform(getD3Transition(d3Selection, options?.duration), transform);\n },\n project: (position) => {\n const { transform, snapToGrid, snapGrid } = store.getState();\n return pointToRendererPoint(position, transform, snapToGrid, snapGrid);\n },\n viewportInitialized: true,\n };\n }\n return initialViewportHelper;\n }, [d3Zoom, d3Selection]);\n return viewportHelperFunctions;\n};\n\n/* eslint-disable-next-line @typescript-eslint/no-explicit-any */\nfunction useReactFlow() {\n const viewportHelper = useViewportHelper();\n const store = useStoreApi();\n const getNodes = useCallback(() => {\n return store\n .getState()\n .getNodes()\n .map((n) => ({ ...n }));\n }, []);\n const getNode = useCallback((id) => {\n return store.getState().nodeInternals.get(id);\n }, []);\n const getEdges = useCallback(() => {\n const { edges = [] } = store.getState();\n return edges.map((e) => ({ ...e }));\n }, []);\n const getEdge = useCallback((id) => {\n const { edges = [] } = store.getState();\n return edges.find((e) => e.id === id);\n }, []);\n const setNodes = useCallback((payload) => {\n const { getNodes, setNodes, hasDefaultNodes, onNodesChange } = store.getState();\n const nodes = getNodes();\n const nextNodes = typeof payload === 'function' ? payload(nodes) : payload;\n if (hasDefaultNodes) {\n setNodes(nextNodes);\n }\n else if (onNodesChange) {\n const changes = nextNodes.length === 0\n ? nodes.map((node) => ({ type: 'remove', id: node.id }))\n : nextNodes.map((node) => ({ item: node, type: 'reset' }));\n onNodesChange(changes);\n }\n }, []);\n const setEdges = useCallback((payload) => {\n const { edges = [], setEdges, hasDefaultEdges, onEdgesChange } = store.getState();\n const nextEdges = typeof payload === 'function' ? payload(edges) : payload;\n if (hasDefaultEdges) {\n setEdges(nextEdges);\n }\n else if (onEdgesChange) {\n const changes = nextEdges.length === 0\n ? edges.map((edge) => ({ type: 'remove', id: edge.id }))\n : nextEdges.map((edge) => ({ item: edge, type: 'reset' }));\n onEdgesChange(changes);\n }\n }, []);\n const addNodes = useCallback((payload) => {\n const nodes = Array.isArray(payload) ? payload : [payload];\n const { getNodes, setNodes, hasDefaultNodes, onNodesChange } = store.getState();\n if (hasDefaultNodes) {\n const currentNodes = getNodes();\n const nextNodes = [...currentNodes, ...nodes];\n setNodes(nextNodes);\n }\n else if (onNodesChange) {\n const changes = nodes.map((node) => ({ item: node, type: 'add' }));\n onNodesChange(changes);\n }\n }, []);\n const addEdges = useCallback((payload) => {\n const nextEdges = Array.isArray(payload) ? payload : [payload];\n const { edges = [], setEdges, hasDefaultEdges, onEdgesChange } = store.getState();\n if (hasDefaultEdges) {\n setEdges([...edges, ...nextEdges]);\n }\n else if (onEdgesChange) {\n const changes = nextEdges.map((edge) => ({ item: edge, type: 'add' }));\n onEdgesChange(changes);\n }\n }, []);\n const toObject = useCallback(() => {\n const { getNodes, edges = [], transform } = store.getState();\n const [x, y, zoom] = transform;\n return {\n nodes: getNodes().map((n) => ({ ...n })),\n edges: edges.map((e) => ({ ...e })),\n viewport: {\n x,\n y,\n zoom,\n },\n };\n }, []);\n const deleteElements = useCallback(({ nodes: nodesDeleted, edges: edgesDeleted }) => {\n const { nodeInternals, getNodes, edges, hasDefaultNodes, hasDefaultEdges, onNodesDelete, onEdgesDelete, onNodesChange, onEdgesChange, } = store.getState();\n const nodeIds = (nodesDeleted || []).map((node) => node.id);\n const edgeIds = (edgesDeleted || []).map((edge) => edge.id);\n const nodesToRemove = getNodes().reduce((res, node) => {\n const parentHit = !nodeIds.includes(node.id) && node.parentNode && res.find((n) => n.id === node.parentNode);\n const deletable = typeof node.deletable === 'boolean' ? node.deletable : true;\n if (deletable && (nodeIds.includes(node.id) || parentHit)) {\n res.push(node);\n }\n return res;\n }, []);\n const deletableEdges = edges.filter((e) => (typeof e.deletable === 'boolean' ? e.deletable : true));\n const initialHitEdges = deletableEdges.filter((e) => edgeIds.includes(e.id));\n if (nodesToRemove || initialHitEdges) {\n const connectedEdges = getConnectedEdges(nodesToRemove, deletableEdges);\n const edgesToRemove = [...initialHitEdges, ...connectedEdges];\n const edgeIdsToRemove = edgesToRemove.reduce((res, edge) => {\n if (!res.includes(edge.id)) {\n res.push(edge.id);\n }\n return res;\n }, []);\n if (hasDefaultEdges || hasDefaultNodes) {\n if (hasDefaultEdges) {\n store.setState({\n edges: edges.filter((e) => !edgeIdsToRemove.includes(e.id)),\n });\n }\n if (hasDefaultNodes) {\n nodesToRemove.forEach((node) => {\n nodeInternals.delete(node.id);\n });\n store.setState({\n nodeInternals: new Map(nodeInternals),\n });\n }\n }\n if (edgeIdsToRemove.length > 0) {\n onEdgesDelete?.(edgesToRemove);\n if (onEdgesChange) {\n onEdgesChange(edgeIdsToRemove.map((id) => ({\n id,\n type: 'remove',\n })));\n }\n }\n if (nodesToRemove.length > 0) {\n onNodesDelete?.(nodesToRemove);\n if (onNodesChange) {\n const nodeChanges = nodesToRemove.map((n) => ({ id: n.id, type: 'remove' }));\n onNodesChange(nodeChanges);\n }\n }\n }\n }, []);\n const getNodeRect = useCallback((nodeOrRect) => {\n const isRect = isRectObject(nodeOrRect);\n const node = isRect ? null : store.getState().nodeInternals.get(nodeOrRect.id);\n const nodeRect = isRect ? nodeOrRect : nodeToRect(node);\n return [nodeRect, node, isRect];\n }, []);\n const getIntersectingNodes = useCallback((nodeOrRect, partially = true, nodes) => {\n const [nodeRect, node, isRect] = getNodeRect(nodeOrRect);\n if (!nodeRect) {\n return [];\n }\n return (nodes || store.getState().getNodes()).filter((n) => {\n if (!isRect && (n.id === node.id || !n.positionAbsolute)) {\n return false;\n }\n const currNodeRect = nodeToRect(n);\n const overlappingArea = getOverlappingArea(currNodeRect, nodeRect);\n const partiallyVisible = partially && overlappingArea > 0;\n return partiallyVisible || overlappingArea >= nodeOrRect.width * nodeOrRect.height;\n });\n }, []);\n const isNodeIntersecting = useCallback((nodeOrRect, area, partially = true) => {\n const [nodeRect] = getNodeRect(nodeOrRect);\n if (!nodeRect) {\n return false;\n }\n const overlappingArea = getOverlappingArea(nodeRect, area);\n const partiallyVisible = partially && overlappingArea > 0;\n return partiallyVisible || overlappingArea >= nodeOrRect.width * nodeOrRect.height;\n }, []);\n return useMemo(() => {\n return {\n ...viewportHelper,\n getNodes,\n getNode,\n getEdges,\n getEdge,\n setNodes,\n setEdges,\n addNodes,\n addEdges,\n toObject,\n deleteElements,\n getIntersectingNodes,\n isNodeIntersecting,\n };\n }, [\n viewportHelper,\n getNodes,\n getNode,\n getEdges,\n getEdge,\n setNodes,\n setEdges,\n addNodes,\n addEdges,\n toObject,\n deleteElements,\n getIntersectingNodes,\n isNodeIntersecting,\n ]);\n}\n\nvar useGlobalKeyHandler = ({ deleteKeyCode, multiSelectionKeyCode }) => {\n const store = useStoreApi();\n const { deleteElements } = useReactFlow();\n const deleteKeyPressed = useKeyPress(deleteKeyCode);\n const multiSelectionKeyPressed = useKeyPress(multiSelectionKeyCode);\n useEffect(() => {\n if (deleteKeyPressed) {\n const { edges, getNodes } = store.getState();\n const selectedNodes = getNodes().filter((node) => node.selected);\n const selectedEdges = edges.filter((edge) => edge.selected);\n deleteElements({ nodes: selectedNodes, edges: selectedEdges });\n store.setState({ nodesSelectionActive: false });\n }\n }, [deleteKeyPressed]);\n useEffect(() => {\n store.setState({ multiSelectionActive: multiSelectionKeyPressed });\n }, [multiSelectionKeyPressed]);\n};\n\nfunction useResizeHandler(rendererNode) {\n const store = useStoreApi();\n useEffect(() => {\n let resizeObserver;\n const updateDimensions = () => {\n if (!rendererNode.current) {\n return;\n }\n const size = getDimensions(rendererNode.current);\n if (size.height === 0 || size.width === 0) {\n store.getState().onError?.('004', errorMessages['error004']());\n }\n store.setState({ width: size.width || 500, height: size.height || 500 });\n };\n updateDimensions();\n window.addEventListener('resize', updateDimensions);\n if (rendererNode.current) {\n resizeObserver = new ResizeObserver(() => updateDimensions());\n resizeObserver.observe(rendererNode.current);\n }\n return () => {\n window.removeEventListener('resize', updateDimensions);\n if (resizeObserver && rendererNode.current) {\n resizeObserver.unobserve(rendererNode.current);\n }\n };\n }, []);\n}\n\nconst containerStyle = {\n position: 'absolute',\n width: '100%',\n height: '100%',\n top: 0,\n left: 0,\n};\n\nconst viewChanged = (prevViewport, eventViewport) => prevViewport.x !== eventViewport.x || prevViewport.y !== eventViewport.y || prevViewport.zoom !== eventViewport.k;\nconst eventToFlowTransform = (eventViewport) => ({\n x: eventViewport.x,\n y: eventViewport.y,\n zoom: eventViewport.k,\n});\nconst isWrappedWithClass = (event, className) => event.target.closest(`.${className}`);\nconst isRightClickPan = (panOnDrag, usedButton) => usedButton === 2 && Array.isArray(panOnDrag) && panOnDrag.includes(2);\nconst selector$a = (s) => ({\n d3Zoom: s.d3Zoom,\n d3Selection: s.d3Selection,\n d3ZoomHandler: s.d3ZoomHandler,\n userSelectionActive: s.userSelectionActive,\n});\nconst ZoomPane = ({ onMove, onMoveStart, onMoveEnd, onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, elementsSelectable, panOnDrag = true, defaultViewport, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling = true, children, noWheelClassName, noPanClassName, }) => {\n const timerId = useRef();\n const store = useStoreApi();\n const isZoomingOrPanning = useRef(false);\n const zoomedWithRightMouseButton = useRef(false);\n const zoomPane = useRef(null);\n const prevTransform = useRef({ x: 0, y: 0, zoom: 0 });\n const { d3Zoom, d3Selection, d3ZoomHandler, userSelectionActive } = useStore(selector$a, shallow);\n const zoomActivationKeyPressed = useKeyPress(zoomActivationKeyCode);\n const mouseButton = useRef(0);\n useResizeHandler(zoomPane);\n useEffect(() => {\n if (zoomPane.current) {\n const bbox = zoomPane.current.getBoundingClientRect();\n const d3ZoomInstance = zoom().scaleExtent([minZoom, maxZoom]).translateExtent(translateExtent);\n const selection = select(zoomPane.current).call(d3ZoomInstance);\n const updatedTransform = zoomIdentity\n .translate(defaultViewport.x, defaultViewport.y)\n .scale(clamp(defaultViewport.zoom, minZoom, maxZoom));\n const extent = [\n [0, 0],\n [bbox.width, bbox.height],\n ];\n const constrainedTransform = d3ZoomInstance.constrain()(updatedTransform, extent, translateExtent);\n d3ZoomInstance.transform(selection, constrainedTransform);\n store.setState({\n d3Zoom: d3ZoomInstance,\n d3Selection: selection,\n d3ZoomHandler: selection.on('wheel.zoom'),\n // we need to pass transform because zoom handler is not registered when we set the initial transform\n transform: [constrainedTransform.x, constrainedTransform.y, constrainedTransform.k],\n domNode: zoomPane.current.closest('.react-flow'),\n });\n }\n }, []);\n useEffect(() => {\n if (d3Selection && d3Zoom) {\n if (panOnScroll && !zoomActivationKeyPressed && !userSelectionActive) {\n d3Selection.on('wheel.zoom', (event) => {\n if (isWrappedWithClass(event, noWheelClassName)) {\n return false;\n }\n event.preventDefault();\n event.stopImmediatePropagation();\n const currentZoom = d3Selection.property('__zoom').k || 1;\n if (event.ctrlKey && zoomOnPinch) {\n const point = pointer(event);\n // taken from https://github.com/d3/d3-zoom/blob/master/src/zoom.js\n const pinchDelta = -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002) * 10;\n const zoom = currentZoom * Math.pow(2, pinchDelta);\n d3Zoom.scaleTo(d3Selection, zoom, point);\n return;\n }\n // increase scroll speed in firefox\n // firefox: deltaMode === 1; chrome: deltaMode === 0\n const deltaNormalize = event.deltaMode === 1 ? 20 : 1;\n const deltaX = panOnScrollMode === PanOnScrollMode.Vertical ? 0 : event.deltaX * deltaNormalize;\n const deltaY = panOnScrollMode === PanOnScrollMode.Horizontal ? 0 : event.deltaY * deltaNormalize;\n d3Zoom.translateBy(d3Selection, -(deltaX / currentZoom) * panOnScrollSpeed, -(deltaY / currentZoom) * panOnScrollSpeed);\n }, { passive: false });\n }\n else if (typeof d3ZoomHandler !== 'undefined') {\n d3Selection.on('wheel.zoom', function (event, d) {\n if (!preventScrolling || isWrappedWithClass(event, noWheelClassName)) {\n return null;\n }\n event.preventDefault();\n d3ZoomHandler.call(this, event, d);\n }, { passive: false });\n }\n }\n }, [\n userSelectionActive,\n panOnScroll,\n panOnScrollMode,\n d3Selection,\n d3Zoom,\n d3ZoomHandler,\n zoomActivationKeyPressed,\n zoomOnPinch,\n preventScrolling,\n noWheelClassName,\n ]);\n useEffect(() => {\n if (d3Zoom) {\n d3Zoom.on('start', (event) => {\n if (!event.sourceEvent) {\n return null;\n }\n // we need to remember it here, because it's always 0 in the \"zoom\" event\n mouseButton.current = event.sourceEvent.button;\n const { onViewportChangeStart } = store.getState();\n isZoomingOrPanning.current = true;\n if (event.sourceEvent?.type === 'mousedown') {\n store.setState({ paneDragging: true });\n }\n if (onMoveStart || onViewportChangeStart) {\n const flowTransform = eventToFlowTransform(event.transform);\n prevTransform.current = flowTransform;\n onViewportChangeStart?.(flowTransform);\n onMoveStart?.(event.sourceEvent, flowTransform);\n }\n });\n }\n }, [d3Zoom, onMoveStart]);\n useEffect(() => {\n if (d3Zoom) {\n if (userSelectionActive && !isZoomingOrPanning.current) {\n d3Zoom.on('zoom', null);\n }\n else if (!userSelectionActive) {\n d3Zoom.on('zoom', (event) => {\n const { onViewportChange } = store.getState();\n store.setState({ transform: [event.transform.x, event.transform.y, event.transform.k] });\n zoomedWithRightMouseButton.current = !!(onPaneContextMenu && isRightClickPan(panOnDrag, mouseButton.current ?? 0));\n if (onMove || onViewportChange) {\n const flowTransform = eventToFlowTransform(event.transform);\n onViewportChange?.(flowTransform);\n onMove?.(event.sourceEvent, flowTransform);\n }\n });\n }\n }\n }, [userSelectionActive, d3Zoom, onMove, panOnDrag, onPaneContextMenu]);\n useEffect(() => {\n if (d3Zoom) {\n d3Zoom.on('end', (event) => {\n if (!event.sourceEvent) {\n return null;\n }\n const { onViewportChangeEnd } = store.getState();\n isZoomingOrPanning.current = false;\n store.setState({ paneDragging: false });\n if (onPaneContextMenu &&\n isRightClickPan(panOnDrag, mouseButton.current ?? 0) &&\n !zoomedWithRightMouseButton.current) {\n onPaneContextMenu(event.sourceEvent);\n }\n zoomedWithRightMouseButton.current = false;\n if ((onMoveEnd || onViewportChangeEnd) && viewChanged(prevTransform.current, event.transform)) {\n const flowTransform = eventToFlowTransform(event.transform);\n prevTransform.current = flowTransform;\n clearTimeout(timerId.current);\n timerId.current = setTimeout(() => {\n onViewportChangeEnd?.(flowTransform);\n onMoveEnd?.(event.sourceEvent, flowTransform);\n }, panOnScroll ? 150 : 0);\n }\n });\n }\n }, [d3Zoom, panOnScroll, panOnDrag, onMoveEnd, onPaneContextMenu]);\n useEffect(() => {\n if (d3Zoom) {\n d3Zoom.filter((event) => {\n const zoomScroll = zoomActivationKeyPressed || zoomOnScroll;\n const pinchZoom = zoomOnPinch && event.ctrlKey;\n if (event.button === 1 &&\n event.type === 'mousedown' &&\n (isWrappedWithClass(event, 'react-flow__node') || isWrappedWithClass(event, 'react-flow__edge'))) {\n return true;\n }\n // if all interactions are disabled, we prevent all zoom events\n if (!panOnDrag && !zoomScroll && !panOnScroll && !zoomOnDoubleClick && !zoomOnPinch) {\n return false;\n }\n // during a selection we prevent all other interactions\n if (userSelectionActive) {\n return false;\n }\n // if zoom on double click is disabled, we prevent the double click event\n if (!zoomOnDoubleClick && event.type === 'dblclick') {\n return false;\n }\n // if the target element is inside an element with the nowheel class, we prevent zooming\n if (isWrappedWithClass(event, noWheelClassName) && event.type === 'wheel') {\n return false;\n }\n // if the target element is inside an element with the nopan class, we prevent panning\n if (isWrappedWithClass(event, noPanClassName) && event.type !== 'wheel') {\n return false;\n }\n if (!zoomOnPinch && event.ctrlKey && event.type === 'wheel') {\n return false;\n }\n // when there is no scroll handling enabled, we prevent all wheel events\n if (!zoomScroll && !panOnScroll && !pinchZoom && event.type === 'wheel') {\n return false;\n }\n // if the pane is not movable, we prevent dragging it with mousestart or touchstart\n if (!panOnDrag && (event.type === 'mousedown' || event.type === 'touchstart')) {\n return false;\n }\n // if the pane is only movable using allowed clicks\n if (Array.isArray(panOnDrag) &&\n !panOnDrag.includes(event.button) &&\n (event.type === 'mousedown' || event.type === 'touchstart')) {\n return false;\n }\n // We only allow right clicks if pan on drag is set to right click\n const buttonAllowed = (Array.isArray(panOnDrag) && panOnDrag.includes(event.button)) || !event.button || event.button <= 1;\n // default filter for d3-zoom\n return (!event.ctrlKey || event.type === 'wheel') && buttonAllowed;\n });\n }\n }, [\n userSelectionActive,\n d3Zoom,\n zoomOnScroll,\n zoomOnPinch,\n panOnScroll,\n zoomOnDoubleClick,\n panOnDrag,\n elementsSelectable,\n zoomActivationKeyPressed,\n ]);\n return (jsx(\"div\", { className: \"react-flow__renderer\", ref: zoomPane, style: containerStyle, children: children }));\n};\n\nconst selector$9 = (s) => ({\n userSelectionActive: s.userSelectionActive,\n userSelectionRect: s.userSelectionRect,\n});\nfunction UserSelection() {\n const { userSelectionActive, userSelectionRect } = useStore(selector$9, shallow);\n const isActive = userSelectionActive && userSelectionRect;\n if (!isActive) {\n return null;\n }\n return (jsx(\"div\", { className: \"react-flow__selection react-flow__container\", style: {\n width: userSelectionRect.width,\n height: userSelectionRect.height,\n transform: `translate(${userSelectionRect.x}px, ${userSelectionRect.y}px)`,\n } }));\n}\n\nfunction handleParentExpand(res, updateItem) {\n const parent = res.find((e) => e.id === updateItem.parentNode);\n if (parent) {\n const extendWidth = updateItem.position.x + updateItem.width - parent.width;\n const extendHeight = updateItem.position.y + updateItem.height - parent.height;\n if (extendWidth > 0 || extendHeight > 0 || updateItem.position.x < 0 || updateItem.position.y < 0) {\n parent.style = { ...parent.style } || {};\n parent.style.width = parent.style.width ?? parent.width;\n parent.style.height = parent.style.height ?? parent.height;\n if (extendWidth > 0) {\n parent.style.width += extendWidth;\n }\n if (extendHeight > 0) {\n parent.style.height += extendHeight;\n }\n if (updateItem.position.x < 0) {\n const xDiff = Math.abs(updateItem.position.x);\n parent.position.x = parent.position.x - xDiff;\n parent.style.width += xDiff;\n updateItem.position.x = 0;\n }\n if (updateItem.position.y < 0) {\n const yDiff = Math.abs(updateItem.position.y);\n parent.position.y = parent.position.y - yDiff;\n parent.style.height += yDiff;\n updateItem.position.y = 0;\n }\n parent.width = parent.style.width;\n parent.height = parent.style.height;\n }\n }\n}\nfunction applyChanges(changes, elements) {\n // we need this hack to handle the setNodes and setEdges function of the useReactFlow hook for controlled flows\n if (changes.some((c) => c.type === 'reset')) {\n return changes.filter((c) => c.type === 'reset').map((c) => c.item);\n }\n const initElements = changes.filter((c) => c.type === 'add').map((c) => c.item);\n return elements.reduce((res, item) => {\n const currentChanges = changes.filter((c) => c.id === item.id);\n if (currentChanges.length === 0) {\n res.push(item);\n return res;\n }\n const updateItem = { ...item };\n for (const currentChange of currentChanges) {\n if (currentChange) {\n switch (currentChange.type) {\n case 'select': {\n updateItem.selected = currentChange.selected;\n break;\n }\n case 'position': {\n if (typeof currentChange.position !== 'undefined') {\n updateItem.position = currentChange.position;\n }\n if (typeof currentChange.positionAbsolute !== 'undefined') {\n updateItem.positionAbsolute = currentChange.positionAbsolute;\n }\n if (typeof currentChange.dragging !== 'undefined') {\n updateItem.dragging = currentChange.dragging;\n }\n if (updateItem.expandParent) {\n handleParentExpand(res, updateItem);\n }\n break;\n }\n case 'dimensions': {\n if (typeof currentChange.dimensions !== 'undefined') {\n updateItem.width = currentChange.dimensions.width;\n updateItem.height = currentChange.dimensions.height;\n }\n if (typeof currentChange.updateStyle !== 'undefined') {\n updateItem.style = { ...(updateItem.style || {}), ...currentChange.dimensions };\n }\n if (typeof currentChange.resizing === 'boolean') {\n updateItem.resizing = currentChange.resizing;\n }\n if (updateItem.expandParent) {\n handleParentExpand(res, updateItem);\n }\n break;\n }\n case 'remove': {\n return res;\n }\n }\n }\n }\n res.push(updateItem);\n return res;\n }, initElements);\n}\nfunction applyNodeChanges(changes, nodes) {\n return applyChanges(changes, nodes);\n}\nfunction applyEdgeChanges(changes, edges) {\n return applyChanges(changes, edges);\n}\nconst createSelectionChange = (id, selected) => ({\n id,\n type: 'select',\n selected,\n});\nfunction getSelectionChanges(items, selectedIds) {\n return items.reduce((res, item) => {\n const willBeSelected = selectedIds.includes(item.id);\n if (!item.selected && willBeSelected) {\n item.selected = true;\n res.push(createSelectionChange(item.id, true));\n }\n else if (item.selected && !willBeSelected) {\n item.selected = false;\n res.push(createSelectionChange(item.id, false));\n }\n return res;\n }, []);\n}\n\nconst wrapHandler = (handler, containerRef) => {\n return (event) => {\n if (event.target !== containerRef.current) {\n return;\n }\n handler?.(event);\n };\n};\nconst selector$8 = (s) => ({\n userSelectionActive: s.userSelectionActive,\n elementsSelectable: s.elementsSelectable,\n dragging: s.paneDragging,\n});\nconst Pane = memo(({ isSelecting, selectionMode = SelectionMode.Full, panOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children, }) => {\n const container = useRef(null);\n const store = useStoreApi();\n const prevSelectedNodesCount = useRef(0);\n const prevSelectedEdgesCount = useRef(0);\n const containerBounds = useRef();\n const { userSelectionActive, elementsSelectable, dragging } = useStore(selector$8, shallow);\n const resetUserSelection = () => {\n store.setState({ userSelectionActive: false, userSelectionRect: null });\n prevSelectedNodesCount.current = 0;\n prevSelectedEdgesCount.current = 0;\n };\n const onClick = (event) => {\n onPaneClick?.(event);\n store.getState().resetSelectedElements();\n store.setState({ nodesSelectionActive: false });\n };\n const onContextMenu = (event) => {\n if (Array.isArray(panOnDrag) && panOnDrag?.includes(2)) {\n event.preventDefault();\n return;\n }\n onPaneContextMenu?.(event);\n };\n const onWheel = onPaneScroll ? (event) => onPaneScroll(event) : undefined;\n const onMouseDown = (event) => {\n const { resetSelectedElements, domNode } = store.getState();\n containerBounds.current = domNode?.getBoundingClientRect();\n if (!elementsSelectable ||\n !isSelecting ||\n event.button !== 0 ||\n event.target !== container.current ||\n !containerBounds.current) {\n return;\n }\n const { x, y } = getEventPosition(event, containerBounds.current);\n resetSelectedElements();\n store.setState({\n userSelectionRect: {\n width: 0,\n height: 0,\n startX: x,\n startY: y,\n x,\n y,\n },\n });\n onSelectionStart?.(event);\n };\n const onMouseMove = (event) => {\n const { userSelectionRect, nodeInternals, edges, transform, onNodesChange, onEdgesChange, nodeOrigin, getNodes } = store.getState();\n if (!isSelecting || !containerBounds.current || !userSelectionRect) {\n return;\n }\n store.setState({ userSelectionActive: true, nodesSelectionActive: false });\n const mousePos = getEventPosition(event, containerBounds.current);\n const startX = userSelectionRect.startX ?? 0;\n const startY = userSelectionRect.startY ?? 0;\n const nextUserSelectRect = {\n ...userSelectionRect,\n x: mousePos.x < startX ? mousePos.x : startX,\n y: mousePos.y < startY ? mousePos.y : startY,\n width: Math.abs(mousePos.x - startX),\n height: Math.abs(mousePos.y - startY),\n };\n const nodes = getNodes();\n const selectedNodes = getNodesInside(nodeInternals, nextUserSelectRect, transform, selectionMode === SelectionMode.Partial, true, nodeOrigin);\n const selectedEdgeIds = getConnectedEdges(selectedNodes, edges).map((e) => e.id);\n const selectedNodeIds = selectedNodes.map((n) => n.id);\n if (prevSelectedNodesCount.current !== selectedNodeIds.length) {\n prevSelectedNodesCount.current = selectedNodeIds.length;\n const changes = getSelectionChanges(nodes, selectedNodeIds);\n if (changes.length) {\n onNodesChange?.(changes);\n }\n }\n if (prevSelectedEdgesCount.current !== selectedEdgeIds.length) {\n prevSelectedEdgesCount.current = selectedEdgeIds.length;\n const changes = getSelectionChanges(edges, selectedEdgeIds);\n if (changes.length) {\n onEdgesChange?.(changes);\n }\n }\n store.setState({\n userSelectionRect: nextUserSelectRect,\n });\n };\n const onMouseUp = (event) => {\n if (event.button !== 0) {\n return;\n }\n const { userSelectionRect } = store.getState();\n // We only want to trigger click functions when in selection mode if\n // the user did not move the mouse.\n if (!userSelectionActive && userSelectionRect && event.target === container.current) {\n onClick?.(event);\n }\n store.setState({ nodesSelectionActive: prevSelectedNodesCount.current > 0 });\n resetUserSelection();\n onSelectionEnd?.(event);\n };\n const onMouseLeave = (event) => {\n if (userSelectionActive) {\n store.setState({ nodesSelectionActive: prevSelectedNodesCount.current > 0 });\n onSelectionEnd?.(event);\n }\n resetUserSelection();\n };\n const hasActiveSelection = elementsSelectable && (isSelecting || userSelectionActive);\n return (jsxs(\"div\", { className: cc(['react-flow__pane', { dragging, selection: isSelecting }]), onClick: hasActiveSelection ? undefined : wrapHandler(onClick, container), onContextMenu: wrapHandler(onContextMenu, container), onWheel: wrapHandler(onWheel, container), onMouseEnter: hasActiveSelection ? undefined : onPaneMouseEnter, onMouseDown: hasActiveSelection ? onMouseDown : undefined, onMouseMove: hasActiveSelection ? onMouseMove : onPaneMouseMove, onMouseUp: hasActiveSelection ? onMouseUp : undefined, onMouseLeave: hasActiveSelection ? onMouseLeave : onPaneMouseLeave, ref: container, style: containerStyle, children: [children, jsx(UserSelection, {})] }));\n});\nPane.displayName = 'Pane';\n\nconst selector$7 = (s) => {\n const selectedNodes = s.getNodes().filter((n) => n.selected);\n return {\n ...getRectOfNodes(selectedNodes, s.nodeOrigin),\n transformString: `translate(${s.transform[0]}px,${s.transform[1]}px) scale(${s.transform[2]})`,\n userSelectionActive: s.userSelectionActive,\n };\n};\nfunction NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboardA11y }) {\n const store = useStoreApi();\n const { width, height, x: left, y: top, transformString, userSelectionActive } = useStore(selector$7, shallow);\n const updatePositions = useUpdateNodePositions();\n const nodeRef = useRef(null);\n useEffect(() => {\n if (!disableKeyboardA11y) {\n nodeRef.current?.focus({\n preventScroll: true,\n });\n }\n }, [disableKeyboardA11y]);\n useDrag({\n nodeRef,\n });\n if (userSelectionActive || !width || !height) {\n return null;\n }\n const onContextMenu = onSelectionContextMenu\n ? (event) => {\n const selectedNodes = store\n .getState()\n .getNodes()\n .filter((n) => n.selected);\n onSelectionContextMenu(event, selectedNodes);\n }\n : undefined;\n const onKeyDown = (event) => {\n if (Object.prototype.hasOwnProperty.call(arrowKeyDiffs, event.key)) {\n updatePositions({\n x: arrowKeyDiffs[event.key].x,\n y: arrowKeyDiffs[event.key].y,\n isShiftPressed: event.shiftKey,\n });\n }\n };\n return (jsx(\"div\", { className: cc(['react-flow__nodesselection', 'react-flow__container', noPanClassName]), style: {\n transform: transformString,\n }, children: jsx(\"div\", { ref: nodeRef, className: \"react-flow__nodesselection-rect\", onContextMenu: onContextMenu, tabIndex: disableKeyboardA11y ? undefined : -1, onKeyDown: disableKeyboardA11y ? undefined : onKeyDown, style: {\n width,\n height,\n top,\n left,\n } }) }));\n}\nvar NodesSelection$1 = memo(NodesSelection);\n\nconst selector$6 = (s) => s.nodesSelectionActive;\nconst FlowRenderer = ({ children, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, deleteKeyCode, onMove, onMoveStart, onMoveEnd, selectionKeyCode, selectionOnDrag, selectionMode, onSelectionStart, onSelectionEnd, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, elementsSelectable, zoomOnScroll, zoomOnPinch, panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag: _panOnDrag, defaultViewport, translateExtent, minZoom, maxZoom, preventScrolling, onSelectionContextMenu, noWheelClassName, noPanClassName, disableKeyboardA11y, }) => {\n const nodesSelectionActive = useStore(selector$6);\n const selectionKeyPressed = useKeyPress(selectionKeyCode);\n const panActivationKeyPressed = useKeyPress(panActivationKeyCode);\n const panOnDrag = panActivationKeyPressed || _panOnDrag;\n const isSelecting = selectionKeyPressed || (selectionOnDrag && panOnDrag !== true);\n useGlobalKeyHandler({ deleteKeyCode, multiSelectionKeyCode });\n return (jsx(ZoomPane, { onMove: onMove, onMoveStart: onMoveStart, onMoveEnd: onMoveEnd, onPaneContextMenu: onPaneContextMenu, elementsSelectable: elementsSelectable, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, zoomOnDoubleClick: zoomOnDoubleClick, panOnDrag: !selectionKeyPressed && panOnDrag, defaultViewport: defaultViewport, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, zoomActivationKeyCode: zoomActivationKeyCode, preventScrolling: preventScrolling, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, children: jsxs(Pane, { onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneContextMenu: onPaneContextMenu, onPaneScroll: onPaneScroll, panOnDrag: panOnDrag, isSelecting: !!isSelecting, selectionMode: selectionMode, children: [children, nodesSelectionActive && (jsx(NodesSelection$1, { onSelectionContextMenu: onSelectionContextMenu, noPanClassName: noPanClassName, disableKeyboardA11y: disableKeyboardA11y }))] }) }));\n};\nFlowRenderer.displayName = 'FlowRenderer';\nvar FlowRenderer$1 = memo(FlowRenderer);\n\nfunction useVisibleNodes(onlyRenderVisible) {\n const nodes = useStore(useCallback((s) => onlyRenderVisible\n ? getNodesInside(s.nodeInternals, { x: 0, y: 0, width: s.width, height: s.height }, s.transform, true)\n : s.getNodes(), [onlyRenderVisible]));\n return nodes;\n}\n\nconst selector$5 = (s) => ({\n nodesDraggable: s.nodesDraggable,\n nodesConnectable: s.nodesConnectable,\n nodesFocusable: s.nodesFocusable,\n elementsSelectable: s.elementsSelectable,\n updateNodeDimensions: s.updateNodeDimensions,\n onError: s.onError,\n});\nconst NodeRenderer = (props) => {\n const { nodesDraggable, nodesConnectable, nodesFocusable, elementsSelectable, updateNodeDimensions, onError } = useStore(selector$5, shallow);\n const nodes = useVisibleNodes(props.onlyRenderVisibleElements);\n const resizeObserverRef = useRef();\n const resizeObserver = useMemo(() => {\n if (typeof ResizeObserver === 'undefined') {\n return null;\n }\n const observer = new ResizeObserver((entries) => {\n const updates = entries.map((entry) => ({\n id: entry.target.getAttribute('data-id'),\n nodeElement: entry.target,\n forceUpdate: true,\n }));\n updateNodeDimensions(updates);\n });\n resizeObserverRef.current = observer;\n return observer;\n }, []);\n useEffect(() => {\n return () => {\n resizeObserverRef?.current?.disconnect();\n };\n }, []);\n return (jsx(\"div\", { className: \"react-flow__nodes\", style: containerStyle, children: nodes.map((node) => {\n let nodeType = node.type || 'default';\n if (!props.nodeTypes[nodeType]) {\n onError?.('003', errorMessages['error003'](nodeType));\n nodeType = 'default';\n }\n const NodeComponent = (props.nodeTypes[nodeType] || props.nodeTypes.default);\n const isDraggable = !!(node.draggable || (nodesDraggable && typeof node.draggable === 'undefined'));\n const isSelectable = !!(node.selectable || (elementsSelectable && typeof node.selectable === 'undefined'));\n const isConnectable = !!(node.connectable || (nodesConnectable && typeof node.connectable === 'undefined'));\n const isFocusable = !!(node.focusable || (nodesFocusable && typeof node.focusable === 'undefined'));\n const clampedPosition = props.nodeExtent\n ? clampPosition(node.positionAbsolute, props.nodeExtent)\n : node.positionAbsolute;\n const posX = clampedPosition?.x ?? 0;\n const posY = clampedPosition?.y ?? 0;\n const posOrigin = getPositionWithOrigin({\n x: posX,\n y: posY,\n width: node.width ?? 0,\n height: node.height ?? 0,\n origin: props.nodeOrigin,\n });\n return (jsx(NodeComponent, { id: node.id, className: node.className, style: node.style, type: nodeType, data: node.data, sourcePosition: node.sourcePosition || Position.Bottom, targetPosition: node.targetPosition || Position.Top, hidden: node.hidden, xPos: posX, yPos: posY, xPosOrigin: posOrigin.x, yPosOrigin: posOrigin.y, selectNodesOnDrag: props.selectNodesOnDrag, onClick: props.onNodeClick, onMouseEnter: props.onNodeMouseEnter, onMouseMove: props.onNodeMouseMove, onMouseLeave: props.onNodeMouseLeave, onContextMenu: props.onNodeContextMenu, onDoubleClick: props.onNodeDoubleClick, selected: !!node.selected, isDraggable: isDraggable, isSelectable: isSelectable, isConnectable: isConnectable, isFocusable: isFocusable, resizeObserver: resizeObserver, dragHandle: node.dragHandle, zIndex: node[internalsSymbol]?.z ?? 0, isParent: !!node[internalsSymbol]?.isParent, noDragClassName: props.noDragClassName, noPanClassName: props.noPanClassName, initialized: !!node.width && !!node.height, rfId: props.rfId, disableKeyboardA11y: props.disableKeyboardA11y, ariaLabel: node.ariaLabel }, node.id));\n }) }));\n};\nNodeRenderer.displayName = 'NodeRenderer';\nvar NodeRenderer$1 = memo(NodeRenderer);\n\nconst defaultEdgeTree = [{ level: 0, isMaxLevel: true, edges: [] }];\nfunction groupEdgesByZLevel(edges, nodeInternals, elevateEdgesOnSelect = false) {\n let maxLevel = -1;\n const levelLookup = edges.reduce((tree, edge) => {\n const hasZIndex = isNumeric(edge.zIndex);\n let z = hasZIndex ? edge.zIndex : 0;\n if (elevateEdgesOnSelect) {\n z = hasZIndex\n ? edge.zIndex\n : Math.max(nodeInternals.get(edge.source)?.[internalsSymbol]?.z || 0, nodeInternals.get(edge.target)?.[internalsSymbol]?.z || 0);\n }\n if (tree[z]) {\n tree[z].push(edge);\n }\n else {\n tree[z] = [edge];\n }\n maxLevel = z > maxLevel ? z : maxLevel;\n return tree;\n }, {});\n const edgeTree = Object.entries(levelLookup).map(([key, edges]) => {\n const level = +key;\n return {\n edges,\n level,\n isMaxLevel: level === maxLevel,\n };\n });\n if (edgeTree.length === 0) {\n return defaultEdgeTree;\n }\n return edgeTree;\n}\nfunction useVisibleEdges(onlyRenderVisible, nodeInternals, elevateEdgesOnSelect) {\n const edges = useStore(useCallback((s) => {\n if (!onlyRenderVisible) {\n return s.edges;\n }\n return s.edges.filter((e) => {\n const sourceNode = nodeInternals.get(e.source);\n const targetNode = nodeInternals.get(e.target);\n return (sourceNode?.width &&\n sourceNode?.height &&\n targetNode?.width &&\n targetNode?.height &&\n isEdgeVisible({\n sourcePos: sourceNode.positionAbsolute || { x: 0, y: 0 },\n targetPos: targetNode.positionAbsolute || { x: 0, y: 0 },\n sourceWidth: sourceNode.width,\n sourceHeight: sourceNode.height,\n targetWidth: targetNode.width,\n targetHeight: targetNode.height,\n width: s.width,\n height: s.height,\n transform: s.transform,\n }));\n });\n }, [onlyRenderVisible, nodeInternals]));\n return groupEdgesByZLevel(edges, nodeInternals, elevateEdgesOnSelect);\n}\n\nconst ArrowSymbol = ({ color = 'none', strokeWidth = 1 }) => {\n return (jsx(\"polyline\", { stroke: color, strokeLinecap: \"round\", strokeLinejoin: \"round\", strokeWidth: strokeWidth, fill: \"none\", points: \"-5,-4 0,0 -5,4\" }));\n};\nconst ArrowClosedSymbol = ({ color = 'none', strokeWidth = 1 }) => {\n return (jsx(\"polyline\", { stroke: color, strokeLinecap: \"round\", strokeLinejoin: \"round\", strokeWidth: strokeWidth, fill: color, points: \"-5,-4 0,0 -5,4 -5,-4\" }));\n};\nconst MarkerSymbols = {\n [MarkerType.Arrow]: ArrowSymbol,\n [MarkerType.ArrowClosed]: ArrowClosedSymbol,\n};\nfunction useMarkerSymbol(type) {\n const store = useStoreApi();\n const symbol = useMemo(() => {\n const symbolExists = Object.prototype.hasOwnProperty.call(MarkerSymbols, type);\n if (!symbolExists) {\n store.getState().onError?.('009', errorMessages['error009'](type));\n return null;\n }\n return MarkerSymbols[type];\n }, [type]);\n return symbol;\n}\n\nconst Marker = ({ id, type, color, width = 12.5, height = 12.5, markerUnits = 'strokeWidth', strokeWidth, orient = 'auto-start-reverse', }) => {\n const Symbol = useMarkerSymbol(type);\n if (!Symbol) {\n return null;\n }\n return (jsx(\"marker\", { className: \"react-flow__arrowhead\", id: id, markerWidth: `${width}`, markerHeight: `${height}`, viewBox: \"-10 -10 20 20\", markerUnits: markerUnits, orient: orient, refX: \"0\", refY: \"0\", children: jsx(Symbol, { color: color, strokeWidth: strokeWidth }) }));\n};\nconst markerSelector = ({ defaultColor, rfId }) => (s) => {\n const ids = [];\n return s.edges\n .reduce((markers, edge) => {\n [edge.markerStart, edge.markerEnd].forEach((marker) => {\n if (marker && typeof marker === 'object') {\n const markerId = getMarkerId(marker, rfId);\n if (!ids.includes(markerId)) {\n markers.push({ id: markerId, color: marker.color || defaultColor, ...marker });\n ids.push(markerId);\n }\n }\n });\n return markers;\n }, [])\n .sort((a, b) => a.id.localeCompare(b.id));\n};\n// when you have multiple flows on a page and you hide the first one, the other ones have no markers anymore\n// when they do have markers with the same ids. To prevent this the user can pass a unique id to the react flow wrapper\n// that we can then use for creating our unique marker ids\nconst MarkerDefinitions = ({ defaultColor, rfId }) => {\n const markers = useStore(useCallback(markerSelector({ defaultColor, rfId }), [defaultColor, rfId]), \n // the id includes all marker options, so we just need to look at that part of the marker\n (a, b) => !(a.length !== b.length || a.some((m, i) => m.id !== b[i].id)));\n return (jsx(\"defs\", { children: markers.map((marker) => (jsx(Marker, { id: marker.id, type: marker.type, color: marker.color, width: marker.width, height: marker.height, markerUnits: marker.markerUnits, strokeWidth: marker.strokeWidth, orient: marker.orient }, marker.id))) }));\n};\nMarkerDefinitions.displayName = 'MarkerDefinitions';\nvar MarkerDefinitions$1 = memo(MarkerDefinitions);\n\nconst selector$4 = (s) => ({\n nodesConnectable: s.nodesConnectable,\n edgesFocusable: s.edgesFocusable,\n edgesUpdatable: s.edgesUpdatable,\n elementsSelectable: s.elementsSelectable,\n width: s.width,\n height: s.height,\n connectionMode: s.connectionMode,\n nodeInternals: s.nodeInternals,\n onError: s.onError,\n});\nconst EdgeRenderer = ({ defaultMarkerColor, onlyRenderVisibleElements, elevateEdgesOnSelect, rfId, edgeTypes, noPanClassName, onEdgeUpdate, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, onEdgeClick, edgeUpdaterRadius, onEdgeDoubleClick, onEdgeUpdateStart, onEdgeUpdateEnd, children, }) => {\n const { edgesFocusable, edgesUpdatable, elementsSelectable, width, height, connectionMode, nodeInternals, onError } = useStore(selector$4, shallow);\n const edgeTree = useVisibleEdges(onlyRenderVisibleElements, nodeInternals, elevateEdgesOnSelect);\n if (!width) {\n return null;\n }\n return (jsxs(Fragment, { children: [edgeTree.map(({ level, edges, isMaxLevel }) => (jsxs(\"svg\", { style: { zIndex: level }, width: width, height: height, className: \"react-flow__edges react-flow__container\", children: [isMaxLevel && jsx(MarkerDefinitions$1, { defaultColor: defaultMarkerColor, rfId: rfId }), jsx(\"g\", { children: edges.map((edge) => {\n const [sourceNodeRect, sourceHandleBounds, sourceIsValid] = getNodeData(nodeInternals.get(edge.source));\n const [targetNodeRect, targetHandleBounds, targetIsValid] = getNodeData(nodeInternals.get(edge.target));\n if (!sourceIsValid || !targetIsValid) {\n return null;\n }\n let edgeType = edge.type || 'default';\n if (!edgeTypes[edgeType]) {\n onError?.('011', errorMessages['error011'](edgeType));\n edgeType = 'default';\n }\n const EdgeComponent = edgeTypes[edgeType] || edgeTypes.default;\n // when connection type is loose we can define all handles as sources and connect source -> source\n const targetNodeHandles = connectionMode === ConnectionMode.Strict\n ? targetHandleBounds.target\n : (targetHandleBounds.target ?? []).concat(targetHandleBounds.source ?? []);\n const sourceHandle = getHandle(sourceHandleBounds.source, edge.sourceHandle);\n const targetHandle = getHandle(targetNodeHandles, edge.targetHandle);\n const sourcePosition = sourceHandle?.position || Position.Bottom;\n const targetPosition = targetHandle?.position || Position.Top;\n const isFocusable = !!(edge.focusable || (edgesFocusable && typeof edge.focusable === 'undefined'));\n const isUpdatable = typeof onEdgeUpdate !== 'undefined' &&\n (edge.updatable || (edgesUpdatable && typeof edge.updatable === 'undefined'));\n if (!sourceHandle || !targetHandle) {\n onError?.('008', errorMessages['error008'](sourceHandle, edge));\n return null;\n }\n const { sourceX, sourceY, targetX, targetY } = getEdgePositions(sourceNodeRect, sourceHandle, sourcePosition, targetNodeRect, targetHandle, targetPosition);\n return (jsx(EdgeComponent, { id: edge.id, className: cc([edge.className, noPanClassName]), type: edgeType, data: edge.data, selected: !!edge.selected, animated: !!edge.animated, hidden: !!edge.hidden, label: edge.label, labelStyle: edge.labelStyle, labelShowBg: edge.labelShowBg, labelBgStyle: edge.labelBgStyle, labelBgPadding: edge.labelBgPadding, labelBgBorderRadius: edge.labelBgBorderRadius, style: edge.style, source: edge.source, target: edge.target, sourceHandleId: edge.sourceHandle, targetHandleId: edge.targetHandle, markerEnd: edge.markerEnd, markerStart: edge.markerStart, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, elementsSelectable: elementsSelectable, onEdgeUpdate: onEdgeUpdate, onContextMenu: onEdgeContextMenu, onMouseEnter: onEdgeMouseEnter, onMouseMove: onEdgeMouseMove, onMouseLeave: onEdgeMouseLeave, onClick: onEdgeClick, edgeUpdaterRadius: edgeUpdaterRadius, onEdgeDoubleClick: onEdgeDoubleClick, onEdgeUpdateStart: onEdgeUpdateStart, onEdgeUpdateEnd: onEdgeUpdateEnd, rfId: rfId, ariaLabel: edge.ariaLabel, isFocusable: isFocusable, isUpdatable: isUpdatable, pathOptions: 'pathOptions' in edge ? edge.pathOptions : undefined, interactionWidth: edge.interactionWidth }, edge.id));\n }) })] }, level))), children] }));\n};\nEdgeRenderer.displayName = 'EdgeRenderer';\nvar EdgeRenderer$1 = memo(EdgeRenderer);\n\nconst selector$3 = (s) => `translate(${s.transform[0]}px,${s.transform[1]}px) scale(${s.transform[2]})`;\nfunction Viewport({ children }) {\n const transform = useStore(selector$3);\n return (jsx(\"div\", { className: \"react-flow__viewport react-flow__container\", style: { transform }, children: children }));\n}\n\nfunction useOnInitHandler(onInit) {\n const rfInstance = useReactFlow();\n const isInitialized = useRef(false);\n useEffect(() => {\n if (!isInitialized.current && rfInstance.viewportInitialized && onInit) {\n setTimeout(() => onInit(rfInstance), 1);\n isInitialized.current = true;\n }\n }, [onInit, rfInstance.viewportInitialized]);\n}\n\nconst oppositePosition = {\n [Position.Left]: Position.Right,\n [Position.Right]: Position.Left,\n [Position.Top]: Position.Bottom,\n [Position.Bottom]: Position.Top,\n};\nconst ConnectionLine = ({ nodeId, handleType, style, type = ConnectionLineType.Bezier, CustomComponent, connectionStatus, }) => {\n const { fromNode, handleId, toX, toY, connectionMode } = useStore(useCallback((s) => ({\n fromNode: s.nodeInternals.get(nodeId),\n handleId: s.connectionHandleId,\n toX: (s.connectionPosition.x - s.transform[0]) / s.transform[2],\n toY: (s.connectionPosition.y - s.transform[1]) / s.transform[2],\n connectionMode: s.connectionMode,\n }), [nodeId]), shallow);\n const fromHandleBounds = fromNode?.[internalsSymbol]?.handleBounds;\n let handleBounds = fromHandleBounds?.[handleType];\n if (connectionMode === ConnectionMode.Loose) {\n handleBounds = handleBounds ? handleBounds : fromHandleBounds?.[handleType === 'source' ? 'target' : 'source'];\n }\n if (!fromNode || !handleBounds) {\n return null;\n }\n const fromHandle = handleId ? handleBounds.find((d) => d.id === handleId) : handleBounds[0];\n const fromHandleX = fromHandle ? fromHandle.x + fromHandle.width / 2 : (fromNode.width ?? 0) / 2;\n const fromHandleY = fromHandle ? fromHandle.y + fromHandle.height / 2 : fromNode.height ?? 0;\n const fromX = (fromNode.positionAbsolute?.x ?? 0) + fromHandleX;\n const fromY = (fromNode.positionAbsolute?.y ?? 0) + fromHandleY;\n const fromPosition = fromHandle?.position;\n const toPosition = fromPosition ? oppositePosition[fromPosition] : null;\n if (!fromPosition || !toPosition) {\n return null;\n }\n if (CustomComponent) {\n return (jsx(CustomComponent, { connectionLineType: type, connectionLineStyle: style, fromNode: fromNode, fromHandle: fromHandle, fromX: fromX, fromY: fromY, toX: toX, toY: toY, fromPosition: fromPosition, toPosition: toPosition, connectionStatus: connectionStatus }));\n }\n let dAttr = '';\n const pathParams = {\n sourceX: fromX,\n sourceY: fromY,\n sourcePosition: fromPosition,\n targetX: toX,\n targetY: toY,\n targetPosition: toPosition,\n };\n if (type === ConnectionLineType.Bezier) {\n // we assume the destination position is opposite to the source position\n [dAttr] = getBezierPath(pathParams);\n }\n else if (type === ConnectionLineType.Step) {\n [dAttr] = getSmoothStepPath({\n ...pathParams,\n borderRadius: 0,\n });\n }\n else if (type === ConnectionLineType.SmoothStep) {\n [dAttr] = getSmoothStepPath(pathParams);\n }\n else if (type === ConnectionLineType.SimpleBezier) {\n [dAttr] = getSimpleBezierPath(pathParams);\n }\n else {\n dAttr = `M${fromX},${fromY} ${toX},${toY}`;\n }\n return jsx(\"path\", { d: dAttr, fill: \"none\", className: \"react-flow__connection-path\", style: style });\n};\nConnectionLine.displayName = 'ConnectionLine';\nconst selector$2 = (s) => ({\n nodeId: s.connectionNodeId,\n handleType: s.connectionHandleType,\n nodesConnectable: s.nodesConnectable,\n connectionStatus: s.connectionStatus,\n width: s.width,\n height: s.height,\n});\nfunction ConnectionLineWrapper({ containerStyle, style, type, component }) {\n const { nodeId, handleType, nodesConnectable, width, height, connectionStatus } = useStore(selector$2, shallow);\n const isValid = !!(nodeId && handleType && width && nodesConnectable);\n if (!isValid) {\n return null;\n }\n return (jsx(\"svg\", { style: containerStyle, width: width, height: height, className: \"react-flow__edges react-flow__connectionline react-flow__container\", children: jsx(\"g\", { className: cc(['react-flow__connection', connectionStatus]), children: jsx(ConnectionLine, { nodeId: nodeId, handleType: handleType, style: style, type: type, CustomComponent: component, connectionStatus: connectionStatus }) }) }));\n}\n\nconst GraphView = ({ nodeTypes, edgeTypes, onMove, onMoveStart, onMoveEnd, onInit, onNodeClick, onEdgeClick, onNodeDoubleClick, onEdgeDoubleClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onSelectionContextMenu, onSelectionStart, onSelectionEnd, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, deleteKeyCode, onlyRenderVisibleElements, elementsSelectable, selectNodesOnDrag, defaultViewport, translateExtent, minZoom, maxZoom, preventScrolling, defaultMarkerColor, zoomOnScroll, zoomOnPinch, panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, onEdgeUpdate, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, edgeUpdaterRadius, onEdgeUpdateStart, onEdgeUpdateEnd, noDragClassName, noWheelClassName, noPanClassName, elevateEdgesOnSelect, disableKeyboardA11y, nodeOrigin, nodeExtent, rfId, }) => {\n useOnInitHandler(onInit);\n return (jsx(FlowRenderer$1, { onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneContextMenu: onPaneContextMenu, onPaneScroll: onPaneScroll, deleteKeyCode: deleteKeyCode, selectionKeyCode: selectionKeyCode, selectionOnDrag: selectionOnDrag, selectionMode: selectionMode, onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, multiSelectionKeyCode: multiSelectionKeyCode, panActivationKeyCode: panActivationKeyCode, zoomActivationKeyCode: zoomActivationKeyCode, elementsSelectable: elementsSelectable, onMove: onMove, onMoveStart: onMoveStart, onMoveEnd: onMoveEnd, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, zoomOnDoubleClick: zoomOnDoubleClick, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, panOnDrag: panOnDrag, defaultViewport: defaultViewport, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, onSelectionContextMenu: onSelectionContextMenu, preventScrolling: preventScrolling, noDragClassName: noDragClassName, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, disableKeyboardA11y: disableKeyboardA11y, children: jsxs(Viewport, { children: [jsx(EdgeRenderer$1, { edgeTypes: edgeTypes, onEdgeClick: onEdgeClick, onEdgeDoubleClick: onEdgeDoubleClick, onEdgeUpdate: onEdgeUpdate, onlyRenderVisibleElements: onlyRenderVisibleElements, onEdgeContextMenu: onEdgeContextMenu, onEdgeMouseEnter: onEdgeMouseEnter, onEdgeMouseMove: onEdgeMouseMove, onEdgeMouseLeave: onEdgeMouseLeave, onEdgeUpdateStart: onEdgeUpdateStart, onEdgeUpdateEnd: onEdgeUpdateEnd, edgeUpdaterRadius: edgeUpdaterRadius, defaultMarkerColor: defaultMarkerColor, noPanClassName: noPanClassName, elevateEdgesOnSelect: !!elevateEdgesOnSelect, disableKeyboardA11y: disableKeyboardA11y, rfId: rfId, children: jsx(ConnectionLineWrapper, { style: connectionLineStyle, type: connectionLineType, component: connectionLineComponent, containerStyle: connectionLineContainerStyle }) }), jsx(\"div\", { className: \"react-flow__edgelabel-renderer\" }), jsx(NodeRenderer$1, { nodeTypes: nodeTypes, onNodeClick: onNodeClick, onNodeDoubleClick: onNodeDoubleClick, onNodeMouseEnter: onNodeMouseEnter, onNodeMouseMove: onNodeMouseMove, onNodeMouseLeave: onNodeMouseLeave, onNodeContextMenu: onNodeContextMenu, selectNodesOnDrag: selectNodesOnDrag, onlyRenderVisibleElements: onlyRenderVisibleElements, noPanClassName: noPanClassName, noDragClassName: noDragClassName, disableKeyboardA11y: disableKeyboardA11y, nodeOrigin: nodeOrigin, nodeExtent: nodeExtent, rfId: rfId })] }) }));\n};\nGraphView.displayName = 'GraphView';\nvar GraphView$1 = memo(GraphView);\n\nconst infiniteExtent = [\n [Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY],\n [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY],\n];\nconst initialState = {\n rfId: '1',\n width: 0,\n height: 0,\n transform: [0, 0, 1],\n nodeInternals: new Map(),\n edges: [],\n onNodesChange: null,\n onEdgesChange: null,\n hasDefaultNodes: false,\n hasDefaultEdges: false,\n d3Zoom: null,\n d3Selection: null,\n d3ZoomHandler: undefined,\n minZoom: 0.5,\n maxZoom: 2,\n translateExtent: infiniteExtent,\n nodeExtent: infiniteExtent,\n nodesSelectionActive: false,\n userSelectionActive: false,\n userSelectionRect: null,\n connectionNodeId: null,\n connectionHandleId: null,\n connectionHandleType: 'source',\n connectionPosition: { x: 0, y: 0 },\n connectionStatus: null,\n connectionMode: ConnectionMode.Strict,\n domNode: null,\n paneDragging: false,\n noPanClassName: 'nopan',\n nodeOrigin: [0, 0],\n snapGrid: [15, 15],\n snapToGrid: false,\n nodesDraggable: true,\n nodesConnectable: true,\n nodesFocusable: true,\n edgesFocusable: true,\n edgesUpdatable: true,\n elementsSelectable: true,\n elevateNodesOnSelect: true,\n fitViewOnInit: false,\n fitViewOnInitDone: false,\n fitViewOnInitOptions: undefined,\n multiSelectionActive: false,\n connectionStartHandle: null,\n connectionEndHandle: null,\n connectionClickStartHandle: null,\n connectOnClick: true,\n ariaLiveMessage: '',\n autoPanOnConnect: true,\n autoPanOnNodeDrag: true,\n connectionRadius: 20,\n onError: devWarn,\n isValidConnection: undefined,\n};\n\nconst createRFStore = () => createStore((set, get) => ({\n ...initialState,\n setNodes: (nodes) => {\n const { nodeInternals, nodeOrigin, elevateNodesOnSelect } = get();\n set({ nodeInternals: createNodeInternals(nodes, nodeInternals, nodeOrigin, elevateNodesOnSelect) });\n },\n getNodes: () => {\n return Array.from(get().nodeInternals.values());\n },\n setEdges: (edges) => {\n const { defaultEdgeOptions = {} } = get();\n set({ edges: edges.map((e) => ({ ...defaultEdgeOptions, ...e })) });\n },\n setDefaultNodesAndEdges: (nodes, edges) => {\n const hasDefaultNodes = typeof nodes !== 'undefined';\n const hasDefaultEdges = typeof edges !== 'undefined';\n const nodeInternals = hasDefaultNodes\n ? createNodeInternals(nodes, new Map(), get().nodeOrigin, get().elevateNodesOnSelect)\n : new Map();\n const nextEdges = hasDefaultEdges ? edges : [];\n set({ nodeInternals, edges: nextEdges, hasDefaultNodes, hasDefaultEdges });\n },\n updateNodeDimensions: (updates) => {\n const { onNodesChange, nodeInternals, fitViewOnInit, fitViewOnInitDone, fitViewOnInitOptions, domNode, nodeOrigin, } = get();\n const viewportNode = domNode?.querySelector('.react-flow__viewport');\n if (!viewportNode) {\n return;\n }\n const style = window.getComputedStyle(viewportNode);\n const { m22: zoom } = new window.DOMMatrixReadOnly(style.transform);\n const changes = updates.reduce((res, update) => {\n const node = nodeInternals.get(update.id);\n if (node) {\n const dimensions = getDimensions(update.nodeElement);\n const doUpdate = !!(dimensions.width &&\n dimensions.height &&\n (node.width !== dimensions.width || node.height !== dimensions.height || update.forceUpdate));\n if (doUpdate) {\n nodeInternals.set(node.id, {\n ...node,\n [internalsSymbol]: {\n ...node[internalsSymbol],\n handleBounds: {\n source: getHandleBounds('.source', update.nodeElement, zoom, nodeOrigin),\n target: getHandleBounds('.target', update.nodeElement, zoom, nodeOrigin),\n },\n },\n ...dimensions,\n });\n res.push({\n id: node.id,\n type: 'dimensions',\n dimensions,\n });\n }\n }\n return res;\n }, []);\n updateAbsoluteNodePositions(nodeInternals, nodeOrigin);\n const nextFitViewOnInitDone = fitViewOnInitDone ||\n (fitViewOnInit && !fitViewOnInitDone && fitView(get, { initial: true, ...fitViewOnInitOptions }));\n set({ nodeInternals: new Map(nodeInternals), fitViewOnInitDone: nextFitViewOnInitDone });\n if (changes?.length > 0) {\n onNodesChange?.(changes);\n }\n },\n updateNodePositions: (nodeDragItems, positionChanged = true, dragging = false) => {\n const { triggerNodeChanges } = get();\n const changes = nodeDragItems.map((node) => {\n const change = {\n id: node.id,\n type: 'position',\n dragging,\n };\n if (positionChanged) {\n change.positionAbsolute = node.positionAbsolute;\n change.position = node.position;\n }\n return change;\n });\n triggerNodeChanges(changes);\n },\n triggerNodeChanges: (changes) => {\n const { onNodesChange, nodeInternals, hasDefaultNodes, nodeOrigin, getNodes, elevateNodesOnSelect } = get();\n if (changes?.length) {\n if (hasDefaultNodes) {\n const nodes = applyNodeChanges(changes, getNodes());\n const nextNodeInternals = createNodeInternals(nodes, nodeInternals, nodeOrigin, elevateNodesOnSelect);\n set({ nodeInternals: nextNodeInternals });\n }\n onNodesChange?.(changes);\n }\n },\n addSelectedNodes: (selectedNodeIds) => {\n const { multiSelectionActive, edges, getNodes } = get();\n let changedNodes;\n let changedEdges = null;\n if (multiSelectionActive) {\n changedNodes = selectedNodeIds.map((nodeId) => createSelectionChange(nodeId, true));\n }\n else {\n changedNodes = getSelectionChanges(getNodes(), selectedNodeIds);\n changedEdges = getSelectionChanges(edges, []);\n }\n updateNodesAndEdgesSelections({\n changedNodes,\n changedEdges,\n get,\n set,\n });\n },\n addSelectedEdges: (selectedEdgeIds) => {\n const { multiSelectionActive, edges, getNodes } = get();\n let changedEdges;\n let changedNodes = null;\n if (multiSelectionActive) {\n changedEdges = selectedEdgeIds.map((edgeId) => createSelectionChange(edgeId, true));\n }\n else {\n changedEdges = getSelectionChanges(edges, selectedEdgeIds);\n changedNodes = getSelectionChanges(getNodes(), []);\n }\n updateNodesAndEdgesSelections({\n changedNodes,\n changedEdges,\n get,\n set,\n });\n },\n unselectNodesAndEdges: ({ nodes, edges } = {}) => {\n const { edges: storeEdges, getNodes } = get();\n const nodesToUnselect = nodes ? nodes : getNodes();\n const edgesToUnselect = edges ? edges : storeEdges;\n const changedNodes = nodesToUnselect.map((n) => {\n n.selected = false;\n return createSelectionChange(n.id, false);\n });\n const changedEdges = edgesToUnselect.map((edge) => createSelectionChange(edge.id, false));\n updateNodesAndEdgesSelections({\n changedNodes,\n changedEdges,\n get,\n set,\n });\n },\n setMinZoom: (minZoom) => {\n const { d3Zoom, maxZoom } = get();\n d3Zoom?.scaleExtent([minZoom, maxZoom]);\n set({ minZoom });\n },\n setMaxZoom: (maxZoom) => {\n const { d3Zoom, minZoom } = get();\n d3Zoom?.scaleExtent([minZoom, maxZoom]);\n set({ maxZoom });\n },\n setTranslateExtent: (translateExtent) => {\n get().d3Zoom?.translateExtent(translateExtent);\n set({ translateExtent });\n },\n resetSelectedElements: () => {\n const { edges, getNodes } = get();\n const nodes = getNodes();\n const nodesToUnselect = nodes\n .filter((e) => e.selected)\n .map((n) => createSelectionChange(n.id, false));\n const edgesToUnselect = edges\n .filter((e) => e.selected)\n .map((e) => createSelectionChange(e.id, false));\n updateNodesAndEdgesSelections({\n changedNodes: nodesToUnselect,\n changedEdges: edgesToUnselect,\n get,\n set,\n });\n },\n setNodeExtent: (nodeExtent) => {\n const { nodeInternals } = get();\n nodeInternals.forEach((node) => {\n node.positionAbsolute = clampPosition(node.position, nodeExtent);\n });\n set({\n nodeExtent,\n nodeInternals: new Map(nodeInternals),\n });\n },\n panBy: (delta) => {\n const { transform, width, height, d3Zoom, d3Selection, translateExtent } = get();\n if (!d3Zoom || !d3Selection || (!delta.x && !delta.y)) {\n return false;\n }\n const nextTransform = zoomIdentity.translate(transform[0] + delta.x, transform[1] + delta.y).scale(transform[2]);\n const extent = [\n [0, 0],\n [width, height],\n ];\n const constrainedTransform = d3Zoom?.constrain()(nextTransform, extent, translateExtent);\n d3Zoom.transform(d3Selection, constrainedTransform);\n const transformChanged = transform[0] !== constrainedTransform.x ||\n transform[1] !== constrainedTransform.y ||\n transform[2] !== constrainedTransform.k;\n return transformChanged;\n },\n cancelConnection: () => set({\n connectionNodeId: initialState.connectionNodeId,\n connectionHandleId: initialState.connectionHandleId,\n connectionHandleType: initialState.connectionHandleType,\n connectionStatus: initialState.connectionStatus,\n connectionStartHandle: initialState.connectionStartHandle,\n connectionEndHandle: initialState.connectionEndHandle,\n }),\n reset: () => set({ ...initialState }),\n}));\n\nconst ReactFlowProvider = ({ children }) => {\n const storeRef = useRef(null);\n if (!storeRef.current) {\n storeRef.current = createRFStore();\n }\n return jsx(Provider$1, { value: storeRef.current, children: children });\n};\nReactFlowProvider.displayName = 'ReactFlowProvider';\n\nconst Wrapper = ({ children }) => {\n const isWrapped = useContext(StoreContext);\n if (isWrapped) {\n // we need to wrap it with a fragment because it's not allowed for children to be a ReactNode\n // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18051\n return jsx(Fragment, { children: children });\n }\n return jsx(ReactFlowProvider, { children: children });\n};\nWrapper.displayName = 'ReactFlowWrapper';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction useNodeOrEdgeTypes(nodeOrEdgeTypes, createTypes) {\n const typesKeysRef = useRef(null);\n const typesParsed = useMemo(() => {\n if (process.env.NODE_ENV === 'development') {\n const typeKeys = Object.keys(nodeOrEdgeTypes);\n if (shallow(typesKeysRef.current, typeKeys)) {\n devWarn('002', errorMessages['error002']());\n }\n typesKeysRef.current = typeKeys;\n }\n return createTypes(nodeOrEdgeTypes);\n }, [nodeOrEdgeTypes]);\n return typesParsed;\n}\n\nconst defaultNodeTypes = {\n input: InputNode$1,\n default: DefaultNode$1,\n output: OutputNode$1,\n group: GroupNode,\n};\nconst defaultEdgeTypes = {\n default: BezierEdge,\n straight: StraightEdge,\n step: StepEdge,\n smoothstep: SmoothStepEdge,\n simplebezier: SimpleBezierEdge,\n};\nconst initNodeOrigin = [0, 0];\nconst initSnapGrid = [15, 15];\nconst initDefaultViewport = { x: 0, y: 0, zoom: 1 };\nconst wrapperStyle = {\n width: '100%',\n height: '100%',\n overflow: 'hidden',\n position: 'relative',\n zIndex: 0,\n};\nconst ReactFlow = forwardRef(({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes = defaultNodeTypes, edgeTypes = defaultEdgeTypes, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, connectionMode = ConnectionMode.Strict, connectionLineType = ConnectionLineType.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = 'Backspace', selectionKeyCode = 'Shift', selectionOnDrag = false, selectionMode = SelectionMode.Full, panActivationKeyCode = 'Space', multiSelectionKeyCode = 'Meta', zoomActivationKeyCode = 'Meta', snapToGrid = false, snapGrid = initSnapGrid, onlyRenderVisibleElements = false, selectNodesOnDrag = true, nodesDraggable, nodesConnectable, nodesFocusable, nodeOrigin = initNodeOrigin, edgesFocusable, edgesUpdatable, elementsSelectable, defaultViewport = initDefaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = true, nodeExtent, defaultMarkerColor = '#b1b1b7', zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, panOnDrag = true, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, children, onEdgeUpdate, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, onEdgeUpdateStart, onEdgeUpdateEnd, edgeUpdaterRadius = 10, onNodesChange, onEdgesChange, noDragClassName = 'nodrag', noWheelClassName = 'nowheel', noPanClassName = 'nopan', fitView = false, fitViewOptions, connectOnClick = true, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect = true, elevateEdgesOnSelect = false, disableKeyboardA11y = false, autoPanOnConnect = true, autoPanOnNodeDrag = true, connectionRadius = 20, isValidConnection, onError, style, id, ...rest }, ref) => {\n const nodeTypesWrapped = useNodeOrEdgeTypes(nodeTypes, createNodeTypes);\n const edgeTypesWrapped = useNodeOrEdgeTypes(edgeTypes, createEdgeTypes);\n const rfId = id || '1';\n return (jsx(\"div\", { ...rest, style: { ...style, ...wrapperStyle }, ref: ref, className: cc(['react-flow', className]), \"data-testid\": \"rf__wrapper\", id: id, children: jsxs(Wrapper, { children: [jsx(GraphView$1, { onInit: onInit, onMove: onMove, onMoveStart: onMoveStart, onMoveEnd: onMoveEnd, onNodeClick: onNodeClick, onEdgeClick: onEdgeClick, onNodeMouseEnter: onNodeMouseEnter, onNodeMouseMove: onNodeMouseMove, onNodeMouseLeave: onNodeMouseLeave, onNodeContextMenu: onNodeContextMenu, onNodeDoubleClick: onNodeDoubleClick, nodeTypes: nodeTypesWrapped, edgeTypes: edgeTypesWrapped, connectionLineType: connectionLineType, connectionLineStyle: connectionLineStyle, connectionLineComponent: connectionLineComponent, connectionLineContainerStyle: connectionLineContainerStyle, selectionKeyCode: selectionKeyCode, selectionOnDrag: selectionOnDrag, selectionMode: selectionMode, deleteKeyCode: deleteKeyCode, multiSelectionKeyCode: multiSelectionKeyCode, panActivationKeyCode: panActivationKeyCode, zoomActivationKeyCode: zoomActivationKeyCode, onlyRenderVisibleElements: onlyRenderVisibleElements, selectNodesOnDrag: selectNodesOnDrag, defaultViewport: defaultViewport, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, preventScrolling: preventScrolling, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, zoomOnDoubleClick: zoomOnDoubleClick, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, panOnDrag: panOnDrag, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneScroll: onPaneScroll, onPaneContextMenu: onPaneContextMenu, onSelectionContextMenu: onSelectionContextMenu, onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onEdgeUpdate: onEdgeUpdate, onEdgeContextMenu: onEdgeContextMenu, onEdgeDoubleClick: onEdgeDoubleClick, onEdgeMouseEnter: onEdgeMouseEnter, onEdgeMouseMove: onEdgeMouseMove, onEdgeMouseLeave: onEdgeMouseLeave, onEdgeUpdateStart: onEdgeUpdateStart, onEdgeUpdateEnd: onEdgeUpdateEnd, edgeUpdaterRadius: edgeUpdaterRadius, defaultMarkerColor: defaultMarkerColor, noDragClassName: noDragClassName, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, elevateEdgesOnSelect: elevateEdgesOnSelect, rfId: rfId, disableKeyboardA11y: disableKeyboardA11y, nodeOrigin: nodeOrigin, nodeExtent: nodeExtent }), jsx(StoreUpdater, { nodes: nodes, edges: edges, defaultNodes: defaultNodes, defaultEdges: defaultEdges, onConnect: onConnect, onConnectStart: onConnectStart, onConnectEnd: onConnectEnd, onClickConnectStart: onClickConnectStart, onClickConnectEnd: onClickConnectEnd, nodesDraggable: nodesDraggable, nodesConnectable: nodesConnectable, nodesFocusable: nodesFocusable, edgesFocusable: edgesFocusable, edgesUpdatable: edgesUpdatable, elementsSelectable: elementsSelectable, elevateNodesOnSelect: elevateNodesOnSelect, minZoom: minZoom, maxZoom: maxZoom, nodeExtent: nodeExtent, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, snapToGrid: snapToGrid, snapGrid: snapGrid, connectionMode: connectionMode, translateExtent: translateExtent, connectOnClick: connectOnClick, defaultEdgeOptions: defaultEdgeOptions, fitView: fitView, fitViewOptions: fitViewOptions, onNodesDelete: onNodesDelete, onEdgesDelete: onEdgesDelete, onNodeDragStart: onNodeDragStart, onNodeDrag: onNodeDrag, onNodeDragStop: onNodeDragStop, onSelectionDrag: onSelectionDrag, onSelectionDragStart: onSelectionDragStart, onSelectionDragStop: onSelectionDragStop, noPanClassName: noPanClassName, nodeOrigin: nodeOrigin, rfId: rfId, autoPanOnConnect: autoPanOnConnect, autoPanOnNodeDrag: autoPanOnNodeDrag, onError: onError, connectionRadius: connectionRadius, isValidConnection: isValidConnection }), jsx(Wrapper$1, { onSelectionChange: onSelectionChange }), children, jsx(Attribution, { proOptions: proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId: rfId, disableKeyboardA11y: disableKeyboardA11y })] }) }));\n});\nReactFlow.displayName = 'ReactFlow';\n\nconst selector$1 = (s) => s.domNode?.querySelector('.react-flow__edgelabel-renderer');\nfunction EdgeLabelRenderer({ children }) {\n const edgeLabelRenderer = useStore(selector$1);\n if (!edgeLabelRenderer) {\n return null;\n }\n return createPortal(children, edgeLabelRenderer);\n}\n\nfunction useUpdateNodeInternals() {\n const store = useStoreApi();\n return useCallback((id) => {\n const { domNode, updateNodeDimensions } = store.getState();\n const updateIds = Array.isArray(id) ? id : [id];\n const updates = updateIds.reduce((res, updateId) => {\n const nodeElement = domNode?.querySelector(`.react-flow__node[data-id=\"${updateId}\"]`);\n if (nodeElement) {\n res.push({ id: updateId, nodeElement, forceUpdate: true });\n }\n return res;\n }, []);\n requestAnimationFrame(() => updateNodeDimensions(updates));\n }, []);\n}\n\nconst nodesSelector = (state) => state.getNodes();\nfunction useNodes() {\n const nodes = useStore(nodesSelector, shallow);\n return nodes;\n}\n\nconst edgesSelector = (state) => state.edges;\nfunction useEdges() {\n const edges = useStore(edgesSelector, shallow);\n return edges;\n}\n\nconst viewportSelector = (state) => ({\n x: state.transform[0],\n y: state.transform[1],\n zoom: state.transform[2],\n});\nfunction useViewport() {\n const viewport = useStore(viewportSelector, shallow);\n return viewport;\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nfunction createUseItemsState(applyChanges) {\n return (initialItems) => {\n const [items, setItems] = useState(initialItems);\n const onItemsChange = useCallback((changes) => setItems((items) => applyChanges(changes, items)), []);\n return [items, setItems, onItemsChange];\n };\n}\nconst useNodesState = createUseItemsState(applyNodeChanges);\nconst useEdgesState = createUseItemsState(applyEdgeChanges);\n\nfunction useOnViewportChange({ onStart, onChange, onEnd }) {\n const store = useStoreApi();\n useEffect(() => {\n store.setState({ onViewportChangeStart: onStart });\n }, [onStart]);\n useEffect(() => {\n store.setState({ onViewportChange: onChange });\n }, [onChange]);\n useEffect(() => {\n store.setState({ onViewportChangeEnd: onEnd });\n }, [onEnd]);\n}\n\nfunction useOnSelectionChange({ onChange }) {\n const store = useStoreApi();\n useEffect(() => {\n store.setState({ onSelectionChange: onChange });\n }, [onChange]);\n}\n\nconst selector = (options) => (s) => {\n if (s.nodeInternals.size === 0) {\n return false;\n }\n return s\n .getNodes()\n .filter((n) => (options.includeHiddenNodes ? true : !n.hidden))\n .every((n) => n[internalsSymbol]?.handleBounds !== undefined);\n};\nconst defaultOptions = {\n includeHiddenNodes: false,\n};\nfunction useNodesInitialized(options = defaultOptions) {\n const initialized = useStore(selector(options));\n return initialized;\n}\n\nexport { BaseEdge, BezierEdge, ConnectionLineType, ConnectionMode, EdgeLabelRenderer, EdgeText$1 as EdgeText, Handle$1 as Handle, MarkerType, PanOnScrollMode, Panel, Position, ReactFlow, ReactFlowProvider, SelectionMode, SimpleBezierEdge, SmoothStepEdge, StepEdge, StraightEdge, addEdge, applyEdgeChanges, applyNodeChanges, boxToRect, clamp, getBezierPath, getBoundsOfRects, getConnectedEdges, getIncomers, getMarkerEnd, getNodePositionWithOrigin, getOutgoers, getRectOfNodes, getSimpleBezierPath, getSmoothStepPath, getStraightPath, getTransformForBounds, internalsSymbol, isEdge, isNode, rectToBox, updateEdge, useEdges, useEdgesState, useGetPointerPosition, useKeyPress, useNodeId, useNodes, useNodesInitialized, useNodesState, useOnSelectionChange, useOnViewportChange, useReactFlow, useStore, useStoreApi, useUpdateNodeInternals, useViewport };\n","import { jsx, jsxs, Fragment } from 'react/jsx-runtime';\nimport { memo, useState, useEffect } from 'react';\nimport cc from 'classcat';\nimport { shallow } from 'zustand/shallow';\nimport { useStoreApi, useStore, useReactFlow, Panel } from '@reactflow/core';\n\nfunction PlusIcon() {\n return (jsx(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", viewBox: \"0 0 32 32\", children: jsx(\"path\", { d: \"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z\" }) }));\n}\n\nfunction MinusIcon() {\n return (jsx(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", viewBox: \"0 0 32 5\", children: jsx(\"path\", { d: \"M0 0h32v4.2H0z\" }) }));\n}\n\nfunction FitViewIcon() {\n return (jsx(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", viewBox: \"0 0 32 30\", children: jsx(\"path\", { d: \"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z\" }) }));\n}\n\nfunction LockIcon() {\n return (jsx(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", viewBox: \"0 0 25 32\", children: jsx(\"path\", { d: \"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z\" }) }));\n}\n\nfunction UnlockIcon() {\n return (jsx(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", viewBox: \"0 0 25 32\", children: jsx(\"path\", { d: \"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z\" }) }));\n}\n\nconst ControlButton = ({ children, className, ...rest }) => (jsx(\"button\", { type: \"button\", className: cc(['react-flow__controls-button', className]), ...rest, children: children }));\nControlButton.displayName = 'ControlButton';\n\nconst selector = (s) => ({\n isInteractive: s.nodesDraggable || s.nodesConnectable || s.elementsSelectable,\n minZoomReached: s.transform[2] <= s.minZoom,\n maxZoomReached: s.transform[2] >= s.maxZoom,\n});\nconst Controls = ({ style, showZoom = true, showFitView = true, showInteractive = true, fitViewOptions, onZoomIn, onZoomOut, onFitView, onInteractiveChange, className, children, position = 'bottom-left', }) => {\n const store = useStoreApi();\n const [isVisible, setIsVisible] = useState(false);\n const { isInteractive, minZoomReached, maxZoomReached } = useStore(selector, shallow);\n const { zoomIn, zoomOut, fitView } = useReactFlow();\n useEffect(() => {\n setIsVisible(true);\n }, []);\n if (!isVisible) {\n return null;\n }\n const onZoomInHandler = () => {\n zoomIn();\n onZoomIn?.();\n };\n const onZoomOutHandler = () => {\n zoomOut();\n onZoomOut?.();\n };\n const onFitViewHandler = () => {\n fitView(fitViewOptions);\n onFitView?.();\n };\n const onToggleInteractivity = () => {\n store.setState({\n nodesDraggable: !isInteractive,\n nodesConnectable: !isInteractive,\n elementsSelectable: !isInteractive,\n });\n onInteractiveChange?.(!isInteractive);\n };\n return (jsxs(Panel, { className: cc(['react-flow__controls', className]), position: position, style: style, \"data-testid\": \"rf__controls\", children: [showZoom && (jsxs(Fragment, { children: [jsx(ControlButton, { onClick: onZoomInHandler, className: \"react-flow__controls-zoomin\", title: \"zoom in\", \"aria-label\": \"zoom in\", disabled: maxZoomReached, children: jsx(PlusIcon, {}) }), jsx(ControlButton, { onClick: onZoomOutHandler, className: \"react-flow__controls-zoomout\", title: \"zoom out\", \"aria-label\": \"zoom out\", disabled: minZoomReached, children: jsx(MinusIcon, {}) })] })), showFitView && (jsx(ControlButton, { className: \"react-flow__controls-fitview\", onClick: onFitViewHandler, title: \"fit view\", \"aria-label\": \"fit view\", children: jsx(FitViewIcon, {}) })), showInteractive && (jsx(ControlButton, { className: \"react-flow__controls-interactive\", onClick: onToggleInteractivity, title: \"toggle interactivity\", \"aria-label\": \"toggle interactivity\", children: isInteractive ? jsx(UnlockIcon, {}) : jsx(LockIcon, {}) })), children] }));\n};\nControls.displayName = 'Controls';\nvar Controls$1 = memo(Controls);\n\nexport { ControlButton, Controls$1 as Controls };\n","import { useEffect, useState } from 'react'\nimport { parseValue } from '../common'\n\nlet data = {}\nif (window.location.hash) {\n try {\n data = JSON.parse(atob(window.location.hash.replace('#', ''))) || {}\n } catch (e) {\n window.location.hash = ''\n data = {}\n }\n}\n\nexport default function usePersistedState(key, def, startTransition, locationRef) {\n const [val, setVal] = useState(() => {\n if (locationRef && data[key]) {\n return parseValue(data[key])\n }\n\n try {\n const item = localStorage.getItem(key)\n return item && item !== '' ? parseValue(JSON.parse(item), def) : def\n } catch (e) {\n console.warn(e)\n return def\n }\n })\n\n useEffect(() => {\n try {\n localStorage.setItem(key, JSON.stringify(val))\n data[key] = val\n\n if (locationRef) {\n locationRef.current.value = 'https://mapsofexile.com/#' + btoa(JSON.stringify(data))\n }\n } catch (e) {\n console.warn(e)\n }\n }, [key, val, locationRef])\n\n return [\n val,\n e => {\n const val = e.hasOwnProperty('target') ? e.target.value : e\n if (startTransition) {\n startTransition(() => setVal(val === '' ? def : parseValue(val, def)))\n } else {\n setVal(val === '' ? def : parseValue(val, def))\n }\n }\n ]\n}\n","import './MapImage.css'\n\nconst MapImage = ({ icon, tier = 0, unique = false, onClick = null }) => {\n let color = 'map-white'\n if (\n unique ||\n icon.includes('Minotaur') ||\n icon.includes('Hydra') ||\n icon.includes('Chimera') ||\n icon.includes('Phoenix')\n ) {\n color = ''\n } else if (tier >= 11) {\n color = 'map-red'\n } else if (tier >= 6) {\n color = 'map-yellow'\n }\n\n let extraClass = ''\n if (!unique) {\n extraClass = ' map-background'\n }\n\n return (\n \n
\n
\n )\n}\n\nexport default MapImage\n","import 'reactflow/dist/base.css'\nimport './Atlas.css'\n\nimport { useCallback, useEffect, useMemo } from 'react'\nimport ReactFlow, { ControlButton, Controls, Handle, Panel, Position, useReactFlow } from 'reactflow'\nimport { deduplicate, filter, ratingColor, scrollToElement, tierColor } from '../common'\nimport useKeyPress from '../hooks/useKeyPress'\nimport usePersistedState from '../hooks/usePersistedState'\nimport MapImage from './MapImage'\nimport { possibleVoidstones, preparedGlobals } from '../data'\n\nconst scale = 3\nconst offset = 6\nconst bgId = 'bg'\n\nfunction toNode(map, matchingNodes, atlasScore, atlasIcons, atlasLabels, voidstones) {\n return {\n id: map.name,\n parentNode: bgId,\n type: 'map',\n position: {\n x: map.x * scale + offset,\n y: map.y * scale + offset\n },\n data: {\n atlasScore,\n atlasIcons,\n atlasLabels,\n voidstones: voidstones,\n map: {\n name: map.name,\n tiers: map.tiers,\n icon: map.icon,\n unique: map.unique,\n score: map.score\n }\n },\n style: {\n opacity: matchingNodes.includes(map.name) ? 1 : 0.4\n },\n selectable: true\n }\n}\n\nfunction toLinks(map) {\n return map.connected.map(c => {\n const con = [map.name, c.name].sort()\n\n return {\n id: con[0] + '-' + con[1],\n source: con[0],\n target: con[1]\n }\n })\n}\n\nfunction BackgroundNode({ data }) {\n return \n}\n\nfunction MapNode({ id, data }) {\n const atlasScore = data.atlasScore\n const atlasIcons = data.atlasIcons\n const atlasLabels = data.atlasLabels\n const map = data.map\n\n let mapColor\n if (atlasScore) {\n mapColor = `text-${ratingColor(map.score, 10)}`\n } else {\n mapColor = `text-${tierColor(map.tiers, map.unique, data.voidstones)}`\n }\n\n const buttonClass = `btn btn-badge btn-dark ${mapColor}` + (atlasIcons ? ' atlas-button' : '')\n const label = (atlasScore ? map.score + ' ' : '') + map.name\n\n return (\n <>\n \n \n {!!atlasIcons && (\n scrollToElement(id)}\n />\n )}\n {!!atlasLabels && (\n scrollToElement(id)}>\n {label}\n \n )}\n >\n )\n}\n\nconst Atlas = ({ maps, currentSearch, full, setFull, voidstones, setVoidstones }) => {\n const flow = useReactFlow()\n const [atlasScore, setAtlasScore] = usePersistedState('atlasScore', false)\n const [atlasIcons, setAtlasIcons] = usePersistedState('atlasIcons', true)\n const [atlasLabels, setAtlasLabels] = usePersistedState('atlasLabels', true)\n\n const nodeTypes = useMemo(() => ({ background: BackgroundNode, map: MapNode }), [])\n const connectedMaps = useMemo(() => maps.filter(m => m.connected.length > 0 && m.x > 0 && m.y > 0), [maps])\n const matchingNodes = useMemo(\n () => connectedMaps.filter(m => filter(currentSearch, m.search)).map(m => m.name),\n [connectedMaps, currentSearch]\n )\n\n const fitMatching = useCallback(\n () =>\n flow.fitView({\n nodes: matchingNodes.map(n => ({ id: n }))\n }),\n [flow, matchingNodes]\n )\n\n const data = useMemo(\n () => ({\n nodes: [\n {\n id: bgId,\n type: 'background',\n position: {\n x: 0,\n y: 0\n },\n data: {\n image: '/img/atlas.webp',\n width: preparedGlobals['atlas']['width'] * scale,\n height: preparedGlobals['atlas']['height'] * scale\n },\n zIndex: -1\n }\n ].concat(connectedMaps.map(m => toNode(m, matchingNodes, atlasScore, atlasIcons, atlasLabels, voidstones))),\n edges: deduplicate(\n connectedMaps.flatMap(m => toLinks(m)),\n 'id'\n )\n }),\n [connectedMaps, matchingNodes, atlasScore, atlasIcons, atlasLabels, voidstones]\n )\n\n useKeyPress(['Escape'], () => {\n if (full) {\n setFull(false)\n }\n })\n\n useEffect(() => {\n setTimeout(() => fitMatching(), 150)\n }, [fitMatching, full])\n\n return (\n \n
\n \n \n
{' '}\n
\n {possibleVoidstones.map(v => (\n <>\n setVoidstones(v)}\n >\n {v}\n \n >\n ))}\n
\n
\n \n \n \n \n \n setAtlasIcons(!atlasIcons)} title=\"Map icons\">\n \n \n setAtlasLabels(!atlasLabels)} title=\"Map labels\">\n \n \n setAtlasScore(!atlasScore)} title=\"Score heatmap\">\n \n \n setFull(!full)} title=\"Fullscreen\">\n {full ? : }\n \n \n \n
\n )\n}\n\nexport default Atlas\n","import { useCallback, useEffect, useLayoutEffect, useRef } from 'react'\n\nexport default function useKeyPress(keys, callback, node = null) {\n const callbackRef = useRef(callback)\n useLayoutEffect(() => {\n callbackRef.current = callback\n })\n\n const handleKeyPress = useCallback(\n event => {\n if (keys.some(key => event.key === key)) {\n callbackRef.current(event)\n }\n },\n [keys]\n )\n\n useEffect(() => {\n const targetNode = node || document\n if (targetNode) {\n targetNode.addEventListener('keydown', handleKeyPress)\n }\n\n return () => targetNode && targetNode.removeEventListener('keydown', handleKeyPress)\n }, [handleKeyPress, node])\n}\n","const Tags = ({ tags, currentSearch, addToInput }) => {\n return tags.map(t => {\n const val = t.name\n const info = t.info\n\n const searched = currentSearch.find(c => c.value === val)\n let color = 'btn-secondary'\n if (searched) {\n color = searched.neg ? 'btn-danger' : 'btn-success'\n }\n\n const buttons = []\n buttons.push(\n addToInput(val, searched ? !searched.neg : false, false)}\n >\n {val} {info && * }\n \n )\n\n if (searched) {\n buttons.push(\n addToInput(val, searched.neg, true)}>\n \n \n )\n }\n\n return info ? (\n \n {info} \n {buttons}
\n \n ) : (\n {buttons}
\n )\n })\n}\n\nexport default Tags\n","import { useRef } from 'react'\nimport usePersistedState from './usePersistedState'\n\nexport default function useInputField(key, def, startTransition, locationRef) {\n const ref = useRef(null)\n const [val, setter] = usePersistedState(key, def, startTransition, locationRef)\n\n return [\n val,\n setter,\n () => {\n if (ref.current) {\n ref.current.value = def\n }\n setter(def)\n },\n ref\n ]\n}\n","import { useEffect, useState } from 'react'\n\nconst GoToTop = () => {\n const [showGoTop, setShowGoTop] = useState(false)\n const handleVisibleButton = () => setShowGoTop(window.pageYOffset > 200)\n const handleScrollUp = () => window.scrollTo({ left: 0, top: 0, behavior: 'smooth' })\n useEffect(() => window.addEventListener('scroll', handleVisibleButton), [])\n\n return (\n \n \n \n \n
\n )\n}\n\nexport default GoToTop\n","import { ratingColor } from '../common'\n\nconst Rating = ({ rating, tooltip, label = '', scale = 1 }) => {\n const badgeClass = `m-1 badge badge-fw text-dark bg-${ratingColor(rating, scale)}`\n\n if (rating == null) {\n rating = '?'\n }\n\n const badge = (\n \n {rating} \n {label && ' ' + label}\n \n )\n\n if (tooltip) {\n return (\n \n {tooltip} \n {badge}\n \n )\n }\n\n return badge\n}\n\nexport default Rating\n","import Tags from './Tags'\nimport { tierColor } from '../common'\nimport Rating from './Rating'\nimport MapImage from './MapImage'\n\nconst MapName = ({ map, currentSearch, addToInput, voidstones }) => {\n const color = `text-${tierColor(map.tiers, map.unique)}`\n\n const name = (\n \n {map.name}\n \n )\n\n const mapName = map.image ? (\n \n \n \n \n {name}\n \n ) : (\n name\n )\n\n const tags = \n const icon = \n const score = (\n \n \n \n )\n\n return (\n \n
\n {icon}\n {score}\n
\n
\n {mapName}\n \n {map.tiers.join(', ')} \n \n {tags}\n
\n
\n )\n}\n\nexport default MapName\n","import Rating from './Rating'\n\nconst MapBoss = ({ boss, rating, tooltip }) => {\n const badge = \n\n if (boss.names || tooltip) {\n return (\n \n \n {boss.names &&\n boss.names.map(b => (\n \n {b}\n \n \n ))}\n {tooltip || ''}\n \n {badge}\n \n )\n }\n\n return badge\n}\n\nexport default MapBoss\n","import { ratingColor, scrollToElement } from '../common'\n\nconst MapConnected = ({ connected }) => {\n return connected.map(m => (\n <>\n scrollToElement(m.name)}>\n {Math.round(m.score) + ' '} \n {m.name}\n \n \n >\n ))\n}\n\nexport default MapConnected\n","import './MapCards.css'\nimport { useMemo } from 'react'\n\nfunction calcRate(mapRate, price, stack) {\n let perMap = 1\n let everyMap = 1 / mapRate\n if (everyMap < 1) {\n perMap = Math.floor(1 / everyMap)\n everyMap = 1\n } else {\n everyMap = Math.ceil(everyMap)\n }\n\n return {\n perMap,\n everyMap,\n value: Math.round(price * mapRate * stack * 1000) / 1000\n }\n}\n\nfunction calculateCardData(weight, card) {\n const mapRate = (card.weight / card.poolWeight) * card.dropPoolItems\n const kiracRate = card.weight / weight\n\n const calcMap = calcRate(mapRate, card.price, 1)\n const calcKirac = calcRate(kiracRate, card.price, card.stack)\n\n return {\n ...card,\n mapWeight: weight,\n map: calcMap,\n kirac: calcKirac\n }\n}\n\nfunction CardRateTooltip({ rate, description, name }) {\n const perDescription = rate.everyMap > 1 ? description + 's' : description\n return !!name ? (\n <>\n {rate.perMap} {name} every {rate.everyMap > 1 && rate.everyMap} {perDescription}\n = {rate.value} per {description}\n \n >\n ) : (\n <>\n = {rate.perMap} every {rate.everyMap > 1 && rate.everyMap} {perDescription}\n = {rate.value} per {description}\n \n >\n )\n}\n\nconst MapCard = ({ card }) => {\n let badgeClass = 'bg-secondary text-dark'\n if (card.score >= 8) {\n badgeClass = 'bg-light text-dark'\n } else if (card.score >= 5) {\n badgeClass = 'bg-primary text-light'\n } else if (card.score >= 2) {\n badgeClass = 'bg-info text-dark'\n } else if (card.score >= 0.5) {\n badgeClass = 'bg-dark text-info border border-1 border-info'\n }\n if (card.boss) {\n badgeClass += ' border border-1 border-warning'\n }\n if (card.weight === 0) {\n badgeClass += ' border border-1 border-danger'\n }\n\n badgeClass = `badge m-1 ${badgeClass}`\n\n let img = '/img/alch.png'\n if (card.price >= 100) {\n img = '/img/divine.png'\n } else if (card.price >= 20) {\n img = '/img/exalt.png'\n } else if (card.price >= 5) {\n img = '/img/chaos.png'\n }\n\n const tooltip = (\n <>\n \n {card.weight} (card weight)\n / {card.poolWeight} (drop pool weight)\n {card.dropPoolItems > 1 && (\n <>\n * {Math.round(card.dropPoolItems)} (drop pool items)\n >\n )}\n \n \n \n {card.weight} (card weight)\n / {card.mapWeight} (map pool weight)\n \n \n >\n )\n\n let dropLevel = null\n if (card.drop.min_level && card.drop.max_level) {\n dropLevel = (\n <>\n {card.drop.min_level} - {card.drop.max_level}\n >\n )\n } else if (card.drop.min_level) {\n dropLevel = <>>= {card.drop.min_level}>\n } else if (card.drop.max_level) {\n dropLevel = <><= {card.drop.max_level}>\n }\n\n return (\n \n \n \n \n {card.stack} \n \n Reward : {card.reward}\n \n Price : {card.price} \n \n Weight : {card.weight}\n {(card.drop.min_level || card.drop.max_level) && (\n <>\n \n Drop level : {dropLevel}\n >\n )}\n {card.boss && (\n <>\n \n Boss drop \n >\n )}\n {card.weight === 0 && (\n <>\n \n Cannot drop \n >\n )}\n {tooltip}\n \n \n \n {card.boss && }\n {card.name}\n \n \n )\n}\n\nconst MapCards = ({ weight, cards }) => {\n const total = useMemo(() => Math.round(cards.reduce((a, b) => a + b.value, 0) * 100) / 100, [cards])\n const cardsWithData = useMemo(() => cards.map(c => calculateCardData(weight, c)), [weight, cards])\n\n return (\n \n
\n
\n \n {cardsWithData\n .filter(c => c.value > 0)\n .map(c => (\n \n ))}\n \n {total} \n \n
\n
\n {cardsWithData.map(c => (\n \n ))}\n
\n
\n )\n}\n\nexport default MapCards\n","import MapName from './MapName'\nimport Rating from './Rating'\nimport MapBoss from './MapBoss'\nimport MapConnected from './MapConnected'\nimport MapCards from './MapCards'\nimport useLazy from '../hooks/useLazy'\n\nconst Map = ({ map, currentSearch, addToInput, voidstones }) => {\n const [ref, visible] = useLazy()\n\n return (\n \n \n \n \n \n \n \n \n
\n \n {visible ? (\n <>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n >\n ) : (\n <>\n \n \n \n \n \n >\n )}\n \n )\n}\n\nexport default Map\n","import { useEffect, useRef, useState } from 'react'\n\nexport default function useLazy() {\n const [visible, setVisible] = useState(false)\n const ref = useRef(null)\n\n useEffect(() => {\n const observer = new IntersectionObserver(es => {\n const [e] = es\n if (e.isIntersecting) {\n setVisible(true)\n e.target.classList.remove('lazy-bg')\n observer.unobserve(e.target)\n }\n })\n\n const cur = ref.current\n\n if (cur) {\n observer.observe(cur)\n }\n\n return () => cur && observer.unobserve(cur)\n }, [ref, setVisible])\n\n return [ref, visible]\n}\n","import 'bootstrap/dist/css/bootstrap.css'\nimport '@fortawesome/fontawesome-free/css/all.min.css'\nimport './App.css'\n\nimport { useCallback, useMemo, useRef, useTransition } from 'react'\nimport SelectSearch from 'react-select-search'\nimport {\n defaultCardBaseline,\n githubRepo,\n issueTemplate,\n mfAcademyInvite,\n preparedCards,\n preparedMaps,\n preparedTags\n} from './data'\nimport Loader from './components/Loader'\nimport Atlas from './components/Atlas'\nimport { calculateScore, copyToClipboard, filter, mapTierToLevel } from './common'\nimport Tags from './components/Tags'\nimport usePersistedState from './hooks/usePersistedState'\nimport useInputField from './hooks/useInputField'\nimport GoToTop from './components/GoToTop'\nimport Map from './components/Map'\nimport { ReactFlowProvider } from 'reactflow'\n\nfunction rateMaps(\n foundMaps,\n foundCards,\n layoutInput,\n densityInput,\n bossInput,\n cardInput,\n cardBaselineInput,\n cardBaselineNumberInput,\n cardMinPriceInput,\n useStandardPriceInput,\n voidstones\n) {\n let cardWeightBaseline = preparedCards.find(c => c.name === cardBaselineInput).weight\n if (cardBaselineNumberInput > 0) {\n cardWeightBaseline /= cardBaselineNumberInput\n } else if (cardBaselineNumberInput < 0) {\n cardWeightBaseline *= Math.abs(cardBaselineNumberInput)\n }\n\n // First calculate value for cards\n const mapsWithCardValues = foundMaps.map(map => {\n const mapLevel = mapTierToLevel(map.tiers[voidstones])\n const mapCards = []\n\n for (let card of map.cards) {\n const cardPrice = useStandardPriceInput === true ? card.standardPrice : card.price\n const dropPoolItems = 1 / (cardWeightBaseline / card.poolWeight) / (card.boss ? 10 : 1)\n const priceEligible = cardPrice >= cardMinPriceInput\n const cardMinLevel = (card.drop || {}).min_level || 0\n const cardMaxLevel = (card.drop || {}).max_level || 99\n const dropEligible = mapLevel >= cardMinLevel && mapLevel <= cardMaxLevel\n\n mapCards.push({\n ...card,\n price: cardPrice,\n dropPoolItems: dropPoolItems,\n weight: dropEligible ? card.weight : 0,\n value: priceEligible && dropEligible ? cardPrice * (card.weight / card.poolWeight) * dropPoolItems : 0\n })\n }\n\n return {\n ...map,\n weight: mapCards.reduce((a, v) => a + v.weight, 0),\n cards: mapCards.sort((a, b) => b.price - a.price).sort((a, b) => b.value - a.value)\n }\n })\n\n // Now calculate score for each card\n calculateScore(\n mapsWithCardValues.flatMap(m => m.cards),\n 10\n )\n\n // Now finally calculate overall map score\n const rated = calculateScore(\n mapsWithCardValues.map(map => {\n const layoutValue = (map.rating.layout || 0) * layoutInput\n const densityValue = (map.rating.density || 0) * densityInput\n const bossValue = (map.rating.boss || 0) * bossInput\n let cardValue = 0\n\n for (let card of map.cards) {\n cardValue += card.score * cardInput\n }\n\n map.value = layoutValue + densityValue + bossValue + cardValue\n return map\n }),\n 100\n )\n\n // Now find scores for connected maps\n for (let map of rated) {\n const connectedOut = []\n for (let connected of map.connected || []) {\n connectedOut.push({\n name: connected,\n score: (rated.find(rm => rm.name === connected) || {}).score || 0\n })\n }\n map.connected = connectedOut\n }\n\n return rated.sort((a, b) => b.score - a.score)\n}\n\nfunction parseSearch(s) {\n return (s || '')\n .split(',')\n .map(e => e.trim().toLowerCase())\n .filter(e => e)\n .map(e => ({\n value: e.replace(/[+-]/g, ''),\n neg: e.startsWith('-')\n }))\n}\n\nfunction buildSearch(s) {\n return s.map(v => (v.neg ? '-' : '') + v.value).join(', ')\n}\n\nfunction filterMaps(ratedMaps, currentSearch) {\n return ratedMaps\n .filter(m => !currentSearch || filter(currentSearch, m.search))\n .sort(\n (a, b) =>\n Number(filter(currentSearch, b.name.toLowerCase())) - Number(filter(currentSearch, a.name.toLowerCase()))\n )\n}\n\nfunction App() {\n const [isPending, startTransition] = useTransition()\n const shareableRef = useRef(null)\n const poeRegexRef = useRef(null)\n const searchRef = useRef(null)\n\n const [atlasFull, setAtlasFull] = usePersistedState('atlasFull', false, startTransition)\n const [atlasVoidstones, setAtlasVoidstones] = usePersistedState('atlasVoidstones', 0, startTransition)\n\n const [searchInput, setSearchInput] = usePersistedState('searchInput', '', startTransition, shareableRef)\n const [layoutInput, setLayoutInput, layoutReset, layoutRef] = useInputField(\n 'layoutInput',\n 3,\n startTransition,\n shareableRef\n )\n const [densityInput, setDensityInput, densityReset, densityRef] = useInputField(\n 'densityInput',\n 2,\n startTransition,\n shareableRef\n )\n const [bossInput, setBossInput, bossReset, bossRef] = useInputField('bossInput', 1, startTransition, shareableRef)\n const [cardInput, setCardInput, cardReset, cardRef] = useInputField(\n 'cardWeightInput',\n 2,\n startTransition,\n shareableRef\n )\n const [cardBaselineInput, setCardBaselineInput, cardBaselineReset] = useInputField(\n 'cardBaselineInput',\n defaultCardBaseline,\n startTransition,\n shareableRef\n )\n const [cardBaselineNumberInput, setCardBaselineNumberInput, cardBaselineNumberReset, cardBaselineNumberRef] =\n useInputField('cardBaselineNumberInput', 1, startTransition, shareableRef)\n const [cardMinPriceInput, setCardMinPriceInput, cardMinPriceReset, cardMinPriceRef] = useInputField(\n 'cardMinPriceInput',\n 10,\n startTransition,\n shareableRef\n )\n const [useStandardPriceInput, setUseStandardPriceInput, useStandardPriceReset, useStandardPriceRef] = useInputField(\n 'useStandardPriceInput',\n false,\n startTransition,\n shareableRef\n )\n\n const ratedMaps = useMemo(\n () =>\n rateMaps(\n preparedMaps,\n preparedCards,\n layoutInput,\n densityInput,\n bossInput,\n cardInput,\n cardBaselineInput,\n cardBaselineNumberInput,\n cardMinPriceInput,\n useStandardPriceInput,\n atlasVoidstones\n ),\n [\n layoutInput,\n densityInput,\n bossInput,\n cardInput,\n cardBaselineInput,\n cardBaselineNumberInput,\n cardMinPriceInput,\n useStandardPriceInput,\n atlasVoidstones\n ]\n )\n const currentSearch = useMemo(() => parseSearch(searchInput), [searchInput])\n\n const filteredMaps = useMemo(() => filterMaps(ratedMaps, currentSearch), [ratedMaps, currentSearch])\n\n const poeRegex = useMemo(() => {\n const re = '\"' + [...new Set(filteredMaps.map(m => m.shorthand))].join('|') + '\"'\n if (re.length > 50) {\n return 'Too long, be more specific'\n }\n return re\n }, [filteredMaps])\n\n const addToInput = useCallback(\n (v, neg, remove) => {\n let s = parseSearch(searchRef.current.value || '')\n\n if (remove) {\n s = s.filter(sv => sv.value !== v)\n } else {\n const sv = s.find(sv => sv.value === v)\n if (sv) {\n sv.neg = neg\n } else {\n s.push({ value: v, neg: neg })\n }\n }\n\n const val = buildSearch(s)\n searchRef.current.value = val\n setSearchInput(val)\n },\n [setSearchInput, searchRef]\n )\n\n let containerClass = 'container-fluid p-2'\n let searchClass = ''\n let inputSectionClass = ''\n let inputClass = ''\n let bigInputClass = ''\n let atlasClass = ''\n\n if (atlasFull) {\n containerClass = containerClass + ' col-lg-3 col-12 full-height'\n searchClass = 'p-1'\n inputClass = 'col-lg-12 col-md-6 col-12 p-1'\n bigInputClass = inputClass\n atlasClass = 'col-lg-9 col-12'\n } else {\n containerClass = containerClass + ' row g-0'\n searchClass = 'col-lg-4 col-12 p-1'\n inputSectionClass = 'col col-lg-8 col-12'\n inputClass = 'col-lg-3 col-md-6 col-12 p-1'\n bigInputClass = 'col-lg-12 col-md-6 col-12 p-1'\n }\n\n return (\n <>\n \n \n Data incorrect or missing? Open an issue\n \n \n \n
\n
\n
\n Search \n \n tags: {' '}\n \n
\n
\n
\n
\n
\n \n The weight of layout rating when calculating score for map (so end result is map layout * layout\n weight).\n \n This is not minimal layout rating filter , this will simply push maps with good layouts lower\n or higher in list.\n \n Layout weight \n \n
\n \n \n \n \n
\n
\n
\n
\n \n The weight of density rating when calculating score for map (so end result is map density * density\n weight).\n \n This is not minimal density rating filter , this will simply push maps with good density lower\n or higher in list.\n \n Density weight \n \n
\n \n \n \n \n
\n
\n
\n
\n \n The weight of boss rating when calculating score for map (so end result is map boss * boss weight).\n \n This is not minimal boss rating filter , this will simply push maps with good boss lower or\n higher in list.\n \n Boss weight \n \n
\n \n \n \n \n
\n
\n
\n
\n \n The weight of card rating when calculating score for map (so end result is map card rating * card\n weight).\n \n This is not minimal card weight filter , this will simply push maps with good cards lower or\n higher in list.\n \n Card weight \n \n
\n \n \n \n \n
\n
\n
\n
\n \n The baseline card drop you are expecting to see every map on average with number input next to it.\n Positive number indicates x cards dropped per map, negative number indicates card dropped every x\n maps.\n \n This is used for calculating how many drop pool items you get on average and that is used for{' '}\n calculating chance to get card per map .\n \n You should set this value to your observed drop rate of index card (for example Union in Cemetery)\n so the site can predict drop rates for your current farming strategy.\n \n Average card per map \n \n
\n b.weight - a.weight)\n .map(c => ({ name: c.name + ' (' + c.weight + ')', value: c.name }))}\n value={cardBaselineInput}\n placeholder={cardBaselineInput}\n onChange={e => setCardBaselineInput(e)}\n search=\"true\"\n />\n \n {\n cardBaselineReset()\n cardBaselineNumberReset()\n }}\n >\n \n \n
\n
\n
\n
\n \n Minimum price for the card to be considered as something that should be accounted for calculating\n map score and per map value.\n \n Try to not go under 6c as poe.ninja tends to overvalue the low cost cards by a lot\n even though when you click on listings the data say something else.\n \n Minimum card price \n \n
\n \n \n \n \n
\n
\n
\n
\n Source of price data, can be either League or Standard \n Card price source \n \n
\n \n League \n Standard \n \n \n \n \n
\n
\n
\n
\n \n Generates string that can be copy/pasted to Path of Exile search boxes that will search for the\n filtered maps. PoE search fields are limited to 50 characters so the string is not generated until\n it can fit this criteria.\n \n PoE regex \n \n
\n e.target.select()}\n />\n copyToClipboard(poeRegexRef)}>\n \n \n
\n
\n
\n
Shareable link \n
\n e.target.select()}\n />\n copyToClipboard(shareableRef)}>\n \n \n
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n Map name, colored based on natural tier with map tiers for each Voidstone next to it.\n \n Under it Score calculated by summing Layout, Density, Boss and Card ratings multiplied by their\n respective weights and recalculated to number betwen 0 and 100.\n \n tier 1-5 \n tier 6-10 \n tier 11-16 \n \n bad/unknown \n >=30 neutral \n >=50 good \n >=70 great \n \n Map\n \n \n \n \n \n How straightforward is the map to clear or how good it is for league mechanics.\n \n This data is opinionated, if you disagree with any rating please open issue on GitHub with\n explanation.\n \n unknown \n bad \n >=3 neutral \n >=5 good \n >=7 great \n \n Layout\n \n \n \n \n \n How many total base mobs does the map have. Do not accounts for extra sources of mobs like league\n mechanics and sextants.\n \n This data is based on actual mob counts in maps counted using rampage. Some newer maps and unique maps\n might be missing data as they still need to be collected.\n \n unknown \n bad \n >=3 neutral \n >=5 good \n >=7 great \n \n Density\n \n \n \n \n \n How annoying/dangerous is the boss to kill.\n \n This data is opinionated, if you disagree with any rating please open issue on GitHub with\n explanation.\n \n unknown \n hard/annoying \n >=3 neutral \n >=5 alright \n >=7 easy/fast \n \n Boss\n \n \n \n \n Maps adjacent to this map on atlas with score on left. \n Connected\n \n \n \n \n \n Cards that drop in the map sorted by drop rate and price . Cards under{' '}\n {cardMinPriceInput}c are filtered out from rating. Adjust Average card per map if the\n card drop rates are not matching with your observed results.\n \n not very good \n >=0.5 decent \n >=2 good \n >=5 great \n >=8 amazing \n \n Cards\n \n \n \n \n \n {filteredMaps.map(m => (\n \n ))}\n \n
\n \n >\n )\n}\n\nexport default App\n","import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport App from './App'\n\nconst root = ReactDOM.createRoot(document.getElementById('root'))\nroot.render( )\n"],"names":["aa","require","ca","p","a","b","c","arguments","length","encodeURIComponent","da","Set","ea","fa","ha","add","ia","window","document","createElement","ja","Object","prototype","hasOwnProperty","ka","la","ma","v","d","e","f","g","this","acceptsBooleans","attributeName","attributeNamespace","mustUseProperty","propertyName","type","sanitizeURL","removeEmptyString","z","split","forEach","toLowerCase","ra","sa","toUpperCase","ta","slice","pa","isNaN","qa","call","test","oa","removeAttribute","setAttribute","setAttributeNS","replace","xlinkHref","ua","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","va","Symbol","for","wa","ya","za","Aa","Ba","Ca","Da","Ea","Fa","Ga","Ha","Ia","Ja","iterator","Ka","La","A","assign","Ma","Error","stack","trim","match","Na","Oa","prepareStackTrace","defineProperty","set","Reflect","construct","l","h","k","displayName","includes","name","Pa","tag","render","Qa","$$typeof","_context","_payload","_init","Ra","Sa","Ta","nodeName","Va","_valueTracker","getOwnPropertyDescriptor","constructor","get","configurable","enumerable","getValue","setValue","stopTracking","Ua","Wa","checked","value","Xa","activeElement","body","Ya","defaultChecked","defaultValue","_wrapperState","initialChecked","Za","initialValue","controlled","ab","bb","cb","db","ownerDocument","eb","Array","isArray","fb","options","selected","defaultSelected","disabled","gb","dangerouslySetInnerHTML","children","hb","ib","jb","textContent","kb","lb","mb","nb","namespaceURI","innerHTML","valueOf","toString","firstChild","removeChild","appendChild","MSApp","execUnsafeLocalFunction","ob","lastChild","nodeType","nodeValue","pb","animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","qb","rb","sb","style","indexOf","setProperty","keys","charAt","substring","tb","menuitem","area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr","ub","vb","is","wb","xb","target","srcElement","correspondingUseElement","parentNode","yb","zb","Ab","Bb","Cb","stateNode","Db","Eb","push","Fb","Gb","Hb","Ib","Jb","Kb","Lb","Mb","addEventListener","removeEventListener","Nb","apply","m","onError","Ob","Pb","Qb","Rb","Sb","Tb","Vb","alternate","return","flags","Wb","memoizedState","dehydrated","Xb","Zb","child","sibling","current","Yb","$b","ac","unstable_scheduleCallback","bc","unstable_cancelCallback","cc","unstable_shouldYield","dc","unstable_requestPaint","B","unstable_now","ec","unstable_getCurrentPriorityLevel","fc","unstable_ImmediatePriority","gc","unstable_UserBlockingPriority","hc","unstable_NormalPriority","ic","unstable_LowPriority","jc","unstable_IdlePriority","kc","lc","oc","Math","clz32","pc","qc","log","LN2","rc","sc","tc","uc","pendingLanes","suspendedLanes","pingedLanes","entangledLanes","entanglements","vc","xc","yc","zc","Ac","eventTimes","Cc","C","Dc","Ec","Fc","Gc","Hc","Ic","Jc","Kc","Lc","Mc","Nc","Oc","Map","Pc","Qc","Rc","Sc","delete","pointerId","Tc","nativeEvent","blockedOn","domEventName","eventSystemFlags","targetContainers","Vc","Wc","priority","isDehydrated","containerInfo","Xc","Yc","dispatchEvent","shift","Zc","$c","ad","bd","cd","ReactCurrentBatchConfig","dd","ed","transition","fd","gd","hd","id","Uc","stopPropagation","jd","kd","ld","md","nd","od","keyCode","charCode","pd","qd","rd","_reactName","_targetInst","currentTarget","isDefaultPrevented","defaultPrevented","returnValue","isPropagationStopped","preventDefault","cancelBubble","persist","isPersistent","wd","xd","yd","sd","eventPhase","bubbles","cancelable","timeStamp","Date","now","isTrusted","td","ud","view","detail","vd","Ad","screenX","screenY","clientX","clientY","pageX","pageY","ctrlKey","shiftKey","altKey","metaKey","getModifierState","zd","button","buttons","relatedTarget","fromElement","toElement","movementX","movementY","Bd","Dd","dataTransfer","Fd","Hd","animationName","elapsedTime","pseudoElement","Id","clipboardData","Jd","Ld","data","Md","Esc","Spacebar","Left","Up","Right","Down","Del","Win","Menu","Apps","Scroll","MozPrintableKey","Nd","Od","Alt","Control","Meta","Shift","Pd","Qd","key","String","fromCharCode","code","location","repeat","locale","which","Rd","Td","width","height","pressure","tangentialPressure","tiltX","tiltY","twist","pointerType","isPrimary","Vd","touches","targetTouches","changedTouches","Xd","Yd","deltaX","wheelDeltaX","deltaY","wheelDeltaY","wheelDelta","deltaZ","deltaMode","Zd","$d","ae","be","documentMode","ce","de","ee","fe","ge","he","ie","le","color","date","datetime","email","month","number","password","range","search","tel","text","time","url","week","me","ne","oe","event","listeners","pe","qe","re","se","te","ue","ve","we","xe","ye","ze","oninput","Ae","detachEvent","Be","Ce","attachEvent","De","Ee","Fe","He","Ie","Je","Ke","node","offset","nextSibling","Le","contains","compareDocumentPosition","Me","HTMLIFrameElement","contentWindow","href","Ne","contentEditable","Oe","focusedElem","selectionRange","documentElement","start","end","selectionStart","selectionEnd","min","defaultView","getSelection","extend","rangeCount","anchorNode","anchorOffset","focusNode","focusOffset","createRange","setStart","removeAllRanges","addRange","setEnd","element","left","scrollLeft","top","scrollTop","focus","Pe","Qe","Re","Se","Te","Ue","Ve","We","animationend","animationiteration","animationstart","transitionend","Xe","Ye","Ze","animation","$e","af","bf","cf","df","ef","ff","gf","hf","lf","mf","concat","nf","Ub","instance","listener","D","of","has","pf","qf","rf","random","sf","bind","capture","passive","n","t","J","x","u","w","F","tf","uf","parentWindow","vf","wf","na","xa","$a","ba","je","char","ke","unshift","xf","yf","zf","Af","Bf","Cf","Df","Ef","__html","Ff","setTimeout","Gf","clearTimeout","Hf","Promise","Jf","queueMicrotask","resolve","then","catch","If","Kf","Lf","Mf","previousSibling","Nf","Of","Pf","Qf","Rf","Sf","Tf","Uf","E","G","Vf","H","Wf","Xf","Yf","contextTypes","__reactInternalMemoizedUnmaskedChildContext","__reactInternalMemoizedMaskedChildContext","Zf","childContextTypes","$f","ag","bg","getChildContext","cg","__reactInternalMemoizedMergedChildContext","dg","eg","fg","gg","hg","jg","kg","lg","mg","ng","og","pg","qg","rg","sg","tg","ug","vg","wg","xg","yg","I","zg","Ag","Bg","elementType","deletions","Cg","pendingProps","overflow","treeContext","retryLane","Dg","mode","Eg","Fg","Gg","memoizedProps","Hg","Ig","Jg","Kg","Lg","defaultProps","Mg","Ng","Og","Pg","Qg","Rg","_currentValue","Sg","childLanes","Tg","dependencies","firstContext","lanes","Ug","Vg","context","memoizedValue","next","Wg","Xg","Yg","interleaved","Zg","$g","ah","updateQueue","baseState","firstBaseUpdate","lastBaseUpdate","shared","pending","effects","bh","ch","eventTime","lane","payload","callback","dh","K","eh","fh","gh","q","r","y","hh","ih","jh","Component","refs","kh","nh","isMounted","_reactInternals","enqueueSetState","L","lh","mh","enqueueReplaceState","enqueueForceUpdate","oh","shouldComponentUpdate","isPureReactComponent","ph","contextType","state","updater","qh","componentWillReceiveProps","UNSAFE_componentWillReceiveProps","rh","props","getDerivedStateFromProps","getSnapshotBeforeUpdate","UNSAFE_componentWillMount","componentWillMount","componentDidMount","sh","ref","_owner","_stringRef","th","join","uh","vh","index","wh","xh","yh","implementation","zh","Ah","done","Bh","Ch","Dh","Eh","Fh","Gh","Hh","Ih","tagName","Jh","Kh","Lh","M","Mh","revealOrder","Nh","Oh","_workInProgressVersionPrimary","Ph","ReactCurrentDispatcher","Qh","Rh","N","O","P","Sh","Th","Uh","Vh","Q","Wh","Xh","Yh","Zh","$h","ai","bi","ci","baseQueue","queue","di","ei","fi","lastRenderedReducer","action","hasEagerState","eagerState","lastRenderedState","dispatch","gi","hi","ii","ji","ki","getSnapshot","li","mi","R","ni","lastEffect","stores","oi","pi","qi","ri","create","destroy","deps","si","ti","ui","vi","wi","xi","yi","zi","Ai","Bi","Ci","Di","Ei","Fi","Gi","Hi","Ii","Ji","readContext","useCallback","useContext","useEffect","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useReducer","useRef","useState","useDebugValue","useDeferredValue","useTransition","useMutableSource","useSyncExternalStore","useId","unstable_isNewReconciler","identifierPrefix","Ki","message","digest","Li","Mi","console","error","Ni","WeakMap","Oi","Pi","Qi","Ri","getDerivedStateFromError","componentDidCatch","Si","componentStack","Ti","pingCache","Ui","Vi","Wi","Xi","ReactCurrentOwner","Yi","Zi","$i","aj","bj","compare","cj","dj","ej","baseLanes","cachePool","transitions","fj","gj","hj","ij","jj","UNSAFE_componentWillUpdate","componentWillUpdate","componentDidUpdate","kj","lj","pendingContext","mj","Aj","Bj","Cj","Dj","nj","oj","pj","fallback","qj","rj","tj","dataset","dgst","uj","vj","_reactRetry","sj","subtreeFlags","wj","xj","isBackwards","rendering","renderingStartTime","last","tail","tailMode","yj","Ej","S","Fj","Gj","wasMultiple","multiple","suppressHydrationWarning","onClick","onclick","size","createElementNS","autoFocus","createTextNode","T","Hj","Ij","Jj","Kj","U","Lj","WeakSet","V","Mj","W","Nj","Oj","Qj","Rj","Sj","Tj","Uj","Vj","Wj","insertBefore","_reactRootContainer","Xj","X","Yj","Zj","ak","onCommitFiberUnmount","componentWillUnmount","bk","ck","dk","ek","fk","isHidden","gk","hk","display","ik","jk","kk","lk","__reactInternalSnapshotBeforeUpdate","src","Wk","mk","ceil","nk","ok","pk","Y","Z","qk","rk","sk","tk","uk","Infinity","vk","wk","xk","yk","zk","Ak","Bk","Ck","Dk","Ek","callbackNode","expirationTimes","expiredLanes","wc","callbackPriority","ig","Fk","Gk","Hk","Ik","Jk","Kk","Lk","Mk","Nk","Ok","Pk","finishedWork","finishedLanes","Qk","timeoutHandle","Rk","Sk","Tk","Uk","Vk","mutableReadLanes","Bc","Pj","onCommitFiberRoot","mc","onRecoverableError","Xk","onPostCommitFiberRoot","Yk","Zk","al","isReactComponent","pendingChildren","bl","mutableSourceEagerHydrationData","cl","cache","pendingSuspenseBoundaries","el","fl","gl","hl","il","jl","zj","$k","ll","reportError","ml","_internalRoot","nl","ol","pl","ql","sl","rl","unmount","unstable_scheduleHydration","splice","querySelectorAll","JSON","stringify","form","tl","usingClientEntryPoint","Events","ul","findFiberByHostInstance","bundleType","version","rendererPackageName","vl","rendererConfig","overrideHookState","overrideHookStateDeletePath","overrideHookStateRenamePath","overrideProps","overridePropsDeletePath","overridePropsRenamePath","setErrorHandler","setSuspenseHandler","scheduleUpdate","currentDispatcherRef","findHostInstanceByFiber","findHostInstancesForRefresh","scheduleRefresh","scheduleRoot","setRefreshHandler","getCurrentFiber","reconcilerVersion","__REACT_DEVTOOLS_GLOBAL_HOOK__","wl","isDisabled","supportsFiber","inject","exports","createPortal","dl","createRoot","unstable_strictMode","findDOMNode","flushSync","hydrate","hydrateRoot","hydratedSources","_getVersion","_source","unmountComponentAtNode","unstable_batchedUpdates","unstable_renderSubtreeIntoContainer","checkDCE","err","module","__self","__source","Fragment","jsx","jsxs","setState","forceUpdate","escape","_status","_result","default","Children","map","count","toArray","only","Profiler","PureComponent","StrictMode","Suspense","cloneElement","createContext","_currentValue2","_threadCount","Provider","Consumer","_defaultValue","_globalName","createFactory","createRef","forwardRef","isValidElement","lazy","memo","startTransition","unstable_act","pop","sortIndex","performance","setImmediate","startTime","expirationTime","priorityLevel","navigator","scheduling","isInputPending","MessageChannel","port2","port1","onmessage","postMessage","unstable_Profiling","unstable_continueExecution","unstable_forceFrameRate","floor","unstable_getFirstCallbackNode","unstable_next","unstable_pauseExecution","unstable_runWithPriority","delay","unstable_wrapCallback","inst","useSyncExternalStoreWithSelector","hasValue","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","_arrayLikeToArray","arr","len","i","arr2","_unsupportedIterableToArray","o","minLen","from","_toConsumableArray","iter","TypeError","_slicedToArray","_i","_s","_e","_x","_r","_arr","_n","_d","_typeof","obj","_toPropertyKey","arg","hint","prim","toPrimitive","res","Number","_defineProperty","writable","ownKeys","object","enumerableOnly","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptors","defineProperties","_createForOfIteratorHelper","allowArrayLike","it","s","normalCompletion","didErr","step","_e2","excluded","sourceKeys","sourceSymbolKeys","propertyIsEnumerable","$f63eea9d7c5f466f$export$2e2bcd8739ae039","v1","v2","$f7a118348608ef0e$export$2e2bcd8739ae039","find","$ab17a5af9c7227da$export$2e2bcd8739ae039","$fcc1d8b4a4fe77ec$export$2e2bcd8739ae039","newOption","oldOption","nextOption","newOptionIndex","findIndex","$29242e7c542b89e5$export$2e2bcd8739ae039","option","placeholder","isMultiple","Boolean","$8f7d71ac34985a60$export$2e2bcd8739ae039","$559302edb229d5e8$export$2e2bcd8739ae039","nextOptions","group","items","$e2eb089248fa8007$export$2e2bcd8739ae039","query","searchLength","textLength","mainLoop","j","charCodeAt","$e2eb089248fa8007$var$search","$5b742793c6607960$export$2e2bcd8739ae039","middleware","reduce","item","_objectSpread","$ab7b6b8f43adf325$export$2e2bcd8739ae039","flat","$21775510bb0d6713$export$2e2bcd8739ae039","defaultOptions","getOptions","debounceTime","_ref2","$6XpKT$useState","setOptions","_ref4","fetching","setFetching","$6XpKT$useEffect","timeout","optionsReq","newOptions","finally","$e86f7a275d5b9934$export$2e2bcd8739ae039","dir","max","newHighlighted","$8c63ada902e0d18e$export$2e2bcd8739ae039","onSelect","_ref6","highlighted","setHighlighted","onKeyDown","onKeyUp","blur","$0d0f732c1d5a71da$var$nullCb","$0d0f732c1d5a71da$export$2e2bcd8739ae039","_ref7","_ref7$onChange","onChange","_ref7$onFocus","onFocus","_ref7$onBlur","onBlur","_ref7$closeOnSelect","closeOnSelect","filterOptions","_ref7$useFuzzySearch","useFuzzySearch","debounce","$6XpKT$useRef","_ref9","setOption","_ref11","setSearch","_ref13","setFocus","_ref15","decodeURIComponent","_ref17","keyHandlers","snapshot","displayValue","valueProps","tabIndex","readOnly","onMouseDown","_ref18","optionProps","$461fda4bde208857$var$isString","str","$461fda4bde208857$var$getClassName","className","$461fda4bde208857$export$2e2bcd8739ae039","classNames","entries","_ref19","_ref20","cls","_ref21","$9b55b4f5631730e8$var$Option","_ref23","renderOption","$6XpKT$jsxs","role","$6XpKT$jsx","$9b55b4f5631730e8$export$2e2bcd8739ae039","$6XpKT$memo","$1b5fcad01c07e709$var$Options","renderGroupHeader","selectedOption","$1b5fcad01c07e709$export$2e2bcd8739ae039","$00d3317695af813e$var$SelectSearch","$6XpKT$forwardRef","_ref24","autoComplete","renderValue","fuzzySearch","emptyMessage","hookProps","_objectWithoutProperties","_excluded","selectRef","_ref26","controlledValue","setControlledValue","_ref28","snapValue","val","querySelector","rect","getBoundingClientRect","selectedRect","offsetTop","container","printOptions","$cf838c15c8b009ba$export$2e2bcd8739ae039","rescale","minValue","maxValue","scale","round","deduplicate","seen","calculateScore","_step","nonzerodataset","_iterator","entry","score","filterOneOrMore","some","_step2","posMatched","negMatched","_iterator2","neg","ratingColor","rating","tierColor","tiers","unique","tier","scrollToElement","getElementById","scrollIntoView","behavior","block","copyToClipboard","select","execCommand","parseValue","parseFloat","githubRepo","issueTemplate","possibleVoidstones","preparedGlobals","globals","preparedCards","cards","card","art","pushTag","info","destination","out","replaceAll","preparedMaps","maps","mapTags","layout","boss","_loop","drop","all_areas","areas","ids","monsters","mapWeight","weight","bossWeight","_cards","poolWeight","names","level","image","connected","tags","sort","localeCompare","icon","wiki","reward","preparedTags","preparedTagsMap","flatMap","_ref","loading","_jsx","tmp","useSyncExternalStoreExports","useStore","api","selector","getState","equalityFn","subscribe","getServerState","createStoreImpl","createState","partial","nextState","previousState","warn","clear","createStore","shallow","objA","objB","_step$value","keysA","noop","_","Dispatch","on","typename","types","copy","that","args","none","empty","arrayAll","matches","childMatcher","childFirst","firstElementChild","update","EnterNode","parent","datum","_next","_parent","__data__","bindIndex","enter","exit","groupLength","dataLength","bindKey","keyValue","nodeByKeyValue","keyValues","arraylike","ascending","NaN","xhtml","svg","xlink","xml","xmlns","prefix","namespaces","space","local","attrRemove","attrRemoveNS","fullname","removeAttributeNS","attrConstant","attrConstantNS","attrFunction","attrFunctionNS","styleRemove","removeProperty","styleConstant","styleFunction","styleValue","getPropertyValue","getComputedStyle","propertyRemove","propertyConstant","propertyFunction","classArray","string","classList","ClassList","_node","_names","getAttribute","classedAdd","list","classedRemove","remove","classedTrue","classedFalse","classedFunction","textRemove","textConstant","textFunction","htmlRemove","htmlConstant","htmlFunction","raise","lower","creatorInherit","uri","creatorFixed","namespace","constantNull","selection_cloneShallow","clone","cloneNode","selection_cloneDeep","onRemove","__on","onAdd","contextListener","params","CustomEvent","createEvent","initEvent","dispatchConstant","dispatchFunction","_regeneratorRuntime","Op","hasOwn","desc","$Symbol","iteratorSymbol","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","Context","makeInvokeMethod","tryCatch","fn","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","method","_invoke","AsyncIterator","PromiseImpl","invoke","reject","record","result","__await","unwrapped","previousPromise","callInvokeWithMethodAndArg","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","methodName","resultName","nextLoc","pushTryEntry","locs","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iterable","iteratorMethod","isGeneratorFunction","genFun","ctor","mark","setPrototypeOf","__proto__","awrap","async","reverse","skipTempReset","prev","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","_callee","groups","_groups","_marked","root","Selection","parents","_parents","selection","subgroups","subnode","subgroup","selectAll","selectorAll","selectChild","childFind","selectChildren","childrenFilter","matcher","enterGroup","updateGroup","previous","i0","i1","_enter","_exit","sparse","onenter","onupdate","onexit","append","merge","groups0","groups1","m0","m1","merges","group0","group1","compareNode","sortgroups","sortgroup","nodes","each","attr","getAttributeNS","property","classed","html","creator","insert","before","deep","typenames","parseTypenames","selection_iterator","sourceEvent","ownerSVGElement","createSVGPoint","point","matrixTransform","getScreenCTM","inverse","clientLeft","clientTop","nonpassive","nonpassivecapture","nopropagation","stopImmediatePropagation","noevent","__noselect","MozUserSelect","yesdrag","noclick","DragEvent","subject","identifier","active","dx","dy","defaultFilter","defaultContainer","defaultSubject","defaultTouchable","maxTouchPoints","cosh","exp","taskHead","taskTail","zoomRho","rho","rho2","rho4","p0","p1","ux0","uy0","w0","ux1","uy1","w1","d2","d1","sqrt","b0","b1","r0","r1","coshr0","sinh","duration","SQRT2","_1","_2","frame","interval","pokeDelay","clockLast","clockNow","clockSkew","clock","setFrame","requestAnimationFrame","clearNow","Timer","_call","_time","timer","restart","wake","timerFlush","t0","t2","t1","sleep","nap","poke","clearInterval","setInterval","elapsed","emptyOn","emptyTween","CREATED","SCHEDULED","STARTING","STARTED","RUNNING","ENDING","ENDED","timing","schedules","__transition","tween","schedule","tick","ease","init","svgNode","degrees","PI","identity","translateX","translateY","rotate","skewX","scaleX","scaleY","atan2","atan","interpolateTransform","parse","pxComma","pxParen","degParen","translate","interpolateTransformCss","DOMMatrix","WebKitCSSMatrix","isIdentity","decompose","interpolateTransformSvg","transform","baseVal","consolidate","matrix","tweenRemove","tween0","tween1","tweenFunction","tweenValue","_id","factory","definition","Color","darker","brighter","reI","reN","reP","reHex","reRgbInteger","RegExp","reRgbPercent","reRgbaInteger","reRgbaPercent","reHslPercent","reHslaPercent","named","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","color_formatHex","rgb","formatHex","color_formatRgb","formatRgb","format","exec","parseInt","rgbn","Rgb","rgba","hsla","rgb_formatHex","hex","rgb_formatRgb","clampa","clampi","Hsl","hslConvert","clamph","clampt","hsl2rgb","m2","basis","v0","v3","t3","channels","displayable","formatHex8","formatHsl","pow","clamp","linear","gamma","nogamma","exponential","constant","rgbGamma","colorRgb","rgbSpline","spline","colors","reA","reB","am","bm","bs","lastIndex","one","zero","interpolateNumber","interpolateRgb","interpolateString","interpolate","value1","string00","interpolate0","string1","string0","string10","attrTweenNS","attrInterpolateNS","_value","attrTween","attrInterpolate","delayFunction","delayConstant","durationFunction","durationConstant","Transition","_name","newId","selection_prototype","inherit","id0","id1","on0","on1","sit","every","onFunction","styleTween","styleNull","listener0","styleMaybeRemove","styleInterpolate","textTween","textInterpolate","removeFunction","easeConstant","easeVarying","cancel","interrupt","defaultTiming","ZoomEvent","Transform","applyX","applyY","invert","invertX","invertY","rescaleX","domain","rescaleY","defaultExtent","SVGElement","hasAttribute","viewBox","clientWidth","clientHeight","defaultTransform","__zoom","defaultWheelDelta","defaultConstrain","extent","translateExtent","dx0","dx1","dy0","dy1","StoreContext","Provider$1","errorMessages","error001","error002","error003","error004","error005","error006","error007","error009","error008","sourceHandle","edge","targetHandle","error010","error011","edgeType","zustandErrorMessage","store","useStore$1","useStoreApi","selector$g","userSelectionActive","Panel","position","rest","pointerEvents","positionClasses","Attribution","proOptions","_ref2$position","hideAttribution","rel","EdgeText$1","_ref3","label","_ref3$labelStyle","labelStyle","_ref3$labelShowBg","labelShowBg","_ref3$labelBgStyle","labelBgStyle","_ref3$labelBgPadding","labelBgPadding","_ref3$labelBgBorderRa","labelBgBorderRadius","_excluded2","edgeRef","_useState2","edgeTextBbox","setEdgeTextBbox","edgeTextClasses","textBbox","getBBox","visibility","rx","ry","getDimensions","offsetWidth","offsetHeight","clampPosition","calcAutoPanVelocity","abs","calcAutoPan","pos","bounds","getHostForElement","_element$getRootNode","_window","getRootNode","getBoundsOfBoxes","box1","box2","x2","y2","rectToBox","boxToRect","_ref5","nodeToRect","positionAbsolute","getOverlappingArea","rectA","rectB","xOverlap","yOverlap","isRectObject","isNumeric","isFinite","internalsSymbol","elementSelectionKeys","devWarn","process","isInputDOMNode","_kbEvent$composedPath","_kbEvent$composedPath2","kbEvent","isReactKeyboardEvent","composedPath","closest","isMouseEvent","getEventPosition","_event$touches","_event$touches2","_bounds$left","_bounds$top","isMouseTriggered","evtX","evtY","BaseEdge","path","labelX","labelY","markerEnd","markerStart","_ref6$interactionWidt","interactionWidth","fill","ConnectionMode","PanOnScrollMode","SelectionMode","ConnectionLineType","MarkerType","Position","getMouseHandler$1","handler","edges","getEdgeCenter","sourceX","sourceY","targetX","targetY","xOffset","centerX","yOffset","getBezierEdgeCenter","_ref8","sourceControlX","sourceControlY","targetControlX","centerY","targetControlY","getControl","x1","y1","getSimpleBezierPath","_ref10","_ref10$sourcePosition","sourcePosition","Bottom","_ref10$targetPosition","targetPosition","Top","_getControl2","_getControl4","_getBezierEdgeCenter2","offsetX","offsetY","SimpleBezierEdge","_ref11$sourcePosition","_ref11$targetPosition","_getSimpleBezierPath2","handleDirections","_handleDirections","getDirection","_ref12","_ref12$sourcePosition","distance","getSmoothStepPath","_ref14","_ref14$sourcePosition","_ref14$targetPosition","_ref14$borderRadius","borderRadius","_ref14$offset","_getPoints","_ref13$sourcePosition","_ref13$targetPosition","center","sourceDir","targetDir","sourceGapped","targetGapped","dirAccessor","currDir","points","_getEdgeCenter2","defaultCenterX","defaultCenterY","defaultOffsetX","defaultOffsetY","verticalSplit","horizontalSplit","sourceTarget","targetSource","dirAccessorOpposite","isSameDir","sourceGtTargetOppo","sourceLtTargetOppo","getPoints","_getPoints2","segment","bendSize","xDir","yDir","getBend","SmoothStepEdge","_ref15$sourcePosition","_ref15$targetPosition","pathOptions","_getSmoothStepPath2","StepEdge","_props$pathOptions2","_props$pathOptions","StraightEdge","_getStraightPath","_ref16","_getEdgeCenter4","getStraightPath","_getStraightPath2","calculateControlOffset","curvature","getControlWithCurvature","getBezierPath","_ref19$sourcePosition","_ref19$targetPosition","_ref19$curvature","_getControlWithCurvat2","_getControlWithCurvat4","_getBezierEdgeCenter4","BezierEdge","_ref20$sourcePosition","_ref20$targetPosition","_getBezierPath2","NodeIdContext","getEdgeId","getMarkerId","marker","rfId","idPrefix","pointToRendererPoint","_ref22","snapToGrid","_ref25","tx","ty","tScale","snapX","snapY","rendererPointToPoint","_ref27","_ref29","getNodePositionWithOrigin","_node$width","_node$height","nodeOrigin","getRectOfNodes","box","currBox","_getNodePositionWithO","getNodesInside","nodeInternals","_ref31","partially","excludeNonSelectableNodes","paneRect","visibleNodes","_node$selectable","selectable","_node$hidden","hidden","nodeRect","overlappingArea","dragging","getConnectedEdges","nodeIds","getTransformForBounds","minZoom","maxZoom","padding","xZoom","yZoom","clampedZoom","getD3Transition","getHandles","handleBounds","currentHandle","_node$positionAbsolut","_node$positionAbsolut2","_node$positionAbsolut3","_node$positionAbsolut4","nodeId","nullConnection","isValidHandle","connectionMode","fromNodeId","fromHandleId","fromType","isValidConnection","doc","isTarget","handleDomNode","_getEventPosition","handleBelow","elementFromPoint","handleToCheck","isValid","connection","endHandle","handleType","getHandleType","handleNodeId","handleId","connectable","connectableEnd","Strict","edgeUpdaterType","resetRecentHandle","getConnectionStatus","isInsideConnectionRadius","isHandleValid","connectionStatus","handlePointerDown","_ref33","closestHandle","onConnect","onEdgeUpdateEnd","_getState","domNode","autoPanOnConnect","connectionRadius","onConnectStart","panBy","getNodes","cancelConnection","autoPanId","_getEventPosition2","clickedHandle","containerBounds","prevActiveHandle","connectionPosition","autoPanStarted","handleLookup","_ref32","sourceHandles","targetHandles","getHandleLookup","autoPan","_calcAutoPan2","xMovement","yMovement","connectionNodeId","connectionHandleId","connectionHandleType","connectionStartHandle","connectionEndHandle","onPointerMove","onPointerUp","handles","closestHandles","minDistance","getClosestHandle","toggle","_getState$onConnectEn","_getState3","onConnectEnd","cancelAnimationFrame","alwaysValid","selector$f","connectOnClick","noPanClassName","Handle","_ref34","_store$getState$onErr","_store$getState","_ref34$type","_ref34$position","_ref34$isConnectable","isConnectable","_ref34$isConnectableS","isConnectableStart","_ref34$isConnectableE","isConnectableEnd","onTouchStart","_excluded4","_useStore","_useStore2","startHandle","clickHandle","connectionClickStartHandle","connecting","clickConnecting","connectingSelector","onConnectExtended","_store$getState2","defaultEdgeOptions","onConnectAction","hasDefaultEdges","edgeParams","_store$getState3","setEdges","connectionExists","addEdge","onPointerDown","connectablestart","connectableend","connectionindicator","_store$getState4","onClickConnectStart","onClickConnectEnd","isValidConnectionStore","isValidConnectionHandler","_isValidHandle","Handle$1","DefaultNode","_ref35","_ref35$targetPosition","_ref35$sourcePosition","DefaultNode$1","InputNode","_ref36","_ref36$sourcePosition","InputNode$1","OutputNode","_ref37","_ref37$targetPosition","OutputNode$1","GroupNode","selector$e","selectedNodes","selectedEdges","selectId","areEqual","SelectionListener","_ref38","onSelectionChange","_useStore3","_store$getState$onSel","_store$getState5","changeSelector","Wrapper$1","_ref39","storeHasSelectionChange","selector$d","setNodes","setDefaultNodesAndEdges","setMinZoom","setMaxZoom","setTranslateExtent","setNodeExtent","useStoreUpdater","setStoreState","useDirectStoreUpdater","StoreUpdater","_ref40","defaultNodes","defaultEdges","nodesDraggable","nodesConnectable","nodesFocusable","edgesFocusable","edgesUpdatable","elevateNodesOnSelect","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","snapGrid","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","autoPanOnNodeDrag","_useStore4","edgesWithDefaults","ariaLiveStyle","margin","border","clip","clipPath","ARIA_NODE_DESC_KEY","ARIA_EDGE_DESC_KEY","ARIA_LIVE_MESSAGE","selector$c","ariaLiveMessage","AriaLiveMessage","_ref41","A11yDescriptions","_ref42","disableKeyboardA11y","shiftX","shiftY","EdgeUpdaterClassName","EdgeAnchor","_ref43","_ref43$radius","radius","onMouseEnter","onMouseOut","cx","cy","stroke","alwaysValidConnection","wrapEdge","EdgeComponent","EdgeWrapper","_ref44","onEdgeDoubleClick","animated","sourceHandleId","targetHandleId","onContextMenu","onMouseMove","onMouseLeave","edgeUpdaterRadius","onEdgeUpdate","onEdgeUpdateStart","ariaLabel","isFocusable","isUpdatable","_useState4","updateHover","setUpdateHover","_useState6","updating","setUpdating","markerStartUrl","markerEndUrl","onEdgeDoubleClickHandler","onEdgeContextMenu","onEdgeMouseEnter","onEdgeMouseMove","onEdgeMouseLeave","handleEdgeUpdater","isSourceHandle","_store$getState7","evt","onEdgeUpdaterMouseEnter","onEdgeUpdaterMouseOut","inactive","_store$getState6","addSelectedEdges","nodesSelectionActive","onDoubleClick","_edgeRef$current","_store$getState8","unselectNodesAndEdges","createEdgeTypes","edgeTypes","standardTypes","straight","bezier","smoothstep","simplebezier","specialTypes","getHandlePosition","getHandle","getNodeData","_node$internalsSymbol","_node$positionAbsolut5","_node$positionAbsolut6","_node$positionAbsolut7","_node$positionAbsolut8","isParentSelected","hasSelector","nodeRef","_current","parentElement","getDragItems","mousePos","draggable","_n$positionAbsolute$x","_n$positionAbsolute","_n$positionAbsolute$y","_n$positionAbsolute2","delta","calcNextPosition","nextPosition","currentExtent","_getNodePositionWithO3","parentX","parentY","_getNodePositionWithO4","parentPosition","getEventHandlerParams","_ref46","dragItems","extentedDragItems","getHandleBounds","nodeElement","handlesArray","nodeBounds","nodeOffset","getMouseHandler","handleNodeClick","_ref47","_ref47$unselect","unselect","_store$getState9","addSelectedNodes","multiSelectionActive","_nodeRef$current","wrapSelectionDragFunc","selectionFunc","useDrag","_ref49","_ref49$disabled","noDragClassName","handleSelector","isSelectable","selectNodesOnDrag","_useState8","setDragging","lastPos","mousePosition","dragEvent","getPointerPosition","_ref48","_store$getState10","pointerPos","xSnapped","ySnapped","useGetPointerPosition","updateNodes","_ref50","_store$getState11","updateNodePositions","hasChange","updatedPos","onDrag","_getEventHandlerParam2","currentNode","_calcAutoPan4","_lastPos$current$x","_lastPos$current$y","_store$getState12","dragHandler","mousedownx","mousedowny","mousemoving","touchending","touchable","gestures","clickDistance2","drag","mousedowned","touchstarted","touchmoved","touchended","gesture","beforestart","mousemoved","mouseupped","nodrag","mouse","touch","pointer","clickDistance","_nodeInternals$get","_store$getState13","onStart","_getEventHandlerParam4","_store$getState15","onStop","_getEventHandlerParam6","useUpdateNodePositions","_store$getState16","xVelo","yVelo","factor","isShiftPressed","positionDiffX","positionDiffY","_calcNextPosition","arrowKeyDiffs","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","wrapNode","NodeComponent","NodeWrapper","_ref51","xPos","yPos","xPosOrigin","yPosOrigin","isDraggable","resizeObserver","dragHandle","isParent","initialized","prevSourcePosition","prevTargetPosition","prevType","hasPointerEvents","updatePositions","onMouseEnterHandler","onMouseMoveHandler","onMouseLeaveHandler","onContextMenuHandler","onDoubleClickHandler","currNode","observe","unobserve","typeChanged","sourcePosChanged","targetPosChanged","updateNodeDimensions","createNodeTypes","nodeTypes","output","useKeyPress","_useState10","keyPressed","setKeyPressed","modifierPressed","pressedKeys","_useMemo","keysFlat","_useMemo2","keyCodes","keysToWatch","_options$target","_options$target2","downHandler","keyOrCode","useKeyOrCode","isMatchingKey","upHandler","resetHandler","_options$target3","_options$target4","isUp","eventCode","calculateXYZPosition","_result$x","_result$y","_parentNode$internals","_parentNode$internals2","_result$z","_parentNode$internals3","_parentNode$internals4","_result$z2","parentNodePosition","updateAbsoluteNodePositions","parentNodes","_node$internalsSymbol2","_node$internalsSymbol3","_calculateXYZPosition","createNodeInternals","nextNodeInternals","selectedNodeZ","_currInternals$intern","currInternals","internals","_get","d3Zoom","d3Selection","fitViewOnInitDone","fitViewOnInit","isInitialFitView","initial","_options$nodes","isVisible","includeHiddenNodes","optionNode","nodesInitialized","_options$minZoom","_options$maxZoom","_options$padding","_getTransformForBound2","nextTransform","zoomIdentity","handleControlledNodeSelectionChange","nodeChanges","change","_objectSpread2","handleControlledEdgeSelectionChange","edgeChanges","updateNodesAndEdgesSelections","_ref54","changedNodes","changedEdges","_get2","hasDefaultNodes","initialViewportHelper","zoomIn","zoomOut","zoomTo","getZoom","setViewport","getViewport","setCenter","fitBounds","project","viewportInitialized","selector$b","useViewportHelper","_useStore5","viewportHelperFunctions","scaleBy","zoomLevel","scaleTo","_transform$x","_transform$y","_transform$zoom","_store$getState$trans","_store$getState$trans2","_store$getState17","nextZoom","_options$padding2","_store$getState18","_getTransformForBound4","_store$getState19","useReactFlow","viewportHelper","getNode","getEdges","_store$getState20$edg","getEdge","_store$getState21$edg","_store$getState22","nextNodes","changes","_store$getState23","_store$getState23$edg","nextEdges","addNodes","_store$getState24","currentNodes","addEdges","_store$getState25","_store$getState25$edg","toObject","_store$getState26","_store$getState26$edg","_transform","viewport","deleteElements","_ref55","nodesDeleted","edgesDeleted","_store$getState27","edgeIds","nodesToRemove","parentHit","deletable","deletableEdges","initialHitEdges","connectedEdges","edgesToRemove","edgeIdsToRemove","getNodeRect","nodeOrRect","isRect","getIntersectingNodes","_getNodeRect2","currNodeRect","isNodeIntersecting","containerStyle","eventToFlowTransform","eventViewport","isWrappedWithClass","isRightClickPan","panOnDrag","usedButton","selector$a","d3ZoomHandler","ZoomPane","_ref57","onMove","onMoveStart","onMoveEnd","onPaneContextMenu","_ref57$zoomOnScroll","zoomOnScroll","_ref57$zoomOnPinch","zoomOnPinch","_ref57$panOnScroll","panOnScroll","_ref57$panOnScrollSpe","panOnScrollSpeed","_ref57$panOnScrollMod","panOnScrollMode","Free","_ref57$zoomOnDoubleCl","zoomOnDoubleClick","_ref57$panOnDrag","defaultViewport","zoomActivationKeyCode","_ref57$preventScrolli","preventScrolling","noWheelClassName","timerId","isZoomingOrPanning","zoomedWithRightMouseButton","zoomPane","prevTransform","_useStore6","zoomActivationKeyPressed","mouseButton","rendererNode","updateDimensions","_store$getState$onErr2","_store$getState29","ResizeObserver","useResizeHandler","bbox","d3ZoomInstance","touchstarting","touchfirst","constrain","scaleExtent","interpolateZoom","touchDelay","wheelDelay","tapDistance","wheeled","dblclicked","centroid","clean","__zooming","Gesture","taps","_len","_key","wheel","_len2","_key2","moved","x0","y0","dragEnable","dragDisable","_len3","_key3","k1","_len4","_key4","started","touch0","touch1","_len5","_key5","l0","l1","dp","_len6","_key6","hypot","collection","translateBy","translateTo","emit","updatedTransform","constrainedTransform","currentZoom","pinchDelta","deltaNormalize","Vertical","Horizontal","_event$sourceEvent","onViewportChangeStart","paneDragging","flowTransform","_mouseButton$current","onViewportChange","_mouseButton$current2","prevViewport","onViewportChangeEnd","zoomScroll","pinchZoom","buttonAllowed","selector$9","userSelectionRect","UserSelection","_useStore7","handleParentExpand","updateItem","extendWidth","extendHeight","_parent$style$width","_parent$style$height","xDiff","yDiff","applyChanges","elements","initElements","currentChanges","currentChange","expandParent","dimensions","updateStyle","resizing","applyNodeChanges","createSelectionChange","getSelectionChanges","selectedIds","willBeSelected","wrapHandler","containerRef","selector$8","Pane","_ref58","isSelecting","_ref58$selectionMode","selectionMode","Full","onSelectionStart","onSelectionEnd","onPaneClick","onPaneScroll","onPaneMouseEnter","onPaneMouseMove","onPaneMouseLeave","prevSelectedNodesCount","prevSelectedEdgesCount","_useStore8","resetUserSelection","resetSelectedElements","onWheel","hasActiveSelection","_store$getState33","_getEventPosition3","startX","startY","_userSelectionRect$st","_userSelectionRect$st2","_store$getState34","nextUserSelectRect","Partial","selectedEdgeIds","selectedNodeIds","onMouseUp","selector$7","transformString","NodesSelection$1","_ref59","onSelectionContextMenu","_useStore9","_nodeRef$current2","preventScroll","selector$6","FlowRenderer","_ref60","deleteKeyCode","selectionKeyCode","selectionOnDrag","multiSelectionKeyCode","panActivationKeyCode","_panOnDrag","selectionKeyPressed","_ref56","deleteKeyPressed","multiSelectionKeyPressed","_store$getState28","useGlobalKeyHandler","FlowRenderer$1","selector$5","NodeRenderer","onlyRenderVisible","_useStore10","onlyRenderVisibleElements","resizeObserverRef","observer","updates","_resizeObserverRef$cu","disconnect","_clampedPosition$x","_clampedPosition$y","_node$width2","_node$height2","_node$internalsSymbol4","_node$internalsSymbol5","_node$internalsSymbol6","focusable","clampedPosition","posX","posY","posOrigin","_ref53","origin","getPositionWithOrigin","onNodeClick","onNodeMouseEnter","onNodeMouseMove","onNodeMouseLeave","onNodeContextMenu","onNodeDoubleClick","NodeRenderer$1","defaultEdgeTree","isMaxLevel","useVisibleEdges","elevateEdgesOnSelect","sourceNode","targetNode","_ref45","sourcePos","targetPos","sourceWidth","sourceHeight","targetWidth","targetHeight","edgeBox","isEdgeVisible","maxLevel","levelLookup","tree","_nodeInternals$get2","_nodeInternals$get2$i","_nodeInternals$get3","_nodeInternals$get3$i","hasZIndex","edgeTree","_ref61","_ref62","groupEdgesByZLevel","MarkerSymbols","_MarkerSymbols","Arrow","_ref63","_ref63$color","_ref63$strokeWidth","strokeLinecap","strokeLinejoin","ArrowClosed","_ref64","_ref64$color","_ref64$strokeWidth","Marker","_ref65","_ref65$width","_ref65$height","_ref65$markerUnits","markerUnits","_ref65$orient","orient","_store$getState$onErr3","_store$getState36","useMarkerSymbol","markerWidth","markerHeight","refX","refY","MarkerDefinitions","_ref67","defaultColor","markers","_ref66","markerId","markerSelector","MarkerDefinitions$1","selector$4","EdgeRenderer","_ref68","defaultMarkerColor","onEdgeClick","_useStore11","_ref69","_targetHandleBounds$t","_targetHandleBounds$s","_getNodeData2","sourceNodeRect","sourceHandleBounds","sourceIsValid","_getNodeData4","targetNodeRect","targetHandleBounds","targetIsValid","targetNodeHandles","updatable","_getEdgePositions","sourceHandlePos","targetHandlePos","getEdgePositions","EdgeRenderer$1","selector$3","Viewport","_ref70","oppositePosition","_oppositePosition","ConnectionLine","_ref71","_fromNode$internalsSy","_fromNode$width","_fromNode$height","_fromNode$positionAbs","_fromNode$positionAbs2","_fromNode$positionAbs3","_fromNode$positionAbs4","_ref71$type","Bezier","CustomComponent","_useStore12","fromNode","toX","toY","fromHandleBounds","Loose","fromHandle","fromHandleX","fromHandleY","fromX","fromY","fromPosition","toPosition","connectionLineType","connectionLineStyle","dAttr","pathParams","Step","SmoothStep","SimpleBezier","selector$2","ConnectionLineWrapper","_ref72","component","_useStore13","GraphView","_ref73","onInit","connectionLineComponent","connectionLineContainerStyle","rfInstance","isInitialized","useOnInitHandler","GraphView$1","infiniteExtent","NEGATIVE_INFINITY","POSITIVE_INFINITY","initialState","fitViewOnInitOptions","ReactFlowProvider","_ref75","storeRef","_get3","_get4$defaultEdgeOpti","_get5","viewportNode","DOMMatrixReadOnly","m22","nextFitViewOnInitDone","nodeDragItems","positionChanged","triggerNodeChanges","_get7","_get8","_get9","edgeId","_ref74","_get10","storeEdges","edgesToUnselect","_get11","_get12","_get$d3Zoom","_get13","_get15","Wrapper","_ref76","useNodeOrEdgeTypes","nodeOrEdgeTypes","createTypes","defaultNodeTypes","defaultEdgeTypes","initNodeOrigin","initSnapGrid","initDefaultViewport","wrapperStyle","ReactFlow","_ref77","_ref77$nodeTypes","_ref77$edgeTypes","_ref77$connectionMode","_ref77$connectionLine","_ref77$deleteKeyCode","_ref77$selectionKeyCo","_ref77$selectionOnDra","_ref77$selectionMode","_ref77$panActivationK","_ref77$multiSelection","_ref77$zoomActivation","_ref77$snapToGrid","_ref77$snapGrid","_ref77$onlyRenderVisi","_ref77$selectNodesOnD","_ref77$nodeOrigin","_ref77$defaultViewpor","_ref77$minZoom","_ref77$maxZoom","_ref77$translateExten","_ref77$preventScrolli","_ref77$defaultMarkerC","_ref77$zoomOnScroll","_ref77$zoomOnPinch","_ref77$panOnScroll","_ref77$panOnScrollSpe","_ref77$panOnScrollMod","_ref77$zoomOnDoubleCl","_ref77$panOnDrag","_ref77$edgeUpdaterRad","_ref77$noDragClassNam","_ref77$noWheelClassNa","_ref77$noPanClassName","_ref77$fitView","_ref77$connectOnClick","attributionPosition","_ref77$elevateNodesOn","_ref77$elevateEdgesOn","_ref77$disableKeyboar","_ref77$autoPanOnConne","_ref77$autoPanOnNodeD","_ref77$connectionRadi","_excluded5","nodeTypesWrapped","edgeTypesWrapped","createUseItemsState","initialItems","_useState12","setItems","onItemsChange","PlusIcon","MinusIcon","FitViewIcon","LockIcon","UnlockIcon","ControlButton","isInteractive","minZoomReached","maxZoomReached","Controls","_ref2$showZoom","showZoom","_ref2$showFitView","showFitView","_ref2$showInteractive","showInteractive","onZoomIn","onZoomOut","onFitView","onInteractiveChange","setIsVisible","_useReactFlow","title","Controls$1","hash","atob","usePersistedState","def","locationRef","_useState","localStorage","getItem","setVal","setItem","btoa","_ref$tier","_ref$unique","_ref$onClick","extraClass","alt","bgId","BackgroundNode","MapNode","mapColor","atlasScore","atlasIcons","atlasLabels","voidstones","buttonClass","_jsxs","_Fragment","MapImage","currentSearch","full","setFull","setVoidstones","flow","_usePersistedState2","setAtlasScore","_usePersistedState4","setAtlasIcons","_usePersistedState6","setAtlasLabels","background","connectedMaps","matchingNodes","fitMatching","toNode","con","callbackRef","handleKeyPress","backgroundColor","addToInput","searched","useInputField","setter","showGoTop","setShowGoTop","handleVisibleButton","pageYOffset","scrollTo","tooltip","_ref$label","_ref$scale","badgeClass","badge","mapName","Tags","Rating","calcRate","mapRate","price","perMap","everyMap","CardRateTooltip","rate","description","perDescription","MapCard","dropPoolItems","kirac","dropLevel","min_level","max_level","ninja","total","cardsWithData","kiracRate","calcMap","calcKirac","calculateCardData","_useLazy","visible","setVisible","IntersectionObserver","es","isIntersecting","cur","useLazy","_useLazy2","backgroundImage","MapName","density","MapBoss","MapConnected","MapCards","parseSearch","startsWith","_useTransition2","isPending","shareableRef","poeRegexRef","searchRef","atlasFull","setAtlasFull","atlasVoidstones","setAtlasVoidstones","searchInput","setSearchInput","_useInputField2","layoutInput","setLayoutInput","layoutReset","layoutRef","_useInputField4","densityInput","setDensityInput","densityReset","densityRef","_useInputField6","bossInput","setBossInput","bossReset","bossRef","_useInputField8","cardInput","setCardInput","cardReset","cardRef","_useInputField10","cardBaselineInput","setCardBaselineInput","cardBaselineReset","_useInputField12","cardBaselineNumberInput","setCardBaselineNumberInput","cardBaselineNumberReset","cardBaselineNumberRef","_useInputField14","cardMinPriceInput","setCardMinPriceInput","cardMinPriceReset","cardMinPriceRef","_useInputField16","useStandardPriceInput","setUseStandardPriceInput","useStandardPriceReset","useStandardPriceRef","ratedMaps","foundMaps","foundCards","cardWeightBaseline","mapsWithCardValues","mapLevel","mapCards","cardPrice","standardPrice","priceEligible","cardMinLevel","cardMaxLevel","dropEligible","_step3","rated","layoutValue","densityValue","bossValue","cardValue","_iterator3","_step4","connectedOut","_iterator4","rm","rateMaps","filteredMaps","filterMaps","poeRegex","shorthand","sv","buildSearch","containerClass","searchClass","inputSectionClass","inputClass","bigInputClass","atlasClass","Loader","GoToTop","Atlas","SelectSearch","scope","ReactDOM","App"],"sourceRoot":""}
\ No newline at end of file