agent-runtime-map 0.8.0

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.
@@ -0,0 +1,7 @@
1
+ import{r as Er,g as ga,R as pa,a as D,j as A,b as ma}from"./react-C8zC5XaP.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 ya={value:()=>{}};function Kt(){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 Tt(n)}function Tt(e){this._=e}function xa(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}})}Tt.prototype=Kt.prototype={constructor:Tt,on:function(e,t){var n=this._,o=xa(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=wa(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]=go(n[r],e.name,t);else if(t==null)for(r in n)n[r]=go(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 Tt(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 wa(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function go(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ya,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Cn="http://www.w3.org/1999/xhtml";const po={svg:"http://www.w3.org/2000/svg",xhtml:Cn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Qt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),po.hasOwnProperty(t)?{space:po[t],local:e}:e}function va(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Cn&&t.documentElement.namespaceURI===Cn?t.createElement(e):t.createElementNS(n,e)}}function ba(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Sr(e){var t=Qt(e);return(t.local?ba:va)(t)}function _a(){}function On(e){return e==null?_a:function(){return this.querySelector(e)}}function Ea(e){typeof e!="function"&&(e=On(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),c,l,u=0;u<s;++u)(c=i[u])&&(l=e.call(c,c.__data__,u,i))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new le(o,this._parents)}function Sa(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Na(){return[]}function Nr(e){return e==null?Na:function(){return this.querySelectorAll(e)}}function Ca(e){return function(){return Sa(e.apply(this,arguments))}}function Ma(e){typeof e=="function"?e=Ca(e):e=Nr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new le(o,r)}function Cr(e){return function(){return this.matches(e)}}function Mr(e){return function(t){return t.matches(e)}}var Ia=Array.prototype.find;function ka(e){return function(){return Ia.call(this.children,e)}}function Aa(){return this.firstElementChild}function $a(e){return this.select(e==null?Aa:ka(typeof e=="function"?e:Mr(e)))}var Pa=Array.prototype.filter;function Da(){return Array.from(this.children)}function Ta(e){return function(){return Pa.call(this.children,e)}}function za(e){return this.selectAll(e==null?Da:Ta(typeof e=="function"?e:Mr(e)))}function Ha(e){typeof e!="function"&&(e=Cr(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]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new le(o,this._parents)}function Ir(e){return new Array(e.length)}function Ra(){return new le(this._enter||this._groups.map(Ir),this._parents)}function Vt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Vt.prototype={constructor:Vt,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 La(e){return function(){return e}}function Va(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Vt(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function Oa(e,t,n,o,r,i,s){var a,c,l=new Map,u=t.length,f=i.length,d=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(d[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?r[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,i[a],a,i)+"",(c=l.get(h))?(o[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new Vt(e,i[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(r[a]=c)}function Ba(e){return e.__data__}function Fa(e,t){if(!arguments.length)return Array.from(this,Ba);var n=t?Oa:Va,o=this._parents,r=this._groups;typeof e!="function"&&(e=La(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var u=o[l],f=r[l],d=f.length,h=ja(e.call(u,u&&u.__data__,l,o)),g=h.length,v=a[l]=new Array(g),x=s[l]=new Array(g),m=c[l]=new Array(d);n(u,f,v,x,m,h,t);for(var _=0,p=0,w,C;_<g;++_)if(w=v[_]){for(_>=p&&(p=_+1);!(C=x[p])&&++p<g;);w._next=C||null}}return s=new le(s,o),s._enter=a,s._exit=c,s}function ja(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Xa(){return new le(this._exit||this._groups.map(Ir),this._parents)}function Ya(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 Za(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),c=0;c<s;++c)for(var l=n[c],u=o[c],f=l.length,d=a[c]=new Array(f),h,g=0;g<f;++g)(h=l[g]||u[g])&&(d[g]=h);for(;c<r;++c)a[c]=n[c];return new le(a,this._parents)}function Wa(){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 qa(e){e||(e=Ga);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}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,c=r[i]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new le(r,this._parents).order()}function Ga(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ua(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ka(){return Array.from(this)}function Qa(){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 Ja(){let e=0;for(const t of this)++e;return e}function ec(){return!this.node()}function tc(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 nc(e){return function(){this.removeAttribute(e)}}function oc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rc(e,t){return function(){this.setAttribute(e,t)}}function ic(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function sc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ac(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 cc(e,t){var n=Qt(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?oc:nc:typeof t=="function"?n.local?ac:sc:n.local?ic:rc)(n,t))}function kr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function lc(e){return function(){this.style.removeProperty(e)}}function uc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function dc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function fc(e,t,n){return arguments.length>1?this.each((t==null?lc:typeof t=="function"?dc:uc)(e,t,n??"")):Ke(this.node(),e)}function Ke(e,t){return e.style.getPropertyValue(t)||kr(e).getComputedStyle(e,null).getPropertyValue(t)}function hc(e){return function(){delete this[e]}}function gc(e,t){return function(){this[e]=t}}function pc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mc(e,t){return arguments.length>1?this.each((t==null?hc:typeof t=="function"?pc:gc)(e,t)):this.node()[e]}function Ar(e){return e.trim().split(/^|\s+/)}function Bn(e){return e.classList||new $r(e)}function $r(e){this._node=e,this._names=Ar(e.getAttribute("class")||"")}$r.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 Pr(e,t){for(var n=Bn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Dr(e,t){for(var n=Bn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function yc(e){return function(){Pr(this,e)}}function xc(e){return function(){Dr(this,e)}}function wc(e,t){return function(){(t.apply(this,arguments)?Pr:Dr)(this,e)}}function vc(e,t){var n=Ar(e+"");if(arguments.length<2){for(var o=Bn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?wc:t?yc:xc)(n,t))}function bc(){this.textContent=""}function _c(e){return function(){this.textContent=e}}function Ec(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Sc(e){return arguments.length?this.each(e==null?bc:(typeof e=="function"?Ec:_c)(e)):this.node().textContent}function Nc(){this.innerHTML=""}function Cc(e){return function(){this.innerHTML=e}}function Mc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ic(e){return arguments.length?this.each(e==null?Nc:(typeof e=="function"?Mc:Cc)(e)):this.node().innerHTML}function kc(){this.nextSibling&&this.parentNode.appendChild(this)}function Ac(){return this.each(kc)}function $c(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pc(){return this.each($c)}function Dc(e){var t=typeof e=="function"?e:Sr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Tc(){return null}function zc(e,t){var n=typeof e=="function"?e:Sr(e),o=t==null?Tc:typeof t=="function"?t:On(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Hc(){var e=this.parentNode;e&&e.removeChild(this)}function Rc(){return this.each(Hc)}function Lc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Oc(e){return this.select(e?Vc:Lc)}function Bc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Fc(e){return function(t){e.call(this,t,this.__data__)}}function jc(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 Xc(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 Yc(e,t,n){return function(){var o=this.__on,r,i=Fc(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 Zc(e,t,n){var o=jc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(r=0,u=a[c];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Yc:Xc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Tr(e,t,n){var o=kr(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 Wc(e,t){return function(){return Tr(this,e,t)}}function qc(e,t){return function(){return Tr(this,e,t.apply(this,arguments))}}function Gc(e,t){return this.each((typeof t=="function"?qc:Wc)(e,t))}function*Uc(){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 zr=[null];function le(e,t){this._groups=e,this._parents=t}function wt(){return new le([[document.documentElement]],zr)}function Kc(){return this}le.prototype=wt.prototype={constructor:le,select:Ea,selectAll:Ma,selectChild:$a,selectChildren:za,filter:Ha,data:Fa,enter:Ra,exit:Xa,join:Ya,merge:Za,selection:Kc,order:Wa,sort:qa,call:Ua,nodes:Ka,node:Qa,size:Ja,empty:ec,each:tc,attr:cc,style:fc,property:mc,classed:vc,text:Sc,html:Ic,raise:Ac,lower:Pc,append:Dc,insert:zc,remove:Rc,clone:Oc,datum:Bc,on:Zc,dispatch:Gc,[Symbol.iterator]:Uc};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],zr)}function Qc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Qc(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 Jc={passive:!1},ut={capture:!0,passive:!1};function hn(e){e.stopImmediatePropagation()}function Ge(e){e.preventDefault(),e.stopImmediatePropagation()}function Hr(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Ge,ut);"onselectstart"in t?n.on("selectstart.drag",Ge,ut):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Rr(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ge,ut),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 Nt=e=>()=>e;function Mn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,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:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Mn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function el(e){return!e.ctrlKey&&!e.button}function tl(){return this.parentNode}function nl(e,t){return t??{x:e.x,y:e.y}}function ol(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lr(){var e=el,t=tl,n=nl,o=ol,r={},i=Kt("start","drag","end"),s=0,a,c,l,u,f=0;function d(w){w.on("mousedown.drag",h).filter(o).on("touchstart.drag",x).on("touchmove.drag",m,Jc).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,C){if(!(u||!e.call(this,w,C))){var b=p(this,t.call(this,w,C),w,C,"mouse");b&&(ce(w.view).on("mousemove.drag",g,ut).on("mouseup.drag",v,ut),Hr(w.view),hn(w),l=!1,a=w.clientX,c=w.clientY,b("start",w))}}function g(w){if(Ge(w),!l){var C=w.clientX-a,b=w.clientY-c;l=C*C+b*b>f}r.mouse("drag",w)}function v(w){ce(w.view).on("mousemove.drag mouseup.drag",null),Rr(w.view,l),Ge(w),r.mouse("end",w)}function x(w,C){if(e.call(this,w,C)){var b=w.changedTouches,N=t.call(this,w,C),I=b.length,k,B;for(k=0;k<I;++k)(B=p(this,N,w,C,b[k].identifier,b[k]))&&(hn(w),B("start",w,b[k]))}}function m(w){var C=w.changedTouches,b=C.length,N,I;for(N=0;N<b;++N)(I=r[C[N].identifier])&&(Ge(w),I("drag",w,C[N]))}function _(w){var C=w.changedTouches,b=C.length,N,I;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<b;++N)(I=r[C[N].identifier])&&(hn(w),I("end",w,C[N]))}function p(w,C,b,N,I,k){var B=i.copy(),T=de(k||b,C),L,H,y;if((y=n.call(w,new Mn("beforestart",{sourceEvent:b,target:d,identifier:I,active:s,x:T[0],y:T[1],dx:0,dy:0,dispatch:B}),N))!=null)return L=y.x-T[0]||0,H=y.y-T[1]||0,function E(S,M,$){var P=T,R;switch(S){case"start":r[I]=E,R=s++;break;case"end":delete r[I],--s;case"drag":T=de($||M,C),R=s;break}B.call(S,w,new Mn(S,{sourceEvent:M,subject:y,target:d,identifier:I,active:R,x:T[0]+L,y:T[1]+H,dx:T[0]-P[0],dy:T[1]-P[1],dispatch:B}),N)}}return d.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Nt(!!w),d):e},d.container=function(w){return arguments.length?(t=typeof w=="function"?w:Nt(w),d):t},d.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Nt(w),d):n},d.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:Nt(!!w),d):o},d.on=function(){var w=i.on.apply(i,arguments);return w===i?d:w},d.clickDistance=function(w){return arguments.length?(f=(w=+w)*w,d):Math.sqrt(f)},d}function Fn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Vr(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function vt(){}var dt=.7,Ot=1/dt,Ue="\\s*([+-]?\\d+)\\s*",ft="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",rl=/^#([0-9a-f]{3,8})$/,il=new RegExp(`^rgb\\(${Ue},${Ue},${Ue}\\)$`),sl=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),al=new RegExp(`^rgba\\(${Ue},${Ue},${Ue},${ft}\\)$`),cl=new RegExp(`^rgba\\(${be},${be},${be},${ft}\\)$`),ll=new RegExp(`^hsl\\(${ft},${be},${be}\\)$`),ul=new RegExp(`^hsla\\(${ft},${be},${be},${ft}\\)$`),mo={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};Fn(vt,Fe,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:yo,formatHex:yo,formatHex8:dl,formatHsl:fl,formatRgb:xo,toString:xo});function yo(){return this.rgb().formatHex()}function dl(){return this.rgb().formatHex8()}function fl(){return Or(this).formatHsl()}function xo(){return this.rgb().formatRgb()}function Fe(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=rl.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?wo(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ct(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ct(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=il.exec(e))?new ae(t[1],t[2],t[3],1):(t=sl.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=al.exec(e))?Ct(t[1],t[2],t[3],t[4]):(t=cl.exec(e))?Ct(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ll.exec(e))?_o(t[1],t[2]/100,t[3]/100,1):(t=ul.exec(e))?_o(t[1],t[2]/100,t[3]/100,t[4]):mo.hasOwnProperty(e)?wo(mo[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function wo(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function Ct(e,t,n,o){return o<=0&&(e=t=n=NaN),new ae(e,t,n,o)}function hl(e){return e instanceof vt||(e=Fe(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function In(e,t,n,o){return arguments.length===1?hl(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}Fn(ae,In,Vr(vt,{brighter(e){return e=e==null?Ot:Math.pow(Ot,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?dt:Math.pow(dt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Oe(this.r),Oe(this.g),Oe(this.b),Bt(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:vo,formatHex:vo,formatHex8:gl,formatRgb:bo,toString:bo}));function vo(){return`#${Ve(this.r)}${Ve(this.g)}${Ve(this.b)}`}function gl(){return`#${Ve(this.r)}${Ve(this.g)}${Ve(this.b)}${Ve((isNaN(this.opacity)?1:this.opacity)*255)}`}function bo(){const e=Bt(this.opacity);return`${e===1?"rgb(":"rgba("}${Oe(this.r)}, ${Oe(this.g)}, ${Oe(this.b)}${e===1?")":`, ${e})`}`}function Bt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Oe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ve(e){return e=Oe(e),(e<16?"0":"")+e.toString(16)}function _o(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fe(e,t,n,o)}function Or(e){if(e instanceof fe)return new fe(e.h,e.s,e.l,e.opacity);if(e instanceof vt||(e=Fe(e)),!e)return new fe;if(e instanceof fe)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,c=(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/=c<.5?i+r:2-i-r,s*=60):a=c>0&&c<1?0:s,new fe(s,a,c,e.opacity)}function pl(e,t,n,o){return arguments.length===1?Or(e):new fe(e,t,n,o??1)}function fe(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}Fn(fe,pl,Vr(vt,{brighter(e){return e=e==null?Ot:Math.pow(Ot,e),new fe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?dt:Math.pow(dt,e),new fe(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(gn(e>=240?e-240:e+120,r,o),gn(e,r,o),gn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new fe(Eo(this.h),Mt(this.s),Mt(this.l),Bt(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=Bt(this.opacity);return`${e===1?"hsl(":"hsla("}${Eo(this.h)}, ${Mt(this.s)*100}%, ${Mt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Eo(e){return e=(e||0)%360,e<0?e+360:e}function Mt(e){return Math.max(0,Math.min(1,e||0))}function gn(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 jn=e=>()=>e;function ml(e,t){return function(n){return e+n*t}}function yl(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 xl(e){return(e=+e)==1?Br:function(t,n){return n-t?yl(t,n,e):jn(isNaN(t)?n:t)}}function Br(e,t){var n=t-e;return n?ml(e,n):jn(isNaN(e)?t:e)}const Ft=(function e(t){var n=xl(t);function o(r,i){var s=n((r=In(r)).r,(i=In(i)).r),a=n(r.g,i.g),c=n(r.b,i.b),l=Br(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=c(u),r.opacity=l(u),r+""}}return o.gamma=e,o})(1);function wl(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 vl(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function bl(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]=ct(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 _l(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function ve(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function El(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]=ct(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var kn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pn=new RegExp(kn.source,"g");function Sl(e){return function(){return e}}function Nl(e){return function(t){return e(t)+""}}function Fr(e,t){var n=kn.lastIndex=pn.lastIndex=0,o,r,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(o=kn.exec(e))&&(r=pn.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,c.push({i:s,x:ve(o,r)})),n=pn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?Nl(c[0].x):Sl(t):(t=c.length,function(l){for(var u=0,f;u<t;++u)a[(f=c[u]).i]=f.x(l);return a.join("")})}function ct(e,t){var n=typeof t,o;return t==null||n==="boolean"?jn(t):(n==="number"?ve:n==="string"?(o=Fe(t))?(t=o,Ft):Fr:t instanceof Fe?Ft:t instanceof Date?_l:vl(t)?wl:Array.isArray(t)?bl:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?El:ve)(e,t)}var So=180/Math.PI,An={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function jr(e,t,n,o,r,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*o)&&(n-=e*c,o-=t*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),e*o<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*So,skewX:Math.atan(c)*So,scaleX:s,scaleY:a}}var It;function Cl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?An:jr(t.a,t.b,t.c,t.d,t.e,t.f)}function Ml(e){return e==null||(It||(It=document.createElementNS("http://www.w3.org/2000/svg","g")),It.setAttribute("transform",e),!(e=It.transform.baseVal.consolidate()))?An:(e=e.matrix,jr(e.a,e.b,e.c,e.d,e.e,e.f))}function Xr(e,t,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,u,f,d,h,g){if(l!==f||u!==d){var v=h.push("translate(",null,t,null,n);g.push({i:v-4,x:ve(l,f)},{i:v-2,x:ve(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(r(f)+"rotate(",null,o)-2,x:ve(l,u)})):u&&f.push(r(f)+"rotate("+u+o)}function a(l,u,f,d){l!==u?d.push({i:f.push(r(f)+"skewX(",null,o)-2,x:ve(l,u)}):u&&f.push(r(f)+"skewX("+u+o)}function c(l,u,f,d,h,g){if(l!==f||u!==d){var v=h.push(r(h)+"scale(",null,",",null,")");g.push({i:v-4,x:ve(l,f)},{i:v-2,x:ve(u,d)})}else(f!==1||d!==1)&&h.push(r(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),i(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var g=-1,v=d.length,x;++g<v;)f[(x=d[g]).i]=x.x(h);return f.join("")}}}var Il=Xr(Cl,"px, ","px)","deg)"),kl=Xr(Ml,", ",")",")"),Al=1e-12;function No(e){return((e=Math.exp(e))+1/e)/2}function $l(e){return((e=Math.exp(e))-1/e)/2}function Pl(e){return((e=Math.exp(2*e))-1)/(e+1)}const zt=(function e(t,n,o){function r(i,s){var a=i[0],c=i[1],l=i[2],u=s[0],f=s[1],d=s[2],h=u-a,g=f-c,v=h*h+g*g,x,m;if(v<Al)m=Math.log(d/l)/t,x=function(N){return[a+N*h,c+N*g,l*Math.exp(t*N*m)]};else{var _=Math.sqrt(v),p=(d*d-l*l+o*v)/(2*l*n*_),w=(d*d-l*l-o*v)/(2*d*n*_),C=Math.log(Math.sqrt(p*p+1)-p),b=Math.log(Math.sqrt(w*w+1)-w);m=(b-C)/t,x=function(N){var I=N*m,k=No(C),B=l/(n*_)*(k*Pl(t*I+C)-$l(C));return[a+B*h,c+B*g,l*k/No(t*I+C)]}}return x.duration=m*1e3*t/Math.SQRT2,x}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},r})(Math.SQRT2,2,4);var Qe=0,st=0,rt=0,Yr=1e3,jt,at,Xt=0,je=0,Jt=0,ht=typeof performance=="object"&&performance.now?performance:Date,Zr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xn(){return je||(Zr(Dl),je=ht.now()+Jt)}function Dl(){je=0}function Yt(){this._call=this._time=this._next=null}Yt.prototype=Wr.prototype={constructor:Yt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xn():+n)+(t==null?0:+t),!this._next&&at!==this&&(at?at._next=this:jt=this,at=this),this._call=e,this._time=n,$n()},stop:function(){this._call&&(this._call=null,this._time=1/0,$n())}};function Wr(e,t,n){var o=new Yt;return o.restart(e,t,n),o}function Tl(){Xn(),++Qe;for(var e=jt,t;e;)(t=je-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Co(){je=(Xt=ht.now())+Jt,Qe=st=0;try{Tl()}finally{Qe=0,Hl(),je=0}}function zl(){var e=ht.now(),t=e-Xt;t>Yr&&(Jt-=t,Xt=e)}function Hl(){for(var e,t=jt,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:jt=n);at=e,$n(o)}function $n(e){if(!Qe){st&&(st=clearTimeout(st));var t=e-je;t>24?(e<1/0&&(st=setTimeout(Co,e-ht.now()-Jt)),rt&&(rt=clearInterval(rt))):(rt||(Xt=ht.now(),rt=setInterval(zl,Yr)),Qe=1,Zr(Co))}}function Mo(e,t,n){var o=new Yt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Rl=Kt("start","end","cancel","interrupt"),Ll=[],qr=0,Io=1,Pn=2,Ht=3,ko=4,Dn=5,Rt=6;function en(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Vl(e,n,{name:t,index:o,group:r,on:Rl,tween:Ll,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:qr})}function Yn(e,t){var n=me(e,t);if(n.state>qr)throw new Error("too late; already scheduled");return n}function _e(e,t){var n=me(e,t);if(n.state>Ht)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Vl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Wr(i,0,n.time);function i(l){n.state=Io,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,d,h;if(n.state!==Io)return c();for(u in o)if(h=o[u],h.name===n.name){if(h.state===Ht)return Mo(s);h.state===ko?(h.state=Rt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=Rt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(Mo(function(){n.state===Ht&&(n.state=ko,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Pn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Pn){for(n.state=Ht,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Dn,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===Dn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Rt,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Lt(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>Pn&&o.state<Dn,o.state=Rt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Ol(e){return this.each(function(){Lt(this,e)})}function Bl(e,t){var n,o;return function(){var r=_e(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 Fl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=_e(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function jl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(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?Bl:Fl)(n,e,t))}function Zn(e,t,n){var o=e._id;return e.each(function(){var r=_e(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function Gr(e,t){var n;return(typeof t=="number"?ve:t instanceof Fe?Ft:(n=Fe(t))?(t=n,Ft):Fr)(e,t)}function Xl(e){return function(){this.removeAttribute(e)}}function Yl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Zl(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 Wl(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 ql(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Gl(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Ul(e,t){var n=Qt(e),o=n==="transform"?kl:Gr;return this.attrTween(e,typeof t=="function"?(n.local?Gl:ql)(n,o,Zn(this,"attr."+e,t)):t==null?(n.local?Yl:Xl)(n):(n.local?Wl:Zl)(n,o,t))}function Kl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ql(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Jl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Ql(e,i)),n}return r._value=t,r}function eu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Kl(e,i)),n}return r._value=t,r}function tu(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=Qt(e);return this.tween(n,(o.local?Jl:eu)(o,t))}function nu(e,t){return function(){Yn(this,e).delay=+t.apply(this,arguments)}}function ou(e,t){return t=+t,function(){Yn(this,e).delay=t}}function ru(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?nu:ou)(t,e)):me(this.node(),t).delay}function iu(e,t){return function(){_e(this,e).duration=+t.apply(this,arguments)}}function su(e,t){return t=+t,function(){_e(this,e).duration=t}}function au(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?iu:su)(t,e)):me(this.node(),t).duration}function cu(e,t){if(typeof t!="function")throw new Error;return function(){_e(this,e).ease=t}}function lu(e){var t=this._id;return arguments.length?this.each(cu(t,e)):me(this.node(),t).ease}function uu(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;_e(this,e).ease=n}}function du(e){if(typeof e!="function")throw new Error;return this.each(uu(this._id,e))}function fu(e){typeof e!="function"&&(e=Cr(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]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new ke(o,this._parents,this._name,this._id)}function hu(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 c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;a<o;++a)s[a]=t[a];return new ke(s,this._parents,this._name,this._id)}function gu(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 pu(e,t,n){var o,r,i=gu(t)?Yn:_e;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function mu(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(pu(n,e,t))}function yu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function xu(){return this.on("end.remove",yu(this._id))}function wu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=On(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,en(l[d],t,n,d,l,me(u,n)));return new ke(i,this._parents,t,n)}function vu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Nr(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,g=me(u,n),v=0,x=d.length;v<x;++v)(h=d[v])&&en(h,t,n,v,d,g);i.push(d),s.push(u)}return new ke(i,s,t,n)}var bu=wt.prototype.constructor;function _u(){return new bu(this._groups,this._parents)}function Eu(e,t){var n,o,r;return function(){var i=Ke(this,e),s=(this.style.removeProperty(e),Ke(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Ur(e){return function(){this.style.removeProperty(e)}}function Su(e,t,n){var o,r=n+"",i;return function(){var s=Ke(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Nu(e,t,n){var o,r,i;return function(){var s=Ke(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ke(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function Cu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=_e(this,e),l=c.on,u=c.value[i]==null?a||(a=Ur(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(s,r=u),c.on=o}}function Mu(e,t,n){var o=(e+="")=="transform"?Il:Gr;return t==null?this.styleTween(e,Eu(e,o)).on("end.style."+e,Ur(e)):typeof t=="function"?this.styleTween(e,Nu(e,o,Zn(this,"style."+e,t))).each(Cu(this._id,e)):this.styleTween(e,Su(e,o,t),n).on("end.style."+e,null)}function Iu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function ku(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&Iu(e,s,n)),o}return i._value=t,i}function Au(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,ku(e,t,n??""))}function $u(e){return function(){this.textContent=e}}function Pu(e){return function(){var t=e(this);this.textContent=t??""}}function Du(e){return this.tween("text",typeof e=="function"?Pu(Zn(this,"text",e)):$u(e==null?"":e+""))}function Tu(e){return function(t){this.textContent=e.call(this,t)}}function zu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Tu(r)),t}return o._value=e,o}function Hu(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,zu(e))}function Ru(){for(var e=this._name,t=this._id,n=Kr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=me(c,t);en(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ke(o,this._parents,e,n)}function Lu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=_e(this,o),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var Vu=0;function ke(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Kr(){return++Vu}var Me=wt.prototype;ke.prototype={constructor:ke,select:wu,selectAll:vu,selectChild:Me.selectChild,selectChildren:Me.selectChildren,filter:fu,merge:hu,selection:_u,transition:Ru,call:Me.call,nodes:Me.nodes,node:Me.node,size:Me.size,empty:Me.empty,each:Me.each,on:mu,attr:Ul,attrTween:tu,style:Mu,styleTween:Au,text:Du,textTween:Hu,remove:xu,tween:jl,delay:ru,duration:au,ease:lu,easeVarying:du,end:Lu,[Symbol.iterator]:Me[Symbol.iterator]};function Ou(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Bu={time:null,delay:0,duration:250,ease:Ou};function Fu(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 ju(e){var t,n;e instanceof ke?(t=e._id,e=e._name):(t=Kr(),(n=Bu).time=Xn(),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,c,l=0;l<a;++l)(c=s[l])&&en(c,e,t,l,s,n||Fu(c,t));return new ke(o,this._parents,e,t)}wt.prototype.interrupt=Ol;wt.prototype.transition=ju;const kt=e=>()=>e;function Xu(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 Ie(e,t,n){this.k=e,this.x=t,this.y=n}Ie.prototype={constructor:Ie,scale:function(e){return e===1?this:new Ie(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ie(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 tn=new Ie(1,0,0);Qr.prototype=Ie.prototype;function Qr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return tn;return e.__zoom}function mn(e){e.stopImmediatePropagation()}function it(e){e.preventDefault(),e.stopImmediatePropagation()}function Yu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Zu(){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 Ao(){return this.__zoom||tn}function Wu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Gu(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 Jr(){var e=Yu,t=Zu,n=Gu,o=Wu,r=qu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=zt,l=Kt("start","zoom","end"),u,f,d,h=500,g=150,v=0,x=10;function m(y){y.property("__zoom",Ao).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",T).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,E,S,M){var $=y.selection?y.selection():y;$.property("__zoom",Ao),y!==$?C(y,E,S,M):$.interrupt().each(function(){b(this,arguments).event(M).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},m.scaleBy=function(y,E,S,M){m.scaleTo(y,function(){var $=this.__zoom.k,P=typeof E=="function"?E.apply(this,arguments):E;return $*P},S,M)},m.scaleTo=function(y,E,S,M){m.transform(y,function(){var $=t.apply(this,arguments),P=this.__zoom,R=S==null?w($):typeof S=="function"?S.apply(this,arguments):S,O=P.invert(R),V=typeof E=="function"?E.apply(this,arguments):E;return n(p(_(P,V),R,O),$,s)},S,M)},m.translateBy=function(y,E,S,M){m.transform(y,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),s)},null,M)},m.translateTo=function(y,E,S,M,$){m.transform(y,function(){var P=t.apply(this,arguments),R=this.__zoom,O=M==null?w(P):typeof M=="function"?M.apply(this,arguments):M;return n(tn.translate(O[0],O[1]).scale(R.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof S=="function"?-S.apply(this,arguments):-S),P,s)},M,$)};function _(y,E){return E=Math.max(i[0],Math.min(i[1],E)),E===y.k?y:new Ie(E,y.x,y.y)}function p(y,E,S){var M=E[0]-S[0]*y.k,$=E[1]-S[1]*y.k;return M===y.x&&$===y.y?y:new Ie(y.k,M,$)}function w(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function C(y,E,S,M){y.on("start.zoom",function(){b(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(M).end()}).tween("zoom",function(){var $=this,P=arguments,R=b($,P).event(M),O=t.apply($,P),V=S==null?w(O):typeof S=="function"?S.apply($,P):S,X=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),F=$.__zoom,q=typeof E=="function"?E.apply($,P):E,Q=c(F.invert(V).concat(X/F.k),q.invert(V).concat(X/q.k));return function(W){if(W===1)W=q;else{var z=Q(W),j=X/z[2];W=new Ie(j,V[0]-z[0]*j,V[1]-z[1]*j)}R.zoom(null,W)}})}function b(y,E,S){return!S&&y.__zooming||new N(y,E)}function N(y,E){this.that=y,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,E),this.taps=0}N.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,E){return this.mouse&&y!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var E=ce(this.that).datum();l.call(y,this.that,new Xu(y,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),E)}};function I(y,...E){if(!e.apply(this,arguments))return;var S=b(this,E).event(y),M=this.__zoom,$=Math.max(i[0],Math.min(i[1],M.k*Math.pow(2,o.apply(this,arguments)))),P=de(y);if(S.wheel)(S.mouse[0][0]!==P[0]||S.mouse[0][1]!==P[1])&&(S.mouse[1]=M.invert(S.mouse[0]=P)),clearTimeout(S.wheel);else{if(M.k===$)return;S.mouse=[P,M.invert(P)],Lt(this),S.start()}it(y),S.wheel=setTimeout(R,g),S.zoom("mouse",n(p(_(M,$),S.mouse[0],S.mouse[1]),S.extent,s));function R(){S.wheel=null,S.end()}}function k(y,...E){if(d||!e.apply(this,arguments))return;var S=y.currentTarget,M=b(this,E,!0).event(y),$=ce(y.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",X,!0),P=de(y,S),R=y.clientX,O=y.clientY;Hr(y.view),mn(y),M.mouse=[P,this.__zoom.invert(P)],Lt(this),M.start();function V(F){if(it(F),!M.moved){var q=F.clientX-R,Q=F.clientY-O;M.moved=q*q+Q*Q>v}M.event(F).zoom("mouse",n(p(M.that.__zoom,M.mouse[0]=de(F,S),M.mouse[1]),M.extent,s))}function X(F){$.on("mousemove.zoom mouseup.zoom",null),Rr(F.view,M.moved),it(F),M.event(F).end()}}function B(y,...E){if(e.apply(this,arguments)){var S=this.__zoom,M=de(y.changedTouches?y.changedTouches[0]:y,this),$=S.invert(M),P=S.k*(y.shiftKey?.5:2),R=n(p(_(S,P),M,$),t.apply(this,E),s);it(y),a>0?ce(this).transition().duration(a).call(C,R,M,y):ce(this).call(m.transform,R,M,y)}}function T(y,...E){if(e.apply(this,arguments)){var S=y.touches,M=S.length,$=b(this,E,y.changedTouches.length===M).event(y),P,R,O,V;for(mn(y),R=0;R<M;++R)O=S[R],V=de(O,this),V=[V,this.__zoom.invert(V),O.identifier],$.touch0?!$.touch1&&$.touch0[2]!==V[2]&&($.touch1=V,$.taps=0):($.touch0=V,P=!0,$.taps=1+!!u);u&&(u=clearTimeout(u)),P&&($.taps<2&&(f=V[0],u=setTimeout(function(){u=null},h)),Lt(this),$.start())}}function L(y,...E){if(this.__zooming){var S=b(this,E).event(y),M=y.changedTouches,$=M.length,P,R,O,V;for(it(y),P=0;P<$;++P)R=M[P],O=de(R,this),S.touch0&&S.touch0[2]===R.identifier?S.touch0[0]=O:S.touch1&&S.touch1[2]===R.identifier&&(S.touch1[0]=O);if(R=S.that.__zoom,S.touch1){var X=S.touch0[0],F=S.touch0[1],q=S.touch1[0],Q=S.touch1[1],W=(W=q[0]-X[0])*W+(W=q[1]-X[1])*W,z=(z=Q[0]-F[0])*z+(z=Q[1]-F[1])*z;R=_(R,Math.sqrt(W/z)),O=[(X[0]+q[0])/2,(X[1]+q[1])/2],V=[(F[0]+Q[0])/2,(F[1]+Q[1])/2]}else if(S.touch0)O=S.touch0[0],V=S.touch0[1];else return;S.zoom("touch",n(p(R,O,V),S.extent,s))}}function H(y,...E){if(this.__zooming){var S=b(this,E).event(y),M=y.changedTouches,$=M.length,P,R;for(mn(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),P=0;P<$;++P)R=M[P],S.touch0&&S.touch0[2]===R.identifier?delete S.touch0:S.touch1&&S.touch1[2]===R.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(R=de(R,this),Math.hypot(f[0]-R[0],f[1]-R[1])<x)){var O=ce(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:kt(+y),m):o},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:kt(!!y),m):e},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:kt(!!y),m):r},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:kt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],m):[i[0],i[1]]},m.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(c=y,m):c},m.on=function(){var y=l.on.apply(l,arguments);return y===l?m:y},m.clickDistance=function(y){return arguments.length?(v=(y=+y)*y,m):Math.sqrt(v)},m.tapDistance=function(y){return arguments.length?(x=+y,m):x},m}const pe={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.`},gt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ei=["Enter"," ","Escape"],ti={"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 Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Be;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Be||(Be={}));var pt;(function(e){e.Partial="partial",e.Full="full"})(pt||(pt={}));const ni={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 Zt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Zt||(Zt={}));var Z;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Z||(Z={}));const $o={[Z.Left]:Z.Right,[Z.Right]:Z.Left,[Z.Top]:Z.Bottom,[Z.Bottom]:Z.Top};function oi(e){return e===null?null:e?"valid":"invalid"}const ri=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,Uu=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Wn=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),bt=(e,t=[0,0])=>{const{width:n,height:o}=ye(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Ku=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1;const o=e.reduce((r,i)=>{const s=typeof i=="string";let a=!t.nodeLookup&&!s?i:void 0;return t.nodeLookup&&(a=s?t.nodeLookup.get(i):Wn(i)?i:t.nodeLookup.get(i.id)),a?(n=!0,nn(r,Wt(a,t.nodeOrigin))):r},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?on(o):{x:0,y:0,width:0,height:0}},_t=(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=nn(n,Wt(r)),o=!0)}),o?on(n):{x:0,y:0,width:0,height:0}},qn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/r,c=(t.y-o)/r,l=t.width/r,u=t.height/r,f=[];for(const d of e.values()){const{measured:h,selectable:g=!0,hidden:v=!1}=d;if(s&&!g||v)continue;const x=h.width??d.width??d.initialWidth??0,m=h.height??d.height??d.initialHeight??0,{x:_,y:p}=d.internals.positionAbsolute,w=ci(a,c,l,u,_,p,x,m),C=x*m,b=i&&w>0;(!d.internals.handleBounds||b||w>=C||d.dragging)&&f.push(d)}return f},Qu=(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 Ju(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}=ye(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 ed({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;const a=Ju(e,s),c=_t(a),l=Un(c,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function ii({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:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",pe.error005());else{const{width:h,height:g}=ye(a);h&&g&&(f=[[c,l],[c+h,l+g]])}else a&&Ye(s.extent)&&(f=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const d=Ye(f)?Xe(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",pe.error015()),{position:{x:d.x-c+(s.measured.width??0)*u[0],y:d.y-l+(s.measured.height??0)*u[1]},positionAbsolute:d}}async function td({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),g=!h&&d.parentId&&s.find(v=>v.id===d.parentId);(h||g)&&s.push(d)}const a=new Set(t.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),u=Qu(s,c);for(const d of c)a.has(d.id)&&!u.find(g=>g.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:s};const f=await r({nodes:s,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:s}:{edges:[],nodes:[]}:f}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Xe=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-(n?.width??0)),y:et(e.y,t[0][1],t[1][1]-(n?.height??0))});function si(e,t,n){const{width:o,height:r}=ye(n),{x:i,y:s}=n.internals.positionAbsolute;return Xe(e,[[i,s],[i+o,s+r]],t)}const Po=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,Gn=(e,t,n=15,o=40)=>{const r=Po(e.x,o,t.width-o)*n,i=Po(e.y,o,t.height-o)*n;return[r,i]},nn=(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)}),Tn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),on=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),mt=(e,t=[0,0])=>{const{x:n,y:o}=Wn(e)?e.internals.positionAbsolute:bt(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}},Wt=(e,t=[0,0])=>{const{x:n,y:o}=Wn(e)?e.internals.positionAbsolute:bt(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)}},ai=(e,t)=>on(nn(Tn(e),Tn(t))),ci=(e,t,n,o,r,i,s,a)=>{const c=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),l=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(c*l)},qt=(e,t)=>ci(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Do=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),li=(e,t)=>(n,o)=>{},Et=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),St=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Et(a,s):a},tt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function We(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 nd(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=We(e,n),r=We(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=We(e.top??e.y??0,n),r=We(e.bottom??e.y??0,n),i=We(e.left??e.x??0,t),s=We(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 od(e,t,n,o,r,i){const{x:s,y:a}=tt(e,[t,n,o]),{x:c,y:l}=tt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-c,f=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}const Un=(e,t,n,o,r,i)=>{const s=nd(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),u=et(l,o,r),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*u,g=n/2-d*u,v=od(e,h,g,u,t,n),x={left:Math.min(v.left-s.left,0),top:Math.min(v.top-s.top,0),right:Math.min(v.right-s.right,0),bottom:Math.min(v.bottom-s.bottom,0)};return{x:h-x.left+x.right,y:g-x.top+x.bottom,zoom:u}},yt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function ye(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ui(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function di(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 To(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function rd(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function id(e){return{...ti,...e||{}}}function lt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ge(e),a=St({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:c,y:l}=n?Et(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Kn=e=>({width:e.offsetWidth,height:e.offsetHeight}),fi=e=>e?.getRootNode?.()||window?.document,sd=["INPUT","SELECT","TEXTAREA"];function hi(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:sd.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const gi=e=>"clientX"in e,ge=(e,t)=>{const n=gi(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)}},zo=(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,...Kn(s)}})};function pi({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,u=Math.abs(c-e),f=Math.abs(l-t);return[c,l,u,f]}function At(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ho({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case Z.Left:return[t-At(t-o,i),n];case Z.Right:return[t+At(o-t,i),n];case Z.Top:return[t,n-At(n-r,i)];case Z.Bottom:return[t,n+At(r-n,i)]}}function mi({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:o,targetY:r,targetPosition:i=Z.Top,curvature:s=.25}){const[a,c]=Ho({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=Ho({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,d,h,g]=pi({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${c} ${l},${u} ${o},${r}`,f,d,h,g]}function yi({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 ad({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 cd({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=nn(Wt(e),Wt(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 qt(s,on(i))>0}const ld=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,ud=(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)),dd=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",pe.error006()),t;const o=n.getEdgeId||ld;let r;return ri(e)?r={...e}:r={...e,id:o(e)},ud(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function xi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=yi({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Ro={[Z.Left]:{x:-1,y:0},[Z.Right]:{x:1,y:0},[Z.Top]:{x:0,y:-1},[Z.Bottom]:{x:0,y:1}},fd=({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},Lo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function hd({source:e,sourcePosition:t=Z.Bottom,target:n,targetPosition:o=Z.Top,center:r,offset:i,stepPosition:s}){const a=Ro[t],c=Ro[o],l={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+c.x*i,y:n.y+c.y*i},f=fd({source:l,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",h=f[d];let g=[],v,x;const m={x:0,y:0},_={x:0,y:0},[,,p,w]=yi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(v=r.x??l.x+(u.x-l.x)*s,x=r.y??(l.y+u.y)/2):(v=r.x??(l.x+u.x)/2,x=r.y??l.y+(u.y-l.y)*s);const I=[{x:v,y:l.y},{x:v,y:u.y}],k=[{x:l.x,y:x},{x:u.x,y:x}];a[d]===h?g=d==="x"?I:k:g=d==="x"?k:I}else{const I=[{x:l.x,y:u.y}],k=[{x:u.x,y:l.y}];if(d==="x"?g=a.x===h?k:I:g=a.y===h?I:k,t===o){const y=Math.abs(e[d]-n[d]);if(y<=i){const E=Math.min(i-1,i-y);a[d]===h?m[d]=(l[d]>e[d]?-1:1)*E:_[d]=(u[d]>n[d]?-1:1)*E}}if(t!==o){const y=d==="x"?"y":"x",E=a[d]===c[y],S=l[y]>u[y],M=l[y]<u[y];(a[d]===1&&(!E&&S||E&&M)||a[d]!==1&&(!E&&M||E&&S))&&(g=d==="x"?I:k)}const B={x:l.x+m.x,y:l.y+m.y},T={x:u.x+_.x,y:u.y+_.y},L=Math.max(Math.abs(B.x-g[0].x),Math.abs(T.x-g[0].x)),H=Math.max(Math.abs(B.y-g[0].y),Math.abs(T.y-g[0].y));L>=H?(v=(B.x+T.x)/2,x=g[0].y):(v=g[0].x,x=(B.y+T.y)/2)}const C={x:l.x+m.x,y:l.y+m.y},b={x:u.x+_.x,y:u.y+_.y};return[[e,...C.x!==g[0].x||C.y!==g[0].y?[C]:[],...g,...b.x!==g[g.length-1].x||b.y!==g[g.length-1].y?[b]:[],n],v,x,p,w]}function gd(e,t,n,o){const r=Math.min(Lo(e,t)/2,Lo(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 l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function zn({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:o,targetY:r,targetPosition:i=Z.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:u=.5}){const[f,d,h,g,v]=hd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:u});let x=`M${f[0].x} ${f[0].y}`;for(let m=1;m<f.length-1;m++)x+=gd(f[m-1],f[m],f[m+1],s);return x+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[x,d,h,g,v]}function Vo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function pd(e){const{sourceNode:t,targetNode:n}=e;if(!Vo(t)||!Vo(n))return null;const o=t.internals.handleBounds||Oo(t.handles),r=n.internals.handleBounds||Oo(n.handles),i=Bo(o?.source??[],e.sourceHandle),s=Bo(e.connectionMode===Je.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",pe.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||Z.Bottom,c=s?.position||Z.Top,l=Ze(t,i,a),u=Ze(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function Oo(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 Ze(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??ye(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 Bo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Hn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function md(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(c=>{if(c&&typeof c=="object"){const l=Hn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const wi=1e3,yd=10,Qn={nodeOrigin:[0,0],nodeExtent:gt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},xd={...Qn,checkEquality:!0};function Jn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function wd(e,t,n){const o=Jn(Qn,n);for(const r of e.values())if(r.parentId)to(r,e,t,o);else{const i=bt(r,o.nodeOrigin),s=Ye(r.extent)?r.extent:o.nodeExtent,a=Xe(i,s,ye(r));r.internals.positionAbsolute=a}}function vd(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 eo(e){return e==="manual"}function Rn(e,t,n,o={}){const r=Jn(xd,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!eo(r.zIndexMode)?wi:0;let c=e.length>0,l=!1;t.clear(),n.clear();for(const u of e){let f=s.get(u.id);if(r.checkEquality&&u===f?.internals.userNode)t.set(u.id,f);else{const d=bt(u,r.nodeOrigin),h=Ye(u.extent)?u.extent:r.nodeExtent,g=Xe(d,h,ye(u));f={...r.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:g,handleBounds:vd(u,f),z:vi(u,a,r.zIndexMode),userNode:u}},t.set(u.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),u.parentId&&to(f,t,n,o,i),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function bd(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 to(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Jn(Qn,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bd(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*yd),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const f=i&&!eo(c)?wi:0,{x:d,y:h,z:g}=_d(e,u,s,a,f,c),{positionAbsolute:v}=e.internals,x=d!==v.x||h!==v.y;(x||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:d,y:h}:v,z:g}})}function vi(e,t,n){const o=he(e.zIndex)?e.zIndex:0;return eo(n)?o:o+(e.selected?t:0)}function _d(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,c=ye(e),l=bt(e,n),u=Ye(e.extent)?Xe(l,e.extent,c):l;let f=Xe({x:s+u.x,y:a+u.y},o,c);e.extent==="parent"&&(f=si(f,c,t));const d=vi(e,r,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function no(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 c=i.get(s.parentId)?.expandedRect??mt(a),l=ai(c,s.rect);i.set(s.parentId,{expandedRect:l,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},c)=>{const l=a.internals.positionAbsolute,u=ye(a),f=a.origin??o,d=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,h=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,g=Math.max(u.width,Math.round(s.width)),v=Math.max(u.height,Math.round(s.height)),x=(g-u.width)*f[0],m=(v-u.height)*f[1];(d>0||h>0||x||m)&&(r.push({id:c,type:"position",position:{x:a.position.x-d+x,y:a.position.y-h+m}}),n.get(c)?.forEach(_=>{e.some(p=>p.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+d,y:_.position.y+h}})})),(u.width<s.width||u.height<s.height||d||h)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(d?f[0]*d-x:0),height:v+(h?f[1]*h-m:0)}})}),r}function Ed(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];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}}),c=!0;continue}const v=Kn(h.nodeElement),x=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(x||!g.internals.handleBounds||h.force))){const _=h.nodeElement.getBoundingClientRect(),p=Ye(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;if(g.parentId&&g.extent==="parent"){const b=t.get(g.parentId);b&&(w=si(w,v,b))}else p&&(w=Xe(w,p,v));const C={...g,measured:v,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:zo("source",h.nodeElement,_,f,g.id),target:zo("target",h.nodeElement,_,f,g.id)}}};t.set(g.id,C),g.parentId&&to(C,t,n,{nodeOrigin:r,zIndexMode:s}),c=!0,x&&(l.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:mt(C,r)}))}}if(d.length>0){const h=no(d,t,n,r);l.push(...h)}return{changes:l,updatedInternals:c}}async function Sd({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 Fo(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 c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function bi(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;Fo("source",c,u,e,r,s),Fo("target",c,l,e,i,a),t.set(o.id,o)}}function _i(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:_i(n,t):!1}function jo(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 Nd(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!_i(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 yn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const c=n.get(s)?.internals.userNode;c&&r.push({...c,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 Cd({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=Et(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Md({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},u=null,f=!1,d=null,h=!1,g=!1,v=null;function x({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:C,nodeId:b,nodeClickDistance:N=0}){d=ce(w);function I({x:L,y:H}){const{nodeLookup:y,nodeExtent:E,snapGrid:S,snapToGrid:M,nodeOrigin:$,onNodeDrag:P,onSelectionDrag:R,onError:O,updateNodePositions:V}=t();i={x:L,y:H};let X=!1;const F=a.size>1,q=F&&E?Tn(_t(a)):null,Q=F&&M?Cd({dragItems:a,snapGrid:S,x:L,y:H}):null;for(const[W,z]of a){if(!y.has(W))continue;let j={x:L-z.distance.x,y:H-z.distance.y};M&&(j=Q?{x:Math.round(j.x+Q.x),y:Math.round(j.y+Q.y)}:Et(j,S));let K=null;if(F&&E&&!z.extent&&q){const{positionAbsolute:G}=z.internals,J=G.x-q.x+E[0][0],te=G.x+z.measured.width-q.x2+E[1][0],oe=G.y-q.y+E[0][1],se=G.y+z.measured.height-q.y2+E[1][1];K=[[J,oe],[te,se]]}const{position:U,positionAbsolute:Y}=ii({nodeId:W,nextPosition:j,nodeLookup:y,nodeExtent:K||E,nodeOrigin:$,onError:O});X=X||z.position.x!==U.x||z.position.y!==U.y,z.position=U,z.internals.positionAbsolute=Y}if(g=g||X,!!X&&(V(a,!0),v&&(o||P||!b&&R))){const[W,z]=yn({nodeId:b,dragItems:a,nodeLookup:y});o?.(v,a,W,z),P?.(v,W,z),b||R?.(v,z)}}async function k(){if(!u)return;const{transform:L,panBy:H,autoPanSpeed:y,autoPanOnNodeDrag:E}=t();if(!E){c=!1,cancelAnimationFrame(s);return}const[S,M]=Gn(l,u,y);(S!==0||M!==0)&&(i.x=(i.x??0)-S/L[2],i.y=(i.y??0)-M/L[2],await H({x:S,y:M})&&I(i)),s=requestAnimationFrame(k)}function B(L){const{nodeLookup:H,multiSelectionActive:y,nodesDraggable:E,transform:S,snapGrid:M,snapToGrid:$,selectNodesOnDrag:P,onNodeDragStart:R,onSelectionDragStart:O,unselectNodesAndEdges:V}=t();f=!0,(!P||!C)&&!y&&b&&(H.get(b)?.selected||V()),C&&P&&b&&e?.(b);const X=lt(L.sourceEvent,{transform:S,snapGrid:M,snapToGrid:$,containerBounds:u});if(i=X,a=Nd(H,E,X,b),a.size>0&&(n||R||!b&&O)){const[F,q]=yn({nodeId:b,dragItems:a,nodeLookup:H});n?.(L.sourceEvent,a,F,q),R?.(L.sourceEvent,F,q),b||O?.(L.sourceEvent,q)}}const T=Lr().clickDistance(N).on("start",L=>{const{domNode:H,nodeDragThreshold:y,transform:E,snapGrid:S,snapToGrid:M}=t();u=H?.getBoundingClientRect()||null,h=!1,g=!1,v=L.sourceEvent,y===0&&B(L),i=lt(L.sourceEvent,{transform:E,snapGrid:S,snapToGrid:M,containerBounds:u}),l=ge(L.sourceEvent,u)}).on("drag",L=>{const{autoPanOnNodeDrag:H,transform:y,snapGrid:E,snapToGrid:S,nodeDragThreshold:M,nodeLookup:$}=t(),P=lt(L.sourceEvent,{transform:y,snapGrid:E,snapToGrid:S,containerBounds:u});if(v=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||b&&!$.has(b))&&(h=!0),!h){if(!c&&H&&f&&(c=!0,k()),!f){const R=ge(L.sourceEvent,u),O=R.x-l.x,V=R.y-l.y;Math.sqrt(O*O+V*V)>M&&B(L)}(i.x!==P.xSnapped||i.y!==P.ySnapped)&&a&&f&&(l=ge(L.sourceEvent,u),I(P))}}).on("end",L=>{if(!f||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,f=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:H,updateNodePositions:y,onNodeDragStop:E,onSelectionDragStop:S}=t();if(g&&(y(a,!1),g=!1),r||E||!b&&S){const[M,$]=yn({nodeId:b,dragItems:a,nodeLookup:H,dragging:!1});r?.(L.sourceEvent,a,M,$),E?.(L.sourceEvent,M,$),b||S?.(L.sourceEvent,$)}}}).filter(L=>{const H=L.target;return!L.button&&(!_||!jo(H,`.${_}`,w))&&(!p||jo(H,p,w))});d.call(T)}function m(){d?.on(".drag",null)}return{update:x,destroy:m}}function Id(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())qt(r,mt(i))>0&&o.push(i);return o}const kd=250;function Ad(e,t,n,o){let r=[],i=1/0;const s=Id(e,n,t+kd);for(const a of s){const c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:u,y:f}=Ze(a,l,l.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<i?(r=[{...l,x:u,y:f}],i=d):d===i&&r.push({...l,x:u,y:f}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function Ei(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??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&i?{...c,...Ze(s,c,c.position,!0)}:c}function Si(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function $d(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Ni=()=>!0;function Pd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:x,isValidConnection:m=Ni,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:C,autoPanSpeed:b,dragThreshold:N=1,handleDomNode:I}){const k=fi(e.target);let B=0,T;const{x:L,y:H}=ge(e),y=Si(i,I),E=a?.getBoundingClientRect();let S=!1;if(!E||!y)return;const M=Ei(r,y,o,c,t);if(!M)return;let $=ge(e,E),P=!1,R=null,O=!1,V=null;function X(){if(!u||!E)return;const[U,Y]=Gn($,E,b);d({x:U,y:Y}),B=requestAnimationFrame(X)}const F={...M,nodeId:r,type:y,position:M.position},q=c.get(r);let W={inProgress:!0,isValid:null,from:Ze(q,F,Z.Left,!0),fromHandle:F,fromPosition:F.position,fromNode:q,to:$,toHandle:null,toPosition:$o[F.position],toNode:null,pointer:$};function z(){S=!0,p(W),g?.(e,{nodeId:r,handleId:o,handleType:y})}N===0&&z();function j(U){if(!S){const{x:se,y:Ee}=ge(U),xe=se-L,we=Ee-H;if(!(xe*xe+we*we>N*N))return;z()}if(!C()||!F){K(U);return}const Y=w();$=ge(U,E),T=Ad(St($,Y,!1,[1,1]),n,c,F),P||(X(),P=!0);const G=Ci(U,{handle:T,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:k,lib:l,flowId:f,nodeLookup:c});V=G.handleDomNode,R=G.connection,O=$d(!!T,G.isValid);const J=c.get(r),te=J?Ze(J,F,Z.Left,!0):W.from,oe={...W,from:te,isValid:O,to:G.toHandle&&O?tt({x:G.toHandle.x,y:G.toHandle.y},Y):$,toHandle:G.toHandle,toPosition:O&&G.toHandle?G.toHandle.position:$o[F.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:$};p(oe),W=oe}function K(U){if(!("touches"in U&&U.touches.length>0)){if(S){(T||V)&&R&&O&&v?.(R);const{inProgress:Y,...G}=W,J={...G,toPosition:W.toHandle?W.toPosition:null};x?.(U,J),i&&_?.(U,J)}h(),cancelAnimationFrame(B),P=!1,O=!1,R=null,V=null,k.removeEventListener("mousemove",j),k.removeEventListener("mouseup",K),k.removeEventListener("touchmove",j),k.removeEventListener("touchend",K)}}k.addEventListener("mousemove",j),k.addEventListener("mouseup",K),k.addEventListener("touchmove",j),k.addEventListener("touchend",K)}function Ci(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=Ni,nodeLookup:u}){const f=i==="target",d=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=ge(e),v=s.elementFromPoint(h,g),x=v?.classList.contains(`${a}-flow__handle`)?v:d,m={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const _=Si(void 0,x),p=x.getAttribute("data-nodeid"),w=x.getAttribute("data-handleid"),C=x.classList.contains("connectable"),b=x.classList.contains("connectableend");if(!p||!_)return m;const N={source:f?p:o,sourceHandle:f?w:r,target:f?o:p,targetHandle:f?r:w};m.connection=N;const k=C&&b&&(n===Je.Strict?f&&_==="source"||!f&&_==="target":p!==o||w!==r);m.isValid=k&&l(N),m.toHandle=Ei(p,_,w,u,n,!0)}return m}const Ln={onPointerDown:Pd,isValid:Ci};function Dd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function i({translateExtent:a,width:c,height:l,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),C=p.sourceEvent.ctrlKey&&yt()?10:1,b=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,N=w[2]*Math.pow(2,b*C);t.scaleTo(N)};let v=[0,0];const x=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(v=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const C=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],b=[C[0]-v[0],C[1]-v[1]];v=C;const N=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),I={x:w[0]-b[0]*N,y:w[1]-b[1]*N},k=[[0,0],[c,l]];t.setViewportConstrained({x:I.x,y:I.y,zoom:w[2]},k,a)},_=Jr().on("start",x).on("zoom",f?m:null).on("zoom.wheel",d?g:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:de}}const rn=e=>({x:e.x,y:e.y,zoom:e.k}),xn=({x:e,y:t,zoom:n})=>tn.translate(e,t).scale(n),Pe=(e,t)=>e.target.closest(`.${t}`),Mi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Td=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,wn=(e,t=0,n=Td,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Ii=e=>{const t=e.ctrlKey&&yt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function zd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Pe(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&s){const x=de(u),m=Ii(u),_=f*Math.pow(2,m);o.scaleTo(n,_,x,u);return}const d=u.deltaMode===1?20:1;let h=r===Be.Vertical?0:u.deltaX*d,g=r===Be.Horizontal?0:u.deltaY*d;!yt()&&u.shiftKey&&r!==Be.Vertical&&(h=u.deltaY*d,g=0),o.translateBy(n,-(h/f)*i,-(g/f)*i,{internal:!0});const v=rn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,v):(e.isPanScrolling=!0,a?.(u,v)),e.panScrollTimeout=setTimeout(()=>{l?.(u,v),e.isPanScrolling=!1},150)}}function Hd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Pe(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Rd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=rn(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 Ld({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Mi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,rn(i.transform))}}function Vd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Mi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=rn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Od({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:f}){return d=>{const h=t||n,g=o&&d.ctrlKey,v=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Pe(d,`${u}-flow__node`)||Pe(d,`${u}-flow__edge`)||Pe(d,`${u}-flow__selection`)||Pe(d,`${u}-flow__nodesselection`)))return!0;if(!r&&!h&&!i&&!s&&!o||a||f&&!v||Pe(d,c)&&v||Pe(d,l)&&(!v||i&&v&&!t)||!o&&d.ctrlKey&&v)return!1;if(!o&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!h&&!i&&!g&&v||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||v||e)&&x}}function Bd({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect();let f=[[0,0],[u.width,u.height]];(typeof ResizeObserver<"u"?new ResizeObserver(H=>{const y=H[0];y&&(f=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null)?.observe(e);const h=Jr().extent(()=>f).scaleExtent([t,n]).translateExtent(o),g=ce(e).call(h);w({x:r.x,y:r.y,zoom:et(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const v=g.on("wheel.zoom"),x=g.on("dblclick.zoom");h.wheelDelta(Ii);async function m(H,y){return g?new Promise(E=>{h?.interpolate(y?.interpolate==="linear"?ct:zt).transform(wn(g,y?.duration,y?.ease,()=>E(!0)),H)}):!1}function _({noWheelClassName:H,noPanClassName:y,onPaneContextMenu:E,userSelectionActive:S,panOnScroll:M,panOnDrag:$,panOnScrollMode:P,panOnScrollSpeed:R,preventScrolling:O,zoomOnPinch:V,zoomOnScroll:X,zoomOnDoubleClick:F,panActivationKeyPressed:q=!1,zoomActivationKeyPressed:Q,lib:W,onTransformChange:z,connectionInProgress:j,paneClickDistance:K,selectionOnDrag:U}){S&&!l.isZoomingOrPanning&&p();const Y=M&&!Q&&!S;h.clickDistance(U?1/0:!he(K)||K<0?0:K);const G=Y?zd({zoomPanValues:l,noWheelClassName:H,d3Selection:g,d3Zoom:h,panOnScrollMode:P,panOnScrollSpeed:R,zoomOnPinch:V,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Hd({noWheelClassName:H,preventScrolling:O,d3ZoomHandler:v});g.on("wheel.zoom",G,{passive:!1});const J=Rd({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});h.on("start",J);const te=Ld({zoomPanValues:l,panOnDrag:$,onPaneContextMenu:!!E,onPanZoom:i,onTransformChange:z});h.on("zoom",te);const oe=Vd({zoomPanValues:l,panOnDrag:$,panOnScroll:M,onPaneContextMenu:E,onPanZoomEnd:a,onDraggingChange:c});h.on("end",oe);const se=Od({panActivationKeyPressed:q,zoomActivationKeyPressed:Q,panOnDrag:$,zoomOnScroll:X,panOnScroll:M,zoomOnDoubleClick:F,zoomOnPinch:V,userSelectionActive:S,noPanClassName:y,noWheelClassName:H,lib:W,connectionInProgress:j});h.filter(se),F?g.on("dblclick.zoom",x):g.on("dblclick.zoom",null)}function p(){h.on("zoom",null)}async function w(H,y,E){const S=xn(H),M=h?.constrain()(S,y,E);return M&&await m(M),M}async function C(H,y){const E=xn(H);return await m(E,y),E}function b(H){if(g){const y=xn(H),E=g.property("__zoom");(E.k!==H.zoom||E.x!==H.x||E.y!==H.y)&&h?.transform(g,y,null,{sync:!0})}}function N(){const H=g?Qr(g.node()):{x:0,y:0,k:1};return{x:H.x,y:H.y,zoom:H.k}}async function I(H,y){return g?new Promise(E=>{h?.interpolate(y?.interpolate==="linear"?ct:zt).scaleTo(wn(g,y?.duration,y?.ease,()=>E(!0)),H)}):!1}async function k(H,y){return g?new Promise(E=>{h?.interpolate(y?.interpolate==="linear"?ct:zt).scaleBy(wn(g,y?.duration,y?.ease,()=>E(!0)),H)}):!1}function B(H){h?.scaleExtent(H)}function T(H){h?.translateExtent(H)}function L(H){const y=!he(H)||H<0?0:H;h?.clickDistance(y)}return{update:_,destroy:p,setViewport:C,setViewportConstrained:w,getViewport:N,scaleTo:I,scaleBy:k,setScaleExtent:B,setTranslateExtent:T,syncViewport:b,setClickDistance:L}}var nt;(function(e){e.Line="line",e.Handle="handle"})(nt||(nt={}));function Fd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Xo(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 Ae(e,t){return Math.max(0,t-e)}function $e(e,t){return Math.max(0,e-t)}function $t(e,t,n){return Math.max(0,t-e,e-n)}function Yo(e,t){return e?!t:t}function jd(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:x,minHeight:m,maxHeight:_}=o,{x:p,y:w,width:C,height:b,aspectRatio:N}=e;let I=Math.floor(u?h-e.pointerX:0),k=Math.floor(f?g-e.pointerY:0);const B=C+(c?-I:I),T=b+(l?-k:k),L=-i[0]*C,H=-i[1]*b;let y=$t(B,v,x),E=$t(T,m,_);if(s){let $=0,P=0;c&&I<0?$=Ae(p+I+L,s[0][0]):!c&&I>0&&($=$e(p+B+L,s[1][0])),l&&k<0?P=Ae(w+k+H,s[0][1]):!l&&k>0&&(P=$e(w+T+H,s[1][1])),y=Math.max(y,$),E=Math.max(E,P)}if(a){let $=0,P=0;c&&I>0?$=$e(p+I,a[0][0]):!c&&I<0&&($=Ae(p+B,a[1][0])),l&&k>0?P=$e(w+k,a[0][1]):!l&&k<0&&(P=Ae(w+T,a[1][1])),y=Math.max(y,$),E=Math.max(E,P)}if(r){if(u){const $=$t(B/N,m,_)*N;if(y=Math.max(y,$),s){let P=0;!c&&!l||c&&!l&&d?P=$e(w+H+B/N,s[1][1])*N:P=Ae(w+H+(c?I:-I)/N,s[0][1])*N,y=Math.max(y,P)}if(a){let P=0;!c&&!l||c&&!l&&d?P=Ae(w+B/N,a[1][1])*N:P=$e(w+(c?I:-I)/N,a[0][1])*N,y=Math.max(y,P)}}if(f){const $=$t(T*N,v,x)/N;if(E=Math.max(E,$),s){let P=0;!c&&!l||l&&!c&&d?P=$e(p+T*N+L,s[1][0])/N:P=Ae(p+(l?k:-k)*N+L,s[0][0])/N,E=Math.max(E,P)}if(a){let P=0;!c&&!l||l&&!c&&d?P=Ae(p+T*N,a[1][0])/N:P=$e(p+(l?k:-k)*N,a[0][0])/N,E=Math.max(E,P)}}}k=k+(k<0?E:-E),I=I+(I<0?y:-y),r&&(d?B>T*N?k=(Yo(c,l)?-I:I)/N:I=(Yo(c,l)?-k:k)*N:u?(k=I/N,l=c):(I=k*N,c=l));const S=c?p+I:p,M=l?w+k:w;return{width:C+(c?-I:I),height:b+(l?-k:k),x:i[0]*I*(c?-1:1)+S,y:i[1]*k*(l?-1:1)+M}}const ki={width:0,height:0,x:0,y:0},Xd={...ki,pointerX:0,pointerY:0,aspectRatio:1};function Yd(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,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function Zd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ce(e);let s={controlDirection:Xo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:u,keepAspectRatio:f,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:x}){let m={...ki},_={...Xd};s={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Xo(l)};let p,w=null,C=[],b,N,I,k=!1;const B=Lr().on("start",T=>{const{nodeLookup:L,transform:H,snapGrid:y,snapToGrid:E,nodeOrigin:S,paneDomNode:M}=n();if(p=L.get(t),!p)return;w=M?.getBoundingClientRect()??null;const{xSnapped:$,ySnapped:P}=lt(T.sourceEvent,{transform:H,snapGrid:y,snapToGrid:E,containerBounds:w});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...m,pointerX:$,pointerY:P,aspectRatio:m.width/m.height},b=void 0,N=Ye(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(b=L.get(p.parentId)),b&&p.extent==="parent"&&(N=[[0,0],[b.measured.width,b.measured.height]]),C=[],I=void 0;for(const[R,O]of L)if(O.parentId===t&&(C.push({id:R,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const V=Yd(O,p,O.origin??S);I?I=[[Math.min(V[0][0],I[0][0]),Math.min(V[0][1],I[0][1])],[Math.max(V[1][0],I[1][0]),Math.max(V[1][1],I[1][1])]]:I=V}h?.(T,{...m})}).on("drag",T=>{const{transform:L,snapGrid:H,snapToGrid:y,nodeOrigin:E}=n(),S=lt(T.sourceEvent,{transform:L,snapGrid:H,snapToGrid:y,containerBounds:w}),M=[];if(!p)return;const{x:$,y:P,width:R,height:O}=m,V={},X=p.origin??E,{width:F,height:q,x:Q,y:W}=jd(_,s.controlDirection,S,s.boundaries,s.keepAspectRatio,X,N,I),z=F!==R,j=q!==O,K=Q!==$&&z,U=W!==P&&j;if(!K&&!U&&!z&&!j)return;if((K||U||X[0]===1||X[1]===1)&&(V.x=K?Q:m.x,V.y=U?W:m.y,m.x=V.x,m.y=V.y,C.length>0)){const te=Q-$,oe=W-P;for(const se of C)se.position={x:se.position.x-te+X[0]*(F-R),y:se.position.y-oe+X[1]*(q-O)},M.push(se)}if((z||j)&&(V.width=z&&(!s.resizeDirection||s.resizeDirection==="horizontal")?F:m.width,V.height=j&&(!s.resizeDirection||s.resizeDirection==="vertical")?q:m.height,m.width=V.width,m.height=V.height),b&&p.expandParent){const te=X[0]*(V.width??0);V.x&&V.x<te&&(m.x=te,_.x=_.x-(V.x-te));const oe=X[1]*(V.height??0);V.y&&V.y<oe&&(m.y=oe,_.y=_.y-(V.y-oe))}const Y=Fd({width:m.width,prevWidth:R,height:m.height,prevHeight:O,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:Y};x?.(T,G)!==!1&&(k=!0,g?.(T,G),o(V,M))}).on("end",T=>{k&&(v?.(T,{...m}),r?.({...m}),k=!1)});i.call(B)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var vn={exports:{}},bn={},_n={exports:{}},En={};var Zo;function Wd(){if(Zo)return En;Zo=1;var e=Er();function t(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(f,d){var h=d(),g=o({inst:{value:h,getSnapshot:d}}),v=g[0].inst,x=g[1];return i(function(){v.value=h,v.getSnapshot=d,c(v)&&x({inst:v})},[f,h,d]),r(function(){return c(v)&&x({inst:v}),f(function(){c(v)&&x({inst:v})})},[f]),s(h),h}function c(f){var d=f.getSnapshot;f=f.value;try{var h=d();return!n(f,h)}catch{return!0}}function l(f,d){return d()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return En.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,En}var Wo;function qd(){return Wo||(Wo=1,_n.exports=Wd()),_n.exports}var qo;function Gd(){if(qo)return bn;qo=1;var e=Er(),t=qd();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,c=e.useDebugValue;return bn.useSyncExternalStoreWithSelector=function(l,u,f,d,h){var g=i(null);if(g.current===null){var v={hasValue:!1,value:null};g.current=v}else v=g.current;g=a(function(){function m(b){if(!_){if(_=!0,p=b,b=d(b),h!==void 0&&v.hasValue){var N=v.value;if(h(N,b))return w=N}return w=b}if(N=w,o(p,b))return N;var I=d(b);return h!==void 0&&h(N,I)?(p=b,N):(p=b,w=I)}var _=!1,p,w,C=f===void 0?null:f;return[function(){return m(u())},C===null?void 0:function(){return m(C())}]},[u,f,d,h]);var x=r(l,g[0],g[1]);return s(function(){v.hasValue=!0,v.value=x},[x]),c(x),x},bn}var Go;function Ud(){return Go||(Go=1,vn.exports=Gd()),vn.exports}var Kd=Ud();const Qd=ga(Kd),Jd={},Uo=e=>{let t;const n=new Set,o=(u,f)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,h))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Jd?"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()}},l=t=e(o,r,c);return c},ef=e=>e?Uo(e):Uo,{useDebugValue:tf}=pa,{useSyncExternalStoreWithSelector:nf}=Qd,of=e=>e;function Ai(e,t=of,n){const o=nf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return tf(o),o}const Ko=(e,t)=>{const n=ef(e),o=(r,i=t)=>Ai(n,r,i);return Object.assign(o,n),o},rf=(e,t)=>e?Ko(e,t):Ko;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 sn=D.createContext(null),sf=sn.Provider,$i=pe.error001("react");function ee(e,t){const n=D.useContext(sn);if(n===null)throw new Error($i);return Ai(n,e,t)}function ne(){const e=D.useContext(sn);if(e===null)throw new Error($i);return D.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Qo={display:"none"},af={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Pi="react-flow__node-desc",Di="react-flow__edge-desc",cf="react-flow__aria-live",lf=e=>e.ariaLiveMessage,uf=e=>e.ariaLabelConfig;function df({rfId:e}){const t=ee(lf);return A.jsx("div",{id:`${cf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:af,children:t})}function ff({rfId:e,disableKeyboardA11y:t}){const n=ee(uf);return A.jsxs(A.Fragment,{children:[A.jsx("div",{id:`${Pi}-${e}`,style:Qo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),A.jsx("div",{id:`${Di}-${e}`,style:Qo,children:n["edge.a11yDescription.default"]}),!t&&A.jsx(df,{rfId:e})]})}const an=D.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return A.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});an.displayName="Panel";const Jo="https://reactflow.dev?utm_source=attribution";function hf({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:A.jsx(an,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Jo}`,children:A.jsx("a",{href:Jo,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const gf=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}},Pt=e=>e.id;function pf(e,t){return re(e.selectedNodes.map(Pt),t.selectedNodes.map(Pt))&&re(e.selectedEdges.map(Pt),t.selectedEdges.map(Pt))}function mf({onSelectionChange:e}){const t=ne(),{selectedNodes:n,selectedEdges:o}=ee(gf,pf);return D.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const yf=e=>!!e.onSelectionChangeHandlers;function xf({onSelectionChange:e}){const t=ee(yf);return e||t?A.jsx(mf,{onSelectionChange:e}):null}const Ti=[0,0],wf={x:0,y:0,zoom:1},vf=["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"],er=[...vf,"rfId"],bf=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}),tr={translateExtent:gt,nodeOrigin:Ti,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function _f(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=ee(bf,re),l=ne();D.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=tr,a()}),[]);const u=D.useRef(tr);return D.useEffect(()=>{for(const f of er){const d=e[f],h=u.current[f];d!==h&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?i(d):f==="nodeExtent"?s(d):f==="ariaLabelConfig"?l.setState({ariaLabelConfig:id(d)}):f==="fitView"?l.setState({fitViewQueued:d}):f==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[f]:d})))}u.current=e},er.map(f=>e[f])),null}function nr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Ef(e){const[t,n]=D.useState(e==="system"?null:e);return D.useEffect(()=>{if(e!=="system"){n(e);return}const o=nr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:nr()?.matches?"dark":"light"}const or=typeof document<"u"?document:null;function xt(e=null,t={target:or,actInsideInputWithModifier:!0}){const[n,o]=D.useState(!1),r=D.useRef(!1),i=D.useRef(new Set([])),[s,a]=D.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace(/\+/g,`
2
+ `).replace(`
3
+
4
+ `,`
5
+ +`).split(`
6
+ `)),u=l.reduce((f,d)=>f.concat(...d),[]);return[l,u]}return[[],[]]},[e]);return D.useEffect(()=>{const c=t?.target??or,l=t?.actInsideInputWithModifier??!0;if(e!==null){const u=h=>{if(r.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!r.current||r.current&&!l)&&hi(h))return!1;const v=ir(h.code,a);if(i.current.add(h[v]),rr(s,i.current,!1)){const x=h.composedPath?.()?.[0]||h.target,m=x?.nodeName==="BUTTON"||x?.nodeName==="A";t.preventDefault!==!1&&(r.current||!m)&&h.preventDefault(),o(!0)}},f=h=>{const g=ir(h.code,a);rr(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(h[g]),h.key==="Meta"&&i.current.clear(),r.current=!1},d=()=>{i.current.clear(),o(!1)};return c?.addEventListener("keydown",u),c?.addEventListener("keyup",f),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{c?.removeEventListener("keydown",u),c?.removeEventListener("keyup",f),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,o]),n}function rr(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function ir(e,t){return t.includes(e)?"code":"key"}const Sf=()=>{const e=ne();return D.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(),c=Un(t,o,r,i,s,n?.padding??.1);return a?(await a.setViewport(c,{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:c}=s.getBoundingClientRect(),l={x:t.x-a,y:t.y-c},u=n.snapGrid??r,f=n.snapToGrid??i;return St(l,o,f,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=tt(t,n);return{x:s.x+r,y:s.y+i}}}),[])};function zi(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 c of s)Nf(c,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 Nf(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 Cf(e,t){return zi(e,t)}function Mf(e,t){return zi(e,t)}function Le(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(Le(i.id,s)))}return o}function sr({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 ar(e){return{id:e.id,type:"remove"}}const If=li();function kf(e,t,n={}){return dd(e,t,{...n,onError:n.onError??If})}const cr=e=>Uu(e),Af=e=>ri(e);function Hi(e){return D.forwardRef(e)}const Ri=typeof window<"u"?D.useLayoutEffect:D.useEffect;function lr(e){const[t,n]=D.useState(BigInt(0)),[o]=D.useState(()=>$f(()=>n(r=>r+BigInt(1))));return Ri(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function $f(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Li=D.createContext(null);function Pf({children:e}){const t=ne(),n=D.useCallback(a=>{const{nodes:c=[],setNodes:l,hasDefaultNodes:u,onNodesChange:f,nodeLookup:d,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let v=c;for(const m of a)v=typeof m=="function"?m(v):m;let x=sr({items:v,lookup:d});for(const m of g.values())x=m(x);u&&l(v),x.length>0?f?.(x):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:_,setNodes:p}=t.getState();m&&p(_)})},[]),o=lr(n),r=D.useCallback(a=>{const{edges:c=[],setEdges:l,hasDefaultEdges:u,onEdgesChange:f,edgeLookup:d}=t.getState();let h=c;for(const g of a)h=typeof g=="function"?g(h):g;u?l(h):f&&f(sr({items:h,lookup:d}))},[]),i=lr(r),s=D.useMemo(()=>({nodeQueue:o,edgeQueue:i}),[]);return A.jsx(Li.Provider,{value:s,children:e})}function Df(){const e=D.useContext(Li);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Tf=e=>!!e.panZoom;function oo(){const e=Sf(),t=ne(),n=Df(),o=ee(Tf),r=D.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),s=f=>{n.nodeQueue.push(f)},a=f=>{n.edgeQueue.push(f)},c=f=>{const{nodeLookup:d,nodeOrigin:h}=t.getState(),g=cr(f)?f:d.get(f.id),v=g.parentId?di(g.position,g.measured,g.parentId,d,h):g.position,x={...g,position:v,width:g.measured?.width??g.width,height:g.measured?.height??g.height};return mt(x)},l=(f,d,h={replace:!1})=>{s(g=>g.map(v=>{if(v.id===f){const x=typeof d=="function"?d(v):d;return h.replace&&cr(x)?x:{...v,...x}}return v}))},u=(f,d,h={replace:!1})=>{a(g=>g.map(v=>{if(v.id===f){const x=typeof d=="function"?d(v):d;return h.replace&&Af(x)?x:{...v,...x}}return v}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>i(f)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(d=>({...d}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:s,setEdges:a,addNodes:f=>{const d=Array.isArray(f)?f:[f];n.nodeQueue.push(h=>[...h,...d])},addEdges:f=>{const d=Array.isArray(f)?f:[f];n.edgeQueue.push(h=>[...h,...d])},toObject:()=>{const{nodes:f=[],edges:d=[],transform:h}=t.getState(),[g,v,x]=h;return{nodes:f.map(m=>({...m})),edges:d.map(m=>({...m})),viewport:{x:g,y:v,zoom:x}}},deleteElements:async({nodes:f=[],edges:d=[]})=>{const{nodes:h,edges:g,onNodesDelete:v,onEdgesDelete:x,triggerNodeChanges:m,triggerEdgeChanges:_,onDelete:p,onBeforeDelete:w}=t.getState(),{nodes:C,edges:b}=await td({nodesToRemove:f,edgesToRemove:d,nodes:h,edges:g,onBeforeDelete:w}),N=b.length>0,I=C.length>0;if(N){const k=b.map(ar);x?.(b),_(k)}if(I){const k=C.map(ar);v?.(C),m(k)}return(I||N)&&p?.({nodes:C,edges:b}),{deletedNodes:C,deletedEdges:b}},getIntersectingNodes:(f,d=!0,h)=>{const g=Do(f),v=g?f:c(f),x=h!==void 0;return v?(h||t.getState().nodes).filter(m=>{const _=t.getState().nodeLookup.get(m.id);if(_&&!g&&(m.id===f.id||!_.internals.positionAbsolute))return!1;const p=mt(x?m:_),w=qt(p,v);return d&&w>0||w>=p.width*p.height||w>=v.width*v.height}):[]},isNodeIntersecting:(f,d,h=!0)=>{const v=Do(f)?f:c(f);if(!v)return!1;const x=qt(v,d);return h&&x>0||x>=d.width*d.height||x>=v.width*v.height},updateNode:l,updateNodeData:(f,d,h={replace:!1})=>{l(f,g=>{const v=typeof d=="function"?d(g):d;return h.replace?{...g,data:v}:{...g,data:{...g.data,...v}}},h)},updateEdge:u,updateEdgeData:(f,d,h={replace:!1})=>{u(f,g=>{const v=typeof d=="function"?d(g):d;return h.replace?{...g,data:v}:{...g,data:{...g.data,...v}}},h)},getNodesBounds:f=>{const{nodeLookup:d,nodeOrigin:h}=t.getState();return Ku(f,{nodeLookup:d,nodeOrigin:h})},getHandleConnections:({type:f,id:d,nodeId:h})=>Array.from(t.getState().connectionLookup.get(`${h}-${f}${d?`-${d}`:""}`)?.values()??[]),getNodeConnections:({type:f,handleId:d,nodeId:h})=>Array.from(t.getState().connectionLookup.get(`${h}${f?d?`-${f}-${d}`:`-${f}`:""}`)?.values()??[]),fitView:async f=>{const d=t.getState().fitViewResolver??rd();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:d}),n.nodeQueue.push(h=>[...h]),d.promise}}},[]);return D.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const ur=e=>e.selected,zf=typeof window<"u"?window:void 0;function Hf({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ne(),{deleteElements:o}=oo(),r=xt(e,{actInsideInputWithModifier:!1}),i=xt(t,{target:zf});D.useEffect(()=>{if(r){const{edges:s,nodes:a}=n.getState();o({nodes:a.filter(ur),edges:s.filter(ur)}),n.setState({nodesSelectionActive:!1})}},[r]),D.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Rf(e){const t=ne();D.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const o=Kn(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",pe.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 cn={position:"absolute",width:"100%",height:"100%",top:0,left:0},Lf=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Vf({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panActivationKeyPressed:r,panOnScrollSpeed:i=.5,panOnScrollMode:s=Be.Free,zoomOnDoubleClick:a=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:f,maxZoom:d,zoomActivationKeyCode:h,preventScrolling:g=!0,children:v,noWheelClassName:x,noPanClassName:m,onViewportChange:_,isControlledViewport:p,paneClickDistance:w,selectionOnDrag:C}){const b=ne(),N=D.useRef(null),{userSelectionActive:I,lib:k,connectionInProgress:B}=ee(Lf,re),T=xt(h),L=D.useRef();Rf(N);const H=D.useCallback(y=>{_?.({x:y[0],y:y[1],zoom:y[2]}),p||b.setState({transform:y})},[_,p]);return D.useEffect(()=>{if(N.current){L.current=Bd({domNode:N.current,minZoom:f,maxZoom:d,translateExtent:u,viewport:l,onDraggingChange:M=>b.setState($=>$.paneDragging===M?$:{paneDragging:M}),onPanZoomStart:(M,$)=>{const{onViewportChangeStart:P,onMoveStart:R}=b.getState();R?.(M,$),P?.($)},onPanZoom:(M,$)=>{const{onViewportChange:P,onMove:R}=b.getState();R?.(M,$),P?.($)},onPanZoomEnd:(M,$)=>{const{onViewportChangeEnd:P,onMoveEnd:R}=b.getState();R?.(M,$),P?.($)}});const{x:y,y:E,zoom:S}=L.current.getViewport();return b.setState({panZoom:L.current,transform:[y,E,S],domNode:N.current.closest(".react-flow")}),()=>{L.current?.destroy()}}},[]),D.useEffect(()=>{L.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panActivationKeyPressed:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:c,zoomActivationKeyPressed:T,preventScrolling:g,noPanClassName:m,userSelectionActive:I,noWheelClassName:x,lib:k,onTransformChange:H,connectionInProgress:B,selectionOnDrag:C,paneClickDistance:w})},[e,t,n,o,r,i,s,a,c,T,g,m,I,x,k,H,B,C,w]),A.jsx("div",{className:"react-flow__renderer",ref:N,style:cn,children:v})}const Of=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Bf(){const{userSelectionActive:e,userSelectionRect:t}=ee(Of,re);return e&&t?A.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 Sn=(e,t)=>n=>{n.target===t.current&&e?.(n)},Ff=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function jf({isSelecting:e,selectionKeyPressed:t,selectionMode:n=pt.Full,panOnDrag:o,autoPanOnSelection:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:a,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:f,onPaneMouseEnter:d,onPaneMouseMove:h,onPaneMouseLeave:g,children:v}){const x=D.useRef(0),m=ne(),{userSelectionActive:_,elementsSelectable:p,dragging:w,panBy:C,autoPanSpeed:b}=ee(Ff,re),N=p&&(e||_),I=D.useRef(null),k=D.useRef(),B=D.useRef(new Set),T=D.useRef(new Set),L=D.useRef(!1),H=D.useRef(!1),y=D.useRef({x:0,y:0}),E=D.useRef(!1),S=z=>{if(H.current||L.current||m.getState().connection.inProgress){H.current=!1,L.current=!1;return}l?.(z),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},M=z=>{if(Array.isArray(o)&&o?.includes(2)){z.preventDefault();return}u?.(z)},$=f?z=>f(z):void 0,P=z=>{H.current&&(z.stopPropagation(),H.current=!1)},R=z=>{if(z.pointerType==="touch"&&o!==!1&&!t)return;const{domNode:j,transform:K}=m.getState();if(k.current=j?.getBoundingClientRect(),!k.current)return;const U=z.target===I.current;if(!U&&!!z.target.closest(".nokey")||!e||!(s&&U||t)||z.button!==0||!z.isPrimary)return;z.target?.setPointerCapture?.(z.pointerId),H.current=!1;const{x:J,y:te}=ge(z.nativeEvent,k.current),oe=St({x:J,y:te},K);m.setState({userSelectionRect:{width:0,height:0,startX:oe.x,startY:oe.y,x:J,y:te}}),U||(z.stopPropagation(),z.preventDefault())};function O(z,j){const{userSelectionRect:K}=m.getState();if(!K)return;const{transform:U,nodeLookup:Y,edgeLookup:G,connectionLookup:J,triggerNodeChanges:te,triggerEdgeChanges:oe,defaultEdgeOptions:se}=m.getState(),Ee={x:K.startX,y:K.startY},{x:xe,y:we}=tt(Ee,U),Se={startX:Ee.x,startY:Ee.y,x:z<xe?z:xe,y:j<we?j:we,width:Math.abs(z-xe),height:Math.abs(j-we)},ot=B.current,ze=T.current;B.current=new Set(qn(Y,Se,U,n===pt.Partial,!0).map(ue=>ue.id)),T.current=new Set;const He=se?.selectable??!0;for(const ue of B.current){const Ne=J.get(ue);if(Ne)for(const{edgeId:Ce}of Ne.values()){const Re=G.get(Ce);Re&&(Re.selectable??He)&&T.current.add(Ce)}}if(!To(ot,B.current)){const ue=qe(Y,B.current,!0);te(ue)}if(!To(ze,T.current)){const ue=qe(G,T.current);oe(ue)}m.setState({userSelectionRect:Se,userSelectionActive:!0,nodesSelectionActive:!1})}function V(){if(!r||!k.current)return;const[z,j]=Gn(y.current,k.current,b);C({x:z,y:j}).then(K=>{if(!H.current||!K){x.current=requestAnimationFrame(V);return}const{x:U,y:Y}=y.current;O(U,Y),x.current=requestAnimationFrame(V)})}const X=()=>{cancelAnimationFrame(x.current),x.current=0,E.current=!1};D.useEffect(()=>()=>X(),[]);const F=z=>{const{userSelectionRect:j,transform:K,resetSelectedElements:U}=m.getState();if(!k.current||!j)return;const{x:Y,y:G}=ge(z.nativeEvent,k.current);y.current={x:Y,y:G};const J=tt({x:j.startX,y:j.startY},K);if(!H.current){const te=t?0:i;if(Math.hypot(Y-J.x,G-J.y)<=te)return;U(),a?.(z)}H.current=!0,E.current||(V(),E.current=!0),O(Y,G)},q=z=>{if(!N){z.target===I.current&&m.getState().connection.inProgress&&(L.current=!0);return}z.button===0&&(z.target?.releasePointerCapture?.(z.pointerId),!_&&z.target===I.current&&m.getState().userSelectionRect&&S?.(z),m.setState({userSelectionActive:!1,userSelectionRect:null}),H.current&&(c?.(z),m.setState({nodesSelectionActive:B.current.size>0})),X())},Q=z=>{z.target?.releasePointerCapture?.(z.pointerId),X()},W=o===!0||Array.isArray(o)&&o.includes(0);return A.jsxs("div",{className:ie(["react-flow__pane",{draggable:W,dragging:w,selection:e}]),onClick:N?void 0:Sn(S,I),onContextMenu:Sn(M,I),onWheel:Sn($,I),onPointerEnter:N?void 0:d,onPointerMove:N?F:h,onPointerUp:q,onPointerCancel:N?Q:void 0,onPointerDownCapture:N?R:void 0,onClickCapture:N?P:void 0,onPointerLeave:g,ref:I,style:cn,children:[v,A.jsx(Bf,{})]})}function Vn({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:c}=t.getState(),l=a.get(e);if(!l){c?.("012",pe.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&s)&&(i({nodes:[l],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function Vi({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const a=ne(),[c,l]=D.useState(!1),u=D.useRef();return D.useEffect(()=>{if(!t)return u.current=Md({getStoreItems:()=>a.getState(),onNodeMouseDown:f=>{Vn({id:f,store:a,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,a,e]),D.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]),c}const Xf=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Oi(){const e=ne();return D.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:c,nodeLookup:l,nodeOrigin:u}=e.getState(),f=new Map,d=Xf(s),h=r?i[0]:5,g=r?i[1]:5,v=n.direction.x*h*n.factor,x=n.direction.y*g*n.factor;for(const[,m]of l){if(!d(m))continue;let _={x:m.internals.positionAbsolute.x+v,y:m.internals.positionAbsolute.y+x};r&&(_=Et(_,i));const{position:p,positionAbsolute:w}=ii({nodeId:m.id,nextPosition:_,nodeLookup:l,nodeExtent:o,nodeOrigin:u,onError:a});m.position=p,m.internals.positionAbsolute=w,f.set(m.id,m)}c(f)},[])}const ro=D.createContext(null),Yf=ro.Provider;ro.Consumer;const Bi=()=>D.useContext(ro),Zf=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Fi=D.createContext(null);function Wf({children:e}){const t=ee(Zf,re);return A.jsx(Fi.Provider,{value:t,children:e})}function qf(){const e=D.useContext(Fi);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const Gf={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},Uf=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:c,isValid:l}=s;if(!a&&!r)return Gf;const u=c?.nodeId===e&&c?.id===t&&c?.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===Je.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:u&&l}};function Kf({type:e="source",position:t=Z.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:c,className:l,onMouseDown:u,onTouchStart:f,...d},h){const g=s||null,v=e==="target",x=ne(),m=Bi(),{connectOnClick:_,noPanClassName:p,rfId:w}=qf(),{connectingFrom:C,connectingTo:b,clickConnecting:N,isPossibleEndHandle:I,connectionInProcess:k,clickConnectionInProcess:B,valid:T}=ee(Uf(m,g,e),re);m||x.getState().onError?.("010",pe.error010());const L=E=>{const{defaultEdgeOptions:S,onConnect:M,hasDefaultEdges:$}=x.getState(),P={...S,...E};if($){const{edges:R,setEdges:O,onError:V}=x.getState();O(kf(P,R,{onError:V}))}M?.(P),a?.(P)},H=E=>{if(!m)return;const S=gi(E.nativeEvent);if(r&&(S&&E.button===0||!S)){const M=x.getState();Ln.onPointerDown(E.nativeEvent,{handleDomNode:E.currentTarget,autoPanOnConnect:M.autoPanOnConnect,connectionMode:M.connectionMode,connectionRadius:M.connectionRadius,domNode:M.domNode,nodeLookup:M.nodeLookup,lib:M.lib,isTarget:v,handleId:g,nodeId:m,flowId:M.rfId,panBy:M.panBy,cancelConnection:M.cancelConnection,onConnectStart:M.onConnectStart,onConnectEnd:(...$)=>x.getState().onConnectEnd?.(...$),updateConnection:M.updateConnection,onConnect:L,isValidConnection:n||((...$)=>x.getState().isValidConnection?.(...$)??!0),getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:M.autoPanSpeed,dragThreshold:M.connectionDragThreshold})}S?u?.(E):f?.(E)},y=E=>{const{onClickConnectStart:S,onClickConnectEnd:M,connectionClickStartHandle:$,connectionMode:P,isValidConnection:R,lib:O,rfId:V,nodeLookup:X,connection:F}=x.getState();if(!m||!$&&!r)return;if(!$){S?.(E.nativeEvent,{nodeId:m,handleId:g,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:m,type:e,id:g}});return}const q=fi(E.target),Q=n||R,{connection:W,isValid:z}=Ln.isValid(E.nativeEvent,{handle:{nodeId:m,id:g,type:e},connectionMode:P,fromNodeId:$.nodeId,fromHandleId:$.id||null,fromType:$.type,isValidConnection:Q,flowId:V,doc:q,lib:O,nodeLookup:X});z&&W&&L(W);const j=structuredClone(F);delete j.inProgress,j.toPosition=j.toHandle?j.toHandle.position:null,M?.(E,j),x.setState({connectionClickStartHandle:null})};return A.jsx("div",{"data-handleid":g,"data-nodeid":m,"data-handlepos":t,"data-id":`${w}-${m}-${g}-${e}`,className:ie(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",p,l,{source:!v,target:v,connectable:o,connectablestart:r,connectableend:i,clickconnecting:N,connectingfrom:C,connectingto:b,valid:T,connectionindicator:o&&(!k||I)&&(k||B?i:r)}]),onMouseDown:H,onTouchStart:H,onClick:_?y:void 0,ref:h,...d,children:c})}const Gt=D.memo(Hi(Kf));function Qf({data:e,isConnectable:t,sourcePosition:n=Z.Bottom}){return A.jsxs(A.Fragment,{children:[e?.label,A.jsx(Gt,{type:"source",position:n,isConnectable:t})]})}function Jf({data:e,isConnectable:t,targetPosition:n=Z.Top,sourcePosition:o=Z.Bottom}){return A.jsxs(A.Fragment,{children:[A.jsx(Gt,{type:"target",position:n,isConnectable:t}),e?.label,A.jsx(Gt,{type:"source",position:o,isConnectable:t})]})}function eh(){return null}function th({data:e,isConnectable:t,targetPosition:n=Z.Top}){return A.jsxs(A.Fragment,{children:[A.jsx(Gt,{type:"target",position:n,isConnectable:t}),e?.label]})}const Ut={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},dr={input:Qf,default:Jf,output:th,group:eh};function nh(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 oh=e=>{const{width:t,height:n,x:o,y:r}=_t(e.nodeLookup,{filter:i=>!!i.selected});return{width:he(t)?t:null,height:he(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 rh({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=ne(),{width:r,height:i,transformString:s,userSelectionActive:a}=ee(oh,re),c=Oi(),l=D.useRef(null);D.useEffect(()=>{n||l.current?.focus({preventScroll:!0})},[n]);const u=!a&&r!==null&&i!==null;if(Vi({nodeRef:l,disabled:!u}),!u)return null;const f=e?h=>{const g=o.getState().nodes.filter(v=>v.selected);e(h,g)}:void 0,d=h=>{Object.prototype.hasOwnProperty.call(Ut,h.key)&&(h.preventDefault(),c({direction:Ut[h.key],factor:h.shiftKey?4:1}))};return A.jsx("div",{className:ie(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:A.jsx("div",{ref:l,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:r,height:i}})})}const fr=typeof window<"u"?window:void 0,ih=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function ji({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:f,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:v,zoomActivationKeyCode:x,elementsSelectable:m,zoomOnScroll:_,zoomOnPinch:p,panOnScroll:w,panOnScrollSpeed:C,panOnScrollMode:b,zoomOnDoubleClick:N,panOnDrag:I,autoPanOnSelection:k,defaultViewport:B,translateExtent:T,minZoom:L,maxZoom:H,preventScrolling:y,onSelectionContextMenu:E,noWheelClassName:S,noPanClassName:M,disableKeyboardA11y:$,onViewportChange:P,isControlledViewport:R}){const{nodesSelectionActive:O,userSelectionActive:V}=ee(ih,re),X=xt(l,{target:fr}),F=xt(v,{target:fr}),q=F||I,Q=F||w,W=u&&q!==!0,z=X||V||W;return Hf({deleteKeyCode:c,multiSelectionKeyCode:g}),A.jsx(Vf,{onPaneContextMenu:i,elementsSelectable:m,zoomOnScroll:_,zoomOnPinch:p,panOnScroll:Q,panActivationKeyPressed:F,panOnScrollSpeed:C,panOnScrollMode:b,zoomOnDoubleClick:N,panOnDrag:!X&&q,defaultViewport:B,translateExtent:T,minZoom:L,maxZoom:H,zoomActivationKeyCode:x,preventScrolling:y,noWheelClassName:S,noPanClassName:M,onViewportChange:P,isControlledViewport:R,paneClickDistance:a,selectionOnDrag:W,children:A.jsxs(jf,{onSelectionStart:d,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:q,autoPanOnSelection:k,isSelecting:!!z,selectionMode:f,selectionKeyPressed:X,paneClickDistance:a,selectionOnDrag:W,children:[e,O&&A.jsx(rh,{onSelectionContextMenu:E,noPanClassName:M,disableKeyboardA11y:$})]})})}ji.displayName="FlowRenderer";const sh=D.memo(ji),ah=e=>t=>e?qn(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 ch(e){return ee(D.useCallback(ah(e),[e]),re)}const lh=e=>e.updateNodeInternals;function uh(){const e=ee(lh),[t]=D.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 D.useEffect(()=>()=>{t?.disconnect()},[t]),t}function dh({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=ne(),i=D.useRef(null),s=D.useRef(null),a=D.useRef(e.sourcePosition),c=D.useRef(e.targetPosition),l=D.useRef(t),u=n&&!!e.internals.handleBounds;return D.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]),D.useEffect(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),D.useEffect(()=>{if(i.current){const f=l.current!==t,d=a.current!==e.sourcePosition,h=c.current!==e.targetPosition;(f||d||h)&&(l.current=t,a.current=e.sourcePosition,c.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 fh({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:f,noDragClassName:d,noPanClassName:h,disableKeyboardA11y:g,rfId:v,nodeTypes:x,nodeClickDistance:m,onError:_}){const{node:p,internals:w,isParent:C}=ee(z=>{const j=z.nodeLookup.get(e),K=z.parentLookup.has(e);return{node:j,internals:j.internals,isParent:K}},re);let b=p.type||"default",N=x?.[b]||dr[b];N===void 0&&(_?.("003",pe.error003(b)),b="default",N=x?.default||dr.default);const I=!!(p.draggable||a&&typeof p.draggable>"u"),k=!!(p.selectable||c&&typeof p.selectable>"u"),B=!!(p.connectable||l&&typeof p.connectable>"u"),T=!!(p.focusable||u&&typeof p.focusable>"u"),L=ne(),H=ui(p),y=dh({node:p,nodeType:b,hasDimensions:H,resizeObserver:f}),E=Vi({nodeRef:y,disabled:p.hidden||!I,noDragClassName:d,handleSelector:p.dragHandle,nodeId:e,isSelectable:k,nodeClickDistance:m}),S=Oi();if(p.hidden)return null;const M=ye(p),$=nh(p),P=k||I||t||n||o||r,R=n?z=>n(z,{...w.userNode}):void 0,O=o?z=>o(z,{...w.userNode}):void 0,V=r?z=>r(z,{...w.userNode}):void 0,X=i?z=>i(z,{...w.userNode}):void 0,F=s?z=>s(z,{...w.userNode}):void 0,q=z=>{const{selectNodesOnDrag:j,nodeDragThreshold:K}=L.getState();k&&(!j||!I||K>0)&&Vn({id:e,store:L,nodeRef:y}),t&&t(z,{...w.userNode})},Q=z=>{if(!(hi(z.nativeEvent)||g)){if(ei.includes(z.key)&&k){const j=z.key==="Escape";Vn({id:e,store:L,unselect:j,nodeRef:y})}else if(I&&p.selected&&Object.prototype.hasOwnProperty.call(Ut,z.key)){z.preventDefault();const{ariaLabelConfig:j}=L.getState();L.setState({ariaLiveMessage:j["node.a11yDescription.ariaLiveMessage"]({direction:z.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),S({direction:Ut[z.key],factor:z.shiftKey?4:1})}}},W=()=>{if(g||!y.current?.matches(":focus-visible"))return;const{transform:z,width:j,height:K,autoPanOnNodeFocus:U,setCenter:Y}=L.getState();if(!U)return;qn(new Map([[e,p]]),{x:0,y:0,width:j,height:K},z,!0).length>0||Y(p.position.x+M.width/2,p.position.y+M.height/2,{zoom:z[2]})};return A.jsx("div",{className:ie(["react-flow__node",`react-flow__node-${b}`,{[h]:I},p.className,{selected:p.selected,selectable:k,parent:C,draggable:I,dragging:E}]),ref:y,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:P?"all":"none",visibility:H?"visible":"hidden",...p.style,...$},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:R,onMouseMove:O,onMouseLeave:V,onContextMenu:X,onClick:q,onDoubleClick:F,onKeyDown:T?Q:void 0,tabIndex:T?0:void 0,onFocus:T?W:void 0,role:p.ariaRole??(T?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${Pi}-${v}`,"aria-label":p.ariaLabel,...p.domAttributes,children:A.jsx(Yf,{value:e,children:A.jsx(N,{id:e,data:p.data,type:b,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:p.selected??!1,selectable:k,draggable:I,deletable:p.deletable??!0,isConnectable:B,sourcePosition:p.sourcePosition,targetPosition:p.targetPosition,dragging:E,dragHandle:p.dragHandle,zIndex:w.z,parentId:p.parentId,...M})})})}var hh=D.memo(fh);const gh=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Xi(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,onError:r}=ee(gh,re),i=ch(e.onlyRenderVisibleElements),s=uh();return A.jsx("div",{className:"react-flow__nodes",style:cn,children:i.map(a=>A.jsx(hh,{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))})}Xi.displayName="NodeRenderer";const ph=D.memo(Xi);function mh(e){return ee(D.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&&cd({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),re)}const yh=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return A.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},xh=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return A.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},hr={[Zt.Arrow]:yh,[Zt.ArrowClosed]:xh};function wh(e){const t=ne();return D.useMemo(()=>Object.prototype.hasOwnProperty.call(hr,e)?hr[e]:(t.getState().onError?.("009",pe.error009(e)),null),[e])}const vh=({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 c=wh(t);return c?A.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:A.jsx(c,{color:n,strokeWidth:s})}):null},Yi=({defaultColor:e,rfId:t})=>{const n=ee(i=>i.edges),o=ee(i=>i.defaultEdgeOptions),r=D.useMemo(()=>md(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?A.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:A.jsx("defs",{children:r.map(i=>A.jsx(vh,{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};Yi.displayName="MarkerDefinitions";var bh=D.memo(Yi);function Zi({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:c,className:l,...u}){const[f,d]=D.useState({x:1,y:0,width:0,height:0}),h=ie(["react-flow__edge-textwrapper",l]),g=D.useRef(null);return D.useEffect(()=>{if(g.current){const v=g.current.getBBox();d({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),n?A.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...u,children:[r&&A.jsx("rect",{width:f.width+2*s[0],x:-s[0],y:-s[1],height:f.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),A.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:o,children:n}),c]}):null}Zi.displayName="EdgeText";const _h=D.memo(Zi);function ln({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return A.jsxs(A.Fragment,{children:[A.jsx("path",{...u,d:e,fill:"none",className:ie(["react-flow__edge-path",u.className])}),l?A.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:l,className:"react-flow__edge-interaction"}):null,o&&he(t)&&he(n)?A.jsx(_h,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function gr({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 Wi({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:o,targetY:r,targetPosition:i=Z.Top}){const[s,a]=gr({pos:n,x1:e,y1:t,x2:o,y2:r}),[c,l]=gr({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,f,d,h]=pi({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:c,targetControlY:l});return[`M${e},${t} C${s},${a} ${c},${l} ${o},${r}`,u,f,d,h]}function qi(e){return D.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:x,interactionWidth:m})=>{const[_,p,w]=Wi({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),C=e.isInternal?void 0:t;return A.jsx(ln,{id:C,path:_,labelX:p,labelY:w,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:x,interactionWidth:m})})}const Eh=qi({isInternal:!1}),Gi=qi({isInternal:!0});Eh.displayName="SimpleBezierEdge";Gi.displayName="SimpleBezierEdgeInternal";function Ui(e){return D.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,style:d,sourcePosition:h=Z.Bottom,targetPosition:g=Z.Top,markerEnd:v,markerStart:x,pathOptions:m,interactionWidth:_})=>{const[p,w,C]=zn({sourceX:n,sourceY:o,sourcePosition:h,targetX:r,targetY:i,targetPosition:g,borderRadius:m?.borderRadius,offset:m?.offset,stepPosition:m?.stepPosition}),b=e.isInternal?void 0:t;return A.jsx(ln,{id:b,path:p,labelX:w,labelY:C,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,style:d,markerEnd:v,markerStart:x,interactionWidth:_})})}const Ki=Ui({isInternal:!1}),Qi=Ui({isInternal:!0});Ki.displayName="SmoothStepEdge";Qi.displayName="SmoothStepEdgeInternal";function Ji(e){return D.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return A.jsx(Ki,{...n,id:o,pathOptions:D.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const Sh=Ji({isInternal:!1}),es=Ji({isInternal:!0});Sh.displayName="StepEdge";es.displayName="StepEdgeInternal";function ts(e){return D.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:g,interactionWidth:v})=>{const[x,m,_]=xi({sourceX:n,sourceY:o,targetX:r,targetY:i}),p=e.isInternal?void 0:t;return A.jsx(ln,{id:p,path:x,labelX:m,labelY:_,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:g,interactionWidth:v})})}const Nh=ts({isInternal:!1}),ns=ts({isInternal:!0});Nh.displayName="StraightEdge";ns.displayName="StraightEdgeInternal";function os(e){return D.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=Z.Bottom,targetPosition:a=Z.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:x,pathOptions:m,interactionWidth:_})=>{const[p,w,C]=mi({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:m?.curvature}),b=e.isInternal?void 0:t;return A.jsx(ln,{id:b,path:p,labelX:w,labelY:C,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:x,interactionWidth:_})})}const Ch=os({isInternal:!1}),rs=os({isInternal:!0});Ch.displayName="BezierEdge";rs.displayName="BezierEdgeInternal";const pr={default:rs,straight:ns,step:es,smoothstep:Qi,simplebezier:Gi},mr={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},Mh=(e,t,n)=>n===Z.Left?e-t:n===Z.Right?e+t:e,Ih=(e,t,n)=>n===Z.Top?e-t:n===Z.Bottom?e+t:e,yr="react-flow__edgeupdater";function xr({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return A.jsx("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:ie([yr,`${yr}-${a}`]),cx:Mh(t,o,e),cy:Ih(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function kh({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:f,setReconnecting:d,setUpdateHover:h}){const g=ne(),v=(w,C)=>{if(w.button!==0)return;const{autoPanOnConnect:b,domNode:N,connectionMode:I,connectionRadius:k,lib:B,onConnectStart:T,cancelConnection:L,nodeLookup:H,rfId:y,panBy:E,updateConnection:S}=g.getState(),M=C.type==="target",$=(O,V)=>{d(!1),f?.(O,n,C.type,V)},P=O=>l?.(n,O),R=(O,V)=>{d(!0),u?.(w,n,C.type),T?.(O,V)};Ln.onPointerDown(w.nativeEvent,{autoPanOnConnect:b,connectionMode:I,connectionRadius:k,domNode:N,handleId:C.id,nodeId:C.nodeId,nodeLookup:H,isTarget:M,edgeUpdaterType:C.type,lib:B,flowId:y,cancelConnection:L,panBy:E,isValidConnection:(...O)=>g.getState().isValidConnection?.(...O)??!0,onConnect:P,onConnectStart:R,onConnectEnd:(...O)=>g.getState().onConnectEnd?.(...O),onReconnectEnd:$,updateConnection:S,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},x=w=>v(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=w=>v(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),_=()=>h(!0),p=()=>h(!1);return A.jsxs(A.Fragment,{children:[(e===!0||e==="source")&&A.jsx(xr,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:x,onMouseEnter:_,onMouseOut:p,type:"source"}),(e===!0||e==="target")&&A.jsx(xr,{position:c,centerX:i,centerY:s,radius:t,onMouseDown:m,onMouseEnter:_,onMouseOut:p,type:"target"})]})}function Ah({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,rfId:g,edgeTypes:v,noPanClassName:x,onError:m,disableKeyboardA11y:_}){let p=ee(Y=>Y.edgeLookup.get(e));const w=ee(Y=>Y.defaultEdgeOptions);p=w?{...w,...p}:p;let C=p.type||"default",b=v?.[C]||pr[C];b===void 0&&(m?.("011",pe.error011(C)),C="default",b=v?.default||pr.default);const N=!!(p.focusable||t&&typeof p.focusable>"u"),I=typeof f<"u"&&(p.reconnectable||n&&typeof p.reconnectable>"u"),k=!!(p.selectable||o&&typeof p.selectable>"u"),B=D.useRef(null),[T,L]=D.useState(!1),[H,y]=D.useState(!1),E=ne(),{zIndex:S=p.zIndex,sourceX:M,sourceY:$,targetX:P,targetY:R,sourcePosition:O,targetPosition:V}=ee(D.useCallback(Y=>{const G=Y.nodeLookup.get(p.source),J=Y.nodeLookup.get(p.target);if(!G||!J)return mr;const te=pd({id:e,sourceNode:G,targetNode:J,sourceHandle:p.sourceHandle||null,targetHandle:p.targetHandle||null,connectionMode:Y.connectionMode,onError:m}),oe=ad({selected:p.selected,zIndex:p.zIndex,sourceNode:G,targetNode:J,elevateOnSelect:Y.elevateEdgesOnSelect,zIndexMode:Y.zIndexMode});return{...te||mr,zIndex:oe}},[p.source,p.target,p.sourceHandle,p.targetHandle,p.selected,p.zIndex,m]),re),X=D.useMemo(()=>p.markerStart?`url('#${Hn(p.markerStart,g)}')`:void 0,[p.markerStart,g]),F=D.useMemo(()=>p.markerEnd?`url('#${Hn(p.markerEnd,g)}')`:void 0,[p.markerEnd,g]);if(p.hidden||M===null||$===null||P===null||R===null)return null;const q=Y=>{const{addSelectedEdges:G,unselectNodesAndEdges:J,multiSelectionActive:te}=E.getState();k&&(E.setState({nodesSelectionActive:!1}),p.selected&&te?(J({nodes:[],edges:[p]}),B.current?.blur()):G([e])),r&&r(Y,p)},Q=i?Y=>{i(Y,{...p})}:void 0,W=s?Y=>{s(Y,{...p})}:void 0,z=a?Y=>{a(Y,{...p})}:void 0,j=c?Y=>{c(Y,{...p})}:void 0,K=l?Y=>{l(Y,{...p})}:void 0,U=Y=>{if(!_&&ei.includes(Y.key)&&k){const{unselectNodesAndEdges:G,addSelectedEdges:J}=E.getState();Y.key==="Escape"?(B.current?.blur(),G({edges:[p]})):J([e])}};return A.jsx("svg",{style:{zIndex:S},children:A.jsxs("g",{className:ie(["react-flow__edge",`react-flow__edge-${C}`,p.className,x,{selected:p.selected,animated:p.animated,inactive:!k&&!r,updating:T,selectable:k}]),onClick:q,onDoubleClick:Q,onContextMenu:W,onMouseEnter:z,onMouseMove:j,onMouseLeave:K,onKeyDown:N?U:void 0,tabIndex:N?0:void 0,role:p.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":p.ariaLabel===null?void 0:p.ariaLabel||`Edge from ${p.source} to ${p.target}`,"aria-describedby":N?`${Di}-${g}`:void 0,ref:B,...p.domAttributes,children:[!H&&A.jsx(b,{id:e,source:p.source,target:p.target,type:p.type,selected:p.selected,animated:p.animated,selectable:k,deletable:p.deletable??!0,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,sourceX:M,sourceY:$,targetX:P,targetY:R,sourcePosition:O,targetPosition:V,data:p.data,style:p.style,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerStart:X,markerEnd:F,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth}),I&&A.jsx(kh,{edge:p,isReconnectable:I,reconnectRadius:u,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,sourceX:M,sourceY:$,targetX:P,targetY:R,sourcePosition:O,targetPosition:V,setUpdateHover:L,setReconnecting:y})]})})}var $h=D.memo(Ah);const Ph=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function is({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:f,onEdgeDoubleClick:d,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:v}){const{edgesFocusable:x,edgesReconnectable:m,elementsSelectable:_,onError:p}=ee(Ph,re),w=mh(t);return A.jsxs("div",{className:"react-flow__edges",children:[A.jsx(bh,{defaultColor:e,rfId:n}),w.map(C=>A.jsx($h,{id:C,edgesFocusable:x,edgesReconnectable:m,elementsSelectable:_,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:f,onDoubleClick:d,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:p,edgeTypes:o,disableKeyboardA11y:v},C))]})}is.displayName="EdgeRenderer";const Dh=D.memo(is),wr=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function Th({children:e}){const t=ne(),n=D.useRef(null),[o]=D.useState(()=>t.getState().transform);return Ri(()=>{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=wr(s)))};return i(),t.subscribe(i)},[t]),A.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:wr(o)},children:e})}function zh(e){const t=oo(),n=D.useRef(!1);D.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Hh=e=>e.panZoom?.syncViewport;function Rh(e){const t=ee(Hh),n=ne();return D.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Lh(e){return e.connection.inProgress?{...e.connection,to:St(e.connection.to,e.transform)}:{...e.connection}}function Vh(e){return Lh}function Oh(e){const t=Vh();return ee(t,re)}const Bh=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Fh({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:c}=ee(Bh,re);return!(i&&r&&c)?null:A.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:A.jsx("g",{className:ie(["react-flow__connection",oi(a)]),children:A.jsx(ss,{style:t,type:n,CustomComponent:o,isValid:a})})})}const ss=({style:e,type:t=De.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:c,to:l,toNode:u,toHandle:f,toPosition:d,pointer:h}=Oh();if(!r)return;if(n)return A.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:d,connectionStatus:oi(o),toNode:u,toHandle:f,pointer:h});let g="";const v={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:d};switch(t){case De.Bezier:[g]=mi(v);break;case De.SimpleBezier:[g]=Wi(v);break;case De.Step:[g]=zn({...v,borderRadius:0});break;case De.SmoothStep:[g]=zn(v);break;default:[g]=xi(v)}return A.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};ss.displayName="ConnectionLine";const jh={};function vr(e=jh){D.useRef(e),ne(),D.useEffect(()=>{},[e])}function Xh(){ne(),D.useRef(!1),D.useEffect(()=>{},[])}function as({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:f,onSelectionStart:d,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:v,connectionLineComponent:x,connectionLineContainerStyle:m,selectionKeyCode:_,selectionOnDrag:p,selectionMode:w,multiSelectionKeyCode:C,panActivationKeyCode:b,zoomActivationKeyCode:N,deleteKeyCode:I,onlyRenderVisibleElements:k,elementsSelectable:B,defaultViewport:T,translateExtent:L,minZoom:H,maxZoom:y,preventScrolling:E,defaultMarkerColor:S,zoomOnScroll:M,zoomOnPinch:$,panOnScroll:P,panOnScrollSpeed:R,panOnScrollMode:O,zoomOnDoubleClick:V,panOnDrag:X,autoPanOnSelection:F,onPaneClick:q,onPaneMouseEnter:Q,onPaneMouseMove:W,onPaneMouseLeave:z,onPaneScroll:j,onPaneContextMenu:K,paneClickDistance:U,nodeClickDistance:Y,onEdgeContextMenu:G,onEdgeMouseEnter:J,onEdgeMouseMove:te,onEdgeMouseLeave:oe,reconnectRadius:se,onReconnect:Ee,onReconnectStart:xe,onReconnectEnd:we,noDragClassName:Se,noWheelClassName:ot,noPanClassName:ze,disableKeyboardA11y:He,nodeExtent:ue,rfId:Ne,viewport:Ce,onViewportChange:Re,nodesDraggable:un}){return vr(e),vr(t),Xh(),zh(n),Rh(Ce),A.jsx(sh,{onPaneClick:q,onPaneMouseEnter:Q,onPaneMouseMove:W,onPaneMouseLeave:z,onPaneContextMenu:K,onPaneScroll:j,paneClickDistance:U,deleteKeyCode:I,selectionKeyCode:_,selectionOnDrag:p,selectionMode:w,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:C,panActivationKeyCode:b,zoomActivationKeyCode:N,elementsSelectable:B,zoomOnScroll:M,zoomOnPinch:$,zoomOnDoubleClick:V,panOnScroll:P,panOnScrollSpeed:R,panOnScrollMode:O,panOnDrag:X,autoPanOnSelection:F,defaultViewport:T,translateExtent:L,minZoom:H,maxZoom:y,onSelectionContextMenu:f,preventScrolling:E,noDragClassName:Se,noWheelClassName:ot,noPanClassName:ze,disableKeyboardA11y:He,onViewportChange:Re,isControlledViewport:!!Ce,children:A.jsxs(Th,{children:[A.jsx(Dh,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:Ee,onReconnectStart:xe,onReconnectEnd:we,onlyRenderVisibleElements:k,onEdgeContextMenu:G,onEdgeMouseEnter:J,onEdgeMouseMove:te,onEdgeMouseLeave:oe,reconnectRadius:se,defaultMarkerColor:S,noPanClassName:ze,disableKeyboardA11y:He,rfId:Ne}),A.jsx(Fh,{style:v,type:g,component:x,containerStyle:m}),A.jsx("div",{className:"react-flow__edgelabel-renderer"}),A.jsx(ph,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:Y,onlyRenderVisibleElements:k,noPanClassName:ze,noDragClassName:Se,disableKeyboardA11y:He,nodeExtent:ue,rfId:Ne,nodesDraggable:un}),A.jsx("div",{className:"react-flow__viewport-portal"})]})})}as.displayName="GraphView";const Yh=D.memo(as),Zh=li(),br=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:f,zIndexMode:d="basic"}={})=>{const h=new Map,g=new Map,v=new Map,x=new Map,m=o??t??[],_=n??e??[],p=u??[0,0],w=f??gt;bi(v,x,m);const{nodesInitialized:C}=Rn(_,h,g,{nodeOrigin:p,nodeExtent:w,zIndexMode:d});let b=[0,0,1];if(s&&r&&i){const N=_t(h,{filter:T=>!!((T.width||T.initialWidth)&&(T.height||T.initialHeight))}),{x:I,y:k,zoom:B}=Un(N,r,i,c,l,a?.padding??.1);b=[I,k,B]}return{rfId:"1",width:r??0,height:i??0,transform:b,nodes:_,nodesInitialized:C,nodeLookup:h,parentLookup:g,edges:m,edgeLookup:x,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:gt,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Je.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:p,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:{...ni},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Zh,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:ti,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Wh=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:f,zIndexMode:d})=>rf((h,g)=>{async function v(){const{nodeLookup:x,panZoom:m,fitViewOptions:_,fitViewResolver:p,width:w,height:C,minZoom:b,maxZoom:N}=g();m&&(await ed({nodes:x,width:w,height:C,panZoom:m,minZoom:b,maxZoom:N},_),p?.resolve(!0),h({fitViewResolver:null}))}return{...br({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:f,defaultNodes:n,defaultEdges:o,zIndexMode:d}),setNodes:x=>{const{nodeLookup:m,parentLookup:_,nodeOrigin:p,nodeExtent:w,elevateNodesOnSelect:C,fitViewQueued:b,zIndexMode:N,nodesSelectionActive:I}=g(),{nodesInitialized:k,hasSelectedNodes:B}=Rn(x,m,_,{nodeOrigin:p,nodeExtent:w,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:N}),T=I&&B;b&&k?(v(),h({nodes:x,nodesInitialized:k,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:T})):h({nodes:x,nodesInitialized:k,nodesSelectionActive:T})},setEdges:x=>{const{connectionLookup:m,edgeLookup:_}=g();bi(m,_,x),h({edges:x})},setDefaultNodesAndEdges:(x,m)=>{if(x){const{setNodes:_}=g();_(x),h({hasDefaultNodes:!0})}if(m){const{setEdges:_}=g();_(m),h({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:m,nodeLookup:_,parentLookup:p,domNode:w,nodeOrigin:C,nodeExtent:b,debug:N,fitViewQueued:I,zIndexMode:k}=g(),{changes:B,updatedInternals:T}=Ed(x,_,p,w,C,b,k);T&&(wd(_,p,{nodeOrigin:C,nodeExtent:b,zIndexMode:k}),I?(v(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),B?.length>0&&(N&&console.log("React Flow: trigger node changes",B),m?.(B)))},updateNodePositions:(x,m=!1)=>{const _=[];let p=[];const{nodeLookup:w,triggerNodeChanges:C,connection:b,updateConnection:N,onNodesChangeMiddlewareMap:I}=g();for(const[k,B]of x){const T=w.get(k),L=!!(T?.expandParent&&T?.parentId&&B?.position),H={id:k,type:"position",position:L?{x:Math.max(0,B.position.x),y:Math.max(0,B.position.y)}:B.position,dragging:m};if(T&&b.inProgress&&b.fromNode.id===T.id){const y=Ze(T,b.fromHandle,Z.Left,!0);N({...b,from:y})}L&&T.parentId&&_.push({id:k,parentId:T.parentId,rect:{...B.internals.positionAbsolute,width:B.measured.width??0,height:B.measured.height??0}}),p.push(H)}if(_.length>0){const{parentLookup:k,nodeOrigin:B}=g(),T=no(_,w,k,B);p.push(...T)}for(const k of I.values())p=k(p);C(p)},triggerNodeChanges:x=>{const{onNodesChange:m,setNodes:_,nodes:p,hasDefaultNodes:w,debug:C}=g();if(x?.length){if(w){const b=Cf(x,p);_(b)}C&&console.log("React Flow: trigger node changes",x),m?.(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:m,setEdges:_,edges:p,hasDefaultEdges:w,debug:C}=g();if(x?.length){if(w){const b=Mf(x,p);_(b)}C&&console.log("React Flow: trigger edge changes",x),m?.(x)}},addSelectedNodes:x=>{const{multiSelectionActive:m,edgeLookup:_,nodeLookup:p,triggerNodeChanges:w,triggerEdgeChanges:C}=g();if(m){const b=x.map(N=>Le(N,!0));w(b);return}w(qe(p,new Set([...x]),!0)),C(qe(_))},addSelectedEdges:x=>{const{multiSelectionActive:m,edgeLookup:_,nodeLookup:p,triggerNodeChanges:w,triggerEdgeChanges:C}=g();if(m){const b=x.map(N=>Le(N,!0));C(b);return}C(qe(_,new Set([...x]))),w(qe(p,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:m}={})=>{const{edges:_,nodes:p,nodeLookup:w,triggerNodeChanges:C,triggerEdgeChanges:b}=g(),N=x||p,I=m||_,k=[];for(const T of N){if(!T.selected)continue;const L=w.get(T.id);L&&(L.selected=!1),k.push(Le(T.id,!1))}const B=[];for(const T of I)T.selected&&B.push(Le(T.id,!1));C(k),b(B)},setMinZoom:x=>{const{panZoom:m,maxZoom:_}=g();m?.setScaleExtent([x,_]),h({minZoom:x})},setMaxZoom:x=>{const{panZoom:m,minZoom:_}=g();m?.setScaleExtent([_,x]),h({maxZoom:x})},setTranslateExtent:x=>{g().panZoom?.setTranslateExtent(x),h({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:m,triggerNodeChanges:_,triggerEdgeChanges:p,elementsSelectable:w}=g();if(!w)return;const C=m.reduce((N,I)=>I.selected?[...N,Le(I.id,!1)]:N,[]),b=x.reduce((N,I)=>I.selected?[...N,Le(I.id,!1)]:N,[]);_(C),p(b)},setNodeExtent:x=>{const{nodes:m,nodeLookup:_,parentLookup:p,nodeOrigin:w,elevateNodesOnSelect:C,nodeExtent:b,zIndexMode:N}=g();x[0][0]===b[0][0]&&x[0][1]===b[0][1]&&x[1][0]===b[1][0]&&x[1][1]===b[1][1]||(Rn(m,_,p,{nodeOrigin:w,nodeExtent:x,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:N}),h({nodeExtent:x}))},panBy:x=>{const{transform:m,width:_,height:p,panZoom:w,translateExtent:C}=g();return Sd({delta:x,panZoom:w,transform:m,translateExtent:C,width:_,height:p})},setCenter:async(x,m,_)=>{const{width:p,height:w,maxZoom:C,panZoom:b}=g();if(!b)return!1;const N=typeof _?.zoom<"u"?_.zoom:C;return await b.setViewport({x:p/2-x*N,y:w/2-m*N,zoom:N},{duration:_?.duration,ease:_?.ease,interpolate:_?.interpolate}),!0},cancelConnection:()=>{h({connection:{...ni}})},updateConnection:x=>{h({connection:x})},reset:()=>h({...br()})}},Object.is);function qh({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:f,zIndexMode:d,children:h}){const[g]=D.useState(()=>Wh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:l,minZoom:s,maxZoom:a,fitViewOptions:c,nodeOrigin:u,nodeExtent:f,zIndexMode:d}));return A.jsx(sf,{value:g,children:A.jsx(Pf,{children:A.jsx(Wf,{children:h})})})}function Gh({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:f,nodeExtent:d,zIndexMode:h}){return D.useContext(sn)?A.jsx(A.Fragment,{children:e}):A.jsx(qh,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:f,nodeExtent:d,zIndexMode:h,children:e})}const Uh={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Kh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:g,onConnectEnd:v,onClickConnectStart:x,onClickConnectEnd:m,onNodeMouseEnter:_,onNodeMouseMove:p,onNodeMouseLeave:w,onNodeContextMenu:C,onNodeDoubleClick:b,onNodeDragStart:N,onNodeDrag:I,onNodeDragStop:k,onNodesDelete:B,onEdgesDelete:T,onDelete:L,onSelectionChange:H,onSelectionDragStart:y,onSelectionDrag:E,onSelectionDragStop:S,onSelectionContextMenu:M,onSelectionStart:$,onSelectionEnd:P,onBeforeDelete:R,connectionMode:O,connectionLineType:V=De.Bezier,connectionLineStyle:X,connectionLineComponent:F,connectionLineContainerStyle:q,deleteKeyCode:Q="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:z=!1,selectionMode:j=pt.Full,panActivationKeyCode:K="Space",multiSelectionKeyCode:U=yt()?"Meta":"Control",zoomActivationKeyCode:Y=yt()?"Meta":"Control",snapToGrid:G,snapGrid:J,onlyRenderVisibleElements:te=!1,selectNodesOnDrag:oe,nodesDraggable:se,autoPanOnNodeFocus:Ee,nodesConnectable:xe,nodesFocusable:we,nodeOrigin:Se=Ti,edgesFocusable:ot,edgesReconnectable:ze,elementsSelectable:He=!0,defaultViewport:ue=wf,minZoom:Ne=.5,maxZoom:Ce=2,translateExtent:Re=gt,preventScrolling:un=!0,nodeExtent:dn,defaultMarkerColor:ds="#b1b1b7",zoomOnScroll:fs=!0,zoomOnPinch:hs=!0,panOnScroll:gs=!1,panOnScrollSpeed:ps=.5,panOnScrollMode:ms=Be.Free,zoomOnDoubleClick:ys=!0,panOnDrag:xs=!0,onPaneClick:ws,onPaneMouseEnter:vs,onPaneMouseMove:bs,onPaneMouseLeave:_s,onPaneScroll:Es,onPaneContextMenu:Ss,paneClickDistance:Ns=1,nodeClickDistance:Cs=0,children:Ms,onReconnect:Is,onReconnectStart:ks,onReconnectEnd:As,onEdgeContextMenu:$s,onEdgeDoubleClick:Ps,onEdgeMouseEnter:Ds,onEdgeMouseMove:Ts,onEdgeMouseLeave:zs,reconnectRadius:Hs=10,onNodesChange:Rs,onEdgesChange:Ls,noDragClassName:Vs="nodrag",noWheelClassName:Os="nowheel",noPanClassName:io="nopan",fitView:so,fitViewOptions:ao,connectOnClick:Bs,attributionPosition:Fs,proOptions:js,defaultEdgeOptions:Xs,elevateNodesOnSelect:Ys=!0,elevateEdgesOnSelect:Zs=!1,disableKeyboardA11y:co=!1,autoPanOnConnect:Ws,autoPanOnNodeDrag:qs,autoPanOnSelection:Gs=!0,autoPanSpeed:Us,connectionRadius:Ks,isValidConnection:Qs,onError:Js,style:ea,id:lo,nodeDragThreshold:ta,connectionDragThreshold:na,viewport:oa,onViewportChange:ra,width:ia,height:sa,colorMode:aa="light",debug:ca,onScroll:uo,ariaLabelConfig:la,zIndexMode:fo="basic",...ua},da){const fn=lo||"1",fa=Ef(aa),ha=D.useCallback(ho=>{ho.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),uo?.(ho)},[uo]);return A.jsx("div",{"data-testid":"rf__wrapper",...ua,onScroll:ha,style:{...ea,...Uh},ref:da,className:ie(["react-flow",r,fa]),id:lo,role:"application",children:A.jsxs(Gh,{nodes:e,edges:t,width:ia,height:sa,fitView:so,fitViewOptions:ao,minZoom:Ne,maxZoom:Ce,nodeOrigin:Se,nodeExtent:dn,zIndexMode:fo,children:[A.jsx(_f,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:h,onConnectStart:g,onConnectEnd:v,onClickConnectStart:x,onClickConnectEnd:m,nodesDraggable:se,autoPanOnNodeFocus:Ee,nodesConnectable:xe,nodesFocusable:we,edgesFocusable:ot,edgesReconnectable:ze,elementsSelectable:He,elevateNodesOnSelect:Ys,elevateEdgesOnSelect:Zs,minZoom:Ne,maxZoom:Ce,nodeExtent:dn,onNodesChange:Rs,onEdgesChange:Ls,snapToGrid:G,snapGrid:J,connectionMode:O,translateExtent:Re,connectOnClick:Bs,defaultEdgeOptions:Xs,fitView:so,fitViewOptions:ao,onNodesDelete:B,onEdgesDelete:T,onDelete:L,onNodeDragStart:N,onNodeDrag:I,onNodeDragStop:k,onSelectionDrag:E,onSelectionDragStart:y,onSelectionDragStop:S,onMove:u,onMoveStart:f,onMoveEnd:d,noPanClassName:io,nodeOrigin:Se,rfId:fn,autoPanOnConnect:Ws,autoPanOnNodeDrag:qs,autoPanSpeed:Us,onError:Js,connectionRadius:Ks,isValidConnection:Qs,selectNodesOnDrag:oe,nodeDragThreshold:ta,connectionDragThreshold:na,onBeforeDelete:R,debug:ca,ariaLabelConfig:la,zIndexMode:fo}),A.jsx(Yh,{onInit:l,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:_,onNodeMouseMove:p,onNodeMouseLeave:w,onNodeContextMenu:C,onNodeDoubleClick:b,nodeTypes:i,edgeTypes:s,connectionLineType:V,connectionLineStyle:X,connectionLineComponent:F,connectionLineContainerStyle:q,selectionKeyCode:W,selectionOnDrag:z,selectionMode:j,deleteKeyCode:Q,multiSelectionKeyCode:U,panActivationKeyCode:K,zoomActivationKeyCode:Y,onlyRenderVisibleElements:te,defaultViewport:ue,translateExtent:Re,minZoom:Ne,maxZoom:Ce,preventScrolling:un,zoomOnScroll:fs,zoomOnPinch:hs,zoomOnDoubleClick:ys,panOnScroll:gs,panOnScrollSpeed:ps,panOnScrollMode:ms,panOnDrag:xs,autoPanOnSelection:Gs,onPaneClick:ws,onPaneMouseEnter:vs,onPaneMouseMove:bs,onPaneMouseLeave:_s,onPaneScroll:Es,onPaneContextMenu:Ss,paneClickDistance:Ns,nodeClickDistance:Cs,onSelectionContextMenu:M,onSelectionStart:$,onSelectionEnd:P,onReconnect:Is,onReconnectStart:ks,onReconnectEnd:As,onEdgeContextMenu:$s,onEdgeDoubleClick:Ps,onEdgeMouseEnter:Ds,onEdgeMouseMove:Ts,onEdgeMouseLeave:zs,reconnectRadius:Hs,defaultMarkerColor:ds,noDragClassName:Vs,noWheelClassName:Os,noPanClassName:io,rfId:fn,disableKeyboardA11y:co,nodeExtent:dn,viewport:oa,onViewportChange:ra,nodesDraggable:se}),A.jsx(xf,{onSelectionChange:H}),Ms,A.jsx(hf,{proOptions:js,position:Fs}),A.jsx(ff,{rfId:fn,disableKeyboardA11y:co})]})})}var Cg=Hi(Kh);const Qh=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function Mg({children:e}){const t=ee(Qh);return t?ma.createPortal(e,t):null}function Jh({dimensions:e,lineWidth:t,variant:n,className:o}){return A.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 eg({radius:e,className:t}){return A.jsx("circle",{cx:e,cy:e,r:e,className:ie(["react-flow__background-pattern","dots",t])})}var Te;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Te||(Te={}));const tg={[Te.Dots]:1,[Te.Lines]:1,[Te.Cross]:6},ng=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function cs({id:e,variant:t=Te.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:a,style:c,className:l,patternClassName:u}){const f=D.useRef(null),{transform:d,patternId:h}=ee(ng,re),g=o||tg[t],v=t===Te.Dots,x=t===Te.Cross,m=Array.isArray(n)?n:[n,n],_=[m[0]*d[2]||1,m[1]*d[2]||1],p=g*d[2],w=Array.isArray(i)?i:[i,i],C=x?[p,p]:_,b=[w[0]*d[2]+C[0]/2,w[1]*d[2]+C[1]/2],N=`${h}${e||""}`;return A.jsxs("svg",{className:ie(["react-flow__background",l]),style:{...c,...cn,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:f,"data-testid":"rf__background",children:[A.jsx("pattern",{id:N,x:d[0]%_[0],y:d[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${b[0]},-${b[1]})`,children:v?A.jsx(eg,{radius:p/2,className:u}):A.jsx(Jh,{dimensions:C,lineWidth:r,variant:t,className:u})}),A.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}cs.displayName="Background";D.memo(cs);function og(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:A.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function rg(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:A.jsx("path",{d:"M0 0h32v4.2H0z"})})}function ig(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:A.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 sg(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:A.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 ag(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:A.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 Dt({children:e,className:t,...n}){return A.jsx("button",{type:"button",className:ie(["react-flow__controls-button",t]),...n,children:e})}const cg=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ls({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:c,className:l,children:u,position:f="bottom-left",orientation:d="vertical","aria-label":h}){const g=ne(),{isInteractive:v,minZoomReached:x,maxZoomReached:m,ariaLabelConfig:_}=ee(cg,re),{zoomIn:p,zoomOut:w,fitView:C}=oo(),b=()=>{p(),i?.()},N=()=>{w(),s?.()},I=()=>{C(r),a?.()},k=()=>{g.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),c?.(!v)},B=d==="horizontal"?"horizontal":"vertical";return A.jsxs(an,{className:ie(["react-flow__controls",B,l]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??_["controls.ariaLabel"],children:[t&&A.jsxs(A.Fragment,{children:[A.jsx(Dt,{onClick:b,className:"react-flow__controls-zoomin",title:_["controls.zoomIn.ariaLabel"],"aria-label":_["controls.zoomIn.ariaLabel"],disabled:m,children:A.jsx(og,{})}),A.jsx(Dt,{onClick:N,className:"react-flow__controls-zoomout",title:_["controls.zoomOut.ariaLabel"],"aria-label":_["controls.zoomOut.ariaLabel"],disabled:x,children:A.jsx(rg,{})})]}),n&&A.jsx(Dt,{className:"react-flow__controls-fitview",onClick:I,title:_["controls.fitView.ariaLabel"],"aria-label":_["controls.fitView.ariaLabel"],children:A.jsx(ig,{})}),o&&A.jsx(Dt,{className:"react-flow__controls-interactive",onClick:k,title:_["controls.interactive.ariaLabel"],"aria-label":_["controls.interactive.ariaLabel"],children:v?A.jsx(ag,{}):A.jsx(sg,{})}),u]})}ls.displayName="Controls";const Ig=D.memo(ls);function lg({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:c,className:l,borderRadius:u,shapeRendering:f,selected:d,onClick:h}){const{background:g,backgroundColor:v}=i||{},x=s||g||v;return A.jsx("rect",{className:ie(["react-flow__minimap-node",{selected:d},l]),x:t,y:n,rx:u,ry:u,width:o,height:r,style:{fill:x,stroke:a,strokeWidth:c},shapeRendering:f,onClick:h?m=>h(m,e):void 0})}const ug=D.memo(lg),dg=e=>e.nodes.map(t=>t.id),Nn=e=>e instanceof Function?e:()=>e;function fg({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=ug,onClick:s}){const a=ee(dg,re),c=Nn(t),l=Nn(e),u=Nn(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return A.jsx(A.Fragment,{children:a.map(d=>A.jsx(gg,{id:d,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:f},d))})}function hg({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:c}){const{node:l,x:u,y:f,width:d,height:h}=ee(g=>{const v=g.nodeLookup.get(e);if(!v)return{node:void 0,x:0,y:0,width:0,height:0};const x=v.internals.userNode,{x:m,y:_}=v.internals.positionAbsolute,{width:p,height:w}=ye(x);return{node:x,x:m,y:_,width:p,height:w}},re);return!l||l.hidden||!ui(l)?null:A.jsx(a,{x:u,y:f,width:d,height:h,style:l.style,selected:!!l.selected,className:o(l),color:t(l),borderRadius:r,strokeColor:n(l),strokeWidth:i,shapeRendering:s,onClick:c,id:l.id})}const gg=D.memo(hg);var pg=D.memo(fg);const mg=200,yg=150,xg=e=>!e.hidden,wg=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?ai(_t(e.nodeLookup,{filter:xg}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},_r=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,vg=(e,t)=>_r(e.viewBB,t.viewBB)&&_r(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,bg="react-flow__minimap-desc";function us({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:f,position:d="bottom-right",onClick:h,onNodeClick:g,pannable:v=!1,zoomable:x=!1,ariaLabel:m,inversePan:_,zoomStep:p=1,offsetScale:w=5}){const C=ne(),b=D.useRef(null),{boundingRect:N,viewBB:I,rfId:k,panZoom:B,translateExtent:T,flowWidth:L,flowHeight:H,ariaLabelConfig:y}=ee(wg,vg),E=e?.width??mg,S=e?.height??yg,M=N.width/E,$=N.height/S,P=Math.max(M,$),R=P*E,O=P*S,V=w*P,X=N.x-(R-N.width)/2-V,F=N.y-(O-N.height)/2-V,q=R+V*2,Q=O+V*2,W=`${bg}-${k}`,z=D.useRef(0),j=D.useRef();z.current=P,D.useEffect(()=>{if(b.current&&B)return j.current=Dd({domNode:b.current,panZoom:B,getTransform:()=>C.getState().transform,getViewScale:()=>z.current}),()=>{j.current?.destroy()}},[B]),D.useEffect(()=>{j.current?.update({translateExtent:T,width:L,height:H,inversePan:_,pannable:v,zoomStep:p,zoomable:x})},[v,x,_,p,T,L,H]);const K=h?G=>{const[J,te]=j.current?.pointer(G)||[0,0];h(G,{x:J,y:te})}:void 0,U=g?D.useCallback((G,J)=>{const te=C.getState().nodeLookup.get(J).internals.userNode;g(G,te)},[]):void 0,Y=m??y["minimap.ariaLabel"];return A.jsx(an,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*P: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:A.jsxs("svg",{width:E,height:S,viewBox:`${X} ${F} ${q} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":W,ref:b,onClick:K,children:[Y&&A.jsx("title",{id:W,children:Y}),A.jsx(pg,{onClick:U,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:a}),A.jsx("path",{className:"react-flow__minimap-mask",d:`M${X-V},${F-V}h${q+V*2}v${Q+V*2}h${-q-V*2}z
7
+ M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}us.displayName="MiniMap";const kg=D.memo(us),_g=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Eg={[nt.Line]:"right",[nt.Handle]:"bottom-right"};function Sg({nodeId:e,position:t,variant:n=nt.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:a=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:d,autoScale:h=!0,shouldResize:g,onResizeStart:v,onResize:x,onResizeEnd:m}){const _=Bi(),p=typeof e=="string"?e:_,w=ne(),C=D.useRef(null),b=n===nt.Handle,N=ee(D.useCallback(_g(b&&h),[b,h]),re),I=D.useRef(null),k=t??Eg[n];D.useEffect(()=>{if(!(!C.current||!p))return I.current||(I.current=Zd({domNode:C.current,nodeId:p,getStoreItems:()=>{const{nodeLookup:T,transform:L,snapGrid:H,snapToGrid:y,nodeOrigin:E,domNode:S}=w.getState();return{nodeLookup:T,transform:L,snapGrid:H,snapToGrid:y,nodeOrigin:E,paneDomNode:S}},onChange:(T,L)=>{const{triggerNodeChanges:H,nodeLookup:y,parentLookup:E,nodeOrigin:S}=w.getState(),M=[],$={x:T.x,y:T.y},P=y.get(p);if(P&&P.expandParent&&P.parentId){const R=P.origin??S,O=T.width??P.measured.width??0,V=T.height??P.measured.height??0,X={id:P.id,parentId:P.parentId,rect:{width:O,height:V,...di({x:T.x??P.position.x,y:T.y??P.position.y},{width:O,height:V},P.parentId,y,R)}},F=no([X],y,E,S);M.push(...F),$.x=T.x?Math.max(R[0]*O,T.x):void 0,$.y=T.y?Math.max(R[1]*V,T.y):void 0}if($.x!==void 0&&$.y!==void 0){const R={id:p,type:"position",position:{...$}};M.push(R)}if(T.width!==void 0&&T.height!==void 0){const O={id:p,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:T.width,height:T.height}};M.push(O)}for(const R of L){const O={...R,type:"position"};M.push(O)}H(M)},onEnd:({width:T,height:L})=>{const H={id:p,type:"dimensions",resizing:!1,dimensions:{width:T,height:L}};w.getState().triggerNodeChanges([H])}})),I.current.update({controlPosition:k,boundaries:{minWidth:a,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:f,resizeDirection:d,onResizeStart:v,onResize:x,onResizeEnd:m,shouldResize:g}),()=>{I.current?.destroy()}},[k,a,c,l,u,f,v,x,m,g]);const B=k.split("-");return A.jsx("div",{className:ie(["react-flow__resize-control","nodrag",...B,n,o]),ref:C,style:{...r,scale:N,...s&&{[b?"backgroundColor":"borderColor"]:s}},children:i})}D.memo(Sg);export{ln as B,Ig as C,Mg as E,Gt as H,kg as M,Z as P,qh as R,Cf as a,Zt as b,zn as g,Cg as i,oo as u};
@@ -0,0 +1,17 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="theme-color" content="#0b0d12" />
7
+ <title>Agent Runtime Map</title>
8
+ <script type="module" crossorigin src="./assets/index-4tql6hvj.js"></script>
9
+ <link rel="modulepreload" crossorigin href="./assets/react-C8zC5XaP.js">
10
+ <link rel="modulepreload" crossorigin href="./assets/xyflow-NEmtYq4w.js">
11
+ <link rel="stylesheet" crossorigin href="./assets/xyflow-BnuhLJ6X.css">
12
+ <link rel="stylesheet" crossorigin href="./assets/index-Dvsvzpjt.css">
13
+ </head>
14
+ <body>
15
+ <div id="root"></div>
16
+ </body>
17
+ </html>
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "agent-runtime-map",
3
+ "version": "0.8.0",
4
+ "description": "Inspect every Agent feature as an evidence-backed, step-through execution circuit.",
5
+ "homepage": "https://github.com/TheCrazyAnt/agent-runtime-map#readme",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/TheCrazyAnt/agent-runtime-map.git",
9
+ "directory": "packages/cli"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/TheCrazyAnt/agent-runtime-map/issues"
13
+ },
14
+ "type": "module",
15
+ "bin": {
16
+ "agent-runtime-map": "dist/cli.js",
17
+ "logic-map": "dist/cli.js"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "README.md",
22
+ "LICENSE",
23
+ "THIRD_PARTY_NOTICES.md"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsup && node scripts/copy-viewer.mjs",
27
+ "prepack": "npm run build -w @agent-runtime-map/viewer && npm run build",
28
+ "clean": "rm -rf dist"
29
+ },
30
+ "dependencies": {
31
+ "ts-morph": "^28.0.0"
32
+ },
33
+ "devDependencies": {
34
+ "@agent-runtime-map/core": "*"
35
+ },
36
+ "engines": {
37
+ "node": ">=20"
38
+ },
39
+ "license": "MIT",
40
+ "keywords": [
41
+ "codebase",
42
+ "visualization",
43
+ "static-analysis",
44
+ "architecture",
45
+ "agents",
46
+ "agent-runtime-map",
47
+ "logic-map",
48
+ "agent-debugging",
49
+ "workflow"
50
+ ],
51
+ "publishConfig": {
52
+ "access": "public"
53
+ }
54
+ }