PageSourceSearch

https://dashboard.y.uno/assets/vendor-flow-DOSM1U9c.js

js y.uno collected 2026-09-24 08:56:08 UTC 163,834 bytes, 7 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.