@aloudata/ink-flow 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/package.json +2 -3
  2. package/dist/base.css +0 -6
  3. package/dist/components/A11yDescriptions/index.d.ts +0 -8
  4. package/dist/components/A11yDescriptions/index.d.ts.map +0 -1
  5. package/dist/components/BatchProvider/index.d.ts +0 -17
  6. package/dist/components/BatchProvider/index.d.ts.map +0 -1
  7. package/dist/components/BatchProvider/types.d.ts +0 -7
  8. package/dist/components/BatchProvider/types.d.ts.map +0 -1
  9. package/dist/components/BatchProvider/useQueue.d.ts +0 -11
  10. package/dist/components/BatchProvider/useQueue.d.ts.map +0 -1
  11. package/dist/components/EdgeWrapper/EdgeUpdateAnchors.d.ts +0 -17
  12. package/dist/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +0 -1
  13. package/dist/components/EdgeWrapper/index.d.ts +0 -3
  14. package/dist/components/EdgeWrapper/index.d.ts.map +0 -1
  15. package/dist/components/EdgeWrapper/utils.d.ts +0 -11
  16. package/dist/components/EdgeWrapper/utils.d.ts.map +0 -1
  17. package/dist/components/Edges/BaseEdge.d.ts +0 -3
  18. package/dist/components/Edges/BaseEdge.d.ts.map +0 -1
  19. package/dist/components/Edges/BezierEdge.d.ts +0 -5
  20. package/dist/components/Edges/BezierEdge.d.ts.map +0 -1
  21. package/dist/components/Edges/EdgeAnchor.d.ts +0 -14
  22. package/dist/components/Edges/EdgeAnchor.d.ts.map +0 -1
  23. package/dist/components/Edges/EdgeText.d.ts +0 -8
  24. package/dist/components/Edges/EdgeText.d.ts.map +0 -1
  25. package/dist/components/Edges/SimpleBezierEdge.d.ts +0 -21
  26. package/dist/components/Edges/SimpleBezierEdge.d.ts.map +0 -1
  27. package/dist/components/Edges/SmoothStepEdge.d.ts +0 -5
  28. package/dist/components/Edges/SmoothStepEdge.d.ts.map +0 -1
  29. package/dist/components/Edges/StepEdge.d.ts +0 -5
  30. package/dist/components/Edges/StepEdge.d.ts.map +0 -1
  31. package/dist/components/Edges/StraightEdge.d.ts +0 -5
  32. package/dist/components/Edges/StraightEdge.d.ts.map +0 -1
  33. package/dist/components/Edges/index.d.ts +0 -6
  34. package/dist/components/Edges/index.d.ts.map +0 -1
  35. package/dist/components/Handle/index.d.ts +0 -9
  36. package/dist/components/Handle/index.d.ts.map +0 -1
  37. package/dist/components/InkFlowProvider/index.d.ts +0 -14
  38. package/dist/components/InkFlowProvider/index.d.ts.map +0 -1
  39. package/dist/components/NodeWrapper/index.d.ts +0 -3
  40. package/dist/components/NodeWrapper/index.d.ts.map +0 -1
  41. package/dist/components/NodeWrapper/useNodeObserver.d.ts +0 -14
  42. package/dist/components/NodeWrapper/useNodeObserver.d.ts.map +0 -1
  43. package/dist/components/NodeWrapper/utils.d.ts +0 -9
  44. package/dist/components/NodeWrapper/utils.d.ts.map +0 -1
  45. package/dist/components/Nodes/DefaultNode.d.ts +0 -3
  46. package/dist/components/Nodes/DefaultNode.d.ts.map +0 -1
  47. package/dist/components/Nodes/GroupNode.d.ts +0 -2
  48. package/dist/components/Nodes/GroupNode.d.ts.map +0 -1
  49. package/dist/components/Nodes/InputNode.d.ts +0 -4
  50. package/dist/components/Nodes/InputNode.d.ts.map +0 -1
  51. package/dist/components/Nodes/OutputNode.d.ts +0 -3
  52. package/dist/components/Nodes/OutputNode.d.ts.map +0 -1
  53. package/dist/components/Nodes/utils.d.ts +0 -13
  54. package/dist/components/Nodes/utils.d.ts.map +0 -1
  55. package/dist/components/Panel/index.d.ts +0 -11
  56. package/dist/components/Panel/index.d.ts.map +0 -1
  57. package/dist/components/StoreUpdater/index.d.ts +0 -9
  58. package/dist/components/StoreUpdater/index.d.ts.map +0 -1
  59. package/dist/components/UserSelection/index.d.ts +0 -2
  60. package/dist/components/UserSelection/index.d.ts.map +0 -1
  61. package/dist/constants/errorMessages.d.ts +0 -22
  62. package/dist/constants/errorMessages.d.ts.map +0 -1
  63. package/dist/constants/index.d.ts +0 -2
  64. package/dist/constants/index.d.ts.map +0 -1
  65. package/dist/container/EdgeRenderer/MarkerDefinitions.d.ts +0 -10
  66. package/dist/container/EdgeRenderer/MarkerDefinitions.d.ts.map +0 -1
  67. package/dist/container/EdgeRenderer/MarkerSymbols.d.ts +0 -9
  68. package/dist/container/EdgeRenderer/MarkerSymbols.d.ts.map +0 -1
  69. package/dist/container/EdgeRenderer/index.d.ts +0 -13
  70. package/dist/container/EdgeRenderer/index.d.ts.map +0 -1
  71. package/dist/container/FlowRenderer/index.d.ts +0 -14
  72. package/dist/container/FlowRenderer/index.d.ts.map +0 -1
  73. package/dist/container/GraphView/index.d.ts +0 -11
  74. package/dist/container/GraphView/index.d.ts.map +0 -1
  75. package/dist/container/InkFlow/Wrapper.d.ts +0 -13
  76. package/dist/container/InkFlow/Wrapper.d.ts.map +0 -1
  77. package/dist/container/InkFlow/index.d.ts +0 -4
  78. package/dist/container/InkFlow/index.d.ts.map +0 -1
  79. package/dist/container/InkFlow/init-values.d.ts +0 -4
  80. package/dist/container/InkFlow/init-values.d.ts.map +0 -1
  81. package/dist/container/NodeRenderer/index.d.ts +0 -10
  82. package/dist/container/NodeRenderer/index.d.ts.map +0 -1
  83. package/dist/container/NodeRenderer/useResizeObserver.d.ts +0 -2
  84. package/dist/container/NodeRenderer/useResizeObserver.d.ts.map +0 -1
  85. package/dist/container/Pane/index.d.ts +0 -12
  86. package/dist/container/Pane/index.d.ts.map +0 -1
  87. package/dist/container/Viewport/index.d.ts +0 -7
  88. package/dist/container/Viewport/index.d.ts.map +0 -1
  89. package/dist/container/ZoomPane/index.d.ts +0 -7
  90. package/dist/container/ZoomPane/index.d.ts.map +0 -1
  91. package/dist/contexts/NodeIdContext.d.ts +0 -6
  92. package/dist/contexts/NodeIdContext.d.ts.map +0 -1
  93. package/dist/contexts/StoreContext.d.ts +0 -4
  94. package/dist/contexts/StoreContext.d.ts.map +0 -1
  95. package/dist/hooks/index.d.ts +0 -5
  96. package/dist/hooks/index.d.ts.map +0 -1
  97. package/dist/hooks/useDrag.d.ts +0 -12
  98. package/dist/hooks/useDrag.d.ts.map +0 -1
  99. package/dist/hooks/useEdgesState.d.ts +0 -4
  100. package/dist/hooks/useEdgesState.d.ts.map +0 -1
  101. package/dist/hooks/useGlobalKeyHandler.d.ts +0 -11
  102. package/dist/hooks/useGlobalKeyHandler.d.ts.map +0 -1
  103. package/dist/hooks/useInkFlow.d.ts +0 -10
  104. package/dist/hooks/useInkFlow.d.ts.map +0 -1
  105. package/dist/hooks/useIsomorphicLayoutEffect.d.ts +0 -3
  106. package/dist/hooks/useIsomorphicLayoutEffect.d.ts.map +0 -1
  107. package/dist/hooks/useKeyPress.d.ts +0 -15
  108. package/dist/hooks/useKeyPress.d.ts.map +0 -1
  109. package/dist/hooks/useMoveSelectedNodes.d.ts +0 -12
  110. package/dist/hooks/useMoveSelectedNodes.d.ts.map +0 -1
  111. package/dist/hooks/useNodesState.d.ts +0 -4
  112. package/dist/hooks/useNodesState.d.ts.map +0 -1
  113. package/dist/hooks/useResizeHandler.d.ts +0 -8
  114. package/dist/hooks/useResizeHandler.d.ts.map +0 -1
  115. package/dist/hooks/useStore.d.ts +0 -21
  116. package/dist/hooks/useStore.d.ts.map +0 -1
  117. package/dist/hooks/useViewportHelper.d.ts +0 -10
  118. package/dist/hooks/useViewportHelper.d.ts.map +0 -1
  119. package/dist/hooks/useVisibleEdgeIds.d.ts +0 -9
  120. package/dist/hooks/useVisibleEdgeIds.d.ts.map +0 -1
  121. package/dist/hooks/useVisibleNodeIds.d.ts +0 -9
  122. package/dist/hooks/useVisibleNodeIds.d.ts.map +0 -1
  123. package/dist/index.cjs.js +0 -17
  124. package/dist/index.cjs.js.map +0 -1
  125. package/dist/index.d.ts +0 -9
  126. package/dist/index.d.ts.map +0 -1
  127. package/dist/index.esm.js +0 -17
  128. package/dist/index.esm.js.map +0 -1
  129. package/dist/plugins/Controls/ControlButton.d.ts +0 -3
  130. package/dist/plugins/Controls/ControlButton.d.ts.map +0 -1
  131. package/dist/plugins/Controls/Controls.d.ts +0 -8
  132. package/dist/plugins/Controls/Controls.d.ts.map +0 -1
  133. package/dist/plugins/Controls/Icons/FitView.d.ts +0 -2
  134. package/dist/plugins/Controls/Icons/FitView.d.ts.map +0 -1
  135. package/dist/plugins/Controls/Icons/Lock.d.ts +0 -2
  136. package/dist/plugins/Controls/Icons/Lock.d.ts.map +0 -1
  137. package/dist/plugins/Controls/Icons/Minus.d.ts +0 -2
  138. package/dist/plugins/Controls/Icons/Minus.d.ts.map +0 -1
  139. package/dist/plugins/Controls/Icons/Plus.d.ts +0 -2
  140. package/dist/plugins/Controls/Icons/Plus.d.ts.map +0 -1
  141. package/dist/plugins/Controls/Icons/Unlock.d.ts +0 -2
  142. package/dist/plugins/Controls/Icons/Unlock.d.ts.map +0 -1
  143. package/dist/plugins/Controls/index.d.ts +0 -4
  144. package/dist/plugins/Controls/index.d.ts.map +0 -1
  145. package/dist/plugins/Controls/types.d.ts +0 -35
  146. package/dist/plugins/Controls/types.d.ts.map +0 -1
  147. package/dist/plugins/index.d.ts +0 -2
  148. package/dist/plugins/index.d.ts.map +0 -1
  149. package/dist/store/index.d.ts +0 -12
  150. package/dist/store/index.d.ts.map +0 -1
  151. package/dist/store/initialState.d.ts +0 -12
  152. package/dist/store/initialState.d.ts.map +0 -1
  153. package/dist/styles/utils.d.ts +0 -3
  154. package/dist/styles/utils.d.ts.map +0 -1
  155. package/dist/types/edges.d.ts +0 -114
  156. package/dist/types/edges.d.ts.map +0 -1
  157. package/dist/types/general.d.ts +0 -123
  158. package/dist/types/general.d.ts.map +0 -1
  159. package/dist/types/index.d.ts +0 -7
  160. package/dist/types/index.d.ts.map +0 -1
  161. package/dist/types/instance.d.ts +0 -149
  162. package/dist/types/instance.d.ts.map +0 -1
  163. package/dist/types/nodes.d.ts +0 -40
  164. package/dist/types/nodes.d.ts.map +0 -1
  165. package/dist/types/props.d.ts +0 -151
  166. package/dist/types/props.d.ts.map +0 -1
  167. package/dist/types/store.d.ts +0 -105
  168. package/dist/types/store.d.ts.map +0 -1
  169. package/dist/types/system/changes.d.ts +0 -51
  170. package/dist/types/system/changes.d.ts.map +0 -1
  171. package/dist/types/system/edges.d.ts +0 -83
  172. package/dist/types/system/edges.d.ts.map +0 -1
  173. package/dist/types/system/general.d.ts +0 -119
  174. package/dist/types/system/general.d.ts.map +0 -1
  175. package/dist/types/system/handles.d.ts +0 -51
  176. package/dist/types/system/handles.d.ts.map +0 -1
  177. package/dist/types/system/index.d.ts +0 -8
  178. package/dist/types/system/index.d.ts.map +0 -1
  179. package/dist/types/system/nodes.d.ts +0 -126
  180. package/dist/types/system/nodes.d.ts.map +0 -1
  181. package/dist/types/system/panzoom.d.ts +0 -49
  182. package/dist/types/system/panzoom.d.ts.map +0 -1
  183. package/dist/types/system/utils.d.ts +0 -25
  184. package/dist/types/system/utils.d.ts.map +0 -1
  185. package/dist/types/utils/types.d.ts +0 -8
  186. package/dist/types/utils/types.d.ts.map +0 -1
  187. package/dist/utils/bezier-edge.d.ts +0 -59
  188. package/dist/utils/bezier-edge.d.ts.map +0 -1
  189. package/dist/utils/changes.d.ts +0 -16
  190. package/dist/utils/changes.d.ts.map +0 -1
  191. package/dist/utils/dom.d.ts +0 -20
  192. package/dist/utils/dom.d.ts.map +0 -1
  193. package/dist/utils/edges/bezier-edge.d.ts +0 -59
  194. package/dist/utils/edges/bezier-edge.d.ts.map +0 -1
  195. package/dist/utils/edges/general.d.ts +0 -46
  196. package/dist/utils/edges/general.d.ts.map +0 -1
  197. package/dist/utils/edges/index.d.ts +0 -6
  198. package/dist/utils/edges/index.d.ts.map +0 -1
  199. package/dist/utils/edges/positions.d.ts +0 -12
  200. package/dist/utils/edges/positions.d.ts.map +0 -1
  201. package/dist/utils/edges/smoothstep-edge.d.ts +0 -43
  202. package/dist/utils/edges/smoothstep-edge.d.ts.map +0 -1
  203. package/dist/utils/edges/straight-edge.d.ts +0 -28
  204. package/dist/utils/edges/straight-edge.d.ts.map +0 -1
  205. package/dist/utils/edges.d.ts +0 -26
  206. package/dist/utils/edges.d.ts.map +0 -1
  207. package/dist/utils/general.d.ts +0 -61
  208. package/dist/utils/general.d.ts.map +0 -1
  209. package/dist/utils/graph.d.ts +0 -113
  210. package/dist/utils/graph.d.ts.map +0 -1
  211. package/dist/utils/marker.d.ts +0 -9
  212. package/dist/utils/marker.d.ts.map +0 -1
  213. package/dist/utils/positions.d.ts +0 -12
  214. package/dist/utils/positions.d.ts.map +0 -1
  215. package/dist/utils/smoothstep-edge.d.ts +0 -43
  216. package/dist/utils/smoothstep-edge.d.ts.map +0 -1
  217. package/dist/utils/store.d.ts +0 -30
  218. package/dist/utils/store.d.ts.map +0 -1
  219. package/dist/utils/straight-edge.d.ts +0 -34
  220. package/dist/utils/straight-edge.d.ts.map +0 -1
  221. package/dist/utils/xydrag/XYDrag.d.ts +0 -52
  222. package/dist/utils/xydrag/XYDrag.d.ts.map +0 -1
  223. package/dist/utils/xydrag/index.d.ts +0 -2
  224. package/dist/utils/xydrag/index.d.ts.map +0 -1
  225. package/dist/utils/xydrag/utils.d.ts +0 -10
  226. package/dist/utils/xydrag/utils.d.ts.map +0 -1
  227. package/dist/utils/xyhandle/XYHandle.d.ts +0 -49
  228. package/dist/utils/xyhandle/XYHandle.d.ts.map +0 -1
  229. package/dist/utils/xyhandle/index.d.ts +0 -2
  230. package/dist/utils/xyhandle/index.d.ts.map +0 -1
  231. package/dist/utils/xyhandle/utils.d.ts +0 -14
  232. package/dist/utils/xyhandle/utils.d.ts.map +0 -1
  233. package/dist/utils/xypanzoom/XYPanZoom.d.ts +0 -12
  234. package/dist/utils/xypanzoom/XYPanZoom.d.ts.map +0 -1
  235. package/dist/utils/xypanzoom/eventhandler.d.ts +0 -46
  236. package/dist/utils/xypanzoom/eventhandler.d.ts.map +0 -1
  237. package/dist/utils/xypanzoom/filter.d.ts +0 -14
  238. package/dist/utils/xypanzoom/filter.d.ts.map +0 -1
  239. package/dist/utils/xypanzoom/index.d.ts +0 -2
  240. package/dist/utils/xypanzoom/index.d.ts.map +0 -1
  241. package/dist/utils/xypanzoom/utils.d.ts +0 -10
  242. package/dist/utils/xypanzoom/utils.d.ts.map +0 -1
