yamlover 0.3.56 → 0.3.58

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 (46) hide show
  1. package/README.md +48 -5
  2. package/bin/yamlover.js +41 -4
  3. package/dist/agent-docs/AGENTS.md +20 -333
  4. package/dist/agent-docs/AGENTS.yo +621 -0
  5. package/dist/builtin-taxonomy/$defs/.yo/meta.yo +0 -2
  6. package/dist/builtin-taxonomy/$defs/decision +34 -0
  7. package/dist/builtin-taxonomy/$defs/edit +60 -0
  8. package/dist/builtin-taxonomy/$defs/edit-answer +21 -0
  9. package/dist/builtin-taxonomy/$defs/edit-batch +31 -0
  10. package/dist/builtin-taxonomy/$defs/envelope +169 -0
  11. package/dist/builtin-taxonomy/$defs/event +85 -0
  12. package/dist/builtin-taxonomy/$defs/link +58 -0
  13. package/dist/builtin-taxonomy/$defs/task +28 -19
  14. package/dist/builtin-taxonomy/$defs/workflow +3 -0
  15. package/dist/builtin-taxonomy/ontos/.yo/body.yo +7 -1
  16. package/dist/client/assets/{decoded-CytDRqwJ.js → decoded-Bj1qJCo_.js} +1 -1
  17. package/dist/client/assets/{djvu-Da-iyAV_.js → djvu-lnurzbzN.js} +1 -1
  18. package/dist/client/assets/{docx-CX_gHuMq.js → docx-DpN_PtM8.js} +1 -1
  19. package/dist/client/assets/{heic-Bf9423pJ.js → heic-BqJutS0N.js} +1 -1
  20. package/dist/client/assets/imagemap-rdhcPlWy.js +1 -0
  21. package/dist/client/assets/index-0ALNONIF.js +962 -0
  22. package/dist/client/assets/index-BiETmvLO.css +1 -0
  23. package/dist/client/assets/map-Btm4SlVs.js +1 -0
  24. package/dist/client/assets/paged-Cjy3svw2.js +1 -0
  25. package/dist/client/assets/{openable-D48EbC_P.js → panzoom-BXEAw479.js} +2 -2
  26. package/dist/client/assets/{pdf-Dj6UMm-B.js → pdf-DvC2sbDN.js} +1 -1
  27. package/dist/client/assets/psd-BKmCWsdC.js +11 -0
  28. package/dist/client/assets/{spreadsheet-BmqsAKDF.js → spreadsheet-Coy5sooG.js} +1 -1
  29. package/dist/client/assets/tiff-IcWiNdYs.js +1 -0
  30. package/dist/client/assets/video-YC-ZvXg7.js +1 -0
  31. package/dist/client/assets/xyflow-CFNcu5cT.js +23 -0
  32. package/dist/client/index.html +2 -2
  33. package/dist/server.js +8818 -5114
  34. package/dist/wire/openapi.yo +935 -0
  35. package/package.json +6 -1
  36. package/dist/agent-docs/CLAUDE.md +0 -7
  37. package/dist/builtin-taxonomy/$defs/board +0 -15
  38. package/dist/client/assets/imagemap-BaCsSWT2.js +0 -1
  39. package/dist/client/assets/index-CLllgDtO.js +0 -765
  40. package/dist/client/assets/index-CYdxG8JF.css +0 -1
  41. package/dist/client/assets/map-C0h_m0kt.js +0 -1
  42. package/dist/client/assets/paged-YrFta0Z1.js +0 -1
  43. package/dist/client/assets/psd-vtV8RE5t.js +0 -11
  44. package/dist/client/assets/tiff-DTjYlW1c.js +0 -1
  45. package/dist/client/assets/xyflow-DLSA3Qi6.js +0 -23
  46. /package/dist/client/assets/{openable-CIGW-MKW.css → panzoom-CIGW-MKW.css} +0 -0
