@code-partner/codepipe-hub 0.14.1-dev.389.g16ca7a21 → 0.14.1-dev.392.g2ee041d5

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.
@@ -9,7 +9,7 @@
9
9
  <link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png" />
10
10
  <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
11
11
  <meta name="theme-color" content="#0f141c" />
12
- <script type="module" crossorigin src="/assets/index-C4jvxAyb.js"></script>
12
+ <script type="module" crossorigin src="/assets/index-C1be47HC.js"></script>
13
13
  <link rel="stylesheet" crossorigin href="/assets/index-DLJp-BWJ.css">
14
14
  </head>
15
15
  <body>
@@ -1,4 +1,4 @@
1
- import{r as T,g as ga,R as pa,j as A}from"./index-Bgq2ZBdp.js";function st(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n<t.length;n++)(r=st(t[n]))!==""&&(e+=(e&&" ")+r);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var ma={value:()=>{}};function tn(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Le(n)}function Le(t){this._=t}function ya(t,e){return t.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&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Le.prototype=tn.prototype={constructor:Le,on:function(t,e){var n=this._,r=ya(t+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(t=r[i]).type)&&(o=xa(n[o],t.name)))return o;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(o=(t=r[i]).type)n[o]=hr(n[o],t.name,e);else if(e==null)for(o in n)n[o]=hr(n[o],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Le(t)},call:function(t,e){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(t))throw new Error("unknown type: "+t);for(i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],o=0,i=r.length;o<i;++o)r[o].value.apply(e,n)}};function xa(t,e){for(var n=0,r=t.length,o;n<r;++n)if((o=t[n]).name===e)return o.value}function hr(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=ma,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Cn="http://www.w3.org/1999/xhtml";const gr={svg:"http://www.w3.org/2000/svg",xhtml:Cn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function en(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),gr.hasOwnProperty(e)?{space:gr[e],local:t}:t}function wa(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Cn&&e.documentElement.namespaceURI===Cn?e.createElement(t):e.createElementNS(n,t)}}function va(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function wo(t){var e=en(t);return(e.local?va:wa)(e)}function ba(){}function Fn(t){return t==null?ba:function(){return this.querySelector(t)}}function _a(t){typeof t!="function"&&(t=Fn(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=new Array(s),c,u,l=0;l<s;++l)(c=i[l])&&(u=t.call(c,c.__data__,l,i))&&("__data__"in c&&(u.__data__=c.__data__),a[l]=u);return new ut(r,this._parents)}function Ea(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Sa(){return[]}function vo(t){return t==null?Sa:function(){return this.querySelectorAll(t)}}function Na(t){return function(){return Ea(t.apply(this,arguments))}}function Ma(t){typeof t=="function"?t=Na(t):t=vo(t);for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var s=e[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&(r.push(t.call(c,c.__data__,u,s)),o.push(c));return new ut(r,o)}function bo(t){return function(){return this.matches(t)}}function _o(t){return function(e){return e.matches(t)}}var Ca=Array.prototype.find;function ka(t){return function(){return Ca.call(this.children,t)}}function Aa(){return this.firstElementChild}function $a(t){return this.select(t==null?Aa:ka(typeof t=="function"?t:_o(t)))}var Ia=Array.prototype.filter;function Pa(){return Array.from(this.children)}function Ta(t){return function(){return Ia.call(this.children,t)}}function za(t){return this.selectAll(t==null?Pa:Ta(typeof t=="function"?t:_o(t)))}function Da(t){typeof t!="function"&&(t=bo(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&t.call(c,c.__data__,u,i)&&a.push(c);return new ut(r,this._parents)}function Eo(t){return new Array(t.length)}function La(){return new ut(this._enter||this._groups.map(Eo),this._parents)}function Oe(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Oe.prototype={constructor:Oe,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Ha(t){return function(){return t}}function Ra(t,e,n,r,o,i){for(var s=0,a,c=e.length,u=i.length;s<u;++s)(a=e[s])?(a.__data__=i[s],r[s]=a):n[s]=new Oe(t,i[s]);for(;s<c;++s)(a=e[s])&&(o[s]=a)}function Va(t,e,n,r,o,i,s){var a,c,u=new Map,l=e.length,f=i.length,d=new Array(l),h;for(a=0;a<l;++a)(c=e[a])&&(d[a]=h=s.call(c,c.__data__,a,e)+"",u.has(h)?o[a]=c:u.set(h,c));for(a=0;a<f;++a)h=s.call(t,i[a],a,i)+"",(c=u.get(h))?(r[a]=c,c.__data__=i[a],u.delete(h)):n[a]=new Oe(t,i[a]);for(a=0;a<l;++a)(c=e[a])&&u.get(d[a])===c&&(o[a]=c)}function Ba(t){return t.__data__}function Fa(t,e){if(!arguments.length)return Array.from(this,Ba);var n=e?Va:Ra,r=this._parents,o=this._groups;typeof t!="function"&&(t=Ha(t));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),u=0;u<i;++u){var l=r[u],f=o[u],d=f.length,h=Oa(t.call(l,l&&l.__data__,u,r)),g=h.length,v=a[u]=new Array(g),x=s[u]=new Array(g),m=c[u]=new Array(d);n(l,f,v,x,m,h,e);for(var b=0,p=0,w,S;b<g;++b)if(w=v[b]){for(b>=p&&(p=b+1);!(S=x[p])&&++p<g;);w._next=S||null}}return s=new ut(s,r),s._enter=a,s._exit=c,s}function Oa(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function ja(){return new ut(this._exit||this._groups.map(Eo),this._parents)}function Xa(t,e,n){var r=this.enter(),o=this,i=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(o=e(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Ya(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var u=n[c],l=r[c],f=u.length,d=a[c]=new Array(f),h,g=0;g<f;++g)(h=u[g]||l[g])&&(d[g]=h);for(;c<o;++c)a[c]=n[c];return new ut(a,this._parents)}function Wa(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],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 qa(t){t||(t=Ga);function e(f,d){return f&&d?t(f.__data__,d.__data__):!f-!d}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),u,l=0;l<a;++l)(u=s[l])&&(c[l]=u);c.sort(e)}return new ut(o,this._parents).order()}function Ga(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Ka(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Za(){return Array.from(this)}function Ua(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function Qa(){let t=0;for(const e of this)++t;return t}function Ja(){return!this.node()}function tc(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=e[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&t.call(a,a.__data__,i,o);return this}function ec(t){return function(){this.removeAttribute(t)}}function nc(t){return function(){this.removeAttributeNS(t.space,t.local)}}function rc(t,e){return function(){this.setAttribute(t,e)}}function oc(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ic(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function sc(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function ac(t,e){var n=en(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?nc:ec:typeof e=="function"?n.local?sc:ic:n.local?oc:rc)(n,e))}function So(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function cc(t){return function(){this.style.removeProperty(t)}}function uc(t,e,n){return function(){this.style.setProperty(t,e,n)}}function lc(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function fc(t,e,n){return arguments.length>1?this.each((e==null?cc:typeof e=="function"?lc:uc)(t,e,n??"")):Ut(this.node(),t)}function Ut(t,e){return t.style.getPropertyValue(e)||So(t).getComputedStyle(t,null).getPropertyValue(e)}function dc(t){return function(){delete this[t]}}function hc(t,e){return function(){this[t]=e}}function gc(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function pc(t,e){return arguments.length>1?this.each((e==null?dc:typeof e=="function"?gc:hc)(t,e)):this.node()[t]}function No(t){return t.trim().split(/^|\s+/)}function On(t){return t.classList||new Mo(t)}function Mo(t){this._node=t,this._names=No(t.getAttribute("class")||"")}Mo.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Co(t,e){for(var n=On(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function ko(t,e){for(var n=On(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function mc(t){return function(){Co(this,t)}}function yc(t){return function(){ko(this,t)}}function xc(t,e){return function(){(e.apply(this,arguments)?Co:ko)(this,t)}}function wc(t,e){var n=No(t+"");if(arguments.length<2){for(var r=On(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof e=="function"?xc:e?mc:yc)(n,e))}function vc(){this.textContent=""}function bc(t){return function(){this.textContent=t}}function _c(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Ec(t){return arguments.length?this.each(t==null?vc:(typeof t=="function"?_c:bc)(t)):this.node().textContent}function Sc(){this.innerHTML=""}function Nc(t){return function(){this.innerHTML=t}}function Mc(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Cc(t){return arguments.length?this.each(t==null?Sc:(typeof t=="function"?Mc:Nc)(t)):this.node().innerHTML}function kc(){this.nextSibling&&this.parentNode.appendChild(this)}function Ac(){return this.each(kc)}function $c(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ic(){return this.each($c)}function Pc(t){var e=typeof t=="function"?t:wo(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Tc(){return null}function zc(t,e){var n=typeof t=="function"?t:wo(t),r=e==null?Tc:typeof e=="function"?e:Fn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Dc(){var t=this.parentNode;t&&t.removeChild(this)}function Lc(){return this.each(Dc)}function Hc(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Rc(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Vc(t){return this.select(t?Rc:Hc)}function Bc(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Fc(t){return function(e){t.call(this,e,this.__data__)}}function Oc(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function jc(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,o=e.length,i;n<o;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++r]=i;++r?e.length=r:delete this.__on}}}function Xc(t,e,n){return function(){var r=this.__on,o,i=Fc(e);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===t.type&&o.name===t.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=e;return}}this.addEventListener(t.type,i,n),o={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(o):this.__on=[o]}}function Yc(t,e,n){var r=Oc(t+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,u=a.length,l;c<u;++c)for(o=0,l=a[c];o<i;++o)if((s=r[o]).type===l.type&&s.name===l.name)return l.value}return}for(a=e?Xc:jc,o=0;o<i;++o)this.each(a(r[o],e,n));return this}function Ao(t,e,n){var r=So(t),o=r.CustomEvent;typeof o=="function"?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function Wc(t,e){return function(){return Ao(this,t,e)}}function qc(t,e){return function(){return Ao(this,t,e.apply(this,arguments))}}function Gc(t,e){return this.each((typeof e=="function"?qc:Wc)(t,e))}function*Kc(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var $o=[null];function ut(t,e){this._groups=t,this._parents=e}function ve(){return new ut([[document.documentElement]],$o)}function Zc(){return this}ut.prototype=ve.prototype={constructor:ut,select:_a,selectAll:Ma,selectChild:$a,selectChildren:za,filter:Da,data:Fa,enter:La,exit:ja,join:Xa,merge:Ya,selection:Zc,order:Wa,sort:qa,call:Ka,nodes:Za,node:Ua,size:Qa,empty:Ja,each:tc,attr:ac,style:fc,property:pc,classed:wc,text:Ec,html:Cc,raise:Ac,lower:Ic,append:Pc,insert:zc,remove:Lc,clone:Vc,datum:Bc,on:Yc,dispatch:Gc,[Symbol.iterator]:Kc};function ct(t){return typeof t=="string"?new ut([[document.querySelector(t)]],[document.documentElement]):new ut([[t]],$o)}function Uc(t){let e;for(;e=t.sourceEvent;)t=e;return t}function dt(t,e){if(t=Uc(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var o=e.getBoundingClientRect();return[t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop]}}return[t.pageX,t.pageY]}const Qc={passive:!1},fe={capture:!0,passive:!1};function yn(t){t.stopImmediatePropagation()}function Kt(t){t.preventDefault(),t.stopImmediatePropagation()}function Io(t){var e=t.document.documentElement,n=ct(t).on("dragstart.drag",Kt,fe);"onselectstart"in e?n.on("selectstart.drag",Kt,fe):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Po(t,e){var n=t.document.documentElement,r=ct(t).on("dragstart.drag",null);e&&(r.on("click.drag",Kt,fe),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 Ce=t=>()=>t;function kn(t,{sourceEvent:e,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:c,dy:u,dispatch:l}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,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:u,enumerable:!0,configurable:!0},_:{value:l}})}kn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Jc(t){return!t.ctrlKey&&!t.button}function tu(){return this.parentNode}function eu(t,e){return e??{x:t.x,y:t.y}}function nu(){return navigator.maxTouchPoints||"ontouchstart"in this}function To(){var t=Jc,e=tu,n=eu,r=nu,o={},i=tn("start","drag","end"),s=0,a,c,u,l,f=0;function d(w){w.on("mousedown.drag",h).filter(r).on("touchstart.drag",x).on("touchmove.drag",m,Qc).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,S){if(!(l||!t.call(this,w,S))){var E=p(this,e.call(this,w,S),w,S,"mouse");E&&(ct(w.view).on("mousemove.drag",g,fe).on("mouseup.drag",v,fe),Io(w.view),yn(w),u=!1,a=w.clientX,c=w.clientY,E("start",w))}}function g(w){if(Kt(w),!u){var S=w.clientX-a,E=w.clientY-c;u=S*S+E*E>f}o.mouse("drag",w)}function v(w){ct(w.view).on("mousemove.drag mouseup.drag",null),Po(w.view,u),Kt(w),o.mouse("end",w)}function x(w,S){if(t.call(this,w,S)){var E=w.changedTouches,k=e.call(this,w,S),$=E.length,I,F;for(I=0;I<$;++I)(F=p(this,k,w,S,E[I].identifier,E[I]))&&(yn(w),F("start",w,E[I]))}}function m(w){var S=w.changedTouches,E=S.length,k,$;for(k=0;k<E;++k)($=o[S[k].identifier])&&(Kt(w),$("drag",w,S[k]))}function b(w){var S=w.changedTouches,E=S.length,k,$;for(l&&clearTimeout(l),l=setTimeout(function(){l=null},500),k=0;k<E;++k)($=o[S[k].identifier])&&(yn(w),$("end",w,S[k]))}function p(w,S,E,k,$,I){var F=i.copy(),z=dt(I||E,S),B,D,y;if((y=n.call(w,new kn("beforestart",{sourceEvent:E,target:d,identifier:$,active:s,x:z[0],y:z[1],dx:0,dy:0,dispatch:F}),k))!=null)return B=y.x-z[0]||0,D=y.y-z[1]||0,function N(_,C,P){var M=z,R;switch(_){case"start":o[$]=N,R=s++;break;case"end":delete o[$],--s;case"drag":z=dt(P||C,S),R=s;break}F.call(_,w,new kn(_,{sourceEvent:C,subject:y,target:d,identifier:$,active:R,x:z[0]+B,y:z[1]+D,dx:z[0]-M[0],dy:z[1]-M[1],dispatch:F}),k)}}return d.filter=function(w){return arguments.length?(t=typeof w=="function"?w:Ce(!!w),d):t},d.container=function(w){return arguments.length?(e=typeof w=="function"?w:Ce(w),d):e},d.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Ce(w),d):n},d.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:Ce(!!w),d):r},d.on=function(){var w=i.on.apply(i,arguments);return w===i?d:w},d.clickDistance=function(w){return arguments.length?(f=(w=+w)*w,d):Math.sqrt(f)},d}function jn(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function zo(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function be(){}var de=.7,je=1/de,Zt="\\s*([+-]?\\d+)\\s*",he="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",bt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ru=/^#([0-9a-f]{3,8})$/,ou=new RegExp(`^rgb\\(${Zt},${Zt},${Zt}\\)$`),iu=new RegExp(`^rgb\\(${bt},${bt},${bt}\\)$`),su=new RegExp(`^rgba\\(${Zt},${Zt},${Zt},${he}\\)$`),au=new RegExp(`^rgba\\(${bt},${bt},${bt},${he}\\)$`),cu=new RegExp(`^hsl\\(${he},${bt},${bt}\\)$`),uu=new RegExp(`^hsla\\(${he},${bt},${bt},${he}\\)$`),pr={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};jn(be,Ft,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:mr,formatHex:mr,formatHex8:lu,formatHsl:fu,formatRgb:yr,toString:yr});function mr(){return this.rgb().formatHex()}function lu(){return this.rgb().formatHex8()}function fu(){return Do(this).formatHsl()}function yr(){return this.rgb().formatRgb()}function Ft(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ru.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?xr(e):n===3?new at(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?ke(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?ke(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=ou.exec(t))?new at(e[1],e[2],e[3],1):(e=iu.exec(t))?new at(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=su.exec(t))?ke(e[1],e[2],e[3],e[4]):(e=au.exec(t))?ke(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=cu.exec(t))?br(e[1],e[2]/100,e[3]/100,1):(e=uu.exec(t))?br(e[1],e[2]/100,e[3]/100,e[4]):pr.hasOwnProperty(t)?xr(pr[t]):t==="transparent"?new at(NaN,NaN,NaN,0):null}function xr(t){return new at(t>>16&255,t>>8&255,t&255,1)}function ke(t,e,n,r){return r<=0&&(t=e=n=NaN),new at(t,e,n,r)}function du(t){return t instanceof be||(t=Ft(t)),t?(t=t.rgb(),new at(t.r,t.g,t.b,t.opacity)):new at}function An(t,e,n,r){return arguments.length===1?du(t):new at(t,e,n,r??1)}function at(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}jn(at,An,zo(be,{brighter(t){return t=t==null?je:Math.pow(je,t),new at(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?de:Math.pow(de,t),new at(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new at(Vt(this.r),Vt(this.g),Vt(this.b),Xe(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:wr,formatHex:wr,formatHex8:hu,formatRgb:vr,toString:vr}));function wr(){return`#${Rt(this.r)}${Rt(this.g)}${Rt(this.b)}`}function hu(){return`#${Rt(this.r)}${Rt(this.g)}${Rt(this.b)}${Rt((isNaN(this.opacity)?1:this.opacity)*255)}`}function vr(){const t=Xe(this.opacity);return`${t===1?"rgb(":"rgba("}${Vt(this.r)}, ${Vt(this.g)}, ${Vt(this.b)}${t===1?")":`, ${t})`}`}function Xe(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Vt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Rt(t){return t=Vt(t),(t<16?"0":"")+t.toString(16)}function br(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ht(t,e,n,r)}function Do(t){if(t instanceof ht)return new ht(t.h,t.s,t.l,t.opacity);if(t instanceof be||(t=Ft(t)),!t)return new ht;if(t instanceof ht)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(e===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-e)/a+2:s=(e-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new ht(s,a,c,t.opacity)}function gu(t,e,n,r){return arguments.length===1?Do(t):new ht(t,e,n,r??1)}function ht(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}jn(ht,gu,zo(be,{brighter(t){return t=t==null?je:Math.pow(je,t),new ht(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?de:Math.pow(de,t),new ht(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new at(xn(t>=240?t-240:t+120,o,r),xn(t,o,r),xn(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new ht(_r(this.h),Ae(this.s),Ae(this.l),Xe(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 t=Xe(this.opacity);return`${t===1?"hsl(":"hsla("}${_r(this.h)}, ${Ae(this.s)*100}%, ${Ae(this.l)*100}%${t===1?")":`, ${t})`}`}}));function _r(t){return t=(t||0)%360,t<0?t+360:t}function Ae(t){return Math.max(0,Math.min(1,t||0))}function xn(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Xn=t=>()=>t;function pu(t,e){return function(n){return t+n*e}}function mu(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function yu(t){return(t=+t)==1?Lo:function(e,n){return n-e?mu(e,n,t):Xn(isNaN(e)?n:e)}}function Lo(t,e){var n=e-t;return n?pu(t,n):Xn(isNaN(t)?e:t)}const Ye=function t(e){var n=yu(e);function r(o,i){var s=n((o=An(o)).r,(i=An(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),u=Lo(o.opacity,i.opacity);return function(l){return o.r=s(l),o.g=a(l),o.b=c(l),o.opacity=u(l),o+""}}return r.gamma=t,r}(1);function xu(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=t[o]*(1-i)+e[o]*i;return r}}function wu(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function vu(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=ue(t[s],e[s]);for(;s<n;++s)i[s]=e[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function bu(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function vt(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function _u(t,e){var n={},r={},o;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(o in e)o in t?n[o]=ue(t[o],e[o]):r[o]=e[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var $n=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wn=new RegExp($n.source,"g");function Eu(t){return function(){return t}}function Su(t){return function(e){return t(e)+""}}function Ho(t,e){var n=$n.lastIndex=wn.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(t=t+"",e=e+"";(r=$n.exec(t))&&(o=wn.exec(e));)(i=o.index)>n&&(i=e.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:vt(r,o)})),n=wn.lastIndex;return n<e.length&&(i=e.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?Su(c[0].x):Eu(e):(e=c.length,function(u){for(var l=0,f;l<e;++l)a[(f=c[l]).i]=f.x(u);return a.join("")})}function ue(t,e){var n=typeof e,r;return e==null||n==="boolean"?Xn(e):(n==="number"?vt:n==="string"?(r=Ft(e))?(e=r,Ye):Ho:e instanceof Ft?Ye:e instanceof Date?bu:wu(e)?xu:Array.isArray(e)?vu:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?_u:vt)(t,e)}var Er=180/Math.PI,In={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ro(t,e,n,r,o,i){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),t*r<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*Er,skewX:Math.atan(c)*Er,scaleX:s,scaleY:a}}var $e;function Nu(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?In:Ro(e.a,e.b,e.c,e.d,e.e,e.f)}function Mu(t){return t==null||($e||($e=document.createElementNS("http://www.w3.org/2000/svg","g")),$e.setAttribute("transform",t),!(t=$e.transform.baseVal.consolidate()))?In:(t=t.matrix,Ro(t.a,t.b,t.c,t.d,t.e,t.f))}function Vo(t,e,n,r){function o(u){return u.length?u.pop()+" ":""}function i(u,l,f,d,h,g){if(u!==f||l!==d){var v=h.push("translate(",null,e,null,n);g.push({i:v-4,x:vt(u,f)},{i:v-2,x:vt(l,d)})}else(f||d)&&h.push("translate("+f+e+d+n)}function s(u,l,f,d){u!==l?(u-l>180?l+=360:l-u>180&&(u+=360),d.push({i:f.push(o(f)+"rotate(",null,r)-2,x:vt(u,l)})):l&&f.push(o(f)+"rotate("+l+r)}function a(u,l,f,d){u!==l?d.push({i:f.push(o(f)+"skewX(",null,r)-2,x:vt(u,l)}):l&&f.push(o(f)+"skewX("+l+r)}function c(u,l,f,d,h,g){if(u!==f||l!==d){var v=h.push(o(h)+"scale(",null,",",null,")");g.push({i:v-4,x:vt(u,f)},{i:v-2,x:vt(l,d)})}else(f!==1||d!==1)&&h.push(o(h)+"scale("+f+","+d+")")}return function(u,l){var f=[],d=[];return u=t(u),l=t(l),i(u.translateX,u.translateY,l.translateX,l.translateY,f,d),s(u.rotate,l.rotate,f,d),a(u.skewX,l.skewX,f,d),c(u.scaleX,u.scaleY,l.scaleX,l.scaleY,f,d),u=l=null,function(h){for(var g=-1,v=d.length,x;++g<v;)f[(x=d[g]).i]=x.x(h);return f.join("")}}}var Cu=Vo(Nu,"px, ","px)","deg)"),ku=Vo(Mu,", ",")",")"),Au=1e-12;function Sr(t){return((t=Math.exp(t))+1/t)/2}function $u(t){return((t=Math.exp(t))-1/t)/2}function Iu(t){return((t=Math.exp(2*t))-1)/(t+1)}const He=function t(e,n,r){function o(i,s){var a=i[0],c=i[1],u=i[2],l=s[0],f=s[1],d=s[2],h=l-a,g=f-c,v=h*h+g*g,x,m;if(v<Au)m=Math.log(d/u)/e,x=function(k){return[a+k*h,c+k*g,u*Math.exp(e*k*m)]};else{var b=Math.sqrt(v),p=(d*d-u*u+r*v)/(2*u*n*b),w=(d*d-u*u-r*v)/(2*d*n*b),S=Math.log(Math.sqrt(p*p+1)-p),E=Math.log(Math.sqrt(w*w+1)-w);m=(E-S)/e,x=function(k){var $=k*m,I=Sr(S),F=u/(n*b)*(I*Iu(e*$+S)-$u(S));return[a+F*h,c+F*g,u*I/Sr(e*$+S)]}}return x.duration=m*1e3*e/Math.SQRT2,x}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return t(s,a,c)},o}(Math.SQRT2,2,4);var Qt=0,ae=0,ie=0,Bo=1e3,We,ce,qe=0,Ot=0,nn=0,ge=typeof performance=="object"&&performance.now?performance:Date,Fo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Yn(){return Ot||(Fo(Pu),Ot=ge.now()+nn)}function Pu(){Ot=0}function Ge(){this._call=this._time=this._next=null}Ge.prototype=Oo.prototype={constructor:Ge,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Yn():+n)+(e==null?0:+e),!this._next&&ce!==this&&(ce?ce._next=this:We=this,ce=this),this._call=t,this._time=n,Pn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Pn())}};function Oo(t,e,n){var r=new Ge;return r.restart(t,e,n),r}function Tu(){Yn(),++Qt;for(var t=We,e;t;)(e=Ot-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Qt}function Nr(){Ot=(qe=ge.now())+nn,Qt=ae=0;try{Tu()}finally{Qt=0,Du(),Ot=0}}function zu(){var t=ge.now(),e=t-qe;e>Bo&&(nn-=e,qe=t)}function Du(){for(var t,e=We,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:We=n);ce=t,Pn(r)}function Pn(t){if(!Qt){ae&&(ae=clearTimeout(ae));var e=t-Ot;e>24?(t<1/0&&(ae=setTimeout(Nr,t-ge.now()-nn)),ie&&(ie=clearInterval(ie))):(ie||(qe=ge.now(),ie=setInterval(zu,Bo)),Qt=1,Fo(Nr))}}function Mr(t,e,n){var r=new Ge;return e=e==null?0:+e,r.restart(o=>{r.stop(),t(o+e)},e,n),r}var Lu=tn("start","end","cancel","interrupt"),Hu=[],jo=0,Cr=1,Tn=2,Re=3,kr=4,zn=5,Ve=6;function rn(t,e,n,r,o,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Ru(t,n,{name:e,index:r,group:o,on:Lu,tween:Hu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:jo})}function Wn(t,e){var n=yt(t,e);if(n.state>jo)throw new Error("too late; already scheduled");return n}function _t(t,e){var n=yt(t,e);if(n.state>Re)throw new Error("too late; already running");return n}function yt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Ru(t,e,n){var r=t.__transition,o;r[e]=n,n.timer=Oo(i,0,n.time);function i(u){n.state=Cr,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var l,f,d,h;if(n.state!==Cr)return c();for(l in r)if(h=r[l],h.name===n.name){if(h.state===Re)return Mr(s);h.state===kr?(h.state=Ve,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete r[l]):+l<e&&(h.state=Ve,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete r[l])}if(Mr(function(){n.state===Re&&(n.state=kr,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=Tn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Tn){for(n.state=Re,o=new Array(d=n.tween.length),l=0,f=-1;l<d;++l)(h=n.tween[l].value.call(t,t.__data__,n.index,n.group))&&(o[++f]=h);o.length=f+1}}function a(u){for(var l=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=zn,1),f=-1,d=o.length;++f<d;)o[f].call(t,l);n.state===zn&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Ve,n.timer.stop(),delete r[e];for(var u in r)return;delete t.__transition}}function Be(t,e){var n=t.__transition,r,o,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((r=n[s]).name!==e){i=!1;continue}o=r.state>Tn&&r.state<zn,r.state=Ve,r.timer.stop(),r.on.call(o?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}i&&delete t.__transition}}function Vu(t){return this.each(function(){Be(this,t)})}function Bu(t,e){var n,r;return function(){var o=_t(this,t),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===e){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function Fu(t,e,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=_t(this,t),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:e,value:n},c=0,u=o.length;c<u;++c)if(o[c].name===e){o[c]=a;break}c===u&&o.push(a)}i.tween=o}}function Ou(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=yt(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===t)return s.value;return null}return this.each((e==null?Bu:Fu)(n,t,e))}function qn(t,e,n){var r=t._id;return t.each(function(){var o=_t(this,r);(o.value||(o.value={}))[e]=n.apply(this,arguments)}),function(o){return yt(o,r).value[e]}}function Xo(t,e){var n;return(typeof e=="number"?vt:e instanceof Ft?Ye:(n=Ft(e))?(e=n,Ye):Ho)(t,e)}function ju(t){return function(){this.removeAttribute(t)}}function Xu(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Yu(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttribute(t);return s===o?null:s===r?i:i=e(r=s,n)}}function Wu(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===o?null:s===r?i:i=e(r=s,n)}}function qu(t,e,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a)))}}function Gu(t,e,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a)))}}function Ku(t,e){var n=en(t),r=n==="transform"?ku:Xo;return this.attrTween(t,typeof e=="function"?(n.local?Gu:qu)(n,r,qn(this,"attr."+t,e)):e==null?(n.local?Xu:ju)(n):(n.local?Wu:Yu)(n,r,e))}function Zu(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Uu(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Qu(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Uu(t,i)),n}return o._value=e,o}function Ju(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Zu(t,i)),n}return o._value=e,o}function tl(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=en(t);return this.tween(n,(r.local?Qu:Ju)(r,e))}function el(t,e){return function(){Wn(this,t).delay=+e.apply(this,arguments)}}function nl(t,e){return e=+e,function(){Wn(this,t).delay=e}}function rl(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?el:nl)(e,t)):yt(this.node(),e).delay}function ol(t,e){return function(){_t(this,t).duration=+e.apply(this,arguments)}}function il(t,e){return e=+e,function(){_t(this,t).duration=e}}function sl(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?ol:il)(e,t)):yt(this.node(),e).duration}function al(t,e){if(typeof e!="function")throw new Error;return function(){_t(this,t).ease=e}}function cl(t){var e=this._id;return arguments.length?this.each(al(e,t)):yt(this.node(),e).ease}function ul(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;_t(this,t).ease=n}}function ll(t){if(typeof t!="function")throw new Error;return this.each(ul(this._id,t))}function fl(t){typeof t!="function"&&(t=bo(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&t.call(c,c.__data__,u,i)&&a.push(c);return new At(r,this._parents,this._name,this._id)}function dl(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=e[a],u=n[a],l=c.length,f=s[a]=new Array(l),d,h=0;h<l;++h)(d=c[h]||u[h])&&(f[h]=d);for(;a<r;++a)s[a]=e[a];return new At(s,this._parents,this._name,this._id)}function hl(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function gl(t,e,n){var r,o,i=hl(e)?Wn:_t;return function(){var s=i(this,t),a=s.on;a!==r&&(o=(r=a).copy()).on(e,n),s.on=o}}function pl(t,e){var n=this._id;return arguments.length<2?yt(this.node(),n).on.on(t):this.each(gl(n,t,e))}function ml(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function yl(){return this.on("end.remove",ml(this._id))}function xl(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Fn(t));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,u=i[s]=new Array(c),l,f,d=0;d<c;++d)(l=a[d])&&(f=t.call(l,l.__data__,d,a))&&("__data__"in l&&(f.__data__=l.__data__),u[d]=f,rn(u[d],e,n,d,u,yt(l,n)));return new At(i,this._parents,e,n)}function wl(t){var e=this._name,n=this._id;typeof t!="function"&&(t=vo(t));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],u=c.length,l,f=0;f<u;++f)if(l=c[f]){for(var d=t.call(l,l.__data__,f,c),h,g=yt(l,n),v=0,x=d.length;v<x;++v)(h=d[v])&&rn(h,e,n,v,d,g);i.push(d),s.push(l)}return new At(i,s,e,n)}var vl=ve.prototype.constructor;function bl(){return new vl(this._groups,this._parents)}function _l(t,e){var n,r,o;return function(){var i=Ut(this,t),s=(this.style.removeProperty(t),Ut(this,t));return i===s?null:i===n&&s===r?o:o=e(n=i,r=s)}}function Yo(t){return function(){this.style.removeProperty(t)}}function El(t,e,n){var r,o=n+"",i;return function(){var s=Ut(this,t);return s===o?null:s===r?i:i=e(r=s,n)}}function Sl(t,e,n){var r,o,i;return function(){var s=Ut(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),Ut(this,t))),s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a))}}function Nl(t,e){var n,r,o,i="style."+e,s="end."+i,a;return function(){var c=_t(this,t),u=c.on,l=c.value[i]==null?a||(a=Yo(e)):void 0;(u!==n||o!==l)&&(r=(n=u).copy()).on(s,o=l),c.on=r}}function Ml(t,e,n){var r=(t+="")=="transform"?Cu:Xo;return e==null?this.styleTween(t,_l(t,r)).on("end.style."+t,Yo(t)):typeof e=="function"?this.styleTween(t,Sl(t,r,qn(this,"style."+t,e))).each(Nl(this._id,t)):this.styleTween(t,El(t,r,e),n).on("end.style."+t,null)}function Cl(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function kl(t,e,n){var r,o;function i(){var s=e.apply(this,arguments);return s!==o&&(r=(o=s)&&Cl(t,s,n)),r}return i._value=e,i}function Al(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,kl(t,e,n??""))}function $l(t){return function(){this.textContent=t}}function Il(t){return function(){var e=t(this);this.textContent=e??""}}function Pl(t){return this.tween("text",typeof t=="function"?Il(qn(this,"text",t)):$l(t==null?"":t+""))}function Tl(t){return function(e){this.textContent=t.call(this,e)}}function zl(t){var e,n;function r(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&Tl(o)),e}return r._value=t,r}function Dl(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,zl(t))}function Ll(){for(var t=this._name,e=this._id,n=Wo(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)if(c=s[u]){var l=yt(c,e);rn(c,t,n,u,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new At(r,this._parents,t,n)}function Hl(){var t,e,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 u=_t(this,r),l=u.on;l!==t&&(e=(t=l).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),u.on=e}),o===0&&i()})}var Rl=0;function At(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Wo(){return++Rl}var Ct=ve.prototype;At.prototype={constructor:At,select:xl,selectAll:wl,selectChild:Ct.selectChild,selectChildren:Ct.selectChildren,filter:fl,merge:dl,selection:bl,transition:Ll,call:Ct.call,nodes:Ct.nodes,node:Ct.node,size:Ct.size,empty:Ct.empty,each:Ct.each,on:pl,attr:Ku,attrTween:tl,style:Ml,styleTween:Al,text:Pl,textTween:Dl,remove:yl,tween:Ou,delay:rl,duration:sl,ease:cl,easeVarying:ll,end:Hl,[Symbol.iterator]:Ct[Symbol.iterator]};function Vl(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Bl={time:null,delay:0,duration:250,ease:Vl};function Fl(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Ol(t){var e,n;t instanceof At?(e=t._id,t=t._name):(e=Wo(),(n=Bl).time=Yn(),t=t==null?null:t+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&rn(c,t,e,u,s,n||Fl(c,e));return new At(r,this._parents,t,e)}ve.prototype.interrupt=Vu;ve.prototype.transition=Ol;const Ie=t=>()=>t;function jl(t,{sourceEvent:e,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function kt(t,e,n){this.k=t,this.x=e,this.y=n}kt.prototype={constructor:kt,scale:function(t){return t===1?this:new kt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new kt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var on=new kt(1,0,0);qo.prototype=kt.prototype;function qo(t){for(;!t.__zoom;)if(!(t=t.parentNode))return on;return t.__zoom}function vn(t){t.stopImmediatePropagation()}function se(t){t.preventDefault(),t.stopImmediatePropagation()}function Xl(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Yl(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Ar(){return this.__zoom||on}function Wl(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function ql(){return navigator.maxTouchPoints||"ontouchstart"in this}function Gl(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.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 Go(){var t=Xl,e=Yl,n=Gl,r=Wl,o=ql,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=He,u=tn("start","zoom","end"),l,f,d,h=500,g=150,v=0,x=10;function m(y){y.property("__zoom",Ar).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",F).filter(o).on("touchstart.zoom",z).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,N,_,C){var P=y.selection?y.selection():y;P.property("__zoom",Ar),y!==P?S(y,N,_,C):P.interrupt().each(function(){E(this,arguments).event(C).start().zoom(null,typeof N=="function"?N.apply(this,arguments):N).end()})},m.scaleBy=function(y,N,_,C){m.scaleTo(y,function(){var P=this.__zoom.k,M=typeof N=="function"?N.apply(this,arguments):N;return P*M},_,C)},m.scaleTo=function(y,N,_,C){m.transform(y,function(){var P=e.apply(this,arguments),M=this.__zoom,R=_==null?w(P):typeof _=="function"?_.apply(this,arguments):_,V=M.invert(R),H=typeof N=="function"?N.apply(this,arguments):N;return n(p(b(M,H),R,V),P,s)},_,C)},m.translateBy=function(y,N,_,C){m.transform(y,function(){return n(this.__zoom.translate(typeof N=="function"?N.apply(this,arguments):N,typeof _=="function"?_.apply(this,arguments):_),e.apply(this,arguments),s)},null,C)},m.translateTo=function(y,N,_,C,P){m.transform(y,function(){var M=e.apply(this,arguments),R=this.__zoom,V=C==null?w(M):typeof C=="function"?C.apply(this,arguments):C;return n(on.translate(V[0],V[1]).scale(R.k).translate(typeof N=="function"?-N.apply(this,arguments):-N,typeof _=="function"?-_.apply(this,arguments):-_),M,s)},C,P)};function b(y,N){return N=Math.max(i[0],Math.min(i[1],N)),N===y.k?y:new kt(N,y.x,y.y)}function p(y,N,_){var C=N[0]-_[0]*y.k,P=N[1]-_[1]*y.k;return C===y.x&&P===y.y?y:new kt(y.k,C,P)}function w(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function S(y,N,_,C){y.on("start.zoom",function(){E(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(C).end()}).tween("zoom",function(){var P=this,M=arguments,R=E(P,M).event(C),V=e.apply(P,M),H=_==null?w(V):typeof _=="function"?_.apply(P,M):_,j=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),X=P.__zoom,G=typeof N=="function"?N.apply(P,M):N,Q=c(X.invert(H).concat(j/X.k),G.invert(H).concat(j/G.k));return function(K){if(K===1)K=G;else{var L=Q(K),O=j/L[2];K=new kt(O,H[0]-L[0]*O,H[1]-L[1]*O)}R.zoom(null,K)}})}function E(y,N,_){return!_&&y.__zooming||new k(y,N)}function k(y,N){this.that=y,this.args=N,this.active=0,this.sourceEvent=null,this.extent=e.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=ct(this.that).datum();u.call(y,this.that,new jl(y,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:u}),N)}};function $(y,...N){if(!t.apply(this,arguments))return;var _=E(this,N).event(y),C=this.__zoom,P=Math.max(i[0],Math.min(i[1],C.k*Math.pow(2,r.apply(this,arguments)))),M=dt(y);if(_.wheel)(_.mouse[0][0]!==M[0]||_.mouse[0][1]!==M[1])&&(_.mouse[1]=C.invert(_.mouse[0]=M)),clearTimeout(_.wheel);else{if(C.k===P)return;_.mouse=[M,C.invert(M)],Be(this),_.start()}se(y),_.wheel=setTimeout(R,g),_.zoom("mouse",n(p(b(C,P),_.mouse[0],_.mouse[1]),_.extent,s));function R(){_.wheel=null,_.end()}}function I(y,...N){if(d||!t.apply(this,arguments))return;var _=y.currentTarget,C=E(this,N,!0).event(y),P=ct(y.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",j,!0),M=dt(y,_),R=y.clientX,V=y.clientY;Io(y.view),vn(y),C.mouse=[M,this.__zoom.invert(M)],Be(this),C.start();function H(X){if(se(X),!C.moved){var G=X.clientX-R,Q=X.clientY-V;C.moved=G*G+Q*Q>v}C.event(X).zoom("mouse",n(p(C.that.__zoom,C.mouse[0]=dt(X,_),C.mouse[1]),C.extent,s))}function j(X){P.on("mousemove.zoom mouseup.zoom",null),Po(X.view,C.moved),se(X),C.event(X).end()}}function F(y,...N){if(t.apply(this,arguments)){var _=this.__zoom,C=dt(y.changedTouches?y.changedTouches[0]:y,this),P=_.invert(C),M=_.k*(y.shiftKey?.5:2),R=n(p(b(_,M),C,P),e.apply(this,N),s);se(y),a>0?ct(this).transition().duration(a).call(S,R,C,y):ct(this).call(m.transform,R,C,y)}}function z(y,...N){if(t.apply(this,arguments)){var _=y.touches,C=_.length,P=E(this,N,y.changedTouches.length===C).event(y),M,R,V,H;for(vn(y),R=0;R<C;++R)V=_[R],H=dt(V,this),H=[H,this.__zoom.invert(H),V.identifier],P.touch0?!P.touch1&&P.touch0[2]!==H[2]&&(P.touch1=H,P.taps=0):(P.touch0=H,M=!0,P.taps=1+!!l);l&&(l=clearTimeout(l)),M&&(P.taps<2&&(f=H[0],l=setTimeout(function(){l=null},h)),Be(this),P.start())}}function B(y,...N){if(this.__zooming){var _=E(this,N).event(y),C=y.changedTouches,P=C.length,M,R,V,H;for(se(y),M=0;M<P;++M)R=C[M],V=dt(R,this),_.touch0&&_.touch0[2]===R.identifier?_.touch0[0]=V:_.touch1&&_.touch1[2]===R.identifier&&(_.touch1[0]=V);if(R=_.that.__zoom,_.touch1){var j=_.touch0[0],X=_.touch0[1],G=_.touch1[0],Q=_.touch1[1],K=(K=G[0]-j[0])*K+(K=G[1]-j[1])*K,L=(L=Q[0]-X[0])*L+(L=Q[1]-X[1])*L;R=b(R,Math.sqrt(K/L)),V=[(j[0]+G[0])/2,(j[1]+G[1])/2],H=[(X[0]+Q[0])/2,(X[1]+Q[1])/2]}else if(_.touch0)V=_.touch0[0],H=_.touch0[1];else return;_.zoom("touch",n(p(R,V,H),_.extent,s))}}function D(y,...N){if(this.__zooming){var _=E(this,N).event(y),C=y.changedTouches,P=C.length,M,R;for(vn(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),M=0;M<P;++M)R=C[M],_.touch0&&_.touch0[2]===R.identifier?delete _.touch0:_.touch1&&_.touch1[2]===R.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&(R=dt(R,this),Math.hypot(f[0]-R[0],f[1]-R[1])<x)){var V=ct(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(r=typeof y=="function"?y:Ie(+y),m):r},m.filter=function(y){return arguments.length?(t=typeof y=="function"?y:Ie(!!y),m):t},m.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:Ie(!!y),m):o},m.extent=function(y){return arguments.length?(e=typeof y=="function"?y:Ie([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):e},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=u.on.apply(u,arguments);return y===u?m:y},m.clickDistance=function(y){return arguments.length?(v=(y=+y)*y,m):Math.sqrt(v)},m.tapDistance=function(y){return arguments.length?(x=+y,m):x},m}const mt={error001:(t="react")=>`Seems like you have not used ${t==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${t}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:t=>`Node type "${t}" 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:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:r}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/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:t=>`Edge with id "${t}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},pe=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ko=["Enter"," ","Escape"],Zo={"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:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, 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 Jt;(function(t){t.Strict="strict",t.Loose="loose"})(Jt||(Jt={}));var Bt;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(Bt||(Bt={}));var me;(function(t){t.Partial="partial",t.Full="full"})(me||(me={}));const Uo={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Pt;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Pt||(Pt={}));var Ke;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Ke||(Ke={}));var q;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(q||(q={}));const $r={[q.Left]:q.Right,[q.Right]:q.Left,[q.Top]:q.Bottom,[q.Bottom]:q.Top};function Qo(t){return t===null?null:t?"valid":"invalid"}const Jo=t=>!!t&&typeof t=="object"&&"id"in t&&"source"in t&&"target"in t,Kl=t=>!!t&&typeof t=="object"&&"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Gn=t=>!!t&&typeof t=="object"&&"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),_e=(t,e=[0,0])=>{const{width:n,height:r}=Et(t),o=t.origin??e,i=n*o[0],s=r*o[1];return{x:t.position.x-i,y:t.position.y-s}},Zl=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,o)=>{const i=typeof o=="string";let s=!e.nodeLookup&&!i?o:void 0;e.nodeLookup&&(s=i?e.nodeLookup.get(o):Gn(o)?o:e.nodeLookup.get(o.id));const a=s?Ze(s,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return sn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return an(n)},Ee=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return t.forEach(o=>{(e.filter===void 0||e.filter(o))&&(n=sn(n,Ze(o)),r=!0)}),r?an(n):{x:0,y:0,width:0,height:0}},Kn=(t,e,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a=(e.x-n)/o,c=(e.y-r)/o,u=e.width/o,l=e.height/o,f=[];for(const d of t.values()){const{measured:h,selectable:g=!0,hidden:v=!1}=d;if(s&&!g||v)continue;const x=h.width??d.width??d.initialWidth??0,m=h.height??d.height??d.initialHeight??0,{x:b,y:p}=d.internals.positionAbsolute,w=ri(a,c,u,l,b,p,x,m),S=x*m,E=i&&w>0;(!d.internals.handleBounds||E||w>=S||d.dragging)&&f.push(d)}return f},Ul=(t,e)=>{const n=new Set;return t.forEach(r=>{n.add(r.id)}),e.filter(r=>n.has(r.source)||n.has(r.target))};function Ql(t,e){const n=new Map,r=e!=null&&e.nodes?new Set(e.nodes.map(o=>o.id)):null;return t.forEach(o=>{let i;if(e!=null&&e.includeHiddenNodes){const{width:s,height:a}=Et(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 Jl({nodes:t,width:e,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(t.size===0)return!0;const a=Ql(t,s),c=Ee(a),u=Un(c,e,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(u,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),!0}function ti({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(t),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},l=s.origin??r;let f=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",mt.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(f=[[c,u],[c+h,u+g]])}else a&&Xt(s.extent)&&(f=[[s.extent[0][0]+c,s.extent[0][1]+u],[s.extent[1][0]+c,s.extent[1][1]+u]]);const d=Xt(f)?jt(e,f,s.measured):e;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",mt.error015())),{position:{x:d.x-c+(s.measured.width??0)*l[0],y:d.y-u+(s.measured.height??0)*l[1]},positionAbsolute:d}}async function tf({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(t.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),g=!h&&d.parentId&&s.find(v=>v.id===d.parentId);(h||g)&&s.push(d)}const a=new Set(e.map(d=>d.id)),c=r.filter(d=>d.deletable!==!1),l=Ul(s,c);for(const d of c)a.has(d.id)&&!l.find(g=>g.id===d.id)&&l.push(d);if(!o)return{edges:l,nodes:s};const f=await o({nodes:s,edges:l});return typeof f=="boolean"?f?{edges:l,nodes:s}:{edges:[],nodes:[]}:f}const te=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),jt=(t={x:0,y:0},e,n)=>({x:te(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:te(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function ei(t,e,n){const{width:r,height:o}=Et(n),{x:i,y:s}=n.internals.positionAbsolute;return jt(t,[[i,s],[i+r,s+o]],e)}const Ir=(t,e,n)=>t<e?te(Math.abs(t-e),1,e)/e:t>n?-te(Math.abs(t-n),1,e)/e:0,Zn=(t,e,n=15,r=40)=>{const o=Ir(t.x,r,e.width-r)*n,i=Ir(t.y,r,e.height-r)*n;return[o,i]},sn=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),Dn=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),an=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),ye=(t,e=[0,0])=>{var o,i;const{x:n,y:r}=Gn(t)?t.internals.positionAbsolute:_e(t,e);return{x:n,y:r,width:((o=t.measured)==null?void 0:o.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}},Ze=(t,e=[0,0])=>{var o,i;const{x:n,y:r}=Gn(t)?t.internals.positionAbsolute:_e(t,e);return{x:n,y:r,x2:n+(((o=t.measured)==null?void 0:o.width)??t.width??t.initialWidth??0),y2:r+(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0)}},ni=(t,e)=>an(sn(Dn(t),Dn(e))),ri=(t,e,n,r,o,i,s,a)=>{const c=Math.max(0,Math.min(t+n,o+s)-Math.max(t,o)),u=Math.max(0,Math.min(e+r,i+a)-Math.max(e,i));return Math.ceil(c*u)},Ue=(t,e)=>ri(t.x,t.y,t.width,t.height,e.x,e.y,e.width,e.height),Pr=t=>gt(t.width)&&gt(t.height)&&gt(t.x)&&gt(t.y),gt=t=>!isNaN(t)&&isFinite(t),oi=(t,e)=>(n,r)=>{},Se=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),Ne=({x:t,y:e},[n,r,o],i=!1,s=[1,1])=>{const a={x:(t-n)/o,y:(e-r)/o};return i?Se(a,s):a},ee=({x:t,y:e},[n,r,o])=>({x:t*o+n,y:e*o+r});function Wt(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function ef(t,e,n){if(typeof t=="string"||typeof t=="number"){const r=Wt(t,n),o=Wt(t,e);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof t=="object"){const r=Wt(t.top??t.y??0,n),o=Wt(t.bottom??t.y??0,n),i=Wt(t.left??t.x??0,e),s=Wt(t.right??t.x??0,e);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 nf(t,e,n,r,o,i){const{x:s,y:a}=ee(t,[e,n,r]),{x:c,y:u}=ee({x:t.x+t.width,y:t.y+t.height},[e,n,r]),l=o-c,f=i-u;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(l),bottom:Math.floor(f)}}const Un=(t,e,n,r,o,i)=>{const s=ef(i,e,n),a=(e-s.x)/t.width,c=(n-s.y)/t.height,u=Math.min(a,c),l=te(u,r,o),f=t.x+t.width/2,d=t.y+t.height/2,h=e/2-f*l,g=n/2-d*l,v=nf(t,h,g,l,e,n),x={left:Math.min(v.left-s.left,0),top:Math.min(v.top-s.top,0),right:Math.min(v.right-s.right,0),bottom:Math.min(v.bottom-s.bottom,0)};return{x:h-x.left+x.right,y:g-x.top+x.bottom,zoom:l}},xe=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Xt(t){return t!=null&&t!=="parent"}function Et(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function ii(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function si(t,e={width:0,height:0},n,r,o){const i={...t},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(e.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(e.height??0)*a[1]}return i}function Tr(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function rf(){let t,e;return{promise:new Promise((r,o)=>{t=r,e=o}),resolve:t,reject:e}}function of(t){return{...Zo,...t||{}}}function le(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=pt(t),a=Ne({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:c,y:u}=n?Se(a,e):a;return{xSnapped:c,ySnapped:u,...a}}const Qn=t=>({width:t.offsetWidth,height:t.offsetHeight}),ai=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},sf=["INPUT","SELECT","TEXTAREA"];function ci(t){var r,o;const e=((o=(r=t.composedPath)==null?void 0:r.call(t))==null?void 0:o[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:sf.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const ui=t=>"clientX"in t,pt=(t,e)=>{var i,s;const n=ui(t),r=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,o=n?t.clientY:(s=t.touches)==null?void 0:s[0].clientY;return{x:r-((e==null?void 0:e.left)??0),y:o-((e==null?void 0:e.top)??0)}},zr=(t,e,n,r,o)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:t,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Qn(s)}})};function li({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=t*.125+o*.375+s*.375+n*.125,u=e*.125+i*.375+a*.375+r*.125,l=Math.abs(c-t),f=Math.abs(u-e);return[c,u,l,f]}function Pe(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function Dr({pos:t,x1:e,y1:n,x2:r,y2:o,c:i}){switch(t){case q.Left:return[e-Pe(e-r,i),n];case q.Right:return[e+Pe(r-e,i),n];case q.Top:return[e,n-Pe(n-o,i)];case q.Bottom:return[e,n+Pe(o-n,i)]}}function fi({sourceX:t,sourceY:e,sourcePosition:n=q.Bottom,targetX:r,targetY:o,targetPosition:i=q.Top,curvature:s=.25}){const[a,c]=Dr({pos:n,x1:t,y1:e,x2:r,y2:o,c:s}),[u,l]=Dr({pos:i,x1:r,y1:o,x2:t,y2:e,c:s}),[f,d,h,g]=li({sourceX:t,sourceY:e,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:u,targetControlY:l});return[`M${t},${e} C${a},${c} ${u},${l} ${r},${o}`,f,d,h,g]}function di({sourceX:t,sourceY:e,targetX:n,targetY:r}){const o=Math.abs(n-t)/2,i=n<t?n+o:n-o,s=Math.abs(r-e)/2,a=r<e?r+s:r-s;return[i,a,o,s]}function af({sourceNode:t,targetNode:e,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(t.parentId||o&&t.selected?t.internals.z:0,e.parentId||o&&e.selected?e.internals.z:0);return s+a}function cf({sourceNode:t,targetNode:e,width:n,height:r,transform:o}){const i=sn(Ze(t),Ze(e));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 Ue(s,an(i))>0}const uf=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`xy-edge__${t}${e||""}-${n}${r||""}`,lf=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),ff=(t,e,n={})=>{var i;if(!t.source||!t.target)return(i=n.onError)==null||i.call(n,"006",mt.error006()),e;const r=n.getEdgeId||uf;let o;return Jo(t)?o={...t}:o={...t,id:r(t)},lf(o,e)?e:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,e.concat(o))};function hi({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[o,i,s,a]=di({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,o,i,s,a]}const Lr={[q.Left]:{x:-1,y:0},[q.Right]:{x:1,y:0},[q.Top]:{x:0,y:-1},[q.Bottom]:{x:0,y:1}},df=({source:t,sourcePosition:e=q.Bottom,target:n})=>e===q.Left||e===q.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},Hr=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function hf({source:t,sourcePosition:e=q.Bottom,target:n,targetPosition:r=q.Top,center:o,offset:i,stepPosition:s}){const a=Lr[e],c=Lr[r],u={x:t.x+a.x*i,y:t.y+a.y*i},l={x:n.x+c.x*i,y:n.y+c.y*i},f=df({source:u,sourcePosition:e,target:l}),d=f.x!==0?"x":"y",h=f[d];let g=[],v,x;const m={x:0,y:0},b={x:0,y:0},[,,p,w]=di({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(v=o.x??u.x+(l.x-u.x)*s,x=o.y??(u.y+l.y)/2):(v=o.x??(u.x+l.x)/2,x=o.y??u.y+(l.y-u.y)*s);const $=[{x:v,y:u.y},{x:v,y:l.y}],I=[{x:u.x,y:x},{x:l.x,y:x}];a[d]===h?g=d==="x"?$:I:g=d==="x"?I:$}else{const $=[{x:u.x,y:l.y}],I=[{x:l.x,y:u.y}];if(d==="x"?g=a.x===h?I:$:g=a.y===h?$:I,e===r){const y=Math.abs(t[d]-n[d]);if(y<=i){const N=Math.min(i-1,i-y);a[d]===h?m[d]=(u[d]>t[d]?-1:1)*N:b[d]=(l[d]>n[d]?-1:1)*N}}if(e!==r){const y=d==="x"?"y":"x",N=a[d]===c[y],_=u[y]>l[y],C=u[y]<l[y];(a[d]===1&&(!N&&_||N&&C)||a[d]!==1&&(!N&&C||N&&_))&&(g=d==="x"?$:I)}const F={x:u.x+m.x,y:u.y+m.y},z={x:l.x+b.x,y:l.y+b.y},B=Math.max(Math.abs(F.x-g[0].x),Math.abs(z.x-g[0].x)),D=Math.max(Math.abs(F.y-g[0].y),Math.abs(z.y-g[0].y));B>=D?(v=(F.x+z.x)/2,x=g[0].y):(v=g[0].x,x=(F.y+z.y)/2)}const S={x:u.x+m.x,y:u.y+m.y},E={x:l.x+b.x,y:l.y+b.y};return[[t,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,...E.x!==g[g.length-1].x||E.y!==g[g.length-1].y?[E]:[],n],v,x,p,w]}function gf(t,e,n,r){const o=Math.min(Hr(t,e)/2,Hr(e,n)/2,r),{x:i,y:s}=e;if(t.x===i&&i===n.x||t.y===s&&s===n.y)return`L${i} ${s}`;if(t.y===s){const u=t.x<n.x?-1:1,l=t.y<n.y?1:-1;return`L ${i+o*u},${s}Q ${i},${s} ${i},${s+o*l}`}const a=t.x<n.x?1:-1,c=t.y<n.y?-1:1;return`L ${i},${s+o*c}Q ${i},${s} ${i+o*a},${s}`}function Ln({sourceX:t,sourceY:e,sourcePosition:n=q.Bottom,targetX:r,targetY:o,targetPosition:i=q.Top,borderRadius:s=5,centerX:a,centerY:c,offset:u=20,stepPosition:l=.5}){const[f,d,h,g,v]=hf({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:c},offset:u,stepPosition:l});let x=`M${f[0].x} ${f[0].y}`;for(let m=1;m<f.length-1;m++)x+=gf(f[m-1],f[m],f[m+1],s);return x+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[x,d,h,g,v]}function Rr(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function pf(t){var f;const{sourceNode:e,targetNode:n}=t;if(!Rr(e)||!Rr(n))return null;const r=e.internals.handleBounds||Vr(e.handles),o=n.internals.handleBounds||Vr(n.handles),i=Br((r==null?void 0:r.source)??[],t.sourceHandle),s=Br(t.connectionMode===Jt.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),t.targetHandle);if(!i||!s)return(f=t.onError)==null||f.call(t,"008",mt.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=(i==null?void 0:i.position)||q.Bottom,c=(s==null?void 0:s.position)||q.Top,u=Yt(e,i,a),l=Yt(n,s,c);return{sourceX:u.x,sourceY:u.y,targetX:l.x,targetY:l.y,sourcePosition:a,targetPosition:c}}function Vr(t){if(!t)return null;const e=[],n=[];for(const r of t)r.width=r.width??1,r.height=r.height??1,r.type==="source"?e.push(r):r.type==="target"&&n.push(r);return{source:e,target:n}}function Yt(t,e,n=q.Left,r=!1){const o=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,i=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:s,height:a}=e??Et(t);if(r)return{x:o+s/2,y:i+a/2};switch((e==null?void 0:e.position)??n){case q.Top:return{x:o+s/2,y:i};case q.Right:return{x:o+s,y:i+a/2};case q.Bottom:return{x:o+s/2,y:i+a};case q.Left:return{x:o,y:i+a/2}}}function Br(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function Hn(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`:""}function mf(t,{id:e,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return t.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const u=Hn(c,e);i.has(u)||(s.push({id:u,color:c.color||n,...c}),i.add(u))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const gi=1e3,yf=10,Jn={nodeOrigin:[0,0],nodeExtent:pe,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},xf={...Jn,checkEquality:!0};function tr(t,e){const n={...t};for(const r in e)e[r]!==void 0&&(n[r]=e[r]);return n}function wf(t,e,n){const r=tr(Jn,n);for(const o of t.values())if(o.parentId)nr(o,t,e,r);else{const i=_e(o,r.nodeOrigin),s=Xt(o.extent)?o.extent:r.nodeExtent,a=jt(i,s,Et(o));o.internals.positionAbsolute=a}}function vf(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],r=[];for(const o of t.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:t.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 er(t){return t==="manual"}function Rn(t,e,n,r={}){var l,f;const o=tr(xf,r),i={i:0},s=new Map(e),a=o!=null&&o.elevateNodesOnSelect&&!er(o.zIndexMode)?gi:0;let c=t.length>0,u=!1;e.clear(),n.clear();for(const d of t){let h=s.get(d.id);if(o.checkEquality&&d===(h==null?void 0:h.internals.userNode))e.set(d.id,h);else{const g=_e(d,o.nodeOrigin),v=Xt(d.extent)?d.extent:o.nodeExtent,x=jt(g,v,Et(d));h={...o.defaults,...d,measured:{width:(l=d.measured)==null?void 0:l.width,height:(f=d.measured)==null?void 0:f.height},internals:{positionAbsolute:x,handleBounds:vf(d,h),z:pi(d,a,o.zIndexMode),userNode:d}},e.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),d.parentId&&nr(h,e,n,r,i),u||(u=d.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function bf(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function nr(t,e,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=tr(Jn,r),u=t.parentId,l=e.get(u);if(!l){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bf(t,n),o&&!l.parentId&&l.internals.rootParentIndex===void 0&&c==="auto"&&(l.internals.rootParentIndex=++o.i,l.internals.z=l.internals.z+o.i*yf),o&&l.internals.rootParentIndex!==void 0&&(o.i=l.internals.rootParentIndex);const f=i&&!er(c)?gi:0,{x:d,y:h,z:g}=_f(t,l,s,a,f,c),{positionAbsolute:v}=t.internals,x=d!==v.x||h!==v.y;(x||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:x?{x:d,y:h}:v,z:g}})}function pi(t,e,n){const r=gt(t.zIndex)?t.zIndex:0;return er(n)?r:r+(t.selected?e:0)}function _f(t,e,n,r,o,i){const{x:s,y:a}=e.internals.positionAbsolute,c=Et(t),u=_e(t,n),l=Xt(t.extent)?jt(u,t.extent,c):u;let f=jt({x:s+l.x,y:a+l.y},r,c);t.extent==="parent"&&(f=ei(f,c,e));const d=pi(t,o,i),h=e.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function rr(t,e,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of t){const c=e.get(a.parentId);if(!c)continue;const u=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??ye(c),l=ni(u,a.rect);i.set(a.parentId,{expandedRect:l,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},u)=>{var p;const l=c.internals.positionAbsolute,f=Et(c),d=c.origin??r,h=a.x<l.x?Math.round(Math.abs(l.x-a.x)):0,g=a.y<l.y?Math.round(Math.abs(l.y-a.y)):0,v=Math.max(f.width,Math.round(a.width)),x=Math.max(f.height,Math.round(a.height)),m=(v-f.width)*d[0],b=(x-f.height)*d[1];(h>0||g>0||m||b)&&(o.push({id:u,type:"position",position:{x:c.position.x-h+m,y:c.position.y-g+b}}),(p=n.get(u))==null||p.forEach(w=>{t.some(S=>S.id===w.id)||o.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+g}})})),(f.width<a.width||f.height<a.height||h||g)&&o.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:v+(h?d[0]*h-m:0),height:x+(g?d[1]*g-b:0)}})}),o}function Ef(t,e,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 u=[],l=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(l.transform),d=[];for(const h of t.values()){const g=e.get(h.id);if(!g)continue;if(g.hidden){e.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const v=Qn(h.nodeElement),x=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(x||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Xt(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;if(g.parentId&&g.extent==="parent"){const E=e.get(g.parentId);E&&(w=ei(w,v,E))}else p&&(w=jt(w,p,v));const S={...g,measured:v,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:zr("source",h.nodeElement,b,f,g.id),target:zr("target",h.nodeElement,b,f,g.id)}}};e.set(g.id,S),g.parentId&&nr(S,e,n,{nodeOrigin:o,zIndexMode:s}),c=!0,x&&(u.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:ye(S,o)}))}}if(d.length>0){const h=rr(d,e,n,o);u.push(...h)}return{changes:u,updatedInternals:c}}async function Sf({delta:t,panZoom:e,transform:n,translateExtent:r,width:o,height:i}){if(!e||!t.x&&!t.y)return!1;const s=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[o,i]],r);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Fr(t,e,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,e)),s=`${o}-${t}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,e)),i){s=`${o}-${t}-${i}`;const u=r.get(s)||new Map;r.set(s,u.set(n,e))}}function mi(t,e,n){t.clear(),e.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},u=`${o}-${s}--${i}-${a}`,l=`${i}-${a}--${o}-${s}`;Fr("source",c,l,t,o,s),Fr("target",c,u,t,i,a),e.set(r.id,r)}}function yi(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:yi(n,e):!1}function Or(t,e,n){var o;let r=t;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,e))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Nf(t,e,n,r){const o=new Map;for(const[i,s]of t)if((s.selected||s.id===r)&&(!s.parentId||!yi(s,t))&&(s.draggable||e&&typeof s.draggable>"u")){const a=t.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 bn({nodeId:t,dragItems:e,nodeLookup:n,dragging:r=!0}){var s,a,c;const o=[];for(const[u,l]of e){const f=(s=n.get(u))==null?void 0:s.internals.userNode;f&&o.push({...f,position:l.position,dragging:r})}if(!t)return[o[0],o];const i=(a=n.get(t))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=e.get(t))==null?void 0:c.position)||i.position,dragging:r}:o[0],o]}function Mf({dragItems:t,snapGrid:e,x:n,y:r}){const o=t.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=Se(i,e);return{x:s.x-i.x,y:s.y-i.y}}function Cf({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,c=!1,u={x:0,y:0},l=null,f=!1,d=null,h=!1,g=!1,v=null;function x({noDragClassName:b,handleSelector:p,domNode:w,isSelectable:S,nodeId:E,nodeClickDistance:k=0}){d=ct(w);function $({x:B,y:D}){const{nodeLookup:y,nodeExtent:N,snapGrid:_,snapToGrid:C,nodeOrigin:P,onNodeDrag:M,onSelectionDrag:R,onError:V,updateNodePositions:H}=e();i={x:B,y:D};let j=!1;const X=a.size>1,G=X&&N?Dn(Ee(a)):null,Q=X&&C?Mf({dragItems:a,snapGrid:_,x:B,y:D}):null;for(const[K,L]of a){if(!y.has(K))continue;let O={x:B-L.distance.x,y:D-L.distance.y};C&&(O=Q?{x:Math.round(O.x+Q.x),y:Math.round(O.y+Q.y)}:Se(O,_));let U=null;if(X&&N&&!L.extent&&G){const{positionAbsolute:Y}=L.internals,J=Y.x-G.x+N[0][0],et=Y.x+L.measured.width-G.x2+N[1][0],nt=Y.y-G.y+N[0][1],it=Y.y+L.measured.height-G.y2+N[1][1];U=[[J,nt],[et,it]]}const{position:Z,positionAbsolute:W}=ti({nodeId:K,nextPosition:O,nodeLookup:y,nodeExtent:U||N,nodeOrigin:P,onError:V});j=j||L.position.x!==Z.x||L.position.y!==Z.y,L.position=Z,L.internals.positionAbsolute=W}if(g=g||j,!!j&&(H(a,!0),v&&(r||M||!E&&R))){const[K,L]=bn({nodeId:E,dragItems:a,nodeLookup:y});r==null||r(v,a,K,L),M==null||M(v,K,L),E||R==null||R(v,L)}}async function I(){if(!l)return;const{transform:B,panBy:D,autoPanSpeed:y,autoPanOnNodeDrag:N}=e();if(!N){c=!1,cancelAnimationFrame(s);return}const[_,C]=Zn(u,l,y);(_!==0||C!==0)&&(i.x=(i.x??0)-_/B[2],i.y=(i.y??0)-C/B[2],await D({x:_,y:C})&&$(i)),s=requestAnimationFrame(I)}function F(B){var X;const{nodeLookup:D,multiSelectionActive:y,nodesDraggable:N,transform:_,snapGrid:C,snapToGrid:P,selectNodesOnDrag:M,onNodeDragStart:R,onSelectionDragStart:V,unselectNodesAndEdges:H}=e();f=!0,(!M||!S)&&!y&&E&&((X=D.get(E))!=null&&X.selected||H()),S&&M&&E&&(t==null||t(E));const j=le(B.sourceEvent,{transform:_,snapGrid:C,snapToGrid:P,containerBounds:l});if(i=j,a=Nf(D,N,j,E),a.size>0&&(n||R||!E&&V)){const[G,Q]=bn({nodeId:E,dragItems:a,nodeLookup:D});n==null||n(B.sourceEvent,a,G,Q),R==null||R(B.sourceEvent,G,Q),E||V==null||V(B.sourceEvent,Q)}}const z=To().clickDistance(k).on("start",B=>{const{domNode:D,nodeDragThreshold:y,transform:N,snapGrid:_,snapToGrid:C}=e();l=(D==null?void 0:D.getBoundingClientRect())||null,h=!1,g=!1,v=B.sourceEvent,y===0&&F(B),i=le(B.sourceEvent,{transform:N,snapGrid:_,snapToGrid:C,containerBounds:l}),u=pt(B.sourceEvent,l)}).on("drag",B=>{const{autoPanOnNodeDrag:D,transform:y,snapGrid:N,snapToGrid:_,nodeDragThreshold:C,nodeLookup:P}=e(),M=le(B.sourceEvent,{transform:y,snapGrid:N,snapToGrid:_,containerBounds:l});if(v=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||E&&!P.has(E))&&(h=!0),!h){if(!c&&D&&f&&(c=!0,I()),!f){const R=pt(B.sourceEvent,l),V=R.x-u.x,H=R.y-u.y;Math.sqrt(V*V+H*H)>C&&F(B)}(i.x!==M.xSnapped||i.y!==M.ySnapped)&&a&&f&&(u=pt(B.sourceEvent,l),$(M))}}).on("end",B=>{if(!f||h){h&&a.size>0&&e().updateNodePositions(a,!1);return}if(c=!1,f=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:D,updateNodePositions:y,onNodeDragStop:N,onSelectionDragStop:_}=e();if(g&&(y(a,!1),g=!1),o||N||!E&&_){const[C,P]=bn({nodeId:E,dragItems:a,nodeLookup:D,dragging:!1});o==null||o(B.sourceEvent,a,C,P),N==null||N(B.sourceEvent,C,P),E||_==null||_(B.sourceEvent,P)}}}).filter(B=>{const D=B.target;return!B.button&&(!b||!Or(D,`.${b}`,w))&&(!p||Or(D,p,w))});d.call(z)}function m(){d==null||d.on(".drag",null)}return{update:x,destroy:m}}function kf(t,e,n){const r=[],o={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())Ue(o,ye(i))>0&&r.push(i);return r}const Af=250;function $f(t,e,n,r){var a,c;let o=[],i=1/0;const s=kf(t,n,e+Af);for(const u of s){const l=[...((a=u.internals.handleBounds)==null?void 0:a.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of l){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:d,y:h}=Yt(u,f,f.position,!0),g=Math.sqrt(Math.pow(d-t.x,2)+Math.pow(h-t.y,2));g>e||(g<i?(o=[{...f,x:d,y:h}],i=g):g===i&&o.push({...f,x:d,y:h}))}}if(!o.length)return null;if(o.length>1){const u=r.type==="source"?"target":"source";return o.find(l=>l.type===u)??o[0]}return o[0]}function xi(t,e,n,r,o,i=!1){var u,l,f;const s=r.get(t);if(!s)return null;const a=o==="strict"?(u=s.internals.handleBounds)==null?void 0:u[e]:[...((l=s.internals.handleBounds)==null?void 0:l.source)??[],...((f=s.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?a==null?void 0:a.find(d=>d.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Yt(s,c,c.position,!0)}:c}function wi(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function If(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const vi=()=>!0;function Pf(t,{connectionMode:e,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:u,autoPanOnConnect:l,flowId:f,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:x,isValidConnection:m=vi,onReconnectEnd:b,updateConnection:p,getTransform:w,getFromHandle:S,autoPanSpeed:E,dragThreshold:k=1,handleDomNode:$}){const I=ai(t.target);let F=0,z;const{x:B,y:D}=pt(t),y=wi(i,$),N=a==null?void 0:a.getBoundingClientRect();let _=!1;if(!N||!y)return;const C=xi(o,y,r,c,e);if(!C)return;let P=pt(t,N),M=!1,R=null,V=!1,H=null;function j(){if(!l||!N)return;const[Z,W]=Zn(P,N,E);d({x:Z,y:W}),F=requestAnimationFrame(j)}const X={...C,nodeId:o,type:y,position:C.position},G=c.get(o);let K={inProgress:!0,isValid:null,from:Yt(G,X,q.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:G,to:P,toHandle:null,toPosition:$r[X.position],toNode:null,pointer:P};function L(){_=!0,p(K),g==null||g(t,{nodeId:o,handleId:r,handleType:y})}k===0&&L();function O(Z){if(!_){const{x:it,y:lt}=pt(Z),xt=it-B,wt=lt-D;if(!(xt*xt+wt*wt>k*k))return;L()}if(!S()||!X){U(Z);return}const W=w();P=pt(Z,N),z=$f(Ne(P,W,!1,[1,1]),n,c,X),M||(j(),M=!0);const Y=bi(Z,{handle:z,connectionMode:e,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:m,doc:I,lib:u,flowId:f,nodeLookup:c});H=Y.handleDomNode,R=Y.connection,V=If(!!z,Y.isValid);const J=c.get(o),et=J?Yt(J,X,q.Left,!0):K.from,nt={...K,from:et,isValid:V,to:Y.toHandle&&V?ee({x:Y.toHandle.x,y:Y.toHandle.y},W):P,toHandle:Y.toHandle,toPosition:V&&Y.toHandle?Y.toHandle.position:$r[X.position],toNode:Y.toHandle?c.get(Y.toHandle.nodeId):null,pointer:P};p(nt),K=nt}function U(Z){if(!("touches"in Z&&Z.touches.length>0)){if(_){(z||H)&&R&&V&&(v==null||v(R));const{inProgress:W,...Y}=K,J={...Y,toPosition:K.toHandle?K.toPosition:null};x==null||x(Z,J),i&&(b==null||b(Z,J))}h(),cancelAnimationFrame(F),M=!1,V=!1,R=null,H=null,I.removeEventListener("mousemove",O),I.removeEventListener("mouseup",U),I.removeEventListener("touchmove",O),I.removeEventListener("touchend",U)}}I.addEventListener("mousemove",O),I.addEventListener("mouseup",U),I.addEventListener("touchmove",O),I.addEventListener("touchend",U)}function bi(t,{handle:e,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:u=vi,nodeLookup:l}){const f=i==="target",d=e?s.querySelector(`.${a}-flow__handle[data-id="${c}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:h,y:g}=pt(t),v=s.elementFromPoint(h,g),x=v!=null&&v.classList.contains(`${a}-flow__handle`)?v:d,m={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const b=wi(void 0,x),p=x.getAttribute("data-nodeid"),w=x.getAttribute("data-handleid"),S=x.classList.contains("connectable"),E=x.classList.contains("connectableend");if(!p||!b)return m;const k={source:f?p:r,sourceHandle:f?w:o,target:f?r:p,targetHandle:f?o:w};m.connection=k;const I=S&&E&&(n===Jt.Strict?f&&b==="source"||!f&&b==="target":p!==r||w!==o);m.isValid=I&&u(k),m.toHandle=xi(p,b,w,l,n,!0)}return m}const Vn={onPointerDown:Pf,isValid:bi};function Tf({domNode:t,panZoom:e,getTransform:n,getViewScale:r}){const o=ct(t);function i({translateExtent:a,width:c,height:u,zoomStep:l=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!e)return;const w=n(),S=p.sourceEvent.ctrlKey&&xe()?10:1,E=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*l,k=w[2]*Math.pow(2,E*S);e.scaleTo(k)};let v=[0,0];const x=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(v=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!e)return;const S=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],E=[S[0]-v[0],S[1]-v[1]];v=S;const k=r()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),$={x:w[0]-E[0]*k,y:w[1]-E[1]*k},I=[[0,0],[c,u]];e.setViewportConstrained({x:$.x,y:$.y,zoom:w[2]},I,a)},b=Go().on("start",x).on("zoom",f?m:null).on("zoom.wheel",d?g:null);o.call(b,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:dt}}const cn=t=>({x:t.x,y:t.y,zoom:t.k}),_n=({x:t,y:e,zoom:n})=>on.translate(t,e).scale(n),qt=(t,e)=>t.target.closest(`.${e}`),_i=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),zf=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,En=(t,e=0,n=zf,r=()=>{})=>{const o=typeof e=="number"&&e>0;return o||r(),o?t.transition().duration(e).ease(n).on("end",r):t},Ei=t=>{const e=t.ctrlKey&&xe()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function Df({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:u}){return l=>{if(qt(l,e))return l.ctrlKey&&l.preventDefault(),!1;l.preventDefault(),l.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(l.ctrlKey&&s){const x=dt(l),m=Ei(l),b=f*Math.pow(2,m);r.scaleTo(n,b,x,l);return}const d=l.deltaMode===1?20:1;let h=o===Bt.Vertical?0:l.deltaX*d,g=o===Bt.Horizontal?0:l.deltaY*d;!xe()&&l.shiftKey&&o!==Bt.Vertical&&(h=l.deltaY*d,g=0),r.translateBy(n,-(h/f)*i,-(g/f)*i,{internal:!0});const v=cn(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?c==null||c(l,v):(t.isPanScrolling=!0,a==null||a(l,v)),t.panScrollTimeout=setTimeout(()=>{u==null||u(l,v),t.isPanScrolling=!1},150)}}function Lf({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!e&&i&&!r.ctrlKey,a=qt(r,t);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function Hf({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=cn(r.transform);t.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),n&&(n==null||n(r.sourceEvent,o))}}function Rf({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;t.usedRightMouseButton=!!(n&&_i(e,t.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,cn(i.transform)))}}function Vf({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(t.isZoomingOrPanning=!1,i&&_i(e,t.mouseButton??0)&&!t.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),t.usedRightMouseButton=!1,r(!1),o)){const c=cn(s.transform);t.prevViewport=c,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,c)},n?150:0)}}}function Bf({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:u,connectionInProgress:l}){return f=>{var x;const d=t||e,h=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(qt(f,`${u}-flow__node`)||qt(f,`${u}-flow__edge`)))return!0;if(!r&&!d&&!o&&!i&&!n||s||l&&!g||qt(f,a)&&g||qt(f,c)&&(!g||o&&g&&!t)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&((x=f.touches)==null?void 0:x.length)>1)return f.preventDefault(),!1;if(!d&&!o&&!h&&g||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const v=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&v}}function Ff({domNode:t,minZoom:e,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},l=t.getBoundingClientRect();let f=[[0,0],[l.width,l.height]];const d=typeof ResizeObserver<"u"?new ResizeObserver(D=>{const y=D[0];y&&(f=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null;d==null||d.observe(t);const h=Go().extent(()=>f).scaleExtent([e,n]).translateExtent(r),g=ct(t).call(h);w({x:o.x,y:o.y,zoom:te(o.zoom,e,n)},[[0,0],[l.width,l.height]],r);const v=g.on("wheel.zoom"),x=g.on("dblclick.zoom");h.wheelDelta(Ei);async function m(D,y){return g?new Promise(N=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?ue:He).transform(En(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>N(!0)),D)}):!1}function b({noWheelClassName:D,noPanClassName:y,onPaneContextMenu:N,userSelectionActive:_,panOnScroll:C,panOnDrag:P,panOnScrollMode:M,panOnScrollSpeed:R,preventScrolling:V,zoomOnPinch:H,zoomOnScroll:j,zoomOnDoubleClick:X,zoomActivationKeyPressed:G,lib:Q,onTransformChange:K,connectionInProgress:L,paneClickDistance:O,selectionOnDrag:U}){_&&!u.isZoomingOrPanning&&p();const Z=C&&!G&&!_;h.clickDistance(U?1/0:!gt(O)||O<0?0:O);const W=Z?Df({zoomPanValues:u,noWheelClassName:D,d3Selection:g,d3Zoom:h,panOnScrollMode:M,panOnScrollSpeed:R,zoomOnPinch:H,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Lf({noWheelClassName:D,preventScrolling:V,d3ZoomHandler:v});g.on("wheel.zoom",W,{passive:!1});const Y=Hf({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:s});h.on("start",Y);const J=Rf({zoomPanValues:u,panOnDrag:P,onPaneContextMenu:!!N,onPanZoom:i,onTransformChange:K});h.on("zoom",J);const et=Vf({zoomPanValues:u,panOnDrag:P,panOnScroll:C,onPaneContextMenu:N,onPanZoomEnd:a,onDraggingChange:c});h.on("end",et);const nt=Bf({zoomActivationKeyPressed:G,panOnDrag:P,zoomOnScroll:j,panOnScroll:C,zoomOnDoubleClick:X,zoomOnPinch:H,userSelectionActive:_,noPanClassName:y,noWheelClassName:D,lib:Q,connectionInProgress:L});h.filter(nt),X?g.on("dblclick.zoom",x):g.on("dblclick.zoom",null)}function p(){h.on("zoom",null)}async function w(D,y,N){const _=_n(D),C=h==null?void 0:h.constrain()(_,y,N);return C&&await m(C),C}async function S(D,y){const N=_n(D);return await m(N,y),N}function E(D){if(g){const y=_n(D),N=g.property("__zoom");(N.k!==D.zoom||N.x!==D.x||N.y!==D.y)&&(h==null||h.transform(g,y,null,{sync:!0}))}}function k(){const D=g?qo(g.node()):{x:0,y:0,k:1};return{x:D.x,y:D.y,zoom:D.k}}async function $(D,y){return g?new Promise(N=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?ue:He).scaleTo(En(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>N(!0)),D)}):!1}async function I(D,y){return g?new Promise(N=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?ue:He).scaleBy(En(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>N(!0)),D)}):!1}function F(D){h==null||h.scaleExtent(D)}function z(D){h==null||h.translateExtent(D)}function B(D){const y=!gt(D)||D<0?0:D;h==null||h.clickDistance(y)}return{update:b,destroy:p,setViewport:S,setViewportConstrained:w,getViewport:k,scaleTo:$,scaleBy:I,setScaleExtent:F,setTranslateExtent:z,syncViewport:E,setClickDistance:B}}var ne;(function(t){t.Line="line",t.Handle="handle"})(ne||(ne={}));function Of({width:t,prevWidth:e,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=t-e,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 jr(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),r=t.includes("left"),o=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:r,affectsY:o}}function $t(t,e){return Math.max(0,e-t)}function It(t,e){return Math.max(0,t-e)}function Te(t,e,n){return Math.max(0,e-t,t-n)}function Xr(t,e){return t?!e:e}function jf(t,e,n,r,o,i,s,a){let{affectsX:c,affectsY:u}=e;const{isHorizontal:l,isVertical:f}=e,d=l&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:x,minHeight:m,maxHeight:b}=r,{x:p,y:w,width:S,height:E,aspectRatio:k}=t;let $=Math.floor(l?h-t.pointerX:0),I=Math.floor(f?g-t.pointerY:0);const F=S+(c?-$:$),z=E+(u?-I:I),B=-i[0]*S,D=-i[1]*E;let y=Te(F,v,x),N=Te(z,m,b);if(s){let P=0,M=0;c&&$<0?P=$t(p+$+B,s[0][0]):!c&&$>0&&(P=It(p+F+B,s[1][0])),u&&I<0?M=$t(w+I+D,s[0][1]):!u&&I>0&&(M=It(w+z+D,s[1][1])),y=Math.max(y,P),N=Math.max(N,M)}if(a){let P=0,M=0;c&&$>0?P=It(p+$,a[0][0]):!c&&$<0&&(P=$t(p+F,a[1][0])),u&&I>0?M=It(w+I,a[0][1]):!u&&I<0&&(M=$t(w+z,a[1][1])),y=Math.max(y,P),N=Math.max(N,M)}if(o){if(l){const P=Te(F/k,m,b)*k;if(y=Math.max(y,P),s){let M=0;!c&&!u||c&&!u&&d?M=It(w+D+F/k,s[1][1])*k:M=$t(w+D+(c?$:-$)/k,s[0][1])*k,y=Math.max(y,M)}if(a){let M=0;!c&&!u||c&&!u&&d?M=$t(w+F/k,a[1][1])*k:M=It(w+(c?$:-$)/k,a[0][1])*k,y=Math.max(y,M)}}if(f){const P=Te(z*k,v,x)/k;if(N=Math.max(N,P),s){let M=0;!c&&!u||u&&!c&&d?M=It(p+z*k+B,s[1][0])/k:M=$t(p+(u?I:-I)*k+B,s[0][0])/k,N=Math.max(N,M)}if(a){let M=0;!c&&!u||u&&!c&&d?M=$t(p+z*k,a[1][0])/k:M=It(p+(u?I:-I)*k,a[0][0])/k,N=Math.max(N,M)}}}I=I+(I<0?N:-N),$=$+($<0?y:-y),o&&(d?F>z*k?I=(Xr(c,u)?-$:$)/k:$=(Xr(c,u)?-I:I)*k:l?(I=$/k,u=c):($=I*k,c=u));const _=c?p+$:p,C=u?w+I:w;return{width:S+(c?-$:$),height:E+(u?-I:I),x:i[0]*$*(c?-1:1)+_,y:i[1]*I*(u?-1:1)+C}}const Si={width:0,height:0,x:0,y:0},Xf={...Si,pointerX:0,pointerY:0,aspectRatio:1};function Yf(t,e,n){const r=e.position.x+t.position.x,o=e.position.y+t.position.y,i=t.measured.width??0,s=t.measured.height??0,a=n[0]*i,c=n[1]*s;return[[r-a,o-c],[r+i-a,o+s-c]]}function Wf({domNode:t,nodeId:e,getStoreItems:n,onChange:r,onEnd:o}){const i=ct(t);let s={controlDirection:jr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:u,boundaries:l,keepAspectRatio:f,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:x}){let m={...Si},b={...Xf};s={boundaries:l,resizeDirection:d,keepAspectRatio:f,controlDirection:jr(u)};let p,w=null,S=[],E,k,$,I=!1;const F=To().on("start",z=>{const{nodeLookup:B,transform:D,snapGrid:y,snapToGrid:N,nodeOrigin:_,paneDomNode:C}=n();if(p=B.get(e),!p)return;w=(C==null?void 0:C.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:M}=le(z.sourceEvent,{transform:D,snapGrid:y,snapToGrid:N,containerBounds:w});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...m,pointerX:P,pointerY:M,aspectRatio:m.width/m.height},E=void 0,k=Xt(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(E=B.get(p.parentId)),E&&p.extent==="parent"&&(k=[[0,0],[E.measured.width,E.measured.height]]),S=[],$=void 0;for(const[R,V]of B)if(V.parentId===e&&(S.push({id:R,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const H=Yf(V,p,V.origin??_);$?$=[[Math.min(H[0][0],$[0][0]),Math.min(H[0][1],$[0][1])],[Math.max(H[1][0],$[1][0]),Math.max(H[1][1],$[1][1])]]:$=H}h==null||h(z,{...m})}).on("drag",z=>{const{transform:B,snapGrid:D,snapToGrid:y,nodeOrigin:N}=n(),_=le(z.sourceEvent,{transform:B,snapGrid:D,snapToGrid:y,containerBounds:w}),C=[];if(!p)return;const{x:P,y:M,width:R,height:V}=m,H={},j=p.origin??N,{width:X,height:G,x:Q,y:K}=jf(b,s.controlDirection,_,s.boundaries,s.keepAspectRatio,j,k,$),L=X!==R,O=G!==V,U=Q!==P&&L,Z=K!==M&&O;if(!U&&!Z&&!L&&!O)return;if((U||Z||j[0]===1||j[1]===1)&&(H.x=U?Q:m.x,H.y=Z?K:m.y,m.x=H.x,m.y=H.y,S.length>0)){const et=Q-P,nt=K-M;for(const it of S)it.position={x:it.position.x-et+j[0]*(X-R),y:it.position.y-nt+j[1]*(G-V)},C.push(it)}if((L||O)&&(H.width=L&&(!s.resizeDirection||s.resizeDirection==="horizontal")?X:m.width,H.height=O&&(!s.resizeDirection||s.resizeDirection==="vertical")?G:m.height,m.width=H.width,m.height=H.height),E&&p.expandParent){const et=j[0]*(H.width??0);H.x&&H.x<et&&(m.x=et,b.x=b.x-(H.x-et));const nt=j[1]*(H.height??0);H.y&&H.y<nt&&(m.y=nt,b.y=b.y-(H.y-nt))}const W=Of({width:m.width,prevWidth:R,height:m.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),Y={...m,direction:W};(x==null?void 0:x(z,Y))!==!1&&(I=!0,g==null||g(z,Y),r(H,C))}).on("end",z=>{I&&(v==null||v(z,{...m}),o==null||o({...m}),I=!1)});i.call(F)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var Ni={exports:{}},Mi={},Ci={exports:{}},ki={};/**
1
+ import{r as T,g as ga,R as pa,j as A}from"./index-Cpy8aKZb.js";function st(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n<t.length;n++)(r=st(t[n]))!==""&&(e+=(e&&" ")+r);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var ma={value:()=>{}};function tn(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Le(n)}function Le(t){this._=t}function ya(t,e){return t.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&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Le.prototype=tn.prototype={constructor:Le,on:function(t,e){var n=this._,r=ya(t+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(t=r[i]).type)&&(o=xa(n[o],t.name)))return o;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(o=(t=r[i]).type)n[o]=hr(n[o],t.name,e);else if(e==null)for(o in n)n[o]=hr(n[o],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Le(t)},call:function(t,e){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(t))throw new Error("unknown type: "+t);for(i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],o=0,i=r.length;o<i;++o)r[o].value.apply(e,n)}};function xa(t,e){for(var n=0,r=t.length,o;n<r;++n)if((o=t[n]).name===e)return o.value}function hr(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=ma,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Cn="http://www.w3.org/1999/xhtml";const gr={svg:"http://www.w3.org/2000/svg",xhtml:Cn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function en(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),gr.hasOwnProperty(e)?{space:gr[e],local:t}:t}function wa(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Cn&&e.documentElement.namespaceURI===Cn?e.createElement(t):e.createElementNS(n,t)}}function va(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function wo(t){var e=en(t);return(e.local?va:wa)(e)}function ba(){}function Fn(t){return t==null?ba:function(){return this.querySelector(t)}}function _a(t){typeof t!="function"&&(t=Fn(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=new Array(s),c,u,l=0;l<s;++l)(c=i[l])&&(u=t.call(c,c.__data__,l,i))&&("__data__"in c&&(u.__data__=c.__data__),a[l]=u);return new ut(r,this._parents)}function Ea(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Sa(){return[]}function vo(t){return t==null?Sa:function(){return this.querySelectorAll(t)}}function Na(t){return function(){return Ea(t.apply(this,arguments))}}function Ma(t){typeof t=="function"?t=Na(t):t=vo(t);for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var s=e[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&(r.push(t.call(c,c.__data__,u,s)),o.push(c));return new ut(r,o)}function bo(t){return function(){return this.matches(t)}}function _o(t){return function(e){return e.matches(t)}}var Ca=Array.prototype.find;function ka(t){return function(){return Ca.call(this.children,t)}}function Aa(){return this.firstElementChild}function $a(t){return this.select(t==null?Aa:ka(typeof t=="function"?t:_o(t)))}var Ia=Array.prototype.filter;function Pa(){return Array.from(this.children)}function Ta(t){return function(){return Ia.call(this.children,t)}}function za(t){return this.selectAll(t==null?Pa:Ta(typeof t=="function"?t:_o(t)))}function Da(t){typeof t!="function"&&(t=bo(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&t.call(c,c.__data__,u,i)&&a.push(c);return new ut(r,this._parents)}function Eo(t){return new Array(t.length)}function La(){return new ut(this._enter||this._groups.map(Eo),this._parents)}function Oe(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Oe.prototype={constructor:Oe,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Ha(t){return function(){return t}}function Ra(t,e,n,r,o,i){for(var s=0,a,c=e.length,u=i.length;s<u;++s)(a=e[s])?(a.__data__=i[s],r[s]=a):n[s]=new Oe(t,i[s]);for(;s<c;++s)(a=e[s])&&(o[s]=a)}function Va(t,e,n,r,o,i,s){var a,c,u=new Map,l=e.length,f=i.length,d=new Array(l),h;for(a=0;a<l;++a)(c=e[a])&&(d[a]=h=s.call(c,c.__data__,a,e)+"",u.has(h)?o[a]=c:u.set(h,c));for(a=0;a<f;++a)h=s.call(t,i[a],a,i)+"",(c=u.get(h))?(r[a]=c,c.__data__=i[a],u.delete(h)):n[a]=new Oe(t,i[a]);for(a=0;a<l;++a)(c=e[a])&&u.get(d[a])===c&&(o[a]=c)}function Ba(t){return t.__data__}function Fa(t,e){if(!arguments.length)return Array.from(this,Ba);var n=e?Va:Ra,r=this._parents,o=this._groups;typeof t!="function"&&(t=Ha(t));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),u=0;u<i;++u){var l=r[u],f=o[u],d=f.length,h=Oa(t.call(l,l&&l.__data__,u,r)),g=h.length,v=a[u]=new Array(g),x=s[u]=new Array(g),m=c[u]=new Array(d);n(l,f,v,x,m,h,e);for(var b=0,p=0,w,S;b<g;++b)if(w=v[b]){for(b>=p&&(p=b+1);!(S=x[p])&&++p<g;);w._next=S||null}}return s=new ut(s,r),s._enter=a,s._exit=c,s}function Oa(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function ja(){return new ut(this._exit||this._groups.map(Eo),this._parents)}function Xa(t,e,n){var r=this.enter(),o=this,i=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(o=e(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Ya(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var u=n[c],l=r[c],f=u.length,d=a[c]=new Array(f),h,g=0;g<f;++g)(h=u[g]||l[g])&&(d[g]=h);for(;c<o;++c)a[c]=n[c];return new ut(a,this._parents)}function Wa(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],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 qa(t){t||(t=Ga);function e(f,d){return f&&d?t(f.__data__,d.__data__):!f-!d}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),u,l=0;l<a;++l)(u=s[l])&&(c[l]=u);c.sort(e)}return new ut(o,this._parents).order()}function Ga(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Ka(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Za(){return Array.from(this)}function Ua(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function Qa(){let t=0;for(const e of this)++t;return t}function Ja(){return!this.node()}function tc(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=e[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&t.call(a,a.__data__,i,o);return this}function ec(t){return function(){this.removeAttribute(t)}}function nc(t){return function(){this.removeAttributeNS(t.space,t.local)}}function rc(t,e){return function(){this.setAttribute(t,e)}}function oc(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ic(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function sc(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function ac(t,e){var n=en(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?nc:ec:typeof e=="function"?n.local?sc:ic:n.local?oc:rc)(n,e))}function So(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function cc(t){return function(){this.style.removeProperty(t)}}function uc(t,e,n){return function(){this.style.setProperty(t,e,n)}}function lc(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function fc(t,e,n){return arguments.length>1?this.each((e==null?cc:typeof e=="function"?lc:uc)(t,e,n??"")):Ut(this.node(),t)}function Ut(t,e){return t.style.getPropertyValue(e)||So(t).getComputedStyle(t,null).getPropertyValue(e)}function dc(t){return function(){delete this[t]}}function hc(t,e){return function(){this[t]=e}}function gc(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function pc(t,e){return arguments.length>1?this.each((e==null?dc:typeof e=="function"?gc:hc)(t,e)):this.node()[t]}function No(t){return t.trim().split(/^|\s+/)}function On(t){return t.classList||new Mo(t)}function Mo(t){this._node=t,this._names=No(t.getAttribute("class")||"")}Mo.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Co(t,e){for(var n=On(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function ko(t,e){for(var n=On(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function mc(t){return function(){Co(this,t)}}function yc(t){return function(){ko(this,t)}}function xc(t,e){return function(){(e.apply(this,arguments)?Co:ko)(this,t)}}function wc(t,e){var n=No(t+"");if(arguments.length<2){for(var r=On(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof e=="function"?xc:e?mc:yc)(n,e))}function vc(){this.textContent=""}function bc(t){return function(){this.textContent=t}}function _c(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Ec(t){return arguments.length?this.each(t==null?vc:(typeof t=="function"?_c:bc)(t)):this.node().textContent}function Sc(){this.innerHTML=""}function Nc(t){return function(){this.innerHTML=t}}function Mc(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Cc(t){return arguments.length?this.each(t==null?Sc:(typeof t=="function"?Mc:Nc)(t)):this.node().innerHTML}function kc(){this.nextSibling&&this.parentNode.appendChild(this)}function Ac(){return this.each(kc)}function $c(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ic(){return this.each($c)}function Pc(t){var e=typeof t=="function"?t:wo(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Tc(){return null}function zc(t,e){var n=typeof t=="function"?t:wo(t),r=e==null?Tc:typeof e=="function"?e:Fn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Dc(){var t=this.parentNode;t&&t.removeChild(this)}function Lc(){return this.each(Dc)}function Hc(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Rc(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Vc(t){return this.select(t?Rc:Hc)}function Bc(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Fc(t){return function(e){t.call(this,e,this.__data__)}}function Oc(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function jc(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,o=e.length,i;n<o;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++r]=i;++r?e.length=r:delete this.__on}}}function Xc(t,e,n){return function(){var r=this.__on,o,i=Fc(e);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===t.type&&o.name===t.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=e;return}}this.addEventListener(t.type,i,n),o={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(o):this.__on=[o]}}function Yc(t,e,n){var r=Oc(t+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,u=a.length,l;c<u;++c)for(o=0,l=a[c];o<i;++o)if((s=r[o]).type===l.type&&s.name===l.name)return l.value}return}for(a=e?Xc:jc,o=0;o<i;++o)this.each(a(r[o],e,n));return this}function Ao(t,e,n){var r=So(t),o=r.CustomEvent;typeof o=="function"?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function Wc(t,e){return function(){return Ao(this,t,e)}}function qc(t,e){return function(){return Ao(this,t,e.apply(this,arguments))}}function Gc(t,e){return this.each((typeof e=="function"?qc:Wc)(t,e))}function*Kc(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var $o=[null];function ut(t,e){this._groups=t,this._parents=e}function ve(){return new ut([[document.documentElement]],$o)}function Zc(){return this}ut.prototype=ve.prototype={constructor:ut,select:_a,selectAll:Ma,selectChild:$a,selectChildren:za,filter:Da,data:Fa,enter:La,exit:ja,join:Xa,merge:Ya,selection:Zc,order:Wa,sort:qa,call:Ka,nodes:Za,node:Ua,size:Qa,empty:Ja,each:tc,attr:ac,style:fc,property:pc,classed:wc,text:Ec,html:Cc,raise:Ac,lower:Ic,append:Pc,insert:zc,remove:Lc,clone:Vc,datum:Bc,on:Yc,dispatch:Gc,[Symbol.iterator]:Kc};function ct(t){return typeof t=="string"?new ut([[document.querySelector(t)]],[document.documentElement]):new ut([[t]],$o)}function Uc(t){let e;for(;e=t.sourceEvent;)t=e;return t}function dt(t,e){if(t=Uc(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var o=e.getBoundingClientRect();return[t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop]}}return[t.pageX,t.pageY]}const Qc={passive:!1},fe={capture:!0,passive:!1};function yn(t){t.stopImmediatePropagation()}function Kt(t){t.preventDefault(),t.stopImmediatePropagation()}function Io(t){var e=t.document.documentElement,n=ct(t).on("dragstart.drag",Kt,fe);"onselectstart"in e?n.on("selectstart.drag",Kt,fe):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Po(t,e){var n=t.document.documentElement,r=ct(t).on("dragstart.drag",null);e&&(r.on("click.drag",Kt,fe),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 Ce=t=>()=>t;function kn(t,{sourceEvent:e,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:c,dy:u,dispatch:l}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,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:u,enumerable:!0,configurable:!0},_:{value:l}})}kn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Jc(t){return!t.ctrlKey&&!t.button}function tu(){return this.parentNode}function eu(t,e){return e??{x:t.x,y:t.y}}function nu(){return navigator.maxTouchPoints||"ontouchstart"in this}function To(){var t=Jc,e=tu,n=eu,r=nu,o={},i=tn("start","drag","end"),s=0,a,c,u,l,f=0;function d(w){w.on("mousedown.drag",h).filter(r).on("touchstart.drag",x).on("touchmove.drag",m,Qc).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,S){if(!(l||!t.call(this,w,S))){var E=p(this,e.call(this,w,S),w,S,"mouse");E&&(ct(w.view).on("mousemove.drag",g,fe).on("mouseup.drag",v,fe),Io(w.view),yn(w),u=!1,a=w.clientX,c=w.clientY,E("start",w))}}function g(w){if(Kt(w),!u){var S=w.clientX-a,E=w.clientY-c;u=S*S+E*E>f}o.mouse("drag",w)}function v(w){ct(w.view).on("mousemove.drag mouseup.drag",null),Po(w.view,u),Kt(w),o.mouse("end",w)}function x(w,S){if(t.call(this,w,S)){var E=w.changedTouches,k=e.call(this,w,S),$=E.length,I,F;for(I=0;I<$;++I)(F=p(this,k,w,S,E[I].identifier,E[I]))&&(yn(w),F("start",w,E[I]))}}function m(w){var S=w.changedTouches,E=S.length,k,$;for(k=0;k<E;++k)($=o[S[k].identifier])&&(Kt(w),$("drag",w,S[k]))}function b(w){var S=w.changedTouches,E=S.length,k,$;for(l&&clearTimeout(l),l=setTimeout(function(){l=null},500),k=0;k<E;++k)($=o[S[k].identifier])&&(yn(w),$("end",w,S[k]))}function p(w,S,E,k,$,I){var F=i.copy(),z=dt(I||E,S),B,D,y;if((y=n.call(w,new kn("beforestart",{sourceEvent:E,target:d,identifier:$,active:s,x:z[0],y:z[1],dx:0,dy:0,dispatch:F}),k))!=null)return B=y.x-z[0]||0,D=y.y-z[1]||0,function N(_,C,P){var M=z,R;switch(_){case"start":o[$]=N,R=s++;break;case"end":delete o[$],--s;case"drag":z=dt(P||C,S),R=s;break}F.call(_,w,new kn(_,{sourceEvent:C,subject:y,target:d,identifier:$,active:R,x:z[0]+B,y:z[1]+D,dx:z[0]-M[0],dy:z[1]-M[1],dispatch:F}),k)}}return d.filter=function(w){return arguments.length?(t=typeof w=="function"?w:Ce(!!w),d):t},d.container=function(w){return arguments.length?(e=typeof w=="function"?w:Ce(w),d):e},d.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Ce(w),d):n},d.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:Ce(!!w),d):r},d.on=function(){var w=i.on.apply(i,arguments);return w===i?d:w},d.clickDistance=function(w){return arguments.length?(f=(w=+w)*w,d):Math.sqrt(f)},d}function jn(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function zo(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function be(){}var de=.7,je=1/de,Zt="\\s*([+-]?\\d+)\\s*",he="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",bt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ru=/^#([0-9a-f]{3,8})$/,ou=new RegExp(`^rgb\\(${Zt},${Zt},${Zt}\\)$`),iu=new RegExp(`^rgb\\(${bt},${bt},${bt}\\)$`),su=new RegExp(`^rgba\\(${Zt},${Zt},${Zt},${he}\\)$`),au=new RegExp(`^rgba\\(${bt},${bt},${bt},${he}\\)$`),cu=new RegExp(`^hsl\\(${he},${bt},${bt}\\)$`),uu=new RegExp(`^hsla\\(${he},${bt},${bt},${he}\\)$`),pr={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};jn(be,Ft,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:mr,formatHex:mr,formatHex8:lu,formatHsl:fu,formatRgb:yr,toString:yr});function mr(){return this.rgb().formatHex()}function lu(){return this.rgb().formatHex8()}function fu(){return Do(this).formatHsl()}function yr(){return this.rgb().formatRgb()}function Ft(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ru.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?xr(e):n===3?new at(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?ke(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?ke(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=ou.exec(t))?new at(e[1],e[2],e[3],1):(e=iu.exec(t))?new at(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=su.exec(t))?ke(e[1],e[2],e[3],e[4]):(e=au.exec(t))?ke(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=cu.exec(t))?br(e[1],e[2]/100,e[3]/100,1):(e=uu.exec(t))?br(e[1],e[2]/100,e[3]/100,e[4]):pr.hasOwnProperty(t)?xr(pr[t]):t==="transparent"?new at(NaN,NaN,NaN,0):null}function xr(t){return new at(t>>16&255,t>>8&255,t&255,1)}function ke(t,e,n,r){return r<=0&&(t=e=n=NaN),new at(t,e,n,r)}function du(t){return t instanceof be||(t=Ft(t)),t?(t=t.rgb(),new at(t.r,t.g,t.b,t.opacity)):new at}function An(t,e,n,r){return arguments.length===1?du(t):new at(t,e,n,r??1)}function at(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}jn(at,An,zo(be,{brighter(t){return t=t==null?je:Math.pow(je,t),new at(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?de:Math.pow(de,t),new at(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new at(Vt(this.r),Vt(this.g),Vt(this.b),Xe(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:wr,formatHex:wr,formatHex8:hu,formatRgb:vr,toString:vr}));function wr(){return`#${Rt(this.r)}${Rt(this.g)}${Rt(this.b)}`}function hu(){return`#${Rt(this.r)}${Rt(this.g)}${Rt(this.b)}${Rt((isNaN(this.opacity)?1:this.opacity)*255)}`}function vr(){const t=Xe(this.opacity);return`${t===1?"rgb(":"rgba("}${Vt(this.r)}, ${Vt(this.g)}, ${Vt(this.b)}${t===1?")":`, ${t})`}`}function Xe(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Vt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Rt(t){return t=Vt(t),(t<16?"0":"")+t.toString(16)}function br(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ht(t,e,n,r)}function Do(t){if(t instanceof ht)return new ht(t.h,t.s,t.l,t.opacity);if(t instanceof be||(t=Ft(t)),!t)return new ht;if(t instanceof ht)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(e===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-e)/a+2:s=(e-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new ht(s,a,c,t.opacity)}function gu(t,e,n,r){return arguments.length===1?Do(t):new ht(t,e,n,r??1)}function ht(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}jn(ht,gu,zo(be,{brighter(t){return t=t==null?je:Math.pow(je,t),new ht(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?de:Math.pow(de,t),new ht(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new at(xn(t>=240?t-240:t+120,o,r),xn(t,o,r),xn(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new ht(_r(this.h),Ae(this.s),Ae(this.l),Xe(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 t=Xe(this.opacity);return`${t===1?"hsl(":"hsla("}${_r(this.h)}, ${Ae(this.s)*100}%, ${Ae(this.l)*100}%${t===1?")":`, ${t})`}`}}));function _r(t){return t=(t||0)%360,t<0?t+360:t}function Ae(t){return Math.max(0,Math.min(1,t||0))}function xn(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Xn=t=>()=>t;function pu(t,e){return function(n){return t+n*e}}function mu(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function yu(t){return(t=+t)==1?Lo:function(e,n){return n-e?mu(e,n,t):Xn(isNaN(e)?n:e)}}function Lo(t,e){var n=e-t;return n?pu(t,n):Xn(isNaN(t)?e:t)}const Ye=function t(e){var n=yu(e);function r(o,i){var s=n((o=An(o)).r,(i=An(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),u=Lo(o.opacity,i.opacity);return function(l){return o.r=s(l),o.g=a(l),o.b=c(l),o.opacity=u(l),o+""}}return r.gamma=t,r}(1);function xu(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=t[o]*(1-i)+e[o]*i;return r}}function wu(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function vu(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=ue(t[s],e[s]);for(;s<n;++s)i[s]=e[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function bu(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function vt(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function _u(t,e){var n={},r={},o;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(o in e)o in t?n[o]=ue(t[o],e[o]):r[o]=e[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var $n=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wn=new RegExp($n.source,"g");function Eu(t){return function(){return t}}function Su(t){return function(e){return t(e)+""}}function Ho(t,e){var n=$n.lastIndex=wn.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(t=t+"",e=e+"";(r=$n.exec(t))&&(o=wn.exec(e));)(i=o.index)>n&&(i=e.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:vt(r,o)})),n=wn.lastIndex;return n<e.length&&(i=e.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?Su(c[0].x):Eu(e):(e=c.length,function(u){for(var l=0,f;l<e;++l)a[(f=c[l]).i]=f.x(u);return a.join("")})}function ue(t,e){var n=typeof e,r;return e==null||n==="boolean"?Xn(e):(n==="number"?vt:n==="string"?(r=Ft(e))?(e=r,Ye):Ho:e instanceof Ft?Ye:e instanceof Date?bu:wu(e)?xu:Array.isArray(e)?vu:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?_u:vt)(t,e)}var Er=180/Math.PI,In={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ro(t,e,n,r,o,i){var s,a,c;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),t*r<e*n&&(t=-t,e=-e,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*Er,skewX:Math.atan(c)*Er,scaleX:s,scaleY:a}}var $e;function Nu(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?In:Ro(e.a,e.b,e.c,e.d,e.e,e.f)}function Mu(t){return t==null||($e||($e=document.createElementNS("http://www.w3.org/2000/svg","g")),$e.setAttribute("transform",t),!(t=$e.transform.baseVal.consolidate()))?In:(t=t.matrix,Ro(t.a,t.b,t.c,t.d,t.e,t.f))}function Vo(t,e,n,r){function o(u){return u.length?u.pop()+" ":""}function i(u,l,f,d,h,g){if(u!==f||l!==d){var v=h.push("translate(",null,e,null,n);g.push({i:v-4,x:vt(u,f)},{i:v-2,x:vt(l,d)})}else(f||d)&&h.push("translate("+f+e+d+n)}function s(u,l,f,d){u!==l?(u-l>180?l+=360:l-u>180&&(u+=360),d.push({i:f.push(o(f)+"rotate(",null,r)-2,x:vt(u,l)})):l&&f.push(o(f)+"rotate("+l+r)}function a(u,l,f,d){u!==l?d.push({i:f.push(o(f)+"skewX(",null,r)-2,x:vt(u,l)}):l&&f.push(o(f)+"skewX("+l+r)}function c(u,l,f,d,h,g){if(u!==f||l!==d){var v=h.push(o(h)+"scale(",null,",",null,")");g.push({i:v-4,x:vt(u,f)},{i:v-2,x:vt(l,d)})}else(f!==1||d!==1)&&h.push(o(h)+"scale("+f+","+d+")")}return function(u,l){var f=[],d=[];return u=t(u),l=t(l),i(u.translateX,u.translateY,l.translateX,l.translateY,f,d),s(u.rotate,l.rotate,f,d),a(u.skewX,l.skewX,f,d),c(u.scaleX,u.scaleY,l.scaleX,l.scaleY,f,d),u=l=null,function(h){for(var g=-1,v=d.length,x;++g<v;)f[(x=d[g]).i]=x.x(h);return f.join("")}}}var Cu=Vo(Nu,"px, ","px)","deg)"),ku=Vo(Mu,", ",")",")"),Au=1e-12;function Sr(t){return((t=Math.exp(t))+1/t)/2}function $u(t){return((t=Math.exp(t))-1/t)/2}function Iu(t){return((t=Math.exp(2*t))-1)/(t+1)}const He=function t(e,n,r){function o(i,s){var a=i[0],c=i[1],u=i[2],l=s[0],f=s[1],d=s[2],h=l-a,g=f-c,v=h*h+g*g,x,m;if(v<Au)m=Math.log(d/u)/e,x=function(k){return[a+k*h,c+k*g,u*Math.exp(e*k*m)]};else{var b=Math.sqrt(v),p=(d*d-u*u+r*v)/(2*u*n*b),w=(d*d-u*u-r*v)/(2*d*n*b),S=Math.log(Math.sqrt(p*p+1)-p),E=Math.log(Math.sqrt(w*w+1)-w);m=(E-S)/e,x=function(k){var $=k*m,I=Sr(S),F=u/(n*b)*(I*Iu(e*$+S)-$u(S));return[a+F*h,c+F*g,u*I/Sr(e*$+S)]}}return x.duration=m*1e3*e/Math.SQRT2,x}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return t(s,a,c)},o}(Math.SQRT2,2,4);var Qt=0,ae=0,ie=0,Bo=1e3,We,ce,qe=0,Ot=0,nn=0,ge=typeof performance=="object"&&performance.now?performance:Date,Fo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Yn(){return Ot||(Fo(Pu),Ot=ge.now()+nn)}function Pu(){Ot=0}function Ge(){this._call=this._time=this._next=null}Ge.prototype=Oo.prototype={constructor:Ge,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Yn():+n)+(e==null?0:+e),!this._next&&ce!==this&&(ce?ce._next=this:We=this,ce=this),this._call=t,this._time=n,Pn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Pn())}};function Oo(t,e,n){var r=new Ge;return r.restart(t,e,n),r}function Tu(){Yn(),++Qt;for(var t=We,e;t;)(e=Ot-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Qt}function Nr(){Ot=(qe=ge.now())+nn,Qt=ae=0;try{Tu()}finally{Qt=0,Du(),Ot=0}}function zu(){var t=ge.now(),e=t-qe;e>Bo&&(nn-=e,qe=t)}function Du(){for(var t,e=We,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:We=n);ce=t,Pn(r)}function Pn(t){if(!Qt){ae&&(ae=clearTimeout(ae));var e=t-Ot;e>24?(t<1/0&&(ae=setTimeout(Nr,t-ge.now()-nn)),ie&&(ie=clearInterval(ie))):(ie||(qe=ge.now(),ie=setInterval(zu,Bo)),Qt=1,Fo(Nr))}}function Mr(t,e,n){var r=new Ge;return e=e==null?0:+e,r.restart(o=>{r.stop(),t(o+e)},e,n),r}var Lu=tn("start","end","cancel","interrupt"),Hu=[],jo=0,Cr=1,Tn=2,Re=3,kr=4,zn=5,Ve=6;function rn(t,e,n,r,o,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Ru(t,n,{name:e,index:r,group:o,on:Lu,tween:Hu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:jo})}function Wn(t,e){var n=yt(t,e);if(n.state>jo)throw new Error("too late; already scheduled");return n}function _t(t,e){var n=yt(t,e);if(n.state>Re)throw new Error("too late; already running");return n}function yt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Ru(t,e,n){var r=t.__transition,o;r[e]=n,n.timer=Oo(i,0,n.time);function i(u){n.state=Cr,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var l,f,d,h;if(n.state!==Cr)return c();for(l in r)if(h=r[l],h.name===n.name){if(h.state===Re)return Mr(s);h.state===kr?(h.state=Ve,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete r[l]):+l<e&&(h.state=Ve,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete r[l])}if(Mr(function(){n.state===Re&&(n.state=kr,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=Tn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Tn){for(n.state=Re,o=new Array(d=n.tween.length),l=0,f=-1;l<d;++l)(h=n.tween[l].value.call(t,t.__data__,n.index,n.group))&&(o[++f]=h);o.length=f+1}}function a(u){for(var l=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=zn,1),f=-1,d=o.length;++f<d;)o[f].call(t,l);n.state===zn&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Ve,n.timer.stop(),delete r[e];for(var u in r)return;delete t.__transition}}function Be(t,e){var n=t.__transition,r,o,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((r=n[s]).name!==e){i=!1;continue}o=r.state>Tn&&r.state<zn,r.state=Ve,r.timer.stop(),r.on.call(o?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}i&&delete t.__transition}}function Vu(t){return this.each(function(){Be(this,t)})}function Bu(t,e){var n,r;return function(){var o=_t(this,t),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===e){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function Fu(t,e,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=_t(this,t),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:e,value:n},c=0,u=o.length;c<u;++c)if(o[c].name===e){o[c]=a;break}c===u&&o.push(a)}i.tween=o}}function Ou(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=yt(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===t)return s.value;return null}return this.each((e==null?Bu:Fu)(n,t,e))}function qn(t,e,n){var r=t._id;return t.each(function(){var o=_t(this,r);(o.value||(o.value={}))[e]=n.apply(this,arguments)}),function(o){return yt(o,r).value[e]}}function Xo(t,e){var n;return(typeof e=="number"?vt:e instanceof Ft?Ye:(n=Ft(e))?(e=n,Ye):Ho)(t,e)}function ju(t){return function(){this.removeAttribute(t)}}function Xu(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Yu(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttribute(t);return s===o?null:s===r?i:i=e(r=s,n)}}function Wu(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===o?null:s===r?i:i=e(r=s,n)}}function qu(t,e,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a)))}}function Gu(t,e,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a)))}}function Ku(t,e){var n=en(t),r=n==="transform"?ku:Xo;return this.attrTween(t,typeof e=="function"?(n.local?Gu:qu)(n,r,qn(this,"attr."+t,e)):e==null?(n.local?Xu:ju)(n):(n.local?Wu:Yu)(n,r,e))}function Zu(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Uu(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Qu(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Uu(t,i)),n}return o._value=e,o}function Ju(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Zu(t,i)),n}return o._value=e,o}function tl(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=en(t);return this.tween(n,(r.local?Qu:Ju)(r,e))}function el(t,e){return function(){Wn(this,t).delay=+e.apply(this,arguments)}}function nl(t,e){return e=+e,function(){Wn(this,t).delay=e}}function rl(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?el:nl)(e,t)):yt(this.node(),e).delay}function ol(t,e){return function(){_t(this,t).duration=+e.apply(this,arguments)}}function il(t,e){return e=+e,function(){_t(this,t).duration=e}}function sl(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?ol:il)(e,t)):yt(this.node(),e).duration}function al(t,e){if(typeof e!="function")throw new Error;return function(){_t(this,t).ease=e}}function cl(t){var e=this._id;return arguments.length?this.each(al(e,t)):yt(this.node(),e).ease}function ul(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;_t(this,t).ease=n}}function ll(t){if(typeof t!="function")throw new Error;return this.each(ul(this._id,t))}function fl(t){typeof t!="function"&&(t=bo(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&t.call(c,c.__data__,u,i)&&a.push(c);return new At(r,this._parents,this._name,this._id)}function dl(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=e[a],u=n[a],l=c.length,f=s[a]=new Array(l),d,h=0;h<l;++h)(d=c[h]||u[h])&&(f[h]=d);for(;a<r;++a)s[a]=e[a];return new At(s,this._parents,this._name,this._id)}function hl(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function gl(t,e,n){var r,o,i=hl(e)?Wn:_t;return function(){var s=i(this,t),a=s.on;a!==r&&(o=(r=a).copy()).on(e,n),s.on=o}}function pl(t,e){var n=this._id;return arguments.length<2?yt(this.node(),n).on.on(t):this.each(gl(n,t,e))}function ml(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function yl(){return this.on("end.remove",ml(this._id))}function xl(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Fn(t));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,u=i[s]=new Array(c),l,f,d=0;d<c;++d)(l=a[d])&&(f=t.call(l,l.__data__,d,a))&&("__data__"in l&&(f.__data__=l.__data__),u[d]=f,rn(u[d],e,n,d,u,yt(l,n)));return new At(i,this._parents,e,n)}function wl(t){var e=this._name,n=this._id;typeof t!="function"&&(t=vo(t));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],u=c.length,l,f=0;f<u;++f)if(l=c[f]){for(var d=t.call(l,l.__data__,f,c),h,g=yt(l,n),v=0,x=d.length;v<x;++v)(h=d[v])&&rn(h,e,n,v,d,g);i.push(d),s.push(l)}return new At(i,s,e,n)}var vl=ve.prototype.constructor;function bl(){return new vl(this._groups,this._parents)}function _l(t,e){var n,r,o;return function(){var i=Ut(this,t),s=(this.style.removeProperty(t),Ut(this,t));return i===s?null:i===n&&s===r?o:o=e(n=i,r=s)}}function Yo(t){return function(){this.style.removeProperty(t)}}function El(t,e,n){var r,o=n+"",i;return function(){var s=Ut(this,t);return s===o?null:s===r?i:i=e(r=s,n)}}function Sl(t,e,n){var r,o,i;return function(){var s=Ut(this,t),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(t),Ut(this,t))),s===c?null:s===r&&c===o?i:(o=c,i=e(r=s,a))}}function Nl(t,e){var n,r,o,i="style."+e,s="end."+i,a;return function(){var c=_t(this,t),u=c.on,l=c.value[i]==null?a||(a=Yo(e)):void 0;(u!==n||o!==l)&&(r=(n=u).copy()).on(s,o=l),c.on=r}}function Ml(t,e,n){var r=(t+="")=="transform"?Cu:Xo;return e==null?this.styleTween(t,_l(t,r)).on("end.style."+t,Yo(t)):typeof e=="function"?this.styleTween(t,Sl(t,r,qn(this,"style."+t,e))).each(Nl(this._id,t)):this.styleTween(t,El(t,r,e),n).on("end.style."+t,null)}function Cl(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function kl(t,e,n){var r,o;function i(){var s=e.apply(this,arguments);return s!==o&&(r=(o=s)&&Cl(t,s,n)),r}return i._value=e,i}function Al(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,kl(t,e,n??""))}function $l(t){return function(){this.textContent=t}}function Il(t){return function(){var e=t(this);this.textContent=e??""}}function Pl(t){return this.tween("text",typeof t=="function"?Il(qn(this,"text",t)):$l(t==null?"":t+""))}function Tl(t){return function(e){this.textContent=t.call(this,e)}}function zl(t){var e,n;function r(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&Tl(o)),e}return r._value=t,r}function Dl(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,zl(t))}function Ll(){for(var t=this._name,e=this._id,n=Wo(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)if(c=s[u]){var l=yt(c,e);rn(c,t,n,u,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new At(r,this._parents,t,n)}function Hl(){var t,e,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 u=_t(this,r),l=u.on;l!==t&&(e=(t=l).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(c)),u.on=e}),o===0&&i()})}var Rl=0;function At(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Wo(){return++Rl}var Ct=ve.prototype;At.prototype={constructor:At,select:xl,selectAll:wl,selectChild:Ct.selectChild,selectChildren:Ct.selectChildren,filter:fl,merge:dl,selection:bl,transition:Ll,call:Ct.call,nodes:Ct.nodes,node:Ct.node,size:Ct.size,empty:Ct.empty,each:Ct.each,on:pl,attr:Ku,attrTween:tl,style:Ml,styleTween:Al,text:Pl,textTween:Dl,remove:yl,tween:Ou,delay:rl,duration:sl,ease:cl,easeVarying:ll,end:Hl,[Symbol.iterator]:Ct[Symbol.iterator]};function Vl(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Bl={time:null,delay:0,duration:250,ease:Vl};function Fl(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Ol(t){var e,n;t instanceof At?(e=t._id,t=t._name):(e=Wo(),(n=Bl).time=Yn(),t=t==null?null:t+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&rn(c,t,e,u,s,n||Fl(c,e));return new At(r,this._parents,t,e)}ve.prototype.interrupt=Vu;ve.prototype.transition=Ol;const Ie=t=>()=>t;function jl(t,{sourceEvent:e,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function kt(t,e,n){this.k=t,this.x=e,this.y=n}kt.prototype={constructor:kt,scale:function(t){return t===1?this:new kt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new kt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var on=new kt(1,0,0);qo.prototype=kt.prototype;function qo(t){for(;!t.__zoom;)if(!(t=t.parentNode))return on;return t.__zoom}function vn(t){t.stopImmediatePropagation()}function se(t){t.preventDefault(),t.stopImmediatePropagation()}function Xl(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Yl(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Ar(){return this.__zoom||on}function Wl(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function ql(){return navigator.maxTouchPoints||"ontouchstart"in this}function Gl(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.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 Go(){var t=Xl,e=Yl,n=Gl,r=Wl,o=ql,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=He,u=tn("start","zoom","end"),l,f,d,h=500,g=150,v=0,x=10;function m(y){y.property("__zoom",Ar).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",F).filter(o).on("touchstart.zoom",z).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,N,_,C){var P=y.selection?y.selection():y;P.property("__zoom",Ar),y!==P?S(y,N,_,C):P.interrupt().each(function(){E(this,arguments).event(C).start().zoom(null,typeof N=="function"?N.apply(this,arguments):N).end()})},m.scaleBy=function(y,N,_,C){m.scaleTo(y,function(){var P=this.__zoom.k,M=typeof N=="function"?N.apply(this,arguments):N;return P*M},_,C)},m.scaleTo=function(y,N,_,C){m.transform(y,function(){var P=e.apply(this,arguments),M=this.__zoom,R=_==null?w(P):typeof _=="function"?_.apply(this,arguments):_,V=M.invert(R),H=typeof N=="function"?N.apply(this,arguments):N;return n(p(b(M,H),R,V),P,s)},_,C)},m.translateBy=function(y,N,_,C){m.transform(y,function(){return n(this.__zoom.translate(typeof N=="function"?N.apply(this,arguments):N,typeof _=="function"?_.apply(this,arguments):_),e.apply(this,arguments),s)},null,C)},m.translateTo=function(y,N,_,C,P){m.transform(y,function(){var M=e.apply(this,arguments),R=this.__zoom,V=C==null?w(M):typeof C=="function"?C.apply(this,arguments):C;return n(on.translate(V[0],V[1]).scale(R.k).translate(typeof N=="function"?-N.apply(this,arguments):-N,typeof _=="function"?-_.apply(this,arguments):-_),M,s)},C,P)};function b(y,N){return N=Math.max(i[0],Math.min(i[1],N)),N===y.k?y:new kt(N,y.x,y.y)}function p(y,N,_){var C=N[0]-_[0]*y.k,P=N[1]-_[1]*y.k;return C===y.x&&P===y.y?y:new kt(y.k,C,P)}function w(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function S(y,N,_,C){y.on("start.zoom",function(){E(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(C).end()}).tween("zoom",function(){var P=this,M=arguments,R=E(P,M).event(C),V=e.apply(P,M),H=_==null?w(V):typeof _=="function"?_.apply(P,M):_,j=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),X=P.__zoom,G=typeof N=="function"?N.apply(P,M):N,Q=c(X.invert(H).concat(j/X.k),G.invert(H).concat(j/G.k));return function(K){if(K===1)K=G;else{var L=Q(K),O=j/L[2];K=new kt(O,H[0]-L[0]*O,H[1]-L[1]*O)}R.zoom(null,K)}})}function E(y,N,_){return!_&&y.__zooming||new k(y,N)}function k(y,N){this.that=y,this.args=N,this.active=0,this.sourceEvent=null,this.extent=e.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=ct(this.that).datum();u.call(y,this.that,new jl(y,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:u}),N)}};function $(y,...N){if(!t.apply(this,arguments))return;var _=E(this,N).event(y),C=this.__zoom,P=Math.max(i[0],Math.min(i[1],C.k*Math.pow(2,r.apply(this,arguments)))),M=dt(y);if(_.wheel)(_.mouse[0][0]!==M[0]||_.mouse[0][1]!==M[1])&&(_.mouse[1]=C.invert(_.mouse[0]=M)),clearTimeout(_.wheel);else{if(C.k===P)return;_.mouse=[M,C.invert(M)],Be(this),_.start()}se(y),_.wheel=setTimeout(R,g),_.zoom("mouse",n(p(b(C,P),_.mouse[0],_.mouse[1]),_.extent,s));function R(){_.wheel=null,_.end()}}function I(y,...N){if(d||!t.apply(this,arguments))return;var _=y.currentTarget,C=E(this,N,!0).event(y),P=ct(y.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",j,!0),M=dt(y,_),R=y.clientX,V=y.clientY;Io(y.view),vn(y),C.mouse=[M,this.__zoom.invert(M)],Be(this),C.start();function H(X){if(se(X),!C.moved){var G=X.clientX-R,Q=X.clientY-V;C.moved=G*G+Q*Q>v}C.event(X).zoom("mouse",n(p(C.that.__zoom,C.mouse[0]=dt(X,_),C.mouse[1]),C.extent,s))}function j(X){P.on("mousemove.zoom mouseup.zoom",null),Po(X.view,C.moved),se(X),C.event(X).end()}}function F(y,...N){if(t.apply(this,arguments)){var _=this.__zoom,C=dt(y.changedTouches?y.changedTouches[0]:y,this),P=_.invert(C),M=_.k*(y.shiftKey?.5:2),R=n(p(b(_,M),C,P),e.apply(this,N),s);se(y),a>0?ct(this).transition().duration(a).call(S,R,C,y):ct(this).call(m.transform,R,C,y)}}function z(y,...N){if(t.apply(this,arguments)){var _=y.touches,C=_.length,P=E(this,N,y.changedTouches.length===C).event(y),M,R,V,H;for(vn(y),R=0;R<C;++R)V=_[R],H=dt(V,this),H=[H,this.__zoom.invert(H),V.identifier],P.touch0?!P.touch1&&P.touch0[2]!==H[2]&&(P.touch1=H,P.taps=0):(P.touch0=H,M=!0,P.taps=1+!!l);l&&(l=clearTimeout(l)),M&&(P.taps<2&&(f=H[0],l=setTimeout(function(){l=null},h)),Be(this),P.start())}}function B(y,...N){if(this.__zooming){var _=E(this,N).event(y),C=y.changedTouches,P=C.length,M,R,V,H;for(se(y),M=0;M<P;++M)R=C[M],V=dt(R,this),_.touch0&&_.touch0[2]===R.identifier?_.touch0[0]=V:_.touch1&&_.touch1[2]===R.identifier&&(_.touch1[0]=V);if(R=_.that.__zoom,_.touch1){var j=_.touch0[0],X=_.touch0[1],G=_.touch1[0],Q=_.touch1[1],K=(K=G[0]-j[0])*K+(K=G[1]-j[1])*K,L=(L=Q[0]-X[0])*L+(L=Q[1]-X[1])*L;R=b(R,Math.sqrt(K/L)),V=[(j[0]+G[0])/2,(j[1]+G[1])/2],H=[(X[0]+Q[0])/2,(X[1]+Q[1])/2]}else if(_.touch0)V=_.touch0[0],H=_.touch0[1];else return;_.zoom("touch",n(p(R,V,H),_.extent,s))}}function D(y,...N){if(this.__zooming){var _=E(this,N).event(y),C=y.changedTouches,P=C.length,M,R;for(vn(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),M=0;M<P;++M)R=C[M],_.touch0&&_.touch0[2]===R.identifier?delete _.touch0:_.touch1&&_.touch1[2]===R.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&(R=dt(R,this),Math.hypot(f[0]-R[0],f[1]-R[1])<x)){var V=ct(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(r=typeof y=="function"?y:Ie(+y),m):r},m.filter=function(y){return arguments.length?(t=typeof y=="function"?y:Ie(!!y),m):t},m.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:Ie(!!y),m):o},m.extent=function(y){return arguments.length?(e=typeof y=="function"?y:Ie([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):e},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=u.on.apply(u,arguments);return y===u?m:y},m.clickDistance=function(y){return arguments.length?(v=(y=+y)*y,m):Math.sqrt(v)},m.tapDistance=function(y){return arguments.length?(x=+y,m):x},m}const mt={error001:(t="react")=>`Seems like you have not used ${t==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${t}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:t=>`Node type "${t}" 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:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:r}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/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:t=>`Edge with id "${t}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},pe=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ko=["Enter"," ","Escape"],Zo={"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:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, 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 Jt;(function(t){t.Strict="strict",t.Loose="loose"})(Jt||(Jt={}));var Bt;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(Bt||(Bt={}));var me;(function(t){t.Partial="partial",t.Full="full"})(me||(me={}));const Uo={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Pt;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Pt||(Pt={}));var Ke;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Ke||(Ke={}));var q;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(q||(q={}));const $r={[q.Left]:q.Right,[q.Right]:q.Left,[q.Top]:q.Bottom,[q.Bottom]:q.Top};function Qo(t){return t===null?null:t?"valid":"invalid"}const Jo=t=>!!t&&typeof t=="object"&&"id"in t&&"source"in t&&"target"in t,Kl=t=>!!t&&typeof t=="object"&&"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Gn=t=>!!t&&typeof t=="object"&&"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),_e=(t,e=[0,0])=>{const{width:n,height:r}=Et(t),o=t.origin??e,i=n*o[0],s=r*o[1];return{x:t.position.x-i,y:t.position.y-s}},Zl=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,o)=>{const i=typeof o=="string";let s=!e.nodeLookup&&!i?o:void 0;e.nodeLookup&&(s=i?e.nodeLookup.get(o):Gn(o)?o:e.nodeLookup.get(o.id));const a=s?Ze(s,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return sn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return an(n)},Ee=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return t.forEach(o=>{(e.filter===void 0||e.filter(o))&&(n=sn(n,Ze(o)),r=!0)}),r?an(n):{x:0,y:0,width:0,height:0}},Kn=(t,e,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a=(e.x-n)/o,c=(e.y-r)/o,u=e.width/o,l=e.height/o,f=[];for(const d of t.values()){const{measured:h,selectable:g=!0,hidden:v=!1}=d;if(s&&!g||v)continue;const x=h.width??d.width??d.initialWidth??0,m=h.height??d.height??d.initialHeight??0,{x:b,y:p}=d.internals.positionAbsolute,w=ri(a,c,u,l,b,p,x,m),S=x*m,E=i&&w>0;(!d.internals.handleBounds||E||w>=S||d.dragging)&&f.push(d)}return f},Ul=(t,e)=>{const n=new Set;return t.forEach(r=>{n.add(r.id)}),e.filter(r=>n.has(r.source)||n.has(r.target))};function Ql(t,e){const n=new Map,r=e!=null&&e.nodes?new Set(e.nodes.map(o=>o.id)):null;return t.forEach(o=>{let i;if(e!=null&&e.includeHiddenNodes){const{width:s,height:a}=Et(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 Jl({nodes:t,width:e,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(t.size===0)return!0;const a=Ql(t,s),c=Ee(a),u=Un(c,e,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(u,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),!0}function ti({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(t),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},l=s.origin??r;let f=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",mt.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(f=[[c,u],[c+h,u+g]])}else a&&Xt(s.extent)&&(f=[[s.extent[0][0]+c,s.extent[0][1]+u],[s.extent[1][0]+c,s.extent[1][1]+u]]);const d=Xt(f)?jt(e,f,s.measured):e;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",mt.error015())),{position:{x:d.x-c+(s.measured.width??0)*l[0],y:d.y-u+(s.measured.height??0)*l[1]},positionAbsolute:d}}async function tf({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(t.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),g=!h&&d.parentId&&s.find(v=>v.id===d.parentId);(h||g)&&s.push(d)}const a=new Set(e.map(d=>d.id)),c=r.filter(d=>d.deletable!==!1),l=Ul(s,c);for(const d of c)a.has(d.id)&&!l.find(g=>g.id===d.id)&&l.push(d);if(!o)return{edges:l,nodes:s};const f=await o({nodes:s,edges:l});return typeof f=="boolean"?f?{edges:l,nodes:s}:{edges:[],nodes:[]}:f}const te=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),jt=(t={x:0,y:0},e,n)=>({x:te(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:te(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function ei(t,e,n){const{width:r,height:o}=Et(n),{x:i,y:s}=n.internals.positionAbsolute;return jt(t,[[i,s],[i+r,s+o]],e)}const Ir=(t,e,n)=>t<e?te(Math.abs(t-e),1,e)/e:t>n?-te(Math.abs(t-n),1,e)/e:0,Zn=(t,e,n=15,r=40)=>{const o=Ir(t.x,r,e.width-r)*n,i=Ir(t.y,r,e.height-r)*n;return[o,i]},sn=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),Dn=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),an=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),ye=(t,e=[0,0])=>{var o,i;const{x:n,y:r}=Gn(t)?t.internals.positionAbsolute:_e(t,e);return{x:n,y:r,width:((o=t.measured)==null?void 0:o.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}},Ze=(t,e=[0,0])=>{var o,i;const{x:n,y:r}=Gn(t)?t.internals.positionAbsolute:_e(t,e);return{x:n,y:r,x2:n+(((o=t.measured)==null?void 0:o.width)??t.width??t.initialWidth??0),y2:r+(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0)}},ni=(t,e)=>an(sn(Dn(t),Dn(e))),ri=(t,e,n,r,o,i,s,a)=>{const c=Math.max(0,Math.min(t+n,o+s)-Math.max(t,o)),u=Math.max(0,Math.min(e+r,i+a)-Math.max(e,i));return Math.ceil(c*u)},Ue=(t,e)=>ri(t.x,t.y,t.width,t.height,e.x,e.y,e.width,e.height),Pr=t=>gt(t.width)&&gt(t.height)&&gt(t.x)&&gt(t.y),gt=t=>!isNaN(t)&&isFinite(t),oi=(t,e)=>(n,r)=>{},Se=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),Ne=({x:t,y:e},[n,r,o],i=!1,s=[1,1])=>{const a={x:(t-n)/o,y:(e-r)/o};return i?Se(a,s):a},ee=({x:t,y:e},[n,r,o])=>({x:t*o+n,y:e*o+r});function Wt(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function ef(t,e,n){if(typeof t=="string"||typeof t=="number"){const r=Wt(t,n),o=Wt(t,e);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof t=="object"){const r=Wt(t.top??t.y??0,n),o=Wt(t.bottom??t.y??0,n),i=Wt(t.left??t.x??0,e),s=Wt(t.right??t.x??0,e);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 nf(t,e,n,r,o,i){const{x:s,y:a}=ee(t,[e,n,r]),{x:c,y:u}=ee({x:t.x+t.width,y:t.y+t.height},[e,n,r]),l=o-c,f=i-u;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(l),bottom:Math.floor(f)}}const Un=(t,e,n,r,o,i)=>{const s=ef(i,e,n),a=(e-s.x)/t.width,c=(n-s.y)/t.height,u=Math.min(a,c),l=te(u,r,o),f=t.x+t.width/2,d=t.y+t.height/2,h=e/2-f*l,g=n/2-d*l,v=nf(t,h,g,l,e,n),x={left:Math.min(v.left-s.left,0),top:Math.min(v.top-s.top,0),right:Math.min(v.right-s.right,0),bottom:Math.min(v.bottom-s.bottom,0)};return{x:h-x.left+x.right,y:g-x.top+x.bottom,zoom:l}},xe=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Xt(t){return t!=null&&t!=="parent"}function Et(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function ii(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function si(t,e={width:0,height:0},n,r,o){const i={...t},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(e.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(e.height??0)*a[1]}return i}function Tr(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function rf(){let t,e;return{promise:new Promise((r,o)=>{t=r,e=o}),resolve:t,reject:e}}function of(t){return{...Zo,...t||{}}}function le(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=pt(t),a=Ne({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:c,y:u}=n?Se(a,e):a;return{xSnapped:c,ySnapped:u,...a}}const Qn=t=>({width:t.offsetWidth,height:t.offsetHeight}),ai=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},sf=["INPUT","SELECT","TEXTAREA"];function ci(t){var r,o;const e=((o=(r=t.composedPath)==null?void 0:r.call(t))==null?void 0:o[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:sf.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const ui=t=>"clientX"in t,pt=(t,e)=>{var i,s;const n=ui(t),r=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,o=n?t.clientY:(s=t.touches)==null?void 0:s[0].clientY;return{x:r-((e==null?void 0:e.left)??0),y:o-((e==null?void 0:e.top)??0)}},zr=(t,e,n,r,o)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:t,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Qn(s)}})};function li({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=t*.125+o*.375+s*.375+n*.125,u=e*.125+i*.375+a*.375+r*.125,l=Math.abs(c-t),f=Math.abs(u-e);return[c,u,l,f]}function Pe(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function Dr({pos:t,x1:e,y1:n,x2:r,y2:o,c:i}){switch(t){case q.Left:return[e-Pe(e-r,i),n];case q.Right:return[e+Pe(r-e,i),n];case q.Top:return[e,n-Pe(n-o,i)];case q.Bottom:return[e,n+Pe(o-n,i)]}}function fi({sourceX:t,sourceY:e,sourcePosition:n=q.Bottom,targetX:r,targetY:o,targetPosition:i=q.Top,curvature:s=.25}){const[a,c]=Dr({pos:n,x1:t,y1:e,x2:r,y2:o,c:s}),[u,l]=Dr({pos:i,x1:r,y1:o,x2:t,y2:e,c:s}),[f,d,h,g]=li({sourceX:t,sourceY:e,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:u,targetControlY:l});return[`M${t},${e} C${a},${c} ${u},${l} ${r},${o}`,f,d,h,g]}function di({sourceX:t,sourceY:e,targetX:n,targetY:r}){const o=Math.abs(n-t)/2,i=n<t?n+o:n-o,s=Math.abs(r-e)/2,a=r<e?r+s:r-s;return[i,a,o,s]}function af({sourceNode:t,targetNode:e,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(t.parentId||o&&t.selected?t.internals.z:0,e.parentId||o&&e.selected?e.internals.z:0);return s+a}function cf({sourceNode:t,targetNode:e,width:n,height:r,transform:o}){const i=sn(Ze(t),Ze(e));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 Ue(s,an(i))>0}const uf=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`xy-edge__${t}${e||""}-${n}${r||""}`,lf=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),ff=(t,e,n={})=>{var i;if(!t.source||!t.target)return(i=n.onError)==null||i.call(n,"006",mt.error006()),e;const r=n.getEdgeId||uf;let o;return Jo(t)?o={...t}:o={...t,id:r(t)},lf(o,e)?e:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,e.concat(o))};function hi({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[o,i,s,a]=di({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,o,i,s,a]}const Lr={[q.Left]:{x:-1,y:0},[q.Right]:{x:1,y:0},[q.Top]:{x:0,y:-1},[q.Bottom]:{x:0,y:1}},df=({source:t,sourcePosition:e=q.Bottom,target:n})=>e===q.Left||e===q.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},Hr=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function hf({source:t,sourcePosition:e=q.Bottom,target:n,targetPosition:r=q.Top,center:o,offset:i,stepPosition:s}){const a=Lr[e],c=Lr[r],u={x:t.x+a.x*i,y:t.y+a.y*i},l={x:n.x+c.x*i,y:n.y+c.y*i},f=df({source:u,sourcePosition:e,target:l}),d=f.x!==0?"x":"y",h=f[d];let g=[],v,x;const m={x:0,y:0},b={x:0,y:0},[,,p,w]=di({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(v=o.x??u.x+(l.x-u.x)*s,x=o.y??(u.y+l.y)/2):(v=o.x??(u.x+l.x)/2,x=o.y??u.y+(l.y-u.y)*s);const $=[{x:v,y:u.y},{x:v,y:l.y}],I=[{x:u.x,y:x},{x:l.x,y:x}];a[d]===h?g=d==="x"?$:I:g=d==="x"?I:$}else{const $=[{x:u.x,y:l.y}],I=[{x:l.x,y:u.y}];if(d==="x"?g=a.x===h?I:$:g=a.y===h?$:I,e===r){const y=Math.abs(t[d]-n[d]);if(y<=i){const N=Math.min(i-1,i-y);a[d]===h?m[d]=(u[d]>t[d]?-1:1)*N:b[d]=(l[d]>n[d]?-1:1)*N}}if(e!==r){const y=d==="x"?"y":"x",N=a[d]===c[y],_=u[y]>l[y],C=u[y]<l[y];(a[d]===1&&(!N&&_||N&&C)||a[d]!==1&&(!N&&C||N&&_))&&(g=d==="x"?$:I)}const F={x:u.x+m.x,y:u.y+m.y},z={x:l.x+b.x,y:l.y+b.y},B=Math.max(Math.abs(F.x-g[0].x),Math.abs(z.x-g[0].x)),D=Math.max(Math.abs(F.y-g[0].y),Math.abs(z.y-g[0].y));B>=D?(v=(F.x+z.x)/2,x=g[0].y):(v=g[0].x,x=(F.y+z.y)/2)}const S={x:u.x+m.x,y:u.y+m.y},E={x:l.x+b.x,y:l.y+b.y};return[[t,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,...E.x!==g[g.length-1].x||E.y!==g[g.length-1].y?[E]:[],n],v,x,p,w]}function gf(t,e,n,r){const o=Math.min(Hr(t,e)/2,Hr(e,n)/2,r),{x:i,y:s}=e;if(t.x===i&&i===n.x||t.y===s&&s===n.y)return`L${i} ${s}`;if(t.y===s){const u=t.x<n.x?-1:1,l=t.y<n.y?1:-1;return`L ${i+o*u},${s}Q ${i},${s} ${i},${s+o*l}`}const a=t.x<n.x?1:-1,c=t.y<n.y?-1:1;return`L ${i},${s+o*c}Q ${i},${s} ${i+o*a},${s}`}function Ln({sourceX:t,sourceY:e,sourcePosition:n=q.Bottom,targetX:r,targetY:o,targetPosition:i=q.Top,borderRadius:s=5,centerX:a,centerY:c,offset:u=20,stepPosition:l=.5}){const[f,d,h,g,v]=hf({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:c},offset:u,stepPosition:l});let x=`M${f[0].x} ${f[0].y}`;for(let m=1;m<f.length-1;m++)x+=gf(f[m-1],f[m],f[m+1],s);return x+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[x,d,h,g,v]}function Rr(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function pf(t){var f;const{sourceNode:e,targetNode:n}=t;if(!Rr(e)||!Rr(n))return null;const r=e.internals.handleBounds||Vr(e.handles),o=n.internals.handleBounds||Vr(n.handles),i=Br((r==null?void 0:r.source)??[],t.sourceHandle),s=Br(t.connectionMode===Jt.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),t.targetHandle);if(!i||!s)return(f=t.onError)==null||f.call(t,"008",mt.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=(i==null?void 0:i.position)||q.Bottom,c=(s==null?void 0:s.position)||q.Top,u=Yt(e,i,a),l=Yt(n,s,c);return{sourceX:u.x,sourceY:u.y,targetX:l.x,targetY:l.y,sourcePosition:a,targetPosition:c}}function Vr(t){if(!t)return null;const e=[],n=[];for(const r of t)r.width=r.width??1,r.height=r.height??1,r.type==="source"?e.push(r):r.type==="target"&&n.push(r);return{source:e,target:n}}function Yt(t,e,n=q.Left,r=!1){const o=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,i=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:s,height:a}=e??Et(t);if(r)return{x:o+s/2,y:i+a/2};switch((e==null?void 0:e.position)??n){case q.Top:return{x:o+s/2,y:i};case q.Right:return{x:o+s,y:i+a/2};case q.Bottom:return{x:o+s/2,y:i+a};case q.Left:return{x:o,y:i+a/2}}}function Br(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function Hn(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`:""}function mf(t,{id:e,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return t.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const u=Hn(c,e);i.has(u)||(s.push({id:u,color:c.color||n,...c}),i.add(u))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const gi=1e3,yf=10,Jn={nodeOrigin:[0,0],nodeExtent:pe,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},xf={...Jn,checkEquality:!0};function tr(t,e){const n={...t};for(const r in e)e[r]!==void 0&&(n[r]=e[r]);return n}function wf(t,e,n){const r=tr(Jn,n);for(const o of t.values())if(o.parentId)nr(o,t,e,r);else{const i=_e(o,r.nodeOrigin),s=Xt(o.extent)?o.extent:r.nodeExtent,a=jt(i,s,Et(o));o.internals.positionAbsolute=a}}function vf(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],r=[];for(const o of t.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:t.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 er(t){return t==="manual"}function Rn(t,e,n,r={}){var l,f;const o=tr(xf,r),i={i:0},s=new Map(e),a=o!=null&&o.elevateNodesOnSelect&&!er(o.zIndexMode)?gi:0;let c=t.length>0,u=!1;e.clear(),n.clear();for(const d of t){let h=s.get(d.id);if(o.checkEquality&&d===(h==null?void 0:h.internals.userNode))e.set(d.id,h);else{const g=_e(d,o.nodeOrigin),v=Xt(d.extent)?d.extent:o.nodeExtent,x=jt(g,v,Et(d));h={...o.defaults,...d,measured:{width:(l=d.measured)==null?void 0:l.width,height:(f=d.measured)==null?void 0:f.height},internals:{positionAbsolute:x,handleBounds:vf(d,h),z:pi(d,a,o.zIndexMode),userNode:d}},e.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),d.parentId&&nr(h,e,n,r,i),u||(u=d.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function bf(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function nr(t,e,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=tr(Jn,r),u=t.parentId,l=e.get(u);if(!l){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bf(t,n),o&&!l.parentId&&l.internals.rootParentIndex===void 0&&c==="auto"&&(l.internals.rootParentIndex=++o.i,l.internals.z=l.internals.z+o.i*yf),o&&l.internals.rootParentIndex!==void 0&&(o.i=l.internals.rootParentIndex);const f=i&&!er(c)?gi:0,{x:d,y:h,z:g}=_f(t,l,s,a,f,c),{positionAbsolute:v}=t.internals,x=d!==v.x||h!==v.y;(x||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:x?{x:d,y:h}:v,z:g}})}function pi(t,e,n){const r=gt(t.zIndex)?t.zIndex:0;return er(n)?r:r+(t.selected?e:0)}function _f(t,e,n,r,o,i){const{x:s,y:a}=e.internals.positionAbsolute,c=Et(t),u=_e(t,n),l=Xt(t.extent)?jt(u,t.extent,c):u;let f=jt({x:s+l.x,y:a+l.y},r,c);t.extent==="parent"&&(f=ei(f,c,e));const d=pi(t,o,i),h=e.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function rr(t,e,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of t){const c=e.get(a.parentId);if(!c)continue;const u=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??ye(c),l=ni(u,a.rect);i.set(a.parentId,{expandedRect:l,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},u)=>{var p;const l=c.internals.positionAbsolute,f=Et(c),d=c.origin??r,h=a.x<l.x?Math.round(Math.abs(l.x-a.x)):0,g=a.y<l.y?Math.round(Math.abs(l.y-a.y)):0,v=Math.max(f.width,Math.round(a.width)),x=Math.max(f.height,Math.round(a.height)),m=(v-f.width)*d[0],b=(x-f.height)*d[1];(h>0||g>0||m||b)&&(o.push({id:u,type:"position",position:{x:c.position.x-h+m,y:c.position.y-g+b}}),(p=n.get(u))==null||p.forEach(w=>{t.some(S=>S.id===w.id)||o.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+g}})})),(f.width<a.width||f.height<a.height||h||g)&&o.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:v+(h?d[0]*h-m:0),height:x+(g?d[1]*g-b:0)}})}),o}function Ef(t,e,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 u=[],l=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(l.transform),d=[];for(const h of t.values()){const g=e.get(h.id);if(!g)continue;if(g.hidden){e.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const v=Qn(h.nodeElement),x=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(x||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Xt(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;if(g.parentId&&g.extent==="parent"){const E=e.get(g.parentId);E&&(w=ei(w,v,E))}else p&&(w=jt(w,p,v));const S={...g,measured:v,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:zr("source",h.nodeElement,b,f,g.id),target:zr("target",h.nodeElement,b,f,g.id)}}};e.set(g.id,S),g.parentId&&nr(S,e,n,{nodeOrigin:o,zIndexMode:s}),c=!0,x&&(u.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:ye(S,o)}))}}if(d.length>0){const h=rr(d,e,n,o);u.push(...h)}return{changes:u,updatedInternals:c}}async function Sf({delta:t,panZoom:e,transform:n,translateExtent:r,width:o,height:i}){if(!e||!t.x&&!t.y)return!1;const s=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[o,i]],r);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Fr(t,e,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,e)),s=`${o}-${t}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,e)),i){s=`${o}-${t}-${i}`;const u=r.get(s)||new Map;r.set(s,u.set(n,e))}}function mi(t,e,n){t.clear(),e.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},u=`${o}-${s}--${i}-${a}`,l=`${i}-${a}--${o}-${s}`;Fr("source",c,l,t,o,s),Fr("target",c,u,t,i,a),e.set(r.id,r)}}function yi(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:yi(n,e):!1}function Or(t,e,n){var o;let r=t;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,e))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Nf(t,e,n,r){const o=new Map;for(const[i,s]of t)if((s.selected||s.id===r)&&(!s.parentId||!yi(s,t))&&(s.draggable||e&&typeof s.draggable>"u")){const a=t.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 bn({nodeId:t,dragItems:e,nodeLookup:n,dragging:r=!0}){var s,a,c;const o=[];for(const[u,l]of e){const f=(s=n.get(u))==null?void 0:s.internals.userNode;f&&o.push({...f,position:l.position,dragging:r})}if(!t)return[o[0],o];const i=(a=n.get(t))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=e.get(t))==null?void 0:c.position)||i.position,dragging:r}:o[0],o]}function Mf({dragItems:t,snapGrid:e,x:n,y:r}){const o=t.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=Se(i,e);return{x:s.x-i.x,y:s.y-i.y}}function Cf({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,c=!1,u={x:0,y:0},l=null,f=!1,d=null,h=!1,g=!1,v=null;function x({noDragClassName:b,handleSelector:p,domNode:w,isSelectable:S,nodeId:E,nodeClickDistance:k=0}){d=ct(w);function $({x:B,y:D}){const{nodeLookup:y,nodeExtent:N,snapGrid:_,snapToGrid:C,nodeOrigin:P,onNodeDrag:M,onSelectionDrag:R,onError:V,updateNodePositions:H}=e();i={x:B,y:D};let j=!1;const X=a.size>1,G=X&&N?Dn(Ee(a)):null,Q=X&&C?Mf({dragItems:a,snapGrid:_,x:B,y:D}):null;for(const[K,L]of a){if(!y.has(K))continue;let O={x:B-L.distance.x,y:D-L.distance.y};C&&(O=Q?{x:Math.round(O.x+Q.x),y:Math.round(O.y+Q.y)}:Se(O,_));let U=null;if(X&&N&&!L.extent&&G){const{positionAbsolute:Y}=L.internals,J=Y.x-G.x+N[0][0],et=Y.x+L.measured.width-G.x2+N[1][0],nt=Y.y-G.y+N[0][1],it=Y.y+L.measured.height-G.y2+N[1][1];U=[[J,nt],[et,it]]}const{position:Z,positionAbsolute:W}=ti({nodeId:K,nextPosition:O,nodeLookup:y,nodeExtent:U||N,nodeOrigin:P,onError:V});j=j||L.position.x!==Z.x||L.position.y!==Z.y,L.position=Z,L.internals.positionAbsolute=W}if(g=g||j,!!j&&(H(a,!0),v&&(r||M||!E&&R))){const[K,L]=bn({nodeId:E,dragItems:a,nodeLookup:y});r==null||r(v,a,K,L),M==null||M(v,K,L),E||R==null||R(v,L)}}async function I(){if(!l)return;const{transform:B,panBy:D,autoPanSpeed:y,autoPanOnNodeDrag:N}=e();if(!N){c=!1,cancelAnimationFrame(s);return}const[_,C]=Zn(u,l,y);(_!==0||C!==0)&&(i.x=(i.x??0)-_/B[2],i.y=(i.y??0)-C/B[2],await D({x:_,y:C})&&$(i)),s=requestAnimationFrame(I)}function F(B){var X;const{nodeLookup:D,multiSelectionActive:y,nodesDraggable:N,transform:_,snapGrid:C,snapToGrid:P,selectNodesOnDrag:M,onNodeDragStart:R,onSelectionDragStart:V,unselectNodesAndEdges:H}=e();f=!0,(!M||!S)&&!y&&E&&((X=D.get(E))!=null&&X.selected||H()),S&&M&&E&&(t==null||t(E));const j=le(B.sourceEvent,{transform:_,snapGrid:C,snapToGrid:P,containerBounds:l});if(i=j,a=Nf(D,N,j,E),a.size>0&&(n||R||!E&&V)){const[G,Q]=bn({nodeId:E,dragItems:a,nodeLookup:D});n==null||n(B.sourceEvent,a,G,Q),R==null||R(B.sourceEvent,G,Q),E||V==null||V(B.sourceEvent,Q)}}const z=To().clickDistance(k).on("start",B=>{const{domNode:D,nodeDragThreshold:y,transform:N,snapGrid:_,snapToGrid:C}=e();l=(D==null?void 0:D.getBoundingClientRect())||null,h=!1,g=!1,v=B.sourceEvent,y===0&&F(B),i=le(B.sourceEvent,{transform:N,snapGrid:_,snapToGrid:C,containerBounds:l}),u=pt(B.sourceEvent,l)}).on("drag",B=>{const{autoPanOnNodeDrag:D,transform:y,snapGrid:N,snapToGrid:_,nodeDragThreshold:C,nodeLookup:P}=e(),M=le(B.sourceEvent,{transform:y,snapGrid:N,snapToGrid:_,containerBounds:l});if(v=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||E&&!P.has(E))&&(h=!0),!h){if(!c&&D&&f&&(c=!0,I()),!f){const R=pt(B.sourceEvent,l),V=R.x-u.x,H=R.y-u.y;Math.sqrt(V*V+H*H)>C&&F(B)}(i.x!==M.xSnapped||i.y!==M.ySnapped)&&a&&f&&(u=pt(B.sourceEvent,l),$(M))}}).on("end",B=>{if(!f||h){h&&a.size>0&&e().updateNodePositions(a,!1);return}if(c=!1,f=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:D,updateNodePositions:y,onNodeDragStop:N,onSelectionDragStop:_}=e();if(g&&(y(a,!1),g=!1),o||N||!E&&_){const[C,P]=bn({nodeId:E,dragItems:a,nodeLookup:D,dragging:!1});o==null||o(B.sourceEvent,a,C,P),N==null||N(B.sourceEvent,C,P),E||_==null||_(B.sourceEvent,P)}}}).filter(B=>{const D=B.target;return!B.button&&(!b||!Or(D,`.${b}`,w))&&(!p||Or(D,p,w))});d.call(z)}function m(){d==null||d.on(".drag",null)}return{update:x,destroy:m}}function kf(t,e,n){const r=[],o={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())Ue(o,ye(i))>0&&r.push(i);return r}const Af=250;function $f(t,e,n,r){var a,c;let o=[],i=1/0;const s=kf(t,n,e+Af);for(const u of s){const l=[...((a=u.internals.handleBounds)==null?void 0:a.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of l){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:d,y:h}=Yt(u,f,f.position,!0),g=Math.sqrt(Math.pow(d-t.x,2)+Math.pow(h-t.y,2));g>e||(g<i?(o=[{...f,x:d,y:h}],i=g):g===i&&o.push({...f,x:d,y:h}))}}if(!o.length)return null;if(o.length>1){const u=r.type==="source"?"target":"source";return o.find(l=>l.type===u)??o[0]}return o[0]}function xi(t,e,n,r,o,i=!1){var u,l,f;const s=r.get(t);if(!s)return null;const a=o==="strict"?(u=s.internals.handleBounds)==null?void 0:u[e]:[...((l=s.internals.handleBounds)==null?void 0:l.source)??[],...((f=s.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?a==null?void 0:a.find(d=>d.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Yt(s,c,c.position,!0)}:c}function wi(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function If(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const vi=()=>!0;function Pf(t,{connectionMode:e,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:u,autoPanOnConnect:l,flowId:f,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:x,isValidConnection:m=vi,onReconnectEnd:b,updateConnection:p,getTransform:w,getFromHandle:S,autoPanSpeed:E,dragThreshold:k=1,handleDomNode:$}){const I=ai(t.target);let F=0,z;const{x:B,y:D}=pt(t),y=wi(i,$),N=a==null?void 0:a.getBoundingClientRect();let _=!1;if(!N||!y)return;const C=xi(o,y,r,c,e);if(!C)return;let P=pt(t,N),M=!1,R=null,V=!1,H=null;function j(){if(!l||!N)return;const[Z,W]=Zn(P,N,E);d({x:Z,y:W}),F=requestAnimationFrame(j)}const X={...C,nodeId:o,type:y,position:C.position},G=c.get(o);let K={inProgress:!0,isValid:null,from:Yt(G,X,q.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:G,to:P,toHandle:null,toPosition:$r[X.position],toNode:null,pointer:P};function L(){_=!0,p(K),g==null||g(t,{nodeId:o,handleId:r,handleType:y})}k===0&&L();function O(Z){if(!_){const{x:it,y:lt}=pt(Z),xt=it-B,wt=lt-D;if(!(xt*xt+wt*wt>k*k))return;L()}if(!S()||!X){U(Z);return}const W=w();P=pt(Z,N),z=$f(Ne(P,W,!1,[1,1]),n,c,X),M||(j(),M=!0);const Y=bi(Z,{handle:z,connectionMode:e,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:m,doc:I,lib:u,flowId:f,nodeLookup:c});H=Y.handleDomNode,R=Y.connection,V=If(!!z,Y.isValid);const J=c.get(o),et=J?Yt(J,X,q.Left,!0):K.from,nt={...K,from:et,isValid:V,to:Y.toHandle&&V?ee({x:Y.toHandle.x,y:Y.toHandle.y},W):P,toHandle:Y.toHandle,toPosition:V&&Y.toHandle?Y.toHandle.position:$r[X.position],toNode:Y.toHandle?c.get(Y.toHandle.nodeId):null,pointer:P};p(nt),K=nt}function U(Z){if(!("touches"in Z&&Z.touches.length>0)){if(_){(z||H)&&R&&V&&(v==null||v(R));const{inProgress:W,...Y}=K,J={...Y,toPosition:K.toHandle?K.toPosition:null};x==null||x(Z,J),i&&(b==null||b(Z,J))}h(),cancelAnimationFrame(F),M=!1,V=!1,R=null,H=null,I.removeEventListener("mousemove",O),I.removeEventListener("mouseup",U),I.removeEventListener("touchmove",O),I.removeEventListener("touchend",U)}}I.addEventListener("mousemove",O),I.addEventListener("mouseup",U),I.addEventListener("touchmove",O),I.addEventListener("touchend",U)}function bi(t,{handle:e,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:u=vi,nodeLookup:l}){const f=i==="target",d=e?s.querySelector(`.${a}-flow__handle[data-id="${c}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:h,y:g}=pt(t),v=s.elementFromPoint(h,g),x=v!=null&&v.classList.contains(`${a}-flow__handle`)?v:d,m={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const b=wi(void 0,x),p=x.getAttribute("data-nodeid"),w=x.getAttribute("data-handleid"),S=x.classList.contains("connectable"),E=x.classList.contains("connectableend");if(!p||!b)return m;const k={source:f?p:r,sourceHandle:f?w:o,target:f?r:p,targetHandle:f?o:w};m.connection=k;const I=S&&E&&(n===Jt.Strict?f&&b==="source"||!f&&b==="target":p!==r||w!==o);m.isValid=I&&u(k),m.toHandle=xi(p,b,w,l,n,!0)}return m}const Vn={onPointerDown:Pf,isValid:bi};function Tf({domNode:t,panZoom:e,getTransform:n,getViewScale:r}){const o=ct(t);function i({translateExtent:a,width:c,height:u,zoomStep:l=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!e)return;const w=n(),S=p.sourceEvent.ctrlKey&&xe()?10:1,E=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*l,k=w[2]*Math.pow(2,E*S);e.scaleTo(k)};let v=[0,0];const x=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(v=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!e)return;const S=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],E=[S[0]-v[0],S[1]-v[1]];v=S;const k=r()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),$={x:w[0]-E[0]*k,y:w[1]-E[1]*k},I=[[0,0],[c,u]];e.setViewportConstrained({x:$.x,y:$.y,zoom:w[2]},I,a)},b=Go().on("start",x).on("zoom",f?m:null).on("zoom.wheel",d?g:null);o.call(b,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:dt}}const cn=t=>({x:t.x,y:t.y,zoom:t.k}),_n=({x:t,y:e,zoom:n})=>on.translate(t,e).scale(n),qt=(t,e)=>t.target.closest(`.${e}`),_i=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),zf=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,En=(t,e=0,n=zf,r=()=>{})=>{const o=typeof e=="number"&&e>0;return o||r(),o?t.transition().duration(e).ease(n).on("end",r):t},Ei=t=>{const e=t.ctrlKey&&xe()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function Df({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:u}){return l=>{if(qt(l,e))return l.ctrlKey&&l.preventDefault(),!1;l.preventDefault(),l.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(l.ctrlKey&&s){const x=dt(l),m=Ei(l),b=f*Math.pow(2,m);r.scaleTo(n,b,x,l);return}const d=l.deltaMode===1?20:1;let h=o===Bt.Vertical?0:l.deltaX*d,g=o===Bt.Horizontal?0:l.deltaY*d;!xe()&&l.shiftKey&&o!==Bt.Vertical&&(h=l.deltaY*d,g=0),r.translateBy(n,-(h/f)*i,-(g/f)*i,{internal:!0});const v=cn(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?c==null||c(l,v):(t.isPanScrolling=!0,a==null||a(l,v)),t.panScrollTimeout=setTimeout(()=>{u==null||u(l,v),t.isPanScrolling=!1},150)}}function Lf({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!e&&i&&!r.ctrlKey,a=qt(r,t);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function Hf({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=cn(r.transform);t.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),n&&(n==null||n(r.sourceEvent,o))}}function Rf({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;t.usedRightMouseButton=!!(n&&_i(e,t.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,cn(i.transform)))}}function Vf({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(t.isZoomingOrPanning=!1,i&&_i(e,t.mouseButton??0)&&!t.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),t.usedRightMouseButton=!1,r(!1),o)){const c=cn(s.transform);t.prevViewport=c,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,c)},n?150:0)}}}function Bf({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:u,connectionInProgress:l}){return f=>{var x;const d=t||e,h=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(qt(f,`${u}-flow__node`)||qt(f,`${u}-flow__edge`)))return!0;if(!r&&!d&&!o&&!i&&!n||s||l&&!g||qt(f,a)&&g||qt(f,c)&&(!g||o&&g&&!t)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&((x=f.touches)==null?void 0:x.length)>1)return f.preventDefault(),!1;if(!d&&!o&&!h&&g||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const v=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&v}}function Ff({domNode:t,minZoom:e,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},l=t.getBoundingClientRect();let f=[[0,0],[l.width,l.height]];const d=typeof ResizeObserver<"u"?new ResizeObserver(D=>{const y=D[0];y&&(f=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null;d==null||d.observe(t);const h=Go().extent(()=>f).scaleExtent([e,n]).translateExtent(r),g=ct(t).call(h);w({x:o.x,y:o.y,zoom:te(o.zoom,e,n)},[[0,0],[l.width,l.height]],r);const v=g.on("wheel.zoom"),x=g.on("dblclick.zoom");h.wheelDelta(Ei);async function m(D,y){return g?new Promise(N=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?ue:He).transform(En(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>N(!0)),D)}):!1}function b({noWheelClassName:D,noPanClassName:y,onPaneContextMenu:N,userSelectionActive:_,panOnScroll:C,panOnDrag:P,panOnScrollMode:M,panOnScrollSpeed:R,preventScrolling:V,zoomOnPinch:H,zoomOnScroll:j,zoomOnDoubleClick:X,zoomActivationKeyPressed:G,lib:Q,onTransformChange:K,connectionInProgress:L,paneClickDistance:O,selectionOnDrag:U}){_&&!u.isZoomingOrPanning&&p();const Z=C&&!G&&!_;h.clickDistance(U?1/0:!gt(O)||O<0?0:O);const W=Z?Df({zoomPanValues:u,noWheelClassName:D,d3Selection:g,d3Zoom:h,panOnScrollMode:M,panOnScrollSpeed:R,zoomOnPinch:H,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Lf({noWheelClassName:D,preventScrolling:V,d3ZoomHandler:v});g.on("wheel.zoom",W,{passive:!1});const Y=Hf({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:s});h.on("start",Y);const J=Rf({zoomPanValues:u,panOnDrag:P,onPaneContextMenu:!!N,onPanZoom:i,onTransformChange:K});h.on("zoom",J);const et=Vf({zoomPanValues:u,panOnDrag:P,panOnScroll:C,onPaneContextMenu:N,onPanZoomEnd:a,onDraggingChange:c});h.on("end",et);const nt=Bf({zoomActivationKeyPressed:G,panOnDrag:P,zoomOnScroll:j,panOnScroll:C,zoomOnDoubleClick:X,zoomOnPinch:H,userSelectionActive:_,noPanClassName:y,noWheelClassName:D,lib:Q,connectionInProgress:L});h.filter(nt),X?g.on("dblclick.zoom",x):g.on("dblclick.zoom",null)}function p(){h.on("zoom",null)}async function w(D,y,N){const _=_n(D),C=h==null?void 0:h.constrain()(_,y,N);return C&&await m(C),C}async function S(D,y){const N=_n(D);return await m(N,y),N}function E(D){if(g){const y=_n(D),N=g.property("__zoom");(N.k!==D.zoom||N.x!==D.x||N.y!==D.y)&&(h==null||h.transform(g,y,null,{sync:!0}))}}function k(){const D=g?qo(g.node()):{x:0,y:0,k:1};return{x:D.x,y:D.y,zoom:D.k}}async function $(D,y){return g?new Promise(N=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?ue:He).scaleTo(En(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>N(!0)),D)}):!1}async function I(D,y){return g?new Promise(N=>{h==null||h.interpolate((y==null?void 0:y.interpolate)==="linear"?ue:He).scaleBy(En(g,y==null?void 0:y.duration,y==null?void 0:y.ease,()=>N(!0)),D)}):!1}function F(D){h==null||h.scaleExtent(D)}function z(D){h==null||h.translateExtent(D)}function B(D){const y=!gt(D)||D<0?0:D;h==null||h.clickDistance(y)}return{update:b,destroy:p,setViewport:S,setViewportConstrained:w,getViewport:k,scaleTo:$,scaleBy:I,setScaleExtent:F,setTranslateExtent:z,syncViewport:E,setClickDistance:B}}var ne;(function(t){t.Line="line",t.Handle="handle"})(ne||(ne={}));function Of({width:t,prevWidth:e,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=t-e,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 jr(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),r=t.includes("left"),o=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:r,affectsY:o}}function $t(t,e){return Math.max(0,e-t)}function It(t,e){return Math.max(0,t-e)}function Te(t,e,n){return Math.max(0,e-t,t-n)}function Xr(t,e){return t?!e:e}function jf(t,e,n,r,o,i,s,a){let{affectsX:c,affectsY:u}=e;const{isHorizontal:l,isVertical:f}=e,d=l&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:x,minHeight:m,maxHeight:b}=r,{x:p,y:w,width:S,height:E,aspectRatio:k}=t;let $=Math.floor(l?h-t.pointerX:0),I=Math.floor(f?g-t.pointerY:0);const F=S+(c?-$:$),z=E+(u?-I:I),B=-i[0]*S,D=-i[1]*E;let y=Te(F,v,x),N=Te(z,m,b);if(s){let P=0,M=0;c&&$<0?P=$t(p+$+B,s[0][0]):!c&&$>0&&(P=It(p+F+B,s[1][0])),u&&I<0?M=$t(w+I+D,s[0][1]):!u&&I>0&&(M=It(w+z+D,s[1][1])),y=Math.max(y,P),N=Math.max(N,M)}if(a){let P=0,M=0;c&&$>0?P=It(p+$,a[0][0]):!c&&$<0&&(P=$t(p+F,a[1][0])),u&&I>0?M=It(w+I,a[0][1]):!u&&I<0&&(M=$t(w+z,a[1][1])),y=Math.max(y,P),N=Math.max(N,M)}if(o){if(l){const P=Te(F/k,m,b)*k;if(y=Math.max(y,P),s){let M=0;!c&&!u||c&&!u&&d?M=It(w+D+F/k,s[1][1])*k:M=$t(w+D+(c?$:-$)/k,s[0][1])*k,y=Math.max(y,M)}if(a){let M=0;!c&&!u||c&&!u&&d?M=$t(w+F/k,a[1][1])*k:M=It(w+(c?$:-$)/k,a[0][1])*k,y=Math.max(y,M)}}if(f){const P=Te(z*k,v,x)/k;if(N=Math.max(N,P),s){let M=0;!c&&!u||u&&!c&&d?M=It(p+z*k+B,s[1][0])/k:M=$t(p+(u?I:-I)*k+B,s[0][0])/k,N=Math.max(N,M)}if(a){let M=0;!c&&!u||u&&!c&&d?M=$t(p+z*k,a[1][0])/k:M=It(p+(u?I:-I)*k,a[0][0])/k,N=Math.max(N,M)}}}I=I+(I<0?N:-N),$=$+($<0?y:-y),o&&(d?F>z*k?I=(Xr(c,u)?-$:$)/k:$=(Xr(c,u)?-I:I)*k:l?(I=$/k,u=c):($=I*k,c=u));const _=c?p+$:p,C=u?w+I:w;return{width:S+(c?-$:$),height:E+(u?-I:I),x:i[0]*$*(c?-1:1)+_,y:i[1]*I*(u?-1:1)+C}}const Si={width:0,height:0,x:0,y:0},Xf={...Si,pointerX:0,pointerY:0,aspectRatio:1};function Yf(t,e,n){const r=e.position.x+t.position.x,o=e.position.y+t.position.y,i=t.measured.width??0,s=t.measured.height??0,a=n[0]*i,c=n[1]*s;return[[r-a,o-c],[r+i-a,o+s-c]]}function Wf({domNode:t,nodeId:e,getStoreItems:n,onChange:r,onEnd:o}){const i=ct(t);let s={controlDirection:jr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:u,boundaries:l,keepAspectRatio:f,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:x}){let m={...Si},b={...Xf};s={boundaries:l,resizeDirection:d,keepAspectRatio:f,controlDirection:jr(u)};let p,w=null,S=[],E,k,$,I=!1;const F=To().on("start",z=>{const{nodeLookup:B,transform:D,snapGrid:y,snapToGrid:N,nodeOrigin:_,paneDomNode:C}=n();if(p=B.get(e),!p)return;w=(C==null?void 0:C.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:M}=le(z.sourceEvent,{transform:D,snapGrid:y,snapToGrid:N,containerBounds:w});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...m,pointerX:P,pointerY:M,aspectRatio:m.width/m.height},E=void 0,k=Xt(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(E=B.get(p.parentId)),E&&p.extent==="parent"&&(k=[[0,0],[E.measured.width,E.measured.height]]),S=[],$=void 0;for(const[R,V]of B)if(V.parentId===e&&(S.push({id:R,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const H=Yf(V,p,V.origin??_);$?$=[[Math.min(H[0][0],$[0][0]),Math.min(H[0][1],$[0][1])],[Math.max(H[1][0],$[1][0]),Math.max(H[1][1],$[1][1])]]:$=H}h==null||h(z,{...m})}).on("drag",z=>{const{transform:B,snapGrid:D,snapToGrid:y,nodeOrigin:N}=n(),_=le(z.sourceEvent,{transform:B,snapGrid:D,snapToGrid:y,containerBounds:w}),C=[];if(!p)return;const{x:P,y:M,width:R,height:V}=m,H={},j=p.origin??N,{width:X,height:G,x:Q,y:K}=jf(b,s.controlDirection,_,s.boundaries,s.keepAspectRatio,j,k,$),L=X!==R,O=G!==V,U=Q!==P&&L,Z=K!==M&&O;if(!U&&!Z&&!L&&!O)return;if((U||Z||j[0]===1||j[1]===1)&&(H.x=U?Q:m.x,H.y=Z?K:m.y,m.x=H.x,m.y=H.y,S.length>0)){const et=Q-P,nt=K-M;for(const it of S)it.position={x:it.position.x-et+j[0]*(X-R),y:it.position.y-nt+j[1]*(G-V)},C.push(it)}if((L||O)&&(H.width=L&&(!s.resizeDirection||s.resizeDirection==="horizontal")?X:m.width,H.height=O&&(!s.resizeDirection||s.resizeDirection==="vertical")?G:m.height,m.width=H.width,m.height=H.height),E&&p.expandParent){const et=j[0]*(H.width??0);H.x&&H.x<et&&(m.x=et,b.x=b.x-(H.x-et));const nt=j[1]*(H.height??0);H.y&&H.y<nt&&(m.y=nt,b.y=b.y-(H.y-nt))}const W=Of({width:m.width,prevWidth:R,height:m.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),Y={...m,direction:W};(x==null?void 0:x(z,Y))!==!1&&(I=!0,g==null||g(z,Y),r(H,C))}).on("end",z=>{I&&(v==null||v(z,{...m}),o==null||o({...m}),I=!1)});i.call(F)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var Ni={exports:{}},Mi={},Ci={exports:{}},ki={};/**
2
2
  * @license React
3
3
  * use-sync-external-store-shim.production.js
4
4
  *