autoforge-ai 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server/services/browser_view_service.py +280 -280
- package/ui/dist/assets/index-BB9FkE5a.js +96 -0
- package/ui/dist/assets/index-CaH_F11g.css +1 -0
- package/ui/dist/assets/{vendor-flow-CSXy01ye.js → vendor-flow-4rkFkfFX.js} +1 -1
- package/ui/dist/assets/vendor-radix-CXoPacKb.js +45 -0
- package/ui/dist/assets/vendor-utils-_RSkPk2f.js +2 -0
- package/ui/dist/index.html +5 -5
- package/ui/dist/assets/index-B5-x5jW8.js +0 -96
- package/ui/dist/assets/index-DkJ1zszK.css +0 -1
- package/ui/dist/assets/vendor-radix-DIVIznMB.js +0 -45
- package/ui/dist/assets/vendor-utils-CnTXttNm.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as yv,g as n_,b as r_,r as $,j as F,c as on}from"./vendor-query-CcgjkJlA.js";import"./vendor-radix-DIVIznMB.js";function ue(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ue(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var i_={value:()=>{}};function Pn(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new gn(n)}function gn(e){this._=e}function o_(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}gn.prototype=Pn.prototype={constructor:gn,on:function(e,t){var n=this._,r=o_(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o<a;)if((i=(e=r[o]).type)&&(i=a_(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<a;)if(i=(e=r[o]).type)n[i]=Gc(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Gc(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new gn(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function a_(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Gc(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=i_,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Hu="http://www.w3.org/1999/xhtml";const Uc={svg:"http://www.w3.org/2000/svg",xhtml:Hu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function kn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Uc.hasOwnProperty(t)?{space:Uc[t],local:e}:e}function s_(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Hu&&t.documentElement.namespaceURI===Hu?t.createElement(e):t.createElementNS(n,e)}}function u_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _v(e){var t=kn(e);return(t.local?u_:s_)(t)}function c_(){}function tc(e){return e==null?c_:function(){return this.querySelector(e)}}function l_(e){typeof e!="function"&&(e=tc(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=new Array(a),c,u,l=0;l<a;++l)(c=o[l])&&(u=e.call(c,c.__data__,l,o))&&("__data__"in c&&(u.__data__=c.__data__),s[l]=u);return new ve(r,this._parents)}function f_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function d_(){return[]}function bv(e){return e==null?d_:function(){return this.querySelectorAll(e)}}function h_(e){return function(){return f_(e.apply(this,arguments))}}function p_(e){typeof e=="function"?e=h_(e):e=bv(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var a=t[o],s=a.length,c,u=0;u<s;++u)(c=a[u])&&(r.push(e.call(c,c.__data__,u,a)),i.push(c));return new ve(r,i)}function wv(e){return function(){return this.matches(e)}}function xv(e){return function(t){return t.matches(e)}}var g_=Array.prototype.find;function v_(e){return function(){return g_.call(this.children,e)}}function m_(){return this.firstElementChild}function y_(e){return this.select(e==null?m_:v_(typeof e=="function"?e:xv(e)))}var __=Array.prototype.filter;function b_(){return Array.from(this.children)}function w_(e){return function(){return __.call(this.children,e)}}function x_(e){return this.selectAll(e==null?b_:w_(typeof e=="function"?e:xv(e)))}function E_(e){typeof e!="function"&&(e=wv(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],c,u=0;u<a;++u)(c=o[u])&&e.call(c,c.__data__,u,o)&&s.push(c);return new ve(r,this._parents)}function Ev(e){return new Array(e.length)}function S_(){return new ve(this._enter||this._groups.map(Ev),this._parents)}function bn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}bn.prototype={constructor:bn,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 C_(e){return function(){return e}}function q_(e,t,n,r,i,o){for(var a=0,s,c=t.length,u=o.length;a<u;++a)(s=t[a])?(s.__data__=o[a],r[a]=s):n[a]=new bn(e,o[a]);for(;a<c;++a)(s=t[a])&&(i[a]=s)}function R_(e,t,n,r,i,o,a){var s,c,u=new Map,l=t.length,f=o.length,d=new Array(l),h;for(s=0;s<l;++s)(c=t[s])&&(d[s]=h=a.call(c,c.__data__,s,t)+"",u.has(h)?i[s]=c:u.set(h,c));for(s=0;s<f;++s)h=a.call(e,o[s],s,o)+"",(c=u.get(h))?(r[s]=c,c.__data__=o[s],u.delete(h)):n[s]=new bn(e,o[s]);for(s=0;s<l;++s)(c=t[s])&&u.get(d[s])===c&&(i[s]=c)}function I_(e){return e.__data__}function N_(e,t){if(!arguments.length)return Array.from(this,I_);var n=t?R_:q_,r=this._parents,i=this._groups;typeof e!="function"&&(e=C_(e));for(var o=i.length,a=new Array(o),s=new Array(o),c=new Array(o),u=0;u<o;++u){var l=r[u],f=i[u],d=f.length,h=A_(e.call(l,l&&l.__data__,u,r)),g=h.length,m=s[u]=new Array(g),v=a[u]=new Array(g),y=c[u]=new Array(d);n(l,f,m,v,y,h,t);for(var b=0,p=0,_,x;b<g;++b)if(_=m[b]){for(b>=p&&(p=b+1);!(x=v[p])&&++p<g;);_._next=x||null}}return a=new ve(a,r),a._enter=s,a._exit=c,a}function A_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function M_(){return new ve(this._exit||this._groups.map(Ev),this._parents)}function T_(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function P_(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),c=0;c<a;++c)for(var u=n[c],l=r[c],f=u.length,d=s[c]=new Array(f),h,g=0;g<f;++g)(h=u[g]||l[g])&&(d[g]=h);for(;c<i;++c)s[c]=n[c];return new ve(s,this._parents)}function k_(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],a;--i>=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function O_(e){e||(e=L_);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a=n[o],s=a.length,c=i[o]=new Array(s),u,l=0;l<s;++l)(u=a[l])&&(c[l]=u);c.sort(t)}return new ve(i,this._parents).order()}function L_(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function D_(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function F_(){return Array.from(this)}function z_(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null}function $_(){let e=0;for(const t of this)++e;return e}function H_(){return!this.node()}function B_(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,a=i.length,s;o<a;++o)(s=i[o])&&e.call(s,s.__data__,o,i);return this}function j_(e){return function(){this.removeAttribute(e)}}function V_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function G_(e,t){return function(){this.setAttribute(e,t)}}function U_(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Y_(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function W_(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 X_(e,t){var n=kn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?V_:j_:typeof t=="function"?n.local?W_:Y_:n.local?U_:G_)(n,t))}function Sv(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function K_(e){return function(){this.style.removeProperty(e)}}function Z_(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Q_(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function J_(e,t,n){return arguments.length>1?this.each((t==null?K_:typeof t=="function"?Q_:Z_)(e,t,n??"")):gt(this.node(),e)}function gt(e,t){return e.style.getPropertyValue(t)||Sv(e).getComputedStyle(e,null).getPropertyValue(t)}function eb(e){return function(){delete this[e]}}function tb(e,t){return function(){this[e]=t}}function nb(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function rb(e,t){return arguments.length>1?this.each((t==null?eb:typeof t=="function"?nb:tb)(e,t)):this.node()[e]}function Cv(e){return e.trim().split(/^|\s+/)}function nc(e){return e.classList||new qv(e)}function qv(e){this._node=e,this._names=Cv(e.getAttribute("class")||"")}qv.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 Rv(e,t){for(var n=nc(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Iv(e,t){for(var n=nc(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function ib(e){return function(){Rv(this,e)}}function ob(e){return function(){Iv(this,e)}}function ab(e,t){return function(){(t.apply(this,arguments)?Rv:Iv)(this,e)}}function sb(e,t){var n=Cv(e+"");if(arguments.length<2){for(var r=nc(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?ab:t?ib:ob)(n,t))}function ub(){this.textContent=""}function cb(e){return function(){this.textContent=e}}function lb(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function fb(e){return arguments.length?this.each(e==null?ub:(typeof e=="function"?lb:cb)(e)):this.node().textContent}function db(){this.innerHTML=""}function hb(e){return function(){this.innerHTML=e}}function pb(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function gb(e){return arguments.length?this.each(e==null?db:(typeof e=="function"?pb:hb)(e)):this.node().innerHTML}function vb(){this.nextSibling&&this.parentNode.appendChild(this)}function mb(){return this.each(vb)}function yb(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function _b(){return this.each(yb)}function bb(e){var t=typeof e=="function"?e:_v(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function wb(){return null}function xb(e,t){var n=typeof e=="function"?e:_v(e),r=t==null?wb:typeof t=="function"?t:tc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Eb(){var e=this.parentNode;e&&e.removeChild(this)}function Sb(){return this.each(Eb)}function Cb(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qb(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Rb(e){return this.select(e?qb:Cb)}function Ib(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Nb(e){return function(t){e.call(this,t,this.__data__)}}function Ab(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Mb(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function Tb(e,t,n){return function(){var r=this.__on,i,o=Nb(t);if(r){for(var a=0,s=r.length;a<s;++a)if((i=r[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function Pb(e,t,n){var r=Ab(e+""),i,o=r.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,u=s.length,l;c<u;++c)for(i=0,l=s[c];i<o;++i)if((a=r[i]).type===l.type&&a.name===l.name)return l.value}return}for(s=t?Tb:Mb,i=0;i<o;++i)this.each(s(r[i],t,n));return this}function Nv(e,t,n){var r=Sv(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function kb(e,t){return function(){return Nv(this,e,t)}}function Ob(e,t){return function(){return Nv(this,e,t.apply(this,arguments))}}function Lb(e,t){return this.each((typeof t=="function"?Ob:kb)(e,t))}function*Db(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,a;i<o;++i)(a=r[i])&&(yield a)}var Av=[null];function ve(e,t){this._groups=e,this._parents=t}function Gt(){return new ve([[document.documentElement]],Av)}function Fb(){return this}ve.prototype=Gt.prototype={constructor:ve,select:l_,selectAll:p_,selectChild:y_,selectChildren:x_,filter:E_,data:N_,enter:S_,exit:M_,join:T_,merge:P_,selection:Fb,order:k_,sort:O_,call:D_,nodes:F_,node:z_,size:$_,empty:H_,each:B_,attr:X_,style:J_,property:rb,classed:sb,text:fb,html:gb,raise:mb,lower:_b,append:bb,insert:xb,remove:Sb,clone:Rb,datum:Ib,on:Pb,dispatch:Lb,[Symbol.iterator]:Db};function ge(e){return typeof e=="string"?new ve([[document.querySelector(e)]],[document.documentElement]):new ve([[e]],Av)}function zb(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _e(e,t){if(e=zb(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const $b={passive:!1},Lt={capture:!0,passive:!1};function lr(e){e.stopImmediatePropagation()}function ht(e){e.preventDefault(),e.stopImmediatePropagation()}function Mv(e){var t=e.document.documentElement,n=ge(e).on("dragstart.drag",ht,Lt);"onselectstart"in t?n.on("selectstart.drag",ht,Lt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Tv(e,t){var n=e.document.documentElement,r=ge(e).on("dragstart.drag",null);t&&(r.on("click.drag",ht,Lt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const an=e=>()=>e;function Bu(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:c,dy:u,dispatch:l}){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:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:l}})}Bu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Hb(e){return!e.ctrlKey&&!e.button}function Bb(){return this.parentNode}function jb(e,t){return t??{x:e.x,y:e.y}}function Vb(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pv(){var e=Hb,t=Bb,n=jb,r=Vb,i={},o=Pn("start","drag","end"),a=0,s,c,u,l,f=0;function d(_){_.on("mousedown.drag",h).filter(r).on("touchstart.drag",v).on("touchmove.drag",y,$b).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(_,x){if(!(l||!e.call(this,_,x))){var w=p(this,t.call(this,_,x),_,x,"mouse");w&&(ge(_.view).on("mousemove.drag",g,Lt).on("mouseup.drag",m,Lt),Mv(_.view),lr(_),u=!1,s=_.clientX,c=_.clientY,w("start",_))}}function g(_){if(ht(_),!u){var x=_.clientX-s,w=_.clientY-c;u=x*x+w*w>f}i.mouse("drag",_)}function m(_){ge(_.view).on("mousemove.drag mouseup.drag",null),Tv(_.view,u),ht(_),i.mouse("end",_)}function v(_,x){if(e.call(this,_,x)){var w=_.changedTouches,E=t.call(this,_,x),R=w.length,C,T;for(C=0;C<R;++C)(T=p(this,E,_,x,w[C].identifier,w[C]))&&(lr(_),T("start",_,w[C]))}}function y(_){var x=_.changedTouches,w=x.length,E,R;for(E=0;E<w;++E)(R=i[x[E].identifier])&&(ht(_),R("drag",_,x[E]))}function b(_){var x=_.changedTouches,w=x.length,E,R;for(l&&clearTimeout(l),l=setTimeout(function(){l=null},500),E=0;E<w;++E)(R=i[x[E].identifier])&&(lr(_),R("end",_,x[E]))}function p(_,x,w,E,R,C){var T=o.copy(),q=_e(C||w,x),M,k,S;if((S=n.call(_,new Bu("beforestart",{sourceEvent:w,target:d,identifier:R,active:a,x:q[0],y:q[1],dx:0,dy:0,dispatch:T}),E))!=null)return M=S.x-q[0]||0,k=S.y-q[1]||0,function A(N,L,P){var D=q,j;switch(N){case"start":i[R]=A,j=a++;break;case"end":delete i[R],--a;case"drag":q=_e(P||L,x),j=a;break}T.call(N,_,new Bu(N,{sourceEvent:L,subject:S,target:d,identifier:R,active:j,x:q[0]+M,y:q[1]+k,dx:q[0]-D[0],dy:q[1]-D[1],dispatch:T}),E)}}return d.filter=function(_){return arguments.length?(e=typeof _=="function"?_:an(!!_),d):e},d.container=function(_){return arguments.length?(t=typeof _=="function"?_:an(_),d):t},d.subject=function(_){return arguments.length?(n=typeof _=="function"?_:an(_),d):n},d.touchable=function(_){return arguments.length?(r=typeof _=="function"?_:an(!!_),d):r},d.on=function(){var _=o.on.apply(o,arguments);return _===o?d:_},d.clickDistance=function(_){return arguments.length?(f=(_=+_)*_,d):Math.sqrt(f)},d}function rc(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function kv(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Ut(){}var Dt=.7,wn=1/Dt,pt="\\s*([+-]?\\d+)\\s*",Ft="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ne="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Gb=/^#([0-9a-f]{3,8})$/,Ub=new RegExp(`^rgb\\(${pt},${pt},${pt}\\)$`),Yb=new RegExp(`^rgb\\(${Ne},${Ne},${Ne}\\)$`),Wb=new RegExp(`^rgba\\(${pt},${pt},${pt},${Ft}\\)$`),Xb=new RegExp(`^rgba\\(${Ne},${Ne},${Ne},${Ft}\\)$`),Kb=new RegExp(`^hsl\\(${Ft},${Ne},${Ne}\\)$`),Zb=new RegExp(`^hsla\\(${Ft},${Ne},${Ne},${Ft}\\)$`),Yc={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};rc(Ut,tt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Wc,formatHex:Wc,formatHex8:Qb,formatHsl:Jb,formatRgb:Xc,toString:Xc});function Wc(){return this.rgb().formatHex()}function Qb(){return this.rgb().formatHex8()}function Jb(){return Ov(this).formatHsl()}function Xc(){return this.rgb().formatRgb()}function tt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Gb.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Kc(t):n===3?new he(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?sn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?sn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ub.exec(e))?new he(t[1],t[2],t[3],1):(t=Yb.exec(e))?new he(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Wb.exec(e))?sn(t[1],t[2],t[3],t[4]):(t=Xb.exec(e))?sn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Kb.exec(e))?Jc(t[1],t[2]/100,t[3]/100,1):(t=Zb.exec(e))?Jc(t[1],t[2]/100,t[3]/100,t[4]):Yc.hasOwnProperty(e)?Kc(Yc[e]):e==="transparent"?new he(NaN,NaN,NaN,0):null}function Kc(e){return new he(e>>16&255,e>>8&255,e&255,1)}function sn(e,t,n,r){return r<=0&&(e=t=n=NaN),new he(e,t,n,r)}function ew(e){return e instanceof Ut||(e=tt(e)),e?(e=e.rgb(),new he(e.r,e.g,e.b,e.opacity)):new he}function ju(e,t,n,r){return arguments.length===1?ew(e):new he(e,t,n,r??1)}function he(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}rc(he,ju,kv(Ut,{brighter(e){return e=e==null?wn:Math.pow(wn,e),new he(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Dt:Math.pow(Dt,e),new he(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new he(Je(this.r),Je(this.g),Je(this.b),xn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Zc,formatHex:Zc,formatHex8:tw,formatRgb:Qc,toString:Qc}));function Zc(){return`#${Qe(this.r)}${Qe(this.g)}${Qe(this.b)}`}function tw(){return`#${Qe(this.r)}${Qe(this.g)}${Qe(this.b)}${Qe((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qc(){const e=xn(this.opacity);return`${e===1?"rgb(":"rgba("}${Je(this.r)}, ${Je(this.g)}, ${Je(this.b)}${e===1?")":`, ${e})`}`}function xn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Je(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Qe(e){return e=Je(e),(e<16?"0":"")+e.toString(16)}function Jc(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new be(e,t,n,r)}function Ov(e){if(e instanceof be)return new be(e.h,e.s,e.l,e.opacity);if(e instanceof Ut||(e=tt(e)),!e)return new be;if(e instanceof be)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,s=o-i,c=(o+i)/2;return s?(t===o?a=(n-r)/s+(n<r)*6:n===o?a=(r-t)/s+2:a=(t-n)/s+4,s/=c<.5?o+i:2-o-i,a*=60):s=c>0&&c<1?0:a,new be(a,s,c,e.opacity)}function nw(e,t,n,r){return arguments.length===1?Ov(e):new be(e,t,n,r??1)}function be(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}rc(be,nw,kv(Ut,{brighter(e){return e=e==null?wn:Math.pow(wn,e),new be(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Dt:Math.pow(Dt,e),new be(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new he(fr(e>=240?e-240:e+120,i,r),fr(e,i,r),fr(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new be(el(this.h),un(this.s),un(this.l),xn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=xn(this.opacity);return`${e===1?"hsl(":"hsla("}${el(this.h)}, ${un(this.s)*100}%, ${un(this.l)*100}%${e===1?")":`, ${e})`}`}}));function el(e){return e=(e||0)%360,e<0?e+360:e}function un(e){return Math.max(0,Math.min(1,e||0))}function fr(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const ic=e=>()=>e;function rw(e,t){return function(n){return e+n*t}}function iw(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function ow(e){return(e=+e)==1?Lv:function(t,n){return n-t?iw(t,n,e):ic(isNaN(t)?n:t)}}function Lv(e,t){var n=t-e;return n?rw(e,n):ic(isNaN(e)?t:e)}const En=(function e(t){var n=ow(t);function r(i,o){var a=n((i=ju(i)).r,(o=ju(o)).r),s=n(i.g,o.g),c=n(i.b,o.b),u=Lv(i.opacity,o.opacity);return function(l){return i.r=a(l),i.g=s(l),i.b=c(l),i.opacity=u(l),i+""}}return r.gamma=e,r})(1);function aw(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=e[i]*(1-o)+t[i]*o;return r}}function sw(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function uw(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),o=new Array(n),a;for(a=0;a<r;++a)i[a]=kt(e[a],t[a]);for(;a<n;++a)o[a]=t[a];return function(s){for(a=0;a<r;++a)o[a]=i[a](s);return o}}function cw(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ie(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function lw(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=kt(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var Vu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,dr=new RegExp(Vu.source,"g");function fw(e){return function(){return e}}function dw(e){return function(t){return e(t)+""}}function Dv(e,t){var n=Vu.lastIndex=dr.lastIndex=0,r,i,o,a=-1,s=[],c=[];for(e=e+"",t=t+"";(r=Vu.exec(e))&&(i=dr.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,c.push({i:a,x:Ie(r,i)})),n=dr.lastIndex;return n<t.length&&(o=t.slice(n),s[a]?s[a]+=o:s[++a]=o),s.length<2?c[0]?dw(c[0].x):fw(t):(t=c.length,function(u){for(var l=0,f;l<t;++l)s[(f=c[l]).i]=f.x(u);return s.join("")})}function kt(e,t){var n=typeof t,r;return t==null||n==="boolean"?ic(t):(n==="number"?Ie:n==="string"?(r=tt(t))?(t=r,En):Dv:t instanceof tt?En:t instanceof Date?cw:sw(t)?aw:Array.isArray(t)?uw:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?lw:Ie)(e,t)}var tl=180/Math.PI,Gu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Fv(e,t,n,r,i,o){var a,s,c;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*tl,skewX:Math.atan(c)*tl,scaleX:a,scaleY:s}}var cn;function hw(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Gu:Fv(t.a,t.b,t.c,t.d,t.e,t.f)}function pw(e){return e==null||(cn||(cn=document.createElementNS("http://www.w3.org/2000/svg","g")),cn.setAttribute("transform",e),!(e=cn.transform.baseVal.consolidate()))?Gu:(e=e.matrix,Fv(e.a,e.b,e.c,e.d,e.e,e.f))}function zv(e,t,n,r){function i(u){return u.length?u.pop()+" ":""}function o(u,l,f,d,h,g){if(u!==f||l!==d){var m=h.push("translate(",null,t,null,n);g.push({i:m-4,x:Ie(u,f)},{i:m-2,x:Ie(l,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function a(u,l,f,d){u!==l?(u-l>180?l+=360:l-u>180&&(u+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Ie(u,l)})):l&&f.push(i(f)+"rotate("+l+r)}function s(u,l,f,d){u!==l?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Ie(u,l)}):l&&f.push(i(f)+"skewX("+l+r)}function c(u,l,f,d,h,g){if(u!==f||l!==d){var m=h.push(i(h)+"scale(",null,",",null,")");g.push({i:m-4,x:Ie(u,f)},{i:m-2,x:Ie(l,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(u,l){var f=[],d=[];return u=e(u),l=e(l),o(u.translateX,u.translateY,l.translateX,l.translateY,f,d),a(u.rotate,l.rotate,f,d),s(u.skewX,l.skewX,f,d),c(u.scaleX,u.scaleY,l.scaleX,l.scaleY,f,d),u=l=null,function(h){for(var g=-1,m=d.length,v;++g<m;)f[(v=d[g]).i]=v.x(h);return f.join("")}}}var gw=zv(hw,"px, ","px)","deg)"),vw=zv(pw,", ",")",")"),mw=1e-12;function nl(e){return((e=Math.exp(e))+1/e)/2}function yw(e){return((e=Math.exp(e))-1/e)/2}function _w(e){return((e=Math.exp(2*e))-1)/(e+1)}const vn=(function e(t,n,r){function i(o,a){var s=o[0],c=o[1],u=o[2],l=a[0],f=a[1],d=a[2],h=l-s,g=f-c,m=h*h+g*g,v,y;if(m<mw)y=Math.log(d/u)/t,v=function(E){return[s+E*h,c+E*g,u*Math.exp(t*E*y)]};else{var b=Math.sqrt(m),p=(d*d-u*u+r*m)/(2*u*n*b),_=(d*d-u*u-r*m)/(2*d*n*b),x=Math.log(Math.sqrt(p*p+1)-p),w=Math.log(Math.sqrt(_*_+1)-_);y=(w-x)/t,v=function(E){var R=E*y,C=nl(x),T=u/(n*b)*(C*_w(t*R+x)-yw(x));return[s+T*h,c+T*g,u*C/nl(t*R+x)]}}return v.duration=y*1e3*t/Math.SQRT2,v}return i.rho=function(o){var a=Math.max(.001,+o),s=a*a,c=s*s;return e(a,s,c)},i})(Math.SQRT2,2,4);var vt=0,Nt=0,Rt=0,$v=1e3,Sn,At,Cn=0,nt=0,On=0,zt=typeof performance=="object"&&performance.now?performance:Date,Hv=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oc(){return nt||(Hv(bw),nt=zt.now()+On)}function bw(){nt=0}function qn(){this._call=this._time=this._next=null}qn.prototype=Bv.prototype={constructor:qn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?oc():+n)+(t==null?0:+t),!this._next&&At!==this&&(At?At._next=this:Sn=this,At=this),this._call=e,this._time=n,Uu()},stop:function(){this._call&&(this._call=null,this._time=1/0,Uu())}};function Bv(e,t,n){var r=new qn;return r.restart(e,t,n),r}function ww(){oc(),++vt;for(var e=Sn,t;e;)(t=nt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--vt}function rl(){nt=(Cn=zt.now())+On,vt=Nt=0;try{ww()}finally{vt=0,Ew(),nt=0}}function xw(){var e=zt.now(),t=e-Cn;t>$v&&(On-=t,Cn=e)}function Ew(){for(var e,t=Sn,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Sn=n);At=e,Uu(r)}function Uu(e){if(!vt){Nt&&(Nt=clearTimeout(Nt));var t=e-nt;t>24?(e<1/0&&(Nt=setTimeout(rl,e-zt.now()-On)),Rt&&(Rt=clearInterval(Rt))):(Rt||(Cn=zt.now(),Rt=setInterval(xw,$v)),vt=1,Hv(rl))}}function il(e,t,n){var r=new qn;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Sw=Pn("start","end","cancel","interrupt"),Cw=[],jv=0,ol=1,Yu=2,mn=3,al=4,Wu=5,yn=6;function Ln(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;qw(e,n,{name:t,index:r,group:i,on:Sw,tween:Cw,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:jv})}function ac(e,t){var n=Se(e,t);if(n.state>jv)throw new Error("too late; already scheduled");return n}function Me(e,t){var n=Se(e,t);if(n.state>mn)throw new Error("too late; already running");return n}function Se(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function qw(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Bv(o,0,n.time);function o(u){n.state=ol,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var l,f,d,h;if(n.state!==ol)return c();for(l in r)if(h=r[l],h.name===n.name){if(h.state===mn)return il(a);h.state===al?(h.state=yn,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[l]):+l<t&&(h.state=yn,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[l])}if(il(function(){n.state===mn&&(n.state=al,n.timer.restart(s,n.delay,n.time),s(u))}),n.state=Yu,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Yu){for(n.state=mn,i=new Array(d=n.tween.length),l=0,f=-1;l<d;++l)(h=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function s(u){for(var l=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Wu,1),f=-1,d=i.length;++f<d;)i[f].call(e,l);n.state===Wu&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=yn,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function _n(e,t){var n=e.__transition,r,i,o=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){o=!1;continue}i=r.state>Yu&&r.state<Wu,r.state=yn,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}o&&delete e.__transition}}function Rw(e){return this.each(function(){_n(this,e)})}function Iw(e,t){var n,r;return function(){var i=Me(this,e),o=i.tween;if(o!==n){r=n=o;for(var a=0,s=r.length;a<s;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function Nw(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=Me(this,e),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:t,value:n},c=0,u=i.length;c<u;++c)if(i[c].name===t){i[c]=s;break}c===u&&i.push(s)}o.tween=i}}function Aw(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Se(this.node(),n).tween,i=0,o=r.length,a;i<o;++i)if((a=r[i]).name===e)return a.value;return null}return this.each((t==null?Iw:Nw)(n,e,t))}function sc(e,t,n){var r=e._id;return e.each(function(){var i=Me(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Se(i,r).value[t]}}function Vv(e,t){var n;return(typeof t=="number"?Ie:t instanceof tt?En:(n=tt(t))?(t=n,En):Dv)(e,t)}function Mw(e){return function(){this.removeAttribute(e)}}function Tw(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Pw(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=t(r=a,n)}}function kw(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=t(r=a,n)}}function Ow(e,t,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s)))}}function Lw(e,t,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s)))}}function Dw(e,t){var n=kn(e),r=n==="transform"?vw:Vv;return this.attrTween(e,typeof t=="function"?(n.local?Lw:Ow)(n,r,sc(this,"attr."+e,t)):t==null?(n.local?Tw:Mw)(n):(n.local?kw:Pw)(n,r,t))}function Fw(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function zw(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function $w(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&zw(e,o)),n}return i._value=t,i}function Hw(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Fw(e,o)),n}return i._value=t,i}function Bw(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 r=kn(e);return this.tween(n,(r.local?$w:Hw)(r,t))}function jw(e,t){return function(){ac(this,e).delay=+t.apply(this,arguments)}}function Vw(e,t){return t=+t,function(){ac(this,e).delay=t}}function Gw(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jw:Vw)(t,e)):Se(this.node(),t).delay}function Uw(e,t){return function(){Me(this,e).duration=+t.apply(this,arguments)}}function Yw(e,t){return t=+t,function(){Me(this,e).duration=t}}function Ww(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Uw:Yw)(t,e)):Se(this.node(),t).duration}function Xw(e,t){if(typeof t!="function")throw new Error;return function(){Me(this,e).ease=t}}function Kw(e){var t=this._id;return arguments.length?this.each(Xw(t,e)):Se(this.node(),t).ease}function Zw(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Me(this,e).ease=n}}function Qw(e){if(typeof e!="function")throw new Error;return this.each(Zw(this._id,e))}function Jw(e){typeof e!="function"&&(e=wv(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],c,u=0;u<a;++u)(c=o[u])&&e.call(c,c.__data__,u,o)&&s.push(c);return new ze(r,this._parents,this._name,this._id)}function ex(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var c=t[s],u=n[s],l=c.length,f=a[s]=new Array(l),d,h=0;h<l;++h)(d=c[h]||u[h])&&(f[h]=d);for(;s<r;++s)a[s]=t[s];return new ze(a,this._parents,this._name,this._id)}function tx(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 nx(e,t,n){var r,i,o=tx(t)?ac:Me;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function rx(e,t){var n=this._id;return arguments.length<2?Se(this.node(),n).on.on(e):this.each(nx(n,e,t))}function ix(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ox(){return this.on("end.remove",ix(this._id))}function ax(e){var t=this._name,n=this._id;typeof e!="function"&&(e=tc(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s=r[a],c=s.length,u=o[a]=new Array(c),l,f,d=0;d<c;++d)(l=s[d])&&(f=e.call(l,l.__data__,d,s))&&("__data__"in l&&(f.__data__=l.__data__),u[d]=f,Ln(u[d],t,n,d,u,Se(l,n)));return new ze(o,this._parents,t,n)}function sx(e){var t=this._name,n=this._id;typeof e!="function"&&(e=bv(e));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var c=r[s],u=c.length,l,f=0;f<u;++f)if(l=c[f]){for(var d=e.call(l,l.__data__,f,c),h,g=Se(l,n),m=0,v=d.length;m<v;++m)(h=d[m])&&Ln(h,t,n,m,d,g);o.push(d),a.push(l)}return new ze(o,a,t,n)}var ux=Gt.prototype.constructor;function cx(){return new ux(this._groups,this._parents)}function lx(e,t){var n,r,i;return function(){var o=gt(this,e),a=(this.style.removeProperty(e),gt(this,e));return o===a?null:o===n&&a===r?i:i=t(n=o,r=a)}}function Gv(e){return function(){this.style.removeProperty(e)}}function fx(e,t,n){var r,i=n+"",o;return function(){var a=gt(this,e);return a===i?null:a===r?o:o=t(r=a,n)}}function dx(e,t,n){var r,i,o;return function(){var a=gt(this,e),s=n(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),gt(this,e))),a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s))}}function hx(e,t){var n,r,i,o="style."+t,a="end."+o,s;return function(){var c=Me(this,e),u=c.on,l=c.value[o]==null?s||(s=Gv(t)):void 0;(u!==n||i!==l)&&(r=(n=u).copy()).on(a,i=l),c.on=r}}function px(e,t,n){var r=(e+="")=="transform"?gw:Vv;return t==null?this.styleTween(e,lx(e,r)).on("end.style."+e,Gv(e)):typeof t=="function"?this.styleTween(e,dx(e,r,sc(this,"style."+e,t))).each(hx(this._id,e)):this.styleTween(e,fx(e,r,t),n).on("end.style."+e,null)}function gx(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function vx(e,t,n){var r,i;function o(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&gx(e,a,n)),r}return o._value=t,o}function mx(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,vx(e,t,n??""))}function yx(e){return function(){this.textContent=e}}function _x(e){return function(){var t=e(this);this.textContent=t??""}}function bx(e){return this.tween("text",typeof e=="function"?_x(sc(this,"text",e)):yx(e==null?"":e+""))}function wx(e){return function(t){this.textContent=e.call(this,t)}}function xx(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&wx(i)),t}return r._value=e,r}function Ex(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,xx(e))}function Sx(){for(var e=this._name,t=this._id,n=Uv(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,u=0;u<s;++u)if(c=a[u]){var l=Se(c,t);Ln(c,e,n,u,a,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new ze(r,this._parents,e,n)}function Cx(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},c={value:function(){--i===0&&o()}};n.each(function(){var u=Me(this,r),l=u.on;l!==e&&(t=(e=l).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),u.on=t}),i===0&&o()})}var qx=0;function ze(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Uv(){return++qx}var De=Gt.prototype;ze.prototype={constructor:ze,select:ax,selectAll:sx,selectChild:De.selectChild,selectChildren:De.selectChildren,filter:Jw,merge:ex,selection:cx,transition:Sx,call:De.call,nodes:De.nodes,node:De.node,size:De.size,empty:De.empty,each:De.each,on:rx,attr:Dw,attrTween:Bw,style:px,styleTween:mx,text:bx,textTween:Ex,remove:ox,tween:Aw,delay:Gw,duration:Ww,ease:Kw,easeVarying:Qw,end:Cx,[Symbol.iterator]:De[Symbol.iterator]};function Rx(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ix={time:null,delay:0,duration:250,ease:Rx};function Nx(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 Ax(e){var t,n;e instanceof ze?(t=e._id,e=e._name):(t=Uv(),(n=Ix).time=oc(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,u=0;u<s;++u)(c=a[u])&&Ln(c,e,t,u,a,n||Nx(c,t));return new ze(r,this._parents,e,t)}Gt.prototype.interrupt=Rw;Gt.prototype.transition=Ax;const ln=e=>()=>e;function Mx(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:r,enumerable:!0,configurable:!0},_:{value:i}})}function Fe(e,t,n){this.k=e,this.x=t,this.y=n}Fe.prototype={constructor:Fe,scale:function(e){return e===1?this:new Fe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Fe(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 Dn=new Fe(1,0,0);Yv.prototype=Fe.prototype;function Yv(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Dn;return e.__zoom}function hr(e){e.stopImmediatePropagation()}function It(e){e.preventDefault(),e.stopImmediatePropagation()}function Tx(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Px(){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 sl(){return this.__zoom||Dn}function kx(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ox(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lx(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function Wv(){var e=Tx,t=Px,n=Lx,r=kx,i=Ox,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,c=vn,u=Pn("start","zoom","end"),l,f,d,h=500,g=150,m=0,v=10;function y(S){S.property("__zoom",sl).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",T).filter(i).on("touchstart.zoom",q).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(S,A,N,L){var P=S.selection?S.selection():S;P.property("__zoom",sl),S!==P?x(S,A,N,L):P.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},y.scaleBy=function(S,A,N,L){y.scaleTo(S,function(){var P=this.__zoom.k,D=typeof A=="function"?A.apply(this,arguments):A;return P*D},N,L)},y.scaleTo=function(S,A,N,L){y.transform(S,function(){var P=t.apply(this,arguments),D=this.__zoom,j=N==null?_(P):typeof N=="function"?N.apply(this,arguments):N,G=D.invert(j),V=typeof A=="function"?A.apply(this,arguments):A;return n(p(b(D,V),j,G),P,a)},N,L)},y.translateBy=function(S,A,N,L){y.transform(S,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),a)},null,L)},y.translateTo=function(S,A,N,L,P){y.transform(S,function(){var D=t.apply(this,arguments),j=this.__zoom,G=L==null?_(D):typeof L=="function"?L.apply(this,arguments):L;return n(Dn.translate(G[0],G[1]).scale(j.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof N=="function"?-N.apply(this,arguments):-N),D,a)},L,P)};function b(S,A){return A=Math.max(o[0],Math.min(o[1],A)),A===S.k?S:new Fe(A,S.x,S.y)}function p(S,A,N){var L=A[0]-N[0]*S.k,P=A[1]-N[1]*S.k;return L===S.x&&P===S.y?S:new Fe(S.k,L,P)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function x(S,A,N,L){S.on("start.zoom",function(){w(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(L).end()}).tween("zoom",function(){var P=this,D=arguments,j=w(P,D).event(L),G=t.apply(P,D),V=N==null?_(G):typeof N=="function"?N.apply(P,D):N,Y=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),I=P.__zoom,O=typeof A=="function"?A.apply(P,D):A,z=c(I.invert(V).concat(Y/I.k),O.invert(V).concat(Y/O.k));return function(H){if(H===1)H=O;else{var B=z(H),U=Y/B[2];H=new Fe(U,V[0]-B[0]*U,V[1]-B[1]*U)}j.zoom(null,H)}})}function w(S,A,N){return!N&&S.__zooming||new E(S,A)}function E(S,A){this.that=S,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,A),this.taps=0}E.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,A){return this.mouse&&S!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var A=ge(this.that).datum();u.call(S,this.that,new Mx(S,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),A)}};function R(S,...A){if(!e.apply(this,arguments))return;var N=w(this,A).event(S),L=this.__zoom,P=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),D=_e(S);if(N.wheel)(N.mouse[0][0]!==D[0]||N.mouse[0][1]!==D[1])&&(N.mouse[1]=L.invert(N.mouse[0]=D)),clearTimeout(N.wheel);else{if(L.k===P)return;N.mouse=[D,L.invert(D)],_n(this),N.start()}It(S),N.wheel=setTimeout(j,g),N.zoom("mouse",n(p(b(L,P),N.mouse[0],N.mouse[1]),N.extent,a));function j(){N.wheel=null,N.end()}}function C(S,...A){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,L=w(this,A,!0).event(S),P=ge(S.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",Y,!0),D=_e(S,N),j=S.clientX,G=S.clientY;Mv(S.view),hr(S),L.mouse=[D,this.__zoom.invert(D)],_n(this),L.start();function V(I){if(It(I),!L.moved){var O=I.clientX-j,z=I.clientY-G;L.moved=O*O+z*z>m}L.event(I).zoom("mouse",n(p(L.that.__zoom,L.mouse[0]=_e(I,N),L.mouse[1]),L.extent,a))}function Y(I){P.on("mousemove.zoom mouseup.zoom",null),Tv(I.view,L.moved),It(I),L.event(I).end()}}function T(S,...A){if(e.apply(this,arguments)){var N=this.__zoom,L=_e(S.changedTouches?S.changedTouches[0]:S,this),P=N.invert(L),D=N.k*(S.shiftKey?.5:2),j=n(p(b(N,D),L,P),t.apply(this,A),a);It(S),s>0?ge(this).transition().duration(s).call(x,j,L,S):ge(this).call(y.transform,j,L,S)}}function q(S,...A){if(e.apply(this,arguments)){var N=S.touches,L=N.length,P=w(this,A,S.changedTouches.length===L).event(S),D,j,G,V;for(hr(S),j=0;j<L;++j)G=N[j],V=_e(G,this),V=[V,this.__zoom.invert(V),G.identifier],P.touch0?!P.touch1&&P.touch0[2]!==V[2]&&(P.touch1=V,P.taps=0):(P.touch0=V,D=!0,P.taps=1+!!l);l&&(l=clearTimeout(l)),D&&(P.taps<2&&(f=V[0],l=setTimeout(function(){l=null},h)),_n(this),P.start())}}function M(S,...A){if(this.__zooming){var N=w(this,A).event(S),L=S.changedTouches,P=L.length,D,j,G,V;for(It(S),D=0;D<P;++D)j=L[D],G=_e(j,this),N.touch0&&N.touch0[2]===j.identifier?N.touch0[0]=G:N.touch1&&N.touch1[2]===j.identifier&&(N.touch1[0]=G);if(j=N.that.__zoom,N.touch1){var Y=N.touch0[0],I=N.touch0[1],O=N.touch1[0],z=N.touch1[1],H=(H=O[0]-Y[0])*H+(H=O[1]-Y[1])*H,B=(B=z[0]-I[0])*B+(B=z[1]-I[1])*B;j=b(j,Math.sqrt(H/B)),G=[(Y[0]+O[0])/2,(Y[1]+O[1])/2],V=[(I[0]+z[0])/2,(I[1]+z[1])/2]}else if(N.touch0)G=N.touch0[0],V=N.touch0[1];else return;N.zoom("touch",n(p(j,G,V),N.extent,a))}}function k(S,...A){if(this.__zooming){var N=w(this,A).event(S),L=S.changedTouches,P=L.length,D,j;for(hr(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),D=0;D<P;++D)j=L[D],N.touch0&&N.touch0[2]===j.identifier?delete N.touch0:N.touch1&&N.touch1[2]===j.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(j=_e(j,this),Math.hypot(f[0]-j[0],f[1]-j[1])<v)){var G=ge(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return y.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:ln(+S),y):r},y.filter=function(S){return arguments.length?(e=typeof S=="function"?S:ln(!!S),y):e},y.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:ln(!!S),y):i},y.extent=function(S){return arguments.length?(t=typeof S=="function"?S:ln([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),y):t},y.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],y):[o[0],o[1]]},y.translateExtent=function(S){return arguments.length?(a[0][0]=+S[0][0],a[1][0]=+S[1][0],a[0][1]=+S[0][1],a[1][1]=+S[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(S){return arguments.length?(n=S,y):n},y.duration=function(S){return arguments.length?(s=+S,y):s},y.interpolate=function(S){return arguments.length?(c=S,y):c},y.on=function(){var S=u.on.apply(u,arguments);return S===u?y:S},y.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,y):Math.sqrt(m)},y.tapDistance=function(S){return arguments.length?(v=+S,y):v},y}const Ae={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:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", 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."},$t=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Xv=["Enter"," ","Escape"],Kv={"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 mt;(function(e){e.Strict="strict",e.Loose="loose"})(mt||(mt={}));var et;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(et||(et={}));var Ht;(function(e){e.Partial="partial",e.Full="full"})(Ht||(Ht={}));const Zv={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var We;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(We||(We={}));var Rn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Rn||(Rn={}));var Z;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Z||(Z={}));const ul={[Z.Left]:Z.Right,[Z.Right]:Z.Left,[Z.Top]:Z.Bottom,[Z.Bottom]:Z.Top};function Qv(e){return e===null?null:e?"valid":"invalid"}const Jv=e=>"id"in e&&"source"in e&&"target"in e,Dx=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),uc=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Yt=(e,t=[0,0])=>{const{width:n,height:r}=$e(e),i=e.origin??t,o=n*i[0],a=r*i[1];return{x:e.position.x-o,y:e.position.y-a}},Fx=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const o=typeof i=="string";let a=!t.nodeLookup&&!o?i:void 0;t.nodeLookup&&(a=o?t.nodeLookup.get(i):uc(i)?i:t.nodeLookup.get(i.id));const s=a?In(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Fn(r,s)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return zn(n)},Wt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=Fn(n,In(i)),r=!0)}),r?zn(n):{x:0,y:0,width:0,height:0}},cc=(e,t,[n,r,i]=[0,0,1],o=!1,a=!1)=>{const s={...Kt(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(const u of e.values()){const{measured:l,selectable:f=!0,hidden:d=!1}=u;if(a&&!f||d)continue;const h=l.width??u.width??u.initialWidth??null,g=l.height??u.height??u.initialHeight??null,m=Bt(s,_t(u)),v=(h??0)*(g??0),y=o&&m>0;(!u.internals.handleBounds||y||m>=v||u.dragging)&&c.push(u)}return c},zx=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function $x(e,t){const n=new Map,r=t?.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&(t?.includeHiddenNodes||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function Hx({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:o},a){if(e.size===0)return Promise.resolve(!0);const s=$x(e,a),c=Wt(s),u=lc(c,t,n,a?.minZoom??i,a?.maxZoom??o,a?.padding??.1);return await r.setViewport(u,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)}function em({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:o}){const a=n.get(e),s=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=s?s.internals.positionAbsolute:{x:0,y:0},l=a.origin??r;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!s)o?.("005",Ae.error005());else{const h=s.measured.width,g=s.measured.height;h&&g&&(f=[[c,u],[c+h,u+g]])}else s&&bt(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const d=bt(f)?rt(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&o?.("015",Ae.error015()),{position:{x:d.x-c+(a.measured.width??0)*l[0],y:d.y-u+(a.measured.height??0)*l[1]},positionAbsolute:d}}async function Bx({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const o=new Set(e.map(d=>d.id)),a=[];for(const d of n){if(d.deletable===!1)continue;const h=o.has(d.id),g=!h&&d.parentId&&a.find(m=>m.id===d.parentId);(h||g)&&a.push(d)}const s=new Set(t.map(d=>d.id)),c=r.filter(d=>d.deletable!==!1),l=zx(a,c);for(const d of c)s.has(d.id)&&!l.find(g=>g.id===d.id)&&l.push(d);if(!i)return{edges:l,nodes:a};const f=await i({nodes:a,edges:l});return typeof f=="boolean"?f?{edges:l,nodes:a}:{edges:[],nodes:[]}:f}const yt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),rt=(e={x:0,y:0},t,n)=>({x:yt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:yt(e.y,t[0][1],t[1][1]-(n?.height??0))});function tm(e,t,n){const{width:r,height:i}=$e(n),{x:o,y:a}=n.internals.positionAbsolute;return rt(e,[[o,a],[o+r,a+i]],t)}const cl=(e,t,n)=>e<t?yt(Math.abs(e-t),1,t)/t:e>n?-yt(Math.abs(e-n),1,t)/t:0,nm=(e,t,n=15,r=40)=>{const i=cl(e.x,r,t.width-r)*n,o=cl(e.y,r,t.height-r)*n;return[i,o]},Fn=(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)}),Xu=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),zn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),_t=(e,t=[0,0])=>{const{x:n,y:r}=uc(e)?e.internals.positionAbsolute:Yt(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},In=(e,t=[0,0])=>{const{x:n,y:r}=uc(e)?e.internals.positionAbsolute:Yt(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},rm=(e,t)=>zn(Fn(Xu(e),Xu(t))),Bt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},ll=e=>we(e.width)&&we(e.height)&&we(e.x)&&we(e.y),we=e=>!isNaN(e)&&isFinite(e),jx=(e,t)=>{},Xt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Kt=({x:e,y:t},[n,r,i],o=!1,a=[1,1])=>{const s={x:(e-n)/i,y:(t-r)/i};return o?Xt(s,a):s},Nn=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function lt(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}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Vx(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=lt(e,n),i=lt(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=lt(e.top??e.y??0,n),i=lt(e.bottom??e.y??0,n),o=lt(e.left??e.x??0,t),a=lt(e.right??e.x??0,t);return{top:r,right:a,bottom:i,left:o,x:o+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Gx(e,t,n,r,i,o){const{x:a,y:s}=Nn(e,[t,n,r]),{x:c,y:u}=Nn({x:e.x+e.width,y:e.y+e.height},[t,n,r]),l=i-c,f=o-u;return{left:Math.floor(a),top:Math.floor(s),right:Math.floor(l),bottom:Math.floor(f)}}const lc=(e,t,n,r,i,o)=>{const a=Vx(o,t,n),s=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(s,c),l=yt(u,r,i),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*l,g=n/2-d*l,m=Gx(e,h,g,l,t,n),v={left:Math.min(m.left-a.left,0),top:Math.min(m.top-a.top,0),right:Math.min(m.right-a.right,0),bottom:Math.min(m.bottom-a.bottom,0)};return{x:h-v.left+v.right,y:g-v.top+v.bottom,zoom:l}},jt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function bt(e){return e!=null&&e!=="parent"}function $e(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function im(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function om(e,t={width:0,height:0},n,r,i){const o={...e},a=r.get(n);if(a){const s=a.origin||i;o.x+=a.internals.positionAbsolute.x-(t.width??0)*s[0],o.y+=a.internals.positionAbsolute.y-(t.height??0)*s[1]}return o}function fl(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ux(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function Yx(e){return{...Kv,...e||{}}}function Ot(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:o,y:a}=xe(e),s=Kt({x:o-(i?.left??0),y:a-(i?.top??0)},r),{x:c,y:u}=n?Xt(s,t):s;return{xSnapped:c,ySnapped:u,...s}}const fc=e=>({width:e.offsetWidth,height:e.offsetHeight}),am=e=>e?.getRootNode?.()||window?.document,Wx=["INPUT","SELECT","TEXTAREA"];function sm(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Wx.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const um=e=>"clientX"in e,xe=(e,t)=>{const n=um(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},dl=(e,t,n,r,i)=>{const o=t.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(a=>{const s=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(s.left-n.left)/r,y:(s.top-n.top)/r,...fc(a)}})};function cm({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:o,targetControlX:a,targetControlY:s}){const c=e*.125+i*.375+a*.375+n*.125,u=t*.125+o*.375+s*.375+r*.125,l=Math.abs(c-e),f=Math.abs(u-t);return[c,u,l,f]}function fn(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function hl({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case Z.Left:return[t-fn(t-r,o),n];case Z.Right:return[t+fn(r-t,o),n];case Z.Top:return[t,n-fn(n-i,o)];case Z.Bottom:return[t,n+fn(i-n,o)]}}function lm({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:r,targetY:i,targetPosition:o=Z.Top,curvature:a=.25}){const[s,c]=hl({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,l]=hl({pos:o,x1:r,y1:i,x2:e,y2:t,c:a}),[f,d,h,g]=cm({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:u,targetControlY:l});return[`M${e},${t} C${s},${c} ${u},${l} ${r},${i}`,f,d,h,g]}function fm({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n<e?n+i:n-i,a=Math.abs(r-t)/2,s=r<t?r+a:r-a;return[o,s,i,a]}function Xx({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:o="basic"}){if(o==="manual")return r;const a=i&&n?r+1e3:r,s=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return a+s}function Kx({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const o=Fn(In(e),In(t));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const a={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return Bt(a,zn(o))>0}const Zx=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Qx=(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)),Jx=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||Zx;let i;return Jv(e)?i={...e}:i={...e,id:r(e)},Qx(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function dm({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,a,s]=fm({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,a,s]}const pl={[Z.Left]:{x:-1,y:0},[Z.Right]:{x:1,y:0},[Z.Top]:{x:0,y:-1},[Z.Bottom]:{x:0,y:1}},e1=({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},gl=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function t1({source:e,sourcePosition:t=Z.Bottom,target:n,targetPosition:r=Z.Top,center:i,offset:o,stepPosition:a}){const s=pl[t],c=pl[r],u={x:e.x+s.x*o,y:e.y+s.y*o},l={x:n.x+c.x*o,y:n.y+c.y*o},f=e1({source:u,sourcePosition:t,target:l}),d=f.x!==0?"x":"y",h=f[d];let g=[],m,v;const y={x:0,y:0},b={x:0,y:0},[,,p,_]=fm({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*c[d]===-1){d==="x"?(m=i.x??u.x+(l.x-u.x)*a,v=i.y??(u.y+l.y)/2):(m=i.x??(u.x+l.x)/2,v=i.y??u.y+(l.y-u.y)*a);const w=[{x:m,y:u.y},{x:m,y:l.y}],E=[{x:u.x,y:v},{x:l.x,y:v}];s[d]===h?g=d==="x"?w:E:g=d==="x"?E:w}else{const w=[{x:u.x,y:l.y}],E=[{x:l.x,y:u.y}];if(d==="x"?g=s.x===h?E:w:g=s.y===h?w:E,t===r){const M=Math.abs(e[d]-n[d]);if(M<=o){const k=Math.min(o-1,o-M);s[d]===h?y[d]=(u[d]>e[d]?-1:1)*k:b[d]=(l[d]>n[d]?-1:1)*k}}if(t!==r){const M=d==="x"?"y":"x",k=s[d]===c[M],S=u[M]>l[M],A=u[M]<l[M];(s[d]===1&&(!k&&S||k&&A)||s[d]!==1&&(!k&&A||k&&S))&&(g=d==="x"?w:E)}const R={x:u.x+y.x,y:u.y+y.y},C={x:l.x+b.x,y:l.y+b.y},T=Math.max(Math.abs(R.x-g[0].x),Math.abs(C.x-g[0].x)),q=Math.max(Math.abs(R.y-g[0].y),Math.abs(C.y-g[0].y));T>=q?(m=(R.x+C.x)/2,v=g[0].y):(m=g[0].x,v=(R.y+C.y)/2)}return[[e,{x:u.x+y.x,y:u.y+y.y},...g,{x:l.x+b.x,y:l.y+b.y},n],m,v,p,_]}function n1(e,t,n,r){const i=Math.min(gl(e,t)/2,gl(t,n)/2,r),{x:o,y:a}=t;if(e.x===o&&o===n.x||e.y===a&&a===n.y)return`L${o} ${a}`;if(e.y===a){const u=e.x<n.x?-1:1,l=e.y<n.y?1:-1;return`L ${o+i*u},${a}Q ${o},${a} ${o},${a+i*l}`}const s=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${o},${a+i*c}Q ${o},${a} ${o+i*s},${a}`}function Ku({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:r,targetY:i,targetPosition:o=Z.Top,borderRadius:a=5,centerX:s,centerY:c,offset:u=20,stepPosition:l=.5}){const[f,d,h,g,m]=t1({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:o,center:{x:s,y:c},offset:u,stepPosition:l});return[f.reduce((y,b,p)=>{let _="";return p>0&&p<f.length-1?_=n1(f[p-1],b,f[p+1],a):_=`${p===0?"M":"L"}${b.x} ${b.y}`,y+=_,y},""),d,h,g,m]}function vl(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function r1(e){const{sourceNode:t,targetNode:n}=e;if(!vl(t)||!vl(n))return null;const r=t.internals.handleBounds||ml(t.handles),i=n.internals.handleBounds||ml(n.handles),o=yl(r?.source??[],e.sourceHandle),a=yl(e.connectionMode===mt.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!o||!a)return e.onError?.("008",Ae.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=o?.position||Z.Bottom,c=a?.position||Z.Top,u=it(t,o,s),l=it(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:l.x,targetY:l.y,sourcePosition:s,targetPosition:c}}function ml(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function it(e,t,n=Z.Left,r=!1){const i=(t?.x??0)+e.internals.positionAbsolute.x,o=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:s}=t??$e(e);if(r)return{x:i+a/2,y:o+s/2};switch(t?.position??n){case Z.Top:return{x:i+a/2,y:o};case Z.Right:return{x:i+a,y:o+s/2};case Z.Bottom:return{x:i+a/2,y:o+s};case Z.Left:return{x:i,y:o+s/2}}}function yl(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Zu(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function i1(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const o=new Set;return e.reduce((a,s)=>([s.markerStart||r,s.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const u=Zu(c,t);o.has(u)||(a.push({id:u,color:c.color||n,...c}),o.add(u))}}),a),[]).sort((a,s)=>a.id.localeCompare(s.id))}const hm=1e3,o1=10,dc={nodeOrigin:[0,0],nodeExtent:$t,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},a1={...dc,checkEquality:!0};function hc(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function s1(e,t,n){const r=hc(dc,n);for(const i of e.values())if(i.parentId)gc(i,e,t,r);else{const o=Yt(i,r.nodeOrigin),a=bt(i.extent)?i.extent:r.nodeExtent,s=rt(o,a,$e(i));i.internals.positionAbsolute=s}}function u1(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],r=[];for(const i of e.handles){const o={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(o):i.type==="target"&&r.push(o)}return{source:n,target:r}}function pc(e){return e==="manual"}function Qu(e,t,n,r={}){const i=hc(a1,r),o={i:0},a=new Map(t),s=i?.elevateNodesOnSelect&&!pc(i.zIndexMode)?hm:0;let c=e.length>0;t.clear(),n.clear();for(const u of e){let l=a.get(u.id);if(i.checkEquality&&u===l?.internals.userNode)t.set(u.id,l);else{const f=Yt(u,i.nodeOrigin),d=bt(u.extent)?u.extent:i.nodeExtent,h=rt(f,d,$e(u));l={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:h,handleBounds:u1(u,l),z:pm(u,s,i.zIndexMode),userNode:u}},t.set(u.id,l)}(l.measured===void 0||l.measured.width===void 0||l.measured.height===void 0)&&!l.hidden&&(c=!1),u.parentId&&gc(l,t,n,r,o)}return c}function c1(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 gc(e,t,n,r,i){const{elevateNodesOnSelect:o,nodeOrigin:a,nodeExtent:s,zIndexMode:c}=hc(dc,r),u=e.parentId,l=t.get(u);if(!l){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}c1(e,n),i&&!l.parentId&&l.internals.rootParentIndex===void 0&&c==="auto"&&(l.internals.rootParentIndex=++i.i,l.internals.z=l.internals.z+i.i*o1),i&&l.internals.rootParentIndex!==void 0&&(i.i=l.internals.rootParentIndex);const f=o&&!pc(c)?hm:0,{x:d,y:h,z:g}=l1(e,l,a,s,f,c),{positionAbsolute:m}=e.internals,v=d!==m.x||h!==m.y;(v||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:d,y:h}:m,z:g}})}function pm(e,t,n){const r=we(e.zIndex)?e.zIndex:0;return pc(n)?r:r+(e.selected?t:0)}function l1(e,t,n,r,i,o){const{x:a,y:s}=t.internals.positionAbsolute,c=$e(e),u=Yt(e,n),l=bt(e.extent)?rt(u,e.extent,c):u;let f=rt({x:a+l.x,y:s+l.y},r,c);e.extent==="parent"&&(f=tm(f,c,t));const d=pm(e,i,o),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function vc(e,t,n,r=[0,0]){const i=[],o=new Map;for(const a of e){const s=t.get(a.parentId);if(!s)continue;const c=o.get(a.parentId)?.expandedRect??_t(s),u=rm(c,a.rect);o.set(a.parentId,{expandedRect:u,parent:s})}return o.size>0&&o.forEach(({expandedRect:a,parent:s},c)=>{const u=s.internals.positionAbsolute,l=$e(s),f=s.origin??r,d=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,h=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,g=Math.max(l.width,Math.round(a.width)),m=Math.max(l.height,Math.round(a.height)),v=(g-l.width)*f[0],y=(m-l.height)*f[1];(d>0||h>0||v||y)&&(i.push({id:c,type:"position",position:{x:s.position.x-d+v,y:s.position.y-h+y}}),n.get(c)?.forEach(b=>{e.some(p=>p.id===b.id)||i.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+h}})})),(l.width<a.width||l.height<a.height||d||h)&&i.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(d?f[0]*d-v:0),height:m+(h?f[1]*h-y:0)}})}),i}function f1(e,t,n,r,i,o,a){const s=r?.querySelector(".xyflow__viewport");let c=!1;if(!s)return{changes:[],updatedInternals:c};const u=[],l=window.getComputedStyle(s),{m22:f}=new window.DOMMatrixReadOnly(l.transform),d=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const m=fc(h.nodeElement),v=g.measured.width!==m.width||g.measured.height!==m.height;if(!!(m.width&&m.height&&(v||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=bt(g.extent)?g.extent:o;let{positionAbsolute:_}=g.internals;g.parentId&&g.extent==="parent"?_=tm(_,m,t.get(g.parentId)):p&&(_=rt(_,p,m));const x={...g,measured:m,internals:{...g.internals,positionAbsolute:_,handleBounds:{source:dl("source",h.nodeElement,b,f,g.id),target:dl("target",h.nodeElement,b,f,g.id)}}};t.set(g.id,x),g.parentId&&gc(x,t,n,{nodeOrigin:i,zIndexMode:a}),c=!0,v&&(u.push({id:g.id,type:"dimensions",dimensions:m}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:_t(x,i)}))}}if(d.length>0){const h=vc(d,t,n,i);u.push(...h)}return{changes:u,updatedInternals:c}}async function d1({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:o}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,o]],r),s=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(s)}function _l(e,t,n,r,i,o){let a=i;const s=r.get(a)||new Map;r.set(a,s.set(n,t)),a=`${i}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),o){a=`${i}-${e}-${o}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function gm(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:o,sourceHandle:a=null,targetHandle:s=null}=r,c={edgeId:r.id,source:i,target:o,sourceHandle:a,targetHandle:s},u=`${i}-${a}--${o}-${s}`,l=`${o}-${s}--${i}-${a}`;_l("source",c,l,e,i,a),_l("target",c,u,e,o,s),t.set(r.id,r)}}function vm(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:vm(n,t):!1}function bl(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function h1(e,t,n,r){const i=new Map;for(const[o,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!vm(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const s=e.get(o);s&&i.set(o,{id:o,position:s.position||{x:0,y:0},distance:{x:n.x-s.internals.positionAbsolute.x,y:n.y-s.internals.positionAbsolute.y},extent:s.extent,parentId:s.parentId,origin:s.origin,expandParent:s.expandParent,internals:{positionAbsolute:s.internals.positionAbsolute||{x:0,y:0}},measured:{width:s.measured.width??0,height:s.measured.height??0}})}return i}function pr({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const i=[];for(const[a,s]of t){const c=n.get(a)?.internals.userNode;c&&i.push({...c,position:s.position,dragging:r})}if(!e)return[i[0],i];const o=n.get(e)?.internals.userNode;return[o?{...o,position:t.get(e)?.position||o.position,dragging:r}:i[0],i]}function p1({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const o={x:n-i.distance.x,y:r-i.distance.y},a=Xt(o,t);return{x:a.x-o.x,y:a.y-o.y}}function g1({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let o={x:null,y:null},a=0,s=new Map,c=!1,u={x:0,y:0},l=null,f=!1,d=null,h=!1,g=!1,m=null;function v({noDragClassName:b,handleSelector:p,domNode:_,isSelectable:x,nodeId:w,nodeClickDistance:E=0}){d=ge(_);function R({x:M,y:k}){const{nodeLookup:S,nodeExtent:A,snapGrid:N,snapToGrid:L,nodeOrigin:P,onNodeDrag:D,onSelectionDrag:j,onError:G,updateNodePositions:V}=t();o={x:M,y:k};let Y=!1;const I=s.size>1,O=I&&A?Xu(Wt(s)):null,z=I&&L?p1({dragItems:s,snapGrid:N,x:M,y:k}):null;for(const[H,B]of s){if(!S.has(H))continue;let U={x:M-B.distance.x,y:k-B.distance.y};L&&(U=z?{x:Math.round(U.x+z.x),y:Math.round(U.y+z.y)}:Xt(U,N));let X=null;if(I&&A&&!B.extent&&O){const{positionAbsolute:W}=B.internals,te=W.x-O.x+A[0][0],K=W.x+B.measured.width-O.x2+A[1][0],re=W.y-O.y+A[0][1],ee=W.y+B.measured.height-O.y2+A[1][1];X=[[te,re],[K,ee]]}const{position:J,positionAbsolute:Q}=em({nodeId:H,nextPosition:U,nodeLookup:S,nodeExtent:X||A,nodeOrigin:P,onError:G});Y=Y||B.position.x!==J.x||B.position.y!==J.y,B.position=J,B.internals.positionAbsolute=Q}if(g=g||Y,!!Y&&(V(s,!0),m&&(r||D||!w&&j))){const[H,B]=pr({nodeId:w,dragItems:s,nodeLookup:S});r?.(m,s,H,B),D?.(m,H,B),w||j?.(m,B)}}async function C(){if(!l)return;const{transform:M,panBy:k,autoPanSpeed:S,autoPanOnNodeDrag:A}=t();if(!A){c=!1,cancelAnimationFrame(a);return}const[N,L]=nm(u,l,S);(N!==0||L!==0)&&(o.x=(o.x??0)-N/M[2],o.y=(o.y??0)-L/M[2],await k({x:N,y:L})&&R(o)),a=requestAnimationFrame(C)}function T(M){const{nodeLookup:k,multiSelectionActive:S,nodesDraggable:A,transform:N,snapGrid:L,snapToGrid:P,selectNodesOnDrag:D,onNodeDragStart:j,onSelectionDragStart:G,unselectNodesAndEdges:V}=t();f=!0,(!D||!x)&&!S&&w&&(k.get(w)?.selected||V()),x&&D&&w&&e?.(w);const Y=Ot(M.sourceEvent,{transform:N,snapGrid:L,snapToGrid:P,containerBounds:l});if(o=Y,s=h1(k,A,Y,w),s.size>0&&(n||j||!w&&G)){const[I,O]=pr({nodeId:w,dragItems:s,nodeLookup:k});n?.(M.sourceEvent,s,I,O),j?.(M.sourceEvent,I,O),w||G?.(M.sourceEvent,O)}}const q=Pv().clickDistance(E).on("start",M=>{const{domNode:k,nodeDragThreshold:S,transform:A,snapGrid:N,snapToGrid:L}=t();l=k?.getBoundingClientRect()||null,h=!1,g=!1,m=M.sourceEvent,S===0&&T(M),o=Ot(M.sourceEvent,{transform:A,snapGrid:N,snapToGrid:L,containerBounds:l}),u=xe(M.sourceEvent,l)}).on("drag",M=>{const{autoPanOnNodeDrag:k,transform:S,snapGrid:A,snapToGrid:N,nodeDragThreshold:L,nodeLookup:P}=t(),D=Ot(M.sourceEvent,{transform:S,snapGrid:A,snapToGrid:N,containerBounds:l});if(m=M.sourceEvent,(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||w&&!P.has(w))&&(h=!0),!h){if(!c&&k&&f&&(c=!0,C()),!f){const j=xe(M.sourceEvent,l),G=j.x-u.x,V=j.y-u.y;Math.sqrt(G*G+V*V)>L&&T(M)}(o.x!==D.xSnapped||o.y!==D.ySnapped)&&s&&f&&(u=xe(M.sourceEvent,l),R(D))}}).on("end",M=>{if(!(!f||h)&&(c=!1,f=!1,cancelAnimationFrame(a),s.size>0)){const{nodeLookup:k,updateNodePositions:S,onNodeDragStop:A,onSelectionDragStop:N}=t();if(g&&(S(s,!1),g=!1),i||A||!w&&N){const[L,P]=pr({nodeId:w,dragItems:s,nodeLookup:k,dragging:!1});i?.(M.sourceEvent,s,L,P),A?.(M.sourceEvent,L,P),w||N?.(M.sourceEvent,P)}}}).filter(M=>{const k=M.target;return!M.button&&(!b||!bl(k,`.${b}`,_))&&(!p||bl(k,p,_))});d.call(q)}function y(){d?.on(".drag",null)}return{update:v,destroy:y}}function v1(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const o of t.values())Bt(i,_t(o))>0&&r.push(o);return r}const m1=250;function y1(e,t,n,r){let i=[],o=1/0;const a=v1(e,n,t+m1);for(const s of a){const c=[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]];for(const u of c){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:l,y:f}=it(s,u,u.position,!0),d=Math.sqrt(Math.pow(l-e.x,2)+Math.pow(f-e.y,2));d>t||(d<o?(i=[{...u,x:l,y:f}],o=d):d===o&&i.push({...u,x:l,y:f}))}}if(!i.length)return null;if(i.length>1){const s=r.type==="source"?"target":"source";return i.find(c=>c.type===s)??i[0]}return i[0]}function mm(e,t,n,r,i,o=!1){const a=r.get(e);if(!a)return null;const s=i==="strict"?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],c=(n?s?.find(u=>u.id===n):s?.[0])??null;return c&&o?{...c,...it(a,c,c.position,!0)}:c}function ym(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function _1(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const _m=()=>!0;function b1(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:o,isTarget:a,domNode:s,nodeLookup:c,lib:u,autoPanOnConnect:l,flowId:f,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:m,onConnectEnd:v,isValidConnection:y=_m,onReconnectEnd:b,updateConnection:p,getTransform:_,getFromHandle:x,autoPanSpeed:w,dragThreshold:E=1,handleDomNode:R}){const C=am(e.target);let T=0,q;const{x:M,y:k}=xe(e),S=ym(o,R),A=s?.getBoundingClientRect();let N=!1;if(!A||!S)return;const L=mm(i,S,r,c,t);if(!L)return;let P=xe(e,A),D=!1,j=null,G=!1,V=null;function Y(){if(!l||!A)return;const[J,Q]=nm(P,A,w);d({x:J,y:Q}),T=requestAnimationFrame(Y)}const I={...L,nodeId:i,type:S,position:L.position},O=c.get(i);let H={inProgress:!0,isValid:null,from:it(O,I,Z.Left,!0),fromHandle:I,fromPosition:I.position,fromNode:O,to:P,toHandle:null,toPosition:ul[I.position],toNode:null,pointer:P};function B(){N=!0,p(H),g?.(e,{nodeId:i,handleId:r,handleType:S})}E===0&&B();function U(J){if(!N){const{x:ee,y:fe}=xe(J),le=ee-M,Pe=fe-k;if(!(le*le+Pe*Pe>E*E))return;B()}if(!x()||!I){X(J);return}const Q=_();P=xe(J,A),q=y1(Kt(P,Q,!1,[1,1]),n,c,I),D||(Y(),D=!0);const W=bm(J,{handle:q,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:C,lib:u,flowId:f,nodeLookup:c});V=W.handleDomNode,j=W.connection,G=_1(!!q,W.isValid);const te=c.get(i),K=te?it(te,I,Z.Left,!0):H.from,re={...H,from:K,isValid:G,to:W.toHandle&&G?Nn({x:W.toHandle.x,y:W.toHandle.y},Q):P,toHandle:W.toHandle,toPosition:G&&W.toHandle?W.toHandle.position:ul[I.position],toNode:W.toHandle?c.get(W.toHandle.nodeId):null,pointer:P};p(re),H=re}function X(J){if(!("touches"in J&&J.touches.length>0)){if(N){(q||V)&&j&&G&&m?.(j);const{inProgress:Q,...W}=H,te={...W,toPosition:H.toHandle?H.toPosition:null};v?.(J,te),o&&b?.(J,te)}h(),cancelAnimationFrame(T),D=!1,G=!1,j=null,V=null,C.removeEventListener("mousemove",U),C.removeEventListener("mouseup",X),C.removeEventListener("touchmove",U),C.removeEventListener("touchend",X)}}C.addEventListener("mousemove",U),C.addEventListener("mouseup",X),C.addEventListener("touchmove",U),C.addEventListener("touchend",X)}function bm(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:o,doc:a,lib:s,flowId:c,isValidConnection:u=_m,nodeLookup:l}){const f=o==="target",d=t?a.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=xe(e),m=a.elementFromPoint(h,g),v=m?.classList.contains(`${s}-flow__handle`)?m:d,y={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const b=ym(void 0,v),p=v.getAttribute("data-nodeid"),_=v.getAttribute("data-handleid"),x=v.classList.contains("connectable"),w=v.classList.contains("connectableend");if(!p||!b)return y;const E={source:f?p:r,sourceHandle:f?_:i,target:f?r:p,targetHandle:f?i:_};y.connection=E;const C=x&&w&&(n===mt.Strict?f&&b==="source"||!f&&b==="target":p!==r||_!==i);y.isValid=C&&u(E),y.toHandle=mm(p,b,_,l,n,!0)}return y}const Ju={onPointerDown:b1,isValid:bm};function w1({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=ge(e);function o({translateExtent:s,width:c,height:u,zoomStep:l=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const _=n(),x=p.sourceEvent.ctrlKey&&jt()?10:1,w=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*l,E=_[2]*Math.pow(2,w*x);t.scaleTo(E)};let m=[0,0];const v=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(m=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},y=p=>{const _=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const x=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],w=[x[0]-m[0],x[1]-m[1]];m=x;const E=r()*Math.max(_[2],Math.log(_[2]))*(h?-1:1),R={x:_[0]-w[0]*E,y:_[1]-w[1]*E},C=[[0,0],[c,u]];t.setViewportConstrained({x:R.x,y:R.y,zoom:_[2]},C,s)},b=Wv().on("start",v).on("zoom",f?y:null).on("zoom.wheel",d?g:null);i.call(b,{})}function a(){i.on("zoom",null)}return{update:o,destroy:a,pointer:_e}}const $n=e=>({x:e.x,y:e.y,zoom:e.k}),gr=({x:e,y:t,zoom:n})=>Dn.translate(e,t).scale(n),ft=(e,t)=>e.target.closest(`.${t}`),wm=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),x1=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,vr=(e,t=0,n=x1,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},xm=e=>{const t=e.ctrlKey&&jt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function E1({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:o,zoomOnPinch:a,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:u}){return l=>{if(ft(l,t))return l.ctrlKey&&l.preventDefault(),!1;l.preventDefault(),l.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(l.ctrlKey&&a){const v=_e(l),y=xm(l),b=f*Math.pow(2,y);r.scaleTo(n,b,v,l);return}const d=l.deltaMode===1?20:1;let h=i===et.Vertical?0:l.deltaX*d,g=i===et.Horizontal?0:l.deltaY*d;!jt()&&l.shiftKey&&i!==et.Vertical&&(h=l.deltaY*d,g=0),r.translateBy(n,-(h/f)*o,-(g/f)*o,{internal:!0});const m=$n(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(l,m),e.panScrollTimeout=setTimeout(()=>{u?.(l,m),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(l,m))}}function S1({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const o=r.type==="wheel",a=!t&&o&&!r.ctrlKey,s=ft(r,e);if(r.ctrlKey&&o&&s&&r.preventDefault(),a||s)return null;r.preventDefault(),n.call(this,r,i)}}function C1({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const i=$n(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,i)}}function q1({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return o=>{e.usedRightMouseButton=!!(n&&wm(t,e.mouseButton??0)),o.sourceEvent?.sync||r([o.transform.x,o.transform.y,o.transform.k]),i&&!o.sourceEvent?.internal&&i?.(o.sourceEvent,$n(o.transform))}}function R1({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:o}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,o&&wm(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&o(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const s=$n(a.transform);e.prevViewport=s,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(a.sourceEvent,s)},n?150:0)}}}function I1({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:o,userSelectionActive:a,noWheelClassName:s,noPanClassName:c,lib:u,connectionInProgress:l}){return f=>{const d=e||t,h=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(ft(f,`${u}-flow__node`)||ft(f,`${u}-flow__edge`)))return!0;if(!r&&!d&&!i&&!o&&!n||a||l&&!g||ft(f,s)&&g||ft(f,c)&&(!g||i&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!i&&!h&&g||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const m=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&m}}function N1({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:o,onPanZoomStart:a,onPanZoomEnd:s,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},l=e.getBoundingClientRect(),f=Wv().scaleExtent([t,n]).translateExtent(r),d=ge(e).call(f);b({x:i.x,y:i.y,zoom:yt(i.zoom,t,n)},[[0,0],[l.width,l.height]],r);const h=d.on("wheel.zoom"),g=d.on("dblclick.zoom");f.wheelDelta(xm);function m(q,M){return d?new Promise(k=>{f?.interpolate(M?.interpolate==="linear"?kt:vn).transform(vr(d,M?.duration,M?.ease,()=>k(!0)),q)}):Promise.resolve(!1)}function v({noWheelClassName:q,noPanClassName:M,onPaneContextMenu:k,userSelectionActive:S,panOnScroll:A,panOnDrag:N,panOnScrollMode:L,panOnScrollSpeed:P,preventScrolling:D,zoomOnPinch:j,zoomOnScroll:G,zoomOnDoubleClick:V,zoomActivationKeyPressed:Y,lib:I,onTransformChange:O,connectionInProgress:z,paneClickDistance:H,selectionOnDrag:B}){S&&!u.isZoomingOrPanning&&y();const U=A&&!Y&&!S;f.clickDistance(B?1/0:!we(H)||H<0?0:H);const X=U?E1({zoomPanValues:u,noWheelClassName:q,d3Selection:d,d3Zoom:f,panOnScrollMode:L,panOnScrollSpeed:P,zoomOnPinch:j,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:s}):S1({noWheelClassName:q,preventScrolling:D,d3ZoomHandler:h});if(d.on("wheel.zoom",X,{passive:!1}),!S){const Q=C1({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",Q);const W=q1({zoomPanValues:u,panOnDrag:N,onPaneContextMenu:!!k,onPanZoom:o,onTransformChange:O});f.on("zoom",W);const te=R1({zoomPanValues:u,panOnDrag:N,panOnScroll:A,onPaneContextMenu:k,onPanZoomEnd:s,onDraggingChange:c});f.on("end",te)}const J=I1({zoomActivationKeyPressed:Y,panOnDrag:N,zoomOnScroll:G,panOnScroll:A,zoomOnDoubleClick:V,zoomOnPinch:j,userSelectionActive:S,noPanClassName:M,noWheelClassName:q,lib:I,connectionInProgress:z});f.filter(J),V?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function b(q,M,k){const S=gr(q),A=f?.constrain()(S,M,k);return A&&await m(A),new Promise(N=>N(A))}async function p(q,M){const k=gr(q);return await m(k,M),new Promise(S=>S(k))}function _(q){if(d){const M=gr(q),k=d.property("__zoom");(k.k!==q.zoom||k.x!==q.x||k.y!==q.y)&&f?.transform(d,M,null,{sync:!0})}}function x(){const q=d?Yv(d.node()):{x:0,y:0,k:1};return{x:q.x,y:q.y,zoom:q.k}}function w(q,M){return d?new Promise(k=>{f?.interpolate(M?.interpolate==="linear"?kt:vn).scaleTo(vr(d,M?.duration,M?.ease,()=>k(!0)),q)}):Promise.resolve(!1)}function E(q,M){return d?new Promise(k=>{f?.interpolate(M?.interpolate==="linear"?kt:vn).scaleBy(vr(d,M?.duration,M?.ease,()=>k(!0)),q)}):Promise.resolve(!1)}function R(q){f?.scaleExtent(q)}function C(q){f?.translateExtent(q)}function T(q){const M=!we(q)||q<0?0:q;f?.clickDistance(M)}return{update:v,destroy:y,setViewport:p,setViewportConstrained:b,getViewport:x,scaleTo:w,scaleBy:E,setScaleExtent:R,setTranslateExtent:C,syncViewport:_,setClickDistance:T}}var wt;(function(e){e.Line="line",e.Handle="handle"})(wt||(wt={}));function A1({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:o}){const a=e-t,s=n-r,c=[a>0?1:a<0?-1:0,s>0?1:s<0?-1:0];return a&&i&&(c[0]=c[0]*-1),s&&o&&(c[1]=c[1]*-1),c}function wl(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function Ue(e,t){return Math.max(0,t-e)}function Ye(e,t){return Math.max(0,e-t)}function dn(e,t,n){return Math.max(0,t-e,e-n)}function xl(e,t){return e?!t:t}function M1(e,t,n,r,i,o,a,s){let{affectsX:c,affectsY:u}=t;const{isHorizontal:l,isVertical:f}=t,d=l&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:m,maxWidth:v,minHeight:y,maxHeight:b}=r,{x:p,y:_,width:x,height:w,aspectRatio:E}=e;let R=Math.floor(l?h-e.pointerX:0),C=Math.floor(f?g-e.pointerY:0);const T=x+(c?-R:R),q=w+(u?-C:C),M=-o[0]*x,k=-o[1]*w;let S=dn(T,m,v),A=dn(q,y,b);if(a){let P=0,D=0;c&&R<0?P=Ue(p+R+M,a[0][0]):!c&&R>0&&(P=Ye(p+T+M,a[1][0])),u&&C<0?D=Ue(_+C+k,a[0][1]):!u&&C>0&&(D=Ye(_+q+k,a[1][1])),S=Math.max(S,P),A=Math.max(A,D)}if(s){let P=0,D=0;c&&R>0?P=Ye(p+R,s[0][0]):!c&&R<0&&(P=Ue(p+T,s[1][0])),u&&C>0?D=Ye(_+C,s[0][1]):!u&&C<0&&(D=Ue(_+q,s[1][1])),S=Math.max(S,P),A=Math.max(A,D)}if(i){if(l){const P=dn(T/E,y,b)*E;if(S=Math.max(S,P),a){let D=0;!c&&!u||c&&!u&&d?D=Ye(_+k+T/E,a[1][1])*E:D=Ue(_+k+(c?R:-R)/E,a[0][1])*E,S=Math.max(S,D)}if(s){let D=0;!c&&!u||c&&!u&&d?D=Ue(_+T/E,s[1][1])*E:D=Ye(_+(c?R:-R)/E,s[0][1])*E,S=Math.max(S,D)}}if(f){const P=dn(q*E,m,v)/E;if(A=Math.max(A,P),a){let D=0;!c&&!u||u&&!c&&d?D=Ye(p+q*E+M,a[1][0])/E:D=Ue(p+(u?C:-C)*E+M,a[0][0])/E,A=Math.max(A,D)}if(s){let D=0;!c&&!u||u&&!c&&d?D=Ue(p+q*E,s[1][0])/E:D=Ye(p+(u?C:-C)*E,s[0][0])/E,A=Math.max(A,D)}}}C=C+(C<0?A:-A),R=R+(R<0?S:-S),i&&(d?T>q*E?C=(xl(c,u)?-R:R)/E:R=(xl(c,u)?-C:C)*E:l?(C=R/E,u=c):(R=C*E,c=u));const N=c?p+R:p,L=u?_+C:_;return{width:x+(c?-R:R),height:w+(u?-C:C),x:o[0]*R*(c?-1:1)+N,y:o[1]*C*(u?-1:1)+L}}const Em={width:0,height:0,x:0,y:0},T1={...Em,pointerX:0,pointerY:0,aspectRatio:1};function P1(e){return[[0,0],[e.measured.width,e.measured.height]]}function k1(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,o=e.measured.width??0,a=e.measured.height??0,s=n[0]*o,c=n[1]*a;return[[r-s,i-c],[r+o-s,i+a-c]]}function O1({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const o=ge(e);let a={controlDirection:wl("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:u,boundaries:l,keepAspectRatio:f,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:m,shouldResize:v}){let y={...Em},b={...T1};a={boundaries:l,resizeDirection:d,keepAspectRatio:f,controlDirection:wl(u)};let p,_=null,x=[],w,E,R,C=!1;const T=Pv().on("start",q=>{const{nodeLookup:M,transform:k,snapGrid:S,snapToGrid:A,nodeOrigin:N,paneDomNode:L}=n();if(p=M.get(t),!p)return;_=L?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:D}=Ot(q.sourceEvent,{transform:k,snapGrid:S,snapToGrid:A,containerBounds:_});y={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...y,pointerX:P,pointerY:D,aspectRatio:y.width/y.height},w=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(w=M.get(p.parentId),E=w&&p.extent==="parent"?P1(w):void 0),x=[],R=void 0;for(const[j,G]of M)if(G.parentId===t&&(x.push({id:j,position:{...G.position},extent:G.extent}),G.extent==="parent"||G.expandParent)){const V=k1(G,p,G.origin??N);R?R=[[Math.min(V[0][0],R[0][0]),Math.min(V[0][1],R[0][1])],[Math.max(V[1][0],R[1][0]),Math.max(V[1][1],R[1][1])]]:R=V}h?.(q,{...y})}).on("drag",q=>{const{transform:M,snapGrid:k,snapToGrid:S,nodeOrigin:A}=n(),N=Ot(q.sourceEvent,{transform:M,snapGrid:k,snapToGrid:S,containerBounds:_}),L=[];if(!p)return;const{x:P,y:D,width:j,height:G}=y,V={},Y=p.origin??A,{width:I,height:O,x:z,y:H}=M1(b,a.controlDirection,N,a.boundaries,a.keepAspectRatio,Y,E,R),B=I!==j,U=O!==G,X=z!==P&&B,J=H!==D&&U;if(!X&&!J&&!B&&!U)return;if((X||J||Y[0]===1||Y[1]===1)&&(V.x=X?z:y.x,V.y=J?H:y.y,y.x=V.x,y.y=V.y,x.length>0)){const K=z-P,re=H-D;for(const ee of x)ee.position={x:ee.position.x-K+Y[0]*(I-j),y:ee.position.y-re+Y[1]*(O-G)},L.push(ee)}if((B||U)&&(V.width=B&&(!a.resizeDirection||a.resizeDirection==="horizontal")?I:y.width,V.height=U&&(!a.resizeDirection||a.resizeDirection==="vertical")?O:y.height,y.width=V.width,y.height=V.height),w&&p.expandParent){const K=Y[0]*(V.width??0);V.x&&V.x<K&&(y.x=K,b.x=b.x-(V.x-K));const re=Y[1]*(V.height??0);V.y&&V.y<re&&(y.y=re,b.y=b.y-(V.y-re))}const Q=A1({width:y.width,prevWidth:j,height:y.height,prevHeight:G,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),W={...y,direction:Q};v?.(q,W)!==!1&&(C=!0,g?.(q,W),r(V,L))}).on("end",q=>{C&&(m?.(q,{...y}),i?.({...y}),C=!1)});o.call(T)}function c(){o.on(".drag",null)}return{update:s,destroy:c}}var mr={exports:{}},yr={},_r={exports:{}},br={};var El;function L1(){if(El)return br;El=1;var e=yv();function t(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,o=e.useLayoutEffect,a=e.useDebugValue;function s(f,d){var h=d(),g=r({inst:{value:h,getSnapshot:d}}),m=g[0].inst,v=g[1];return o(function(){m.value=h,m.getSnapshot=d,c(m)&&v({inst:m})},[f,h,d]),i(function(){return c(m)&&v({inst:m}),f(function(){c(m)&&v({inst:m})})},[f]),a(h),h}function c(f){var d=f.getSnapshot;f=f.value;try{var h=d();return!n(f,h)}catch{return!0}}function u(f,d){return d()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:s;return br.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:l,br}var Sl;function D1(){return Sl||(Sl=1,_r.exports=L1()),_r.exports}var Cl;function F1(){if(Cl)return yr;Cl=1;var e=yv(),t=D1();function n(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,a=e.useEffect,s=e.useMemo,c=e.useDebugValue;return yr.useSyncExternalStoreWithSelector=function(u,l,f,d,h){var g=o(null);if(g.current===null){var m={hasValue:!1,value:null};g.current=m}else m=g.current;g=s(function(){function y(w){if(!b){if(b=!0,p=w,w=d(w),h!==void 0&&m.hasValue){var E=m.value;if(h(E,w))return _=E}return _=w}if(E=_,r(p,w))return E;var R=d(w);return h!==void 0&&h(E,R)?(p=w,E):(p=w,_=R)}var b=!1,p,_,x=f===void 0?null:f;return[function(){return y(l())},x===null?void 0:function(){return y(x())}]},[l,f,d,h]);var v=i(u,g[0],g[1]);return a(function(){m.hasValue=!0,m.value=v},[v]),c(v),v},yr}var ql;function z1(){return ql||(ql=1,mr.exports=F1()),mr.exports}var $1=z1();const H1=n_($1),B1={},Rl=e=>{let t;const n=new Set,r=(l,f)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,h))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>u,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{(B1?"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()}},u=t=e(r,i,c);return c},j1=e=>e?Rl(e):Rl,{useDebugValue:V1}=r_,{useSyncExternalStoreWithSelector:G1}=H1,U1=e=>e;function Sm(e,t=U1,n){const r=G1(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return V1(r),r}const Il=(e,t)=>{const n=j1(e),r=(i,o=t)=>Sm(n,i,o);return Object.assign(r,n),r},Y1=(e,t)=>e?Il(e,t):Il;function ie(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[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Hn=$.createContext(null),W1=Hn.Provider,Cm=Ae.error001();function ne(e,t){const n=$.useContext(Hn);if(n===null)throw new Error(Cm);return Sm(n,e,t)}function oe(){const e=$.useContext(Hn);if(e===null)throw new Error(Cm);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Nl={display:"none"},X1={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},qm="react-flow__node-desc",Rm="react-flow__edge-desc",K1="react-flow__aria-live",Z1=e=>e.ariaLiveMessage,Q1=e=>e.ariaLabelConfig;function J1({rfId:e}){const t=ne(Z1);return F.jsx("div",{id:`${K1}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:X1,children:t})}function eE({rfId:e,disableKeyboardA11y:t}){const n=ne(Q1);return F.jsxs(F.Fragment,{children:[F.jsx("div",{id:`${qm}-${e}`,style:Nl,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),F.jsx("div",{id:`${Rm}-${e}`,style:Nl,children:n["edge.a11yDescription.default"]}),!t&&F.jsx(J1,{rfId:e})]})}const Bn=$.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},o)=>{const a=`${e}`.split("-");return F.jsx("div",{className:ue(["react-flow__panel",n,...a]),style:r,ref:o,...i,children:t})});Bn.displayName="Panel";function tE({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:F.jsx(Bn,{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:F.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const nE=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},hn=e=>e.id;function rE(e,t){return ie(e.selectedNodes.map(hn),t.selectedNodes.map(hn))&&ie(e.selectedEdges.map(hn),t.selectedEdges.map(hn))}function iE({onSelectionChange:e}){const t=oe(),{selectedNodes:n,selectedEdges:r}=ne(nE,rE);return $.useEffect(()=>{const i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(o=>o(i))},[n,r,e]),null}const oE=e=>!!e.onSelectionChangeHandlers;function aE({onSelectionChange:e}){const t=ne(oE);return e||t?F.jsx(iE,{onSelectionChange:e}):null}const Im=[0,0],sE={x:0,y:0,zoom:1},uE=["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"],Al=[...uE,"rfId"],cE=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}),Ml={translateExtent:$t,nodeOrigin:Im,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function lE(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:o,setNodeExtent:a,reset:s,setDefaultNodesAndEdges:c}=ne(cE,ie),u=oe();$.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{l.current=Ml,s()}),[]);const l=$.useRef(Ml);return $.useEffect(()=>{for(const f of Al){const d=e[f],h=l.current[f];d!==h&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?r(d):f==="maxZoom"?i(d):f==="translateExtent"?o(d):f==="nodeExtent"?a(d):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:Yx(d)}):f==="fitView"?u.setState({fitViewQueued:d}):f==="fitViewOptions"?u.setState({fitViewOptions:d}):u.setState({[f]:d})))}l.current=e},Al.map(f=>e[f])),null}function Tl(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function fE(e){const[t,n]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){n(e);return}const r=Tl(),i=()=>n(r?.matches?"dark":"light");return i(),r?.addEventListener("change",i),()=>{r?.removeEventListener("change",i)}},[e]),t!==null?t:Tl()?.matches?"dark":"light"}const Pl=typeof document<"u"?document:null;function Vt(e=null,t={target:Pl,actInsideInputWithModifier:!0}){const[n,r]=$.useState(!1),i=$.useRef(!1),o=$.useRef(new Set([])),[a,s]=$.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
1
|
+
import{a as yv,g as n_,b as r_,r as $,j as F,c as on}from"./vendor-query-CcgjkJlA.js";import"./vendor-radix-CXoPacKb.js";function ue(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ue(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var i_={value:()=>{}};function Pn(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new gn(n)}function gn(e){this._=e}function o_(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}gn.prototype=Pn.prototype={constructor:gn,on:function(e,t){var n=this._,r=o_(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o<a;)if((i=(e=r[o]).type)&&(i=a_(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<a;)if(i=(e=r[o]).type)n[i]=Gc(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Gc(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new gn(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function a_(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Gc(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=i_,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Hu="http://www.w3.org/1999/xhtml";const Uc={svg:"http://www.w3.org/2000/svg",xhtml:Hu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function kn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Uc.hasOwnProperty(t)?{space:Uc[t],local:e}:e}function s_(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Hu&&t.documentElement.namespaceURI===Hu?t.createElement(e):t.createElementNS(n,e)}}function u_(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _v(e){var t=kn(e);return(t.local?u_:s_)(t)}function c_(){}function tc(e){return e==null?c_:function(){return this.querySelector(e)}}function l_(e){typeof e!="function"&&(e=tc(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=new Array(a),c,u,l=0;l<a;++l)(c=o[l])&&(u=e.call(c,c.__data__,l,o))&&("__data__"in c&&(u.__data__=c.__data__),s[l]=u);return new ve(r,this._parents)}function f_(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function d_(){return[]}function bv(e){return e==null?d_:function(){return this.querySelectorAll(e)}}function h_(e){return function(){return f_(e.apply(this,arguments))}}function p_(e){typeof e=="function"?e=h_(e):e=bv(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var a=t[o],s=a.length,c,u=0;u<s;++u)(c=a[u])&&(r.push(e.call(c,c.__data__,u,a)),i.push(c));return new ve(r,i)}function wv(e){return function(){return this.matches(e)}}function xv(e){return function(t){return t.matches(e)}}var g_=Array.prototype.find;function v_(e){return function(){return g_.call(this.children,e)}}function m_(){return this.firstElementChild}function y_(e){return this.select(e==null?m_:v_(typeof e=="function"?e:xv(e)))}var __=Array.prototype.filter;function b_(){return Array.from(this.children)}function w_(e){return function(){return __.call(this.children,e)}}function x_(e){return this.selectAll(e==null?b_:w_(typeof e=="function"?e:xv(e)))}function E_(e){typeof e!="function"&&(e=wv(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],c,u=0;u<a;++u)(c=o[u])&&e.call(c,c.__data__,u,o)&&s.push(c);return new ve(r,this._parents)}function Ev(e){return new Array(e.length)}function S_(){return new ve(this._enter||this._groups.map(Ev),this._parents)}function bn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}bn.prototype={constructor:bn,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 C_(e){return function(){return e}}function q_(e,t,n,r,i,o){for(var a=0,s,c=t.length,u=o.length;a<u;++a)(s=t[a])?(s.__data__=o[a],r[a]=s):n[a]=new bn(e,o[a]);for(;a<c;++a)(s=t[a])&&(i[a]=s)}function R_(e,t,n,r,i,o,a){var s,c,u=new Map,l=t.length,f=o.length,d=new Array(l),h;for(s=0;s<l;++s)(c=t[s])&&(d[s]=h=a.call(c,c.__data__,s,t)+"",u.has(h)?i[s]=c:u.set(h,c));for(s=0;s<f;++s)h=a.call(e,o[s],s,o)+"",(c=u.get(h))?(r[s]=c,c.__data__=o[s],u.delete(h)):n[s]=new bn(e,o[s]);for(s=0;s<l;++s)(c=t[s])&&u.get(d[s])===c&&(i[s]=c)}function I_(e){return e.__data__}function N_(e,t){if(!arguments.length)return Array.from(this,I_);var n=t?R_:q_,r=this._parents,i=this._groups;typeof e!="function"&&(e=C_(e));for(var o=i.length,a=new Array(o),s=new Array(o),c=new Array(o),u=0;u<o;++u){var l=r[u],f=i[u],d=f.length,h=A_(e.call(l,l&&l.__data__,u,r)),g=h.length,m=s[u]=new Array(g),v=a[u]=new Array(g),y=c[u]=new Array(d);n(l,f,m,v,y,h,t);for(var b=0,p=0,_,x;b<g;++b)if(_=m[b]){for(b>=p&&(p=b+1);!(x=v[p])&&++p<g;);_._next=x||null}}return a=new ve(a,r),a._enter=s,a._exit=c,a}function A_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function M_(){return new ve(this._exit||this._groups.map(Ev),this._parents)}function T_(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function P_(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),c=0;c<a;++c)for(var u=n[c],l=r[c],f=u.length,d=s[c]=new Array(f),h,g=0;g<f;++g)(h=u[g]||l[g])&&(d[g]=h);for(;c<i;++c)s[c]=n[c];return new ve(s,this._parents)}function k_(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],a;--i>=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function O_(e){e||(e=L_);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a=n[o],s=a.length,c=i[o]=new Array(s),u,l=0;l<s;++l)(u=a[l])&&(c[l]=u);c.sort(t)}return new ve(i,this._parents).order()}function L_(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function D_(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function F_(){return Array.from(this)}function z_(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null}function $_(){let e=0;for(const t of this)++e;return e}function H_(){return!this.node()}function B_(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,a=i.length,s;o<a;++o)(s=i[o])&&e.call(s,s.__data__,o,i);return this}function j_(e){return function(){this.removeAttribute(e)}}function V_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function G_(e,t){return function(){this.setAttribute(e,t)}}function U_(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Y_(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function W_(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 X_(e,t){var n=kn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?V_:j_:typeof t=="function"?n.local?W_:Y_:n.local?U_:G_)(n,t))}function Sv(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function K_(e){return function(){this.style.removeProperty(e)}}function Z_(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Q_(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function J_(e,t,n){return arguments.length>1?this.each((t==null?K_:typeof t=="function"?Q_:Z_)(e,t,n??"")):gt(this.node(),e)}function gt(e,t){return e.style.getPropertyValue(t)||Sv(e).getComputedStyle(e,null).getPropertyValue(t)}function eb(e){return function(){delete this[e]}}function tb(e,t){return function(){this[e]=t}}function nb(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function rb(e,t){return arguments.length>1?this.each((t==null?eb:typeof t=="function"?nb:tb)(e,t)):this.node()[e]}function Cv(e){return e.trim().split(/^|\s+/)}function nc(e){return e.classList||new qv(e)}function qv(e){this._node=e,this._names=Cv(e.getAttribute("class")||"")}qv.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 Rv(e,t){for(var n=nc(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Iv(e,t){for(var n=nc(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function ib(e){return function(){Rv(this,e)}}function ob(e){return function(){Iv(this,e)}}function ab(e,t){return function(){(t.apply(this,arguments)?Rv:Iv)(this,e)}}function sb(e,t){var n=Cv(e+"");if(arguments.length<2){for(var r=nc(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?ab:t?ib:ob)(n,t))}function ub(){this.textContent=""}function cb(e){return function(){this.textContent=e}}function lb(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function fb(e){return arguments.length?this.each(e==null?ub:(typeof e=="function"?lb:cb)(e)):this.node().textContent}function db(){this.innerHTML=""}function hb(e){return function(){this.innerHTML=e}}function pb(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function gb(e){return arguments.length?this.each(e==null?db:(typeof e=="function"?pb:hb)(e)):this.node().innerHTML}function vb(){this.nextSibling&&this.parentNode.appendChild(this)}function mb(){return this.each(vb)}function yb(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function _b(){return this.each(yb)}function bb(e){var t=typeof e=="function"?e:_v(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function wb(){return null}function xb(e,t){var n=typeof e=="function"?e:_v(e),r=t==null?wb:typeof t=="function"?t:tc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Eb(){var e=this.parentNode;e&&e.removeChild(this)}function Sb(){return this.each(Eb)}function Cb(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qb(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Rb(e){return this.select(e?qb:Cb)}function Ib(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Nb(e){return function(t){e.call(this,t,this.__data__)}}function Ab(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Mb(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function Tb(e,t,n){return function(){var r=this.__on,i,o=Nb(t);if(r){for(var a=0,s=r.length;a<s;++a)if((i=r[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function Pb(e,t,n){var r=Ab(e+""),i,o=r.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,u=s.length,l;c<u;++c)for(i=0,l=s[c];i<o;++i)if((a=r[i]).type===l.type&&a.name===l.name)return l.value}return}for(s=t?Tb:Mb,i=0;i<o;++i)this.each(s(r[i],t,n));return this}function Nv(e,t,n){var r=Sv(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function kb(e,t){return function(){return Nv(this,e,t)}}function Ob(e,t){return function(){return Nv(this,e,t.apply(this,arguments))}}function Lb(e,t){return this.each((typeof t=="function"?Ob:kb)(e,t))}function*Db(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,a;i<o;++i)(a=r[i])&&(yield a)}var Av=[null];function ve(e,t){this._groups=e,this._parents=t}function Gt(){return new ve([[document.documentElement]],Av)}function Fb(){return this}ve.prototype=Gt.prototype={constructor:ve,select:l_,selectAll:p_,selectChild:y_,selectChildren:x_,filter:E_,data:N_,enter:S_,exit:M_,join:T_,merge:P_,selection:Fb,order:k_,sort:O_,call:D_,nodes:F_,node:z_,size:$_,empty:H_,each:B_,attr:X_,style:J_,property:rb,classed:sb,text:fb,html:gb,raise:mb,lower:_b,append:bb,insert:xb,remove:Sb,clone:Rb,datum:Ib,on:Pb,dispatch:Lb,[Symbol.iterator]:Db};function ge(e){return typeof e=="string"?new ve([[document.querySelector(e)]],[document.documentElement]):new ve([[e]],Av)}function zb(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _e(e,t){if(e=zb(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const $b={passive:!1},Lt={capture:!0,passive:!1};function lr(e){e.stopImmediatePropagation()}function ht(e){e.preventDefault(),e.stopImmediatePropagation()}function Mv(e){var t=e.document.documentElement,n=ge(e).on("dragstart.drag",ht,Lt);"onselectstart"in t?n.on("selectstart.drag",ht,Lt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Tv(e,t){var n=e.document.documentElement,r=ge(e).on("dragstart.drag",null);t&&(r.on("click.drag",ht,Lt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const an=e=>()=>e;function Bu(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:c,dy:u,dispatch:l}){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:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:l}})}Bu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Hb(e){return!e.ctrlKey&&!e.button}function Bb(){return this.parentNode}function jb(e,t){return t??{x:e.x,y:e.y}}function Vb(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pv(){var e=Hb,t=Bb,n=jb,r=Vb,i={},o=Pn("start","drag","end"),a=0,s,c,u,l,f=0;function d(_){_.on("mousedown.drag",h).filter(r).on("touchstart.drag",v).on("touchmove.drag",y,$b).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(_,x){if(!(l||!e.call(this,_,x))){var w=p(this,t.call(this,_,x),_,x,"mouse");w&&(ge(_.view).on("mousemove.drag",g,Lt).on("mouseup.drag",m,Lt),Mv(_.view),lr(_),u=!1,s=_.clientX,c=_.clientY,w("start",_))}}function g(_){if(ht(_),!u){var x=_.clientX-s,w=_.clientY-c;u=x*x+w*w>f}i.mouse("drag",_)}function m(_){ge(_.view).on("mousemove.drag mouseup.drag",null),Tv(_.view,u),ht(_),i.mouse("end",_)}function v(_,x){if(e.call(this,_,x)){var w=_.changedTouches,E=t.call(this,_,x),R=w.length,C,T;for(C=0;C<R;++C)(T=p(this,E,_,x,w[C].identifier,w[C]))&&(lr(_),T("start",_,w[C]))}}function y(_){var x=_.changedTouches,w=x.length,E,R;for(E=0;E<w;++E)(R=i[x[E].identifier])&&(ht(_),R("drag",_,x[E]))}function b(_){var x=_.changedTouches,w=x.length,E,R;for(l&&clearTimeout(l),l=setTimeout(function(){l=null},500),E=0;E<w;++E)(R=i[x[E].identifier])&&(lr(_),R("end",_,x[E]))}function p(_,x,w,E,R,C){var T=o.copy(),q=_e(C||w,x),M,k,S;if((S=n.call(_,new Bu("beforestart",{sourceEvent:w,target:d,identifier:R,active:a,x:q[0],y:q[1],dx:0,dy:0,dispatch:T}),E))!=null)return M=S.x-q[0]||0,k=S.y-q[1]||0,function A(N,L,P){var D=q,j;switch(N){case"start":i[R]=A,j=a++;break;case"end":delete i[R],--a;case"drag":q=_e(P||L,x),j=a;break}T.call(N,_,new Bu(N,{sourceEvent:L,subject:S,target:d,identifier:R,active:j,x:q[0]+M,y:q[1]+k,dx:q[0]-D[0],dy:q[1]-D[1],dispatch:T}),E)}}return d.filter=function(_){return arguments.length?(e=typeof _=="function"?_:an(!!_),d):e},d.container=function(_){return arguments.length?(t=typeof _=="function"?_:an(_),d):t},d.subject=function(_){return arguments.length?(n=typeof _=="function"?_:an(_),d):n},d.touchable=function(_){return arguments.length?(r=typeof _=="function"?_:an(!!_),d):r},d.on=function(){var _=o.on.apply(o,arguments);return _===o?d:_},d.clickDistance=function(_){return arguments.length?(f=(_=+_)*_,d):Math.sqrt(f)},d}function rc(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function kv(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Ut(){}var Dt=.7,wn=1/Dt,pt="\\s*([+-]?\\d+)\\s*",Ft="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ne="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Gb=/^#([0-9a-f]{3,8})$/,Ub=new RegExp(`^rgb\\(${pt},${pt},${pt}\\)$`),Yb=new RegExp(`^rgb\\(${Ne},${Ne},${Ne}\\)$`),Wb=new RegExp(`^rgba\\(${pt},${pt},${pt},${Ft}\\)$`),Xb=new RegExp(`^rgba\\(${Ne},${Ne},${Ne},${Ft}\\)$`),Kb=new RegExp(`^hsl\\(${Ft},${Ne},${Ne}\\)$`),Zb=new RegExp(`^hsla\\(${Ft},${Ne},${Ne},${Ft}\\)$`),Yc={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};rc(Ut,tt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Wc,formatHex:Wc,formatHex8:Qb,formatHsl:Jb,formatRgb:Xc,toString:Xc});function Wc(){return this.rgb().formatHex()}function Qb(){return this.rgb().formatHex8()}function Jb(){return Ov(this).formatHsl()}function Xc(){return this.rgb().formatRgb()}function tt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Gb.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Kc(t):n===3?new he(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?sn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?sn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ub.exec(e))?new he(t[1],t[2],t[3],1):(t=Yb.exec(e))?new he(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Wb.exec(e))?sn(t[1],t[2],t[3],t[4]):(t=Xb.exec(e))?sn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Kb.exec(e))?Jc(t[1],t[2]/100,t[3]/100,1):(t=Zb.exec(e))?Jc(t[1],t[2]/100,t[3]/100,t[4]):Yc.hasOwnProperty(e)?Kc(Yc[e]):e==="transparent"?new he(NaN,NaN,NaN,0):null}function Kc(e){return new he(e>>16&255,e>>8&255,e&255,1)}function sn(e,t,n,r){return r<=0&&(e=t=n=NaN),new he(e,t,n,r)}function ew(e){return e instanceof Ut||(e=tt(e)),e?(e=e.rgb(),new he(e.r,e.g,e.b,e.opacity)):new he}function ju(e,t,n,r){return arguments.length===1?ew(e):new he(e,t,n,r??1)}function he(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}rc(he,ju,kv(Ut,{brighter(e){return e=e==null?wn:Math.pow(wn,e),new he(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Dt:Math.pow(Dt,e),new he(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new he(Je(this.r),Je(this.g),Je(this.b),xn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Zc,formatHex:Zc,formatHex8:tw,formatRgb:Qc,toString:Qc}));function Zc(){return`#${Qe(this.r)}${Qe(this.g)}${Qe(this.b)}`}function tw(){return`#${Qe(this.r)}${Qe(this.g)}${Qe(this.b)}${Qe((isNaN(this.opacity)?1:this.opacity)*255)}`}function Qc(){const e=xn(this.opacity);return`${e===1?"rgb(":"rgba("}${Je(this.r)}, ${Je(this.g)}, ${Je(this.b)}${e===1?")":`, ${e})`}`}function xn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Je(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Qe(e){return e=Je(e),(e<16?"0":"")+e.toString(16)}function Jc(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new be(e,t,n,r)}function Ov(e){if(e instanceof be)return new be(e.h,e.s,e.l,e.opacity);if(e instanceof Ut||(e=tt(e)),!e)return new be;if(e instanceof be)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,s=o-i,c=(o+i)/2;return s?(t===o?a=(n-r)/s+(n<r)*6:n===o?a=(r-t)/s+2:a=(t-n)/s+4,s/=c<.5?o+i:2-o-i,a*=60):s=c>0&&c<1?0:a,new be(a,s,c,e.opacity)}function nw(e,t,n,r){return arguments.length===1?Ov(e):new be(e,t,n,r??1)}function be(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}rc(be,nw,kv(Ut,{brighter(e){return e=e==null?wn:Math.pow(wn,e),new be(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Dt:Math.pow(Dt,e),new be(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new he(fr(e>=240?e-240:e+120,i,r),fr(e,i,r),fr(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new be(el(this.h),un(this.s),un(this.l),xn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=xn(this.opacity);return`${e===1?"hsl(":"hsla("}${el(this.h)}, ${un(this.s)*100}%, ${un(this.l)*100}%${e===1?")":`, ${e})`}`}}));function el(e){return e=(e||0)%360,e<0?e+360:e}function un(e){return Math.max(0,Math.min(1,e||0))}function fr(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const ic=e=>()=>e;function rw(e,t){return function(n){return e+n*t}}function iw(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function ow(e){return(e=+e)==1?Lv:function(t,n){return n-t?iw(t,n,e):ic(isNaN(t)?n:t)}}function Lv(e,t){var n=t-e;return n?rw(e,n):ic(isNaN(e)?t:e)}const En=(function e(t){var n=ow(t);function r(i,o){var a=n((i=ju(i)).r,(o=ju(o)).r),s=n(i.g,o.g),c=n(i.b,o.b),u=Lv(i.opacity,o.opacity);return function(l){return i.r=a(l),i.g=s(l),i.b=c(l),i.opacity=u(l),i+""}}return r.gamma=e,r})(1);function aw(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=e[i]*(1-o)+t[i]*o;return r}}function sw(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function uw(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),o=new Array(n),a;for(a=0;a<r;++a)i[a]=kt(e[a],t[a]);for(;a<n;++a)o[a]=t[a];return function(s){for(a=0;a<r;++a)o[a]=i[a](s);return o}}function cw(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ie(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function lw(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=kt(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var Vu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,dr=new RegExp(Vu.source,"g");function fw(e){return function(){return e}}function dw(e){return function(t){return e(t)+""}}function Dv(e,t){var n=Vu.lastIndex=dr.lastIndex=0,r,i,o,a=-1,s=[],c=[];for(e=e+"",t=t+"";(r=Vu.exec(e))&&(i=dr.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,c.push({i:a,x:Ie(r,i)})),n=dr.lastIndex;return n<t.length&&(o=t.slice(n),s[a]?s[a]+=o:s[++a]=o),s.length<2?c[0]?dw(c[0].x):fw(t):(t=c.length,function(u){for(var l=0,f;l<t;++l)s[(f=c[l]).i]=f.x(u);return s.join("")})}function kt(e,t){var n=typeof t,r;return t==null||n==="boolean"?ic(t):(n==="number"?Ie:n==="string"?(r=tt(t))?(t=r,En):Dv:t instanceof tt?En:t instanceof Date?cw:sw(t)?aw:Array.isArray(t)?uw:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?lw:Ie)(e,t)}var tl=180/Math.PI,Gu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Fv(e,t,n,r,i,o){var a,s,c;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*tl,skewX:Math.atan(c)*tl,scaleX:a,scaleY:s}}var cn;function hw(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Gu:Fv(t.a,t.b,t.c,t.d,t.e,t.f)}function pw(e){return e==null||(cn||(cn=document.createElementNS("http://www.w3.org/2000/svg","g")),cn.setAttribute("transform",e),!(e=cn.transform.baseVal.consolidate()))?Gu:(e=e.matrix,Fv(e.a,e.b,e.c,e.d,e.e,e.f))}function zv(e,t,n,r){function i(u){return u.length?u.pop()+" ":""}function o(u,l,f,d,h,g){if(u!==f||l!==d){var m=h.push("translate(",null,t,null,n);g.push({i:m-4,x:Ie(u,f)},{i:m-2,x:Ie(l,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function a(u,l,f,d){u!==l?(u-l>180?l+=360:l-u>180&&(u+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Ie(u,l)})):l&&f.push(i(f)+"rotate("+l+r)}function s(u,l,f,d){u!==l?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Ie(u,l)}):l&&f.push(i(f)+"skewX("+l+r)}function c(u,l,f,d,h,g){if(u!==f||l!==d){var m=h.push(i(h)+"scale(",null,",",null,")");g.push({i:m-4,x:Ie(u,f)},{i:m-2,x:Ie(l,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(u,l){var f=[],d=[];return u=e(u),l=e(l),o(u.translateX,u.translateY,l.translateX,l.translateY,f,d),a(u.rotate,l.rotate,f,d),s(u.skewX,l.skewX,f,d),c(u.scaleX,u.scaleY,l.scaleX,l.scaleY,f,d),u=l=null,function(h){for(var g=-1,m=d.length,v;++g<m;)f[(v=d[g]).i]=v.x(h);return f.join("")}}}var gw=zv(hw,"px, ","px)","deg)"),vw=zv(pw,", ",")",")"),mw=1e-12;function nl(e){return((e=Math.exp(e))+1/e)/2}function yw(e){return((e=Math.exp(e))-1/e)/2}function _w(e){return((e=Math.exp(2*e))-1)/(e+1)}const vn=(function e(t,n,r){function i(o,a){var s=o[0],c=o[1],u=o[2],l=a[0],f=a[1],d=a[2],h=l-s,g=f-c,m=h*h+g*g,v,y;if(m<mw)y=Math.log(d/u)/t,v=function(E){return[s+E*h,c+E*g,u*Math.exp(t*E*y)]};else{var b=Math.sqrt(m),p=(d*d-u*u+r*m)/(2*u*n*b),_=(d*d-u*u-r*m)/(2*d*n*b),x=Math.log(Math.sqrt(p*p+1)-p),w=Math.log(Math.sqrt(_*_+1)-_);y=(w-x)/t,v=function(E){var R=E*y,C=nl(x),T=u/(n*b)*(C*_w(t*R+x)-yw(x));return[s+T*h,c+T*g,u*C/nl(t*R+x)]}}return v.duration=y*1e3*t/Math.SQRT2,v}return i.rho=function(o){var a=Math.max(.001,+o),s=a*a,c=s*s;return e(a,s,c)},i})(Math.SQRT2,2,4);var vt=0,Nt=0,Rt=0,$v=1e3,Sn,At,Cn=0,nt=0,On=0,zt=typeof performance=="object"&&performance.now?performance:Date,Hv=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oc(){return nt||(Hv(bw),nt=zt.now()+On)}function bw(){nt=0}function qn(){this._call=this._time=this._next=null}qn.prototype=Bv.prototype={constructor:qn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?oc():+n)+(t==null?0:+t),!this._next&&At!==this&&(At?At._next=this:Sn=this,At=this),this._call=e,this._time=n,Uu()},stop:function(){this._call&&(this._call=null,this._time=1/0,Uu())}};function Bv(e,t,n){var r=new qn;return r.restart(e,t,n),r}function ww(){oc(),++vt;for(var e=Sn,t;e;)(t=nt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--vt}function rl(){nt=(Cn=zt.now())+On,vt=Nt=0;try{ww()}finally{vt=0,Ew(),nt=0}}function xw(){var e=zt.now(),t=e-Cn;t>$v&&(On-=t,Cn=e)}function Ew(){for(var e,t=Sn,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Sn=n);At=e,Uu(r)}function Uu(e){if(!vt){Nt&&(Nt=clearTimeout(Nt));var t=e-nt;t>24?(e<1/0&&(Nt=setTimeout(rl,e-zt.now()-On)),Rt&&(Rt=clearInterval(Rt))):(Rt||(Cn=zt.now(),Rt=setInterval(xw,$v)),vt=1,Hv(rl))}}function il(e,t,n){var r=new qn;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Sw=Pn("start","end","cancel","interrupt"),Cw=[],jv=0,ol=1,Yu=2,mn=3,al=4,Wu=5,yn=6;function Ln(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;qw(e,n,{name:t,index:r,group:i,on:Sw,tween:Cw,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:jv})}function ac(e,t){var n=Se(e,t);if(n.state>jv)throw new Error("too late; already scheduled");return n}function Me(e,t){var n=Se(e,t);if(n.state>mn)throw new Error("too late; already running");return n}function Se(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function qw(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Bv(o,0,n.time);function o(u){n.state=ol,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var l,f,d,h;if(n.state!==ol)return c();for(l in r)if(h=r[l],h.name===n.name){if(h.state===mn)return il(a);h.state===al?(h.state=yn,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[l]):+l<t&&(h.state=yn,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[l])}if(il(function(){n.state===mn&&(n.state=al,n.timer.restart(s,n.delay,n.time),s(u))}),n.state=Yu,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Yu){for(n.state=mn,i=new Array(d=n.tween.length),l=0,f=-1;l<d;++l)(h=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function s(u){for(var l=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Wu,1),f=-1,d=i.length;++f<d;)i[f].call(e,l);n.state===Wu&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=yn,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function _n(e,t){var n=e.__transition,r,i,o=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){o=!1;continue}i=r.state>Yu&&r.state<Wu,r.state=yn,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}o&&delete e.__transition}}function Rw(e){return this.each(function(){_n(this,e)})}function Iw(e,t){var n,r;return function(){var i=Me(this,e),o=i.tween;if(o!==n){r=n=o;for(var a=0,s=r.length;a<s;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function Nw(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=Me(this,e),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:t,value:n},c=0,u=i.length;c<u;++c)if(i[c].name===t){i[c]=s;break}c===u&&i.push(s)}o.tween=i}}function Aw(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Se(this.node(),n).tween,i=0,o=r.length,a;i<o;++i)if((a=r[i]).name===e)return a.value;return null}return this.each((t==null?Iw:Nw)(n,e,t))}function sc(e,t,n){var r=e._id;return e.each(function(){var i=Me(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Se(i,r).value[t]}}function Vv(e,t){var n;return(typeof t=="number"?Ie:t instanceof tt?En:(n=tt(t))?(t=n,En):Dv)(e,t)}function Mw(e){return function(){this.removeAttribute(e)}}function Tw(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Pw(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=t(r=a,n)}}function kw(e,t,n){var r,i=n+"",o;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=t(r=a,n)}}function Ow(e,t,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s)))}}function Lw(e,t,n){var r,i,o;return function(){var a,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=s+"",a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s)))}}function Dw(e,t){var n=kn(e),r=n==="transform"?vw:Vv;return this.attrTween(e,typeof t=="function"?(n.local?Lw:Ow)(n,r,sc(this,"attr."+e,t)):t==null?(n.local?Tw:Mw)(n):(n.local?kw:Pw)(n,r,t))}function Fw(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function zw(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function $w(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&zw(e,o)),n}return i._value=t,i}function Hw(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Fw(e,o)),n}return i._value=t,i}function Bw(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 r=kn(e);return this.tween(n,(r.local?$w:Hw)(r,t))}function jw(e,t){return function(){ac(this,e).delay=+t.apply(this,arguments)}}function Vw(e,t){return t=+t,function(){ac(this,e).delay=t}}function Gw(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jw:Vw)(t,e)):Se(this.node(),t).delay}function Uw(e,t){return function(){Me(this,e).duration=+t.apply(this,arguments)}}function Yw(e,t){return t=+t,function(){Me(this,e).duration=t}}function Ww(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Uw:Yw)(t,e)):Se(this.node(),t).duration}function Xw(e,t){if(typeof t!="function")throw new Error;return function(){Me(this,e).ease=t}}function Kw(e){var t=this._id;return arguments.length?this.each(Xw(t,e)):Se(this.node(),t).ease}function Zw(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Me(this,e).ease=n}}function Qw(e){if(typeof e!="function")throw new Error;return this.each(Zw(this._id,e))}function Jw(e){typeof e!="function"&&(e=wv(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],c,u=0;u<a;++u)(c=o[u])&&e.call(c,c.__data__,u,o)&&s.push(c);return new ze(r,this._parents,this._name,this._id)}function ex(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var c=t[s],u=n[s],l=c.length,f=a[s]=new Array(l),d,h=0;h<l;++h)(d=c[h]||u[h])&&(f[h]=d);for(;s<r;++s)a[s]=t[s];return new ze(a,this._parents,this._name,this._id)}function tx(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 nx(e,t,n){var r,i,o=tx(t)?ac:Me;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function rx(e,t){var n=this._id;return arguments.length<2?Se(this.node(),n).on.on(e):this.each(nx(n,e,t))}function ix(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ox(){return this.on("end.remove",ix(this._id))}function ax(e){var t=this._name,n=this._id;typeof e!="function"&&(e=tc(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s=r[a],c=s.length,u=o[a]=new Array(c),l,f,d=0;d<c;++d)(l=s[d])&&(f=e.call(l,l.__data__,d,s))&&("__data__"in l&&(f.__data__=l.__data__),u[d]=f,Ln(u[d],t,n,d,u,Se(l,n)));return new ze(o,this._parents,t,n)}function sx(e){var t=this._name,n=this._id;typeof e!="function"&&(e=bv(e));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var c=r[s],u=c.length,l,f=0;f<u;++f)if(l=c[f]){for(var d=e.call(l,l.__data__,f,c),h,g=Se(l,n),m=0,v=d.length;m<v;++m)(h=d[m])&&Ln(h,t,n,m,d,g);o.push(d),a.push(l)}return new ze(o,a,t,n)}var ux=Gt.prototype.constructor;function cx(){return new ux(this._groups,this._parents)}function lx(e,t){var n,r,i;return function(){var o=gt(this,e),a=(this.style.removeProperty(e),gt(this,e));return o===a?null:o===n&&a===r?i:i=t(n=o,r=a)}}function Gv(e){return function(){this.style.removeProperty(e)}}function fx(e,t,n){var r,i=n+"",o;return function(){var a=gt(this,e);return a===i?null:a===r?o:o=t(r=a,n)}}function dx(e,t,n){var r,i,o;return function(){var a=gt(this,e),s=n(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(e),gt(this,e))),a===c?null:a===r&&c===i?o:(i=c,o=t(r=a,s))}}function hx(e,t){var n,r,i,o="style."+t,a="end."+o,s;return function(){var c=Me(this,e),u=c.on,l=c.value[o]==null?s||(s=Gv(t)):void 0;(u!==n||i!==l)&&(r=(n=u).copy()).on(a,i=l),c.on=r}}function px(e,t,n){var r=(e+="")=="transform"?gw:Vv;return t==null?this.styleTween(e,lx(e,r)).on("end.style."+e,Gv(e)):typeof t=="function"?this.styleTween(e,dx(e,r,sc(this,"style."+e,t))).each(hx(this._id,e)):this.styleTween(e,fx(e,r,t),n).on("end.style."+e,null)}function gx(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function vx(e,t,n){var r,i;function o(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&gx(e,a,n)),r}return o._value=t,o}function mx(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,vx(e,t,n??""))}function yx(e){return function(){this.textContent=e}}function _x(e){return function(){var t=e(this);this.textContent=t??""}}function bx(e){return this.tween("text",typeof e=="function"?_x(sc(this,"text",e)):yx(e==null?"":e+""))}function wx(e){return function(t){this.textContent=e.call(this,t)}}function xx(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&wx(i)),t}return r._value=e,r}function Ex(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,xx(e))}function Sx(){for(var e=this._name,t=this._id,n=Uv(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,u=0;u<s;++u)if(c=a[u]){var l=Se(c,t);Ln(c,e,n,u,a,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new ze(r,this._parents,e,n)}function Cx(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},c={value:function(){--i===0&&o()}};n.each(function(){var u=Me(this,r),l=u.on;l!==e&&(t=(e=l).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),u.on=t}),i===0&&o()})}var qx=0;function ze(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Uv(){return++qx}var De=Gt.prototype;ze.prototype={constructor:ze,select:ax,selectAll:sx,selectChild:De.selectChild,selectChildren:De.selectChildren,filter:Jw,merge:ex,selection:cx,transition:Sx,call:De.call,nodes:De.nodes,node:De.node,size:De.size,empty:De.empty,each:De.each,on:rx,attr:Dw,attrTween:Bw,style:px,styleTween:mx,text:bx,textTween:Ex,remove:ox,tween:Aw,delay:Gw,duration:Ww,ease:Kw,easeVarying:Qw,end:Cx,[Symbol.iterator]:De[Symbol.iterator]};function Rx(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ix={time:null,delay:0,duration:250,ease:Rx};function Nx(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 Ax(e){var t,n;e instanceof ze?(t=e._id,e=e._name):(t=Uv(),(n=Ix).time=oc(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,c,u=0;u<s;++u)(c=a[u])&&Ln(c,e,t,u,a,n||Nx(c,t));return new ze(r,this._parents,e,t)}Gt.prototype.interrupt=Rw;Gt.prototype.transition=Ax;const ln=e=>()=>e;function Mx(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:r,enumerable:!0,configurable:!0},_:{value:i}})}function Fe(e,t,n){this.k=e,this.x=t,this.y=n}Fe.prototype={constructor:Fe,scale:function(e){return e===1?this:new Fe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Fe(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 Dn=new Fe(1,0,0);Yv.prototype=Fe.prototype;function Yv(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Dn;return e.__zoom}function hr(e){e.stopImmediatePropagation()}function It(e){e.preventDefault(),e.stopImmediatePropagation()}function Tx(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Px(){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 sl(){return this.__zoom||Dn}function kx(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ox(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lx(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function Wv(){var e=Tx,t=Px,n=Lx,r=kx,i=Ox,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,c=vn,u=Pn("start","zoom","end"),l,f,d,h=500,g=150,m=0,v=10;function y(S){S.property("__zoom",sl).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",T).filter(i).on("touchstart.zoom",q).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(S,A,N,L){var P=S.selection?S.selection():S;P.property("__zoom",sl),S!==P?x(S,A,N,L):P.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},y.scaleBy=function(S,A,N,L){y.scaleTo(S,function(){var P=this.__zoom.k,D=typeof A=="function"?A.apply(this,arguments):A;return P*D},N,L)},y.scaleTo=function(S,A,N,L){y.transform(S,function(){var P=t.apply(this,arguments),D=this.__zoom,j=N==null?_(P):typeof N=="function"?N.apply(this,arguments):N,G=D.invert(j),V=typeof A=="function"?A.apply(this,arguments):A;return n(p(b(D,V),j,G),P,a)},N,L)},y.translateBy=function(S,A,N,L){y.transform(S,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),a)},null,L)},y.translateTo=function(S,A,N,L,P){y.transform(S,function(){var D=t.apply(this,arguments),j=this.__zoom,G=L==null?_(D):typeof L=="function"?L.apply(this,arguments):L;return n(Dn.translate(G[0],G[1]).scale(j.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof N=="function"?-N.apply(this,arguments):-N),D,a)},L,P)};function b(S,A){return A=Math.max(o[0],Math.min(o[1],A)),A===S.k?S:new Fe(A,S.x,S.y)}function p(S,A,N){var L=A[0]-N[0]*S.k,P=A[1]-N[1]*S.k;return L===S.x&&P===S.y?S:new Fe(S.k,L,P)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function x(S,A,N,L){S.on("start.zoom",function(){w(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(L).end()}).tween("zoom",function(){var P=this,D=arguments,j=w(P,D).event(L),G=t.apply(P,D),V=N==null?_(G):typeof N=="function"?N.apply(P,D):N,Y=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),I=P.__zoom,O=typeof A=="function"?A.apply(P,D):A,z=c(I.invert(V).concat(Y/I.k),O.invert(V).concat(Y/O.k));return function(H){if(H===1)H=O;else{var B=z(H),U=Y/B[2];H=new Fe(U,V[0]-B[0]*U,V[1]-B[1]*U)}j.zoom(null,H)}})}function w(S,A,N){return!N&&S.__zooming||new E(S,A)}function E(S,A){this.that=S,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,A),this.taps=0}E.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,A){return this.mouse&&S!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var A=ge(this.that).datum();u.call(S,this.that,new Mx(S,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),A)}};function R(S,...A){if(!e.apply(this,arguments))return;var N=w(this,A).event(S),L=this.__zoom,P=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),D=_e(S);if(N.wheel)(N.mouse[0][0]!==D[0]||N.mouse[0][1]!==D[1])&&(N.mouse[1]=L.invert(N.mouse[0]=D)),clearTimeout(N.wheel);else{if(L.k===P)return;N.mouse=[D,L.invert(D)],_n(this),N.start()}It(S),N.wheel=setTimeout(j,g),N.zoom("mouse",n(p(b(L,P),N.mouse[0],N.mouse[1]),N.extent,a));function j(){N.wheel=null,N.end()}}function C(S,...A){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,L=w(this,A,!0).event(S),P=ge(S.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",Y,!0),D=_e(S,N),j=S.clientX,G=S.clientY;Mv(S.view),hr(S),L.mouse=[D,this.__zoom.invert(D)],_n(this),L.start();function V(I){if(It(I),!L.moved){var O=I.clientX-j,z=I.clientY-G;L.moved=O*O+z*z>m}L.event(I).zoom("mouse",n(p(L.that.__zoom,L.mouse[0]=_e(I,N),L.mouse[1]),L.extent,a))}function Y(I){P.on("mousemove.zoom mouseup.zoom",null),Tv(I.view,L.moved),It(I),L.event(I).end()}}function T(S,...A){if(e.apply(this,arguments)){var N=this.__zoom,L=_e(S.changedTouches?S.changedTouches[0]:S,this),P=N.invert(L),D=N.k*(S.shiftKey?.5:2),j=n(p(b(N,D),L,P),t.apply(this,A),a);It(S),s>0?ge(this).transition().duration(s).call(x,j,L,S):ge(this).call(y.transform,j,L,S)}}function q(S,...A){if(e.apply(this,arguments)){var N=S.touches,L=N.length,P=w(this,A,S.changedTouches.length===L).event(S),D,j,G,V;for(hr(S),j=0;j<L;++j)G=N[j],V=_e(G,this),V=[V,this.__zoom.invert(V),G.identifier],P.touch0?!P.touch1&&P.touch0[2]!==V[2]&&(P.touch1=V,P.taps=0):(P.touch0=V,D=!0,P.taps=1+!!l);l&&(l=clearTimeout(l)),D&&(P.taps<2&&(f=V[0],l=setTimeout(function(){l=null},h)),_n(this),P.start())}}function M(S,...A){if(this.__zooming){var N=w(this,A).event(S),L=S.changedTouches,P=L.length,D,j,G,V;for(It(S),D=0;D<P;++D)j=L[D],G=_e(j,this),N.touch0&&N.touch0[2]===j.identifier?N.touch0[0]=G:N.touch1&&N.touch1[2]===j.identifier&&(N.touch1[0]=G);if(j=N.that.__zoom,N.touch1){var Y=N.touch0[0],I=N.touch0[1],O=N.touch1[0],z=N.touch1[1],H=(H=O[0]-Y[0])*H+(H=O[1]-Y[1])*H,B=(B=z[0]-I[0])*B+(B=z[1]-I[1])*B;j=b(j,Math.sqrt(H/B)),G=[(Y[0]+O[0])/2,(Y[1]+O[1])/2],V=[(I[0]+z[0])/2,(I[1]+z[1])/2]}else if(N.touch0)G=N.touch0[0],V=N.touch0[1];else return;N.zoom("touch",n(p(j,G,V),N.extent,a))}}function k(S,...A){if(this.__zooming){var N=w(this,A).event(S),L=S.changedTouches,P=L.length,D,j;for(hr(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),D=0;D<P;++D)j=L[D],N.touch0&&N.touch0[2]===j.identifier?delete N.touch0:N.touch1&&N.touch1[2]===j.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(j=_e(j,this),Math.hypot(f[0]-j[0],f[1]-j[1])<v)){var G=ge(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return y.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:ln(+S),y):r},y.filter=function(S){return arguments.length?(e=typeof S=="function"?S:ln(!!S),y):e},y.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:ln(!!S),y):i},y.extent=function(S){return arguments.length?(t=typeof S=="function"?S:ln([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),y):t},y.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],y):[o[0],o[1]]},y.translateExtent=function(S){return arguments.length?(a[0][0]=+S[0][0],a[1][0]=+S[1][0],a[0][1]=+S[0][1],a[1][1]=+S[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(S){return arguments.length?(n=S,y):n},y.duration=function(S){return arguments.length?(s=+S,y):s},y.interpolate=function(S){return arguments.length?(c=S,y):c},y.on=function(){var S=u.on.apply(u,arguments);return S===u?y:S},y.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,y):Math.sqrt(m)},y.tapDistance=function(S){return arguments.length?(v=+S,y):v},y}const Ae={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:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", 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."},$t=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Xv=["Enter"," ","Escape"],Kv={"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 mt;(function(e){e.Strict="strict",e.Loose="loose"})(mt||(mt={}));var et;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(et||(et={}));var Ht;(function(e){e.Partial="partial",e.Full="full"})(Ht||(Ht={}));const Zv={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var We;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(We||(We={}));var Rn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Rn||(Rn={}));var Z;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Z||(Z={}));const ul={[Z.Left]:Z.Right,[Z.Right]:Z.Left,[Z.Top]:Z.Bottom,[Z.Bottom]:Z.Top};function Qv(e){return e===null?null:e?"valid":"invalid"}const Jv=e=>"id"in e&&"source"in e&&"target"in e,Dx=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),uc=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Yt=(e,t=[0,0])=>{const{width:n,height:r}=$e(e),i=e.origin??t,o=n*i[0],a=r*i[1];return{x:e.position.x-o,y:e.position.y-a}},Fx=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const o=typeof i=="string";let a=!t.nodeLookup&&!o?i:void 0;t.nodeLookup&&(a=o?t.nodeLookup.get(i):uc(i)?i:t.nodeLookup.get(i.id));const s=a?In(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Fn(r,s)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return zn(n)},Wt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=Fn(n,In(i)),r=!0)}),r?zn(n):{x:0,y:0,width:0,height:0}},cc=(e,t,[n,r,i]=[0,0,1],o=!1,a=!1)=>{const s={...Kt(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(const u of e.values()){const{measured:l,selectable:f=!0,hidden:d=!1}=u;if(a&&!f||d)continue;const h=l.width??u.width??u.initialWidth??null,g=l.height??u.height??u.initialHeight??null,m=Bt(s,_t(u)),v=(h??0)*(g??0),y=o&&m>0;(!u.internals.handleBounds||y||m>=v||u.dragging)&&c.push(u)}return c},zx=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function $x(e,t){const n=new Map,r=t?.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&(t?.includeHiddenNodes||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function Hx({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:o},a){if(e.size===0)return Promise.resolve(!0);const s=$x(e,a),c=Wt(s),u=lc(c,t,n,a?.minZoom??i,a?.maxZoom??o,a?.padding??.1);return await r.setViewport(u,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)}function em({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:o}){const a=n.get(e),s=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=s?s.internals.positionAbsolute:{x:0,y:0},l=a.origin??r;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!s)o?.("005",Ae.error005());else{const h=s.measured.width,g=s.measured.height;h&&g&&(f=[[c,u],[c+h,u+g]])}else s&&bt(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const d=bt(f)?rt(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&o?.("015",Ae.error015()),{position:{x:d.x-c+(a.measured.width??0)*l[0],y:d.y-u+(a.measured.height??0)*l[1]},positionAbsolute:d}}async function Bx({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const o=new Set(e.map(d=>d.id)),a=[];for(const d of n){if(d.deletable===!1)continue;const h=o.has(d.id),g=!h&&d.parentId&&a.find(m=>m.id===d.parentId);(h||g)&&a.push(d)}const s=new Set(t.map(d=>d.id)),c=r.filter(d=>d.deletable!==!1),l=zx(a,c);for(const d of c)s.has(d.id)&&!l.find(g=>g.id===d.id)&&l.push(d);if(!i)return{edges:l,nodes:a};const f=await i({nodes:a,edges:l});return typeof f=="boolean"?f?{edges:l,nodes:a}:{edges:[],nodes:[]}:f}const yt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),rt=(e={x:0,y:0},t,n)=>({x:yt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:yt(e.y,t[0][1],t[1][1]-(n?.height??0))});function tm(e,t,n){const{width:r,height:i}=$e(n),{x:o,y:a}=n.internals.positionAbsolute;return rt(e,[[o,a],[o+r,a+i]],t)}const cl=(e,t,n)=>e<t?yt(Math.abs(e-t),1,t)/t:e>n?-yt(Math.abs(e-n),1,t)/t:0,nm=(e,t,n=15,r=40)=>{const i=cl(e.x,r,t.width-r)*n,o=cl(e.y,r,t.height-r)*n;return[i,o]},Fn=(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)}),Xu=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),zn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),_t=(e,t=[0,0])=>{const{x:n,y:r}=uc(e)?e.internals.positionAbsolute:Yt(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},In=(e,t=[0,0])=>{const{x:n,y:r}=uc(e)?e.internals.positionAbsolute:Yt(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},rm=(e,t)=>zn(Fn(Xu(e),Xu(t))),Bt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},ll=e=>we(e.width)&&we(e.height)&&we(e.x)&&we(e.y),we=e=>!isNaN(e)&&isFinite(e),jx=(e,t)=>{},Xt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Kt=({x:e,y:t},[n,r,i],o=!1,a=[1,1])=>{const s={x:(e-n)/i,y:(t-r)/i};return o?Xt(s,a):s},Nn=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function lt(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}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Vx(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=lt(e,n),i=lt(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=lt(e.top??e.y??0,n),i=lt(e.bottom??e.y??0,n),o=lt(e.left??e.x??0,t),a=lt(e.right??e.x??0,t);return{top:r,right:a,bottom:i,left:o,x:o+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Gx(e,t,n,r,i,o){const{x:a,y:s}=Nn(e,[t,n,r]),{x:c,y:u}=Nn({x:e.x+e.width,y:e.y+e.height},[t,n,r]),l=i-c,f=o-u;return{left:Math.floor(a),top:Math.floor(s),right:Math.floor(l),bottom:Math.floor(f)}}const lc=(e,t,n,r,i,o)=>{const a=Vx(o,t,n),s=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(s,c),l=yt(u,r,i),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*l,g=n/2-d*l,m=Gx(e,h,g,l,t,n),v={left:Math.min(m.left-a.left,0),top:Math.min(m.top-a.top,0),right:Math.min(m.right-a.right,0),bottom:Math.min(m.bottom-a.bottom,0)};return{x:h-v.left+v.right,y:g-v.top+v.bottom,zoom:l}},jt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function bt(e){return e!=null&&e!=="parent"}function $e(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function im(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function om(e,t={width:0,height:0},n,r,i){const o={...e},a=r.get(n);if(a){const s=a.origin||i;o.x+=a.internals.positionAbsolute.x-(t.width??0)*s[0],o.y+=a.internals.positionAbsolute.y-(t.height??0)*s[1]}return o}function fl(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ux(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function Yx(e){return{...Kv,...e||{}}}function Ot(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:o,y:a}=xe(e),s=Kt({x:o-(i?.left??0),y:a-(i?.top??0)},r),{x:c,y:u}=n?Xt(s,t):s;return{xSnapped:c,ySnapped:u,...s}}const fc=e=>({width:e.offsetWidth,height:e.offsetHeight}),am=e=>e?.getRootNode?.()||window?.document,Wx=["INPUT","SELECT","TEXTAREA"];function sm(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Wx.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const um=e=>"clientX"in e,xe=(e,t)=>{const n=um(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},dl=(e,t,n,r,i)=>{const o=t.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(a=>{const s=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(s.left-n.left)/r,y:(s.top-n.top)/r,...fc(a)}})};function cm({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:o,targetControlX:a,targetControlY:s}){const c=e*.125+i*.375+a*.375+n*.125,u=t*.125+o*.375+s*.375+r*.125,l=Math.abs(c-e),f=Math.abs(u-t);return[c,u,l,f]}function fn(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function hl({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case Z.Left:return[t-fn(t-r,o),n];case Z.Right:return[t+fn(r-t,o),n];case Z.Top:return[t,n-fn(n-i,o)];case Z.Bottom:return[t,n+fn(i-n,o)]}}function lm({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:r,targetY:i,targetPosition:o=Z.Top,curvature:a=.25}){const[s,c]=hl({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,l]=hl({pos:o,x1:r,y1:i,x2:e,y2:t,c:a}),[f,d,h,g]=cm({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:u,targetControlY:l});return[`M${e},${t} C${s},${c} ${u},${l} ${r},${i}`,f,d,h,g]}function fm({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n<e?n+i:n-i,a=Math.abs(r-t)/2,s=r<t?r+a:r-a;return[o,s,i,a]}function Xx({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:o="basic"}){if(o==="manual")return r;const a=i&&n?r+1e3:r,s=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return a+s}function Kx({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const o=Fn(In(e),In(t));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const a={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return Bt(a,zn(o))>0}const Zx=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Qx=(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)),Jx=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||Zx;let i;return Jv(e)?i={...e}:i={...e,id:r(e)},Qx(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function dm({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,a,s]=fm({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,a,s]}const pl={[Z.Left]:{x:-1,y:0},[Z.Right]:{x:1,y:0},[Z.Top]:{x:0,y:-1},[Z.Bottom]:{x:0,y:1}},e1=({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},gl=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function t1({source:e,sourcePosition:t=Z.Bottom,target:n,targetPosition:r=Z.Top,center:i,offset:o,stepPosition:a}){const s=pl[t],c=pl[r],u={x:e.x+s.x*o,y:e.y+s.y*o},l={x:n.x+c.x*o,y:n.y+c.y*o},f=e1({source:u,sourcePosition:t,target:l}),d=f.x!==0?"x":"y",h=f[d];let g=[],m,v;const y={x:0,y:0},b={x:0,y:0},[,,p,_]=fm({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*c[d]===-1){d==="x"?(m=i.x??u.x+(l.x-u.x)*a,v=i.y??(u.y+l.y)/2):(m=i.x??(u.x+l.x)/2,v=i.y??u.y+(l.y-u.y)*a);const w=[{x:m,y:u.y},{x:m,y:l.y}],E=[{x:u.x,y:v},{x:l.x,y:v}];s[d]===h?g=d==="x"?w:E:g=d==="x"?E:w}else{const w=[{x:u.x,y:l.y}],E=[{x:l.x,y:u.y}];if(d==="x"?g=s.x===h?E:w:g=s.y===h?w:E,t===r){const M=Math.abs(e[d]-n[d]);if(M<=o){const k=Math.min(o-1,o-M);s[d]===h?y[d]=(u[d]>e[d]?-1:1)*k:b[d]=(l[d]>n[d]?-1:1)*k}}if(t!==r){const M=d==="x"?"y":"x",k=s[d]===c[M],S=u[M]>l[M],A=u[M]<l[M];(s[d]===1&&(!k&&S||k&&A)||s[d]!==1&&(!k&&A||k&&S))&&(g=d==="x"?w:E)}const R={x:u.x+y.x,y:u.y+y.y},C={x:l.x+b.x,y:l.y+b.y},T=Math.max(Math.abs(R.x-g[0].x),Math.abs(C.x-g[0].x)),q=Math.max(Math.abs(R.y-g[0].y),Math.abs(C.y-g[0].y));T>=q?(m=(R.x+C.x)/2,v=g[0].y):(m=g[0].x,v=(R.y+C.y)/2)}return[[e,{x:u.x+y.x,y:u.y+y.y},...g,{x:l.x+b.x,y:l.y+b.y},n],m,v,p,_]}function n1(e,t,n,r){const i=Math.min(gl(e,t)/2,gl(t,n)/2,r),{x:o,y:a}=t;if(e.x===o&&o===n.x||e.y===a&&a===n.y)return`L${o} ${a}`;if(e.y===a){const u=e.x<n.x?-1:1,l=e.y<n.y?1:-1;return`L ${o+i*u},${a}Q ${o},${a} ${o},${a+i*l}`}const s=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${o},${a+i*c}Q ${o},${a} ${o+i*s},${a}`}function Ku({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:r,targetY:i,targetPosition:o=Z.Top,borderRadius:a=5,centerX:s,centerY:c,offset:u=20,stepPosition:l=.5}){const[f,d,h,g,m]=t1({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:o,center:{x:s,y:c},offset:u,stepPosition:l});return[f.reduce((y,b,p)=>{let _="";return p>0&&p<f.length-1?_=n1(f[p-1],b,f[p+1],a):_=`${p===0?"M":"L"}${b.x} ${b.y}`,y+=_,y},""),d,h,g,m]}function vl(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function r1(e){const{sourceNode:t,targetNode:n}=e;if(!vl(t)||!vl(n))return null;const r=t.internals.handleBounds||ml(t.handles),i=n.internals.handleBounds||ml(n.handles),o=yl(r?.source??[],e.sourceHandle),a=yl(e.connectionMode===mt.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!o||!a)return e.onError?.("008",Ae.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=o?.position||Z.Bottom,c=a?.position||Z.Top,u=it(t,o,s),l=it(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:l.x,targetY:l.y,sourcePosition:s,targetPosition:c}}function ml(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function it(e,t,n=Z.Left,r=!1){const i=(t?.x??0)+e.internals.positionAbsolute.x,o=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:s}=t??$e(e);if(r)return{x:i+a/2,y:o+s/2};switch(t?.position??n){case Z.Top:return{x:i+a/2,y:o};case Z.Right:return{x:i+a,y:o+s/2};case Z.Bottom:return{x:i+a/2,y:o+s};case Z.Left:return{x:i,y:o+s/2}}}function yl(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Zu(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function i1(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const o=new Set;return e.reduce((a,s)=>([s.markerStart||r,s.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const u=Zu(c,t);o.has(u)||(a.push({id:u,color:c.color||n,...c}),o.add(u))}}),a),[]).sort((a,s)=>a.id.localeCompare(s.id))}const hm=1e3,o1=10,dc={nodeOrigin:[0,0],nodeExtent:$t,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},a1={...dc,checkEquality:!0};function hc(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function s1(e,t,n){const r=hc(dc,n);for(const i of e.values())if(i.parentId)gc(i,e,t,r);else{const o=Yt(i,r.nodeOrigin),a=bt(i.extent)?i.extent:r.nodeExtent,s=rt(o,a,$e(i));i.internals.positionAbsolute=s}}function u1(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],r=[];for(const i of e.handles){const o={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(o):i.type==="target"&&r.push(o)}return{source:n,target:r}}function pc(e){return e==="manual"}function Qu(e,t,n,r={}){const i=hc(a1,r),o={i:0},a=new Map(t),s=i?.elevateNodesOnSelect&&!pc(i.zIndexMode)?hm:0;let c=e.length>0;t.clear(),n.clear();for(const u of e){let l=a.get(u.id);if(i.checkEquality&&u===l?.internals.userNode)t.set(u.id,l);else{const f=Yt(u,i.nodeOrigin),d=bt(u.extent)?u.extent:i.nodeExtent,h=rt(f,d,$e(u));l={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:h,handleBounds:u1(u,l),z:pm(u,s,i.zIndexMode),userNode:u}},t.set(u.id,l)}(l.measured===void 0||l.measured.width===void 0||l.measured.height===void 0)&&!l.hidden&&(c=!1),u.parentId&&gc(l,t,n,r,o)}return c}function c1(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 gc(e,t,n,r,i){const{elevateNodesOnSelect:o,nodeOrigin:a,nodeExtent:s,zIndexMode:c}=hc(dc,r),u=e.parentId,l=t.get(u);if(!l){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}c1(e,n),i&&!l.parentId&&l.internals.rootParentIndex===void 0&&c==="auto"&&(l.internals.rootParentIndex=++i.i,l.internals.z=l.internals.z+i.i*o1),i&&l.internals.rootParentIndex!==void 0&&(i.i=l.internals.rootParentIndex);const f=o&&!pc(c)?hm:0,{x:d,y:h,z:g}=l1(e,l,a,s,f,c),{positionAbsolute:m}=e.internals,v=d!==m.x||h!==m.y;(v||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:d,y:h}:m,z:g}})}function pm(e,t,n){const r=we(e.zIndex)?e.zIndex:0;return pc(n)?r:r+(e.selected?t:0)}function l1(e,t,n,r,i,o){const{x:a,y:s}=t.internals.positionAbsolute,c=$e(e),u=Yt(e,n),l=bt(e.extent)?rt(u,e.extent,c):u;let f=rt({x:a+l.x,y:s+l.y},r,c);e.extent==="parent"&&(f=tm(f,c,t));const d=pm(e,i,o),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function vc(e,t,n,r=[0,0]){const i=[],o=new Map;for(const a of e){const s=t.get(a.parentId);if(!s)continue;const c=o.get(a.parentId)?.expandedRect??_t(s),u=rm(c,a.rect);o.set(a.parentId,{expandedRect:u,parent:s})}return o.size>0&&o.forEach(({expandedRect:a,parent:s},c)=>{const u=s.internals.positionAbsolute,l=$e(s),f=s.origin??r,d=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,h=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,g=Math.max(l.width,Math.round(a.width)),m=Math.max(l.height,Math.round(a.height)),v=(g-l.width)*f[0],y=(m-l.height)*f[1];(d>0||h>0||v||y)&&(i.push({id:c,type:"position",position:{x:s.position.x-d+v,y:s.position.y-h+y}}),n.get(c)?.forEach(b=>{e.some(p=>p.id===b.id)||i.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+h}})})),(l.width<a.width||l.height<a.height||d||h)&&i.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(d?f[0]*d-v:0),height:m+(h?f[1]*h-y:0)}})}),i}function f1(e,t,n,r,i,o,a){const s=r?.querySelector(".xyflow__viewport");let c=!1;if(!s)return{changes:[],updatedInternals:c};const u=[],l=window.getComputedStyle(s),{m22:f}=new window.DOMMatrixReadOnly(l.transform),d=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const m=fc(h.nodeElement),v=g.measured.width!==m.width||g.measured.height!==m.height;if(!!(m.width&&m.height&&(v||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=bt(g.extent)?g.extent:o;let{positionAbsolute:_}=g.internals;g.parentId&&g.extent==="parent"?_=tm(_,m,t.get(g.parentId)):p&&(_=rt(_,p,m));const x={...g,measured:m,internals:{...g.internals,positionAbsolute:_,handleBounds:{source:dl("source",h.nodeElement,b,f,g.id),target:dl("target",h.nodeElement,b,f,g.id)}}};t.set(g.id,x),g.parentId&&gc(x,t,n,{nodeOrigin:i,zIndexMode:a}),c=!0,v&&(u.push({id:g.id,type:"dimensions",dimensions:m}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:_t(x,i)}))}}if(d.length>0){const h=vc(d,t,n,i);u.push(...h)}return{changes:u,updatedInternals:c}}async function d1({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:o}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,o]],r),s=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(s)}function _l(e,t,n,r,i,o){let a=i;const s=r.get(a)||new Map;r.set(a,s.set(n,t)),a=`${i}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),o){a=`${i}-${e}-${o}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function gm(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:o,sourceHandle:a=null,targetHandle:s=null}=r,c={edgeId:r.id,source:i,target:o,sourceHandle:a,targetHandle:s},u=`${i}-${a}--${o}-${s}`,l=`${o}-${s}--${i}-${a}`;_l("source",c,l,e,i,a),_l("target",c,u,e,o,s),t.set(r.id,r)}}function vm(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:vm(n,t):!1}function bl(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function h1(e,t,n,r){const i=new Map;for(const[o,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!vm(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const s=e.get(o);s&&i.set(o,{id:o,position:s.position||{x:0,y:0},distance:{x:n.x-s.internals.positionAbsolute.x,y:n.y-s.internals.positionAbsolute.y},extent:s.extent,parentId:s.parentId,origin:s.origin,expandParent:s.expandParent,internals:{positionAbsolute:s.internals.positionAbsolute||{x:0,y:0}},measured:{width:s.measured.width??0,height:s.measured.height??0}})}return i}function pr({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const i=[];for(const[a,s]of t){const c=n.get(a)?.internals.userNode;c&&i.push({...c,position:s.position,dragging:r})}if(!e)return[i[0],i];const o=n.get(e)?.internals.userNode;return[o?{...o,position:t.get(e)?.position||o.position,dragging:r}:i[0],i]}function p1({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const o={x:n-i.distance.x,y:r-i.distance.y},a=Xt(o,t);return{x:a.x-o.x,y:a.y-o.y}}function g1({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let o={x:null,y:null},a=0,s=new Map,c=!1,u={x:0,y:0},l=null,f=!1,d=null,h=!1,g=!1,m=null;function v({noDragClassName:b,handleSelector:p,domNode:_,isSelectable:x,nodeId:w,nodeClickDistance:E=0}){d=ge(_);function R({x:M,y:k}){const{nodeLookup:S,nodeExtent:A,snapGrid:N,snapToGrid:L,nodeOrigin:P,onNodeDrag:D,onSelectionDrag:j,onError:G,updateNodePositions:V}=t();o={x:M,y:k};let Y=!1;const I=s.size>1,O=I&&A?Xu(Wt(s)):null,z=I&&L?p1({dragItems:s,snapGrid:N,x:M,y:k}):null;for(const[H,B]of s){if(!S.has(H))continue;let U={x:M-B.distance.x,y:k-B.distance.y};L&&(U=z?{x:Math.round(U.x+z.x),y:Math.round(U.y+z.y)}:Xt(U,N));let X=null;if(I&&A&&!B.extent&&O){const{positionAbsolute:W}=B.internals,te=W.x-O.x+A[0][0],K=W.x+B.measured.width-O.x2+A[1][0],re=W.y-O.y+A[0][1],ee=W.y+B.measured.height-O.y2+A[1][1];X=[[te,re],[K,ee]]}const{position:J,positionAbsolute:Q}=em({nodeId:H,nextPosition:U,nodeLookup:S,nodeExtent:X||A,nodeOrigin:P,onError:G});Y=Y||B.position.x!==J.x||B.position.y!==J.y,B.position=J,B.internals.positionAbsolute=Q}if(g=g||Y,!!Y&&(V(s,!0),m&&(r||D||!w&&j))){const[H,B]=pr({nodeId:w,dragItems:s,nodeLookup:S});r?.(m,s,H,B),D?.(m,H,B),w||j?.(m,B)}}async function C(){if(!l)return;const{transform:M,panBy:k,autoPanSpeed:S,autoPanOnNodeDrag:A}=t();if(!A){c=!1,cancelAnimationFrame(a);return}const[N,L]=nm(u,l,S);(N!==0||L!==0)&&(o.x=(o.x??0)-N/M[2],o.y=(o.y??0)-L/M[2],await k({x:N,y:L})&&R(o)),a=requestAnimationFrame(C)}function T(M){const{nodeLookup:k,multiSelectionActive:S,nodesDraggable:A,transform:N,snapGrid:L,snapToGrid:P,selectNodesOnDrag:D,onNodeDragStart:j,onSelectionDragStart:G,unselectNodesAndEdges:V}=t();f=!0,(!D||!x)&&!S&&w&&(k.get(w)?.selected||V()),x&&D&&w&&e?.(w);const Y=Ot(M.sourceEvent,{transform:N,snapGrid:L,snapToGrid:P,containerBounds:l});if(o=Y,s=h1(k,A,Y,w),s.size>0&&(n||j||!w&&G)){const[I,O]=pr({nodeId:w,dragItems:s,nodeLookup:k});n?.(M.sourceEvent,s,I,O),j?.(M.sourceEvent,I,O),w||G?.(M.sourceEvent,O)}}const q=Pv().clickDistance(E).on("start",M=>{const{domNode:k,nodeDragThreshold:S,transform:A,snapGrid:N,snapToGrid:L}=t();l=k?.getBoundingClientRect()||null,h=!1,g=!1,m=M.sourceEvent,S===0&&T(M),o=Ot(M.sourceEvent,{transform:A,snapGrid:N,snapToGrid:L,containerBounds:l}),u=xe(M.sourceEvent,l)}).on("drag",M=>{const{autoPanOnNodeDrag:k,transform:S,snapGrid:A,snapToGrid:N,nodeDragThreshold:L,nodeLookup:P}=t(),D=Ot(M.sourceEvent,{transform:S,snapGrid:A,snapToGrid:N,containerBounds:l});if(m=M.sourceEvent,(M.sourceEvent.type==="touchmove"&&M.sourceEvent.touches.length>1||w&&!P.has(w))&&(h=!0),!h){if(!c&&k&&f&&(c=!0,C()),!f){const j=xe(M.sourceEvent,l),G=j.x-u.x,V=j.y-u.y;Math.sqrt(G*G+V*V)>L&&T(M)}(o.x!==D.xSnapped||o.y!==D.ySnapped)&&s&&f&&(u=xe(M.sourceEvent,l),R(D))}}).on("end",M=>{if(!(!f||h)&&(c=!1,f=!1,cancelAnimationFrame(a),s.size>0)){const{nodeLookup:k,updateNodePositions:S,onNodeDragStop:A,onSelectionDragStop:N}=t();if(g&&(S(s,!1),g=!1),i||A||!w&&N){const[L,P]=pr({nodeId:w,dragItems:s,nodeLookup:k,dragging:!1});i?.(M.sourceEvent,s,L,P),A?.(M.sourceEvent,L,P),w||N?.(M.sourceEvent,P)}}}).filter(M=>{const k=M.target;return!M.button&&(!b||!bl(k,`.${b}`,_))&&(!p||bl(k,p,_))});d.call(q)}function y(){d?.on(".drag",null)}return{update:v,destroy:y}}function v1(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const o of t.values())Bt(i,_t(o))>0&&r.push(o);return r}const m1=250;function y1(e,t,n,r){let i=[],o=1/0;const a=v1(e,n,t+m1);for(const s of a){const c=[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]];for(const u of c){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:l,y:f}=it(s,u,u.position,!0),d=Math.sqrt(Math.pow(l-e.x,2)+Math.pow(f-e.y,2));d>t||(d<o?(i=[{...u,x:l,y:f}],o=d):d===o&&i.push({...u,x:l,y:f}))}}if(!i.length)return null;if(i.length>1){const s=r.type==="source"?"target":"source";return i.find(c=>c.type===s)??i[0]}return i[0]}function mm(e,t,n,r,i,o=!1){const a=r.get(e);if(!a)return null;const s=i==="strict"?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],c=(n?s?.find(u=>u.id===n):s?.[0])??null;return c&&o?{...c,...it(a,c,c.position,!0)}:c}function ym(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function _1(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const _m=()=>!0;function b1(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:o,isTarget:a,domNode:s,nodeLookup:c,lib:u,autoPanOnConnect:l,flowId:f,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:m,onConnectEnd:v,isValidConnection:y=_m,onReconnectEnd:b,updateConnection:p,getTransform:_,getFromHandle:x,autoPanSpeed:w,dragThreshold:E=1,handleDomNode:R}){const C=am(e.target);let T=0,q;const{x:M,y:k}=xe(e),S=ym(o,R),A=s?.getBoundingClientRect();let N=!1;if(!A||!S)return;const L=mm(i,S,r,c,t);if(!L)return;let P=xe(e,A),D=!1,j=null,G=!1,V=null;function Y(){if(!l||!A)return;const[J,Q]=nm(P,A,w);d({x:J,y:Q}),T=requestAnimationFrame(Y)}const I={...L,nodeId:i,type:S,position:L.position},O=c.get(i);let H={inProgress:!0,isValid:null,from:it(O,I,Z.Left,!0),fromHandle:I,fromPosition:I.position,fromNode:O,to:P,toHandle:null,toPosition:ul[I.position],toNode:null,pointer:P};function B(){N=!0,p(H),g?.(e,{nodeId:i,handleId:r,handleType:S})}E===0&&B();function U(J){if(!N){const{x:ee,y:fe}=xe(J),le=ee-M,Pe=fe-k;if(!(le*le+Pe*Pe>E*E))return;B()}if(!x()||!I){X(J);return}const Q=_();P=xe(J,A),q=y1(Kt(P,Q,!1,[1,1]),n,c,I),D||(Y(),D=!0);const W=bm(J,{handle:q,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:C,lib:u,flowId:f,nodeLookup:c});V=W.handleDomNode,j=W.connection,G=_1(!!q,W.isValid);const te=c.get(i),K=te?it(te,I,Z.Left,!0):H.from,re={...H,from:K,isValid:G,to:W.toHandle&&G?Nn({x:W.toHandle.x,y:W.toHandle.y},Q):P,toHandle:W.toHandle,toPosition:G&&W.toHandle?W.toHandle.position:ul[I.position],toNode:W.toHandle?c.get(W.toHandle.nodeId):null,pointer:P};p(re),H=re}function X(J){if(!("touches"in J&&J.touches.length>0)){if(N){(q||V)&&j&&G&&m?.(j);const{inProgress:Q,...W}=H,te={...W,toPosition:H.toHandle?H.toPosition:null};v?.(J,te),o&&b?.(J,te)}h(),cancelAnimationFrame(T),D=!1,G=!1,j=null,V=null,C.removeEventListener("mousemove",U),C.removeEventListener("mouseup",X),C.removeEventListener("touchmove",U),C.removeEventListener("touchend",X)}}C.addEventListener("mousemove",U),C.addEventListener("mouseup",X),C.addEventListener("touchmove",U),C.addEventListener("touchend",X)}function bm(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:o,doc:a,lib:s,flowId:c,isValidConnection:u=_m,nodeLookup:l}){const f=o==="target",d=t?a.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=xe(e),m=a.elementFromPoint(h,g),v=m?.classList.contains(`${s}-flow__handle`)?m:d,y={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const b=ym(void 0,v),p=v.getAttribute("data-nodeid"),_=v.getAttribute("data-handleid"),x=v.classList.contains("connectable"),w=v.classList.contains("connectableend");if(!p||!b)return y;const E={source:f?p:r,sourceHandle:f?_:i,target:f?r:p,targetHandle:f?i:_};y.connection=E;const C=x&&w&&(n===mt.Strict?f&&b==="source"||!f&&b==="target":p!==r||_!==i);y.isValid=C&&u(E),y.toHandle=mm(p,b,_,l,n,!0)}return y}const Ju={onPointerDown:b1,isValid:bm};function w1({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=ge(e);function o({translateExtent:s,width:c,height:u,zoomStep:l=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const _=n(),x=p.sourceEvent.ctrlKey&&jt()?10:1,w=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*l,E=_[2]*Math.pow(2,w*x);t.scaleTo(E)};let m=[0,0];const v=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(m=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},y=p=>{const _=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const x=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],w=[x[0]-m[0],x[1]-m[1]];m=x;const E=r()*Math.max(_[2],Math.log(_[2]))*(h?-1:1),R={x:_[0]-w[0]*E,y:_[1]-w[1]*E},C=[[0,0],[c,u]];t.setViewportConstrained({x:R.x,y:R.y,zoom:_[2]},C,s)},b=Wv().on("start",v).on("zoom",f?y:null).on("zoom.wheel",d?g:null);i.call(b,{})}function a(){i.on("zoom",null)}return{update:o,destroy:a,pointer:_e}}const $n=e=>({x:e.x,y:e.y,zoom:e.k}),gr=({x:e,y:t,zoom:n})=>Dn.translate(e,t).scale(n),ft=(e,t)=>e.target.closest(`.${t}`),wm=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),x1=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,vr=(e,t=0,n=x1,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},xm=e=>{const t=e.ctrlKey&&jt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function E1({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:o,zoomOnPinch:a,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:u}){return l=>{if(ft(l,t))return l.ctrlKey&&l.preventDefault(),!1;l.preventDefault(),l.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(l.ctrlKey&&a){const v=_e(l),y=xm(l),b=f*Math.pow(2,y);r.scaleTo(n,b,v,l);return}const d=l.deltaMode===1?20:1;let h=i===et.Vertical?0:l.deltaX*d,g=i===et.Horizontal?0:l.deltaY*d;!jt()&&l.shiftKey&&i!==et.Vertical&&(h=l.deltaY*d,g=0),r.translateBy(n,-(h/f)*o,-(g/f)*o,{internal:!0});const m=$n(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(l,m),e.panScrollTimeout=setTimeout(()=>{u?.(l,m),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(l,m))}}function S1({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const o=r.type==="wheel",a=!t&&o&&!r.ctrlKey,s=ft(r,e);if(r.ctrlKey&&o&&s&&r.preventDefault(),a||s)return null;r.preventDefault(),n.call(this,r,i)}}function C1({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const i=$n(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,i)}}function q1({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return o=>{e.usedRightMouseButton=!!(n&&wm(t,e.mouseButton??0)),o.sourceEvent?.sync||r([o.transform.x,o.transform.y,o.transform.k]),i&&!o.sourceEvent?.internal&&i?.(o.sourceEvent,$n(o.transform))}}function R1({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:o}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,o&&wm(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&o(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const s=$n(a.transform);e.prevViewport=s,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(a.sourceEvent,s)},n?150:0)}}}function I1({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:o,userSelectionActive:a,noWheelClassName:s,noPanClassName:c,lib:u,connectionInProgress:l}){return f=>{const d=e||t,h=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(ft(f,`${u}-flow__node`)||ft(f,`${u}-flow__edge`)))return!0;if(!r&&!d&&!i&&!o&&!n||a||l&&!g||ft(f,s)&&g||ft(f,c)&&(!g||i&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!i&&!h&&g||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const m=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&m}}function N1({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:o,onPanZoomStart:a,onPanZoomEnd:s,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},l=e.getBoundingClientRect(),f=Wv().scaleExtent([t,n]).translateExtent(r),d=ge(e).call(f);b({x:i.x,y:i.y,zoom:yt(i.zoom,t,n)},[[0,0],[l.width,l.height]],r);const h=d.on("wheel.zoom"),g=d.on("dblclick.zoom");f.wheelDelta(xm);function m(q,M){return d?new Promise(k=>{f?.interpolate(M?.interpolate==="linear"?kt:vn).transform(vr(d,M?.duration,M?.ease,()=>k(!0)),q)}):Promise.resolve(!1)}function v({noWheelClassName:q,noPanClassName:M,onPaneContextMenu:k,userSelectionActive:S,panOnScroll:A,panOnDrag:N,panOnScrollMode:L,panOnScrollSpeed:P,preventScrolling:D,zoomOnPinch:j,zoomOnScroll:G,zoomOnDoubleClick:V,zoomActivationKeyPressed:Y,lib:I,onTransformChange:O,connectionInProgress:z,paneClickDistance:H,selectionOnDrag:B}){S&&!u.isZoomingOrPanning&&y();const U=A&&!Y&&!S;f.clickDistance(B?1/0:!we(H)||H<0?0:H);const X=U?E1({zoomPanValues:u,noWheelClassName:q,d3Selection:d,d3Zoom:f,panOnScrollMode:L,panOnScrollSpeed:P,zoomOnPinch:j,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:s}):S1({noWheelClassName:q,preventScrolling:D,d3ZoomHandler:h});if(d.on("wheel.zoom",X,{passive:!1}),!S){const Q=C1({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",Q);const W=q1({zoomPanValues:u,panOnDrag:N,onPaneContextMenu:!!k,onPanZoom:o,onTransformChange:O});f.on("zoom",W);const te=R1({zoomPanValues:u,panOnDrag:N,panOnScroll:A,onPaneContextMenu:k,onPanZoomEnd:s,onDraggingChange:c});f.on("end",te)}const J=I1({zoomActivationKeyPressed:Y,panOnDrag:N,zoomOnScroll:G,panOnScroll:A,zoomOnDoubleClick:V,zoomOnPinch:j,userSelectionActive:S,noPanClassName:M,noWheelClassName:q,lib:I,connectionInProgress:z});f.filter(J),V?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function b(q,M,k){const S=gr(q),A=f?.constrain()(S,M,k);return A&&await m(A),new Promise(N=>N(A))}async function p(q,M){const k=gr(q);return await m(k,M),new Promise(S=>S(k))}function _(q){if(d){const M=gr(q),k=d.property("__zoom");(k.k!==q.zoom||k.x!==q.x||k.y!==q.y)&&f?.transform(d,M,null,{sync:!0})}}function x(){const q=d?Yv(d.node()):{x:0,y:0,k:1};return{x:q.x,y:q.y,zoom:q.k}}function w(q,M){return d?new Promise(k=>{f?.interpolate(M?.interpolate==="linear"?kt:vn).scaleTo(vr(d,M?.duration,M?.ease,()=>k(!0)),q)}):Promise.resolve(!1)}function E(q,M){return d?new Promise(k=>{f?.interpolate(M?.interpolate==="linear"?kt:vn).scaleBy(vr(d,M?.duration,M?.ease,()=>k(!0)),q)}):Promise.resolve(!1)}function R(q){f?.scaleExtent(q)}function C(q){f?.translateExtent(q)}function T(q){const M=!we(q)||q<0?0:q;f?.clickDistance(M)}return{update:v,destroy:y,setViewport:p,setViewportConstrained:b,getViewport:x,scaleTo:w,scaleBy:E,setScaleExtent:R,setTranslateExtent:C,syncViewport:_,setClickDistance:T}}var wt;(function(e){e.Line="line",e.Handle="handle"})(wt||(wt={}));function A1({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:o}){const a=e-t,s=n-r,c=[a>0?1:a<0?-1:0,s>0?1:s<0?-1:0];return a&&i&&(c[0]=c[0]*-1),s&&o&&(c[1]=c[1]*-1),c}function wl(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function Ue(e,t){return Math.max(0,t-e)}function Ye(e,t){return Math.max(0,e-t)}function dn(e,t,n){return Math.max(0,t-e,e-n)}function xl(e,t){return e?!t:t}function M1(e,t,n,r,i,o,a,s){let{affectsX:c,affectsY:u}=t;const{isHorizontal:l,isVertical:f}=t,d=l&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:m,maxWidth:v,minHeight:y,maxHeight:b}=r,{x:p,y:_,width:x,height:w,aspectRatio:E}=e;let R=Math.floor(l?h-e.pointerX:0),C=Math.floor(f?g-e.pointerY:0);const T=x+(c?-R:R),q=w+(u?-C:C),M=-o[0]*x,k=-o[1]*w;let S=dn(T,m,v),A=dn(q,y,b);if(a){let P=0,D=0;c&&R<0?P=Ue(p+R+M,a[0][0]):!c&&R>0&&(P=Ye(p+T+M,a[1][0])),u&&C<0?D=Ue(_+C+k,a[0][1]):!u&&C>0&&(D=Ye(_+q+k,a[1][1])),S=Math.max(S,P),A=Math.max(A,D)}if(s){let P=0,D=0;c&&R>0?P=Ye(p+R,s[0][0]):!c&&R<0&&(P=Ue(p+T,s[1][0])),u&&C>0?D=Ye(_+C,s[0][1]):!u&&C<0&&(D=Ue(_+q,s[1][1])),S=Math.max(S,P),A=Math.max(A,D)}if(i){if(l){const P=dn(T/E,y,b)*E;if(S=Math.max(S,P),a){let D=0;!c&&!u||c&&!u&&d?D=Ye(_+k+T/E,a[1][1])*E:D=Ue(_+k+(c?R:-R)/E,a[0][1])*E,S=Math.max(S,D)}if(s){let D=0;!c&&!u||c&&!u&&d?D=Ue(_+T/E,s[1][1])*E:D=Ye(_+(c?R:-R)/E,s[0][1])*E,S=Math.max(S,D)}}if(f){const P=dn(q*E,m,v)/E;if(A=Math.max(A,P),a){let D=0;!c&&!u||u&&!c&&d?D=Ye(p+q*E+M,a[1][0])/E:D=Ue(p+(u?C:-C)*E+M,a[0][0])/E,A=Math.max(A,D)}if(s){let D=0;!c&&!u||u&&!c&&d?D=Ue(p+q*E,s[1][0])/E:D=Ye(p+(u?C:-C)*E,s[0][0])/E,A=Math.max(A,D)}}}C=C+(C<0?A:-A),R=R+(R<0?S:-S),i&&(d?T>q*E?C=(xl(c,u)?-R:R)/E:R=(xl(c,u)?-C:C)*E:l?(C=R/E,u=c):(R=C*E,c=u));const N=c?p+R:p,L=u?_+C:_;return{width:x+(c?-R:R),height:w+(u?-C:C),x:o[0]*R*(c?-1:1)+N,y:o[1]*C*(u?-1:1)+L}}const Em={width:0,height:0,x:0,y:0},T1={...Em,pointerX:0,pointerY:0,aspectRatio:1};function P1(e){return[[0,0],[e.measured.width,e.measured.height]]}function k1(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,o=e.measured.width??0,a=e.measured.height??0,s=n[0]*o,c=n[1]*a;return[[r-s,i-c],[r+o-s,i+a-c]]}function O1({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const o=ge(e);let a={controlDirection:wl("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:u,boundaries:l,keepAspectRatio:f,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:m,shouldResize:v}){let y={...Em},b={...T1};a={boundaries:l,resizeDirection:d,keepAspectRatio:f,controlDirection:wl(u)};let p,_=null,x=[],w,E,R,C=!1;const T=Pv().on("start",q=>{const{nodeLookup:M,transform:k,snapGrid:S,snapToGrid:A,nodeOrigin:N,paneDomNode:L}=n();if(p=M.get(t),!p)return;_=L?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:D}=Ot(q.sourceEvent,{transform:k,snapGrid:S,snapToGrid:A,containerBounds:_});y={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...y,pointerX:P,pointerY:D,aspectRatio:y.width/y.height},w=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(w=M.get(p.parentId),E=w&&p.extent==="parent"?P1(w):void 0),x=[],R=void 0;for(const[j,G]of M)if(G.parentId===t&&(x.push({id:j,position:{...G.position},extent:G.extent}),G.extent==="parent"||G.expandParent)){const V=k1(G,p,G.origin??N);R?R=[[Math.min(V[0][0],R[0][0]),Math.min(V[0][1],R[0][1])],[Math.max(V[1][0],R[1][0]),Math.max(V[1][1],R[1][1])]]:R=V}h?.(q,{...y})}).on("drag",q=>{const{transform:M,snapGrid:k,snapToGrid:S,nodeOrigin:A}=n(),N=Ot(q.sourceEvent,{transform:M,snapGrid:k,snapToGrid:S,containerBounds:_}),L=[];if(!p)return;const{x:P,y:D,width:j,height:G}=y,V={},Y=p.origin??A,{width:I,height:O,x:z,y:H}=M1(b,a.controlDirection,N,a.boundaries,a.keepAspectRatio,Y,E,R),B=I!==j,U=O!==G,X=z!==P&&B,J=H!==D&&U;if(!X&&!J&&!B&&!U)return;if((X||J||Y[0]===1||Y[1]===1)&&(V.x=X?z:y.x,V.y=J?H:y.y,y.x=V.x,y.y=V.y,x.length>0)){const K=z-P,re=H-D;for(const ee of x)ee.position={x:ee.position.x-K+Y[0]*(I-j),y:ee.position.y-re+Y[1]*(O-G)},L.push(ee)}if((B||U)&&(V.width=B&&(!a.resizeDirection||a.resizeDirection==="horizontal")?I:y.width,V.height=U&&(!a.resizeDirection||a.resizeDirection==="vertical")?O:y.height,y.width=V.width,y.height=V.height),w&&p.expandParent){const K=Y[0]*(V.width??0);V.x&&V.x<K&&(y.x=K,b.x=b.x-(V.x-K));const re=Y[1]*(V.height??0);V.y&&V.y<re&&(y.y=re,b.y=b.y-(V.y-re))}const Q=A1({width:y.width,prevWidth:j,height:y.height,prevHeight:G,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),W={...y,direction:Q};v?.(q,W)!==!1&&(C=!0,g?.(q,W),r(V,L))}).on("end",q=>{C&&(m?.(q,{...y}),i?.({...y}),C=!1)});o.call(T)}function c(){o.on(".drag",null)}return{update:s,destroy:c}}var mr={exports:{}},yr={},_r={exports:{}},br={};var El;function L1(){if(El)return br;El=1;var e=yv();function t(f,d){return f===d&&(f!==0||1/f===1/d)||f!==f&&d!==d}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,o=e.useLayoutEffect,a=e.useDebugValue;function s(f,d){var h=d(),g=r({inst:{value:h,getSnapshot:d}}),m=g[0].inst,v=g[1];return o(function(){m.value=h,m.getSnapshot=d,c(m)&&v({inst:m})},[f,h,d]),i(function(){return c(m)&&v({inst:m}),f(function(){c(m)&&v({inst:m})})},[f]),a(h),h}function c(f){var d=f.getSnapshot;f=f.value;try{var h=d();return!n(f,h)}catch{return!0}}function u(f,d){return d()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:s;return br.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:l,br}var Sl;function D1(){return Sl||(Sl=1,_r.exports=L1()),_r.exports}var Cl;function F1(){if(Cl)return yr;Cl=1;var e=yv(),t=D1();function n(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,a=e.useEffect,s=e.useMemo,c=e.useDebugValue;return yr.useSyncExternalStoreWithSelector=function(u,l,f,d,h){var g=o(null);if(g.current===null){var m={hasValue:!1,value:null};g.current=m}else m=g.current;g=s(function(){function y(w){if(!b){if(b=!0,p=w,w=d(w),h!==void 0&&m.hasValue){var E=m.value;if(h(E,w))return _=E}return _=w}if(E=_,r(p,w))return E;var R=d(w);return h!==void 0&&h(E,R)?(p=w,E):(p=w,_=R)}var b=!1,p,_,x=f===void 0?null:f;return[function(){return y(l())},x===null?void 0:function(){return y(x())}]},[l,f,d,h]);var v=i(u,g[0],g[1]);return a(function(){m.hasValue=!0,m.value=v},[v]),c(v),v},yr}var ql;function z1(){return ql||(ql=1,mr.exports=F1()),mr.exports}var $1=z1();const H1=n_($1),B1={},Rl=e=>{let t;const n=new Set,r=(l,f)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,h))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>u,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{(B1?"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()}},u=t=e(r,i,c);return c},j1=e=>e?Rl(e):Rl,{useDebugValue:V1}=r_,{useSyncExternalStoreWithSelector:G1}=H1,U1=e=>e;function Sm(e,t=U1,n){const r=G1(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return V1(r),r}const Il=(e,t)=>{const n=j1(e),r=(i,o=t)=>Sm(n,i,o);return Object.assign(r,n),r},Y1=(e,t)=>e?Il(e,t):Il;function ie(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[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Hn=$.createContext(null),W1=Hn.Provider,Cm=Ae.error001();function ne(e,t){const n=$.useContext(Hn);if(n===null)throw new Error(Cm);return Sm(n,e,t)}function oe(){const e=$.useContext(Hn);if(e===null)throw new Error(Cm);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Nl={display:"none"},X1={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},qm="react-flow__node-desc",Rm="react-flow__edge-desc",K1="react-flow__aria-live",Z1=e=>e.ariaLiveMessage,Q1=e=>e.ariaLabelConfig;function J1({rfId:e}){const t=ne(Z1);return F.jsx("div",{id:`${K1}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:X1,children:t})}function eE({rfId:e,disableKeyboardA11y:t}){const n=ne(Q1);return F.jsxs(F.Fragment,{children:[F.jsx("div",{id:`${qm}-${e}`,style:Nl,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),F.jsx("div",{id:`${Rm}-${e}`,style:Nl,children:n["edge.a11yDescription.default"]}),!t&&F.jsx(J1,{rfId:e})]})}const Bn=$.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},o)=>{const a=`${e}`.split("-");return F.jsx("div",{className:ue(["react-flow__panel",n,...a]),style:r,ref:o,...i,children:t})});Bn.displayName="Panel";function tE({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:F.jsx(Bn,{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:F.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const nE=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},hn=e=>e.id;function rE(e,t){return ie(e.selectedNodes.map(hn),t.selectedNodes.map(hn))&&ie(e.selectedEdges.map(hn),t.selectedEdges.map(hn))}function iE({onSelectionChange:e}){const t=oe(),{selectedNodes:n,selectedEdges:r}=ne(nE,rE);return $.useEffect(()=>{const i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(o=>o(i))},[n,r,e]),null}const oE=e=>!!e.onSelectionChangeHandlers;function aE({onSelectionChange:e}){const t=ne(oE);return e||t?F.jsx(iE,{onSelectionChange:e}):null}const Im=[0,0],sE={x:0,y:0,zoom:1},uE=["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"],Al=[...uE,"rfId"],cE=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}),Ml={translateExtent:$t,nodeOrigin:Im,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function lE(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:o,setNodeExtent:a,reset:s,setDefaultNodesAndEdges:c}=ne(cE,ie),u=oe();$.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{l.current=Ml,s()}),[]);const l=$.useRef(Ml);return $.useEffect(()=>{for(const f of Al){const d=e[f],h=l.current[f];d!==h&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?r(d):f==="maxZoom"?i(d):f==="translateExtent"?o(d):f==="nodeExtent"?a(d):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:Yx(d)}):f==="fitView"?u.setState({fitViewQueued:d}):f==="fitViewOptions"?u.setState({fitViewOptions:d}):u.setState({[f]:d})))}l.current=e},Al.map(f=>e[f])),null}function Tl(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function fE(e){const[t,n]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){n(e);return}const r=Tl(),i=()=>n(r?.matches?"dark":"light");return i(),r?.addEventListener("change",i),()=>{r?.removeEventListener("change",i)}},[e]),t!==null?t:Tl()?.matches?"dark":"light"}const Pl=typeof document<"u"?document:null;function Vt(e=null,t={target:Pl,actInsideInputWithModifier:!0}){const[n,r]=$.useState(!1),i=$.useRef(!1),o=$.useRef(new Set([])),[a,s]=$.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|