@@ -0,0 +1,23 @@
1
+ import{r as T,g as tl,n as nl,j as P,o as fe,p as er,q as on,v as jt,w as rn,x as vo,y as xn,z as ol,A as rl,B as il,C as sl,E as al,F as cl,G as ll,H as ul,I as dl,J as fl,K as hl,L as gl}from"./index-0ALNONIF.js";import{a as pl}from"./paged-Cjy3svw2.js";function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var ml={value:()=>{}};function vn(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Ut(n)}function Ut(e){this._=e}function yl(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Ut.prototype=vn.prototype={constructor:Ut,on:function(e,t){var n=this._,o=yl(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=wl(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=tr(n[r],e.name,t);else if(t==null)for(r in n)n[r]=tr(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Ut(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function wl(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function tr(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ml,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var oo="http://www.w3.org/1999/xhtml";const nr={svg:"http://www.w3.org/2000/svg",xhtml:oo,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function bn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),nr.hasOwnProperty(t)?{space:nr[t],local:e}:e}function xl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===oo&&t.documentElement.namespaceURI===oo?t.createElement(e):t.createElementNS(n,e)}}function vl(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Pi(e){var t=bn(e);return(t.local?vl:xl)(t)}function bl(){}function bo(e){return e==null?bl:function(){return this.querySelector(e)}}function El(e){typeof e!="function"&&(e=bo(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,c,u=0;u<s;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new le(o,this._parents)}function _l(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Nl(){return[]}function Ai(e){return e==null?Nl:function(){return this.querySelectorAll(e)}}function Sl(e){return function(){return _l(e.apply(this,arguments))}}function kl(e){typeof e=="function"?e=Sl(e):e=Ai(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));return new le(o,r)}function $i(e){return function(){return this.matches(e)}}function Ti(e){return function(t){return t.matches(e)}}var Cl=Array.prototype.find;function Ml(e){return function(){return Cl.call(this.children,e)}}function Il(){return this.firstElementChild}function Ol(e){return this.select(e==null?Il:Ml(typeof e=="function"?e:Ti(e)))}var Pl=Array.prototype.filter;function Al(){return Array.from(this.children)}function $l(e){return function(){return Pl.call(this.children,e)}}function Tl(e){return this.selectAll(e==null?Al:$l(typeof e=="function"?e:Ti(e)))}function Dl(e){typeof e!="function"&&(e=$i(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new le(o,this._parents)}function Di(e){return new Array(e.length)}function Ll(){return new le(this._enter||this._groups.map(Di),this._parents)}function sn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}sn.prototype={constructor:sn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Rl(e){return function(){return e}}function zl(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new sn(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function jl(e,t,n,o,r,i,s){var a,l,c=new Map,u=t.length,d=i.length,f=new Array(u),h;for(a=0;a<u;++a)(l=t[a])&&(f[a]=h=s.call(l,l.__data__,a,t)+"",c.has(h)?r[a]=l:c.set(h,l));for(a=0;a<d;++a)h=s.call(e,i[a],a,i)+"",(l=c.get(h))?(o[a]=l,l.__data__=i[a],c.delete(h)):n[a]=new sn(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function Hl(e){return e.__data__}function Vl(e,t){if(!arguments.length)return Array.from(this,Hl);var n=t?jl:zl,o=this._parents,r=this._groups;typeof e!="function"&&(e=Rl(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var u=o[c],d=r[c],f=d.length,h=Bl(e.call(u,u&&u.__data__,c,o)),g=h.length,x=a[c]=new Array(g),y=s[c]=new Array(g),p=l[c]=new Array(f);n(u,d,x,y,p,h,t);for(var E=0,m=0,v,S;E<g;++E)if(v=x[E]){for(E>=m&&(m=E+1);!(S=y[m])&&++m<g;);v._next=S||null}}return s=new le(s,o),s._enter=a,s._exit=l,s}function Bl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Fl(){return new le(this._exit||this._groups.map(Di),this._parents)}function Yl(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Xl(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=n[l],u=o[l],d=c.length,f=a[l]=new Array(d),h,g=0;g<d;++g)(h=c[g]||u[g])&&(f[g]=h);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function Zl(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Wl(e){e||(e=Gl);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new le(r,this._parents).order()}function Gl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ql(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Kl(){return Array.from(this)}function Ul(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Ql(){let e=0;for(const t of this)++e;return e}function Jl(){return!this.node()}function eu(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function tu(e){return function(){this.removeAttribute(e)}}function nu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ou(e,t){return function(){this.setAttribute(e,t)}}function ru(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function iu(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function su(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function au(e,t){var n=bn(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?nu:tu:typeof t=="function"?n.local?su:iu:n.local?ru:ou)(n,t))}function Li(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function cu(e){return function(){this.style.removeProperty(e)}}function lu(e,t,n){return function(){this.style.setProperty(e,t,n)}}function uu(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function du(e,t,n){return arguments.length>1?this.each((t==null?cu:typeof t=="function"?uu:lu)(e,t,n??"")):tt(this.node(),e)}function tt(e,t){return e.style.getPropertyValue(t)||Li(e).getComputedStyle(e,null).getPropertyValue(t)}function fu(e){return function(){delete this[e]}}function hu(e,t){return function(){this[e]=t}}function gu(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function pu(e,t){return arguments.length>1?this.each((t==null?fu:typeof t=="function"?gu:hu)(e,t)):this.node()[e]}function Ri(e){return e.trim().split(/^|\s+/)}function Eo(e){return e.classList||new zi(e)}function zi(e){this._node=e,this._names=Ri(e.getAttribute("class")||"")}zi.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ji(e,t){for(var n=Eo(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Hi(e,t){for(var n=Eo(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function mu(e){return function(){ji(this,e)}}function yu(e){return function(){Hi(this,e)}}function wu(e,t){return function(){(t.apply(this,arguments)?ji:Hi)(this,e)}}function xu(e,t){var n=Ri(e+"");if(arguments.length<2){for(var o=Eo(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?wu:t?mu:yu)(n,t))}function vu(){this.textContent=""}function bu(e){return function(){this.textContent=e}}function Eu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function _u(e){return arguments.length?this.each(e==null?vu:(typeof e=="function"?Eu:bu)(e)):this.node().textContent}function Nu(){this.innerHTML=""}function Su(e){return function(){this.innerHTML=e}}function ku(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Cu(e){return arguments.length?this.each(e==null?Nu:(typeof e=="function"?ku:Su)(e)):this.node().innerHTML}function Mu(){this.nextSibling&&this.parentNode.appendChild(this)}function Iu(){return this.each(Mu)}function Ou(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pu(){return this.each(Ou)}function Au(e){var t=typeof e=="function"?e:Pi(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function $u(){return null}function Tu(e,t){var n=typeof e=="function"?e:Pi(e),o=t==null?$u:typeof t=="function"?t:bo(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Du(){var e=this.parentNode;e&&e.removeChild(this)}function Lu(){return this.each(Du)}function Ru(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ju(e){return this.select(e?zu:Ru)}function Hu(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Vu(e){return function(t){e.call(this,t,this.__data__)}}function Bu(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Fu(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Yu(e,t,n){return function(){var o=this.__on,r,i=Vu(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Xu(e,t,n){var o=Bu(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Yu:Fu,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Vi(e,t,n){var o=Li(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Zu(e,t){return function(){return Vi(this,e,t)}}function Wu(e,t){return function(){return Vi(this,e,t.apply(this,arguments))}}function Gu(e,t){return this.each((typeof t=="function"?Wu:Zu)(e,t))}function*qu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Bi=[null];function le(e,t){this._groups=e,this._parents=t}function At(){return new le([[document.documentElement]],Bi)}function Ku(){return this}le.prototype=At.prototype={constructor:le,select:El,selectAll:kl,selectChild:Ol,selectChildren:Tl,filter:Dl,data:Vl,enter:Ll,exit:Fl,join:Yl,merge:Xl,selection:Ku,order:Zl,sort:Wl,call:ql,nodes:Kl,node:Ul,size:Ql,empty:Jl,each:eu,attr:au,style:du,property:pu,classed:xu,text:_u,html:Cu,raise:Iu,lower:Pu,append:Au,insert:Tu,remove:Lu,clone:ju,datum:Hu,on:Xu,dispatch:Gu,[Symbol.iterator]:qu};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Bi)}function Uu(e){let t;for(;t=e.sourceEvent;)e=t;return e}function he(e,t){if(e=Uu(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Qu={passive:!1},vt={capture:!0,passive:!1};function Rn(e){e.stopImmediatePropagation()}function Je(e){e.preventDefault(),e.stopImmediatePropagation()}function Fi(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Je,vt);"onselectstart"in t?n.on("selectstart.drag",Je,vt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Yi(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Je,vt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Ht=e=>()=>e;function ro(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}ro.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Ju(e){return!e.ctrlKey&&!e.button}function ed(){return this.parentNode}function td(e,t){return t??{x:e.x,y:e.y}}function nd(){return navigator.maxTouchPoints||"ontouchstart"in this}function Xi(){var e=Ju,t=ed,n=td,o=nd,r={},i=vn("start","drag","end"),s=0,a,l,c,u,d=0;function f(v){v.on("mousedown.drag",h).filter(o).on("touchstart.drag",y).on("touchmove.drag",p,Qu).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(v,S){if(!(u||!e.call(this,v,S))){var N=m(this,t.call(this,v,S),v,S,"mouse");N&&(ce(v.view).on("mousemove.drag",g,vt).on("mouseup.drag",x,vt),Fi(v.view),Rn(v),c=!1,a=v.clientX,l=v.clientY,N("start",v))}}function g(v){if(Je(v),!c){var S=v.clientX-a,N=v.clientY-l;c=S*S+N*N>d}r.mouse("drag",v)}function x(v){ce(v.view).on("mousemove.drag mouseup.drag",null),Yi(v.view,c),Je(v),r.mouse("end",v)}function y(v,S){if(e.call(this,v,S)){var N=v.changedTouches,b=t.call(this,v,S),_=N.length,C,L;for(C=0;C<_;++C)(L=m(this,b,v,S,N[C].identifier,N[C]))&&(Rn(v),L("start",v,N[C]))}}function p(v){var S=v.changedTouches,N=S.length,b,_;for(b=0;b<N;++b)(_=r[S[b].identifier])&&(Je(v),_("drag",v,S[b]))}function E(v){var S=v.changedTouches,N=S.length,b,_;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),b=0;b<N;++b)(_=r[S[b].identifier])&&(Rn(v),_("end",v,S[b]))}function m(v,S,N,b,_,C){var L=i.copy(),O=he(C||N,S),A,I,w;if((w=n.call(v,new ro("beforestart",{sourceEvent:N,target:f,identifier:_,active:s,x:O[0],y:O[1],dx:0,dy:0,dispatch:L}),b))!=null)return A=w.x-O[0]||0,I=w.y-O[1]||0,function k(M,$,R){var D=O,V;switch(M){case"start":r[_]=k,V=s++;break;case"end":delete r[_],--s;case"drag":O=he(R||$,S),V=s;break}L.call(M,v,new ro(M,{sourceEvent:$,subject:w,target:f,identifier:_,active:V,x:O[0]+A,y:O[1]+I,dx:O[0]-D[0],dy:O[1]-D[1],dispatch:L}),b)}}return f.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Ht(!!v),f):e},f.container=function(v){return arguments.length?(t=typeof v=="function"?v:Ht(v),f):t},f.subject=function(v){return arguments.length?(n=typeof v=="function"?v:Ht(v),f):n},f.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:Ht(!!v),f):o},f.on=function(){var v=i.on.apply(i,arguments);return v===i?f:v},f.clickDistance=function(v){return arguments.length?(d=(v=+v)*v,f):Math.sqrt(d)},f}function _o(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Zi(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function $t(){}var bt=.7,an=1/bt,et="\\s*([+-]?\\d+)\\s*",Et="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_e="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",od=/^#([0-9a-f]{3,8})$/,rd=new RegExp(`^rgb\\(${et},${et},${et}\\)$`),id=new RegExp(`^rgb\\(${_e},${_e},${_e}\\)$`),sd=new RegExp(`^rgba\\(${et},${et},${et},${Et}\\)$`),ad=new RegExp(`^rgba\\(${_e},${_e},${_e},${Et}\\)$`),cd=new RegExp(`^hsl\\(${Et},${_e},${_e}\\)$`),ld=new RegExp(`^hsla\\(${Et},${_e},${_e},${Et}\\)$`),or={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};_o($t,Ye,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:rr,formatHex:rr,formatHex8:ud,formatHsl:dd,formatRgb:ir,toString:ir});function rr(){return this.rgb().formatHex()}function ud(){return this.rgb().formatHex8()}function dd(){return Wi(this).formatHsl()}function ir(){return this.rgb().formatRgb()}function Ye(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=od.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?sr(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Vt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Vt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=rd.exec(e))?new ae(t[1],t[2],t[3],1):(t=id.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=sd.exec(e))?Vt(t[1],t[2],t[3],t[4]):(t=ad.exec(e))?Vt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=cd.exec(e))?lr(t[1],t[2]/100,t[3]/100,1):(t=ld.exec(e))?lr(t[1],t[2]/100,t[3]/100,t[4]):or.hasOwnProperty(e)?sr(or[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function sr(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function Vt(e,t,n,o){return o<=0&&(e=t=n=NaN),new ae(e,t,n,o)}function fd(e){return e instanceof $t||(e=Ye(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function io(e,t,n,o){return arguments.length===1?fd(e):new ae(e,t,n,o??1)}function ae(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}_o(ae,io,Zi($t,{brighter(e){return e=e==null?an:Math.pow(an,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?bt:Math.pow(bt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Be(this.r),Be(this.g),Be(this.b),cn(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:ar,formatHex:ar,formatHex8:hd,formatRgb:cr,toString:cr}));function ar(){return`#${Ve(this.r)}${Ve(this.g)}${Ve(this.b)}`}function hd(){return`#${Ve(this.r)}${Ve(this.g)}${Ve(this.b)}${Ve((isNaN(this.opacity)?1:this.opacity)*255)}`}function cr(){const e=cn(this.opacity);return`${e===1?"rgb(":"rgba("}${Be(this.r)}, ${Be(this.g)}, ${Be(this.b)}${e===1?")":`, ${e})`}`}function cn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Be(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ve(e){return e=Be(e),(e<16?"0":"")+e.toString(16)}function lr(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ge(e,t,n,o)}function Wi(e){if(e instanceof ge)return new ge(e.h,e.s,e.l,e.opacity);if(e instanceof $t||(e=Ye(e)),!e)return new ge;if(e instanceof ge)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new ge(s,a,l,e.opacity)}function gd(e,t,n,o){return arguments.length===1?Wi(e):new ge(e,t,n,o??1)}function ge(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}_o(ge,gd,Zi($t,{brighter(e){return e=e==null?an:Math.pow(an,e),new ge(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?bt:Math.pow(bt,e),new ge(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new ae(zn(e>=240?e-240:e+120,r,o),zn(e,r,o),zn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new ge(ur(this.h),Bt(this.s),Bt(this.l),cn(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=cn(this.opacity);return`${e===1?"hsl(":"hsla("}${ur(this.h)}, ${Bt(this.s)*100}%, ${Bt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ur(e){return e=(e||0)%360,e<0?e+360:e}function Bt(e){return Math.max(0,Math.min(1,e||0))}function zn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const No=e=>()=>e;function pd(e,t){return function(n){return e+n*t}}function md(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function yd(e){return(e=+e)==1?Gi:function(t,n){return n-t?md(t,n,e):No(isNaN(t)?n:t)}}function Gi(e,t){var n=t-e;return n?pd(e,n):No(isNaN(e)?t:e)}const ln=function e(t){var n=yd(t);function o(r,i){var s=n((r=io(r)).r,(i=io(i)).r),a=n(r.g,i.g),l=n(r.b,i.b),c=Gi(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return o.gamma=e,o}(1);function wd(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function xd(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function vd(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=wt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function bd(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function be(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Ed(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=wt(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var so=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jn=new RegExp(so.source,"g");function _d(e){return function(){return e}}function Nd(e){return function(t){return e(t)+""}}function qi(e,t){var n=so.lastIndex=jn.lastIndex=0,o,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=so.exec(e))&&(r=jn.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:be(o,r)})),n=jn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?Nd(l[0].x):_d(t):(t=l.length,function(c){for(var u=0,d;u<t;++u)a[(d=l[u]).i]=d.x(c);return a.join("")})}function wt(e,t){var n=typeof t,o;return t==null||n==="boolean"?No(t):(n==="number"?be:n==="string"?(o=Ye(t))?(t=o,ln):qi:t instanceof Ye?ln:t instanceof Date?bd:xd(t)?wd:Array.isArray(t)?vd:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Ed:be)(e,t)}var dr=180/Math.PI,ao={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ki(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*dr,skewX:Math.atan(l)*dr,scaleX:s,scaleY:a}}var Ft;function Sd(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ao:Ki(t.a,t.b,t.c,t.d,t.e,t.f)}function kd(e){return e==null||(Ft||(Ft=document.createElementNS("http://www.w3.org/2000/svg","g")),Ft.setAttribute("transform",e),!(e=Ft.transform.baseVal.consolidate()))?ao:(e=e.matrix,Ki(e.a,e.b,e.c,e.d,e.e,e.f))}function Ui(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,u,d,f,h,g){if(c!==d||u!==f){var x=h.push("translate(",null,t,null,n);g.push({i:x-4,x:be(c,d)},{i:x-2,x:be(u,f)})}else(d||f)&&h.push("translate("+d+t+f+n)}function s(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:be(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,f){c!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:be(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,f,h,g){if(c!==d||u!==f){var x=h.push(r(h)+"scale(",null,",",null,")");g.push({i:x-4,x:be(c,d)},{i:x-2,x:be(u,f)})}else(d!==1||f!==1)&&h.push(r(h)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,d,f),s(c.rotate,u.rotate,d,f),a(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(h){for(var g=-1,x=f.length,y;++g<x;)d[(y=f[g]).i]=y.x(h);return d.join("")}}}var Cd=Ui(Sd,"px, ","px)","deg)"),Md=Ui(kd,", ",")",")"),Id=1e-12;function fr(e){return((e=Math.exp(e))+1/e)/2}function Od(e){return((e=Math.exp(e))-1/e)/2}function Pd(e){return((e=Math.exp(2*e))-1)/(e+1)}const Qt=function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],u=s[0],d=s[1],f=s[2],h=u-a,g=d-l,x=h*h+g*g,y,p;if(x<Id)p=Math.log(f/c)/t,y=function(b){return[a+b*h,l+b*g,c*Math.exp(t*b*p)]};else{var E=Math.sqrt(x),m=(f*f-c*c+o*x)/(2*c*n*E),v=(f*f-c*c-o*x)/(2*f*n*E),S=Math.log(Math.sqrt(m*m+1)-m),N=Math.log(Math.sqrt(v*v+1)-v);p=(N-S)/t,y=function(b){var _=b*p,C=fr(S),L=c/(n*E)*(C*Pd(t*_+S)-Od(S));return[a+L*h,l+L*g,c*C/fr(t*_+S)]}}return y.duration=p*1e3*t/Math.SQRT2,y}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r}(Math.SQRT2,2,4);var nt=0,pt=0,ht=0,Qi=1e3,un,mt,dn=0,Xe=0,En=0,_t=typeof performance=="object"&&performance.now?performance:Date,Ji=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function So(){return Xe||(Ji(Ad),Xe=_t.now()+En)}function Ad(){Xe=0}function fn(){this._call=this._time=this._next=null}fn.prototype=es.prototype={constructor:fn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?So():+n)+(t==null?0:+t),!this._next&&mt!==this&&(mt?mt._next=this:un=this,mt=this),this._call=e,this._time=n,co()},stop:function(){this._call&&(this._call=null,this._time=1/0,co())}};function es(e,t,n){var o=new fn;return o.restart(e,t,n),o}function $d(){So(),++nt;for(var e=un,t;e;)(t=Xe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--nt}function hr(){Xe=(dn=_t.now())+En,nt=pt=0;try{$d()}finally{nt=0,Dd(),Xe=0}}function Td(){var e=_t.now(),t=e-dn;t>Qi&&(En-=t,dn=e)}function Dd(){for(var e,t=un,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:un=n);mt=e,co(o)}function co(e){if(!nt){pt&&(pt=clearTimeout(pt));var t=e-Xe;t>24?(e<1/0&&(pt=setTimeout(hr,e-_t.now()-En)),ht&&(ht=clearInterval(ht))):(ht||(dn=_t.now(),ht=setInterval(Td,Qi)),nt=1,Ji(hr))}}function gr(e,t,n){var o=new fn;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Ld=vn("start","end","cancel","interrupt"),Rd=[],ts=0,pr=1,lo=2,Jt=3,mr=4,uo=5,en=6;function _n(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;zd(e,n,{name:t,index:o,group:r,on:Ld,tween:Rd,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:ts})}function ko(e,t){var n=we(e,t);if(n.state>ts)throw new Error("too late; already scheduled");return n}function Ne(e,t){var n=we(e,t);if(n.state>Jt)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function zd(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=es(i,0,n.time);function i(c){n.state=pr,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,d,f,h;if(n.state!==pr)return l();for(u in o)if(h=o[u],h.name===n.name){if(h.state===Jt)return gr(s);h.state===mr?(h.state=en,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=en,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(gr(function(){n.state===Jt&&(n.state=mr,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=lo,n.on.call("start",e,e.__data__,n.index,n.group),n.state===lo){for(n.state=Jt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=h);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=uo,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===uo&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=en,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function tn(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>lo&&o.state<uo,o.state=en,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function jd(e){return this.each(function(){tn(this,e)})}function Hd(e,t){var n,o;return function(){var r=Ne(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Vd(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=Ne(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function Bd(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=we(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Hd:Vd)(n,e,t))}function Co(e,t,n){var o=e._id;return e.each(function(){var r=Ne(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return we(r,o).value[t]}}function ns(e,t){var n;return(typeof t=="number"?be:t instanceof Ye?ln:(n=Ye(t))?(t=n,ln):qi)(e,t)}function Fd(e){return function(){this.removeAttribute(e)}}function Yd(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Xd(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Zd(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Wd(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Gd(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function qd(e,t){var n=bn(e),o=n==="transform"?Md:ns;return this.attrTween(e,typeof t=="function"?(n.local?Gd:Wd)(n,o,Co(this,"attr."+e,t)):t==null?(n.local?Yd:Fd)(n):(n.local?Zd:Xd)(n,o,t))}function Kd(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ud(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Qd(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Ud(e,i)),n}return r._value=t,r}function Jd(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Kd(e,i)),n}return r._value=t,r}function ef(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=bn(e);return this.tween(n,(o.local?Qd:Jd)(o,t))}function tf(e,t){return function(){ko(this,e).delay=+t.apply(this,arguments)}}function nf(e,t){return t=+t,function(){ko(this,e).delay=t}}function of(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?tf:nf)(t,e)):we(this.node(),t).delay}function rf(e,t){return function(){Ne(this,e).duration=+t.apply(this,arguments)}}function sf(e,t){return t=+t,function(){Ne(this,e).duration=t}}function af(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?rf:sf)(t,e)):we(this.node(),t).duration}function cf(e,t){if(typeof t!="function")throw new Error;return function(){Ne(this,e).ease=t}}function lf(e){var t=this._id;return arguments.length?this.each(cf(t,e)):we(this.node(),t).ease}function uf(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ne(this,e).ease=n}}function df(e){if(typeof e!="function")throw new Error;return this.each(uf(this._id,e))}function ff(e){typeof e!="function"&&(e=$i(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new Ae(o,this._parents,this._name,this._id)}function hf(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],c=n[a],u=l.length,d=s[a]=new Array(u),f,h=0;h<u;++h)(f=l[h]||c[h])&&(d[h]=f);for(;a<o;++a)s[a]=t[a];return new Ae(s,this._parents,this._name,this._id)}function gf(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function pf(e,t,n){var o,r,i=gf(t)?ko:Ne;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function mf(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(pf(n,e,t))}function yf(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function wf(){return this.on("end.remove",yf(this._id))}function xf(e){var t=this._name,n=this._id;typeof e!="function"&&(e=bo(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,_n(c[f],t,n,f,c,we(u,n)));return new Ae(i,this._parents,t,n)}function vf(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ai(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),h,g=we(u,n),x=0,y=f.length;x<y;++x)(h=f[x])&&_n(h,t,n,x,f,g);i.push(f),s.push(u)}return new Ae(i,s,t,n)}var bf=At.prototype.constructor;function Ef(){return new bf(this._groups,this._parents)}function _f(e,t){var n,o,r;return function(){var i=tt(this,e),s=(this.style.removeProperty(e),tt(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function os(e){return function(){this.style.removeProperty(e)}}function Nf(e,t,n){var o,r=n+"",i;return function(){var s=tt(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Sf(e,t,n){var o,r,i;return function(){var s=tt(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),tt(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function kf(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=Ne(this,e),c=l.on,u=l.value[i]==null?a||(a=os(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(s,r=u),l.on=o}}function Cf(e,t,n){var o=(e+="")=="transform"?Cd:ns;return t==null?this.styleTween(e,_f(e,o)).on("end.style."+e,os(e)):typeof t=="function"?this.styleTween(e,Sf(e,o,Co(this,"style."+e,t))).each(kf(this._id,e)):this.styleTween(e,Nf(e,o,t),n).on("end.style."+e,null)}function Mf(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function If(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&Mf(e,s,n)),o}return i._value=t,i}function Of(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,If(e,t,n??""))}function Pf(e){return function(){this.textContent=e}}function Af(e){return function(){var t=e(this);this.textContent=t??""}}function $f(e){return this.tween("text",typeof e=="function"?Af(Co(this,"text",e)):Pf(e==null?"":e+""))}function Tf(e){return function(t){this.textContent=e.call(this,t)}}function Df(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Tf(r)),t}return o._value=e,o}function Lf(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Df(e))}function Rf(){for(var e=this._name,t=this._id,n=rs(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=we(l,t);_n(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ae(o,this._parents,e,n)}function zf(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=Ne(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var jf=0;function Ae(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function rs(){return++jf}var Oe=At.prototype;Ae.prototype={constructor:Ae,select:xf,selectAll:vf,selectChild:Oe.selectChild,selectChildren:Oe.selectChildren,filter:ff,merge:hf,selection:Ef,transition:Rf,call:Oe.call,nodes:Oe.nodes,node:Oe.node,size:Oe.size,empty:Oe.empty,each:Oe.each,on:mf,attr:qd,attrTween:ef,style:Cf,styleTween:Of,text:$f,textTween:Lf,remove:wf,tween:Bd,delay:of,duration:af,ease:lf,easeVarying:df,end:zf,[Symbol.iterator]:Oe[Symbol.iterator]};function Hf(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Vf={time:null,delay:0,duration:250,ease:Hf};function Bf(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Ff(e){var t,n;e instanceof Ae?(t=e._id,e=e._name):(t=rs(),(n=Vf).time=So(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&_n(l,e,t,c,s,n||Bf(l,t));return new Ae(o,this._parents,e,t)}At.prototype.interrupt=jd;At.prototype.transition=Ff;const Yt=e=>()=>e;function Yf(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Pe(e,t,n){this.k=e,this.x=t,this.y=n}Pe.prototype={constructor:Pe,scale:function(e){return e===1?this:new Pe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Pe(this.k,this.x+this.k*e,this.y+this.k*t)},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 Nn=new Pe(1,0,0);is.prototype=Pe.prototype;function is(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Nn;return e.__zoom}function Hn(e){e.stopImmediatePropagation()}function gt(e){e.preventDefault(),e.stopImmediatePropagation()}function Xf(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Zf(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.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 yr(){return this.__zoom||Nn}function Wf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Gf(){return navigator.maxTouchPoints||"ontouchstart"in this}function qf(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function ss(){var e=Xf,t=Zf,n=qf,o=Wf,r=Gf,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Qt,c=vn("start","zoom","end"),u,d,f,h=500,g=150,x=0,y=10;function p(w){w.property("__zoom",yr).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",L).filter(r).on("touchstart.zoom",O).on("touchmove.zoom",A).on("touchend.zoom touchcancel.zoom",I).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(w,k,M,$){var R=w.selection?w.selection():w;R.property("__zoom",yr),w!==R?S(w,k,M,$):R.interrupt().each(function(){N(this,arguments).event($).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},p.scaleBy=function(w,k,M,$){p.scaleTo(w,function(){var R=this.__zoom.k,D=typeof k=="function"?k.apply(this,arguments):k;return R*D},M,$)},p.scaleTo=function(w,k,M,$){p.transform(w,function(){var R=t.apply(this,arguments),D=this.__zoom,V=M==null?v(R):typeof M=="function"?M.apply(this,arguments):M,H=D.invert(V),z=typeof k=="function"?k.apply(this,arguments):k;return n(m(E(D,z),V,H),R,s)},M,$)},p.translateBy=function(w,k,M,$){p.transform(w,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof M=="function"?M.apply(this,arguments):M),t.apply(this,arguments),s)},null,$)},p.translateTo=function(w,k,M,$,R){p.transform(w,function(){var D=t.apply(this,arguments),V=this.__zoom,H=$==null?v(D):typeof $=="function"?$.apply(this,arguments):$;return n(Nn.translate(H[0],H[1]).scale(V.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof M=="function"?-M.apply(this,arguments):-M),D,s)},$,R)};function E(w,k){return k=Math.max(i[0],Math.min(i[1],k)),k===w.k?w:new Pe(k,w.x,w.y)}function m(w,k,M){var $=k[0]-M[0]*w.k,R=k[1]-M[1]*w.k;return $===w.x&&R===w.y?w:new Pe(w.k,$,R)}function v(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function S(w,k,M,$){w.on("start.zoom",function(){N(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event($).end()}).tween("zoom",function(){var R=this,D=arguments,V=N(R,D).event($),H=t.apply(R,D),z=M==null?v(H):typeof M=="function"?M.apply(R,D):M,Y=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),B=R.__zoom,X=typeof k=="function"?k.apply(R,D):k,Q=l(B.invert(z).concat(Y/B.k),X.invert(z).concat(Y/X.k));return function(G){if(G===1)G=X;else{var j=Q(G),F=Y/j[2];G=new Pe(F,z[0]-j[0]*F,z[1]-j[1]*F)}V.zoom(null,G)}})}function N(w,k,M){return!M&&w.__zooming||new b(w,k)}function b(w,k){this.that=w,this.args=k,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,k),this.taps=0}b.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,k){return this.mouse&&w!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var k=ce(this.that).datum();c.call(w,this.that,new Yf(w,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:c}),k)}};function _(w,...k){if(!e.apply(this,arguments))return;var M=N(this,k).event(w),$=this.__zoom,R=Math.max(i[0],Math.min(i[1],$.k*Math.pow(2,o.apply(this,arguments)))),D=he(w);if(M.wheel)(M.mouse[0][0]!==D[0]||M.mouse[0][1]!==D[1])&&(M.mouse[1]=$.invert(M.mouse[0]=D)),clearTimeout(M.wheel);else{if($.k===R)return;M.mouse=[D,$.invert(D)],tn(this),M.start()}gt(w),M.wheel=setTimeout(V,g),M.zoom("mouse",n(m(E($,R),M.mouse[0],M.mouse[1]),M.extent,s));function V(){M.wheel=null,M.end()}}function C(w,...k){if(f||!e.apply(this,arguments))return;var M=w.currentTarget,$=N(this,k,!0).event(w),R=ce(w.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",Y,!0),D=he(w,M),V=w.clientX,H=w.clientY;Fi(w.view),Hn(w),$.mouse=[D,this.__zoom.invert(D)],tn(this),$.start();function z(B){if(gt(B),!$.moved){var X=B.clientX-V,Q=B.clientY-H;$.moved=X*X+Q*Q>x}$.event(B).zoom("mouse",n(m($.that.__zoom,$.mouse[0]=he(B,M),$.mouse[1]),$.extent,s))}function Y(B){R.on("mousemove.zoom mouseup.zoom",null),Yi(B.view,$.moved),gt(B),$.event(B).end()}}function L(w,...k){if(e.apply(this,arguments)){var M=this.__zoom,$=he(w.changedTouches?w.changedTouches[0]:w,this),R=M.invert($),D=M.k*(w.shiftKey?.5:2),V=n(m(E(M,D),$,R),t.apply(this,k),s);gt(w),a>0?ce(this).transition().duration(a).call(S,V,$,w):ce(this).call(p.transform,V,$,w)}}function O(w,...k){if(e.apply(this,arguments)){var M=w.touches,$=M.length,R=N(this,k,w.changedTouches.length===$).event(w),D,V,H,z;for(Hn(w),V=0;V<$;++V)H=M[V],z=he(H,this),z=[z,this.__zoom.invert(z),H.identifier],R.touch0?!R.touch1&&R.touch0[2]!==z[2]&&(R.touch1=z,R.taps=0):(R.touch0=z,D=!0,R.taps=1+!!u);u&&(u=clearTimeout(u)),D&&(R.taps<2&&(d=z[0],u=setTimeout(function(){u=null},h)),tn(this),R.start())}}function A(w,...k){if(this.__zooming){var M=N(this,k).event(w),$=w.changedTouches,R=$.length,D,V,H,z;for(gt(w),D=0;D<R;++D)V=$[D],H=he(V,this),M.touch0&&M.touch0[2]===V.identifier?M.touch0[0]=H:M.touch1&&M.touch1[2]===V.identifier&&(M.touch1[0]=H);if(V=M.that.__zoom,M.touch1){var Y=M.touch0[0],B=M.touch0[1],X=M.touch1[0],Q=M.touch1[1],G=(G=X[0]-Y[0])*G+(G=X[1]-Y[1])*G,j=(j=Q[0]-B[0])*j+(j=Q[1]-B[1])*j;V=E(V,Math.sqrt(G/j)),H=[(Y[0]+X[0])/2,(Y[1]+X[1])/2],z=[(B[0]+Q[0])/2,(B[1]+Q[1])/2]}else if(M.touch0)H=M.touch0[0],z=M.touch0[1];else return;M.zoom("touch",n(m(V,H,z),M.extent,s))}}function I(w,...k){if(this.__zooming){var M=N(this,k).event(w),$=w.changedTouches,R=$.length,D,V;for(Hn(w),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),D=0;D<R;++D)V=$[D],M.touch0&&M.touch0[2]===V.identifier?delete M.touch0:M.touch1&&M.touch1[2]===V.identifier&&delete M.touch1;if(M.touch1&&!M.touch0&&(M.touch0=M.touch1,delete M.touch1),M.touch0)M.touch0[1]=this.__zoom.invert(M.touch0[0]);else if(M.end(),M.taps===2&&(V=he(V,this),Math.hypot(d[0]-V[0],d[1]-V[1])<y)){var H=ce(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return p.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:Yt(+w),p):o},p.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Yt(!!w),p):e},p.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:Yt(!!w),p):r},p.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Yt([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),p):t},p.scaleExtent=function(w){return arguments.length?(i[0]=+w[0],i[1]=+w[1],p):[i[0],i[1]]},p.translateExtent=function(w){return arguments.length?(s[0][0]=+w[0][0],s[1][0]=+w[1][0],s[0][1]=+w[0][1],s[1][1]=+w[1][1],p):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},p.constrain=function(w){return arguments.length?(n=w,p):n},p.duration=function(w){return arguments.length?(a=+w,p):a},p.interpolate=function(w){return arguments.length?(l=w,p):l},p.on=function(){var w=c.on.apply(c,arguments);return w===c?p:w},p.clickDistance=function(w){return arguments.length?(x=(w=+w)*w,p):Math.sqrt(x)},p.tapDistance=function(w){return arguments.length?(y=+w,p):y},p}const ye={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Nt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],as=["Enter"," ","Escape"],cs={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var ot;(function(e){e.Strict="strict",e.Loose="loose"})(ot||(ot={}));var Fe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Fe||(Fe={}));var St;(function(e){e.Partial="partial",e.Full="full"})(St||(St={}));const ls={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var De;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(De||(De={}));var kt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(kt||(kt={}));var Z;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Z||(Z={}));const wr={[Z.Left]:Z.Right,[Z.Right]:Z.Left,[Z.Top]:Z.Bottom,[Z.Bottom]:Z.Top};function us(e){return e===null?null:e?"valid":"invalid"}const ds=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,Kf=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Mo=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Tt=(e,t=[0,0])=>{const{width:n,height:o}=Se(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Uf=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):Mo(r)?r:t.nodeLookup.get(r.id));const a=s?hn(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Sn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return kn(n)},Dt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=Sn(n,hn(r)),o=!0)}),o?kn(n):{x:0,y:0,width:0,height:0}},Io=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/r,l=(t.y-o)/r,c=t.width/r,u=t.height/r,d=[];for(const f of e.values()){const{measured:h,selectable:g=!0,hidden:x=!1}=f;if(s&&!g||x)continue;const y=h.width??f.width??f.initialWidth??0,p=h.height??f.height??f.initialHeight??0,{x:E,y:m}=f.internals.positionAbsolute,v=ps(a,l,c,u,E,m,y,p),S=y*p,N=i&&v>0;(!f.internals.handleBounds||N||v>=S||f.dragging)&&d.push(f)}return d},Qf=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Jf(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{let i;if(t?.includeHiddenNodes){const{width:s,height:a}=Se(r);i=s>0&&a>0}else i=!!(r.measured.width&&r.measured.height&&!r.hidden);i&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function eh({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;const a=Jf(e,s),l=Dt(a),c=Po(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function fs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",ye.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(d=[[l,c],[l+h,c+g]])}else a&&We(s.extent)&&(d=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const f=We(d)?Ze(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",ye.error015()),{position:{x:f.x-l+(s.measured.width??0)*u[0],y:f.y-c+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function th({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(x=>x.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=Qf(s,l);for(const f of l)a.has(f.id)&&!u.find(g=>g.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const rt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ze=(e={x:0,y:0},t,n)=>({x:rt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:rt(e.y,t[0][1],t[1][1]-(n?.height??0))});function hs(e,t,n){const{width:o,height:r}=Se(n),{x:i,y:s}=n.internals.positionAbsolute;return Ze(e,[[i,s],[i+o,s+r]],t)}const xr=(e,t,n)=>e<t?rt(Math.abs(e-t),1,t)/t:e>n?-rt(Math.abs(e-n),1,t)/t:0,Oo=(e,t,n=15,o=40)=>{const r=xr(e.x,o,t.width-o)*n,i=xr(e.y,o,t.height-o)*n;return[r,i]},Sn=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),fo=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),kn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Ct=(e,t=[0,0])=>{const{x:n,y:o}=Mo(e)?e.internals.positionAbsolute:Tt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},hn=(e,t=[0,0])=>{const{x:n,y:o}=Mo(e)?e.internals.positionAbsolute:Tt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},gs=(e,t)=>kn(Sn(fo(e),fo(t))),ps=(e,t,n,o,r,i,s,a)=>{const l=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),c=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(l*c)},gn=(e,t)=>ps(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),vr=e=>pe(e.width)&&pe(e.height)&&pe(e.x)&&pe(e.y),pe=e=>!isNaN(e)&&isFinite(e),ms=(e,t)=>(n,o)=>{},Lt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Rt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Lt(a,s):a},it=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Ke(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function nh(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Ke(e,n),r=Ke(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Ke(e.top??e.y??0,n),r=Ke(e.bottom??e.y??0,n),i=Ke(e.left??e.x??0,t),s=Ke(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function oh(e,t,n,o,r,i){const{x:s,y:a}=it(e,[t,n,o]),{x:l,y:c}=it({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const Po=(e,t,n,o,r,i)=>{const s=nh(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=rt(c,o,r),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*u,g=n/2-f*u,x=oh(e,h,g,u,t,n),y={left:Math.min(x.left-s.left,0),top:Math.min(x.top-s.top,0),right:Math.min(x.right-s.right,0),bottom:Math.min(x.bottom-s.bottom,0)};return{x:h-y.left+y.right,y:g-y.top+y.bottom,zoom:u}},Mt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function We(e){return e!=null&&e!=="parent"}function Se(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ys(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function ws(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function br(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function rh(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function ih(e){return{...cs,...e||{}}}function xt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=me(e),a=Rt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?Lt(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const Ao=e=>({width:e.offsetWidth,height:e.offsetHeight}),xs=e=>e?.getRootNode?.()||window?.document,sh=["INPUT","SELECT","TEXTAREA"];function vs(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:sh.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const bs=e=>"clientX"in e,me=(e,t)=>{const n=bs(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Er=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Ao(s)}})};function Es({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function Xt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function _r({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case Z.Left:return[t-Xt(t-o,i),n];case Z.Right:return[t+Xt(o-t,i),n];case Z.Top:return[t,n-Xt(n-r,i)];case Z.Bottom:return[t,n+Xt(r-n,i)]}}function $o({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:o,targetY:r,targetPosition:i=Z.Top,curvature:s=.25}){const[a,l]=_r({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,u]=_r({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,h,g]=Es({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,d,f,h,g]}function _s({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function ah({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function ch({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Sn(hn(e),hn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return gn(s,kn(i))>0}const lh=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,uh=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),dh=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",ye.error006()),t;const o=n.getEdgeId||lh;let r;return ds(e)?r={...e}:r={...e,id:o(e)},uh(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Ns({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=_s({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Nr={[Z.Left]:{x:-1,y:0},[Z.Right]:{x:1,y:0},[Z.Top]:{x:0,y:-1},[Z.Bottom]:{x:0,y:1}},fh=({source:e,sourcePosition:t=Z.Bottom,target:n})=>t===Z.Left||t===Z.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Sr=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function hh({source:e,sourcePosition:t=Z.Bottom,target:n,targetPosition:o=Z.Top,center:r,offset:i,stepPosition:s}){const a=Nr[t],l=Nr[o],c={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},d=fh({source:c,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",h=d[f];let g=[],x,y;const p={x:0,y:0},E={x:0,y:0},[,,m,v]=_s({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(x=r.x??c.x+(u.x-c.x)*s,y=r.y??(c.y+u.y)/2):(x=r.x??(c.x+u.x)/2,y=r.y??c.y+(u.y-c.y)*s);const _=[{x,y:c.y},{x,y:u.y}],C=[{x:c.x,y},{x:u.x,y}];a[f]===h?g=f==="x"?_:C:g=f==="x"?C:_}else{const _=[{x:c.x,y:u.y}],C=[{x:u.x,y:c.y}];if(f==="x"?g=a.x===h?C:_:g=a.y===h?_:C,t===o){const w=Math.abs(e[f]-n[f]);if(w<=i){const k=Math.min(i-1,i-w);a[f]===h?p[f]=(c[f]>e[f]?-1:1)*k:E[f]=(u[f]>n[f]?-1:1)*k}}if(t!==o){const w=f==="x"?"y":"x",k=a[f]===l[w],M=c[w]>u[w],$=c[w]<u[w];(a[f]===1&&(!k&&M||k&&$)||a[f]!==1&&(!k&&$||k&&M))&&(g=f==="x"?_:C)}const L={x:c.x+p.x,y:c.y+p.y},O={x:u.x+E.x,y:u.y+E.y},A=Math.max(Math.abs(L.x-g[0].x),Math.abs(O.x-g[0].x)),I=Math.max(Math.abs(L.y-g[0].y),Math.abs(O.y-g[0].y));A>=I?(x=(L.x+O.x)/2,y=g[0].y):(x=g[0].x,y=(L.y+O.y)/2)}const S={x:c.x+p.x,y:c.y+p.y},N={x:u.x+E.x,y:u.y+E.y};return[[e,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,...N.x!==g[g.length-1].x||N.y!==g[g.length-1].y?[N]:[],n],x,y,m,v]}function gh(e,t,n,o){const r=Math.min(Sr(e,t)/2,Sr(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function ho({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:o,targetY:r,targetPosition:i=Z.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,h,g,x]=hh({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:u});let y=`M${d[0].x} ${d[0].y}`;for(let p=1;p<d.length-1;p++)y+=gh(d[p-1],d[p],d[p+1],s);return y+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[y,f,h,g,x]}function kr(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function ph(e){const{sourceNode:t,targetNode:n}=e;if(!kr(t)||!kr(n))return null;const o=t.internals.handleBounds||Cr(t.handles),r=n.internals.handleBounds||Cr(n.handles),i=Mr(o?.source??[],e.sourceHandle),s=Mr(e.connectionMode===ot.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",ye.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||Z.Bottom,l=s?.position||Z.Top,c=Ge(t,i,a),u=Ge(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Cr(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Ge(e,t,n=Z.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Se(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case Z.Top:return{x:r+s/2,y:i};case Z.Right:return{x:r+s,y:i+a/2};case Z.Bottom:return{x:r+s/2,y:i+a};case Z.Left:return{x:r,y:i+a/2}}}function Mr(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function go(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function mh(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=go(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Ss=1e3,yh=10,To={nodeOrigin:[0,0],nodeExtent:Nt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},wh={...To,checkEquality:!0};function Do(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function xh(e,t,n){const o=Do(To,n);for(const r of e.values())if(r.parentId)Ro(r,e,t,o);else{const i=Tt(r,o.nodeOrigin),s=We(r.extent)?r.extent:o.nodeExtent,a=Ze(i,s,Se(r));r.internals.positionAbsolute=a}}function vh(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Lo(e){return e==="manual"}function po(e,t,n,o={}){const r=Do(wh,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!Lo(r.zIndexMode)?Ss:0;let l=e.length>0,c=!1;t.clear(),n.clear();for(const u of e){let d=s.get(u.id);if(r.checkEquality&&u===d?.internals.userNode)t.set(u.id,d);else{const f=Tt(u,r.nodeOrigin),h=We(u.extent)?u.extent:r.nodeExtent,g=Ze(f,h,Se(u));d={...r.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:g,handleBounds:vh(u,d),z:ks(u,a,r.zIndexMode),userNode:u}},t.set(u.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(l=!1),u.parentId&&Ro(d,t,n,o,i),c||=u.selected??!1}return{nodesInitialized:l,hasSelectedNodes:c}}function bh(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Ro(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Do(To,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bh(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*yh),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=i&&!Lo(l)?Ss:0,{x:f,y:h,z:g}=Eh(e,u,s,a,d,l),{positionAbsolute:x}=e.internals,y=f!==x.x||h!==x.y;(y||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:f,y:h}:x,z:g}})}function ks(e,t,n){const o=pe(e.zIndex)?e.zIndex:0;return Lo(n)?o:o+(e.selected?t:0)}function Eh(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Se(e),c=Tt(e,n),u=We(e.extent)?Ze(c,e.extent,l):c;let d=Ze({x:s+u.x,y:a+u.y},o,l);e.extent==="parent"&&(d=hs(d,l,t));const f=ks(e,r,i),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function zo(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const l=i.get(s.parentId)?.expandedRect??Ct(a),c=gs(l,s.rect);i.set(s.parentId,{expandedRect:c,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Se(a),d=a.origin??o,f=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,h=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,g=Math.max(u.width,Math.round(s.width)),x=Math.max(u.height,Math.round(s.height)),y=(g-u.width)*d[0],p=(x-u.height)*d[1];(f>0||h>0||y||p)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+y,y:a.position.y-h+p}}),n.get(l)?.forEach(E=>{e.some(m=>m.id===E.id)||r.push({id:E.id,type:"position",position:{x:E.position.x+f,y:E.position.y+h}})})),(u.width<s.width||u.height<s.height||f||h)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(f?d[0]*f-y:0),height:x+(h?d[1]*h-p:0)}})}),r}function _h(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}const x=Ao(h.nodeElement),y=g.measured.width!==x.width||g.measured.height!==x.height;if(!!(x.width&&x.height&&(y||!g.internals.handleBounds||h.force))){const E=h.nodeElement.getBoundingClientRect(),m=We(g.extent)?g.extent:i;let{positionAbsolute:v}=g.internals;if(g.parentId&&g.extent==="parent"){const N=t.get(g.parentId);N&&(v=hs(v,x,N))}else m&&(v=Ze(v,m,x));const S={...g,measured:x,internals:{...g.internals,positionAbsolute:v,handleBounds:{source:Er("source",h.nodeElement,E,d,g.id),target:Er("target",h.nodeElement,E,d,g.id)}}};t.set(g.id,S),g.parentId&&Ro(S,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,y&&(c.push({id:g.id,type:"dimensions",dimensions:x}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Ct(S,r)}))}}if(f.length>0){const h=zo(f,t,n,r);c.push(...h)}return{changes:c,updatedInternals:l}}async function Nh({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Ir(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function Cs(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;Ir("source",l,u,e,r,s),Ir("target",l,c,e,i,a),t.set(o.id,o)}}function Ms(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Ms(n,t):!1}function Or(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Sh(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Ms(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function Vn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function kh({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=Lt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Ch({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,h=!1,g=!1,x=null;function y({noDragClassName:E,handleSelector:m,domNode:v,isSelectable:S,nodeId:N,nodeClickDistance:b=0}){f=ce(v);function _({x:A,y:I}){const{nodeLookup:w,nodeExtent:k,snapGrid:M,snapToGrid:$,nodeOrigin:R,onNodeDrag:D,onSelectionDrag:V,onError:H,updateNodePositions:z}=t();i={x:A,y:I};let Y=!1;const B=a.size>1,X=B&&k?fo(Dt(a)):null,Q=B&&$?kh({dragItems:a,snapGrid:M,x:A,y:I}):null;for(const[G,j]of a){if(!w.has(G))continue;let F={x:A-j.distance.x,y:I-j.distance.y};$&&(F=Q?{x:Math.round(F.x+Q.x),y:Math.round(F.y+Q.y)}:Lt(F,M));let U=null;if(B&&k&&!j.extent&&X){const{positionAbsolute:q}=j.internals,J=q.x-X.x+k[0][0],te=q.x+j.measured.width-X.x2+k[1][0],oe=q.y-X.y+k[0][1],se=q.y+j.measured.height-X.y2+k[1][1];U=[[J,oe],[te,se]]}const{position:K,positionAbsolute:W}=fs({nodeId:G,nextPosition:F,nodeLookup:w,nodeExtent:U||k,nodeOrigin:R,onError:H});Y=Y||j.position.x!==K.x||j.position.y!==K.y,j.position=K,j.internals.positionAbsolute=W}if(g=g||Y,!!Y&&(z(a,!0),x&&(o||D||!N&&V))){const[G,j]=Vn({nodeId:N,dragItems:a,nodeLookup:w});o?.(x,a,G,j),D?.(x,G,j),N||V?.(x,j)}}async function C(){if(!u)return;const{transform:A,panBy:I,autoPanSpeed:w,autoPanOnNodeDrag:k}=t();if(!k){l=!1,cancelAnimationFrame(s);return}const[M,$]=Oo(c,u,w);(M!==0||$!==0)&&(i.x=(i.x??0)-M/A[2],i.y=(i.y??0)-$/A[2],await I({x:M,y:$})&&_(i)),s=requestAnimationFrame(C)}function L(A){const{nodeLookup:I,multiSelectionActive:w,nodesDraggable:k,transform:M,snapGrid:$,snapToGrid:R,selectNodesOnDrag:D,onNodeDragStart:V,onSelectionDragStart:H,unselectNodesAndEdges:z}=t();d=!0,(!D||!S)&&!w&&N&&(I.get(N)?.selected||z()),S&&D&&N&&e?.(N);const Y=xt(A.sourceEvent,{transform:M,snapGrid:$,snapToGrid:R,containerBounds:u});if(i=Y,a=Sh(I,k,Y,N),a.size>0&&(n||V||!N&&H)){const[B,X]=Vn({nodeId:N,dragItems:a,nodeLookup:I});n?.(A.sourceEvent,a,B,X),V?.(A.sourceEvent,B,X),N||H?.(A.sourceEvent,X)}}const O=Xi().clickDistance(b).on("start",A=>{const{domNode:I,nodeDragThreshold:w,transform:k,snapGrid:M,snapToGrid:$}=t();u=I?.getBoundingClientRect()||null,h=!1,g=!1,x=A.sourceEvent,w===0&&L(A),i=xt(A.sourceEvent,{transform:k,snapGrid:M,snapToGrid:$,containerBounds:u}),c=me(A.sourceEvent,u)}).on("drag",A=>{const{autoPanOnNodeDrag:I,transform:w,snapGrid:k,snapToGrid:M,nodeDragThreshold:$,nodeLookup:R}=t(),D=xt(A.sourceEvent,{transform:w,snapGrid:k,snapToGrid:M,containerBounds:u});if(x=A.sourceEvent,(A.sourceEvent.type==="touchmove"&&A.sourceEvent.touches.length>1||N&&!R.has(N))&&(h=!0),!h){if(!l&&I&&d&&(l=!0,C()),!d){const V=me(A.sourceEvent,u),H=V.x-c.x,z=V.y-c.y;Math.sqrt(H*H+z*z)>$&&L(A)}(i.x!==D.xSnapped||i.y!==D.ySnapped)&&a&&d&&(c=me(A.sourceEvent,u),_(D))}}).on("end",A=>{if(!d||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(l=!1,d=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:I,updateNodePositions:w,onNodeDragStop:k,onSelectionDragStop:M}=t();if(g&&(w(a,!1),g=!1),r||k||!N&&M){const[$,R]=Vn({nodeId:N,dragItems:a,nodeLookup:I,dragging:!1});r?.(A.sourceEvent,a,$,R),k?.(A.sourceEvent,$,R),N||M?.(A.sourceEvent,R)}}}).filter(A=>{const I=A.target;return!A.button&&(!E||!Or(I,`.${E}`,v))&&(!m||Or(I,m,v))});f.call(O)}function p(){f?.on(".drag",null)}return{update:y,destroy:p}}function Mh(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())gn(r,Ct(i))>0&&o.push(i);return o}const Ih=250;function Oh(e,t,n,o){let r=[],i=1/0;const s=Mh(e,n,t+Ih);for(const a of s){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:d}=Ge(a,c,c.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<i?(r=[{...c,x:u,y:d}],i=f):f===i&&r.push({...c,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function Is(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&i?{...l,...Ge(s,l,l.position,!0)}:l}function Os(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Ph(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Ps=()=>!0;function Ah(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:x,onConnectEnd:y,isValidConnection:p=Ps,onReconnectEnd:E,updateConnection:m,getTransform:v,getFromHandle:S,autoPanSpeed:N,dragThreshold:b=1,handleDomNode:_}){const C=xs(e.target);let L=0,O;const{x:A,y:I}=me(e),w=Os(i,_),k=a?.getBoundingClientRect();let M=!1;if(!k||!w)return;const $=Is(r,w,o,l,t);if(!$)return;let R=me(e,k),D=!1,V=null,H=!1,z=null;function Y(){if(!u||!k)return;const[K,W]=Oo(R,k,N);f({x:K,y:W}),L=requestAnimationFrame(Y)}const B={...$,nodeId:r,type:w,position:$.position},X=l.get(r);let G={inProgress:!0,isValid:null,from:Ge(X,B,Z.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:X,to:R,toHandle:null,toPosition:wr[B.position],toNode:null,pointer:R};function j(){M=!0,m(G),g?.(e,{nodeId:r,handleId:o,handleType:w})}b===0&&j();function F(K){if(!M){const{x:se,y:ke}=me(K),xe=se-A,ve=ke-I;if(!(xe*xe+ve*ve>b*b))return;j()}if(!S()||!B){U(K);return}const W=v();R=me(K,k),O=Oh(Rt(R,W,!1,[1,1]),n,l,B),D||(Y(),D=!0);const q=As(K,{handle:O,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:p,doc:C,lib:c,flowId:d,nodeLookup:l});z=q.handleDomNode,V=q.connection,H=Ph(!!O,q.isValid);const J=l.get(r),te=J?Ge(J,B,Z.Left,!0):G.from,oe={...G,from:te,isValid:H,to:q.toHandle&&H?it({x:q.toHandle.x,y:q.toHandle.y},W):R,toHandle:q.toHandle,toPosition:H&&q.toHandle?q.toHandle.position:wr[B.position],toNode:q.toHandle?l.get(q.toHandle.nodeId):null,pointer:R};m(oe),G=oe}function U(K){if(!("touches"in K&&K.touches.length>0)){if(M){(O||z)&&V&&H&&x?.(V);const{inProgress:W,...q}=G,J={...q,toPosition:G.toHandle?G.toPosition:null};y?.(K,J),i&&E?.(K,J)}h(),cancelAnimationFrame(L),D=!1,H=!1,V=null,z=null,C.removeEventListener("mousemove",F),C.removeEventListener("mouseup",U),C.removeEventListener("touchmove",F),C.removeEventListener("touchend",U)}}C.addEventListener("mousemove",F),C.addEventListener("mouseup",U),C.addEventListener("touchmove",F),C.addEventListener("touchend",U)}function As(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Ps,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=me(e),x=s.elementFromPoint(h,g),y=x?.classList.contains(`${a}-flow__handle`)?x:f,p={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const E=Os(void 0,y),m=y.getAttribute("data-nodeid"),v=y.getAttribute("data-handleid"),S=y.classList.contains("connectable"),N=y.classList.contains("connectableend");if(!m||!E)return p;const b={source:d?m:o,sourceHandle:d?v:r,target:d?o:m,targetHandle:d?r:v};p.connection=b;const C=S&&N&&(n===ot.Strict?d&&E==="source"||!d&&E==="target":m!==o||v!==r);p.isValid=C&&c(b),p.toHandle=Is(m,E,v,u,n,!0)}return p}const mo={onPointerDown:Ah,isValid:As};function $h({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function i({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const g=m=>{if(m.sourceEvent.type!=="wheel"||!t)return;const v=n(),S=m.sourceEvent.ctrlKey&&Mt()?10:1,N=-m.sourceEvent.deltaY*(m.sourceEvent.deltaMode===1?.05:m.sourceEvent.deltaMode?1:.002)*u,b=v[2]*Math.pow(2,N*S);t.scaleTo(b)};let x=[0,0];const y=m=>{(m.sourceEvent.type==="mousedown"||m.sourceEvent.type==="touchstart")&&(x=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY])},p=m=>{const v=n();if(m.sourceEvent.type!=="mousemove"&&m.sourceEvent.type!=="touchmove"||!t)return;const S=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY],N=[S[0]-x[0],S[1]-x[1]];x=S;const b=o()*Math.max(v[2],Math.log(v[2]))*(h?-1:1),_={x:v[0]-N[0]*b,y:v[1]-N[1]*b},C=[[0,0],[l,c]];t.setViewportConstrained({x:_.x,y:_.y,zoom:v[2]},C,a)},E=ss().on("start",y).on("zoom",d?p:null).on("zoom.wheel",f?g:null);r.call(E,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:he}}const Cn=e=>({x:e.x,y:e.y,zoom:e.k}),Bn=({x:e,y:t,zoom:n})=>Nn.translate(e,t).scale(n),Ue=(e,t)=>e.target.closest(`.${t}`),$s=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Th=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Fn=(e,t=0,n=Th,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Ts=e=>{const t=e.ctrlKey&&Mt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Dh({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Ue(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const y=he(u),p=Ts(u),E=d*Math.pow(2,p);o.scaleTo(n,E,y,u);return}const f=u.deltaMode===1?20:1;let h=r===Fe.Vertical?0:u.deltaX*f,g=r===Fe.Horizontal?0:u.deltaY*f;!Mt()&&u.shiftKey&&r!==Fe.Vertical&&(h=u.deltaY*f,g=0),o.translateBy(n,-(h/d)*i,-(g/d)*i,{internal:!0});const x=Cn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(u,x):(e.isPanScrolling=!0,a?.(u,x)),e.panScrollTimeout=setTimeout(()=>{c?.(u,x),e.isPanScrolling=!1},150)}}function Lh({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Ue(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Rh({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Cn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function zh({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&$s(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Cn(i.transform))}}function jh({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&$s(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=Cn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Hh({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const f=e||t,h=n&&d.ctrlKey,g=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Ue(d,`${c}-flow__node`)||Ue(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!g||Ue(d,a)&&g||Ue(d,l)&&(!g||r&&g&&!e)||!n&&d.ctrlKey&&g)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!h&&g||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const x=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||g)&&x}}function Vh({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect();let d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<"u"?new ResizeObserver(I=>{const w=I[0];w&&(d=[[0,0],[w.contentRect.width,w.contentRect.height]])}):null)?.observe(e);const h=ss().extent(()=>d).scaleExtent([t,n]).translateExtent(o),g=ce(e).call(h);v({x:r.x,y:r.y,zoom:rt(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const x=g.on("wheel.zoom"),y=g.on("dblclick.zoom");h.wheelDelta(Ts);async function p(I,w){return g?new Promise(k=>{h?.interpolate(w?.interpolate==="linear"?wt:Qt).transform(Fn(g,w?.duration,w?.ease,()=>k(!0)),I)}):!1}function E({noWheelClassName:I,noPanClassName:w,onPaneContextMenu:k,userSelectionActive:M,panOnScroll:$,panOnDrag:R,panOnScrollMode:D,panOnScrollSpeed:V,preventScrolling:H,zoomOnPinch:z,zoomOnScroll:Y,zoomOnDoubleClick:B,zoomActivationKeyPressed:X,lib:Q,onTransformChange:G,connectionInProgress:j,paneClickDistance:F,selectionOnDrag:U}){M&&!c.isZoomingOrPanning&&m();const K=$&&!X&&!M;h.clickDistance(U?1/0:!pe(F)||F<0?0:F);const W=K?Dh({zoomPanValues:c,noWheelClassName:I,d3Selection:g,d3Zoom:h,panOnScrollMode:D,panOnScrollSpeed:V,zoomOnPinch:z,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Lh({noWheelClassName:I,preventScrolling:H,d3ZoomHandler:x});g.on("wheel.zoom",W,{passive:!1});const q=Rh({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});h.on("start",q);const J=zh({zoomPanValues:c,panOnDrag:R,onPaneContextMenu:!!k,onPanZoom:i,onTransformChange:G});h.on("zoom",J);const te=jh({zoomPanValues:c,panOnDrag:R,panOnScroll:$,onPaneContextMenu:k,onPanZoomEnd:a,onDraggingChange:l});h.on("end",te);const oe=Hh({zoomActivationKeyPressed:X,panOnDrag:R,zoomOnScroll:Y,panOnScroll:$,zoomOnDoubleClick:B,zoomOnPinch:z,userSelectionActive:M,noPanClassName:w,noWheelClassName:I,lib:Q,connectionInProgress:j});h.filter(oe),B?g.on("dblclick.zoom",y):g.on("dblclick.zoom",null)}function m(){h.on("zoom",null)}async function v(I,w,k){const M=Bn(I),$=h?.constrain()(M,w,k);return $&&await p($),$}async function S(I,w){const k=Bn(I);return await p(k,w),k}function N(I){if(g){const w=Bn(I),k=g.property("__zoom");(k.k!==I.zoom||k.x!==I.x||k.y!==I.y)&&h?.transform(g,w,null,{sync:!0})}}function b(){const I=g?is(g.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}async function _(I,w){return g?new Promise(k=>{h?.interpolate(w?.interpolate==="linear"?wt:Qt).scaleTo(Fn(g,w?.duration,w?.ease,()=>k(!0)),I)}):!1}async function C(I,w){return g?new Promise(k=>{h?.interpolate(w?.interpolate==="linear"?wt:Qt).scaleBy(Fn(g,w?.duration,w?.ease,()=>k(!0)),I)}):!1}function L(I){h?.scaleExtent(I)}function O(I){h?.translateExtent(I)}function A(I){const w=!pe(I)||I<0?0:I;h?.clickDistance(w)}return{update:E,destroy:m,setViewport:S,setViewportConstrained:v,getViewport:b,scaleTo:_,scaleBy:C,setScaleExtent:L,setTranslateExtent:O,syncViewport:N,setClickDistance:A}}var st;(function(e){e.Line="line",e.Handle="handle"})(st||(st={}));function Bh({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function Pr(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function $e(e,t){return Math.max(0,t-e)}function Te(e,t){return Math.max(0,e-t)}function Zt(e,t,n){return Math.max(0,t-e,e-n)}function Ar(e,t){return e?!t:t}function Fh(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:h,ySnapped:g}=n,{minWidth:x,maxWidth:y,minHeight:p,maxHeight:E}=o,{x:m,y:v,width:S,height:N,aspectRatio:b}=e;let _=Math.floor(u?h-e.pointerX:0),C=Math.floor(d?g-e.pointerY:0);const L=S+(l?-_:_),O=N+(c?-C:C),A=-i[0]*S,I=-i[1]*N;let w=Zt(L,x,y),k=Zt(O,p,E);if(s){let R=0,D=0;l&&_<0?R=$e(m+_+A,s[0][0]):!l&&_>0&&(R=Te(m+L+A,s[1][0])),c&&C<0?D=$e(v+C+I,s[0][1]):!c&&C>0&&(D=Te(v+O+I,s[1][1])),w=Math.max(w,R),k=Math.max(k,D)}if(a){let R=0,D=0;l&&_>0?R=Te(m+_,a[0][0]):!l&&_<0&&(R=$e(m+L,a[1][0])),c&&C>0?D=Te(v+C,a[0][1]):!c&&C<0&&(D=$e(v+O,a[1][1])),w=Math.max(w,R),k=Math.max(k,D)}if(r){if(u){const R=Zt(L/b,p,E)*b;if(w=Math.max(w,R),s){let D=0;!l&&!c||l&&!c&&f?D=Te(v+I+L/b,s[1][1])*b:D=$e(v+I+(l?_:-_)/b,s[0][1])*b,w=Math.max(w,D)}if(a){let D=0;!l&&!c||l&&!c&&f?D=$e(v+L/b,a[1][1])*b:D=Te(v+(l?_:-_)/b,a[0][1])*b,w=Math.max(w,D)}}if(d){const R=Zt(O*b,x,y)/b;if(k=Math.max(k,R),s){let D=0;!l&&!c||c&&!l&&f?D=Te(m+O*b+A,s[1][0])/b:D=$e(m+(c?C:-C)*b+A,s[0][0])/b,k=Math.max(k,D)}if(a){let D=0;!l&&!c||c&&!l&&f?D=$e(m+O*b,a[1][0])/b:D=Te(m+(c?C:-C)*b,a[0][0])/b,k=Math.max(k,D)}}}C=C+(C<0?k:-k),_=_+(_<0?w:-w),r&&(f?L>O*b?C=(Ar(l,c)?-_:_)/b:_=(Ar(l,c)?-C:C)*b:u?(C=_/b,c=l):(_=C*b,l=c));const M=l?m+_:m,$=c?v+C:v;return{width:S+(l?-_:_),height:N+(c?-C:C),x:i[0]*_*(l?-1:1)+M,y:i[1]*C*(c?-1:1)+$}}const Ds={width:0,height:0,x:0,y:0},Yh={...Ds,pointerX:0,pointerY:0,aspectRatio:1};function Xh(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function Zh({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ce(e);let s={controlDirection:Pr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:x,shouldResize:y}){let p={...Ds},E={...Yh};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:Pr(c)};let m,v=null,S=[],N,b,_,C=!1;const L=Xi().on("start",O=>{const{nodeLookup:A,transform:I,snapGrid:w,snapToGrid:k,nodeOrigin:M,paneDomNode:$}=n();if(m=A.get(t),!m)return;v=$?.getBoundingClientRect()??null;const{xSnapped:R,ySnapped:D}=xt(O.sourceEvent,{transform:I,snapGrid:w,snapToGrid:k,containerBounds:v});p={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},E={...p,pointerX:R,pointerY:D,aspectRatio:p.width/p.height},N=void 0,b=We(m.extent)?m.extent:void 0,m.parentId&&(m.extent==="parent"||m.expandParent)&&(N=A.get(m.parentId)),N&&m.extent==="parent"&&(b=[[0,0],[N.measured.width,N.measured.height]]),S=[],_=void 0;for(const[V,H]of A)if(H.parentId===t&&(S.push({id:V,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const z=Xh(H,m,H.origin??M);_?_=[[Math.min(z[0][0],_[0][0]),Math.min(z[0][1],_[0][1])],[Math.max(z[1][0],_[1][0]),Math.max(z[1][1],_[1][1])]]:_=z}h?.(O,{...p})}).on("drag",O=>{const{transform:A,snapGrid:I,snapToGrid:w,nodeOrigin:k}=n(),M=xt(O.sourceEvent,{transform:A,snapGrid:I,snapToGrid:w,containerBounds:v}),$=[];if(!m)return;const{x:R,y:D,width:V,height:H}=p,z={},Y=m.origin??k,{width:B,height:X,x:Q,y:G}=Fh(E,s.controlDirection,M,s.boundaries,s.keepAspectRatio,Y,b,_),j=B!==V,F=X!==H,U=Q!==R&&j,K=G!==D&&F;if(!U&&!K&&!j&&!F)return;if((U||K||Y[0]===1||Y[1]===1)&&(z.x=U?Q:p.x,z.y=K?G:p.y,p.x=z.x,p.y=z.y,S.length>0)){const te=Q-R,oe=G-D;for(const se of S)se.position={x:se.position.x-te+Y[0]*(B-V),y:se.position.y-oe+Y[1]*(X-H)},$.push(se)}if((j||F)&&(z.width=j&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:p.width,z.height=F&&(!s.resizeDirection||s.resizeDirection==="vertical")?X:p.height,p.width=z.width,p.height=z.height),N&&m.expandParent){const te=Y[0]*(z.width??0);z.x&&z.x<te&&(p.x=te,E.x=E.x-(z.x-te));const oe=Y[1]*(z.height??0);z.y&&z.y<oe&&(p.y=oe,E.y=E.y-(z.y-oe))}const W=Bh({width:p.width,prevWidth:V,height:p.height,prevHeight:H,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...p,direction:W};y?.(O,q)!==!1&&(C=!0,g?.(O,q),o(z,$))}).on("end",O=>{C&&(x?.(O,{...p}),r?.({...p}),C=!1)});i.call(L)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}var Ls={exports:{}},Rs={},zs={exports:{}},js={};/**
2
+ * @license React
3
+ * use-sync-external-store-shim.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var at=T;function Wh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gh=typeof Object.is=="function"?Object.is:Wh,qh=at.useState,Kh=at.useEffect,Uh=at.useLayoutEffect,Qh=at.useDebugValue;function Jh(e,t){var n=t(),o=qh({inst:{value:n,getSnapshot:t}}),r=o[0].inst,i=o[1];return Uh(function(){r.value=n,r.getSnapshot=t,Yn(r)&&i({inst:r})},[e,n,t]),Kh(function(){return Yn(r)&&i({inst:r}),e(function(){Yn(r)&&i({inst:r})})},[e]),Qh(n),n}function Yn(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Gh(e,n)}catch{return!0}}function eg(e,t){return t()}var tg=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?eg:Jh;js.useSyncExternalStore=at.useSyncExternalStore!==void 0?at.useSyncExternalStore:tg;zs.exports=js;var ng=zs.exports;/**
10
+ * @license React
11
+ * use-sync-external-store-shim/with-selector.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Mn=T,og=ng;function rg(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ig=typeof Object.is=="function"?Object.is:rg,sg=og.useSyncExternalStore,ag=Mn.useRef,cg=Mn.useEffect,lg=Mn.useMemo,ug=Mn.useDebugValue;Rs.useSyncExternalStoreWithSelector=function(e,t,n,o,r){var i=ag(null);if(i.current===null){var s={hasValue:!1,value:null};i.current=s}else s=i.current;i=lg(function(){function l(h){if(!c){if(c=!0,u=h,h=o(h),r!==void 0&&s.hasValue){var g=s.value;if(r(g,h))return d=g}return d=h}if(g=d,ig(u,h))return g;var x=o(h);return r!==void 0&&r(g,x)?(u=h,g):(u=h,d=x)}var c=!1,u,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,o,r]);var a=sg(e,i[0],i[1]);return cg(function(){s.hasValue=!0,s.value=a},[a]),ug(a),a};Ls.exports=Rs;var dg=Ls.exports;const fg=tl(dg),hg={},$r=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(hg?"production":void 0)!=="production"&&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."),n.clear()}},c=t=e(o,r,l);return l},gg=e=>e?$r(e):$r,{useDebugValue:pg}=nl,{useSyncExternalStoreWithSelector:mg}=fg,yg=e=>e;function Hs(e,t=yg,n){const o=mg(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return pg(o),o}const Tr=(e,t)=>{const n=gg(e),o=(r,i=t)=>Hs(n,r,i);return Object.assign(o,n),o},wg=(e,t)=>e?Tr(e,t):Tr;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const In=T.createContext(null),xg=In.Provider,Vs=ye.error001("react");function ee(e,t){const n=T.useContext(In);if(n===null)throw new Error(Vs);return Hs(n,e,t)}function ne(){const e=T.useContext(In);if(e===null)throw new Error(Vs);return T.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Dr={display:"none"},vg={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Bs="react-flow__node-desc",Fs="react-flow__edge-desc",bg="react-flow__aria-live",Eg=e=>e.ariaLiveMessage,_g=e=>e.ariaLabelConfig;function Ng({rfId:e}){const t=ee(Eg);return P.jsx("div",{id:`${bg}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:vg,children:t})}function Sg({rfId:e,disableKeyboardA11y:t}){const n=ee(_g);return P.jsxs(P.Fragment,{children:[P.jsx("div",{id:`${Bs}-${e}`,style:Dr,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),P.jsx("div",{id:`${Fs}-${e}`,style:Dr,children:n["edge.a11yDescription.default"]}),!t&&P.jsx(Ng,{rfId:e})]})}const On=T.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return P.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});On.displayName="Panel";const Lr="https://reactflow.dev?utm_source=attribution";function kg({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:P.jsx(On,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Lr}`,children:P.jsx("a",{href:Lr,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Cg=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Wt=e=>e.id;function Mg(e,t){return re(e.selectedNodes.map(Wt),t.selectedNodes.map(Wt))&&re(e.selectedEdges.map(Wt),t.selectedEdges.map(Wt))}function Ig({onSelectionChange:e}){const t=ne(),{selectedNodes:n,selectedEdges:o}=ee(Cg,Mg);return T.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Og=e=>!!e.onSelectionChangeHandlers;function Pg({onSelectionChange:e}){const t=ee(Og);return e||t?P.jsx(Ig,{onSelectionChange:e}):null}const Ys=[0,0],Ag={x:0,y:0,zoom:1},$g=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Rr=[...$g,"rfId"],Tg=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),zr={translateExtent:Nt,nodeOrigin:Ys,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Dg(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=ee(Tg,re),c=ne();T.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=zr,a()}),[]);const u=T.useRef(zr);return T.useEffect(()=>{for(const d of Rr){const f=e[d],h=u.current[d];f!==h&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?c.setState({ariaLabelConfig:ih(f)}):d==="fitView"?c.setState({fitViewQueued:f}):d==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[d]:f})))}u.current=e},Rr.map(d=>e[d])),null}function jr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Lg(e){const[t,n]=T.useState(e==="system"?null:e);return T.useEffect(()=>{if(e!=="system"){n(e);return}const o=jr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:jr()?.matches?"dark":"light"}const Hr=typeof document<"u"?document:null;function It(e=null,t={target:Hr,actInsideInputWithModifier:!0}){const[n,o]=T.useState(!1),r=T.useRef(!1),i=T.useRef(new Set([])),[s,a]=T.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
18
+ `).replace(`
19
+
20
+ `,`
21
+ +`).split(`
22
+ `)),u=c.reduce((d,f)=>d.concat(...f),[]);return[c,u]}return[[],[]]},[e]);return T.useEffect(()=>{const l=t?.target??Hr,c=t?.actInsideInputWithModifier??!0;if(e!==null){const u=h=>{if(r.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!r.current||r.current&&!c)&&vs(h))return!1;const x=Br(h.code,a);if(i.current.add(h[x]),Vr(s,i.current,!1)){const y=h.composedPath?.()?.[0]||h.target,p=y?.nodeName==="BUTTON"||y?.nodeName==="A";t.preventDefault!==!1&&(r.current||!p)&&h.preventDefault(),o(!0)}},d=h=>{const g=Br(h.code,a);Vr(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(h[g]),h.key==="Meta"&&i.current.clear(),r.current=!1},f=()=>{i.current.clear(),o(!1)};return l?.addEventListener("keydown",u),l?.addEventListener("keyup",d),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{l?.removeEventListener("keydown",u),l?.removeEventListener("keyup",d),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,o]),n}function Vr(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function Br(e,t){return t.includes(e)?"code":"key"}const Rg=()=>{const e=ne();return T.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),l=Po(t,o,r,i,s,n?.padding??.1);return a?(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},u=n.snapGrid??r,d=n.snapToGrid??i;return Rt(c,o,d,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=it(t,n);return{x:s.x+r,y:s.y+i}}}),[])};function Xs(e,t){const n=[],o=new Map,r=[];for(const i of e)if(i.type==="add"){r.push(i);continue}else if(i.type==="remove"||i.type==="replace")o.set(i.id,[i]);else{const s=o.get(i.id);s?s.push(i):o.set(i.id,[i])}for(const i of t){const s=o.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const a={...i};for(const l of s)zg(l,a);n.push(a)}return r.length&&r.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function zg(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Zs(e,t){return Xs(e,t)}function jg(e,t){return Xs(e,t)}function He(e,t){return{id:e,type:"select",selected:t}}function Qe(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const s=t.has(r);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),o.push(He(i.id,s)))}return o}function Fr({items:e=[],lookup:t}){const n=[],o=new Map(e.map(r=>[r.id,r]));for(const[r,i]of e.entries()){const s=t.get(i.id),a=s?.internals?.userNode??s;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:"replace"}),a===void 0&&n.push({item:i,type:"add",index:r})}for(const[r]of t)o.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function Yr(e){return{id:e.id,type:"remove"}}const Hg=ms();function Vg(e,t,n={}){return dh(e,t,{...n,onError:n.onError??Hg})}const Xr=e=>Kf(e),Bg=e=>ds(e);function Ws(e){return T.forwardRef(e)}const Gs=typeof window<"u"?T.useLayoutEffect:T.useEffect;function Zr(e){const[t,n]=T.useState(BigInt(0)),[o]=T.useState(()=>Fg(()=>n(r=>r+BigInt(1))));return Gs(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function Fg(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const qs=T.createContext(null);function Yg({children:e}){const t=ne(),n=T.useCallback(a=>{const{nodes:l=[],setNodes:c,hasDefaultNodes:u,onNodesChange:d,nodeLookup:f,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let x=l;for(const p of a)x=typeof p=="function"?p(x):p;let y=Fr({items:x,lookup:f});for(const p of g.values())y=p(y);u&&c(x),y.length>0?d?.(y):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:p,nodes:E,setNodes:m}=t.getState();p&&m(E)})},[]),o=Zr(n),r=T.useCallback(a=>{const{edges:l=[],setEdges:c,hasDefaultEdges:u,onEdgesChange:d,edgeLookup:f}=t.getState();let h=l;for(const g of a)h=typeof g=="function"?g(h):g;u?c(h):d&&d(Fr({items:h,lookup:f}))},[]),i=Zr(r),s=T.useMemo(()=>({nodeQueue:o,edgeQueue:i}),[]);return P.jsx(qs.Provider,{value:s,children:e})}function Xg(){const e=T.useContext(qs);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Zg=e=>!!e.panZoom;function jo(){const e=Rg(),t=ne(),n=Xg(),o=ee(Zg),r=T.useMemo(()=>{const i=d=>t.getState().nodeLookup.get(d),s=d=>{n.nodeQueue.push(d)},a=d=>{n.edgeQueue.push(d)},l=d=>{const{nodeLookup:f,nodeOrigin:h}=t.getState(),g=Xr(d)?d:f.get(d.id),x=g.parentId?ws(g.position,g.measured,g.parentId,f,h):g.position,y={...g,position:x,width:g.measured?.width??g.width,height:g.measured?.height??g.height};return Ct(y)},c=(d,f,h={replace:!1})=>{s(g=>g.map(x=>{if(x.id===d){const y=typeof f=="function"?f(x):f;return h.replace&&Xr(y)?y:{...x,...y}}return x}))},u=(d,f,h={replace:!1})=>{a(g=>g.map(x=>{if(x.id===d){const y=typeof f=="function"?f(x):f;return h.replace&&Bg(y)?y:{...x,...y}}return x}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>i(d)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(f=>({...f}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:s,setEdges:a,addNodes:d=>{const f=Array.isArray(d)?d:[d];n.nodeQueue.push(h=>[...h,...f])},addEdges:d=>{const f=Array.isArray(d)?d:[d];n.edgeQueue.push(h=>[...h,...f])},toObject:()=>{const{nodes:d=[],edges:f=[],transform:h}=t.getState(),[g,x,y]=h;return{nodes:d.map(p=>({...p})),edges:f.map(p=>({...p})),viewport:{x:g,y:x,zoom:y}}},deleteElements:async({nodes:d=[],edges:f=[]})=>{const{nodes:h,edges:g,onNodesDelete:x,onEdgesDelete:y,triggerNodeChanges:p,triggerEdgeChanges:E,onDelete:m,onBeforeDelete:v}=t.getState(),{nodes:S,edges:N}=await th({nodesToRemove:d,edgesToRemove:f,nodes:h,edges:g,onBeforeDelete:v}),b=N.length>0,_=S.length>0;if(b){const C=N.map(Yr);y?.(N),E(C)}if(_){const C=S.map(Yr);x?.(S),p(C)}return(_||b)&&m?.({nodes:S,edges:N}),{deletedNodes:S,deletedEdges:N}},getIntersectingNodes:(d,f=!0,h)=>{const g=vr(d),x=g?d:l(d),y=h!==void 0;return x?(h||t.getState().nodes).filter(p=>{const E=t.getState().nodeLookup.get(p.id);if(E&&!g&&(p.id===d.id||!E.internals.positionAbsolute))return!1;const m=Ct(y?p:E),v=gn(m,x);return f&&v>0||v>=m.width*m.height||v>=x.width*x.height}):[]},isNodeIntersecting:(d,f,h=!0)=>{const x=vr(d)?d:l(d);if(!x)return!1;const y=gn(x,f);return h&&y>0||y>=f.width*f.height||y>=x.width*x.height},updateNode:c,updateNodeData:(d,f,h={replace:!1})=>{c(d,g=>{const x=typeof f=="function"?f(g):f;return h.replace?{...g,data:x}:{...g,data:{...g.data,...x}}},h)},updateEdge:u,updateEdgeData:(d,f,h={replace:!1})=>{u(d,g=>{const x=typeof f=="function"?f(g):f;return h.replace?{...g,data:x}:{...g,data:{...g.data,...x}}},h)},getNodesBounds:d=>{const{nodeLookup:f,nodeOrigin:h}=t.getState();return Uf(d,{nodeLookup:f,nodeOrigin:h})},getHandleConnections:({type:d,id:f,nodeId:h})=>Array.from(t.getState().connectionLookup.get(`${h}-${d}${f?`-${f}`:""}`)?.values()??[]),getNodeConnections:({type:d,handleId:f,nodeId:h})=>Array.from(t.getState().connectionLookup.get(`${h}${d?f?`-${d}-${f}`:`-${d}`:""}`)?.values()??[]),fitView:async d=>{const f=t.getState().fitViewResolver??rh();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:f}),n.nodeQueue.push(h=>[...h]),f.promise}}},[]);return T.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const Wr=e=>e.selected,Wg=typeof window<"u"?window:void 0;function Gg({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ne(),{deleteElements:o}=jo(),r=It(e,{actInsideInputWithModifier:!1}),i=It(t,{target:Wg});T.useEffect(()=>{if(r){const{edges:s,nodes:a}=n.getState();o({nodes:a.filter(Wr),edges:s.filter(Wr)}),n.setState({nodesSelectionActive:!1})}},[r]),T.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function qg(e){const t=ne();T.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const o=Ao(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",ye.error004()),t.setState({width:o.width||500,height:o.height||500})};if(e.current){n(),window.addEventListener("resize",n);const o=new ResizeObserver(()=>n());return o.observe(e.current),()=>{window.removeEventListener("resize",n),o&&e.current&&o.unobserve(e.current)}}},[])}const Pn={position:"absolute",width:"100%",height:"100%",top:0,left:0},Kg=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Ug({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:i=Fe.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:h=!0,children:g,noWheelClassName:x,noPanClassName:y,onViewportChange:p,isControlledViewport:E,paneClickDistance:m,selectionOnDrag:v}){const S=ne(),N=T.useRef(null),{userSelectionActive:b,lib:_,connectionInProgress:C}=ee(Kg,re),L=It(f),O=T.useRef();qg(N);const A=T.useCallback(I=>{p?.({x:I[0],y:I[1],zoom:I[2]}),E||S.setState({transform:I})},[p,E]);return T.useEffect(()=>{if(N.current){O.current=Vh({domNode:N.current,minZoom:u,maxZoom:d,translateExtent:c,viewport:l,onDraggingChange:M=>S.setState($=>$.paneDragging===M?$:{paneDragging:M}),onPanZoomStart:(M,$)=>{const{onViewportChangeStart:R,onMoveStart:D}=S.getState();D?.(M,$),R?.($)},onPanZoom:(M,$)=>{const{onViewportChange:R,onMove:D}=S.getState();D?.(M,$),R?.($)},onPanZoomEnd:(M,$)=>{const{onViewportChangeEnd:R,onMoveEnd:D}=S.getState();D?.(M,$),R?.($)}});const{x:I,y:w,zoom:k}=O.current.getViewport();return S.setState({panZoom:O.current,transform:[I,w,k],domNode:N.current.closest(".react-flow")}),()=>{O.current?.destroy()}}},[]),T.useEffect(()=>{O.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:L,preventScrolling:h,noPanClassName:y,userSelectionActive:b,noWheelClassName:x,lib:_,onTransformChange:A,connectionInProgress:C,selectionOnDrag:v,paneClickDistance:m})},[e,t,n,o,r,i,s,a,L,h,y,b,x,_,A,C,v,m]),P.jsx("div",{className:"react-flow__renderer",ref:N,style:Pn,children:g})}const Qg=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Jg(){const{userSelectionActive:e,userSelectionRect:t}=ee(Qg,re);return e&&t?P.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Xn=(e,t)=>n=>{n.target===t.current&&e?.(n)},ep=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function tp({isSelecting:e,selectionKeyPressed:t,selectionMode:n=St.Full,panOnDrag:o,autoPanOnSelection:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:h,onPaneMouseLeave:g,children:x}){const y=T.useRef(0),p=ne(),{userSelectionActive:E,elementsSelectable:m,dragging:v,panBy:S,autoPanSpeed:N}=ee(ep,re),b=m&&(e||E),_=T.useRef(null),C=T.useRef(),L=T.useRef(new Set),O=T.useRef(new Set),A=T.useRef(!1),I=T.useRef(!1),w=T.useRef({x:0,y:0}),k=T.useRef(!1),M=j=>{if(I.current||A.current||p.getState().connection.inProgress){I.current=!1,A.current=!1;return}c?.(j),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},$=j=>{if(Array.isArray(o)&&o?.includes(2)){j.preventDefault();return}u?.(j)},R=d?j=>d(j):void 0,D=j=>{I.current&&(j.stopPropagation(),I.current=!1)},V=j=>{const{domNode:F,transform:U}=p.getState();if(C.current=F?.getBoundingClientRect(),!C.current)return;const K=j.target===_.current;if(!K&&!!j.target.closest(".nokey")||!e||!(s&&K||t)||j.button!==0||!j.isPrimary)return;j.target?.setPointerCapture?.(j.pointerId),I.current=!1;const{x:J,y:te}=me(j.nativeEvent,C.current),oe=Rt({x:J,y:te},U);p.setState({userSelectionRect:{width:0,height:0,startX:oe.x,startY:oe.y,x:J,y:te}}),K||(j.stopPropagation(),j.preventDefault())};function H(j,F){const{userSelectionRect:U}=p.getState();if(!U)return;const{transform:K,nodeLookup:W,edgeLookup:q,connectionLookup:J,triggerNodeChanges:te,triggerEdgeChanges:oe,defaultEdgeOptions:se}=p.getState(),ke={x:U.startX,y:U.startY},{x:xe,y:ve}=it(ke,K),Ce={startX:ke.x,startY:ke.y,x:j<xe?j:xe,y:F<ve?F:ve,width:Math.abs(j-xe),height:Math.abs(F-ve)},ft=L.current,Re=O.current;L.current=new Set(Io(W,Ce,K,n===St.Partial,!0).map(de=>de.id)),O.current=new Set;const ze=se?.selectable??!0;for(const de of L.current){const Me=J.get(de);if(Me)for(const{edgeId:Ie}of Me.values()){const je=q.get(Ie);je&&(je.selectable??ze)&&O.current.add(Ie)}}if(!br(ft,L.current)){const de=Qe(W,L.current,!0);te(de)}if(!br(Re,O.current)){const de=Qe(q,O.current);oe(de)}p.setState({userSelectionRect:Ce,userSelectionActive:!0,nodesSelectionActive:!1})}function z(){if(!r||!C.current)return;const[j,F]=Oo(w.current,C.current,N);S({x:j,y:F}).then(U=>{if(!I.current||!U){y.current=requestAnimationFrame(z);return}const{x:K,y:W}=w.current;H(K,W),y.current=requestAnimationFrame(z)})}const Y=()=>{cancelAnimationFrame(y.current),y.current=0,k.current=!1};T.useEffect(()=>()=>Y(),[]);const B=j=>{const{userSelectionRect:F,transform:U,resetSelectedElements:K}=p.getState();if(!C.current||!F)return;const{x:W,y:q}=me(j.nativeEvent,C.current);w.current={x:W,y:q};const J=it({x:F.startX,y:F.startY},U);if(!I.current){const te=t?0:i;if(Math.hypot(W-J.x,q-J.y)<=te)return;K(),a?.(j)}I.current=!0,k.current||(z(),k.current=!0),H(W,q)},X=j=>{if(!b){j.target===_.current&&p.getState().connection.inProgress&&(A.current=!0);return}j.button===0&&(j.target?.releasePointerCapture?.(j.pointerId),!E&&j.target===_.current&&p.getState().userSelectionRect&&M?.(j),p.setState({userSelectionActive:!1,userSelectionRect:null}),I.current&&(l?.(j),p.setState({nodesSelectionActive:L.current.size>0})),Y())},Q=j=>{j.target?.releasePointerCapture?.(j.pointerId),Y()},G=o===!0||Array.isArray(o)&&o.includes(0);return P.jsxs("div",{className:ie(["react-flow__pane",{draggable:G,dragging:v,selection:e}]),onClick:b?void 0:Xn(M,_),onContextMenu:Xn($,_),onWheel:Xn(R,_),onPointerEnter:b?void 0:f,onPointerMove:b?B:h,onPointerUp:X,onPointerCancel:b?Q:void 0,onPointerDownCapture:b?V:void 0,onClickCapture:b?D:void 0,onPointerLeave:g,ref:_,style:Pn,children:[x,P.jsx(Jg,{})]})}function yo({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);if(!c){l?.("012",ye.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function Ks({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const a=ne(),[l,c]=T.useState(!1),u=T.useRef();return T.useEffect(()=>{if(!t)return u.current=Ch({getStoreItems:()=>a.getState(),onNodeMouseDown:d=>{yo({id:d,store:a,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,a,e]),T.useEffect(()=>{t||!e.current||!u.current||u.current.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s})},[n,o,t,i,e,r,s]),l}const np=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Us(){const e=ne();return T.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:u}=e.getState(),d=new Map,f=np(s),h=r?i[0]:5,g=r?i[1]:5,x=n.direction.x*h*n.factor,y=n.direction.y*g*n.factor;for(const[,p]of c){if(!f(p))continue;let E={x:p.internals.positionAbsolute.x+x,y:p.internals.positionAbsolute.y+y};r&&(E=Lt(E,i));const{position:m,positionAbsolute:v}=fs({nodeId:p.id,nextPosition:E,nodeLookup:c,nodeExtent:o,nodeOrigin:u,onError:a});p.position=m,p.internals.positionAbsolute=v,d.set(p.id,p)}l(d)},[])}const Ho=T.createContext(null),op=Ho.Provider;Ho.Consumer;const Qs=()=>T.useContext(Ho),rp=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Js=T.createContext(null);function ip({children:e}){const t=ee(rp,re);return P.jsx(Js.Provider,{value:t,children:e})}function sp(){const e=T.useContext(Js);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const ap={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},cp=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:l,isValid:c}=s;if(!a&&!r)return ap;const u=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===ot.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:u&&c}};function lp({type:e="source",position:t=Z.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:l,className:c,onMouseDown:u,onTouchStart:d,...f},h){const g=s||null,x=e==="target",y=ne(),p=Qs(),{connectOnClick:E,noPanClassName:m,rfId:v}=sp(),{connectingFrom:S,connectingTo:N,clickConnecting:b,isPossibleEndHandle:_,connectionInProcess:C,clickConnectionInProcess:L,valid:O}=ee(cp(p,g,e),re);p||y.getState().onError?.("010",ye.error010());const A=k=>{const{defaultEdgeOptions:M,onConnect:$,hasDefaultEdges:R}=y.getState(),D={...M,...k};if(R){const{edges:V,setEdges:H,onError:z}=y.getState();H(Vg(D,V,{onError:z}))}$?.(D),a?.(D)},I=k=>{if(!p)return;const M=bs(k.nativeEvent);if(r&&(M&&k.button===0||!M)){const $=y.getState();mo.onPointerDown(k.nativeEvent,{handleDomNode:k.currentTarget,autoPanOnConnect:$.autoPanOnConnect,connectionMode:$.connectionMode,connectionRadius:$.connectionRadius,domNode:$.domNode,nodeLookup:$.nodeLookup,lib:$.lib,isTarget:x,handleId:g,nodeId:p,flowId:$.rfId,panBy:$.panBy,cancelConnection:$.cancelConnection,onConnectStart:$.onConnectStart,onConnectEnd:(...R)=>y.getState().onConnectEnd?.(...R),updateConnection:$.updateConnection,onConnect:A,isValidConnection:n||((...R)=>y.getState().isValidConnection?.(...R)??!0),getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,autoPanSpeed:$.autoPanSpeed,dragThreshold:$.connectionDragThreshold})}M?u?.(k):d?.(k)},w=k=>{const{onClickConnectStart:M,onClickConnectEnd:$,connectionClickStartHandle:R,connectionMode:D,isValidConnection:V,lib:H,rfId:z,nodeLookup:Y,connection:B}=y.getState();if(!p||!R&&!r)return;if(!R){M?.(k.nativeEvent,{nodeId:p,handleId:g,handleType:e}),y.setState({connectionClickStartHandle:{nodeId:p,type:e,id:g}});return}const X=xs(k.target),Q=n||V,{connection:G,isValid:j}=mo.isValid(k.nativeEvent,{handle:{nodeId:p,id:g,type:e},connectionMode:D,fromNodeId:R.nodeId,fromHandleId:R.id||null,fromType:R.type,isValidConnection:Q,flowId:z,doc:X,lib:H,nodeLookup:Y});j&&G&&A(G);const F=structuredClone(B);delete F.inProgress,F.toPosition=F.toHandle?F.toHandle.position:null,$?.(k,F),y.setState({connectionClickStartHandle:null})};return P.jsx("div",{"data-handleid":g,"data-nodeid":p,"data-handlepos":t,"data-id":`${v}-${p}-${g}-${e}`,className:ie(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",m,c,{source:!x,target:x,connectable:o,connectablestart:r,connectableend:i,clickconnecting:b,connectingfrom:S,connectingto:N,valid:O,connectionindicator:o&&(!C||_)&&(C||L?i:r)}]),onMouseDown:I,onTouchStart:I,onClick:E?w:void 0,ref:h,...f,children:l})}const ct=T.memo(Ws(lp));function up({data:e,isConnectable:t,sourcePosition:n=Z.Bottom}){return P.jsxs(P.Fragment,{children:[e?.label,P.jsx(ct,{type:"source",position:n,isConnectable:t})]})}function dp({data:e,isConnectable:t,targetPosition:n=Z.Top,sourcePosition:o=Z.Bottom}){return P.jsxs(P.Fragment,{children:[P.jsx(ct,{type:"target",position:n,isConnectable:t}),e?.label,P.jsx(ct,{type:"source",position:o,isConnectable:t})]})}function fp(){return null}function hp({data:e,isConnectable:t,targetPosition:n=Z.Top}){return P.jsxs(P.Fragment,{children:[P.jsx(ct,{type:"target",position:n,isConnectable:t}),e?.label]})}const pn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Gr={input:up,default:dp,output:hp,group:fp};function gp(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const pp=e=>{const{width:t,height:n,x:o,y:r}=Dt(e.nodeLookup,{filter:i=>!!i.selected});return{width:pe(t)?t:null,height:pe(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function mp({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=ne(),{width:r,height:i,transformString:s,userSelectionActive:a}=ee(pp,re),l=Us(),c=T.useRef(null);T.useEffect(()=>{n||c.current?.focus({preventScroll:!0})},[n]);const u=!a&&r!==null&&i!==null;if(Ks({nodeRef:c,disabled:!u}),!u)return null;const d=e?h=>{const g=o.getState().nodes.filter(x=>x.selected);e(h,g)}:void 0,f=h=>{Object.prototype.hasOwnProperty.call(pn,h.key)&&(h.preventDefault(),l({direction:pn[h.key],factor:h.shiftKey?4:1}))};return P.jsx("div",{className:ie(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:P.jsx("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:r,height:i}})})}const qr=typeof window<"u"?window:void 0,yp=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function ea({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:x,zoomActivationKeyCode:y,elementsSelectable:p,zoomOnScroll:E,zoomOnPinch:m,panOnScroll:v,panOnScrollSpeed:S,panOnScrollMode:N,zoomOnDoubleClick:b,panOnDrag:_,autoPanOnSelection:C,defaultViewport:L,translateExtent:O,minZoom:A,maxZoom:I,preventScrolling:w,onSelectionContextMenu:k,noWheelClassName:M,noPanClassName:$,disableKeyboardA11y:R,onViewportChange:D,isControlledViewport:V}){const{nodesSelectionActive:H,userSelectionActive:z}=ee(yp,re),Y=It(c,{target:qr}),B=It(x,{target:qr}),X=B||_,Q=B||v,G=u&&X!==!0,j=Y||z||G;return Gg({deleteKeyCode:l,multiSelectionKeyCode:g}),P.jsx(Ug,{onPaneContextMenu:i,elementsSelectable:p,zoomOnScroll:E,zoomOnPinch:m,panOnScroll:Q,panOnScrollSpeed:S,panOnScrollMode:N,zoomOnDoubleClick:b,panOnDrag:!Y&&X,defaultViewport:L,translateExtent:O,minZoom:A,maxZoom:I,zoomActivationKeyCode:y,preventScrolling:w,noWheelClassName:M,noPanClassName:$,onViewportChange:D,isControlledViewport:V,paneClickDistance:a,selectionOnDrag:G,children:P.jsxs(tp,{onSelectionStart:f,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:X,autoPanOnSelection:C,isSelecting:!!j,selectionMode:d,selectionKeyPressed:Y,paneClickDistance:a,selectionOnDrag:G,children:[e,H&&P.jsx(mp,{onSelectionContextMenu:k,noPanClassName:$,disableKeyboardA11y:R})]})})}ea.displayName="FlowRenderer";const wp=T.memo(ea),xp=e=>t=>e?Io(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function vp(e){return ee(T.useCallback(xp(e),[e]),re)}const bp=e=>e.updateNodeInternals;function Ep(){const e=ee(bp),[t]=T.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const i=r.target.getAttribute("data-id");o.set(i,{id:i,nodeElement:r.target,force:!0})}),e(o)}));return T.useEffect(()=>()=>{t?.disconnect()},[t]),t}function _p({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=ne(),i=T.useRef(null),s=T.useRef(null),a=T.useRef(e.sourcePosition),l=T.useRef(e.targetPosition),c=T.useRef(t),u=n&&!!e.internals.handleBounds;return T.useEffect(()=>{i.current&&!e.hidden&&(!u||s.current!==i.current)&&(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[u,e.hidden]),T.useEffect(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),T.useEffect(()=>{if(i.current){const d=c.current!==t,f=a.current!==e.sourcePosition,h=l.current!==e.targetPosition;(d||f||h)&&(c.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function Np({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:h,disableKeyboardA11y:g,rfId:x,nodeTypes:y,nodeClickDistance:p,onError:E}){const{node:m,internals:v,isParent:S}=ee(j=>{const F=j.nodeLookup.get(e),U=j.parentLookup.has(e);return{node:F,internals:F.internals,isParent:U}},re);let N=m.type||"default",b=y?.[N]||Gr[N];b===void 0&&(E?.("003",ye.error003(N)),N="default",b=y?.default||Gr.default);const _=!!(m.draggable||a&&typeof m.draggable>"u"),C=!!(m.selectable||l&&typeof m.selectable>"u"),L=!!(m.connectable||c&&typeof m.connectable>"u"),O=!!(m.focusable||u&&typeof m.focusable>"u"),A=ne(),I=ys(m),w=_p({node:m,nodeType:N,hasDimensions:I,resizeObserver:d}),k=Ks({nodeRef:w,disabled:m.hidden||!_,noDragClassName:f,handleSelector:m.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:p}),M=Us();if(m.hidden)return null;const $=Se(m),R=gp(m),D=C||_||t||n||o||r,V=n?j=>n(j,{...v.userNode}):void 0,H=o?j=>o(j,{...v.userNode}):void 0,z=r?j=>r(j,{...v.userNode}):void 0,Y=i?j=>i(j,{...v.userNode}):void 0,B=s?j=>s(j,{...v.userNode}):void 0,X=j=>{const{selectNodesOnDrag:F,nodeDragThreshold:U}=A.getState();C&&(!F||!_||U>0)&&yo({id:e,store:A,nodeRef:w}),t&&t(j,{...v.userNode})},Q=j=>{if(!(vs(j.nativeEvent)||g)){if(as.includes(j.key)&&C){const F=j.key==="Escape";yo({id:e,store:A,unselect:F,nodeRef:w})}else if(_&&m.selected&&Object.prototype.hasOwnProperty.call(pn,j.key)){j.preventDefault();const{ariaLabelConfig:F}=A.getState();A.setState({ariaLiveMessage:F["node.a11yDescription.ariaLiveMessage"]({direction:j.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),M({direction:pn[j.key],factor:j.shiftKey?4:1})}}},G=()=>{if(g||!w.current?.matches(":focus-visible"))return;const{transform:j,width:F,height:U,autoPanOnNodeFocus:K,setCenter:W}=A.getState();if(!K)return;Io(new Map([[e,m]]),{x:0,y:0,width:F,height:U},j,!0).length>0||W(m.position.x+$.width/2,m.position.y+$.height/2,{zoom:j[2]})};return P.jsx("div",{className:ie(["react-flow__node",`react-flow__node-${N}`,{[h]:_},m.className,{selected:m.selected,selectable:C,parent:S,draggable:_,dragging:k}]),ref:w,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:D?"all":"none",visibility:I?"visible":"hidden",...m.style,...R},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:V,onMouseMove:H,onMouseLeave:z,onContextMenu:Y,onClick:X,onDoubleClick:B,onKeyDown:O?Q:void 0,tabIndex:O?0:void 0,onFocus:O?G:void 0,role:m.ariaRole??(O?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${Bs}-${x}`,"aria-label":m.ariaLabel,...m.domAttributes,children:P.jsx(op,{value:e,children:P.jsx(b,{id:e,data:m.data,type:N,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:m.selected??!1,selectable:C,draggable:_,deletable:m.deletable??!0,isConnectable:L,sourcePosition:m.sourcePosition,targetPosition:m.targetPosition,dragging:k,dragHandle:m.dragHandle,zIndex:v.z,parentId:m.parentId,...$})})})}var Sp=T.memo(Np);const kp=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function ta(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,onError:r}=ee(kp,re),i=vp(e.onlyRenderVisibleElements),s=Ep();return P.jsx("div",{className:"react-flow__nodes",style:Pn,children:i.map(a=>P.jsx(Sp,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:r},a))})}ta.displayName="NodeRenderer";const Cp=T.memo(ta);function Mp(e){return ee(T.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const o=[];if(n.width&&n.height)for(const r of n.edges){const i=n.nodeLookup.get(r.source),s=n.nodeLookup.get(r.target);i&&s&&ch({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),re)}const Ip=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return P.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Op=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return P.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Kr={[kt.Arrow]:Ip,[kt.ArrowClosed]:Op};function Pp(e){const t=ne();return T.useMemo(()=>Object.prototype.hasOwnProperty.call(Kr,e)?Kr[e]:(t.getState().onError?.("009",ye.error009(e)),null),[e])}const Ap=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=Pp(t);return l?P.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:P.jsx(l,{color:n,strokeWidth:s})}):null},na=({defaultColor:e,rfId:t})=>{const n=ee(i=>i.edges),o=ee(i=>i.defaultEdgeOptions),r=T.useMemo(()=>mh(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?P.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:P.jsx("defs",{children:r.map(i=>P.jsx(Ap,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};na.displayName="MarkerDefinitions";var $p=T.memo(na);function oa({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...u}){const[d,f]=T.useState({x:1,y:0,width:0,height:0}),h=ie(["react-flow__edge-textwrapper",c]),g=T.useRef(null);return T.useEffect(()=>{if(g.current){const x=g.current.getBBox();f({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n?P.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:h,visibility:d.width?"visible":"hidden",...u,children:[r&&P.jsx("rect",{width:d.width+2*s[0],x:-s[0],y:-s[1],height:d.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),P.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:g,style:o,children:n}),l]}):null}oa.displayName="EdgeText";const Tp=T.memo(oa);function lt({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...u}){return P.jsxs(P.Fragment,{children:[P.jsx("path",{...u,d:e,fill:"none",className:ie(["react-flow__edge-path",u.className])}),c?P.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,o&&pe(t)&&pe(n)?P.jsx(Tp,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function Ur({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===Z.Left||e===Z.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function ra({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:o,targetY:r,targetPosition:i=Z.Top}){const[s,a]=Ur({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=Ur({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,d,f,h]=Es({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${a} ${l},${c} ${o},${r}`,u,d,f,h]}function ia(e){return T.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:x,markerStart:y,interactionWidth:p})=>{const[E,m,v]=ra({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),S=e.isInternal?void 0:t;return P.jsx(lt,{id:S,path:E,labelX:m,labelY:v,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:x,markerStart:y,interactionWidth:p})})}const Dp=ia({isInternal:!1}),sa=ia({isInternal:!0});Dp.displayName="SimpleBezierEdge";sa.displayName="SimpleBezierEdgeInternal";function aa(e){return T.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:h=Z.Bottom,targetPosition:g=Z.Top,markerEnd:x,markerStart:y,pathOptions:p,interactionWidth:E})=>{const[m,v,S]=ho({sourceX:n,sourceY:o,sourcePosition:h,targetX:r,targetY:i,targetPosition:g,borderRadius:p?.borderRadius,offset:p?.offset,stepPosition:p?.stepPosition}),N=e.isInternal?void 0:t;return P.jsx(lt,{id:N,path:m,labelX:v,labelY:S,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:x,markerStart:y,interactionWidth:E})})}const ca=aa({isInternal:!1}),la=aa({isInternal:!0});ca.displayName="SmoothStepEdge";la.displayName="SmoothStepEdgeInternal";function ua(e){return T.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return P.jsx(ca,{...n,id:o,pathOptions:T.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const Lp=ua({isInternal:!1}),da=ua({isInternal:!0});Lp.displayName="StepEdge";da.displayName="StepEdgeInternal";function fa(e){return T.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:x})=>{const[y,p,E]=Ns({sourceX:n,sourceY:o,targetX:r,targetY:i}),m=e.isInternal?void 0:t;return P.jsx(lt,{id:m,path:y,labelX:p,labelY:E,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:x})})}const Rp=fa({isInternal:!1}),ha=fa({isInternal:!0});Rp.displayName="StraightEdge";ha.displayName="StraightEdgeInternal";function ga(e){return T.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=Z.Bottom,targetPosition:a=Z.Top,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:x,markerStart:y,pathOptions:p,interactionWidth:E})=>{const[m,v,S]=$o({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:p?.curvature}),N=e.isInternal?void 0:t;return P.jsx(lt,{id:N,path:m,labelX:v,labelY:S,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:x,markerStart:y,interactionWidth:E})})}const zp=ga({isInternal:!1}),pa=ga({isInternal:!0});zp.displayName="BezierEdge";pa.displayName="BezierEdgeInternal";const Qr={default:pa,straight:ha,step:da,smoothstep:la,simplebezier:sa},Jr={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},jp=(e,t,n)=>n===Z.Left?e-t:n===Z.Right?e+t:e,Hp=(e,t,n)=>n===Z.Top?e-t:n===Z.Bottom?e+t:e,ei="react-flow__edgeupdater";function ti({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return P.jsx("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:ie([ei,`${ei}-${a}`]),cx:jp(t,o,e),cy:Hp(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function Vp({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:h}){const g=ne(),x=(v,S)=>{if(v.button!==0)return;const{autoPanOnConnect:N,domNode:b,connectionMode:_,connectionRadius:C,lib:L,onConnectStart:O,cancelConnection:A,nodeLookup:I,rfId:w,panBy:k,updateConnection:M}=g.getState(),$=S.type==="target",R=(H,z)=>{f(!1),d?.(H,n,S.type,z)},D=H=>c?.(n,H),V=(H,z)=>{f(!0),u?.(v,n,S.type),O?.(H,z)};mo.onPointerDown(v.nativeEvent,{autoPanOnConnect:N,connectionMode:_,connectionRadius:C,domNode:b,handleId:S.id,nodeId:S.nodeId,nodeLookup:I,isTarget:$,edgeUpdaterType:S.type,lib:L,flowId:w,cancelConnection:A,panBy:k,isValidConnection:(...H)=>g.getState().isValidConnection?.(...H)??!0,onConnect:D,onConnectStart:V,onConnectEnd:(...H)=>g.getState().onConnectEnd?.(...H),onReconnectEnd:R,updateConnection:M,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:v.currentTarget})},y=v=>x(v,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),p=v=>x(v,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),E=()=>h(!0),m=()=>h(!1);return P.jsxs(P.Fragment,{children:[(e===!0||e==="source")&&P.jsx(ti,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:y,onMouseEnter:E,onMouseOut:m,type:"source"}),(e===!0||e==="target")&&P.jsx(ti,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:p,onMouseEnter:E,onMouseOut:m,type:"target"})]})}function Bp({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:h,rfId:g,edgeTypes:x,noPanClassName:y,onError:p,disableKeyboardA11y:E}){let m=ee(W=>W.edgeLookup.get(e));const v=ee(W=>W.defaultEdgeOptions);m=v?{...v,...m}:m;let S=m.type||"default",N=x?.[S]||Qr[S];N===void 0&&(p?.("011",ye.error011(S)),S="default",N=x?.default||Qr.default);const b=!!(m.focusable||t&&typeof m.focusable>"u"),_=typeof d<"u"&&(m.reconnectable||n&&typeof m.reconnectable>"u"),C=!!(m.selectable||o&&typeof m.selectable>"u"),L=T.useRef(null),[O,A]=T.useState(!1),[I,w]=T.useState(!1),k=ne(),{zIndex:M=m.zIndex,sourceX:$,sourceY:R,targetX:D,targetY:V,sourcePosition:H,targetPosition:z}=ee(T.useCallback(W=>{const q=W.nodeLookup.get(m.source),J=W.nodeLookup.get(m.target);if(!q||!J)return Jr;const te=ph({id:e,sourceNode:q,targetNode:J,sourceHandle:m.sourceHandle||null,targetHandle:m.targetHandle||null,connectionMode:W.connectionMode,onError:p}),oe=ah({selected:m.selected,zIndex:m.zIndex,sourceNode:q,targetNode:J,elevateOnSelect:W.elevateEdgesOnSelect,zIndexMode:W.zIndexMode});return{...te||Jr,zIndex:oe}},[m.source,m.target,m.sourceHandle,m.targetHandle,m.selected,m.zIndex]),re),Y=T.useMemo(()=>m.markerStart?`url('#${go(m.markerStart,g)}')`:void 0,[m.markerStart,g]),B=T.useMemo(()=>m.markerEnd?`url('#${go(m.markerEnd,g)}')`:void 0,[m.markerEnd,g]);if(m.hidden||$===null||R===null||D===null||V===null)return null;const X=W=>{const{addSelectedEdges:q,unselectNodesAndEdges:J,multiSelectionActive:te}=k.getState();C&&(k.setState({nodesSelectionActive:!1}),m.selected&&te?(J({nodes:[],edges:[m]}),L.current?.blur()):q([e])),r&&r(W,m)},Q=i?W=>{i(W,{...m})}:void 0,G=s?W=>{s(W,{...m})}:void 0,j=a?W=>{a(W,{...m})}:void 0,F=l?W=>{l(W,{...m})}:void 0,U=c?W=>{c(W,{...m})}:void 0,K=W=>{if(!E&&as.includes(W.key)&&C){const{unselectNodesAndEdges:q,addSelectedEdges:J}=k.getState();W.key==="Escape"?(L.current?.blur(),q({edges:[m]})):J([e])}};return P.jsx("svg",{style:{zIndex:M},children:P.jsxs("g",{className:ie(["react-flow__edge",`react-flow__edge-${S}`,m.className,y,{selected:m.selected,animated:m.animated,inactive:!C&&!r,updating:O,selectable:C}]),onClick:X,onDoubleClick:Q,onContextMenu:G,onMouseEnter:j,onMouseMove:F,onMouseLeave:U,onKeyDown:b?K:void 0,tabIndex:b?0:void 0,role:m.ariaRole??(b?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":m.ariaLabel===null?void 0:m.ariaLabel||`Edge from ${m.source} to ${m.target}`,"aria-describedby":b?`${Fs}-${g}`:void 0,ref:L,...m.domAttributes,children:[!I&&P.jsx(N,{id:e,source:m.source,target:m.target,type:m.type,selected:m.selected,animated:m.animated,selectable:C,deletable:m.deletable??!0,label:m.label,labelStyle:m.labelStyle,labelShowBg:m.labelShowBg,labelBgStyle:m.labelBgStyle,labelBgPadding:m.labelBgPadding,labelBgBorderRadius:m.labelBgBorderRadius,sourceX:$,sourceY:R,targetX:D,targetY:V,sourcePosition:H,targetPosition:z,data:m.data,style:m.style,sourceHandleId:m.sourceHandle,targetHandleId:m.targetHandle,markerStart:Y,markerEnd:B,pathOptions:"pathOptions"in m?m.pathOptions:void 0,interactionWidth:m.interactionWidth}),_&&P.jsx(Vp,{edge:m,isReconnectable:_,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:h,sourceX:$,sourceY:R,targetX:D,targetY:V,sourcePosition:H,targetPosition:z,setUpdateHover:A,setReconnecting:w})]})})}var Fp=T.memo(Bp);const Yp=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ma({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:x}){const{edgesFocusable:y,edgesReconnectable:p,elementsSelectable:E,onError:m}=ee(Yp,re),v=Mp(t);return P.jsxs("div",{className:"react-flow__edges",children:[P.jsx($p,{defaultColor:e,rfId:n}),v.map(S=>P.jsx(Fp,{id:S,edgesFocusable:y,edgesReconnectable:p,elementsSelectable:E,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:m,edgeTypes:o,disableKeyboardA11y:x},S))]})}ma.displayName="EdgeRenderer";const Xp=T.memo(ma),ni=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function Zp({children:e}){const t=ne(),n=T.useRef(null),[o]=T.useState(()=>t.getState().transform);return Gs(()=>{let r=null;const i=()=>{const s=t.getState().transform;r&&s[0]===r[0]&&s[1]===r[1]&&s[2]===r[2]||(r=s,n.current&&(n.current.style.transform=ni(s)))};return i(),t.subscribe(i)},[t]),P.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:ni(o)},children:e})}function Wp(e){const t=jo(),n=T.useRef(!1);T.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Gp=e=>e.panZoom?.syncViewport;function qp(e){const t=ee(Gp),n=ne();return T.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Kp(e){return e.connection.inProgress?{...e.connection,to:Rt(e.connection.to,e.transform)}:{...e.connection}}function Up(e){return Kp}function Qp(e){const t=Up();return ee(t,re)}const Jp=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function e0({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:l}=ee(Jp,re);return!(i&&r&&l)?null:P.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:P.jsx("g",{className:ie(["react-flow__connection",us(a)]),children:P.jsx(ya,{style:t,type:n,CustomComponent:o,isValid:a})})})}const ya=({style:e,type:t=De.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:l,to:c,toNode:u,toHandle:d,toPosition:f,pointer:h}=Qp();if(!r)return;if(n)return P.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:f,connectionStatus:us(o),toNode:u,toHandle:d,pointer:h});let g="";const x={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:f};switch(t){case De.Bezier:[g]=$o(x);break;case De.SimpleBezier:[g]=ra(x);break;case De.Step:[g]=ho({...x,borderRadius:0});break;case De.SmoothStep:[g]=ho(x);break;default:[g]=Ns(x)}return P.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};ya.displayName="ConnectionLine";const t0={};function oi(e=t0){T.useRef(e),ne(),T.useEffect(()=>{},[e])}function n0(){ne(),T.useRef(!1),T.useEffect(()=>{},[])}function wa({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:x,connectionLineComponent:y,connectionLineContainerStyle:p,selectionKeyCode:E,selectionOnDrag:m,selectionMode:v,multiSelectionKeyCode:S,panActivationKeyCode:N,zoomActivationKeyCode:b,deleteKeyCode:_,onlyRenderVisibleElements:C,elementsSelectable:L,defaultViewport:O,translateExtent:A,minZoom:I,maxZoom:w,preventScrolling:k,defaultMarkerColor:M,zoomOnScroll:$,zoomOnPinch:R,panOnScroll:D,panOnScrollSpeed:V,panOnScrollMode:H,zoomOnDoubleClick:z,panOnDrag:Y,autoPanOnSelection:B,onPaneClick:X,onPaneMouseEnter:Q,onPaneMouseMove:G,onPaneMouseLeave:j,onPaneScroll:F,onPaneContextMenu:U,paneClickDistance:K,nodeClickDistance:W,onEdgeContextMenu:q,onEdgeMouseEnter:J,onEdgeMouseMove:te,onEdgeMouseLeave:oe,reconnectRadius:se,onReconnect:ke,onReconnectStart:xe,onReconnectEnd:ve,noDragClassName:Ce,noWheelClassName:ft,noPanClassName:Re,disableKeyboardA11y:ze,nodeExtent:de,rfId:Me,viewport:Ie,onViewportChange:je,nodesDraggable:Tn}){return oi(e),oi(t),n0(),Wp(n),qp(Ie),P.jsx(wp,{onPaneClick:X,onPaneMouseEnter:Q,onPaneMouseMove:G,onPaneMouseLeave:j,onPaneContextMenu:U,onPaneScroll:F,paneClickDistance:K,deleteKeyCode:_,selectionKeyCode:E,selectionOnDrag:m,selectionMode:v,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:S,panActivationKeyCode:N,zoomActivationKeyCode:b,elementsSelectable:L,zoomOnScroll:$,zoomOnPinch:R,zoomOnDoubleClick:z,panOnScroll:D,panOnScrollSpeed:V,panOnScrollMode:H,panOnDrag:Y,autoPanOnSelection:B,defaultViewport:O,translateExtent:A,minZoom:I,maxZoom:w,onSelectionContextMenu:d,preventScrolling:k,noDragClassName:Ce,noWheelClassName:ft,noPanClassName:Re,disableKeyboardA11y:ze,onViewportChange:je,isControlledViewport:!!Ie,children:P.jsxs(Zp,{children:[P.jsx(Xp,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:ke,onReconnectStart:xe,onReconnectEnd:ve,onlyRenderVisibleElements:C,onEdgeContextMenu:q,onEdgeMouseEnter:J,onEdgeMouseMove:te,onEdgeMouseLeave:oe,reconnectRadius:se,defaultMarkerColor:M,noPanClassName:Re,disableKeyboardA11y:ze,rfId:Me}),P.jsx(e0,{style:x,type:g,component:y,containerStyle:p}),P.jsx("div",{className:"react-flow__edgelabel-renderer"}),P.jsx(Cp,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,nodeClickDistance:W,onlyRenderVisibleElements:C,noPanClassName:Re,noDragClassName:Ce,disableKeyboardA11y:ze,nodeExtent:de,rfId:Me,nodesDraggable:Tn}),P.jsx("div",{className:"react-flow__viewport-portal"})]})})}wa.displayName="GraphView";const o0=T.memo(wa),r0=ms(),ri=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f="basic"}={})=>{const h=new Map,g=new Map,x=new Map,y=new Map,p=o??t??[],E=n??e??[],m=u??[0,0],v=d??Nt;Cs(x,y,p);const{nodesInitialized:S}=po(E,h,g,{nodeOrigin:m,nodeExtent:v,zIndexMode:f});let N=[0,0,1];if(s&&r&&i){const b=Dt(h,{filter:O=>!!((O.width||O.initialWidth)&&(O.height||O.initialHeight))}),{x:_,y:C,zoom:L}=Po(b,r,i,l,c,a?.padding??.1);N=[_,C,L]}return{rfId:"1",width:r??0,height:i??0,transform:N,nodes:E,nodesInitialized:S,nodeLookup:h,parentLookup:g,edges:p,edgeLookup:y,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:Nt,nodeExtent:v,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ot.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:m,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...ls},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:r0,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:cs,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},i0=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>wg((h,g)=>{async function x(){const{nodeLookup:y,panZoom:p,fitViewOptions:E,fitViewResolver:m,width:v,height:S,minZoom:N,maxZoom:b}=g();p&&(await eh({nodes:y,width:v,height:S,panZoom:p,minZoom:N,maxZoom:b},E),m?.resolve(!0),h({fitViewResolver:null}))}return{...ri({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:o,zIndexMode:f}),setNodes:y=>{const{nodeLookup:p,parentLookup:E,nodeOrigin:m,elevateNodesOnSelect:v,fitViewQueued:S,zIndexMode:N,nodesSelectionActive:b}=g(),{nodesInitialized:_,hasSelectedNodes:C}=po(y,p,E,{nodeOrigin:m,nodeExtent:d,elevateNodesOnSelect:v,checkEquality:!0,zIndexMode:N}),L=b&&C;S&&_?(x(),h({nodes:y,nodesInitialized:_,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:L})):h({nodes:y,nodesInitialized:_,nodesSelectionActive:L})},setEdges:y=>{const{connectionLookup:p,edgeLookup:E}=g();Cs(p,E,y),h({edges:y})},setDefaultNodesAndEdges:(y,p)=>{if(y){const{setNodes:E}=g();E(y),h({hasDefaultNodes:!0})}if(p){const{setEdges:E}=g();E(p),h({hasDefaultEdges:!0})}},updateNodeInternals:y=>{const{triggerNodeChanges:p,nodeLookup:E,parentLookup:m,domNode:v,nodeOrigin:S,nodeExtent:N,debug:b,fitViewQueued:_,zIndexMode:C}=g(),{changes:L,updatedInternals:O}=_h(y,E,m,v,S,N,C);O&&(xh(E,m,{nodeOrigin:S,nodeExtent:N,zIndexMode:C}),_?(x(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),L?.length>0&&(b&&console.log("React Flow: trigger node changes",L),p?.(L)))},updateNodePositions:(y,p=!1)=>{const E=[];let m=[];const{nodeLookup:v,triggerNodeChanges:S,connection:N,updateConnection:b,onNodesChangeMiddlewareMap:_}=g();for(const[C,L]of y){const O=v.get(C),A=!!(O?.expandParent&&O?.parentId&&L?.position),I={id:C,type:"position",position:A?{x:Math.max(0,L.position.x),y:Math.max(0,L.position.y)}:L.position,dragging:p};if(O&&N.inProgress&&N.fromNode.id===O.id){const w=Ge(O,N.fromHandle,Z.Left,!0);b({...N,from:w})}A&&O.parentId&&E.push({id:C,parentId:O.parentId,rect:{...L.internals.positionAbsolute,width:L.measured.width??0,height:L.measured.height??0}}),m.push(I)}if(E.length>0){const{parentLookup:C,nodeOrigin:L}=g(),O=zo(E,v,C,L);m.push(...O)}for(const C of _.values())m=C(m);S(m)},triggerNodeChanges:y=>{const{onNodesChange:p,setNodes:E,nodes:m,hasDefaultNodes:v,debug:S}=g();if(y?.length){if(v){const N=Zs(y,m);E(N)}S&&console.log("React Flow: trigger node changes",y),p?.(y)}},triggerEdgeChanges:y=>{const{onEdgesChange:p,setEdges:E,edges:m,hasDefaultEdges:v,debug:S}=g();if(y?.length){if(v){const N=jg(y,m);E(N)}S&&console.log("React Flow: trigger edge changes",y),p?.(y)}},addSelectedNodes:y=>{const{multiSelectionActive:p,edgeLookup:E,nodeLookup:m,triggerNodeChanges:v,triggerEdgeChanges:S}=g();if(p){const N=y.map(b=>He(b,!0));v(N);return}v(Qe(m,new Set([...y]),!0)),S(Qe(E))},addSelectedEdges:y=>{const{multiSelectionActive:p,edgeLookup:E,nodeLookup:m,triggerNodeChanges:v,triggerEdgeChanges:S}=g();if(p){const N=y.map(b=>He(b,!0));S(N);return}S(Qe(E,new Set([...y]))),v(Qe(m,new Set,!0))},unselectNodesAndEdges:({nodes:y,edges:p}={})=>{const{edges:E,nodes:m,nodeLookup:v,triggerNodeChanges:S,triggerEdgeChanges:N}=g(),b=y||m,_=p||E,C=[];for(const O of b){if(!O.selected)continue;const A=v.get(O.id);A&&(A.selected=!1),C.push(He(O.id,!1))}const L=[];for(const O of _)O.selected&&L.push(He(O.id,!1));S(C),N(L)},setMinZoom:y=>{const{panZoom:p,maxZoom:E}=g();p?.setScaleExtent([y,E]),h({minZoom:y})},setMaxZoom:y=>{const{panZoom:p,minZoom:E}=g();p?.setScaleExtent([E,y]),h({maxZoom:y})},setTranslateExtent:y=>{g().panZoom?.setTranslateExtent(y),h({translateExtent:y})},resetSelectedElements:()=>{const{edges:y,nodes:p,triggerNodeChanges:E,triggerEdgeChanges:m,elementsSelectable:v}=g();if(!v)return;const S=p.reduce((b,_)=>_.selected?[...b,He(_.id,!1)]:b,[]),N=y.reduce((b,_)=>_.selected?[...b,He(_.id,!1)]:b,[]);E(S),m(N)},setNodeExtent:y=>{const{nodes:p,nodeLookup:E,parentLookup:m,nodeOrigin:v,elevateNodesOnSelect:S,nodeExtent:N,zIndexMode:b}=g();y[0][0]===N[0][0]&&y[0][1]===N[0][1]&&y[1][0]===N[1][0]&&y[1][1]===N[1][1]||(po(p,E,m,{nodeOrigin:v,nodeExtent:y,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:b}),h({nodeExtent:y}))},panBy:y=>{const{transform:p,width:E,height:m,panZoom:v,translateExtent:S}=g();return Nh({delta:y,panZoom:v,transform:p,translateExtent:S,width:E,height:m})},setCenter:async(y,p,E)=>{const{width:m,height:v,maxZoom:S,panZoom:N}=g();if(!N)return!1;const b=typeof E?.zoom<"u"?E.zoom:S;return await N.setViewport({x:m/2-y*b,y:v/2-p*b,zoom:b},{duration:E?.duration,ease:E?.ease,interpolate:E?.interpolate}),!0},cancelConnection:()=>{h({connection:{...ls}})},updateConnection:y=>{h({connection:y})},reset:()=>h({...ri()})}},Object.is);function s0({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:h}){const[g]=T.useState(()=>i0({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:c,minZoom:s,maxZoom:a,fitViewOptions:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return P.jsx(xg,{value:g,children:P.jsx(Yg,{children:P.jsx(ip,{children:h})})})}function a0({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h}){return T.useContext(In)?P.jsx(P.Fragment,{children:e}):P.jsx(s0,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:e})}const c0={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function l0({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:g,onConnectEnd:x,onClickConnectStart:y,onClickConnectEnd:p,onNodeMouseEnter:E,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:N,onNodeDragStart:b,onNodeDrag:_,onNodeDragStop:C,onNodesDelete:L,onEdgesDelete:O,onDelete:A,onSelectionChange:I,onSelectionDragStart:w,onSelectionDrag:k,onSelectionDragStop:M,onSelectionContextMenu:$,onSelectionStart:R,onSelectionEnd:D,onBeforeDelete:V,connectionMode:H,connectionLineType:z=De.Bezier,connectionLineStyle:Y,connectionLineComponent:B,connectionLineContainerStyle:X,deleteKeyCode:Q="Backspace",selectionKeyCode:G="Shift",selectionOnDrag:j=!1,selectionMode:F=St.Full,panActivationKeyCode:U="Space",multiSelectionKeyCode:K=Mt()?"Meta":"Control",zoomActivationKeyCode:W=Mt()?"Meta":"Control",snapToGrid:q,snapGrid:J,onlyRenderVisibleElements:te=!1,selectNodesOnDrag:oe,nodesDraggable:se,autoPanOnNodeFocus:ke,nodesConnectable:xe,nodesFocusable:ve,nodeOrigin:Ce=Ys,edgesFocusable:ft,edgesReconnectable:Re,elementsSelectable:ze=!0,defaultViewport:de=Ag,minZoom:Me=.5,maxZoom:Ie=2,translateExtent:je=Nt,preventScrolling:Tn=!0,nodeExtent:Dn,defaultMarkerColor:Qa="#b1b1b7",zoomOnScroll:Ja=!0,zoomOnPinch:ec=!0,panOnScroll:tc=!1,panOnScrollSpeed:nc=.5,panOnScrollMode:oc=Fe.Free,zoomOnDoubleClick:rc=!0,panOnDrag:ic=!0,onPaneClick:sc,onPaneMouseEnter:ac,onPaneMouseMove:cc,onPaneMouseLeave:lc,onPaneScroll:uc,onPaneContextMenu:dc,paneClickDistance:fc=1,nodeClickDistance:hc=0,children:gc,onReconnect:pc,onReconnectStart:mc,onReconnectEnd:yc,onEdgeContextMenu:wc,onEdgeDoubleClick:xc,onEdgeMouseEnter:vc,onEdgeMouseMove:bc,onEdgeMouseLeave:Ec,reconnectRadius:_c=10,onNodesChange:Nc,onEdgesChange:Sc,noDragClassName:kc="nodrag",noWheelClassName:Cc="nowheel",noPanClassName:Zo="nopan",fitView:Wo,fitViewOptions:Go,connectOnClick:Mc,attributionPosition:Ic,proOptions:Oc,defaultEdgeOptions:Pc,elevateNodesOnSelect:Ac=!0,elevateEdgesOnSelect:$c=!1,disableKeyboardA11y:qo=!1,autoPanOnConnect:Tc,autoPanOnNodeDrag:Dc,autoPanOnSelection:Lc=!0,autoPanSpeed:Rc,connectionRadius:zc,isValidConnection:jc,onError:Hc,style:Vc,id:Ko,nodeDragThreshold:Bc,connectionDragThreshold:Fc,viewport:Yc,onViewportChange:Xc,width:Zc,height:Wc,colorMode:Gc="light",debug:qc,onScroll:Uo,ariaLabelConfig:Kc,zIndexMode:Qo="basic",...Uc},Qc){const Ln=Ko||"1",Jc=Lg(Gc),el=T.useCallback(Jo=>{Jo.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Uo?.(Jo)},[Uo]);return P.jsx("div",{"data-testid":"rf__wrapper",...Uc,onScroll:el,style:{...Vc,...c0},ref:Qc,className:ie(["react-flow",r,Jc]),id:Ko,role:"application",children:P.jsxs(a0,{nodes:e,edges:t,width:Zc,height:Wc,fitView:Wo,fitViewOptions:Go,minZoom:Me,maxZoom:Ie,nodeOrigin:Ce,nodeExtent:Dn,zIndexMode:Qo,children:[P.jsx(Dg,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:h,onConnectStart:g,onConnectEnd:x,onClickConnectStart:y,onClickConnectEnd:p,nodesDraggable:se,autoPanOnNodeFocus:ke,nodesConnectable:xe,nodesFocusable:ve,edgesFocusable:ft,edgesReconnectable:Re,elementsSelectable:ze,elevateNodesOnSelect:Ac,elevateEdgesOnSelect:$c,minZoom:Me,maxZoom:Ie,nodeExtent:Dn,onNodesChange:Nc,onEdgesChange:Sc,snapToGrid:q,snapGrid:J,connectionMode:H,translateExtent:je,connectOnClick:Mc,defaultEdgeOptions:Pc,fitView:Wo,fitViewOptions:Go,onNodesDelete:L,onEdgesDelete:O,onDelete:A,onNodeDragStart:b,onNodeDrag:_,onNodeDragStop:C,onSelectionDrag:k,onSelectionDragStart:w,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:Zo,nodeOrigin:Ce,rfId:Ln,autoPanOnConnect:Tc,autoPanOnNodeDrag:Dc,autoPanSpeed:Rc,onError:Hc,connectionRadius:zc,isValidConnection:jc,selectNodesOnDrag:oe,nodeDragThreshold:Bc,connectionDragThreshold:Fc,onBeforeDelete:V,debug:qc,ariaLabelConfig:Kc,zIndexMode:Qo}),P.jsx(o0,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:E,onNodeMouseMove:m,onNodeMouseLeave:v,onNodeContextMenu:S,onNodeDoubleClick:N,nodeTypes:i,edgeTypes:s,connectionLineType:z,connectionLineStyle:Y,connectionLineComponent:B,connectionLineContainerStyle:X,selectionKeyCode:G,selectionOnDrag:j,selectionMode:F,deleteKeyCode:Q,multiSelectionKeyCode:K,panActivationKeyCode:U,zoomActivationKeyCode:W,onlyRenderVisibleElements:te,defaultViewport:de,translateExtent:je,minZoom:Me,maxZoom:Ie,preventScrolling:Tn,zoomOnScroll:Ja,zoomOnPinch:ec,zoomOnDoubleClick:rc,panOnScroll:tc,panOnScrollSpeed:nc,panOnScrollMode:oc,panOnDrag:ic,autoPanOnSelection:Lc,onPaneClick:sc,onPaneMouseEnter:ac,onPaneMouseMove:cc,onPaneMouseLeave:lc,onPaneScroll:uc,onPaneContextMenu:dc,paneClickDistance:fc,nodeClickDistance:hc,onSelectionContextMenu:$,onSelectionStart:R,onSelectionEnd:D,onReconnect:pc,onReconnectStart:mc,onReconnectEnd:yc,onEdgeContextMenu:wc,onEdgeDoubleClick:xc,onEdgeMouseEnter:vc,onEdgeMouseMove:bc,onEdgeMouseLeave:Ec,reconnectRadius:_c,defaultMarkerColor:Qa,noDragClassName:kc,noWheelClassName:Cc,noPanClassName:Zo,rfId:Ln,disableKeyboardA11y:qo,nodeExtent:Dn,viewport:Yc,onViewportChange:Xc,nodesDraggable:se}),P.jsx(Pg,{onSelectionChange:I}),gc,P.jsx(kg,{proOptions:Oc,position:Ic}),P.jsx(Sg,{rfId:Ln,disableKeyboardA11y:qo})]})})}var u0=Ws(l0);function d0(e){const[t,n]=T.useState(e),o=T.useCallback(r=>n(i=>Zs(r,i)),[]);return[t,n,o]}function f0({dimensions:e,lineWidth:t,variant:n,className:o}){return P.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ie(["react-flow__background-pattern",n,o])})}function h0({radius:e,className:t}){return P.jsx("circle",{cx:e,cy:e,r:e,className:ie(["react-flow__background-pattern","dots",t])})}var Le;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Le||(Le={}));const g0={[Le.Dots]:1,[Le.Lines]:1,[Le.Cross]:6},p0=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function xa({id:e,variant:t=Le.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:a,style:l,className:c,patternClassName:u}){const d=T.useRef(null),{transform:f,patternId:h}=ee(p0,re),g=o||g0[t],x=t===Le.Dots,y=t===Le.Cross,p=Array.isArray(n)?n:[n,n],E=[p[0]*f[2]||1,p[1]*f[2]||1],m=g*f[2],v=Array.isArray(i)?i:[i,i],S=y?[m,m]:E,N=[v[0]*f[2]||1+S[0]/2,v[1]*f[2]||1+S[1]/2],b=`${h}${e||""}`;return P.jsxs("svg",{className:ie(["react-flow__background",c]),style:{...l,...Pn,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:d,"data-testid":"rf__background",children:[P.jsx("pattern",{id:b,x:f[0]%E[0],y:f[1]%E[1],width:E[0],height:E[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:x?P.jsx(h0,{radius:m/2,className:u}):P.jsx(f0,{dimensions:S,lineWidth:r,variant:t,className:u})}),P.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${b})`})]})}xa.displayName="Background";T.memo(xa);function m0(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:P.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function y0(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:P.jsx("path",{d:"M0 0h32v4.2H0z"})})}function w0(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:P.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function x0(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:P.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function v0(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:P.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Gt({children:e,className:t,...n}){return P.jsx("button",{type:"button",className:ie(["react-flow__controls-button",t]),...n,children:e})}const b0=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function va({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:c,children:u,position:d="bottom-left",orientation:f="vertical","aria-label":h}){const g=ne(),{isInteractive:x,minZoomReached:y,maxZoomReached:p,ariaLabelConfig:E}=ee(b0,re),{zoomIn:m,zoomOut:v,fitView:S}=jo(),N=()=>{m(),i?.()},b=()=>{v(),s?.()},_=()=>{S(r),a?.()},C=()=>{g.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),l?.(!x)},L=f==="horizontal"?"horizontal":"vertical";return P.jsxs(On,{className:ie(["react-flow__controls",L,c]),position:d,style:e,"data-testid":"rf__controls","aria-label":h??E["controls.ariaLabel"],children:[t&&P.jsxs(P.Fragment,{children:[P.jsx(Gt,{onClick:N,className:"react-flow__controls-zoomin",title:E["controls.zoomIn.ariaLabel"],"aria-label":E["controls.zoomIn.ariaLabel"],disabled:p,children:P.jsx(m0,{})}),P.jsx(Gt,{onClick:b,className:"react-flow__controls-zoomout",title:E["controls.zoomOut.ariaLabel"],"aria-label":E["controls.zoomOut.ariaLabel"],disabled:y,children:P.jsx(y0,{})})]}),n&&P.jsx(Gt,{className:"react-flow__controls-fitview",onClick:_,title:E["controls.fitView.ariaLabel"],"aria-label":E["controls.fitView.ariaLabel"],children:P.jsx(w0,{})}),o&&P.jsx(Gt,{className:"react-flow__controls-interactive",onClick:C,title:E["controls.interactive.ariaLabel"],"aria-label":E["controls.interactive.ariaLabel"],children:x?P.jsx(v0,{}):P.jsx(x0,{})}),u]})}va.displayName="Controls";const E0=T.memo(va);function _0({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:l,className:c,borderRadius:u,shapeRendering:d,selected:f,onClick:h}){const{background:g,backgroundColor:x}=i||{},y=s||g||x;return P.jsx("rect",{className:ie(["react-flow__minimap-node",{selected:f},c]),x:t,y:n,rx:u,ry:u,width:o,height:r,style:{fill:y,stroke:a,strokeWidth:l},shapeRendering:d,onClick:h?p=>h(p,e):void 0})}const N0=T.memo(_0),S0=e=>e.nodes.map(t=>t.id),Zn=e=>e instanceof Function?e:()=>e;function k0({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=N0,onClick:s}){const a=ee(S0,re),l=Zn(t),c=Zn(e),u=Zn(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return P.jsx(P.Fragment,{children:a.map(f=>P.jsx(M0,{id:f,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:d},f))})}function C0({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:l}){const{node:c,x:u,y:d,width:f,height:h}=ee(g=>{const x=g.nodeLookup.get(e);if(!x)return{node:void 0,x:0,y:0,width:0,height:0};const y=x.internals.userNode,{x:p,y:E}=x.internals.positionAbsolute,{width:m,height:v}=Se(y);return{node:y,x:p,y:E,width:m,height:v}},re);return!c||c.hidden||!ys(c)?null:P.jsx(a,{x:u,y:d,width:f,height:h,style:c.style,selected:!!c.selected,className:o(c),color:t(c),borderRadius:r,strokeColor:n(c),strokeWidth:i,shapeRendering:s,onClick:l,id:c.id})}const M0=T.memo(C0);var I0=T.memo(k0);const O0=200,P0=150,A0=e=>!e.hidden,$0=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?gs(Dt(e.nodeLookup,{filter:A0}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},ii=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,T0=(e,t)=>ii(e.viewBB,t.viewBB)&&ii(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,D0="react-flow__minimap-desc";function ba({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:u,maskStrokeWidth:d,position:f="bottom-right",onClick:h,onNodeClick:g,pannable:x=!1,zoomable:y=!1,ariaLabel:p,inversePan:E,zoomStep:m=1,offsetScale:v=5}){const S=ne(),N=T.useRef(null),{boundingRect:b,viewBB:_,rfId:C,panZoom:L,translateExtent:O,flowWidth:A,flowHeight:I,ariaLabelConfig:w}=ee($0,T0),k=e?.width??O0,M=e?.height??P0,$=b.width/k,R=b.height/M,D=Math.max($,R),V=D*k,H=D*M,z=v*D,Y=b.x-(V-b.width)/2-z,B=b.y-(H-b.height)/2-z,X=V+z*2,Q=H+z*2,G=`${D0}-${C}`,j=T.useRef(0),F=T.useRef();j.current=D,T.useEffect(()=>{if(N.current&&L)return F.current=$h({domNode:N.current,panZoom:L,getTransform:()=>S.getState().transform,getViewScale:()=>j.current}),()=>{F.current?.destroy()}},[L]),T.useEffect(()=>{F.current?.update({translateExtent:O,width:A,height:I,inversePan:E,pannable:x,zoomStep:m,zoomable:y})},[x,y,E,m,O,A,I]);const U=h?q=>{const[J,te]=F.current?.pointer(q)||[0,0];h(q,{x:J,y:te})}:void 0,K=g?T.useCallback((q,J)=>{const te=S.getState().nodeLookup.get(J).internals.userNode;g(q,te)},[]):void 0,W=p??w["minimap.ariaLabel"];return P.jsx(On,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*D:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:ie(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:P.jsxs("svg",{width:k,height:M,viewBox:`${Y} ${B} ${X} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":G,ref:N,onClick:U,children:[W&&P.jsx("title",{id:G,children:W}),P.jsx(I0,{onClick:K,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:a}),P.jsx("path",{className:"react-flow__minimap-mask",d:`M${Y-z},${B-z}h${X+z*2}v${Q+z*2}h${-X-z*2}z
23
+ M${_.x},${_.y}h${_.width}v${_.height}h${-_.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ba.displayName="MiniMap";T.memo(ba);const L0=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,R0={[st.Line]:"right",[st.Handle]:"bottom-right"};function z0({nodeId:e,position:t,variant:n=st.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:h=!0,shouldResize:g,onResizeStart:x,onResize:y,onResizeEnd:p}){const E=Qs(),m=typeof e=="string"?e:E,v=ne(),S=T.useRef(null),N=n===st.Handle,b=ee(T.useCallback(L0(N&&h),[N,h]),re),_=T.useRef(null),C=t??R0[n];T.useEffect(()=>{if(!(!S.current||!m))return _.current||(_.current=Zh({domNode:S.current,nodeId:m,getStoreItems:()=>{const{nodeLookup:O,transform:A,snapGrid:I,snapToGrid:w,nodeOrigin:k,domNode:M}=v.getState();return{nodeLookup:O,transform:A,snapGrid:I,snapToGrid:w,nodeOrigin:k,paneDomNode:M}},onChange:(O,A)=>{const{triggerNodeChanges:I,nodeLookup:w,parentLookup:k,nodeOrigin:M}=v.getState(),$=[],R={x:O.x,y:O.y},D=w.get(m);if(D&&D.expandParent&&D.parentId){const V=D.origin??M,H=O.width??D.measured.width??0,z=O.height??D.measured.height??0,Y={id:D.id,parentId:D.parentId,rect:{width:H,height:z,...ws({x:O.x??D.position.x,y:O.y??D.position.y},{width:H,height:z},D.parentId,w,V)}},B=zo([Y],w,k,M);$.push(...B),R.x=O.x?Math.max(V[0]*H,O.x):void 0,R.y=O.y?Math.max(V[1]*z,O.y):void 0}if(R.x!==void 0&&R.y!==void 0){const V={id:m,type:"position",position:{...R}};$.push(V)}if(O.width!==void 0&&O.height!==void 0){const H={id:m,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:O.width,height:O.height}};$.push(H)}for(const V of A){const H={...V,type:"position"};$.push(H)}I($)},onEnd:({width:O,height:A})=>{const I={id:m,type:"dimensions",resizing:!1,dimensions:{width:O,height:A}};v.getState().triggerNodeChanges([I])}})),_.current.update({controlPosition:C,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:x,onResize:y,onResizeEnd:p,shouldResize:g}),()=>{_.current?.destroy()}},[C,a,l,c,u,d,x,y,p,g]);const L=C.split("-");return P.jsx("div",{className:ie(["react-flow__resize-control","nodrag",...L,n,o]),ref:S,style:{...r,scale:b,...s&&{[N?"backgroundColor":"borderColor"]:s}},children:i})}T.memo(z0);var Ea=Object.defineProperty,j0=(e,t,n)=>t in e?Ea(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,H0=(e,t)=>{for(var n in t)Ea(e,n,{get:t[n],enumerable:!0})},V0=(e,t,n)=>j0(e,t+"",n),_a={};H0(_a,{Graph:()=>ue,alg:()=>Vo,json:()=>Sa,version:()=>Y0});var B0=Object.defineProperty,Na=(e,t)=>{for(var n in t)B0(e,n,{get:t[n],enumerable:!0})},ue=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(n=>{t!==void 0?this.setNode(n,t):this.setNode(n)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(n=>{this.setParent(n)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let o of this.successors(e))n.add(o);return Array.from(n.values())}}isLeaf(e){let t;return this.isDirected()?t=this.successors(e):t=this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([r,i])=>{e(r)&&t.setNode(r,i)}),Object.values(this._edgeObjs).forEach(r=>{t.hasNode(r.v)&&t.hasNode(r.w)&&t.setEdge(r,this.edge(r))});let n={},o=r=>{let i=this.parent(r);return!i||t.hasNode(i)?(n[r]=i??void 0,i??void 0):i in n?n[i]:o(i)};return this._isCompound&&t.nodes().forEach(r=>t.setParent(r,o(r))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((n,o)=>(t!==void 0?this.setEdge(n,o,t):this.setEdge(n,o),o)),this}setEdge(e,t,n,o){let r,i,s,a,l=!1;typeof e=="object"&&e!==null&&"v"in e?(r=e.v,i=e.w,s=e.name,arguments.length===2&&(a=t,l=!0)):(r=e,i=t,s=o,arguments.length>2&&(a=n,l=!0)),r=""+r,i=""+i,s!==void 0&&(s=""+s);let c=yt(this._isDirected,r,i,s);if(c in this._edgeLabels)return l&&(this._edgeLabels[c]=a),this;if(s!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(r),this.setNode(i),this._edgeLabels[c]=l?a:this._defaultEdgeLabelFn(r,i,s);let u=F0(this._isDirected,r,i,s);return r=u.v,i=u.w,Object.freeze(u),this._edgeObjs[c]=u,si(this._preds[i],r),si(this._sucs[r],i),this._in[i][c]=u,this._out[r][c]=u,this._edgeCount++,this}edge(e,t,n){let o=arguments.length===1?Wn(this._isDirected,e):yt(this._isDirected,e,t,n);return this._edgeLabels[o]}edgeAsObj(e,t,n){let o=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof o!="object"?{label:o}:o}hasEdge(e,t,n){return(arguments.length===1?Wn(this._isDirected,e):yt(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let o=arguments.length===1?Wn(this._isDirected,e):yt(this._isDirected,e,t,n),r=this._edgeObjs[o];if(r){let i=r.v,s=r.w;delete this._edgeLabels[o],delete this._edgeObjs[o],ai(this._preds[s],i),ai(this._sucs[i],s),delete this._in[s][o],delete this._out[i][o],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let o=Object.values(e);return n?o.filter(r=>r.v===t&&r.w===n||r.v===n&&r.w===t):o}};function si(e,t){e[t]?e[t]++:e[t]=1}function ai(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function yt(e,t,n,o){let r=""+t,i=""+n;if(!e&&r>i){let s=r;r=i,i=s}return r+""+i+""+(o===void 0?"\0":o)}function F0(e,t,n,o){let r=""+t,i=""+n;if(!e&&r>i){let a=r;r=i,i=a}let s={v:r,w:i};return o&&(s.name=o),s}function Wn(e,t){return yt(e,t.v,t.w,t.name)}var Y0="4.0.1",Sa={};Na(Sa,{read:()=>G0,write:()=>X0});function X0(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Z0(e),edges:W0(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Z0(e){return e.nodes().map(t=>{let n=e.node(t),o=e.parent(t),r={v:t};return n!==void 0&&(r.value=n),o!==void 0&&(r.parent=o),r})}function W0(e){return e.edges().map(t=>{let n=e.edge(t),o={v:t.v,w:t.w};return t.name!==void 0&&(o.name=t.name),n!==void 0&&(o.value=n),o})}function G0(e){let t=new ue(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var Vo={};Na(Vo,{CycleException:()=>yn,bellmanFord:()=>ka,components:()=>U0,dijkstra:()=>mn,dijkstraAll:()=>em,findCycles:()=>tm,floydWarshall:()=>om,isAcyclic:()=>im,postorder:()=>am,preorder:()=>cm,prim:()=>lm,shortestPaths:()=>um,tarjan:()=>Ma,topsort:()=>Ia});var q0=()=>1;function ka(e,t,n,o){return K0(e,String(t),n||q0,o||function(r){return e.outEdges(r)})}function K0(e,t,n,o){let r={},i,s=0,a=e.nodes(),l=function(d){let f=n(d);r[d.v].distance+f<r[d.w].distance&&(r[d.w]={distance:r[d.v].distance+f,predecessor:d.v},i=!0)},c=function(){a.forEach(function(d){o(d).forEach(function(f){let h=f.v===d?f.v:f.w,g=h===f.v?f.w:f.v;l({v:h,w:g})})})};a.forEach(function(d){let f=d===t?0:Number.POSITIVE_INFINITY;r[d]={distance:f,predecessor:""}});let u=a.length;for(let d=1;d<u&&(i=!1,s++,c(),!!i);d++);if(s===u-1&&(i=!1,c(),i))throw new Error("The graph contains a negative weight cycle");return r}function U0(e){let t={},n=[],o;function r(i){i in t||(t[i]=!0,o.push(i),e.successors(i).forEach(r),e.predecessors(i).forEach(r))}return e.nodes().forEach(function(i){o=[],r(i),o.length&&n.push(o)}),n}var Ca=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,o=String(e);if(!(o in n)){let r=this._arr,i=r.length;return n[o]=i,r.push({key:o,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let o=this._arr[n].priority;if(t>o)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${o} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,o=n+1,r=e;n<t.length&&(r=t[n].priority<t[r].priority?n:r,o<t.length&&(r=t[o].priority<t[r].priority?o:r),r!==e&&(this._swap(e,r),this._heapify(r)))}_decrease(e){let t=this._arr,n=t[e].priority,o;for(;e!==0&&(o=e>>1,!(t[o].priority<n));)this._swap(e,o),e=o}_swap(e,t){let n=this._arr,o=this._keyIndices,r=n[e],i=n[t];n[e]=i,n[t]=r,o[i.key]=e,o[r.key]=t}},Q0=()=>1;function mn(e,t,n,o){let r=function(i){return e.outEdges(i)};return J0(e,String(t),n||Q0,o||r)}function J0(e,t,n,o){let r={},i=new Ca,s,a,l=function(c){let u=c.v!==s?c.v:c.w,d=r[u],f=n(c),h=a.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+c+" Weight: "+f);h<d.distance&&(d.distance=h,d.predecessor=s,i.decrease(u,h))};for(e.nodes().forEach(function(c){let u=c===t?0:Number.POSITIVE_INFINITY;r[c]={distance:u,predecessor:""},i.add(c,u)});i.size()>0&&(s=i.removeMin(),a=r[s],a.distance!==Number.POSITIVE_INFINITY);)o(s).forEach(l);return r}function em(e,t,n){return e.nodes().reduce(function(o,r){return o[r]=mn(e,r,t,n),o},{})}function Ma(e){let t=0,n=[],o={},r=[];function i(s){let a=o[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),e.successors(s).forEach(function(l){l in o?o[l].onStack&&(a.lowlink=Math.min(a.lowlink,o[l].index)):(i(l),a.lowlink=Math.min(a.lowlink,o[l].lowlink))}),a.lowlink===a.index){let l=[],c;do c=n.pop(),o[c].onStack=!1,l.push(c);while(s!==c);r.push(l)}}return e.nodes().forEach(function(s){s in o||i(s)}),r}function tm(e){return Ma(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var nm=()=>1;function om(e,t,n){return rm(e,t||nm,n||function(o){return e.outEdges(o)})}function rm(e,t,n){let o={},r=e.nodes();return r.forEach(function(i){o[i]={},o[i][i]={distance:0,predecessor:""},r.forEach(function(s){i!==s&&(o[i][s]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(i).forEach(function(s){let a=s.v===i?s.w:s.v,l=t(s);o[i][a]={distance:l,predecessor:i}})}),r.forEach(function(i){let s=o[i];r.forEach(function(a){let l=o[a];r.forEach(function(c){let u=l[i],d=s[c],f=l[c],h=u.distance+d.distance;h<f.distance&&(f.distance=h,f.predecessor=d.predecessor)})})}),o}var yn=class extends Error{constructor(...e){super(...e)}};function Ia(e){let t={},n={},o=[];function r(i){if(i in n)throw new yn;i in t||(n[i]=!0,t[i]=!0,e.predecessors(i).forEach(r),delete n[i],o.push(i))}if(e.sinks().forEach(r),Object.keys(t).length!==e.nodeCount())throw new yn;return o}function im(e){try{Ia(e)}catch(t){if(t instanceof yn)return!1;throw t}return!0}function sm(e,t,n,o,r){Array.isArray(t)||(t=[t]);let i=a=>{var l;return(l=e.isDirected()?e.successors(a):e.neighbors(a))!=null?l:[]},s={};return t.forEach(function(a){if(!e.hasNode(a))throw new Error("Graph does not have node: "+a);r=Oa(e,a,n==="post",s,i,o,r)}),r}function Oa(e,t,n,o,r,i,s){return t in o||(o[t]=!0,n||(s=i(s,t)),r(t).forEach(function(a){s=Oa(e,a,n,o,r,i,s)}),n&&(s=i(s,t))),s}function Pa(e,t,n){return sm(e,t,n,function(o,r){return o.push(r),o},[])}function am(e,t){return Pa(e,t,"post")}function cm(e,t){return Pa(e,t,"pre")}function lm(e,t){let n=new ue,o={},r=new Ca,i;function s(l){let c=l.v===i?l.w:l.v,u=r.priority(c);if(u!==void 0){let d=t(l);d<u&&(o[c]=i,r.decrease(c,d))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(l){r.add(l,Number.POSITIVE_INFINITY),n.setNode(l)}),r.decrease(e.nodes()[0],0);let a=!1;for(;r.size()>0;){if(i=r.removeMin(),i in o)n.setEdge(i,o[i]);else{if(a)throw new Error("Input graph is not connected: "+e);a=!0}e.nodeEdges(i).forEach(s)}return n}function um(e,t,n,o){return dm(e,t,n,o??(r=>{let i=e.outEdges(r);return i??[]}))}function dm(e,t,n,o){if(n===void 0)return mn(e,t,n,o);let r=!1,i=e.nodes();for(let s=0;s<i.length;s++){let a=o(i[s]);for(let l=0;l<a.length;l++){let c=a[l],u=c.v===i[s]?c.v:c.w,d=u===c.v?c.w:c.v;n({v:u,w:d})<0&&(r=!0)}if(r)return ka(e,t,n,o)}return mn(e,t,n,o)}function dt(e,t,n,o){let r=o;for(;e.hasNode(r);)r=Bo(o);return n.dummy=t,e.setNode(r,n),r}function fm(e){let t=new ue().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let o=t.edge(n.v,n.w)||{weight:0,minlen:1},r=e.edge(n);t.setEdge(n.v,n.w,{weight:o.weight+r.weight,minlen:Math.max(o.minlen,r.minlen)})}),t}function Aa(e){let t=new ue({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function ci(e,t){let n=e.x,o=e.y,r=t.x-n,i=t.y-o,s=e.width/2,a=e.height/2;if(!r&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let l,c;return Math.abs(i)*s>Math.abs(r)*a?(i<0&&(a=-a),l=a*r/i,c=a):(r<0&&(s=-s),l=s,c=s*i/r),{x:n+l,y:o+c}}function zt(e){let t=Ot(Ta(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let o=e.node(n),r=o.rank;r!==void 0&&(t[r]||(t[r]=[]),t[r][o.order]=n)}),t}function hm(e){let t=e.nodes().map(o=>{let r=e.node(o).rank;return r===void 0?Number.MAX_VALUE:r}),n=Ee(Math.min,t);e.nodes().forEach(o=>{let r=e.node(o);Object.hasOwn(r,"rank")&&(r.rank-=n)})}function gm(e){let t=e.nodes().map(s=>e.node(s).rank).filter(s=>s!==void 0),n=Ee(Math.min,t),o=[];e.nodes().forEach(s=>{let a=e.node(s).rank-n;o[a]||(o[a]=[]),o[a].push(s)});let r=0,i=e.graph().nodeRankFactor;Array.from(o).forEach((s,a)=>{s===void 0&&a%i!==0?--r:s!==void 0&&r&&s.forEach(l=>e.node(l).rank+=r)})}function li(e,t,n,o){let r={width:0,height:0};return arguments.length>=4&&(r.rank=n,r.order=o),dt(e,"border",r,t)}function pm(e,t=$a){let n=[];for(let o=0;o<e.length;o+=t){let r=e.slice(o,o+t);n.push(r)}return n}var $a=65535;function Ee(e,t){if(t.length>$a){let n=pm(t);return e(...n.map(o=>e(...o)))}else return e(...t)}function Ta(e){let t=e.nodes().map(n=>{let o=e.node(n).rank;return o===void 0?Number.MIN_VALUE:o});return Ee(Math.max,t)}function mm(e,t){let n={lhs:[],rhs:[]};return e.forEach(o=>{t(o)?n.lhs.push(o):n.rhs.push(o)}),n}function ym(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function Da(e,t){return t()}var wm=0;function Bo(e){let t=++wm;return e+(""+t)}function Ot(e,t,n=1){t==null&&(t=e,e=0);let o=i=>i<t;n<0&&(o=i=>t<i);let r=[];for(let i=e;o(i);i+=n)r.push(i);return r}function wn(e,t){let n={};for(let o of t)e[o]!==void 0&&(n[o]=e[o]);return n}function An(e,t){let n;return typeof t=="string"?n=o=>o[t]:n=t,Object.entries(e).reduce((o,[r,i])=>(o[r]=n(i,r),o),{})}function xm(e,t){return e.reduce((n,o,r)=>(n[o]=t[r],n),{})}var $n="\0";function La(e,t,n){var o,r,i,s,a,l;if(!(e&&t&&n&&t.dummy==="edge"&&n.dummy==="edge"&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let c=!0;t.edgeObj.w===n.edgeObj.w&&(c=!1);let u=c?(r=(o=e[t.edgeObj.v])==null?void 0:o.rank)!=null?r:NaN+1:(s=(i=e[t.edgeObj.w])==null?void 0:i.rank)!=null?s:NaN-1,d=Object.entries(e).find(x=>{var y,p;return((y=x[1].edgeObj)==null?void 0:y.v)===t.edgeObj.v&&((p=x[1].edgeObj)==null?void 0:p.w)===t.edgeObj.w&&x[1].rank===u}),f=Object.entries(e).find(x=>{var y,p;return((y=x[1].edgeObj)==null?void 0:y.v)===n.edgeObj.v&&((p=x[1].edgeObj)==null?void 0:p.w)===n.edgeObj.w&&x[1].rank===u});if(!d||!f)return 0;let h=(a=d[1].order)!=null?a:NaN,g=(l=f[1].order)!=null?l:NaN;return isNaN(h-g)?0:h-g}var vm="3.1.0",bm=class{constructor(){V0(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return ui(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&ui(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,Em)),n=n._prev;return"["+e.join(", ")+"]"}};function ui(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Em(e,t){if(e!=="_next"&&e!=="_prev")return t}var _m=bm,Nm=()=>1;function Sm(e,t){if(e.nodeCount()<=1)return[];let n=Cm(e,t||Nm);return km(n.graph,n.buckets,n.zeroIdx).flatMap(o=>e.outEdges(o.v,o.w)||[])}function km(e,t,n){var o;let r=[],i=t[t.length-1],s=t[0],a;for(;e.nodeCount();){for(;a=s.dequeue();)Gn(e,t,n,a);for(;a=i.dequeue();)Gn(e,t,n,a);if(e.nodeCount()){for(let l=t.length-2;l>0;--l)if(a=(o=t[l])==null?void 0:o.dequeue(),a){r=r.concat(Gn(e,t,n,a,!0)||[]);break}}}return r}function Gn(e,t,n,o,r){let i=[],s=r?i:void 0;return(e.inEdges(o.v)||[]).forEach(a=>{let l=e.edge(a),c=e.node(a.v);r&&i.push({v:a.v,w:a.w}),c.out-=l,wo(t,n,c)}),(e.outEdges(o.v)||[]).forEach(a=>{let l=e.edge(a),c=a.w,u=e.node(c);u.in-=l,wo(t,n,u)}),e.removeNode(o.v),s}function Cm(e,t){let n=new ue,o=0,r=0;e.nodes().forEach(a=>{n.setNode(a,{v:a,in:0,out:0})}),e.edges().forEach(a=>{let l=n.edge(a.v,a.w)||0,c=t(a),u=l+c;n.setEdge(a.v,a.w,u);let d=n.node(a.v),f=n.node(a.w);r=Math.max(r,d.out+=c),o=Math.max(o,f.in+=c)});let i=Mm(r+o+3).map(()=>new _m),s=o+1;return n.nodes().forEach(a=>{wo(i,s,n.node(a))}),{graph:n,buckets:i,zeroIdx:s}}function wo(e,t,n){var o,r,i;n.out?n.in?(i=e[n.out-n.in+t])==null||i.enqueue(n):(r=e[e.length-1])==null||r.enqueue(n):(o=e[0])==null||o.enqueue(n)}function Mm(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function Im(e,t){(e.graph().acyclicer==="greedy"?Sm(e,n(e)):Om(e,t??null)).forEach(o=>{let r=e.edge(o);e.removeEdge(o),r.forwardName=o.name,r.reversed=!0,e.setEdge(o.w,o.v,r,Bo("rev"))});function n(o){return r=>o.edge(r).weight}}function Om(e,t){let n=[],o={},r={};function i(l){Object.hasOwn(r,l)||(r[l]=!0,o[l]=!0,e.outEdges(l).forEach(c=>{Object.hasOwn(o,c.w)?n.push(c):i(c.w)}),delete o[l])}function s(l){var c;Object.hasOwn(r,l)||(r[l]=!0,o[l]=!0,(c=e.outEdges(l))==null||c.forEach(u=>{var d,f;Object.hasOwn(o,u.w)||((d=t.node(l))==null?void 0:d.rank)>((f=t.node(u.w))==null?void 0:f.rank)&&Am(e,u.w,u)?n.push(u):s(u.w)}),delete o[l])}let a=i;return t&&typeof t.node=="function"&&(a=s),e.sources().forEach(a),e.nodes().forEach(a),n}function Pm(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let o=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,o)}})}function Am(e,t,n){let o=new Set;function r(i){var s;if(e.sources().includes(i))return!0;o.add(i);for(let a of(s=e.inEdges(i))!=null?s:[])if(!(a.v===n.v&&a.w===n.w)&&!o.has(a.v)&&r(a.v))return!0;return!1}return r(t)}function $m(e){e.graph().dummyChains=[],e.edges().forEach(t=>Tm(e,t))}function Tm(e,t){let n=t.v,o=e.node(n).rank,r=t.w,i=e.node(r).rank,s=t.name,a=e.edge(t),l=a.labelRank;if(i===o+1)return;e.removeEdge(t);let c,u,d;for(d=0,++o;o<i;++d,++o)a.points=[],u={width:0,height:0,edgeLabel:a,edgeObj:t,rank:o},c=dt(e,"edge",u,"_d"),o===l&&(u.width=a.width,u.height=a.height,u.dummy="edge-label",u.labelpos=a.labelpos),e.setEdge(n,c,{weight:a.weight},s),d===0&&e.graph().dummyChains.push(c),n=c;e.setEdge(n,r,{weight:a.weight},s)}function Dm(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),o=n.edgeLabel,r;for(e.setEdge(n.edgeObj,o);n.dummy;)r=e.successors(t)[0],e.removeNode(t),o.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),t=r,n=e.node(t)})}function Fo(e){let t={};function n(o){let r=e.node(o);if(Object.hasOwn(t,o))return r.rank;t[o]=!0;let i=e.outEdges(o),s=i?i.map(l=>l==null?Number.POSITIVE_INFINITY:n(l.w)-e.edge(l).minlen):[],a=Ee(Math.min,s);return a===Number.POSITIVE_INFINITY&&(a=0),r.rank=a}e.sources().forEach(n)}function ut(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Ra=Lm;function Lm(e){let t=new ue({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let o=n[0],r=e.nodeCount();t.setNode(o,{});let i,s;for(;Rm(t,e)<r&&(i=zm(t,e),!!i);)s=t.hasNode(i.v)?ut(e,i):-ut(e,i),jm(t,e,s);return t}function Rm(e,t){function n(o){let r=t.nodeEdges(o);r&&r.forEach(i=>{let s=i.v,a=o===s?i.w:s;!e.hasNode(a)&&!ut(t,i)&&(e.setNode(a,{}),e.setEdge(o,a,{}),n(a))})}return e.nodes().forEach(n),e.nodeCount()}function zm(e,t){return t.edges().reduce((n,o)=>{let r=Number.POSITIVE_INFINITY;return e.hasNode(o.v)!==e.hasNode(o.w)&&(r=ut(t,o)),r<n[0]?[r,o]:n},[Number.POSITIVE_INFINITY,null])[1]}function jm(e,t,n){e.nodes().forEach(o=>t.node(o).rank+=n)}var{preorder:Hm,postorder:Vm}=Vo,Bm=qe;qe.initLowLimValues=Xo;qe.initCutValues=Yo;qe.calcCutValue=za;qe.leaveEdge=Ha;qe.enterEdge=Va;qe.exchangeEdges=Ba;function qe(e){e=fm(e),Fo(e);let t=Ra(e);Xo(t),Yo(t,e);let n,o;for(;n=Ha(t);)o=Va(t,e,n),Ba(t,e,n,o)}function Yo(e,t){let n=Vm(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(o=>Fm(e,t,o))}function Fm(e,t,n){let o=e.node(n).parent,r=e.edge(n,o);r.cutvalue=za(e,t,n)}function za(e,t,n){let o=e.node(n).parent,r=!0,i=t.edge(n,o),s=0;i||(r=!1,i=t.edge(o,n)),s=i.weight;let a=t.nodeEdges(n);return a&&a.forEach(l=>{let c=l.v===n,u=c?l.w:l.v;if(u!==o){let d=c===r,f=t.edge(l).weight;if(s+=d?f:-f,Xm(e,n,u)){let h=e.edge(n,u).cutvalue;s+=d?-h:h}}}),s}function Xo(e,t){arguments.length<2&&(t=e.nodes()[0]),ja(e,{},1,t)}function ja(e,t,n,o,r){let i=n,s=e.node(o);t[o]=!0;let a=e.neighbors(o);return a&&a.forEach(l=>{Object.hasOwn(t,l)||(n=ja(e,t,n,l,o))}),s.low=i,s.lim=n++,r?s.parent=r:delete s.parent,n}function Ha(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function Va(e,t,n){let o=n.v,r=n.w;t.hasEdge(o,r)||(o=n.w,r=n.v);let i=e.node(o),s=e.node(r),a=i,l=!1;return i.lim>s.lim&&(a=s,l=!0),t.edges().filter(c=>l===di(e,e.node(c.v),a)&&l!==di(e,e.node(c.w),a)).reduce((c,u)=>ut(t,u)<ut(t,c)?u:c)}function Ba(e,t,n,o){let r=n.v,i=n.w;e.removeEdge(r,i),e.setEdge(o.v,o.w,{}),Xo(e),Yo(e,t),Ym(e,t)}function Ym(e,t){let n=e.nodes().find(r=>!e.node(r).parent);if(!n)return;let o=Hm(e,[n]);o=o.slice(1),o.forEach(r=>{let i=e.node(r).parent,s=t.edge(r,i),a=!1;s||(s=t.edge(i,r),a=!0),t.node(r).rank=t.node(i).rank+(a?s.minlen:-s.minlen)})}function Xm(e,t,n){return e.hasEdge(t,n)}function di(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Zm=Wm;function Wm(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":fi(e);break;case"tight-tree":qm(e);break;case"longest-path":Gm(e);break;case"none":break;default:fi(e)}}var Gm=Fo;function qm(e){Fo(e),Ra(e)}function fi(e){Bm(e)}var Km=Um;function Um(e){let t=Jm(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(o=>{let r=e.node(o),i=r.edgeObj,s=Qm(e,t,i.v,i.w),a=s.path,l=s.lca,c=0,u=a[c],d=!0;for(;o!==i.w;){if(r=e.node(o),d){for(;(u=a[c])!==l&&e.node(u).maxRank<r.rank;)c++;u===l&&(d=!1)}if(!d){for(;c<a.length-1&&e.node(a[c+1]).minRank<=r.rank;)c++;u=a[c]}u!==void 0&&e.setParent(o,u),o=e.successors(o)[0]}})}function Qm(e,t,n,o){let r=[],i=[],s=Math.min(t[n].low,t[o].low),a=Math.max(t[n].lim,t[o].lim),l;l=n;do l=e.parent(l),r.push(l);while(l&&(t[l].low>s||a>t[l].lim));let c=l,u=o;for(;(u=e.parent(u))!==c;)i.push(u);return{path:r.concat(i.reverse()),lca:c}}function Jm(e){let t={},n=0;function o(r){let i=n;e.children(r).forEach(o),t[r]={low:i,lim:n++}}return e.children($n).forEach(o),t}function ey(e){let t=dt(e,"root",{},"_root"),n=ty(e),o=Object.values(n),r=Ee(Math.max,o)-1,i=2*r+1;e.graph().nestingRoot=t,e.edges().forEach(a=>e.edge(a).minlen*=i);let s=ny(e)+1;e.children($n).forEach(a=>{Fa(e,t,i,s,r,n,a)}),e.graph().nodeRankFactor=i}function Fa(e,t,n,o,r,i,s){var a;let l=e.children(s);if(!l.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:n});return}let c=li(e,"_bt"),u=li(e,"_bb"),d=e.node(s);e.setParent(c,s),d.borderTop=c,e.setParent(u,s),d.borderBottom=u,l.forEach(f=>{var h;Fa(e,t,n,o,r,i,f);let g=e.node(f),x=g.borderTop?g.borderTop:f,y=g.borderBottom?g.borderBottom:f,p=g.borderTop?o:2*o,E=x!==y?1:r-((h=i[s])!=null?h:0)+1;e.setEdge(c,x,{weight:p,minlen:E,nestingEdge:!0}),e.setEdge(y,u,{weight:p,minlen:E,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,c,{weight:0,minlen:r+((a=i[s])!=null?a:0)})}function ty(e){let t={};function n(o,r){let i=e.children(o);i&&i.length&&i.forEach(s=>n(s,r+1)),t[o]=r}return e.children($n).forEach(o=>n(o,1)),t}function ny(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function oy(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var ry=iy;function iy(e){function t(n){let o=e.children(n),r=e.node(n);if(o.length&&o.forEach(t),r&&Object.hasOwn(r,"minRank")){r.borderLeft=[],r.borderRight=[];for(let i=r.minRank,s=r.maxRank+1;i<s;++i)hi(e,"borderLeft","_bl",n,r,i),hi(e,"borderRight","_br",n,r,i)}}e.children($n).forEach(t)}function hi(e,t,n,o,r,i){let s={width:0,height:0,rank:i,borderType:t},a=r[t][i-1],l=dt(e,"border",s,n);r[t][i]=l,e.setParent(l,o),a&&e.setEdge(a,l,{weight:1})}function sy(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="lr"||n==="rl")&&Ya(e)}function ay(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="bt"||n==="rl")&&cy(e),(n==="lr"||n==="rl")&&(ly(e),Ya(e))}function Ya(e){e.nodes().forEach(t=>gi(e.node(t))),e.edges().forEach(t=>gi(e.edge(t)))}function gi(e){let t=e.width;e.width=e.height,e.height=t}function cy(e){e.nodes().forEach(t=>qn(e.node(t))),e.edges().forEach(t=>{var n;let o=e.edge(t);(n=o.points)==null||n.forEach(qn),Object.hasOwn(o,"y")&&qn(o)})}function qn(e){e.y=-e.y}function ly(e){e.nodes().forEach(t=>Kn(e.node(t))),e.edges().forEach(t=>{var n;let o=e.edge(t);(n=o.points)==null||n.forEach(Kn),Object.hasOwn(o,"x")&&Kn(o)})}function Kn(e){let t=e.x;e.x=e.y,e.y=t}function uy(e,t=null){let n={},o=e.nodes().filter(c=>!e.children(c).length),r=o.map(c=>e.node(c).rank),i=Ee(Math.max,r),s=Ot(i+1).map(()=>[]);function a(c){if(n[c])return;n[c]=!0;let u=e.node(c);s[u.rank].push(c);let d=e.successors(c);d&&[...d].sort((f,h)=>l(f,h)).forEach(a)}o.sort((c,u)=>e.node(c).rank-e.node(u).rank).forEach(a);function l(c,u){let d=e.node(c),f=e.node(u);return La(t,d,f)}return s}function dy(e,t){let n=0;for(let o=1;o<t.length;++o)n+=fy(e,t[o-1],t[o]);return n}function fy(e,t,n){let o=xm(n,n.map((c,u)=>u)),r=t.flatMap(c=>{let u=e.outEdges(c);return u?u.map(d=>({pos:o[d.w],weight:e.edge(d).weight})).sort((d,f)=>d.pos-f.pos):[]}),i=1;for(;i<n.length;)i<<=1;let s=2*i-1;i-=1;let a=new Array(s).fill(0),l=0;return r.forEach(c=>{let u=c.pos+i;a[u]+=c.weight;let d=0;for(;u>0;)u%2&&(d+=a[u+1]),u=u-1>>1,a[u]+=c.weight;l+=c.weight*d}),l}function hy(e,t=[]){return t.map(n=>{let o=e.inEdges(n);if(!o||!o.length)return{v:n};{let r=o.reduce((i,s)=>{let a=e.edge(s),l=e.node(s.v);return{sum:i.sum+a.weight*l.order,weight:i.weight+a.weight}},{sum:0,weight:0});return{v:n,barycenter:r.sum/r.weight,weight:r.weight}}})}function gy(e,t){let n={};e.forEach((r,i)=>{let s={indegree:0,in:[],out:[],vs:[r.v],i};r.barycenter!==void 0&&(s.barycenter=r.barycenter,s.weight=r.weight),n[r.v]=s}),t.edges().forEach(r=>{let i=n[r.v],s=n[r.w];i!==void 0&&s!==void 0&&(s.indegree++,i.out.push(s))});let o=Object.values(n).filter(r=>!r.indegree);return py(o)}function py(e){let t=[];function n(r){return i=>{i.merged||(i.barycenter===void 0||r.barycenter===void 0||i.barycenter>=r.barycenter)&&my(r,i)}}function o(r){return i=>{i.in.push(r),--i.indegree===0&&e.push(i)}}for(;e.length;){let r=e.pop();t.push(r),r.in.reverse().forEach(n(r)),r.out.forEach(o(r))}return t.filter(r=>!r.merged).map(r=>wn(r,["vs","i","barycenter","weight"]))}function my(e,t){let n=0,o=0;e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/o,e.weight=o,e.i=Math.min(t.i,e.i),t.merged=!0}function yy(e,t,n,o,r){let i={},s=null,a=null,l=r;typeof t=="boolean"?(l=t,i={}):t&&(i=t,s=n??null,a=o??null);let c=mm(e,p=>Object.hasOwn(p,"barycenter")),u=c.lhs,d=c.rhs.sort((p,E)=>E.i-p.i),f=[],h=0,g=0,x=0;u.sort(wy(a,s,!!l));for(let[p,E]of Object.entries(i)){let m=u.findIndex(v=>v.vs[0]===p);u.splice(m+1,0,E)}x=pi(f,d,x),u.forEach(p=>{x+=p.vs.length,f.push(p.vs),h+=p.barycenter*p.weight,g+=p.weight,x=pi(f,d,x)});let y={vs:f.flat(1)};return g&&(y.barycenter=h/g,y.weight=g),y}function pi(e,t,n){let o;for(;t.length&&(o=t[t.length-1]).i<=n;)t.pop(),e.push(o.vs),n++;return n}function wy(e,t,n){return(o,r)=>{if(o.barycenter<r.barycenter)return-1;if(o.barycenter>r.barycenter)return 1;if(e&&(typeof o.vs[0]=="string"||typeof r.vs[0]=="string")){let i=e.node(o.vs[0]),s=e.node(r.vs[0]),a=La(t,i,s);if(a!==0)return a}return n?r.i-o.i:o.i-r.i}}function Xa(e,t,n,o,r){var i,s,a,l,c,u,d,f,h,g,x;let y=null,p=r;typeof o=="boolean"?(p=o,y=null):o!==void 0&&(y=o);let E=e.children(t),m=e.node(t),v=m?m.borderLeft:void 0,S=m?m.borderRight:void 0,N={};v&&(E=E.filter(A=>A!==v&&A!==S));let b=hy(e,E);b.forEach(A=>{if(e.children(A.v).length){let{result:I}=Xa(e,A.v,n,y,p);N[A.v]=I,Object.hasOwn(I,"barycenter")&&vy(A,I)}});let _=gy(b,n);xy(_,N);let C={},L=!1;for(let A=0;A<_.length;A++)for(let I=A+1;I<_.length;I++)if(!(!_[A]||!_[I]||!((i=_[A])!=null&&i.barycenter)||!((s=_[I])!=null&&s.barycenter))&&((a=_[A])==null?void 0:a.barycenter)===_[I].barycenter){let w=(c=(l=_[A])==null?void 0:l.vs[0])!=null?c:"",k=(d=(u=_[I])==null?void 0:u.vs[0])!=null?d:"",M=e.node(w),$=e.node(k);if(M.dummy==="edge"&&$.dummy==="edge"&&((f=M.edgeObj)==null?void 0:f.v)===((h=$.edgeObj)==null?void 0:h.v)&&((g=M.edgeObj)==null?void 0:g.w)===((x=$.edgeObj)==null?void 0:x.w))if(M.edgeLabel.reversed){C[k]=_[A],_.splice(A,1),A--;break}else C[w]=_[I],_.splice(I,1),I--;else L=!0}let O=yy(_,C,y,e,p);if(v&&S){O.vs=[v,O.vs,S].flat(1);let A=e.predecessors(v);if(A&&A.length){let I=e.node(A[0]),w=e.predecessors(S),k=e.node(w[0]);Object.hasOwn(O,"barycenter")||(O.barycenter=0,O.weight=0),O.barycenter=(O.barycenter*O.weight+I.order+k.order)/(O.weight+2),O.weight+=2}}return Object.defineProperty(O,"result",{value:O,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(O,"usedBias",{value:L,enumerable:!1,configurable:!0,writable:!0}),O}function xy(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(o=>t[o]?t[o].vs:o)})}function vy(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function by(e,t,n,o){o||(o=e.nodes());let r=Ey(e),i=new ue({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(s=>e.node(s));return o.forEach(s=>{let a=e.node(s),l=e.parent(s);if(a.rank===t||a.minRank<=t&&t<=a.maxRank){i.setNode(s),i.setParent(s,l||r);let c=e[n](s);c&&c.forEach(u=>{let d=u.v===s?u.w:u.v,f=i.edge(d,s),h=f!==void 0?f.weight:0;i.setEdge(d,s,{weight:e.edge(u).weight+h})}),Object.hasOwn(a,"minRank")&&i.setNode(s,{borderLeft:a.borderLeft[t],borderRight:a.borderRight[t]})}}),i}function Ey(e){let t;for(;e.hasNode(t=Bo("_root")););return t}function _y(e,t,n){let o={},r;n.forEach(i=>{let s=e.parent(i),a,l;for(;s;){if(a=e.parent(s),a?(l=o[a],o[a]=s):(l=r,r=s),l&&l!==s){t.setEdge(l,s);return}s=a}})}function Za(e,t={},n=null){if(typeof t.customOrder=="function"){t.customOrder(e,Za);return}let o=Ta(e),r=mi(e,Ot(1,o+1),"inEdges"),i=mi(e,Ot(o-1,-1,-1),"outEdges"),s=uy(e,n);if(yi(e,s),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){Ny(u%2?r:i,u%4>=2,c,n),s=zt(e);let f=dy(e,s);f<a?(d=0,l=Object.assign({},s),a=f):f===a&&(l=structuredClone(s))}yi(e,l)}function mi(e,t,n){let o=new Map,r=(i,s)=>{o.has(i)||o.set(i,[]),o.get(i).push(s)};for(let i of e.nodes()){let s=e.node(i);if(typeof s.rank=="number"&&r(s.rank,i),typeof s.minRank=="number"&&typeof s.maxRank=="number")for(let a=s.minRank;a<=s.maxRank;a++)a!==s.rank&&r(a,i)}return t.map(function(i){return by(e,i,n,o.get(i)||[])})}function Ny(e,t,n,o){let r=!0,i=new ue;e.forEach(function(s){n.forEach(u=>i.setEdge(u.left,u.right));let a=s.graph().root,{result:l,usedBias:c}=Xa(s,a,i,o,r);t&&c&&(r=!r),l.vs.forEach((u,d)=>s.node(u).order=d),_y(s,i,l.vs)})}function yi(e,t){Object.values(t).forEach(n=>n.forEach((o,r)=>e.node(o).order=r))}function Sy(e,t){let n={};function o(r,i){let s=0,a=0,l=r.length,c=i[i.length-1];return i.forEach((u,d)=>{let f=Cy(e,u),h=f?e.node(f).order:l;(f||u===c)&&(i.slice(a,d+1).forEach(g=>{let x=e.predecessors(g);x&&x.forEach(y=>{let p=e.node(y),E=p.order;(E<s||h<E)&&!(p.dummy&&e.node(g).dummy)&&Wa(n,y,g)})}),a=d+1,s=h)}),i}return t.length&&t.reduce(o),n}function ky(e,t){let n={};function o(i,s,a,l,c){Ot(s,a).forEach(u=>{let d=i[u];if(d!==void 0&&e.node(d).dummy){let f=e.predecessors(d);f&&f.forEach(h=>{if(h===void 0)return;let g=e.node(h);g.dummy&&(g.order<l||g.order>c)&&Wa(n,h,d)})}})}function r(i,s){let a=-1,l=-1,c=0;return s.forEach((u,d)=>{if(e.node(u).dummy==="border"){let f=e.predecessors(u);if(f&&f.length){let h=f[0];if(h===void 0)return;l=e.node(h).order,o(s,c,d,a,l),c=d,a=l}}o(s,c,s.length,l,i.length)}),s}return t.length&&t.reduce(r),n}function Cy(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(o=>e.node(o).dummy)}}function Wa(e,t,n){if(t>n){let r=t;t=n,n=r}let o=e[t];o||(e[t]=o={}),o[n]=!0}function My(e,t,n){if(t>n){let r=t;t=n,n=r}let o=e[t];return o!==void 0&&Object.hasOwn(o,n)}function Iy(e,t,n,o,r){let i={},s={},a={};return t.forEach(l=>{l.forEach((c,u)=>{i[c]=c,s[c]=c,a[c]=u})}),t.forEach(l=>{let c=-1,u=-1,d=!1,f=l,h=l.findIndex(g=>r?.includes(g)||wi(g,e,r));h>0&&(f=[l[h],...l.slice(0,h),...l.slice(h+1)],d=!0),f.forEach(g=>{var x;let y=o(g);if(y&&y.length){r!=null&&r.includes(g)&&(y=y.filter(m=>wi(m,e,r)));let p=y.sort((m,v)=>{let S=a[m],N=a[v];return(S!==void 0?S:0)-(N!==void 0?N:0)}),E=(p.length-1)/2;for(let m=Math.floor(E),v=Math.ceil(E);m<=v;++m){let S=p[m];if(S===void 0)continue;let N=a[S];if(N!==void 0&&s[g]===g&&c<N&&a[S]!==u&&!My(n,g,S)){let b=i[S];b!==void 0&&(s[S]=g,s[g]=i[g]=b,c=N,d&&(c=-1,u=(x=a[S])!=null?x:-1,d=!1))}}}})}),{root:i,align:s}}function Oy(e,t,n,o,r=!1){let i={},s=Py(e,t,n,r),a=r?"borderLeft":"borderRight";function l(h,g){let x=s.nodes().slice(),y={},p=x.pop();for(;p;){if(y[p])h(p);else{y[p]=!0,x.push(p);for(let E of g(p))x.push(E)}p=x.pop()}}function c(h){let g=s.inEdges(h);g?i[h]=g.reduce((x,y)=>{var p;let E=(p=i[y.v])!=null?p:0,m=s.edge(y);return Math.max(x,E+(m!==void 0?m:0))},0):i[h]=0}function u(h){let g=s.outEdges(h),x=Number.POSITIVE_INFINITY;g&&(x=g.reduce((p,E)=>{let m=i[E.w],v=s.edge(E);return Math.min(p,(m!==void 0?m:0)-(v!==void 0?v:0))},Number.POSITIVE_INFINITY));let y=e.node(h);x!==Number.POSITIVE_INFINITY&&y.borderType!==a&&(i[h]=Math.max(i[h]!==void 0?i[h]:0,x))}function d(h){return s.predecessors(h)||[]}function f(h){return s.successors(h)||[]}return l(c,d),l(u,f),Object.keys(o).forEach(h=>{var g;let x=n[h];x!==void 0&&(i[h]=(g=i[x])!=null?g:0)}),i}function Py(e,t,n,o){let r=new ue,i=e.graph(),s=Ly(i.nodesep,i.edgesep,o);return t.forEach(a=>{let l;a.forEach(c=>{let u=n[c];if(u!==void 0){if(r.setNode(u),l!==void 0){let d=n[l];if(d!==void 0){let f=r.edge(d,u);r.setEdge(d,u,Math.max(s(e,c,l),f||0))}}l=c}})}),r}function Ay(e,t){return Object.values(t).reduce((n,o)=>{let r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(o).forEach(([a,l])=>{let c=Ry(e,a)/2;r=Math.max(l+c,r),i=Math.min(l-c,i)});let s=r-i;return s<n[0]&&(n=[s,o]),n},[Number.POSITIVE_INFINITY,null])[1]}function $y(e,t){let n=Object.values(t),o=Ee(Math.min,n),r=Ee(Math.max,n);["u","d"].forEach(i=>{["l","r"].forEach(s=>{let a=i+s,l=e[a];if(!l||l===t)return;let c=Object.values(l),u=o-Ee(Math.min,c);s!=="l"&&(u=r-Ee(Math.max,c)),u&&(e[a]=An(l,d=>d+u))})})}function Ty(e,t=void 0){let n=e.ul;return n?An(n,(o,r)=>{var i,s;if(t){let l=t.toLowerCase(),c=e[l];if(c&&c[r]!==void 0)return c[r]}let a=Object.values(e).map(l=>{let c=l[r];return c!==void 0?c:0}).sort((l,c)=>l-c);return(((i=a[1])!=null?i:0)+((s=a[2])!=null?s:0))/2}):{}}function Dy(e,t){let n=zt(e),o=Object.assign(Sy(e,n),ky(e,n)),r={},i;["u","d"].forEach(a=>{i=a==="u"?n:Object.values(n).reverse(),["l","r"].forEach(l=>{l==="r"&&(i=i.map(d=>Object.values(d).reverse()));let c=Iy(e,i,o,d=>(a==="u"?e.predecessors(d):e.successors(d))||[],t),u=Oy(e,i,c.root,c.align,l==="r");l==="r"&&(u=An(u,d=>-d)),r[a+l]=u})});let s=Ay(e,r);return $y(r,s),Ty(r,e.graph().align)}function Ly(e,t,n){return(o,r,i)=>{let s=o.node(r),a=o.node(i),l=0,c;if(l+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":c=-s.width/2;break;case"r":c=s.width/2;break}if(c&&(l+=n?c:-c),c=void 0,l+=(s.dummy?t:e)/2,l+=(a.dummy?t:e)/2,l+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":c=a.width/2;break;case"r":c=-a.width/2;break}return c&&(l+=n?c:-c),l}}function Ry(e,t){return e.node(t).width}function wi(e,t,n){var o;if(!n)return!1;let r=(o=t.node(e))==null?void 0:o.edgeObj;if(!r||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(r?.v),s=n.indexOf(r?.w);return i!==-1&&s!==-1&&i===(s+1)%n.length||i===(s-1)%n.length}function zy(e,t){e=Aa(e),jy(e),Object.entries(Dy(e,t)).forEach(([n,o])=>e.node(n).x=o)}function jy(e){let t=zt(e),n=e.graph(),o=n.ranksep,r=n.rankalign,i=0;t.forEach(s=>{let a=s.reduce((l,c)=>{var u;let d=(u=e.node(c).height)!=null?u:0;return l>d?l:d},0);s.forEach(l=>{let c=e.node(l);r==="top"?c.y=i+c.height/2:r==="bottom"?c.y=i+a-c.height/2:c.y=i+a/2}),i+=a+o})}var Un=null,Qn=null;function Hy(e,t={}){return Ga(e,Da,t),e}function xi(e,t,n){let o=t;for(;o!==void 0;){let r=e.parent(o);if(r===n)return o;o=r}}function Ga(e,t,n){let o=e.nodes().filter(y=>e.children(y).length),r={};o.forEach(y=>{let p=e.node(y);if(p&&p.rankdir){let E=new ue({multigraph:!0,compound:!0});E.setGraph({rankdir:p.rankdir});let m=e.children(y);m.forEach(A=>{let I={...e.node(A)};E.setNode(A,I);let w=e.parent(A);w&&w!==y&&m.includes(w)&&E.setParent(A,w)});let v=new Set;e.edges().forEach(A=>{let I=xi(e,A.v,y),w=xi(e,A.w,y);if(I&&w&&I!==w){let k=`${I}\0${w}`;v.has(k)||(v.add(k),E.setEdge(I,w,{...e.edge(A)}))}}),Ga(E,t,n);let S=_i(E);vi(S,t,n),bi(E,S);let N=1/0,b=1/0,_=-1/0,C=-1/0;E.nodes().forEach(A=>{if(A===y)return;let I=E.node(A);I&&typeof I.x=="number"&&typeof I.y=="number"&&typeof I.width=="number"&&typeof I.height=="number"&&(N=Math.min(N,I.x-I.width/2),_=Math.max(_,I.x+I.width/2),b=Math.min(b,I.y-I.height/2),C=Math.max(C,I.y+I.height/2))}),(!isFinite(N)||!isFinite(b)||!isFinite(_)||!isFinite(C))&&(N=b=0,_=C=0);let L=_-N,O=C-b;r[y]={minX:N,minY:b,maxX:_,maxY:C,width:L,height:O,offsetX:N,offsetY:b},p._dagreClusterSubgraph=E}});let i=[],s=y=>{let p=[],E=(e.children(y)||[]).filter(m=>m!==y);for(;E.length>0;){let m=E.shift();p.push(m),(e.children(m)||[]).filter(v=>v!==m).forEach(v=>E.push(v))}return p},a=new Map;o.forEach(y=>{let p=e.node(y);p&&p.rankdir&&r[y]&&a.set(y,(e.children(y)||[]).filter(E=>E!==y))});let l=new Set([...a.values()].flat()),c=new Map;a.forEach((y,p)=>{l.has(p)||c.set(p,s(p))});let u=new Set([...c.values()].flat()),d=y=>{for(let[p,E]of c)if(E.includes(y))return p;return y},f=[];e.edges().forEach(y=>{(u.has(y.v)||u.has(y.w))&&f.push({edge:y,label:e.edge(y)})});let h=new Map;u.forEach(y=>{let p=e.parent(y);h.set(y,typeof p=="string"?p:void 0)}),c.forEach((y,p)=>{let E=e.node(p),m=[];y.forEach(N=>{let b=e.node(N);b&&(m.push({id:N,node:b,parent:h.get(N)}),e.removeNode(N))});let v=f.filter(({edge:N})=>y.includes(N.v)||y.includes(N.w)),S=r[p];E&&(i.push({clusterId:p,subgraph:E._dagreClusterSubgraph,bounds:S,children:y,removedNodes:m,removedEdges:v}),E.width=S.width,E.height=S.height)});let g=new Set;f.forEach(({edge:y,label:p})=>{let E=d(y.v),m=d(y.w);if(E!==m&&e.hasNode(E)&&e.hasNode(m)){let v=`${E}\0${m}`;g.has(v)||(g.add(v),e.setEdge(E,m,{...p,width:0,height:0}))}});let x=_i(e);vi(x,t,n),bi(e,x),g.forEach(y=>{let p=y.indexOf("\0"),E=y.slice(0,p),m=y.slice(p+1);e.hasEdge(E,m)&&e.removeEdge(E,m)}),i.forEach(({clusterId:y,subgraph:p,bounds:E,removedNodes:m,removedEdges:v})=>{var S,N;let b=e.node(y),_=(S=b?.x)!=null?S:0,C=(N=b?.y)!=null?N:0,L=(E.minX+E.maxX)/2,O=(E.minY+E.maxY)/2;m.forEach(({id:A,node:I,parent:w})=>{e.setNode(A,I),w!==void 0&&e.setParent(A,w)}),v.forEach(({edge:A,label:I})=>{e.setEdge(A,I)}),p.nodes().forEach(A=>{if(A===y)return;let I=p.node(A),w=e.node(A);w&&I&&typeof I.x=="number"&&typeof I.y=="number"&&(w.x=_+(I.x-L),w.y=C+(I.y-O))}),delete b._dagreClusterSubgraph}),o.forEach(y=>{var p,E;let m=e.node(y),v=r[y];if(m&&m.rankdir&&m._dagreClusterSubgraph&&v){let S=m._dagreClusterSubgraph,N=(p=m.x)!=null?p:0,b=(E=m.y)!=null?E:0,_=(v.minX+v.maxX)/2,C=(v.minY+v.maxY)/2;S.nodes().forEach(L=>{if(L===y)return;let O=S.node(L),A=e.node(L);if(A&&O&&typeof O.x=="number"&&typeof O.y=="number"){let I=O.x-_,w=O.y-C;A.x=N+I,A.y=b+w}}),delete m._dagreClusterSubgraph}})}function vi(e,t,n){n?.useDynamic===!1&&(Un=null,Qn=null),t(" makeSpaceForEdgeLabels",()=>Gy(e)),t(" removeSelfEdges",()=>ow(e)),t(" acyclic",()=>Im(e,Un)),t(" nestingGraph.run",()=>ey(e)),t(" rank",()=>Zm(Aa(e))),t(" injectEdgeLabelProxies",()=>qy(e)),t(" removeEmptyRanks",()=>gm(e)),t(" nestingGraph.cleanup",()=>oy(e)),t(" normalizeRanks",()=>hm(e)),t(" assignRankMinMax",()=>Ky(e)),t(" removeEdgeLabelProxies",()=>Uy(e)),t(" normalize.run",()=>$m(e)),t(" parentDummyChains",()=>Km(e)),t(" addBorderSegments",()=>ry(e)),t(" order",()=>Za(e,n,Qn)),t(" insertSelfEdges",()=>rw(e)),t(" adjustCoordinateSystem",()=>sy(e)),t(" position",()=>zy(e,n.corePath)),t(" positionSelfEdges",()=>iw(e)),Qn=JSON.parse(JSON.stringify(e._nodes)),t(" removeBorderNodes",()=>nw(e)),t(" normalize.undo",()=>Dm(e)),t(" fixupEdgeLabelCoords",()=>ew(e)),t(" undoCoordinateSystem",()=>ay(e)),t(" translateGraph",()=>Qy(e)),t(" assignNodeIntersects",()=>Jy(e)),t(" reversePoints",()=>tw(e)),t(" acyclic.undo",()=>Pm(e)),Un=e}function bi(e,t){e.nodes().forEach(n=>{let o=e.node(n),r=t.node(n);o&&(o.x=r.x,o.y=r.y,o.order=r.order,o.rank=r.rank,t.children(n).length&&(o.width=r.width,o.height=r.height))}),e.edges().forEach(n=>{let o=e.edge(n),r=t.edge(n);o.points=r.points,Object.hasOwn(r,"x")&&(o.x=r.x,o.y=r.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Vy=["nodesep","edgesep","ranksep","marginx","marginy"],By={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},Fy=["acyclicer","ranker","rankdir","align","rankalign"],Yy=["width","height","rank"],Ei={width:0,height:0},Xy=["minlen","weight","width","height","labeloffset"],Zy={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Wy=["labelpos"];function _i(e){let t=new ue({multigraph:!0,compound:!0}),n=eo(e.graph());return t.setGraph(Object.assign({},By,Jn(n,Vy),wn(n,Fy))),e.nodes().forEach(o=>{let r=eo(e.node(o)),i=Jn(r,Yy);Object.keys(Ei).forEach(a=>{i[a]===void 0&&(i[a]=Ei[a])}),t.setNode(o,i);let s=e.parent(o);s!==void 0&&t.setParent(o,s)}),e.edges().forEach(o=>{let r=eo(e.edge(o));t.setEdge(o,Object.assign({},Zy,Jn(r,Xy),wn(r,Wy)))}),t}function Gy(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{var o;let r=e.edge(n);r.minlen*=2,((o=r.labelpos)!=null?o:"r").toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function qy(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let o=e.node(t.v),r={rank:(e.node(t.w).rank-o.rank)/2+o.rank,e:t};dt(e,"edge-proxy",r,"_ep")}})}function Ky(e){let t=0;e.nodes().forEach(n=>{let o=e.node(n);o.borderTop&&(o.minRank=e.node(o.borderTop).rank,o.maxRank=e.node(o.borderBottom).rank,t=Math.max(t,o.maxRank))}),e.graph().maxRank=t}function Uy(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let o=n;e.edge(o.e).labelRank=n.rank,e.removeNode(t)}})}function Qy(e){let t=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,r=0,i=e.graph(),s=i.marginx||0,a=i.marginy||0;function l(c){let u=c.x,d=c.y,f=c.width,h=c.height;t=Math.min(t,u-f/2),n=Math.max(n,u+f/2),o=Math.min(o,d-h/2),r=Math.max(r,d+h/2)}e.nodes().forEach(c=>l(e.node(c))),e.edges().forEach(c=>{let u=e.edge(c);Object.hasOwn(u,"x")&&l(u)}),t-=s,o-=a,e.nodes().forEach(c=>{let u=e.node(c);u.x-=t,u.y-=o}),e.edges().forEach(c=>{let u=e.edge(c);u.points.forEach(d=>{d.x-=t,d.y-=o}),Object.hasOwn(u,"x")&&(u.x-=t),Object.hasOwn(u,"y")&&(u.y-=o)}),i.width=n-t+s,i.height=r-o+a}function Jy(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),o=e.node(t.v),r=e.node(t.w),i,s;n.points?(i=n.points[0],s=n.points[n.points.length-1]):(n.points=[],i=r,s=o),n.points.unshift(ci(o,i)),n.points.push(ci(r,s))})}function ew(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function tw(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function nw(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),o=e.node(n.borderTop),r=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),s=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(s.x-i.x),n.height=Math.abs(r.y-o.y),n.x=i.x+n.width/2,n.y=o.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function ow(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function rw(e){zt(e).forEach(t=>{let n=0;t.forEach((o,r)=>{let i=e.node(o);typeof i.rank!="number"&&(i.rank=0),i.order=r+n,(i.selfEdges||[]).forEach(s=>{dt(e,"selfedge",{width:s.label.width,height:s.label.height,rank:i.rank,order:r+ ++n,e:s.e,edgeLabel:s.label},"_se"),(!Array.isArray(s.label.points)||s.label.points.length!==7)&&(s.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function iw(e){e.nodes().forEach(t=>{let n=e.node(t),o=r=>typeof r=="number"&&isFinite(r);if(n.dummy==="selfedge"){let r=n,i=e.node(r.e.v),s=o(i?.x)?i.x:0,a=o(i?.y)?i.y:0,l=o(i?.width)?i.width:0,c=o(i?.height)?i.height:0,u=o(n.x)?n.x:s,d=o(n.y)?n.y:a,f=l/2,h=c/2;r.edgeLabel.points=[{x:u+f,y:d-h},{x:u+f,y:d-h},{x:u,y:d},{x:u-f,y:d+h},{x:u-f,y:d+h},{x:u,y:d},{x:u,y:d}],r.edgeLabel.x=u,r.edgeLabel.y=d,e.setEdge(r.e,r.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(r=>{if(!Array.isArray(r.label.points)||r.label.points.length!==7){let i=o(n.x)?n.x:0,s=o(n.y)?n.y:0,a=o(n.width)?n.width:0,l=o(n.height)?n.height:0,c=a/2,u=l/2;r.label.points=[{x:i+c,y:s-u},{x:i+c,y:s-u},{x:i,y:s},{x:i-c,y:s+u},{x:i-c,y:s+u},{x:i,y:s},{x:i,y:s}]}})})}function Jn(e,t){return An(wn(e,t),Number)}function eo(e){let t={};return e&&Object.entries(e).forEach(([n,o])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=o}),t}function sw(e){let t=zt(e),n=new ue({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(o=>{n.setNode(o,{label:o}),n.setParent(o,"layer"+e.node(o).rank)}),e.edges().forEach(o=>n.setEdge(o.v,o.w,{},o.name)),t.forEach((o,r)=>{let i="layer"+r;n.setNode(i,{rank:"same"}),o.reduce((s,a)=>(n.setEdge(s,a,{style:"invis"}),a))}),n}var aw={graphlib:_a,version:vm,layout:Hy,debug:sw,util:{time:ym,notime:Da}},Ni=aw;/*! For license information please see dagre.esm.js.LEGAL.txt */const qt=e=>{const t=sl(e);return t==="both"?"both":t==="push"?"anchor":"deref"};function Si(e,t){return t!==null&&e!==null?`${e}: ${t}`:t!==null?t:e!==null?String(e):""}const ki=(e,t)=>vo([...rn(e),t]),cw=(e,t,n)=>e!==null?e:t?"~":String(n);function lw(e){const t=[];for(const n of e)if(n.sel==="key")t.push(n.name);else if(n.sel==="index")t.push(n.n);else if(n.sel==="nullkey")t.push(null);else return null;return t}function uw(e,t,n){let o,r,i,s;try{const d=cl(e,f=>{throw new Error(f)});o=d.ordinal===!0,r=d.path.steps,i=d.path.base.scope,s=d.path.base.authority}catch{return null}const a=lw(r);if(!a)return null;const l=rn(t),c=i==="document"?rn(n):i==="current"?l.slice(0,-1):i==="parent"?l.slice(0,-2):i==="link"&&s?[s]:null,u=c?[...c,...a]:a;return!o&&u.length===0?null:{host:vo(o?u:u.slice(0,-1)),key:o?null:String(u[u.length-1])}}function Ci(e){const t=xn(e);return t?{self:t.kind==="omni"?t.value:void 0,entries:t.entries}:Array.isArray(e)?{self:void 0,entries:e.map(n=>({key:null,value:n}))}:e!==null&&typeof e=="object"?{self:void 0,entries:Object.entries(e).map(([n,o])=>({key:n,value:o}))}:{self:e,entries:[]}}function dw(e){if(e==null)return null;if(typeof e=="object"){const n=e.$yamloverNum;return typeof n=="string"?{text:n,type:"number"}:null}const t=typeof e=="number"?"number":typeof e=="boolean"?"boolean":"string";return{text:String(e),type:t}}const Kt=e=>ol(e),Mi=(e,t=null)=>xn(e)?.format??on(e)?.format??t,fw=e=>`(untitled ${al(e)?"task":"chapter"})`;function to(e,t,n){const o=xn(e);if(o?.kind==="omni"&&o.value!=null&&typeof o.value!="object")return String(o.value);const r=o?.entries.find(a=>a.key==="title")?.value,i=r===void 0?"":rl(r);if(i)return i;const s=on(e);return typeof s?.title=="string"&&s.title?s.title:n||fw(t)}const hw=e=>e.length?e.join(": "):null,gw=(e,t)=>{const n=fe(e),o=fe(t);return n===":"||n===o||ll(n,o)};function pw(e,t={}){const n=t.fold!==!1,o=[],r=new Map,i=new Map,s=new Map,a=new Set,l=[],c=[],u=e.comments??{},d=e.path,f=(b,_)=>{const C=b;if(r.get(C))return C;const O=dw(_),A=O===null?{id:C,path:b,label:"",kind:"empty"}:{id:C,path:b,label:O.text,kind:"value",valueType:O.type};return o.push(A),r.set(C,A),i.set(fe(b),C),C},h=(b,_,C)=>{if(r.has(b))return b;const L={id:b,path:b,label:_,kind:"unit",format:C};return o.push(L),r.set(b,L),i.set(fe(b),b),s.set(fe(b),b),b},g=(b,_,C)=>{const L=u[b];for(const O of(Array.isArray(L)?void 0:L?.anchors)??[]){const A=uw(O,_,d);A&&c.push({host:A.host,key:A.key,target:C})}},x=(b,_,C)=>({seg:b.key!==null?b.key:b.keyNull===!0?null:b.pos??_,childFrag:`${C}/${encodeURIComponent(cw(b.key,b.keyNull===!0,_))}`,key:b.key!==null?b.key:b.keyNull===!0?"~":null}),y=(b,_,C,L,O,A)=>{if(a.has(L))return;a.add(L);const{entries:I}=Ci(C);I.forEach((w,k)=>{if(il(w.key))return;const{seg:M,childFrag:$,key:R}=x(w,k,O),D=R!==null?[...A,R]:A,V=hw(D),H=er(w.value);if(H){l.push({source:b,target:null,targetPath:H.path??void 0,text:H.text,kind:qt(H.via),via:H.via,key:V,ordinal:null});return}const z=on(w.value);if(z){const B=typeof z.path=="string"?z.path:null;if(B===null)return;const X=z.format??null;if(z.via){l.push({source:b,target:null,targetPath:B,text:typeof z.title=="string"?z.title:jt(B),kind:qt(z.via),via:z.via,key:V,ordinal:null});return}if(gw(_,B)){Kt(X)&&(h(B,to(w.value,X,null),X),l.push({source:b,target:B,kind:w.anchor===!0?"anchor":"contain",key:null,ordinal:k}));return}l.push({source:b,target:null,targetPath:B,text:typeof z.title=="string"?z.title:jt(B),kind:"deref",key:V,ordinal:null});return}const Y=ki(L,M);if(Kt(Mi(w.value))){const B=p(w.value,Y,$);l.push({source:b,target:B,kind:w.anchor===!0?"anchor":"contain",key:null,ordinal:k});return}g($,Y,Y),y(b,_,w.value,Y,$,D)})},p=(b,_,C)=>{const L=Mi(b,_===e.path?e.format??null:null);if(n&&Kt(L)){const k=r.has(_),M=h(_,to(b,L,_===e.path?e.title??null:null),L);return k||(g(C,_,M),y(M,_,b,_,C,[])),M}const O=r.has(_),{self:A,entries:I}=Ci(b),w=f(_,A);return O||(g(C,_,w),I.forEach((k,M)=>{const{seg:$,childFrag:R,key:D}=x(k,M,C),V=k.anchor===!0?"anchor":"contain",H=er(k.value);if(H){l.push({source:w,target:null,targetPath:H.path??void 0,text:H.text,kind:qt(H.via),via:H.via,key:D,ordinal:M});return}const z=on(k.value);if(z){if(z.via){l.push({source:w,target:null,targetPath:z.path,text:typeof z.title=="string"?z.title:jt(z.path),kind:qt(z.via),via:z.via,key:D,ordinal:M});return}const B=z.format??null,X=n&&Kt(B)&&typeof z.path=="string"?h(z.path,to(k.value,B,null),B):f(z.path,z.value??z.title??null);l.push({source:w,target:X,kind:V,key:D,ordinal:M});return}const Y=p(k.value,ki(_,$),R);l.push({source:w,target:Y,kind:V,key:D,ordinal:M})})),w};p(e.value,e.path,"");const E=(b,_)=>{if(b!==void 0){const L=i.get(fe(b));if(L)return L;const O={id:b,path:b,label:":"+jt(b),kind:"stub"};return r.has(b)||(o.push(O),r.set(b,O),i.set(fe(b),b)),b}if(_===void 0)return null;const C=`$unresolved:${_}`;if(!r.has(C)){const L={id:C,path:null,label:_,kind:"stub"};o.push(L),r.set(C,L)}return C},m=b=>{if(b==null)return null;const _=fe(b),C=i.get(_);if(C)return C;if(!n)return null;const L=rn(_);for(let O=L.length-1;O>=0;O--){const A=s.get(fe(vo(L.slice(0,O))));if(A)return A}return null},v=[],S=(b,_,C,L)=>v.some(O=>O.source===b&&O.target===_&&O.kind===C&&O.key===L);l.forEach((b,_)=>{const C=b.source!==null?m(b.source)??b.source:m(b.sourcePath)??E(b.sourcePath,void 0),L=b.target!==null?m(b.target)??b.target:m(b.targetPath)??E(b.targetPath,b.text);C===null||L===null||n&&(C===L||S(C,L,b.kind,b.key))||v.push({id:`e${_}`,source:C,target:L,kind:b.kind,key:b.key,ordinal:b.ordinal,label:Si(b.ordinal,b.key),...b.via?{via:b.via}:{}})});const N=b=>b===null?null:b.split(": ").pop();for(const b of c){const _=m(b.target)??b.target,C=m(b.host),L=fe(b.host),O=v.find(I=>I.target===_&&(I.key===b.key||n&&N(I.key)===b.key)&&(C!==null?I.source===C:fe(I.source)===L));if(O){O.kind=O.kind==="both"||(O.via?.includes("pull")??!1)?"both":"anchor";continue}const A=C??E(b.host,void 0);A!==null&&(n&&(A===_||S(A,_,"anchor",b.key))||v.push({id:`a${v.length}`,source:A,target:_,kind:"anchor",key:b.key,ordinal:null,label:Si(null,b.key)}))}return{nodes:o,edges:v}}const mw=["Control","Alt","Meta"],yw=e=>e.ctrlKey||e.altKey||e.metaKey,ww="12px ui-sans-serif, system-ui, -apple-system, sans-serif",qa=10,xw=26,Pt=16,Ka=(xw-Pt)/2,Ua=12,vw=180,no=4/3,bw=18,nn=(()=>{let e;return t=>(e===void 0&&(e=document.createElement("canvas").getContext("2d")),e?(e.font=ww,Math.ceil(e.measureText(t).width)):t.length*7)})();function Ew(e){const t=nn(e);if(t<=vw)return[e];const n=e.split(/\s+/).filter(Boolean);if(n.length<2)return[e];const o=2*no*Ka-2*qa,r=Math.max(1,Math.round((-o+Math.sqrt(o*o+4*no*Pt*t))/(2*no*Pt))),i=l=>{const c=[];let u="";for(const d of n){const f=u===""?d:u+" "+d;u!==""&&nn(f)>l?(c.push(u),u=d):u=f}return u!==""&&c.push(u),c};let s=Math.max(t/r,...n.map(nn)),a=i(s);for(;a.length>r;)s*=1.15,a=i(s);return a}const _w=(e,t)=>e.kind==="empty"?Ua:Math.max(...t.map(nn))+2*qa+(e.kind==="unit"?bw:0),Nw=(e,t)=>e.kind==="empty"?Ua:t.length*Pt+2*Ka,Ii=(e,t)=>`${(e+1)/(t+1)*100}%`,Sw=e=>e.kind==="unit"?"unit":e.kind==="stub"?"ref":e.valueType==="number"?"n":e.valueType==="boolean"?"b":"s";function kw({data:e}){const{node:t,lines:n,width:o,height:r,sources:i,targets:s,onNavigate:a}=e,l=t.path!==null;return P.jsxs("div",{className:`xyflow-node xyflow-node-${t.kind}${l?" xyflow-node-nav":""}`,style:{width:o,height:r},title:t.path?`${t.path} — double-click to open`:t.label,"data-node-path":t.path??void 0,onDoubleClick:l?c=>{c.stopPropagation(),a(t.path)}:void 0,children:[s.map((c,u)=>P.jsx(ct,{id:c,type:"target",position:Z.Left,style:{top:Ii(u,s.length)}},c)),t.kind==="unit"&&(()=>{const c=gl("omni",t.format??null);return P.jsx("span",{className:"xyflow-unit-icon "+c.cls,title:c.title,"data-yo-chrome":!0,children:c.glyph})})(),t.kind==="empty"?null:P.jsx("span",{className:Sw(t),style:{lineHeight:`${Pt}px`,textAlign:"center"},children:n.map((c,u)=>P.jsxs(T.Fragment,{children:[u>0&&P.jsx("br",{}),c]},u))}),i.map((c,u)=>P.jsx(ct,{id:c,type:"source",position:Z.Right,style:{top:Ii(u,i.length)}},c))]})}const Cw={yamlover:kw};function Mw({id:e,sourceX:t,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:s,style:a,markerStart:l,markerEnd:c,data:u}){const[d]=$o({sourceX:t,sourceY:n,sourcePosition:o,targetX:r,targetY:i,targetPosition:s}),f=u??{},h=f.kind??"contain",g=f.key??null,x=f.ordinal??null;return g===null&&x===null?P.jsx(lt,{id:e,path:d,style:a,markerStart:l,markerEnd:c}):P.jsxs(P.Fragment,{children:[P.jsx(lt,{id:e,path:d,style:a,markerStart:l,markerEnd:c}),P.jsx("text",{className:`xyflow-edge-label xyflow-edge-${h}${g===null?" xyflow-edge-ordinal":""}`,dy:-5,children:P.jsxs("textPath",{href:`#${e}`,startOffset:"45%",textAnchor:"middle",children:[x!==null?P.jsx("tspan",{className:"n",children:x}):null,x!==null&&g!==null?P.jsx("tspan",{className:"punct",children:": "}):null,g!==null?P.jsx("tspan",{className:"k",children:g}):null]})})]})}const Iw={yamlover:Mw};function Ow({uid:e}){return P.jsx("svg",{className:"xyflow-markers",width:"0",height:"0","aria-hidden":"true",children:P.jsxs("defs",{children:[P.jsx("marker",{id:`${e}-pull-end`,viewBox:"0 0 10 10",refX:"0",refY:"5",markerWidth:"10",markerHeight:"10",markerUnits:"userSpaceOnUse",orient:"auto",children:P.jsx("circle",{className:"xyflow-end xyflow-end-pull",cx:"5",cy:"5",r:"3.5"})}),P.jsxs("marker",{id:`${e}-push-end`,viewBox:"0 0 26 12",refX:"26",refY:"6",markerWidth:"26",markerHeight:"12",markerUnits:"userSpaceOnUse",orient:"auto",children:[P.jsx("circle",{className:"xyflow-end xyflow-end-push",cx:"9",cy:"6",r:"3.5"}),P.jsx("path",{className:"xyflow-arrow",d:"M16,1 L26,6 L16,11 z"})]})]})})}const Pw=e=>e.kind==="deref"?{strokeDasharray:"6 3",strokeWidth:1.4,stroke:"var(--fg)"}:e.kind==="anchor"?{strokeDasharray:"1 3 5 3",strokeWidth:1.4,stroke:"var(--fg)"}:e.kind==="both"?{strokeDasharray:"6 3 1 3",strokeWidth:1.6,stroke:"var(--fg)"}:e.key===null?{strokeWidth:.9,stroke:"var(--dim)"}:{strokeWidth:1.4,stroke:"var(--fg)"},Aw=20,Oi=12;function $w(e,t,n){const o=new Map,r=new Map;e.edges.forEach((u,d)=>{u.kind!=="contain"||o.has(u.target)||(o.set(u.target,u.source),r.set(u.target,u.ordinal??d))});const i=[...new Set(e.nodes.map(u=>t.get(u.id).x))].sort((u,d)=>u-d),s=new Map;let a=0;i.forEach((u,d)=>{d>0&&u-i[d-1]>Aw&&a++,s.set(u,a)});const l=new Map;e.nodes.forEach(u=>{const d=s.get(t.get(u.id).x),f=l.get(d)??[];f.length===0&&l.set(d,f),f.push(u.id)});const c=new Set;for(const u of[...l.keys()].sort((d,f)=>d-f)){const d=l.get(u),f=y=>{const p=o.get(y);return p!==void 0&&c.has(p)?t.get(p).y:t.get(y).y},h=d.map(y=>t.get(y).y).sort((y,p)=>y-p),g=new Map(d.map((y,p)=>[y,p])),x=[...d].sort((y,p)=>f(y)-f(p)||(r.get(y)??0)-(r.get(p)??0)||g.get(y)-g.get(p));if(x.forEach((y,p)=>{t.get(y).y=h[p]}),n){let y=-1/0;for(const p of x){const E=t.get(p),m=n(p);E.y-m/2<y+Oi&&(E.y=y+Oi+m/2),y=E.y+m/2}}for(const y of d)c.add(y)}}function Tw(e,t,n){e={nodes:e.nodes,edges:e.edges.map(f=>({...f,id:n+f.id}))};const o=new Ni.graphlib.Graph;o.setDefaultEdgeLabel(()=>({})),o.setGraph({rankdir:"LR",nodesep:30,ranksep:150});const r=new Map(e.nodes.map(f=>[f.id,f.kind==="empty"?[]:Ew(f.label)])),i=new Map(e.nodes.map(f=>[f.id,{width:_w(f,r.get(f.id)),height:Nw(f,r.get(f.id))}]));e.nodes.forEach(f=>o.setNode(f.id,{...i.get(f.id)})),e.edges.forEach(f=>o.setEdge(f.source,f.target)),Ni.layout(o);const s=new Map(e.nodes.map(f=>[f.id,{x:o.node(f.id)?.x??0,y:o.node(f.id)?.y??0}]));$w(e,s,f=>i.get(f).height);const a=f=>s.get(f)?.y??0,l=new Map(e.nodes.map(f=>[f.id,[]])),c=new Map(e.nodes.map(f=>[f.id,[]]));for(const f of[...e.edges].sort((h,g)=>a(h.target)-a(g.target)))l.get(f.source)?.push(f.id);for(const f of[...e.edges].sort((h,g)=>a(h.source)-a(g.source)))c.get(f.target)?.push(f.id);const u=e.nodes.map(f=>{const{width:h,height:g}=i.get(f.id),x=s.get(f.id);return{id:f.id,type:"yamlover",data:{node:f,lines:r.get(f.id),width:h,height:g,sources:l.get(f.id)??[],targets:c.get(f.id)??[],onNavigate:t},position:{x:x.x-h/2,y:x.y-g/2}}}),d=e.edges.map(f=>{const h=Pw(f),g=f.kind==="deref"||f.kind==="both",x=f.kind==="anchor"||f.kind==="both";return{id:f.id,source:f.source,target:f.target,sourceHandle:f.id,targetHandle:f.id,type:"yamlover",data:{kind:f.kind,key:f.key,ordinal:f.ordinal},style:h,...g?{markerStart:`${n}-pull-end`}:{},markerEnd:x?`${n}-push-end`:{type:kt.ArrowClosed,color:h.stroke,width:14,height:14}}});return{nodes:u,edges:d}}function xo({node:e,onNavigate:t,className:n,interactive:o=!1,openPath:r}){const i=T.useRef(null),s=T.useRef(null);pl(i,14,o);const a=T.useId().replace(/[^A-Za-z0-9_-]/g,""),l=hl(),c=T.useMemo(()=>Tw(pw(e,{fold:l}),t,a),[e,t,a,l]),[u,d,f]=d0(c.nodes);T.useEffect(()=>d(c.nodes),[c,d]);const h=g=>{const x=s.current;if(!x||g.button!==0||!yw(g))return;g.preventDefault(),g.stopPropagation();const y={x:g.clientX,y:g.clientY},p=x.getViewport(),E=v=>x.setViewport({x:p.x+v.clientX-y.x,y:p.y+v.clientY-y.y,zoom:p.zoom}),m=()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",m)};document.addEventListener("mousemove",E),document.addEventListener("mouseup",m)};return c.nodes.length===0?P.jsx("p",{className:"csv-empty",children:"nothing to draw"}):P.jsxs("div",{ref:i,className:n,onMouseDownCapture:o?h:void 0,onDoubleClick:r?()=>t(r):void 0,title:r?"Double-click to open the graph on its own page":void 0,children:[P.jsx(Ow,{uid:a}),P.jsx(u0,{nodes:u,edges:c.edges,onNodesChange:o?f:void 0,nodeTypes:Cw,edgeTypes:Iw,fitView:!0,nodesDraggable:o,elementsSelectable:o,zoomOnDoubleClick:!1,...o?{onInit:g=>{s.current=g},panOnDrag:[2],panOnScroll:!0,zoomOnScroll:!1,zoomActivationKeyCode:mw,onPaneContextMenu:g=>g.preventDefault()}:{panOnDrag:!1,panOnScroll:!1,zoomOnScroll:!1,zoomOnPinch:!1,preventScrolling:!1},children:o&&P.jsx(E0,{position:"top-left",showInteractive:!1})})]})}function Rw({node:e,onNavigate:t}){return P.jsx(xo,{node:e,onNavigate:t,className:"xyflow-view",interactive:!0})}function zw({chunk:e,onNavigate:t}){const[n,o]=T.useState(null),[r,i]=T.useState(null),s=(xn(e.value)!=null||Array.isArray(e.value))&&!ul(e.value,e.path),a=dl(s?null:e.path);if(T.useEffect(()=>{if(s)return;let l=!1;return fl(e.path,null).then(c=>{l||(o(c),i(null))}).catch(c=>!l&&i(c.message)),()=>{l=!0}},[e.path,s,a]),s){const l={path:e.path,type:e.type,format:e.format,concrete:null,documentPath:e.documentPath,title:null,description:null,value:e.value};return P.jsx(xo,{node:l,onNavigate:t,className:"xyflow-chunk",openPath:e.path})}return r?P.jsxs("p",{className:"csv-empty",children:["graph failed to load: ",r]}):n?P.jsx(xo,{node:n,onNavigate:t,className:"xyflow-chunk",openPath:e.path}):P.jsx("p",{className:"csv-empty",children:"…"})}export{zw as XyflowChunk,Rw as XyflowView,$w as reseatInRelationOrder,Ew as wrapLabel};