@owox/web 0.38.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{a0 as jc,a1 as Lc,r as L,j as E,P as Dc,n as Rc,c as Hc,a2 as zc,p as Fc,a3 as Lr,a4 as Bc,a5 as Vc,G as Yc,y as Xc,a6 as Wc,a7 as Gc,a8 as qc,T as Kc,a as Uc,I as Zc,b as Qc,a9 as Jc,aa as el,ab as tl}from"./index-BW17AtYZ.js";function se(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=se(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var nl={value:()=>{}};function dn(){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 Yt(n)}function Yt(e){this._=e}function rl(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Yt.prototype=dn.prototype={constructor:Yt,on:function(e,t){var n=this._,r=rl(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=ol(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=Dr(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Dr(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Yt(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[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],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function ol(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Dr(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=nl,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Vn="http://www.w3.org/1999/xhtml";const Rr={svg:"http://www.w3.org/2000/svg",xhtml:Vn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function fn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rr.hasOwnProperty(t)?{space:Rr[t],local:e}:e}function il(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Vn&&t.documentElement.namespaceURI===Vn?t.createElement(e):t.createElementNS(n,e)}}function sl(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function hi(e){var t=fn(e);return(t.local?sl:il)(t)}function al(){}function or(e){return e==null?al:function(){return this.querySelector(e)}}function cl(e){typeof e!="function"&&(e=or(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=new Array(s),c,l,u=0;u<s;++u)(c=i[u])&&(l=e.call(c,c.__data__,u,i))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new le(r,this._parents)}function ll(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ul(){return[]}function gi(e){return e==null?ul:function(){return this.querySelectorAll(e)}}function dl(e){return function(){return ll(e.apply(this,arguments))}}function fl(e){typeof e=="function"?e=dl(e):e=gi(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(e.call(c,c.__data__,l,s)),o.push(c));return new le(r,o)}function pi(e){return function(){return this.matches(e)}}function mi(e){return function(t){return t.matches(e)}}var hl=Array.prototype.find;function gl(e){return function(){return hl.call(this.children,e)}}function pl(){return this.firstElementChild}function ml(e){return this.select(e==null?pl:gl(typeof e=="function"?e:mi(e)))}var yl=Array.prototype.filter;function xl(){return Array.from(this.children)}function wl(e){return function(){return yl.call(this.children,e)}}function vl(e){return this.selectAll(e==null?xl:wl(typeof e=="function"?e:mi(e)))}function bl(e){typeof e!="function"&&(e=pi(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new le(r,this._parents)}function yi(e){return new Array(e.length)}function El(){return new le(this._enter||this._groups.map(yi),this._parents)}function Kt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Kt.prototype={constructor:Kt,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 _l(e){return function(){return e}}function Nl(e,t,n,r,o,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):n[s]=new Kt(e,i[s]);for(;s<c;++s)(a=t[s])&&(o[s]=a)}function Sl(e,t,n,r,o,i,s){var a,c,l=new Map,u=t.length,d=i.length,f=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?o[a]=c:l.set(h,c));for(a=0;a<d;++a)h=s.call(e,i[a],a,i)+"",(c=l.get(h))?(r[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new Kt(e,i[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(f[a])===c&&(o[a]=c)}function Cl(e){return e.__data__}function kl(e,t){if(!arguments.length)return Array.from(this,Cl);var n=t?Sl:Nl,r=this._parents,o=this._groups;typeof e!="function"&&(e=_l(e));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var u=r[l],d=o[l],f=d.length,h=Ml(e.call(u,u&&u.__data__,l,r)),g=h.length,v=a[l]=new Array(g),w=s[l]=new Array(g),m=c[l]=new Array(f);n(u,d,v,w,m,h,t);for(var b=0,p=0,x,_;b<g;++b)if(x=v[b]){for(b>=p&&(p=b+1);!(_=w[p])&&++p<g;);x._next=_||null}}return s=new le(s,r),s._enter=a,s._exit=c,s}function Ml(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Il(){return new le(this._exit||this._groups.map(yi),this._parents)}function Al(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Tl(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var l=n[c],u=r[c],d=l.length,f=a[c]=new Array(d),h,g=0;g<d;++g)(h=l[g]||u[g])&&(f[g]=h);for(;c<o;++c)a[c]=n[c];return new le(a,this._parents)}function Ol(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Pl(e){e||(e=$l);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new le(o,this._parents).order()}function $l(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function jl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ll(){return Array.from(this)}function Dl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function Rl(){let e=0;for(const t of this)++e;return e}function Hl(){return!this.node()}function zl(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&e.call(a,a.__data__,i,o);return this}function Fl(e){return function(){this.removeAttribute(e)}}function Bl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Vl(e,t){return function(){this.setAttribute(e,t)}}function Yl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Xl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Wl(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 Gl(e,t){var n=fn(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?Bl:Fl:typeof t=="function"?n.local?Wl:Xl:n.local?Yl:Vl)(n,t))}function xi(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ql(e){return function(){this.style.removeProperty(e)}}function Kl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ul(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Zl(e,t,n){return arguments.length>1?this.each((t==null?ql:typeof t=="function"?Ul:Kl)(e,t,n??"")):et(this.node(),e)}function et(e,t){return e.style.getPropertyValue(t)||xi(e).getComputedStyle(e,null).getPropertyValue(t)}function Ql(e){return function(){delete this[e]}}function Jl(e,t){return function(){this[e]=t}}function eu(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function tu(e,t){return arguments.length>1?this.each((t==null?Ql:typeof t=="function"?eu:Jl)(e,t)):this.node()[e]}function wi(e){return e.trim().split(/^|\s+/)}function ir(e){return e.classList||new vi(e)}function vi(e){this._node=e,this._names=wi(e.getAttribute("class")||"")}vi.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 bi(e,t){for(var n=ir(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Ei(e,t){for(var n=ir(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function nu(e){return function(){bi(this,e)}}function ru(e){return function(){Ei(this,e)}}function ou(e,t){return function(){(t.apply(this,arguments)?bi:Ei)(this,e)}}function iu(e,t){var n=wi(e+"");if(arguments.length<2){for(var r=ir(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?ou:t?nu:ru)(n,t))}function su(){this.textContent=""}function au(e){return function(){this.textContent=e}}function cu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function lu(e){return arguments.length?this.each(e==null?su:(typeof e=="function"?cu:au)(e)):this.node().textContent}function uu(){this.innerHTML=""}function du(e){return function(){this.innerHTML=e}}function fu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function hu(e){return arguments.length?this.each(e==null?uu:(typeof e=="function"?fu:du)(e)):this.node().innerHTML}function gu(){this.nextSibling&&this.parentNode.appendChild(this)}function pu(){return this.each(gu)}function mu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function yu(){return this.each(mu)}function xu(e){var t=typeof e=="function"?e:hi(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function wu(){return null}function vu(e,t){var n=typeof e=="function"?e:hi(e),r=t==null?wu:typeof t=="function"?t:or(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function bu(){var e=this.parentNode;e&&e.removeChild(this)}function Eu(){return this.each(bu)}function _u(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Nu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Su(e){return this.select(e?Nu:_u)}function Cu(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ku(e){return function(t){e.call(this,t,this.__data__)}}function Mu(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 Iu(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function Au(e,t,n){return function(){var r=this.__on,o,i=ku(t);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function Tu(e,t,n){var r=Mu(e+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(o=0,u=a[c];o<i;++o)if((s=r[o]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Au:Iu,o=0;o<i;++o)this.each(a(r[o],t,n));return this}function _i(e,t,n){var r=xi(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Ou(e,t){return function(){return _i(this,e,t)}}function Pu(e,t){return function(){return _i(this,e,t.apply(this,arguments))}}function $u(e,t){return this.each((typeof t=="function"?Pu:Ou)(e,t))}function*ju(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var Ni=[null];function le(e,t){this._groups=e,this._parents=t}function Ct(){return new le([[document.documentElement]],Ni)}function Lu(){return this}le.prototype=Ct.prototype={constructor:le,select:cl,selectAll:fl,selectChild:ml,selectChildren:vl,filter:bl,data:kl,enter:El,exit:Il,join:Al,merge:Tl,selection:Lu,order:Ol,sort:Pl,call:jl,nodes:Ll,node:Dl,size:Rl,empty:Hl,each:zl,attr:Gl,style:Zl,property:tu,classed:iu,text:lu,html:hu,raise:pu,lower:yu,append:xu,insert:vu,remove:Eu,clone:Su,datum:Cu,on:Tu,dispatch:$u,[Symbol.iterator]:ju};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Ni)}function Du(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fe(e,t){if(e=Du(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 o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const Ru={passive:!1},mt={capture:!0,passive:!1};function Mn(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function Si(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Qe,mt);"onselectstart"in t?n.on("selectstart.drag",Qe,mt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ci(e,t){var n=e.document.documentElement,r=ce(e).on("dragstart.drag",null);t&&(r.on("click.drag",Qe,mt),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 jt=e=>()=>e;function Yn(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Yn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Hu(e){return!e.ctrlKey&&!e.button}function zu(){return this.parentNode}function Fu(e,t){return t??{x:e.x,y:e.y}}function Bu(){return navigator.maxTouchPoints||"ontouchstart"in this}function ki(){var e=Hu,t=zu,n=Fu,r=Bu,o={},i=dn("start","drag","end"),s=0,a,c,l,u,d=0;function f(x){x.on("mousedown.drag",h).filter(r).on("touchstart.drag",w).on("touchmove.drag",m,Ru).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,_){if(!(u||!e.call(this,x,_))){var S=p(this,t.call(this,x,_),x,_,"mouse");S&&(ce(x.view).on("mousemove.drag",g,mt).on("mouseup.drag",v,mt),Si(x.view),Mn(x),l=!1,a=x.clientX,c=x.clientY,S("start",x))}}function g(x){if(Qe(x),!l){var _=x.clientX-a,S=x.clientY-c;l=_*_+S*S>d}o.mouse("drag",x)}function v(x){ce(x.view).on("mousemove.drag mouseup.drag",null),Ci(x.view,l),Qe(x),o.mouse("end",x)}function w(x,_){if(e.call(this,x,_)){var S=x.changedTouches,k=t.call(this,x,_),M=S.length,I,z;for(I=0;I<M;++I)(z=p(this,k,x,_,S[I].identifier,S[I]))&&(Mn(x),z("start",x,S[I]))}}function m(x){var _=x.changedTouches,S=_.length,k,M;for(k=0;k<S;++k)(M=o[_[k].identifier])&&(Qe(x),M("drag",x,_[k]))}function b(x){var _=x.changedTouches,S=_.length,k,M;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),k=0;k<S;++k)(M=o[_[k].identifier])&&(Mn(x),M("end",x,_[k]))}function p(x,_,S,k,M,I){var z=i.copy(),O=fe(I||S,_),$,P,y;if((y=n.call(x,new Yn("beforestart",{sourceEvent:S,target:f,identifier:M,active:s,x:O[0],y:O[1],dx:0,dy:0,dispatch:z}),k))!=null)return $=y.x-O[0]||0,P=y.y-O[1]||0,function N(C,A,j){var T=O,D;switch(C){case"start":o[M]=N,D=s++;break;case"end":delete o[M],--s;case"drag":O=fe(j||A,_),D=s;break}z.call(C,x,new Yn(C,{sourceEvent:A,subject:y,target:f,identifier:M,active:D,x:O[0]+$,y:O[1]+P,dx:O[0]-T[0],dy:O[1]-T[1],dispatch:z}),k)}}return f.filter=function(x){return arguments.length?(e=typeof x=="function"?x:jt(!!x),f):e},f.container=function(x){return arguments.length?(t=typeof x=="function"?x:jt(x),f):t},f.subject=function(x){return arguments.length?(n=typeof x=="function"?x:jt(x),f):n},f.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:jt(!!x),f):r},f.on=function(){var x=i.on.apply(i,arguments);return x===i?f:x},f.clickDistance=function(x){return arguments.length?(d=(x=+x)*x,f):Math.sqrt(d)},f}function sr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Mi(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function kt(){}var yt=.7,Ut=1/yt,Je="\\s*([+-]?\\d+)\\s*",xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ne="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Vu=/^#([0-9a-f]{3,8})$/,Yu=new RegExp(`^rgb\\(${Je},${Je},${Je}\\)$`),Xu=new RegExp(`^rgb\\(${Ne},${Ne},${Ne}\\)$`),Wu=new RegExp(`^rgba\\(${Je},${Je},${Je},${xt}\\)$`),Gu=new RegExp(`^rgba\\(${Ne},${Ne},${Ne},${xt}\\)$`),qu=new RegExp(`^hsl\\(${xt},${Ne},${Ne}\\)$`),Ku=new RegExp(`^hsla\\(${xt},${Ne},${Ne},${xt}\\)$`),Hr={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};sr(kt,Ye,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:zr,formatHex:zr,formatHex8:Uu,formatHsl:Zu,formatRgb:Fr,toString:Fr});function zr(){return this.rgb().formatHex()}function Uu(){return this.rgb().formatHex8()}function Zu(){return Ii(this).formatHsl()}function Fr(){return this.rgb().formatRgb()}function Ye(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Vu.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Br(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Lt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Lt(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=Yu.exec(e))?new ae(t[1],t[2],t[3],1):(t=Xu.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Wu.exec(e))?Lt(t[1],t[2],t[3],t[4]):(t=Gu.exec(e))?Lt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=qu.exec(e))?Xr(t[1],t[2]/100,t[3]/100,1):(t=Ku.exec(e))?Xr(t[1],t[2]/100,t[3]/100,t[4]):Hr.hasOwnProperty(e)?Br(Hr[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function Br(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function Lt(e,t,n,r){return r<=0&&(e=t=n=NaN),new ae(e,t,n,r)}function Qu(e){return e instanceof kt||(e=Ye(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function Xn(e,t,n,r){return arguments.length===1?Qu(e):new ae(e,t,n,r??1)}function ae(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}sr(ae,Xn,Mi(kt,{brighter(e){return e=e==null?Ut:Math.pow(Ut,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yt:Math.pow(yt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Be(this.r),Be(this.g),Be(this.b),Zt(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:Vr,formatHex:Vr,formatHex8:Ju,formatRgb:Yr,toString:Yr}));function Vr(){return`#${Fe(this.r)}${Fe(this.g)}${Fe(this.b)}`}function Ju(){return`#${Fe(this.r)}${Fe(this.g)}${Fe(this.b)}${Fe((isNaN(this.opacity)?1:this.opacity)*255)}`}function Yr(){const e=Zt(this.opacity);return`${e===1?"rgb(":"rgba("}${Be(this.r)}, ${Be(this.g)}, ${Be(this.b)}${e===1?")":`, ${e})`}`}function Zt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Be(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Fe(e){return e=Be(e),(e<16?"0":"")+e.toString(16)}function Xr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new he(e,t,n,r)}function Ii(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof kt||(e=Ye(e)),!e)return new he;if(e instanceof he)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new he(s,a,c,e.opacity)}function ed(e,t,n,r){return arguments.length===1?Ii(e):new he(e,t,n,r??1)}function he(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}sr(he,ed,Mi(kt,{brighter(e){return e=e==null?Ut:Math.pow(Ut,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yt:Math.pow(yt,e),new he(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,o=2*n-r;return new ae(In(e>=240?e-240:e+120,o,r),In(e,o,r),In(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new he(Wr(this.h),Dt(this.s),Dt(this.l),Zt(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=Zt(this.opacity);return`${e===1?"hsl(":"hsla("}${Wr(this.h)}, ${Dt(this.s)*100}%, ${Dt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Wr(e){return e=(e||0)%360,e<0?e+360:e}function Dt(e){return Math.max(0,Math.min(1,e||0))}function In(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 ar=e=>()=>e;function td(e,t){return function(n){return e+n*t}}function nd(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 rd(e){return(e=+e)==1?Ai:function(t,n){return n-t?nd(t,n,e):ar(isNaN(t)?n:t)}}function Ai(e,t){var n=t-e;return n?td(e,n):ar(isNaN(e)?t:e)}const Qt=(function e(t){var n=rd(t);function r(o,i){var s=n((o=Xn(o)).r,(i=Xn(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),l=Ai(o.opacity,i.opacity);return function(u){return o.r=s(u),o.g=a(u),o.b=c(u),o.opacity=l(u),o+""}}return r.gamma=e,r})(1);function od(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function id(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function sd(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=gt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function ad(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ee(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function cd(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=gt(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var Wn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,An=new RegExp(Wn.source,"g");function ld(e){return function(){return e}}function ud(e){return function(t){return e(t)+""}}function Ti(e,t){var n=Wn.lastIndex=An.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=Wn.exec(e))&&(o=An.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:Ee(r,o)})),n=An.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?ud(c[0].x):ld(t):(t=c.length,function(l){for(var u=0,d;u<t;++u)a[(d=c[u]).i]=d.x(l);return a.join("")})}function gt(e,t){var n=typeof t,r;return t==null||n==="boolean"?ar(t):(n==="number"?Ee:n==="string"?(r=Ye(t))?(t=r,Qt):Ti:t instanceof Ye?Qt:t instanceof Date?ad:id(t)?od:Array.isArray(t)?sd:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?cd:Ee)(e,t)}var Gr=180/Math.PI,Gn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Oi(e,t,n,r,o,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*Gr,skewX:Math.atan(c)*Gr,scaleX:s,scaleY:a}}var Rt;function dd(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Gn:Oi(t.a,t.b,t.c,t.d,t.e,t.f)}function fd(e){return e==null||(Rt||(Rt=document.createElementNS("http://www.w3.org/2000/svg","g")),Rt.setAttribute("transform",e),!(e=Rt.transform.baseVal.consolidate()))?Gn:(e=e.matrix,Oi(e.a,e.b,e.c,e.d,e.e,e.f))}function Pi(e,t,n,r){function o(l){return l.length?l.pop()+" ":""}function i(l,u,d,f,h,g){if(l!==d||u!==f){var v=h.push("translate(",null,t,null,n);g.push({i:v-4,x:Ee(l,d)},{i:v-2,x:Ee(u,f)})}else(d||f)&&h.push("translate("+d+t+f+n)}function s(l,u,d,f){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),f.push({i:d.push(o(d)+"rotate(",null,r)-2,x:Ee(l,u)})):u&&d.push(o(d)+"rotate("+u+r)}function a(l,u,d,f){l!==u?f.push({i:d.push(o(d)+"skewX(",null,r)-2,x:Ee(l,u)}):u&&d.push(o(d)+"skewX("+u+r)}function c(l,u,d,f,h,g){if(l!==d||u!==f){var v=h.push(o(h)+"scale(",null,",",null,")");g.push({i:v-4,x:Ee(l,d)},{i:v-2,x:Ee(u,f)})}else(d!==1||f!==1)&&h.push(o(h)+"scale("+d+","+f+")")}return function(l,u){var d=[],f=[];return l=e(l),u=e(u),i(l.translateX,l.translateY,u.translateX,u.translateY,d,f),s(l.rotate,u.rotate,d,f),a(l.skewX,u.skewX,d,f),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,d,f),l=u=null,function(h){for(var g=-1,v=f.length,w;++g<v;)d[(w=f[g]).i]=w.x(h);return d.join("")}}}var hd=Pi(dd,"px, ","px)","deg)"),gd=Pi(fd,", ",")",")"),pd=1e-12;function qr(e){return((e=Math.exp(e))+1/e)/2}function md(e){return((e=Math.exp(e))-1/e)/2}function yd(e){return((e=Math.exp(2*e))-1)/(e+1)}const Xt=(function e(t,n,r){function o(i,s){var a=i[0],c=i[1],l=i[2],u=s[0],d=s[1],f=s[2],h=u-a,g=d-c,v=h*h+g*g,w,m;if(v<pd)m=Math.log(f/l)/t,w=function(k){return[a+k*h,c+k*g,l*Math.exp(t*k*m)]};else{var b=Math.sqrt(v),p=(f*f-l*l+r*v)/(2*l*n*b),x=(f*f-l*l-r*v)/(2*f*n*b),_=Math.log(Math.sqrt(p*p+1)-p),S=Math.log(Math.sqrt(x*x+1)-x);m=(S-_)/t,w=function(k){var M=k*m,I=qr(_),z=l/(n*b)*(I*yd(t*M+_)-md(_));return[a+z*h,c+z*g,l*I/qr(t*M+_)]}}return w.duration=m*1e3*t/Math.SQRT2,w}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},o})(Math.SQRT2,2,4);var tt=0,dt=0,lt=0,$i=1e3,Jt,ft,en=0,Xe=0,hn=0,wt=typeof performance=="object"&&performance.now?performance:Date,ji=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function cr(){return Xe||(ji(xd),Xe=wt.now()+hn)}function xd(){Xe=0}function tn(){this._call=this._time=this._next=null}tn.prototype=Li.prototype={constructor:tn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?cr():+n)+(t==null?0:+t),!this._next&&ft!==this&&(ft?ft._next=this:Jt=this,ft=this),this._call=e,this._time=n,qn()},stop:function(){this._call&&(this._call=null,this._time=1/0,qn())}};function Li(e,t,n){var r=new tn;return r.restart(e,t,n),r}function wd(){cr(),++tt;for(var e=Jt,t;e;)(t=Xe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--tt}function Kr(){Xe=(en=wt.now())+hn,tt=dt=0;try{wd()}finally{tt=0,bd(),Xe=0}}function vd(){var e=wt.now(),t=e-en;t>$i&&(hn-=t,en=e)}function bd(){for(var e,t=Jt,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:Jt=n);ft=e,qn(r)}function qn(e){if(!tt){dt&&(dt=clearTimeout(dt));var t=e-Xe;t>24?(e<1/0&&(dt=setTimeout(Kr,e-wt.now()-hn)),lt&&(lt=clearInterval(lt))):(lt||(en=wt.now(),lt=setInterval(vd,$i)),tt=1,ji(Kr))}}function Ur(e,t,n){var r=new tn;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Ed=dn("start","end","cancel","interrupt"),_d=[],Di=0,Zr=1,Kn=2,Wt=3,Qr=4,Un=5,Gt=6;function gn(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Nd(e,n,{name:t,index:r,group:o,on:Ed,tween:_d,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Di})}function lr(e,t){var n=ye(e,t);if(n.state>Di)throw new Error("too late; already scheduled");return n}function Se(e,t){var n=ye(e,t);if(n.state>Wt)throw new Error("too late; already running");return n}function ye(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Nd(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=Li(i,0,n.time);function i(l){n.state=Zr,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,d,f,h;if(n.state!==Zr)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===Wt)return Ur(s);h.state===Qr?(h.state=Gt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=Gt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Ur(function(){n.state===Wt&&(n.state=Qr,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Kn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Kn){for(n.state=Wt,o=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(o[++d]=h);o.length=d+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Un,1),d=-1,f=o.length;++d<f;)o[d].call(e,u);n.state===Un&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Gt,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function qt(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>Kn&&r.state<Un,r.state=Gt,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function Sd(e){return this.each(function(){qt(this,e)})}function Cd(e,t){var n,r;return function(){var o=Se(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function kd(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=Se(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:t,value:n},c=0,l=o.length;c<l;++c)if(o[c].name===t){o[c]=a;break}c===l&&o.push(a)}i.tween=o}}function Md(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ye(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?Cd:kd)(n,e,t))}function ur(e,t,n){var r=e._id;return e.each(function(){var o=Se(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return ye(o,r).value[t]}}function Ri(e,t){var n;return(typeof t=="number"?Ee:t instanceof Ye?Qt:(n=Ye(t))?(t=n,Qt):Ti)(e,t)}function Id(e){return function(){this.removeAttribute(e)}}function Ad(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Td(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function Od(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function Pd(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function $d(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function jd(e,t){var n=fn(e),r=n==="transform"?gd:Ri;return this.attrTween(e,typeof t=="function"?(n.local?$d:Pd)(n,r,ur(this,"attr."+e,t)):t==null?(n.local?Ad:Id)(n):(n.local?Od:Td)(n,r,t))}function Ld(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Dd(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Rd(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Dd(e,i)),n}return o._value=t,o}function Hd(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ld(e,i)),n}return o._value=t,o}function zd(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=fn(e);return this.tween(n,(r.local?Rd:Hd)(r,t))}function Fd(e,t){return function(){lr(this,e).delay=+t.apply(this,arguments)}}function Bd(e,t){return t=+t,function(){lr(this,e).delay=t}}function Vd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Fd:Bd)(t,e)):ye(this.node(),t).delay}function Yd(e,t){return function(){Se(this,e).duration=+t.apply(this,arguments)}}function Xd(e,t){return t=+t,function(){Se(this,e).duration=t}}function Wd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Yd:Xd)(t,e)):ye(this.node(),t).duration}function Gd(e,t){if(typeof t!="function")throw new Error;return function(){Se(this,e).ease=t}}function qd(e){var t=this._id;return arguments.length?this.each(Gd(t,e)):ye(this.node(),t).ease}function Kd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Se(this,e).ease=n}}function Ud(e){if(typeof e!="function")throw new Error;return this.each(Kd(this._id,e))}function Zd(e){typeof e!="function"&&(e=pi(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new Te(r,this._parents,this._name,this._id)}function Qd(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=t[a],l=n[a],u=c.length,d=s[a]=new Array(u),f,h=0;h<u;++h)(f=c[h]||l[h])&&(d[h]=f);for(;a<r;++a)s[a]=t[a];return new Te(s,this._parents,this._name,this._id)}function Jd(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 ef(e,t,n){var r,o,i=Jd(t)?lr:Se;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function tf(e,t){var n=this._id;return arguments.length<2?ye(this.node(),n).on.on(e):this.each(ef(n,e,t))}function nf(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function rf(){return this.on("end.remove",nf(this._id))}function of(e){var t=this._name,n=this._id;typeof e!="function"&&(e=or(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,l=i[s]=new Array(c),u,d,f=0;f<c;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),l[f]=d,gn(l[f],t,n,f,l,ye(u,n)));return new Te(i,this._parents,t,n)}function sf(e){var t=this._name,n=this._id;typeof e!="function"&&(e=gi(e));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),h,g=ye(u,n),v=0,w=f.length;v<w;++v)(h=f[v])&&gn(h,t,n,v,f,g);i.push(f),s.push(u)}return new Te(i,s,t,n)}var af=Ct.prototype.constructor;function cf(){return new af(this._groups,this._parents)}function lf(e,t){var n,r,o;return function(){var i=et(this,e),s=(this.style.removeProperty(e),et(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function Hi(e){return function(){this.style.removeProperty(e)}}function uf(e,t,n){var r,o=n+"",i;return function(){var s=et(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function df(e,t,n){var r,o,i;return function(){var s=et(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),et(this,e))),s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a))}}function ff(e,t){var n,r,o,i="style."+t,s="end."+i,a;return function(){var c=Se(this,e),l=c.on,u=c.value[i]==null?a||(a=Hi(t)):void 0;(l!==n||o!==u)&&(r=(n=l).copy()).on(s,o=u),c.on=r}}function hf(e,t,n){var r=(e+="")=="transform"?hd:Ri;return t==null?this.styleTween(e,lf(e,r)).on("end.style."+e,Hi(e)):typeof t=="function"?this.styleTween(e,df(e,r,ur(this,"style."+e,t))).each(ff(this._id,e)):this.styleTween(e,uf(e,r,t),n).on("end.style."+e,null)}function gf(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function pf(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&gf(e,s,n)),r}return i._value=t,i}function mf(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,pf(e,t,n??""))}function yf(e){return function(){this.textContent=e}}function xf(e){return function(){var t=e(this);this.textContent=t??""}}function wf(e){return this.tween("text",typeof e=="function"?xf(ur(this,"text",e)):yf(e==null?"":e+""))}function vf(e){return function(t){this.textContent=e.call(this,t)}}function bf(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&vf(o)),t}return r._value=e,r}function Ef(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,bf(e))}function _f(){for(var e=this._name,t=this._id,n=zi(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=ye(c,t);gn(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Te(r,this._parents,e,n)}function Nf(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var l=Se(this,r),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),o===0&&i()})}var Sf=0;function Te(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function zi(){return++Sf}var Ie=Ct.prototype;Te.prototype={constructor:Te,select:of,selectAll:sf,selectChild:Ie.selectChild,selectChildren:Ie.selectChildren,filter:Zd,merge:Qd,selection:cf,transition:_f,call:Ie.call,nodes:Ie.nodes,node:Ie.node,size:Ie.size,empty:Ie.empty,each:Ie.each,on:tf,attr:jd,attrTween:zd,style:hf,styleTween:mf,text:wf,textTween:Ef,remove:rf,tween:Md,delay:Vd,duration:Wd,ease:qd,easeVarying:Ud,end:Nf,[Symbol.iterator]:Ie[Symbol.iterator]};function Cf(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var kf={time:null,delay:0,duration:250,ease:Cf};function Mf(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 If(e){var t,n;e instanceof Te?(t=e._id,e=e._name):(t=zi(),(n=kf).time=cr(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&gn(c,e,t,l,s,n||Mf(c,t));return new Te(r,this._parents,e,t)}Ct.prototype.interrupt=Sd;Ct.prototype.transition=If;const Ht=e=>()=>e;function Af(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){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:o}})}function Ae(e,t,n){this.k=e,this.x=t,this.y=n}Ae.prototype={constructor:Ae,scale:function(e){return e===1?this:new Ae(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ae(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 pn=new Ae(1,0,0);Fi.prototype=Ae.prototype;function Fi(e){for(;!e.__zoom;)if(!(e=e.parentNode))return pn;return e.__zoom}function Tn(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function Tf(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Of(){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 Jr(){return this.__zoom||pn}function Pf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function $f(){return navigator.maxTouchPoints||"ontouchstart"in this}function jf(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Bi(){var e=Tf,t=Of,n=jf,r=Pf,o=$f,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Xt,l=dn("start","zoom","end"),u,d,f,h=500,g=150,v=0,w=10;function m(y){y.property("__zoom",Jr).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",z).filter(o).on("touchstart.zoom",O).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",P).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,N,C,A){var j=y.selection?y.selection():y;j.property("__zoom",Jr),y!==j?_(y,N,C,A):j.interrupt().each(function(){S(this,arguments).event(A).start().zoom(null,typeof N=="function"?N.apply(this,arguments):N).end()})},m.scaleBy=function(y,N,C,A){m.scaleTo(y,function(){var j=this.__zoom.k,T=typeof N=="function"?N.apply(this,arguments):N;return j*T},C,A)},m.scaleTo=function(y,N,C,A){m.transform(y,function(){var j=t.apply(this,arguments),T=this.__zoom,D=C==null?x(j):typeof C=="function"?C.apply(this,arguments):C,F=T.invert(D),H=typeof N=="function"?N.apply(this,arguments):N;return n(p(b(T,H),D,F),j,s)},C,A)},m.translateBy=function(y,N,C,A){m.transform(y,function(){return n(this.__zoom.translate(typeof N=="function"?N.apply(this,arguments):N,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),s)},null,A)},m.translateTo=function(y,N,C,A,j){m.transform(y,function(){var T=t.apply(this,arguments),D=this.__zoom,F=A==null?x(T):typeof A=="function"?A.apply(this,arguments):A;return n(pn.translate(F[0],F[1]).scale(D.k).translate(typeof N=="function"?-N.apply(this,arguments):-N,typeof C=="function"?-C.apply(this,arguments):-C),T,s)},A,j)};function b(y,N){return N=Math.max(i[0],Math.min(i[1],N)),N===y.k?y:new Ae(N,y.x,y.y)}function p(y,N,C){var A=N[0]-C[0]*y.k,j=N[1]-C[1]*y.k;return A===y.x&&j===y.y?y:new Ae(y.k,A,j)}function x(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function _(y,N,C,A){y.on("start.zoom",function(){S(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(A).end()}).tween("zoom",function(){var j=this,T=arguments,D=S(j,T).event(A),F=t.apply(j,T),H=C==null?x(F):typeof C=="function"?C.apply(j,T):C,V=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),Y=j.__zoom,q=typeof N=="function"?N.apply(j,T):N,J=c(Y.invert(H).concat(V/Y.k),q.invert(H).concat(V/q.k));return function(G){if(G===1)G=q;else{var R=J(G),B=V/R[2];G=new Ae(B,H[0]-R[0]*B,H[1]-R[1]*B)}D.zoom(null,G)}})}function S(y,N,C){return!C&&y.__zooming||new k(y,N)}function k(y,N){this.that=y,this.args=N,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,N),this.taps=0}k.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,N){return this.mouse&&y!=="mouse"&&(this.mouse[1]=N.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=N.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=N.invert(this.touch1[0])),this.that.__zoom=N,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var N=ce(this.that).datum();l.call(y,this.that,new Af(y,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),N)}};function M(y,...N){if(!e.apply(this,arguments))return;var C=S(this,N).event(y),A=this.__zoom,j=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,r.apply(this,arguments)))),T=fe(y);if(C.wheel)(C.mouse[0][0]!==T[0]||C.mouse[0][1]!==T[1])&&(C.mouse[1]=A.invert(C.mouse[0]=T)),clearTimeout(C.wheel);else{if(A.k===j)return;C.mouse=[T,A.invert(T)],qt(this),C.start()}ut(y),C.wheel=setTimeout(D,g),C.zoom("mouse",n(p(b(A,j),C.mouse[0],C.mouse[1]),C.extent,s));function D(){C.wheel=null,C.end()}}function I(y,...N){if(f||!e.apply(this,arguments))return;var C=y.currentTarget,A=S(this,N,!0).event(y),j=ce(y.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",V,!0),T=fe(y,C),D=y.clientX,F=y.clientY;Si(y.view),Tn(y),A.mouse=[T,this.__zoom.invert(T)],qt(this),A.start();function H(Y){if(ut(Y),!A.moved){var q=Y.clientX-D,J=Y.clientY-F;A.moved=q*q+J*J>v}A.event(Y).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=fe(Y,C),A.mouse[1]),A.extent,s))}function V(Y){j.on("mousemove.zoom mouseup.zoom",null),Ci(Y.view,A.moved),ut(Y),A.event(Y).end()}}function z(y,...N){if(e.apply(this,arguments)){var C=this.__zoom,A=fe(y.changedTouches?y.changedTouches[0]:y,this),j=C.invert(A),T=C.k*(y.shiftKey?.5:2),D=n(p(b(C,T),A,j),t.apply(this,N),s);ut(y),a>0?ce(this).transition().duration(a).call(_,D,A,y):ce(this).call(m.transform,D,A,y)}}function O(y,...N){if(e.apply(this,arguments)){var C=y.touches,A=C.length,j=S(this,N,y.changedTouches.length===A).event(y),T,D,F,H;for(Tn(y),D=0;D<A;++D)F=C[D],H=fe(F,this),H=[H,this.__zoom.invert(H),F.identifier],j.touch0?!j.touch1&&j.touch0[2]!==H[2]&&(j.touch1=H,j.taps=0):(j.touch0=H,T=!0,j.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(j.taps<2&&(d=H[0],u=setTimeout(function(){u=null},h)),qt(this),j.start())}}function $(y,...N){if(this.__zooming){var C=S(this,N).event(y),A=y.changedTouches,j=A.length,T,D,F,H;for(ut(y),T=0;T<j;++T)D=A[T],F=fe(D,this),C.touch0&&C.touch0[2]===D.identifier?C.touch0[0]=F:C.touch1&&C.touch1[2]===D.identifier&&(C.touch1[0]=F);if(D=C.that.__zoom,C.touch1){var V=C.touch0[0],Y=C.touch0[1],q=C.touch1[0],J=C.touch1[1],G=(G=q[0]-V[0])*G+(G=q[1]-V[1])*G,R=(R=J[0]-Y[0])*R+(R=J[1]-Y[1])*R;D=b(D,Math.sqrt(G/R)),F=[(V[0]+q[0])/2,(V[1]+q[1])/2],H=[(Y[0]+J[0])/2,(Y[1]+J[1])/2]}else if(C.touch0)F=C.touch0[0],H=C.touch0[1];else return;C.zoom("touch",n(p(D,F,H),C.extent,s))}}function P(y,...N){if(this.__zooming){var C=S(this,N).event(y),A=y.changedTouches,j=A.length,T,D;for(Tn(y),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),T=0;T<j;++T)D=A[T],C.touch0&&C.touch0[2]===D.identifier?delete C.touch0:C.touch1&&C.touch1[2]===D.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(D=fe(D,this),Math.hypot(d[0]-D[0],d[1]-D[1])<w)){var F=ce(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(r=typeof y=="function"?y:Ht(+y),m):r},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Ht(!!y),m):e},m.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:Ht(!!y),m):o},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Ht([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],m):[i[0],i[1]]},m.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(c=y,m):c},m.on=function(){var y=l.on.apply(l,arguments);return y===l?m:y},m.clickDistance=function(y){return arguments.length?(v=(y=+y)*y,m):Math.sqrt(v)},m.tapDistance=function(y){return arguments.length?(w=+y,m):w},m}const me={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle: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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},vt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Vi=["Enter"," ","Escape"],Yi={"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 nt;(function(e){e.Strict="strict",e.Loose="loose"})(nt||(nt={}));var Ve;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ve||(Ve={}));var bt;(function(e){e.Partial="partial",e.Full="full"})(bt||(bt={}));const Xi={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var je;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(je||(je={}));var nn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(nn||(nn={}));var W;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(W||(W={}));const eo={[W.Left]:W.Right,[W.Right]:W.Left,[W.Top]:W.Bottom,[W.Bottom]:W.Top},Wi=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,Lf=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),dr=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Mt=(e,t=[0,0])=>{const{width:n,height:r}=xe(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},Df=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1;const r=e.reduce((o,i)=>{const s=typeof i=="string";let a=!t.nodeLookup&&!s?i:void 0;return t.nodeLookup&&(a=s?t.nodeLookup.get(i):dr(i)?i:t.nodeLookup.get(i.id)),a?(n=!0,mn(o,rn(a,t.nodeOrigin))):o},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?yn(r):{x:0,y:0,width:0,height:0}},It=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=mn(n,rn(o)),r=!0)}),r?yn(n):{x:0,y:0,width:0,height:0}},fr=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/o,c=(t.y-r)/o,l=t.width/o,u=t.height/o,d=[];for(const f of e.values()){const{measured:h,selectable:g=!0,hidden:v=!1}=f;if(s&&!g||v)continue;const w=h.width??f.width??f.initialWidth??0,m=h.height??f.height??f.initialHeight??0,{x:b,y:p}=f.internals.positionAbsolute,x=Ui(a,c,l,u,b,p,w,m),_=w*m,S=i&&x>0;(!f.internals.handleBounds||S||x>=_||f.dragging)&&d.push(f)}return d},Rf=(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 Hf(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{let i;if(t!=null&&t.includeHiddenNodes){const{width:s,height:a}=xe(o);i=s>0&&a>0}else i=!!(o.measured.width&&o.measured.height&&!o.hidden);i&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function zf({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return!0;const a=Hf(e,s),c=It(a),l=gr(c,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),!0}function Gi({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??r;let d=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",me.error005());else{const{width:h,height:g}=xe(a);h&&g&&(d=[[c,l],[c+h,l+g]])}else a&&Ge(s.extent)&&(d=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const f=Ge(d)?We(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",me.error015())),{position:{x:f.x-c+(s.measured.width??0)*u[0],y:f.y-l+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function Ff({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(v=>v.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),u=Rf(s,c);for(const f of c)a.has(f.id)&&!u.find(g=>g.id===f.id)&&u.push(f);if(!o)return{edges:u,nodes:s};const d=await o({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const rt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),We=(e={x:0,y:0},t,n)=>({x:rt(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:rt(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function qi(e,t,n){const{width:r,height:o}=xe(n),{x:i,y:s}=n.internals.positionAbsolute;return We(e,[[i,s],[i+r,s+o]],t)}const to=(e,t,n)=>e<t?rt(Math.abs(e-t),1,t)/t:e>n?-rt(Math.abs(e-n),1,t)/t:0,hr=(e,t,n=15,r=40)=>{const o=to(e.x,r,t.width-r)*n,i=to(e.y,r,t.height-r)*n;return[o,i]},mn=(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)}),Zn=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),yn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Et=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=dr(e)?e.internals.positionAbsolute:Mt(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},rn=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=dr(e)?e.internals.positionAbsolute:Mt(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},Ki=(e,t)=>yn(mn(Zn(e),Zn(t))),Ui=(e,t,n,r,o,i,s,a)=>{const c=Math.max(0,Math.min(e+n,o+s)-Math.max(e,o)),l=Math.max(0,Math.min(t+r,i+a)-Math.max(t,i));return Math.ceil(c*l)},on=(e,t)=>Ui(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),no=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),Zi=(e,t)=>(n,r)=>{},At=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Tt=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return i?At(a,s):a},ot=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function Ue(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Bf(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Ue(e,n),o=Ue(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=Ue(e.top??e.y??0,n),o=Ue(e.bottom??e.y??0,n),i=Ue(e.left??e.x??0,t),s=Ue(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Vf(e,t,n,r,o,i){const{x:s,y:a}=ot(e,[t,n,r]),{x:c,y:l}=ot({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=o-c,d=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const gr=(e,t,n,r,o,i)=>{const s=Bf(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),u=rt(l,r,o),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*u,g=n/2-f*u,v=Vf(e,h,g,u,t,n),w={left:Math.min(v.left-s.left,0),top:Math.min(v.top-s.top,0),right:Math.min(v.right-s.right,0),bottom:Math.min(v.bottom-s.bottom,0)};return{x:h-w.left+w.right,y:g-w.top+w.bottom,zoom:u}},_t=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ge(e){return e!=null&&e!=="parent"}function xe(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Qi(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function Ji(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function ro(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Yf(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function Xf(e){return{...Yi,...e||{}}}function es(e){return e===null?null:e?"valid":"invalid"}function pt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=pe(e),a=Tt({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:c,y:l}=n?At(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const pr=e=>({width:e.offsetWidth,height:e.offsetHeight}),ts=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Wf=["INPUT","SELECT","TEXTAREA"];function ns(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Wf.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const rs=e=>"clientX"in e,pe=(e,t)=>{var i,s;const n=rs(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},oo=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...pr(s)}})};function os({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+o*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+r*.125,u=Math.abs(c-e),d=Math.abs(l-t);return[c,l,u,d]}function zt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function io({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case W.Left:return[t-zt(t-r,i),n];case W.Right:return[t+zt(r-t,i),n];case W.Top:return[t,n-zt(n-o,i)];case W.Bottom:return[t,n+zt(o-n,i)]}}function is({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:o,targetPosition:i=W.Top,curvature:s=.25}){const[a,c]=io({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[l,u]=io({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[d,f,h,g]=os({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${c} ${l},${u} ${r},${o}`,d,f,h,g]}function ss({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[i,a,o,s]}function Gf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const s=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return s+a}function qf({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=mn(rn(e),rn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return on(s,yn(i))>0}const Kf=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Uf=(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)),Zf=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",me.error006()),t;const r=n.getEdgeId||Kf;let o;return Wi(e)?o={...e}:o={...e,id:r(e)},Uf(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function as({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=ss({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const so={[W.Left]:{x:-1,y:0},[W.Right]:{x:1,y:0},[W.Top]:{x:0,y:-1},[W.Bottom]:{x:0,y:1}},Qf=({source:e,sourcePosition:t=W.Bottom,target:n})=>t===W.Left||t===W.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},ao=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Jf({source:e,sourcePosition:t=W.Bottom,target:n,targetPosition:r=W.Top,center:o,offset:i,stepPosition:s}){const a=so[t],c=so[r],l={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+c.x*i,y:n.y+c.y*i},d=Qf({source:l,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",h=d[f];let g=[],v,w;const m={x:0,y:0},b={x:0,y:0},[,,p,x]=ss({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(v=o.x??l.x+(u.x-l.x)*s,w=o.y??(l.y+u.y)/2):(v=o.x??(l.x+u.x)/2,w=o.y??l.y+(u.y-l.y)*s);const M=[{x:v,y:l.y},{x:v,y:u.y}],I=[{x:l.x,y:w},{x:u.x,y:w}];a[f]===h?g=f==="x"?M:I:g=f==="x"?I:M}else{const M=[{x:l.x,y:u.y}],I=[{x:u.x,y:l.y}];if(f==="x"?g=a.x===h?I:M:g=a.y===h?M:I,t===r){const y=Math.abs(e[f]-n[f]);if(y<=i){const N=Math.min(i-1,i-y);a[f]===h?m[f]=(l[f]>e[f]?-1:1)*N:b[f]=(u[f]>n[f]?-1:1)*N}}if(t!==r){const y=f==="x"?"y":"x",N=a[f]===c[y],C=l[y]>u[y],A=l[y]<u[y];(a[f]===1&&(!N&&C||N&&A)||a[f]!==1&&(!N&&A||N&&C))&&(g=f==="x"?M:I)}const z={x:l.x+m.x,y:l.y+m.y},O={x:u.x+b.x,y:u.y+b.y},$=Math.max(Math.abs(z.x-g[0].x),Math.abs(O.x-g[0].x)),P=Math.max(Math.abs(z.y-g[0].y),Math.abs(O.y-g[0].y));$>=P?(v=(z.x+O.x)/2,w=g[0].y):(v=g[0].x,w=(z.y+O.y)/2)}const _={x:l.x+m.x,y:l.y+m.y},S={x:u.x+b.x,y:u.y+b.y};return[[e,..._.x!==g[0].x||_.y!==g[0].y?[_]:[],...g,...S.x!==g[g.length-1].x||S.y!==g[g.length-1].y?[S]:[],n],v,w,p,x]}function eh(e,t,n,r){const o=Math.min(ao(e,t)/2,ao(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+o*l},${s}Q ${i},${s} ${i},${s+o*u}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+o*c}Q ${i},${s} ${i+o*a},${s}`}function Qn({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:o,targetPosition:i=W.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:u=.5}){const[d,f,h,g,v]=Jf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:u});let w=`M${d[0].x} ${d[0].y}`;for(let m=1;m<d.length-1;m++)w+=eh(d[m-1],d[m],d[m+1],s);return w+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[w,f,h,g,v]}function co(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function th(e){var d;const{sourceNode:t,targetNode:n}=e;if(!co(t)||!co(n))return null;const r=t.internals.handleBounds||lo(t.handles),o=n.internals.handleBounds||lo(n.handles),i=uo((r==null?void 0:r.source)??[],e.sourceHandle),s=uo(e.connectionMode===nt.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!s)return(d=e.onError)==null||d.call(e,"008",me.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||W.Bottom,c=(s==null?void 0:s.position)||W.Top,l=qe(t,i,a),u=qe(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function lo(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 qe(e,t,n=W.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??xe(e);if(r)return{x:o+s/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case W.Top:return{x:o+s/2,y:i};case W.Right:return{x:o+s,y:i+a/2};case W.Bottom:return{x:o+s/2,y:i+a};case W.Left:return{x:o,y:i+a/2}}}function uo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Jn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function nh(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const l=Jn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const cs=1e3,rh=10,mr={nodeOrigin:[0,0],nodeExtent:vt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},oh={...mr,checkEquality:!0};function yr(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function ih(e,t,n){const r=yr(mr,n);for(const o of e.values())if(o.parentId)wr(o,e,t,r);else{const i=Mt(o,r.nodeOrigin),s=Ge(o.extent)?o.extent:r.nodeExtent,a=We(i,s,xe(o));o.internals.positionAbsolute=a}}function sh(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function xr(e){return e==="manual"}function er(e,t,n,r={}){var u,d;const o=yr(oh,r),i={i:0},s=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!xr(o.zIndexMode)?cs:0;let c=e.length>0,l=!1;t.clear(),n.clear();for(const f of e){let h=s.get(f.id);if(o.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const g=Mt(f,o.nodeOrigin),v=Ge(f.extent)?f.extent:o.nodeExtent,w=We(g,v,xe(f));h={...o.defaults,...f,measured:{width:(u=f.measured)==null?void 0:u.width,height:(d=f.measured)==null?void 0:d.height},internals:{positionAbsolute:w,handleBounds:sh(f,h),z:ls(f,a,o.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&wr(h,t,n,r,i),l||(l=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:l}}function ah(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 wr(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=yr(mr,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}ah(e,n),o&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++o.i,u.internals.z=u.internals.z+o.i*rh),o&&u.internals.rootParentIndex!==void 0&&(o.i=u.internals.rootParentIndex);const d=i&&!xr(c)?cs:0,{x:f,y:h,z:g}=ch(e,u,s,a,d,c),{positionAbsolute:v}=e.internals,w=f!==v.x||h!==v.y;(w||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:f,y:h}:v,z:g}})}function ls(e,t,n){const r=ge(e.zIndex)?e.zIndex:0;return xr(n)?r:r+(e.selected?t:0)}function ch(e,t,n,r,o,i){const{x:s,y:a}=t.internals.positionAbsolute,c=xe(e),l=Mt(e,n),u=Ge(e.extent)?We(l,e.extent,c):l;let d=We({x:s+u.x,y:a+u.y},r,c);e.extent==="parent"&&(d=qi(d,c,t));const f=ls(e,o,i),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function vr(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Et(c),u=Ki(l,a.rect);i.set(a.parentId,{expandedRect:u,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var p;const u=c.internals.positionAbsolute,d=xe(c),f=c.origin??r,h=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,g=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,v=Math.max(d.width,Math.round(a.width)),w=Math.max(d.height,Math.round(a.height)),m=(v-d.width)*f[0],b=(w-d.height)*f[1];(h>0||g>0||m||b)&&(o.push({id:l,type:"position",position:{x:c.position.x-h+m,y:c.position.y-g+b}}),(p=n.get(l))==null||p.forEach(x=>{e.some(_=>_.id===x.id)||o.push({id:x.id,type:"position",position:{x:x.position.x+h,y:x.position.y+g}})})),(d.width<a.width||d.height<a.height||h||g)&&o.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:v+(h?f[0]*h-m:0),height:w+(g?f[1]*g-b:0)}})}),o}function lh(e,t,n,r,o,i,s){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const v=pr(h.nodeElement),w=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(w||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Ge(g.extent)?g.extent:i;let{positionAbsolute:x}=g.internals;if(g.parentId&&g.extent==="parent"){const S=t.get(g.parentId);S&&(x=qi(x,v,S))}else p&&(x=We(x,p,v));const _={...g,measured:v,internals:{...g.internals,positionAbsolute:x,handleBounds:{source:oo("source",h.nodeElement,b,d,g.id),target:oo("target",h.nodeElement,b,d,g.id)}}};t.set(g.id,_),g.parentId&&wr(_,t,n,{nodeOrigin:o,zIndexMode:s}),c=!0,w&&(l.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Et(_,o)}))}}if(f.length>0){const h=vr(f,t,n,o);l.push(...h)}return{changes:l,updatedInternals:c}}async function uh({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function fo(e,t,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${o}-${e}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,t)),i){s=`${o}-${e}-${i}`;const l=r.get(s)||new Map;r.set(s,l.set(n,t))}}function us(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},l=`${o}-${s}--${i}-${a}`,u=`${i}-${a}--${o}-${s}`;fo("source",c,u,e,o,s),fo("target",c,l,e,i,a),t.set(r.id,r)}}function ds(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:ds(n,t):!1}function ho(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function dh(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!ds(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&o.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function On({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,a,c;const o=[];for(const[l,u]of t){const d=(s=n.get(l))==null?void 0:s.internals.userNode;d&&o.push({...d,position:u.position,dragging:r})}if(!e)return[o[0],o];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:o[0],o]}function fh({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=At(i,t);return{x:s.x-i.x,y:s.y-i.y}}function hh({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,h=!1,g=!1,v=null;function w({noDragClassName:b,handleSelector:p,domNode:x,isSelectable:_,nodeId:S,nodeClickDistance:k=0}){f=ce(x);function M({x:$,y:P}){const{nodeLookup:y,nodeExtent:N,snapGrid:C,snapToGrid:A,nodeOrigin:j,onNodeDrag:T,onSelectionDrag:D,onError:F,updateNodePositions:H}=t();i={x:$,y:P};let V=!1;const Y=a.size>1,q=Y&&N?Zn(It(a)):null,J=Y&&A?fh({dragItems:a,snapGrid:C,x:$,y:P}):null;for(const[G,R]of a){if(!y.has(G))continue;let B={x:$-R.distance.x,y:P-R.distance.y};A&&(B=J?{x:Math.round(B.x+J.x),y:Math.round(B.y+J.y)}:At(B,C));let K=null;if(Y&&N&&!R.extent&&q){const{positionAbsolute:Z}=R.internals,Q=Z.x-q.x+N[0][0],ee=Z.x+R.measured.width-q.x2+N[1][0],ne=Z.y-q.y+N[0][1],re=Z.y+R.measured.height-q.y2+N[1][1];K=[[Q,ne],[ee,re]]}const{position:U,positionAbsolute:X}=Gi({nodeId:G,nextPosition:B,nodeLookup:y,nodeExtent:K||N,nodeOrigin:j,onError:F});V=V||R.position.x!==U.x||R.position.y!==U.y,R.position=U,R.internals.positionAbsolute=X}if(g=g||V,!!V&&(H(a,!0),v&&(r||T||!S&&D))){const[G,R]=On({nodeId:S,dragItems:a,nodeLookup:y});r==null||r(v,a,G,R),T==null||T(v,G,R),S||D==null||D(v,R)}}async function I(){if(!u)return;const{transform:$,panBy:P,autoPanSpeed:y,autoPanOnNodeDrag:N}=t();if(!N){c=!1,cancelAnimationFrame(s);return}const[C,A]=hr(l,u,y);(C!==0||A!==0)&&(i.x=(i.x??0)-C/$[2],i.y=(i.y??0)-A/$[2],await P({x:C,y:A})&&M(i)),s=requestAnimationFrame(I)}function z($){var Y;const{nodeLookup:P,multiSelectionActive:y,nodesDraggable:N,transform:C,snapGrid:A,snapToGrid:j,selectNodesOnDrag:T,onNodeDragStart:D,onSelectionDragStart:F,unselectNodesAndEdges:H}=t();d=!0,(!T||!_)&&!y&&S&&((Y=P.get(S))!=null&&Y.selected||H()),_&&T&&S&&(e==null||e(S));const V=pt($.sourceEvent,{transform:C,snapGrid:A,snapToGrid:j,containerBounds:u});if(i=V,a=dh(P,N,V,S),a.size>0&&(n||D||!S&&F)){const[q,J]=On({nodeId:S,dragItems:a,nodeLookup:P});n==null||n($.sourceEvent,a,q,J),D==null||D($.sourceEvent,q,J),S||F==null||F($.sourceEvent,J)}}const O=ki().clickDistance(k).on("start",$=>{const{domNode:P,nodeDragThreshold:y,transform:N,snapGrid:C,snapToGrid:A}=t();u=(P==null?void 0:P.getBoundingClientRect())||null,h=!1,g=!1,v=$.sourceEvent,y===0&&z($),i=pt($.sourceEvent,{transform:N,snapGrid:C,snapToGrid:A,containerBounds:u}),l=pe($.sourceEvent,u)}).on("drag",$=>{const{autoPanOnNodeDrag:P,transform:y,snapGrid:N,snapToGrid:C,nodeDragThreshold:A,nodeLookup:j}=t(),T=pt($.sourceEvent,{transform:y,snapGrid:N,snapToGrid:C,containerBounds:u});if(v=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||S&&!j.has(S))&&(h=!0),!h){if(!c&&P&&d&&(c=!0,I()),!d){const D=pe($.sourceEvent,u),F=D.x-l.x,H=D.y-l.y;Math.sqrt(F*F+H*H)>A&&z($)}(i.x!==T.xSnapped||i.y!==T.ySnapped)&&a&&d&&(l=pe($.sourceEvent,u),M(T))}}).on("end",$=>{if(!d||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,d=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:P,updateNodePositions:y,onNodeDragStop:N,onSelectionDragStop:C}=t();if(g&&(y(a,!1),g=!1),o||N||!S&&C){const[A,j]=On({nodeId:S,dragItems:a,nodeLookup:P,dragging:!1});o==null||o($.sourceEvent,a,A,j),N==null||N($.sourceEvent,A,j),S||C==null||C($.sourceEvent,j)}}}).filter($=>{const P=$.target;return!$.button&&(!b||!ho(P,`.${b}`,x))&&(!p||ho(P,p,x))});f.call(O)}function m(){f==null||f.on(".drag",null)}return{update:w,destroy:m}}function gh(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())on(o,Et(i))>0&&r.push(i);return r}const ph=250;function mh(e,t,n,r){var a,c;let o=[],i=1/0;const s=gh(e,n,t+ph);for(const l of s){const u=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of u){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:f,y:h}=qe(l,d,d.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(o=[{...d,x:f,y:h}],i=g):g===i&&o.push({...d,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const l=r.type==="source"?"target":"source";return o.find(u=>u.type===l)??o[0]}return o[0]}function fs(e,t,n,r,o,i=!1){var l,u,d;const s=r.get(e);if(!s)return null;const a=o==="strict"?(l=s.internals.handleBounds)==null?void 0:l[t]:[...((u=s.internals.handleBounds)==null?void 0:u.source)??[],...((d=s.internals.handleBounds)==null?void 0:d.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...qe(s,c,c.position,!0)}:c}function hs(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function yh(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const gs=()=>!0;function xh(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:w,isValidConnection:m=gs,onReconnectEnd:b,updateConnection:p,getTransform:x,getFromHandle:_,autoPanSpeed:S,dragThreshold:k=1,handleDomNode:M}){const I=ts(e.target);let z=0,O;const{x:$,y:P}=pe(e),y=hs(i,M),N=a==null?void 0:a.getBoundingClientRect();let C=!1;if(!N||!y)return;const A=fs(o,y,r,c,t);if(!A)return;let j=pe(e,N),T=!1,D=null,F=!1,H=null;function V(){if(!u||!N)return;const[U,X]=hr(j,N,S);f({x:U,y:X}),z=requestAnimationFrame(V)}const Y={...A,nodeId:o,type:y,position:A.position},q=c.get(o);let G={inProgress:!0,isValid:null,from:qe(q,Y,W.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:q,to:j,toHandle:null,toPosition:eo[Y.position],toNode:null,pointer:j};function R(){C=!0,p(G),g==null||g(e,{nodeId:o,handleId:r,handleType:y})}k===0&&R();function B(U){if(!C){const{x:re,y:ue}=pe(U),ve=re-$,be=ue-P;if(!(ve*ve+be*be>k*k))return;R()}if(!_()||!Y){K(U);return}const X=x();j=pe(U,N),O=mh(Tt(j,X,!1,[1,1]),n,c,Y),T||(V(),T=!0);const Z=ps(U,{handle:O,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:m,doc:I,lib:l,flowId:d,nodeLookup:c});H=Z.handleDomNode,D=Z.connection,F=yh(!!O,Z.isValid);const Q=c.get(o),ee=Q?qe(Q,Y,W.Left,!0):G.from,ne={...G,from:ee,isValid:F,to:Z.toHandle&&F?ot({x:Z.toHandle.x,y:Z.toHandle.y},X):j,toHandle:Z.toHandle,toPosition:F&&Z.toHandle?Z.toHandle.position:eo[Y.position],toNode:Z.toHandle?c.get(Z.toHandle.nodeId):null,pointer:j};p(ne),G=ne}function K(U){if(!("touches"in U&&U.touches.length>0)){if(C){(O||H)&&D&&F&&(v==null||v(D));const{inProgress:X,...Z}=G,Q={...Z,toPosition:G.toHandle?G.toPosition:null};w==null||w(U,Q),i&&(b==null||b(U,Q))}h(),cancelAnimationFrame(z),T=!1,F=!1,D=null,H=null,I.removeEventListener("mousemove",B),I.removeEventListener("mouseup",K),I.removeEventListener("touchmove",B),I.removeEventListener("touchend",K)}}I.addEventListener("mousemove",B),I.addEventListener("mouseup",K),I.addEventListener("touchmove",B),I.addEventListener("touchend",K)}function ps(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=gs,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=pe(e),v=s.elementFromPoint(h,g),w=v!=null&&v.classList.contains(`${a}-flow__handle`)?v:f,m={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const b=hs(void 0,w),p=w.getAttribute("data-nodeid"),x=w.getAttribute("data-handleid"),_=w.classList.contains("connectable"),S=w.classList.contains("connectableend");if(!p||!b)return m;const k={source:d?p:r,sourceHandle:d?x:o,target:d?r:p,targetHandle:d?o:x};m.connection=k;const I=_&&S&&(n===nt.Strict?d&&b==="source"||!d&&b==="target":p!==r||x!==o);m.isValid=I&&l(k),m.toHandle=fs(p,b,x,u,n,!0)}return m}const tr={onPointerDown:xh,isValid:ps};function wh({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=ce(e);function i({translateExtent:a,width:c,height:l,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const x=n(),_=p.sourceEvent.ctrlKey&&_t()?10:1,S=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,k=x[2]*Math.pow(2,S*_);t.scaleTo(k)};let v=[0,0];const w=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(v=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const x=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const _=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],S=[_[0]-v[0],_[1]-v[1]];v=_;const k=r()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),M={x:x[0]-S[0]*k,y:x[1]-S[1]*k},I=[[0,0],[c,l]];t.setViewportConstrained({x:M.x,y:M.y,zoom:x[2]},I,a)},b=Bi().on("start",w).on("zoom",d?m:null).on("zoom.wheel",f?g:null);o.call(b,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const xn=e=>({x:e.x,y:e.y,zoom:e.k}),Pn=({x:e,y:t,zoom:n})=>pn.translate(e,t).scale(n),$e=(e,t)=>e.target.closest(`.${t}`),ms=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),vh=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,$n=(e,t=0,n=vh,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},ys=e=>{const t=e.ctrlKey&&_t()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function bh({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return u=>{if($e(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const w=fe(u),m=ys(u),b=d*Math.pow(2,m);r.scaleTo(n,b,w,u);return}const f=u.deltaMode===1?20:1;let h=o===Ve.Vertical?0:u.deltaX*f,g=o===Ve.Horizontal?0:u.deltaY*f;!_t()&&u.shiftKey&&o!==Ve.Vertical&&(h=u.deltaY*f,g=0),r.translateBy(n,-(h/d)*i,-(g/d)*i,{internal:!0});const v=xn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c==null||c(u,v):(e.isPanScrolling=!0,a==null||a(u,v)),e.panScrollTimeout=setTimeout(()=>{l==null||l(u,v),e.isPanScrolling=!1},150)}}function Eh({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,a=$e(r,e);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function _h({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=xn(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function Nh({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&ms(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((a=i.sourceEvent)!=null&&a.internal)&&(o==null||o(i.sourceEvent,xn(i.transform)))}}function Sh({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&ms(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=xn(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,c)},n?150:0)}}}function Ch({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:o,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{var m;const h=t||n,g=r&&f.ctrlKey,v=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&($e(f,`${u}-flow__node`)||$e(f,`${u}-flow__edge`)||$e(f,`${u}-flow__selection`)||$e(f,`${u}-flow__nodesselection`)))return!0;if(!o&&!h&&!i&&!s&&!r||a||d&&!v||$e(f,c)&&v||$e(f,l)&&(!v||i&&v&&!t)||!r&&f.ctrlKey&&v)return!1;if(!r&&f.type==="touchstart"&&((m=f.touches)==null?void 0:m.length)>1)return f.preventDefault(),!1;if(!h&&!i&&!g&&v||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||v||e)&&w}}function kh({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect();let d=[[0,0],[u.width,u.height]];const f=typeof ResizeObserver<"u"?new ResizeObserver(P=>{const y=P[0];y&&(d=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null;f==null||f.observe(e);const h=Bi().extent(()=>d).scaleExtent([t,n]).translateExtent(r),g=ce(e).call(h);x({x:o.x,y:o.y,zoom:rt(o.zoom,t,n)},[[0,0],[u.width,u.height]],r);const v=g.on("wheel.zoom"),w=g.on("dblclick.zoom");h.wheelDelta(ys);async function m(P,y){return g?new Promise(N=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?gt:Xt).transform($n(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>N(!0)),P)}):!1}function b({noWheelClassName:P,noPanClassName:y,onPaneContextMenu:N,userSelectionActive:C,panOnScroll:A,panOnDrag:j,panOnScrollMode:T,panOnScrollSpeed:D,preventScrolling:F,zoomOnPinch:H,zoomOnScroll:V,zoomOnDoubleClick:Y,panActivationKeyPressed:q=!1,zoomActivationKeyPressed:J,lib:G,onTransformChange:R,connectionInProgress:B,paneClickDistance:K,selectionOnDrag:U}){C&&!l.isZoomingOrPanning&&p();const X=A&&!J&&!C;h.clickDistance(U?1/0:!ge(K)||K<0?0:K);const Z=X?bh({zoomPanValues:l,noWheelClassName:P,d3Selection:g,d3Zoom:h,panOnScrollMode:T,panOnScrollSpeed:D,zoomOnPinch:H,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Eh({noWheelClassName:P,preventScrolling:F,d3ZoomHandler:v});g.on("wheel.zoom",Z,{passive:!1});const Q=_h({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});h.on("start",Q);const ee=Nh({zoomPanValues:l,panOnDrag:j,onPaneContextMenu:!!N,onPanZoom:i,onTransformChange:R});h.on("zoom",ee);const ne=Sh({zoomPanValues:l,panOnDrag:j,panOnScroll:A,onPaneContextMenu:N,onPanZoomEnd:a,onDraggingChange:c});h.on("end",ne);const re=Ch({panActivationKeyPressed:q,zoomActivationKeyPressed:J,panOnDrag:j,zoomOnScroll:V,panOnScroll:A,zoomOnDoubleClick:Y,zoomOnPinch:H,userSelectionActive:C,noPanClassName:y,noWheelClassName:P,lib:G,connectionInProgress:B});h.filter(re),Y?g.on("dblclick.zoom",w):g.on("dblclick.zoom",null)}function p(){h.on("zoom",null)}async function x(P,y,N){const C=Pn(P),A=h==null?void 0:h.constrain()(C,y,N);return A&&await m(A),A}async function _(P,y){const N=Pn(P);return await m(N,y),N}function S(P){if(g){const y=Pn(P),N=g.property("__zoom");(N.k!==P.zoom||N.x!==P.x||N.y!==P.y)&&(h==null||h.transform(g,y,null,{sync:!0}))}}function k(){const P=g?Fi(g.node()):{x:0,y:0,k:1};return{x:P.x,y:P.y,zoom:P.k}}async function M(P,y){return g?new Promise(N=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?gt:Xt).scaleTo($n(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>N(!0)),P)}):!1}async function I(P,y){return g?new Promise(N=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?gt:Xt).scaleBy($n(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>N(!0)),P)}):!1}function z(P){h==null||h.scaleExtent(P)}function O(P){h==null||h.translateExtent(P)}function $(P){const y=!ge(P)||P<0?0:P;h==null||h.clickDistance(y)}return{update:b,destroy:p,setViewport:_,setViewportConstrained:x,getViewport:k,scaleTo:M,scaleBy:I,setScaleExtent:z,setTranslateExtent:O,syncViewport:S,setClickDistance:$}}var it;(function(e){e.Line="line",e.Handle="handle"})(it||(it={}));function Mh({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,a=n-r,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function go(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Oe(e,t){return Math.max(0,t-e)}function Pe(e,t){return Math.max(0,e-t)}function Ft(e,t,n){return Math.max(0,t-e,e-n)}function po(e,t){return e?!t:t}function Ih(e,t,n,r,o,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:w,minHeight:m,maxHeight:b}=r,{x:p,y:x,width:_,height:S,aspectRatio:k}=e;let M=Math.floor(u?h-e.pointerX:0),I=Math.floor(d?g-e.pointerY:0);const z=_+(c?-M:M),O=S+(l?-I:I),$=-i[0]*_,P=-i[1]*S;let y=Ft(z,v,w),N=Ft(O,m,b);if(s){let j=0,T=0;c&&M<0?j=Oe(p+M+$,s[0][0]):!c&&M>0&&(j=Pe(p+z+$,s[1][0])),l&&I<0?T=Oe(x+I+P,s[0][1]):!l&&I>0&&(T=Pe(x+O+P,s[1][1])),y=Math.max(y,j),N=Math.max(N,T)}if(a){let j=0,T=0;c&&M>0?j=Pe(p+M,a[0][0]):!c&&M<0&&(j=Oe(p+z,a[1][0])),l&&I>0?T=Pe(x+I,a[0][1]):!l&&I<0&&(T=Oe(x+O,a[1][1])),y=Math.max(y,j),N=Math.max(N,T)}if(o){if(u){const j=Ft(z/k,m,b)*k;if(y=Math.max(y,j),s){let T=0;!c&&!l||c&&!l&&f?T=Pe(x+P+z/k,s[1][1])*k:T=Oe(x+P+(c?M:-M)/k,s[0][1])*k,y=Math.max(y,T)}if(a){let T=0;!c&&!l||c&&!l&&f?T=Oe(x+z/k,a[1][1])*k:T=Pe(x+(c?M:-M)/k,a[0][1])*k,y=Math.max(y,T)}}if(d){const j=Ft(O*k,v,w)/k;if(N=Math.max(N,j),s){let T=0;!c&&!l||l&&!c&&f?T=Pe(p+O*k+$,s[1][0])/k:T=Oe(p+(l?I:-I)*k+$,s[0][0])/k,N=Math.max(N,T)}if(a){let T=0;!c&&!l||l&&!c&&f?T=Oe(p+O*k,a[1][0])/k:T=Pe(p+(l?I:-I)*k,a[0][0])/k,N=Math.max(N,T)}}}I=I+(I<0?N:-N),M=M+(M<0?y:-y),o&&(f?z>O*k?I=(po(c,l)?-M:M)/k:M=(po(c,l)?-I:I)*k:u?(I=M/k,l=c):(M=I*k,c=l));const C=c?p+M:p,A=l?x+I:x;return{width:_+(c?-M:M),height:S+(l?-I:I),x:i[0]*M*(c?-1:1)+C,y:i[1]*I*(l?-1:1)+A}}const xs={width:0,height:0,x:0,y:0},Ah={...xs,pointerX:0,pointerY:0,aspectRatio:1};function Th(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[r-a,o-c],[r+i-a,o+s-c]]}function Oh({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=ce(e);let s={controlDirection:go("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:w}){let m={...xs},b={...Ah};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:go(l)};let p,x=null,_=[],S,k,M,I=!1;const z=ki().on("start",O=>{const{nodeLookup:$,transform:P,snapGrid:y,snapToGrid:N,nodeOrigin:C,paneDomNode:A}=n();if(p=$.get(t),!p)return;x=(A==null?void 0:A.getBoundingClientRect())??null;const{xSnapped:j,ySnapped:T}=pt(O.sourceEvent,{transform:P,snapGrid:y,snapToGrid:N,containerBounds:x});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...m,pointerX:j,pointerY:T,aspectRatio:m.width/m.height},S=void 0,k=Ge(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(S=$.get(p.parentId)),S&&p.extent==="parent"&&(k=[[0,0],[S.measured.width,S.measured.height]]),_=[],M=void 0;for(const[D,F]of $)if(F.parentId===t&&(_.push({id:D,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const H=Th(F,p,F.origin??C);M?M=[[Math.min(H[0][0],M[0][0]),Math.min(H[0][1],M[0][1])],[Math.max(H[1][0],M[1][0]),Math.max(H[1][1],M[1][1])]]:M=H}h==null||h(O,{...m})}).on("drag",O=>{const{transform:$,snapGrid:P,snapToGrid:y,nodeOrigin:N}=n(),C=pt(O.sourceEvent,{transform:$,snapGrid:P,snapToGrid:y,containerBounds:x}),A=[];if(!p)return;const{x:j,y:T,width:D,height:F}=m,H={},V=p.origin??N,{width:Y,height:q,x:J,y:G}=Ih(b,s.controlDirection,C,s.boundaries,s.keepAspectRatio,V,k,M),R=Y!==D,B=q!==F,K=J!==j&&R,U=G!==T&&B;if(!K&&!U&&!R&&!B)return;if((K||U||V[0]===1||V[1]===1)&&(H.x=K?J:m.x,H.y=U?G:m.y,m.x=H.x,m.y=H.y,_.length>0)){const ee=J-j,ne=G-T;for(const re of _)re.position={x:re.position.x-ee+V[0]*(Y-D),y:re.position.y-ne+V[1]*(q-F)},A.push(re)}if((R||B)&&(H.width=R&&(!s.resizeDirection||s.resizeDirection==="horizontal")?Y:m.width,H.height=B&&(!s.resizeDirection||s.resizeDirection==="vertical")?q:m.height,m.width=H.width,m.height=H.height),S&&p.expandParent){const ee=V[0]*(H.width??0);H.x&&H.x<ee&&(m.x=ee,b.x=b.x-(H.x-ee));const ne=V[1]*(H.height??0);H.y&&H.y<ne&&(m.y=ne,b.y=b.y-(H.y-ne))}const X=Mh({width:m.width,prevWidth:D,height:m.height,prevHeight:F,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),Z={...m,direction:X};(w==null?void 0:w(O,Z))!==!1&&(I=!0,g==null||g(O,Z),r(H,A))}).on("end",O=>{I&&(v==null||v(O,{...m}),o==null||o({...m}),I=!1)});i.call(z)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}const Ph={},mo=e=>{let t;const n=new Set,r=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Ph?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(r,o,c);return c},$h=e=>e?mo(e):mo,{useDebugValue:jh}=Lc,{useSyncExternalStoreWithSelector:Lh}=jc,Dh=e=>e;function ws(e,t=Dh,n){const r=Lh(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return jh(r),r}const yo=(e,t)=>{const n=$h(e),r=(o,i=t)=>ws(n,o,i);return Object.assign(r,n),r},Rh=(e,t)=>e?yo(e,t):yo;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,o]of e)if(!Object.is(o,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 wn=L.createContext(null),Hh=wn.Provider,vs=me.error001("react");function te(e,t){const n=L.useContext(wn);if(n===null)throw new Error(vs);return ws(n,e,t)}function oe(){const e=L.useContext(wn);if(e===null)throw new Error(vs);return L.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const xo={display:"none"},zh={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},bs="react-flow__node-desc",Es="react-flow__edge-desc",Fh="react-flow__aria-live",Bh=e=>e.ariaLiveMessage,Vh=e=>e.ariaLabelConfig;function Yh({rfId:e}){const t=te(Bh);return E.jsx("div",{id:`${Fh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:zh,children:t})}function Xh({rfId:e,disableKeyboardA11y:t}){const n=te(Vh);return E.jsxs(E.Fragment,{children:[E.jsx("div",{id:`${bs}-${e}`,style:xo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),E.jsx("div",{id:`${Es}-${e}`,style:xo,children:n["edge.a11yDescription.default"]}),!t&&E.jsx(Yh,{rfId:e})]})}const vn=L.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const s=`${e}`.split("-");return E.jsx("div",{className:se(["react-flow__panel",n,...s]),style:r,ref:i,...o,children:t})});vn.displayName="Panel";const wo="https://reactflow.dev?utm_source=attribution";function Wh({proOptions:e,position:t="bottom-right"}){return L.useEffect(()=>{},[]),e!=null&&e.hideAttribution?null:E.jsx(vn,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${wo}`,children:E.jsx("a",{href:wo,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Gh=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}},Bt=e=>e.id;function qh(e,t){return ie(e.selectedNodes.map(Bt),t.selectedNodes.map(Bt))&&ie(e.selectedEdges.map(Bt),t.selectedEdges.map(Bt))}function Kh({onSelectionChange:e}){const t=oe(),{selectedNodes:n,selectedEdges:r}=te(Gh,qh);return L.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const Uh=e=>!!e.onSelectionChangeHandlers;function Zh({onSelectionChange:e}){const t=te(Uh);return e||t?E.jsx(Kh,{onSelectionChange:e}):null}const _s=[0,0],Qh={x:0,y:0,zoom:1},Jh=["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"],vo=[...Jh,"rfId"],eg=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}),bo={translateExtent:vt,nodeOrigin:_s,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function tg(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=te(eg,ie),l=oe();L.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=bo,a()}),[]);const u=L.useRef(bo);return L.useEffect(()=>{for(const d of vo){const f=e[d],h=u.current[d];f!==h&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?r(f):d==="maxZoom"?o(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?l.setState({ariaLabelConfig:Xf(f)}):d==="fitView"?l.setState({fitViewQueued:f}):d==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[d]:f})))}u.current=e},vo.map(d=>e[d])),null}function Eo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ng(e){var r;const[t,n]=L.useState(e==="system"?null:e);return L.useEffect(()=>{if(e!=="system"){n(e);return}const o=Eo(),i=()=>n(o!=null&&o.matches?"dark":"light");return i(),o==null||o.addEventListener("change",i),()=>{o==null||o.removeEventListener("change",i)}},[e]),t!==null?t:(r=Eo())!=null&&r.matches?"dark":"light"}const _o=typeof document<"u"?document:null;function Nt(e=null,t={target:_o,actInsideInputWithModifier:!0}){const[n,r]=L.useState(!1),o=L.useRef(!1),i=L.useRef(new Set([])),[s,a]=L.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace(/\+/g,`
1
+ import{a0 as jc,a1 as Lc,r as L,j as E,P as Dc,n as Rc,c as Hc,a2 as zc,p as Fc,a3 as Lr,a4 as Bc,a5 as Vc,G as Yc,y as Xc,a6 as Wc,a7 as Gc,a8 as qc,T as Kc,a as Uc,I as Zc,b as Qc,a9 as Jc,aa as el,ab as tl}from"./index-C-XEQ2rM.js";function se(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=se(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var nl={value:()=>{}};function dn(){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 Yt(n)}function Yt(e){this._=e}function rl(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Yt.prototype=dn.prototype={constructor:Yt,on:function(e,t){var n=this._,r=rl(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=ol(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=Dr(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Dr(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Yt(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[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],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function ol(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Dr(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=nl,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Vn="http://www.w3.org/1999/xhtml";const Rr={svg:"http://www.w3.org/2000/svg",xhtml:Vn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function fn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rr.hasOwnProperty(t)?{space:Rr[t],local:e}:e}function il(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Vn&&t.documentElement.namespaceURI===Vn?t.createElement(e):t.createElementNS(n,e)}}function sl(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function hi(e){var t=fn(e);return(t.local?sl:il)(t)}function al(){}function or(e){return e==null?al:function(){return this.querySelector(e)}}function cl(e){typeof e!="function"&&(e=or(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=new Array(s),c,l,u=0;u<s;++u)(c=i[u])&&(l=e.call(c,c.__data__,u,i))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new le(r,this._parents)}function ll(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ul(){return[]}function gi(e){return e==null?ul:function(){return this.querySelectorAll(e)}}function dl(e){return function(){return ll(e.apply(this,arguments))}}function fl(e){typeof e=="function"?e=dl(e):e=gi(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(e.call(c,c.__data__,l,s)),o.push(c));return new le(r,o)}function pi(e){return function(){return this.matches(e)}}function mi(e){return function(t){return t.matches(e)}}var hl=Array.prototype.find;function gl(e){return function(){return hl.call(this.children,e)}}function pl(){return this.firstElementChild}function ml(e){return this.select(e==null?pl:gl(typeof e=="function"?e:mi(e)))}var yl=Array.prototype.filter;function xl(){return Array.from(this.children)}function wl(e){return function(){return yl.call(this.children,e)}}function vl(e){return this.selectAll(e==null?xl:wl(typeof e=="function"?e:mi(e)))}function bl(e){typeof e!="function"&&(e=pi(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new le(r,this._parents)}function yi(e){return new Array(e.length)}function El(){return new le(this._enter||this._groups.map(yi),this._parents)}function Kt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Kt.prototype={constructor:Kt,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 _l(e){return function(){return e}}function Nl(e,t,n,r,o,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):n[s]=new Kt(e,i[s]);for(;s<c;++s)(a=t[s])&&(o[s]=a)}function Sl(e,t,n,r,o,i,s){var a,c,l=new Map,u=t.length,d=i.length,f=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?o[a]=c:l.set(h,c));for(a=0;a<d;++a)h=s.call(e,i[a],a,i)+"",(c=l.get(h))?(r[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new Kt(e,i[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(f[a])===c&&(o[a]=c)}function Cl(e){return e.__data__}function kl(e,t){if(!arguments.length)return Array.from(this,Cl);var n=t?Sl:Nl,r=this._parents,o=this._groups;typeof e!="function"&&(e=_l(e));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var u=r[l],d=o[l],f=d.length,h=Ml(e.call(u,u&&u.__data__,l,r)),g=h.length,v=a[l]=new Array(g),w=s[l]=new Array(g),m=c[l]=new Array(f);n(u,d,v,w,m,h,t);for(var b=0,p=0,x,_;b<g;++b)if(x=v[b]){for(b>=p&&(p=b+1);!(_=w[p])&&++p<g;);x._next=_||null}}return s=new le(s,r),s._enter=a,s._exit=c,s}function Ml(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Il(){return new le(this._exit||this._groups.map(yi),this._parents)}function Al(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Tl(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var l=n[c],u=r[c],d=l.length,f=a[c]=new Array(d),h,g=0;g<d;++g)(h=l[g]||u[g])&&(f[g]=h);for(;c<o;++c)a[c]=n[c];return new le(a,this._parents)}function Ol(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Pl(e){e||(e=$l);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new le(o,this._parents).order()}function $l(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function jl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ll(){return Array.from(this)}function Dl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function Rl(){let e=0;for(const t of this)++e;return e}function Hl(){return!this.node()}function zl(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&e.call(a,a.__data__,i,o);return this}function Fl(e){return function(){this.removeAttribute(e)}}function Bl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Vl(e,t){return function(){this.setAttribute(e,t)}}function Yl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Xl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Wl(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 Gl(e,t){var n=fn(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?Bl:Fl:typeof t=="function"?n.local?Wl:Xl:n.local?Yl:Vl)(n,t))}function xi(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ql(e){return function(){this.style.removeProperty(e)}}function Kl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ul(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Zl(e,t,n){return arguments.length>1?this.each((t==null?ql:typeof t=="function"?Ul:Kl)(e,t,n??"")):et(this.node(),e)}function et(e,t){return e.style.getPropertyValue(t)||xi(e).getComputedStyle(e,null).getPropertyValue(t)}function Ql(e){return function(){delete this[e]}}function Jl(e,t){return function(){this[e]=t}}function eu(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function tu(e,t){return arguments.length>1?this.each((t==null?Ql:typeof t=="function"?eu:Jl)(e,t)):this.node()[e]}function wi(e){return e.trim().split(/^|\s+/)}function ir(e){return e.classList||new vi(e)}function vi(e){this._node=e,this._names=wi(e.getAttribute("class")||"")}vi.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 bi(e,t){for(var n=ir(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Ei(e,t){for(var n=ir(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function nu(e){return function(){bi(this,e)}}function ru(e){return function(){Ei(this,e)}}function ou(e,t){return function(){(t.apply(this,arguments)?bi:Ei)(this,e)}}function iu(e,t){var n=wi(e+"");if(arguments.length<2){for(var r=ir(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?ou:t?nu:ru)(n,t))}function su(){this.textContent=""}function au(e){return function(){this.textContent=e}}function cu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function lu(e){return arguments.length?this.each(e==null?su:(typeof e=="function"?cu:au)(e)):this.node().textContent}function uu(){this.innerHTML=""}function du(e){return function(){this.innerHTML=e}}function fu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function hu(e){return arguments.length?this.each(e==null?uu:(typeof e=="function"?fu:du)(e)):this.node().innerHTML}function gu(){this.nextSibling&&this.parentNode.appendChild(this)}function pu(){return this.each(gu)}function mu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function yu(){return this.each(mu)}function xu(e){var t=typeof e=="function"?e:hi(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function wu(){return null}function vu(e,t){var n=typeof e=="function"?e:hi(e),r=t==null?wu:typeof t=="function"?t:or(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function bu(){var e=this.parentNode;e&&e.removeChild(this)}function Eu(){return this.each(bu)}function _u(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Nu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Su(e){return this.select(e?Nu:_u)}function Cu(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ku(e){return function(t){e.call(this,t,this.__data__)}}function Mu(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 Iu(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function Au(e,t,n){return function(){var r=this.__on,o,i=ku(t);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function Tu(e,t,n){var r=Mu(e+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(o=0,u=a[c];o<i;++o)if((s=r[o]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Au:Iu,o=0;o<i;++o)this.each(a(r[o],t,n));return this}function _i(e,t,n){var r=xi(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Ou(e,t){return function(){return _i(this,e,t)}}function Pu(e,t){return function(){return _i(this,e,t.apply(this,arguments))}}function $u(e,t){return this.each((typeof t=="function"?Pu:Ou)(e,t))}function*ju(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var Ni=[null];function le(e,t){this._groups=e,this._parents=t}function Ct(){return new le([[document.documentElement]],Ni)}function Lu(){return this}le.prototype=Ct.prototype={constructor:le,select:cl,selectAll:fl,selectChild:ml,selectChildren:vl,filter:bl,data:kl,enter:El,exit:Il,join:Al,merge:Tl,selection:Lu,order:Ol,sort:Pl,call:jl,nodes:Ll,node:Dl,size:Rl,empty:Hl,each:zl,attr:Gl,style:Zl,property:tu,classed:iu,text:lu,html:hu,raise:pu,lower:yu,append:xu,insert:vu,remove:Eu,clone:Su,datum:Cu,on:Tu,dispatch:$u,[Symbol.iterator]:ju};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Ni)}function Du(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fe(e,t){if(e=Du(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 o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const Ru={passive:!1},mt={capture:!0,passive:!1};function Mn(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function Si(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Qe,mt);"onselectstart"in t?n.on("selectstart.drag",Qe,mt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ci(e,t){var n=e.document.documentElement,r=ce(e).on("dragstart.drag",null);t&&(r.on("click.drag",Qe,mt),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 jt=e=>()=>e;function Yn(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Yn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Hu(e){return!e.ctrlKey&&!e.button}function zu(){return this.parentNode}function Fu(e,t){return t??{x:e.x,y:e.y}}function Bu(){return navigator.maxTouchPoints||"ontouchstart"in this}function ki(){var e=Hu,t=zu,n=Fu,r=Bu,o={},i=dn("start","drag","end"),s=0,a,c,l,u,d=0;function f(x){x.on("mousedown.drag",h).filter(r).on("touchstart.drag",w).on("touchmove.drag",m,Ru).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,_){if(!(u||!e.call(this,x,_))){var S=p(this,t.call(this,x,_),x,_,"mouse");S&&(ce(x.view).on("mousemove.drag",g,mt).on("mouseup.drag",v,mt),Si(x.view),Mn(x),l=!1,a=x.clientX,c=x.clientY,S("start",x))}}function g(x){if(Qe(x),!l){var _=x.clientX-a,S=x.clientY-c;l=_*_+S*S>d}o.mouse("drag",x)}function v(x){ce(x.view).on("mousemove.drag mouseup.drag",null),Ci(x.view,l),Qe(x),o.mouse("end",x)}function w(x,_){if(e.call(this,x,_)){var S=x.changedTouches,k=t.call(this,x,_),M=S.length,I,z;for(I=0;I<M;++I)(z=p(this,k,x,_,S[I].identifier,S[I]))&&(Mn(x),z("start",x,S[I]))}}function m(x){var _=x.changedTouches,S=_.length,k,M;for(k=0;k<S;++k)(M=o[_[k].identifier])&&(Qe(x),M("drag",x,_[k]))}function b(x){var _=x.changedTouches,S=_.length,k,M;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),k=0;k<S;++k)(M=o[_[k].identifier])&&(Mn(x),M("end",x,_[k]))}function p(x,_,S,k,M,I){var z=i.copy(),O=fe(I||S,_),$,P,y;if((y=n.call(x,new Yn("beforestart",{sourceEvent:S,target:f,identifier:M,active:s,x:O[0],y:O[1],dx:0,dy:0,dispatch:z}),k))!=null)return $=y.x-O[0]||0,P=y.y-O[1]||0,function N(C,A,j){var T=O,D;switch(C){case"start":o[M]=N,D=s++;break;case"end":delete o[M],--s;case"drag":O=fe(j||A,_),D=s;break}z.call(C,x,new Yn(C,{sourceEvent:A,subject:y,target:f,identifier:M,active:D,x:O[0]+$,y:O[1]+P,dx:O[0]-T[0],dy:O[1]-T[1],dispatch:z}),k)}}return f.filter=function(x){return arguments.length?(e=typeof x=="function"?x:jt(!!x),f):e},f.container=function(x){return arguments.length?(t=typeof x=="function"?x:jt(x),f):t},f.subject=function(x){return arguments.length?(n=typeof x=="function"?x:jt(x),f):n},f.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:jt(!!x),f):r},f.on=function(){var x=i.on.apply(i,arguments);return x===i?f:x},f.clickDistance=function(x){return arguments.length?(d=(x=+x)*x,f):Math.sqrt(d)},f}function sr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Mi(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function kt(){}var yt=.7,Ut=1/yt,Je="\\s*([+-]?\\d+)\\s*",xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ne="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Vu=/^#([0-9a-f]{3,8})$/,Yu=new RegExp(`^rgb\\(${Je},${Je},${Je}\\)$`),Xu=new RegExp(`^rgb\\(${Ne},${Ne},${Ne}\\)$`),Wu=new RegExp(`^rgba\\(${Je},${Je},${Je},${xt}\\)$`),Gu=new RegExp(`^rgba\\(${Ne},${Ne},${Ne},${xt}\\)$`),qu=new RegExp(`^hsl\\(${xt},${Ne},${Ne}\\)$`),Ku=new RegExp(`^hsla\\(${xt},${Ne},${Ne},${xt}\\)$`),Hr={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};sr(kt,Ye,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:zr,formatHex:zr,formatHex8:Uu,formatHsl:Zu,formatRgb:Fr,toString:Fr});function zr(){return this.rgb().formatHex()}function Uu(){return this.rgb().formatHex8()}function Zu(){return Ii(this).formatHsl()}function Fr(){return this.rgb().formatRgb()}function Ye(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Vu.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Br(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Lt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Lt(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=Yu.exec(e))?new ae(t[1],t[2],t[3],1):(t=Xu.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Wu.exec(e))?Lt(t[1],t[2],t[3],t[4]):(t=Gu.exec(e))?Lt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=qu.exec(e))?Xr(t[1],t[2]/100,t[3]/100,1):(t=Ku.exec(e))?Xr(t[1],t[2]/100,t[3]/100,t[4]):Hr.hasOwnProperty(e)?Br(Hr[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function Br(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function Lt(e,t,n,r){return r<=0&&(e=t=n=NaN),new ae(e,t,n,r)}function Qu(e){return e instanceof kt||(e=Ye(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function Xn(e,t,n,r){return arguments.length===1?Qu(e):new ae(e,t,n,r??1)}function ae(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}sr(ae,Xn,Mi(kt,{brighter(e){return e=e==null?Ut:Math.pow(Ut,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yt:Math.pow(yt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Be(this.r),Be(this.g),Be(this.b),Zt(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:Vr,formatHex:Vr,formatHex8:Ju,formatRgb:Yr,toString:Yr}));function Vr(){return`#${Fe(this.r)}${Fe(this.g)}${Fe(this.b)}`}function Ju(){return`#${Fe(this.r)}${Fe(this.g)}${Fe(this.b)}${Fe((isNaN(this.opacity)?1:this.opacity)*255)}`}function Yr(){const e=Zt(this.opacity);return`${e===1?"rgb(":"rgba("}${Be(this.r)}, ${Be(this.g)}, ${Be(this.b)}${e===1?")":`, ${e})`}`}function Zt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Be(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Fe(e){return e=Be(e),(e<16?"0":"")+e.toString(16)}function Xr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new he(e,t,n,r)}function Ii(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof kt||(e=Ye(e)),!e)return new he;if(e instanceof he)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new he(s,a,c,e.opacity)}function ed(e,t,n,r){return arguments.length===1?Ii(e):new he(e,t,n,r??1)}function he(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}sr(he,ed,Mi(kt,{brighter(e){return e=e==null?Ut:Math.pow(Ut,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yt:Math.pow(yt,e),new he(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,o=2*n-r;return new ae(In(e>=240?e-240:e+120,o,r),In(e,o,r),In(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new he(Wr(this.h),Dt(this.s),Dt(this.l),Zt(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=Zt(this.opacity);return`${e===1?"hsl(":"hsla("}${Wr(this.h)}, ${Dt(this.s)*100}%, ${Dt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Wr(e){return e=(e||0)%360,e<0?e+360:e}function Dt(e){return Math.max(0,Math.min(1,e||0))}function In(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 ar=e=>()=>e;function td(e,t){return function(n){return e+n*t}}function nd(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 rd(e){return(e=+e)==1?Ai:function(t,n){return n-t?nd(t,n,e):ar(isNaN(t)?n:t)}}function Ai(e,t){var n=t-e;return n?td(e,n):ar(isNaN(e)?t:e)}const Qt=(function e(t){var n=rd(t);function r(o,i){var s=n((o=Xn(o)).r,(i=Xn(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),l=Ai(o.opacity,i.opacity);return function(u){return o.r=s(u),o.g=a(u),o.b=c(u),o.opacity=l(u),o+""}}return r.gamma=e,r})(1);function od(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function id(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function sd(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=gt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function ad(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ee(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function cd(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=gt(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var Wn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,An=new RegExp(Wn.source,"g");function ld(e){return function(){return e}}function ud(e){return function(t){return e(t)+""}}function Ti(e,t){var n=Wn.lastIndex=An.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=Wn.exec(e))&&(o=An.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:Ee(r,o)})),n=An.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?ud(c[0].x):ld(t):(t=c.length,function(l){for(var u=0,d;u<t;++u)a[(d=c[u]).i]=d.x(l);return a.join("")})}function gt(e,t){var n=typeof t,r;return t==null||n==="boolean"?ar(t):(n==="number"?Ee:n==="string"?(r=Ye(t))?(t=r,Qt):Ti:t instanceof Ye?Qt:t instanceof Date?ad:id(t)?od:Array.isArray(t)?sd:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?cd:Ee)(e,t)}var Gr=180/Math.PI,Gn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Oi(e,t,n,r,o,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*Gr,skewX:Math.atan(c)*Gr,scaleX:s,scaleY:a}}var Rt;function dd(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Gn:Oi(t.a,t.b,t.c,t.d,t.e,t.f)}function fd(e){return e==null||(Rt||(Rt=document.createElementNS("http://www.w3.org/2000/svg","g")),Rt.setAttribute("transform",e),!(e=Rt.transform.baseVal.consolidate()))?Gn:(e=e.matrix,Oi(e.a,e.b,e.c,e.d,e.e,e.f))}function Pi(e,t,n,r){function o(l){return l.length?l.pop()+" ":""}function i(l,u,d,f,h,g){if(l!==d||u!==f){var v=h.push("translate(",null,t,null,n);g.push({i:v-4,x:Ee(l,d)},{i:v-2,x:Ee(u,f)})}else(d||f)&&h.push("translate("+d+t+f+n)}function s(l,u,d,f){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),f.push({i:d.push(o(d)+"rotate(",null,r)-2,x:Ee(l,u)})):u&&d.push(o(d)+"rotate("+u+r)}function a(l,u,d,f){l!==u?f.push({i:d.push(o(d)+"skewX(",null,r)-2,x:Ee(l,u)}):u&&d.push(o(d)+"skewX("+u+r)}function c(l,u,d,f,h,g){if(l!==d||u!==f){var v=h.push(o(h)+"scale(",null,",",null,")");g.push({i:v-4,x:Ee(l,d)},{i:v-2,x:Ee(u,f)})}else(d!==1||f!==1)&&h.push(o(h)+"scale("+d+","+f+")")}return function(l,u){var d=[],f=[];return l=e(l),u=e(u),i(l.translateX,l.translateY,u.translateX,u.translateY,d,f),s(l.rotate,u.rotate,d,f),a(l.skewX,u.skewX,d,f),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,d,f),l=u=null,function(h){for(var g=-1,v=f.length,w;++g<v;)d[(w=f[g]).i]=w.x(h);return d.join("")}}}var hd=Pi(dd,"px, ","px)","deg)"),gd=Pi(fd,", ",")",")"),pd=1e-12;function qr(e){return((e=Math.exp(e))+1/e)/2}function md(e){return((e=Math.exp(e))-1/e)/2}function yd(e){return((e=Math.exp(2*e))-1)/(e+1)}const Xt=(function e(t,n,r){function o(i,s){var a=i[0],c=i[1],l=i[2],u=s[0],d=s[1],f=s[2],h=u-a,g=d-c,v=h*h+g*g,w,m;if(v<pd)m=Math.log(f/l)/t,w=function(k){return[a+k*h,c+k*g,l*Math.exp(t*k*m)]};else{var b=Math.sqrt(v),p=(f*f-l*l+r*v)/(2*l*n*b),x=(f*f-l*l-r*v)/(2*f*n*b),_=Math.log(Math.sqrt(p*p+1)-p),S=Math.log(Math.sqrt(x*x+1)-x);m=(S-_)/t,w=function(k){var M=k*m,I=qr(_),z=l/(n*b)*(I*yd(t*M+_)-md(_));return[a+z*h,c+z*g,l*I/qr(t*M+_)]}}return w.duration=m*1e3*t/Math.SQRT2,w}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},o})(Math.SQRT2,2,4);var tt=0,dt=0,lt=0,$i=1e3,Jt,ft,en=0,Xe=0,hn=0,wt=typeof performance=="object"&&performance.now?performance:Date,ji=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function cr(){return Xe||(ji(xd),Xe=wt.now()+hn)}function xd(){Xe=0}function tn(){this._call=this._time=this._next=null}tn.prototype=Li.prototype={constructor:tn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?cr():+n)+(t==null?0:+t),!this._next&&ft!==this&&(ft?ft._next=this:Jt=this,ft=this),this._call=e,this._time=n,qn()},stop:function(){this._call&&(this._call=null,this._time=1/0,qn())}};function Li(e,t,n){var r=new tn;return r.restart(e,t,n),r}function wd(){cr(),++tt;for(var e=Jt,t;e;)(t=Xe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--tt}function Kr(){Xe=(en=wt.now())+hn,tt=dt=0;try{wd()}finally{tt=0,bd(),Xe=0}}function vd(){var e=wt.now(),t=e-en;t>$i&&(hn-=t,en=e)}function bd(){for(var e,t=Jt,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:Jt=n);ft=e,qn(r)}function qn(e){if(!tt){dt&&(dt=clearTimeout(dt));var t=e-Xe;t>24?(e<1/0&&(dt=setTimeout(Kr,e-wt.now()-hn)),lt&&(lt=clearInterval(lt))):(lt||(en=wt.now(),lt=setInterval(vd,$i)),tt=1,ji(Kr))}}function Ur(e,t,n){var r=new tn;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Ed=dn("start","end","cancel","interrupt"),_d=[],Di=0,Zr=1,Kn=2,Wt=3,Qr=4,Un=5,Gt=6;function gn(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Nd(e,n,{name:t,index:r,group:o,on:Ed,tween:_d,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Di})}function lr(e,t){var n=ye(e,t);if(n.state>Di)throw new Error("too late; already scheduled");return n}function Se(e,t){var n=ye(e,t);if(n.state>Wt)throw new Error("too late; already running");return n}function ye(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Nd(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=Li(i,0,n.time);function i(l){n.state=Zr,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,d,f,h;if(n.state!==Zr)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===Wt)return Ur(s);h.state===Qr?(h.state=Gt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=Gt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Ur(function(){n.state===Wt&&(n.state=Qr,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Kn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Kn){for(n.state=Wt,o=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(o[++d]=h);o.length=d+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Un,1),d=-1,f=o.length;++d<f;)o[d].call(e,u);n.state===Un&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Gt,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function qt(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>Kn&&r.state<Un,r.state=Gt,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function Sd(e){return this.each(function(){qt(this,e)})}function Cd(e,t){var n,r;return function(){var o=Se(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function kd(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=Se(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:t,value:n},c=0,l=o.length;c<l;++c)if(o[c].name===t){o[c]=a;break}c===l&&o.push(a)}i.tween=o}}function Md(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ye(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?Cd:kd)(n,e,t))}function ur(e,t,n){var r=e._id;return e.each(function(){var o=Se(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return ye(o,r).value[t]}}function Ri(e,t){var n;return(typeof t=="number"?Ee:t instanceof Ye?Qt:(n=Ye(t))?(t=n,Qt):Ti)(e,t)}function Id(e){return function(){this.removeAttribute(e)}}function Ad(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Td(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function Od(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function Pd(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function $d(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function jd(e,t){var n=fn(e),r=n==="transform"?gd:Ri;return this.attrTween(e,typeof t=="function"?(n.local?$d:Pd)(n,r,ur(this,"attr."+e,t)):t==null?(n.local?Ad:Id)(n):(n.local?Od:Td)(n,r,t))}function Ld(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Dd(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Rd(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Dd(e,i)),n}return o._value=t,o}function Hd(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ld(e,i)),n}return o._value=t,o}function zd(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=fn(e);return this.tween(n,(r.local?Rd:Hd)(r,t))}function Fd(e,t){return function(){lr(this,e).delay=+t.apply(this,arguments)}}function Bd(e,t){return t=+t,function(){lr(this,e).delay=t}}function Vd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Fd:Bd)(t,e)):ye(this.node(),t).delay}function Yd(e,t){return function(){Se(this,e).duration=+t.apply(this,arguments)}}function Xd(e,t){return t=+t,function(){Se(this,e).duration=t}}function Wd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Yd:Xd)(t,e)):ye(this.node(),t).duration}function Gd(e,t){if(typeof t!="function")throw new Error;return function(){Se(this,e).ease=t}}function qd(e){var t=this._id;return arguments.length?this.each(Gd(t,e)):ye(this.node(),t).ease}function Kd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Se(this,e).ease=n}}function Ud(e){if(typeof e!="function")throw new Error;return this.each(Kd(this._id,e))}function Zd(e){typeof e!="function"&&(e=pi(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new Te(r,this._parents,this._name,this._id)}function Qd(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=t[a],l=n[a],u=c.length,d=s[a]=new Array(u),f,h=0;h<u;++h)(f=c[h]||l[h])&&(d[h]=f);for(;a<r;++a)s[a]=t[a];return new Te(s,this._parents,this._name,this._id)}function Jd(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 ef(e,t,n){var r,o,i=Jd(t)?lr:Se;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function tf(e,t){var n=this._id;return arguments.length<2?ye(this.node(),n).on.on(e):this.each(ef(n,e,t))}function nf(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function rf(){return this.on("end.remove",nf(this._id))}function of(e){var t=this._name,n=this._id;typeof e!="function"&&(e=or(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,l=i[s]=new Array(c),u,d,f=0;f<c;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),l[f]=d,gn(l[f],t,n,f,l,ye(u,n)));return new Te(i,this._parents,t,n)}function sf(e){var t=this._name,n=this._id;typeof e!="function"&&(e=gi(e));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),h,g=ye(u,n),v=0,w=f.length;v<w;++v)(h=f[v])&&gn(h,t,n,v,f,g);i.push(f),s.push(u)}return new Te(i,s,t,n)}var af=Ct.prototype.constructor;function cf(){return new af(this._groups,this._parents)}function lf(e,t){var n,r,o;return function(){var i=et(this,e),s=(this.style.removeProperty(e),et(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function Hi(e){return function(){this.style.removeProperty(e)}}function uf(e,t,n){var r,o=n+"",i;return function(){var s=et(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function df(e,t,n){var r,o,i;return function(){var s=et(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),et(this,e))),s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a))}}function ff(e,t){var n,r,o,i="style."+t,s="end."+i,a;return function(){var c=Se(this,e),l=c.on,u=c.value[i]==null?a||(a=Hi(t)):void 0;(l!==n||o!==u)&&(r=(n=l).copy()).on(s,o=u),c.on=r}}function hf(e,t,n){var r=(e+="")=="transform"?hd:Ri;return t==null?this.styleTween(e,lf(e,r)).on("end.style."+e,Hi(e)):typeof t=="function"?this.styleTween(e,df(e,r,ur(this,"style."+e,t))).each(ff(this._id,e)):this.styleTween(e,uf(e,r,t),n).on("end.style."+e,null)}function gf(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function pf(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&gf(e,s,n)),r}return i._value=t,i}function mf(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,pf(e,t,n??""))}function yf(e){return function(){this.textContent=e}}function xf(e){return function(){var t=e(this);this.textContent=t??""}}function wf(e){return this.tween("text",typeof e=="function"?xf(ur(this,"text",e)):yf(e==null?"":e+""))}function vf(e){return function(t){this.textContent=e.call(this,t)}}function bf(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&vf(o)),t}return r._value=e,r}function Ef(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,bf(e))}function _f(){for(var e=this._name,t=this._id,n=zi(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=ye(c,t);gn(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Te(r,this._parents,e,n)}function Nf(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var l=Se(this,r),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),o===0&&i()})}var Sf=0;function Te(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function zi(){return++Sf}var Ie=Ct.prototype;Te.prototype={constructor:Te,select:of,selectAll:sf,selectChild:Ie.selectChild,selectChildren:Ie.selectChildren,filter:Zd,merge:Qd,selection:cf,transition:_f,call:Ie.call,nodes:Ie.nodes,node:Ie.node,size:Ie.size,empty:Ie.empty,each:Ie.each,on:tf,attr:jd,attrTween:zd,style:hf,styleTween:mf,text:wf,textTween:Ef,remove:rf,tween:Md,delay:Vd,duration:Wd,ease:qd,easeVarying:Ud,end:Nf,[Symbol.iterator]:Ie[Symbol.iterator]};function Cf(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var kf={time:null,delay:0,duration:250,ease:Cf};function Mf(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 If(e){var t,n;e instanceof Te?(t=e._id,e=e._name):(t=zi(),(n=kf).time=cr(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&gn(c,e,t,l,s,n||Mf(c,t));return new Te(r,this._parents,e,t)}Ct.prototype.interrupt=Sd;Ct.prototype.transition=If;const Ht=e=>()=>e;function Af(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){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:o}})}function Ae(e,t,n){this.k=e,this.x=t,this.y=n}Ae.prototype={constructor:Ae,scale:function(e){return e===1?this:new Ae(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ae(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 pn=new Ae(1,0,0);Fi.prototype=Ae.prototype;function Fi(e){for(;!e.__zoom;)if(!(e=e.parentNode))return pn;return e.__zoom}function Tn(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function Tf(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Of(){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 Jr(){return this.__zoom||pn}function Pf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function $f(){return navigator.maxTouchPoints||"ontouchstart"in this}function jf(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Bi(){var e=Tf,t=Of,n=jf,r=Pf,o=$f,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Xt,l=dn("start","zoom","end"),u,d,f,h=500,g=150,v=0,w=10;function m(y){y.property("__zoom",Jr).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",z).filter(o).on("touchstart.zoom",O).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",P).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,N,C,A){var j=y.selection?y.selection():y;j.property("__zoom",Jr),y!==j?_(y,N,C,A):j.interrupt().each(function(){S(this,arguments).event(A).start().zoom(null,typeof N=="function"?N.apply(this,arguments):N).end()})},m.scaleBy=function(y,N,C,A){m.scaleTo(y,function(){var j=this.__zoom.k,T=typeof N=="function"?N.apply(this,arguments):N;return j*T},C,A)},m.scaleTo=function(y,N,C,A){m.transform(y,function(){var j=t.apply(this,arguments),T=this.__zoom,D=C==null?x(j):typeof C=="function"?C.apply(this,arguments):C,F=T.invert(D),H=typeof N=="function"?N.apply(this,arguments):N;return n(p(b(T,H),D,F),j,s)},C,A)},m.translateBy=function(y,N,C,A){m.transform(y,function(){return n(this.__zoom.translate(typeof N=="function"?N.apply(this,arguments):N,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),s)},null,A)},m.translateTo=function(y,N,C,A,j){m.transform(y,function(){var T=t.apply(this,arguments),D=this.__zoom,F=A==null?x(T):typeof A=="function"?A.apply(this,arguments):A;return n(pn.translate(F[0],F[1]).scale(D.k).translate(typeof N=="function"?-N.apply(this,arguments):-N,typeof C=="function"?-C.apply(this,arguments):-C),T,s)},A,j)};function b(y,N){return N=Math.max(i[0],Math.min(i[1],N)),N===y.k?y:new Ae(N,y.x,y.y)}function p(y,N,C){var A=N[0]-C[0]*y.k,j=N[1]-C[1]*y.k;return A===y.x&&j===y.y?y:new Ae(y.k,A,j)}function x(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function _(y,N,C,A){y.on("start.zoom",function(){S(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(A).end()}).tween("zoom",function(){var j=this,T=arguments,D=S(j,T).event(A),F=t.apply(j,T),H=C==null?x(F):typeof C=="function"?C.apply(j,T):C,V=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),Y=j.__zoom,q=typeof N=="function"?N.apply(j,T):N,J=c(Y.invert(H).concat(V/Y.k),q.invert(H).concat(V/q.k));return function(G){if(G===1)G=q;else{var R=J(G),B=V/R[2];G=new Ae(B,H[0]-R[0]*B,H[1]-R[1]*B)}D.zoom(null,G)}})}function S(y,N,C){return!C&&y.__zooming||new k(y,N)}function k(y,N){this.that=y,this.args=N,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,N),this.taps=0}k.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,N){return this.mouse&&y!=="mouse"&&(this.mouse[1]=N.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=N.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=N.invert(this.touch1[0])),this.that.__zoom=N,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var N=ce(this.that).datum();l.call(y,this.that,new Af(y,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),N)}};function M(y,...N){if(!e.apply(this,arguments))return;var C=S(this,N).event(y),A=this.__zoom,j=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,r.apply(this,arguments)))),T=fe(y);if(C.wheel)(C.mouse[0][0]!==T[0]||C.mouse[0][1]!==T[1])&&(C.mouse[1]=A.invert(C.mouse[0]=T)),clearTimeout(C.wheel);else{if(A.k===j)return;C.mouse=[T,A.invert(T)],qt(this),C.start()}ut(y),C.wheel=setTimeout(D,g),C.zoom("mouse",n(p(b(A,j),C.mouse[0],C.mouse[1]),C.extent,s));function D(){C.wheel=null,C.end()}}function I(y,...N){if(f||!e.apply(this,arguments))return;var C=y.currentTarget,A=S(this,N,!0).event(y),j=ce(y.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",V,!0),T=fe(y,C),D=y.clientX,F=y.clientY;Si(y.view),Tn(y),A.mouse=[T,this.__zoom.invert(T)],qt(this),A.start();function H(Y){if(ut(Y),!A.moved){var q=Y.clientX-D,J=Y.clientY-F;A.moved=q*q+J*J>v}A.event(Y).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=fe(Y,C),A.mouse[1]),A.extent,s))}function V(Y){j.on("mousemove.zoom mouseup.zoom",null),Ci(Y.view,A.moved),ut(Y),A.event(Y).end()}}function z(y,...N){if(e.apply(this,arguments)){var C=this.__zoom,A=fe(y.changedTouches?y.changedTouches[0]:y,this),j=C.invert(A),T=C.k*(y.shiftKey?.5:2),D=n(p(b(C,T),A,j),t.apply(this,N),s);ut(y),a>0?ce(this).transition().duration(a).call(_,D,A,y):ce(this).call(m.transform,D,A,y)}}function O(y,...N){if(e.apply(this,arguments)){var C=y.touches,A=C.length,j=S(this,N,y.changedTouches.length===A).event(y),T,D,F,H;for(Tn(y),D=0;D<A;++D)F=C[D],H=fe(F,this),H=[H,this.__zoom.invert(H),F.identifier],j.touch0?!j.touch1&&j.touch0[2]!==H[2]&&(j.touch1=H,j.taps=0):(j.touch0=H,T=!0,j.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(j.taps<2&&(d=H[0],u=setTimeout(function(){u=null},h)),qt(this),j.start())}}function $(y,...N){if(this.__zooming){var C=S(this,N).event(y),A=y.changedTouches,j=A.length,T,D,F,H;for(ut(y),T=0;T<j;++T)D=A[T],F=fe(D,this),C.touch0&&C.touch0[2]===D.identifier?C.touch0[0]=F:C.touch1&&C.touch1[2]===D.identifier&&(C.touch1[0]=F);if(D=C.that.__zoom,C.touch1){var V=C.touch0[0],Y=C.touch0[1],q=C.touch1[0],J=C.touch1[1],G=(G=q[0]-V[0])*G+(G=q[1]-V[1])*G,R=(R=J[0]-Y[0])*R+(R=J[1]-Y[1])*R;D=b(D,Math.sqrt(G/R)),F=[(V[0]+q[0])/2,(V[1]+q[1])/2],H=[(Y[0]+J[0])/2,(Y[1]+J[1])/2]}else if(C.touch0)F=C.touch0[0],H=C.touch0[1];else return;C.zoom("touch",n(p(D,F,H),C.extent,s))}}function P(y,...N){if(this.__zooming){var C=S(this,N).event(y),A=y.changedTouches,j=A.length,T,D;for(Tn(y),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),T=0;T<j;++T)D=A[T],C.touch0&&C.touch0[2]===D.identifier?delete C.touch0:C.touch1&&C.touch1[2]===D.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(D=fe(D,this),Math.hypot(d[0]-D[0],d[1]-D[1])<w)){var F=ce(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(r=typeof y=="function"?y:Ht(+y),m):r},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Ht(!!y),m):e},m.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:Ht(!!y),m):o},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Ht([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],m):[i[0],i[1]]},m.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(c=y,m):c},m.on=function(){var y=l.on.apply(l,arguments);return y===l?m:y},m.clickDistance=function(y){return arguments.length?(v=(y=+y)*y,m):Math.sqrt(v)},m.tapDistance=function(y){return arguments.length?(w=+y,m):w},m}const me={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle: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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},vt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Vi=["Enter"," ","Escape"],Yi={"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 nt;(function(e){e.Strict="strict",e.Loose="loose"})(nt||(nt={}));var Ve;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ve||(Ve={}));var bt;(function(e){e.Partial="partial",e.Full="full"})(bt||(bt={}));const Xi={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var je;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(je||(je={}));var nn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(nn||(nn={}));var W;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(W||(W={}));const eo={[W.Left]:W.Right,[W.Right]:W.Left,[W.Top]:W.Bottom,[W.Bottom]:W.Top},Wi=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,Lf=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),dr=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Mt=(e,t=[0,0])=>{const{width:n,height:r}=xe(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},Df=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1;const r=e.reduce((o,i)=>{const s=typeof i=="string";let a=!t.nodeLookup&&!s?i:void 0;return t.nodeLookup&&(a=s?t.nodeLookup.get(i):dr(i)?i:t.nodeLookup.get(i.id)),a?(n=!0,mn(o,rn(a,t.nodeOrigin))):o},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?yn(r):{x:0,y:0,width:0,height:0}},It=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=mn(n,rn(o)),r=!0)}),r?yn(n):{x:0,y:0,width:0,height:0}},fr=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/o,c=(t.y-r)/o,l=t.width/o,u=t.height/o,d=[];for(const f of e.values()){const{measured:h,selectable:g=!0,hidden:v=!1}=f;if(s&&!g||v)continue;const w=h.width??f.width??f.initialWidth??0,m=h.height??f.height??f.initialHeight??0,{x:b,y:p}=f.internals.positionAbsolute,x=Ui(a,c,l,u,b,p,w,m),_=w*m,S=i&&x>0;(!f.internals.handleBounds||S||x>=_||f.dragging)&&d.push(f)}return d},Rf=(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 Hf(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{let i;if(t!=null&&t.includeHiddenNodes){const{width:s,height:a}=xe(o);i=s>0&&a>0}else i=!!(o.measured.width&&o.measured.height&&!o.hidden);i&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function zf({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return!0;const a=Hf(e,s),c=It(a),l=gr(c,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),!0}function Gi({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??r;let d=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",me.error005());else{const{width:h,height:g}=xe(a);h&&g&&(d=[[c,l],[c+h,l+g]])}else a&&Ge(s.extent)&&(d=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const f=Ge(d)?We(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",me.error015())),{position:{x:f.x-c+(s.measured.width??0)*u[0],y:f.y-l+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function Ff({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(v=>v.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),u=Rf(s,c);for(const f of c)a.has(f.id)&&!u.find(g=>g.id===f.id)&&u.push(f);if(!o)return{edges:u,nodes:s};const d=await o({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const rt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),We=(e={x:0,y:0},t,n)=>({x:rt(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:rt(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function qi(e,t,n){const{width:r,height:o}=xe(n),{x:i,y:s}=n.internals.positionAbsolute;return We(e,[[i,s],[i+r,s+o]],t)}const to=(e,t,n)=>e<t?rt(Math.abs(e-t),1,t)/t:e>n?-rt(Math.abs(e-n),1,t)/t:0,hr=(e,t,n=15,r=40)=>{const o=to(e.x,r,t.width-r)*n,i=to(e.y,r,t.height-r)*n;return[o,i]},mn=(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)}),Zn=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),yn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Et=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=dr(e)?e.internals.positionAbsolute:Mt(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},rn=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=dr(e)?e.internals.positionAbsolute:Mt(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},Ki=(e,t)=>yn(mn(Zn(e),Zn(t))),Ui=(e,t,n,r,o,i,s,a)=>{const c=Math.max(0,Math.min(e+n,o+s)-Math.max(e,o)),l=Math.max(0,Math.min(t+r,i+a)-Math.max(t,i));return Math.ceil(c*l)},on=(e,t)=>Ui(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),no=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),Zi=(e,t)=>(n,r)=>{},At=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Tt=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return i?At(a,s):a},ot=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function Ue(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Bf(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Ue(e,n),o=Ue(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=Ue(e.top??e.y??0,n),o=Ue(e.bottom??e.y??0,n),i=Ue(e.left??e.x??0,t),s=Ue(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Vf(e,t,n,r,o,i){const{x:s,y:a}=ot(e,[t,n,r]),{x:c,y:l}=ot({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=o-c,d=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const gr=(e,t,n,r,o,i)=>{const s=Bf(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),u=rt(l,r,o),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*u,g=n/2-f*u,v=Vf(e,h,g,u,t,n),w={left:Math.min(v.left-s.left,0),top:Math.min(v.top-s.top,0),right:Math.min(v.right-s.right,0),bottom:Math.min(v.bottom-s.bottom,0)};return{x:h-w.left+w.right,y:g-w.top+w.bottom,zoom:u}},_t=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ge(e){return e!=null&&e!=="parent"}function xe(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Qi(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function Ji(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function ro(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Yf(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function Xf(e){return{...Yi,...e||{}}}function es(e){return e===null?null:e?"valid":"invalid"}function pt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=pe(e),a=Tt({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:c,y:l}=n?At(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const pr=e=>({width:e.offsetWidth,height:e.offsetHeight}),ts=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Wf=["INPUT","SELECT","TEXTAREA"];function ns(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Wf.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const rs=e=>"clientX"in e,pe=(e,t)=>{var i,s;const n=rs(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},oo=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...pr(s)}})};function os({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+o*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+r*.125,u=Math.abs(c-e),d=Math.abs(l-t);return[c,l,u,d]}function zt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function io({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case W.Left:return[t-zt(t-r,i),n];case W.Right:return[t+zt(r-t,i),n];case W.Top:return[t,n-zt(n-o,i)];case W.Bottom:return[t,n+zt(o-n,i)]}}function is({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:o,targetPosition:i=W.Top,curvature:s=.25}){const[a,c]=io({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[l,u]=io({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[d,f,h,g]=os({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${c} ${l},${u} ${r},${o}`,d,f,h,g]}function ss({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[i,a,o,s]}function Gf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const s=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return s+a}function qf({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=mn(rn(e),rn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return on(s,yn(i))>0}const Kf=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Uf=(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)),Zf=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",me.error006()),t;const r=n.getEdgeId||Kf;let o;return Wi(e)?o={...e}:o={...e,id:r(e)},Uf(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function as({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=ss({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const so={[W.Left]:{x:-1,y:0},[W.Right]:{x:1,y:0},[W.Top]:{x:0,y:-1},[W.Bottom]:{x:0,y:1}},Qf=({source:e,sourcePosition:t=W.Bottom,target:n})=>t===W.Left||t===W.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},ao=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Jf({source:e,sourcePosition:t=W.Bottom,target:n,targetPosition:r=W.Top,center:o,offset:i,stepPosition:s}){const a=so[t],c=so[r],l={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+c.x*i,y:n.y+c.y*i},d=Qf({source:l,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",h=d[f];let g=[],v,w;const m={x:0,y:0},b={x:0,y:0},[,,p,x]=ss({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(v=o.x??l.x+(u.x-l.x)*s,w=o.y??(l.y+u.y)/2):(v=o.x??(l.x+u.x)/2,w=o.y??l.y+(u.y-l.y)*s);const M=[{x:v,y:l.y},{x:v,y:u.y}],I=[{x:l.x,y:w},{x:u.x,y:w}];a[f]===h?g=f==="x"?M:I:g=f==="x"?I:M}else{const M=[{x:l.x,y:u.y}],I=[{x:u.x,y:l.y}];if(f==="x"?g=a.x===h?I:M:g=a.y===h?M:I,t===r){const y=Math.abs(e[f]-n[f]);if(y<=i){const N=Math.min(i-1,i-y);a[f]===h?m[f]=(l[f]>e[f]?-1:1)*N:b[f]=(u[f]>n[f]?-1:1)*N}}if(t!==r){const y=f==="x"?"y":"x",N=a[f]===c[y],C=l[y]>u[y],A=l[y]<u[y];(a[f]===1&&(!N&&C||N&&A)||a[f]!==1&&(!N&&A||N&&C))&&(g=f==="x"?M:I)}const z={x:l.x+m.x,y:l.y+m.y},O={x:u.x+b.x,y:u.y+b.y},$=Math.max(Math.abs(z.x-g[0].x),Math.abs(O.x-g[0].x)),P=Math.max(Math.abs(z.y-g[0].y),Math.abs(O.y-g[0].y));$>=P?(v=(z.x+O.x)/2,w=g[0].y):(v=g[0].x,w=(z.y+O.y)/2)}const _={x:l.x+m.x,y:l.y+m.y},S={x:u.x+b.x,y:u.y+b.y};return[[e,..._.x!==g[0].x||_.y!==g[0].y?[_]:[],...g,...S.x!==g[g.length-1].x||S.y!==g[g.length-1].y?[S]:[],n],v,w,p,x]}function eh(e,t,n,r){const o=Math.min(ao(e,t)/2,ao(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+o*l},${s}Q ${i},${s} ${i},${s+o*u}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+o*c}Q ${i},${s} ${i+o*a},${s}`}function Qn({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:o,targetPosition:i=W.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:u=.5}){const[d,f,h,g,v]=Jf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:u});let w=`M${d[0].x} ${d[0].y}`;for(let m=1;m<d.length-1;m++)w+=eh(d[m-1],d[m],d[m+1],s);return w+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[w,f,h,g,v]}function co(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function th(e){var d;const{sourceNode:t,targetNode:n}=e;if(!co(t)||!co(n))return null;const r=t.internals.handleBounds||lo(t.handles),o=n.internals.handleBounds||lo(n.handles),i=uo((r==null?void 0:r.source)??[],e.sourceHandle),s=uo(e.connectionMode===nt.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!s)return(d=e.onError)==null||d.call(e,"008",me.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||W.Bottom,c=(s==null?void 0:s.position)||W.Top,l=qe(t,i,a),u=qe(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function lo(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 qe(e,t,n=W.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??xe(e);if(r)return{x:o+s/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case W.Top:return{x:o+s/2,y:i};case W.Right:return{x:o+s,y:i+a/2};case W.Bottom:return{x:o+s/2,y:i+a};case W.Left:return{x:o,y:i+a/2}}}function uo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Jn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function nh(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const l=Jn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const cs=1e3,rh=10,mr={nodeOrigin:[0,0],nodeExtent:vt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},oh={...mr,checkEquality:!0};function yr(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function ih(e,t,n){const r=yr(mr,n);for(const o of e.values())if(o.parentId)wr(o,e,t,r);else{const i=Mt(o,r.nodeOrigin),s=Ge(o.extent)?o.extent:r.nodeExtent,a=We(i,s,xe(o));o.internals.positionAbsolute=a}}function sh(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function xr(e){return e==="manual"}function er(e,t,n,r={}){var u,d;const o=yr(oh,r),i={i:0},s=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!xr(o.zIndexMode)?cs:0;let c=e.length>0,l=!1;t.clear(),n.clear();for(const f of e){let h=s.get(f.id);if(o.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const g=Mt(f,o.nodeOrigin),v=Ge(f.extent)?f.extent:o.nodeExtent,w=We(g,v,xe(f));h={...o.defaults,...f,measured:{width:(u=f.measured)==null?void 0:u.width,height:(d=f.measured)==null?void 0:d.height},internals:{positionAbsolute:w,handleBounds:sh(f,h),z:ls(f,a,o.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&wr(h,t,n,r,i),l||(l=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:l}}function ah(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 wr(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=yr(mr,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}ah(e,n),o&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++o.i,u.internals.z=u.internals.z+o.i*rh),o&&u.internals.rootParentIndex!==void 0&&(o.i=u.internals.rootParentIndex);const d=i&&!xr(c)?cs:0,{x:f,y:h,z:g}=ch(e,u,s,a,d,c),{positionAbsolute:v}=e.internals,w=f!==v.x||h!==v.y;(w||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:f,y:h}:v,z:g}})}function ls(e,t,n){const r=ge(e.zIndex)?e.zIndex:0;return xr(n)?r:r+(e.selected?t:0)}function ch(e,t,n,r,o,i){const{x:s,y:a}=t.internals.positionAbsolute,c=xe(e),l=Mt(e,n),u=Ge(e.extent)?We(l,e.extent,c):l;let d=We({x:s+u.x,y:a+u.y},r,c);e.extent==="parent"&&(d=qi(d,c,t));const f=ls(e,o,i),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function vr(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Et(c),u=Ki(l,a.rect);i.set(a.parentId,{expandedRect:u,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var p;const u=c.internals.positionAbsolute,d=xe(c),f=c.origin??r,h=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,g=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,v=Math.max(d.width,Math.round(a.width)),w=Math.max(d.height,Math.round(a.height)),m=(v-d.width)*f[0],b=(w-d.height)*f[1];(h>0||g>0||m||b)&&(o.push({id:l,type:"position",position:{x:c.position.x-h+m,y:c.position.y-g+b}}),(p=n.get(l))==null||p.forEach(x=>{e.some(_=>_.id===x.id)||o.push({id:x.id,type:"position",position:{x:x.position.x+h,y:x.position.y+g}})})),(d.width<a.width||d.height<a.height||h||g)&&o.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:v+(h?f[0]*h-m:0),height:w+(g?f[1]*g-b:0)}})}),o}function lh(e,t,n,r,o,i,s){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const v=pr(h.nodeElement),w=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(w||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Ge(g.extent)?g.extent:i;let{positionAbsolute:x}=g.internals;if(g.parentId&&g.extent==="parent"){const S=t.get(g.parentId);S&&(x=qi(x,v,S))}else p&&(x=We(x,p,v));const _={...g,measured:v,internals:{...g.internals,positionAbsolute:x,handleBounds:{source:oo("source",h.nodeElement,b,d,g.id),target:oo("target",h.nodeElement,b,d,g.id)}}};t.set(g.id,_),g.parentId&&wr(_,t,n,{nodeOrigin:o,zIndexMode:s}),c=!0,w&&(l.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Et(_,o)}))}}if(f.length>0){const h=vr(f,t,n,o);l.push(...h)}return{changes:l,updatedInternals:c}}async function uh({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function fo(e,t,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${o}-${e}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,t)),i){s=`${o}-${e}-${i}`;const l=r.get(s)||new Map;r.set(s,l.set(n,t))}}function us(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},l=`${o}-${s}--${i}-${a}`,u=`${i}-${a}--${o}-${s}`;fo("source",c,u,e,o,s),fo("target",c,l,e,i,a),t.set(r.id,r)}}function ds(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:ds(n,t):!1}function ho(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function dh(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!ds(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&o.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function On({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,a,c;const o=[];for(const[l,u]of t){const d=(s=n.get(l))==null?void 0:s.internals.userNode;d&&o.push({...d,position:u.position,dragging:r})}if(!e)return[o[0],o];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:o[0],o]}function fh({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=At(i,t);return{x:s.x-i.x,y:s.y-i.y}}function hh({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,h=!1,g=!1,v=null;function w({noDragClassName:b,handleSelector:p,domNode:x,isSelectable:_,nodeId:S,nodeClickDistance:k=0}){f=ce(x);function M({x:$,y:P}){const{nodeLookup:y,nodeExtent:N,snapGrid:C,snapToGrid:A,nodeOrigin:j,onNodeDrag:T,onSelectionDrag:D,onError:F,updateNodePositions:H}=t();i={x:$,y:P};let V=!1;const Y=a.size>1,q=Y&&N?Zn(It(a)):null,J=Y&&A?fh({dragItems:a,snapGrid:C,x:$,y:P}):null;for(const[G,R]of a){if(!y.has(G))continue;let B={x:$-R.distance.x,y:P-R.distance.y};A&&(B=J?{x:Math.round(B.x+J.x),y:Math.round(B.y+J.y)}:At(B,C));let K=null;if(Y&&N&&!R.extent&&q){const{positionAbsolute:Z}=R.internals,Q=Z.x-q.x+N[0][0],ee=Z.x+R.measured.width-q.x2+N[1][0],ne=Z.y-q.y+N[0][1],re=Z.y+R.measured.height-q.y2+N[1][1];K=[[Q,ne],[ee,re]]}const{position:U,positionAbsolute:X}=Gi({nodeId:G,nextPosition:B,nodeLookup:y,nodeExtent:K||N,nodeOrigin:j,onError:F});V=V||R.position.x!==U.x||R.position.y!==U.y,R.position=U,R.internals.positionAbsolute=X}if(g=g||V,!!V&&(H(a,!0),v&&(r||T||!S&&D))){const[G,R]=On({nodeId:S,dragItems:a,nodeLookup:y});r==null||r(v,a,G,R),T==null||T(v,G,R),S||D==null||D(v,R)}}async function I(){if(!u)return;const{transform:$,panBy:P,autoPanSpeed:y,autoPanOnNodeDrag:N}=t();if(!N){c=!1,cancelAnimationFrame(s);return}const[C,A]=hr(l,u,y);(C!==0||A!==0)&&(i.x=(i.x??0)-C/$[2],i.y=(i.y??0)-A/$[2],await P({x:C,y:A})&&M(i)),s=requestAnimationFrame(I)}function z($){var Y;const{nodeLookup:P,multiSelectionActive:y,nodesDraggable:N,transform:C,snapGrid:A,snapToGrid:j,selectNodesOnDrag:T,onNodeDragStart:D,onSelectionDragStart:F,unselectNodesAndEdges:H}=t();d=!0,(!T||!_)&&!y&&S&&((Y=P.get(S))!=null&&Y.selected||H()),_&&T&&S&&(e==null||e(S));const V=pt($.sourceEvent,{transform:C,snapGrid:A,snapToGrid:j,containerBounds:u});if(i=V,a=dh(P,N,V,S),a.size>0&&(n||D||!S&&F)){const[q,J]=On({nodeId:S,dragItems:a,nodeLookup:P});n==null||n($.sourceEvent,a,q,J),D==null||D($.sourceEvent,q,J),S||F==null||F($.sourceEvent,J)}}const O=ki().clickDistance(k).on("start",$=>{const{domNode:P,nodeDragThreshold:y,transform:N,snapGrid:C,snapToGrid:A}=t();u=(P==null?void 0:P.getBoundingClientRect())||null,h=!1,g=!1,v=$.sourceEvent,y===0&&z($),i=pt($.sourceEvent,{transform:N,snapGrid:C,snapToGrid:A,containerBounds:u}),l=pe($.sourceEvent,u)}).on("drag",$=>{const{autoPanOnNodeDrag:P,transform:y,snapGrid:N,snapToGrid:C,nodeDragThreshold:A,nodeLookup:j}=t(),T=pt($.sourceEvent,{transform:y,snapGrid:N,snapToGrid:C,containerBounds:u});if(v=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||S&&!j.has(S))&&(h=!0),!h){if(!c&&P&&d&&(c=!0,I()),!d){const D=pe($.sourceEvent,u),F=D.x-l.x,H=D.y-l.y;Math.sqrt(F*F+H*H)>A&&z($)}(i.x!==T.xSnapped||i.y!==T.ySnapped)&&a&&d&&(l=pe($.sourceEvent,u),M(T))}}).on("end",$=>{if(!d||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,d=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:P,updateNodePositions:y,onNodeDragStop:N,onSelectionDragStop:C}=t();if(g&&(y(a,!1),g=!1),o||N||!S&&C){const[A,j]=On({nodeId:S,dragItems:a,nodeLookup:P,dragging:!1});o==null||o($.sourceEvent,a,A,j),N==null||N($.sourceEvent,A,j),S||C==null||C($.sourceEvent,j)}}}).filter($=>{const P=$.target;return!$.button&&(!b||!ho(P,`.${b}`,x))&&(!p||ho(P,p,x))});f.call(O)}function m(){f==null||f.on(".drag",null)}return{update:w,destroy:m}}function gh(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())on(o,Et(i))>0&&r.push(i);return r}const ph=250;function mh(e,t,n,r){var a,c;let o=[],i=1/0;const s=gh(e,n,t+ph);for(const l of s){const u=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of u){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:f,y:h}=qe(l,d,d.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(o=[{...d,x:f,y:h}],i=g):g===i&&o.push({...d,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const l=r.type==="source"?"target":"source";return o.find(u=>u.type===l)??o[0]}return o[0]}function fs(e,t,n,r,o,i=!1){var l,u,d;const s=r.get(e);if(!s)return null;const a=o==="strict"?(l=s.internals.handleBounds)==null?void 0:l[t]:[...((u=s.internals.handleBounds)==null?void 0:u.source)??[],...((d=s.internals.handleBounds)==null?void 0:d.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...qe(s,c,c.position,!0)}:c}function hs(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function yh(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const gs=()=>!0;function xh(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:w,isValidConnection:m=gs,onReconnectEnd:b,updateConnection:p,getTransform:x,getFromHandle:_,autoPanSpeed:S,dragThreshold:k=1,handleDomNode:M}){const I=ts(e.target);let z=0,O;const{x:$,y:P}=pe(e),y=hs(i,M),N=a==null?void 0:a.getBoundingClientRect();let C=!1;if(!N||!y)return;const A=fs(o,y,r,c,t);if(!A)return;let j=pe(e,N),T=!1,D=null,F=!1,H=null;function V(){if(!u||!N)return;const[U,X]=hr(j,N,S);f({x:U,y:X}),z=requestAnimationFrame(V)}const Y={...A,nodeId:o,type:y,position:A.position},q=c.get(o);let G={inProgress:!0,isValid:null,from:qe(q,Y,W.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:q,to:j,toHandle:null,toPosition:eo[Y.position],toNode:null,pointer:j};function R(){C=!0,p(G),g==null||g(e,{nodeId:o,handleId:r,handleType:y})}k===0&&R();function B(U){if(!C){const{x:re,y:ue}=pe(U),ve=re-$,be=ue-P;if(!(ve*ve+be*be>k*k))return;R()}if(!_()||!Y){K(U);return}const X=x();j=pe(U,N),O=mh(Tt(j,X,!1,[1,1]),n,c,Y),T||(V(),T=!0);const Z=ps(U,{handle:O,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:m,doc:I,lib:l,flowId:d,nodeLookup:c});H=Z.handleDomNode,D=Z.connection,F=yh(!!O,Z.isValid);const Q=c.get(o),ee=Q?qe(Q,Y,W.Left,!0):G.from,ne={...G,from:ee,isValid:F,to:Z.toHandle&&F?ot({x:Z.toHandle.x,y:Z.toHandle.y},X):j,toHandle:Z.toHandle,toPosition:F&&Z.toHandle?Z.toHandle.position:eo[Y.position],toNode:Z.toHandle?c.get(Z.toHandle.nodeId):null,pointer:j};p(ne),G=ne}function K(U){if(!("touches"in U&&U.touches.length>0)){if(C){(O||H)&&D&&F&&(v==null||v(D));const{inProgress:X,...Z}=G,Q={...Z,toPosition:G.toHandle?G.toPosition:null};w==null||w(U,Q),i&&(b==null||b(U,Q))}h(),cancelAnimationFrame(z),T=!1,F=!1,D=null,H=null,I.removeEventListener("mousemove",B),I.removeEventListener("mouseup",K),I.removeEventListener("touchmove",B),I.removeEventListener("touchend",K)}}I.addEventListener("mousemove",B),I.addEventListener("mouseup",K),I.addEventListener("touchmove",B),I.addEventListener("touchend",K)}function ps(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=gs,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=pe(e),v=s.elementFromPoint(h,g),w=v!=null&&v.classList.contains(`${a}-flow__handle`)?v:f,m={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const b=hs(void 0,w),p=w.getAttribute("data-nodeid"),x=w.getAttribute("data-handleid"),_=w.classList.contains("connectable"),S=w.classList.contains("connectableend");if(!p||!b)return m;const k={source:d?p:r,sourceHandle:d?x:o,target:d?r:p,targetHandle:d?o:x};m.connection=k;const I=_&&S&&(n===nt.Strict?d&&b==="source"||!d&&b==="target":p!==r||x!==o);m.isValid=I&&l(k),m.toHandle=fs(p,b,x,u,n,!0)}return m}const tr={onPointerDown:xh,isValid:ps};function wh({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=ce(e);function i({translateExtent:a,width:c,height:l,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const x=n(),_=p.sourceEvent.ctrlKey&&_t()?10:1,S=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,k=x[2]*Math.pow(2,S*_);t.scaleTo(k)};let v=[0,0];const w=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(v=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const x=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const _=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],S=[_[0]-v[0],_[1]-v[1]];v=_;const k=r()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),M={x:x[0]-S[0]*k,y:x[1]-S[1]*k},I=[[0,0],[c,l]];t.setViewportConstrained({x:M.x,y:M.y,zoom:x[2]},I,a)},b=Bi().on("start",w).on("zoom",d?m:null).on("zoom.wheel",f?g:null);o.call(b,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const xn=e=>({x:e.x,y:e.y,zoom:e.k}),Pn=({x:e,y:t,zoom:n})=>pn.translate(e,t).scale(n),$e=(e,t)=>e.target.closest(`.${t}`),ms=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),vh=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,$n=(e,t=0,n=vh,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},ys=e=>{const t=e.ctrlKey&&_t()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function bh({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return u=>{if($e(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const w=fe(u),m=ys(u),b=d*Math.pow(2,m);r.scaleTo(n,b,w,u);return}const f=u.deltaMode===1?20:1;let h=o===Ve.Vertical?0:u.deltaX*f,g=o===Ve.Horizontal?0:u.deltaY*f;!_t()&&u.shiftKey&&o!==Ve.Vertical&&(h=u.deltaY*f,g=0),r.translateBy(n,-(h/d)*i,-(g/d)*i,{internal:!0});const v=xn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c==null||c(u,v):(e.isPanScrolling=!0,a==null||a(u,v)),e.panScrollTimeout=setTimeout(()=>{l==null||l(u,v),e.isPanScrolling=!1},150)}}function Eh({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,a=$e(r,e);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function _h({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=xn(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function Nh({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&ms(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((a=i.sourceEvent)!=null&&a.internal)&&(o==null||o(i.sourceEvent,xn(i.transform)))}}function Sh({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&ms(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=xn(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,c)},n?150:0)}}}function Ch({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:o,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{var m;const h=t||n,g=r&&f.ctrlKey,v=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&($e(f,`${u}-flow__node`)||$e(f,`${u}-flow__edge`)||$e(f,`${u}-flow__selection`)||$e(f,`${u}-flow__nodesselection`)))return!0;if(!o&&!h&&!i&&!s&&!r||a||d&&!v||$e(f,c)&&v||$e(f,l)&&(!v||i&&v&&!t)||!r&&f.ctrlKey&&v)return!1;if(!r&&f.type==="touchstart"&&((m=f.touches)==null?void 0:m.length)>1)return f.preventDefault(),!1;if(!h&&!i&&!g&&v||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||v||e)&&w}}function kh({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect();let d=[[0,0],[u.width,u.height]];const f=typeof ResizeObserver<"u"?new ResizeObserver(P=>{const y=P[0];y&&(d=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null;f==null||f.observe(e);const h=Bi().extent(()=>d).scaleExtent([t,n]).translateExtent(r),g=ce(e).call(h);x({x:o.x,y:o.y,zoom:rt(o.zoom,t,n)},[[0,0],[u.width,u.height]],r);const v=g.on("wheel.zoom"),w=g.on("dblclick.zoom");h.wheelDelta(ys);async function m(P,y){return g?new Promise(N=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?gt:Xt).transform($n(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>N(!0)),P)}):!1}function b({noWheelClassName:P,noPanClassName:y,onPaneContextMenu:N,userSelectionActive:C,panOnScroll:A,panOnDrag:j,panOnScrollMode:T,panOnScrollSpeed:D,preventScrolling:F,zoomOnPinch:H,zoomOnScroll:V,zoomOnDoubleClick:Y,panActivationKeyPressed:q=!1,zoomActivationKeyPressed:J,lib:G,onTransformChange:R,connectionInProgress:B,paneClickDistance:K,selectionOnDrag:U}){C&&!l.isZoomingOrPanning&&p();const X=A&&!J&&!C;h.clickDistance(U?1/0:!ge(K)||K<0?0:K);const Z=X?bh({zoomPanValues:l,noWheelClassName:P,d3Selection:g,d3Zoom:h,panOnScrollMode:T,panOnScrollSpeed:D,zoomOnPinch:H,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Eh({noWheelClassName:P,preventScrolling:F,d3ZoomHandler:v});g.on("wheel.zoom",Z,{passive:!1});const Q=_h({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});h.on("start",Q);const ee=Nh({zoomPanValues:l,panOnDrag:j,onPaneContextMenu:!!N,onPanZoom:i,onTransformChange:R});h.on("zoom",ee);const ne=Sh({zoomPanValues:l,panOnDrag:j,panOnScroll:A,onPaneContextMenu:N,onPanZoomEnd:a,onDraggingChange:c});h.on("end",ne);const re=Ch({panActivationKeyPressed:q,zoomActivationKeyPressed:J,panOnDrag:j,zoomOnScroll:V,panOnScroll:A,zoomOnDoubleClick:Y,zoomOnPinch:H,userSelectionActive:C,noPanClassName:y,noWheelClassName:P,lib:G,connectionInProgress:B});h.filter(re),Y?g.on("dblclick.zoom",w):g.on("dblclick.zoom",null)}function p(){h.on("zoom",null)}async function x(P,y,N){const C=Pn(P),A=h==null?void 0:h.constrain()(C,y,N);return A&&await m(A),A}async function _(P,y){const N=Pn(P);return await m(N,y),N}function S(P){if(g){const y=Pn(P),N=g.property("__zoom");(N.k!==P.zoom||N.x!==P.x||N.y!==P.y)&&(h==null||h.transform(g,y,null,{sync:!0}))}}function k(){const P=g?Fi(g.node()):{x:0,y:0,k:1};return{x:P.x,y:P.y,zoom:P.k}}async function M(P,y){return g?new Promise(N=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?gt:Xt).scaleTo($n(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>N(!0)),P)}):!1}async function I(P,y){return g?new Promise(N=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?gt:Xt).scaleBy($n(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>N(!0)),P)}):!1}function z(P){h==null||h.scaleExtent(P)}function O(P){h==null||h.translateExtent(P)}function $(P){const y=!ge(P)||P<0?0:P;h==null||h.clickDistance(y)}return{update:b,destroy:p,setViewport:_,setViewportConstrained:x,getViewport:k,scaleTo:M,scaleBy:I,setScaleExtent:z,setTranslateExtent:O,syncViewport:S,setClickDistance:$}}var it;(function(e){e.Line="line",e.Handle="handle"})(it||(it={}));function Mh({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,a=n-r,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function go(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Oe(e,t){return Math.max(0,t-e)}function Pe(e,t){return Math.max(0,e-t)}function Ft(e,t,n){return Math.max(0,t-e,e-n)}function po(e,t){return e?!t:t}function Ih(e,t,n,r,o,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:w,minHeight:m,maxHeight:b}=r,{x:p,y:x,width:_,height:S,aspectRatio:k}=e;let M=Math.floor(u?h-e.pointerX:0),I=Math.floor(d?g-e.pointerY:0);const z=_+(c?-M:M),O=S+(l?-I:I),$=-i[0]*_,P=-i[1]*S;let y=Ft(z,v,w),N=Ft(O,m,b);if(s){let j=0,T=0;c&&M<0?j=Oe(p+M+$,s[0][0]):!c&&M>0&&(j=Pe(p+z+$,s[1][0])),l&&I<0?T=Oe(x+I+P,s[0][1]):!l&&I>0&&(T=Pe(x+O+P,s[1][1])),y=Math.max(y,j),N=Math.max(N,T)}if(a){let j=0,T=0;c&&M>0?j=Pe(p+M,a[0][0]):!c&&M<0&&(j=Oe(p+z,a[1][0])),l&&I>0?T=Pe(x+I,a[0][1]):!l&&I<0&&(T=Oe(x+O,a[1][1])),y=Math.max(y,j),N=Math.max(N,T)}if(o){if(u){const j=Ft(z/k,m,b)*k;if(y=Math.max(y,j),s){let T=0;!c&&!l||c&&!l&&f?T=Pe(x+P+z/k,s[1][1])*k:T=Oe(x+P+(c?M:-M)/k,s[0][1])*k,y=Math.max(y,T)}if(a){let T=0;!c&&!l||c&&!l&&f?T=Oe(x+z/k,a[1][1])*k:T=Pe(x+(c?M:-M)/k,a[0][1])*k,y=Math.max(y,T)}}if(d){const j=Ft(O*k,v,w)/k;if(N=Math.max(N,j),s){let T=0;!c&&!l||l&&!c&&f?T=Pe(p+O*k+$,s[1][0])/k:T=Oe(p+(l?I:-I)*k+$,s[0][0])/k,N=Math.max(N,T)}if(a){let T=0;!c&&!l||l&&!c&&f?T=Oe(p+O*k,a[1][0])/k:T=Pe(p+(l?I:-I)*k,a[0][0])/k,N=Math.max(N,T)}}}I=I+(I<0?N:-N),M=M+(M<0?y:-y),o&&(f?z>O*k?I=(po(c,l)?-M:M)/k:M=(po(c,l)?-I:I)*k:u?(I=M/k,l=c):(M=I*k,c=l));const C=c?p+M:p,A=l?x+I:x;return{width:_+(c?-M:M),height:S+(l?-I:I),x:i[0]*M*(c?-1:1)+C,y:i[1]*I*(l?-1:1)+A}}const xs={width:0,height:0,x:0,y:0},Ah={...xs,pointerX:0,pointerY:0,aspectRatio:1};function Th(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[r-a,o-c],[r+i-a,o+s-c]]}function Oh({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=ce(e);let s={controlDirection:go("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:w}){let m={...xs},b={...Ah};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:go(l)};let p,x=null,_=[],S,k,M,I=!1;const z=ki().on("start",O=>{const{nodeLookup:$,transform:P,snapGrid:y,snapToGrid:N,nodeOrigin:C,paneDomNode:A}=n();if(p=$.get(t),!p)return;x=(A==null?void 0:A.getBoundingClientRect())??null;const{xSnapped:j,ySnapped:T}=pt(O.sourceEvent,{transform:P,snapGrid:y,snapToGrid:N,containerBounds:x});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...m,pointerX:j,pointerY:T,aspectRatio:m.width/m.height},S=void 0,k=Ge(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(S=$.get(p.parentId)),S&&p.extent==="parent"&&(k=[[0,0],[S.measured.width,S.measured.height]]),_=[],M=void 0;for(const[D,F]of $)if(F.parentId===t&&(_.push({id:D,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const H=Th(F,p,F.origin??C);M?M=[[Math.min(H[0][0],M[0][0]),Math.min(H[0][1],M[0][1])],[Math.max(H[1][0],M[1][0]),Math.max(H[1][1],M[1][1])]]:M=H}h==null||h(O,{...m})}).on("drag",O=>{const{transform:$,snapGrid:P,snapToGrid:y,nodeOrigin:N}=n(),C=pt(O.sourceEvent,{transform:$,snapGrid:P,snapToGrid:y,containerBounds:x}),A=[];if(!p)return;const{x:j,y:T,width:D,height:F}=m,H={},V=p.origin??N,{width:Y,height:q,x:J,y:G}=Ih(b,s.controlDirection,C,s.boundaries,s.keepAspectRatio,V,k,M),R=Y!==D,B=q!==F,K=J!==j&&R,U=G!==T&&B;if(!K&&!U&&!R&&!B)return;if((K||U||V[0]===1||V[1]===1)&&(H.x=K?J:m.x,H.y=U?G:m.y,m.x=H.x,m.y=H.y,_.length>0)){const ee=J-j,ne=G-T;for(const re of _)re.position={x:re.position.x-ee+V[0]*(Y-D),y:re.position.y-ne+V[1]*(q-F)},A.push(re)}if((R||B)&&(H.width=R&&(!s.resizeDirection||s.resizeDirection==="horizontal")?Y:m.width,H.height=B&&(!s.resizeDirection||s.resizeDirection==="vertical")?q:m.height,m.width=H.width,m.height=H.height),S&&p.expandParent){const ee=V[0]*(H.width??0);H.x&&H.x<ee&&(m.x=ee,b.x=b.x-(H.x-ee));const ne=V[1]*(H.height??0);H.y&&H.y<ne&&(m.y=ne,b.y=b.y-(H.y-ne))}const X=Mh({width:m.width,prevWidth:D,height:m.height,prevHeight:F,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),Z={...m,direction:X};(w==null?void 0:w(O,Z))!==!1&&(I=!0,g==null||g(O,Z),r(H,A))}).on("end",O=>{I&&(v==null||v(O,{...m}),o==null||o({...m}),I=!1)});i.call(z)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}const Ph={},mo=e=>{let t;const n=new Set,r=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Ph?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(r,o,c);return c},$h=e=>e?mo(e):mo,{useDebugValue:jh}=Lc,{useSyncExternalStoreWithSelector:Lh}=jc,Dh=e=>e;function ws(e,t=Dh,n){const r=Lh(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return jh(r),r}const yo=(e,t)=>{const n=$h(e),r=(o,i=t)=>ws(n,o,i);return Object.assign(r,n),r},Rh=(e,t)=>e?yo(e,t):yo;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,o]of e)if(!Object.is(o,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 wn=L.createContext(null),Hh=wn.Provider,vs=me.error001("react");function te(e,t){const n=L.useContext(wn);if(n===null)throw new Error(vs);return ws(n,e,t)}function oe(){const e=L.useContext(wn);if(e===null)throw new Error(vs);return L.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const xo={display:"none"},zh={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},bs="react-flow__node-desc",Es="react-flow__edge-desc",Fh="react-flow__aria-live",Bh=e=>e.ariaLiveMessage,Vh=e=>e.ariaLabelConfig;function Yh({rfId:e}){const t=te(Bh);return E.jsx("div",{id:`${Fh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:zh,children:t})}function Xh({rfId:e,disableKeyboardA11y:t}){const n=te(Vh);return E.jsxs(E.Fragment,{children:[E.jsx("div",{id:`${bs}-${e}`,style:xo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),E.jsx("div",{id:`${Es}-${e}`,style:xo,children:n["edge.a11yDescription.default"]}),!t&&E.jsx(Yh,{rfId:e})]})}const vn=L.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const s=`${e}`.split("-");return E.jsx("div",{className:se(["react-flow__panel",n,...s]),style:r,ref:i,...o,children:t})});vn.displayName="Panel";const wo="https://reactflow.dev?utm_source=attribution";function Wh({proOptions:e,position:t="bottom-right"}){return L.useEffect(()=>{},[]),e!=null&&e.hideAttribution?null:E.jsx(vn,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${wo}`,children:E.jsx("a",{href:wo,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Gh=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}},Bt=e=>e.id;function qh(e,t){return ie(e.selectedNodes.map(Bt),t.selectedNodes.map(Bt))&&ie(e.selectedEdges.map(Bt),t.selectedEdges.map(Bt))}function Kh({onSelectionChange:e}){const t=oe(),{selectedNodes:n,selectedEdges:r}=te(Gh,qh);return L.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const Uh=e=>!!e.onSelectionChangeHandlers;function Zh({onSelectionChange:e}){const t=te(Uh);return e||t?E.jsx(Kh,{onSelectionChange:e}):null}const _s=[0,0],Qh={x:0,y:0,zoom:1},Jh=["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"],vo=[...Jh,"rfId"],eg=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}),bo={translateExtent:vt,nodeOrigin:_s,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function tg(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=te(eg,ie),l=oe();L.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=bo,a()}),[]);const u=L.useRef(bo);return L.useEffect(()=>{for(const d of vo){const f=e[d],h=u.current[d];f!==h&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?r(f):d==="maxZoom"?o(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?l.setState({ariaLabelConfig:Xf(f)}):d==="fitView"?l.setState({fitViewQueued:f}):d==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[d]:f})))}u.current=e},vo.map(d=>e[d])),null}function Eo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function ng(e){var r;const[t,n]=L.useState(e==="system"?null:e);return L.useEffect(()=>{if(e!=="system"){n(e);return}const o=Eo(),i=()=>n(o!=null&&o.matches?"dark":"light");return i(),o==null||o.addEventListener("change",i),()=>{o==null||o.removeEventListener("change",i)}},[e]),t!==null?t:(r=Eo())!=null&&r.matches?"dark":"light"}const _o=typeof document<"u"?document:null;function Nt(e=null,t={target:_o,actInsideInputWithModifier:!0}){const[n,r]=L.useState(!1),o=L.useRef(!1),i=L.useRef(new Set([])),[s,a]=L.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace(/\+/g,`
2
2
  `).replace(`
3
3
 
4
4
  `,`