remote-codex 0.11.8 → 0.11.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/relay-server/dist/index.js +93 -10
- package/apps/supervisor-api/dist/{chunk-ELPP22TZ.js → chunk-HMFJNQDI.js} +11 -4
- package/apps/supervisor-api/dist/index.js +1 -1
- package/apps/supervisor-api/dist/worker-index.js +1 -1
- package/apps/supervisor-web/dist/assets/{core-DIQen2lE.js → core-oEok_Crl.js} +1 -1
- package/apps/supervisor-web/dist/assets/{graph-vendor-CGzY-MFv.js → graph-vendor-DVPtkh3h.js} +1 -1
- package/apps/supervisor-web/dist/assets/index-Cp9GkemI.css +1 -0
- package/apps/supervisor-web/dist/assets/index-M5xKhovw.js +5 -0
- package/apps/supervisor-web/dist/assets/{markdown-vendor-hBDTCSB-.js → markdown-vendor-BQJfKm05.js} +1 -1
- package/apps/supervisor-web/dist/assets/{react-vendor-o1Xrx7m4.js → react-vendor-CgLzZcV4.js} +1 -1
- package/apps/supervisor-web/dist/assets/{terminal-vendor-CLGgN91S.js → terminal-vendor-B365Go3Z.js} +1 -1
- package/apps/supervisor-web/dist/assets/thread-ui-DldLSgqC.js +3604 -0
- package/apps/supervisor-web/dist/assets/ui-vendor-CeKGesq3.js +50 -0
- package/apps/supervisor-web/dist/index.html +8 -8
- package/bin/remote-codex.mjs +255 -40
- package/package.json +2 -2
- package/packages/shared/src/index.ts +1 -0
- package/apps/supervisor-api/dist/chunk-ZWZQVPDT.js +0 -27893
- package/apps/supervisor-web/dist/assets/index-CXq73NcP.js +0 -5
- package/apps/supervisor-web/dist/assets/index-Di1JBevU.css +0 -1
- package/apps/supervisor-web/dist/assets/thread-ui-ICfwCbte.js +0 -3604
- package/apps/supervisor-web/dist/assets/ui-vendor-D1uxdi-d.js +0 -430
package/apps/supervisor-web/dist/assets/{graph-vendor-CGzY-MFv.js → graph-vendor-DVPtkh3h.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as wo,g as la,c as fa,r as D,j as P}from"./react-vendor-o1Xrx7m4.js";function se(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=se(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var da={value:()=>{}};function Qt(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Lt(n)}function Lt(e){this._=e}function ha(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Lt.prototype=Qt.prototype={constructor:Lt,on:function(e,t){var n=this._,r=ha(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=ga(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=dr(n[o],e.name,t);else if(t==null)for(o in n)n[o]=dr(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Lt(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function ga(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function dr(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=da,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Mn="http://www.w3.org/1999/xhtml";const hr={svg:"http://www.w3.org/2000/svg",xhtml:Mn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Jt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),hr.hasOwnProperty(t)?{space:hr[t],local:e}:e}function pa(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Mn&&t.documentElement.namespaceURI===Mn?t.createElement(e):t.createElementNS(n,e)}}function ma(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function vo(e){var t=Jt(e);return(t.local?ma:pa)(t)}function ya(){}function Bn(e){return e==null?ya:function(){return this.querySelector(e)}}function xa(e){typeof e!="function"&&(e=Bn(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=new Array(s),c,l,d=0;d<s;++d)(c=i[d])&&(l=e.call(c,c.__data__,d,i))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new ue(r,this._parents)}function wa(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function va(){return[]}function bo(e){return e==null?va:function(){return this.querySelectorAll(e)}}function ba(e){return function(){return wa(e.apply(this,arguments))}}function _a(e){typeof e=="function"?e=ba(e):e=bo(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(e.call(c,c.__data__,l,s)),o.push(c));return new ue(r,o)}function _o(e){return function(){return this.matches(e)}}function Eo(e){return function(t){return t.matches(e)}}var Ea=Array.prototype.find;function Sa(e){return function(){return Ea.call(this.children,e)}}function Na(){return this.firstElementChild}function Ma(e){return this.select(e==null?Na:Sa(typeof e=="function"?e:Eo(e)))}var Ca=Array.prototype.filter;function Ia(){return Array.from(this.children)}function Aa(e){return function(){return Ca.call(this.children,e)}}function ka(e){return this.selectAll(e==null?Ia:Aa(typeof e=="function"?e:Eo(e)))}function $a(e){typeof e!="function"&&(e=_o(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new ue(r,this._parents)}function So(e){return new Array(e.length)}function Pa(){return new ue(this._enter||this._groups.map(So),this._parents)}function Ft(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ft.prototype={constructor:Ft,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Ta(e){return function(){return e}}function za(e,t,n,r,o,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):n[s]=new Ft(e,i[s]);for(;s<c;++s)(a=t[s])&&(o[s]=a)}function Da(e,t,n,r,o,i,s){var a,c,l=new Map,d=t.length,u=i.length,f=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?o[a]=c:l.set(h,c));for(a=0;a<u;++a)h=s.call(e,i[a],a,i)+"",(c=l.get(h))?(r[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new Ft(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(f[a])===c&&(o[a]=c)}function La(e){return e.__data__}function Ha(e,t){if(!arguments.length)return Array.from(this,La);var n=t?Da:za,r=this._parents,o=this._groups;typeof e!="function"&&(e=Ta(e));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var d=r[l],u=o[l],f=u.length,h=Ra(e.call(d,d&&d.__data__,l,r)),g=h.length,x=a[l]=new Array(g),y=s[l]=new Array(g),m=c[l]=new Array(f);n(d,u,x,y,m,h,t);for(var b=0,p=0,w,S;b<g;++b)if(w=x[b]){for(b>=p&&(p=b+1);!(S=y[p])&&++p<g;);w._next=S||null}}return s=new ue(s,r),s._enter=a,s._exit=c,s}function Ra(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Va(){return new ue(this._exit||this._groups.map(So),this._parents)}function Ba(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Fa(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var l=n[c],d=r[c],u=l.length,f=a[c]=new Array(u),h,g=0;g<u;++g)(h=l[g]||d[g])&&(f[g]=h);for(;c<o;++c)a[c]=n[c];return new ue(a,this._parents)}function Oa(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function ja(e){e||(e=Xa);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),l,d=0;d<a;++d)(l=s[d])&&(c[d]=l);c.sort(t)}return new ue(o,this._parents).order()}function Xa(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ya(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Wa(){return Array.from(this)}function qa(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function Ga(){let e=0;for(const t of this)++e;return e}function Ua(){return!this.node()}function Ka(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&e.call(a,a.__data__,i,o);return this}function Za(e){return function(){this.removeAttribute(e)}}function Qa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ja(e,t){return function(){this.setAttribute(e,t)}}function ec(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function tc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function nc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function rc(e,t){var n=Jt(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Qa:Za:typeof t=="function"?n.local?nc:tc:n.local?ec:Ja)(n,t))}function No(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function oc(e){return function(){this.style.removeProperty(e)}}function ic(e,t,n){return function(){this.style.setProperty(e,t,n)}}function sc(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function ac(e,t,n){return arguments.length>1?this.each((t==null?oc:typeof t=="function"?sc:ic)(e,t,n??"")):Ze(this.node(),e)}function Ze(e,t){return e.style.getPropertyValue(t)||No(e).getComputedStyle(e,null).getPropertyValue(t)}function cc(e){return function(){delete this[e]}}function uc(e,t){return function(){this[e]=t}}function lc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function fc(e,t){return arguments.length>1?this.each((t==null?cc:typeof t=="function"?lc:uc)(e,t)):this.node()[e]}function Mo(e){return e.trim().split(/^|\s+/)}function Fn(e){return e.classList||new Co(e)}function Co(e){this._node=e,this._names=Mo(e.getAttribute("class")||"")}Co.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Io(e,t){for(var n=Fn(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Ao(e,t){for(var n=Fn(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function dc(e){return function(){Io(this,e)}}function hc(e){return function(){Ao(this,e)}}function gc(e,t){return function(){(t.apply(this,arguments)?Io:Ao)(this,e)}}function pc(e,t){var n=Mo(e+"");if(arguments.length<2){for(var r=Fn(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?gc:t?dc:hc)(n,t))}function mc(){this.textContent=""}function yc(e){return function(){this.textContent=e}}function xc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function wc(e){return arguments.length?this.each(e==null?mc:(typeof e=="function"?xc:yc)(e)):this.node().textContent}function vc(){this.innerHTML=""}function bc(e){return function(){this.innerHTML=e}}function _c(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ec(e){return arguments.length?this.each(e==null?vc:(typeof e=="function"?_c:bc)(e)):this.node().innerHTML}function Sc(){this.nextSibling&&this.parentNode.appendChild(this)}function Nc(){return this.each(Sc)}function Mc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Cc(){return this.each(Mc)}function Ic(e){var t=typeof e=="function"?e:vo(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ac(){return null}function kc(e,t){var n=typeof e=="function"?e:vo(e),r=t==null?Ac:typeof t=="function"?t:Bn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function $c(){var e=this.parentNode;e&&e.removeChild(this)}function Pc(){return this.each($c)}function Tc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Dc(e){return this.select(e?zc:Tc)}function Lc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Hc(e){return function(t){e.call(this,t,this.__data__)}}function Rc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Vc(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function Bc(e,t,n){return function(){var r=this.__on,o,i=Hc(t);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function Fc(e,t,n){var r=Rc(e+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(o=0,d=a[c];o<i;++o)if((s=r[o]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?Bc:Vc,o=0;o<i;++o)this.each(a(r[o],t,n));return this}function ko(e,t,n){var r=No(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Oc(e,t){return function(){return ko(this,e,t)}}function jc(e,t){return function(){return ko(this,e,t.apply(this,arguments))}}function Xc(e,t){return this.each((typeof t=="function"?jc:Oc)(e,t))}function*Yc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var $o=[null];function ue(e,t){this._groups=e,this._parents=t}function bt(){return new ue([[document.documentElement]],$o)}function Wc(){return this}ue.prototype=bt.prototype={constructor:ue,select:xa,selectAll:_a,selectChild:Ma,selectChildren:ka,filter:$a,data:Ha,enter:Pa,exit:Va,join:Ba,merge:Fa,selection:Wc,order:Oa,sort:ja,call:Ya,nodes:Wa,node:qa,size:Ga,empty:Ua,each:Ka,attr:rc,style:ac,property:fc,classed:pc,text:wc,html:Ec,raise:Nc,lower:Cc,append:Ic,insert:kc,remove:Pc,clone:Dc,datum:Lc,on:Fc,dispatch:Xc,[Symbol.iterator]:Yc};function ce(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],$o)}function qc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=qc(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const Gc={passive:!1},dt={capture:!0,passive:!1};function hn(e){e.stopImmediatePropagation()}function Ue(e){e.preventDefault(),e.stopImmediatePropagation()}function Po(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Ue,dt);"onselectstart"in t?n.on("selectstart.drag",Ue,dt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function To(e,t){var n=e.document.documentElement,r=ce(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ue,dt),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 Ct=e=>()=>e;function Cn(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}Cn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Uc(e){return!e.ctrlKey&&!e.button}function Kc(){return this.parentNode}function Zc(e,t){return t??{x:e.x,y:e.y}}function Qc(){return navigator.maxTouchPoints||"ontouchstart"in this}function zo(){var e=Uc,t=Kc,n=Zc,r=Qc,o={},i=Qt("start","drag","end"),s=0,a,c,l,d,u=0;function f(w){w.on("mousedown.drag",h).filter(r).on("touchstart.drag",y).on("touchmove.drag",m,Gc).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(!(d||!e.call(this,w,S))){var _=p(this,t.call(this,w,S),w,S,"mouse");_&&(ce(w.view).on("mousemove.drag",g,dt).on("mouseup.drag",x,dt),Po(w.view),hn(w),l=!1,a=w.clientX,c=w.clientY,_("start",w))}}function g(w){if(Ue(w),!l){var S=w.clientX-a,_=w.clientY-c;l=S*S+_*_>u}o.mouse("drag",w)}function x(w){ce(w.view).on("mousemove.drag mouseup.drag",null),To(w.view,l),Ue(w),o.mouse("end",w)}function y(w,S){if(e.call(this,w,S)){var _=w.changedTouches,I=t.call(this,w,S),k=_.length,T,F;for(T=0;T<k;++T)(F=p(this,I,w,S,_[T].identifier,_[T]))&&(hn(w),F("start",w,_[T]))}}function m(w){var S=w.changedTouches,_=S.length,I,k;for(I=0;I<_;++I)(k=o[S[I].identifier])&&(Ue(w),k("drag",w,S[I]))}function b(w){var S=w.changedTouches,_=S.length,I,k;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),I=0;I<_;++I)(k=o[S[I].identifier])&&(hn(w),k("end",w,S[I]))}function p(w,S,_,I,k,T){var F=i.copy(),N=de(T||_,S),$,B,v;if((v=n.call(w,new Cn("beforestart",{sourceEvent:_,target:f,identifier:k,active:s,x:N[0],y:N[1],dx:0,dy:0,dispatch:F}),I))!=null)return $=v.x-N[0]||0,B=v.y-N[1]||0,function C(E,A,z){var M=N,R;switch(E){case"start":o[k]=C,R=s++;break;case"end":delete o[k],--s;case"drag":N=de(z||A,S),R=s;break}F.call(E,w,new Cn(E,{sourceEvent:A,subject:v,target:f,identifier:k,active:R,x:N[0]+$,y:N[1]+B,dx:N[0]-M[0],dy:N[1]-M[1],dispatch:F}),I)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ct(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:Ct(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Ct(w),f):n},f.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:Ct(!!w),f):r},f.on=function(){var w=i.on.apply(i,arguments);return w===i?f:w},f.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,f):Math.sqrt(u)},f}function On(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Do(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function _t(){}var ht=.7,Ot=1/ht,Ke="\\s*([+-]?\\d+)\\s*",gt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Jc=/^#([0-9a-f]{3,8})$/,eu=new RegExp(`^rgb\\(${Ke},${Ke},${Ke}\\)$`),tu=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),nu=new RegExp(`^rgba\\(${Ke},${Ke},${Ke},${gt}\\)$`),ru=new RegExp(`^rgba\\(${be},${be},${be},${gt}\\)$`),ou=new RegExp(`^hsl\\(${gt},${be},${be}\\)$`),iu=new RegExp(`^hsla\\(${gt},${be},${be},${gt}\\)$`),gr={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};On(_t,Fe,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:pr,formatHex:pr,formatHex8:su,formatHsl:au,formatRgb:mr,toString:mr});function pr(){return this.rgb().formatHex()}function su(){return this.rgb().formatHex8()}function au(){return Lo(this).formatHsl()}function mr(){return this.rgb().formatRgb()}function Fe(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Jc.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?yr(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?It(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?It(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=eu.exec(e))?new ae(t[1],t[2],t[3],1):(t=tu.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=nu.exec(e))?It(t[1],t[2],t[3],t[4]):(t=ru.exec(e))?It(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ou.exec(e))?vr(t[1],t[2]/100,t[3]/100,1):(t=iu.exec(e))?vr(t[1],t[2]/100,t[3]/100,t[4]):gr.hasOwnProperty(e)?yr(gr[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function yr(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function It(e,t,n,r){return r<=0&&(e=t=n=NaN),new ae(e,t,n,r)}function cu(e){return e instanceof _t||(e=Fe(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function In(e,t,n,r){return arguments.length===1?cu(e):new ae(e,t,n,r??1)}function ae(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}On(ae,In,Do(_t,{brighter(e){return e=e==null?Ot:Math.pow(Ot,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ht:Math.pow(ht,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Ve(this.r),Ve(this.g),Ve(this.b),jt(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:xr,formatHex:xr,formatHex8:uu,formatRgb:wr,toString:wr}));function xr(){return`#${Re(this.r)}${Re(this.g)}${Re(this.b)}`}function uu(){return`#${Re(this.r)}${Re(this.g)}${Re(this.b)}${Re((isNaN(this.opacity)?1:this.opacity)*255)}`}function wr(){const e=jt(this.opacity);return`${e===1?"rgb(":"rgba("}${Ve(this.r)}, ${Ve(this.g)}, ${Ve(this.b)}${e===1?")":`, ${e})`}`}function jt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ve(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Re(e){return e=Ve(e),(e<16?"0":"")+e.toString(16)}function vr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new he(e,t,n,r)}function Lo(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof _t||(e=Fe(e)),!e)return new he;if(e instanceof he)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new he(s,a,c,e.opacity)}function lu(e,t,n,r){return arguments.length===1?Lo(e):new he(e,t,n,r??1)}function he(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}On(he,lu,Do(_t,{brighter(e){return e=e==null?Ot:Math.pow(Ot,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ht:Math.pow(ht,e),new he(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new ae(gn(e>=240?e-240:e+120,o,r),gn(e,o,r),gn(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new he(br(this.h),At(this.s),At(this.l),jt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=jt(this.opacity);return`${e===1?"hsl(":"hsla("}${br(this.h)}, ${At(this.s)*100}%, ${At(this.l)*100}%${e===1?")":`, ${e})`}`}}));function br(e){return e=(e||0)%360,e<0?e+360:e}function At(e){return Math.max(0,Math.min(1,e||0))}function gn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const jn=e=>()=>e;function fu(e,t){return function(n){return e+n*t}}function du(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function hu(e){return(e=+e)==1?Ho:function(t,n){return n-t?du(t,n,e):jn(isNaN(t)?n:t)}}function Ho(e,t){var n=t-e;return n?fu(e,n):jn(isNaN(e)?t:e)}const Xt=(function e(t){var n=hu(t);function r(o,i){var s=n((o=In(o)).r,(i=In(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),l=Ho(o.opacity,i.opacity);return function(d){return o.r=s(d),o.g=a(d),o.b=c(d),o.opacity=l(d),o+""}}return r.gamma=e,r})(1);function gu(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function pu(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function mu(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=lt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function yu(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ve(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function xu(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=lt(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var An=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pn=new RegExp(An.source,"g");function wu(e){return function(){return e}}function vu(e){return function(t){return e(t)+""}}function Ro(e,t){var n=An.lastIndex=pn.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=An.exec(e))&&(o=pn.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:ve(r,o)})),n=pn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?vu(c[0].x):wu(t):(t=c.length,function(l){for(var d=0,u;d<t;++d)a[(u=c[d]).i]=u.x(l);return a.join("")})}function lt(e,t){var n=typeof t,r;return t==null||n==="boolean"?jn(t):(n==="number"?ve:n==="string"?(r=Fe(t))?(t=r,Xt):Ro:t instanceof Fe?Xt:t instanceof Date?yu:pu(t)?gu:Array.isArray(t)?mu:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?xu:ve)(e,t)}var _r=180/Math.PI,kn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vo(e,t,n,r,o,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*_r,skewX:Math.atan(c)*_r,scaleX:s,scaleY:a}}var kt;function bu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?kn:Vo(t.a,t.b,t.c,t.d,t.e,t.f)}function _u(e){return e==null||(kt||(kt=document.createElementNS("http://www.w3.org/2000/svg","g")),kt.setAttribute("transform",e),!(e=kt.transform.baseVal.consolidate()))?kn:(e=e.matrix,Vo(e.a,e.b,e.c,e.d,e.e,e.f))}function Bo(e,t,n,r){function o(l){return l.length?l.pop()+" ":""}function i(l,d,u,f,h,g){if(l!==u||d!==f){var x=h.push("translate(",null,t,null,n);g.push({i:x-4,x:ve(l,u)},{i:x-2,x:ve(d,f)})}else(u||f)&&h.push("translate("+u+t+f+n)}function s(l,d,u,f){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),f.push({i:u.push(o(u)+"rotate(",null,r)-2,x:ve(l,d)})):d&&u.push(o(u)+"rotate("+d+r)}function a(l,d,u,f){l!==d?f.push({i:u.push(o(u)+"skewX(",null,r)-2,x:ve(l,d)}):d&&u.push(o(u)+"skewX("+d+r)}function c(l,d,u,f,h,g){if(l!==u||d!==f){var x=h.push(o(h)+"scale(",null,",",null,")");g.push({i:x-4,x:ve(l,u)},{i:x-2,x:ve(d,f)})}else(u!==1||f!==1)&&h.push(o(h)+"scale("+u+","+f+")")}return function(l,d){var u=[],f=[];return l=e(l),d=e(d),i(l.translateX,l.translateY,d.translateX,d.translateY,u,f),s(l.rotate,d.rotate,u,f),a(l.skewX,d.skewX,u,f),c(l.scaleX,l.scaleY,d.scaleX,d.scaleY,u,f),l=d=null,function(h){for(var g=-1,x=f.length,y;++g<x;)u[(y=f[g]).i]=y.x(h);return u.join("")}}}var Eu=Bo(bu,"px, ","px)","deg)"),Su=Bo(_u,", ",")",")"),Nu=1e-12;function Er(e){return((e=Math.exp(e))+1/e)/2}function Mu(e){return((e=Math.exp(e))-1/e)/2}function Cu(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ht=(function e(t,n,r){function o(i,s){var a=i[0],c=i[1],l=i[2],d=s[0],u=s[1],f=s[2],h=d-a,g=u-c,x=h*h+g*g,y,m;if(x<Nu)m=Math.log(f/l)/t,y=function(I){return[a+I*h,c+I*g,l*Math.exp(t*I*m)]};else{var b=Math.sqrt(x),p=(f*f-l*l+r*x)/(2*l*n*b),w=(f*f-l*l-r*x)/(2*f*n*b),S=Math.log(Math.sqrt(p*p+1)-p),_=Math.log(Math.sqrt(w*w+1)-w);m=(_-S)/t,y=function(I){var k=I*m,T=Er(S),F=l/(n*b)*(T*Cu(t*k+S)-Mu(S));return[a+F*h,c+F*g,l*T/Er(t*k+S)]}}return y.duration=m*1e3*t/Math.SQRT2,y}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},o})(Math.SQRT2,2,4);var Qe=0,ct=0,st=0,Fo=1e3,Yt,ut,Wt=0,Oe=0,en=0,pt=typeof performance=="object"&&performance.now?performance:Date,Oo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xn(){return Oe||(Oo(Iu),Oe=pt.now()+en)}function Iu(){Oe=0}function qt(){this._call=this._time=this._next=null}qt.prototype=jo.prototype={constructor:qt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xn():+n)+(t==null?0:+t),!this._next&&ut!==this&&(ut?ut._next=this:Yt=this,ut=this),this._call=e,this._time=n,$n()},stop:function(){this._call&&(this._call=null,this._time=1/0,$n())}};function jo(e,t,n){var r=new qt;return r.restart(e,t,n),r}function Au(){Xn(),++Qe;for(var e=Yt,t;e;)(t=Oe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Sr(){Oe=(Wt=pt.now())+en,Qe=ct=0;try{Au()}finally{Qe=0,$u(),Oe=0}}function ku(){var e=pt.now(),t=e-Wt;t>Fo&&(en-=t,Wt=e)}function $u(){for(var e,t=Yt,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Yt=n);ut=e,$n(r)}function $n(e){if(!Qe){ct&&(ct=clearTimeout(ct));var t=e-Oe;t>24?(e<1/0&&(ct=setTimeout(Sr,e-pt.now()-en)),st&&(st=clearInterval(st))):(st||(Wt=pt.now(),st=setInterval(ku,Fo)),Qe=1,Oo(Sr))}}function Nr(e,t,n){var r=new qt;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Pu=Qt("start","end","cancel","interrupt"),Tu=[],Xo=0,Mr=1,Pn=2,Rt=3,Cr=4,Tn=5,Vt=6;function tn(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;zu(e,n,{name:t,index:r,group:o,on:Pu,tween:Tu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Xo})}function Yn(e,t){var n=ye(e,t);if(n.state>Xo)throw new Error("too late; already scheduled");return n}function _e(e,t){var n=ye(e,t);if(n.state>Rt)throw new Error("too late; already running");return n}function ye(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function zu(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=jo(i,0,n.time);function i(l){n.state=Mr,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var d,u,f,h;if(n.state!==Mr)return c();for(d in r)if(h=r[d],h.name===n.name){if(h.state===Rt)return Nr(s);h.state===Cr?(h.state=Vt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[d]):+d<t&&(h.state=Vt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[d])}if(Nr(function(){n.state===Rt&&(n.state=Cr,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Pn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Pn){for(n.state=Rt,o=new Array(f=n.tween.length),d=0,u=-1;d<f;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=h);o.length=u+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Tn,1),u=-1,f=o.length;++u<f;)o[u].call(e,d);n.state===Tn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Vt,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function Bt(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>Pn&&r.state<Tn,r.state=Vt,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function Du(e){return this.each(function(){Bt(this,e)})}function Lu(e,t){var n,r;return function(){var o=_e(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function Hu(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=_e(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:t,value:n},c=0,l=o.length;c<l;++c)if(o[c].name===t){o[c]=a;break}c===l&&o.push(a)}i.tween=o}}function Ru(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ye(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?Lu:Hu)(n,e,t))}function Wn(e,t,n){var r=e._id;return e.each(function(){var o=_e(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return ye(o,r).value[t]}}function Yo(e,t){var n;return(typeof t=="number"?ve:t instanceof Fe?Xt:(n=Fe(t))?(t=n,Xt):Ro)(e,t)}function Vu(e){return function(){this.removeAttribute(e)}}function Bu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Fu(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function Ou(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function ju(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Xu(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Yu(e,t){var n=Jt(e),r=n==="transform"?Su:Yo;return this.attrTween(e,typeof t=="function"?(n.local?Xu:ju)(n,r,Wn(this,"attr."+e,t)):t==null?(n.local?Bu:Vu)(n):(n.local?Ou:Fu)(n,r,t))}function Wu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function qu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Gu(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&qu(e,i)),n}return o._value=t,o}function Uu(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Wu(e,i)),n}return o._value=t,o}function Ku(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Jt(e);return this.tween(n,(r.local?Gu:Uu)(r,t))}function Zu(e,t){return function(){Yn(this,e).delay=+t.apply(this,arguments)}}function Qu(e,t){return t=+t,function(){Yn(this,e).delay=t}}function Ju(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Zu:Qu)(t,e)):ye(this.node(),t).delay}function el(e,t){return function(){_e(this,e).duration=+t.apply(this,arguments)}}function tl(e,t){return t=+t,function(){_e(this,e).duration=t}}function nl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?el:tl)(t,e)):ye(this.node(),t).duration}function rl(e,t){if(typeof t!="function")throw new Error;return function(){_e(this,e).ease=t}}function ol(e){var t=this._id;return arguments.length?this.each(rl(t,e)):ye(this.node(),t).ease}function il(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;_e(this,e).ease=n}}function sl(e){if(typeof e!="function")throw new Error;return this.each(il(this._id,e))}function al(e){typeof e!="function"&&(e=_o(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new Ie(r,this._parents,this._name,this._id)}function cl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=t[a],l=n[a],d=c.length,u=s[a]=new Array(d),f,h=0;h<d;++h)(f=c[h]||l[h])&&(u[h]=f);for(;a<r;++a)s[a]=t[a];return new Ie(s,this._parents,this._name,this._id)}function ul(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function ll(e,t,n){var r,o,i=ul(t)?Yn:_e;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function fl(e,t){var n=this._id;return arguments.length<2?ye(this.node(),n).on.on(e):this.each(ll(n,e,t))}function dl(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function hl(){return this.on("end.remove",dl(this._id))}function gl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Bn(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,l=i[s]=new Array(c),d,u,f=0;f<c;++f)(d=a[f])&&(u=e.call(d,d.__data__,f,a))&&("__data__"in d&&(u.__data__=d.__data__),l[f]=u,tn(l[f],t,n,f,l,ye(d,n)));return new Ie(i,this._parents,t,n)}function pl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=bo(e));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],l=c.length,d,u=0;u<l;++u)if(d=c[u]){for(var f=e.call(d,d.__data__,u,c),h,g=ye(d,n),x=0,y=f.length;x<y;++x)(h=f[x])&&tn(h,t,n,x,f,g);i.push(f),s.push(d)}return new Ie(i,s,t,n)}var ml=bt.prototype.constructor;function yl(){return new ml(this._groups,this._parents)}function xl(e,t){var n,r,o;return function(){var i=Ze(this,e),s=(this.style.removeProperty(e),Ze(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function Wo(e){return function(){this.style.removeProperty(e)}}function wl(e,t,n){var r,o=n+"",i;return function(){var s=Ze(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function vl(e,t,n){var r,o,i;return function(){var s=Ze(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ze(this,e))),s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a))}}function bl(e,t){var n,r,o,i="style."+t,s="end."+i,a;return function(){var c=_e(this,e),l=c.on,d=c.value[i]==null?a||(a=Wo(t)):void 0;(l!==n||o!==d)&&(r=(n=l).copy()).on(s,o=d),c.on=r}}function _l(e,t,n){var r=(e+="")=="transform"?Eu:Yo;return t==null?this.styleTween(e,xl(e,r)).on("end.style."+e,Wo(e)):typeof t=="function"?this.styleTween(e,vl(e,r,Wn(this,"style."+e,t))).each(bl(this._id,e)):this.styleTween(e,wl(e,r,t),n).on("end.style."+e,null)}function El(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Sl(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&El(e,s,n)),r}return i._value=t,i}function Nl(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Sl(e,t,n??""))}function Ml(e){return function(){this.textContent=e}}function Cl(e){return function(){var t=e(this);this.textContent=t??""}}function Il(e){return this.tween("text",typeof e=="function"?Cl(Wn(this,"text",e)):Ml(e==null?"":e+""))}function Al(e){return function(t){this.textContent=e.call(this,t)}}function kl(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&Al(o)),t}return r._value=e,r}function $l(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,kl(e))}function Pl(){for(var e=this._name,t=this._id,n=qo(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var d=ye(c,t);tn(c,e,n,l,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ie(r,this._parents,e,n)}function Tl(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var l=_e(this,r),d=l.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),o===0&&i()})}var zl=0;function Ie(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function qo(){return++zl}var Me=bt.prototype;Ie.prototype={constructor:Ie,select:gl,selectAll:pl,selectChild:Me.selectChild,selectChildren:Me.selectChildren,filter:al,merge:cl,selection:yl,transition:Pl,call:Me.call,nodes:Me.nodes,node:Me.node,size:Me.size,empty:Me.empty,each:Me.each,on:fl,attr:Yu,attrTween:Ku,style:_l,styleTween:Nl,text:Il,textTween:$l,remove:hl,tween:Ru,delay:Ju,duration:nl,ease:ol,easeVarying:sl,end:Tl,[Symbol.iterator]:Me[Symbol.iterator]};function Dl(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ll={time:null,delay:0,duration:250,ease:Dl};function Hl(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Rl(e){var t,n;e instanceof Ie?(t=e._id,e=e._name):(t=qo(),(n=Ll).time=Xn(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&tn(c,e,t,l,s,n||Hl(c,t));return new Ie(r,this._parents,e,t)}bt.prototype.interrupt=Du;bt.prototype.transition=Rl;const $t=e=>()=>e;function Vl(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Ce(e,t,n){this.k=e,this.x=t,this.y=n}Ce.prototype={constructor:Ce,scale:function(e){return e===1?this:new Ce(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ce(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var nn=new Ce(1,0,0);Go.prototype=Ce.prototype;function Go(e){for(;!e.__zoom;)if(!(e=e.parentNode))return nn;return e.__zoom}function mn(e){e.stopImmediatePropagation()}function at(e){e.preventDefault(),e.stopImmediatePropagation()}function Bl(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Fl(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ir(){return this.__zoom||nn}function Ol(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function jl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Xl(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Uo(){var e=Bl,t=Fl,n=Xl,r=Ol,o=jl,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Ht,l=Qt("start","zoom","end"),d,u,f,h=500,g=150,x=0,y=10;function m(v){v.property("__zoom",Ir).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",F).filter(o).on("touchstart.zoom",N).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,C,E,A){var z=v.selection?v.selection():v;z.property("__zoom",Ir),v!==z?S(v,C,E,A):z.interrupt().each(function(){_(this,arguments).event(A).start().zoom(null,typeof C=="function"?C.apply(this,arguments):C).end()})},m.scaleBy=function(v,C,E,A){m.scaleTo(v,function(){var z=this.__zoom.k,M=typeof C=="function"?C.apply(this,arguments):C;return z*M},E,A)},m.scaleTo=function(v,C,E,A){m.transform(v,function(){var z=t.apply(this,arguments),M=this.__zoom,R=E==null?w(z):typeof E=="function"?E.apply(this,arguments):E,V=M.invert(R),H=typeof C=="function"?C.apply(this,arguments):C;return n(p(b(M,H),R,V),z,s)},E,A)},m.translateBy=function(v,C,E,A){m.transform(v,function(){return n(this.__zoom.translate(typeof C=="function"?C.apply(this,arguments):C,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,A)},m.translateTo=function(v,C,E,A,z){m.transform(v,function(){var M=t.apply(this,arguments),R=this.__zoom,V=A==null?w(M):typeof A=="function"?A.apply(this,arguments):A;return n(nn.translate(V[0],V[1]).scale(R.k).translate(typeof C=="function"?-C.apply(this,arguments):-C,typeof E=="function"?-E.apply(this,arguments):-E),M,s)},A,z)};function b(v,C){return C=Math.max(i[0],Math.min(i[1],C)),C===v.k?v:new Ce(C,v.x,v.y)}function p(v,C,E){var A=C[0]-E[0]*v.k,z=C[1]-E[1]*v.k;return A===v.x&&z===v.y?v:new Ce(v.k,A,z)}function w(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function S(v,C,E,A){v.on("start.zoom",function(){_(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(A).end()}).tween("zoom",function(){var z=this,M=arguments,R=_(z,M).event(A),V=t.apply(z,M),H=E==null?w(V):typeof E=="function"?E.apply(z,M):E,j=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),X=z.__zoom,U=typeof C=="function"?C.apply(z,M):C,Q=c(X.invert(H).concat(j/X.k),U.invert(H).concat(j/U.k));return function(G){if(G===1)G=U;else{var L=Q(G),O=j/L[2];G=new Ce(O,H[0]-L[0]*O,H[1]-L[1]*O)}R.zoom(null,G)}})}function _(v,C,E){return!E&&v.__zooming||new I(v,C)}function I(v,C){this.that=v,this.args=C,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,C),this.taps=0}I.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,C){return this.mouse&&v!=="mouse"&&(this.mouse[1]=C.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=C.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=C.invert(this.touch1[0])),this.that.__zoom=C,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var C=ce(this.that).datum();l.call(v,this.that,new Vl(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),C)}};function k(v,...C){if(!e.apply(this,arguments))return;var E=_(this,C).event(v),A=this.__zoom,z=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,r.apply(this,arguments)))),M=de(v);if(E.wheel)(E.mouse[0][0]!==M[0]||E.mouse[0][1]!==M[1])&&(E.mouse[1]=A.invert(E.mouse[0]=M)),clearTimeout(E.wheel);else{if(A.k===z)return;E.mouse=[M,A.invert(M)],Bt(this),E.start()}at(v),E.wheel=setTimeout(R,g),E.zoom("mouse",n(p(b(A,z),E.mouse[0],E.mouse[1]),E.extent,s));function R(){E.wheel=null,E.end()}}function T(v,...C){if(f||!e.apply(this,arguments))return;var E=v.currentTarget,A=_(this,C,!0).event(v),z=ce(v.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",j,!0),M=de(v,E),R=v.clientX,V=v.clientY;Po(v.view),mn(v),A.mouse=[M,this.__zoom.invert(M)],Bt(this),A.start();function H(X){if(at(X),!A.moved){var U=X.clientX-R,Q=X.clientY-V;A.moved=U*U+Q*Q>x}A.event(X).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=de(X,E),A.mouse[1]),A.extent,s))}function j(X){z.on("mousemove.zoom mouseup.zoom",null),To(X.view,A.moved),at(X),A.event(X).end()}}function F(v,...C){if(e.apply(this,arguments)){var E=this.__zoom,A=de(v.changedTouches?v.changedTouches[0]:v,this),z=E.invert(A),M=E.k*(v.shiftKey?.5:2),R=n(p(b(E,M),A,z),t.apply(this,C),s);at(v),a>0?ce(this).transition().duration(a).call(S,R,A,v):ce(this).call(m.transform,R,A,v)}}function N(v,...C){if(e.apply(this,arguments)){var E=v.touches,A=E.length,z=_(this,C,v.changedTouches.length===A).event(v),M,R,V,H;for(mn(v),R=0;R<A;++R)V=E[R],H=de(V,this),H=[H,this.__zoom.invert(H),V.identifier],z.touch0?!z.touch1&&z.touch0[2]!==H[2]&&(z.touch1=H,z.taps=0):(z.touch0=H,M=!0,z.taps=1+!!d);d&&(d=clearTimeout(d)),M&&(z.taps<2&&(u=H[0],d=setTimeout(function(){d=null},h)),Bt(this),z.start())}}function $(v,...C){if(this.__zooming){var E=_(this,C).event(v),A=v.changedTouches,z=A.length,M,R,V,H;for(at(v),M=0;M<z;++M)R=A[M],V=de(R,this),E.touch0&&E.touch0[2]===R.identifier?E.touch0[0]=V:E.touch1&&E.touch1[2]===R.identifier&&(E.touch1[0]=V);if(R=E.that.__zoom,E.touch1){var j=E.touch0[0],X=E.touch0[1],U=E.touch1[0],Q=E.touch1[1],G=(G=U[0]-j[0])*G+(G=U[1]-j[1])*G,L=(L=Q[0]-X[0])*L+(L=Q[1]-X[1])*L;R=b(R,Math.sqrt(G/L)),V=[(j[0]+U[0])/2,(j[1]+U[1])/2],H=[(X[0]+Q[0])/2,(X[1]+Q[1])/2]}else if(E.touch0)V=E.touch0[0],H=E.touch0[1];else return;E.zoom("touch",n(p(R,V,H),E.extent,s))}}function B(v,...C){if(this.__zooming){var E=_(this,C).event(v),A=v.changedTouches,z=A.length,M,R;for(mn(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),M=0;M<z;++M)R=A[M],E.touch0&&E.touch0[2]===R.identifier?delete E.touch0:E.touch1&&E.touch1[2]===R.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(R=de(R,this),Math.hypot(u[0]-R[0],u[1]-R[1])<y)){var V=ce(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(r=typeof v=="function"?v:$t(+v),m):r},m.filter=function(v){return arguments.length?(e=typeof v=="function"?v:$t(!!v),m):e},m.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:$t(!!v),m):o},m.extent=function(v){return arguments.length?(t=typeof v=="function"?v:$t([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):t},m.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],m):[i[0],i[1]]},m.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(c=v,m):c},m.on=function(){var v=l.on.apply(l,arguments);return v===l?m:v},m.clickDistance=function(v){return arguments.length?(x=(v=+v)*v,m):Math.sqrt(x)},m.tapDistance=function(v){return arguments.length?(y=+v,m):y},m}const me={error001:(e="react")=>`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},mt=[[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:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Be;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Be||(Be={}));var yt;(function(e){e.Partial="partial",e.Full="full"})(yt||(yt={}));const Qo={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Pe;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Pe||(Pe={}));var Gt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Gt||(Gt={}));var q;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(q||(q={}));const Ar={[q.Left]:q.Right,[q.Right]:q.Left,[q.Top]:q.Bottom,[q.Bottom]:q.Top};function Jo(e){return e===null?null:e?"valid":"invalid"}const ei=e=>"id"in e&&"source"in e&&"target"in e,Yl=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),qn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Et=(e,t=[0,0])=>{const{width:n,height:r}=Ae(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},Wl=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let s=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(o):qn(o)?o:t.nodeLookup.get(o.id));const a=s?Ut(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return rn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return on(n)},St=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=rn(n,Ut(o)),r=!0)}),r?on(n):{x:0,y:0,width:0,height:0}},Gn=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a={...ot(t,[n,r,o]),width:t.width/o,height:t.height/o},c=[];for(const l of e.values()){const{measured:d,selectable:u=!0,hidden:f=!1}=l;if(s&&!u||f)continue;const h=d.width??l.width??l.initialWidth??null,g=d.height??l.height??l.initialHeight??null,x=xt(a,tt(l)),y=(h??0)*(g??0),m=i&&x>0;(!l.internals.handleBounds||m||x>=y||l.dragging)&&c.push(l)}return c},ql=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Gl(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function Ul({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return!0;const a=Gl(e,s),c=St(a),l=Kn(c,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),!0}function ti({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??r;let u=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",me.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(u=[[c,l],[c+h,l+g]])}else a&&Xe(s.extent)&&(u=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const f=Xe(u)?je(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",me.error015())),{position:{x:f.x-c+(s.measured.width??0)*d[0],y:f.y-l+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function Kl({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(x=>x.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=ql(s,c);for(const f of c)a.has(f.id)&&!d.find(g=>g.id===f.id)&&d.push(f);if(!o)return{edges:d,nodes:s};const u=await o({nodes:s,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:s}:{edges:[],nodes:[]}:u}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),je=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:et(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ni(e,t,n){const{width:r,height:o}=Ae(n),{x:i,y:s}=n.internals.positionAbsolute;return je(e,[[i,s],[i+r,s+o]],t)}const kr=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,Un=(e,t,n=15,r=40)=>{const o=kr(e.x,r,t.width-r)*n,i=kr(e.y,r,t.height-r)*n;return[o,i]},rn=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),zn=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),on=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),tt=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=qn(e)?e.internals.positionAbsolute:Et(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Ut=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=qn(e)?e.internals.positionAbsolute:Et(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},ri=(e,t)=>on(rn(zn(e),zn(t))),xt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},$r=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),oi=(e,t)=>(n,r)=>{},Nt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),ot=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return i?Nt(a,s):a},nt=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function We(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Zl(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=We(e,n),o=We(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=We(e.top??e.y??0,n),o=We(e.bottom??e.y??0,n),i=We(e.left??e.x??0,t),s=We(e.right??e.x??0,t);return{top: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 Ql(e,t,n,r,o,i){const{x:s,y:a}=nt(e,[t,n,r]),{x:c,y:l}=nt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=o-c,u=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const Kn=(e,t,n,r,o,i)=>{const s=Zl(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),d=et(l,r,o),u=e.x+e.width/2,f=e.y+e.height/2,h=t/2-u*d,g=n/2-f*d,x=Ql(e,h,g,d,t,n),y={left:Math.min(x.left-s.left,0),top:Math.min(x.top-s.top,0),right:Math.min(x.right-s.right,0),bottom:Math.min(x.bottom-s.bottom,0)};return{x:h-y.left+y.right,y:g-y.top+y.bottom,zoom:d}},wt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Xe(e){return e!=null&&e!=="parent"}function Ae(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function ii(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function si(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function Pr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Jl(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function ef(e){return{...Zo,...e||{}}}function ft(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=pe(e),a=ot({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:c,y:l}=n?Nt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Zn=e=>({width:e.offsetWidth,height:e.offsetHeight}),ai=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},tf=["INPUT","SELECT","TEXTAREA"];function ci(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:tf.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const ui=e=>"clientX"in e,pe=(e,t)=>{var i,s;const n=ui(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},Tr=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Zn(s)}})};function li({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+o*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+r*.125,d=Math.abs(c-e),u=Math.abs(l-t);return[c,l,d,u]}function Pt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function zr({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case q.Left:return[t-Pt(t-r,i),n];case q.Right:return[t+Pt(r-t,i),n];case q.Top:return[t,n-Pt(n-o,i)];case q.Bottom:return[t,n+Pt(o-n,i)]}}function fi({sourceX:e,sourceY:t,sourcePosition:n=q.Bottom,targetX:r,targetY:o,targetPosition:i=q.Top,curvature:s=.25}){const[a,c]=zr({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[l,d]=zr({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[u,f,h,g]=li({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${r},${o}`,u,f,h,g]}function di({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[i,a,o,s]}function nf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const s=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return s+a}function rf({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=rn(Ut(e),Ut(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return xt(s,on(i))>0}const of=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,sf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),af=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",me.error006()),t;const r=n.getEdgeId||of;let o;return ei(e)?o={...e}:o={...e,id:r(e)},sf(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function hi({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=di({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const Dr={[q.Left]:{x:-1,y:0},[q.Right]:{x:1,y:0},[q.Top]:{x:0,y:-1},[q.Bottom]:{x:0,y:1}},cf=({source:e,sourcePosition:t=q.Bottom,target:n})=>t===q.Left||t===q.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Lr=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function uf({source:e,sourcePosition:t=q.Bottom,target:n,targetPosition:r=q.Top,center:o,offset:i,stepPosition:s}){const a=Dr[t],c=Dr[r],l={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},u=cf({source:l,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let g=[],x,y;const m={x:0,y:0},b={x:0,y:0},[,,p,w]=di({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(x=o.x??l.x+(d.x-l.x)*s,y=o.y??(l.y+d.y)/2):(x=o.x??(l.x+d.x)/2,y=o.y??l.y+(d.y-l.y)*s);const k=[{x,y:l.y},{x,y:d.y}],T=[{x:l.x,y},{x:d.x,y}];a[f]===h?g=f==="x"?k:T:g=f==="x"?T:k}else{const k=[{x:l.x,y:d.y}],T=[{x:d.x,y:l.y}];if(f==="x"?g=a.x===h?T:k:g=a.y===h?k:T,t===r){const v=Math.abs(e[f]-n[f]);if(v<=i){const C=Math.min(i-1,i-v);a[f]===h?m[f]=(l[f]>e[f]?-1:1)*C:b[f]=(d[f]>n[f]?-1:1)*C}}if(t!==r){const v=f==="x"?"y":"x",C=a[f]===c[v],E=l[v]>d[v],A=l[v]<d[v];(a[f]===1&&(!C&&E||C&&A)||a[f]!==1&&(!C&&A||C&&E))&&(g=f==="x"?k:T)}const F={x:l.x+m.x,y:l.y+m.y},N={x:d.x+b.x,y:d.y+b.y},$=Math.max(Math.abs(F.x-g[0].x),Math.abs(N.x-g[0].x)),B=Math.max(Math.abs(F.y-g[0].y),Math.abs(N.y-g[0].y));$>=B?(x=(F.x+N.x)/2,y=g[0].y):(x=g[0].x,y=(F.y+N.y)/2)}const S={x:l.x+m.x,y:l.y+m.y},_={x:d.x+b.x,y:d.y+b.y};return[[e,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,..._.x!==g[g.length-1].x||_.y!==g[g.length-1].y?[_]:[],n],x,y,p,w]}function lf(e,t,n,r){const o=Math.min(Lr(e,t)/2,Lr(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+o*l},${s}Q ${i},${s} ${i},${s+o*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+o*c}Q ${i},${s} ${i+o*a},${s}`}function Dn({sourceX:e,sourceY:t,sourcePosition:n=q.Bottom,targetX:r,targetY:o,targetPosition:i=q.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){const[u,f,h,g,x]=uf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:d});let y=`M${u[0].x} ${u[0].y}`;for(let m=1;m<u.length-1;m++)y+=lf(u[m-1],u[m],u[m+1],s);return y+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[y,f,h,g,x]}function Hr(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function ff(e){var u;const{sourceNode:t,targetNode:n}=e;if(!Hr(t)||!Hr(n))return null;const r=t.internals.handleBounds||Rr(t.handles),o=n.internals.handleBounds||Rr(n.handles),i=Vr((r==null?void 0:r.source)??[],e.sourceHandle),s=Vr(e.connectionMode===Je.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!s)return(u=e.onError)==null||u.call(e,"008",me.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||q.Bottom,c=(s==null?void 0:s.position)||q.Top,l=Ye(t,i,a),d=Ye(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function Rr(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Ye(e,t,n=q.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Ae(e);if(r)return{x:o+s/2,y:i+a/2};switch((t==null?void 0:t.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 Vr(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Ln(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function df(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const l=Ln(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const gi=1e3,hf=10,Qn={nodeOrigin:[0,0],nodeExtent:mt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},gf={...Qn,checkEquality:!0};function Jn(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function pf(e,t,n){const r=Jn(Qn,n);for(const o of e.values())if(o.parentId)tr(o,e,t,r);else{const i=Et(o,r.nodeOrigin),s=Xe(o.extent)?o.extent:r.nodeExtent,a=je(i,s,Ae(o));o.internals.positionAbsolute=a}}function mf(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function er(e){return e==="manual"}function Hn(e,t,n,r={}){var d,u;const o=Jn(gf,r),i={i:0},s=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!er(o.zIndexMode)?gi:0;let c=e.length>0,l=!1;t.clear(),n.clear();for(const f of e){let h=s.get(f.id);if(o.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const g=Et(f,o.nodeOrigin),x=Xe(f.extent)?f.extent:o.nodeExtent,y=je(g,x,Ae(f));h={...o.defaults,...f,measured:{width:(d=f.measured)==null?void 0:d.width,height:(u=f.measured)==null?void 0:u.height},internals:{positionAbsolute:y,handleBounds:mf(f,h),z:pi(f,a,o.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&tr(h,t,n,r,i),l||(l=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:l}}function yf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function tr(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Jn(Qn,r),l=e.parentId,d=t.get(l);if(!d){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}yf(e,n),o&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+o.i*hf),o&&d.internals.rootParentIndex!==void 0&&(o.i=d.internals.rootParentIndex);const u=i&&!er(c)?gi:0,{x:f,y:h,z:g}=xf(e,d,s,a,u,c),{positionAbsolute:x}=e.internals,y=f!==x.x||h!==x.y;(y||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:f,y:h}:x,z:g}})}function pi(e,t,n){const r=ge(e.zIndex)?e.zIndex:0;return er(n)?r:r+(e.selected?t:0)}function xf(e,t,n,r,o,i){const{x:s,y:a}=t.internals.positionAbsolute,c=Ae(e),l=Et(e,n),d=Xe(e.extent)?je(l,e.extent,c):l;let u=je({x:s+d.x,y:a+d.y},r,c);e.extent==="parent"&&(u=ni(u,c,t));const f=pi(e,o,i),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}function nr(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??tt(c),d=ri(l,a.rect);i.set(a.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var p;const d=c.internals.positionAbsolute,u=Ae(c),f=c.origin??r,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,x=Math.max(u.width,Math.round(a.width)),y=Math.max(u.height,Math.round(a.height)),m=(x-u.width)*f[0],b=(y-u.height)*f[1];(h>0||g>0||m||b)&&(o.push({id:l,type:"position",position:{x:c.position.x-h+m,y:c.position.y-g+b}}),(p=n.get(l))==null||p.forEach(w=>{e.some(S=>S.id===w.id)||o.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+g}})})),(u.width<a.width||u.height<a.height||h||g)&&o.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:x+(h?f[0]*h-m:0),height:y+(g?f[1]*g-b:0)}})}),o}function wf(e,t,n,r,o,i,s){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const x=Zn(h.nodeElement),y=g.measured.width!==x.width||g.measured.height!==x.height;if(!!(x.width&&x.height&&(y||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Xe(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=ni(w,x,t.get(g.parentId)):p&&(w=je(w,p,x));const S={...g,measured:x,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:Tr("source",h.nodeElement,b,u,g.id),target:Tr("target",h.nodeElement,b,u,g.id)}}};t.set(g.id,S),g.parentId&&tr(S,t,n,{nodeOrigin:o,zIndexMode:s}),c=!0,y&&(l.push({id:g.id,type:"dimensions",dimensions:x}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:tt(S,o)}))}}if(f.length>0){const h=nr(f,t,n,o);l.push(...h)}return{changes:l,updatedInternals:c}}async function vf({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Br(e,t,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${o}-${e}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,t)),i){s=`${o}-${e}-${i}`;const l=r.get(s)||new Map;r.set(s,l.set(n,t))}}function mi(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},l=`${o}-${s}--${i}-${a}`,d=`${i}-${a}--${o}-${s}`;Br("source",c,d,e,o,s),Br("target",c,l,e,i,a),t.set(r.id,r)}}function yi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:yi(n,t):!1}function Fr(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function bf(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!yi(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&o.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function yn({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,a,c;const o=[];for(const[l,d]of t){const u=(s=n.get(l))==null?void 0:s.internals.userNode;u&&o.push({...u,position:d.position,dragging:r})}if(!e)return[o[0],o];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:o[0],o]}function _f({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=Nt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Ef({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},d=null,u=!1,f=null,h=!1,g=!1,x=null;function y({noDragClassName:b,handleSelector:p,domNode:w,isSelectable:S,nodeId:_,nodeClickDistance:I=0}){f=ce(w);function k({x:$,y:B}){const{nodeLookup:v,nodeExtent:C,snapGrid:E,snapToGrid:A,nodeOrigin:z,onNodeDrag:M,onSelectionDrag:R,onError:V,updateNodePositions:H}=t();i={x:$,y:B};let j=!1;const X=a.size>1,U=X&&C?zn(St(a)):null,Q=X&&A?_f({dragItems:a,snapGrid:E,x:$,y:B}):null;for(const[G,L]of a){if(!v.has(G))continue;let O={x:$-L.distance.x,y:B-L.distance.y};A&&(O=Q?{x:Math.round(O.x+Q.x),y:Math.round(O.y+Q.y)}:Nt(O,E));let Z=null;if(X&&C&&!L.extent&&U){const{positionAbsolute:Y}=L.internals,J=Y.x-U.x+C[0][0],te=Y.x+L.measured.width-U.x2+C[1][0],ne=Y.y-U.y+C[0][1],ie=Y.y+L.measured.height-U.y2+C[1][1];Z=[[J,ne],[te,ie]]}const{position:K,positionAbsolute:W}=ti({nodeId:G,nextPosition:O,nodeLookup:v,nodeExtent:Z||C,nodeOrigin:z,onError:V});j=j||L.position.x!==K.x||L.position.y!==K.y,L.position=K,L.internals.positionAbsolute=W}if(g=g||j,!!j&&(H(a,!0),x&&(r||M||!_&&R))){const[G,L]=yn({nodeId:_,dragItems:a,nodeLookup:v});r==null||r(x,a,G,L),M==null||M(x,G,L),_||R==null||R(x,L)}}async function T(){if(!d)return;const{transform:$,panBy:B,autoPanSpeed:v,autoPanOnNodeDrag:C}=t();if(!C){c=!1,cancelAnimationFrame(s);return}const[E,A]=Un(l,d,v);(E!==0||A!==0)&&(i.x=(i.x??0)-E/$[2],i.y=(i.y??0)-A/$[2],await B({x:E,y:A})&&k(i)),s=requestAnimationFrame(T)}function F($){var X;const{nodeLookup:B,multiSelectionActive:v,nodesDraggable:C,transform:E,snapGrid:A,snapToGrid:z,selectNodesOnDrag:M,onNodeDragStart:R,onSelectionDragStart:V,unselectNodesAndEdges:H}=t();u=!0,(!M||!S)&&!v&&_&&((X=B.get(_))!=null&&X.selected||H()),S&&M&&_&&(e==null||e(_));const j=ft($.sourceEvent,{transform:E,snapGrid:A,snapToGrid:z,containerBounds:d});if(i=j,a=bf(B,C,j,_),a.size>0&&(n||R||!_&&V)){const[U,Q]=yn({nodeId:_,dragItems:a,nodeLookup:B});n==null||n($.sourceEvent,a,U,Q),R==null||R($.sourceEvent,U,Q),_||V==null||V($.sourceEvent,Q)}}const N=zo().clickDistance(I).on("start",$=>{const{domNode:B,nodeDragThreshold:v,transform:C,snapGrid:E,snapToGrid:A}=t();d=(B==null?void 0:B.getBoundingClientRect())||null,h=!1,g=!1,x=$.sourceEvent,v===0&&F($),i=ft($.sourceEvent,{transform:C,snapGrid:E,snapToGrid:A,containerBounds:d}),l=pe($.sourceEvent,d)}).on("drag",$=>{const{autoPanOnNodeDrag:B,transform:v,snapGrid:C,snapToGrid:E,nodeDragThreshold:A,nodeLookup:z}=t(),M=ft($.sourceEvent,{transform:v,snapGrid:C,snapToGrid:E,containerBounds:d});if(x=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||_&&!z.has(_))&&(h=!0),!h){if(!c&&B&&u&&(c=!0,T()),!u){const R=pe($.sourceEvent,d),V=R.x-l.x,H=R.y-l.y;Math.sqrt(V*V+H*H)>A&&F($)}(i.x!==M.xSnapped||i.y!==M.ySnapped)&&a&&u&&(l=pe($.sourceEvent,d),k(M))}}).on("end",$=>{if(!u||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,u=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:B,updateNodePositions:v,onNodeDragStop:C,onSelectionDragStop:E}=t();if(g&&(v(a,!1),g=!1),o||C||!_&&E){const[A,z]=yn({nodeId:_,dragItems:a,nodeLookup:B,dragging:!1});o==null||o($.sourceEvent,a,A,z),C==null||C($.sourceEvent,A,z),_||E==null||E($.sourceEvent,z)}}}).filter($=>{const B=$.target;return!$.button&&(!b||!Fr(B,`.${b}`,w))&&(!p||Fr(B,p,w))});f.call(N)}function m(){f==null||f.on(".drag",null)}return{update:y,destroy:m}}function Sf(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())xt(o,tt(i))>0&&r.push(i);return r}const Nf=250;function Mf(e,t,n,r){var a,c;let o=[],i=1/0;const s=Sf(e,n,t+Nf);for(const l of s){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of d){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:f,y:h}=Ye(l,u,u.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(o=[{...u,x:f,y:h}],i=g):g===i&&o.push({...u,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const l=r.type==="source"?"target":"source";return o.find(d=>d.type===l)??o[0]}return o[0]}function xi(e,t,n,r,o,i=!1){var l,d,u;const s=r.get(e);if(!s)return null;const a=o==="strict"?(l=s.internals.handleBounds)==null?void 0:l[t]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Ye(s,c,c.position,!0)}:c}function wi(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Cf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const vi=()=>!0;function If(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:x,onConnectEnd:y,isValidConnection:m=vi,onReconnectEnd:b,updateConnection:p,getTransform:w,getFromHandle:S,autoPanSpeed:_,dragThreshold:I=1,handleDomNode:k}){const T=ai(e.target);let F=0,N;const{x:$,y:B}=pe(e),v=wi(i,k),C=a==null?void 0:a.getBoundingClientRect();let E=!1;if(!C||!v)return;const A=xi(o,v,r,c,t);if(!A)return;let z=pe(e,C),M=!1,R=null,V=!1,H=null;function j(){if(!d||!C)return;const[K,W]=Un(z,C,_);f({x:K,y:W}),F=requestAnimationFrame(j)}const X={...A,nodeId:o,type:v,position:A.position},U=c.get(o);let G={inProgress:!0,isValid:null,from:Ye(U,X,q.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:U,to:z,toHandle:null,toPosition:Ar[X.position],toNode:null,pointer:z};function L(){E=!0,p(G),g==null||g(e,{nodeId:o,handleId:r,handleType:v})}I===0&&L();function O(K){if(!E){const{x:ie,y:le}=pe(K),xe=ie-$,we=le-B;if(!(xe*xe+we*we>I*I))return;L()}if(!S()||!X){Z(K);return}const W=w();z=pe(K,C),N=Mf(ot(z,W,!1,[1,1]),n,c,X),M||(j(),M=!0);const Y=bi(K,{handle:N,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:m,doc:T,lib:l,flowId:u,nodeLookup:c});H=Y.handleDomNode,R=Y.connection,V=Cf(!!N,Y.isValid);const J=c.get(o),te=J?Ye(J,X,q.Left,!0):G.from,ne={...G,from:te,isValid:V,to:Y.toHandle&&V?nt({x:Y.toHandle.x,y:Y.toHandle.y},W):z,toHandle:Y.toHandle,toPosition:V&&Y.toHandle?Y.toHandle.position:Ar[X.position],toNode:Y.toHandle?c.get(Y.toHandle.nodeId):null,pointer:z};p(ne),G=ne}function Z(K){if(!("touches"in K&&K.touches.length>0)){if(E){(N||H)&&R&&V&&(x==null||x(R));const{inProgress:W,...Y}=G,J={...Y,toPosition:G.toHandle?G.toPosition:null};y==null||y(K,J),i&&(b==null||b(K,J))}h(),cancelAnimationFrame(F),M=!1,V=!1,R=null,H=null,T.removeEventListener("mousemove",O),T.removeEventListener("mouseup",Z),T.removeEventListener("touchmove",O),T.removeEventListener("touchend",Z)}}T.addEventListener("mousemove",O),T.addEventListener("mouseup",Z),T.addEventListener("touchmove",O),T.addEventListener("touchend",Z)}function bi(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=vi,nodeLookup:d}){const u=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=pe(e),x=s.elementFromPoint(h,g),y=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:f,m={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const b=wi(void 0,y),p=y.getAttribute("data-nodeid"),w=y.getAttribute("data-handleid"),S=y.classList.contains("connectable"),_=y.classList.contains("connectableend");if(!p||!b)return m;const I={source:u?p:r,sourceHandle:u?w:o,target:u?r:p,targetHandle:u?o:w};m.connection=I;const T=S&&_&&(n===Je.Strict?u&&b==="source"||!u&&b==="target":p!==r||w!==o);m.isValid=T&&l(I),m.toHandle=xi(p,b,w,d,n,!0)}return m}const Rn={onPointerDown:If,isValid:bi};function Af({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=ce(e);function i({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:u=!0,zoomable:f=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),S=p.sourceEvent.ctrlKey&&wt()?10:1,_=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*d,I=w[2]*Math.pow(2,_*S);t.scaleTo(I)};let x=[0,0];const y=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(x=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const S=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],_=[S[0]-x[0],S[1]-x[1]];x=S;const I=r()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),k={x:w[0]-_[0]*I,y:w[1]-_[1]*I},T=[[0,0],[c,l]];t.setViewportConstrained({x:k.x,y:k.y,zoom:w[2]},T,a)},b=Uo().on("start",y).on("zoom",u?m:null).on("zoom.wheel",f?g:null);o.call(b,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:de}}const sn=e=>({x:e.x,y:e.y,zoom:e.k}),xn=({x:e,y:t,zoom:n})=>nn.translate(e,t).scale(n),qe=(e,t)=>e.target.closest(`.${t}`),_i=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),kf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,wn=(e,t=0,n=kf,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},Ei=e=>{const t=e.ctrlKey&&wt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function $f({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(qe(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&s){const y=de(d),m=Ei(d),b=u*Math.pow(2,m);r.scaleTo(n,b,y,d);return}const f=d.deltaMode===1?20:1;let h=o===Be.Vertical?0:d.deltaX*f,g=o===Be.Horizontal?0:d.deltaY*f;!wt()&&d.shiftKey&&o!==Be.Vertical&&(h=d.deltaY*f,g=0),r.translateBy(n,-(h/u)*i,-(g/u)*i,{internal:!0});const x=sn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,x),e.panScrollTimeout=setTimeout(()=>{l==null||l(d,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,x))}}function Pf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,a=qe(r,e);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function Tf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=sn(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function zf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&_i(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((a=i.sourceEvent)!=null&&a.internal)&&(o==null||o(i.sourceEvent,sn(i.transform)))}}function Df({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&_i(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=sn(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,c)},n?150:0)}}}function Lf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:d}){return u=>{var y;const f=e||t,h=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(qe(u,`${l}-flow__node`)||qe(u,`${l}-flow__edge`)))return!0;if(!r&&!f&&!o&&!i&&!n||s||d&&!g||qe(u,a)&&g||qe(u,c)&&(!g||o&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&((y=u.touches)==null?void 0:y.length)>1)return u.preventDefault(),!1;if(!f&&!o&&!h&&g||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&x}}function Hf({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),u=Uo().scaleExtent([t,n]).translateExtent(r),f=ce(e).call(u);b({x:o.x,y:o.y,zoom:et(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=f.on("wheel.zoom"),g=f.on("dblclick.zoom");u.wheelDelta(Ei);async function x(N,$){return f?new Promise(B=>{u==null||u.interpolate(($==null?void 0:$.interpolate)==="linear"?lt:Ht).transform(wn(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>B(!0)),N)}):!1}function y({noWheelClassName:N,noPanClassName:$,onPaneContextMenu:B,userSelectionActive:v,panOnScroll:C,panOnDrag:E,panOnScrollMode:A,panOnScrollSpeed:z,preventScrolling:M,zoomOnPinch:R,zoomOnScroll:V,zoomOnDoubleClick:H,zoomActivationKeyPressed:j,lib:X,onTransformChange:U,connectionInProgress:Q,paneClickDistance:G,selectionOnDrag:L}){v&&!l.isZoomingOrPanning&&m();const O=C&&!j&&!v;u.clickDistance(L?1/0:!ge(G)||G<0?0:G);const Z=O?$f({zoomPanValues:l,noWheelClassName:N,d3Selection:f,d3Zoom:u,panOnScrollMode:A,panOnScrollSpeed:z,zoomOnPinch:R,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Pf({noWheelClassName:N,preventScrolling:M,d3ZoomHandler:h});f.on("wheel.zoom",Z,{passive:!1});const K=Tf({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});u.on("start",K);const W=zf({zoomPanValues:l,panOnDrag:E,onPaneContextMenu:!!B,onPanZoom:i,onTransformChange:U});u.on("zoom",W);const Y=Df({zoomPanValues:l,panOnDrag:E,panOnScroll:C,onPaneContextMenu:B,onPanZoomEnd:a,onDraggingChange:c});u.on("end",Y);const J=Lf({zoomActivationKeyPressed:j,panOnDrag:E,zoomOnScroll:V,panOnScroll:C,zoomOnDoubleClick:H,zoomOnPinch:R,userSelectionActive:v,noPanClassName:$,noWheelClassName:N,lib:X,connectionInProgress:Q});u.filter(J),H?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function b(N,$,B){const v=xn(N),C=u==null?void 0:u.constrain()(v,$,B);return C&&await x(C),C}async function p(N,$){const B=xn(N);return await x(B,$),B}function w(N){if(f){const $=xn(N),B=f.property("__zoom");(B.k!==N.zoom||B.x!==N.x||B.y!==N.y)&&(u==null||u.transform(f,$,null,{sync:!0}))}}function S(){const N=f?Go(f.node()):{x:0,y:0,k:1};return{x:N.x,y:N.y,zoom:N.k}}async function _(N,$){return f?new Promise(B=>{u==null||u.interpolate(($==null?void 0:$.interpolate)==="linear"?lt:Ht).scaleTo(wn(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>B(!0)),N)}):!1}async function I(N,$){return f?new Promise(B=>{u==null||u.interpolate(($==null?void 0:$.interpolate)==="linear"?lt:Ht).scaleBy(wn(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>B(!0)),N)}):!1}function k(N){u==null||u.scaleExtent(N)}function T(N){u==null||u.translateExtent(N)}function F(N){const $=!ge(N)||N<0?0:N;u==null||u.clickDistance($)}return{update:y,destroy:m,setViewport:p,setViewportConstrained:b,getViewport:S,scaleTo:_,scaleBy:I,setScaleExtent:k,setTranslateExtent:T,syncViewport:w,setClickDistance:F}}var rt;(function(e){e.Line="line",e.Handle="handle"})(rt||(rt={}));function Rf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,a=n-r,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Or(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function ke(e,t){return Math.max(0,t-e)}function $e(e,t){return Math.max(0,e-t)}function Tt(e,t,n){return Math.max(0,t-e,e-n)}function jr(e,t){return e?!t:t}function Vf(e,t,n,r,o,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:h,ySnapped:g}=n,{minWidth:x,maxWidth:y,minHeight:m,maxHeight:b}=r,{x:p,y:w,width:S,height:_,aspectRatio:I}=e;let k=Math.floor(d?h-e.pointerX:0),T=Math.floor(u?g-e.pointerY:0);const F=S+(c?-k:k),N=_+(l?-T:T),$=-i[0]*S,B=-i[1]*_;let v=Tt(F,x,y),C=Tt(N,m,b);if(s){let z=0,M=0;c&&k<0?z=ke(p+k+$,s[0][0]):!c&&k>0&&(z=$e(p+F+$,s[1][0])),l&&T<0?M=ke(w+T+B,s[0][1]):!l&&T>0&&(M=$e(w+N+B,s[1][1])),v=Math.max(v,z),C=Math.max(C,M)}if(a){let z=0,M=0;c&&k>0?z=$e(p+k,a[0][0]):!c&&k<0&&(z=ke(p+F,a[1][0])),l&&T>0?M=$e(w+T,a[0][1]):!l&&T<0&&(M=ke(w+N,a[1][1])),v=Math.max(v,z),C=Math.max(C,M)}if(o){if(d){const z=Tt(F/I,m,b)*I;if(v=Math.max(v,z),s){let M=0;!c&&!l||c&&!l&&f?M=$e(w+B+F/I,s[1][1])*I:M=ke(w+B+(c?k:-k)/I,s[0][1])*I,v=Math.max(v,M)}if(a){let M=0;!c&&!l||c&&!l&&f?M=ke(w+F/I,a[1][1])*I:M=$e(w+(c?k:-k)/I,a[0][1])*I,v=Math.max(v,M)}}if(u){const z=Tt(N*I,x,y)/I;if(C=Math.max(C,z),s){let M=0;!c&&!l||l&&!c&&f?M=$e(p+N*I+$,s[1][0])/I:M=ke(p+(l?T:-T)*I+$,s[0][0])/I,C=Math.max(C,M)}if(a){let M=0;!c&&!l||l&&!c&&f?M=ke(p+N*I,a[1][0])/I:M=$e(p+(l?T:-T)*I,a[0][0])/I,C=Math.max(C,M)}}}T=T+(T<0?C:-C),k=k+(k<0?v:-v),o&&(f?F>N*I?T=(jr(c,l)?-k:k)/I:k=(jr(c,l)?-T:T)*I:d?(T=k/I,l=c):(k=T*I,c=l));const E=c?p+k:p,A=l?w+T:w;return{width:S+(c?-k:k),height:_+(l?-T:T),x:i[0]*k*(c?-1:1)+E,y:i[1]*T*(l?-1:1)+A}}const Si={width:0,height:0,x:0,y:0},Bf={...Si,pointerX:0,pointerY:0,aspectRatio:1};function Ff(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[r-a,o-c],[r+i-a,o+s-c]]}function Of({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=ce(e);let s={controlDirection:Or("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:d,keepAspectRatio:u,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:x,shouldResize:y}){let m={...Si},b={...Bf};s={boundaries:d,resizeDirection:f,keepAspectRatio:u,controlDirection:Or(l)};let p,w=null,S=[],_,I,k,T=!1;const F=zo().on("start",N=>{const{nodeLookup:$,transform:B,snapGrid:v,snapToGrid:C,nodeOrigin:E,paneDomNode:A}=n();if(p=$.get(t),!p)return;w=(A==null?void 0:A.getBoundingClientRect())??null;const{xSnapped:z,ySnapped:M}=ft(N.sourceEvent,{transform:B,snapGrid:v,snapToGrid:C,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:z,pointerY:M,aspectRatio:m.width/m.height},_=void 0,I=Xe(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(_=$.get(p.parentId)),_&&p.extent==="parent"&&(I=[[0,0],[_.measured.width,_.measured.height]]),S=[],k=void 0;for(const[R,V]of $)if(V.parentId===t&&(S.push({id:R,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const H=Ff(V,p,V.origin??E);k?k=[[Math.min(H[0][0],k[0][0]),Math.min(H[0][1],k[0][1])],[Math.max(H[1][0],k[1][0]),Math.max(H[1][1],k[1][1])]]:k=H}h==null||h(N,{...m})}).on("drag",N=>{const{transform:$,snapGrid:B,snapToGrid:v,nodeOrigin:C}=n(),E=ft(N.sourceEvent,{transform:$,snapGrid:B,snapToGrid:v,containerBounds:w}),A=[];if(!p)return;const{x:z,y:M,width:R,height:V}=m,H={},j=p.origin??C,{width:X,height:U,x:Q,y:G}=Vf(b,s.controlDirection,E,s.boundaries,s.keepAspectRatio,j,I,k),L=X!==R,O=U!==V,Z=Q!==z&&L,K=G!==M&&O;if(!Z&&!K&&!L&&!O)return;if((Z||K||j[0]===1||j[1]===1)&&(H.x=Z?Q:m.x,H.y=K?G:m.y,m.x=H.x,m.y=H.y,S.length>0)){const te=Q-z,ne=G-M;for(const ie of S)ie.position={x:ie.position.x-te+j[0]*(X-R),y:ie.position.y-ne+j[1]*(U-V)},A.push(ie)}if((L||O)&&(H.width=L&&(!s.resizeDirection||s.resizeDirection==="horizontal")?X:m.width,H.height=O&&(!s.resizeDirection||s.resizeDirection==="vertical")?U:m.height,m.width=H.width,m.height=H.height),_&&p.expandParent){const te=j[0]*(H.width??0);H.x&&H.x<te&&(m.x=te,b.x=b.x-(H.x-te));const ne=j[1]*(H.height??0);H.y&&H.y<ne&&(m.y=ne,b.y=b.y-(H.y-ne))}const W=Rf({width:m.width,prevWidth:R,height:m.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),Y={...m,direction:W};(y==null?void 0:y(N,Y))!==!1&&(T=!0,g==null||g(N,Y),r(H,A))}).on("end",N=>{T&&(x==null||x(N,{...m}),o==null||o({...m}),T=!1)});i.call(F)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var vn={exports:{}},bn={},_n={exports:{}},En={};/**
|
|
1
|
+
import{a as wo,g as la,c as fa,r as D,j as P}from"./react-vendor-CgLzZcV4.js";function se(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=se(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var da={value:()=>{}};function Qt(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Lt(n)}function Lt(e){this._=e}function ha(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Lt.prototype=Qt.prototype={constructor:Lt,on:function(e,t){var n=this._,r=ha(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=ga(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=dr(n[o],e.name,t);else if(t==null)for(o in n)n[o]=dr(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Lt(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function ga(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function dr(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=da,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Mn="http://www.w3.org/1999/xhtml";const hr={svg:"http://www.w3.org/2000/svg",xhtml:Mn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Jt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),hr.hasOwnProperty(t)?{space:hr[t],local:e}:e}function pa(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Mn&&t.documentElement.namespaceURI===Mn?t.createElement(e):t.createElementNS(n,e)}}function ma(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function vo(e){var t=Jt(e);return(t.local?ma:pa)(t)}function ya(){}function Bn(e){return e==null?ya:function(){return this.querySelector(e)}}function xa(e){typeof e!="function"&&(e=Bn(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=new Array(s),c,l,d=0;d<s;++d)(c=i[d])&&(l=e.call(c,c.__data__,d,i))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new ue(r,this._parents)}function wa(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function va(){return[]}function bo(e){return e==null?va:function(){return this.querySelectorAll(e)}}function ba(e){return function(){return wa(e.apply(this,arguments))}}function _a(e){typeof e=="function"?e=ba(e):e=bo(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(e.call(c,c.__data__,l,s)),o.push(c));return new ue(r,o)}function _o(e){return function(){return this.matches(e)}}function Eo(e){return function(t){return t.matches(e)}}var Ea=Array.prototype.find;function Sa(e){return function(){return Ea.call(this.children,e)}}function Na(){return this.firstElementChild}function Ma(e){return this.select(e==null?Na:Sa(typeof e=="function"?e:Eo(e)))}var Ca=Array.prototype.filter;function Ia(){return Array.from(this.children)}function Aa(e){return function(){return Ca.call(this.children,e)}}function ka(e){return this.selectAll(e==null?Ia:Aa(typeof e=="function"?e:Eo(e)))}function $a(e){typeof e!="function"&&(e=_o(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new ue(r,this._parents)}function So(e){return new Array(e.length)}function Pa(){return new ue(this._enter||this._groups.map(So),this._parents)}function Ft(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ft.prototype={constructor:Ft,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Ta(e){return function(){return e}}function za(e,t,n,r,o,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):n[s]=new Ft(e,i[s]);for(;s<c;++s)(a=t[s])&&(o[s]=a)}function Da(e,t,n,r,o,i,s){var a,c,l=new Map,d=t.length,u=i.length,f=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?o[a]=c:l.set(h,c));for(a=0;a<u;++a)h=s.call(e,i[a],a,i)+"",(c=l.get(h))?(r[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new Ft(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(f[a])===c&&(o[a]=c)}function La(e){return e.__data__}function Ha(e,t){if(!arguments.length)return Array.from(this,La);var n=t?Da:za,r=this._parents,o=this._groups;typeof e!="function"&&(e=Ta(e));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var d=r[l],u=o[l],f=u.length,h=Ra(e.call(d,d&&d.__data__,l,r)),g=h.length,x=a[l]=new Array(g),y=s[l]=new Array(g),m=c[l]=new Array(f);n(d,u,x,y,m,h,t);for(var b=0,p=0,w,S;b<g;++b)if(w=x[b]){for(b>=p&&(p=b+1);!(S=y[p])&&++p<g;);w._next=S||null}}return s=new ue(s,r),s._enter=a,s._exit=c,s}function Ra(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Va(){return new ue(this._exit||this._groups.map(So),this._parents)}function Ba(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Fa(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var l=n[c],d=r[c],u=l.length,f=a[c]=new Array(u),h,g=0;g<u;++g)(h=l[g]||d[g])&&(f[g]=h);for(;c<o;++c)a[c]=n[c];return new ue(a,this._parents)}function Oa(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function ja(e){e||(e=Xa);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),l,d=0;d<a;++d)(l=s[d])&&(c[d]=l);c.sort(t)}return new ue(o,this._parents).order()}function Xa(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ya(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Wa(){return Array.from(this)}function qa(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function Ga(){let e=0;for(const t of this)++e;return e}function Ua(){return!this.node()}function Ka(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&e.call(a,a.__data__,i,o);return this}function Za(e){return function(){this.removeAttribute(e)}}function Qa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ja(e,t){return function(){this.setAttribute(e,t)}}function ec(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function tc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function nc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function rc(e,t){var n=Jt(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Qa:Za:typeof t=="function"?n.local?nc:tc:n.local?ec:Ja)(n,t))}function No(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function oc(e){return function(){this.style.removeProperty(e)}}function ic(e,t,n){return function(){this.style.setProperty(e,t,n)}}function sc(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function ac(e,t,n){return arguments.length>1?this.each((t==null?oc:typeof t=="function"?sc:ic)(e,t,n??"")):Ze(this.node(),e)}function Ze(e,t){return e.style.getPropertyValue(t)||No(e).getComputedStyle(e,null).getPropertyValue(t)}function cc(e){return function(){delete this[e]}}function uc(e,t){return function(){this[e]=t}}function lc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function fc(e,t){return arguments.length>1?this.each((t==null?cc:typeof t=="function"?lc:uc)(e,t)):this.node()[e]}function Mo(e){return e.trim().split(/^|\s+/)}function Fn(e){return e.classList||new Co(e)}function Co(e){this._node=e,this._names=Mo(e.getAttribute("class")||"")}Co.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Io(e,t){for(var n=Fn(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Ao(e,t){for(var n=Fn(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function dc(e){return function(){Io(this,e)}}function hc(e){return function(){Ao(this,e)}}function gc(e,t){return function(){(t.apply(this,arguments)?Io:Ao)(this,e)}}function pc(e,t){var n=Mo(e+"");if(arguments.length<2){for(var r=Fn(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?gc:t?dc:hc)(n,t))}function mc(){this.textContent=""}function yc(e){return function(){this.textContent=e}}function xc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function wc(e){return arguments.length?this.each(e==null?mc:(typeof e=="function"?xc:yc)(e)):this.node().textContent}function vc(){this.innerHTML=""}function bc(e){return function(){this.innerHTML=e}}function _c(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ec(e){return arguments.length?this.each(e==null?vc:(typeof e=="function"?_c:bc)(e)):this.node().innerHTML}function Sc(){this.nextSibling&&this.parentNode.appendChild(this)}function Nc(){return this.each(Sc)}function Mc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Cc(){return this.each(Mc)}function Ic(e){var t=typeof e=="function"?e:vo(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ac(){return null}function kc(e,t){var n=typeof e=="function"?e:vo(e),r=t==null?Ac:typeof t=="function"?t:Bn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function $c(){var e=this.parentNode;e&&e.removeChild(this)}function Pc(){return this.each($c)}function Tc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Dc(e){return this.select(e?zc:Tc)}function Lc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Hc(e){return function(t){e.call(this,t,this.__data__)}}function Rc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Vc(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function Bc(e,t,n){return function(){var r=this.__on,o,i=Hc(t);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function Fc(e,t,n){var r=Rc(e+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(o=0,d=a[c];o<i;++o)if((s=r[o]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?Bc:Vc,o=0;o<i;++o)this.each(a(r[o],t,n));return this}function ko(e,t,n){var r=No(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Oc(e,t){return function(){return ko(this,e,t)}}function jc(e,t){return function(){return ko(this,e,t.apply(this,arguments))}}function Xc(e,t){return this.each((typeof t=="function"?jc:Oc)(e,t))}function*Yc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var $o=[null];function ue(e,t){this._groups=e,this._parents=t}function bt(){return new ue([[document.documentElement]],$o)}function Wc(){return this}ue.prototype=bt.prototype={constructor:ue,select:xa,selectAll:_a,selectChild:Ma,selectChildren:ka,filter:$a,data:Ha,enter:Pa,exit:Va,join:Ba,merge:Fa,selection:Wc,order:Oa,sort:ja,call:Ya,nodes:Wa,node:qa,size:Ga,empty:Ua,each:Ka,attr:rc,style:ac,property:fc,classed:pc,text:wc,html:Ec,raise:Nc,lower:Cc,append:Ic,insert:kc,remove:Pc,clone:Dc,datum:Lc,on:Fc,dispatch:Xc,[Symbol.iterator]:Yc};function ce(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],$o)}function qc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=qc(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const Gc={passive:!1},dt={capture:!0,passive:!1};function hn(e){e.stopImmediatePropagation()}function Ue(e){e.preventDefault(),e.stopImmediatePropagation()}function Po(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Ue,dt);"onselectstart"in t?n.on("selectstart.drag",Ue,dt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function To(e,t){var n=e.document.documentElement,r=ce(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ue,dt),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 Ct=e=>()=>e;function Cn(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}Cn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Uc(e){return!e.ctrlKey&&!e.button}function Kc(){return this.parentNode}function Zc(e,t){return t??{x:e.x,y:e.y}}function Qc(){return navigator.maxTouchPoints||"ontouchstart"in this}function zo(){var e=Uc,t=Kc,n=Zc,r=Qc,o={},i=Qt("start","drag","end"),s=0,a,c,l,d,u=0;function f(w){w.on("mousedown.drag",h).filter(r).on("touchstart.drag",y).on("touchmove.drag",m,Gc).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(!(d||!e.call(this,w,S))){var _=p(this,t.call(this,w,S),w,S,"mouse");_&&(ce(w.view).on("mousemove.drag",g,dt).on("mouseup.drag",x,dt),Po(w.view),hn(w),l=!1,a=w.clientX,c=w.clientY,_("start",w))}}function g(w){if(Ue(w),!l){var S=w.clientX-a,_=w.clientY-c;l=S*S+_*_>u}o.mouse("drag",w)}function x(w){ce(w.view).on("mousemove.drag mouseup.drag",null),To(w.view,l),Ue(w),o.mouse("end",w)}function y(w,S){if(e.call(this,w,S)){var _=w.changedTouches,I=t.call(this,w,S),k=_.length,T,F;for(T=0;T<k;++T)(F=p(this,I,w,S,_[T].identifier,_[T]))&&(hn(w),F("start",w,_[T]))}}function m(w){var S=w.changedTouches,_=S.length,I,k;for(I=0;I<_;++I)(k=o[S[I].identifier])&&(Ue(w),k("drag",w,S[I]))}function b(w){var S=w.changedTouches,_=S.length,I,k;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),I=0;I<_;++I)(k=o[S[I].identifier])&&(hn(w),k("end",w,S[I]))}function p(w,S,_,I,k,T){var F=i.copy(),N=de(T||_,S),$,B,v;if((v=n.call(w,new Cn("beforestart",{sourceEvent:_,target:f,identifier:k,active:s,x:N[0],y:N[1],dx:0,dy:0,dispatch:F}),I))!=null)return $=v.x-N[0]||0,B=v.y-N[1]||0,function C(E,A,z){var M=N,R;switch(E){case"start":o[k]=C,R=s++;break;case"end":delete o[k],--s;case"drag":N=de(z||A,S),R=s;break}F.call(E,w,new Cn(E,{sourceEvent:A,subject:v,target:f,identifier:k,active:R,x:N[0]+$,y:N[1]+B,dx:N[0]-M[0],dy:N[1]-M[1],dispatch:F}),I)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Ct(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:Ct(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Ct(w),f):n},f.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:Ct(!!w),f):r},f.on=function(){var w=i.on.apply(i,arguments);return w===i?f:w},f.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,f):Math.sqrt(u)},f}function On(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Do(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function _t(){}var ht=.7,Ot=1/ht,Ke="\\s*([+-]?\\d+)\\s*",gt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Jc=/^#([0-9a-f]{3,8})$/,eu=new RegExp(`^rgb\\(${Ke},${Ke},${Ke}\\)$`),tu=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),nu=new RegExp(`^rgba\\(${Ke},${Ke},${Ke},${gt}\\)$`),ru=new RegExp(`^rgba\\(${be},${be},${be},${gt}\\)$`),ou=new RegExp(`^hsl\\(${gt},${be},${be}\\)$`),iu=new RegExp(`^hsla\\(${gt},${be},${be},${gt}\\)$`),gr={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};On(_t,Fe,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:pr,formatHex:pr,formatHex8:su,formatHsl:au,formatRgb:mr,toString:mr});function pr(){return this.rgb().formatHex()}function su(){return this.rgb().formatHex8()}function au(){return Lo(this).formatHsl()}function mr(){return this.rgb().formatRgb()}function Fe(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Jc.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?yr(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?It(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?It(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=eu.exec(e))?new ae(t[1],t[2],t[3],1):(t=tu.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=nu.exec(e))?It(t[1],t[2],t[3],t[4]):(t=ru.exec(e))?It(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ou.exec(e))?vr(t[1],t[2]/100,t[3]/100,1):(t=iu.exec(e))?vr(t[1],t[2]/100,t[3]/100,t[4]):gr.hasOwnProperty(e)?yr(gr[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function yr(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function It(e,t,n,r){return r<=0&&(e=t=n=NaN),new ae(e,t,n,r)}function cu(e){return e instanceof _t||(e=Fe(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function In(e,t,n,r){return arguments.length===1?cu(e):new ae(e,t,n,r??1)}function ae(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}On(ae,In,Do(_t,{brighter(e){return e=e==null?Ot:Math.pow(Ot,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ht:Math.pow(ht,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Ve(this.r),Ve(this.g),Ve(this.b),jt(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:xr,formatHex:xr,formatHex8:uu,formatRgb:wr,toString:wr}));function xr(){return`#${Re(this.r)}${Re(this.g)}${Re(this.b)}`}function uu(){return`#${Re(this.r)}${Re(this.g)}${Re(this.b)}${Re((isNaN(this.opacity)?1:this.opacity)*255)}`}function wr(){const e=jt(this.opacity);return`${e===1?"rgb(":"rgba("}${Ve(this.r)}, ${Ve(this.g)}, ${Ve(this.b)}${e===1?")":`, ${e})`}`}function jt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ve(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Re(e){return e=Ve(e),(e<16?"0":"")+e.toString(16)}function vr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new he(e,t,n,r)}function Lo(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof _t||(e=Fe(e)),!e)return new he;if(e instanceof he)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new he(s,a,c,e.opacity)}function lu(e,t,n,r){return arguments.length===1?Lo(e):new he(e,t,n,r??1)}function he(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}On(he,lu,Do(_t,{brighter(e){return e=e==null?Ot:Math.pow(Ot,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ht:Math.pow(ht,e),new he(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new ae(gn(e>=240?e-240:e+120,o,r),gn(e,o,r),gn(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new he(br(this.h),At(this.s),At(this.l),jt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=jt(this.opacity);return`${e===1?"hsl(":"hsla("}${br(this.h)}, ${At(this.s)*100}%, ${At(this.l)*100}%${e===1?")":`, ${e})`}`}}));function br(e){return e=(e||0)%360,e<0?e+360:e}function At(e){return Math.max(0,Math.min(1,e||0))}function gn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const jn=e=>()=>e;function fu(e,t){return function(n){return e+n*t}}function du(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function hu(e){return(e=+e)==1?Ho:function(t,n){return n-t?du(t,n,e):jn(isNaN(t)?n:t)}}function Ho(e,t){var n=t-e;return n?fu(e,n):jn(isNaN(e)?t:e)}const Xt=(function e(t){var n=hu(t);function r(o,i){var s=n((o=In(o)).r,(i=In(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),l=Ho(o.opacity,i.opacity);return function(d){return o.r=s(d),o.g=a(d),o.b=c(d),o.opacity=l(d),o+""}}return r.gamma=e,r})(1);function gu(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function pu(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function mu(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=lt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function yu(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ve(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function xu(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=lt(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var An=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pn=new RegExp(An.source,"g");function wu(e){return function(){return e}}function vu(e){return function(t){return e(t)+""}}function Ro(e,t){var n=An.lastIndex=pn.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=An.exec(e))&&(o=pn.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:ve(r,o)})),n=pn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?vu(c[0].x):wu(t):(t=c.length,function(l){for(var d=0,u;d<t;++d)a[(u=c[d]).i]=u.x(l);return a.join("")})}function lt(e,t){var n=typeof t,r;return t==null||n==="boolean"?jn(t):(n==="number"?ve:n==="string"?(r=Fe(t))?(t=r,Xt):Ro:t instanceof Fe?Xt:t instanceof Date?yu:pu(t)?gu:Array.isArray(t)?mu:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?xu:ve)(e,t)}var _r=180/Math.PI,kn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vo(e,t,n,r,o,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*_r,skewX:Math.atan(c)*_r,scaleX:s,scaleY:a}}var kt;function bu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?kn:Vo(t.a,t.b,t.c,t.d,t.e,t.f)}function _u(e){return e==null||(kt||(kt=document.createElementNS("http://www.w3.org/2000/svg","g")),kt.setAttribute("transform",e),!(e=kt.transform.baseVal.consolidate()))?kn:(e=e.matrix,Vo(e.a,e.b,e.c,e.d,e.e,e.f))}function Bo(e,t,n,r){function o(l){return l.length?l.pop()+" ":""}function i(l,d,u,f,h,g){if(l!==u||d!==f){var x=h.push("translate(",null,t,null,n);g.push({i:x-4,x:ve(l,u)},{i:x-2,x:ve(d,f)})}else(u||f)&&h.push("translate("+u+t+f+n)}function s(l,d,u,f){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),f.push({i:u.push(o(u)+"rotate(",null,r)-2,x:ve(l,d)})):d&&u.push(o(u)+"rotate("+d+r)}function a(l,d,u,f){l!==d?f.push({i:u.push(o(u)+"skewX(",null,r)-2,x:ve(l,d)}):d&&u.push(o(u)+"skewX("+d+r)}function c(l,d,u,f,h,g){if(l!==u||d!==f){var x=h.push(o(h)+"scale(",null,",",null,")");g.push({i:x-4,x:ve(l,u)},{i:x-2,x:ve(d,f)})}else(u!==1||f!==1)&&h.push(o(h)+"scale("+u+","+f+")")}return function(l,d){var u=[],f=[];return l=e(l),d=e(d),i(l.translateX,l.translateY,d.translateX,d.translateY,u,f),s(l.rotate,d.rotate,u,f),a(l.skewX,d.skewX,u,f),c(l.scaleX,l.scaleY,d.scaleX,d.scaleY,u,f),l=d=null,function(h){for(var g=-1,x=f.length,y;++g<x;)u[(y=f[g]).i]=y.x(h);return u.join("")}}}var Eu=Bo(bu,"px, ","px)","deg)"),Su=Bo(_u,", ",")",")"),Nu=1e-12;function Er(e){return((e=Math.exp(e))+1/e)/2}function Mu(e){return((e=Math.exp(e))-1/e)/2}function Cu(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ht=(function e(t,n,r){function o(i,s){var a=i[0],c=i[1],l=i[2],d=s[0],u=s[1],f=s[2],h=d-a,g=u-c,x=h*h+g*g,y,m;if(x<Nu)m=Math.log(f/l)/t,y=function(I){return[a+I*h,c+I*g,l*Math.exp(t*I*m)]};else{var b=Math.sqrt(x),p=(f*f-l*l+r*x)/(2*l*n*b),w=(f*f-l*l-r*x)/(2*f*n*b),S=Math.log(Math.sqrt(p*p+1)-p),_=Math.log(Math.sqrt(w*w+1)-w);m=(_-S)/t,y=function(I){var k=I*m,T=Er(S),F=l/(n*b)*(T*Cu(t*k+S)-Mu(S));return[a+F*h,c+F*g,l*T/Er(t*k+S)]}}return y.duration=m*1e3*t/Math.SQRT2,y}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},o})(Math.SQRT2,2,4);var Qe=0,ct=0,st=0,Fo=1e3,Yt,ut,Wt=0,Oe=0,en=0,pt=typeof performance=="object"&&performance.now?performance:Date,Oo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xn(){return Oe||(Oo(Iu),Oe=pt.now()+en)}function Iu(){Oe=0}function qt(){this._call=this._time=this._next=null}qt.prototype=jo.prototype={constructor:qt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xn():+n)+(t==null?0:+t),!this._next&&ut!==this&&(ut?ut._next=this:Yt=this,ut=this),this._call=e,this._time=n,$n()},stop:function(){this._call&&(this._call=null,this._time=1/0,$n())}};function jo(e,t,n){var r=new qt;return r.restart(e,t,n),r}function Au(){Xn(),++Qe;for(var e=Yt,t;e;)(t=Oe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Sr(){Oe=(Wt=pt.now())+en,Qe=ct=0;try{Au()}finally{Qe=0,$u(),Oe=0}}function ku(){var e=pt.now(),t=e-Wt;t>Fo&&(en-=t,Wt=e)}function $u(){for(var e,t=Yt,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Yt=n);ut=e,$n(r)}function $n(e){if(!Qe){ct&&(ct=clearTimeout(ct));var t=e-Oe;t>24?(e<1/0&&(ct=setTimeout(Sr,e-pt.now()-en)),st&&(st=clearInterval(st))):(st||(Wt=pt.now(),st=setInterval(ku,Fo)),Qe=1,Oo(Sr))}}function Nr(e,t,n){var r=new qt;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Pu=Qt("start","end","cancel","interrupt"),Tu=[],Xo=0,Mr=1,Pn=2,Rt=3,Cr=4,Tn=5,Vt=6;function tn(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;zu(e,n,{name:t,index:r,group:o,on:Pu,tween:Tu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Xo})}function Yn(e,t){var n=ye(e,t);if(n.state>Xo)throw new Error("too late; already scheduled");return n}function _e(e,t){var n=ye(e,t);if(n.state>Rt)throw new Error("too late; already running");return n}function ye(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function zu(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=jo(i,0,n.time);function i(l){n.state=Mr,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var d,u,f,h;if(n.state!==Mr)return c();for(d in r)if(h=r[d],h.name===n.name){if(h.state===Rt)return Nr(s);h.state===Cr?(h.state=Vt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[d]):+d<t&&(h.state=Vt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[d])}if(Nr(function(){n.state===Rt&&(n.state=Cr,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Pn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Pn){for(n.state=Rt,o=new Array(f=n.tween.length),d=0,u=-1;d<f;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=h);o.length=u+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Tn,1),u=-1,f=o.length;++u<f;)o[u].call(e,d);n.state===Tn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Vt,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function Bt(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>Pn&&r.state<Tn,r.state=Vt,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function Du(e){return this.each(function(){Bt(this,e)})}function Lu(e,t){var n,r;return function(){var o=_e(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function Hu(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=_e(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:t,value:n},c=0,l=o.length;c<l;++c)if(o[c].name===t){o[c]=a;break}c===l&&o.push(a)}i.tween=o}}function Ru(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ye(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?Lu:Hu)(n,e,t))}function Wn(e,t,n){var r=e._id;return e.each(function(){var o=_e(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return ye(o,r).value[t]}}function Yo(e,t){var n;return(typeof t=="number"?ve:t instanceof Fe?Xt:(n=Fe(t))?(t=n,Xt):Ro)(e,t)}function Vu(e){return function(){this.removeAttribute(e)}}function Bu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Fu(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function Ou(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function ju(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Xu(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Yu(e,t){var n=Jt(e),r=n==="transform"?Su:Yo;return this.attrTween(e,typeof t=="function"?(n.local?Xu:ju)(n,r,Wn(this,"attr."+e,t)):t==null?(n.local?Bu:Vu)(n):(n.local?Ou:Fu)(n,r,t))}function Wu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function qu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Gu(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&qu(e,i)),n}return o._value=t,o}function Uu(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Wu(e,i)),n}return o._value=t,o}function Ku(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Jt(e);return this.tween(n,(r.local?Gu:Uu)(r,t))}function Zu(e,t){return function(){Yn(this,e).delay=+t.apply(this,arguments)}}function Qu(e,t){return t=+t,function(){Yn(this,e).delay=t}}function Ju(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Zu:Qu)(t,e)):ye(this.node(),t).delay}function el(e,t){return function(){_e(this,e).duration=+t.apply(this,arguments)}}function tl(e,t){return t=+t,function(){_e(this,e).duration=t}}function nl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?el:tl)(t,e)):ye(this.node(),t).duration}function rl(e,t){if(typeof t!="function")throw new Error;return function(){_e(this,e).ease=t}}function ol(e){var t=this._id;return arguments.length?this.each(rl(t,e)):ye(this.node(),t).ease}function il(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;_e(this,e).ease=n}}function sl(e){if(typeof e!="function")throw new Error;return this.each(il(this._id,e))}function al(e){typeof e!="function"&&(e=_o(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new Ie(r,this._parents,this._name,this._id)}function cl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=t[a],l=n[a],d=c.length,u=s[a]=new Array(d),f,h=0;h<d;++h)(f=c[h]||l[h])&&(u[h]=f);for(;a<r;++a)s[a]=t[a];return new Ie(s,this._parents,this._name,this._id)}function ul(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function ll(e,t,n){var r,o,i=ul(t)?Yn:_e;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function fl(e,t){var n=this._id;return arguments.length<2?ye(this.node(),n).on.on(e):this.each(ll(n,e,t))}function dl(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function hl(){return this.on("end.remove",dl(this._id))}function gl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Bn(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,l=i[s]=new Array(c),d,u,f=0;f<c;++f)(d=a[f])&&(u=e.call(d,d.__data__,f,a))&&("__data__"in d&&(u.__data__=d.__data__),l[f]=u,tn(l[f],t,n,f,l,ye(d,n)));return new Ie(i,this._parents,t,n)}function pl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=bo(e));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],l=c.length,d,u=0;u<l;++u)if(d=c[u]){for(var f=e.call(d,d.__data__,u,c),h,g=ye(d,n),x=0,y=f.length;x<y;++x)(h=f[x])&&tn(h,t,n,x,f,g);i.push(f),s.push(d)}return new Ie(i,s,t,n)}var ml=bt.prototype.constructor;function yl(){return new ml(this._groups,this._parents)}function xl(e,t){var n,r,o;return function(){var i=Ze(this,e),s=(this.style.removeProperty(e),Ze(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function Wo(e){return function(){this.style.removeProperty(e)}}function wl(e,t,n){var r,o=n+"",i;return function(){var s=Ze(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function vl(e,t,n){var r,o,i;return function(){var s=Ze(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ze(this,e))),s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a))}}function bl(e,t){var n,r,o,i="style."+t,s="end."+i,a;return function(){var c=_e(this,e),l=c.on,d=c.value[i]==null?a||(a=Wo(t)):void 0;(l!==n||o!==d)&&(r=(n=l).copy()).on(s,o=d),c.on=r}}function _l(e,t,n){var r=(e+="")=="transform"?Eu:Yo;return t==null?this.styleTween(e,xl(e,r)).on("end.style."+e,Wo(e)):typeof t=="function"?this.styleTween(e,vl(e,r,Wn(this,"style."+e,t))).each(bl(this._id,e)):this.styleTween(e,wl(e,r,t),n).on("end.style."+e,null)}function El(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Sl(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&El(e,s,n)),r}return i._value=t,i}function Nl(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Sl(e,t,n??""))}function Ml(e){return function(){this.textContent=e}}function Cl(e){return function(){var t=e(this);this.textContent=t??""}}function Il(e){return this.tween("text",typeof e=="function"?Cl(Wn(this,"text",e)):Ml(e==null?"":e+""))}function Al(e){return function(t){this.textContent=e.call(this,t)}}function kl(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&Al(o)),t}return r._value=e,r}function $l(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,kl(e))}function Pl(){for(var e=this._name,t=this._id,n=qo(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var d=ye(c,t);tn(c,e,n,l,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ie(r,this._parents,e,n)}function Tl(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var l=_e(this,r),d=l.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),o===0&&i()})}var zl=0;function Ie(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function qo(){return++zl}var Me=bt.prototype;Ie.prototype={constructor:Ie,select:gl,selectAll:pl,selectChild:Me.selectChild,selectChildren:Me.selectChildren,filter:al,merge:cl,selection:yl,transition:Pl,call:Me.call,nodes:Me.nodes,node:Me.node,size:Me.size,empty:Me.empty,each:Me.each,on:fl,attr:Yu,attrTween:Ku,style:_l,styleTween:Nl,text:Il,textTween:$l,remove:hl,tween:Ru,delay:Ju,duration:nl,ease:ol,easeVarying:sl,end:Tl,[Symbol.iterator]:Me[Symbol.iterator]};function Dl(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ll={time:null,delay:0,duration:250,ease:Dl};function Hl(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Rl(e){var t,n;e instanceof Ie?(t=e._id,e=e._name):(t=qo(),(n=Ll).time=Xn(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&tn(c,e,t,l,s,n||Hl(c,t));return new Ie(r,this._parents,e,t)}bt.prototype.interrupt=Du;bt.prototype.transition=Rl;const $t=e=>()=>e;function Vl(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Ce(e,t,n){this.k=e,this.x=t,this.y=n}Ce.prototype={constructor:Ce,scale:function(e){return e===1?this:new Ce(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ce(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var nn=new Ce(1,0,0);Go.prototype=Ce.prototype;function Go(e){for(;!e.__zoom;)if(!(e=e.parentNode))return nn;return e.__zoom}function mn(e){e.stopImmediatePropagation()}function at(e){e.preventDefault(),e.stopImmediatePropagation()}function Bl(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Fl(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ir(){return this.__zoom||nn}function Ol(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function jl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Xl(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Uo(){var e=Bl,t=Fl,n=Xl,r=Ol,o=jl,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Ht,l=Qt("start","zoom","end"),d,u,f,h=500,g=150,x=0,y=10;function m(v){v.property("__zoom",Ir).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",F).filter(o).on("touchstart.zoom",N).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,C,E,A){var z=v.selection?v.selection():v;z.property("__zoom",Ir),v!==z?S(v,C,E,A):z.interrupt().each(function(){_(this,arguments).event(A).start().zoom(null,typeof C=="function"?C.apply(this,arguments):C).end()})},m.scaleBy=function(v,C,E,A){m.scaleTo(v,function(){var z=this.__zoom.k,M=typeof C=="function"?C.apply(this,arguments):C;return z*M},E,A)},m.scaleTo=function(v,C,E,A){m.transform(v,function(){var z=t.apply(this,arguments),M=this.__zoom,R=E==null?w(z):typeof E=="function"?E.apply(this,arguments):E,V=M.invert(R),H=typeof C=="function"?C.apply(this,arguments):C;return n(p(b(M,H),R,V),z,s)},E,A)},m.translateBy=function(v,C,E,A){m.transform(v,function(){return n(this.__zoom.translate(typeof C=="function"?C.apply(this,arguments):C,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,A)},m.translateTo=function(v,C,E,A,z){m.transform(v,function(){var M=t.apply(this,arguments),R=this.__zoom,V=A==null?w(M):typeof A=="function"?A.apply(this,arguments):A;return n(nn.translate(V[0],V[1]).scale(R.k).translate(typeof C=="function"?-C.apply(this,arguments):-C,typeof E=="function"?-E.apply(this,arguments):-E),M,s)},A,z)};function b(v,C){return C=Math.max(i[0],Math.min(i[1],C)),C===v.k?v:new Ce(C,v.x,v.y)}function p(v,C,E){var A=C[0]-E[0]*v.k,z=C[1]-E[1]*v.k;return A===v.x&&z===v.y?v:new Ce(v.k,A,z)}function w(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function S(v,C,E,A){v.on("start.zoom",function(){_(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(A).end()}).tween("zoom",function(){var z=this,M=arguments,R=_(z,M).event(A),V=t.apply(z,M),H=E==null?w(V):typeof E=="function"?E.apply(z,M):E,j=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),X=z.__zoom,U=typeof C=="function"?C.apply(z,M):C,Q=c(X.invert(H).concat(j/X.k),U.invert(H).concat(j/U.k));return function(G){if(G===1)G=U;else{var L=Q(G),O=j/L[2];G=new Ce(O,H[0]-L[0]*O,H[1]-L[1]*O)}R.zoom(null,G)}})}function _(v,C,E){return!E&&v.__zooming||new I(v,C)}function I(v,C){this.that=v,this.args=C,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,C),this.taps=0}I.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,C){return this.mouse&&v!=="mouse"&&(this.mouse[1]=C.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=C.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=C.invert(this.touch1[0])),this.that.__zoom=C,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var C=ce(this.that).datum();l.call(v,this.that,new Vl(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),C)}};function k(v,...C){if(!e.apply(this,arguments))return;var E=_(this,C).event(v),A=this.__zoom,z=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,r.apply(this,arguments)))),M=de(v);if(E.wheel)(E.mouse[0][0]!==M[0]||E.mouse[0][1]!==M[1])&&(E.mouse[1]=A.invert(E.mouse[0]=M)),clearTimeout(E.wheel);else{if(A.k===z)return;E.mouse=[M,A.invert(M)],Bt(this),E.start()}at(v),E.wheel=setTimeout(R,g),E.zoom("mouse",n(p(b(A,z),E.mouse[0],E.mouse[1]),E.extent,s));function R(){E.wheel=null,E.end()}}function T(v,...C){if(f||!e.apply(this,arguments))return;var E=v.currentTarget,A=_(this,C,!0).event(v),z=ce(v.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",j,!0),M=de(v,E),R=v.clientX,V=v.clientY;Po(v.view),mn(v),A.mouse=[M,this.__zoom.invert(M)],Bt(this),A.start();function H(X){if(at(X),!A.moved){var U=X.clientX-R,Q=X.clientY-V;A.moved=U*U+Q*Q>x}A.event(X).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=de(X,E),A.mouse[1]),A.extent,s))}function j(X){z.on("mousemove.zoom mouseup.zoom",null),To(X.view,A.moved),at(X),A.event(X).end()}}function F(v,...C){if(e.apply(this,arguments)){var E=this.__zoom,A=de(v.changedTouches?v.changedTouches[0]:v,this),z=E.invert(A),M=E.k*(v.shiftKey?.5:2),R=n(p(b(E,M),A,z),t.apply(this,C),s);at(v),a>0?ce(this).transition().duration(a).call(S,R,A,v):ce(this).call(m.transform,R,A,v)}}function N(v,...C){if(e.apply(this,arguments)){var E=v.touches,A=E.length,z=_(this,C,v.changedTouches.length===A).event(v),M,R,V,H;for(mn(v),R=0;R<A;++R)V=E[R],H=de(V,this),H=[H,this.__zoom.invert(H),V.identifier],z.touch0?!z.touch1&&z.touch0[2]!==H[2]&&(z.touch1=H,z.taps=0):(z.touch0=H,M=!0,z.taps=1+!!d);d&&(d=clearTimeout(d)),M&&(z.taps<2&&(u=H[0],d=setTimeout(function(){d=null},h)),Bt(this),z.start())}}function $(v,...C){if(this.__zooming){var E=_(this,C).event(v),A=v.changedTouches,z=A.length,M,R,V,H;for(at(v),M=0;M<z;++M)R=A[M],V=de(R,this),E.touch0&&E.touch0[2]===R.identifier?E.touch0[0]=V:E.touch1&&E.touch1[2]===R.identifier&&(E.touch1[0]=V);if(R=E.that.__zoom,E.touch1){var j=E.touch0[0],X=E.touch0[1],U=E.touch1[0],Q=E.touch1[1],G=(G=U[0]-j[0])*G+(G=U[1]-j[1])*G,L=(L=Q[0]-X[0])*L+(L=Q[1]-X[1])*L;R=b(R,Math.sqrt(G/L)),V=[(j[0]+U[0])/2,(j[1]+U[1])/2],H=[(X[0]+Q[0])/2,(X[1]+Q[1])/2]}else if(E.touch0)V=E.touch0[0],H=E.touch0[1];else return;E.zoom("touch",n(p(R,V,H),E.extent,s))}}function B(v,...C){if(this.__zooming){var E=_(this,C).event(v),A=v.changedTouches,z=A.length,M,R;for(mn(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),M=0;M<z;++M)R=A[M],E.touch0&&E.touch0[2]===R.identifier?delete E.touch0:E.touch1&&E.touch1[2]===R.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(R=de(R,this),Math.hypot(u[0]-R[0],u[1]-R[1])<y)){var V=ce(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(r=typeof v=="function"?v:$t(+v),m):r},m.filter=function(v){return arguments.length?(e=typeof v=="function"?v:$t(!!v),m):e},m.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:$t(!!v),m):o},m.extent=function(v){return arguments.length?(t=typeof v=="function"?v:$t([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):t},m.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],m):[i[0],i[1]]},m.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(c=v,m):c},m.on=function(){var v=l.on.apply(l,arguments);return v===l?m:v},m.clickDistance=function(v){return arguments.length?(x=(v=+v)*v,m):Math.sqrt(x)},m.tapDistance=function(v){return arguments.length?(y=+v,m):y},m}const me={error001:(e="react")=>`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},mt=[[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:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Be;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Be||(Be={}));var yt;(function(e){e.Partial="partial",e.Full="full"})(yt||(yt={}));const Qo={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Pe;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Pe||(Pe={}));var Gt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Gt||(Gt={}));var q;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(q||(q={}));const Ar={[q.Left]:q.Right,[q.Right]:q.Left,[q.Top]:q.Bottom,[q.Bottom]:q.Top};function Jo(e){return e===null?null:e?"valid":"invalid"}const ei=e=>"id"in e&&"source"in e&&"target"in e,Yl=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),qn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Et=(e,t=[0,0])=>{const{width:n,height:r}=Ae(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},Wl=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let s=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(o):qn(o)?o:t.nodeLookup.get(o.id));const a=s?Ut(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return rn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return on(n)},St=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=rn(n,Ut(o)),r=!0)}),r?on(n):{x:0,y:0,width:0,height:0}},Gn=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a={...ot(t,[n,r,o]),width:t.width/o,height:t.height/o},c=[];for(const l of e.values()){const{measured:d,selectable:u=!0,hidden:f=!1}=l;if(s&&!u||f)continue;const h=d.width??l.width??l.initialWidth??null,g=d.height??l.height??l.initialHeight??null,x=xt(a,tt(l)),y=(h??0)*(g??0),m=i&&x>0;(!l.internals.handleBounds||m||x>=y||l.dragging)&&c.push(l)}return c},ql=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Gl(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function Ul({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return!0;const a=Gl(e,s),c=St(a),l=Kn(c,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),!0}function ti({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??r;let u=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",me.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(u=[[c,l],[c+h,l+g]])}else a&&Xe(s.extent)&&(u=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const f=Xe(u)?je(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",me.error015())),{position:{x:f.x-c+(s.measured.width??0)*d[0],y:f.y-l+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function Kl({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(x=>x.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=ql(s,c);for(const f of c)a.has(f.id)&&!d.find(g=>g.id===f.id)&&d.push(f);if(!o)return{edges:d,nodes:s};const u=await o({nodes:s,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:s}:{edges:[],nodes:[]}:u}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),je=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:et(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ni(e,t,n){const{width:r,height:o}=Ae(n),{x:i,y:s}=n.internals.positionAbsolute;return je(e,[[i,s],[i+r,s+o]],t)}const kr=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,Un=(e,t,n=15,r=40)=>{const o=kr(e.x,r,t.width-r)*n,i=kr(e.y,r,t.height-r)*n;return[o,i]},rn=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),zn=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),on=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),tt=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=qn(e)?e.internals.positionAbsolute:Et(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Ut=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=qn(e)?e.internals.positionAbsolute:Et(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},ri=(e,t)=>on(rn(zn(e),zn(t))),xt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},$r=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),oi=(e,t)=>(n,r)=>{},Nt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),ot=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return i?Nt(a,s):a},nt=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function We(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Zl(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=We(e,n),o=We(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=We(e.top??e.y??0,n),o=We(e.bottom??e.y??0,n),i=We(e.left??e.x??0,t),s=We(e.right??e.x??0,t);return{top: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 Ql(e,t,n,r,o,i){const{x:s,y:a}=nt(e,[t,n,r]),{x:c,y:l}=nt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=o-c,u=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const Kn=(e,t,n,r,o,i)=>{const s=Zl(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),d=et(l,r,o),u=e.x+e.width/2,f=e.y+e.height/2,h=t/2-u*d,g=n/2-f*d,x=Ql(e,h,g,d,t,n),y={left:Math.min(x.left-s.left,0),top:Math.min(x.top-s.top,0),right:Math.min(x.right-s.right,0),bottom:Math.min(x.bottom-s.bottom,0)};return{x:h-y.left+y.right,y:g-y.top+y.bottom,zoom:d}},wt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Xe(e){return e!=null&&e!=="parent"}function Ae(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function ii(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function si(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function Pr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Jl(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function ef(e){return{...Zo,...e||{}}}function ft(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=pe(e),a=ot({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:c,y:l}=n?Nt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Zn=e=>({width:e.offsetWidth,height:e.offsetHeight}),ai=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},tf=["INPUT","SELECT","TEXTAREA"];function ci(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:tf.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const ui=e=>"clientX"in e,pe=(e,t)=>{var i,s;const n=ui(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},Tr=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Zn(s)}})};function li({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+o*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+r*.125,d=Math.abs(c-e),u=Math.abs(l-t);return[c,l,d,u]}function Pt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function zr({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case q.Left:return[t-Pt(t-r,i),n];case q.Right:return[t+Pt(r-t,i),n];case q.Top:return[t,n-Pt(n-o,i)];case q.Bottom:return[t,n+Pt(o-n,i)]}}function fi({sourceX:e,sourceY:t,sourcePosition:n=q.Bottom,targetX:r,targetY:o,targetPosition:i=q.Top,curvature:s=.25}){const[a,c]=zr({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[l,d]=zr({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[u,f,h,g]=li({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${r},${o}`,u,f,h,g]}function di({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[i,a,o,s]}function nf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const s=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return s+a}function rf({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=rn(Ut(e),Ut(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return xt(s,on(i))>0}const of=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,sf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),af=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",me.error006()),t;const r=n.getEdgeId||of;let o;return ei(e)?o={...e}:o={...e,id:r(e)},sf(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function hi({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=di({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const Dr={[q.Left]:{x:-1,y:0},[q.Right]:{x:1,y:0},[q.Top]:{x:0,y:-1},[q.Bottom]:{x:0,y:1}},cf=({source:e,sourcePosition:t=q.Bottom,target:n})=>t===q.Left||t===q.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Lr=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function uf({source:e,sourcePosition:t=q.Bottom,target:n,targetPosition:r=q.Top,center:o,offset:i,stepPosition:s}){const a=Dr[t],c=Dr[r],l={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},u=cf({source:l,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let g=[],x,y;const m={x:0,y:0},b={x:0,y:0},[,,p,w]=di({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(x=o.x??l.x+(d.x-l.x)*s,y=o.y??(l.y+d.y)/2):(x=o.x??(l.x+d.x)/2,y=o.y??l.y+(d.y-l.y)*s);const k=[{x,y:l.y},{x,y:d.y}],T=[{x:l.x,y},{x:d.x,y}];a[f]===h?g=f==="x"?k:T:g=f==="x"?T:k}else{const k=[{x:l.x,y:d.y}],T=[{x:d.x,y:l.y}];if(f==="x"?g=a.x===h?T:k:g=a.y===h?k:T,t===r){const v=Math.abs(e[f]-n[f]);if(v<=i){const C=Math.min(i-1,i-v);a[f]===h?m[f]=(l[f]>e[f]?-1:1)*C:b[f]=(d[f]>n[f]?-1:1)*C}}if(t!==r){const v=f==="x"?"y":"x",C=a[f]===c[v],E=l[v]>d[v],A=l[v]<d[v];(a[f]===1&&(!C&&E||C&&A)||a[f]!==1&&(!C&&A||C&&E))&&(g=f==="x"?k:T)}const F={x:l.x+m.x,y:l.y+m.y},N={x:d.x+b.x,y:d.y+b.y},$=Math.max(Math.abs(F.x-g[0].x),Math.abs(N.x-g[0].x)),B=Math.max(Math.abs(F.y-g[0].y),Math.abs(N.y-g[0].y));$>=B?(x=(F.x+N.x)/2,y=g[0].y):(x=g[0].x,y=(F.y+N.y)/2)}const S={x:l.x+m.x,y:l.y+m.y},_={x:d.x+b.x,y:d.y+b.y};return[[e,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,..._.x!==g[g.length-1].x||_.y!==g[g.length-1].y?[_]:[],n],x,y,p,w]}function lf(e,t,n,r){const o=Math.min(Lr(e,t)/2,Lr(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+o*l},${s}Q ${i},${s} ${i},${s+o*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+o*c}Q ${i},${s} ${i+o*a},${s}`}function Dn({sourceX:e,sourceY:t,sourcePosition:n=q.Bottom,targetX:r,targetY:o,targetPosition:i=q.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){const[u,f,h,g,x]=uf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:d});let y=`M${u[0].x} ${u[0].y}`;for(let m=1;m<u.length-1;m++)y+=lf(u[m-1],u[m],u[m+1],s);return y+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[y,f,h,g,x]}function Hr(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function ff(e){var u;const{sourceNode:t,targetNode:n}=e;if(!Hr(t)||!Hr(n))return null;const r=t.internals.handleBounds||Rr(t.handles),o=n.internals.handleBounds||Rr(n.handles),i=Vr((r==null?void 0:r.source)??[],e.sourceHandle),s=Vr(e.connectionMode===Je.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!s)return(u=e.onError)==null||u.call(e,"008",me.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||q.Bottom,c=(s==null?void 0:s.position)||q.Top,l=Ye(t,i,a),d=Ye(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function Rr(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Ye(e,t,n=q.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Ae(e);if(r)return{x:o+s/2,y:i+a/2};switch((t==null?void 0:t.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 Vr(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Ln(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function df(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const l=Ln(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const gi=1e3,hf=10,Qn={nodeOrigin:[0,0],nodeExtent:mt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},gf={...Qn,checkEquality:!0};function Jn(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function pf(e,t,n){const r=Jn(Qn,n);for(const o of e.values())if(o.parentId)tr(o,e,t,r);else{const i=Et(o,r.nodeOrigin),s=Xe(o.extent)?o.extent:r.nodeExtent,a=je(i,s,Ae(o));o.internals.positionAbsolute=a}}function mf(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function er(e){return e==="manual"}function Hn(e,t,n,r={}){var d,u;const o=Jn(gf,r),i={i:0},s=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!er(o.zIndexMode)?gi:0;let c=e.length>0,l=!1;t.clear(),n.clear();for(const f of e){let h=s.get(f.id);if(o.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const g=Et(f,o.nodeOrigin),x=Xe(f.extent)?f.extent:o.nodeExtent,y=je(g,x,Ae(f));h={...o.defaults,...f,measured:{width:(d=f.measured)==null?void 0:d.width,height:(u=f.measured)==null?void 0:u.height},internals:{positionAbsolute:y,handleBounds:mf(f,h),z:pi(f,a,o.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&tr(h,t,n,r,i),l||(l=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:l}}function yf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function tr(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Jn(Qn,r),l=e.parentId,d=t.get(l);if(!d){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}yf(e,n),o&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+o.i*hf),o&&d.internals.rootParentIndex!==void 0&&(o.i=d.internals.rootParentIndex);const u=i&&!er(c)?gi:0,{x:f,y:h,z:g}=xf(e,d,s,a,u,c),{positionAbsolute:x}=e.internals,y=f!==x.x||h!==x.y;(y||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:f,y:h}:x,z:g}})}function pi(e,t,n){const r=ge(e.zIndex)?e.zIndex:0;return er(n)?r:r+(e.selected?t:0)}function xf(e,t,n,r,o,i){const{x:s,y:a}=t.internals.positionAbsolute,c=Ae(e),l=Et(e,n),d=Xe(e.extent)?je(l,e.extent,c):l;let u=je({x:s+d.x,y:a+d.y},r,c);e.extent==="parent"&&(u=ni(u,c,t));const f=pi(e,o,i),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}function nr(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??tt(c),d=ri(l,a.rect);i.set(a.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var p;const d=c.internals.positionAbsolute,u=Ae(c),f=c.origin??r,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,x=Math.max(u.width,Math.round(a.width)),y=Math.max(u.height,Math.round(a.height)),m=(x-u.width)*f[0],b=(y-u.height)*f[1];(h>0||g>0||m||b)&&(o.push({id:l,type:"position",position:{x:c.position.x-h+m,y:c.position.y-g+b}}),(p=n.get(l))==null||p.forEach(w=>{e.some(S=>S.id===w.id)||o.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+g}})})),(u.width<a.width||u.height<a.height||h||g)&&o.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:x+(h?f[0]*h-m:0),height:y+(g?f[1]*g-b:0)}})}),o}function wf(e,t,n,r,o,i,s){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const x=Zn(h.nodeElement),y=g.measured.width!==x.width||g.measured.height!==x.height;if(!!(x.width&&x.height&&(y||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Xe(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=ni(w,x,t.get(g.parentId)):p&&(w=je(w,p,x));const S={...g,measured:x,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:Tr("source",h.nodeElement,b,u,g.id),target:Tr("target",h.nodeElement,b,u,g.id)}}};t.set(g.id,S),g.parentId&&tr(S,t,n,{nodeOrigin:o,zIndexMode:s}),c=!0,y&&(l.push({id:g.id,type:"dimensions",dimensions:x}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:tt(S,o)}))}}if(f.length>0){const h=nr(f,t,n,o);l.push(...h)}return{changes:l,updatedInternals:c}}async function vf({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Br(e,t,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${o}-${e}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,t)),i){s=`${o}-${e}-${i}`;const l=r.get(s)||new Map;r.set(s,l.set(n,t))}}function mi(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},l=`${o}-${s}--${i}-${a}`,d=`${i}-${a}--${o}-${s}`;Br("source",c,d,e,o,s),Br("target",c,l,e,i,a),t.set(r.id,r)}}function yi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:yi(n,t):!1}function Fr(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function bf(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!yi(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&o.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function yn({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,a,c;const o=[];for(const[l,d]of t){const u=(s=n.get(l))==null?void 0:s.internals.userNode;u&&o.push({...u,position:d.position,dragging:r})}if(!e)return[o[0],o];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:o[0],o]}function _f({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=Nt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Ef({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},d=null,u=!1,f=null,h=!1,g=!1,x=null;function y({noDragClassName:b,handleSelector:p,domNode:w,isSelectable:S,nodeId:_,nodeClickDistance:I=0}){f=ce(w);function k({x:$,y:B}){const{nodeLookup:v,nodeExtent:C,snapGrid:E,snapToGrid:A,nodeOrigin:z,onNodeDrag:M,onSelectionDrag:R,onError:V,updateNodePositions:H}=t();i={x:$,y:B};let j=!1;const X=a.size>1,U=X&&C?zn(St(a)):null,Q=X&&A?_f({dragItems:a,snapGrid:E,x:$,y:B}):null;for(const[G,L]of a){if(!v.has(G))continue;let O={x:$-L.distance.x,y:B-L.distance.y};A&&(O=Q?{x:Math.round(O.x+Q.x),y:Math.round(O.y+Q.y)}:Nt(O,E));let Z=null;if(X&&C&&!L.extent&&U){const{positionAbsolute:Y}=L.internals,J=Y.x-U.x+C[0][0],te=Y.x+L.measured.width-U.x2+C[1][0],ne=Y.y-U.y+C[0][1],ie=Y.y+L.measured.height-U.y2+C[1][1];Z=[[J,ne],[te,ie]]}const{position:K,positionAbsolute:W}=ti({nodeId:G,nextPosition:O,nodeLookup:v,nodeExtent:Z||C,nodeOrigin:z,onError:V});j=j||L.position.x!==K.x||L.position.y!==K.y,L.position=K,L.internals.positionAbsolute=W}if(g=g||j,!!j&&(H(a,!0),x&&(r||M||!_&&R))){const[G,L]=yn({nodeId:_,dragItems:a,nodeLookup:v});r==null||r(x,a,G,L),M==null||M(x,G,L),_||R==null||R(x,L)}}async function T(){if(!d)return;const{transform:$,panBy:B,autoPanSpeed:v,autoPanOnNodeDrag:C}=t();if(!C){c=!1,cancelAnimationFrame(s);return}const[E,A]=Un(l,d,v);(E!==0||A!==0)&&(i.x=(i.x??0)-E/$[2],i.y=(i.y??0)-A/$[2],await B({x:E,y:A})&&k(i)),s=requestAnimationFrame(T)}function F($){var X;const{nodeLookup:B,multiSelectionActive:v,nodesDraggable:C,transform:E,snapGrid:A,snapToGrid:z,selectNodesOnDrag:M,onNodeDragStart:R,onSelectionDragStart:V,unselectNodesAndEdges:H}=t();u=!0,(!M||!S)&&!v&&_&&((X=B.get(_))!=null&&X.selected||H()),S&&M&&_&&(e==null||e(_));const j=ft($.sourceEvent,{transform:E,snapGrid:A,snapToGrid:z,containerBounds:d});if(i=j,a=bf(B,C,j,_),a.size>0&&(n||R||!_&&V)){const[U,Q]=yn({nodeId:_,dragItems:a,nodeLookup:B});n==null||n($.sourceEvent,a,U,Q),R==null||R($.sourceEvent,U,Q),_||V==null||V($.sourceEvent,Q)}}const N=zo().clickDistance(I).on("start",$=>{const{domNode:B,nodeDragThreshold:v,transform:C,snapGrid:E,snapToGrid:A}=t();d=(B==null?void 0:B.getBoundingClientRect())||null,h=!1,g=!1,x=$.sourceEvent,v===0&&F($),i=ft($.sourceEvent,{transform:C,snapGrid:E,snapToGrid:A,containerBounds:d}),l=pe($.sourceEvent,d)}).on("drag",$=>{const{autoPanOnNodeDrag:B,transform:v,snapGrid:C,snapToGrid:E,nodeDragThreshold:A,nodeLookup:z}=t(),M=ft($.sourceEvent,{transform:v,snapGrid:C,snapToGrid:E,containerBounds:d});if(x=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||_&&!z.has(_))&&(h=!0),!h){if(!c&&B&&u&&(c=!0,T()),!u){const R=pe($.sourceEvent,d),V=R.x-l.x,H=R.y-l.y;Math.sqrt(V*V+H*H)>A&&F($)}(i.x!==M.xSnapped||i.y!==M.ySnapped)&&a&&u&&(l=pe($.sourceEvent,d),k(M))}}).on("end",$=>{if(!u||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,u=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:B,updateNodePositions:v,onNodeDragStop:C,onSelectionDragStop:E}=t();if(g&&(v(a,!1),g=!1),o||C||!_&&E){const[A,z]=yn({nodeId:_,dragItems:a,nodeLookup:B,dragging:!1});o==null||o($.sourceEvent,a,A,z),C==null||C($.sourceEvent,A,z),_||E==null||E($.sourceEvent,z)}}}).filter($=>{const B=$.target;return!$.button&&(!b||!Fr(B,`.${b}`,w))&&(!p||Fr(B,p,w))});f.call(N)}function m(){f==null||f.on(".drag",null)}return{update:y,destroy:m}}function Sf(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())xt(o,tt(i))>0&&r.push(i);return r}const Nf=250;function Mf(e,t,n,r){var a,c;let o=[],i=1/0;const s=Sf(e,n,t+Nf);for(const l of s){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of d){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:f,y:h}=Ye(l,u,u.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(o=[{...u,x:f,y:h}],i=g):g===i&&o.push({...u,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const l=r.type==="source"?"target":"source";return o.find(d=>d.type===l)??o[0]}return o[0]}function xi(e,t,n,r,o,i=!1){var l,d,u;const s=r.get(e);if(!s)return null;const a=o==="strict"?(l=s.internals.handleBounds)==null?void 0:l[t]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Ye(s,c,c.position,!0)}:c}function wi(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Cf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const vi=()=>!0;function If(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:x,onConnectEnd:y,isValidConnection:m=vi,onReconnectEnd:b,updateConnection:p,getTransform:w,getFromHandle:S,autoPanSpeed:_,dragThreshold:I=1,handleDomNode:k}){const T=ai(e.target);let F=0,N;const{x:$,y:B}=pe(e),v=wi(i,k),C=a==null?void 0:a.getBoundingClientRect();let E=!1;if(!C||!v)return;const A=xi(o,v,r,c,t);if(!A)return;let z=pe(e,C),M=!1,R=null,V=!1,H=null;function j(){if(!d||!C)return;const[K,W]=Un(z,C,_);f({x:K,y:W}),F=requestAnimationFrame(j)}const X={...A,nodeId:o,type:v,position:A.position},U=c.get(o);let G={inProgress:!0,isValid:null,from:Ye(U,X,q.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:U,to:z,toHandle:null,toPosition:Ar[X.position],toNode:null,pointer:z};function L(){E=!0,p(G),g==null||g(e,{nodeId:o,handleId:r,handleType:v})}I===0&&L();function O(K){if(!E){const{x:ie,y:le}=pe(K),xe=ie-$,we=le-B;if(!(xe*xe+we*we>I*I))return;L()}if(!S()||!X){Z(K);return}const W=w();z=pe(K,C),N=Mf(ot(z,W,!1,[1,1]),n,c,X),M||(j(),M=!0);const Y=bi(K,{handle:N,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:m,doc:T,lib:l,flowId:u,nodeLookup:c});H=Y.handleDomNode,R=Y.connection,V=Cf(!!N,Y.isValid);const J=c.get(o),te=J?Ye(J,X,q.Left,!0):G.from,ne={...G,from:te,isValid:V,to:Y.toHandle&&V?nt({x:Y.toHandle.x,y:Y.toHandle.y},W):z,toHandle:Y.toHandle,toPosition:V&&Y.toHandle?Y.toHandle.position:Ar[X.position],toNode:Y.toHandle?c.get(Y.toHandle.nodeId):null,pointer:z};p(ne),G=ne}function Z(K){if(!("touches"in K&&K.touches.length>0)){if(E){(N||H)&&R&&V&&(x==null||x(R));const{inProgress:W,...Y}=G,J={...Y,toPosition:G.toHandle?G.toPosition:null};y==null||y(K,J),i&&(b==null||b(K,J))}h(),cancelAnimationFrame(F),M=!1,V=!1,R=null,H=null,T.removeEventListener("mousemove",O),T.removeEventListener("mouseup",Z),T.removeEventListener("touchmove",O),T.removeEventListener("touchend",Z)}}T.addEventListener("mousemove",O),T.addEventListener("mouseup",Z),T.addEventListener("touchmove",O),T.addEventListener("touchend",Z)}function bi(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=vi,nodeLookup:d}){const u=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=pe(e),x=s.elementFromPoint(h,g),y=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:f,m={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const b=wi(void 0,y),p=y.getAttribute("data-nodeid"),w=y.getAttribute("data-handleid"),S=y.classList.contains("connectable"),_=y.classList.contains("connectableend");if(!p||!b)return m;const I={source:u?p:r,sourceHandle:u?w:o,target:u?r:p,targetHandle:u?o:w};m.connection=I;const T=S&&_&&(n===Je.Strict?u&&b==="source"||!u&&b==="target":p!==r||w!==o);m.isValid=T&&l(I),m.toHandle=xi(p,b,w,d,n,!0)}return m}const Rn={onPointerDown:If,isValid:bi};function Af({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=ce(e);function i({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:u=!0,zoomable:f=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),S=p.sourceEvent.ctrlKey&&wt()?10:1,_=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*d,I=w[2]*Math.pow(2,_*S);t.scaleTo(I)};let x=[0,0];const y=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(x=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const S=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],_=[S[0]-x[0],S[1]-x[1]];x=S;const I=r()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),k={x:w[0]-_[0]*I,y:w[1]-_[1]*I},T=[[0,0],[c,l]];t.setViewportConstrained({x:k.x,y:k.y,zoom:w[2]},T,a)},b=Uo().on("start",y).on("zoom",u?m:null).on("zoom.wheel",f?g:null);o.call(b,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:de}}const sn=e=>({x:e.x,y:e.y,zoom:e.k}),xn=({x:e,y:t,zoom:n})=>nn.translate(e,t).scale(n),qe=(e,t)=>e.target.closest(`.${t}`),_i=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),kf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,wn=(e,t=0,n=kf,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},Ei=e=>{const t=e.ctrlKey&&wt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function $f({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(qe(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&s){const y=de(d),m=Ei(d),b=u*Math.pow(2,m);r.scaleTo(n,b,y,d);return}const f=d.deltaMode===1?20:1;let h=o===Be.Vertical?0:d.deltaX*f,g=o===Be.Horizontal?0:d.deltaY*f;!wt()&&d.shiftKey&&o!==Be.Vertical&&(h=d.deltaY*f,g=0),r.translateBy(n,-(h/u)*i,-(g/u)*i,{internal:!0});const x=sn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,x),e.panScrollTimeout=setTimeout(()=>{l==null||l(d,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,x))}}function Pf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,a=qe(r,e);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function Tf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=sn(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function zf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&_i(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((a=i.sourceEvent)!=null&&a.internal)&&(o==null||o(i.sourceEvent,sn(i.transform)))}}function Df({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&_i(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=sn(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,c)},n?150:0)}}}function Lf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:d}){return u=>{var y;const f=e||t,h=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(qe(u,`${l}-flow__node`)||qe(u,`${l}-flow__edge`)))return!0;if(!r&&!f&&!o&&!i&&!n||s||d&&!g||qe(u,a)&&g||qe(u,c)&&(!g||o&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&((y=u.touches)==null?void 0:y.length)>1)return u.preventDefault(),!1;if(!f&&!o&&!h&&g||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&x}}function Hf({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),u=Uo().scaleExtent([t,n]).translateExtent(r),f=ce(e).call(u);b({x:o.x,y:o.y,zoom:et(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=f.on("wheel.zoom"),g=f.on("dblclick.zoom");u.wheelDelta(Ei);async function x(N,$){return f?new Promise(B=>{u==null||u.interpolate(($==null?void 0:$.interpolate)==="linear"?lt:Ht).transform(wn(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>B(!0)),N)}):!1}function y({noWheelClassName:N,noPanClassName:$,onPaneContextMenu:B,userSelectionActive:v,panOnScroll:C,panOnDrag:E,panOnScrollMode:A,panOnScrollSpeed:z,preventScrolling:M,zoomOnPinch:R,zoomOnScroll:V,zoomOnDoubleClick:H,zoomActivationKeyPressed:j,lib:X,onTransformChange:U,connectionInProgress:Q,paneClickDistance:G,selectionOnDrag:L}){v&&!l.isZoomingOrPanning&&m();const O=C&&!j&&!v;u.clickDistance(L?1/0:!ge(G)||G<0?0:G);const Z=O?$f({zoomPanValues:l,noWheelClassName:N,d3Selection:f,d3Zoom:u,panOnScrollMode:A,panOnScrollSpeed:z,zoomOnPinch:R,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Pf({noWheelClassName:N,preventScrolling:M,d3ZoomHandler:h});f.on("wheel.zoom",Z,{passive:!1});const K=Tf({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});u.on("start",K);const W=zf({zoomPanValues:l,panOnDrag:E,onPaneContextMenu:!!B,onPanZoom:i,onTransformChange:U});u.on("zoom",W);const Y=Df({zoomPanValues:l,panOnDrag:E,panOnScroll:C,onPaneContextMenu:B,onPanZoomEnd:a,onDraggingChange:c});u.on("end",Y);const J=Lf({zoomActivationKeyPressed:j,panOnDrag:E,zoomOnScroll:V,panOnScroll:C,zoomOnDoubleClick:H,zoomOnPinch:R,userSelectionActive:v,noPanClassName:$,noWheelClassName:N,lib:X,connectionInProgress:Q});u.filter(J),H?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function b(N,$,B){const v=xn(N),C=u==null?void 0:u.constrain()(v,$,B);return C&&await x(C),C}async function p(N,$){const B=xn(N);return await x(B,$),B}function w(N){if(f){const $=xn(N),B=f.property("__zoom");(B.k!==N.zoom||B.x!==N.x||B.y!==N.y)&&(u==null||u.transform(f,$,null,{sync:!0}))}}function S(){const N=f?Go(f.node()):{x:0,y:0,k:1};return{x:N.x,y:N.y,zoom:N.k}}async function _(N,$){return f?new Promise(B=>{u==null||u.interpolate(($==null?void 0:$.interpolate)==="linear"?lt:Ht).scaleTo(wn(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>B(!0)),N)}):!1}async function I(N,$){return f?new Promise(B=>{u==null||u.interpolate(($==null?void 0:$.interpolate)==="linear"?lt:Ht).scaleBy(wn(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>B(!0)),N)}):!1}function k(N){u==null||u.scaleExtent(N)}function T(N){u==null||u.translateExtent(N)}function F(N){const $=!ge(N)||N<0?0:N;u==null||u.clickDistance($)}return{update:y,destroy:m,setViewport:p,setViewportConstrained:b,getViewport:S,scaleTo:_,scaleBy:I,setScaleExtent:k,setTranslateExtent:T,syncViewport:w,setClickDistance:F}}var rt;(function(e){e.Line="line",e.Handle="handle"})(rt||(rt={}));function Rf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,a=n-r,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Or(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function ke(e,t){return Math.max(0,t-e)}function $e(e,t){return Math.max(0,e-t)}function Tt(e,t,n){return Math.max(0,t-e,e-n)}function jr(e,t){return e?!t:t}function Vf(e,t,n,r,o,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:h,ySnapped:g}=n,{minWidth:x,maxWidth:y,minHeight:m,maxHeight:b}=r,{x:p,y:w,width:S,height:_,aspectRatio:I}=e;let k=Math.floor(d?h-e.pointerX:0),T=Math.floor(u?g-e.pointerY:0);const F=S+(c?-k:k),N=_+(l?-T:T),$=-i[0]*S,B=-i[1]*_;let v=Tt(F,x,y),C=Tt(N,m,b);if(s){let z=0,M=0;c&&k<0?z=ke(p+k+$,s[0][0]):!c&&k>0&&(z=$e(p+F+$,s[1][0])),l&&T<0?M=ke(w+T+B,s[0][1]):!l&&T>0&&(M=$e(w+N+B,s[1][1])),v=Math.max(v,z),C=Math.max(C,M)}if(a){let z=0,M=0;c&&k>0?z=$e(p+k,a[0][0]):!c&&k<0&&(z=ke(p+F,a[1][0])),l&&T>0?M=$e(w+T,a[0][1]):!l&&T<0&&(M=ke(w+N,a[1][1])),v=Math.max(v,z),C=Math.max(C,M)}if(o){if(d){const z=Tt(F/I,m,b)*I;if(v=Math.max(v,z),s){let M=0;!c&&!l||c&&!l&&f?M=$e(w+B+F/I,s[1][1])*I:M=ke(w+B+(c?k:-k)/I,s[0][1])*I,v=Math.max(v,M)}if(a){let M=0;!c&&!l||c&&!l&&f?M=ke(w+F/I,a[1][1])*I:M=$e(w+(c?k:-k)/I,a[0][1])*I,v=Math.max(v,M)}}if(u){const z=Tt(N*I,x,y)/I;if(C=Math.max(C,z),s){let M=0;!c&&!l||l&&!c&&f?M=$e(p+N*I+$,s[1][0])/I:M=ke(p+(l?T:-T)*I+$,s[0][0])/I,C=Math.max(C,M)}if(a){let M=0;!c&&!l||l&&!c&&f?M=ke(p+N*I,a[1][0])/I:M=$e(p+(l?T:-T)*I,a[0][0])/I,C=Math.max(C,M)}}}T=T+(T<0?C:-C),k=k+(k<0?v:-v),o&&(f?F>N*I?T=(jr(c,l)?-k:k)/I:k=(jr(c,l)?-T:T)*I:d?(T=k/I,l=c):(k=T*I,c=l));const E=c?p+k:p,A=l?w+T:w;return{width:S+(c?-k:k),height:_+(l?-T:T),x:i[0]*k*(c?-1:1)+E,y:i[1]*T*(l?-1:1)+A}}const Si={width:0,height:0,x:0,y:0},Bf={...Si,pointerX:0,pointerY:0,aspectRatio:1};function Ff(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[r-a,o-c],[r+i-a,o+s-c]]}function Of({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=ce(e);let s={controlDirection:Or("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:d,keepAspectRatio:u,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:x,shouldResize:y}){let m={...Si},b={...Bf};s={boundaries:d,resizeDirection:f,keepAspectRatio:u,controlDirection:Or(l)};let p,w=null,S=[],_,I,k,T=!1;const F=zo().on("start",N=>{const{nodeLookup:$,transform:B,snapGrid:v,snapToGrid:C,nodeOrigin:E,paneDomNode:A}=n();if(p=$.get(t),!p)return;w=(A==null?void 0:A.getBoundingClientRect())??null;const{xSnapped:z,ySnapped:M}=ft(N.sourceEvent,{transform:B,snapGrid:v,snapToGrid:C,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:z,pointerY:M,aspectRatio:m.width/m.height},_=void 0,I=Xe(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(_=$.get(p.parentId)),_&&p.extent==="parent"&&(I=[[0,0],[_.measured.width,_.measured.height]]),S=[],k=void 0;for(const[R,V]of $)if(V.parentId===t&&(S.push({id:R,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const H=Ff(V,p,V.origin??E);k?k=[[Math.min(H[0][0],k[0][0]),Math.min(H[0][1],k[0][1])],[Math.max(H[1][0],k[1][0]),Math.max(H[1][1],k[1][1])]]:k=H}h==null||h(N,{...m})}).on("drag",N=>{const{transform:$,snapGrid:B,snapToGrid:v,nodeOrigin:C}=n(),E=ft(N.sourceEvent,{transform:$,snapGrid:B,snapToGrid:v,containerBounds:w}),A=[];if(!p)return;const{x:z,y:M,width:R,height:V}=m,H={},j=p.origin??C,{width:X,height:U,x:Q,y:G}=Vf(b,s.controlDirection,E,s.boundaries,s.keepAspectRatio,j,I,k),L=X!==R,O=U!==V,Z=Q!==z&&L,K=G!==M&&O;if(!Z&&!K&&!L&&!O)return;if((Z||K||j[0]===1||j[1]===1)&&(H.x=Z?Q:m.x,H.y=K?G:m.y,m.x=H.x,m.y=H.y,S.length>0)){const te=Q-z,ne=G-M;for(const ie of S)ie.position={x:ie.position.x-te+j[0]*(X-R),y:ie.position.y-ne+j[1]*(U-V)},A.push(ie)}if((L||O)&&(H.width=L&&(!s.resizeDirection||s.resizeDirection==="horizontal")?X:m.width,H.height=O&&(!s.resizeDirection||s.resizeDirection==="vertical")?U:m.height,m.width=H.width,m.height=H.height),_&&p.expandParent){const te=j[0]*(H.width??0);H.x&&H.x<te&&(m.x=te,b.x=b.x-(H.x-te));const ne=j[1]*(H.height??0);H.y&&H.y<ne&&(m.y=ne,b.y=b.y-(H.y-ne))}const W=Rf({width:m.width,prevWidth:R,height:m.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),Y={...m,direction:W};(y==null?void 0:y(N,Y))!==!1&&(T=!0,g==null||g(N,Y),r(H,A))}).on("end",N=>{T&&(x==null||x(N,{...m}),o==null||o({...m}),T=!1)});i.call(F)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var vn={exports:{}},bn={},_n={exports:{}},En={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* use-sync-external-store-shim.production.js
|
|
4
4
|
*
|