package/dist/index.cjs.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=function(){return n=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},n.apply(this,arguments)};function t(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}function r(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,u)}c((r=r.apply(e,n||[])).next())}))}function o(e,n){var t,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=n.call(e,a)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function i(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],r=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function u(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}function c(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var s,l={exports:{}},d={};l.exports=function(){if(s)return d;s=1;var n=e,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(e,n,r){var u,c={},s=null,l=null;for(u in void 0!==r&&(s=""+r),void 0!==n.key&&(s=""+n.key),void 0!==n.ref&&(l=n.ref),n)o.call(n,u)&&!a.hasOwnProperty(u)&&(c[u]=n[u]);if(e&&e.defaultProps)for(u in n=e.defaultProps)void 0===c[u]&&(c[u]=n[u]);return{$$typeof:t,type:e,key:s,ref:l,props:c,_owner:i.current}}return d.Fragment=r,d.jsx=u,d.jsxs=u,d}();var f,h=l.exports,v={exports:{}};
2
- /*!
3
- Copyright (c) 2018 Jed Watson.
4
- Licensed under the MIT License (MIT), see
5
- http://jedwatson.github.io/classnames
6
- */
7
- f=v,function(){var e={}.hasOwnProperty;function n(){for(var t=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)t.push(o);else if(Array.isArray(o)){if(o.length){var a=n.apply(null,o);a&&t.push(a)}}else if("object"===i)if(o.toString===Object.prototype.toString)for(var u in o)e.call(o,u)&&o[u]&&t.push(u);else t.push(o.toString())}}return t.join(" ")}f.exports?(n.default=n,f.exports=n):window.classNames=n}();var p,g,y,m=c(v.exports),w={exports:{}},b={},x={exports:{}},_={};function E(){return g||(g=1,x.exports=function(){if(p)return _;p=1;var n=e,t="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},r=n.useState,o=n.useEffect,i=n.useLayoutEffect,a=n.useDebugValue;function u(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!t(e,r)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,n){return n()}:function(e,n){var t=n(),c=r({inst:{value:t,getSnapshot:n}}),s=c[0].inst,l=c[1];return i((function(){s.value=t,s.getSnapshot=n,u(s)&&l({inst:s})}),[e,t,n]),o((function(){return u(s)&&l({inst:s}),e((function(){u(s)&&l({inst:s})}))}),[e]),a(t),t};return _.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c,_}()),x.exports}
8
- /**
9
- * @license React
10
- * use-sync-external-store-shim/with-selector.production.min.js
11
- *
12
- * Copyright (c) Facebook, Inc. and its affiliates.
13
- *
14
- * This source code is licensed under the MIT license found in the
15
- * LICENSE file in the root directory of this source tree.
16
- */w.exports=function(){if(y)return b;y=1;var n=e,t=E(),r="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},o=t.useSyncExternalStore,i=n.useRef,a=n.useEffect,u=n.useMemo,c=n.useDebugValue;return b.useSyncExternalStoreWithSelector=function(e,n,t,s,l){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=u((function(){function e(e){if(!a){if(a=!0,o=e,e=s(e),void 0!==l&&f.hasValue){var n=f.value;if(l(n,e))return i=n}return i=e}if(n=i,r(o,e))return n;var t=s(e);return void 0!==l&&l(n,t)?n:(o=e,i=t)}var o,i,a=!1,u=void 0===t?null:t;return[function(){return e(n())},null===u?void 0:function(){return e(u())}]}),[n,t,s,l]);var h=o(e,d[0],d[1]);return a((function(){f.hasValue=!0,f.value=h}),[h]),c(h),h},b}();var S=c(w.exports);const k=e=>{let n;const t=new Set,r=(e,r)=>{const o="function"==typeof e?e(n):e;if(!Object.is(o,n)){const e=n;n=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},n,o),t.forEach((t=>t(n,e)))}},o=()=>n,i={setState:r,getState:o,getInitialState:()=>a,subscribe:e=>(t.add(e),()=>t.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},a=n=e(r,o,i);return i},{useDebugValue:N}=e,{useSyncExternalStoreWithSelector:C}=S,P=e=>e;function M(e,n=P,t){const r=C(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,t);return N(r),r}const O=(e,n)=>{const t=(e=>e?k(e):k)(e),r=(e,r=n)=>M(t,e,r);return Object.assign(r,t),r};var j=e.createContext(null),I=j.Provider,A={error001:function(){return"[Ink Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://InkFlow.dev/error#001"},error002:function(){return"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them."},error003:function(e){return'Node type "'.concat(e,'" not found. Using fallback type "default".')},error004:function(){return"The Ink Flow parent container needs a width and a height to render the graph."},error005:function(){return"Only child nodes can use a parent extent."},error006:function(){return"Can't create edge. An edge needs a source and a target."},error007:function(e){return"The old edge with id=".concat(e," does not exist.")},error009:function(e){return'Marker type "'.concat(e,"\" doesn't exist.")},error008:function(e,n){var t=n.id,r=n.sourceHandle,o=n.targetHandle;return"Couldn't create edge for ".concat(e,' handle id: "').concat(r?o:r,'", edge id: ').concat(t,".")},error010:function(){return"Handle: No node id found. Make sure to only use a Handle inside a custom Node."},error011:function(e){return'Edge type "'.concat(e,'" not found. Using fallback type "default".')},error012:function(e){return'Node with id "'.concat(e,'" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.')}},z=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],T=["Enter"," ","Escape"],B=A.error001();function D(n,t){var r=e.useContext(j);if(null===r)throw new Error(B);return M(r,n,t)}function L(){var n=e.useContext(j);if(null===n)throw new Error(B);return e.useMemo((function(){return{getState:n.getState,setState:n.setState,subscribe:n.subscribe}}),[n])}function R(e,t){var r,o,u;void 0===t&&(t={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{}});var c=(null==t?void 0:t.elevateNodesOnSelect)?1e3:0;try{for(var s=i(e),l=s.next();!l.done;l=s.next()){var d=a(l.value,2)[1],f=d.parentId;if(f){if(!e.has(f))throw new Error("Parent node ".concat(f," not found"));var h=e.get(f),v=V(d,e,n(n({},d.position),{z:($(d.zIndex)?d.zIndex:0)+(d.selected?c:0)}),null!==(u=null==h?void 0:h.origin)&&void 0!==u?u:t.nodeOrigin),p=v.x,g=v.y,y=v.z,m=d.internals.positionAbsolute,w=p!==m.x||g!==m.y;(w||y!==d.internals.z)&&(d.internals=n(n({},d.internals),{positionAbsolute:w?{x:p,y:g}:m,z:y}))}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}function V(e,n,t,r){var o,i,a,u,c,s;if(void 0===r&&(r=[0,0]),!e.parentId)return t;var l=n.get(e.parentId),d=H(l,r).position;return V(l,n,{x:(null!==(o=t.x)&&void 0!==o?o:0)+d.x,y:(null!==(i=t.y)&&void 0!==i?i:0)+d.y,z:(null!==(a=l.internals.z)&&void 0!==a?a:0)>(null!==(u=t.z)&&void 0!==u?u:0)?null!==(c=l.internals.z)&&void 0!==c?c:0:null!==(s=t.z)&&void 0!==s?s:0},l.origin||r)}var H=function(e,n){void 0===n&&(n=[0,0]);var t=G(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}};function Z(e,n,t){var r,o;e.clear(),n.clear();try{for(var a=i(t),u=a.next();!u.done;u=a.next()){var c=u.value,s=c.source,l=c.target,d=c.sourceHandle,f=void 0===d?null:d,h=c.targetHandle,v=void 0===h?null:h,p="".concat(s,"-source-").concat(f),g="".concat(l,"-target-").concat(v),y=e.get(p)||new Map,m=e.get(g)||new Map,w={edgeId:c.id,source:s,target:l,sourceHandle:f,targetHandle:v};n.set(c.id,c),e.set(p,y.set("".concat(l,"-").concat(v),w)),e.set(g,m.set("".concat(s,"-").concat(f),w))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}}function Y(e,t,r,o){void 0===o&&(o={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{},checkEquality:!0});var i=new Map(t);t.clear(),r.clear();var a=(null==o?void 0:o.elevateNodesOnSelect)?1e3:0;e.forEach((function(e){var u,c,s=i.get(e.id);if(o.checkEquality&&e===(null==s?void 0:s.internals.userNode)||(s=n(n(n({},o.defaults),e),{measured:{width:null===(u=e.measured)||void 0===u?void 0:u.width,height:null===(c=e.measured)||void 0===c?void 0:c.height},internals:{positionAbsolute:e.position,handleBounds:null==s?void 0:s.internals.handleBounds,z:($(e.zIndex)?e.zIndex:0)+(e.selected?a:0),userNode:e}})),t.set(e.id,s),e.parentId){var l=r.get(e.parentId);l?l.push(s):r.set(e.parentId,[s])}})),r.size>0&&R(t,o)}function X(e,n,t,r){var o,a,u,c,s,l=[],d=new Map;try{for(var f=i(e),h=f.next();!h.done;h=f.next()){var v=h.value,p=n.get(v.parentId);if(p){var g=null!==(c=null===(u=d.get(v.parentId))||void 0===u?void 0:u.expandedRect)&&void 0!==c?c:K(p,null!==(s=p.origin)&&void 0!==s?s:r),y=te(g,v.rect);d.set(v.parentId,{expandedRect:y,parent:p})}}}catch(e){o={error:e}}finally{try{h&&!h.done&&(a=f.return)&&a.call(f)}finally{if(o)throw o.error}}return d.size>0&&d.forEach((function(n,r){var o=n.expandedRect,i=n.parent,a=H(i,i.origin).position,u=G(i),c=o.x<a.x?Math.round(Math.abs(a.x-o.x)):0,s=o.y<a.y?Math.round(Math.abs(a.y-o.y)):0;if(c>0||s>0){l.push({id:r,type:"position",position:{x:a.x-c,y:a.y-s}});var d=t.get(r);null==d||d.forEach((function(n){e.some((function(e){return e.id===n.id}))||l.push({id:n.id,type:"position",position:{x:n.position.x+c,y:n.position.y+s}})}))}(u.width<o.width||u.height<o.height)&&l.push({id:r,type:"dimensions",setAttributes:!0,dimensions:{width:Math.max(u.width,Math.round(o.width)),height:Math.max(u.height,Math.round(o.height))}})})),l}var F=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},U=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:F(e.x,n[0][0],n[1][0]),y:F(e.y,n[0][1],n[1][1])}};function G(e){var n,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:e.initialHeight)&&void 0!==c?c:0}}var $=function(e){return!isNaN(e)&&isFinite(e)},W=function(e,n){return void 0===n&&(n=[1,1]),{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}},q=function(e,n,t,r){var o=e.x,i=e.y,u=a(n,3),c=u[0],s=u[1],l=u[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var d={x:(o-c)/l,y:(i-s)/l};return t?W(d,r):d},K=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=H(e,n).positionAbsolute;return{x:c.x,y:c.y,width:null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0,height:null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0}},Q=function(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}},J=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},ee=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},ne=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=H(e,n).positionAbsolute,s=c.x,l=c.y;return{x:s,y:l,x2:s+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:l+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}},te=function(e,n){return ee(Q(J(e),J(n)))};function re(n){return e.forwardRef(n)}var oe=function(e,n){var t=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),r=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(t*r)},ie=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),s=F(c,r,o);return{x:n/2-(e.x+e.width/2)*s,y:t/2-(e.y+e.height/2)*s,zoom:s}};function ae(e){return void 0!==e&&"parent"!==e}var ue=function(e,n,t){return e<n?F(Math.abs(e-n),1,50)/50:e>t?-F(Math.abs(e-t),1,50)/50:0},ce=function(e,n){return[20*ue(e.x,35,n.width-35),20*ue(e.y,35,n.height-35)]},se=function(e){var n=e.x,t=e.y,r=e.width,o=e.height,i=e.origin,a=void 0===i?[0,0]:i;return!r||!o||a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:n,y:t}:{x:n-r*a[0],y:t-o*a[1]}},le=function(e,n){var t=e.x,r=e.y,o=a(n,3),i=o[0],u=o[1],c=o[2];return{x:t*c+i,y:r*c+u}},de=function(){var e;return"undefined"!=typeof navigator&&(null===(e=null===navigator||void 0===navigator?void 0:navigator.userAgent)||void 0===e?void 0:e.indexOf("Mac"))>=0},fe=function(e){return he(e)},he=function(e){return"id"in e&&"position"in e&&!("source"in e)&&!("target"in e)};var ve=function(e){return $(e.width)&&$(e.height)&&$(e.x)&&$(e.y)};function pe(e,t){var r=t.snapGrid,o=void 0===r?[0,0]:r,i=t.snapToGrid,a=void 0!==i&&i,u=t.transform,c=xe(e),s=c.x,l=c.y,d=q({x:s,y:l},u),f=a?W(d,o):d,h=f.x,v=f.y;return n({xSnapped:h,ySnapped:v},d)}var ge=function(e){return{width:e.offsetWidth,height:e.offsetHeight}},ye=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)},me=["INPUT","SELECT","TEXTAREA"];function we(e){var n,t,r=(null===(t=null===(n=e.composedPath)||void 0===n?void 0:n.call(e))||void 0===t?void 0:t[0])||e.target;return me.includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}var be=function(e){return"clientX"in e},xe=function(e,n){var t,r,o,i,a=be(e),u=a?e.clientX:null===(t=e.touches)||void 0===t?void 0:t[0].clientX,c=a?e.clientY:null===(r=e.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==n?void 0:n.left)&&void 0!==o?o:0),y:c-(null!==(i=null==n?void 0:n.top)&&void 0!==i?i:0)}},_e=function(e,t,r,o){void 0===o&&(o=[0,0]);var i=t.querySelectorAll(e);if(!i||!i.length)return null;var a=Array.from(i),u=t.getBoundingClientRect(),c=u.width*o[0],s=u.height*o[1];return a.map((function(e){var t=e.getBoundingClientRect();return n({id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(t.left-u.left-c)/r,y:(t.top-u.top-s)/r},ge(e))}))},Ee="undefined"!=typeof document?document:null;function Se(n,t){void 0===n&&(n=null),void 0===t&&(t={target:Ee,actInsideInputWithModifier:!0});var r=a(e.useState(!1),2),o=r[0],i=r[1],c=e.useRef(!1),s=e.useRef(new Set([])),l=a(e.useMemo((function(){if(null!==n){var e=(Array.isArray(n)?n:[n]).filter((function(e){return"string"==typeof e})).map((function(e){return e.split("+")})),t=e.reduce((function(e,n){return e.concat.apply(e,u([],a(n),!1))}),[]);return[e,t]}return[[],[]]}),[n]),2),d=l[0],f=l[1];return e.useEffect((function(){var e=(null==t?void 0:t.target)||Ee;if(null!==n){var r=function(e){if(c.current=e.ctrlKey||e.metaKey||e.shiftKey,(!c.current||c.current&&!t.actInsideInputWithModifier)&&we(e))return!1;var n=Ne(e.code,f);s.current.add(e[n]),ke(d,s.current,!1)&&(e.preventDefault(),i(!0))},o=function(e){if((!c.current||c.current&&!t.actInsideInputWithModifier)&&we(e))return!1;var n=Ne(e.code,f);ke(d,s.current,!0)?(i(!1),s.current.clear()):s.current.delete(e[n]),"Meta"===e.key&&s.current.clear(),c.current=!1},a=function(){s.current.clear(),i(!1)};return null==e||e.addEventListener("keydown",r),null==e||e.addEventListener("keyup",o),window.addEventListener("blur",a),window.addEventListener("contextmenu",a),function(){null==e||e.removeEventListener("keydown",r),null==e||e.removeEventListener("keyup",o),window.removeEventListener("blur",a),window.removeEventListener("contextmenu",a)}}}),[n,i]),o}function ke(e,n,t){return e.filter((function(e){return t||e.length===n.size})).some((function(e){return e.every((function(e){return n.has(e)}))}))}function Ne(e,n){return n.includes(e)?"code":"key"}function Ce(e,n){if(Object.is(e,n))return!0;if("object"!=typeof e||null===e||"object"!=typeof n||null===n)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[t,r]of e)if(!Object.is(r,n.get(t)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const t of e)if(!n.has(t))return!1;return!0}const t=Object.keys(e);if(t.length!==Object.keys(n).length)return!1;for(const r of t)if(!Object.prototype.hasOwnProperty.call(n,r)||!Object.is(e[r],n[r]))return!1;return!0}var Pe,Me,Oe,je,Ie,Ae,ze={position:"absolute",width:"100%",height:"100%",top:0,left:0};!function(e){e.Strict="strict",e.Loose="loose"}(Pe||(Pe={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(Me||(Me={})),function(e){e.Partial="partial",e.Full="full"}(Oe||(Oe={})),function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(je||(je={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(Ie||(Ie={})),exports.Position=void 0,(Ae=exports.Position||(exports.Position={})).Left="left",Ae.Top="top",Ae.Right="right",Ae.Bottom="bottom";var Te={value:()=>{}};function Be(){for(var e,n=0,t=arguments.length,r={};n<t;++n){if(!(e=arguments[n]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new De(r)}function De(e){this._=e}function Le(e,n){for(var t,r=0,o=e.length;r<o;++r)if((t=e[r]).name===n)return t.value}function Re(e,n,t){for(var r=0,o=e.length;r<o;++r)if(e[r].name===n){e[r]=Te,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=t&&e.push({name:n,value:t}),e}De.prototype=Be.prototype={constructor:De,on:function(e,n){var t,r,o=this._,i=(r=o,(e+"").trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");if(t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(t=(e=i[a]).type)o[t]=Re(o[t],e.name,n);else if(null==n)for(t in o)o[t]=Re(o[t],e.name,null);return this}for(;++a<u;)if((t=(e=i[a]).type)&&(t=Le(o[t],e.name)))return t},copy:function(){var e={},n=this._;for(var t in n)e[t]=n[t].slice();return new De(e)},call:function(e,n){if((t=arguments.length-2)>0)for(var t,r,o=new Array(t),i=0;i<t;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,t=(r=this._[e]).length;i<t;++i)r[i].value.apply(n,o)},apply:function(e,n,t){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(n,t)}};var Ve="http://www.w3.org/1999/xhtml",He={svg:"http://www.w3.org/2000/svg",xhtml:Ve,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ze(e){var n=e+="",t=n.indexOf(":");return t>=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),He.hasOwnProperty(n)?{space:He[n],local:e}:e}function Ye(e){return function(){var n=this.ownerDocument,t=this.namespaceURI;return t===Ve&&n.documentElement.namespaceURI===Ve?n.createElement(e):n.createElementNS(t,e)}}function Xe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Fe(e){var n=Ze(e);return(n.local?Xe:Ye)(n)}function Ue(){}function Ge(e){return null==e?Ue:function(){return this.querySelector(e)}}function $e(){return[]}function We(e){return null==e?$e:function(){return this.querySelectorAll(e)}}function qe(e){return function(){return function(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}(e.apply(this,arguments))}}function Ke(e){return function(){return this.matches(e)}}function Qe(e){return function(n){return n.matches(e)}}var Je=Array.prototype.find;function en(){return this.firstElementChild}var nn=Array.prototype.filter;function tn(){return Array.from(this.children)}function rn(e){return new Array(e.length)}function on(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}function an(e,n,t,r,o,i){for(var a,u=0,c=n.length,s=i.length;u<s;++u)(a=n[u])?(a.__data__=i[u],r[u]=a):t[u]=new on(e,i[u]);for(;u<c;++u)(a=n[u])&&(o[u]=a)}function un(e,n,t,r,o,i,a){var u,c,s,l=new Map,d=n.length,f=i.length,h=new Array(d);for(u=0;u<d;++u)(c=n[u])&&(h[u]=s=a.call(c,c.__data__,u,n)+"",l.has(s)?o[u]=c:l.set(s,c));for(u=0;u<f;++u)s=a.call(e,i[u],u,i)+"",(c=l.get(s))?(r[u]=c,c.__data__=i[u],l.delete(s)):t[u]=new on(e,i[u]);for(u=0;u<d;++u)(c=n[u])&&l.get(h[u])===c&&(o[u]=c)}function cn(e){return e.__data__}function sn(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function ln(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function dn(e){return function(){this.removeAttribute(e)}}function fn(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hn(e,n){return function(){this.setAttribute(e,n)}}function vn(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function pn(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}function gn(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,t)}}function yn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function mn(e){return function(){this.style.removeProperty(e)}}function wn(e,n,t){return function(){this.style.setProperty(e,n,t)}}function bn(e,n,t){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,t)}}function xn(e,n){return e.style.getPropertyValue(n)||yn(e).getComputedStyle(e,null).getPropertyValue(n)}function _n(e){return function(){delete this[e]}}function En(e,n){return function(){this[e]=n}}function Sn(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}function kn(e){return e.trim().split(/^|\s+/)}function Nn(e){return e.classList||new Cn(e)}function Cn(e){this._node=e,this._names=kn(e.getAttribute("class")||"")}function Pn(e,n){for(var t=Nn(e),r=-1,o=n.length;++r<o;)t.add(n[r])}function Mn(e,n){for(var t=Nn(e),r=-1,o=n.length;++r<o;)t.remove(n[r])}function On(e){return function(){Pn(this,e)}}function jn(e){return function(){Mn(this,e)}}function In(e,n){return function(){(n.apply(this,arguments)?Pn:Mn)(this,e)}}function An(){this.textContent=""}function zn(e){return function(){this.textContent=e}}function Tn(e){return function(){var n=e.apply(this,arguments);this.textContent=null==n?"":n}}function Bn(){this.innerHTML=""}function Dn(e){return function(){this.innerHTML=e}}function Ln(e){return function(){var n=e.apply(this,arguments);this.innerHTML=null==n?"":n}}function Rn(){this.nextSibling&&this.parentNode.appendChild(this)}function Vn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Hn(){return null}function Zn(){var e=this.parentNode;e&&e.removeChild(this)}function Yn(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Xn(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Fn(e){return function(){var n=this.__on;if(n){for(var t,r=0,o=-1,i=n.length;r<i;++r)t=n[r],e.type&&t.type!==e.type||t.name!==e.name?n[++o]=t:this.removeEventListener(t.type,t.listener,t.options);++o?n.length=o:delete this.__on}}}function Un(e,n,t){return function(){var r,o=this.__on,i=function(e){return function(n){e.call(this,n,this.__data__)}}(n);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=t),void(r.value=n);this.addEventListener(e.type,i,t),r={type:e.type,name:e.name,value:n,listener:i,options:t},o?o.push(r):this.__on=[r]}}function Gn(e,n,t){var r=yn(e),o=r.CustomEvent;"function"==typeof o?o=new o(n,t):(o=r.document.createEvent("Event"),t?(o.initEvent(n,t.bubbles,t.cancelable),o.detail=t.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function $n(e,n){return function(){return Gn(this,e,n)}}function Wn(e,n){return function(){return Gn(this,e,n.apply(this,arguments))}}on.prototype={constructor:on,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},Cn.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var qn=[null];function Kn(e,n){this._groups=e,this._parents=n}function Qn(){return new Kn([[document.documentElement]],qn)}function Jn(e){return"string"==typeof e?new Kn([[document.querySelector(e)]],[document.documentElement]):new Kn([[e]],qn)}function et(e,n){if(e=function(e){let n;for(;n=e.sourceEvent;)e=n;return e}(e),void 0===n&&(n=e.currentTarget),n){var t=n.ownerSVGElement||n;if(t.createSVGPoint){var r=t.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}Kn.prototype=Qn.prototype={constructor:Kn,select:function(e){"function"!=typeof e&&(e=Ge(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a,u=n[o],c=u.length,s=r[o]=new Array(c),l=0;l<c;++l)(i=u[l])&&(a=e.call(i,i.__data__,l,u))&&("__data__"in i&&(a.__data__=i.__data__),s[l]=a);return new Kn(r,this._parents)},selectAll:function(e){e="function"==typeof e?qe(e):We(e);for(var n=this._groups,t=n.length,r=[],o=[],i=0;i<t;++i)for(var a,u=n[i],c=u.length,s=0;s<c;++s)(a=u[s])&&(r.push(e.call(a,a.__data__,s,u)),o.push(a));return new Kn(r,o)},selectChild:function(e){return this.select(null==e?en:function(e){return function(){return Je.call(this.children,e)}}("function"==typeof e?e:Qe(e)))},selectChildren:function(e){return this.selectAll(null==e?tn:function(e){return function(){return nn.call(this.children,e)}}("function"==typeof e?e:Qe(e)))},filter:function(e){"function"!=typeof e&&(e=Ke(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],s=0;s<u;++s)(i=a[s])&&e.call(i,i.__data__,s,a)&&c.push(i);return new Kn(r,this._parents)},data:function(e,n){if(!arguments.length)return Array.from(this,cn);var t=n?un:an,r=this._parents,o=this._groups;"function"!=typeof e&&(e=function(e){return function(){return e}}(e));for(var i=o.length,a=new Array(i),u=new Array(i),c=new Array(i),s=0;s<i;++s){var l=r[s],d=o[s],f=d.length,h=sn(e.call(l,l&&l.__data__,s,r)),v=h.length,p=u[s]=new Array(v),g=a[s]=new Array(v);t(l,d,p,g,c[s]=new Array(f),h,n);for(var y,m,w=0,b=0;w<v;++w)if(y=p[w]){for(w>=b&&(b=w+1);!(m=g[b])&&++b<v;);y._next=m||null}}return(a=new Kn(a,r))._enter=u,a._exit=c,a},enter:function(){return new Kn(this._enter||this._groups.map(rn),this._parents)},exit:function(){return new Kn(this._exit||this._groups.map(rn),this._parents)},join:function(e,n,t){var r=this.enter(),o=this,i=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=n&&(o=n(o))&&(o=o.selection()),null==t?i.remove():t(i),r&&o?r.merge(o).order():o},merge:function(e){for(var n=e.selection?e.selection():e,t=this._groups,r=n._groups,o=t.length,i=r.length,a=Math.min(o,i),u=new Array(o),c=0;c<a;++c)for(var s,l=t[c],d=r[c],f=l.length,h=u[c]=new Array(f),v=0;v<f;++v)(s=l[v]||d[v])&&(h[v]=s);for(;c<o;++c)u[c]=t[c];return new Kn(u,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,n=-1,t=e.length;++n<t;)for(var r,o=e[n],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function n(n,t){return n&&t?e(n.__data__,t.__data__):!n-!t}e||(e=ln);for(var t=this._groups,r=t.length,o=new Array(r),i=0;i<r;++i){for(var a,u=t[i],c=u.length,s=o[i]=new Array(c),l=0;l<c;++l)(a=u[l])&&(s[l]=a);s.sort(n)}return new Kn(o,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,n=0,t=e.length;n<t;++n)for(var r=e[n],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null},size:function(){let e=0;for(const n of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var n=this._groups,t=0,r=n.length;t<r;++t)for(var o,i=n[t],a=0,u=i.length;a<u;++a)(o=i[a])&&e.call(o,o.__data__,a,i);return this},attr:function(e,n){var t=Ze(e);if(arguments.length<2){var r=this.node();return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}return this.each((null==n?t.local?fn:dn:"function"==typeof n?t.local?gn:pn:t.local?vn:hn)(t,n))},style:function(e,n,t){return arguments.length>1?this.each((null==n?mn:"function"==typeof n?bn:wn)(e,n,null==t?"":t)):xn(this.node(),e)},property:function(e,n){return arguments.length>1?this.each((null==n?_n:"function"==typeof n?Sn:En)(e,n)):this.node()[e]},classed:function(e,n){var t=kn(e+"");if(arguments.length<2){for(var r=Nn(this.node()),o=-1,i=t.length;++o<i;)if(!r.contains(t[o]))return!1;return!0}return this.each(("function"==typeof n?In:n?On:jn)(t,n))},text:function(e){return arguments.length?this.each(null==e?An:("function"==typeof e?Tn:zn)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Bn:("function"==typeof e?Ln:Dn)(e)):this.node().innerHTML},raise:function(){return this.each(Rn)},lower:function(){return this.each(Vn)},append:function(e){var n="function"==typeof e?e:Fe(e);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(e,n){var t="function"==typeof e?e:Fe(e),r=null==n?Hn:"function"==typeof n?n:Ge(n);return this.select((function(){return this.insertBefore(t.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(Zn)},clone:function(e){return this.select(e?Xn:Yn)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,n,t){var r,o,i=function(e){return e.trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");return t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),{type:e,name:n}}))}(e+""),a=i.length;if(!(arguments.length<2)){for(u=n?Un:Fn,r=0;r<a;++r)this.each(u(i[r],n,t));return this}var u=this.node().__on;if(u)for(var c,s=0,l=u.length;s<l;++s)for(r=0,c=u[s];r<a;++r)if((o=i[r]).type===c.type&&o.name===c.name)return c.value},dispatch:function(e,n){return this.each(("function"==typeof n?Wn:$n)(e,n))},[Symbol.iterator]:function*(){for(var e=this._groups,n=0,t=e.length;n<t;++n)for(var r,o=e[n],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};const nt={passive:!1},tt={capture:!0,passive:!1};function rt(e){e.stopImmediatePropagation()}function ot(e){e.preventDefault(),e.stopImmediatePropagation()}function it(e){var n=e.document.documentElement,t=Jn(e).on("dragstart.drag",ot,tt);"onselectstart"in n?t.on("selectstart.drag",ot,tt):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function at(e,n){var t=e.document.documentElement,r=Jn(e).on("dragstart.drag",null);n&&(r.on("click.drag",ot,tt),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in t?r.on("selectstart.drag",null):(t.style.MozUserSelect=t.__noselect,delete t.__noselect)}var ut=e=>()=>e;function ct(e,{sourceEvent:n,subject:t,target:r,identifier:o,active:i,x:a,y:u,dx:c,dy:s,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:s,enumerable:!0,configurable:!0},_:{value:l}})}function st(e){return!e.ctrlKey&&!e.button}function lt(){return this.parentNode}function dt(e,n){return null==n?{x:e.x,y:e.y}:n}function ft(){return navigator.maxTouchPoints||"ontouchstart"in this}function ht(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function vt(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function pt(){}ct.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var gt=.7,yt=1/gt,mt="\\s*([+-]?\\d+)\\s*",wt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",bt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xt=/^#([0-9a-f]{3,8})$/,_t=new RegExp(`^rgb\\(${mt},${mt},${mt}\\)$`),Et=new RegExp(`^rgb\\(${bt},${bt},${bt}\\)$`),St=new RegExp(`^rgba\\(${mt},${mt},${mt},${wt}\\)$`),kt=new RegExp(`^rgba\\(${bt},${bt},${bt},${wt}\\)$`),Nt=new RegExp(`^hsl\\(${wt},${bt},${bt}\\)$`),Ct=new RegExp(`^hsla\\(${wt},${bt},${bt},${wt}\\)$`),Pt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Mt(){return this.rgb().formatHex()}function Ot(){return this.rgb().formatRgb()}function jt(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=xt.exec(e))?(t=n[1].length,n=parseInt(n[1],16),6===t?It(n):3===t?new Tt(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===t?At(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===t?At(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=_t.exec(e))?new Tt(n[1],n[2],n[3],1):(n=Et.exec(e))?new Tt(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=St.exec(e))?At(n[1],n[2],n[3],n[4]):(n=kt.exec(e))?At(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Nt.exec(e))?Ht(n[1],n[2]/100,n[3]/100,1):(n=Ct.exec(e))?Ht(n[1],n[2]/100,n[3]/100,n[4]):Pt.hasOwnProperty(e)?It(Pt[e]):"transparent"===e?new Tt(NaN,NaN,NaN,0):null}function It(e){return new Tt(e>>16&255,e>>8&255,255&e,1)}function At(e,n,t,r){return r<=0&&(e=n=t=NaN),new Tt(e,n,t,r)}function zt(e,n,t,r){return 1===arguments.length?function(e){return e instanceof pt||(e=jt(e)),e?new Tt((e=e.rgb()).r,e.g,e.b,e.opacity):new Tt}(e):new Tt(e,n,t,null==r?1:r)}function Tt(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}function Bt(){return`#${Vt(this.r)}${Vt(this.g)}${Vt(this.b)}`}function Dt(){const e=Lt(this.opacity);return`${1===e?"rgb(":"rgba("}${Rt(this.r)}, ${Rt(this.g)}, ${Rt(this.b)}${1===e?")":`, ${e})`}`}function Lt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Rt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Vt(e){return((e=Rt(e))<16?"0":"")+e.toString(16)}function Ht(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new Yt(e,n,t,r)}function Zt(e){if(e instanceof Yt)return new Yt(e.h,e.s,e.l,e.opacity);if(e instanceof pt||(e=jt(e)),!e)return new Yt;if(e instanceof Yt)return e;var n=(e=e.rgb()).r/255,t=e.g/255,r=e.b/255,o=Math.min(n,t,r),i=Math.max(n,t,r),a=NaN,u=i-o,c=(i+o)/2;return u?(a=n===i?(t-r)/u+6*(t<r):t===i?(r-n)/u+2:(n-t)/u+4,u/=c<.5?i+o:2-i-o,a*=60):u=c>0&&c<1?0:a,new Yt(a,u,c,e.opacity)}function Yt(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}function Xt(e){return(e=(e||0)%360)<0?e+360:e}function Ft(e){return Math.max(0,Math.min(1,e||0))}function Ut(e,n,t){return 255*(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)}ht(pt,jt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Mt,formatHex:Mt,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Zt(this).formatHsl()},formatRgb:Ot,toString:Ot}),ht(Tt,zt,vt(pt,{brighter(e){return e=null==e?yt:Math.pow(yt,e),new Tt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?gt:Math.pow(gt,e),new Tt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Tt(Rt(this.r),Rt(this.g),Rt(this.b),Lt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Bt,formatHex:Bt,formatHex8:function(){return`#${Vt(this.r)}${Vt(this.g)}${Vt(this.b)}${Vt(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Dt,toString:Dt})),ht(Yt,(function(e,n,t,r){return 1===arguments.length?Zt(e):new Yt(e,n,t,null==r?1:r)}),vt(pt,{brighter(e){return e=null==e?yt:Math.pow(yt,e),new Yt(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?gt:Math.pow(gt,e),new Yt(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,o=2*t-r;return new Tt(Ut(e>=240?e-240:e+120,o,r),Ut(e,o,r),Ut(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Yt(Xt(this.h),Ft(this.s),Ft(this.l),Lt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Lt(this.opacity);return`${1===e?"hsl(":"hsla("}${Xt(this.h)}, ${100*Ft(this.s)}%, ${100*Ft(this.l)}%${1===e?")":`, ${e})`}`}}));var Gt=e=>()=>e;function $t(e){return 1==(e=+e)?Wt:function(n,t){return t-n?function(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}(n,t,e):Gt(isNaN(n)?t:n)}}function Wt(e,n){var t=n-e;return t?function(e,n){return function(t){return e+t*n}}(e,t):Gt(isNaN(e)?n:e)}var qt=function e(n){var t=$t(n);function r(e,n){var r=t((e=zt(e)).r,(n=zt(n)).r),o=t(e.g,n.g),i=t(e.b,n.b),a=Wt(e.opacity,n.opacity);return function(n){return e.r=r(n),e.g=o(n),e.b=i(n),e.opacity=a(n),e+""}}return r.gamma=e,r}(1);function Kt(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}var Qt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Jt=new RegExp(Qt.source,"g");function er(e,n){var t,r,o,i=Qt.lastIndex=Jt.lastIndex=0,a=-1,u=[],c=[];for(e+="",n+="";(t=Qt.exec(e))&&(r=Jt.exec(n));)(o=r.index)>i&&(o=n.slice(i,o),u[a]?u[a]+=o:u[++a]=o),(t=t[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:Kt(t,r)})),i=Jt.lastIndex;return i<n.length&&(o=n.slice(i),u[a]?u[a]+=o:u[++a]=o),u.length<2?c[0]?function(e){return function(n){return e(n)+""}}(c[0].x):function(e){return function(){return e}}(n):(n=c.length,function(e){for(var t,r=0;r<n;++r)u[(t=c[r]).i]=t.x(e);return u.join("")})}var nr,tr=180/Math.PI,rr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function or(e,n,t,r,o,i){var a,u,c;return(a=Math.sqrt(e*e+n*n))&&(e/=a,n/=a),(c=e*t+n*r)&&(t-=e*c,r-=n*c),(u=Math.sqrt(t*t+r*r))&&(t/=u,r/=u,c/=u),e*r<n*t&&(e=-e,n=-n,c=-c,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(n,e)*tr,skewX:Math.atan(c)*tr,scaleX:a,scaleY:u}}function ir(e,n,t,r){function o(e){return e.length?e.pop()+" ":""}return function(i,a){var u=[],c=[];return i=e(i),a=e(a),function(e,r,o,i,a,u){if(e!==o||r!==i){var c=a.push("translate(",null,n,null,t);u.push({i:c-4,x:Kt(e,o)},{i:c-2,x:Kt(r,i)})}else(o||i)&&a.push("translate("+o+n+i+t)}(i.translateX,i.translateY,a.translateX,a.translateY,u,c),function(e,n,t,i){e!==n?(e-n>180?n+=360:n-e>180&&(e+=360),i.push({i:t.push(o(t)+"rotate(",null,r)-2,x:Kt(e,n)})):n&&t.push(o(t)+"rotate("+n+r)}(i.rotate,a.rotate,u,c),function(e,n,t,i){e!==n?i.push({i:t.push(o(t)+"skewX(",null,r)-2,x:Kt(e,n)}):n&&t.push(o(t)+"skewX("+n+r)}(i.skewX,a.skewX,u,c),function(e,n,t,r,i,a){if(e!==t||n!==r){var u=i.push(o(i)+"scale(",null,",",null,")");a.push({i:u-4,x:Kt(e,t)},{i:u-2,x:Kt(n,r)})}else 1===t&&1===r||i.push(o(i)+"scale("+t+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,u,c),i=a=null,function(e){for(var n,t=-1,r=c.length;++t<r;)u[(n=c[t]).i]=n.x(e);return u.join("")}}}var ar=ir((function(e){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?rr:or(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),ur=ir((function(e){return null==e?rr:(nr||(nr=document.createElementNS("http://www.w3.org/2000/svg","g")),nr.setAttribute("transform",e),(e=nr.transform.baseVal.consolidate())?or((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):rr)}),", ",")",")");function cr(e){return((e=Math.exp(e))+1/e)/2}var sr,lr,dr=function e(n,t,r){function o(e,o){var i,a,u=e[0],c=e[1],s=e[2],l=o[0],d=o[1],f=o[2],h=l-u,v=d-c,p=h*h+v*v;if(p<1e-12)a=Math.log(f/s)/n,i=function(e){return[u+e*h,c+e*v,s*Math.exp(n*e*a)]};else{var g=Math.sqrt(p),y=(f*f-s*s+r*p)/(2*s*t*g),m=(f*f-s*s-r*p)/(2*f*t*g),w=Math.log(Math.sqrt(y*y+1)-y),b=Math.log(Math.sqrt(m*m+1)-m);a=(b-w)/n,i=function(e){var r=e*a,o=cr(w),i=s/(t*g)*(o*function(e){return((e=Math.exp(2*e))-1)/(e+1)}(n*r+w)-function(e){return((e=Math.exp(e))-1/e)/2}(w));return[u+i*h,c+i*v,s*o/cr(n*r+w)]}}return i.duration=1e3*a*n/Math.SQRT2,i}return o.rho=function(n){var t=Math.max(.001,+n),r=t*t;return e(t,r,r*r)},o}(Math.SQRT2,2,4),fr=0,hr=0,vr=0,pr=1e3,gr=0,yr=0,mr=0,wr="object"==typeof performance&&performance.now?performance:Date,br="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function xr(){return yr||(br(_r),yr=wr.now()+mr)}function _r(){yr=0}function Er(){this._call=this._time=this._next=null}function Sr(e,n,t){var r=new Er;return r.restart(e,n,t),r}function kr(){yr=(gr=wr.now())+mr,fr=hr=0;try{!function(){xr(),++fr;for(var e,n=sr;n;)(e=yr-n._time)>=0&&n._call.call(void 0,e),n=n._next;--fr}()}finally{fr=0,function(){var e,n,t=sr,r=1/0;for(;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:sr=n);lr=e,Cr(r)}(),yr=0}}function Nr(){var e=wr.now(),n=e-gr;n>pr&&(mr-=n,gr=e)}function Cr(e){fr||(hr&&(hr=clearTimeout(hr)),e-yr>24?(e<1/0&&(hr=setTimeout(kr,e-wr.now()-mr)),vr&&(vr=clearInterval(vr))):(vr||(gr=wr.now(),vr=setInterval(Nr,pr)),fr=1,br(kr)))}function Pr(e,n,t){var r=new Er;return n=null==n?0:+n,r.restart((t=>{r.stop(),e(t+n)}),n,t),r}Er.prototype=Sr.prototype={constructor:Er,restart:function(e,n,t){if("function"!=typeof e)throw new TypeError("callback is not a function");t=(null==t?xr():+t)+(null==n?0:+n),this._next||lr===this||(lr?lr._next=this:sr=this,lr=this),this._call=e,this._time=t,Cr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Cr())}};var Mr=Be("start","end","cancel","interrupt"),Or=[],jr=0,Ir=1,Ar=2,zr=3,Tr=4,Br=5,Dr=6;function Lr(e,n,t,r,o,i){var a=e.__transition;if(a){if(t in a)return}else e.__transition={};!function(e,n,t){var r,o=e.__transition;function i(e){t.state=Ir,t.timer.restart(a,t.delay,t.time),t.delay<=e&&a(e-t.delay)}function a(i){var s,l,d,f;if(t.state!==Ir)return c();for(s in o)if((f=o[s]).name===t.name){if(f.state===zr)return Pr(a);f.state===Tr?(f.state=Dr,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[s]):+s<n&&(f.state=Dr,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[s])}if(Pr((function(){t.state===zr&&(t.state=Tr,t.timer.restart(u,t.delay,t.time),u(i))})),t.state=Ar,t.on.call("start",e,e.__data__,t.index,t.group),t.state===Ar){for(t.state=zr,r=new Array(d=t.tween.length),s=0,l=-1;s<d;++s)(f=t.tween[s].value.call(e,e.__data__,t.index,t.group))&&(r[++l]=f);r.length=l+1}}function u(n){for(var o=n<t.duration?t.ease.call(null,n/t.duration):(t.timer.restart(c),t.state=Br,1),i=-1,a=r.length;++i<a;)r[i].call(e,o);t.state===Br&&(t.on.call("end",e,e.__data__,t.index,t.group),c())}function c(){for(var r in t.state=Dr,t.timer.stop(),delete o[n],o)return;delete e.__transition}o[n]=t,t.timer=Sr(i,0,t.time)}(e,t,{name:n,index:r,group:o,on:Mr,tween:Or,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:jr})}function Rr(e,n){var t=Hr(e,n);if(t.state>jr)throw new Error("too late; already scheduled");return t}function Vr(e,n){var t=Hr(e,n);if(t.state>zr)throw new Error("too late; already running");return t}function Hr(e,n){var t=e.__transition;if(!t||!(t=t[n]))throw new Error("transition not found");return t}function Zr(e,n){var t,r,o,i=e.__transition,a=!0;if(i){for(o in n=null==n?null:n+"",i)(t=i[o]).name===n?(r=t.state>Ar&&t.state<Br,t.state=Dr,t.timer.stop(),t.on.call(r?"interrupt":"cancel",e,e.__data__,t.index,t.group),delete i[o]):a=!1;a&&delete e.__transition}}function Yr(e,n){var t,r;return function(){var o=Vr(this,e),i=o.tween;if(i!==t)for(var a=0,u=(r=t=i).length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}o.tween=r}}function Xr(e,n,t){var r,o;if("function"!=typeof t)throw new Error;return function(){var i=Vr(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:n,value:t},c=0,s=o.length;c<s;++c)if(o[c].name===n){o[c]=u;break}c===s&&o.push(u)}i.tween=o}}function Fr(e,n,t){var r=e._id;return e.each((function(){var e=Vr(this,r);(e.value||(e.value={}))[n]=t.apply(this,arguments)})),function(e){return Hr(e,r).value[n]}}function Ur(e,n){var t;return("number"==typeof n?Kt:n instanceof jt?qt:(t=jt(n))?(n=t,qt):er)(e,n)}function Gr(e){return function(){this.removeAttribute(e)}}function $r(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Wr(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=n(r=a,t)}}function qr(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=n(r=a,t)}}function Kr(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttribute(e))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttribute(e)}}function Qr(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttributeNS(e.space,e.local))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttributeNS(e.space,e.local)}}function Jr(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttributeNS(e.space,e.local,n.call(this,t))}}(e,o)),t}return o._value=n,o}function eo(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttribute(e,n.call(this,t))}}(e,o)),t}return o._value=n,o}function no(e,n){return function(){Rr(this,e).delay=+n.apply(this,arguments)}}function to(e,n){return n=+n,function(){Rr(this,e).delay=n}}function ro(e,n){return function(){Vr(this,e).duration=+n.apply(this,arguments)}}function oo(e,n){return n=+n,function(){Vr(this,e).duration=n}}var io=Qn.prototype.constructor;function ao(e){return function(){this.style.removeProperty(e)}}var uo=0;function co(e,n,t,r){this._groups=e,this._parents=n,this._name=t,this._id=r}function so(){return++uo}var lo=Qn.prototype;co.prototype={constructor:co,select:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=Ge(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,s=r[a],l=s.length,d=i[a]=new Array(l),f=0;f<l;++f)(u=s[f])&&(c=e.call(u,u.__data__,f,s))&&("__data__"in u&&(c.__data__=u.__data__),d[f]=c,Lr(d[f],n,t,f,d,Hr(u,t)));return new co(i,this._parents,n,t)},selectAll:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=We(e));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var c,s=r[u],l=s.length,d=0;d<l;++d)if(c=s[d]){for(var f,h=e.call(c,c.__data__,d,s),v=Hr(c,t),p=0,g=h.length;p<g;++p)(f=h[p])&&Lr(f,n,t,p,h,v);i.push(h),a.push(c)}return new co(i,a,n,t)},selectChild:lo.selectChild,selectChildren:lo.selectChildren,filter:function(e){"function"!=typeof e&&(e=Ke(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],s=0;s<u;++s)(i=a[s])&&e.call(i,i.__data__,s,a)&&c.push(i);return new co(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,t=e._groups,r=n.length,o=t.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var c,s=n[u],l=t[u],d=s.length,f=a[u]=new Array(d),h=0;h<d;++h)(c=s[h]||l[h])&&(f[h]=c);for(;u<r;++u)a[u]=n[u];return new co(a,this._parents,this._name,this._id)},selection:function(){return new io(this._groups,this._parents)},transition:function(){for(var e=this._name,n=this._id,t=so(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,s=0;s<c;++s)if(a=u[s]){var l=Hr(a,n);Lr(a,e,t,s,u,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new co(r,this._parents,e,t)},call:lo.call,nodes:lo.nodes,node:lo.node,size:lo.size,empty:lo.empty,each:lo.each,on:function(e,n){var t=this._id;return arguments.length<2?Hr(this.node(),t).on.on(e):this.each(function(e,n,t){var r,o,i=function(e){return(e+"").trim().split(/^|\s+/).every((function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||"start"===e}))}(n)?Rr:Vr;return function(){var a=i(this,e),u=a.on;u!==r&&(o=(r=u).copy()).on(n,t),a.on=o}}(t,e,n))},attr:function(e,n){var t=Ze(e),r="transform"===t?ur:Ur;return this.attrTween(e,"function"==typeof n?(t.local?Qr:Kr)(t,r,Fr(this,"attr."+e,n)):null==n?(t.local?$r:Gr)(t):(t.local?qr:Wr)(t,r,n))},attrTween:function(e,n){var t="attr."+e;if(arguments.length<2)return(t=this.tween(t))&&t._value;if(null==n)return this.tween(t,null);if("function"!=typeof n)throw new Error;var r=Ze(e);return this.tween(t,(r.local?Jr:eo)(r,n))},style:function(e,n,t){var r="transform"==(e+="")?ar:Ur;return null==n?this.styleTween(e,function(e,n){var t,r,o;return function(){var i=xn(this,e),a=(this.style.removeProperty(e),xn(this,e));return i===a?null:i===t&&a===r?o:o=n(t=i,r=a)}}(e,r)).on("end.style."+e,ao(e)):"function"==typeof n?this.styleTween(e,function(e,n,t){var r,o,i;return function(){var a=xn(this,e),u=t(this),c=u+"";return null==u&&(this.style.removeProperty(e),c=u=xn(this,e)),a===c?null:a===r&&c===o?i:(o=c,i=n(r=a,u))}}(e,r,Fr(this,"style."+e,n))).each(function(e,n){var t,r,o,i,a="style."+n,u="end."+a;return function(){var c=Vr(this,e),s=c.on,l=null==c.value[a]?i||(i=ao(n)):void 0;s===t&&o===l||(r=(t=s).copy()).on(u,o=l),c.on=r}}(this._id,e)):this.styleTween(e,function(e,n,t){var r,o,i=t+"";return function(){var a=xn(this,e);return a===i?null:a===r?o:o=n(r=a,t)}}(e,r,n),t).on("end.style."+e,null)},styleTween:function(e,n,t){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(e,n,t){var r,o;function i(){var i=n.apply(this,arguments);return i!==o&&(r=(o=i)&&function(e,n,t){return function(r){this.style.setProperty(e,n.call(this,r),t)}}(e,i,t)),r}return i._value=n,i}(e,n,null==t?"":t))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var n=e(this);this.textContent=null==n?"":n}}(Fr(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;return this.tween(n,function(e){var n,t;function r(){var r=e.apply(this,arguments);return r!==t&&(n=(t=r)&&function(e){return function(n){this.textContent=e.call(this,n)}}(r)),n}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var n=this.parentNode;for(var t in this.__transition)if(+t!==e)return;n&&n.removeChild(this)}}(this._id))},tween:function(e,n){var t=this._id;if(e+="",arguments.length<2){for(var r,o=Hr(this.node(),t).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===e)return r.value;return null}return this.each((null==n?Yr:Xr)(t,e,n))},delay:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?no:to)(n,e)):Hr(this.node(),n).delay},duration:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?ro:oo)(n,e)):Hr(this.node(),n).duration},ease:function(e){var n=this._id;return arguments.length?this.each(function(e,n){if("function"!=typeof n)throw new Error;return function(){Vr(this,e).ease=n}}(n,e)):Hr(this.node(),n).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,n){return function(){var t=n.apply(this,arguments);if("function"!=typeof t)throw new Error;Vr(this,e).ease=t}}(this._id,e))},end:function(){var e,n,t=this,r=t._id,o=t.size();return new Promise((function(i,a){var u={value:a},c={value:function(){0==--o&&i()}};t.each((function(){var t=Vr(this,r),o=t.on;o!==e&&((n=(e=o).copy())._.cancel.push(u),n._.interrupt.push(u),n._.end.push(c)),t.on=n})),0===o&&i()}))},[Symbol.iterator]:lo[Symbol.iterator]};var fo={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function ho(e,n){for(var t;!(t=e.__transition)||!(t=t[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return t}Qn.prototype.interrupt=function(e){return this.each((function(){Zr(this,e)}))},Qn.prototype.transition=function(e){var n,t;e instanceof co?(n=e._id,e=e._name):(n=so(),(t=fo).time=xr(),e=null==e?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,s=0;s<c;++s)(a=u[s])&&Lr(a,e,n,s,u,t||ho(a,n));return new co(r,this._parents,e,n)};var vo=e=>()=>e;function po(e,{sourceEvent:n,target:t,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function go(e,n,t){this.k=e,this.x=n,this.y=t}go.prototype={constructor:go,scale:function(e){return 1===e?this:new go(this.k*e,this.x,this.y)},translate:function(e,n){return 0===e&0===n?this:new go(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var yo=new go(1,0,0);function mo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return yo;return e.__zoom}function wo(e){e.stopImmediatePropagation()}function bo(e){e.preventDefault(),e.stopImmediatePropagation()}function xo(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function _o(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function Eo(){return this.__zoom||yo}function So(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ko(){return navigator.maxTouchPoints||"ontouchstart"in this}function No(e,n,t){var r=e.invertX(n[0][0])-t[0][0],o=e.invertX(n[1][0])-t[1][0],i=e.invertY(n[0][1])-t[0][1],a=e.invertY(n[1][1])-t[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}mo.prototype=go.prototype;var Co=function(e,n){return e.x!==n.x||e.y!==n.y||e.zoom!==n.k},Po=function(e){return{x:e.x,y:e.y,zoom:e.k}},Mo=function(e){var n=e.x,t=e.y,r=e.zoom;return yo.translate(n,t).scale(r)},Oo=function(e,n){return e.target.closest(".".concat(n))},jo=function(e,n){return 2===n&&Array.isArray(e)&&e.includes(2)},Io=function(e,n){return void 0===n&&(n=0),"number"==typeof n&&n>0?e.transition().duration(n):e},Ao=function(e){var n=e.ctrlKey&&de()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*n};function zo(e){var n=e.domNode,t=e.minZoom,r=e.maxZoom,o=e.translateExtent,i=e.viewport,a=e.onPanZoom,u=e.onPanZoomStart,c=e.onPanZoomEnd,s=e.onTransformChange,l=e.onDraggingChange,d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=n.getBoundingClientRect(),h=function(){var e,n,t,r=xo,o=_o,i=No,a=So,u=ko,c=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,d=dr,f=Be("start","zoom","end"),h=500,v=150,p=0,g=10;function y(e){e.property("__zoom",Eo).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",N).filter(u).on("touchstart.zoom",C).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,n){return(n=Math.max(c[0],Math.min(c[1],n)))===e.k?e:new go(n,e.x,e.y)}function w(e,n,t){var r=n[0]-t[0]*e.k,o=n[1]-t[1]*e.k;return r===e.x&&o===e.y?e:new go(e.k,r,o)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,t,r){e.on("start.zoom",(function(){_(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){_(this,arguments).event(r).end()})).tween("zoom",(function(){var e=this,i=arguments,a=_(e,i).event(r),u=o.apply(e,i),c=null==t?b(u):"function"==typeof t?t.apply(e,i):t,s=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),l=e.__zoom,f="function"==typeof n?n.apply(e,i):n,h=d(l.invert(c).concat(s/l.k),f.invert(c).concat(s/f.k));return function(e){if(1===e)e=f;else{var n=h(e),t=s/n[2];e=new go(t,c[0]-n[0]*t,c[1]-n[1]*t)}a.zoom(null,e)}}))}function _(e,n,t){return!t&&e.__zooming||new E(e,n)}function E(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=o.apply(e,n),this.taps=0}function S(e,...n){if(r.apply(this,arguments)){var t=_(this,n).event(e),o=this.__zoom,u=Math.max(c[0],Math.min(c[1],o.k*Math.pow(2,a.apply(this,arguments)))),l=et(e);if(t.wheel)t.mouse[0][0]===l[0]&&t.mouse[0][1]===l[1]||(t.mouse[1]=o.invert(t.mouse[0]=l)),clearTimeout(t.wheel);else{if(o.k===u)return;t.mouse=[l,o.invert(l)],Zr(this),t.start()}bo(e),t.wheel=setTimeout((function(){t.wheel=null,t.end()}),v),t.zoom("mouse",i(w(m(o,u),t.mouse[0],t.mouse[1]),t.extent,s))}}function k(e,...n){if(!t&&r.apply(this,arguments)){var o=e.currentTarget,a=_(this,n,!0).event(e),u=Jn(e.view).on("mousemove.zoom",(function(e){if(bo(e),!a.moved){var n=e.clientX-l,t=e.clientY-d;a.moved=n*n+t*t>p}a.event(e).zoom("mouse",i(w(a.that.__zoom,a.mouse[0]=et(e,o),a.mouse[1]),a.extent,s))}),!0).on("mouseup.zoom",(function(e){u.on("mousemove.zoom mouseup.zoom",null),at(e.view,a.moved),bo(e),a.event(e).end()}),!0),c=et(e,o),l=e.clientX,d=e.clientY;it(e.view),wo(e),a.mouse=[c,this.__zoom.invert(c)],Zr(this),a.start()}}function N(e,...n){if(r.apply(this,arguments)){var t=this.__zoom,a=et(e.changedTouches?e.changedTouches[0]:e,this),u=t.invert(a),c=t.k*(e.shiftKey?.5:2),d=i(w(m(t,c),a,u),o.apply(this,n),s);bo(e),l>0?Jn(this).transition().duration(l).call(x,d,a,e):Jn(this).call(y.transform,d,a,e)}}function C(t,...o){if(r.apply(this,arguments)){var i,a,u,c,s=t.touches,l=s.length,d=_(this,o,t.changedTouches.length===l).event(t);for(wo(t),a=0;a<l;++a)c=[c=et(u=s[a],this),this.__zoom.invert(c),u.identifier],d.touch0?d.touch1||d.touch0[2]===c[2]||(d.touch1=c,d.taps=0):(d.touch0=c,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(n=c[0],e=setTimeout((function(){e=null}),h)),Zr(this),d.start())}}function P(e,...n){if(this.__zooming){var t,r,o,a,u=_(this,n).event(e),c=e.changedTouches,l=c.length;for(bo(e),t=0;t<l;++t)o=et(r=c[t],this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=o:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=o);if(r=u.that.__zoom,u.touch1){var d=u.touch0[0],f=u.touch0[1],h=u.touch1[0],v=u.touch1[1],p=(p=h[0]-d[0])*p+(p=h[1]-d[1])*p,g=(g=v[0]-f[0])*g+(g=v[1]-f[1])*g;r=m(r,Math.sqrt(p/g)),o=[(d[0]+h[0])/2,(d[1]+h[1])/2],a=[(f[0]+v[0])/2,(f[1]+v[1])/2]}else{if(!u.touch0)return;o=u.touch0[0],a=u.touch0[1]}u.zoom("touch",i(w(r,o,a),u.extent,s))}}function M(e,...r){if(this.__zooming){var o,i,a=_(this,r).event(e),u=e.changedTouches,c=u.length;for(wo(e),t&&clearTimeout(t),t=setTimeout((function(){t=null}),h),o=0;o<c;++o)i=u[o],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=et(i,this),Math.hypot(n[0]-i[0],n[1]-i[1])<g)){var s=Jn(this).on("dblclick.zoom");s&&s.apply(this,arguments)}}}return y.transform=function(e,n,t,r){var o=e.selection?e.selection():e;o.property("__zoom",Eo),e!==o?x(e,n,t,r):o.interrupt().each((function(){_(this,arguments).event(r).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()}))},y.scaleBy=function(e,n,t,r){y.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)}),t,r)},y.scaleTo=function(e,n,t,r){y.transform(e,(function(){var e=o.apply(this,arguments),r=this.__zoom,a=null==t?b(e):"function"==typeof t?t.apply(this,arguments):t,u=r.invert(a),c="function"==typeof n?n.apply(this,arguments):n;return i(w(m(r,c),a,u),e,s)}),t,r)},y.translateBy=function(e,n,t,r){y.transform(e,(function(){return i(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof t?t.apply(this,arguments):t),o.apply(this,arguments),s)}),null,r)},y.translateTo=function(e,n,t,r,a){y.transform(e,(function(){var e=o.apply(this,arguments),a=this.__zoom,u=null==r?b(e):"function"==typeof r?r.apply(this,arguments):r;return i(yo.translate(u[0],u[1]).scale(a.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof t?-t.apply(this,arguments):-t),e,s)}),r,a)},E.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,n){return this.mouse&&"mouse"!==e&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var n=Jn(this.that).datum();f.call(e,this.that,new po(e,{sourceEvent:this.sourceEvent,target:y,type:e,transform:this.that.__zoom,dispatch:f}),n)}},y.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:vo(+e),y):a},y.filter=function(e){return arguments.length?(r="function"==typeof e?e:vo(!!e),y):r},y.touchable=function(e){return arguments.length?(u="function"==typeof e?e:vo(!!e),y):u},y.extent=function(e){return arguments.length?(o="function"==typeof e?e:vo([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),y):o},y.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],y):[c[0],c[1]]},y.translateExtent=function(e){return arguments.length?(s[0][0]=+e[0][0],s[1][0]=+e[1][0],s[0][1]=+e[0][1],s[1][1]=+e[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(e){return arguments.length?(i=e,y):i},y.duration=function(e){return arguments.length?(l=+e,y):l},y.interpolate=function(e){return arguments.length?(d=e,y):d},y.on=function(){var e=f.on.apply(f,arguments);return e===f?y:e},y.clickDistance=function(e){return arguments.length?(p=(e=+e)*e,y):Math.sqrt(p)},y.tapDistance=function(e){return arguments.length?(g=+e,y):g},y}().scaleExtent([t,r]).translateExtent(o),v=Jn(n).call(h);w({x:i.x,y:i.y,zoom:F(i.zoom,t,r)},[[0,0],[f.width,f.height]],o);var p=v.on("wheel.zoom"),g=v.on("dblclick.zoom");function y(e,n){v&&(null==h||h.transform(Io(v,null==n?void 0:n.duration),e))}function m(){h.on("zoom",null)}function w(e,n,t){var r=Mo(e),o=null==h?void 0:h.constrain()(r,n,t);return o&&y(o),o}return h.wheelDelta(Ao),{update:function(e){var n=e.noWheelClassName,t=e.noPanClassName,r=e.onPaneContextMenu,o=e.userSelectionActive,i=e.panOnScroll,f=e.panOnDrag,y=e.panOnScrollMode,w=e.panOnScrollSpeed,b=e.preventScrolling,x=e.zoomOnPinch,_=e.zoomOnScroll,E=e.zoomOnDoubleClick,S=e.zoomActivationKeyPressed,k=e.lib;o&&!d.isZoomingOrPanning&&m();var N=i&&!S&&!o?function(e){var n=e.zoomPanValues,t=e.noWheelClassName,r=e.d3Selection,o=e.d3Zoom,i=e.panOnScrollMode,a=e.panOnScrollSpeed,u=e.zoomOnPinch,c=e.onPanZoomStart,s=e.onPanZoom,l=e.onPanZoomEnd;return function(e){if(Oo(e,t))return!1;e.preventDefault(),e.stopImmediatePropagation();var d=r.property("__zoom").k||1;if(e.ctrlKey&&u){var f=et(e),h=Ao(e),v=d*Math.pow(2,h);o.scaleTo(r,v,f,e)}else{var p=1===e.deltaMode?20:1,g=i===Me.Vertical?0:e.deltaX*p,y=i===Me.Horizontal?0:e.deltaY*p;!de()&&e.shiftKey&&i!==Me.Vertical&&(g=e.deltaY*p,y=0),o.translateBy(r,-g/d*a,-y/d*a,{internal:!0});var m=Po(r.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling||(n.isPanScrolling=!0,null==c||c(e,m)),n.isPanScrolling&&(null==s||s(e,m),n.panScrollTimeout=setTimeout((function(){null==l||l(e,m),n.isPanScrolling=!1}),150))}}}({zoomPanValues:d,noWheelClassName:n,d3Selection:v,d3Zoom:h,panOnScrollMode:y,panOnScrollSpeed:w,zoomOnPinch:x,onPanZoomStart:u,onPanZoom:a,onPanZoomEnd:c}):function(e){var n=e.noWheelClassName,t=e.preventScrolling,r=e.d3ZoomHandler;return function(e,o){if(!t&&"wheel"===e.type&&!e.ctrlKey||Oo(e,n))return null;e.preventDefault(),r.call(this,e,o)}}({noWheelClassName:n,preventScrolling:b,d3ZoomHandler:p});if(v.on("wheel.zoom",N,{passive:!1}),!o){var C=function(e){var n=e.zoomPanValues,t=e.onDraggingChange,r=e.onPanZoomStart;return function(e){var o,i,a;if(!(null===(o=e.sourceEvent)||void 0===o?void 0:o.internal)){var u=Po(e.transform);n.mouseButton=(null===(i=e.sourceEvent)||void 0===i?void 0:i.button)||0,n.isZoomingOrPanning=!0,n.prevViewport=u,"mousedown"===(null===(a=e.sourceEvent)||void 0===a?void 0:a.type)&&t(!0),r&&(null==r||r(e.sourceEvent,u))}}}({zoomPanValues:d,onDraggingChange:l,onPanZoomStart:u});h.on("start",C);var P=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.onPaneContextMenu,o=e.onTransformChange,i=e.onPanZoom;return function(e){var a,u,c;n.usedRightMouseButton=!(!r||!jo(t,null!==(a=n.mouseButton)&&void 0!==a?a:0)),(null===(u=e.sourceEvent)||void 0===u?void 0:u.sync)||o([e.transform.x,e.transform.y,e.transform.k]),i&&!(null===(c=e.sourceEvent)||void 0===c?void 0:c.internal)&&(null==i||i(e.sourceEvent,Po(e.transform)))}}({zoomPanValues:d,panOnDrag:f,onPaneContextMenu:!!r,onPanZoom:a,onTransformChange:s});h.on("zoom",P);var M=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.panOnScroll,o=e.onDraggingChange,i=e.onPanZoomEnd,a=e.onPaneContextMenu;return function(e){var u,c;if(!(null===(u=e.sourceEvent)||void 0===u?void 0:u.internal)&&(n.isZoomingOrPanning=!1,a&&jo(t,null!==(c=n.mouseButton)&&void 0!==c?c:0)&&!n.usedRightMouseButton&&e.sourceEvent&&a(e.sourceEvent),n.usedRightMouseButton=!1,o(!1),i&&Co(n.prevViewport,e.transform))){var s=Po(e.transform);n.prevViewport=s,clearTimeout(n.timerId),n.timerId=setTimeout((function(){null==i||i(e.sourceEvent,s)}),r?150:0)}}}({zoomPanValues:d,panOnDrag:f,panOnScroll:i,onPaneContextMenu:r,onPanZoomEnd:c,onDraggingChange:l});h.on("end",M)}var O=function(e){var n=e.zoomActivationKeyPressed,t=e.zoomOnScroll,r=e.zoomOnPinch,o=e.panOnDrag,i=e.panOnScroll,a=e.zoomOnDoubleClick,u=e.userSelectionActive,c=e.noWheelClassName,s=e.noPanClassName,l=e.lib;return function(e){var d=n||t,f=r&&e.ctrlKey;if(1===e.button&&"mousedown"===e.type&&(Oo(e,"".concat(l,"-flow__node"))||Oo(e,"".concat(l,"-flow__edge"))))return!0;if(!(o||d||i||a||r))return!1;if(u)return!1;if(Oo(e,c)&&"wheel"===e.type)return!1;if(Oo(e,s)&&("wheel"!==e.type||i&&"wheel"===e.type&&!n))return!1;if(!r&&e.ctrlKey&&"wheel"===e.type)return!1;if(!d&&!i&&!f&&"wheel"===e.type)return!1;if(!o&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(o)&&!o.includes(e.button)&&"mousedown"===e.type)return!1;var h=Array.isArray(o)&&o.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||"wheel"===e.type)&&h}}({zoomActivationKeyPressed:S,panOnDrag:f,zoomOnScroll:_,panOnScroll:i,zoomOnDoubleClick:E,zoomOnPinch:x,userSelectionActive:o,noPanClassName:t,noWheelClassName:n,lib:k});h.filter(O),E?v.on("dblclick.zoom",g):v.on("dblclick.zoom",null)},destroy:m,setViewport:function(e,n){var t=Mo(e);return y(t,n),t},setViewportConstrained:w,getViewport:function(){var e=v?mo(v.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,n){v&&(null==h||h.scaleTo(Io(v,null==n?void 0:n.duration),e))},scaleBy:function(e,n){v&&(null==h||h.scaleBy(Io(v,null==n?void 0:n.duration),e))},setScaleExtent:function(e){null==h||h.scaleExtent(e)},setTranslateExtent:function(e){null==h||h.translateExtent(e)},syncViewport:function(e){if(v){var n=Mo(e),t=v.property("__zoom");t.k===e.zoom&&t.x===e.x&&t.y===e.y||null==h||h.transform(v,n,null,{sync:!0})}}}}var To=function(e){return{userSelectionActive:e.userSelectionActive,lib:e.lib}};function Bo(n){var t=n.onPaneContextMenu,r=n.zoomOnScroll,o=void 0===r||r,i=n.zoomOnPinch,a=void 0===i||i,u=n.panOnScroll,c=void 0!==u&&u,s=n.panOnScrollSpeed,l=void 0===s?.5:s,d=n.panOnScrollMode,f=void 0===d?Me.Free:d,v=n.zoomOnDoubleClick,p=void 0===v||v,g=n.panOnDrag,y=void 0===g||g,m=n.defaultViewport,w=n.translateExtent,b=n.minZoom,x=n.maxZoom,_=n.zoomActivationKeyCode,E=n.preventScrolling,S=void 0===E||E,k=n.children,N=n.noWheelClassName,C=n.noPanClassName,P=n.onViewportChange,M=n.isControlledViewport,O=L(),j=e.useRef(null),I=D(To,Ce),z=I.userSelectionActive,T=I.lib,B=Se(_),R=e.useRef();return function(n){var t=L();e.useEffect((function(){var e=function(){var e,r;if(!n.current)return!1;var o=ge(n.current);0!==o.height&&0!==o.width||null===(r=(e=t.getState()).onError)||void 0===r||r.call(e,"004",A.error004()),t.setState({width:o.width||500,height:o.height||500})};if(n.current){e(),window.addEventListener("resize",e);var r=new ResizeObserver((function(){return e()}));return r.observe(n.current),function(){window.removeEventListener("resize",e),r&&n.current&&r.unobserve(n.current)}}}),[])}(j),e.useEffect((function(){if(j.current){R.current=zo({domNode:j.current,minZoom:b,maxZoom:x,translateExtent:w,viewport:m,onTransformChange:function(e){null==P||P({x:e[0],y:e[1],zoom:e[2]}),M||O.setState({transform:e})},onDraggingChange:function(e){return O.setState({paneDragging:e})},onPanZoomStart:function(e,n){var t=O.getState(),r=t.onViewportChangeStart,o=t.onMoveStart;null==o||o(e,n),null==r||r(n)},onPanZoom:function(e,n){var t=O.getState(),r=t.onViewportChange,o=t.onMove;null==o||o(e,n),null==r||r(n)},onPanZoomEnd:function(e,n){var t=O.getState(),r=t.onViewportChangeEnd,o=t.onMoveEnd;null==o||o(e,n),null==r||r(n)}});var e=R.current.getViewport(),n=e.x,t=e.y,r=e.zoom;return O.setState({panZoom:R.current,transform:[n,t,r],domNode:j.current.closest(".ink-flow")}),function(){var e;null===(e=R.current)||void 0===e||e.destroy()}}}),[]),e.useEffect((function(){var e;null===(e=R.current)||void 0===e||e.update({onPaneContextMenu:t,zoomOnScroll:o,zoomOnPinch:a,panOnScroll:c,panOnScrollSpeed:l,panOnScrollMode:f,zoomOnDoubleClick:p,panOnDrag:y,zoomActivationKeyPressed:B,preventScrolling:S,noPanClassName:C,userSelectionActive:z,noWheelClassName:N,lib:T})}),[t,o,a,c,l,f,p,y,B,S,C,z,N,T]),h.jsx("div",{className:"ink-flow__renderer",ref:j,style:ze,children:k})}var Do={actInsideInputWithModifier:!1};function Lo(e,n){var t;switch(e.type){case"select":n.selected=e.selected;break;case"position":void 0!==e.position&&(n.position=e.position),void 0!==e.dragging&&(n.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(null!==(t=n.measured)&&void 0!==t||(n.measured={}),n.measured.width=e.dimensions.width,n.measured.height=e.dimensions.height,e.setAttributes&&(n.width=e.dimensions.width,n.height=e.dimensions.height)),"boolean"==typeof e.resizing&&(n.resizing=e.resizing)}}function Ro(e,t){var r,o,a,u,c,s,l=[],d=new Map;try{for(var f=i(e),h=f.next();!h.done;h=f.next()){if("add"!==(_=h.value).type)if("remove"===_.type||"replace"===_.type)d.set(_.id,[_]);else{var v=d.get(_.id);v?v.push(_):d.set(_.id,[_])}else l.push(_.item)}}catch(e){r={error:e}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}try{for(var p=i(t),g=p.next();!g.done;g=p.next()){var y=g.value,m=d.get(y.id);if(m){if("remove"!==m[0].type)if("replace"!==m[0].type){var w=n({},y);try{for(var b=(c=void 0,i(m)),x=b.next();!x.done;x=b.next()){var _;Lo(_=x.value,w)}}catch(e){c={error:e}}finally{try{x&&!x.done&&(s=b.return)&&s.call(b)}finally{if(c)throw c.error}}l.push(w)}else l.push(n({},m[0].item))}else l.push(y)}}catch(e){a={error:e}}finally{try{g&&!g.done&&(u=p.return)&&u.call(p)}finally{if(a)throw a.error}}return l}function Vo(e,n){return Ro(e,n)}function Ho(e,n){return Ro(e,n)}function Zo(e,n){return{id:e,type:"select",selected:n}}function Yo(e,n,t){var r,o;void 0===n&&(n=new Set),void 0===t&&(t=!1);var u=[];try{for(var c=i(e),s=c.next();!s.done;s=c.next()){var l=a(s.value,2),d=l[0],f=l[1],h=n.has(d);void 0===f.selected&&!h||f.selected===h||(t&&(f.selected=h),u.push(Zo(f.id,h)))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}return u}function Xo(e){var n,t,r,o,u,c,s=e.items,l=void 0===s?[]:s,d=e.lookup,f=[],h=new Map(l.map((function(e){return[e.id,e]})));try{for(var v=i(l),p=v.next();!p.done;p=v.next()){var g=p.value,y=d.get(g.id),m=null!==(c=null===(u=null==y?void 0:y.internals)||void 0===u?void 0:u.userNode)&&void 0!==c?c:y;void 0!==m&&m!==g&&f.push({id:g.id,item:g,type:"replace"}),void 0===m&&f.push({item:g,type:"add"})}}catch(e){n={error:e}}finally{try{p&&!p.done&&(t=v.return)&&t.call(v)}finally{if(n)throw n.error}}try{for(var w=i(d),b=w.next();!b.done;b=w.next()){var x=a(b.value,1)[0];void 0===h.get(x)&&f.push({id:x,type:"remove"})}}catch(e){r={error:e}}finally{try{b&&!b.done&&(o=w.return)&&o.call(w)}finally{if(r)throw r.error}}return f}function Fo(e){return{id:e.id,type:"remove"}}var Uo=function(e,n){void 0===n&&(n=[0,0]);var t=G(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},Go=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.size)return{x:0,y:0,width:0,height:0};var t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach((function(e){if(null==n.filter||n.filter(e)){var r=ne(e,n.nodeOrigin);t=Q(t,r)}})),ee(t)},$o=function(e,t,r,o,u,c){var s,l,d,f,h,v,p,g,y=a(void 0===r?[0,0,1]:r,3),m=y[0],w=y[1],b=y[2];void 0===o&&(o=!1),void 0===u&&(u=!1),void 0===c&&(c=[0,0]);var x=n(n({},q(t,[m,w,b])),{width:t.width/b,height:t.height/b}),_=[];try{for(var E=i(e),S=E.next();!S.done;S=E.next()){var k=a(S.value,2)[1],N=k.measured,C=k.selectable,P=void 0===C||C,M=k.hidden,O=void 0!==M&&M,j=null!==(h=null!==(f=null!==(d=N.width)&&void 0!==d?d:k.width)&&void 0!==f?f:k.initialWidth)&&void 0!==h?h:null,I=null!==(g=null!==(p=null!==(v=N.height)&&void 0!==v?v:k.height)&&void 0!==p?p:k.initialHeight)&&void 0!==g?g:null;if(!(u&&!P||O)){var A=oe(x,K(k,c));(null===j||null===I||o&&A>0||A>=(null!=j?j:0)*(null!=I?I:0)||k.dragging)&&_.push(k)}}}catch(e){s={error:e}}finally{try{S&&!S.done&&(l=E.return)&&l.call(E)}finally{if(s)throw s.error}}return _},Wo=function(e,n){var t=new Set;return e.forEach((function(e){t.add(e.id)})),n.filter((function(e){return t.has(e.source)||t.has(e.target)}))};function qo(e,n){var t,r,o,i=e.nodeLookup,a=e.width,u=e.height,c=e.panZoom,s=e.minZoom,l=e.maxZoom,d=e.nodeOrigin,f=void 0===d?[0,0]:d,h=[],v=(null==n?void 0:n.nodes)?new Set(n.nodes.map((function(e){return e.id}))):null;if(i.forEach((function(e){!(e.measured.width&&e.measured.height&&((null==n?void 0:n.includeHiddenNodes)||!e.hidden))||v&&!v.has(e.id)||h.push(e)})),h.length>0){var p=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.length)return{x:0,y:0,width:0,height:0};var t=e.reduce((function(e,t){var r=ne(t,n.nodeOrigin);return Q(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ee(t)}(h,{nodeOrigin:f}),g=ie(p,a,u,null!==(t=null==n?void 0:n.minZoom)&&void 0!==t?t:s,null!==(r=null==n?void 0:n.maxZoom)&&void 0!==r?r:l,null!==(o=null==n?void 0:n.padding)&&void 0!==o?o:.1);return c.setViewport(g,{duration:null==n?void 0:n.duration}),!0}return!1}function Ko(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),s=c.parentId?r.get(c.parentId):void 0,l=s?Uo(s,s.origin||i).positionAbsolute:{x:0,y:0},d=l.x,f=l.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)s&&ae(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(s){var v=c.measured.width,p=c.measured.height,g=s.measured.width,y=s.measured.height;if(v&&p&&g&&y){var m=c.origin||i,w=d+v*m[0],b=f+p*m[1];h=[[w,b],[w+g-v,b+y-p]]}}else null==u||u("005",A.error005());var x=ae(h)?U(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}function Qo(e){return r(this,arguments,void 0,(function(e){var n,t,r,a,u,c,s,l,d,f,h,v,p,g,y,m,w,b,x,_=e.nodesToRemove,E=void 0===_?[]:_,S=e.edgesToRemove,k=void 0===S?[]:S,N=e.nodes,C=e.edges,P=e.onBeforeDelete;return o(this,(function(e){switch(e.label){case 0:n=new Set(E.map((function(e){return e.id}))),t=[],r=function(e){if(!1===e.deletable)return"continue";var r=n.has(e.id),o=!r&&e.parentId&&t.find((function(n){return n.id===e.parentId}));(r||o)&&t.push(e)};try{for(a=i(N),u=a.next();!u.done;u=a.next())c=u.value,r(c)}catch(e){m={error:e}}finally{try{u&&!u.done&&(w=a.return)&&w.call(a)}finally{if(m)throw m.error}}s=new Set(k.map((function(e){return e.id}))),l=C.filter((function(e){return!1!==e.deletable})),d=Wo(t,l),f=d,h=function(e){s.has(e.id)&&!f.find((function(n){return n.id===e.id}))&&f.push(e)};try{for(v=i(l),p=v.next();!p.done;p=v.next())g=p.value,h(g)}catch(e){b={error:e}}finally{try{p&&!p.done&&(x=v.return)&&x.call(v)}finally{if(b)throw b.error}}return P?[4,P({nodes:t,edges:f})]:[2,{edges:f,nodes:t}];case 1:return"boolean"==typeof(y=e.sent())?[2,y?{edges:f,nodes:t}:{edges:[],nodes:[]}]:[2,y]}}))}))}var Jo=function(e){return{userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect}};function ei(){var e=D(Jo,Ce),n=e.userSelectionActive,t=e.userSelectionRect;return n&&t?h.jsx("div",{className:"ink-flow__selection ink-flow__container",style:{width:t.width,height:t.height,transform:"translate(".concat(t.x,"px, ").concat(t.y,"px)")}}):null}var ni=function(e,n){return function(t){t.target===n.current&&(null==e||e(t))}},ti=function(e){return{userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}};function ri(n){var t=n.isSelecting;n.selectionMode;var r=n.panOnDrag,o=n.onSelectionStart,u=n.onSelectionEnd,c=n.onPaneClick,s=n.onPaneContextMenu,l=n.onPaneScroll,d=n.onPaneMouseEnter,f=n.onPaneMouseMove,v=n.onPaneMouseLeave,p=n.children,g=e.useRef(null),y=L(),w=e.useRef(0),b=e.useRef(0),x=e.useRef(),_=e.useRef(new Map),E=D(ti,Ce),S=E.userSelectionActive,k=E.elementsSelectable,N=E.dragging,C=function(){y.setState({userSelectionActive:!1,userSelectionRect:null}),w.current=0,b.current=0},P=function(e){null==c||c(e),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},M=l?function(e){return l(e)}:void 0,O=k&&(t||S);return h.jsxs("div",{className:m(["ink-flow__pane",{draggable:r,dragging:N,selection:t}]),onClick:O?void 0:ni(P,g),onContextMenu:ni((function(e){Array.isArray(r)&&(null==r?void 0:r.includes(2))?e.preventDefault():null==s||s(e)}),g),onWheel:ni(M,g),onMouseEnter:O?void 0:d,onMouseDown:O?function(e){var n,r,u,c,s=y.getState(),l=s.resetSelectedElements,d=s.domNode,f=s.edgeLookup;if(x.current=null==d?void 0:d.getBoundingClientRect(),k&&t&&0===e.button&&e.target===g.current&&x.current){_.current=new Map;try{for(var h=i(f),v=h.next();!v.done;v=h.next()){var p=a(v.value,2),m=p[0],w=p[1];_.current.set(w.source,(null===(u=_.current.get(w.source))||void 0===u?void 0:u.add(m))||new Set([m])),_.current.set(w.target,(null===(c=_.current.get(w.target))||void 0===c?void 0:c.add(m))||new Set([m]))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}var b=xe(e.nativeEvent,x.current),E=b.x,S=b.y;l(),y.setState({userSelectionRect:{width:0,height:0,startX:E,startY:S,x:E,y:S}}),null==o||o(e)}}:void 0,onMouseMove:O?function(e){var n,r,o,a,u=y.getState(),c=u.userSelectionRect,s=u.edgeLookup,l=u.transform,d=u.nodeOrigin,f=u.nodeLookup,h=u.triggerNodeChanges,v=u.triggerEdgeChanges;if(t&&x.current&&c){var p=xe(e.nativeEvent,x.current),g=p.x,m=p.y,E=c.startX,S=c.startY,k={startX:E,startY:S,x:g<E?g:E,y:m<S?m:S,width:Math.abs(g-E),height:Math.abs(m-S)},N=$o(f,k,l,!1,!0,d),C=new Set,P=new Set;try{for(var M=i(N),O=M.next();!O.done;O=M.next()){var j=O.value;P.add(j.id);var I=_.current.get(j.id);if(I)try{for(var A=(o=void 0,i(I)),z=A.next();!z.done;z=A.next()){var T=z.value;C.add(T)}}catch(e){o={error:e}}finally{try{z&&!z.done&&(a=A.return)&&a.call(A)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{O&&!O.done&&(r=M.return)&&r.call(M)}finally{if(n)throw n.error}}if(w.current!==P.size)w.current=P.size,h(Yo(f,P,!0));if(b.current!==C.size)b.current=C.size,v(Yo(s,C));y.setState({userSelectionRect:k,userSelectionActive:!0,nodesSelectionActive:!1})}}:f,onMouseUp:O?function(e){if(0===e.button){var n=y.getState().userSelectionRect;!S&&n&&e.target===g.current&&(null==P||P(e)),y.setState({nodesSelectionActive:w.current>0}),C(),null==u||u(e)}}:void 0,onMouseLeave:O?function(e){S&&(y.setState({nodesSelectionActive:w.current>0}),null==u||u(e)),C()}:v,ref:g,style:ze,children:[p,h.jsx(ei,{})]})}var oi=function(e){return{nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive}};function ii(n){var t=n.children,r=n.onPaneClick,o=n.onPaneMouseEnter,i=n.onPaneMouseMove,a=n.onPaneMouseLeave,u=n.onPaneContextMenu,c=n.onPaneScroll,s=n.deleteKeyCode,l=n.selectionKeyCode,d=n.selectionOnDrag,f=n.selectionMode,v=n.onSelectionStart,p=n.onSelectionEnd,g=n.multiSelectionKeyCode,y=n.panActivationKeyCode,m=n.zoomActivationKeyCode,w=n.elementsSelectable,b=n.zoomOnScroll,x=n.zoomOnPinch,_=n.panOnScroll,E=n.panOnScrollSpeed,S=n.panOnScrollMode,k=n.zoomOnDoubleClick,N=n.panOnDrag,C=n.defaultViewport,P=n.translateExtent,M=n.minZoom,O=n.maxZoom,j=n.preventScrolling;n.onSelectionContextMenu;var I=n.noWheelClassName,A=n.noPanClassName;n.disableKeyboardA11y;var z=n.onViewportChange,T=n.isControlledViewport,B=D(oi);B.nodesSelectionActive;var R=B.userSelectionActive,V=Se(l),H=Se(y),Z=H||N,Y=H||_,X=V||R||d&&!0!==Z;return function(n){var t=n.deleteKeyCode,r=n.multiSelectionKeyCode,o=L(),i=Se(t,Do),a=Se(r);e.useEffect((function(){if(i){var e=o.getState();e.edges,e.nodes,o.setState({nodesSelectionActive:!1})}}),[i]),e.useEffect((function(){o.setState({multiSelectionActive:a})}),[a])}({deleteKeyCode:s,multiSelectionKeyCode:g}),h.jsx(Bo,{onPaneContextMenu:u,elementsSelectable:w,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:Y,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!V&&Z,defaultViewport:C,translateExtent:P,minZoom:M,maxZoom:O,zoomActivationKeyCode:m,preventScrolling:j,noWheelClassName:I,noPanClassName:A,onViewportChange:z,isControlledViewport:T,children:h.jsx(ri,{onSelectionStart:v,onSelectionEnd:p,onPaneClick:r,onPaneMouseEnter:o,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:u,onPaneScroll:c,panOnDrag:Z,isSelecting:!!X,selectionMode:f,children:t})})}ii.displayName="FlowRenderer";var ai=e.memo(ii);var ui="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function ci(n){var t=a(e.useState(!1),2),r=t[0],o=t[1],i=a(e.useState((function(){return function(e){var n=[];return{get:function(){return n},reset:function(){n=[]},push:function(t){n.push(t),e()}}}((function(){return o(!0)}))})),1),u=i[0];return ui((function(){if(r){var e=u.get();e.length&&(n(e),u.reset()),o(!1)}else u.reset()}),[r]),u}var si=e.createContext(null);function li(n){var t=n.children,r=L(),o=e.useCallback((function(e){var n,t,o=r.getState(),a=o.nodes,u=void 0===a?[]:a,c=o.setNodes,s=o.hasDefaultNodes,l=o.onNodesChange,d=o.nodeLookup,f=u;try{for(var h=i(e),v=h.next();!v.done;v=h.next()){var p=v.value;f="function"==typeof p?p(f):p}}catch(e){n={error:e}}finally{try{v&&!v.done&&(t=h.return)&&t.call(h)}finally{if(n)throw n.error}}s?c(f):l&&l(Xo({items:f,lookup:d}))}),[]),a=ci(o),u=e.useCallback((function(e){var n,t,o=r.getState(),a=o.edges,u=void 0===a?[]:a,c=o.setEdges,s=o.hasDefaultEdges,l=o.onEdgesChange,d=o.edgeLookup,f=u;try{for(var h=i(e),v=h.next();!v.done;v=h.next()){var p=v.value;f="function"==typeof p?p(f):p}}catch(e){n={error:e}}finally{try{v&&!v.done&&(t=h.return)&&t.call(h)}finally{if(n)throw n.error}}s?c(f):l&&l(Xo({items:f,lookup:d}))}),[]),c=ci(u),s=e.useMemo((function(){return{nodeQueue:a,edgeQueue:c}}),[]);return h.jsx(si.Provider,{value:s,children:t})}var di=function(){var n=L();return e.useMemo((function(){return{zoomIn:function(e){var t;return null===(t=n.getState().panZoom)||void 0===t?void 0:t.scaleBy(1.2,{duration:null==e?void 0:e.duration})},zoomOut:function(e){var t;return null===(t=n.getState().panZoom)||void 0===t?void 0:t.scaleBy(1/1.2,{duration:null==e?void 0:e.duration})},zoomTo:function(e,t){var r;return null===(r=n.getState().panZoom)||void 0===r?void 0:r.scaleTo(e,{duration:null==t?void 0:t.duration})},getZoom:function(){return n.getState().transform[2]},setViewport:function(e,t){var r,o,i,u=n.getState(),c=a(u.transform,3),s=c[0],l=c[1],d=c[2],f=u.panZoom;null==f||f.setViewport({x:null!==(r=e.x)&&void 0!==r?r:s,y:null!==(o=e.y)&&void 0!==o?o:l,zoom:null!==(i=e.zoom)&&void 0!==i?i:d},{duration:null==t?void 0:t.duration})},getViewport:function(){var e=a(n.getState().transform,3);return{x:e[0],y:e[1],zoom:e[2]}},fitView:function(e){var t=n.getState(),r=t.nodeLookup,o=t.width,i=t.height,a=t.nodeOrigin,u=t.minZoom,c=t.maxZoom,s=t.panZoom;return!!s&&qo({nodeLookup:r,width:o,height:i,nodeOrigin:a,minZoom:u,maxZoom:c,panZoom:s},e)},setCenter:function(e,t,r){var o=n.getState(),i=o.width,a=o.height,u=o.maxZoom,c=o.panZoom,s=void 0!==(null==r?void 0:r.zoom)?r.zoom:u,l=i/2-e*s,d=a/2-t*s;null==c||c.setViewport({x:l,y:d,zoom:s},{duration:null==r?void 0:r.duration})},fitBounds:function(e,t){var r,o=n.getState(),i=o.width,a=o.height,u=o.minZoom,c=o.maxZoom,s=o.panZoom,l=ie(e,i,a,u,c,null!==(r=null==t?void 0:t.padding)&&void 0!==r?r:.1);null==s||s.setViewport(l,{duration:null==t?void 0:t.duration})},screenToFlowPosition:function(e,t){void 0===t&&(t={snapToGrid:!0});var r=n.getState(),o=r.transform,i=r.snapGrid,a=r.domNode;if(!a)return e;var u=a.getBoundingClientRect(),c=u.x,s=u.y,l={x:e.x-c,y:e.y-s};return q(l,o,t.snapToGrid,i)},flowToScreenPosition:function(e){var t=n.getState(),r=t.transform,o=t.domNode;if(!o)return e;var i=o.getBoundingClientRect(),a=i.x,u=i.y,c=le(e,r);return{x:c.x+a,y:c.y+u}}}}),[])},fi=function(e){return!!e.panZoom};function hi(){var t=this,i=di(),c=L(),s=function(){var n=e.useContext(si);if(!n)throw new Error("useBatchContext must be used within a BatchProvider");return n}(),l=D(fi),d=e.useMemo((function(){var e=function(e){return c.getState().nodeLookup.get(e)},i=function(e){s.nodeQueue.push(e)},l=function(e){var t,r,o,i,a=c.getState(),u=a.nodeLookup,s=a.nodeOrigin,l=fe(e)?e:u.get(e.id),d=l.parentId?function(e,t,r,o){var i,a;void 0===o&&(o=[0,0]);for(var u=t,c=n({},e);u;){var s=r.get(t);if(u=null==s?void 0:s.parentId,s){var l=s.origin||o,d=(null!==(i=s.measured.width)&&void 0!==i?i:0)*l[0],f=(null!==(a=s.measured.height)&&void 0!==a?a:0)*l[1];c.x+=s.position.x-d,c.y+=s.position.y-f}}return c}(l.position,l.parentId,u,s):l.position,f={id:l.id,position:d,width:null!==(r=null===(t=l.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:l.width,height:null!==(i=null===(o=l.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:l.height,data:l.data};return K(f)},d=function(e,t,r){void 0===r&&(r={replace:!1}),i((function(o){return o.map((function(o){if(o.id===e){var i="function"==typeof t?t(o):t;return r.replace&&fe(i)?i:n(n({},o),i)}return o}))}))};return{getNodes:function(){return c.getState().nodes.map((function(e){return n({},e)}))},getNode:function(n){var t;return null===(t=e(n))||void 0===t?void 0:t.internals.userNode},getInternalNode:e,getEdges:function(){var e=c.getState().edges;return(void 0===e?[]:e).map((function(e){return n({},e)}))},getEdge:function(e){return c.getState().edgeLookup.get(e)},setNodes:i,setEdges:function(e){s.edgeQueue.push(e)},addNodes:function(e){var n=Array.isArray(e)?e:[e];s.nodeQueue.push((function(e){return u(u([],a(e),!1),a(n),!1)}))},addEdges:function(e){var n=Array.isArray(e)?e:[e];s.edgeQueue.push((function(e){return u(u([],a(e),!1),a(n),!1)}))},toObject:function(){var e=c.getState(),t=e.nodes,r=void 0===t?[]:t,o=e.edges,i=void 0===o?[]:o,u=a(e.transform,3),s=u[0],l=u[1],d=u[2];return{nodes:r.map((function(e){return n({},e)})),edges:i.map((function(e){return n({},e)})),viewport:{x:s,y:l,zoom:d}}},deleteElements:function(e){return r(t,[e],void 0,(function(e){var n,t,r,i,a,u,s,l,d,f,h,v,p,g,y,m,w=e.nodes,b=void 0===w?[]:w,x=e.edges,_=void 0===x?[]:x;return o(this,(function(e){switch(e.label){case 0:return n=c.getState(),t=n.nodes,r=n.edges,i=n.onNodesDelete,a=n.onEdgesDelete,u=n.triggerNodeChanges,s=n.triggerEdgeChanges,l=n.onDelete,d=n.onBeforeDelete,[4,Qo({nodesToRemove:b,edgesToRemove:_,nodes:t,edges:r,onBeforeDelete:d})];case 1:return f=e.sent(),h=f.nodes,v=f.edges,p=v.length>0,g=h.length>0,p&&(y=v.map(Fo),null==a||a(v),s(y)),g&&(m=h.map(Fo),null==i||i(h),u(m)),(g||p)&&(null==l||l({nodes:h,edges:v})),[2,{deletedNodes:h,deletedEdges:v}]}}))}))},getIntersectingNodes:function(e,n,t){void 0===n&&(n=!0);var r=ve(e),o=r?e:l(e),i=void 0!==t;return o?(t||c.getState().nodes).filter((function(t){var a=c.getState().nodeLookup.get(t.id);if(a&&!r&&(t.id===e.id||!a.internals.positionAbsolute))return!1;var u=K(i?t:a),s=oe(u,o);return n&&s>0||s>=o.width*o.height})):[]},isNodeIntersecting:function(e,n,t){void 0===t&&(t=!0);var r=ve(e)?e:l(e);if(!r)return!1;var o=oe(r,n);return t&&o>0||o>=r.width*r.height},updateNode:d,updateNodeData:function(e,t,r){void 0===r&&(r={replace:!1}),d(e,(function(e){var o="function"==typeof t?t(e):t;return r.replace?n(n({},e),{data:o}):n(n({},e),{data:n(n({},e.data),o)})}),r)}}}),[]);return e.useMemo((function(){return n(n(n({},d),i),{viewportInitialized:l})}),[l])}var vi=function(e){return e.updateNodeInternals};var pi=function(e){return function(n){return e?$o(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map((function(e){return e.id})):Array.from(n.nodeLookup.keys())}};var gi=e.createContext(null),yi=gi.Provider;gi.Consumer;var mi="ink-flow__node-desc",wi="ink-flow__edge-desc";function bi(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=e.sourceControlX,a=e.sourceControlY,u=.125*n+.375*i+.375*e.targetControlX+.125*r,c=.125*t+.375*a+.375*e.targetControlY+.125*o;return[u,c,Math.abs(u-n),Math.abs(c-t)]}function xi(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function _i(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case exports.Position.Left:return[t-xi(t-o,a),r];case exports.Position.Right:return[t+xi(o-t,a),r];case exports.Position.Top:return[t,r-xi(r-i,a)];case exports.Position.Bottom:return[t,r+xi(i-r,a)]}}function Ei(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Math.abs(r-n)/2,a=r<n?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}var Si,ki=function(e){var n=e.source,t=e.sourceHandle,r=e.target,o=e.targetHandle;return"xy-edge__".concat(n).concat(t||"","-").concat(r).concat(o||"")};var Ni=((Si={})[exports.Position.Left]={x:-1,y:0},Si[exports.Position.Right]={x:1,y:0},Si[exports.Position.Top]={x:0,y:-1},Si[exports.Position.Bottom]={x:0,y:1},Si),Ci=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?exports.Position.Bottom:t,o=e.target;return r===exports.Position.Left||r===exports.Position.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}},Pi=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function Mi(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,c=e.targetY,s=e.targetPosition,l=void 0===s?exports.Position.Top:s,d=e.borderRadius,f=void 0===d?5:d,h=e.centerX,v=e.centerY,p=e.offset,g=a(function(e){var n,t,r,o,i=e.source,c=e.sourcePosition,s=void 0===c?exports.Position.Bottom:c,l=e.target,d=e.targetPosition,f=void 0===d?exports.Position.Top:d,h=e.center,v=e.offset,p=Ni[s],g=Ni[f],y={x:i.x+p.x*v,y:i.y+p.y*v},m={x:l.x+g.x*v,y:l.y+g.y*v},w=Ci({source:y,sourcePosition:s,target:m}),b=0!==w.x?"x":"y",x=w[b],_=[],E={x:0,y:0},S={x:0,y:0},k=a(Ei({sourceX:i.x,sourceY:i.y,targetX:l.x,targetY:l.y}),4),N=k[0],C=k[1],P=k[2],M=k[3];if(p[b]*g[b]==-1){r=null!==(n=h.x)&&void 0!==n?n:N,o=null!==(t=h.y)&&void 0!==t?t:C;var O=[{x:r,y:y.y},{x:r,y:m.y}],j=[{x:y.x,y:o},{x:m.x,y:o}];_=p[b]===x?"x"===b?O:j:"x"===b?j:O}else{var I=[{x:y.x,y:m.y}],A=[{x:m.x,y:y.y}];if(_="x"===b?p.x===x?A:I:p.y===x?I:A,s===f){var z=Math.abs(i[b]-l[b]);if(z<=v){var T=Math.min(v-1,v-z);p[b]===x?E[b]=(y[b]>i[b]?-1:1)*T:S[b]=(m[b]>l[b]?-1:1)*T}}if(s!==f){var B="x"===b?"y":"x",D=p[b]===g[B],L=y[B]>m[B],R=y[B]<m[B];(1===p[b]&&(!D&&L||D&&R)||1!==p[b]&&(!D&&R||D&&L))&&(_="x"===b?I:A)}var V={x:y.x+E.x,y:y.y+E.y},H={x:m.x+S.x,y:m.y+S.y};Math.max(Math.abs(V.x-_[0].x),Math.abs(H.x-_[0].x))>=Math.max(Math.abs(V.y-_[0].y),Math.abs(H.y-_[0].y))?(r=(V.x+H.x)/2,o=_[0].y):(r=_[0].x,o=(V.y+H.y)/2)}return[u(u([i,{x:y.x+E.x,y:y.y+E.y}],a(_),!1),[{x:m.x+S.x,y:m.y+S.y},l],!1),r,o,P,M]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:c},targetPosition:l,center:{x:h,y:v},offset:void 0===p?20:p}),5),y=g[0],m=g[1],w=g[2],b=g[3],x=g[4],_=y.reduce((function(e,n,t){var r="";return r=t>0&&t<y.length-1?function(e,n,t,r){var o=Math.min(Pi(e,n)/2,Pi(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var s=e.x<t.x?1:-1,l=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*l,"Q ").concat(i,",").concat(a," ").concat(i+o*s,",").concat(a)}(y[t-1],n,y[t+1],f):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+=r}),"");return[_,m,w,b,x]}function Oi(e,n,t,r){return(n[t]||[]).reduce((function(n,o){return"".concat(e.id,"-").concat(o.id,"-").concat(t)!==r&&n.push({id:o.id||null,type:t,nodeId:e.id,x:e.internals.positionAbsolute.x+o.x+o.width/2,y:e.internals.positionAbsolute.y+o.y+o.height/2}),n}),[])}function ji(e,n){return e||((null==n?void 0:n.classList.contains("target"))?"target":(null==n?void 0:n.classList.contains("source"))?"source":null)}var Ii=function(){return!0},Ai=null;function zi(e,n){var t=n.handle,r=n.connectionMode,o=n.fromNodeId,i=n.fromHandleId,a=n.fromType,u=n.doc,c=n.lib,s=n.flowId,l=n.isValidConnection,d=void 0===l?Ii:l,f="target"===a,h=t?u.querySelector(".".concat(c,'-flow__handle[data-id="').concat(s,"-").concat(null==t?void 0:t.nodeId,"-").concat(null==t?void 0:t.id,"-").concat(null==t?void 0:t.type,'"]')):null,v=xe(e),p=v.x,g=v.y,y=u.elementFromPoint(p,g),m=(null==y?void 0:y.classList.contains("".concat(c,"-flow__handle")))?y:h,w={handleDomNode:m,isValid:!1,connection:null,endHandle:null};if(m){var b=ji(void 0,m),x=m.getAttribute("data-nodeid"),_=m.getAttribute("data-handleid"),E=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!x)return w;var k={source:f?x:o,sourceHandle:f?_:i,target:f?o:x,targetHandle:f?i:_};w.connection=k,E&&S&&(r===Pe.Strict?f&&"source"===b||!f&&"target"===b:x!==o||_!==i)&&(w.endHandle={nodeId:x,handleId:_,type:b},w.isValid=d(k))}return w}var Ti={onPointerDown:function(e,n){var t,r=n.connectionMode,o=n.connectionRadius,c=n.handleId,s=n.nodeId,l=n.edgeUpdaterType,d=n.isTarget,f=n.domNode,h=n.nodeLookup,v=n.lib,p=n.autoPanOnConnect,g=n.flowId,y=n.panBy,m=n.cancelConnection,w=n.onConnectStart,b=n.onConnect,x=n.onConnectEnd,_=n.isValidConnection,E=void 0===_?Ii:_,S=n.onEdgeUpdateEnd,k=n.updateConnection,N=n.getTransform,C=n.getConnectionStartHandle,P=ye(e.target),M=0,O=xe(e),j=O.x,I=O.y,A=null==P?void 0:P.elementFromPoint(j,I),z=ji(l,A),T=null==f?void 0:f.getBoundingClientRect();if(T&&z){var B=xe(e,T),D=!1,L=null,R=!1,V=null,H=function(e){var n,t,r=e.nodeLookup,o=e.nodeId,c=e.handleId,s=e.handleType,l=[];try{for(var d=i(r),f=d.next();!f.done;f=d.next()){var h=a(f.value,2)[1];if(h.internals.handleBounds){var v="".concat(o,"-").concat(c,"-").concat(s),p=Oi(h,h.internals.handleBounds,"source",v),g=Oi(h,h.internals.handleBounds,"target",v);l.push.apply(l,u(u([],a(p),!1),a(g),!1))}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(t=d.return)&&t.call(d)}finally{if(n)throw n.error}}return l}({nodeLookup:h,nodeId:s,handleId:c,handleType:z});k({connectionPosition:B,connectionStatus:null,connectionStartHandle:Ai={nodeId:s,handleId:c,type:z},connectionEndHandle:null}),null==w||w(e,{nodeId:s,handleId:c,handleType:z}),P.addEventListener("mousemove",Y),P.addEventListener("mouseup",X),P.addEventListener("touchmove",Y),P.addEventListener("touchend",X)}function Z(){if(p&&T){var e=a(ce(B,T),2),n=e[0],t=e[1];y({x:n,y:t}),M=requestAnimationFrame(Z)}}function Y(e){C()||X(e);var n=N();B=xe(e,T),t=function(e,n,t){var r,o,a=[],u=1/0;try{for(var c=i(t),s=c.next();!s.done;s=c.next()){var l=s.value,d=Math.sqrt(Math.pow(l.x-e.x,2)+Math.pow(l.y-e.y,2));d<=n&&(d<u?a=[l]:d===u&&a.push(l),u=d)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}return a.length?1===a.length?a[0]:a.find((function(e){return"target"===e.type}))||a[0]:null}(q(B,n,!1,[1,1]),o,H),D||(Z(),D=!0);var a,u,l,f=zi(e,{handle:t,connectionMode:r,fromNodeId:s,fromHandleId:c,fromType:d?"target":"source",isValidConnection:E,doc:P,lib:v,flowId:g});V=f.handleDomNode,L=f.connection,R=f.isValid,k({connectionStartHandle:Ai,connectionPosition:t&&R?le({x:t.x,y:t.y},n):B,connectionStatus:(a=!!t,u=R,l=null,u?l="valid":a&&!u&&(l="invalid"),l),connectionEndHandle:f.endHandle})}function X(e){(t||V)&&L&&R&&(null==b||b(L)),null==x||x(e),l&&(null==S||S(e)),m(),cancelAnimationFrame(M),D=!1,R=!1,L=null,V=null,Ai=null,P.removeEventListener("mousemove",Y),P.removeEventListener("mouseup",X),P.removeEventListener("touchmove",Y),P.removeEventListener("touchend",X)}},isValid:zi},Bi=function(e){return{connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}};var Di=e.memo(re((function(r,o){var i,a,u=r.type,c=void 0===u?"source":u,s=r.position,l=void 0===s?exports.Position.Top:s,d=r.isValidConnection,f=r.isConnectable,v=void 0===f||f,p=r.isConnectableStart,g=void 0===p||p,y=r.isConnectableEnd,w=void 0===y||y,b=r.id,x=r.onConnect,_=r.children,E=r.className,S=r.onMouseDown,k=r.onTouchStart,N=t(r,["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"]),C=b||null,P="target"===c,M=L(),O=e.useContext(gi),j=D(Bi,Ce),I=j.connectOnClick,z=j.noPanClassName,T=j.rfId,B=D(function(e,n,t){return function(r){var o=r.connectionStartHandle,i=r.connectionEndHandle,a=r.connectionClickStartHandle,u=r.connectionMode,c=r.connectionStatus,s=(null==i?void 0:i.nodeId)===e&&(null==i?void 0:i.handleId)===n&&(null==i?void 0:i.type)===t;return{connectingFrom:(null==o?void 0:o.nodeId)===e&&(null==o?void 0:o.handleId)===n&&(null==o?void 0:o.type)===t,connectingTo:s,clickConnecting:(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===n&&(null==a?void 0:a.type)===t,isPossibleEndHandle:u===Pe.Strict?(null==o?void 0:o.type)!==t:e!==(null==o?void 0:o.nodeId)||n!==(null==o?void 0:o.handleId),connectionInProcess:!!o,valid:s&&"valid"===c}}}(O,C,c),Ce),R=B.connectingFrom,V=B.connectingTo,H=B.clickConnecting,Z=B.isPossibleEndHandle,Y=B.connectionInProcess,X=B.valid;O||null===(a=(i=M.getState()).onError)||void 0===a||a.call(i,"010",A.error010());var F=function(e){var t=M.getState(),r=t.defaultEdgeOptions,o=t.onConnect,i=t.hasDefaultEdges,a=n(n({},r),e);if(i){var u=M.getState(),c=u.edges;(0,u.setEdges)(function(e,t){return e.source&&e.target?function(e,n){return n.some((function(n){return!(n.source!==e.source||n.target!==e.target||n.sourceHandle!==e.sourceHandle&&(n.sourceHandle||e.sourceHandle)||n.targetHandle!==e.targetHandle&&(n.targetHandle||e.targetHandle))}))}(r="id"in(o=e)&&"source"in o&&"target"in o?n({},e):n(n({},e),{id:ki(e)}),t)?t:(null===r.sourceHandle&&delete r.sourceHandle,null===r.targetHandle&&delete r.targetHandle,t.concat(r)):t;var r,o}(a,c))}null==o||o(a),null==x||x(a)},U=function(e){if(O){var n=be(e.nativeEvent);if(g&&(n&&0===e.button||!n)){var t=M.getState();Ti.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:P,handleId:C,nodeId:O,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:F,isValidConnection:d||t.isValidConnection,getTransform:function(){return M.getState().transform},getConnectionStartHandle:function(){return M.getState().connectionStartHandle}})}n?null==S||S(e):null==k||k(e)}};return h.jsx("div",n({"data-handleid":C,"data-nodeid":O,"data-handlepos":l,"data-id":"".concat(T,"-").concat(O,"-").concat(C,"-").concat(c),className:m(["ink-flow__handle","ink-flow__handle-".concat(l),"nodrag",z,E,{source:!P,target:P,connectable:v,connectablestart:g,connectableend:w,clickconnecting:H,connectingfrom:R,connectingto:V,valid:X,connectionindicator:v&&(!Y||Z)&&(Y?w:g)}]),onMouseDown:U,onTouchStart:U,onClick:I?function(e){var n=M.getState(),t=n.onClickConnectStart,r=n.onClickConnectEnd,o=n.connectionClickStartHandle,i=n.connectionMode,a=n.isValidConnection,u=n.lib,s=n.rfId;if(O&&(o||g)){if(!o)return null==t||t(e.nativeEvent,{nodeId:O,handleId:C,handleType:c}),void M.setState({connectionClickStartHandle:{nodeId:O,type:c,handleId:C}});var l=ye(e.target),f=d||a,h=Ti.isValid(e.nativeEvent,{handle:{nodeId:O,id:C,type:c},connectionMode:i,fromNodeId:o.nodeId,fromHandleId:o.handleId||null,fromType:o.type,isValidConnection:f,flowId:s,doc:l,lib:u}),v=h.connection;h.isValid&&v&&F(v),null==r||r(e),M.setState({connectionClickStartHandle:null})}}:void 0,ref:o},N,{children:_}))})));var Li={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ri={input:function(e){var n=e.data,t=e.isConnectable,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r;return h.jsxs(h.Fragment,{children:[null==n?void 0:n.label,h.jsx(Di,{type:"source",position:o,isConnectable:t})]})},default:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?exports.Position.Top:r,i=e.sourcePosition,a=void 0===i?exports.Position.Bottom:i;return h.jsxs(h.Fragment,{children:[h.jsx(Di,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label,h.jsx(Di,{type:"source",position:a,isConnectable:t})]})},output:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?exports.Position.Top:r;return h.jsxs(h.Fragment,{children:[h.jsx(Di,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label]})},group:function(){return null}};function Vi(e){var n=e.id,t=e.store,r=e.unselect,o=void 0!==r&&r,i=e.nodeRef,a=t.getState(),u=a.addSelectedNodes,c=a.unselectNodesAndEdges,s=a.multiSelectionActive,l=a.nodeLookup,d=a.onError,f=l.get(n);f?(t.setState({nodesSelectionActive:!1}),f.selected?(o||f.selected&&s)&&(c({nodes:[f],edges:[]}),requestAnimationFrame((function(){var e;return null===(e=null==i?void 0:i.current)||void 0===e?void 0:e.blur()}))):u([n])):null==d||d("012",A.error012(n))}function Hi(e,n){if(!e.parentId)return!1;var t=n.get(e.parentId);return!!t&&(!!t.selected||Hi(t,n))}function Zi(e,n,t){var r=e;do{if(null==r?void 0:r.matches(n))return!0;if(r===t)return!1;r=r.parentElement}while(r);return!1}function Yi(e){var t,r,o,u,c=e.nodeId,s=e.dragItems,l=e.nodeLookup,d=[];try{for(var f=i(s),h=f.next();!h.done;h=f.next()){var v=a(h.value,2),p=v[0],g=v[1],y=null===(o=l.get(p))||void 0===o?void 0:o.internals.userNode;y&&d.push(n(n({},y),{position:g.position}))}}catch(e){t={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(t)throw t.error}}if(!c)return[d[0],d];var m=l.get(c).internals.userNode;return[n(n({},m),{position:(null===(u=s.get(c))||void 0===u?void 0:u.position)||m.position}),d]}function Xi(e){var n=e.onNodeMouseDown,t=e.getStoreItems,r=e.onDragStart,o=e.onDrag,u=e.onDragStop,c={x:null,y:null},s=0,l=new Map,d=!1,f={x:0,y:0},h=null,v=!1,p=null;return{update:function(e){var g=e.noDragClassName,y=e.handleSelector,m=e.domNode,w=e.isSelectable,b=e.nodeId;function x(e,n){var r,u,s=e.x,d=e.y,f=t(),h=f.nodeLookup,v=f.nodeExtent,p=f.snapGrid,g=f.snapToGrid,y=f.nodeOrigin,m=f.onNodeDrag,w=f.onSelectionDrag,x=f.onError,_=f.updateNodePositions;c={x:s,y:d};var E=!1,S={x:0,y:0,x2:0,y2:0};if(l.size>1&&v){var k=Go(l,{nodeOrigin:y});S=J(k)}try{for(var N=i(l),C=N.next();!C.done;C=N.next()){var P=a(C.value,2),M=P[0],O=P[1],j={x:s-O.distance.x,y:d-O.distance.y};g&&(j=W(j,p));var I=[[v[0][0],v[0][1]],[v[1][0],v[1][1]]];if(l.size>1&&v&&!O.extent){var A=O.internals.positionAbsolute,z=A.x-S.x+v[0][0],T=A.x+O.measured.width-S.x2+v[1][0];I=[[z,A.y-S.y+v[0][1]],[T,A.y+O.measured.height-S.y2+v[1][1]]]}var B=Ko({nodeId:M,nextPosition:j,nodeLookup:h,nodeExtent:I,nodeOrigin:y,onError:x}),D=B.position,L=B.positionAbsolute;E=E||O.position.x!==D.x||O.position.y!==D.y,O.position=D,O.internals.positionAbsolute=L}}catch(e){r={error:e}}finally{try{C&&!C.done&&(u=N.return)&&u.call(N)}finally{if(r)throw r.error}}if(E&&(_(l,!0),n&&(o||m||!b&&w))){var R=a(Yi({nodeId:b,dragItems:l,nodeLookup:h}),2),V=R[0],H=R[1];null==o||o(n,l,V,H),null==m||m(n,V,H),b||null==w||w(n,H)}}function _(){var e,n;if(h){var r=a(ce(f,h),2),o=r[0],i=r[1];if(0!==o||0!==i){var u=t(),l=u.transform,d=u.panBy;c.x=(null!==(e=c.x)&&void 0!==e?e:0)-o/l[2],c.y=(null!==(n=c.y)&&void 0!==n?n:0)-i/l[2],d({x:o,y:i})&&x(c,null)}s=requestAnimationFrame(_)}}function E(e){var o,u=t(),s=u.nodeLookup,d=u.multiSelectionActive,f=u.nodesDraggable,h=u.transform,p=u.snapGrid,g=u.snapToGrid,y=u.selectNodesOnDrag,m=u.onNodeDragStart,x=u.onSelectionDragStart,_=u.unselectNodesAndEdges;v=!0,y&&w||d||!b||(null===(o=s.get(b))||void 0===o?void 0:o.selected)||_(),w&&y&&b&&(null==n||n(b));var E=pe(e.sourceEvent,{transform:h,snapGrid:p,snapToGrid:g});if(c=E,l=function(e,n,t,r){var o,u,c,s,l=new Map;try{for(var d=i(e),f=d.next();!f.done;f=d.next()){var h=a(f.value,2),v=h[0],p=h[1];if((p.selected||p.id===r)&&(!p.parentId||!Hi(p,e))&&(p.draggable||n&&void 0===p.draggable)){var g=e.get(v);g&&l.set(v,{id:v,position:g.position||{x:0,y:0},distance:{x:t.x-g.internals.positionAbsolute.x,y:t.y-g.internals.positionAbsolute.y},extent:g.extent,parentId:g.parentId,origin:g.origin,expandParent:g.expandParent,internals:{positionAbsolute:g.internals.positionAbsolute||{x:0,y:0}},measured:{width:null!==(c=g.measured.width)&&void 0!==c?c:0,height:null!==(s=g.measured.height)&&void 0!==s?s:0}})}}}catch(e){o={error:e}}finally{try{f&&!f.done&&(u=d.return)&&u.call(d)}finally{if(o)throw o.error}}return l}(s,f,E,b),l.size>0&&(r||m||!b&&x)){var S=a(Yi({nodeId:b,dragItems:l,nodeLookup:s}),2),k=S[0],N=S[1];null==r||r(e.sourceEvent,l,k,N),null==m||m(e.sourceEvent,k,N),b||null==x||x(e.sourceEvent,N)}}p=Jn(m);var S=function(){var e,n,t,r,o=st,i=lt,a=dt,u=ft,c={},s=Be("start","drag","end"),l=0,d=0;function f(e){e.on("mousedown.drag",h).filter(u).on("touchstart.drag",g).on("touchmove.drag",y,nt).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,u){if(!r&&o.call(this,a,u)){var c=w(this,i.call(this,a,u),a,u,"mouse");c&&(Jn(a.view).on("mousemove.drag",v,tt).on("mouseup.drag",p,tt),it(a.view),rt(a),t=!1,e=a.clientX,n=a.clientY,c("start",a))}}function v(r){if(ot(r),!t){var o=r.clientX-e,i=r.clientY-n;t=o*o+i*i>d}c.mouse("drag",r)}function p(e){Jn(e.view).on("mousemove.drag mouseup.drag",null),at(e.view,t),ot(e),c.mouse("end",e)}function g(e,n){if(o.call(this,e,n)){var t,r,a=e.changedTouches,u=i.call(this,e,n),c=a.length;for(t=0;t<c;++t)(r=w(this,u,e,n,a[t].identifier,a[t]))&&(rt(e),r("start",e,a[t]))}}function y(e){var n,t,r=e.changedTouches,o=r.length;for(n=0;n<o;++n)(t=c[r[n].identifier])&&(ot(e),t("drag",e,r[n]))}function m(e){var n,t,o=e.changedTouches,i=o.length;for(r&&clearTimeout(r),r=setTimeout((function(){r=null}),500),n=0;n<i;++n)(t=c[o[n].identifier])&&(rt(e),t("end",e,o[n]))}function w(e,n,t,r,o,i){var u,d,h,v=s.copy(),p=et(i||t,n);if(null!=(h=a.call(e,new ct("beforestart",{sourceEvent:t,target:f,identifier:o,active:l,x:p[0],y:p[1],dx:0,dy:0,dispatch:v}),r)))return u=h.x-p[0]||0,d=h.y-p[1]||0,function t(i,a,s){var g,y=p;switch(i){case"start":c[o]=t,g=l++;break;case"end":delete c[o],--l;case"drag":p=et(s||a,n),g=l}v.call(i,e,new ct(i,{sourceEvent:a,subject:h,target:f,identifier:o,active:g,x:p[0]+u,y:p[1]+d,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:v}),r)}}return f.filter=function(e){return arguments.length?(o="function"==typeof e?e:ut(!!e),f):o},f.container=function(e){return arguments.length?(i="function"==typeof e?e:ut(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:ut(e),f):a},f.touchable=function(e){return arguments.length?(u="function"==typeof e?e:ut(!!e),f):u},f.on=function(){var e=s.on.apply(s,arguments);return e===s?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}().on("start",(function(e){var n=t(),r=n.domNode,o=n.nodeDragThreshold,i=n.transform,a=n.snapGrid,u=n.snapToGrid;0===o&&E(e);var s=pe(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:u});c=s,h=(null==r?void 0:r.getBoundingClientRect())||null,f=xe(e.sourceEvent,h)})).on("drag",(function(e){var n,r,o=t(),i=o.autoPanOnNodeDrag,a=o.transform,u=o.snapGrid,s=o.snapToGrid,p=o.nodeDragThreshold,g=pe(e.sourceEvent,{transform:a,snapGrid:u,snapToGrid:s});if(!d&&i&&v&&(d=!0,_()),!v){var y=g.xSnapped-(null!==(n=c.x)&&void 0!==n?n:0),m=g.ySnapped-(null!==(r=c.y)&&void 0!==r?r:0);Math.sqrt(y*y+m*m)>p&&E(e)}(c.x!==g.xSnapped||c.y!==g.ySnapped)&&l&&v&&(f=xe(e.sourceEvent,h),x(g,e.sourceEvent))})).on("end",(function(e){if(v&&(d=!1,v=!1,cancelAnimationFrame(s),l.size>0)){var n=t(),r=n.nodeLookup,o=n.updateNodePositions,i=n.onNodeDragStop,c=n.onSelectionDragStop;if(o(l,!1),u||i||!b&&c){var f=a(Yi({nodeId:b,dragItems:l,nodeLookup:r}),2),h=f[0],p=f[1];null==u||u(e.sourceEvent,l,h,p),null==i||i(e.sourceEvent,h,p),b||null==c||c(e.sourceEvent,p)}}})).filter((function(e){var n=e.target;return!e.button&&(!g||!Zi(n,".".concat(g),m))&&(!y||Zi(n,y,m))}));p.call(S)},destroy:function(){null==p||p.on(".drag",null)}}}var Fi=function(e){return function(n){return n.selected&&(n.draggable||e&&void 0===n.draggable)}};function Ui(t){var r,o=t.id,u=t.onClick,c=t.onMouseEnter,s=t.onMouseMove,l=t.onMouseLeave,d=t.onContextMenu,f=t.onDoubleClick,v=t.nodesDraggable,p=t.elementsSelectable,g=t.nodesConnectable,y=t.nodesFocusable,w=t.resizeObserver,b=t.noDragClassName,x=t.noPanClassName,_=t.disableKeyboardA11y,E=t.rfId,S=t.nodeTypes,k=t.nodeExtent,N=t.nodeOrigin,C=t.onError,P=D((function(e){var n=e.nodeLookup.get(o),t=e.parentLookup.has(o);return{node:n,internals:n.internals,isParent:t}}),Ce),M=P.node,O=P.internals,j=P.isParent,I=M.type||"default",z=(null==S?void 0:S[I])||Ri[I];void 0===z&&(null==C||C("003",A.error003(I)),I="default",z=Ri.default);var B=!!(M.draggable||v&&void 0===M.draggable),R=!!(M.selectable||p&&void 0===M.selectable),V=!!(M.connectable||g&&void 0===M.connectable),H=!!(M.focusable||y&&void 0===M.focusable),Z=L(),Y=function(e){var n,t,r,o,i,a;return void 0!==(null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==(null!==(a=null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:e.height)&&void 0!==a?a:e.initialHeight)}(M),X=function(n){var t=n.node,r=n.nodeType,o=n.hasDimensions,i=n.resizeObserver,a=L(),u=e.useRef(null),c=e.useRef(null),s=e.useRef(t.sourcePosition),l=e.useRef(t.targetPosition),d=e.useRef(r),f=o&&!!t.internals.handleBounds&&!t.hidden;return e.useEffect((function(){!u.current||f&&c.current===u.current||(c.current&&(null==i||i.unobserve(c.current)),null==i||i.observe(u.current),c.current=u.current)}),[f]),e.useEffect((function(){return function(){c.current&&(null==i||i.unobserve(c.current),c.current=null)}}),[]),e.useEffect((function(){if(u.current){var e=d.current!==r,n=s.current!==t.sourcePosition,o=l.current!==t.targetPosition;(e||n||o)&&(d.current=r,s.current=t.sourcePosition,l.current=t.targetPosition,a.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:u.current,force:!0}]])))}}),[t.id,r,t.sourcePosition,t.targetPosition]),u}({node:M,nodeType:I,hasDimensions:Y,resizeObserver:w}),F=function(n){var t=n.nodeRef,r=n.disabled,o=void 0!==r&&r,i=n.noDragClassName,u=n.handleSelector,c=n.nodeId,s=n.isSelectable,l=L(),d=a(e.useState(!1),2),f=d[0],h=d[1],v=e.useRef();return e.useEffect((function(){v.current=Xi({getStoreItems:function(){return l.getState()},onNodeMouseDown:function(e){Vi({id:e,store:l,nodeRef:t})},onDragStart:function(){h(!0)},onDragStop:function(){h(!1)}})}),[]),e.useEffect((function(){var e,n;if(o)null===(e=v.current)||void 0===e||e.destroy();else if(t.current)return null===(n=v.current)||void 0===n||n.update({noDragClassName:i,handleSelector:u,domNode:t.current,isSelectable:s,nodeId:c}),function(){var e;null===(e=v.current)||void 0===e||e.destroy()}}),[i,u,o,s,t,c]),f}({nodeRef:X,disabled:M.hidden||!B,noDragClassName:b,handleSelector:M.dragHandle,nodeId:o,isSelectable:R}),$=function(){var n=L(),t=e.useCallback((function(e){var t,r,o=n.getState(),u=o.nodeExtent,c=o.snapToGrid,s=o.snapGrid,l=o.nodesDraggable,d=o.onError,f=o.updateNodePositions,h=o.nodeLookup,v=o.nodeOrigin,p=new Map,g=Fi(l),y=c?s[0]:5,m=c?s[1]:5,w=e.direction.x*y*e.factor,b=e.direction.y*m*e.factor;try{for(var x=i(h),_=x.next();!_.done;_=x.next()){var E=a(_.value,2)[1];if(g(E)){var S={x:E.internals.positionAbsolute.x+w,y:E.internals.positionAbsolute.y+b};c&&(S=W(S,s));var k=Ko({nodeId:E.id,nextPosition:S,nodeLookup:h,nodeExtent:u,nodeOrigin:v,onError:d}),N=k.position,C=k.positionAbsolute;E.position=N,E.internals.positionAbsolute=C,p.set(E.id,E)}}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=x.return)&&r.call(x)}finally{if(t)throw t.error}}f(p)}),[]);return t}();if(M.hidden)return null;var q=G(M),K=function(e){var n,t,r,o,i,a,u,c,s,l;return void 0===e.internals.handleBounds?{width:null!==(t=null!==(n=e.width)&&void 0!==n?n:e.initialWidth)&&void 0!==t?t:null===(r=e.style)||void 0===r?void 0:r.width,height:null!==(i=null!==(o=e.height)&&void 0!==o?o:e.initialHeight)&&void 0!==i?i:null===(a=e.style)||void 0===a?void 0:a.height}:{width:null!==(u=e.width)&&void 0!==u?u:null===(c=e.style)||void 0===c?void 0:c.width,height:null!==(s=e.height)&&void 0!==s?s:null===(l=e.style)||void 0===l?void 0:l.height}}(M),Q=k?U(O.positionAbsolute,k):O.positionAbsolute,J=se(n(n(n({},Q),q),{origin:M.origin||N})),ee=R||B||u||c||s||l,ne=c?function(e){return c(e,n({},O.userNode))}:void 0,te=s?function(e){return s(e,n({},O.userNode))}:void 0,re=l?function(e){return l(e,n({},O.userNode))}:void 0,oe=d?function(e){return d(e,n({},O.userNode))}:void 0,ie=f?function(e){return f(e,n({},O.userNode))}:void 0;return h.jsx("div",{className:m(["ink-flow__node","ink-flow__node-".concat(I),(r={},r[x]=B,r),M.className,{selected:M.selected,selectable:R,parent:j,draggable:B,dragging:F}]),ref:X,style:n(n({zIndex:O.z,transform:"translate(".concat(J.x,"px,").concat(J.y,"px)"),pointerEvents:ee?"all":"none",visibility:Y?"visible":"hidden"},M.style),K),"data-id":o,"data-testid":"rf__node-".concat(o),onMouseEnter:ne,onMouseMove:te,onMouseLeave:re,onContextMenu:oe,onClick:function(e){var t=Z.getState(),r=t.selectNodesOnDrag,i=t.nodeDragThreshold;R&&(!r||!B||i>0)&&Vi({id:o,store:Z,nodeRef:X}),u&&u(e,n({},O.userNode))},onDoubleClick:ie,onKeyDown:H?function(e){if(!we(e.nativeEvent)&&!_)if(T.includes(e.key)&&R){var n="Escape"===e.key;Vi({id:o,store:Z,unselect:n,nodeRef:X})}else B&&M.selected&&Object.prototype.hasOwnProperty.call(Li,e.key)&&(Z.setState({ariaLiveMessage:"Moved selected node ".concat(e.key.replace("Arrow","").toLowerCase(),". New position, x: ").concat(~~Q.x,", y: ").concat(~~Q.y)}),$({direction:Li[e.key],factor:e.shiftKey?4:1}))}:void 0,tabIndex:H?0:void 0,role:H?"button":void 0,"aria-describedby":_?void 0:"".concat(mi,"-").concat(E),"aria-label":M.ariaLabel,children:h.jsx(yi,{value:o,children:h.jsx(z,n({id:o,data:M.data,type:I,positionAbsoluteX:Q.x,positionAbsoluteY:Q.y,selected:M.selected,isConnectable:V,sourcePosition:M.sourcePosition,targetPosition:M.targetPosition,dragging:F,dragHandle:M.dragHandle,zIndex:O.z},q))})})}var Gi=function(e){return{nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError}};function $i(n){var t,r=D(Gi,Ce),o=r.nodesDraggable,i=r.nodesConnectable,u=r.nodesFocusable,c=r.elementsSelectable,s=r.onError,l=(t=!1,D(e.useCallback(pi(t),[t]),Ce)),d=function(){var n=D(vi),t=a(e.useState((function(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver((function(e){var t=new Map;e.forEach((function(e){var n=e.target.getAttribute("data-id");t.set(n,{id:n,nodeElement:e.target})})),n(t)}))})),1),r=t[0];return e.useEffect((function(){return function(){null==r||r.disconnect()}}),[r]),r}();return h.jsx("div",{className:"ink-flow__nodes",style:ze,children:l.map((function(e){return h.jsx(Ui,{id:e,nodeTypes:n.nodeTypes,nodeOrigin:n.nodeOrigin,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,resizeObserver:d,nodesDraggable:o,nodesConnectable:i,nodesFocusable:u,elementsSelectable:c,onError:s},e)}))})}$i.displayName="NodeRenderer";var Wi,qi=e.memo($i),Ki=((Wi={})[Ie.Arrow]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return h.jsx("polyline",{style:{stroke:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"})},Wi[Ie.ArrowClosed]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return h.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Wi);function Qi(e,n){if(!e)return"";if("string"==typeof e)return e;var t=n?"".concat(n,"__"):"";return"".concat(t).concat(Object.keys(e).sort().map((function(n){return"".concat(n,"=").concat(e[n])})).join("&"))}var Ji=function(n){var t=n.id,r=n.type,o=n.color,i=n.width,a=void 0===i?12.5:i,u=n.height,c=void 0===u?12.5:u,s=n.markerUnits,l=void 0===s?"strokeWidth":s,d=n.strokeWidth,f=n.orient,v=void 0===f?"auto-start-reverse":f,p=function(n){var t=L(),r=e.useMemo((function(){var e,r;return Object.prototype.hasOwnProperty.call(Ki,n)?Ki[n]:(null===(r=(e=t.getState()).onError)||void 0===r||r.call(e,"009",A.error009(n)),null)}),[n]);return r}(r);return p?h.jsx("marker",{className:"ink-flow__arrowhead",id:t,markerWidth:"".concat(a),markerHeight:"".concat(c),viewBox:"-10 -10 20 20",markerUnits:l,orient:v,refX:"0",refY:"0",children:h.jsx(p,{color:o,strokeWidth:d})}):null},ea=function(t){var r=t.defaultColor,o=t.rfId,i=D((function(e){return e.edges})),a=D((function(e){return e.defaultEdgeOptions})),u=e.useMemo((function(){var e=function(e,t){var r=t.id,o=t.defaultColor,i=t.defaultMarkerStart,a=t.defaultMarkerEnd,u=new Set;return e.reduce((function(e,t){return[t.markerStart||i,t.markerEnd||a].forEach((function(t){if(t&&"object"==typeof t){var i=Qi(t,r);u.has(i)||(e.push(n({id:i,color:t.color||o},t)),u.add(i))}})),e}),[]).sort((function(e,n){return e.id.localeCompare(n.id)}))}(i,{id:o,defaultColor:r,defaultMarkerStart:null==a?void 0:a.markerStart,defaultMarkerEnd:null==a?void 0:a.markerEnd});return e}),[i,a,o,r]);return u.length?h.jsx("svg",{className:"ink-flow__marker",children:h.jsx("defs",{children:u.map((function(e){return h.jsx(Ji,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id)}))})}):null};ea.displayName="MarkerDefinitions";var na=e.memo(ea);function ta(r){var o=r.x,i=r.y,u=r.label,c=r.labelStyle,s=void 0===c?{}:c,l=r.labelShowBg,d=void 0===l||l,f=r.labelBgStyle,v=void 0===f?{}:f,p=r.labelBgPadding,g=void 0===p?[2,4]:p,y=r.labelBgBorderRadius,w=void 0===y?2:y,b=r.children,x=r.className,_=t(r,["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"]),E=a(e.useState({x:1,y:0,width:0,height:0}),2),S=E[0],k=E[1],N=m(["ink-flow__edge-textwrapper",x]),C=e.useCallback((function(e){if(null!==e){var n=e.getBBox();k({x:n.x,y:n.y,width:n.width,height:n.height})}}),[]);return void 0!==u&&u?h.jsxs("g",n({transform:"translate(".concat(o-S.width/2," ").concat(i-S.height/2,")"),className:N,visibility:S.width?"visible":"hidden"},_,{children:[d&&h.jsx("rect",{width:S.width+2*g[0],x:-g[0],y:-g[1],height:S.height+2*g[1],className:"ink-flow__edge-textbg",style:v,rx:w,ry:w}),h.jsx("text",{className:"ink-flow__edge-text",y:S.height/2,dy:"0.3em",ref:C,style:s,children:u}),b]})):null}ta.displayName="EdgeText";var ra=e.memo(ta);function oa(e){var n=e.id,t=e.path,r=e.labelX,o=e.labelY,i=e.label,a=e.labelStyle,u=e.labelShowBg,c=e.labelBgStyle,s=e.labelBgPadding,l=e.labelBgBorderRadius,d=e.style,f=e.markerEnd,v=e.markerStart,p=e.className,g=e.interactionWidth,y=void 0===g?20:g;return h.jsxs(h.Fragment,{children:[h.jsx("path",{id:n,style:d,d:t,fill:"none",className:m(["ink-flow__edge-path",p]),markerEnd:f,markerStart:v}),y&&h.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:y,className:"ink-flow__edge-interaction"}),i&&$(r)&&$(o)?h.jsx(ra,{x:r,y:o,label:i,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:s,labelBgBorderRadius:l}):null]})}function ia(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2;return n===exports.Position.Left||n===exports.Position.Right?[.5*(t+o),r]:[t,.5*(r+i)]}function aa(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,u=e.targetY,c=e.sourcePosition,s=void 0===c?exports.Position.Bottom:c,l=e.targetPosition,d=void 0===l?exports.Position.Top:l,f=e.label,v=e.labelStyle,p=e.labelShowBg,g=e.labelBgStyle,y=e.labelBgPadding,m=e.labelBgBorderRadius,w=e.style,b=e.markerEnd,x=e.markerStart,_=e.interactionWidth,E=a(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,u=e.targetY,c=e.targetPosition,s=void 0===c?exports.Position.Top:c,l=a(ia({pos:o,x1:n,y1:t,x2:i,y2:u}),2),d=l[0],f=l[1],h=a(ia({pos:s,x1:i,y1:u,x2:n,y2:t}),2),v=h[0],p=h[1],g=a(bi({sourceX:n,sourceY:t,targetX:i,targetY:u,sourceControlX:d,sourceControlY:f,targetControlX:v,targetControlY:p}),4),y=g[0],m=g[1],w=g[2],b=g[3];return["M".concat(n,",").concat(t," C").concat(d,",").concat(f," ").concat(v,",").concat(p," ").concat(i,",").concat(u),y,m,w,b]}({sourceX:r,sourceY:o,sourcePosition:s,targetX:i,targetY:u,targetPosition:d}),3),S=E[0],k=E[1],N=E[2],C=n.isInternal?void 0:t;return h.jsx(oa,{id:C,path:S,labelX:k,labelY:N,label:f,labelStyle:v,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:m,style:w,markerEnd:b,markerStart:x,interactionWidth:_})}))}var ua=aa({isInternal:!1}),ca=aa({isInternal:!0});function sa(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,u=e.targetY,c=e.label,s=e.labelStyle,l=e.labelShowBg,d=e.labelBgStyle,f=e.labelBgPadding,v=e.labelBgBorderRadius,p=e.style,g=e.sourcePosition,y=void 0===g?exports.Position.Bottom:g,m=e.targetPosition,w=void 0===m?exports.Position.Top:m,b=e.markerEnd,x=e.markerStart,_=e.pathOptions,E=e.interactionWidth,S=a(Mi({sourceX:r,sourceY:o,sourcePosition:y,targetX:i,targetY:u,targetPosition:w,borderRadius:null==_?void 0:_.borderRadius,offset:null==_?void 0:_.offset}),3),k=S[0],N=S[1],C=S[2],P=n.isInternal?void 0:t;return h.jsx(oa,{id:P,path:k,labelX:N,labelY:C,label:c,labelStyle:s,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:v,style:p,markerEnd:b,markerStart:x,interactionWidth:E})}))}ua.displayName="SimpleBezierEdge",ca.displayName="SimpleBezierEdgeInternal";var la=sa({isInternal:!1}),da=sa({isInternal:!0});function fa(r){return e.memo((function(o){var i,a=o.id,u=t(o,["id"]),c=r.isInternal?void 0:a;return h.jsx(la,n({},u,{id:c,pathOptions:e.useMemo((function(){var e;return{borderRadius:0,offset:null===(e=u.pathOptions)||void 0===e?void 0:e.offset}}),[null===(i=u.pathOptions)||void 0===i?void 0:i.offset])}))}))}la.displayName="SmoothStepEdge",da.displayName="SmoothStepEdgeInternal";var ha=fa({isInternal:!1}),va=fa({isInternal:!0});function pa(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,u=e.targetY,c=e.label,s=e.labelStyle,l=e.labelShowBg,d=e.labelBgStyle,f=e.labelBgPadding,v=e.labelBgBorderRadius,p=e.style,g=e.markerEnd,y=e.markerStart,m=e.interactionWidth,w=a(function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=a(Ei({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),u=i[0],c=i[1],s=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),u,c,s,l]}({sourceX:r,sourceY:o,targetX:i,targetY:u}),3),b=w[0],x=w[1],_=w[2],E=n.isInternal?void 0:t;return h.jsx(oa,{id:E,path:b,labelX:x,labelY:_,label:c,labelStyle:s,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:v,style:p,markerEnd:g,markerStart:y,interactionWidth:m})}))}ha.displayName="StepEdge",va.displayName="StepEdgeInternal";var ga=pa({isInternal:!1}),ya=pa({isInternal:!0});function ma(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,u=e.targetY,c=e.sourcePosition,s=void 0===c?exports.Position.Bottom:c,l=e.targetPosition,d=void 0===l?exports.Position.Top:l,f=e.label,v=e.labelStyle,p=e.labelShowBg,g=e.labelBgStyle,y=e.labelBgPadding,m=e.labelBgBorderRadius,w=e.style,b=e.markerEnd,x=e.markerStart,_=e.pathOptions,E=e.interactionWidth,S=a(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,u=e.targetY,c=e.targetPosition,s=void 0===c?exports.Position.Top:c,l=e.curvature,d=void 0===l?.25:l,f=a(_i({pos:o,x1:n,y1:t,x2:i,y2:u,c:d}),2),h=f[0],v=f[1],p=a(_i({pos:s,x1:i,y1:u,x2:n,y2:t,c:d}),2),g=p[0],y=p[1],m=a(bi({sourceX:n,sourceY:t,targetX:i,targetY:u,sourceControlX:h,sourceControlY:v,targetControlX:g,targetControlY:y}),4),w=m[0],b=m[1],x=m[2],_=m[3];return["M".concat(n,",").concat(t," C").concat(h,",").concat(v," ").concat(g,",").concat(y," ").concat(i,",").concat(u),w,b,x,_]}({sourceX:r,sourceY:o,sourcePosition:s,targetX:i,targetY:u,targetPosition:d,curvature:null==_?void 0:_.curvature}),3),k=S[0],N=S[1],C=S[2],P=n.isInternal?void 0:t;return h.jsx(oa,{id:P,path:k,labelX:N,labelY:C,label:f,labelStyle:v,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:m,style:w,markerEnd:b,markerStart:x,interactionWidth:E})}))}ga.displayName="StraightEdge",ya.displayName="StraightEdgeInternal";var wa=ma({isInternal:!1}),ba=ma({isInternal:!0});wa.displayName="BezierEdge",ba.displayName="BezierEdgeInternal";var xa={default:ba,straight:ya,step:va,smoothstep:da,simplebezier:ca},_a={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Ea=function(e,n,t){return t===exports.Position.Left?e-n:t===exports.Position.Right?e+n:e},Sa=function(e,n,t){return t===exports.Position.Top?e-n:t===exports.Position.Bottom?e+n:e},ka="ink-flow__edgeupdater";function Na(e){var n=e.position,t=e.centerX,r=e.centerY,o=e.radius,i=void 0===o?10:o,a=e.onMouseDown,u=e.onMouseEnter,c=e.onMouseOut,s=e.type;return h.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:c,className:m([ka,"".concat(ka,"-").concat(s)]),cx:Ea(t,i,n),cy:Sa(r,i,n),r:i,stroke:"transparent",fill:"transparent"})}function Ca(e){var n=e.isUpdatable,t=e.edgeUpdaterRadius,r=e.edge,o=e.targetHandleId,i=e.sourceHandleId,a=e.sourceX,u=e.sourceY,c=e.targetX,s=e.targetY,l=e.sourcePosition,d=e.targetPosition,f=e.onEdgeUpdate,v=e.onEdgeUpdateStart,p=e.onEdgeUpdateEnd,g=e.setUpdating,y=e.setUpdateHover,m=L(),w=function(e,n){if(0===e.button){var t=m.getState(),a=t.autoPanOnConnect,u=t.domNode,c=t.isValidConnection,s=t.connectionMode,l=t.connectionRadius,d=t.lib,h=t.onConnectStart,y=t.onConnectEnd,w=t.cancelConnection,b=t.nodeLookup,x=t.rfId,_=t.panBy,E=t.updateConnection,S=n?r.target:r.source,k=(n?o:i)||null,N=n?"target":"source",C=n;g(!0),null==v||v(e,r,N);Ti.onPointerDown(e.nativeEvent,{autoPanOnConnect:a,connectionMode:s,connectionRadius:l,domNode:u,handleId:k,nodeId:S,nodeLookup:b,isTarget:C,edgeUpdaterType:N,lib:d,flowId:x,cancelConnection:w,panBy:_,isValidConnection:c,onConnect:function(e){return null==f?void 0:f(r,e)},onConnectStart:h,onConnectEnd:y,onEdgeUpdateEnd:function(e){g(!1),null==p||p(e,r,N)},updateConnection:E,getTransform:function(){return m.getState().transform},getConnectionStartHandle:function(){return m.getState().connectionStartHandle}})}},b=function(){return y(!0)},x=function(){return y(!1)};return h.jsxs(h.Fragment,{children:[("source"===n||!0===n)&&h.jsx(Na,{position:l,centerX:a,centerY:u,radius:t,onMouseDown:function(e){return w(e,!0)},onMouseEnter:b,onMouseOut:x,type:"source"}),("target"===n||!0===n)&&h.jsx(Na,{position:d,centerX:c,centerY:s,radius:t,onMouseDown:function(e){return w(e,!1)},onMouseEnter:b,onMouseOut:x,type:"target"})]})}function Pa(e){var n;return e&&!(!e.internals.handleBounds&&!(null===(n=e.handles)||void 0===n?void 0:n.length))&&!!(e.measured.width||e.width||e.initialWidth)}function Ma(e){var n,t,r,o;if(!e)return null;var a=[],u=[];try{for(var c=i(e),s=c.next();!s.done;s=c.next()){var l=s.value;l.width=null!==(r=l.width)&&void 0!==r?r:1,l.height=null!==(o=l.height)&&void 0!==o?o:1,"source"===l.type?a.push(l):"target"===l.type&&u.push(l)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return{source:a,target:u}}function Oa(e,n,t){var r,o;void 0===t&&(t=null);var i=(null!==(r=null==t?void 0:t.x)&&void 0!==r?r:0)+n.internals.positionAbsolute.x,a=(null!==(o=null==t?void 0:t.y)&&void 0!==o?o:0)+n.internals.positionAbsolute.y,u=null!=t?t:G(n),c=u.width,s=u.height;switch(e){case exports.Position.Top:return[i+c/2,a];case exports.Position.Right:return[i+c,a+s/2];case exports.Position.Bottom:return[i+c/2,a+s];case exports.Position.Left:return[i,a+s/2]}}function ja(e,n){return e&&(n?e.find((function(e){return e.id===n})):e[0])||null}function Ia(t){var r=t.id,o=t.edgesFocusable,i=t.edgesUpdatable,u=t.elementsSelectable,c=t.onClick,s=t.onDoubleClick,l=t.onContextMenu,d=t.onMouseEnter,f=t.onMouseMove,v=t.onMouseLeave,p=t.edgeUpdaterRadius,g=t.onEdgeUpdate,y=t.onEdgeUpdateStart,w=t.onEdgeUpdateEnd,b=t.rfId,x=t.edgeTypes,_=t.noPanClassName,E=t.onError,S=t.disableKeyboardA11y,k=D((function(e){return e.edgeLookup.get(r)})),N=D((function(e){return e.defaultEdgeOptions})),C=(k=N?n(n({},N),k):k).type||"default",P=(null==x?void 0:x[C])||xa[C];void 0===P&&(null==E||E("011",A.error011(C)),C="default",P=xa.default);var M=!!(k.focusable||o&&void 0===k.focusable),O=void 0!==g&&(k.updatable||i&&void 0===k.updatable),j=!!(k.selectable||u&&void 0===k.selectable),I=e.useRef(null),z=a(e.useState(!1),2),B=z[0],R=z[1],V=a(e.useState(!1),2),H=V[0],Z=V[1],Y=L(),X=D(e.useCallback((function(e){var t=e.nodeLookup.get(k.source),o=e.nodeLookup.get(k.target);if(!t||!o)return n({zIndex:k.zIndex},_a);var i=function(e){var n,t,r,o,i,u=e.sourceNode,c=e.targetNode;if(!Pa(u)||!Pa(c))return null;var s=u.internals.handleBounds||Ma(u.handles),l=c.internals.handleBounds||Ma(c.handles),d=ja(null!==(n=null==s?void 0:s.source)&&void 0!==n?n:[],e.sourceHandle),f=ja(e.connectionMode===Pe.Strict?null!==(t=null==l?void 0:l.target)&&void 0!==t?t:[]:(null!==(r=null==l?void 0:l.target)&&void 0!==r?r:[]).concat(null!==(o=null==l?void 0:l.source)&&void 0!==o?o:[]),e.targetHandle),h=(null==d?void 0:d.position)||exports.Position.Bottom,v=(null==f?void 0:f.position)||exports.Position.Top;if(!d||!f)return null===(i=e.onError)||void 0===i||i.call(e,"008",A.error008(d?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;var p=a(Oa(h,u,d),2),g=p[0],y=p[1],m=a(Oa(v,c,f),2);return{sourceX:g,sourceY:y,targetX:m[0],targetY:m[1],sourcePosition:h,targetPosition:v}}({id:r,sourceNode:t,targetNode:o,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:e.connectionMode,onError:E}),u=function(e){var n=e.sourceNode,t=e.targetNode,r=e.selected,o=void 0!==r&&r,i=e.zIndex,a=void 0===i?0:i,u=e.elevateOnSelect;if(void 0===u||!u)return a;var c=o||t.selected||n.selected,s=Math.max(n.internals.z||0,t.internals.z||0,1e3);return a+(c?s:0)}({selected:k.selected,zIndex:k.zIndex,sourceNode:t,targetNode:o,elevateOnSelect:e.elevateEdgesOnSelect});return n({zIndex:u},i||_a)}),[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),Ce),F=X.zIndex,U=X.sourceX,G=X.sourceY,$=X.targetX,W=X.targetY,q=X.sourcePosition,K=X.targetPosition,Q=e.useMemo((function(){return k.markerStart?"url('#".concat(Qi(k.markerStart,b),"')"):void 0}),[k.markerStart,b]),J=e.useMemo((function(){return k.markerEnd?"url('#".concat(Qi(k.markerEnd,b),"')"):void 0}),[k.markerEnd,b]);if(k.hidden||null===U||null===G||null===$||null===W)return null;var ee=s?function(e){s(e,n({},k))}:void 0,ne=l?function(e){l(e,n({},k))}:void 0,te=d?function(e){d(e,n({},k))}:void 0,re=f?function(e){f(e,n({},k))}:void 0,oe=v?function(e){v(e,n({},k))}:void 0;return h.jsx("svg",{style:{zIndex:F},children:h.jsxs("g",{className:m(["ink-flow__edge","ink-flow__edge-".concat(C),k.className,_,{selected:k.selected,animated:k.animated,inactive:!j&&!c,updating:B,selectable:j}]),onClick:function(e){var n,t=Y.getState(),o=t.addSelectedEdges,i=t.unselectNodesAndEdges,a=t.multiSelectionActive;j&&(Y.setState({nodesSelectionActive:!1}),k.selected&&a?(i({nodes:[],edges:[k]}),null===(n=I.current)||void 0===n||n.blur()):o([r])),c&&c(e,k)},onDoubleClick:ee,onContextMenu:ne,onMouseEnter:te,onMouseMove:re,onMouseLeave:oe,onKeyDown:M?function(e){var n;if(!S&&T.includes(e.key)&&j){var t=Y.getState(),o=t.unselectNodesAndEdges,i=t.addSelectedEdges;"Escape"===e.key?(null===(n=I.current)||void 0===n||n.blur(),o({edges:[k]})):i([r])}}:void 0,tabIndex:M?0:void 0,role:M?"button":"img","data-id":r,"data-testid":"rf__edge-".concat(r),"aria-label":null===k.ariaLabel?void 0:k.ariaLabel||"Edge from ".concat(k.source," to ").concat(k.target),"aria-describedby":M?"".concat(wi,"-").concat(b):void 0,ref:I,children:[!H&&h.jsx(P,{id:r,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:U,sourceY:G,targetX:$,targetY:W,sourcePosition:q,targetPosition:K,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:Q,markerEnd:J,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),O&&h.jsx(Ca,{edge:k,isUpdatable:O,edgeUpdaterRadius:p,onEdgeUpdate:g,onEdgeUpdateStart:y,onEdgeUpdateEnd:w,sourceX:U,sourceY:G,targetX:$,targetY:W,sourcePosition:q,targetPosition:K,setUpdateHover:R,setUpdating:Z,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle})]})})}var Aa=function(e){return{width:e.width,height:e.height,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError}};function za(n){var t=n.rfId,r=n.noPanClassName,o=n.onEdgeUpdate,i=D(Aa,Ce),a=i.edgesFocusable,u=i.edgesUpdatable,c=i.elementsSelectable,s=i.onError,l=function(n){var t=D(e.useCallback((function(e){return e.edges.map((function(e){return e.id}))}),[n]),Ce);return t}(!1);return h.jsxs("div",{className:"ink-flow__edges",children:[h.jsx(na,{defaultColor:"",rfId:t}),l.map((function(e){return h.jsx(Ia,{id:e,edgesFocusable:a,edgesUpdatable:u,elementsSelectable:c,noPanClassName:r,onEdgeUpdate:o,rfId:t,onError:s},e)}))]})}za.displayName="EdgeRenderer";var Ta=e.memo(za),Ba=function(e){return"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],")")};function Da(e){var n=e.children,t=D(Ba);return h.jsx("div",{className:"ink-flow__viewport xyflow__viewport ink-flow__container",style:{transform:t},children:n})}function La(e){var n=e.rfId,t=e.minZoom,r=e.maxZoom,o=e.noPanClassName,i=e.noDragClassName,a=e.nodeOrigin,u=e.viewport,c=e.disableKeyboardA11y,s=e.translateExtent,l=e.defaultViewport,d=e.nodeTypes,f=e.elementsSelectable,v=e.onPaneClick,p=e.onPaneContextMenu;return h.jsx(ai,{minZoom:t,maxZoom:r,noPanClassName:o,noDragClassName:i,isControlledViewport:!!u,disableKeyboardA11y:c,translateExtent:s,defaultViewport:l,elementsSelectable:f,onPaneClick:v,onPaneContextMenu:p,children:h.jsxs(Da,{children:[h.jsx(Ta,{rfId:n,noPanClassName:o}),h.jsx("div",{className:"ink-flow__edgelabel-renderer"}),h.jsx(qi,{rfId:n,nodeTypes:d,nodeOrigin:a,noDragClassName:i,noPanClassName:o,disableKeyboardA11y:!1}),h.jsx("div",{className:"ink-flow__viewport-portal"})]})})}La.displayName="GraphView";var Ra=e.memo(La),Va=function(e){var n,t,r=void 0===e?{}:e,o=r.nodes,i=r.edges,a=r.defaultNodes,u=r.defaultEdges;r.width,r.height,r.fitView;var c=new Map,s=new Map,l=new Map,d=new Map,f=null!==(n=null!=u?u:i)&&void 0!==n?n:[],h=null!==(t=null!=a?a:o)&&void 0!==t?t:[];Z(l,d,f),Y(h,c,s,{nodeOrigin:[0,0],elevateNodesOnSelect:!1});return{rfId:"1",width:0,height:0,transform:[0,0,1],nodes:h,nodeLookup:c,parentLookup:s,edges:f,edgeLookup:d,connectionLookup:l,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==a,hasDefaultEdges:void 0!==u,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:z,nodeExtent:z,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Pe.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,fitViewOnInit:!1,fitViewDone:!1,fitViewOnInitOptions:void 0,selectNodesOnDrag:!0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:void 0,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1}},Ha=function(e){var t,r,o=e.nodes,c=e.edges,s=e.defaultNodes,l=e.defaultEdges,d=e.width,f=e.height,h=e.fitView;return t=function(e,t){return n(n({},Va({nodes:o,edges:c,width:d,height:f,fitView:h,defaultNodes:s,defaultEdges:l})),{setNodes:function(n){var r=t();Y(n,r.nodeLookup,r.parentLookup,{nodeOrigin:r.nodeOrigin,elevateNodesOnSelect:r.elevateNodesOnSelect,checkEquality:!0}),e({nodes:n})},setEdges:function(n){var r=t();Z(r.connectionLookup,r.edgeLookup,n),e({edges:n})},setDefaultNodesAndEdges:function(n,r){n&&((0,t().setNodes)(n),e({hasDefaultNodes:!0})),r&&((0,t().setEdges)(r),e({hasDefaultEdges:!0}))},updateNodeInternals:function(r){var o=t(),i=o.triggerNodeChanges,c=o.fitView,s=o.nodeLookup,l=o.parentLookup,d=o.fitViewOnInit,f=o.fitViewDone,h=o.fitViewOnInitOptions,v=o.domNode,p=o.nodeOrigin,g=o.debug,y=function(e,t,r,o,i){var c=null==o?void 0:o.querySelector(".xyflow__viewport"),s=!1;if(!c)return{changes:[],updatedInternals:s};var l=[],d=window.getComputedStyle(c),f=new window.DOMMatrixReadOnly(d.transform).m22,h=[];if(e.forEach((function(e){var r=t.get(e.id);if(null==r?void 0:r.hidden)t.set(r.id,n(n({},r),{internals:n(n({},r.internals),{handleBounds:void 0})})),s=!0;else if(r){var o=ge(e.nodeElement),a=r.measured.width!==o.width||r.measured.height!==o.height;if(o.width&&o.height&&(a||!r.internals.handleBounds||e.force)){var u=n(n({},r),{measured:o,internals:n(n({},r.internals),{handleBounds:{source:_e(".source",e.nodeElement,f,r.origin||i),target:_e(".target",e.nodeElement,f,r.origin||i)}})});t.set(r.id,u),s=!0,a&&(l.push({id:u.id,type:"dimensions",dimensions:o}),u.expandParent&&u.parentId&&h.push({id:u.id,parentId:u.parentId,rect:K(u,u.origin||i)}))}}})),h.length>0){var v=X(h,t,r,i);l.push.apply(l,u([],a(v),!1))}return{changes:l,updatedInternals:s}}(r,s,l,v,p),m=y.changes;if(y.updatedInternals){R(s,{nodeOrigin:p});var w=f;!f&&d&&(w=c(n(n({},h),{nodes:null==h?void 0:h.nodes}))),e({fitViewDone:w}),(null==m?void 0:m.length)>0&&(g&&console.log("Ink Flow: trigger node changes",m),null==i||i(m))}},updateNodePositions:function(e,r){var o,c;void 0===r&&(r=!1);var s=[],l=[];try{for(var d=i(e),f=d.next();!f.done;f=d.next()){var h=a(f.value,2),v=h[0],p=h[1],g={id:v,type:"position",position:p.position,dragging:r};(null==p?void 0:p.expandParent)&&(null==p?void 0:p.parentId)&&g.position&&(s.push({id:v,parentId:p.parentId,rect:n(n({},p.internals.positionAbsolute),{width:p.measured.width,height:p.measured.height})}),g.position.x=Math.max(0,g.position.x),g.position.y=Math.max(0,g.position.y)),l.push(g)}}catch(e){o={error:e}}finally{try{f&&!f.done&&(c=d.return)&&c.call(d)}finally{if(o)throw o.error}}if(s.length>0){var y=t(),m=X(s,y.nodeLookup,y.parentLookup);l.push.apply(l,u([],a(m),!1))}t().triggerNodeChanges(l)},triggerNodeChanges:function(e){var n=t(),r=n.onNodesChange,o=n.setNodes,i=n.nodes,a=n.hasDefaultNodes,u=n.debug;(null==e?void 0:e.length)&&(a&&o(Ho(e,i)),u&&console.log("Ink Flow: trigger node changes",e),null==r||r(e))},triggerEdgeChanges:function(e){var n=t(),r=n.onEdgesChange,o=n.setEdges,i=n.edges,a=n.hasDefaultEdges,u=n.debug;(null==e?void 0:e.length)&&(a&&o(Vo(e,i)),u&&console.log("Ink Flow: trigger edge changes",e),null==r||r(e))},addSelectedNodes:function(e){var n=t(),r=n.multiSelectionActive,o=n.edgeLookup,i=n.nodeLookup,c=n.triggerNodeChanges,s=n.triggerEdgeChanges;r?c(e.map((function(e){return Zo(e,!0)}))):(c(Yo(i,new Set(u([],a(e),!1)),!0)),s(Yo(o)))},addSelectedEdges:function(e){var n=t(),r=n.multiSelectionActive,o=n.edgeLookup,i=n.nodeLookup,c=n.triggerNodeChanges,s=n.triggerEdgeChanges;r?s(e.map((function(e){return Zo(e,!0)}))):(s(Yo(o,new Set(u([],a(e),!1)))),c(Yo(i,new Set,!0)))},unselectNodesAndEdges:function(e){var n=void 0===e?{}:e,r=n.nodes,o=n.edges,i=t(),a=i.edges,u=i.nodes,c=i.triggerNodeChanges,s=i.triggerEdgeChanges,l=o||a,d=(r||u).map((function(e){return e.selected=!1,Zo(e.id,!1)})),f=l.map((function(e){return Zo(e.id,!1)}));c(d),s(f)},setMinZoom:function(n){var r=t(),o=r.panZoom,i=r.maxZoom;null==o||o.setScaleExtent([n,i]),e({minZoom:n})},setMaxZoom:function(n){var r=t(),o=r.panZoom,i=r.minZoom;null==o||o.setScaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:function(n){var r;null===(r=t().panZoom)||void 0===r||r.setTranslateExtent(n),e({translateExtent:n})},resetSelectedElements:function(){var e=t(),n=e.edges,r=e.nodes,o=e.triggerNodeChanges,i=e.triggerEdgeChanges,c=r.reduce((function(e,n){return n.selected?u(u([],a(e),!1),[Zo(n.id,!1)],!1):e}),[]),s=n.reduce((function(e,n){return n.selected?u(u([],a(e),!1),[Zo(n.id,!1)],!1):e}),[]);o(c),i(s)},setNodeExtent:function(r){var o,u,c=t().nodeLookup;try{for(var s=i(c),l=s.next();!l.done;l=s.next()){var d=a(l.value,2)[1],f=U(d.position,r);c.set(d.id,n(n({},d),{internals:n(n({},d.internals),{positionAbsolute:f})}))}}catch(e){o={error:e}}finally{try{l&&!l.done&&(u=s.return)&&u.call(s)}finally{if(o)throw o.error}}e({nodeExtent:r})},panBy:function(e){var n=t(),r=n.transform,o=n.width,i=n.height;return function(e){var n=e.delta,t=e.panZoom,r=e.transform,o=e.translateExtent,i=e.width,a=e.height;if(!t||!n.x&&!n.y)return!1;var u=t.setViewportConstrained({x:r[0]+n.x,y:r[1]+n.y,zoom:r[2]},[[0,0],[i,a]],o);return!!u&&(u.x!==r[0]||u.y!==r[1]||u.k!==r[2])}({delta:e,panZoom:n.panZoom,transform:r,translateExtent:n.translateExtent,width:o,height:i})},fitView:function(e){var n=t(),r=n.panZoom,o=n.width,i=n.height,a=n.minZoom,u=n.maxZoom,c=n.nodeOrigin,s=n.nodeLookup;return!!r&&qo({nodeLookup:s,width:o,height:i,panZoom:r,minZoom:a,maxZoom:u,nodeOrigin:c},e)},cancelConnection:function(){return e({connectionStatus:null,connectionStartHandle:null,connectionEndHandle:null})},updateConnection:function(r){var o,i=t().connectionPosition,a=n(n({},r),{connectionPosition:null!==(o=r.connectionPosition)&&void 0!==o?o:i});e(a)},reset:function(){return e(n({},Va()))}})},r=Object.is,t?O(t,r):O};function Za(n){var t=n.initialNodes,r=n.initialEdges,o=n.defaultNodes,i=n.defaultEdges,u=n.initialWidth,c=n.initialHeight,s=n.fitView,l=n.children,d=a(e.useState((function(){return Ha({nodes:t,edges:r,defaultNodes:o,defaultEdges:i,width:u,height:c,fitView:s})})),1)[0];return h.jsx(I,{value:d,children:h.jsx(li,{children:l})})}function Ya(n){var t=n.children,r=n.nodes,o=n.edges,i=n.defaultNodes,a=n.defaultEdges,u=n.width,c=n.height,s=n.fitView;return e.useContext(j)?h.jsx(h.Fragment,{children:t}):h.jsx(Za,{initialNodes:r,initialEdges:o,defaultNodes:i,defaultEdges:a,initialWidth:u,initialHeight:c,fitView:s,children:t})}var Xa={x:0,y:0,zoom:1},Fa=u(u([],a(["nodes","edges","defaultNodes","defaultEdges","nodesDraggable","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","translateExtent","defaultEdgeOptions","fitView","fitViewOptions"]),!1),["rfId"],!1),Ua=function(e){return{setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}},Ga={translateExtent:z,nodeOrigin:[0,0],minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function $a(n){var t=D(Ua,Ce),r=t.setNodes,o=t.setEdges,a=t.setMinZoom,u=t.setMaxZoom,c=t.setTranslateExtent,s=t.setNodeExtent,l=t.reset,d=t.setDefaultNodesAndEdges,f=L();e.useEffect((function(){return d(n.defaultNodes,n.defaultEdges),function(){h.current=Ga,l()}}),[]);var h=e.useRef(Ga);return e.useEffect((function(){var e,t,l;try{for(var d=i(Fa),v=d.next();!v.done;v=d.next()){var p=v.value,g=n[p];g!==h.current[p]&&(void 0!==n[p]&&("nodes"===p?r(g):"edges"===p?o(g):"minZoom"===p?a(g):"maxZoom"===p?u(g):"translateExtent"===p?c(g):"nodeExtent"===p?s(g):"fitView"===p?f.setState({fitViewOnInit:g}):"fitViewOptions"===p?f.setState({fitViewOnInitOptions:g}):f.setState(((l={})[p]=g,l))))}}catch(n){e={error:n}}finally{try{v&&!v.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}h.current=n}),Fa.map((function(e){return n[e]}))),null}var Wa={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var qa=re((function(e,r){var o=e.nodes,i=e.edges,a=e.translateExtent,u=void 0===a?z:a,c=e.defaultViewport,s=void 0===c?Xa:c,l=e.minZoom,d=void 0===l?.5:l,f=e.maxZoom,v=void 0===f?2:f,p=e.nodeOrigin,g=e.noDragClassName,y=e.noPanClassName,w=e.disableKeyboardA11y,b=e.nodeTypes,x=e.onNodesChange,_=e.onEdgesChange,E=e.fitView,S=e.fitViewOptions,k=e.nodeExtent,N=e.nodesDraggable,C=e.children,P=e.id,M=e.width,O=e.height,j=e.onPaneClick,I=e.onPaneContextMenu,A=t(e,["nodes","edges","translateExtent","defaultViewport","minZoom","maxZoom","nodeOrigin","noDragClassName","noPanClassName","disableKeyboardA11y","nodeTypes","onNodesChange","onEdgesChange","fitView","fitViewOptions","nodeExtent","nodesDraggable","children","id","width","height","onPaneClick","onPaneContextMenu"]),T=P||"1";return console.log("yk 22",j,I),h.jsx("div",n({},A,{ref:r,style:n({},Wa),className:m(["ink-flow"]),"data-testid":"rf__wrapper",id:P,children:h.jsxs(Ya,{nodes:o,edges:i,width:M,height:O,fitView:E,children:[h.jsx(Ra,{rfId:T,nodeTypes:b,minZoom:d,maxZoom:v,nodeOrigin:p,noDragClassName:g,noPanClassName:y,disableKeyboardA11y:w,translateExtent:u,defaultViewport:s,onPaneClick:j,onPaneContextMenu:I}),h.jsx($a,{nodes:o,edges:i,rfId:T,onNodesChange:x,onEdgesChange:_,fitView:E,fitViewOptions:S,nodeExtent:k,nodesDraggable:N}),C]})}))}));function Ka(){return h.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10 4.375C10.3452 4.375 10.625 4.65482 10.625 5V9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H10.625V15C10.625 15.3452 10.3452 15.625 10 15.625C9.65482 15.625 9.375 15.3452 9.375 15V10.625H5C4.65482 10.625 4.375 10.3452 4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H9.375V5C9.375 4.65482 9.65482 4.375 10 4.375Z",fill:"#6B7280"})})}function Qa(){return h.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H5C4.65482 10.625 4.375 10.3452 4.375 10Z",fill:"#6B7280"})})}function Ja(){return h.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10 1.875C10.3452 1.875 10.625 2.15482 10.625 2.5V3.57152C13.6929 3.86613 16.1339 6.30708 16.4285 9.375H17.5C17.8452 9.375 18.125 9.65482 18.125 10C18.125 10.3452 17.8452 10.625 17.5 10.625H16.4285C16.1339 13.6929 13.6929 16.1339 10.625 16.4285V17.5C10.625 17.8452 10.3452 18.125 10 18.125C9.65482 18.125 9.375 17.8452 9.375 17.5V16.4285C6.30708 16.1339 3.86613 13.6929 3.57152 10.625H2.5C2.15482 10.625 1.875 10.3452 1.875 10C1.875 9.65482 2.15482 9.375 2.5 9.375H3.57152C3.86613 6.30708 6.30708 3.86613 9.375 3.57152V2.5C9.375 2.15482 9.65482 1.875 10 1.875ZM4.82878 10.625H5.83333C6.17851 10.625 6.45833 10.3452 6.45833 10C6.45833 9.65482 6.17851 9.375 5.83333 9.375H4.82878C5.11304 6.99811 6.99811 5.11304 9.375 4.82878V5.83333C9.375 6.17851 9.65482 6.45833 10 6.45833C10.3452 6.45833 10.625 6.17851 10.625 5.83333V4.82878C13.0019 5.11304 14.887 6.99811 15.1712 9.375H14.1667C13.8215 9.375 13.5417 9.65482 13.5417 10C13.5417 10.3452 13.8215 10.625 14.1667 10.625H15.1712C14.887 13.0019 13.0019 14.887 10.625 15.1712V14.1667C10.625 13.8215 10.3452 13.5417 10 13.5417C9.65482 13.5417 9.375 13.8215 9.375 14.1667V15.1712C6.99811 14.887 5.11304 13.0019 4.82878 10.625Z",fill:"#6B7280"})})}function eu(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:h.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function nu(){return h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:h.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function tu(e){var r=e.children,o=e.className,i=t(e,["children","className"]);return h.jsx("button",n({type:"button",className:m(["ink-flow__controls-button",o])},i,{children:r}))}var ru=function(e){return e.userSelectionActive?"none":"all"};function ou(e){var r=e.position,o=void 0===r?"top-left":r,i=e.children,c=e.className,s=e.style,l=t(e,["position","children","className","style"]),d=D(ru),f="".concat(o).split("-");return h.jsx("div",n({className:m(u(["ink-flow__panel",c],a(f),!1)),style:n(n({},s),{pointerEvents:d})},l,{children:i}))}var iu=function(e){return{isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}};function au(e){var n=e.style,t=e.showZoom,r=void 0===t||t,o=e.showFitView,i=void 0===o||o,a=e.showInteractive,u=void 0===a||a,c=e.fitViewOptions,s=e.onZoomIn,l=e.onZoomOut,d=e.onFitView,f=e.onInteractiveChange,v=e.className,p=e.children,g=e.position,y=void 0===g?"bottom-left":g,w=e.orientation,b=void 0===w?"vertical":w,x=e["aria-label"],_=void 0===x?"Ink Flow controls":x,E=L(),S=D(iu,Ce),k=S.isInteractive,N=S.minZoomReached,C=S.maxZoomReached,P=hi(),M=P.zoomIn,O=P.zoomOut,j=P.fitView,I="horizontal"===b?"horizontal":"vertical";return h.jsxs(ou,{className:m(["ink-flow__controls",I,v]),position:y,style:n,"data-testid":"rf__controls","aria-label":_,children:[i&&h.jsx(tu,{className:"ink-flow__controls-fitview",onClick:function(){j(c),null==d||d()},title:"fit view","aria-label":"fit view",children:h.jsx(Ja,{})}),r&&h.jsxs("div",{className:"ink-flow__controls-zoom",children:[h.jsx(tu,{onClick:function(){M(),null==s||s()},className:"ink-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:C,children:h.jsx(Ka,{})}),h.jsx(tu,{onClick:function(){O(),null==l||l()},className:"ink-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:N,children:h.jsx(Qa,{})})]}),u&&h.jsx(tu,{className:"ink-flow__controls-interactive",onClick:function(){E.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),null==f||f(!k)},title:"toggle interactivity","aria-label":"toggle interactivity",children:k?h.jsx(nu,{}):h.jsx(eu,{})}),p]})}au.displayName="Controls";var uu=e.memo(au);console.log("types");var cu,su,lu,du,fu,hu,vu,pu,gu,yu,mu,wu,bu,xu,_u,Eu,Su,ku,Nu,Cu,Pu,Mu,Ou,ju,Iu,Au,zu,Tu,Bu,Du,Lu,Ru,Vu,Hu,Zu,Yu,Xu,Fu,Uu,Gu,$u,Wu,qu,Ku,Qu,Ju,ec,nc,tc,rc,oc,ic,ac,uc,cc,sc,lc,dc,fc,hc,vc,pc,gc,yc,mc,wc,bc,xc,_c,Ec,Sc,kc,Nc,Cc,Pc,Mc,Oc,jc,Ic,Ac,zc,Tc,Bc,Dc,Lc,Rc,Vc,Hc,Zc,Yc,Xc,Fc,Uc,Gc,$c,Wc,qc,Kc,Qc,Jc,es,ns,ts,rs,os,is,as,us,cs="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ss(){return du?lu:(du=1,lu=function(e,n){return e===n||e!=e&&n!=n})}function ls(){if(hu)return fu;hu=1;var e=ss();return fu=function(n,t){for(var r=n.length;r--;)if(e(n[r][0],t))return r;return-1}}function ds(){if(Eu)return _u;Eu=1;var e=su?cu:(su=1,cu=function(){this.__data__=[],this.size=0}),n=function(){if(pu)return vu;pu=1;var e=ls(),n=Array.prototype.splice;return vu=function(t){var r=this.__data__,o=e(r,t);return!(o<0||(o==r.length-1?r.pop():n.call(r,o,1),--this.size,0))}}(),t=function(){if(yu)return gu;yu=1;var e=ls();return gu=function(n){var t=this.__data__,r=e(t,n);return r<0?void 0:t[r][1]}}(),r=function(){if(wu)return mu;wu=1;var e=ls();return mu=function(n){return e(this.__data__,n)>-1}}(),o=function(){if(xu)return bu;xu=1;var e=ls();return bu=function(n,t){var r=this.__data__,o=e(r,n);return o<0?(++this.size,r.push([n,t])):r[o][1]=t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,_u=i}function fs(){if(Au)return Iu;Au=1;var e="object"==typeof cs&&cs&&cs.Object===Object&&cs;return Iu=e}function hs(){if(Tu)return zu;Tu=1;var e=fs(),n="object"==typeof self&&self&&self.Object===Object&&self,t=e||n||Function("return this")();return zu=t}function vs(){if(Du)return Bu;Du=1;var e=hs().Symbol;return Bu=e}function ps(){if(Yu)return Zu;Yu=1;var e=vs(),n=function(){if(Ru)return Lu;Ru=1;var e=vs(),n=Object.prototype,t=n.hasOwnProperty,r=n.toString,o=e?e.toStringTag:void 0;return Lu=function(e){var n=t.call(e,o),i=e[o];try{e[o]=void 0;var a=!0}catch(e){}var u=r.call(e);return a&&(n?e[o]=i:delete e[o]),u}}(),t=function(){if(Hu)return Vu;Hu=1;var e=Object.prototype.toString;return Vu=function(n){return e.call(n)}}(),r=e?e.toStringTag:void 0;return Zu=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?n(e):t(e)}}function gs(){return Fu?Xu:(Fu=1,Xu=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)})}function ys(){if(Gu)return Uu;Gu=1;var e=ps(),n=gs();return Uu=function(t){if(!n(t))return!1;var r=e(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function ms(){if(Ju)return Qu;Ju=1;var e=Function.prototype.toString;return Qu=function(n){if(null!=n){try{return e.call(n)}catch(e){}try{return n+""}catch(e){}}return""}}function ws(){if(ic)return oc;ic=1;var e=function(){if(nc)return ec;nc=1;var e=ys(),n=function(){if(Ku)return qu;Ku=1;var e,n=function(){if(Wu)return $u;Wu=1;var e=hs()["__core-js_shared__"];return $u=e}(),t=(e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return qu=function(e){return!!t&&t in e}}(),t=gs(),r=ms(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,u=i.toString,c=a.hasOwnProperty,s=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return ec=function(i){return!(!t(i)||n(i))&&(e(i)?s:o).test(r(i))}}(),n=rc?tc:(rc=1,tc=function(e,n){return null==e?void 0:e[n]});return oc=function(t,r){var o=n(t,r);return e(o)?o:void 0}}function bs(){if(uc)return ac;uc=1;var e=ws()(hs(),"Map");return ac=e}function xs(){if(sc)return cc;sc=1;var e=ws()(Object,"create");return cc=e}function _s(){if(Cc)return Nc;Cc=1;var e=kc?Sc:(kc=1,Sc=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e});return Nc=function(n,t){var r=n.__data__;return e(t)?r["string"==typeof t?"string":"hash"]:r.map}}function Es(){if(Dc)return Bc;Dc=1;var e=function(){if(Ec)return _c;Ec=1;var e=function(){if(xc)return bc;xc=1;var e=function(){if(dc)return lc;dc=1;var e=xs();return lc=function(){this.__data__=e?e(null):{},this.size=0}}(),n=hc?fc:(hc=1,fc=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}),t=function(){if(pc)return vc;pc=1;var e=xs(),n=Object.prototype.hasOwnProperty;return vc=function(t){var r=this.__data__;if(e){var o=r[t];return"__lodash_hash_undefined__"===o?void 0:o}return n.call(r,t)?r[t]:void 0}}(),r=function(){if(yc)return gc;yc=1;var e=xs(),n=Object.prototype.hasOwnProperty;return gc=function(t){var r=this.__data__;return e?void 0!==r[t]:n.call(r,t)}}(),o=function(){if(wc)return mc;wc=1;var e=xs();return mc=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=e&&void 0===t?"__lodash_hash_undefined__":t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,bc=i}(),n=ds(),t=bs();return _c=function(){this.size=0,this.__data__={hash:new e,map:new(t||n),string:new e}}}(),n=function(){if(Mc)return Pc;Mc=1;var e=_s();return Pc=function(n){var t=e(this,n).delete(n);return this.size-=t?1:0,t}}(),t=function(){if(jc)return Oc;jc=1;var e=_s();return Oc=function(n){return e(this,n).get(n)}}(),r=function(){if(Ac)return Ic;Ac=1;var e=_s();return Ic=function(n){return e(this,n).has(n)}}(),o=function(){if(Tc)return zc;Tc=1;var e=_s();return zc=function(n,t){var r=e(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,Bc=i}function Ss(){if(Hc)return Vc;Hc=1;var e=ds(),n=function(){if(ku)return Su;ku=1;var e=ds();return Su=function(){this.__data__=new e,this.size=0}}(),t=Cu?Nu:(Cu=1,Nu=function(e){var n=this.__data__,t=n.delete(e);return this.size=n.size,t}),r=Mu?Pu:(Mu=1,Pu=function(e){return this.__data__.get(e)}),o=ju?Ou:(ju=1,Ou=function(e){return this.__data__.has(e)}),i=function(){if(Rc)return Lc;Rc=1;var e=ds(),n=bs(),t=Es();return Lc=function(r,o){var i=this.__data__;if(i instanceof e){var a=i.__data__;if(!n||a.length<199)return a.push([r,o]),this.size=++i.size,this;i=this.__data__=new t(a)}return i.set(r,o),this.size=i.size,this}}();function a(n){var t=this.__data__=new e(n);this.size=t.size}return a.prototype.clear=n,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=o,a.prototype.set=i,Vc=a}function ks(){return Yc?Zc:(Yc=1,Zc=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r&&!1!==n(e[t],t,e););return e})}function Ns(){if(Fc)return Xc;Fc=1;var e=ws(),n=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch(e){}}();return Xc=n}function Cs(){if(Gc)return Uc;Gc=1;var e=Ns();return Uc=function(n,t,r){"__proto__"==t&&e?e(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}}function Ps(){if(Wc)return $c;Wc=1;var e=Cs(),n=ss(),t=Object.prototype.hasOwnProperty;return $c=function(r,o,i){var a=r[o];t.call(r,o)&&n(a,i)&&(void 0!==i||o in r)||e(r,o,i)}}function Ms(){if(Kc)return qc;Kc=1;var e=Ps(),n=Cs();return qc=function(t,r,o,i){var a=!o;o||(o={});for(var u=-1,c=r.length;++u<c;){var s=r[u],l=i?i(o[s],t[s],s,o,t):void 0;void 0===l&&(l=t[s]),a?n(o,s,l):e(o,s,l)}return o}}function Os(){return ns?es:(ns=1,es=function(e){return null!=e&&"object"==typeof e})}function js(){if(is)return os;is=1;var e=function(){if(rs)return ts;rs=1;var e=ps(),n=Os();return ts=function(t){return n(t)&&"[object Arguments]"==e(t)}}(),n=Os(),t=Object.prototype,r=t.hasOwnProperty,o=t.propertyIsEnumerable,i=e(function(){return arguments}())?e:function(e){return n(e)&&r.call(e,"callee")&&!o.call(e,"callee")};return os=i}function Is(){if(us)return as;us=1;var e=Array.isArray;return as=e}var As,zs,Ts,Bs,Ds,Ls,Rs,Vs,Hs,Zs,Ys,Xs={exports:{}};function Fs(){return Ts||(Ts=1,function(e,n){var t=hs(),r=zs?As:(zs=1,As=function(){return!1}),o=n&&!n.nodeType&&n,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o?t.Buffer:void 0,u=(a?a.isBuffer:void 0)||r;e.exports=u}(Xs,Xs.exports)),Xs.exports}function Us(){if(Ds)return Bs;Ds=1;var e=/^(?:0|[1-9]\d*)$/;return Bs=function(n,t){var r=typeof n;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&e.test(n))&&n>-1&&n%1==0&&n<t}}function Gs(){return Rs?Ls:(Rs=1,Ls=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991})}function $s(){return Ys?Zs:(Ys=1,Zs=function(e){return function(n){return e(n)}})}Xs.exports;var Ws,qs,Ks,Qs,Js,el,nl,tl,rl,ol,il,al,ul,cl,sl,ll,dl,fl,hl,vl,pl,gl,yl,ml,wl,bl,xl,_l={exports:{}};function El(){return Ws||(Ws=1,e=_l,n=_l.exports,t=fs(),r=n&&!n.nodeType&&n,o=r&&e&&!e.nodeType&&e,i=o&&o.exports===r&&t.process,a=function(){try{return o&&o.require&&o.require("util").types||i&&i.binding&&i.binding("util")}catch(e){}}(),e.exports=a),_l.exports;var e,n,t,r,o,i,a}function Sl(){if(Ks)return qs;Ks=1;var e=function(){if(Hs)return Vs;Hs=1;var e=ps(),n=Gs(),t=Os(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,Vs=function(o){return t(o)&&n(o.length)&&!!r[e(o)]}}(),n=$s(),t=El(),r=t&&t.isTypedArray,o=r?n(r):e;return qs=o}function kl(){if(Js)return Qs;Js=1;var e=Jc?Qc:(Jc=1,Qc=function(e,n){for(var t=-1,r=Array(e);++t<e;)r[t]=n(t);return r}),n=js(),t=Is(),r=Fs(),o=Us(),i=Sl(),a=Object.prototype.hasOwnProperty;return Qs=function(u,c){var s=t(u),l=!s&&n(u),d=!s&&!l&&r(u),f=!s&&!l&&!d&&i(u),h=s||l||d||f,v=h?e(u.length,String):[],p=v.length;for(var g in u)!c&&!a.call(u,g)||h&&("length"==g||d&&("offset"==g||"parent"==g)||f&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||o(g,p))||v.push(g);return v}}function Nl(){if(nl)return el;nl=1;var e=Object.prototype;return el=function(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||e)}}function Cl(){return rl?tl:(rl=1,tl=function(e,n){return function(t){return e(n(t))}})}function Pl(){if(ul)return al;ul=1;var e=Nl(),n=function(){if(il)return ol;il=1;var e=Cl()(Object.keys,Object);return ol=e}(),t=Object.prototype.hasOwnProperty;return al=function(r){if(!e(r))return n(r);var o=[];for(var i in Object(r))t.call(r,i)&&"constructor"!=i&&o.push(i);return o}}function Ml(){if(sl)return cl;sl=1;var e=ys(),n=Gs();return cl=function(t){return null!=t&&n(t.length)&&!e(t)}}function Ol(){if(dl)return ll;dl=1;var e=kl(),n=Pl(),t=Ml();return ll=function(r){return t(r)?e(r):n(r)}}function jl(){if(wl)return ml;wl=1;var e=kl(),n=function(){if(yl)return gl;yl=1;var e=gs(),n=Nl(),t=pl?vl:(pl=1,vl=function(e){var n=[];if(null!=e)for(var t in Object(e))n.push(t);return n}),r=Object.prototype.hasOwnProperty;return gl=function(o){if(!e(o))return t(o);var i=n(o),a=[];for(var u in o)("constructor"!=u||!i&&r.call(o,u))&&a.push(u);return a}}(),t=Ml();return ml=function(r){return t(r)?e(r,!0):n(r)}}_l.exports;var Il,Al,zl,Tl,Bl,Dl,Ll,Rl,Vl,Hl,Zl,Yl,Xl,Fl,Ul,Gl,$l,Wl,ql,Kl,Ql,Jl,ed,nd,td,rd,od,id,ad,ud,cd,sd,ld,dd,fd,hd,vd,pd,gd,yd,md,wd,bd,xd,_d,Ed,Sd,kd,Nd,Cd,Pd,Md,Od,jd,Id,Ad,zd,Td,Bd,Dd,Ld,Rd,Vd,Hd,Zd,Yd,Xd,Fd,Ud,Gd,$d,Wd,qd,Kd,Qd,Jd,ef,nf,tf,rf,of,af,uf,cf,sf,lf,df,ff,hf,vf,pf,gf,yf,mf,wf,bf,xf,_f,Ef,Sf,kf,Nf,Cf,Pf,Mf,Of,jf,If,Af,zf,Tf,Bf,Df,Lf,Rf,Vf,Hf,Zf,Yf,Xf,Ff,Uf,Gf,$f,Wf,qf,Kf,Qf,Jf,eh,nh,th,rh,oh,ih,ah,uh,ch,sh,lh,dh,fh,hh,vh,ph,gh,yh,mh,wh,bh,xh,_h,Eh,Sh,kh,Nh,Ch,Ph,Mh,Oh,jh,Ih,Ah,zh,Th,Bh,Dh,Lh,Rh,Vh,Hh,Zh,Yh,Xh,Fh,Uh,Gh,$h,Wh,qh,Kh,Qh,Jh,ev,nv,tv,rv,ov,iv,av,uv,cv,sv,lv,dv,fv,hv,vv,pv,gv,yv,mv,wv,bv,xv,_v,Ev,Sv,kv,Nv,Cv,Pv,Mv,Ov,jv,Iv,Av,zv,Tv,Bv,Dv,Lv,Rv,Vv,Hv,Zv,Yv,Xv,Fv,Uv,Gv,$v,Wv,qv,Kv,Qv,Jv,ep,np,tp,rp,op,ip,ap,up,cp,sp,lp,dp,fp,hp,vp,pp,gp,yp,mp,wp,bp,xp,_p,Ep,Sp,kp,Np,Cp,Pp,Mp,Op,jp,Ip,Ap,zp,Tp,Bp,Dp,Lp,Rp,Vp,Hp,Zp,Yp={exports:{}};function Xp(){return Il||(Il=1,e=Yp,n=Yp.exports,t=hs(),i=(o=(r=n&&!n.nodeType&&n)&&e&&!e.nodeType&&e)&&o.exports===r?t.Buffer:void 0,a=i?i.allocUnsafe:void 0,e.exports=function(e,n){if(n)return e.slice();var t=e.length,r=a?a(t):new e.constructor(t);return e.copy(r),r}),Yp.exports;var e,n,t,r,o,i,a}function Fp(){return zl?Al:(zl=1,Al=function(e,n){var t=-1,r=e.length;for(n||(n=Array(r));++t<r;)n[t]=e[t];return n})}function Up(){return Bl?Tl:(Bl=1,Tl=function(e,n){for(var t=-1,r=null==e?0:e.length,o=0,i=[];++t<r;){var a=e[t];n(a,t,e)&&(i[o++]=a)}return i})}function Gp(){return Ll?Dl:(Ll=1,Dl=function(){return[]})}function $p(){if(Vl)return Rl;Vl=1;var e=Up(),n=Gp(),t=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return Rl=r?function(n){return null==n?[]:(n=Object(n),e(r(n),(function(e){return t.call(n,e)})))}:n}function Wp(){return Xl?Yl:(Xl=1,Yl=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e})}function qp(){if(Ul)return Fl;Ul=1;var e=Cl()(Object.getPrototypeOf,Object);return Fl=e}function Kp(){if($l)return Gl;$l=1;var e=Wp(),n=qp(),t=$p(),r=Gp(),o=Object.getOwnPropertySymbols;return Gl=o?function(r){for(var o=[];r;)e(o,t(r)),r=n(r);return o}:r}function Qp(){if(Ql)return Kl;Ql=1;var e=Wp(),n=Is();return Kl=function(t,r,o){var i=r(t);return n(t)?i:e(i,o(t))}}function Jp(){if(ed)return Jl;ed=1;var e=Qp(),n=$p(),t=Ol();return Jl=function(r){return e(r,t,n)}}function eg(){if(cd)return ud;cd=1;var e=ws()(hs(),"Set");return ud=e}function ng(){if(fd)return dd;fd=1;var e=function(){if(od)return rd;od=1;var e=ws()(hs(),"DataView");return rd=e}(),n=bs(),t=function(){if(ad)return id;ad=1;var e=ws()(hs(),"Promise");return id=e}(),r=eg(),o=function(){if(ld)return sd;ld=1;var e=ws()(hs(),"WeakMap");return sd=e}(),i=ps(),a=ms(),u="[object Map]",c="[object Promise]",s="[object Set]",l="[object WeakMap]",d="[object DataView]",f=a(e),h=a(n),v=a(t),p=a(r),g=a(o),y=i;return(e&&y(new e(new ArrayBuffer(1)))!=d||n&&y(new n)!=u||t&&y(t.resolve())!=c||r&&y(new r)!=s||o&&y(new o)!=l)&&(y=function(e){var n=i(e),t="[object Object]"==n?e.constructor:void 0,r=t?a(t):"";if(r)switch(r){case f:return d;case h:return u;case v:return c;case p:return s;case g:return l}return n}),dd=y}function tg(){if(gd)return pd;gd=1;var e=hs().Uint8Array;return pd=e}function rg(){if(md)return yd;md=1;var e=tg();return yd=function(n){var t=new n.constructor(n.byteLength);return new e(t).set(new e(n)),t}}function og(){if(Nd)return kd;Nd=1;var e=rg();return kd=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}}function ig(){if(Od)return Md;Od=1;var e=gs(),n=Object.create,t=function(){function t(){}return function(r){if(!e(r))return{};if(n)return n(r);t.prototype=r;var o=new t;return t.prototype=void 0,o}}();return Md=t}function ag(){if(Id)return jd;Id=1;var e=ig(),n=qp(),t=Nl();return jd=function(r){return"function"!=typeof r.constructor||t(r)?{}:e(n(r))}}function ug(){if(Zd)return Hd;Zd=1;var e=Ss(),n=ks(),t=Ps(),r=function(){if(hl)return fl;hl=1;var e=Ms(),n=Ol();return fl=function(t,r){return t&&e(r,n(r),t)}}(),o=function(){if(xl)return bl;xl=1;var e=Ms(),n=jl();return bl=function(t,r){return t&&e(r,n(r),t)}}(),i=Xp(),a=Fp(),u=function(){if(Zl)return Hl;Zl=1;var e=Ms(),n=$p();return Hl=function(t,r){return e(t,n(t),r)}}(),c=function(){if(ql)return Wl;ql=1;var e=Ms(),n=Kp();return Wl=function(t,r){return e(t,n(t),r)}}(),s=Jp(),l=function(){if(td)return nd;td=1;var e=Qp(),n=Kp(),t=jl();return nd=function(r){return e(r,t,n)}}(),d=ng(),f=function(){if(vd)return hd;vd=1;var e=Object.prototype.hasOwnProperty;return hd=function(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&e.call(n,"index")&&(r.index=n.index,r.input=n.input),r}}(),h=function(){if(Pd)return Cd;Pd=1;var e=rg(),n=function(){if(bd)return wd;bd=1;var e=rg();return wd=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}}(),t=function(){if(_d)return xd;_d=1;var e=/\w*$/;return xd=function(n){var t=new n.constructor(n.source,e.exec(n));return t.lastIndex=n.lastIndex,t}}(),r=function(){if(Sd)return Ed;Sd=1;var e=vs(),n=e?e.prototype:void 0,t=n?n.valueOf:void 0;return Ed=function(e){return t?Object(t.call(e)):{}}}(),o=og();return Cd=function(i,a,u){var c=i.constructor;switch(a){case"[object ArrayBuffer]":return e(i);case"[object Boolean]":case"[object Date]":return new c(+i);case"[object DataView]":return n(i,u);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return o(i,u);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(i);case"[object RegExp]":return t(i);case"[object Symbol]":return r(i)}}}(),v=ag(),p=Is(),g=Fs(),y=function(){if(Bd)return Td;Bd=1;var e=function(){if(zd)return Ad;zd=1;var e=ng(),n=Os();return Ad=function(t){return n(t)&&"[object Map]"==e(t)}}(),n=$s(),t=El(),r=t&&t.isMap,o=r?n(r):e;return Td=o}(),m=gs(),w=function(){if(Vd)return Rd;Vd=1;var e=function(){if(Ld)return Dd;Ld=1;var e=ng(),n=Os();return Dd=function(t){return n(t)&&"[object Set]"==e(t)}}(),n=$s(),t=El(),r=t&&t.isSet,o=r?n(r):e;return Rd=o}(),b=Ol(),x=jl(),_="[object Arguments]",E="[object Function]",S="[object Object]",k={};return k[_]=k["[object Array]"]=k["[object ArrayBuffer]"]=k["[object DataView]"]=k["[object Boolean]"]=k["[object Date]"]=k["[object Float32Array]"]=k["[object Float64Array]"]=k["[object Int8Array]"]=k["[object Int16Array]"]=k["[object Int32Array]"]=k["[object Map]"]=k["[object Number]"]=k[S]=k["[object RegExp]"]=k["[object Set]"]=k["[object String]"]=k["[object Symbol]"]=k["[object Uint8Array]"]=k["[object Uint8ClampedArray]"]=k["[object Uint16Array]"]=k["[object Uint32Array]"]=!0,k["[object Error]"]=k[E]=k["[object WeakMap]"]=!1,Hd=function N(C,P,M,O,j,I){var A,z=1&P,T=2&P,B=4&P;if(M&&(A=j?M(C,O,j,I):M(C)),void 0!==A)return A;if(!m(C))return C;var D=p(C);if(D){if(A=f(C),!z)return a(C,A)}else{var L=d(C),R=L==E||"[object GeneratorFunction]"==L;if(g(C))return i(C,z);if(L==S||L==_||R&&!j){if(A=T||R?{}:v(C),!z)return T?c(C,o(A,C)):u(C,r(A,C))}else{if(!k[L])return j?C:{};A=h(C,L,z)}}I||(I=new e);var V=I.get(C);if(V)return V;I.set(C,A),w(C)?C.forEach((function(e){A.add(N(e,P,M,e,C,I))})):y(C)&&C.forEach((function(e,n){A.set(n,N(e,P,M,n,C,I))}));var H=D?void 0:(B?T?l:s:T?x:b)(C);return n(H||C,(function(e,n){H&&(e=C[n=e]),t(A,n,N(e,P,M,n,C,I))})),A},Hd}function cg(){if(Xd)return Yd;Xd=1;var e=ug();return Yd=function(n){return e(n,4)}}function sg(){return Ud?Fd:(Ud=1,Fd=function(e){return function(){return e}})}function lg(){if(qd)return Wd;qd=1;var e=($d?Gd:($d=1,Gd=function(e){return function(n,t,r){for(var o=-1,i=Object(n),a=r(n),u=a.length;u--;){var c=a[e?u:++o];if(!1===t(i[c],c,i))break}return n}}))();return Wd=e}function dg(){if(Qd)return Kd;Qd=1;var e=lg(),n=Ol();return Kd=function(t,r){return t&&e(t,r,n)}}function fg(){if(tf)return nf;tf=1;var e=dg(),n=function(){if(ef)return Jd;ef=1;var e=Ml();return Jd=function(n,t){return function(r,o){if(null==r)return r;if(!e(r))return n(r,o);for(var i=r.length,a=t?i:-1,u=Object(r);(t?a--:++a<i)&&!1!==o(u[a],a,u););return r}}}()(e);return nf=n}function hg(){return of?rf:(of=1,rf=function(e){return e})}function vg(){if(uf)return af;uf=1;var e=hg();return af=function(n){return"function"==typeof n?n:e}}function pg(){if(sf)return cf;sf=1;var e=ks(),n=fg(),t=vg(),r=Is();return cf=function(o,i){return(r(o)?e:n)(o,t(i))}}function gg(){return df?lf:(df=1,lf=pg())}function yg(){if(wf)return mf;wf=1;var e=Es(),n=pf?vf:(pf=1,vf=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),t=yf?gf:(yf=1,gf=function(e){return this.__data__.has(e)});function r(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new e;++t<r;)this.add(n[t])}return r.prototype.add=r.prototype.push=n,r.prototype.has=t,mf=r}function mg(){return Ef?_f:(Ef=1,_f=function(e,n){return e.has(n)})}function wg(){if(kf)return Sf;kf=1;var e=yg(),n=xf?bf:(xf=1,bf=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r;)if(n(e[t],t,e))return!0;return!1}),t=mg();return Sf=function(r,o,i,a,u,c){var s=1&i,l=r.length,d=o.length;if(l!=d&&!(s&&d>l))return!1;var f=c.get(r),h=c.get(o);if(f&&h)return f==o&&h==r;var v=-1,p=!0,g=2&i?new e:void 0;for(c.set(r,o),c.set(o,r);++v<l;){var y=r[v],m=o[v];if(a)var w=s?a(m,y,v,o,r,c):a(y,m,v,r,o,c);if(void 0!==w){if(w)continue;p=!1;break}if(g){if(!n(o,(function(e,n){if(!t(g,n)&&(y===e||u(y,e,i,a,c)))return g.push(n)}))){p=!1;break}}else if(y!==m&&!u(y,m,i,a,c)){p=!1;break}}return c.delete(r),c.delete(o),p}}function bg(){return Mf?Pf:(Mf=1,Pf=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e){t[++n]=e})),t})}function xg(){if(Tf)return zf;Tf=1;var e=Ss(),n=wg(),t=function(){if(jf)return Of;jf=1;var e=vs(),n=tg(),t=ss(),r=wg(),o=Cf?Nf:(Cf=1,Nf=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e,r){t[++n]=[r,e]})),t}),i=bg(),a=e?e.prototype:void 0,u=a?a.valueOf:void 0;return Of=function(e,a,c,s,l,d,f){switch(c){case"[object DataView]":if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=a.byteLength||!d(new n(e),new n(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return t(+e,+a);case"[object Error]":return e.name==a.name&&e.message==a.message;case"[object RegExp]":case"[object String]":return e==a+"";case"[object Map]":var h=o;case"[object Set]":var v=1&s;if(h||(h=i),e.size!=a.size&&!v)return!1;var p=f.get(e);if(p)return p==a;s|=2,f.set(e,a);var g=r(h(e),h(a),s,l,d,f);return f.delete(e),g;case"[object Symbol]":if(u)return u.call(e)==u.call(a)}return!1}}(),r=function(){if(Af)return If;Af=1;var e=Jp(),n=Object.prototype.hasOwnProperty;return If=function(t,r,o,i,a,u){var c=1&o,s=e(t),l=s.length;if(l!=e(r).length&&!c)return!1;for(var d=l;d--;){var f=s[d];if(!(c?f in r:n.call(r,f)))return!1}var h=u.get(t),v=u.get(r);if(h&&v)return h==r&&v==t;var p=!0;u.set(t,r),u.set(r,t);for(var g=c;++d<l;){var y=t[f=s[d]],m=r[f];if(i)var w=c?i(m,y,f,r,t,u):i(y,m,f,t,r,u);if(!(void 0===w?y===m||a(y,m,o,i,u):w)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var b=t.constructor,x=r.constructor;b==x||!("constructor"in t)||!("constructor"in r)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(p=!1)}return u.delete(t),u.delete(r),p}}(),o=ng(),i=Is(),a=Fs(),u=Sl(),c="[object Arguments]",s="[object Array]",l="[object Object]",d=Object.prototype.hasOwnProperty;return zf=function(f,h,v,p,g,y){var m=i(f),w=i(h),b=m?s:o(f),x=w?s:o(h),_=(b=b==c?l:b)==l,E=(x=x==c?l:x)==l,S=b==x;if(S&&a(f)){if(!a(h))return!1;m=!0,_=!1}if(S&&!_)return y||(y=new e),m||u(f)?n(f,h,v,p,g,y):t(f,h,b,v,p,g,y);if(!(1&v)){var k=_&&d.call(f,"__wrapped__"),N=E&&d.call(h,"__wrapped__");if(k||N){var C=k?f.value():f,P=N?h.value():h;return y||(y=new e),g(C,P,v,p,y)}}return!!S&&(y||(y=new e),r(f,h,v,p,g,y))}}function _g(){if(Df)return Bf;Df=1;var e=xg(),n=Os();return Bf=function t(r,o,i,a,u){return r===o||(null==r||null==o||!n(r)&&!n(o)?r!=r&&o!=o:e(r,o,i,a,t,u))},Bf}function Eg(){if(Hf)return Vf;Hf=1;var e=gs();return Vf=function(n){return n==n&&!e(n)}}function Sg(){return Ff?Xf:(Ff=1,Xf=function(e,n){return function(t){return null!=t&&t[e]===n&&(void 0!==n||e in Object(t))}})}function kg(){if(Wf)return $f;Wf=1;var e=ps(),n=Os();return $f=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==e(t)}}function Ng(){if(Kf)return qf;Kf=1;var e=Is(),n=kg(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return qf=function(o,i){if(e(o))return!1;var a=typeof o;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=o&&!n(o))||r.test(o)||!t.test(o)||null!=i&&o in Object(i)}}function Cg(){return ih?oh:(ih=1,oh=function(e,n){for(var t=-1,r=null==e?0:e.length,o=Array(r);++t<r;)o[t]=n(e[t],t,e);return o})}function Pg(){if(sh)return ch;sh=1;var e=function(){if(uh)return ah;uh=1;var e=vs(),n=Cg(),t=Is(),r=kg(),o=e?e.prototype:void 0,i=o?o.toString:void 0;return ah=function e(o){if("string"==typeof o)return o;if(t(o))return n(o,e)+"";if(r(o))return i?i.call(o):"";var a=o+"";return"0"==a&&1/o==-1/0?"-0":a},ah}();return ch=function(n){return null==n?"":e(n)}}function Mg(){if(dh)return lh;dh=1;var e=Is(),n=Ng(),t=function(){if(rh)return th;rh=1;var e=function(){if(nh)return eh;nh=1;var e=function(){if(Jf)return Qf;Jf=1;var e=Es();function n(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var o=function(){var e=arguments,n=r?r.apply(this,e):e[0],i=o.cache;if(i.has(n))return i.get(n);var a=t.apply(this,e);return o.cache=i.set(n,a)||i,a};return o.cache=new(n.Cache||e),o}return n.Cache=e,Qf=n}();return eh=function(n){var t=e(n,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}}(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,r=e((function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(n,(function(e,n,o,i){r.push(o?i.replace(t,"$1"):n||e)})),r}));return th=r}(),r=Pg();return lh=function(o,i){return e(o)?o:n(o,i)?[o]:t(r(o))}}function Og(){if(hh)return fh;hh=1;var e=kg();return fh=function(n){if("string"==typeof n||e(n))return n;var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}}function jg(){if(ph)return vh;ph=1;var e=Mg(),n=Og();return vh=function(t,r){for(var o=0,i=(r=e(r,t)).length;null!=t&&o<i;)t=t[n(r[o++])];return o&&o==i?t:void 0}}function Ig(){if(xh)return bh;xh=1;var e=Mg(),n=js(),t=Is(),r=Us(),o=Gs(),i=Og();return bh=function(a,u,c){for(var s=-1,l=(u=e(u,a)).length,d=!1;++s<l;){var f=i(u[s]);if(!(d=null!=a&&c(a,f)))break;a=a[f]}return d||++s!=l?d:!!(l=null==a?0:a.length)&&o(l)&&r(f,l)&&(t(a)||n(a))}}function Ag(){if(Eh)return _h;Eh=1;var e=wh?mh:(wh=1,mh=function(e,n){return null!=e&&n in Object(e)}),n=Ig();return _h=function(t,r){return null!=t&&n(t,r,e)}}function zg(){return Ch?Nh:(Ch=1,Nh=function(e){return function(n){return null==n?void 0:n[e]}})}function Tg(){if(Ah)return Ih;Ah=1;var e=function(){if(Gf)return Uf;Gf=1;var e=function(){if(Rf)return Lf;Rf=1;var e=Ss(),n=_g();return Lf=function(t,r,o,i){var a=o.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var s=o[a];if(c&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++a<u;){var l=(s=o[a])[0],d=t[l],f=s[1];if(c&&s[2]){if(void 0===d&&!(l in t))return!1}else{var h=new e;if(i)var v=i(d,f,l,t,r,h);if(!(void 0===v?n(f,d,3,i,h):v))return!1}}return!0}}(),n=function(){if(Yf)return Zf;Yf=1;var e=Eg(),n=Ol();return Zf=function(t){for(var r=n(t),o=r.length;o--;){var i=r[o],a=t[i];r[o]=[i,a,e(a)]}return r}}(),t=Sg();return Uf=function(r){var o=n(r);return 1==o.length&&o[0][2]?t(o[0][0],o[0][1]):function(n){return n===r||e(n,r,o)}}}(),n=function(){if(kh)return Sh;kh=1;var e=_g(),n=function(){if(yh)return gh;yh=1;var e=jg();return gh=function(n,t,r){var o=null==n?void 0:e(n,t);return void 0===o?r:o}}(),t=Ag(),r=Ng(),o=Eg(),i=Sg(),a=Og();return Sh=function(u,c){return r(u)&&o(c)?i(a(u),c):function(r){var o=n(r,u);return void 0===o&&o===c?t(r,u):e(c,o,3)}}}(),t=hg(),r=Is(),o=function(){if(jh)return Oh;jh=1;var e=zg(),n=function(){if(Mh)return Ph;Mh=1;var e=jg();return Ph=function(n){return function(t){return e(t,n)}}}(),t=Ng(),r=Og();return Oh=function(o){return t(o)?e(r(o)):n(o)}}();return Ih=function(i){return"function"==typeof i?i:null==i?t:"object"==typeof i?r(i)?n(i[0],i[1]):e(i):o(i)}}function Bg(){if(Th)return zh;Th=1;var e=Up(),n=function(){if(hf)return ff;hf=1;var e=fg();return ff=function(n,t){var r=[];return e(n,(function(e,n,o){t(e,n,o)&&r.push(e)})),r}}(),t=Tg(),r=Is();return zh=function(o,i){return(r(o)?e:n)(o,t(i,3))}}function Dg(){if(Rh)return Lh;Rh=1;var e=function(){if(Dh)return Bh;Dh=1;var e=Object.prototype.hasOwnProperty;return Bh=function(n,t){return null!=n&&e.call(n,t)}}(),n=Ig();return Lh=function(t,r){return null!=t&&n(t,r,e)}}function Lg(){if(Hh)return Vh;Hh=1;var e=Pl(),n=ng(),t=js(),r=Is(),o=Ml(),i=Fs(),a=Nl(),u=Sl(),c=Object.prototype.hasOwnProperty;return Vh=function(s){if(null==s)return!0;if(o(s)&&(r(s)||"string"==typeof s||"function"==typeof s.splice||i(s)||u(s)||t(s)))return!s.length;var l=n(s);if("[object Map]"==l||"[object Set]"==l)return!s.size;if(a(s))return!e(s).length;for(var d in s)if(c.call(s,d))return!1;return!0}}function Rg(){return Yh?Zh:(Yh=1,Zh=function(e){return void 0===e})}function Vg(){if(Fh)return Xh;Fh=1;var e=fg(),n=Ml();return Xh=function(t,r){var o=-1,i=n(t)?Array(t.length):[];return e(t,(function(e,n,t){i[++o]=r(e,n,t)})),i}}function Hg(){if(Gh)return Uh;Gh=1;var e=Cg(),n=Tg(),t=Vg(),r=Is();return Uh=function(o,i){return(r(o)?e:t)(o,n(i,3))}}function Zg(){if(Jh)return Qh;Jh=1;var e=Wh?$h:(Wh=1,$h=function(e,n,t,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(t=e[++o]);++o<i;)t=n(t,e[o],o,e);return t}),n=fg(),t=Tg(),r=Kh?qh:(Kh=1,qh=function(e,n,t,r,o){return o(e,(function(e,o,i){t=r?(r=!1,e):n(t,e,o,i)})),t}),o=Is();return Qh=function(i,a,u){var c=o(i)?e:r,s=arguments.length<3;return c(i,t(a,4),u,s,n)},Qh}function Yg(){if(dv)return lv;dv=1;var e=Pl(),n=ng(),t=Ml(),r=function(){if(nv)return ev;nv=1;var e=ps(),n=Is(),t=Os();return ev=function(r){return"string"==typeof r||!n(r)&&t(r)&&"[object String]"==e(r)}}(),o=function(){if(sv)return cv;sv=1;var e=function(){if(rv)return tv;rv=1;var e=zg()("length");return tv=e}(),n=function(){if(iv)return ov;iv=1;var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return ov=function(n){return e.test(n)}}(),t=function(){if(uv)return av;uv=1;var e="\\ud800-\\udfff",n="["+e+"]",t="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",o="[^"+e+"]",i="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+t+"|"+r+")?",c="[\\ufe0e\\ufe0f]?",s=c+u+"(?:\\u200d(?:"+[o,i,a].join("|")+")"+c+u+")*",l="(?:"+[o+t+"?",t,i,a,n].join("|")+")",d=RegExp(r+"(?="+r+")|"+l+s,"g");return av=function(e){for(var n=d.lastIndex=0;d.test(e);)++n;return n}}();return cv=function(r){return n(r)?t(r):e(r)}}();return lv=function(i){if(null==i)return 0;if(t(i))return r(i)?o(i):i.length;var a=n(i);return"[object Map]"==a||"[object Set]"==a?i.size:e(i).length}}function Xg(){if(hv)return fv;hv=1;var e=ks(),n=ig(),t=dg(),r=Tg(),o=qp(),i=Is(),a=Fs(),u=ys(),c=gs(),s=Sl();return fv=function(l,d,f){var h=i(l),v=h||a(l)||s(l);if(d=r(d,4),null==f){var p=l&&l.constructor;f=v?h?new p:[]:c(l)&&u(p)?n(o(l)):{}}return(v?e:t)(l,(function(e,n,t){return d(f,e,n,t)})),f}}function Fg(){if(yv)return gv;yv=1;var e=Wp(),n=function(){if(pv)return vv;pv=1;var e=vs(),n=js(),t=Is(),r=e?e.isConcatSpreadable:void 0;return vv=function(e){return t(e)||n(e)||!!(r&&e&&e[r])}}();return gv=function t(r,o,i,a,u){var c=-1,s=r.length;for(i||(i=n),u||(u=[]);++c<s;){var l=r[c];o>0&&i(l)?o>1?t(l,o-1,i,a,u):e(u,l):a||(u[u.length]=l)}return u},gv}function Ug(){if(xv)return bv;xv=1;var e=wv?mv:(wv=1,mv=function(e,n,t){switch(t.length){case 0:return e.call(n);case 1:return e.call(n,t[0]);case 2:return e.call(n,t[0],t[1]);case 3:return e.call(n,t[0],t[1],t[2])}return e.apply(n,t)}),n=Math.max;return bv=function(t,r,o){return r=n(void 0===r?t.length-1:r,0),function(){for(var i=arguments,a=-1,u=n(i.length-r,0),c=Array(u);++a<u;)c[a]=i[r+a];a=-1;for(var s=Array(r+1);++a<r;)s[a]=i[a];return s[r]=o(c),e(t,this,s)}},bv}function Gg(){if(Cv)return Nv;Cv=1;var e=function(){if(Ev)return _v;Ev=1;var e=sg(),n=Ns(),t=hg();return _v=n?function(t,r){return n(t,"toString",{configurable:!0,enumerable:!1,value:e(r),writable:!0})}:t}(),n=function(){if(kv)return Sv;kv=1;var e=Date.now;return Sv=function(n){var t=0,r=0;return function(){var o=e(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return n.apply(void 0,arguments)}},Sv}(),t=n(e);return Nv=t}function $g(){if(Mv)return Pv;Mv=1;var e=hg(),n=Ug(),t=Gg();return Pv=function(r,o){return t(n(r,o,e),r+"")}}function Wg(){return jv?Ov:(jv=1,Ov=function(e,n,t,r){for(var o=e.length,i=t+(r?1:-1);r?i--:++i<o;)if(n(e[i],i,e))return i;return-1})}function qg(){if(Gv)return Uv;Gv=1;var e=yg(),n=function(){if(Rv)return Lv;Rv=1;var e=function(){if(Dv)return Bv;Dv=1;var e=Wg(),n=Av?Iv:(Av=1,Iv=function(e){return e!=e}),t=Tv?zv:(Tv=1,zv=function(e,n,t){for(var r=t-1,o=e.length;++r<o;)if(e[r]===n)return r;return-1});return Bv=function(r,o,i){return o==o?t(r,o,i):e(r,n,i)}}();return Lv=function(n,t){return!(null==n||!n.length)&&e(n,t,0)>-1}}(),t=Hv?Vv:(Hv=1,Vv=function(e,n,t){for(var r=-1,o=null==e?0:e.length;++r<o;)if(t(n,e[r]))return!0;return!1}),r=mg(),o=function(){if(Fv)return Xv;Fv=1;var e=eg(),n=Yv?Zv:(Yv=1,Zv=function(){}),t=bg(),r=e&&1/t(new e([,-0]))[1]==1/0?function(n){return new e(n)}:n;return Xv=r}(),i=bg();return Uv=function(a,u,c){var s=-1,l=n,d=a.length,f=!0,h=[],v=h;if(c)f=!1,l=t;else if(d>=200){var p=u?null:o(a);if(p)return i(p);f=!1,l=r,v=new e}else v=u?[]:h;e:for(;++s<d;){var g=a[s],y=u?u(g):g;if(g=c||0!==g?g:0,f&&y==y){for(var m=v.length;m--;)if(v[m]===y)continue e;u&&v.push(y),h.push(g)}else l(v,y,c)||(v!==h&&v.push(y),h.push(g))}return h}}function Kg(){if(Wv)return $v;Wv=1;var e=Ml(),n=Os();return $v=function(t){return n(t)&&e(t)}}function Qg(){if(Kv)return qv;Kv=1;var e=Fg(),n=$g(),t=qg(),r=Kg(),o=n((function(n){return t(e(n,1,r,!0))}));return qv=o}function Jg(){if(np)return ep;np=1;var e=function(){if(Jv)return Qv;Jv=1;var e=Cg();return Qv=function(n,t){return e(t,(function(e){return n[e]}))}}(),n=Ol();return ep=function(t){return null==t?[]:e(t,n(t))}}function ey(){if(rp)return tp;var e;rp=1;try{e={clone:cg(),constant:sg(),each:gg(),filter:Bg(),has:Dg(),isArray:Is(),isEmpty:Lg(),isFunction:ys(),isUndefined:Rg(),keys:Ol(),map:Hg(),reduce:Zg(),size:Yg(),transform:Xg(),union:Qg(),values:Jg()}}catch(e){}return e||(e=window._),tp=e}function ny(){if(ip)return op;ip=1;var e=ey();op=o;var n="\0",t="\0",r="";function o(n){this._isDirected=!e.has(n,"directed")||n.directed,this._isMultigraph=!!e.has(n,"multigraph")&&n.multigraph,this._isCompound=!!e.has(n,"compound")&&n.compound,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[t]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function i(e,n){e[n]?e[n]++:e[n]=1}function a(e,n){--e[n]||delete e[n]}function u(t,o,i,a){var u=""+o,c=""+i;if(!t&&u>c){var s=u;u=c,c=s}return u+r+c+r+(e.isUndefined(a)?n:a)}function c(e,n){return u(e,n.v,n.w,n.name)}return o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(e){return this._label=e,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultNodeLabelFn=n,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._in[t])}))},o.prototype.sinks=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._out[t])}))},o.prototype.setNodes=function(n,t){var r=arguments,o=this;return e.each(n,(function(e){r.length>1?o.setNode(e,t):o.setNode(e)})),this},o.prototype.setNode=function(n,r){return e.has(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=r),this):(this._nodes[n]=arguments.length>1?r:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=t,this._children[n]={},this._children[t][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)},o.prototype.node=function(e){return this._nodes[e]},o.prototype.hasNode=function(n){return e.has(this._nodes,n)},o.prototype.removeNode=function(n){var t=this;if(e.has(this._nodes,n)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[n],this._isCompound&&(this._removeFromParentsChildList(n),delete this._parent[n],e.each(this.children(n),(function(e){t.setParent(e)})),delete this._children[n]),e.each(e.keys(this._in[n]),r),delete this._in[n],delete this._preds[n],e.each(e.keys(this._out[n]),r),delete this._out[n],delete this._sucs[n],--this._nodeCount}return this},o.prototype.setParent=function(n,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(r))r=t;else{for(var o=r+="";!e.isUndefined(o);o=this.parent(o))if(o===n)throw new Error("Setting "+r+" as parent of "+n+" would create a cycle");this.setNode(r)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=r,this._children[r][n]=!0,this},o.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},o.prototype.parent=function(e){if(this._isCompound){var n=this._parent[e];if(n!==t)return n}},o.prototype.children=function(n){if(e.isUndefined(n)&&(n=t),this._isCompound){var r=this._children[n];if(r)return e.keys(r)}else{if(n===t)return this.nodes();if(this.hasNode(n))return[]}},o.prototype.predecessors=function(n){var t=this._preds[n];if(t)return e.keys(t)},o.prototype.successors=function(n){var t=this._sucs[n];if(t)return e.keys(t)},o.prototype.neighbors=function(n){var t=this.predecessors(n);if(t)return e.union(t,this.successors(n))},o.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},o.prototype.filterNodes=function(n){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;e.each(this._nodes,(function(e,r){n(r)&&t.setNode(r,e)})),e.each(this._edgeObjs,(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))}));var o={};function i(e){var n=r.parent(e);return void 0===n||t.hasNode(n)?(o[e]=n,n):n in o?o[n]:i(n)}return this._isCompound&&e.each(t.nodes(),(function(e){t.setParent(e,i(e))})),t},o.prototype.setDefaultEdgeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultEdgeLabelFn=n,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(n,t){var r=this,o=arguments;return e.reduce(n,(function(e,n){return o.length>1?r.setEdge(e,n,t):r.setEdge(e,n),n})),this},o.prototype.setEdge=function(){var n,t,r,o,a=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(n=c.v,t=c.w,r=c.name,2===arguments.length&&(o=arguments[1],a=!0)):(n=c,t=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],a=!0)),n=""+n,t=""+t,e.isUndefined(r)||(r=""+r);var s=u(this._isDirected,n,t,r);if(e.has(this._edgeLabels,s))return a&&(this._edgeLabels[s]=o),this;if(!e.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(n),this.setNode(t),this._edgeLabels[s]=a?o:this._defaultEdgeLabelFn(n,t,r);var l=function(e,n,t,r){var o=""+n,i=""+t;if(!e&&o>i){var a=o;o=i,i=a}var u={v:o,w:i};return r&&(u.name=r),u}(this._isDirected,n,t,r);return n=l.v,t=l.w,Object.freeze(l),this._edgeObjs[s]=l,i(this._preds[t],n),i(this._sucs[n],t),this._in[t][s]=l,this._out[n][s]=l,this._edgeCount++,this},o.prototype.edge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t);return this._edgeLabels[r]},o.prototype.hasEdge=function(n,t,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,n,t,r);return e.has(this._edgeLabels,o)},o.prototype.removeEdge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t),o=this._edgeObjs[r];return o&&(e=o.v,n=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[n],e),a(this._sucs[e],n),delete this._in[n][r],delete this._out[e][r],this._edgeCount--),this},o.prototype.inEdges=function(n,t){var r=this._in[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.v===t})):o}},o.prototype.outEdges=function(n,t){var r=this._out[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.w===t})):o}},o.prototype.nodeEdges=function(e,n){var t=this.inEdges(e,n);if(t)return t.concat(this.outEdges(e,n))},op}function ty(){if(dp)return lp;dp=1;var e=ey(),n=ny();function t(n){return e.map(n.nodes(),(function(t){var r=n.node(t),o=n.parent(t),i={v:t};return e.isUndefined(r)||(i.value=r),e.isUndefined(o)||(i.parent=o),i}))}function r(n){return e.map(n.edges(),(function(t){var r=n.edge(t),o={v:t.v,w:t.w};return e.isUndefined(t.name)||(o.name=t.name),e.isUndefined(r)||(o.value=r),o}))}return lp={write:function(n){var o={options:{directed:n.isDirected(),multigraph:n.isMultigraph(),compound:n.isCompound()},nodes:t(n),edges:r(n)};return e.isUndefined(n.graph())||(o.value=e.clone(n.graph())),o},read:function(t){var r=new n(t.options).setGraph(t.value);return e.each(t.nodes,(function(e){r.setNode(e.v,e.value),e.parent&&r.setParent(e.v,e.parent)})),e.each(t.edges,(function(e){r.setEdge({v:e.v,w:e.w,name:e.name},e.value)})),r}}}function ry(){if(hp)return fp;hp=1;var e=ey();return fp=function(n){var t,r={},o=[];function i(o){e.has(r,o)||(r[o]=!0,t.push(o),e.each(n.successors(o),i),e.each(n.predecessors(o),i))}return e.each(n.nodes(),(function(e){t=[],i(e),t.length&&o.push(t)})),o},fp}function oy(){if(pp)return vp;pp=1;var e=ey();function n(){this._arr=[],this._keyIndices={}}return vp=n,n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map((function(e){return e.key}))},n.prototype.has=function(n){return e.has(this._keyIndices,n)},n.prototype.priority=function(e){var n=this._keyIndices[e];if(void 0!==n)return this._arr[n].priority},n.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(n,t){var r=this._keyIndices;if(n=String(n),!e.has(r,n)){var o=this._arr,i=o.length;return r[n]=i,o.push({key:n,priority:t}),this._decrease(i),!0}return!1},n.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},n.prototype.decrease=function(e,n){var t=this._keyIndices[e];if(n>this._arr[t].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[t].priority+" New: "+n);this._arr[t].priority=n,this._decrease(t)},n.prototype._heapify=function(e){var n=this._arr,t=2*e,r=t+1,o=e;t<n.length&&(o=n[t].priority<n[o].priority?t:o,r<n.length&&(o=n[r].priority<n[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))},n.prototype._decrease=function(e){for(var n,t=this._arr,r=t[e].priority;0!==e&&!(t[n=e>>1].priority<r);)this._swap(e,n),e=n},n.prototype._swap=function(e,n){var t=this._arr,r=this._keyIndices,o=t[e],i=t[n];t[e]=i,t[n]=o,r[i.key]=e,r[o.key]=n},vp}function iy(){if(yp)return gp;yp=1;var e=ey(),n=oy();gp=function(e,r,o,i){return function(e,t,r,o){var i,a,u={},c=new n,s=function(e){var n=e.v!==i?e.v:e.w,t=u[n],o=r(e),s=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);s<t.distance&&(t.distance=s,t.predecessor=i,c.decrease(n,s))};for(e.nodes().forEach((function(e){var n=e===t?0:Number.POSITIVE_INFINITY;u[e]={distance:n},c.add(e,n)}));c.size()>0&&(i=c.removeMin(),(a=u[i]).distance!==Number.POSITIVE_INFINITY);)o(i).forEach(s);return u}(e,String(r),o||t,i||function(n){return e.outEdges(n)})};var t=e.constant(1);return gp}function ay(){if(wp)return mp;wp=1;var e=iy(),n=ey();return mp=function(t,r,o){return n.transform(t.nodes(),(function(n,i){n[i]=e(t,i,r,o)}),{})}}function uy(){if(xp)return bp;xp=1;var e=ey();return bp=function(n){var t=0,r=[],o={},i=[];function a(u){var c=o[u]={onStack:!0,lowlink:t,index:t++};if(r.push(u),n.successors(u).forEach((function(n){e.has(o,n)?o[n].onStack&&(c.lowlink=Math.min(c.lowlink,o[n].index)):(a(n),c.lowlink=Math.min(c.lowlink,o[n].lowlink))})),c.lowlink===c.index){var s,l=[];do{s=r.pop(),o[s].onStack=!1,l.push(s)}while(u!==s);i.push(l)}}return n.nodes().forEach((function(n){e.has(o,n)||a(n)})),i},bp}function cy(){if(Ep)return _p;Ep=1;var e=ey(),n=uy();return _p=function(t){return e.filter(n(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}}function sy(){if(kp)return Sp;kp=1;var e=ey();Sp=function(e,t,r){return function(e,n,t){var r={},o=e.nodes();return o.forEach((function(e){r[e]={},r[e][e]={distance:0},o.forEach((function(n){e!==n&&(r[e][n]={distance:Number.POSITIVE_INFINITY})})),t(e).forEach((function(t){var o=t.v===e?t.w:t.v,i=n(t);r[e][o]={distance:i,predecessor:e}}))})),o.forEach((function(e){var n=r[e];o.forEach((function(t){var i=r[t];o.forEach((function(t){var r=i[e],o=n[t],a=i[t],u=r.distance+o.distance;u<a.distance&&(a.distance=u,a.predecessor=o.predecessor)}))}))})),r}(e,t||n,r||function(n){return e.outEdges(n)})};var n=e.constant(1);return Sp}function ly(){if(Cp)return Np;Cp=1;var e=ey();function n(n){var r={},o={},i=[];if(e.each(n.sinks(),(function a(u){if(e.has(o,u))throw new t;e.has(r,u)||(o[u]=!0,r[u]=!0,e.each(n.predecessors(u),a),delete o[u],i.push(u))})),e.size(r)!==n.nodeCount())throw new t;return i}function t(){}return Np=n,n.CycleException=t,t.prototype=new Error,Np}function dy(){if(Mp)return Pp;Mp=1;var e=ly();return Pp=function(n){try{e(n)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}}function fy(){if(jp)return Op;jp=1;var e=ey();function n(t,r,o,i,a,u){e.has(i,r)||(i[r]=!0,o||u.push(r),e.each(a(r),(function(e){n(t,e,o,i,a,u)})),o&&u.push(r))}return Op=function(t,r,o){e.isArray(r)||(r=[r]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),a=[],u={};return e.each(r,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);n(t,e,"post"===o,u,i,a)})),a},Op}function hy(){if(Ap)return Ip;Ap=1;var e=fy();return Ip=function(n,t){return e(n,t,"post")}}function vy(){if(Tp)return zp;Tp=1;var e=fy();return zp=function(n,t){return e(n,t,"pre")}}function py(){if(Dp)return Bp;Dp=1;var e=ey(),n=ny(),t=oy();return Bp=function(r,o){var i,a=new n,u={},c=new t;function s(e){var n=e.v===i?e.w:e.v,t=c.priority(n);if(void 0!==t){var r=o(e);r<t&&(u[n]=i,c.decrease(n,r))}}if(0===r.nodeCount())return a;e.each(r.nodes(),(function(e){c.add(e,Number.POSITIVE_INFINITY),a.setNode(e)})),c.decrease(r.nodes()[0],0);for(var l=!1;c.size()>0;){if(i=c.removeMin(),e.has(u,i))a.setEdge(i,u[i]);else{if(l)throw new Error("Input graph is not connected: "+r);l=!0}r.nodeEdges(i).forEach(s)}return a}}Yp.exports;try{Zp=function(){if(Hp)return Vp;Hp=1;var e=sp?cp:(sp=1,cp={Graph:ny(),version:up?ap:(up=1,ap="2.1.8")});return Vp={Graph:e.Graph,json:ty(),alg:Rp?Lp:(Rp=1,Lp={components:ry(),dijkstra:iy(),dijkstraAll:ay(),findCycles:cy(),floydWarshall:sy(),isAcyclic:dy(),postorder:hy(),preorder:vy(),prim:py(),tarjan:uy(),topsort:ly()}),version:e.version}}()}catch(cu){}Zp||(Zp=window.graphlib);var gy,yy,my,wy,by,xy,_y,Ey,Sy,ky,Ny,Cy,Py,My,Oy,jy,Iy,Ay,zy,Ty,By,Dy,Ly,Ry,Vy,Hy,Zy,Yy,Xy,Fy,Uy,Gy,$y,Wy,qy,Ky,Qy,Jy,em,nm,tm,rm,om,im,am,um,cm,sm,lm,dm,fm,hm,vm,pm,gm,ym,mm,wm,bm,xm,_m,Em,Sm,km,Nm,Cm,Pm,Mm,Om,jm,Im,Am,zm,Tm,Bm,Dm,Lm,Rm,Vm,Hm,Zm,Ym,Xm,Fm,Um,Gm,$m,Wm,qm,Km,Qm,Jm,ew,nw=Zp;function tw(){if(wy)return my;wy=1;var e=ss(),n=Ml(),t=Us(),r=gs();return my=function(o,i,a){if(!r(a))return!1;var u=typeof i;return!!("number"==u?n(a)&&t(i,a.length):"string"==u&&i in a)&&e(a[i],o)}}function rw(){if(jy)return Oy;jy=1;var e=function(){if(My)return Py;My=1;var e=function(){if(Cy)return Ny;Cy=1;var e=function(){if(ky)return Sy;ky=1;var e=/\s/;return Sy=function(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}}(),n=/^\s+/;return Ny=function(t){return t?t.slice(0,e(t)+1).replace(n,""):t}}(),n=gs(),t=kg(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;return Py=function(u){if("number"==typeof u)return u;if(t(u))return NaN;if(n(u)){var c="function"==typeof u.valueOf?u.valueOf():u;u=n(c)?c+"":c}if("string"!=typeof u)return 0===u?u:+u;u=e(u);var s=o.test(u);return s||i.test(u)?a(u.slice(2),s?2:8):r.test(u)?NaN:+u}}(),n=1/0;return Oy=function(t){return t?(t=e(t))===n||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}}function ow(){if(Ry)return Ly;Ry=1;var e=Fg();return Ly=function(n){return null!=n&&n.length?e(n,1):[]}}function iw(){if(Gy)return Uy;Gy=1;var e=kg();return Uy=function(n,t,r){for(var o=-1,i=n.length;++o<i;){var a=n[o],u=t(a);if(null!=u&&(void 0===c?u==u&&!e(u):r(u,c)))var c=u,s=a}return s}}function aw(){if(Jy)return Qy;Jy=1;var e=Cs(),n=ss();return Qy=function(t,r,o){(void 0!==o&&!n(t[r],o)||void 0===o&&!(r in t))&&e(t,r,o)}}function uw(){return rm?tm:(rm=1,tm=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]})}function cw(){return pm?vm:(pm=1,vm=function(e,n){return e<n})}function sw(){if(Fm)return Xm;Fm=1;var e=Cg(),n=jg(),t=Tg(),r=Vg(),o=Rm?Lm:(Rm=1,Lm=function(e,n){var t=e.length;for(e.sort(n);t--;)e[t]=e[t].value;return e}),i=$s(),a=function(){if(Ym)return Zm;Ym=1;var e=function(){if(Hm)return Vm;Hm=1;var e=kg();return Vm=function(n,t){if(n!==t){var r=void 0!==n,o=null===n,i=n==n,a=e(n),u=void 0!==t,c=null===t,s=t==t,l=e(t);if(!c&&!l&&!a&&n>t||a&&u&&s&&!c&&!l||o&&u&&s||!r&&s||!i)return 1;if(!o&&!a&&!l&&n<t||l&&r&&i&&!o&&!a||c&&r&&i||!u&&i||!s)return-1}return 0}}();return Zm=function(n,t,r){for(var o=-1,i=n.criteria,a=t.criteria,u=i.length,c=r.length;++o<u;){var s=e(i[o],a[o]);if(s)return o>=c?s:s*("desc"==r[o]?-1:1)}return n.index-t.index}}(),u=hg(),c=Is();return Xm=function(s,l,d){l=l.length?e(l,(function(e){return c(e)?function(t){return n(t,1===e.length?e[0]:e)}:e})):[u];var f=-1;l=e(l,i(t));var h=r(s,(function(n,t,r){return{criteria:e(l,(function(e){return e(n)})),index:++f,value:n}}));return o(h,(function(e,n){return a(e,n,d)}))}}try{ew={cloneDeep:function(){if(yy)return gy;yy=1;var e=ug();return gy=function(n){return e(n,5)}}(),constant:sg(),defaults:function(){if(xy)return by;xy=1;var e=$g(),n=ss(),t=tw(),r=jl(),o=Object.prototype,i=o.hasOwnProperty,a=e((function(e,a){e=Object(e);var u=-1,c=a.length,s=c>2?a[2]:void 0;for(s&&t(a[0],a[1],s)&&(c=1);++u<c;)for(var l=a[u],d=r(l),f=-1,h=d.length;++f<h;){var v=d[f],p=e[v];(void 0===p||n(p,o[v])&&!i.call(e,v))&&(e[v]=l[v])}return e}));return by=a}(),each:gg(),filter:Bg(),find:function(){if(Dy)return By;Dy=1;var e=function(){if(Ey)return _y;Ey=1;var e=Tg(),n=Ml(),t=Ol();return _y=function(r){return function(o,i,a){var u=Object(o);if(!n(o)){var c=e(i,3);o=t(o),i=function(e){return c(u[e],e,u)}}var s=r(o,i,a);return s>-1?u[c?o[s]:s]:void 0}}}()(function(){if(Ty)return zy;Ty=1;var e=Wg(),n=Tg(),t=function(){if(Ay)return Iy;Ay=1;var e=rw();return Iy=function(n){var t=e(n),r=t%1;return t==t?r?t-r:t:0}}(),r=Math.max;return zy=function(o,i,a){var u=null==o?0:o.length;if(!u)return-1;var c=null==a?0:t(a);return c<0&&(c=r(u+c,0)),e(o,n(i,3),c)}}());return By=e}(),flatten:ow(),forEach:pg(),forIn:function(){if(Hy)return Vy;Hy=1;var e=lg(),n=vg(),t=jl();return Vy=function(r,o){return null==r?r:e(r,n(o),t)}}(),has:Dg(),isUndefined:Rg(),last:Yy?Zy:(Yy=1,Zy=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}),map:Hg(),mapValues:function(){if(Fy)return Xy;Fy=1;var e=Cs(),n=dg(),t=Tg();return Xy=function(r,o){var i={};return o=t(o,3),n(r,(function(n,t,r){e(i,t,o(n,t,r))})),i}}(),max:function(){if(Ky)return qy;Ky=1;var e=iw(),n=Wy?$y:(Wy=1,$y=function(e,n){return e>n}),t=hg();return qy=function(r){return r&&r.length?e(r,t,n):void 0}}(),merge:function(){if(hm)return fm;hm=1;var e=function(){if(sm)return cm;sm=1;var e=Ss(),n=aw(),t=lg(),r=function(){if(um)return am;um=1;var e=aw(),n=Xp(),t=og(),r=Fp(),o=ag(),i=js(),a=Is(),u=Kg(),c=Fs(),s=ys(),l=gs(),d=function(){if(nm)return em;nm=1;var e=ps(),n=qp(),t=Os(),r=Function.prototype,o=Object.prototype,i=r.toString,a=o.hasOwnProperty,u=i.call(Object);return em=function(r){if(!t(r)||"[object Object]"!=e(r))return!1;var o=n(r);if(null===o)return!0;var c=a.call(o,"constructor")&&o.constructor;return"function"==typeof c&&c instanceof c&&i.call(c)==u}}(),f=Sl(),h=uw(),v=function(){if(im)return om;im=1;var e=Ms(),n=jl();return om=function(t){return e(t,n(t))}}();return am=function(p,g,y,m,w,b,x){var _=h(p,y),E=h(g,y),S=x.get(E);if(S)e(p,y,S);else{var k=b?b(_,E,y+"",p,g,x):void 0,N=void 0===k;if(N){var C=a(E),P=!C&&c(E),M=!C&&!P&&f(E);k=E,C||P||M?a(_)?k=_:u(_)?k=r(_):P?(N=!1,k=n(E,!0)):M?(N=!1,k=t(E,!0)):k=[]:d(E)||i(E)?(k=_,i(_)?k=v(_):l(_)&&!s(_)||(k=o(E))):N=!1}N&&(x.set(E,k),w(k,E,m,b,x),x.delete(E)),e(p,y,k)}}}(),o=gs(),i=jl(),a=uw();return cm=function u(c,s,l,d,f){c!==s&&t(s,(function(t,i){if(f||(f=new e),o(t))r(c,s,i,l,u,d,f);else{var h=d?d(a(c,i),t,i+"",c,s,f):void 0;void 0===h&&(h=t),n(c,i,h)}}),i)},cm}(),n=function(){if(dm)return lm;dm=1;var e=$g(),n=tw();return lm=function(t){return e((function(e,r){var o=-1,i=r.length,a=i>1?r[i-1]:void 0,u=i>2?r[2]:void 0;for(a=t.length>3&&"function"==typeof a?(i--,a):void 0,u&&n(r[0],r[1],u)&&(a=i<3?void 0:a,i=1),e=Object(e);++o<i;){var c=r[o];c&&t(e,c,o,a)}return e}))}}()((function(n,t,r){e(n,t,r)}));return fm=n}(),min:function(){if(ym)return gm;ym=1;var e=iw(),n=cw(),t=hg();return gm=function(r){return r&&r.length?e(r,t,n):void 0}}(),minBy:function(){if(wm)return mm;wm=1;var e=iw(),n=Tg(),t=cw();return mm=function(r,o){return r&&r.length?e(r,n(o,2),t):void 0}}(),now:function(){if(xm)return bm;xm=1;var e=hs();return bm=function(){return e.Date.now()}}(),pick:function(){if(jm)return Om;jm=1;var e=function(){if(Cm)return Nm;Cm=1;var e=function(){if(km)return Sm;km=1;var e=jg(),n=function(){if(Em)return _m;Em=1;var e=Ps(),n=Mg(),t=Us(),r=gs(),o=Og();return _m=function(i,a,u,c){if(!r(i))return i;for(var s=-1,l=(a=n(a,i)).length,d=l-1,f=i;null!=f&&++s<l;){var h=o(a[s]),v=u;if("__proto__"===h||"constructor"===h||"prototype"===h)return i;if(s!=d){var p=f[h];void 0===(v=c?c(p,h,f):void 0)&&(v=r(p)?p:t(a[s+1])?[]:{})}e(f,h,v),f=f[h]}return i}}(),t=Mg();return Sm=function(r,o,i){for(var a=-1,u=o.length,c={};++a<u;){var s=o[a],l=e(r,s);i(l,s)&&n(c,t(s,r),l)}return c}}(),n=Ag();return Nm=function(t,r){return e(t,r,(function(e,r){return n(t,r)}))}}(),n=function(){if(Mm)return Pm;Mm=1;var e=ow(),n=Ug(),t=Gg();return Pm=function(r){return t(n(r,void 0,e),r+"")}}()((function(n,t){return null==n?{}:e(n,t)}));return Om=n}(),range:function(){if(Dm)return Bm;Dm=1;var e=function(){if(Tm)return zm;Tm=1;var e=function(){if(Am)return Im;Am=1;var e=Math.ceil,n=Math.max;return Im=function(t,r,o,i){for(var a=-1,u=n(e((r-t)/(o||1)),0),c=Array(u);u--;)c[i?u:++a]=t,t+=o;return c}}(),n=tw(),t=rw();return zm=function(r){return function(o,i,a){return a&&"number"!=typeof a&&n(o,i,a)&&(i=a=void 0),o=t(o),void 0===i?(i=o,o=0):i=t(i),a=void 0===a?o<i?1:-1:t(a),e(o,i,a,r)}}}()();return Bm=e}(),reduce:Zg(),sortBy:function(){if(Gm)return Um;Gm=1;var e=Fg(),n=sw(),t=$g(),r=tw(),o=t((function(t,o){if(null==t)return[];var i=o.length;return i>1&&r(t,o[0],o[1])?o=[]:i>2&&r(o[0],o[1],o[2])&&(o=[o[0]]),n(t,e(o,1),[])}));return Um=o}(),uniqueId:function(){if(Wm)return $m;Wm=1;var e=Pg(),n=0;return $m=function(t){var r=++n;return e(t)+r}}(),values:Jg(),zipObject:function(){if(Jm)return Qm;Jm=1;var e=Ps(),n=Km?qm:(Km=1,qm=function(e,n,t){for(var r=-1,o=e.length,i=n.length,a={};++r<o;){var u=r<i?n[r]:void 0;t(a,e[r],u)}return a});return Qm=function(t,r){return n(t||[],r||[],e)}}()}}catch(cu){}ew||(ew=window._);var lw=ew,dw=fw;function fw(){var e={};e._next=e._prev=e,this._sentinel=e}function hw(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function vw(e,n){if("_next"!==e&&"_prev"!==e)return n}fw.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return hw(n),n},fw.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&hw(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},fw.prototype.toString=function(){for(var e=[],n=this._sentinel,t=n._prev;t!==n;)e.push(JSON.stringify(t,vw)),t=t._prev;return"["+e.join(", ")+"]"};var pw=lw,gw=nw.Graph,yw=dw,mw=pw.constant(1);function ww(e,n,t,r,o){var i=o?[]:void 0;return pw.forEach(e.inEdges(r.v),(function(r){var a=e.edge(r),u=e.node(r.v);o&&i.push({v:r.v,w:r.w}),u.out-=a,bw(n,t,u)})),pw.forEach(e.outEdges(r.v),(function(r){var o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,bw(n,t,a)})),e.removeNode(r.v),i}function bw(e,n,t){t.out?t.in?e[t.out-t.in+n].enqueue(t):e[e.length-1].enqueue(t):e[0].enqueue(t)}var xw=lw,_w=function(e,n){if(e.nodeCount()<=1)return[];var t=function(e,n){var t=new gw,r=0,o=0;pw.forEach(e.nodes(),(function(e){t.setNode(e,{v:e,in:0,out:0})})),pw.forEach(e.edges(),(function(e){var i=t.edge(e.v,e.w)||0,a=n(e),u=i+a;t.setEdge(e.v,e.w,u),o=Math.max(o,t.node(e.v).out+=a),r=Math.max(r,t.node(e.w).in+=a)}));var i=pw.range(o+r+3).map((function(){return new yw})),a=r+1;return pw.forEach(t.nodes(),(function(e){bw(i,a,t.node(e))})),{graph:t,buckets:i,zeroIdx:a}}(e,n||mw),r=function(e,n,t){for(var r,o=[],i=n[n.length-1],a=n[0];e.nodeCount();){for(;r=a.dequeue();)ww(e,n,t,r);for(;r=i.dequeue();)ww(e,n,t,r);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(r=n[u].dequeue()){o=o.concat(ww(e,n,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return pw.flatten(pw.map(r,(function(n){return e.outEdges(n.v,n.w)})),!0)},Ew={run:function(e){var n="greedy"===e.graph().acyclicer?_w(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],t={},r={};return xw.forEach(e.nodes(),(function o(i){xw.has(r,i)||(r[i]=!0,t[i]=!0,xw.forEach(e.outEdges(i),(function(e){xw.has(t,e.w)?n.push(e):o(e.w)})),delete t[i])})),n}(e);xw.forEach(n,(function(n){var t=e.edge(n);e.removeEdge(n),t.forwardName=n.name,t.reversed=!0,e.setEdge(n.w,n.v,t,xw.uniqueId("rev"))}))},undo:function(e){xw.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.reversed){e.removeEdge(n);var r=t.forwardName;delete t.reversed,delete t.forwardName,e.setEdge(n.w,n.v,t,r)}}))}},Sw=lw,kw=nw.Graph,Nw={addDummyNode:Cw,simplify:function(e){var n=(new kw).setGraph(e.graph());return Sw.forEach(e.nodes(),(function(t){n.setNode(t,e.node(t))})),Sw.forEach(e.edges(),(function(t){var r=n.edge(t.v,t.w)||{weight:0,minlen:1},o=e.edge(t);n.setEdge(t.v,t.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})})),n},asNonCompoundGraph:function(e){var n=new kw({multigraph:e.isMultigraph()}).setGraph(e.graph());return Sw.forEach(e.nodes(),(function(t){e.children(t).length||n.setNode(t,e.node(t))})),Sw.forEach(e.edges(),(function(t){n.setEdge(t,e.edge(t))})),n},successorWeights:function(e){var n=Sw.map(e.nodes(),(function(n){var t={};return Sw.forEach(e.outEdges(n),(function(n){t[n.w]=(t[n.w]||0)+e.edge(n).weight})),t}));return Sw.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=Sw.map(e.nodes(),(function(n){var t={};return Sw.forEach(e.inEdges(n),(function(n){t[n.v]=(t[n.v]||0)+e.edge(n).weight})),t}));return Sw.zipObject(e.nodes(),n)},intersectRect:function(e,n){var t,r,o=e.x,i=e.y,a=n.x-o,u=n.y-i,c=e.width/2,s=e.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(u)*c>Math.abs(a)*s?(u<0&&(s=-s),t=s*a/u,r=s):(a<0&&(c=-c),t=c,r=c*u/a),{x:o+t,y:i+r}},buildLayerMatrix:function(e){var n=Sw.map(Sw.range(Pw(e)+1),(function(){return[]}));return Sw.forEach(e.nodes(),(function(t){var r=e.node(t),o=r.rank;Sw.isUndefined(o)||(n[o][r.order]=t)})),n},normalizeRanks:function(e){var n=Sw.min(Sw.map(e.nodes(),(function(n){return e.node(n).rank})));Sw.forEach(e.nodes(),(function(t){var r=e.node(t);Sw.has(r,"rank")&&(r.rank-=n)}))},removeEmptyRanks:function(e){var n=Sw.min(Sw.map(e.nodes(),(function(n){return e.node(n).rank}))),t=[];Sw.forEach(e.nodes(),(function(r){var o=e.node(r).rank-n;t[o]||(t[o]=[]),t[o].push(r)}));var r=0,o=e.graph().nodeRankFactor;Sw.forEach(t,(function(n,t){Sw.isUndefined(n)&&t%o!=0?--r:r&&Sw.forEach(n,(function(n){e.node(n).rank+=r}))}))},addBorderNode:function(e,n,t,r){var o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=r),Cw(e,"border",o,n)},maxRank:Pw,partition:function(e,n){var t={lhs:[],rhs:[]};return Sw.forEach(e,(function(e){n(e)?t.lhs.push(e):t.rhs.push(e)})),t},time:function(e,n){var t=Sw.now();try{return n()}finally{console.log(e+" time: "+(Sw.now()-t)+"ms")}},notime:function(e,n){return n()}};function Cw(e,n,t,r){var o;do{o=Sw.uniqueId(r)}while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function Pw(e){return Sw.max(Sw.map(e.nodes(),(function(n){var t=e.node(n).rank;if(!Sw.isUndefined(t))return t})))}var Mw=lw,Ow=Nw,jw={run:function(e){e.graph().dummyChains=[],Mw.forEach(e.edges(),(function(n){!function(e,n){var t,r,o,i=n.v,a=e.node(i).rank,u=n.w,c=e.node(u).rank,s=n.name,l=e.edge(n),d=l.labelRank;if(c!==a+1){for(e.removeEdge(n),o=0,++a;a<c;++o,++a)l.points=[],r={width:0,height:0,edgeLabel:l,edgeObj:n,rank:a},t=Ow.addDummyNode(e,"edge",r,"_d"),a===d&&(r.width=l.width,r.height=l.height,r.dummy="edge-label",r.labelpos=l.labelpos),e.setEdge(i,t,{weight:l.weight},s),0===o&&e.graph().dummyChains.push(t),i=t;e.setEdge(i,u,{weight:l.weight},s)}}(e,n)}))},undo:function(e){Mw.forEach(e.graph().dummyChains,(function(n){var t,r=e.node(n),o=r.edgeLabel;for(e.setEdge(r.edgeObj,o);r.dummy;)t=e.successors(n)[0],e.removeNode(n),o.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(o.x=r.x,o.y=r.y,o.width=r.width,o.height=r.height),n=t,r=e.node(n)}))}},Iw=lw,Aw=function(e){var n={};Iw.forEach(e.sources(),(function t(r){var o=e.node(r);if(Iw.has(n,r))return o.rank;n[r]=!0;var i=Iw.min(Iw.map(e.outEdges(r),(function(n){return t(n.w)-e.edge(n).minlen})));return i!==Number.POSITIVE_INFINITY&&null!=i||(i=0),o.rank=i}))},zw=function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen},Tw=lw,Bw=nw.Graph,Dw=zw,Lw=function(e){var n,t,r=new Bw({directed:!1}),o=e.nodes()[0],i=e.nodeCount();for(r.setNode(o,{});Rw(r,e)<i;)n=Vw(r,e),t=r.hasNode(n.v)?Dw(e,n):-Dw(e,n),Hw(r,e,t);return r};function Rw(e,n){return Tw.forEach(e.nodes(),(function t(r){Tw.forEach(n.nodeEdges(r),(function(o){var i=o.v,a=r===i?o.w:i;e.hasNode(a)||Dw(n,o)||(e.setNode(a,{}),e.setEdge(r,a,{}),t(a))}))})),e.nodeCount()}function Vw(e,n){return Tw.minBy(n.edges(),(function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return Dw(n,t)}))}function Hw(e,n,t){Tw.forEach(e.nodes(),(function(e){n.node(e).rank+=t}))}var Zw=lw,Yw=Lw,Xw=zw,Fw=Aw,Uw=nw.alg.preorder,Gw=nw.alg.postorder,$w=Nw.simplify,Ww=qw;function qw(e){e=$w(e),Fw(e);var n,t=Yw(e);for(Jw(t),Kw(t,e);n=nb(t);)rb(t,e,n,tb(t,e,n))}function Kw(e,n){var t=Gw(e,e.nodes());t=t.slice(0,t.length-1),Zw.forEach(t,(function(t){!function(e,n,t){var r=e.node(t).parent;e.edge(t,r).cutvalue=Qw(e,n,t)}(e,n,t)}))}function Qw(e,n,t){var r=e.node(t).parent,o=!0,i=n.edge(t,r),a=0;return i||(o=!1,i=n.edge(r,t)),a=i.weight,Zw.forEach(n.nodeEdges(t),(function(i){var u,c,s=i.v===t,l=s?i.w:i.v;if(l!==r){var d=s===o,f=n.edge(i).weight;if(a+=d?f:-f,u=t,c=l,e.hasEdge(u,c)){var h=e.edge(t,l).cutvalue;a+=d?-h:h}}})),a}function Jw(e,n){arguments.length<2&&(n=e.nodes()[0]),eb(e,{},1,n)}function eb(e,n,t,r,o){var i=t,a=e.node(r);return n[r]=!0,Zw.forEach(e.neighbors(r),(function(o){Zw.has(n,o)||(t=eb(e,n,t,o,r))})),a.low=i,a.lim=t++,o?a.parent=o:delete a.parent,t}function nb(e){return Zw.find(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function tb(e,n,t){var r=t.v,o=t.w;n.hasEdge(r,o)||(r=t.w,o=t.v);var i=e.node(r),a=e.node(o),u=i,c=!1;i.lim>a.lim&&(u=a,c=!0);var s=Zw.filter(n.edges(),(function(n){return c===ob(e,e.node(n.v),u)&&c!==ob(e,e.node(n.w),u)}));return Zw.minBy(s,(function(e){return Xw(n,e)}))}function rb(e,n,t,r){var o=t.v,i=t.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),Jw(e),Kw(e,n),function(e,n){var t=Zw.find(e.nodes(),(function(e){return!n.node(e).parent})),r=Uw(e,t);r=r.slice(1),Zw.forEach(r,(function(t){var r=e.node(t).parent,o=n.edge(t,r),i=!1;o||(o=n.edge(r,t),i=!0),n.node(t).rank=n.node(r).rank+(i?o.minlen:-o.minlen)}))}(e,n)}function ob(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}qw.initLowLimValues=Jw,qw.initCutValues=Kw,qw.calcCutValue=Qw,qw.leaveEdge=nb,qw.enterEdge=tb,qw.exchangeEdges=rb;var ib=Aw,ab=Lw,ub=Ww,cb=ib;var sb=lw,lb=lw,db=Nw,fb={run:function(e){var n=db.addDummyNode(e,"root",{},"_root"),t=function(e){var n={};function t(r,o){var i=e.children(r);i&&i.length&&lb.forEach(i,(function(e){t(e,o+1)})),n[r]=o}return lb.forEach(e.children(),(function(e){t(e,1)})),n}(e),r=lb.max(lb.values(t))-1,o=2*r+1;e.graph().nestingRoot=n,lb.forEach(e.edges(),(function(n){e.edge(n).minlen*=o}));var i=function(e){return lb.reduce(e.edges(),(function(n,t){return n+e.edge(t).weight}),0)}(e)+1;lb.forEach(e.children(),(function(a){hb(e,n,o,i,r,t,a)})),e.graph().nodeRankFactor=o},cleanup:function(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,lb.forEach(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}};function hb(e,n,t,r,o,i,a){var u=e.children(a);if(u.length){var c=db.addBorderNode(e,"_bt"),s=db.addBorderNode(e,"_bb"),l=e.node(a);e.setParent(c,a),l.borderTop=c,e.setParent(s,a),l.borderBottom=s,lb.forEach(u,(function(u){hb(e,n,t,r,o,i,u);var l=e.node(u),d=l.borderTop?l.borderTop:u,f=l.borderBottom?l.borderBottom:u,h=l.borderTop?r:2*r,v=d!==f?1:o-i[a]+1;e.setEdge(c,d,{weight:h,minlen:v,nestingEdge:!0}),e.setEdge(f,s,{weight:h,minlen:v,nestingEdge:!0})})),e.parent(a)||e.setEdge(n,c,{weight:0,minlen:o+i[a]})}else a!==n&&e.setEdge(n,a,{weight:0,minlen:t})}var vb=lw,pb=Nw;function gb(e,n,t,r,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],c=pb.addDummyNode(e,"border",a,t);o[n][i]=c,e.setParent(c,r),u&&e.setEdge(u,c,{weight:1})}var yb=lw,mb={adjust:function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||wb(e)},undo:function(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){yb.forEach(e.nodes(),(function(n){xb(e.node(n))})),yb.forEach(e.edges(),(function(n){var t=e.edge(n);yb.forEach(t.points,xb),yb.has(t,"y")&&xb(t)}))}(e),"lr"!==n&&"rl"!==n||(function(e){yb.forEach(e.nodes(),(function(n){_b(e.node(n))})),yb.forEach(e.edges(),(function(n){var t=e.edge(n);yb.forEach(t.points,_b),yb.has(t,"x")&&_b(t)}))}(e),wb(e))}};function wb(e){yb.forEach(e.nodes(),(function(n){bb(e.node(n))})),yb.forEach(e.edges(),(function(n){bb(e.edge(n))}))}function bb(e){var n=e.width;e.width=e.height,e.height=n}function xb(e){e.y=-e.y}function _b(e){var n=e.x;e.x=e.y,e.y=n}var Eb=lw,Sb=lw;function kb(e,n,t){for(var r=Sb.zipObject(t,Sb.map(t,(function(e,n){return n}))),o=Sb.flatten(Sb.map(n,(function(n){return Sb.sortBy(Sb.map(e.outEdges(n),(function(n){return{pos:r[n.w],weight:e.edge(n).weight}})),"pos")})),!0),i=1;i<t.length;)i<<=1;var a=2*i-1;i-=1;var u=Sb.map(new Array(a),(function(){return 0})),c=0;return Sb.forEach(o.forEach((function(e){var n=e.pos+i;u[n]+=e.weight;for(var t=0;n>0;)n%2&&(t+=u[n+1]),u[n=n-1>>1]+=e.weight;c+=e.weight*t}))),c}var Nb=lw,Cb=lw,Pb=lw,Mb=Nw;function Ob(e,n,t){for(var r;n.length&&(r=Pb.last(n)).i<=t;)n.pop(),e.push(r.vs),t++;return t}var jb=lw,Ib=lw,Ab=nw.Graph,zb=lw,Tb=lw,Bb=function(e){var n={},t=Eb.filter(e.nodes(),(function(n){return!e.children(n).length})),r=Eb.max(Eb.map(t,(function(n){return e.node(n).rank}))),o=Eb.map(Eb.range(r+1),(function(){return[]}));var i=Eb.sortBy(t,(function(n){return e.node(n).rank}));return Eb.forEach(i,(function t(r){if(!Eb.has(n,r)){n[r]=!0;var i=e.node(r);o[i.rank].push(r),Eb.forEach(e.successors(r),t)}})),o},Db=function(e,n){for(var t=0,r=1;r<n.length;++r)t+=kb(e,n[r-1],n[r]);return t},Lb=function e(n,t,r,o){var i=n.children(t),a=n.node(t),u=a?a.borderLeft:void 0,c=a?a.borderRight:void 0,s={};u&&(i=jb.filter(i,(function(e){return e!==u&&e!==c})));var l=function(e,n){return Nb.map(n,(function(n){var t=e.inEdges(n);if(t.length){var r=Nb.reduce(t,(function(n,t){var r=e.edge(t),o=e.node(t.v);return{sum:n.sum+r.weight*o.order,weight:n.weight+r.weight}}),{sum:0,weight:0});return{v:n,barycenter:r.sum/r.weight,weight:r.weight}}return{v:n}}))}(n,i);jb.forEach(l,(function(t){if(n.children(t.v).length){var i=e(n,t.v,r,o);s[t.v]=i,jb.has(i,"barycenter")&&(a=t,u=i,jb.isUndefined(a.barycenter)?(a.barycenter=u.barycenter,a.weight=u.weight):(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight))}var a,u}));var d=function(e,n){var t={};return Cb.forEach(e,(function(e,n){var r=t[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};Cb.isUndefined(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)})),Cb.forEach(n.edges(),(function(e){var n=t[e.v],r=t[e.w];Cb.isUndefined(n)||Cb.isUndefined(r)||(r.indegree++,n.out.push(t[e.w]))})),function(e){var n=[];function t(e){return function(n){n.merged||(Cb.isUndefined(n.barycenter)||Cb.isUndefined(e.barycenter)||n.barycenter>=e.barycenter)&&function(e,n){var t=0,r=0;e.weight&&(t+=e.barycenter*e.weight,r+=e.weight),n.weight&&(t+=n.barycenter*n.weight,r+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=t/r,e.weight=r,e.i=Math.min(n.i,e.i),n.merged=!0}(e,n)}}function r(n){return function(t){t.in.push(n),0==--t.indegree&&e.push(t)}}for(;e.length;){var o=e.pop();n.push(o),Cb.forEach(o.in.reverse(),t(o)),Cb.forEach(o.out,r(o))}return Cb.map(Cb.filter(n,(function(e){return!e.merged})),(function(e){return Cb.pick(e,["vs","i","barycenter","weight"])}))}(Cb.filter(t,(function(e){return!e.indegree})))}(l,r);!function(e,n){jb.forEach(e,(function(e){e.vs=jb.flatten(e.vs.map((function(e){return n[e]?n[e].vs:e})),!0)}))}(d,s);var f=function(e,n){var t,r=Mb.partition(e,(function(e){return Pb.has(e,"barycenter")})),o=r.lhs,i=Pb.sortBy(r.rhs,(function(e){return-e.i})),a=[],u=0,c=0,s=0;o.sort((t=!!n,function(e,n){return e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i})),s=Ob(a,i,s),Pb.forEach(o,(function(e){s+=e.vs.length,a.push(e.vs),u+=e.barycenter*e.weight,c+=e.weight,s=Ob(a,i,s)}));var l={vs:Pb.flatten(a,!0)};return c&&(l.barycenter=u/c,l.weight=c),l}(d,o);if(u&&(f.vs=jb.flatten([u,f.vs,c],!0),n.predecessors(u).length)){var h=n.node(n.predecessors(u)[0]),v=n.node(n.predecessors(c)[0]);jb.has(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+h.order+v.order)/(f.weight+2),f.weight+=2}return f},Rb=function(e,n,t){var r=function(e){for(var n;e.hasNode(n=Ib.uniqueId("_root")););return n}(e),o=new Ab({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(n){return e.node(n)}));return Ib.forEach(e.nodes(),(function(i){var a=e.node(i),u=e.parent(i);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(o.setNode(i),o.setParent(i,u||r),Ib.forEach(e[t](i),(function(n){var t=n.v===i?n.w:n.v,r=o.edge(t,i),a=Ib.isUndefined(r)?0:r.weight;o.setEdge(t,i,{weight:e.edge(n).weight+a})})),Ib.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))})),o},Vb=nw.Graph,Hb=Nw;function Zb(e,n,t){return Tb.map(n,(function(n){return Rb(e,n,t)}))}function Yb(e,n){var t=new Vb;Tb.forEach(e,(function(e){var r=e.graph().root,o=Lb(e,r,t,n);Tb.forEach(o.vs,(function(n,t){e.node(n).order=t})),function(e,n,t){var r,o={};zb.forEach(t,(function(t){for(var i,a,u=e.parent(t);u;){if((i=e.parent(u))?(a=o[i],o[i]=u):(a=r,r=u),a&&a!==u)return void n.setEdge(a,u);u=i}}))}(e,t,o.vs)}))}function Xb(e,n){Tb.forEach(n,(function(n){Tb.forEach(n,(function(n,t){e.node(n).order=t}))}))}var Fb=lw,Ub=nw.Graph,Gb=Nw;function $b(e,n,t){if(n>t){var r=n;n=t,t=r}var o=e[n];o||(e[n]=o={}),o[t]=!0}function Wb(e,n,t){if(n>t){var r=n;n=t,t=r}return Fb.has(e[n],t)}var qb=lw,Kb=Nw,Qb=function(e){var n,t=Gb.buildLayerMatrix(e),r=Fb.merge(function(e,n){var t={};return Fb.reduce(n,(function(n,r){var o=0,i=0,a=n.length,u=Fb.last(r);return Fb.forEach(r,(function(n,c){var s=function(e,n){if(e.node(n).dummy)return Fb.find(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),l=s?e.node(s).order:a;(s||n===u)&&(Fb.forEach(r.slice(i,c+1),(function(n){Fb.forEach(e.predecessors(n),(function(r){var i=e.node(r),a=i.order;!(a<o||l<a)||i.dummy&&e.node(n).dummy||$b(t,r,n)}))})),i=c+1,o=l)})),r})),t}(e,t),function(e,n){var t={};function r(n,r,o,i,a){var u;Fb.forEach(Fb.range(r,o),(function(r){u=n[r],e.node(u).dummy&&Fb.forEach(e.predecessors(u),(function(n){var r=e.node(n);r.dummy&&(r.order<i||r.order>a)&&$b(t,n,u)}))}))}return Fb.reduce(n,(function(n,t){var o,i=-1,a=0;return Fb.forEach(t,(function(u,c){if("border"===e.node(u).dummy){var s=e.predecessors(u);s.length&&(o=e.node(s[0]).order,r(t,a,c,i,o),a=c,i=o)}r(t,a,t.length,o,n.length)})),t})),t}(e,t)),o={};Fb.forEach(["u","d"],(function(i){n="u"===i?t:Fb.values(t).reverse(),Fb.forEach(["l","r"],(function(t){"r"===t&&(n=Fb.map(n,(function(e){return Fb.values(e).reverse()})));var a=("u"===i?e.predecessors:e.successors).bind(e),u=function(e,n,t,r){var o={},i={},a={};return Fb.forEach(n,(function(e){Fb.forEach(e,(function(e,n){o[e]=e,i[e]=e,a[e]=n}))})),Fb.forEach(n,(function(e){var n=-1;Fb.forEach(e,(function(e){var u=r(e);if(u.length){u=Fb.sortBy(u,(function(e){return a[e]}));for(var c=(u.length-1)/2,s=Math.floor(c),l=Math.ceil(c);s<=l;++s){var d=u[s];i[e]===e&&n<a[d]&&!Wb(t,e,d)&&(i[d]=e,i[e]=o[e]=o[d],n=a[d])}}}))})),{root:o,align:i}}(0,n,r,a),c=function(e,n,t,r,o){var i={},a=function(e,n,t,r){var o=new Ub,i=e.graph(),a=function(e,n,t){return function(r,o,i){var a,u=r.node(o),c=r.node(i),s=0;if(s+=u.width/2,Fb.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(s+=t?a:-a),a=0,s+=(u.dummy?n:e)/2,s+=(c.dummy?n:e)/2,s+=c.width/2,Fb.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(s+=t?a:-a),a=0,s}}(i.nodesep,i.edgesep,r);return Fb.forEach(n,(function(n){var r;Fb.forEach(n,(function(n){var i=t[n];if(o.setNode(i),r){var u=t[r],c=o.edge(u,i);o.setEdge(u,i,Math.max(a(e,n,r),c||0))}r=n}))})),o}(e,n,t,o),u=o?"borderLeft":"borderRight";function c(e,n){for(var t=a.nodes(),r=t.pop(),o={};r;)o[r]?e(r):(o[r]=!0,t.push(r),t=t.concat(n(r))),r=t.pop()}return c((function(e){i[e]=a.inEdges(e).reduce((function(e,n){return Math.max(e,i[n.v]+a.edge(n))}),0)}),a.predecessors.bind(a)),c((function(n){var t=a.outEdges(n).reduce((function(e,n){return Math.min(e,i[n.w]-a.edge(n))}),Number.POSITIVE_INFINITY),r=e.node(n);t!==Number.POSITIVE_INFINITY&&r.borderType!==u&&(i[n]=Math.max(i[n],t))}),a.successors.bind(a)),Fb.forEach(r,(function(e){i[e]=i[t[e]]})),i}(e,n,u.root,u.align,"r"===t);"r"===t&&(c=Fb.mapValues(c,(function(e){return-e}))),o[i+t]=c}))}));var i=function(e,n){return Fb.minBy(Fb.values(n),(function(n){var t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return Fb.forIn(n,(function(n,o){var i=function(e,n){return e.node(n).width}(e,o)/2;t=Math.max(n+i,t),r=Math.min(n-i,r)})),t-r}))}(e,o);return function(e,n){var t=Fb.values(n),r=Fb.min(t),o=Fb.max(t);Fb.forEach(["u","d"],(function(t){Fb.forEach(["l","r"],(function(i){var a,u=t+i,c=e[u];if(c!==n){var s=Fb.values(c);(a="l"===i?r-Fb.min(s):o-Fb.max(s))&&(e[u]=Fb.mapValues(c,(function(e){return e+a})))}}))}))}(o,i),function(e,n){return Fb.mapValues(e.ul,(function(t,r){if(n)return e[n.toLowerCase()][r];var o=Fb.sortBy(Fb.map(e,r));return(o[1]+o[2])/2}))}(o,e.graph().align)},Jb=lw,ex=Ew,nx=jw,tx=function(e){switch(e.graph().ranker){case"network-simplex":default:!function(e){ub(e)}(e);break;case"tight-tree":!function(e){ib(e),ab(e)}(e);break;case"longest-path":cb(e)}},rx=Nw.normalizeRanks,ox=function(e){var n=function(e){var n={},t=0;return sb.forEach(e.children(),(function r(o){var i=t;sb.forEach(e.children(o),r),n[o]={low:i,lim:t++}})),n}(e);sb.forEach(e.graph().dummyChains,(function(t){for(var r=e.node(t),o=r.edgeObj,i=function(e,n,t,r){var o,i,a=[],u=[],c=Math.min(n[t].low,n[r].low),s=Math.max(n[t].lim,n[r].lim);o=t;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>c||s>n[o].lim));for(i=o,o=r;(o=e.parent(o))!==i;)u.push(o);return{path:a.concat(u.reverse()),lca:i}}(e,n,o.v,o.w),a=i.path,u=i.lca,c=0,s=a[c],l=!0;t!==o.w;){if(r=e.node(t),l){for(;(s=a[c])!==u&&e.node(s).maxRank<r.rank;)c++;s===u&&(l=!1)}if(!l){for(;c<a.length-1&&e.node(s=a[c+1]).minRank<=r.rank;)c++;s=a[c]}e.setParent(t,s),t=e.successors(t)[0]}}))},ix=Nw.removeEmptyRanks,ax=fb,ux=function(e){vb.forEach(e.children(),(function n(t){var r=e.children(t),o=e.node(t);if(r.length&&vb.forEach(r,n),vb.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)gb(e,"borderLeft","_bl",t,o,i),gb(e,"borderRight","_br",t,o,i)}}))},cx=mb,sx=function(e){var n=Hb.maxRank(e),t=Zb(e,Tb.range(1,n+1),"inEdges"),r=Zb(e,Tb.range(n-1,-1,-1),"outEdges"),o=Bb(e);Xb(e,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){Yb(u%2?t:r,u%4>=2),o=Hb.buildLayerMatrix(e);var s=Db(e,o);s<a&&(c=0,i=Tb.cloneDeep(o),a=s)}Xb(e,i)},lx=Nw,dx=nw.Graph,fx=["nodesep","edgesep","ranksep","marginx","marginy"],hx={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},vx=["acyclicer","ranker","rankdir","align"],px=["width","height"],gx={width:0,height:0},yx=["minlen","weight","width","height","labeloffset"],mx={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},wx=["labelpos"];function bx(e,n){return Jb.mapValues(Jb.pick(e,n),Number)}function xx(e){var n={};return Jb.forEach(e,(function(e,t){n[t.toLowerCase()]=e})),n}var _x=lw,Ex=Nw,Sx=nw.Graph,kx=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}({graphlib:nw,layout:function(e,n){var t=n&&n.debugTiming?lx.time:lx.notime;t("layout",(function(){var n=t(" buildLayoutGraph",(function(){return function(e){var n=new dx({multigraph:!0,compound:!0}),t=xx(e.graph());return n.setGraph(Jb.merge({},hx,bx(t,fx),Jb.pick(t,vx))),Jb.forEach(e.nodes(),(function(t){var r=xx(e.node(t));n.setNode(t,Jb.defaults(bx(r,px),gx)),n.setParent(t,e.parent(t))})),Jb.forEach(e.edges(),(function(t){var r=xx(e.edge(t));n.setEdge(t,Jb.merge({},mx,bx(r,yx),Jb.pick(r,wx)))})),n}(e)}));t(" runLayout",(function(){!function(e,n){n(" makeSpaceForEdgeLabels",(function(){!function(e){var n=e.graph();n.ranksep/=2,Jb.forEach(e.edges(),(function(t){var r=e.edge(t);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(e)})),n(" removeSelfEdges",(function(){!function(e){Jb.forEach(e.edges(),(function(n){if(n.v===n.w){var t=e.node(n.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}}))}(e)})),n(" acyclic",(function(){ex.run(e)})),n(" nestingGraph.run",(function(){ax.run(e)})),n(" rank",(function(){tx(lx.asNonCompoundGraph(e))})),n(" injectEdgeLabelProxies",(function(){!function(e){Jb.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.width&&t.height){var r=e.node(n.v),o={rank:(e.node(n.w).rank-r.rank)/2+r.rank,e:n};lx.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e)})),n(" removeEmptyRanks",(function(){ix(e)})),n(" nestingGraph.cleanup",(function(){ax.cleanup(e)})),n(" normalizeRanks",(function(){rx(e)})),n(" assignRankMinMax",(function(){!function(e){var n=0;Jb.forEach(e.nodes(),(function(t){var r=e.node(t);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,n=Jb.max(n,r.maxRank))})),e.graph().maxRank=n}(e)})),n(" removeEdgeLabelProxies",(function(){!function(e){Jb.forEach(e.nodes(),(function(n){var t=e.node(n);"edge-proxy"===t.dummy&&(e.edge(t.e).labelRank=t.rank,e.removeNode(n))}))}(e)})),n(" normalize.run",(function(){nx.run(e)})),n(" parentDummyChains",(function(){ox(e)})),n(" addBorderSegments",(function(){ux(e)})),n(" order",(function(){sx(e)})),n(" insertSelfEdges",(function(){!function(e){var n=lx.buildLayerMatrix(e);Jb.forEach(n,(function(n){var t=0;Jb.forEach(n,(function(n,r){var o=e.node(n);o.order=r+t,Jb.forEach(o.selfEdges,(function(n){lx.addDummyNode(e,"selfedge",{width:n.label.width,height:n.label.height,rank:o.rank,order:r+ ++t,e:n.e,label:n.label},"_se")})),delete o.selfEdges}))}))}(e)})),n(" adjustCoordinateSystem",(function(){cx.adjust(e)})),n(" position",(function(){!function(e){(function(e){var n=Kb.buildLayerMatrix(e),t=e.graph().ranksep,r=0;qb.forEach(n,(function(n){var o=qb.max(qb.map(n,(function(n){return e.node(n).height})));qb.forEach(n,(function(n){e.node(n).y=r+o/2})),r+=o+t}))})(e=Kb.asNonCompoundGraph(e)),qb.forEach(Qb(e),(function(n,t){e.node(t).x=n}))}(e)})),n(" positionSelfEdges",(function(){!function(e){Jb.forEach(e.nodes(),(function(n){var t=e.node(n);if("selfedge"===t.dummy){var r=e.node(t.e.v),o=r.x+r.width/2,i=r.y,a=t.x-o,u=r.height/2;e.setEdge(t.e,t.label),e.removeNode(n),t.label.points=[{x:o+2*a/3,y:i-u},{x:o+5*a/6,y:i-u},{x:o+a,y:i},{x:o+5*a/6,y:i+u},{x:o+2*a/3,y:i+u}],t.label.x=t.x,t.label.y=t.y}}))}(e)})),n(" removeBorderNodes",(function(){!function(e){Jb.forEach(e.nodes(),(function(n){if(e.children(n).length){var t=e.node(n),r=e.node(t.borderTop),o=e.node(t.borderBottom),i=e.node(Jb.last(t.borderLeft)),a=e.node(Jb.last(t.borderRight));t.width=Math.abs(a.x-i.x),t.height=Math.abs(o.y-r.y),t.x=i.x+t.width/2,t.y=r.y+t.height/2}})),Jb.forEach(e.nodes(),(function(n){"border"===e.node(n).dummy&&e.removeNode(n)}))}(e)})),n(" normalize.undo",(function(){nx.undo(e)})),n(" fixupEdgeLabelCoords",(function(){!function(e){Jb.forEach(e.edges(),(function(n){var t=e.edge(n);if(Jb.has(t,"x"))switch("l"!==t.labelpos&&"r"!==t.labelpos||(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset}}))}(e)})),n(" undoCoordinateSystem",(function(){cx.undo(e)})),n(" translateGraph",(function(){!function(e){var n=Number.POSITIVE_INFINITY,t=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),a=i.marginx||0,u=i.marginy||0;function c(e){var i=e.x,a=e.y,u=e.width,c=e.height;n=Math.min(n,i-u/2),t=Math.max(t,i+u/2),r=Math.min(r,a-c/2),o=Math.max(o,a+c/2)}Jb.forEach(e.nodes(),(function(n){c(e.node(n))})),Jb.forEach(e.edges(),(function(n){var t=e.edge(n);Jb.has(t,"x")&&c(t)})),n-=a,r-=u,Jb.forEach(e.nodes(),(function(t){var o=e.node(t);o.x-=n,o.y-=r})),Jb.forEach(e.edges(),(function(t){var o=e.edge(t);Jb.forEach(o.points,(function(e){e.x-=n,e.y-=r})),Jb.has(o,"x")&&(o.x-=n),Jb.has(o,"y")&&(o.y-=r)})),i.width=t-n+a,i.height=o-r+u}(e)})),n(" assignNodeIntersects",(function(){!function(e){Jb.forEach(e.edges(),(function(n){var t,r,o=e.edge(n),i=e.node(n.v),a=e.node(n.w);o.points?(t=o.points[0],r=o.points[o.points.length-1]):(o.points=[],t=a,r=i),o.points.unshift(lx.intersectRect(i,t)),o.points.push(lx.intersectRect(a,r))}))}(e)})),n(" reversePoints",(function(){!function(e){Jb.forEach(e.edges(),(function(n){var t=e.edge(n);t.reversed&&t.points.reverse()}))}(e)})),n(" acyclic.undo",(function(){ex.undo(e)}))}(n,t)})),t(" updateInputGraph",(function(){!function(e,n){Jb.forEach(e.nodes(),(function(t){var r=e.node(t),o=n.node(t);r&&(r.x=o.x,r.y=o.y,n.children(t).length&&(r.width=o.width,r.height=o.height))})),Jb.forEach(e.edges(),(function(t){var r=e.edge(t),o=n.edge(t);r.points=o.points,Jb.has(o,"x")&&(r.x=o.x,r.y=o.y)})),e.graph().width=n.graph().width,e.graph().height=n.graph().height}(e,n)}))}))},debug:{debugOrdering:function(e){var n=Ex.buildLayerMatrix(e),t=new Sx({compound:!0,multigraph:!0}).setGraph({});return _x.forEach(e.nodes(),(function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+e.node(n).rank)})),_x.forEach(e.edges(),(function(e){t.setEdge(e.v,e.w,{},e.name)})),_x.forEach(n,(function(e,n){var r="layer"+n;t.setNode(r,{rank:"same"}),_x.reduce(e,(function(e,n){return t.setEdge(e,n,{style:"invis"}),n}))})),t}},util:{time:Nw.time,notime:Nw.notime},version:"0.8.5"});exports.ControlButton=tu,exports.Controls=uu,exports.Handle=Di,exports.InkFlowProvider=Za,exports.dagreLayout=function(e,n,t){void 0===t&&(t={rankdir:"TB"});var r=t.rankdir,o=new kx.graphlib.Graph;return o.setDefaultEdgeLabel((function(){return{}})),o.setGraph({rankdir:r}),e.forEach((function(e){var n,t;if(!e.id)throw new Error('Node "id" does not exist');var r=(null===(n=e.data)||void 0===n?void 0:n.width)||200,i=(null===(t=e.data)||void 0===t?void 0:t.height)||56;o.setNode(e.id,{width:r,height:i})})),n.forEach((function(e){o.setEdge(e.source,e.target)})),kx.layout(o),e.forEach((function(e){var n=o.node(e.id),t="bottom",i="top";switch(r){case"TB":t="bottom",i="top";break;case"BT":t="top",i="bottom";break;case"LR":case"RL":t="right",i="left"}e.targetPosition=i,e.sourcePosition=t,e.position={x:n.x-n.width/2,y:n.y-n.height/2}})),{nodes:e,edges:n}},exports.default=qa,exports.useEdgesState=function(n){var t=a(e.useState(n),2),r=t[0],o=t[1],i=e.useCallback((function(e){return o((function(n){return Vo(e,n)}))}),[]);return[r,o,i]},exports.useInkFlow=hi,exports.useNodesState=function(n){var t=a(e.useState(n),2),r=t[0],o=t[1],i=e.useCallback((function(e){return o((function(n){return Ho(e,n)}))}),[]);return[r,o,i]},exports.useStore=D,exports.useStoreApi=L;
17
- //# sourceMappingURL=index.cjs.js.map